@aibee/crc-bmap 0.13.24 → 0.13.25

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,14 +1,14 @@
1
- var $D=Object.create;var U1=Object.defineProperty;var ZD=Object.getOwnPropertyDescriptor;var JD=Object.getOwnPropertyNames;var jD=Object.getPrototypeOf,KD=Object.prototype.hasOwnProperty;var X=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var QD=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of JD(t))!KD.call(n,s)&&s!==e&&U1(n,s,{get:()=>t[s],enumerable:!(i=ZD(t,s))||i.enumerable});return n};var Jt=(n,t,e)=>(e=n!=null?$D(jD(n)):{},QD(t||!n||!n.__esModule?U1(e,"default",{value:n,enumerable:!0}):e,n));var Ri=(n,t,e)=>new Promise((i,s)=>{var u=p=>{try{f(e.next(p))}catch(d){s(d)}},c=p=>{try{f(e.throw(p))}catch(d){s(d)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,c);f((e=e.apply(n,t)).next())});var Sn=X((zg,B1)=>{"use strict";var Mc=function(n){return n&&n.Math===Math&&n};B1.exports=Mc(typeof globalThis=="object"&&globalThis)||Mc(typeof window=="object"&&window)||Mc(typeof self=="object"&&self)||Mc(typeof global=="object"&&global)||Mc(typeof zg=="object"&&zg)||function(){return this}()||Function("return this")()});var An=X((vet,z1)=>{"use strict";z1.exports=function(n){try{return!!n()}catch(t){return!0}}});var ri=X((_et,G1)=>{"use strict";var t3=An();G1.exports=!t3(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var bc=X((xet,k1)=>{"use strict";var e3=An();k1.exports=!e3(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var vr=X((Eet,q1)=>{"use strict";var n3=bc(),eh=Function.prototype.call;q1.exports=n3?eh.bind(eh):function(){return eh.apply(eh,arguments)}});var X1=X(W1=>{"use strict";var V1={}.propertyIsEnumerable,H1=Object.getOwnPropertyDescriptor,r3=H1&&!V1.call({1:2},1);W1.f=r3?function(t){var e=H1(this,t);return!!e&&e.enumerable}:V1});var Ac=X((Met,Y1)=>{"use strict";Y1.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var In=X((bet,J1)=>{"use strict";var $1=bc(),Z1=Function.prototype,Gg=Z1.call,i3=$1&&Z1.bind.bind(Gg,Gg);J1.exports=$1?i3:function(n){return function(){return Gg.apply(n,arguments)}}});var vs=X((Aet,K1)=>{"use strict";var j1=In(),o3=j1({}.toString),s3=j1("".slice);K1.exports=function(n){return s3(o3(n),8,-1)}});var nh=X((Tet,Q1)=>{"use strict";var a3=In(),u3=An(),l3=vs(),kg=Object,c3=a3("".split);Q1.exports=u3(function(){return!kg("z").propertyIsEnumerable(0)})?function(n){return l3(n)==="String"?c3(n,""):kg(n)}:kg});var rh=X((Cet,tE)=>{"use strict";tE.exports=function(n){return n==null}});var zu=X((Iet,eE)=>{"use strict";var f3=rh(),h3=TypeError;eE.exports=function(n){if(f3(n))throw new h3("Can't call method on "+n);return n}});var Gu=X((Pet,nE)=>{"use strict";var p3=nh(),d3=zu();nE.exports=function(n){return p3(d3(n))}});var er=X((Ret,rE)=>{"use strict";var qg=typeof document=="object"&&document.all;rE.exports=typeof qg=="undefined"&&qg!==void 0?function(n){return typeof n=="function"||n===qg}:function(n){return typeof n=="function"}});var Ei=X((Let,iE)=>{"use strict";var g3=er();iE.exports=function(n){return typeof n=="object"?n!==null:g3(n)}});var $s=X((Net,oE)=>{"use strict";var Vg=Sn(),m3=er(),y3=function(n){return m3(n)?n:void 0};oE.exports=function(n,t){return arguments.length<2?y3(Vg[n]):Vg[n]&&Vg[n][t]}});var Tc=X((Oet,sE)=>{"use strict";var v3=In();sE.exports=v3({}.isPrototypeOf)});var ku=X((Det,lE)=>{"use strict";var _3=Sn(),aE=_3.navigator,uE=aE&&aE.userAgent;lE.exports=uE?String(uE):""});var Cc=X((Fet,gE)=>{"use strict";var dE=Sn(),Hg=ku(),cE=dE.process,fE=dE.Deno,hE=cE&&cE.versions||fE&&fE.version,pE=hE&&hE.v8,wo,ih;pE&&(wo=pE.split("."),ih=wo[0]>0&&wo[0]<4?1:+(wo[0]+wo[1]));!ih&&Hg&&(wo=Hg.match(/Edge\/(\d+)/),(!wo||wo[1]>=74)&&(wo=Hg.match(/Chrome\/(\d+)/),wo&&(ih=+wo[1])));gE.exports=ih});var oh=X((Uet,yE)=>{"use strict";var mE=Cc(),x3=An(),E3=Sn(),S3=E3.String;yE.exports=!!Object.getOwnPropertySymbols&&!x3(function(){var n=Symbol("symbol detection");return!S3(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&mE&&mE<41})});var Wg=X((Bet,vE)=>{"use strict";var w3=oh();vE.exports=w3&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ic=X((zet,_E)=>{"use strict";var M3=$s(),b3=er(),A3=Tc(),T3=Wg(),C3=Object;_E.exports=T3?function(n){return typeof n=="symbol"}:function(n){var t=M3("Symbol");return b3(t)&&A3(t.prototype,C3(n))}});var qu=X((Get,xE)=>{"use strict";var I3=String;xE.exports=function(n){try{return I3(n)}catch(t){return"Object"}}});var _s=X((ket,EE)=>{"use strict";var P3=er(),R3=qu(),L3=TypeError;EE.exports=function(n){if(P3(n))return n;throw new L3(R3(n)+" is not a function")}});var Pc=X((qet,SE)=>{"use strict";var N3=_s(),O3=rh();SE.exports=function(n,t){var e=n[t];return O3(e)?void 0:N3(e)}});var ME=X((Vet,wE)=>{"use strict";var Xg=vr(),Yg=er(),$g=Ei(),D3=TypeError;wE.exports=function(n,t){var e,i;if(t==="string"&&Yg(e=n.toString)&&!$g(i=Xg(e,n))||Yg(e=n.valueOf)&&!$g(i=Xg(e,n))||t!=="string"&&Yg(e=n.toString)&&!$g(i=Xg(e,n)))return i;throw new D3("Can't convert object to primitive value")}});var Rc=X((Het,bE)=>{"use strict";bE.exports=!1});var sh=X((Wet,TE)=>{"use strict";var AE=Sn(),F3=Object.defineProperty;TE.exports=function(n,t){try{F3(AE,n,{value:t,configurable:!0,writable:!0})}catch(e){AE[n]=t}return t}});var ah=X((Xet,PE)=>{"use strict";var U3=Rc(),B3=Sn(),z3=sh(),CE="__core-js_shared__",IE=PE.exports=B3[CE]||z3(CE,{});(IE.versions||(IE.versions=[])).push({version:"3.42.0",mode:U3?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var uh=X((Yet,LE)=>{"use strict";var RE=ah();LE.exports=function(n,t){return RE[n]||(RE[n]=t||{})}});var Vi=X(($et,NE)=>{"use strict";var G3=zu(),k3=Object;NE.exports=function(n){return k3(G3(n))}});var oo=X((Zet,OE)=>{"use strict";var q3=In(),V3=Vi(),H3=q3({}.hasOwnProperty);OE.exports=Object.hasOwn||function(t,e){return H3(V3(t),e)}});var lh=X((Jet,DE)=>{"use strict";var W3=In(),X3=0,Y3=Math.random(),$3=W3(1 .toString);DE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+$3(++X3+Y3,36)}});var Xr=X((jet,UE)=>{"use strict";var Z3=Sn(),J3=uh(),FE=oo(),j3=lh(),K3=oh(),Q3=Wg(),Vu=Z3.Symbol,Zg=J3("wks"),tF=Q3?Vu.for||Vu:Vu&&Vu.withoutSetter||j3;UE.exports=function(n){return FE(Zg,n)||(Zg[n]=K3&&FE(Vu,n)?Vu[n]:tF("Symbol."+n)),Zg[n]}});var Jg=X((Ket,GE)=>{"use strict";var eF=vr(),BE=Ei(),zE=Ic(),nF=Pc(),rF=ME(),iF=Xr(),oF=TypeError,sF=iF("toPrimitive");GE.exports=function(n,t){if(!BE(n)||zE(n))return n;var e=nF(n,sF),i;if(e){if(t===void 0&&(t="default"),i=eF(e,n,t),!BE(i)||zE(i))return i;throw new oF("Can't convert object to primitive value")}return t===void 0&&(t="number"),rF(n,t)}});var ch=X((Qet,kE)=>{"use strict";var aF=Jg(),uF=Ic();kE.exports=function(n){var t=aF(n,"string");return uF(t)?t:t+""}});var fh=X((tnt,VE)=>{"use strict";var lF=Sn(),qE=Ei(),jg=lF.document,cF=qE(jg)&&qE(jg.createElement);VE.exports=function(n){return cF?jg.createElement(n):{}}});var Kg=X((ent,HE)=>{"use strict";var fF=ri(),hF=An(),pF=fh();HE.exports=!fF&&!hF(function(){return Object.defineProperty(pF("div"),"a",{get:function(){return 7}}).a!==7})});var hh=X(XE=>{"use strict";var dF=ri(),gF=vr(),mF=X1(),yF=Ac(),vF=Gu(),_F=ch(),xF=oo(),EF=Kg(),WE=Object.getOwnPropertyDescriptor;XE.f=dF?WE:function(t,e){if(t=vF(t),e=_F(e),EF)try{return WE(t,e)}catch(i){}if(xF(t,e))return yF(!gF(mF.f,t,e),t[e])}});var Qg=X((rnt,YE)=>{"use strict";var SF=ri(),wF=An();YE.exports=SF&&wF(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var so=X((int,$E)=>{"use strict";var MF=Ei(),bF=String,AF=TypeError;$E.exports=function(n){if(MF(n))return n;throw new AF(bF(n)+" is not an object")}});var Wo=X(JE=>{"use strict";var TF=ri(),CF=Kg(),IF=Qg(),ph=so(),ZE=ch(),PF=TypeError,tm=Object.defineProperty,RF=Object.getOwnPropertyDescriptor,em="enumerable",nm="configurable",rm="writable";JE.f=TF?IF?function(t,e,i){if(ph(t),e=ZE(e),ph(i),typeof t=="function"&&e==="prototype"&&"value"in i&&rm in i&&!i[rm]){var s=RF(t,e);s&&s[rm]&&(t[e]=i.value,i={configurable:nm in i?i[nm]:s[nm],enumerable:em in i?i[em]:s[em],writable:!1})}return tm(t,e,i)}:tm:function(t,e,i){if(ph(t),e=ZE(e),ph(i),CF)try{return tm(t,e,i)}catch(s){}if("get"in i||"set"in i)throw new PF("Accessors not supported");return"value"in i&&(t[e]=i.value),t}});var xs=X((snt,jE)=>{"use strict";var LF=ri(),NF=Wo(),OF=Ac();jE.exports=LF?function(n,t,e){return NF.f(n,t,OF(1,e))}:function(n,t,e){return n[t]=e,n}});var dh=X((ant,QE)=>{"use strict";var im=ri(),DF=oo(),KE=Function.prototype,FF=im&&Object.getOwnPropertyDescriptor,om=DF(KE,"name"),UF=om&&function(){}.name==="something",BF=om&&(!im||im&&FF(KE,"name").configurable);QE.exports={EXISTS:om,PROPER:UF,CONFIGURABLE:BF}});var am=X((unt,tS)=>{"use strict";var zF=In(),GF=er(),sm=ah(),kF=zF(Function.toString);GF(sm.inspectSource)||(sm.inspectSource=function(n){return kF(n)});tS.exports=sm.inspectSource});var rS=X((lnt,nS)=>{"use strict";var qF=Sn(),VF=er(),eS=qF.WeakMap;nS.exports=VF(eS)&&/native code/.test(String(eS))});var gh=X((cnt,oS)=>{"use strict";var HF=uh(),WF=lh(),iS=HF("keys");oS.exports=function(n){return iS[n]||(iS[n]=WF(n))}});var mh=X((fnt,sS)=>{"use strict";sS.exports={}});var Va=X((hnt,lS)=>{"use strict";var XF=rS(),uS=Sn(),YF=Ei(),$F=xs(),um=oo(),lm=ah(),ZF=gh(),JF=mh(),aS="Object already initialized",cm=uS.TypeError,jF=uS.WeakMap,yh,Lc,vh,KF=function(n){return vh(n)?Lc(n):yh(n,{})},QF=function(n){return function(t){var e;if(!YF(t)||(e=Lc(t)).type!==n)throw new cm("Incompatible receiver, "+n+" required");return e}};XF||lm.state?(Mo=lm.state||(lm.state=new jF),Mo.get=Mo.get,Mo.has=Mo.has,Mo.set=Mo.set,yh=function(n,t){if(Mo.has(n))throw new cm(aS);return t.facade=n,Mo.set(n,t),t},Lc=function(n){return Mo.get(n)||{}},vh=function(n){return Mo.has(n)}):(qa=ZF("state"),JF[qa]=!0,yh=function(n,t){if(um(n,qa))throw new cm(aS);return t.facade=n,$F(n,qa,t),t},Lc=function(n){return um(n,qa)?n[qa]:{}},vh=function(n){return um(n,qa)});var Mo,qa;lS.exports={set:yh,get:Lc,has:vh,enforce:KF,getterFor:QF}});var pm=X((pnt,hS)=>{"use strict";var hm=In(),tU=An(),eU=er(),_h=oo(),fm=ri(),nU=dh().CONFIGURABLE,rU=am(),fS=Va(),iU=fS.enforce,oU=fS.get,cS=String,xh=Object.defineProperty,sU=hm("".slice),aU=hm("".replace),uU=hm([].join),lU=fm&&!tU(function(){return xh(function(){},"length",{value:8}).length!==8}),cU=String(String).split("String"),fU=hS.exports=function(n,t,e){sU(cS(t),0,7)==="Symbol("&&(t="["+aU(cS(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!_h(n,"name")||nU&&n.name!==t)&&(fm?xh(n,"name",{value:t,configurable:!0}):n.name=t),lU&&e&&_h(e,"arity")&&n.length!==e.arity&&xh(n,"length",{value:e.arity});try{e&&_h(e,"constructor")&&e.constructor?fm&&xh(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var i=iU(n);return _h(i,"source")||(i.source=uU(cU,typeof t=="string"?t:"")),n};Function.prototype.toString=fU(function(){return eU(this)&&oU(this).source||rU(this)},"toString")});var Ha=X((dnt,pS)=>{"use strict";var hU=er(),pU=Wo(),dU=pm(),gU=sh();pS.exports=function(n,t,e,i){i||(i={});var s=i.enumerable,u=i.name!==void 0?i.name:t;if(hU(e)&&dU(e,u,i),i.global)s?n[t]=e:gU(t,e);else{try{i.unsafe?n[t]&&(s=!0):delete n[t]}catch(c){}s?n[t]=e:pU.f(n,t,{value:e,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return n}});var gS=X((gnt,dS)=>{"use strict";var mU=Math.ceil,yU=Math.floor;dS.exports=Math.trunc||function(t){var e=+t;return(e>0?yU:mU)(e)}});var Hi=X((mnt,mS)=>{"use strict";var vU=gS();mS.exports=function(n){var t=+n;return t!==t||t===0?0:vU(t)}});var Eh=X((ynt,yS)=>{"use strict";var _U=Hi(),xU=Math.max,EU=Math.min;yS.exports=function(n,t){var e=_U(n);return e<0?xU(e+t,0):EU(e,t)}});var Wa=X((vnt,vS)=>{"use strict";var SU=Hi(),wU=Math.min;vS.exports=function(n){var t=SU(n);return t>0?wU(t,9007199254740991):0}});var ii=X((_nt,_S)=>{"use strict";var MU=Wa();_S.exports=function(n){return MU(n.length)}});var SS=X((xnt,ES)=>{"use strict";var bU=Gu(),AU=Eh(),TU=ii(),xS=function(n){return function(t,e,i){var s=bU(t),u=TU(s);if(u===0)return!n&&-1;var c=AU(i,u),f;if(n&&e!==e){for(;u>c;)if(f=s[c++],f!==f)return!0}else for(;u>c;c++)if((n||c in s)&&s[c]===e)return n||c||0;return!n&&-1}};ES.exports={includes:xS(!0),indexOf:xS(!1)}});var gm=X((Ent,MS)=>{"use strict";var CU=In(),dm=oo(),IU=Gu(),PU=SS().indexOf,RU=mh(),wS=CU([].push);MS.exports=function(n,t){var e=IU(n),i=0,s=[],u;for(u in e)!dm(RU,u)&&dm(e,u)&&wS(s,u);for(;t.length>i;)dm(e,u=t[i++])&&(~PU(s,u)||wS(s,u));return s}});var Sh=X((Snt,bS)=>{"use strict";bS.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var mm=X(AS=>{"use strict";var LU=gm(),NU=Sh(),OU=NU.concat("length","prototype");AS.f=Object.getOwnPropertyNames||function(t){return LU(t,OU)}});var CS=X(TS=>{"use strict";TS.f=Object.getOwnPropertySymbols});var PS=X((bnt,IS)=>{"use strict";var DU=$s(),FU=In(),UU=mm(),BU=CS(),zU=so(),GU=FU([].concat);IS.exports=DU("Reflect","ownKeys")||function(t){var e=UU.f(zU(t)),i=BU.f;return i?GU(e,i(t)):e}});var ym=X((Ant,LS)=>{"use strict";var RS=oo(),kU=PS(),qU=hh(),VU=Wo();LS.exports=function(n,t,e){for(var i=kU(t),s=VU.f,u=qU.f,c=0;c<i.length;c++){var f=i[c];!RS(n,f)&&!(e&&RS(e,f))&&s(n,f,u(t,f))}}});var OS=X((Tnt,NS)=>{"use strict";var HU=An(),WU=er(),XU=/#|\.prototype\./,Nc=function(n,t){var e=$U[YU(n)];return e===JU?!0:e===ZU?!1:WU(t)?HU(t):!!t},YU=Nc.normalize=function(n){return String(n).replace(XU,".").toLowerCase()},$U=Nc.data={},ZU=Nc.NATIVE="N",JU=Nc.POLYFILL="P";NS.exports=Nc});var sr=X((Cnt,DS)=>{"use strict";var wh=Sn(),jU=hh().f,KU=xs(),QU=Ha(),tB=sh(),eB=ym(),nB=OS();DS.exports=function(n,t){var e=n.target,i=n.global,s=n.stat,u,c,f,p,d,g;if(i?c=wh:s?c=wh[e]||tB(e,{}):c=wh[e]&&wh[e].prototype,c)for(f in t){if(d=t[f],n.dontCallGetSet?(g=jU(c,f),p=g&&g.value):p=c[f],u=nB(i?f:e+(s?".":"#")+f,n.forced),!u&&p!==void 0){if(typeof d==typeof p)continue;eB(d,p)}(n.sham||p&&p.sham)&&KU(d,"sham",!0),QU(c,f,d,n)}}});var Oc=X((Int,FS)=>{"use strict";var rB=vs();FS.exports=Array.isArray||function(t){return rB(t)==="Array"}});var vm=X((Pnt,US)=>{"use strict";var iB=ri(),oB=Oc(),sB=TypeError,aB=Object.getOwnPropertyDescriptor,uB=iB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();US.exports=uB?function(n,t){if(oB(n)&&!aB(n,"length").writable)throw new sB("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var Mh=X((Rnt,BS)=>{"use strict";var lB=TypeError,cB=9007199254740991;BS.exports=function(n){if(n>cB)throw lB("Maximum allowed index exceeded");return n}});var Dc=X(()=>{"use strict";var fB=sr(),hB=Vi(),pB=ii(),dB=vm(),gB=Mh(),mB=An(),yB=mB(function(){return[].push.call({length:4294967296},1)!==4294967297}),vB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},_B=yB||!vB();fB({target:"Array",proto:!0,arity:1,forced:_B},{push:function(t){var e=hB(this),i=pB(e),s=arguments.length;gB(i+s);for(var u=0;u<s;u++)e[i]=arguments[u],i++;return dB(e,i),i}})});var zS=X(()=>{"use strict";var xB=sr(),EB=vr();xB({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return EB(URL.prototype.toString,this)}})});var kS=X((Fnt,GS)=>{"use strict";GS.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=X((Unt,VS)=>{"use strict";var SB=fh(),_m=SB("span").classList,qS=_m&&_m.constructor&&_m.constructor.prototype;VS.exports=qS===Object.prototype?void 0:qS});var XS=X((Bnt,WS)=>{"use strict";var wB=gm(),MB=Sh();WS.exports=Object.keys||function(t){return wB(t,MB)}});var $S=X(YS=>{"use strict";var bB=ri(),AB=Qg(),TB=Wo(),CB=so(),IB=Gu(),PB=XS();YS.f=bB&&!AB?Object.defineProperties:function(t,e){CB(t);for(var i=IB(e),s=PB(e),u=s.length,c=0,f;u>c;)TB.f(t,f=s[c++],i[f]);return t}});var JS=X((Gnt,ZS)=>{"use strict";var RB=$s();ZS.exports=RB("document","documentElement")});var Hu=X((knt,rw)=>{"use strict";var LB=so(),NB=$S(),jS=Sh(),OB=mh(),DB=JS(),FB=fh(),UB=gh(),KS=">",QS="<",Em="prototype",Sm="script",ew=UB("IE_PROTO"),xm=function(){},nw=function(n){return QS+Sm+KS+n+QS+"/"+Sm+KS},tw=function(n){n.write(nw("")),n.close();var t=n.parentWindow.Object;return n=null,t},BB=function(){var n=FB("iframe"),t="java"+Sm+":",e;return n.style.display="none",DB.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(nw("document.F=Object")),e.close(),e.F},bh,Ah=function(){try{bh=new ActiveXObject("htmlfile")}catch(t){}Ah=typeof document!="undefined"?document.domain&&bh?tw(bh):BB():tw(bh);for(var n=jS.length;n--;)delete Ah[Em][jS[n]];return Ah()};OB[ew]=!0;rw.exports=Object.create||function(t,e){var i;return t!==null?(xm[Em]=LB(t),i=new xm,xm[Em]=null,i[ew]=t):i=Ah(),e===void 0?i:NB.f(i,e)}});var bm=X((qnt,iw)=>{"use strict";var zB=Xr(),GB=Hu(),kB=Wo().f,wm=zB("unscopables"),Mm=Array.prototype;Mm[wm]===void 0&&kB(Mm,wm,{configurable:!0,value:GB(null)});iw.exports=function(n){Mm[wm][n]=!0}});var Wu=X((Vnt,ow)=>{"use strict";ow.exports={}});var aw=X((Hnt,sw)=>{"use strict";var qB=An();sw.exports=!qB(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var Fc=X((Wnt,lw)=>{"use strict";var VB=oo(),HB=er(),WB=Vi(),XB=gh(),YB=aw(),uw=XB("IE_PROTO"),Am=Object,$B=Am.prototype;lw.exports=YB?Am.getPrototypeOf:function(n){var t=WB(n);if(VB(t,uw))return t[uw];var e=t.constructor;return HB(e)&&t instanceof e?e.prototype:t instanceof Am?$B:null}});var Pm=X((Xnt,hw)=>{"use strict";var ZB=An(),JB=er(),jB=Ei(),KB=Hu(),cw=Fc(),QB=Ha(),tz=Xr(),ez=Rc(),Im=tz("iterator"),fw=!1,Es,Tm,Cm;[].keys&&(Cm=[].keys(),"next"in Cm?(Tm=cw(cw(Cm)),Tm!==Object.prototype&&(Es=Tm)):fw=!0);var nz=!jB(Es)||ZB(function(){var n={};return Es[Im].call(n)!==n});nz?Es={}:ez&&(Es=KB(Es));JB(Es[Im])||QB(Es,Im,function(){return this});hw.exports={IteratorPrototype:Es,BUGGY_SAFARI_ITERATORS:fw}});var Uc=X((Ynt,dw)=>{"use strict";var rz=Wo().f,iz=oo(),oz=Xr(),pw=oz("toStringTag");dw.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!iz(n,pw)&&rz(n,pw,{configurable:!0,value:t})}});var mw=X(($nt,gw)=>{"use strict";var sz=Pm().IteratorPrototype,az=Hu(),uz=Ac(),lz=Uc(),cz=Wu(),fz=function(){return this};gw.exports=function(n,t,e,i){var s=t+" Iterator";return n.prototype=az(sz,{next:uz(+!i,e)}),lz(n,s,!1,!0),cz[s]=fz,n}});var Bc=X((Znt,yw)=>{"use strict";var hz=In(),pz=_s();yw.exports=function(n,t,e){try{return hz(pz(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(i){}}});var _w=X((Jnt,vw)=>{"use strict";var dz=Ei();vw.exports=function(n){return dz(n)||n===null}});var Ew=X((jnt,xw)=>{"use strict";var gz=_w(),mz=String,yz=TypeError;xw.exports=function(n){if(gz(n))return n;throw new yz("Can't set "+mz(n)+" as a prototype")}});var Xu=X((Knt,Sw)=>{"use strict";var vz=Bc(),_z=Ei(),xz=zu(),Ez=Ew();Sw.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=vz(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(i){}return function(s,u){return xz(s),Ez(u),_z(s)&&(n?e(s,u):s.__proto__=u),s}}():void 0)});var Nw=X((Qnt,Lw)=>{"use strict";var Sz=sr(),wz=vr(),Th=Rc(),Pw=dh(),Mz=er(),bz=mw(),ww=Fc(),Mw=Xu(),Az=Uc(),Tz=xs(),Rm=Ha(),Cz=Xr(),bw=Wu(),Rw=Pm(),Iz=Pw.PROPER,Pz=Pw.CONFIGURABLE,Aw=Rw.IteratorPrototype,Ch=Rw.BUGGY_SAFARI_ITERATORS,zc=Cz("iterator"),Tw="keys",Gc="values",Cw="entries",Iw=function(){return this};Lw.exports=function(n,t,e,i,s,u,c){bz(e,t,i);var f=function(x){if(x===s&&v)return v;if(!Ch&&x&&x in g)return g[x];switch(x){case Tw:return function(){return new e(this,x)};case Gc:return function(){return new e(this,x)};case Cw:return function(){return new e(this,x)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,g=n.prototype,y=g[zc]||g["@@iterator"]||s&&g[s],v=!Ch&&y||f(s),E=t==="Array"&&g.entries||y,M,A,_;if(E&&(M=ww(E.call(new n)),M!==Object.prototype&&M.next&&(!Th&&ww(M)!==Aw&&(Mw?Mw(M,Aw):Mz(M[zc])||Rm(M,zc,Iw)),Az(M,p,!0,!0),Th&&(bw[p]=Iw))),Iz&&s===Gc&&y&&y.name!==Gc&&(!Th&&Pz?Tz(g,"name",Gc):(d=!0,v=function(){return wz(y,this)})),s)if(A={values:f(Gc),keys:u?v:f(Tw),entries:f(Cw)},c)for(_ in A)(Ch||d||!(_ in g))&&Rm(g,_,A[_]);else Sz({target:t,proto:!0,forced:Ch||d},A);return(!Th||c)&&g[zc]!==v&&Rm(g,zc,v,{name:s}),bw[t]=v,A}});var Dw=X((trt,Ow)=>{"use strict";Ow.exports=function(n,t){return{value:n,done:t}}});var kw=X((ert,Gw)=>{"use strict";var Rz=Gu(),Lm=bm(),Fw=Wu(),Bw=Va(),Lz=Wo().f,Nz=Nw(),Ih=Dw(),Oz=Rc(),Dz=ri(),zw="Array Iterator",Fz=Bw.set,Uz=Bw.getterFor(zw);Gw.exports=Nz(Array,"Array",function(n,t){Fz(this,{type:zw,target:Rz(n),index:0,kind:t})},function(){var n=Uz(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Ih(void 0,!0);switch(n.kind){case"keys":return Ih(e,!1);case"values":return Ih(t[e],!1)}return Ih([e,t[e]],!1)},"values");var Uw=Fw.Arguments=Fw.Array;Lm("keys");Lm("values");Lm("entries");if(!Oz&&Dz&&Uw.name!=="values")try{Lz(Uw,"name",{value:"values"})}catch(n){}});var Yu=X(()=>{"use strict";var qw=Sn(),Hw=kS(),Bz=HS(),kc=kw(),Vw=xs(),zz=Uc(),Gz=Xr(),Nm=Gz("iterator"),Om=kc.values,Ww=function(n,t){if(n){if(n[Nm]!==Om)try{Vw(n,Nm,Om)}catch(i){n[Nm]=Om}if(zz(n,t,!0),Hw[t]){for(var e in kc)if(n[e]!==kc[e])try{Vw(n,e,kc[e])}catch(i){n[e]=kc[e]}}}};for(Ph in Hw)Ww(qw[Ph]&&qw[Ph].prototype,Ph);var Ph;Ww(Bz,"DOMTokenList")});var Rh=X((irt,Xw)=>{"use strict";var kz=vs(),qz=In();Xw.exports=function(n){if(kz(n)==="Function")return qz(n)}});var qc=X((ort,$w)=>{"use strict";var Yw=Rh(),Vz=_s(),Hz=bc(),Wz=Yw(Yw.bind);$w.exports=function(n,t){return Vz(n),t===void 0?n:Hz?Wz(n,t):function(){return n.apply(t,arguments)}}});var jw=X((srt,Jw)=>{"use strict";var Xz=Oc(),Yz=ii(),$z=Mh(),Zz=qc(),Zw=function(n,t,e,i,s,u,c,f){for(var p=s,d=0,g=c?Zz(c,f):!1,y,v;d<i;)d in e&&(y=g?g(e[d],d,t):e[d],u>0&&Xz(y)?(v=Yz(y),p=Zw(n,t,y,v,p,u-1)-1):($z(p+1),n[p]=y),p++),d++;return p};Jw.exports=Zw});var tM=X((art,Qw)=>{"use strict";var Jz=Xr(),jz=Jz("toStringTag"),Kw={};Kw[jz]="z";Qw.exports=String(Kw)==="[object z]"});var Zs=X((urt,eM)=>{"use strict";var Kz=tM(),Qz=er(),Lh=vs(),tG=Xr(),eG=tG("toStringTag"),nG=Object,rG=Lh(function(){return arguments}())==="Arguments",iG=function(n,t){try{return n[t]}catch(e){}};eM.exports=Kz?Lh:function(n){var t,e,i;return n===void 0?"Undefined":n===null?"Null":typeof(e=iG(t=nG(n),eG))=="string"?e:rG?Lh(t):(i=Lh(t))==="Object"&&Qz(t.callee)?"Arguments":i}});var Fm=X((lrt,sM)=>{"use strict";var oG=In(),sG=An(),nM=er(),aG=Zs(),uG=$s(),lG=am(),rM=function(){},iM=uG("Reflect","construct"),Dm=/^\s*(?:class|function)\b/,cG=oG(Dm.exec),fG=!Dm.test(rM),Vc=function(t){if(!nM(t))return!1;try{return iM(rM,[],t),!0}catch(e){return!1}},oM=function(t){if(!nM(t))return!1;switch(aG(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fG||!!cG(Dm,lG(t))}catch(e){return!0}};oM.sham=!0;sM.exports=!iM||sG(function(){var n;return Vc(Vc.call)||!Vc(Object)||!Vc(function(){n=!0})||n})?oM:Vc});var cM=X((crt,lM)=>{"use strict";var aM=Oc(),hG=Fm(),pG=Ei(),dG=Xr(),gG=dG("species"),uM=Array;lM.exports=function(n){var t;return aM(n)&&(t=n.constructor,hG(t)&&(t===uM||aM(t.prototype))?t=void 0:pG(t)&&(t=t[gG],t===null&&(t=void 0))),t===void 0?uM:t}});var Um=X((frt,fM)=>{"use strict";var mG=cM();fM.exports=function(n,t){return new(mG(n))(t===0?0:t)}});var hM=X(()=>{"use strict";var yG=sr(),vG=jw(),_G=Vi(),xG=ii(),EG=Hi(),SG=Um();yG({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=_G(this),i=xG(e),s=SG(e,0);return s.length=vG(s,e,e,i,0,t===void 0?1:EG(t)),s}})});var pM=X(()=>{"use strict";var wG=bm();wG("flat")});var vM=X((mrt,yM)=>{"use strict";var MG=Xr(),gM=MG("iterator"),mM=!1;try{dM=0,Bm={next:function(){return{done:!!dM++}},return:function(){mM=!0}},Bm[gM]=function(){return this},Array.from(Bm,function(){throw 2})}catch(n){}var dM,Bm;yM.exports=function(n,t){try{if(!t&&!mM)return!1}catch(s){return!1}var e=!1;try{var i={};i[gM]=function(){return{next:function(){return{done:e=!0}}}},n(i)}catch(s){}return e}});var Nh=X((yrt,_M)=>{"use strict";_M.exports=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"});var $u=X((vrt,EM)=>{"use strict";var xM=pm(),bG=Wo();EM.exports=function(n,t,e){return e.get&&xM(e.get,t,{getter:!0}),e.set&&xM(e.set,t,{setter:!0}),bG.f(n,t,e)}});var Wi=X((_rt,RM)=>{"use strict";var AG=Nh(),qm=ri(),Si=Sn(),bM=er(),Fh=Ei(),js=oo(),Vm=Zs(),TG=qu(),CG=xs(),zm=Ha(),IG=$u(),PG=Tc(),Uh=Fc(),Ju=Xu(),RG=Xr(),LG=lh(),AM=Va(),TM=AM.enforce,NG=AM.get,Oh=Si.Int8Array,Gm=Oh&&Oh.prototype,SM=Si.Uint8ClampedArray,wM=SM&&SM.prototype,Xo=Oh&&Uh(Oh),bo=Gm&&Uh(Gm),OG=Object.prototype,Hm=Si.TypeError,MM=RG("toStringTag"),km=LG("TYPED_ARRAY_TAG"),Dh="TypedArrayConstructor",Ss=AG&&!!Ju&&Vm(Si.opera)!=="Opera",CM=!1,Li,Js,Zu,ws={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Wm={BigInt64Array:8,BigUint64Array:8},DG=function(t){if(!Fh(t))return!1;var e=Vm(t);return e==="DataView"||js(ws,e)||js(Wm,e)},IM=function(n){var t=Uh(n);if(Fh(t)){var e=NG(t);return e&&js(e,Dh)?e[Dh]:IM(t)}},PM=function(n){if(!Fh(n))return!1;var t=Vm(n);return js(ws,t)||js(Wm,t)},FG=function(n){if(PM(n))return n;throw new Hm("Target is not a typed array")},UG=function(n){if(bM(n)&&(!Ju||PG(Xo,n)))return n;throw new Hm(TG(n)+" is not a typed array constructor")},BG=function(n,t,e,i){if(qm){if(e)for(var s in ws){var u=Si[s];if(u&&js(u.prototype,n))try{delete u.prototype[n]}catch(c){try{u.prototype[n]=t}catch(f){}}}(!bo[n]||e)&&zm(bo,n,e?t:Ss&&Gm[n]||t,i)}},zG=function(n,t,e){var i,s;if(qm){if(Ju){if(e){for(i in ws)if(s=Si[i],s&&js(s,n))try{delete s[n]}catch(u){}}if(!Xo[n]||e)try{return zm(Xo,n,e?t:Ss&&Xo[n]||t)}catch(u){}else return}for(i in ws)s=Si[i],s&&(!s[n]||e)&&zm(s,n,t)}};for(Li in ws)Js=Si[Li],Zu=Js&&Js.prototype,Zu?TM(Zu)[Dh]=Js:Ss=!1;for(Li in Wm)Js=Si[Li],Zu=Js&&Js.prototype,Zu&&(TM(Zu)[Dh]=Js);if((!Ss||!bM(Xo)||Xo===Function.prototype)&&(Xo=function(){throw new Hm("Incorrect invocation")},Ss))for(Li in ws)Si[Li]&&Ju(Si[Li],Xo);if((!Ss||!bo||bo===OG)&&(bo=Xo.prototype,Ss))for(Li in ws)Si[Li]&&Ju(Si[Li].prototype,bo);Ss&&Uh(wM)!==bo&&Ju(wM,bo);if(qm&&!js(bo,MM)){CM=!0,IG(bo,MM,{configurable:!0,get:function(){return Fh(this)?this[km]:void 0}});for(Li in ws)Si[Li]&&CG(Si[Li],km,Li)}RM.exports={NATIVE_ARRAY_BUFFER_VIEWS:Ss,TYPED_ARRAY_TAG:CM&&km,aTypedArray:FG,aTypedArrayConstructor:UG,exportTypedArrayMethod:BG,exportTypedArrayStaticMethod:zG,getTypedArrayConstructor:IM,isView:DG,isTypedArray:PM,TypedArray:Xo,TypedArrayPrototype:bo}});var OM=X((xrt,NM)=>{"use strict";var LM=Sn(),Xm=An(),GG=vM(),kG=Wi().NATIVE_ARRAY_BUFFER_VIEWS,qG=LM.ArrayBuffer,Xa=LM.Int8Array;NM.exports=!kG||!Xm(function(){Xa(1)})||!Xm(function(){new Xa(-1)})||!GG(function(n){new Xa,new Xa(null),new Xa(1.5),new Xa(n)},!0)||Xm(function(){return new Xa(new qG(2),1,void 0).length!==1})});var FM=X((Ert,DM)=>{"use strict";var VG=Ha();DM.exports=function(n,t,e){for(var i in t)VG(n,i,t[i],e);return n}});var Ym=X((Srt,UM)=>{"use strict";var HG=Tc(),WG=TypeError;UM.exports=function(n,t){if(HG(t,n))return n;throw new WG("Incorrect invocation")}});var Bh=X((wrt,BM)=>{"use strict";var XG=Hi(),YG=Wa(),$G=RangeError;BM.exports=function(n){if(n===void 0)return 0;var t=XG(n),e=YG(t);if(t!==e)throw new $G("Wrong length or index");return e}});var GM=X((Mrt,zM)=>{"use strict";zM.exports=Math.sign||function(t){var e=+t;return e===0||e!==e?e:e<0?-1:1}});var VM=X((brt,qM)=>{"use strict";var ZG=2220446049250313e-31,kM=1/ZG;qM.exports=function(n){return n+kM-kM}});var WM=X((Art,HM)=>{"use strict";var JG=GM(),jG=VM(),KG=Math.abs,QG=2220446049250313e-31;HM.exports=function(n,t,e,i){var s=+n,u=KG(s),c=JG(s);if(u<i)return c*jG(u/i/t)*i*t;var f=(1+t/QG)*u,p=f-(f-u);return p>e||p!==p?c*(1/0):c*p}});var YM=X((Trt,XM)=>{"use strict";var t4=WM(),e4=11920928955078125e-23,n4=34028234663852886e22,r4=11754943508222875e-54;XM.exports=Math.fround||function(t){return t4(t,e4,n4,r4)}});var ZM=X((Crt,$M)=>{"use strict";var i4=Array,o4=Math.abs,Ms=Math.pow,s4=Math.floor,a4=Math.log,u4=Math.LN2,l4=function(n,t,e){var i=i4(e),s=e*8-t-1,u=(1<<s)-1,c=u>>1,f=t===23?Ms(2,-24)-Ms(2,-77):0,p=n<0||n===0&&1/n<0?1:0,d=0,g,y,v;for(n=o4(n),n!==n||n===1/0?(y=n!==n?1:0,g=u):(g=s4(a4(n)/u4),v=Ms(2,-g),n*v<1&&(g--,v*=2),g+c>=1?n+=f/v:n+=f*Ms(2,1-c),n*v>=2&&(g++,v/=2),g+c>=u?(y=0,g=u):g+c>=1?(y=(n*v-1)*Ms(2,t),g+=c):(y=n*Ms(2,c-1)*Ms(2,t),g=0));t>=8;)i[d++]=y&255,y/=256,t-=8;for(g=g<<t|y,s+=t;s>0;)i[d++]=g&255,g/=256,s-=8;return i[d-1]|=p*128,i},c4=function(n,t){var e=n.length,i=e*8-t-1,s=(1<<i)-1,u=s>>1,c=i-7,f=e-1,p=n[f--],d=p&127,g;for(p>>=7;c>0;)d=d*256+n[f--],c-=8;for(g=d&(1<<-c)-1,d>>=-c,c+=t;c>0;)g=g*256+n[f--],c-=8;if(d===0)d=1-u;else{if(d===s)return g?NaN:p?-1/0:1/0;g+=Ms(2,t),d-=u}return(p?-1:1)*g*Ms(2,d-t)};$M.exports={pack:l4,unpack:c4}});var $m=X((Irt,jM)=>{"use strict";var f4=Vi(),JM=Eh(),h4=ii();jM.exports=function(t){for(var e=f4(this),i=h4(e),s=arguments.length,u=JM(s>1?arguments[1]:void 0,i),c=s>2?arguments[2]:void 0,f=c===void 0?i:JM(c,i);f>u;)e[u++]=t;return e}});var zh=X((Prt,KM)=>{"use strict";var p4=In();KM.exports=p4([].slice)});var Zm=X((Rrt,tb)=>{"use strict";var d4=er(),g4=Ei(),QM=Xu();tb.exports=function(n,t,e){var i,s;return QM&&d4(i=t.constructor)&&i!==e&&g4(s=i.prototype)&&s!==e.prototype&&QM(n,s),n}});var Xh=X((Lrt,yb)=>{"use strict";var Hh=Sn(),t0=In(),Jm=ri(),m4=Nh(),hb=dh(),y4=xs(),v4=$u(),eb=FM(),jm=An(),Gh=Ym(),_4=Hi(),x4=Wa(),qh=Bh(),E4=YM(),pb=ZM(),S4=Fc(),nb=Xu(),w4=$m(),M4=zh(),b4=Zm(),A4=ym(),db=Uc(),e0=Va(),T4=hb.PROPER,rb=hb.CONFIGURABLE,Ku="ArrayBuffer",Wh="DataView",Qu="prototype",C4="Wrong length",gb="Wrong index",ib=e0.getterFor(Ku),Wc=e0.getterFor(Wh),ob=e0.set,Ao=Hh[Ku],Xi=Ao,ju=Xi&&Xi[Qu],Yo=Hh[Wh],Ya=Yo&&Yo[Qu],sb=Object.prototype,I4=Hh.Array,Vh=Hh.RangeError,P4=t0(w4),R4=t0([].reverse),mb=pb.pack,ab=pb.unpack,ub=function(n){return[n&255]},lb=function(n){return[n&255,n>>8&255]},cb=function(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]},fb=function(n){return n[3]<<24|n[2]<<16|n[1]<<8|n[0]},L4=function(n){return mb(E4(n),23,4)},N4=function(n){return mb(n,52,8)},kh=function(n,t,e){v4(n[Qu],t,{configurable:!0,get:function(){return e(this)[t]}})},Ks=function(n,t,e,i){var s=Wc(n),u=qh(e),c=!!i;if(u+t>s.byteLength)throw new Vh(gb);var f=s.bytes,p=u+s.byteOffset,d=M4(f,p,p+t);return c?d:R4(d)},Qs=function(n,t,e,i,s,u){var c=Wc(n),f=qh(e),p=i(+s),d=!!u;if(f+t>c.byteLength)throw new Vh(gb);for(var g=c.bytes,y=f+c.byteOffset,v=0;v<t;v++)g[y+v]=p[d?v:t-v-1]};m4?(Km=T4&&Ao.name!==Ku,!jm(function(){Ao(1)})||!jm(function(){new Ao(-1)})||jm(function(){return new Ao,new Ao(1.5),new Ao(NaN),Ao.length!==1||Km&&!rb})?(Xi=function(t){return Gh(this,ju),b4(new Ao(qh(t)),this,Xi)},Xi[Qu]=ju,ju.constructor=Xi,A4(Xi,Ao)):Km&&rb&&y4(Ao,"name",Ku),nb&&S4(Ya)!==sb&&nb(Ya,sb),Hc=new Yo(new Xi(2)),Qm=t0(Ya.setInt8),Hc.setInt8(0,2147483648),Hc.setInt8(1,2147483649),(Hc.getInt8(0)||!Hc.getInt8(1))&&eb(Ya,{setInt8:function(t,e){Qm(this,t,e<<24>>24)},setUint8:function(t,e){Qm(this,t,e<<24>>24)}},{unsafe:!0})):(Xi=function(t){Gh(this,ju);var e=qh(t);ob(this,{type:Ku,bytes:P4(I4(e),0),byteLength:e}),Jm||(this.byteLength=e,this.detached=!1)},ju=Xi[Qu],Yo=function(t,e,i){Gh(this,Ya),Gh(t,ju);var s=ib(t),u=s.byteLength,c=_4(e);if(c<0||c>u)throw new Vh("Wrong offset");if(i=i===void 0?u-c:x4(i),c+i>u)throw new Vh(C4);ob(this,{type:Wh,buffer:t,byteLength:i,byteOffset:c,bytes:s.bytes}),Jm||(this.buffer=t,this.byteLength=i,this.byteOffset=c)},Ya=Yo[Qu],Jm&&(kh(Xi,"byteLength",ib),kh(Yo,"buffer",Wc),kh(Yo,"byteLength",Wc),kh(Yo,"byteOffset",Wc)),eb(Ya,{getInt8:function(t){return Ks(this,1,t)[0]<<24>>24},getUint8:function(t){return Ks(this,1,t)[0]},getInt16:function(t){var e=Ks(this,2,t,arguments.length>1?arguments[1]:!1);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=Ks(this,2,t,arguments.length>1?arguments[1]:!1);return e[1]<<8|e[0]},getInt32:function(t){return fb(Ks(this,4,t,arguments.length>1?arguments[1]:!1))},getUint32:function(t){return fb(Ks(this,4,t,arguments.length>1?arguments[1]:!1))>>>0},getFloat32:function(t){return ab(Ks(this,4,t,arguments.length>1?arguments[1]:!1),23)},getFloat64:function(t){return ab(Ks(this,8,t,arguments.length>1?arguments[1]:!1),52)},setInt8:function(t,e){Qs(this,1,t,ub,e)},setUint8:function(t,e){Qs(this,1,t,ub,e)},setInt16:function(t,e){Qs(this,2,t,lb,e,arguments.length>2?arguments[2]:!1)},setUint16:function(t,e){Qs(this,2,t,lb,e,arguments.length>2?arguments[2]:!1)},setInt32:function(t,e){Qs(this,4,t,cb,e,arguments.length>2?arguments[2]:!1)},setUint32:function(t,e){Qs(this,4,t,cb,e,arguments.length>2?arguments[2]:!1)},setFloat32:function(t,e){Qs(this,4,t,L4,e,arguments.length>2?arguments[2]:!1)},setFloat64:function(t,e){Qs(this,8,t,N4,e,arguments.length>2?arguments[2]:!1)}}));var Km,Hc,Qm;db(Xi,Ku);db(Yo,Wh);yb.exports={ArrayBuffer:Xi,DataView:Yo}});var _b=X((Nrt,vb)=>{"use strict";var O4=Ei(),D4=Math.floor;vb.exports=Number.isInteger||function(t){return!O4(t)&&isFinite(t)&&D4(t)===t}});var Eb=X((Ort,xb)=>{"use strict";var F4=Hi(),U4=RangeError;xb.exports=function(n){var t=F4(n);if(t<0)throw new U4("The argument can't be less than 0");return t}});var n0=X((Drt,Sb)=>{"use strict";var B4=Eb(),z4=RangeError;Sb.exports=function(n,t){var e=B4(n);if(e%t)throw new z4("Wrong offset");return e}});var Mb=X((Frt,wb)=>{"use strict";var G4=Math.round;wb.exports=function(n){var t=G4(n);return t<0?0:t>255?255:t&255}});var Ab=X((Urt,bb)=>{"use strict";var k4=Fm(),q4=qu(),V4=TypeError;bb.exports=function(n){if(k4(n))return n;throw new V4(q4(n)+" is not a constructor")}});var r0=X((Brt,Cb)=>{"use strict";var H4=Zs(),Tb=Pc(),W4=rh(),X4=Wu(),Y4=Xr(),$4=Y4("iterator");Cb.exports=function(n){if(!W4(n))return Tb(n,$4)||Tb(n,"@@iterator")||X4[H4(n)]}});var Pb=X((zrt,Ib)=>{"use strict";var Z4=vr(),J4=_s(),j4=so(),K4=qu(),Q4=r0(),tk=TypeError;Ib.exports=function(n,t){var e=arguments.length<2?Q4(n):t;if(J4(e))return j4(Z4(e,n));throw new tk(K4(n)+" is not iterable")}});var Lb=X((Grt,Rb)=>{"use strict";var ek=Xr(),nk=Wu(),rk=ek("iterator"),ik=Array.prototype;Rb.exports=function(n){return n!==void 0&&(nk.Array===n||ik[rk]===n)}});var i0=X((krt,Nb)=>{"use strict";var ok=Zs();Nb.exports=function(n){var t=ok(n);return t==="BigInt64Array"||t==="BigUint64Array"}});var Yh=X((qrt,Ob)=>{"use strict";var sk=Jg(),ak=TypeError;Ob.exports=function(n){var t=sk(n,"number");if(typeof t=="number")throw new ak("Can't convert number to bigint");return BigInt(t)}});var Fb=X((Vrt,Db)=>{"use strict";var uk=qc(),lk=vr(),ck=Ab(),fk=Vi(),hk=ii(),pk=Pb(),dk=r0(),gk=Lb(),mk=i0(),yk=Wi().aTypedArrayConstructor,vk=Yh();Db.exports=function(t){var e=ck(this),i=fk(t),s=arguments.length,u=s>1?arguments[1]:void 0,c=u!==void 0,f=dk(i),p,d,g,y,v,E,M,A;if(f&&!gk(f))for(M=pk(i,f),A=M.next,i=[];!(E=lk(A,M)).done;)i.push(E.value);for(c&&s>2&&(u=uk(u,arguments[2])),d=hk(i),g=new(yk(e))(d),y=mk(g),p=0;d>p;p++)v=c?u(i[p],p):i[p],g[p]=y?vk(v):+v;return g}});var zb=X((Hrt,Bb)=>{"use strict";var _k=qc(),xk=In(),Ek=nh(),Sk=Vi(),wk=ii(),Mk=Um(),Ub=xk([].push),ta=function(n){var t=n===1,e=n===2,i=n===3,s=n===4,u=n===6,c=n===7,f=n===5||u;return function(p,d,g,y){for(var v=Sk(p),E=Ek(v),M=wk(E),A=_k(d,g),_=0,x=y||Mk,T=t?x(p,M):e||c?x(p,0):void 0,w,R;M>_;_++)if((f||_ in E)&&(w=E[_],R=A(w,_,v),n))if(t)T[_]=R;else if(R)switch(n){case 3:return!0;case 5:return w;case 6:return _;case 2:Ub(T,w)}else switch(n){case 4:return!1;case 7:Ub(T,w)}return u?-1:i||s?s:T}};Bb.exports={forEach:ta(0),map:ta(1),filter:ta(2),some:ta(3),every:ta(4),find:ta(5),findIndex:ta(6),filterReject:ta(7)}});var o0=X((Wrt,kb)=>{"use strict";var bk=$s(),Ak=$u(),Tk=Xr(),Ck=ri(),Gb=Tk("species");kb.exports=function(n){var t=bk(n);Ck&&t&&!t[Gb]&&Ak(t,Gb,{configurable:!0,get:function(){return this}})}});var s0=X((Xrt,qb)=>{"use strict";var Ik=ii();qb.exports=function(n,t,e){for(var i=0,s=arguments.length>2?e:Ik(t),u=new n(s);s>i;)u[i]=t[i++];return u}});var uA=X((Yrt,p0)=>{"use strict";var Vb=sr(),tA=Sn(),Hb=vr(),Pk=ri(),Rk=OM(),Zc=Wi(),eA=Xh(),Wb=Ym(),Lk=Ac(),Xc=xs(),Nk=_b(),Ok=Wa(),Xb=Bh(),a0=n0(),Dk=Mb(),nA=ch(),Yc=oo(),Fk=Zs(),c0=Ei(),Uk=Ic(),Bk=Hu(),zk=Tc(),$h=Xu(),Gk=mm().f,Yb=Fb(),kk=zb().forEach,qk=o0(),Vk=$u(),rA=Wo(),iA=hh(),$b=s0(),d0=Va(),Hk=Zm(),f0=d0.get,Wk=d0.set,Xk=d0.enforce,oA=rA.f,Yk=iA.f,u0=tA.RangeError,sA=eA.ArrayBuffer,$k=sA.prototype,Zk=eA.DataView,Zh=Zc.NATIVE_ARRAY_BUFFER_VIEWS,Zb=Zc.TYPED_ARRAY_TAG,Jb=Zc.TypedArray,$c=Zc.TypedArrayPrototype,h0=Zc.isTypedArray,Jh="BYTES_PER_ELEMENT",l0="Wrong length",jh=function(n,t){Vk(n,t,{configurable:!0,get:function(){return f0(this)[t]}})},jb=function(n){var t;return zk($k,n)||(t=Fk(n))==="ArrayBuffer"||t==="SharedArrayBuffer"},aA=function(n,t){return h0(n)&&!Uk(t)&&t in n&&Nk(+t)&&t>=0},Kb=function(t,e){return e=nA(e),aA(t,e)?Lk(2,t[e]):Yk(t,e)},Qb=function(t,e,i){return e=nA(e),aA(t,e)&&c0(i)&&Yc(i,"value")&&!Yc(i,"get")&&!Yc(i,"set")&&!i.configurable&&(!Yc(i,"writable")||i.writable)&&(!Yc(i,"enumerable")||i.enumerable)?(t[e]=i.value,t):oA(t,e,i)};Pk?(Zh||(iA.f=Kb,rA.f=Qb,jh($c,"buffer"),jh($c,"byteOffset"),jh($c,"byteLength"),jh($c,"length")),Vb({target:"Object",stat:!0,forced:!Zh},{getOwnPropertyDescriptor:Kb,defineProperty:Qb}),p0.exports=function(n,t,e){var i=n.match(/\d+/)[0]/8,s=n+(e?"Clamped":"")+"Array",u="get"+n,c="set"+n,f=tA[s],p=f,d=p&&p.prototype,g={},y=function(A,_){var x=f0(A);return x.view[u](_*i+x.byteOffset,!0)},v=function(A,_,x){var T=f0(A);T.view[c](_*i+T.byteOffset,e?Dk(x):x,!0)},E=function(A,_){oA(A,_,{get:function(){return y(this,_)},set:function(x){return v(this,_,x)},enumerable:!0})};Zh?Rk&&(p=t(function(A,_,x,T){return Wb(A,d),Hk(function(){return c0(_)?jb(_)?T!==void 0?new f(_,a0(x,i),T):x!==void 0?new f(_,a0(x,i)):new f(_):h0(_)?$b(p,_):Hb(Yb,p,_):new f(Xb(_))}(),A,p)}),$h&&$h(p,Jb),kk(Gk(f),function(A){A in p||Xc(p,A,f[A])}),p.prototype=d):(p=t(function(A,_,x,T){Wb(A,d);var w=0,R=0,B,U,D;if(!c0(_))D=Xb(_),U=D*i,B=new sA(U);else if(jb(_)){B=_,R=a0(x,i);var P=_.byteLength;if(T===void 0){if(P%i)throw new u0(l0);if(U=P-R,U<0)throw new u0(l0)}else if(U=Ok(T)*i,U+R>P)throw new u0(l0);D=U/i}else return h0(_)?$b(p,_):Hb(Yb,p,_);for(Wk(A,{buffer:B,byteOffset:R,byteLength:U,length:D,view:new Zk(B)});w<D;)E(A,w++)}),$h&&$h(p,Jb),d=p.prototype=Bk($c)),d.constructor!==p&&Xc(d,"constructor",p),Xk(d).TypedArrayConstructor=p,Zb&&Xc(d,Zb,s);var M=p!==f;g[s]=p,Vb({global:!0,constructor:!0,forced:M,sham:!Zh},g),Jh in p||Xc(p,Jh,i),Jh in d||Xc(d,Jh,i),qk(s)}):p0.exports=function(){}});var g0=X(()=>{"use strict";var Jk=uA();Jk("Float32",function(n){return function(e,i,s){return n(this,e,i,s)}})});var m0=X(()=>{"use strict";var lA=Wi(),jk=ii(),Kk=Hi(),Qk=lA.aTypedArray,tq=lA.exportTypedArrayMethod;tq("at",function(t){var e=Qk(this),i=jk(e),s=Kk(t),u=s>=0?s:i+s;return u<0||u>=i?void 0:e[u]})});var y0=X(()=>{"use strict";var cA=Wi(),eq=$m(),nq=Yh(),rq=Zs(),iq=vr(),oq=In(),sq=An(),aq=cA.aTypedArray,uq=cA.exportTypedArrayMethod,lq=oq("".slice),cq=sq(function(){var n=0;return new Int8Array(2).fill({valueOf:function(){return n++}}),n!==1});uq("fill",function(t){var e=arguments.length;aq(this);var i=lq(rq(this),0,3)==="Big"?nq(t):+t;return iq(eq,this,i,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},cq)});var v0=X((tit,hA)=>{"use strict";var fq=qc(),hq=nh(),pq=Vi(),dq=ii(),fA=function(n){var t=n===1;return function(e,i,s){for(var u=pq(e),c=hq(u),f=dq(c),p=fq(i,s),d,g;f-- >0;)if(d=c[f],g=p(d,f,u),g)switch(n){case 0:return d;case 1:return f}return t?-1:void 0}};hA.exports={findLast:fA(0),findLastIndex:fA(1)}});var _0=X(()=>{"use strict";var pA=Wi(),gq=v0().findLast,mq=pA.aTypedArray,yq=pA.exportTypedArrayMethod;yq("findLast",function(t){return gq(mq(this),t,arguments.length>1?arguments[1]:void 0)})});var x0=X(()=>{"use strict";var dA=Wi(),vq=v0().findLastIndex,_q=dA.aTypedArray,xq=dA.exportTypedArrayMethod;xq("findLastIndex",function(t){return vq(_q(this),t,arguments.length>1?arguments[1]:void 0)})});var M0=X(()=>{"use strict";var mA=Sn(),yA=vr(),w0=Wi(),Eq=ii(),Sq=n0(),wq=Vi(),vA=An(),Mq=mA.RangeError,E0=mA.Int8Array,gA=E0&&E0.prototype,_A=gA&&gA.set,bq=w0.aTypedArray,Aq=w0.exportTypedArrayMethod,S0=!vA(function(){var n=new Uint8ClampedArray(2);return yA(_A,n,{length:1,0:3},1),n[1]!==3}),Tq=S0&&w0.NATIVE_ARRAY_BUFFER_VIEWS&&vA(function(){var n=new E0(2);return n.set(1),n.set("2",1),n[0]!==0||n[1]!==2});Aq("set",function(t){bq(this);var e=Sq(arguments.length>1?arguments[1]:void 0,1),i=wq(t);if(S0)return yA(_A,this,i,e);var s=this.length,u=Eq(i),c=0;if(u+e>s)throw new Mq("Wrong length");for(;c<u;)this[e+c]=i[c++]},!S0||Tq)});var A0=X((ait,EA)=>{"use strict";var xA=zh(),Cq=Math.floor,b0=function(n,t){var e=n.length;if(e<8)for(var i=1,s,u;i<e;){for(u=i,s=n[i];u&&t(n[u-1],s)>0;)n[u]=n[--u];u!==i++&&(n[u]=s)}else for(var c=Cq(e/2),f=b0(xA(n,0,c),t),p=b0(xA(n,c),t),d=f.length,g=p.length,y=0,v=0;y<d||v<g;)n[y+v]=y<d&&v<g?t(f[y],p[v])<=0?f[y++]:p[v++]:y<d?f[y++]:p[v++];return n};EA.exports=b0});var T0=X((uit,wA)=>{"use strict";var Iq=ku(),SA=Iq.match(/firefox\/(\d+)/i);wA.exports=!!SA&&+SA[1]});var C0=X((lit,MA)=>{"use strict";var Pq=ku();MA.exports=/MSIE|Trident/.test(Pq)});var I0=X((cit,AA)=>{"use strict";var Rq=ku(),bA=Rq.match(/AppleWebKit\/(\d+)\./);AA.exports=!!bA&&+bA[1]});var R0=X(()=>{"use strict";var Lq=Sn(),Nq=Rh(),P0=An(),Oq=_s(),Dq=A0(),RA=Wi(),TA=T0(),Fq=C0(),CA=Cc(),IA=I0(),Uq=RA.aTypedArray,Bq=RA.exportTypedArrayMethod,Jc=Lq.Uint16Array,tl=Jc&&Nq(Jc.prototype.sort),zq=!!tl&&!(P0(function(){tl(new Jc(2),null)})&&P0(function(){tl(new Jc(2),{})})),PA=!!tl&&!P0(function(){if(CA)return CA<74;if(TA)return TA<67;if(Fq)return!0;if(IA)return IA<602;var n=new Jc(516),t=Array(516),e,i;for(e=0;e<516;e++)i=e%4,n[e]=515-e,t[e]=e-2*i+3;for(tl(n,function(s,u){return(s/4|0)-(u/4|0)}),e=0;e<516;e++)if(n[e]!==t[e])return!0}),Gq=function(n){return function(t,e){return n!==void 0?+n(t,e)||0:e!==e?-1:t!==t?1:t===0&&e===0?1/t>0&&1/e<0?1:-1:t>e}};Bq("sort",function(t){return t!==void 0&&Oq(t),PA?tl(this,t):Dq(Uq(this),Gq(t))},!PA||zq)});var NA=X((pit,LA)=>{"use strict";var kq=ii();LA.exports=function(n,t){for(var e=kq(n),i=new t(e),s=0;s<e;s++)i[s]=n[e-s-1];return i}});var N0=X(()=>{"use strict";var qq=NA(),L0=Wi(),Vq=L0.aTypedArray,Hq=L0.exportTypedArrayMethod,Wq=L0.getTypedArrayConstructor;Hq("toReversed",function(){return qq(Vq(this),Wq(this))})});var O0=X(()=>{"use strict";var Kh=Wi(),Xq=In(),Yq=_s(),$q=s0(),Zq=Kh.aTypedArray,Jq=Kh.getTypedArrayConstructor,jq=Kh.exportTypedArrayMethod,Kq=Xq(Kh.TypedArrayPrototype.sort);jq("toSorted",function(t){t!==void 0&&Yq(t);var e=Zq(this),i=$q(Jq(e),e);return Kq(i,t)})});var DA=X((vit,OA)=>{"use strict";var Qq=ii(),t5=Hi(),e5=RangeError;OA.exports=function(n,t,e,i){var s=Qq(n),u=t5(e),c=u<0?s+u:u;if(c>=s||c<0)throw new e5("Incorrect index");for(var f=new t(s),p=0;p<s;p++)f[p]=p===c?i:n[p];return f}});var F0=X(()=>{"use strict";var n5=DA(),D0=Wi(),r5=i0(),i5=Hi(),o5=Yh(),s5=D0.aTypedArray,a5=D0.getTypedArrayConstructor,u5=D0.exportTypedArrayMethod,l5=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(n){return n===8}}();u5("with",function(n,t){var e=s5(this),i=i5(n),s=r5(e)?o5(t):+t;return n5(e,a5(e),i,s)},!l5)});var B0=X(()=>{"use strict";var c5=sr(),f5=Sn(),h5=Xh(),p5=o0(),U0="ArrayBuffer",FA=h5[U0],d5=f5[U0];c5({global:!0,constructor:!0,forced:d5!==FA},{ArrayBuffer:FA});p5(U0)});var q0=X(()=>{"use strict";var g5=sr(),G0=Rh(),m5=An(),GA=Xh(),UA=so(),BA=Eh(),y5=Wa(),k0=GA.ArrayBuffer,z0=GA.DataView,kA=z0.prototype,zA=G0(k0.prototype.slice),v5=G0(kA.getUint8),_5=G0(kA.setUint8),x5=m5(function(){return!new k0(2).slice(1,void 0).byteLength});g5({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:x5},{slice:function(t,e){if(zA&&e===void 0)return zA(UA(this),t);for(var i=UA(this).byteLength,s=BA(t,i),u=BA(e===void 0?i:e,i),c=new k0(y5(u-s)),f=new z0(this),p=new z0(c),d=0;s<u;)_5(p,d++,v5(f,s++));return c}})});var V0=X((bit,HA)=>{"use strict";var VA=Sn(),E5=Bc(),S5=vs(),qA=VA.ArrayBuffer,w5=VA.TypeError;HA.exports=qA&&E5(qA.prototype,"byteLength","get")||function(n){if(S5(n)!=="ArrayBuffer")throw new w5("ArrayBuffer expected");return n.byteLength}});var H0=X((Ait,WA)=>{"use strict";var M5=Sn(),b5=Nh(),A5=V0(),T5=M5.DataView;WA.exports=function(n){if(!b5||A5(n)!==0)return!1;try{return new T5(n),!1}catch(t){return!0}}});var W0=X(()=>{"use strict";var C5=ri(),I5=$u(),P5=H0(),XA=ArrayBuffer.prototype;C5&&!("detached"in XA)&&I5(XA,"detached",{configurable:!0,get:function(){return P5(this)}})});var $A=X((Iit,YA)=>{"use strict";var R5=H0(),L5=TypeError;YA.exports=function(n){if(R5(n))throw new L5("ArrayBuffer is detached");return n}});var X0=X((Pit,ZA)=>{"use strict";var jc=Sn(),N5=ku(),O5=vs(),Qh=function(n){return N5.slice(0,n.length)===n};ZA.exports=function(){return Qh("Bun/")?"BUN":Qh("Cloudflare-Workers")?"CLOUDFLARE":Qh("Deno/")?"DENO":Qh("Node.js/")?"NODE":jc.Bun&&typeof Bun.version=="string"?"BUN":jc.Deno&&typeof Deno.version=="object"?"DENO":O5(jc.process)==="process"?"NODE":jc.window&&jc.document?"BROWSER":"REST"}()});var jA=X((Rit,JA)=>{"use strict";var D5=X0();JA.exports=D5==="NODE"});var QA=X((Lit,KA)=>{"use strict";var F5=Sn(),U5=jA();KA.exports=function(n){if(U5){try{return F5.process.getBuiltinModule(n)}catch(t){}try{return Function('return require("'+n+'")')()}catch(t){}}}});var Z0=X((Nit,eT)=>{"use strict";var B5=Sn(),z5=An(),Y0=Cc(),$0=X0(),tT=B5.structuredClone;eT.exports=!!tT&&!z5(function(){if($0==="DENO"&&Y0>92||$0==="NODE"&&Y0>94||$0==="BROWSER"&&Y0>97)return!1;var n=new ArrayBuffer(8),t=tT(n,{transfer:[n]});return n.byteLength!==0||t.byteLength!==8})});var oT=X((Oit,iT)=>{"use strict";var Q0=Sn(),G5=QA(),k5=Z0(),q5=Q0.structuredClone,nT=Q0.ArrayBuffer,tp=Q0.MessageChannel,K0=!1,J0,rT,ep,j0;if(k5)K0=function(n){q5(n,{transfer:[n]})};else if(nT)try{tp||(J0=G5("worker_threads"),J0&&(tp=J0.MessageChannel)),tp&&(rT=new tp,ep=new nT(2),j0=function(n){rT.port1.postMessage(null,[n])},ep.byteLength===2&&(j0(ep),ep.byteLength===0&&(K0=j0)))}catch(n){}iT.exports=K0});var oy=X((Dit,hT)=>{"use strict";var ny=Sn(),ry=In(),lT=Bc(),V5=Bh(),H5=$A(),W5=V0(),sT=oT(),ty=Z0(),X5=ny.structuredClone,cT=ny.ArrayBuffer,ey=ny.DataView,Y5=Math.min,iy=cT.prototype,fT=ey.prototype,$5=ry(iy.slice),aT=lT(iy,"resizable","get"),uT=lT(iy,"maxByteLength","get"),Z5=ry(fT.getInt8),J5=ry(fT.setInt8);hT.exports=(ty||sT)&&function(n,t,e){var i=W5(n),s=t===void 0?i:V5(t),u=!aT||!aT(n),c;if(H5(n),ty&&(n=X5(n,{transfer:[n]}),i===s&&(e||u)))return n;if(i>=s&&(!e||u))c=$5(n,0,s);else{var f=e&&!u&&uT?{maxByteLength:uT(n)}:void 0;c=new cT(s,f);for(var p=new ey(n),d=new ey(c),g=Y5(s,i),y=0;y<g;y++)J5(d,y,Z5(p,y))}return ty||sT(n),c}});var sy=X(()=>{"use strict";var j5=sr(),pT=oy();pT&&j5({target:"ArrayBuffer",proto:!0},{transfer:function(){return pT(this,arguments.length?arguments[0]:void 0,!0)}})});var ay=X(()=>{"use strict";var K5=sr(),dT=oy();dT&&K5({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return dT(this,arguments.length?arguments[0]:void 0,!1)}})});var To=X((Git,gT)=>{"use strict";var uy=In(),np=Set.prototype;gT.exports={Set,add:uy(np.add),has:uy(np.has),remove:uy(np.delete),proto:np}});var ea=X((kit,mT)=>{"use strict";var Q5=To().has;mT.exports=function(n){return Q5(n),n}});var na=X((qit,yT)=>{"use strict";var tV=vr();yT.exports=function(n,t,e){for(var i=e?n:n.iterator,s=n.next,u,c;!(u=tV(s,i)).done;)if(c=t(u.value),c!==void 0)return c}});var el=X((Vit,ST)=>{"use strict";var vT=In(),eV=na(),_T=To(),nV=_T.Set,xT=_T.proto,rV=vT(xT.forEach),ET=vT(xT.keys),iV=ET(new nV).next;ST.exports=function(n,t,e){return e?eV({iterator:ET(n),next:iV},t):rV(n,t)}});var rp=X((Hit,MT)=>{"use strict";var wT=To(),oV=el(),sV=wT.Set,aV=wT.add;MT.exports=function(n){var t=new sV;return oV(n,function(e){aV(t,e)}),t}});var nl=X((Wit,bT)=>{"use strict";var uV=Bc(),lV=To();bT.exports=uV(lV.proto,"size","get")||function(n){return n.size}});var TT=X((Xit,AT)=>{"use strict";AT.exports=function(n){return{iterator:n,next:n.next,done:!1}}});var ra=X((Yit,NT)=>{"use strict";var CT=_s(),RT=so(),IT=vr(),cV=Hi(),fV=TT(),PT="Invalid size",hV=RangeError,pV=TypeError,dV=Math.max,LT=function(n,t){this.set=n,this.size=dV(t,0),this.has=CT(n.has),this.keys=CT(n.keys)};LT.prototype={getIterator:function(){return fV(RT(IT(this.keys,this.set)))},includes:function(n){return IT(this.has,this.set,n)}};NT.exports=function(n){RT(n);var t=+n.size;if(t!==t)throw new pV(PT);var e=cV(t);if(e<0)throw new hV(PT);return new LT(n,e)}});var UT=X(($it,FT)=>{"use strict";var gV=ea(),DT=To(),mV=rp(),yV=nl(),vV=ra(),_V=el(),xV=na(),EV=DT.has,OT=DT.remove;FT.exports=function(t){var e=gV(this),i=vV(t),s=mV(e);return yV(e)<=i.size?_V(e,function(u){i.includes(u)&&OT(s,u)}):xV(i.getIterator(),function(u){EV(e,u)&&OT(s,u)}),s}});var ia=X((Zit,GT)=>{"use strict";var SV=$s(),BT=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},zT=function(n){return{size:n,has:function(){return!0},keys:function(){throw new Error("e")}}};GT.exports=function(n,t){var e=SV("Set");try{new e()[n](BT(0));try{return new e()[n](BT(-1)),!1}catch(s){if(!t)return!0;try{return new e()[n](zT(-1/0)),!1}catch(u){var i=new e;return i.add(1),i.add(2),t(i[n](zT(1/0)))}}}catch(s){return!1}}});var kT=X(()=>{"use strict";var wV=sr(),MV=UT(),bV=ia(),AV=!bV("difference",function(n){return n.size===0});wV({target:"Set",proto:!0,real:!0,forced:AV},{difference:MV})});var HT=X((Kit,VT)=>{"use strict";var TV=ea(),ly=To(),CV=nl(),IV=ra(),PV=el(),RV=na(),LV=ly.Set,qT=ly.add,NV=ly.has;VT.exports=function(t){var e=TV(this),i=IV(t),s=new LV;return CV(e)>i.size?RV(i.getIterator(),function(u){NV(e,u)&&qT(s,u)}):PV(e,function(u){i.includes(u)&&qT(s,u)}),s}});var WT=X(()=>{"use strict";var OV=sr(),DV=An(),FV=HT(),UV=ia(),BV=!UV("intersection",function(n){return n.size===2&&n.has(1)&&n.has(2)})||DV(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});OV({target:"Set",proto:!0,real:!0,forced:BV},{intersection:FV})});var cy=X((eot,YT)=>{"use strict";var zV=vr(),XT=so(),GV=Pc();YT.exports=function(n,t,e){var i,s;XT(n);try{if(i=GV(n,"return"),!i){if(t==="throw")throw e;return e}i=zV(i,n)}catch(u){s=!0,i=u}if(t==="throw")throw e;if(s)throw i;return XT(i),e}});var ZT=X((not,$T)=>{"use strict";var kV=ea(),qV=To().has,VV=nl(),HV=ra(),WV=el(),XV=na(),YV=cy();$T.exports=function(t){var e=kV(this),i=HV(t);if(VV(e)<=i.size)return WV(e,function(u){if(i.includes(u))return!1},!0)!==!1;var s=i.getIterator();return XV(s,function(u){if(qV(e,u))return YV(s,"normal",!1)})!==!1}});var JT=X(()=>{"use strict";var $V=sr(),ZV=ZT(),JV=ia(),jV=!JV("isDisjointFrom",function(n){return!n});$V({target:"Set",proto:!0,real:!0,forced:jV},{isDisjointFrom:ZV})});var KT=X((oot,jT)=>{"use strict";var KV=ea(),QV=nl(),tH=el(),eH=ra();jT.exports=function(t){var e=KV(this),i=eH(t);return QV(e)>i.size?!1:tH(e,function(s){if(!i.includes(s))return!1},!0)!==!1}});var QT=X(()=>{"use strict";var nH=sr(),rH=KT(),iH=ia(),oH=!iH("isSubsetOf",function(n){return n});nH({target:"Set",proto:!0,real:!0,forced:oH},{isSubsetOf:rH})});var eC=X((uot,tC)=>{"use strict";var sH=ea(),aH=To().has,uH=nl(),lH=ra(),cH=na(),fH=cy();tC.exports=function(t){var e=sH(this),i=lH(t);if(uH(e)<i.size)return!1;var s=i.getIterator();return cH(s,function(u){if(!aH(e,u))return fH(s,"normal",!1)})!==!1}});var nC=X(()=>{"use strict";var hH=sr(),pH=eC(),dH=ia(),gH=!dH("isSupersetOf",function(n){return!n});hH({target:"Set",proto:!0,real:!0,forced:gH},{isSupersetOf:pH})});var iC=X((fot,rC)=>{"use strict";var mH=ea(),fy=To(),yH=rp(),vH=ra(),_H=na(),xH=fy.add,EH=fy.has,SH=fy.remove;rC.exports=function(t){var e=mH(this),i=vH(t).getIterator(),s=yH(e);return _H(i,function(u){EH(e,u)?SH(s,u):xH(s,u)}),s}});var oC=X(()=>{"use strict";var wH=sr(),MH=iC(),bH=ia();wH({target:"Set",proto:!0,real:!0,forced:!bH("symmetricDifference")},{symmetricDifference:MH})});var aC=X((dot,sC)=>{"use strict";var AH=ea(),TH=To().add,CH=rp(),IH=ra(),PH=na();sC.exports=function(t){var e=AH(this),i=IH(t).getIterator(),s=CH(e);return PH(i,function(u){TH(s,u)}),s}});var uC=X(()=>{"use strict";var RH=sr(),LH=aC(),NH=ia();RH({target:"Set",proto:!0,real:!0,forced:!NH("union")},{union:LH})});var hy=X((yot,cC)=>{"use strict";var lC=qu(),OH=TypeError;cC.exports=function(n,t){if(!delete n[t])throw new OH("Cannot delete property "+lC(t)+" of "+lC(n))}});var fC=X(()=>{"use strict";var DH=sr(),FH=Vi(),UH=ii(),BH=vm(),zH=hy(),GH=Mh(),kH=[].unshift(0)!==1,qH=function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(n){return n instanceof TypeError}},VH=kH||!qH();DH({target:"Array",proto:!0,arity:1,forced:VH},{unshift:function(t){var e=FH(this),i=UH(e),s=arguments.length;if(s){GH(i+s);for(var u=i;u--;){var c=u+s;u in e?e[c]=e[u]:zH(e,c)}for(var f=0;f<s;f++)e[f]=arguments[f]}return BH(e,i+s)}})});var Fl=X((Not,gP)=>{"use strict";var bY=Zs(),AY=String;gP.exports=function(n){if(bY(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return AY(n)}});var yP=X((Oot,mP)=>{"use strict";var TY=so();mP.exports=function(){var n=TY(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 _P=X((Dot,vP)=>{"use strict";var t_=An(),CY=Sn(),e_=CY.RegExp,n_=t_(function(){var n=e_("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),IY=n_||t_(function(){return!e_("a","y").sticky}),PY=n_||t_(function(){var n=e_("^r","gy");return n.lastIndex=2,n.exec("str")!==null});vP.exports={BROKEN_CARET:PY,MISSED_STICKY:IY,UNSUPPORTED_Y:n_}});var EP=X((Fot,xP)=>{"use strict";var RY=An(),LY=Sn(),NY=LY.RegExp;xP.exports=RY(function(){var n=NY(".","s");return!(n.dotAll&&n.test(`
1
+ var $D=Object.create;var U1=Object.defineProperty;var ZD=Object.getOwnPropertyDescriptor;var JD=Object.getOwnPropertyNames;var jD=Object.getPrototypeOf,KD=Object.prototype.hasOwnProperty;var X=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var QD=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of JD(t))!KD.call(n,s)&&s!==e&&U1(n,s,{get:()=>t[s],enumerable:!(i=ZD(t,s))||i.enumerable});return n};var Jt=(n,t,e)=>(e=n!=null?$D(jD(n)):{},QD(t||!n||!n.__esModule?U1(e,"default",{value:n,enumerable:!0}):e,n));var Ri=(n,t,e)=>new Promise((i,s)=>{var u=p=>{try{f(e.next(p))}catch(d){s(d)}},c=p=>{try{f(e.throw(p))}catch(d){s(d)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,c);f((e=e.apply(n,t)).next())});var Sn=X((zg,B1)=>{"use strict";var Mc=function(n){return n&&n.Math===Math&&n};B1.exports=Mc(typeof globalThis=="object"&&globalThis)||Mc(typeof window=="object"&&window)||Mc(typeof self=="object"&&self)||Mc(typeof global=="object"&&global)||Mc(typeof zg=="object"&&zg)||function(){return this}()||Function("return this")()});var An=X((vet,z1)=>{"use strict";z1.exports=function(n){try{return!!n()}catch(t){return!0}}});var ri=X((_et,G1)=>{"use strict";var t3=An();G1.exports=!t3(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var bc=X((xet,k1)=>{"use strict";var e3=An();k1.exports=!e3(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var vr=X((Eet,q1)=>{"use strict";var n3=bc(),eh=Function.prototype.call;q1.exports=n3?eh.bind(eh):function(){return eh.apply(eh,arguments)}});var X1=X(W1=>{"use strict";var V1={}.propertyIsEnumerable,H1=Object.getOwnPropertyDescriptor,r3=H1&&!V1.call({1:2},1);W1.f=r3?function(t){var e=H1(this,t);return!!e&&e.enumerable}:V1});var Ac=X((Met,Y1)=>{"use strict";Y1.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var In=X((bet,J1)=>{"use strict";var $1=bc(),Z1=Function.prototype,Gg=Z1.call,i3=$1&&Z1.bind.bind(Gg,Gg);J1.exports=$1?i3:function(n){return function(){return Gg.apply(n,arguments)}}});var _s=X((Aet,K1)=>{"use strict";var j1=In(),o3=j1({}.toString),s3=j1("".slice);K1.exports=function(n){return s3(o3(n),8,-1)}});var nh=X((Tet,Q1)=>{"use strict";var a3=In(),u3=An(),l3=_s(),kg=Object,c3=a3("".split);Q1.exports=u3(function(){return!kg("z").propertyIsEnumerable(0)})?function(n){return l3(n)==="String"?c3(n,""):kg(n)}:kg});var rh=X((Cet,tE)=>{"use strict";tE.exports=function(n){return n==null}});var zu=X((Iet,eE)=>{"use strict";var f3=rh(),h3=TypeError;eE.exports=function(n){if(f3(n))throw new h3("Can't call method on "+n);return n}});var Gu=X((Pet,nE)=>{"use strict";var p3=nh(),d3=zu();nE.exports=function(n){return p3(d3(n))}});var er=X((Ret,rE)=>{"use strict";var qg=typeof document=="object"&&document.all;rE.exports=typeof qg=="undefined"&&qg!==void 0?function(n){return typeof n=="function"||n===qg}:function(n){return typeof n=="function"}});var Ei=X((Let,iE)=>{"use strict";var g3=er();iE.exports=function(n){return typeof n=="object"?n!==null:g3(n)}});var $s=X((Net,oE)=>{"use strict";var Vg=Sn(),m3=er(),y3=function(n){return m3(n)?n:void 0};oE.exports=function(n,t){return arguments.length<2?y3(Vg[n]):Vg[n]&&Vg[n][t]}});var Tc=X((Oet,sE)=>{"use strict";var v3=In();sE.exports=v3({}.isPrototypeOf)});var ku=X((Det,lE)=>{"use strict";var _3=Sn(),aE=_3.navigator,uE=aE&&aE.userAgent;lE.exports=uE?String(uE):""});var Cc=X((Fet,gE)=>{"use strict";var dE=Sn(),Hg=ku(),cE=dE.process,fE=dE.Deno,hE=cE&&cE.versions||fE&&fE.version,pE=hE&&hE.v8,wo,ih;pE&&(wo=pE.split("."),ih=wo[0]>0&&wo[0]<4?1:+(wo[0]+wo[1]));!ih&&Hg&&(wo=Hg.match(/Edge\/(\d+)/),(!wo||wo[1]>=74)&&(wo=Hg.match(/Chrome\/(\d+)/),wo&&(ih=+wo[1])));gE.exports=ih});var oh=X((Uet,yE)=>{"use strict";var mE=Cc(),x3=An(),E3=Sn(),S3=E3.String;yE.exports=!!Object.getOwnPropertySymbols&&!x3(function(){var n=Symbol("symbol detection");return!S3(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&mE&&mE<41})});var Wg=X((Bet,vE)=>{"use strict";var w3=oh();vE.exports=w3&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ic=X((zet,_E)=>{"use strict";var M3=$s(),b3=er(),A3=Tc(),T3=Wg(),C3=Object;_E.exports=T3?function(n){return typeof n=="symbol"}:function(n){var t=M3("Symbol");return b3(t)&&A3(t.prototype,C3(n))}});var qu=X((Get,xE)=>{"use strict";var I3=String;xE.exports=function(n){try{return I3(n)}catch(t){return"Object"}}});var xs=X((ket,EE)=>{"use strict";var P3=er(),R3=qu(),L3=TypeError;EE.exports=function(n){if(P3(n))return n;throw new L3(R3(n)+" is not a function")}});var Pc=X((qet,SE)=>{"use strict";var N3=xs(),O3=rh();SE.exports=function(n,t){var e=n[t];return O3(e)?void 0:N3(e)}});var ME=X((Vet,wE)=>{"use strict";var Xg=vr(),Yg=er(),$g=Ei(),D3=TypeError;wE.exports=function(n,t){var e,i;if(t==="string"&&Yg(e=n.toString)&&!$g(i=Xg(e,n))||Yg(e=n.valueOf)&&!$g(i=Xg(e,n))||t!=="string"&&Yg(e=n.toString)&&!$g(i=Xg(e,n)))return i;throw new D3("Can't convert object to primitive value")}});var Rc=X((Het,bE)=>{"use strict";bE.exports=!1});var sh=X((Wet,TE)=>{"use strict";var AE=Sn(),F3=Object.defineProperty;TE.exports=function(n,t){try{F3(AE,n,{value:t,configurable:!0,writable:!0})}catch(e){AE[n]=t}return t}});var ah=X((Xet,PE)=>{"use strict";var U3=Rc(),B3=Sn(),z3=sh(),CE="__core-js_shared__",IE=PE.exports=B3[CE]||z3(CE,{});(IE.versions||(IE.versions=[])).push({version:"3.42.0",mode:U3?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var uh=X((Yet,LE)=>{"use strict";var RE=ah();LE.exports=function(n,t){return RE[n]||(RE[n]=t||{})}});var Vi=X(($et,NE)=>{"use strict";var G3=zu(),k3=Object;NE.exports=function(n){return k3(G3(n))}});var oo=X((Zet,OE)=>{"use strict";var q3=In(),V3=Vi(),H3=q3({}.hasOwnProperty);OE.exports=Object.hasOwn||function(t,e){return H3(V3(t),e)}});var lh=X((Jet,DE)=>{"use strict";var W3=In(),X3=0,Y3=Math.random(),$3=W3(1 .toString);DE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+$3(++X3+Y3,36)}});var Xr=X((jet,UE)=>{"use strict";var Z3=Sn(),J3=uh(),FE=oo(),j3=lh(),K3=oh(),Q3=Wg(),Vu=Z3.Symbol,Zg=J3("wks"),tF=Q3?Vu.for||Vu:Vu&&Vu.withoutSetter||j3;UE.exports=function(n){return FE(Zg,n)||(Zg[n]=K3&&FE(Vu,n)?Vu[n]:tF("Symbol."+n)),Zg[n]}});var Jg=X((Ket,GE)=>{"use strict";var eF=vr(),BE=Ei(),zE=Ic(),nF=Pc(),rF=ME(),iF=Xr(),oF=TypeError,sF=iF("toPrimitive");GE.exports=function(n,t){if(!BE(n)||zE(n))return n;var e=nF(n,sF),i;if(e){if(t===void 0&&(t="default"),i=eF(e,n,t),!BE(i)||zE(i))return i;throw new oF("Can't convert object to primitive value")}return t===void 0&&(t="number"),rF(n,t)}});var ch=X((Qet,kE)=>{"use strict";var aF=Jg(),uF=Ic();kE.exports=function(n){var t=aF(n,"string");return uF(t)?t:t+""}});var fh=X((tnt,VE)=>{"use strict";var lF=Sn(),qE=Ei(),jg=lF.document,cF=qE(jg)&&qE(jg.createElement);VE.exports=function(n){return cF?jg.createElement(n):{}}});var Kg=X((ent,HE)=>{"use strict";var fF=ri(),hF=An(),pF=fh();HE.exports=!fF&&!hF(function(){return Object.defineProperty(pF("div"),"a",{get:function(){return 7}}).a!==7})});var hh=X(XE=>{"use strict";var dF=ri(),gF=vr(),mF=X1(),yF=Ac(),vF=Gu(),_F=ch(),xF=oo(),EF=Kg(),WE=Object.getOwnPropertyDescriptor;XE.f=dF?WE:function(t,e){if(t=vF(t),e=_F(e),EF)try{return WE(t,e)}catch(i){}if(xF(t,e))return yF(!gF(mF.f,t,e),t[e])}});var Qg=X((rnt,YE)=>{"use strict";var SF=ri(),wF=An();YE.exports=SF&&wF(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var so=X((int,$E)=>{"use strict";var MF=Ei(),bF=String,AF=TypeError;$E.exports=function(n){if(MF(n))return n;throw new AF(bF(n)+" is not an object")}});var Wo=X(JE=>{"use strict";var TF=ri(),CF=Kg(),IF=Qg(),ph=so(),ZE=ch(),PF=TypeError,tm=Object.defineProperty,RF=Object.getOwnPropertyDescriptor,em="enumerable",nm="configurable",rm="writable";JE.f=TF?IF?function(t,e,i){if(ph(t),e=ZE(e),ph(i),typeof t=="function"&&e==="prototype"&&"value"in i&&rm in i&&!i[rm]){var s=RF(t,e);s&&s[rm]&&(t[e]=i.value,i={configurable:nm in i?i[nm]:s[nm],enumerable:em in i?i[em]:s[em],writable:!1})}return tm(t,e,i)}:tm:function(t,e,i){if(ph(t),e=ZE(e),ph(i),CF)try{return tm(t,e,i)}catch(s){}if("get"in i||"set"in i)throw new PF("Accessors not supported");return"value"in i&&(t[e]=i.value),t}});var Es=X((snt,jE)=>{"use strict";var LF=ri(),NF=Wo(),OF=Ac();jE.exports=LF?function(n,t,e){return NF.f(n,t,OF(1,e))}:function(n,t,e){return n[t]=e,n}});var dh=X((ant,QE)=>{"use strict";var im=ri(),DF=oo(),KE=Function.prototype,FF=im&&Object.getOwnPropertyDescriptor,om=DF(KE,"name"),UF=om&&function(){}.name==="something",BF=om&&(!im||im&&FF(KE,"name").configurable);QE.exports={EXISTS:om,PROPER:UF,CONFIGURABLE:BF}});var am=X((unt,tS)=>{"use strict";var zF=In(),GF=er(),sm=ah(),kF=zF(Function.toString);GF(sm.inspectSource)||(sm.inspectSource=function(n){return kF(n)});tS.exports=sm.inspectSource});var rS=X((lnt,nS)=>{"use strict";var qF=Sn(),VF=er(),eS=qF.WeakMap;nS.exports=VF(eS)&&/native code/.test(String(eS))});var gh=X((cnt,oS)=>{"use strict";var HF=uh(),WF=lh(),iS=HF("keys");oS.exports=function(n){return iS[n]||(iS[n]=WF(n))}});var mh=X((fnt,sS)=>{"use strict";sS.exports={}});var Va=X((hnt,lS)=>{"use strict";var XF=rS(),uS=Sn(),YF=Ei(),$F=Es(),um=oo(),lm=ah(),ZF=gh(),JF=mh(),aS="Object already initialized",cm=uS.TypeError,jF=uS.WeakMap,yh,Lc,vh,KF=function(n){return vh(n)?Lc(n):yh(n,{})},QF=function(n){return function(t){var e;if(!YF(t)||(e=Lc(t)).type!==n)throw new cm("Incompatible receiver, "+n+" required");return e}};XF||lm.state?(Mo=lm.state||(lm.state=new jF),Mo.get=Mo.get,Mo.has=Mo.has,Mo.set=Mo.set,yh=function(n,t){if(Mo.has(n))throw new cm(aS);return t.facade=n,Mo.set(n,t),t},Lc=function(n){return Mo.get(n)||{}},vh=function(n){return Mo.has(n)}):(qa=ZF("state"),JF[qa]=!0,yh=function(n,t){if(um(n,qa))throw new cm(aS);return t.facade=n,$F(n,qa,t),t},Lc=function(n){return um(n,qa)?n[qa]:{}},vh=function(n){return um(n,qa)});var Mo,qa;lS.exports={set:yh,get:Lc,has:vh,enforce:KF,getterFor:QF}});var pm=X((pnt,hS)=>{"use strict";var hm=In(),tU=An(),eU=er(),_h=oo(),fm=ri(),nU=dh().CONFIGURABLE,rU=am(),fS=Va(),iU=fS.enforce,oU=fS.get,cS=String,xh=Object.defineProperty,sU=hm("".slice),aU=hm("".replace),uU=hm([].join),lU=fm&&!tU(function(){return xh(function(){},"length",{value:8}).length!==8}),cU=String(String).split("String"),fU=hS.exports=function(n,t,e){sU(cS(t),0,7)==="Symbol("&&(t="["+aU(cS(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!_h(n,"name")||nU&&n.name!==t)&&(fm?xh(n,"name",{value:t,configurable:!0}):n.name=t),lU&&e&&_h(e,"arity")&&n.length!==e.arity&&xh(n,"length",{value:e.arity});try{e&&_h(e,"constructor")&&e.constructor?fm&&xh(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var i=iU(n);return _h(i,"source")||(i.source=uU(cU,typeof t=="string"?t:"")),n};Function.prototype.toString=fU(function(){return eU(this)&&oU(this).source||rU(this)},"toString")});var Ha=X((dnt,pS)=>{"use strict";var hU=er(),pU=Wo(),dU=pm(),gU=sh();pS.exports=function(n,t,e,i){i||(i={});var s=i.enumerable,u=i.name!==void 0?i.name:t;if(hU(e)&&dU(e,u,i),i.global)s?n[t]=e:gU(t,e);else{try{i.unsafe?n[t]&&(s=!0):delete n[t]}catch(c){}s?n[t]=e:pU.f(n,t,{value:e,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return n}});var gS=X((gnt,dS)=>{"use strict";var mU=Math.ceil,yU=Math.floor;dS.exports=Math.trunc||function(t){var e=+t;return(e>0?yU:mU)(e)}});var Hi=X((mnt,mS)=>{"use strict";var vU=gS();mS.exports=function(n){var t=+n;return t!==t||t===0?0:vU(t)}});var Eh=X((ynt,yS)=>{"use strict";var _U=Hi(),xU=Math.max,EU=Math.min;yS.exports=function(n,t){var e=_U(n);return e<0?xU(e+t,0):EU(e,t)}});var Wa=X((vnt,vS)=>{"use strict";var SU=Hi(),wU=Math.min;vS.exports=function(n){var t=SU(n);return t>0?wU(t,9007199254740991):0}});var ii=X((_nt,_S)=>{"use strict";var MU=Wa();_S.exports=function(n){return MU(n.length)}});var SS=X((xnt,ES)=>{"use strict";var bU=Gu(),AU=Eh(),TU=ii(),xS=function(n){return function(t,e,i){var s=bU(t),u=TU(s);if(u===0)return!n&&-1;var c=AU(i,u),f;if(n&&e!==e){for(;u>c;)if(f=s[c++],f!==f)return!0}else for(;u>c;c++)if((n||c in s)&&s[c]===e)return n||c||0;return!n&&-1}};ES.exports={includes:xS(!0),indexOf:xS(!1)}});var gm=X((Ent,MS)=>{"use strict";var CU=In(),dm=oo(),IU=Gu(),PU=SS().indexOf,RU=mh(),wS=CU([].push);MS.exports=function(n,t){var e=IU(n),i=0,s=[],u;for(u in e)!dm(RU,u)&&dm(e,u)&&wS(s,u);for(;t.length>i;)dm(e,u=t[i++])&&(~PU(s,u)||wS(s,u));return s}});var Sh=X((Snt,bS)=>{"use strict";bS.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var mm=X(AS=>{"use strict";var LU=gm(),NU=Sh(),OU=NU.concat("length","prototype");AS.f=Object.getOwnPropertyNames||function(t){return LU(t,OU)}});var CS=X(TS=>{"use strict";TS.f=Object.getOwnPropertySymbols});var PS=X((bnt,IS)=>{"use strict";var DU=$s(),FU=In(),UU=mm(),BU=CS(),zU=so(),GU=FU([].concat);IS.exports=DU("Reflect","ownKeys")||function(t){var e=UU.f(zU(t)),i=BU.f;return i?GU(e,i(t)):e}});var ym=X((Ant,LS)=>{"use strict";var RS=oo(),kU=PS(),qU=hh(),VU=Wo();LS.exports=function(n,t,e){for(var i=kU(t),s=VU.f,u=qU.f,c=0;c<i.length;c++){var f=i[c];!RS(n,f)&&!(e&&RS(e,f))&&s(n,f,u(t,f))}}});var OS=X((Tnt,NS)=>{"use strict";var HU=An(),WU=er(),XU=/#|\.prototype\./,Nc=function(n,t){var e=$U[YU(n)];return e===JU?!0:e===ZU?!1:WU(t)?HU(t):!!t},YU=Nc.normalize=function(n){return String(n).replace(XU,".").toLowerCase()},$U=Nc.data={},ZU=Nc.NATIVE="N",JU=Nc.POLYFILL="P";NS.exports=Nc});var sr=X((Cnt,DS)=>{"use strict";var wh=Sn(),jU=hh().f,KU=Es(),QU=Ha(),tB=sh(),eB=ym(),nB=OS();DS.exports=function(n,t){var e=n.target,i=n.global,s=n.stat,u,c,f,p,d,g;if(i?c=wh:s?c=wh[e]||tB(e,{}):c=wh[e]&&wh[e].prototype,c)for(f in t){if(d=t[f],n.dontCallGetSet?(g=jU(c,f),p=g&&g.value):p=c[f],u=nB(i?f:e+(s?".":"#")+f,n.forced),!u&&p!==void 0){if(typeof d==typeof p)continue;eB(d,p)}(n.sham||p&&p.sham)&&KU(d,"sham",!0),QU(c,f,d,n)}}});var Oc=X((Int,FS)=>{"use strict";var rB=_s();FS.exports=Array.isArray||function(t){return rB(t)==="Array"}});var vm=X((Pnt,US)=>{"use strict";var iB=ri(),oB=Oc(),sB=TypeError,aB=Object.getOwnPropertyDescriptor,uB=iB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();US.exports=uB?function(n,t){if(oB(n)&&!aB(n,"length").writable)throw new sB("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var Mh=X((Rnt,BS)=>{"use strict";var lB=TypeError,cB=9007199254740991;BS.exports=function(n){if(n>cB)throw lB("Maximum allowed index exceeded");return n}});var Dc=X(()=>{"use strict";var fB=sr(),hB=Vi(),pB=ii(),dB=vm(),gB=Mh(),mB=An(),yB=mB(function(){return[].push.call({length:4294967296},1)!==4294967297}),vB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},_B=yB||!vB();fB({target:"Array",proto:!0,arity:1,forced:_B},{push:function(t){var e=hB(this),i=pB(e),s=arguments.length;gB(i+s);for(var u=0;u<s;u++)e[i]=arguments[u],i++;return dB(e,i),i}})});var zS=X(()=>{"use strict";var xB=sr(),EB=vr();xB({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return EB(URL.prototype.toString,this)}})});var kS=X((Fnt,GS)=>{"use strict";GS.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=X((Unt,VS)=>{"use strict";var SB=fh(),_m=SB("span").classList,qS=_m&&_m.constructor&&_m.constructor.prototype;VS.exports=qS===Object.prototype?void 0:qS});var XS=X((Bnt,WS)=>{"use strict";var wB=gm(),MB=Sh();WS.exports=Object.keys||function(t){return wB(t,MB)}});var $S=X(YS=>{"use strict";var bB=ri(),AB=Qg(),TB=Wo(),CB=so(),IB=Gu(),PB=XS();YS.f=bB&&!AB?Object.defineProperties:function(t,e){CB(t);for(var i=IB(e),s=PB(e),u=s.length,c=0,f;u>c;)TB.f(t,f=s[c++],i[f]);return t}});var JS=X((Gnt,ZS)=>{"use strict";var RB=$s();ZS.exports=RB("document","documentElement")});var Hu=X((knt,rw)=>{"use strict";var LB=so(),NB=$S(),jS=Sh(),OB=mh(),DB=JS(),FB=fh(),UB=gh(),KS=">",QS="<",Em="prototype",Sm="script",ew=UB("IE_PROTO"),xm=function(){},nw=function(n){return QS+Sm+KS+n+QS+"/"+Sm+KS},tw=function(n){n.write(nw("")),n.close();var t=n.parentWindow.Object;return n=null,t},BB=function(){var n=FB("iframe"),t="java"+Sm+":",e;return n.style.display="none",DB.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(nw("document.F=Object")),e.close(),e.F},bh,Ah=function(){try{bh=new ActiveXObject("htmlfile")}catch(t){}Ah=typeof document!="undefined"?document.domain&&bh?tw(bh):BB():tw(bh);for(var n=jS.length;n--;)delete Ah[Em][jS[n]];return Ah()};OB[ew]=!0;rw.exports=Object.create||function(t,e){var i;return t!==null?(xm[Em]=LB(t),i=new xm,xm[Em]=null,i[ew]=t):i=Ah(),e===void 0?i:NB.f(i,e)}});var bm=X((qnt,iw)=>{"use strict";var zB=Xr(),GB=Hu(),kB=Wo().f,wm=zB("unscopables"),Mm=Array.prototype;Mm[wm]===void 0&&kB(Mm,wm,{configurable:!0,value:GB(null)});iw.exports=function(n){Mm[wm][n]=!0}});var Wu=X((Vnt,ow)=>{"use strict";ow.exports={}});var aw=X((Hnt,sw)=>{"use strict";var qB=An();sw.exports=!qB(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var Fc=X((Wnt,lw)=>{"use strict";var VB=oo(),HB=er(),WB=Vi(),XB=gh(),YB=aw(),uw=XB("IE_PROTO"),Am=Object,$B=Am.prototype;lw.exports=YB?Am.getPrototypeOf:function(n){var t=WB(n);if(VB(t,uw))return t[uw];var e=t.constructor;return HB(e)&&t instanceof e?e.prototype:t instanceof Am?$B:null}});var Pm=X((Xnt,hw)=>{"use strict";var ZB=An(),JB=er(),jB=Ei(),KB=Hu(),cw=Fc(),QB=Ha(),tz=Xr(),ez=Rc(),Im=tz("iterator"),fw=!1,Ss,Tm,Cm;[].keys&&(Cm=[].keys(),"next"in Cm?(Tm=cw(cw(Cm)),Tm!==Object.prototype&&(Ss=Tm)):fw=!0);var nz=!jB(Ss)||ZB(function(){var n={};return Ss[Im].call(n)!==n});nz?Ss={}:ez&&(Ss=KB(Ss));JB(Ss[Im])||QB(Ss,Im,function(){return this});hw.exports={IteratorPrototype:Ss,BUGGY_SAFARI_ITERATORS:fw}});var Uc=X((Ynt,dw)=>{"use strict";var rz=Wo().f,iz=oo(),oz=Xr(),pw=oz("toStringTag");dw.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!iz(n,pw)&&rz(n,pw,{configurable:!0,value:t})}});var mw=X(($nt,gw)=>{"use strict";var sz=Pm().IteratorPrototype,az=Hu(),uz=Ac(),lz=Uc(),cz=Wu(),fz=function(){return this};gw.exports=function(n,t,e,i){var s=t+" Iterator";return n.prototype=az(sz,{next:uz(+!i,e)}),lz(n,s,!1,!0),cz[s]=fz,n}});var Bc=X((Znt,yw)=>{"use strict";var hz=In(),pz=xs();yw.exports=function(n,t,e){try{return hz(pz(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(i){}}});var _w=X((Jnt,vw)=>{"use strict";var dz=Ei();vw.exports=function(n){return dz(n)||n===null}});var Ew=X((jnt,xw)=>{"use strict";var gz=_w(),mz=String,yz=TypeError;xw.exports=function(n){if(gz(n))return n;throw new yz("Can't set "+mz(n)+" as a prototype")}});var Xu=X((Knt,Sw)=>{"use strict";var vz=Bc(),_z=Ei(),xz=zu(),Ez=Ew();Sw.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=vz(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(i){}return function(s,u){return xz(s),Ez(u),_z(s)&&(n?e(s,u):s.__proto__=u),s}}():void 0)});var Nw=X((Qnt,Lw)=>{"use strict";var Sz=sr(),wz=vr(),Th=Rc(),Pw=dh(),Mz=er(),bz=mw(),ww=Fc(),Mw=Xu(),Az=Uc(),Tz=Es(),Rm=Ha(),Cz=Xr(),bw=Wu(),Rw=Pm(),Iz=Pw.PROPER,Pz=Pw.CONFIGURABLE,Aw=Rw.IteratorPrototype,Ch=Rw.BUGGY_SAFARI_ITERATORS,zc=Cz("iterator"),Tw="keys",Gc="values",Cw="entries",Iw=function(){return this};Lw.exports=function(n,t,e,i,s,u,c){bz(e,t,i);var f=function(x){if(x===s&&v)return v;if(!Ch&&x&&x in g)return g[x];switch(x){case Tw:return function(){return new e(this,x)};case Gc:return function(){return new e(this,x)};case Cw:return function(){return new e(this,x)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,g=n.prototype,y=g[zc]||g["@@iterator"]||s&&g[s],v=!Ch&&y||f(s),E=t==="Array"&&g.entries||y,M,A,_;if(E&&(M=ww(E.call(new n)),M!==Object.prototype&&M.next&&(!Th&&ww(M)!==Aw&&(Mw?Mw(M,Aw):Mz(M[zc])||Rm(M,zc,Iw)),Az(M,p,!0,!0),Th&&(bw[p]=Iw))),Iz&&s===Gc&&y&&y.name!==Gc&&(!Th&&Pz?Tz(g,"name",Gc):(d=!0,v=function(){return wz(y,this)})),s)if(A={values:f(Gc),keys:u?v:f(Tw),entries:f(Cw)},c)for(_ in A)(Ch||d||!(_ in g))&&Rm(g,_,A[_]);else Sz({target:t,proto:!0,forced:Ch||d},A);return(!Th||c)&&g[zc]!==v&&Rm(g,zc,v,{name:s}),bw[t]=v,A}});var Dw=X((trt,Ow)=>{"use strict";Ow.exports=function(n,t){return{value:n,done:t}}});var kw=X((ert,Gw)=>{"use strict";var Rz=Gu(),Lm=bm(),Fw=Wu(),Bw=Va(),Lz=Wo().f,Nz=Nw(),Ih=Dw(),Oz=Rc(),Dz=ri(),zw="Array Iterator",Fz=Bw.set,Uz=Bw.getterFor(zw);Gw.exports=Nz(Array,"Array",function(n,t){Fz(this,{type:zw,target:Rz(n),index:0,kind:t})},function(){var n=Uz(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Ih(void 0,!0);switch(n.kind){case"keys":return Ih(e,!1);case"values":return Ih(t[e],!1)}return Ih([e,t[e]],!1)},"values");var Uw=Fw.Arguments=Fw.Array;Lm("keys");Lm("values");Lm("entries");if(!Oz&&Dz&&Uw.name!=="values")try{Lz(Uw,"name",{value:"values"})}catch(n){}});var Yu=X(()=>{"use strict";var qw=Sn(),Hw=kS(),Bz=HS(),kc=kw(),Vw=Es(),zz=Uc(),Gz=Xr(),Nm=Gz("iterator"),Om=kc.values,Ww=function(n,t){if(n){if(n[Nm]!==Om)try{Vw(n,Nm,Om)}catch(i){n[Nm]=Om}if(zz(n,t,!0),Hw[t]){for(var e in kc)if(n[e]!==kc[e])try{Vw(n,e,kc[e])}catch(i){n[e]=kc[e]}}}};for(Ph in Hw)Ww(qw[Ph]&&qw[Ph].prototype,Ph);var Ph;Ww(Bz,"DOMTokenList")});var Rh=X((irt,Xw)=>{"use strict";var kz=_s(),qz=In();Xw.exports=function(n){if(kz(n)==="Function")return qz(n)}});var qc=X((ort,$w)=>{"use strict";var Yw=Rh(),Vz=xs(),Hz=bc(),Wz=Yw(Yw.bind);$w.exports=function(n,t){return Vz(n),t===void 0?n:Hz?Wz(n,t):function(){return n.apply(t,arguments)}}});var jw=X((srt,Jw)=>{"use strict";var Xz=Oc(),Yz=ii(),$z=Mh(),Zz=qc(),Zw=function(n,t,e,i,s,u,c,f){for(var p=s,d=0,g=c?Zz(c,f):!1,y,v;d<i;)d in e&&(y=g?g(e[d],d,t):e[d],u>0&&Xz(y)?(v=Yz(y),p=Zw(n,t,y,v,p,u-1)-1):($z(p+1),n[p]=y),p++),d++;return p};Jw.exports=Zw});var tM=X((art,Qw)=>{"use strict";var Jz=Xr(),jz=Jz("toStringTag"),Kw={};Kw[jz]="z";Qw.exports=String(Kw)==="[object z]"});var Zs=X((urt,eM)=>{"use strict";var Kz=tM(),Qz=er(),Lh=_s(),tG=Xr(),eG=tG("toStringTag"),nG=Object,rG=Lh(function(){return arguments}())==="Arguments",iG=function(n,t){try{return n[t]}catch(e){}};eM.exports=Kz?Lh:function(n){var t,e,i;return n===void 0?"Undefined":n===null?"Null":typeof(e=iG(t=nG(n),eG))=="string"?e:rG?Lh(t):(i=Lh(t))==="Object"&&Qz(t.callee)?"Arguments":i}});var Fm=X((lrt,sM)=>{"use strict";var oG=In(),sG=An(),nM=er(),aG=Zs(),uG=$s(),lG=am(),rM=function(){},iM=uG("Reflect","construct"),Dm=/^\s*(?:class|function)\b/,cG=oG(Dm.exec),fG=!Dm.test(rM),Vc=function(t){if(!nM(t))return!1;try{return iM(rM,[],t),!0}catch(e){return!1}},oM=function(t){if(!nM(t))return!1;switch(aG(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fG||!!cG(Dm,lG(t))}catch(e){return!0}};oM.sham=!0;sM.exports=!iM||sG(function(){var n;return Vc(Vc.call)||!Vc(Object)||!Vc(function(){n=!0})||n})?oM:Vc});var cM=X((crt,lM)=>{"use strict";var aM=Oc(),hG=Fm(),pG=Ei(),dG=Xr(),gG=dG("species"),uM=Array;lM.exports=function(n){var t;return aM(n)&&(t=n.constructor,hG(t)&&(t===uM||aM(t.prototype))?t=void 0:pG(t)&&(t=t[gG],t===null&&(t=void 0))),t===void 0?uM:t}});var Um=X((frt,fM)=>{"use strict";var mG=cM();fM.exports=function(n,t){return new(mG(n))(t===0?0:t)}});var hM=X(()=>{"use strict";var yG=sr(),vG=jw(),_G=Vi(),xG=ii(),EG=Hi(),SG=Um();yG({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=_G(this),i=xG(e),s=SG(e,0);return s.length=vG(s,e,e,i,0,t===void 0?1:EG(t)),s}})});var pM=X(()=>{"use strict";var wG=bm();wG("flat")});var vM=X((mrt,yM)=>{"use strict";var MG=Xr(),gM=MG("iterator"),mM=!1;try{dM=0,Bm={next:function(){return{done:!!dM++}},return:function(){mM=!0}},Bm[gM]=function(){return this},Array.from(Bm,function(){throw 2})}catch(n){}var dM,Bm;yM.exports=function(n,t){try{if(!t&&!mM)return!1}catch(s){return!1}var e=!1;try{var i={};i[gM]=function(){return{next:function(){return{done:e=!0}}}},n(i)}catch(s){}return e}});var Nh=X((yrt,_M)=>{"use strict";_M.exports=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"});var $u=X((vrt,EM)=>{"use strict";var xM=pm(),bG=Wo();EM.exports=function(n,t,e){return e.get&&xM(e.get,t,{getter:!0}),e.set&&xM(e.set,t,{setter:!0}),bG.f(n,t,e)}});var Wi=X((_rt,RM)=>{"use strict";var AG=Nh(),qm=ri(),Si=Sn(),bM=er(),Fh=Ei(),js=oo(),Vm=Zs(),TG=qu(),CG=Es(),zm=Ha(),IG=$u(),PG=Tc(),Uh=Fc(),Ju=Xu(),RG=Xr(),LG=lh(),AM=Va(),TM=AM.enforce,NG=AM.get,Oh=Si.Int8Array,Gm=Oh&&Oh.prototype,SM=Si.Uint8ClampedArray,wM=SM&&SM.prototype,Xo=Oh&&Uh(Oh),bo=Gm&&Uh(Gm),OG=Object.prototype,Hm=Si.TypeError,MM=RG("toStringTag"),km=LG("TYPED_ARRAY_TAG"),Dh="TypedArrayConstructor",ws=AG&&!!Ju&&Vm(Si.opera)!=="Opera",CM=!1,Li,Js,Zu,Ms={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Wm={BigInt64Array:8,BigUint64Array:8},DG=function(t){if(!Fh(t))return!1;var e=Vm(t);return e==="DataView"||js(Ms,e)||js(Wm,e)},IM=function(n){var t=Uh(n);if(Fh(t)){var e=NG(t);return e&&js(e,Dh)?e[Dh]:IM(t)}},PM=function(n){if(!Fh(n))return!1;var t=Vm(n);return js(Ms,t)||js(Wm,t)},FG=function(n){if(PM(n))return n;throw new Hm("Target is not a typed array")},UG=function(n){if(bM(n)&&(!Ju||PG(Xo,n)))return n;throw new Hm(TG(n)+" is not a typed array constructor")},BG=function(n,t,e,i){if(qm){if(e)for(var s in Ms){var u=Si[s];if(u&&js(u.prototype,n))try{delete u.prototype[n]}catch(c){try{u.prototype[n]=t}catch(f){}}}(!bo[n]||e)&&zm(bo,n,e?t:ws&&Gm[n]||t,i)}},zG=function(n,t,e){var i,s;if(qm){if(Ju){if(e){for(i in Ms)if(s=Si[i],s&&js(s,n))try{delete s[n]}catch(u){}}if(!Xo[n]||e)try{return zm(Xo,n,e?t:ws&&Xo[n]||t)}catch(u){}else return}for(i in Ms)s=Si[i],s&&(!s[n]||e)&&zm(s,n,t)}};for(Li in Ms)Js=Si[Li],Zu=Js&&Js.prototype,Zu?TM(Zu)[Dh]=Js:ws=!1;for(Li in Wm)Js=Si[Li],Zu=Js&&Js.prototype,Zu&&(TM(Zu)[Dh]=Js);if((!ws||!bM(Xo)||Xo===Function.prototype)&&(Xo=function(){throw new Hm("Incorrect invocation")},ws))for(Li in Ms)Si[Li]&&Ju(Si[Li],Xo);if((!ws||!bo||bo===OG)&&(bo=Xo.prototype,ws))for(Li in Ms)Si[Li]&&Ju(Si[Li].prototype,bo);ws&&Uh(wM)!==bo&&Ju(wM,bo);if(qm&&!js(bo,MM)){CM=!0,IG(bo,MM,{configurable:!0,get:function(){return Fh(this)?this[km]:void 0}});for(Li in Ms)Si[Li]&&CG(Si[Li],km,Li)}RM.exports={NATIVE_ARRAY_BUFFER_VIEWS:ws,TYPED_ARRAY_TAG:CM&&km,aTypedArray:FG,aTypedArrayConstructor:UG,exportTypedArrayMethod:BG,exportTypedArrayStaticMethod:zG,getTypedArrayConstructor:IM,isView:DG,isTypedArray:PM,TypedArray:Xo,TypedArrayPrototype:bo}});var OM=X((xrt,NM)=>{"use strict";var LM=Sn(),Xm=An(),GG=vM(),kG=Wi().NATIVE_ARRAY_BUFFER_VIEWS,qG=LM.ArrayBuffer,Xa=LM.Int8Array;NM.exports=!kG||!Xm(function(){Xa(1)})||!Xm(function(){new Xa(-1)})||!GG(function(n){new Xa,new Xa(null),new Xa(1.5),new Xa(n)},!0)||Xm(function(){return new Xa(new qG(2),1,void 0).length!==1})});var FM=X((Ert,DM)=>{"use strict";var VG=Ha();DM.exports=function(n,t,e){for(var i in t)VG(n,i,t[i],e);return n}});var Ym=X((Srt,UM)=>{"use strict";var HG=Tc(),WG=TypeError;UM.exports=function(n,t){if(HG(t,n))return n;throw new WG("Incorrect invocation")}});var Bh=X((wrt,BM)=>{"use strict";var XG=Hi(),YG=Wa(),$G=RangeError;BM.exports=function(n){if(n===void 0)return 0;var t=XG(n),e=YG(t);if(t!==e)throw new $G("Wrong length or index");return e}});var GM=X((Mrt,zM)=>{"use strict";zM.exports=Math.sign||function(t){var e=+t;return e===0||e!==e?e:e<0?-1:1}});var VM=X((brt,qM)=>{"use strict";var ZG=2220446049250313e-31,kM=1/ZG;qM.exports=function(n){return n+kM-kM}});var WM=X((Art,HM)=>{"use strict";var JG=GM(),jG=VM(),KG=Math.abs,QG=2220446049250313e-31;HM.exports=function(n,t,e,i){var s=+n,u=KG(s),c=JG(s);if(u<i)return c*jG(u/i/t)*i*t;var f=(1+t/QG)*u,p=f-(f-u);return p>e||p!==p?c*(1/0):c*p}});var YM=X((Trt,XM)=>{"use strict";var t4=WM(),e4=11920928955078125e-23,n4=34028234663852886e22,r4=11754943508222875e-54;XM.exports=Math.fround||function(t){return t4(t,e4,n4,r4)}});var ZM=X((Crt,$M)=>{"use strict";var i4=Array,o4=Math.abs,bs=Math.pow,s4=Math.floor,a4=Math.log,u4=Math.LN2,l4=function(n,t,e){var i=i4(e),s=e*8-t-1,u=(1<<s)-1,c=u>>1,f=t===23?bs(2,-24)-bs(2,-77):0,p=n<0||n===0&&1/n<0?1:0,d=0,g,y,v;for(n=o4(n),n!==n||n===1/0?(y=n!==n?1:0,g=u):(g=s4(a4(n)/u4),v=bs(2,-g),n*v<1&&(g--,v*=2),g+c>=1?n+=f/v:n+=f*bs(2,1-c),n*v>=2&&(g++,v/=2),g+c>=u?(y=0,g=u):g+c>=1?(y=(n*v-1)*bs(2,t),g+=c):(y=n*bs(2,c-1)*bs(2,t),g=0));t>=8;)i[d++]=y&255,y/=256,t-=8;for(g=g<<t|y,s+=t;s>0;)i[d++]=g&255,g/=256,s-=8;return i[d-1]|=p*128,i},c4=function(n,t){var e=n.length,i=e*8-t-1,s=(1<<i)-1,u=s>>1,c=i-7,f=e-1,p=n[f--],d=p&127,g;for(p>>=7;c>0;)d=d*256+n[f--],c-=8;for(g=d&(1<<-c)-1,d>>=-c,c+=t;c>0;)g=g*256+n[f--],c-=8;if(d===0)d=1-u;else{if(d===s)return g?NaN:p?-1/0:1/0;g+=bs(2,t),d-=u}return(p?-1:1)*g*bs(2,d-t)};$M.exports={pack:l4,unpack:c4}});var $m=X((Irt,jM)=>{"use strict";var f4=Vi(),JM=Eh(),h4=ii();jM.exports=function(t){for(var e=f4(this),i=h4(e),s=arguments.length,u=JM(s>1?arguments[1]:void 0,i),c=s>2?arguments[2]:void 0,f=c===void 0?i:JM(c,i);f>u;)e[u++]=t;return e}});var zh=X((Prt,KM)=>{"use strict";var p4=In();KM.exports=p4([].slice)});var Zm=X((Rrt,tb)=>{"use strict";var d4=er(),g4=Ei(),QM=Xu();tb.exports=function(n,t,e){var i,s;return QM&&d4(i=t.constructor)&&i!==e&&g4(s=i.prototype)&&s!==e.prototype&&QM(n,s),n}});var Xh=X((Lrt,yb)=>{"use strict";var Hh=Sn(),t0=In(),Jm=ri(),m4=Nh(),hb=dh(),y4=Es(),v4=$u(),eb=FM(),jm=An(),Gh=Ym(),_4=Hi(),x4=Wa(),qh=Bh(),E4=YM(),pb=ZM(),S4=Fc(),nb=Xu(),w4=$m(),M4=zh(),b4=Zm(),A4=ym(),db=Uc(),e0=Va(),T4=hb.PROPER,rb=hb.CONFIGURABLE,Ku="ArrayBuffer",Wh="DataView",Qu="prototype",C4="Wrong length",gb="Wrong index",ib=e0.getterFor(Ku),Wc=e0.getterFor(Wh),ob=e0.set,Ao=Hh[Ku],Xi=Ao,ju=Xi&&Xi[Qu],Yo=Hh[Wh],Ya=Yo&&Yo[Qu],sb=Object.prototype,I4=Hh.Array,Vh=Hh.RangeError,P4=t0(w4),R4=t0([].reverse),mb=pb.pack,ab=pb.unpack,ub=function(n){return[n&255]},lb=function(n){return[n&255,n>>8&255]},cb=function(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]},fb=function(n){return n[3]<<24|n[2]<<16|n[1]<<8|n[0]},L4=function(n){return mb(E4(n),23,4)},N4=function(n){return mb(n,52,8)},kh=function(n,t,e){v4(n[Qu],t,{configurable:!0,get:function(){return e(this)[t]}})},Ks=function(n,t,e,i){var s=Wc(n),u=qh(e),c=!!i;if(u+t>s.byteLength)throw new Vh(gb);var f=s.bytes,p=u+s.byteOffset,d=M4(f,p,p+t);return c?d:R4(d)},Qs=function(n,t,e,i,s,u){var c=Wc(n),f=qh(e),p=i(+s),d=!!u;if(f+t>c.byteLength)throw new Vh(gb);for(var g=c.bytes,y=f+c.byteOffset,v=0;v<t;v++)g[y+v]=p[d?v:t-v-1]};m4?(Km=T4&&Ao.name!==Ku,!jm(function(){Ao(1)})||!jm(function(){new Ao(-1)})||jm(function(){return new Ao,new Ao(1.5),new Ao(NaN),Ao.length!==1||Km&&!rb})?(Xi=function(t){return Gh(this,ju),b4(new Ao(qh(t)),this,Xi)},Xi[Qu]=ju,ju.constructor=Xi,A4(Xi,Ao)):Km&&rb&&y4(Ao,"name",Ku),nb&&S4(Ya)!==sb&&nb(Ya,sb),Hc=new Yo(new Xi(2)),Qm=t0(Ya.setInt8),Hc.setInt8(0,2147483648),Hc.setInt8(1,2147483649),(Hc.getInt8(0)||!Hc.getInt8(1))&&eb(Ya,{setInt8:function(t,e){Qm(this,t,e<<24>>24)},setUint8:function(t,e){Qm(this,t,e<<24>>24)}},{unsafe:!0})):(Xi=function(t){Gh(this,ju);var e=qh(t);ob(this,{type:Ku,bytes:P4(I4(e),0),byteLength:e}),Jm||(this.byteLength=e,this.detached=!1)},ju=Xi[Qu],Yo=function(t,e,i){Gh(this,Ya),Gh(t,ju);var s=ib(t),u=s.byteLength,c=_4(e);if(c<0||c>u)throw new Vh("Wrong offset");if(i=i===void 0?u-c:x4(i),c+i>u)throw new Vh(C4);ob(this,{type:Wh,buffer:t,byteLength:i,byteOffset:c,bytes:s.bytes}),Jm||(this.buffer=t,this.byteLength=i,this.byteOffset=c)},Ya=Yo[Qu],Jm&&(kh(Xi,"byteLength",ib),kh(Yo,"buffer",Wc),kh(Yo,"byteLength",Wc),kh(Yo,"byteOffset",Wc)),eb(Ya,{getInt8:function(t){return Ks(this,1,t)[0]<<24>>24},getUint8:function(t){return Ks(this,1,t)[0]},getInt16:function(t){var e=Ks(this,2,t,arguments.length>1?arguments[1]:!1);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=Ks(this,2,t,arguments.length>1?arguments[1]:!1);return e[1]<<8|e[0]},getInt32:function(t){return fb(Ks(this,4,t,arguments.length>1?arguments[1]:!1))},getUint32:function(t){return fb(Ks(this,4,t,arguments.length>1?arguments[1]:!1))>>>0},getFloat32:function(t){return ab(Ks(this,4,t,arguments.length>1?arguments[1]:!1),23)},getFloat64:function(t){return ab(Ks(this,8,t,arguments.length>1?arguments[1]:!1),52)},setInt8:function(t,e){Qs(this,1,t,ub,e)},setUint8:function(t,e){Qs(this,1,t,ub,e)},setInt16:function(t,e){Qs(this,2,t,lb,e,arguments.length>2?arguments[2]:!1)},setUint16:function(t,e){Qs(this,2,t,lb,e,arguments.length>2?arguments[2]:!1)},setInt32:function(t,e){Qs(this,4,t,cb,e,arguments.length>2?arguments[2]:!1)},setUint32:function(t,e){Qs(this,4,t,cb,e,arguments.length>2?arguments[2]:!1)},setFloat32:function(t,e){Qs(this,4,t,L4,e,arguments.length>2?arguments[2]:!1)},setFloat64:function(t,e){Qs(this,8,t,N4,e,arguments.length>2?arguments[2]:!1)}}));var Km,Hc,Qm;db(Xi,Ku);db(Yo,Wh);yb.exports={ArrayBuffer:Xi,DataView:Yo}});var _b=X((Nrt,vb)=>{"use strict";var O4=Ei(),D4=Math.floor;vb.exports=Number.isInteger||function(t){return!O4(t)&&isFinite(t)&&D4(t)===t}});var Eb=X((Ort,xb)=>{"use strict";var F4=Hi(),U4=RangeError;xb.exports=function(n){var t=F4(n);if(t<0)throw new U4("The argument can't be less than 0");return t}});var n0=X((Drt,Sb)=>{"use strict";var B4=Eb(),z4=RangeError;Sb.exports=function(n,t){var e=B4(n);if(e%t)throw new z4("Wrong offset");return e}});var Mb=X((Frt,wb)=>{"use strict";var G4=Math.round;wb.exports=function(n){var t=G4(n);return t<0?0:t>255?255:t&255}});var Ab=X((Urt,bb)=>{"use strict";var k4=Fm(),q4=qu(),V4=TypeError;bb.exports=function(n){if(k4(n))return n;throw new V4(q4(n)+" is not a constructor")}});var r0=X((Brt,Cb)=>{"use strict";var H4=Zs(),Tb=Pc(),W4=rh(),X4=Wu(),Y4=Xr(),$4=Y4("iterator");Cb.exports=function(n){if(!W4(n))return Tb(n,$4)||Tb(n,"@@iterator")||X4[H4(n)]}});var Pb=X((zrt,Ib)=>{"use strict";var Z4=vr(),J4=xs(),j4=so(),K4=qu(),Q4=r0(),tk=TypeError;Ib.exports=function(n,t){var e=arguments.length<2?Q4(n):t;if(J4(e))return j4(Z4(e,n));throw new tk(K4(n)+" is not iterable")}});var Lb=X((Grt,Rb)=>{"use strict";var ek=Xr(),nk=Wu(),rk=ek("iterator"),ik=Array.prototype;Rb.exports=function(n){return n!==void 0&&(nk.Array===n||ik[rk]===n)}});var i0=X((krt,Nb)=>{"use strict";var ok=Zs();Nb.exports=function(n){var t=ok(n);return t==="BigInt64Array"||t==="BigUint64Array"}});var Yh=X((qrt,Ob)=>{"use strict";var sk=Jg(),ak=TypeError;Ob.exports=function(n){var t=sk(n,"number");if(typeof t=="number")throw new ak("Can't convert number to bigint");return BigInt(t)}});var Fb=X((Vrt,Db)=>{"use strict";var uk=qc(),lk=vr(),ck=Ab(),fk=Vi(),hk=ii(),pk=Pb(),dk=r0(),gk=Lb(),mk=i0(),yk=Wi().aTypedArrayConstructor,vk=Yh();Db.exports=function(t){var e=ck(this),i=fk(t),s=arguments.length,u=s>1?arguments[1]:void 0,c=u!==void 0,f=dk(i),p,d,g,y,v,E,M,A;if(f&&!gk(f))for(M=pk(i,f),A=M.next,i=[];!(E=lk(A,M)).done;)i.push(E.value);for(c&&s>2&&(u=uk(u,arguments[2])),d=hk(i),g=new(yk(e))(d),y=mk(g),p=0;d>p;p++)v=c?u(i[p],p):i[p],g[p]=y?vk(v):+v;return g}});var zb=X((Hrt,Bb)=>{"use strict";var _k=qc(),xk=In(),Ek=nh(),Sk=Vi(),wk=ii(),Mk=Um(),Ub=xk([].push),ta=function(n){var t=n===1,e=n===2,i=n===3,s=n===4,u=n===6,c=n===7,f=n===5||u;return function(p,d,g,y){for(var v=Sk(p),E=Ek(v),M=wk(E),A=_k(d,g),_=0,x=y||Mk,T=t?x(p,M):e||c?x(p,0):void 0,w,R;M>_;_++)if((f||_ in E)&&(w=E[_],R=A(w,_,v),n))if(t)T[_]=R;else if(R)switch(n){case 3:return!0;case 5:return w;case 6:return _;case 2:Ub(T,w)}else switch(n){case 4:return!1;case 7:Ub(T,w)}return u?-1:i||s?s:T}};Bb.exports={forEach:ta(0),map:ta(1),filter:ta(2),some:ta(3),every:ta(4),find:ta(5),findIndex:ta(6),filterReject:ta(7)}});var o0=X((Wrt,kb)=>{"use strict";var bk=$s(),Ak=$u(),Tk=Xr(),Ck=ri(),Gb=Tk("species");kb.exports=function(n){var t=bk(n);Ck&&t&&!t[Gb]&&Ak(t,Gb,{configurable:!0,get:function(){return this}})}});var s0=X((Xrt,qb)=>{"use strict";var Ik=ii();qb.exports=function(n,t,e){for(var i=0,s=arguments.length>2?e:Ik(t),u=new n(s);s>i;)u[i]=t[i++];return u}});var uA=X((Yrt,p0)=>{"use strict";var Vb=sr(),tA=Sn(),Hb=vr(),Pk=ri(),Rk=OM(),Zc=Wi(),eA=Xh(),Wb=Ym(),Lk=Ac(),Xc=Es(),Nk=_b(),Ok=Wa(),Xb=Bh(),a0=n0(),Dk=Mb(),nA=ch(),Yc=oo(),Fk=Zs(),c0=Ei(),Uk=Ic(),Bk=Hu(),zk=Tc(),$h=Xu(),Gk=mm().f,Yb=Fb(),kk=zb().forEach,qk=o0(),Vk=$u(),rA=Wo(),iA=hh(),$b=s0(),d0=Va(),Hk=Zm(),f0=d0.get,Wk=d0.set,Xk=d0.enforce,oA=rA.f,Yk=iA.f,u0=tA.RangeError,sA=eA.ArrayBuffer,$k=sA.prototype,Zk=eA.DataView,Zh=Zc.NATIVE_ARRAY_BUFFER_VIEWS,Zb=Zc.TYPED_ARRAY_TAG,Jb=Zc.TypedArray,$c=Zc.TypedArrayPrototype,h0=Zc.isTypedArray,Jh="BYTES_PER_ELEMENT",l0="Wrong length",jh=function(n,t){Vk(n,t,{configurable:!0,get:function(){return f0(this)[t]}})},jb=function(n){var t;return zk($k,n)||(t=Fk(n))==="ArrayBuffer"||t==="SharedArrayBuffer"},aA=function(n,t){return h0(n)&&!Uk(t)&&t in n&&Nk(+t)&&t>=0},Kb=function(t,e){return e=nA(e),aA(t,e)?Lk(2,t[e]):Yk(t,e)},Qb=function(t,e,i){return e=nA(e),aA(t,e)&&c0(i)&&Yc(i,"value")&&!Yc(i,"get")&&!Yc(i,"set")&&!i.configurable&&(!Yc(i,"writable")||i.writable)&&(!Yc(i,"enumerable")||i.enumerable)?(t[e]=i.value,t):oA(t,e,i)};Pk?(Zh||(iA.f=Kb,rA.f=Qb,jh($c,"buffer"),jh($c,"byteOffset"),jh($c,"byteLength"),jh($c,"length")),Vb({target:"Object",stat:!0,forced:!Zh},{getOwnPropertyDescriptor:Kb,defineProperty:Qb}),p0.exports=function(n,t,e){var i=n.match(/\d+/)[0]/8,s=n+(e?"Clamped":"")+"Array",u="get"+n,c="set"+n,f=tA[s],p=f,d=p&&p.prototype,g={},y=function(A,_){var x=f0(A);return x.view[u](_*i+x.byteOffset,!0)},v=function(A,_,x){var T=f0(A);T.view[c](_*i+T.byteOffset,e?Dk(x):x,!0)},E=function(A,_){oA(A,_,{get:function(){return y(this,_)},set:function(x){return v(this,_,x)},enumerable:!0})};Zh?Rk&&(p=t(function(A,_,x,T){return Wb(A,d),Hk(function(){return c0(_)?jb(_)?T!==void 0?new f(_,a0(x,i),T):x!==void 0?new f(_,a0(x,i)):new f(_):h0(_)?$b(p,_):Hb(Yb,p,_):new f(Xb(_))}(),A,p)}),$h&&$h(p,Jb),kk(Gk(f),function(A){A in p||Xc(p,A,f[A])}),p.prototype=d):(p=t(function(A,_,x,T){Wb(A,d);var w=0,R=0,B,U,D;if(!c0(_))D=Xb(_),U=D*i,B=new sA(U);else if(jb(_)){B=_,R=a0(x,i);var P=_.byteLength;if(T===void 0){if(P%i)throw new u0(l0);if(U=P-R,U<0)throw new u0(l0)}else if(U=Ok(T)*i,U+R>P)throw new u0(l0);D=U/i}else return h0(_)?$b(p,_):Hb(Yb,p,_);for(Wk(A,{buffer:B,byteOffset:R,byteLength:U,length:D,view:new Zk(B)});w<D;)E(A,w++)}),$h&&$h(p,Jb),d=p.prototype=Bk($c)),d.constructor!==p&&Xc(d,"constructor",p),Xk(d).TypedArrayConstructor=p,Zb&&Xc(d,Zb,s);var M=p!==f;g[s]=p,Vb({global:!0,constructor:!0,forced:M,sham:!Zh},g),Jh in p||Xc(p,Jh,i),Jh in d||Xc(d,Jh,i),qk(s)}):p0.exports=function(){}});var g0=X(()=>{"use strict";var Jk=uA();Jk("Float32",function(n){return function(e,i,s){return n(this,e,i,s)}})});var m0=X(()=>{"use strict";var lA=Wi(),jk=ii(),Kk=Hi(),Qk=lA.aTypedArray,tq=lA.exportTypedArrayMethod;tq("at",function(t){var e=Qk(this),i=jk(e),s=Kk(t),u=s>=0?s:i+s;return u<0||u>=i?void 0:e[u]})});var y0=X(()=>{"use strict";var cA=Wi(),eq=$m(),nq=Yh(),rq=Zs(),iq=vr(),oq=In(),sq=An(),aq=cA.aTypedArray,uq=cA.exportTypedArrayMethod,lq=oq("".slice),cq=sq(function(){var n=0;return new Int8Array(2).fill({valueOf:function(){return n++}}),n!==1});uq("fill",function(t){var e=arguments.length;aq(this);var i=lq(rq(this),0,3)==="Big"?nq(t):+t;return iq(eq,this,i,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},cq)});var v0=X((tit,hA)=>{"use strict";var fq=qc(),hq=nh(),pq=Vi(),dq=ii(),fA=function(n){var t=n===1;return function(e,i,s){for(var u=pq(e),c=hq(u),f=dq(c),p=fq(i,s),d,g;f-- >0;)if(d=c[f],g=p(d,f,u),g)switch(n){case 0:return d;case 1:return f}return t?-1:void 0}};hA.exports={findLast:fA(0),findLastIndex:fA(1)}});var _0=X(()=>{"use strict";var pA=Wi(),gq=v0().findLast,mq=pA.aTypedArray,yq=pA.exportTypedArrayMethod;yq("findLast",function(t){return gq(mq(this),t,arguments.length>1?arguments[1]:void 0)})});var x0=X(()=>{"use strict";var dA=Wi(),vq=v0().findLastIndex,_q=dA.aTypedArray,xq=dA.exportTypedArrayMethod;xq("findLastIndex",function(t){return vq(_q(this),t,arguments.length>1?arguments[1]:void 0)})});var M0=X(()=>{"use strict";var mA=Sn(),yA=vr(),w0=Wi(),Eq=ii(),Sq=n0(),wq=Vi(),vA=An(),Mq=mA.RangeError,E0=mA.Int8Array,gA=E0&&E0.prototype,_A=gA&&gA.set,bq=w0.aTypedArray,Aq=w0.exportTypedArrayMethod,S0=!vA(function(){var n=new Uint8ClampedArray(2);return yA(_A,n,{length:1,0:3},1),n[1]!==3}),Tq=S0&&w0.NATIVE_ARRAY_BUFFER_VIEWS&&vA(function(){var n=new E0(2);return n.set(1),n.set("2",1),n[0]!==0||n[1]!==2});Aq("set",function(t){bq(this);var e=Sq(arguments.length>1?arguments[1]:void 0,1),i=wq(t);if(S0)return yA(_A,this,i,e);var s=this.length,u=Eq(i),c=0;if(u+e>s)throw new Mq("Wrong length");for(;c<u;)this[e+c]=i[c++]},!S0||Tq)});var A0=X((ait,EA)=>{"use strict";var xA=zh(),Cq=Math.floor,b0=function(n,t){var e=n.length;if(e<8)for(var i=1,s,u;i<e;){for(u=i,s=n[i];u&&t(n[u-1],s)>0;)n[u]=n[--u];u!==i++&&(n[u]=s)}else for(var c=Cq(e/2),f=b0(xA(n,0,c),t),p=b0(xA(n,c),t),d=f.length,g=p.length,y=0,v=0;y<d||v<g;)n[y+v]=y<d&&v<g?t(f[y],p[v])<=0?f[y++]:p[v++]:y<d?f[y++]:p[v++];return n};EA.exports=b0});var T0=X((uit,wA)=>{"use strict";var Iq=ku(),SA=Iq.match(/firefox\/(\d+)/i);wA.exports=!!SA&&+SA[1]});var C0=X((lit,MA)=>{"use strict";var Pq=ku();MA.exports=/MSIE|Trident/.test(Pq)});var I0=X((cit,AA)=>{"use strict";var Rq=ku(),bA=Rq.match(/AppleWebKit\/(\d+)\./);AA.exports=!!bA&&+bA[1]});var R0=X(()=>{"use strict";var Lq=Sn(),Nq=Rh(),P0=An(),Oq=xs(),Dq=A0(),RA=Wi(),TA=T0(),Fq=C0(),CA=Cc(),IA=I0(),Uq=RA.aTypedArray,Bq=RA.exportTypedArrayMethod,Jc=Lq.Uint16Array,tl=Jc&&Nq(Jc.prototype.sort),zq=!!tl&&!(P0(function(){tl(new Jc(2),null)})&&P0(function(){tl(new Jc(2),{})})),PA=!!tl&&!P0(function(){if(CA)return CA<74;if(TA)return TA<67;if(Fq)return!0;if(IA)return IA<602;var n=new Jc(516),t=Array(516),e,i;for(e=0;e<516;e++)i=e%4,n[e]=515-e,t[e]=e-2*i+3;for(tl(n,function(s,u){return(s/4|0)-(u/4|0)}),e=0;e<516;e++)if(n[e]!==t[e])return!0}),Gq=function(n){return function(t,e){return n!==void 0?+n(t,e)||0:e!==e?-1:t!==t?1:t===0&&e===0?1/t>0&&1/e<0?1:-1:t>e}};Bq("sort",function(t){return t!==void 0&&Oq(t),PA?tl(this,t):Dq(Uq(this),Gq(t))},!PA||zq)});var NA=X((pit,LA)=>{"use strict";var kq=ii();LA.exports=function(n,t){for(var e=kq(n),i=new t(e),s=0;s<e;s++)i[s]=n[e-s-1];return i}});var N0=X(()=>{"use strict";var qq=NA(),L0=Wi(),Vq=L0.aTypedArray,Hq=L0.exportTypedArrayMethod,Wq=L0.getTypedArrayConstructor;Hq("toReversed",function(){return qq(Vq(this),Wq(this))})});var O0=X(()=>{"use strict";var Kh=Wi(),Xq=In(),Yq=xs(),$q=s0(),Zq=Kh.aTypedArray,Jq=Kh.getTypedArrayConstructor,jq=Kh.exportTypedArrayMethod,Kq=Xq(Kh.TypedArrayPrototype.sort);jq("toSorted",function(t){t!==void 0&&Yq(t);var e=Zq(this),i=$q(Jq(e),e);return Kq(i,t)})});var DA=X((vit,OA)=>{"use strict";var Qq=ii(),t5=Hi(),e5=RangeError;OA.exports=function(n,t,e,i){var s=Qq(n),u=t5(e),c=u<0?s+u:u;if(c>=s||c<0)throw new e5("Incorrect index");for(var f=new t(s),p=0;p<s;p++)f[p]=p===c?i:n[p];return f}});var F0=X(()=>{"use strict";var n5=DA(),D0=Wi(),r5=i0(),i5=Hi(),o5=Yh(),s5=D0.aTypedArray,a5=D0.getTypedArrayConstructor,u5=D0.exportTypedArrayMethod,l5=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(n){return n===8}}();u5("with",function(n,t){var e=s5(this),i=i5(n),s=r5(e)?o5(t):+t;return n5(e,a5(e),i,s)},!l5)});var B0=X(()=>{"use strict";var c5=sr(),f5=Sn(),h5=Xh(),p5=o0(),U0="ArrayBuffer",FA=h5[U0],d5=f5[U0];c5({global:!0,constructor:!0,forced:d5!==FA},{ArrayBuffer:FA});p5(U0)});var q0=X(()=>{"use strict";var g5=sr(),G0=Rh(),m5=An(),GA=Xh(),UA=so(),BA=Eh(),y5=Wa(),k0=GA.ArrayBuffer,z0=GA.DataView,kA=z0.prototype,zA=G0(k0.prototype.slice),v5=G0(kA.getUint8),_5=G0(kA.setUint8),x5=m5(function(){return!new k0(2).slice(1,void 0).byteLength});g5({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:x5},{slice:function(t,e){if(zA&&e===void 0)return zA(UA(this),t);for(var i=UA(this).byteLength,s=BA(t,i),u=BA(e===void 0?i:e,i),c=new k0(y5(u-s)),f=new z0(this),p=new z0(c),d=0;s<u;)_5(p,d++,v5(f,s++));return c}})});var V0=X((bit,HA)=>{"use strict";var VA=Sn(),E5=Bc(),S5=_s(),qA=VA.ArrayBuffer,w5=VA.TypeError;HA.exports=qA&&E5(qA.prototype,"byteLength","get")||function(n){if(S5(n)!=="ArrayBuffer")throw new w5("ArrayBuffer expected");return n.byteLength}});var H0=X((Ait,WA)=>{"use strict";var M5=Sn(),b5=Nh(),A5=V0(),T5=M5.DataView;WA.exports=function(n){if(!b5||A5(n)!==0)return!1;try{return new T5(n),!1}catch(t){return!0}}});var W0=X(()=>{"use strict";var C5=ri(),I5=$u(),P5=H0(),XA=ArrayBuffer.prototype;C5&&!("detached"in XA)&&I5(XA,"detached",{configurable:!0,get:function(){return P5(this)}})});var $A=X((Iit,YA)=>{"use strict";var R5=H0(),L5=TypeError;YA.exports=function(n){if(R5(n))throw new L5("ArrayBuffer is detached");return n}});var X0=X((Pit,ZA)=>{"use strict";var jc=Sn(),N5=ku(),O5=_s(),Qh=function(n){return N5.slice(0,n.length)===n};ZA.exports=function(){return Qh("Bun/")?"BUN":Qh("Cloudflare-Workers")?"CLOUDFLARE":Qh("Deno/")?"DENO":Qh("Node.js/")?"NODE":jc.Bun&&typeof Bun.version=="string"?"BUN":jc.Deno&&typeof Deno.version=="object"?"DENO":O5(jc.process)==="process"?"NODE":jc.window&&jc.document?"BROWSER":"REST"}()});var jA=X((Rit,JA)=>{"use strict";var D5=X0();JA.exports=D5==="NODE"});var QA=X((Lit,KA)=>{"use strict";var F5=Sn(),U5=jA();KA.exports=function(n){if(U5){try{return F5.process.getBuiltinModule(n)}catch(t){}try{return Function('return require("'+n+'")')()}catch(t){}}}});var Z0=X((Nit,eT)=>{"use strict";var B5=Sn(),z5=An(),Y0=Cc(),$0=X0(),tT=B5.structuredClone;eT.exports=!!tT&&!z5(function(){if($0==="DENO"&&Y0>92||$0==="NODE"&&Y0>94||$0==="BROWSER"&&Y0>97)return!1;var n=new ArrayBuffer(8),t=tT(n,{transfer:[n]});return n.byteLength!==0||t.byteLength!==8})});var oT=X((Oit,iT)=>{"use strict";var Q0=Sn(),G5=QA(),k5=Z0(),q5=Q0.structuredClone,nT=Q0.ArrayBuffer,tp=Q0.MessageChannel,K0=!1,J0,rT,ep,j0;if(k5)K0=function(n){q5(n,{transfer:[n]})};else if(nT)try{tp||(J0=G5("worker_threads"),J0&&(tp=J0.MessageChannel)),tp&&(rT=new tp,ep=new nT(2),j0=function(n){rT.port1.postMessage(null,[n])},ep.byteLength===2&&(j0(ep),ep.byteLength===0&&(K0=j0)))}catch(n){}iT.exports=K0});var oy=X((Dit,hT)=>{"use strict";var ny=Sn(),ry=In(),lT=Bc(),V5=Bh(),H5=$A(),W5=V0(),sT=oT(),ty=Z0(),X5=ny.structuredClone,cT=ny.ArrayBuffer,ey=ny.DataView,Y5=Math.min,iy=cT.prototype,fT=ey.prototype,$5=ry(iy.slice),aT=lT(iy,"resizable","get"),uT=lT(iy,"maxByteLength","get"),Z5=ry(fT.getInt8),J5=ry(fT.setInt8);hT.exports=(ty||sT)&&function(n,t,e){var i=W5(n),s=t===void 0?i:V5(t),u=!aT||!aT(n),c;if(H5(n),ty&&(n=X5(n,{transfer:[n]}),i===s&&(e||u)))return n;if(i>=s&&(!e||u))c=$5(n,0,s);else{var f=e&&!u&&uT?{maxByteLength:uT(n)}:void 0;c=new cT(s,f);for(var p=new ey(n),d=new ey(c),g=Y5(s,i),y=0;y<g;y++)J5(d,y,Z5(p,y))}return ty||sT(n),c}});var sy=X(()=>{"use strict";var j5=sr(),pT=oy();pT&&j5({target:"ArrayBuffer",proto:!0},{transfer:function(){return pT(this,arguments.length?arguments[0]:void 0,!0)}})});var ay=X(()=>{"use strict";var K5=sr(),dT=oy();dT&&K5({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return dT(this,arguments.length?arguments[0]:void 0,!1)}})});var To=X((Git,gT)=>{"use strict";var uy=In(),np=Set.prototype;gT.exports={Set,add:uy(np.add),has:uy(np.has),remove:uy(np.delete),proto:np}});var ea=X((kit,mT)=>{"use strict";var Q5=To().has;mT.exports=function(n){return Q5(n),n}});var na=X((qit,yT)=>{"use strict";var tV=vr();yT.exports=function(n,t,e){for(var i=e?n:n.iterator,s=n.next,u,c;!(u=tV(s,i)).done;)if(c=t(u.value),c!==void 0)return c}});var el=X((Vit,ST)=>{"use strict";var vT=In(),eV=na(),_T=To(),nV=_T.Set,xT=_T.proto,rV=vT(xT.forEach),ET=vT(xT.keys),iV=ET(new nV).next;ST.exports=function(n,t,e){return e?eV({iterator:ET(n),next:iV},t):rV(n,t)}});var rp=X((Hit,MT)=>{"use strict";var wT=To(),oV=el(),sV=wT.Set,aV=wT.add;MT.exports=function(n){var t=new sV;return oV(n,function(e){aV(t,e)}),t}});var nl=X((Wit,bT)=>{"use strict";var uV=Bc(),lV=To();bT.exports=uV(lV.proto,"size","get")||function(n){return n.size}});var TT=X((Xit,AT)=>{"use strict";AT.exports=function(n){return{iterator:n,next:n.next,done:!1}}});var ra=X((Yit,NT)=>{"use strict";var CT=xs(),RT=so(),IT=vr(),cV=Hi(),fV=TT(),PT="Invalid size",hV=RangeError,pV=TypeError,dV=Math.max,LT=function(n,t){this.set=n,this.size=dV(t,0),this.has=CT(n.has),this.keys=CT(n.keys)};LT.prototype={getIterator:function(){return fV(RT(IT(this.keys,this.set)))},includes:function(n){return IT(this.has,this.set,n)}};NT.exports=function(n){RT(n);var t=+n.size;if(t!==t)throw new pV(PT);var e=cV(t);if(e<0)throw new hV(PT);return new LT(n,e)}});var UT=X(($it,FT)=>{"use strict";var gV=ea(),DT=To(),mV=rp(),yV=nl(),vV=ra(),_V=el(),xV=na(),EV=DT.has,OT=DT.remove;FT.exports=function(t){var e=gV(this),i=vV(t),s=mV(e);return yV(e)<=i.size?_V(e,function(u){i.includes(u)&&OT(s,u)}):xV(i.getIterator(),function(u){EV(e,u)&&OT(s,u)}),s}});var ia=X((Zit,GT)=>{"use strict";var SV=$s(),BT=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},zT=function(n){return{size:n,has:function(){return!0},keys:function(){throw new Error("e")}}};GT.exports=function(n,t){var e=SV("Set");try{new e()[n](BT(0));try{return new e()[n](BT(-1)),!1}catch(s){if(!t)return!0;try{return new e()[n](zT(-1/0)),!1}catch(u){var i=new e;return i.add(1),i.add(2),t(i[n](zT(1/0)))}}}catch(s){return!1}}});var kT=X(()=>{"use strict";var wV=sr(),MV=UT(),bV=ia(),AV=!bV("difference",function(n){return n.size===0});wV({target:"Set",proto:!0,real:!0,forced:AV},{difference:MV})});var HT=X((Kit,VT)=>{"use strict";var TV=ea(),ly=To(),CV=nl(),IV=ra(),PV=el(),RV=na(),LV=ly.Set,qT=ly.add,NV=ly.has;VT.exports=function(t){var e=TV(this),i=IV(t),s=new LV;return CV(e)>i.size?RV(i.getIterator(),function(u){NV(e,u)&&qT(s,u)}):PV(e,function(u){i.includes(u)&&qT(s,u)}),s}});var WT=X(()=>{"use strict";var OV=sr(),DV=An(),FV=HT(),UV=ia(),BV=!UV("intersection",function(n){return n.size===2&&n.has(1)&&n.has(2)})||DV(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});OV({target:"Set",proto:!0,real:!0,forced:BV},{intersection:FV})});var cy=X((eot,YT)=>{"use strict";var zV=vr(),XT=so(),GV=Pc();YT.exports=function(n,t,e){var i,s;XT(n);try{if(i=GV(n,"return"),!i){if(t==="throw")throw e;return e}i=zV(i,n)}catch(u){s=!0,i=u}if(t==="throw")throw e;if(s)throw i;return XT(i),e}});var ZT=X((not,$T)=>{"use strict";var kV=ea(),qV=To().has,VV=nl(),HV=ra(),WV=el(),XV=na(),YV=cy();$T.exports=function(t){var e=kV(this),i=HV(t);if(VV(e)<=i.size)return WV(e,function(u){if(i.includes(u))return!1},!0)!==!1;var s=i.getIterator();return XV(s,function(u){if(qV(e,u))return YV(s,"normal",!1)})!==!1}});var JT=X(()=>{"use strict";var $V=sr(),ZV=ZT(),JV=ia(),jV=!JV("isDisjointFrom",function(n){return!n});$V({target:"Set",proto:!0,real:!0,forced:jV},{isDisjointFrom:ZV})});var KT=X((oot,jT)=>{"use strict";var KV=ea(),QV=nl(),tH=el(),eH=ra();jT.exports=function(t){var e=KV(this),i=eH(t);return QV(e)>i.size?!1:tH(e,function(s){if(!i.includes(s))return!1},!0)!==!1}});var QT=X(()=>{"use strict";var nH=sr(),rH=KT(),iH=ia(),oH=!iH("isSubsetOf",function(n){return n});nH({target:"Set",proto:!0,real:!0,forced:oH},{isSubsetOf:rH})});var eC=X((uot,tC)=>{"use strict";var sH=ea(),aH=To().has,uH=nl(),lH=ra(),cH=na(),fH=cy();tC.exports=function(t){var e=sH(this),i=lH(t);if(uH(e)<i.size)return!1;var s=i.getIterator();return cH(s,function(u){if(!aH(e,u))return fH(s,"normal",!1)})!==!1}});var nC=X(()=>{"use strict";var hH=sr(),pH=eC(),dH=ia(),gH=!dH("isSupersetOf",function(n){return!n});hH({target:"Set",proto:!0,real:!0,forced:gH},{isSupersetOf:pH})});var iC=X((fot,rC)=>{"use strict";var mH=ea(),fy=To(),yH=rp(),vH=ra(),_H=na(),xH=fy.add,EH=fy.has,SH=fy.remove;rC.exports=function(t){var e=mH(this),i=vH(t).getIterator(),s=yH(e);return _H(i,function(u){EH(e,u)?SH(s,u):xH(s,u)}),s}});var oC=X(()=>{"use strict";var wH=sr(),MH=iC(),bH=ia();wH({target:"Set",proto:!0,real:!0,forced:!bH("symmetricDifference")},{symmetricDifference:MH})});var aC=X((dot,sC)=>{"use strict";var AH=ea(),TH=To().add,CH=rp(),IH=ra(),PH=na();sC.exports=function(t){var e=AH(this),i=IH(t).getIterator(),s=CH(e);return PH(i,function(u){TH(s,u)}),s}});var uC=X(()=>{"use strict";var RH=sr(),LH=aC(),NH=ia();RH({target:"Set",proto:!0,real:!0,forced:!NH("union")},{union:LH})});var hy=X((yot,cC)=>{"use strict";var lC=qu(),OH=TypeError;cC.exports=function(n,t){if(!delete n[t])throw new OH("Cannot delete property "+lC(t)+" of "+lC(n))}});var fC=X(()=>{"use strict";var DH=sr(),FH=Vi(),UH=ii(),BH=vm(),zH=hy(),GH=Mh(),kH=[].unshift(0)!==1,qH=function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(n){return n instanceof TypeError}},VH=kH||!qH();DH({target:"Array",proto:!0,arity:1,forced:VH},{unshift:function(t){var e=FH(this),i=UH(e),s=arguments.length;if(s){GH(i+s);for(var u=i;u--;){var c=u+s;u in e?e[c]=e[u]:zH(e,c)}for(var f=0;f<s;f++)e[f]=arguments[f]}return BH(e,i+s)}})});var Fl=X((Not,gP)=>{"use strict";var bY=Zs(),AY=String;gP.exports=function(n){if(bY(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return AY(n)}});var yP=X((Oot,mP)=>{"use strict";var TY=so();mP.exports=function(){var n=TY(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 _P=X((Dot,vP)=>{"use strict";var t_=An(),CY=Sn(),e_=CY.RegExp,n_=t_(function(){var n=e_("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),IY=n_||t_(function(){return!e_("a","y").sticky}),PY=n_||t_(function(){var n=e_("^r","gy");return n.lastIndex=2,n.exec("str")!==null});vP.exports={BROKEN_CARET:PY,MISSED_STICKY:IY,UNSUPPORTED_Y:n_}});var EP=X((Fot,xP)=>{"use strict";var RY=An(),LY=Sn(),NY=LY.RegExp;xP.exports=RY(function(){var n=NY(".","s");return!(n.dotAll&&n.test(`
2
2
  `)&&n.flags==="s")})});var wP=X((Uot,SP)=>{"use strict";var OY=An(),DY=Sn(),FY=DY.RegExp;SP.exports=OY(function(){var n=FY("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var gd=X((Bot,bP)=>{"use strict";var Ul=vr(),dd=In(),UY=Fl(),BY=yP(),zY=_P(),GY=uh(),kY=Hu(),qY=Va().get,VY=EP(),HY=wP(),WY=GY("native-string-replace",String.prototype.replace),pd=RegExp.prototype.exec,i_=pd,XY=dd("".charAt),YY=dd("".indexOf),$Y=dd("".replace),r_=dd("".slice),o_=function(){var n=/a/,t=/b*/g;return Ul(pd,n,"a"),Ul(pd,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),MP=zY.BROKEN_CARET,s_=/()??/.exec("")[1]!==void 0,ZY=o_||s_||MP||VY||HY;ZY&&(i_=function(t){var e=this,i=qY(e),s=UY(t),u=i.raw,c,f,p,d,g,y,v;if(u)return u.lastIndex=e.lastIndex,c=Ul(i_,u,s),e.lastIndex=u.lastIndex,c;var E=i.groups,M=MP&&e.sticky,A=Ul(BY,e),_=e.source,x=0,T=s;if(M&&(A=$Y(A,"y",""),YY(A,"g")===-1&&(A+="g"),T=r_(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&XY(s,e.lastIndex-1)!==`
3
- `)&&(_="(?: "+_+")",T=" "+T,x++),f=new RegExp("^(?:"+_+")",A)),s_&&(f=new RegExp("^"+_+"$(?!\\s)",A)),o_&&(p=e.lastIndex),d=Ul(pd,M?f:e,T),M?d?(d.input=r_(d.input,x),d[0]=r_(d[0],x),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:o_&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),s_&&d&&d.length>1&&Ul(WY,d[0],f,function(){for(g=1;g<arguments.length-2;g++)arguments[g]===void 0&&(d[g]=void 0)}),d&&E)for(d.groups=y=kY(null),g=0;g<E.length;g++)v=E[g],y[v[0]]=d[v[1]];return d});bP.exports=i_});var a_=X(()=>{"use strict";var JY=sr(),AP=gd();JY({target:"RegExp",proto:!0,forced:/./.exec!==AP},{exec:AP})});var md=X((Yot,IP)=>{"use strict";var CP=Object.getOwnPropertySymbols,t$=Object.prototype.hasOwnProperty,e$=Object.prototype.propertyIsEnumerable;function n$(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function r$(){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 i=Object.getOwnPropertyNames(t).map(function(u){return t[u]});if(i.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(u){s[u]=u}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(u){return!1}}IP.exports=r$()?Object.assign:function(n,t){for(var e,i=n$(n),s,u=1;u<arguments.length;u++){e=Object(arguments[u]);for(var c in e)t$.call(e,c)&&(i[c]=e[c]);if(CP){s=CP(e);for(var f=0;f<s.length;f++)e$.call(e,s[f])&&(i[s[f]]=e[s[f]])}}return i}});var p_=X((f_,h_)=>{(function(n,t){typeof f_=="object"&&typeof h_!="undefined"?h_.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(f_,function(){"use strict";function n(_,x,T,w,R){(function B(U,D,P,ct,L){for(;ct>P;){if(ct-P>600){var W=ct-P+1,V=D-P+1,Mt=Math.log(W),$=.5*Math.exp(2*Mt/3),gt=.5*Math.sqrt(Mt*$*(W-$)/W)*(V-W/2<0?-1:1),ft=Math.max(P,Math.floor(D-V*$/W+gt)),vt=Math.min(ct,Math.floor(D+(W-V)*$/W+gt));B(U,D,ft,vt,L)}var it=U[D],lt=P,H=ct;for(t(U,P,D),L(U[ct],it)>0&&t(U,P,ct);lt<H;){for(t(U,lt,H),lt++,H--;L(U[lt],it)<0;)lt++;for(;L(U[H],it)>0;)H--}L(U[P],it)===0?t(U,P,H):t(U,++H,ct),H<=D&&(P=H+1),D<=H&&(ct=H-1)}})(_,x,T||0,w||_.length-1,R||e)}function t(_,x,T){var w=_[x];_[x]=_[T],_[T]=w}function e(_,x){return _<x?-1:_>x?1:0}var i=function(_){_===void 0&&(_=9),this._maxEntries=Math.max(4,_),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(_,x,T){if(!T)return x.indexOf(_);for(var w=0;w<x.length;w++)if(T(_,x[w]))return w;return-1}function u(_,x){c(_,0,_.children.length,x,_)}function c(_,x,T,w,R){R||(R=M(null)),R.minX=1/0,R.minY=1/0,R.maxX=-1/0,R.maxY=-1/0;for(var B=x;B<T;B++){var U=_.children[B];f(R,_.leaf?w(U):U)}return R}function f(_,x){return _.minX=Math.min(_.minX,x.minX),_.minY=Math.min(_.minY,x.minY),_.maxX=Math.max(_.maxX,x.maxX),_.maxY=Math.max(_.maxY,x.maxY),_}function p(_,x){return _.minX-x.minX}function d(_,x){return _.minY-x.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function y(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,x){return _.minX<=x.minX&&_.minY<=x.minY&&x.maxX<=_.maxX&&x.maxY<=_.maxY}function E(_,x){return x.minX<=_.maxX&&x.minY<=_.maxY&&x.maxX>=_.minX&&x.maxY>=_.minY}function M(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function A(_,x,T,w,R){for(var B=[x,T];B.length;)if(!((T=B.pop())-(x=B.pop())<=w)){var U=x+Math.ceil((T-x)/w/2)*w;n(_,U,x,T,R),B.push(x,U,U,T)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(_){var x=this.data,T=[];if(!E(_,x))return T;for(var w=this.toBBox,R=[];x;){for(var B=0;B<x.children.length;B++){var U=x.children[B],D=x.leaf?w(U):U;E(_,D)&&(x.leaf?T.push(U):v(_,D)?this._all(U,T):R.push(U))}x=R.pop()}return T},i.prototype.collides=function(_){var x=this.data;if(!E(_,x))return!1;for(var T=[];x;){for(var w=0;w<x.children.length;w++){var R=x.children[w],B=x.leaf?this.toBBox(R):R;if(E(_,B)){if(x.leaf||v(_,B))return!0;T.push(R)}}x=T.pop()}return!1},i.prototype.load=function(_){if(!_||!_.length)return this;if(_.length<this._minEntries){for(var x=0;x<_.length;x++)this.insert(_[x]);return this}var T=this._build(_.slice(),0,_.length-1,0);if(this.data.children.length)if(this.data.height===T.height)this._splitRoot(this.data,T);else{if(this.data.height<T.height){var w=this.data;this.data=T,T=w}this._insert(T,this.data.height-T.height-1,!0)}else this.data=T;return this},i.prototype.insert=function(_){return _&&this._insert(_,this.data.height-1),this},i.prototype.clear=function(){return this.data=M([]),this},i.prototype.remove=function(_,x){if(!_)return this;for(var T,w,R,B=this.data,U=this.toBBox(_),D=[],P=[];B||D.length;){if(B||(B=D.pop(),w=D[D.length-1],T=P.pop(),R=!0),B.leaf){var ct=s(_,B.children,x);if(ct!==-1)return B.children.splice(ct,1),D.push(B),this._condense(D),this}R||B.leaf||!v(B,U)?w?(T++,B=w.children[T],R=!1):B=null:(D.push(B),P.push(T),T=0,w=B,B=B.children[0])}return this},i.prototype.toBBox=function(_){return _},i.prototype.compareMinX=function(_,x){return _.minX-x.minX},i.prototype.compareMinY=function(_,x){return _.minY-x.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(_){return this.data=_,this},i.prototype._all=function(_,x){for(var T=[];_;)_.leaf?x.push.apply(x,_.children):T.push.apply(T,_.children),_=T.pop();return x},i.prototype._build=function(_,x,T,w){var R,B=T-x+1,U=this._maxEntries;if(B<=U)return u(R=M(_.slice(x,T+1)),this.toBBox),R;w||(w=Math.ceil(Math.log(B)/Math.log(U)),U=Math.ceil(B/Math.pow(U,w-1))),(R=M([])).leaf=!1,R.height=w;var D=Math.ceil(B/U),P=D*Math.ceil(Math.sqrt(U));A(_,x,T,P,this.compareMinX);for(var ct=x;ct<=T;ct+=P){var L=Math.min(ct+P-1,T);A(_,ct,L,D,this.compareMinY);for(var W=ct;W<=L;W+=D){var V=Math.min(W+D-1,L);R.children.push(this._build(_,W,V,w-1))}}return u(R,this.toBBox),R},i.prototype._chooseSubtree=function(_,x,T,w){for(;w.push(x),!x.leaf&&w.length-1!==T;){for(var R=1/0,B=1/0,U=void 0,D=0;D<x.children.length;D++){var P=x.children[D],ct=g(P),L=(W=_,V=P,(Math.max(V.maxX,W.maxX)-Math.min(V.minX,W.minX))*(Math.max(V.maxY,W.maxY)-Math.min(V.minY,W.minY))-ct);L<B?(B=L,R=ct<R?ct:R,U=P):L===B&&ct<R&&(R=ct,U=P)}x=U||x.children[0]}var W,V;return x},i.prototype._insert=function(_,x,T){var w=T?_:this.toBBox(_),R=[],B=this._chooseSubtree(w,this.data,x,R);for(B.children.push(_),f(B,w);x>=0&&R[x].children.length>this._maxEntries;)this._split(R,x),x--;this._adjustParentBBoxes(w,R,x)},i.prototype._split=function(_,x){var T=_[x],w=T.children.length,R=this._minEntries;this._chooseSplitAxis(T,R,w);var B=this._chooseSplitIndex(T,R,w),U=M(T.children.splice(B,T.children.length-B));U.height=T.height,U.leaf=T.leaf,u(T,this.toBBox),u(U,this.toBBox),x?_[x-1].children.push(U):this._splitRoot(T,U)},i.prototype._splitRoot=function(_,x){this.data=M([_,x]),this.data.height=_.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(_,x,T){for(var w,R,B,U,D,P,ct,L=1/0,W=1/0,V=x;V<=T-x;V++){var Mt=c(_,0,V,this.toBBox),$=c(_,V,T,this.toBBox),gt=(R=Mt,B=$,U=void 0,D=void 0,P=void 0,ct=void 0,U=Math.max(R.minX,B.minX),D=Math.max(R.minY,B.minY),P=Math.min(R.maxX,B.maxX),ct=Math.min(R.maxY,B.maxY),Math.max(0,P-U)*Math.max(0,ct-D)),ft=g(Mt)+g($);gt<L?(L=gt,w=V,W=ft<W?ft:W):gt===L&&ft<W&&(W=ft,w=V)}return w||T-x},i.prototype._chooseSplitAxis=function(_,x,T){var w=_.leaf?this.compareMinX:p,R=_.leaf?this.compareMinY:d;this._allDistMargin(_,x,T,w)<this._allDistMargin(_,x,T,R)&&_.children.sort(w)},i.prototype._allDistMargin=function(_,x,T,w){_.children.sort(w);for(var R=this.toBBox,B=c(_,0,x,R),U=c(_,T-x,T,R),D=y(B)+y(U),P=x;P<T-x;P++){var ct=_.children[P];f(B,_.leaf?R(ct):ct),D+=y(B)}for(var L=T-x-1;L>=x;L--){var W=_.children[L];f(U,_.leaf?R(W):W),D+=y(U)}return D},i.prototype._adjustParentBBoxes=function(_,x,T){for(var w=T;w>=0;w--)f(x[w],_)},i.prototype._condense=function(_){for(var x=_.length-1,T=void 0;x>=0;x--)_[x].children.length===0?x>0?(T=_[x-1].children).splice(T.indexOf(_[x]),1):this.clear():u(_[x],this.toBBox)},i})});var PP=X((d_,g_)=>{(function(n,t){typeof d_=="object"&&typeof g_!="undefined"?g_.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(d_,function(){"use strict";var n=function(i,s){if(i===void 0&&(i=[]),s===void 0&&(s=t),this.data=i,this.length=this.data.length,this.compare=s,this.length>0)for(var u=(this.length>>1)-1;u>=0;u--)this._down(u)};n.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var i=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),i}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(i){for(var s=this,u=s.data,c=s.compare,f=u[i];i>0;){var p=i-1>>1,d=u[p];if(c(f,d)>=0)break;u[i]=d,i=p}u[i]=f},n.prototype._down=function(i){for(var s=this,u=s.data,c=s.compare,f=this.length>>1,p=u[i];i<f;){var d=(i<<1)+1,g=u[d],y=d+1;if(y<this.length&&c(u[y],g)<0&&(d=y,g=u[y]),c(g,p)>=0)break;u[i]=g,i=d}u[i]=p};function t(e,i){return e<i?-1:e>i?1:0}return n})});var LP=X((Qot,RP)=>{RP.exports=function(t,e,i,s){var u=t[0],c=t[1],f=!1;i===void 0&&(i=0),s===void 0&&(s=e.length);for(var p=(s-i)/2,d=0,g=p-1;d<p;g=d++){var y=e[i+d*2+0],v=e[i+d*2+1],E=e[i+g*2+0],M=e[i+g*2+1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var OP=X((tst,NP)=>{NP.exports=function(t,e,i,s){var u=t[0],c=t[1],f=!1;i===void 0&&(i=0),s===void 0&&(s=e.length);for(var p=s-i,d=0,g=p-1;d<p;g=d++){var y=e[d+i][0],v=e[d+i][1],E=e[g+i][0],M=e[g+i][1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var UP=X((est,_d)=>{var DP=LP(),FP=OP();_d.exports=function(t,e,i,s){return e.length>0&&Array.isArray(e[0])?FP(t,e,i,s):DP(t,e,i,s)};_d.exports.nested=FP;_d.exports.flat=DP});var zP=X((xd,BP)=>{(function(n,t){typeof xd=="object"&&typeof BP!="undefined"?t(xd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(xd,function(n){"use strict";let e=33306690738754706e-32;function i(E,M,A,_,x){let T,w,R,B,U=M[0],D=_[0],P=0,ct=0;D>U==D>-U?(T=U,U=M[++P]):(T=D,D=_[++ct]);let L=0;if(P<E&&ct<A)for(D>U==D>-U?(R=T-((w=U+T)-U),U=M[++P]):(R=T-((w=D+T)-D),D=_[++ct]),T=w,R!==0&&(x[L++]=R);P<E&&ct<A;)D>U==D>-U?(R=T-((w=T+U)-(B=w-T))+(U-B),U=M[++P]):(R=T-((w=T+D)-(B=w-T))+(D-B),D=_[++ct]),T=w,R!==0&&(x[L++]=R);for(;P<E;)R=T-((w=T+U)-(B=w-T))+(U-B),U=M[++P],T=w,R!==0&&(x[L++]=R);for(;ct<A;)R=T-((w=T+D)-(B=w-T))+(D-B),D=_[++ct],T=w,R!==0&&(x[L++]=R);return T===0&&L!==0||(x[L++]=T),L}function s(E){return new Float64Array(E)}let u=33306690738754716e-32,c=22204460492503146e-32,f=11093356479670487e-47,p=s(4),d=s(8),g=s(12),y=s(16),v=s(4);n.orient2d=function(E,M,A,_,x,T){let w=(M-T)*(A-x),R=(E-x)*(_-T),B=w-R;if(w===0||R===0||w>0!=R>0)return B;let U=Math.abs(w+R);return Math.abs(B)>=u*U?B:-function(D,P,ct,L,W,V,Mt){let $,gt,ft,vt,it,lt,H,At,It,Kt,nt,bt,Vt,$t,Ut,Gt,Ct,ee,Z=D-W,Dt=ct-W,_t=P-V,Nt=L-V;it=(Ut=(At=Z-(H=(lt=134217729*Z)-(lt-Z)))*(Kt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=Z*Nt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(Kt=Dt-(It=(lt=134217729*Dt)-(lt-Dt)))-((Gt=_t*Dt)-H*It-At*It-H*Kt))),p[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),p[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,p[2]=bt-(ee-it)+(nt-it),p[3]=ee;let wt=function(Y,N){let xt=N[0];for(let St=1;St<Y;St++)xt+=N[St];return xt}(4,p),Ht=c*Mt;if(wt>=Ht||-wt>=Ht||($=D-(Z+(it=D-Z))+(it-W),ft=ct-(Dt+(it=ct-Dt))+(it-W),gt=P-(_t+(it=P-_t))+(it-V),vt=L-(Nt+(it=L-Nt))+(it-V),$===0&&gt===0&&ft===0&&vt===0)||(Ht=f*Mt+e*Math.abs(wt),(wt+=Z*vt+Nt*$-(_t*ft+Dt*gt))>=Ht||-wt>=Ht))return wt;it=(Ut=(At=$-(H=(lt=134217729*$)-(lt-$)))*(Kt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=$*Nt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=gt-(H=(lt=134217729*gt)-(lt-gt)))*(Kt=Dt-(It=(lt=134217729*Dt)-(lt-Dt)))-((Gt=gt*Dt)-H*It-At*It-H*Kt))),v[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),v[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,v[2]=bt-(ee-it)+(nt-it),v[3]=ee;let Xt=i(4,p,4,v,d);it=(Ut=(At=Z-(H=(lt=134217729*Z)-(lt-Z)))*(Kt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=Z*vt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(Kt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((Gt=_t*ft)-H*It-At*It-H*Kt))),v[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),v[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,v[2]=bt-(ee-it)+(nt-it),v[3]=ee;let Pt=i(Xt,d,4,v,g);it=(Ut=(At=$-(H=(lt=134217729*$)-(lt-$)))*(Kt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=$*vt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=gt-(H=(lt=134217729*gt)-(lt-gt)))*(Kt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((Gt=gt*ft)-H*It-At*It-H*Kt))),v[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),v[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,v[2]=bt-(ee-it)+(nt-it),v[3]=ee;let ne=i(Pt,g,4,v,y);return y[ne-1]}(E,M,A,_,x,T,U)},n.orient2dfast=function(E,M,A,_,x,T){return(M-T)*(A-x)-(E-x)*(_-T)},Object.defineProperty(n,"__esModule",{value:!0})})});var WP=X((nst,__)=>{"use strict";var GP=p_(),Sd=PP(),o$=UP(),s$=zP().orient2d;Sd.default&&(Sd=Sd.default);__.exports=HP;__.exports.default=HP;function HP(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var i=f$(n),s=new GP(16);s.toBBox=function(T){return{minX:T[0],minY:T[1],maxX:T[0],maxY:T[1]}},s.compareMinX=function(T,w){return T[0]-w[0]},s.compareMinY=function(T,w){return T[1]-w[1]},s.load(n);for(var u=[],c=0,f;c<i.length;c++){var p=i[c];s.remove(p),f=VP(p,f),u.push(f)}var d=new GP(16);for(c=0;c<u.length;c++)d.insert(m_(u[c]));for(var g=t*t,y=e*e;u.length;){var v=u.shift(),E=v.p,M=v.next.p,A=y_(E,M);if(!(A<y)){var _=A/g;p=a$(s,v.prev.p,E,M,v.next.next.p,_,d),p&&Math.min(y_(p,E),y_(p,M))<=_&&(u.push(v),u.push(VP(p,v)),s.remove(p),d.remove(v),d.insert(m_(v)),d.insert(m_(v.next)))}}v=f;var x=[];do x.push(v.p),v=v.next;while(v!==f);return x.push(v.p),x}function a$(n,t,e,i,s,u,c){for(var f=new Sd([],u$),p=n.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],y=p.leaf?v_(g,e,i):l$(e,i,g);y>u||f.push({node:g,dist:y})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),E=v.node,M=v_(E,t,e),A=v_(E,i,s);if(v.dist<M&&v.dist<A&&qP(e,E,c)&&qP(i,E,c))return E}p=f.pop(),p&&(p=p.node)}return null}function u$(n,t){return n.dist-t.dist}function l$(n,t,e){if(kP(n,e)||kP(t,e))return 0;var i=Ed(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(i===0)return 0;var s=Ed(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var u=Ed(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(u===0)return 0;var c=Ed(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return c===0?0:Math.min(i,s,u,c)}function kP(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function qP(n,t,e){for(var i=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),u=Math.max(n[0],t[0]),c=Math.max(n[1],t[1]),f=e.search({minX:i,minY:s,maxX:u,maxY:c}),p=0;p<f.length;p++)if(c$(f[p].p,f[p].next.p,n,t))return!1;return!0}function Bl(n,t,e){return s$(n[0],n[1],t[0],t[1],e[0],e[1])}function c$(n,t,e,i){return n!==i&&t!==e&&Bl(n,t,e)>0!=Bl(n,t,i)>0&&Bl(e,i,n)>0!=Bl(e,i,t)>0}function m_(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 f$(n){for(var t=n[0],e=n[0],i=n[0],s=n[0],u=0;u<n.length;u++){var c=n[u];c[0]<t[0]&&(t=c),c[0]>i[0]&&(i=c),c[1]<e[1]&&(e=c),c[1]>s[1]&&(s=c)}var f=[t,e,i,s],p=f.slice();for(u=0;u<n.length;u++)o$(n[u],f)||p.push(n[u]);return p$(p)}function VP(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 y_(n,t){var e=n[0]-t[0],i=n[1]-t[1];return e*e+i*i}function v_(n,t,e){var i=t[0],s=t[1],u=e[0]-i,c=e[1]-s;if(u!==0||c!==0){var f=((n[0]-i)*u+(n[1]-s)*c)/(u*u+c*c);f>1?(i=e[0],s=e[1]):f>0&&(i+=u*f,s+=c*f)}return u=n[0]-i,c=n[1]-s,u*u+c*c}function Ed(n,t,e,i,s,u,c,f){var p=e-n,d=i-t,g=c-s,y=f-u,v=n-s,E=t-u,M=p*p+d*d,A=p*g+d*y,_=g*g+y*y,x=p*v+d*E,T=g*v+y*E,w=M*_-A*A,R,B,U,D,P=w,ct=w;w===0?(B=0,P=1,D=T,ct=_):(B=A*T-_*x,D=M*T-A*x,B<0?(B=0,D=T,ct=_):B>P&&(B=P,D=T+A,ct=_)),D<0?(D=0,-x<0?B=0:-x>M?B=P:(B=-x,P=M)):D>ct&&(D=ct,-x+A<0?B=0:-x+A>M?B=P:(B=-x+A,P=M)),R=B===0?0:B/P,U=D===0?0:D/ct;var L=(1-R)*n+R*e,W=(1-R)*t+R*i,V=(1-U)*s+U*c,Mt=(1-U)*u+U*f,$=V-L,gt=Mt-W;return $*$+gt*gt}function h$(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function p$(n){n.sort(h$);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&Bl(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var i=[],s=n.length-1;s>=0;s--){for(;i.length>=2&&Bl(i[i.length-2],i[i.length-1],n[s])<=0;)i.pop();i.push(n[s])}return i.pop(),t.pop(),t.concat(i)}});var jP=X((E_,S_)=>{(function(n,t){typeof E_=="object"&&typeof S_!="undefined"?S_.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(E_,function(){"use strict";function n(s,u,c,f,p){t(s,u,c||0,f||s.length-1,p||i)}function t(s,u,c,f,p){for(;f>c;){if(f-c>600){var d=f-c+1,g=u-c+1,y=Math.log(d),v=.5*Math.exp(2*y/3),E=.5*Math.sqrt(y*v*(d-v)/d)*(g-d/2<0?-1:1),M=Math.max(c,Math.floor(u-g*v/d+E)),A=Math.min(f,Math.floor(u+(d-g)*v/d+E));t(s,u,M,A,p)}var _=s[u],x=c,T=f;for(e(s,c,u),p(s[f],_)>0&&e(s,c,f);x<T;){for(e(s,x,T),x++,T--;p(s[x],_)<0;)x++;for(;p(s[T],_)>0;)T--}p(s[c],_)===0?e(s,c,T):(T++,e(s,T,f)),T<=u&&(c=T+1),u<=T&&(f=T-1)}}function e(s,u,c){var f=s[u];s[u]=s[c],s[c]=f}function i(s,u){return s<u?-1:s>u?1:0}return n})});var A_=X((Cut,b_)=>{"use strict";b_.exports=Sf;b_.exports.default=Sf;var A$=jP();function Sf(n,t){if(!(this instanceof Sf))return new Sf(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()}Sf.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],i=this.toBBox;if(!Md(n,t))return e;for(var s=[],u,c,f,p;t;){for(u=0,c=t.children.length;u<c;u++)f=t.children[u],p=t.leaf?i(f):f,Md(n,p)&&(t.leaf?e.push(f):M_(n,p)?this._all(f,e):s.push(f));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!Md(n,t))return!1;for(var i=[],s,u,c,f;t;){for(s=0,u=t.children.length;s<u;s++)if(c=t.children[s],f=t.leaf?e(c):c,Md(n,f)){if(t.leaf||M_(n,f))return!0;i.push(c)}t=i.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 i=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=kl([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,i=this.toBBox(n),s=[],u=[],c,f,p,d;e||s.length;){if(e||(e=s.pop(),f=s[s.length-1],c=u.pop(),d=!0),e.leaf&&(p=T$(n,e.children,t),p!==-1))return e.children.splice(p,1),s.push(e),this._condense(s),this;!d&&!e.leaf&&M_(e,i)?(s.push(e),u.push(c),c=0,f=e,e=e.children[0]):f?(c++,e=f.children[c],d=!1):e=null}return this},toBBox:function(n){return n},compareMinX:KP,compareMinY:QP,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,i){var s=e-t+1,u=this._maxEntries,c;if(s<=u)return c=kl(n.slice(t,e+1)),Gl(c,this.toBBox),c;i||(i=Math.ceil(Math.log(s)/Math.log(u)),u=Math.ceil(s/Math.pow(u,i-1))),c=kl([]),c.leaf=!1,c.height=i;var f=Math.ceil(s/u),p=f*Math.ceil(Math.sqrt(u)),d,g,y,v;for(tR(n,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(y=Math.min(d+p-1,e),tR(n,d,y,f,this.compareMinY),g=d;g<=y;g+=f)v=Math.min(g+f-1,y),c.children.push(this._build(n,g,v,i-1));return Gl(c,this.toBBox),c},_chooseSubtree:function(n,t,e,i){for(var s,u,c,f,p,d,g,y;i.push(t),!(t.leaf||i.length-1===e);){for(g=y=1/0,s=0,u=t.children.length;s<u;s++)c=t.children[s],p=w_(c),d=C$(n,c)-p,d<y?(y=d,g=p<g?p:g,f=c):d===y&&p<g&&(g=p,f=c);t=f||t.children[0]}return t},_insert:function(n,t,e){var i=this.toBBox,s=e?n:i(n),u=[],c=this._chooseSubtree(s,this.data,t,u);for(c.children.push(n),Ef(c,s);t>=0&&u[t].children.length>this._maxEntries;)this._split(u,t),t--;this._adjustParentBBoxes(s,u,t)},_split:function(n,t){var e=n[t],i=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,i);var u=this._chooseSplitIndex(e,s,i),c=kl(e.children.splice(u,e.children.length-u));c.height=e.height,c.leaf=e.leaf,Gl(e,this.toBBox),Gl(c,this.toBBox),t?n[t-1].children.push(c):this._splitRoot(e,c)},_splitRoot:function(n,t){this.data=kl([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Gl(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var i,s,u,c,f,p,d,g;for(p=d=1/0,i=t;i<=e-t;i++)s=xf(n,0,i,this.toBBox),u=xf(n,i,e,this.toBBox),c=I$(s,u),f=w_(s)+w_(u),c<p?(p=c,g=i,d=f<d?f:d):c===p&&f<d&&(d=f,g=i);return g},_chooseSplitAxis:function(n,t,e){var i=n.leaf?this.compareMinX:KP,s=n.leaf?this.compareMinY:QP,u=this._allDistMargin(n,t,e,i),c=this._allDistMargin(n,t,e,s);u<c&&n.children.sort(i)},_allDistMargin:function(n,t,e,i){n.children.sort(i);var s=this.toBBox,u=xf(n,0,t,s),c=xf(n,e-t,e,s),f=wd(u)+wd(c),p,d;for(p=t;p<e-t;p++)d=n.children[p],Ef(u,n.leaf?s(d):d),f+=wd(u);for(p=e-t-1;p>=t;p--)d=n.children[p],Ef(c,n.leaf?s(d):d),f+=wd(c);return f},_adjustParentBBoxes:function(n,t,e){for(var i=e;i>=0;i--)Ef(t[i],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():Gl(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 T$(n,t,e){if(!e)return t.indexOf(n);for(var i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Gl(n,t){xf(n,0,n.children.length,t,n)}function xf(n,t,e,i,s){s||(s=kl(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var u=t,c;u<e;u++)c=n.children[u],Ef(s,n.leaf?i(c):c);return s}function Ef(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 KP(n,t){return n.minX-t.minX}function QP(n,t){return n.minY-t.minY}function w_(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function wd(n){return n.maxX-n.minX+(n.maxY-n.minY)}function C$(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 I$(n,t){var e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),u=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,u-i)}function M_(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Md(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function kl(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function tR(n,t,e,i,s){for(var u=[t,e],c;u.length;)e=u.pop(),t=u.pop(),!(e-t<=i)&&(c=t+Math.ceil((e-t)/i/2)*i,A$(n,c,t,e,s),u.push(t,c,c,e))}});var sR=X((klt,L_)=>{"use strict";L_.exports=Cd;L_.exports.default=Cd;function Cd(n,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:n.length,u=rR(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;var f,p,d,g,y,v,E;if(i&&(u=G$(n,t,u,e)),n.length>80*e){f=d=n[0],p=g=n[1];for(var M=e;M<s;M+=e)y=n[M],v=n[M+1],y<f&&(f=y),v<p&&(p=v),y>d&&(d=y),v>g&&(g=v);E=Math.max(d-f,g-p),E=E!==0?32767/E:0}return bf(u,c,e,f,p,E,0),c}function rR(n,t,e,i,s){var u,c;if(s===R_(n,t,e,i)>0)for(u=t;u<e;u+=i)c=nR(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=nR(u,n[u],n[u+1],c);return c&&Id(c,c.next)&&(Tf(c),c=c.next),c}function gu(n,t){if(!n)return n;t||(t=n);var e=n,i;do if(i=!1,!e.steiner&&(Id(e,e.next)||tr(e.prev,e,e.next)===0)){if(Tf(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function bf(n,t,e,i,s,u,c){if(n){!c&&u&&W$(n,i,s,u);for(var f=n,p,d;n.prev!==n.next;){if(p=n.prev,d=n.next,u?U$(n,i,s,u):F$(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),Tf(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=B$(gu(n),t,e),bf(n,t,e,i,s,u,2)):c===2&&z$(n,t,e,i,s,u):bf(gu(n),t,e,i,s,u,1);break}}}}function F$(n){var t=n.prev,e=n,i=n.next;if(tr(t,e,i)>=0)return!1;for(var s=t.x,u=e.x,c=i.x,f=t.y,p=e.y,d=i.y,g=s<u?s<c?s:c:u<c?u:c,y=f<p?f<d?f:d:p<d?p:d,v=s>u?s>c?s:c:u>c?u:c,E=f>p?f>d?f:d:p>d?p:d,M=i.next;M!==t;){if(M.x>=g&&M.x<=v&&M.y>=y&&M.y<=E&&Hl(s,f,u,p,c,d,M.x,M.y)&&tr(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function U$(n,t,e,i){var s=n.prev,u=n,c=n.next;if(tr(s,u,c)>=0)return!1;for(var f=s.x,p=u.x,d=c.x,g=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=g<y?g<v?g:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=g>y?g>v?g:v:y>v?y:v,x=I_(E,M,t,e,i),T=I_(A,_,t,e,i),w=n.prevZ,R=n.nextZ;w&&w.z>=x&&R&&R.z<=T;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Hl(f,g,p,y,d,v,w.x,w.y)&&tr(w.prev,w,w.next)>=0||(w=w.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Hl(f,g,p,y,d,v,R.x,R.y)&&tr(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;w&&w.z>=x;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Hl(f,g,p,y,d,v,w.x,w.y)&&tr(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Hl(f,g,p,y,d,v,R.x,R.y)&&tr(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function B$(n,t,e){var i=n;do{var s=i.prev,u=i.next.next;!Id(s,u)&&iR(s,i,i.next,u)&&Af(s,u)&&Af(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),Tf(i),Tf(i.next),i=n=u),i=i.next}while(i!==n);return gu(i)}function z$(n,t,e,i,s,u){var c=n;do{for(var f=c.next.next;f!==c.prev;){if(c.i!==f.i&&$$(c,f)){var p=oR(c,f);c=gu(c,c.next),p=gu(p,p.next),bf(c,t,e,i,s,u,0),bf(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function G$(n,t,e,i){var s=[],u,c,f,p,d;for(u=0,c=t.length;u<c;u++)f=t[u]*i,p=u<c-1?t[u+1]*i:n.length,d=rR(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(Y$(d));for(s.sort(k$),u=0;u<s.length;u++)e=q$(s[u],e);return e}function k$(n,t){return n.x-t.x}function q$(n,t){var e=V$(n,t);if(!e)return t;var i=oR(e,n);return gu(i,i.next),gu(e,e.next)}function V$(n,t){var e=t,i=n.x,s=n.y,u=-1/0,c;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var f=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=i&&f>u&&(u=f,c=e.x<e.next.x?e:e.next,f===i))return c}e=e.next}while(e!==t);if(!c)return null;var p=c,d=c.x,g=c.y,y=1/0,v;e=c;do i>=e.x&&e.x>=d&&i!==e.x&&Hl(s<g?i:u,s,d,g,s<g?u:i,s,e.x,e.y)&&(v=Math.abs(s-e.y)/(i-e.x),Af(e,n)&&(v<y||v===y&&(e.x>c.x||e.x===c.x&&H$(c,e)))&&(c=e,y=v)),e=e.next;while(e!==p);return c}function H$(n,t){return tr(n.prev,n,t.prev)<0&&tr(t.next,n,n.next)<0}function W$(n,t,e,i){var s=n;do s.z===0&&(s.z=I_(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,X$(s)}function X$(n){var t,e,i,s,u,c,f,p,d=1;do{for(e=n,n=null,u=null,c=0;e;){for(c++,i=e,f=0,t=0;t<d&&(f++,i=i.nextZ,!!i);t++);for(p=d;f>0||p>0&&i;)f!==0&&(p===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,f--):(s=i,i=i.nextZ,p--),u?u.nextZ=s:n=s,s.prevZ=u,u=s;e=i}u.nextZ=null,d*=2}while(c>1);return n}function I_(n,t,e,i,s){return n=(n-e)*s|0,t=(t-i)*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 Y$(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 Hl(n,t,e,i,s,u,c,f){return(s-c)*(t-f)>=(n-c)*(u-f)&&(n-c)*(i-f)>=(e-c)*(t-f)&&(e-c)*(u-f)>=(s-c)*(i-f)}function $$(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!Z$(n,t)&&(Af(n,t)&&Af(t,n)&&J$(n,t)&&(tr(n.prev,n,t.prev)||tr(n,t.prev,t))||Id(n,t)&&tr(n.prev,n,n.next)>0&&tr(t.prev,t,t.next)>0)}function tr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Id(n,t){return n.x===t.x&&n.y===t.y}function iR(n,t,e,i){var s=Td(tr(n,t,e)),u=Td(tr(n,t,i)),c=Td(tr(e,i,n)),f=Td(tr(e,i,t));return!!(s!==u&&c!==f||s===0&&Ad(n,e,t)||u===0&&Ad(n,i,t)||c===0&&Ad(e,n,i)||f===0&&Ad(e,t,i))}function Ad(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 Td(n){return n>0?1:n<0?-1:0}function Z$(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&&iR(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function Af(n,t){return tr(n.prev,n,n.next)<0?tr(n,t,n.next)>=0&&tr(n,n.prev,t)>=0:tr(n,t,n.prev)<0||tr(n,n.next,t)<0}function J$(n,t){var e=n,i=!1,s=(n.x+t.x)/2,u=(n.y+t.y)/2;do e.y>u!=e.next.y>u&&e.next.y!==e.y&&s<(e.next.x-e.x)*(u-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==n);return i}function oR(n,t){var e=new P_(n.i,n.x,n.y),i=new P_(t.i,t.x,t.y),s=n.next,u=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,i.next=e,e.prev=i,u.next=i,i.prev=u,i}function nR(n,t,e,i){var s=new P_(n,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Tf(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 P_(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}Cd.deviation=function(n,t,e,i){var s=t&&t.length,u=s?t[0]*e:n.length,c=Math.abs(R_(n,0,u,e));if(s)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:n.length;c-=Math.abs(R_(n,d,g,e))}var y=0;for(f=0;f<i.length;f+=3){var v=i[f]*e,E=i[f+1]*e,M=i[f+2]*e;y+=Math.abs((n[v]-n[M])*(n[E+1]-n[v+1])-(n[v]-n[E])*(n[M+1]-n[v+1]))}return c===0&&y===0?0:Math.abs((y-c)/c)};function R_(n,t,e,i){for(var s=0,u=t,c=e-i;u<e;u+=i)s+=(n[c]-n[u])*(n[u+1]+n[c+1]),c=u;return s}Cd.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<n.length;s++){for(var u=0;u<n[s].length;u++)for(var c=0;c<t;c++)e.vertices.push(n[s][u][c]);s>0&&(i+=n[s-1].length,e.holes.push(i))}return e}});var U_=X(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.earthRadius=63710088e-1;ge.factors={centimeters:ge.earthRadius*100,centimetres:ge.earthRadius*100,degrees:ge.earthRadius/111325,feet:ge.earthRadius*3.28084,inches:ge.earthRadius*39.37,kilometers:ge.earthRadius/1e3,kilometres:ge.earthRadius/1e3,meters:ge.earthRadius,metres:ge.earthRadius,miles:ge.earthRadius/1609.344,millimeters:ge.earthRadius*1e3,millimetres:ge.earthRadius*1e3,nauticalmiles:ge.earthRadius/1852,radians:1,yards:ge.earthRadius*1.0936};ge.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/ge.earthRadius,yards:1.0936133};ge.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 Sa(n,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}ge.feature=Sa;function K$(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return N_(t).geometry;case"LineString":return D_(t).geometry;case"Polygon":return O_(t).geometry;case"MultiPoint":return uR(t).geometry;case"MultiLineString":return aR(t).geometry;case"MultiPolygon":return lR(t).geometry;default:throw new Error(n+" is invalid")}}ge.geometry=K$;function N_(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(!Pd(n[0])||!Pd(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return Sa(i,t,e)}ge.point=N_;function Q$(n,t,e){return e===void 0&&(e={}),Rd(n.map(function(i){return N_(i,t)}),e)}ge.points=Q$;function O_(n,t,e){e===void 0&&(e={});for(var i=0,s=n;i<s.length;i++){var u=s[i];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var c=0;c<u[u.length-1].length;c++)if(u[u.length-1][c]!==u[0][c])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:n};return Sa(f,t,e)}ge.polygon=O_;function tZ(n,t,e){return e===void 0&&(e={}),Rd(n.map(function(i){return O_(i,t)}),e)}ge.polygons=tZ;function D_(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 i={type:"LineString",coordinates:n};return Sa(i,t,e)}ge.lineString=D_;function eZ(n,t,e){return e===void 0&&(e={}),Rd(n.map(function(i){return D_(i,t)}),e)}ge.lineStrings=eZ;function Rd(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}ge.featureCollection=Rd;function aR(n,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:n};return Sa(i,t,e)}ge.multiLineString=aR;function uR(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return Sa(i,t,e)}ge.multiPoint=uR;function lR(n,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:n};return Sa(i,t,e)}ge.multiPolygon=lR;function nZ(n,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:n};return Sa(i,t,e)}ge.geometryCollection=nZ;function rZ(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}ge.round=rZ;function cR(n,t){t===void 0&&(t="kilometers");var e=ge.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}ge.radiansToLength=cR;function F_(n,t){t===void 0&&(t="kilometers");var e=ge.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}ge.lengthToRadians=F_;function iZ(n,t){return fR(F_(n,t))}ge.lengthToDegrees=iZ;function oZ(n){var t=n%360;return t<0&&(t+=360),t}ge.bearingToAzimuth=oZ;function fR(n){var t=n%(2*Math.PI);return t*180/Math.PI}ge.radiansToDegrees=fR;function sZ(n){var t=n%360;return t*Math.PI/180}ge.degreesToRadians=sZ;function aZ(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 cR(F_(n,t),e)}ge.convertLength=aZ;function uZ(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 i=ge.areaFactors[t];if(!i)throw new Error("invalid original units");var s=ge.areaFactors[e];if(!s)throw new Error("invalid final units");return n/i*s}ge.convertArea=uZ;function Pd(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}ge.isNumber=Pd;function lZ(n){return!!n&&n.constructor===Object}ge.isObject=lZ;function cZ(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(!Pd(t))throw new Error("bbox must only contain numbers")})}ge.validateBBox=cZ;function fZ(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")}ge.validateId=fZ});var z_=X(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});var fi=U_();function Cf(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,g=0,y=0,v,E=n.type,M=E==="FeatureCollection",A=E==="Feature",_=M?n.features.length:1,x=0;x<_;x++){d=M?n.features[x].geometry:A?n.geometry:n,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var T=0;T<f;T++){var w=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var B=c.type;switch(g=e&&(B==="Polygon"||B==="MultiPolygon")?1:0,B){case null:break;case"Point":if(t(p,y,x,w,R)===!1)return!1;y++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,w,R)===!1)return!1;y++,B==="MultiPoint"&&w++}B==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-g;s++){if(t(p[i][s],y,x,w,R)===!1)return!1;y++}B==="MultiLineString"&&w++,B==="Polygon"&&R++}B==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<p.length;i++){for(R=0,s=0;s<p[i].length;s++){for(u=0;u<p[i][s].length-g;u++){if(t(p[i][s][u],y,x,w,R)===!1)return!1;y++}R++}w++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(Cf(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hZ(n,t,e,i){var s=e;return Cf(n,function(u,c,f,p,d){c===0&&e===void 0?s=u:s=t(s,u,c,f,p,d)},i),s}function hR(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 pZ(n,t,e){var i=e;return hR(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function pR(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 dZ(n,t,e){var i=e;return pR(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function gZ(n){var t=[];return Cf(n,function(e){t.push(e)}),t}function B_(n,t){var e,i,s,u,c,f,p,d,g,y,v=0,E=n.type==="FeatureCollection",M=n.type==="Feature",A=E?n.features.length:1;for(e=0;e<A;e++){for(f=E?n.features[e].geometry:M?n.geometry:n,d=E?n.features[e].properties:M?n.properties:{},g=E?n.features[e].bbox:M?n.bbox:void 0,y=E?n.features[e].id:M?n.id:void 0,p=f?f.type==="GeometryCollection":!1,c=p?f.geometries.length:1,s=0;s<c;s++){if(u=p?f.geometries[s]:f,u===null){if(t(null,v,d,g,y)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,v,d,g,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,g,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function mZ(n,t,e){var i=e;return B_(n,function(s,u,c,f,p){u===0&&e===void 0?i=s:i=t(i,s,u,c,f,p)}),i}function Ld(n,t){B_(n,function(e,i,s,u,c){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(fi.feature(e,s,{bbox:u,id:c}),i,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],y={type:p,coordinates:g};if(t(fi.feature(y,s),i,d)===!1)return!1}})}function yZ(n,t,e){var i=e;return Ld(n,function(s,u,c){u===0&&c===0&&e===void 0?i=s:i=t(i,s,u,c)}),i}function dR(n,t){Ld(n,function(e,i,s){var u=0;if(e.geometry){var c=e.geometry.type;if(!(c==="Point"||c==="MultiPoint")){var f,p=0,d=0,g=0;if(Cf(e,function(y,v,E,M,A){if(f===void 0||i>p||M>d||A>g){f=y,p=i,d=M,g=A,u=0;return}var _=fi.lineString([f,y],e.properties);if(t(_,i,s,A,u)===!1)return!1;u++,f=y})===!1)return!1}}})}function vZ(n,t,e){var i=e,s=!1;return dR(n,function(u,c,f,p,d){s===!1&&e===void 0?i=u:i=t(i,u,c,f,p,d),s=!0}),i}function gR(n,t){if(!n)throw new Error("geojson is required");Ld(n,function(e,i,s){if(e.geometry!==null){var u=e.geometry.type,c=e.geometry.coordinates;switch(u){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<c.length;f++)if(t(fi.lineString(c[f],e.properties),i,s,f)===!1)return!1;break}}})}function _Z(n,t,e){var i=e;return gR(n,function(s,u,c,f){u===0&&e===void 0?i=s:i=t(i,s,u,c,f)}),i}function xZ(n,t){if(t=t||{},!fi.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,s=t.geometryIndex||0,u=t.segmentIndex||0,c=t.properties,f;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),c=c||n.features[e].properties,f=n.features[e].geometry;break;case"Feature":c=c||n.properties,f=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=n;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return u<0&&(u=p.length+u-1),fi.lineString([p[u],p[u+1]],c,t);case"Polygon":return s<0&&(s=p.length+s),u<0&&(u=p[s].length+u-1),fi.lineString([p[s][u],p[s][u+1]],c,t);case"MultiLineString":return i<0&&(i=p.length+i),u<0&&(u=p[i].length+u-1),fi.lineString([p[i][u],p[i][u+1]],c,t);case"MultiPolygon":return i<0&&(i=p.length+i),s<0&&(s=p[i].length+s),u<0&&(u=p[i][s].length-u-1),fi.lineString([p[i][s][u],p[i][s][u+1]],c,t)}throw new Error("geojson is invalid")}function EZ(n,t){if(t=t||{},!fi.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,s=t.geometryIndex||0,u=t.coordIndex||0,c=t.properties,f;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),c=c||n.features[e].properties,f=n.features[e].geometry;break;case"Feature":c=c||n.properties,f=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=n;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return fi.point(p,c,t);case"MultiPoint":return i<0&&(i=p.length+i),fi.point(p[i],c,t);case"LineString":return u<0&&(u=p.length+u),fi.point(p[u],c,t);case"Polygon":return s<0&&(s=p.length+s),u<0&&(u=p[s].length+u),fi.point(p[s][u],c,t);case"MultiLineString":return i<0&&(i=p.length+i),u<0&&(u=p[i].length+u),fi.point(p[i][u],c,t);case"MultiPolygon":return i<0&&(i=p.length+i),s<0&&(s=p[i].length+s),u<0&&(u=p[i][s].length-u),fi.point(p[i][s][u],c,t)}throw new Error("geojson is invalid")}Mr.coordAll=gZ;Mr.coordEach=Cf;Mr.coordReduce=hZ;Mr.featureEach=pR;Mr.featureReduce=dZ;Mr.findPoint=EZ;Mr.findSegment=xZ;Mr.flattenEach=Ld;Mr.flattenReduce=yZ;Mr.geomEach=B_;Mr.geomReduce=mZ;Mr.lineEach=gR;Mr.lineReduce=_Z;Mr.propEach=hR;Mr.propReduce=pZ;Mr.segmentEach=dR;Mr.segmentReduce=vZ});var mR=X(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var SZ=z_();function G_(n){var t=[1/0,1/0,-1/0,-1/0];return SZ.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}G_.default=G_;k_.default=G_});var Nd=X((rct,q_)=>{var ns=p_(),vR=U_(),_R=z_(),Wl=mR().default,wZ=_R.featureEach,ect=_R.coordEach,nct=vR.polygon,yR=vR.featureCollection;function xR(n){var t=new ns(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Wl(e),ns.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Wl(s),i.push(s)}):wZ(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Wl(s),i.push(s)}),ns.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Wl(e),ns.prototype.remove.call(this,e,i)},t.clear=function(){return ns.prototype.clear.call(this)},t.search=function(e){var i=ns.prototype.search.call(this,this.toBBox(e));return yR(i)},t.collides=function(e){return ns.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ns.prototype.all.call(this);return yR(e)},t.toJSON=function(){return ns.prototype.toJSON.call(this)},t.fromJSON=function(e){return ns.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=Wl(e);else if(e.type==="FeatureCollection")i=Wl(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}q_.exports=xR;q_.exports.default=xR});var $_=X((hht,PR)=>{"use strict";var IR=Object.prototype.toString;PR.exports=function(t){var e=IR.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&IR.call(t.callee)==="[object Function]"),i}});var zR=X((pht,BR)=>{"use strict";var UR;Object.keys||(Rf=Object.prototype.hasOwnProperty,Z_=Object.prototype.toString,RR=$_(),J_=Object.prototype.propertyIsEnumerable,LR=!J_.call({toString:null},"toString"),NR=J_.call(function(){},"prototype"),Lf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ud=function(n){var t=n.constructor;return t&&t.prototype===n},OR={$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},DR=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!OR["$"+n]&&Rf.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{Ud(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),FR=function(n){if(typeof window=="undefined"||!DR)return Ud(n);try{return Ud(n)}catch(t){return!1}},UR=function(t){var e=t!==null&&typeof t=="object",i=Z_.call(t)==="[object Function]",s=RR(t),u=e&&Z_.call(t)==="[object String]",c=[];if(!e&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var f=NR&&i;if(u&&t.length>0&&!Rf.call(t,0))for(var p=0;p<t.length;++p)c.push(String(p));if(s&&t.length>0)for(var d=0;d<t.length;++d)c.push(String(d));else for(var g in t)!(f&&g==="prototype")&&Rf.call(t,g)&&c.push(String(g));if(LR)for(var y=FR(t),v=0;v<Lf.length;++v)!(y&&Lf[v]==="constructor")&&Rf.call(t,Lf[v])&&c.push(Lf[v]);return c});var Rf,Z_,RR,J_,LR,NR,Lf,Ud,OR,DR,FR;BR.exports=UR});var j_=X((dht,qR)=>{"use strict";var NZ=Array.prototype.slice,OZ=$_(),GR=Object.keys,Bd=GR?function(t){return GR(t)}:zR(),kR=Object.keys;Bd.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(i){return OZ(i)?kR(NZ.call(i)):kR(i)})}else Object.keys=Bd;return Object.keys||Bd};qR.exports=Bd});var K_=X((ght,VR)=>{"use strict";VR.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var u 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 f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==s||f.enumerable!==!0)return!1}return!0}});var zd=X((mht,HR)=>{"use strict";var DZ=K_();HR.exports=function(){return DZ()&&!!Symbol.toStringTag}});var Q_=X((yht,WR)=>{"use strict";WR.exports=Object});var tx=X((vht,XR)=>{"use strict";XR.exports=Error});var $R=X((_ht,YR)=>{"use strict";YR.exports=EvalError});var JR=X((xht,ZR)=>{"use strict";ZR.exports=RangeError});var KR=X((Eht,jR)=>{"use strict";jR.exports=ReferenceError});var ex=X((Sht,QR)=>{"use strict";QR.exports=SyntaxError});var mu=X((wht,tL)=>{"use strict";tL.exports=TypeError});var nL=X((Mht,eL)=>{"use strict";eL.exports=URIError});var iL=X((bht,rL)=>{"use strict";rL.exports=Math.abs});var sL=X((Aht,oL)=>{"use strict";oL.exports=Math.floor});var uL=X((Tht,aL)=>{"use strict";aL.exports=Math.max});var cL=X((Cht,lL)=>{"use strict";lL.exports=Math.min});var hL=X((Iht,fL)=>{"use strict";fL.exports=Math.pow});var dL=X((Pht,pL)=>{"use strict";pL.exports=Math.round});var mL=X((Rht,gL)=>{"use strict";gL.exports=Number.isNaN||function(t){return t!==t}});var vL=X((Lht,yL)=>{"use strict";var FZ=mL();yL.exports=function(t){return FZ(t)||t===0?t:t<0?-1:1}});var xL=X((Nht,_L)=>{"use strict";_L.exports=Object.getOwnPropertyDescriptor});var yu=X((Oht,EL)=>{"use strict";var Gd=xL();if(Gd)try{Gd([],"length")}catch(n){Gd=null}EL.exports=Gd});var Nf=X((Dht,SL)=>{"use strict";var kd=Object.defineProperty||!1;if(kd)try{kd({},"a",{value:1})}catch(n){kd=!1}SL.exports=kd});var bL=X((Fht,ML)=>{"use strict";var wL=typeof Symbol!="undefined"&&Symbol,UZ=K_();ML.exports=function(){return typeof wL!="function"||typeof Symbol!="function"||typeof wL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:UZ()}});var nx=X((Uht,AL)=>{"use strict";AL.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var rx=X((Bht,TL)=>{"use strict";var BZ=Q_();TL.exports=BZ.getPrototypeOf||null});var PL=X((zht,IL)=>{"use strict";var zZ="Function.prototype.bind called on incompatible ",GZ=Object.prototype.toString,kZ=Math.max,qZ="[object Function]",CL=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var u=0;u<e.length;u+=1)i[u+t.length]=e[u];return i},VZ=function(t,e){for(var i=[],s=e||0,u=0;s<t.length;s+=1,u+=1)i[u]=t[s];return i},HZ=function(n,t){for(var e="",i=0;i<n.length;i+=1)e+=n[i],i+1<n.length&&(e+=t);return e};IL.exports=function(t){var e=this;if(typeof e!="function"||GZ.apply(e)!==qZ)throw new TypeError(zZ+e);for(var i=VZ(arguments,1),s,u=function(){if(this instanceof s){var g=e.apply(this,CL(i,arguments));return Object(g)===g?g:this}return e.apply(t,CL(i,arguments))},c=kZ(0,e.length-i.length),f=[],p=0;p<c;p++)f[p]="$"+p;if(s=Function("binder","return function ("+HZ(f,",")+"){ return binder.apply(this,arguments); }")(u),e.prototype){var d=function(){};d.prototype=e.prototype,s.prototype=new d,d.prototype=null}return s}});var Xl=X((Ght,RL)=>{"use strict";var WZ=PL();RL.exports=Function.prototype.bind||WZ});var qd=X((kht,LL)=>{"use strict";LL.exports=Function.prototype.call});var Vd=X((qht,NL)=>{"use strict";NL.exports=Function.prototype.apply});var DL=X((Vht,OL)=>{"use strict";OL.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var ix=X((Hht,FL)=>{"use strict";var XZ=Xl(),YZ=Vd(),$Z=qd(),ZZ=DL();FL.exports=ZZ||XZ.call($Z,YZ)});var Hd=X((Wht,UL)=>{"use strict";var JZ=Xl(),jZ=mu(),KZ=qd(),QZ=ix();UL.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new jZ("a function is required");return QZ(JZ,KZ,t)}});var VL=X((Xht,qL)=>{"use strict";var tJ=Hd(),BL=yu(),GL;try{GL=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var ox=!!GL&&BL&&BL(Object.prototype,"__proto__"),kL=Object,zL=kL.getPrototypeOf;qL.exports=ox&&typeof ox.get=="function"?tJ([ox.get]):typeof zL=="function"?function(t){return zL(t==null?t:kL(t))}:!1});var sx=X((Yht,YL)=>{"use strict";var HL=nx(),WL=rx(),XL=VL();YL.exports=HL?function(t){return HL(t)}:WL?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return WL(t)}:XL?function(t){return XL(t)}:null});var ax=X(($ht,$L)=>{"use strict";var eJ=Function.prototype.call,nJ=Object.prototype.hasOwnProperty,rJ=Xl();$L.exports=rJ.call(eJ,nJ)});var cx=X((Zht,tN)=>{"use strict";var tn,iJ=Q_(),oJ=tx(),sJ=$R(),aJ=JR(),uJ=KR(),Jl=ex(),Zl=mu(),lJ=nL(),cJ=iL(),fJ=sL(),hJ=uL(),pJ=cL(),dJ=hL(),gJ=dL(),mJ=vL(),KL=Function,ux=function(n){try{return KL('"use strict"; return ('+n+").constructor;")()}catch(t){}},Of=yu(),yJ=Nf(),lx=function(){throw new Zl},vJ=Of?function(){try{return arguments.callee,lx}catch(n){try{return Of(arguments,"callee").get}catch(t){return lx}}}():lx,Yl=bL()(),Gr=sx(),_J=rx(),xJ=nx(),QL=Vd(),Df=qd(),$l={},EJ=typeof Uint8Array=="undefined"||!Gr?tn:Gr(Uint8Array),vu={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":Yl&&Gr?Gr([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":$l,"%AsyncGenerator%":$l,"%AsyncGeneratorFunction%":$l,"%AsyncIteratorPrototype%":$l,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":oJ,"%eval%":eval,"%EvalError%":sJ,"%Float16Array%":typeof Float16Array=="undefined"?tn:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":KL,"%GeneratorFunction%":$l,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Yl&&Gr?Gr(Gr([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Yl||!Gr?tn:Gr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":iJ,"%Object.getOwnPropertyDescriptor%":Of,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":aJ,"%ReferenceError%":uJ,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Yl||!Gr?tn:Gr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Yl&&Gr?Gr(""[Symbol.iterator]()):tn,"%Symbol%":Yl?Symbol:tn,"%SyntaxError%":Jl,"%ThrowTypeError%":vJ,"%TypedArray%":EJ,"%TypeError%":Zl,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":lJ,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet,"%Function.prototype.call%":Df,"%Function.prototype.apply%":QL,"%Object.defineProperty%":yJ,"%Object.getPrototypeOf%":_J,"%Math.abs%":cJ,"%Math.floor%":fJ,"%Math.max%":hJ,"%Math.min%":pJ,"%Math.pow%":dJ,"%Math.round%":gJ,"%Math.sign%":mJ,"%Reflect.getPrototypeOf%":xJ};if(Gr)try{null.error}catch(n){ZL=Gr(Gr(n)),vu["%Error.prototype%"]=ZL}var ZL,SJ=function n(t){var e;if(t==="%AsyncFunction%")e=ux("async function () {}");else if(t==="%GeneratorFunction%")e=ux("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ux("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&Gr&&(e=Gr(s.prototype))}return vu[t]=e,e},JL={__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"]},Ff=Xl(),Wd=ax(),wJ=Ff.call(Df,Array.prototype.concat),MJ=Ff.call(QL,Array.prototype.splice),jL=Ff.call(Df,String.prototype.replace),Xd=Ff.call(Df,String.prototype.slice),bJ=Ff.call(Df,RegExp.prototype.exec),AJ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,TJ=/\\(\\)?/g,CJ=function(t){var e=Xd(t,0,1),i=Xd(t,-1);if(e==="%"&&i!=="%")throw new Jl("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Jl("invalid intrinsic syntax, expected opening `%`");var s=[];return jL(t,AJ,function(u,c,f,p){s[s.length]=f?jL(p,TJ,"$1"):c||u}),s},IJ=function(t,e){var i=t,s;if(Wd(JL,i)&&(s=JL[i],i="%"+s[0]+"%"),Wd(vu,i)){var u=vu[i];if(u===$l&&(u=SJ(i)),typeof u=="undefined"&&!e)throw new Zl("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:u}}throw new Jl("intrinsic "+t+" does not exist!")};tN.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Zl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Zl('"allowMissing" argument must be a boolean');if(bJ(/^%?[^%]*%?$/,t)===null)throw new Jl("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=CJ(t),s=i.length>0?i[0]:"",u=IJ("%"+s+"%",e),c=u.name,f=u.value,p=!1,d=u.alias;d&&(s=d[0],MJ(i,wJ([0,1],d)));for(var g=1,y=!0;g<i.length;g+=1){var v=i[g],E=Xd(v,0,1),M=Xd(v,-1);if((E==='"'||E==="'"||E==="`"||M==='"'||M==="'"||M==="`")&&E!==M)throw new Jl("property names with quotes must have matching quotes");if((v==="constructor"||!y)&&(p=!0),s+="."+v,c="%"+s+"%",Wd(vu,c))f=vu[c];else if(f!=null){if(!(v in f)){if(!e)throw new Zl("base intrinsic for "+t+" exists, but the property is not available.");return}if(Of&&g+1>=i.length){var A=Of(f,v);y=!!A,y&&"get"in A&&!("originalValue"in A.get)?f=A.get:f=f[v]}else y=Wd(f,v),f=f[v];y&&!p&&(vu[c]=f)}}return f}});var Yd=X((Jht,rN)=>{"use strict";var eN=cx(),nN=Hd(),PJ=nN([eN("%String.prototype.indexOf%")]);rN.exports=function(t,e){var i=eN(t,!!e);return typeof i=="function"&&PJ(t,".prototype.")>-1?nN([i]):i}});var sN=X((jht,oN)=>{"use strict";var RJ=zd()(),LJ=Yd(),fx=LJ("Object.prototype.toString"),$d=function(t){return RJ&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:fx(t)==="[object Arguments]"},iN=function(t){return $d(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&fx(t)!=="[object Array]"&&"callee"in t&&fx(t.callee)==="[object Function]"},NJ=function(){return $d(arguments)}();$d.isLegacyArguments=iN;oN.exports=NJ?$d:iN});var Zd=X((Kht,lN)=>{"use strict";var aN=Nf(),OJ=ex(),jl=mu(),uN=yu();lN.exports=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new jl("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new jl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new jl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new jl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new jl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new jl("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!uN&&uN(t,e);if(aN)aN(t,e,{configurable:c===null&&p?p.configurable:!c,enumerable:s===null&&p?p.enumerable:!s,value:i,writable:u===null&&p?p.writable:!u});else if(f||!s&&!u&&!c)t[e]=i;else throw new OJ("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Jd=X((Qht,fN)=>{"use strict";var hx=Nf(),cN=function(){return!!hx};cN.hasArrayLengthDefineBug=function(){if(!hx)return null;try{return hx([],"length",{value:1}).length!==1}catch(t){return!0}};fN.exports=cN});var Kl=X((tpt,gN)=>{"use strict";var DJ=j_(),FJ=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",UJ=Object.prototype.toString,BJ=Array.prototype.concat,hN=Zd(),zJ=function(n){return typeof n=="function"&&UJ.call(n)==="[object Function]"},pN=Jd()(),GJ=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!zJ(i)||!i())return}pN?hN(n,t,e,!0):hN(n,t,e)},dN=function(n,t){var e=arguments.length>2?arguments[2]:{},i=DJ(t);FJ&&(i=BJ.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s<i.length;s+=1)GJ(n,i[s],t[i[s]],e[i[s]])};dN.supportsDescriptors=!!pN;gN.exports=dN});var xN=X((ept,_N)=>{"use strict";var kJ=cx(),mN=Zd(),qJ=Jd()(),yN=yu(),vN=mu(),VJ=kJ("%Math.floor%");_N.exports=function(t,e){if(typeof t!="function")throw new vN("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||VJ(e)!==e)throw new vN("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in t&&yN){var c=yN(t,"length");c&&!c.configurable&&(s=!1),c&&!c.writable&&(u=!1)}return(s||u||!i)&&(qJ?mN(t,"length",e,!0,!0):mN(t,"length",e)),t}});var SN=X((npt,EN)=>{"use strict";var HJ=Xl(),WJ=Vd(),XJ=ix();EN.exports=function(){return XJ(HJ,WJ,arguments)}});var px=X((rpt,jd)=>{"use strict";var YJ=xN(),wN=Nf(),$J=Hd(),MN=SN();jd.exports=function(t){var e=$J(arguments),i=t.length-(arguments.length-1);return YJ(e,1+(i>0?i:0),!0)};wN?wN(jd.exports,"apply",{value:MN}):jd.exports.apply=MN});var dx=X((ipt,AN)=>{"use strict";var bN=function(n){return n!==n};AN.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||bN(t)&&bN(e))}});var gx=X((opt,TN)=>{"use strict";var ZJ=dx();TN.exports=function(){return typeof Object.is=="function"?Object.is:ZJ}});var IN=X((spt,CN)=>{"use strict";var JJ=gx(),jJ=Kl();CN.exports=function(){var t=JJ();return jJ(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var NN=X((apt,LN)=>{"use strict";var KJ=Kl(),QJ=px(),tj=dx(),PN=gx(),ej=IN(),RN=QJ(PN(),Object);KJ(RN,{getPolyfill:PN,implementation:tj,shim:ej});LN.exports=RN});var zN=X((upt,BN)=>{"use strict";var ON=Yd(),nj=zd()(),rj=ax(),ij=yu(),vx;nj?(DN=ON("RegExp.prototype.exec"),mx={},Kd=function(){throw mx},yx={toString:Kd,valueOf:Kd},typeof Symbol.toPrimitive=="symbol"&&(yx[Symbol.toPrimitive]=Kd),vx=function(t){if(!t||typeof t!="object")return!1;var e=ij(t,"lastIndex"),i=e&&rj(e,"value");if(!i)return!1;try{DN(t,yx)}catch(s){return s===mx}}):(FN=ON("Object.prototype.toString"),UN="[object RegExp]",vx=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:FN(t)===UN});var DN,mx,Kd,yx,FN,UN;BN.exports=vx});var kN=X((lpt,GN)=>{"use strict";var Bf=function(){return typeof function(){}.name=="string"},Uf=Object.getOwnPropertyDescriptor;if(Uf)try{Uf([],"length")}catch(n){Uf=null}Bf.functionsHaveConfigurableNames=function(){if(!Bf()||!Uf)return!1;var t=Uf(function(){},"name");return!!t&&!!t.configurable};var oj=Function.prototype.bind;Bf.boundFunctionsHaveNames=function(){return Bf()&&typeof oj=="function"&&function(){}.bind().name!==""};GN.exports=Bf});var HN=X((cpt,VN)=>{"use strict";var qN=Zd(),sj=Jd()(),aj=kN().functionsHaveConfigurableNames(),uj=mu();VN.exports=function(t,e){if(typeof t!="function")throw new uj("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||aj)&&(sj?qN(t,"name",e,!0,!0):qN(t,"name",e)),t}});var _x=X((fpt,WN)=>{"use strict";var lj=HN(),cj=mu(),fj=Object;WN.exports=lj(function(){if(this==null||this!==fj(this))throw new cj("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 xx=X((hpt,XN)=>{"use strict";var hj=_x(),pj=Kl().supportsDescriptors,dj=Object.getOwnPropertyDescriptor;XN.exports=function(){if(pj&&/a/mig.flags==="gim"){var t=dj(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),t.get.call(i),e==="dy")return t.get}}return hj}});var ZN=X((ppt,$N)=>{"use strict";var gj=Kl().supportsDescriptors,mj=xx(),yj=yu(),vj=Object.defineProperty,_j=tx(),YN=sx(),xj=/a/;$N.exports=function(){if(!gj||!YN)throw new _j("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=mj(),e=YN(xj),i=yj(e,"flags");return(!i||i.get!==t)&&vj(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var QN=X((dpt,KN)=>{"use strict";var Ej=Kl(),Sj=px(),wj=_x(),JN=xx(),Mj=ZN(),jN=Sj(JN());Ej(jN,{getPolyfill:JN,implementation:wj,shim:Mj});KN.exports=jN});var n2=X((gpt,e2)=>{"use strict";var t2=Yd(),bj=t2("Date.prototype.getDay"),Aj=function(t){try{return bj(t),!0}catch(e){return!1}},Tj=t2("Object.prototype.toString"),Cj="[object Date]",Ij=zd()();e2.exports=function(t){return typeof t!="object"||t===null?!1:Ij?Aj(t):Tj(t)===Cj}});var Ex=X((mpt,p2)=>{var r2=j_(),i2=sN(),o2=NN(),s2=zN(),a2=QN(),u2=n2(),l2=Date.prototype.getTime;function h2(n,t,e){var i=e||{};return(i.strict?o2(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?i.strict?o2(n,t):n==t:Pj(n,t,i)}function c2(n){return n==null}function f2(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 Pj(n,t,e){var i,s;if(typeof n!=typeof t||c2(n)||c2(t)||n.prototype!==t.prototype||i2(n)!==i2(t))return!1;var u=s2(n),c=s2(t);if(u!==c)return!1;if(u||c)return n.source===t.source&&a2(n)===a2(t);if(u2(n)&&u2(t))return l2.call(n)===l2.call(t);var f=f2(n),p=f2(t);if(f!==p)return!1;if(f||p){if(n.length!==t.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==t[i])return!1;return!0}if(typeof n!=typeof t)return!1;try{var d=r2(n),g=r2(t)}catch(y){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),i=d.length-1;i>=0;i--)if(d[i]!=g[i])return!1;for(i=d.length-1;i>=0;i--)if(s=d[i],!h2(n[s],t[s],e))return!1;return!0}p2.exports=h2});var Nx=X((Sgt,x2)=>{var xK=Ex(),rs=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:EK};rs.prototype.compare=function(n,t){if(n.type!==t.type||!_2(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,i=v2(n),s=v2(t);return i.every(function(u){return this.some(function(c){return e.compare(u,c)})},s)}}return!1};function v2(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function _2(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}rs.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};rs.prototype.compareLine=function(n,t,e,i){if(!_2(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),u=this.pseudoNode?t:this.removePseudo(t);if(!(i&&!this.compareCoord(s[0],u[0])&&(u=this.fixStartIndex(u,s),!u))){var c=this.compareCoord(s[e],u[e]);return this.direction||c?this.comparePath(s,u):this.compareCoord(s[e],u[u.length-(1+e)])?this.comparePath(s.slice().reverse(),u):!1}};rs.prototype.fixStartIndex=function(n,t){for(var e,i=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){i=s;break}return i>=0&&(e=[].concat(n.slice(i,n.length),n.slice(1,i+1))),e};rs.prototype.comparePath=function(n,t){var e=this;return n.every(function(i,s){return e.compareCoord(i,this[s])},t)};rs.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),i=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(u){return this.some(function(c){return s.compareLine(u,c,1,!0)})},i)}else return!1};rs.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)};rs.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};rs.prototype.removePseudo=function(n){return n};function EK(n,t){return xK(n,t,{strict:!0})}x2.exports=rs});var E2=X((Ogt,eg)=>{function Ma(n,t,e,i){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,i)}Ma.prototype.run=function(n,t,e,i){this._init(n,t,e,i);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var u=this._regionQuery(s);if(u.length<this.minPts)this.noise.push(s);else{var c=this.clusters.length;this.clusters.push([]),this._addToCluster(s,c),this._expandCluster(c,u)}}return this.clusters};Ma.prototype._init=function(n,t,e,i){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),i&&(this.distance=i)};Ma.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var i=t[e];if(this._visited[i]!==1){this._visited[i]=1;var s=this._regionQuery(i);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[i]!==1&&this._addToCluster(i,n)}};Ma.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};Ma.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var i=this.distance(this.dataset[n],this.dataset[e]);i<this.epsilon&&t.push(e)}return t};Ma.prototype._mergeArrays=function(n,t){for(var e=t.length,i=0;i<e;i++){var s=t[i];n.indexOf(s)<0&&n.push(s)}return n};Ma.prototype._euclideanDistance=function(n,t){for(var e=0,i=Math.min(n.length,t.length);i--;)e+=(n[i]-t[i])*(n[i]-t[i]);return Math.sqrt(e)};typeof eg!="undefined"&&eg.exports&&(eg.exports=Ma)});var S2=X((Dgt,ng)=>{function ba(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}ba.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)};ba.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,i=0;i<this.k;i++)this.centroids[i]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var u=0;u<this.k;u++){for(var c=new Array(g),f=0,p=0;p<g;p++)c[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(u===this.assignments[d]){for(var p=0;p<g;p++)c[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)c[p]/=f;this.centroids[u]=c}else this.centroids[u]=this.randomCentroid(),s=!0}}return this.getClusters()};ba.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};ba.prototype.assign=function(){for(var n=!1,t=this.dataset.length,e,i=0;i<t;i++)e=this.argmin(this.dataset[i],this.centroids,this.distance),e!=this.assignments[i]&&(this.assignments[i]=e,n=!0);return n};ba.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};ba.prototype.argmin=function(n,t,e){for(var i=Number.MAX_VALUE,s=0,u=t.length,c,f=0;f<u;f++)c=e(n,t[f]),c<i&&(i=c,s=f);return s};ba.prototype.distance=function(n,t){for(var e=0,i=Math.min(n.length,t.length);i--;){var s=n[i]-t[i];e+=s*s}return Math.sqrt(e)};typeof ng!="undefined"&&ng.exports&&(ng.exports=ba)});var Ox=X((Fgt,rg)=>{function is(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}is.prototype.insert=function(n,t){for(var e=this._queue.length,i=e;i--;){var s=this._priorities[i];this._sorting==="desc"?t>s&&(e=i):t<s&&(e=i)}this._insertAt(n,t,e)};is.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}}};is.prototype.forEach=function(n){this._queue.forEach(n)};is.prototype.getElements=function(){return this._queue};is.prototype.getElementPriority=function(n){return this._priorities[n]};is.prototype.getPriorities=function(){return this._priorities};is.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};is.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 i=0;i<n.length;i++)this.insert(n[i],t[i])}e&&(this._sorting=e)};is.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 rg!="undefined"&&rg.exports&&(rg.exports=is)});var M2=X((Ugt,tc)=>{typeof tc!="undefined"&&tc.exports&&(w2=Ox());var w2;function Bs(n,t,e,i){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,i)}Bs.prototype.run=function(n,t,e,i){this._init(n,t,e,i);for(var s=0,u=this.dataset.length;s<u;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var c=this.clusters.length-1;this._orderedList.push(s);var f=new w2(null,null,"asc"),p=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,p,f),this._expandCluster(c,f))}return this.clusters};Bs.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var i=this._orderedList[t],s=this._reachability[i];n.push([i,s])}return n};Bs.prototype._init=function(n,t,e,i){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),i&&(this.distance=i)};Bs.prototype._updateQueue=function(n,t,e){var i=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(i._processed[s]===void 0){var u=i.distance(i.dataset[n],i.dataset[s]),c=Math.max(i._coreDistance,u);i._reachability[s]===void 0?(i._reachability[s]=c,e.insert(s,c)):c<i._reachability[s]&&(i._reachability[s]=c,e.remove(s),e.insert(s,c))}})};Bs.prototype._expandCluster=function(n,t){for(var e=t.getElements(),i=0,s=e.length;i<s;i++){var u=e[i];if(this._processed[u]===void 0){var c=this._regionQuery(u);this._processed[u]=1,this.clusters[n].push(u),this._orderedList.push(u),this._distanceToCore(u)!==void 0&&(this._updateQueue(u,c,t),this._expandCluster(n,t))}}};Bs.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var i=this._regionQuery(n,e);if(i.length>=this.minPts)return e}};Bs.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],i=0,s=this.dataset.length;i<s;i++)this.distance(this.dataset[n],this.dataset[i])<t&&e.push(i);return e};Bs.prototype._euclideanDistance=function(n,t){for(var e=0,i=Math.min(n.length,t.length);i--;)e+=(n[i]-t[i])*(n[i]-t[i]);return Math.sqrt(e)};typeof tc!="undefined"&&tc.exports&&(tc.exports=Bs)});var b2=X((Bgt,ig)=>{typeof ig!="undefined"&&ig.exports&&(ig.exports={DBSCAN:E2(),KMEANS:S2(),OPTICS:M2(),PriorityQueue:Ox()})});var Dx=X((Hgt,T2)=>{"use strict";T2.exports={eudist:function(t,e,i){for(var s=t.length,u=0,c=0;c<s;c++){var f=(t[c]||0)-(e[c]||0);u+=f*f}return i?Math.sqrt(u):u},mandist:function(t,e,i){for(var s=t.length,u=0,c=0;c<s;c++)u+=Math.abs((t[c]||0)-(e[c]||0));return i?Math.sqrt(u):u},dist:function(t,e,i){var s=Math.abs(t-e);return i?s:s*s}}});var P2=X((Wgt,I2)=>{"use strict";var C2=Dx(),TK=C2.eudist,CK=C2.dist;I2.exports={kmrand:function(t,e){for(var i={},s=[],u=e<<2,c=t.length,f=t[0].length>0;s.length<e&&u-- >0;){var p=t[Math.floor(Math.random()*c)],d=f?p.join("_"):""+p;i[d]||(i[d]=!0,s.push(p))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var i=t[0].length?TK:CK,s=[],u=t.length,c=t[0].length>0,f={},p=t[Math.floor(Math.random()*u)],d=c?p.join("_"):""+p;for(s.push(p),f[d]=!0;s.length<e;){for(var g=[],y=s.length,v=0,E=[],M=0;M<u;M++){for(var A=1/0,_=0;_<y;_++){var x=i(t[M],s[_]);x<=A&&(A=x)}g[M]=A}for(var T=0;T<u;T++)v+=g[T];for(var w=0;w<u;w++)E[w]={i:w,v:t[w],pr:g[w]/v,cs:0};E.sort(function(D,P){return D.pr-P.pr}),E[0].cs=E[0].pr;for(var R=1;R<u;R++)E[R].cs=E[R-1].cs+E[R].pr;for(var B=Math.random(),U=0;U<u-1&&E[U++].cs<B;);s.push(E[U-1].v)}return s}}});var D2=X(($gt,O2)=>{"use strict";var Fx=Dx(),N2=P2(),IK=Fx.eudist,Xgt=Fx.mandist,Ygt=Fx.dist,PK=N2.kmrand,RK=N2.kmpp,R2=1e4;function L2(n,t,e){e=e||[];for(var i=0;i<n;i++)e[i]=t;return e}function LK(n,t,e,i){var s=[],u=[],c=[],f=[],p=!1,d=i||R2,g=n.length,y=n[0].length,v=y>0,E=[];if(e)e=="kmrand"?s=PK(n,t):e=="kmpp"?s=RK(n,t):s=e;else for(var M={};s.length<t;){var A=Math.floor(Math.random()*g);M[A]||(M[A]=!0,s.push(n[A]))}do{L2(t,0,E);for(var _=0;_<g;_++){for(var x=1/0,T=0,w=0;w<t;w++){var f=v?IK(n[_],s[w]):Math.abs(n[_]-s[w]);f<=x&&(x=f,T=w)}c[_]=T,E[T]++}for(var R=[],u=[],B=0,U=0;U<t;U++)R[U]=v?L2(y,0,R[U]):0,u[U]=s[U];if(v){for(var D=0;D<t;D++)s[D]=[];for(var P=0;P<g;P++)for(var ct=c[P],L=R[ct],W=n[P],V=0;V<y;V++)L[V]+=W[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var $=s[Mt],gt=R[Mt],ft=u[Mt],vt=E[Mt],it=0;it<y;it++)$[it]=gt[it]/vt||0;if(p){for(var lt=0;lt<y;lt++)if(ft[lt]!=$[lt]){p=!1;break}}}}else{for(var H=0;H<g;H++){var At=c[H];R[At]+=n[H]}for(var It=0;It<t;It++)s[It]=R[It]/E[It]||0;p=!0;for(var Kt=0;Kt<t;Kt++)if(u[Kt]!=s[Kt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:R2-d,k:t,idxs:c,centroids:s}}O2.exports=LK});var oc=X((qx,Vx)=>{(function(n,t){typeof qx=="object"&&typeof Vx!="undefined"?Vx.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(qx,function(){"use strict";function n(j,b){var I={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},F,k,G,rt;return rt={next:tt(0),throw:tt(1),return:tt(2)},typeof Symbol=="function"&&(rt[Symbol.iterator]=function(){return this}),rt;function tt(ht){return function(O){return pt([ht,O])}}function pt(ht){if(F)throw new TypeError("Generator is already executing.");for(;I;)try{if(F=1,k&&(G=ht[0]&2?k.return:ht[0]?k.throw||((G=k.return)&&G.call(k),0):k.next)&&!(G=G.call(k,ht[1])).done)return G;switch(k=0,G&&(ht=[ht[0]&2,G.value]),ht[0]){case 0:case 1:G=ht;break;case 4:return I.label++,{value:ht[1],done:!1};case 5:I.label++,k=ht[1],ht=[0];continue;case 7:ht=I.ops.pop(),I.trys.pop();continue;default:if(G=I.trys,!(G=G.length>0&&G[G.length-1])&&(ht[0]===6||ht[0]===2)){I=0;continue}if(ht[0]===3&&(!G||ht[1]>G[0]&&ht[1]<G[3])){I.label=ht[1];break}if(ht[0]===6&&I.label<G[1]){I.label=G[1],G=ht;break}if(G&&I.label<G[2]){I.label=G[2],I.ops.push(ht);break}G[2]&&I.ops.pop(),I.trys.pop();continue}ht=b.call(j,I)}catch(O){ht=[6,O],k=0}finally{F=G=0}if(ht[0]&5)throw ht[1];return{value:ht[0]?ht[1]:void 0,done:!0}}}var t=function(){function j(b,I){this.next=null,this.key=b,this.data=I,this.left=null,this.right=null}return j}();function e(j,b){return j>b?1:j<b?-1:0}function i(j,b,I){for(var F=new t(null,null),k=F,G=F;;){var rt=I(j,b.key);if(rt<0){if(b.left===null)break;if(I(j,b.left.key)<0){var tt=b.left;if(b.left=tt.right,tt.right=b,b=tt,b.left===null)break}G.left=b,G=b,b=b.left}else if(rt>0){if(b.right===null)break;if(I(j,b.right.key)>0){var tt=b.right;if(b.right=tt.left,tt.left=b,b=tt,b.right===null)break}k.right=b,k=b,b=b.right}else break}return k.right=b.left,G.left=b.right,b.left=F.right,b.right=F.left,b}function s(j,b,I,F){var k=new t(j,b);if(I===null)return k.left=k.right=null,k;I=i(j,I,F);var G=F(j,I.key);return G<0?(k.left=I.left,k.right=I,I.left=null):G>=0&&(k.right=I.right,k.left=I,I.right=null),k}function u(j,b,I){var F=null,k=null;if(b){b=i(j,b,I);var G=I(b.key,j);G===0?(F=b.left,k=b.right):G<0?(k=b.right,b.right=null,F=b):(F=b.left,b.left=null,k=b)}return{left:F,right:k}}function c(j,b,I){return b===null?j:(j===null||(b=i(j.key,b,I),b.left=j),b)}function f(j,b,I,F,k){if(j){F(""+b+(I?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+k(j)+`
3
+ `)&&(_="(?: "+_+")",T=" "+T,x++),f=new RegExp("^(?:"+_+")",A)),s_&&(f=new RegExp("^"+_+"$(?!\\s)",A)),o_&&(p=e.lastIndex),d=Ul(pd,M?f:e,T),M?d?(d.input=r_(d.input,x),d[0]=r_(d[0],x),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:o_&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),s_&&d&&d.length>1&&Ul(WY,d[0],f,function(){for(g=1;g<arguments.length-2;g++)arguments[g]===void 0&&(d[g]=void 0)}),d&&E)for(d.groups=y=kY(null),g=0;g<E.length;g++)v=E[g],y[v[0]]=d[v[1]];return d});bP.exports=i_});var a_=X(()=>{"use strict";var JY=sr(),AP=gd();JY({target:"RegExp",proto:!0,forced:/./.exec!==AP},{exec:AP})});var md=X((Yot,IP)=>{"use strict";var CP=Object.getOwnPropertySymbols,t$=Object.prototype.hasOwnProperty,e$=Object.prototype.propertyIsEnumerable;function n$(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function r$(){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 i=Object.getOwnPropertyNames(t).map(function(u){return t[u]});if(i.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(u){s[u]=u}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(u){return!1}}IP.exports=r$()?Object.assign:function(n,t){for(var e,i=n$(n),s,u=1;u<arguments.length;u++){e=Object(arguments[u]);for(var c in e)t$.call(e,c)&&(i[c]=e[c]);if(CP){s=CP(e);for(var f=0;f<s.length;f++)e$.call(e,s[f])&&(i[s[f]]=e[s[f]])}}return i}});var p_=X((f_,h_)=>{(function(n,t){typeof f_=="object"&&typeof h_!="undefined"?h_.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(f_,function(){"use strict";function n(_,x,T,w,R){(function B(U,D,P,ct,L){for(;ct>P;){if(ct-P>600){var W=ct-P+1,V=D-P+1,Mt=Math.log(W),$=.5*Math.exp(2*Mt/3),gt=.5*Math.sqrt(Mt*$*(W-$)/W)*(V-W/2<0?-1:1),ft=Math.max(P,Math.floor(D-V*$/W+gt)),vt=Math.min(ct,Math.floor(D+(W-V)*$/W+gt));B(U,D,ft,vt,L)}var it=U[D],lt=P,H=ct;for(t(U,P,D),L(U[ct],it)>0&&t(U,P,ct);lt<H;){for(t(U,lt,H),lt++,H--;L(U[lt],it)<0;)lt++;for(;L(U[H],it)>0;)H--}L(U[P],it)===0?t(U,P,H):t(U,++H,ct),H<=D&&(P=H+1),D<=H&&(ct=H-1)}})(_,x,T||0,w||_.length-1,R||e)}function t(_,x,T){var w=_[x];_[x]=_[T],_[T]=w}function e(_,x){return _<x?-1:_>x?1:0}var i=function(_){_===void 0&&(_=9),this._maxEntries=Math.max(4,_),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(_,x,T){if(!T)return x.indexOf(_);for(var w=0;w<x.length;w++)if(T(_,x[w]))return w;return-1}function u(_,x){c(_,0,_.children.length,x,_)}function c(_,x,T,w,R){R||(R=M(null)),R.minX=1/0,R.minY=1/0,R.maxX=-1/0,R.maxY=-1/0;for(var B=x;B<T;B++){var U=_.children[B];f(R,_.leaf?w(U):U)}return R}function f(_,x){return _.minX=Math.min(_.minX,x.minX),_.minY=Math.min(_.minY,x.minY),_.maxX=Math.max(_.maxX,x.maxX),_.maxY=Math.max(_.maxY,x.maxY),_}function p(_,x){return _.minX-x.minX}function d(_,x){return _.minY-x.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function y(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,x){return _.minX<=x.minX&&_.minY<=x.minY&&x.maxX<=_.maxX&&x.maxY<=_.maxY}function E(_,x){return x.minX<=_.maxX&&x.minY<=_.maxY&&x.maxX>=_.minX&&x.maxY>=_.minY}function M(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function A(_,x,T,w,R){for(var B=[x,T];B.length;)if(!((T=B.pop())-(x=B.pop())<=w)){var U=x+Math.ceil((T-x)/w/2)*w;n(_,U,x,T,R),B.push(x,U,U,T)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(_){var x=this.data,T=[];if(!E(_,x))return T;for(var w=this.toBBox,R=[];x;){for(var B=0;B<x.children.length;B++){var U=x.children[B],D=x.leaf?w(U):U;E(_,D)&&(x.leaf?T.push(U):v(_,D)?this._all(U,T):R.push(U))}x=R.pop()}return T},i.prototype.collides=function(_){var x=this.data;if(!E(_,x))return!1;for(var T=[];x;){for(var w=0;w<x.children.length;w++){var R=x.children[w],B=x.leaf?this.toBBox(R):R;if(E(_,B)){if(x.leaf||v(_,B))return!0;T.push(R)}}x=T.pop()}return!1},i.prototype.load=function(_){if(!_||!_.length)return this;if(_.length<this._minEntries){for(var x=0;x<_.length;x++)this.insert(_[x]);return this}var T=this._build(_.slice(),0,_.length-1,0);if(this.data.children.length)if(this.data.height===T.height)this._splitRoot(this.data,T);else{if(this.data.height<T.height){var w=this.data;this.data=T,T=w}this._insert(T,this.data.height-T.height-1,!0)}else this.data=T;return this},i.prototype.insert=function(_){return _&&this._insert(_,this.data.height-1),this},i.prototype.clear=function(){return this.data=M([]),this},i.prototype.remove=function(_,x){if(!_)return this;for(var T,w,R,B=this.data,U=this.toBBox(_),D=[],P=[];B||D.length;){if(B||(B=D.pop(),w=D[D.length-1],T=P.pop(),R=!0),B.leaf){var ct=s(_,B.children,x);if(ct!==-1)return B.children.splice(ct,1),D.push(B),this._condense(D),this}R||B.leaf||!v(B,U)?w?(T++,B=w.children[T],R=!1):B=null:(D.push(B),P.push(T),T=0,w=B,B=B.children[0])}return this},i.prototype.toBBox=function(_){return _},i.prototype.compareMinX=function(_,x){return _.minX-x.minX},i.prototype.compareMinY=function(_,x){return _.minY-x.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(_){return this.data=_,this},i.prototype._all=function(_,x){for(var T=[];_;)_.leaf?x.push.apply(x,_.children):T.push.apply(T,_.children),_=T.pop();return x},i.prototype._build=function(_,x,T,w){var R,B=T-x+1,U=this._maxEntries;if(B<=U)return u(R=M(_.slice(x,T+1)),this.toBBox),R;w||(w=Math.ceil(Math.log(B)/Math.log(U)),U=Math.ceil(B/Math.pow(U,w-1))),(R=M([])).leaf=!1,R.height=w;var D=Math.ceil(B/U),P=D*Math.ceil(Math.sqrt(U));A(_,x,T,P,this.compareMinX);for(var ct=x;ct<=T;ct+=P){var L=Math.min(ct+P-1,T);A(_,ct,L,D,this.compareMinY);for(var W=ct;W<=L;W+=D){var V=Math.min(W+D-1,L);R.children.push(this._build(_,W,V,w-1))}}return u(R,this.toBBox),R},i.prototype._chooseSubtree=function(_,x,T,w){for(;w.push(x),!x.leaf&&w.length-1!==T;){for(var R=1/0,B=1/0,U=void 0,D=0;D<x.children.length;D++){var P=x.children[D],ct=g(P),L=(W=_,V=P,(Math.max(V.maxX,W.maxX)-Math.min(V.minX,W.minX))*(Math.max(V.maxY,W.maxY)-Math.min(V.minY,W.minY))-ct);L<B?(B=L,R=ct<R?ct:R,U=P):L===B&&ct<R&&(R=ct,U=P)}x=U||x.children[0]}var W,V;return x},i.prototype._insert=function(_,x,T){var w=T?_:this.toBBox(_),R=[],B=this._chooseSubtree(w,this.data,x,R);for(B.children.push(_),f(B,w);x>=0&&R[x].children.length>this._maxEntries;)this._split(R,x),x--;this._adjustParentBBoxes(w,R,x)},i.prototype._split=function(_,x){var T=_[x],w=T.children.length,R=this._minEntries;this._chooseSplitAxis(T,R,w);var B=this._chooseSplitIndex(T,R,w),U=M(T.children.splice(B,T.children.length-B));U.height=T.height,U.leaf=T.leaf,u(T,this.toBBox),u(U,this.toBBox),x?_[x-1].children.push(U):this._splitRoot(T,U)},i.prototype._splitRoot=function(_,x){this.data=M([_,x]),this.data.height=_.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(_,x,T){for(var w,R,B,U,D,P,ct,L=1/0,W=1/0,V=x;V<=T-x;V++){var Mt=c(_,0,V,this.toBBox),$=c(_,V,T,this.toBBox),gt=(R=Mt,B=$,U=void 0,D=void 0,P=void 0,ct=void 0,U=Math.max(R.minX,B.minX),D=Math.max(R.minY,B.minY),P=Math.min(R.maxX,B.maxX),ct=Math.min(R.maxY,B.maxY),Math.max(0,P-U)*Math.max(0,ct-D)),ft=g(Mt)+g($);gt<L?(L=gt,w=V,W=ft<W?ft:W):gt===L&&ft<W&&(W=ft,w=V)}return w||T-x},i.prototype._chooseSplitAxis=function(_,x,T){var w=_.leaf?this.compareMinX:p,R=_.leaf?this.compareMinY:d;this._allDistMargin(_,x,T,w)<this._allDistMargin(_,x,T,R)&&_.children.sort(w)},i.prototype._allDistMargin=function(_,x,T,w){_.children.sort(w);for(var R=this.toBBox,B=c(_,0,x,R),U=c(_,T-x,T,R),D=y(B)+y(U),P=x;P<T-x;P++){var ct=_.children[P];f(B,_.leaf?R(ct):ct),D+=y(B)}for(var L=T-x-1;L>=x;L--){var W=_.children[L];f(U,_.leaf?R(W):W),D+=y(U)}return D},i.prototype._adjustParentBBoxes=function(_,x,T){for(var w=T;w>=0;w--)f(x[w],_)},i.prototype._condense=function(_){for(var x=_.length-1,T=void 0;x>=0;x--)_[x].children.length===0?x>0?(T=_[x-1].children).splice(T.indexOf(_[x]),1):this.clear():u(_[x],this.toBBox)},i})});var PP=X((d_,g_)=>{(function(n,t){typeof d_=="object"&&typeof g_!="undefined"?g_.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(d_,function(){"use strict";var n=function(i,s){if(i===void 0&&(i=[]),s===void 0&&(s=t),this.data=i,this.length=this.data.length,this.compare=s,this.length>0)for(var u=(this.length>>1)-1;u>=0;u--)this._down(u)};n.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var i=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),i}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(i){for(var s=this,u=s.data,c=s.compare,f=u[i];i>0;){var p=i-1>>1,d=u[p];if(c(f,d)>=0)break;u[i]=d,i=p}u[i]=f},n.prototype._down=function(i){for(var s=this,u=s.data,c=s.compare,f=this.length>>1,p=u[i];i<f;){var d=(i<<1)+1,g=u[d],y=d+1;if(y<this.length&&c(u[y],g)<0&&(d=y,g=u[y]),c(g,p)>=0)break;u[i]=g,i=d}u[i]=p};function t(e,i){return e<i?-1:e>i?1:0}return n})});var LP=X((Qot,RP)=>{RP.exports=function(t,e,i,s){var u=t[0],c=t[1],f=!1;i===void 0&&(i=0),s===void 0&&(s=e.length);for(var p=(s-i)/2,d=0,g=p-1;d<p;g=d++){var y=e[i+d*2+0],v=e[i+d*2+1],E=e[i+g*2+0],M=e[i+g*2+1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var OP=X((tst,NP)=>{NP.exports=function(t,e,i,s){var u=t[0],c=t[1],f=!1;i===void 0&&(i=0),s===void 0&&(s=e.length);for(var p=s-i,d=0,g=p-1;d<p;g=d++){var y=e[d+i][0],v=e[d+i][1],E=e[g+i][0],M=e[g+i][1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var UP=X((est,_d)=>{var DP=LP(),FP=OP();_d.exports=function(t,e,i,s){return e.length>0&&Array.isArray(e[0])?FP(t,e,i,s):DP(t,e,i,s)};_d.exports.nested=FP;_d.exports.flat=DP});var zP=X((xd,BP)=>{(function(n,t){typeof xd=="object"&&typeof BP!="undefined"?t(xd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(xd,function(n){"use strict";let e=33306690738754706e-32;function i(E,M,A,_,x){let T,w,R,B,U=M[0],D=_[0],P=0,ct=0;D>U==D>-U?(T=U,U=M[++P]):(T=D,D=_[++ct]);let L=0;if(P<E&&ct<A)for(D>U==D>-U?(R=T-((w=U+T)-U),U=M[++P]):(R=T-((w=D+T)-D),D=_[++ct]),T=w,R!==0&&(x[L++]=R);P<E&&ct<A;)D>U==D>-U?(R=T-((w=T+U)-(B=w-T))+(U-B),U=M[++P]):(R=T-((w=T+D)-(B=w-T))+(D-B),D=_[++ct]),T=w,R!==0&&(x[L++]=R);for(;P<E;)R=T-((w=T+U)-(B=w-T))+(U-B),U=M[++P],T=w,R!==0&&(x[L++]=R);for(;ct<A;)R=T-((w=T+D)-(B=w-T))+(D-B),D=_[++ct],T=w,R!==0&&(x[L++]=R);return T===0&&L!==0||(x[L++]=T),L}function s(E){return new Float64Array(E)}let u=33306690738754716e-32,c=22204460492503146e-32,f=11093356479670487e-47,p=s(4),d=s(8),g=s(12),y=s(16),v=s(4);n.orient2d=function(E,M,A,_,x,T){let w=(M-T)*(A-x),R=(E-x)*(_-T),B=w-R;if(w===0||R===0||w>0!=R>0)return B;let U=Math.abs(w+R);return Math.abs(B)>=u*U?B:-function(D,P,ct,L,W,V,Mt){let $,gt,ft,vt,it,lt,H,At,It,Kt,nt,bt,Vt,$t,Ut,Gt,Ct,ee,Z=D-W,Dt=ct-W,_t=P-V,Nt=L-V;it=(Ut=(At=Z-(H=(lt=134217729*Z)-(lt-Z)))*(Kt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=Z*Nt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(Kt=Dt-(It=(lt=134217729*Dt)-(lt-Dt)))-((Gt=_t*Dt)-H*It-At*It-H*Kt))),p[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),p[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,p[2]=bt-(ee-it)+(nt-it),p[3]=ee;let wt=function(Y,N){let xt=N[0];for(let St=1;St<Y;St++)xt+=N[St];return xt}(4,p),Ht=c*Mt;if(wt>=Ht||-wt>=Ht||($=D-(Z+(it=D-Z))+(it-W),ft=ct-(Dt+(it=ct-Dt))+(it-W),gt=P-(_t+(it=P-_t))+(it-V),vt=L-(Nt+(it=L-Nt))+(it-V),$===0&&gt===0&&ft===0&&vt===0)||(Ht=f*Mt+e*Math.abs(wt),(wt+=Z*vt+Nt*$-(_t*ft+Dt*gt))>=Ht||-wt>=Ht))return wt;it=(Ut=(At=$-(H=(lt=134217729*$)-(lt-$)))*(Kt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=$*Nt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=gt-(H=(lt=134217729*gt)-(lt-gt)))*(Kt=Dt-(It=(lt=134217729*Dt)-(lt-Dt)))-((Gt=gt*Dt)-H*It-At*It-H*Kt))),v[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),v[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,v[2]=bt-(ee-it)+(nt-it),v[3]=ee;let Xt=i(4,p,4,v,d);it=(Ut=(At=Z-(H=(lt=134217729*Z)-(lt-Z)))*(Kt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=Z*vt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(Kt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((Gt=_t*ft)-H*It-At*It-H*Kt))),v[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),v[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,v[2]=bt-(ee-it)+(nt-it),v[3]=ee;let Pt=i(Xt,d,4,v,g);it=(Ut=(At=$-(H=(lt=134217729*$)-(lt-$)))*(Kt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=$*vt)-H*It-At*It-H*Kt))-(nt=Ut-(Ct=(At=gt-(H=(lt=134217729*gt)-(lt-gt)))*(Kt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((Gt=gt*ft)-H*It-At*It-H*Kt))),v[0]=Ut-(nt+it)+(it-Ct),it=(Vt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=Vt-Gt),v[1]=Vt-(nt+it)+(it-Gt),it=(ee=bt+nt)-bt,v[2]=bt-(ee-it)+(nt-it),v[3]=ee;let ne=i(Pt,g,4,v,y);return y[ne-1]}(E,M,A,_,x,T,U)},n.orient2dfast=function(E,M,A,_,x,T){return(M-T)*(A-x)-(E-x)*(_-T)},Object.defineProperty(n,"__esModule",{value:!0})})});var WP=X((nst,__)=>{"use strict";var GP=p_(),Sd=PP(),o$=UP(),s$=zP().orient2d;Sd.default&&(Sd=Sd.default);__.exports=HP;__.exports.default=HP;function HP(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var i=f$(n),s=new GP(16);s.toBBox=function(T){return{minX:T[0],minY:T[1],maxX:T[0],maxY:T[1]}},s.compareMinX=function(T,w){return T[0]-w[0]},s.compareMinY=function(T,w){return T[1]-w[1]},s.load(n);for(var u=[],c=0,f;c<i.length;c++){var p=i[c];s.remove(p),f=VP(p,f),u.push(f)}var d=new GP(16);for(c=0;c<u.length;c++)d.insert(m_(u[c]));for(var g=t*t,y=e*e;u.length;){var v=u.shift(),E=v.p,M=v.next.p,A=y_(E,M);if(!(A<y)){var _=A/g;p=a$(s,v.prev.p,E,M,v.next.next.p,_,d),p&&Math.min(y_(p,E),y_(p,M))<=_&&(u.push(v),u.push(VP(p,v)),s.remove(p),d.remove(v),d.insert(m_(v)),d.insert(m_(v.next)))}}v=f;var x=[];do x.push(v.p),v=v.next;while(v!==f);return x.push(v.p),x}function a$(n,t,e,i,s,u,c){for(var f=new Sd([],u$),p=n.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],y=p.leaf?v_(g,e,i):l$(e,i,g);y>u||f.push({node:g,dist:y})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),E=v.node,M=v_(E,t,e),A=v_(E,i,s);if(v.dist<M&&v.dist<A&&qP(e,E,c)&&qP(i,E,c))return E}p=f.pop(),p&&(p=p.node)}return null}function u$(n,t){return n.dist-t.dist}function l$(n,t,e){if(kP(n,e)||kP(t,e))return 0;var i=Ed(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(i===0)return 0;var s=Ed(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var u=Ed(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(u===0)return 0;var c=Ed(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return c===0?0:Math.min(i,s,u,c)}function kP(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function qP(n,t,e){for(var i=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),u=Math.max(n[0],t[0]),c=Math.max(n[1],t[1]),f=e.search({minX:i,minY:s,maxX:u,maxY:c}),p=0;p<f.length;p++)if(c$(f[p].p,f[p].next.p,n,t))return!1;return!0}function Bl(n,t,e){return s$(n[0],n[1],t[0],t[1],e[0],e[1])}function c$(n,t,e,i){return n!==i&&t!==e&&Bl(n,t,e)>0!=Bl(n,t,i)>0&&Bl(e,i,n)>0!=Bl(e,i,t)>0}function m_(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 f$(n){for(var t=n[0],e=n[0],i=n[0],s=n[0],u=0;u<n.length;u++){var c=n[u];c[0]<t[0]&&(t=c),c[0]>i[0]&&(i=c),c[1]<e[1]&&(e=c),c[1]>s[1]&&(s=c)}var f=[t,e,i,s],p=f.slice();for(u=0;u<n.length;u++)o$(n[u],f)||p.push(n[u]);return p$(p)}function VP(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 y_(n,t){var e=n[0]-t[0],i=n[1]-t[1];return e*e+i*i}function v_(n,t,e){var i=t[0],s=t[1],u=e[0]-i,c=e[1]-s;if(u!==0||c!==0){var f=((n[0]-i)*u+(n[1]-s)*c)/(u*u+c*c);f>1?(i=e[0],s=e[1]):f>0&&(i+=u*f,s+=c*f)}return u=n[0]-i,c=n[1]-s,u*u+c*c}function Ed(n,t,e,i,s,u,c,f){var p=e-n,d=i-t,g=c-s,y=f-u,v=n-s,E=t-u,M=p*p+d*d,A=p*g+d*y,_=g*g+y*y,x=p*v+d*E,T=g*v+y*E,w=M*_-A*A,R,B,U,D,P=w,ct=w;w===0?(B=0,P=1,D=T,ct=_):(B=A*T-_*x,D=M*T-A*x,B<0?(B=0,D=T,ct=_):B>P&&(B=P,D=T+A,ct=_)),D<0?(D=0,-x<0?B=0:-x>M?B=P:(B=-x,P=M)):D>ct&&(D=ct,-x+A<0?B=0:-x+A>M?B=P:(B=-x+A,P=M)),R=B===0?0:B/P,U=D===0?0:D/ct;var L=(1-R)*n+R*e,W=(1-R)*t+R*i,V=(1-U)*s+U*c,Mt=(1-U)*u+U*f,$=V-L,gt=Mt-W;return $*$+gt*gt}function h$(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function p$(n){n.sort(h$);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&Bl(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var i=[],s=n.length-1;s>=0;s--){for(;i.length>=2&&Bl(i[i.length-2],i[i.length-1],n[s])<=0;)i.pop();i.push(n[s])}return i.pop(),t.pop(),t.concat(i)}});var jP=X((E_,S_)=>{(function(n,t){typeof E_=="object"&&typeof S_!="undefined"?S_.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(E_,function(){"use strict";function n(s,u,c,f,p){t(s,u,c||0,f||s.length-1,p||i)}function t(s,u,c,f,p){for(;f>c;){if(f-c>600){var d=f-c+1,g=u-c+1,y=Math.log(d),v=.5*Math.exp(2*y/3),E=.5*Math.sqrt(y*v*(d-v)/d)*(g-d/2<0?-1:1),M=Math.max(c,Math.floor(u-g*v/d+E)),A=Math.min(f,Math.floor(u+(d-g)*v/d+E));t(s,u,M,A,p)}var _=s[u],x=c,T=f;for(e(s,c,u),p(s[f],_)>0&&e(s,c,f);x<T;){for(e(s,x,T),x++,T--;p(s[x],_)<0;)x++;for(;p(s[T],_)>0;)T--}p(s[c],_)===0?e(s,c,T):(T++,e(s,T,f)),T<=u&&(c=T+1),u<=T&&(f=T-1)}}function e(s,u,c){var f=s[u];s[u]=s[c],s[c]=f}function i(s,u){return s<u?-1:s>u?1:0}return n})});var A_=X((Cut,b_)=>{"use strict";b_.exports=Sf;b_.exports.default=Sf;var A$=jP();function Sf(n,t){if(!(this instanceof Sf))return new Sf(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()}Sf.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],i=this.toBBox;if(!Md(n,t))return e;for(var s=[],u,c,f,p;t;){for(u=0,c=t.children.length;u<c;u++)f=t.children[u],p=t.leaf?i(f):f,Md(n,p)&&(t.leaf?e.push(f):M_(n,p)?this._all(f,e):s.push(f));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!Md(n,t))return!1;for(var i=[],s,u,c,f;t;){for(s=0,u=t.children.length;s<u;s++)if(c=t.children[s],f=t.leaf?e(c):c,Md(n,f)){if(t.leaf||M_(n,f))return!0;i.push(c)}t=i.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 i=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=kl([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,i=this.toBBox(n),s=[],u=[],c,f,p,d;e||s.length;){if(e||(e=s.pop(),f=s[s.length-1],c=u.pop(),d=!0),e.leaf&&(p=T$(n,e.children,t),p!==-1))return e.children.splice(p,1),s.push(e),this._condense(s),this;!d&&!e.leaf&&M_(e,i)?(s.push(e),u.push(c),c=0,f=e,e=e.children[0]):f?(c++,e=f.children[c],d=!1):e=null}return this},toBBox:function(n){return n},compareMinX:KP,compareMinY:QP,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,i){var s=e-t+1,u=this._maxEntries,c;if(s<=u)return c=kl(n.slice(t,e+1)),Gl(c,this.toBBox),c;i||(i=Math.ceil(Math.log(s)/Math.log(u)),u=Math.ceil(s/Math.pow(u,i-1))),c=kl([]),c.leaf=!1,c.height=i;var f=Math.ceil(s/u),p=f*Math.ceil(Math.sqrt(u)),d,g,y,v;for(tR(n,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(y=Math.min(d+p-1,e),tR(n,d,y,f,this.compareMinY),g=d;g<=y;g+=f)v=Math.min(g+f-1,y),c.children.push(this._build(n,g,v,i-1));return Gl(c,this.toBBox),c},_chooseSubtree:function(n,t,e,i){for(var s,u,c,f,p,d,g,y;i.push(t),!(t.leaf||i.length-1===e);){for(g=y=1/0,s=0,u=t.children.length;s<u;s++)c=t.children[s],p=w_(c),d=C$(n,c)-p,d<y?(y=d,g=p<g?p:g,f=c):d===y&&p<g&&(g=p,f=c);t=f||t.children[0]}return t},_insert:function(n,t,e){var i=this.toBBox,s=e?n:i(n),u=[],c=this._chooseSubtree(s,this.data,t,u);for(c.children.push(n),Ef(c,s);t>=0&&u[t].children.length>this._maxEntries;)this._split(u,t),t--;this._adjustParentBBoxes(s,u,t)},_split:function(n,t){var e=n[t],i=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,i);var u=this._chooseSplitIndex(e,s,i),c=kl(e.children.splice(u,e.children.length-u));c.height=e.height,c.leaf=e.leaf,Gl(e,this.toBBox),Gl(c,this.toBBox),t?n[t-1].children.push(c):this._splitRoot(e,c)},_splitRoot:function(n,t){this.data=kl([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Gl(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var i,s,u,c,f,p,d,g;for(p=d=1/0,i=t;i<=e-t;i++)s=xf(n,0,i,this.toBBox),u=xf(n,i,e,this.toBBox),c=I$(s,u),f=w_(s)+w_(u),c<p?(p=c,g=i,d=f<d?f:d):c===p&&f<d&&(d=f,g=i);return g},_chooseSplitAxis:function(n,t,e){var i=n.leaf?this.compareMinX:KP,s=n.leaf?this.compareMinY:QP,u=this._allDistMargin(n,t,e,i),c=this._allDistMargin(n,t,e,s);u<c&&n.children.sort(i)},_allDistMargin:function(n,t,e,i){n.children.sort(i);var s=this.toBBox,u=xf(n,0,t,s),c=xf(n,e-t,e,s),f=wd(u)+wd(c),p,d;for(p=t;p<e-t;p++)d=n.children[p],Ef(u,n.leaf?s(d):d),f+=wd(u);for(p=e-t-1;p>=t;p--)d=n.children[p],Ef(c,n.leaf?s(d):d),f+=wd(c);return f},_adjustParentBBoxes:function(n,t,e){for(var i=e;i>=0;i--)Ef(t[i],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():Gl(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 T$(n,t,e){if(!e)return t.indexOf(n);for(var i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Gl(n,t){xf(n,0,n.children.length,t,n)}function xf(n,t,e,i,s){s||(s=kl(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var u=t,c;u<e;u++)c=n.children[u],Ef(s,n.leaf?i(c):c);return s}function Ef(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 KP(n,t){return n.minX-t.minX}function QP(n,t){return n.minY-t.minY}function w_(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function wd(n){return n.maxX-n.minX+(n.maxY-n.minY)}function C$(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 I$(n,t){var e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),u=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,u-i)}function M_(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Md(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function kl(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function tR(n,t,e,i,s){for(var u=[t,e],c;u.length;)e=u.pop(),t=u.pop(),!(e-t<=i)&&(c=t+Math.ceil((e-t)/i/2)*i,A$(n,c,t,e,s),u.push(t,c,c,e))}});var sR=X((klt,L_)=>{"use strict";L_.exports=Cd;L_.exports.default=Cd;function Cd(n,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:n.length,u=rR(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;var f,p,d,g,y,v,E;if(i&&(u=G$(n,t,u,e)),n.length>80*e){f=d=n[0],p=g=n[1];for(var M=e;M<s;M+=e)y=n[M],v=n[M+1],y<f&&(f=y),v<p&&(p=v),y>d&&(d=y),v>g&&(g=v);E=Math.max(d-f,g-p),E=E!==0?32767/E:0}return bf(u,c,e,f,p,E,0),c}function rR(n,t,e,i,s){var u,c;if(s===R_(n,t,e,i)>0)for(u=t;u<e;u+=i)c=nR(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=nR(u,n[u],n[u+1],c);return c&&Id(c,c.next)&&(Tf(c),c=c.next),c}function gu(n,t){if(!n)return n;t||(t=n);var e=n,i;do if(i=!1,!e.steiner&&(Id(e,e.next)||tr(e.prev,e,e.next)===0)){if(Tf(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function bf(n,t,e,i,s,u,c){if(n){!c&&u&&W$(n,i,s,u);for(var f=n,p,d;n.prev!==n.next;){if(p=n.prev,d=n.next,u?U$(n,i,s,u):F$(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),Tf(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=B$(gu(n),t,e),bf(n,t,e,i,s,u,2)):c===2&&z$(n,t,e,i,s,u):bf(gu(n),t,e,i,s,u,1);break}}}}function F$(n){var t=n.prev,e=n,i=n.next;if(tr(t,e,i)>=0)return!1;for(var s=t.x,u=e.x,c=i.x,f=t.y,p=e.y,d=i.y,g=s<u?s<c?s:c:u<c?u:c,y=f<p?f<d?f:d:p<d?p:d,v=s>u?s>c?s:c:u>c?u:c,E=f>p?f>d?f:d:p>d?p:d,M=i.next;M!==t;){if(M.x>=g&&M.x<=v&&M.y>=y&&M.y<=E&&Hl(s,f,u,p,c,d,M.x,M.y)&&tr(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function U$(n,t,e,i){var s=n.prev,u=n,c=n.next;if(tr(s,u,c)>=0)return!1;for(var f=s.x,p=u.x,d=c.x,g=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=g<y?g<v?g:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=g>y?g>v?g:v:y>v?y:v,x=I_(E,M,t,e,i),T=I_(A,_,t,e,i),w=n.prevZ,R=n.nextZ;w&&w.z>=x&&R&&R.z<=T;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Hl(f,g,p,y,d,v,w.x,w.y)&&tr(w.prev,w,w.next)>=0||(w=w.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Hl(f,g,p,y,d,v,R.x,R.y)&&tr(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;w&&w.z>=x;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Hl(f,g,p,y,d,v,w.x,w.y)&&tr(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Hl(f,g,p,y,d,v,R.x,R.y)&&tr(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function B$(n,t,e){var i=n;do{var s=i.prev,u=i.next.next;!Id(s,u)&&iR(s,i,i.next,u)&&Af(s,u)&&Af(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),Tf(i),Tf(i.next),i=n=u),i=i.next}while(i!==n);return gu(i)}function z$(n,t,e,i,s,u){var c=n;do{for(var f=c.next.next;f!==c.prev;){if(c.i!==f.i&&$$(c,f)){var p=oR(c,f);c=gu(c,c.next),p=gu(p,p.next),bf(c,t,e,i,s,u,0),bf(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function G$(n,t,e,i){var s=[],u,c,f,p,d;for(u=0,c=t.length;u<c;u++)f=t[u]*i,p=u<c-1?t[u+1]*i:n.length,d=rR(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(Y$(d));for(s.sort(k$),u=0;u<s.length;u++)e=q$(s[u],e);return e}function k$(n,t){return n.x-t.x}function q$(n,t){var e=V$(n,t);if(!e)return t;var i=oR(e,n);return gu(i,i.next),gu(e,e.next)}function V$(n,t){var e=t,i=n.x,s=n.y,u=-1/0,c;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var f=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=i&&f>u&&(u=f,c=e.x<e.next.x?e:e.next,f===i))return c}e=e.next}while(e!==t);if(!c)return null;var p=c,d=c.x,g=c.y,y=1/0,v;e=c;do i>=e.x&&e.x>=d&&i!==e.x&&Hl(s<g?i:u,s,d,g,s<g?u:i,s,e.x,e.y)&&(v=Math.abs(s-e.y)/(i-e.x),Af(e,n)&&(v<y||v===y&&(e.x>c.x||e.x===c.x&&H$(c,e)))&&(c=e,y=v)),e=e.next;while(e!==p);return c}function H$(n,t){return tr(n.prev,n,t.prev)<0&&tr(t.next,n,n.next)<0}function W$(n,t,e,i){var s=n;do s.z===0&&(s.z=I_(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,X$(s)}function X$(n){var t,e,i,s,u,c,f,p,d=1;do{for(e=n,n=null,u=null,c=0;e;){for(c++,i=e,f=0,t=0;t<d&&(f++,i=i.nextZ,!!i);t++);for(p=d;f>0||p>0&&i;)f!==0&&(p===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,f--):(s=i,i=i.nextZ,p--),u?u.nextZ=s:n=s,s.prevZ=u,u=s;e=i}u.nextZ=null,d*=2}while(c>1);return n}function I_(n,t,e,i,s){return n=(n-e)*s|0,t=(t-i)*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 Y$(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 Hl(n,t,e,i,s,u,c,f){return(s-c)*(t-f)>=(n-c)*(u-f)&&(n-c)*(i-f)>=(e-c)*(t-f)&&(e-c)*(u-f)>=(s-c)*(i-f)}function $$(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!Z$(n,t)&&(Af(n,t)&&Af(t,n)&&J$(n,t)&&(tr(n.prev,n,t.prev)||tr(n,t.prev,t))||Id(n,t)&&tr(n.prev,n,n.next)>0&&tr(t.prev,t,t.next)>0)}function tr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Id(n,t){return n.x===t.x&&n.y===t.y}function iR(n,t,e,i){var s=Td(tr(n,t,e)),u=Td(tr(n,t,i)),c=Td(tr(e,i,n)),f=Td(tr(e,i,t));return!!(s!==u&&c!==f||s===0&&Ad(n,e,t)||u===0&&Ad(n,i,t)||c===0&&Ad(e,n,i)||f===0&&Ad(e,t,i))}function Ad(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 Td(n){return n>0?1:n<0?-1:0}function Z$(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&&iR(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function Af(n,t){return tr(n.prev,n,n.next)<0?tr(n,t,n.next)>=0&&tr(n,n.prev,t)>=0:tr(n,t,n.prev)<0||tr(n,n.next,t)<0}function J$(n,t){var e=n,i=!1,s=(n.x+t.x)/2,u=(n.y+t.y)/2;do e.y>u!=e.next.y>u&&e.next.y!==e.y&&s<(e.next.x-e.x)*(u-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==n);return i}function oR(n,t){var e=new P_(n.i,n.x,n.y),i=new P_(t.i,t.x,t.y),s=n.next,u=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,i.next=e,e.prev=i,u.next=i,i.prev=u,i}function nR(n,t,e,i){var s=new P_(n,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Tf(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 P_(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}Cd.deviation=function(n,t,e,i){var s=t&&t.length,u=s?t[0]*e:n.length,c=Math.abs(R_(n,0,u,e));if(s)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:n.length;c-=Math.abs(R_(n,d,g,e))}var y=0;for(f=0;f<i.length;f+=3){var v=i[f]*e,E=i[f+1]*e,M=i[f+2]*e;y+=Math.abs((n[v]-n[M])*(n[E+1]-n[v+1])-(n[v]-n[E])*(n[M+1]-n[v+1]))}return c===0&&y===0?0:Math.abs((y-c)/c)};function R_(n,t,e,i){for(var s=0,u=t,c=e-i;u<e;u+=i)s+=(n[c]-n[u])*(n[u+1]+n[c+1]),c=u;return s}Cd.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<n.length;s++){for(var u=0;u<n[s].length;u++)for(var c=0;c<t;c++)e.vertices.push(n[s][u][c]);s>0&&(i+=n[s-1].length,e.holes.push(i))}return e}});var U_=X(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.earthRadius=63710088e-1;ge.factors={centimeters:ge.earthRadius*100,centimetres:ge.earthRadius*100,degrees:ge.earthRadius/111325,feet:ge.earthRadius*3.28084,inches:ge.earthRadius*39.37,kilometers:ge.earthRadius/1e3,kilometres:ge.earthRadius/1e3,meters:ge.earthRadius,metres:ge.earthRadius,miles:ge.earthRadius/1609.344,millimeters:ge.earthRadius*1e3,millimetres:ge.earthRadius*1e3,nauticalmiles:ge.earthRadius/1852,radians:1,yards:ge.earthRadius*1.0936};ge.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/ge.earthRadius,yards:1.0936133};ge.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 Sa(n,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}ge.feature=Sa;function K$(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return N_(t).geometry;case"LineString":return D_(t).geometry;case"Polygon":return O_(t).geometry;case"MultiPoint":return uR(t).geometry;case"MultiLineString":return aR(t).geometry;case"MultiPolygon":return lR(t).geometry;default:throw new Error(n+" is invalid")}}ge.geometry=K$;function N_(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(!Pd(n[0])||!Pd(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return Sa(i,t,e)}ge.point=N_;function Q$(n,t,e){return e===void 0&&(e={}),Rd(n.map(function(i){return N_(i,t)}),e)}ge.points=Q$;function O_(n,t,e){e===void 0&&(e={});for(var i=0,s=n;i<s.length;i++){var u=s[i];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var c=0;c<u[u.length-1].length;c++)if(u[u.length-1][c]!==u[0][c])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:n};return Sa(f,t,e)}ge.polygon=O_;function tZ(n,t,e){return e===void 0&&(e={}),Rd(n.map(function(i){return O_(i,t)}),e)}ge.polygons=tZ;function D_(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 i={type:"LineString",coordinates:n};return Sa(i,t,e)}ge.lineString=D_;function eZ(n,t,e){return e===void 0&&(e={}),Rd(n.map(function(i){return D_(i,t)}),e)}ge.lineStrings=eZ;function Rd(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}ge.featureCollection=Rd;function aR(n,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:n};return Sa(i,t,e)}ge.multiLineString=aR;function uR(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return Sa(i,t,e)}ge.multiPoint=uR;function lR(n,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:n};return Sa(i,t,e)}ge.multiPolygon=lR;function nZ(n,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:n};return Sa(i,t,e)}ge.geometryCollection=nZ;function rZ(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}ge.round=rZ;function cR(n,t){t===void 0&&(t="kilometers");var e=ge.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}ge.radiansToLength=cR;function F_(n,t){t===void 0&&(t="kilometers");var e=ge.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}ge.lengthToRadians=F_;function iZ(n,t){return fR(F_(n,t))}ge.lengthToDegrees=iZ;function oZ(n){var t=n%360;return t<0&&(t+=360),t}ge.bearingToAzimuth=oZ;function fR(n){var t=n%(2*Math.PI);return t*180/Math.PI}ge.radiansToDegrees=fR;function sZ(n){var t=n%360;return t*Math.PI/180}ge.degreesToRadians=sZ;function aZ(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 cR(F_(n,t),e)}ge.convertLength=aZ;function uZ(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 i=ge.areaFactors[t];if(!i)throw new Error("invalid original units");var s=ge.areaFactors[e];if(!s)throw new Error("invalid final units");return n/i*s}ge.convertArea=uZ;function Pd(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}ge.isNumber=Pd;function lZ(n){return!!n&&n.constructor===Object}ge.isObject=lZ;function cZ(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(!Pd(t))throw new Error("bbox must only contain numbers")})}ge.validateBBox=cZ;function fZ(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")}ge.validateId=fZ});var z_=X(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});var fi=U_();function Cf(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,g=0,y=0,v,E=n.type,M=E==="FeatureCollection",A=E==="Feature",_=M?n.features.length:1,x=0;x<_;x++){d=M?n.features[x].geometry:A?n.geometry:n,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var T=0;T<f;T++){var w=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var B=c.type;switch(g=e&&(B==="Polygon"||B==="MultiPolygon")?1:0,B){case null:break;case"Point":if(t(p,y,x,w,R)===!1)return!1;y++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,w,R)===!1)return!1;y++,B==="MultiPoint"&&w++}B==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-g;s++){if(t(p[i][s],y,x,w,R)===!1)return!1;y++}B==="MultiLineString"&&w++,B==="Polygon"&&R++}B==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<p.length;i++){for(R=0,s=0;s<p[i].length;s++){for(u=0;u<p[i][s].length-g;u++){if(t(p[i][s][u],y,x,w,R)===!1)return!1;y++}R++}w++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(Cf(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hZ(n,t,e,i){var s=e;return Cf(n,function(u,c,f,p,d){c===0&&e===void 0?s=u:s=t(s,u,c,f,p,d)},i),s}function hR(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 pZ(n,t,e){var i=e;return hR(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function pR(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 dZ(n,t,e){var i=e;return pR(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function gZ(n){var t=[];return Cf(n,function(e){t.push(e)}),t}function B_(n,t){var e,i,s,u,c,f,p,d,g,y,v=0,E=n.type==="FeatureCollection",M=n.type==="Feature",A=E?n.features.length:1;for(e=0;e<A;e++){for(f=E?n.features[e].geometry:M?n.geometry:n,d=E?n.features[e].properties:M?n.properties:{},g=E?n.features[e].bbox:M?n.bbox:void 0,y=E?n.features[e].id:M?n.id:void 0,p=f?f.type==="GeometryCollection":!1,c=p?f.geometries.length:1,s=0;s<c;s++){if(u=p?f.geometries[s]:f,u===null){if(t(null,v,d,g,y)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,v,d,g,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,g,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function mZ(n,t,e){var i=e;return B_(n,function(s,u,c,f,p){u===0&&e===void 0?i=s:i=t(i,s,u,c,f,p)}),i}function Ld(n,t){B_(n,function(e,i,s,u,c){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(fi.feature(e,s,{bbox:u,id:c}),i,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],y={type:p,coordinates:g};if(t(fi.feature(y,s),i,d)===!1)return!1}})}function yZ(n,t,e){var i=e;return Ld(n,function(s,u,c){u===0&&c===0&&e===void 0?i=s:i=t(i,s,u,c)}),i}function dR(n,t){Ld(n,function(e,i,s){var u=0;if(e.geometry){var c=e.geometry.type;if(!(c==="Point"||c==="MultiPoint")){var f,p=0,d=0,g=0;if(Cf(e,function(y,v,E,M,A){if(f===void 0||i>p||M>d||A>g){f=y,p=i,d=M,g=A,u=0;return}var _=fi.lineString([f,y],e.properties);if(t(_,i,s,A,u)===!1)return!1;u++,f=y})===!1)return!1}}})}function vZ(n,t,e){var i=e,s=!1;return dR(n,function(u,c,f,p,d){s===!1&&e===void 0?i=u:i=t(i,u,c,f,p,d),s=!0}),i}function gR(n,t){if(!n)throw new Error("geojson is required");Ld(n,function(e,i,s){if(e.geometry!==null){var u=e.geometry.type,c=e.geometry.coordinates;switch(u){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<c.length;f++)if(t(fi.lineString(c[f],e.properties),i,s,f)===!1)return!1;break}}})}function _Z(n,t,e){var i=e;return gR(n,function(s,u,c,f){u===0&&e===void 0?i=s:i=t(i,s,u,c,f)}),i}function xZ(n,t){if(t=t||{},!fi.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,s=t.geometryIndex||0,u=t.segmentIndex||0,c=t.properties,f;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),c=c||n.features[e].properties,f=n.features[e].geometry;break;case"Feature":c=c||n.properties,f=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=n;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return u<0&&(u=p.length+u-1),fi.lineString([p[u],p[u+1]],c,t);case"Polygon":return s<0&&(s=p.length+s),u<0&&(u=p[s].length+u-1),fi.lineString([p[s][u],p[s][u+1]],c,t);case"MultiLineString":return i<0&&(i=p.length+i),u<0&&(u=p[i].length+u-1),fi.lineString([p[i][u],p[i][u+1]],c,t);case"MultiPolygon":return i<0&&(i=p.length+i),s<0&&(s=p[i].length+s),u<0&&(u=p[i][s].length-u-1),fi.lineString([p[i][s][u],p[i][s][u+1]],c,t)}throw new Error("geojson is invalid")}function EZ(n,t){if(t=t||{},!fi.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,s=t.geometryIndex||0,u=t.coordIndex||0,c=t.properties,f;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),c=c||n.features[e].properties,f=n.features[e].geometry;break;case"Feature":c=c||n.properties,f=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=n;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return fi.point(p,c,t);case"MultiPoint":return i<0&&(i=p.length+i),fi.point(p[i],c,t);case"LineString":return u<0&&(u=p.length+u),fi.point(p[u],c,t);case"Polygon":return s<0&&(s=p.length+s),u<0&&(u=p[s].length+u),fi.point(p[s][u],c,t);case"MultiLineString":return i<0&&(i=p.length+i),u<0&&(u=p[i].length+u),fi.point(p[i][u],c,t);case"MultiPolygon":return i<0&&(i=p.length+i),s<0&&(s=p[i].length+s),u<0&&(u=p[i][s].length-u),fi.point(p[i][s][u],c,t)}throw new Error("geojson is invalid")}Mr.coordAll=gZ;Mr.coordEach=Cf;Mr.coordReduce=hZ;Mr.featureEach=pR;Mr.featureReduce=dZ;Mr.findPoint=EZ;Mr.findSegment=xZ;Mr.flattenEach=Ld;Mr.flattenReduce=yZ;Mr.geomEach=B_;Mr.geomReduce=mZ;Mr.lineEach=gR;Mr.lineReduce=_Z;Mr.propEach=hR;Mr.propReduce=pZ;Mr.segmentEach=dR;Mr.segmentReduce=vZ});var mR=X(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var SZ=z_();function G_(n){var t=[1/0,1/0,-1/0,-1/0];return SZ.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}G_.default=G_;k_.default=G_});var Nd=X((rct,q_)=>{var rs=p_(),vR=U_(),_R=z_(),Wl=mR().default,wZ=_R.featureEach,ect=_R.coordEach,nct=vR.polygon,yR=vR.featureCollection;function xR(n){var t=new rs(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Wl(e),rs.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Wl(s),i.push(s)}):wZ(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Wl(s),i.push(s)}),rs.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Wl(e),rs.prototype.remove.call(this,e,i)},t.clear=function(){return rs.prototype.clear.call(this)},t.search=function(e){var i=rs.prototype.search.call(this,this.toBBox(e));return yR(i)},t.collides=function(e){return rs.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=rs.prototype.all.call(this);return yR(e)},t.toJSON=function(){return rs.prototype.toJSON.call(this)},t.fromJSON=function(e){return rs.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=Wl(e);else if(e.type==="FeatureCollection")i=Wl(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}q_.exports=xR;q_.exports.default=xR});var $_=X((hht,PR)=>{"use strict";var IR=Object.prototype.toString;PR.exports=function(t){var e=IR.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&IR.call(t.callee)==="[object Function]"),i}});var zR=X((pht,BR)=>{"use strict";var UR;Object.keys||(Rf=Object.prototype.hasOwnProperty,Z_=Object.prototype.toString,RR=$_(),J_=Object.prototype.propertyIsEnumerable,LR=!J_.call({toString:null},"toString"),NR=J_.call(function(){},"prototype"),Lf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ud=function(n){var t=n.constructor;return t&&t.prototype===n},OR={$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},DR=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!OR["$"+n]&&Rf.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{Ud(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),FR=function(n){if(typeof window=="undefined"||!DR)return Ud(n);try{return Ud(n)}catch(t){return!1}},UR=function(t){var e=t!==null&&typeof t=="object",i=Z_.call(t)==="[object Function]",s=RR(t),u=e&&Z_.call(t)==="[object String]",c=[];if(!e&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var f=NR&&i;if(u&&t.length>0&&!Rf.call(t,0))for(var p=0;p<t.length;++p)c.push(String(p));if(s&&t.length>0)for(var d=0;d<t.length;++d)c.push(String(d));else for(var g in t)!(f&&g==="prototype")&&Rf.call(t,g)&&c.push(String(g));if(LR)for(var y=FR(t),v=0;v<Lf.length;++v)!(y&&Lf[v]==="constructor")&&Rf.call(t,Lf[v])&&c.push(Lf[v]);return c});var Rf,Z_,RR,J_,LR,NR,Lf,Ud,OR,DR,FR;BR.exports=UR});var j_=X((dht,qR)=>{"use strict";var NZ=Array.prototype.slice,OZ=$_(),GR=Object.keys,Bd=GR?function(t){return GR(t)}:zR(),kR=Object.keys;Bd.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(i){return OZ(i)?kR(NZ.call(i)):kR(i)})}else Object.keys=Bd;return Object.keys||Bd};qR.exports=Bd});var K_=X((ght,VR)=>{"use strict";VR.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var u 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 f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==s||f.enumerable!==!0)return!1}return!0}});var zd=X((mht,HR)=>{"use strict";var DZ=K_();HR.exports=function(){return DZ()&&!!Symbol.toStringTag}});var Q_=X((yht,WR)=>{"use strict";WR.exports=Object});var tx=X((vht,XR)=>{"use strict";XR.exports=Error});var $R=X((_ht,YR)=>{"use strict";YR.exports=EvalError});var JR=X((xht,ZR)=>{"use strict";ZR.exports=RangeError});var KR=X((Eht,jR)=>{"use strict";jR.exports=ReferenceError});var ex=X((Sht,QR)=>{"use strict";QR.exports=SyntaxError});var mu=X((wht,tL)=>{"use strict";tL.exports=TypeError});var nL=X((Mht,eL)=>{"use strict";eL.exports=URIError});var iL=X((bht,rL)=>{"use strict";rL.exports=Math.abs});var sL=X((Aht,oL)=>{"use strict";oL.exports=Math.floor});var uL=X((Tht,aL)=>{"use strict";aL.exports=Math.max});var cL=X((Cht,lL)=>{"use strict";lL.exports=Math.min});var hL=X((Iht,fL)=>{"use strict";fL.exports=Math.pow});var dL=X((Pht,pL)=>{"use strict";pL.exports=Math.round});var mL=X((Rht,gL)=>{"use strict";gL.exports=Number.isNaN||function(t){return t!==t}});var vL=X((Lht,yL)=>{"use strict";var FZ=mL();yL.exports=function(t){return FZ(t)||t===0?t:t<0?-1:1}});var xL=X((Nht,_L)=>{"use strict";_L.exports=Object.getOwnPropertyDescriptor});var yu=X((Oht,EL)=>{"use strict";var Gd=xL();if(Gd)try{Gd([],"length")}catch(n){Gd=null}EL.exports=Gd});var Nf=X((Dht,SL)=>{"use strict";var kd=Object.defineProperty||!1;if(kd)try{kd({},"a",{value:1})}catch(n){kd=!1}SL.exports=kd});var bL=X((Fht,ML)=>{"use strict";var wL=typeof Symbol!="undefined"&&Symbol,UZ=K_();ML.exports=function(){return typeof wL!="function"||typeof Symbol!="function"||typeof wL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:UZ()}});var nx=X((Uht,AL)=>{"use strict";AL.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var rx=X((Bht,TL)=>{"use strict";var BZ=Q_();TL.exports=BZ.getPrototypeOf||null});var PL=X((zht,IL)=>{"use strict";var zZ="Function.prototype.bind called on incompatible ",GZ=Object.prototype.toString,kZ=Math.max,qZ="[object Function]",CL=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var u=0;u<e.length;u+=1)i[u+t.length]=e[u];return i},VZ=function(t,e){for(var i=[],s=e||0,u=0;s<t.length;s+=1,u+=1)i[u]=t[s];return i},HZ=function(n,t){for(var e="",i=0;i<n.length;i+=1)e+=n[i],i+1<n.length&&(e+=t);return e};IL.exports=function(t){var e=this;if(typeof e!="function"||GZ.apply(e)!==qZ)throw new TypeError(zZ+e);for(var i=VZ(arguments,1),s,u=function(){if(this instanceof s){var g=e.apply(this,CL(i,arguments));return Object(g)===g?g:this}return e.apply(t,CL(i,arguments))},c=kZ(0,e.length-i.length),f=[],p=0;p<c;p++)f[p]="$"+p;if(s=Function("binder","return function ("+HZ(f,",")+"){ return binder.apply(this,arguments); }")(u),e.prototype){var d=function(){};d.prototype=e.prototype,s.prototype=new d,d.prototype=null}return s}});var Xl=X((Ght,RL)=>{"use strict";var WZ=PL();RL.exports=Function.prototype.bind||WZ});var qd=X((kht,LL)=>{"use strict";LL.exports=Function.prototype.call});var Vd=X((qht,NL)=>{"use strict";NL.exports=Function.prototype.apply});var DL=X((Vht,OL)=>{"use strict";OL.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var ix=X((Hht,FL)=>{"use strict";var XZ=Xl(),YZ=Vd(),$Z=qd(),ZZ=DL();FL.exports=ZZ||XZ.call($Z,YZ)});var Hd=X((Wht,UL)=>{"use strict";var JZ=Xl(),jZ=mu(),KZ=qd(),QZ=ix();UL.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new jZ("a function is required");return QZ(JZ,KZ,t)}});var VL=X((Xht,qL)=>{"use strict";var tJ=Hd(),BL=yu(),GL;try{GL=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var ox=!!GL&&BL&&BL(Object.prototype,"__proto__"),kL=Object,zL=kL.getPrototypeOf;qL.exports=ox&&typeof ox.get=="function"?tJ([ox.get]):typeof zL=="function"?function(t){return zL(t==null?t:kL(t))}:!1});var sx=X((Yht,YL)=>{"use strict";var HL=nx(),WL=rx(),XL=VL();YL.exports=HL?function(t){return HL(t)}:WL?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return WL(t)}:XL?function(t){return XL(t)}:null});var ax=X(($ht,$L)=>{"use strict";var eJ=Function.prototype.call,nJ=Object.prototype.hasOwnProperty,rJ=Xl();$L.exports=rJ.call(eJ,nJ)});var cx=X((Zht,tN)=>{"use strict";var tn,iJ=Q_(),oJ=tx(),sJ=$R(),aJ=JR(),uJ=KR(),Jl=ex(),Zl=mu(),lJ=nL(),cJ=iL(),fJ=sL(),hJ=uL(),pJ=cL(),dJ=hL(),gJ=dL(),mJ=vL(),KL=Function,ux=function(n){try{return KL('"use strict"; return ('+n+").constructor;")()}catch(t){}},Of=yu(),yJ=Nf(),lx=function(){throw new Zl},vJ=Of?function(){try{return arguments.callee,lx}catch(n){try{return Of(arguments,"callee").get}catch(t){return lx}}}():lx,Yl=bL()(),Gr=sx(),_J=rx(),xJ=nx(),QL=Vd(),Df=qd(),$l={},EJ=typeof Uint8Array=="undefined"||!Gr?tn:Gr(Uint8Array),vu={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":Yl&&Gr?Gr([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":$l,"%AsyncGenerator%":$l,"%AsyncGeneratorFunction%":$l,"%AsyncIteratorPrototype%":$l,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":oJ,"%eval%":eval,"%EvalError%":sJ,"%Float16Array%":typeof Float16Array=="undefined"?tn:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":KL,"%GeneratorFunction%":$l,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Yl&&Gr?Gr(Gr([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Yl||!Gr?tn:Gr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":iJ,"%Object.getOwnPropertyDescriptor%":Of,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":aJ,"%ReferenceError%":uJ,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Yl||!Gr?tn:Gr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Yl&&Gr?Gr(""[Symbol.iterator]()):tn,"%Symbol%":Yl?Symbol:tn,"%SyntaxError%":Jl,"%ThrowTypeError%":vJ,"%TypedArray%":EJ,"%TypeError%":Zl,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":lJ,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet,"%Function.prototype.call%":Df,"%Function.prototype.apply%":QL,"%Object.defineProperty%":yJ,"%Object.getPrototypeOf%":_J,"%Math.abs%":cJ,"%Math.floor%":fJ,"%Math.max%":hJ,"%Math.min%":pJ,"%Math.pow%":dJ,"%Math.round%":gJ,"%Math.sign%":mJ,"%Reflect.getPrototypeOf%":xJ};if(Gr)try{null.error}catch(n){ZL=Gr(Gr(n)),vu["%Error.prototype%"]=ZL}var ZL,SJ=function n(t){var e;if(t==="%AsyncFunction%")e=ux("async function () {}");else if(t==="%GeneratorFunction%")e=ux("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ux("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&Gr&&(e=Gr(s.prototype))}return vu[t]=e,e},JL={__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"]},Ff=Xl(),Wd=ax(),wJ=Ff.call(Df,Array.prototype.concat),MJ=Ff.call(QL,Array.prototype.splice),jL=Ff.call(Df,String.prototype.replace),Xd=Ff.call(Df,String.prototype.slice),bJ=Ff.call(Df,RegExp.prototype.exec),AJ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,TJ=/\\(\\)?/g,CJ=function(t){var e=Xd(t,0,1),i=Xd(t,-1);if(e==="%"&&i!=="%")throw new Jl("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Jl("invalid intrinsic syntax, expected opening `%`");var s=[];return jL(t,AJ,function(u,c,f,p){s[s.length]=f?jL(p,TJ,"$1"):c||u}),s},IJ=function(t,e){var i=t,s;if(Wd(JL,i)&&(s=JL[i],i="%"+s[0]+"%"),Wd(vu,i)){var u=vu[i];if(u===$l&&(u=SJ(i)),typeof u=="undefined"&&!e)throw new Zl("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:u}}throw new Jl("intrinsic "+t+" does not exist!")};tN.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Zl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Zl('"allowMissing" argument must be a boolean');if(bJ(/^%?[^%]*%?$/,t)===null)throw new Jl("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=CJ(t),s=i.length>0?i[0]:"",u=IJ("%"+s+"%",e),c=u.name,f=u.value,p=!1,d=u.alias;d&&(s=d[0],MJ(i,wJ([0,1],d)));for(var g=1,y=!0;g<i.length;g+=1){var v=i[g],E=Xd(v,0,1),M=Xd(v,-1);if((E==='"'||E==="'"||E==="`"||M==='"'||M==="'"||M==="`")&&E!==M)throw new Jl("property names with quotes must have matching quotes");if((v==="constructor"||!y)&&(p=!0),s+="."+v,c="%"+s+"%",Wd(vu,c))f=vu[c];else if(f!=null){if(!(v in f)){if(!e)throw new Zl("base intrinsic for "+t+" exists, but the property is not available.");return}if(Of&&g+1>=i.length){var A=Of(f,v);y=!!A,y&&"get"in A&&!("originalValue"in A.get)?f=A.get:f=f[v]}else y=Wd(f,v),f=f[v];y&&!p&&(vu[c]=f)}}return f}});var Yd=X((Jht,rN)=>{"use strict";var eN=cx(),nN=Hd(),PJ=nN([eN("%String.prototype.indexOf%")]);rN.exports=function(t,e){var i=eN(t,!!e);return typeof i=="function"&&PJ(t,".prototype.")>-1?nN([i]):i}});var sN=X((jht,oN)=>{"use strict";var RJ=zd()(),LJ=Yd(),fx=LJ("Object.prototype.toString"),$d=function(t){return RJ&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:fx(t)==="[object Arguments]"},iN=function(t){return $d(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&fx(t)!=="[object Array]"&&"callee"in t&&fx(t.callee)==="[object Function]"},NJ=function(){return $d(arguments)}();$d.isLegacyArguments=iN;oN.exports=NJ?$d:iN});var Zd=X((Kht,lN)=>{"use strict";var aN=Nf(),OJ=ex(),jl=mu(),uN=yu();lN.exports=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new jl("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new jl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new jl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new jl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new jl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new jl("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!uN&&uN(t,e);if(aN)aN(t,e,{configurable:c===null&&p?p.configurable:!c,enumerable:s===null&&p?p.enumerable:!s,value:i,writable:u===null&&p?p.writable:!u});else if(f||!s&&!u&&!c)t[e]=i;else throw new OJ("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Jd=X((Qht,fN)=>{"use strict";var hx=Nf(),cN=function(){return!!hx};cN.hasArrayLengthDefineBug=function(){if(!hx)return null;try{return hx([],"length",{value:1}).length!==1}catch(t){return!0}};fN.exports=cN});var Kl=X((tpt,gN)=>{"use strict";var DJ=j_(),FJ=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",UJ=Object.prototype.toString,BJ=Array.prototype.concat,hN=Zd(),zJ=function(n){return typeof n=="function"&&UJ.call(n)==="[object Function]"},pN=Jd()(),GJ=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!zJ(i)||!i())return}pN?hN(n,t,e,!0):hN(n,t,e)},dN=function(n,t){var e=arguments.length>2?arguments[2]:{},i=DJ(t);FJ&&(i=BJ.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s<i.length;s+=1)GJ(n,i[s],t[i[s]],e[i[s]])};dN.supportsDescriptors=!!pN;gN.exports=dN});var xN=X((ept,_N)=>{"use strict";var kJ=cx(),mN=Zd(),qJ=Jd()(),yN=yu(),vN=mu(),VJ=kJ("%Math.floor%");_N.exports=function(t,e){if(typeof t!="function")throw new vN("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||VJ(e)!==e)throw new vN("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in t&&yN){var c=yN(t,"length");c&&!c.configurable&&(s=!1),c&&!c.writable&&(u=!1)}return(s||u||!i)&&(qJ?mN(t,"length",e,!0,!0):mN(t,"length",e)),t}});var SN=X((npt,EN)=>{"use strict";var HJ=Xl(),WJ=Vd(),XJ=ix();EN.exports=function(){return XJ(HJ,WJ,arguments)}});var px=X((rpt,jd)=>{"use strict";var YJ=xN(),wN=Nf(),$J=Hd(),MN=SN();jd.exports=function(t){var e=$J(arguments),i=t.length-(arguments.length-1);return YJ(e,1+(i>0?i:0),!0)};wN?wN(jd.exports,"apply",{value:MN}):jd.exports.apply=MN});var dx=X((ipt,AN)=>{"use strict";var bN=function(n){return n!==n};AN.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||bN(t)&&bN(e))}});var gx=X((opt,TN)=>{"use strict";var ZJ=dx();TN.exports=function(){return typeof Object.is=="function"?Object.is:ZJ}});var IN=X((spt,CN)=>{"use strict";var JJ=gx(),jJ=Kl();CN.exports=function(){var t=JJ();return jJ(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var NN=X((apt,LN)=>{"use strict";var KJ=Kl(),QJ=px(),tj=dx(),PN=gx(),ej=IN(),RN=QJ(PN(),Object);KJ(RN,{getPolyfill:PN,implementation:tj,shim:ej});LN.exports=RN});var zN=X((upt,BN)=>{"use strict";var ON=Yd(),nj=zd()(),rj=ax(),ij=yu(),vx;nj?(DN=ON("RegExp.prototype.exec"),mx={},Kd=function(){throw mx},yx={toString:Kd,valueOf:Kd},typeof Symbol.toPrimitive=="symbol"&&(yx[Symbol.toPrimitive]=Kd),vx=function(t){if(!t||typeof t!="object")return!1;var e=ij(t,"lastIndex"),i=e&&rj(e,"value");if(!i)return!1;try{DN(t,yx)}catch(s){return s===mx}}):(FN=ON("Object.prototype.toString"),UN="[object RegExp]",vx=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:FN(t)===UN});var DN,mx,Kd,yx,FN,UN;BN.exports=vx});var kN=X((lpt,GN)=>{"use strict";var Bf=function(){return typeof function(){}.name=="string"},Uf=Object.getOwnPropertyDescriptor;if(Uf)try{Uf([],"length")}catch(n){Uf=null}Bf.functionsHaveConfigurableNames=function(){if(!Bf()||!Uf)return!1;var t=Uf(function(){},"name");return!!t&&!!t.configurable};var oj=Function.prototype.bind;Bf.boundFunctionsHaveNames=function(){return Bf()&&typeof oj=="function"&&function(){}.bind().name!==""};GN.exports=Bf});var HN=X((cpt,VN)=>{"use strict";var qN=Zd(),sj=Jd()(),aj=kN().functionsHaveConfigurableNames(),uj=mu();VN.exports=function(t,e){if(typeof t!="function")throw new uj("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||aj)&&(sj?qN(t,"name",e,!0,!0):qN(t,"name",e)),t}});var _x=X((fpt,WN)=>{"use strict";var lj=HN(),cj=mu(),fj=Object;WN.exports=lj(function(){if(this==null||this!==fj(this))throw new cj("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 xx=X((hpt,XN)=>{"use strict";var hj=_x(),pj=Kl().supportsDescriptors,dj=Object.getOwnPropertyDescriptor;XN.exports=function(){if(pj&&/a/mig.flags==="gim"){var t=dj(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),t.get.call(i),e==="dy")return t.get}}return hj}});var ZN=X((ppt,$N)=>{"use strict";var gj=Kl().supportsDescriptors,mj=xx(),yj=yu(),vj=Object.defineProperty,_j=tx(),YN=sx(),xj=/a/;$N.exports=function(){if(!gj||!YN)throw new _j("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=mj(),e=YN(xj),i=yj(e,"flags");return(!i||i.get!==t)&&vj(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var QN=X((dpt,KN)=>{"use strict";var Ej=Kl(),Sj=px(),wj=_x(),JN=xx(),Mj=ZN(),jN=Sj(JN());Ej(jN,{getPolyfill:JN,implementation:wj,shim:Mj});KN.exports=jN});var n2=X((gpt,e2)=>{"use strict";var t2=Yd(),bj=t2("Date.prototype.getDay"),Aj=function(t){try{return bj(t),!0}catch(e){return!1}},Tj=t2("Object.prototype.toString"),Cj="[object Date]",Ij=zd()();e2.exports=function(t){return typeof t!="object"||t===null?!1:Ij?Aj(t):Tj(t)===Cj}});var Ex=X((mpt,p2)=>{var r2=j_(),i2=sN(),o2=NN(),s2=zN(),a2=QN(),u2=n2(),l2=Date.prototype.getTime;function h2(n,t,e){var i=e||{};return(i.strict?o2(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?i.strict?o2(n,t):n==t:Pj(n,t,i)}function c2(n){return n==null}function f2(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 Pj(n,t,e){var i,s;if(typeof n!=typeof t||c2(n)||c2(t)||n.prototype!==t.prototype||i2(n)!==i2(t))return!1;var u=s2(n),c=s2(t);if(u!==c)return!1;if(u||c)return n.source===t.source&&a2(n)===a2(t);if(u2(n)&&u2(t))return l2.call(n)===l2.call(t);var f=f2(n),p=f2(t);if(f!==p)return!1;if(f||p){if(n.length!==t.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==t[i])return!1;return!0}if(typeof n!=typeof t)return!1;try{var d=r2(n),g=r2(t)}catch(y){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),i=d.length-1;i>=0;i--)if(d[i]!=g[i])return!1;for(i=d.length-1;i>=0;i--)if(s=d[i],!h2(n[s],t[s],e))return!1;return!0}p2.exports=h2});var Nx=X((Sgt,x2)=>{var xK=Ex(),is=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:EK};is.prototype.compare=function(n,t){if(n.type!==t.type||!_2(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,i=v2(n),s=v2(t);return i.every(function(u){return this.some(function(c){return e.compare(u,c)})},s)}}return!1};function v2(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function _2(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}is.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};is.prototype.compareLine=function(n,t,e,i){if(!_2(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),u=this.pseudoNode?t:this.removePseudo(t);if(!(i&&!this.compareCoord(s[0],u[0])&&(u=this.fixStartIndex(u,s),!u))){var c=this.compareCoord(s[e],u[e]);return this.direction||c?this.comparePath(s,u):this.compareCoord(s[e],u[u.length-(1+e)])?this.comparePath(s.slice().reverse(),u):!1}};is.prototype.fixStartIndex=function(n,t){for(var e,i=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){i=s;break}return i>=0&&(e=[].concat(n.slice(i,n.length),n.slice(1,i+1))),e};is.prototype.comparePath=function(n,t){var e=this;return n.every(function(i,s){return e.compareCoord(i,this[s])},t)};is.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),i=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(u){return this.some(function(c){return s.compareLine(u,c,1,!0)})},i)}else return!1};is.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)};is.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};is.prototype.removePseudo=function(n){return n};function EK(n,t){return xK(n,t,{strict:!0})}x2.exports=is});var E2=X((Ogt,eg)=>{function Ma(n,t,e,i){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,i)}Ma.prototype.run=function(n,t,e,i){this._init(n,t,e,i);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var u=this._regionQuery(s);if(u.length<this.minPts)this.noise.push(s);else{var c=this.clusters.length;this.clusters.push([]),this._addToCluster(s,c),this._expandCluster(c,u)}}return this.clusters};Ma.prototype._init=function(n,t,e,i){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),i&&(this.distance=i)};Ma.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var i=t[e];if(this._visited[i]!==1){this._visited[i]=1;var s=this._regionQuery(i);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[i]!==1&&this._addToCluster(i,n)}};Ma.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};Ma.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var i=this.distance(this.dataset[n],this.dataset[e]);i<this.epsilon&&t.push(e)}return t};Ma.prototype._mergeArrays=function(n,t){for(var e=t.length,i=0;i<e;i++){var s=t[i];n.indexOf(s)<0&&n.push(s)}return n};Ma.prototype._euclideanDistance=function(n,t){for(var e=0,i=Math.min(n.length,t.length);i--;)e+=(n[i]-t[i])*(n[i]-t[i]);return Math.sqrt(e)};typeof eg!="undefined"&&eg.exports&&(eg.exports=Ma)});var S2=X((Dgt,ng)=>{function ba(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}ba.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)};ba.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,i=0;i<this.k;i++)this.centroids[i]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var u=0;u<this.k;u++){for(var c=new Array(g),f=0,p=0;p<g;p++)c[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(u===this.assignments[d]){for(var p=0;p<g;p++)c[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)c[p]/=f;this.centroids[u]=c}else this.centroids[u]=this.randomCentroid(),s=!0}}return this.getClusters()};ba.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};ba.prototype.assign=function(){for(var n=!1,t=this.dataset.length,e,i=0;i<t;i++)e=this.argmin(this.dataset[i],this.centroids,this.distance),e!=this.assignments[i]&&(this.assignments[i]=e,n=!0);return n};ba.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};ba.prototype.argmin=function(n,t,e){for(var i=Number.MAX_VALUE,s=0,u=t.length,c,f=0;f<u;f++)c=e(n,t[f]),c<i&&(i=c,s=f);return s};ba.prototype.distance=function(n,t){for(var e=0,i=Math.min(n.length,t.length);i--;){var s=n[i]-t[i];e+=s*s}return Math.sqrt(e)};typeof ng!="undefined"&&ng.exports&&(ng.exports=ba)});var Ox=X((Fgt,rg)=>{function os(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}os.prototype.insert=function(n,t){for(var e=this._queue.length,i=e;i--;){var s=this._priorities[i];this._sorting==="desc"?t>s&&(e=i):t<s&&(e=i)}this._insertAt(n,t,e)};os.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}}};os.prototype.forEach=function(n){this._queue.forEach(n)};os.prototype.getElements=function(){return this._queue};os.prototype.getElementPriority=function(n){return this._priorities[n]};os.prototype.getPriorities=function(){return this._priorities};os.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};os.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 i=0;i<n.length;i++)this.insert(n[i],t[i])}e&&(this._sorting=e)};os.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 rg!="undefined"&&rg.exports&&(rg.exports=os)});var M2=X((Ugt,tc)=>{typeof tc!="undefined"&&tc.exports&&(w2=Ox());var w2;function Bs(n,t,e,i){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,i)}Bs.prototype.run=function(n,t,e,i){this._init(n,t,e,i);for(var s=0,u=this.dataset.length;s<u;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var c=this.clusters.length-1;this._orderedList.push(s);var f=new w2(null,null,"asc"),p=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,p,f),this._expandCluster(c,f))}return this.clusters};Bs.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var i=this._orderedList[t],s=this._reachability[i];n.push([i,s])}return n};Bs.prototype._init=function(n,t,e,i){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),i&&(this.distance=i)};Bs.prototype._updateQueue=function(n,t,e){var i=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(i._processed[s]===void 0){var u=i.distance(i.dataset[n],i.dataset[s]),c=Math.max(i._coreDistance,u);i._reachability[s]===void 0?(i._reachability[s]=c,e.insert(s,c)):c<i._reachability[s]&&(i._reachability[s]=c,e.remove(s),e.insert(s,c))}})};Bs.prototype._expandCluster=function(n,t){for(var e=t.getElements(),i=0,s=e.length;i<s;i++){var u=e[i];if(this._processed[u]===void 0){var c=this._regionQuery(u);this._processed[u]=1,this.clusters[n].push(u),this._orderedList.push(u),this._distanceToCore(u)!==void 0&&(this._updateQueue(u,c,t),this._expandCluster(n,t))}}};Bs.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var i=this._regionQuery(n,e);if(i.length>=this.minPts)return e}};Bs.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],i=0,s=this.dataset.length;i<s;i++)this.distance(this.dataset[n],this.dataset[i])<t&&e.push(i);return e};Bs.prototype._euclideanDistance=function(n,t){for(var e=0,i=Math.min(n.length,t.length);i--;)e+=(n[i]-t[i])*(n[i]-t[i]);return Math.sqrt(e)};typeof tc!="undefined"&&tc.exports&&(tc.exports=Bs)});var b2=X((Bgt,ig)=>{typeof ig!="undefined"&&ig.exports&&(ig.exports={DBSCAN:E2(),KMEANS:S2(),OPTICS:M2(),PriorityQueue:Ox()})});var Dx=X((Hgt,T2)=>{"use strict";T2.exports={eudist:function(t,e,i){for(var s=t.length,u=0,c=0;c<s;c++){var f=(t[c]||0)-(e[c]||0);u+=f*f}return i?Math.sqrt(u):u},mandist:function(t,e,i){for(var s=t.length,u=0,c=0;c<s;c++)u+=Math.abs((t[c]||0)-(e[c]||0));return i?Math.sqrt(u):u},dist:function(t,e,i){var s=Math.abs(t-e);return i?s:s*s}}});var P2=X((Wgt,I2)=>{"use strict";var C2=Dx(),TK=C2.eudist,CK=C2.dist;I2.exports={kmrand:function(t,e){for(var i={},s=[],u=e<<2,c=t.length,f=t[0].length>0;s.length<e&&u-- >0;){var p=t[Math.floor(Math.random()*c)],d=f?p.join("_"):""+p;i[d]||(i[d]=!0,s.push(p))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var i=t[0].length?TK:CK,s=[],u=t.length,c=t[0].length>0,f={},p=t[Math.floor(Math.random()*u)],d=c?p.join("_"):""+p;for(s.push(p),f[d]=!0;s.length<e;){for(var g=[],y=s.length,v=0,E=[],M=0;M<u;M++){for(var A=1/0,_=0;_<y;_++){var x=i(t[M],s[_]);x<=A&&(A=x)}g[M]=A}for(var T=0;T<u;T++)v+=g[T];for(var w=0;w<u;w++)E[w]={i:w,v:t[w],pr:g[w]/v,cs:0};E.sort(function(D,P){return D.pr-P.pr}),E[0].cs=E[0].pr;for(var R=1;R<u;R++)E[R].cs=E[R-1].cs+E[R].pr;for(var B=Math.random(),U=0;U<u-1&&E[U++].cs<B;);s.push(E[U-1].v)}return s}}});var D2=X(($gt,O2)=>{"use strict";var Fx=Dx(),N2=P2(),IK=Fx.eudist,Xgt=Fx.mandist,Ygt=Fx.dist,PK=N2.kmrand,RK=N2.kmpp,R2=1e4;function L2(n,t,e){e=e||[];for(var i=0;i<n;i++)e[i]=t;return e}function LK(n,t,e,i){var s=[],u=[],c=[],f=[],p=!1,d=i||R2,g=n.length,y=n[0].length,v=y>0,E=[];if(e)e=="kmrand"?s=PK(n,t):e=="kmpp"?s=RK(n,t):s=e;else for(var M={};s.length<t;){var A=Math.floor(Math.random()*g);M[A]||(M[A]=!0,s.push(n[A]))}do{L2(t,0,E);for(var _=0;_<g;_++){for(var x=1/0,T=0,w=0;w<t;w++){var f=v?IK(n[_],s[w]):Math.abs(n[_]-s[w]);f<=x&&(x=f,T=w)}c[_]=T,E[T]++}for(var R=[],u=[],B=0,U=0;U<t;U++)R[U]=v?L2(y,0,R[U]):0,u[U]=s[U];if(v){for(var D=0;D<t;D++)s[D]=[];for(var P=0;P<g;P++)for(var ct=c[P],L=R[ct],W=n[P],V=0;V<y;V++)L[V]+=W[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var $=s[Mt],gt=R[Mt],ft=u[Mt],vt=E[Mt],it=0;it<y;it++)$[it]=gt[it]/vt||0;if(p){for(var lt=0;lt<y;lt++)if(ft[lt]!=$[lt]){p=!1;break}}}}else{for(var H=0;H<g;H++){var At=c[H];R[At]+=n[H]}for(var It=0;It<t;It++)s[It]=R[It]/E[It]||0;p=!0;for(var Kt=0;Kt<t;Kt++)if(u[Kt]!=s[Kt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:R2-d,k:t,idxs:c,centroids:s}}O2.exports=LK});var oc=X((qx,Vx)=>{(function(n,t){typeof qx=="object"&&typeof Vx!="undefined"?Vx.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(qx,function(){"use strict";function n(j,b){var I={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},F,k,G,rt;return rt={next:tt(0),throw:tt(1),return:tt(2)},typeof Symbol=="function"&&(rt[Symbol.iterator]=function(){return this}),rt;function tt(ht){return function(O){return pt([ht,O])}}function pt(ht){if(F)throw new TypeError("Generator is already executing.");for(;I;)try{if(F=1,k&&(G=ht[0]&2?k.return:ht[0]?k.throw||((G=k.return)&&G.call(k),0):k.next)&&!(G=G.call(k,ht[1])).done)return G;switch(k=0,G&&(ht=[ht[0]&2,G.value]),ht[0]){case 0:case 1:G=ht;break;case 4:return I.label++,{value:ht[1],done:!1};case 5:I.label++,k=ht[1],ht=[0];continue;case 7:ht=I.ops.pop(),I.trys.pop();continue;default:if(G=I.trys,!(G=G.length>0&&G[G.length-1])&&(ht[0]===6||ht[0]===2)){I=0;continue}if(ht[0]===3&&(!G||ht[1]>G[0]&&ht[1]<G[3])){I.label=ht[1];break}if(ht[0]===6&&I.label<G[1]){I.label=G[1],G=ht;break}if(G&&I.label<G[2]){I.label=G[2],I.ops.push(ht);break}G[2]&&I.ops.pop(),I.trys.pop();continue}ht=b.call(j,I)}catch(O){ht=[6,O],k=0}finally{F=G=0}if(ht[0]&5)throw ht[1];return{value:ht[0]?ht[1]:void 0,done:!0}}}var t=function(){function j(b,I){this.next=null,this.key=b,this.data=I,this.left=null,this.right=null}return j}();function e(j,b){return j>b?1:j<b?-1:0}function i(j,b,I){for(var F=new t(null,null),k=F,G=F;;){var rt=I(j,b.key);if(rt<0){if(b.left===null)break;if(I(j,b.left.key)<0){var tt=b.left;if(b.left=tt.right,tt.right=b,b=tt,b.left===null)break}G.left=b,G=b,b=b.left}else if(rt>0){if(b.right===null)break;if(I(j,b.right.key)>0){var tt=b.right;if(b.right=tt.left,tt.left=b,b=tt,b.right===null)break}k.right=b,k=b,b=b.right}else break}return k.right=b.left,G.left=b.right,b.left=F.right,b.right=F.left,b}function s(j,b,I,F){var k=new t(j,b);if(I===null)return k.left=k.right=null,k;I=i(j,I,F);var G=F(j,I.key);return G<0?(k.left=I.left,k.right=I,I.left=null):G>=0&&(k.right=I.right,k.left=I,I.right=null),k}function u(j,b,I){var F=null,k=null;if(b){b=i(j,b,I);var G=I(b.key,j);G===0?(F=b.left,k=b.right):G<0?(k=b.right,b.right=null,F=b):(F=b.left,b.left=null,k=b)}return{left:F,right:k}}function c(j,b,I){return b===null?j:(j===null||(b=i(j.key,b,I),b.left=j),b)}function f(j,b,I,F,k){if(j){F(""+b+(I?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+k(j)+`
4
4
  `);var G=b+(I?" ":"\u2502 ");j.left&&f(j.left,G,!1,F,k),j.right&&f(j.right,G,!0,F,k)}}var p=function(){function j(b){b===void 0&&(b=e),this._root=null,this._size=0,this._comparator=b}return j.prototype.insert=function(b,I){return this._size++,this._root=s(b,I,this._root,this._comparator)},j.prototype.add=function(b,I){var F=new t(b,I);this._root===null&&(F.left=F.right=null,this._size++,this._root=F);var k=this._comparator,G=i(b,this._root,k),rt=k(b,G.key);return rt===0?this._root=G:(rt<0?(F.left=G.left,F.right=G,G.left=null):rt>0&&(F.right=G.right,F.left=G,G.right=null),this._size++,this._root=F),this._root},j.prototype.remove=function(b){this._root=this._remove(b,this._root,this._comparator)},j.prototype._remove=function(b,I,F){var k;if(I===null)return null;I=i(b,I,F);var G=F(b,I.key);return G===0?(I.left===null?k=I.right:(k=i(b,I.left,F),k.right=I.right),this._size--,k):I},j.prototype.pop=function(){var b=this._root;if(b){for(;b.left;)b=b.left;return this._root=i(b.key,this._root,this._comparator),this._root=this._remove(b.key,this._root,this._comparator),{key:b.key,data:b.data}}return null},j.prototype.findStatic=function(b){for(var I=this._root,F=this._comparator;I;){var k=F(b,I.key);if(k===0)return I;k<0?I=I.left:I=I.right}return null},j.prototype.find=function(b){return this._root&&(this._root=i(b,this._root,this._comparator),this._comparator(b,this._root.key)!==0)?null:this._root},j.prototype.contains=function(b){for(var I=this._root,F=this._comparator;I;){var k=F(b,I.key);if(k===0)return!0;k<0?I=I.left:I=I.right}return!1},j.prototype.forEach=function(b,I){for(var F=this._root,k=[],G=!1;!G;)F!==null?(k.push(F),F=F.left):k.length!==0?(F=k.pop(),b.call(I,F),F=F.right):G=!0;return this},j.prototype.range=function(b,I,F,k){for(var G=[],rt=this._comparator,tt=this._root,pt;G.length!==0||tt;)if(tt)G.push(tt),tt=tt.left;else{if(tt=G.pop(),pt=rt(tt.key,I),pt>0)break;if(rt(tt.key,b)>=0&&F.call(k,tt))return this;tt=tt.right}return this},j.prototype.keys=function(){var b=[];return this.forEach(function(I){var F=I.key;return b.push(F)}),b},j.prototype.values=function(){var b=[];return this.forEach(function(I){var F=I.data;return b.push(F)}),b},j.prototype.min=function(){return this._root?this.minNode(this._root).key:null},j.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},j.prototype.minNode=function(b){if(b===void 0&&(b=this._root),b)for(;b.left;)b=b.left;return b},j.prototype.maxNode=function(b){if(b===void 0&&(b=this._root),b)for(;b.right;)b=b.right;return b},j.prototype.at=function(b){for(var I=this._root,F=!1,k=0,G=[];!F;)if(I)G.push(I),I=I.left;else if(G.length>0){if(I=G.pop(),k===b)return I;k++,I=I.right}else F=!0;return null},j.prototype.next=function(b){var I=this._root,F=null;if(b.right){for(F=b.right;F.left;)F=F.left;return F}for(var k=this._comparator;I;){var G=k(b.key,I.key);if(G===0)break;G<0?(F=I,I=I.left):I=I.right}return F},j.prototype.prev=function(b){var I=this._root,F=null;if(b.left!==null){for(F=b.left;F.right;)F=F.right;return F}for(var k=this._comparator;I;){var G=k(b.key,I.key);if(G===0)break;G<0?I=I.left:(F=I,I=I.right)}return F},j.prototype.clear=function(){return this._root=null,this._size=0,this},j.prototype.toList=function(){return y(this._root)},j.prototype.load=function(b,I,F){I===void 0&&(I=[]),F===void 0&&(F=!1);var k=b.length,G=this._comparator;if(F&&M(b,I,0,k-1,G),this._root===null)this._root=d(b,I,0,k),this._size=k;else{var rt=E(this.toList(),g(b,I),G);k=this._size+k,this._root=v({head:rt},0,k)}return this},j.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(j.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(j.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),j.prototype.toString=function(b){b===void 0&&(b=function(F){return String(F.key)});var I=[];return f(this._root,"",!0,function(F){return I.push(F)},b),I.join("")},j.prototype.update=function(b,I,F){var k=this._comparator,G=u(b,this._root,k),rt=G.left,tt=G.right;k(b,I)<0?tt=s(I,F,tt,k):rt=s(I,F,rt,k),this._root=c(rt,tt,k)},j.prototype.split=function(b){return u(b,this._root,this._comparator)},j.prototype[Symbol.iterator]=function(){var b,I,F;return n(this,function(k){switch(k.label){case 0:b=this._root,I=[],F=!1,k.label=1;case 1:return F?[3,6]:b===null?[3,2]:(I.push(b),b=b.left,[3,5]);case 2:return I.length===0?[3,4]:(b=I.pop(),[4,b]);case 3:return k.sent(),b=b.right,[3,5];case 4:F=!0,k.label=5;case 5:return[3,1];case 6:return[2]}})},j}();function d(j,b,I,F){var k=F-I;if(k>0){var G=I+Math.floor(k/2),rt=j[G],tt=b[G],pt=new t(rt,tt);return pt.left=d(j,b,I,G),pt.right=d(j,b,G+1,F),pt}return null}function g(j,b){for(var I=new t(null,null),F=I,k=0;k<j.length;k++)F=F.next=new t(j[k],b[k]);return F.next=null,I.next}function y(j){for(var b=j,I=[],F=!1,k=new t(null,null),G=k;!F;)b?(I.push(b),b=b.left):I.length>0?(b=G=G.next=I.pop(),b=b.right):F=!0;return G.next=null,k.next}function v(j,b,I){var F=I-b;if(F>0){var k=b+Math.floor(F/2),G=v(j,b,k),rt=j.head;return rt.left=G,j.head=j.head.next,rt.right=v(j,k+1,I),rt}return null}function E(j,b,I){for(var F=new t(null,null),k=F,G=j,rt=b;G!==null&&rt!==null;)I(G.key,rt.key)<0?(k.next=G,G=G.next):(k.next=rt,rt=rt.next),k=k.next;return G!==null?k.next=G:rt!==null&&(k.next=rt),F.next}function M(j,b,I,F,k){if(!(I>=F)){for(var G=j[I+F>>1],rt=I-1,tt=F+1;;){do rt++;while(k(j[rt],G)<0);do tt--;while(k(j[tt],G)>0);if(rt>=tt)break;var pt=j[rt];j[rt]=j[tt],j[tt]=pt,pt=b[rt],b[rt]=b[tt],b[tt]=pt}M(j,b,I,tt,k),M(j,b,tt+1,F,k)}}let A=(j,b)=>j.ll.x<=b.x&&b.x<=j.ur.x&&j.ll.y<=b.y&&b.y<=j.ur.y,_=(j,b)=>{if(b.ur.x<j.ll.x||j.ur.x<b.ll.x||b.ur.y<j.ll.y||j.ur.y<b.ll.y)return null;let I=j.ll.x<b.ll.x?b.ll.x:j.ll.x,F=j.ur.x<b.ur.x?j.ur.x:b.ur.x,k=j.ll.y<b.ll.y?b.ll.y:j.ll.y,G=j.ur.y<b.ur.y?j.ur.y:b.ur.y;return{ll:{x:I,y:k},ur:{x:F,y:G}}},x=Number.EPSILON;x===void 0&&(x=Math.pow(2,-52));let T=x*x,w=(j,b)=>{if(-x<j&&j<x&&-x<b&&b<x)return 0;let I=j-b;return I*I<T*j*b?0:j<b?-1:1};class R{constructor(){this.reset()}reset(){this.xRounder=new B,this.yRounder=new B}round(b,I){return{x:this.xRounder.round(b),y:this.yRounder.round(I)}}}class B{constructor(){this.tree=new p,this.round(0)}round(b){let I=this.tree.add(b),F=this.tree.prev(I);if(F!==null&&w(I.key,F.key)===0)return this.tree.remove(b),F.key;let k=this.tree.next(I);return k!==null&&w(I.key,k.key)===0?(this.tree.remove(b),k.key):b}}let U=new R,D=11102230246251565e-32,P=134217729,ct=(3+8*D)*D;function L(j,b,I,F,k){let G,rt,tt,pt,ht=b[0],O=F[0],Q=0,J=0;O>ht==O>-ht?(G=ht,ht=b[++Q]):(G=O,O=F[++J]);let et=0;if(Q<j&&J<I)for(O>ht==O>-ht?(rt=ht+G,tt=G-(rt-ht),ht=b[++Q]):(rt=O+G,tt=G-(rt-O),O=F[++J]),G=rt,tt!==0&&(k[et++]=tt);Q<j&&J<I;)O>ht==O>-ht?(rt=G+ht,pt=rt-G,tt=G-(rt-pt)+(ht-pt),ht=b[++Q]):(rt=G+O,pt=rt-G,tt=G-(rt-pt)+(O-pt),O=F[++J]),G=rt,tt!==0&&(k[et++]=tt);for(;Q<j;)rt=G+ht,pt=rt-G,tt=G-(rt-pt)+(ht-pt),ht=b[++Q],G=rt,tt!==0&&(k[et++]=tt);for(;J<I;)rt=G+O,pt=rt-G,tt=G-(rt-pt)+(O-pt),O=F[++J],G=rt,tt!==0&&(k[et++]=tt);return(G!==0||et===0)&&(k[et++]=G),et}function W(j,b){let I=b[0];for(let F=1;F<j;F++)I+=b[F];return I}function V(j){return new Float64Array(j)}let Mt=(3+16*D)*D,$=(2+12*D)*D,gt=(9+64*D)*D*D,ft=V(4),vt=V(8),it=V(12),lt=V(16),H=V(4);function At(j,b,I,F,k,G,rt){let tt,pt,ht,O,Q,J,et,Tt,kt,ie,oe,we,ye,be,Ae,Bn,dr,_n,pe=j-k,xn=I-k,Nn=b-G,Cn=F-G;be=pe*Cn,J=P*pe,et=J-(J-pe),Tt=pe-et,J=P*Cn,kt=J-(J-Cn),ie=Cn-kt,Ae=Tt*ie-(be-et*kt-Tt*kt-et*ie),Bn=Nn*xn,J=P*Nn,et=J-(J-Nn),Tt=Nn-et,J=P*xn,kt=J-(J-xn),ie=xn-kt,dr=Tt*ie-(Bn-et*kt-Tt*kt-et*ie),oe=Ae-dr,Q=Ae-oe,ft[0]=Ae-(oe+Q)+(Q-dr),we=be+oe,Q=we-be,ye=be-(we-Q)+(oe-Q),oe=ye-Bn,Q=ye-oe,ft[1]=ye-(oe+Q)+(Q-Bn),_n=we+oe,Q=_n-we,ft[2]=we-(_n-Q)+(oe-Q),ft[3]=_n;let En=W(4,ft),Kr=$*rt;if(En>=Kr||-En>=Kr||(Q=j-pe,tt=j-(pe+Q)+(Q-k),Q=I-xn,ht=I-(xn+Q)+(Q-k),Q=b-Nn,pt=b-(Nn+Q)+(Q-G),Q=F-Cn,O=F-(Cn+Q)+(Q-G),tt===0&&pt===0&&ht===0&&O===0)||(Kr=gt*rt+ct*Math.abs(En),En+=pe*O+Cn*tt-(Nn*ht+xn*pt),En>=Kr||-En>=Kr))return En;be=tt*Cn,J=P*tt,et=J-(J-tt),Tt=tt-et,J=P*Cn,kt=J-(J-Cn),ie=Cn-kt,Ae=Tt*ie-(be-et*kt-Tt*kt-et*ie),Bn=pt*xn,J=P*pt,et=J-(J-pt),Tt=pt-et,J=P*xn,kt=J-(J-xn),ie=xn-kt,dr=Tt*ie-(Bn-et*kt-Tt*kt-et*ie),oe=Ae-dr,Q=Ae-oe,H[0]=Ae-(oe+Q)+(Q-dr),we=be+oe,Q=we-be,ye=be-(we-Q)+(oe-Q),oe=ye-Bn,Q=ye-oe,H[1]=ye-(oe+Q)+(Q-Bn),_n=we+oe,Q=_n-we,H[2]=we-(_n-Q)+(oe-Q),H[3]=_n;let Ar=L(4,ft,4,H,vt);be=pe*O,J=P*pe,et=J-(J-pe),Tt=pe-et,J=P*O,kt=J-(J-O),ie=O-kt,Ae=Tt*ie-(be-et*kt-Tt*kt-et*ie),Bn=Nn*ht,J=P*Nn,et=J-(J-Nn),Tt=Nn-et,J=P*ht,kt=J-(J-ht),ie=ht-kt,dr=Tt*ie-(Bn-et*kt-Tt*kt-et*ie),oe=Ae-dr,Q=Ae-oe,H[0]=Ae-(oe+Q)+(Q-dr),we=be+oe,Q=we-be,ye=be-(we-Q)+(oe-Q),oe=ye-Bn,Q=ye-oe,H[1]=ye-(oe+Q)+(Q-Bn),_n=we+oe,Q=_n-we,H[2]=we-(_n-Q)+(oe-Q),H[3]=_n;let q=L(Ar,vt,4,H,it);be=tt*O,J=P*tt,et=J-(J-tt),Tt=tt-et,J=P*O,kt=J-(J-O),ie=O-kt,Ae=Tt*ie-(be-et*kt-Tt*kt-et*ie),Bn=pt*ht,J=P*pt,et=J-(J-pt),Tt=pt-et,J=P*ht,kt=J-(J-ht),ie=ht-kt,dr=Tt*ie-(Bn-et*kt-Tt*kt-et*ie),oe=Ae-dr,Q=Ae-oe,H[0]=Ae-(oe+Q)+(Q-dr),we=be+oe,Q=we-be,ye=be-(we-Q)+(oe-Q),oe=ye-Bn,Q=ye-oe,H[1]=ye-(oe+Q)+(Q-Bn),_n=we+oe,Q=_n-we,H[2]=we-(_n-Q)+(oe-Q),H[3]=_n;let at=L(q,it,4,H,lt);return lt[at-1]}function It(j,b,I,F,k,G){let rt=(b-G)*(I-k),tt=(j-k)*(F-G),pt=rt-tt,ht=Math.abs(rt+tt);return Math.abs(pt)>=Mt*ht?pt:-At(j,b,I,F,k,G,ht)}let Kt=(j,b)=>j.x*b.y-j.y*b.x,nt=(j,b)=>j.x*b.x+j.y*b.y,bt=(j,b,I)=>{let F=It(j.x,j.y,b.x,b.y,I.x,I.y);return F>0?-1:F<0?1:0},Vt=j=>Math.sqrt(nt(j,j)),$t=(j,b,I)=>{let F={x:b.x-j.x,y:b.y-j.y},k={x:I.x-j.x,y:I.y-j.y};return Kt(k,F)/Vt(k)/Vt(F)},Ut=(j,b,I)=>{let F={x:b.x-j.x,y:b.y-j.y},k={x:I.x-j.x,y:I.y-j.y};return nt(k,F)/Vt(k)/Vt(F)},Gt=(j,b,I)=>b.y===0?null:{x:j.x+b.x/b.y*(I-j.y),y:I},Ct=(j,b,I)=>b.x===0?null:{x:I,y:j.y+b.y/b.x*(I-j.x)},ee=(j,b,I,F)=>{if(b.x===0)return Ct(I,F,j.x);if(F.x===0)return Ct(j,b,I.x);if(b.y===0)return Gt(I,F,j.y);if(F.y===0)return Gt(j,b,I.y);let k=Kt(b,F);if(k==0)return null;let G={x:I.x-j.x,y:I.y-j.y},rt=Kt(G,b)/k,tt=Kt(G,F)/k,pt=j.x+tt*b.x,ht=I.x+rt*F.x,O=j.y+tt*b.y,Q=I.y+rt*F.y,J=(pt+ht)/2,et=(O+Q)/2;return{x:J,y:et}};class Z{static compare(b,I){let F=Z.comparePoints(b.point,I.point);return F!==0?F:(b.point!==I.point&&b.link(I),b.isLeft!==I.isLeft?b.isLeft?1:-1:_t.compare(b.segment,I.segment))}static comparePoints(b,I){return b.x<I.x?-1:b.x>I.x?1:b.y<I.y?-1:b.y>I.y?1:0}constructor(b,I){b.events===void 0?b.events=[this]:b.events.push(this),this.point=b,this.isLeft=I}link(b){if(b.point===this.point)throw new Error("Tried to link already linked events");let I=b.point.events;for(let F=0,k=I.length;F<k;F++){let G=I[F];this.point.events.push(G),G.point=this.point}this.checkForConsuming()}checkForConsuming(){let b=this.point.events.length;for(let I=0;I<b;I++){let F=this.point.events[I];if(F.segment.consumedBy===void 0)for(let k=I+1;k<b;k++){let G=this.point.events[k];G.consumedBy===void 0&&F.otherSE.point.events===G.otherSE.point.events&&F.segment.consume(G.segment)}}}getAvailableLinkedEvents(){let b=[];for(let I=0,F=this.point.events.length;I<F;I++){let k=this.point.events[I];k!==this&&!k.segment.ringOut&&k.segment.isInResult()&&b.push(k)}return b}getLeftmostComparator(b){let I=new Map,F=k=>{let G=k.otherSE;I.set(k,{sine:$t(this.point,b.point,G.point),cosine:Ut(this.point,b.point,G.point)})};return(k,G)=>{I.has(k)||F(k),I.has(G)||F(G);let{sine:rt,cosine:tt}=I.get(k),{sine:pt,cosine:ht}=I.get(G);return rt>=0&&pt>=0?tt<ht?1:tt>ht?-1:0:rt<0&&pt<0?tt<ht?-1:tt>ht?1:0:pt<rt?-1:pt>rt?1:0}}}let Dt=0;class _t{static compare(b,I){let F=b.leftSE.point.x,k=I.leftSE.point.x,G=b.rightSE.point.x,rt=I.rightSE.point.x;if(rt<F)return 1;if(G<k)return-1;let tt=b.leftSE.point.y,pt=I.leftSE.point.y,ht=b.rightSE.point.y,O=I.rightSE.point.y;if(F<k){if(pt<tt&&pt<ht)return 1;if(pt>tt&&pt>ht)return-1;let Q=b.comparePoint(I.leftSE.point);if(Q<0)return 1;if(Q>0)return-1;let J=I.comparePoint(b.rightSE.point);return J!==0?J:-1}if(F>k){if(tt<pt&&tt<O)return-1;if(tt>pt&&tt>O)return 1;let Q=I.comparePoint(b.leftSE.point);if(Q!==0)return Q;let J=b.comparePoint(I.rightSE.point);return J<0?1:J>0?-1:1}if(tt<pt)return-1;if(tt>pt)return 1;if(G<rt){let Q=I.comparePoint(b.rightSE.point);if(Q!==0)return Q}if(G>rt){let Q=b.comparePoint(I.rightSE.point);if(Q<0)return 1;if(Q>0)return-1}if(G!==rt){let Q=ht-tt,J=G-F,et=O-pt,Tt=rt-k;if(Q>J&&et<Tt)return 1;if(Q<J&&et>Tt)return-1}return G>rt?1:G<rt||ht<O?-1:ht>O?1:b.id<I.id?-1:b.id>I.id?1:0}constructor(b,I,F,k){this.id=++Dt,this.leftSE=b,b.segment=this,b.otherSE=I,this.rightSE=I,I.segment=this,I.otherSE=b,this.rings=F,this.windings=k}static fromRing(b,I,F){let k,G,rt,tt=Z.comparePoints(b,I);if(tt<0)k=b,G=I,rt=1;else if(tt>0)k=I,G=b,rt=-1;else throw new Error(`Tried to create degenerate segment at [${b.x}, ${b.y}]`);let pt=new Z(k,!0),ht=new Z(G,!1);return new _t(pt,ht,[F],[rt])}replaceRightSE(b){this.rightSE=b,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let b=this.leftSE.point.y,I=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:b<I?b:I},ur:{x:this.rightSE.point.x,y:b>I?b:I}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(b){return b.x===this.leftSE.point.x&&b.y===this.leftSE.point.y||b.x===this.rightSE.point.x&&b.y===this.rightSE.point.y}comparePoint(b){if(this.isAnEndpoint(b))return 0;let I=this.leftSE.point,F=this.rightSE.point,k=this.vector();if(I.x===F.x)return b.x===I.x?0:b.x<I.x?1:-1;let G=(b.y-I.y)/k.y,rt=I.x+G*k.x;if(b.x===rt)return 0;let tt=(b.x-I.x)/k.x,pt=I.y+tt*k.y;return b.y===pt?0:b.y<pt?-1:1}getIntersection(b){let I=this.bbox(),F=b.bbox(),k=_(I,F);if(k===null)return null;let G=this.leftSE.point,rt=this.rightSE.point,tt=b.leftSE.point,pt=b.rightSE.point,ht=A(I,tt)&&this.comparePoint(tt)===0,O=A(F,G)&&b.comparePoint(G)===0,Q=A(I,pt)&&this.comparePoint(pt)===0,J=A(F,rt)&&b.comparePoint(rt)===0;if(O&&ht)return J&&!Q?rt:!J&&Q?pt:null;if(O)return Q&&G.x===pt.x&&G.y===pt.y?null:G;if(ht)return J&&rt.x===tt.x&&rt.y===tt.y?null:tt;if(J&&Q)return null;if(J)return rt;if(Q)return pt;let et=ee(G,this.vector(),tt,b.vector());return et===null||!A(k,et)?null:U.round(et.x,et.y)}split(b){let I=[],F=b.events!==void 0,k=new Z(b,!0),G=new Z(b,!1),rt=this.rightSE;this.replaceRightSE(G),I.push(G),I.push(k);let tt=new _t(k,rt,this.rings.slice(),this.windings.slice());return Z.comparePoints(tt.leftSE.point,tt.rightSE.point)>0&&tt.swapEvents(),Z.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),F&&(k.checkForConsuming(),G.checkForConsuming()),I}swapEvents(){let b=this.rightSE;this.rightSE=this.leftSE,this.leftSE=b,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let I=0,F=this.windings.length;I<F;I++)this.windings[I]*=-1}consume(b){let I=this,F=b;for(;I.consumedBy;)I=I.consumedBy;for(;F.consumedBy;)F=F.consumedBy;let k=_t.compare(I,F);if(k!==0){if(k>0){let G=I;I=F,F=G}if(I.prev===F){let G=I;I=F,F=G}for(let G=0,rt=F.rings.length;G<rt;G++){let tt=F.rings[G],pt=F.windings[G],ht=I.rings.indexOf(tt);ht===-1?(I.rings.push(tt),I.windings.push(pt)):I.windings[ht]+=pt}F.rings=null,F.windings=null,F.consumedBy=I,F.leftSE.consumedBy=I.leftSE,F.rightSE.consumedBy=I.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 b=this.prev.consumedBy||this.prev;this._beforeState=b.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let b=this.beforeState();this._afterState={rings:b.rings.slice(0),windings:b.windings.slice(0),multiPolys:[]};let I=this._afterState.rings,F=this._afterState.windings,k=this._afterState.multiPolys;for(let tt=0,pt=this.rings.length;tt<pt;tt++){let ht=this.rings[tt],O=this.windings[tt],Q=I.indexOf(ht);Q===-1?(I.push(ht),F.push(O)):F[Q]+=O}let G=[],rt=[];for(let tt=0,pt=I.length;tt<pt;tt++){if(F[tt]===0)continue;let ht=I[tt],O=ht.poly;if(rt.indexOf(O)===-1)if(ht.isExterior)G.push(O);else{rt.indexOf(O)===-1&&rt.push(O);let Q=G.indexOf(ht.poly);Q!==-1&&G.splice(Q,1)}}for(let tt=0,pt=G.length;tt<pt;tt++){let ht=G[tt].multiPoly;k.indexOf(ht)===-1&&k.push(ht)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let b=this.beforeState().multiPolys,I=this.afterState().multiPolys;switch(ot.type){case"union":{let F=b.length===0,k=I.length===0;this._isInResult=F!==k;break}case"intersection":{let F,k;b.length<I.length?(F=b.length,k=I.length):(F=I.length,k=b.length),this._isInResult=k===ot.numMultiPolys&&F<k;break}case"xor":{let F=Math.abs(b.length-I.length);this._isInResult=F%2===1;break}case"difference":{let F=k=>k.length===1&&k[0].isSubject;this._isInResult=F(b)!==F(I);break}default:throw new Error(`Unrecognized operation type found ${ot.type}`)}return this._isInResult}}class Nt{constructor(b,I,F){if(!Array.isArray(b)||b.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=I,this.isExterior=F,this.segments=[],typeof b[0][0]!="number"||typeof b[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let k=U.round(b[0][0],b[0][1]);this.bbox={ll:{x:k.x,y:k.y},ur:{x:k.x,y:k.y}};let G=k;for(let rt=1,tt=b.length;rt<tt;rt++){if(typeof b[rt][0]!="number"||typeof b[rt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let pt=U.round(b[rt][0],b[rt][1]);pt.x===G.x&&pt.y===G.y||(this.segments.push(_t.fromRing(G,pt,this)),pt.x<this.bbox.ll.x&&(this.bbox.ll.x=pt.x),pt.y<this.bbox.ll.y&&(this.bbox.ll.y=pt.y),pt.x>this.bbox.ur.x&&(this.bbox.ur.x=pt.x),pt.y>this.bbox.ur.y&&(this.bbox.ur.y=pt.y),G=pt)}(k.x!==G.x||k.y!==G.y)&&this.segments.push(_t.fromRing(G,k,this))}getSweepEvents(){let b=[];for(let I=0,F=this.segments.length;I<F;I++){let k=this.segments[I];b.push(k.leftSE),b.push(k.rightSE)}return b}}class wt{constructor(b,I){if(!Array.isArray(b))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Nt(b[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 F=1,k=b.length;F<k;F++){let G=new Nt(b[F],this,!1);G.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=G.bbox.ll.x),G.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=G.bbox.ll.y),G.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=G.bbox.ur.x),G.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=G.bbox.ur.y),this.interiorRings.push(G)}this.multiPoly=I}getSweepEvents(){let b=this.exteriorRing.getSweepEvents();for(let I=0,F=this.interiorRings.length;I<F;I++){let k=this.interiorRings[I].getSweepEvents();for(let G=0,rt=k.length;G<rt;G++)b.push(k[G])}return b}}class Ht{constructor(b,I){if(!Array.isArray(b))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof b[0][0][0]=="number"&&(b=[b])}catch(F){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let F=0,k=b.length;F<k;F++){let G=new wt(b[F],this);G.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=G.bbox.ll.x),G.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=G.bbox.ll.y),G.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=G.bbox.ur.x),G.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=G.bbox.ur.y),this.polys.push(G)}this.isSubject=I}getSweepEvents(){let b=[];for(let I=0,F=this.polys.length;I<F;I++){let k=this.polys[I].getSweepEvents();for(let G=0,rt=k.length;G<rt;G++)b.push(k[G])}return b}}class Xt{static factory(b){let I=[];for(let F=0,k=b.length;F<k;F++){let G=b[F];if(!G.isInResult()||G.ringOut)continue;let rt=null,tt=G.leftSE,pt=G.rightSE,ht=[tt],O=tt.point,Q=[];for(;rt=tt,tt=pt,ht.push(tt),tt.point!==O;)for(;;){let J=tt.getAvailableLinkedEvents();if(J.length===0){let kt=ht[0].point,ie=ht[ht.length-1].point;throw new Error(`Unable to complete output ring starting at [${kt.x}, ${kt.y}]. Last matching segment found ends at [${ie.x}, ${ie.y}].`)}if(J.length===1){pt=J[0].otherSE;break}let et=null;for(let kt=0,ie=Q.length;kt<ie;kt++)if(Q[kt].point===tt.point){et=kt;break}if(et!==null){let kt=Q.splice(et)[0],ie=ht.splice(kt.index);ie.unshift(ie[0].otherSE),I.push(new Xt(ie.reverse()));continue}Q.push({index:ht.length,point:tt.point});let Tt=tt.getLeftmostComparator(rt);pt=J.sort(Tt)[0].otherSE;break}I.push(new Xt(ht))}return I}constructor(b){this.events=b;for(let I=0,F=b.length;I<F;I++)b[I].segment.ringOut=this;this.poly=null}getGeom(){let b=this.events[0].point,I=[b];for(let ht=1,O=this.events.length-1;ht<O;ht++){let Q=this.events[ht].point,J=this.events[ht+1].point;bt(Q,b,J)!==0&&(I.push(Q),b=Q)}if(I.length===1)return null;let F=I[0],k=I[1];bt(F,b,k)===0&&I.shift(),I.push(I[0]);let G=this.isExteriorRing()?1:-1,rt=this.isExteriorRing()?0:I.length-1,tt=this.isExteriorRing()?I.length:-1,pt=[];for(let ht=rt;ht!=tt;ht+=G)pt.push([I[ht].x,I[ht].y]);return pt}isExteriorRing(){if(this._isExteriorRing===void 0){let b=this.enclosingRing();this._isExteriorRing=b?!b.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let b=this.events[0];for(let k=1,G=this.events.length;k<G;k++){let rt=this.events[k];Z.compare(b,rt)>0&&(b=rt)}let I=b.segment.prevInResult(),F=I?I.prevInResult():null;for(;;){if(!I)return null;if(!F)return I.ringOut;if(F.ringOut!==I.ringOut)return F.ringOut.enclosingRing()!==I.ringOut?I.ringOut:I.ringOut.enclosingRing();I=F.prevInResult(),F=I?I.prevInResult():null}}}class Pt{constructor(b){this.exteriorRing=b,b.poly=this,this.interiorRings=[]}addInterior(b){this.interiorRings.push(b),b.poly=this}getGeom(){let b=[this.exteriorRing.getGeom()];if(b[0]===null)return null;for(let I=0,F=this.interiorRings.length;I<F;I++){let k=this.interiorRings[I].getGeom();k!==null&&b.push(k)}return b}}class ne{constructor(b){this.rings=b,this.polys=this._composePolys(b)}getGeom(){let b=[];for(let I=0,F=this.polys.length;I<F;I++){let k=this.polys[I].getGeom();k!==null&&b.push(k)}return b}_composePolys(b){let I=[];for(let F=0,k=b.length;F<k;F++){let G=b[F];if(!G.poly)if(G.isExteriorRing())I.push(new Pt(G));else{let rt=G.enclosingRing();rt.poly||I.push(new Pt(rt)),rt.poly.addInterior(G)}}return I}}class Y{constructor(b){let I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_t.compare;this.queue=b,this.tree=new p(I),this.segments=[]}process(b){let I=b.segment,F=[];if(b.consumedBy)return b.isLeft?this.queue.remove(b.otherSE):this.tree.remove(I),F;let k=b.isLeft?this.tree.add(I):this.tree.find(I);if(!k)throw new Error(`Unable to find segment #${I.id} [${I.leftSE.point.x}, ${I.leftSE.point.y}] -> [${I.rightSE.point.x}, ${I.rightSE.point.y}] in SweepLine tree.`);let G=k,rt=k,tt,pt;for(;tt===void 0;)G=this.tree.prev(G),G===null?tt=null:G.key.consumedBy===void 0&&(tt=G.key);for(;pt===void 0;)rt=this.tree.next(rt),rt===null?pt=null:rt.key.consumedBy===void 0&&(pt=rt.key);if(b.isLeft){let ht=null;if(tt){let Q=tt.getIntersection(I);if(Q!==null&&(I.isAnEndpoint(Q)||(ht=Q),!tt.isAnEndpoint(Q))){let J=this._splitSafely(tt,Q);for(let et=0,Tt=J.length;et<Tt;et++)F.push(J[et])}}let O=null;if(pt){let Q=pt.getIntersection(I);if(Q!==null&&(I.isAnEndpoint(Q)||(O=Q),!pt.isAnEndpoint(Q))){let J=this._splitSafely(pt,Q);for(let et=0,Tt=J.length;et<Tt;et++)F.push(J[et])}}if(ht!==null||O!==null){let Q=null;ht===null?Q=O:O===null?Q=ht:Q=Z.comparePoints(ht,O)<=0?ht:O,this.queue.remove(I.rightSE),F.push(I.rightSE);let J=I.split(Q);for(let et=0,Tt=J.length;et<Tt;et++)F.push(J[et])}F.length>0?(this.tree.remove(I),F.push(b)):(this.segments.push(I),I.prev=tt)}else{if(tt&&pt){let ht=tt.getIntersection(pt);if(ht!==null){if(!tt.isAnEndpoint(ht)){let O=this._splitSafely(tt,ht);for(let Q=0,J=O.length;Q<J;Q++)F.push(O[Q])}if(!pt.isAnEndpoint(ht)){let O=this._splitSafely(pt,ht);for(let Q=0,J=O.length;Q<J;Q++)F.push(O[Q])}}}this.tree.remove(I)}return F}_splitSafely(b,I){this.tree.remove(b);let F=b.rightSE;this.queue.remove(F);let k=b.split(I);return k.push(F),b.consumedBy===void 0&&this.tree.add(b),k}}let N=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class St{run(b,I,F){ot.type=b,U.reset();let k=[new Ht(I,!0)];for(let Q=0,J=F.length;Q<J;Q++)k.push(new Ht(F[Q],!1));if(ot.numMultiPolys=k.length,ot.type==="difference"){let Q=k[0],J=1;for(;J<k.length;)_(k[J].bbox,Q.bbox)!==null?J++:k.splice(J,1)}if(ot.type==="intersection")for(let Q=0,J=k.length;Q<J;Q++){let et=k[Q];for(let Tt=Q+1,kt=k.length;Tt<kt;Tt++)if(_(et.bbox,k[Tt].bbox)===null)return[]}let G=new p(Z.compare);for(let Q=0,J=k.length;Q<J;Q++){let et=k[Q].getSweepEvents();for(let Tt=0,kt=et.length;Tt<kt;Tt++)if(G.insert(et[Tt]),G.size>N)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let rt=new Y(G),tt=G.size,pt=G.pop();for(;pt;){let Q=pt.key;if(G.size===tt){let et=Q.segment;throw new Error(`Unable to pop() ${Q.isLeft?"left":"right"} SweepEvent [${Q.point.x}, ${Q.point.y}] from segment #${et.id} [${et.leftSE.point.x}, ${et.leftSE.point.y}] -> [${et.rightSE.point.x}, ${et.rightSE.point.y}] from queue.`)}if(G.size>N)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(rt.segments.length>xt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let J=rt.process(Q);for(let et=0,Tt=J.length;et<Tt;et++){let kt=J[et];kt.consumedBy===void 0&&G.insert(kt)}tt=G.size,pt=G.pop()}U.reset();let ht=Xt.factory(rt.segments);return new ne(ht).getGeom()}}let ot=new St;var Wt={union:function(j){for(var b=arguments.length,I=new Array(b>1?b-1:0),F=1;F<b;F++)I[F-1]=arguments[F];return ot.run("union",j,I)},intersection:function(j){for(var b=arguments.length,I=new Array(b>1?b-1:0),F=1;F<b;F++)I[F-1]=arguments[F];return ot.run("intersection",j,I)},xor:function(j){for(var b=arguments.length,I=new Array(b>1?b-1:0),F=1;F<b;F++)I[F-1]=arguments[F];return ot.run("xor",j,I)},difference:function(j){for(var b=arguments.length,I=new Array(b>1?b-1:0),F=1;F<b;F++)I[F-1]=arguments[F];return ot.run("difference",j,I)}};return Wt})});var tO=X((ug,Q2)=>{(function(n,t){typeof ug=="object"&&typeof Q2!="undefined"?t(ug):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(ug,function(n){"use strict";function t(){}function e(r){this.message=r||""}function i(r){this.message=r||""}function s(r){this.message=r||""}function u(){}function c(r){return r===null?Ae:r.color}function f(r){return r===null?null:r.parent}function p(r,o){r!==null&&(r.color=o)}function d(r){return r===null?null:r.left}function g(r){return r===null?null:r.right}function y(){this.root_=null,this.size_=0}function v(){}function E(){this.array_=[],arguments[0]instanceof tt&&this.addAll(arguments[0])}function M(){}function A(r){this.message=r||""}function _(){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 o=Object(this),a=Math.max(Math.min(o.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 h=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:a;for(h=h<0?Math.max(a+arguments[2],0):Math.min(h,a);l<h;)o[l]=r,++l;return o},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 x=function(){};x.prototype.interfaces_=function(){return[]},x.prototype.getClass=function(){return x},x.prototype.equalsWithTolerance=function(r,o,a){return Math.abs(r-o)<=a};var T=function(r){function o(a){r.call(this,a),this.name="IllegalArgumentException",this.message=a,this.stack=new r().stack}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o}(Error),w=function(){},R={MAX_VALUE:{configurable:!0}};w.isNaN=function(r){return Number.isNaN(r)},w.doubleToLongBits=function(r){return r},w.longBitsToDouble=function(r){return r},w.isInfinite=function(r){return!Number.isFinite(r)},R.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(w,R);var B=function(){},U=function(){},D=function(){},P=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 o=arguments[0];this.x=o.x,this.y=o.y,this.z=o.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])},ct={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};P.prototype.setOrdinate=function(r,o){switch(r){case P.X:this.x=o;break;case P.Y:this.y=o;break;case P.Z:this.z=o;break;default:throw new T("Invalid ordinate index: "+r)}},P.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 o=arguments[0],a=arguments[1];return!!x.equalsWithTolerance(this.x,o.x,a)&&!!x.equalsWithTolerance(this.y,o.y,a)}},P.prototype.getOrdinate=function(r){switch(r){case P.X:return this.x;case P.Y:return this.y;case P.Z:return this.z}throw new T("Invalid ordinate index: "+r)},P.prototype.equals3D=function(r){return this.x===r.x&&this.y===r.y&&(this.z===r.z||w.isNaN(this.z))&&w.isNaN(r.z)},P.prototype.equals=function(r){return r instanceof P&&this.equals2D(r)},P.prototype.equalInZ=function(r,o){return x.equalsWithTolerance(this.z,r.z,o)},P.prototype.compareTo=function(r){var o=r;return this.x<o.x?-1:this.x>o.x?1:this.y<o.y?-1:this.y>o.y?1:0},P.prototype.clone=function(){},P.prototype.copy=function(){return new P(this)},P.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},P.prototype.distance3D=function(r){var o=this.x-r.x,a=this.y-r.y,l=this.z-r.z;return Math.sqrt(o*o+a*a+l*l)},P.prototype.distance=function(r){var o=this.x-r.x,a=this.y-r.y;return Math.sqrt(o*o+a*a)},P.prototype.hashCode=function(){var r=17;return r=37*r+P.hashCode(this.x),r=37*r+P.hashCode(this.y)},P.prototype.setCoordinate=function(r){this.x=r.x,this.y=r.y,this.z=r.z},P.prototype.interfaces_=function(){return[B,U,t]},P.prototype.getClass=function(){return P},P.hashCode=function(){if(arguments.length===1){var r=arguments[0],o=w.doubleToLongBits(r);return Math.trunc((o^o)>>>32)}},ct.DimensionalComparator.get=function(){return L},ct.serialVersionUID.get=function(){return 6683108902428367e3},ct.NULL_ORDINATE.get=function(){return w.NaN},ct.X.get=function(){return 0},ct.Y.get=function(){return 1},ct.Z.get=function(){return 2},Object.defineProperties(P,ct);var L=function(r){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var o=arguments[0];if(o!==2&&o!==3)throw new T("only 2 or 3 dimensions may be specified");this._dimensionsToTest=o}}};L.prototype.compare=function(r,o){var a=r,l=o,h=L.compare(a.x,l.x);if(h!==0)return h;var m=L.compare(a.y,l.y);return m!==0?m:this._dimensionsToTest<=2?0:L.compare(a.z,l.z)},L.prototype.interfaces_=function(){return[D]},L.prototype.getClass=function(){return L},L.compare=function(r,o){return r<o?-1:r>o?1:w.isNaN(r)?w.isNaN(o)?0:-1:w.isNaN(o)?1:0};var W=function(){};W.prototype.create=function(){},W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W};var V=function(){},Mt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(r){switch(r){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new T("Unknown location value: "+r)},Mt.INTERIOR.get=function(){return 0},Mt.BOUNDARY.get=function(){return 1},Mt.EXTERIOR.get=function(){return 2},Mt.NONE.get=function(){return-1},Object.defineProperties(V,Mt);var $=function(r,o){return r.interfaces_&&r.interfaces_().indexOf(o)>-1},gt=function(){},ft={LOG_10:{configurable:!0}};gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt},gt.log10=function(r){var o=Math.log(r);return w.isInfinite(o)||w.isNaN(o)?o:o/gt.LOG_10},gt.min=function(r,o,a,l){var h=r;return o<h&&(h=o),a<h&&(h=a),l<h&&(h=l),h},gt.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],o=arguments[1],a=arguments[2];return r<o?o:r>a?a:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],h=arguments[1],m=arguments[2];return l<h?h:l>m?m:l}},gt.wrap=function(r,o){return r<0?o- -r%o:r%o},gt.max=function(){if(arguments.length===3){var r=arguments[0],o=arguments[1],a=arguments[2],l=r;return o>l&&(l=o),a>l&&(l=a),l}if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3],z=h;return m>z&&(z=m),S>z&&(z=S),C>z&&(z=C),z}},gt.average=function(r,o){return(r+o)/2},ft.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(gt,ft);var vt=function(r){this.str=r};vt.prototype.append=function(r){this.str+=r},vt.prototype.setCharAt=function(r,o){this.str=this.str.substr(0,r)+o+this.str.substr(r+1)},vt.prototype.toString=function(r){return this.str};var it=function(r){this.value=r};it.prototype.intValue=function(){return this.value},it.prototype.compareTo=function(r){return this.value<r?-1:this.value>r?1:0},it.isNaN=function(r){return Number.isNaN(r)};var lt=function(){};lt.isWhitespace=function(r){return r<=32&&r>=0||r===127},lt.toUpperCase=function(r){return r.toUpperCase()};var H=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 o=arguments[0];this.init(o)}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 h=arguments[0],m=arguments[1];this.init(h,m)}},At={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}};H.prototype.le=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<=r._lo},H.prototype.extractSignificantDigits=function(r,o){var a=this.abs(),l=H.magnitude(a._hi),h=H.TEN.pow(l);(a=a.divide(h)).gt(H.TEN)?(a=a.divide(H.TEN),l+=1):a.lt(H.ONE)&&(a=a.multiply(H.TEN),l-=1);for(var m=l+1,S=new vt,C=H.MAX_PRINT_DIGITS-1,z=0;z<=C;z++){r&&z===m&&S.append(".");var K=Math.trunc(a._hi);if(K<0)break;var mt=!1,yt=0;K>9?(mt=!0,yt="9"):yt="0"+K,S.append(yt),a=a.subtract(H.valueOf(K)).multiply(H.TEN),mt&&a.selfAdd(H.TEN);var zt=!0,qt=H.magnitude(a._hi);if(qt<0&&Math.abs(qt)>=C-z&&(zt=!1),!zt)break}return o[0]=l,S.toString()},H.prototype.sqr=function(){return this.multiply(this)},H.prototype.doubleValue=function(){return this._hi+this._lo},H.prototype.subtract=function(){if(arguments[0]instanceof H){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var o=arguments[0];return this.add(-o)}},H.prototype.equals=function(){if(arguments.length===1){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}},H.prototype.isZero=function(){return this._hi===0&&this._lo===0},H.prototype.selfSubtract=function(){if(arguments[0]instanceof H){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var o=arguments[0];return this.isNaN()?this:this.selfAdd(-o,0)}},H.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},H.prototype.min=function(r){return this.le(r)?this:r},H.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof H){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var o=arguments[0];return this.selfDivide(o,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],h=null,m=null,S=null,C=null,z=null,K=null,mt=null,yt=null;return z=this._hi/a,K=H.SPLIT*z,h=K-z,yt=H.SPLIT*a,h=K-h,m=z-h,S=yt-a,mt=z*a,S=yt-S,C=a-S,yt=h*S-mt+h*C+m*S+m*C,K=(this._hi-mt-yt+this._lo-z*l)/a,yt=z+K,this._hi=yt,this._lo=z-yt+K,this}},H.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},H.prototype.divide=function(){if(arguments[0]instanceof H){var r=arguments[0],o=null,a=null,l=null,h=null,m=null,S=null,C=null,z=null;return a=(m=this._hi/r._hi)-(o=(S=H.SPLIT*m)-(o=S-m)),z=o*(l=(z=H.SPLIT*r._hi)-(l=z-r._hi))-(C=m*r._hi)+o*(h=r._hi-l)+a*l+a*h,S=(this._hi-C-z+this._lo-m*r._lo)/r._hi,new H(z=m+S,m-z+S)}if(typeof arguments[0]=="number"){var K=arguments[0];return w.isNaN(K)?H.createNaN():H.copy(this).selfDivide(K,0)}},H.prototype.ge=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>=r._lo},H.prototype.pow=function(r){if(r===0)return H.valueOf(1);var o=new H(this),a=H.valueOf(1),l=Math.abs(r);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(o),(l/=2)>0&&(o=o.sqr());else a=o;return r<0?a.reciprocal():a},H.prototype.ceil=function(){if(this.isNaN())return H.NaN;var r=Math.ceil(this._hi),o=0;return r===this._hi&&(o=Math.ceil(this._lo)),new H(r,o)},H.prototype.compareTo=function(r){var o=r;return this._hi<o._hi?-1:this._hi>o._hi?1:this._lo<o._lo?-1:this._lo>o._lo?1:0},H.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},H.prototype.setValue=function(){if(arguments[0]instanceof H){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var o=arguments[0];return this.init(o),this}},H.prototype.max=function(r){return this.ge(r)?this:r},H.prototype.sqrt=function(){if(this.isZero())return H.valueOf(0);if(this.isNegative())return H.NaN;var r=1/Math.sqrt(this._hi),o=this._hi*r,a=H.valueOf(o),l=this.subtract(a.sqr())._hi*(.5*r);return a.add(l)},H.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof H){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var o=arguments[0],a=null,l=null,h=null,m=null,S=null,C=null;return h=this._hi+o,S=h-this._hi,m=h-S,m=o-S+(this._hi-m),C=m+this._lo,a=h+C,l=C+(h-a),this._hi=a+l,this._lo=l+(a-this._hi),this}}else if(arguments.length===2){var z=arguments[0],K=arguments[1],mt=null,yt=null,zt=null,qt=null,jt=null,ue=null,dn=null;qt=this._hi+z,yt=this._lo+K,jt=qt-(ue=qt-this._hi),zt=yt-(dn=yt-this._lo);var Xn=(mt=qt+(ue=(jt=z-ue+(this._hi-jt))+yt))+(ue=(zt=K-dn+(this._lo-zt))+(ue+(qt-mt))),Dr=ue+(mt-Xn);return this._hi=Xn,this._lo=Dr,this}},H.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof H){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var o=arguments[0];return this.selfMultiply(o,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],h=null,m=null,S=null,C=null,z=null,K=null;h=(z=H.SPLIT*this._hi)-this._hi,K=H.SPLIT*a,h=z-h,m=this._hi-h,S=K-a;var mt=(z=this._hi*a)+(K=h*(S=K-S)-z+h*(C=a-S)+m*S+m*C+(this._hi*l+this._lo*a)),yt=K+(h=z-mt);return this._hi=mt,this._lo=yt,this}},H.prototype.selfSqr=function(){return this.selfMultiply(this)},H.prototype.floor=function(){if(this.isNaN())return H.NaN;var r=Math.floor(this._hi),o=0;return r===this._hi&&(o=Math.floor(this._lo)),new H(r,o)},H.prototype.negate=function(){return this.isNaN()?this:new H(-this._hi,-this._lo)},H.prototype.clone=function(){},H.prototype.multiply=function(){if(arguments[0]instanceof H){var r=arguments[0];return r.isNaN()?H.createNaN():H.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var o=arguments[0];return w.isNaN(o)?H.createNaN():H.copy(this).selfMultiply(o,0)}},H.prototype.isNaN=function(){return w.isNaN(this._hi)},H.prototype.intValue=function(){return Math.trunc(this._hi)},H.prototype.toString=function(){var r=H.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()},H.prototype.toStandardNotation=function(){var r=this.getSpecialNumberString();if(r!==null)return r;var o=new Array(1).fill(null),a=this.extractSignificantDigits(!0,o),l=o[0]+1,h=a;if(a.charAt(0)===".")h="0"+a;else if(l<0)h="0."+H.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var m=l-a.length;h=a+H.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+h:h},H.prototype.reciprocal=function(){var r=null,o=null,a=null,l=null,h=null,m=null,S=null,C=null;o=(h=1/this._hi)-(r=(m=H.SPLIT*h)-(r=m-h)),a=(C=H.SPLIT*this._hi)-this._hi;var z=h+(m=(1-(S=h*this._hi)-(C=r*(a=C-a)-S+r*(l=this._hi-a)+o*a+o*l)-h*this._lo)/this._hi);return new H(z,h-z+m)},H.prototype.toSciNotation=function(){if(this.isZero())return H.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var o=new Array(1).fill(null),a=this.extractSignificantDigits(!1,o),l=H.SCI_NOT_EXPONENT_CHAR+o[0];if(a.charAt(0)==="0")throw new Error("Found leading zero: "+a);var h="";a.length>1&&(h=a.substring(1));var m=a.charAt(0)+"."+h;return this.isNegative()?"-"+m+l:m+l},H.prototype.abs=function(){return this.isNaN()?H.NaN:this.isNegative()?this.negate():new H(this)},H.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},H.prototype.lt=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<r._lo},H.prototype.add=function(){if(arguments[0]instanceof H){var r=arguments[0];return H.copy(this).selfAdd(r)}if(typeof arguments[0]=="number"){var o=arguments[0];return H.copy(this).selfAdd(o)}},H.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 H){var o=arguments[0];this._hi=o._hi,this._lo=o._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}},H.prototype.gt=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>r._lo},H.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},H.prototype.trunc=function(){return this.isNaN()?H.NaN:this.isPositive()?this.floor():this.ceil()},H.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},H.prototype.interfaces_=function(){return[t,B,U]},H.prototype.getClass=function(){return H},H.sqr=function(r){return H.valueOf(r).selfMultiply(r)},H.valueOf=function(){if(typeof arguments[0]=="string"){var r=arguments[0];return H.parse(r)}if(typeof arguments[0]=="number"){var o=arguments[0];return new H(o)}},H.sqrt=function(r){return H.valueOf(r).sqrt()},H.parse=function(r){for(var o=0,a=r.length;lt.isWhitespace(r.charAt(o));)o++;var l=!1;if(o<a){var h=r.charAt(o);h!=="-"&&h!=="+"||(o++,h==="-"&&(l=!0))}for(var m=new H,S=0,C=0,z=0;!(o>=a);){var K=r.charAt(o);if(o++,lt.isDigit(K)){var mt=K-"0";m.selfMultiply(H.TEN),m.selfAdd(mt),S++}else{if(K!=="."){if(K==="e"||K==="E"){var yt=r.substring(o);try{z=it.parseInt(yt)}catch(dn){throw dn instanceof Error?new Error("Invalid exponent "+yt+" in string "+r):dn}break}throw new Error("Unexpected character '"+K+"' at position "+o+" in string "+r)}C=S}}var zt=m,qt=S-C-z;if(qt===0)zt=m;else if(qt>0){var jt=H.TEN.pow(qt);zt=m.divide(jt)}else if(qt<0){var ue=H.TEN.pow(-qt);zt=m.multiply(ue)}return l?zt.negate():zt},H.createNaN=function(){return new H(w.NaN,w.NaN)},H.copy=function(r){return new H(r)},H.magnitude=function(r){var o=Math.abs(r),a=Math.log(o)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=o&&(l+=1),l},H.stringOfChar=function(r,o){for(var a=new vt,l=0;l<o;l++)a.append(r);return a.toString()},At.PI.get=function(){return new H(3.141592653589793,12246467991473532e-32)},At.TWO_PI.get=function(){return new H(6.283185307179586,24492935982947064e-32)},At.PI_2.get=function(){return new H(1.5707963267948966,6123233995736766e-32)},At.E.get=function(){return new H(2.718281828459045,14456468917292502e-32)},At.NaN.get=function(){return new H(w.NaN,w.NaN)},At.EPS.get=function(){return 123259516440783e-46},At.SPLIT.get=function(){return 134217729},At.MAX_PRINT_DIGITS.get=function(){return 32},At.TEN.get=function(){return H.valueOf(10)},At.ONE.get=function(){return H.valueOf(1)},At.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},At.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(H,At);var It=function(){},Kt={DP_SAFE_EPSILON:{configurable:!0}};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.orientationIndex=function(r,o,a){var l=It.orientationIndexFilter(r,o,a);if(l<=1)return l;var h=H.valueOf(o.x).selfAdd(-r.x),m=H.valueOf(o.y).selfAdd(-r.y),S=H.valueOf(a.x).selfAdd(-o.x),C=H.valueOf(a.y).selfAdd(-o.y);return h.selfMultiply(C).selfSubtract(m.selfMultiply(S)).signum()},It.signOfDet2x2=function(r,o,a,l){return r.multiply(l).selfSubtract(o.multiply(a)).signum()},It.intersection=function(r,o,a,l){var h=H.valueOf(l.y).selfSubtract(a.y).selfMultiply(H.valueOf(o.x).selfSubtract(r.x)),m=H.valueOf(l.x).selfSubtract(a.x).selfMultiply(H.valueOf(o.y).selfSubtract(r.y)),S=h.subtract(m),C=H.valueOf(l.x).selfSubtract(a.x).selfMultiply(H.valueOf(r.y).selfSubtract(a.y)),z=H.valueOf(l.y).selfSubtract(a.y).selfMultiply(H.valueOf(r.x).selfSubtract(a.x)),K=C.subtract(z).selfDivide(S).doubleValue(),mt=H.valueOf(r.x).selfAdd(H.valueOf(o.x).selfSubtract(r.x).selfMultiply(K)).doubleValue(),yt=H.valueOf(o.x).selfSubtract(r.x).selfMultiply(H.valueOf(r.y).selfSubtract(a.y)),zt=H.valueOf(o.y).selfSubtract(r.y).selfMultiply(H.valueOf(r.x).selfSubtract(a.x)),qt=yt.subtract(zt).selfDivide(S).doubleValue(),jt=H.valueOf(a.y).selfAdd(H.valueOf(l.y).selfSubtract(a.y).selfMultiply(qt)).doubleValue();return new P(mt,jt)},It.orientationIndexFilter=function(r,o,a){var l=null,h=(r.x-a.x)*(o.y-a.y),m=(r.y-a.y)*(o.x-a.x),S=h-m;if(h>0){if(m<=0)return It.signum(S);l=h+m}else{if(!(h<0)||m>=0)return It.signum(S);l=-h-m}var C=It.DP_SAFE_EPSILON*l;return S>=C||-S>=C?It.signum(S):2},It.signum=function(r){return r>0?1:r<0?-1:0},Kt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(It,Kt);var nt=function(){},bt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};bt.X.get=function(){return 0},bt.Y.get=function(){return 1},bt.Z.get=function(){return 2},bt.M.get=function(){return 3},nt.prototype.setOrdinate=function(r,o,a){},nt.prototype.size=function(){},nt.prototype.getOrdinate=function(r,o){},nt.prototype.getCoordinate=function(){},nt.prototype.getCoordinateCopy=function(r){},nt.prototype.getDimension=function(){},nt.prototype.getX=function(r){},nt.prototype.clone=function(){},nt.prototype.expandEnvelope=function(r){},nt.prototype.copy=function(){},nt.prototype.getY=function(r){},nt.prototype.toCoordinateArray=function(){},nt.prototype.interfaces_=function(){return[U]},nt.prototype.getClass=function(){return nt},Object.defineProperties(nt,bt);var Vt=function(){},$t=function(r){function o(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Vt),Ut=function(){};Ut.arraycopy=function(r,o,a,l,h){for(var m=0,S=o;S<o+h;S++)a[l+m]=r[S],m++},Ut.getProperty=function(r){return{"line.separator":`
5
- `}[r]};var Gt=function r(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var o=arguments[0];this.x=o.x,this.y=o.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var a=arguments[0],l=arguments[1];this.x=a,this.y=l,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var h=arguments[0],m=arguments[1];this.x=h.y*m.w-m.y*h.w,this.y=m.x*h.w-h.x*m.w,this.w=h.x*m.y-m.x*h.y}else if(arguments[0]instanceof P&&arguments[1]instanceof P){var S=arguments[0],C=arguments[1];this.x=S.y-C.y,this.y=C.x-S.x,this.w=S.x*C.y-C.x*S.y}}else if(arguments.length===3){var z=arguments[0],K=arguments[1],mt=arguments[2];this.x=z,this.y=K,this.w=mt}else if(arguments.length===4){var yt=arguments[0],zt=arguments[1],qt=arguments[2],jt=arguments[3],ue=yt.y-zt.y,dn=zt.x-yt.x,Xn=yt.x*zt.y-zt.x*yt.y,Dr=qt.y-jt.y,So=jt.x-qt.x,ys=qt.x*jt.y-jt.x*qt.y;this.x=dn*ys-So*Xn,this.y=Dr*Xn-ue*ys,this.w=ue*So-Dr*dn}};Gt.prototype.getY=function(){var r=this.y/this.w;if(w.isNaN(r)||w.isInfinite(r))throw new $t;return r},Gt.prototype.getX=function(){var r=this.x/this.w;if(w.isNaN(r)||w.isInfinite(r))throw new $t;return r},Gt.prototype.getCoordinate=function(){var r=new P;return r.x=this.getX(),r.y=this.getY(),r},Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.intersection=function(r,o,a,l){var h=r.y-o.y,m=o.x-r.x,S=r.x*o.y-o.x*r.y,C=a.y-l.y,z=l.x-a.x,K=a.x*l.y-l.x*a.y,mt=h*z-C*m,yt=(m*K-z*S)/mt,zt=(C*S-h*K)/mt;if(w.isNaN(yt)||w.isInfinite(yt)||w.isNaN(zt)||w.isInfinite(zt))throw new $t;return new P(yt,zt)};var Ct=function r(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof P){var o=arguments[0];this.init(o.x,o.x,o.y,o.y)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.init(l.x,h.x,l.y,h.y)}else if(arguments.length===4){var m=arguments[0],S=arguments[1],C=arguments[2],z=arguments[3];this.init(m,S,C,z)}},ee={serialVersionUID:{configurable:!0}};Ct.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Ct.prototype.equals=function(r){if(!(r instanceof Ct))return!1;var o=r;return this.isNull()?o.isNull():this._maxx===o.getMaxX()&&this._maxy===o.getMaxY()&&this._minx===o.getMinX()&&this._miny===o.getMinY()},Ct.prototype.intersection=function(r){if(this.isNull()||r.isNull()||!this.intersects(r))return new Ct;var o=this._minx>r._minx?this._minx:r._minx,a=this._miny>r._miny?this._miny:r._miny,l=this._maxx<r._maxx?this._maxx:r._maxx,h=this._maxy<r._maxy?this._maxy:r._maxy;return new Ct(o,l,a,h)},Ct.prototype.isNull=function(){return this._maxx<this._minx},Ct.prototype.getMaxX=function(){return this._maxx},Ct.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];return this.covers(r.x,r.y)}if(arguments[0]instanceof Ct){var o=arguments[0];return!this.isNull()&&!o.isNull()&&o.getMinX()>=this._minx&&o.getMaxX()<=this._maxx&&o.getMinY()>=this._miny&&o.getMaxY()<=this._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&l>=this._miny&&l<=this._maxy}},Ct.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var r=arguments[0];return!this.isNull()&&!r.isNull()&&!(r._minx>this._maxx||r._maxx<this._minx||r._miny>this._maxy||r._maxy<this._miny)}if(arguments[0]instanceof P){var o=arguments[0];return this.intersects(o.x,o.y)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return!this.isNull()&&!(a>this._maxx||a<this._minx||l>this._maxy||l<this._miny)}},Ct.prototype.getMinY=function(){return this._miny},Ct.prototype.getMinX=function(){return this._minx},Ct.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];this.expandToInclude(r.x,r.y)}else if(arguments[0]instanceof Ct){var o=arguments[0];if(o.isNull())return null;this.isNull()?(this._minx=o.getMinX(),this._maxx=o.getMaxX(),this._miny=o.getMinY(),this._maxy=o.getMaxY()):(o._minx<this._minx&&(this._minx=o._minx),o._maxx>this._maxx&&(this._maxx=o._maxx),o._miny<this._miny&&(this._miny=o._miny),o._maxy>this._maxy&&(this._maxy=o._maxy))}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=l,this._maxy=l):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}},Ct.prototype.minExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),o=this.getHeight();return r<o?r:o},Ct.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Ct.prototype.compareTo=function(r){var o=r;return this.isNull()?o.isNull()?0:-1:o.isNull()?1:this._minx<o._minx?-1:this._minx>o._minx?1:this._miny<o._miny?-1:this._miny>o._miny?1:this._maxx<o._maxx?-1:this._maxx>o._maxx?1:this._maxy<o._maxy?-1:this._maxy>o._maxy?1:0},Ct.prototype.translate=function(r,o){if(this.isNull())return null;this.init(this.getMinX()+r,this.getMaxX()+r,this.getMinY()+o,this.getMaxY()+o)},Ct.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ct.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ct.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ct.prototype.maxExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),o=this.getHeight();return r>o?r:o},Ct.prototype.expandBy=function(){if(arguments.length===1){var r=arguments[0];this.expandBy(r,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=o,this._maxx+=o,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Ct.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var r=arguments[0];return this.covers(r)}if(arguments[0]instanceof P){var o=arguments[0];return this.covers(o)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.covers(a,l)}},Ct.prototype.centre=function(){return this.isNull()?null:new P((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ct.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof Ct){var o=arguments[0];this._minx=o._minx,this._maxx=o._maxx,this._miny=o._miny,this._maxy=o._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.init(a.x,l.x,a.y,l.y)}else if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3];h<m?(this._minx=h,this._maxx=m):(this._minx=m,this._maxx=h),S<C?(this._miny=S,this._maxy=C):(this._miny=C,this._maxy=S)}},Ct.prototype.getMaxY=function(){return this._maxy},Ct.prototype.distance=function(r){if(this.intersects(r))return 0;var o=0;this._maxx<r._minx?o=r._minx-this._maxx:this._minx>r._maxx&&(o=this._minx-r._maxx);var a=0;return this._maxy<r._miny?a=r._miny-this._maxy:this._miny>r._maxy&&(a=this._miny-r._maxy),o===0?a:a===0?o:Math.sqrt(o*o+a*a)},Ct.prototype.hashCode=function(){var r=17;return r=37*r+P.hashCode(this._minx),r=37*r+P.hashCode(this._maxx),r=37*r+P.hashCode(this._miny),r=37*r+P.hashCode(this._maxy)},Ct.prototype.interfaces_=function(){return[B,t]},Ct.prototype.getClass=function(){return Ct},Ct.intersects=function(){if(arguments.length===3){var r=arguments[0],o=arguments[1],a=arguments[2];return a.x>=(r.x<o.x?r.x:o.x)&&a.x<=(r.x>o.x?r.x:o.x)&&a.y>=(r.y<o.y?r.y:o.y)&&a.y<=(r.y>o.y?r.y:o.y)}if(arguments.length===4){var l=arguments[0],h=arguments[1],m=arguments[2],S=arguments[3],C=Math.min(m.x,S.x),z=Math.max(m.x,S.x),K=Math.min(l.x,h.x),mt=Math.max(l.x,h.x);return!(K>z)&&!(mt<C)&&(C=Math.min(m.y,S.y),z=Math.max(m.y,S.y),K=Math.min(l.y,h.y),mt=Math.max(l.y,h.y),!(K>z)&&!(mt<C))}},ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,ee);var Z={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},Dt=function(r){this.geometryFactory=r||new me};Dt.prototype.read=function(r){var o,a,l;r=r.replace(/[\n\r]/g," ");var h=Z.typeStr.exec(r);if(r.search("EMPTY")!==-1&&((h=Z.emptyTypeStr.exec(r))[2]=void 0),h&&(a=h[1].toLowerCase(),l=h[2],Nt[a]&&(o=Nt[a].apply(this,[l]))),o===void 0)throw new Error("Could not parse WKT "+r);return o},Dt.prototype.write=function(r){return this.extractGeometry(r)},Dt.prototype.extractGeometry=function(r){var o=r.getGeometryType().toLowerCase();if(!_t[o])return null;var a=o.toUpperCase();return r.isEmpty()?a+" EMPTY":a+"("+_t[o].apply(this,[r])+")"};var _t={coordinate:function(r){return r.x+" "+r.y},point:function(r){return _t.coordinate.call(this,r._coordinates._coordinates[0])},multipoint:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push("("+_t.point.apply(this,[r._geometries[a]])+")");return o.join(",")},linestring:function(r){for(var o=[],a=0,l=r._points._coordinates.length;a<l;++a)o.push(_t.coordinate.apply(this,[r._points._coordinates[a]]));return o.join(",")},linearring:function(r){for(var o=[],a=0,l=r._points._coordinates.length;a<l;++a)o.push(_t.coordinate.apply(this,[r._points._coordinates[a]]));return o.join(",")},multilinestring:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push("("+_t.linestring.apply(this,[r._geometries[a]])+")");return o.join(",")},polygon:function(r){var o=[];o.push("("+_t.linestring.apply(this,[r._shell])+")");for(var a=0,l=r._holes.length;a<l;++a)o.push("("+_t.linestring.apply(this,[r._holes[a]])+")");return o.join(",")},multipolygon:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push("("+_t.polygon.apply(this,[r._geometries[a]])+")");return o.join(",")},geometrycollection:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push(this.extractGeometry(r._geometries[a]));return o.join(",")}},Nt={point:function(r){if(r===void 0)return this.geometryFactory.createPoint();var o=r.trim().split(Z.spaces);return this.geometryFactory.createPoint(new P(Number.parseFloat(o[0]),Number.parseFloat(o[1])))},multipoint:function(r){if(r===void 0)return this.geometryFactory.createMultiPoint();for(var o,a=r.trim().split(","),l=[],h=0,m=a.length;h<m;++h)o=a[h].replace(Z.trimParens,"$1"),l.push(Nt.point.apply(this,[o]));return this.geometryFactory.createMultiPoint(l)},linestring:function(r){if(r===void 0)return this.geometryFactory.createLineString();for(var o,a=r.trim().split(","),l=[],h=0,m=a.length;h<m;++h)o=a[h].trim().split(Z.spaces),l.push(new P(Number.parseFloat(o[0]),Number.parseFloat(o[1])));return this.geometryFactory.createLineString(l)},linearring:function(r){if(r===void 0)return this.geometryFactory.createLinearRing();for(var o,a=r.trim().split(","),l=[],h=0,m=a.length;h<m;++h)o=a[h].trim().split(Z.spaces),l.push(new P(Number.parseFloat(o[0]),Number.parseFloat(o[1])));return this.geometryFactory.createLinearRing(l)},multilinestring:function(r){if(r===void 0)return this.geometryFactory.createMultiLineString();for(var o,a=r.trim().split(Z.parenComma),l=[],h=0,m=a.length;h<m;++h)o=a[h].replace(Z.trimParens,"$1"),l.push(Nt.linestring.apply(this,[o]));return this.geometryFactory.createMultiLineString(l)},polygon:function(r){if(r===void 0)return this.geometryFactory.createPolygon();for(var o,a,l,h,m=r.trim().split(Z.parenComma),S=[],C=0,z=m.length;C<z;++C)o=m[C].replace(Z.trimParens,"$1"),a=Nt.linestring.apply(this,[o]),l=this.geometryFactory.createLinearRing(a._points),C===0?h=l:S.push(l);return this.geometryFactory.createPolygon(h,S)},multipolygon:function(r){if(r===void 0)return this.geometryFactory.createMultiPolygon();for(var o,a=r.trim().split(Z.doubleParenComma),l=[],h=0,m=a.length;h<m;++h)o=a[h].replace(Z.trimParens,"$1"),l.push(Nt.polygon.apply(this,[o]));return this.geometryFactory.createMultiPolygon(l)},geometrycollection:function(r){if(r===void 0)return this.geometryFactory.createGeometryCollection();for(var o=(r=r.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),a=[],l=0,h=o.length;l<h;++l)a.push(this.read(o[l]));return this.geometryFactory.createGeometryCollection(a)}},wt=function(r){this.parser=new Dt(r)};wt.prototype.write=function(r){return this.parser.write(r)},wt.toLineString=function(r,o){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+o.x+" "+o.y+" )"};var Ht=function(r){function o(a){r.call(this,a),this.name="RuntimeException",this.message=a,this.stack=new r().stack}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o}(Error),Xt=function(r){function o(){if(r.call(this),arguments.length===0)r.call(this);else if(arguments.length===1){var a=arguments[0];r.call(this,a)}}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Ht),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.shouldNeverReachHere=function(){if(arguments.length===0)Pt.shouldNeverReachHere(null);else if(arguments.length===1){var r=arguments[0];throw new Xt("Should never reach here"+(r!==null?": "+r:""))}},Pt.isTrue=function(){var r,o;if(arguments.length===1)r=arguments[0],Pt.isTrue(r,null);else if(arguments.length===2&&(r=arguments[0],o=arguments[1],!r))throw o===null?new Xt:new Xt(o)},Pt.equals=function(){var r,o,a;if(arguments.length===2)r=arguments[0],o=arguments[1],Pt.equals(r,o,null);else if(arguments.length===3&&(r=arguments[0],o=arguments[1],a=arguments[2],!o.equals(r)))throw new Xt("Expected "+r+" but encountered "+o+(a!==null?": "+a:""))};var ne=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new P,this._intPt[1]=new P,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Y={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ne.prototype.getIndexAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intLineIndex[r][o]},ne.prototype.getTopologySummary=function(){var r=new vt;return this.isEndPoint()&&r.append(" endpoint"),this._isProper&&r.append(" proper"),this.isCollinear()&&r.append(" collinear"),r.toString()},ne.prototype.computeIntersection=function(r,o,a,l){this._inputLines[0][0]=r,this._inputLines[0][1]=o,this._inputLines[1][0]=a,this._inputLines[1][1]=l,this._result=this.computeIntersect(r,o,a,l)},ne.prototype.getIntersectionNum=function(){return this._result},ne.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var r=arguments[0];this.getEdgeDistance(r,0)>this.getEdgeDistance(r,1)?(this._intLineIndex[r][0]=0,this._intLineIndex[r][1]=1):(this._intLineIndex[r][0]=1,this._intLineIndex[r][1]=0)}},ne.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ne.prototype.setPrecisionModel=function(r){this._precisionModel=r},ne.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var r=arguments[0],o=0;o<this._result;o++)if(!this._intPt[o].equals2D(this._inputLines[r][0])&&!this._intPt[o].equals2D(this._inputLines[r][1]))return!0;return!1}},ne.prototype.getIntersection=function(r){return this._intPt[r]},ne.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ne.prototype.hasIntersection=function(){return this._result!==ne.NO_INTERSECTION},ne.prototype.getEdgeDistance=function(r,o){return ne.computeEdgeDistance(this._intPt[o],this._inputLines[r][0],this._inputLines[r][1])},ne.prototype.isCollinear=function(){return this._result===ne.COLLINEAR_INTERSECTION},ne.prototype.toString=function(){return wt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+wt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ne.prototype.getEndpoint=function(r,o){return this._inputLines[r][o]},ne.prototype.isIntersection=function(r){for(var o=0;o<this._result;o++)if(this._intPt[o].equals2D(r))return!0;return!1},ne.prototype.getIntersectionAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[r][o]]},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.computeEdgeDistance=function(r,o,a){var l=Math.abs(a.x-o.x),h=Math.abs(a.y-o.y),m=-1;if(r.equals(o))m=0;else if(r.equals(a))m=l>h?l:h;else{var S=Math.abs(r.x-o.x),C=Math.abs(r.y-o.y);(m=l>h?S:C)!==0||r.equals(o)||(m=Math.max(S,C))}return Pt.isTrue(!(m===0&&!r.equals(o)),"Bad distance calculation"),m},ne.nonRobustComputeEdgeDistance=function(r,o,a){var l=r.x-o.x,h=r.y-o.y,m=Math.sqrt(l*l+h*h);return Pt.isTrue(!(m===0&&!r.equals(o)),"Invalid distance calculation"),m},Y.DONT_INTERSECT.get=function(){return 0},Y.DO_INTERSECT.get=function(){return 1},Y.COLLINEAR.get=function(){return 2},Y.NO_INTERSECTION.get=function(){return 0},Y.POINT_INTERSECTION.get=function(){return 1},Y.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ne,Y);var N=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.isInSegmentEnvelopes=function(a){var l=new Ct(this._inputLines[0][0],this._inputLines[0][1]),h=new Ct(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(a)&&h.contains(a)},o.prototype.computeIntersection=function(){if(arguments.length!==3)return r.prototype.computeIntersection.apply(this,arguments);var a=arguments[0],l=arguments[1],h=arguments[2];if(this._isProper=!1,Ct.intersects(l,h,a)&&ot.orientationIndex(l,h,a)===0&&ot.orientationIndex(h,l,a)===0)return this._isProper=!0,(a.equals(l)||a.equals(h))&&(this._isProper=!1),this._result=r.POINT_INTERSECTION,null;this._result=r.NO_INTERSECTION},o.prototype.normalizeToMinimum=function(a,l,h,m,S){S.x=this.smallestInAbsValue(a.x,l.x,h.x,m.x),S.y=this.smallestInAbsValue(a.y,l.y,h.y,m.y),a.x-=S.x,a.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,m.x-=S.x,m.y-=S.y},o.prototype.safeHCoordinateIntersection=function(a,l,h,m){var S=null;try{S=Gt.intersection(a,l,h,m)}catch(C){if(!(C instanceof $t))throw C;S=o.nearestEndpoint(a,l,h,m)}return S},o.prototype.intersection=function(a,l,h,m){var S=this.intersectionWithNormalization(a,l,h,m);return this.isInSegmentEnvelopes(S)||(S=new P(o.nearestEndpoint(a,l,h,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(S),S},o.prototype.smallestInAbsValue=function(a,l,h,m){var S=a,C=Math.abs(S);return Math.abs(l)<C&&(S=l,C=Math.abs(l)),Math.abs(h)<C&&(S=h,C=Math.abs(h)),Math.abs(m)<C&&(S=m),S},o.prototype.checkDD=function(a,l,h,m,S){var C=It.intersection(a,l,h,m),z=this.isInSegmentEnvelopes(C);Ut.out.println("DD in env = "+z+" --------------------- "+C),S.distance(C)>1e-4&&Ut.out.println("Distance = "+S.distance(C))},o.prototype.intersectionWithNormalization=function(a,l,h,m){var S=new P(a),C=new P(l),z=new P(h),K=new P(m),mt=new P;this.normalizeToEnvCentre(S,C,z,K,mt);var yt=this.safeHCoordinateIntersection(S,C,z,K);return yt.x+=mt.x,yt.y+=mt.y,yt},o.prototype.computeCollinearIntersection=function(a,l,h,m){var S=Ct.intersects(a,l,h),C=Ct.intersects(a,l,m),z=Ct.intersects(h,m,a),K=Ct.intersects(h,m,l);return S&&C?(this._intPt[0]=h,this._intPt[1]=m,r.COLLINEAR_INTERSECTION):z&&K?(this._intPt[0]=a,this._intPt[1]=l,r.COLLINEAR_INTERSECTION):S&&z?(this._intPt[0]=h,this._intPt[1]=a,!h.equals(a)||C||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):S&&K?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||C||z?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&z?(this._intPt[0]=m,this._intPt[1]=a,!m.equals(a)||S||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&K?(this._intPt[0]=m,this._intPt[1]=l,!m.equals(l)||S||z?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):r.NO_INTERSECTION},o.prototype.normalizeToEnvCentre=function(a,l,h,m,S){var C=a.x<l.x?a.x:l.x,z=a.y<l.y?a.y:l.y,K=a.x>l.x?a.x:l.x,mt=a.y>l.y?a.y:l.y,yt=h.x<m.x?h.x:m.x,zt=h.y<m.y?h.y:m.y,qt=h.x>m.x?h.x:m.x,jt=h.y>m.y?h.y:m.y,ue=((C>yt?C:yt)+(K<qt?K:qt))/2,dn=((z>zt?z:zt)+(mt<jt?mt:jt))/2;S.x=ue,S.y=dn,a.x-=S.x,a.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,m.x-=S.x,m.y-=S.y},o.prototype.computeIntersect=function(a,l,h,m){if(this._isProper=!1,!Ct.intersects(a,l,h,m))return r.NO_INTERSECTION;var S=ot.orientationIndex(a,l,h),C=ot.orientationIndex(a,l,m);if(S>0&&C>0||S<0&&C<0)return r.NO_INTERSECTION;var z=ot.orientationIndex(h,m,a),K=ot.orientationIndex(h,m,l);return z>0&&K>0||z<0&&K<0?r.NO_INTERSECTION:S===0&&C===0&&z===0&&K===0?this.computeCollinearIntersection(a,l,h,m):(S===0||C===0||z===0||K===0?(this._isProper=!1,a.equals2D(h)||a.equals2D(m)?this._intPt[0]=a:l.equals2D(h)||l.equals2D(m)?this._intPt[0]=l:S===0?this._intPt[0]=new P(h):C===0?this._intPt[0]=new P(m):z===0?this._intPt[0]=new P(a):K===0&&(this._intPt[0]=new P(l))):(this._isProper=!0,this._intPt[0]=this.intersection(a,l,h,m)),r.POINT_INTERSECTION)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.nearestEndpoint=function(a,l,h,m){var S=a,C=ot.distancePointLine(a,h,m),z=ot.distancePointLine(l,h,m);return z<C&&(C=z,S=l),(z=ot.distancePointLine(h,a,l))<C&&(C=z,S=h),(z=ot.distancePointLine(m,a,l))<C&&(C=z,S=m),S},o}(ne),xt=function(){};xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.orientationIndex=function(r,o,a){var l=o.x-r.x,h=o.y-r.y,m=a.x-o.x,S=a.y-o.y;return xt.signOfDet2x2(l,h,m,S)},xt.signOfDet2x2=function(r,o,a,l){var h=null,m=null,S=null;if(h=1,r===0||l===0)return o===0||a===0?0:o>0?a>0?-h:h:a>0?h:-h;if(o===0||a===0)return l>0?r>0?h:-h:r>0?-h:h;if(o>0?l>0?o<=l||(h=-h,m=r,r=a,a=m,m=o,o=l,l=m):o<=-l?(h=-h,a=-a,l=-l):(m=r,r=-a,a=m,m=o,o=-l,l=m):l>0?-o<=l?(h=-h,r=-r,o=-o):(m=-r,r=a,a=m,m=-o,o=l,l=m):o>=l?(r=-r,o=-o,a=-a,l=-l):(h=-h,m=-r,r=-a,a=m,m=-o,o=-l,l=m),r>0){if(!(a>0)||!(r<=a))return h}else{if(a>0||!(r>=a))return-h;h=-h,r=-r,a=-a}for(;;){if(S=Math.floor(a/r),a-=S*r,(l-=S*o)<0)return-h;if(l>o)return h;if(r>a+a){if(o<l+l)return h}else{if(o>l+l)return-h;a=r-a,l=o-l,h=-h}if(l===0)return a===0?0:-h;if(a===0||(S=Math.floor(r/a),r-=S*a,(o-=S*l)<0))return h;if(o>l)return-h;if(a>r+r){if(l<o+o)return-h}else{if(l>o+o)return h;r=a-r,o=l-o,h=-h}if(o===0)return r===0?0:h;if(r===0)return-h}};var St=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var r=arguments[0];this._p=r};St.prototype.countSegment=function(r,o){if(r.x<this._p.x&&o.x<this._p.x)return null;if(this._p.x===o.x&&this._p.y===o.y)return this._isPointOnSegment=!0,null;if(r.y===this._p.y&&o.y===this._p.y){var a=r.x,l=o.x;return a>l&&(a=o.x,l=r.x),this._p.x>=a&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(r.y>this._p.y&&o.y<=this._p.y||o.y>this._p.y&&r.y<=this._p.y){var h=r.x-this._p.x,m=r.y-this._p.y,S=o.x-this._p.x,C=o.y-this._p.y,z=xt.signOfDet2x2(h,m,S,C);if(z===0)return this._isPointOnSegment=!0,null;C<m&&(z=-z),z>0&&this._crossingCount++}},St.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},St.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},St.prototype.isOnSegment=function(){return this._isPointOnSegment},St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.locatePointInRing=function(){if(arguments[0]instanceof P&&$(arguments[1],nt)){for(var r=arguments[0],o=arguments[1],a=new St(r),l=new P,h=new P,m=1;m<o.size();m++)if(o.getCoordinate(m,l),o.getCoordinate(m-1,h),a.countSegment(l,h),a.isOnSegment())return a.getLocation();return a.getLocation()}if(arguments[0]instanceof P&&arguments[1]instanceof Array){for(var S=arguments[0],C=arguments[1],z=new St(S),K=1;K<C.length;K++){var mt=C[K],yt=C[K-1];if(z.countSegment(mt,yt),z.isOnSegment())return z.getLocation()}return z.getLocation()}};var ot=function(){},Lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.orientationIndex=function(r,o,a){return It.orientationIndex(r,o,a)},ot.signedArea=function(){if(arguments[0]instanceof Array){var r=arguments[0];if(r.length<3)return 0;for(var o=0,a=r[0].x,l=1;l<r.length-1;l++){var h=r[l].x-a,m=r[l+1].y;o+=h*(r[l-1].y-m)}return o/2}if($(arguments[0],nt)){var S=arguments[0],C=S.size();if(C<3)return 0;var z=new P,K=new P,mt=new P;S.getCoordinate(0,K),S.getCoordinate(1,mt);var yt=K.x;mt.x-=yt;for(var zt=0,qt=1;qt<C-1;qt++)z.y=K.y,K.x=mt.x,K.y=mt.y,S.getCoordinate(qt+1,mt),mt.x-=yt,zt+=K.x*(z.y-mt.y);return zt/2}},ot.distanceLineLine=function(r,o,a,l){if(r.equals(o))return ot.distancePointLine(r,a,l);if(a.equals(l))return ot.distancePointLine(l,r,o);var h=!1;if(Ct.intersects(r,o,a,l)){var m=(o.x-r.x)*(l.y-a.y)-(o.y-r.y)*(l.x-a.x);if(m===0)h=!0;else{var S=(r.y-a.y)*(l.x-a.x)-(r.x-a.x)*(l.y-a.y),C=((r.y-a.y)*(o.x-r.x)-(r.x-a.x)*(o.y-r.y))/m,z=S/m;(z<0||z>1||C<0||C>1)&&(h=!0)}}else h=!0;return h?gt.min(ot.distancePointLine(r,a,l),ot.distancePointLine(o,a,l),ot.distancePointLine(a,r,o),ot.distancePointLine(l,r,o)):0},ot.isPointInRing=function(r,o){return ot.locatePointInRing(r,o)!==V.EXTERIOR},ot.computeLength=function(r){var o=r.size();if(o<=1)return 0;var a=0,l=new P;r.getCoordinate(0,l);for(var h=l.x,m=l.y,S=1;S<o;S++){r.getCoordinate(S,l);var C=l.x,z=l.y,K=C-h,mt=z-m;a+=Math.sqrt(K*K+mt*mt),h=C,m=z}return a},ot.isCCW=function(r){var o=r.length-1;if(o<3)throw new T("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=r[0],l=0,h=1;h<=o;h++){var m=r[h];m.y>a.y&&(a=m,l=h)}var S=l;do(S-=1)<0&&(S=o);while(r[S].equals2D(a)&&S!==l);var C=l;do C=(C+1)%o;while(r[C].equals2D(a)&&C!==l);var z=r[S],K=r[C];if(z.equals2D(a)||K.equals2D(a)||z.equals2D(K))return!1;var mt=ot.computeOrientation(z,a,K),yt=!1;return yt=mt===0?z.x>K.x:mt>0,yt},ot.locatePointInRing=function(r,o){return St.locatePointInRing(r,o)},ot.distancePointLinePerpendicular=function(r,o,a){var l=(a.x-o.x)*(a.x-o.x)+(a.y-o.y)*(a.y-o.y),h=((o.y-r.y)*(a.x-o.x)-(o.x-r.x)*(a.y-o.y))/l;return Math.abs(h)*Math.sqrt(l)},ot.computeOrientation=function(r,o,a){return ot.orientationIndex(r,o,a)},ot.distancePointLine=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];if(o.length===0)throw new T("Line array must contain at least one vertex");for(var a=r.distance(o[0]),l=0;l<o.length-1;l++){var h=ot.distancePointLine(r,o[l],o[l+1]);h<a&&(a=h)}return a}if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];if(S.x===C.x&&S.y===C.y)return m.distance(S);var z=(C.x-S.x)*(C.x-S.x)+(C.y-S.y)*(C.y-S.y),K=((m.x-S.x)*(C.x-S.x)+(m.y-S.y)*(C.y-S.y))/z;if(K<=0)return m.distance(S);if(K>=1)return m.distance(C);var mt=((S.y-m.y)*(C.x-S.x)-(S.x-m.x)*(C.y-S.y))/z;return Math.abs(mt)*Math.sqrt(z)}},ot.isOnLine=function(r,o){for(var a=new N,l=1;l<o.length;l++){var h=o[l-1],m=o[l];if(a.computeIntersection(r,h,m),a.hasIntersection())return!0}return!1},Lt.CLOCKWISE.get=function(){return-1},Lt.RIGHT.get=function(){return ot.CLOCKWISE},Lt.COUNTERCLOCKWISE.get=function(){return 1},Lt.LEFT.get=function(){return ot.COUNTERCLOCKWISE},Lt.COLLINEAR.get=function(){return 0},Lt.STRAIGHT.get=function(){return ot.COLLINEAR},Object.defineProperties(ot,Lt);var ce=function(){};ce.prototype.filter=function(r){},ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Rt=function(){var r=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=r,this._SRID=r.getSRID()},Bt={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};Rt.prototype.isGeometryCollection=function(){return this.getSortIndex()===Rt.SORTINDEX_GEOMETRYCOLLECTION},Rt.prototype.getFactory=function(){return this._factory},Rt.prototype.getGeometryN=function(r){return this},Rt.prototype.getArea=function(){return 0},Rt.prototype.isRectangle=function(){return!1},Rt.prototype.equals=function(){if(arguments[0]instanceof Rt){var r=arguments[0];return r!==null&&this.equalsTopo(r)}if(arguments[0]instanceof Object){var o=arguments[0];if(!(o instanceof Rt))return!1;var a=o;return this.equalsExact(a)}},Rt.prototype.equalsExact=function(r){return this===r||this.equalsExact(r,0)},Rt.prototype.geometryChanged=function(){this.apply(Rt.geometryChangedFilter)},Rt.prototype.geometryChangedAction=function(){this._envelope=null},Rt.prototype.equalsNorm=function(r){return r!==null&&this.norm().equalsExact(r.norm())},Rt.prototype.getLength=function(){return 0},Rt.prototype.getNumGeometries=function(){return 1},Rt.prototype.compareTo=function(){if(arguments.length===1){var r=arguments[0],o=r;return this.getSortIndex()!==o.getSortIndex()?this.getSortIndex()-o.getSortIndex():this.isEmpty()&&o.isEmpty()?0:this.isEmpty()?-1:o.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.getSortIndex()!==a.getSortIndex()?this.getSortIndex()-a.getSortIndex():this.isEmpty()&&a.isEmpty()?0:this.isEmpty()?-1:a.isEmpty()?1:this.compareToSameClass(a,l)}},Rt.prototype.getUserData=function(){return this._userData},Rt.prototype.getSRID=function(){return this._SRID},Rt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Rt.prototype.checkNotGeometryCollection=function(r){if(r.getSortIndex()===Rt.SORTINDEX_GEOMETRYCOLLECTION)throw new T("This method does not support GeometryCollection arguments")},Rt.prototype.equal=function(r,o,a){return a===0?r.equals(o):r.distance(o)<=a},Rt.prototype.norm=function(){var r=this.copy();return r.normalize(),r},Rt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Rt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Ct(this._envelope)},Rt.prototype.setSRID=function(r){this._SRID=r},Rt.prototype.setUserData=function(r){this._userData=r},Rt.prototype.compare=function(r,o){for(var a=r.iterator(),l=o.iterator();a.hasNext()&&l.hasNext();){var h=a.next(),m=l.next(),S=h.compareTo(m);if(S!==0)return S}return a.hasNext()?1:l.hasNext()?-1:0},Rt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Rt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Rt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Rt.SORTINDEX_MULTIPOINT||this.getSortIndex()===Rt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Rt.SORTINDEX_MULTIPOLYGON},Rt.prototype.interfaces_=function(){return[U,B,t]},Rt.prototype.getClass=function(){return Rt},Rt.hasNonEmptyElements=function(r){for(var o=0;o<r.length;o++)if(!r[o].isEmpty())return!0;return!1},Rt.hasNullElements=function(r){for(var o=0;o<r.length;o++)if(r[o]===null)return!0;return!1},Bt.serialVersionUID.get=function(){return 8763622679187377e3},Bt.SORTINDEX_POINT.get=function(){return 0},Bt.SORTINDEX_MULTIPOINT.get=function(){return 1},Bt.SORTINDEX_LINESTRING.get=function(){return 2},Bt.SORTINDEX_LINEARRING.get=function(){return 3},Bt.SORTINDEX_MULTILINESTRING.get=function(){return 4},Bt.SORTINDEX_POLYGON.get=function(){return 5},Bt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Bt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Bt.geometryChangedFilter.get=function(){return Wt},Object.defineProperties(Rt,Bt);var Wt=function(){};Wt.interfaces_=function(){return[ce]},Wt.filter=function(r){r.geometryChangedAction()};var j=function(){};j.prototype.filter=function(r){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var b=function(){},I={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};b.prototype.isInBoundary=function(r){},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},I.Mod2BoundaryNodeRule.get=function(){return F},I.EndPointBoundaryNodeRule.get=function(){return k},I.MultiValentEndPointBoundaryNodeRule.get=function(){return G},I.MonoValentEndPointBoundaryNodeRule.get=function(){return rt},I.MOD2_BOUNDARY_RULE.get=function(){return new F},I.ENDPOINT_BOUNDARY_RULE.get=function(){return new k},I.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new G},I.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new rt},I.OGC_SFS_BOUNDARY_RULE.get=function(){return b.MOD2_BOUNDARY_RULE},Object.defineProperties(b,I);var F=function(){};F.prototype.isInBoundary=function(r){return r%2==1},F.prototype.interfaces_=function(){return[b]},F.prototype.getClass=function(){return F};var k=function(){};k.prototype.isInBoundary=function(r){return r>0},k.prototype.interfaces_=function(){return[b]},k.prototype.getClass=function(){return k};var G=function(){};G.prototype.isInBoundary=function(r){return r>1},G.prototype.interfaces_=function(){return[b]},G.prototype.getClass=function(){return G};var rt=function(){};rt.prototype.isInBoundary=function(r){return r===1},rt.prototype.interfaces_=function(){return[b]},rt.prototype.getClass=function(){return rt};var tt=function(){};tt.prototype.add=function(){},tt.prototype.addAll=function(){},tt.prototype.isEmpty=function(){},tt.prototype.iterator=function(){},tt.prototype.size=function(){},tt.prototype.toArray=function(){},tt.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var pt=function(){};pt.prototype.hasNext=function(){},pt.prototype.next=function(){},pt.prototype.remove=function(){};var ht=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.get=function(){},o.prototype.set=function(){},o.prototype.isEmpty=function(){},o}(tt);(i.prototype=new Error).name="NoSuchElementException";var O=function(r){function o(){r.call(this),this.array_=[],arguments[0]instanceof tt&&this.addAll(arguments[0])}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.ensureCapacity=function(){},o.prototype.interfaces_=function(){return[r,tt]},o.prototype.add=function(a){return arguments.length===1?this.array_.push(a):this.array_.splice(arguments[0],arguments[1]),!0},o.prototype.clear=function(){this.array_=[]},o.prototype.addAll=function(a){for(var l=a.iterator();l.hasNext();)this.add(l.next());return!0},o.prototype.set=function(a,l){var h=this.array_[a];return this.array_[a]=l,h},o.prototype.iterator=function(){return new Q(this)},o.prototype.get=function(a){if(a<0||a>=this.size())throw new e;return this.array_[a]},o.prototype.isEmpty=function(){return this.array_.length===0},o.prototype.size=function(){return this.array_.length},o.prototype.toArray=function(){for(var a=[],l=0,h=this.array_.length;l<h;l++)a.push(this.array_[l]);return a},o.prototype.remove=function(a){for(var l=!1,h=0,m=this.array_.length;h<m;h++)if(this.array_[h]===a){this.array_.splice(h,1),l=!0;break}return l},o}(ht),Q=function(r){function o(a){r.call(this),this.arrayList_=a,this.position_=0}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new i;return this.arrayList_.get(this.position_++)},o.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},o.prototype.set=function(a){return this.arrayList_.set(this.position_-1,a)},o.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},o}(pt),J=function(r){function o(){if(r.call(this),arguments.length!==0){if(arguments.length===1){var l=arguments[0];this.ensureCapacity(l.length),this.add(l,!0)}else if(arguments.length===2){var h=arguments[0],m=arguments[1];this.ensureCapacity(h.length),this.add(h,m)}}}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={coordArrayType:{configurable:!0}};return a.coordArrayType.get=function(){return new Array(0).fill(null)},o.prototype.getCoordinate=function(l){return this.get(l)},o.prototype.addAll=function(){if(arguments.length===2){for(var l=arguments[0],h=arguments[1],m=!1,S=l.iterator();S.hasNext();)this.add(S.next(),h),m=!0;return m}return r.prototype.addAll.apply(this,arguments)},o.prototype.clone=function(){for(var l=r.prototype.clone.call(this),h=0;h<this.size();h++)l.add(h,this.get(h).copy());return l},o.prototype.toCoordinateArray=function(){return this.toArray(o.coordArrayType)},o.prototype.add=function(){if(arguments.length===1){var l=arguments[0];r.prototype.add.call(this,l)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],m=arguments[1];return this.add(h,m,!0),!0}if(arguments[0]instanceof P&&typeof arguments[1]=="boolean"){var S=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(S))return null;r.prototype.add.call(this,S)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var C=arguments[0],z=arguments[1];return this.add(C,z),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var K=arguments[0],mt=arguments[1];if(arguments[2])for(var yt=0;yt<K.length;yt++)this.add(K[yt],mt);else for(var zt=K.length-1;zt>=0;zt--)this.add(K[zt],mt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof P){var qt=arguments[0],jt=arguments[1];if(!arguments[2]){var ue=this.size();if(ue>0&&(qt>0&&this.get(qt-1).equals2D(jt)||qt<ue&&this.get(qt).equals2D(jt)))return null}r.prototype.add.call(this,qt,jt)}}else if(arguments.length===4){var dn=arguments[0],Xn=arguments[1],Dr=arguments[2],So=arguments[3],ys=1;Dr>So&&(ys=-1);for(var Bg=Dr;Bg!==So;Bg+=ys)this.add(dn[Bg],Xn);return!0}},o.prototype.closeRing=function(){this.size()>0&&this.add(new P(this.get(0)),!1)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},Object.defineProperties(o,a),o}(O),et=function(){},Tt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Tt.ForwardComparator.get=function(){return kt},Tt.BidirectionalComparator.get=function(){return ie},Tt.coordArrayType.get=function(){return new Array(0).fill(null)},et.prototype.interfaces_=function(){return[]},et.prototype.getClass=function(){return et},et.isRing=function(r){return!(r.length<4)&&!!r[0].equals2D(r[r.length-1])},et.ptNotInList=function(r,o){for(var a=0;a<r.length;a++){var l=r[a];if(et.indexOf(l,o)<0)return l}return null},et.scroll=function(r,o){var a=et.indexOf(o,r);if(a<0)return null;var l=new Array(r.length).fill(null);Ut.arraycopy(r,a,l,0,r.length-a),Ut.arraycopy(r,0,l,r.length-a,a),Ut.arraycopy(l,0,r,0,r.length)},et.equals=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];if(r===o)return!0;if(r===null||o===null||r.length!==o.length)return!1;for(var a=0;a<r.length;a++)if(!r[a].equals(o[a]))return!1;return!0}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var S=0;S<l.length;S++)if(m.compare(l[S],h[S])!==0)return!1;return!0}},et.intersection=function(r,o){for(var a=new J,l=0;l<r.length;l++)o.intersects(r[l])&&a.add(r[l],!0);return a.toCoordinateArray()},et.hasRepeatedPoints=function(r){for(var o=1;o<r.length;o++)if(r[o-1].equals(r[o]))return!0;return!1},et.removeRepeatedPoints=function(r){return et.hasRepeatedPoints(r)?new J(r,!1).toCoordinateArray():r},et.reverse=function(r){for(var o=r.length-1,a=Math.trunc(o/2),l=0;l<=a;l++){var h=r[l];r[l]=r[o-l],r[o-l]=h}},et.removeNull=function(r){for(var o=0,a=0;a<r.length;a++)r[a]!==null&&o++;var l=new Array(o).fill(null);if(o===0)return l;for(var h=0,m=0;m<r.length;m++)r[m]!==null&&(l[h++]=r[m]);return l},et.copyDeep=function(){if(arguments.length===1){for(var r=arguments[0],o=new Array(r.length).fill(null),a=0;a<r.length;a++)o[a]=new P(r[a]);return o}if(arguments.length===5)for(var l=arguments[0],h=arguments[1],m=arguments[2],S=arguments[3],C=arguments[4],z=0;z<C;z++)m[S+z]=new P(l[h+z])},et.isEqualReversed=function(r,o){for(var a=0;a<r.length;a++){var l=r[a],h=o[r.length-a-1];if(l.compareTo(h)!==0)return!1}return!0},et.envelope=function(r){for(var o=new Ct,a=0;a<r.length;a++)o.expandToInclude(r[a]);return o},et.toCoordinateArray=function(r){return r.toArray(et.coordArrayType)},et.atLeastNCoordinatesOrNothing=function(r,o){return o.length>=r?o:[]},et.indexOf=function(r,o){for(var a=0;a<o.length;a++)if(r.equals(o[a]))return a;return-1},et.increasingDirection=function(r){for(var o=0;o<Math.trunc(r.length/2);o++){var a=r.length-1-o,l=r[o].compareTo(r[a]);if(l!==0)return l}return 1},et.compare=function(r,o){for(var a=0;a<r.length&&a<o.length;){var l=r[a].compareTo(o[a]);if(l!==0)return l;a++}return a<o.length?-1:a<r.length?1:0},et.minCoordinate=function(r){for(var o=null,a=0;a<r.length;a++)(o===null||o.compareTo(r[a])>0)&&(o=r[a]);return o},et.extract=function(r,o,a){o=gt.clamp(o,0,r.length);var l=(a=gt.clamp(a,-1,r.length))-o+1;a<0&&(l=0),o>=r.length&&(l=0),a<o&&(l=0);var h=new Array(l).fill(null);if(l===0)return h;for(var m=0,S=o;S<=a;S++)h[m++]=r[S];return h},Object.defineProperties(et,Tt);var kt=function(){};kt.prototype.compare=function(r,o){return et.compare(r,o)},kt.prototype.interfaces_=function(){return[D]},kt.prototype.getClass=function(){return kt};var ie=function(){};ie.prototype.compare=function(r,o){var a=r,l=o;if(a.length<l.length)return-1;if(a.length>l.length)return 1;if(a.length===0)return 0;var h=et.compare(a,l);return et.isEqualReversed(a,l)?0:h},ie.prototype.OLDcompare=function(r,o){var a=r,l=o;if(a.length<l.length)return-1;if(a.length>l.length)return 1;if(a.length===0)return 0;for(var h=et.increasingDirection(a),m=et.increasingDirection(l),S=h>0?0:a.length-1,C=m>0?0:a.length-1,z=0;z<a.length;z++){var K=a[S].compareTo(l[C]);if(K!==0)return K;S+=h,C+=m}return 0},ie.prototype.interfaces_=function(){return[D]},ie.prototype.getClass=function(){return ie};var oe=function(){};oe.prototype.get=function(){},oe.prototype.put=function(){},oe.prototype.size=function(){},oe.prototype.values=function(){},oe.prototype.entrySet=function(){};var we=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o}(oe);(s.prototype=new Error).name="OperationNotSupported",(u.prototype=new tt).contains=function(){};var ye=function(r){function o(){r.call(this),this.array_=[],arguments[0]instanceof tt&&this.addAll(arguments[0])}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.contains=function(a){for(var l=0,h=this.array_.length;l<h;l++)if(this.array_[l]===a)return!0;return!1},o.prototype.add=function(a){return!this.contains(a)&&(this.array_.push(a),!0)},o.prototype.addAll=function(a){for(var l=a.iterator();l.hasNext();)this.add(l.next());return!0},o.prototype.remove=function(a){throw new Error},o.prototype.size=function(){return this.array_.length},o.prototype.isEmpty=function(){return this.array_.length===0},o.prototype.toArray=function(){for(var a=[],l=0,h=this.array_.length;l<h;l++)a.push(this.array_[l]);return a},o.prototype.iterator=function(){return new be(this)},o}(u),be=function(r){function o(a){r.call(this),this.hashSet_=a,this.position_=0}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new i;return this.hashSet_.array_[this.position_++]},o.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},o.prototype.remove=function(){throw new s},o}(pt),Ae=0;(y.prototype=new we).get=function(r){for(var o=this.root_;o!==null;){var a=r.compareTo(o.key);if(a<0)o=o.left;else{if(!(a>0))return o.value;o=o.right}}return null},y.prototype.put=function(r,o){if(this.root_===null)return this.root_={key:r,value:o,left:null,right:null,parent:null,color:Ae,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var a,l,h=this.root_;do if(a=h,(l=r.compareTo(h.key))<0)h=h.left;else{if(!(l>0)){var m=h.value;return h.value=o,m}h=h.right}while(h!==null);var S={key:r,left:null,right:null,value:o,parent:a,color:Ae,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?a.left=S:a.right=S,this.fixAfterInsertion(S),this.size_++,null},y.prototype.fixAfterInsertion=function(r){for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)if(f(r)===d(f(f(r)))){var o=g(f(f(r)));c(o)===1?(p(f(r),Ae),p(o,Ae),p(f(f(r)),1),r=f(f(r))):(r===g(f(r))&&(r=f(r),this.rotateLeft(r)),p(f(r),Ae),p(f(f(r)),1),this.rotateRight(f(f(r))))}else{var a=d(f(f(r)));c(a)===1?(p(f(r),Ae),p(a,Ae),p(f(f(r)),1),r=f(f(r))):(r===d(f(r))&&(r=f(r),this.rotateRight(r)),p(f(r),Ae),p(f(f(r)),1),this.rotateLeft(f(f(r))))}this.root_.color=Ae},y.prototype.values=function(){var r=new O,o=this.getFirstEntry();if(o!==null)for(r.add(o.value);(o=y.successor(o))!==null;)r.add(o.value);return r},y.prototype.entrySet=function(){var r=new ye,o=this.getFirstEntry();if(o!==null)for(r.add(o);(o=y.successor(o))!==null;)r.add(o);return r},y.prototype.rotateLeft=function(r){if(r!=null){var o=r.right;r.right=o.left,o.left!=null&&(o.left.parent=r),o.parent=r.parent,r.parent===null?this.root_=o:r.parent.left===r?r.parent.left=o:r.parent.right=o,o.left=r,r.parent=o}},y.prototype.rotateRight=function(r){if(r!=null){var o=r.left;r.left=o.right,o.right!=null&&(o.right.parent=r),o.parent=r.parent,r.parent===null?this.root_=o:r.parent.right===r?r.parent.right=o:r.parent.left=o,o.right=r,r.parent=o}},y.prototype.getFirstEntry=function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r},y.successor=function(r){if(r===null)return null;if(r.right!==null){for(var o=r.right;o.left!==null;)o=o.left;return o}for(var a=r.parent,l=r;a!==null&&l===a.right;)l=a,a=a.parent;return a},y.prototype.size=function(){return this.size_};var Bn=function(){};Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn},v.prototype=new u,(E.prototype=new v).contains=function(r){for(var o=0,a=this.array_.length;o<a;o++)if(this.array_[o].compareTo(r)===0)return!0;return!1},E.prototype.add=function(r){if(this.contains(r))return!1;for(var o=0,a=this.array_.length;o<a;o++)if(this.array_[o].compareTo(r)===1)return this.array_.splice(o,0,r),!0;return this.array_.push(r),!0},E.prototype.addAll=function(r){for(var o=r.iterator();o.hasNext();)this.add(o.next());return!0},E.prototype.remove=function(r){throw new s},E.prototype.size=function(){return this.array_.length},E.prototype.isEmpty=function(){return this.array_.length===0},E.prototype.toArray=function(){for(var r=[],o=0,a=this.array_.length;o<a;o++)r.push(this.array_[o]);return r},E.prototype.iterator=function(){return new dr(this)};var dr=function(r){this.treeSet_=r,this.position_=0};dr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new i;return this.treeSet_.array_[this.position_++]},dr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},dr.prototype.remove=function(){throw new s};var _n=function(){};_n.sort=function(){var r,o,a,l,h=arguments[0];if(arguments.length===1)l=function(S,C){return S.compareTo(C)},h.sort(l);else if(arguments.length===2)a=arguments[1],l=function(S,C){return a.compare(S,C)},h.sort(l);else if(arguments.length===3){(o=h.slice(arguments[1],arguments[2])).sort();var m=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length));for(h.splice(0,h.length),r=0;r<m.length;r++)h.push(m[r])}else if(arguments.length===4)for(o=h.slice(arguments[1],arguments[2]),a=arguments[3],l=function(S,C){return a.compare(S,C)},o.sort(l),m=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length)),h.splice(0,h.length),r=0;r<m.length;r++)h.push(m[r])},_n.asList=function(r){for(var o=new O,a=0,l=r.length;a<l;a++)o.add(r[a]);return o};var pe=function(){},xn={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};xn.P.get=function(){return 0},xn.L.get=function(){return 1},xn.A.get=function(){return 2},xn.FALSE.get=function(){return-1},xn.TRUE.get=function(){return-2},xn.DONTCARE.get=function(){return-3},xn.SYM_FALSE.get=function(){return"F"},xn.SYM_TRUE.get=function(){return"T"},xn.SYM_DONTCARE.get=function(){return"*"},xn.SYM_P.get=function(){return"0"},xn.SYM_L.get=function(){return"1"},xn.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(r){switch(r){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new T("Unknown dimension value: "+r)},pe.toDimensionValue=function(r){switch(lt.toUpperCase(r)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new T("Unknown dimension symbol: "+r)},Object.defineProperties(pe,xn);var Nn=function(){};Nn.prototype.filter=function(r){},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn};var Cn=function(){};Cn.prototype.filter=function(r,o){},Cn.prototype.isDone=function(){},Cn.prototype.isGeometryChanged=function(){},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var En=function(r){function o(l,h){if(r.call(this,h),this._geometries=l||[],r.hasNullElements(this._geometries))throw new T("geometries must not contain null elements")}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){for(var l=new Ct,h=0;h<this._geometries.length;h++)l.expandToInclude(this._geometries[h].getEnvelopeInternal());return l},o.prototype.getGeometryN=function(l){return this._geometries[l]},o.prototype.getSortIndex=function(){return r.SORTINDEX_GEOMETRYCOLLECTION},o.prototype.getCoordinates=function(){for(var l=new Array(this.getNumPoints()).fill(null),h=-1,m=0;m<this._geometries.length;m++)for(var S=this._geometries[m].getCoordinates(),C=0;C<S.length;C++)l[++h]=S[C];return l},o.prototype.getArea=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getArea();return l},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var m=l;if(this._geometries.length!==m._geometries.length)return!1;for(var S=0;S<this._geometries.length;S++)if(!this._geometries[S].equalsExact(m._geometries[S],h))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){for(var l=0;l<this._geometries.length;l++)this._geometries[l].normalize();_n.sort(this._geometries)},o.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},o.prototype.getBoundaryDimension=function(){for(var l=pe.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getBoundaryDimension());return l},o.prototype.getDimension=function(){for(var l=pe.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getDimension());return l},o.prototype.getLength=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getLength();return l},o.prototype.getNumPoints=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getNumPoints();return l},o.prototype.getNumGeometries=function(){return this._geometries.length},o.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),m=0;m<this._geometries.length;m++)h[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(h)},o.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=new E(_n.asList(this._geometries)),m=new E(_n.asList(l._geometries));return this.compare(h,m)}if(arguments.length===2){for(var S=arguments[0],C=arguments[1],z=S,K=this.getNumGeometries(),mt=z.getNumGeometries(),yt=0;yt<K&&yt<mt;){var zt=this.getGeometryN(yt),qt=z.getGeometryN(yt),jt=zt.compareToSameClass(qt,C);if(jt!==0)return jt;yt++}return yt<K?1:yt<mt?-1:0}},o.prototype.apply=function(){if($(arguments[0],j))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if($(arguments[0],Cn)){var m=arguments[0];if(this._geometries.length===0)return null;for(var S=0;S<this._geometries.length&&(this._geometries[S].apply(m),!m.isDone());S++);m.isGeometryChanged()&&this.geometryChanged()}else if($(arguments[0],Nn)){var C=arguments[0];C.filter(this);for(var z=0;z<this._geometries.length;z++)this._geometries[z].apply(C)}else if($(arguments[0],ce)){var K=arguments[0];K.filter(this);for(var mt=0;mt<this._geometries.length;mt++)this._geometries[mt].apply(K)}},o.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Pt.shouldNeverReachHere(),null},o.prototype.clone=function(){var l=r.prototype.clone.call(this);l._geometries=new Array(this._geometries.length).fill(null);for(var h=0;h<this._geometries.length;h++)l._geometries[h]=this._geometries[h].clone();return l},o.prototype.getGeometryType=function(){return"GeometryCollection"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.isEmpty=function(){for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isEmpty())return!1;return!0},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(o,a),o}(Rt),Kr=function(r){function o(){r.apply(this,arguments)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_MULTILINESTRING},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&r.prototype.equalsExact.call(this,l,h)}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},o.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isClosed())return!1;return!0},o.prototype.getDimension=function(){return 1},o.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),m=0;m<this._geometries.length;m++)h[l-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(h)},o.prototype.getBoundary=function(){return new Ar(this).getBoundary()},o.prototype.getGeometryType=function(){return"MultiLineString"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.interfaces_=function(){return[Bn]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(o,a),o}(En),Ar=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var r=arguments[0],o=b.MOD2_BOUNDARY_RULE;this._geom=r,this._geomFact=r.getFactory(),this._bnRule=o}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._geom=a,this._geomFact=a.getFactory(),this._bnRule=l}};Ar.prototype.boundaryMultiLineString=function(r){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var o=this.computeBoundaryCoordinates(r);return o.length===1?this._geomFact.createPoint(o[0]):this._geomFact.createMultiPointFromCoords(o)},Ar.prototype.getBoundary=function(){return this._geom instanceof ut?this.boundaryLineString(this._geom):this._geom instanceof Kr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Ar.prototype.boundaryLineString=function(r){return this._geom.isEmpty()?this.getEmptyMultiPoint():r.isClosed()?this._bnRule.isInBoundary(2)?r.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([r.getStartPoint(),r.getEndPoint()])},Ar.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Ar.prototype.computeBoundaryCoordinates=function(r){var o=new O;this._endpointMap=new y;for(var a=0;a<r.getNumGeometries();a++){var l=r.getGeometryN(a);l.getNumPoints()!==0&&(this.addEndpoint(l.getCoordinateN(0)),this.addEndpoint(l.getCoordinateN(l.getNumPoints()-1)))}for(var h=this._endpointMap.entrySet().iterator();h.hasNext();){var m=h.next(),S=m.getValue().count;this._bnRule.isInBoundary(S)&&o.add(m.getKey())}return et.toCoordinateArray(o)},Ar.prototype.addEndpoint=function(r){var o=this._endpointMap.get(r);o===null&&(o=new q,this._endpointMap.put(r,o)),o.count++},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar},Ar.getBoundary=function(){if(arguments.length===1){var r=arguments[0];return new Ar(r).getBoundary()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new Ar(o,a).getBoundary()}};var q=function(){this.count=null};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q};var at=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.chars=function(r,o){for(var a=new Array(o).fill(null),l=0;l<o;l++)a[l]=r;return String(a)},at.getStackTrace=function(){if(arguments.length===1){var r=arguments[0],o=new function(){},a=new function(){}(o);return r.printStackTrace(a),o.toString()}if(arguments.length===2){for(var l=arguments[0],h=arguments[1],m="",S=new function(){}(new function(){}(at.getStackTrace(l))),C=0;C<h;C++)try{m+=S.readLine()+at.NEWLINE}catch(z){if(!(z instanceof M))throw z;Pt.shouldNeverReachHere()}return m}},at.split=function(r,o){for(var a=o.length,l=new O,h=""+r,m=h.indexOf(o);m>=0;){var S=h.substring(0,m);l.add(S),m=(h=h.substring(m+a)).indexOf(o)}h.length>0&&l.add(h);for(var C=new Array(l.size()).fill(null),z=0;z<C.length;z++)C[z]=l.get(z);return C},at.toString=function(){if(arguments.length===1){var r=arguments[0];return at.SIMPLE_ORDINATE_FORMAT.format(r)}},at.spaces=function(r){return at.chars(" ",r)},Et.NEWLINE.get=function(){return Ut.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(at,Et);var dt=function(){};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.copyCoord=function(r,o,a,l){for(var h=Math.min(r.getDimension(),a.getDimension()),m=0;m<h;m++)a.setOrdinate(l,m,r.getOrdinate(o,m))},dt.isRing=function(r){var o=r.size();return o===0||!(o<=3)&&r.getOrdinate(0,nt.X)===r.getOrdinate(o-1,nt.X)&&r.getOrdinate(0,nt.Y)===r.getOrdinate(o-1,nt.Y)},dt.isEqual=function(r,o){var a=r.size();if(a!==o.size())return!1;for(var l=Math.min(r.getDimension(),o.getDimension()),h=0;h<a;h++)for(var m=0;m<l;m++){var S=r.getOrdinate(h,m),C=o.getOrdinate(h,m);if(r.getOrdinate(h,m)!==o.getOrdinate(h,m)&&(!w.isNaN(S)||!w.isNaN(C)))return!1}return!0},dt.extend=function(r,o,a){var l=r.create(a,o.getDimension()),h=o.size();if(dt.copy(o,0,l,0,h),h>0)for(var m=h;m<a;m++)dt.copy(o,h-1,l,m,1);return l},dt.reverse=function(r){for(var o=r.size()-1,a=Math.trunc(o/2),l=0;l<=a;l++)dt.swap(r,l,o-l)},dt.swap=function(r,o,a){if(o===a)return null;for(var l=0;l<r.getDimension();l++){var h=r.getOrdinate(o,l);r.setOrdinate(o,l,r.getOrdinate(a,l)),r.setOrdinate(a,l,h)}},dt.copy=function(r,o,a,l,h){for(var m=0;m<h;m++)dt.copyCoord(r,o+m,a,l+m)},dt.toString=function(){if(arguments.length===1){var r=arguments[0],o=r.size();if(o===0)return"()";var a=r.getDimension(),l=new vt;l.append("(");for(var h=0;h<o;h++){h>0&&l.append(" ");for(var m=0;m<a;m++)m>0&&l.append(","),l.append(at.toString(r.getOrdinate(h,m)))}return l.append(")"),l.toString()}},dt.ensureValidRing=function(r,o){var a=o.size();return a===0?o:a<=3?dt.createClosedRing(r,o,4):o.getOrdinate(0,nt.X)===o.getOrdinate(a-1,nt.X)&&o.getOrdinate(0,nt.Y)===o.getOrdinate(a-1,nt.Y)?o:dt.createClosedRing(r,o,a+1)},dt.createClosedRing=function(r,o,a){var l=r.create(a,o.getDimension()),h=o.size();dt.copy(o,0,l,0,h);for(var m=h;m<a;m++)dt.copy(o,0,l,m,1);return l};var ut=function(r){function o(l,h){r.call(this,h),this._points=null,this.init(l)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Ct:this._points.expandEnvelope(new Ct)},o.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},o.prototype.getSortIndex=function(){return r.SORTINDEX_LINESTRING},o.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var m=l;if(this._points.size()!==m._points.size())return!1;for(var S=0;S<this._points.size();S++)if(!this.equal(this._points.getCoordinate(S),m._points.getCoordinate(S),h))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){for(var l=0;l<Math.trunc(this._points.size()/2);l++){var h=this._points.size()-1-l;if(!this._points.getCoordinate(l).equals(this._points.getCoordinate(h)))return this._points.getCoordinate(l).compareTo(this._points.getCoordinate(h))>0&&dt.reverse(this._points),null}},o.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},o.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},o.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},o.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},o.prototype.getDimension=function(){return 1},o.prototype.getLength=function(){return ot.computeLength(this._points)},o.prototype.getNumPoints=function(){return this._points.size()},o.prototype.reverse=function(){var l=this._points.copy();return dt.reverse(l),this.getFactory().createLineString(l)},o.prototype.compareToSameClass=function(){if(arguments.length===1){for(var l=arguments[0],h=0,m=0;h<this._points.size()&&m<l._points.size();){var S=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(m));if(S!==0)return S;h++,m++}return h<this._points.size()?1:m<l._points.size()?-1:0}if(arguments.length===2){var C=arguments[0];return arguments[1].compare(this._points,C._points)}},o.prototype.apply=function(){if($(arguments[0],j))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if($(arguments[0],Cn)){var m=arguments[0];if(this._points.size()===0)return null;for(var S=0;S<this._points.size()&&(m.filter(this._points,S),!m.isDone());S++);m.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Nn)?arguments[0].filter(this):$(arguments[0],ce)&&arguments[0].filter(this)},o.prototype.getBoundary=function(){return new Ar(this).getBoundary()},o.prototype.isEquivalentClass=function(l){return l instanceof o},o.prototype.clone=function(){var l=r.prototype.clone.call(this);return l._points=this._points.clone(),l},o.prototype.getCoordinateN=function(l){return this._points.getCoordinate(l)},o.prototype.getGeometryType=function(){return"LineString"},o.prototype.copy=function(){return new o(this._points.copy(),this._factory)},o.prototype.getCoordinateSequence=function(){return this._points},o.prototype.isEmpty=function(){return this._points.size()===0},o.prototype.init=function(l){if(l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),l.size()===1)throw new T("Invalid number of points in LineString (found "+l.size()+" - must be 0 or >= 2)");this._points=l},o.prototype.isCoordinate=function(l){for(var h=0;h<this._points.size();h++)if(this._points.getCoordinate(h).equals(l))return!0;return!1},o.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},o.prototype.getPointN=function(l){return this.getFactory().createPoint(this._points.getCoordinate(l))},o.prototype.interfaces_=function(){return[Bn]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(o,a),o}(Rt),Qt=function(){};Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt};var te=function(r){function o(l,h){r.call(this,h),this._coordinates=l||null,this.init(this._coordinates)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Ct;var l=new Ct;return l.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),l},o.prototype.getSortIndex=function(){return r.SORTINDEX_POINT},o.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&(!(!this.isEmpty()||!l.isEmpty())||this.isEmpty()===l.isEmpty()&&this.equal(l.getCoordinate(),this.getCoordinate(),h))}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){},o.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},o.prototype.getBoundaryDimension=function(){return pe.FALSE},o.prototype.getDimension=function(){return 0},o.prototype.getNumPoints=function(){return this.isEmpty()?0:1},o.prototype.reverse=function(){return this.copy()},o.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},o.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0];return this.getCoordinate().compareTo(l.getCoordinate())}if(arguments.length===2){var h=arguments[0];return arguments[1].compare(this._coordinates,h._coordinates)}},o.prototype.apply=function(){if($(arguments[0],j)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if($(arguments[0],Cn)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Nn)?arguments[0].filter(this):$(arguments[0],ce)&&arguments[0].filter(this)},o.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},o.prototype.clone=function(){var l=r.prototype.clone.call(this);return l._coordinates=this._coordinates.clone(),l},o.prototype.getGeometryType=function(){return"Point"},o.prototype.copy=function(){return new o(this._coordinates.copy(),this._factory)},o.prototype.getCoordinateSequence=function(){return this._coordinates},o.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},o.prototype.isEmpty=function(){return this._coordinates.size()===0},o.prototype.init=function(l){l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),Pt.isTrue(l.size()<=1),this._coordinates=l},o.prototype.isSimple=function(){return!0},o.prototype.interfaces_=function(){return[Qt]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(o,a),o}(Rt),le=function(){};le.prototype.interfaces_=function(){return[]},le.prototype.getClass=function(){return le};var re=function(r){function o(l,h,m){if(r.call(this,m),this._shell=null,this._holes=null,l===null&&(l=this.getFactory().createLinearRing()),h===null&&(h=[]),r.hasNullElements(h))throw new T("holes must not contain null elements");if(l.isEmpty()&&r.hasNonEmptyElements(h))throw new T("shell is empty but holes are not");this._shell=l,this._holes=h}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},o.prototype.getSortIndex=function(){return r.SORTINDEX_POLYGON},o.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var l=new Array(this.getNumPoints()).fill(null),h=-1,m=this._shell.getCoordinates(),S=0;S<m.length;S++)l[++h]=m[S];for(var C=0;C<this._holes.length;C++)for(var z=this._holes[C].getCoordinates(),K=0;K<z.length;K++)l[++h]=z[K];return l},o.prototype.getArea=function(){var l=0;l+=Math.abs(ot.signedArea(this._shell.getCoordinateSequence()));for(var h=0;h<this._holes.length;h++)l-=Math.abs(ot.signedArea(this._holes[h].getCoordinateSequence()));return l},o.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var l=this._shell.getCoordinateSequence(),h=this.getEnvelopeInternal(),m=0;m<5;m++){var S=l.getX(m);if(S!==h.getMinX()&&S!==h.getMaxX())return!1;var C=l.getY(m);if(C!==h.getMinY()&&C!==h.getMaxY())return!1}for(var z=l.getX(0),K=l.getY(0),mt=1;mt<=4;mt++){var yt=l.getX(mt),zt=l.getY(mt);if(yt!==z==(zt!==K))return!1;z=yt,K=zt}return!0},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var m=l,S=this._shell,C=m._shell;if(!S.equalsExact(C,h)||this._holes.length!==m._holes.length)return!1;for(var z=0;z<this._holes.length;z++)if(!this._holes[z].equalsExact(m._holes[z],h))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var l=0;l<this._holes.length;l++)this.normalize(this._holes[l],!1);_n.sort(this._holes)}else if(arguments.length===2){var h=arguments[0],m=arguments[1];if(h.isEmpty())return null;var S=new Array(h.getCoordinates().length-1).fill(null);Ut.arraycopy(h.getCoordinates(),0,S,0,S.length);var C=et.minCoordinate(h.getCoordinates());et.scroll(S,C),Ut.arraycopy(S,0,h.getCoordinates(),0,S.length),h.getCoordinates()[S.length]=S[0],ot.isCCW(h.getCoordinates())===m&&et.reverse(h.getCoordinates())}},o.prototype.getCoordinate=function(){return this._shell.getCoordinate()},o.prototype.getNumInteriorRing=function(){return this._holes.length},o.prototype.getBoundaryDimension=function(){return 1},o.prototype.getDimension=function(){return 2},o.prototype.getLength=function(){var l=0;l+=this._shell.getLength();for(var h=0;h<this._holes.length;h++)l+=this._holes[h].getLength();return l},o.prototype.getNumPoints=function(){for(var l=this._shell.getNumPoints(),h=0;h<this._holes.length;h++)l+=this._holes[h].getNumPoints();return l},o.prototype.reverse=function(){var l=this.copy();l._shell=this._shell.copy().reverse(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].copy().reverse();return l},o.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},o.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=this._shell,m=l._shell;return h.compareToSameClass(m)}if(arguments.length===2){var S=arguments[0],C=arguments[1],z=S,K=this._shell,mt=z._shell,yt=K.compareToSameClass(mt,C);if(yt!==0)return yt;for(var zt=this.getNumInteriorRing(),qt=z.getNumInteriorRing(),jt=0;jt<zt&&jt<qt;){var ue=this.getInteriorRingN(jt),dn=z.getInteriorRingN(jt),Xn=ue.compareToSameClass(dn,C);if(Xn!==0)return Xn;jt++}return jt<zt?1:jt<qt?-1:0}},o.prototype.apply=function(l){if($(l,j)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if($(l,Cn)){if(this._shell.apply(l),!l.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(l),!l.isDone());m++);l.isGeometryChanged()&&this.geometryChanged()}else if($(l,Nn))l.filter(this);else if($(l,ce)){l.filter(this),this._shell.apply(l);for(var S=0;S<this._holes.length;S++)this._holes[S].apply(l)}},o.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var l=new Array(this._holes.length+1).fill(null);l[0]=this._shell;for(var h=0;h<this._holes.length;h++)l[h+1]=this._holes[h];return l.length<=1?this.getFactory().createLinearRing(l[0].getCoordinateSequence()):this.getFactory().createMultiLineString(l)},o.prototype.clone=function(){var l=r.prototype.clone.call(this);l._shell=this._shell.clone(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].clone();return l},o.prototype.getGeometryType=function(){return"Polygon"},o.prototype.copy=function(){for(var l=this._shell.copy(),h=new Array(this._holes.length).fill(null),m=0;m<h.length;m++)h[m]=this._holes[m].copy();return new o(l,h,this._factory)},o.prototype.getExteriorRing=function(){return this._shell},o.prototype.isEmpty=function(){return this._shell.isEmpty()},o.prototype.getInteriorRingN=function(l){return this._holes[l]},o.prototype.interfaces_=function(){return[le]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(o,a),o}(Rt),ve=function(r){function o(){r.apply(this,arguments)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_MULTIPOINT},o.prototype.isValid=function(){return!0},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&r.prototype.equalsExact.call(this,l,h)}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.getCoordinate=function(){if(arguments.length===1){var l=arguments[0];return this._geometries[l].getCoordinate()}return r.prototype.getCoordinate.apply(this,arguments)},o.prototype.getBoundaryDimension=function(){return pe.FALSE},o.prototype.getDimension=function(){return 0},o.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},o.prototype.getGeometryType=function(){return"MultiPoint"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.interfaces_=function(){return[Qt]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(o,a),o}(En),fe=function(r){function o(l,h){l instanceof P&&h instanceof me&&(l=h.getCoordinateSequenceFactory().create(l)),r.call(this,l,h),this.validateConstruction()}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_LINEARRING},o.prototype.getBoundaryDimension=function(){return pe.FALSE},o.prototype.isClosed=function(){return!!this.isEmpty()||r.prototype.isClosed.call(this)},o.prototype.reverse=function(){var l=this._points.copy();return dt.reverse(l),this.getFactory().createLinearRing(l)},o.prototype.validateConstruction=function(){if(!this.isEmpty()&&!r.prototype.isClosed.call(this))throw new T("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<o.MINIMUM_VALID_SIZE)throw new T("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},o.prototype.getGeometryType=function(){return"LinearRing"},o.prototype.copy=function(){return new o(this._points.copy(),this._factory)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},a.MINIMUM_VALID_SIZE.get=function(){return 4},a.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(o,a),o}(ut),he=function(r){function o(){r.apply(this,arguments)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_MULTIPOLYGON},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&r.prototype.equalsExact.call(this,l,h)}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.getBoundaryDimension=function(){return 1},o.prototype.getDimension=function(){return 2},o.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),m=0;m<this._geometries.length;m++)h[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(h)},o.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var l=new O,h=0;h<this._geometries.length;h++)for(var m=this._geometries[h].getBoundary(),S=0;S<m.getNumGeometries();S++)l.add(m.getGeometryN(S));var C=new Array(l.size()).fill(null);return this.getFactory().createMultiLineString(l.toArray(C))},o.prototype.getGeometryType=function(){return"MultiPolygon"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.interfaces_=function(){return[le]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(o,a),o}(En),cn=function(r){this._factory=r||null,this._isUserDataCopied=!1},Tr={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};cn.prototype.setCopyUserData=function(r){this._isUserDataCopied=r},cn.prototype.edit=function(r,o){if(r===null)return null;var a=this.editInternal(r,o);return this._isUserDataCopied&&a.setUserData(r.getUserData()),a},cn.prototype.editInternal=function(r,o){return this._factory===null&&(this._factory=r.getFactory()),r instanceof En?this.editGeometryCollection(r,o):r instanceof re?this.editPolygon(r,o):r instanceof te?o.edit(r,this._factory):r instanceof ut?o.edit(r,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+r.getClass().getName()),null)},cn.prototype.editGeometryCollection=function(r,o){for(var a=o.edit(r,this._factory),l=new O,h=0;h<a.getNumGeometries();h++){var m=this.edit(a.getGeometryN(h),o);m===null||m.isEmpty()||l.add(m)}return a.getClass()===ve?this._factory.createMultiPoint(l.toArray([])):a.getClass()===Kr?this._factory.createMultiLineString(l.toArray([])):a.getClass()===he?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},cn.prototype.editPolygon=function(r,o){var a=o.edit(r,this._factory);if(a===null&&(a=this._factory.createPolygon(null)),a.isEmpty())return a;var l=this.edit(a.getExteriorRing(),o);if(l===null||l.isEmpty())return this._factory.createPolygon();for(var h=new O,m=0;m<a.getNumInteriorRing();m++){var S=this.edit(a.getInteriorRingN(m),o);S===null||S.isEmpty()||h.add(S)}return this._factory.createPolygon(l,h.toArray([]))},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.GeometryEditorOperation=function(){},Tr.NoOpGeometryOperation.get=function(){return qn},Tr.CoordinateOperation.get=function(){return hi},Tr.CoordinateSequenceOperation.get=function(){return wn},Object.defineProperties(cn,Tr);var qn=function(){};qn.prototype.edit=function(r,o){return r},qn.prototype.interfaces_=function(){return[cn.GeometryEditorOperation]},qn.prototype.getClass=function(){return qn};var hi=function(){};hi.prototype.edit=function(r,o){var a=this.editCoordinates(r.getCoordinates(),r);return a===null?r:r instanceof fe?o.createLinearRing(a):r instanceof ut?o.createLineString(a):r instanceof te?a.length>0?o.createPoint(a[0]):o.createPoint():r},hi.prototype.interfaces_=function(){return[cn.GeometryEditorOperation]},hi.prototype.getClass=function(){return hi};var wn=function(){};wn.prototype.edit=function(r,o){return r instanceof fe?o.createLinearRing(this.edit(r.getCoordinateSequence(),r)):r instanceof ut?o.createLineString(this.edit(r.getCoordinateSequence(),r)):r instanceof te?o.createPoint(this.edit(r.getCoordinateSequence(),r)):r},wn.prototype.interfaces_=function(){return[cn.GeometryEditorOperation]},wn.prototype.getClass=function(){return wn};var se=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var r=arguments[0];this._coordinates=new Array(r).fill(null);for(var o=0;o<r;o++)this._coordinates[o]=new P}else if($(arguments[0],nt)){var a=arguments[0];if(a===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=a.getDimension(),this._coordinates=new Array(a.size()).fill(null);for(var l=0;l<this._coordinates.length;l++)this._coordinates[l]=a.getCoordinateCopy(l)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var h=arguments[0],m=arguments[1];this._coordinates=h,this._dimension=m,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var S=arguments[0],C=arguments[1];this._coordinates=new Array(S).fill(null),this._dimension=C;for(var z=0;z<S;z++)this._coordinates[z]=new P}}},bu={serialVersionUID:{configurable:!0}};se.prototype.setOrdinate=function(r,o,a){switch(o){case nt.X:this._coordinates[r].x=a;break;case nt.Y:this._coordinates[r].y=a;break;case nt.Z:this._coordinates[r].z=a;break;default:throw new T("invalid ordinateIndex")}},se.prototype.size=function(){return this._coordinates.length},se.prototype.getOrdinate=function(r,o){switch(o){case nt.X:return this._coordinates[r].x;case nt.Y:return this._coordinates[r].y;case nt.Z:return this._coordinates[r].z}return w.NaN},se.prototype.getCoordinate=function(){if(arguments.length===1){var r=arguments[0];return this._coordinates[r]}if(arguments.length===2){var o=arguments[0],a=arguments[1];a.x=this._coordinates[o].x,a.y=this._coordinates[o].y,a.z=this._coordinates[o].z}},se.prototype.getCoordinateCopy=function(r){return new P(this._coordinates[r])},se.prototype.getDimension=function(){return this._dimension},se.prototype.getX=function(r){return this._coordinates[r].x},se.prototype.clone=function(){for(var r=new Array(this.size()).fill(null),o=0;o<this._coordinates.length;o++)r[o]=this._coordinates[o].clone();return new se(r,this._dimension)},se.prototype.expandEnvelope=function(r){for(var o=0;o<this._coordinates.length;o++)r.expandToInclude(this._coordinates[o]);return r},se.prototype.copy=function(){for(var r=new Array(this.size()).fill(null),o=0;o<this._coordinates.length;o++)r[o]=this._coordinates[o].copy();return new se(r,this._dimension)},se.prototype.toString=function(){if(this._coordinates.length>0){var r=new vt(17*this._coordinates.length);r.append("("),r.append(this._coordinates[0]);for(var o=1;o<this._coordinates.length;o++)r.append(", "),r.append(this._coordinates[o]);return r.append(")"),r.toString()}return"()"},se.prototype.getY=function(r){return this._coordinates[r].y},se.prototype.toCoordinateArray=function(){return this._coordinates},se.prototype.interfaces_=function(){return[nt,t]},se.prototype.getClass=function(){return se},bu.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(se,bu);var fn=function(){},fo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};fn.prototype.readResolve=function(){return fn.instance()},fn.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new se(r)}if($(arguments[0],nt)){var o=arguments[0];return new se(o)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new se(a):new se(a,l)}},fn.prototype.interfaces_=function(){return[W,t]},fn.prototype.getClass=function(){return fn},fn.instance=function(){return fn.instanceObject},fo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},fo.instanceObject.get=function(){return new fn},Object.defineProperties(fn,fo);var fc=function(r){function o(){r.call(this),this.map_=new Map}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.get=function(a){return this.map_.get(a)||null},o.prototype.put=function(a,l){return this.map_.set(a,l),l},o.prototype.values=function(){for(var a=new O,l=this.map_.values(),h=l.next();!h.done;)a.add(h.value),h=l.next();return a},o.prototype.entrySet=function(){var a=new ye;return this.map_.entries().forEach(function(l){return a.add(l)}),a},o.prototype.size=function(){return this.map_.size()},o}(oe),_e=function r(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Mn){var o=arguments[0];this._modelType=o,o===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var a=arguments[0];this._modelType=r.FIXED,this.setScale(a)}else if(arguments[0]instanceof r){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}},Pa={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};_e.prototype.equals=function(r){if(!(r instanceof _e))return!1;var o=r;return this._modelType===o._modelType&&this._scale===o._scale},_e.prototype.compareTo=function(r){var o=r,a=this.getMaximumSignificantDigits(),l=o.getMaximumSignificantDigits();return new it(a).compareTo(new it(l))},_e.prototype.getScale=function(){return this._scale},_e.prototype.isFloating=function(){return this._modelType===_e.FLOATING||this._modelType===_e.FLOATING_SINGLE},_e.prototype.getType=function(){return this._modelType},_e.prototype.toString=function(){var r="UNKNOWN";return this._modelType===_e.FLOATING?r="Floating":this._modelType===_e.FLOATING_SINGLE?r="Floating-Single":this._modelType===_e.FIXED&&(r="Fixed (Scale="+this.getScale()+")"),r},_e.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var r=arguments[0];return w.isNaN(r)||this._modelType===_e.FLOATING_SINGLE?r:this._modelType===_e.FIXED?Math.round(r*this._scale)/this._scale:r}if(arguments[0]instanceof P){var o=arguments[0];if(this._modelType===_e.FLOATING)return null;o.x=this.makePrecise(o.x),o.y=this.makePrecise(o.y)}},_e.prototype.getMaximumSignificantDigits=function(){var r=16;return this._modelType===_e.FLOATING?r=16:this._modelType===_e.FLOATING_SINGLE?r=6:this._modelType===_e.FIXED&&(r=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),r},_e.prototype.setScale=function(r){this._scale=Math.abs(r)},_e.prototype.interfaces_=function(){return[t,B]},_e.prototype.getClass=function(){return _e},_e.mostPrecise=function(r,o){return r.compareTo(o)>=0?r:o},Pa.serialVersionUID.get=function(){return 7777263578777804e3},Pa.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(_e,Pa);var Mn=function r(o){this._name=o||null,r.nameToTypeMap.put(o,this)},ho={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Mn.prototype.readResolve=function(){return Mn.nameToTypeMap.get(this._name)},Mn.prototype.toString=function(){return this._name},Mn.prototype.interfaces_=function(){return[t]},Mn.prototype.getClass=function(){return Mn},ho.serialVersionUID.get=function(){return-552860263173159e4},ho.nameToTypeMap.get=function(){return new fc},Object.defineProperties(Mn,ho),_e.Type=Mn,_e.FIXED=new Mn("FIXED"),_e.FLOATING=new Mn("FLOATING"),_e.FLOATING_SINGLE=new Mn("FLOATING SINGLE");var me=function r(){this._precisionModel=new _e,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?$(arguments[0],W)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof _e&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},pi={serialVersionUID:{configurable:!0}};me.prototype.toGeometry=function(r){return r.isNull()?this.createPoint(null):r.getMinX()===r.getMaxX()&&r.getMinY()===r.getMaxY()?this.createPoint(new P(r.getMinX(),r.getMinY())):r.getMinX()===r.getMaxX()||r.getMinY()===r.getMaxY()?this.createLineString([new P(r.getMinX(),r.getMinY()),new P(r.getMaxX(),r.getMaxY())]):this.createPolygon(this.createLinearRing([new P(r.getMinX(),r.getMinY()),new P(r.getMinX(),r.getMaxY()),new P(r.getMaxX(),r.getMaxY()),new P(r.getMaxX(),r.getMinY()),new P(r.getMinX(),r.getMinY())]),null)},me.prototype.createLineString=function(r){return r?r instanceof Array?new ut(this.getCoordinateSequenceFactory().create(r),this):$(r,nt)?new ut(r,this):void 0:new ut(this.getCoordinateSequenceFactory().create([]),this)},me.prototype.createMultiLineString=function(){if(arguments.length===0)return new Kr(null,this);if(arguments.length===1){var r=arguments[0];return new Kr(r,this)}},me.prototype.buildGeometry=function(r){for(var o=null,a=!1,l=!1,h=r.iterator();h.hasNext();){var m=h.next(),S=m.getClass();o===null&&(o=S),S!==o&&(a=!0),m.isGeometryCollectionOrDerived()&&(l=!0)}if(o===null)return this.createGeometryCollection();if(a||l)return this.createGeometryCollection(me.toGeometryArray(r));var C=r.iterator().next();if(r.size()>1){if(C instanceof re)return this.createMultiPolygon(me.toPolygonArray(r));if(C instanceof ut)return this.createMultiLineString(me.toLineStringArray(r));if(C instanceof te)return this.createMultiPoint(me.toPointArray(r));Pt.shouldNeverReachHere("Unhandled class: "+C.getClass().getName())}return C},me.prototype.createMultiPointFromCoords=function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)},me.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];return this.createPoint(r!==null?this.getCoordinateSequenceFactory().create([r]):null)}if($(arguments[0],nt)){var o=arguments[0];return new te(o,this)}}},me.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},me.prototype.createPolygon=function(){if(arguments.length===0)return new re(null,null,this);if(arguments.length===1){if($(arguments[0],nt)){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Array){var o=arguments[0];return this.createPolygon(this.createLinearRing(o))}if(arguments[0]instanceof fe){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];return new re(l,h,this)}},me.prototype.getSRID=function(){return this._SRID},me.prototype.createGeometryCollection=function(){if(arguments.length===0)return new En(null,this);if(arguments.length===1){var r=arguments[0];return new En(r,this)}},me.prototype.createGeometry=function(r){return new cn(this).edit(r,{edit:function(){if(arguments.length===2){var o=arguments[0];return this._coordinateSequenceFactory.create(o)}}})},me.prototype.getPrecisionModel=function(){return this._precisionModel},me.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return this.createLinearRing(r!==null?this.getCoordinateSequenceFactory().create(r):null)}if($(arguments[0],nt)){var o=arguments[0];return new fe(o,this)}}},me.prototype.createMultiPolygon=function(){if(arguments.length===0)return new he(null,this);if(arguments.length===1){var r=arguments[0];return new he(r,this)}},me.prototype.createMultiPoint=function(){if(arguments.length===0)return new ve(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new ve(r,this)}if(arguments[0]instanceof Array){var o=arguments[0];return this.createMultiPoint(o!==null?this.getCoordinateSequenceFactory().create(o):null)}if($(arguments[0],nt)){var a=arguments[0];if(a===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(a.size()).fill(null),h=0;h<a.size();h++){var m=this.getCoordinateSequenceFactory().create(1,a.getDimension());dt.copy(a,h,m,0,1),l[h]=this.createPoint(m)}return this.createMultiPoint(l)}}},me.prototype.interfaces_=function(){return[t]},me.prototype.getClass=function(){return me},me.toMultiPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toGeometryArray=function(r){if(r===null)return null;var o=new Array(r.size()).fill(null);return r.toArray(o)},me.getDefaultCoordinateSequenceFactory=function(){return fn.instance()},me.toMultiLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toMultiPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toLinearRingArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.createPointFromInternalCoord=function(r,o){return o.getPrecisionModel().makePrecise(r),o.getFactory().createPoint(r)},pi.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(me,pi);var hc=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Au=function(r){this.geometryFactory=r||new me};Au.prototype.read=function(r){var o,a=(o=typeof r=="string"?JSON.parse(r):r).type;if(!di[a])throw new Error("Unknown GeoJSON type: "+o.type);return hc.indexOf(a)!==-1?di[a].apply(this,[o.coordinates]):a==="GeometryCollection"?di[a].apply(this,[o.geometries]):di[a].apply(this,[o])},Au.prototype.write=function(r){var o=r.getGeometryType();if(!zo[o])throw new Error("Geometry is not supported");return zo[o].apply(this,[r])};var di={Feature:function(r){var o={};for(var a in r)o[a]=r[a];if(r.geometry){var l=r.geometry.type;if(!di[l])throw new Error("Unknown GeoJSON type: "+r.type);o.geometry=this.read(r.geometry)}return r.bbox&&(o.bbox=di.bbox.apply(this,[r.bbox])),o},FeatureCollection:function(r){var o={};if(r.features){o.features=[];for(var a=0;a<r.features.length;++a)o.features.push(this.read(r.features[a]))}return r.bbox&&(o.bbox=this.parse.bbox.apply(this,[r.bbox])),o},coordinates:function(r){for(var o=[],a=0;a<r.length;++a){var l=r[a];o.push(new P(l[0],l[1]))}return o},bbox:function(r){return this.geometryFactory.createLinearRing([new P(r[0],r[1]),new P(r[2],r[1]),new P(r[2],r[3]),new P(r[0],r[3]),new P(r[0],r[1])])},Point:function(r){var o=new P(r[0],r[1]);return this.geometryFactory.createPoint(o)},MultiPoint:function(r){for(var o=[],a=0;a<r.length;++a)o.push(di.Point.apply(this,[r[a]]));return this.geometryFactory.createMultiPoint(o)},LineString:function(r){var o=di.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(o)},MultiLineString:function(r){for(var o=[],a=0;a<r.length;++a)o.push(di.LineString.apply(this,[r[a]]));return this.geometryFactory.createMultiLineString(o)},Polygon:function(r){for(var o=di.coordinates.apply(this,[r[0]]),a=this.geometryFactory.createLinearRing(o),l=[],h=1;h<r.length;++h){var m=r[h],S=di.coordinates.apply(this,[m]),C=this.geometryFactory.createLinearRing(S);l.push(C)}return this.geometryFactory.createPolygon(a,l)},MultiPolygon:function(r){for(var o=[],a=0;a<r.length;++a){var l=r[a];o.push(di.Polygon.apply(this,[l]))}return this.geometryFactory.createMultiPolygon(o)},GeometryCollection:function(r){for(var o=[],a=0;a<r.length;++a){var l=r[a];o.push(this.read(l))}return this.geometryFactory.createGeometryCollection(o)}},zo={coordinate:function(r){return[r.x,r.y]},Point:function(r){return{type:"Point",coordinates:zo.coordinate.apply(this,[r.getCoordinate()])}},MultiPoint:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=zo.Point.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiPoint",coordinates:o}},LineString:function(r){for(var o=[],a=r.getCoordinates(),l=0;l<a.length;++l){var h=a[l];o.push(zo.coordinate.apply(this,[h]))}return{type:"LineString",coordinates:o}},MultiLineString:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=zo.LineString.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiLineString",coordinates:o}},Polygon:function(r){var o=[],a=zo.LineString.apply(this,[r._shell]);o.push(a.coordinates);for(var l=0;l<r._holes.length;++l){var h=r._holes[l],m=zo.LineString.apply(this,[h]);o.push(m.coordinates)}return{type:"Polygon",coordinates:o}},MultiPolygon:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=zo.Polygon.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiPolygon",coordinates:o}},GeometryCollection:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=l.getGeometryType();o.push(zo[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:o}}},Cg=function(r){this.geometryFactory=r||new me,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Au(this.geometryFactory)};Cg.prototype.read=function(r){var o=this.parser.read(r);return this.precisionModel.getType()===_e.FIXED&&this.reducePrecision(o),o},Cg.prototype.reducePrecision=function(r){var o,a;if(r.coordinate)this.precisionModel.makePrecise(r.coordinate);else if(r.points)for(o=0,a=r.points.length;o<a;o++)this.precisionModel.makePrecise(r.points[o]);else if(r.geometries)for(o=0,a=r.geometries.length;o<a;o++)this.reducePrecision(r.geometries[o])};var y1=function(){this.parser=new Au(this.geometryFactory)};y1.prototype.write=function(r){return this.parser.write(r)};var Ft=function(){},Zf={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Ft.prototype.interfaces_=function(){return[]},Ft.prototype.getClass=function(){return Ft},Ft.opposite=function(r){return r===Ft.LEFT?Ft.RIGHT:r===Ft.RIGHT?Ft.LEFT:r},Zf.ON.get=function(){return 0},Zf.LEFT.get=function(){return 1},Zf.RIGHT.get=function(){return 2},Object.defineProperties(Ft,Zf),(A.prototype=new Error).name="EmptyStackException",(_.prototype=new ht).add=function(r){return this.array_.push(r),!0},_.prototype.get=function(r){if(r<0||r>=this.size())throw new Error;return this.array_[r]},_.prototype.push=function(r){return this.array_.push(r),r},_.prototype.pop=function(r){if(this.array_.length===0)throw new A;return this.array_.pop()},_.prototype.peek=function(){if(this.array_.length===0)throw new A;return this.array_[this.array_.length-1]},_.prototype.empty=function(){return this.array_.length===0},_.prototype.isEmpty=function(){return this.empty()},_.prototype.search=function(r){return this.array_.indexOf(r)},_.prototype.size=function(){return this.array_.length},_.prototype.toArray=function(){for(var r=[],o=0,a=this.array_.length;o<a;o++)r.push(this.array_[o]);return r};var ji=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};ji.prototype.getCoordinate=function(){return this._minCoord},ji.prototype.getRightmostSide=function(r,o){var a=this.getRightmostSideOfSegment(r,o);return a<0&&(a=this.getRightmostSideOfSegment(r,o-1)),a<0&&(this._minCoord=null,this.checkForRightmostCoordinate(r)),a},ji.prototype.findRightmostEdgeAtVertex=function(){var r=this._minDe.getEdge().getCoordinates();Pt.isTrue(this._minIndex>0&&this._minIndex<r.length,"rightmost point expected to be interior vertex of edge");var o=r[this._minIndex-1],a=r[this._minIndex+1],l=ot.computeOrientation(this._minCoord,a,o),h=!1;(o.y<this._minCoord.y&&a.y<this._minCoord.y&&l===ot.COUNTERCLOCKWISE||o.y>this._minCoord.y&&a.y>this._minCoord.y&&l===ot.CLOCKWISE)&&(h=!0),h&&(this._minIndex=this._minIndex-1)},ji.prototype.getRightmostSideOfSegment=function(r,o){var a=r.getEdge().getCoordinates();if(o<0||o+1>=a.length||a[o].y===a[o+1].y)return-1;var l=Ft.LEFT;return a[o].y<a[o+1].y&&(l=Ft.RIGHT),l},ji.prototype.getEdge=function(){return this._orientedDe},ji.prototype.checkForRightmostCoordinate=function(r){for(var o=r.getEdge().getCoordinates(),a=0;a<o.length-1;a++)(this._minCoord===null||o[a].x>this._minCoord.x)&&(this._minDe=r,this._minIndex=a,this._minCoord=o[a])},ji.prototype.findRightmostEdgeAtNode=function(){var r=this._minDe.getNode().getEdges();this._minDe=r.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},ji.prototype.findEdge=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next();a.isForward()&&this.checkForRightmostCoordinate(a)}Pt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Ft.LEFT&&(this._orientedDe=this._minDe.getSym())},ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji};var Go=function(r){function o(a,l){r.call(this,o.msgWithCoord(a,l)),this.pt=l?new P(l):null,this.name="TopologyException"}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.getCoordinate=function(){return this.pt},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.msgWithCoord=function(a,l){return l?a:a+" [ "+l+" ]"},o}(Ht),Jf=function(){this.array_=[]};Jf.prototype.addLast=function(r){this.array_.push(r)},Jf.prototype.removeFirst=function(){return this.array_.shift()},Jf.prototype.isEmpty=function(){return this.array_.length===0};var Cr=function(){this._finder=null,this._dirEdgeList=new O,this._nodes=new O,this._rightMostCoord=null,this._env=null,this._finder=new ji};Cr.prototype.clearVisitedEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();)r.next().setVisited(!1)},Cr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Cr.prototype.computeNodeDepth=function(r){for(var o=null,a=r.getEdges().iterator();a.hasNext();){var l=a.next();if(l.isVisited()||l.getSym().isVisited()){o=l;break}}if(o===null)throw new Go("unable to find edge to compute depths at "+r.getCoordinate());r.getEdges().computeDepths(o);for(var h=r.getEdges().iterator();h.hasNext();){var m=h.next();m.setVisited(!0),this.copySymDepths(m)}},Cr.prototype.computeDepth=function(r){this.clearVisitedEdges();var o=this._finder.getEdge();o.setEdgeDepths(Ft.RIGHT,r),this.copySymDepths(o),this.computeDepths(o)},Cr.prototype.create=function(r){this.addReachable(r),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Cr.prototype.findResultEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();){var o=r.next();o.getDepth(Ft.RIGHT)>=1&&o.getDepth(Ft.LEFT)<=0&&!o.isInteriorAreaEdge()&&o.setInResult(!0)}},Cr.prototype.computeDepths=function(r){var o=new ye,a=new Jf,l=r.getNode();for(a.addLast(l),o.add(l),r.setVisited(!0);!a.isEmpty();){var h=a.removeFirst();o.add(h),this.computeNodeDepth(h);for(var m=h.getEdges().iterator();m.hasNext();){var S=m.next().getSym();if(!S.isVisited()){var C=S.getNode();o.contains(C)||(a.addLast(C),o.add(C))}}}},Cr.prototype.compareTo=function(r){var o=r;return this._rightMostCoord.x<o._rightMostCoord.x?-1:this._rightMostCoord.x>o._rightMostCoord.x?1:0},Cr.prototype.getEnvelope=function(){if(this._env===null){for(var r=new Ct,o=this._dirEdgeList.iterator();o.hasNext();)for(var a=o.next().getEdge().getCoordinates(),l=0;l<a.length-1;l++)r.expandToInclude(a[l]);this._env=r}return this._env},Cr.prototype.addReachable=function(r){var o=new _;for(o.add(r);!o.empty();){var a=o.pop();this.add(a,o)}},Cr.prototype.copySymDepths=function(r){var o=r.getSym();o.setDepth(Ft.LEFT,r.getDepth(Ft.RIGHT)),o.setDepth(Ft.RIGHT,r.getDepth(Ft.LEFT))},Cr.prototype.add=function(r,o){r.setVisited(!0),this._nodes.add(r);for(var a=r.getEdges().iterator();a.hasNext();){var l=a.next();this._dirEdgeList.add(l);var h=l.getSym().getNode();h.isVisited()||o.push(h)}},Cr.prototype.getNodes=function(){return this._nodes},Cr.prototype.getDirectedEdges=function(){return this._dirEdgeList},Cr.prototype.interfaces_=function(){return[B]},Cr.prototype.getClass=function(){return Cr};var vn=function r(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var o=arguments[0];this.init(o.length)}else if(Number.isInteger(arguments[0])){var a=arguments[0];this.init(1),this.location[Ft.ON]=a}else if(arguments[0]instanceof r){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var h=0;h<this.location.length;h++)this.location[h]=l.location[h]}}else if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];this.init(3),this.location[Ft.ON]=m,this.location[Ft.LEFT]=S,this.location[Ft.RIGHT]=C}};vn.prototype.setAllLocations=function(r){for(var o=0;o<this.location.length;o++)this.location[o]=r},vn.prototype.isNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]!==V.NONE)return!1;return!0},vn.prototype.setAllLocationsIfNull=function(r){for(var o=0;o<this.location.length;o++)this.location[o]===V.NONE&&(this.location[o]=r)},vn.prototype.isLine=function(){return this.location.length===1},vn.prototype.merge=function(r){if(r.location.length>this.location.length){var o=new Array(3).fill(null);o[Ft.ON]=this.location[Ft.ON],o[Ft.LEFT]=V.NONE,o[Ft.RIGHT]=V.NONE,this.location=o}for(var a=0;a<this.location.length;a++)this.location[a]===V.NONE&&a<r.location.length&&(this.location[a]=r.location[a])},vn.prototype.getLocations=function(){return this.location},vn.prototype.flip=function(){if(this.location.length<=1)return null;var r=this.location[Ft.LEFT];this.location[Ft.LEFT]=this.location[Ft.RIGHT],this.location[Ft.RIGHT]=r},vn.prototype.toString=function(){var r=new vt;return this.location.length>1&&r.append(V.toLocationSymbol(this.location[Ft.LEFT])),r.append(V.toLocationSymbol(this.location[Ft.ON])),this.location.length>1&&r.append(V.toLocationSymbol(this.location[Ft.RIGHT])),r.toString()},vn.prototype.setLocations=function(r,o,a){this.location[Ft.ON]=r,this.location[Ft.LEFT]=o,this.location[Ft.RIGHT]=a},vn.prototype.get=function(r){return r<this.location.length?this.location[r]:V.NONE},vn.prototype.isArea=function(){return this.location.length>1},vn.prototype.isAnyNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]===V.NONE)return!0;return!1},vn.prototype.setLocation=function(){if(arguments.length===1){var r=arguments[0];this.setLocation(Ft.ON,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this.location[o]=a}},vn.prototype.init=function(r){this.location=new Array(r).fill(null),this.setAllLocations(V.NONE)},vn.prototype.isEqualOnSide=function(r,o){return this.location[o]===r.location[o]},vn.prototype.allPositionsEqual=function(r){for(var o=0;o<this.location.length;o++)if(this.location[o]!==r)return!1;return!0},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn};var pn=function r(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var o=arguments[0];this.elt[0]=new vn(o),this.elt[1]=new vn(o)}else if(arguments[0]instanceof r){var a=arguments[0];this.elt[0]=new vn(a.elt[0]),this.elt[1]=new vn(a.elt[1])}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.elt[0]=new vn(V.NONE),this.elt[1]=new vn(V.NONE),this.elt[l].setLocation(h)}else if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];this.elt[0]=new vn(m,S,C),this.elt[1]=new vn(m,S,C)}else if(arguments.length===4){var z=arguments[0],K=arguments[1],mt=arguments[2],yt=arguments[3];this.elt[0]=new vn(V.NONE,V.NONE,V.NONE),this.elt[1]=new vn(V.NONE,V.NONE,V.NONE),this.elt[z].setLocations(K,mt,yt)}};pn.prototype.getGeometryCount=function(){var r=0;return this.elt[0].isNull()||r++,this.elt[1].isNull()||r++,r},pn.prototype.setAllLocations=function(r,o){this.elt[r].setAllLocations(o)},pn.prototype.isNull=function(r){return this.elt[r].isNull()},pn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var r=arguments[0];this.setAllLocationsIfNull(0,r),this.setAllLocationsIfNull(1,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this.elt[o].setAllLocationsIfNull(a)}},pn.prototype.isLine=function(r){return this.elt[r].isLine()},pn.prototype.merge=function(r){for(var o=0;o<2;o++)this.elt[o]===null&&r.elt[o]!==null?this.elt[o]=new vn(r.elt[o]):this.elt[o].merge(r.elt[o])},pn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},pn.prototype.getLocation=function(){if(arguments.length===1){var r=arguments[0];return this.elt[r].get(Ft.ON)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return this.elt[o].get(a)}},pn.prototype.toString=function(){var r=new vt;return this.elt[0]!==null&&(r.append("A:"),r.append(this.elt[0].toString())),this.elt[1]!==null&&(r.append(" B:"),r.append(this.elt[1].toString())),r.toString()},pn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var r=arguments[0];return this.elt[r].isArea()}},pn.prototype.isAnyNull=function(r){return this.elt[r].isAnyNull()},pn.prototype.setLocation=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];this.elt[r].setLocation(Ft.ON,o)}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this.elt[a].setLocation(l,h)}},pn.prototype.isEqualOnSide=function(r,o){return this.elt[0].isEqualOnSide(r.elt[0],o)&&this.elt[1].isEqualOnSide(r.elt[1],o)},pn.prototype.allPositionsEqual=function(r,o){return this.elt[r].allPositionsEqual(o)},pn.prototype.toLine=function(r){this.elt[r].isArea()&&(this.elt[r]=new vn(this.elt[r].location[0]))},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},pn.toLineLabel=function(r){for(var o=new pn(V.NONE),a=0;a<2;a++)o.setLocation(a,r.getLocation(a));return o};var Vn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new O,this._pts=new O,this._label=new pn(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new O,this._geometryFactory=null;var r=arguments[0],o=arguments[1];this._geometryFactory=o,this.computePoints(r),this.computeRing()};Vn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var r=new Array(this._pts.size()).fill(null),o=0;o<this._pts.size();o++)r[o]=this._pts.get(o);this._ring=this._geometryFactory.createLinearRing(r),this._isHole=ot.isCCW(this._ring.getCoordinates())},Vn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Vn.prototype.computePoints=function(r){this._startDe=r;var o=r,a=!0;do{if(o===null)throw new Go("Found null DirectedEdge");if(o.getEdgeRing()===this)throw new Go("Directed Edge visited twice during ring-building at "+o.getCoordinate());this._edges.add(o);var l=o.getLabel();Pt.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(o.getEdge(),o.isForward(),a),a=!1,this.setEdgeRing(o,this),o=this.getNext(o)}while(o!==this._startDe)},Vn.prototype.getLinearRing=function(){return this._ring},Vn.prototype.getCoordinate=function(r){return this._pts.get(r)},Vn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var r=this._startDe;do{var o=r.getNode().getEdges().getOutgoingDegree(this);o>this._maxNodeDegree&&(this._maxNodeDegree=o),r=this.getNext(r)}while(r!==this._startDe);this._maxNodeDegree*=2},Vn.prototype.addPoints=function(r,o,a){var l=r.getCoordinates();if(o){var h=1;a&&(h=0);for(var m=h;m<l.length;m++)this._pts.add(l[m])}else{var S=l.length-2;a&&(S=l.length-1);for(var C=S;C>=0;C--)this._pts.add(l[C])}},Vn.prototype.isHole=function(){return this._isHole},Vn.prototype.setInResult=function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)},Vn.prototype.containsPoint=function(r){var o=this.getLinearRing();if(!o.getEnvelopeInternal().contains(r)||!ot.isPointInRing(r,o.getCoordinates()))return!1;for(var a=this._holes.iterator();a.hasNext();)if(a.next().containsPoint(r))return!1;return!0},Vn.prototype.addHole=function(r){this._holes.add(r)},Vn.prototype.isShell=function(){return this._shell===null},Vn.prototype.getLabel=function(){return this._label},Vn.prototype.getEdges=function(){return this._edges},Vn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Vn.prototype.getShell=function(){return this._shell},Vn.prototype.mergeLabel=function(){if(arguments.length===1){var r=arguments[0];this.mergeLabel(r,0),this.mergeLabel(r,1)}else if(arguments.length===2){var o=arguments[0],a=arguments[1],l=o.getLocation(a,Ft.RIGHT);if(l===V.NONE)return null;if(this._label.getLocation(a)===V.NONE)return this._label.setLocation(a,l),null}},Vn.prototype.setShell=function(r){this._shell=r,r!==null&&r.addHole(this)},Vn.prototype.toPolygon=function(r){for(var o=new Array(this._holes.size()).fill(null),a=0;a<this._holes.size();a++)o[a]=this._holes.get(a).getLinearRing();return r.createPolygon(this.getLinearRing(),o)},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn};var kD=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.setEdgeRing=function(a,l){a.setMinEdgeRing(l)},o.prototype.getNext=function(a){return a.getNextMin()},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Vn),qD=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.buildMinimalRings=function(){var a=new O,l=this._startDe;do{if(l.getMinEdgeRing()===null){var h=new kD(l,this._geometryFactory);a.add(h)}l=l.getNext()}while(l!==this._startDe);return a},o.prototype.setEdgeRing=function(a,l){a.setEdgeRing(l)},o.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var a=this._startDe;do a.getNode().getEdges().linkMinimalDirectedEdges(this),a=a.getNext();while(a!==this._startDe)},o.prototype.getNext=function(a){return a.getNext()},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Vn),gi=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this._label=r}}};gi.prototype.setVisited=function(r){this._isVisited=r},gi.prototype.setInResult=function(r){this._isInResult=r},gi.prototype.isCovered=function(){return this._isCovered},gi.prototype.isCoveredSet=function(){return this._isCoveredSet},gi.prototype.setLabel=function(r){this._label=r},gi.prototype.getLabel=function(){return this._label},gi.prototype.setCovered=function(r){this._isCovered=r,this._isCoveredSet=!0},gi.prototype.updateIM=function(r){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(r)},gi.prototype.isInResult=function(){return this._isInResult},gi.prototype.isVisited=function(){return this._isVisited},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var jf=function(r){function o(){r.call(this),this._coord=null,this._edges=null;var a=arguments[0],l=arguments[1];this._coord=a,this._edges=l,this._label=new pn(0,V.NONE)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.isIncidentEdgeInResult=function(){for(var a=this.getEdges().getEdges().iterator();a.hasNext();)if(a.next().getEdge().isInResult())return!0;return!1},o.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},o.prototype.getCoordinate=function(){return this._coord},o.prototype.print=function(a){a.println("node "+this._coord+" lbl: "+this._label)},o.prototype.computeIM=function(a){},o.prototype.computeMergedLocation=function(a,l){var h=V.NONE;if(h=this._label.getLocation(l),!a.isNull(l)){var m=a.getLocation(l);h!==V.BOUNDARY&&(h=m)}return h},o.prototype.setLabel=function(){if(arguments.length!==2)return r.prototype.setLabel.apply(this,arguments);var a=arguments[0],l=arguments[1];this._label===null?this._label=new pn(a,l):this._label.setLocation(a,l)},o.prototype.getEdges=function(){return this._edges},o.prototype.mergeLabel=function(){if(arguments[0]instanceof o){var a=arguments[0];this.mergeLabel(a._label)}else if(arguments[0]instanceof pn)for(var l=arguments[0],h=0;h<2;h++){var m=this.computeMergedLocation(l,h);this._label.getLocation(h)===V.NONE&&this._label.setLocation(h,m)}},o.prototype.add=function(a){this._edges.insert(a),a.setNode(this)},o.prototype.setLabelBoundary=function(a){if(this._label===null)return null;var l=V.NONE;this._label!==null&&(l=this._label.getLocation(a));var h=null;switch(l){case V.BOUNDARY:h=V.INTERIOR;break;case V.INTERIOR:default:h=V.BOUNDARY}this._label.setLocation(a,h)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(gi),Ki=function(){this.nodeMap=new y,this.nodeFact=null;var r=arguments[0];this.nodeFact=r};Ki.prototype.find=function(r){return this.nodeMap.get(r)},Ki.prototype.addNode=function(){if(arguments[0]instanceof P){var r=arguments[0],o=this.nodeMap.get(r);return o===null&&(o=this.nodeFact.createNode(r),this.nodeMap.put(r,o)),o}if(arguments[0]instanceof jf){var a=arguments[0],l=this.nodeMap.get(a.getCoordinate());return l===null?(this.nodeMap.put(a.getCoordinate(),a),a):(l.mergeLabel(a),l)}},Ki.prototype.print=function(r){for(var o=this.iterator();o.hasNext();)o.next().print(r)},Ki.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ki.prototype.values=function(){return this.nodeMap.values()},Ki.prototype.getBoundaryNodes=function(r){for(var o=new O,a=this.iterator();a.hasNext();){var l=a.next();l.getLabel().getLocation(r)===V.BOUNDARY&&o.add(l)}return o},Ki.prototype.add=function(r){var o=r.getCoordinate();this.addNode(o).add(r)},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki};var mn=function(){},pc={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};mn.prototype.interfaces_=function(){return[]},mn.prototype.getClass=function(){return mn},mn.isNorthern=function(r){return r===mn.NE||r===mn.NW},mn.isOpposite=function(r,o){return r===o?!1:(r-o+4)%4===2},mn.commonHalfPlane=function(r,o){if(r===o)return r;if((r-o+4)%4===2)return-1;var a=r<o?r:o;return a===0&&(r>o?r:o)===3?3:a},mn.isInHalfPlane=function(r,o){return o===mn.SE?r===mn.SE||r===mn.SW:r===o||r===o+1},mn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],o=arguments[1];if(r===0&&o===0)throw new T("Cannot compute the quadrant for point ( "+r+", "+o+" )");return r>=0?o>=0?mn.NE:mn.SE:o>=0?mn.NW:mn.SW}if(arguments[0]instanceof P&&arguments[1]instanceof P){var a=arguments[0],l=arguments[1];if(l.x===a.x&&l.y===a.y)throw new T("Cannot compute the quadrant for two identical points "+a);return l.x>=a.x?l.y>=a.y?mn.NE:mn.SE:l.y>=a.y?mn.NW:mn.SW}},pc.NE.get=function(){return 0},pc.NW.get=function(){return 1},pc.SW.get=function(){return 2},pc.SE.get=function(){return 3},Object.defineProperties(mn,pc);var gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var r=arguments[0];this._edge=r}else if(arguments.length===3){var o=arguments[0],a=arguments[1],l=arguments[2];this._edge=o,this.init(a,l),this._label=null}else if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3];this._edge=h,this.init(m,S),this._label=C}};gr.prototype.compareDirection=function(r){return this._dx===r._dx&&this._dy===r._dy?0:this._quadrant>r._quadrant?1:this._quadrant<r._quadrant?-1:ot.computeOrientation(r._p0,r._p1,this._p1)},gr.prototype.getDy=function(){return this._dy},gr.prototype.getCoordinate=function(){return this._p0},gr.prototype.setNode=function(r){this._node=r},gr.prototype.print=function(r){var o=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),l=a.lastIndexOf("."),h=a.substring(l+1);r.print(" "+h+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+o+" "+this._label)},gr.prototype.compareTo=function(r){var o=r;return this.compareDirection(o)},gr.prototype.getDirectedCoordinate=function(){return this._p1},gr.prototype.getDx=function(){return this._dx},gr.prototype.getLabel=function(){return this._label},gr.prototype.getEdge=function(){return this._edge},gr.prototype.getQuadrant=function(){return this._quadrant},gr.prototype.getNode=function(){return this._node},gr.prototype.toString=function(){var r=Math.atan2(this._dy,this._dx),o=this.getClass().getName(),a=o.lastIndexOf(".");return" "+o.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label},gr.prototype.computeLabel=function(r){},gr.prototype.init=function(r,o){this._p0=r,this._p1=o,this._dx=o.x-r.x,this._dy=o.y-r.y,this._quadrant=mn.quadrant(this._dx,this._dy),Pt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},gr.prototype.interfaces_=function(){return[B]},gr.prototype.getClass=function(){return gr};var Ig=function(r){function o(){var a=arguments[0],l=arguments[1];if(r.call(this,a),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=l,l)this.init(a.getCoordinate(0),a.getCoordinate(1));else{var h=a.getNumPoints()-1;this.init(a.getCoordinate(h),a.getCoordinate(h-1))}this.computeDirectedLabel()}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.getNextMin=function(){return this._nextMin},o.prototype.getDepth=function(a){return this._depth[a]},o.prototype.setVisited=function(a){this._isVisited=a},o.prototype.computeDirectedLabel=function(){this._label=new pn(this._edge.getLabel()),this._isForward||this._label.flip()},o.prototype.getNext=function(){return this._next},o.prototype.setDepth=function(a,l){if(this._depth[a]!==-999&&this._depth[a]!==l)throw new Go("assigned depths do not match",this.getCoordinate());this._depth[a]=l},o.prototype.isInteriorAreaEdge=function(){for(var a=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,Ft.LEFT)===V.INTERIOR&&this._label.getLocation(l,Ft.RIGHT)===V.INTERIOR||(a=!1);return a},o.prototype.setNextMin=function(a){this._nextMin=a},o.prototype.print=function(a){r.prototype.print.call(this,a),a.print(" "+this._depth[Ft.LEFT]+"/"+this._depth[Ft.RIGHT]),a.print(" ("+this.getDepthDelta()+")"),this._isInResult&&a.print(" inResult")},o.prototype.setMinEdgeRing=function(a){this._minEdgeRing=a},o.prototype.isLineEdge=function(){var a=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),h=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return a&&l&&h},o.prototype.setEdgeRing=function(a){this._edgeRing=a},o.prototype.getMinEdgeRing=function(){return this._minEdgeRing},o.prototype.getDepthDelta=function(){var a=this._edge.getDepthDelta();return this._isForward||(a=-a),a},o.prototype.setInResult=function(a){this._isInResult=a},o.prototype.getSym=function(){return this._sym},o.prototype.isForward=function(){return this._isForward},o.prototype.getEdge=function(){return this._edge},o.prototype.printEdge=function(a){this.print(a),a.print(" "),this._isForward?this._edge.print(a):this._edge.printReverse(a)},o.prototype.setSym=function(a){this._sym=a},o.prototype.setVisitedEdge=function(a){this.setVisited(a),this._sym.setVisited(a)},o.prototype.setEdgeDepths=function(a,l){var h=this.getEdge().getDepthDelta();this._isForward||(h=-h);var m=1;a===Ft.LEFT&&(m=-1);var S=Ft.opposite(a),C=l+h*m;this.setDepth(a,l),this.setDepth(S,C)},o.prototype.getEdgeRing=function(){return this._edgeRing},o.prototype.isInResult=function(){return this._isInResult},o.prototype.setNext=function(a){this._next=a},o.prototype.isVisited=function(){return this._isVisited},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.depthFactor=function(a,l){return a===V.EXTERIOR&&l===V.INTERIOR?1:a===V.INTERIOR&&l===V.EXTERIOR?-1:0},o}(gr),Tu=function(){};Tu.prototype.createNode=function(r){return new jf(r,null)},Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu};var On=function(){if(this._edges=new O,this._nodes=null,this._edgeEndList=new O,arguments.length===0)this._nodes=new Ki(new Tu);else if(arguments.length===1){var r=arguments[0];this._nodes=new Ki(r)}};On.prototype.printEdges=function(r){r.println("Edges:");for(var o=0;o<this._edges.size();o++){r.println("edge "+o+":");var a=this._edges.get(o);a.print(r),a.eiList.print(r)}},On.prototype.find=function(r){return this._nodes.find(r)},On.prototype.addNode=function(){if(arguments[0]instanceof jf){var r=arguments[0];return this._nodes.addNode(r)}if(arguments[0]instanceof P){var o=arguments[0];return this._nodes.addNode(o)}},On.prototype.getNodeIterator=function(){return this._nodes.iterator()},On.prototype.linkResultDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkResultDirectedEdges()},On.prototype.debugPrintln=function(r){Ut.out.println(r)},On.prototype.isBoundaryNode=function(r,o){var a=this._nodes.find(o);if(a===null)return!1;var l=a.getLabel();return l!==null&&l.getLocation(r)===V.BOUNDARY},On.prototype.linkAllDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkAllDirectedEdges()},On.prototype.matchInSameDirection=function(r,o,a,l){return!!r.equals(a)&&ot.computeOrientation(r,o,l)===ot.COLLINEAR&&mn.quadrant(r,o)===mn.quadrant(a,l)},On.prototype.getEdgeEnds=function(){return this._edgeEndList},On.prototype.debugPrint=function(r){Ut.out.print(r)},On.prototype.getEdgeIterator=function(){return this._edges.iterator()},On.prototype.findEdgeInSameDirection=function(r,o){for(var a=0;a<this._edges.size();a++){var l=this._edges.get(a),h=l.getCoordinates();if(this.matchInSameDirection(r,o,h[0],h[1])||this.matchInSameDirection(r,o,h[h.length-1],h[h.length-2]))return l}return null},On.prototype.insertEdge=function(r){this._edges.add(r)},On.prototype.findEdgeEnd=function(r){for(var o=this.getEdgeEnds().iterator();o.hasNext();){var a=o.next();if(a.getEdge()===r)return a}return null},On.prototype.addEdges=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next();this._edges.add(a);var l=new Ig(a,!0),h=new Ig(a,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},On.prototype.add=function(r){this._nodes.add(r),this._edgeEndList.add(r)},On.prototype.getNodes=function(){return this._nodes.values()},On.prototype.findEdge=function(r,o){for(var a=0;a<this._edges.size();a++){var l=this._edges.get(a),h=l.getCoordinates();if(r.equals(h[0])&&o.equals(h[1]))return l}return null},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.linkResultDirectedEdges=function(r){for(var o=r.iterator();o.hasNext();)o.next().getEdges().linkResultDirectedEdges()};var Qr=function(){this._geometryFactory=null,this._shellList=new O;var r=arguments[0];this._geometryFactory=r};Qr.prototype.sortShellsAndHoles=function(r,o,a){for(var l=r.iterator();l.hasNext();){var h=l.next();h.isHole()?a.add(h):o.add(h)}},Qr.prototype.computePolygons=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next().toPolygon(this._geometryFactory);o.add(l)}return o},Qr.prototype.placeFreeHoles=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next();if(l.getShell()===null){var h=this.findEdgeRingContaining(l,r);if(h===null)throw new Go("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},Qr.prototype.buildMinimalEdgeRings=function(r,o,a){for(var l=new O,h=r.iterator();h.hasNext();){var m=h.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var S=m.buildMinimalRings(),C=this.findShell(S);C!==null?(this.placePolygonHoles(C,S),o.add(C)):a.addAll(S)}else l.add(m)}return l},Qr.prototype.containsPoint=function(r){for(var o=this._shellList.iterator();o.hasNext();)if(o.next().containsPoint(r))return!0;return!1},Qr.prototype.buildMaximalEdgeRings=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var h=new qD(l,this._geometryFactory);o.add(h),h.setInResult()}}return o},Qr.prototype.placePolygonHoles=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next();l.isHole()&&l.setShell(r)}},Qr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Qr.prototype.findEdgeRingContaining=function(r,o){for(var a=r.getLinearRing(),l=a.getEnvelopeInternal(),h=a.getCoordinateN(0),m=null,S=null,C=o.iterator();C.hasNext();){var z=C.next(),K=z.getLinearRing(),mt=K.getEnvelopeInternal();m!==null&&(S=m.getLinearRing().getEnvelopeInternal());var yt=!1;mt.contains(l)&&ot.isPointInRing(h,K.getCoordinates())&&(yt=!0),yt&&(m===null||S.contains(mt))&&(m=z)}return m},Qr.prototype.findShell=function(r){for(var o=0,a=null,l=r.iterator();l.hasNext();){var h=l.next();h.isHole()||(a=h,o++)}return Pt.isTrue(o<=1,"found two shells in MinimalEdgeRing list"),a},Qr.prototype.add=function(){if(arguments.length===1){var r=arguments[0];this.add(r.getEdgeEnds(),r.getNodes())}else if(arguments.length===2){var o=arguments[0],a=arguments[1];On.linkResultDirectedEdges(a);var l=this.buildMaximalEdgeRings(o),h=new O,m=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(m,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var Cu=function(){};Cu.prototype.getBounds=function(){},Cu.prototype.interfaces_=function(){return[]},Cu.prototype.getClass=function(){return Cu};var Bi=function(){this._bounds=null,this._item=null;var r=arguments[0],o=arguments[1];this._bounds=r,this._item=o};Bi.prototype.getItem=function(){return this._item},Bi.prototype.getBounds=function(){return this._bounds},Bi.prototype.interfaces_=function(){return[Cu,t]},Bi.prototype.getClass=function(){return Bi};var ko=function(){this._size=null,this._items=null,this._size=0,this._items=new O,this._items.add(null)};ko.prototype.poll=function(){if(this.isEmpty())return null;var r=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),r},ko.prototype.size=function(){return this._size},ko.prototype.reorder=function(r){for(var o=null,a=this._items.get(r);2*r<=this._size&&((o=2*r)!==this._size&&this._items.get(o+1).compareTo(this._items.get(o))<0&&o++,this._items.get(o).compareTo(a)<0);r=o)this._items.set(r,this._items.get(o));this._items.set(r,a)},ko.prototype.clear=function(){this._size=0,this._items.clear()},ko.prototype.isEmpty=function(){return this._size===0},ko.prototype.add=function(r){this._items.add(null),this._size+=1;var o=this._size;for(this._items.set(0,r);r.compareTo(this._items.get(Math.trunc(o/2)))<0;o/=2)this._items.set(o,this._items.get(Math.trunc(o/2)));this._items.set(o,r)},ko.prototype.interfaces_=function(){return[]},ko.prototype.getClass=function(){return ko};var as=function(){};as.prototype.visitItem=function(r){},as.prototype.interfaces_=function(){return[]},as.prototype.getClass=function(){return as};var Ra=function(){};Ra.prototype.insert=function(r,o){},Ra.prototype.remove=function(r,o){},Ra.prototype.query=function(){},Ra.prototype.interfaces_=function(){return[]},Ra.prototype.getClass=function(){return Ra};var Jn=function(){if(this._childBoundables=new O,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this._level=r}}},v1={serialVersionUID:{configurable:!0}};Jn.prototype.getLevel=function(){return this._level},Jn.prototype.size=function(){return this._childBoundables.size()},Jn.prototype.getChildBoundables=function(){return this._childBoundables},Jn.prototype.addChildBoundable=function(r){Pt.isTrue(this._bounds===null),this._childBoundables.add(r)},Jn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Jn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Jn.prototype.interfaces_=function(){return[Cu,t]},Jn.prototype.getClass=function(){return Jn},v1.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Jn,v1);var zi=function(){};zi.reverseOrder=function(){return{compare:function(r,o){return o.compareTo(r)}}},zi.min=function(r){return zi.sort(r),r.get(0)},zi.sort=function(r,o){var a=r.toArray();o?_n.sort(a,o):_n.sort(a);for(var l=r.iterator(),h=0,m=a.length;h<m;h++)l.next(),l.set(a[h])},zi.singletonList=function(r){var o=new O;return o.add(r),o};var Hn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var r=arguments[0],o=arguments[1],a=arguments[2];this._boundable1=r,this._boundable2=o,this._itemDistance=a,this._distance=this.distance()};Hn.prototype.expandToQueue=function(r,o){var a=Hn.isComposite(this._boundable1),l=Hn.isComposite(this._boundable2);if(a&&l)return Hn.area(this._boundable1)>Hn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,r,o),null):(this.expand(this._boundable2,this._boundable1,r,o),null);if(a)return this.expand(this._boundable1,this._boundable2,r,o),null;if(l)return this.expand(this._boundable2,this._boundable1,r,o),null;throw new T("neither boundable is composite")},Hn.prototype.isLeaves=function(){return!(Hn.isComposite(this._boundable1)||Hn.isComposite(this._boundable2))},Hn.prototype.compareTo=function(r){var o=r;return this._distance<o._distance?-1:this._distance>o._distance?1:0},Hn.prototype.expand=function(r,o,a,l){for(var h=r.getChildBoundables().iterator();h.hasNext();){var m=h.next(),S=new Hn(m,o,this._itemDistance);S.getDistance()<l&&a.add(S)}},Hn.prototype.getBoundable=function(r){return r===0?this._boundable1:this._boundable2},Hn.prototype.getDistance=function(){return this._distance},Hn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Hn.prototype.interfaces_=function(){return[B]},Hn.prototype.getClass=function(){return Hn},Hn.area=function(r){return r.getBounds().getArea()},Hn.isComposite=function(r){return r instanceof Jn};var rr=function r(){if(this._root=null,this._built=!1,this._itemBoundables=new O,this._nodeCapacity=null,arguments.length===0){var o=r.DEFAULT_NODE_CAPACITY;this._nodeCapacity=o}else if(arguments.length===1){var a=arguments[0];Pt.isTrue(a>1,"Node capacity must be greater than 1"),this._nodeCapacity=a}},Kf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};rr.prototype.getNodeCapacity=function(){return this._nodeCapacity},rr.prototype.lastNode=function(r){return r.get(r.size()-1)},rr.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var r=0,o=arguments[0].getChildBoundables().iterator();o.hasNext();){var a=o.next();a instanceof Jn?r+=this.size(a):a instanceof Bi&&(r+=1)}return r}},rr.prototype.removeItem=function(r,o){for(var a=null,l=r.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof Bi&&h.getItem()===o&&(a=h)}return a!==null&&(r.getChildBoundables().remove(a),!0)},rr.prototype.itemsTree=function(){if(arguments.length===0){this.build();var r=this.itemsTree(this._root);return r===null?new O:r}if(arguments.length===1){for(var o=arguments[0],a=new O,l=o.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(h instanceof Jn){var m=this.itemsTree(h);m!==null&&a.add(m)}else h instanceof Bi?a.add(h.getItem()):Pt.shouldNeverReachHere()}return a.size()<=0?null:a}},rr.prototype.insert=function(r,o){Pt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Bi(r,o))},rr.prototype.boundablesAtLevel=function(){if(arguments.length===1){var r=arguments[0],o=new O;return this.boundablesAtLevel(r,this._root,o),o}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];if(Pt.isTrue(a>-2),l.getLevel()===a)return h.add(l),null;for(var m=l.getChildBoundables().iterator();m.hasNext();){var S=m.next();S instanceof Jn?this.boundablesAtLevel(a,S,h):(Pt.isTrue(S instanceof Bi),a===-1&&h.add(S))}return null}},rr.prototype.query=function(){if(arguments.length===1){var r=arguments[0];this.build();var o=new O;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,o),o}if(arguments.length===2){var a=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.query(a,this._root,l)}else if(arguments.length===3){if($(arguments[2],as)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn)for(var h=arguments[0],m=arguments[1],S=arguments[2],C=m.getChildBoundables(),z=0;z<C.size();z++){var K=C.get(z);this.getIntersectsOp().intersects(K.getBounds(),h)&&(K instanceof Jn?this.query(h,K,S):K instanceof Bi?S.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if($(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn)for(var mt=arguments[0],yt=arguments[1],zt=arguments[2],qt=yt.getChildBoundables(),jt=0;jt<qt.size();jt++){var ue=qt.get(jt);this.getIntersectsOp().intersects(ue.getBounds(),mt)&&(ue instanceof Jn?this.query(mt,ue,zt):ue instanceof Bi?zt.add(ue.getItem()):Pt.shouldNeverReachHere())}}},rr.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},rr.prototype.getRoot=function(){return this.build(),this._root},rr.prototype.remove=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.remove(r,this._root,o)}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2],m=this.removeItem(l,h);if(m)return!0;for(var S=null,C=l.getChildBoundables().iterator();C.hasNext();){var z=C.next();if(this.getIntersectsOp().intersects(z.getBounds(),a)&&z instanceof Jn&&(m=this.remove(a,z,h))){S=z;break}}return S!==null&&S.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(S),m}},rr.prototype.createHigherLevels=function(r,o){Pt.isTrue(!r.isEmpty());var a=this.createParentBoundables(r,o+1);return a.size()===1?a.get(0):this.createHigherLevels(a,o+1)},rr.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var r=0,o=arguments[0].getChildBoundables().iterator();o.hasNext();){var a=o.next();if(a instanceof Jn){var l=this.depth(a);l>r&&(r=l)}}return r+1}},rr.prototype.createParentBoundables=function(r,o){Pt.isTrue(!r.isEmpty());var a=new O;a.add(this.createNode(o));var l=new O(r);zi.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var m=h.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(o)),this.lastNode(a).addChildBoundable(m)}return a},rr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},rr.prototype.interfaces_=function(){return[t]},rr.prototype.getClass=function(){return rr},rr.compareDoubles=function(r,o){return r>o?1:r<o?-1:0},Kf.IntersectsOp.get=function(){return VD},Kf.serialVersionUID.get=function(){return-3886435814360241e3},Kf.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(rr,Kf);var VD=function(){},Iu=function(){};Iu.prototype.distance=function(r,o){},Iu.prototype.interfaces_=function(){return[]},Iu.prototype.getClass=function(){return Iu};var _1=function(r){function o(l){l=l||o.DEFAULT_NODE_CAPACITY,r.call(this,l)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return o.prototype.createParentBoundablesFromVerticalSlices=function(l,h){Pt.isTrue(l.length>0);for(var m=new O,S=0;S<l.length;S++)m.addAll(this.createParentBoundablesFromVerticalSlice(l[S],h));return m},o.prototype.createNode=function(l){return new x1(l)},o.prototype.size=function(){return arguments.length===0?r.prototype.size.call(this):r.prototype.size.apply(this,arguments)},o.prototype.insert=function(){if(arguments.length!==2)return r.prototype.insert.apply(this,arguments);var l=arguments[0],h=arguments[1];if(l.isNull())return null;r.prototype.insert.call(this,l,h)},o.prototype.getIntersectsOp=function(){return o.intersectsOp},o.prototype.verticalSlices=function(l,h){for(var m=Math.trunc(Math.ceil(l.size()/h)),S=new Array(h).fill(null),C=l.iterator(),z=0;z<h;z++){S[z]=new O;for(var K=0;C.hasNext()&&K<m;){var mt=C.next();S[z].add(mt),K++}}return S},o.prototype.query=function(){if(arguments.length===1){var l=arguments[0];return r.prototype.query.call(this,l)}if(arguments.length===2){var h=arguments[0],m=arguments[1];r.prototype.query.call(this,h,m)}else if(arguments.length===3){if($(arguments[2],as)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn){var S=arguments[0],C=arguments[1],z=arguments[2];r.prototype.query.call(this,S,C,z)}else if($(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn){var K=arguments[0],mt=arguments[1],yt=arguments[2];r.prototype.query.call(this,K,mt,yt)}}},o.prototype.getComparator=function(){return o.yComparator},o.prototype.createParentBoundablesFromVerticalSlice=function(l,h){return r.prototype.createParentBoundables.call(this,l,h)},o.prototype.remove=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return r.prototype.remove.call(this,l,h)}return r.prototype.remove.apply(this,arguments)},o.prototype.depth=function(){return arguments.length===0?r.prototype.depth.call(this):r.prototype.depth.apply(this,arguments)},o.prototype.createParentBoundables=function(l,h){Pt.isTrue(!l.isEmpty());var m=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),S=new O(l);zi.sort(S,o.xComparator);var C=this.verticalSlices(S,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(C,h)},o.prototype.nearestNeighbour=function(){if(arguments.length===1){if($(arguments[0],Iu)){var l=arguments[0],h=new Hn(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof Hn){var m=arguments[0];return this.nearestNeighbour(m,w.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof o&&$(arguments[1],Iu)){var S=arguments[0],C=arguments[1],z=new Hn(this.getRoot(),S.getRoot(),C);return this.nearestNeighbour(z)}if(arguments[0]instanceof Hn&&typeof arguments[1]=="number"){var K=arguments[0],mt=arguments[1],yt=null,zt=new ko;for(zt.add(K);!zt.isEmpty()&&mt>0;){var qt=zt.poll(),jt=qt.getDistance();if(jt>=mt)break;qt.isLeaves()?(mt=jt,yt=qt):qt.expandToQueue(zt,mt)}return[yt.getBoundable(0).getItem(),yt.getBoundable(1).getItem()]}}else if(arguments.length===3){var ue=arguments[0],dn=arguments[1],Xn=arguments[2],Dr=new Bi(ue,dn),So=new Hn(this.getRoot(),Dr,Xn);return this.nearestNeighbour(So)[0]}},o.prototype.interfaces_=function(){return[Ra,t]},o.prototype.getClass=function(){return o},o.centreX=function(l){return o.avg(l.getMinX(),l.getMaxX())},o.avg=function(l,h){return(l+h)/2},o.centreY=function(l){return o.avg(l.getMinY(),l.getMaxY())},a.STRtreeNode.get=function(){return x1},a.serialVersionUID.get=function(){return 0x39920f7d5f261e0},a.xComparator.get=function(){return{interfaces_:function(){return[D]},compare:function(l,h){return r.compareDoubles(o.centreX(l.getBounds()),o.centreX(h.getBounds()))}}},a.yComparator.get=function(){return{interfaces_:function(){return[D]},compare:function(l,h){return r.compareDoubles(o.centreY(l.getBounds()),o.centreY(h.getBounds()))}}},a.intersectsOp.get=function(){return{interfaces_:function(){return[r.IntersectsOp]},intersects:function(l,h){return l.intersects(h)}}},a.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(o,a),o}(rr),x1=function(r){function o(){var a=arguments[0];r.call(this,a)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.computeBounds=function(){for(var a=null,l=this.getChildBoundables().iterator();l.hasNext();){var h=l.next();a===null?a=new Ct(h.getBounds()):a.expandToInclude(h.getBounds())}return a},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Jn),qr=function(){};qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.relativeSign=function(r,o){return r<o?-1:r>o?1:0},qr.compare=function(r,o,a){if(o.equals2D(a))return 0;var l=qr.relativeSign(o.x,a.x),h=qr.relativeSign(o.y,a.y);switch(r){case 0:return qr.compareValue(l,h);case 1:return qr.compareValue(h,l);case 2:return qr.compareValue(h,-l);case 3:return qr.compareValue(-l,h);case 4:return qr.compareValue(-l,-h);case 5:return qr.compareValue(-h,-l);case 6:return qr.compareValue(-h,l);case 7:return qr.compareValue(l,-h)}return Pt.shouldNeverReachHere("invalid octant value"),0},qr.compareValue=function(r,o){return r<0?-1:r>0?1:o<0?-1:o>0?1:0};var us=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];this._segString=r,this.coord=new P(o),this.segmentIndex=a,this._segmentOctant=l,this._isInterior=!o.equals2D(r.getCoordinate(a))};us.prototype.getCoordinate=function(){return this.coord},us.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)},us.prototype.compareTo=function(r){var o=r;return this.segmentIndex<o.segmentIndex?-1:this.segmentIndex>o.segmentIndex?1:this.coord.equals2D(o.coord)?0:qr.compare(this._segmentOctant,this.coord,o.coord)},us.prototype.isEndPoint=function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r},us.prototype.isInterior=function(){return this._isInterior},us.prototype.interfaces_=function(){return[B]},us.prototype.getClass=function(){return us};var Ir=function(){this._nodeMap=new y,this._edge=null;var r=arguments[0];this._edge=r};Ir.prototype.getSplitCoordinates=function(){var r=new J;this.addEndpoints();for(var o=this.iterator(),a=o.next();o.hasNext();){var l=o.next();this.addEdgeCoordinates(a,l,r),a=l}return r.toCoordinateArray()},Ir.prototype.addCollapsedNodes=function(){var r=new O;this.findCollapsesFromInsertedNodes(r),this.findCollapsesFromExistingVertices(r);for(var o=r.iterator();o.hasNext();){var a=o.next().intValue();this.add(this._edge.getCoordinate(a),a)}},Ir.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},Ir.prototype.findCollapsesFromExistingVertices=function(r){for(var o=0;o<this._edge.size()-2;o++){var a=this._edge.getCoordinate(o),l=this._edge.getCoordinate(o+2);a.equals2D(l)&&r.add(new it(o+1))}},Ir.prototype.addEdgeCoordinates=function(r,o,a){var l=this._edge.getCoordinate(o.segmentIndex),h=o.isInterior()||!o.coord.equals2D(l);a.add(new P(r.coord),!1);for(var m=r.segmentIndex+1;m<=o.segmentIndex;m++)a.add(this._edge.getCoordinate(m));h&&a.add(new P(o.coord))},Ir.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ir.prototype.addSplitEdges=function(r){this.addEndpoints(),this.addCollapsedNodes();for(var o=this.iterator(),a=o.next();o.hasNext();){var l=o.next(),h=this.createSplitEdge(a,l);r.add(h),a=l}},Ir.prototype.findCollapseIndex=function(r,o,a){if(!r.coord.equals2D(o.coord))return!1;var l=o.segmentIndex-r.segmentIndex;return o.isInterior()||l--,l===1&&(a[0]=r.segmentIndex+1,!0)},Ir.prototype.findCollapsesFromInsertedNodes=function(r){for(var o=new Array(1).fill(null),a=this.iterator(),l=a.next();a.hasNext();){var h=a.next();this.findCollapseIndex(l,h,o)&&r.add(new it(o[0])),l=h}},Ir.prototype.getEdge=function(){return this._edge},Ir.prototype.addEndpoints=function(){var r=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(r),r)},Ir.prototype.createSplitEdge=function(r,o){var a=o.segmentIndex-r.segmentIndex+2,l=this._edge.getCoordinate(o.segmentIndex),h=o.isInterior()||!o.coord.equals2D(l);h||a--;var m=new Array(a).fill(null),S=0;m[S++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)m[S++]=this._edge.getCoordinate(C);return h&&(m[S]=new P(o.coord)),new zn(m,this._edge.getData())},Ir.prototype.add=function(r,o){var a=new us(this._edge,r,o,this._edge.getSegmentOctant(o)),l=this._nodeMap.get(a);return l!==null?(Pt.isTrue(l.coord.equals2D(r),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(a,a),a)},Ir.prototype.checkSplitEdgesCorrectness=function(r){var o=this._edge.getCoordinates(),a=r.get(0).getCoordinate(0);if(!a.equals2D(o[0]))throw new Ht("bad split edge start point at "+a);var l=r.get(r.size()-1).getCoordinates(),h=l[l.length-1];if(!h.equals2D(o[o.length-1]))throw new Ht("bad split edge end point at "+h)},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir};var La=function(){};La.prototype.interfaces_=function(){return[]},La.prototype.getClass=function(){return La},La.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],o=arguments[1];if(r===0&&o===0)throw new T("Cannot compute the octant for point ( "+r+", "+o+" )");var a=Math.abs(r),l=Math.abs(o);return r>=0?o>=0?a>=l?0:1:a>=l?7:6:o>=0?a>=l?3:2:a>=l?4:5}if(arguments[0]instanceof P&&arguments[1]instanceof P){var h=arguments[0],m=arguments[1],S=m.x-h.x,C=m.y-h.y;if(S===0&&C===0)throw new T("Cannot compute the octant for two identical points "+h);return La.octant(S,C)}};var po=function(){};po.prototype.getCoordinates=function(){},po.prototype.size=function(){},po.prototype.getCoordinate=function(r){},po.prototype.isClosed=function(){},po.prototype.setData=function(r){},po.prototype.getData=function(){},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po};var dc=function(){};dc.prototype.addIntersection=function(r,o){},dc.prototype.interfaces_=function(){return[po]},dc.prototype.getClass=function(){return dc};var zn=function(){this._nodeList=new Ir(this),this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};zn.prototype.getCoordinates=function(){return this._pts},zn.prototype.size=function(){return this._pts.length},zn.prototype.getCoordinate=function(r){return this._pts[r]},zn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},zn.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))},zn.prototype.setData=function(r){this._data=r},zn.prototype.safeOctant=function(r,o){return r.equals2D(o)?0:La.octant(r,o)},zn.prototype.getData=function(){return this._data},zn.prototype.addIntersection=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];this.addIntersectionNode(r,o)}else if(arguments.length===4){var a=arguments[0],l=arguments[1],h=arguments[3],m=new P(a.getIntersection(h));this.addIntersection(m,l)}},zn.prototype.toString=function(){return wt.toLineString(new se(this._pts))},zn.prototype.getNodeList=function(){return this._nodeList},zn.prototype.addIntersectionNode=function(r,o){var a=o,l=a+1;if(l<this._pts.length){var h=this._pts[l];r.equals2D(h)&&(a=l)}return this._nodeList.add(r,a)},zn.prototype.addIntersections=function(r,o,a){for(var l=0;l<r.getIntersectionNum();l++)this.addIntersection(r,o,a,l)},zn.prototype.interfaces_=function(){return[dc]},zn.prototype.getClass=function(){return zn},zn.getNodedSubstrings=function(){if(arguments.length===1){var r=arguments[0],o=new O;return zn.getNodedSubstrings(r,o),o}if(arguments.length===2)for(var a=arguments[0],l=arguments[1],h=a.iterator();h.hasNext();)h.next().getNodeList().addSplitEdges(l)};var ae=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new P,this.p1=new P;else if(arguments.length===1){var r=arguments[0];this.p0=new P(r.p0),this.p1=new P(r.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var o=arguments[0],a=arguments[1],l=arguments[2],h=arguments[3];this.p0=new P(o,a),this.p1=new P(l,h)}},E1={serialVersionUID:{configurable:!0}};ae.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ae.prototype.orientationIndex=function(){if(arguments[0]instanceof ae){var r=arguments[0],o=ot.orientationIndex(this.p0,this.p1,r.p0),a=ot.orientationIndex(this.p0,this.p1,r.p1);return o>=0&&a>=0||o<=0&&a<=0?Math.max(o,a):0}if(arguments[0]instanceof P){var l=arguments[0];return ot.orientationIndex(this.p0,this.p1,l)}},ae.prototype.toGeometry=function(r){return r.createLineString([this.p0,this.p1])},ae.prototype.isVertical=function(){return this.p0.x===this.p1.x},ae.prototype.equals=function(r){if(!(r instanceof ae))return!1;var o=r;return this.p0.equals(o.p0)&&this.p1.equals(o.p1)},ae.prototype.intersection=function(r){var o=new N;return o.computeIntersection(this.p0,this.p1,r.p0,r.p1),o.hasIntersection()?o.getIntersection(0):null},ae.prototype.project=function(){if(arguments[0]instanceof P){var r=arguments[0];if(r.equals(this.p0)||r.equals(this.p1))return new P(r);var o=this.projectionFactor(r),a=new P;return a.x=this.p0.x+o*(this.p1.x-this.p0.x),a.y=this.p0.y+o*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof ae){var l=arguments[0],h=this.projectionFactor(l.p0),m=this.projectionFactor(l.p1);if(h>=1&&m>=1||h<=0&&m<=0)return null;var S=this.project(l.p0);h<0&&(S=this.p0),h>1&&(S=this.p1);var C=this.project(l.p1);return m<0&&(C=this.p0),m>1&&(C=this.p1),new ae(S,C)}},ae.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ae.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ae.prototype.getCoordinate=function(r){return r===0?this.p0:this.p1},ae.prototype.distancePerpendicular=function(r){return ot.distancePointLinePerpendicular(r,this.p0,this.p1)},ae.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ae.prototype.midPoint=function(){return ae.midPoint(this.p0,this.p1)},ae.prototype.projectionFactor=function(r){if(r.equals(this.p0))return 0;if(r.equals(this.p1))return 1;var o=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,l=o*o+a*a;return l<=0?w.NaN:((r.x-this.p0.x)*o+(r.y-this.p0.y)*a)/l},ae.prototype.closestPoints=function(r){var o=this.intersection(r);if(o!==null)return[o,o];var a=new Array(2).fill(null),l=w.MAX_VALUE,h=null,m=this.closestPoint(r.p0);l=m.distance(r.p0),a[0]=m,a[1]=r.p0;var S=this.closestPoint(r.p1);(h=S.distance(r.p1))<l&&(l=h,a[0]=S,a[1]=r.p1);var C=r.closestPoint(this.p0);(h=C.distance(this.p0))<l&&(l=h,a[0]=this.p0,a[1]=C);var z=r.closestPoint(this.p1);return(h=z.distance(this.p1))<l&&(l=h,a[0]=this.p1,a[1]=z),a},ae.prototype.closestPoint=function(r){var o=this.projectionFactor(r);return o>0&&o<1?this.project(r):this.p0.distance(r)<this.p1.distance(r)?this.p0:this.p1},ae.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ae.prototype.getLength=function(){return this.p0.distance(this.p1)},ae.prototype.compareTo=function(r){var o=r,a=this.p0.compareTo(o.p0);return a!==0?a:this.p1.compareTo(o.p1)},ae.prototype.reverse=function(){var r=this.p0;this.p0=this.p1,this.p1=r},ae.prototype.equalsTopo=function(r){return this.p0.equals(r.p0)&&(this.p1.equals(r.p1)||this.p0.equals(r.p1))&&this.p1.equals(r.p0)},ae.prototype.lineIntersection=function(r){try{return Gt.intersection(this.p0,this.p1,r.p0,r.p1)}catch(o){if(!(o instanceof $t))throw o}return null},ae.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ae.prototype.pointAlongOffset=function(r,o){var a=this.p0.x+r*(this.p1.x-this.p0.x),l=this.p0.y+r*(this.p1.y-this.p0.y),h=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,S=Math.sqrt(h*h+m*m),C=0,z=0;if(o!==0){if(S<=0)throw new Error("Cannot compute offset from zero-length line segment");C=o*h/S,z=o*m/S}return new P(a-z,l+C)},ae.prototype.setCoordinates=function(){if(arguments.length===1){var r=arguments[0];this.setCoordinates(r.p0,r.p1)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this.p0.x=o.x,this.p0.y=o.y,this.p1.x=a.x,this.p1.y=a.y}},ae.prototype.segmentFraction=function(r){var o=this.projectionFactor(r);return o<0?o=0:(o>1||w.isNaN(o))&&(o=1),o},ae.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ae.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ae.prototype.distance=function(){if(arguments[0]instanceof ae){var r=arguments[0];return ot.distanceLineLine(this.p0,this.p1,r.p0,r.p1)}if(arguments[0]instanceof P){var o=arguments[0];return ot.distancePointLine(o,this.p0,this.p1)}},ae.prototype.pointAlong=function(r){var o=new P;return o.x=this.p0.x+r*(this.p1.x-this.p0.x),o.y=this.p0.y+r*(this.p1.y-this.p0.y),o},ae.prototype.hashCode=function(){var r=w.doubleToLongBits(this.p0.x);r^=31*w.doubleToLongBits(this.p0.y);var o=Math.trunc(r)^Math.trunc(r>>32),a=w.doubleToLongBits(this.p1.x);return a^=31*w.doubleToLongBits(this.p1.y),o^(Math.trunc(a)^Math.trunc(a>>32))},ae.prototype.interfaces_=function(){return[B,t]},ae.prototype.getClass=function(){return ae},ae.midPoint=function(r,o){return new P((r.x+o.x)/2,(r.y+o.y)/2)},E1.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ae,E1);var gc=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new ae,this._overlapSeg2=new ae};gc.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];r.getLineSegment(o,this._overlapSeg1),a.getLineSegment(l,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},gc.prototype.interfaces_=function(){return[]},gc.prototype.getClass=function(){return gc};var ti=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];this._pts=r,this._start=o,this._end=a,this._context=l};ti.prototype.getLineSegment=function(r,o){o.p0=this._pts[r],o.p1=this._pts[r+1]},ti.prototype.computeSelect=function(r,o,a,l){var h=this._pts[o],m=this._pts[a];if(l.tempEnv1.init(h,m),a-o==1)return l.select(this,o),null;if(!r.intersects(l.tempEnv1))return null;var S=Math.trunc((o+a)/2);o<S&&this.computeSelect(r,o,S,l),S<a&&this.computeSelect(r,S,a,l)},ti.prototype.getCoordinates=function(){for(var r=new Array(this._end-this._start+1).fill(null),o=0,a=this._start;a<=this._end;a++)r[o++]=this._pts[a];return r},ti.prototype.computeOverlaps=function(r,o){this.computeOverlapsInternal(this._start,this._end,r,r._start,r._end,o)},ti.prototype.setId=function(r){this._id=r},ti.prototype.select=function(r,o){this.computeSelect(r,this._start,this._end,o)},ti.prototype.getEnvelope=function(){if(this._env===null){var r=this._pts[this._start],o=this._pts[this._end];this._env=new Ct(r,o)}return this._env},ti.prototype.getEndIndex=function(){return this._end},ti.prototype.getStartIndex=function(){return this._start},ti.prototype.getContext=function(){return this._context},ti.prototype.getId=function(){return this._id},ti.prototype.computeOverlapsInternal=function(r,o,a,l,h,m){var S=this._pts[r],C=this._pts[o],z=a._pts[l],K=a._pts[h];if(o-r==1&&h-l==1)return m.overlap(this,r,a,l),null;if(m.tempEnv1.init(S,C),m.tempEnv2.init(z,K),!m.tempEnv1.intersects(m.tempEnv2))return null;var mt=Math.trunc((r+o)/2),yt=Math.trunc((l+h)/2);r<mt&&(l<yt&&this.computeOverlapsInternal(r,mt,a,l,yt,m),yt<h&&this.computeOverlapsInternal(r,mt,a,yt,h,m)),mt<o&&(l<yt&&this.computeOverlapsInternal(mt,o,a,l,yt,m),yt<h&&this.computeOverlapsInternal(mt,o,a,yt,h,m))},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti};var Qi=function(){};Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi},Qi.getChainStartIndices=function(r){var o=0,a=new O;a.add(new it(o));do{var l=Qi.findChainEnd(r,o);a.add(new it(l)),o=l}while(o<r.length-1);return Qi.toIntArray(a)},Qi.findChainEnd=function(r,o){for(var a=o;a<r.length-1&&r[a].equals2D(r[a+1]);)a++;if(a>=r.length-1)return r.length-1;for(var l=mn.quadrant(r[a],r[a+1]),h=o+1;h<r.length&&!(!r[h-1].equals2D(r[h])&&mn.quadrant(r[h-1],r[h])!==l);)h++;return h-1},Qi.getChains=function(){if(arguments.length===1){var r=arguments[0];return Qi.getChains(r,null)}if(arguments.length===2){for(var o=arguments[0],a=arguments[1],l=new O,h=Qi.getChainStartIndices(o),m=0;m<h.length-1;m++){var S=new ti(o,h[m],h[m+1],a);l.add(S)}return l}},Qi.toIntArray=function(r){for(var o=new Array(r.size()).fill(null),a=0;a<o.length;a++)o[a]=r.get(a).intValue();return o};var zs=function(){};zs.prototype.computeNodes=function(r){},zs.prototype.getNodedSubstrings=function(){},zs.prototype.interfaces_=function(){return[]},zs.prototype.getClass=function(){return zs};var mc=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setSegmentIntersector(r)}}};mc.prototype.setSegmentIntersector=function(r){this._segInt=r},mc.prototype.interfaces_=function(){return[zs]},mc.prototype.getClass=function(){return mc};var Pg=function(r){function o(l){l?r.call(this,l):r.call(this),this._monoChains=new O,this._index=new _1,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={SegmentOverlapAction:{configurable:!0}};return o.prototype.getMonotoneChains=function(){return this._monoChains},o.prototype.getNodedSubstrings=function(){return zn.getNodedSubstrings(this._nodedSegStrings)},o.prototype.getIndex=function(){return this._index},o.prototype.add=function(l){for(var h=Qi.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var m=h.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},o.prototype.computeNodes=function(l){this._nodedSegStrings=l;for(var h=l.iterator();h.hasNext();)this.add(h.next());this.intersectChains()},o.prototype.intersectChains=function(){for(var l=new S1(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var m=h.next(),S=this._index.query(m.getEnvelope()).iterator();S.hasNext();){var C=S.next();if(C.getId()>m.getId()&&(m.computeOverlaps(C,l),this._nOverlaps++),this._segInt.isDone())return null}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},a.SegmentOverlapAction.get=function(){return S1},Object.defineProperties(o,a),o}(mc),S1=function(r){function o(){r.call(this),this._si=null;var a=arguments[0];this._si=a}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.overlap=function(){if(arguments.length!==4)return r.prototype.overlap.apply(this,arguments);var a=arguments[0],l=arguments[1],h=arguments[2],m=arguments[3],S=a.getContext(),C=h.getContext();this._si.processIntersections(S,l,C,m)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(gc),Ke=function r(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var o=arguments[0];this.setQuadrantSegments(o)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.setQuadrantSegments(a),this.setEndCapStyle(l)}else if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(m),this.setJoinStyle(S),this.setMitreLimit(C)}}},qo={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Ke.prototype.getEndCapStyle=function(){return this._endCapStyle},Ke.prototype.isSingleSided=function(){return this._isSingleSided},Ke.prototype.setQuadrantSegments=function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=Ke.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ke.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==Ke.JOIN_ROUND&&(this._quadrantSegments=Ke.DEFAULT_QUADRANT_SEGMENTS)},Ke.prototype.getJoinStyle=function(){return this._joinStyle},Ke.prototype.setJoinStyle=function(r){this._joinStyle=r},Ke.prototype.setSimplifyFactor=function(r){this._simplifyFactor=r<0?0:r},Ke.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ke.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ke.prototype.setEndCapStyle=function(r){this._endCapStyle=r},Ke.prototype.getMitreLimit=function(){return this._mitreLimit},Ke.prototype.setMitreLimit=function(r){this._mitreLimit=r},Ke.prototype.setSingleSided=function(r){this._isSingleSided=r},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke},Ke.bufferDistanceError=function(r){var o=Math.PI/2/r;return 1-Math.cos(o/2)},qo.CAP_ROUND.get=function(){return 1},qo.CAP_FLAT.get=function(){return 2},qo.CAP_SQUARE.get=function(){return 3},qo.JOIN_ROUND.get=function(){return 1},qo.JOIN_MITRE.get=function(){return 2},qo.JOIN_BEVEL.get=function(){return 3},qo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},qo.DEFAULT_MITRE_LIMIT.get=function(){return 5},qo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Ke,qo);var Fn=function(r){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ot.COUNTERCLOCKWISE,this._inputLine=r||null},yc={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Fn.prototype.isDeletable=function(r,o,a,l){var h=this._inputLine[r],m=this._inputLine[o],S=this._inputLine[a];return!!this.isConcave(h,m,S)&&!!this.isShallow(h,m,S,l)&&this.isShallowSampled(h,m,r,a,l)},Fn.prototype.deleteShallowConcavities=function(){for(var r=1,o=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(o),l=!1;a<this._inputLine.length;){var h=!1;this.isDeletable(r,o,a,this._distanceTol)&&(this._isDeleted[o]=Fn.DELETE,h=!0,l=!0),r=h?a:o,o=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(o)}return l},Fn.prototype.isShallowConcavity=function(r,o,a,l){return ot.computeOrientation(r,o,a)!==this._angleOrientation?!1:ot.distancePointLine(o,r,a)<l},Fn.prototype.isShallowSampled=function(r,o,a,l,h){var m=Math.trunc((l-a)/Fn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var S=a;S<l;S+=m)if(!this.isShallow(r,o,this._inputLine[S],h))return!1;return!0},Fn.prototype.isConcave=function(r,o,a){var l=ot.computeOrientation(r,o,a)===this._angleOrientation;return l},Fn.prototype.simplify=function(r){this._distanceTol=Math.abs(r),r<0&&(this._angleOrientation=ot.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var o=!1;do o=this.deleteShallowConcavities();while(o);return this.collapseLine()},Fn.prototype.findNextNonDeletedIndex=function(r){for(var o=r+1;o<this._inputLine.length&&this._isDeleted[o]===Fn.DELETE;)o++;return o},Fn.prototype.isShallow=function(r,o,a,l){return ot.distancePointLine(o,r,a)<l},Fn.prototype.collapseLine=function(){for(var r=new J,o=0;o<this._inputLine.length;o++)this._isDeleted[o]!==Fn.DELETE&&r.add(this._inputLine[o]);return r.toCoordinateArray()},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.simplify=function(r,o){return new Fn(r).simplify(o)},yc.INIT.get=function(){return 0},yc.DELETE.get=function(){return 1},yc.KEEP.get=function(){return 1},yc.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Fn,yc);var mi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new O},w1={COORDINATE_ARRAY_TYPE:{configurable:!0}};mi.prototype.getCoordinates=function(){return this._ptList.toArray(mi.COORDINATE_ARRAY_TYPE)},mi.prototype.setPrecisionModel=function(r){this._precisionModel=r},mi.prototype.addPt=function(r){var o=new P(r);if(this._precisionModel.makePrecise(o),this.isRedundant(o))return null;this._ptList.add(o)},mi.prototype.revere=function(){},mi.prototype.addPts=function(r,o){if(o)for(var a=0;a<r.length;a++)this.addPt(r[a]);else for(var l=r.length-1;l>=0;l--)this.addPt(r[l])},mi.prototype.isRedundant=function(r){if(this._ptList.size()<1)return!1;var o=this._ptList.get(this._ptList.size()-1);return r.distance(o)<this._minimimVertexDistance},mi.prototype.toString=function(){return new me().createLineString(this.getCoordinates()).toString()},mi.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var r=new P(this._ptList.get(0)),o=this._ptList.get(this._ptList.size()-1);if(r.equals(o))return null;this._ptList.add(r)},mi.prototype.setMinimumVertexDistance=function(r){this._minimimVertexDistance=r},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi},w1.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(mi,w1);var xe=function(){},Na={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};xe.prototype.interfaces_=function(){return[]},xe.prototype.getClass=function(){return xe},xe.toDegrees=function(r){return 180*r/Math.PI},xe.normalize=function(r){for(;r>Math.PI;)r-=xe.PI_TIMES_2;for(;r<=-Math.PI;)r+=xe.PI_TIMES_2;return r},xe.angle=function(){if(arguments.length===1){var r=arguments[0];return Math.atan2(r.y,r.x)}if(arguments.length===2){var o=arguments[0],a=arguments[1],l=a.x-o.x,h=a.y-o.y;return Math.atan2(h,l)}},xe.isAcute=function(r,o,a){var l=r.x-o.x,h=r.y-o.y;return l*(a.x-o.x)+h*(a.y-o.y)>0},xe.isObtuse=function(r,o,a){var l=r.x-o.x,h=r.y-o.y;return l*(a.x-o.x)+h*(a.y-o.y)<0},xe.interiorAngle=function(r,o,a){var l=xe.angle(o,r),h=xe.angle(o,a);return Math.abs(h-l)},xe.normalizePositive=function(r){if(r<0){for(;r<0;)r+=xe.PI_TIMES_2;r>=xe.PI_TIMES_2&&(r=0)}else{for(;r>=xe.PI_TIMES_2;)r-=xe.PI_TIMES_2;r<0&&(r=0)}return r},xe.angleBetween=function(r,o,a){var l=xe.angle(o,r),h=xe.angle(o,a);return xe.diff(l,h)},xe.diff=function(r,o){var a=null;return(a=r<o?o-r:r-o)>Math.PI&&(a=2*Math.PI-a),a},xe.toRadians=function(r){return r*Math.PI/180},xe.getTurn=function(r,o){var a=Math.sin(o-r);return a>0?xe.COUNTERCLOCKWISE:a<0?xe.CLOCKWISE:xe.NONE},xe.angleBetweenOriented=function(r,o,a){var l=xe.angle(o,r),h=xe.angle(o,a)-l;return h<=-Math.PI?h+xe.PI_TIMES_2:h>Math.PI?h-xe.PI_TIMES_2:h},Na.PI_TIMES_2.get=function(){return 2*Math.PI},Na.PI_OVER_2.get=function(){return Math.PI/2},Na.PI_OVER_4.get=function(){return Math.PI/4},Na.COUNTERCLOCKWISE.get=function(){return ot.COUNTERCLOCKWISE},Na.CLOCKWISE.get=function(){return ot.CLOCKWISE},Na.NONE.get=function(){return ot.COLLINEAR},Object.defineProperties(xe,Na);var bn=function r(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ae,this._seg1=new ae,this._offset0=new ae,this._offset1=new ae,this._side=0,this._hasNarrowConcaveAngle=!1;var o=arguments[0],a=arguments[1],l=arguments[2];this._precisionModel=o,this._bufParams=a,this._li=new N,this._filletAngleQuantum=Math.PI/2/a.getQuadrantSegments(),a.getQuadrantSegments()>=8&&a.getJoinStyle()===Ke.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},vc={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};bn.prototype.addNextSegment=function(r,o){if(this._s0=this._s1,this._s1=this._s2,this._s2=r,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var a=ot.computeOrientation(this._s0,this._s1,this._s2),l=a===ot.CLOCKWISE&&this._side===Ft.LEFT||a===ot.COUNTERCLOCKWISE&&this._side===Ft.RIGHT;a===0?this.addCollinear(o):l?this.addOutsideTurn(a,o):this.addInsideTurn(a,o)},bn.prototype.addLineEndCap=function(r,o){var a=new ae(r,o),l=new ae;this.computeOffsetSegment(a,Ft.LEFT,this._distance,l);var h=new ae;this.computeOffsetSegment(a,Ft.RIGHT,this._distance,h);var m=o.x-r.x,S=o.y-r.y,C=Math.atan2(S,m);switch(this._bufParams.getEndCapStyle()){case Ke.CAP_ROUND:this._segList.addPt(l.p1),this.addFilletArc(o,C+Math.PI/2,C-Math.PI/2,ot.CLOCKWISE,this._distance),this._segList.addPt(h.p1);break;case Ke.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case Ke.CAP_SQUARE:var z=new P;z.x=Math.abs(this._distance)*Math.cos(C),z.y=Math.abs(this._distance)*Math.sin(C);var K=new P(l.p1.x+z.x,l.p1.y+z.y),mt=new P(h.p1.x+z.x,h.p1.y+z.y);this._segList.addPt(K),this._segList.addPt(mt)}},bn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},bn.prototype.addMitreJoin=function(r,o,a,l){var h=!0,m=null;try{m=Gt.intersection(o.p0,o.p1,a.p0,a.p1),(l<=0?1:m.distance(r)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(S){if(!(S instanceof $t))throw S;m=new P(0,0),h=!1}h?this._segList.addPt(m):this.addLimitedMitreJoin(o,a,l,this._bufParams.getMitreLimit())},bn.prototype.addFilletCorner=function(r,o,a,l,h){var m=o.x-r.x,S=o.y-r.y,C=Math.atan2(S,m),z=a.x-r.x,K=a.y-r.y,mt=Math.atan2(K,z);l===ot.CLOCKWISE?C<=mt&&(C+=2*Math.PI):C>=mt&&(C-=2*Math.PI),this._segList.addPt(o),this.addFilletArc(r,C,mt,l,h),this._segList.addPt(a)},bn.prototype.addOutsideTurn=function(r,o){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*bn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ke.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ke.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(o&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,r,this._distance),this._segList.addPt(this._offset1.p0))},bn.prototype.createSquare=function(r){this._segList.addPt(new P(r.x+this._distance,r.y+this._distance)),this._segList.addPt(new P(r.x+this._distance,r.y-this._distance)),this._segList.addPt(new P(r.x-this._distance,r.y-this._distance)),this._segList.addPt(new P(r.x-this._distance,r.y+this._distance)),this._segList.closeRing()},bn.prototype.addSegments=function(r,o){this._segList.addPts(r,o)},bn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},bn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},bn.prototype.initSideSegments=function(r,o,a){this._s1=r,this._s2=o,this._side=a,this._seg1.setCoordinates(r,o),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)},bn.prototype.addLimitedMitreJoin=function(r,o,a,l){var h=this._seg0.p1,m=xe.angle(h,this._seg0.p0),S=xe.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,C=xe.normalize(m+S),z=xe.normalize(C+Math.PI),K=l*a,mt=a-K*Math.abs(Math.sin(S)),yt=h.x+K*Math.cos(z),zt=h.y+K*Math.sin(z),qt=new P(yt,zt),jt=new ae(h,qt),ue=jt.pointAlongOffset(1,mt),dn=jt.pointAlongOffset(1,-mt);this._side===Ft.LEFT?(this._segList.addPt(ue),this._segList.addPt(dn)):(this._segList.addPt(dn),this._segList.addPt(ue))},bn.prototype.computeOffsetSegment=function(r,o,a,l){var h=o===Ft.LEFT?1:-1,m=r.p1.x-r.p0.x,S=r.p1.y-r.p0.y,C=Math.sqrt(m*m+S*S),z=h*a*m/C,K=h*a*S/C;l.p0.x=r.p0.x-K,l.p0.y=r.p0.y+z,l.p1.x=r.p1.x-K,l.p1.y=r.p1.y+z},bn.prototype.addFilletArc=function(r,o,a,l,h){var m=l===ot.CLOCKWISE?-1:1,S=Math.abs(o-a),C=Math.trunc(S/this._filletAngleQuantum+.5);if(C<1)return null;for(var z=S/C,K=0,mt=new P;K<S;){var yt=o+m*K;mt.x=r.x+h*Math.cos(yt),mt.y=r.y+h*Math.sin(yt),this._segList.addPt(mt),K+=z}},bn.prototype.addInsideTurn=function(r,o){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*bn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new P((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(a);var l=new P((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},bn.prototype.createCircle=function(r){var o=new P(r.x+this._distance,r.y);this._segList.addPt(o),this.addFilletArc(r,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},bn.prototype.addBevelJoin=function(r,o){this._segList.addPt(r.p1),this._segList.addPt(o.p0)},bn.prototype.init=function(r){this._distance=r,this._maxCurveSegmentError=r*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new mi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(r*bn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},bn.prototype.addCollinear=function(r){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ke.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ke.JOIN_MITRE?(r&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ot.CLOCKWISE,this._distance))},bn.prototype.closeRing=function(){this._segList.closeRing()},bn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},vc.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},vc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},vc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},vc.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(bn,vc);var Vr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],o=arguments[1];this._precisionModel=r,this._bufParams=o};Vr.prototype.getOffsetCurve=function(r,o){if(this._distance=o,o===0)return null;var a=o<0,l=Math.abs(o),h=this.getSegGen(l);r.length<=1?this.computePointCurve(r[0],h):this.computeOffsetCurve(r,a,h);var m=h.getCoordinates();return a&&et.reverse(m),m},Vr.prototype.computeSingleSidedBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){a.addSegments(r,!0);var h=Fn.simplify(r,-l),m=h.length-1;a.initSideSegments(h[m],h[m-1],Ft.LEFT),a.addFirstSegment();for(var S=m-2;S>=0;S--)a.addNextSegment(h[S],!0)}else{a.addSegments(r,!1);var C=Fn.simplify(r,l),z=C.length-1;a.initSideSegments(C[0],C[1],Ft.LEFT),a.addFirstSegment();for(var K=2;K<=z;K++)a.addNextSegment(C[K],!0)}a.addLastSegment(),a.closeRing()},Vr.prototype.computeRingBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);o===Ft.RIGHT&&(l=-l);var h=Fn.simplify(r,l),m=h.length-1;a.initSideSegments(h[m-1],h[0],o);for(var S=1;S<=m;S++){var C=S!==1;a.addNextSegment(h[S],C)}a.closeRing()},Vr.prototype.computeLineBufferCurve=function(r,o){var a=this.simplifyTolerance(this._distance),l=Fn.simplify(r,a),h=l.length-1;o.initSideSegments(l[0],l[1],Ft.LEFT);for(var m=2;m<=h;m++)o.addNextSegment(l[m],!0);o.addLastSegment(),o.addLineEndCap(l[h-1],l[h]);var S=Fn.simplify(r,-a),C=S.length-1;o.initSideSegments(S[C],S[C-1],Ft.LEFT);for(var z=C-2;z>=0;z--)o.addNextSegment(S[z],!0);o.addLastSegment(),o.addLineEndCap(S[1],S[0]),o.closeRing()},Vr.prototype.computePointCurve=function(r,o){switch(this._bufParams.getEndCapStyle()){case Ke.CAP_ROUND:o.createCircle(r);break;case Ke.CAP_SQUARE:o.createSquare(r)}},Vr.prototype.getLineCurve=function(r,o){if(this._distance=o,o<0&&!this._bufParams.isSingleSided()||o===0)return null;var a=Math.abs(o),l=this.getSegGen(a);if(r.length<=1)this.computePointCurve(r[0],l);else if(this._bufParams.isSingleSided()){var h=o<0;this.computeSingleSidedBufferCurve(r,h,l)}else this.computeLineBufferCurve(r,l);return l.getCoordinates()},Vr.prototype.getBufferParameters=function(){return this._bufParams},Vr.prototype.simplifyTolerance=function(r){return r*this._bufParams.getSimplifyFactor()},Vr.prototype.getRingCurve=function(r,o,a){if(this._distance=a,r.length<=2)return this.getLineCurve(r,a);if(a===0)return Vr.copyCoordinates(r);var l=this.getSegGen(a);return this.computeRingBufferCurve(r,o,l),l.getCoordinates()},Vr.prototype.computeOffsetCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){var h=Fn.simplify(r,-l),m=h.length-1;a.initSideSegments(h[m],h[m-1],Ft.LEFT),a.addFirstSegment();for(var S=m-2;S>=0;S--)a.addNextSegment(h[S],!0)}else{var C=Fn.simplify(r,l),z=C.length-1;a.initSideSegments(C[0],C[1],Ft.LEFT),a.addFirstSegment();for(var K=2;K<=z;K++)a.addNextSegment(C[K],!0)}a.addLastSegment()},Vr.prototype.getSegGen=function(r){return new bn(this._precisionModel,this._bufParams,r)},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr},Vr.copyCoordinates=function(r){for(var o=new Array(r.length).fill(null),a=0;a<o.length;a++)o[a]=new P(r[a]);return o};var Oa=function(){this._subgraphs=null,this._seg=new ae,this._cga=new ot;var r=arguments[0];this._subgraphs=r},M1={DepthSegment:{configurable:!0}};Oa.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var r=arguments[0],o=new O,a=this._subgraphs.iterator();a.hasNext();){var l=a.next(),h=l.getEnvelope();r.y<h.getMinY()||r.y>h.getMaxY()||this.findStabbedSegments(r,l.getDirectedEdges(),o)}return o}if(arguments.length===3){if($(arguments[2],ht)&&arguments[0]instanceof P&&arguments[1]instanceof Ig){for(var m=arguments[0],S=arguments[1],C=arguments[2],z=S.getEdge().getCoordinates(),K=0;K<z.length-1;K++)if(this._seg.p0=z[K],this._seg.p1=z[K+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||ot.computeOrientation(this._seg.p0,this._seg.p1,m)===ot.RIGHT)){var mt=S.getDepth(Ft.LEFT);this._seg.p0.equals(z[K])||(mt=S.getDepth(Ft.RIGHT));var yt=new Gs(this._seg,mt);C.add(yt)}}else if($(arguments[2],ht)&&arguments[0]instanceof P&&$(arguments[1],ht))for(var zt=arguments[0],qt=arguments[1],jt=arguments[2],ue=qt.iterator();ue.hasNext();){var dn=ue.next();dn.isForward()&&this.findStabbedSegments(zt,dn,jt)}}},Oa.prototype.getDepth=function(r){var o=this.findStabbedSegments(r);return o.size()===0?0:zi.min(o)._leftDepth},Oa.prototype.interfaces_=function(){return[]},Oa.prototype.getClass=function(){return Oa},M1.DepthSegment.get=function(){return Gs},Object.defineProperties(Oa,M1);var Gs=function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],o=arguments[1];this._upwardSeg=new ae(r),this._leftDepth=o};Gs.prototype.compareTo=function(r){var o=r;if(this._upwardSeg.minX()>=o._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=o._upwardSeg.minX())return-1;var a=this._upwardSeg.orientationIndex(o._upwardSeg);return a!==0||(a=-1*o._upwardSeg.orientationIndex(this._upwardSeg))!=0?a:this._upwardSeg.compareTo(o._upwardSeg)},Gs.prototype.compareX=function(r,o){var a=r.p0.compareTo(o.p0);return a!==0?a:r.p1.compareTo(o.p1)},Gs.prototype.toString=function(){return this._upwardSeg.toString()},Gs.prototype.interfaces_=function(){return[B]},Gs.prototype.getClass=function(){return Gs};var Qe=function(r,o,a){this.p0=r||null,this.p1=o||null,this.p2=a||null};Qe.prototype.area=function(){return Qe.area(this.p0,this.p1,this.p2)},Qe.prototype.signedArea=function(){return Qe.signedArea(this.p0,this.p1,this.p2)},Qe.prototype.interpolateZ=function(r){if(r===null)throw new T("Supplied point is null.");return Qe.interpolateZ(r,this.p0,this.p1,this.p2)},Qe.prototype.longestSideLength=function(){return Qe.longestSideLength(this.p0,this.p1,this.p2)},Qe.prototype.isAcute=function(){return Qe.isAcute(this.p0,this.p1,this.p2)},Qe.prototype.circumcentre=function(){return Qe.circumcentre(this.p0,this.p1,this.p2)},Qe.prototype.area3D=function(){return Qe.area3D(this.p0,this.p1,this.p2)},Qe.prototype.centroid=function(){return Qe.centroid(this.p0,this.p1,this.p2)},Qe.prototype.inCentre=function(){return Qe.inCentre(this.p0,this.p1,this.p2)},Qe.prototype.interfaces_=function(){return[]},Qe.prototype.getClass=function(){return Qe},Qe.area=function(r,o,a){return Math.abs(((a.x-r.x)*(o.y-r.y)-(o.x-r.x)*(a.y-r.y))/2)},Qe.signedArea=function(r,o,a){return((a.x-r.x)*(o.y-r.y)-(o.x-r.x)*(a.y-r.y))/2},Qe.det=function(r,o,a,l){return r*l-o*a},Qe.interpolateZ=function(r,o,a,l){var h=o.x,m=o.y,S=a.x-h,C=l.x-h,z=a.y-m,K=l.y-m,mt=S*K-C*z,yt=r.x-h,zt=r.y-m,qt=(K*yt-C*zt)/mt,jt=(-z*yt+S*zt)/mt;return o.z+qt*(a.z-o.z)+jt*(l.z-o.z)},Qe.longestSideLength=function(r,o,a){var l=r.distance(o),h=o.distance(a),m=a.distance(r),S=l;return h>S&&(S=h),m>S&&(S=m),S},Qe.isAcute=function(r,o,a){return!!xe.isAcute(r,o,a)&&!!xe.isAcute(o,a,r)&&!!xe.isAcute(a,r,o)},Qe.circumcentre=function(r,o,a){var l=a.x,h=a.y,m=r.x-l,S=r.y-h,C=o.x-l,z=o.y-h,K=2*Qe.det(m,S,C,z),mt=Qe.det(S,m*m+S*S,z,C*C+z*z),yt=Qe.det(m,m*m+S*S,C,C*C+z*z);return new P(l-mt/K,h+yt/K)},Qe.perpendicularBisector=function(r,o){var a=o.x-r.x,l=o.y-r.y,h=new Gt(r.x+a/2,r.y+l/2,1),m=new Gt(r.x-l+a/2,r.y+a+l/2,1);return new Gt(h,m)},Qe.angleBisector=function(r,o,a){var l=o.distance(r),h=l/(l+o.distance(a)),m=a.x-r.x,S=a.y-r.y;return new P(r.x+h*m,r.y+h*S)},Qe.area3D=function(r,o,a){var l=o.x-r.x,h=o.y-r.y,m=o.z-r.z,S=a.x-r.x,C=a.y-r.y,z=a.z-r.z,K=h*z-m*C,mt=m*S-l*z,yt=l*C-h*S,zt=K*K+mt*mt+yt*yt,qt=Math.sqrt(zt)/2;return qt},Qe.centroid=function(r,o,a){var l=(r.x+o.x+a.x)/3,h=(r.y+o.y+a.y)/3;return new P(l,h)},Qe.inCentre=function(r,o,a){var l=o.distance(a),h=r.distance(a),m=r.distance(o),S=l+h+m,C=(l*r.x+h*o.x+m*a.x)/S,z=(l*r.y+h*o.y+m*a.y)/S;return new P(C,z)};var Ii=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new O;var r=arguments[0],o=arguments[1],a=arguments[2];this._inputGeom=r,this._distance=o,this._curveBuilder=a};Ii.prototype.addPoint=function(r){if(this._distance<=0)return null;var o=r.getCoordinates(),a=this._curveBuilder.getLineCurve(o,this._distance);this.addCurve(a,V.EXTERIOR,V.INTERIOR)},Ii.prototype.addPolygon=function(r){var o=this._distance,a=Ft.LEFT;this._distance<0&&(o=-this._distance,a=Ft.RIGHT);var l=r.getExteriorRing(),h=et.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&h.length<3)return null;this.addPolygonRing(h,o,a,V.EXTERIOR,V.INTERIOR);for(var m=0;m<r.getNumInteriorRing();m++){var S=r.getInteriorRingN(m),C=et.removeRepeatedPoints(S.getCoordinates());this._distance>0&&this.isErodedCompletely(S,-this._distance)||this.addPolygonRing(C,o,Ft.opposite(a),V.INTERIOR,V.EXTERIOR)}},Ii.prototype.isTriangleErodedCompletely=function(r,o){var a=new Qe(r[0],r[1],r[2]),l=a.inCentre();return ot.distancePointLine(l,a.p0,a.p1)<Math.abs(o)},Ii.prototype.addLineString=function(r){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var o=et.removeRepeatedPoints(r.getCoordinates()),a=this._curveBuilder.getLineCurve(o,this._distance);this.addCurve(a,V.EXTERIOR,V.INTERIOR)},Ii.prototype.addCurve=function(r,o,a){if(r===null||r.length<2)return null;var l=new zn(r,new pn(0,V.BOUNDARY,o,a));this._curveList.add(l)},Ii.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ii.prototype.addPolygonRing=function(r,o,a,l,h){if(o===0&&r.length<fe.MINIMUM_VALID_SIZE)return null;var m=l,S=h;r.length>=fe.MINIMUM_VALID_SIZE&&ot.isCCW(r)&&(m=h,S=l,a=Ft.opposite(a));var C=this._curveBuilder.getRingCurve(r,a,o);this.addCurve(C,m,S)},Ii.prototype.add=function(r){if(r.isEmpty())return null;r instanceof re?this.addPolygon(r):r instanceof ut?this.addLineString(r):r instanceof te?this.addPoint(r):r instanceof ve?this.addCollection(r):r instanceof Kr?this.addCollection(r):r instanceof he?this.addCollection(r):r instanceof En&&this.addCollection(r)},Ii.prototype.isErodedCompletely=function(r,o){var a=r.getCoordinates();if(a.length<4)return o<0;if(a.length===4)return this.isTriangleErodedCompletely(a,o);var l=r.getEnvelopeInternal(),h=Math.min(l.getHeight(),l.getWidth());return o<0&&2*Math.abs(o)>h},Ii.prototype.addCollection=function(r){for(var o=0;o<r.getNumGeometries();o++){var a=r.getGeometryN(o);this.add(a)}},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var Pu=function(){};Pu.prototype.locate=function(r){},Pu.prototype.interfaces_=function(){return[]},Pu.prototype.getClass=function(){return Pu};var go=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var r=arguments[0];this._parent=r,this._atStart=!0,this._index=0,this._max=r.getNumGeometries()};go.prototype.next=function(){if(this._atStart)return this._atStart=!1,go.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new i;var r=this._parent.getGeometryN(this._index++);return r instanceof En?(this._subcollectionIterator=new go(r),this._subcollectionIterator.next()):r},go.prototype.remove=function(){throw new Error(this.getClass().getName())},go.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},go.prototype.interfaces_=function(){return[pt]},go.prototype.getClass=function(){return go},go.isAtomic=function(r){return!(r instanceof En)};var yi=function(){this._geom=null;var r=arguments[0];this._geom=r};yi.prototype.locate=function(r){return yi.locate(r,this._geom)},yi.prototype.interfaces_=function(){return[Pu]},yi.prototype.getClass=function(){return yi},yi.isPointInRing=function(r,o){return!!o.getEnvelopeInternal().intersects(r)&&ot.isPointInRing(r,o.getCoordinates())},yi.containsPointInPolygon=function(r,o){if(o.isEmpty())return!1;var a=o.getExteriorRing();if(!yi.isPointInRing(r,a))return!1;for(var l=0;l<o.getNumInteriorRing();l++){var h=o.getInteriorRingN(l);if(yi.isPointInRing(r,h))return!1}return!0},yi.containsPoint=function(r,o){if(o instanceof re)return yi.containsPointInPolygon(r,o);if(o instanceof En)for(var a=new go(o);a.hasNext();){var l=a.next();if(l!==o&&yi.containsPoint(r,l))return!0}return!1},yi.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:yi.containsPoint(r,o)?V.INTERIOR:V.EXTERIOR};var mr=function(){this._edgeMap=new y,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};mr.prototype.getNextCW=function(r){this.getEdges();var o=this._edgeList.indexOf(r),a=o-1;return o===0&&(a=this._edgeList.size()-1),this._edgeList.get(a)},mr.prototype.propagateSideLabels=function(r){for(var o=V.NONE,a=this.iterator();a.hasNext();){var l=a.next().getLabel();l.isArea(r)&&l.getLocation(r,Ft.LEFT)!==V.NONE&&(o=l.getLocation(r,Ft.LEFT))}if(o===V.NONE)return null;for(var h=o,m=this.iterator();m.hasNext();){var S=m.next(),C=S.getLabel();if(C.getLocation(r,Ft.ON)===V.NONE&&C.setLocation(r,Ft.ON,h),C.isArea(r)){var z=C.getLocation(r,Ft.LEFT),K=C.getLocation(r,Ft.RIGHT);if(K!==V.NONE){if(K!==h)throw new Go("side location conflict",S.getCoordinate());z===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+S.getCoordinate()+")"),h=z}else Pt.isTrue(C.getLocation(r,Ft.LEFT)===V.NONE,"found single null side"),C.setLocation(r,Ft.RIGHT,h),C.setLocation(r,Ft.LEFT,h)}}},mr.prototype.getCoordinate=function(){var r=this.iterator();return r.hasNext()?r.next().getCoordinate():null},mr.prototype.print=function(r){Ut.out.println("EdgeEndStar: "+this.getCoordinate());for(var o=this.iterator();o.hasNext();)o.next().print(r)},mr.prototype.isAreaLabelsConsistent=function(r){return this.computeEdgeEndLabels(r.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},mr.prototype.checkAreaLabelsConsistent=function(r){var o=this.getEdges();if(o.size()<=0)return!0;var a=o.size()-1,l=o.get(a).getLabel().getLocation(r,Ft.LEFT);Pt.isTrue(l!==V.NONE,"Found unlabelled area edge");for(var h=l,m=this.iterator();m.hasNext();){var S=m.next().getLabel();Pt.isTrue(S.isArea(r),"Found non-area edge");var C=S.getLocation(r,Ft.LEFT),z=S.getLocation(r,Ft.RIGHT);if(C===z||z!==h)return!1;h=C}return!0},mr.prototype.findIndex=function(r){this.iterator();for(var o=0;o<this._edgeList.size();o++)if(this._edgeList.get(o)===r)return o;return-1},mr.prototype.iterator=function(){return this.getEdges().iterator()},mr.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new O(this._edgeMap.values())),this._edgeList},mr.prototype.getLocation=function(r,o,a){return this._ptInAreaLocation[r]===V.NONE&&(this._ptInAreaLocation[r]=yi.locate(o,a[r].getGeometry())),this._ptInAreaLocation[r]},mr.prototype.toString=function(){var r=new vt;r.append("EdgeEndStar: "+this.getCoordinate()),r.append(`
5
+ `}[r]};var Gt=function r(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var o=arguments[0];this.x=o.x,this.y=o.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var a=arguments[0],l=arguments[1];this.x=a,this.y=l,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var h=arguments[0],m=arguments[1];this.x=h.y*m.w-m.y*h.w,this.y=m.x*h.w-h.x*m.w,this.w=h.x*m.y-m.x*h.y}else if(arguments[0]instanceof P&&arguments[1]instanceof P){var S=arguments[0],C=arguments[1];this.x=S.y-C.y,this.y=C.x-S.x,this.w=S.x*C.y-C.x*S.y}}else if(arguments.length===3){var z=arguments[0],K=arguments[1],mt=arguments[2];this.x=z,this.y=K,this.w=mt}else if(arguments.length===4){var yt=arguments[0],zt=arguments[1],qt=arguments[2],jt=arguments[3],ue=yt.y-zt.y,dn=zt.x-yt.x,Xn=yt.x*zt.y-zt.x*yt.y,Dr=qt.y-jt.y,So=jt.x-qt.x,vs=qt.x*jt.y-jt.x*qt.y;this.x=dn*vs-So*Xn,this.y=Dr*Xn-ue*vs,this.w=ue*So-Dr*dn}};Gt.prototype.getY=function(){var r=this.y/this.w;if(w.isNaN(r)||w.isInfinite(r))throw new $t;return r},Gt.prototype.getX=function(){var r=this.x/this.w;if(w.isNaN(r)||w.isInfinite(r))throw new $t;return r},Gt.prototype.getCoordinate=function(){var r=new P;return r.x=this.getX(),r.y=this.getY(),r},Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.intersection=function(r,o,a,l){var h=r.y-o.y,m=o.x-r.x,S=r.x*o.y-o.x*r.y,C=a.y-l.y,z=l.x-a.x,K=a.x*l.y-l.x*a.y,mt=h*z-C*m,yt=(m*K-z*S)/mt,zt=(C*S-h*K)/mt;if(w.isNaN(yt)||w.isInfinite(yt)||w.isNaN(zt)||w.isInfinite(zt))throw new $t;return new P(yt,zt)};var Ct=function r(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof P){var o=arguments[0];this.init(o.x,o.x,o.y,o.y)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.init(l.x,h.x,l.y,h.y)}else if(arguments.length===4){var m=arguments[0],S=arguments[1],C=arguments[2],z=arguments[3];this.init(m,S,C,z)}},ee={serialVersionUID:{configurable:!0}};Ct.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Ct.prototype.equals=function(r){if(!(r instanceof Ct))return!1;var o=r;return this.isNull()?o.isNull():this._maxx===o.getMaxX()&&this._maxy===o.getMaxY()&&this._minx===o.getMinX()&&this._miny===o.getMinY()},Ct.prototype.intersection=function(r){if(this.isNull()||r.isNull()||!this.intersects(r))return new Ct;var o=this._minx>r._minx?this._minx:r._minx,a=this._miny>r._miny?this._miny:r._miny,l=this._maxx<r._maxx?this._maxx:r._maxx,h=this._maxy<r._maxy?this._maxy:r._maxy;return new Ct(o,l,a,h)},Ct.prototype.isNull=function(){return this._maxx<this._minx},Ct.prototype.getMaxX=function(){return this._maxx},Ct.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];return this.covers(r.x,r.y)}if(arguments[0]instanceof Ct){var o=arguments[0];return!this.isNull()&&!o.isNull()&&o.getMinX()>=this._minx&&o.getMaxX()<=this._maxx&&o.getMinY()>=this._miny&&o.getMaxY()<=this._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&l>=this._miny&&l<=this._maxy}},Ct.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var r=arguments[0];return!this.isNull()&&!r.isNull()&&!(r._minx>this._maxx||r._maxx<this._minx||r._miny>this._maxy||r._maxy<this._miny)}if(arguments[0]instanceof P){var o=arguments[0];return this.intersects(o.x,o.y)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return!this.isNull()&&!(a>this._maxx||a<this._minx||l>this._maxy||l<this._miny)}},Ct.prototype.getMinY=function(){return this._miny},Ct.prototype.getMinX=function(){return this._minx},Ct.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];this.expandToInclude(r.x,r.y)}else if(arguments[0]instanceof Ct){var o=arguments[0];if(o.isNull())return null;this.isNull()?(this._minx=o.getMinX(),this._maxx=o.getMaxX(),this._miny=o.getMinY(),this._maxy=o.getMaxY()):(o._minx<this._minx&&(this._minx=o._minx),o._maxx>this._maxx&&(this._maxx=o._maxx),o._miny<this._miny&&(this._miny=o._miny),o._maxy>this._maxy&&(this._maxy=o._maxy))}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=l,this._maxy=l):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}},Ct.prototype.minExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),o=this.getHeight();return r<o?r:o},Ct.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Ct.prototype.compareTo=function(r){var o=r;return this.isNull()?o.isNull()?0:-1:o.isNull()?1:this._minx<o._minx?-1:this._minx>o._minx?1:this._miny<o._miny?-1:this._miny>o._miny?1:this._maxx<o._maxx?-1:this._maxx>o._maxx?1:this._maxy<o._maxy?-1:this._maxy>o._maxy?1:0},Ct.prototype.translate=function(r,o){if(this.isNull())return null;this.init(this.getMinX()+r,this.getMaxX()+r,this.getMinY()+o,this.getMaxY()+o)},Ct.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ct.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ct.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ct.prototype.maxExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),o=this.getHeight();return r>o?r:o},Ct.prototype.expandBy=function(){if(arguments.length===1){var r=arguments[0];this.expandBy(r,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=o,this._maxx+=o,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Ct.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var r=arguments[0];return this.covers(r)}if(arguments[0]instanceof P){var o=arguments[0];return this.covers(o)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.covers(a,l)}},Ct.prototype.centre=function(){return this.isNull()?null:new P((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ct.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof Ct){var o=arguments[0];this._minx=o._minx,this._maxx=o._maxx,this._miny=o._miny,this._maxy=o._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.init(a.x,l.x,a.y,l.y)}else if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3];h<m?(this._minx=h,this._maxx=m):(this._minx=m,this._maxx=h),S<C?(this._miny=S,this._maxy=C):(this._miny=C,this._maxy=S)}},Ct.prototype.getMaxY=function(){return this._maxy},Ct.prototype.distance=function(r){if(this.intersects(r))return 0;var o=0;this._maxx<r._minx?o=r._minx-this._maxx:this._minx>r._maxx&&(o=this._minx-r._maxx);var a=0;return this._maxy<r._miny?a=r._miny-this._maxy:this._miny>r._maxy&&(a=this._miny-r._maxy),o===0?a:a===0?o:Math.sqrt(o*o+a*a)},Ct.prototype.hashCode=function(){var r=17;return r=37*r+P.hashCode(this._minx),r=37*r+P.hashCode(this._maxx),r=37*r+P.hashCode(this._miny),r=37*r+P.hashCode(this._maxy)},Ct.prototype.interfaces_=function(){return[B,t]},Ct.prototype.getClass=function(){return Ct},Ct.intersects=function(){if(arguments.length===3){var r=arguments[0],o=arguments[1],a=arguments[2];return a.x>=(r.x<o.x?r.x:o.x)&&a.x<=(r.x>o.x?r.x:o.x)&&a.y>=(r.y<o.y?r.y:o.y)&&a.y<=(r.y>o.y?r.y:o.y)}if(arguments.length===4){var l=arguments[0],h=arguments[1],m=arguments[2],S=arguments[3],C=Math.min(m.x,S.x),z=Math.max(m.x,S.x),K=Math.min(l.x,h.x),mt=Math.max(l.x,h.x);return!(K>z)&&!(mt<C)&&(C=Math.min(m.y,S.y),z=Math.max(m.y,S.y),K=Math.min(l.y,h.y),mt=Math.max(l.y,h.y),!(K>z)&&!(mt<C))}},ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,ee);var Z={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},Dt=function(r){this.geometryFactory=r||new me};Dt.prototype.read=function(r){var o,a,l;r=r.replace(/[\n\r]/g," ");var h=Z.typeStr.exec(r);if(r.search("EMPTY")!==-1&&((h=Z.emptyTypeStr.exec(r))[2]=void 0),h&&(a=h[1].toLowerCase(),l=h[2],Nt[a]&&(o=Nt[a].apply(this,[l]))),o===void 0)throw new Error("Could not parse WKT "+r);return o},Dt.prototype.write=function(r){return this.extractGeometry(r)},Dt.prototype.extractGeometry=function(r){var o=r.getGeometryType().toLowerCase();if(!_t[o])return null;var a=o.toUpperCase();return r.isEmpty()?a+" EMPTY":a+"("+_t[o].apply(this,[r])+")"};var _t={coordinate:function(r){return r.x+" "+r.y},point:function(r){return _t.coordinate.call(this,r._coordinates._coordinates[0])},multipoint:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push("("+_t.point.apply(this,[r._geometries[a]])+")");return o.join(",")},linestring:function(r){for(var o=[],a=0,l=r._points._coordinates.length;a<l;++a)o.push(_t.coordinate.apply(this,[r._points._coordinates[a]]));return o.join(",")},linearring:function(r){for(var o=[],a=0,l=r._points._coordinates.length;a<l;++a)o.push(_t.coordinate.apply(this,[r._points._coordinates[a]]));return o.join(",")},multilinestring:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push("("+_t.linestring.apply(this,[r._geometries[a]])+")");return o.join(",")},polygon:function(r){var o=[];o.push("("+_t.linestring.apply(this,[r._shell])+")");for(var a=0,l=r._holes.length;a<l;++a)o.push("("+_t.linestring.apply(this,[r._holes[a]])+")");return o.join(",")},multipolygon:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push("("+_t.polygon.apply(this,[r._geometries[a]])+")");return o.join(",")},geometrycollection:function(r){for(var o=[],a=0,l=r._geometries.length;a<l;++a)o.push(this.extractGeometry(r._geometries[a]));return o.join(",")}},Nt={point:function(r){if(r===void 0)return this.geometryFactory.createPoint();var o=r.trim().split(Z.spaces);return this.geometryFactory.createPoint(new P(Number.parseFloat(o[0]),Number.parseFloat(o[1])))},multipoint:function(r){if(r===void 0)return this.geometryFactory.createMultiPoint();for(var o,a=r.trim().split(","),l=[],h=0,m=a.length;h<m;++h)o=a[h].replace(Z.trimParens,"$1"),l.push(Nt.point.apply(this,[o]));return this.geometryFactory.createMultiPoint(l)},linestring:function(r){if(r===void 0)return this.geometryFactory.createLineString();for(var o,a=r.trim().split(","),l=[],h=0,m=a.length;h<m;++h)o=a[h].trim().split(Z.spaces),l.push(new P(Number.parseFloat(o[0]),Number.parseFloat(o[1])));return this.geometryFactory.createLineString(l)},linearring:function(r){if(r===void 0)return this.geometryFactory.createLinearRing();for(var o,a=r.trim().split(","),l=[],h=0,m=a.length;h<m;++h)o=a[h].trim().split(Z.spaces),l.push(new P(Number.parseFloat(o[0]),Number.parseFloat(o[1])));return this.geometryFactory.createLinearRing(l)},multilinestring:function(r){if(r===void 0)return this.geometryFactory.createMultiLineString();for(var o,a=r.trim().split(Z.parenComma),l=[],h=0,m=a.length;h<m;++h)o=a[h].replace(Z.trimParens,"$1"),l.push(Nt.linestring.apply(this,[o]));return this.geometryFactory.createMultiLineString(l)},polygon:function(r){if(r===void 0)return this.geometryFactory.createPolygon();for(var o,a,l,h,m=r.trim().split(Z.parenComma),S=[],C=0,z=m.length;C<z;++C)o=m[C].replace(Z.trimParens,"$1"),a=Nt.linestring.apply(this,[o]),l=this.geometryFactory.createLinearRing(a._points),C===0?h=l:S.push(l);return this.geometryFactory.createPolygon(h,S)},multipolygon:function(r){if(r===void 0)return this.geometryFactory.createMultiPolygon();for(var o,a=r.trim().split(Z.doubleParenComma),l=[],h=0,m=a.length;h<m;++h)o=a[h].replace(Z.trimParens,"$1"),l.push(Nt.polygon.apply(this,[o]));return this.geometryFactory.createMultiPolygon(l)},geometrycollection:function(r){if(r===void 0)return this.geometryFactory.createGeometryCollection();for(var o=(r=r.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),a=[],l=0,h=o.length;l<h;++l)a.push(this.read(o[l]));return this.geometryFactory.createGeometryCollection(a)}},wt=function(r){this.parser=new Dt(r)};wt.prototype.write=function(r){return this.parser.write(r)},wt.toLineString=function(r,o){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+o.x+" "+o.y+" )"};var Ht=function(r){function o(a){r.call(this,a),this.name="RuntimeException",this.message=a,this.stack=new r().stack}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o}(Error),Xt=function(r){function o(){if(r.call(this),arguments.length===0)r.call(this);else if(arguments.length===1){var a=arguments[0];r.call(this,a)}}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Ht),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.shouldNeverReachHere=function(){if(arguments.length===0)Pt.shouldNeverReachHere(null);else if(arguments.length===1){var r=arguments[0];throw new Xt("Should never reach here"+(r!==null?": "+r:""))}},Pt.isTrue=function(){var r,o;if(arguments.length===1)r=arguments[0],Pt.isTrue(r,null);else if(arguments.length===2&&(r=arguments[0],o=arguments[1],!r))throw o===null?new Xt:new Xt(o)},Pt.equals=function(){var r,o,a;if(arguments.length===2)r=arguments[0],o=arguments[1],Pt.equals(r,o,null);else if(arguments.length===3&&(r=arguments[0],o=arguments[1],a=arguments[2],!o.equals(r)))throw new Xt("Expected "+r+" but encountered "+o+(a!==null?": "+a:""))};var ne=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new P,this._intPt[1]=new P,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Y={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ne.prototype.getIndexAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intLineIndex[r][o]},ne.prototype.getTopologySummary=function(){var r=new vt;return this.isEndPoint()&&r.append(" endpoint"),this._isProper&&r.append(" proper"),this.isCollinear()&&r.append(" collinear"),r.toString()},ne.prototype.computeIntersection=function(r,o,a,l){this._inputLines[0][0]=r,this._inputLines[0][1]=o,this._inputLines[1][0]=a,this._inputLines[1][1]=l,this._result=this.computeIntersect(r,o,a,l)},ne.prototype.getIntersectionNum=function(){return this._result},ne.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var r=arguments[0];this.getEdgeDistance(r,0)>this.getEdgeDistance(r,1)?(this._intLineIndex[r][0]=0,this._intLineIndex[r][1]=1):(this._intLineIndex[r][0]=1,this._intLineIndex[r][1]=0)}},ne.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ne.prototype.setPrecisionModel=function(r){this._precisionModel=r},ne.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var r=arguments[0],o=0;o<this._result;o++)if(!this._intPt[o].equals2D(this._inputLines[r][0])&&!this._intPt[o].equals2D(this._inputLines[r][1]))return!0;return!1}},ne.prototype.getIntersection=function(r){return this._intPt[r]},ne.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ne.prototype.hasIntersection=function(){return this._result!==ne.NO_INTERSECTION},ne.prototype.getEdgeDistance=function(r,o){return ne.computeEdgeDistance(this._intPt[o],this._inputLines[r][0],this._inputLines[r][1])},ne.prototype.isCollinear=function(){return this._result===ne.COLLINEAR_INTERSECTION},ne.prototype.toString=function(){return wt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+wt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ne.prototype.getEndpoint=function(r,o){return this._inputLines[r][o]},ne.prototype.isIntersection=function(r){for(var o=0;o<this._result;o++)if(this._intPt[o].equals2D(r))return!0;return!1},ne.prototype.getIntersectionAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[r][o]]},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.computeEdgeDistance=function(r,o,a){var l=Math.abs(a.x-o.x),h=Math.abs(a.y-o.y),m=-1;if(r.equals(o))m=0;else if(r.equals(a))m=l>h?l:h;else{var S=Math.abs(r.x-o.x),C=Math.abs(r.y-o.y);(m=l>h?S:C)!==0||r.equals(o)||(m=Math.max(S,C))}return Pt.isTrue(!(m===0&&!r.equals(o)),"Bad distance calculation"),m},ne.nonRobustComputeEdgeDistance=function(r,o,a){var l=r.x-o.x,h=r.y-o.y,m=Math.sqrt(l*l+h*h);return Pt.isTrue(!(m===0&&!r.equals(o)),"Invalid distance calculation"),m},Y.DONT_INTERSECT.get=function(){return 0},Y.DO_INTERSECT.get=function(){return 1},Y.COLLINEAR.get=function(){return 2},Y.NO_INTERSECTION.get=function(){return 0},Y.POINT_INTERSECTION.get=function(){return 1},Y.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ne,Y);var N=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.isInSegmentEnvelopes=function(a){var l=new Ct(this._inputLines[0][0],this._inputLines[0][1]),h=new Ct(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(a)&&h.contains(a)},o.prototype.computeIntersection=function(){if(arguments.length!==3)return r.prototype.computeIntersection.apply(this,arguments);var a=arguments[0],l=arguments[1],h=arguments[2];if(this._isProper=!1,Ct.intersects(l,h,a)&&ot.orientationIndex(l,h,a)===0&&ot.orientationIndex(h,l,a)===0)return this._isProper=!0,(a.equals(l)||a.equals(h))&&(this._isProper=!1),this._result=r.POINT_INTERSECTION,null;this._result=r.NO_INTERSECTION},o.prototype.normalizeToMinimum=function(a,l,h,m,S){S.x=this.smallestInAbsValue(a.x,l.x,h.x,m.x),S.y=this.smallestInAbsValue(a.y,l.y,h.y,m.y),a.x-=S.x,a.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,m.x-=S.x,m.y-=S.y},o.prototype.safeHCoordinateIntersection=function(a,l,h,m){var S=null;try{S=Gt.intersection(a,l,h,m)}catch(C){if(!(C instanceof $t))throw C;S=o.nearestEndpoint(a,l,h,m)}return S},o.prototype.intersection=function(a,l,h,m){var S=this.intersectionWithNormalization(a,l,h,m);return this.isInSegmentEnvelopes(S)||(S=new P(o.nearestEndpoint(a,l,h,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(S),S},o.prototype.smallestInAbsValue=function(a,l,h,m){var S=a,C=Math.abs(S);return Math.abs(l)<C&&(S=l,C=Math.abs(l)),Math.abs(h)<C&&(S=h,C=Math.abs(h)),Math.abs(m)<C&&(S=m),S},o.prototype.checkDD=function(a,l,h,m,S){var C=It.intersection(a,l,h,m),z=this.isInSegmentEnvelopes(C);Ut.out.println("DD in env = "+z+" --------------------- "+C),S.distance(C)>1e-4&&Ut.out.println("Distance = "+S.distance(C))},o.prototype.intersectionWithNormalization=function(a,l,h,m){var S=new P(a),C=new P(l),z=new P(h),K=new P(m),mt=new P;this.normalizeToEnvCentre(S,C,z,K,mt);var yt=this.safeHCoordinateIntersection(S,C,z,K);return yt.x+=mt.x,yt.y+=mt.y,yt},o.prototype.computeCollinearIntersection=function(a,l,h,m){var S=Ct.intersects(a,l,h),C=Ct.intersects(a,l,m),z=Ct.intersects(h,m,a),K=Ct.intersects(h,m,l);return S&&C?(this._intPt[0]=h,this._intPt[1]=m,r.COLLINEAR_INTERSECTION):z&&K?(this._intPt[0]=a,this._intPt[1]=l,r.COLLINEAR_INTERSECTION):S&&z?(this._intPt[0]=h,this._intPt[1]=a,!h.equals(a)||C||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):S&&K?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||C||z?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&z?(this._intPt[0]=m,this._intPt[1]=a,!m.equals(a)||S||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&K?(this._intPt[0]=m,this._intPt[1]=l,!m.equals(l)||S||z?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):r.NO_INTERSECTION},o.prototype.normalizeToEnvCentre=function(a,l,h,m,S){var C=a.x<l.x?a.x:l.x,z=a.y<l.y?a.y:l.y,K=a.x>l.x?a.x:l.x,mt=a.y>l.y?a.y:l.y,yt=h.x<m.x?h.x:m.x,zt=h.y<m.y?h.y:m.y,qt=h.x>m.x?h.x:m.x,jt=h.y>m.y?h.y:m.y,ue=((C>yt?C:yt)+(K<qt?K:qt))/2,dn=((z>zt?z:zt)+(mt<jt?mt:jt))/2;S.x=ue,S.y=dn,a.x-=S.x,a.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,m.x-=S.x,m.y-=S.y},o.prototype.computeIntersect=function(a,l,h,m){if(this._isProper=!1,!Ct.intersects(a,l,h,m))return r.NO_INTERSECTION;var S=ot.orientationIndex(a,l,h),C=ot.orientationIndex(a,l,m);if(S>0&&C>0||S<0&&C<0)return r.NO_INTERSECTION;var z=ot.orientationIndex(h,m,a),K=ot.orientationIndex(h,m,l);return z>0&&K>0||z<0&&K<0?r.NO_INTERSECTION:S===0&&C===0&&z===0&&K===0?this.computeCollinearIntersection(a,l,h,m):(S===0||C===0||z===0||K===0?(this._isProper=!1,a.equals2D(h)||a.equals2D(m)?this._intPt[0]=a:l.equals2D(h)||l.equals2D(m)?this._intPt[0]=l:S===0?this._intPt[0]=new P(h):C===0?this._intPt[0]=new P(m):z===0?this._intPt[0]=new P(a):K===0&&(this._intPt[0]=new P(l))):(this._isProper=!0,this._intPt[0]=this.intersection(a,l,h,m)),r.POINT_INTERSECTION)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.nearestEndpoint=function(a,l,h,m){var S=a,C=ot.distancePointLine(a,h,m),z=ot.distancePointLine(l,h,m);return z<C&&(C=z,S=l),(z=ot.distancePointLine(h,a,l))<C&&(C=z,S=h),(z=ot.distancePointLine(m,a,l))<C&&(C=z,S=m),S},o}(ne),xt=function(){};xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.orientationIndex=function(r,o,a){var l=o.x-r.x,h=o.y-r.y,m=a.x-o.x,S=a.y-o.y;return xt.signOfDet2x2(l,h,m,S)},xt.signOfDet2x2=function(r,o,a,l){var h=null,m=null,S=null;if(h=1,r===0||l===0)return o===0||a===0?0:o>0?a>0?-h:h:a>0?h:-h;if(o===0||a===0)return l>0?r>0?h:-h:r>0?-h:h;if(o>0?l>0?o<=l||(h=-h,m=r,r=a,a=m,m=o,o=l,l=m):o<=-l?(h=-h,a=-a,l=-l):(m=r,r=-a,a=m,m=o,o=-l,l=m):l>0?-o<=l?(h=-h,r=-r,o=-o):(m=-r,r=a,a=m,m=-o,o=l,l=m):o>=l?(r=-r,o=-o,a=-a,l=-l):(h=-h,m=-r,r=-a,a=m,m=-o,o=-l,l=m),r>0){if(!(a>0)||!(r<=a))return h}else{if(a>0||!(r>=a))return-h;h=-h,r=-r,a=-a}for(;;){if(S=Math.floor(a/r),a-=S*r,(l-=S*o)<0)return-h;if(l>o)return h;if(r>a+a){if(o<l+l)return h}else{if(o>l+l)return-h;a=r-a,l=o-l,h=-h}if(l===0)return a===0?0:-h;if(a===0||(S=Math.floor(r/a),r-=S*a,(o-=S*l)<0))return h;if(o>l)return-h;if(a>r+r){if(l<o+o)return-h}else{if(l>o+o)return h;r=a-r,o=l-o,h=-h}if(o===0)return r===0?0:h;if(r===0)return-h}};var St=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var r=arguments[0];this._p=r};St.prototype.countSegment=function(r,o){if(r.x<this._p.x&&o.x<this._p.x)return null;if(this._p.x===o.x&&this._p.y===o.y)return this._isPointOnSegment=!0,null;if(r.y===this._p.y&&o.y===this._p.y){var a=r.x,l=o.x;return a>l&&(a=o.x,l=r.x),this._p.x>=a&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(r.y>this._p.y&&o.y<=this._p.y||o.y>this._p.y&&r.y<=this._p.y){var h=r.x-this._p.x,m=r.y-this._p.y,S=o.x-this._p.x,C=o.y-this._p.y,z=xt.signOfDet2x2(h,m,S,C);if(z===0)return this._isPointOnSegment=!0,null;C<m&&(z=-z),z>0&&this._crossingCount++}},St.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},St.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},St.prototype.isOnSegment=function(){return this._isPointOnSegment},St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.locatePointInRing=function(){if(arguments[0]instanceof P&&$(arguments[1],nt)){for(var r=arguments[0],o=arguments[1],a=new St(r),l=new P,h=new P,m=1;m<o.size();m++)if(o.getCoordinate(m,l),o.getCoordinate(m-1,h),a.countSegment(l,h),a.isOnSegment())return a.getLocation();return a.getLocation()}if(arguments[0]instanceof P&&arguments[1]instanceof Array){for(var S=arguments[0],C=arguments[1],z=new St(S),K=1;K<C.length;K++){var mt=C[K],yt=C[K-1];if(z.countSegment(mt,yt),z.isOnSegment())return z.getLocation()}return z.getLocation()}};var ot=function(){},Lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.orientationIndex=function(r,o,a){return It.orientationIndex(r,o,a)},ot.signedArea=function(){if(arguments[0]instanceof Array){var r=arguments[0];if(r.length<3)return 0;for(var o=0,a=r[0].x,l=1;l<r.length-1;l++){var h=r[l].x-a,m=r[l+1].y;o+=h*(r[l-1].y-m)}return o/2}if($(arguments[0],nt)){var S=arguments[0],C=S.size();if(C<3)return 0;var z=new P,K=new P,mt=new P;S.getCoordinate(0,K),S.getCoordinate(1,mt);var yt=K.x;mt.x-=yt;for(var zt=0,qt=1;qt<C-1;qt++)z.y=K.y,K.x=mt.x,K.y=mt.y,S.getCoordinate(qt+1,mt),mt.x-=yt,zt+=K.x*(z.y-mt.y);return zt/2}},ot.distanceLineLine=function(r,o,a,l){if(r.equals(o))return ot.distancePointLine(r,a,l);if(a.equals(l))return ot.distancePointLine(l,r,o);var h=!1;if(Ct.intersects(r,o,a,l)){var m=(o.x-r.x)*(l.y-a.y)-(o.y-r.y)*(l.x-a.x);if(m===0)h=!0;else{var S=(r.y-a.y)*(l.x-a.x)-(r.x-a.x)*(l.y-a.y),C=((r.y-a.y)*(o.x-r.x)-(r.x-a.x)*(o.y-r.y))/m,z=S/m;(z<0||z>1||C<0||C>1)&&(h=!0)}}else h=!0;return h?gt.min(ot.distancePointLine(r,a,l),ot.distancePointLine(o,a,l),ot.distancePointLine(a,r,o),ot.distancePointLine(l,r,o)):0},ot.isPointInRing=function(r,o){return ot.locatePointInRing(r,o)!==V.EXTERIOR},ot.computeLength=function(r){var o=r.size();if(o<=1)return 0;var a=0,l=new P;r.getCoordinate(0,l);for(var h=l.x,m=l.y,S=1;S<o;S++){r.getCoordinate(S,l);var C=l.x,z=l.y,K=C-h,mt=z-m;a+=Math.sqrt(K*K+mt*mt),h=C,m=z}return a},ot.isCCW=function(r){var o=r.length-1;if(o<3)throw new T("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=r[0],l=0,h=1;h<=o;h++){var m=r[h];m.y>a.y&&(a=m,l=h)}var S=l;do(S-=1)<0&&(S=o);while(r[S].equals2D(a)&&S!==l);var C=l;do C=(C+1)%o;while(r[C].equals2D(a)&&C!==l);var z=r[S],K=r[C];if(z.equals2D(a)||K.equals2D(a)||z.equals2D(K))return!1;var mt=ot.computeOrientation(z,a,K),yt=!1;return yt=mt===0?z.x>K.x:mt>0,yt},ot.locatePointInRing=function(r,o){return St.locatePointInRing(r,o)},ot.distancePointLinePerpendicular=function(r,o,a){var l=(a.x-o.x)*(a.x-o.x)+(a.y-o.y)*(a.y-o.y),h=((o.y-r.y)*(a.x-o.x)-(o.x-r.x)*(a.y-o.y))/l;return Math.abs(h)*Math.sqrt(l)},ot.computeOrientation=function(r,o,a){return ot.orientationIndex(r,o,a)},ot.distancePointLine=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];if(o.length===0)throw new T("Line array must contain at least one vertex");for(var a=r.distance(o[0]),l=0;l<o.length-1;l++){var h=ot.distancePointLine(r,o[l],o[l+1]);h<a&&(a=h)}return a}if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];if(S.x===C.x&&S.y===C.y)return m.distance(S);var z=(C.x-S.x)*(C.x-S.x)+(C.y-S.y)*(C.y-S.y),K=((m.x-S.x)*(C.x-S.x)+(m.y-S.y)*(C.y-S.y))/z;if(K<=0)return m.distance(S);if(K>=1)return m.distance(C);var mt=((S.y-m.y)*(C.x-S.x)-(S.x-m.x)*(C.y-S.y))/z;return Math.abs(mt)*Math.sqrt(z)}},ot.isOnLine=function(r,o){for(var a=new N,l=1;l<o.length;l++){var h=o[l-1],m=o[l];if(a.computeIntersection(r,h,m),a.hasIntersection())return!0}return!1},Lt.CLOCKWISE.get=function(){return-1},Lt.RIGHT.get=function(){return ot.CLOCKWISE},Lt.COUNTERCLOCKWISE.get=function(){return 1},Lt.LEFT.get=function(){return ot.COUNTERCLOCKWISE},Lt.COLLINEAR.get=function(){return 0},Lt.STRAIGHT.get=function(){return ot.COLLINEAR},Object.defineProperties(ot,Lt);var ce=function(){};ce.prototype.filter=function(r){},ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Rt=function(){var r=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=r,this._SRID=r.getSRID()},Bt={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};Rt.prototype.isGeometryCollection=function(){return this.getSortIndex()===Rt.SORTINDEX_GEOMETRYCOLLECTION},Rt.prototype.getFactory=function(){return this._factory},Rt.prototype.getGeometryN=function(r){return this},Rt.prototype.getArea=function(){return 0},Rt.prototype.isRectangle=function(){return!1},Rt.prototype.equals=function(){if(arguments[0]instanceof Rt){var r=arguments[0];return r!==null&&this.equalsTopo(r)}if(arguments[0]instanceof Object){var o=arguments[0];if(!(o instanceof Rt))return!1;var a=o;return this.equalsExact(a)}},Rt.prototype.equalsExact=function(r){return this===r||this.equalsExact(r,0)},Rt.prototype.geometryChanged=function(){this.apply(Rt.geometryChangedFilter)},Rt.prototype.geometryChangedAction=function(){this._envelope=null},Rt.prototype.equalsNorm=function(r){return r!==null&&this.norm().equalsExact(r.norm())},Rt.prototype.getLength=function(){return 0},Rt.prototype.getNumGeometries=function(){return 1},Rt.prototype.compareTo=function(){if(arguments.length===1){var r=arguments[0],o=r;return this.getSortIndex()!==o.getSortIndex()?this.getSortIndex()-o.getSortIndex():this.isEmpty()&&o.isEmpty()?0:this.isEmpty()?-1:o.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.getSortIndex()!==a.getSortIndex()?this.getSortIndex()-a.getSortIndex():this.isEmpty()&&a.isEmpty()?0:this.isEmpty()?-1:a.isEmpty()?1:this.compareToSameClass(a,l)}},Rt.prototype.getUserData=function(){return this._userData},Rt.prototype.getSRID=function(){return this._SRID},Rt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Rt.prototype.checkNotGeometryCollection=function(r){if(r.getSortIndex()===Rt.SORTINDEX_GEOMETRYCOLLECTION)throw new T("This method does not support GeometryCollection arguments")},Rt.prototype.equal=function(r,o,a){return a===0?r.equals(o):r.distance(o)<=a},Rt.prototype.norm=function(){var r=this.copy();return r.normalize(),r},Rt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Rt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Ct(this._envelope)},Rt.prototype.setSRID=function(r){this._SRID=r},Rt.prototype.setUserData=function(r){this._userData=r},Rt.prototype.compare=function(r,o){for(var a=r.iterator(),l=o.iterator();a.hasNext()&&l.hasNext();){var h=a.next(),m=l.next(),S=h.compareTo(m);if(S!==0)return S}return a.hasNext()?1:l.hasNext()?-1:0},Rt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Rt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Rt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Rt.SORTINDEX_MULTIPOINT||this.getSortIndex()===Rt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Rt.SORTINDEX_MULTIPOLYGON},Rt.prototype.interfaces_=function(){return[U,B,t]},Rt.prototype.getClass=function(){return Rt},Rt.hasNonEmptyElements=function(r){for(var o=0;o<r.length;o++)if(!r[o].isEmpty())return!0;return!1},Rt.hasNullElements=function(r){for(var o=0;o<r.length;o++)if(r[o]===null)return!0;return!1},Bt.serialVersionUID.get=function(){return 8763622679187377e3},Bt.SORTINDEX_POINT.get=function(){return 0},Bt.SORTINDEX_MULTIPOINT.get=function(){return 1},Bt.SORTINDEX_LINESTRING.get=function(){return 2},Bt.SORTINDEX_LINEARRING.get=function(){return 3},Bt.SORTINDEX_MULTILINESTRING.get=function(){return 4},Bt.SORTINDEX_POLYGON.get=function(){return 5},Bt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Bt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Bt.geometryChangedFilter.get=function(){return Wt},Object.defineProperties(Rt,Bt);var Wt=function(){};Wt.interfaces_=function(){return[ce]},Wt.filter=function(r){r.geometryChangedAction()};var j=function(){};j.prototype.filter=function(r){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var b=function(){},I={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};b.prototype.isInBoundary=function(r){},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},I.Mod2BoundaryNodeRule.get=function(){return F},I.EndPointBoundaryNodeRule.get=function(){return k},I.MultiValentEndPointBoundaryNodeRule.get=function(){return G},I.MonoValentEndPointBoundaryNodeRule.get=function(){return rt},I.MOD2_BOUNDARY_RULE.get=function(){return new F},I.ENDPOINT_BOUNDARY_RULE.get=function(){return new k},I.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new G},I.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new rt},I.OGC_SFS_BOUNDARY_RULE.get=function(){return b.MOD2_BOUNDARY_RULE},Object.defineProperties(b,I);var F=function(){};F.prototype.isInBoundary=function(r){return r%2==1},F.prototype.interfaces_=function(){return[b]},F.prototype.getClass=function(){return F};var k=function(){};k.prototype.isInBoundary=function(r){return r>0},k.prototype.interfaces_=function(){return[b]},k.prototype.getClass=function(){return k};var G=function(){};G.prototype.isInBoundary=function(r){return r>1},G.prototype.interfaces_=function(){return[b]},G.prototype.getClass=function(){return G};var rt=function(){};rt.prototype.isInBoundary=function(r){return r===1},rt.prototype.interfaces_=function(){return[b]},rt.prototype.getClass=function(){return rt};var tt=function(){};tt.prototype.add=function(){},tt.prototype.addAll=function(){},tt.prototype.isEmpty=function(){},tt.prototype.iterator=function(){},tt.prototype.size=function(){},tt.prototype.toArray=function(){},tt.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var pt=function(){};pt.prototype.hasNext=function(){},pt.prototype.next=function(){},pt.prototype.remove=function(){};var ht=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.get=function(){},o.prototype.set=function(){},o.prototype.isEmpty=function(){},o}(tt);(i.prototype=new Error).name="NoSuchElementException";var O=function(r){function o(){r.call(this),this.array_=[],arguments[0]instanceof tt&&this.addAll(arguments[0])}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.ensureCapacity=function(){},o.prototype.interfaces_=function(){return[r,tt]},o.prototype.add=function(a){return arguments.length===1?this.array_.push(a):this.array_.splice(arguments[0],arguments[1]),!0},o.prototype.clear=function(){this.array_=[]},o.prototype.addAll=function(a){for(var l=a.iterator();l.hasNext();)this.add(l.next());return!0},o.prototype.set=function(a,l){var h=this.array_[a];return this.array_[a]=l,h},o.prototype.iterator=function(){return new Q(this)},o.prototype.get=function(a){if(a<0||a>=this.size())throw new e;return this.array_[a]},o.prototype.isEmpty=function(){return this.array_.length===0},o.prototype.size=function(){return this.array_.length},o.prototype.toArray=function(){for(var a=[],l=0,h=this.array_.length;l<h;l++)a.push(this.array_[l]);return a},o.prototype.remove=function(a){for(var l=!1,h=0,m=this.array_.length;h<m;h++)if(this.array_[h]===a){this.array_.splice(h,1),l=!0;break}return l},o}(ht),Q=function(r){function o(a){r.call(this),this.arrayList_=a,this.position_=0}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new i;return this.arrayList_.get(this.position_++)},o.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},o.prototype.set=function(a){return this.arrayList_.set(this.position_-1,a)},o.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},o}(pt),J=function(r){function o(){if(r.call(this),arguments.length!==0){if(arguments.length===1){var l=arguments[0];this.ensureCapacity(l.length),this.add(l,!0)}else if(arguments.length===2){var h=arguments[0],m=arguments[1];this.ensureCapacity(h.length),this.add(h,m)}}}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={coordArrayType:{configurable:!0}};return a.coordArrayType.get=function(){return new Array(0).fill(null)},o.prototype.getCoordinate=function(l){return this.get(l)},o.prototype.addAll=function(){if(arguments.length===2){for(var l=arguments[0],h=arguments[1],m=!1,S=l.iterator();S.hasNext();)this.add(S.next(),h),m=!0;return m}return r.prototype.addAll.apply(this,arguments)},o.prototype.clone=function(){for(var l=r.prototype.clone.call(this),h=0;h<this.size();h++)l.add(h,this.get(h).copy());return l},o.prototype.toCoordinateArray=function(){return this.toArray(o.coordArrayType)},o.prototype.add=function(){if(arguments.length===1){var l=arguments[0];r.prototype.add.call(this,l)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],m=arguments[1];return this.add(h,m,!0),!0}if(arguments[0]instanceof P&&typeof arguments[1]=="boolean"){var S=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(S))return null;r.prototype.add.call(this,S)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var C=arguments[0],z=arguments[1];return this.add(C,z),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var K=arguments[0],mt=arguments[1];if(arguments[2])for(var yt=0;yt<K.length;yt++)this.add(K[yt],mt);else for(var zt=K.length-1;zt>=0;zt--)this.add(K[zt],mt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof P){var qt=arguments[0],jt=arguments[1];if(!arguments[2]){var ue=this.size();if(ue>0&&(qt>0&&this.get(qt-1).equals2D(jt)||qt<ue&&this.get(qt).equals2D(jt)))return null}r.prototype.add.call(this,qt,jt)}}else if(arguments.length===4){var dn=arguments[0],Xn=arguments[1],Dr=arguments[2],So=arguments[3],vs=1;Dr>So&&(vs=-1);for(var Bg=Dr;Bg!==So;Bg+=vs)this.add(dn[Bg],Xn);return!0}},o.prototype.closeRing=function(){this.size()>0&&this.add(new P(this.get(0)),!1)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},Object.defineProperties(o,a),o}(O),et=function(){},Tt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Tt.ForwardComparator.get=function(){return kt},Tt.BidirectionalComparator.get=function(){return ie},Tt.coordArrayType.get=function(){return new Array(0).fill(null)},et.prototype.interfaces_=function(){return[]},et.prototype.getClass=function(){return et},et.isRing=function(r){return!(r.length<4)&&!!r[0].equals2D(r[r.length-1])},et.ptNotInList=function(r,o){for(var a=0;a<r.length;a++){var l=r[a];if(et.indexOf(l,o)<0)return l}return null},et.scroll=function(r,o){var a=et.indexOf(o,r);if(a<0)return null;var l=new Array(r.length).fill(null);Ut.arraycopy(r,a,l,0,r.length-a),Ut.arraycopy(r,0,l,r.length-a,a),Ut.arraycopy(l,0,r,0,r.length)},et.equals=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];if(r===o)return!0;if(r===null||o===null||r.length!==o.length)return!1;for(var a=0;a<r.length;a++)if(!r[a].equals(o[a]))return!1;return!0}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var S=0;S<l.length;S++)if(m.compare(l[S],h[S])!==0)return!1;return!0}},et.intersection=function(r,o){for(var a=new J,l=0;l<r.length;l++)o.intersects(r[l])&&a.add(r[l],!0);return a.toCoordinateArray()},et.hasRepeatedPoints=function(r){for(var o=1;o<r.length;o++)if(r[o-1].equals(r[o]))return!0;return!1},et.removeRepeatedPoints=function(r){return et.hasRepeatedPoints(r)?new J(r,!1).toCoordinateArray():r},et.reverse=function(r){for(var o=r.length-1,a=Math.trunc(o/2),l=0;l<=a;l++){var h=r[l];r[l]=r[o-l],r[o-l]=h}},et.removeNull=function(r){for(var o=0,a=0;a<r.length;a++)r[a]!==null&&o++;var l=new Array(o).fill(null);if(o===0)return l;for(var h=0,m=0;m<r.length;m++)r[m]!==null&&(l[h++]=r[m]);return l},et.copyDeep=function(){if(arguments.length===1){for(var r=arguments[0],o=new Array(r.length).fill(null),a=0;a<r.length;a++)o[a]=new P(r[a]);return o}if(arguments.length===5)for(var l=arguments[0],h=arguments[1],m=arguments[2],S=arguments[3],C=arguments[4],z=0;z<C;z++)m[S+z]=new P(l[h+z])},et.isEqualReversed=function(r,o){for(var a=0;a<r.length;a++){var l=r[a],h=o[r.length-a-1];if(l.compareTo(h)!==0)return!1}return!0},et.envelope=function(r){for(var o=new Ct,a=0;a<r.length;a++)o.expandToInclude(r[a]);return o},et.toCoordinateArray=function(r){return r.toArray(et.coordArrayType)},et.atLeastNCoordinatesOrNothing=function(r,o){return o.length>=r?o:[]},et.indexOf=function(r,o){for(var a=0;a<o.length;a++)if(r.equals(o[a]))return a;return-1},et.increasingDirection=function(r){for(var o=0;o<Math.trunc(r.length/2);o++){var a=r.length-1-o,l=r[o].compareTo(r[a]);if(l!==0)return l}return 1},et.compare=function(r,o){for(var a=0;a<r.length&&a<o.length;){var l=r[a].compareTo(o[a]);if(l!==0)return l;a++}return a<o.length?-1:a<r.length?1:0},et.minCoordinate=function(r){for(var o=null,a=0;a<r.length;a++)(o===null||o.compareTo(r[a])>0)&&(o=r[a]);return o},et.extract=function(r,o,a){o=gt.clamp(o,0,r.length);var l=(a=gt.clamp(a,-1,r.length))-o+1;a<0&&(l=0),o>=r.length&&(l=0),a<o&&(l=0);var h=new Array(l).fill(null);if(l===0)return h;for(var m=0,S=o;S<=a;S++)h[m++]=r[S];return h},Object.defineProperties(et,Tt);var kt=function(){};kt.prototype.compare=function(r,o){return et.compare(r,o)},kt.prototype.interfaces_=function(){return[D]},kt.prototype.getClass=function(){return kt};var ie=function(){};ie.prototype.compare=function(r,o){var a=r,l=o;if(a.length<l.length)return-1;if(a.length>l.length)return 1;if(a.length===0)return 0;var h=et.compare(a,l);return et.isEqualReversed(a,l)?0:h},ie.prototype.OLDcompare=function(r,o){var a=r,l=o;if(a.length<l.length)return-1;if(a.length>l.length)return 1;if(a.length===0)return 0;for(var h=et.increasingDirection(a),m=et.increasingDirection(l),S=h>0?0:a.length-1,C=m>0?0:a.length-1,z=0;z<a.length;z++){var K=a[S].compareTo(l[C]);if(K!==0)return K;S+=h,C+=m}return 0},ie.prototype.interfaces_=function(){return[D]},ie.prototype.getClass=function(){return ie};var oe=function(){};oe.prototype.get=function(){},oe.prototype.put=function(){},oe.prototype.size=function(){},oe.prototype.values=function(){},oe.prototype.entrySet=function(){};var we=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o}(oe);(s.prototype=new Error).name="OperationNotSupported",(u.prototype=new tt).contains=function(){};var ye=function(r){function o(){r.call(this),this.array_=[],arguments[0]instanceof tt&&this.addAll(arguments[0])}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.contains=function(a){for(var l=0,h=this.array_.length;l<h;l++)if(this.array_[l]===a)return!0;return!1},o.prototype.add=function(a){return!this.contains(a)&&(this.array_.push(a),!0)},o.prototype.addAll=function(a){for(var l=a.iterator();l.hasNext();)this.add(l.next());return!0},o.prototype.remove=function(a){throw new Error},o.prototype.size=function(){return this.array_.length},o.prototype.isEmpty=function(){return this.array_.length===0},o.prototype.toArray=function(){for(var a=[],l=0,h=this.array_.length;l<h;l++)a.push(this.array_[l]);return a},o.prototype.iterator=function(){return new be(this)},o}(u),be=function(r){function o(a){r.call(this),this.hashSet_=a,this.position_=0}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new i;return this.hashSet_.array_[this.position_++]},o.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},o.prototype.remove=function(){throw new s},o}(pt),Ae=0;(y.prototype=new we).get=function(r){for(var o=this.root_;o!==null;){var a=r.compareTo(o.key);if(a<0)o=o.left;else{if(!(a>0))return o.value;o=o.right}}return null},y.prototype.put=function(r,o){if(this.root_===null)return this.root_={key:r,value:o,left:null,right:null,parent:null,color:Ae,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var a,l,h=this.root_;do if(a=h,(l=r.compareTo(h.key))<0)h=h.left;else{if(!(l>0)){var m=h.value;return h.value=o,m}h=h.right}while(h!==null);var S={key:r,left:null,right:null,value:o,parent:a,color:Ae,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?a.left=S:a.right=S,this.fixAfterInsertion(S),this.size_++,null},y.prototype.fixAfterInsertion=function(r){for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)if(f(r)===d(f(f(r)))){var o=g(f(f(r)));c(o)===1?(p(f(r),Ae),p(o,Ae),p(f(f(r)),1),r=f(f(r))):(r===g(f(r))&&(r=f(r),this.rotateLeft(r)),p(f(r),Ae),p(f(f(r)),1),this.rotateRight(f(f(r))))}else{var a=d(f(f(r)));c(a)===1?(p(f(r),Ae),p(a,Ae),p(f(f(r)),1),r=f(f(r))):(r===d(f(r))&&(r=f(r),this.rotateRight(r)),p(f(r),Ae),p(f(f(r)),1),this.rotateLeft(f(f(r))))}this.root_.color=Ae},y.prototype.values=function(){var r=new O,o=this.getFirstEntry();if(o!==null)for(r.add(o.value);(o=y.successor(o))!==null;)r.add(o.value);return r},y.prototype.entrySet=function(){var r=new ye,o=this.getFirstEntry();if(o!==null)for(r.add(o);(o=y.successor(o))!==null;)r.add(o);return r},y.prototype.rotateLeft=function(r){if(r!=null){var o=r.right;r.right=o.left,o.left!=null&&(o.left.parent=r),o.parent=r.parent,r.parent===null?this.root_=o:r.parent.left===r?r.parent.left=o:r.parent.right=o,o.left=r,r.parent=o}},y.prototype.rotateRight=function(r){if(r!=null){var o=r.left;r.left=o.right,o.right!=null&&(o.right.parent=r),o.parent=r.parent,r.parent===null?this.root_=o:r.parent.right===r?r.parent.right=o:r.parent.left=o,o.right=r,r.parent=o}},y.prototype.getFirstEntry=function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r},y.successor=function(r){if(r===null)return null;if(r.right!==null){for(var o=r.right;o.left!==null;)o=o.left;return o}for(var a=r.parent,l=r;a!==null&&l===a.right;)l=a,a=a.parent;return a},y.prototype.size=function(){return this.size_};var Bn=function(){};Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn},v.prototype=new u,(E.prototype=new v).contains=function(r){for(var o=0,a=this.array_.length;o<a;o++)if(this.array_[o].compareTo(r)===0)return!0;return!1},E.prototype.add=function(r){if(this.contains(r))return!1;for(var o=0,a=this.array_.length;o<a;o++)if(this.array_[o].compareTo(r)===1)return this.array_.splice(o,0,r),!0;return this.array_.push(r),!0},E.prototype.addAll=function(r){for(var o=r.iterator();o.hasNext();)this.add(o.next());return!0},E.prototype.remove=function(r){throw new s},E.prototype.size=function(){return this.array_.length},E.prototype.isEmpty=function(){return this.array_.length===0},E.prototype.toArray=function(){for(var r=[],o=0,a=this.array_.length;o<a;o++)r.push(this.array_[o]);return r},E.prototype.iterator=function(){return new dr(this)};var dr=function(r){this.treeSet_=r,this.position_=0};dr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new i;return this.treeSet_.array_[this.position_++]},dr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},dr.prototype.remove=function(){throw new s};var _n=function(){};_n.sort=function(){var r,o,a,l,h=arguments[0];if(arguments.length===1)l=function(S,C){return S.compareTo(C)},h.sort(l);else if(arguments.length===2)a=arguments[1],l=function(S,C){return a.compare(S,C)},h.sort(l);else if(arguments.length===3){(o=h.slice(arguments[1],arguments[2])).sort();var m=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length));for(h.splice(0,h.length),r=0;r<m.length;r++)h.push(m[r])}else if(arguments.length===4)for(o=h.slice(arguments[1],arguments[2]),a=arguments[3],l=function(S,C){return a.compare(S,C)},o.sort(l),m=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length)),h.splice(0,h.length),r=0;r<m.length;r++)h.push(m[r])},_n.asList=function(r){for(var o=new O,a=0,l=r.length;a<l;a++)o.add(r[a]);return o};var pe=function(){},xn={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};xn.P.get=function(){return 0},xn.L.get=function(){return 1},xn.A.get=function(){return 2},xn.FALSE.get=function(){return-1},xn.TRUE.get=function(){return-2},xn.DONTCARE.get=function(){return-3},xn.SYM_FALSE.get=function(){return"F"},xn.SYM_TRUE.get=function(){return"T"},xn.SYM_DONTCARE.get=function(){return"*"},xn.SYM_P.get=function(){return"0"},xn.SYM_L.get=function(){return"1"},xn.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(r){switch(r){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new T("Unknown dimension value: "+r)},pe.toDimensionValue=function(r){switch(lt.toUpperCase(r)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new T("Unknown dimension symbol: "+r)},Object.defineProperties(pe,xn);var Nn=function(){};Nn.prototype.filter=function(r){},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn};var Cn=function(){};Cn.prototype.filter=function(r,o){},Cn.prototype.isDone=function(){},Cn.prototype.isGeometryChanged=function(){},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var En=function(r){function o(l,h){if(r.call(this,h),this._geometries=l||[],r.hasNullElements(this._geometries))throw new T("geometries must not contain null elements")}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){for(var l=new Ct,h=0;h<this._geometries.length;h++)l.expandToInclude(this._geometries[h].getEnvelopeInternal());return l},o.prototype.getGeometryN=function(l){return this._geometries[l]},o.prototype.getSortIndex=function(){return r.SORTINDEX_GEOMETRYCOLLECTION},o.prototype.getCoordinates=function(){for(var l=new Array(this.getNumPoints()).fill(null),h=-1,m=0;m<this._geometries.length;m++)for(var S=this._geometries[m].getCoordinates(),C=0;C<S.length;C++)l[++h]=S[C];return l},o.prototype.getArea=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getArea();return l},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var m=l;if(this._geometries.length!==m._geometries.length)return!1;for(var S=0;S<this._geometries.length;S++)if(!this._geometries[S].equalsExact(m._geometries[S],h))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){for(var l=0;l<this._geometries.length;l++)this._geometries[l].normalize();_n.sort(this._geometries)},o.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},o.prototype.getBoundaryDimension=function(){for(var l=pe.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getBoundaryDimension());return l},o.prototype.getDimension=function(){for(var l=pe.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getDimension());return l},o.prototype.getLength=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getLength();return l},o.prototype.getNumPoints=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getNumPoints();return l},o.prototype.getNumGeometries=function(){return this._geometries.length},o.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),m=0;m<this._geometries.length;m++)h[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(h)},o.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=new E(_n.asList(this._geometries)),m=new E(_n.asList(l._geometries));return this.compare(h,m)}if(arguments.length===2){for(var S=arguments[0],C=arguments[1],z=S,K=this.getNumGeometries(),mt=z.getNumGeometries(),yt=0;yt<K&&yt<mt;){var zt=this.getGeometryN(yt),qt=z.getGeometryN(yt),jt=zt.compareToSameClass(qt,C);if(jt!==0)return jt;yt++}return yt<K?1:yt<mt?-1:0}},o.prototype.apply=function(){if($(arguments[0],j))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if($(arguments[0],Cn)){var m=arguments[0];if(this._geometries.length===0)return null;for(var S=0;S<this._geometries.length&&(this._geometries[S].apply(m),!m.isDone());S++);m.isGeometryChanged()&&this.geometryChanged()}else if($(arguments[0],Nn)){var C=arguments[0];C.filter(this);for(var z=0;z<this._geometries.length;z++)this._geometries[z].apply(C)}else if($(arguments[0],ce)){var K=arguments[0];K.filter(this);for(var mt=0;mt<this._geometries.length;mt++)this._geometries[mt].apply(K)}},o.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Pt.shouldNeverReachHere(),null},o.prototype.clone=function(){var l=r.prototype.clone.call(this);l._geometries=new Array(this._geometries.length).fill(null);for(var h=0;h<this._geometries.length;h++)l._geometries[h]=this._geometries[h].clone();return l},o.prototype.getGeometryType=function(){return"GeometryCollection"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.isEmpty=function(){for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isEmpty())return!1;return!0},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(o,a),o}(Rt),Kr=function(r){function o(){r.apply(this,arguments)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_MULTILINESTRING},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&r.prototype.equalsExact.call(this,l,h)}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},o.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isClosed())return!1;return!0},o.prototype.getDimension=function(){return 1},o.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),m=0;m<this._geometries.length;m++)h[l-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(h)},o.prototype.getBoundary=function(){return new Ar(this).getBoundary()},o.prototype.getGeometryType=function(){return"MultiLineString"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.interfaces_=function(){return[Bn]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(o,a),o}(En),Ar=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var r=arguments[0],o=b.MOD2_BOUNDARY_RULE;this._geom=r,this._geomFact=r.getFactory(),this._bnRule=o}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._geom=a,this._geomFact=a.getFactory(),this._bnRule=l}};Ar.prototype.boundaryMultiLineString=function(r){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var o=this.computeBoundaryCoordinates(r);return o.length===1?this._geomFact.createPoint(o[0]):this._geomFact.createMultiPointFromCoords(o)},Ar.prototype.getBoundary=function(){return this._geom instanceof ut?this.boundaryLineString(this._geom):this._geom instanceof Kr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Ar.prototype.boundaryLineString=function(r){return this._geom.isEmpty()?this.getEmptyMultiPoint():r.isClosed()?this._bnRule.isInBoundary(2)?r.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([r.getStartPoint(),r.getEndPoint()])},Ar.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Ar.prototype.computeBoundaryCoordinates=function(r){var o=new O;this._endpointMap=new y;for(var a=0;a<r.getNumGeometries();a++){var l=r.getGeometryN(a);l.getNumPoints()!==0&&(this.addEndpoint(l.getCoordinateN(0)),this.addEndpoint(l.getCoordinateN(l.getNumPoints()-1)))}for(var h=this._endpointMap.entrySet().iterator();h.hasNext();){var m=h.next(),S=m.getValue().count;this._bnRule.isInBoundary(S)&&o.add(m.getKey())}return et.toCoordinateArray(o)},Ar.prototype.addEndpoint=function(r){var o=this._endpointMap.get(r);o===null&&(o=new q,this._endpointMap.put(r,o)),o.count++},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar},Ar.getBoundary=function(){if(arguments.length===1){var r=arguments[0];return new Ar(r).getBoundary()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new Ar(o,a).getBoundary()}};var q=function(){this.count=null};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q};var at=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.chars=function(r,o){for(var a=new Array(o).fill(null),l=0;l<o;l++)a[l]=r;return String(a)},at.getStackTrace=function(){if(arguments.length===1){var r=arguments[0],o=new function(){},a=new function(){}(o);return r.printStackTrace(a),o.toString()}if(arguments.length===2){for(var l=arguments[0],h=arguments[1],m="",S=new function(){}(new function(){}(at.getStackTrace(l))),C=0;C<h;C++)try{m+=S.readLine()+at.NEWLINE}catch(z){if(!(z instanceof M))throw z;Pt.shouldNeverReachHere()}return m}},at.split=function(r,o){for(var a=o.length,l=new O,h=""+r,m=h.indexOf(o);m>=0;){var S=h.substring(0,m);l.add(S),m=(h=h.substring(m+a)).indexOf(o)}h.length>0&&l.add(h);for(var C=new Array(l.size()).fill(null),z=0;z<C.length;z++)C[z]=l.get(z);return C},at.toString=function(){if(arguments.length===1){var r=arguments[0];return at.SIMPLE_ORDINATE_FORMAT.format(r)}},at.spaces=function(r){return at.chars(" ",r)},Et.NEWLINE.get=function(){return Ut.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(at,Et);var dt=function(){};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.copyCoord=function(r,o,a,l){for(var h=Math.min(r.getDimension(),a.getDimension()),m=0;m<h;m++)a.setOrdinate(l,m,r.getOrdinate(o,m))},dt.isRing=function(r){var o=r.size();return o===0||!(o<=3)&&r.getOrdinate(0,nt.X)===r.getOrdinate(o-1,nt.X)&&r.getOrdinate(0,nt.Y)===r.getOrdinate(o-1,nt.Y)},dt.isEqual=function(r,o){var a=r.size();if(a!==o.size())return!1;for(var l=Math.min(r.getDimension(),o.getDimension()),h=0;h<a;h++)for(var m=0;m<l;m++){var S=r.getOrdinate(h,m),C=o.getOrdinate(h,m);if(r.getOrdinate(h,m)!==o.getOrdinate(h,m)&&(!w.isNaN(S)||!w.isNaN(C)))return!1}return!0},dt.extend=function(r,o,a){var l=r.create(a,o.getDimension()),h=o.size();if(dt.copy(o,0,l,0,h),h>0)for(var m=h;m<a;m++)dt.copy(o,h-1,l,m,1);return l},dt.reverse=function(r){for(var o=r.size()-1,a=Math.trunc(o/2),l=0;l<=a;l++)dt.swap(r,l,o-l)},dt.swap=function(r,o,a){if(o===a)return null;for(var l=0;l<r.getDimension();l++){var h=r.getOrdinate(o,l);r.setOrdinate(o,l,r.getOrdinate(a,l)),r.setOrdinate(a,l,h)}},dt.copy=function(r,o,a,l,h){for(var m=0;m<h;m++)dt.copyCoord(r,o+m,a,l+m)},dt.toString=function(){if(arguments.length===1){var r=arguments[0],o=r.size();if(o===0)return"()";var a=r.getDimension(),l=new vt;l.append("(");for(var h=0;h<o;h++){h>0&&l.append(" ");for(var m=0;m<a;m++)m>0&&l.append(","),l.append(at.toString(r.getOrdinate(h,m)))}return l.append(")"),l.toString()}},dt.ensureValidRing=function(r,o){var a=o.size();return a===0?o:a<=3?dt.createClosedRing(r,o,4):o.getOrdinate(0,nt.X)===o.getOrdinate(a-1,nt.X)&&o.getOrdinate(0,nt.Y)===o.getOrdinate(a-1,nt.Y)?o:dt.createClosedRing(r,o,a+1)},dt.createClosedRing=function(r,o,a){var l=r.create(a,o.getDimension()),h=o.size();dt.copy(o,0,l,0,h);for(var m=h;m<a;m++)dt.copy(o,0,l,m,1);return l};var ut=function(r){function o(l,h){r.call(this,h),this._points=null,this.init(l)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Ct:this._points.expandEnvelope(new Ct)},o.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},o.prototype.getSortIndex=function(){return r.SORTINDEX_LINESTRING},o.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var m=l;if(this._points.size()!==m._points.size())return!1;for(var S=0;S<this._points.size();S++)if(!this.equal(this._points.getCoordinate(S),m._points.getCoordinate(S),h))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){for(var l=0;l<Math.trunc(this._points.size()/2);l++){var h=this._points.size()-1-l;if(!this._points.getCoordinate(l).equals(this._points.getCoordinate(h)))return this._points.getCoordinate(l).compareTo(this._points.getCoordinate(h))>0&&dt.reverse(this._points),null}},o.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},o.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},o.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},o.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},o.prototype.getDimension=function(){return 1},o.prototype.getLength=function(){return ot.computeLength(this._points)},o.prototype.getNumPoints=function(){return this._points.size()},o.prototype.reverse=function(){var l=this._points.copy();return dt.reverse(l),this.getFactory().createLineString(l)},o.prototype.compareToSameClass=function(){if(arguments.length===1){for(var l=arguments[0],h=0,m=0;h<this._points.size()&&m<l._points.size();){var S=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(m));if(S!==0)return S;h++,m++}return h<this._points.size()?1:m<l._points.size()?-1:0}if(arguments.length===2){var C=arguments[0];return arguments[1].compare(this._points,C._points)}},o.prototype.apply=function(){if($(arguments[0],j))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if($(arguments[0],Cn)){var m=arguments[0];if(this._points.size()===0)return null;for(var S=0;S<this._points.size()&&(m.filter(this._points,S),!m.isDone());S++);m.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Nn)?arguments[0].filter(this):$(arguments[0],ce)&&arguments[0].filter(this)},o.prototype.getBoundary=function(){return new Ar(this).getBoundary()},o.prototype.isEquivalentClass=function(l){return l instanceof o},o.prototype.clone=function(){var l=r.prototype.clone.call(this);return l._points=this._points.clone(),l},o.prototype.getCoordinateN=function(l){return this._points.getCoordinate(l)},o.prototype.getGeometryType=function(){return"LineString"},o.prototype.copy=function(){return new o(this._points.copy(),this._factory)},o.prototype.getCoordinateSequence=function(){return this._points},o.prototype.isEmpty=function(){return this._points.size()===0},o.prototype.init=function(l){if(l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),l.size()===1)throw new T("Invalid number of points in LineString (found "+l.size()+" - must be 0 or >= 2)");this._points=l},o.prototype.isCoordinate=function(l){for(var h=0;h<this._points.size();h++)if(this._points.getCoordinate(h).equals(l))return!0;return!1},o.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},o.prototype.getPointN=function(l){return this.getFactory().createPoint(this._points.getCoordinate(l))},o.prototype.interfaces_=function(){return[Bn]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(o,a),o}(Rt),Qt=function(){};Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt};var te=function(r){function o(l,h){r.call(this,h),this._coordinates=l||null,this.init(this._coordinates)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Ct;var l=new Ct;return l.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),l},o.prototype.getSortIndex=function(){return r.SORTINDEX_POINT},o.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&(!(!this.isEmpty()||!l.isEmpty())||this.isEmpty()===l.isEmpty()&&this.equal(l.getCoordinate(),this.getCoordinate(),h))}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){},o.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},o.prototype.getBoundaryDimension=function(){return pe.FALSE},o.prototype.getDimension=function(){return 0},o.prototype.getNumPoints=function(){return this.isEmpty()?0:1},o.prototype.reverse=function(){return this.copy()},o.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},o.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0];return this.getCoordinate().compareTo(l.getCoordinate())}if(arguments.length===2){var h=arguments[0];return arguments[1].compare(this._coordinates,h._coordinates)}},o.prototype.apply=function(){if($(arguments[0],j)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if($(arguments[0],Cn)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Nn)?arguments[0].filter(this):$(arguments[0],ce)&&arguments[0].filter(this)},o.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},o.prototype.clone=function(){var l=r.prototype.clone.call(this);return l._coordinates=this._coordinates.clone(),l},o.prototype.getGeometryType=function(){return"Point"},o.prototype.copy=function(){return new o(this._coordinates.copy(),this._factory)},o.prototype.getCoordinateSequence=function(){return this._coordinates},o.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},o.prototype.isEmpty=function(){return this._coordinates.size()===0},o.prototype.init=function(l){l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),Pt.isTrue(l.size()<=1),this._coordinates=l},o.prototype.isSimple=function(){return!0},o.prototype.interfaces_=function(){return[Qt]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(o,a),o}(Rt),le=function(){};le.prototype.interfaces_=function(){return[]},le.prototype.getClass=function(){return le};var re=function(r){function o(l,h,m){if(r.call(this,m),this._shell=null,this._holes=null,l===null&&(l=this.getFactory().createLinearRing()),h===null&&(h=[]),r.hasNullElements(h))throw new T("holes must not contain null elements");if(l.isEmpty()&&r.hasNonEmptyElements(h))throw new T("shell is empty but holes are not");this._shell=l,this._holes=h}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},o.prototype.getSortIndex=function(){return r.SORTINDEX_POLYGON},o.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var l=new Array(this.getNumPoints()).fill(null),h=-1,m=this._shell.getCoordinates(),S=0;S<m.length;S++)l[++h]=m[S];for(var C=0;C<this._holes.length;C++)for(var z=this._holes[C].getCoordinates(),K=0;K<z.length;K++)l[++h]=z[K];return l},o.prototype.getArea=function(){var l=0;l+=Math.abs(ot.signedArea(this._shell.getCoordinateSequence()));for(var h=0;h<this._holes.length;h++)l-=Math.abs(ot.signedArea(this._holes[h].getCoordinateSequence()));return l},o.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var l=this._shell.getCoordinateSequence(),h=this.getEnvelopeInternal(),m=0;m<5;m++){var S=l.getX(m);if(S!==h.getMinX()&&S!==h.getMaxX())return!1;var C=l.getY(m);if(C!==h.getMinY()&&C!==h.getMaxY())return!1}for(var z=l.getX(0),K=l.getY(0),mt=1;mt<=4;mt++){var yt=l.getX(mt),zt=l.getY(mt);if(yt!==z==(zt!==K))return!1;z=yt,K=zt}return!0},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var m=l,S=this._shell,C=m._shell;if(!S.equalsExact(C,h)||this._holes.length!==m._holes.length)return!1;for(var z=0;z<this._holes.length;z++)if(!this._holes[z].equalsExact(m._holes[z],h))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var l=0;l<this._holes.length;l++)this.normalize(this._holes[l],!1);_n.sort(this._holes)}else if(arguments.length===2){var h=arguments[0],m=arguments[1];if(h.isEmpty())return null;var S=new Array(h.getCoordinates().length-1).fill(null);Ut.arraycopy(h.getCoordinates(),0,S,0,S.length);var C=et.minCoordinate(h.getCoordinates());et.scroll(S,C),Ut.arraycopy(S,0,h.getCoordinates(),0,S.length),h.getCoordinates()[S.length]=S[0],ot.isCCW(h.getCoordinates())===m&&et.reverse(h.getCoordinates())}},o.prototype.getCoordinate=function(){return this._shell.getCoordinate()},o.prototype.getNumInteriorRing=function(){return this._holes.length},o.prototype.getBoundaryDimension=function(){return 1},o.prototype.getDimension=function(){return 2},o.prototype.getLength=function(){var l=0;l+=this._shell.getLength();for(var h=0;h<this._holes.length;h++)l+=this._holes[h].getLength();return l},o.prototype.getNumPoints=function(){for(var l=this._shell.getNumPoints(),h=0;h<this._holes.length;h++)l+=this._holes[h].getNumPoints();return l},o.prototype.reverse=function(){var l=this.copy();l._shell=this._shell.copy().reverse(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].copy().reverse();return l},o.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},o.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=this._shell,m=l._shell;return h.compareToSameClass(m)}if(arguments.length===2){var S=arguments[0],C=arguments[1],z=S,K=this._shell,mt=z._shell,yt=K.compareToSameClass(mt,C);if(yt!==0)return yt;for(var zt=this.getNumInteriorRing(),qt=z.getNumInteriorRing(),jt=0;jt<zt&&jt<qt;){var ue=this.getInteriorRingN(jt),dn=z.getInteriorRingN(jt),Xn=ue.compareToSameClass(dn,C);if(Xn!==0)return Xn;jt++}return jt<zt?1:jt<qt?-1:0}},o.prototype.apply=function(l){if($(l,j)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if($(l,Cn)){if(this._shell.apply(l),!l.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(l),!l.isDone());m++);l.isGeometryChanged()&&this.geometryChanged()}else if($(l,Nn))l.filter(this);else if($(l,ce)){l.filter(this),this._shell.apply(l);for(var S=0;S<this._holes.length;S++)this._holes[S].apply(l)}},o.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var l=new Array(this._holes.length+1).fill(null);l[0]=this._shell;for(var h=0;h<this._holes.length;h++)l[h+1]=this._holes[h];return l.length<=1?this.getFactory().createLinearRing(l[0].getCoordinateSequence()):this.getFactory().createMultiLineString(l)},o.prototype.clone=function(){var l=r.prototype.clone.call(this);l._shell=this._shell.clone(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].clone();return l},o.prototype.getGeometryType=function(){return"Polygon"},o.prototype.copy=function(){for(var l=this._shell.copy(),h=new Array(this._holes.length).fill(null),m=0;m<h.length;m++)h[m]=this._holes[m].copy();return new o(l,h,this._factory)},o.prototype.getExteriorRing=function(){return this._shell},o.prototype.isEmpty=function(){return this._shell.isEmpty()},o.prototype.getInteriorRingN=function(l){return this._holes[l]},o.prototype.interfaces_=function(){return[le]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(o,a),o}(Rt),ve=function(r){function o(){r.apply(this,arguments)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_MULTIPOINT},o.prototype.isValid=function(){return!0},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&r.prototype.equalsExact.call(this,l,h)}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.getCoordinate=function(){if(arguments.length===1){var l=arguments[0];return this._geometries[l].getCoordinate()}return r.prototype.getCoordinate.apply(this,arguments)},o.prototype.getBoundaryDimension=function(){return pe.FALSE},o.prototype.getDimension=function(){return 0},o.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},o.prototype.getGeometryType=function(){return"MultiPoint"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.interfaces_=function(){return[Qt]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(o,a),o}(En),fe=function(r){function o(l,h){l instanceof P&&h instanceof me&&(l=h.getCoordinateSequenceFactory().create(l)),r.call(this,l,h),this.validateConstruction()}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_LINEARRING},o.prototype.getBoundaryDimension=function(){return pe.FALSE},o.prototype.isClosed=function(){return!!this.isEmpty()||r.prototype.isClosed.call(this)},o.prototype.reverse=function(){var l=this._points.copy();return dt.reverse(l),this.getFactory().createLinearRing(l)},o.prototype.validateConstruction=function(){if(!this.isEmpty()&&!r.prototype.isClosed.call(this))throw new T("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<o.MINIMUM_VALID_SIZE)throw new T("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},o.prototype.getGeometryType=function(){return"LinearRing"},o.prototype.copy=function(){return new o(this._points.copy(),this._factory)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},a.MINIMUM_VALID_SIZE.get=function(){return 4},a.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(o,a),o}(ut),he=function(r){function o(){r.apply(this,arguments)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={serialVersionUID:{configurable:!0}};return o.prototype.getSortIndex=function(){return Rt.SORTINDEX_MULTIPOLYGON},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&r.prototype.equalsExact.call(this,l,h)}return r.prototype.equalsExact.apply(this,arguments)},o.prototype.getBoundaryDimension=function(){return 1},o.prototype.getDimension=function(){return 2},o.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),m=0;m<this._geometries.length;m++)h[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(h)},o.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var l=new O,h=0;h<this._geometries.length;h++)for(var m=this._geometries[h].getBoundary(),S=0;S<m.getNumGeometries();S++)l.add(m.getGeometryN(S));var C=new Array(l.size()).fill(null);return this.getFactory().createMultiLineString(l.toArray(C))},o.prototype.getGeometryType=function(){return"MultiPolygon"},o.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new o(l,this._factory)},o.prototype.interfaces_=function(){return[le]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(o,a),o}(En),cn=function(r){this._factory=r||null,this._isUserDataCopied=!1},Tr={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};cn.prototype.setCopyUserData=function(r){this._isUserDataCopied=r},cn.prototype.edit=function(r,o){if(r===null)return null;var a=this.editInternal(r,o);return this._isUserDataCopied&&a.setUserData(r.getUserData()),a},cn.prototype.editInternal=function(r,o){return this._factory===null&&(this._factory=r.getFactory()),r instanceof En?this.editGeometryCollection(r,o):r instanceof re?this.editPolygon(r,o):r instanceof te?o.edit(r,this._factory):r instanceof ut?o.edit(r,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+r.getClass().getName()),null)},cn.prototype.editGeometryCollection=function(r,o){for(var a=o.edit(r,this._factory),l=new O,h=0;h<a.getNumGeometries();h++){var m=this.edit(a.getGeometryN(h),o);m===null||m.isEmpty()||l.add(m)}return a.getClass()===ve?this._factory.createMultiPoint(l.toArray([])):a.getClass()===Kr?this._factory.createMultiLineString(l.toArray([])):a.getClass()===he?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},cn.prototype.editPolygon=function(r,o){var a=o.edit(r,this._factory);if(a===null&&(a=this._factory.createPolygon(null)),a.isEmpty())return a;var l=this.edit(a.getExteriorRing(),o);if(l===null||l.isEmpty())return this._factory.createPolygon();for(var h=new O,m=0;m<a.getNumInteriorRing();m++){var S=this.edit(a.getInteriorRingN(m),o);S===null||S.isEmpty()||h.add(S)}return this._factory.createPolygon(l,h.toArray([]))},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.GeometryEditorOperation=function(){},Tr.NoOpGeometryOperation.get=function(){return qn},Tr.CoordinateOperation.get=function(){return hi},Tr.CoordinateSequenceOperation.get=function(){return wn},Object.defineProperties(cn,Tr);var qn=function(){};qn.prototype.edit=function(r,o){return r},qn.prototype.interfaces_=function(){return[cn.GeometryEditorOperation]},qn.prototype.getClass=function(){return qn};var hi=function(){};hi.prototype.edit=function(r,o){var a=this.editCoordinates(r.getCoordinates(),r);return a===null?r:r instanceof fe?o.createLinearRing(a):r instanceof ut?o.createLineString(a):r instanceof te?a.length>0?o.createPoint(a[0]):o.createPoint():r},hi.prototype.interfaces_=function(){return[cn.GeometryEditorOperation]},hi.prototype.getClass=function(){return hi};var wn=function(){};wn.prototype.edit=function(r,o){return r instanceof fe?o.createLinearRing(this.edit(r.getCoordinateSequence(),r)):r instanceof ut?o.createLineString(this.edit(r.getCoordinateSequence(),r)):r instanceof te?o.createPoint(this.edit(r.getCoordinateSequence(),r)):r},wn.prototype.interfaces_=function(){return[cn.GeometryEditorOperation]},wn.prototype.getClass=function(){return wn};var se=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var r=arguments[0];this._coordinates=new Array(r).fill(null);for(var o=0;o<r;o++)this._coordinates[o]=new P}else if($(arguments[0],nt)){var a=arguments[0];if(a===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=a.getDimension(),this._coordinates=new Array(a.size()).fill(null);for(var l=0;l<this._coordinates.length;l++)this._coordinates[l]=a.getCoordinateCopy(l)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var h=arguments[0],m=arguments[1];this._coordinates=h,this._dimension=m,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var S=arguments[0],C=arguments[1];this._coordinates=new Array(S).fill(null),this._dimension=C;for(var z=0;z<S;z++)this._coordinates[z]=new P}}},bu={serialVersionUID:{configurable:!0}};se.prototype.setOrdinate=function(r,o,a){switch(o){case nt.X:this._coordinates[r].x=a;break;case nt.Y:this._coordinates[r].y=a;break;case nt.Z:this._coordinates[r].z=a;break;default:throw new T("invalid ordinateIndex")}},se.prototype.size=function(){return this._coordinates.length},se.prototype.getOrdinate=function(r,o){switch(o){case nt.X:return this._coordinates[r].x;case nt.Y:return this._coordinates[r].y;case nt.Z:return this._coordinates[r].z}return w.NaN},se.prototype.getCoordinate=function(){if(arguments.length===1){var r=arguments[0];return this._coordinates[r]}if(arguments.length===2){var o=arguments[0],a=arguments[1];a.x=this._coordinates[o].x,a.y=this._coordinates[o].y,a.z=this._coordinates[o].z}},se.prototype.getCoordinateCopy=function(r){return new P(this._coordinates[r])},se.prototype.getDimension=function(){return this._dimension},se.prototype.getX=function(r){return this._coordinates[r].x},se.prototype.clone=function(){for(var r=new Array(this.size()).fill(null),o=0;o<this._coordinates.length;o++)r[o]=this._coordinates[o].clone();return new se(r,this._dimension)},se.prototype.expandEnvelope=function(r){for(var o=0;o<this._coordinates.length;o++)r.expandToInclude(this._coordinates[o]);return r},se.prototype.copy=function(){for(var r=new Array(this.size()).fill(null),o=0;o<this._coordinates.length;o++)r[o]=this._coordinates[o].copy();return new se(r,this._dimension)},se.prototype.toString=function(){if(this._coordinates.length>0){var r=new vt(17*this._coordinates.length);r.append("("),r.append(this._coordinates[0]);for(var o=1;o<this._coordinates.length;o++)r.append(", "),r.append(this._coordinates[o]);return r.append(")"),r.toString()}return"()"},se.prototype.getY=function(r){return this._coordinates[r].y},se.prototype.toCoordinateArray=function(){return this._coordinates},se.prototype.interfaces_=function(){return[nt,t]},se.prototype.getClass=function(){return se},bu.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(se,bu);var fn=function(){},fo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};fn.prototype.readResolve=function(){return fn.instance()},fn.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new se(r)}if($(arguments[0],nt)){var o=arguments[0];return new se(o)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new se(a):new se(a,l)}},fn.prototype.interfaces_=function(){return[W,t]},fn.prototype.getClass=function(){return fn},fn.instance=function(){return fn.instanceObject},fo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},fo.instanceObject.get=function(){return new fn},Object.defineProperties(fn,fo);var fc=function(r){function o(){r.call(this),this.map_=new Map}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.get=function(a){return this.map_.get(a)||null},o.prototype.put=function(a,l){return this.map_.set(a,l),l},o.prototype.values=function(){for(var a=new O,l=this.map_.values(),h=l.next();!h.done;)a.add(h.value),h=l.next();return a},o.prototype.entrySet=function(){var a=new ye;return this.map_.entries().forEach(function(l){return a.add(l)}),a},o.prototype.size=function(){return this.map_.size()},o}(oe),_e=function r(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Mn){var o=arguments[0];this._modelType=o,o===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var a=arguments[0];this._modelType=r.FIXED,this.setScale(a)}else if(arguments[0]instanceof r){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}},Pa={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};_e.prototype.equals=function(r){if(!(r instanceof _e))return!1;var o=r;return this._modelType===o._modelType&&this._scale===o._scale},_e.prototype.compareTo=function(r){var o=r,a=this.getMaximumSignificantDigits(),l=o.getMaximumSignificantDigits();return new it(a).compareTo(new it(l))},_e.prototype.getScale=function(){return this._scale},_e.prototype.isFloating=function(){return this._modelType===_e.FLOATING||this._modelType===_e.FLOATING_SINGLE},_e.prototype.getType=function(){return this._modelType},_e.prototype.toString=function(){var r="UNKNOWN";return this._modelType===_e.FLOATING?r="Floating":this._modelType===_e.FLOATING_SINGLE?r="Floating-Single":this._modelType===_e.FIXED&&(r="Fixed (Scale="+this.getScale()+")"),r},_e.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var r=arguments[0];return w.isNaN(r)||this._modelType===_e.FLOATING_SINGLE?r:this._modelType===_e.FIXED?Math.round(r*this._scale)/this._scale:r}if(arguments[0]instanceof P){var o=arguments[0];if(this._modelType===_e.FLOATING)return null;o.x=this.makePrecise(o.x),o.y=this.makePrecise(o.y)}},_e.prototype.getMaximumSignificantDigits=function(){var r=16;return this._modelType===_e.FLOATING?r=16:this._modelType===_e.FLOATING_SINGLE?r=6:this._modelType===_e.FIXED&&(r=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),r},_e.prototype.setScale=function(r){this._scale=Math.abs(r)},_e.prototype.interfaces_=function(){return[t,B]},_e.prototype.getClass=function(){return _e},_e.mostPrecise=function(r,o){return r.compareTo(o)>=0?r:o},Pa.serialVersionUID.get=function(){return 7777263578777804e3},Pa.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(_e,Pa);var Mn=function r(o){this._name=o||null,r.nameToTypeMap.put(o,this)},ho={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Mn.prototype.readResolve=function(){return Mn.nameToTypeMap.get(this._name)},Mn.prototype.toString=function(){return this._name},Mn.prototype.interfaces_=function(){return[t]},Mn.prototype.getClass=function(){return Mn},ho.serialVersionUID.get=function(){return-552860263173159e4},ho.nameToTypeMap.get=function(){return new fc},Object.defineProperties(Mn,ho),_e.Type=Mn,_e.FIXED=new Mn("FIXED"),_e.FLOATING=new Mn("FLOATING"),_e.FLOATING_SINGLE=new Mn("FLOATING SINGLE");var me=function r(){this._precisionModel=new _e,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?$(arguments[0],W)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof _e&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},pi={serialVersionUID:{configurable:!0}};me.prototype.toGeometry=function(r){return r.isNull()?this.createPoint(null):r.getMinX()===r.getMaxX()&&r.getMinY()===r.getMaxY()?this.createPoint(new P(r.getMinX(),r.getMinY())):r.getMinX()===r.getMaxX()||r.getMinY()===r.getMaxY()?this.createLineString([new P(r.getMinX(),r.getMinY()),new P(r.getMaxX(),r.getMaxY())]):this.createPolygon(this.createLinearRing([new P(r.getMinX(),r.getMinY()),new P(r.getMinX(),r.getMaxY()),new P(r.getMaxX(),r.getMaxY()),new P(r.getMaxX(),r.getMinY()),new P(r.getMinX(),r.getMinY())]),null)},me.prototype.createLineString=function(r){return r?r instanceof Array?new ut(this.getCoordinateSequenceFactory().create(r),this):$(r,nt)?new ut(r,this):void 0:new ut(this.getCoordinateSequenceFactory().create([]),this)},me.prototype.createMultiLineString=function(){if(arguments.length===0)return new Kr(null,this);if(arguments.length===1){var r=arguments[0];return new Kr(r,this)}},me.prototype.buildGeometry=function(r){for(var o=null,a=!1,l=!1,h=r.iterator();h.hasNext();){var m=h.next(),S=m.getClass();o===null&&(o=S),S!==o&&(a=!0),m.isGeometryCollectionOrDerived()&&(l=!0)}if(o===null)return this.createGeometryCollection();if(a||l)return this.createGeometryCollection(me.toGeometryArray(r));var C=r.iterator().next();if(r.size()>1){if(C instanceof re)return this.createMultiPolygon(me.toPolygonArray(r));if(C instanceof ut)return this.createMultiLineString(me.toLineStringArray(r));if(C instanceof te)return this.createMultiPoint(me.toPointArray(r));Pt.shouldNeverReachHere("Unhandled class: "+C.getClass().getName())}return C},me.prototype.createMultiPointFromCoords=function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)},me.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof P){var r=arguments[0];return this.createPoint(r!==null?this.getCoordinateSequenceFactory().create([r]):null)}if($(arguments[0],nt)){var o=arguments[0];return new te(o,this)}}},me.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},me.prototype.createPolygon=function(){if(arguments.length===0)return new re(null,null,this);if(arguments.length===1){if($(arguments[0],nt)){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Array){var o=arguments[0];return this.createPolygon(this.createLinearRing(o))}if(arguments[0]instanceof fe){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];return new re(l,h,this)}},me.prototype.getSRID=function(){return this._SRID},me.prototype.createGeometryCollection=function(){if(arguments.length===0)return new En(null,this);if(arguments.length===1){var r=arguments[0];return new En(r,this)}},me.prototype.createGeometry=function(r){return new cn(this).edit(r,{edit:function(){if(arguments.length===2){var o=arguments[0];return this._coordinateSequenceFactory.create(o)}}})},me.prototype.getPrecisionModel=function(){return this._precisionModel},me.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return this.createLinearRing(r!==null?this.getCoordinateSequenceFactory().create(r):null)}if($(arguments[0],nt)){var o=arguments[0];return new fe(o,this)}}},me.prototype.createMultiPolygon=function(){if(arguments.length===0)return new he(null,this);if(arguments.length===1){var r=arguments[0];return new he(r,this)}},me.prototype.createMultiPoint=function(){if(arguments.length===0)return new ve(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new ve(r,this)}if(arguments[0]instanceof Array){var o=arguments[0];return this.createMultiPoint(o!==null?this.getCoordinateSequenceFactory().create(o):null)}if($(arguments[0],nt)){var a=arguments[0];if(a===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(a.size()).fill(null),h=0;h<a.size();h++){var m=this.getCoordinateSequenceFactory().create(1,a.getDimension());dt.copy(a,h,m,0,1),l[h]=this.createPoint(m)}return this.createMultiPoint(l)}}},me.prototype.interfaces_=function(){return[t]},me.prototype.getClass=function(){return me},me.toMultiPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toGeometryArray=function(r){if(r===null)return null;var o=new Array(r.size()).fill(null);return r.toArray(o)},me.getDefaultCoordinateSequenceFactory=function(){return fn.instance()},me.toMultiLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toMultiPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toLinearRingArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.toPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},me.createPointFromInternalCoord=function(r,o){return o.getPrecisionModel().makePrecise(r),o.getFactory().createPoint(r)},pi.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(me,pi);var hc=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Au=function(r){this.geometryFactory=r||new me};Au.prototype.read=function(r){var o,a=(o=typeof r=="string"?JSON.parse(r):r).type;if(!di[a])throw new Error("Unknown GeoJSON type: "+o.type);return hc.indexOf(a)!==-1?di[a].apply(this,[o.coordinates]):a==="GeometryCollection"?di[a].apply(this,[o.geometries]):di[a].apply(this,[o])},Au.prototype.write=function(r){var o=r.getGeometryType();if(!zo[o])throw new Error("Geometry is not supported");return zo[o].apply(this,[r])};var di={Feature:function(r){var o={};for(var a in r)o[a]=r[a];if(r.geometry){var l=r.geometry.type;if(!di[l])throw new Error("Unknown GeoJSON type: "+r.type);o.geometry=this.read(r.geometry)}return r.bbox&&(o.bbox=di.bbox.apply(this,[r.bbox])),o},FeatureCollection:function(r){var o={};if(r.features){o.features=[];for(var a=0;a<r.features.length;++a)o.features.push(this.read(r.features[a]))}return r.bbox&&(o.bbox=this.parse.bbox.apply(this,[r.bbox])),o},coordinates:function(r){for(var o=[],a=0;a<r.length;++a){var l=r[a];o.push(new P(l[0],l[1]))}return o},bbox:function(r){return this.geometryFactory.createLinearRing([new P(r[0],r[1]),new P(r[2],r[1]),new P(r[2],r[3]),new P(r[0],r[3]),new P(r[0],r[1])])},Point:function(r){var o=new P(r[0],r[1]);return this.geometryFactory.createPoint(o)},MultiPoint:function(r){for(var o=[],a=0;a<r.length;++a)o.push(di.Point.apply(this,[r[a]]));return this.geometryFactory.createMultiPoint(o)},LineString:function(r){var o=di.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(o)},MultiLineString:function(r){for(var o=[],a=0;a<r.length;++a)o.push(di.LineString.apply(this,[r[a]]));return this.geometryFactory.createMultiLineString(o)},Polygon:function(r){for(var o=di.coordinates.apply(this,[r[0]]),a=this.geometryFactory.createLinearRing(o),l=[],h=1;h<r.length;++h){var m=r[h],S=di.coordinates.apply(this,[m]),C=this.geometryFactory.createLinearRing(S);l.push(C)}return this.geometryFactory.createPolygon(a,l)},MultiPolygon:function(r){for(var o=[],a=0;a<r.length;++a){var l=r[a];o.push(di.Polygon.apply(this,[l]))}return this.geometryFactory.createMultiPolygon(o)},GeometryCollection:function(r){for(var o=[],a=0;a<r.length;++a){var l=r[a];o.push(this.read(l))}return this.geometryFactory.createGeometryCollection(o)}},zo={coordinate:function(r){return[r.x,r.y]},Point:function(r){return{type:"Point",coordinates:zo.coordinate.apply(this,[r.getCoordinate()])}},MultiPoint:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=zo.Point.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiPoint",coordinates:o}},LineString:function(r){for(var o=[],a=r.getCoordinates(),l=0;l<a.length;++l){var h=a[l];o.push(zo.coordinate.apply(this,[h]))}return{type:"LineString",coordinates:o}},MultiLineString:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=zo.LineString.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiLineString",coordinates:o}},Polygon:function(r){var o=[],a=zo.LineString.apply(this,[r._shell]);o.push(a.coordinates);for(var l=0;l<r._holes.length;++l){var h=r._holes[l],m=zo.LineString.apply(this,[h]);o.push(m.coordinates)}return{type:"Polygon",coordinates:o}},MultiPolygon:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=zo.Polygon.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiPolygon",coordinates:o}},GeometryCollection:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=l.getGeometryType();o.push(zo[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:o}}},Cg=function(r){this.geometryFactory=r||new me,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Au(this.geometryFactory)};Cg.prototype.read=function(r){var o=this.parser.read(r);return this.precisionModel.getType()===_e.FIXED&&this.reducePrecision(o),o},Cg.prototype.reducePrecision=function(r){var o,a;if(r.coordinate)this.precisionModel.makePrecise(r.coordinate);else if(r.points)for(o=0,a=r.points.length;o<a;o++)this.precisionModel.makePrecise(r.points[o]);else if(r.geometries)for(o=0,a=r.geometries.length;o<a;o++)this.reducePrecision(r.geometries[o])};var y1=function(){this.parser=new Au(this.geometryFactory)};y1.prototype.write=function(r){return this.parser.write(r)};var Ft=function(){},Zf={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Ft.prototype.interfaces_=function(){return[]},Ft.prototype.getClass=function(){return Ft},Ft.opposite=function(r){return r===Ft.LEFT?Ft.RIGHT:r===Ft.RIGHT?Ft.LEFT:r},Zf.ON.get=function(){return 0},Zf.LEFT.get=function(){return 1},Zf.RIGHT.get=function(){return 2},Object.defineProperties(Ft,Zf),(A.prototype=new Error).name="EmptyStackException",(_.prototype=new ht).add=function(r){return this.array_.push(r),!0},_.prototype.get=function(r){if(r<0||r>=this.size())throw new Error;return this.array_[r]},_.prototype.push=function(r){return this.array_.push(r),r},_.prototype.pop=function(r){if(this.array_.length===0)throw new A;return this.array_.pop()},_.prototype.peek=function(){if(this.array_.length===0)throw new A;return this.array_[this.array_.length-1]},_.prototype.empty=function(){return this.array_.length===0},_.prototype.isEmpty=function(){return this.empty()},_.prototype.search=function(r){return this.array_.indexOf(r)},_.prototype.size=function(){return this.array_.length},_.prototype.toArray=function(){for(var r=[],o=0,a=this.array_.length;o<a;o++)r.push(this.array_[o]);return r};var ji=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};ji.prototype.getCoordinate=function(){return this._minCoord},ji.prototype.getRightmostSide=function(r,o){var a=this.getRightmostSideOfSegment(r,o);return a<0&&(a=this.getRightmostSideOfSegment(r,o-1)),a<0&&(this._minCoord=null,this.checkForRightmostCoordinate(r)),a},ji.prototype.findRightmostEdgeAtVertex=function(){var r=this._minDe.getEdge().getCoordinates();Pt.isTrue(this._minIndex>0&&this._minIndex<r.length,"rightmost point expected to be interior vertex of edge");var o=r[this._minIndex-1],a=r[this._minIndex+1],l=ot.computeOrientation(this._minCoord,a,o),h=!1;(o.y<this._minCoord.y&&a.y<this._minCoord.y&&l===ot.COUNTERCLOCKWISE||o.y>this._minCoord.y&&a.y>this._minCoord.y&&l===ot.CLOCKWISE)&&(h=!0),h&&(this._minIndex=this._minIndex-1)},ji.prototype.getRightmostSideOfSegment=function(r,o){var a=r.getEdge().getCoordinates();if(o<0||o+1>=a.length||a[o].y===a[o+1].y)return-1;var l=Ft.LEFT;return a[o].y<a[o+1].y&&(l=Ft.RIGHT),l},ji.prototype.getEdge=function(){return this._orientedDe},ji.prototype.checkForRightmostCoordinate=function(r){for(var o=r.getEdge().getCoordinates(),a=0;a<o.length-1;a++)(this._minCoord===null||o[a].x>this._minCoord.x)&&(this._minDe=r,this._minIndex=a,this._minCoord=o[a])},ji.prototype.findRightmostEdgeAtNode=function(){var r=this._minDe.getNode().getEdges();this._minDe=r.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},ji.prototype.findEdge=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next();a.isForward()&&this.checkForRightmostCoordinate(a)}Pt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Ft.LEFT&&(this._orientedDe=this._minDe.getSym())},ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji};var Go=function(r){function o(a,l){r.call(this,o.msgWithCoord(a,l)),this.pt=l?new P(l):null,this.name="TopologyException"}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.getCoordinate=function(){return this.pt},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.msgWithCoord=function(a,l){return l?a:a+" [ "+l+" ]"},o}(Ht),Jf=function(){this.array_=[]};Jf.prototype.addLast=function(r){this.array_.push(r)},Jf.prototype.removeFirst=function(){return this.array_.shift()},Jf.prototype.isEmpty=function(){return this.array_.length===0};var Cr=function(){this._finder=null,this._dirEdgeList=new O,this._nodes=new O,this._rightMostCoord=null,this._env=null,this._finder=new ji};Cr.prototype.clearVisitedEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();)r.next().setVisited(!1)},Cr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Cr.prototype.computeNodeDepth=function(r){for(var o=null,a=r.getEdges().iterator();a.hasNext();){var l=a.next();if(l.isVisited()||l.getSym().isVisited()){o=l;break}}if(o===null)throw new Go("unable to find edge to compute depths at "+r.getCoordinate());r.getEdges().computeDepths(o);for(var h=r.getEdges().iterator();h.hasNext();){var m=h.next();m.setVisited(!0),this.copySymDepths(m)}},Cr.prototype.computeDepth=function(r){this.clearVisitedEdges();var o=this._finder.getEdge();o.setEdgeDepths(Ft.RIGHT,r),this.copySymDepths(o),this.computeDepths(o)},Cr.prototype.create=function(r){this.addReachable(r),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Cr.prototype.findResultEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();){var o=r.next();o.getDepth(Ft.RIGHT)>=1&&o.getDepth(Ft.LEFT)<=0&&!o.isInteriorAreaEdge()&&o.setInResult(!0)}},Cr.prototype.computeDepths=function(r){var o=new ye,a=new Jf,l=r.getNode();for(a.addLast(l),o.add(l),r.setVisited(!0);!a.isEmpty();){var h=a.removeFirst();o.add(h),this.computeNodeDepth(h);for(var m=h.getEdges().iterator();m.hasNext();){var S=m.next().getSym();if(!S.isVisited()){var C=S.getNode();o.contains(C)||(a.addLast(C),o.add(C))}}}},Cr.prototype.compareTo=function(r){var o=r;return this._rightMostCoord.x<o._rightMostCoord.x?-1:this._rightMostCoord.x>o._rightMostCoord.x?1:0},Cr.prototype.getEnvelope=function(){if(this._env===null){for(var r=new Ct,o=this._dirEdgeList.iterator();o.hasNext();)for(var a=o.next().getEdge().getCoordinates(),l=0;l<a.length-1;l++)r.expandToInclude(a[l]);this._env=r}return this._env},Cr.prototype.addReachable=function(r){var o=new _;for(o.add(r);!o.empty();){var a=o.pop();this.add(a,o)}},Cr.prototype.copySymDepths=function(r){var o=r.getSym();o.setDepth(Ft.LEFT,r.getDepth(Ft.RIGHT)),o.setDepth(Ft.RIGHT,r.getDepth(Ft.LEFT))},Cr.prototype.add=function(r,o){r.setVisited(!0),this._nodes.add(r);for(var a=r.getEdges().iterator();a.hasNext();){var l=a.next();this._dirEdgeList.add(l);var h=l.getSym().getNode();h.isVisited()||o.push(h)}},Cr.prototype.getNodes=function(){return this._nodes},Cr.prototype.getDirectedEdges=function(){return this._dirEdgeList},Cr.prototype.interfaces_=function(){return[B]},Cr.prototype.getClass=function(){return Cr};var vn=function r(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var o=arguments[0];this.init(o.length)}else if(Number.isInteger(arguments[0])){var a=arguments[0];this.init(1),this.location[Ft.ON]=a}else if(arguments[0]instanceof r){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var h=0;h<this.location.length;h++)this.location[h]=l.location[h]}}else if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];this.init(3),this.location[Ft.ON]=m,this.location[Ft.LEFT]=S,this.location[Ft.RIGHT]=C}};vn.prototype.setAllLocations=function(r){for(var o=0;o<this.location.length;o++)this.location[o]=r},vn.prototype.isNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]!==V.NONE)return!1;return!0},vn.prototype.setAllLocationsIfNull=function(r){for(var o=0;o<this.location.length;o++)this.location[o]===V.NONE&&(this.location[o]=r)},vn.prototype.isLine=function(){return this.location.length===1},vn.prototype.merge=function(r){if(r.location.length>this.location.length){var o=new Array(3).fill(null);o[Ft.ON]=this.location[Ft.ON],o[Ft.LEFT]=V.NONE,o[Ft.RIGHT]=V.NONE,this.location=o}for(var a=0;a<this.location.length;a++)this.location[a]===V.NONE&&a<r.location.length&&(this.location[a]=r.location[a])},vn.prototype.getLocations=function(){return this.location},vn.prototype.flip=function(){if(this.location.length<=1)return null;var r=this.location[Ft.LEFT];this.location[Ft.LEFT]=this.location[Ft.RIGHT],this.location[Ft.RIGHT]=r},vn.prototype.toString=function(){var r=new vt;return this.location.length>1&&r.append(V.toLocationSymbol(this.location[Ft.LEFT])),r.append(V.toLocationSymbol(this.location[Ft.ON])),this.location.length>1&&r.append(V.toLocationSymbol(this.location[Ft.RIGHT])),r.toString()},vn.prototype.setLocations=function(r,o,a){this.location[Ft.ON]=r,this.location[Ft.LEFT]=o,this.location[Ft.RIGHT]=a},vn.prototype.get=function(r){return r<this.location.length?this.location[r]:V.NONE},vn.prototype.isArea=function(){return this.location.length>1},vn.prototype.isAnyNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]===V.NONE)return!0;return!1},vn.prototype.setLocation=function(){if(arguments.length===1){var r=arguments[0];this.setLocation(Ft.ON,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this.location[o]=a}},vn.prototype.init=function(r){this.location=new Array(r).fill(null),this.setAllLocations(V.NONE)},vn.prototype.isEqualOnSide=function(r,o){return this.location[o]===r.location[o]},vn.prototype.allPositionsEqual=function(r){for(var o=0;o<this.location.length;o++)if(this.location[o]!==r)return!1;return!0},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn};var pn=function r(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var o=arguments[0];this.elt[0]=new vn(o),this.elt[1]=new vn(o)}else if(arguments[0]instanceof r){var a=arguments[0];this.elt[0]=new vn(a.elt[0]),this.elt[1]=new vn(a.elt[1])}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.elt[0]=new vn(V.NONE),this.elt[1]=new vn(V.NONE),this.elt[l].setLocation(h)}else if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];this.elt[0]=new vn(m,S,C),this.elt[1]=new vn(m,S,C)}else if(arguments.length===4){var z=arguments[0],K=arguments[1],mt=arguments[2],yt=arguments[3];this.elt[0]=new vn(V.NONE,V.NONE,V.NONE),this.elt[1]=new vn(V.NONE,V.NONE,V.NONE),this.elt[z].setLocations(K,mt,yt)}};pn.prototype.getGeometryCount=function(){var r=0;return this.elt[0].isNull()||r++,this.elt[1].isNull()||r++,r},pn.prototype.setAllLocations=function(r,o){this.elt[r].setAllLocations(o)},pn.prototype.isNull=function(r){return this.elt[r].isNull()},pn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var r=arguments[0];this.setAllLocationsIfNull(0,r),this.setAllLocationsIfNull(1,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this.elt[o].setAllLocationsIfNull(a)}},pn.prototype.isLine=function(r){return this.elt[r].isLine()},pn.prototype.merge=function(r){for(var o=0;o<2;o++)this.elt[o]===null&&r.elt[o]!==null?this.elt[o]=new vn(r.elt[o]):this.elt[o].merge(r.elt[o])},pn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},pn.prototype.getLocation=function(){if(arguments.length===1){var r=arguments[0];return this.elt[r].get(Ft.ON)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return this.elt[o].get(a)}},pn.prototype.toString=function(){var r=new vt;return this.elt[0]!==null&&(r.append("A:"),r.append(this.elt[0].toString())),this.elt[1]!==null&&(r.append(" B:"),r.append(this.elt[1].toString())),r.toString()},pn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var r=arguments[0];return this.elt[r].isArea()}},pn.prototype.isAnyNull=function(r){return this.elt[r].isAnyNull()},pn.prototype.setLocation=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];this.elt[r].setLocation(Ft.ON,o)}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this.elt[a].setLocation(l,h)}},pn.prototype.isEqualOnSide=function(r,o){return this.elt[0].isEqualOnSide(r.elt[0],o)&&this.elt[1].isEqualOnSide(r.elt[1],o)},pn.prototype.allPositionsEqual=function(r,o){return this.elt[r].allPositionsEqual(o)},pn.prototype.toLine=function(r){this.elt[r].isArea()&&(this.elt[r]=new vn(this.elt[r].location[0]))},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},pn.toLineLabel=function(r){for(var o=new pn(V.NONE),a=0;a<2;a++)o.setLocation(a,r.getLocation(a));return o};var Vn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new O,this._pts=new O,this._label=new pn(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new O,this._geometryFactory=null;var r=arguments[0],o=arguments[1];this._geometryFactory=o,this.computePoints(r),this.computeRing()};Vn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var r=new Array(this._pts.size()).fill(null),o=0;o<this._pts.size();o++)r[o]=this._pts.get(o);this._ring=this._geometryFactory.createLinearRing(r),this._isHole=ot.isCCW(this._ring.getCoordinates())},Vn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Vn.prototype.computePoints=function(r){this._startDe=r;var o=r,a=!0;do{if(o===null)throw new Go("Found null DirectedEdge");if(o.getEdgeRing()===this)throw new Go("Directed Edge visited twice during ring-building at "+o.getCoordinate());this._edges.add(o);var l=o.getLabel();Pt.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(o.getEdge(),o.isForward(),a),a=!1,this.setEdgeRing(o,this),o=this.getNext(o)}while(o!==this._startDe)},Vn.prototype.getLinearRing=function(){return this._ring},Vn.prototype.getCoordinate=function(r){return this._pts.get(r)},Vn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var r=this._startDe;do{var o=r.getNode().getEdges().getOutgoingDegree(this);o>this._maxNodeDegree&&(this._maxNodeDegree=o),r=this.getNext(r)}while(r!==this._startDe);this._maxNodeDegree*=2},Vn.prototype.addPoints=function(r,o,a){var l=r.getCoordinates();if(o){var h=1;a&&(h=0);for(var m=h;m<l.length;m++)this._pts.add(l[m])}else{var S=l.length-2;a&&(S=l.length-1);for(var C=S;C>=0;C--)this._pts.add(l[C])}},Vn.prototype.isHole=function(){return this._isHole},Vn.prototype.setInResult=function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)},Vn.prototype.containsPoint=function(r){var o=this.getLinearRing();if(!o.getEnvelopeInternal().contains(r)||!ot.isPointInRing(r,o.getCoordinates()))return!1;for(var a=this._holes.iterator();a.hasNext();)if(a.next().containsPoint(r))return!1;return!0},Vn.prototype.addHole=function(r){this._holes.add(r)},Vn.prototype.isShell=function(){return this._shell===null},Vn.prototype.getLabel=function(){return this._label},Vn.prototype.getEdges=function(){return this._edges},Vn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Vn.prototype.getShell=function(){return this._shell},Vn.prototype.mergeLabel=function(){if(arguments.length===1){var r=arguments[0];this.mergeLabel(r,0),this.mergeLabel(r,1)}else if(arguments.length===2){var o=arguments[0],a=arguments[1],l=o.getLocation(a,Ft.RIGHT);if(l===V.NONE)return null;if(this._label.getLocation(a)===V.NONE)return this._label.setLocation(a,l),null}},Vn.prototype.setShell=function(r){this._shell=r,r!==null&&r.addHole(this)},Vn.prototype.toPolygon=function(r){for(var o=new Array(this._holes.size()).fill(null),a=0;a<this._holes.size();a++)o[a]=this._holes.get(a).getLinearRing();return r.createPolygon(this.getLinearRing(),o)},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn};var kD=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.setEdgeRing=function(a,l){a.setMinEdgeRing(l)},o.prototype.getNext=function(a){return a.getNextMin()},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Vn),qD=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.buildMinimalRings=function(){var a=new O,l=this._startDe;do{if(l.getMinEdgeRing()===null){var h=new kD(l,this._geometryFactory);a.add(h)}l=l.getNext()}while(l!==this._startDe);return a},o.prototype.setEdgeRing=function(a,l){a.setEdgeRing(l)},o.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var a=this._startDe;do a.getNode().getEdges().linkMinimalDirectedEdges(this),a=a.getNext();while(a!==this._startDe)},o.prototype.getNext=function(a){return a.getNext()},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Vn),gi=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this._label=r}}};gi.prototype.setVisited=function(r){this._isVisited=r},gi.prototype.setInResult=function(r){this._isInResult=r},gi.prototype.isCovered=function(){return this._isCovered},gi.prototype.isCoveredSet=function(){return this._isCoveredSet},gi.prototype.setLabel=function(r){this._label=r},gi.prototype.getLabel=function(){return this._label},gi.prototype.setCovered=function(r){this._isCovered=r,this._isCoveredSet=!0},gi.prototype.updateIM=function(r){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(r)},gi.prototype.isInResult=function(){return this._isInResult},gi.prototype.isVisited=function(){return this._isVisited},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var jf=function(r){function o(){r.call(this),this._coord=null,this._edges=null;var a=arguments[0],l=arguments[1];this._coord=a,this._edges=l,this._label=new pn(0,V.NONE)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.isIncidentEdgeInResult=function(){for(var a=this.getEdges().getEdges().iterator();a.hasNext();)if(a.next().getEdge().isInResult())return!0;return!1},o.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},o.prototype.getCoordinate=function(){return this._coord},o.prototype.print=function(a){a.println("node "+this._coord+" lbl: "+this._label)},o.prototype.computeIM=function(a){},o.prototype.computeMergedLocation=function(a,l){var h=V.NONE;if(h=this._label.getLocation(l),!a.isNull(l)){var m=a.getLocation(l);h!==V.BOUNDARY&&(h=m)}return h},o.prototype.setLabel=function(){if(arguments.length!==2)return r.prototype.setLabel.apply(this,arguments);var a=arguments[0],l=arguments[1];this._label===null?this._label=new pn(a,l):this._label.setLocation(a,l)},o.prototype.getEdges=function(){return this._edges},o.prototype.mergeLabel=function(){if(arguments[0]instanceof o){var a=arguments[0];this.mergeLabel(a._label)}else if(arguments[0]instanceof pn)for(var l=arguments[0],h=0;h<2;h++){var m=this.computeMergedLocation(l,h);this._label.getLocation(h)===V.NONE&&this._label.setLocation(h,m)}},o.prototype.add=function(a){this._edges.insert(a),a.setNode(this)},o.prototype.setLabelBoundary=function(a){if(this._label===null)return null;var l=V.NONE;this._label!==null&&(l=this._label.getLocation(a));var h=null;switch(l){case V.BOUNDARY:h=V.INTERIOR;break;case V.INTERIOR:default:h=V.BOUNDARY}this._label.setLocation(a,h)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(gi),Ki=function(){this.nodeMap=new y,this.nodeFact=null;var r=arguments[0];this.nodeFact=r};Ki.prototype.find=function(r){return this.nodeMap.get(r)},Ki.prototype.addNode=function(){if(arguments[0]instanceof P){var r=arguments[0],o=this.nodeMap.get(r);return o===null&&(o=this.nodeFact.createNode(r),this.nodeMap.put(r,o)),o}if(arguments[0]instanceof jf){var a=arguments[0],l=this.nodeMap.get(a.getCoordinate());return l===null?(this.nodeMap.put(a.getCoordinate(),a),a):(l.mergeLabel(a),l)}},Ki.prototype.print=function(r){for(var o=this.iterator();o.hasNext();)o.next().print(r)},Ki.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ki.prototype.values=function(){return this.nodeMap.values()},Ki.prototype.getBoundaryNodes=function(r){for(var o=new O,a=this.iterator();a.hasNext();){var l=a.next();l.getLabel().getLocation(r)===V.BOUNDARY&&o.add(l)}return o},Ki.prototype.add=function(r){var o=r.getCoordinate();this.addNode(o).add(r)},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki};var mn=function(){},pc={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};mn.prototype.interfaces_=function(){return[]},mn.prototype.getClass=function(){return mn},mn.isNorthern=function(r){return r===mn.NE||r===mn.NW},mn.isOpposite=function(r,o){return r===o?!1:(r-o+4)%4===2},mn.commonHalfPlane=function(r,o){if(r===o)return r;if((r-o+4)%4===2)return-1;var a=r<o?r:o;return a===0&&(r>o?r:o)===3?3:a},mn.isInHalfPlane=function(r,o){return o===mn.SE?r===mn.SE||r===mn.SW:r===o||r===o+1},mn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],o=arguments[1];if(r===0&&o===0)throw new T("Cannot compute the quadrant for point ( "+r+", "+o+" )");return r>=0?o>=0?mn.NE:mn.SE:o>=0?mn.NW:mn.SW}if(arguments[0]instanceof P&&arguments[1]instanceof P){var a=arguments[0],l=arguments[1];if(l.x===a.x&&l.y===a.y)throw new T("Cannot compute the quadrant for two identical points "+a);return l.x>=a.x?l.y>=a.y?mn.NE:mn.SE:l.y>=a.y?mn.NW:mn.SW}},pc.NE.get=function(){return 0},pc.NW.get=function(){return 1},pc.SW.get=function(){return 2},pc.SE.get=function(){return 3},Object.defineProperties(mn,pc);var gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var r=arguments[0];this._edge=r}else if(arguments.length===3){var o=arguments[0],a=arguments[1],l=arguments[2];this._edge=o,this.init(a,l),this._label=null}else if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3];this._edge=h,this.init(m,S),this._label=C}};gr.prototype.compareDirection=function(r){return this._dx===r._dx&&this._dy===r._dy?0:this._quadrant>r._quadrant?1:this._quadrant<r._quadrant?-1:ot.computeOrientation(r._p0,r._p1,this._p1)},gr.prototype.getDy=function(){return this._dy},gr.prototype.getCoordinate=function(){return this._p0},gr.prototype.setNode=function(r){this._node=r},gr.prototype.print=function(r){var o=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),l=a.lastIndexOf("."),h=a.substring(l+1);r.print(" "+h+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+o+" "+this._label)},gr.prototype.compareTo=function(r){var o=r;return this.compareDirection(o)},gr.prototype.getDirectedCoordinate=function(){return this._p1},gr.prototype.getDx=function(){return this._dx},gr.prototype.getLabel=function(){return this._label},gr.prototype.getEdge=function(){return this._edge},gr.prototype.getQuadrant=function(){return this._quadrant},gr.prototype.getNode=function(){return this._node},gr.prototype.toString=function(){var r=Math.atan2(this._dy,this._dx),o=this.getClass().getName(),a=o.lastIndexOf(".");return" "+o.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label},gr.prototype.computeLabel=function(r){},gr.prototype.init=function(r,o){this._p0=r,this._p1=o,this._dx=o.x-r.x,this._dy=o.y-r.y,this._quadrant=mn.quadrant(this._dx,this._dy),Pt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},gr.prototype.interfaces_=function(){return[B]},gr.prototype.getClass=function(){return gr};var Ig=function(r){function o(){var a=arguments[0],l=arguments[1];if(r.call(this,a),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=l,l)this.init(a.getCoordinate(0),a.getCoordinate(1));else{var h=a.getNumPoints()-1;this.init(a.getCoordinate(h),a.getCoordinate(h-1))}this.computeDirectedLabel()}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.getNextMin=function(){return this._nextMin},o.prototype.getDepth=function(a){return this._depth[a]},o.prototype.setVisited=function(a){this._isVisited=a},o.prototype.computeDirectedLabel=function(){this._label=new pn(this._edge.getLabel()),this._isForward||this._label.flip()},o.prototype.getNext=function(){return this._next},o.prototype.setDepth=function(a,l){if(this._depth[a]!==-999&&this._depth[a]!==l)throw new Go("assigned depths do not match",this.getCoordinate());this._depth[a]=l},o.prototype.isInteriorAreaEdge=function(){for(var a=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,Ft.LEFT)===V.INTERIOR&&this._label.getLocation(l,Ft.RIGHT)===V.INTERIOR||(a=!1);return a},o.prototype.setNextMin=function(a){this._nextMin=a},o.prototype.print=function(a){r.prototype.print.call(this,a),a.print(" "+this._depth[Ft.LEFT]+"/"+this._depth[Ft.RIGHT]),a.print(" ("+this.getDepthDelta()+")"),this._isInResult&&a.print(" inResult")},o.prototype.setMinEdgeRing=function(a){this._minEdgeRing=a},o.prototype.isLineEdge=function(){var a=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),h=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return a&&l&&h},o.prototype.setEdgeRing=function(a){this._edgeRing=a},o.prototype.getMinEdgeRing=function(){return this._minEdgeRing},o.prototype.getDepthDelta=function(){var a=this._edge.getDepthDelta();return this._isForward||(a=-a),a},o.prototype.setInResult=function(a){this._isInResult=a},o.prototype.getSym=function(){return this._sym},o.prototype.isForward=function(){return this._isForward},o.prototype.getEdge=function(){return this._edge},o.prototype.printEdge=function(a){this.print(a),a.print(" "),this._isForward?this._edge.print(a):this._edge.printReverse(a)},o.prototype.setSym=function(a){this._sym=a},o.prototype.setVisitedEdge=function(a){this.setVisited(a),this._sym.setVisited(a)},o.prototype.setEdgeDepths=function(a,l){var h=this.getEdge().getDepthDelta();this._isForward||(h=-h);var m=1;a===Ft.LEFT&&(m=-1);var S=Ft.opposite(a),C=l+h*m;this.setDepth(a,l),this.setDepth(S,C)},o.prototype.getEdgeRing=function(){return this._edgeRing},o.prototype.isInResult=function(){return this._isInResult},o.prototype.setNext=function(a){this._next=a},o.prototype.isVisited=function(){return this._isVisited},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.depthFactor=function(a,l){return a===V.EXTERIOR&&l===V.INTERIOR?1:a===V.INTERIOR&&l===V.EXTERIOR?-1:0},o}(gr),Tu=function(){};Tu.prototype.createNode=function(r){return new jf(r,null)},Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu};var On=function(){if(this._edges=new O,this._nodes=null,this._edgeEndList=new O,arguments.length===0)this._nodes=new Ki(new Tu);else if(arguments.length===1){var r=arguments[0];this._nodes=new Ki(r)}};On.prototype.printEdges=function(r){r.println("Edges:");for(var o=0;o<this._edges.size();o++){r.println("edge "+o+":");var a=this._edges.get(o);a.print(r),a.eiList.print(r)}},On.prototype.find=function(r){return this._nodes.find(r)},On.prototype.addNode=function(){if(arguments[0]instanceof jf){var r=arguments[0];return this._nodes.addNode(r)}if(arguments[0]instanceof P){var o=arguments[0];return this._nodes.addNode(o)}},On.prototype.getNodeIterator=function(){return this._nodes.iterator()},On.prototype.linkResultDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkResultDirectedEdges()},On.prototype.debugPrintln=function(r){Ut.out.println(r)},On.prototype.isBoundaryNode=function(r,o){var a=this._nodes.find(o);if(a===null)return!1;var l=a.getLabel();return l!==null&&l.getLocation(r)===V.BOUNDARY},On.prototype.linkAllDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkAllDirectedEdges()},On.prototype.matchInSameDirection=function(r,o,a,l){return!!r.equals(a)&&ot.computeOrientation(r,o,l)===ot.COLLINEAR&&mn.quadrant(r,o)===mn.quadrant(a,l)},On.prototype.getEdgeEnds=function(){return this._edgeEndList},On.prototype.debugPrint=function(r){Ut.out.print(r)},On.prototype.getEdgeIterator=function(){return this._edges.iterator()},On.prototype.findEdgeInSameDirection=function(r,o){for(var a=0;a<this._edges.size();a++){var l=this._edges.get(a),h=l.getCoordinates();if(this.matchInSameDirection(r,o,h[0],h[1])||this.matchInSameDirection(r,o,h[h.length-1],h[h.length-2]))return l}return null},On.prototype.insertEdge=function(r){this._edges.add(r)},On.prototype.findEdgeEnd=function(r){for(var o=this.getEdgeEnds().iterator();o.hasNext();){var a=o.next();if(a.getEdge()===r)return a}return null},On.prototype.addEdges=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next();this._edges.add(a);var l=new Ig(a,!0),h=new Ig(a,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},On.prototype.add=function(r){this._nodes.add(r),this._edgeEndList.add(r)},On.prototype.getNodes=function(){return this._nodes.values()},On.prototype.findEdge=function(r,o){for(var a=0;a<this._edges.size();a++){var l=this._edges.get(a),h=l.getCoordinates();if(r.equals(h[0])&&o.equals(h[1]))return l}return null},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.linkResultDirectedEdges=function(r){for(var o=r.iterator();o.hasNext();)o.next().getEdges().linkResultDirectedEdges()};var Qr=function(){this._geometryFactory=null,this._shellList=new O;var r=arguments[0];this._geometryFactory=r};Qr.prototype.sortShellsAndHoles=function(r,o,a){for(var l=r.iterator();l.hasNext();){var h=l.next();h.isHole()?a.add(h):o.add(h)}},Qr.prototype.computePolygons=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next().toPolygon(this._geometryFactory);o.add(l)}return o},Qr.prototype.placeFreeHoles=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next();if(l.getShell()===null){var h=this.findEdgeRingContaining(l,r);if(h===null)throw new Go("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},Qr.prototype.buildMinimalEdgeRings=function(r,o,a){for(var l=new O,h=r.iterator();h.hasNext();){var m=h.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var S=m.buildMinimalRings(),C=this.findShell(S);C!==null?(this.placePolygonHoles(C,S),o.add(C)):a.addAll(S)}else l.add(m)}return l},Qr.prototype.containsPoint=function(r){for(var o=this._shellList.iterator();o.hasNext();)if(o.next().containsPoint(r))return!0;return!1},Qr.prototype.buildMaximalEdgeRings=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var h=new qD(l,this._geometryFactory);o.add(h),h.setInResult()}}return o},Qr.prototype.placePolygonHoles=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next();l.isHole()&&l.setShell(r)}},Qr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Qr.prototype.findEdgeRingContaining=function(r,o){for(var a=r.getLinearRing(),l=a.getEnvelopeInternal(),h=a.getCoordinateN(0),m=null,S=null,C=o.iterator();C.hasNext();){var z=C.next(),K=z.getLinearRing(),mt=K.getEnvelopeInternal();m!==null&&(S=m.getLinearRing().getEnvelopeInternal());var yt=!1;mt.contains(l)&&ot.isPointInRing(h,K.getCoordinates())&&(yt=!0),yt&&(m===null||S.contains(mt))&&(m=z)}return m},Qr.prototype.findShell=function(r){for(var o=0,a=null,l=r.iterator();l.hasNext();){var h=l.next();h.isHole()||(a=h,o++)}return Pt.isTrue(o<=1,"found two shells in MinimalEdgeRing list"),a},Qr.prototype.add=function(){if(arguments.length===1){var r=arguments[0];this.add(r.getEdgeEnds(),r.getNodes())}else if(arguments.length===2){var o=arguments[0],a=arguments[1];On.linkResultDirectedEdges(a);var l=this.buildMaximalEdgeRings(o),h=new O,m=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(m,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var Cu=function(){};Cu.prototype.getBounds=function(){},Cu.prototype.interfaces_=function(){return[]},Cu.prototype.getClass=function(){return Cu};var Bi=function(){this._bounds=null,this._item=null;var r=arguments[0],o=arguments[1];this._bounds=r,this._item=o};Bi.prototype.getItem=function(){return this._item},Bi.prototype.getBounds=function(){return this._bounds},Bi.prototype.interfaces_=function(){return[Cu,t]},Bi.prototype.getClass=function(){return Bi};var ko=function(){this._size=null,this._items=null,this._size=0,this._items=new O,this._items.add(null)};ko.prototype.poll=function(){if(this.isEmpty())return null;var r=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),r},ko.prototype.size=function(){return this._size},ko.prototype.reorder=function(r){for(var o=null,a=this._items.get(r);2*r<=this._size&&((o=2*r)!==this._size&&this._items.get(o+1).compareTo(this._items.get(o))<0&&o++,this._items.get(o).compareTo(a)<0);r=o)this._items.set(r,this._items.get(o));this._items.set(r,a)},ko.prototype.clear=function(){this._size=0,this._items.clear()},ko.prototype.isEmpty=function(){return this._size===0},ko.prototype.add=function(r){this._items.add(null),this._size+=1;var o=this._size;for(this._items.set(0,r);r.compareTo(this._items.get(Math.trunc(o/2)))<0;o/=2)this._items.set(o,this._items.get(Math.trunc(o/2)));this._items.set(o,r)},ko.prototype.interfaces_=function(){return[]},ko.prototype.getClass=function(){return ko};var us=function(){};us.prototype.visitItem=function(r){},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us};var Ra=function(){};Ra.prototype.insert=function(r,o){},Ra.prototype.remove=function(r,o){},Ra.prototype.query=function(){},Ra.prototype.interfaces_=function(){return[]},Ra.prototype.getClass=function(){return Ra};var Jn=function(){if(this._childBoundables=new O,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this._level=r}}},v1={serialVersionUID:{configurable:!0}};Jn.prototype.getLevel=function(){return this._level},Jn.prototype.size=function(){return this._childBoundables.size()},Jn.prototype.getChildBoundables=function(){return this._childBoundables},Jn.prototype.addChildBoundable=function(r){Pt.isTrue(this._bounds===null),this._childBoundables.add(r)},Jn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Jn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Jn.prototype.interfaces_=function(){return[Cu,t]},Jn.prototype.getClass=function(){return Jn},v1.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Jn,v1);var zi=function(){};zi.reverseOrder=function(){return{compare:function(r,o){return o.compareTo(r)}}},zi.min=function(r){return zi.sort(r),r.get(0)},zi.sort=function(r,o){var a=r.toArray();o?_n.sort(a,o):_n.sort(a);for(var l=r.iterator(),h=0,m=a.length;h<m;h++)l.next(),l.set(a[h])},zi.singletonList=function(r){var o=new O;return o.add(r),o};var Hn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var r=arguments[0],o=arguments[1],a=arguments[2];this._boundable1=r,this._boundable2=o,this._itemDistance=a,this._distance=this.distance()};Hn.prototype.expandToQueue=function(r,o){var a=Hn.isComposite(this._boundable1),l=Hn.isComposite(this._boundable2);if(a&&l)return Hn.area(this._boundable1)>Hn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,r,o),null):(this.expand(this._boundable2,this._boundable1,r,o),null);if(a)return this.expand(this._boundable1,this._boundable2,r,o),null;if(l)return this.expand(this._boundable2,this._boundable1,r,o),null;throw new T("neither boundable is composite")},Hn.prototype.isLeaves=function(){return!(Hn.isComposite(this._boundable1)||Hn.isComposite(this._boundable2))},Hn.prototype.compareTo=function(r){var o=r;return this._distance<o._distance?-1:this._distance>o._distance?1:0},Hn.prototype.expand=function(r,o,a,l){for(var h=r.getChildBoundables().iterator();h.hasNext();){var m=h.next(),S=new Hn(m,o,this._itemDistance);S.getDistance()<l&&a.add(S)}},Hn.prototype.getBoundable=function(r){return r===0?this._boundable1:this._boundable2},Hn.prototype.getDistance=function(){return this._distance},Hn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Hn.prototype.interfaces_=function(){return[B]},Hn.prototype.getClass=function(){return Hn},Hn.area=function(r){return r.getBounds().getArea()},Hn.isComposite=function(r){return r instanceof Jn};var rr=function r(){if(this._root=null,this._built=!1,this._itemBoundables=new O,this._nodeCapacity=null,arguments.length===0){var o=r.DEFAULT_NODE_CAPACITY;this._nodeCapacity=o}else if(arguments.length===1){var a=arguments[0];Pt.isTrue(a>1,"Node capacity must be greater than 1"),this._nodeCapacity=a}},Kf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};rr.prototype.getNodeCapacity=function(){return this._nodeCapacity},rr.prototype.lastNode=function(r){return r.get(r.size()-1)},rr.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var r=0,o=arguments[0].getChildBoundables().iterator();o.hasNext();){var a=o.next();a instanceof Jn?r+=this.size(a):a instanceof Bi&&(r+=1)}return r}},rr.prototype.removeItem=function(r,o){for(var a=null,l=r.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof Bi&&h.getItem()===o&&(a=h)}return a!==null&&(r.getChildBoundables().remove(a),!0)},rr.prototype.itemsTree=function(){if(arguments.length===0){this.build();var r=this.itemsTree(this._root);return r===null?new O:r}if(arguments.length===1){for(var o=arguments[0],a=new O,l=o.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(h instanceof Jn){var m=this.itemsTree(h);m!==null&&a.add(m)}else h instanceof Bi?a.add(h.getItem()):Pt.shouldNeverReachHere()}return a.size()<=0?null:a}},rr.prototype.insert=function(r,o){Pt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Bi(r,o))},rr.prototype.boundablesAtLevel=function(){if(arguments.length===1){var r=arguments[0],o=new O;return this.boundablesAtLevel(r,this._root,o),o}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];if(Pt.isTrue(a>-2),l.getLevel()===a)return h.add(l),null;for(var m=l.getChildBoundables().iterator();m.hasNext();){var S=m.next();S instanceof Jn?this.boundablesAtLevel(a,S,h):(Pt.isTrue(S instanceof Bi),a===-1&&h.add(S))}return null}},rr.prototype.query=function(){if(arguments.length===1){var r=arguments[0];this.build();var o=new O;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,o),o}if(arguments.length===2){var a=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.query(a,this._root,l)}else if(arguments.length===3){if($(arguments[2],us)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn)for(var h=arguments[0],m=arguments[1],S=arguments[2],C=m.getChildBoundables(),z=0;z<C.size();z++){var K=C.get(z);this.getIntersectsOp().intersects(K.getBounds(),h)&&(K instanceof Jn?this.query(h,K,S):K instanceof Bi?S.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if($(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn)for(var mt=arguments[0],yt=arguments[1],zt=arguments[2],qt=yt.getChildBoundables(),jt=0;jt<qt.size();jt++){var ue=qt.get(jt);this.getIntersectsOp().intersects(ue.getBounds(),mt)&&(ue instanceof Jn?this.query(mt,ue,zt):ue instanceof Bi?zt.add(ue.getItem()):Pt.shouldNeverReachHere())}}},rr.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},rr.prototype.getRoot=function(){return this.build(),this._root},rr.prototype.remove=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.remove(r,this._root,o)}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2],m=this.removeItem(l,h);if(m)return!0;for(var S=null,C=l.getChildBoundables().iterator();C.hasNext();){var z=C.next();if(this.getIntersectsOp().intersects(z.getBounds(),a)&&z instanceof Jn&&(m=this.remove(a,z,h))){S=z;break}}return S!==null&&S.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(S),m}},rr.prototype.createHigherLevels=function(r,o){Pt.isTrue(!r.isEmpty());var a=this.createParentBoundables(r,o+1);return a.size()===1?a.get(0):this.createHigherLevels(a,o+1)},rr.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var r=0,o=arguments[0].getChildBoundables().iterator();o.hasNext();){var a=o.next();if(a instanceof Jn){var l=this.depth(a);l>r&&(r=l)}}return r+1}},rr.prototype.createParentBoundables=function(r,o){Pt.isTrue(!r.isEmpty());var a=new O;a.add(this.createNode(o));var l=new O(r);zi.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var m=h.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(o)),this.lastNode(a).addChildBoundable(m)}return a},rr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},rr.prototype.interfaces_=function(){return[t]},rr.prototype.getClass=function(){return rr},rr.compareDoubles=function(r,o){return r>o?1:r<o?-1:0},Kf.IntersectsOp.get=function(){return VD},Kf.serialVersionUID.get=function(){return-3886435814360241e3},Kf.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(rr,Kf);var VD=function(){},Iu=function(){};Iu.prototype.distance=function(r,o){},Iu.prototype.interfaces_=function(){return[]},Iu.prototype.getClass=function(){return Iu};var _1=function(r){function o(l){l=l||o.DEFAULT_NODE_CAPACITY,r.call(this,l)}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return o.prototype.createParentBoundablesFromVerticalSlices=function(l,h){Pt.isTrue(l.length>0);for(var m=new O,S=0;S<l.length;S++)m.addAll(this.createParentBoundablesFromVerticalSlice(l[S],h));return m},o.prototype.createNode=function(l){return new x1(l)},o.prototype.size=function(){return arguments.length===0?r.prototype.size.call(this):r.prototype.size.apply(this,arguments)},o.prototype.insert=function(){if(arguments.length!==2)return r.prototype.insert.apply(this,arguments);var l=arguments[0],h=arguments[1];if(l.isNull())return null;r.prototype.insert.call(this,l,h)},o.prototype.getIntersectsOp=function(){return o.intersectsOp},o.prototype.verticalSlices=function(l,h){for(var m=Math.trunc(Math.ceil(l.size()/h)),S=new Array(h).fill(null),C=l.iterator(),z=0;z<h;z++){S[z]=new O;for(var K=0;C.hasNext()&&K<m;){var mt=C.next();S[z].add(mt),K++}}return S},o.prototype.query=function(){if(arguments.length===1){var l=arguments[0];return r.prototype.query.call(this,l)}if(arguments.length===2){var h=arguments[0],m=arguments[1];r.prototype.query.call(this,h,m)}else if(arguments.length===3){if($(arguments[2],us)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn){var S=arguments[0],C=arguments[1],z=arguments[2];r.prototype.query.call(this,S,C,z)}else if($(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn){var K=arguments[0],mt=arguments[1],yt=arguments[2];r.prototype.query.call(this,K,mt,yt)}}},o.prototype.getComparator=function(){return o.yComparator},o.prototype.createParentBoundablesFromVerticalSlice=function(l,h){return r.prototype.createParentBoundables.call(this,l,h)},o.prototype.remove=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return r.prototype.remove.call(this,l,h)}return r.prototype.remove.apply(this,arguments)},o.prototype.depth=function(){return arguments.length===0?r.prototype.depth.call(this):r.prototype.depth.apply(this,arguments)},o.prototype.createParentBoundables=function(l,h){Pt.isTrue(!l.isEmpty());var m=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),S=new O(l);zi.sort(S,o.xComparator);var C=this.verticalSlices(S,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(C,h)},o.prototype.nearestNeighbour=function(){if(arguments.length===1){if($(arguments[0],Iu)){var l=arguments[0],h=new Hn(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof Hn){var m=arguments[0];return this.nearestNeighbour(m,w.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof o&&$(arguments[1],Iu)){var S=arguments[0],C=arguments[1],z=new Hn(this.getRoot(),S.getRoot(),C);return this.nearestNeighbour(z)}if(arguments[0]instanceof Hn&&typeof arguments[1]=="number"){var K=arguments[0],mt=arguments[1],yt=null,zt=new ko;for(zt.add(K);!zt.isEmpty()&&mt>0;){var qt=zt.poll(),jt=qt.getDistance();if(jt>=mt)break;qt.isLeaves()?(mt=jt,yt=qt):qt.expandToQueue(zt,mt)}return[yt.getBoundable(0).getItem(),yt.getBoundable(1).getItem()]}}else if(arguments.length===3){var ue=arguments[0],dn=arguments[1],Xn=arguments[2],Dr=new Bi(ue,dn),So=new Hn(this.getRoot(),Dr,Xn);return this.nearestNeighbour(So)[0]}},o.prototype.interfaces_=function(){return[Ra,t]},o.prototype.getClass=function(){return o},o.centreX=function(l){return o.avg(l.getMinX(),l.getMaxX())},o.avg=function(l,h){return(l+h)/2},o.centreY=function(l){return o.avg(l.getMinY(),l.getMaxY())},a.STRtreeNode.get=function(){return x1},a.serialVersionUID.get=function(){return 0x39920f7d5f261e0},a.xComparator.get=function(){return{interfaces_:function(){return[D]},compare:function(l,h){return r.compareDoubles(o.centreX(l.getBounds()),o.centreX(h.getBounds()))}}},a.yComparator.get=function(){return{interfaces_:function(){return[D]},compare:function(l,h){return r.compareDoubles(o.centreY(l.getBounds()),o.centreY(h.getBounds()))}}},a.intersectsOp.get=function(){return{interfaces_:function(){return[r.IntersectsOp]},intersects:function(l,h){return l.intersects(h)}}},a.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(o,a),o}(rr),x1=function(r){function o(){var a=arguments[0];r.call(this,a)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.computeBounds=function(){for(var a=null,l=this.getChildBoundables().iterator();l.hasNext();){var h=l.next();a===null?a=new Ct(h.getBounds()):a.expandToInclude(h.getBounds())}return a},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Jn),qr=function(){};qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.relativeSign=function(r,o){return r<o?-1:r>o?1:0},qr.compare=function(r,o,a){if(o.equals2D(a))return 0;var l=qr.relativeSign(o.x,a.x),h=qr.relativeSign(o.y,a.y);switch(r){case 0:return qr.compareValue(l,h);case 1:return qr.compareValue(h,l);case 2:return qr.compareValue(h,-l);case 3:return qr.compareValue(-l,h);case 4:return qr.compareValue(-l,-h);case 5:return qr.compareValue(-h,-l);case 6:return qr.compareValue(-h,l);case 7:return qr.compareValue(l,-h)}return Pt.shouldNeverReachHere("invalid octant value"),0},qr.compareValue=function(r,o){return r<0?-1:r>0?1:o<0?-1:o>0?1:0};var ls=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];this._segString=r,this.coord=new P(o),this.segmentIndex=a,this._segmentOctant=l,this._isInterior=!o.equals2D(r.getCoordinate(a))};ls.prototype.getCoordinate=function(){return this.coord},ls.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)},ls.prototype.compareTo=function(r){var o=r;return this.segmentIndex<o.segmentIndex?-1:this.segmentIndex>o.segmentIndex?1:this.coord.equals2D(o.coord)?0:qr.compare(this._segmentOctant,this.coord,o.coord)},ls.prototype.isEndPoint=function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r},ls.prototype.isInterior=function(){return this._isInterior},ls.prototype.interfaces_=function(){return[B]},ls.prototype.getClass=function(){return ls};var Ir=function(){this._nodeMap=new y,this._edge=null;var r=arguments[0];this._edge=r};Ir.prototype.getSplitCoordinates=function(){var r=new J;this.addEndpoints();for(var o=this.iterator(),a=o.next();o.hasNext();){var l=o.next();this.addEdgeCoordinates(a,l,r),a=l}return r.toCoordinateArray()},Ir.prototype.addCollapsedNodes=function(){var r=new O;this.findCollapsesFromInsertedNodes(r),this.findCollapsesFromExistingVertices(r);for(var o=r.iterator();o.hasNext();){var a=o.next().intValue();this.add(this._edge.getCoordinate(a),a)}},Ir.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},Ir.prototype.findCollapsesFromExistingVertices=function(r){for(var o=0;o<this._edge.size()-2;o++){var a=this._edge.getCoordinate(o),l=this._edge.getCoordinate(o+2);a.equals2D(l)&&r.add(new it(o+1))}},Ir.prototype.addEdgeCoordinates=function(r,o,a){var l=this._edge.getCoordinate(o.segmentIndex),h=o.isInterior()||!o.coord.equals2D(l);a.add(new P(r.coord),!1);for(var m=r.segmentIndex+1;m<=o.segmentIndex;m++)a.add(this._edge.getCoordinate(m));h&&a.add(new P(o.coord))},Ir.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ir.prototype.addSplitEdges=function(r){this.addEndpoints(),this.addCollapsedNodes();for(var o=this.iterator(),a=o.next();o.hasNext();){var l=o.next(),h=this.createSplitEdge(a,l);r.add(h),a=l}},Ir.prototype.findCollapseIndex=function(r,o,a){if(!r.coord.equals2D(o.coord))return!1;var l=o.segmentIndex-r.segmentIndex;return o.isInterior()||l--,l===1&&(a[0]=r.segmentIndex+1,!0)},Ir.prototype.findCollapsesFromInsertedNodes=function(r){for(var o=new Array(1).fill(null),a=this.iterator(),l=a.next();a.hasNext();){var h=a.next();this.findCollapseIndex(l,h,o)&&r.add(new it(o[0])),l=h}},Ir.prototype.getEdge=function(){return this._edge},Ir.prototype.addEndpoints=function(){var r=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(r),r)},Ir.prototype.createSplitEdge=function(r,o){var a=o.segmentIndex-r.segmentIndex+2,l=this._edge.getCoordinate(o.segmentIndex),h=o.isInterior()||!o.coord.equals2D(l);h||a--;var m=new Array(a).fill(null),S=0;m[S++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)m[S++]=this._edge.getCoordinate(C);return h&&(m[S]=new P(o.coord)),new zn(m,this._edge.getData())},Ir.prototype.add=function(r,o){var a=new ls(this._edge,r,o,this._edge.getSegmentOctant(o)),l=this._nodeMap.get(a);return l!==null?(Pt.isTrue(l.coord.equals2D(r),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(a,a),a)},Ir.prototype.checkSplitEdgesCorrectness=function(r){var o=this._edge.getCoordinates(),a=r.get(0).getCoordinate(0);if(!a.equals2D(o[0]))throw new Ht("bad split edge start point at "+a);var l=r.get(r.size()-1).getCoordinates(),h=l[l.length-1];if(!h.equals2D(o[o.length-1]))throw new Ht("bad split edge end point at "+h)},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir};var La=function(){};La.prototype.interfaces_=function(){return[]},La.prototype.getClass=function(){return La},La.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],o=arguments[1];if(r===0&&o===0)throw new T("Cannot compute the octant for point ( "+r+", "+o+" )");var a=Math.abs(r),l=Math.abs(o);return r>=0?o>=0?a>=l?0:1:a>=l?7:6:o>=0?a>=l?3:2:a>=l?4:5}if(arguments[0]instanceof P&&arguments[1]instanceof P){var h=arguments[0],m=arguments[1],S=m.x-h.x,C=m.y-h.y;if(S===0&&C===0)throw new T("Cannot compute the octant for two identical points "+h);return La.octant(S,C)}};var po=function(){};po.prototype.getCoordinates=function(){},po.prototype.size=function(){},po.prototype.getCoordinate=function(r){},po.prototype.isClosed=function(){},po.prototype.setData=function(r){},po.prototype.getData=function(){},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po};var dc=function(){};dc.prototype.addIntersection=function(r,o){},dc.prototype.interfaces_=function(){return[po]},dc.prototype.getClass=function(){return dc};var zn=function(){this._nodeList=new Ir(this),this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};zn.prototype.getCoordinates=function(){return this._pts},zn.prototype.size=function(){return this._pts.length},zn.prototype.getCoordinate=function(r){return this._pts[r]},zn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},zn.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))},zn.prototype.setData=function(r){this._data=r},zn.prototype.safeOctant=function(r,o){return r.equals2D(o)?0:La.octant(r,o)},zn.prototype.getData=function(){return this._data},zn.prototype.addIntersection=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];this.addIntersectionNode(r,o)}else if(arguments.length===4){var a=arguments[0],l=arguments[1],h=arguments[3],m=new P(a.getIntersection(h));this.addIntersection(m,l)}},zn.prototype.toString=function(){return wt.toLineString(new se(this._pts))},zn.prototype.getNodeList=function(){return this._nodeList},zn.prototype.addIntersectionNode=function(r,o){var a=o,l=a+1;if(l<this._pts.length){var h=this._pts[l];r.equals2D(h)&&(a=l)}return this._nodeList.add(r,a)},zn.prototype.addIntersections=function(r,o,a){for(var l=0;l<r.getIntersectionNum();l++)this.addIntersection(r,o,a,l)},zn.prototype.interfaces_=function(){return[dc]},zn.prototype.getClass=function(){return zn},zn.getNodedSubstrings=function(){if(arguments.length===1){var r=arguments[0],o=new O;return zn.getNodedSubstrings(r,o),o}if(arguments.length===2)for(var a=arguments[0],l=arguments[1],h=a.iterator();h.hasNext();)h.next().getNodeList().addSplitEdges(l)};var ae=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new P,this.p1=new P;else if(arguments.length===1){var r=arguments[0];this.p0=new P(r.p0),this.p1=new P(r.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var o=arguments[0],a=arguments[1],l=arguments[2],h=arguments[3];this.p0=new P(o,a),this.p1=new P(l,h)}},E1={serialVersionUID:{configurable:!0}};ae.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ae.prototype.orientationIndex=function(){if(arguments[0]instanceof ae){var r=arguments[0],o=ot.orientationIndex(this.p0,this.p1,r.p0),a=ot.orientationIndex(this.p0,this.p1,r.p1);return o>=0&&a>=0||o<=0&&a<=0?Math.max(o,a):0}if(arguments[0]instanceof P){var l=arguments[0];return ot.orientationIndex(this.p0,this.p1,l)}},ae.prototype.toGeometry=function(r){return r.createLineString([this.p0,this.p1])},ae.prototype.isVertical=function(){return this.p0.x===this.p1.x},ae.prototype.equals=function(r){if(!(r instanceof ae))return!1;var o=r;return this.p0.equals(o.p0)&&this.p1.equals(o.p1)},ae.prototype.intersection=function(r){var o=new N;return o.computeIntersection(this.p0,this.p1,r.p0,r.p1),o.hasIntersection()?o.getIntersection(0):null},ae.prototype.project=function(){if(arguments[0]instanceof P){var r=arguments[0];if(r.equals(this.p0)||r.equals(this.p1))return new P(r);var o=this.projectionFactor(r),a=new P;return a.x=this.p0.x+o*(this.p1.x-this.p0.x),a.y=this.p0.y+o*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof ae){var l=arguments[0],h=this.projectionFactor(l.p0),m=this.projectionFactor(l.p1);if(h>=1&&m>=1||h<=0&&m<=0)return null;var S=this.project(l.p0);h<0&&(S=this.p0),h>1&&(S=this.p1);var C=this.project(l.p1);return m<0&&(C=this.p0),m>1&&(C=this.p1),new ae(S,C)}},ae.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ae.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ae.prototype.getCoordinate=function(r){return r===0?this.p0:this.p1},ae.prototype.distancePerpendicular=function(r){return ot.distancePointLinePerpendicular(r,this.p0,this.p1)},ae.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ae.prototype.midPoint=function(){return ae.midPoint(this.p0,this.p1)},ae.prototype.projectionFactor=function(r){if(r.equals(this.p0))return 0;if(r.equals(this.p1))return 1;var o=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,l=o*o+a*a;return l<=0?w.NaN:((r.x-this.p0.x)*o+(r.y-this.p0.y)*a)/l},ae.prototype.closestPoints=function(r){var o=this.intersection(r);if(o!==null)return[o,o];var a=new Array(2).fill(null),l=w.MAX_VALUE,h=null,m=this.closestPoint(r.p0);l=m.distance(r.p0),a[0]=m,a[1]=r.p0;var S=this.closestPoint(r.p1);(h=S.distance(r.p1))<l&&(l=h,a[0]=S,a[1]=r.p1);var C=r.closestPoint(this.p0);(h=C.distance(this.p0))<l&&(l=h,a[0]=this.p0,a[1]=C);var z=r.closestPoint(this.p1);return(h=z.distance(this.p1))<l&&(l=h,a[0]=this.p1,a[1]=z),a},ae.prototype.closestPoint=function(r){var o=this.projectionFactor(r);return o>0&&o<1?this.project(r):this.p0.distance(r)<this.p1.distance(r)?this.p0:this.p1},ae.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ae.prototype.getLength=function(){return this.p0.distance(this.p1)},ae.prototype.compareTo=function(r){var o=r,a=this.p0.compareTo(o.p0);return a!==0?a:this.p1.compareTo(o.p1)},ae.prototype.reverse=function(){var r=this.p0;this.p0=this.p1,this.p1=r},ae.prototype.equalsTopo=function(r){return this.p0.equals(r.p0)&&(this.p1.equals(r.p1)||this.p0.equals(r.p1))&&this.p1.equals(r.p0)},ae.prototype.lineIntersection=function(r){try{return Gt.intersection(this.p0,this.p1,r.p0,r.p1)}catch(o){if(!(o instanceof $t))throw o}return null},ae.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ae.prototype.pointAlongOffset=function(r,o){var a=this.p0.x+r*(this.p1.x-this.p0.x),l=this.p0.y+r*(this.p1.y-this.p0.y),h=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,S=Math.sqrt(h*h+m*m),C=0,z=0;if(o!==0){if(S<=0)throw new Error("Cannot compute offset from zero-length line segment");C=o*h/S,z=o*m/S}return new P(a-z,l+C)},ae.prototype.setCoordinates=function(){if(arguments.length===1){var r=arguments[0];this.setCoordinates(r.p0,r.p1)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this.p0.x=o.x,this.p0.y=o.y,this.p1.x=a.x,this.p1.y=a.y}},ae.prototype.segmentFraction=function(r){var o=this.projectionFactor(r);return o<0?o=0:(o>1||w.isNaN(o))&&(o=1),o},ae.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ae.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ae.prototype.distance=function(){if(arguments[0]instanceof ae){var r=arguments[0];return ot.distanceLineLine(this.p0,this.p1,r.p0,r.p1)}if(arguments[0]instanceof P){var o=arguments[0];return ot.distancePointLine(o,this.p0,this.p1)}},ae.prototype.pointAlong=function(r){var o=new P;return o.x=this.p0.x+r*(this.p1.x-this.p0.x),o.y=this.p0.y+r*(this.p1.y-this.p0.y),o},ae.prototype.hashCode=function(){var r=w.doubleToLongBits(this.p0.x);r^=31*w.doubleToLongBits(this.p0.y);var o=Math.trunc(r)^Math.trunc(r>>32),a=w.doubleToLongBits(this.p1.x);return a^=31*w.doubleToLongBits(this.p1.y),o^(Math.trunc(a)^Math.trunc(a>>32))},ae.prototype.interfaces_=function(){return[B,t]},ae.prototype.getClass=function(){return ae},ae.midPoint=function(r,o){return new P((r.x+o.x)/2,(r.y+o.y)/2)},E1.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ae,E1);var gc=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new ae,this._overlapSeg2=new ae};gc.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];r.getLineSegment(o,this._overlapSeg1),a.getLineSegment(l,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},gc.prototype.interfaces_=function(){return[]},gc.prototype.getClass=function(){return gc};var ti=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];this._pts=r,this._start=o,this._end=a,this._context=l};ti.prototype.getLineSegment=function(r,o){o.p0=this._pts[r],o.p1=this._pts[r+1]},ti.prototype.computeSelect=function(r,o,a,l){var h=this._pts[o],m=this._pts[a];if(l.tempEnv1.init(h,m),a-o==1)return l.select(this,o),null;if(!r.intersects(l.tempEnv1))return null;var S=Math.trunc((o+a)/2);o<S&&this.computeSelect(r,o,S,l),S<a&&this.computeSelect(r,S,a,l)},ti.prototype.getCoordinates=function(){for(var r=new Array(this._end-this._start+1).fill(null),o=0,a=this._start;a<=this._end;a++)r[o++]=this._pts[a];return r},ti.prototype.computeOverlaps=function(r,o){this.computeOverlapsInternal(this._start,this._end,r,r._start,r._end,o)},ti.prototype.setId=function(r){this._id=r},ti.prototype.select=function(r,o){this.computeSelect(r,this._start,this._end,o)},ti.prototype.getEnvelope=function(){if(this._env===null){var r=this._pts[this._start],o=this._pts[this._end];this._env=new Ct(r,o)}return this._env},ti.prototype.getEndIndex=function(){return this._end},ti.prototype.getStartIndex=function(){return this._start},ti.prototype.getContext=function(){return this._context},ti.prototype.getId=function(){return this._id},ti.prototype.computeOverlapsInternal=function(r,o,a,l,h,m){var S=this._pts[r],C=this._pts[o],z=a._pts[l],K=a._pts[h];if(o-r==1&&h-l==1)return m.overlap(this,r,a,l),null;if(m.tempEnv1.init(S,C),m.tempEnv2.init(z,K),!m.tempEnv1.intersects(m.tempEnv2))return null;var mt=Math.trunc((r+o)/2),yt=Math.trunc((l+h)/2);r<mt&&(l<yt&&this.computeOverlapsInternal(r,mt,a,l,yt,m),yt<h&&this.computeOverlapsInternal(r,mt,a,yt,h,m)),mt<o&&(l<yt&&this.computeOverlapsInternal(mt,o,a,l,yt,m),yt<h&&this.computeOverlapsInternal(mt,o,a,yt,h,m))},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti};var Qi=function(){};Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi},Qi.getChainStartIndices=function(r){var o=0,a=new O;a.add(new it(o));do{var l=Qi.findChainEnd(r,o);a.add(new it(l)),o=l}while(o<r.length-1);return Qi.toIntArray(a)},Qi.findChainEnd=function(r,o){for(var a=o;a<r.length-1&&r[a].equals2D(r[a+1]);)a++;if(a>=r.length-1)return r.length-1;for(var l=mn.quadrant(r[a],r[a+1]),h=o+1;h<r.length&&!(!r[h-1].equals2D(r[h])&&mn.quadrant(r[h-1],r[h])!==l);)h++;return h-1},Qi.getChains=function(){if(arguments.length===1){var r=arguments[0];return Qi.getChains(r,null)}if(arguments.length===2){for(var o=arguments[0],a=arguments[1],l=new O,h=Qi.getChainStartIndices(o),m=0;m<h.length-1;m++){var S=new ti(o,h[m],h[m+1],a);l.add(S)}return l}},Qi.toIntArray=function(r){for(var o=new Array(r.size()).fill(null),a=0;a<o.length;a++)o[a]=r.get(a).intValue();return o};var zs=function(){};zs.prototype.computeNodes=function(r){},zs.prototype.getNodedSubstrings=function(){},zs.prototype.interfaces_=function(){return[]},zs.prototype.getClass=function(){return zs};var mc=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setSegmentIntersector(r)}}};mc.prototype.setSegmentIntersector=function(r){this._segInt=r},mc.prototype.interfaces_=function(){return[zs]},mc.prototype.getClass=function(){return mc};var Pg=function(r){function o(l){l?r.call(this,l):r.call(this),this._monoChains=new O,this._index=new _1,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var a={SegmentOverlapAction:{configurable:!0}};return o.prototype.getMonotoneChains=function(){return this._monoChains},o.prototype.getNodedSubstrings=function(){return zn.getNodedSubstrings(this._nodedSegStrings)},o.prototype.getIndex=function(){return this._index},o.prototype.add=function(l){for(var h=Qi.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var m=h.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},o.prototype.computeNodes=function(l){this._nodedSegStrings=l;for(var h=l.iterator();h.hasNext();)this.add(h.next());this.intersectChains()},o.prototype.intersectChains=function(){for(var l=new S1(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var m=h.next(),S=this._index.query(m.getEnvelope()).iterator();S.hasNext();){var C=S.next();if(C.getId()>m.getId()&&(m.computeOverlaps(C,l),this._nOverlaps++),this._segInt.isDone())return null}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},a.SegmentOverlapAction.get=function(){return S1},Object.defineProperties(o,a),o}(mc),S1=function(r){function o(){r.call(this),this._si=null;var a=arguments[0];this._si=a}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.overlap=function(){if(arguments.length!==4)return r.prototype.overlap.apply(this,arguments);var a=arguments[0],l=arguments[1],h=arguments[2],m=arguments[3],S=a.getContext(),C=h.getContext();this._si.processIntersections(S,l,C,m)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(gc),Ke=function r(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var o=arguments[0];this.setQuadrantSegments(o)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.setQuadrantSegments(a),this.setEndCapStyle(l)}else if(arguments.length===4){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(m),this.setJoinStyle(S),this.setMitreLimit(C)}}},qo={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Ke.prototype.getEndCapStyle=function(){return this._endCapStyle},Ke.prototype.isSingleSided=function(){return this._isSingleSided},Ke.prototype.setQuadrantSegments=function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=Ke.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ke.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==Ke.JOIN_ROUND&&(this._quadrantSegments=Ke.DEFAULT_QUADRANT_SEGMENTS)},Ke.prototype.getJoinStyle=function(){return this._joinStyle},Ke.prototype.setJoinStyle=function(r){this._joinStyle=r},Ke.prototype.setSimplifyFactor=function(r){this._simplifyFactor=r<0?0:r},Ke.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ke.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ke.prototype.setEndCapStyle=function(r){this._endCapStyle=r},Ke.prototype.getMitreLimit=function(){return this._mitreLimit},Ke.prototype.setMitreLimit=function(r){this._mitreLimit=r},Ke.prototype.setSingleSided=function(r){this._isSingleSided=r},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke},Ke.bufferDistanceError=function(r){var o=Math.PI/2/r;return 1-Math.cos(o/2)},qo.CAP_ROUND.get=function(){return 1},qo.CAP_FLAT.get=function(){return 2},qo.CAP_SQUARE.get=function(){return 3},qo.JOIN_ROUND.get=function(){return 1},qo.JOIN_MITRE.get=function(){return 2},qo.JOIN_BEVEL.get=function(){return 3},qo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},qo.DEFAULT_MITRE_LIMIT.get=function(){return 5},qo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Ke,qo);var Fn=function(r){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ot.COUNTERCLOCKWISE,this._inputLine=r||null},yc={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Fn.prototype.isDeletable=function(r,o,a,l){var h=this._inputLine[r],m=this._inputLine[o],S=this._inputLine[a];return!!this.isConcave(h,m,S)&&!!this.isShallow(h,m,S,l)&&this.isShallowSampled(h,m,r,a,l)},Fn.prototype.deleteShallowConcavities=function(){for(var r=1,o=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(o),l=!1;a<this._inputLine.length;){var h=!1;this.isDeletable(r,o,a,this._distanceTol)&&(this._isDeleted[o]=Fn.DELETE,h=!0,l=!0),r=h?a:o,o=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(o)}return l},Fn.prototype.isShallowConcavity=function(r,o,a,l){return ot.computeOrientation(r,o,a)!==this._angleOrientation?!1:ot.distancePointLine(o,r,a)<l},Fn.prototype.isShallowSampled=function(r,o,a,l,h){var m=Math.trunc((l-a)/Fn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var S=a;S<l;S+=m)if(!this.isShallow(r,o,this._inputLine[S],h))return!1;return!0},Fn.prototype.isConcave=function(r,o,a){var l=ot.computeOrientation(r,o,a)===this._angleOrientation;return l},Fn.prototype.simplify=function(r){this._distanceTol=Math.abs(r),r<0&&(this._angleOrientation=ot.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var o=!1;do o=this.deleteShallowConcavities();while(o);return this.collapseLine()},Fn.prototype.findNextNonDeletedIndex=function(r){for(var o=r+1;o<this._inputLine.length&&this._isDeleted[o]===Fn.DELETE;)o++;return o},Fn.prototype.isShallow=function(r,o,a,l){return ot.distancePointLine(o,r,a)<l},Fn.prototype.collapseLine=function(){for(var r=new J,o=0;o<this._inputLine.length;o++)this._isDeleted[o]!==Fn.DELETE&&r.add(this._inputLine[o]);return r.toCoordinateArray()},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.simplify=function(r,o){return new Fn(r).simplify(o)},yc.INIT.get=function(){return 0},yc.DELETE.get=function(){return 1},yc.KEEP.get=function(){return 1},yc.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Fn,yc);var mi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new O},w1={COORDINATE_ARRAY_TYPE:{configurable:!0}};mi.prototype.getCoordinates=function(){return this._ptList.toArray(mi.COORDINATE_ARRAY_TYPE)},mi.prototype.setPrecisionModel=function(r){this._precisionModel=r},mi.prototype.addPt=function(r){var o=new P(r);if(this._precisionModel.makePrecise(o),this.isRedundant(o))return null;this._ptList.add(o)},mi.prototype.revere=function(){},mi.prototype.addPts=function(r,o){if(o)for(var a=0;a<r.length;a++)this.addPt(r[a]);else for(var l=r.length-1;l>=0;l--)this.addPt(r[l])},mi.prototype.isRedundant=function(r){if(this._ptList.size()<1)return!1;var o=this._ptList.get(this._ptList.size()-1);return r.distance(o)<this._minimimVertexDistance},mi.prototype.toString=function(){return new me().createLineString(this.getCoordinates()).toString()},mi.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var r=new P(this._ptList.get(0)),o=this._ptList.get(this._ptList.size()-1);if(r.equals(o))return null;this._ptList.add(r)},mi.prototype.setMinimumVertexDistance=function(r){this._minimimVertexDistance=r},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi},w1.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(mi,w1);var xe=function(){},Na={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};xe.prototype.interfaces_=function(){return[]},xe.prototype.getClass=function(){return xe},xe.toDegrees=function(r){return 180*r/Math.PI},xe.normalize=function(r){for(;r>Math.PI;)r-=xe.PI_TIMES_2;for(;r<=-Math.PI;)r+=xe.PI_TIMES_2;return r},xe.angle=function(){if(arguments.length===1){var r=arguments[0];return Math.atan2(r.y,r.x)}if(arguments.length===2){var o=arguments[0],a=arguments[1],l=a.x-o.x,h=a.y-o.y;return Math.atan2(h,l)}},xe.isAcute=function(r,o,a){var l=r.x-o.x,h=r.y-o.y;return l*(a.x-o.x)+h*(a.y-o.y)>0},xe.isObtuse=function(r,o,a){var l=r.x-o.x,h=r.y-o.y;return l*(a.x-o.x)+h*(a.y-o.y)<0},xe.interiorAngle=function(r,o,a){var l=xe.angle(o,r),h=xe.angle(o,a);return Math.abs(h-l)},xe.normalizePositive=function(r){if(r<0){for(;r<0;)r+=xe.PI_TIMES_2;r>=xe.PI_TIMES_2&&(r=0)}else{for(;r>=xe.PI_TIMES_2;)r-=xe.PI_TIMES_2;r<0&&(r=0)}return r},xe.angleBetween=function(r,o,a){var l=xe.angle(o,r),h=xe.angle(o,a);return xe.diff(l,h)},xe.diff=function(r,o){var a=null;return(a=r<o?o-r:r-o)>Math.PI&&(a=2*Math.PI-a),a},xe.toRadians=function(r){return r*Math.PI/180},xe.getTurn=function(r,o){var a=Math.sin(o-r);return a>0?xe.COUNTERCLOCKWISE:a<0?xe.CLOCKWISE:xe.NONE},xe.angleBetweenOriented=function(r,o,a){var l=xe.angle(o,r),h=xe.angle(o,a)-l;return h<=-Math.PI?h+xe.PI_TIMES_2:h>Math.PI?h-xe.PI_TIMES_2:h},Na.PI_TIMES_2.get=function(){return 2*Math.PI},Na.PI_OVER_2.get=function(){return Math.PI/2},Na.PI_OVER_4.get=function(){return Math.PI/4},Na.COUNTERCLOCKWISE.get=function(){return ot.COUNTERCLOCKWISE},Na.CLOCKWISE.get=function(){return ot.CLOCKWISE},Na.NONE.get=function(){return ot.COLLINEAR},Object.defineProperties(xe,Na);var bn=function r(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ae,this._seg1=new ae,this._offset0=new ae,this._offset1=new ae,this._side=0,this._hasNarrowConcaveAngle=!1;var o=arguments[0],a=arguments[1],l=arguments[2];this._precisionModel=o,this._bufParams=a,this._li=new N,this._filletAngleQuantum=Math.PI/2/a.getQuadrantSegments(),a.getQuadrantSegments()>=8&&a.getJoinStyle()===Ke.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},vc={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};bn.prototype.addNextSegment=function(r,o){if(this._s0=this._s1,this._s1=this._s2,this._s2=r,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var a=ot.computeOrientation(this._s0,this._s1,this._s2),l=a===ot.CLOCKWISE&&this._side===Ft.LEFT||a===ot.COUNTERCLOCKWISE&&this._side===Ft.RIGHT;a===0?this.addCollinear(o):l?this.addOutsideTurn(a,o):this.addInsideTurn(a,o)},bn.prototype.addLineEndCap=function(r,o){var a=new ae(r,o),l=new ae;this.computeOffsetSegment(a,Ft.LEFT,this._distance,l);var h=new ae;this.computeOffsetSegment(a,Ft.RIGHT,this._distance,h);var m=o.x-r.x,S=o.y-r.y,C=Math.atan2(S,m);switch(this._bufParams.getEndCapStyle()){case Ke.CAP_ROUND:this._segList.addPt(l.p1),this.addFilletArc(o,C+Math.PI/2,C-Math.PI/2,ot.CLOCKWISE,this._distance),this._segList.addPt(h.p1);break;case Ke.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case Ke.CAP_SQUARE:var z=new P;z.x=Math.abs(this._distance)*Math.cos(C),z.y=Math.abs(this._distance)*Math.sin(C);var K=new P(l.p1.x+z.x,l.p1.y+z.y),mt=new P(h.p1.x+z.x,h.p1.y+z.y);this._segList.addPt(K),this._segList.addPt(mt)}},bn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},bn.prototype.addMitreJoin=function(r,o,a,l){var h=!0,m=null;try{m=Gt.intersection(o.p0,o.p1,a.p0,a.p1),(l<=0?1:m.distance(r)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(S){if(!(S instanceof $t))throw S;m=new P(0,0),h=!1}h?this._segList.addPt(m):this.addLimitedMitreJoin(o,a,l,this._bufParams.getMitreLimit())},bn.prototype.addFilletCorner=function(r,o,a,l,h){var m=o.x-r.x,S=o.y-r.y,C=Math.atan2(S,m),z=a.x-r.x,K=a.y-r.y,mt=Math.atan2(K,z);l===ot.CLOCKWISE?C<=mt&&(C+=2*Math.PI):C>=mt&&(C-=2*Math.PI),this._segList.addPt(o),this.addFilletArc(r,C,mt,l,h),this._segList.addPt(a)},bn.prototype.addOutsideTurn=function(r,o){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*bn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ke.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ke.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(o&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,r,this._distance),this._segList.addPt(this._offset1.p0))},bn.prototype.createSquare=function(r){this._segList.addPt(new P(r.x+this._distance,r.y+this._distance)),this._segList.addPt(new P(r.x+this._distance,r.y-this._distance)),this._segList.addPt(new P(r.x-this._distance,r.y-this._distance)),this._segList.addPt(new P(r.x-this._distance,r.y+this._distance)),this._segList.closeRing()},bn.prototype.addSegments=function(r,o){this._segList.addPts(r,o)},bn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},bn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},bn.prototype.initSideSegments=function(r,o,a){this._s1=r,this._s2=o,this._side=a,this._seg1.setCoordinates(r,o),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)},bn.prototype.addLimitedMitreJoin=function(r,o,a,l){var h=this._seg0.p1,m=xe.angle(h,this._seg0.p0),S=xe.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,C=xe.normalize(m+S),z=xe.normalize(C+Math.PI),K=l*a,mt=a-K*Math.abs(Math.sin(S)),yt=h.x+K*Math.cos(z),zt=h.y+K*Math.sin(z),qt=new P(yt,zt),jt=new ae(h,qt),ue=jt.pointAlongOffset(1,mt),dn=jt.pointAlongOffset(1,-mt);this._side===Ft.LEFT?(this._segList.addPt(ue),this._segList.addPt(dn)):(this._segList.addPt(dn),this._segList.addPt(ue))},bn.prototype.computeOffsetSegment=function(r,o,a,l){var h=o===Ft.LEFT?1:-1,m=r.p1.x-r.p0.x,S=r.p1.y-r.p0.y,C=Math.sqrt(m*m+S*S),z=h*a*m/C,K=h*a*S/C;l.p0.x=r.p0.x-K,l.p0.y=r.p0.y+z,l.p1.x=r.p1.x-K,l.p1.y=r.p1.y+z},bn.prototype.addFilletArc=function(r,o,a,l,h){var m=l===ot.CLOCKWISE?-1:1,S=Math.abs(o-a),C=Math.trunc(S/this._filletAngleQuantum+.5);if(C<1)return null;for(var z=S/C,K=0,mt=new P;K<S;){var yt=o+m*K;mt.x=r.x+h*Math.cos(yt),mt.y=r.y+h*Math.sin(yt),this._segList.addPt(mt),K+=z}},bn.prototype.addInsideTurn=function(r,o){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*bn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new P((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(a);var l=new P((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},bn.prototype.createCircle=function(r){var o=new P(r.x+this._distance,r.y);this._segList.addPt(o),this.addFilletArc(r,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},bn.prototype.addBevelJoin=function(r,o){this._segList.addPt(r.p1),this._segList.addPt(o.p0)},bn.prototype.init=function(r){this._distance=r,this._maxCurveSegmentError=r*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new mi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(r*bn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},bn.prototype.addCollinear=function(r){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ke.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ke.JOIN_MITRE?(r&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ot.CLOCKWISE,this._distance))},bn.prototype.closeRing=function(){this._segList.closeRing()},bn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},vc.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},vc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},vc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},vc.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(bn,vc);var Vr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],o=arguments[1];this._precisionModel=r,this._bufParams=o};Vr.prototype.getOffsetCurve=function(r,o){if(this._distance=o,o===0)return null;var a=o<0,l=Math.abs(o),h=this.getSegGen(l);r.length<=1?this.computePointCurve(r[0],h):this.computeOffsetCurve(r,a,h);var m=h.getCoordinates();return a&&et.reverse(m),m},Vr.prototype.computeSingleSidedBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){a.addSegments(r,!0);var h=Fn.simplify(r,-l),m=h.length-1;a.initSideSegments(h[m],h[m-1],Ft.LEFT),a.addFirstSegment();for(var S=m-2;S>=0;S--)a.addNextSegment(h[S],!0)}else{a.addSegments(r,!1);var C=Fn.simplify(r,l),z=C.length-1;a.initSideSegments(C[0],C[1],Ft.LEFT),a.addFirstSegment();for(var K=2;K<=z;K++)a.addNextSegment(C[K],!0)}a.addLastSegment(),a.closeRing()},Vr.prototype.computeRingBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);o===Ft.RIGHT&&(l=-l);var h=Fn.simplify(r,l),m=h.length-1;a.initSideSegments(h[m-1],h[0],o);for(var S=1;S<=m;S++){var C=S!==1;a.addNextSegment(h[S],C)}a.closeRing()},Vr.prototype.computeLineBufferCurve=function(r,o){var a=this.simplifyTolerance(this._distance),l=Fn.simplify(r,a),h=l.length-1;o.initSideSegments(l[0],l[1],Ft.LEFT);for(var m=2;m<=h;m++)o.addNextSegment(l[m],!0);o.addLastSegment(),o.addLineEndCap(l[h-1],l[h]);var S=Fn.simplify(r,-a),C=S.length-1;o.initSideSegments(S[C],S[C-1],Ft.LEFT);for(var z=C-2;z>=0;z--)o.addNextSegment(S[z],!0);o.addLastSegment(),o.addLineEndCap(S[1],S[0]),o.closeRing()},Vr.prototype.computePointCurve=function(r,o){switch(this._bufParams.getEndCapStyle()){case Ke.CAP_ROUND:o.createCircle(r);break;case Ke.CAP_SQUARE:o.createSquare(r)}},Vr.prototype.getLineCurve=function(r,o){if(this._distance=o,o<0&&!this._bufParams.isSingleSided()||o===0)return null;var a=Math.abs(o),l=this.getSegGen(a);if(r.length<=1)this.computePointCurve(r[0],l);else if(this._bufParams.isSingleSided()){var h=o<0;this.computeSingleSidedBufferCurve(r,h,l)}else this.computeLineBufferCurve(r,l);return l.getCoordinates()},Vr.prototype.getBufferParameters=function(){return this._bufParams},Vr.prototype.simplifyTolerance=function(r){return r*this._bufParams.getSimplifyFactor()},Vr.prototype.getRingCurve=function(r,o,a){if(this._distance=a,r.length<=2)return this.getLineCurve(r,a);if(a===0)return Vr.copyCoordinates(r);var l=this.getSegGen(a);return this.computeRingBufferCurve(r,o,l),l.getCoordinates()},Vr.prototype.computeOffsetCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){var h=Fn.simplify(r,-l),m=h.length-1;a.initSideSegments(h[m],h[m-1],Ft.LEFT),a.addFirstSegment();for(var S=m-2;S>=0;S--)a.addNextSegment(h[S],!0)}else{var C=Fn.simplify(r,l),z=C.length-1;a.initSideSegments(C[0],C[1],Ft.LEFT),a.addFirstSegment();for(var K=2;K<=z;K++)a.addNextSegment(C[K],!0)}a.addLastSegment()},Vr.prototype.getSegGen=function(r){return new bn(this._precisionModel,this._bufParams,r)},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr},Vr.copyCoordinates=function(r){for(var o=new Array(r.length).fill(null),a=0;a<o.length;a++)o[a]=new P(r[a]);return o};var Oa=function(){this._subgraphs=null,this._seg=new ae,this._cga=new ot;var r=arguments[0];this._subgraphs=r},M1={DepthSegment:{configurable:!0}};Oa.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var r=arguments[0],o=new O,a=this._subgraphs.iterator();a.hasNext();){var l=a.next(),h=l.getEnvelope();r.y<h.getMinY()||r.y>h.getMaxY()||this.findStabbedSegments(r,l.getDirectedEdges(),o)}return o}if(arguments.length===3){if($(arguments[2],ht)&&arguments[0]instanceof P&&arguments[1]instanceof Ig){for(var m=arguments[0],S=arguments[1],C=arguments[2],z=S.getEdge().getCoordinates(),K=0;K<z.length-1;K++)if(this._seg.p0=z[K],this._seg.p1=z[K+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||ot.computeOrientation(this._seg.p0,this._seg.p1,m)===ot.RIGHT)){var mt=S.getDepth(Ft.LEFT);this._seg.p0.equals(z[K])||(mt=S.getDepth(Ft.RIGHT));var yt=new Gs(this._seg,mt);C.add(yt)}}else if($(arguments[2],ht)&&arguments[0]instanceof P&&$(arguments[1],ht))for(var zt=arguments[0],qt=arguments[1],jt=arguments[2],ue=qt.iterator();ue.hasNext();){var dn=ue.next();dn.isForward()&&this.findStabbedSegments(zt,dn,jt)}}},Oa.prototype.getDepth=function(r){var o=this.findStabbedSegments(r);return o.size()===0?0:zi.min(o)._leftDepth},Oa.prototype.interfaces_=function(){return[]},Oa.prototype.getClass=function(){return Oa},M1.DepthSegment.get=function(){return Gs},Object.defineProperties(Oa,M1);var Gs=function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],o=arguments[1];this._upwardSeg=new ae(r),this._leftDepth=o};Gs.prototype.compareTo=function(r){var o=r;if(this._upwardSeg.minX()>=o._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=o._upwardSeg.minX())return-1;var a=this._upwardSeg.orientationIndex(o._upwardSeg);return a!==0||(a=-1*o._upwardSeg.orientationIndex(this._upwardSeg))!=0?a:this._upwardSeg.compareTo(o._upwardSeg)},Gs.prototype.compareX=function(r,o){var a=r.p0.compareTo(o.p0);return a!==0?a:r.p1.compareTo(o.p1)},Gs.prototype.toString=function(){return this._upwardSeg.toString()},Gs.prototype.interfaces_=function(){return[B]},Gs.prototype.getClass=function(){return Gs};var Qe=function(r,o,a){this.p0=r||null,this.p1=o||null,this.p2=a||null};Qe.prototype.area=function(){return Qe.area(this.p0,this.p1,this.p2)},Qe.prototype.signedArea=function(){return Qe.signedArea(this.p0,this.p1,this.p2)},Qe.prototype.interpolateZ=function(r){if(r===null)throw new T("Supplied point is null.");return Qe.interpolateZ(r,this.p0,this.p1,this.p2)},Qe.prototype.longestSideLength=function(){return Qe.longestSideLength(this.p0,this.p1,this.p2)},Qe.prototype.isAcute=function(){return Qe.isAcute(this.p0,this.p1,this.p2)},Qe.prototype.circumcentre=function(){return Qe.circumcentre(this.p0,this.p1,this.p2)},Qe.prototype.area3D=function(){return Qe.area3D(this.p0,this.p1,this.p2)},Qe.prototype.centroid=function(){return Qe.centroid(this.p0,this.p1,this.p2)},Qe.prototype.inCentre=function(){return Qe.inCentre(this.p0,this.p1,this.p2)},Qe.prototype.interfaces_=function(){return[]},Qe.prototype.getClass=function(){return Qe},Qe.area=function(r,o,a){return Math.abs(((a.x-r.x)*(o.y-r.y)-(o.x-r.x)*(a.y-r.y))/2)},Qe.signedArea=function(r,o,a){return((a.x-r.x)*(o.y-r.y)-(o.x-r.x)*(a.y-r.y))/2},Qe.det=function(r,o,a,l){return r*l-o*a},Qe.interpolateZ=function(r,o,a,l){var h=o.x,m=o.y,S=a.x-h,C=l.x-h,z=a.y-m,K=l.y-m,mt=S*K-C*z,yt=r.x-h,zt=r.y-m,qt=(K*yt-C*zt)/mt,jt=(-z*yt+S*zt)/mt;return o.z+qt*(a.z-o.z)+jt*(l.z-o.z)},Qe.longestSideLength=function(r,o,a){var l=r.distance(o),h=o.distance(a),m=a.distance(r),S=l;return h>S&&(S=h),m>S&&(S=m),S},Qe.isAcute=function(r,o,a){return!!xe.isAcute(r,o,a)&&!!xe.isAcute(o,a,r)&&!!xe.isAcute(a,r,o)},Qe.circumcentre=function(r,o,a){var l=a.x,h=a.y,m=r.x-l,S=r.y-h,C=o.x-l,z=o.y-h,K=2*Qe.det(m,S,C,z),mt=Qe.det(S,m*m+S*S,z,C*C+z*z),yt=Qe.det(m,m*m+S*S,C,C*C+z*z);return new P(l-mt/K,h+yt/K)},Qe.perpendicularBisector=function(r,o){var a=o.x-r.x,l=o.y-r.y,h=new Gt(r.x+a/2,r.y+l/2,1),m=new Gt(r.x-l+a/2,r.y+a+l/2,1);return new Gt(h,m)},Qe.angleBisector=function(r,o,a){var l=o.distance(r),h=l/(l+o.distance(a)),m=a.x-r.x,S=a.y-r.y;return new P(r.x+h*m,r.y+h*S)},Qe.area3D=function(r,o,a){var l=o.x-r.x,h=o.y-r.y,m=o.z-r.z,S=a.x-r.x,C=a.y-r.y,z=a.z-r.z,K=h*z-m*C,mt=m*S-l*z,yt=l*C-h*S,zt=K*K+mt*mt+yt*yt,qt=Math.sqrt(zt)/2;return qt},Qe.centroid=function(r,o,a){var l=(r.x+o.x+a.x)/3,h=(r.y+o.y+a.y)/3;return new P(l,h)},Qe.inCentre=function(r,o,a){var l=o.distance(a),h=r.distance(a),m=r.distance(o),S=l+h+m,C=(l*r.x+h*o.x+m*a.x)/S,z=(l*r.y+h*o.y+m*a.y)/S;return new P(C,z)};var Ii=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new O;var r=arguments[0],o=arguments[1],a=arguments[2];this._inputGeom=r,this._distance=o,this._curveBuilder=a};Ii.prototype.addPoint=function(r){if(this._distance<=0)return null;var o=r.getCoordinates(),a=this._curveBuilder.getLineCurve(o,this._distance);this.addCurve(a,V.EXTERIOR,V.INTERIOR)},Ii.prototype.addPolygon=function(r){var o=this._distance,a=Ft.LEFT;this._distance<0&&(o=-this._distance,a=Ft.RIGHT);var l=r.getExteriorRing(),h=et.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&h.length<3)return null;this.addPolygonRing(h,o,a,V.EXTERIOR,V.INTERIOR);for(var m=0;m<r.getNumInteriorRing();m++){var S=r.getInteriorRingN(m),C=et.removeRepeatedPoints(S.getCoordinates());this._distance>0&&this.isErodedCompletely(S,-this._distance)||this.addPolygonRing(C,o,Ft.opposite(a),V.INTERIOR,V.EXTERIOR)}},Ii.prototype.isTriangleErodedCompletely=function(r,o){var a=new Qe(r[0],r[1],r[2]),l=a.inCentre();return ot.distancePointLine(l,a.p0,a.p1)<Math.abs(o)},Ii.prototype.addLineString=function(r){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var o=et.removeRepeatedPoints(r.getCoordinates()),a=this._curveBuilder.getLineCurve(o,this._distance);this.addCurve(a,V.EXTERIOR,V.INTERIOR)},Ii.prototype.addCurve=function(r,o,a){if(r===null||r.length<2)return null;var l=new zn(r,new pn(0,V.BOUNDARY,o,a));this._curveList.add(l)},Ii.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ii.prototype.addPolygonRing=function(r,o,a,l,h){if(o===0&&r.length<fe.MINIMUM_VALID_SIZE)return null;var m=l,S=h;r.length>=fe.MINIMUM_VALID_SIZE&&ot.isCCW(r)&&(m=h,S=l,a=Ft.opposite(a));var C=this._curveBuilder.getRingCurve(r,a,o);this.addCurve(C,m,S)},Ii.prototype.add=function(r){if(r.isEmpty())return null;r instanceof re?this.addPolygon(r):r instanceof ut?this.addLineString(r):r instanceof te?this.addPoint(r):r instanceof ve?this.addCollection(r):r instanceof Kr?this.addCollection(r):r instanceof he?this.addCollection(r):r instanceof En&&this.addCollection(r)},Ii.prototype.isErodedCompletely=function(r,o){var a=r.getCoordinates();if(a.length<4)return o<0;if(a.length===4)return this.isTriangleErodedCompletely(a,o);var l=r.getEnvelopeInternal(),h=Math.min(l.getHeight(),l.getWidth());return o<0&&2*Math.abs(o)>h},Ii.prototype.addCollection=function(r){for(var o=0;o<r.getNumGeometries();o++){var a=r.getGeometryN(o);this.add(a)}},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var Pu=function(){};Pu.prototype.locate=function(r){},Pu.prototype.interfaces_=function(){return[]},Pu.prototype.getClass=function(){return Pu};var go=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var r=arguments[0];this._parent=r,this._atStart=!0,this._index=0,this._max=r.getNumGeometries()};go.prototype.next=function(){if(this._atStart)return this._atStart=!1,go.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new i;var r=this._parent.getGeometryN(this._index++);return r instanceof En?(this._subcollectionIterator=new go(r),this._subcollectionIterator.next()):r},go.prototype.remove=function(){throw new Error(this.getClass().getName())},go.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},go.prototype.interfaces_=function(){return[pt]},go.prototype.getClass=function(){return go},go.isAtomic=function(r){return!(r instanceof En)};var yi=function(){this._geom=null;var r=arguments[0];this._geom=r};yi.prototype.locate=function(r){return yi.locate(r,this._geom)},yi.prototype.interfaces_=function(){return[Pu]},yi.prototype.getClass=function(){return yi},yi.isPointInRing=function(r,o){return!!o.getEnvelopeInternal().intersects(r)&&ot.isPointInRing(r,o.getCoordinates())},yi.containsPointInPolygon=function(r,o){if(o.isEmpty())return!1;var a=o.getExteriorRing();if(!yi.isPointInRing(r,a))return!1;for(var l=0;l<o.getNumInteriorRing();l++){var h=o.getInteriorRingN(l);if(yi.isPointInRing(r,h))return!1}return!0},yi.containsPoint=function(r,o){if(o instanceof re)return yi.containsPointInPolygon(r,o);if(o instanceof En)for(var a=new go(o);a.hasNext();){var l=a.next();if(l!==o&&yi.containsPoint(r,l))return!0}return!1},yi.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:yi.containsPoint(r,o)?V.INTERIOR:V.EXTERIOR};var mr=function(){this._edgeMap=new y,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};mr.prototype.getNextCW=function(r){this.getEdges();var o=this._edgeList.indexOf(r),a=o-1;return o===0&&(a=this._edgeList.size()-1),this._edgeList.get(a)},mr.prototype.propagateSideLabels=function(r){for(var o=V.NONE,a=this.iterator();a.hasNext();){var l=a.next().getLabel();l.isArea(r)&&l.getLocation(r,Ft.LEFT)!==V.NONE&&(o=l.getLocation(r,Ft.LEFT))}if(o===V.NONE)return null;for(var h=o,m=this.iterator();m.hasNext();){var S=m.next(),C=S.getLabel();if(C.getLocation(r,Ft.ON)===V.NONE&&C.setLocation(r,Ft.ON,h),C.isArea(r)){var z=C.getLocation(r,Ft.LEFT),K=C.getLocation(r,Ft.RIGHT);if(K!==V.NONE){if(K!==h)throw new Go("side location conflict",S.getCoordinate());z===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+S.getCoordinate()+")"),h=z}else Pt.isTrue(C.getLocation(r,Ft.LEFT)===V.NONE,"found single null side"),C.setLocation(r,Ft.RIGHT,h),C.setLocation(r,Ft.LEFT,h)}}},mr.prototype.getCoordinate=function(){var r=this.iterator();return r.hasNext()?r.next().getCoordinate():null},mr.prototype.print=function(r){Ut.out.println("EdgeEndStar: "+this.getCoordinate());for(var o=this.iterator();o.hasNext();)o.next().print(r)},mr.prototype.isAreaLabelsConsistent=function(r){return this.computeEdgeEndLabels(r.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},mr.prototype.checkAreaLabelsConsistent=function(r){var o=this.getEdges();if(o.size()<=0)return!0;var a=o.size()-1,l=o.get(a).getLabel().getLocation(r,Ft.LEFT);Pt.isTrue(l!==V.NONE,"Found unlabelled area edge");for(var h=l,m=this.iterator();m.hasNext();){var S=m.next().getLabel();Pt.isTrue(S.isArea(r),"Found non-area edge");var C=S.getLocation(r,Ft.LEFT),z=S.getLocation(r,Ft.RIGHT);if(C===z||z!==h)return!1;h=C}return!0},mr.prototype.findIndex=function(r){this.iterator();for(var o=0;o<this._edgeList.size();o++)if(this._edgeList.get(o)===r)return o;return-1},mr.prototype.iterator=function(){return this.getEdges().iterator()},mr.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new O(this._edgeMap.values())),this._edgeList},mr.prototype.getLocation=function(r,o,a){return this._ptInAreaLocation[r]===V.NONE&&(this._ptInAreaLocation[r]=yi.locate(o,a[r].getGeometry())),this._ptInAreaLocation[r]},mr.prototype.toString=function(){var r=new vt;r.append("EdgeEndStar: "+this.getCoordinate()),r.append(`
6
6
  `);for(var o=this.iterator();o.hasNext();){var a=o.next();r.append(a),r.append(`
7
- `)}return r.toString()},mr.prototype.computeEdgeEndLabels=function(r){for(var o=this.iterator();o.hasNext();)o.next().computeLabel(r)},mr.prototype.computeLabelling=function(r){this.computeEdgeEndLabels(r[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var o=[!1,!1],a=this.iterator();a.hasNext();)for(var l=a.next().getLabel(),h=0;h<2;h++)l.isLine(h)&&l.getLocation(h)===V.BOUNDARY&&(o[h]=!0);for(var m=this.iterator();m.hasNext();)for(var S=m.next(),C=S.getLabel(),z=0;z<2;z++)if(C.isAnyNull(z)){var K=V.NONE;if(o[z])K=V.EXTERIOR;else{var mt=S.getCoordinate();K=this.getLocation(z,mt,r)}C.setAllLocationsIfNull(z,K)}},mr.prototype.getDegree=function(){return this._edgeMap.size()},mr.prototype.insertEdgeEnd=function(r,o){this._edgeMap.put(r,o),this._edgeList=null},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr};var HD=function(r){function o(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var a=null,l=null,h=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var S=this._resultAreaEdgeList.get(m),C=S.getSym();if(S.getLabel().isArea())switch(a===null&&S.isInResult()&&(a=S),h){case this._SCANNING_FOR_INCOMING:if(!C.isInResult())continue;l=C,h=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!S.isInResult())continue;l.setNext(S),h=this._SCANNING_FOR_INCOMING}}if(h===this._LINKING_TO_OUTGOING){if(a===null)throw new Go("no outgoing dirEdge found",this.getCoordinate());Pt.isTrue(a.isInResult(),"unable to link last incoming dirEdge"),l.setNext(a)}},o.prototype.insert=function(a){var l=a;this.insertEdgeEnd(l,l)},o.prototype.getRightmostEdge=function(){var a=this.getEdges(),l=a.size();if(l<1)return null;var h=a.get(0);if(l===1)return h;var m=a.get(l-1),S=h.getQuadrant(),C=m.getQuadrant();return mn.isNorthern(S)&&mn.isNorthern(C)?h:mn.isNorthern(S)||mn.isNorthern(C)?h.getDy()!==0?h:m.getDy()!==0?m:(Pt.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},o.prototype.print=function(a){Ut.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var l=this.iterator();l.hasNext();){var h=l.next();a.print("out "),h.print(a),a.println(),a.print("in "),h.getSym().print(a),a.println()}},o.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new O;for(var a=this.iterator();a.hasNext();){var l=a.next();(l.isInResult()||l.getSym().isInResult())&&this._resultAreaEdgeList.add(l)}return this._resultAreaEdgeList},o.prototype.updateLabelling=function(a){for(var l=this.iterator();l.hasNext();){var h=l.next().getLabel();h.setAllLocationsIfNull(0,a.getLocation(0)),h.setAllLocationsIfNull(1,a.getLocation(1))}},o.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var a=null,l=null,h=this._edgeList.size()-1;h>=0;h--){var m=this._edgeList.get(h),S=m.getSym();l===null&&(l=S),a!==null&&S.setNext(a),a=m}l.setNext(a)},o.prototype.computeDepths=function(){if(arguments.length===1){var a=arguments[0],l=this.findIndex(a),h=a.getDepth(Ft.LEFT),m=a.getDepth(Ft.RIGHT),S=this.computeDepths(l+1,this._edgeList.size(),h);if(this.computeDepths(0,l,S)!==m)throw new Go("depth mismatch at "+a.getCoordinate())}else if(arguments.length===3){for(var C=arguments[0],z=arguments[1],K=arguments[2],mt=C;mt<z;mt++){var yt=this._edgeList.get(mt);yt.setEdgeDepths(Ft.RIGHT,K),K=yt.getDepth(Ft.LEFT)}return K}},o.prototype.mergeSymLabels=function(){for(var a=this.iterator();a.hasNext();){var l=a.next();l.getLabel().merge(l.getSym().getLabel())}},o.prototype.linkMinimalDirectedEdges=function(a){for(var l=null,h=null,m=this._SCANNING_FOR_INCOMING,S=this._resultAreaEdgeList.size()-1;S>=0;S--){var C=this._resultAreaEdgeList.get(S),z=C.getSym();switch(l===null&&C.getEdgeRing()===a&&(l=C),m){case this._SCANNING_FOR_INCOMING:if(z.getEdgeRing()!==a)continue;h=z,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(C.getEdgeRing()!==a)continue;h.setNextMin(C),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(Pt.isTrue(l!==null,"found null for first outgoing dirEdge"),Pt.isTrue(l.getEdgeRing()===a,"unable to link last incoming dirEdge"),h.setNextMin(l))},o.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var a=0,l=this.iterator();l.hasNext();)l.next().isInResult()&&a++;return a}if(arguments.length===1){for(var h=arguments[0],m=0,S=this.iterator();S.hasNext();)S.next().getEdgeRing()===h&&m++;return m}},o.prototype.getLabel=function(){return this._label},o.prototype.findCoveredLineEdges=function(){for(var a=V.NONE,l=this.iterator();l.hasNext();){var h=l.next(),m=h.getSym();if(!h.isLineEdge()){if(h.isInResult()){a=V.INTERIOR;break}if(m.isInResult()){a=V.EXTERIOR;break}}}if(a===V.NONE)return null;for(var S=a,C=this.iterator();C.hasNext();){var z=C.next(),K=z.getSym();z.isLineEdge()?z.getEdge().setCovered(S===V.INTERIOR):(z.isInResult()&&(S=V.EXTERIOR),K.isInResult()&&(S=V.INTERIOR))}},o.prototype.computeLabelling=function(a){r.prototype.computeLabelling.call(this,a),this._label=new pn(V.NONE);for(var l=this.iterator();l.hasNext();)for(var h=l.next().getEdge().getLabel(),m=0;m<2;m++){var S=h.getLocation(m);S!==V.INTERIOR&&S!==V.BOUNDARY||this._label.setLocation(m,V.INTERIOR)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(mr),b1=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.createNode=function(a){return new jf(a,new HD)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Tu),ls=function r(){this._pts=null,this._orientation=null;var o=arguments[0];this._pts=o,this._orientation=r.orientation(o)};ls.prototype.compareTo=function(r){var o=r;return ls.compareOriented(this._pts,this._orientation,o._pts,o._orientation)},ls.prototype.interfaces_=function(){return[B]},ls.prototype.getClass=function(){return ls},ls.orientation=function(r){return et.increasingDirection(r)===1},ls.compareOriented=function(r,o,a,l){for(var h=o?1:-1,m=l?1:-1,S=o?r.length:-1,C=l?a.length:-1,z=o?0:r.length-1,K=l?0:a.length-1;;){var mt=r[z].compareTo(a[K]);if(mt!==0)return mt;var yt=(z+=h)===S,zt=(K+=m)===C;if(yt&&!zt)return-1;if(!yt&&zt)return 1;if(yt&&zt)return 0}};var Gi=function(){this._edges=new O,this._ocaMap=new y};Gi.prototype.print=function(r){r.print("MULTILINESTRING ( ");for(var o=0;o<this._edges.size();o++){var a=this._edges.get(o);o>0&&r.print(","),r.print("(");for(var l=a.getCoordinates(),h=0;h<l.length;h++)h>0&&r.print(","),r.print(l[h].x+" "+l[h].y);r.println(")")}r.print(") ")},Gi.prototype.addAll=function(r){for(var o=r.iterator();o.hasNext();)this.add(o.next())},Gi.prototype.findEdgeIndex=function(r){for(var o=0;o<this._edges.size();o++)if(this._edges.get(o).equals(r))return o;return-1},Gi.prototype.iterator=function(){return this._edges.iterator()},Gi.prototype.getEdges=function(){return this._edges},Gi.prototype.get=function(r){return this._edges.get(r)},Gi.prototype.findEqualEdge=function(r){var o=new ls(r.getCoordinates());return this._ocaMap.get(o)},Gi.prototype.add=function(r){this._edges.add(r);var o=new ls(r.getCoordinates());this._ocaMap.put(o,r)},Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi};var ks=function(){};ks.prototype.processIntersections=function(r,o,a,l){},ks.prototype.isDone=function(){},ks.prototype.interfaces_=function(){return[]},ks.prototype.getClass=function(){return ks};var vi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var r=arguments[0];this._li=r};vi.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(vi.isAdjacentSegments(o,l))return!0;if(r.isClosed()){var h=r.size()-1;if(o===0&&l===h||l===0&&o===h)return!0}}return!1},vi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},vi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},vi.prototype.getLineIntersector=function(){return this._li},vi.prototype.hasProperIntersection=function(){return this._hasProper},vi.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(r,o,a,l)||(this._hasIntersection=!0,r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},vi.prototype.hasIntersection=function(){return this._hasIntersection},vi.prototype.isDone=function(){return!1},vi.prototype.hasInteriorIntersection=function(){return this._hasInterior},vi.prototype.interfaces_=function(){return[ks]},vi.prototype.getClass=function(){return vi},vi.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var to=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var r=arguments[0],o=arguments[1],a=arguments[2];this.coord=new P(r),this.segmentIndex=o,this.dist=a};to.prototype.getSegmentIndex=function(){return this.segmentIndex},to.prototype.getCoordinate=function(){return this.coord},to.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex),r.println(" dist = "+this.dist)},to.prototype.compareTo=function(r){var o=r;return this.compare(o.segmentIndex,o.dist)},to.prototype.isEndPoint=function(r){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===r},to.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},to.prototype.getDistance=function(){return this.dist},to.prototype.compare=function(r,o){return this.segmentIndex<r?-1:this.segmentIndex>r?1:this.dist<o?-1:this.dist>o?1:0},to.prototype.interfaces_=function(){return[B]},to.prototype.getClass=function(){return to};var mo=function(){this._nodeMap=new y,this.edge=null;var r=arguments[0];this.edge=r};mo.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},mo.prototype.iterator=function(){return this._nodeMap.values().iterator()},mo.prototype.addSplitEdges=function(r){this.addEndpoints();for(var o=this.iterator(),a=o.next();o.hasNext();){var l=o.next(),h=this.createSplitEdge(a,l);r.add(h),a=l}},mo.prototype.addEndpoints=function(){var r=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[r],r,0)},mo.prototype.createSplitEdge=function(r,o){var a=o.segmentIndex-r.segmentIndex+2,l=this.edge.pts[o.segmentIndex],h=o.dist>0||!o.coord.equals2D(l);h||a--;var m=new Array(a).fill(null),S=0;m[S++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)m[S++]=this.edge.pts[C];return h&&(m[S]=o.coord),new Qf(m,new pn(this.edge._label))},mo.prototype.add=function(r,o,a){var l=new to(r,o,a),h=this._nodeMap.get(l);return h!==null?h:(this._nodeMap.put(l,l),l)},mo.prototype.isIntersection=function(r){for(var o=this.iterator();o.hasNext();)if(o.next().coord.equals(r))return!0;return!1},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo};var qs=function(){};qs.prototype.getChainStartIndices=function(r){var o=0,a=new O;a.add(new it(o));do{var l=this.findChainEnd(r,o);a.add(new it(l)),o=l}while(o<r.length-1);return qs.toIntArray(a)},qs.prototype.findChainEnd=function(r,o){for(var a=mn.quadrant(r[o],r[o+1]),l=o+1;l<r.length&&mn.quadrant(r[l-1],r[l])===a;)l++;return l-1},qs.prototype.interfaces_=function(){return[]},qs.prototype.getClass=function(){return qs},qs.toIntArray=function(r){for(var o=new Array(r.size()).fill(null),a=0;a<o.length;a++)o[a]=r.get(a).intValue();return o};var Vo=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Ct,this.env2=new Ct;var r=arguments[0];this.e=r,this.pts=r.getCoordinates();var o=new qs;this.startIndex=o.getChainStartIndices(this.pts)};Vo.prototype.getCoordinates=function(){return this.pts},Vo.prototype.getMaxX=function(r){var o=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return o>a?o:a},Vo.prototype.getMinX=function(r){var o=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return o<a?o:a},Vo.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];this.computeIntersectsForChain(this.startIndex[r],this.startIndex[r+1],o,o.startIndex[a],o.startIndex[a+1],l)}else if(arguments.length===6){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3],z=arguments[4],K=arguments[5],mt=this.pts[h],yt=this.pts[m],zt=S.pts[C],qt=S.pts[z];if(m-h==1&&z-C==1)return K.addIntersections(this.e,h,S.e,C),null;if(this.env1.init(mt,yt),this.env2.init(zt,qt),!this.env1.intersects(this.env2))return null;var jt=Math.trunc((h+m)/2),ue=Math.trunc((C+z)/2);h<jt&&(C<ue&&this.computeIntersectsForChain(h,jt,S,C,ue,K),ue<z&&this.computeIntersectsForChain(h,jt,S,ue,z,K)),jt<m&&(C<ue&&this.computeIntersectsForChain(jt,m,S,C,ue,K),ue<z&&this.computeIntersectsForChain(jt,m,S,ue,z,K))}},Vo.prototype.getStartIndexes=function(){return this.startIndex},Vo.prototype.computeIntersects=function(r,o){for(var a=0;a<this.startIndex.length-1;a++)for(var l=0;l<r.startIndex.length-1;l++)this.computeIntersectsForChain(a,r,l,o)},Vo.prototype.interfaces_=function(){return[]},Vo.prototype.getClass=function(){return Vo};var ar=function r(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var o=0;o<2;o++)for(var a=0;a<3;a++)this._depth[o][a]=r.NULL_VALUE},A1={NULL_VALUE:{configurable:!0}};ar.prototype.getDepth=function(r,o){return this._depth[r][o]},ar.prototype.setDepth=function(r,o,a){this._depth[r][o]=a},ar.prototype.isNull=function(){if(arguments.length===0){for(var r=0;r<2;r++)for(var o=0;o<3;o++)if(this._depth[r][o]!==ar.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===ar.NULL_VALUE}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._depth[l][h]===ar.NULL_VALUE}},ar.prototype.normalize=function(){for(var r=0;r<2;r++)if(!this.isNull(r)){var o=this._depth[r][1];this._depth[r][2]<o&&(o=this._depth[r][2]),o<0&&(o=0);for(var a=1;a<3;a++){var l=0;this._depth[r][a]>o&&(l=1),this._depth[r][a]=l}}},ar.prototype.getDelta=function(r){return this._depth[r][Ft.RIGHT]-this._depth[r][Ft.LEFT]},ar.prototype.getLocation=function(r,o){return this._depth[r][o]<=0?V.EXTERIOR:V.INTERIOR},ar.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},ar.prototype.add=function(){if(arguments.length===1)for(var r=arguments[0],o=0;o<2;o++)for(var a=1;a<3;a++){var l=r.getLocation(o,a);l!==V.EXTERIOR&&l!==V.INTERIOR||(this.isNull(o,a)?this._depth[o][a]=ar.depthAtLocation(l):this._depth[o][a]+=ar.depthAtLocation(l))}else if(arguments.length===3){var h=arguments[0],m=arguments[1];arguments[2]===V.INTERIOR&&this._depth[h][m]++}},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar},ar.depthAtLocation=function(r){return r===V.EXTERIOR?0:r===V.INTERIOR?1:ar.NULL_VALUE},A1.NULL_VALUE.get=function(){return-1},Object.defineProperties(ar,A1);var Qf=function(r){function o(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new mo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new ar,this._depthDelta=0,arguments.length===1){var a=arguments[0];o.call(this,a,null)}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.pts=l,this._label=h}}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.getDepth=function(){return this._depth},o.prototype.getCollapsedEdge=function(){var a=new Array(2).fill(null);return a[0]=this.pts[0],a[1]=this.pts[1],new o(a,pn.toLineLabel(this._label))},o.prototype.isIsolated=function(){return this._isIsolated},o.prototype.getCoordinates=function(){return this.pts},o.prototype.setIsolated=function(a){this._isIsolated=a},o.prototype.setName=function(a){this._name=a},o.prototype.equals=function(a){if(!(a instanceof o))return!1;var l=a;if(this.pts.length!==l.pts.length)return!1;for(var h=!0,m=!0,S=this.pts.length,C=0;C<this.pts.length;C++)if(this.pts[C].equals2D(l.pts[C])||(h=!1),this.pts[C].equals2D(l.pts[--S])||(m=!1),!h&&!m)return!1;return!0},o.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var a=arguments[0];return this.pts[a]}},o.prototype.print=function(a){a.print("edge "+this._name+": "),a.print("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&a.print(","),a.print(this.pts[l].x+" "+this.pts[l].y);a.print(") "+this._label+" "+this._depthDelta)},o.prototype.computeIM=function(a){o.updateIM(this._label,a)},o.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},o.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},o.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},o.prototype.getDepthDelta=function(){return this._depthDelta},o.prototype.getNumPoints=function(){return this.pts.length},o.prototype.printReverse=function(a){a.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)a.print(this.pts[l]+" ");a.println("")},o.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Vo(this)),this._mce},o.prototype.getEnvelope=function(){if(this._env===null){this._env=new Ct;for(var a=0;a<this.pts.length;a++)this._env.expandToInclude(this.pts[a])}return this._env},o.prototype.addIntersection=function(a,l,h,m){var S=new P(a.getIntersection(m)),C=l,z=a.getEdgeDistance(h,m),K=C+1;if(K<this.pts.length){var mt=this.pts[K];S.equals2D(mt)&&(C=K,z=0)}this.eiList.add(S,C,z)},o.prototype.toString=function(){var a=new vt;a.append("edge "+this._name+": "),a.append("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&a.append(","),a.append(this.pts[l].x+" "+this.pts[l].y);return a.append(") "+this._label+" "+this._depthDelta),a.toString()},o.prototype.isPointwiseEqual=function(a){if(this.pts.length!==a.pts.length)return!1;for(var l=0;l<this.pts.length;l++)if(!this.pts[l].equals2D(a.pts[l]))return!1;return!0},o.prototype.setDepthDelta=function(a){this._depthDelta=a},o.prototype.getEdgeIntersectionList=function(){return this.eiList},o.prototype.addIntersections=function(a,l,h){for(var m=0;m<a.getIntersectionNum();m++)this.addIntersection(a,l,h,m)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.updateIM=function(){if(arguments.length!==2)return r.prototype.updateIM.apply(this,arguments);var a=arguments[0],l=arguments[1];l.setAtLeastIfValid(a.getLocation(0,Ft.ON),a.getLocation(1,Ft.ON),1),a.isArea()&&(l.setAtLeastIfValid(a.getLocation(0,Ft.LEFT),a.getLocation(1,Ft.LEFT),2),l.setAtLeastIfValid(a.getLocation(0,Ft.RIGHT),a.getLocation(1,Ft.RIGHT),2))},o}(gi),Pr=function(r){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Gi,this._bufParams=r||null};Pr.prototype.setWorkingPrecisionModel=function(r){this._workingPrecisionModel=r},Pr.prototype.insertUniqueEdge=function(r){var o=this._edgeList.findEqualEdge(r);if(o!==null){var a=o.getLabel(),l=r.getLabel();o.isPointwiseEqual(r)||(l=new pn(r.getLabel())).flip(),a.merge(l);var h=Pr.depthDelta(l),m=o.getDepthDelta()+h;o.setDepthDelta(m)}else this._edgeList.add(r),r.setDepthDelta(Pr.depthDelta(r.getLabel()))},Pr.prototype.buildSubgraphs=function(r,o){for(var a=new O,l=r.iterator();l.hasNext();){var h=l.next(),m=h.getRightmostCoordinate(),S=new Oa(a).getDepth(m);h.computeDepth(S),h.findResultEdges(),a.add(h),o.add(h.getDirectedEdges(),h.getNodes())}},Pr.prototype.createSubgraphs=function(r){for(var o=new O,a=r.getNodes().iterator();a.hasNext();){var l=a.next();if(!l.isVisited()){var h=new Cr;h.create(l),o.add(h)}}return zi.sort(o,zi.reverseOrder()),o},Pr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Pr.prototype.getNoder=function(r){if(this._workingNoder!==null)return this._workingNoder;var o=new Pg,a=new N;return a.setPrecisionModel(r),o.setSegmentIntersector(new vi(a)),o},Pr.prototype.buffer=function(r,o){var a=this._workingPrecisionModel;a===null&&(a=r.getPrecisionModel()),this._geomFact=r.getFactory();var l=new Vr(a,this._bufParams),h=new Ii(r,o,l).getCurves();if(h.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(h,a),this._graph=new On(new b1),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),S=new Qr(this._geomFact);this.buildSubgraphs(m,S);var C=S.getPolygons();return C.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(C)},Pr.prototype.computeNodedEdges=function(r,o){var a=this.getNoder(o);a.computeNodes(r);for(var l=a.getNodedSubstrings().iterator();l.hasNext();){var h=l.next(),m=h.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var S=h.getData(),C=new Qf(h.getCoordinates(),new pn(S));this.insertUniqueEdge(C)}}},Pr.prototype.setNoder=function(r){this._workingNoder=r},Pr.prototype.interfaces_=function(){return[]},Pr.prototype.getClass=function(){return Pr},Pr.depthDelta=function(r){var o=r.getLocation(0,Ft.LEFT),a=r.getLocation(0,Ft.RIGHT);return o===V.INTERIOR&&a===V.EXTERIOR?1:o===V.EXTERIOR&&a===V.INTERIOR?-1:0},Pr.convertSegStrings=function(r){for(var o=new me,a=new O;r.hasNext();){var l=r.next(),h=o.createLineString(l.getCoordinates());a.add(h)}return o.buildGeometry(a)};var cs=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var r=arguments[0],o=arguments[1];this._noder=r,this._scaleFactor=o,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var a=arguments[0],l=arguments[1],h=arguments[2],m=arguments[3];this._noder=a,this._scaleFactor=l,this._offsetX=h,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};cs.prototype.rescale=function(){if($(arguments[0],tt))for(var r=arguments[0].iterator();r.hasNext();){var o=r.next();this.rescale(o.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],l=0;l<a.length;l++)a[l].x=a[l].x/this._scaleFactor+this._offsetX,a[l].y=a[l].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&Ut.out.println(a)}},cs.prototype.scale=function(){if($(arguments[0],tt)){for(var r=arguments[0],o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new zn(this.scale(l.getCoordinates()),l.getData()))}return o}if(arguments[0]instanceof Array){for(var h=arguments[0],m=new Array(h.length).fill(null),S=0;S<h.length;S++)m[S]=new P(Math.round((h[S].x-this._offsetX)*this._scaleFactor),Math.round((h[S].y-this._offsetY)*this._scaleFactor),h[S].z);return et.removeRepeatedPoints(m)}},cs.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},cs.prototype.getNodedSubstrings=function(){var r=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(r),r},cs.prototype.computeNodes=function(r){var o=r;this._isScaled&&(o=this.scale(r)),this._noder.computeNodes(o)},cs.prototype.interfaces_=function(){return[zs]},cs.prototype.getClass=function(){return cs};var eo=function(){this._li=new N,this._segStrings=null;var r=arguments[0];this._segStrings=r},T1={fact:{configurable:!0}};eo.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var o=r.next().getCoordinates();this.checkEndPtVertexIntersections(o[0],this._segStrings),this.checkEndPtVertexIntersections(o[o.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],l=arguments[1].iterator();l.hasNext();)for(var h=l.next().getCoordinates(),m=1;m<h.length-1;m++)if(h[m].equals(a))throw new Ht("found endpt/interior pt intersection at index "+m+" :pt "+a)}},eo.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();)for(var o=r.next(),a=this._segStrings.iterator();a.hasNext();){var l=a.next();this.checkInteriorIntersections(o,l)}else if(arguments.length===2)for(var h=arguments[0],m=arguments[1],S=h.getCoordinates(),C=m.getCoordinates(),z=0;z<S.length-1;z++)for(var K=0;K<C.length-1;K++)this.checkInteriorIntersections(h,z,m,K);else if(arguments.length===4){var mt=arguments[0],yt=arguments[1],zt=arguments[2],qt=arguments[3];if(mt===zt&&yt===qt)return null;var jt=mt.getCoordinates()[yt],ue=mt.getCoordinates()[yt+1],dn=zt.getCoordinates()[qt],Xn=zt.getCoordinates()[qt+1];if(this._li.computeIntersection(jt,ue,dn,Xn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,jt,ue)||this.hasInteriorIntersection(this._li,dn,Xn)))throw new Ht("found non-noded intersection at "+jt+"-"+ue+" and "+dn+"-"+Xn)}},eo.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},eo.prototype.checkCollapses=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var o=r.next();this.checkCollapses(o)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),l=0;l<a.length-2;l++)this.checkCollapse(a[l],a[l+1],a[l+2])},eo.prototype.hasInteriorIntersection=function(r,o,a){for(var l=0;l<r.getIntersectionNum();l++){var h=r.getIntersection(l);if(!h.equals(o)&&!h.equals(a))return!0}return!1},eo.prototype.checkCollapse=function(r,o,a){if(r.equals(a))throw new Ht("found non-noded collapse at "+eo.fact.createLineString([r,o,a]))},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo},T1.fact.get=function(){return new me},Object.defineProperties(eo,T1);var Hr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var r=arguments[0],o=arguments[1],a=arguments[2];if(this._originalPt=r,this._pt=r,this._scaleFactor=o,this._li=a,o<=0)throw new T("Scale factor must be non-zero");o!==1&&(this._pt=new P(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new P,this._p1Scaled=new P),this.initCorners(this._pt)},C1={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Hr.prototype.intersectsScaled=function(r,o){var a=Math.min(r.x,o.x),l=Math.max(r.x,o.x),h=Math.min(r.y,o.y),m=Math.max(r.y,o.y),S=this._maxx<a||this._minx>l||this._maxy<h||this._miny>m;if(S)return!1;var C=this.intersectsToleranceSquare(r,o);return Pt.isTrue(!(S&&C),"Found bad envelope test"),C},Hr.prototype.initCorners=function(r){this._minx=r.x-.5,this._maxx=r.x+.5,this._miny=r.y-.5,this._maxy=r.y+.5,this._corner[0]=new P(this._maxx,this._maxy),this._corner[1]=new P(this._minx,this._maxy),this._corner[2]=new P(this._minx,this._miny),this._corner[3]=new P(this._maxx,this._miny)},Hr.prototype.intersects=function(r,o){return this._scaleFactor===1?this.intersectsScaled(r,o):(this.copyScaled(r,this._p0Scaled),this.copyScaled(o,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Hr.prototype.scale=function(r){return Math.round(r*this._scaleFactor)},Hr.prototype.getCoordinate=function(){return this._originalPt},Hr.prototype.copyScaled=function(r,o){o.x=this.scale(r.x),o.y=this.scale(r.y)},Hr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var r=Hr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ct(this._originalPt.x-r,this._originalPt.x+r,this._originalPt.y-r,this._originalPt.y+r)}return this._safeEnv},Hr.prototype.intersectsPixelClosure=function(r,o){return this._li.computeIntersection(r,o,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,o,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,o,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,o,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Hr.prototype.intersectsToleranceSquare=function(r,o){var a=!1,l=!1;return this._li.computeIntersection(r,o,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(r,o,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(r,o,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(r,o,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!l)||!!r.equals(this._pt)||!!o.equals(this._pt))))},Hr.prototype.addSnappedNode=function(r,o){var a=r.getCoordinate(o),l=r.getCoordinate(o+1);return!!this.intersects(a,l)&&(r.addIntersection(this.getCoordinate(),o),!0)},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr},C1.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Hr,C1);var _c=function(){this.tempEnv1=new Ct,this.selectedSegment=new ae};_c.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var r=arguments[0],o=arguments[1];r.getLineSegment(o,this.selectedSegment),this.select(this.selectedSegment)}}},_c.prototype.interfaces_=function(){return[]},_c.prototype.getClass=function(){return _c};var Ru=function(){this._index=null;var r=arguments[0];this._index=r},I1={HotPixelSnapAction:{configurable:!0}};Ru.prototype.snap=function(){if(arguments.length===1){var r=arguments[0];return this.snap(r,null,-1)}if(arguments.length===3){var o=arguments[0],a=arguments[1],l=arguments[2],h=o.getSafeEnvelope(),m=new P1(o,a,l);return this._index.query(h,{interfaces_:function(){return[as]},visitItem:function(S){S.select(h,m)}}),m.isNodeAdded()}},Ru.prototype.interfaces_=function(){return[]},Ru.prototype.getClass=function(){return Ru},I1.HotPixelSnapAction.get=function(){return P1},Object.defineProperties(Ru,I1);var P1=function(r){function o(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var a=arguments[0],l=arguments[1],h=arguments[2];this._hotPixel=a,this._parentEdge=l,this._hotPixelVertexIndex=h}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.isNodeAdded=function(){return this._isNodeAdded},o.prototype.select=function(){if(arguments.length!==2)return r.prototype.select.apply(this,arguments);var a=arguments[0],l=arguments[1],h=a.getContext();if(this._parentEdge!==null&&h===this._parentEdge&&l===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(h,l)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(_c),Da=function(){this._li=null,this._interiorIntersections=null;var r=arguments[0];this._li=r,this._interiorIntersections=new O};Da.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];if(this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var z=0;z<this._li.getIntersectionNum();z++)this._interiorIntersections.add(this._li.getIntersection(z));r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1)}},Da.prototype.isDone=function(){return!1},Da.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Da.prototype.interfaces_=function(){return[ks]},Da.prototype.getClass=function(){return Da};var yo=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var r=arguments[0];this._pm=r,this._li=new N,this._li.setPrecisionModel(r),this._scaleFactor=r.getScale()};yo.prototype.checkCorrectness=function(r){var o=zn.getNodedSubstrings(r),a=new eo(o);try{a.checkValid()}catch(l){if(!(l instanceof Vt))throw l;l.printStackTrace()}},yo.prototype.getNodedSubstrings=function(){return zn.getNodedSubstrings(this._nodedSegStrings)},yo.prototype.snapRound=function(r,o){var a=this.findInteriorIntersections(r,o);this.computeIntersectionSnaps(a),this.computeVertexSnaps(r)},yo.prototype.findInteriorIntersections=function(r,o){var a=new Da(o);return this._noder.setSegmentIntersector(a),this._noder.computeNodes(r),a.getInteriorIntersections()},yo.prototype.computeVertexSnaps=function(){if($(arguments[0],tt))for(var r=arguments[0].iterator();r.hasNext();){var o=r.next();this.computeVertexSnaps(o)}else if(arguments[0]instanceof zn)for(var a=arguments[0],l=a.getCoordinates(),h=0;h<l.length;h++){var m=new Hr(l[h],this._scaleFactor,this._li);this._pointSnapper.snap(m,a,h)&&a.addIntersection(l[h],h)}},yo.prototype.computeNodes=function(r){this._nodedSegStrings=r,this._noder=new Pg,this._pointSnapper=new Ru(this._noder.getIndex()),this.snapRound(r,this._li)},yo.prototype.computeIntersectionSnaps=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next(),l=new Hr(a,this._scaleFactor,this._li);this._pointSnapper.snap(l)}},yo.prototype.interfaces_=function(){return[zs]},yo.prototype.getClass=function(){return yo};var ur=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ke,this._resultGeometry=null,this._saveException=null,arguments.length===1){var r=arguments[0];this._argGeom=r}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this._argGeom=o,this._bufParams=a}},Lu={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};ur.prototype.bufferFixedPrecision=function(r){var o=new cs(new yo(new _e(1)),r.getScale()),a=new Pr(this._bufParams);a.setWorkingPrecisionModel(r),a.setNoder(o),this._resultGeometry=a.buffer(this._argGeom,this._distance)},ur.prototype.bufferReducedPrecision=function(){var r=this;if(arguments.length===0){for(var o=ur.MAX_PRECISION_DIGITS;o>=0;o--){try{r.bufferReducedPrecision(o)}catch(m){if(!(m instanceof Go))throw m;r._saveException=m}if(r._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],l=ur.precisionScaleFactor(this._argGeom,this._distance,a),h=new _e(l);this.bufferFixedPrecision(h)}},ur.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var r=this._argGeom.getFactory().getPrecisionModel();r.getType()===_e.FIXED?this.bufferFixedPrecision(r):this.bufferReducedPrecision()},ur.prototype.setQuadrantSegments=function(r){this._bufParams.setQuadrantSegments(r)},ur.prototype.bufferOriginalPrecision=function(){try{var r=new Pr(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(o){if(!(o instanceof Ht))throw o;this._saveException=o}},ur.prototype.getResultGeometry=function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry},ur.prototype.setEndCapStyle=function(r){this._bufParams.setEndCapStyle(r)},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.bufferOp=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new ur(r).getResultGeometry(o)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Rt&&typeof arguments[1]=="number"){var a=arguments[0],l=arguments[1],h=arguments[2],m=new ur(a);return m.setQuadrantSegments(h),m.getResultGeometry(l)}if(arguments[2]instanceof Ke&&arguments[0]instanceof Rt&&typeof arguments[1]=="number"){var S=arguments[0],C=arguments[1],z=arguments[2];return new ur(S,z).getResultGeometry(C)}}else if(arguments.length===4){var K=arguments[0],mt=arguments[1],yt=arguments[2],zt=arguments[3],qt=new ur(K);return qt.setQuadrantSegments(yt),qt.setEndCapStyle(zt),qt.getResultGeometry(mt)}},ur.precisionScaleFactor=function(r,o,a){var l=r.getEnvelopeInternal(),h=gt.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(o>0?o:0),m=a-Math.trunc(Math.log(h)/Math.log(10)+1);return Math.pow(10,m)},Lu.CAP_ROUND.get=function(){return Ke.CAP_ROUND},Lu.CAP_BUTT.get=function(){return Ke.CAP_FLAT},Lu.CAP_FLAT.get=function(){return Ke.CAP_FLAT},Lu.CAP_SQUARE.get=function(){return Ke.CAP_SQUARE},Lu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(ur,Lu);var Rr=function(){this._pt=[new P,new P],this._distance=w.NaN,this._isNull=!0};Rr.prototype.getCoordinates=function(){return this._pt},Rr.prototype.getCoordinate=function(r){return this._pt[r]},Rr.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l<this._distance&&this.initialize(o,a,l)}},Rr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],o=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(o),this._distance=r.distance(o),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},Rr.prototype.getDistance=function(){return this._distance},Rr.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l>this._distance&&this.initialize(o,a,l)}},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr};var vo=function(){};vo.prototype.interfaces_=function(){return[]},vo.prototype.getClass=function(){return vo},vo.computeDistance=function(){if(arguments[2]instanceof Rr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=r.getCoordinates(),h=new ae,m=0;m<l.length-1;m++){h.setCoordinates(l[m],l[m+1]);var S=h.closestPoint(o);a.setMinimum(S,o)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof re&&arguments[1]instanceof P){var C=arguments[0],z=arguments[1],K=arguments[2];vo.computeDistance(C.getExteriorRing(),z,K);for(var mt=0;mt<C.getNumInteriorRing();mt++)vo.computeDistance(C.getInteriorRingN(mt),z,K)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],zt=arguments[1],qt=arguments[2];if(yt instanceof ut)vo.computeDistance(yt,zt,qt);else if(yt instanceof re)vo.computeDistance(yt,zt,qt);else if(yt instanceof En)for(var jt=yt,ue=0;ue<jt.getNumGeometries();ue++){var dn=jt.getGeometryN(ue);vo.computeDistance(dn,zt,qt)}else qt.setMinimum(yt.getCoordinate(),zt)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof ae&&arguments[1]instanceof P){var Xn=arguments[0],Dr=arguments[1],So=arguments[2],ys=Xn.closestPoint(Dr);So.setMinimum(ys,Dr)}};var Vs=function(r){this._maxPtDist=new Rr,this._inputGeom=r||null},Rg={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Vs.prototype.computeMaxMidpointDistance=function(r){var o=new fs(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Vs.prototype.computeMaxVertexDistance=function(r){var o=new Fa(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Vs.prototype.findDistance=function(r){return this.computeMaxVertexDistance(r),this.computeMaxMidpointDistance(r),this._maxPtDist.getDistance()},Vs.prototype.getDistancePoints=function(){return this._maxPtDist},Vs.prototype.interfaces_=function(){return[]},Vs.prototype.getClass=function(){return Vs},Rg.MaxPointDistanceFilter.get=function(){return Fa},Rg.MaxMidpointDistanceFilter.get=function(){return fs},Object.defineProperties(Vs,Rg);var Fa=function(r){this._maxPtDist=new Rr,this._minPtDist=new Rr,this._geom=r||null};Fa.prototype.filter=function(r){this._minPtDist.initialize(),vo.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Fa.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fa.prototype.interfaces_=function(){return[j]},Fa.prototype.getClass=function(){return Fa};var fs=function(r){this._maxPtDist=new Rr,this._minPtDist=new Rr,this._geom=r||null};fs.prototype.filter=function(r,o){if(o===0)return null;var a=r.getCoordinate(o-1),l=r.getCoordinate(o),h=new P((a.x+l.x)/2,(a.y+l.y)/2);this._minPtDist.initialize(),vo.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},fs.prototype.isDone=function(){return!1},fs.prototype.isGeometryChanged=function(){return!1},fs.prototype.getMaxPointDistance=function(){return this._maxPtDist},fs.prototype.interfaces_=function(){return[Cn]},fs.prototype.getClass=function(){return fs};var Ho=function(r){this._comps=r||null};Ho.prototype.filter=function(r){r instanceof re&&this._comps.add(r)},Ho.prototype.interfaces_=function(){return[Nn]},Ho.prototype.getClass=function(){return Ho},Ho.getPolygons=function(){if(arguments.length===1){var r=arguments[0];return Ho.getPolygons(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof re?a.add(o):o instanceof En&&o.apply(new Ho(a)),a}};var lr=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var r=arguments[0];this._lines=r}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this._lines=o,this._isForcedToLineString=a}};lr.prototype.filter=function(r){if(this._isForcedToLineString&&r instanceof fe){var o=r.getFactory().createLineString(r.getCoordinateSequence());return this._lines.add(o),null}r instanceof ut&&this._lines.add(r)},lr.prototype.setForceToLineString=function(r){this._isForcedToLineString=r},lr.prototype.interfaces_=function(){return[ce]},lr.prototype.getClass=function(){return lr},lr.getGeometry=function(){if(arguments.length===1){var r=arguments[0];return r.getFactory().buildGeometry(lr.getLines(r))}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o.getFactory().buildGeometry(lr.getLines(o,a))}},lr.getLines=function(){if(arguments.length===1){var r=arguments[0];return lr.getLines(r,!1)}if(arguments.length===2){if($(arguments[0],tt)&&$(arguments[1],tt)){for(var o=arguments[0],a=arguments[1],l=o.iterator();l.hasNext();){var h=l.next();lr.getLines(h,a)}return a}if(arguments[0]instanceof Rt&&typeof arguments[1]=="boolean"){var m=arguments[0],S=arguments[1],C=new O;return m.apply(new lr(C,S)),C}if(arguments[0]instanceof Rt&&$(arguments[1],tt)){var z=arguments[0],K=arguments[1];return z instanceof ut?K.add(z):z.apply(new lr(K)),K}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&$(arguments[0],tt)&&$(arguments[1],tt)){for(var mt=arguments[0],yt=arguments[1],zt=arguments[2],qt=mt.iterator();qt.hasNext();){var jt=qt.next();lr.getLines(jt,yt,zt)}return yt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Rt&&$(arguments[1],tt)){var ue=arguments[0],dn=arguments[1],Xn=arguments[2];return ue.apply(new lr(dn,Xn)),dn}}};var ki=function(){if(this._boundaryRule=b.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];if(r===null)throw new T("Rule must be non-null");this._boundaryRule=r}}};ki.prototype.locateInternal=function(){if(arguments[0]instanceof P&&arguments[1]instanceof re){var r=arguments[0],o=arguments[1];if(o.isEmpty())return V.EXTERIOR;var a=o.getExteriorRing(),l=this.locateInPolygonRing(r,a);if(l===V.EXTERIOR)return V.EXTERIOR;if(l===V.BOUNDARY)return V.BOUNDARY;for(var h=0;h<o.getNumInteriorRing();h++){var m=o.getInteriorRingN(h),S=this.locateInPolygonRing(r,m);if(S===V.INTERIOR)return V.EXTERIOR;if(S===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof P&&arguments[1]instanceof ut){var C=arguments[0],z=arguments[1];if(!z.getEnvelopeInternal().intersects(C))return V.EXTERIOR;var K=z.getCoordinates();return z.isClosed()||!C.equals(K[0])&&!C.equals(K[K.length-1])?ot.isOnLine(C,K)?V.INTERIOR:V.EXTERIOR:V.BOUNDARY}if(arguments[0]instanceof P&&arguments[1]instanceof te){var mt=arguments[0];return arguments[1].getCoordinate().equals2D(mt)?V.INTERIOR:V.EXTERIOR}},ki.prototype.locateInPolygonRing=function(r,o){return o.getEnvelopeInternal().intersects(r)?ot.locatePointInRing(r,o.getCoordinates()):V.EXTERIOR},ki.prototype.intersects=function(r,o){return this.locate(r,o)!==V.EXTERIOR},ki.prototype.updateLocationInfo=function(r){r===V.INTERIOR&&(this._isIn=!0),r===V.BOUNDARY&&this._numBoundaries++},ki.prototype.computeLocation=function(r,o){if(o instanceof te&&this.updateLocationInfo(this.locateInternal(r,o)),o instanceof ut)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof re)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof Kr)for(var a=o,l=0;l<a.getNumGeometries();l++){var h=a.getGeometryN(l);this.updateLocationInfo(this.locateInternal(r,h))}else if(o instanceof he)for(var m=o,S=0;S<m.getNumGeometries();S++){var C=m.getGeometryN(S);this.updateLocationInfo(this.locateInternal(r,C))}else if(o instanceof En)for(var z=new go(o);z.hasNext();){var K=z.next();K!==o&&this.computeLocation(r,K)}},ki.prototype.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:o instanceof ut?this.locateInternal(r,o):o instanceof re?this.locateInternal(r,o):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(r,o),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki};var Lr=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var o=arguments[0],a=arguments[1];r.call(this,o,r.INSIDE_AREA,a)}else if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];this._component=l,this._segIndex=h,this._pt=m}},R1={INSIDE_AREA:{configurable:!0}};Lr.prototype.isInsideArea=function(){return this._segIndex===Lr.INSIDE_AREA},Lr.prototype.getCoordinate=function(){return this._pt},Lr.prototype.getGeometryComponent=function(){return this._component},Lr.prototype.getSegmentIndex=function(){return this._segIndex},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},R1.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Lr,R1);var hs=function(r){this._pts=r||null};hs.prototype.filter=function(r){r instanceof te&&this._pts.add(r)},hs.prototype.interfaces_=function(){return[Nn]},hs.prototype.getClass=function(){return hs},hs.getPoints=function(){if(arguments.length===1){var r=arguments[0];return r instanceof te?zi.singletonList(r):hs.getPoints(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof te?a.add(o):o instanceof En&&o.apply(new hs(a)),a}};var Ua=function(){this._locations=null;var r=arguments[0];this._locations=r};Ua.prototype.filter=function(r){(r instanceof te||r instanceof ut||r instanceof re)&&this._locations.add(new Lr(r,0,r.getCoordinate()))},Ua.prototype.interfaces_=function(){return[Nn]},Ua.prototype.getClass=function(){return Ua},Ua.getLocations=function(r){var o=new O;return r.apply(new Ua(o)),o};var cr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ki,this._minDistanceLocation=null,this._minDistance=w.MAX_VALUE,arguments.length===2){var r=arguments[0],o=arguments[1];this._geom=[r,o],this._terminateDistance=0}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=a,this._geom[1]=l,this._terminateDistance=h}};cr.prototype.computeContainmentDistance=function(){if(arguments.length===0){var r=new Array(2).fill(null);if(this.computeContainmentDistance(0,r),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1],l=1-o,h=Ho.getPolygons(this._geom[o]);if(h.size()>0){var m=Ua.getLocations(this._geom[l]);if(this.computeContainmentDistance(m,h,a),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=a[0],this._minDistanceLocation[o]=a[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&$(arguments[0],ht)&&$(arguments[1],ht)){for(var S=arguments[0],C=arguments[1],z=arguments[2],K=0;K<S.size();K++)for(var mt=S.get(K),yt=0;yt<C.size();yt++)if(this.computeContainmentDistance(mt,C.get(yt),z),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Lr&&arguments[1]instanceof re){var zt=arguments[0],qt=arguments[1],jt=arguments[2],ue=zt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(ue,qt))return this._minDistance=0,jt[0]=zt,jt[1]=new Lr(qt,ue),null}}},cr.prototype.computeMinDistanceLinesPoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),m=0;m<o.size();m++){var S=o.get(m);if(this.computeMinDistance(h,S,a),this._minDistance<=this._terminateDistance)return null}},cr.prototype.computeFacetDistance=function(){var r=new Array(2).fill(null),o=lr.getLines(this._geom[0]),a=lr.getLines(this._geom[1]),l=hs.getPoints(this._geom[0]),h=hs.getPoints(this._geom[1]);return this.computeMinDistanceLines(o,a,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(o,h,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(a,l,r),this.updateMinDistance(r,!0),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistancePoints(l,h,r),void this.updateMinDistance(r,!1))))},cr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},cr.prototype.updateMinDistance=function(r,o){if(r[0]===null)return null;o?(this._minDistanceLocation[0]=r[1],this._minDistanceLocation[1]=r[0]):(this._minDistanceLocation[0]=r[0],this._minDistanceLocation[1]=r[1])},cr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},cr.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof ut&&arguments[1]instanceof te){var r=arguments[0],o=arguments[1],a=arguments[2];if(r.getEnvelopeInternal().distance(o.getEnvelopeInternal())>this._minDistance)return null;for(var l=r.getCoordinates(),h=o.getCoordinate(),m=0;m<l.length-1;m++){var S=ot.distancePointLine(h,l[m],l[m+1]);if(S<this._minDistance){this._minDistance=S;var C=new ae(l[m],l[m+1]).closestPoint(h);a[0]=new Lr(r,m,C),a[1]=new Lr(o,0,h)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof ut&&arguments[1]instanceof ut){var z=arguments[0],K=arguments[1],mt=arguments[2];if(z.getEnvelopeInternal().distance(K.getEnvelopeInternal())>this._minDistance)return null;for(var yt=z.getCoordinates(),zt=K.getCoordinates(),qt=0;qt<yt.length-1;qt++)for(var jt=0;jt<zt.length-1;jt++){var ue=ot.distanceLineLine(yt[qt],yt[qt+1],zt[jt],zt[jt+1]);if(ue<this._minDistance){this._minDistance=ue;var dn=new ae(yt[qt],yt[qt+1]),Xn=new ae(zt[jt],zt[jt+1]),Dr=dn.closestPoints(Xn);mt[0]=new Lr(z,qt,Dr[0]),mt[1]=new Lr(K,jt,Dr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},cr.prototype.computeMinDistancePoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),m=0;m<o.size();m++){var S=o.get(m),C=h.getCoordinate().distance(S.getCoordinate());if(C<this._minDistance&&(this._minDistance=C,a[0]=new Lr(h,0,h.getCoordinate()),a[1]=new Lr(S,0,S.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},cr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new T("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},cr.prototype.computeMinDistanceLines=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),m=0;m<o.size();m++){var S=o.get(m);if(this.computeMinDistance(h,S,a),this._minDistance<=this._terminateDistance)return null}},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.distance=function(r,o){return new cr(r,o).distance()},cr.isWithinDistance=function(r,o,a){return new cr(r,o,a).distance()<=a},cr.nearestPoints=function(r,o){return new cr(r,o).nearestPoints()};var yr=function(){this._pt=[new P,new P],this._distance=w.NaN,this._isNull=!0};yr.prototype.getCoordinates=function(){return this._pt},yr.prototype.getCoordinate=function(r){return this._pt[r]},yr.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l<this._distance&&this.initialize(o,a,l)}},yr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],o=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(o),this._distance=r.distance(o),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},yr.prototype.toString=function(){return wt.toLineString(this._pt[0],this._pt[1])},yr.prototype.getDistance=function(){return this._distance},yr.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l>this._distance&&this.initialize(o,a,l)}},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr};var no=function(){};no.prototype.interfaces_=function(){return[]},no.prototype.getClass=function(){return no},no.computeDistance=function(){if(arguments[2]instanceof yr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=new ae,h=r.getCoordinates(),m=0;m<h.length-1;m++){l.setCoordinates(h[m],h[m+1]);var S=l.closestPoint(o);a.setMinimum(S,o)}else if(arguments[2]instanceof yr&&arguments[0]instanceof re&&arguments[1]instanceof P){var C=arguments[0],z=arguments[1],K=arguments[2];no.computeDistance(C.getExteriorRing(),z,K);for(var mt=0;mt<C.getNumInteriorRing();mt++)no.computeDistance(C.getInteriorRingN(mt),z,K)}else if(arguments[2]instanceof yr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],zt=arguments[1],qt=arguments[2];if(yt instanceof ut)no.computeDistance(yt,zt,qt);else if(yt instanceof re)no.computeDistance(yt,zt,qt);else if(yt instanceof En)for(var jt=yt,ue=0;ue<jt.getNumGeometries();ue++){var dn=jt.getGeometryN(ue);no.computeDistance(dn,zt,qt)}else qt.setMinimum(yt.getCoordinate(),zt)}else if(arguments[2]instanceof yr&&arguments[0]instanceof ae&&arguments[1]instanceof P){var Xn=arguments[0],Dr=arguments[1],So=arguments[2],ys=Xn.closestPoint(Dr);So.setMinimum(ys,Dr)}};var Pi=function(){this._g0=null,this._g1=null,this._ptDist=new yr,this._densifyFrac=0;var r=arguments[0],o=arguments[1];this._g0=r,this._g1=o},Lg={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Pi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Pi.prototype.setDensifyFraction=function(r){if(r>1||r<=0)throw new T("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=r},Pi.prototype.compute=function(r,o){this.computeOrientedDistance(r,o,this._ptDist),this.computeOrientedDistance(o,r,this._ptDist)},Pi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Pi.prototype.computeOrientedDistance=function(r,o,a){var l=new Ba(o);if(r.apply(l),a.setMaximum(l.getMaxPointDistance()),this._densifyFrac>0){var h=new ps(o,this._densifyFrac);r.apply(h),a.setMaximum(h.getMaxPointDistance())}},Pi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.distance=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new Pi(r,o).distance()}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2],m=new Pi(a,l);return m.setDensifyFraction(h),m.distance()}},Lg.MaxPointDistanceFilter.get=function(){return Ba},Lg.MaxDensifiedByFractionDistanceFilter.get=function(){return ps},Object.defineProperties(Pi,Lg);var Ba=function(){this._maxPtDist=new yr,this._minPtDist=new yr,this._euclideanDist=new no,this._geom=null;var r=arguments[0];this._geom=r};Ba.prototype.filter=function(r){this._minPtDist.initialize(),no.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ba.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ba.prototype.interfaces_=function(){return[j]},Ba.prototype.getClass=function(){return Ba};var ps=function(){this._maxPtDist=new yr,this._minPtDist=new yr,this._geom=null,this._numSubSegs=0;var r=arguments[0],o=arguments[1];this._geom=r,this._numSubSegs=Math.trunc(Math.round(1/o))};ps.prototype.filter=function(r,o){if(o===0)return null;for(var a=r.getCoordinate(o-1),l=r.getCoordinate(o),h=(l.x-a.x)/this._numSubSegs,m=(l.y-a.y)/this._numSubSegs,S=0;S<this._numSubSegs;S++){var C=a.x+S*h,z=a.y+S*m,K=new P(C,z);this._minPtDist.initialize(),no.computeDistance(this._geom,K,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},ps.prototype.isDone=function(){return!1},ps.prototype.isGeometryChanged=function(){return!1},ps.prototype.getMaxPointDistance=function(){return this._maxPtDist},ps.prototype.interfaces_=function(){return[Cn]},ps.prototype.getClass=function(){return ps};var ei=function(r,o,a){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._bufDistance=o||null,this._result=a||null},Ng={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};ei.prototype.checkMaximumDistance=function(r,o,a){var l=new Pi(o,r);if(l.setDensifyFraction(.25),this._maxDistanceFound=l.orientedDistance(),this._maxDistanceFound>a){this._isValid=!1;var h=l.getCoordinates();this._errorLocation=h[1],this._errorIndicator=r.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+wt.toLineString(h[0],h[1])+")"}},ei.prototype.isValid=function(){var r=Math.abs(this._bufDistance),o=ei.MAX_DISTANCE_DIFF_FRAC*r;return this._minValidDistance=r-o,this._maxValidDistance=r+o,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),ei.VERBOSE&&Ut.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},ei.prototype.checkNegativeValid=function(){if(!(this._input instanceof re||this._input instanceof he||this._input instanceof En))return null;var r=this.getPolygonLines(this._input);if(this.checkMinimumDistance(r,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(r,this._result,this._maxValidDistance)},ei.prototype.getErrorIndicator=function(){return this._errorIndicator},ei.prototype.checkMinimumDistance=function(r,o,a){var l=new cr(r,o,a);if(this._minDistanceFound=l.distance(),this._minDistanceFound<a){this._isValid=!1;var h=l.nearestPoints();this._errorLocation=l.nearestPoints()[1],this._errorIndicator=r.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+wt.toLineString(h[0],h[1])+" )"}},ei.prototype.checkPositiveValid=function(){var r=this._result.getBoundary();if(this.checkMinimumDistance(this._input,r,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,r,this._maxValidDistance)},ei.prototype.getErrorLocation=function(){return this._errorLocation},ei.prototype.getPolygonLines=function(r){for(var o=new O,a=new lr(o),l=Ho.getPolygons(r).iterator();l.hasNext();)l.next().apply(a);return r.getFactory().buildGeometry(o)},ei.prototype.getErrorMessage=function(){return this._errMsg},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},Ng.VERBOSE.get=function(){return!1},Ng.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(ei,Ng);var fr=function(r,o,a){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._distance=o||null,this._result=a||null},Og={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};fr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},fr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var r=this._distance*fr.MAX_ENV_DIFF_FRAC;r===0&&(r=.001);var o=new Ct(this._input.getEnvelopeInternal());o.expandBy(this._distance);var a=new Ct(this._result.getEnvelopeInternal());a.expandBy(r),a.contains(o)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(a)),this.report("Envelope")},fr.prototype.checkDistance=function(){var r=new ei(this._input,this._distance,this._result);r.isValid()||(this._isValid=!1,this._errorMsg=r.getErrorMessage(),this._errorLocation=r.getErrorLocation(),this._errorIndicator=r.getErrorIndicator()),this.report("Distance")},fr.prototype.checkArea=function(){var r=this._input.getArea(),o=this._result.getArea();this._distance>0&&r>o&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&r<o&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},fr.prototype.checkPolygonal=function(){this._result instanceof re||this._result instanceof he||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},fr.prototype.getErrorIndicator=function(){return this._errorIndicator},fr.prototype.getErrorLocation=function(){return this._errorLocation},fr.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},fr.prototype.report=function(r){if(!fr.VERBOSE)return null;Ut.out.println("Check "+r+": "+(this._isValid?"passed":"FAILED"))},fr.prototype.getErrorMessage=function(){return this._errorMsg},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.isValidMsg=function(r,o,a){var l=new fr(r,o,a);return l.isValid()?null:l.getErrorMessage()},fr.isValid=function(r,o,a){return!!new fr(r,o,a).isValid()},Og.VERBOSE.get=function(){return!1},Og.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(fr,Og);var ro=function(){this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};ro.prototype.getCoordinates=function(){return this._pts},ro.prototype.size=function(){return this._pts.length},ro.prototype.getCoordinate=function(r){return this._pts[r]},ro.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ro.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:La.octant(this.getCoordinate(r),this.getCoordinate(r+1))},ro.prototype.setData=function(r){this._data=r},ro.prototype.getData=function(){return this._data},ro.prototype.toString=function(){return wt.toLineString(new se(this._pts))},ro.prototype.interfaces_=function(){return[po]},ro.prototype.getClass=function(){return ro};var ir=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new O,this._intersectionCount=0,this._keepIntersections=!0;var r=arguments[0];this._li=r,this._interiorIntersection=null};ir.prototype.getInteriorIntersection=function(){return this._interiorIntersection},ir.prototype.setCheckEndSegmentsOnly=function(r){this._isCheckEndSegmentsOnly=r},ir.prototype.getIntersectionSegments=function(){return this._intSegments},ir.prototype.count=function(){return this._intersectionCount},ir.prototype.getIntersections=function(){return this._intersections},ir.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},ir.prototype.setKeepIntersections=function(r){this._keepIntersections=r},ir.prototype.processIntersections=function(r,o,a,l){if(!this._findAllIntersections&&this.hasIntersection()||r===a&&o===l||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(r,o)||this.isEndSegment(a,l)))return null;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=h,this._intSegments[1]=m,this._intSegments[2]=S,this._intSegments[3]=C,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},ir.prototype.isEndSegment=function(r,o){return o===0||o>=r.size()-2},ir.prototype.hasIntersection=function(){return this._interiorIntersection!==null},ir.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},ir.prototype.interfaces_=function(){return[ks]},ir.prototype.getClass=function(){return ir},ir.createAllIntersectionsFinder=function(r){var o=new ir(r);return o.setFindAllIntersections(!0),o},ir.createAnyIntersectionFinder=function(r){return new ir(r)},ir.createIntersectionCounter=function(r){var o=new ir(r);return o.setFindAllIntersections(!0),o.setKeepIntersections(!1),o};var qi=function(){this._li=new N,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var r=arguments[0];this._segStrings=r};qi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},qi.prototype.getIntersections=function(){return this._segInt.getIntersections()},qi.prototype.isValid=function(){return this.execute(),this._isValid},qi.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},qi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new ir(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var r=new Pg;if(r.setSegmentIntersector(this._segInt),r.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Go(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var r=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+wt.toLineString(r[0],r[1])+" and "+wt.toLineString(r[2],r[3])},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi},qi.computeIntersections=function(r){var o=new qi(r);return o.setFindAllIntersections(!0),o.isValid(),o.getIntersections()};var Hs=function r(){this._nv=null;var o=arguments[0];this._nv=new qi(r.toSegmentStrings(o))};Hs.prototype.checkValid=function(){this._nv.checkValid()},Hs.prototype.interfaces_=function(){return[]},Hs.prototype.getClass=function(){return Hs},Hs.toSegmentStrings=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new ro(l.getCoordinates(),l))}return o},Hs.checkValid=function(r){new Hs(r).checkValid()};var za=function(r){this._mapOp=r};za.prototype.map=function(r){for(var o=new O,a=0;a<r.getNumGeometries();a++){var l=this._mapOp.map(r.getGeometryN(a));l.isEmpty()||o.add(l)}return r.getFactory().createGeometryCollection(me.toGeometryArray(o))},za.prototype.interfaces_=function(){return[]},za.prototype.getClass=function(){return za},za.map=function(r,o){return new za(o).map(r)};var io=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new O,this._resultLineList=new O;var r=arguments[0],o=arguments[1],a=arguments[2];this._op=r,this._geometryFactory=o,this._ptLocator=a};io.prototype.collectLines=function(r){for(var o=this._op.getGraph().getEdgeEnds().iterator();o.hasNext();){var a=o.next();this.collectLineEdge(a,r,this._lineEdgesList),this.collectBoundaryTouchEdge(a,r,this._lineEdgesList)}},io.prototype.labelIsolatedLine=function(r,o){var a=this._ptLocator.locate(r.getCoordinate(),this._op.getArgGeometry(o));r.getLabel().setLocation(o,a)},io.prototype.build=function(r){return this.findCoveredLineEdges(),this.collectLines(r),this.buildLines(r),this._resultLineList},io.prototype.collectLineEdge=function(r,o,a){var l=r.getLabel(),h=r.getEdge();r.isLineEdge()&&(r.isVisited()||!de.isResultOfOp(l,o)||h.isCovered()||(a.add(h),r.setVisitedEdge(!0)))},io.prototype.findCoveredLineEdges=function(){for(var r=this._op.getGraph().getNodes().iterator();r.hasNext();)r.next().getEdges().findCoveredLineEdges();for(var o=this._op.getGraph().getEdgeEnds().iterator();o.hasNext();){var a=o.next(),l=a.getEdge();if(a.isLineEdge()&&!l.isCoveredSet()){var h=this._op.isCoveredByA(a.getCoordinate());l.setCovered(h)}}},io.prototype.labelIsolatedLines=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next(),l=a.getLabel();a.isIsolated()&&(l.isNull(0)?this.labelIsolatedLine(a,0):this.labelIsolatedLine(a,1))}},io.prototype.buildLines=function(r){for(var o=this._lineEdgesList.iterator();o.hasNext();){var a=o.next(),l=this._geometryFactory.createLineString(a.getCoordinates());this._resultLineList.add(l),a.setInResult(!0)}},io.prototype.collectBoundaryTouchEdge=function(r,o,a){var l=r.getLabel();return r.isLineEdge()||r.isVisited()||r.isInteriorAreaEdge()||r.getEdge().isInResult()?null:(Pt.isTrue(!(r.isInResult()||r.getSym().isInResult())||!r.getEdge().isInResult()),void(de.isResultOfOp(l,o)&&o===de.INTERSECTION&&(a.add(r.getEdge()),r.setVisitedEdge(!0))))},io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io};var Ga=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new O;var r=arguments[0],o=arguments[1];this._op=r,this._geometryFactory=o};Ga.prototype.filterCoveredNodeToPoint=function(r){var o=r.getCoordinate();if(!this._op.isCoveredByLA(o)){var a=this._geometryFactory.createPoint(o);this._resultPointList.add(a)}},Ga.prototype.extractNonCoveredResultNodes=function(r){for(var o=this._op.getGraph().getNodes().iterator();o.hasNext();){var a=o.next();if(!a.isInResult()&&!a.isIncidentEdgeInResult()&&(a.getEdges().getDegree()===0||r===de.INTERSECTION)){var l=a.getLabel();de.isResultOfOp(l,r)&&this.filterCoveredNodeToPoint(a)}}},Ga.prototype.build=function(r){return this.extractNonCoveredResultNodes(r),this._resultPointList},Ga.prototype.interfaces_=function(){return[]},Ga.prototype.getClass=function(){return Ga};var Wr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Wr.prototype.transformPoint=function(r,o){return this._factory.createPoint(this.transformCoordinates(r.getCoordinateSequence(),r))},Wr.prototype.transformPolygon=function(r,o){var a=!0,l=this.transformLinearRing(r.getExteriorRing(),r);l!==null&&l instanceof fe&&!l.isEmpty()||(a=!1);for(var h=new O,m=0;m<r.getNumInteriorRing();m++){var S=this.transformLinearRing(r.getInteriorRingN(m),r);S===null||S.isEmpty()||(S instanceof fe||(a=!1),h.add(S))}if(a)return this._factory.createPolygon(l,h.toArray([]));var C=new O;return l!==null&&C.add(l),C.addAll(h),this._factory.buildGeometry(C)},Wr.prototype.createCoordinateSequence=function(r){return this._factory.getCoordinateSequenceFactory().create(r)},Wr.prototype.getInputGeometry=function(){return this._inputGeom},Wr.prototype.transformMultiLineString=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transformLineString(r.getGeometryN(l),r);h!==null&&(h.isEmpty()||a.add(h))}return this._factory.buildGeometry(a)},Wr.prototype.transformCoordinates=function(r,o){return this.copy(r)},Wr.prototype.transformLineString=function(r,o){return this._factory.createLineString(this.transformCoordinates(r.getCoordinateSequence(),r))},Wr.prototype.transformMultiPoint=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transformPoint(r.getGeometryN(l),r);h!==null&&(h.isEmpty()||a.add(h))}return this._factory.buildGeometry(a)},Wr.prototype.transformMultiPolygon=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transformPolygon(r.getGeometryN(l),r);h!==null&&(h.isEmpty()||a.add(h))}return this._factory.buildGeometry(a)},Wr.prototype.copy=function(r){return r.copy()},Wr.prototype.transformGeometryCollection=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transform(r.getGeometryN(l));h!==null&&(this._pruneEmptyGeometry&&h.isEmpty()||a.add(h))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(me.toGeometryArray(a)):this._factory.buildGeometry(a)},Wr.prototype.transform=function(r){if(this._inputGeom=r,this._factory=r.getFactory(),r instanceof te)return this.transformPoint(r,null);if(r instanceof ve)return this.transformMultiPoint(r,null);if(r instanceof fe)return this.transformLinearRing(r,null);if(r instanceof ut)return this.transformLineString(r,null);if(r instanceof Kr)return this.transformMultiLineString(r,null);if(r instanceof re)return this.transformPolygon(r,null);if(r instanceof he)return this.transformMultiPolygon(r,null);if(r instanceof En)return this.transformGeometryCollection(r,null);throw new T("Unknown Geometry subtype: "+r.getClass().getName())},Wr.prototype.transformLinearRing=function(r,o){var a=this.transformCoordinates(r.getCoordinateSequence(),r);if(a===null)return this._factory.createLinearRing(null);var l=a.size();return l>0&&l<4&&!this._preserveType?this._factory.createLineString(a):this._factory.createLinearRing(a)},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var _o=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ae,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof ut&&typeof arguments[1]=="number"){var o=arguments[0],a=arguments[1];r.call(this,o.getCoordinates(),a)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var l=arguments[0],h=arguments[1];this._srcPts=l,this._isClosed=r.isClosed(l),this._snapTolerance=h}};_o.prototype.snapVertices=function(r,o){for(var a=this._isClosed?r.size()-1:r.size(),l=0;l<a;l++){var h=r.get(l),m=this.findSnapForVertex(h,o);m!==null&&(r.set(l,new P(m)),l===0&&this._isClosed&&r.set(r.size()-1,new P(m)))}},_o.prototype.findSnapForVertex=function(r,o){for(var a=0;a<o.length;a++){if(r.equals2D(o[a]))return null;if(r.distance(o[a])<this._snapTolerance)return o[a]}return null},_o.prototype.snapTo=function(r){var o=new J(this._srcPts);return this.snapVertices(o,r),this.snapSegments(o,r),o.toCoordinateArray()},_o.prototype.snapSegments=function(r,o){if(o.length===0)return null;var a=o.length;o[0].equals2D(o[o.length-1])&&(a=o.length-1);for(var l=0;l<a;l++){var h=o[l],m=this.findSegmentIndexToSnap(h,r);m>=0&&r.add(m+1,new P(h),!1)}},_o.prototype.findSegmentIndexToSnap=function(r,o){for(var a=w.MAX_VALUE,l=-1,h=0;h<o.size()-1;h++){if(this._seg.p0=o.get(h),this._seg.p1=o.get(h+1),this._seg.p0.equals2D(r)||this._seg.p1.equals2D(r)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(r);m<this._snapTolerance&&m<a&&(a=m,l=h)}return l},_o.prototype.setAllowSnappingToSourceVertices=function(r){this._allowSnappingToSourceVertices=r},_o.prototype.interfaces_=function(){return[]},_o.prototype.getClass=function(){return _o},_o.isClosed=function(r){return!(r.length<=1)&&r[0].equals2D(r[r.length-1])};var Gn=function(r){this._srcGeom=r||null},L1={SNAP_PRECISION_FACTOR:{configurable:!0}};Gn.prototype.snapTo=function(r,o){var a=this.extractTargetCoordinates(r);return new N1(o,a).transform(this._srcGeom)},Gn.prototype.snapToSelf=function(r,o){var a=this.extractTargetCoordinates(this._srcGeom),l=new N1(r,a,!0).transform(this._srcGeom),h=l;return o&&$(h,le)&&(h=l.buffer(0)),h},Gn.prototype.computeSnapTolerance=function(r){return this.computeMinimumSegmentLength(r)/10},Gn.prototype.extractTargetCoordinates=function(r){for(var o=new E,a=r.getCoordinates(),l=0;l<a.length;l++)o.add(a[l]);return o.toArray(new Array(0).fill(null))},Gn.prototype.computeMinimumSegmentLength=function(r){for(var o=w.MAX_VALUE,a=0;a<r.length-1;a++){var l=r[a].distance(r[a+1]);l<o&&(o=l)}return o},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.snap=function(r,o,a){var l=new Array(2).fill(null),h=new Gn(r);l[0]=h.snapTo(o,a);var m=new Gn(o);return l[1]=m.snapTo(l[0],a),l},Gn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var r=arguments[0],o=Gn.computeSizeBasedSnapTolerance(r),a=r.getPrecisionModel();if(a.getType()===_e.FIXED){var l=1/a.getScale()*2/1.415;l>o&&(o=l)}return o}if(arguments.length===2){var h=arguments[0],m=arguments[1];return Math.min(Gn.computeOverlaySnapTolerance(h),Gn.computeOverlaySnapTolerance(m))}},Gn.computeSizeBasedSnapTolerance=function(r){var o=r.getEnvelopeInternal();return Math.min(o.getHeight(),o.getWidth())*Gn.SNAP_PRECISION_FACTOR},Gn.snapToSelf=function(r,o,a){return new Gn(r).snapToSelf(o,a)},L1.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Gn,L1);var N1=function(r){function o(a,l,h){r.call(this),this._snapTolerance=a||null,this._snapPts=l||null,this._isSelfSnap=h!==void 0&&h}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.snapLine=function(a,l){var h=new _o(a,this._snapTolerance);return h.setAllowSnappingToSourceVertices(this._isSelfSnap),h.snapTo(l)},o.prototype.transformCoordinates=function(a,l){var h=a.toCoordinateArray(),m=this.snapLine(h,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Wr),Nr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Nr.prototype.getCommon=function(){return w.longBitsToDouble(this._commonBits)},Nr.prototype.add=function(r){var o=w.doubleToLongBits(r);if(this._isFirst)return this._commonBits=o,this._commonSignExp=Nr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Nr.signExpBits(o)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Nr.numCommonMostSigMantissaBits(this._commonBits,o),this._commonBits=Nr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Nr.prototype.toString=function(){if(arguments.length===1){var r=arguments[0],o=w.longBitsToDouble(r),a="0000000000000000000000000000000000000000000000000000000000000000"+w.toBinaryString(r),l=a.substring(a.length-64);return l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+o+" ]"}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.getBit=function(r,o){return r&1<<o?1:0},Nr.signExpBits=function(r){return r>>52},Nr.zeroLowerBits=function(r,o){return r&~((1<<o)-1)},Nr.numCommonMostSigMantissaBits=function(r,o){for(var a=0,l=52;l>=0;l--){if(Nr.getBit(r,l)!==Nr.getBit(o,l))return a;a++}return 52};var ds=function(){this._commonCoord=null,this._ccFilter=new ka},Dg={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};ds.prototype.addCommonBits=function(r){var o=new gs(this._commonCoord);r.apply(o),r.geometryChanged()},ds.prototype.removeCommonBits=function(r){if(this._commonCoord.x===0&&this._commonCoord.y===0)return r;var o=new P(this._commonCoord);o.x=-o.x,o.y=-o.y;var a=new gs(o);return r.apply(a),r.geometryChanged(),r},ds.prototype.getCommonCoordinate=function(){return this._commonCoord},ds.prototype.add=function(r){r.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},ds.prototype.interfaces_=function(){return[]},ds.prototype.getClass=function(){return ds},Dg.CommonCoordinateFilter.get=function(){return ka},Dg.Translater.get=function(){return gs},Object.defineProperties(ds,Dg);var ka=function(){this._commonBitsX=new Nr,this._commonBitsY=new Nr};ka.prototype.filter=function(r){this._commonBitsX.add(r.x),this._commonBitsY.add(r.y)},ka.prototype.getCommonCoordinate=function(){return new P(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},ka.prototype.interfaces_=function(){return[j]},ka.prototype.getClass=function(){return ka};var gs=function(){this.trans=null;var r=arguments[0];this.trans=r};gs.prototype.filter=function(r,o){var a=r.getOrdinate(o,0)+this.trans.x,l=r.getOrdinate(o,1)+this.trans.y;r.setOrdinate(o,0,a),r.setOrdinate(o,1,l)},gs.prototype.isDone=function(){return!1},gs.prototype.isGeometryChanged=function(){return!0},gs.prototype.interfaces_=function(){return[Cn]},gs.prototype.getClass=function(){return gs};var or=function(r,o){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=r,this._geom[1]=o,this.computeSnapTolerance()};or.prototype.selfSnap=function(r){return new Gn(r).snapTo(r,this._snapTolerance)},or.prototype.removeCommonBits=function(r){this._cbr=new ds,this._cbr.add(r[0]),this._cbr.add(r[1]);var o=new Array(2).fill(null);return o[0]=this._cbr.removeCommonBits(r[0].copy()),o[1]=this._cbr.removeCommonBits(r[1].copy()),o},or.prototype.prepareResult=function(r){return this._cbr.addCommonBits(r),r},or.prototype.getResultGeometry=function(r){var o=this.snap(this._geom),a=de.overlayOp(o[0],o[1],r);return this.prepareResult(a)},or.prototype.checkValid=function(r){r.isValid()||Ut.out.println("Snapped geometry is invalid")},or.prototype.computeSnapTolerance=function(){this._snapTolerance=Gn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},or.prototype.snap=function(r){var o=this.removeCommonBits(r);return Gn.snap(o[0],o[1],this._snapTolerance)},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.overlayOp=function(r,o,a){return new or(r,o).getResultGeometry(a)},or.union=function(r,o){return or.overlayOp(r,o,de.UNION)},or.intersection=function(r,o){return or.overlayOp(r,o,de.INTERSECTION)},or.symDifference=function(r,o){return or.overlayOp(r,o,de.SYMDIFFERENCE)},or.difference=function(r,o){return or.overlayOp(r,o,de.DIFFERENCE)};var Or=function(r,o){this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=o};Or.prototype.getResultGeometry=function(r){var o=null,a=!1,l=null;try{o=de.overlayOp(this._geom[0],this._geom[1],r),a=!0}catch(h){if(!(h instanceof Ht))throw h;l=h}if(!a)try{o=or.overlayOp(this._geom[0],this._geom[1],r)}catch(h){throw h instanceof Ht?l:h}return o},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.overlayOp=function(r,o,a){return new Or(r,o).getResultGeometry(a)},Or.union=function(r,o){return Or.overlayOp(r,o,de.UNION)},Or.intersection=function(r,o){return Or.overlayOp(r,o,de.INTERSECTION)},Or.symDifference=function(r,o){return Or.overlayOp(r,o,de.SYMDIFFERENCE)},Or.difference=function(r,o){return Or.overlayOp(r,o,de.DIFFERENCE)};var xc=function(){this.mce=null,this.chainIndex=null;var r=arguments[0],o=arguments[1];this.mce=r,this.chainIndex=o};xc.prototype.computeIntersections=function(r,o){this.mce.computeIntersectsForChain(this.chainIndex,r.mce,r.chainIndex,o)},xc.prototype.interfaces_=function(){return[]},xc.prototype.getClass=function(){return xc};var ni=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var o=arguments[0],a=arguments[1];this._eventType=r.DELETE,this._xValue=o,this._insertEvent=a}else if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];this._eventType=r.INSERT,this._label=l,this._xValue=h,this._obj=m}},Fg={INSERT:{configurable:!0},DELETE:{configurable:!0}};ni.prototype.isDelete=function(){return this._eventType===ni.DELETE},ni.prototype.setDeleteEventIndex=function(r){this._deleteEventIndex=r},ni.prototype.getObject=function(){return this._obj},ni.prototype.compareTo=function(r){var o=r;return this._xValue<o._xValue?-1:this._xValue>o._xValue?1:this._eventType<o._eventType?-1:this._eventType>o._eventType?1:0},ni.prototype.getInsertEvent=function(){return this._insertEvent},ni.prototype.isInsert=function(){return this._eventType===ni.INSERT},ni.prototype.isSameLabel=function(r){return this._label!==null&&this._label===r._label},ni.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ni.prototype.interfaces_=function(){return[B]},ni.prototype.getClass=function(){return ni},Fg.INSERT.get=function(){return 1},Fg.DELETE.get=function(){return 2},Object.defineProperties(ni,Fg);var th=function(){};th.prototype.interfaces_=function(){return[]},th.prototype.getClass=function(){return th};var hr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var r=arguments[0],o=arguments[1],a=arguments[2];this._li=r,this._includeProper=o,this._recordIsolated=a};hr.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(hr.isAdjacentSegments(o,l))return!0;if(r.isClosed()){var h=r.getNumPoints()-1;if(o===0&&l===h||l===0&&o===h)return!0}}return!1},hr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},hr.prototype.setIsDoneIfProperInt=function(r){this._isDoneWhenProperInt=r},hr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},hr.prototype.isBoundaryPointInternal=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next().getCoordinate();if(r.isIntersection(l))return!0}return!1},hr.prototype.hasProperIntersection=function(){return this._hasProper},hr.prototype.hasIntersection=function(){return this._hasIntersection},hr.prototype.isDone=function(){return this._isDone},hr.prototype.isBoundaryPoint=function(r,o){return o!==null&&(!!this.isBoundaryPointInternal(r,o[0])||!!this.isBoundaryPointInternal(r,o[1]))},hr.prototype.setBoundaryNodes=function(r,o){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=r,this._bdyNodes[1]=o},hr.prototype.addIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&(this._recordIsolated&&(r.setIsolated(!1),a.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(r,o,a,l)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var WD=function(r){function o(){r.call(this),this.events=new O,this.nOverlaps=null}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.prepareEvents=function(){zi.sort(this.events);for(var a=0;a<this.events.size();a++){var l=this.events.get(a);l.isDelete()&&l.getInsertEvent().setDeleteEventIndex(a)}},o.prototype.computeIntersections=function(){if(arguments.length===1){var a=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var l=0;l<this.events.size();l++){var h=this.events.get(l);if(h.isInsert()&&this.processOverlaps(l,h.getDeleteEventIndex(),h,a),a.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof hr&&$(arguments[0],ht)&&$(arguments[1],ht)){var m=arguments[0],S=arguments[1],C=arguments[2];this.addEdges(m,m),this.addEdges(S,S),this.computeIntersections(C)}else if(typeof arguments[2]=="boolean"&&$(arguments[0],ht)&&arguments[1]instanceof hr){var z=arguments[0],K=arguments[1];arguments[2]?this.addEdges(z,null):this.addEdges(z),this.computeIntersections(K)}}},o.prototype.addEdge=function(a,l){for(var h=a.getMonotoneChainEdge(),m=h.getStartIndexes(),S=0;S<m.length-1;S++){var C=new xc(h,S),z=new ni(l,h.getMinX(S),C);this.events.add(z),this.events.add(new ni(h.getMaxX(S),z))}},o.prototype.processOverlaps=function(a,l,h,m){for(var S=h.getObject(),C=a;C<l;C++){var z=this.events.get(C);if(z.isInsert()){var K=z.getObject();h.isSameLabel(z)||(S.computeIntersections(K,m),this.nOverlaps++)}}},o.prototype.addEdges=function(){if(arguments.length===1)for(var a=arguments[0].iterator();a.hasNext();){var l=a.next();this.addEdge(l,l)}else if(arguments.length===2)for(var h=arguments[0],m=arguments[1],S=h.iterator();S.hasNext();){var C=S.next();this.addEdge(C,m)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(th),xo=function(){this._min=w.POSITIVE_INFINITY,this._max=w.NEGATIVE_INFINITY},O1={NodeComparator:{configurable:!0}};xo.prototype.getMin=function(){return this._min},xo.prototype.intersects=function(r,o){return!(this._min>o||this._max<r)},xo.prototype.getMax=function(){return this._max},xo.prototype.toString=function(){return wt.toLineString(new P(this._min,0),new P(this._max,0))},xo.prototype.interfaces_=function(){return[]},xo.prototype.getClass=function(){return xo},O1.NodeComparator.get=function(){return Ec},Object.defineProperties(xo,O1);var Ec=function(){};Ec.prototype.compare=function(r,o){var a=r,l=o,h=(a._min+a._max)/2,m=(l._min+l._max)/2;return h<m?-1:h>m?1:0},Ec.prototype.interfaces_=function(){return[D]},Ec.prototype.getClass=function(){return Ec};var XD=function(r){function o(){r.call(this),this._item=null;var a=arguments[0],l=arguments[1],h=arguments[2];this._min=a,this._max=l,this._item=h}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.query=function(a,l,h){if(!this.intersects(a,l))return null;h.visitItem(this._item)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(xo),YD=function(r){function o(){r.call(this),this._node1=null,this._node2=null;var a=arguments[0],l=arguments[1];this._node1=a,this._node2=l,this.buildExtent(this._node1,this._node2)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.buildExtent=function(a,l){this._min=Math.min(a._min,l._min),this._max=Math.max(a._max,l._max)},o.prototype.query=function(a,l,h){if(!this.intersects(a,l))return null;this._node1!==null&&this._node1.query(a,l,h),this._node2!==null&&this._node2.query(a,l,h)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(xo),Eo=function(){this._leaves=new O,this._root=null,this._level=0};Eo.prototype.buildTree=function(){zi.sort(this._leaves,new xo.NodeComparator);for(var r=this._leaves,o=null,a=new O;;){if(this.buildLevel(r,a),a.size()===1)return a.get(0);o=r,r=a,a=o}},Eo.prototype.insert=function(r,o,a){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new XD(r,o,a))},Eo.prototype.query=function(r,o,a){this.init(),this._root.query(r,o,a)},Eo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Eo.prototype.printNode=function(r){Ut.out.println(wt.toLineString(new P(r._min,this._level),new P(r._max,this._level)))},Eo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Eo.prototype.buildLevel=function(r,o){this._level++,o.clear();for(var a=0;a<r.size();a+=2){var l=r.get(a);if((a+1<r.size()?r.get(a):null)===null)o.add(l);else{var h=new YD(r.get(a),r.get(a+1));o.add(h)}}},Eo.prototype.interfaces_=function(){return[]},Eo.prototype.getClass=function(){return Eo};var Nu=function(){this._items=new O};Nu.prototype.visitItem=function(r){this._items.add(r)},Nu.prototype.getItems=function(){return this._items},Nu.prototype.interfaces_=function(){return[as]},Nu.prototype.getClass=function(){return Nu};var Ou=function(){this._index=null;var r=arguments[0];if(!$(r,le))throw new T("Argument must be Polygonal");this._index=new Ws(r)},Ug={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Ou.prototype.locate=function(r){var o=new St(r),a=new Du(o);return this._index.query(r.y,r.y,a),o.getLocation()},Ou.prototype.interfaces_=function(){return[Pu]},Ou.prototype.getClass=function(){return Ou},Ug.SegmentVisitor.get=function(){return Du},Ug.IntervalIndexedGeometry.get=function(){return Ws},Object.defineProperties(Ou,Ug);var Du=function(){this._counter=null;var r=arguments[0];this._counter=r};Du.prototype.visitItem=function(r){var o=r;this._counter.countSegment(o.getCoordinate(0),o.getCoordinate(1))},Du.prototype.interfaces_=function(){return[as]},Du.prototype.getClass=function(){return Du};var Ws=function(){this._index=new Eo;var r=arguments[0];this.init(r)};Ws.prototype.init=function(r){for(var o=lr.getLines(r).iterator();o.hasNext();){var a=o.next().getCoordinates();this.addLine(a)}},Ws.prototype.addLine=function(r){for(var o=1;o<r.length;o++){var a=new ae(r[o-1],r[o]),l=Math.min(a.p0.y,a.p1.y),h=Math.max(a.p0.y,a.p1.y);this._index.insert(l,h,a)}},Ws.prototype.query=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=new Nu;return this._index.query(r,o,a),a.getItems()}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];this._index.query(l,h,m)}},Ws.prototype.interfaces_=function(){return[]},Ws.prototype.getClass=function(){return Ws};var Sc=function(r){function o(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new fc,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new ki,arguments.length===2){var a=arguments[0],l=arguments[1],h=b.OGC_SFS_BOUNDARY_RULE;this._argIndex=a,this._parentGeom=l,this._boundaryNodeRule=h,l!==null&&this.add(l)}else if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];this._argIndex=m,this._parentGeom=S,this._boundaryNodeRule=C,S!==null&&this.add(S)}}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.insertBoundaryPoint=function(a,l){var h=this._nodes.addNode(l).getLabel(),m=1;V.NONE,h.getLocation(a,Ft.ON)===V.BOUNDARY&&m++;var S=o.determineBoundary(this._boundaryNodeRule,m);h.setLocation(a,S)},o.prototype.computeSelfNodes=function(){if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.computeSelfNodes(a,l,!1)}if(arguments.length===3){var h=arguments[0],m=arguments[1],S=arguments[2],C=new hr(h,!0,!1);C.setIsDoneIfProperInt(S);var z=this.createEdgeSetIntersector(),K=this._parentGeom instanceof fe||this._parentGeom instanceof re||this._parentGeom instanceof he,mt=m||!K;return z.computeIntersections(this._edges,C,mt),this.addSelfIntersectionNodes(this._argIndex),C}},o.prototype.computeSplitEdges=function(a){for(var l=this._edges.iterator();l.hasNext();)l.next().eiList.addSplitEdges(a)},o.prototype.computeEdgeIntersections=function(a,l,h){var m=new hr(l,h,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,m),m},o.prototype.getGeometry=function(){return this._parentGeom},o.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},o.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},o.prototype.addPoint=function(){if(arguments[0]instanceof te){var a=arguments[0].getCoordinate();this.insertPoint(this._argIndex,a,V.INTERIOR)}else if(arguments[0]instanceof P){var l=arguments[0];this.insertPoint(this._argIndex,l,V.INTERIOR)}},o.prototype.addPolygon=function(a){this.addPolygonRing(a.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var l=0;l<a.getNumInteriorRing();l++){var h=a.getInteriorRingN(l);this.addPolygonRing(h,V.INTERIOR,V.EXTERIOR)}},o.prototype.addEdge=function(a){this.insertEdge(a);var l=a.getCoordinates();this.insertPoint(this._argIndex,l[0],V.BOUNDARY),this.insertPoint(this._argIndex,l[l.length-1],V.BOUNDARY)},o.prototype.addLineString=function(a){var l=et.removeRepeatedPoints(a.getCoordinates());if(l.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var h=new Qf(l,new pn(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(a,h),this.insertEdge(h),Pt.isTrue(l.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,l[0]),this.insertBoundaryPoint(this._argIndex,l[l.length-1])},o.prototype.getInvalidPoint=function(){return this._invalidPoint},o.prototype.getBoundaryPoints=function(){for(var a=this.getBoundaryNodes(),l=new Array(a.size()).fill(null),h=0,m=a.iterator();m.hasNext();){var S=m.next();l[h++]=S.getCoordinate().copy()}return l},o.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},o.prototype.addSelfIntersectionNode=function(a,l,h){if(this.isBoundaryNode(a,l))return null;h===V.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(a,l):this.insertPoint(a,l,h)},o.prototype.addPolygonRing=function(a,l,h){if(a.isEmpty())return null;var m=et.removeRepeatedPoints(a.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var S=l,C=h;ot.isCCW(m)&&(S=h,C=l);var z=new Qf(m,new pn(this._argIndex,V.BOUNDARY,S,C));this._lineEdgeMap.put(a,z),this.insertEdge(z),this.insertPoint(this._argIndex,m[0],V.BOUNDARY)},o.prototype.insertPoint=function(a,l,h){var m=this._nodes.addNode(l),S=m.getLabel();S===null?m._label=new pn(a,h):S.setLocation(a,h)},o.prototype.createEdgeSetIntersector=function(){return new WD},o.prototype.addSelfIntersectionNodes=function(a){for(var l=this._edges.iterator();l.hasNext();)for(var h=l.next(),m=h.getLabel().getLocation(a),S=h.eiList.iterator();S.hasNext();){var C=S.next();this.addSelfIntersectionNode(a,C.coord,m)}},o.prototype.add=function(){if(arguments.length!==1)return r.prototype.add.apply(this,arguments);var a=arguments[0];if(a.isEmpty())return null;if(a instanceof he&&(this._useBoundaryDeterminationRule=!1),a instanceof re)this.addPolygon(a);else if(a instanceof ut)this.addLineString(a);else if(a instanceof te)this.addPoint(a);else if(a instanceof ve)this.addCollection(a);else if(a instanceof Kr)this.addCollection(a);else if(a instanceof he)this.addCollection(a);else{if(!(a instanceof En))throw new Error(a.getClass().getName());this.addCollection(a)}},o.prototype.addCollection=function(a){for(var l=0;l<a.getNumGeometries();l++){var h=a.getGeometryN(l);this.add(h)}},o.prototype.locate=function(a){return $(this._parentGeom,le)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new Ou(this._parentGeom)),this._areaPtLocator.locate(a)):this._ptLocator.locate(a,this._parentGeom)},o.prototype.findEdge=function(){if(arguments.length===1){var a=arguments[0];return this._lineEdgeMap.get(a)}return r.prototype.findEdge.apply(this,arguments)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.determineBoundary=function(a,l){return a.isInBoundary(l)?V.BOUNDARY:V.INTERIOR},o}(On),Fu=function(){if(this._li=new N,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var r=arguments[0];this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Sc(0,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1],l=b.OGC_SFS_BOUNDARY_RULE;o.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(o.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sc(0,o,l),this._arg[1]=new Sc(1,a,l)}else if(arguments.length===3){var h=arguments[0],m=arguments[1],S=arguments[2];h.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(h.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sc(0,h,S),this._arg[1]=new Sc(1,m,S)}};Fu.prototype.getArgGeometry=function(r){return this._arg[r].getGeometry()},Fu.prototype.setComputationPrecision=function(r){this._resultPrecisionModel=r,this._li.setPrecisionModel(this._resultPrecisionModel)},Fu.prototype.interfaces_=function(){return[]},Fu.prototype.getClass=function(){return Fu};var Xs=function(){};Xs.prototype.interfaces_=function(){return[]},Xs.prototype.getClass=function(){return Xs},Xs.map=function(){if(arguments[0]instanceof Rt&&$(arguments[1],Xs.MapOp)){for(var r=arguments[0],o=arguments[1],a=new O,l=0;l<r.getNumGeometries();l++){var h=o.map(r.getGeometryN(l));h!==null&&a.add(h)}return r.getFactory().buildGeometry(a)}if($(arguments[0],tt)&&$(arguments[1],Xs.MapOp)){for(var m=arguments[0],S=arguments[1],C=new O,z=m.iterator();z.hasNext();){var K=z.next(),mt=S.map(K);mt!==null&&C.add(mt)}return C}},Xs.MapOp=function(){};var de=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l),this._ptLocator=new ki,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Gi,this._resultPolyList=new O,this._resultLineList=new O,this._resultPointList=new O,this._graph=new On(new b1),this._geomFact=a.getFactory()}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.insertUniqueEdge=function(a){var l=this._edgeList.findEqualEdge(a);if(l!==null){var h=l.getLabel(),m=a.getLabel();l.isPointwiseEqual(a)||(m=new pn(a.getLabel())).flip();var S=l.getDepth();S.isNull()&&S.add(h),S.add(m),h.merge(m)}else this._edgeList.add(a)},o.prototype.getGraph=function(){return this._graph},o.prototype.cancelDuplicateResultEdges=function(){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var l=a.next(),h=l.getSym();l.isInResult()&&h.isInResult()&&(l.setInResult(!1),h.setInResult(!1))}},o.prototype.isCoveredByLA=function(a){return!!this.isCovered(a,this._resultLineList)||!!this.isCovered(a,this._resultPolyList)},o.prototype.computeGeometry=function(a,l,h,m){var S=new O;return S.addAll(a),S.addAll(l),S.addAll(h),S.isEmpty()?o.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(S)},o.prototype.mergeSymLabels=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().mergeSymLabels()},o.prototype.isCovered=function(a,l){for(var h=l.iterator();h.hasNext();){var m=h.next();if(this._ptLocator.locate(a,m)!==V.EXTERIOR)return!0}return!1},o.prototype.replaceCollapsedEdges=function(){for(var a=new O,l=this._edgeList.iterator();l.hasNext();){var h=l.next();h.isCollapsed()&&(l.remove(),a.add(h.getCollapsedEdge()))}this._edgeList.addAll(a)},o.prototype.updateNodeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var l=a.next(),h=l.getEdges().getLabel();l.getLabel().merge(h)}},o.prototype.getResultGeometry=function(a){return this.computeOverlay(a),this._resultGeom},o.prototype.insertUniqueEdges=function(a){for(var l=a.iterator();l.hasNext();){var h=l.next();this.insertUniqueEdge(h)}},o.prototype.computeOverlay=function(a){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var l=new O;this._arg[0].computeSplitEdges(l),this._arg[1].computeSplitEdges(l),this.insertUniqueEdges(l),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Hs.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var h=new Qr(this._geomFact);h.add(this._graph),this._resultPolyList=h.getPolygons();var m=new io(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(a);var S=new Ga(this,this._geomFact,this._ptLocator);this._resultPointList=S.build(a),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,a)},o.prototype.labelIncompleteNode=function(a,l){var h=this._ptLocator.locate(a.getCoordinate(),this._arg[l].getGeometry());a.getLabel().setLocation(l,h)},o.prototype.copyPoints=function(a){for(var l=this._arg[a].getNodeIterator();l.hasNext();){var h=l.next();this._graph.addNode(h.getCoordinate()).setLabel(a,h.getLabel().getLocation(a))}},o.prototype.findResultAreaEdges=function(a){for(var l=this._graph.getEdgeEnds().iterator();l.hasNext();){var h=l.next(),m=h.getLabel();m.isArea()&&!h.isInteriorAreaEdge()&&o.isResultOfOp(m.getLocation(0,Ft.RIGHT),m.getLocation(1,Ft.RIGHT),a)&&h.setInResult(!0)}},o.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var l=a.next(),h=l.getLabel(),m=l.getDepth();if(!m.isNull()){m.normalize();for(var S=0;S<2;S++)h.isNull(S)||!h.isArea()||m.isNull(S)||(m.getDelta(S)===0?h.toLine(S):(Pt.isTrue(!m.isNull(S,Ft.LEFT),"depth of LEFT side has not been initialized"),h.setLocation(S,Ft.LEFT,m.getLocation(S,Ft.LEFT)),Pt.isTrue(!m.isNull(S,Ft.RIGHT),"depth of RIGHT side has not been initialized"),h.setLocation(S,Ft.RIGHT,m.getLocation(S,Ft.RIGHT))))}}},o.prototype.computeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},o.prototype.labelIncompleteNodes=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var l=a.next(),h=l.getLabel();l.isIsolated()&&(h.isNull(0)?this.labelIncompleteNode(l,0):this.labelIncompleteNode(l,1)),l.getEdges().updateLabelling(h)}},o.prototype.isCoveredByA=function(a){return!!this.isCovered(a,this._resultPolyList)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Fu);de.overlayOp=function(r,o,a){return new de(r,o).getResultGeometry(a)},de.intersection=function(r,o){if(r.isEmpty()||o.isEmpty())return de.createEmptyResult(de.INTERSECTION,r,o,r.getFactory());if(r.isGeometryCollection()){var a=o;return za.map(r,{interfaces_:function(){return[Xs.MapOp]},map:function(l){return l.intersection(a)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.INTERSECTION)},de.symDifference=function(r,o){if(r.isEmpty()||o.isEmpty()){if(r.isEmpty()&&o.isEmpty())return de.createEmptyResult(de.SYMDIFFERENCE,r,o,r.getFactory());if(r.isEmpty())return o.copy();if(o.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.SYMDIFFERENCE)},de.resultDimension=function(r,o,a){var l=o.getDimension(),h=a.getDimension(),m=-1;switch(r){case de.INTERSECTION:m=Math.min(l,h);break;case de.UNION:m=Math.max(l,h);break;case de.DIFFERENCE:m=l;break;case de.SYMDIFFERENCE:m=Math.max(l,h)}return m},de.createEmptyResult=function(r,o,a,l){var h=null;switch(de.resultDimension(r,o,a)){case-1:h=l.createGeometryCollection(new Array(0).fill(null));break;case 0:h=l.createPoint();break;case 1:h=l.createLineString();break;case 2:h=l.createPolygon()}return h},de.difference=function(r,o){return r.isEmpty()?de.createEmptyResult(de.DIFFERENCE,r,o,r.getFactory()):o.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.DIFFERENCE))},de.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=r.getLocation(0),l=r.getLocation(1);return de.isResultOfOp(a,l,o)}if(arguments.length===3){var h=arguments[0],m=arguments[1],S=arguments[2];switch(h===V.BOUNDARY&&(h=V.INTERIOR),m===V.BOUNDARY&&(m=V.INTERIOR),S){case de.INTERSECTION:return h===V.INTERIOR&&m===V.INTERIOR;case de.UNION:return h===V.INTERIOR||m===V.INTERIOR;case de.DIFFERENCE:return h===V.INTERIOR&&m!==V.INTERIOR;case de.SYMDIFFERENCE:return h===V.INTERIOR&&m!==V.INTERIOR||h!==V.INTERIOR&&m===V.INTERIOR}return!1}},de.INTERSECTION=1,de.UNION=2,de.DIFFERENCE=3,de.SYMDIFFERENCE=4;var ms=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new ki,this._seg=new ae;var r=arguments[0],o=arguments[1];this._g=r,this._boundaryDistanceTolerance=o,this._linework=this.extractLinework(r)};ms.prototype.isWithinToleranceOfBoundary=function(r){for(var o=0;o<this._linework.getNumGeometries();o++)for(var a=this._linework.getGeometryN(o).getCoordinateSequence(),l=0;l<a.size()-1;l++)if(a.getCoordinate(l,this._seg.p0),a.getCoordinate(l+1,this._seg.p1),this._seg.distance(r)<=this._boundaryDistanceTolerance)return!0;return!1},ms.prototype.getLocation=function(r){return this.isWithinToleranceOfBoundary(r)?V.BOUNDARY:this._ptLocator.locate(r,this._g)},ms.prototype.extractLinework=function(r){var o=new Uu;r.apply(o);var a=o.getLinework(),l=me.toLineStringArray(a);return r.getFactory().createMultiLineString(l)},ms.prototype.interfaces_=function(){return[]},ms.prototype.getClass=function(){return ms};var Uu=function(){this._linework=null,this._linework=new O};Uu.prototype.getLinework=function(){return this._linework},Uu.prototype.filter=function(r){if(r instanceof re){var o=r;this._linework.add(o.getExteriorRing());for(var a=0;a<o.getNumInteriorRing();a++)this._linework.add(o.getInteriorRingN(a))}},Uu.prototype.interfaces_=function(){return[Nn]},Uu.prototype.getClass=function(){return Uu};var Ys=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var r=arguments[0];this._g=r};Ys.prototype.extractPoints=function(r,o,a){for(var l=r.getCoordinates(),h=0;h<l.length-1;h++)this.computeOffsetPoints(l[h],l[h+1],o,a)},Ys.prototype.setSidesToGenerate=function(r,o){this._doLeft=r,this._doRight=o},Ys.prototype.getPoints=function(r){for(var o=new O,a=lr.getLines(this._g).iterator();a.hasNext();){var l=a.next();this.extractPoints(l,r,o)}return o},Ys.prototype.computeOffsetPoints=function(r,o,a,l){var h=o.x-r.x,m=o.y-r.y,S=Math.sqrt(h*h+m*m),C=a*h/S,z=a*m/S,K=(o.x+r.x)/2,mt=(o.y+r.y)/2;if(this._doLeft){var yt=new P(K-z,mt+C);l.add(yt)}if(this._doRight){var zt=new P(K+z,mt-C);l.add(zt)}},Ys.prototype.interfaces_=function(){return[]},Ys.prototype.getClass=function(){return Ys};var _i=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new O;var o=arguments[0],a=arguments[1],l=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(o,a),this._geom=[o,a,l],this._locFinder=[new ms(this._geom[0],this._boundaryDistanceTolerance),new ms(this._geom[1],this._boundaryDistanceTolerance),new ms(this._geom[2],this._boundaryDistanceTolerance)]},D1={TOLERANCE:{configurable:!0}};_i.prototype.reportResult=function(r,o,a){Ut.out.println("Overlay result invalid - A:"+V.toLocationSymbol(o[0])+" B:"+V.toLocationSymbol(o[1])+" expected:"+(a?"i":"e")+" actual:"+V.toLocationSymbol(o[2]))},_i.prototype.isValid=function(r){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var o=this.checkValid(r);return o},_i.prototype.checkValid=function(){if(arguments.length===1){for(var r=arguments[0],o=0;o<this._testCoords.size();o++){var a=this._testCoords.get(o);if(!this.checkValid(r,a))return this._invalidLocation=a,!1}return!0}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._location[0]=this._locFinder[0].getLocation(h),this._location[1]=this._locFinder[1].getLocation(h),this._location[2]=this._locFinder[2].getLocation(h),!!_i.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(l,this._location)}},_i.prototype.addTestPts=function(r){var o=new Ys(r);this._testCoords.addAll(o.getPoints(5*this._boundaryDistanceTolerance))},_i.prototype.isValidResult=function(r,o){var a=de.isResultOfOp(o[0],o[1],r),l=!(a^o[2]===V.INTERIOR);return l||this.reportResult(r,o,a),l},_i.prototype.getInvalidLocation=function(){return this._invalidLocation},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},_i.hasLocation=function(r,o){for(var a=0;a<3;a++)if(r[a]===o)return!0;return!1},_i.computeBoundaryDistanceTolerance=function(r,o){return Math.min(Gn.computeSizeBasedSnapTolerance(r),Gn.computeSizeBasedSnapTolerance(o))},_i.isValid=function(r,o,a,l){return new _i(r,o,l).isValid(a)},D1.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(_i,D1);var xi=function r(o){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(o),this._inputGeoms=o};xi.prototype.extractElements=function(r,o){if(r===null)return null;for(var a=0;a<r.getNumGeometries();a++){var l=r.getGeometryN(a);this._skipEmpty&&l.isEmpty()||o.add(l)}},xi.prototype.combine=function(){for(var r=new O,o=this._inputGeoms.iterator();o.hasNext();){var a=o.next();this.extractElements(a,r)}return r.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(r)},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi},xi.combine=function(){if(arguments.length===1){var r=arguments[0];return new xi(r).combine()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new xi(xi.createList(o,a)).combine()}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];return new xi(xi.createList(l,h,m)).combine()}},xi.extractFactory=function(r){return r.isEmpty()?null:r.iterator().next().getFactory()},xi.createList=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=new O;return a.add(r),a.add(o),a}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2],S=new O;return S.add(l),S.add(h),S.add(m),S}};var Wn=function(){this._inputPolys=null,this._geomFactory=null;var r=arguments[0];this._inputPolys=r,this._inputPolys===null&&(this._inputPolys=new O)},F1={STRTREE_NODE_CAPACITY:{configurable:!0}};Wn.prototype.reduceToGeometries=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next(),h=null;$(l,ht)?h=this.unionTree(l):l instanceof Rt&&(h=l),o.add(h)}return o},Wn.prototype.extractByEnvelope=function(r,o,a){for(var l=new O,h=0;h<o.getNumGeometries();h++){var m=o.getGeometryN(h);m.getEnvelopeInternal().intersects(r)?l.add(m):a.add(m)}return this._geomFactory.buildGeometry(l)},Wn.prototype.unionOptimized=function(r,o){var a=r.getEnvelopeInternal(),l=o.getEnvelopeInternal();if(!a.intersects(l))return xi.combine(r,o);if(r.getNumGeometries()<=1&&o.getNumGeometries()<=1)return this.unionActual(r,o);var h=a.intersection(l);return this.unionUsingEnvelopeIntersection(r,o,h)},Wn.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var r=new _1(Wn.STRTREE_NODE_CAPACITY),o=this._inputPolys.iterator();o.hasNext();){var a=o.next();r.insert(a.getEnvelopeInternal(),a)}this._inputPolys=null;var l=r.itemsTree();return this.unionTree(l)},Wn.prototype.binaryUnion=function(){if(arguments.length===1){var r=arguments[0];return this.binaryUnion(r,0,r.size())}if(arguments.length===3){var o=arguments[0],a=arguments[1],l=arguments[2];if(l-a<=1){var h=Wn.getGeometry(o,a);return this.unionSafe(h,null)}if(l-a==2)return this.unionSafe(Wn.getGeometry(o,a),Wn.getGeometry(o,a+1));var m=Math.trunc((l+a)/2),S=this.binaryUnion(o,a,m),C=this.binaryUnion(o,m,l);return this.unionSafe(S,C)}},Wn.prototype.repeatedUnion=function(r){for(var o=null,a=r.iterator();a.hasNext();){var l=a.next();o=o===null?l.copy():o.union(l)}return o},Wn.prototype.unionSafe=function(r,o){return r===null&&o===null?null:r===null?o.copy():o===null?r.copy():this.unionOptimized(r,o)},Wn.prototype.unionActual=function(r,o){return Wn.restrictToPolygons(r.union(o))},Wn.prototype.unionTree=function(r){var o=this.reduceToGeometries(r);return this.binaryUnion(o)},Wn.prototype.unionUsingEnvelopeIntersection=function(r,o,a){var l=new O,h=this.extractByEnvelope(a,r,l),m=this.extractByEnvelope(a,o,l),S=this.unionActual(h,m);return l.add(S),xi.combine(l)},Wn.prototype.bufferUnion=function(){if(arguments.length===1){var r=arguments[0];return r.get(0).getFactory().buildGeometry(r).buffer(0)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o.getFactory().createGeometryCollection([o,a]).buffer(0)}},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn},Wn.restrictToPolygons=function(r){if($(r,le))return r;var o=Ho.getPolygons(r);return o.size()===1?o.get(0):r.getFactory().createMultiPolygon(me.toPolygonArray(o))},Wn.getGeometry=function(r,o){return o>=r.size()?null:r.get(o)},Wn.union=function(r){return new Wn(r).union()},F1.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Wn,F1);var wc=function(){};wc.prototype.interfaces_=function(){return[]},wc.prototype.getClass=function(){return wc},wc.union=function(r,o){if(r.isEmpty()||o.isEmpty()){if(r.isEmpty()&&o.isEmpty())return de.createEmptyResult(de.UNION,r,o,r.getFactory());if(r.isEmpty())return o.copy();if(o.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.UNION)},n.GeoJSONReader=Cg,n.GeoJSONWriter=y1,n.OverlayOp=de,n.UnionOp=wc,n.BufferOp=ur,Object.defineProperty(n,"__esModule",{value:!0})})});var r1=X((CAt,PO)=>{"use strict";var HQ=bc(),IO=Function.prototype,TO=IO.apply,CO=IO.call;PO.exports=typeof Reflect=="object"&&Reflect.apply||(HQ?CO.bind(TO):function(){return CO.apply(TO,arguments)})});var FO=X((IAt,DO)=>{"use strict";a_();var RO=vr(),LO=Ha(),WQ=gd(),NO=An(),OO=Xr(),XQ=xs(),YQ=OO("species"),i1=RegExp.prototype;DO.exports=function(n,t,e,i){var s=OO(n),u=!NO(function(){var d={};return d[s]=function(){return 7},""[n](d)!==7}),c=u&&!NO(function(){var d=!1,g=/a/;return n==="split"&&(g={},g.constructor={},g.constructor[YQ]=function(){return g},g.flags="",g[s]=/./[s]),g.exec=function(){return d=!0,null},g[s](""),!d});if(!u||!c||e){var f=/./[s],p=t(s,""[n],function(d,g,y,v,E){var M=g.exec;return M===WQ||M===i1.exec?u&&!E?{done:!0,value:RO(f,g,y,v)}:{done:!0,value:RO(d,y,g,v)}:{done:!1}});LO(String.prototype,n,p[0]),LO(i1,s,p[1])}i&&XQ(i1[s],"sham",!0)}});var GO=X((PAt,zO)=>{"use strict";var o1=In(),$Q=Hi(),ZQ=Fl(),JQ=zu(),jQ=o1("".charAt),UO=o1("".charCodeAt),KQ=o1("".slice),BO=function(n){return function(t,e){var i=ZQ(JQ(t)),s=$Q(e),u=i.length,c,f;return s<0||s>=u?n?"":void 0:(c=UO(i,s),c<55296||c>56319||s+1===u||(f=UO(i,s+1))<56320||f>57343?n?jQ(i,s):c:n?KQ(i,s,s+2):(c-55296<<10)+(f-56320)+65536)}};zO.exports={codeAt:BO(!1),charAt:BO(!0)}});var qO=X((RAt,kO)=>{"use strict";var QQ=GO().charAt;kO.exports=function(n,t,e){return t+(e?QQ(n,t).length:1)}});var HO=X((LAt,VO)=>{"use strict";var u1=In(),ttt=Vi(),ett=Math.floor,s1=u1("".charAt),ntt=u1("".replace),a1=u1("".slice),rtt=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,itt=/\$([$&'`]|\d{1,2})/g;VO.exports=function(n,t,e,i,s,u){var c=e+n.length,f=i.length,p=itt;return s!==void 0&&(s=ttt(s),p=rtt),ntt(u,p,function(d,g){var y;switch(s1(g,0)){case"$":return"$";case"&":return n;case"`":return a1(t,0,e);case"'":return a1(t,c);case"<":y=s[a1(g,1,-1)];break;default:var v=+g;if(v===0)return d;if(v>f){var E=ett(v/10);return E===0?d:E<=f?i[E-1]===void 0?s1(g,1):i[E-1]+s1(g,1):d}y=i[v-1]}return y===void 0?"":y})}});var YO=X((NAt,XO)=>{"use strict";var WO=vr(),ott=so(),stt=er(),att=vs(),utt=gd(),ltt=TypeError;XO.exports=function(n,t){var e=n.exec;if(stt(e)){var i=WO(e,n,t);return i!==null&&ott(i),i}if(att(n)==="RegExp")return WO(utt,n,t);throw new ltt("RegExp#exec called on incompatible receiver")}});var KO=X(()=>{"use strict";var ctt=r1(),$O=vr(),_g=In(),ftt=FO(),htt=An(),ptt=so(),dtt=er(),gtt=Ei(),mtt=Hi(),ytt=Wa(),ac=Fl(),vtt=zu(),_tt=qO(),xtt=Pc(),Ett=HO(),Stt=YO(),wtt=Xr(),c1=wtt("replace"),Mtt=Math.max,btt=Math.min,Att=_g([].concat),l1=_g([].push),ZO=_g("".indexOf),JO=_g("".slice),Ttt=function(n){return n===void 0?n:String(n)},Ctt=function(){return"a".replace(/./,"$0")==="$0"}(),jO=function(){return/./[c1]?/./[c1]("a","$0")==="":!1}(),Itt=!htt(function(){var n=/./;return n.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(n,"$<a>")!=="7"});ftt("replace",function(n,t,e){var i=jO?"$":"$0";return[function(u,c){var f=vtt(this),p=gtt(u)?xtt(u,c1):void 0;return p?$O(p,u,f,c):$O(t,ac(f),u,c)},function(s,u){var c=ptt(this),f=ac(s);if(typeof u=="string"&&ZO(u,i)===-1&&ZO(u,"$<")===-1){var p=e(t,c,f,u);if(p.done)return p.value}var d=dtt(u);d||(u=ac(u));var g=c.global,y;g&&(y=c.unicode,c.lastIndex=0);for(var v=[],E;E=Stt(c,f),!(E===null||(l1(v,E),!g));){var M=ac(E[0]);M===""&&(c.lastIndex=_tt(f,ytt(c.lastIndex),y))}for(var A="",_=0,x=0;x<v.length;x++){E=v[x];for(var T=ac(E[0]),w=Mtt(btt(mtt(E.index),f.length),0),R=[],B,U=1;U<E.length;U++)l1(R,Ttt(E[U]));var D=E.groups;if(d){var P=Att([T],R,w,f);D!==void 0&&l1(P,D),B=ac(ctt(u,void 0,P))}else B=Ett(T,f,w,R,D,u);w>=_&&(A+=JO(f,_,w)+B,_=w+T.length)}return A+JO(f,_)}]},!Itt||!Ctt||jO)});var tD=X((FAt,QO)=>{"use strict";var Ptt=An();QO.exports=function(n,t){var e=[][n];return!!e&&Ptt(function(){e.call(null,t||function(){return 1},1)})}});var lD=X(()=>{"use strict";var Rtt=sr(),aD=In(),Ltt=_s(),Ntt=Vi(),eD=ii(),Ott=hy(),nD=Fl(),f1=An(),Dtt=A0(),Ftt=tD(),rD=T0(),Utt=C0(),iD=Cc(),oD=I0(),Ca=[],sD=aD(Ca.sort),Btt=aD(Ca.push),ztt=f1(function(){Ca.sort(void 0)}),Gtt=f1(function(){Ca.sort(null)}),ktt=Ftt("sort"),uD=!f1(function(){if(iD)return iD<70;if(!(rD&&rD>3)){if(Utt)return!0;if(oD)return oD<603;var n="",t,e,i,s;for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(s=0;s<47;s++)Ca.push({k:e+s,v:i})}for(Ca.sort(function(u,c){return c.v-u.v}),s=0;s<Ca.length;s++)e=Ca[s].k.charAt(0),n.charAt(n.length-1)!==e&&(n+=e);return n!=="DGBEFHACIJK"}}),qtt=ztt||!Gtt||!ktt||!uD,Vtt=function(n){return function(t,e){return e===void 0?-1:t===void 0?1:n!==void 0?+n(t,e)||0:nD(t)>nD(e)?1:-1}};Rtt({target:"Array",proto:!0,forced:qtt},{sort:function(t){t!==void 0&&Ltt(t);var e=Ntt(this);if(uD)return t===void 0?sD(e):sD(e,t);var i=[],s=eD(e),u,c;for(c=0;c<s;c++)c in e&&Btt(i,e[c]);for(Dtt(i,Vtt(t)),u=eD(i),c=0;c<u;)e[c]=i[c++];for(;c<s;)Ott(e,c++);return e}})});var mD=X((XAt,gD)=>{"use strict";var Htt=In(),hD=Oc(),Wtt=er(),pD=vs(),Xtt=Fl(),dD=Htt([].push);gD.exports=function(n){if(Wtt(n))return n;if(hD(n)){for(var t=n.length,e=[],i=0;i<t;i++){var s=n[i];typeof s=="string"?dD(e,s):(typeof s=="number"||pD(s)==="Number"||pD(s)==="String")&&dD(e,Xtt(s))}var u=e.length,c=!0;return function(f,p){if(c)return c=!1,p;if(hD(this))return p;for(var d=0;d<u;d++)if(e[d]===f)return p}}}});var CD=X(()=>{"use strict";var Ytt=sr(),MD=$s(),bD=r1(),$tt=vr(),Yf=In(),AD=An(),yD=er(),vD=Ic(),TD=zh(),Ztt=mD(),Jtt=oh(),jtt=String,Ia=MD("JSON","stringify"),xg=Yf(/./.exec),_D=Yf("".charAt),Ktt=Yf("".charCodeAt),Qtt=Yf("".replace),tet=Yf(1 .toString),eet=/[\uD800-\uDFFF]/g,xD=/^[\uD800-\uDBFF]$/,ED=/^[\uDC00-\uDFFF]$/,SD=!Jtt||AD(function(){var n=MD("Symbol")("stringify detection");return Ia([n])!=="[null]"||Ia({a:n})!=="{}"||Ia(Object(n))!=="{}"}),wD=AD(function(){return Ia("\uDF06\uD834")!=='"\\udf06\\ud834"'||Ia("\uDEAD")!=='"\\udead"'}),net=function(n,t){var e=TD(arguments),i=Ztt(t);if(!(!yD(i)&&(n===void 0||vD(n))))return e[1]=function(s,u){if(yD(i)&&(u=$tt(i,this,jtt(s),u)),!vD(u))return u},bD(Ia,null,e)},ret=function(n,t,e){var i=_D(e,t-1),s=_D(e,t+1);return xg(xD,n)&&!xg(ED,s)||xg(ED,n)&&!xg(xD,i)?"\\u"+tet(Ktt(n,0),16):n};Ia&&Ytt({target:"JSON",stat:!0,arity:3,forced:SD||wD},{stringify:function(t,e,i){var s=TD(arguments),u=bD(SD?net:Ia,null,s);return wD&&typeof u=="string"?Qtt(u,eet,ret):u}})});function Bu(){return Bu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},Bu.apply(this,arguments)}var OTt=Jt(Dc(),1),DTt=Jt(zS(),1),FTt=Jt(Yu(),1),UTt=Jt(hM(),1),BTt=Jt(pM(),1),zTt=Jt(g0(),1),GTt=Jt(m0(),1),kTt=Jt(y0(),1),qTt=Jt(_0(),1),VTt=Jt(x0(),1),HTt=Jt(M0(),1),WTt=Jt(R0(),1),XTt=Jt(N0(),1),YTt=Jt(O0(),1),$Tt=Jt(F0(),1),ZTt=Jt(B0(),1),JTt=Jt(q0(),1),jTt=Jt(W0(),1),KTt=Jt(sy(),1),QTt=Jt(ay(),1),tCt=Jt(kT(),1),eCt=Jt(WT(),1),nCt=Jt(JT(),1),rCt=Jt(QT(),1),iCt=Jt(nC(),1),oCt=Jt(oC(),1),sCt=Jt(uC(),1),aCt=Jt(fC(),1);var $o,Kc=function(n){return n.MAP_VERSION="map_version",n.ROUTE_VERSION="route_version",n.FACILITY_VERSION="facility_version",n.MAP_DATA="map_data",n.ROAD_NETWORK_DATA="road_network_data",n.FACILITY_DATA="facility_data",n.POI_TEXT="poi_text_1",n.LAZY_TEXTURE="lazy_texture",n.LAZY_POI="lazy_poi",n}({});function ip(n,t){return n===void 0&&(n="aibee_map"),t===void 0&&(t=7),new Promise((e,i)=>{if($o)return e({db:$o,type:"success"});let s=indexedDB.open(n,t);s.onupgradeneeded=function(u){$o=u.target.result,console.log("[open db is onupgradeneeded]"),bs("map_version"),bs("route_version"),bs("facility_version"),bs("map_data"),bs("road_network_data"),bs("facility_data"),bs("poi_text_1"),bs("lazy_texture"),bs("lazy_poi")},s.onsuccess=u=>{$o=u.target.result,e({db:$o,type:"success"})},s.onerror=u=>{console.log("[open db is onerror]"),i(u)}})}function py(n,t,e){return e===void 0&&(e=$o),new Promise((i,s)=>{e||s("\u6CA1\u6709db");let c=e.transaction([n],"readonly").objectStore(n).get(t);c.onsuccess=()=>{c.result?i(c.result.value):i(null)},c.onerror=f=>{console.log("[getVersionByKey]",f),i(null)}})}function hC(n,t,e,i,s){return i===void 0&&(i=$o),s===void 0&&(s=!1),new Promise((u,c)=>Ri(this,null,function*(){if(!i){c("\u6CA1\u6709db");return}let f=s;s||(f=!!(yield py(n,t)));let p=i.transaction([n],"readwrite").objectStore(n),d=f?p.put({key:t,value:e}):p.add({key:t,value:e});d.onsuccess=function(g){u(g)},d.onerror=function(g){c(g)}}))}function bs(n,t){t===void 0&&(t=$o),t&&(t.objectStoreNames.contains(n)||t.createObjectStore(n,{keyPath:"key"}))}function pC(n){n===void 0&&(n=$o),n==null||n.close(),$o=null}var Iot=Jt(Yu(),1),Pot=Jt(Dc(),1);var Yv="162";var HH=0,dC=1,WH=2;var HI=1,XH=2,Rs=3,va=0,Oi=1,Ns=2,da=0,bl=1,gC=2,mC=3,yC=4,YH=5,eu=100,$H=101,ZH=102,vC=103,_C=104,JH=200,jH=201,KH=202,QH=203,jy=204,Ky=205,t6=206,e6=207,n6=208,r6=209,i6=210,o6=211,s6=212,a6=213,u6=214,l6=0,c6=1,f6=2,Np=3,h6=4,p6=5,d6=6,g6=7,WI=0,m6=1,y6=2,ga=0,v6=1,_6=2,x6=3,E6=4,S6=5,w6=6,M6=7;var XI=300,Cl=301,Il=302,Qy=303,tv=304,ud=306,ev=1e3,Ro=1001,nv=1002,bi=1003,xC=1004;var Qc=1005;var Ni=1006,dy=1007;var ru=1008;var ma=1009,b6=1010,A6=1011,$v=1012,YI=1013,pa=1014,Os=1015,ff=1016,$I=1017,ZI=1018,su=1020,T6=1021,Lo=1023,C6=1024,I6=1025,au=1026,Pl=1027,P6=1028,JI=1029,R6=1030,jI=1031,KI=1033,gy=33776,my=33777,yy=33778,vy=33779,EC=35840,SC=35841,wC=35842,MC=35843,QI=36196,bC=37492,AC=37496,TC=37808,CC=37809,IC=37810,PC=37811,RC=37812,LC=37813,NC=37814,OC=37815,DC=37816,FC=37817,UC=37818,BC=37819,zC=37820,GC=37821,_y=36492,kC=36494,qC=36495,L6=36283,VC=36284,HC=36285,WC=36286;var Op=2300,Dp=2301,xy=2302,XC=2400,YC=2401,$C=2402;var N6=3200,O6=3201,D6=0,F6=1,ha="",Zo="srgb",xa="srgb-linear",Zv="display-p3",ld="display-p3-linear",Fp="linear",kn="srgb",Up="rec709",Bp="p3";var rl=7680;var ZC=519,U6=512,B6=513,z6=514,tP=515,G6=516,k6=517,q6=518,V6=519,rv=35044;var JC="300 es",iv=1035,Ds=2e3,zp=2001,_a=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let s=this._listeners[t];if(s!==void 0){let u=s.indexOf(e);u!==-1&&s.splice(u,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let i=this._listeners[t.type];if(i!==void 0){t.target=this;let s=i.slice(0);for(let u=0,c=s.length;u<c;u++)s[u].call(this,t);t.target=null}}},oi=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var Ey=Math.PI/180,ov=180/Math.PI;function Fs(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(oi[n&255]+oi[n>>8&255]+oi[n>>16&255]+oi[n>>24&255]+"-"+oi[t&255]+oi[t>>8&255]+"-"+oi[t>>16&15|64]+oi[t>>24&255]+"-"+oi[e&63|128]+oi[e>>8&255]+"-"+oi[e>>16&255]+oi[e>>24&255]+oi[i&255]+oi[i>>8&255]+oi[i>>16&255]+oi[i>>24&255]).toLowerCase()}function ai(n,t,e){return Math.max(t,Math.min(e,n))}function H6(n,t){return(n%t+t)%t}function Sy(n,t,e){return(1-e)*n+e*t}function jC(n){return(n&n-1)===0&&n!==0}function sv(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function jo(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Pn(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Ot=class n{constructor(t=0,e=0){n.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ai(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),s=Math.sin(e),u=this.x-t.x,c=this.y-t.y;return this.x=u*i-c*s+t.x,this.y=u*s+c*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ee=class n{constructor(t,e,i,s,u,c,f,p,d){n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,s,u,c,f,p,d)}set(t,e,i,s,u,c,f,p,d){let g=this.elements;return g[0]=t,g[1]=s,g[2]=f,g[3]=e,g[4]=u,g[5]=p,g[6]=i,g[7]=c,g[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,u=this.elements,c=i[0],f=i[3],p=i[6],d=i[1],g=i[4],y=i[7],v=i[2],E=i[5],M=i[8],A=s[0],_=s[3],x=s[6],T=s[1],w=s[4],R=s[7],B=s[2],U=s[5],D=s[8];return u[0]=c*A+f*T+p*B,u[3]=c*_+f*w+p*U,u[6]=c*x+f*R+p*D,u[1]=d*A+g*T+y*B,u[4]=d*_+g*w+y*U,u[7]=d*x+g*R+y*D,u[2]=v*A+E*T+M*B,u[5]=v*_+E*w+M*U,u[8]=v*x+E*R+M*D,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],s=t[2],u=t[3],c=t[4],f=t[5],p=t[6],d=t[7],g=t[8];return e*c*g-e*f*d-i*u*g+i*f*p+s*u*d-s*c*p}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],u=t[3],c=t[4],f=t[5],p=t[6],d=t[7],g=t[8],y=g*c-f*d,v=f*p-g*u,E=d*u-c*p,M=e*y+i*v+s*E;if(M===0)return this.set(0,0,0,0,0,0,0,0,0);let A=1/M;return t[0]=y*A,t[1]=(s*d-g*i)*A,t[2]=(f*i-s*c)*A,t[3]=v*A,t[4]=(g*e-s*p)*A,t[5]=(s*u-f*e)*A,t[6]=E*A,t[7]=(i*p-d*e)*A,t[8]=(c*e-i*u)*A,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,u,c,f){let p=Math.cos(u),d=Math.sin(u);return this.set(i*p,i*d,-i*(p*c+d*f)+c+t,-s*d,s*p,-s*(-d*c+p*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(wy.makeScale(t,e)),this}rotate(t){return this.premultiply(wy.makeRotation(-t)),this}translate(t,e){return this.premultiply(wy.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},wy=new Ee;function eP(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function Gp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function W6(){let n=Gp("canvas");return n.style.display="block",n}var KC={};function nP(n){n in KC||(KC[n]=!0,console.warn(n))}var QC=new Ee().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),tI=new Ee().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),op={[xa]:{transfer:Fp,primaries:Up,toReference:n=>n,fromReference:n=>n},[Zo]:{transfer:kn,primaries:Up,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[ld]:{transfer:Fp,primaries:Bp,toReference:n=>n.applyMatrix3(tI),fromReference:n=>n.applyMatrix3(QC)},[Zv]:{transfer:kn,primaries:Bp,toReference:n=>n.convertSRGBToLinear().applyMatrix3(tI),fromReference:n=>n.applyMatrix3(QC).convertLinearToSRGB()}},X6=new Set([xa,ld]),Rn={enabled:!0,_workingColorSpace:xa,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!X6.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,t,e){if(this.enabled===!1||t===e||!t||!e)return n;let i=op[t].toReference,s=op[e].fromReference;return s(i(n))},fromWorkingColorSpace:function(n,t){return this.convert(n,this._workingColorSpace,t)},toWorkingColorSpace:function(n,t){return this.convert(n,t,this._workingColorSpace)},getPrimaries:function(n){return op[n].primaries},getTransfer:function(n){return n===ha?Fp:op[n].transfer}};function Al(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function My(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var il,kp=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{il===void 0&&(il=Gp("canvas")),il.width=t.width,il.height=t.height;let i=il.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=il}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Gp("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),u=s.data;for(let c=0;c<u.length;c++)u[c]=Al(u[c]/255)*255;return i.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(Al(e[i]/255)*255):e[i]=Al(e[i]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Y6=0,qp=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Y6++}),this.uuid=Fs(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let u;if(Array.isArray(s)){u=[];for(let c=0,f=s.length;c<f;c++)s[c].isDataTexture?u.push(by(s[c].image)):u.push(by(s[c]))}else u=by(s);i.url=u}return e||(t.images[this.uuid]=i),i}};function by(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?kp.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var $6=0,uo=class n extends _a{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,i=Ro,s=Ro,u=Ni,c=ru,f=Lo,p=ma,d=n.DEFAULT_ANISOTROPY,g=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$6++}),this.uuid=Fs(),this.name="",this.source=new qp(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=u,this.minFilter=c,this.anisotropy=d,this.format=f,this.internalFormat=null,this.type=p,this.offset=new Ot(0,0),this.repeat=new Ot(1,1),this.center=new Ot(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ee,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=g,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==XI)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ev:t.x=t.x-Math.floor(t.x);break;case Ro:t.x=t.x<0?0:1;break;case nv:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ev:t.y=t.y-Math.floor(t.y);break;case Ro:t.y=t.y<0?0:1;break;case nv:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}};uo.DEFAULT_IMAGE=null;uo.DEFAULT_MAPPING=XI;uo.DEFAULT_ANISOTROPY=1;var Yr=class n{constructor(t=0,e=0,i=0,s=1){n.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,u=this.w,c=t.elements;return this.x=c[0]*e+c[4]*i+c[8]*s+c[12]*u,this.y=c[1]*e+c[5]*i+c[9]*s+c[13]*u,this.z=c[2]*e+c[6]*i+c[10]*s+c[14]*u,this.w=c[3]*e+c[7]*i+c[11]*s+c[15]*u,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,u,p=t.elements,d=p[0],g=p[4],y=p[8],v=p[1],E=p[5],M=p[9],A=p[2],_=p[6],x=p[10];if(Math.abs(g-v)<.01&&Math.abs(y-A)<.01&&Math.abs(M-_)<.01){if(Math.abs(g+v)<.1&&Math.abs(y+A)<.1&&Math.abs(M+_)<.1&&Math.abs(d+E+x-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let w=(d+1)/2,R=(E+1)/2,B=(x+1)/2,U=(g+v)/4,D=(y+A)/4,P=(M+_)/4;return w>R&&w>B?w<.01?(i=0,s=.707106781,u=.707106781):(i=Math.sqrt(w),s=U/i,u=D/i):R>B?R<.01?(i=.707106781,s=0,u=.707106781):(s=Math.sqrt(R),i=U/s,u=P/s):B<.01?(i=.707106781,s=.707106781,u=0):(u=Math.sqrt(B),i=D/u,s=P/u),this.set(i,s,u,e),this}let T=Math.sqrt((_-M)*(_-M)+(y-A)*(y-A)+(v-g)*(v-g));return Math.abs(T)<.001&&(T=1),this.x=(_-M)/T,this.y=(y-A)/T,this.z=(v-g)/T,this.w=Math.acos((d+E+x-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},av=class extends _a{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Yr(0,0,t,e),this.scissorTest=!1,this.viewport=new Yr(0,0,t,e);let s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ni,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let u=new uo(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);u.flipY=!1,u.generateMipmaps=i.generateMipmaps,u.internalFormat=i.internalFormat,this.textures=[];let c=i.count;for(let f=0;f<c;f++)this.textures[f]=u.clone(),this.textures[f].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,u=this.textures.length;s<u;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let i=0,s=t.textures.length;i<s;i++)this.textures[i]=t.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new qp(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Us=class extends av{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},Vp=class extends uo{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=bi,this.minFilter=bi,this.wrapR=Ro,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var uv=class extends uo{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=bi,this.minFilter=bi,this.wrapR=Ro,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var lo=class{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,u,c,f){let p=i[s+0],d=i[s+1],g=i[s+2],y=i[s+3],v=u[c+0],E=u[c+1],M=u[c+2],A=u[c+3];if(f===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=y;return}if(f===1){t[e+0]=v,t[e+1]=E,t[e+2]=M,t[e+3]=A;return}if(y!==A||p!==v||d!==E||g!==M){let _=1-f,x=p*v+d*E+g*M+y*A,T=x>=0?1:-1,w=1-x*x;if(w>Number.EPSILON){let B=Math.sqrt(w),U=Math.atan2(B,x*T);_=Math.sin(_*U)/B,f=Math.sin(f*U)/B}let R=f*T;if(p=p*_+v*R,d=d*_+E*R,g=g*_+M*R,y=y*_+A*R,_===1-f){let B=1/Math.sqrt(p*p+d*d+g*g+y*y);p*=B,d*=B,g*=B,y*=B}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=y}static multiplyQuaternionsFlat(t,e,i,s,u,c){let f=i[s],p=i[s+1],d=i[s+2],g=i[s+3],y=u[c],v=u[c+1],E=u[c+2],M=u[c+3];return t[e]=f*M+g*y+p*E-d*v,t[e+1]=p*M+g*v+d*y-f*E,t[e+2]=d*M+g*E+f*v-p*y,t[e+3]=g*M-f*y-p*v-d*E,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,s=t._y,u=t._z,c=t._order,f=Math.cos,p=Math.sin,d=f(i/2),g=f(s/2),y=f(u/2),v=p(i/2),E=p(s/2),M=p(u/2);switch(c){case"XYZ":this._x=v*g*y+d*E*M,this._y=d*E*y-v*g*M,this._z=d*g*M+v*E*y,this._w=d*g*y-v*E*M;break;case"YXZ":this._x=v*g*y+d*E*M,this._y=d*E*y-v*g*M,this._z=d*g*M-v*E*y,this._w=d*g*y+v*E*M;break;case"ZXY":this._x=v*g*y-d*E*M,this._y=d*E*y+v*g*M,this._z=d*g*M+v*E*y,this._w=d*g*y-v*E*M;break;case"ZYX":this._x=v*g*y-d*E*M,this._y=d*E*y+v*g*M,this._z=d*g*M-v*E*y,this._w=d*g*y+v*E*M;break;case"YZX":this._x=v*g*y+d*E*M,this._y=d*E*y+v*g*M,this._z=d*g*M-v*E*y,this._w=d*g*y-v*E*M;break;case"XZY":this._x=v*g*y-d*E*M,this._y=d*E*y-v*g*M,this._z=d*g*M+v*E*y,this._w=d*g*y+v*E*M;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],u=e[8],c=e[1],f=e[5],p=e[9],d=e[2],g=e[6],y=e[10],v=i+f+y;if(v>0){let E=.5/Math.sqrt(v+1);this._w=.25/E,this._x=(g-p)*E,this._y=(u-d)*E,this._z=(c-s)*E}else if(i>f&&i>y){let E=2*Math.sqrt(1+i-f-y);this._w=(g-p)/E,this._x=.25*E,this._y=(s+c)/E,this._z=(u+d)/E}else if(f>y){let E=2*Math.sqrt(1+f-i-y);this._w=(u-d)/E,this._x=(s+c)/E,this._y=.25*E,this._z=(p+g)/E}else{let E=2*Math.sqrt(1+y-i-f);this._w=(c-s)/E,this._x=(u+d)/E,this._y=(p+g)/E,this._z=.25*E}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ai(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(i===0)return this;let s=Math.min(1,e/i);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,s=t._y,u=t._z,c=t._w,f=e._x,p=e._y,d=e._z,g=e._w;return this._x=i*g+c*f+s*d-u*p,this._y=s*g+c*p+u*f-i*d,this._z=u*g+c*d+i*p-s*f,this._w=c*g-i*f-s*p-u*d,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let i=this._x,s=this._y,u=this._z,c=this._w,f=c*t._w+i*t._x+s*t._y+u*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=c,this._x=i,this._y=s,this._z=u,this;let p=1-f*f;if(p<=Number.EPSILON){let E=1-e;return this._w=E*c+e*this._w,this._x=E*i+e*this._x,this._y=E*s+e*this._y,this._z=E*u+e*this._z,this.normalize(),this}let d=Math.sqrt(p),g=Math.atan2(d,f),y=Math.sin((1-e)*g)/d,v=Math.sin(e*g)/d;return this._w=c*y+this._w*v,this._x=i*y+this._x*v,this._y=s*y+this._y*v,this._z=u*y+this._z*v,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),u=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),u*Math.sin(e),u*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},st=class n{constructor(t=0,e=0,i=0){n.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(eI.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(eI.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[3]*i+u[6]*s,this.y=u[1]*e+u[4]*i+u[7]*s,this.z=u[2]*e+u[5]*i+u[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,u=t.elements,c=1/(u[3]*e+u[7]*i+u[11]*s+u[15]);return this.x=(u[0]*e+u[4]*i+u[8]*s+u[12])*c,this.y=(u[1]*e+u[5]*i+u[9]*s+u[13])*c,this.z=(u[2]*e+u[6]*i+u[10]*s+u[14])*c,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,u=t.x,c=t.y,f=t.z,p=t.w,d=2*(c*s-f*i),g=2*(f*e-u*s),y=2*(u*i-c*e);return this.x=e+p*d+c*y-f*g,this.y=i+p*g+f*d-u*y,this.z=s+p*y+u*g-c*d,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[4]*i+u[8]*s,this.y=u[1]*e+u[5]*i+u[9]*s,this.z=u[2]*e+u[6]*i+u[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,u=t.z,c=e.x,f=e.y,p=e.z;return this.x=s*p-u*f,this.y=u*c-i*p,this.z=i*f-s*c,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Ay.copy(this).projectOnVector(t),this.sub(Ay)}reflect(t){return this.sub(Ay.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ai(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Ay=new st,eI=new lo,Ko=class{constructor(t=new st(1/0,1/0,1/0),e=new st(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Co.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Co.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=Co.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(i!==void 0){let u=i.getAttribute("position");if(e===!0&&u!==void 0&&t.isInstancedMesh!==!0)for(let c=0,f=u.count;c<f;c++)t.isMesh===!0?t.getVertexPosition(c,Co):Co.fromBufferAttribute(u,c),Co.applyMatrix4(t.matrixWorld),this.expandByPoint(Co);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),sp.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),sp.copy(i.boundingBox)),sp.applyMatrix4(t.matrixWorld),this.union(sp)}let s=t.children;for(let u=0,c=s.length;u<c;u++)this.expandByObject(s[u],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Co),Co.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(tf),ap.subVectors(this.max,tf),ol.subVectors(t.a,tf),sl.subVectors(t.b,tf),al.subVectors(t.c,tf),oa.subVectors(sl,ol),sa.subVectors(al,sl),$a.subVectors(ol,al);let e=[0,-oa.z,oa.y,0,-sa.z,sa.y,0,-$a.z,$a.y,oa.z,0,-oa.x,sa.z,0,-sa.x,$a.z,0,-$a.x,-oa.y,oa.x,0,-sa.y,sa.x,0,-$a.y,$a.x,0];return!Ty(e,ol,sl,al,ap)||(e=[1,0,0,0,1,0,0,0,1],!Ty(e,ol,sl,al,ap))?!1:(up.crossVectors(oa,sa),e=[up.x,up.y,up.z],Ty(e,ol,sl,al,ap))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Co).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Co).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(As[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),As[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),As[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),As[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),As[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),As[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),As[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),As[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(As),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},As=[new st,new st,new st,new st,new st,new st,new st,new st],Co=new st,sp=new Ko,ol=new st,sl=new st,al=new st,oa=new st,sa=new st,$a=new st,tf=new st,ap=new st,up=new st,Za=new st;function Ty(n,t,e,i,s){for(let u=0,c=n.length-3;u<=c;u+=3){Za.fromArray(n,u);let f=s.x*Math.abs(Za.x)+s.y*Math.abs(Za.y)+s.z*Math.abs(Za.z),p=t.dot(Za),d=e.dot(Za),g=i.dot(Za);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>f)return!1}return!0}var Z6=new Ko,ef=new st,Cy=new st,uu=class{constructor(t=new st,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;e!==void 0?i.copy(e):Z6.setFromPoints(t).getCenter(i);let s=0;for(let u=0,c=t.length;u<c;u++)s=Math.max(s,i.distanceToSquared(t[u]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ef.subVectors(t,this.center);let e=ef.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(ef,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Cy.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ef.copy(t.center).add(Cy)),this.expandByPoint(ef.copy(t.center).sub(Cy))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ts=new st,Iy=new st,lp=new st,aa=new st,Py=new st,cp=new st,Ry=new st,lv=class{constructor(t=new st,e=new st(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ts)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Ts.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ts.copy(this.origin).addScaledVector(this.direction,e),Ts.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){Iy.copy(t).add(e).multiplyScalar(.5),lp.copy(e).sub(t).normalize(),aa.copy(this.origin).sub(Iy);let u=t.distanceTo(e)*.5,c=-this.direction.dot(lp),f=aa.dot(this.direction),p=-aa.dot(lp),d=aa.lengthSq(),g=Math.abs(1-c*c),y,v,E,M;if(g>0)if(y=c*p-f,v=c*f-p,M=u*g,y>=0)if(v>=-M)if(v<=M){let A=1/g;y*=A,v*=A,E=y*(y+c*v+2*f)+v*(c*y+v+2*p)+d}else v=u,y=Math.max(0,-(c*v+f)),E=-y*y+v*(v+2*p)+d;else v=-u,y=Math.max(0,-(c*v+f)),E=-y*y+v*(v+2*p)+d;else v<=-M?(y=Math.max(0,-(-c*u+f)),v=y>0?-u:Math.min(Math.max(-u,-p),u),E=-y*y+v*(v+2*p)+d):v<=M?(y=0,v=Math.min(Math.max(-u,-p),u),E=v*(v+2*p)+d):(y=Math.max(0,-(c*u+f)),v=y>0?u:Math.min(Math.max(-u,-p),u),E=-y*y+v*(v+2*p)+d);else v=c>0?-u:u,y=Math.max(0,-(c*v+f)),E=-y*y+v*(v+2*p)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,y),s&&s.copy(Iy).addScaledVector(lp,v),E}intersectSphere(t,e){Ts.subVectors(t.center,this.origin);let i=Ts.dot(this.direction),s=Ts.dot(Ts)-i*i,u=t.radius*t.radius;if(s>u)return null;let c=Math.sqrt(u-s),f=i-c,p=i+c;return p<0?null:f<0?this.at(p,e):this.at(f,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,u,c,f,p,d=1/this.direction.x,g=1/this.direction.y,y=1/this.direction.z,v=this.origin;return d>=0?(i=(t.min.x-v.x)*d,s=(t.max.x-v.x)*d):(i=(t.max.x-v.x)*d,s=(t.min.x-v.x)*d),g>=0?(u=(t.min.y-v.y)*g,c=(t.max.y-v.y)*g):(u=(t.max.y-v.y)*g,c=(t.min.y-v.y)*g),i>c||u>s||((u>i||isNaN(i))&&(i=u),(c<s||isNaN(s))&&(s=c),y>=0?(f=(t.min.z-v.z)*y,p=(t.max.z-v.z)*y):(f=(t.max.z-v.z)*y,p=(t.min.z-v.z)*y),i>p||f>s)||((f>i||i!==i)&&(i=f),(p<s||s!==s)&&(s=p),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return this.intersectBox(t,Ts)!==null}intersectTriangle(t,e,i,s,u){Py.subVectors(e,t),cp.subVectors(i,t),Ry.crossVectors(Py,cp);let c=this.direction.dot(Ry),f;if(c>0){if(s)return null;f=1}else if(c<0)f=-1,c=-c;else return null;aa.subVectors(this.origin,t);let p=f*this.direction.dot(cp.crossVectors(aa,cp));if(p<0)return null;let d=f*this.direction.dot(Py.cross(aa));if(d<0||p+d>c)return null;let g=-f*aa.dot(Ry);return g<0?null:this.at(g/c,u)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},$n=class n{constructor(t,e,i,s,u,c,f,p,d,g,y,v,E,M,A,_){n.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,s,u,c,f,p,d,g,y,v,E,M,A,_)}set(t,e,i,s,u,c,f,p,d,g,y,v,E,M,A,_){let x=this.elements;return x[0]=t,x[4]=e,x[8]=i,x[12]=s,x[1]=u,x[5]=c,x[9]=f,x[13]=p,x[2]=d,x[6]=g,x[10]=y,x[14]=v,x[3]=E,x[7]=M,x[11]=A,x[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new n().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,i=t.elements,s=1/ul.setFromMatrixColumn(t,0).length(),u=1/ul.setFromMatrixColumn(t,1).length(),c=1/ul.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*u,e[5]=i[5]*u,e[6]=i[6]*u,e[7]=0,e[8]=i[8]*c,e[9]=i[9]*c,e[10]=i[10]*c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,u=t.z,c=Math.cos(i),f=Math.sin(i),p=Math.cos(s),d=Math.sin(s),g=Math.cos(u),y=Math.sin(u);if(t.order==="XYZ"){let v=c*g,E=c*y,M=f*g,A=f*y;e[0]=p*g,e[4]=-p*y,e[8]=d,e[1]=E+M*d,e[5]=v-A*d,e[9]=-f*p,e[2]=A-v*d,e[6]=M+E*d,e[10]=c*p}else if(t.order==="YXZ"){let v=p*g,E=p*y,M=d*g,A=d*y;e[0]=v+A*f,e[4]=M*f-E,e[8]=c*d,e[1]=c*y,e[5]=c*g,e[9]=-f,e[2]=E*f-M,e[6]=A+v*f,e[10]=c*p}else if(t.order==="ZXY"){let v=p*g,E=p*y,M=d*g,A=d*y;e[0]=v-A*f,e[4]=-c*y,e[8]=M+E*f,e[1]=E+M*f,e[5]=c*g,e[9]=A-v*f,e[2]=-c*d,e[6]=f,e[10]=c*p}else if(t.order==="ZYX"){let v=c*g,E=c*y,M=f*g,A=f*y;e[0]=p*g,e[4]=M*d-E,e[8]=v*d+A,e[1]=p*y,e[5]=A*d+v,e[9]=E*d-M,e[2]=-d,e[6]=f*p,e[10]=c*p}else if(t.order==="YZX"){let v=c*p,E=c*d,M=f*p,A=f*d;e[0]=p*g,e[4]=A-v*y,e[8]=M*y+E,e[1]=y,e[5]=c*g,e[9]=-f*g,e[2]=-d*g,e[6]=E*y+M,e[10]=v-A*y}else if(t.order==="XZY"){let v=c*p,E=c*d,M=f*p,A=f*d;e[0]=p*g,e[4]=-y,e[8]=d*g,e[1]=v*y+A,e[5]=c*g,e[9]=E*y-M,e[2]=M*y-E,e[6]=f*g,e[10]=A*y+v}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(J6,t,j6)}lookAt(t,e,i){let s=this.elements;return Yi.subVectors(t,e),Yi.lengthSq()===0&&(Yi.z=1),Yi.normalize(),ua.crossVectors(i,Yi),ua.lengthSq()===0&&(Math.abs(i.z)===1?Yi.x+=1e-4:Yi.z+=1e-4,Yi.normalize(),ua.crossVectors(i,Yi)),ua.normalize(),fp.crossVectors(Yi,ua),s[0]=ua.x,s[4]=fp.x,s[8]=Yi.x,s[1]=ua.y,s[5]=fp.y,s[9]=Yi.y,s[2]=ua.z,s[6]=fp.z,s[10]=Yi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,u=this.elements,c=i[0],f=i[4],p=i[8],d=i[12],g=i[1],y=i[5],v=i[9],E=i[13],M=i[2],A=i[6],_=i[10],x=i[14],T=i[3],w=i[7],R=i[11],B=i[15],U=s[0],D=s[4],P=s[8],ct=s[12],L=s[1],W=s[5],V=s[9],Mt=s[13],$=s[2],gt=s[6],ft=s[10],vt=s[14],it=s[3],lt=s[7],H=s[11],At=s[15];return u[0]=c*U+f*L+p*$+d*it,u[4]=c*D+f*W+p*gt+d*lt,u[8]=c*P+f*V+p*ft+d*H,u[12]=c*ct+f*Mt+p*vt+d*At,u[1]=g*U+y*L+v*$+E*it,u[5]=g*D+y*W+v*gt+E*lt,u[9]=g*P+y*V+v*ft+E*H,u[13]=g*ct+y*Mt+v*vt+E*At,u[2]=M*U+A*L+_*$+x*it,u[6]=M*D+A*W+_*gt+x*lt,u[10]=M*P+A*V+_*ft+x*H,u[14]=M*ct+A*Mt+_*vt+x*At,u[3]=T*U+w*L+R*$+B*it,u[7]=T*D+w*W+R*gt+B*lt,u[11]=T*P+w*V+R*ft+B*H,u[15]=T*ct+w*Mt+R*vt+B*At,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],s=t[8],u=t[12],c=t[1],f=t[5],p=t[9],d=t[13],g=t[2],y=t[6],v=t[10],E=t[14],M=t[3],A=t[7],_=t[11],x=t[15];return M*(+u*p*y-s*d*y-u*f*v+i*d*v+s*f*E-i*p*E)+A*(+e*p*E-e*d*v+u*c*v-s*c*E+s*d*g-u*p*g)+_*(+e*d*y-e*f*E-u*c*y+i*c*E+u*f*g-i*d*g)+x*(-s*f*g-e*p*y+e*f*v+s*c*y-i*c*v+i*p*g)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],u=t[3],c=t[4],f=t[5],p=t[6],d=t[7],g=t[8],y=t[9],v=t[10],E=t[11],M=t[12],A=t[13],_=t[14],x=t[15],T=y*_*d-A*v*d+A*p*E-f*_*E-y*p*x+f*v*x,w=M*v*d-g*_*d-M*p*E+c*_*E+g*p*x-c*v*x,R=g*A*d-M*y*d+M*f*E-c*A*E-g*f*x+c*y*x,B=M*y*p-g*A*p-M*f*v+c*A*v+g*f*_-c*y*_,U=e*T+i*w+s*R+u*B;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/U;return t[0]=T*D,t[1]=(A*v*u-y*_*u-A*s*E+i*_*E+y*s*x-i*v*x)*D,t[2]=(f*_*u-A*p*u+A*s*d-i*_*d-f*s*x+i*p*x)*D,t[3]=(y*p*u-f*v*u-y*s*d+i*v*d+f*s*E-i*p*E)*D,t[4]=w*D,t[5]=(g*_*u-M*v*u+M*s*E-e*_*E-g*s*x+e*v*x)*D,t[6]=(M*p*u-c*_*u-M*s*d+e*_*d+c*s*x-e*p*x)*D,t[7]=(c*v*u-g*p*u+g*s*d-e*v*d-c*s*E+e*p*E)*D,t[8]=R*D,t[9]=(M*y*u-g*A*u-M*i*E+e*A*E+g*i*x-e*y*x)*D,t[10]=(c*A*u-M*f*u+M*i*d-e*A*d-c*i*x+e*f*x)*D,t[11]=(g*f*u-c*y*u-g*i*d+e*y*d+c*i*E-e*f*E)*D,t[12]=B*D,t[13]=(g*A*s-M*y*s+M*i*v-e*A*v-g*i*_+e*y*_)*D,t[14]=(M*f*s-c*A*s-M*i*p+e*A*p+c*i*_-e*f*_)*D,t[15]=(c*y*s-g*f*s+g*i*p-e*y*p-c*i*v+e*f*v)*D,this}scale(t){let e=this.elements,i=t.x,s=t.y,u=t.z;return e[0]*=i,e[4]*=s,e[8]*=u,e[1]*=i,e[5]*=s,e[9]*=u,e[2]*=i,e[6]*=s,e[10]*=u,e[3]*=i,e[7]*=s,e[11]*=u,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),u=1-i,c=t.x,f=t.y,p=t.z,d=u*c,g=u*f;return this.set(d*c+i,d*f-s*p,d*p+s*f,0,d*f+s*p,g*f+i,g*p-s*c,0,d*p-s*f,g*p+s*c,u*p*p+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,u,c){return this.set(1,i,u,0,t,1,c,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,u=e._x,c=e._y,f=e._z,p=e._w,d=u+u,g=c+c,y=f+f,v=u*d,E=u*g,M=u*y,A=c*g,_=c*y,x=f*y,T=p*d,w=p*g,R=p*y,B=i.x,U=i.y,D=i.z;return s[0]=(1-(A+x))*B,s[1]=(E+R)*B,s[2]=(M-w)*B,s[3]=0,s[4]=(E-R)*U,s[5]=(1-(v+x))*U,s[6]=(_+T)*U,s[7]=0,s[8]=(M+w)*D,s[9]=(_-T)*D,s[10]=(1-(v+A))*D,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements,u=ul.set(s[0],s[1],s[2]).length(),c=ul.set(s[4],s[5],s[6]).length(),f=ul.set(s[8],s[9],s[10]).length();this.determinant()<0&&(u=-u),t.x=s[12],t.y=s[13],t.z=s[14],Io.copy(this);let d=1/u,g=1/c,y=1/f;return Io.elements[0]*=d,Io.elements[1]*=d,Io.elements[2]*=d,Io.elements[4]*=g,Io.elements[5]*=g,Io.elements[6]*=g,Io.elements[8]*=y,Io.elements[9]*=y,Io.elements[10]*=y,e.setFromRotationMatrix(Io),i.x=u,i.y=c,i.z=f,this}makePerspective(t,e,i,s,u,c,f=Ds){let p=this.elements,d=2*u/(e-t),g=2*u/(i-s),y=(e+t)/(e-t),v=(i+s)/(i-s),E,M;if(f===Ds)E=-(c+u)/(c-u),M=-2*c*u/(c-u);else if(f===zp)E=-c/(c-u),M=-c*u/(c-u);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);return p[0]=d,p[4]=0,p[8]=y,p[12]=0,p[1]=0,p[5]=g,p[9]=v,p[13]=0,p[2]=0,p[6]=0,p[10]=E,p[14]=M,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,i,s,u,c,f=Ds){let p=this.elements,d=1/(e-t),g=1/(i-s),y=1/(c-u),v=(e+t)*d,E=(i+s)*g,M,A;if(f===Ds)M=(c+u)*y,A=-2*y;else if(f===zp)M=u*y,A=-1*y;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-v,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-E,p[2]=0,p[6]=0,p[10]=A,p[14]=-M,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},ul=new st,Io=new $n,J6=new st(0,0,0),j6=new st(1,1,1),ua=new st,fp=new st,Yi=new st,nI=new $n,rI=new lo,lu=class n{constructor(t=0,e=0,i=0,s=n.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let s=t.elements,u=s[0],c=s[4],f=s[8],p=s[1],d=s[5],g=s[9],y=s[2],v=s[6],E=s[10];switch(e){case"XYZ":this._y=Math.asin(ai(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-g,E),this._z=Math.atan2(-c,u)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ai(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(f,E),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-y,u),this._z=0);break;case"ZXY":this._x=Math.asin(ai(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-y,E),this._z=Math.atan2(-c,d)):(this._y=0,this._z=Math.atan2(p,u));break;case"ZYX":this._y=Math.asin(-ai(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(v,E),this._z=Math.atan2(p,u)):(this._x=0,this._z=Math.atan2(-c,d));break;case"YZX":this._z=Math.asin(ai(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-y,u)):(this._x=0,this._y=Math.atan2(f,E));break;case"XZY":this._z=Math.asin(-ai(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(f,u)):(this._x=Math.atan2(-g,E),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return nI.makeRotationFromQuaternion(t),this.setFromRotationMatrix(nI,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return rI.setFromEuler(this),this.setFromQuaternion(rI,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};lu.DEFAULT_ORDER="XYZ";var Hp=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},K6=0,iI=new st,ll=new lo,Cs=new $n,hp=new st,nf=new st,Q6=new st,t8=new lo,oI=new st(1,0,0),sI=new st(0,1,0),aI=new st(0,0,1),e8={type:"added"},n8={type:"removed"},Ly={type:"childadded",child:null},Ny={type:"childremoved",child:null},Oo=class n extends _a{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:K6++}),this.uuid=Fs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new st,e=new lu,i=new lo,s=new st(1,1,1);function u(){i.setFromEuler(e,!1)}function c(){e.setFromQuaternion(i,void 0,!1)}e._onChange(u),i._onChange(c),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new $n},normalMatrix:{value:new Ee}}),this.matrix=new $n,this.matrixWorld=new $n,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Hp,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ll.setFromAxisAngle(t,e),this.quaternion.multiply(ll),this}rotateOnWorldAxis(t,e){return ll.setFromAxisAngle(t,e),this.quaternion.premultiply(ll),this}rotateX(t){return this.rotateOnAxis(oI,t)}rotateY(t){return this.rotateOnAxis(sI,t)}rotateZ(t){return this.rotateOnAxis(aI,t)}translateOnAxis(t,e){return iI.copy(t).applyQuaternion(this.quaternion),this.position.add(iI.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(oI,t)}translateY(t){return this.translateOnAxis(sI,t)}translateZ(t){return this.translateOnAxis(aI,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Cs.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?hp.copy(t):hp.set(t,e,i);let s=this.parent;this.updateWorldMatrix(!0,!1),nf.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cs.lookAt(nf,hp,this.up):Cs.lookAt(hp,nf,this.up),this.quaternion.setFromRotationMatrix(Cs),s&&(Cs.extractRotation(s.matrixWorld),ll.setFromRotationMatrix(Cs),this.quaternion.premultiply(ll.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(e8),Ly.child=t,this.dispatchEvent(Ly),Ly.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(n8),Ny.child=t,this.dispatchEvent(Ny),Ny.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Cs.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Cs.multiply(t.parent.matrixWorld)),t.applyMatrix4(Cs),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){let c=this.children[i].getObjectByProperty(t,e);if(c!==void 0)return c}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let s=this.children;for(let u=0,c=s.length;u<c;u++)s[u].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(nf,t,Q6),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(nf,t8,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,s=e.length;i<s;i++){let u=e[i];(u.matrixWorldAutoUpdate===!0||t===!0)&&u.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let i=this.parent;if(t===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let s=this.children;for(let u=0,c=s.length;u<c;u++){let f=s[u];f.matrixWorldAutoUpdate===!0&&f.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(f=>({boxInitialized:f.boxInitialized,boxMin:f.box.min.toArray(),boxMax:f.box.max.toArray(),sphereInitialized:f.sphereInitialized,sphereRadius:f.sphere.radius,sphereCenter:f.sphere.center.toArray()})),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function u(f,p){return f[p.uuid]===void 0&&(f[p.uuid]=p.toJSON(t)),p.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=u(t.geometries,this.geometry);let f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let p=f.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let y=p[d];u(t.shapes,y)}else u(t.shapes,p)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(u(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let f=[];for(let p=0,d=this.material.length;p<d;p++)f.push(u(t.materials,this.material[p]));s.material=f}else s.material=u(t.materials,this.material);if(this.children.length>0){s.children=[];for(let f=0;f<this.children.length;f++)s.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let f=0;f<this.animations.length;f++){let p=this.animations[f];s.animations.push(u(t.animations,p))}}if(e){let f=c(t.geometries),p=c(t.materials),d=c(t.textures),g=c(t.images),y=c(t.shapes),v=c(t.skeletons),E=c(t.animations),M=c(t.nodes);f.length>0&&(i.geometries=f),p.length>0&&(i.materials=p),d.length>0&&(i.textures=d),g.length>0&&(i.images=g),y.length>0&&(i.shapes=y),v.length>0&&(i.skeletons=v),E.length>0&&(i.animations=E),M.length>0&&(i.nodes=M)}return i.object=s,i;function c(f){let p=[];for(let d in f){let g=f[d];delete g.metadata,p.push(g)}return p}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}};Oo.DEFAULT_UP=new st(0,1,0);Oo.DEFAULT_MATRIX_AUTO_UPDATE=!0;Oo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Po=new st,Is=new st,Oy=new st,Ps=new st,cl=new st,fl=new st,uI=new st,Dy=new st,Fy=new st,Uy=new st,iu=class n{constructor(t=new st,e=new st,i=new st){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),Po.subVectors(t,e),s.cross(Po);let u=s.lengthSq();return u>0?s.multiplyScalar(1/Math.sqrt(u)):s.set(0,0,0)}static getBarycoord(t,e,i,s,u){Po.subVectors(s,e),Is.subVectors(i,e),Oy.subVectors(t,e);let c=Po.dot(Po),f=Po.dot(Is),p=Po.dot(Oy),d=Is.dot(Is),g=Is.dot(Oy),y=c*d-f*f;if(y===0)return u.set(0,0,0),null;let v=1/y,E=(d*p-f*g)*v,M=(c*g-f*p)*v;return u.set(1-E-M,M,E)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,Ps)===null?!1:Ps.x>=0&&Ps.y>=0&&Ps.x+Ps.y<=1}static getInterpolation(t,e,i,s,u,c,f,p){return this.getBarycoord(t,e,i,s,Ps)===null?(p.x=0,p.y=0,"z"in p&&(p.z=0),"w"in p&&(p.w=0),null):(p.setScalar(0),p.addScaledVector(u,Ps.x),p.addScaledVector(c,Ps.y),p.addScaledVector(f,Ps.z),p)}static isFrontFacing(t,e,i,s){return Po.subVectors(i,e),Is.subVectors(t,e),Po.cross(Is).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Po.subVectors(this.c,this.b),Is.subVectors(this.a,this.b),Po.cross(Is).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return n.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return n.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,u){return n.getInterpolation(t,this.a,this.b,this.c,e,i,s,u)}containsPoint(t){return n.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return n.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i=this.a,s=this.b,u=this.c,c,f;cl.subVectors(s,i),fl.subVectors(u,i),Dy.subVectors(t,i);let p=cl.dot(Dy),d=fl.dot(Dy);if(p<=0&&d<=0)return e.copy(i);Fy.subVectors(t,s);let g=cl.dot(Fy),y=fl.dot(Fy);if(g>=0&&y<=g)return e.copy(s);let v=p*y-g*d;if(v<=0&&p>=0&&g<=0)return c=p/(p-g),e.copy(i).addScaledVector(cl,c);Uy.subVectors(t,u);let E=cl.dot(Uy),M=fl.dot(Uy);if(M>=0&&E<=M)return e.copy(u);let A=E*d-p*M;if(A<=0&&d>=0&&M<=0)return f=d/(d-M),e.copy(i).addScaledVector(fl,f);let _=g*M-E*y;if(_<=0&&y-g>=0&&E-M>=0)return uI.subVectors(u,s),f=(y-g)/(y-g+(E-M)),e.copy(s).addScaledVector(uI,f);let x=1/(_+A+v);return c=A*x,f=v*x,e.copy(i).addScaledVector(cl,c).addScaledVector(fl,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},rP={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},la={h:0,s:0,l:0},pp={h:0,s:0,l:0};function By(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}var Te=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Zo){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Rn.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=Rn.workingColorSpace){return this.r=t,this.g=e,this.b=i,Rn.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=Rn.workingColorSpace){if(t=H6(t,1),e=ai(e,0,1),i=ai(i,0,1),e===0)this.r=this.g=this.b=i;else{let u=i<=.5?i*(1+e):i+e-i*e,c=2*i-u;this.r=By(c,u,t+1/3),this.g=By(c,u,t),this.b=By(c,u,t-1/3)}return Rn.toWorkingColorSpace(this,s),this}setStyle(t,e=Zo){function i(u){u!==void 0&&parseFloat(u)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let u,c=s[1],f=s[2];switch(c){case"rgb":case"rgba":if(u=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return i(u[4]),this.setRGB(Math.min(255,parseInt(u[1],10))/255,Math.min(255,parseInt(u[2],10))/255,Math.min(255,parseInt(u[3],10))/255,e);if(u=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return i(u[4]),this.setRGB(Math.min(100,parseInt(u[1],10))/100,Math.min(100,parseInt(u[2],10))/100,Math.min(100,parseInt(u[3],10))/100,e);break;case"hsl":case"hsla":if(u=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return i(u[4]),this.setHSL(parseFloat(u[1])/360,parseFloat(u[2])/100,parseFloat(u[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let u=s[1],c=u.length;if(c===3)return this.setRGB(parseInt(u.charAt(0),16)/15,parseInt(u.charAt(1),16)/15,parseInt(u.charAt(2),16)/15,e);if(c===6)return this.setHex(parseInt(u,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Zo){let i=rP[t.toLowerCase()];return i!==void 0?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Al(t.r),this.g=Al(t.g),this.b=Al(t.b),this}copyLinearToSRGB(t){return this.r=My(t.r),this.g=My(t.g),this.b=My(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Zo){return Rn.fromWorkingColorSpace(si.copy(this),t),Math.round(ai(si.r*255,0,255))*65536+Math.round(ai(si.g*255,0,255))*256+Math.round(ai(si.b*255,0,255))}getHexString(t=Zo){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Rn.workingColorSpace){Rn.fromWorkingColorSpace(si.copy(this),e);let i=si.r,s=si.g,u=si.b,c=Math.max(i,s,u),f=Math.min(i,s,u),p,d,g=(f+c)/2;if(f===c)p=0,d=0;else{let y=c-f;switch(d=g<=.5?y/(c+f):y/(2-c-f),c){case i:p=(s-u)/y+(s<u?6:0);break;case s:p=(u-i)/y+2;break;case u:p=(i-s)/y+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=Rn.workingColorSpace){return Rn.fromWorkingColorSpace(si.copy(this),e),t.r=si.r,t.g=si.g,t.b=si.b,t}getStyle(t=Zo){Rn.fromWorkingColorSpace(si.copy(this),t);let e=si.r,i=si.g,s=si.b;return t!==Zo?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(t,e,i){return this.getHSL(la),this.setHSL(la.h+t,la.s+e,la.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(la),t.getHSL(pp);let i=Sy(la.h,pp.h,e),s=Sy(la.s,pp.s,e),u=Sy(la.l,pp.l,e);return this.setHSL(i,s,u),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,s=this.b,u=t.elements;return this.r=u[0]*e+u[3]*i+u[6]*s,this.g=u[1]*e+u[4]*i+u[7]*s,this.b=u[2]*e+u[5]*i+u[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},si=new Te;Te.NAMES=rP;var r8=0,cu=class extends _a{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:r8++}),this.uuid=Fs(),this.name="",this.type="Material",this.blending=bl,this.side=va,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=jy,this.blendDst=Ky,this.blendEquation=eu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Te(0,0,0),this.blendAlpha=0,this.depthFunc=Np,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ZC,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=rl,this.stencilZFail=rl,this.stencilZPass=rl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let i=t[e];if(i===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==bl&&(i.blending=this.blending),this.side!==va&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==jy&&(i.blendSrc=this.blendSrc),this.blendDst!==Ky&&(i.blendDst=this.blendDst),this.blendEquation!==eu&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Np&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ZC&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==rl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==rl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==rl&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(u){let c=[];for(let f in u){let p=u[f];delete p.metadata,c.push(p)}return c}if(e){let u=s(t.textures),c=s(t.images);u.length>0&&(i.textures=u),c.length>0&&(i.images=c)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(e!==null){let s=e.length;i=new Array(s);for(let u=0;u!==s;++u)i[u]=e[u].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Wp=class extends cu{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Te(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lu,this.combine=WI,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var pr=new st,dp=new Ot,Zn=class{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Os,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return nP("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,u=this.itemSize;s<u;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)dp.fromBufferAttribute(this,e),dp.applyMatrix3(t),this.setXY(e,dp.x,dp.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.applyMatrix3(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.applyMatrix4(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.applyNormalMatrix(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.transformDirection(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=jo(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Pn(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=jo(e,this.array)),e}setX(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=jo(e,this.array)),e}setY(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=jo(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=jo(e,this.array)),e}setW(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,u){return t*=this.itemSize,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array),u=Pn(u,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=u,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==rv&&(t.usage=this.usage),t}};var Xp=class extends Zn{constructor(t,e,i){super(new Uint16Array(t),e,i)}};var Yp=class extends Zn{constructor(t,e,i){super(new Uint32Array(t),e,i)}};var _r=class extends Zn{constructor(t,e,i){super(new Float32Array(t),e,i)}},i8=0,ao=new $n,zy=new Oo,hl=new st,$i=new Ko,rf=new Ko,Fr=new st,ui=class n extends _a{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:i8++}),this.uuid=Fs(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(eP(t)?Yp:Xp)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let u=new Ee().getNormalMatrix(t);i.applyNormalMatrix(u),i.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return ao.makeRotationFromQuaternion(t),this.applyMatrix4(ao),this}rotateX(t){return ao.makeRotationX(t),this.applyMatrix4(ao),this}rotateY(t){return ao.makeRotationY(t),this.applyMatrix4(ao),this}rotateZ(t){return ao.makeRotationZ(t),this.applyMatrix4(ao),this}translate(t,e,i){return ao.makeTranslation(t,e,i),this.applyMatrix4(ao),this}scale(t,e,i){return ao.makeScale(t,e,i),this.applyMatrix4(ao),this}lookAt(t){return zy.lookAt(t),zy.updateMatrix(),this.applyMatrix4(zy.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hl).negate(),this.translate(hl.x,hl.y,hl.z),this}setFromPoints(t){let e=[];for(let i=0,s=t.length;i<s;i++){let u=t[i];e.push(u.x,u.y,u.z||0)}return this.setAttribute("position",new _r(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ko);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new st(-1/0,-1/0,-1/0),new st(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){let u=e[i];$i.setFromBufferAttribute(u),this.morphTargetsRelative?(Fr.addVectors(this.boundingBox.min,$i.min),this.boundingBox.expandByPoint(Fr),Fr.addVectors(this.boundingBox.max,$i.max),this.boundingBox.expandByPoint(Fr)):(this.boundingBox.expandByPoint($i.min),this.boundingBox.expandByPoint($i.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new st,1/0);return}if(t){let i=this.boundingSphere.center;if($i.setFromBufferAttribute(t),e)for(let u=0,c=e.length;u<c;u++){let f=e[u];rf.setFromBufferAttribute(f),this.morphTargetsRelative?(Fr.addVectors($i.min,rf.min),$i.expandByPoint(Fr),Fr.addVectors($i.max,rf.max),$i.expandByPoint(Fr)):($i.expandByPoint(rf.min),$i.expandByPoint(rf.max))}$i.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Fr.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Fr));if(e)for(let u=0,c=e.length;u<c;u++){let f=e[u],p=this.morphTargetsRelative;for(let d=0,g=f.count;d<g;d++)Fr.fromBufferAttribute(f,d),p&&(hl.fromBufferAttribute(t,d),Fr.add(hl)),s=Math.max(s,i.distanceToSquared(Fr))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.position,s=e.normal,u=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Zn(new Float32Array(4*i.count),4));let c=this.getAttribute("tangent"),f=[],p=[];for(let P=0;P<i.count;P++)f[P]=new st,p[P]=new st;let d=new st,g=new st,y=new st,v=new Ot,E=new Ot,M=new Ot,A=new st,_=new st;function x(P,ct,L){d.fromBufferAttribute(i,P),g.fromBufferAttribute(i,ct),y.fromBufferAttribute(i,L),v.fromBufferAttribute(u,P),E.fromBufferAttribute(u,ct),M.fromBufferAttribute(u,L),g.sub(d),y.sub(d),E.sub(v),M.sub(v);let W=1/(E.x*M.y-M.x*E.y);isFinite(W)&&(A.copy(g).multiplyScalar(M.y).addScaledVector(y,-E.y).multiplyScalar(W),_.copy(y).multiplyScalar(E.x).addScaledVector(g,-M.x).multiplyScalar(W),f[P].add(A),f[ct].add(A),f[L].add(A),p[P].add(_),p[ct].add(_),p[L].add(_))}let T=this.groups;T.length===0&&(T=[{start:0,count:t.count}]);for(let P=0,ct=T.length;P<ct;++P){let L=T[P],W=L.start,V=L.count;for(let Mt=W,$=W+V;Mt<$;Mt+=3)x(t.getX(Mt+0),t.getX(Mt+1),t.getX(Mt+2))}let w=new st,R=new st,B=new st,U=new st;function D(P){B.fromBufferAttribute(s,P),U.copy(B);let ct=f[P];w.copy(ct),w.sub(B.multiplyScalar(B.dot(ct))).normalize(),R.crossVectors(U,ct);let W=R.dot(p[P])<0?-1:1;c.setXYZW(P,w.x,w.y,w.z,W)}for(let P=0,ct=T.length;P<ct;++P){let L=T[P],W=L.start,V=L.count;for(let Mt=W,$=W+V;Mt<$;Mt+=3)D(t.getX(Mt+0)),D(t.getX(Mt+1)),D(t.getX(Mt+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Zn(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let v=0,E=i.count;v<E;v++)i.setXYZ(v,0,0,0);let s=new st,u=new st,c=new st,f=new st,p=new st,d=new st,g=new st,y=new st;if(t)for(let v=0,E=t.count;v<E;v+=3){let M=t.getX(v+0),A=t.getX(v+1),_=t.getX(v+2);s.fromBufferAttribute(e,M),u.fromBufferAttribute(e,A),c.fromBufferAttribute(e,_),g.subVectors(c,u),y.subVectors(s,u),g.cross(y),f.fromBufferAttribute(i,M),p.fromBufferAttribute(i,A),d.fromBufferAttribute(i,_),f.add(g),p.add(g),d.add(g),i.setXYZ(M,f.x,f.y,f.z),i.setXYZ(A,p.x,p.y,p.z),i.setXYZ(_,d.x,d.y,d.z)}else for(let v=0,E=e.count;v<E;v+=3)s.fromBufferAttribute(e,v+0),u.fromBufferAttribute(e,v+1),c.fromBufferAttribute(e,v+2),g.subVectors(c,u),y.subVectors(s,u),g.cross(y),i.setXYZ(v+0,g.x,g.y,g.z),i.setXYZ(v+1,g.x,g.y,g.z),i.setXYZ(v+2,g.x,g.y,g.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Fr.fromBufferAttribute(t,e),Fr.normalize(),t.setXYZ(e,Fr.x,Fr.y,Fr.z)}toNonIndexed(){function t(f,p){let d=f.array,g=f.itemSize,y=f.normalized,v=new d.constructor(p.length*g),E=0,M=0;for(let A=0,_=p.length;A<_;A++){f.isInterleavedBufferAttribute?E=p[A]*f.data.stride+f.offset:E=p[A]*g;for(let x=0;x<g;x++)v[M++]=d[E++]}return new Zn(v,g,y)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new n,i=this.index.array,s=this.attributes;for(let f in s){let p=s[f],d=t(p,i);e.setAttribute(f,d)}let u=this.morphAttributes;for(let f in u){let p=[],d=u[f];for(let g=0,y=d.length;g<y;g++){let v=d[g],E=t(v,i);p.push(E)}e.morphAttributes[f]=p}e.morphTargetsRelative=this.morphTargetsRelative;let c=this.groups;for(let f=0,p=c.length;f<p;f++){let d=c[f];e.addGroup(d.start,d.count,d.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let p in i){let d=i[p];t.data.attributes[p]=d.toJSON(t.data)}let s={},u=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let y=0,v=d.length;y<v;y++){let E=d[y];g.push(E.toJSON(t.data))}g.length>0&&(s[p]=g,u=!0)}u&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let c=this.groups;c.length>0&&(t.data.groups=JSON.parse(JSON.stringify(c)));let f=this.boundingSphere;return f!==null&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone(e));let s=t.attributes;for(let d in s){let g=s[d];this.setAttribute(d,g.clone(e))}let u=t.morphAttributes;for(let d in u){let g=[],y=u[d];for(let v=0,E=y.length;v<E;v++)g.push(y[v].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let c=t.groups;for(let d=0,g=c.length;d<g;d++){let y=c[d];this.addGroup(y.start,y.count,y.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},lI=new $n,Ja=new lv,gp=new uu,cI=new st,pl=new st,dl=new st,gl=new st,Gy=new st,mp=new st,yp=new Ot,vp=new Ot,_p=new Ot,fI=new st,hI=new st,pI=new st,xp=new st,Ep=new st,No=class extends Oo{constructor(t=new ui,e=new Wp){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){let s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,c=s.length;u<c;u++){let f=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=u}}}}getVertexPosition(t,e){let i=this.geometry,s=i.attributes.position,u=i.morphAttributes.position,c=i.morphTargetsRelative;e.fromBufferAttribute(s,t);let f=this.morphTargetInfluences;if(u&&f){mp.set(0,0,0);for(let p=0,d=u.length;p<d;p++){let g=f[p],y=u[p];g!==0&&(Gy.fromBufferAttribute(y,t),c?mp.addScaledVector(Gy,g):mp.addScaledVector(Gy.sub(e),g))}e.add(mp)}return e}raycast(t,e){let i=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),gp.copy(i.boundingSphere),gp.applyMatrix4(u),Ja.copy(t.ray).recast(t.near),!(gp.containsPoint(Ja.origin)===!1&&(Ja.intersectSphere(gp,cI)===null||Ja.origin.distanceToSquared(cI)>(t.far-t.near)**2))&&(lI.copy(u).invert(),Ja.copy(t.ray).applyMatrix4(lI),!(i.boundingBox!==null&&Ja.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Ja)))}_computeIntersections(t,e,i){let s,u=this.geometry,c=this.material,f=u.index,p=u.attributes.position,d=u.attributes.uv,g=u.attributes.uv1,y=u.attributes.normal,v=u.groups,E=u.drawRange;if(f!==null)if(Array.isArray(c))for(let M=0,A=v.length;M<A;M++){let _=v[M],x=c[_.materialIndex],T=Math.max(_.start,E.start),w=Math.min(f.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,B=w;R<B;R+=3){let U=f.getX(R),D=f.getX(R+1),P=f.getX(R+2);s=Sp(this,x,t,i,d,g,y,U,D,P),s&&(s.faceIndex=Math.floor(R/3),s.face.materialIndex=_.materialIndex,e.push(s))}}else{let M=Math.max(0,E.start),A=Math.min(f.count,E.start+E.count);for(let _=M,x=A;_<x;_+=3){let T=f.getX(_),w=f.getX(_+1),R=f.getX(_+2);s=Sp(this,c,t,i,d,g,y,T,w,R),s&&(s.faceIndex=Math.floor(_/3),e.push(s))}}else if(p!==void 0)if(Array.isArray(c))for(let M=0,A=v.length;M<A;M++){let _=v[M],x=c[_.materialIndex],T=Math.max(_.start,E.start),w=Math.min(p.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,B=w;R<B;R+=3){let U=R,D=R+1,P=R+2;s=Sp(this,x,t,i,d,g,y,U,D,P),s&&(s.faceIndex=Math.floor(R/3),s.face.materialIndex=_.materialIndex,e.push(s))}}else{let M=Math.max(0,E.start),A=Math.min(p.count,E.start+E.count);for(let _=M,x=A;_<x;_+=3){let T=_,w=_+1,R=_+2;s=Sp(this,c,t,i,d,g,y,T,w,R),s&&(s.faceIndex=Math.floor(_/3),e.push(s))}}}};function o8(n,t,e,i,s,u,c,f){let p;if(t.side===Oi?p=i.intersectTriangle(c,u,s,!0,f):p=i.intersectTriangle(s,u,c,t.side===va,f),p===null)return null;Ep.copy(f),Ep.applyMatrix4(n.matrixWorld);let d=e.ray.origin.distanceTo(Ep);return d<e.near||d>e.far?null:{distance:d,point:Ep.clone(),object:n}}function Sp(n,t,e,i,s,u,c,f,p,d){n.getVertexPosition(f,pl),n.getVertexPosition(p,dl),n.getVertexPosition(d,gl);let g=o8(n,t,e,i,pl,dl,gl,xp);if(g){s&&(yp.fromBufferAttribute(s,f),vp.fromBufferAttribute(s,p),_p.fromBufferAttribute(s,d),g.uv=iu.getInterpolation(xp,pl,dl,gl,yp,vp,_p,new Ot)),u&&(yp.fromBufferAttribute(u,f),vp.fromBufferAttribute(u,p),_p.fromBufferAttribute(u,d),g.uv1=iu.getInterpolation(xp,pl,dl,gl,yp,vp,_p,new Ot)),c&&(fI.fromBufferAttribute(c,f),hI.fromBufferAttribute(c,p),pI.fromBufferAttribute(c,d),g.normal=iu.getInterpolation(xp,pl,dl,gl,fI,hI,pI,new st),g.normal.dot(i.direction)>0&&g.normal.multiplyScalar(-1));let y={a:f,b:p,c:d,normal:new st,materialIndex:0};iu.getNormal(pl,dl,gl,y.normal),g.face=y}return g}var hf=class n extends ui{constructor(t=1,e=1,i=1,s=1,u=1,c=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:u,depthSegments:c};let f=this;s=Math.floor(s),u=Math.floor(u),c=Math.floor(c);let p=[],d=[],g=[],y=[],v=0,E=0;M("z","y","x",-1,-1,i,e,t,c,u,0),M("z","y","x",1,-1,i,e,-t,c,u,1),M("x","z","y",1,1,t,i,e,s,c,2),M("x","z","y",1,-1,t,i,-e,s,c,3),M("x","y","z",1,-1,t,e,i,s,u,4),M("x","y","z",-1,-1,t,e,-i,s,u,5),this.setIndex(p),this.setAttribute("position",new _r(d,3)),this.setAttribute("normal",new _r(g,3)),this.setAttribute("uv",new _r(y,2));function M(A,_,x,T,w,R,B,U,D,P,ct){let L=R/D,W=B/P,V=R/2,Mt=B/2,$=U/2,gt=D+1,ft=P+1,vt=0,it=0,lt=new st;for(let H=0;H<ft;H++){let At=H*W-Mt;for(let It=0;It<gt;It++){let Kt=It*L-V;lt[A]=Kt*T,lt[_]=At*w,lt[x]=$,d.push(lt.x,lt.y,lt.z),lt[A]=0,lt[_]=0,lt[x]=U>0?1:-1,g.push(lt.x,lt.y,lt.z),y.push(It/D),y.push(1-H/P),vt+=1}}for(let H=0;H<P;H++)for(let At=0;At<D;At++){let It=v+At+gt*H,Kt=v+At+gt*(H+1),nt=v+(At+1)+gt*(H+1),bt=v+(At+1)+gt*H;p.push(It,Kt,bt),p.push(Kt,nt,bt),it+=6}f.addGroup(E,it,ct),E+=it,v+=vt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Rl(n){let t={};for(let e in n){t[e]={};for(let i in n[e]){let s=n[e][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][i]=null):t[e][i]=s.clone():Array.isArray(s)?t[e][i]=s.slice():t[e][i]=s}}return t}function Mi(n){let t={};for(let e=0;e<n.length;e++){let i=Rl(n[e]);for(let s in i)t[s]=i[s]}return t}function s8(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function iP(n){return n.getRenderTarget()===null?n.outputColorSpace:Rn.workingColorSpace}var a8={clone:Rl,merge:Mi},u8=`void main() {
7
+ `)}return r.toString()},mr.prototype.computeEdgeEndLabels=function(r){for(var o=this.iterator();o.hasNext();)o.next().computeLabel(r)},mr.prototype.computeLabelling=function(r){this.computeEdgeEndLabels(r[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var o=[!1,!1],a=this.iterator();a.hasNext();)for(var l=a.next().getLabel(),h=0;h<2;h++)l.isLine(h)&&l.getLocation(h)===V.BOUNDARY&&(o[h]=!0);for(var m=this.iterator();m.hasNext();)for(var S=m.next(),C=S.getLabel(),z=0;z<2;z++)if(C.isAnyNull(z)){var K=V.NONE;if(o[z])K=V.EXTERIOR;else{var mt=S.getCoordinate();K=this.getLocation(z,mt,r)}C.setAllLocationsIfNull(z,K)}},mr.prototype.getDegree=function(){return this._edgeMap.size()},mr.prototype.insertEdgeEnd=function(r,o){this._edgeMap.put(r,o),this._edgeList=null},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr};var HD=function(r){function o(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var a=null,l=null,h=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var S=this._resultAreaEdgeList.get(m),C=S.getSym();if(S.getLabel().isArea())switch(a===null&&S.isInResult()&&(a=S),h){case this._SCANNING_FOR_INCOMING:if(!C.isInResult())continue;l=C,h=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!S.isInResult())continue;l.setNext(S),h=this._SCANNING_FOR_INCOMING}}if(h===this._LINKING_TO_OUTGOING){if(a===null)throw new Go("no outgoing dirEdge found",this.getCoordinate());Pt.isTrue(a.isInResult(),"unable to link last incoming dirEdge"),l.setNext(a)}},o.prototype.insert=function(a){var l=a;this.insertEdgeEnd(l,l)},o.prototype.getRightmostEdge=function(){var a=this.getEdges(),l=a.size();if(l<1)return null;var h=a.get(0);if(l===1)return h;var m=a.get(l-1),S=h.getQuadrant(),C=m.getQuadrant();return mn.isNorthern(S)&&mn.isNorthern(C)?h:mn.isNorthern(S)||mn.isNorthern(C)?h.getDy()!==0?h:m.getDy()!==0?m:(Pt.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},o.prototype.print=function(a){Ut.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var l=this.iterator();l.hasNext();){var h=l.next();a.print("out "),h.print(a),a.println(),a.print("in "),h.getSym().print(a),a.println()}},o.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new O;for(var a=this.iterator();a.hasNext();){var l=a.next();(l.isInResult()||l.getSym().isInResult())&&this._resultAreaEdgeList.add(l)}return this._resultAreaEdgeList},o.prototype.updateLabelling=function(a){for(var l=this.iterator();l.hasNext();){var h=l.next().getLabel();h.setAllLocationsIfNull(0,a.getLocation(0)),h.setAllLocationsIfNull(1,a.getLocation(1))}},o.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var a=null,l=null,h=this._edgeList.size()-1;h>=0;h--){var m=this._edgeList.get(h),S=m.getSym();l===null&&(l=S),a!==null&&S.setNext(a),a=m}l.setNext(a)},o.prototype.computeDepths=function(){if(arguments.length===1){var a=arguments[0],l=this.findIndex(a),h=a.getDepth(Ft.LEFT),m=a.getDepth(Ft.RIGHT),S=this.computeDepths(l+1,this._edgeList.size(),h);if(this.computeDepths(0,l,S)!==m)throw new Go("depth mismatch at "+a.getCoordinate())}else if(arguments.length===3){for(var C=arguments[0],z=arguments[1],K=arguments[2],mt=C;mt<z;mt++){var yt=this._edgeList.get(mt);yt.setEdgeDepths(Ft.RIGHT,K),K=yt.getDepth(Ft.LEFT)}return K}},o.prototype.mergeSymLabels=function(){for(var a=this.iterator();a.hasNext();){var l=a.next();l.getLabel().merge(l.getSym().getLabel())}},o.prototype.linkMinimalDirectedEdges=function(a){for(var l=null,h=null,m=this._SCANNING_FOR_INCOMING,S=this._resultAreaEdgeList.size()-1;S>=0;S--){var C=this._resultAreaEdgeList.get(S),z=C.getSym();switch(l===null&&C.getEdgeRing()===a&&(l=C),m){case this._SCANNING_FOR_INCOMING:if(z.getEdgeRing()!==a)continue;h=z,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(C.getEdgeRing()!==a)continue;h.setNextMin(C),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(Pt.isTrue(l!==null,"found null for first outgoing dirEdge"),Pt.isTrue(l.getEdgeRing()===a,"unable to link last incoming dirEdge"),h.setNextMin(l))},o.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var a=0,l=this.iterator();l.hasNext();)l.next().isInResult()&&a++;return a}if(arguments.length===1){for(var h=arguments[0],m=0,S=this.iterator();S.hasNext();)S.next().getEdgeRing()===h&&m++;return m}},o.prototype.getLabel=function(){return this._label},o.prototype.findCoveredLineEdges=function(){for(var a=V.NONE,l=this.iterator();l.hasNext();){var h=l.next(),m=h.getSym();if(!h.isLineEdge()){if(h.isInResult()){a=V.INTERIOR;break}if(m.isInResult()){a=V.EXTERIOR;break}}}if(a===V.NONE)return null;for(var S=a,C=this.iterator();C.hasNext();){var z=C.next(),K=z.getSym();z.isLineEdge()?z.getEdge().setCovered(S===V.INTERIOR):(z.isInResult()&&(S=V.EXTERIOR),K.isInResult()&&(S=V.INTERIOR))}},o.prototype.computeLabelling=function(a){r.prototype.computeLabelling.call(this,a),this._label=new pn(V.NONE);for(var l=this.iterator();l.hasNext();)for(var h=l.next().getEdge().getLabel(),m=0;m<2;m++){var S=h.getLocation(m);S!==V.INTERIOR&&S!==V.BOUNDARY||this._label.setLocation(m,V.INTERIOR)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(mr),b1=function(r){function o(){r.apply(this,arguments)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.createNode=function(a){return new jf(a,new HD)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Tu),cs=function r(){this._pts=null,this._orientation=null;var o=arguments[0];this._pts=o,this._orientation=r.orientation(o)};cs.prototype.compareTo=function(r){var o=r;return cs.compareOriented(this._pts,this._orientation,o._pts,o._orientation)},cs.prototype.interfaces_=function(){return[B]},cs.prototype.getClass=function(){return cs},cs.orientation=function(r){return et.increasingDirection(r)===1},cs.compareOriented=function(r,o,a,l){for(var h=o?1:-1,m=l?1:-1,S=o?r.length:-1,C=l?a.length:-1,z=o?0:r.length-1,K=l?0:a.length-1;;){var mt=r[z].compareTo(a[K]);if(mt!==0)return mt;var yt=(z+=h)===S,zt=(K+=m)===C;if(yt&&!zt)return-1;if(!yt&&zt)return 1;if(yt&&zt)return 0}};var Gi=function(){this._edges=new O,this._ocaMap=new y};Gi.prototype.print=function(r){r.print("MULTILINESTRING ( ");for(var o=0;o<this._edges.size();o++){var a=this._edges.get(o);o>0&&r.print(","),r.print("(");for(var l=a.getCoordinates(),h=0;h<l.length;h++)h>0&&r.print(","),r.print(l[h].x+" "+l[h].y);r.println(")")}r.print(") ")},Gi.prototype.addAll=function(r){for(var o=r.iterator();o.hasNext();)this.add(o.next())},Gi.prototype.findEdgeIndex=function(r){for(var o=0;o<this._edges.size();o++)if(this._edges.get(o).equals(r))return o;return-1},Gi.prototype.iterator=function(){return this._edges.iterator()},Gi.prototype.getEdges=function(){return this._edges},Gi.prototype.get=function(r){return this._edges.get(r)},Gi.prototype.findEqualEdge=function(r){var o=new cs(r.getCoordinates());return this._ocaMap.get(o)},Gi.prototype.add=function(r){this._edges.add(r);var o=new cs(r.getCoordinates());this._ocaMap.put(o,r)},Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi};var ks=function(){};ks.prototype.processIntersections=function(r,o,a,l){},ks.prototype.isDone=function(){},ks.prototype.interfaces_=function(){return[]},ks.prototype.getClass=function(){return ks};var vi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var r=arguments[0];this._li=r};vi.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(vi.isAdjacentSegments(o,l))return!0;if(r.isClosed()){var h=r.size()-1;if(o===0&&l===h||l===0&&o===h)return!0}}return!1},vi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},vi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},vi.prototype.getLineIntersector=function(){return this._li},vi.prototype.hasProperIntersection=function(){return this._hasProper},vi.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(r,o,a,l)||(this._hasIntersection=!0,r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},vi.prototype.hasIntersection=function(){return this._hasIntersection},vi.prototype.isDone=function(){return!1},vi.prototype.hasInteriorIntersection=function(){return this._hasInterior},vi.prototype.interfaces_=function(){return[ks]},vi.prototype.getClass=function(){return vi},vi.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var to=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var r=arguments[0],o=arguments[1],a=arguments[2];this.coord=new P(r),this.segmentIndex=o,this.dist=a};to.prototype.getSegmentIndex=function(){return this.segmentIndex},to.prototype.getCoordinate=function(){return this.coord},to.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex),r.println(" dist = "+this.dist)},to.prototype.compareTo=function(r){var o=r;return this.compare(o.segmentIndex,o.dist)},to.prototype.isEndPoint=function(r){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===r},to.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},to.prototype.getDistance=function(){return this.dist},to.prototype.compare=function(r,o){return this.segmentIndex<r?-1:this.segmentIndex>r?1:this.dist<o?-1:this.dist>o?1:0},to.prototype.interfaces_=function(){return[B]},to.prototype.getClass=function(){return to};var mo=function(){this._nodeMap=new y,this.edge=null;var r=arguments[0];this.edge=r};mo.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},mo.prototype.iterator=function(){return this._nodeMap.values().iterator()},mo.prototype.addSplitEdges=function(r){this.addEndpoints();for(var o=this.iterator(),a=o.next();o.hasNext();){var l=o.next(),h=this.createSplitEdge(a,l);r.add(h),a=l}},mo.prototype.addEndpoints=function(){var r=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[r],r,0)},mo.prototype.createSplitEdge=function(r,o){var a=o.segmentIndex-r.segmentIndex+2,l=this.edge.pts[o.segmentIndex],h=o.dist>0||!o.coord.equals2D(l);h||a--;var m=new Array(a).fill(null),S=0;m[S++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)m[S++]=this.edge.pts[C];return h&&(m[S]=o.coord),new Qf(m,new pn(this.edge._label))},mo.prototype.add=function(r,o,a){var l=new to(r,o,a),h=this._nodeMap.get(l);return h!==null?h:(this._nodeMap.put(l,l),l)},mo.prototype.isIntersection=function(r){for(var o=this.iterator();o.hasNext();)if(o.next().coord.equals(r))return!0;return!1},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo};var qs=function(){};qs.prototype.getChainStartIndices=function(r){var o=0,a=new O;a.add(new it(o));do{var l=this.findChainEnd(r,o);a.add(new it(l)),o=l}while(o<r.length-1);return qs.toIntArray(a)},qs.prototype.findChainEnd=function(r,o){for(var a=mn.quadrant(r[o],r[o+1]),l=o+1;l<r.length&&mn.quadrant(r[l-1],r[l])===a;)l++;return l-1},qs.prototype.interfaces_=function(){return[]},qs.prototype.getClass=function(){return qs},qs.toIntArray=function(r){for(var o=new Array(r.size()).fill(null),a=0;a<o.length;a++)o[a]=r.get(a).intValue();return o};var Vo=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Ct,this.env2=new Ct;var r=arguments[0];this.e=r,this.pts=r.getCoordinates();var o=new qs;this.startIndex=o.getChainStartIndices(this.pts)};Vo.prototype.getCoordinates=function(){return this.pts},Vo.prototype.getMaxX=function(r){var o=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return o>a?o:a},Vo.prototype.getMinX=function(r){var o=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return o<a?o:a},Vo.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var r=arguments[0],o=arguments[1],a=arguments[2],l=arguments[3];this.computeIntersectsForChain(this.startIndex[r],this.startIndex[r+1],o,o.startIndex[a],o.startIndex[a+1],l)}else if(arguments.length===6){var h=arguments[0],m=arguments[1],S=arguments[2],C=arguments[3],z=arguments[4],K=arguments[5],mt=this.pts[h],yt=this.pts[m],zt=S.pts[C],qt=S.pts[z];if(m-h==1&&z-C==1)return K.addIntersections(this.e,h,S.e,C),null;if(this.env1.init(mt,yt),this.env2.init(zt,qt),!this.env1.intersects(this.env2))return null;var jt=Math.trunc((h+m)/2),ue=Math.trunc((C+z)/2);h<jt&&(C<ue&&this.computeIntersectsForChain(h,jt,S,C,ue,K),ue<z&&this.computeIntersectsForChain(h,jt,S,ue,z,K)),jt<m&&(C<ue&&this.computeIntersectsForChain(jt,m,S,C,ue,K),ue<z&&this.computeIntersectsForChain(jt,m,S,ue,z,K))}},Vo.prototype.getStartIndexes=function(){return this.startIndex},Vo.prototype.computeIntersects=function(r,o){for(var a=0;a<this.startIndex.length-1;a++)for(var l=0;l<r.startIndex.length-1;l++)this.computeIntersectsForChain(a,r,l,o)},Vo.prototype.interfaces_=function(){return[]},Vo.prototype.getClass=function(){return Vo};var ar=function r(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var o=0;o<2;o++)for(var a=0;a<3;a++)this._depth[o][a]=r.NULL_VALUE},A1={NULL_VALUE:{configurable:!0}};ar.prototype.getDepth=function(r,o){return this._depth[r][o]},ar.prototype.setDepth=function(r,o,a){this._depth[r][o]=a},ar.prototype.isNull=function(){if(arguments.length===0){for(var r=0;r<2;r++)for(var o=0;o<3;o++)if(this._depth[r][o]!==ar.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===ar.NULL_VALUE}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._depth[l][h]===ar.NULL_VALUE}},ar.prototype.normalize=function(){for(var r=0;r<2;r++)if(!this.isNull(r)){var o=this._depth[r][1];this._depth[r][2]<o&&(o=this._depth[r][2]),o<0&&(o=0);for(var a=1;a<3;a++){var l=0;this._depth[r][a]>o&&(l=1),this._depth[r][a]=l}}},ar.prototype.getDelta=function(r){return this._depth[r][Ft.RIGHT]-this._depth[r][Ft.LEFT]},ar.prototype.getLocation=function(r,o){return this._depth[r][o]<=0?V.EXTERIOR:V.INTERIOR},ar.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},ar.prototype.add=function(){if(arguments.length===1)for(var r=arguments[0],o=0;o<2;o++)for(var a=1;a<3;a++){var l=r.getLocation(o,a);l!==V.EXTERIOR&&l!==V.INTERIOR||(this.isNull(o,a)?this._depth[o][a]=ar.depthAtLocation(l):this._depth[o][a]+=ar.depthAtLocation(l))}else if(arguments.length===3){var h=arguments[0],m=arguments[1];arguments[2]===V.INTERIOR&&this._depth[h][m]++}},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar},ar.depthAtLocation=function(r){return r===V.EXTERIOR?0:r===V.INTERIOR?1:ar.NULL_VALUE},A1.NULL_VALUE.get=function(){return-1},Object.defineProperties(ar,A1);var Qf=function(r){function o(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new mo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new ar,this._depthDelta=0,arguments.length===1){var a=arguments[0];o.call(this,a,null)}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.pts=l,this._label=h}}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.getDepth=function(){return this._depth},o.prototype.getCollapsedEdge=function(){var a=new Array(2).fill(null);return a[0]=this.pts[0],a[1]=this.pts[1],new o(a,pn.toLineLabel(this._label))},o.prototype.isIsolated=function(){return this._isIsolated},o.prototype.getCoordinates=function(){return this.pts},o.prototype.setIsolated=function(a){this._isIsolated=a},o.prototype.setName=function(a){this._name=a},o.prototype.equals=function(a){if(!(a instanceof o))return!1;var l=a;if(this.pts.length!==l.pts.length)return!1;for(var h=!0,m=!0,S=this.pts.length,C=0;C<this.pts.length;C++)if(this.pts[C].equals2D(l.pts[C])||(h=!1),this.pts[C].equals2D(l.pts[--S])||(m=!1),!h&&!m)return!1;return!0},o.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var a=arguments[0];return this.pts[a]}},o.prototype.print=function(a){a.print("edge "+this._name+": "),a.print("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&a.print(","),a.print(this.pts[l].x+" "+this.pts[l].y);a.print(") "+this._label+" "+this._depthDelta)},o.prototype.computeIM=function(a){o.updateIM(this._label,a)},o.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},o.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},o.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},o.prototype.getDepthDelta=function(){return this._depthDelta},o.prototype.getNumPoints=function(){return this.pts.length},o.prototype.printReverse=function(a){a.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)a.print(this.pts[l]+" ");a.println("")},o.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Vo(this)),this._mce},o.prototype.getEnvelope=function(){if(this._env===null){this._env=new Ct;for(var a=0;a<this.pts.length;a++)this._env.expandToInclude(this.pts[a])}return this._env},o.prototype.addIntersection=function(a,l,h,m){var S=new P(a.getIntersection(m)),C=l,z=a.getEdgeDistance(h,m),K=C+1;if(K<this.pts.length){var mt=this.pts[K];S.equals2D(mt)&&(C=K,z=0)}this.eiList.add(S,C,z)},o.prototype.toString=function(){var a=new vt;a.append("edge "+this._name+": "),a.append("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&a.append(","),a.append(this.pts[l].x+" "+this.pts[l].y);return a.append(") "+this._label+" "+this._depthDelta),a.toString()},o.prototype.isPointwiseEqual=function(a){if(this.pts.length!==a.pts.length)return!1;for(var l=0;l<this.pts.length;l++)if(!this.pts[l].equals2D(a.pts[l]))return!1;return!0},o.prototype.setDepthDelta=function(a){this._depthDelta=a},o.prototype.getEdgeIntersectionList=function(){return this.eiList},o.prototype.addIntersections=function(a,l,h){for(var m=0;m<a.getIntersectionNum();m++)this.addIntersection(a,l,h,m)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.updateIM=function(){if(arguments.length!==2)return r.prototype.updateIM.apply(this,arguments);var a=arguments[0],l=arguments[1];l.setAtLeastIfValid(a.getLocation(0,Ft.ON),a.getLocation(1,Ft.ON),1),a.isArea()&&(l.setAtLeastIfValid(a.getLocation(0,Ft.LEFT),a.getLocation(1,Ft.LEFT),2),l.setAtLeastIfValid(a.getLocation(0,Ft.RIGHT),a.getLocation(1,Ft.RIGHT),2))},o}(gi),Pr=function(r){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Gi,this._bufParams=r||null};Pr.prototype.setWorkingPrecisionModel=function(r){this._workingPrecisionModel=r},Pr.prototype.insertUniqueEdge=function(r){var o=this._edgeList.findEqualEdge(r);if(o!==null){var a=o.getLabel(),l=r.getLabel();o.isPointwiseEqual(r)||(l=new pn(r.getLabel())).flip(),a.merge(l);var h=Pr.depthDelta(l),m=o.getDepthDelta()+h;o.setDepthDelta(m)}else this._edgeList.add(r),r.setDepthDelta(Pr.depthDelta(r.getLabel()))},Pr.prototype.buildSubgraphs=function(r,o){for(var a=new O,l=r.iterator();l.hasNext();){var h=l.next(),m=h.getRightmostCoordinate(),S=new Oa(a).getDepth(m);h.computeDepth(S),h.findResultEdges(),a.add(h),o.add(h.getDirectedEdges(),h.getNodes())}},Pr.prototype.createSubgraphs=function(r){for(var o=new O,a=r.getNodes().iterator();a.hasNext();){var l=a.next();if(!l.isVisited()){var h=new Cr;h.create(l),o.add(h)}}return zi.sort(o,zi.reverseOrder()),o},Pr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Pr.prototype.getNoder=function(r){if(this._workingNoder!==null)return this._workingNoder;var o=new Pg,a=new N;return a.setPrecisionModel(r),o.setSegmentIntersector(new vi(a)),o},Pr.prototype.buffer=function(r,o){var a=this._workingPrecisionModel;a===null&&(a=r.getPrecisionModel()),this._geomFact=r.getFactory();var l=new Vr(a,this._bufParams),h=new Ii(r,o,l).getCurves();if(h.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(h,a),this._graph=new On(new b1),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),S=new Qr(this._geomFact);this.buildSubgraphs(m,S);var C=S.getPolygons();return C.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(C)},Pr.prototype.computeNodedEdges=function(r,o){var a=this.getNoder(o);a.computeNodes(r);for(var l=a.getNodedSubstrings().iterator();l.hasNext();){var h=l.next(),m=h.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var S=h.getData(),C=new Qf(h.getCoordinates(),new pn(S));this.insertUniqueEdge(C)}}},Pr.prototype.setNoder=function(r){this._workingNoder=r},Pr.prototype.interfaces_=function(){return[]},Pr.prototype.getClass=function(){return Pr},Pr.depthDelta=function(r){var o=r.getLocation(0,Ft.LEFT),a=r.getLocation(0,Ft.RIGHT);return o===V.INTERIOR&&a===V.EXTERIOR?1:o===V.EXTERIOR&&a===V.INTERIOR?-1:0},Pr.convertSegStrings=function(r){for(var o=new me,a=new O;r.hasNext();){var l=r.next(),h=o.createLineString(l.getCoordinates());a.add(h)}return o.buildGeometry(a)};var fs=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var r=arguments[0],o=arguments[1];this._noder=r,this._scaleFactor=o,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var a=arguments[0],l=arguments[1],h=arguments[2],m=arguments[3];this._noder=a,this._scaleFactor=l,this._offsetX=h,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};fs.prototype.rescale=function(){if($(arguments[0],tt))for(var r=arguments[0].iterator();r.hasNext();){var o=r.next();this.rescale(o.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],l=0;l<a.length;l++)a[l].x=a[l].x/this._scaleFactor+this._offsetX,a[l].y=a[l].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&Ut.out.println(a)}},fs.prototype.scale=function(){if($(arguments[0],tt)){for(var r=arguments[0],o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new zn(this.scale(l.getCoordinates()),l.getData()))}return o}if(arguments[0]instanceof Array){for(var h=arguments[0],m=new Array(h.length).fill(null),S=0;S<h.length;S++)m[S]=new P(Math.round((h[S].x-this._offsetX)*this._scaleFactor),Math.round((h[S].y-this._offsetY)*this._scaleFactor),h[S].z);return et.removeRepeatedPoints(m)}},fs.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},fs.prototype.getNodedSubstrings=function(){var r=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(r),r},fs.prototype.computeNodes=function(r){var o=r;this._isScaled&&(o=this.scale(r)),this._noder.computeNodes(o)},fs.prototype.interfaces_=function(){return[zs]},fs.prototype.getClass=function(){return fs};var eo=function(){this._li=new N,this._segStrings=null;var r=arguments[0];this._segStrings=r},T1={fact:{configurable:!0}};eo.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var o=r.next().getCoordinates();this.checkEndPtVertexIntersections(o[0],this._segStrings),this.checkEndPtVertexIntersections(o[o.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],l=arguments[1].iterator();l.hasNext();)for(var h=l.next().getCoordinates(),m=1;m<h.length-1;m++)if(h[m].equals(a))throw new Ht("found endpt/interior pt intersection at index "+m+" :pt "+a)}},eo.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();)for(var o=r.next(),a=this._segStrings.iterator();a.hasNext();){var l=a.next();this.checkInteriorIntersections(o,l)}else if(arguments.length===2)for(var h=arguments[0],m=arguments[1],S=h.getCoordinates(),C=m.getCoordinates(),z=0;z<S.length-1;z++)for(var K=0;K<C.length-1;K++)this.checkInteriorIntersections(h,z,m,K);else if(arguments.length===4){var mt=arguments[0],yt=arguments[1],zt=arguments[2],qt=arguments[3];if(mt===zt&&yt===qt)return null;var jt=mt.getCoordinates()[yt],ue=mt.getCoordinates()[yt+1],dn=zt.getCoordinates()[qt],Xn=zt.getCoordinates()[qt+1];if(this._li.computeIntersection(jt,ue,dn,Xn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,jt,ue)||this.hasInteriorIntersection(this._li,dn,Xn)))throw new Ht("found non-noded intersection at "+jt+"-"+ue+" and "+dn+"-"+Xn)}},eo.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},eo.prototype.checkCollapses=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var o=r.next();this.checkCollapses(o)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),l=0;l<a.length-2;l++)this.checkCollapse(a[l],a[l+1],a[l+2])},eo.prototype.hasInteriorIntersection=function(r,o,a){for(var l=0;l<r.getIntersectionNum();l++){var h=r.getIntersection(l);if(!h.equals(o)&&!h.equals(a))return!0}return!1},eo.prototype.checkCollapse=function(r,o,a){if(r.equals(a))throw new Ht("found non-noded collapse at "+eo.fact.createLineString([r,o,a]))},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo},T1.fact.get=function(){return new me},Object.defineProperties(eo,T1);var Hr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var r=arguments[0],o=arguments[1],a=arguments[2];if(this._originalPt=r,this._pt=r,this._scaleFactor=o,this._li=a,o<=0)throw new T("Scale factor must be non-zero");o!==1&&(this._pt=new P(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new P,this._p1Scaled=new P),this.initCorners(this._pt)},C1={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Hr.prototype.intersectsScaled=function(r,o){var a=Math.min(r.x,o.x),l=Math.max(r.x,o.x),h=Math.min(r.y,o.y),m=Math.max(r.y,o.y),S=this._maxx<a||this._minx>l||this._maxy<h||this._miny>m;if(S)return!1;var C=this.intersectsToleranceSquare(r,o);return Pt.isTrue(!(S&&C),"Found bad envelope test"),C},Hr.prototype.initCorners=function(r){this._minx=r.x-.5,this._maxx=r.x+.5,this._miny=r.y-.5,this._maxy=r.y+.5,this._corner[0]=new P(this._maxx,this._maxy),this._corner[1]=new P(this._minx,this._maxy),this._corner[2]=new P(this._minx,this._miny),this._corner[3]=new P(this._maxx,this._miny)},Hr.prototype.intersects=function(r,o){return this._scaleFactor===1?this.intersectsScaled(r,o):(this.copyScaled(r,this._p0Scaled),this.copyScaled(o,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Hr.prototype.scale=function(r){return Math.round(r*this._scaleFactor)},Hr.prototype.getCoordinate=function(){return this._originalPt},Hr.prototype.copyScaled=function(r,o){o.x=this.scale(r.x),o.y=this.scale(r.y)},Hr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var r=Hr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ct(this._originalPt.x-r,this._originalPt.x+r,this._originalPt.y-r,this._originalPt.y+r)}return this._safeEnv},Hr.prototype.intersectsPixelClosure=function(r,o){return this._li.computeIntersection(r,o,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,o,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,o,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,o,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Hr.prototype.intersectsToleranceSquare=function(r,o){var a=!1,l=!1;return this._li.computeIntersection(r,o,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(r,o,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(r,o,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(r,o,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!l)||!!r.equals(this._pt)||!!o.equals(this._pt))))},Hr.prototype.addSnappedNode=function(r,o){var a=r.getCoordinate(o),l=r.getCoordinate(o+1);return!!this.intersects(a,l)&&(r.addIntersection(this.getCoordinate(),o),!0)},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr},C1.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Hr,C1);var _c=function(){this.tempEnv1=new Ct,this.selectedSegment=new ae};_c.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var r=arguments[0],o=arguments[1];r.getLineSegment(o,this.selectedSegment),this.select(this.selectedSegment)}}},_c.prototype.interfaces_=function(){return[]},_c.prototype.getClass=function(){return _c};var Ru=function(){this._index=null;var r=arguments[0];this._index=r},I1={HotPixelSnapAction:{configurable:!0}};Ru.prototype.snap=function(){if(arguments.length===1){var r=arguments[0];return this.snap(r,null,-1)}if(arguments.length===3){var o=arguments[0],a=arguments[1],l=arguments[2],h=o.getSafeEnvelope(),m=new P1(o,a,l);return this._index.query(h,{interfaces_:function(){return[us]},visitItem:function(S){S.select(h,m)}}),m.isNodeAdded()}},Ru.prototype.interfaces_=function(){return[]},Ru.prototype.getClass=function(){return Ru},I1.HotPixelSnapAction.get=function(){return P1},Object.defineProperties(Ru,I1);var P1=function(r){function o(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var a=arguments[0],l=arguments[1],h=arguments[2];this._hotPixel=a,this._parentEdge=l,this._hotPixelVertexIndex=h}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.isNodeAdded=function(){return this._isNodeAdded},o.prototype.select=function(){if(arguments.length!==2)return r.prototype.select.apply(this,arguments);var a=arguments[0],l=arguments[1],h=a.getContext();if(this._parentEdge!==null&&h===this._parentEdge&&l===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(h,l)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(_c),Da=function(){this._li=null,this._interiorIntersections=null;var r=arguments[0];this._li=r,this._interiorIntersections=new O};Da.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];if(this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var z=0;z<this._li.getIntersectionNum();z++)this._interiorIntersections.add(this._li.getIntersection(z));r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1)}},Da.prototype.isDone=function(){return!1},Da.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Da.prototype.interfaces_=function(){return[ks]},Da.prototype.getClass=function(){return Da};var yo=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var r=arguments[0];this._pm=r,this._li=new N,this._li.setPrecisionModel(r),this._scaleFactor=r.getScale()};yo.prototype.checkCorrectness=function(r){var o=zn.getNodedSubstrings(r),a=new eo(o);try{a.checkValid()}catch(l){if(!(l instanceof Vt))throw l;l.printStackTrace()}},yo.prototype.getNodedSubstrings=function(){return zn.getNodedSubstrings(this._nodedSegStrings)},yo.prototype.snapRound=function(r,o){var a=this.findInteriorIntersections(r,o);this.computeIntersectionSnaps(a),this.computeVertexSnaps(r)},yo.prototype.findInteriorIntersections=function(r,o){var a=new Da(o);return this._noder.setSegmentIntersector(a),this._noder.computeNodes(r),a.getInteriorIntersections()},yo.prototype.computeVertexSnaps=function(){if($(arguments[0],tt))for(var r=arguments[0].iterator();r.hasNext();){var o=r.next();this.computeVertexSnaps(o)}else if(arguments[0]instanceof zn)for(var a=arguments[0],l=a.getCoordinates(),h=0;h<l.length;h++){var m=new Hr(l[h],this._scaleFactor,this._li);this._pointSnapper.snap(m,a,h)&&a.addIntersection(l[h],h)}},yo.prototype.computeNodes=function(r){this._nodedSegStrings=r,this._noder=new Pg,this._pointSnapper=new Ru(this._noder.getIndex()),this.snapRound(r,this._li)},yo.prototype.computeIntersectionSnaps=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next(),l=new Hr(a,this._scaleFactor,this._li);this._pointSnapper.snap(l)}},yo.prototype.interfaces_=function(){return[zs]},yo.prototype.getClass=function(){return yo};var ur=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ke,this._resultGeometry=null,this._saveException=null,arguments.length===1){var r=arguments[0];this._argGeom=r}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this._argGeom=o,this._bufParams=a}},Lu={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};ur.prototype.bufferFixedPrecision=function(r){var o=new fs(new yo(new _e(1)),r.getScale()),a=new Pr(this._bufParams);a.setWorkingPrecisionModel(r),a.setNoder(o),this._resultGeometry=a.buffer(this._argGeom,this._distance)},ur.prototype.bufferReducedPrecision=function(){var r=this;if(arguments.length===0){for(var o=ur.MAX_PRECISION_DIGITS;o>=0;o--){try{r.bufferReducedPrecision(o)}catch(m){if(!(m instanceof Go))throw m;r._saveException=m}if(r._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],l=ur.precisionScaleFactor(this._argGeom,this._distance,a),h=new _e(l);this.bufferFixedPrecision(h)}},ur.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var r=this._argGeom.getFactory().getPrecisionModel();r.getType()===_e.FIXED?this.bufferFixedPrecision(r):this.bufferReducedPrecision()},ur.prototype.setQuadrantSegments=function(r){this._bufParams.setQuadrantSegments(r)},ur.prototype.bufferOriginalPrecision=function(){try{var r=new Pr(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(o){if(!(o instanceof Ht))throw o;this._saveException=o}},ur.prototype.getResultGeometry=function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry},ur.prototype.setEndCapStyle=function(r){this._bufParams.setEndCapStyle(r)},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.bufferOp=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new ur(r).getResultGeometry(o)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Rt&&typeof arguments[1]=="number"){var a=arguments[0],l=arguments[1],h=arguments[2],m=new ur(a);return m.setQuadrantSegments(h),m.getResultGeometry(l)}if(arguments[2]instanceof Ke&&arguments[0]instanceof Rt&&typeof arguments[1]=="number"){var S=arguments[0],C=arguments[1],z=arguments[2];return new ur(S,z).getResultGeometry(C)}}else if(arguments.length===4){var K=arguments[0],mt=arguments[1],yt=arguments[2],zt=arguments[3],qt=new ur(K);return qt.setQuadrantSegments(yt),qt.setEndCapStyle(zt),qt.getResultGeometry(mt)}},ur.precisionScaleFactor=function(r,o,a){var l=r.getEnvelopeInternal(),h=gt.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(o>0?o:0),m=a-Math.trunc(Math.log(h)/Math.log(10)+1);return Math.pow(10,m)},Lu.CAP_ROUND.get=function(){return Ke.CAP_ROUND},Lu.CAP_BUTT.get=function(){return Ke.CAP_FLAT},Lu.CAP_FLAT.get=function(){return Ke.CAP_FLAT},Lu.CAP_SQUARE.get=function(){return Ke.CAP_SQUARE},Lu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(ur,Lu);var Rr=function(){this._pt=[new P,new P],this._distance=w.NaN,this._isNull=!0};Rr.prototype.getCoordinates=function(){return this._pt},Rr.prototype.getCoordinate=function(r){return this._pt[r]},Rr.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l<this._distance&&this.initialize(o,a,l)}},Rr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],o=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(o),this._distance=r.distance(o),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},Rr.prototype.getDistance=function(){return this._distance},Rr.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l>this._distance&&this.initialize(o,a,l)}},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr};var vo=function(){};vo.prototype.interfaces_=function(){return[]},vo.prototype.getClass=function(){return vo},vo.computeDistance=function(){if(arguments[2]instanceof Rr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=r.getCoordinates(),h=new ae,m=0;m<l.length-1;m++){h.setCoordinates(l[m],l[m+1]);var S=h.closestPoint(o);a.setMinimum(S,o)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof re&&arguments[1]instanceof P){var C=arguments[0],z=arguments[1],K=arguments[2];vo.computeDistance(C.getExteriorRing(),z,K);for(var mt=0;mt<C.getNumInteriorRing();mt++)vo.computeDistance(C.getInteriorRingN(mt),z,K)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],zt=arguments[1],qt=arguments[2];if(yt instanceof ut)vo.computeDistance(yt,zt,qt);else if(yt instanceof re)vo.computeDistance(yt,zt,qt);else if(yt instanceof En)for(var jt=yt,ue=0;ue<jt.getNumGeometries();ue++){var dn=jt.getGeometryN(ue);vo.computeDistance(dn,zt,qt)}else qt.setMinimum(yt.getCoordinate(),zt)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof ae&&arguments[1]instanceof P){var Xn=arguments[0],Dr=arguments[1],So=arguments[2],vs=Xn.closestPoint(Dr);So.setMinimum(vs,Dr)}};var Vs=function(r){this._maxPtDist=new Rr,this._inputGeom=r||null},Rg={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Vs.prototype.computeMaxMidpointDistance=function(r){var o=new hs(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Vs.prototype.computeMaxVertexDistance=function(r){var o=new Fa(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Vs.prototype.findDistance=function(r){return this.computeMaxVertexDistance(r),this.computeMaxMidpointDistance(r),this._maxPtDist.getDistance()},Vs.prototype.getDistancePoints=function(){return this._maxPtDist},Vs.prototype.interfaces_=function(){return[]},Vs.prototype.getClass=function(){return Vs},Rg.MaxPointDistanceFilter.get=function(){return Fa},Rg.MaxMidpointDistanceFilter.get=function(){return hs},Object.defineProperties(Vs,Rg);var Fa=function(r){this._maxPtDist=new Rr,this._minPtDist=new Rr,this._geom=r||null};Fa.prototype.filter=function(r){this._minPtDist.initialize(),vo.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Fa.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fa.prototype.interfaces_=function(){return[j]},Fa.prototype.getClass=function(){return Fa};var hs=function(r){this._maxPtDist=new Rr,this._minPtDist=new Rr,this._geom=r||null};hs.prototype.filter=function(r,o){if(o===0)return null;var a=r.getCoordinate(o-1),l=r.getCoordinate(o),h=new P((a.x+l.x)/2,(a.y+l.y)/2);this._minPtDist.initialize(),vo.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},hs.prototype.isDone=function(){return!1},hs.prototype.isGeometryChanged=function(){return!1},hs.prototype.getMaxPointDistance=function(){return this._maxPtDist},hs.prototype.interfaces_=function(){return[Cn]},hs.prototype.getClass=function(){return hs};var Ho=function(r){this._comps=r||null};Ho.prototype.filter=function(r){r instanceof re&&this._comps.add(r)},Ho.prototype.interfaces_=function(){return[Nn]},Ho.prototype.getClass=function(){return Ho},Ho.getPolygons=function(){if(arguments.length===1){var r=arguments[0];return Ho.getPolygons(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof re?a.add(o):o instanceof En&&o.apply(new Ho(a)),a}};var lr=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var r=arguments[0];this._lines=r}else if(arguments.length===2){var o=arguments[0],a=arguments[1];this._lines=o,this._isForcedToLineString=a}};lr.prototype.filter=function(r){if(this._isForcedToLineString&&r instanceof fe){var o=r.getFactory().createLineString(r.getCoordinateSequence());return this._lines.add(o),null}r instanceof ut&&this._lines.add(r)},lr.prototype.setForceToLineString=function(r){this._isForcedToLineString=r},lr.prototype.interfaces_=function(){return[ce]},lr.prototype.getClass=function(){return lr},lr.getGeometry=function(){if(arguments.length===1){var r=arguments[0];return r.getFactory().buildGeometry(lr.getLines(r))}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o.getFactory().buildGeometry(lr.getLines(o,a))}},lr.getLines=function(){if(arguments.length===1){var r=arguments[0];return lr.getLines(r,!1)}if(arguments.length===2){if($(arguments[0],tt)&&$(arguments[1],tt)){for(var o=arguments[0],a=arguments[1],l=o.iterator();l.hasNext();){var h=l.next();lr.getLines(h,a)}return a}if(arguments[0]instanceof Rt&&typeof arguments[1]=="boolean"){var m=arguments[0],S=arguments[1],C=new O;return m.apply(new lr(C,S)),C}if(arguments[0]instanceof Rt&&$(arguments[1],tt)){var z=arguments[0],K=arguments[1];return z instanceof ut?K.add(z):z.apply(new lr(K)),K}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&$(arguments[0],tt)&&$(arguments[1],tt)){for(var mt=arguments[0],yt=arguments[1],zt=arguments[2],qt=mt.iterator();qt.hasNext();){var jt=qt.next();lr.getLines(jt,yt,zt)}return yt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Rt&&$(arguments[1],tt)){var ue=arguments[0],dn=arguments[1],Xn=arguments[2];return ue.apply(new lr(dn,Xn)),dn}}};var ki=function(){if(this._boundaryRule=b.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];if(r===null)throw new T("Rule must be non-null");this._boundaryRule=r}}};ki.prototype.locateInternal=function(){if(arguments[0]instanceof P&&arguments[1]instanceof re){var r=arguments[0],o=arguments[1];if(o.isEmpty())return V.EXTERIOR;var a=o.getExteriorRing(),l=this.locateInPolygonRing(r,a);if(l===V.EXTERIOR)return V.EXTERIOR;if(l===V.BOUNDARY)return V.BOUNDARY;for(var h=0;h<o.getNumInteriorRing();h++){var m=o.getInteriorRingN(h),S=this.locateInPolygonRing(r,m);if(S===V.INTERIOR)return V.EXTERIOR;if(S===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof P&&arguments[1]instanceof ut){var C=arguments[0],z=arguments[1];if(!z.getEnvelopeInternal().intersects(C))return V.EXTERIOR;var K=z.getCoordinates();return z.isClosed()||!C.equals(K[0])&&!C.equals(K[K.length-1])?ot.isOnLine(C,K)?V.INTERIOR:V.EXTERIOR:V.BOUNDARY}if(arguments[0]instanceof P&&arguments[1]instanceof te){var mt=arguments[0];return arguments[1].getCoordinate().equals2D(mt)?V.INTERIOR:V.EXTERIOR}},ki.prototype.locateInPolygonRing=function(r,o){return o.getEnvelopeInternal().intersects(r)?ot.locatePointInRing(r,o.getCoordinates()):V.EXTERIOR},ki.prototype.intersects=function(r,o){return this.locate(r,o)!==V.EXTERIOR},ki.prototype.updateLocationInfo=function(r){r===V.INTERIOR&&(this._isIn=!0),r===V.BOUNDARY&&this._numBoundaries++},ki.prototype.computeLocation=function(r,o){if(o instanceof te&&this.updateLocationInfo(this.locateInternal(r,o)),o instanceof ut)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof re)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof Kr)for(var a=o,l=0;l<a.getNumGeometries();l++){var h=a.getGeometryN(l);this.updateLocationInfo(this.locateInternal(r,h))}else if(o instanceof he)for(var m=o,S=0;S<m.getNumGeometries();S++){var C=m.getGeometryN(S);this.updateLocationInfo(this.locateInternal(r,C))}else if(o instanceof En)for(var z=new go(o);z.hasNext();){var K=z.next();K!==o&&this.computeLocation(r,K)}},ki.prototype.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:o instanceof ut?this.locateInternal(r,o):o instanceof re?this.locateInternal(r,o):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(r,o),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki};var Lr=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var o=arguments[0],a=arguments[1];r.call(this,o,r.INSIDE_AREA,a)}else if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];this._component=l,this._segIndex=h,this._pt=m}},R1={INSIDE_AREA:{configurable:!0}};Lr.prototype.isInsideArea=function(){return this._segIndex===Lr.INSIDE_AREA},Lr.prototype.getCoordinate=function(){return this._pt},Lr.prototype.getGeometryComponent=function(){return this._component},Lr.prototype.getSegmentIndex=function(){return this._segIndex},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},R1.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Lr,R1);var ps=function(r){this._pts=r||null};ps.prototype.filter=function(r){r instanceof te&&this._pts.add(r)},ps.prototype.interfaces_=function(){return[Nn]},ps.prototype.getClass=function(){return ps},ps.getPoints=function(){if(arguments.length===1){var r=arguments[0];return r instanceof te?zi.singletonList(r):ps.getPoints(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof te?a.add(o):o instanceof En&&o.apply(new ps(a)),a}};var Ua=function(){this._locations=null;var r=arguments[0];this._locations=r};Ua.prototype.filter=function(r){(r instanceof te||r instanceof ut||r instanceof re)&&this._locations.add(new Lr(r,0,r.getCoordinate()))},Ua.prototype.interfaces_=function(){return[Nn]},Ua.prototype.getClass=function(){return Ua},Ua.getLocations=function(r){var o=new O;return r.apply(new Ua(o)),o};var cr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ki,this._minDistanceLocation=null,this._minDistance=w.MAX_VALUE,arguments.length===2){var r=arguments[0],o=arguments[1];this._geom=[r,o],this._terminateDistance=0}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=a,this._geom[1]=l,this._terminateDistance=h}};cr.prototype.computeContainmentDistance=function(){if(arguments.length===0){var r=new Array(2).fill(null);if(this.computeContainmentDistance(0,r),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1],l=1-o,h=Ho.getPolygons(this._geom[o]);if(h.size()>0){var m=Ua.getLocations(this._geom[l]);if(this.computeContainmentDistance(m,h,a),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=a[0],this._minDistanceLocation[o]=a[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&$(arguments[0],ht)&&$(arguments[1],ht)){for(var S=arguments[0],C=arguments[1],z=arguments[2],K=0;K<S.size();K++)for(var mt=S.get(K),yt=0;yt<C.size();yt++)if(this.computeContainmentDistance(mt,C.get(yt),z),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Lr&&arguments[1]instanceof re){var zt=arguments[0],qt=arguments[1],jt=arguments[2],ue=zt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(ue,qt))return this._minDistance=0,jt[0]=zt,jt[1]=new Lr(qt,ue),null}}},cr.prototype.computeMinDistanceLinesPoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),m=0;m<o.size();m++){var S=o.get(m);if(this.computeMinDistance(h,S,a),this._minDistance<=this._terminateDistance)return null}},cr.prototype.computeFacetDistance=function(){var r=new Array(2).fill(null),o=lr.getLines(this._geom[0]),a=lr.getLines(this._geom[1]),l=ps.getPoints(this._geom[0]),h=ps.getPoints(this._geom[1]);return this.computeMinDistanceLines(o,a,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(o,h,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(a,l,r),this.updateMinDistance(r,!0),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistancePoints(l,h,r),void this.updateMinDistance(r,!1))))},cr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},cr.prototype.updateMinDistance=function(r,o){if(r[0]===null)return null;o?(this._minDistanceLocation[0]=r[1],this._minDistanceLocation[1]=r[0]):(this._minDistanceLocation[0]=r[0],this._minDistanceLocation[1]=r[1])},cr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},cr.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof ut&&arguments[1]instanceof te){var r=arguments[0],o=arguments[1],a=arguments[2];if(r.getEnvelopeInternal().distance(o.getEnvelopeInternal())>this._minDistance)return null;for(var l=r.getCoordinates(),h=o.getCoordinate(),m=0;m<l.length-1;m++){var S=ot.distancePointLine(h,l[m],l[m+1]);if(S<this._minDistance){this._minDistance=S;var C=new ae(l[m],l[m+1]).closestPoint(h);a[0]=new Lr(r,m,C),a[1]=new Lr(o,0,h)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof ut&&arguments[1]instanceof ut){var z=arguments[0],K=arguments[1],mt=arguments[2];if(z.getEnvelopeInternal().distance(K.getEnvelopeInternal())>this._minDistance)return null;for(var yt=z.getCoordinates(),zt=K.getCoordinates(),qt=0;qt<yt.length-1;qt++)for(var jt=0;jt<zt.length-1;jt++){var ue=ot.distanceLineLine(yt[qt],yt[qt+1],zt[jt],zt[jt+1]);if(ue<this._minDistance){this._minDistance=ue;var dn=new ae(yt[qt],yt[qt+1]),Xn=new ae(zt[jt],zt[jt+1]),Dr=dn.closestPoints(Xn);mt[0]=new Lr(z,qt,Dr[0]),mt[1]=new Lr(K,jt,Dr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},cr.prototype.computeMinDistancePoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),m=0;m<o.size();m++){var S=o.get(m),C=h.getCoordinate().distance(S.getCoordinate());if(C<this._minDistance&&(this._minDistance=C,a[0]=new Lr(h,0,h.getCoordinate()),a[1]=new Lr(S,0,S.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},cr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new T("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},cr.prototype.computeMinDistanceLines=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),m=0;m<o.size();m++){var S=o.get(m);if(this.computeMinDistance(h,S,a),this._minDistance<=this._terminateDistance)return null}},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.distance=function(r,o){return new cr(r,o).distance()},cr.isWithinDistance=function(r,o,a){return new cr(r,o,a).distance()<=a},cr.nearestPoints=function(r,o){return new cr(r,o).nearestPoints()};var yr=function(){this._pt=[new P,new P],this._distance=w.NaN,this._isNull=!0};yr.prototype.getCoordinates=function(){return this._pt},yr.prototype.getCoordinate=function(r){return this._pt[r]},yr.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l<this._distance&&this.initialize(o,a,l)}},yr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],o=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(o),this._distance=r.distance(o),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},yr.prototype.toString=function(){return wt.toLineString(this._pt[0],this._pt[1])},yr.prototype.getDistance=function(){return this._distance},yr.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(o,a),null;var l=o.distance(a);l>this._distance&&this.initialize(o,a,l)}},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr};var no=function(){};no.prototype.interfaces_=function(){return[]},no.prototype.getClass=function(){return no},no.computeDistance=function(){if(arguments[2]instanceof yr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=new ae,h=r.getCoordinates(),m=0;m<h.length-1;m++){l.setCoordinates(h[m],h[m+1]);var S=l.closestPoint(o);a.setMinimum(S,o)}else if(arguments[2]instanceof yr&&arguments[0]instanceof re&&arguments[1]instanceof P){var C=arguments[0],z=arguments[1],K=arguments[2];no.computeDistance(C.getExteriorRing(),z,K);for(var mt=0;mt<C.getNumInteriorRing();mt++)no.computeDistance(C.getInteriorRingN(mt),z,K)}else if(arguments[2]instanceof yr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],zt=arguments[1],qt=arguments[2];if(yt instanceof ut)no.computeDistance(yt,zt,qt);else if(yt instanceof re)no.computeDistance(yt,zt,qt);else if(yt instanceof En)for(var jt=yt,ue=0;ue<jt.getNumGeometries();ue++){var dn=jt.getGeometryN(ue);no.computeDistance(dn,zt,qt)}else qt.setMinimum(yt.getCoordinate(),zt)}else if(arguments[2]instanceof yr&&arguments[0]instanceof ae&&arguments[1]instanceof P){var Xn=arguments[0],Dr=arguments[1],So=arguments[2],vs=Xn.closestPoint(Dr);So.setMinimum(vs,Dr)}};var Pi=function(){this._g0=null,this._g1=null,this._ptDist=new yr,this._densifyFrac=0;var r=arguments[0],o=arguments[1];this._g0=r,this._g1=o},Lg={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Pi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Pi.prototype.setDensifyFraction=function(r){if(r>1||r<=0)throw new T("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=r},Pi.prototype.compute=function(r,o){this.computeOrientedDistance(r,o,this._ptDist),this.computeOrientedDistance(o,r,this._ptDist)},Pi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Pi.prototype.computeOrientedDistance=function(r,o,a){var l=new Ba(o);if(r.apply(l),a.setMaximum(l.getMaxPointDistance()),this._densifyFrac>0){var h=new ds(o,this._densifyFrac);r.apply(h),a.setMaximum(h.getMaxPointDistance())}},Pi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.distance=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new Pi(r,o).distance()}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2],m=new Pi(a,l);return m.setDensifyFraction(h),m.distance()}},Lg.MaxPointDistanceFilter.get=function(){return Ba},Lg.MaxDensifiedByFractionDistanceFilter.get=function(){return ds},Object.defineProperties(Pi,Lg);var Ba=function(){this._maxPtDist=new yr,this._minPtDist=new yr,this._euclideanDist=new no,this._geom=null;var r=arguments[0];this._geom=r};Ba.prototype.filter=function(r){this._minPtDist.initialize(),no.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ba.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ba.prototype.interfaces_=function(){return[j]},Ba.prototype.getClass=function(){return Ba};var ds=function(){this._maxPtDist=new yr,this._minPtDist=new yr,this._geom=null,this._numSubSegs=0;var r=arguments[0],o=arguments[1];this._geom=r,this._numSubSegs=Math.trunc(Math.round(1/o))};ds.prototype.filter=function(r,o){if(o===0)return null;for(var a=r.getCoordinate(o-1),l=r.getCoordinate(o),h=(l.x-a.x)/this._numSubSegs,m=(l.y-a.y)/this._numSubSegs,S=0;S<this._numSubSegs;S++){var C=a.x+S*h,z=a.y+S*m,K=new P(C,z);this._minPtDist.initialize(),no.computeDistance(this._geom,K,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},ds.prototype.isDone=function(){return!1},ds.prototype.isGeometryChanged=function(){return!1},ds.prototype.getMaxPointDistance=function(){return this._maxPtDist},ds.prototype.interfaces_=function(){return[Cn]},ds.prototype.getClass=function(){return ds};var ei=function(r,o,a){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._bufDistance=o||null,this._result=a||null},Ng={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};ei.prototype.checkMaximumDistance=function(r,o,a){var l=new Pi(o,r);if(l.setDensifyFraction(.25),this._maxDistanceFound=l.orientedDistance(),this._maxDistanceFound>a){this._isValid=!1;var h=l.getCoordinates();this._errorLocation=h[1],this._errorIndicator=r.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+wt.toLineString(h[0],h[1])+")"}},ei.prototype.isValid=function(){var r=Math.abs(this._bufDistance),o=ei.MAX_DISTANCE_DIFF_FRAC*r;return this._minValidDistance=r-o,this._maxValidDistance=r+o,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),ei.VERBOSE&&Ut.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},ei.prototype.checkNegativeValid=function(){if(!(this._input instanceof re||this._input instanceof he||this._input instanceof En))return null;var r=this.getPolygonLines(this._input);if(this.checkMinimumDistance(r,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(r,this._result,this._maxValidDistance)},ei.prototype.getErrorIndicator=function(){return this._errorIndicator},ei.prototype.checkMinimumDistance=function(r,o,a){var l=new cr(r,o,a);if(this._minDistanceFound=l.distance(),this._minDistanceFound<a){this._isValid=!1;var h=l.nearestPoints();this._errorLocation=l.nearestPoints()[1],this._errorIndicator=r.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+wt.toLineString(h[0],h[1])+" )"}},ei.prototype.checkPositiveValid=function(){var r=this._result.getBoundary();if(this.checkMinimumDistance(this._input,r,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,r,this._maxValidDistance)},ei.prototype.getErrorLocation=function(){return this._errorLocation},ei.prototype.getPolygonLines=function(r){for(var o=new O,a=new lr(o),l=Ho.getPolygons(r).iterator();l.hasNext();)l.next().apply(a);return r.getFactory().buildGeometry(o)},ei.prototype.getErrorMessage=function(){return this._errMsg},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},Ng.VERBOSE.get=function(){return!1},Ng.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(ei,Ng);var fr=function(r,o,a){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._distance=o||null,this._result=a||null},Og={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};fr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},fr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var r=this._distance*fr.MAX_ENV_DIFF_FRAC;r===0&&(r=.001);var o=new Ct(this._input.getEnvelopeInternal());o.expandBy(this._distance);var a=new Ct(this._result.getEnvelopeInternal());a.expandBy(r),a.contains(o)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(a)),this.report("Envelope")},fr.prototype.checkDistance=function(){var r=new ei(this._input,this._distance,this._result);r.isValid()||(this._isValid=!1,this._errorMsg=r.getErrorMessage(),this._errorLocation=r.getErrorLocation(),this._errorIndicator=r.getErrorIndicator()),this.report("Distance")},fr.prototype.checkArea=function(){var r=this._input.getArea(),o=this._result.getArea();this._distance>0&&r>o&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&r<o&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},fr.prototype.checkPolygonal=function(){this._result instanceof re||this._result instanceof he||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},fr.prototype.getErrorIndicator=function(){return this._errorIndicator},fr.prototype.getErrorLocation=function(){return this._errorLocation},fr.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},fr.prototype.report=function(r){if(!fr.VERBOSE)return null;Ut.out.println("Check "+r+": "+(this._isValid?"passed":"FAILED"))},fr.prototype.getErrorMessage=function(){return this._errorMsg},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.isValidMsg=function(r,o,a){var l=new fr(r,o,a);return l.isValid()?null:l.getErrorMessage()},fr.isValid=function(r,o,a){return!!new fr(r,o,a).isValid()},Og.VERBOSE.get=function(){return!1},Og.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(fr,Og);var ro=function(){this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};ro.prototype.getCoordinates=function(){return this._pts},ro.prototype.size=function(){return this._pts.length},ro.prototype.getCoordinate=function(r){return this._pts[r]},ro.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ro.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:La.octant(this.getCoordinate(r),this.getCoordinate(r+1))},ro.prototype.setData=function(r){this._data=r},ro.prototype.getData=function(){return this._data},ro.prototype.toString=function(){return wt.toLineString(new se(this._pts))},ro.prototype.interfaces_=function(){return[po]},ro.prototype.getClass=function(){return ro};var ir=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new O,this._intersectionCount=0,this._keepIntersections=!0;var r=arguments[0];this._li=r,this._interiorIntersection=null};ir.prototype.getInteriorIntersection=function(){return this._interiorIntersection},ir.prototype.setCheckEndSegmentsOnly=function(r){this._isCheckEndSegmentsOnly=r},ir.prototype.getIntersectionSegments=function(){return this._intSegments},ir.prototype.count=function(){return this._intersectionCount},ir.prototype.getIntersections=function(){return this._intersections},ir.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},ir.prototype.setKeepIntersections=function(r){this._keepIntersections=r},ir.prototype.processIntersections=function(r,o,a,l){if(!this._findAllIntersections&&this.hasIntersection()||r===a&&o===l||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(r,o)||this.isEndSegment(a,l)))return null;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=h,this._intSegments[1]=m,this._intSegments[2]=S,this._intSegments[3]=C,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},ir.prototype.isEndSegment=function(r,o){return o===0||o>=r.size()-2},ir.prototype.hasIntersection=function(){return this._interiorIntersection!==null},ir.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},ir.prototype.interfaces_=function(){return[ks]},ir.prototype.getClass=function(){return ir},ir.createAllIntersectionsFinder=function(r){var o=new ir(r);return o.setFindAllIntersections(!0),o},ir.createAnyIntersectionFinder=function(r){return new ir(r)},ir.createIntersectionCounter=function(r){var o=new ir(r);return o.setFindAllIntersections(!0),o.setKeepIntersections(!1),o};var qi=function(){this._li=new N,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var r=arguments[0];this._segStrings=r};qi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},qi.prototype.getIntersections=function(){return this._segInt.getIntersections()},qi.prototype.isValid=function(){return this.execute(),this._isValid},qi.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},qi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new ir(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var r=new Pg;if(r.setSegmentIntersector(this._segInt),r.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Go(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var r=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+wt.toLineString(r[0],r[1])+" and "+wt.toLineString(r[2],r[3])},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi},qi.computeIntersections=function(r){var o=new qi(r);return o.setFindAllIntersections(!0),o.isValid(),o.getIntersections()};var Hs=function r(){this._nv=null;var o=arguments[0];this._nv=new qi(r.toSegmentStrings(o))};Hs.prototype.checkValid=function(){this._nv.checkValid()},Hs.prototype.interfaces_=function(){return[]},Hs.prototype.getClass=function(){return Hs},Hs.toSegmentStrings=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new ro(l.getCoordinates(),l))}return o},Hs.checkValid=function(r){new Hs(r).checkValid()};var za=function(r){this._mapOp=r};za.prototype.map=function(r){for(var o=new O,a=0;a<r.getNumGeometries();a++){var l=this._mapOp.map(r.getGeometryN(a));l.isEmpty()||o.add(l)}return r.getFactory().createGeometryCollection(me.toGeometryArray(o))},za.prototype.interfaces_=function(){return[]},za.prototype.getClass=function(){return za},za.map=function(r,o){return new za(o).map(r)};var io=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new O,this._resultLineList=new O;var r=arguments[0],o=arguments[1],a=arguments[2];this._op=r,this._geometryFactory=o,this._ptLocator=a};io.prototype.collectLines=function(r){for(var o=this._op.getGraph().getEdgeEnds().iterator();o.hasNext();){var a=o.next();this.collectLineEdge(a,r,this._lineEdgesList),this.collectBoundaryTouchEdge(a,r,this._lineEdgesList)}},io.prototype.labelIsolatedLine=function(r,o){var a=this._ptLocator.locate(r.getCoordinate(),this._op.getArgGeometry(o));r.getLabel().setLocation(o,a)},io.prototype.build=function(r){return this.findCoveredLineEdges(),this.collectLines(r),this.buildLines(r),this._resultLineList},io.prototype.collectLineEdge=function(r,o,a){var l=r.getLabel(),h=r.getEdge();r.isLineEdge()&&(r.isVisited()||!de.isResultOfOp(l,o)||h.isCovered()||(a.add(h),r.setVisitedEdge(!0)))},io.prototype.findCoveredLineEdges=function(){for(var r=this._op.getGraph().getNodes().iterator();r.hasNext();)r.next().getEdges().findCoveredLineEdges();for(var o=this._op.getGraph().getEdgeEnds().iterator();o.hasNext();){var a=o.next(),l=a.getEdge();if(a.isLineEdge()&&!l.isCoveredSet()){var h=this._op.isCoveredByA(a.getCoordinate());l.setCovered(h)}}},io.prototype.labelIsolatedLines=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next(),l=a.getLabel();a.isIsolated()&&(l.isNull(0)?this.labelIsolatedLine(a,0):this.labelIsolatedLine(a,1))}},io.prototype.buildLines=function(r){for(var o=this._lineEdgesList.iterator();o.hasNext();){var a=o.next(),l=this._geometryFactory.createLineString(a.getCoordinates());this._resultLineList.add(l),a.setInResult(!0)}},io.prototype.collectBoundaryTouchEdge=function(r,o,a){var l=r.getLabel();return r.isLineEdge()||r.isVisited()||r.isInteriorAreaEdge()||r.getEdge().isInResult()?null:(Pt.isTrue(!(r.isInResult()||r.getSym().isInResult())||!r.getEdge().isInResult()),void(de.isResultOfOp(l,o)&&o===de.INTERSECTION&&(a.add(r.getEdge()),r.setVisitedEdge(!0))))},io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io};var Ga=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new O;var r=arguments[0],o=arguments[1];this._op=r,this._geometryFactory=o};Ga.prototype.filterCoveredNodeToPoint=function(r){var o=r.getCoordinate();if(!this._op.isCoveredByLA(o)){var a=this._geometryFactory.createPoint(o);this._resultPointList.add(a)}},Ga.prototype.extractNonCoveredResultNodes=function(r){for(var o=this._op.getGraph().getNodes().iterator();o.hasNext();){var a=o.next();if(!a.isInResult()&&!a.isIncidentEdgeInResult()&&(a.getEdges().getDegree()===0||r===de.INTERSECTION)){var l=a.getLabel();de.isResultOfOp(l,r)&&this.filterCoveredNodeToPoint(a)}}},Ga.prototype.build=function(r){return this.extractNonCoveredResultNodes(r),this._resultPointList},Ga.prototype.interfaces_=function(){return[]},Ga.prototype.getClass=function(){return Ga};var Wr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Wr.prototype.transformPoint=function(r,o){return this._factory.createPoint(this.transformCoordinates(r.getCoordinateSequence(),r))},Wr.prototype.transformPolygon=function(r,o){var a=!0,l=this.transformLinearRing(r.getExteriorRing(),r);l!==null&&l instanceof fe&&!l.isEmpty()||(a=!1);for(var h=new O,m=0;m<r.getNumInteriorRing();m++){var S=this.transformLinearRing(r.getInteriorRingN(m),r);S===null||S.isEmpty()||(S instanceof fe||(a=!1),h.add(S))}if(a)return this._factory.createPolygon(l,h.toArray([]));var C=new O;return l!==null&&C.add(l),C.addAll(h),this._factory.buildGeometry(C)},Wr.prototype.createCoordinateSequence=function(r){return this._factory.getCoordinateSequenceFactory().create(r)},Wr.prototype.getInputGeometry=function(){return this._inputGeom},Wr.prototype.transformMultiLineString=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transformLineString(r.getGeometryN(l),r);h!==null&&(h.isEmpty()||a.add(h))}return this._factory.buildGeometry(a)},Wr.prototype.transformCoordinates=function(r,o){return this.copy(r)},Wr.prototype.transformLineString=function(r,o){return this._factory.createLineString(this.transformCoordinates(r.getCoordinateSequence(),r))},Wr.prototype.transformMultiPoint=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transformPoint(r.getGeometryN(l),r);h!==null&&(h.isEmpty()||a.add(h))}return this._factory.buildGeometry(a)},Wr.prototype.transformMultiPolygon=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transformPolygon(r.getGeometryN(l),r);h!==null&&(h.isEmpty()||a.add(h))}return this._factory.buildGeometry(a)},Wr.prototype.copy=function(r){return r.copy()},Wr.prototype.transformGeometryCollection=function(r,o){for(var a=new O,l=0;l<r.getNumGeometries();l++){var h=this.transform(r.getGeometryN(l));h!==null&&(this._pruneEmptyGeometry&&h.isEmpty()||a.add(h))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(me.toGeometryArray(a)):this._factory.buildGeometry(a)},Wr.prototype.transform=function(r){if(this._inputGeom=r,this._factory=r.getFactory(),r instanceof te)return this.transformPoint(r,null);if(r instanceof ve)return this.transformMultiPoint(r,null);if(r instanceof fe)return this.transformLinearRing(r,null);if(r instanceof ut)return this.transformLineString(r,null);if(r instanceof Kr)return this.transformMultiLineString(r,null);if(r instanceof re)return this.transformPolygon(r,null);if(r instanceof he)return this.transformMultiPolygon(r,null);if(r instanceof En)return this.transformGeometryCollection(r,null);throw new T("Unknown Geometry subtype: "+r.getClass().getName())},Wr.prototype.transformLinearRing=function(r,o){var a=this.transformCoordinates(r.getCoordinateSequence(),r);if(a===null)return this._factory.createLinearRing(null);var l=a.size();return l>0&&l<4&&!this._preserveType?this._factory.createLineString(a):this._factory.createLinearRing(a)},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var _o=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ae,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof ut&&typeof arguments[1]=="number"){var o=arguments[0],a=arguments[1];r.call(this,o.getCoordinates(),a)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var l=arguments[0],h=arguments[1];this._srcPts=l,this._isClosed=r.isClosed(l),this._snapTolerance=h}};_o.prototype.snapVertices=function(r,o){for(var a=this._isClosed?r.size()-1:r.size(),l=0;l<a;l++){var h=r.get(l),m=this.findSnapForVertex(h,o);m!==null&&(r.set(l,new P(m)),l===0&&this._isClosed&&r.set(r.size()-1,new P(m)))}},_o.prototype.findSnapForVertex=function(r,o){for(var a=0;a<o.length;a++){if(r.equals2D(o[a]))return null;if(r.distance(o[a])<this._snapTolerance)return o[a]}return null},_o.prototype.snapTo=function(r){var o=new J(this._srcPts);return this.snapVertices(o,r),this.snapSegments(o,r),o.toCoordinateArray()},_o.prototype.snapSegments=function(r,o){if(o.length===0)return null;var a=o.length;o[0].equals2D(o[o.length-1])&&(a=o.length-1);for(var l=0;l<a;l++){var h=o[l],m=this.findSegmentIndexToSnap(h,r);m>=0&&r.add(m+1,new P(h),!1)}},_o.prototype.findSegmentIndexToSnap=function(r,o){for(var a=w.MAX_VALUE,l=-1,h=0;h<o.size()-1;h++){if(this._seg.p0=o.get(h),this._seg.p1=o.get(h+1),this._seg.p0.equals2D(r)||this._seg.p1.equals2D(r)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(r);m<this._snapTolerance&&m<a&&(a=m,l=h)}return l},_o.prototype.setAllowSnappingToSourceVertices=function(r){this._allowSnappingToSourceVertices=r},_o.prototype.interfaces_=function(){return[]},_o.prototype.getClass=function(){return _o},_o.isClosed=function(r){return!(r.length<=1)&&r[0].equals2D(r[r.length-1])};var Gn=function(r){this._srcGeom=r||null},L1={SNAP_PRECISION_FACTOR:{configurable:!0}};Gn.prototype.snapTo=function(r,o){var a=this.extractTargetCoordinates(r);return new N1(o,a).transform(this._srcGeom)},Gn.prototype.snapToSelf=function(r,o){var a=this.extractTargetCoordinates(this._srcGeom),l=new N1(r,a,!0).transform(this._srcGeom),h=l;return o&&$(h,le)&&(h=l.buffer(0)),h},Gn.prototype.computeSnapTolerance=function(r){return this.computeMinimumSegmentLength(r)/10},Gn.prototype.extractTargetCoordinates=function(r){for(var o=new E,a=r.getCoordinates(),l=0;l<a.length;l++)o.add(a[l]);return o.toArray(new Array(0).fill(null))},Gn.prototype.computeMinimumSegmentLength=function(r){for(var o=w.MAX_VALUE,a=0;a<r.length-1;a++){var l=r[a].distance(r[a+1]);l<o&&(o=l)}return o},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.snap=function(r,o,a){var l=new Array(2).fill(null),h=new Gn(r);l[0]=h.snapTo(o,a);var m=new Gn(o);return l[1]=m.snapTo(l[0],a),l},Gn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var r=arguments[0],o=Gn.computeSizeBasedSnapTolerance(r),a=r.getPrecisionModel();if(a.getType()===_e.FIXED){var l=1/a.getScale()*2/1.415;l>o&&(o=l)}return o}if(arguments.length===2){var h=arguments[0],m=arguments[1];return Math.min(Gn.computeOverlaySnapTolerance(h),Gn.computeOverlaySnapTolerance(m))}},Gn.computeSizeBasedSnapTolerance=function(r){var o=r.getEnvelopeInternal();return Math.min(o.getHeight(),o.getWidth())*Gn.SNAP_PRECISION_FACTOR},Gn.snapToSelf=function(r,o,a){return new Gn(r).snapToSelf(o,a)},L1.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Gn,L1);var N1=function(r){function o(a,l,h){r.call(this),this._snapTolerance=a||null,this._snapPts=l||null,this._isSelfSnap=h!==void 0&&h}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.snapLine=function(a,l){var h=new _o(a,this._snapTolerance);return h.setAllowSnappingToSourceVertices(this._isSelfSnap),h.snapTo(l)},o.prototype.transformCoordinates=function(a,l){var h=a.toCoordinateArray(),m=this.snapLine(h,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Wr),Nr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Nr.prototype.getCommon=function(){return w.longBitsToDouble(this._commonBits)},Nr.prototype.add=function(r){var o=w.doubleToLongBits(r);if(this._isFirst)return this._commonBits=o,this._commonSignExp=Nr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Nr.signExpBits(o)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Nr.numCommonMostSigMantissaBits(this._commonBits,o),this._commonBits=Nr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Nr.prototype.toString=function(){if(arguments.length===1){var r=arguments[0],o=w.longBitsToDouble(r),a="0000000000000000000000000000000000000000000000000000000000000000"+w.toBinaryString(r),l=a.substring(a.length-64);return l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+o+" ]"}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.getBit=function(r,o){return r&1<<o?1:0},Nr.signExpBits=function(r){return r>>52},Nr.zeroLowerBits=function(r,o){return r&~((1<<o)-1)},Nr.numCommonMostSigMantissaBits=function(r,o){for(var a=0,l=52;l>=0;l--){if(Nr.getBit(r,l)!==Nr.getBit(o,l))return a;a++}return 52};var gs=function(){this._commonCoord=null,this._ccFilter=new ka},Dg={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};gs.prototype.addCommonBits=function(r){var o=new ms(this._commonCoord);r.apply(o),r.geometryChanged()},gs.prototype.removeCommonBits=function(r){if(this._commonCoord.x===0&&this._commonCoord.y===0)return r;var o=new P(this._commonCoord);o.x=-o.x,o.y=-o.y;var a=new ms(o);return r.apply(a),r.geometryChanged(),r},gs.prototype.getCommonCoordinate=function(){return this._commonCoord},gs.prototype.add=function(r){r.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},gs.prototype.interfaces_=function(){return[]},gs.prototype.getClass=function(){return gs},Dg.CommonCoordinateFilter.get=function(){return ka},Dg.Translater.get=function(){return ms},Object.defineProperties(gs,Dg);var ka=function(){this._commonBitsX=new Nr,this._commonBitsY=new Nr};ka.prototype.filter=function(r){this._commonBitsX.add(r.x),this._commonBitsY.add(r.y)},ka.prototype.getCommonCoordinate=function(){return new P(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},ka.prototype.interfaces_=function(){return[j]},ka.prototype.getClass=function(){return ka};var ms=function(){this.trans=null;var r=arguments[0];this.trans=r};ms.prototype.filter=function(r,o){var a=r.getOrdinate(o,0)+this.trans.x,l=r.getOrdinate(o,1)+this.trans.y;r.setOrdinate(o,0,a),r.setOrdinate(o,1,l)},ms.prototype.isDone=function(){return!1},ms.prototype.isGeometryChanged=function(){return!0},ms.prototype.interfaces_=function(){return[Cn]},ms.prototype.getClass=function(){return ms};var or=function(r,o){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=r,this._geom[1]=o,this.computeSnapTolerance()};or.prototype.selfSnap=function(r){return new Gn(r).snapTo(r,this._snapTolerance)},or.prototype.removeCommonBits=function(r){this._cbr=new gs,this._cbr.add(r[0]),this._cbr.add(r[1]);var o=new Array(2).fill(null);return o[0]=this._cbr.removeCommonBits(r[0].copy()),o[1]=this._cbr.removeCommonBits(r[1].copy()),o},or.prototype.prepareResult=function(r){return this._cbr.addCommonBits(r),r},or.prototype.getResultGeometry=function(r){var o=this.snap(this._geom),a=de.overlayOp(o[0],o[1],r);return this.prepareResult(a)},or.prototype.checkValid=function(r){r.isValid()||Ut.out.println("Snapped geometry is invalid")},or.prototype.computeSnapTolerance=function(){this._snapTolerance=Gn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},or.prototype.snap=function(r){var o=this.removeCommonBits(r);return Gn.snap(o[0],o[1],this._snapTolerance)},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.overlayOp=function(r,o,a){return new or(r,o).getResultGeometry(a)},or.union=function(r,o){return or.overlayOp(r,o,de.UNION)},or.intersection=function(r,o){return or.overlayOp(r,o,de.INTERSECTION)},or.symDifference=function(r,o){return or.overlayOp(r,o,de.SYMDIFFERENCE)},or.difference=function(r,o){return or.overlayOp(r,o,de.DIFFERENCE)};var Or=function(r,o){this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=o};Or.prototype.getResultGeometry=function(r){var o=null,a=!1,l=null;try{o=de.overlayOp(this._geom[0],this._geom[1],r),a=!0}catch(h){if(!(h instanceof Ht))throw h;l=h}if(!a)try{o=or.overlayOp(this._geom[0],this._geom[1],r)}catch(h){throw h instanceof Ht?l:h}return o},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.overlayOp=function(r,o,a){return new Or(r,o).getResultGeometry(a)},Or.union=function(r,o){return Or.overlayOp(r,o,de.UNION)},Or.intersection=function(r,o){return Or.overlayOp(r,o,de.INTERSECTION)},Or.symDifference=function(r,o){return Or.overlayOp(r,o,de.SYMDIFFERENCE)},Or.difference=function(r,o){return Or.overlayOp(r,o,de.DIFFERENCE)};var xc=function(){this.mce=null,this.chainIndex=null;var r=arguments[0],o=arguments[1];this.mce=r,this.chainIndex=o};xc.prototype.computeIntersections=function(r,o){this.mce.computeIntersectsForChain(this.chainIndex,r.mce,r.chainIndex,o)},xc.prototype.interfaces_=function(){return[]},xc.prototype.getClass=function(){return xc};var ni=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var o=arguments[0],a=arguments[1];this._eventType=r.DELETE,this._xValue=o,this._insertEvent=a}else if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];this._eventType=r.INSERT,this._label=l,this._xValue=h,this._obj=m}},Fg={INSERT:{configurable:!0},DELETE:{configurable:!0}};ni.prototype.isDelete=function(){return this._eventType===ni.DELETE},ni.prototype.setDeleteEventIndex=function(r){this._deleteEventIndex=r},ni.prototype.getObject=function(){return this._obj},ni.prototype.compareTo=function(r){var o=r;return this._xValue<o._xValue?-1:this._xValue>o._xValue?1:this._eventType<o._eventType?-1:this._eventType>o._eventType?1:0},ni.prototype.getInsertEvent=function(){return this._insertEvent},ni.prototype.isInsert=function(){return this._eventType===ni.INSERT},ni.prototype.isSameLabel=function(r){return this._label!==null&&this._label===r._label},ni.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ni.prototype.interfaces_=function(){return[B]},ni.prototype.getClass=function(){return ni},Fg.INSERT.get=function(){return 1},Fg.DELETE.get=function(){return 2},Object.defineProperties(ni,Fg);var th=function(){};th.prototype.interfaces_=function(){return[]},th.prototype.getClass=function(){return th};var hr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var r=arguments[0],o=arguments[1],a=arguments[2];this._li=r,this._includeProper=o,this._recordIsolated=a};hr.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(hr.isAdjacentSegments(o,l))return!0;if(r.isClosed()){var h=r.getNumPoints()-1;if(o===0&&l===h||l===0&&o===h)return!0}}return!1},hr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},hr.prototype.setIsDoneIfProperInt=function(r){this._isDoneWhenProperInt=r},hr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},hr.prototype.isBoundaryPointInternal=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next().getCoordinate();if(r.isIntersection(l))return!0}return!1},hr.prototype.hasProperIntersection=function(){return this._hasProper},hr.prototype.hasIntersection=function(){return this._hasIntersection},hr.prototype.isDone=function(){return this._isDone},hr.prototype.isBoundaryPoint=function(r,o){return o!==null&&(!!this.isBoundaryPointInternal(r,o[0])||!!this.isBoundaryPointInternal(r,o[1]))},hr.prototype.setBoundaryNodes=function(r,o){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=r,this._bdyNodes[1]=o},hr.prototype.addIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],m=r.getCoordinates()[o+1],S=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,m,S,C),this._li.hasIntersection()&&(this._recordIsolated&&(r.setIsolated(!1),a.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(r,o,a,l)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var WD=function(r){function o(){r.call(this),this.events=new O,this.nOverlaps=null}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.prepareEvents=function(){zi.sort(this.events);for(var a=0;a<this.events.size();a++){var l=this.events.get(a);l.isDelete()&&l.getInsertEvent().setDeleteEventIndex(a)}},o.prototype.computeIntersections=function(){if(arguments.length===1){var a=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var l=0;l<this.events.size();l++){var h=this.events.get(l);if(h.isInsert()&&this.processOverlaps(l,h.getDeleteEventIndex(),h,a),a.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof hr&&$(arguments[0],ht)&&$(arguments[1],ht)){var m=arguments[0],S=arguments[1],C=arguments[2];this.addEdges(m,m),this.addEdges(S,S),this.computeIntersections(C)}else if(typeof arguments[2]=="boolean"&&$(arguments[0],ht)&&arguments[1]instanceof hr){var z=arguments[0],K=arguments[1];arguments[2]?this.addEdges(z,null):this.addEdges(z),this.computeIntersections(K)}}},o.prototype.addEdge=function(a,l){for(var h=a.getMonotoneChainEdge(),m=h.getStartIndexes(),S=0;S<m.length-1;S++){var C=new xc(h,S),z=new ni(l,h.getMinX(S),C);this.events.add(z),this.events.add(new ni(h.getMaxX(S),z))}},o.prototype.processOverlaps=function(a,l,h,m){for(var S=h.getObject(),C=a;C<l;C++){var z=this.events.get(C);if(z.isInsert()){var K=z.getObject();h.isSameLabel(z)||(S.computeIntersections(K,m),this.nOverlaps++)}}},o.prototype.addEdges=function(){if(arguments.length===1)for(var a=arguments[0].iterator();a.hasNext();){var l=a.next();this.addEdge(l,l)}else if(arguments.length===2)for(var h=arguments[0],m=arguments[1],S=h.iterator();S.hasNext();){var C=S.next();this.addEdge(C,m)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(th),xo=function(){this._min=w.POSITIVE_INFINITY,this._max=w.NEGATIVE_INFINITY},O1={NodeComparator:{configurable:!0}};xo.prototype.getMin=function(){return this._min},xo.prototype.intersects=function(r,o){return!(this._min>o||this._max<r)},xo.prototype.getMax=function(){return this._max},xo.prototype.toString=function(){return wt.toLineString(new P(this._min,0),new P(this._max,0))},xo.prototype.interfaces_=function(){return[]},xo.prototype.getClass=function(){return xo},O1.NodeComparator.get=function(){return Ec},Object.defineProperties(xo,O1);var Ec=function(){};Ec.prototype.compare=function(r,o){var a=r,l=o,h=(a._min+a._max)/2,m=(l._min+l._max)/2;return h<m?-1:h>m?1:0},Ec.prototype.interfaces_=function(){return[D]},Ec.prototype.getClass=function(){return Ec};var XD=function(r){function o(){r.call(this),this._item=null;var a=arguments[0],l=arguments[1],h=arguments[2];this._min=a,this._max=l,this._item=h}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.query=function(a,l,h){if(!this.intersects(a,l))return null;h.visitItem(this._item)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(xo),YD=function(r){function o(){r.call(this),this._node1=null,this._node2=null;var a=arguments[0],l=arguments[1];this._node1=a,this._node2=l,this.buildExtent(this._node1,this._node2)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.buildExtent=function(a,l){this._min=Math.min(a._min,l._min),this._max=Math.max(a._max,l._max)},o.prototype.query=function(a,l,h){if(!this.intersects(a,l))return null;this._node1!==null&&this._node1.query(a,l,h),this._node2!==null&&this._node2.query(a,l,h)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(xo),Eo=function(){this._leaves=new O,this._root=null,this._level=0};Eo.prototype.buildTree=function(){zi.sort(this._leaves,new xo.NodeComparator);for(var r=this._leaves,o=null,a=new O;;){if(this.buildLevel(r,a),a.size()===1)return a.get(0);o=r,r=a,a=o}},Eo.prototype.insert=function(r,o,a){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new XD(r,o,a))},Eo.prototype.query=function(r,o,a){this.init(),this._root.query(r,o,a)},Eo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Eo.prototype.printNode=function(r){Ut.out.println(wt.toLineString(new P(r._min,this._level),new P(r._max,this._level)))},Eo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Eo.prototype.buildLevel=function(r,o){this._level++,o.clear();for(var a=0;a<r.size();a+=2){var l=r.get(a);if((a+1<r.size()?r.get(a):null)===null)o.add(l);else{var h=new YD(r.get(a),r.get(a+1));o.add(h)}}},Eo.prototype.interfaces_=function(){return[]},Eo.prototype.getClass=function(){return Eo};var Nu=function(){this._items=new O};Nu.prototype.visitItem=function(r){this._items.add(r)},Nu.prototype.getItems=function(){return this._items},Nu.prototype.interfaces_=function(){return[us]},Nu.prototype.getClass=function(){return Nu};var Ou=function(){this._index=null;var r=arguments[0];if(!$(r,le))throw new T("Argument must be Polygonal");this._index=new Ws(r)},Ug={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Ou.prototype.locate=function(r){var o=new St(r),a=new Du(o);return this._index.query(r.y,r.y,a),o.getLocation()},Ou.prototype.interfaces_=function(){return[Pu]},Ou.prototype.getClass=function(){return Ou},Ug.SegmentVisitor.get=function(){return Du},Ug.IntervalIndexedGeometry.get=function(){return Ws},Object.defineProperties(Ou,Ug);var Du=function(){this._counter=null;var r=arguments[0];this._counter=r};Du.prototype.visitItem=function(r){var o=r;this._counter.countSegment(o.getCoordinate(0),o.getCoordinate(1))},Du.prototype.interfaces_=function(){return[us]},Du.prototype.getClass=function(){return Du};var Ws=function(){this._index=new Eo;var r=arguments[0];this.init(r)};Ws.prototype.init=function(r){for(var o=lr.getLines(r).iterator();o.hasNext();){var a=o.next().getCoordinates();this.addLine(a)}},Ws.prototype.addLine=function(r){for(var o=1;o<r.length;o++){var a=new ae(r[o-1],r[o]),l=Math.min(a.p0.y,a.p1.y),h=Math.max(a.p0.y,a.p1.y);this._index.insert(l,h,a)}},Ws.prototype.query=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=new Nu;return this._index.query(r,o,a),a.getItems()}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];this._index.query(l,h,m)}},Ws.prototype.interfaces_=function(){return[]},Ws.prototype.getClass=function(){return Ws};var Sc=function(r){function o(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new fc,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new ki,arguments.length===2){var a=arguments[0],l=arguments[1],h=b.OGC_SFS_BOUNDARY_RULE;this._argIndex=a,this._parentGeom=l,this._boundaryNodeRule=h,l!==null&&this.add(l)}else if(arguments.length===3){var m=arguments[0],S=arguments[1],C=arguments[2];this._argIndex=m,this._parentGeom=S,this._boundaryNodeRule=C,S!==null&&this.add(S)}}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.insertBoundaryPoint=function(a,l){var h=this._nodes.addNode(l).getLabel(),m=1;V.NONE,h.getLocation(a,Ft.ON)===V.BOUNDARY&&m++;var S=o.determineBoundary(this._boundaryNodeRule,m);h.setLocation(a,S)},o.prototype.computeSelfNodes=function(){if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.computeSelfNodes(a,l,!1)}if(arguments.length===3){var h=arguments[0],m=arguments[1],S=arguments[2],C=new hr(h,!0,!1);C.setIsDoneIfProperInt(S);var z=this.createEdgeSetIntersector(),K=this._parentGeom instanceof fe||this._parentGeom instanceof re||this._parentGeom instanceof he,mt=m||!K;return z.computeIntersections(this._edges,C,mt),this.addSelfIntersectionNodes(this._argIndex),C}},o.prototype.computeSplitEdges=function(a){for(var l=this._edges.iterator();l.hasNext();)l.next().eiList.addSplitEdges(a)},o.prototype.computeEdgeIntersections=function(a,l,h){var m=new hr(l,h,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,m),m},o.prototype.getGeometry=function(){return this._parentGeom},o.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},o.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},o.prototype.addPoint=function(){if(arguments[0]instanceof te){var a=arguments[0].getCoordinate();this.insertPoint(this._argIndex,a,V.INTERIOR)}else if(arguments[0]instanceof P){var l=arguments[0];this.insertPoint(this._argIndex,l,V.INTERIOR)}},o.prototype.addPolygon=function(a){this.addPolygonRing(a.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var l=0;l<a.getNumInteriorRing();l++){var h=a.getInteriorRingN(l);this.addPolygonRing(h,V.INTERIOR,V.EXTERIOR)}},o.prototype.addEdge=function(a){this.insertEdge(a);var l=a.getCoordinates();this.insertPoint(this._argIndex,l[0],V.BOUNDARY),this.insertPoint(this._argIndex,l[l.length-1],V.BOUNDARY)},o.prototype.addLineString=function(a){var l=et.removeRepeatedPoints(a.getCoordinates());if(l.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var h=new Qf(l,new pn(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(a,h),this.insertEdge(h),Pt.isTrue(l.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,l[0]),this.insertBoundaryPoint(this._argIndex,l[l.length-1])},o.prototype.getInvalidPoint=function(){return this._invalidPoint},o.prototype.getBoundaryPoints=function(){for(var a=this.getBoundaryNodes(),l=new Array(a.size()).fill(null),h=0,m=a.iterator();m.hasNext();){var S=m.next();l[h++]=S.getCoordinate().copy()}return l},o.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},o.prototype.addSelfIntersectionNode=function(a,l,h){if(this.isBoundaryNode(a,l))return null;h===V.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(a,l):this.insertPoint(a,l,h)},o.prototype.addPolygonRing=function(a,l,h){if(a.isEmpty())return null;var m=et.removeRepeatedPoints(a.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var S=l,C=h;ot.isCCW(m)&&(S=h,C=l);var z=new Qf(m,new pn(this._argIndex,V.BOUNDARY,S,C));this._lineEdgeMap.put(a,z),this.insertEdge(z),this.insertPoint(this._argIndex,m[0],V.BOUNDARY)},o.prototype.insertPoint=function(a,l,h){var m=this._nodes.addNode(l),S=m.getLabel();S===null?m._label=new pn(a,h):S.setLocation(a,h)},o.prototype.createEdgeSetIntersector=function(){return new WD},o.prototype.addSelfIntersectionNodes=function(a){for(var l=this._edges.iterator();l.hasNext();)for(var h=l.next(),m=h.getLabel().getLocation(a),S=h.eiList.iterator();S.hasNext();){var C=S.next();this.addSelfIntersectionNode(a,C.coord,m)}},o.prototype.add=function(){if(arguments.length!==1)return r.prototype.add.apply(this,arguments);var a=arguments[0];if(a.isEmpty())return null;if(a instanceof he&&(this._useBoundaryDeterminationRule=!1),a instanceof re)this.addPolygon(a);else if(a instanceof ut)this.addLineString(a);else if(a instanceof te)this.addPoint(a);else if(a instanceof ve)this.addCollection(a);else if(a instanceof Kr)this.addCollection(a);else if(a instanceof he)this.addCollection(a);else{if(!(a instanceof En))throw new Error(a.getClass().getName());this.addCollection(a)}},o.prototype.addCollection=function(a){for(var l=0;l<a.getNumGeometries();l++){var h=a.getGeometryN(l);this.add(h)}},o.prototype.locate=function(a){return $(this._parentGeom,le)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new Ou(this._parentGeom)),this._areaPtLocator.locate(a)):this._ptLocator.locate(a,this._parentGeom)},o.prototype.findEdge=function(){if(arguments.length===1){var a=arguments[0];return this._lineEdgeMap.get(a)}return r.prototype.findEdge.apply(this,arguments)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.determineBoundary=function(a,l){return a.isInBoundary(l)?V.BOUNDARY:V.INTERIOR},o}(On),Fu=function(){if(this._li=new N,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var r=arguments[0];this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Sc(0,r)}else if(arguments.length===2){var o=arguments[0],a=arguments[1],l=b.OGC_SFS_BOUNDARY_RULE;o.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(o.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sc(0,o,l),this._arg[1]=new Sc(1,a,l)}else if(arguments.length===3){var h=arguments[0],m=arguments[1],S=arguments[2];h.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(h.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sc(0,h,S),this._arg[1]=new Sc(1,m,S)}};Fu.prototype.getArgGeometry=function(r){return this._arg[r].getGeometry()},Fu.prototype.setComputationPrecision=function(r){this._resultPrecisionModel=r,this._li.setPrecisionModel(this._resultPrecisionModel)},Fu.prototype.interfaces_=function(){return[]},Fu.prototype.getClass=function(){return Fu};var Xs=function(){};Xs.prototype.interfaces_=function(){return[]},Xs.prototype.getClass=function(){return Xs},Xs.map=function(){if(arguments[0]instanceof Rt&&$(arguments[1],Xs.MapOp)){for(var r=arguments[0],o=arguments[1],a=new O,l=0;l<r.getNumGeometries();l++){var h=o.map(r.getGeometryN(l));h!==null&&a.add(h)}return r.getFactory().buildGeometry(a)}if($(arguments[0],tt)&&$(arguments[1],Xs.MapOp)){for(var m=arguments[0],S=arguments[1],C=new O,z=m.iterator();z.hasNext();){var K=z.next(),mt=S.map(K);mt!==null&&C.add(mt)}return C}},Xs.MapOp=function(){};var de=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l),this._ptLocator=new ki,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Gi,this._resultPolyList=new O,this._resultLineList=new O,this._resultPointList=new O,this._graph=new On(new b1),this._geomFact=a.getFactory()}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.insertUniqueEdge=function(a){var l=this._edgeList.findEqualEdge(a);if(l!==null){var h=l.getLabel(),m=a.getLabel();l.isPointwiseEqual(a)||(m=new pn(a.getLabel())).flip();var S=l.getDepth();S.isNull()&&S.add(h),S.add(m),h.merge(m)}else this._edgeList.add(a)},o.prototype.getGraph=function(){return this._graph},o.prototype.cancelDuplicateResultEdges=function(){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var l=a.next(),h=l.getSym();l.isInResult()&&h.isInResult()&&(l.setInResult(!1),h.setInResult(!1))}},o.prototype.isCoveredByLA=function(a){return!!this.isCovered(a,this._resultLineList)||!!this.isCovered(a,this._resultPolyList)},o.prototype.computeGeometry=function(a,l,h,m){var S=new O;return S.addAll(a),S.addAll(l),S.addAll(h),S.isEmpty()?o.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(S)},o.prototype.mergeSymLabels=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().mergeSymLabels()},o.prototype.isCovered=function(a,l){for(var h=l.iterator();h.hasNext();){var m=h.next();if(this._ptLocator.locate(a,m)!==V.EXTERIOR)return!0}return!1},o.prototype.replaceCollapsedEdges=function(){for(var a=new O,l=this._edgeList.iterator();l.hasNext();){var h=l.next();h.isCollapsed()&&(l.remove(),a.add(h.getCollapsedEdge()))}this._edgeList.addAll(a)},o.prototype.updateNodeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var l=a.next(),h=l.getEdges().getLabel();l.getLabel().merge(h)}},o.prototype.getResultGeometry=function(a){return this.computeOverlay(a),this._resultGeom},o.prototype.insertUniqueEdges=function(a){for(var l=a.iterator();l.hasNext();){var h=l.next();this.insertUniqueEdge(h)}},o.prototype.computeOverlay=function(a){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var l=new O;this._arg[0].computeSplitEdges(l),this._arg[1].computeSplitEdges(l),this.insertUniqueEdges(l),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Hs.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var h=new Qr(this._geomFact);h.add(this._graph),this._resultPolyList=h.getPolygons();var m=new io(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(a);var S=new Ga(this,this._geomFact,this._ptLocator);this._resultPointList=S.build(a),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,a)},o.prototype.labelIncompleteNode=function(a,l){var h=this._ptLocator.locate(a.getCoordinate(),this._arg[l].getGeometry());a.getLabel().setLocation(l,h)},o.prototype.copyPoints=function(a){for(var l=this._arg[a].getNodeIterator();l.hasNext();){var h=l.next();this._graph.addNode(h.getCoordinate()).setLabel(a,h.getLabel().getLocation(a))}},o.prototype.findResultAreaEdges=function(a){for(var l=this._graph.getEdgeEnds().iterator();l.hasNext();){var h=l.next(),m=h.getLabel();m.isArea()&&!h.isInteriorAreaEdge()&&o.isResultOfOp(m.getLocation(0,Ft.RIGHT),m.getLocation(1,Ft.RIGHT),a)&&h.setInResult(!0)}},o.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var l=a.next(),h=l.getLabel(),m=l.getDepth();if(!m.isNull()){m.normalize();for(var S=0;S<2;S++)h.isNull(S)||!h.isArea()||m.isNull(S)||(m.getDelta(S)===0?h.toLine(S):(Pt.isTrue(!m.isNull(S,Ft.LEFT),"depth of LEFT side has not been initialized"),h.setLocation(S,Ft.LEFT,m.getLocation(S,Ft.LEFT)),Pt.isTrue(!m.isNull(S,Ft.RIGHT),"depth of RIGHT side has not been initialized"),h.setLocation(S,Ft.RIGHT,m.getLocation(S,Ft.RIGHT))))}}},o.prototype.computeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},o.prototype.labelIncompleteNodes=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var l=a.next(),h=l.getLabel();l.isIsolated()&&(h.isNull(0)?this.labelIncompleteNode(l,0):this.labelIncompleteNode(l,1)),l.getEdges().updateLabelling(h)}},o.prototype.isCoveredByA=function(a){return!!this.isCovered(a,this._resultPolyList)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Fu);de.overlayOp=function(r,o,a){return new de(r,o).getResultGeometry(a)},de.intersection=function(r,o){if(r.isEmpty()||o.isEmpty())return de.createEmptyResult(de.INTERSECTION,r,o,r.getFactory());if(r.isGeometryCollection()){var a=o;return za.map(r,{interfaces_:function(){return[Xs.MapOp]},map:function(l){return l.intersection(a)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.INTERSECTION)},de.symDifference=function(r,o){if(r.isEmpty()||o.isEmpty()){if(r.isEmpty()&&o.isEmpty())return de.createEmptyResult(de.SYMDIFFERENCE,r,o,r.getFactory());if(r.isEmpty())return o.copy();if(o.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.SYMDIFFERENCE)},de.resultDimension=function(r,o,a){var l=o.getDimension(),h=a.getDimension(),m=-1;switch(r){case de.INTERSECTION:m=Math.min(l,h);break;case de.UNION:m=Math.max(l,h);break;case de.DIFFERENCE:m=l;break;case de.SYMDIFFERENCE:m=Math.max(l,h)}return m},de.createEmptyResult=function(r,o,a,l){var h=null;switch(de.resultDimension(r,o,a)){case-1:h=l.createGeometryCollection(new Array(0).fill(null));break;case 0:h=l.createPoint();break;case 1:h=l.createLineString();break;case 2:h=l.createPolygon()}return h},de.difference=function(r,o){return r.isEmpty()?de.createEmptyResult(de.DIFFERENCE,r,o,r.getFactory()):o.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.DIFFERENCE))},de.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=r.getLocation(0),l=r.getLocation(1);return de.isResultOfOp(a,l,o)}if(arguments.length===3){var h=arguments[0],m=arguments[1],S=arguments[2];switch(h===V.BOUNDARY&&(h=V.INTERIOR),m===V.BOUNDARY&&(m=V.INTERIOR),S){case de.INTERSECTION:return h===V.INTERIOR&&m===V.INTERIOR;case de.UNION:return h===V.INTERIOR||m===V.INTERIOR;case de.DIFFERENCE:return h===V.INTERIOR&&m!==V.INTERIOR;case de.SYMDIFFERENCE:return h===V.INTERIOR&&m!==V.INTERIOR||h!==V.INTERIOR&&m===V.INTERIOR}return!1}},de.INTERSECTION=1,de.UNION=2,de.DIFFERENCE=3,de.SYMDIFFERENCE=4;var ys=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new ki,this._seg=new ae;var r=arguments[0],o=arguments[1];this._g=r,this._boundaryDistanceTolerance=o,this._linework=this.extractLinework(r)};ys.prototype.isWithinToleranceOfBoundary=function(r){for(var o=0;o<this._linework.getNumGeometries();o++)for(var a=this._linework.getGeometryN(o).getCoordinateSequence(),l=0;l<a.size()-1;l++)if(a.getCoordinate(l,this._seg.p0),a.getCoordinate(l+1,this._seg.p1),this._seg.distance(r)<=this._boundaryDistanceTolerance)return!0;return!1},ys.prototype.getLocation=function(r){return this.isWithinToleranceOfBoundary(r)?V.BOUNDARY:this._ptLocator.locate(r,this._g)},ys.prototype.extractLinework=function(r){var o=new Uu;r.apply(o);var a=o.getLinework(),l=me.toLineStringArray(a);return r.getFactory().createMultiLineString(l)},ys.prototype.interfaces_=function(){return[]},ys.prototype.getClass=function(){return ys};var Uu=function(){this._linework=null,this._linework=new O};Uu.prototype.getLinework=function(){return this._linework},Uu.prototype.filter=function(r){if(r instanceof re){var o=r;this._linework.add(o.getExteriorRing());for(var a=0;a<o.getNumInteriorRing();a++)this._linework.add(o.getInteriorRingN(a))}},Uu.prototype.interfaces_=function(){return[Nn]},Uu.prototype.getClass=function(){return Uu};var Ys=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var r=arguments[0];this._g=r};Ys.prototype.extractPoints=function(r,o,a){for(var l=r.getCoordinates(),h=0;h<l.length-1;h++)this.computeOffsetPoints(l[h],l[h+1],o,a)},Ys.prototype.setSidesToGenerate=function(r,o){this._doLeft=r,this._doRight=o},Ys.prototype.getPoints=function(r){for(var o=new O,a=lr.getLines(this._g).iterator();a.hasNext();){var l=a.next();this.extractPoints(l,r,o)}return o},Ys.prototype.computeOffsetPoints=function(r,o,a,l){var h=o.x-r.x,m=o.y-r.y,S=Math.sqrt(h*h+m*m),C=a*h/S,z=a*m/S,K=(o.x+r.x)/2,mt=(o.y+r.y)/2;if(this._doLeft){var yt=new P(K-z,mt+C);l.add(yt)}if(this._doRight){var zt=new P(K+z,mt-C);l.add(zt)}},Ys.prototype.interfaces_=function(){return[]},Ys.prototype.getClass=function(){return Ys};var _i=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new O;var o=arguments[0],a=arguments[1],l=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(o,a),this._geom=[o,a,l],this._locFinder=[new ys(this._geom[0],this._boundaryDistanceTolerance),new ys(this._geom[1],this._boundaryDistanceTolerance),new ys(this._geom[2],this._boundaryDistanceTolerance)]},D1={TOLERANCE:{configurable:!0}};_i.prototype.reportResult=function(r,o,a){Ut.out.println("Overlay result invalid - A:"+V.toLocationSymbol(o[0])+" B:"+V.toLocationSymbol(o[1])+" expected:"+(a?"i":"e")+" actual:"+V.toLocationSymbol(o[2]))},_i.prototype.isValid=function(r){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var o=this.checkValid(r);return o},_i.prototype.checkValid=function(){if(arguments.length===1){for(var r=arguments[0],o=0;o<this._testCoords.size();o++){var a=this._testCoords.get(o);if(!this.checkValid(r,a))return this._invalidLocation=a,!1}return!0}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._location[0]=this._locFinder[0].getLocation(h),this._location[1]=this._locFinder[1].getLocation(h),this._location[2]=this._locFinder[2].getLocation(h),!!_i.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(l,this._location)}},_i.prototype.addTestPts=function(r){var o=new Ys(r);this._testCoords.addAll(o.getPoints(5*this._boundaryDistanceTolerance))},_i.prototype.isValidResult=function(r,o){var a=de.isResultOfOp(o[0],o[1],r),l=!(a^o[2]===V.INTERIOR);return l||this.reportResult(r,o,a),l},_i.prototype.getInvalidLocation=function(){return this._invalidLocation},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},_i.hasLocation=function(r,o){for(var a=0;a<3;a++)if(r[a]===o)return!0;return!1},_i.computeBoundaryDistanceTolerance=function(r,o){return Math.min(Gn.computeSizeBasedSnapTolerance(r),Gn.computeSizeBasedSnapTolerance(o))},_i.isValid=function(r,o,a,l){return new _i(r,o,l).isValid(a)},D1.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(_i,D1);var xi=function r(o){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(o),this._inputGeoms=o};xi.prototype.extractElements=function(r,o){if(r===null)return null;for(var a=0;a<r.getNumGeometries();a++){var l=r.getGeometryN(a);this._skipEmpty&&l.isEmpty()||o.add(l)}},xi.prototype.combine=function(){for(var r=new O,o=this._inputGeoms.iterator();o.hasNext();){var a=o.next();this.extractElements(a,r)}return r.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(r)},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi},xi.combine=function(){if(arguments.length===1){var r=arguments[0];return new xi(r).combine()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new xi(xi.createList(o,a)).combine()}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2];return new xi(xi.createList(l,h,m)).combine()}},xi.extractFactory=function(r){return r.isEmpty()?null:r.iterator().next().getFactory()},xi.createList=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=new O;return a.add(r),a.add(o),a}if(arguments.length===3){var l=arguments[0],h=arguments[1],m=arguments[2],S=new O;return S.add(l),S.add(h),S.add(m),S}};var Wn=function(){this._inputPolys=null,this._geomFactory=null;var r=arguments[0];this._inputPolys=r,this._inputPolys===null&&(this._inputPolys=new O)},F1={STRTREE_NODE_CAPACITY:{configurable:!0}};Wn.prototype.reduceToGeometries=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next(),h=null;$(l,ht)?h=this.unionTree(l):l instanceof Rt&&(h=l),o.add(h)}return o},Wn.prototype.extractByEnvelope=function(r,o,a){for(var l=new O,h=0;h<o.getNumGeometries();h++){var m=o.getGeometryN(h);m.getEnvelopeInternal().intersects(r)?l.add(m):a.add(m)}return this._geomFactory.buildGeometry(l)},Wn.prototype.unionOptimized=function(r,o){var a=r.getEnvelopeInternal(),l=o.getEnvelopeInternal();if(!a.intersects(l))return xi.combine(r,o);if(r.getNumGeometries()<=1&&o.getNumGeometries()<=1)return this.unionActual(r,o);var h=a.intersection(l);return this.unionUsingEnvelopeIntersection(r,o,h)},Wn.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var r=new _1(Wn.STRTREE_NODE_CAPACITY),o=this._inputPolys.iterator();o.hasNext();){var a=o.next();r.insert(a.getEnvelopeInternal(),a)}this._inputPolys=null;var l=r.itemsTree();return this.unionTree(l)},Wn.prototype.binaryUnion=function(){if(arguments.length===1){var r=arguments[0];return this.binaryUnion(r,0,r.size())}if(arguments.length===3){var o=arguments[0],a=arguments[1],l=arguments[2];if(l-a<=1){var h=Wn.getGeometry(o,a);return this.unionSafe(h,null)}if(l-a==2)return this.unionSafe(Wn.getGeometry(o,a),Wn.getGeometry(o,a+1));var m=Math.trunc((l+a)/2),S=this.binaryUnion(o,a,m),C=this.binaryUnion(o,m,l);return this.unionSafe(S,C)}},Wn.prototype.repeatedUnion=function(r){for(var o=null,a=r.iterator();a.hasNext();){var l=a.next();o=o===null?l.copy():o.union(l)}return o},Wn.prototype.unionSafe=function(r,o){return r===null&&o===null?null:r===null?o.copy():o===null?r.copy():this.unionOptimized(r,o)},Wn.prototype.unionActual=function(r,o){return Wn.restrictToPolygons(r.union(o))},Wn.prototype.unionTree=function(r){var o=this.reduceToGeometries(r);return this.binaryUnion(o)},Wn.prototype.unionUsingEnvelopeIntersection=function(r,o,a){var l=new O,h=this.extractByEnvelope(a,r,l),m=this.extractByEnvelope(a,o,l),S=this.unionActual(h,m);return l.add(S),xi.combine(l)},Wn.prototype.bufferUnion=function(){if(arguments.length===1){var r=arguments[0];return r.get(0).getFactory().buildGeometry(r).buffer(0)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o.getFactory().createGeometryCollection([o,a]).buffer(0)}},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn},Wn.restrictToPolygons=function(r){if($(r,le))return r;var o=Ho.getPolygons(r);return o.size()===1?o.get(0):r.getFactory().createMultiPolygon(me.toPolygonArray(o))},Wn.getGeometry=function(r,o){return o>=r.size()?null:r.get(o)},Wn.union=function(r){return new Wn(r).union()},F1.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Wn,F1);var wc=function(){};wc.prototype.interfaces_=function(){return[]},wc.prototype.getClass=function(){return wc},wc.union=function(r,o){if(r.isEmpty()||o.isEmpty()){if(r.isEmpty()&&o.isEmpty())return de.createEmptyResult(de.UNION,r,o,r.getFactory());if(r.isEmpty())return o.copy();if(o.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Or.overlayOp(r,o,de.UNION)},n.GeoJSONReader=Cg,n.GeoJSONWriter=y1,n.OverlayOp=de,n.UnionOp=wc,n.BufferOp=ur,Object.defineProperty(n,"__esModule",{value:!0})})});var r1=X((CAt,PO)=>{"use strict";var HQ=bc(),IO=Function.prototype,TO=IO.apply,CO=IO.call;PO.exports=typeof Reflect=="object"&&Reflect.apply||(HQ?CO.bind(TO):function(){return CO.apply(TO,arguments)})});var FO=X((IAt,DO)=>{"use strict";a_();var RO=vr(),LO=Ha(),WQ=gd(),NO=An(),OO=Xr(),XQ=Es(),YQ=OO("species"),i1=RegExp.prototype;DO.exports=function(n,t,e,i){var s=OO(n),u=!NO(function(){var d={};return d[s]=function(){return 7},""[n](d)!==7}),c=u&&!NO(function(){var d=!1,g=/a/;return n==="split"&&(g={},g.constructor={},g.constructor[YQ]=function(){return g},g.flags="",g[s]=/./[s]),g.exec=function(){return d=!0,null},g[s](""),!d});if(!u||!c||e){var f=/./[s],p=t(s,""[n],function(d,g,y,v,E){var M=g.exec;return M===WQ||M===i1.exec?u&&!E?{done:!0,value:RO(f,g,y,v)}:{done:!0,value:RO(d,y,g,v)}:{done:!1}});LO(String.prototype,n,p[0]),LO(i1,s,p[1])}i&&XQ(i1[s],"sham",!0)}});var GO=X((PAt,zO)=>{"use strict";var o1=In(),$Q=Hi(),ZQ=Fl(),JQ=zu(),jQ=o1("".charAt),UO=o1("".charCodeAt),KQ=o1("".slice),BO=function(n){return function(t,e){var i=ZQ(JQ(t)),s=$Q(e),u=i.length,c,f;return s<0||s>=u?n?"":void 0:(c=UO(i,s),c<55296||c>56319||s+1===u||(f=UO(i,s+1))<56320||f>57343?n?jQ(i,s):c:n?KQ(i,s,s+2):(c-55296<<10)+(f-56320)+65536)}};zO.exports={codeAt:BO(!1),charAt:BO(!0)}});var qO=X((RAt,kO)=>{"use strict";var QQ=GO().charAt;kO.exports=function(n,t,e){return t+(e?QQ(n,t).length:1)}});var HO=X((LAt,VO)=>{"use strict";var u1=In(),ttt=Vi(),ett=Math.floor,s1=u1("".charAt),ntt=u1("".replace),a1=u1("".slice),rtt=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,itt=/\$([$&'`]|\d{1,2})/g;VO.exports=function(n,t,e,i,s,u){var c=e+n.length,f=i.length,p=itt;return s!==void 0&&(s=ttt(s),p=rtt),ntt(u,p,function(d,g){var y;switch(s1(g,0)){case"$":return"$";case"&":return n;case"`":return a1(t,0,e);case"'":return a1(t,c);case"<":y=s[a1(g,1,-1)];break;default:var v=+g;if(v===0)return d;if(v>f){var E=ett(v/10);return E===0?d:E<=f?i[E-1]===void 0?s1(g,1):i[E-1]+s1(g,1):d}y=i[v-1]}return y===void 0?"":y})}});var YO=X((NAt,XO)=>{"use strict";var WO=vr(),ott=so(),stt=er(),att=_s(),utt=gd(),ltt=TypeError;XO.exports=function(n,t){var e=n.exec;if(stt(e)){var i=WO(e,n,t);return i!==null&&ott(i),i}if(att(n)==="RegExp")return WO(utt,n,t);throw new ltt("RegExp#exec called on incompatible receiver")}});var KO=X(()=>{"use strict";var ctt=r1(),$O=vr(),_g=In(),ftt=FO(),htt=An(),ptt=so(),dtt=er(),gtt=Ei(),mtt=Hi(),ytt=Wa(),ac=Fl(),vtt=zu(),_tt=qO(),xtt=Pc(),Ett=HO(),Stt=YO(),wtt=Xr(),c1=wtt("replace"),Mtt=Math.max,btt=Math.min,Att=_g([].concat),l1=_g([].push),ZO=_g("".indexOf),JO=_g("".slice),Ttt=function(n){return n===void 0?n:String(n)},Ctt=function(){return"a".replace(/./,"$0")==="$0"}(),jO=function(){return/./[c1]?/./[c1]("a","$0")==="":!1}(),Itt=!htt(function(){var n=/./;return n.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(n,"$<a>")!=="7"});ftt("replace",function(n,t,e){var i=jO?"$":"$0";return[function(u,c){var f=vtt(this),p=gtt(u)?xtt(u,c1):void 0;return p?$O(p,u,f,c):$O(t,ac(f),u,c)},function(s,u){var c=ptt(this),f=ac(s);if(typeof u=="string"&&ZO(u,i)===-1&&ZO(u,"$<")===-1){var p=e(t,c,f,u);if(p.done)return p.value}var d=dtt(u);d||(u=ac(u));var g=c.global,y;g&&(y=c.unicode,c.lastIndex=0);for(var v=[],E;E=Stt(c,f),!(E===null||(l1(v,E),!g));){var M=ac(E[0]);M===""&&(c.lastIndex=_tt(f,ytt(c.lastIndex),y))}for(var A="",_=0,x=0;x<v.length;x++){E=v[x];for(var T=ac(E[0]),w=Mtt(btt(mtt(E.index),f.length),0),R=[],B,U=1;U<E.length;U++)l1(R,Ttt(E[U]));var D=E.groups;if(d){var P=Att([T],R,w,f);D!==void 0&&l1(P,D),B=ac(ctt(u,void 0,P))}else B=Ett(T,f,w,R,D,u);w>=_&&(A+=JO(f,_,w)+B,_=w+T.length)}return A+JO(f,_)}]},!Itt||!Ctt||jO)});var tD=X((FAt,QO)=>{"use strict";var Ptt=An();QO.exports=function(n,t){var e=[][n];return!!e&&Ptt(function(){e.call(null,t||function(){return 1},1)})}});var lD=X(()=>{"use strict";var Rtt=sr(),aD=In(),Ltt=xs(),Ntt=Vi(),eD=ii(),Ott=hy(),nD=Fl(),f1=An(),Dtt=A0(),Ftt=tD(),rD=T0(),Utt=C0(),iD=Cc(),oD=I0(),Ca=[],sD=aD(Ca.sort),Btt=aD(Ca.push),ztt=f1(function(){Ca.sort(void 0)}),Gtt=f1(function(){Ca.sort(null)}),ktt=Ftt("sort"),uD=!f1(function(){if(iD)return iD<70;if(!(rD&&rD>3)){if(Utt)return!0;if(oD)return oD<603;var n="",t,e,i,s;for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(s=0;s<47;s++)Ca.push({k:e+s,v:i})}for(Ca.sort(function(u,c){return c.v-u.v}),s=0;s<Ca.length;s++)e=Ca[s].k.charAt(0),n.charAt(n.length-1)!==e&&(n+=e);return n!=="DGBEFHACIJK"}}),qtt=ztt||!Gtt||!ktt||!uD,Vtt=function(n){return function(t,e){return e===void 0?-1:t===void 0?1:n!==void 0?+n(t,e)||0:nD(t)>nD(e)?1:-1}};Rtt({target:"Array",proto:!0,forced:qtt},{sort:function(t){t!==void 0&&Ltt(t);var e=Ntt(this);if(uD)return t===void 0?sD(e):sD(e,t);var i=[],s=eD(e),u,c;for(c=0;c<s;c++)c in e&&Btt(i,e[c]);for(Dtt(i,Vtt(t)),u=eD(i),c=0;c<u;)e[c]=i[c++];for(;c<s;)Ott(e,c++);return e}})});var mD=X((XAt,gD)=>{"use strict";var Htt=In(),hD=Oc(),Wtt=er(),pD=_s(),Xtt=Fl(),dD=Htt([].push);gD.exports=function(n){if(Wtt(n))return n;if(hD(n)){for(var t=n.length,e=[],i=0;i<t;i++){var s=n[i];typeof s=="string"?dD(e,s):(typeof s=="number"||pD(s)==="Number"||pD(s)==="String")&&dD(e,Xtt(s))}var u=e.length,c=!0;return function(f,p){if(c)return c=!1,p;if(hD(this))return p;for(var d=0;d<u;d++)if(e[d]===f)return p}}}});var CD=X(()=>{"use strict";var Ytt=sr(),MD=$s(),bD=r1(),$tt=vr(),Yf=In(),AD=An(),yD=er(),vD=Ic(),TD=zh(),Ztt=mD(),Jtt=oh(),jtt=String,Ia=MD("JSON","stringify"),xg=Yf(/./.exec),_D=Yf("".charAt),Ktt=Yf("".charCodeAt),Qtt=Yf("".replace),tet=Yf(1 .toString),eet=/[\uD800-\uDFFF]/g,xD=/^[\uD800-\uDBFF]$/,ED=/^[\uDC00-\uDFFF]$/,SD=!Jtt||AD(function(){var n=MD("Symbol")("stringify detection");return Ia([n])!=="[null]"||Ia({a:n})!=="{}"||Ia(Object(n))!=="{}"}),wD=AD(function(){return Ia("\uDF06\uD834")!=='"\\udf06\\ud834"'||Ia("\uDEAD")!=='"\\udead"'}),net=function(n,t){var e=TD(arguments),i=Ztt(t);if(!(!yD(i)&&(n===void 0||vD(n))))return e[1]=function(s,u){if(yD(i)&&(u=$tt(i,this,jtt(s),u)),!vD(u))return u},bD(Ia,null,e)},ret=function(n,t,e){var i=_D(e,t-1),s=_D(e,t+1);return xg(xD,n)&&!xg(ED,s)||xg(ED,n)&&!xg(xD,i)?"\\u"+tet(Ktt(n,0),16):n};Ia&&Ytt({target:"JSON",stat:!0,arity:3,forced:SD||wD},{stringify:function(t,e,i){var s=TD(arguments),u=bD(SD?net:Ia,null,s);return wD&&typeof u=="string"?Qtt(u,eet,ret):u}})});function Bu(){return Bu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},Bu.apply(this,arguments)}var OTt=Jt(Dc(),1),DTt=Jt(zS(),1),FTt=Jt(Yu(),1),UTt=Jt(hM(),1),BTt=Jt(pM(),1),zTt=Jt(g0(),1),GTt=Jt(m0(),1),kTt=Jt(y0(),1),qTt=Jt(_0(),1),VTt=Jt(x0(),1),HTt=Jt(M0(),1),WTt=Jt(R0(),1),XTt=Jt(N0(),1),YTt=Jt(O0(),1),$Tt=Jt(F0(),1),ZTt=Jt(B0(),1),JTt=Jt(q0(),1),jTt=Jt(W0(),1),KTt=Jt(sy(),1),QTt=Jt(ay(),1),tCt=Jt(kT(),1),eCt=Jt(WT(),1),nCt=Jt(JT(),1),rCt=Jt(QT(),1),iCt=Jt(nC(),1),oCt=Jt(oC(),1),sCt=Jt(uC(),1),aCt=Jt(fC(),1);var Zo,Kc=function(n){return n.MAP_VERSION="map_version",n.ROUTE_VERSION="route_version",n.FACILITY_VERSION="facility_version",n.MAP_DATA="map_data",n.ROAD_NETWORK_DATA="road_network_data",n.FACILITY_DATA="facility_data",n.POI_TEXT="poi_text_1",n.POI_TEXT_RECT="poi_text_rect",n.LAZY_TEXTURE="lazy_texture",n.LAZY_POI="lazy_poi",n}({});function ip(n,t){return n===void 0&&(n="aibee_map"),t===void 0&&(t=9),new Promise((e,i)=>{if(Zo)return e({db:Zo,type:"success"});let s=indexedDB.open(n,t);s.onupgradeneeded=function(u){Zo=u.target.result,console.log("[open db is onupgradeneeded]"),$o("map_version"),$o("route_version"),$o("facility_version"),$o("map_data"),$o("road_network_data"),$o("facility_data"),$o("poi_text_1"),$o("poi_text_rect"),$o("lazy_texture"),$o("lazy_poi")},s.onsuccess=u=>{Zo=u.target.result,e({db:Zo,type:"success"})},s.onerror=u=>{console.log("[open db is onerror]"),i(u)}})}function py(n,t,e){return e===void 0&&(e=Zo),new Promise((i,s)=>{e||s("\u6CA1\u6709db");let c=e.transaction([n],"readonly").objectStore(n).get(t);c.onsuccess=()=>{c.result?i(c.result.value):i(null)},c.onerror=f=>{console.log("[getVersionByKey]",f),i(null)}})}function hC(n,t,e,i,s){return i===void 0&&(i=Zo),s===void 0&&(s=!1),new Promise((u,c)=>Ri(this,null,function*(){if(!i){c("\u6CA1\u6709db");return}let f=s;s||(f=!!(yield py(n,t)));let p=i.transaction([n],"readwrite").objectStore(n),d=f?p.put({key:t,value:e}):p.add({key:t,value:e});d.onsuccess=function(g){u(g)},d.onerror=function(g){c(g)}}))}function $o(n,t){t===void 0&&(t=Zo),t&&(t.objectStoreNames.contains(n)||t.createObjectStore(n,{keyPath:"key"}))}function pC(n){n===void 0&&(n=Zo),n==null||n.close(),Zo=null}var Iot=Jt(Yu(),1),Pot=Jt(Dc(),1);var Yv="162";var HH=0,dC=1,WH=2;var HI=1,XH=2,Rs=3,va=0,Oi=1,Ns=2,da=0,bl=1,gC=2,mC=3,yC=4,YH=5,eu=100,$H=101,ZH=102,vC=103,_C=104,JH=200,jH=201,KH=202,QH=203,jy=204,Ky=205,t6=206,e6=207,n6=208,r6=209,i6=210,o6=211,s6=212,a6=213,u6=214,l6=0,c6=1,f6=2,Np=3,h6=4,p6=5,d6=6,g6=7,WI=0,m6=1,y6=2,ga=0,v6=1,_6=2,x6=3,E6=4,S6=5,w6=6,M6=7;var XI=300,Cl=301,Il=302,Qy=303,tv=304,ud=306,ev=1e3,Ro=1001,nv=1002,bi=1003,xC=1004;var Qc=1005;var Ni=1006,dy=1007;var ru=1008;var ma=1009,b6=1010,A6=1011,$v=1012,YI=1013,pa=1014,Os=1015,ff=1016,$I=1017,ZI=1018,su=1020,T6=1021,Lo=1023,C6=1024,I6=1025,au=1026,Pl=1027,P6=1028,JI=1029,R6=1030,jI=1031,KI=1033,gy=33776,my=33777,yy=33778,vy=33779,EC=35840,SC=35841,wC=35842,MC=35843,QI=36196,bC=37492,AC=37496,TC=37808,CC=37809,IC=37810,PC=37811,RC=37812,LC=37813,NC=37814,OC=37815,DC=37816,FC=37817,UC=37818,BC=37819,zC=37820,GC=37821,_y=36492,kC=36494,qC=36495,L6=36283,VC=36284,HC=36285,WC=36286;var Op=2300,Dp=2301,xy=2302,XC=2400,YC=2401,$C=2402;var N6=3200,O6=3201,D6=0,F6=1,ha="",Jo="srgb",xa="srgb-linear",Zv="display-p3",ld="display-p3-linear",Fp="linear",kn="srgb",Up="rec709",Bp="p3";var rl=7680;var ZC=519,U6=512,B6=513,z6=514,tP=515,G6=516,k6=517,q6=518,V6=519,rv=35044;var JC="300 es",iv=1035,Ds=2e3,zp=2001,_a=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let s=this._listeners[t];if(s!==void 0){let u=s.indexOf(e);u!==-1&&s.splice(u,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let i=this._listeners[t.type];if(i!==void 0){t.target=this;let s=i.slice(0);for(let u=0,c=s.length;u<c;u++)s[u].call(this,t);t.target=null}}},oi=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var Ey=Math.PI/180,ov=180/Math.PI;function Fs(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(oi[n&255]+oi[n>>8&255]+oi[n>>16&255]+oi[n>>24&255]+"-"+oi[t&255]+oi[t>>8&255]+"-"+oi[t>>16&15|64]+oi[t>>24&255]+"-"+oi[e&63|128]+oi[e>>8&255]+"-"+oi[e>>16&255]+oi[e>>24&255]+oi[i&255]+oi[i>>8&255]+oi[i>>16&255]+oi[i>>24&255]).toLowerCase()}function ai(n,t,e){return Math.max(t,Math.min(e,n))}function H6(n,t){return(n%t+t)%t}function Sy(n,t,e){return(1-e)*n+e*t}function jC(n){return(n&n-1)===0&&n!==0}function sv(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ko(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Pn(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Ot=class n{constructor(t=0,e=0){n.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ai(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),s=Math.sin(e),u=this.x-t.x,c=this.y-t.y;return this.x=u*i-c*s+t.x,this.y=u*s+c*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ee=class n{constructor(t,e,i,s,u,c,f,p,d){n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,s,u,c,f,p,d)}set(t,e,i,s,u,c,f,p,d){let g=this.elements;return g[0]=t,g[1]=s,g[2]=f,g[3]=e,g[4]=u,g[5]=p,g[6]=i,g[7]=c,g[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,u=this.elements,c=i[0],f=i[3],p=i[6],d=i[1],g=i[4],y=i[7],v=i[2],E=i[5],M=i[8],A=s[0],_=s[3],x=s[6],T=s[1],w=s[4],R=s[7],B=s[2],U=s[5],D=s[8];return u[0]=c*A+f*T+p*B,u[3]=c*_+f*w+p*U,u[6]=c*x+f*R+p*D,u[1]=d*A+g*T+y*B,u[4]=d*_+g*w+y*U,u[7]=d*x+g*R+y*D,u[2]=v*A+E*T+M*B,u[5]=v*_+E*w+M*U,u[8]=v*x+E*R+M*D,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],s=t[2],u=t[3],c=t[4],f=t[5],p=t[6],d=t[7],g=t[8];return e*c*g-e*f*d-i*u*g+i*f*p+s*u*d-s*c*p}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],u=t[3],c=t[4],f=t[5],p=t[6],d=t[7],g=t[8],y=g*c-f*d,v=f*p-g*u,E=d*u-c*p,M=e*y+i*v+s*E;if(M===0)return this.set(0,0,0,0,0,0,0,0,0);let A=1/M;return t[0]=y*A,t[1]=(s*d-g*i)*A,t[2]=(f*i-s*c)*A,t[3]=v*A,t[4]=(g*e-s*p)*A,t[5]=(s*u-f*e)*A,t[6]=E*A,t[7]=(i*p-d*e)*A,t[8]=(c*e-i*u)*A,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,u,c,f){let p=Math.cos(u),d=Math.sin(u);return this.set(i*p,i*d,-i*(p*c+d*f)+c+t,-s*d,s*p,-s*(-d*c+p*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(wy.makeScale(t,e)),this}rotate(t){return this.premultiply(wy.makeRotation(-t)),this}translate(t,e){return this.premultiply(wy.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},wy=new Ee;function eP(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function Gp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function W6(){let n=Gp("canvas");return n.style.display="block",n}var KC={};function nP(n){n in KC||(KC[n]=!0,console.warn(n))}var QC=new Ee().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),tI=new Ee().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),op={[xa]:{transfer:Fp,primaries:Up,toReference:n=>n,fromReference:n=>n},[Jo]:{transfer:kn,primaries:Up,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[ld]:{transfer:Fp,primaries:Bp,toReference:n=>n.applyMatrix3(tI),fromReference:n=>n.applyMatrix3(QC)},[Zv]:{transfer:kn,primaries:Bp,toReference:n=>n.convertSRGBToLinear().applyMatrix3(tI),fromReference:n=>n.applyMatrix3(QC).convertLinearToSRGB()}},X6=new Set([xa,ld]),Rn={enabled:!0,_workingColorSpace:xa,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!X6.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,t,e){if(this.enabled===!1||t===e||!t||!e)return n;let i=op[t].toReference,s=op[e].fromReference;return s(i(n))},fromWorkingColorSpace:function(n,t){return this.convert(n,this._workingColorSpace,t)},toWorkingColorSpace:function(n,t){return this.convert(n,t,this._workingColorSpace)},getPrimaries:function(n){return op[n].primaries},getTransfer:function(n){return n===ha?Fp:op[n].transfer}};function Al(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function My(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var il,kp=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{il===void 0&&(il=Gp("canvas")),il.width=t.width,il.height=t.height;let i=il.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=il}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Gp("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),u=s.data;for(let c=0;c<u.length;c++)u[c]=Al(u[c]/255)*255;return i.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(Al(e[i]/255)*255):e[i]=Al(e[i]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Y6=0,qp=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Y6++}),this.uuid=Fs(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let u;if(Array.isArray(s)){u=[];for(let c=0,f=s.length;c<f;c++)s[c].isDataTexture?u.push(by(s[c].image)):u.push(by(s[c]))}else u=by(s);i.url=u}return e||(t.images[this.uuid]=i),i}};function by(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?kp.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var $6=0,uo=class n extends _a{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,i=Ro,s=Ro,u=Ni,c=ru,f=Lo,p=ma,d=n.DEFAULT_ANISOTROPY,g=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$6++}),this.uuid=Fs(),this.name="",this.source=new qp(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=u,this.minFilter=c,this.anisotropy=d,this.format=f,this.internalFormat=null,this.type=p,this.offset=new Ot(0,0),this.repeat=new Ot(1,1),this.center=new Ot(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ee,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=g,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==XI)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ev:t.x=t.x-Math.floor(t.x);break;case Ro:t.x=t.x<0?0:1;break;case nv:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ev:t.y=t.y-Math.floor(t.y);break;case Ro:t.y=t.y<0?0:1;break;case nv:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}};uo.DEFAULT_IMAGE=null;uo.DEFAULT_MAPPING=XI;uo.DEFAULT_ANISOTROPY=1;var Yr=class n{constructor(t=0,e=0,i=0,s=1){n.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,u=this.w,c=t.elements;return this.x=c[0]*e+c[4]*i+c[8]*s+c[12]*u,this.y=c[1]*e+c[5]*i+c[9]*s+c[13]*u,this.z=c[2]*e+c[6]*i+c[10]*s+c[14]*u,this.w=c[3]*e+c[7]*i+c[11]*s+c[15]*u,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,u,p=t.elements,d=p[0],g=p[4],y=p[8],v=p[1],E=p[5],M=p[9],A=p[2],_=p[6],x=p[10];if(Math.abs(g-v)<.01&&Math.abs(y-A)<.01&&Math.abs(M-_)<.01){if(Math.abs(g+v)<.1&&Math.abs(y+A)<.1&&Math.abs(M+_)<.1&&Math.abs(d+E+x-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let w=(d+1)/2,R=(E+1)/2,B=(x+1)/2,U=(g+v)/4,D=(y+A)/4,P=(M+_)/4;return w>R&&w>B?w<.01?(i=0,s=.707106781,u=.707106781):(i=Math.sqrt(w),s=U/i,u=D/i):R>B?R<.01?(i=.707106781,s=0,u=.707106781):(s=Math.sqrt(R),i=U/s,u=P/s):B<.01?(i=.707106781,s=.707106781,u=0):(u=Math.sqrt(B),i=D/u,s=P/u),this.set(i,s,u,e),this}let T=Math.sqrt((_-M)*(_-M)+(y-A)*(y-A)+(v-g)*(v-g));return Math.abs(T)<.001&&(T=1),this.x=(_-M)/T,this.y=(y-A)/T,this.z=(v-g)/T,this.w=Math.acos((d+E+x-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},av=class extends _a{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Yr(0,0,t,e),this.scissorTest=!1,this.viewport=new Yr(0,0,t,e);let s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ni,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let u=new uo(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);u.flipY=!1,u.generateMipmaps=i.generateMipmaps,u.internalFormat=i.internalFormat,this.textures=[];let c=i.count;for(let f=0;f<c;f++)this.textures[f]=u.clone(),this.textures[f].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,u=this.textures.length;s<u;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let i=0,s=t.textures.length;i<s;i++)this.textures[i]=t.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new qp(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Us=class extends av{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},Vp=class extends uo{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=bi,this.minFilter=bi,this.wrapR=Ro,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var uv=class extends uo{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=bi,this.minFilter=bi,this.wrapR=Ro,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var lo=class{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,u,c,f){let p=i[s+0],d=i[s+1],g=i[s+2],y=i[s+3],v=u[c+0],E=u[c+1],M=u[c+2],A=u[c+3];if(f===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=y;return}if(f===1){t[e+0]=v,t[e+1]=E,t[e+2]=M,t[e+3]=A;return}if(y!==A||p!==v||d!==E||g!==M){let _=1-f,x=p*v+d*E+g*M+y*A,T=x>=0?1:-1,w=1-x*x;if(w>Number.EPSILON){let B=Math.sqrt(w),U=Math.atan2(B,x*T);_=Math.sin(_*U)/B,f=Math.sin(f*U)/B}let R=f*T;if(p=p*_+v*R,d=d*_+E*R,g=g*_+M*R,y=y*_+A*R,_===1-f){let B=1/Math.sqrt(p*p+d*d+g*g+y*y);p*=B,d*=B,g*=B,y*=B}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=y}static multiplyQuaternionsFlat(t,e,i,s,u,c){let f=i[s],p=i[s+1],d=i[s+2],g=i[s+3],y=u[c],v=u[c+1],E=u[c+2],M=u[c+3];return t[e]=f*M+g*y+p*E-d*v,t[e+1]=p*M+g*v+d*y-f*E,t[e+2]=d*M+g*E+f*v-p*y,t[e+3]=g*M-f*y-p*v-d*E,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,s=t._y,u=t._z,c=t._order,f=Math.cos,p=Math.sin,d=f(i/2),g=f(s/2),y=f(u/2),v=p(i/2),E=p(s/2),M=p(u/2);switch(c){case"XYZ":this._x=v*g*y+d*E*M,this._y=d*E*y-v*g*M,this._z=d*g*M+v*E*y,this._w=d*g*y-v*E*M;break;case"YXZ":this._x=v*g*y+d*E*M,this._y=d*E*y-v*g*M,this._z=d*g*M-v*E*y,this._w=d*g*y+v*E*M;break;case"ZXY":this._x=v*g*y-d*E*M,this._y=d*E*y+v*g*M,this._z=d*g*M+v*E*y,this._w=d*g*y-v*E*M;break;case"ZYX":this._x=v*g*y-d*E*M,this._y=d*E*y+v*g*M,this._z=d*g*M-v*E*y,this._w=d*g*y+v*E*M;break;case"YZX":this._x=v*g*y+d*E*M,this._y=d*E*y+v*g*M,this._z=d*g*M-v*E*y,this._w=d*g*y-v*E*M;break;case"XZY":this._x=v*g*y-d*E*M,this._y=d*E*y-v*g*M,this._z=d*g*M+v*E*y,this._w=d*g*y+v*E*M;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],u=e[8],c=e[1],f=e[5],p=e[9],d=e[2],g=e[6],y=e[10],v=i+f+y;if(v>0){let E=.5/Math.sqrt(v+1);this._w=.25/E,this._x=(g-p)*E,this._y=(u-d)*E,this._z=(c-s)*E}else if(i>f&&i>y){let E=2*Math.sqrt(1+i-f-y);this._w=(g-p)/E,this._x=.25*E,this._y=(s+c)/E,this._z=(u+d)/E}else if(f>y){let E=2*Math.sqrt(1+f-i-y);this._w=(u-d)/E,this._x=(s+c)/E,this._y=.25*E,this._z=(p+g)/E}else{let E=2*Math.sqrt(1+y-i-f);this._w=(c-s)/E,this._x=(u+d)/E,this._y=(p+g)/E,this._z=.25*E}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ai(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(i===0)return this;let s=Math.min(1,e/i);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,s=t._y,u=t._z,c=t._w,f=e._x,p=e._y,d=e._z,g=e._w;return this._x=i*g+c*f+s*d-u*p,this._y=s*g+c*p+u*f-i*d,this._z=u*g+c*d+i*p-s*f,this._w=c*g-i*f-s*p-u*d,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let i=this._x,s=this._y,u=this._z,c=this._w,f=c*t._w+i*t._x+s*t._y+u*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=c,this._x=i,this._y=s,this._z=u,this;let p=1-f*f;if(p<=Number.EPSILON){let E=1-e;return this._w=E*c+e*this._w,this._x=E*i+e*this._x,this._y=E*s+e*this._y,this._z=E*u+e*this._z,this.normalize(),this}let d=Math.sqrt(p),g=Math.atan2(d,f),y=Math.sin((1-e)*g)/d,v=Math.sin(e*g)/d;return this._w=c*y+this._w*v,this._x=i*y+this._x*v,this._y=s*y+this._y*v,this._z=u*y+this._z*v,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),u=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),u*Math.sin(e),u*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},st=class n{constructor(t=0,e=0,i=0){n.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(eI.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(eI.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[3]*i+u[6]*s,this.y=u[1]*e+u[4]*i+u[7]*s,this.z=u[2]*e+u[5]*i+u[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,u=t.elements,c=1/(u[3]*e+u[7]*i+u[11]*s+u[15]);return this.x=(u[0]*e+u[4]*i+u[8]*s+u[12])*c,this.y=(u[1]*e+u[5]*i+u[9]*s+u[13])*c,this.z=(u[2]*e+u[6]*i+u[10]*s+u[14])*c,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,u=t.x,c=t.y,f=t.z,p=t.w,d=2*(c*s-f*i),g=2*(f*e-u*s),y=2*(u*i-c*e);return this.x=e+p*d+c*y-f*g,this.y=i+p*g+f*d-u*y,this.z=s+p*y+u*g-c*d,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[4]*i+u[8]*s,this.y=u[1]*e+u[5]*i+u[9]*s,this.z=u[2]*e+u[6]*i+u[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,u=t.z,c=e.x,f=e.y,p=e.z;return this.x=s*p-u*f,this.y=u*c-i*p,this.z=i*f-s*c,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Ay.copy(this).projectOnVector(t),this.sub(Ay)}reflect(t){return this.sub(Ay.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ai(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Ay=new st,eI=new lo,Qo=class{constructor(t=new st(1/0,1/0,1/0),e=new st(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Co.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Co.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=Co.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(i!==void 0){let u=i.getAttribute("position");if(e===!0&&u!==void 0&&t.isInstancedMesh!==!0)for(let c=0,f=u.count;c<f;c++)t.isMesh===!0?t.getVertexPosition(c,Co):Co.fromBufferAttribute(u,c),Co.applyMatrix4(t.matrixWorld),this.expandByPoint(Co);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),sp.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),sp.copy(i.boundingBox)),sp.applyMatrix4(t.matrixWorld),this.union(sp)}let s=t.children;for(let u=0,c=s.length;u<c;u++)this.expandByObject(s[u],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Co),Co.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(tf),ap.subVectors(this.max,tf),ol.subVectors(t.a,tf),sl.subVectors(t.b,tf),al.subVectors(t.c,tf),oa.subVectors(sl,ol),sa.subVectors(al,sl),$a.subVectors(ol,al);let e=[0,-oa.z,oa.y,0,-sa.z,sa.y,0,-$a.z,$a.y,oa.z,0,-oa.x,sa.z,0,-sa.x,$a.z,0,-$a.x,-oa.y,oa.x,0,-sa.y,sa.x,0,-$a.y,$a.x,0];return!Ty(e,ol,sl,al,ap)||(e=[1,0,0,0,1,0,0,0,1],!Ty(e,ol,sl,al,ap))?!1:(up.crossVectors(oa,sa),e=[up.x,up.y,up.z],Ty(e,ol,sl,al,ap))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Co).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Co).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(As[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),As[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),As[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),As[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),As[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),As[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),As[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),As[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(As),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},As=[new st,new st,new st,new st,new st,new st,new st,new st],Co=new st,sp=new Qo,ol=new st,sl=new st,al=new st,oa=new st,sa=new st,$a=new st,tf=new st,ap=new st,up=new st,Za=new st;function Ty(n,t,e,i,s){for(let u=0,c=n.length-3;u<=c;u+=3){Za.fromArray(n,u);let f=s.x*Math.abs(Za.x)+s.y*Math.abs(Za.y)+s.z*Math.abs(Za.z),p=t.dot(Za),d=e.dot(Za),g=i.dot(Za);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>f)return!1}return!0}var Z6=new Qo,ef=new st,Cy=new st,uu=class{constructor(t=new st,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;e!==void 0?i.copy(e):Z6.setFromPoints(t).getCenter(i);let s=0;for(let u=0,c=t.length;u<c;u++)s=Math.max(s,i.distanceToSquared(t[u]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ef.subVectors(t,this.center);let e=ef.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(ef,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Cy.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ef.copy(t.center).add(Cy)),this.expandByPoint(ef.copy(t.center).sub(Cy))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ts=new st,Iy=new st,lp=new st,aa=new st,Py=new st,cp=new st,Ry=new st,lv=class{constructor(t=new st,e=new st(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ts)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Ts.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ts.copy(this.origin).addScaledVector(this.direction,e),Ts.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){Iy.copy(t).add(e).multiplyScalar(.5),lp.copy(e).sub(t).normalize(),aa.copy(this.origin).sub(Iy);let u=t.distanceTo(e)*.5,c=-this.direction.dot(lp),f=aa.dot(this.direction),p=-aa.dot(lp),d=aa.lengthSq(),g=Math.abs(1-c*c),y,v,E,M;if(g>0)if(y=c*p-f,v=c*f-p,M=u*g,y>=0)if(v>=-M)if(v<=M){let A=1/g;y*=A,v*=A,E=y*(y+c*v+2*f)+v*(c*y+v+2*p)+d}else v=u,y=Math.max(0,-(c*v+f)),E=-y*y+v*(v+2*p)+d;else v=-u,y=Math.max(0,-(c*v+f)),E=-y*y+v*(v+2*p)+d;else v<=-M?(y=Math.max(0,-(-c*u+f)),v=y>0?-u:Math.min(Math.max(-u,-p),u),E=-y*y+v*(v+2*p)+d):v<=M?(y=0,v=Math.min(Math.max(-u,-p),u),E=v*(v+2*p)+d):(y=Math.max(0,-(c*u+f)),v=y>0?u:Math.min(Math.max(-u,-p),u),E=-y*y+v*(v+2*p)+d);else v=c>0?-u:u,y=Math.max(0,-(c*v+f)),E=-y*y+v*(v+2*p)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,y),s&&s.copy(Iy).addScaledVector(lp,v),E}intersectSphere(t,e){Ts.subVectors(t.center,this.origin);let i=Ts.dot(this.direction),s=Ts.dot(Ts)-i*i,u=t.radius*t.radius;if(s>u)return null;let c=Math.sqrt(u-s),f=i-c,p=i+c;return p<0?null:f<0?this.at(p,e):this.at(f,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,u,c,f,p,d=1/this.direction.x,g=1/this.direction.y,y=1/this.direction.z,v=this.origin;return d>=0?(i=(t.min.x-v.x)*d,s=(t.max.x-v.x)*d):(i=(t.max.x-v.x)*d,s=(t.min.x-v.x)*d),g>=0?(u=(t.min.y-v.y)*g,c=(t.max.y-v.y)*g):(u=(t.max.y-v.y)*g,c=(t.min.y-v.y)*g),i>c||u>s||((u>i||isNaN(i))&&(i=u),(c<s||isNaN(s))&&(s=c),y>=0?(f=(t.min.z-v.z)*y,p=(t.max.z-v.z)*y):(f=(t.max.z-v.z)*y,p=(t.min.z-v.z)*y),i>p||f>s)||((f>i||i!==i)&&(i=f),(p<s||s!==s)&&(s=p),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return this.intersectBox(t,Ts)!==null}intersectTriangle(t,e,i,s,u){Py.subVectors(e,t),cp.subVectors(i,t),Ry.crossVectors(Py,cp);let c=this.direction.dot(Ry),f;if(c>0){if(s)return null;f=1}else if(c<0)f=-1,c=-c;else return null;aa.subVectors(this.origin,t);let p=f*this.direction.dot(cp.crossVectors(aa,cp));if(p<0)return null;let d=f*this.direction.dot(Py.cross(aa));if(d<0||p+d>c)return null;let g=-f*aa.dot(Ry);return g<0?null:this.at(g/c,u)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},$n=class n{constructor(t,e,i,s,u,c,f,p,d,g,y,v,E,M,A,_){n.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,s,u,c,f,p,d,g,y,v,E,M,A,_)}set(t,e,i,s,u,c,f,p,d,g,y,v,E,M,A,_){let x=this.elements;return x[0]=t,x[4]=e,x[8]=i,x[12]=s,x[1]=u,x[5]=c,x[9]=f,x[13]=p,x[2]=d,x[6]=g,x[10]=y,x[14]=v,x[3]=E,x[7]=M,x[11]=A,x[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new n().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,i=t.elements,s=1/ul.setFromMatrixColumn(t,0).length(),u=1/ul.setFromMatrixColumn(t,1).length(),c=1/ul.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*u,e[5]=i[5]*u,e[6]=i[6]*u,e[7]=0,e[8]=i[8]*c,e[9]=i[9]*c,e[10]=i[10]*c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,u=t.z,c=Math.cos(i),f=Math.sin(i),p=Math.cos(s),d=Math.sin(s),g=Math.cos(u),y=Math.sin(u);if(t.order==="XYZ"){let v=c*g,E=c*y,M=f*g,A=f*y;e[0]=p*g,e[4]=-p*y,e[8]=d,e[1]=E+M*d,e[5]=v-A*d,e[9]=-f*p,e[2]=A-v*d,e[6]=M+E*d,e[10]=c*p}else if(t.order==="YXZ"){let v=p*g,E=p*y,M=d*g,A=d*y;e[0]=v+A*f,e[4]=M*f-E,e[8]=c*d,e[1]=c*y,e[5]=c*g,e[9]=-f,e[2]=E*f-M,e[6]=A+v*f,e[10]=c*p}else if(t.order==="ZXY"){let v=p*g,E=p*y,M=d*g,A=d*y;e[0]=v-A*f,e[4]=-c*y,e[8]=M+E*f,e[1]=E+M*f,e[5]=c*g,e[9]=A-v*f,e[2]=-c*d,e[6]=f,e[10]=c*p}else if(t.order==="ZYX"){let v=c*g,E=c*y,M=f*g,A=f*y;e[0]=p*g,e[4]=M*d-E,e[8]=v*d+A,e[1]=p*y,e[5]=A*d+v,e[9]=E*d-M,e[2]=-d,e[6]=f*p,e[10]=c*p}else if(t.order==="YZX"){let v=c*p,E=c*d,M=f*p,A=f*d;e[0]=p*g,e[4]=A-v*y,e[8]=M*y+E,e[1]=y,e[5]=c*g,e[9]=-f*g,e[2]=-d*g,e[6]=E*y+M,e[10]=v-A*y}else if(t.order==="XZY"){let v=c*p,E=c*d,M=f*p,A=f*d;e[0]=p*g,e[4]=-y,e[8]=d*g,e[1]=v*y+A,e[5]=c*g,e[9]=E*y-M,e[2]=M*y-E,e[6]=f*g,e[10]=A*y+v}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(J6,t,j6)}lookAt(t,e,i){let s=this.elements;return Yi.subVectors(t,e),Yi.lengthSq()===0&&(Yi.z=1),Yi.normalize(),ua.crossVectors(i,Yi),ua.lengthSq()===0&&(Math.abs(i.z)===1?Yi.x+=1e-4:Yi.z+=1e-4,Yi.normalize(),ua.crossVectors(i,Yi)),ua.normalize(),fp.crossVectors(Yi,ua),s[0]=ua.x,s[4]=fp.x,s[8]=Yi.x,s[1]=ua.y,s[5]=fp.y,s[9]=Yi.y,s[2]=ua.z,s[6]=fp.z,s[10]=Yi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,u=this.elements,c=i[0],f=i[4],p=i[8],d=i[12],g=i[1],y=i[5],v=i[9],E=i[13],M=i[2],A=i[6],_=i[10],x=i[14],T=i[3],w=i[7],R=i[11],B=i[15],U=s[0],D=s[4],P=s[8],ct=s[12],L=s[1],W=s[5],V=s[9],Mt=s[13],$=s[2],gt=s[6],ft=s[10],vt=s[14],it=s[3],lt=s[7],H=s[11],At=s[15];return u[0]=c*U+f*L+p*$+d*it,u[4]=c*D+f*W+p*gt+d*lt,u[8]=c*P+f*V+p*ft+d*H,u[12]=c*ct+f*Mt+p*vt+d*At,u[1]=g*U+y*L+v*$+E*it,u[5]=g*D+y*W+v*gt+E*lt,u[9]=g*P+y*V+v*ft+E*H,u[13]=g*ct+y*Mt+v*vt+E*At,u[2]=M*U+A*L+_*$+x*it,u[6]=M*D+A*W+_*gt+x*lt,u[10]=M*P+A*V+_*ft+x*H,u[14]=M*ct+A*Mt+_*vt+x*At,u[3]=T*U+w*L+R*$+B*it,u[7]=T*D+w*W+R*gt+B*lt,u[11]=T*P+w*V+R*ft+B*H,u[15]=T*ct+w*Mt+R*vt+B*At,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],s=t[8],u=t[12],c=t[1],f=t[5],p=t[9],d=t[13],g=t[2],y=t[6],v=t[10],E=t[14],M=t[3],A=t[7],_=t[11],x=t[15];return M*(+u*p*y-s*d*y-u*f*v+i*d*v+s*f*E-i*p*E)+A*(+e*p*E-e*d*v+u*c*v-s*c*E+s*d*g-u*p*g)+_*(+e*d*y-e*f*E-u*c*y+i*c*E+u*f*g-i*d*g)+x*(-s*f*g-e*p*y+e*f*v+s*c*y-i*c*v+i*p*g)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],u=t[3],c=t[4],f=t[5],p=t[6],d=t[7],g=t[8],y=t[9],v=t[10],E=t[11],M=t[12],A=t[13],_=t[14],x=t[15],T=y*_*d-A*v*d+A*p*E-f*_*E-y*p*x+f*v*x,w=M*v*d-g*_*d-M*p*E+c*_*E+g*p*x-c*v*x,R=g*A*d-M*y*d+M*f*E-c*A*E-g*f*x+c*y*x,B=M*y*p-g*A*p-M*f*v+c*A*v+g*f*_-c*y*_,U=e*T+i*w+s*R+u*B;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/U;return t[0]=T*D,t[1]=(A*v*u-y*_*u-A*s*E+i*_*E+y*s*x-i*v*x)*D,t[2]=(f*_*u-A*p*u+A*s*d-i*_*d-f*s*x+i*p*x)*D,t[3]=(y*p*u-f*v*u-y*s*d+i*v*d+f*s*E-i*p*E)*D,t[4]=w*D,t[5]=(g*_*u-M*v*u+M*s*E-e*_*E-g*s*x+e*v*x)*D,t[6]=(M*p*u-c*_*u-M*s*d+e*_*d+c*s*x-e*p*x)*D,t[7]=(c*v*u-g*p*u+g*s*d-e*v*d-c*s*E+e*p*E)*D,t[8]=R*D,t[9]=(M*y*u-g*A*u-M*i*E+e*A*E+g*i*x-e*y*x)*D,t[10]=(c*A*u-M*f*u+M*i*d-e*A*d-c*i*x+e*f*x)*D,t[11]=(g*f*u-c*y*u-g*i*d+e*y*d+c*i*E-e*f*E)*D,t[12]=B*D,t[13]=(g*A*s-M*y*s+M*i*v-e*A*v-g*i*_+e*y*_)*D,t[14]=(M*f*s-c*A*s-M*i*p+e*A*p+c*i*_-e*f*_)*D,t[15]=(c*y*s-g*f*s+g*i*p-e*y*p-c*i*v+e*f*v)*D,this}scale(t){let e=this.elements,i=t.x,s=t.y,u=t.z;return e[0]*=i,e[4]*=s,e[8]*=u,e[1]*=i,e[5]*=s,e[9]*=u,e[2]*=i,e[6]*=s,e[10]*=u,e[3]*=i,e[7]*=s,e[11]*=u,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),u=1-i,c=t.x,f=t.y,p=t.z,d=u*c,g=u*f;return this.set(d*c+i,d*f-s*p,d*p+s*f,0,d*f+s*p,g*f+i,g*p-s*c,0,d*p-s*f,g*p+s*c,u*p*p+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,u,c){return this.set(1,i,u,0,t,1,c,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,u=e._x,c=e._y,f=e._z,p=e._w,d=u+u,g=c+c,y=f+f,v=u*d,E=u*g,M=u*y,A=c*g,_=c*y,x=f*y,T=p*d,w=p*g,R=p*y,B=i.x,U=i.y,D=i.z;return s[0]=(1-(A+x))*B,s[1]=(E+R)*B,s[2]=(M-w)*B,s[3]=0,s[4]=(E-R)*U,s[5]=(1-(v+x))*U,s[6]=(_+T)*U,s[7]=0,s[8]=(M+w)*D,s[9]=(_-T)*D,s[10]=(1-(v+A))*D,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements,u=ul.set(s[0],s[1],s[2]).length(),c=ul.set(s[4],s[5],s[6]).length(),f=ul.set(s[8],s[9],s[10]).length();this.determinant()<0&&(u=-u),t.x=s[12],t.y=s[13],t.z=s[14],Io.copy(this);let d=1/u,g=1/c,y=1/f;return Io.elements[0]*=d,Io.elements[1]*=d,Io.elements[2]*=d,Io.elements[4]*=g,Io.elements[5]*=g,Io.elements[6]*=g,Io.elements[8]*=y,Io.elements[9]*=y,Io.elements[10]*=y,e.setFromRotationMatrix(Io),i.x=u,i.y=c,i.z=f,this}makePerspective(t,e,i,s,u,c,f=Ds){let p=this.elements,d=2*u/(e-t),g=2*u/(i-s),y=(e+t)/(e-t),v=(i+s)/(i-s),E,M;if(f===Ds)E=-(c+u)/(c-u),M=-2*c*u/(c-u);else if(f===zp)E=-c/(c-u),M=-c*u/(c-u);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);return p[0]=d,p[4]=0,p[8]=y,p[12]=0,p[1]=0,p[5]=g,p[9]=v,p[13]=0,p[2]=0,p[6]=0,p[10]=E,p[14]=M,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,i,s,u,c,f=Ds){let p=this.elements,d=1/(e-t),g=1/(i-s),y=1/(c-u),v=(e+t)*d,E=(i+s)*g,M,A;if(f===Ds)M=(c+u)*y,A=-2*y;else if(f===zp)M=u*y,A=-1*y;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-v,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-E,p[2]=0,p[6]=0,p[10]=A,p[14]=-M,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},ul=new st,Io=new $n,J6=new st(0,0,0),j6=new st(1,1,1),ua=new st,fp=new st,Yi=new st,nI=new $n,rI=new lo,lu=class n{constructor(t=0,e=0,i=0,s=n.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let s=t.elements,u=s[0],c=s[4],f=s[8],p=s[1],d=s[5],g=s[9],y=s[2],v=s[6],E=s[10];switch(e){case"XYZ":this._y=Math.asin(ai(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-g,E),this._z=Math.atan2(-c,u)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ai(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(f,E),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-y,u),this._z=0);break;case"ZXY":this._x=Math.asin(ai(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-y,E),this._z=Math.atan2(-c,d)):(this._y=0,this._z=Math.atan2(p,u));break;case"ZYX":this._y=Math.asin(-ai(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(v,E),this._z=Math.atan2(p,u)):(this._x=0,this._z=Math.atan2(-c,d));break;case"YZX":this._z=Math.asin(ai(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-y,u)):(this._x=0,this._y=Math.atan2(f,E));break;case"XZY":this._z=Math.asin(-ai(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(f,u)):(this._x=Math.atan2(-g,E),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return nI.makeRotationFromQuaternion(t),this.setFromRotationMatrix(nI,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return rI.setFromEuler(this),this.setFromQuaternion(rI,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};lu.DEFAULT_ORDER="XYZ";var Hp=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},K6=0,iI=new st,ll=new lo,Cs=new $n,hp=new st,nf=new st,Q6=new st,t8=new lo,oI=new st(1,0,0),sI=new st(0,1,0),aI=new st(0,0,1),e8={type:"added"},n8={type:"removed"},Ly={type:"childadded",child:null},Ny={type:"childremoved",child:null},Oo=class n extends _a{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:K6++}),this.uuid=Fs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new st,e=new lu,i=new lo,s=new st(1,1,1);function u(){i.setFromEuler(e,!1)}function c(){e.setFromQuaternion(i,void 0,!1)}e._onChange(u),i._onChange(c),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new $n},normalMatrix:{value:new Ee}}),this.matrix=new $n,this.matrixWorld=new $n,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Hp,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ll.setFromAxisAngle(t,e),this.quaternion.multiply(ll),this}rotateOnWorldAxis(t,e){return ll.setFromAxisAngle(t,e),this.quaternion.premultiply(ll),this}rotateX(t){return this.rotateOnAxis(oI,t)}rotateY(t){return this.rotateOnAxis(sI,t)}rotateZ(t){return this.rotateOnAxis(aI,t)}translateOnAxis(t,e){return iI.copy(t).applyQuaternion(this.quaternion),this.position.add(iI.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(oI,t)}translateY(t){return this.translateOnAxis(sI,t)}translateZ(t){return this.translateOnAxis(aI,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Cs.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?hp.copy(t):hp.set(t,e,i);let s=this.parent;this.updateWorldMatrix(!0,!1),nf.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cs.lookAt(nf,hp,this.up):Cs.lookAt(hp,nf,this.up),this.quaternion.setFromRotationMatrix(Cs),s&&(Cs.extractRotation(s.matrixWorld),ll.setFromRotationMatrix(Cs),this.quaternion.premultiply(ll.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(e8),Ly.child=t,this.dispatchEvent(Ly),Ly.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(n8),Ny.child=t,this.dispatchEvent(Ny),Ny.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Cs.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Cs.multiply(t.parent.matrixWorld)),t.applyMatrix4(Cs),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){let c=this.children[i].getObjectByProperty(t,e);if(c!==void 0)return c}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let s=this.children;for(let u=0,c=s.length;u<c;u++)s[u].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(nf,t,Q6),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(nf,t8,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,s=e.length;i<s;i++){let u=e[i];(u.matrixWorldAutoUpdate===!0||t===!0)&&u.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let i=this.parent;if(t===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let s=this.children;for(let u=0,c=s.length;u<c;u++){let f=s[u];f.matrixWorldAutoUpdate===!0&&f.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(f=>({boxInitialized:f.boxInitialized,boxMin:f.box.min.toArray(),boxMax:f.box.max.toArray(),sphereInitialized:f.sphereInitialized,sphereRadius:f.sphere.radius,sphereCenter:f.sphere.center.toArray()})),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function u(f,p){return f[p.uuid]===void 0&&(f[p.uuid]=p.toJSON(t)),p.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=u(t.geometries,this.geometry);let f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let p=f.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let y=p[d];u(t.shapes,y)}else u(t.shapes,p)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(u(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let f=[];for(let p=0,d=this.material.length;p<d;p++)f.push(u(t.materials,this.material[p]));s.material=f}else s.material=u(t.materials,this.material);if(this.children.length>0){s.children=[];for(let f=0;f<this.children.length;f++)s.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let f=0;f<this.animations.length;f++){let p=this.animations[f];s.animations.push(u(t.animations,p))}}if(e){let f=c(t.geometries),p=c(t.materials),d=c(t.textures),g=c(t.images),y=c(t.shapes),v=c(t.skeletons),E=c(t.animations),M=c(t.nodes);f.length>0&&(i.geometries=f),p.length>0&&(i.materials=p),d.length>0&&(i.textures=d),g.length>0&&(i.images=g),y.length>0&&(i.shapes=y),v.length>0&&(i.skeletons=v),E.length>0&&(i.animations=E),M.length>0&&(i.nodes=M)}return i.object=s,i;function c(f){let p=[];for(let d in f){let g=f[d];delete g.metadata,p.push(g)}return p}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}};Oo.DEFAULT_UP=new st(0,1,0);Oo.DEFAULT_MATRIX_AUTO_UPDATE=!0;Oo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Po=new st,Is=new st,Oy=new st,Ps=new st,cl=new st,fl=new st,uI=new st,Dy=new st,Fy=new st,Uy=new st,iu=class n{constructor(t=new st,e=new st,i=new st){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),Po.subVectors(t,e),s.cross(Po);let u=s.lengthSq();return u>0?s.multiplyScalar(1/Math.sqrt(u)):s.set(0,0,0)}static getBarycoord(t,e,i,s,u){Po.subVectors(s,e),Is.subVectors(i,e),Oy.subVectors(t,e);let c=Po.dot(Po),f=Po.dot(Is),p=Po.dot(Oy),d=Is.dot(Is),g=Is.dot(Oy),y=c*d-f*f;if(y===0)return u.set(0,0,0),null;let v=1/y,E=(d*p-f*g)*v,M=(c*g-f*p)*v;return u.set(1-E-M,M,E)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,Ps)===null?!1:Ps.x>=0&&Ps.y>=0&&Ps.x+Ps.y<=1}static getInterpolation(t,e,i,s,u,c,f,p){return this.getBarycoord(t,e,i,s,Ps)===null?(p.x=0,p.y=0,"z"in p&&(p.z=0),"w"in p&&(p.w=0),null):(p.setScalar(0),p.addScaledVector(u,Ps.x),p.addScaledVector(c,Ps.y),p.addScaledVector(f,Ps.z),p)}static isFrontFacing(t,e,i,s){return Po.subVectors(i,e),Is.subVectors(t,e),Po.cross(Is).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Po.subVectors(this.c,this.b),Is.subVectors(this.a,this.b),Po.cross(Is).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return n.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return n.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,u){return n.getInterpolation(t,this.a,this.b,this.c,e,i,s,u)}containsPoint(t){return n.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return n.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i=this.a,s=this.b,u=this.c,c,f;cl.subVectors(s,i),fl.subVectors(u,i),Dy.subVectors(t,i);let p=cl.dot(Dy),d=fl.dot(Dy);if(p<=0&&d<=0)return e.copy(i);Fy.subVectors(t,s);let g=cl.dot(Fy),y=fl.dot(Fy);if(g>=0&&y<=g)return e.copy(s);let v=p*y-g*d;if(v<=0&&p>=0&&g<=0)return c=p/(p-g),e.copy(i).addScaledVector(cl,c);Uy.subVectors(t,u);let E=cl.dot(Uy),M=fl.dot(Uy);if(M>=0&&E<=M)return e.copy(u);let A=E*d-p*M;if(A<=0&&d>=0&&M<=0)return f=d/(d-M),e.copy(i).addScaledVector(fl,f);let _=g*M-E*y;if(_<=0&&y-g>=0&&E-M>=0)return uI.subVectors(u,s),f=(y-g)/(y-g+(E-M)),e.copy(s).addScaledVector(uI,f);let x=1/(_+A+v);return c=A*x,f=v*x,e.copy(i).addScaledVector(cl,c).addScaledVector(fl,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},rP={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},la={h:0,s:0,l:0},pp={h:0,s:0,l:0};function By(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}var Te=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Jo){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Rn.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=Rn.workingColorSpace){return this.r=t,this.g=e,this.b=i,Rn.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=Rn.workingColorSpace){if(t=H6(t,1),e=ai(e,0,1),i=ai(i,0,1),e===0)this.r=this.g=this.b=i;else{let u=i<=.5?i*(1+e):i+e-i*e,c=2*i-u;this.r=By(c,u,t+1/3),this.g=By(c,u,t),this.b=By(c,u,t-1/3)}return Rn.toWorkingColorSpace(this,s),this}setStyle(t,e=Jo){function i(u){u!==void 0&&parseFloat(u)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let u,c=s[1],f=s[2];switch(c){case"rgb":case"rgba":if(u=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return i(u[4]),this.setRGB(Math.min(255,parseInt(u[1],10))/255,Math.min(255,parseInt(u[2],10))/255,Math.min(255,parseInt(u[3],10))/255,e);if(u=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return i(u[4]),this.setRGB(Math.min(100,parseInt(u[1],10))/100,Math.min(100,parseInt(u[2],10))/100,Math.min(100,parseInt(u[3],10))/100,e);break;case"hsl":case"hsla":if(u=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return i(u[4]),this.setHSL(parseFloat(u[1])/360,parseFloat(u[2])/100,parseFloat(u[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let u=s[1],c=u.length;if(c===3)return this.setRGB(parseInt(u.charAt(0),16)/15,parseInt(u.charAt(1),16)/15,parseInt(u.charAt(2),16)/15,e);if(c===6)return this.setHex(parseInt(u,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Jo){let i=rP[t.toLowerCase()];return i!==void 0?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Al(t.r),this.g=Al(t.g),this.b=Al(t.b),this}copyLinearToSRGB(t){return this.r=My(t.r),this.g=My(t.g),this.b=My(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Jo){return Rn.fromWorkingColorSpace(si.copy(this),t),Math.round(ai(si.r*255,0,255))*65536+Math.round(ai(si.g*255,0,255))*256+Math.round(ai(si.b*255,0,255))}getHexString(t=Jo){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Rn.workingColorSpace){Rn.fromWorkingColorSpace(si.copy(this),e);let i=si.r,s=si.g,u=si.b,c=Math.max(i,s,u),f=Math.min(i,s,u),p,d,g=(f+c)/2;if(f===c)p=0,d=0;else{let y=c-f;switch(d=g<=.5?y/(c+f):y/(2-c-f),c){case i:p=(s-u)/y+(s<u?6:0);break;case s:p=(u-i)/y+2;break;case u:p=(i-s)/y+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=Rn.workingColorSpace){return Rn.fromWorkingColorSpace(si.copy(this),e),t.r=si.r,t.g=si.g,t.b=si.b,t}getStyle(t=Jo){Rn.fromWorkingColorSpace(si.copy(this),t);let e=si.r,i=si.g,s=si.b;return t!==Jo?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(t,e,i){return this.getHSL(la),this.setHSL(la.h+t,la.s+e,la.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(la),t.getHSL(pp);let i=Sy(la.h,pp.h,e),s=Sy(la.s,pp.s,e),u=Sy(la.l,pp.l,e);return this.setHSL(i,s,u),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,s=this.b,u=t.elements;return this.r=u[0]*e+u[3]*i+u[6]*s,this.g=u[1]*e+u[4]*i+u[7]*s,this.b=u[2]*e+u[5]*i+u[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},si=new Te;Te.NAMES=rP;var r8=0,cu=class extends _a{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:r8++}),this.uuid=Fs(),this.name="",this.type="Material",this.blending=bl,this.side=va,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=jy,this.blendDst=Ky,this.blendEquation=eu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Te(0,0,0),this.blendAlpha=0,this.depthFunc=Np,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ZC,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=rl,this.stencilZFail=rl,this.stencilZPass=rl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let i=t[e];if(i===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==bl&&(i.blending=this.blending),this.side!==va&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==jy&&(i.blendSrc=this.blendSrc),this.blendDst!==Ky&&(i.blendDst=this.blendDst),this.blendEquation!==eu&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Np&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ZC&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==rl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==rl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==rl&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(u){let c=[];for(let f in u){let p=u[f];delete p.metadata,c.push(p)}return c}if(e){let u=s(t.textures),c=s(t.images);u.length>0&&(i.textures=u),c.length>0&&(i.images=c)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(e!==null){let s=e.length;i=new Array(s);for(let u=0;u!==s;++u)i[u]=e[u].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Wp=class extends cu{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Te(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lu,this.combine=WI,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var pr=new st,dp=new Ot,Zn=class{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Os,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return nP("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,u=this.itemSize;s<u;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)dp.fromBufferAttribute(this,e),dp.applyMatrix3(t),this.setXY(e,dp.x,dp.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.applyMatrix3(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.applyMatrix4(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.applyNormalMatrix(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)pr.fromBufferAttribute(this,e),pr.transformDirection(t),this.setXYZ(e,pr.x,pr.y,pr.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Ko(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Pn(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ko(e,this.array)),e}setX(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ko(e,this.array)),e}setY(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ko(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ko(e,this.array)),e}setW(t,e){return this.normalized&&(e=Pn(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,u){return t*=this.itemSize,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array),u=Pn(u,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=u,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==rv&&(t.usage=this.usage),t}};var Xp=class extends Zn{constructor(t,e,i){super(new Uint16Array(t),e,i)}};var Yp=class extends Zn{constructor(t,e,i){super(new Uint32Array(t),e,i)}};var _r=class extends Zn{constructor(t,e,i){super(new Float32Array(t),e,i)}},i8=0,ao=new $n,zy=new Oo,hl=new st,$i=new Qo,rf=new Qo,Fr=new st,ui=class n extends _a{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:i8++}),this.uuid=Fs(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(eP(t)?Yp:Xp)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let u=new Ee().getNormalMatrix(t);i.applyNormalMatrix(u),i.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return ao.makeRotationFromQuaternion(t),this.applyMatrix4(ao),this}rotateX(t){return ao.makeRotationX(t),this.applyMatrix4(ao),this}rotateY(t){return ao.makeRotationY(t),this.applyMatrix4(ao),this}rotateZ(t){return ao.makeRotationZ(t),this.applyMatrix4(ao),this}translate(t,e,i){return ao.makeTranslation(t,e,i),this.applyMatrix4(ao),this}scale(t,e,i){return ao.makeScale(t,e,i),this.applyMatrix4(ao),this}lookAt(t){return zy.lookAt(t),zy.updateMatrix(),this.applyMatrix4(zy.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hl).negate(),this.translate(hl.x,hl.y,hl.z),this}setFromPoints(t){let e=[];for(let i=0,s=t.length;i<s;i++){let u=t[i];e.push(u.x,u.y,u.z||0)}return this.setAttribute("position",new _r(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qo);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new st(-1/0,-1/0,-1/0),new st(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){let u=e[i];$i.setFromBufferAttribute(u),this.morphTargetsRelative?(Fr.addVectors(this.boundingBox.min,$i.min),this.boundingBox.expandByPoint(Fr),Fr.addVectors(this.boundingBox.max,$i.max),this.boundingBox.expandByPoint(Fr)):(this.boundingBox.expandByPoint($i.min),this.boundingBox.expandByPoint($i.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new st,1/0);return}if(t){let i=this.boundingSphere.center;if($i.setFromBufferAttribute(t),e)for(let u=0,c=e.length;u<c;u++){let f=e[u];rf.setFromBufferAttribute(f),this.morphTargetsRelative?(Fr.addVectors($i.min,rf.min),$i.expandByPoint(Fr),Fr.addVectors($i.max,rf.max),$i.expandByPoint(Fr)):($i.expandByPoint(rf.min),$i.expandByPoint(rf.max))}$i.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Fr.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Fr));if(e)for(let u=0,c=e.length;u<c;u++){let f=e[u],p=this.morphTargetsRelative;for(let d=0,g=f.count;d<g;d++)Fr.fromBufferAttribute(f,d),p&&(hl.fromBufferAttribute(t,d),Fr.add(hl)),s=Math.max(s,i.distanceToSquared(Fr))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.position,s=e.normal,u=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Zn(new Float32Array(4*i.count),4));let c=this.getAttribute("tangent"),f=[],p=[];for(let P=0;P<i.count;P++)f[P]=new st,p[P]=new st;let d=new st,g=new st,y=new st,v=new Ot,E=new Ot,M=new Ot,A=new st,_=new st;function x(P,ct,L){d.fromBufferAttribute(i,P),g.fromBufferAttribute(i,ct),y.fromBufferAttribute(i,L),v.fromBufferAttribute(u,P),E.fromBufferAttribute(u,ct),M.fromBufferAttribute(u,L),g.sub(d),y.sub(d),E.sub(v),M.sub(v);let W=1/(E.x*M.y-M.x*E.y);isFinite(W)&&(A.copy(g).multiplyScalar(M.y).addScaledVector(y,-E.y).multiplyScalar(W),_.copy(y).multiplyScalar(E.x).addScaledVector(g,-M.x).multiplyScalar(W),f[P].add(A),f[ct].add(A),f[L].add(A),p[P].add(_),p[ct].add(_),p[L].add(_))}let T=this.groups;T.length===0&&(T=[{start:0,count:t.count}]);for(let P=0,ct=T.length;P<ct;++P){let L=T[P],W=L.start,V=L.count;for(let Mt=W,$=W+V;Mt<$;Mt+=3)x(t.getX(Mt+0),t.getX(Mt+1),t.getX(Mt+2))}let w=new st,R=new st,B=new st,U=new st;function D(P){B.fromBufferAttribute(s,P),U.copy(B);let ct=f[P];w.copy(ct),w.sub(B.multiplyScalar(B.dot(ct))).normalize(),R.crossVectors(U,ct);let W=R.dot(p[P])<0?-1:1;c.setXYZW(P,w.x,w.y,w.z,W)}for(let P=0,ct=T.length;P<ct;++P){let L=T[P],W=L.start,V=L.count;for(let Mt=W,$=W+V;Mt<$;Mt+=3)D(t.getX(Mt+0)),D(t.getX(Mt+1)),D(t.getX(Mt+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Zn(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let v=0,E=i.count;v<E;v++)i.setXYZ(v,0,0,0);let s=new st,u=new st,c=new st,f=new st,p=new st,d=new st,g=new st,y=new st;if(t)for(let v=0,E=t.count;v<E;v+=3){let M=t.getX(v+0),A=t.getX(v+1),_=t.getX(v+2);s.fromBufferAttribute(e,M),u.fromBufferAttribute(e,A),c.fromBufferAttribute(e,_),g.subVectors(c,u),y.subVectors(s,u),g.cross(y),f.fromBufferAttribute(i,M),p.fromBufferAttribute(i,A),d.fromBufferAttribute(i,_),f.add(g),p.add(g),d.add(g),i.setXYZ(M,f.x,f.y,f.z),i.setXYZ(A,p.x,p.y,p.z),i.setXYZ(_,d.x,d.y,d.z)}else for(let v=0,E=e.count;v<E;v+=3)s.fromBufferAttribute(e,v+0),u.fromBufferAttribute(e,v+1),c.fromBufferAttribute(e,v+2),g.subVectors(c,u),y.subVectors(s,u),g.cross(y),i.setXYZ(v+0,g.x,g.y,g.z),i.setXYZ(v+1,g.x,g.y,g.z),i.setXYZ(v+2,g.x,g.y,g.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Fr.fromBufferAttribute(t,e),Fr.normalize(),t.setXYZ(e,Fr.x,Fr.y,Fr.z)}toNonIndexed(){function t(f,p){let d=f.array,g=f.itemSize,y=f.normalized,v=new d.constructor(p.length*g),E=0,M=0;for(let A=0,_=p.length;A<_;A++){f.isInterleavedBufferAttribute?E=p[A]*f.data.stride+f.offset:E=p[A]*g;for(let x=0;x<g;x++)v[M++]=d[E++]}return new Zn(v,g,y)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new n,i=this.index.array,s=this.attributes;for(let f in s){let p=s[f],d=t(p,i);e.setAttribute(f,d)}let u=this.morphAttributes;for(let f in u){let p=[],d=u[f];for(let g=0,y=d.length;g<y;g++){let v=d[g],E=t(v,i);p.push(E)}e.morphAttributes[f]=p}e.morphTargetsRelative=this.morphTargetsRelative;let c=this.groups;for(let f=0,p=c.length;f<p;f++){let d=c[f];e.addGroup(d.start,d.count,d.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let p in i){let d=i[p];t.data.attributes[p]=d.toJSON(t.data)}let s={},u=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let y=0,v=d.length;y<v;y++){let E=d[y];g.push(E.toJSON(t.data))}g.length>0&&(s[p]=g,u=!0)}u&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let c=this.groups;c.length>0&&(t.data.groups=JSON.parse(JSON.stringify(c)));let f=this.boundingSphere;return f!==null&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone(e));let s=t.attributes;for(let d in s){let g=s[d];this.setAttribute(d,g.clone(e))}let u=t.morphAttributes;for(let d in u){let g=[],y=u[d];for(let v=0,E=y.length;v<E;v++)g.push(y[v].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let c=t.groups;for(let d=0,g=c.length;d<g;d++){let y=c[d];this.addGroup(y.start,y.count,y.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},lI=new $n,Ja=new lv,gp=new uu,cI=new st,pl=new st,dl=new st,gl=new st,Gy=new st,mp=new st,yp=new Ot,vp=new Ot,_p=new Ot,fI=new st,hI=new st,pI=new st,xp=new st,Ep=new st,No=class extends Oo{constructor(t=new ui,e=new Wp){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){let s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,c=s.length;u<c;u++){let f=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=u}}}}getVertexPosition(t,e){let i=this.geometry,s=i.attributes.position,u=i.morphAttributes.position,c=i.morphTargetsRelative;e.fromBufferAttribute(s,t);let f=this.morphTargetInfluences;if(u&&f){mp.set(0,0,0);for(let p=0,d=u.length;p<d;p++){let g=f[p],y=u[p];g!==0&&(Gy.fromBufferAttribute(y,t),c?mp.addScaledVector(Gy,g):mp.addScaledVector(Gy.sub(e),g))}e.add(mp)}return e}raycast(t,e){let i=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),gp.copy(i.boundingSphere),gp.applyMatrix4(u),Ja.copy(t.ray).recast(t.near),!(gp.containsPoint(Ja.origin)===!1&&(Ja.intersectSphere(gp,cI)===null||Ja.origin.distanceToSquared(cI)>(t.far-t.near)**2))&&(lI.copy(u).invert(),Ja.copy(t.ray).applyMatrix4(lI),!(i.boundingBox!==null&&Ja.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Ja)))}_computeIntersections(t,e,i){let s,u=this.geometry,c=this.material,f=u.index,p=u.attributes.position,d=u.attributes.uv,g=u.attributes.uv1,y=u.attributes.normal,v=u.groups,E=u.drawRange;if(f!==null)if(Array.isArray(c))for(let M=0,A=v.length;M<A;M++){let _=v[M],x=c[_.materialIndex],T=Math.max(_.start,E.start),w=Math.min(f.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,B=w;R<B;R+=3){let U=f.getX(R),D=f.getX(R+1),P=f.getX(R+2);s=Sp(this,x,t,i,d,g,y,U,D,P),s&&(s.faceIndex=Math.floor(R/3),s.face.materialIndex=_.materialIndex,e.push(s))}}else{let M=Math.max(0,E.start),A=Math.min(f.count,E.start+E.count);for(let _=M,x=A;_<x;_+=3){let T=f.getX(_),w=f.getX(_+1),R=f.getX(_+2);s=Sp(this,c,t,i,d,g,y,T,w,R),s&&(s.faceIndex=Math.floor(_/3),e.push(s))}}else if(p!==void 0)if(Array.isArray(c))for(let M=0,A=v.length;M<A;M++){let _=v[M],x=c[_.materialIndex],T=Math.max(_.start,E.start),w=Math.min(p.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,B=w;R<B;R+=3){let U=R,D=R+1,P=R+2;s=Sp(this,x,t,i,d,g,y,U,D,P),s&&(s.faceIndex=Math.floor(R/3),s.face.materialIndex=_.materialIndex,e.push(s))}}else{let M=Math.max(0,E.start),A=Math.min(p.count,E.start+E.count);for(let _=M,x=A;_<x;_+=3){let T=_,w=_+1,R=_+2;s=Sp(this,c,t,i,d,g,y,T,w,R),s&&(s.faceIndex=Math.floor(_/3),e.push(s))}}}};function o8(n,t,e,i,s,u,c,f){let p;if(t.side===Oi?p=i.intersectTriangle(c,u,s,!0,f):p=i.intersectTriangle(s,u,c,t.side===va,f),p===null)return null;Ep.copy(f),Ep.applyMatrix4(n.matrixWorld);let d=e.ray.origin.distanceTo(Ep);return d<e.near||d>e.far?null:{distance:d,point:Ep.clone(),object:n}}function Sp(n,t,e,i,s,u,c,f,p,d){n.getVertexPosition(f,pl),n.getVertexPosition(p,dl),n.getVertexPosition(d,gl);let g=o8(n,t,e,i,pl,dl,gl,xp);if(g){s&&(yp.fromBufferAttribute(s,f),vp.fromBufferAttribute(s,p),_p.fromBufferAttribute(s,d),g.uv=iu.getInterpolation(xp,pl,dl,gl,yp,vp,_p,new Ot)),u&&(yp.fromBufferAttribute(u,f),vp.fromBufferAttribute(u,p),_p.fromBufferAttribute(u,d),g.uv1=iu.getInterpolation(xp,pl,dl,gl,yp,vp,_p,new Ot)),c&&(fI.fromBufferAttribute(c,f),hI.fromBufferAttribute(c,p),pI.fromBufferAttribute(c,d),g.normal=iu.getInterpolation(xp,pl,dl,gl,fI,hI,pI,new st),g.normal.dot(i.direction)>0&&g.normal.multiplyScalar(-1));let y={a:f,b:p,c:d,normal:new st,materialIndex:0};iu.getNormal(pl,dl,gl,y.normal),g.face=y}return g}var hf=class n extends ui{constructor(t=1,e=1,i=1,s=1,u=1,c=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:u,depthSegments:c};let f=this;s=Math.floor(s),u=Math.floor(u),c=Math.floor(c);let p=[],d=[],g=[],y=[],v=0,E=0;M("z","y","x",-1,-1,i,e,t,c,u,0),M("z","y","x",1,-1,i,e,-t,c,u,1),M("x","z","y",1,1,t,i,e,s,c,2),M("x","z","y",1,-1,t,i,-e,s,c,3),M("x","y","z",1,-1,t,e,i,s,u,4),M("x","y","z",-1,-1,t,e,-i,s,u,5),this.setIndex(p),this.setAttribute("position",new _r(d,3)),this.setAttribute("normal",new _r(g,3)),this.setAttribute("uv",new _r(y,2));function M(A,_,x,T,w,R,B,U,D,P,ct){let L=R/D,W=B/P,V=R/2,Mt=B/2,$=U/2,gt=D+1,ft=P+1,vt=0,it=0,lt=new st;for(let H=0;H<ft;H++){let At=H*W-Mt;for(let It=0;It<gt;It++){let Kt=It*L-V;lt[A]=Kt*T,lt[_]=At*w,lt[x]=$,d.push(lt.x,lt.y,lt.z),lt[A]=0,lt[_]=0,lt[x]=U>0?1:-1,g.push(lt.x,lt.y,lt.z),y.push(It/D),y.push(1-H/P),vt+=1}}for(let H=0;H<P;H++)for(let At=0;At<D;At++){let It=v+At+gt*H,Kt=v+At+gt*(H+1),nt=v+(At+1)+gt*(H+1),bt=v+(At+1)+gt*H;p.push(It,Kt,bt),p.push(Kt,nt,bt),it+=6}f.addGroup(E,it,ct),E+=it,v+=vt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Rl(n){let t={};for(let e in n){t[e]={};for(let i in n[e]){let s=n[e][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][i]=null):t[e][i]=s.clone():Array.isArray(s)?t[e][i]=s.slice():t[e][i]=s}}return t}function Mi(n){let t={};for(let e=0;e<n.length;e++){let i=Rl(n[e]);for(let s in i)t[s]=i[s]}return t}function s8(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function iP(n){return n.getRenderTarget()===null?n.outputColorSpace:Rn.workingColorSpace}var a8={clone:Rl,merge:Mi},u8=`void main() {
8
8
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9
9
  }`,l8=`void main() {
10
10
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
11
- }`,Qo=class extends cu{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=u8,this.fragmentShader=l8,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Rl(t.uniforms),this.uniformsGroups=s8(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let c=this.uniforms[s].value;c&&c.isTexture?e.uniforms[s]={type:"t",value:c.toJSON(t).uuid}:c&&c.isColor?e.uniforms[s]={type:"c",value:c.getHex()}:c&&c.isVector2?e.uniforms[s]={type:"v2",value:c.toArray()}:c&&c.isVector3?e.uniforms[s]={type:"v3",value:c.toArray()}:c&&c.isVector4?e.uniforms[s]={type:"v4",value:c.toArray()}:c&&c.isMatrix3?e.uniforms[s]={type:"m3",value:c.toArray()}:c&&c.isMatrix4?e.uniforms[s]={type:"m4",value:c.toArray()}:e.uniforms[s]={value:c}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}},$p=class extends Oo{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new $n,this.projectionMatrix=new $n,this.projectionMatrixInverse=new $n,this.coordinateSystem=Ds}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},ca=new st,dI=new Ot,gI=new Ot,Zi=class extends $p{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=ov*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Ey*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return ov*2*Math.atan(Math.tan(Ey*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){ca.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(ca.x,ca.y).multiplyScalar(-t/ca.z),ca.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ca.x,ca.y).multiplyScalar(-t/ca.z)}getViewSize(t,e){return this.getViewBounds(t,dI,gI),e.subVectors(gI,dI)}setViewOffset(t,e,i,s,u,c){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=u,this.view.height=c,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Ey*.5*this.fov)/this.zoom,i=2*e,s=this.aspect*i,u=-.5*s,c=this.view;if(this.view!==null&&this.view.enabled){let p=c.fullWidth,d=c.fullHeight;u+=c.offsetX*s/p,e-=c.offsetY*i/d,s*=c.width/p,i*=c.height/d}let f=this.filmOffset;f!==0&&(u+=t*f/this.getFilmWidth()),this.projectionMatrix.makePerspective(u,u+s,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},ml=-90,yl=1,cv=class extends Oo{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new Zi(ml,yl,t,e);s.layers=this.layers,this.add(s);let u=new Zi(ml,yl,t,e);u.layers=this.layers,this.add(u);let c=new Zi(ml,yl,t,e);c.layers=this.layers,this.add(c);let f=new Zi(ml,yl,t,e);f.layers=this.layers,this.add(f);let p=new Zi(ml,yl,t,e);p.layers=this.layers,this.add(p);let d=new Zi(ml,yl,t,e);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,u,c,f,p]=e;for(let d of e)this.remove(d);if(t===Ds)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),u.up.set(0,0,-1),u.lookAt(0,1,0),c.up.set(0,0,1),c.lookAt(0,-1,0),f.up.set(0,1,0),f.lookAt(0,0,1),p.up.set(0,1,0),p.lookAt(0,0,-1);else if(t===zp)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),u.up.set(0,0,1),u.lookAt(0,1,0),c.up.set(0,0,-1),c.lookAt(0,-1,0),f.up.set(0,-1,0),f.lookAt(0,0,1),p.up.set(0,-1,0),p.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let d of e)this.add(d),d.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[u,c,f,p,d,g]=this.children,y=t.getRenderTarget(),v=t.getActiveCubeFace(),E=t.getActiveMipmapLevel(),M=t.xr.enabled;t.xr.enabled=!1;let A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,u),t.setRenderTarget(i,1,s),t.render(e,c),t.setRenderTarget(i,2,s),t.render(e,f),t.setRenderTarget(i,3,s),t.render(e,p),t.setRenderTarget(i,4,s),t.render(e,d),i.texture.generateMipmaps=A,t.setRenderTarget(i,5,s),t.render(e,g),t.setRenderTarget(y,v,E),t.xr.enabled=M,i.texture.needsPMREMUpdate=!0}},Zp=class extends uo{constructor(t,e,i,s,u,c,f,p,d,g){t=t!==void 0?t:[],e=e!==void 0?e:Cl,super(t,e,i,s,u,c,f,p,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},fv=class extends Us{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let i={width:t,height:t,depth:1},s=[i,i,i,i,i,i];this.texture=new Zp(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Ni}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
11
+ }`,ts=class extends cu{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=u8,this.fragmentShader=l8,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Rl(t.uniforms),this.uniformsGroups=s8(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let c=this.uniforms[s].value;c&&c.isTexture?e.uniforms[s]={type:"t",value:c.toJSON(t).uuid}:c&&c.isColor?e.uniforms[s]={type:"c",value:c.getHex()}:c&&c.isVector2?e.uniforms[s]={type:"v2",value:c.toArray()}:c&&c.isVector3?e.uniforms[s]={type:"v3",value:c.toArray()}:c&&c.isVector4?e.uniforms[s]={type:"v4",value:c.toArray()}:c&&c.isMatrix3?e.uniforms[s]={type:"m3",value:c.toArray()}:c&&c.isMatrix4?e.uniforms[s]={type:"m4",value:c.toArray()}:e.uniforms[s]={value:c}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}},$p=class extends Oo{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new $n,this.projectionMatrix=new $n,this.projectionMatrixInverse=new $n,this.coordinateSystem=Ds}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},ca=new st,dI=new Ot,gI=new Ot,Zi=class extends $p{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=ov*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Ey*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return ov*2*Math.atan(Math.tan(Ey*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){ca.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(ca.x,ca.y).multiplyScalar(-t/ca.z),ca.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ca.x,ca.y).multiplyScalar(-t/ca.z)}getViewSize(t,e){return this.getViewBounds(t,dI,gI),e.subVectors(gI,dI)}setViewOffset(t,e,i,s,u,c){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=u,this.view.height=c,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Ey*.5*this.fov)/this.zoom,i=2*e,s=this.aspect*i,u=-.5*s,c=this.view;if(this.view!==null&&this.view.enabled){let p=c.fullWidth,d=c.fullHeight;u+=c.offsetX*s/p,e-=c.offsetY*i/d,s*=c.width/p,i*=c.height/d}let f=this.filmOffset;f!==0&&(u+=t*f/this.getFilmWidth()),this.projectionMatrix.makePerspective(u,u+s,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},ml=-90,yl=1,cv=class extends Oo{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new Zi(ml,yl,t,e);s.layers=this.layers,this.add(s);let u=new Zi(ml,yl,t,e);u.layers=this.layers,this.add(u);let c=new Zi(ml,yl,t,e);c.layers=this.layers,this.add(c);let f=new Zi(ml,yl,t,e);f.layers=this.layers,this.add(f);let p=new Zi(ml,yl,t,e);p.layers=this.layers,this.add(p);let d=new Zi(ml,yl,t,e);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,u,c,f,p]=e;for(let d of e)this.remove(d);if(t===Ds)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),u.up.set(0,0,-1),u.lookAt(0,1,0),c.up.set(0,0,1),c.lookAt(0,-1,0),f.up.set(0,1,0),f.lookAt(0,0,1),p.up.set(0,1,0),p.lookAt(0,0,-1);else if(t===zp)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),u.up.set(0,0,1),u.lookAt(0,1,0),c.up.set(0,0,-1),c.lookAt(0,-1,0),f.up.set(0,-1,0),f.lookAt(0,0,1),p.up.set(0,-1,0),p.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let d of e)this.add(d),d.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[u,c,f,p,d,g]=this.children,y=t.getRenderTarget(),v=t.getActiveCubeFace(),E=t.getActiveMipmapLevel(),M=t.xr.enabled;t.xr.enabled=!1;let A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,u),t.setRenderTarget(i,1,s),t.render(e,c),t.setRenderTarget(i,2,s),t.render(e,f),t.setRenderTarget(i,3,s),t.render(e,p),t.setRenderTarget(i,4,s),t.render(e,d),i.texture.generateMipmaps=A,t.setRenderTarget(i,5,s),t.render(e,g),t.setRenderTarget(y,v,E),t.xr.enabled=M,i.texture.needsPMREMUpdate=!0}},Zp=class extends uo{constructor(t,e,i,s,u,c,f,p,d,g){t=t!==void 0?t:[],e=e!==void 0?e:Cl,super(t,e,i,s,u,c,f,p,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},fv=class extends Us{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let i={width:t,height:t,depth:1},s=[i,i,i,i,i,i];this.texture=new Zp(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Ni}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
12
12
 
13
13
  varying vec3 vWorldDirection;
14
14
 
@@ -43,7 +43,7 @@ var $D=Object.create;var U1=Object.defineProperty;var ZD=Object.getOwnPropertyDe
43
43
  gl_FragColor = texture2D( tEquirect, sampleUV );
44
44
 
45
45
  }
46
- `},s=new hf(5,5,5),u=new Qo({name:"CubemapFromEquirect",uniforms:Rl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Oi,blending:da});u.uniforms.tEquirect.value=e;let c=new No(s,u),f=e.minFilter;return e.minFilter===ru&&(e.minFilter=Ni),new cv(1,10,this).update(t,c),e.minFilter=f,c.geometry.dispose(),c.material.dispose(),this}clear(t,e,i,s){let u=t.getRenderTarget();for(let c=0;c<6;c++)t.setRenderTarget(this,c),t.clear(e,i,s);t.setRenderTarget(u)}},ky=new st,c8=new st,f8=new Ee,Ls=class{constructor(t=new st(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let s=ky.subVectors(i,e).cross(c8.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let i=t.delta(ky),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let u=-(t.start.dot(this.normal)+this.constant)/s;return u<0||u>1?null:e.copy(t.start).addScaledVector(i,u)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||f8.getNormalMatrix(t),s=this.coplanarPoint(ky).applyMatrix4(t),u=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(u),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},ja=new uu,wp=new st,Jp=class{constructor(t=new Ls,e=new Ls,i=new Ls,s=new Ls,u=new Ls,c=new Ls){this.planes=[t,e,i,s,u,c]}set(t,e,i,s,u,c){let f=this.planes;return f[0].copy(t),f[1].copy(e),f[2].copy(i),f[3].copy(s),f[4].copy(u),f[5].copy(c),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=Ds){let i=this.planes,s=t.elements,u=s[0],c=s[1],f=s[2],p=s[3],d=s[4],g=s[5],y=s[6],v=s[7],E=s[8],M=s[9],A=s[10],_=s[11],x=s[12],T=s[13],w=s[14],R=s[15];if(i[0].setComponents(p-u,v-d,_-E,R-x).normalize(),i[1].setComponents(p+u,v+d,_+E,R+x).normalize(),i[2].setComponents(p+c,v+g,_+M,R+T).normalize(),i[3].setComponents(p-c,v-g,_-M,R-T).normalize(),i[4].setComponents(p-f,v-y,_-A,R-w).normalize(),e===Ds)i[5].setComponents(p+f,v+y,_+A,R+w).normalize();else if(e===zp)i[5].setComponents(f,y,A,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ja.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),ja.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ja)}intersectsSprite(t){return ja.center.set(0,0,0),ja.radius=.7071067811865476,ja.applyMatrix4(t.matrixWorld),this.intersectsSphere(ja)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let u=0;u<6;u++)if(e[u].distanceToPoint(i)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let s=e[i];if(wp.x=s.normal.x>0?t.max.x:t.min.x,wp.y=s.normal.y>0?t.max.y:t.min.y,wp.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(wp)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function oP(){let n=null,t=!1,e=null,i=null;function s(u,c){e(u,c),i=n.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&(i=n.requestAnimationFrame(s),t=!0)},stop:function(){n.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(u){e=u},setContext:function(u){n=u}}}function h8(n,t){let e=t.isWebGL2,i=new WeakMap;function s(d,g){let y=d.array,v=d.usage,E=y.byteLength,M=n.createBuffer();n.bindBuffer(g,M),n.bufferData(g,y,v),d.onUploadCallback();let A;if(y instanceof Float32Array)A=n.FLOAT;else if(y instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)A=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else A=n.UNSIGNED_SHORT;else if(y instanceof Int16Array)A=n.SHORT;else if(y instanceof Uint32Array)A=n.UNSIGNED_INT;else if(y instanceof Int32Array)A=n.INT;else if(y instanceof Int8Array)A=n.BYTE;else if(y instanceof Uint8Array)A=n.UNSIGNED_BYTE;else if(y instanceof Uint8ClampedArray)A=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+y);return{buffer:M,type:A,bytesPerElement:y.BYTES_PER_ELEMENT,version:d.version,size:E}}function u(d,g,y){let v=g.array,E=g._updateRange,M=g.updateRanges;if(n.bindBuffer(y,d),E.count===-1&&M.length===0&&n.bufferSubData(y,0,v),M.length!==0){for(let A=0,_=M.length;A<_;A++){let x=M[A];e?n.bufferSubData(y,x.start*v.BYTES_PER_ELEMENT,v,x.start,x.count):n.bufferSubData(y,x.start*v.BYTES_PER_ELEMENT,v.subarray(x.start,x.start+x.count))}g.clearUpdateRanges()}E.count!==-1&&(e?n.bufferSubData(y,E.offset*v.BYTES_PER_ELEMENT,v,E.offset,E.count):n.bufferSubData(y,E.offset*v.BYTES_PER_ELEMENT,v.subarray(E.offset,E.offset+E.count)),E.count=-1),g.onUploadCallback()}function c(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function f(d){d.isInterleavedBufferAttribute&&(d=d.data);let g=i.get(d);g&&(n.deleteBuffer(g.buffer),i.delete(d))}function p(d,g){if(d.isGLBufferAttribute){let v=i.get(d);(!v||v.version<d.version)&&i.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);let y=i.get(d);if(y===void 0)i.set(d,s(d,g));else if(y.version<d.version){if(y.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");u(y.buffer,d,g),y.version=d.version}}return{get:c,remove:f,update:p}}var jp=class n extends ui{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};let u=t/2,c=e/2,f=Math.floor(i),p=Math.floor(s),d=f+1,g=p+1,y=t/f,v=e/p,E=[],M=[],A=[],_=[];for(let x=0;x<g;x++){let T=x*v-c;for(let w=0;w<d;w++){let R=w*y-u;M.push(R,-T,0),A.push(0,0,1),_.push(w/f),_.push(1-x/p)}}for(let x=0;x<p;x++)for(let T=0;T<f;T++){let w=T+d*x,R=T+d*(x+1),B=T+1+d*(x+1),U=T+1+d*x;E.push(w,R,U),E.push(R,B,U)}this.setIndex(E),this.setAttribute("position",new _r(M,3)),this.setAttribute("normal",new _r(A,3)),this.setAttribute("uv",new _r(_,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.widthSegments,t.heightSegments)}},p8=`#ifdef USE_ALPHAHASH
46
+ `},s=new hf(5,5,5),u=new ts({name:"CubemapFromEquirect",uniforms:Rl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Oi,blending:da});u.uniforms.tEquirect.value=e;let c=new No(s,u),f=e.minFilter;return e.minFilter===ru&&(e.minFilter=Ni),new cv(1,10,this).update(t,c),e.minFilter=f,c.geometry.dispose(),c.material.dispose(),this}clear(t,e,i,s){let u=t.getRenderTarget();for(let c=0;c<6;c++)t.setRenderTarget(this,c),t.clear(e,i,s);t.setRenderTarget(u)}},ky=new st,c8=new st,f8=new Ee,Ls=class{constructor(t=new st(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let s=ky.subVectors(i,e).cross(c8.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let i=t.delta(ky),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let u=-(t.start.dot(this.normal)+this.constant)/s;return u<0||u>1?null:e.copy(t.start).addScaledVector(i,u)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||f8.getNormalMatrix(t),s=this.coplanarPoint(ky).applyMatrix4(t),u=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(u),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},ja=new uu,wp=new st,Jp=class{constructor(t=new Ls,e=new Ls,i=new Ls,s=new Ls,u=new Ls,c=new Ls){this.planes=[t,e,i,s,u,c]}set(t,e,i,s,u,c){let f=this.planes;return f[0].copy(t),f[1].copy(e),f[2].copy(i),f[3].copy(s),f[4].copy(u),f[5].copy(c),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=Ds){let i=this.planes,s=t.elements,u=s[0],c=s[1],f=s[2],p=s[3],d=s[4],g=s[5],y=s[6],v=s[7],E=s[8],M=s[9],A=s[10],_=s[11],x=s[12],T=s[13],w=s[14],R=s[15];if(i[0].setComponents(p-u,v-d,_-E,R-x).normalize(),i[1].setComponents(p+u,v+d,_+E,R+x).normalize(),i[2].setComponents(p+c,v+g,_+M,R+T).normalize(),i[3].setComponents(p-c,v-g,_-M,R-T).normalize(),i[4].setComponents(p-f,v-y,_-A,R-w).normalize(),e===Ds)i[5].setComponents(p+f,v+y,_+A,R+w).normalize();else if(e===zp)i[5].setComponents(f,y,A,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ja.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),ja.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ja)}intersectsSprite(t){return ja.center.set(0,0,0),ja.radius=.7071067811865476,ja.applyMatrix4(t.matrixWorld),this.intersectsSphere(ja)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let u=0;u<6;u++)if(e[u].distanceToPoint(i)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let s=e[i];if(wp.x=s.normal.x>0?t.max.x:t.min.x,wp.y=s.normal.y>0?t.max.y:t.min.y,wp.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(wp)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function oP(){let n=null,t=!1,e=null,i=null;function s(u,c){e(u,c),i=n.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&(i=n.requestAnimationFrame(s),t=!0)},stop:function(){n.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(u){e=u},setContext:function(u){n=u}}}function h8(n,t){let e=t.isWebGL2,i=new WeakMap;function s(d,g){let y=d.array,v=d.usage,E=y.byteLength,M=n.createBuffer();n.bindBuffer(g,M),n.bufferData(g,y,v),d.onUploadCallback();let A;if(y instanceof Float32Array)A=n.FLOAT;else if(y instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)A=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else A=n.UNSIGNED_SHORT;else if(y instanceof Int16Array)A=n.SHORT;else if(y instanceof Uint32Array)A=n.UNSIGNED_INT;else if(y instanceof Int32Array)A=n.INT;else if(y instanceof Int8Array)A=n.BYTE;else if(y instanceof Uint8Array)A=n.UNSIGNED_BYTE;else if(y instanceof Uint8ClampedArray)A=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+y);return{buffer:M,type:A,bytesPerElement:y.BYTES_PER_ELEMENT,version:d.version,size:E}}function u(d,g,y){let v=g.array,E=g._updateRange,M=g.updateRanges;if(n.bindBuffer(y,d),E.count===-1&&M.length===0&&n.bufferSubData(y,0,v),M.length!==0){for(let A=0,_=M.length;A<_;A++){let x=M[A];e?n.bufferSubData(y,x.start*v.BYTES_PER_ELEMENT,v,x.start,x.count):n.bufferSubData(y,x.start*v.BYTES_PER_ELEMENT,v.subarray(x.start,x.start+x.count))}g.clearUpdateRanges()}E.count!==-1&&(e?n.bufferSubData(y,E.offset*v.BYTES_PER_ELEMENT,v,E.offset,E.count):n.bufferSubData(y,E.offset*v.BYTES_PER_ELEMENT,v.subarray(E.offset,E.offset+E.count)),E.count=-1),g.onUploadCallback()}function c(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function f(d){d.isInterleavedBufferAttribute&&(d=d.data);let g=i.get(d);g&&(n.deleteBuffer(g.buffer),i.delete(d))}function p(d,g){if(d.isGLBufferAttribute){let v=i.get(d);(!v||v.version<d.version)&&i.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);let y=i.get(d);if(y===void 0)i.set(d,s(d,g));else if(y.version<d.version){if(y.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");u(y.buffer,d,g),y.version=d.version}}return{get:c,remove:f,update:p}}var jp=class n extends ui{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};let u=t/2,c=e/2,f=Math.floor(i),p=Math.floor(s),d=f+1,g=p+1,y=t/f,v=e/p,E=[],M=[],A=[],_=[];for(let x=0;x<g;x++){let T=x*v-c;for(let w=0;w<d;w++){let R=w*y-u;M.push(R,-T,0),A.push(0,0,1),_.push(w/f),_.push(1-x/p)}}for(let x=0;x<p;x++)for(let T=0;T<f;T++){let w=T+d*x,R=T+d*(x+1),B=T+1+d*(x+1),U=T+1+d*x;E.push(w,R,U),E.push(R,B,U)}this.setIndex(E),this.setAttribute("position",new _r(M,3)),this.setAttribute("normal",new _r(A,3)),this.setAttribute("uv",new _r(_,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.widthSegments,t.heightSegments)}},p8=`#ifdef USE_ALPHAHASH
47
47
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
48
48
  #endif`,d8=`#ifdef USE_ALPHAHASH
49
49
  const float ALPHA_HASH_SCALE = 0.05;
@@ -3550,7 +3550,7 @@ void main() {
3550
3550
  #include <tonemapping_fragment>
3551
3551
  #include <colorspace_fragment>
3552
3552
  #include <fog_fragment>
3553
- }`,Se={alphahash_fragment:p8,alphahash_pars_fragment:d8,alphamap_fragment:g8,alphamap_pars_fragment:m8,alphatest_fragment:y8,alphatest_pars_fragment:v8,aomap_fragment:_8,aomap_pars_fragment:x8,batching_pars_vertex:E8,batching_vertex:S8,begin_vertex:w8,beginnormal_vertex:M8,bsdfs:b8,iridescence_fragment:A8,bumpmap_pars_fragment:T8,clipping_planes_fragment:C8,clipping_planes_pars_fragment:I8,clipping_planes_pars_vertex:P8,clipping_planes_vertex:R8,color_fragment:L8,color_pars_fragment:N8,color_pars_vertex:O8,color_vertex:D8,common:F8,cube_uv_reflection_fragment:U8,defaultnormal_vertex:B8,displacementmap_pars_vertex:z8,displacementmap_vertex:G8,emissivemap_fragment:k8,emissivemap_pars_fragment:q8,colorspace_fragment:V8,colorspace_pars_fragment:H8,envmap_fragment:W8,envmap_common_pars_fragment:X8,envmap_pars_fragment:Y8,envmap_pars_vertex:$8,envmap_physical_pars_fragment:sW,envmap_vertex:Z8,fog_vertex:J8,fog_pars_vertex:j8,fog_fragment:K8,fog_pars_fragment:Q8,gradientmap_pars_fragment:tW,lightmap_fragment:eW,lightmap_pars_fragment:nW,lights_lambert_fragment:rW,lights_lambert_pars_fragment:iW,lights_pars_begin:oW,lights_toon_fragment:aW,lights_toon_pars_fragment:uW,lights_phong_fragment:lW,lights_phong_pars_fragment:cW,lights_physical_fragment:fW,lights_physical_pars_fragment:hW,lights_fragment_begin:pW,lights_fragment_maps:dW,lights_fragment_end:gW,logdepthbuf_fragment:mW,logdepthbuf_pars_fragment:yW,logdepthbuf_pars_vertex:vW,logdepthbuf_vertex:_W,map_fragment:xW,map_pars_fragment:EW,map_particle_fragment:SW,map_particle_pars_fragment:wW,metalnessmap_fragment:MW,metalnessmap_pars_fragment:bW,morphinstance_vertex:AW,morphcolor_vertex:TW,morphnormal_vertex:CW,morphtarget_pars_vertex:IW,morphtarget_vertex:PW,normal_fragment_begin:RW,normal_fragment_maps:LW,normal_pars_fragment:NW,normal_pars_vertex:OW,normal_vertex:DW,normalmap_pars_fragment:FW,clearcoat_normal_fragment_begin:UW,clearcoat_normal_fragment_maps:BW,clearcoat_pars_fragment:zW,iridescence_pars_fragment:GW,opaque_fragment:kW,packing:qW,premultiplied_alpha_fragment:VW,project_vertex:HW,dithering_fragment:WW,dithering_pars_fragment:XW,roughnessmap_fragment:YW,roughnessmap_pars_fragment:$W,shadowmap_pars_fragment:ZW,shadowmap_pars_vertex:JW,shadowmap_vertex:jW,shadowmask_pars_fragment:KW,skinbase_vertex:QW,skinning_pars_vertex:tX,skinning_vertex:eX,skinnormal_vertex:nX,specularmap_fragment:rX,specularmap_pars_fragment:iX,tonemapping_fragment:oX,tonemapping_pars_fragment:sX,transmission_fragment:aX,transmission_pars_fragment:uX,uv_pars_fragment:lX,uv_pars_vertex:cX,uv_vertex:fX,worldpos_vertex:hX,background_vert:pX,background_frag:dX,backgroundCube_vert:gX,backgroundCube_frag:mX,cube_vert:yX,cube_frag:vX,depth_vert:_X,depth_frag:xX,distanceRGBA_vert:EX,distanceRGBA_frag:SX,equirect_vert:wX,equirect_frag:MX,linedashed_vert:bX,linedashed_frag:AX,meshbasic_vert:TX,meshbasic_frag:CX,meshlambert_vert:IX,meshlambert_frag:PX,meshmatcap_vert:RX,meshmatcap_frag:LX,meshnormal_vert:NX,meshnormal_frag:OX,meshphong_vert:DX,meshphong_frag:FX,meshphysical_vert:UX,meshphysical_frag:BX,meshtoon_vert:zX,meshtoon_frag:GX,points_vert:kX,points_frag:qX,shadow_vert:VX,shadow_frag:HX,sprite_vert:WX,sprite_frag:XX},Zt={common:{diffuse:{value:new Te(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ee},alphaMap:{value:null},alphaMapTransform:{value:new Ee},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ee}},envmap:{envMap:{value:null},envMapRotation:{value:new Ee},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ee}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ee}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ee},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ee},normalScale:{value:new Ot(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ee},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ee}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ee}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ee}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Te(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Te(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ee},alphaTest:{value:0},uvTransform:{value:new Ee}},sprite:{diffuse:{value:new Te(16777215)},opacity:{value:1},center:{value:new Ot(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ee},alphaMap:{value:null},alphaMapTransform:{value:new Ee},alphaTest:{value:0}}},Jo={basic:{uniforms:Mi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.fog]),vertexShader:Se.meshbasic_vert,fragmentShader:Se.meshbasic_frag},lambert:{uniforms:Mi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)}}]),vertexShader:Se.meshlambert_vert,fragmentShader:Se.meshlambert_frag},phong:{uniforms:Mi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)},specular:{value:new Te(1118481)},shininess:{value:30}}]),vertexShader:Se.meshphong_vert,fragmentShader:Se.meshphong_frag},standard:{uniforms:Mi([Zt.common,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.roughnessmap,Zt.metalnessmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Se.meshphysical_vert,fragmentShader:Se.meshphysical_frag},toon:{uniforms:Mi([Zt.common,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.gradientmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)}}]),vertexShader:Se.meshtoon_vert,fragmentShader:Se.meshtoon_frag},matcap:{uniforms:Mi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,{matcap:{value:null}}]),vertexShader:Se.meshmatcap_vert,fragmentShader:Se.meshmatcap_frag},points:{uniforms:Mi([Zt.points,Zt.fog]),vertexShader:Se.points_vert,fragmentShader:Se.points_frag},dashed:{uniforms:Mi([Zt.common,Zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Se.linedashed_vert,fragmentShader:Se.linedashed_frag},depth:{uniforms:Mi([Zt.common,Zt.displacementmap]),vertexShader:Se.depth_vert,fragmentShader:Se.depth_frag},normal:{uniforms:Mi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,{opacity:{value:1}}]),vertexShader:Se.meshnormal_vert,fragmentShader:Se.meshnormal_frag},sprite:{uniforms:Mi([Zt.sprite,Zt.fog]),vertexShader:Se.sprite_vert,fragmentShader:Se.sprite_frag},background:{uniforms:{uvTransform:{value:new Ee},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Se.background_vert,fragmentShader:Se.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ee}},vertexShader:Se.backgroundCube_vert,fragmentShader:Se.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Se.cube_vert,fragmentShader:Se.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Se.equirect_vert,fragmentShader:Se.equirect_frag},distanceRGBA:{uniforms:Mi([Zt.common,Zt.displacementmap,{referencePosition:{value:new st},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Se.distanceRGBA_vert,fragmentShader:Se.distanceRGBA_frag},shadow:{uniforms:Mi([Zt.lights,Zt.fog,{color:{value:new Te(0)},opacity:{value:1}}]),vertexShader:Se.shadow_vert,fragmentShader:Se.shadow_frag}};Jo.physical={uniforms:Mi([Jo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ee},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ee},clearcoatNormalScale:{value:new Ot(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ee},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ee},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ee},sheen:{value:0},sheenColor:{value:new Te(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ee},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ee},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ee},transmissionSamplerSize:{value:new Ot},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ee},attenuationDistance:{value:0},attenuationColor:{value:new Te(0)},specularColor:{value:new Te(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ee},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ee},anisotropyVector:{value:new Ot},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ee}}]),vertexShader:Se.meshphysical_vert,fragmentShader:Se.meshphysical_frag};var Mp={r:0,b:0,g:0},Ka=new lu,YX=new $n;function $X(n,t,e,i,s,u,c){let f=new Te(0),p=u===!0?0:1,d,g,y=null,v=0,E=null;function M(_,x){let T=!1,w=x.isScene===!0?x.background:null;w&&w.isTexture&&(w=(x.backgroundBlurriness>0?e:t).get(w)),w===null?A(f,p):w&&w.isColor&&(A(w,1),T=!0);let R=n.xr.getEnvironmentBlendMode();R==="additive"?i.buffers.color.setClear(0,0,0,1,c):R==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,c),(n.autoClear||T)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===ud)?(g===void 0&&(g=new No(new hf(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Rl(Jo.backgroundCube.uniforms),vertexShader:Jo.backgroundCube.vertexShader,fragmentShader:Jo.backgroundCube.fragmentShader,side:Oi,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(B,U,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(g)),Ka.copy(x.backgroundRotation),Ka.x*=-1,Ka.y*=-1,Ka.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Ka.y*=-1,Ka.z*=-1),g.material.uniforms.envMap.value=w,g.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(YX.makeRotationFromEuler(Ka)),g.material.toneMapped=Rn.getTransfer(w.colorSpace)!==kn,(y!==w||v!==w.version||E!==n.toneMapping)&&(g.material.needsUpdate=!0,y=w,v=w.version,E=n.toneMapping),g.layers.enableAll(),_.unshift(g,g.geometry,g.material,0,0,null)):w&&w.isTexture&&(d===void 0&&(d=new No(new jp(2,2),new Qo({name:"BackgroundMaterial",uniforms:Rl(Jo.background.uniforms),vertexShader:Jo.background.vertexShader,fragmentShader:Jo.background.fragmentShader,side:va,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=w,d.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,d.material.toneMapped=Rn.getTransfer(w.colorSpace)!==kn,w.matrixAutoUpdate===!0&&w.updateMatrix(),d.material.uniforms.uvTransform.value.copy(w.matrix),(y!==w||v!==w.version||E!==n.toneMapping)&&(d.material.needsUpdate=!0,y=w,v=w.version,E=n.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function A(_,x){_.getRGB(Mp,iP(n)),i.buffers.color.setClear(Mp.r,Mp.g,Mp.b,x,c)}return{getClearColor:function(){return f},setClearColor:function(_,x=1){f.set(_),p=x,A(f,p)},getClearAlpha:function(){return p},setClearAlpha:function(_){p=_,A(f,p)},render:M}}function ZX(n,t,e,i){let s=n.getParameter(n.MAX_VERTEX_ATTRIBS),u=i.isWebGL2?null:t.get("OES_vertex_array_object"),c=i.isWebGL2||u!==null,f={},p=_(null),d=p,g=!1;function y($,gt,ft,vt,it){let lt=!1;if(c){let H=A(vt,ft,gt);d!==H&&(d=H,E(d.object)),lt=x($,vt,ft,it),lt&&T($,vt,ft,it)}else{let H=gt.wireframe===!0;(d.geometry!==vt.id||d.program!==ft.id||d.wireframe!==H)&&(d.geometry=vt.id,d.program=ft.id,d.wireframe=H,lt=!0)}it!==null&&e.update(it,n.ELEMENT_ARRAY_BUFFER),(lt||g)&&(g=!1,P($,gt,ft,vt),it!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(it).buffer))}function v(){return i.isWebGL2?n.createVertexArray():u.createVertexArrayOES()}function E($){return i.isWebGL2?n.bindVertexArray($):u.bindVertexArrayOES($)}function M($){return i.isWebGL2?n.deleteVertexArray($):u.deleteVertexArrayOES($)}function A($,gt,ft){let vt=ft.wireframe===!0,it=f[$.id];it===void 0&&(it={},f[$.id]=it);let lt=it[gt.id];lt===void 0&&(lt={},it[gt.id]=lt);let H=lt[vt];return H===void 0&&(H=_(v()),lt[vt]=H),H}function _($){let gt=[],ft=[],vt=[];for(let it=0;it<s;it++)gt[it]=0,ft[it]=0,vt[it]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:gt,enabledAttributes:ft,attributeDivisors:vt,object:$,attributes:{},index:null}}function x($,gt,ft,vt){let it=d.attributes,lt=gt.attributes,H=0,At=ft.getAttributes();for(let It in At)if(At[It].location>=0){let nt=it[It],bt=lt[It];if(bt===void 0&&(It==="instanceMatrix"&&$.instanceMatrix&&(bt=$.instanceMatrix),It==="instanceColor"&&$.instanceColor&&(bt=$.instanceColor)),nt===void 0||nt.attribute!==bt||bt&&nt.data!==bt.data)return!0;H++}return d.attributesNum!==H||d.index!==vt}function T($,gt,ft,vt){let it={},lt=gt.attributes,H=0,At=ft.getAttributes();for(let It in At)if(At[It].location>=0){let nt=lt[It];nt===void 0&&(It==="instanceMatrix"&&$.instanceMatrix&&(nt=$.instanceMatrix),It==="instanceColor"&&$.instanceColor&&(nt=$.instanceColor));let bt={};bt.attribute=nt,nt&&nt.data&&(bt.data=nt.data),it[It]=bt,H++}d.attributes=it,d.attributesNum=H,d.index=vt}function w(){let $=d.newAttributes;for(let gt=0,ft=$.length;gt<ft;gt++)$[gt]=0}function R($){B($,0)}function B($,gt){let ft=d.newAttributes,vt=d.enabledAttributes,it=d.attributeDivisors;ft[$]=1,vt[$]===0&&(n.enableVertexAttribArray($),vt[$]=1),it[$]!==gt&&((i.isWebGL2?n:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"]($,gt),it[$]=gt)}function U(){let $=d.newAttributes,gt=d.enabledAttributes;for(let ft=0,vt=gt.length;ft<vt;ft++)gt[ft]!==$[ft]&&(n.disableVertexAttribArray(ft),gt[ft]=0)}function D($,gt,ft,vt,it,lt,H){H===!0?n.vertexAttribIPointer($,gt,ft,it,lt):n.vertexAttribPointer($,gt,ft,vt,it,lt)}function P($,gt,ft,vt){if(i.isWebGL2===!1&&($.isInstancedMesh||vt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;w();let it=vt.attributes,lt=ft.getAttributes(),H=gt.defaultAttributeValues;for(let At in lt){let It=lt[At];if(It.location>=0){let Kt=it[At];if(Kt===void 0&&(At==="instanceMatrix"&&$.instanceMatrix&&(Kt=$.instanceMatrix),At==="instanceColor"&&$.instanceColor&&(Kt=$.instanceColor)),Kt!==void 0){let nt=Kt.normalized,bt=Kt.itemSize,Vt=e.get(Kt);if(Vt===void 0)continue;let $t=Vt.buffer,Ut=Vt.type,Gt=Vt.bytesPerElement,Ct=i.isWebGL2===!0&&(Ut===n.INT||Ut===n.UNSIGNED_INT||Kt.gpuType===YI);if(Kt.isInterleavedBufferAttribute){let ee=Kt.data,Z=ee.stride,Dt=Kt.offset;if(ee.isInstancedInterleavedBuffer){for(let _t=0;_t<It.locationSize;_t++)B(It.location+_t,ee.meshPerAttribute);$.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let _t=0;_t<It.locationSize;_t++)R(It.location+_t);n.bindBuffer(n.ARRAY_BUFFER,$t);for(let _t=0;_t<It.locationSize;_t++)D(It.location+_t,bt/It.locationSize,Ut,nt,Z*Gt,(Dt+bt/It.locationSize*_t)*Gt,Ct)}else{if(Kt.isInstancedBufferAttribute){for(let ee=0;ee<It.locationSize;ee++)B(It.location+ee,Kt.meshPerAttribute);$.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=Kt.meshPerAttribute*Kt.count)}else for(let ee=0;ee<It.locationSize;ee++)R(It.location+ee);n.bindBuffer(n.ARRAY_BUFFER,$t);for(let ee=0;ee<It.locationSize;ee++)D(It.location+ee,bt/It.locationSize,Ut,nt,bt*Gt,bt/It.locationSize*ee*Gt,Ct)}}else if(H!==void 0){let nt=H[At];if(nt!==void 0)switch(nt.length){case 2:n.vertexAttrib2fv(It.location,nt);break;case 3:n.vertexAttrib3fv(It.location,nt);break;case 4:n.vertexAttrib4fv(It.location,nt);break;default:n.vertexAttrib1fv(It.location,nt)}}}}U()}function ct(){V();for(let $ in f){let gt=f[$];for(let ft in gt){let vt=gt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete gt[ft]}delete f[$]}}function L($){if(f[$.id]===void 0)return;let gt=f[$.id];for(let ft in gt){let vt=gt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete gt[ft]}delete f[$.id]}function W($){for(let gt in f){let ft=f[gt];if(ft[$.id]===void 0)continue;let vt=ft[$.id];for(let it in vt)M(vt[it].object),delete vt[it];delete ft[$.id]}}function V(){Mt(),g=!0,d!==p&&(d=p,E(d.object))}function Mt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:y,reset:V,resetDefaultState:Mt,dispose:ct,releaseStatesOfGeometry:L,releaseStatesOfProgram:W,initAttributes:w,enableAttribute:R,disableUnusedAttributes:U}}function JX(n,t,e,i){let s=i.isWebGL2,u;function c(g){u=g}function f(g,y){n.drawArrays(u,g,y),e.update(y,u,1)}function p(g,y,v){if(v===0)return;let E,M;if(s)E=n,M="drawArraysInstanced";else if(E=t.get("ANGLE_instanced_arrays"),M="drawArraysInstancedANGLE",E===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}E[M](u,g,y,v),e.update(y,u,v)}function d(g,y,v){if(v===0)return;let E=t.get("WEBGL_multi_draw");if(E===null)for(let M=0;M<v;M++)this.render(g[M],y[M]);else{E.multiDrawArraysWEBGL(u,g,0,y,0,v);let M=0;for(let A=0;A<v;A++)M+=y[A];e.update(M,u,1)}}this.setMode=c,this.render=f,this.renderInstances=p,this.renderMultiDraw=d}function jX(n,t,e){let i;function s(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===!0){let D=t.get("EXT_texture_filter_anisotropic");i=n.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function u(D){if(D==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=typeof WebGL2RenderingContext!="undefined"&&n.constructor.name==="WebGL2RenderingContext",f=e.precision!==void 0?e.precision:"highp",p=u(f);p!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let d=c||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,y=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=n.getParameter(n.MAX_TEXTURE_SIZE),M=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),A=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),x=n.getParameter(n.MAX_VARYING_VECTORS),T=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=v>0,R=c||t.has("OES_texture_float"),B=w&&R,U=c?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:c,drawBuffers:d,getMaxAnisotropy:s,getMaxPrecision:u,precision:f,logarithmicDepthBuffer:g,maxTextures:y,maxVertexTextures:v,maxTextureSize:E,maxCubemapSize:M,maxAttributes:A,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:T,vertexTextures:w,floatFragmentTextures:R,floatVertexTextures:B,maxSamples:U}}function KX(n){let t=this,e=null,i=0,s=!1,u=!1,c=new Ls,f=new Ee,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(y,v){let E=y.length!==0||v||i!==0||s;return s=v,i=y.length,E},this.beginShadows=function(){u=!0,g(null)},this.endShadows=function(){u=!1},this.setGlobalState=function(y,v){e=g(y,v,0)},this.setState=function(y,v,E){let M=y.clippingPlanes,A=y.clipIntersection,_=y.clipShadows,x=n.get(y);if(!s||M===null||M.length===0||u&&!_)u?g(null):d();else{let T=u?0:i,w=T*4,R=x.clippingState||null;p.value=R,R=g(M,v,w,E);for(let B=0;B!==w;++B)R[B]=e[B];x.clippingState=R,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=T}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function g(y,v,E,M){let A=y!==null?y.length:0,_=null;if(A!==0){if(_=p.value,M!==!0||_===null){let x=E+A*4,T=v.matrixWorldInverse;f.getNormalMatrix(T),(_===null||_.length<x)&&(_=new Float32Array(x));for(let w=0,R=E;w!==A;++w,R+=4)c.copy(y[w]).applyMatrix4(T,f),c.normal.toArray(_,R),_[R+3]=c.constant}p.value=_,p.needsUpdate=!0}return t.numPlanes=A,t.numIntersection=0,_}}function QX(n){let t=new WeakMap;function e(c,f){return f===Qy?c.mapping=Cl:f===tv&&(c.mapping=Il),c}function i(c){if(c&&c.isTexture){let f=c.mapping;if(f===Qy||f===tv)if(t.has(c)){let p=t.get(c).texture;return e(p,c.mapping)}else{let p=c.image;if(p&&p.height>0){let d=new fv(p.height);return d.fromEquirectangularTexture(n,c),t.set(c,d),c.addEventListener("dispose",s),e(d.texture,c.mapping)}else return null}}return c}function s(c){let f=c.target;f.removeEventListener("dispose",s);let p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function u(){t=new WeakMap}return{get:i,dispose:u}}var hv=class extends $p{constructor(t=-1,e=1,i=1,s=-1,u=.1,c=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=u,this.far=c,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,u,c){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=u,this.view.height=c,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2,u=i-t,c=i+t,f=s+e,p=s-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;u+=d*this.view.offsetX,c=u+d*this.view.width,f-=g*this.view.offsetY,p=f-g*this.view.height}this.projectionMatrix.makeOrthographic(u,c,f,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},Sl=4,mI=[.125,.215,.35,.446,.526,.582],nu=20,qy=new hv,yI=new Te,Vy=null,Hy=0,Wy=0,tu=(1+Math.sqrt(5))/2,vl=1/tu,vI=[new st(1,1,1),new st(-1,1,1),new st(1,1,-1),new st(-1,1,-1),new st(0,tu,vl),new st(0,tu,-vl),new st(vl,0,tu),new st(-vl,0,tu),new st(tu,vl,0),new st(-tu,vl,0)],Kp=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,s=100){Vy=this._renderer.getRenderTarget(),Hy=this._renderer.getActiveCubeFace(),Wy=this._renderer.getActiveMipmapLevel(),this._setSize(256);let u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(t,i,s,u),e>0&&this._blur(u,0,0,e),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=EI(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xI(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Vy,Hy,Wy),t.scissorTest=!1,bp(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Cl||t.mapping===Il?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Vy=this._renderer.getRenderTarget(),Hy=this._renderer.getActiveCubeFace(),Wy=this._renderer.getActiveMipmapLevel();let i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:Ni,minFilter:Ni,generateMipmaps:!1,type:ff,format:Lo,colorSpace:xa,depthBuffer:!1},s=_I(t,e,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_I(t,e,i);let{_lodMax:u}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=t9(u)),this._blurMaterial=e9(u,t,e)}return s}_compileMaterial(t){let e=new No(this._lodPlanes[0],t);this._renderer.compile(e,qy)}_sceneToCubeUV(t,e,i,s){let f=new Zi(90,1,e,i),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,y=g.autoClear,v=g.toneMapping;g.getClearColor(yI),g.toneMapping=ga,g.autoClear=!1;let E=new Wp({name:"PMREM.Background",side:Oi,depthWrite:!1,depthTest:!1}),M=new No(new hf,E),A=!1,_=t.background;_?_.isColor&&(E.color.copy(_),t.background=null,A=!0):(E.color.copy(yI),A=!0);for(let x=0;x<6;x++){let T=x%3;T===0?(f.up.set(0,p[x],0),f.lookAt(d[x],0,0)):T===1?(f.up.set(0,0,p[x]),f.lookAt(0,d[x],0)):(f.up.set(0,p[x],0),f.lookAt(0,0,d[x]));let w=this._cubeSize;bp(s,T*w,x>2?w:0,w,w),g.setRenderTarget(s),A&&g.render(M,f),g.render(t,f)}M.geometry.dispose(),M.material.dispose(),g.toneMapping=v,g.autoClear=y,t.background=_}_textureToCubeUV(t,e){let i=this._renderer,s=t.mapping===Cl||t.mapping===Il;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=EI()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xI());let u=s?this._cubemapMaterial:this._equirectMaterial,c=new No(this._lodPlanes[0],u),f=u.uniforms;f.envMap.value=t;let p=this._cubeSize;bp(e,0,0,3*p,2*p),i.setRenderTarget(e),i.render(c,qy)}_applyPMREM(t){let e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let s=1;s<this._lodPlanes.length;s++){let u=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),c=vI[(s-1)%vI.length];this._blur(t,s-1,s,u,c)}e.autoClear=i}_blur(t,e,i,s,u){let c=this._pingPongRenderTarget;this._halfBlur(t,c,e,i,s,"latitudinal",u),this._halfBlur(c,t,i,i,s,"longitudinal",u)}_halfBlur(t,e,i,s,u,c,f){let p=this._renderer,d=this._blurMaterial;c!=="latitudinal"&&c!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,y=new No(this._lodPlanes[s],d),v=d.uniforms,E=this._sizeLods[i]-1,M=isFinite(u)?Math.PI/(2*E):2*Math.PI/(2*nu-1),A=u/M,_=isFinite(u)?1+Math.floor(g*A):nu;_>nu&&console.warn(`sigmaRadians, ${u}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${nu}`);let x=[],T=0;for(let D=0;D<nu;++D){let P=D/A,ct=Math.exp(-P*P/2);x.push(ct),D===0?T+=ct:D<_&&(T+=2*ct)}for(let D=0;D<x.length;D++)x[D]=x[D]/T;v.envMap.value=t.texture,v.samples.value=_,v.weights.value=x,v.latitudinal.value=c==="latitudinal",f&&(v.poleAxis.value=f);let{_lodMax:w}=this;v.dTheta.value=M,v.mipInt.value=w-i;let R=this._sizeLods[s],B=3*R*(s>w-Sl?s-w+Sl:0),U=4*(this._cubeSize-R);bp(e,B,U,3*R,2*R),p.setRenderTarget(e),p.render(y,qy)}};function t9(n){let t=[],e=[],i=[],s=n,u=n-Sl+1+mI.length;for(let c=0;c<u;c++){let f=Math.pow(2,s);e.push(f);let p=1/f;c>n-Sl?p=mI[c-n+Sl-1]:c===0&&(p=0),i.push(p);let d=1/(f-2),g=-d,y=1+d,v=[g,g,y,g,y,y,g,g,y,y,g,y],E=6,M=6,A=3,_=2,x=1,T=new Float32Array(A*M*E),w=new Float32Array(_*M*E),R=new Float32Array(x*M*E);for(let U=0;U<E;U++){let D=U%3*2/3-1,P=U>2?0:-1,ct=[D,P,0,D+2/3,P,0,D+2/3,P+1,0,D,P,0,D+2/3,P+1,0,D,P+1,0];T.set(ct,A*M*U),w.set(v,_*M*U);let L=[U,U,U,U,U,U];R.set(L,x*M*U)}let B=new ui;B.setAttribute("position",new Zn(T,A)),B.setAttribute("uv",new Zn(w,_)),B.setAttribute("faceIndex",new Zn(R,x)),t.push(B),s>Sl&&s--}return{lodPlanes:t,sizeLods:e,sigmas:i}}function _I(n,t,e){let i=new Us(n,t,e);return i.texture.mapping=ud,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function bp(n,t,e,i,s){n.viewport.set(t,e,i,s),n.scissor.set(t,e,i,s)}function e9(n,t,e){let i=new Float32Array(nu),s=new st(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:nu,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Jv(),fragmentShader:`
3553
+ }`,Se={alphahash_fragment:p8,alphahash_pars_fragment:d8,alphamap_fragment:g8,alphamap_pars_fragment:m8,alphatest_fragment:y8,alphatest_pars_fragment:v8,aomap_fragment:_8,aomap_pars_fragment:x8,batching_pars_vertex:E8,batching_vertex:S8,begin_vertex:w8,beginnormal_vertex:M8,bsdfs:b8,iridescence_fragment:A8,bumpmap_pars_fragment:T8,clipping_planes_fragment:C8,clipping_planes_pars_fragment:I8,clipping_planes_pars_vertex:P8,clipping_planes_vertex:R8,color_fragment:L8,color_pars_fragment:N8,color_pars_vertex:O8,color_vertex:D8,common:F8,cube_uv_reflection_fragment:U8,defaultnormal_vertex:B8,displacementmap_pars_vertex:z8,displacementmap_vertex:G8,emissivemap_fragment:k8,emissivemap_pars_fragment:q8,colorspace_fragment:V8,colorspace_pars_fragment:H8,envmap_fragment:W8,envmap_common_pars_fragment:X8,envmap_pars_fragment:Y8,envmap_pars_vertex:$8,envmap_physical_pars_fragment:sW,envmap_vertex:Z8,fog_vertex:J8,fog_pars_vertex:j8,fog_fragment:K8,fog_pars_fragment:Q8,gradientmap_pars_fragment:tW,lightmap_fragment:eW,lightmap_pars_fragment:nW,lights_lambert_fragment:rW,lights_lambert_pars_fragment:iW,lights_pars_begin:oW,lights_toon_fragment:aW,lights_toon_pars_fragment:uW,lights_phong_fragment:lW,lights_phong_pars_fragment:cW,lights_physical_fragment:fW,lights_physical_pars_fragment:hW,lights_fragment_begin:pW,lights_fragment_maps:dW,lights_fragment_end:gW,logdepthbuf_fragment:mW,logdepthbuf_pars_fragment:yW,logdepthbuf_pars_vertex:vW,logdepthbuf_vertex:_W,map_fragment:xW,map_pars_fragment:EW,map_particle_fragment:SW,map_particle_pars_fragment:wW,metalnessmap_fragment:MW,metalnessmap_pars_fragment:bW,morphinstance_vertex:AW,morphcolor_vertex:TW,morphnormal_vertex:CW,morphtarget_pars_vertex:IW,morphtarget_vertex:PW,normal_fragment_begin:RW,normal_fragment_maps:LW,normal_pars_fragment:NW,normal_pars_vertex:OW,normal_vertex:DW,normalmap_pars_fragment:FW,clearcoat_normal_fragment_begin:UW,clearcoat_normal_fragment_maps:BW,clearcoat_pars_fragment:zW,iridescence_pars_fragment:GW,opaque_fragment:kW,packing:qW,premultiplied_alpha_fragment:VW,project_vertex:HW,dithering_fragment:WW,dithering_pars_fragment:XW,roughnessmap_fragment:YW,roughnessmap_pars_fragment:$W,shadowmap_pars_fragment:ZW,shadowmap_pars_vertex:JW,shadowmap_vertex:jW,shadowmask_pars_fragment:KW,skinbase_vertex:QW,skinning_pars_vertex:tX,skinning_vertex:eX,skinnormal_vertex:nX,specularmap_fragment:rX,specularmap_pars_fragment:iX,tonemapping_fragment:oX,tonemapping_pars_fragment:sX,transmission_fragment:aX,transmission_pars_fragment:uX,uv_pars_fragment:lX,uv_pars_vertex:cX,uv_vertex:fX,worldpos_vertex:hX,background_vert:pX,background_frag:dX,backgroundCube_vert:gX,backgroundCube_frag:mX,cube_vert:yX,cube_frag:vX,depth_vert:_X,depth_frag:xX,distanceRGBA_vert:EX,distanceRGBA_frag:SX,equirect_vert:wX,equirect_frag:MX,linedashed_vert:bX,linedashed_frag:AX,meshbasic_vert:TX,meshbasic_frag:CX,meshlambert_vert:IX,meshlambert_frag:PX,meshmatcap_vert:RX,meshmatcap_frag:LX,meshnormal_vert:NX,meshnormal_frag:OX,meshphong_vert:DX,meshphong_frag:FX,meshphysical_vert:UX,meshphysical_frag:BX,meshtoon_vert:zX,meshtoon_frag:GX,points_vert:kX,points_frag:qX,shadow_vert:VX,shadow_frag:HX,sprite_vert:WX,sprite_frag:XX},Zt={common:{diffuse:{value:new Te(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ee},alphaMap:{value:null},alphaMapTransform:{value:new Ee},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ee}},envmap:{envMap:{value:null},envMapRotation:{value:new Ee},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ee}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ee}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ee},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ee},normalScale:{value:new Ot(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ee},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ee}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ee}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ee}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Te(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Te(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ee},alphaTest:{value:0},uvTransform:{value:new Ee}},sprite:{diffuse:{value:new Te(16777215)},opacity:{value:1},center:{value:new Ot(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ee},alphaMap:{value:null},alphaMapTransform:{value:new Ee},alphaTest:{value:0}}},jo={basic:{uniforms:Mi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.fog]),vertexShader:Se.meshbasic_vert,fragmentShader:Se.meshbasic_frag},lambert:{uniforms:Mi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)}}]),vertexShader:Se.meshlambert_vert,fragmentShader:Se.meshlambert_frag},phong:{uniforms:Mi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)},specular:{value:new Te(1118481)},shininess:{value:30}}]),vertexShader:Se.meshphong_vert,fragmentShader:Se.meshphong_frag},standard:{uniforms:Mi([Zt.common,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.roughnessmap,Zt.metalnessmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Se.meshphysical_vert,fragmentShader:Se.meshphysical_frag},toon:{uniforms:Mi([Zt.common,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.gradientmap,Zt.fog,Zt.lights,{emissive:{value:new Te(0)}}]),vertexShader:Se.meshtoon_vert,fragmentShader:Se.meshtoon_frag},matcap:{uniforms:Mi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,{matcap:{value:null}}]),vertexShader:Se.meshmatcap_vert,fragmentShader:Se.meshmatcap_frag},points:{uniforms:Mi([Zt.points,Zt.fog]),vertexShader:Se.points_vert,fragmentShader:Se.points_frag},dashed:{uniforms:Mi([Zt.common,Zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Se.linedashed_vert,fragmentShader:Se.linedashed_frag},depth:{uniforms:Mi([Zt.common,Zt.displacementmap]),vertexShader:Se.depth_vert,fragmentShader:Se.depth_frag},normal:{uniforms:Mi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,{opacity:{value:1}}]),vertexShader:Se.meshnormal_vert,fragmentShader:Se.meshnormal_frag},sprite:{uniforms:Mi([Zt.sprite,Zt.fog]),vertexShader:Se.sprite_vert,fragmentShader:Se.sprite_frag},background:{uniforms:{uvTransform:{value:new Ee},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Se.background_vert,fragmentShader:Se.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ee}},vertexShader:Se.backgroundCube_vert,fragmentShader:Se.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Se.cube_vert,fragmentShader:Se.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Se.equirect_vert,fragmentShader:Se.equirect_frag},distanceRGBA:{uniforms:Mi([Zt.common,Zt.displacementmap,{referencePosition:{value:new st},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Se.distanceRGBA_vert,fragmentShader:Se.distanceRGBA_frag},shadow:{uniforms:Mi([Zt.lights,Zt.fog,{color:{value:new Te(0)},opacity:{value:1}}]),vertexShader:Se.shadow_vert,fragmentShader:Se.shadow_frag}};jo.physical={uniforms:Mi([jo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ee},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ee},clearcoatNormalScale:{value:new Ot(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ee},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ee},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ee},sheen:{value:0},sheenColor:{value:new Te(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ee},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ee},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ee},transmissionSamplerSize:{value:new Ot},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ee},attenuationDistance:{value:0},attenuationColor:{value:new Te(0)},specularColor:{value:new Te(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ee},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ee},anisotropyVector:{value:new Ot},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ee}}]),vertexShader:Se.meshphysical_vert,fragmentShader:Se.meshphysical_frag};var Mp={r:0,b:0,g:0},Ka=new lu,YX=new $n;function $X(n,t,e,i,s,u,c){let f=new Te(0),p=u===!0?0:1,d,g,y=null,v=0,E=null;function M(_,x){let T=!1,w=x.isScene===!0?x.background:null;w&&w.isTexture&&(w=(x.backgroundBlurriness>0?e:t).get(w)),w===null?A(f,p):w&&w.isColor&&(A(w,1),T=!0);let R=n.xr.getEnvironmentBlendMode();R==="additive"?i.buffers.color.setClear(0,0,0,1,c):R==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,c),(n.autoClear||T)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===ud)?(g===void 0&&(g=new No(new hf(1,1,1),new ts({name:"BackgroundCubeMaterial",uniforms:Rl(jo.backgroundCube.uniforms),vertexShader:jo.backgroundCube.vertexShader,fragmentShader:jo.backgroundCube.fragmentShader,side:Oi,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(B,U,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(g)),Ka.copy(x.backgroundRotation),Ka.x*=-1,Ka.y*=-1,Ka.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Ka.y*=-1,Ka.z*=-1),g.material.uniforms.envMap.value=w,g.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(YX.makeRotationFromEuler(Ka)),g.material.toneMapped=Rn.getTransfer(w.colorSpace)!==kn,(y!==w||v!==w.version||E!==n.toneMapping)&&(g.material.needsUpdate=!0,y=w,v=w.version,E=n.toneMapping),g.layers.enableAll(),_.unshift(g,g.geometry,g.material,0,0,null)):w&&w.isTexture&&(d===void 0&&(d=new No(new jp(2,2),new ts({name:"BackgroundMaterial",uniforms:Rl(jo.background.uniforms),vertexShader:jo.background.vertexShader,fragmentShader:jo.background.fragmentShader,side:va,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=w,d.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,d.material.toneMapped=Rn.getTransfer(w.colorSpace)!==kn,w.matrixAutoUpdate===!0&&w.updateMatrix(),d.material.uniforms.uvTransform.value.copy(w.matrix),(y!==w||v!==w.version||E!==n.toneMapping)&&(d.material.needsUpdate=!0,y=w,v=w.version,E=n.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function A(_,x){_.getRGB(Mp,iP(n)),i.buffers.color.setClear(Mp.r,Mp.g,Mp.b,x,c)}return{getClearColor:function(){return f},setClearColor:function(_,x=1){f.set(_),p=x,A(f,p)},getClearAlpha:function(){return p},setClearAlpha:function(_){p=_,A(f,p)},render:M}}function ZX(n,t,e,i){let s=n.getParameter(n.MAX_VERTEX_ATTRIBS),u=i.isWebGL2?null:t.get("OES_vertex_array_object"),c=i.isWebGL2||u!==null,f={},p=_(null),d=p,g=!1;function y($,gt,ft,vt,it){let lt=!1;if(c){let H=A(vt,ft,gt);d!==H&&(d=H,E(d.object)),lt=x($,vt,ft,it),lt&&T($,vt,ft,it)}else{let H=gt.wireframe===!0;(d.geometry!==vt.id||d.program!==ft.id||d.wireframe!==H)&&(d.geometry=vt.id,d.program=ft.id,d.wireframe=H,lt=!0)}it!==null&&e.update(it,n.ELEMENT_ARRAY_BUFFER),(lt||g)&&(g=!1,P($,gt,ft,vt),it!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(it).buffer))}function v(){return i.isWebGL2?n.createVertexArray():u.createVertexArrayOES()}function E($){return i.isWebGL2?n.bindVertexArray($):u.bindVertexArrayOES($)}function M($){return i.isWebGL2?n.deleteVertexArray($):u.deleteVertexArrayOES($)}function A($,gt,ft){let vt=ft.wireframe===!0,it=f[$.id];it===void 0&&(it={},f[$.id]=it);let lt=it[gt.id];lt===void 0&&(lt={},it[gt.id]=lt);let H=lt[vt];return H===void 0&&(H=_(v()),lt[vt]=H),H}function _($){let gt=[],ft=[],vt=[];for(let it=0;it<s;it++)gt[it]=0,ft[it]=0,vt[it]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:gt,enabledAttributes:ft,attributeDivisors:vt,object:$,attributes:{},index:null}}function x($,gt,ft,vt){let it=d.attributes,lt=gt.attributes,H=0,At=ft.getAttributes();for(let It in At)if(At[It].location>=0){let nt=it[It],bt=lt[It];if(bt===void 0&&(It==="instanceMatrix"&&$.instanceMatrix&&(bt=$.instanceMatrix),It==="instanceColor"&&$.instanceColor&&(bt=$.instanceColor)),nt===void 0||nt.attribute!==bt||bt&&nt.data!==bt.data)return!0;H++}return d.attributesNum!==H||d.index!==vt}function T($,gt,ft,vt){let it={},lt=gt.attributes,H=0,At=ft.getAttributes();for(let It in At)if(At[It].location>=0){let nt=lt[It];nt===void 0&&(It==="instanceMatrix"&&$.instanceMatrix&&(nt=$.instanceMatrix),It==="instanceColor"&&$.instanceColor&&(nt=$.instanceColor));let bt={};bt.attribute=nt,nt&&nt.data&&(bt.data=nt.data),it[It]=bt,H++}d.attributes=it,d.attributesNum=H,d.index=vt}function w(){let $=d.newAttributes;for(let gt=0,ft=$.length;gt<ft;gt++)$[gt]=0}function R($){B($,0)}function B($,gt){let ft=d.newAttributes,vt=d.enabledAttributes,it=d.attributeDivisors;ft[$]=1,vt[$]===0&&(n.enableVertexAttribArray($),vt[$]=1),it[$]!==gt&&((i.isWebGL2?n:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"]($,gt),it[$]=gt)}function U(){let $=d.newAttributes,gt=d.enabledAttributes;for(let ft=0,vt=gt.length;ft<vt;ft++)gt[ft]!==$[ft]&&(n.disableVertexAttribArray(ft),gt[ft]=0)}function D($,gt,ft,vt,it,lt,H){H===!0?n.vertexAttribIPointer($,gt,ft,it,lt):n.vertexAttribPointer($,gt,ft,vt,it,lt)}function P($,gt,ft,vt){if(i.isWebGL2===!1&&($.isInstancedMesh||vt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;w();let it=vt.attributes,lt=ft.getAttributes(),H=gt.defaultAttributeValues;for(let At in lt){let It=lt[At];if(It.location>=0){let Kt=it[At];if(Kt===void 0&&(At==="instanceMatrix"&&$.instanceMatrix&&(Kt=$.instanceMatrix),At==="instanceColor"&&$.instanceColor&&(Kt=$.instanceColor)),Kt!==void 0){let nt=Kt.normalized,bt=Kt.itemSize,Vt=e.get(Kt);if(Vt===void 0)continue;let $t=Vt.buffer,Ut=Vt.type,Gt=Vt.bytesPerElement,Ct=i.isWebGL2===!0&&(Ut===n.INT||Ut===n.UNSIGNED_INT||Kt.gpuType===YI);if(Kt.isInterleavedBufferAttribute){let ee=Kt.data,Z=ee.stride,Dt=Kt.offset;if(ee.isInstancedInterleavedBuffer){for(let _t=0;_t<It.locationSize;_t++)B(It.location+_t,ee.meshPerAttribute);$.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let _t=0;_t<It.locationSize;_t++)R(It.location+_t);n.bindBuffer(n.ARRAY_BUFFER,$t);for(let _t=0;_t<It.locationSize;_t++)D(It.location+_t,bt/It.locationSize,Ut,nt,Z*Gt,(Dt+bt/It.locationSize*_t)*Gt,Ct)}else{if(Kt.isInstancedBufferAttribute){for(let ee=0;ee<It.locationSize;ee++)B(It.location+ee,Kt.meshPerAttribute);$.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=Kt.meshPerAttribute*Kt.count)}else for(let ee=0;ee<It.locationSize;ee++)R(It.location+ee);n.bindBuffer(n.ARRAY_BUFFER,$t);for(let ee=0;ee<It.locationSize;ee++)D(It.location+ee,bt/It.locationSize,Ut,nt,bt*Gt,bt/It.locationSize*ee*Gt,Ct)}}else if(H!==void 0){let nt=H[At];if(nt!==void 0)switch(nt.length){case 2:n.vertexAttrib2fv(It.location,nt);break;case 3:n.vertexAttrib3fv(It.location,nt);break;case 4:n.vertexAttrib4fv(It.location,nt);break;default:n.vertexAttrib1fv(It.location,nt)}}}}U()}function ct(){V();for(let $ in f){let gt=f[$];for(let ft in gt){let vt=gt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete gt[ft]}delete f[$]}}function L($){if(f[$.id]===void 0)return;let gt=f[$.id];for(let ft in gt){let vt=gt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete gt[ft]}delete f[$.id]}function W($){for(let gt in f){let ft=f[gt];if(ft[$.id]===void 0)continue;let vt=ft[$.id];for(let it in vt)M(vt[it].object),delete vt[it];delete ft[$.id]}}function V(){Mt(),g=!0,d!==p&&(d=p,E(d.object))}function Mt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:y,reset:V,resetDefaultState:Mt,dispose:ct,releaseStatesOfGeometry:L,releaseStatesOfProgram:W,initAttributes:w,enableAttribute:R,disableUnusedAttributes:U}}function JX(n,t,e,i){let s=i.isWebGL2,u;function c(g){u=g}function f(g,y){n.drawArrays(u,g,y),e.update(y,u,1)}function p(g,y,v){if(v===0)return;let E,M;if(s)E=n,M="drawArraysInstanced";else if(E=t.get("ANGLE_instanced_arrays"),M="drawArraysInstancedANGLE",E===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}E[M](u,g,y,v),e.update(y,u,v)}function d(g,y,v){if(v===0)return;let E=t.get("WEBGL_multi_draw");if(E===null)for(let M=0;M<v;M++)this.render(g[M],y[M]);else{E.multiDrawArraysWEBGL(u,g,0,y,0,v);let M=0;for(let A=0;A<v;A++)M+=y[A];e.update(M,u,1)}}this.setMode=c,this.render=f,this.renderInstances=p,this.renderMultiDraw=d}function jX(n,t,e){let i;function s(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===!0){let D=t.get("EXT_texture_filter_anisotropic");i=n.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function u(D){if(D==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=typeof WebGL2RenderingContext!="undefined"&&n.constructor.name==="WebGL2RenderingContext",f=e.precision!==void 0?e.precision:"highp",p=u(f);p!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let d=c||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,y=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=n.getParameter(n.MAX_TEXTURE_SIZE),M=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),A=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),x=n.getParameter(n.MAX_VARYING_VECTORS),T=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=v>0,R=c||t.has("OES_texture_float"),B=w&&R,U=c?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:c,drawBuffers:d,getMaxAnisotropy:s,getMaxPrecision:u,precision:f,logarithmicDepthBuffer:g,maxTextures:y,maxVertexTextures:v,maxTextureSize:E,maxCubemapSize:M,maxAttributes:A,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:T,vertexTextures:w,floatFragmentTextures:R,floatVertexTextures:B,maxSamples:U}}function KX(n){let t=this,e=null,i=0,s=!1,u=!1,c=new Ls,f=new Ee,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(y,v){let E=y.length!==0||v||i!==0||s;return s=v,i=y.length,E},this.beginShadows=function(){u=!0,g(null)},this.endShadows=function(){u=!1},this.setGlobalState=function(y,v){e=g(y,v,0)},this.setState=function(y,v,E){let M=y.clippingPlanes,A=y.clipIntersection,_=y.clipShadows,x=n.get(y);if(!s||M===null||M.length===0||u&&!_)u?g(null):d();else{let T=u?0:i,w=T*4,R=x.clippingState||null;p.value=R,R=g(M,v,w,E);for(let B=0;B!==w;++B)R[B]=e[B];x.clippingState=R,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=T}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function g(y,v,E,M){let A=y!==null?y.length:0,_=null;if(A!==0){if(_=p.value,M!==!0||_===null){let x=E+A*4,T=v.matrixWorldInverse;f.getNormalMatrix(T),(_===null||_.length<x)&&(_=new Float32Array(x));for(let w=0,R=E;w!==A;++w,R+=4)c.copy(y[w]).applyMatrix4(T,f),c.normal.toArray(_,R),_[R+3]=c.constant}p.value=_,p.needsUpdate=!0}return t.numPlanes=A,t.numIntersection=0,_}}function QX(n){let t=new WeakMap;function e(c,f){return f===Qy?c.mapping=Cl:f===tv&&(c.mapping=Il),c}function i(c){if(c&&c.isTexture){let f=c.mapping;if(f===Qy||f===tv)if(t.has(c)){let p=t.get(c).texture;return e(p,c.mapping)}else{let p=c.image;if(p&&p.height>0){let d=new fv(p.height);return d.fromEquirectangularTexture(n,c),t.set(c,d),c.addEventListener("dispose",s),e(d.texture,c.mapping)}else return null}}return c}function s(c){let f=c.target;f.removeEventListener("dispose",s);let p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function u(){t=new WeakMap}return{get:i,dispose:u}}var hv=class extends $p{constructor(t=-1,e=1,i=1,s=-1,u=.1,c=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=u,this.far=c,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,u,c){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=u,this.view.height=c,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2,u=i-t,c=i+t,f=s+e,p=s-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;u+=d*this.view.offsetX,c=u+d*this.view.width,f-=g*this.view.offsetY,p=f-g*this.view.height}this.projectionMatrix.makeOrthographic(u,c,f,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},Sl=4,mI=[.125,.215,.35,.446,.526,.582],nu=20,qy=new hv,yI=new Te,Vy=null,Hy=0,Wy=0,tu=(1+Math.sqrt(5))/2,vl=1/tu,vI=[new st(1,1,1),new st(-1,1,1),new st(1,1,-1),new st(-1,1,-1),new st(0,tu,vl),new st(0,tu,-vl),new st(vl,0,tu),new st(-vl,0,tu),new st(tu,vl,0),new st(-tu,vl,0)],Kp=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,s=100){Vy=this._renderer.getRenderTarget(),Hy=this._renderer.getActiveCubeFace(),Wy=this._renderer.getActiveMipmapLevel(),this._setSize(256);let u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(t,i,s,u),e>0&&this._blur(u,0,0,e),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=EI(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xI(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Vy,Hy,Wy),t.scissorTest=!1,bp(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Cl||t.mapping===Il?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Vy=this._renderer.getRenderTarget(),Hy=this._renderer.getActiveCubeFace(),Wy=this._renderer.getActiveMipmapLevel();let i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:Ni,minFilter:Ni,generateMipmaps:!1,type:ff,format:Lo,colorSpace:xa,depthBuffer:!1},s=_I(t,e,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_I(t,e,i);let{_lodMax:u}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=t9(u)),this._blurMaterial=e9(u,t,e)}return s}_compileMaterial(t){let e=new No(this._lodPlanes[0],t);this._renderer.compile(e,qy)}_sceneToCubeUV(t,e,i,s){let f=new Zi(90,1,e,i),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,y=g.autoClear,v=g.toneMapping;g.getClearColor(yI),g.toneMapping=ga,g.autoClear=!1;let E=new Wp({name:"PMREM.Background",side:Oi,depthWrite:!1,depthTest:!1}),M=new No(new hf,E),A=!1,_=t.background;_?_.isColor&&(E.color.copy(_),t.background=null,A=!0):(E.color.copy(yI),A=!0);for(let x=0;x<6;x++){let T=x%3;T===0?(f.up.set(0,p[x],0),f.lookAt(d[x],0,0)):T===1?(f.up.set(0,0,p[x]),f.lookAt(0,d[x],0)):(f.up.set(0,p[x],0),f.lookAt(0,0,d[x]));let w=this._cubeSize;bp(s,T*w,x>2?w:0,w,w),g.setRenderTarget(s),A&&g.render(M,f),g.render(t,f)}M.geometry.dispose(),M.material.dispose(),g.toneMapping=v,g.autoClear=y,t.background=_}_textureToCubeUV(t,e){let i=this._renderer,s=t.mapping===Cl||t.mapping===Il;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=EI()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xI());let u=s?this._cubemapMaterial:this._equirectMaterial,c=new No(this._lodPlanes[0],u),f=u.uniforms;f.envMap.value=t;let p=this._cubeSize;bp(e,0,0,3*p,2*p),i.setRenderTarget(e),i.render(c,qy)}_applyPMREM(t){let e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let s=1;s<this._lodPlanes.length;s++){let u=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),c=vI[(s-1)%vI.length];this._blur(t,s-1,s,u,c)}e.autoClear=i}_blur(t,e,i,s,u){let c=this._pingPongRenderTarget;this._halfBlur(t,c,e,i,s,"latitudinal",u),this._halfBlur(c,t,i,i,s,"longitudinal",u)}_halfBlur(t,e,i,s,u,c,f){let p=this._renderer,d=this._blurMaterial;c!=="latitudinal"&&c!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,y=new No(this._lodPlanes[s],d),v=d.uniforms,E=this._sizeLods[i]-1,M=isFinite(u)?Math.PI/(2*E):2*Math.PI/(2*nu-1),A=u/M,_=isFinite(u)?1+Math.floor(g*A):nu;_>nu&&console.warn(`sigmaRadians, ${u}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${nu}`);let x=[],T=0;for(let D=0;D<nu;++D){let P=D/A,ct=Math.exp(-P*P/2);x.push(ct),D===0?T+=ct:D<_&&(T+=2*ct)}for(let D=0;D<x.length;D++)x[D]=x[D]/T;v.envMap.value=t.texture,v.samples.value=_,v.weights.value=x,v.latitudinal.value=c==="latitudinal",f&&(v.poleAxis.value=f);let{_lodMax:w}=this;v.dTheta.value=M,v.mipInt.value=w-i;let R=this._sizeLods[s],B=3*R*(s>w-Sl?s-w+Sl:0),U=4*(this._cubeSize-R);bp(e,B,U,3*R,2*R),p.setRenderTarget(e),p.render(y,qy)}};function t9(n){let t=[],e=[],i=[],s=n,u=n-Sl+1+mI.length;for(let c=0;c<u;c++){let f=Math.pow(2,s);e.push(f);let p=1/f;c>n-Sl?p=mI[c-n+Sl-1]:c===0&&(p=0),i.push(p);let d=1/(f-2),g=-d,y=1+d,v=[g,g,y,g,y,y,g,g,y,y,g,y],E=6,M=6,A=3,_=2,x=1,T=new Float32Array(A*M*E),w=new Float32Array(_*M*E),R=new Float32Array(x*M*E);for(let U=0;U<E;U++){let D=U%3*2/3-1,P=U>2?0:-1,ct=[D,P,0,D+2/3,P,0,D+2/3,P+1,0,D,P,0,D+2/3,P+1,0,D,P+1,0];T.set(ct,A*M*U),w.set(v,_*M*U);let L=[U,U,U,U,U,U];R.set(L,x*M*U)}let B=new ui;B.setAttribute("position",new Zn(T,A)),B.setAttribute("uv",new Zn(w,_)),B.setAttribute("faceIndex",new Zn(R,x)),t.push(B),s>Sl&&s--}return{lodPlanes:t,sizeLods:e,sigmas:i}}function _I(n,t,e){let i=new Us(n,t,e);return i.texture.mapping=ud,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function bp(n,t,e,i,s){n.viewport.set(t,e,i,s),n.scissor.set(t,e,i,s)}function e9(n,t,e){let i=new Float32Array(nu),s=new st(0,1,0);return new ts({name:"SphericalGaussianBlur",defines:{n:nu,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Jv(),fragmentShader:`
3554
3554
 
3555
3555
  precision mediump float;
3556
3556
  precision mediump int;
@@ -3610,7 +3610,7 @@ void main() {
3610
3610
  }
3611
3611
 
3612
3612
  }
3613
- `,blending:da,depthTest:!1,depthWrite:!1})}function xI(){return new Qo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Jv(),fragmentShader:`
3613
+ `,blending:da,depthTest:!1,depthWrite:!1})}function xI(){return new ts({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Jv(),fragmentShader:`
3614
3614
 
3615
3615
  precision mediump float;
3616
3616
  precision mediump int;
@@ -3629,7 +3629,7 @@ void main() {
3629
3629
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3630
3630
 
3631
3631
  }
3632
- `,blending:da,depthTest:!1,depthWrite:!1})}function EI(){return new Qo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Jv(),fragmentShader:`
3632
+ `,blending:da,depthTest:!1,depthWrite:!1})}function EI(){return new ts({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Jv(),fragmentShader:`
3633
3633
 
3634
3634
  precision mediump float;
3635
3635
  precision mediump int;
@@ -3702,7 +3702,7 @@ void main() {
3702
3702
  }
3703
3703
  `}function n9(n){let t=new WeakMap,e=null;function i(f){if(f&&f.isTexture){let p=f.mapping,d=p===Qy||p===tv,g=p===Cl||p===Il;if(d||g)if(f.isRenderTargetTexture&&f.needsPMREMUpdate===!0){f.needsPMREMUpdate=!1;let y=t.get(f);return e===null&&(e=new Kp(n)),y=d?e.fromEquirectangular(f,y):e.fromCubemap(f,y),t.set(f,y),y.texture}else{if(t.has(f))return t.get(f).texture;{let y=f.image;if(d&&y&&y.height>0||g&&y&&s(y)){e===null&&(e=new Kp(n));let v=d?e.fromEquirectangular(f):e.fromCubemap(f);return t.set(f,v),f.addEventListener("dispose",u),v.texture}else return null}}}return f}function s(f){let p=0,d=6;for(let g=0;g<d;g++)f[g]!==void 0&&p++;return p===d}function u(f){let p=f.target;p.removeEventListener("dispose",u);let d=t.get(p);d!==void 0&&(t.delete(p),d.dispose())}function c(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:i,dispose:c}}function r9(n){let t={};function e(i){if(t[i]!==void 0)return t[i];let s;switch(i){case"WEBGL_depth_texture":s=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=n.getExtension(i)}return t[i]=s,s}return{has:function(i){return e(i)!==null},init:function(i){i.isWebGL2?(e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance")):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(i){let s=e(i);return s===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function i9(n,t,e,i){let s={},u=new WeakMap;function c(y){let v=y.target;v.index!==null&&t.remove(v.index);for(let M in v.attributes)t.remove(v.attributes[M]);for(let M in v.morphAttributes){let A=v.morphAttributes[M];for(let _=0,x=A.length;_<x;_++)t.remove(A[_])}v.removeEventListener("dispose",c),delete s[v.id];let E=u.get(v);E&&(t.remove(E),u.delete(v)),i.releaseStatesOfGeometry(v),v.isInstancedBufferGeometry===!0&&delete v._maxInstanceCount,e.memory.geometries--}function f(y,v){return s[v.id]===!0||(v.addEventListener("dispose",c),s[v.id]=!0,e.memory.geometries++),v}function p(y){let v=y.attributes;for(let M in v)t.update(v[M],n.ARRAY_BUFFER);let E=y.morphAttributes;for(let M in E){let A=E[M];for(let _=0,x=A.length;_<x;_++)t.update(A[_],n.ARRAY_BUFFER)}}function d(y){let v=[],E=y.index,M=y.attributes.position,A=0;if(E!==null){let T=E.array;A=E.version;for(let w=0,R=T.length;w<R;w+=3){let B=T[w+0],U=T[w+1],D=T[w+2];v.push(B,U,U,D,D,B)}}else if(M!==void 0){let T=M.array;A=M.version;for(let w=0,R=T.length/3-1;w<R;w+=3){let B=w+0,U=w+1,D=w+2;v.push(B,U,U,D,D,B)}}else return;let _=new(eP(v)?Yp:Xp)(v,1);_.version=A;let x=u.get(y);x&&t.remove(x),u.set(y,_)}function g(y){let v=u.get(y);if(v){let E=y.index;E!==null&&v.version<E.version&&d(y)}else d(y);return u.get(y)}return{get:f,update:p,getWireframeAttribute:g}}function o9(n,t,e,i){let s=i.isWebGL2,u;function c(E){u=E}let f,p;function d(E){f=E.type,p=E.bytesPerElement}function g(E,M){n.drawElements(u,M,f,E*p),e.update(M,u,1)}function y(E,M,A){if(A===0)return;let _,x;if(s)_=n,x="drawElementsInstanced";else if(_=t.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",_===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}_[x](u,M,f,E*p,A),e.update(M,u,A)}function v(E,M,A){if(A===0)return;let _=t.get("WEBGL_multi_draw");if(_===null)for(let x=0;x<A;x++)this.render(E[x]/p,M[x]);else{_.multiDrawElementsWEBGL(u,M,0,f,E,0,A);let x=0;for(let T=0;T<A;T++)x+=M[T];e.update(x,u,1)}}this.setMode=c,this.setIndex=d,this.render=g,this.renderInstances=y,this.renderMultiDraw=v}function s9(n){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function i(u,c,f){switch(e.calls++,c){case n.TRIANGLES:e.triangles+=f*(u/3);break;case n.LINES:e.lines+=f*(u/2);break;case n.LINE_STRIP:e.lines+=f*(u-1);break;case n.LINE_LOOP:e.lines+=f*u;break;case n.POINTS:e.points+=f*u;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",c);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:i}}function a9(n,t){return n[0]-t[0]}function u9(n,t){return Math.abs(t[1])-Math.abs(n[1])}function l9(n,t,e){let i={},s=new Float32Array(8),u=new WeakMap,c=new Yr,f=[];for(let d=0;d<8;d++)f[d]=[d,0];function p(d,g,y){let v=d.morphTargetInfluences;if(t.isWebGL2===!0){let E=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,M=E!==void 0?E.length:0,A=u.get(g);if(A===void 0||A.count!==M){let V=function(){L.dispose(),u.delete(g),g.removeEventListener("dispose",V)};A!==void 0&&A.texture.dispose();let _=g.morphAttributes.position!==void 0,x=g.morphAttributes.normal!==void 0,T=g.morphAttributes.color!==void 0,w=g.morphAttributes.position||[],R=g.morphAttributes.normal||[],B=g.morphAttributes.color||[],U=0;_===!0&&(U=1),x===!0&&(U=2),T===!0&&(U=3);let D=g.attributes.position.count*U,P=1;D>t.maxTextureSize&&(P=Math.ceil(D/t.maxTextureSize),D=t.maxTextureSize);let ct=new Float32Array(D*P*4*M),L=new Vp(ct,D,P,M);L.type=Os,L.needsUpdate=!0;let W=U*4;for(let Mt=0;Mt<M;Mt++){let $=w[Mt],gt=R[Mt],ft=B[Mt],vt=D*P*4*Mt;for(let it=0;it<$.count;it++){let lt=it*W;_===!0&&(c.fromBufferAttribute($,it),ct[vt+lt+0]=c.x,ct[vt+lt+1]=c.y,ct[vt+lt+2]=c.z,ct[vt+lt+3]=0),x===!0&&(c.fromBufferAttribute(gt,it),ct[vt+lt+4]=c.x,ct[vt+lt+5]=c.y,ct[vt+lt+6]=c.z,ct[vt+lt+7]=0),T===!0&&(c.fromBufferAttribute(ft,it),ct[vt+lt+8]=c.x,ct[vt+lt+9]=c.y,ct[vt+lt+10]=c.z,ct[vt+lt+11]=ft.itemSize===4?c.w:1)}}A={count:M,texture:L,size:new Ot(D,P)},u.set(g,A),g.addEventListener("dispose",V)}if(d.isInstancedMesh===!0&&d.morphTexture!==null)y.getUniforms().setValue(n,"morphTexture",d.morphTexture,e);else{let _=0;for(let T=0;T<v.length;T++)_+=v[T];let x=g.morphTargetsRelative?1:1-_;y.getUniforms().setValue(n,"morphTargetBaseInfluence",x),y.getUniforms().setValue(n,"morphTargetInfluences",v)}y.getUniforms().setValue(n,"morphTargetsTexture",A.texture,e),y.getUniforms().setValue(n,"morphTargetsTextureSize",A.size)}else{let E=v===void 0?0:v.length,M=i[g.id];if(M===void 0||M.length!==E){M=[];for(let w=0;w<E;w++)M[w]=[w,0];i[g.id]=M}for(let w=0;w<E;w++){let R=M[w];R[0]=w,R[1]=v[w]}M.sort(u9);for(let w=0;w<8;w++)w<E&&M[w][1]?(f[w][0]=M[w][0],f[w][1]=M[w][1]):(f[w][0]=Number.MAX_SAFE_INTEGER,f[w][1]=0);f.sort(a9);let A=g.morphAttributes.position,_=g.morphAttributes.normal,x=0;for(let w=0;w<8;w++){let R=f[w],B=R[0],U=R[1];B!==Number.MAX_SAFE_INTEGER&&U?(A&&g.getAttribute("morphTarget"+w)!==A[B]&&g.setAttribute("morphTarget"+w,A[B]),_&&g.getAttribute("morphNormal"+w)!==_[B]&&g.setAttribute("morphNormal"+w,_[B]),s[w]=U,x+=U):(A&&g.hasAttribute("morphTarget"+w)===!0&&g.deleteAttribute("morphTarget"+w),_&&g.hasAttribute("morphNormal"+w)===!0&&g.deleteAttribute("morphNormal"+w),s[w]=0)}let T=g.morphTargetsRelative?1:1-x;y.getUniforms().setValue(n,"morphTargetBaseInfluence",T),y.getUniforms().setValue(n,"morphTargetInfluences",s)}}return{update:p}}function c9(n,t,e,i){let s=new WeakMap;function u(p){let d=i.render.frame,g=p.geometry,y=t.get(p,g);if(s.get(y)!==d&&(t.update(y),s.set(y,d)),p.isInstancedMesh&&(p.hasEventListener("dispose",f)===!1&&p.addEventListener("dispose",f),s.get(p)!==d&&(e.update(p.instanceMatrix,n.ARRAY_BUFFER),p.instanceColor!==null&&e.update(p.instanceColor,n.ARRAY_BUFFER),s.set(p,d))),p.isSkinnedMesh){let v=p.skeleton;s.get(v)!==d&&(v.update(),s.set(v,d))}return y}function c(){s=new WeakMap}function f(p){let d=p.target;d.removeEventListener("dispose",f),e.remove(d.instanceMatrix),d.instanceColor!==null&&e.remove(d.instanceColor)}return{update:u,dispose:c}}var Qp=class extends uo{constructor(t,e,i,s,u,c,f,p,d,g){if(g=g!==void 0?g:au,g!==au&&g!==Pl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&g===au&&(i=pa),i===void 0&&g===Pl&&(i=su),super(null,s,u,c,f,p,g,i,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=f!==void 0?f:bi,this.minFilter=p!==void 0?p:bi,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},sP=new uo,aP=new Qp(1,1);aP.compareFunction=tP;var uP=new Vp,lP=new uv,cP=new Zp,SI=[],wI=[],MI=new Float32Array(16),bI=new Float32Array(9),AI=new Float32Array(4);function Dl(n,t,e){let i=n[0];if(i<=0||i>0)return n;let s=t*e,u=SI[s];if(u===void 0&&(u=new Float32Array(s),SI[s]=u),t!==0){i.toArray(u,0);for(let c=1,f=0;c!==t;++c)f+=e,n[c].toArray(u,f)}return u}function xr(n,t){if(n.length!==t.length)return!1;for(let e=0,i=n.length;e<i;e++)if(n[e]!==t[e])return!1;return!0}function Er(n,t){for(let e=0,i=t.length;e<i;e++)n[e]=t[e]}function cd(n,t){let e=wI[t];e===void 0&&(e=new Int32Array(t),wI[t]=e);for(let i=0;i!==t;++i)e[i]=n.allocateTextureUnit();return e}function f9(n,t){let e=this.cache;e[0]!==t&&(n.uniform1f(this.addr,t),e[0]=t)}function h9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(n.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(xr(e,t))return;n.uniform2fv(this.addr,t),Er(e,t)}}function p9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(n.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(n.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(xr(e,t))return;n.uniform3fv(this.addr,t),Er(e,t)}}function d9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(n.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(xr(e,t))return;n.uniform4fv(this.addr,t),Er(e,t)}}function g9(n,t){let e=this.cache,i=t.elements;if(i===void 0){if(xr(e,t))return;n.uniformMatrix2fv(this.addr,!1,t),Er(e,t)}else{if(xr(e,i))return;AI.set(i),n.uniformMatrix2fv(this.addr,!1,AI),Er(e,i)}}function m9(n,t){let e=this.cache,i=t.elements;if(i===void 0){if(xr(e,t))return;n.uniformMatrix3fv(this.addr,!1,t),Er(e,t)}else{if(xr(e,i))return;bI.set(i),n.uniformMatrix3fv(this.addr,!1,bI),Er(e,i)}}function y9(n,t){let e=this.cache,i=t.elements;if(i===void 0){if(xr(e,t))return;n.uniformMatrix4fv(this.addr,!1,t),Er(e,t)}else{if(xr(e,i))return;MI.set(i),n.uniformMatrix4fv(this.addr,!1,MI),Er(e,i)}}function v9(n,t){let e=this.cache;e[0]!==t&&(n.uniform1i(this.addr,t),e[0]=t)}function _9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(n.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(xr(e,t))return;n.uniform2iv(this.addr,t),Er(e,t)}}function x9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(n.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(xr(e,t))return;n.uniform3iv(this.addr,t),Er(e,t)}}function E9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(n.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(xr(e,t))return;n.uniform4iv(this.addr,t),Er(e,t)}}function S9(n,t){let e=this.cache;e[0]!==t&&(n.uniform1ui(this.addr,t),e[0]=t)}function w9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(n.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(xr(e,t))return;n.uniform2uiv(this.addr,t),Er(e,t)}}function M9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(n.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(xr(e,t))return;n.uniform3uiv(this.addr,t),Er(e,t)}}function b9(n,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(n.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(xr(e,t))return;n.uniform4uiv(this.addr,t),Er(e,t)}}function A9(n,t,e){let i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s);let u=this.type===n.SAMPLER_2D_SHADOW?aP:sP;e.setTexture2D(t||u,s)}function T9(n,t,e){let i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),e.setTexture3D(t||lP,s)}function C9(n,t,e){let i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),e.setTextureCube(t||cP,s)}function I9(n,t,e){let i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),e.setTexture2DArray(t||uP,s)}function P9(n){switch(n){case 5126:return f9;case 35664:return h9;case 35665:return p9;case 35666:return d9;case 35674:return g9;case 35675:return m9;case 35676:return y9;case 5124:case 35670:return v9;case 35667:case 35671:return _9;case 35668:case 35672:return x9;case 35669:case 35673:return E9;case 5125:return S9;case 36294:return w9;case 36295:return M9;case 36296:return b9;case 35678:case 36198:case 36298:case 36306:case 35682:return A9;case 35679:case 36299:case 36307:return T9;case 35680:case 36300:case 36308:case 36293:return C9;case 36289:case 36303:case 36311:case 36292:return I9}}function R9(n,t){n.uniform1fv(this.addr,t)}function L9(n,t){let e=Dl(t,this.size,2);n.uniform2fv(this.addr,e)}function N9(n,t){let e=Dl(t,this.size,3);n.uniform3fv(this.addr,e)}function O9(n,t){let e=Dl(t,this.size,4);n.uniform4fv(this.addr,e)}function D9(n,t){let e=Dl(t,this.size,4);n.uniformMatrix2fv(this.addr,!1,e)}function F9(n,t){let e=Dl(t,this.size,9);n.uniformMatrix3fv(this.addr,!1,e)}function U9(n,t){let e=Dl(t,this.size,16);n.uniformMatrix4fv(this.addr,!1,e)}function B9(n,t){n.uniform1iv(this.addr,t)}function z9(n,t){n.uniform2iv(this.addr,t)}function G9(n,t){n.uniform3iv(this.addr,t)}function k9(n,t){n.uniform4iv(this.addr,t)}function q9(n,t){n.uniform1uiv(this.addr,t)}function V9(n,t){n.uniform2uiv(this.addr,t)}function H9(n,t){n.uniform3uiv(this.addr,t)}function W9(n,t){n.uniform4uiv(this.addr,t)}function X9(n,t,e){let i=this.cache,s=t.length,u=cd(e,s);xr(i,u)||(n.uniform1iv(this.addr,u),Er(i,u));for(let c=0;c!==s;++c)e.setTexture2D(t[c]||sP,u[c])}function Y9(n,t,e){let i=this.cache,s=t.length,u=cd(e,s);xr(i,u)||(n.uniform1iv(this.addr,u),Er(i,u));for(let c=0;c!==s;++c)e.setTexture3D(t[c]||lP,u[c])}function $9(n,t,e){let i=this.cache,s=t.length,u=cd(e,s);xr(i,u)||(n.uniform1iv(this.addr,u),Er(i,u));for(let c=0;c!==s;++c)e.setTextureCube(t[c]||cP,u[c])}function Z9(n,t,e){let i=this.cache,s=t.length,u=cd(e,s);xr(i,u)||(n.uniform1iv(this.addr,u),Er(i,u));for(let c=0;c!==s;++c)e.setTexture2DArray(t[c]||uP,u[c])}function J9(n){switch(n){case 5126:return R9;case 35664:return L9;case 35665:return N9;case 35666:return O9;case 35674:return D9;case 35675:return F9;case 35676:return U9;case 5124:case 35670:return B9;case 35667:case 35671:return z9;case 35668:case 35672:return G9;case 35669:case 35673:return k9;case 5125:return q9;case 36294:return V9;case 36295:return H9;case 36296:return W9;case 35678:case 36198:case 36298:case 36306:case 35682:return X9;case 35679:case 36299:case 36307:return Y9;case 35680:case 36300:case 36308:case 36293:return $9;case 36289:case 36303:case 36311:case 36292:return Z9}}var pv=class{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=P9(e.type)}},dv=class{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=J9(e.type)}},gv=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){let s=this.seq;for(let u=0,c=s.length;u!==c;++u){let f=s[u];f.setValue(t,e[f.id],i)}}},Xy=/(\w+)(\])?(\[|\.)?/g;function TI(n,t){n.seq.push(t),n.map[t.id]=t}function j9(n,t,e){let i=n.name,s=i.length;for(Xy.lastIndex=0;;){let u=Xy.exec(i),c=Xy.lastIndex,f=u[1],p=u[2]==="]",d=u[3];if(p&&(f=f|0),d===void 0||d==="["&&c+2===s){TI(e,d===void 0?new pv(f,n,t):new dv(f,n,t));break}else{let y=e.map[f];y===void 0&&(y=new gv(f),TI(e,y)),e=y}}}var Tl=class{constructor(t,e){this.seq=[],this.map={};let i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){let u=t.getActiveUniform(e,s),c=t.getUniformLocation(e,u.name);j9(u,c,this)}}setValue(t,e,i,s){let u=this.map[e];u!==void 0&&u.setValue(t,i,s)}setOptional(t,e,i){let s=e[i];s!==void 0&&this.setValue(t,i,s)}static upload(t,e,i,s){for(let u=0,c=e.length;u!==c;++u){let f=e[u],p=i[f.id];p.needsUpdate!==!1&&f.setValue(t,p.value,s)}}static seqWithValue(t,e){let i=[];for(let s=0,u=t.length;s!==u;++s){let c=t[s];c.id in e&&i.push(c)}return i}};function CI(n,t,e){let i=n.createShader(t);return n.shaderSource(i,e),n.compileShader(i),i}var K9=37297,Q9=0;function t7(n,t){let e=n.split(`
3704
3704
  `),i=[],s=Math.max(t-6,0),u=Math.min(t+6,e.length);for(let c=s;c<u;c++){let f=c+1;i.push(`${f===t?">":" "} ${f}: ${e[c]}`)}return i.join(`
3705
- `)}function e7(n){let t=Rn.getPrimaries(Rn.workingColorSpace),e=Rn.getPrimaries(n),i;switch(t===e?i="":t===Bp&&e===Up?i="LinearDisplayP3ToLinearSRGB":t===Up&&e===Bp&&(i="LinearSRGBToLinearDisplayP3"),n){case xa:case ld:return[i,"LinearTransferOETF"];case Zo:case Zv:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function II(n,t,e){let i=n.getShaderParameter(t,n.COMPILE_STATUS),s=n.getShaderInfoLog(t).trim();if(i&&s==="")return"";let u=/ERROR: 0:(\d+)/.exec(s);if(u){let c=parseInt(u[1]);return e.toUpperCase()+`
3705
+ `)}function e7(n){let t=Rn.getPrimaries(Rn.workingColorSpace),e=Rn.getPrimaries(n),i;switch(t===e?i="":t===Bp&&e===Up?i="LinearDisplayP3ToLinearSRGB":t===Up&&e===Bp&&(i="LinearSRGBToLinearDisplayP3"),n){case xa:case ld:return[i,"LinearTransferOETF"];case Jo:case Zv:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function II(n,t,e){let i=n.getShaderParameter(t,n.COMPILE_STATUS),s=n.getShaderInfoLog(t).trim();if(i&&s==="")return"";let u=/ERROR: 0:(\d+)/.exec(s);if(u){let c=parseInt(u[1]);return e.toUpperCase()+`
3706
3706
 
3707
3707
  `+s+`
3708
3708
 
@@ -3750,7 +3750,7 @@ Material Type: `+V.type+`
3750
3750
 
3751
3751
  Program Info Log: `+Mt+`
3752
3752
  `+it+`
3753
- `+lt)}else Mt!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Mt):($===""||gt==="")&&(vt=!1);vt&&(V.diagnostics={runnable:ft,programLog:Mt,vertexShader:{log:$,prefix:x},fragmentShader:{log:gt,prefix:T}})}s.deleteShader(U),s.deleteShader(D),ct=new Tl(s,_),L=a7(s,_)}let ct;this.getUniforms=function(){return ct===void 0&&P(this),ct};let L;this.getAttributes=function(){return L===void 0&&P(this),L};let W=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=s.getProgramParameter(_,K9)),W},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Q9++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=U,this.fragmentShader=D,this}var _7=0,yv=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,i=t.fragmentShader,s=this._getShaderStage(e),u=this._getShaderStage(i),c=this._getShaderCacheForMaterial(t);return c.has(s)===!1&&(c.add(s),s.usedTimes++),c.has(u)===!1&&(c.add(u),u.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let i of e)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,i=e.get(t);return i===void 0&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){let e=this.shaderCache,i=e.get(t);return i===void 0&&(i=new vv(t),e.set(t,i)),i}},vv=class{constructor(t){this.id=_7++,this.code=t,this.usedTimes=0}};function x7(n,t,e,i,s,u,c){let f=new Hp,p=new yv,d=new Set,g=[],y=s.isWebGL2,v=s.logarithmicDepthBuffer,E=s.vertexTextures,M=s.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(L){return d.add(L),L===0?"uv":`uv${L}`}function x(L,W,V,Mt,$){let gt=Mt.fog,ft=$.geometry,vt=L.isMeshStandardMaterial?Mt.environment:null,it=(L.isMeshStandardMaterial?e:t).get(L.envMap||vt),lt=it&&it.mapping===ud?it.image.height:null,H=A[L.type];L.precision!==null&&(M=s.getMaxPrecision(L.precision),M!==L.precision&&console.warn("THREE.WebGLProgram.getParameters:",L.precision,"not supported, using",M,"instead."));let At=ft.morphAttributes.position||ft.morphAttributes.normal||ft.morphAttributes.color,It=At!==void 0?At.length:0,Kt=0;ft.morphAttributes.position!==void 0&&(Kt=1),ft.morphAttributes.normal!==void 0&&(Kt=2),ft.morphAttributes.color!==void 0&&(Kt=3);let nt,bt,Vt,$t;if(H){let ie=Jo[H];nt=ie.vertexShader,bt=ie.fragmentShader}else nt=L.vertexShader,bt=L.fragmentShader,p.update(L),Vt=p.getVertexShaderID(L),$t=p.getFragmentShaderID(L);let Ut=n.getRenderTarget(),Gt=$.isInstancedMesh===!0,Ct=$.isBatchedMesh===!0,ee=!!L.map,Z=!!L.matcap,Dt=!!it,_t=!!L.aoMap,Nt=!!L.lightMap,wt=!!L.bumpMap,Ht=!!L.normalMap,Xt=!!L.displacementMap,Pt=!!L.emissiveMap,ne=!!L.metalnessMap,Y=!!L.roughnessMap,N=L.anisotropy>0,xt=L.clearcoat>0,St=L.iridescence>0,ot=L.sheen>0,Lt=L.transmission>0,ce=N&&!!L.anisotropyMap,Rt=xt&&!!L.clearcoatMap,Bt=xt&&!!L.clearcoatNormalMap,Wt=xt&&!!L.clearcoatRoughnessMap,j=St&&!!L.iridescenceMap,b=St&&!!L.iridescenceThicknessMap,I=ot&&!!L.sheenColorMap,F=ot&&!!L.sheenRoughnessMap,k=!!L.specularMap,G=!!L.specularColorMap,rt=!!L.specularIntensityMap,tt=Lt&&!!L.transmissionMap,pt=Lt&&!!L.thicknessMap,ht=!!L.gradientMap,O=!!L.alphaMap,Q=L.alphaTest>0,J=!!L.alphaHash,et=!!L.extensions,Tt=ga;L.toneMapped&&(Ut===null||Ut.isXRRenderTarget===!0)&&(Tt=n.toneMapping);let kt={isWebGL2:y,shaderID:H,shaderType:L.type,shaderName:L.name,vertexShader:nt,fragmentShader:bt,defines:L.defines,customVertexShaderID:Vt,customFragmentShaderID:$t,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:M,batching:Ct,instancing:Gt,instancingColor:Gt&&$.instanceColor!==null,instancingMorph:Gt&&$.morphTexture!==null,supportsVertexTextures:E,outputColorSpace:Ut===null?n.outputColorSpace:Ut.isXRRenderTarget===!0?Ut.texture.colorSpace:xa,alphaToCoverage:!!L.alphaToCoverage,map:ee,matcap:Z,envMap:Dt,envMapMode:Dt&&it.mapping,envMapCubeUVHeight:lt,aoMap:_t,lightMap:Nt,bumpMap:wt,normalMap:Ht,displacementMap:E&&Xt,emissiveMap:Pt,normalMapObjectSpace:Ht&&L.normalMapType===F6,normalMapTangentSpace:Ht&&L.normalMapType===D6,metalnessMap:ne,roughnessMap:Y,anisotropy:N,anisotropyMap:ce,clearcoat:xt,clearcoatMap:Rt,clearcoatNormalMap:Bt,clearcoatRoughnessMap:Wt,iridescence:St,iridescenceMap:j,iridescenceThicknessMap:b,sheen:ot,sheenColorMap:I,sheenRoughnessMap:F,specularMap:k,specularColorMap:G,specularIntensityMap:rt,transmission:Lt,transmissionMap:tt,thicknessMap:pt,gradientMap:ht,opaque:L.transparent===!1&&L.blending===bl&&L.alphaToCoverage===!1,alphaMap:O,alphaTest:Q,alphaHash:J,combine:L.combine,mapUv:ee&&_(L.map.channel),aoMapUv:_t&&_(L.aoMap.channel),lightMapUv:Nt&&_(L.lightMap.channel),bumpMapUv:wt&&_(L.bumpMap.channel),normalMapUv:Ht&&_(L.normalMap.channel),displacementMapUv:Xt&&_(L.displacementMap.channel),emissiveMapUv:Pt&&_(L.emissiveMap.channel),metalnessMapUv:ne&&_(L.metalnessMap.channel),roughnessMapUv:Y&&_(L.roughnessMap.channel),anisotropyMapUv:ce&&_(L.anisotropyMap.channel),clearcoatMapUv:Rt&&_(L.clearcoatMap.channel),clearcoatNormalMapUv:Bt&&_(L.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Wt&&_(L.clearcoatRoughnessMap.channel),iridescenceMapUv:j&&_(L.iridescenceMap.channel),iridescenceThicknessMapUv:b&&_(L.iridescenceThicknessMap.channel),sheenColorMapUv:I&&_(L.sheenColorMap.channel),sheenRoughnessMapUv:F&&_(L.sheenRoughnessMap.channel),specularMapUv:k&&_(L.specularMap.channel),specularColorMapUv:G&&_(L.specularColorMap.channel),specularIntensityMapUv:rt&&_(L.specularIntensityMap.channel),transmissionMapUv:tt&&_(L.transmissionMap.channel),thicknessMapUv:pt&&_(L.thicknessMap.channel),alphaMapUv:O&&_(L.alphaMap.channel),vertexTangents:!!ft.attributes.tangent&&(Ht||N),vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!ft.attributes.color&&ft.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!ft.attributes.uv&&(ee||O),fog:!!gt,useFog:L.fog===!0,fogExp2:!!gt&&gt.isFogExp2,flatShading:L.flatShading===!0,sizeAttenuation:L.sizeAttenuation===!0,logarithmicDepthBuffer:v,skinning:$.isSkinnedMesh===!0,morphTargets:ft.morphAttributes.position!==void 0,morphNormals:ft.morphAttributes.normal!==void 0,morphColors:ft.morphAttributes.color!==void 0,morphTargetsCount:It,morphTextureStride:Kt,numDirLights:W.directional.length,numPointLights:W.point.length,numSpotLights:W.spot.length,numSpotLightMaps:W.spotLightMap.length,numRectAreaLights:W.rectArea.length,numHemiLights:W.hemi.length,numDirLightShadows:W.directionalShadowMap.length,numPointLightShadows:W.pointShadowMap.length,numSpotLightShadows:W.spotShadowMap.length,numSpotLightShadowsWithMaps:W.numSpotLightShadowsWithMaps,numLightProbes:W.numLightProbes,numClippingPlanes:c.numPlanes,numClipIntersection:c.numIntersection,dithering:L.dithering,shadowMapEnabled:n.shadowMap.enabled&&V.length>0,shadowMapType:n.shadowMap.type,toneMapping:Tt,useLegacyLights:n._useLegacyLights,decodeVideoTexture:ee&&L.map.isVideoTexture===!0&&Rn.getTransfer(L.map.colorSpace)===kn,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===Ns,flipSided:L.side===Oi,useDepthPacking:L.depthPacking>=0,depthPacking:L.depthPacking||0,index0AttributeName:L.index0AttributeName,extensionDerivatives:et&&L.extensions.derivatives===!0,extensionFragDepth:et&&L.extensions.fragDepth===!0,extensionDrawBuffers:et&&L.extensions.drawBuffers===!0,extensionShaderTextureLOD:et&&L.extensions.shaderTextureLOD===!0,extensionClipCullDistance:et&&L.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:et&&L.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:y||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:y||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:y||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:L.customProgramCacheKey()};return kt.vertexUv1s=d.has(1),kt.vertexUv2s=d.has(2),kt.vertexUv3s=d.has(3),d.clear(),kt}function T(L){let W=[];if(L.shaderID?W.push(L.shaderID):(W.push(L.customVertexShaderID),W.push(L.customFragmentShaderID)),L.defines!==void 0)for(let V in L.defines)W.push(V),W.push(L.defines[V]);return L.isRawShaderMaterial===!1&&(w(W,L),R(W,L),W.push(n.outputColorSpace)),W.push(L.customProgramCacheKey),W.join()}function w(L,W){L.push(W.precision),L.push(W.outputColorSpace),L.push(W.envMapMode),L.push(W.envMapCubeUVHeight),L.push(W.mapUv),L.push(W.alphaMapUv),L.push(W.lightMapUv),L.push(W.aoMapUv),L.push(W.bumpMapUv),L.push(W.normalMapUv),L.push(W.displacementMapUv),L.push(W.emissiveMapUv),L.push(W.metalnessMapUv),L.push(W.roughnessMapUv),L.push(W.anisotropyMapUv),L.push(W.clearcoatMapUv),L.push(W.clearcoatNormalMapUv),L.push(W.clearcoatRoughnessMapUv),L.push(W.iridescenceMapUv),L.push(W.iridescenceThicknessMapUv),L.push(W.sheenColorMapUv),L.push(W.sheenRoughnessMapUv),L.push(W.specularMapUv),L.push(W.specularColorMapUv),L.push(W.specularIntensityMapUv),L.push(W.transmissionMapUv),L.push(W.thicknessMapUv),L.push(W.combine),L.push(W.fogExp2),L.push(W.sizeAttenuation),L.push(W.morphTargetsCount),L.push(W.morphAttributeCount),L.push(W.numDirLights),L.push(W.numPointLights),L.push(W.numSpotLights),L.push(W.numSpotLightMaps),L.push(W.numHemiLights),L.push(W.numRectAreaLights),L.push(W.numDirLightShadows),L.push(W.numPointLightShadows),L.push(W.numSpotLightShadows),L.push(W.numSpotLightShadowsWithMaps),L.push(W.numLightProbes),L.push(W.shadowMapType),L.push(W.toneMapping),L.push(W.numClippingPlanes),L.push(W.numClipIntersection),L.push(W.depthPacking)}function R(L,W){f.disableAll(),W.isWebGL2&&f.enable(0),W.supportsVertexTextures&&f.enable(1),W.instancing&&f.enable(2),W.instancingColor&&f.enable(3),W.instancingMorph&&f.enable(4),W.matcap&&f.enable(5),W.envMap&&f.enable(6),W.normalMapObjectSpace&&f.enable(7),W.normalMapTangentSpace&&f.enable(8),W.clearcoat&&f.enable(9),W.iridescence&&f.enable(10),W.alphaTest&&f.enable(11),W.vertexColors&&f.enable(12),W.vertexAlphas&&f.enable(13),W.vertexUv1s&&f.enable(14),W.vertexUv2s&&f.enable(15),W.vertexUv3s&&f.enable(16),W.vertexTangents&&f.enable(17),W.anisotropy&&f.enable(18),W.alphaHash&&f.enable(19),W.batching&&f.enable(20),L.push(f.mask),f.disableAll(),W.fog&&f.enable(0),W.useFog&&f.enable(1),W.flatShading&&f.enable(2),W.logarithmicDepthBuffer&&f.enable(3),W.skinning&&f.enable(4),W.morphTargets&&f.enable(5),W.morphNormals&&f.enable(6),W.morphColors&&f.enable(7),W.premultipliedAlpha&&f.enable(8),W.shadowMapEnabled&&f.enable(9),W.useLegacyLights&&f.enable(10),W.doubleSided&&f.enable(11),W.flipSided&&f.enable(12),W.useDepthPacking&&f.enable(13),W.dithering&&f.enable(14),W.transmission&&f.enable(15),W.sheen&&f.enable(16),W.opaque&&f.enable(17),W.pointsUvs&&f.enable(18),W.decodeVideoTexture&&f.enable(19),W.alphaToCoverage&&f.enable(20),L.push(f.mask)}function B(L){let W=A[L.type],V;if(W){let Mt=Jo[W];V=a8.clone(Mt.uniforms)}else V=L.uniforms;return V}function U(L,W){let V;for(let Mt=0,$=g.length;Mt<$;Mt++){let gt=g[Mt];if(gt.cacheKey===W){V=gt,++V.usedTimes;break}}return V===void 0&&(V=new v7(n,W,L,u),g.push(V)),V}function D(L){if(--L.usedTimes===0){let W=g.indexOf(L);g[W]=g[g.length-1],g.pop(),L.destroy()}}function P(L){p.remove(L)}function ct(){p.dispose()}return{getParameters:x,getProgramCacheKey:T,getUniforms:B,acquireProgram:U,releaseProgram:D,releaseShaderCache:P,programs:g,dispose:ct}}function E7(){let n=new WeakMap;function t(u){let c=n.get(u);return c===void 0&&(c={},n.set(u,c)),c}function e(u){n.delete(u)}function i(u,c,f){n.get(u)[c]=f}function s(){n=new WeakMap}return{get:t,remove:e,update:i,dispose:s}}function S7(n,t){return n.groupOrder!==t.groupOrder?n.groupOrder-t.groupOrder:n.renderOrder!==t.renderOrder?n.renderOrder-t.renderOrder:n.material.id!==t.material.id?n.material.id-t.material.id:n.z!==t.z?n.z-t.z:n.id-t.id}function OI(n,t){return n.groupOrder!==t.groupOrder?n.groupOrder-t.groupOrder:n.renderOrder!==t.renderOrder?n.renderOrder-t.renderOrder:n.z!==t.z?t.z-n.z:n.id-t.id}function DI(){let n=[],t=0,e=[],i=[],s=[];function u(){t=0,e.length=0,i.length=0,s.length=0}function c(y,v,E,M,A,_){let x=n[t];return x===void 0?(x={id:y.id,object:y,geometry:v,material:E,groupOrder:M,renderOrder:y.renderOrder,z:A,group:_},n[t]=x):(x.id=y.id,x.object=y,x.geometry=v,x.material=E,x.groupOrder=M,x.renderOrder=y.renderOrder,x.z=A,x.group=_),t++,x}function f(y,v,E,M,A,_){let x=c(y,v,E,M,A,_);E.transmission>0?i.push(x):E.transparent===!0?s.push(x):e.push(x)}function p(y,v,E,M,A,_){let x=c(y,v,E,M,A,_);E.transmission>0?i.unshift(x):E.transparent===!0?s.unshift(x):e.unshift(x)}function d(y,v){e.length>1&&e.sort(y||S7),i.length>1&&i.sort(v||OI),s.length>1&&s.sort(v||OI)}function g(){for(let y=t,v=n.length;y<v;y++){let E=n[y];if(E.id===null)break;E.id=null,E.object=null,E.geometry=null,E.material=null,E.group=null}}return{opaque:e,transmissive:i,transparent:s,init:u,push:f,unshift:p,finish:g,sort:d}}function w7(){let n=new WeakMap;function t(i,s){let u=n.get(i),c;return u===void 0?(c=new DI,n.set(i,[c])):s>=u.length?(c=new DI,u.push(c)):c=u[s],c}function e(){n=new WeakMap}return{get:t,dispose:e}}function M7(){let n={};return{get:function(t){if(n[t.id]!==void 0)return n[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new st,color:new Te};break;case"SpotLight":e={position:new st,direction:new st,color:new Te,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new st,color:new Te,distance:0,decay:0};break;case"HemisphereLight":e={direction:new st,skyColor:new Te,groundColor:new Te};break;case"RectAreaLight":e={color:new Te,position:new st,halfWidth:new st,halfHeight:new st};break}return n[t.id]=e,e}}}function b7(){let n={};return{get:function(t){if(n[t.id]!==void 0)return n[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ot};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ot};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ot,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[t.id]=e,e}}}var A7=0;function T7(n,t){return(t.castShadow?2:0)-(n.castShadow?2:0)+(t.map?1:0)-(n.map?1:0)}function C7(n,t){let e=new M7,i=b7(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let g=0;g<9;g++)s.probe.push(new st);let u=new st,c=new $n,f=new $n;function p(g,y){let v=0,E=0,M=0;for(let V=0;V<9;V++)s.probe[V].set(0,0,0);let A=0,_=0,x=0,T=0,w=0,R=0,B=0,U=0,D=0,P=0,ct=0;g.sort(T7);let L=y===!0?Math.PI:1;for(let V=0,Mt=g.length;V<Mt;V++){let $=g[V],gt=$.color,ft=$.intensity,vt=$.distance,it=$.shadow&&$.shadow.map?$.shadow.map.texture:null;if($.isAmbientLight)v+=gt.r*ft*L,E+=gt.g*ft*L,M+=gt.b*ft*L;else if($.isLightProbe){for(let lt=0;lt<9;lt++)s.probe[lt].addScaledVector($.sh.coefficients[lt],ft);ct++}else if($.isDirectionalLight){let lt=e.get($);if(lt.color.copy($.color).multiplyScalar($.intensity*L),$.castShadow){let H=$.shadow,At=i.get($);At.shadowBias=H.bias,At.shadowNormalBias=H.normalBias,At.shadowRadius=H.radius,At.shadowMapSize=H.mapSize,s.directionalShadow[A]=At,s.directionalShadowMap[A]=it,s.directionalShadowMatrix[A]=$.shadow.matrix,R++}s.directional[A]=lt,A++}else if($.isSpotLight){let lt=e.get($);lt.position.setFromMatrixPosition($.matrixWorld),lt.color.copy(gt).multiplyScalar(ft*L),lt.distance=vt,lt.coneCos=Math.cos($.angle),lt.penumbraCos=Math.cos($.angle*(1-$.penumbra)),lt.decay=$.decay,s.spot[x]=lt;let H=$.shadow;if($.map&&(s.spotLightMap[D]=$.map,D++,H.updateMatrices($),$.castShadow&&P++),s.spotLightMatrix[x]=H.matrix,$.castShadow){let At=i.get($);At.shadowBias=H.bias,At.shadowNormalBias=H.normalBias,At.shadowRadius=H.radius,At.shadowMapSize=H.mapSize,s.spotShadow[x]=At,s.spotShadowMap[x]=it,U++}x++}else if($.isRectAreaLight){let lt=e.get($);lt.color.copy(gt).multiplyScalar(ft),lt.halfWidth.set($.width*.5,0,0),lt.halfHeight.set(0,$.height*.5,0),s.rectArea[T]=lt,T++}else if($.isPointLight){let lt=e.get($);if(lt.color.copy($.color).multiplyScalar($.intensity*L),lt.distance=$.distance,lt.decay=$.decay,$.castShadow){let H=$.shadow,At=i.get($);At.shadowBias=H.bias,At.shadowNormalBias=H.normalBias,At.shadowRadius=H.radius,At.shadowMapSize=H.mapSize,At.shadowCameraNear=H.camera.near,At.shadowCameraFar=H.camera.far,s.pointShadow[_]=At,s.pointShadowMap[_]=it,s.pointShadowMatrix[_]=$.shadow.matrix,B++}s.point[_]=lt,_++}else if($.isHemisphereLight){let lt=e.get($);lt.skyColor.copy($.color).multiplyScalar(ft*L),lt.groundColor.copy($.groundColor).multiplyScalar(ft*L),s.hemi[w]=lt,w++}}T>0&&(t.isWebGL2?n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Zt.LTC_FLOAT_1,s.rectAreaLTC2=Zt.LTC_FLOAT_2):(s.rectAreaLTC1=Zt.LTC_HALF_1,s.rectAreaLTC2=Zt.LTC_HALF_2):n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Zt.LTC_FLOAT_1,s.rectAreaLTC2=Zt.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Zt.LTC_HALF_1,s.rectAreaLTC2=Zt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=v,s.ambient[1]=E,s.ambient[2]=M;let W=s.hash;(W.directionalLength!==A||W.pointLength!==_||W.spotLength!==x||W.rectAreaLength!==T||W.hemiLength!==w||W.numDirectionalShadows!==R||W.numPointShadows!==B||W.numSpotShadows!==U||W.numSpotMaps!==D||W.numLightProbes!==ct)&&(s.directional.length=A,s.spot.length=x,s.rectArea.length=T,s.point.length=_,s.hemi.length=w,s.directionalShadow.length=R,s.directionalShadowMap.length=R,s.pointShadow.length=B,s.pointShadowMap.length=B,s.spotShadow.length=U,s.spotShadowMap.length=U,s.directionalShadowMatrix.length=R,s.pointShadowMatrix.length=B,s.spotLightMatrix.length=U+D-P,s.spotLightMap.length=D,s.numSpotLightShadowsWithMaps=P,s.numLightProbes=ct,W.directionalLength=A,W.pointLength=_,W.spotLength=x,W.rectAreaLength=T,W.hemiLength=w,W.numDirectionalShadows=R,W.numPointShadows=B,W.numSpotShadows=U,W.numSpotMaps=D,W.numLightProbes=ct,s.version=A7++)}function d(g,y){let v=0,E=0,M=0,A=0,_=0,x=y.matrixWorldInverse;for(let T=0,w=g.length;T<w;T++){let R=g[T];if(R.isDirectionalLight){let B=s.directional[v];B.direction.setFromMatrixPosition(R.matrixWorld),u.setFromMatrixPosition(R.target.matrixWorld),B.direction.sub(u),B.direction.transformDirection(x),v++}else if(R.isSpotLight){let B=s.spot[M];B.position.setFromMatrixPosition(R.matrixWorld),B.position.applyMatrix4(x),B.direction.setFromMatrixPosition(R.matrixWorld),u.setFromMatrixPosition(R.target.matrixWorld),B.direction.sub(u),B.direction.transformDirection(x),M++}else if(R.isRectAreaLight){let B=s.rectArea[A];B.position.setFromMatrixPosition(R.matrixWorld),B.position.applyMatrix4(x),f.identity(),c.copy(R.matrixWorld),c.premultiply(x),f.extractRotation(c),B.halfWidth.set(R.width*.5,0,0),B.halfHeight.set(0,R.height*.5,0),B.halfWidth.applyMatrix4(f),B.halfHeight.applyMatrix4(f),A++}else if(R.isPointLight){let B=s.point[E];B.position.setFromMatrixPosition(R.matrixWorld),B.position.applyMatrix4(x),E++}else if(R.isHemisphereLight){let B=s.hemi[_];B.direction.setFromMatrixPosition(R.matrixWorld),B.direction.transformDirection(x),_++}}}return{setup:p,setupView:d,state:s}}function FI(n,t){let e=new C7(n,t),i=[],s=[];function u(){i.length=0,s.length=0}function c(y){i.push(y)}function f(y){s.push(y)}function p(y){e.setup(i,y)}function d(y){e.setupView(i,y)}return{init:u,state:{lightsArray:i,shadowsArray:s,lights:e},setupLights:p,setupLightsView:d,pushLight:c,pushShadow:f}}function I7(n,t){let e=new WeakMap;function i(u,c=0){let f=e.get(u),p;return f===void 0?(p=new FI(n,t),e.set(u,[p])):c>=f.length?(p=new FI(n,t),f.push(p)):p=f[c],p}function s(){e=new WeakMap}return{get:i,dispose:s}}var _v=class extends cu{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=N6,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},xv=class extends cu{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},P7=`void main() {
3753
+ `+lt)}else Mt!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Mt):($===""||gt==="")&&(vt=!1);vt&&(V.diagnostics={runnable:ft,programLog:Mt,vertexShader:{log:$,prefix:x},fragmentShader:{log:gt,prefix:T}})}s.deleteShader(U),s.deleteShader(D),ct=new Tl(s,_),L=a7(s,_)}let ct;this.getUniforms=function(){return ct===void 0&&P(this),ct};let L;this.getAttributes=function(){return L===void 0&&P(this),L};let W=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=s.getProgramParameter(_,K9)),W},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Q9++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=U,this.fragmentShader=D,this}var _7=0,yv=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,i=t.fragmentShader,s=this._getShaderStage(e),u=this._getShaderStage(i),c=this._getShaderCacheForMaterial(t);return c.has(s)===!1&&(c.add(s),s.usedTimes++),c.has(u)===!1&&(c.add(u),u.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let i of e)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,i=e.get(t);return i===void 0&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){let e=this.shaderCache,i=e.get(t);return i===void 0&&(i=new vv(t),e.set(t,i)),i}},vv=class{constructor(t){this.id=_7++,this.code=t,this.usedTimes=0}};function x7(n,t,e,i,s,u,c){let f=new Hp,p=new yv,d=new Set,g=[],y=s.isWebGL2,v=s.logarithmicDepthBuffer,E=s.vertexTextures,M=s.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(L){return d.add(L),L===0?"uv":`uv${L}`}function x(L,W,V,Mt,$){let gt=Mt.fog,ft=$.geometry,vt=L.isMeshStandardMaterial?Mt.environment:null,it=(L.isMeshStandardMaterial?e:t).get(L.envMap||vt),lt=it&&it.mapping===ud?it.image.height:null,H=A[L.type];L.precision!==null&&(M=s.getMaxPrecision(L.precision),M!==L.precision&&console.warn("THREE.WebGLProgram.getParameters:",L.precision,"not supported, using",M,"instead."));let At=ft.morphAttributes.position||ft.morphAttributes.normal||ft.morphAttributes.color,It=At!==void 0?At.length:0,Kt=0;ft.morphAttributes.position!==void 0&&(Kt=1),ft.morphAttributes.normal!==void 0&&(Kt=2),ft.morphAttributes.color!==void 0&&(Kt=3);let nt,bt,Vt,$t;if(H){let ie=jo[H];nt=ie.vertexShader,bt=ie.fragmentShader}else nt=L.vertexShader,bt=L.fragmentShader,p.update(L),Vt=p.getVertexShaderID(L),$t=p.getFragmentShaderID(L);let Ut=n.getRenderTarget(),Gt=$.isInstancedMesh===!0,Ct=$.isBatchedMesh===!0,ee=!!L.map,Z=!!L.matcap,Dt=!!it,_t=!!L.aoMap,Nt=!!L.lightMap,wt=!!L.bumpMap,Ht=!!L.normalMap,Xt=!!L.displacementMap,Pt=!!L.emissiveMap,ne=!!L.metalnessMap,Y=!!L.roughnessMap,N=L.anisotropy>0,xt=L.clearcoat>0,St=L.iridescence>0,ot=L.sheen>0,Lt=L.transmission>0,ce=N&&!!L.anisotropyMap,Rt=xt&&!!L.clearcoatMap,Bt=xt&&!!L.clearcoatNormalMap,Wt=xt&&!!L.clearcoatRoughnessMap,j=St&&!!L.iridescenceMap,b=St&&!!L.iridescenceThicknessMap,I=ot&&!!L.sheenColorMap,F=ot&&!!L.sheenRoughnessMap,k=!!L.specularMap,G=!!L.specularColorMap,rt=!!L.specularIntensityMap,tt=Lt&&!!L.transmissionMap,pt=Lt&&!!L.thicknessMap,ht=!!L.gradientMap,O=!!L.alphaMap,Q=L.alphaTest>0,J=!!L.alphaHash,et=!!L.extensions,Tt=ga;L.toneMapped&&(Ut===null||Ut.isXRRenderTarget===!0)&&(Tt=n.toneMapping);let kt={isWebGL2:y,shaderID:H,shaderType:L.type,shaderName:L.name,vertexShader:nt,fragmentShader:bt,defines:L.defines,customVertexShaderID:Vt,customFragmentShaderID:$t,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:M,batching:Ct,instancing:Gt,instancingColor:Gt&&$.instanceColor!==null,instancingMorph:Gt&&$.morphTexture!==null,supportsVertexTextures:E,outputColorSpace:Ut===null?n.outputColorSpace:Ut.isXRRenderTarget===!0?Ut.texture.colorSpace:xa,alphaToCoverage:!!L.alphaToCoverage,map:ee,matcap:Z,envMap:Dt,envMapMode:Dt&&it.mapping,envMapCubeUVHeight:lt,aoMap:_t,lightMap:Nt,bumpMap:wt,normalMap:Ht,displacementMap:E&&Xt,emissiveMap:Pt,normalMapObjectSpace:Ht&&L.normalMapType===F6,normalMapTangentSpace:Ht&&L.normalMapType===D6,metalnessMap:ne,roughnessMap:Y,anisotropy:N,anisotropyMap:ce,clearcoat:xt,clearcoatMap:Rt,clearcoatNormalMap:Bt,clearcoatRoughnessMap:Wt,iridescence:St,iridescenceMap:j,iridescenceThicknessMap:b,sheen:ot,sheenColorMap:I,sheenRoughnessMap:F,specularMap:k,specularColorMap:G,specularIntensityMap:rt,transmission:Lt,transmissionMap:tt,thicknessMap:pt,gradientMap:ht,opaque:L.transparent===!1&&L.blending===bl&&L.alphaToCoverage===!1,alphaMap:O,alphaTest:Q,alphaHash:J,combine:L.combine,mapUv:ee&&_(L.map.channel),aoMapUv:_t&&_(L.aoMap.channel),lightMapUv:Nt&&_(L.lightMap.channel),bumpMapUv:wt&&_(L.bumpMap.channel),normalMapUv:Ht&&_(L.normalMap.channel),displacementMapUv:Xt&&_(L.displacementMap.channel),emissiveMapUv:Pt&&_(L.emissiveMap.channel),metalnessMapUv:ne&&_(L.metalnessMap.channel),roughnessMapUv:Y&&_(L.roughnessMap.channel),anisotropyMapUv:ce&&_(L.anisotropyMap.channel),clearcoatMapUv:Rt&&_(L.clearcoatMap.channel),clearcoatNormalMapUv:Bt&&_(L.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Wt&&_(L.clearcoatRoughnessMap.channel),iridescenceMapUv:j&&_(L.iridescenceMap.channel),iridescenceThicknessMapUv:b&&_(L.iridescenceThicknessMap.channel),sheenColorMapUv:I&&_(L.sheenColorMap.channel),sheenRoughnessMapUv:F&&_(L.sheenRoughnessMap.channel),specularMapUv:k&&_(L.specularMap.channel),specularColorMapUv:G&&_(L.specularColorMap.channel),specularIntensityMapUv:rt&&_(L.specularIntensityMap.channel),transmissionMapUv:tt&&_(L.transmissionMap.channel),thicknessMapUv:pt&&_(L.thicknessMap.channel),alphaMapUv:O&&_(L.alphaMap.channel),vertexTangents:!!ft.attributes.tangent&&(Ht||N),vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!ft.attributes.color&&ft.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!ft.attributes.uv&&(ee||O),fog:!!gt,useFog:L.fog===!0,fogExp2:!!gt&&gt.isFogExp2,flatShading:L.flatShading===!0,sizeAttenuation:L.sizeAttenuation===!0,logarithmicDepthBuffer:v,skinning:$.isSkinnedMesh===!0,morphTargets:ft.morphAttributes.position!==void 0,morphNormals:ft.morphAttributes.normal!==void 0,morphColors:ft.morphAttributes.color!==void 0,morphTargetsCount:It,morphTextureStride:Kt,numDirLights:W.directional.length,numPointLights:W.point.length,numSpotLights:W.spot.length,numSpotLightMaps:W.spotLightMap.length,numRectAreaLights:W.rectArea.length,numHemiLights:W.hemi.length,numDirLightShadows:W.directionalShadowMap.length,numPointLightShadows:W.pointShadowMap.length,numSpotLightShadows:W.spotShadowMap.length,numSpotLightShadowsWithMaps:W.numSpotLightShadowsWithMaps,numLightProbes:W.numLightProbes,numClippingPlanes:c.numPlanes,numClipIntersection:c.numIntersection,dithering:L.dithering,shadowMapEnabled:n.shadowMap.enabled&&V.length>0,shadowMapType:n.shadowMap.type,toneMapping:Tt,useLegacyLights:n._useLegacyLights,decodeVideoTexture:ee&&L.map.isVideoTexture===!0&&Rn.getTransfer(L.map.colorSpace)===kn,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===Ns,flipSided:L.side===Oi,useDepthPacking:L.depthPacking>=0,depthPacking:L.depthPacking||0,index0AttributeName:L.index0AttributeName,extensionDerivatives:et&&L.extensions.derivatives===!0,extensionFragDepth:et&&L.extensions.fragDepth===!0,extensionDrawBuffers:et&&L.extensions.drawBuffers===!0,extensionShaderTextureLOD:et&&L.extensions.shaderTextureLOD===!0,extensionClipCullDistance:et&&L.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:et&&L.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:y||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:y||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:y||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:L.customProgramCacheKey()};return kt.vertexUv1s=d.has(1),kt.vertexUv2s=d.has(2),kt.vertexUv3s=d.has(3),d.clear(),kt}function T(L){let W=[];if(L.shaderID?W.push(L.shaderID):(W.push(L.customVertexShaderID),W.push(L.customFragmentShaderID)),L.defines!==void 0)for(let V in L.defines)W.push(V),W.push(L.defines[V]);return L.isRawShaderMaterial===!1&&(w(W,L),R(W,L),W.push(n.outputColorSpace)),W.push(L.customProgramCacheKey),W.join()}function w(L,W){L.push(W.precision),L.push(W.outputColorSpace),L.push(W.envMapMode),L.push(W.envMapCubeUVHeight),L.push(W.mapUv),L.push(W.alphaMapUv),L.push(W.lightMapUv),L.push(W.aoMapUv),L.push(W.bumpMapUv),L.push(W.normalMapUv),L.push(W.displacementMapUv),L.push(W.emissiveMapUv),L.push(W.metalnessMapUv),L.push(W.roughnessMapUv),L.push(W.anisotropyMapUv),L.push(W.clearcoatMapUv),L.push(W.clearcoatNormalMapUv),L.push(W.clearcoatRoughnessMapUv),L.push(W.iridescenceMapUv),L.push(W.iridescenceThicknessMapUv),L.push(W.sheenColorMapUv),L.push(W.sheenRoughnessMapUv),L.push(W.specularMapUv),L.push(W.specularColorMapUv),L.push(W.specularIntensityMapUv),L.push(W.transmissionMapUv),L.push(W.thicknessMapUv),L.push(W.combine),L.push(W.fogExp2),L.push(W.sizeAttenuation),L.push(W.morphTargetsCount),L.push(W.morphAttributeCount),L.push(W.numDirLights),L.push(W.numPointLights),L.push(W.numSpotLights),L.push(W.numSpotLightMaps),L.push(W.numHemiLights),L.push(W.numRectAreaLights),L.push(W.numDirLightShadows),L.push(W.numPointLightShadows),L.push(W.numSpotLightShadows),L.push(W.numSpotLightShadowsWithMaps),L.push(W.numLightProbes),L.push(W.shadowMapType),L.push(W.toneMapping),L.push(W.numClippingPlanes),L.push(W.numClipIntersection),L.push(W.depthPacking)}function R(L,W){f.disableAll(),W.isWebGL2&&f.enable(0),W.supportsVertexTextures&&f.enable(1),W.instancing&&f.enable(2),W.instancingColor&&f.enable(3),W.instancingMorph&&f.enable(4),W.matcap&&f.enable(5),W.envMap&&f.enable(6),W.normalMapObjectSpace&&f.enable(7),W.normalMapTangentSpace&&f.enable(8),W.clearcoat&&f.enable(9),W.iridescence&&f.enable(10),W.alphaTest&&f.enable(11),W.vertexColors&&f.enable(12),W.vertexAlphas&&f.enable(13),W.vertexUv1s&&f.enable(14),W.vertexUv2s&&f.enable(15),W.vertexUv3s&&f.enable(16),W.vertexTangents&&f.enable(17),W.anisotropy&&f.enable(18),W.alphaHash&&f.enable(19),W.batching&&f.enable(20),L.push(f.mask),f.disableAll(),W.fog&&f.enable(0),W.useFog&&f.enable(1),W.flatShading&&f.enable(2),W.logarithmicDepthBuffer&&f.enable(3),W.skinning&&f.enable(4),W.morphTargets&&f.enable(5),W.morphNormals&&f.enable(6),W.morphColors&&f.enable(7),W.premultipliedAlpha&&f.enable(8),W.shadowMapEnabled&&f.enable(9),W.useLegacyLights&&f.enable(10),W.doubleSided&&f.enable(11),W.flipSided&&f.enable(12),W.useDepthPacking&&f.enable(13),W.dithering&&f.enable(14),W.transmission&&f.enable(15),W.sheen&&f.enable(16),W.opaque&&f.enable(17),W.pointsUvs&&f.enable(18),W.decodeVideoTexture&&f.enable(19),W.alphaToCoverage&&f.enable(20),L.push(f.mask)}function B(L){let W=A[L.type],V;if(W){let Mt=jo[W];V=a8.clone(Mt.uniforms)}else V=L.uniforms;return V}function U(L,W){let V;for(let Mt=0,$=g.length;Mt<$;Mt++){let gt=g[Mt];if(gt.cacheKey===W){V=gt,++V.usedTimes;break}}return V===void 0&&(V=new v7(n,W,L,u),g.push(V)),V}function D(L){if(--L.usedTimes===0){let W=g.indexOf(L);g[W]=g[g.length-1],g.pop(),L.destroy()}}function P(L){p.remove(L)}function ct(){p.dispose()}return{getParameters:x,getProgramCacheKey:T,getUniforms:B,acquireProgram:U,releaseProgram:D,releaseShaderCache:P,programs:g,dispose:ct}}function E7(){let n=new WeakMap;function t(u){let c=n.get(u);return c===void 0&&(c={},n.set(u,c)),c}function e(u){n.delete(u)}function i(u,c,f){n.get(u)[c]=f}function s(){n=new WeakMap}return{get:t,remove:e,update:i,dispose:s}}function S7(n,t){return n.groupOrder!==t.groupOrder?n.groupOrder-t.groupOrder:n.renderOrder!==t.renderOrder?n.renderOrder-t.renderOrder:n.material.id!==t.material.id?n.material.id-t.material.id:n.z!==t.z?n.z-t.z:n.id-t.id}function OI(n,t){return n.groupOrder!==t.groupOrder?n.groupOrder-t.groupOrder:n.renderOrder!==t.renderOrder?n.renderOrder-t.renderOrder:n.z!==t.z?t.z-n.z:n.id-t.id}function DI(){let n=[],t=0,e=[],i=[],s=[];function u(){t=0,e.length=0,i.length=0,s.length=0}function c(y,v,E,M,A,_){let x=n[t];return x===void 0?(x={id:y.id,object:y,geometry:v,material:E,groupOrder:M,renderOrder:y.renderOrder,z:A,group:_},n[t]=x):(x.id=y.id,x.object=y,x.geometry=v,x.material=E,x.groupOrder=M,x.renderOrder=y.renderOrder,x.z=A,x.group=_),t++,x}function f(y,v,E,M,A,_){let x=c(y,v,E,M,A,_);E.transmission>0?i.push(x):E.transparent===!0?s.push(x):e.push(x)}function p(y,v,E,M,A,_){let x=c(y,v,E,M,A,_);E.transmission>0?i.unshift(x):E.transparent===!0?s.unshift(x):e.unshift(x)}function d(y,v){e.length>1&&e.sort(y||S7),i.length>1&&i.sort(v||OI),s.length>1&&s.sort(v||OI)}function g(){for(let y=t,v=n.length;y<v;y++){let E=n[y];if(E.id===null)break;E.id=null,E.object=null,E.geometry=null,E.material=null,E.group=null}}return{opaque:e,transmissive:i,transparent:s,init:u,push:f,unshift:p,finish:g,sort:d}}function w7(){let n=new WeakMap;function t(i,s){let u=n.get(i),c;return u===void 0?(c=new DI,n.set(i,[c])):s>=u.length?(c=new DI,u.push(c)):c=u[s],c}function e(){n=new WeakMap}return{get:t,dispose:e}}function M7(){let n={};return{get:function(t){if(n[t.id]!==void 0)return n[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new st,color:new Te};break;case"SpotLight":e={position:new st,direction:new st,color:new Te,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new st,color:new Te,distance:0,decay:0};break;case"HemisphereLight":e={direction:new st,skyColor:new Te,groundColor:new Te};break;case"RectAreaLight":e={color:new Te,position:new st,halfWidth:new st,halfHeight:new st};break}return n[t.id]=e,e}}}function b7(){let n={};return{get:function(t){if(n[t.id]!==void 0)return n[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ot};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ot};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ot,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[t.id]=e,e}}}var A7=0;function T7(n,t){return(t.castShadow?2:0)-(n.castShadow?2:0)+(t.map?1:0)-(n.map?1:0)}function C7(n,t){let e=new M7,i=b7(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let g=0;g<9;g++)s.probe.push(new st);let u=new st,c=new $n,f=new $n;function p(g,y){let v=0,E=0,M=0;for(let V=0;V<9;V++)s.probe[V].set(0,0,0);let A=0,_=0,x=0,T=0,w=0,R=0,B=0,U=0,D=0,P=0,ct=0;g.sort(T7);let L=y===!0?Math.PI:1;for(let V=0,Mt=g.length;V<Mt;V++){let $=g[V],gt=$.color,ft=$.intensity,vt=$.distance,it=$.shadow&&$.shadow.map?$.shadow.map.texture:null;if($.isAmbientLight)v+=gt.r*ft*L,E+=gt.g*ft*L,M+=gt.b*ft*L;else if($.isLightProbe){for(let lt=0;lt<9;lt++)s.probe[lt].addScaledVector($.sh.coefficients[lt],ft);ct++}else if($.isDirectionalLight){let lt=e.get($);if(lt.color.copy($.color).multiplyScalar($.intensity*L),$.castShadow){let H=$.shadow,At=i.get($);At.shadowBias=H.bias,At.shadowNormalBias=H.normalBias,At.shadowRadius=H.radius,At.shadowMapSize=H.mapSize,s.directionalShadow[A]=At,s.directionalShadowMap[A]=it,s.directionalShadowMatrix[A]=$.shadow.matrix,R++}s.directional[A]=lt,A++}else if($.isSpotLight){let lt=e.get($);lt.position.setFromMatrixPosition($.matrixWorld),lt.color.copy(gt).multiplyScalar(ft*L),lt.distance=vt,lt.coneCos=Math.cos($.angle),lt.penumbraCos=Math.cos($.angle*(1-$.penumbra)),lt.decay=$.decay,s.spot[x]=lt;let H=$.shadow;if($.map&&(s.spotLightMap[D]=$.map,D++,H.updateMatrices($),$.castShadow&&P++),s.spotLightMatrix[x]=H.matrix,$.castShadow){let At=i.get($);At.shadowBias=H.bias,At.shadowNormalBias=H.normalBias,At.shadowRadius=H.radius,At.shadowMapSize=H.mapSize,s.spotShadow[x]=At,s.spotShadowMap[x]=it,U++}x++}else if($.isRectAreaLight){let lt=e.get($);lt.color.copy(gt).multiplyScalar(ft),lt.halfWidth.set($.width*.5,0,0),lt.halfHeight.set(0,$.height*.5,0),s.rectArea[T]=lt,T++}else if($.isPointLight){let lt=e.get($);if(lt.color.copy($.color).multiplyScalar($.intensity*L),lt.distance=$.distance,lt.decay=$.decay,$.castShadow){let H=$.shadow,At=i.get($);At.shadowBias=H.bias,At.shadowNormalBias=H.normalBias,At.shadowRadius=H.radius,At.shadowMapSize=H.mapSize,At.shadowCameraNear=H.camera.near,At.shadowCameraFar=H.camera.far,s.pointShadow[_]=At,s.pointShadowMap[_]=it,s.pointShadowMatrix[_]=$.shadow.matrix,B++}s.point[_]=lt,_++}else if($.isHemisphereLight){let lt=e.get($);lt.skyColor.copy($.color).multiplyScalar(ft*L),lt.groundColor.copy($.groundColor).multiplyScalar(ft*L),s.hemi[w]=lt,w++}}T>0&&(t.isWebGL2?n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Zt.LTC_FLOAT_1,s.rectAreaLTC2=Zt.LTC_FLOAT_2):(s.rectAreaLTC1=Zt.LTC_HALF_1,s.rectAreaLTC2=Zt.LTC_HALF_2):n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Zt.LTC_FLOAT_1,s.rectAreaLTC2=Zt.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Zt.LTC_HALF_1,s.rectAreaLTC2=Zt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=v,s.ambient[1]=E,s.ambient[2]=M;let W=s.hash;(W.directionalLength!==A||W.pointLength!==_||W.spotLength!==x||W.rectAreaLength!==T||W.hemiLength!==w||W.numDirectionalShadows!==R||W.numPointShadows!==B||W.numSpotShadows!==U||W.numSpotMaps!==D||W.numLightProbes!==ct)&&(s.directional.length=A,s.spot.length=x,s.rectArea.length=T,s.point.length=_,s.hemi.length=w,s.directionalShadow.length=R,s.directionalShadowMap.length=R,s.pointShadow.length=B,s.pointShadowMap.length=B,s.spotShadow.length=U,s.spotShadowMap.length=U,s.directionalShadowMatrix.length=R,s.pointShadowMatrix.length=B,s.spotLightMatrix.length=U+D-P,s.spotLightMap.length=D,s.numSpotLightShadowsWithMaps=P,s.numLightProbes=ct,W.directionalLength=A,W.pointLength=_,W.spotLength=x,W.rectAreaLength=T,W.hemiLength=w,W.numDirectionalShadows=R,W.numPointShadows=B,W.numSpotShadows=U,W.numSpotMaps=D,W.numLightProbes=ct,s.version=A7++)}function d(g,y){let v=0,E=0,M=0,A=0,_=0,x=y.matrixWorldInverse;for(let T=0,w=g.length;T<w;T++){let R=g[T];if(R.isDirectionalLight){let B=s.directional[v];B.direction.setFromMatrixPosition(R.matrixWorld),u.setFromMatrixPosition(R.target.matrixWorld),B.direction.sub(u),B.direction.transformDirection(x),v++}else if(R.isSpotLight){let B=s.spot[M];B.position.setFromMatrixPosition(R.matrixWorld),B.position.applyMatrix4(x),B.direction.setFromMatrixPosition(R.matrixWorld),u.setFromMatrixPosition(R.target.matrixWorld),B.direction.sub(u),B.direction.transformDirection(x),M++}else if(R.isRectAreaLight){let B=s.rectArea[A];B.position.setFromMatrixPosition(R.matrixWorld),B.position.applyMatrix4(x),f.identity(),c.copy(R.matrixWorld),c.premultiply(x),f.extractRotation(c),B.halfWidth.set(R.width*.5,0,0),B.halfHeight.set(0,R.height*.5,0),B.halfWidth.applyMatrix4(f),B.halfHeight.applyMatrix4(f),A++}else if(R.isPointLight){let B=s.point[E];B.position.setFromMatrixPosition(R.matrixWorld),B.position.applyMatrix4(x),E++}else if(R.isHemisphereLight){let B=s.hemi[_];B.direction.setFromMatrixPosition(R.matrixWorld),B.direction.transformDirection(x),_++}}}return{setup:p,setupView:d,state:s}}function FI(n,t){let e=new C7(n,t),i=[],s=[];function u(){i.length=0,s.length=0}function c(y){i.push(y)}function f(y){s.push(y)}function p(y){e.setup(i,y)}function d(y){e.setupView(i,y)}return{init:u,state:{lightsArray:i,shadowsArray:s,lights:e},setupLights:p,setupLightsView:d,pushLight:c,pushShadow:f}}function I7(n,t){let e=new WeakMap;function i(u,c=0){let f=e.get(u),p;return f===void 0?(p=new FI(n,t),e.set(u,[p])):c>=f.length?(p=new FI(n,t),f.push(p)):p=f[c],p}function s(){e=new WeakMap}return{get:i,dispose:s}}var _v=class extends cu{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=N6,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},xv=class extends cu{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},P7=`void main() {
3754
3754
  gl_Position = vec4( position, 1.0 );
3755
3755
  }`,R7=`uniform sampler2D shadow_pass;
3756
3756
  uniform vec2 resolution;
@@ -3778,7 +3778,7 @@ void main() {
3778
3778
  squared_mean = squared_mean / samples;
3779
3779
  float std_dev = sqrt( squared_mean - mean * mean );
3780
3780
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3781
- }`;function L7(n,t,e){let i=new Jp,s=new Ot,u=new Ot,c=new Yr,f=new _v({depthPacking:O6}),p=new xv,d={},g=e.maxTextureSize,y={[va]:Oi,[Oi]:va,[Ns]:Ns},v=new Qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ot},radius:{value:4}},vertexShader:P7,fragmentShader:R7}),E=v.clone();E.defines.HORIZONTAL_PASS=1;let M=new ui;M.setAttribute("position",new Zn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let A=new No(M,v),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=HI;let x=this.type;this.render=function(U,D,P){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||U.length===0)return;let ct=n.getRenderTarget(),L=n.getActiveCubeFace(),W=n.getActiveMipmapLevel(),V=n.state;V.setBlending(da),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Mt=x!==Rs&&this.type===Rs,$=x===Rs&&this.type!==Rs;for(let gt=0,ft=U.length;gt<ft;gt++){let vt=U[gt],it=vt.shadow;if(it===void 0){console.warn("THREE.WebGLShadowMap:",vt,"has no shadow.");continue}if(it.autoUpdate===!1&&it.needsUpdate===!1)continue;s.copy(it.mapSize);let lt=it.getFrameExtents();if(s.multiply(lt),u.copy(it.mapSize),(s.x>g||s.y>g)&&(s.x>g&&(u.x=Math.floor(g/lt.x),s.x=u.x*lt.x,it.mapSize.x=u.x),s.y>g&&(u.y=Math.floor(g/lt.y),s.y=u.y*lt.y,it.mapSize.y=u.y)),it.map===null||Mt===!0||$===!0){let At=this.type!==Rs?{minFilter:bi,magFilter:bi}:{};it.map!==null&&it.map.dispose(),it.map=new Us(s.x,s.y,At),it.map.texture.name=vt.name+".shadowMap",it.camera.updateProjectionMatrix()}n.setRenderTarget(it.map),n.clear();let H=it.getViewportCount();for(let At=0;At<H;At++){let It=it.getViewport(At);c.set(u.x*It.x,u.y*It.y,u.x*It.z,u.y*It.w),V.viewport(c),it.updateMatrices(vt,At),i=it.getFrustum(),R(D,P,it.camera,vt,this.type)}it.isPointLightShadow!==!0&&this.type===Rs&&T(it,P),it.needsUpdate=!1}x=this.type,_.needsUpdate=!1,n.setRenderTarget(ct,L,W)},this.dispose=function(){M.dispose(),M=null,v.dispose(),v=null,E.dispose(),E=null,A.clear()};function T(U,D){let P=t.update(A);v.defines.VSM_SAMPLES!==U.blurSamples&&(v.defines.VSM_SAMPLES=U.blurSamples,E.defines.VSM_SAMPLES=U.blurSamples,v.needsUpdate=!0,E.needsUpdate=!0),U.mapPass===null&&(U.mapPass=new Us(s.x,s.y)),v.uniforms.shadow_pass.value=U.map.texture,v.uniforms.resolution.value=U.mapSize,v.uniforms.radius.value=U.radius,n.setRenderTarget(U.mapPass),n.clear(),n.renderBufferDirect(D,null,P,v,A,null),E.uniforms.shadow_pass.value=U.mapPass.texture,E.uniforms.resolution.value=U.mapSize,E.uniforms.radius.value=U.radius,n.setRenderTarget(U.map),n.clear(),n.renderBufferDirect(D,null,P,E,A,null)}function w(U,D,P,ct){let L=null,W=P.isPointLight===!0?U.customDistanceMaterial:U.customDepthMaterial;if(W!==void 0)L=W;else if(L=P.isPointLight===!0?p:f,n.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0){let V=L.uuid,Mt=D.uuid,$=d[V];$===void 0&&($={},d[V]=$);let gt=$[Mt];gt===void 0&&(gt=L.clone(),$[Mt]=gt,D.addEventListener("dispose",B)),L=gt}if(L.visible=D.visible,L.wireframe=D.wireframe,ct===Rs?L.side=D.shadowSide!==null?D.shadowSide:D.side:L.side=D.shadowSide!==null?D.shadowSide:y[D.side],L.alphaMap=D.alphaMap,L.alphaTest=D.alphaTest,L.map=D.map,L.clipShadows=D.clipShadows,L.clippingPlanes=D.clippingPlanes,L.clipIntersection=D.clipIntersection,L.displacementMap=D.displacementMap,L.displacementScale=D.displacementScale,L.displacementBias=D.displacementBias,L.wireframeLinewidth=D.wireframeLinewidth,L.linewidth=D.linewidth,P.isPointLight===!0&&L.isMeshDistanceMaterial===!0){let V=n.properties.get(L);V.light=P}return L}function R(U,D,P,ct,L){if(U.visible===!1)return;if(U.layers.test(D.layers)&&(U.isMesh||U.isLine||U.isPoints)&&(U.castShadow||U.receiveShadow&&L===Rs)&&(!U.frustumCulled||i.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,U.matrixWorld);let Mt=t.update(U),$=U.material;if(Array.isArray($)){let gt=Mt.groups;for(let ft=0,vt=gt.length;ft<vt;ft++){let it=gt[ft],lt=$[it.materialIndex];if(lt&&lt.visible){let H=w(U,lt,ct,L);U.onBeforeShadow(n,U,D,P,Mt,H,it),n.renderBufferDirect(P,null,Mt,H,U,it),U.onAfterShadow(n,U,D,P,Mt,H,it)}}}else if($.visible){let gt=w(U,$,ct,L);U.onBeforeShadow(n,U,D,P,Mt,gt,null),n.renderBufferDirect(P,null,Mt,gt,U,null),U.onAfterShadow(n,U,D,P,Mt,gt,null)}}let V=U.children;for(let Mt=0,$=V.length;Mt<$;Mt++)R(V[Mt],D,P,ct,L)}function B(U){U.target.removeEventListener("dispose",B);for(let P in d){let ct=d[P],L=U.target.uuid;L in ct&&(ct[L].dispose(),delete ct[L])}}}function N7(n,t,e){let i=e.isWebGL2;function s(){let O=!1,Q=new Yr,J=null,et=new Yr(0,0,0,0);return{setMask:function(Tt){J!==Tt&&!O&&(n.colorMask(Tt,Tt,Tt,Tt),J=Tt)},setLocked:function(Tt){O=Tt},setClear:function(Tt,kt,ie,oe,we){we===!0&&(Tt*=oe,kt*=oe,ie*=oe),Q.set(Tt,kt,ie,oe),et.equals(Q)===!1&&(n.clearColor(Tt,kt,ie,oe),et.copy(Q))},reset:function(){O=!1,J=null,et.set(-1,0,0,0)}}}function u(){let O=!1,Q=null,J=null,et=null;return{setTest:function(Tt){Tt?Gt(n.DEPTH_TEST):Ct(n.DEPTH_TEST)},setMask:function(Tt){Q!==Tt&&!O&&(n.depthMask(Tt),Q=Tt)},setFunc:function(Tt){if(J!==Tt){switch(Tt){case l6:n.depthFunc(n.NEVER);break;case c6:n.depthFunc(n.ALWAYS);break;case f6:n.depthFunc(n.LESS);break;case Np:n.depthFunc(n.LEQUAL);break;case h6:n.depthFunc(n.EQUAL);break;case p6:n.depthFunc(n.GEQUAL);break;case d6:n.depthFunc(n.GREATER);break;case g6:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}J=Tt}},setLocked:function(Tt){O=Tt},setClear:function(Tt){et!==Tt&&(n.clearDepth(Tt),et=Tt)},reset:function(){O=!1,Q=null,J=null,et=null}}}function c(){let O=!1,Q=null,J=null,et=null,Tt=null,kt=null,ie=null,oe=null,we=null;return{setTest:function(ye){O||(ye?Gt(n.STENCIL_TEST):Ct(n.STENCIL_TEST))},setMask:function(ye){Q!==ye&&!O&&(n.stencilMask(ye),Q=ye)},setFunc:function(ye,be,Ae){(J!==ye||et!==be||Tt!==Ae)&&(n.stencilFunc(ye,be,Ae),J=ye,et=be,Tt=Ae)},setOp:function(ye,be,Ae){(kt!==ye||ie!==be||oe!==Ae)&&(n.stencilOp(ye,be,Ae),kt=ye,ie=be,oe=Ae)},setLocked:function(ye){O=ye},setClear:function(ye){we!==ye&&(n.clearStencil(ye),we=ye)},reset:function(){O=!1,Q=null,J=null,et=null,Tt=null,kt=null,ie=null,oe=null,we=null}}}let f=new s,p=new u,d=new c,g=new WeakMap,y=new WeakMap,v={},E={},M=new WeakMap,A=[],_=null,x=!1,T=null,w=null,R=null,B=null,U=null,D=null,P=null,ct=new Te(0,0,0),L=0,W=!1,V=null,Mt=null,$=null,gt=null,ft=null,vt=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),it=!1,lt=0,H=n.getParameter(n.VERSION);H.indexOf("WebGL")!==-1?(lt=parseFloat(/^WebGL (\d)/.exec(H)[1]),it=lt>=1):H.indexOf("OpenGL ES")!==-1&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),it=lt>=2);let At=null,It={},Kt=n.getParameter(n.SCISSOR_BOX),nt=n.getParameter(n.VIEWPORT),bt=new Yr().fromArray(Kt),Vt=new Yr().fromArray(nt);function $t(O,Q,J,et){let Tt=new Uint8Array(4),kt=n.createTexture();n.bindTexture(O,kt),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ie=0;ie<J;ie++)i&&(O===n.TEXTURE_3D||O===n.TEXTURE_2D_ARRAY)?n.texImage3D(Q,0,n.RGBA,1,1,et,0,n.RGBA,n.UNSIGNED_BYTE,Tt):n.texImage2D(Q+ie,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Tt);return kt}let Ut={};Ut[n.TEXTURE_2D]=$t(n.TEXTURE_2D,n.TEXTURE_2D,1),Ut[n.TEXTURE_CUBE_MAP]=$t(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Ut[n.TEXTURE_2D_ARRAY]=$t(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Ut[n.TEXTURE_3D]=$t(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Gt(n.DEPTH_TEST),p.setFunc(Np),Xt(!1),Pt(dC),Gt(n.CULL_FACE),wt(da);function Gt(O){v[O]!==!0&&(n.enable(O),v[O]=!0)}function Ct(O){v[O]!==!1&&(n.disable(O),v[O]=!1)}function ee(O,Q){return E[O]!==Q?(n.bindFramebuffer(O,Q),E[O]=Q,i&&(O===n.DRAW_FRAMEBUFFER&&(E[n.FRAMEBUFFER]=Q),O===n.FRAMEBUFFER&&(E[n.DRAW_FRAMEBUFFER]=Q)),!0):!1}function Z(O,Q){let J=A,et=!1;if(O){J=M.get(Q),J===void 0&&(J=[],M.set(Q,J));let Tt=O.textures;if(J.length!==Tt.length||J[0]!==n.COLOR_ATTACHMENT0){for(let kt=0,ie=Tt.length;kt<ie;kt++)J[kt]=n.COLOR_ATTACHMENT0+kt;J.length=Tt.length,et=!0}}else J[0]!==n.BACK&&(J[0]=n.BACK,et=!0);if(et)if(e.isWebGL2)n.drawBuffers(J);else if(t.has("WEBGL_draw_buffers")===!0)t.get("WEBGL_draw_buffers").drawBuffersWEBGL(J);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function Dt(O){return _!==O?(n.useProgram(O),_=O,!0):!1}let _t={[eu]:n.FUNC_ADD,[$H]:n.FUNC_SUBTRACT,[ZH]:n.FUNC_REVERSE_SUBTRACT};if(i)_t[vC]=n.MIN,_t[_C]=n.MAX;else{let O=t.get("EXT_blend_minmax");O!==null&&(_t[vC]=O.MIN_EXT,_t[_C]=O.MAX_EXT)}let Nt={[JH]:n.ZERO,[jH]:n.ONE,[KH]:n.SRC_COLOR,[jy]:n.SRC_ALPHA,[i6]:n.SRC_ALPHA_SATURATE,[n6]:n.DST_COLOR,[t6]:n.DST_ALPHA,[QH]:n.ONE_MINUS_SRC_COLOR,[Ky]:n.ONE_MINUS_SRC_ALPHA,[r6]:n.ONE_MINUS_DST_COLOR,[e6]:n.ONE_MINUS_DST_ALPHA,[o6]:n.CONSTANT_COLOR,[s6]:n.ONE_MINUS_CONSTANT_COLOR,[a6]:n.CONSTANT_ALPHA,[u6]:n.ONE_MINUS_CONSTANT_ALPHA};function wt(O,Q,J,et,Tt,kt,ie,oe,we,ye){if(O===da){x===!0&&(Ct(n.BLEND),x=!1);return}if(x===!1&&(Gt(n.BLEND),x=!0),O!==YH){if(O!==T||ye!==W){if((w!==eu||U!==eu)&&(n.blendEquation(n.FUNC_ADD),w=eu,U=eu),ye)switch(O){case bl:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case gC:n.blendFunc(n.ONE,n.ONE);break;case mC:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case yC:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}else switch(O){case bl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case gC:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case mC:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case yC:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}R=null,B=null,D=null,P=null,ct.set(0,0,0),L=0,T=O,W=ye}return}Tt=Tt||Q,kt=kt||J,ie=ie||et,(Q!==w||Tt!==U)&&(n.blendEquationSeparate(_t[Q],_t[Tt]),w=Q,U=Tt),(J!==R||et!==B||kt!==D||ie!==P)&&(n.blendFuncSeparate(Nt[J],Nt[et],Nt[kt],Nt[ie]),R=J,B=et,D=kt,P=ie),(oe.equals(ct)===!1||we!==L)&&(n.blendColor(oe.r,oe.g,oe.b,we),ct.copy(oe),L=we),T=O,W=!1}function Ht(O,Q){O.side===Ns?Ct(n.CULL_FACE):Gt(n.CULL_FACE);let J=O.side===Oi;Q&&(J=!J),Xt(J),O.blending===bl&&O.transparent===!1?wt(da):wt(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),p.setFunc(O.depthFunc),p.setTest(O.depthTest),p.setMask(O.depthWrite),f.setMask(O.colorWrite);let et=O.stencilWrite;d.setTest(et),et&&(d.setMask(O.stencilWriteMask),d.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),d.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),Y(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?Gt(n.SAMPLE_ALPHA_TO_COVERAGE):Ct(n.SAMPLE_ALPHA_TO_COVERAGE)}function Xt(O){V!==O&&(O?n.frontFace(n.CW):n.frontFace(n.CCW),V=O)}function Pt(O){O!==HH?(Gt(n.CULL_FACE),O!==Mt&&(O===dC?n.cullFace(n.BACK):O===WH?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ct(n.CULL_FACE),Mt=O}function ne(O){O!==$&&(it&&n.lineWidth(O),$=O)}function Y(O,Q,J){O?(Gt(n.POLYGON_OFFSET_FILL),(gt!==Q||ft!==J)&&(n.polygonOffset(Q,J),gt=Q,ft=J)):Ct(n.POLYGON_OFFSET_FILL)}function N(O){O?Gt(n.SCISSOR_TEST):Ct(n.SCISSOR_TEST)}function xt(O){O===void 0&&(O=n.TEXTURE0+vt-1),At!==O&&(n.activeTexture(O),At=O)}function St(O,Q,J){J===void 0&&(At===null?J=n.TEXTURE0+vt-1:J=At);let et=It[J];et===void 0&&(et={type:void 0,texture:void 0},It[J]=et),(et.type!==O||et.texture!==Q)&&(At!==J&&(n.activeTexture(J),At=J),n.bindTexture(O,Q||Ut[O]),et.type=O,et.texture=Q)}function ot(){let O=It[At];O!==void 0&&O.type!==void 0&&(n.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function Lt(){try{n.compressedTexImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function ce(){try{n.compressedTexImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Rt(){try{n.texSubImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Bt(){try{n.texSubImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Wt(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function j(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function b(){try{n.texStorage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function I(){try{n.texStorage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function F(){try{n.texImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function k(){try{n.texImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function G(O){bt.equals(O)===!1&&(n.scissor(O.x,O.y,O.z,O.w),bt.copy(O))}function rt(O){Vt.equals(O)===!1&&(n.viewport(O.x,O.y,O.z,O.w),Vt.copy(O))}function tt(O,Q){let J=y.get(Q);J===void 0&&(J=new WeakMap,y.set(Q,J));let et=J.get(O);et===void 0&&(et=n.getUniformBlockIndex(Q,O.name),J.set(O,et))}function pt(O,Q){let et=y.get(Q).get(O);g.get(Q)!==et&&(n.uniformBlockBinding(Q,et,O.__bindingPointIndex),g.set(Q,et))}function ht(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),i===!0&&(n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),v={},At=null,It={},E={},M=new WeakMap,A=[],_=null,x=!1,T=null,w=null,R=null,B=null,U=null,D=null,P=null,ct=new Te(0,0,0),L=0,W=!1,V=null,Mt=null,$=null,gt=null,ft=null,bt.set(0,0,n.canvas.width,n.canvas.height),Vt.set(0,0,n.canvas.width,n.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:Gt,disable:Ct,bindFramebuffer:ee,drawBuffers:Z,useProgram:Dt,setBlending:wt,setMaterial:Ht,setFlipSided:Xt,setCullFace:Pt,setLineWidth:ne,setPolygonOffset:Y,setScissorTest:N,activeTexture:xt,bindTexture:St,unbindTexture:ot,compressedTexImage2D:Lt,compressedTexImage3D:ce,texImage2D:F,texImage3D:k,updateUBOMapping:tt,uniformBlockBinding:pt,texStorage2D:b,texStorage3D:I,texSubImage2D:Rt,texSubImage3D:Bt,compressedTexSubImage2D:Wt,compressedTexSubImage3D:j,scissor:G,viewport:rt,reset:ht}}function O7(n,t,e,i,s,u,c){let f=s.isWebGL2,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,d=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new Ot,y=new WeakMap,v,E=new WeakMap,M=!1;try{M=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(Y){}function A(Y,N){return M?new OffscreenCanvas(Y,N):Gp("canvas")}function _(Y,N,xt,St){let ot=1,Lt=ne(Y);if((Lt.width>St||Lt.height>St)&&(ot=St/Math.max(Lt.width,Lt.height)),ot<1||N===!0)if(typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Y instanceof ImageBitmap||typeof VideoFrame!="undefined"&&Y instanceof VideoFrame){let ce=N?sv:Math.floor,Rt=ce(ot*Lt.width),Bt=ce(ot*Lt.height);v===void 0&&(v=A(Rt,Bt));let Wt=xt?A(Rt,Bt):v;return Wt.width=Rt,Wt.height=Bt,Wt.getContext("2d").drawImage(Y,0,0,Rt,Bt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Lt.width+"x"+Lt.height+") to ("+Rt+"x"+Bt+")."),Wt}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Lt.width+"x"+Lt.height+")."),Y;return Y}function x(Y){let N=ne(Y);return jC(N.width)&&jC(N.height)}function T(Y){return f?!1:Y.wrapS!==Ro||Y.wrapT!==Ro||Y.minFilter!==bi&&Y.minFilter!==Ni}function w(Y,N){return Y.generateMipmaps&&N&&Y.minFilter!==bi&&Y.minFilter!==Ni}function R(Y){n.generateMipmap(Y)}function B(Y,N,xt,St,ot=!1){if(f===!1)return N;if(Y!==null){if(n[Y]!==void 0)return n[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let Lt=N;if(N===n.RED&&(xt===n.FLOAT&&(Lt=n.R32F),xt===n.HALF_FLOAT&&(Lt=n.R16F),xt===n.UNSIGNED_BYTE&&(Lt=n.R8)),N===n.RED_INTEGER&&(xt===n.UNSIGNED_BYTE&&(Lt=n.R8UI),xt===n.UNSIGNED_SHORT&&(Lt=n.R16UI),xt===n.UNSIGNED_INT&&(Lt=n.R32UI),xt===n.BYTE&&(Lt=n.R8I),xt===n.SHORT&&(Lt=n.R16I),xt===n.INT&&(Lt=n.R32I)),N===n.RG&&(xt===n.FLOAT&&(Lt=n.RG32F),xt===n.HALF_FLOAT&&(Lt=n.RG16F),xt===n.UNSIGNED_BYTE&&(Lt=n.RG8)),N===n.RG_INTEGER&&(xt===n.UNSIGNED_BYTE&&(Lt=n.RG8UI),xt===n.UNSIGNED_SHORT&&(Lt=n.RG16UI),xt===n.UNSIGNED_INT&&(Lt=n.RG32UI),xt===n.BYTE&&(Lt=n.RG8I),xt===n.SHORT&&(Lt=n.RG16I),xt===n.INT&&(Lt=n.RG32I)),N===n.RGBA){let ce=ot?Fp:Rn.getTransfer(St);xt===n.FLOAT&&(Lt=n.RGBA32F),xt===n.HALF_FLOAT&&(Lt=n.RGBA16F),xt===n.UNSIGNED_BYTE&&(Lt=ce===kn?n.SRGB8_ALPHA8:n.RGBA8),xt===n.UNSIGNED_SHORT_4_4_4_4&&(Lt=n.RGBA4),xt===n.UNSIGNED_SHORT_5_5_5_1&&(Lt=n.RGB5_A1)}return(Lt===n.R16F||Lt===n.R32F||Lt===n.RG16F||Lt===n.RG32F||Lt===n.RGBA16F||Lt===n.RGBA32F)&&t.get("EXT_color_buffer_float"),Lt}function U(Y,N,xt){return w(Y,xt)===!0||Y.isFramebufferTexture&&Y.minFilter!==bi&&Y.minFilter!==Ni?Math.log2(Math.max(N.width,N.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?N.mipmaps.length:1}function D(Y){return Y===bi||Y===xC||Y===Qc?n.NEAREST:n.LINEAR}function P(Y){let N=Y.target;N.removeEventListener("dispose",P),L(N),N.isVideoTexture&&y.delete(N)}function ct(Y){let N=Y.target;N.removeEventListener("dispose",ct),V(N)}function L(Y){let N=i.get(Y);if(N.__webglInit===void 0)return;let xt=Y.source,St=E.get(xt);if(St){let ot=St[N.__cacheKey];ot.usedTimes--,ot.usedTimes===0&&W(Y),Object.keys(St).length===0&&E.delete(xt)}i.remove(Y)}function W(Y){let N=i.get(Y);n.deleteTexture(N.__webglTexture);let xt=Y.source,St=E.get(xt);delete St[N.__cacheKey],c.memory.textures--}function V(Y){let N=i.get(Y);if(Y.depthTexture&&Y.depthTexture.dispose(),Y.isWebGLCubeRenderTarget)for(let St=0;St<6;St++){if(Array.isArray(N.__webglFramebuffer[St]))for(let ot=0;ot<N.__webglFramebuffer[St].length;ot++)n.deleteFramebuffer(N.__webglFramebuffer[St][ot]);else n.deleteFramebuffer(N.__webglFramebuffer[St]);N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer[St])}else{if(Array.isArray(N.__webglFramebuffer))for(let St=0;St<N.__webglFramebuffer.length;St++)n.deleteFramebuffer(N.__webglFramebuffer[St]);else n.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&n.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let St=0;St<N.__webglColorRenderbuffer.length;St++)N.__webglColorRenderbuffer[St]&&n.deleteRenderbuffer(N.__webglColorRenderbuffer[St]);N.__webglDepthRenderbuffer&&n.deleteRenderbuffer(N.__webglDepthRenderbuffer)}let xt=Y.textures;for(let St=0,ot=xt.length;St<ot;St++){let Lt=i.get(xt[St]);Lt.__webglTexture&&(n.deleteTexture(Lt.__webglTexture),c.memory.textures--),i.remove(xt[St])}i.remove(Y)}let Mt=0;function $(){Mt=0}function gt(){let Y=Mt;return Y>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+s.maxTextures),Mt+=1,Y}function ft(Y){let N=[];return N.push(Y.wrapS),N.push(Y.wrapT),N.push(Y.wrapR||0),N.push(Y.magFilter),N.push(Y.minFilter),N.push(Y.anisotropy),N.push(Y.internalFormat),N.push(Y.format),N.push(Y.type),N.push(Y.generateMipmaps),N.push(Y.premultiplyAlpha),N.push(Y.flipY),N.push(Y.unpackAlignment),N.push(Y.colorSpace),N.join()}function vt(Y,N){let xt=i.get(Y);if(Y.isVideoTexture&&Xt(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&xt.__version!==Y.version){let St=Y.image;if(St===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(St.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Vt(xt,Y,N);return}}e.bindTexture(n.TEXTURE_2D,xt.__webglTexture,n.TEXTURE0+N)}function it(Y,N){let xt=i.get(Y);if(Y.version>0&&xt.__version!==Y.version){Vt(xt,Y,N);return}e.bindTexture(n.TEXTURE_2D_ARRAY,xt.__webglTexture,n.TEXTURE0+N)}function lt(Y,N){let xt=i.get(Y);if(Y.version>0&&xt.__version!==Y.version){Vt(xt,Y,N);return}e.bindTexture(n.TEXTURE_3D,xt.__webglTexture,n.TEXTURE0+N)}function H(Y,N){let xt=i.get(Y);if(Y.version>0&&xt.__version!==Y.version){$t(xt,Y,N);return}e.bindTexture(n.TEXTURE_CUBE_MAP,xt.__webglTexture,n.TEXTURE0+N)}let At={[ev]:n.REPEAT,[Ro]:n.CLAMP_TO_EDGE,[nv]:n.MIRRORED_REPEAT},It={[bi]:n.NEAREST,[xC]:n.NEAREST_MIPMAP_NEAREST,[Qc]:n.NEAREST_MIPMAP_LINEAR,[Ni]:n.LINEAR,[dy]:n.LINEAR_MIPMAP_NEAREST,[ru]:n.LINEAR_MIPMAP_LINEAR},Kt={[U6]:n.NEVER,[V6]:n.ALWAYS,[B6]:n.LESS,[tP]:n.LEQUAL,[z6]:n.EQUAL,[q6]:n.GEQUAL,[G6]:n.GREATER,[k6]:n.NOTEQUAL};function nt(Y,N,xt){if(N.type===Os&&t.has("OES_texture_float_linear")===!1&&(N.magFilter===Ni||N.magFilter===dy||N.magFilter===Qc||N.magFilter===ru||N.minFilter===Ni||N.minFilter===dy||N.minFilter===Qc||N.minFilter===ru)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),xt?(n.texParameteri(Y,n.TEXTURE_WRAP_S,At[N.wrapS]),n.texParameteri(Y,n.TEXTURE_WRAP_T,At[N.wrapT]),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,At[N.wrapR]),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,It[N.magFilter]),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,It[N.minFilter])):(n.texParameteri(Y,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(Y,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==Ro||N.wrapT!==Ro)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,D(N.magFilter)),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,D(N.minFilter)),N.minFilter!==bi&&N.minFilter!==Ni&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(n.texParameteri(Y,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(Y,n.TEXTURE_COMPARE_FUNC,Kt[N.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===bi||N.minFilter!==Qc&&N.minFilter!==ru||N.type===Os&&t.has("OES_texture_float_linear")===!1||f===!1&&N.type===ff&&t.has("OES_texture_half_float_linear")===!1)return;if(N.anisotropy>1||i.get(N).__currentAnisotropy){let St=t.get("EXT_texture_filter_anisotropic");n.texParameterf(Y,St.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,s.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy}}}function bt(Y,N){let xt=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,N.addEventListener("dispose",P));let St=N.source,ot=E.get(St);ot===void 0&&(ot={},E.set(St,ot));let Lt=ft(N);if(Lt!==Y.__cacheKey){ot[Lt]===void 0&&(ot[Lt]={texture:n.createTexture(),usedTimes:0},c.memory.textures++,xt=!0),ot[Lt].usedTimes++;let ce=ot[Y.__cacheKey];ce!==void 0&&(ot[Y.__cacheKey].usedTimes--,ce.usedTimes===0&&W(N)),Y.__cacheKey=Lt,Y.__webglTexture=ot[Lt].texture}return xt}function Vt(Y,N,xt){let St=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(St=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(St=n.TEXTURE_3D);let ot=bt(Y,N),Lt=N.source;e.bindTexture(St,Y.__webglTexture,n.TEXTURE0+xt);let ce=i.get(Lt);if(Lt.version!==ce.__version||ot===!0){e.activeTexture(n.TEXTURE0+xt);let Rt=Rn.getPrimaries(Rn.workingColorSpace),Bt=N.colorSpace===ha?null:Rn.getPrimaries(N.colorSpace),Wt=N.colorSpace===ha||Rt===Bt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);let j=T(N)&&x(N.image)===!1,b=_(N.image,j,!1,s.maxTextureSize);b=Pt(N,b);let I=x(b)||f,F=u.convert(N.format,N.colorSpace),k=u.convert(N.type),G=B(N.internalFormat,F,k,N.colorSpace,N.isVideoTexture);nt(St,N,I);let rt,tt=N.mipmaps,pt=f&&N.isVideoTexture!==!0&&G!==QI,ht=ce.__version===void 0||ot===!0,O=Lt.dataReady,Q=U(N,b,I);if(N.isDepthTexture)G=n.DEPTH_COMPONENT,f?N.type===Os?G=n.DEPTH_COMPONENT32F:N.type===pa?G=n.DEPTH_COMPONENT24:N.type===su?G=n.DEPTH24_STENCIL8:G=n.DEPTH_COMPONENT16:N.type===Os&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===au&&G===n.DEPTH_COMPONENT&&N.type!==$v&&N.type!==pa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=pa,k=u.convert(N.type)),N.format===Pl&&G===n.DEPTH_COMPONENT&&(G=n.DEPTH_STENCIL,N.type!==su&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=su,k=u.convert(N.type))),ht&&(pt?e.texStorage2D(n.TEXTURE_2D,1,G,b.width,b.height):e.texImage2D(n.TEXTURE_2D,0,G,b.width,b.height,0,F,k,null));else if(N.isDataTexture)if(tt.length>0&&I){pt&&ht&&e.texStorage2D(n.TEXTURE_2D,Q,G,tt[0].width,tt[0].height);for(let J=0,et=tt.length;J<et;J++)rt=tt[J],pt?O&&e.texSubImage2D(n.TEXTURE_2D,J,0,0,rt.width,rt.height,F,k,rt.data):e.texImage2D(n.TEXTURE_2D,J,G,rt.width,rt.height,0,F,k,rt.data);N.generateMipmaps=!1}else pt?(ht&&e.texStorage2D(n.TEXTURE_2D,Q,G,b.width,b.height),O&&e.texSubImage2D(n.TEXTURE_2D,0,0,0,b.width,b.height,F,k,b.data)):e.texImage2D(n.TEXTURE_2D,0,G,b.width,b.height,0,F,k,b.data);else if(N.isCompressedTexture)if(N.isCompressedArrayTexture){pt&&ht&&e.texStorage3D(n.TEXTURE_2D_ARRAY,Q,G,tt[0].width,tt[0].height,b.depth);for(let J=0,et=tt.length;J<et;J++)rt=tt[J],N.format!==Lo?F!==null?pt?O&&e.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,rt.width,rt.height,b.depth,F,rt.data,0,0):e.compressedTexImage3D(n.TEXTURE_2D_ARRAY,J,G,rt.width,rt.height,b.depth,0,rt.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):pt?O&&e.texSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,rt.width,rt.height,b.depth,F,k,rt.data):e.texImage3D(n.TEXTURE_2D_ARRAY,J,G,rt.width,rt.height,b.depth,0,F,k,rt.data)}else{pt&&ht&&e.texStorage2D(n.TEXTURE_2D,Q,G,tt[0].width,tt[0].height);for(let J=0,et=tt.length;J<et;J++)rt=tt[J],N.format!==Lo?F!==null?pt?O&&e.compressedTexSubImage2D(n.TEXTURE_2D,J,0,0,rt.width,rt.height,F,rt.data):e.compressedTexImage2D(n.TEXTURE_2D,J,G,rt.width,rt.height,0,rt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):pt?O&&e.texSubImage2D(n.TEXTURE_2D,J,0,0,rt.width,rt.height,F,k,rt.data):e.texImage2D(n.TEXTURE_2D,J,G,rt.width,rt.height,0,F,k,rt.data)}else if(N.isDataArrayTexture)pt?(ht&&e.texStorage3D(n.TEXTURE_2D_ARRAY,Q,G,b.width,b.height,b.depth),O&&e.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,b.width,b.height,b.depth,F,k,b.data)):e.texImage3D(n.TEXTURE_2D_ARRAY,0,G,b.width,b.height,b.depth,0,F,k,b.data);else if(N.isData3DTexture)pt?(ht&&e.texStorage3D(n.TEXTURE_3D,Q,G,b.width,b.height,b.depth),O&&e.texSubImage3D(n.TEXTURE_3D,0,0,0,0,b.width,b.height,b.depth,F,k,b.data)):e.texImage3D(n.TEXTURE_3D,0,G,b.width,b.height,b.depth,0,F,k,b.data);else if(N.isFramebufferTexture){if(ht)if(pt)e.texStorage2D(n.TEXTURE_2D,Q,G,b.width,b.height);else{let J=b.width,et=b.height;for(let Tt=0;Tt<Q;Tt++)e.texImage2D(n.TEXTURE_2D,Tt,G,J,et,0,F,k,null),J>>=1,et>>=1}}else if(tt.length>0&&I){if(pt&&ht){let J=ne(tt[0]);e.texStorage2D(n.TEXTURE_2D,Q,G,J.width,J.height)}for(let J=0,et=tt.length;J<et;J++)rt=tt[J],pt?O&&e.texSubImage2D(n.TEXTURE_2D,J,0,0,F,k,rt):e.texImage2D(n.TEXTURE_2D,J,G,F,k,rt);N.generateMipmaps=!1}else if(pt){if(ht){let J=ne(b);e.texStorage2D(n.TEXTURE_2D,Q,G,J.width,J.height)}O&&e.texSubImage2D(n.TEXTURE_2D,0,0,0,F,k,b)}else e.texImage2D(n.TEXTURE_2D,0,G,F,k,b);w(N,I)&&R(St),ce.__version=Lt.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function $t(Y,N,xt){if(N.image.length!==6)return;let St=bt(Y,N),ot=N.source;e.bindTexture(n.TEXTURE_CUBE_MAP,Y.__webglTexture,n.TEXTURE0+xt);let Lt=i.get(ot);if(ot.version!==Lt.__version||St===!0){e.activeTexture(n.TEXTURE0+xt);let ce=Rn.getPrimaries(Rn.workingColorSpace),Rt=N.colorSpace===ha?null:Rn.getPrimaries(N.colorSpace),Bt=N.colorSpace===ha||ce===Rt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt);let Wt=N.isCompressedTexture||N.image[0].isCompressedTexture,j=N.image[0]&&N.image[0].isDataTexture,b=[];for(let J=0;J<6;J++)!Wt&&!j?b[J]=_(N.image[J],!1,!0,s.maxCubemapSize):b[J]=j?N.image[J].image:N.image[J],b[J]=Pt(N,b[J]);let I=b[0],F=x(I)||f,k=u.convert(N.format,N.colorSpace),G=u.convert(N.type),rt=B(N.internalFormat,k,G,N.colorSpace),tt=f&&N.isVideoTexture!==!0,pt=Lt.__version===void 0||St===!0,ht=ot.dataReady,O=U(N,I,F);nt(n.TEXTURE_CUBE_MAP,N,F);let Q;if(Wt){tt&&pt&&e.texStorage2D(n.TEXTURE_CUBE_MAP,O,rt,I.width,I.height);for(let J=0;J<6;J++){Q=b[J].mipmaps;for(let et=0;et<Q.length;et++){let Tt=Q[et];N.format!==Lo?k!==null?tt?ht&&e.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,0,0,Tt.width,Tt.height,k,Tt.data):e.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,rt,Tt.width,Tt.height,0,Tt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,0,0,Tt.width,Tt.height,k,G,Tt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,rt,Tt.width,Tt.height,0,k,G,Tt.data)}}}else{if(Q=N.mipmaps,tt&&pt){Q.length>0&&O++;let J=ne(b[0]);e.texStorage2D(n.TEXTURE_CUBE_MAP,O,rt,J.width,J.height)}for(let J=0;J<6;J++)if(j){tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,b[J].width,b[J].height,k,G,b[J].data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,rt,b[J].width,b[J].height,0,k,G,b[J].data);for(let et=0;et<Q.length;et++){let kt=Q[et].image[J].image;tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,0,0,kt.width,kt.height,k,G,kt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,rt,kt.width,kt.height,0,k,G,kt.data)}}else{tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,k,G,b[J]):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,rt,k,G,b[J]);for(let et=0;et<Q.length;et++){let Tt=Q[et];tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,0,0,k,G,Tt.image[J]):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,rt,k,G,Tt.image[J])}}}w(N,F)&&R(n.TEXTURE_CUBE_MAP),Lt.__version=ot.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function Ut(Y,N,xt,St,ot,Lt){let ce=u.convert(xt.format,xt.colorSpace),Rt=u.convert(xt.type),Bt=B(xt.internalFormat,ce,Rt,xt.colorSpace);if(!i.get(N).__hasExternalTextures){let j=Math.max(1,N.width>>Lt),b=Math.max(1,N.height>>Lt);ot===n.TEXTURE_3D||ot===n.TEXTURE_2D_ARRAY?e.texImage3D(ot,Lt,Bt,j,b,N.depth,0,ce,Rt,null):e.texImage2D(ot,Lt,Bt,j,b,0,ce,Rt,null)}e.bindFramebuffer(n.FRAMEBUFFER,Y),Ht(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,St,ot,i.get(xt).__webglTexture,0,wt(N)):(ot===n.TEXTURE_2D||ot>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ot<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,St,ot,i.get(xt).__webglTexture,Lt),e.bindFramebuffer(n.FRAMEBUFFER,null)}function Gt(Y,N,xt){if(n.bindRenderbuffer(n.RENDERBUFFER,Y),N.depthBuffer&&!N.stencilBuffer){let St=f===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(xt||Ht(N)){let ot=N.depthTexture;ot&&ot.isDepthTexture&&(ot.type===Os?St=n.DEPTH_COMPONENT32F:ot.type===pa&&(St=n.DEPTH_COMPONENT24));let Lt=wt(N);Ht(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Lt,St,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Lt,St,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,St,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,Y)}else if(N.depthBuffer&&N.stencilBuffer){let St=wt(N);xt&&Ht(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,St,n.DEPTH24_STENCIL8,N.width,N.height):Ht(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,St,n.DEPTH24_STENCIL8,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,Y)}else{let St=N.textures;for(let ot=0;ot<St.length;ot++){let Lt=St[ot],ce=u.convert(Lt.format,Lt.colorSpace),Rt=u.convert(Lt.type),Bt=B(Lt.internalFormat,ce,Rt,Lt.colorSpace),Wt=wt(N);xt&&Ht(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Wt,Bt,N.width,N.height):Ht(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Wt,Bt,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,Bt,N.width,N.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ct(Y,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(n.FRAMEBUFFER,Y),!(N.depthTexture&&N.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(N.depthTexture).__webglTexture||N.depthTexture.image.width!==N.width||N.depthTexture.image.height!==N.height)&&(N.depthTexture.image.width=N.width,N.depthTexture.image.height=N.height,N.depthTexture.needsUpdate=!0),vt(N.depthTexture,0);let St=i.get(N.depthTexture).__webglTexture,ot=wt(N);if(N.depthTexture.format===au)Ht(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,St,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,St,0);else if(N.depthTexture.format===Pl)Ht(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,St,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,St,0);else throw new Error("Unknown depthTexture format")}function ee(Y){let N=i.get(Y),xt=Y.isWebGLCubeRenderTarget===!0;if(Y.depthTexture&&!N.__autoAllocateDepthBuffer){if(xt)throw new Error("target.depthTexture not supported in Cube render targets");Ct(N.__webglFramebuffer,Y)}else if(xt){N.__webglDepthbuffer=[];for(let St=0;St<6;St++)e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer[St]),N.__webglDepthbuffer[St]=n.createRenderbuffer(),Gt(N.__webglDepthbuffer[St],Y,!1)}else e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=n.createRenderbuffer(),Gt(N.__webglDepthbuffer,Y,!1);e.bindFramebuffer(n.FRAMEBUFFER,null)}function Z(Y,N,xt){let St=i.get(Y);N!==void 0&&Ut(St.__webglFramebuffer,Y,Y.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),xt!==void 0&&ee(Y)}function Dt(Y){let N=Y.texture,xt=i.get(Y),St=i.get(N);Y.addEventListener("dispose",ct);let ot=Y.textures,Lt=Y.isWebGLCubeRenderTarget===!0,ce=ot.length>1,Rt=x(Y)||f;if(ce||(St.__webglTexture===void 0&&(St.__webglTexture=n.createTexture()),St.__version=N.version,c.memory.textures++),Lt){xt.__webglFramebuffer=[];for(let Bt=0;Bt<6;Bt++)if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer[Bt]=[];for(let Wt=0;Wt<N.mipmaps.length;Wt++)xt.__webglFramebuffer[Bt][Wt]=n.createFramebuffer()}else xt.__webglFramebuffer[Bt]=n.createFramebuffer()}else{if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer=[];for(let Bt=0;Bt<N.mipmaps.length;Bt++)xt.__webglFramebuffer[Bt]=n.createFramebuffer()}else xt.__webglFramebuffer=n.createFramebuffer();if(ce)if(s.drawBuffers)for(let Bt=0,Wt=ot.length;Bt<Wt;Bt++){let j=i.get(ot[Bt]);j.__webglTexture===void 0&&(j.__webglTexture=n.createTexture(),c.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(f&&Y.samples>0&&Ht(Y)===!1){xt.__webglMultisampledFramebuffer=n.createFramebuffer(),xt.__webglColorRenderbuffer=[],e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglMultisampledFramebuffer);for(let Bt=0;Bt<ot.length;Bt++){let Wt=ot[Bt];xt.__webglColorRenderbuffer[Bt]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,xt.__webglColorRenderbuffer[Bt]);let j=u.convert(Wt.format,Wt.colorSpace),b=u.convert(Wt.type),I=B(Wt.internalFormat,j,b,Wt.colorSpace,Y.isXRRenderTarget===!0),F=wt(Y);n.renderbufferStorageMultisample(n.RENDERBUFFER,F,I,Y.width,Y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Bt,n.RENDERBUFFER,xt.__webglColorRenderbuffer[Bt])}n.bindRenderbuffer(n.RENDERBUFFER,null),Y.depthBuffer&&(xt.__webglDepthRenderbuffer=n.createRenderbuffer(),Gt(xt.__webglDepthRenderbuffer,Y,!0)),e.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Lt){e.bindTexture(n.TEXTURE_CUBE_MAP,St.__webglTexture),nt(n.TEXTURE_CUBE_MAP,N,Rt);for(let Bt=0;Bt<6;Bt++)if(f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ut(xt.__webglFramebuffer[Bt][Wt],Y,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Bt,Wt);else Ut(xt.__webglFramebuffer[Bt],Y,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Bt,0);w(N,Rt)&&R(n.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(ce){for(let Bt=0,Wt=ot.length;Bt<Wt;Bt++){let j=ot[Bt],b=i.get(j);e.bindTexture(n.TEXTURE_2D,b.__webglTexture),nt(n.TEXTURE_2D,j,Rt),Ut(xt.__webglFramebuffer,Y,j,n.COLOR_ATTACHMENT0+Bt,n.TEXTURE_2D,0),w(j,Rt)&&R(n.TEXTURE_2D)}e.unbindTexture()}else{let Bt=n.TEXTURE_2D;if((Y.isWebGL3DRenderTarget||Y.isWebGLArrayRenderTarget)&&(f?Bt=Y.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Bt,St.__webglTexture),nt(Bt,N,Rt),f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ut(xt.__webglFramebuffer[Wt],Y,N,n.COLOR_ATTACHMENT0,Bt,Wt);else Ut(xt.__webglFramebuffer,Y,N,n.COLOR_ATTACHMENT0,Bt,0);w(N,Rt)&&R(Bt),e.unbindTexture()}Y.depthBuffer&&ee(Y)}function _t(Y){let N=x(Y)||f,xt=Y.textures;for(let St=0,ot=xt.length;St<ot;St++){let Lt=xt[St];if(w(Lt,N)){let ce=Y.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Rt=i.get(Lt).__webglTexture;e.bindTexture(ce,Rt),R(ce),e.unbindTexture()}}}function Nt(Y){if(f&&Y.samples>0&&Ht(Y)===!1){let N=Y.textures,xt=Y.width,St=Y.height,ot=n.COLOR_BUFFER_BIT,Lt=[],ce=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Rt=i.get(Y),Bt=N.length>1;if(Bt)for(let Wt=0;Wt<N.length;Wt++)e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.RENDERBUFFER,null),e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.TEXTURE_2D,null,0);e.bindFramebuffer(n.READ_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer);for(let Wt=0;Wt<N.length;Wt++){Lt.push(n.COLOR_ATTACHMENT0+Wt),Y.depthBuffer&&Lt.push(ce);let j=Rt.__ignoreDepthValues!==void 0?Rt.__ignoreDepthValues:!1;if(j===!1&&(Y.depthBuffer&&(ot|=n.DEPTH_BUFFER_BIT),Y.stencilBuffer&&(ot|=n.STENCIL_BUFFER_BIT)),Bt&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Rt.__webglColorRenderbuffer[Wt]),j===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[ce]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[ce])),Bt){let b=i.get(N[Wt]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b,0)}n.blitFramebuffer(0,0,xt,St,0,0,xt,St,ot,n.NEAREST),d&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Lt)}if(e.bindFramebuffer(n.READ_FRAMEBUFFER,null),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Bt)for(let Wt=0;Wt<N.length;Wt++){e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.RENDERBUFFER,Rt.__webglColorRenderbuffer[Wt]);let j=i.get(N[Wt]).__webglTexture;e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.TEXTURE_2D,j,0)}e.bindFramebuffer(n.DRAW_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer)}}function wt(Y){return Math.min(s.maxSamples,Y.samples)}function Ht(Y){let N=i.get(Y);return f&&Y.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function Xt(Y){let N=c.render.frame;y.get(Y)!==N&&(y.set(Y,N),Y.update())}function Pt(Y,N){let xt=Y.colorSpace,St=Y.format,ot=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||Y.format===iv||xt!==xa&&xt!==ha&&(Rn.getTransfer(xt)===kn?f===!1?t.has("EXT_sRGB")===!0&&St===Lo?(Y.format=iv,Y.minFilter=Ni,Y.generateMipmaps=!1):N=kp.sRGBToLinear(N):(St!==Lo||ot!==ma)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xt)),N}function ne(Y){return typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement?(g.width=Y.naturalWidth||Y.width,g.height=Y.naturalHeight||Y.height):typeof VideoFrame!="undefined"&&Y instanceof VideoFrame?(g.width=Y.displayWidth,g.height=Y.displayHeight):(g.width=Y.width,g.height=Y.height),g}this.allocateTextureUnit=gt,this.resetTextureUnits=$,this.setTexture2D=vt,this.setTexture2DArray=it,this.setTexture3D=lt,this.setTextureCube=H,this.rebindTextures=Z,this.setupRenderTarget=Dt,this.updateRenderTargetMipmap=_t,this.updateMultisampleRenderTarget=Nt,this.setupDepthRenderbuffer=ee,this.setupFrameBufferTexture=Ut,this.useMultisampledRTT=Ht}function D7(n,t,e){let i=e.isWebGL2;function s(u,c=ha){let f,p=Rn.getTransfer(c);if(u===ma)return n.UNSIGNED_BYTE;if(u===$I)return n.UNSIGNED_SHORT_4_4_4_4;if(u===ZI)return n.UNSIGNED_SHORT_5_5_5_1;if(u===b6)return n.BYTE;if(u===A6)return n.SHORT;if(u===$v)return n.UNSIGNED_SHORT;if(u===YI)return n.INT;if(u===pa)return n.UNSIGNED_INT;if(u===Os)return n.FLOAT;if(u===ff)return i?n.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(u===T6)return n.ALPHA;if(u===Lo)return n.RGBA;if(u===C6)return n.LUMINANCE;if(u===I6)return n.LUMINANCE_ALPHA;if(u===au)return n.DEPTH_COMPONENT;if(u===Pl)return n.DEPTH_STENCIL;if(u===iv)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(u===P6)return n.RED;if(u===JI)return n.RED_INTEGER;if(u===R6)return n.RG;if(u===jI)return n.RG_INTEGER;if(u===KI)return n.RGBA_INTEGER;if(u===gy||u===my||u===yy||u===vy)if(p===kn)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(u===gy)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(u===my)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(u===yy)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(u===vy)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(u===gy)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(u===my)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(u===yy)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(u===vy)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(u===EC||u===SC||u===wC||u===MC)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(u===EC)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(u===SC)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(u===wC)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(u===MC)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(u===QI)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(u===bC||u===AC)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(u===bC)return p===kn?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(u===AC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(u===TC||u===CC||u===IC||u===PC||u===RC||u===LC||u===NC||u===OC||u===DC||u===FC||u===UC||u===BC||u===zC||u===GC)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(u===TC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(u===CC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(u===IC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(u===PC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(u===RC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(u===LC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(u===NC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(u===OC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(u===DC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(u===FC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(u===UC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(u===BC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(u===zC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(u===GC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(u===_y||u===kC||u===qC)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(u===_y)return p===kn?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(u===kC)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(u===qC)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(u===L6||u===VC||u===HC||u===WC)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(u===_y)return f.COMPRESSED_RED_RGTC1_EXT;if(u===VC)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(u===HC)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(u===WC)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return u===su?i?n.UNSIGNED_INT_24_8:(f=t.get("WEBGL_depth_texture"),f!==null?f.UNSIGNED_INT_24_8_WEBGL:null):n[u]!==void 0?n[u]:null}return{convert:s}}var Ev=class extends Zi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},ou=class extends Oo{constructor(){super(),this.isGroup=!0,this.type="Group"}},F7={type:"move"},uf=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ou,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ou,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new st,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new st),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ou,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new st,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new st),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,i){let s=null,u=null,c=null,f=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){c=!0;for(let A of t.hand.values()){let _=e.getJointPose(A,i),x=this._getHandJoint(d,A);_!==null&&(x.matrix.fromArray(_.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=_.radius),x.visible=_!==null}let g=d.joints["index-finger-tip"],y=d.joints["thumb-tip"],v=g.position.distanceTo(y.position),E=.02,M=.005;d.inputState.pinching&&v>E+M?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&v<=E-M&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(u=e.getPose(t.gripSpace,i),u!==null&&(p.matrix.fromArray(u.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,u.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(u.linearVelocity)):p.hasLinearVelocity=!1,u.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(u.angularVelocity)):p.hasAngularVelocity=!1));f!==null&&(s=e.getPose(t.targetRaySpace,i),s===null&&u!==null&&(s=u),s!==null&&(f.matrix.fromArray(s.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,s.linearVelocity?(f.hasLinearVelocity=!0,f.linearVelocity.copy(s.linearVelocity)):f.hasLinearVelocity=!1,s.angularVelocity?(f.hasAngularVelocity=!0,f.angularVelocity.copy(s.angularVelocity)):f.hasAngularVelocity=!1,this.dispatchEvent(F7)))}return f!==null&&(f.visible=s!==null),p!==null&&(p.visible=u!==null),d!==null&&(d.visible=c!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let i=new ou;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},U7=`
3781
+ }`;function L7(n,t,e){let i=new Jp,s=new Ot,u=new Ot,c=new Yr,f=new _v({depthPacking:O6}),p=new xv,d={},g=e.maxTextureSize,y={[va]:Oi,[Oi]:va,[Ns]:Ns},v=new ts({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ot},radius:{value:4}},vertexShader:P7,fragmentShader:R7}),E=v.clone();E.defines.HORIZONTAL_PASS=1;let M=new ui;M.setAttribute("position",new Zn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let A=new No(M,v),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=HI;let x=this.type;this.render=function(U,D,P){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||U.length===0)return;let ct=n.getRenderTarget(),L=n.getActiveCubeFace(),W=n.getActiveMipmapLevel(),V=n.state;V.setBlending(da),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Mt=x!==Rs&&this.type===Rs,$=x===Rs&&this.type!==Rs;for(let gt=0,ft=U.length;gt<ft;gt++){let vt=U[gt],it=vt.shadow;if(it===void 0){console.warn("THREE.WebGLShadowMap:",vt,"has no shadow.");continue}if(it.autoUpdate===!1&&it.needsUpdate===!1)continue;s.copy(it.mapSize);let lt=it.getFrameExtents();if(s.multiply(lt),u.copy(it.mapSize),(s.x>g||s.y>g)&&(s.x>g&&(u.x=Math.floor(g/lt.x),s.x=u.x*lt.x,it.mapSize.x=u.x),s.y>g&&(u.y=Math.floor(g/lt.y),s.y=u.y*lt.y,it.mapSize.y=u.y)),it.map===null||Mt===!0||$===!0){let At=this.type!==Rs?{minFilter:bi,magFilter:bi}:{};it.map!==null&&it.map.dispose(),it.map=new Us(s.x,s.y,At),it.map.texture.name=vt.name+".shadowMap",it.camera.updateProjectionMatrix()}n.setRenderTarget(it.map),n.clear();let H=it.getViewportCount();for(let At=0;At<H;At++){let It=it.getViewport(At);c.set(u.x*It.x,u.y*It.y,u.x*It.z,u.y*It.w),V.viewport(c),it.updateMatrices(vt,At),i=it.getFrustum(),R(D,P,it.camera,vt,this.type)}it.isPointLightShadow!==!0&&this.type===Rs&&T(it,P),it.needsUpdate=!1}x=this.type,_.needsUpdate=!1,n.setRenderTarget(ct,L,W)},this.dispose=function(){M.dispose(),M=null,v.dispose(),v=null,E.dispose(),E=null,A.clear()};function T(U,D){let P=t.update(A);v.defines.VSM_SAMPLES!==U.blurSamples&&(v.defines.VSM_SAMPLES=U.blurSamples,E.defines.VSM_SAMPLES=U.blurSamples,v.needsUpdate=!0,E.needsUpdate=!0),U.mapPass===null&&(U.mapPass=new Us(s.x,s.y)),v.uniforms.shadow_pass.value=U.map.texture,v.uniforms.resolution.value=U.mapSize,v.uniforms.radius.value=U.radius,n.setRenderTarget(U.mapPass),n.clear(),n.renderBufferDirect(D,null,P,v,A,null),E.uniforms.shadow_pass.value=U.mapPass.texture,E.uniforms.resolution.value=U.mapSize,E.uniforms.radius.value=U.radius,n.setRenderTarget(U.map),n.clear(),n.renderBufferDirect(D,null,P,E,A,null)}function w(U,D,P,ct){let L=null,W=P.isPointLight===!0?U.customDistanceMaterial:U.customDepthMaterial;if(W!==void 0)L=W;else if(L=P.isPointLight===!0?p:f,n.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0){let V=L.uuid,Mt=D.uuid,$=d[V];$===void 0&&($={},d[V]=$);let gt=$[Mt];gt===void 0&&(gt=L.clone(),$[Mt]=gt,D.addEventListener("dispose",B)),L=gt}if(L.visible=D.visible,L.wireframe=D.wireframe,ct===Rs?L.side=D.shadowSide!==null?D.shadowSide:D.side:L.side=D.shadowSide!==null?D.shadowSide:y[D.side],L.alphaMap=D.alphaMap,L.alphaTest=D.alphaTest,L.map=D.map,L.clipShadows=D.clipShadows,L.clippingPlanes=D.clippingPlanes,L.clipIntersection=D.clipIntersection,L.displacementMap=D.displacementMap,L.displacementScale=D.displacementScale,L.displacementBias=D.displacementBias,L.wireframeLinewidth=D.wireframeLinewidth,L.linewidth=D.linewidth,P.isPointLight===!0&&L.isMeshDistanceMaterial===!0){let V=n.properties.get(L);V.light=P}return L}function R(U,D,P,ct,L){if(U.visible===!1)return;if(U.layers.test(D.layers)&&(U.isMesh||U.isLine||U.isPoints)&&(U.castShadow||U.receiveShadow&&L===Rs)&&(!U.frustumCulled||i.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,U.matrixWorld);let Mt=t.update(U),$=U.material;if(Array.isArray($)){let gt=Mt.groups;for(let ft=0,vt=gt.length;ft<vt;ft++){let it=gt[ft],lt=$[it.materialIndex];if(lt&&lt.visible){let H=w(U,lt,ct,L);U.onBeforeShadow(n,U,D,P,Mt,H,it),n.renderBufferDirect(P,null,Mt,H,U,it),U.onAfterShadow(n,U,D,P,Mt,H,it)}}}else if($.visible){let gt=w(U,$,ct,L);U.onBeforeShadow(n,U,D,P,Mt,gt,null),n.renderBufferDirect(P,null,Mt,gt,U,null),U.onAfterShadow(n,U,D,P,Mt,gt,null)}}let V=U.children;for(let Mt=0,$=V.length;Mt<$;Mt++)R(V[Mt],D,P,ct,L)}function B(U){U.target.removeEventListener("dispose",B);for(let P in d){let ct=d[P],L=U.target.uuid;L in ct&&(ct[L].dispose(),delete ct[L])}}}function N7(n,t,e){let i=e.isWebGL2;function s(){let O=!1,Q=new Yr,J=null,et=new Yr(0,0,0,0);return{setMask:function(Tt){J!==Tt&&!O&&(n.colorMask(Tt,Tt,Tt,Tt),J=Tt)},setLocked:function(Tt){O=Tt},setClear:function(Tt,kt,ie,oe,we){we===!0&&(Tt*=oe,kt*=oe,ie*=oe),Q.set(Tt,kt,ie,oe),et.equals(Q)===!1&&(n.clearColor(Tt,kt,ie,oe),et.copy(Q))},reset:function(){O=!1,J=null,et.set(-1,0,0,0)}}}function u(){let O=!1,Q=null,J=null,et=null;return{setTest:function(Tt){Tt?Gt(n.DEPTH_TEST):Ct(n.DEPTH_TEST)},setMask:function(Tt){Q!==Tt&&!O&&(n.depthMask(Tt),Q=Tt)},setFunc:function(Tt){if(J!==Tt){switch(Tt){case l6:n.depthFunc(n.NEVER);break;case c6:n.depthFunc(n.ALWAYS);break;case f6:n.depthFunc(n.LESS);break;case Np:n.depthFunc(n.LEQUAL);break;case h6:n.depthFunc(n.EQUAL);break;case p6:n.depthFunc(n.GEQUAL);break;case d6:n.depthFunc(n.GREATER);break;case g6:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}J=Tt}},setLocked:function(Tt){O=Tt},setClear:function(Tt){et!==Tt&&(n.clearDepth(Tt),et=Tt)},reset:function(){O=!1,Q=null,J=null,et=null}}}function c(){let O=!1,Q=null,J=null,et=null,Tt=null,kt=null,ie=null,oe=null,we=null;return{setTest:function(ye){O||(ye?Gt(n.STENCIL_TEST):Ct(n.STENCIL_TEST))},setMask:function(ye){Q!==ye&&!O&&(n.stencilMask(ye),Q=ye)},setFunc:function(ye,be,Ae){(J!==ye||et!==be||Tt!==Ae)&&(n.stencilFunc(ye,be,Ae),J=ye,et=be,Tt=Ae)},setOp:function(ye,be,Ae){(kt!==ye||ie!==be||oe!==Ae)&&(n.stencilOp(ye,be,Ae),kt=ye,ie=be,oe=Ae)},setLocked:function(ye){O=ye},setClear:function(ye){we!==ye&&(n.clearStencil(ye),we=ye)},reset:function(){O=!1,Q=null,J=null,et=null,Tt=null,kt=null,ie=null,oe=null,we=null}}}let f=new s,p=new u,d=new c,g=new WeakMap,y=new WeakMap,v={},E={},M=new WeakMap,A=[],_=null,x=!1,T=null,w=null,R=null,B=null,U=null,D=null,P=null,ct=new Te(0,0,0),L=0,W=!1,V=null,Mt=null,$=null,gt=null,ft=null,vt=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),it=!1,lt=0,H=n.getParameter(n.VERSION);H.indexOf("WebGL")!==-1?(lt=parseFloat(/^WebGL (\d)/.exec(H)[1]),it=lt>=1):H.indexOf("OpenGL ES")!==-1&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),it=lt>=2);let At=null,It={},Kt=n.getParameter(n.SCISSOR_BOX),nt=n.getParameter(n.VIEWPORT),bt=new Yr().fromArray(Kt),Vt=new Yr().fromArray(nt);function $t(O,Q,J,et){let Tt=new Uint8Array(4),kt=n.createTexture();n.bindTexture(O,kt),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ie=0;ie<J;ie++)i&&(O===n.TEXTURE_3D||O===n.TEXTURE_2D_ARRAY)?n.texImage3D(Q,0,n.RGBA,1,1,et,0,n.RGBA,n.UNSIGNED_BYTE,Tt):n.texImage2D(Q+ie,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Tt);return kt}let Ut={};Ut[n.TEXTURE_2D]=$t(n.TEXTURE_2D,n.TEXTURE_2D,1),Ut[n.TEXTURE_CUBE_MAP]=$t(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Ut[n.TEXTURE_2D_ARRAY]=$t(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Ut[n.TEXTURE_3D]=$t(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Gt(n.DEPTH_TEST),p.setFunc(Np),Xt(!1),Pt(dC),Gt(n.CULL_FACE),wt(da);function Gt(O){v[O]!==!0&&(n.enable(O),v[O]=!0)}function Ct(O){v[O]!==!1&&(n.disable(O),v[O]=!1)}function ee(O,Q){return E[O]!==Q?(n.bindFramebuffer(O,Q),E[O]=Q,i&&(O===n.DRAW_FRAMEBUFFER&&(E[n.FRAMEBUFFER]=Q),O===n.FRAMEBUFFER&&(E[n.DRAW_FRAMEBUFFER]=Q)),!0):!1}function Z(O,Q){let J=A,et=!1;if(O){J=M.get(Q),J===void 0&&(J=[],M.set(Q,J));let Tt=O.textures;if(J.length!==Tt.length||J[0]!==n.COLOR_ATTACHMENT0){for(let kt=0,ie=Tt.length;kt<ie;kt++)J[kt]=n.COLOR_ATTACHMENT0+kt;J.length=Tt.length,et=!0}}else J[0]!==n.BACK&&(J[0]=n.BACK,et=!0);if(et)if(e.isWebGL2)n.drawBuffers(J);else if(t.has("WEBGL_draw_buffers")===!0)t.get("WEBGL_draw_buffers").drawBuffersWEBGL(J);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function Dt(O){return _!==O?(n.useProgram(O),_=O,!0):!1}let _t={[eu]:n.FUNC_ADD,[$H]:n.FUNC_SUBTRACT,[ZH]:n.FUNC_REVERSE_SUBTRACT};if(i)_t[vC]=n.MIN,_t[_C]=n.MAX;else{let O=t.get("EXT_blend_minmax");O!==null&&(_t[vC]=O.MIN_EXT,_t[_C]=O.MAX_EXT)}let Nt={[JH]:n.ZERO,[jH]:n.ONE,[KH]:n.SRC_COLOR,[jy]:n.SRC_ALPHA,[i6]:n.SRC_ALPHA_SATURATE,[n6]:n.DST_COLOR,[t6]:n.DST_ALPHA,[QH]:n.ONE_MINUS_SRC_COLOR,[Ky]:n.ONE_MINUS_SRC_ALPHA,[r6]:n.ONE_MINUS_DST_COLOR,[e6]:n.ONE_MINUS_DST_ALPHA,[o6]:n.CONSTANT_COLOR,[s6]:n.ONE_MINUS_CONSTANT_COLOR,[a6]:n.CONSTANT_ALPHA,[u6]:n.ONE_MINUS_CONSTANT_ALPHA};function wt(O,Q,J,et,Tt,kt,ie,oe,we,ye){if(O===da){x===!0&&(Ct(n.BLEND),x=!1);return}if(x===!1&&(Gt(n.BLEND),x=!0),O!==YH){if(O!==T||ye!==W){if((w!==eu||U!==eu)&&(n.blendEquation(n.FUNC_ADD),w=eu,U=eu),ye)switch(O){case bl:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case gC:n.blendFunc(n.ONE,n.ONE);break;case mC:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case yC:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}else switch(O){case bl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case gC:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case mC:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case yC:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}R=null,B=null,D=null,P=null,ct.set(0,0,0),L=0,T=O,W=ye}return}Tt=Tt||Q,kt=kt||J,ie=ie||et,(Q!==w||Tt!==U)&&(n.blendEquationSeparate(_t[Q],_t[Tt]),w=Q,U=Tt),(J!==R||et!==B||kt!==D||ie!==P)&&(n.blendFuncSeparate(Nt[J],Nt[et],Nt[kt],Nt[ie]),R=J,B=et,D=kt,P=ie),(oe.equals(ct)===!1||we!==L)&&(n.blendColor(oe.r,oe.g,oe.b,we),ct.copy(oe),L=we),T=O,W=!1}function Ht(O,Q){O.side===Ns?Ct(n.CULL_FACE):Gt(n.CULL_FACE);let J=O.side===Oi;Q&&(J=!J),Xt(J),O.blending===bl&&O.transparent===!1?wt(da):wt(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),p.setFunc(O.depthFunc),p.setTest(O.depthTest),p.setMask(O.depthWrite),f.setMask(O.colorWrite);let et=O.stencilWrite;d.setTest(et),et&&(d.setMask(O.stencilWriteMask),d.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),d.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),Y(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?Gt(n.SAMPLE_ALPHA_TO_COVERAGE):Ct(n.SAMPLE_ALPHA_TO_COVERAGE)}function Xt(O){V!==O&&(O?n.frontFace(n.CW):n.frontFace(n.CCW),V=O)}function Pt(O){O!==HH?(Gt(n.CULL_FACE),O!==Mt&&(O===dC?n.cullFace(n.BACK):O===WH?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ct(n.CULL_FACE),Mt=O}function ne(O){O!==$&&(it&&n.lineWidth(O),$=O)}function Y(O,Q,J){O?(Gt(n.POLYGON_OFFSET_FILL),(gt!==Q||ft!==J)&&(n.polygonOffset(Q,J),gt=Q,ft=J)):Ct(n.POLYGON_OFFSET_FILL)}function N(O){O?Gt(n.SCISSOR_TEST):Ct(n.SCISSOR_TEST)}function xt(O){O===void 0&&(O=n.TEXTURE0+vt-1),At!==O&&(n.activeTexture(O),At=O)}function St(O,Q,J){J===void 0&&(At===null?J=n.TEXTURE0+vt-1:J=At);let et=It[J];et===void 0&&(et={type:void 0,texture:void 0},It[J]=et),(et.type!==O||et.texture!==Q)&&(At!==J&&(n.activeTexture(J),At=J),n.bindTexture(O,Q||Ut[O]),et.type=O,et.texture=Q)}function ot(){let O=It[At];O!==void 0&&O.type!==void 0&&(n.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function Lt(){try{n.compressedTexImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function ce(){try{n.compressedTexImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Rt(){try{n.texSubImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Bt(){try{n.texSubImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Wt(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function j(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function b(){try{n.texStorage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function I(){try{n.texStorage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function F(){try{n.texImage2D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function k(){try{n.texImage3D.apply(n,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function G(O){bt.equals(O)===!1&&(n.scissor(O.x,O.y,O.z,O.w),bt.copy(O))}function rt(O){Vt.equals(O)===!1&&(n.viewport(O.x,O.y,O.z,O.w),Vt.copy(O))}function tt(O,Q){let J=y.get(Q);J===void 0&&(J=new WeakMap,y.set(Q,J));let et=J.get(O);et===void 0&&(et=n.getUniformBlockIndex(Q,O.name),J.set(O,et))}function pt(O,Q){let et=y.get(Q).get(O);g.get(Q)!==et&&(n.uniformBlockBinding(Q,et,O.__bindingPointIndex),g.set(Q,et))}function ht(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),i===!0&&(n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),v={},At=null,It={},E={},M=new WeakMap,A=[],_=null,x=!1,T=null,w=null,R=null,B=null,U=null,D=null,P=null,ct=new Te(0,0,0),L=0,W=!1,V=null,Mt=null,$=null,gt=null,ft=null,bt.set(0,0,n.canvas.width,n.canvas.height),Vt.set(0,0,n.canvas.width,n.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:Gt,disable:Ct,bindFramebuffer:ee,drawBuffers:Z,useProgram:Dt,setBlending:wt,setMaterial:Ht,setFlipSided:Xt,setCullFace:Pt,setLineWidth:ne,setPolygonOffset:Y,setScissorTest:N,activeTexture:xt,bindTexture:St,unbindTexture:ot,compressedTexImage2D:Lt,compressedTexImage3D:ce,texImage2D:F,texImage3D:k,updateUBOMapping:tt,uniformBlockBinding:pt,texStorage2D:b,texStorage3D:I,texSubImage2D:Rt,texSubImage3D:Bt,compressedTexSubImage2D:Wt,compressedTexSubImage3D:j,scissor:G,viewport:rt,reset:ht}}function O7(n,t,e,i,s,u,c){let f=s.isWebGL2,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,d=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new Ot,y=new WeakMap,v,E=new WeakMap,M=!1;try{M=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(Y){}function A(Y,N){return M?new OffscreenCanvas(Y,N):Gp("canvas")}function _(Y,N,xt,St){let ot=1,Lt=ne(Y);if((Lt.width>St||Lt.height>St)&&(ot=St/Math.max(Lt.width,Lt.height)),ot<1||N===!0)if(typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Y instanceof ImageBitmap||typeof VideoFrame!="undefined"&&Y instanceof VideoFrame){let ce=N?sv:Math.floor,Rt=ce(ot*Lt.width),Bt=ce(ot*Lt.height);v===void 0&&(v=A(Rt,Bt));let Wt=xt?A(Rt,Bt):v;return Wt.width=Rt,Wt.height=Bt,Wt.getContext("2d").drawImage(Y,0,0,Rt,Bt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Lt.width+"x"+Lt.height+") to ("+Rt+"x"+Bt+")."),Wt}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Lt.width+"x"+Lt.height+")."),Y;return Y}function x(Y){let N=ne(Y);return jC(N.width)&&jC(N.height)}function T(Y){return f?!1:Y.wrapS!==Ro||Y.wrapT!==Ro||Y.minFilter!==bi&&Y.minFilter!==Ni}function w(Y,N){return Y.generateMipmaps&&N&&Y.minFilter!==bi&&Y.minFilter!==Ni}function R(Y){n.generateMipmap(Y)}function B(Y,N,xt,St,ot=!1){if(f===!1)return N;if(Y!==null){if(n[Y]!==void 0)return n[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let Lt=N;if(N===n.RED&&(xt===n.FLOAT&&(Lt=n.R32F),xt===n.HALF_FLOAT&&(Lt=n.R16F),xt===n.UNSIGNED_BYTE&&(Lt=n.R8)),N===n.RED_INTEGER&&(xt===n.UNSIGNED_BYTE&&(Lt=n.R8UI),xt===n.UNSIGNED_SHORT&&(Lt=n.R16UI),xt===n.UNSIGNED_INT&&(Lt=n.R32UI),xt===n.BYTE&&(Lt=n.R8I),xt===n.SHORT&&(Lt=n.R16I),xt===n.INT&&(Lt=n.R32I)),N===n.RG&&(xt===n.FLOAT&&(Lt=n.RG32F),xt===n.HALF_FLOAT&&(Lt=n.RG16F),xt===n.UNSIGNED_BYTE&&(Lt=n.RG8)),N===n.RG_INTEGER&&(xt===n.UNSIGNED_BYTE&&(Lt=n.RG8UI),xt===n.UNSIGNED_SHORT&&(Lt=n.RG16UI),xt===n.UNSIGNED_INT&&(Lt=n.RG32UI),xt===n.BYTE&&(Lt=n.RG8I),xt===n.SHORT&&(Lt=n.RG16I),xt===n.INT&&(Lt=n.RG32I)),N===n.RGBA){let ce=ot?Fp:Rn.getTransfer(St);xt===n.FLOAT&&(Lt=n.RGBA32F),xt===n.HALF_FLOAT&&(Lt=n.RGBA16F),xt===n.UNSIGNED_BYTE&&(Lt=ce===kn?n.SRGB8_ALPHA8:n.RGBA8),xt===n.UNSIGNED_SHORT_4_4_4_4&&(Lt=n.RGBA4),xt===n.UNSIGNED_SHORT_5_5_5_1&&(Lt=n.RGB5_A1)}return(Lt===n.R16F||Lt===n.R32F||Lt===n.RG16F||Lt===n.RG32F||Lt===n.RGBA16F||Lt===n.RGBA32F)&&t.get("EXT_color_buffer_float"),Lt}function U(Y,N,xt){return w(Y,xt)===!0||Y.isFramebufferTexture&&Y.minFilter!==bi&&Y.minFilter!==Ni?Math.log2(Math.max(N.width,N.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?N.mipmaps.length:1}function D(Y){return Y===bi||Y===xC||Y===Qc?n.NEAREST:n.LINEAR}function P(Y){let N=Y.target;N.removeEventListener("dispose",P),L(N),N.isVideoTexture&&y.delete(N)}function ct(Y){let N=Y.target;N.removeEventListener("dispose",ct),V(N)}function L(Y){let N=i.get(Y);if(N.__webglInit===void 0)return;let xt=Y.source,St=E.get(xt);if(St){let ot=St[N.__cacheKey];ot.usedTimes--,ot.usedTimes===0&&W(Y),Object.keys(St).length===0&&E.delete(xt)}i.remove(Y)}function W(Y){let N=i.get(Y);n.deleteTexture(N.__webglTexture);let xt=Y.source,St=E.get(xt);delete St[N.__cacheKey],c.memory.textures--}function V(Y){let N=i.get(Y);if(Y.depthTexture&&Y.depthTexture.dispose(),Y.isWebGLCubeRenderTarget)for(let St=0;St<6;St++){if(Array.isArray(N.__webglFramebuffer[St]))for(let ot=0;ot<N.__webglFramebuffer[St].length;ot++)n.deleteFramebuffer(N.__webglFramebuffer[St][ot]);else n.deleteFramebuffer(N.__webglFramebuffer[St]);N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer[St])}else{if(Array.isArray(N.__webglFramebuffer))for(let St=0;St<N.__webglFramebuffer.length;St++)n.deleteFramebuffer(N.__webglFramebuffer[St]);else n.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&n.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let St=0;St<N.__webglColorRenderbuffer.length;St++)N.__webglColorRenderbuffer[St]&&n.deleteRenderbuffer(N.__webglColorRenderbuffer[St]);N.__webglDepthRenderbuffer&&n.deleteRenderbuffer(N.__webglDepthRenderbuffer)}let xt=Y.textures;for(let St=0,ot=xt.length;St<ot;St++){let Lt=i.get(xt[St]);Lt.__webglTexture&&(n.deleteTexture(Lt.__webglTexture),c.memory.textures--),i.remove(xt[St])}i.remove(Y)}let Mt=0;function $(){Mt=0}function gt(){let Y=Mt;return Y>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+s.maxTextures),Mt+=1,Y}function ft(Y){let N=[];return N.push(Y.wrapS),N.push(Y.wrapT),N.push(Y.wrapR||0),N.push(Y.magFilter),N.push(Y.minFilter),N.push(Y.anisotropy),N.push(Y.internalFormat),N.push(Y.format),N.push(Y.type),N.push(Y.generateMipmaps),N.push(Y.premultiplyAlpha),N.push(Y.flipY),N.push(Y.unpackAlignment),N.push(Y.colorSpace),N.join()}function vt(Y,N){let xt=i.get(Y);if(Y.isVideoTexture&&Xt(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&xt.__version!==Y.version){let St=Y.image;if(St===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(St.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Vt(xt,Y,N);return}}e.bindTexture(n.TEXTURE_2D,xt.__webglTexture,n.TEXTURE0+N)}function it(Y,N){let xt=i.get(Y);if(Y.version>0&&xt.__version!==Y.version){Vt(xt,Y,N);return}e.bindTexture(n.TEXTURE_2D_ARRAY,xt.__webglTexture,n.TEXTURE0+N)}function lt(Y,N){let xt=i.get(Y);if(Y.version>0&&xt.__version!==Y.version){Vt(xt,Y,N);return}e.bindTexture(n.TEXTURE_3D,xt.__webglTexture,n.TEXTURE0+N)}function H(Y,N){let xt=i.get(Y);if(Y.version>0&&xt.__version!==Y.version){$t(xt,Y,N);return}e.bindTexture(n.TEXTURE_CUBE_MAP,xt.__webglTexture,n.TEXTURE0+N)}let At={[ev]:n.REPEAT,[Ro]:n.CLAMP_TO_EDGE,[nv]:n.MIRRORED_REPEAT},It={[bi]:n.NEAREST,[xC]:n.NEAREST_MIPMAP_NEAREST,[Qc]:n.NEAREST_MIPMAP_LINEAR,[Ni]:n.LINEAR,[dy]:n.LINEAR_MIPMAP_NEAREST,[ru]:n.LINEAR_MIPMAP_LINEAR},Kt={[U6]:n.NEVER,[V6]:n.ALWAYS,[B6]:n.LESS,[tP]:n.LEQUAL,[z6]:n.EQUAL,[q6]:n.GEQUAL,[G6]:n.GREATER,[k6]:n.NOTEQUAL};function nt(Y,N,xt){if(N.type===Os&&t.has("OES_texture_float_linear")===!1&&(N.magFilter===Ni||N.magFilter===dy||N.magFilter===Qc||N.magFilter===ru||N.minFilter===Ni||N.minFilter===dy||N.minFilter===Qc||N.minFilter===ru)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),xt?(n.texParameteri(Y,n.TEXTURE_WRAP_S,At[N.wrapS]),n.texParameteri(Y,n.TEXTURE_WRAP_T,At[N.wrapT]),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,At[N.wrapR]),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,It[N.magFilter]),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,It[N.minFilter])):(n.texParameteri(Y,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(Y,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==Ro||N.wrapT!==Ro)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,D(N.magFilter)),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,D(N.minFilter)),N.minFilter!==bi&&N.minFilter!==Ni&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(n.texParameteri(Y,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(Y,n.TEXTURE_COMPARE_FUNC,Kt[N.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===bi||N.minFilter!==Qc&&N.minFilter!==ru||N.type===Os&&t.has("OES_texture_float_linear")===!1||f===!1&&N.type===ff&&t.has("OES_texture_half_float_linear")===!1)return;if(N.anisotropy>1||i.get(N).__currentAnisotropy){let St=t.get("EXT_texture_filter_anisotropic");n.texParameterf(Y,St.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,s.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy}}}function bt(Y,N){let xt=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,N.addEventListener("dispose",P));let St=N.source,ot=E.get(St);ot===void 0&&(ot={},E.set(St,ot));let Lt=ft(N);if(Lt!==Y.__cacheKey){ot[Lt]===void 0&&(ot[Lt]={texture:n.createTexture(),usedTimes:0},c.memory.textures++,xt=!0),ot[Lt].usedTimes++;let ce=ot[Y.__cacheKey];ce!==void 0&&(ot[Y.__cacheKey].usedTimes--,ce.usedTimes===0&&W(N)),Y.__cacheKey=Lt,Y.__webglTexture=ot[Lt].texture}return xt}function Vt(Y,N,xt){let St=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(St=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(St=n.TEXTURE_3D);let ot=bt(Y,N),Lt=N.source;e.bindTexture(St,Y.__webglTexture,n.TEXTURE0+xt);let ce=i.get(Lt);if(Lt.version!==ce.__version||ot===!0){e.activeTexture(n.TEXTURE0+xt);let Rt=Rn.getPrimaries(Rn.workingColorSpace),Bt=N.colorSpace===ha?null:Rn.getPrimaries(N.colorSpace),Wt=N.colorSpace===ha||Rt===Bt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);let j=T(N)&&x(N.image)===!1,b=_(N.image,j,!1,s.maxTextureSize);b=Pt(N,b);let I=x(b)||f,F=u.convert(N.format,N.colorSpace),k=u.convert(N.type),G=B(N.internalFormat,F,k,N.colorSpace,N.isVideoTexture);nt(St,N,I);let rt,tt=N.mipmaps,pt=f&&N.isVideoTexture!==!0&&G!==QI,ht=ce.__version===void 0||ot===!0,O=Lt.dataReady,Q=U(N,b,I);if(N.isDepthTexture)G=n.DEPTH_COMPONENT,f?N.type===Os?G=n.DEPTH_COMPONENT32F:N.type===pa?G=n.DEPTH_COMPONENT24:N.type===su?G=n.DEPTH24_STENCIL8:G=n.DEPTH_COMPONENT16:N.type===Os&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===au&&G===n.DEPTH_COMPONENT&&N.type!==$v&&N.type!==pa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=pa,k=u.convert(N.type)),N.format===Pl&&G===n.DEPTH_COMPONENT&&(G=n.DEPTH_STENCIL,N.type!==su&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=su,k=u.convert(N.type))),ht&&(pt?e.texStorage2D(n.TEXTURE_2D,1,G,b.width,b.height):e.texImage2D(n.TEXTURE_2D,0,G,b.width,b.height,0,F,k,null));else if(N.isDataTexture)if(tt.length>0&&I){pt&&ht&&e.texStorage2D(n.TEXTURE_2D,Q,G,tt[0].width,tt[0].height);for(let J=0,et=tt.length;J<et;J++)rt=tt[J],pt?O&&e.texSubImage2D(n.TEXTURE_2D,J,0,0,rt.width,rt.height,F,k,rt.data):e.texImage2D(n.TEXTURE_2D,J,G,rt.width,rt.height,0,F,k,rt.data);N.generateMipmaps=!1}else pt?(ht&&e.texStorage2D(n.TEXTURE_2D,Q,G,b.width,b.height),O&&e.texSubImage2D(n.TEXTURE_2D,0,0,0,b.width,b.height,F,k,b.data)):e.texImage2D(n.TEXTURE_2D,0,G,b.width,b.height,0,F,k,b.data);else if(N.isCompressedTexture)if(N.isCompressedArrayTexture){pt&&ht&&e.texStorage3D(n.TEXTURE_2D_ARRAY,Q,G,tt[0].width,tt[0].height,b.depth);for(let J=0,et=tt.length;J<et;J++)rt=tt[J],N.format!==Lo?F!==null?pt?O&&e.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,rt.width,rt.height,b.depth,F,rt.data,0,0):e.compressedTexImage3D(n.TEXTURE_2D_ARRAY,J,G,rt.width,rt.height,b.depth,0,rt.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):pt?O&&e.texSubImage3D(n.TEXTURE_2D_ARRAY,J,0,0,0,rt.width,rt.height,b.depth,F,k,rt.data):e.texImage3D(n.TEXTURE_2D_ARRAY,J,G,rt.width,rt.height,b.depth,0,F,k,rt.data)}else{pt&&ht&&e.texStorage2D(n.TEXTURE_2D,Q,G,tt[0].width,tt[0].height);for(let J=0,et=tt.length;J<et;J++)rt=tt[J],N.format!==Lo?F!==null?pt?O&&e.compressedTexSubImage2D(n.TEXTURE_2D,J,0,0,rt.width,rt.height,F,rt.data):e.compressedTexImage2D(n.TEXTURE_2D,J,G,rt.width,rt.height,0,rt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):pt?O&&e.texSubImage2D(n.TEXTURE_2D,J,0,0,rt.width,rt.height,F,k,rt.data):e.texImage2D(n.TEXTURE_2D,J,G,rt.width,rt.height,0,F,k,rt.data)}else if(N.isDataArrayTexture)pt?(ht&&e.texStorage3D(n.TEXTURE_2D_ARRAY,Q,G,b.width,b.height,b.depth),O&&e.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,b.width,b.height,b.depth,F,k,b.data)):e.texImage3D(n.TEXTURE_2D_ARRAY,0,G,b.width,b.height,b.depth,0,F,k,b.data);else if(N.isData3DTexture)pt?(ht&&e.texStorage3D(n.TEXTURE_3D,Q,G,b.width,b.height,b.depth),O&&e.texSubImage3D(n.TEXTURE_3D,0,0,0,0,b.width,b.height,b.depth,F,k,b.data)):e.texImage3D(n.TEXTURE_3D,0,G,b.width,b.height,b.depth,0,F,k,b.data);else if(N.isFramebufferTexture){if(ht)if(pt)e.texStorage2D(n.TEXTURE_2D,Q,G,b.width,b.height);else{let J=b.width,et=b.height;for(let Tt=0;Tt<Q;Tt++)e.texImage2D(n.TEXTURE_2D,Tt,G,J,et,0,F,k,null),J>>=1,et>>=1}}else if(tt.length>0&&I){if(pt&&ht){let J=ne(tt[0]);e.texStorage2D(n.TEXTURE_2D,Q,G,J.width,J.height)}for(let J=0,et=tt.length;J<et;J++)rt=tt[J],pt?O&&e.texSubImage2D(n.TEXTURE_2D,J,0,0,F,k,rt):e.texImage2D(n.TEXTURE_2D,J,G,F,k,rt);N.generateMipmaps=!1}else if(pt){if(ht){let J=ne(b);e.texStorage2D(n.TEXTURE_2D,Q,G,J.width,J.height)}O&&e.texSubImage2D(n.TEXTURE_2D,0,0,0,F,k,b)}else e.texImage2D(n.TEXTURE_2D,0,G,F,k,b);w(N,I)&&R(St),ce.__version=Lt.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function $t(Y,N,xt){if(N.image.length!==6)return;let St=bt(Y,N),ot=N.source;e.bindTexture(n.TEXTURE_CUBE_MAP,Y.__webglTexture,n.TEXTURE0+xt);let Lt=i.get(ot);if(ot.version!==Lt.__version||St===!0){e.activeTexture(n.TEXTURE0+xt);let ce=Rn.getPrimaries(Rn.workingColorSpace),Rt=N.colorSpace===ha?null:Rn.getPrimaries(N.colorSpace),Bt=N.colorSpace===ha||ce===Rt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt);let Wt=N.isCompressedTexture||N.image[0].isCompressedTexture,j=N.image[0]&&N.image[0].isDataTexture,b=[];for(let J=0;J<6;J++)!Wt&&!j?b[J]=_(N.image[J],!1,!0,s.maxCubemapSize):b[J]=j?N.image[J].image:N.image[J],b[J]=Pt(N,b[J]);let I=b[0],F=x(I)||f,k=u.convert(N.format,N.colorSpace),G=u.convert(N.type),rt=B(N.internalFormat,k,G,N.colorSpace),tt=f&&N.isVideoTexture!==!0,pt=Lt.__version===void 0||St===!0,ht=ot.dataReady,O=U(N,I,F);nt(n.TEXTURE_CUBE_MAP,N,F);let Q;if(Wt){tt&&pt&&e.texStorage2D(n.TEXTURE_CUBE_MAP,O,rt,I.width,I.height);for(let J=0;J<6;J++){Q=b[J].mipmaps;for(let et=0;et<Q.length;et++){let Tt=Q[et];N.format!==Lo?k!==null?tt?ht&&e.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,0,0,Tt.width,Tt.height,k,Tt.data):e.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,rt,Tt.width,Tt.height,0,Tt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,0,0,Tt.width,Tt.height,k,G,Tt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et,rt,Tt.width,Tt.height,0,k,G,Tt.data)}}}else{if(Q=N.mipmaps,tt&&pt){Q.length>0&&O++;let J=ne(b[0]);e.texStorage2D(n.TEXTURE_CUBE_MAP,O,rt,J.width,J.height)}for(let J=0;J<6;J++)if(j){tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,b[J].width,b[J].height,k,G,b[J].data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,rt,b[J].width,b[J].height,0,k,G,b[J].data);for(let et=0;et<Q.length;et++){let kt=Q[et].image[J].image;tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,0,0,kt.width,kt.height,k,G,kt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,rt,kt.width,kt.height,0,k,G,kt.data)}}else{tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,k,G,b[J]):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,rt,k,G,b[J]);for(let et=0;et<Q.length;et++){let Tt=Q[et];tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,0,0,k,G,Tt.image[J]):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,rt,k,G,Tt.image[J])}}}w(N,F)&&R(n.TEXTURE_CUBE_MAP),Lt.__version=ot.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function Ut(Y,N,xt,St,ot,Lt){let ce=u.convert(xt.format,xt.colorSpace),Rt=u.convert(xt.type),Bt=B(xt.internalFormat,ce,Rt,xt.colorSpace);if(!i.get(N).__hasExternalTextures){let j=Math.max(1,N.width>>Lt),b=Math.max(1,N.height>>Lt);ot===n.TEXTURE_3D||ot===n.TEXTURE_2D_ARRAY?e.texImage3D(ot,Lt,Bt,j,b,N.depth,0,ce,Rt,null):e.texImage2D(ot,Lt,Bt,j,b,0,ce,Rt,null)}e.bindFramebuffer(n.FRAMEBUFFER,Y),Ht(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,St,ot,i.get(xt).__webglTexture,0,wt(N)):(ot===n.TEXTURE_2D||ot>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ot<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,St,ot,i.get(xt).__webglTexture,Lt),e.bindFramebuffer(n.FRAMEBUFFER,null)}function Gt(Y,N,xt){if(n.bindRenderbuffer(n.RENDERBUFFER,Y),N.depthBuffer&&!N.stencilBuffer){let St=f===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(xt||Ht(N)){let ot=N.depthTexture;ot&&ot.isDepthTexture&&(ot.type===Os?St=n.DEPTH_COMPONENT32F:ot.type===pa&&(St=n.DEPTH_COMPONENT24));let Lt=wt(N);Ht(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Lt,St,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Lt,St,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,St,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,Y)}else if(N.depthBuffer&&N.stencilBuffer){let St=wt(N);xt&&Ht(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,St,n.DEPTH24_STENCIL8,N.width,N.height):Ht(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,St,n.DEPTH24_STENCIL8,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,Y)}else{let St=N.textures;for(let ot=0;ot<St.length;ot++){let Lt=St[ot],ce=u.convert(Lt.format,Lt.colorSpace),Rt=u.convert(Lt.type),Bt=B(Lt.internalFormat,ce,Rt,Lt.colorSpace),Wt=wt(N);xt&&Ht(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Wt,Bt,N.width,N.height):Ht(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Wt,Bt,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,Bt,N.width,N.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ct(Y,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(n.FRAMEBUFFER,Y),!(N.depthTexture&&N.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(N.depthTexture).__webglTexture||N.depthTexture.image.width!==N.width||N.depthTexture.image.height!==N.height)&&(N.depthTexture.image.width=N.width,N.depthTexture.image.height=N.height,N.depthTexture.needsUpdate=!0),vt(N.depthTexture,0);let St=i.get(N.depthTexture).__webglTexture,ot=wt(N);if(N.depthTexture.format===au)Ht(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,St,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,St,0);else if(N.depthTexture.format===Pl)Ht(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,St,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,St,0);else throw new Error("Unknown depthTexture format")}function ee(Y){let N=i.get(Y),xt=Y.isWebGLCubeRenderTarget===!0;if(Y.depthTexture&&!N.__autoAllocateDepthBuffer){if(xt)throw new Error("target.depthTexture not supported in Cube render targets");Ct(N.__webglFramebuffer,Y)}else if(xt){N.__webglDepthbuffer=[];for(let St=0;St<6;St++)e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer[St]),N.__webglDepthbuffer[St]=n.createRenderbuffer(),Gt(N.__webglDepthbuffer[St],Y,!1)}else e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=n.createRenderbuffer(),Gt(N.__webglDepthbuffer,Y,!1);e.bindFramebuffer(n.FRAMEBUFFER,null)}function Z(Y,N,xt){let St=i.get(Y);N!==void 0&&Ut(St.__webglFramebuffer,Y,Y.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),xt!==void 0&&ee(Y)}function Dt(Y){let N=Y.texture,xt=i.get(Y),St=i.get(N);Y.addEventListener("dispose",ct);let ot=Y.textures,Lt=Y.isWebGLCubeRenderTarget===!0,ce=ot.length>1,Rt=x(Y)||f;if(ce||(St.__webglTexture===void 0&&(St.__webglTexture=n.createTexture()),St.__version=N.version,c.memory.textures++),Lt){xt.__webglFramebuffer=[];for(let Bt=0;Bt<6;Bt++)if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer[Bt]=[];for(let Wt=0;Wt<N.mipmaps.length;Wt++)xt.__webglFramebuffer[Bt][Wt]=n.createFramebuffer()}else xt.__webglFramebuffer[Bt]=n.createFramebuffer()}else{if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer=[];for(let Bt=0;Bt<N.mipmaps.length;Bt++)xt.__webglFramebuffer[Bt]=n.createFramebuffer()}else xt.__webglFramebuffer=n.createFramebuffer();if(ce)if(s.drawBuffers)for(let Bt=0,Wt=ot.length;Bt<Wt;Bt++){let j=i.get(ot[Bt]);j.__webglTexture===void 0&&(j.__webglTexture=n.createTexture(),c.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(f&&Y.samples>0&&Ht(Y)===!1){xt.__webglMultisampledFramebuffer=n.createFramebuffer(),xt.__webglColorRenderbuffer=[],e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglMultisampledFramebuffer);for(let Bt=0;Bt<ot.length;Bt++){let Wt=ot[Bt];xt.__webglColorRenderbuffer[Bt]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,xt.__webglColorRenderbuffer[Bt]);let j=u.convert(Wt.format,Wt.colorSpace),b=u.convert(Wt.type),I=B(Wt.internalFormat,j,b,Wt.colorSpace,Y.isXRRenderTarget===!0),F=wt(Y);n.renderbufferStorageMultisample(n.RENDERBUFFER,F,I,Y.width,Y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Bt,n.RENDERBUFFER,xt.__webglColorRenderbuffer[Bt])}n.bindRenderbuffer(n.RENDERBUFFER,null),Y.depthBuffer&&(xt.__webglDepthRenderbuffer=n.createRenderbuffer(),Gt(xt.__webglDepthRenderbuffer,Y,!0)),e.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Lt){e.bindTexture(n.TEXTURE_CUBE_MAP,St.__webglTexture),nt(n.TEXTURE_CUBE_MAP,N,Rt);for(let Bt=0;Bt<6;Bt++)if(f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ut(xt.__webglFramebuffer[Bt][Wt],Y,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Bt,Wt);else Ut(xt.__webglFramebuffer[Bt],Y,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Bt,0);w(N,Rt)&&R(n.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(ce){for(let Bt=0,Wt=ot.length;Bt<Wt;Bt++){let j=ot[Bt],b=i.get(j);e.bindTexture(n.TEXTURE_2D,b.__webglTexture),nt(n.TEXTURE_2D,j,Rt),Ut(xt.__webglFramebuffer,Y,j,n.COLOR_ATTACHMENT0+Bt,n.TEXTURE_2D,0),w(j,Rt)&&R(n.TEXTURE_2D)}e.unbindTexture()}else{let Bt=n.TEXTURE_2D;if((Y.isWebGL3DRenderTarget||Y.isWebGLArrayRenderTarget)&&(f?Bt=Y.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Bt,St.__webglTexture),nt(Bt,N,Rt),f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ut(xt.__webglFramebuffer[Wt],Y,N,n.COLOR_ATTACHMENT0,Bt,Wt);else Ut(xt.__webglFramebuffer,Y,N,n.COLOR_ATTACHMENT0,Bt,0);w(N,Rt)&&R(Bt),e.unbindTexture()}Y.depthBuffer&&ee(Y)}function _t(Y){let N=x(Y)||f,xt=Y.textures;for(let St=0,ot=xt.length;St<ot;St++){let Lt=xt[St];if(w(Lt,N)){let ce=Y.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Rt=i.get(Lt).__webglTexture;e.bindTexture(ce,Rt),R(ce),e.unbindTexture()}}}function Nt(Y){if(f&&Y.samples>0&&Ht(Y)===!1){let N=Y.textures,xt=Y.width,St=Y.height,ot=n.COLOR_BUFFER_BIT,Lt=[],ce=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Rt=i.get(Y),Bt=N.length>1;if(Bt)for(let Wt=0;Wt<N.length;Wt++)e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.RENDERBUFFER,null),e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.TEXTURE_2D,null,0);e.bindFramebuffer(n.READ_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer);for(let Wt=0;Wt<N.length;Wt++){Lt.push(n.COLOR_ATTACHMENT0+Wt),Y.depthBuffer&&Lt.push(ce);let j=Rt.__ignoreDepthValues!==void 0?Rt.__ignoreDepthValues:!1;if(j===!1&&(Y.depthBuffer&&(ot|=n.DEPTH_BUFFER_BIT),Y.stencilBuffer&&(ot|=n.STENCIL_BUFFER_BIT)),Bt&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Rt.__webglColorRenderbuffer[Wt]),j===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[ce]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[ce])),Bt){let b=i.get(N[Wt]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b,0)}n.blitFramebuffer(0,0,xt,St,0,0,xt,St,ot,n.NEAREST),d&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Lt)}if(e.bindFramebuffer(n.READ_FRAMEBUFFER,null),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Bt)for(let Wt=0;Wt<N.length;Wt++){e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.RENDERBUFFER,Rt.__webglColorRenderbuffer[Wt]);let j=i.get(N[Wt]).__webglTexture;e.bindFramebuffer(n.FRAMEBUFFER,Rt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Wt,n.TEXTURE_2D,j,0)}e.bindFramebuffer(n.DRAW_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer)}}function wt(Y){return Math.min(s.maxSamples,Y.samples)}function Ht(Y){let N=i.get(Y);return f&&Y.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function Xt(Y){let N=c.render.frame;y.get(Y)!==N&&(y.set(Y,N),Y.update())}function Pt(Y,N){let xt=Y.colorSpace,St=Y.format,ot=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||Y.format===iv||xt!==xa&&xt!==ha&&(Rn.getTransfer(xt)===kn?f===!1?t.has("EXT_sRGB")===!0&&St===Lo?(Y.format=iv,Y.minFilter=Ni,Y.generateMipmaps=!1):N=kp.sRGBToLinear(N):(St!==Lo||ot!==ma)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xt)),N}function ne(Y){return typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement?(g.width=Y.naturalWidth||Y.width,g.height=Y.naturalHeight||Y.height):typeof VideoFrame!="undefined"&&Y instanceof VideoFrame?(g.width=Y.displayWidth,g.height=Y.displayHeight):(g.width=Y.width,g.height=Y.height),g}this.allocateTextureUnit=gt,this.resetTextureUnits=$,this.setTexture2D=vt,this.setTexture2DArray=it,this.setTexture3D=lt,this.setTextureCube=H,this.rebindTextures=Z,this.setupRenderTarget=Dt,this.updateRenderTargetMipmap=_t,this.updateMultisampleRenderTarget=Nt,this.setupDepthRenderbuffer=ee,this.setupFrameBufferTexture=Ut,this.useMultisampledRTT=Ht}function D7(n,t,e){let i=e.isWebGL2;function s(u,c=ha){let f,p=Rn.getTransfer(c);if(u===ma)return n.UNSIGNED_BYTE;if(u===$I)return n.UNSIGNED_SHORT_4_4_4_4;if(u===ZI)return n.UNSIGNED_SHORT_5_5_5_1;if(u===b6)return n.BYTE;if(u===A6)return n.SHORT;if(u===$v)return n.UNSIGNED_SHORT;if(u===YI)return n.INT;if(u===pa)return n.UNSIGNED_INT;if(u===Os)return n.FLOAT;if(u===ff)return i?n.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(u===T6)return n.ALPHA;if(u===Lo)return n.RGBA;if(u===C6)return n.LUMINANCE;if(u===I6)return n.LUMINANCE_ALPHA;if(u===au)return n.DEPTH_COMPONENT;if(u===Pl)return n.DEPTH_STENCIL;if(u===iv)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(u===P6)return n.RED;if(u===JI)return n.RED_INTEGER;if(u===R6)return n.RG;if(u===jI)return n.RG_INTEGER;if(u===KI)return n.RGBA_INTEGER;if(u===gy||u===my||u===yy||u===vy)if(p===kn)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(u===gy)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(u===my)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(u===yy)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(u===vy)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(u===gy)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(u===my)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(u===yy)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(u===vy)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(u===EC||u===SC||u===wC||u===MC)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(u===EC)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(u===SC)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(u===wC)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(u===MC)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(u===QI)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(u===bC||u===AC)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(u===bC)return p===kn?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(u===AC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(u===TC||u===CC||u===IC||u===PC||u===RC||u===LC||u===NC||u===OC||u===DC||u===FC||u===UC||u===BC||u===zC||u===GC)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(u===TC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(u===CC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(u===IC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(u===PC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(u===RC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(u===LC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(u===NC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(u===OC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(u===DC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(u===FC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(u===UC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(u===BC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(u===zC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(u===GC)return p===kn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(u===_y||u===kC||u===qC)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(u===_y)return p===kn?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(u===kC)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(u===qC)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(u===L6||u===VC||u===HC||u===WC)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(u===_y)return f.COMPRESSED_RED_RGTC1_EXT;if(u===VC)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(u===HC)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(u===WC)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return u===su?i?n.UNSIGNED_INT_24_8:(f=t.get("WEBGL_depth_texture"),f!==null?f.UNSIGNED_INT_24_8_WEBGL:null):n[u]!==void 0?n[u]:null}return{convert:s}}var Ev=class extends Zi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},ou=class extends Oo{constructor(){super(),this.isGroup=!0,this.type="Group"}},F7={type:"move"},uf=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ou,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ou,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new st,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new st),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ou,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new st,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new st),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,i){let s=null,u=null,c=null,f=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){c=!0;for(let A of t.hand.values()){let _=e.getJointPose(A,i),x=this._getHandJoint(d,A);_!==null&&(x.matrix.fromArray(_.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=_.radius),x.visible=_!==null}let g=d.joints["index-finger-tip"],y=d.joints["thumb-tip"],v=g.position.distanceTo(y.position),E=.02,M=.005;d.inputState.pinching&&v>E+M?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&v<=E-M&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(u=e.getPose(t.gripSpace,i),u!==null&&(p.matrix.fromArray(u.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,u.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(u.linearVelocity)):p.hasLinearVelocity=!1,u.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(u.angularVelocity)):p.hasAngularVelocity=!1));f!==null&&(s=e.getPose(t.targetRaySpace,i),s===null&&u!==null&&(s=u),s!==null&&(f.matrix.fromArray(s.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,s.linearVelocity?(f.hasLinearVelocity=!0,f.linearVelocity.copy(s.linearVelocity)):f.hasLinearVelocity=!1,s.angularVelocity?(f.hasAngularVelocity=!0,f.angularVelocity.copy(s.angularVelocity)):f.hasAngularVelocity=!1,this.dispatchEvent(F7)))}return f!==null&&(f.visible=s!==null),p!==null&&(p.visible=u!==null),d!==null&&(d.visible=c!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let i=new ou;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},U7=`
3782
3782
  void main() {
3783
3783
 
3784
3784
  gl_Position = vec4( position, 1.0 );
@@ -3802,5 +3802,5 @@ void main() {
3802
3802
 
3803
3803
  }
3804
3804
 
3805
- }`,Sv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(this.texture===null){let s=new uo,u=t.properties.get(s);u.__webglTexture=e.texture,(e.depthNear!=i.depthNear||e.depthFar!=i.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let i=e.cameras[0].viewport,s=new Qo({extensions:{fragDepth:!0},vertexShader:U7,fragmentShader:B7,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new No(new jp(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},wv=class extends _a{constructor(t,e){super();let i=this,s=null,u=1,c=null,f="local-floor",p=1,d=null,g=null,y=null,v=null,E=null,M=null,A=new Sv,_=e.getContextAttributes(),x=null,T=null,w=[],R=[],B=new Ot,U=null,D=new Zi;D.layers.enable(1),D.viewport=new Yr;let P=new Zi;P.layers.enable(2),P.viewport=new Yr;let ct=[D,P],L=new Ev;L.layers.enable(1),L.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(nt){let bt=w[nt];return bt===void 0&&(bt=new uf,w[nt]=bt),bt.getTargetRaySpace()},this.getControllerGrip=function(nt){let bt=w[nt];return bt===void 0&&(bt=new uf,w[nt]=bt),bt.getGripSpace()},this.getHand=function(nt){let bt=w[nt];return bt===void 0&&(bt=new uf,w[nt]=bt),bt.getHandSpace()};function Mt(nt){let bt=R.indexOf(nt.inputSource);if(bt===-1)return;let Vt=w[bt];Vt!==void 0&&(Vt.update(nt.inputSource,nt.frame,d||c),Vt.dispatchEvent({type:nt.type,data:nt.inputSource}))}function $(){s.removeEventListener("select",Mt),s.removeEventListener("selectstart",Mt),s.removeEventListener("selectend",Mt),s.removeEventListener("squeeze",Mt),s.removeEventListener("squeezestart",Mt),s.removeEventListener("squeezeend",Mt),s.removeEventListener("end",$),s.removeEventListener("inputsourceschange",gt);for(let nt=0;nt<w.length;nt++){let bt=R[nt];bt!==null&&(R[nt]=null,w[nt].disconnect(bt))}W=null,V=null,A.reset(),t.setRenderTarget(x),E=null,v=null,y=null,s=null,T=null,Kt.stop(),i.isPresenting=!1,t.setPixelRatio(U),t.setSize(B.width,B.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(nt){u=nt,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(nt){f=nt,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||c},this.setReferenceSpace=function(nt){d=nt},this.getBaseLayer=function(){return v!==null?v:E},this.getBinding=function(){return y},this.getFrame=function(){return M},this.getSession=function(){return s},this.setSession=function(nt){return Ri(this,null,function*(){if(s=nt,s!==null){if(x=t.getRenderTarget(),s.addEventListener("select",Mt),s.addEventListener("selectstart",Mt),s.addEventListener("selectend",Mt),s.addEventListener("squeeze",Mt),s.addEventListener("squeezestart",Mt),s.addEventListener("squeezeend",Mt),s.addEventListener("end",$),s.addEventListener("inputsourceschange",gt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),U=t.getPixelRatio(),t.getSize(B),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let bt={antialias:s.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:u};E=new XRWebGLLayer(s,e,bt),s.updateRenderState({baseLayer:E}),t.setPixelRatio(1),t.setSize(E.framebufferWidth,E.framebufferHeight,!1),T=new Us(E.framebufferWidth,E.framebufferHeight,{format:Lo,type:ma,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let bt=null,Vt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,bt=_.stencil?Pl:au,Vt=_.stencil?su:pa);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:u};y=new XRWebGLBinding(s,e),v=y.createProjectionLayer(Ut),s.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),T=new Us(v.textureWidth,v.textureHeight,{format:Lo,type:ma,depthTexture:new Qp(v.textureWidth,v.textureHeight,Vt,void 0,void 0,void 0,void 0,void 0,void 0,bt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Gt=t.properties.get(T);Gt.__ignoreDepthValues=v.ignoreDepthValues}T.isXRRenderTarget=!0,this.setFoveation(p),d=null,c=yield s.requestReferenceSpace(f),Kt.setContext(s),Kt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function gt(nt){for(let bt=0;bt<nt.removed.length;bt++){let Vt=nt.removed[bt],$t=R.indexOf(Vt);$t>=0&&(R[$t]=null,w[$t].disconnect(Vt))}for(let bt=0;bt<nt.added.length;bt++){let Vt=nt.added[bt],$t=R.indexOf(Vt);if($t===-1){for(let Gt=0;Gt<w.length;Gt++)if(Gt>=R.length){R.push(Vt),$t=Gt;break}else if(R[Gt]===null){R[Gt]=Vt,$t=Gt;break}if($t===-1)break}let Ut=w[$t];Ut&&Ut.connect(Vt)}}let ft=new st,vt=new st;function it(nt,bt,Vt){ft.setFromMatrixPosition(bt.matrixWorld),vt.setFromMatrixPosition(Vt.matrixWorld);let $t=ft.distanceTo(vt),Ut=bt.projectionMatrix.elements,Gt=Vt.projectionMatrix.elements,Ct=Ut[14]/(Ut[10]-1),ee=Ut[14]/(Ut[10]+1),Z=(Ut[9]+1)/Ut[5],Dt=(Ut[9]-1)/Ut[5],_t=(Ut[8]-1)/Ut[0],Nt=(Gt[8]+1)/Gt[0],wt=Ct*_t,Ht=Ct*Nt,Xt=$t/(-_t+Nt),Pt=Xt*-_t;bt.matrixWorld.decompose(nt.position,nt.quaternion,nt.scale),nt.translateX(Pt),nt.translateZ(Xt),nt.matrixWorld.compose(nt.position,nt.quaternion,nt.scale),nt.matrixWorldInverse.copy(nt.matrixWorld).invert();let ne=Ct+Xt,Y=ee+Xt,N=wt-Pt,xt=Ht+($t-Pt),St=Z*ee/Y*ne,ot=Dt*ee/Y*ne;nt.projectionMatrix.makePerspective(N,xt,St,ot,ne,Y),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert()}function lt(nt,bt){bt===null?nt.matrixWorld.copy(nt.matrix):nt.matrixWorld.multiplyMatrices(bt.matrixWorld,nt.matrix),nt.matrixWorldInverse.copy(nt.matrixWorld).invert()}this.updateCamera=function(nt){if(s===null)return;A.texture!==null&&(nt.near=A.depthNear,nt.far=A.depthFar),L.near=P.near=D.near=nt.near,L.far=P.far=D.far=nt.far,(W!==L.near||V!==L.far)&&(s.updateRenderState({depthNear:L.near,depthFar:L.far}),W=L.near,V=L.far,D.near=W,D.far=V,P.near=W,P.far=V,D.updateProjectionMatrix(),P.updateProjectionMatrix(),nt.updateProjectionMatrix());let bt=nt.parent,Vt=L.cameras;lt(L,bt);for(let $t=0;$t<Vt.length;$t++)lt(Vt[$t],bt);Vt.length===2?it(L,D,P):L.projectionMatrix.copy(D.projectionMatrix),H(nt,L,bt)};function H(nt,bt,Vt){Vt===null?nt.matrix.copy(bt.matrixWorld):(nt.matrix.copy(Vt.matrixWorld),nt.matrix.invert(),nt.matrix.multiply(bt.matrixWorld)),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.updateMatrixWorld(!0),nt.projectionMatrix.copy(bt.projectionMatrix),nt.projectionMatrixInverse.copy(bt.projectionMatrixInverse),nt.isPerspectiveCamera&&(nt.fov=ov*2*Math.atan(1/nt.projectionMatrix.elements[5]),nt.zoom=1)}this.getCamera=function(){return L},this.getFoveation=function(){if(!(v===null&&E===null))return p},this.setFoveation=function(nt){p=nt,v!==null&&(v.fixedFoveation=nt),E!==null&&E.fixedFoveation!==void 0&&(E.fixedFoveation=nt)},this.hasDepthSensing=function(){return A.texture!==null};let At=null;function It(nt,bt){if(g=bt.getViewerPose(d||c),M=bt,g!==null){let Vt=g.views;E!==null&&(t.setRenderTargetFramebuffer(T,E.framebuffer),t.setRenderTarget(T));let $t=!1;Vt.length!==L.cameras.length&&(L.cameras.length=0,$t=!0);for(let Gt=0;Gt<Vt.length;Gt++){let Ct=Vt[Gt],ee=null;if(E!==null)ee=E.getViewport(Ct);else{let Dt=y.getViewSubImage(v,Ct);ee=Dt.viewport,Gt===0&&(t.setRenderTargetTextures(T,Dt.colorTexture,v.ignoreDepthValues?void 0:Dt.depthStencilTexture),t.setRenderTarget(T))}let Z=ct[Gt];Z===void 0&&(Z=new Zi,Z.layers.enable(Gt),Z.viewport=new Yr,ct[Gt]=Z),Z.matrix.fromArray(Ct.transform.matrix),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.projectionMatrix.fromArray(Ct.projectionMatrix),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert(),Z.viewport.set(ee.x,ee.y,ee.width,ee.height),Gt===0&&(L.matrix.copy(Z.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),$t===!0&&L.cameras.push(Z)}let Ut=s.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Gt=y.getDepthInformation(Vt[0]);Gt&&Gt.isValid&&Gt.texture&&A.init(t,Gt,s.renderState)}}for(let Vt=0;Vt<w.length;Vt++){let $t=R[Vt],Ut=w[Vt];$t!==null&&Ut!==void 0&&Ut.update($t,bt,d||c)}A.render(t,L),At&&At(nt,bt),bt.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:bt}),M=null}let Kt=new oP;Kt.setAnimationLoop(It),this.setAnimationLoop=function(nt){At=nt},this.dispose=function(){}}},Qa=new lu,z7=new $n;function G7(n,t){function e(_,x){_.matrixAutoUpdate===!0&&_.updateMatrix(),x.value.copy(_.matrix)}function i(_,x){x.color.getRGB(_.fogColor.value,iP(n)),x.isFog?(_.fogNear.value=x.near,_.fogFar.value=x.far):x.isFogExp2&&(_.fogDensity.value=x.density)}function s(_,x,T,w,R){x.isMeshBasicMaterial||x.isMeshLambertMaterial?u(_,x):x.isMeshToonMaterial?(u(_,x),y(_,x)):x.isMeshPhongMaterial?(u(_,x),g(_,x)):x.isMeshStandardMaterial?(u(_,x),v(_,x),x.isMeshPhysicalMaterial&&E(_,x,R)):x.isMeshMatcapMaterial?(u(_,x),M(_,x)):x.isMeshDepthMaterial?u(_,x):x.isMeshDistanceMaterial?(u(_,x),A(_,x)):x.isMeshNormalMaterial?u(_,x):x.isLineBasicMaterial?(c(_,x),x.isLineDashedMaterial&&f(_,x)):x.isPointsMaterial?p(_,x,T,w):x.isSpriteMaterial?d(_,x):x.isShadowMaterial?(_.color.value.copy(x.color),_.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function u(_,x){_.opacity.value=x.opacity,x.color&&_.diffuse.value.copy(x.color),x.emissive&&_.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(_.map.value=x.map,e(x.map,_.mapTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.bumpMap&&(_.bumpMap.value=x.bumpMap,e(x.bumpMap,_.bumpMapTransform),_.bumpScale.value=x.bumpScale,x.side===Oi&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,e(x.normalMap,_.normalMapTransform),_.normalScale.value.copy(x.normalScale),x.side===Oi&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,e(x.displacementMap,_.displacementMapTransform),_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap,e(x.emissiveMap,_.emissiveMapTransform)),x.specularMap&&(_.specularMap.value=x.specularMap,e(x.specularMap,_.specularMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest);let T=t.get(x),w=T.envMap,R=T.envMapRotation;if(w&&(_.envMap.value=w,Qa.copy(R),Qa.x*=-1,Qa.y*=-1,Qa.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Qa.y*=-1,Qa.z*=-1),_.envMapRotation.value.setFromMatrix4(z7.makeRotationFromEuler(Qa)),_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=x.reflectivity,_.ior.value=x.ior,_.refractionRatio.value=x.refractionRatio),x.lightMap){_.lightMap.value=x.lightMap;let B=n._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=x.lightMapIntensity*B,e(x.lightMap,_.lightMapTransform)}x.aoMap&&(_.aoMap.value=x.aoMap,_.aoMapIntensity.value=x.aoMapIntensity,e(x.aoMap,_.aoMapTransform))}function c(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,x.map&&(_.map.value=x.map,e(x.map,_.mapTransform))}function f(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}function p(_,x,T,w){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*T,_.scale.value=w*.5,x.map&&(_.map.value=x.map,e(x.map,_.uvTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest)}function d(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map,e(x.map,_.mapTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest)}function g(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4)}function y(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap)}function v(_,x){_.metalness.value=x.metalness,x.metalnessMap&&(_.metalnessMap.value=x.metalnessMap,e(x.metalnessMap,_.metalnessMapTransform)),_.roughness.value=x.roughness,x.roughnessMap&&(_.roughnessMap.value=x.roughnessMap,e(x.roughnessMap,_.roughnessMapTransform)),t.get(x).envMap&&(_.envMapIntensity.value=x.envMapIntensity)}function E(_,x,T){_.ior.value=x.ior,x.sheen>0&&(_.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),_.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(_.sheenColorMap.value=x.sheenColorMap,e(x.sheenColorMap,_.sheenColorMapTransform)),x.sheenRoughnessMap&&(_.sheenRoughnessMap.value=x.sheenRoughnessMap,e(x.sheenRoughnessMap,_.sheenRoughnessMapTransform))),x.clearcoat>0&&(_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap,e(x.clearcoatMap,_.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,e(x.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(_.clearcoatNormalMap.value=x.clearcoatNormalMap,e(x.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===Oi&&_.clearcoatNormalScale.value.negate())),x.iridescence>0&&(_.iridescence.value=x.iridescence,_.iridescenceIOR.value=x.iridescenceIOR,_.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(_.iridescenceMap.value=x.iridescenceMap,e(x.iridescenceMap,_.iridescenceMapTransform)),x.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=x.iridescenceThicknessMap,e(x.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),x.transmission>0&&(_.transmission.value=x.transmission,_.transmissionSamplerMap.value=T.texture,_.transmissionSamplerSize.value.set(T.width,T.height),x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap,e(x.transmissionMap,_.transmissionMapTransform)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap,e(x.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(_.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(_.anisotropyMap.value=x.anisotropyMap,e(x.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=x.specularIntensity,_.specularColor.value.copy(x.specularColor),x.specularColorMap&&(_.specularColorMap.value=x.specularColorMap,e(x.specularColorMap,_.specularColorMapTransform)),x.specularIntensityMap&&(_.specularIntensityMap.value=x.specularIntensityMap,e(x.specularIntensityMap,_.specularIntensityMapTransform))}function M(_,x){x.matcap&&(_.matcap.value=x.matcap)}function A(_,x){let T=t.get(x).light;_.referencePosition.value.setFromMatrixPosition(T.matrixWorld),_.nearDistance.value=T.shadow.camera.near,_.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function k7(n,t,e,i){let s={},u={},c=[],f=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(T,w){let R=w.program;i.uniformBlockBinding(T,R)}function d(T,w){let R=s[T.id];R===void 0&&(M(T),R=g(T),s[T.id]=R,T.addEventListener("dispose",_));let B=w.program;i.updateUBOMapping(T,B);let U=t.render.frame;u[T.id]!==U&&(v(T),u[T.id]=U)}function g(T){let w=y();T.__bindingPointIndex=w;let R=n.createBuffer(),B=T.__size,U=T.usage;return n.bindBuffer(n.UNIFORM_BUFFER,R),n.bufferData(n.UNIFORM_BUFFER,B,U),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,R),R}function y(){for(let T=0;T<f;T++)if(c.indexOf(T)===-1)return c.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(T){let w=s[T.id],R=T.uniforms,B=T.__cache;n.bindBuffer(n.UNIFORM_BUFFER,w);for(let U=0,D=R.length;U<D;U++){let P=Array.isArray(R[U])?R[U]:[R[U]];for(let ct=0,L=P.length;ct<L;ct++){let W=P[ct];if(E(W,U,ct,B)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],$=0;for(let gt=0;gt<Mt.length;gt++){let ft=Mt[gt],vt=A(ft);typeof ft=="number"||typeof ft=="boolean"?(W.__data[0]=ft,n.bufferSubData(n.UNIFORM_BUFFER,V+$,W.__data)):ft.isMatrix3?(W.__data[0]=ft.elements[0],W.__data[1]=ft.elements[1],W.__data[2]=ft.elements[2],W.__data[3]=0,W.__data[4]=ft.elements[3],W.__data[5]=ft.elements[4],W.__data[6]=ft.elements[5],W.__data[7]=0,W.__data[8]=ft.elements[6],W.__data[9]=ft.elements[7],W.__data[10]=ft.elements[8],W.__data[11]=0):(ft.toArray(W.__data,$),$+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,V,W.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function E(T,w,R,B){let U=T.value,D=w+"_"+R;if(B[D]===void 0)return typeof U=="number"||typeof U=="boolean"?B[D]=U:B[D]=U.clone(),!0;{let P=B[D];if(typeof U=="number"||typeof U=="boolean"){if(P!==U)return B[D]=U,!0}else if(P.equals(U)===!1)return P.copy(U),!0}return!1}function M(T){let w=T.uniforms,R=0,B=16;for(let D=0,P=w.length;D<P;D++){let ct=Array.isArray(w[D])?w[D]:[w[D]];for(let L=0,W=ct.length;L<W;L++){let V=ct[L],Mt=Array.isArray(V.value)?V.value:[V.value];for(let $=0,gt=Mt.length;$<gt;$++){let ft=Mt[$],vt=A(ft),it=R%B;it!==0&&B-it<vt.boundary&&(R+=B-it),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=R,R+=vt.storage}}}let U=R%B;return U>0&&(R+=B-U),T.__size=R,T.__cache={},this}function A(T){let w={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(w.boundary=4,w.storage=4):T.isVector2?(w.boundary=8,w.storage=8):T.isVector3||T.isColor?(w.boundary=16,w.storage=12):T.isVector4?(w.boundary=16,w.storage=16):T.isMatrix3?(w.boundary=48,w.storage=48):T.isMatrix4?(w.boundary=64,w.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),w}function _(T){let w=T.target;w.removeEventListener("dispose",_);let R=c.indexOf(w.__bindingPointIndex);c.splice(R,1),n.deleteBuffer(s[w.id]),delete s[w.id],delete u[w.id]}function x(){for(let T in s)n.deleteBuffer(s[T]);c=[],s={},u={}}return{bind:p,update:d,dispose:x}}var Mv=class{constructor(t={}){let{canvas:e=W6(),context:i=null,depth:s=!0,stencil:u=!0,alpha:c=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:y=!1}=t;this.isWebGLRenderer=!0;let v;i!==null?v=i.getContextAttributes().alpha:v=c;let E=new Uint32Array(4),M=new Int32Array(4),A=null,_=null,x=[],T=[];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=Zo,this._useLegacyLights=!1,this.toneMapping=ga,this.toneMappingExposure=1;let w=this,R=!1,B=0,U=0,D=null,P=-1,ct=null,L=new Yr,W=new Yr,V=null,Mt=new Te(0),$=0,gt=e.width,ft=e.height,vt=1,it=null,lt=null,H=new Yr(0,0,gt,ft),At=new Yr(0,0,gt,ft),It=!1,Kt=new Jp,nt=!1,bt=!1,Vt=null,$t=new $n,Ut=new Ot,Gt=new st,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ee(){return D===null?vt:1}let Z=i;function Dt(q,at){for(let Et=0;Et<q.length;Et++){let dt=q[Et],ut=e.getContext(dt,at);if(ut!==null)return ut}return null}try{let q={alpha:!0,depth:s,stencil:u,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:y};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Yv}`),e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",Q,!1),Z===null){let at=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&at.shift(),Z=Dt(at,q),Z===null)throw Dt(at)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&Z instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),Z.getShaderPrecisionFormat===void 0&&(Z.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let _t,Nt,wt,Ht,Xt,Pt,ne,Y,N,xt,St,ot,Lt,ce,Rt,Bt,Wt,j,b,I,F,k,G,rt;function tt(){_t=new r9(Z),Nt=new jX(Z,_t,t),_t.init(Nt),k=new D7(Z,_t,Nt),wt=new N7(Z,_t,Nt),Ht=new s9(Z),Xt=new E7,Pt=new O7(Z,_t,wt,Xt,Nt,k,Ht),ne=new QX(w),Y=new n9(w),N=new h8(Z,Nt),G=new ZX(Z,_t,N,Nt),xt=new i9(Z,N,Ht,G),St=new c9(Z,xt,N,Ht),b=new l9(Z,Nt,Pt),Bt=new KX(Xt),ot=new x7(w,ne,Y,_t,Nt,G,Bt),Lt=new G7(w,Xt),ce=new w7,Rt=new I7(_t,Nt),j=new $X(w,ne,Y,wt,St,v,p),Wt=new L7(w,St,Nt),rt=new k7(Z,Ht,Nt,wt),I=new JX(Z,_t,Ht,Nt),F=new o9(Z,_t,Ht,Nt),Ht.programs=ot.programs,w.capabilities=Nt,w.extensions=_t,w.properties=Xt,w.renderLists=ce,w.shadowMap=Wt,w.state=wt,w.info=Ht}tt();let pt=new wv(w,Z);this.xr=pt,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){let q=_t.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=_t.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(q){q!==void 0&&(vt=q,this.setSize(gt,ft,!1))},this.getSize=function(q){return q.set(gt,ft)},this.setSize=function(q,at,Et=!0){if(pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}gt=q,ft=at,e.width=Math.floor(q*vt),e.height=Math.floor(at*vt),Et===!0&&(e.style.width=q+"px",e.style.height=at+"px"),this.setViewport(0,0,q,at)},this.getDrawingBufferSize=function(q){return q.set(gt*vt,ft*vt).floor()},this.setDrawingBufferSize=function(q,at,Et){gt=q,ft=at,vt=Et,e.width=Math.floor(q*Et),e.height=Math.floor(at*Et),this.setViewport(0,0,q,at)},this.getCurrentViewport=function(q){return q.copy(L)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,at,Et,dt){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,at,Et,dt),wt.viewport(L.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(At)},this.setScissor=function(q,at,Et,dt){q.isVector4?At.set(q.x,q.y,q.z,q.w):At.set(q,at,Et,dt),wt.scissor(W.copy(At).multiplyScalar(vt).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(q){wt.setScissorTest(It=q)},this.setOpaqueSort=function(q){it=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,at=!0,Et=!0){let dt=0;if(q){let ut=!1;if(D!==null){let Qt=D.texture.format;ut=Qt===KI||Qt===jI||Qt===JI}if(ut){let Qt=D.texture.type,te=Qt===ma||Qt===pa||Qt===$v||Qt===su||Qt===$I||Qt===ZI,le=j.getClearColor(),re=j.getClearAlpha(),ve=le.r,fe=le.g,he=le.b;te?(E[0]=ve,E[1]=fe,E[2]=he,E[3]=re,Z.clearBufferuiv(Z.COLOR,0,E)):(M[0]=ve,M[1]=fe,M[2]=he,M[3]=re,Z.clearBufferiv(Z.COLOR,0,M))}else dt|=Z.COLOR_BUFFER_BIT}at&&(dt|=Z.DEPTH_BUFFER_BIT),Et&&(dt|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(dt)},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",ht,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",Q,!1),ce.dispose(),Rt.dispose(),Xt.dispose(),ne.dispose(),Y.dispose(),St.dispose(),G.dispose(),rt.dispose(),ot.dispose(),Wt.dispose(),pt.dispose(),pt.removeEventListener("sessionstart",we),pt.removeEventListener("sessionend",ye),Vt&&(Vt.dispose(),Vt=null),be.stop()};function ht(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),R=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),R=!1;let q=Ht.autoReset,at=Wt.enabled,Et=Wt.autoUpdate,dt=Wt.needsUpdate,ut=Wt.type;tt(),Ht.autoReset=q,Wt.enabled=at,Wt.autoUpdate=Et,Wt.needsUpdate=dt,Wt.type=ut}function Q(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function J(q){let at=q.target;at.removeEventListener("dispose",J),et(at)}function et(q){Tt(q),Xt.remove(q)}function Tt(q){let at=Xt.get(q).programs;at!==void 0&&(at.forEach(function(Et){ot.releaseProgram(Et)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,at,Et,dt,ut,Qt){at===null&&(at=Ct);let te=ut.isMesh&&ut.matrixWorld.determinant()<0,le=En(q,at,Et,dt,ut);wt.setMaterial(dt,te);let re=Et.index,ve=1;if(dt.wireframe===!0){if(re=xt.getWireframeAttribute(Et),re===void 0)return;ve=2}let fe=Et.drawRange,he=Et.attributes.position,cn=fe.start*ve,Tr=(fe.start+fe.count)*ve;Qt!==null&&(cn=Math.max(cn,Qt.start*ve),Tr=Math.min(Tr,(Qt.start+Qt.count)*ve)),re!==null?(cn=Math.max(cn,0),Tr=Math.min(Tr,re.count)):he!=null&&(cn=Math.max(cn,0),Tr=Math.min(Tr,he.count));let qn=Tr-cn;if(qn<0||qn===1/0)return;G.setup(ut,dt,le,Et,re);let hi,wn=I;if(re!==null&&(hi=N.get(re),wn=F,wn.setIndex(hi)),ut.isMesh)dt.wireframe===!0?(wt.setLineWidth(dt.wireframeLinewidth*ee()),wn.setMode(Z.LINES)):wn.setMode(Z.TRIANGLES);else if(ut.isLine){let se=dt.linewidth;se===void 0&&(se=1),wt.setLineWidth(se*ee()),ut.isLineSegments?wn.setMode(Z.LINES):ut.isLineLoop?wn.setMode(Z.LINE_LOOP):wn.setMode(Z.LINE_STRIP)}else ut.isPoints?wn.setMode(Z.POINTS):ut.isSprite&&wn.setMode(Z.TRIANGLES);if(ut.isBatchedMesh)wn.renderMultiDraw(ut._multiDrawStarts,ut._multiDrawCounts,ut._multiDrawCount);else if(ut.isInstancedMesh)wn.renderInstances(cn,qn,ut.count);else if(Et.isInstancedBufferGeometry){let se=Et._maxInstanceCount!==void 0?Et._maxInstanceCount:1/0,bu=Math.min(Et.instanceCount,se);wn.renderInstances(cn,qn,bu)}else wn.render(cn,qn)};function kt(q,at,Et){q.transparent===!0&&q.side===Ns&&q.forceSinglePass===!1?(q.side=Oi,q.needsUpdate=!0,xn(q,at,Et),q.side=va,q.needsUpdate=!0,xn(q,at,Et),q.side=Ns):xn(q,at,Et)}this.compile=function(q,at,Et=null){Et===null&&(Et=q),_=Rt.get(Et),_.init(),T.push(_),Et.traverseVisible(function(ut){ut.isLight&&ut.layers.test(at.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),q!==Et&&q.traverseVisible(function(ut){ut.isLight&&ut.layers.test(at.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),_.setupLights(w._useLegacyLights);let dt=new Set;return q.traverse(function(ut){let Qt=ut.material;if(Qt)if(Array.isArray(Qt))for(let te=0;te<Qt.length;te++){let le=Qt[te];kt(le,Et,ut),dt.add(le)}else kt(Qt,Et,ut),dt.add(Qt)}),T.pop(),_=null,dt},this.compileAsync=function(q,at,Et=null){let dt=this.compile(q,at,Et);return new Promise(ut=>{function Qt(){if(dt.forEach(function(te){Xt.get(te).currentProgram.isReady()&&dt.delete(te)}),dt.size===0){ut(q);return}setTimeout(Qt,10)}_t.get("KHR_parallel_shader_compile")!==null?Qt():setTimeout(Qt,10)})};let ie=null;function oe(q){ie&&ie(q)}function we(){be.stop()}function ye(){be.start()}let be=new oP;be.setAnimationLoop(oe),typeof self!="undefined"&&be.setContext(self),this.setAnimationLoop=function(q){ie=q,pt.setAnimationLoop(q),q===null?be.stop():be.start()},pt.addEventListener("sessionstart",we),pt.addEventListener("sessionend",ye),this.render=function(q,at){if(at!==void 0&&at.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),at.parent===null&&at.matrixWorldAutoUpdate===!0&&at.updateMatrixWorld(),pt.enabled===!0&&pt.isPresenting===!0&&(pt.cameraAutoUpdate===!0&&pt.updateCamera(at),at=pt.getCamera()),q.isScene===!0&&q.onBeforeRender(w,q,at,D),_=Rt.get(q,T.length),_.init(),T.push(_),$t.multiplyMatrices(at.projectionMatrix,at.matrixWorldInverse),Kt.setFromProjectionMatrix($t),bt=this.localClippingEnabled,nt=Bt.init(this.clippingPlanes,bt),A=ce.get(q,x.length),A.init(),x.push(A),Ae(q,at,0,w.sortObjects),A.finish(),w.sortObjects===!0&&A.sort(it,lt),this.info.render.frame++,nt===!0&&Bt.beginShadows();let Et=_.state.shadowsArray;if(Wt.render(Et,q,at),nt===!0&&Bt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(pt.enabled===!1||pt.isPresenting===!1||pt.hasDepthSensing()===!1)&&j.render(A,q),_.setupLights(w._useLegacyLights),at.isArrayCamera){let dt=at.cameras;for(let ut=0,Qt=dt.length;ut<Qt;ut++){let te=dt[ut];Bn(A,q,te,te.viewport)}}else Bn(A,q,at);D!==null&&(Pt.updateMultisampleRenderTarget(D),Pt.updateRenderTargetMipmap(D)),q.isScene===!0&&q.onAfterRender(w,q,at),G.resetDefaultState(),P=-1,ct=null,T.pop(),T.length>0?_=T[T.length-1]:_=null,x.pop(),x.length>0?A=x[x.length-1]:A=null};function Ae(q,at,Et,dt){if(q.visible===!1)return;if(q.layers.test(at.layers)){if(q.isGroup)Et=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(at);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Kt.intersectsSprite(q)){dt&&Gt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let te=St.update(q),le=q.material;le.visible&&A.push(q,te,le,Et,Gt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Kt.intersectsObject(q))){let te=St.update(q),le=q.material;if(dt&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Gt.copy(q.boundingSphere.center)):(te.boundingSphere===null&&te.computeBoundingSphere(),Gt.copy(te.boundingSphere.center)),Gt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(le)){let re=te.groups;for(let ve=0,fe=re.length;ve<fe;ve++){let he=re[ve],cn=le[he.materialIndex];cn&&cn.visible&&A.push(q,te,cn,Et,Gt.z,he)}}else le.visible&&A.push(q,te,le,Et,Gt.z,null)}}let Qt=q.children;for(let te=0,le=Qt.length;te<le;te++)Ae(Qt[te],at,Et,dt)}function Bn(q,at,Et,dt){let ut=q.opaque,Qt=q.transmissive,te=q.transparent;_.setupLightsView(Et),nt===!0&&Bt.setGlobalState(w.clippingPlanes,Et),Qt.length>0&&dr(ut,Qt,at,Et),dt&&wt.viewport(L.copy(dt)),ut.length>0&&_n(ut,at,Et),Qt.length>0&&_n(Qt,at,Et),te.length>0&&_n(te,at,Et),wt.buffers.depth.setTest(!0),wt.buffers.depth.setMask(!0),wt.buffers.color.setMask(!0),wt.setPolygonOffset(!1)}function dr(q,at,Et,dt){if((Et.isScene===!0?Et.overrideMaterial:null)!==null)return;let Qt=Nt.isWebGL2;Vt===null&&(Vt=new Us(1,1,{generateMipmaps:!0,type:_t.has("EXT_color_buffer_half_float")?ff:ma,minFilter:ru,samples:Qt?4:0})),w.getDrawingBufferSize(Ut),Qt?Vt.setSize(Ut.x,Ut.y):Vt.setSize(sv(Ut.x),sv(Ut.y));let te=w.getRenderTarget();w.setRenderTarget(Vt),w.getClearColor(Mt),$=w.getClearAlpha(),$<1&&w.setClearColor(16777215,.5),w.clear();let le=w.toneMapping;w.toneMapping=ga,_n(q,Et,dt),Pt.updateMultisampleRenderTarget(Vt),Pt.updateRenderTargetMipmap(Vt);let re=!1;for(let ve=0,fe=at.length;ve<fe;ve++){let he=at[ve],cn=he.object,Tr=he.geometry,qn=he.material,hi=he.group;if(qn.side===Ns&&cn.layers.test(dt.layers)){let wn=qn.side;qn.side=Oi,qn.needsUpdate=!0,pe(cn,Et,dt,Tr,qn,hi),qn.side=wn,qn.needsUpdate=!0,re=!0}}re===!0&&(Pt.updateMultisampleRenderTarget(Vt),Pt.updateRenderTargetMipmap(Vt)),w.setRenderTarget(te),w.setClearColor(Mt,$),w.toneMapping=le}function _n(q,at,Et){let dt=at.isScene===!0?at.overrideMaterial:null;for(let ut=0,Qt=q.length;ut<Qt;ut++){let te=q[ut],le=te.object,re=te.geometry,ve=dt===null?te.material:dt,fe=te.group;le.layers.test(Et.layers)&&pe(le,at,Et,re,ve,fe)}}function pe(q,at,Et,dt,ut,Qt){q.onBeforeRender(w,at,Et,dt,ut,Qt),q.modelViewMatrix.multiplyMatrices(Et.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ut.onBeforeRender(w,at,Et,dt,q,Qt),ut.transparent===!0&&ut.side===Ns&&ut.forceSinglePass===!1?(ut.side=Oi,ut.needsUpdate=!0,w.renderBufferDirect(Et,at,dt,ut,q,Qt),ut.side=va,ut.needsUpdate=!0,w.renderBufferDirect(Et,at,dt,ut,q,Qt),ut.side=Ns):w.renderBufferDirect(Et,at,dt,ut,q,Qt),q.onAfterRender(w,at,Et,dt,ut,Qt)}function xn(q,at,Et){at.isScene!==!0&&(at=Ct);let dt=Xt.get(q),ut=_.state.lights,Qt=_.state.shadowsArray,te=ut.state.version,le=ot.getParameters(q,ut.state,Qt,at,Et),re=ot.getProgramCacheKey(le),ve=dt.programs;dt.environment=q.isMeshStandardMaterial?at.environment:null,dt.fog=at.fog,dt.envMap=(q.isMeshStandardMaterial?Y:ne).get(q.envMap||dt.environment),dt.envMapRotation=dt.environment!==null&&q.envMap===null?at.environmentRotation:q.envMapRotation,ve===void 0&&(q.addEventListener("dispose",J),ve=new Map,dt.programs=ve);let fe=ve.get(re);if(fe!==void 0){if(dt.currentProgram===fe&&dt.lightsStateVersion===te)return Cn(q,le),fe}else le.uniforms=ot.getUniforms(q),q.onBuild(Et,le,w),q.onBeforeCompile(le,w),fe=ot.acquireProgram(le,re),ve.set(re,fe),dt.uniforms=le.uniforms;let he=dt.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(he.clippingPlanes=Bt.uniform),Cn(q,le),dt.needsLights=Ar(q),dt.lightsStateVersion=te,dt.needsLights&&(he.ambientLightColor.value=ut.state.ambient,he.lightProbe.value=ut.state.probe,he.directionalLights.value=ut.state.directional,he.directionalLightShadows.value=ut.state.directionalShadow,he.spotLights.value=ut.state.spot,he.spotLightShadows.value=ut.state.spotShadow,he.rectAreaLights.value=ut.state.rectArea,he.ltc_1.value=ut.state.rectAreaLTC1,he.ltc_2.value=ut.state.rectAreaLTC2,he.pointLights.value=ut.state.point,he.pointLightShadows.value=ut.state.pointShadow,he.hemisphereLights.value=ut.state.hemi,he.directionalShadowMap.value=ut.state.directionalShadowMap,he.directionalShadowMatrix.value=ut.state.directionalShadowMatrix,he.spotShadowMap.value=ut.state.spotShadowMap,he.spotLightMatrix.value=ut.state.spotLightMatrix,he.spotLightMap.value=ut.state.spotLightMap,he.pointShadowMap.value=ut.state.pointShadowMap,he.pointShadowMatrix.value=ut.state.pointShadowMatrix),dt.currentProgram=fe,dt.uniformsList=null,fe}function Nn(q){if(q.uniformsList===null){let at=q.currentProgram.getUniforms();q.uniformsList=Tl.seqWithValue(at.seq,q.uniforms)}return q.uniformsList}function Cn(q,at){let Et=Xt.get(q);Et.outputColorSpace=at.outputColorSpace,Et.batching=at.batching,Et.instancing=at.instancing,Et.instancingColor=at.instancingColor,Et.instancingMorph=at.instancingMorph,Et.skinning=at.skinning,Et.morphTargets=at.morphTargets,Et.morphNormals=at.morphNormals,Et.morphColors=at.morphColors,Et.morphTargetsCount=at.morphTargetsCount,Et.numClippingPlanes=at.numClippingPlanes,Et.numIntersection=at.numClipIntersection,Et.vertexAlphas=at.vertexAlphas,Et.vertexTangents=at.vertexTangents,Et.toneMapping=at.toneMapping}function En(q,at,Et,dt,ut){at.isScene!==!0&&(at=Ct),Pt.resetTextureUnits();let Qt=at.fog,te=dt.isMeshStandardMaterial?at.environment:null,le=D===null?w.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:xa,re=(dt.isMeshStandardMaterial?Y:ne).get(dt.envMap||te),ve=dt.vertexColors===!0&&!!Et.attributes.color&&Et.attributes.color.itemSize===4,fe=!!Et.attributes.tangent&&(!!dt.normalMap||dt.anisotropy>0),he=!!Et.morphAttributes.position,cn=!!Et.morphAttributes.normal,Tr=!!Et.morphAttributes.color,qn=ga;dt.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(qn=w.toneMapping);let hi=Et.morphAttributes.position||Et.morphAttributes.normal||Et.morphAttributes.color,wn=hi!==void 0?hi.length:0,se=Xt.get(dt),bu=_.state.lights;if(nt===!0&&(bt===!0||q!==ct)){let pi=q===ct&&dt.id===P;Bt.setState(dt,q,pi)}let fn=!1;dt.version===se.__version?(se.needsLights&&se.lightsStateVersion!==bu.state.version||se.outputColorSpace!==le||ut.isBatchedMesh&&se.batching===!1||!ut.isBatchedMesh&&se.batching===!0||ut.isInstancedMesh&&se.instancing===!1||!ut.isInstancedMesh&&se.instancing===!0||ut.isSkinnedMesh&&se.skinning===!1||!ut.isSkinnedMesh&&se.skinning===!0||ut.isInstancedMesh&&se.instancingColor===!0&&ut.instanceColor===null||ut.isInstancedMesh&&se.instancingColor===!1&&ut.instanceColor!==null||ut.isInstancedMesh&&se.instancingMorph===!0&&ut.morphTexture===null||ut.isInstancedMesh&&se.instancingMorph===!1&&ut.morphTexture!==null||se.envMap!==re||dt.fog===!0&&se.fog!==Qt||se.numClippingPlanes!==void 0&&(se.numClippingPlanes!==Bt.numPlanes||se.numIntersection!==Bt.numIntersection)||se.vertexAlphas!==ve||se.vertexTangents!==fe||se.morphTargets!==he||se.morphNormals!==cn||se.morphColors!==Tr||se.toneMapping!==qn||Nt.isWebGL2===!0&&se.morphTargetsCount!==wn)&&(fn=!0):(fn=!0,se.__version=dt.version);let fo=se.currentProgram;fn===!0&&(fo=xn(dt,at,ut));let fc=!1,_e=!1,Pa=!1,Mn=fo.getUniforms(),ho=se.uniforms;if(wt.useProgram(fo.program)&&(fc=!0,_e=!0,Pa=!0),dt.id!==P&&(P=dt.id,_e=!0),fc||ct!==q){Mn.setValue(Z,"projectionMatrix",q.projectionMatrix),Mn.setValue(Z,"viewMatrix",q.matrixWorldInverse);let pi=Mn.map.cameraPosition;pi!==void 0&&pi.setValue(Z,Gt.setFromMatrixPosition(q.matrixWorld)),Nt.logarithmicDepthBuffer&&Mn.setValue(Z,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(dt.isMeshPhongMaterial||dt.isMeshToonMaterial||dt.isMeshLambertMaterial||dt.isMeshBasicMaterial||dt.isMeshStandardMaterial||dt.isShaderMaterial)&&Mn.setValue(Z,"isOrthographic",q.isOrthographicCamera===!0),ct!==q&&(ct=q,_e=!0,Pa=!0)}if(ut.isSkinnedMesh){Mn.setOptional(Z,ut,"bindMatrix"),Mn.setOptional(Z,ut,"bindMatrixInverse");let pi=ut.skeleton;pi&&(Nt.floatVertexTextures?(pi.boneTexture===null&&pi.computeBoneTexture(),Mn.setValue(Z,"boneTexture",pi.boneTexture,Pt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ut.isBatchedMesh&&(Mn.setOptional(Z,ut,"batchingTexture"),Mn.setValue(Z,"batchingTexture",ut._matricesTexture,Pt));let me=Et.morphAttributes;if((me.position!==void 0||me.normal!==void 0||me.color!==void 0&&Nt.isWebGL2===!0)&&b.update(ut,Et,fo),(_e||se.receiveShadow!==ut.receiveShadow)&&(se.receiveShadow=ut.receiveShadow,Mn.setValue(Z,"receiveShadow",ut.receiveShadow)),dt.isMeshGouraudMaterial&&dt.envMap!==null&&(ho.envMap.value=re,ho.flipEnvMap.value=re.isCubeTexture&&re.isRenderTargetTexture===!1?-1:1),_e&&(Mn.setValue(Z,"toneMappingExposure",w.toneMappingExposure),se.needsLights&&Kr(ho,Pa),Qt&&dt.fog===!0&&Lt.refreshFogUniforms(ho,Qt),Lt.refreshMaterialUniforms(ho,dt,vt,ft,Vt),Tl.upload(Z,Nn(se),ho,Pt)),dt.isShaderMaterial&&dt.uniformsNeedUpdate===!0&&(Tl.upload(Z,Nn(se),ho,Pt),dt.uniformsNeedUpdate=!1),dt.isSpriteMaterial&&Mn.setValue(Z,"center",ut.center),Mn.setValue(Z,"modelViewMatrix",ut.modelViewMatrix),Mn.setValue(Z,"normalMatrix",ut.normalMatrix),Mn.setValue(Z,"modelMatrix",ut.matrixWorld),dt.isShaderMaterial||dt.isRawShaderMaterial){let pi=dt.uniformsGroups;for(let hc=0,Au=pi.length;hc<Au;hc++)if(Nt.isWebGL2){let di=pi[hc];rt.update(di,fo),rt.bind(di,fo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return fo}function Kr(q,at){q.ambientLightColor.needsUpdate=at,q.lightProbe.needsUpdate=at,q.directionalLights.needsUpdate=at,q.directionalLightShadows.needsUpdate=at,q.pointLights.needsUpdate=at,q.pointLightShadows.needsUpdate=at,q.spotLights.needsUpdate=at,q.spotLightShadows.needsUpdate=at,q.rectAreaLights.needsUpdate=at,q.hemisphereLights.needsUpdate=at}function Ar(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(q,at,Et){Xt.get(q.texture).__webglTexture=at,Xt.get(q.depthTexture).__webglTexture=Et;let dt=Xt.get(q);dt.__hasExternalTextures=!0,dt.__autoAllocateDepthBuffer=Et===void 0,dt.__autoAllocateDepthBuffer||_t.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),dt.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,at){let Et=Xt.get(q);Et.__webglFramebuffer=at,Et.__useDefaultFramebuffer=at===void 0},this.setRenderTarget=function(q,at=0,Et=0){D=q,B=at,U=Et;let dt=!0,ut=null,Qt=!1,te=!1;if(q){let re=Xt.get(q);re.__useDefaultFramebuffer!==void 0?(wt.bindFramebuffer(Z.FRAMEBUFFER,null),dt=!1):re.__webglFramebuffer===void 0?Pt.setupRenderTarget(q):re.__hasExternalTextures&&Pt.rebindTextures(q,Xt.get(q.texture).__webglTexture,Xt.get(q.depthTexture).__webglTexture);let ve=q.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(te=!0);let fe=Xt.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(fe[at])?ut=fe[at][Et]:ut=fe[at],Qt=!0):Nt.isWebGL2&&q.samples>0&&Pt.useMultisampledRTT(q)===!1?ut=Xt.get(q).__webglMultisampledFramebuffer:Array.isArray(fe)?ut=fe[Et]:ut=fe,L.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else L.copy(H).multiplyScalar(vt).floor(),W.copy(At).multiplyScalar(vt).floor(),V=It;if(wt.bindFramebuffer(Z.FRAMEBUFFER,ut)&&Nt.drawBuffers&&dt&&wt.drawBuffers(q,ut),wt.viewport(L),wt.scissor(W),wt.setScissorTest(V),Qt){let re=Xt.get(q.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+at,re.__webglTexture,Et)}else if(te){let re=Xt.get(q.texture),ve=at||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,re.__webglTexture,Et||0,ve)}P=-1},this.readRenderTargetPixels=function(q,at,Et,dt,ut,Qt,te){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let le=Xt.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&te!==void 0&&(le=le[te]),le){wt.bindFramebuffer(Z.FRAMEBUFFER,le);try{let re=q.texture,ve=re.format,fe=re.type;if(ve!==Lo&&k.convert(ve)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let he=fe===ff&&(_t.has("EXT_color_buffer_half_float")||Nt.isWebGL2&&_t.has("EXT_color_buffer_float"));if(fe!==ma&&k.convert(fe)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(fe===Os&&(Nt.isWebGL2||_t.has("OES_texture_float")||_t.has("WEBGL_color_buffer_float")))&&!he){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}at>=0&&at<=q.width-dt&&Et>=0&&Et<=q.height-ut&&Z.readPixels(at,Et,dt,ut,k.convert(ve),k.convert(fe),Qt)}finally{let re=D!==null?Xt.get(D).__webglFramebuffer:null;wt.bindFramebuffer(Z.FRAMEBUFFER,re)}}},this.copyFramebufferToTexture=function(q,at,Et=0){let dt=Math.pow(2,-Et),ut=Math.floor(at.image.width*dt),Qt=Math.floor(at.image.height*dt);Pt.setTexture2D(at,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Et,0,0,q.x,q.y,ut,Qt),wt.unbindTexture()},this.copyTextureToTexture=function(q,at,Et,dt=0){let ut=at.image.width,Qt=at.image.height,te=k.convert(Et.format),le=k.convert(Et.type);Pt.setTexture2D(Et,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,Et.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Et.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,Et.unpackAlignment),at.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,dt,q.x,q.y,ut,Qt,te,le,at.image.data):at.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,dt,q.x,q.y,at.mipmaps[0].width,at.mipmaps[0].height,te,at.mipmaps[0].data):Z.texSubImage2D(Z.TEXTURE_2D,dt,q.x,q.y,te,le,at.image),dt===0&&Et.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),wt.unbindTexture()},this.copyTextureToTexture3D=function(q,at,Et,dt,ut=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Qt=Math.round(q.max.x-q.min.x),te=Math.round(q.max.y-q.min.y),le=q.max.z-q.min.z+1,re=k.convert(dt.format),ve=k.convert(dt.type),fe;if(dt.isData3DTexture)Pt.setTexture3D(dt,0),fe=Z.TEXTURE_3D;else if(dt.isDataArrayTexture||dt.isCompressedArrayTexture)Pt.setTexture2DArray(dt,0),fe=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,dt.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dt.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,dt.unpackAlignment);let he=Z.getParameter(Z.UNPACK_ROW_LENGTH),cn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Tr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),qn=Z.getParameter(Z.UNPACK_SKIP_ROWS),hi=Z.getParameter(Z.UNPACK_SKIP_IMAGES),wn=Et.isCompressedTexture?Et.mipmaps[ut]:Et.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,wn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,wn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,q.min.x),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,q.min.y),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,q.min.z),Et.isDataTexture||Et.isData3DTexture?Z.texSubImage3D(fe,ut,at.x,at.y,at.z,Qt,te,le,re,ve,wn.data):dt.isCompressedArrayTexture?Z.compressedTexSubImage3D(fe,ut,at.x,at.y,at.z,Qt,te,le,re,wn.data):Z.texSubImage3D(fe,ut,at.x,at.y,at.z,Qt,te,le,re,ve,wn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,he),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,cn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Tr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,qn),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,hi),ut===0&&dt.generateMipmaps&&Z.generateMipmap(fe),wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Pt.setTextureCube(q,0):q.isData3DTexture?Pt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Pt.setTexture2DArray(q,0):Pt.setTexture2D(q,0),wt.unbindTexture()},this.resetState=function(){B=0,U=0,D=null,wt.reset(),G.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ds}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Zv?"display-p3":"srgb",e.unpackColorSpace=Rn.workingColorSpace===ld?"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}},bv=class extends Mv{};bv.prototype.isWebGL1Renderer=!0;var pf=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Fs()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return nP("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,u=this.stride;s<u;s++)this.array[t+s]=e.array[i+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fs()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fs()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},wi=new st,ts=class n{constructor(t,e,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)wi.fromBufferAttribute(this,e),wi.applyMatrix4(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)wi.fromBufferAttribute(this,e),wi.applyNormalMatrix(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)wi.fromBufferAttribute(this,e),wi.transformDirection(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=jo(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Pn(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=jo(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=jo(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=jo(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=jo(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,e,i,s,u){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array),u=Pn(u,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=u,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let s=i*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return new Zn(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new n(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let s=i*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Av=class extends cu{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Te(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},fa,of=new st,_l=new st,xl=new st,El=new Ot,sf=new Ot,fP=new $n,Ap=new st,af=new st,Tp=new st,UI=new Ot,Yy=new Ot,BI=new Ot,Tv=class extends Oo{constructor(t=new Av){if(super(),this.isSprite=!0,this.type="Sprite",fa===void 0){fa=new ui;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new pf(e,5);fa.setIndex([0,1,2,0,2,3]),fa.setAttribute("position",new ts(i,3,0,!1)),fa.setAttribute("uv",new ts(i,2,3,!1))}this.geometry=fa,this.material=t,this.center=new Ot(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),_l.setFromMatrixScale(this.matrixWorld),fP.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),xl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_l.multiplyScalar(-xl.z);let i=this.material.rotation,s,u;i!==0&&(u=Math.cos(i),s=Math.sin(i));let c=this.center;Cp(Ap.set(-.5,-.5,0),xl,c,_l,s,u),Cp(af.set(.5,-.5,0),xl,c,_l,s,u),Cp(Tp.set(.5,.5,0),xl,c,_l,s,u),UI.set(0,0),Yy.set(1,0),BI.set(1,1);let f=t.ray.intersectTriangle(Ap,af,Tp,!1,of);if(f===null&&(Cp(af.set(-.5,.5,0),xl,c,_l,s,u),Yy.set(0,1),f=t.ray.intersectTriangle(Ap,Tp,af,!1,of),f===null))return;let p=t.ray.origin.distanceTo(of);p<t.near||p>t.far||e.push({distance:p,point:of.clone(),uv:iu.getInterpolation(of,Ap,af,Tp,UI,Yy,BI,new Ot),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};Tv.Dispose=function(){fa.dispose(),fa=void 0};function Cp(n,t,e,i,s,u){El.subVectors(n,e).addScalar(.5).multiply(i),s!==void 0?(sf.x=u*El.x-s*El.y,sf.y=s*El.x+u*El.y):sf.copy(El),n.copy(t),n.x+=sf.x,n.y+=sf.y,n.applyMatrix4(fP)}var co=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],i,s=this.getPoint(0),u=0;e.push(0);for(let c=1;c<=t;c++)i=this.getPoint(c/t),u+=i.distanceTo(s),e.push(u),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){let i=this.getLengths(),s=0,u=i.length,c;e?c=e:c=t*i[u-1];let f=0,p=u-1,d;for(;f<=p;)if(s=Math.floor(f+(p-f)/2),d=i[s]-c,d<0)f=s+1;else if(d>0)p=s-1;else{p=s;break}if(s=p,i[s]===c)return s/(u-1);let g=i[s],v=i[s+1]-g,E=(c-g)/v;return(s+E)/(u-1)}getTangent(t,e){let s=t-1e-4,u=t+1e-4;s<0&&(s=0),u>1&&(u=1);let c=this.getPoint(s),f=this.getPoint(u),p=e||(c.isVector2?new Ot:new st);return p.copy(f).sub(c).normalize(),p}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){let i=new st,s=[],u=[],c=[],f=new st,p=new $n;for(let E=0;E<=t;E++){let M=E/t;s[E]=this.getTangentAt(M,new st)}u[0]=new st,c[0]=new st;let d=Number.MAX_VALUE,g=Math.abs(s[0].x),y=Math.abs(s[0].y),v=Math.abs(s[0].z);g<=d&&(d=g,i.set(1,0,0)),y<=d&&(d=y,i.set(0,1,0)),v<=d&&i.set(0,0,1),f.crossVectors(s[0],i).normalize(),u[0].crossVectors(s[0],f),c[0].crossVectors(s[0],u[0]);for(let E=1;E<=t;E++){if(u[E]=u[E-1].clone(),c[E]=c[E-1].clone(),f.crossVectors(s[E-1],s[E]),f.length()>Number.EPSILON){f.normalize();let M=Math.acos(ai(s[E-1].dot(s[E]),-1,1));u[E].applyMatrix4(p.makeRotationAxis(f,M))}c[E].crossVectors(s[E],u[E])}if(e===!0){let E=Math.acos(ai(u[0].dot(u[t]),-1,1));E/=t,s[0].dot(f.crossVectors(u[0],u[t]))>0&&(E=-E);for(let M=1;M<=t;M++)u[M].applyMatrix4(p.makeRotationAxis(s[M],E*M)),c[M].crossVectors(s[M],u[M])}return{tangents:s,normals:u,binormals:c}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},df=class extends co{constructor(t=0,e=0,i=1,s=1,u=0,c=Math.PI*2,f=!1,p=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=u,this.aEndAngle=c,this.aClockwise=f,this.aRotation=p}getPoint(t,e=new Ot){let i=e,s=Math.PI*2,u=this.aEndAngle-this.aStartAngle,c=Math.abs(u)<Number.EPSILON;for(;u<0;)u+=s;for(;u>s;)u-=s;u<Number.EPSILON&&(c?u=0:u=s),this.aClockwise===!0&&!c&&(u===s?u=-s:u=u-s);let f=this.aStartAngle+t*u,p=this.aX+this.xRadius*Math.cos(f),d=this.aY+this.yRadius*Math.sin(f);if(this.aRotation!==0){let g=Math.cos(this.aRotation),y=Math.sin(this.aRotation),v=p-this.aX,E=d-this.aY;p=v*g-E*y+this.aX,d=v*y+E*g+this.aY}return i.set(p,d)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},Cv=class extends df{constructor(t,e,i,s,u,c){super(t,e,i,i,s,u,c),this.isArcCurve=!0,this.type="ArcCurve"}};function jv(){let n=0,t=0,e=0,i=0;function s(u,c,f,p){n=u,t=f,e=-3*u+3*c-2*f-p,i=2*u-2*c+f+p}return{initCatmullRom:function(u,c,f,p,d){s(c,f,d*(f-u),d*(p-c))},initNonuniformCatmullRom:function(u,c,f,p,d,g,y){let v=(c-u)/d-(f-u)/(d+g)+(f-c)/g,E=(f-c)/g-(p-c)/(g+y)+(p-f)/y;v*=g,E*=g,s(c,f,v,E)},calc:function(u){let c=u*u,f=c*u;return n+t*u+e*c+i*f}}}var Ip=new st,$y=new jv,Zy=new jv,Jy=new jv,Iv=class extends co{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new st){let i=e,s=this.points,u=s.length,c=(u-(this.closed?0:1))*t,f=Math.floor(c),p=c-f;this.closed?f+=f>0?0:(Math.floor(Math.abs(f)/u)+1)*u:p===0&&f===u-1&&(f=u-2,p=1);let d,g;this.closed||f>0?d=s[(f-1)%u]:(Ip.subVectors(s[0],s[1]).add(s[0]),d=Ip);let y=s[f%u],v=s[(f+1)%u];if(this.closed||f+2<u?g=s[(f+2)%u]:(Ip.subVectors(s[u-1],s[u-2]).add(s[u-1]),g=Ip),this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?.5:.25,M=Math.pow(d.distanceToSquared(y),E),A=Math.pow(y.distanceToSquared(v),E),_=Math.pow(v.distanceToSquared(g),E);A<1e-4&&(A=1),M<1e-4&&(M=A),_<1e-4&&(_=A),$y.initNonuniformCatmullRom(d.x,y.x,v.x,g.x,M,A,_),Zy.initNonuniformCatmullRom(d.y,y.y,v.y,g.y,M,A,_),Jy.initNonuniformCatmullRom(d.z,y.z,v.z,g.z,M,A,_)}else this.curveType==="catmullrom"&&($y.initCatmullRom(d.x,y.x,v.x,g.x,this.tension),Zy.initCatmullRom(d.y,y.y,v.y,g.y,this.tension),Jy.initCatmullRom(d.z,y.z,v.z,g.z,this.tension));return i.set($y.calc(p),Zy.calc(p),Jy.calc(p)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(new st().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function zI(n,t,e,i,s){let u=(i-t)*.5,c=(s-e)*.5,f=n*n,p=n*f;return(2*e-2*i+u+c)*p+(-3*e+3*i-2*u-c)*f+u*n+e}function q7(n,t){let e=1-n;return e*e*t}function V7(n,t){return 2*(1-n)*n*t}function H7(n,t){return n*n*t}function lf(n,t,e,i){return q7(n,t)+V7(n,e)+H7(n,i)}function W7(n,t){let e=1-n;return e*e*e*t}function X7(n,t){let e=1-n;return 3*e*e*n*t}function Y7(n,t){return 3*(1-n)*n*n*t}function $7(n,t){return n*n*n*t}function cf(n,t,e,i,s){return W7(n,t)+X7(n,e)+Y7(n,i)+$7(n,s)}var td=class extends co{constructor(t=new Ot,e=new Ot,i=new Ot,s=new Ot){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Ot){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(cf(t,s.x,u.x,c.x,f.x),cf(t,s.y,u.y,c.y,f.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Pv=class extends co{constructor(t=new st,e=new st,i=new st,s=new st){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new st){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(cf(t,s.x,u.x,c.x,f.x),cf(t,s.y,u.y,c.y,f.y),cf(t,s.z,u.z,c.z,f.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},ed=class extends co{constructor(t=new Ot,e=new Ot){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ot){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Ot){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Rv=class extends co{constructor(t=new st,e=new st){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new st){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new st){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},nd=class extends co{constructor(t=new Ot,e=new Ot,i=new Ot){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ot){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(lf(t,s.x,u.x,c.x),lf(t,s.y,u.y,c.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Lv=class extends co{constructor(t=new st,e=new st,i=new st){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new st){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(lf(t,s.x,u.x,c.x),lf(t,s.y,u.y,c.y),lf(t,s.z,u.z,c.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},rd=class extends co{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ot){let i=e,s=this.points,u=(s.length-1)*t,c=Math.floor(u),f=u-c,p=s[c===0?c:c-1],d=s[c],g=s[c>s.length-2?s.length-1:c+1],y=s[c>s.length-3?s.length-1:c+2];return i.set(zI(f,p.x,d.x,g.x,y.x),zI(f,p.y,d.y,g.y,y.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(new Ot().fromArray(s))}return this}},Nv=Object.freeze({__proto__:null,ArcCurve:Cv,CatmullRomCurve3:Iv,CubicBezierCurve:td,CubicBezierCurve3:Pv,EllipseCurve:df,LineCurve:ed,LineCurve3:Rv,QuadraticBezierCurve:nd,QuadraticBezierCurve3:Lv,SplineCurve:rd}),Ov=class extends co{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Nv[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),s=this.getCurveLengths(),u=0;for(;u<s.length;){if(s[u]>=i){let c=s[u]-i,f=this.curves[u],p=f.getLength(),d=p===0?0:1-c/p;return f.getPointAt(d,e)}u++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i<s;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],i;for(let s=0,u=this.curves;s<u.length;s++){let c=u[s],f=c.isEllipseCurve?t*2:c.isLineCurve||c.isLineCurve3?1:c.isSplineCurve?t*c.points.length:t,p=c.getPoints(f);for(let d=0;d<p.length;d++){let g=p[d];i&&i.equals(g)||(e.push(g),i=g)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let s=t.curves[e];this.curves.push(new Nv[s.type]().fromJSON(s))}return this}},Ll=class extends Ov{constructor(t){super(),this.type="Path",this.currentPoint=new Ot,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new ed(this.currentPoint.clone(),new Ot(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){let u=new nd(this.currentPoint.clone(),new Ot(t,e),new Ot(i,s));return this.curves.push(u),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,u,c){let f=new td(this.currentPoint.clone(),new Ot(t,e),new Ot(i,s),new Ot(u,c));return this.curves.push(f),this.currentPoint.set(u,c),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new rd(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,s,u,c){let f=this.currentPoint.x,p=this.currentPoint.y;return this.absarc(t+f,e+p,i,s,u,c),this}absarc(t,e,i,s,u,c){return this.absellipse(t,e,i,i,s,u,c),this}ellipse(t,e,i,s,u,c,f,p){let d=this.currentPoint.x,g=this.currentPoint.y;return this.absellipse(t+d,e+g,i,s,u,c,f,p),this}absellipse(t,e,i,s,u,c,f,p){let d=new df(t,e,i,s,u,c,f,p);if(this.curves.length>0){let y=d.getPoint(0);y.equals(this.currentPoint)||this.lineTo(y.x,y.y)}this.curves.push(d);let g=d.getPoint(1);return this.currentPoint.copy(g),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}};var Nl=class extends Ll{constructor(t){super(t),this.uuid=Fs(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i<s;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let s=t.holes[e];this.holes.push(new Ll().fromJSON(s))}return this}},Z7={triangulate:function(n,t,e=2){let i=t&&t.length,s=i?t[0]*e:n.length,u=hP(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;let f,p,d,g,y,v,E;if(i&&(u=tY(n,t,u,e)),n.length>80*e){f=d=n[0],p=g=n[1];for(let M=e;M<s;M+=e)y=n[M],v=n[M+1],y<f&&(f=y),v<p&&(p=v),y>d&&(d=y),v>g&&(g=v);E=Math.max(d-f,g-p),E=E!==0?32767/E:0}return gf(u,c,e,f,p,E,0),c}};function hP(n,t,e,i,s){let u,c;if(s===fY(n,t,e,i)>0)for(u=t;u<e;u+=i)c=GI(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=GI(u,n[u],n[u+1],c);return c&&fd(c,c.next)&&(yf(c),c=c.next),c}function fu(n,t){if(!n)return n;t||(t=n);let e=n,i;do if(i=!1,!e.steiner&&(fd(e,e.next)||jn(e.prev,e,e.next)===0)){if(yf(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function gf(n,t,e,i,s,u,c){if(!n)return;!c&&u&&oY(n,i,s,u);let f=n,p,d;for(;n.prev!==n.next;){if(p=n.prev,d=n.next,u?j7(n,i,s,u):J7(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),yf(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=K7(fu(n),t,e),gf(n,t,e,i,s,u,2)):c===2&&Q7(n,t,e,i,s,u):gf(fu(n),t,e,i,s,u,1);break}}}function J7(n){let t=n.prev,e=n,i=n.next;if(jn(t,e,i)>=0)return!1;let s=t.x,u=e.x,c=i.x,f=t.y,p=e.y,d=i.y,g=s<u?s<c?s:c:u<c?u:c,y=f<p?f<d?f:d:p<d?p:d,v=s>u?s>c?s:c:u>c?u:c,E=f>p?f>d?f:d:p>d?p:d,M=i.next;for(;M!==t;){if(M.x>=g&&M.x<=v&&M.y>=y&&M.y<=E&&Ml(s,f,u,p,c,d,M.x,M.y)&&jn(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function j7(n,t,e,i){let s=n.prev,u=n,c=n.next;if(jn(s,u,c)>=0)return!1;let f=s.x,p=u.x,d=c.x,g=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=g<y?g<v?g:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=g>y?g>v?g:v:y>v?y:v,x=Dv(E,M,t,e,i),T=Dv(A,_,t,e,i),w=n.prevZ,R=n.nextZ;for(;w&&w.z>=x&&R&&R.z<=T;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Ml(f,g,p,y,d,v,w.x,w.y)&&jn(w.prev,w,w.next)>=0||(w=w.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Ml(f,g,p,y,d,v,R.x,R.y)&&jn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;w&&w.z>=x;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Ml(f,g,p,y,d,v,w.x,w.y)&&jn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Ml(f,g,p,y,d,v,R.x,R.y)&&jn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function K7(n,t,e){let i=n;do{let s=i.prev,u=i.next.next;!fd(s,u)&&pP(s,i,i.next,u)&&mf(s,u)&&mf(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),yf(i),yf(i.next),i=n=u),i=i.next}while(i!==n);return fu(i)}function Q7(n,t,e,i,s,u){let c=n;do{let f=c.next.next;for(;f!==c.prev;){if(c.i!==f.i&&uY(c,f)){let p=dP(c,f);c=fu(c,c.next),p=fu(p,p.next),gf(c,t,e,i,s,u,0),gf(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function tY(n,t,e,i){let s=[],u,c,f,p,d;for(u=0,c=t.length;u<c;u++)f=t[u]*i,p=u<c-1?t[u+1]*i:n.length,d=hP(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(aY(d));for(s.sort(eY),u=0;u<s.length;u++)e=nY(s[u],e);return e}function eY(n,t){return n.x-t.x}function nY(n,t){let e=rY(n,t);if(!e)return t;let i=dP(e,n);return fu(i,i.next),fu(e,e.next)}function rY(n,t){let e=t,i=-1/0,s,u=n.x,c=n.y;do{if(c<=e.y&&c>=e.next.y&&e.next.y!==e.y){let v=e.x+(c-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(v<=u&&v>i&&(i=v,s=e.x<e.next.x?e:e.next,v===u))return s}e=e.next}while(e!==t);if(!s)return null;let f=s,p=s.x,d=s.y,g=1/0,y;e=s;do u>=e.x&&e.x>=p&&u!==e.x&&Ml(c<d?u:i,c,p,d,c<d?i:u,c,e.x,e.y)&&(y=Math.abs(c-e.y)/(u-e.x),mf(e,n)&&(y<g||y===g&&(e.x>s.x||e.x===s.x&&iY(s,e)))&&(s=e,g=y)),e=e.next;while(e!==f);return s}function iY(n,t){return jn(n.prev,n,t.prev)<0&&jn(t.next,n,n.next)<0}function oY(n,t,e,i){let s=n;do s.z===0&&(s.z=Dv(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,sY(s)}function sY(n){let t,e,i,s,u,c,f,p,d=1;do{for(e=n,n=null,u=null,c=0;e;){for(c++,i=e,f=0,t=0;t<d&&(f++,i=i.nextZ,!!i);t++);for(p=d;f>0||p>0&&i;)f!==0&&(p===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,f--):(s=i,i=i.nextZ,p--),u?u.nextZ=s:n=s,s.prevZ=u,u=s;e=i}u.nextZ=null,d*=2}while(c>1);return n}function Dv(n,t,e,i,s){return n=(n-e)*s|0,t=(t-i)*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 aY(n){let 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 Ml(n,t,e,i,s,u,c,f){return(s-c)*(t-f)>=(n-c)*(u-f)&&(n-c)*(i-f)>=(e-c)*(t-f)&&(e-c)*(u-f)>=(s-c)*(i-f)}function uY(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!lY(n,t)&&(mf(n,t)&&mf(t,n)&&cY(n,t)&&(jn(n.prev,n,t.prev)||jn(n,t.prev,t))||fd(n,t)&&jn(n.prev,n,n.next)>0&&jn(t.prev,t,t.next)>0)}function jn(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function fd(n,t){return n.x===t.x&&n.y===t.y}function pP(n,t,e,i){let s=Rp(jn(n,t,e)),u=Rp(jn(n,t,i)),c=Rp(jn(e,i,n)),f=Rp(jn(e,i,t));return!!(s!==u&&c!==f||s===0&&Pp(n,e,t)||u===0&&Pp(n,i,t)||c===0&&Pp(e,n,i)||f===0&&Pp(e,t,i))}function Pp(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 Rp(n){return n>0?1:n<0?-1:0}function lY(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&pP(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function mf(n,t){return jn(n.prev,n,n.next)<0?jn(n,t,n.next)>=0&&jn(n,n.prev,t)>=0:jn(n,t,n.prev)<0||jn(n,n.next,t)<0}function cY(n,t){let e=n,i=!1,s=(n.x+t.x)/2,u=(n.y+t.y)/2;do e.y>u!=e.next.y>u&&e.next.y!==e.y&&s<(e.next.x-e.x)*(u-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==n);return i}function dP(n,t){let e=new Fv(n.i,n.x,n.y),i=new Fv(t.i,t.x,t.y),s=n.next,u=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,i.next=e,e.prev=i,u.next=i,i.prev=u,i}function GI(n,t,e,i){let s=new Fv(n,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function yf(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 Fv(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}function fY(n,t,e,i){let s=0;for(let u=t,c=e-i;u<e;u+=i)s+=(n[c]-n[u])*(n[u+1]+n[c+1]),c=u;return s}var ya=class n{static area(t){let e=t.length,i=0;for(let s=e-1,u=0;u<e;s=u++)i+=t[s].x*t[u].y-t[u].x*t[s].y;return i*.5}static isClockWise(t){return n.area(t)<0}static triangulateShape(t,e){let i=[],s=[],u=[];kI(t),qI(i,t);let c=t.length;e.forEach(kI);for(let p=0;p<e.length;p++)s.push(c),c+=e[p].length,qI(i,e[p]);let f=Z7.triangulate(i,s);for(let p=0;p<f.length;p+=3)u.push(f.slice(p,p+3));return u}};function kI(n){let t=n.length;t>2&&n[t-1].equals(n[0])&&n.pop()}function qI(n,t){for(let e=0;e<t.length;e++)n.push(t[e].x),n.push(t[e].y)}var id=class n extends ui{constructor(t=new Nl([new Ot(.5,.5),new Ot(-.5,.5),new Ot(-.5,-.5),new Ot(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let i=this,s=[],u=[];for(let f=0,p=t.length;f<p;f++){let d=t[f];c(d)}this.setAttribute("position",new _r(s,3)),this.setAttribute("uv",new _r(u,2)),this.computeVertexNormals();function c(f){let p=[],d=e.curveSegments!==void 0?e.curveSegments:12,g=e.steps!==void 0?e.steps:1,y=e.depth!==void 0?e.depth:1,v=e.bevelEnabled!==void 0?e.bevelEnabled:!0,E=e.bevelThickness!==void 0?e.bevelThickness:.2,M=e.bevelSize!==void 0?e.bevelSize:E-.1,A=e.bevelOffset!==void 0?e.bevelOffset:0,_=e.bevelSegments!==void 0?e.bevelSegments:3,x=e.extrudePath,T=e.UVGenerator!==void 0?e.UVGenerator:hY,w,R=!1,B,U,D,P;x&&(w=x.getSpacedPoints(g),R=!0,v=!1,B=x.computeFrenetFrames(g,!1),U=new st,D=new st,P=new st),v||(_=0,E=0,M=0,A=0);let ct=f.extractPoints(d),L=ct.shape,W=ct.holes;if(!ya.isClockWise(L)){L=L.reverse();for(let Z=0,Dt=W.length;Z<Dt;Z++){let _t=W[Z];ya.isClockWise(_t)&&(W[Z]=_t.reverse())}}let Mt=ya.triangulateShape(L,W),$=L;for(let Z=0,Dt=W.length;Z<Dt;Z++){let _t=W[Z];L=L.concat(_t)}function gt(Z,Dt,_t){return Dt||console.error("THREE.ExtrudeGeometry: vec does not exist"),Z.clone().addScaledVector(Dt,_t)}let ft=L.length,vt=Mt.length;function it(Z,Dt,_t){let Nt,wt,Ht,Xt=Z.x-Dt.x,Pt=Z.y-Dt.y,ne=_t.x-Z.x,Y=_t.y-Z.y,N=Xt*Xt+Pt*Pt,xt=Xt*Y-Pt*ne;if(Math.abs(xt)>Number.EPSILON){let St=Math.sqrt(N),ot=Math.sqrt(ne*ne+Y*Y),Lt=Dt.x-Pt/St,ce=Dt.y+Xt/St,Rt=_t.x-Y/ot,Bt=_t.y+ne/ot,Wt=((Rt-Lt)*Y-(Bt-ce)*ne)/(Xt*Y-Pt*ne);Nt=Lt+Xt*Wt-Z.x,wt=ce+Pt*Wt-Z.y;let j=Nt*Nt+wt*wt;if(j<=2)return new Ot(Nt,wt);Ht=Math.sqrt(j/2)}else{let St=!1;Xt>Number.EPSILON?ne>Number.EPSILON&&(St=!0):Xt<-Number.EPSILON?ne<-Number.EPSILON&&(St=!0):Math.sign(Pt)===Math.sign(Y)&&(St=!0),St?(Nt=-Pt,wt=Xt,Ht=Math.sqrt(N)):(Nt=Xt,wt=Pt,Ht=Math.sqrt(N/2))}return new Ot(Nt/Ht,wt/Ht)}let lt=[];for(let Z=0,Dt=$.length,_t=Dt-1,Nt=Z+1;Z<Dt;Z++,_t++,Nt++)_t===Dt&&(_t=0),Nt===Dt&&(Nt=0),lt[Z]=it($[Z],$[_t],$[Nt]);let H=[],At,It=lt.concat();for(let Z=0,Dt=W.length;Z<Dt;Z++){let _t=W[Z];At=[];for(let Nt=0,wt=_t.length,Ht=wt-1,Xt=Nt+1;Nt<wt;Nt++,Ht++,Xt++)Ht===wt&&(Ht=0),Xt===wt&&(Xt=0),At[Nt]=it(_t[Nt],_t[Ht],_t[Xt]);H.push(At),It=It.concat(At)}for(let Z=0;Z<_;Z++){let Dt=Z/_,_t=E*Math.cos(Dt*Math.PI/2),Nt=M*Math.sin(Dt*Math.PI/2)+A;for(let wt=0,Ht=$.length;wt<Ht;wt++){let Xt=gt($[wt],lt[wt],Nt);$t(Xt.x,Xt.y,-_t)}for(let wt=0,Ht=W.length;wt<Ht;wt++){let Xt=W[wt];At=H[wt];for(let Pt=0,ne=Xt.length;Pt<ne;Pt++){let Y=gt(Xt[Pt],At[Pt],Nt);$t(Y.x,Y.y,-_t)}}}let Kt=M+A;for(let Z=0;Z<ft;Z++){let Dt=v?gt(L[Z],It[Z],Kt):L[Z];R?(D.copy(B.normals[0]).multiplyScalar(Dt.x),U.copy(B.binormals[0]).multiplyScalar(Dt.y),P.copy(w[0]).add(D).add(U),$t(P.x,P.y,P.z)):$t(Dt.x,Dt.y,0)}for(let Z=1;Z<=g;Z++)for(let Dt=0;Dt<ft;Dt++){let _t=v?gt(L[Dt],It[Dt],Kt):L[Dt];R?(D.copy(B.normals[Z]).multiplyScalar(_t.x),U.copy(B.binormals[Z]).multiplyScalar(_t.y),P.copy(w[Z]).add(D).add(U),$t(P.x,P.y,P.z)):$t(_t.x,_t.y,y/g*Z)}for(let Z=_-1;Z>=0;Z--){let Dt=Z/_,_t=E*Math.cos(Dt*Math.PI/2),Nt=M*Math.sin(Dt*Math.PI/2)+A;for(let wt=0,Ht=$.length;wt<Ht;wt++){let Xt=gt($[wt],lt[wt],Nt);$t(Xt.x,Xt.y,y+_t)}for(let wt=0,Ht=W.length;wt<Ht;wt++){let Xt=W[wt];At=H[wt];for(let Pt=0,ne=Xt.length;Pt<ne;Pt++){let Y=gt(Xt[Pt],At[Pt],Nt);R?$t(Y.x,Y.y+w[g-1].y,w[g-1].x+_t):$t(Y.x,Y.y,y+_t)}}}nt(),bt();function nt(){let Z=s.length/3;if(v){let Dt=0,_t=ft*Dt;for(let Nt=0;Nt<vt;Nt++){let wt=Mt[Nt];Ut(wt[2]+_t,wt[1]+_t,wt[0]+_t)}Dt=g+_*2,_t=ft*Dt;for(let Nt=0;Nt<vt;Nt++){let wt=Mt[Nt];Ut(wt[0]+_t,wt[1]+_t,wt[2]+_t)}}else{for(let Dt=0;Dt<vt;Dt++){let _t=Mt[Dt];Ut(_t[2],_t[1],_t[0])}for(let Dt=0;Dt<vt;Dt++){let _t=Mt[Dt];Ut(_t[0]+ft*g,_t[1]+ft*g,_t[2]+ft*g)}}i.addGroup(Z,s.length/3-Z,0)}function bt(){let Z=s.length/3,Dt=0;Vt($,Dt),Dt+=$.length;for(let _t=0,Nt=W.length;_t<Nt;_t++){let wt=W[_t];Vt(wt,Dt),Dt+=wt.length}i.addGroup(Z,s.length/3-Z,1)}function Vt(Z,Dt){let _t=Z.length;for(;--_t>=0;){let Nt=_t,wt=_t-1;wt<0&&(wt=Z.length-1);for(let Ht=0,Xt=g+_*2;Ht<Xt;Ht++){let Pt=ft*Ht,ne=ft*(Ht+1),Y=Dt+Nt+Pt,N=Dt+wt+Pt,xt=Dt+wt+ne,St=Dt+Nt+ne;Gt(Y,N,xt,St)}}}function $t(Z,Dt,_t){p.push(Z),p.push(Dt),p.push(_t)}function Ut(Z,Dt,_t){Ct(Z),Ct(Dt),Ct(_t);let Nt=s.length/3,wt=T.generateTopUV(i,s,Nt-3,Nt-2,Nt-1);ee(wt[0]),ee(wt[1]),ee(wt[2])}function Gt(Z,Dt,_t,Nt){Ct(Z),Ct(Dt),Ct(Nt),Ct(Dt),Ct(_t),Ct(Nt);let wt=s.length/3,Ht=T.generateSideWallUV(i,s,wt-6,wt-3,wt-2,wt-1);ee(Ht[0]),ee(Ht[1]),ee(Ht[3]),ee(Ht[1]),ee(Ht[2]),ee(Ht[3])}function Ct(Z){s.push(p[Z*3+0]),s.push(p[Z*3+1]),s.push(p[Z*3+2])}function ee(Z){u.push(Z.x),u.push(Z.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,i=this.parameters.options;return pY(e,i,t)}static fromJSON(t,e){let i=[];for(let u=0,c=t.shapes.length;u<c;u++){let f=e[t.shapes[u]];i.push(f)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Nv[s.type]().fromJSON(s)),new n(i,t.options)}},hY={generateTopUV:function(n,t,e,i,s){let u=t[e*3],c=t[e*3+1],f=t[i*3],p=t[i*3+1],d=t[s*3],g=t[s*3+1];return[new Ot(u,c),new Ot(f,p),new Ot(d,g)]},generateSideWallUV:function(n,t,e,i,s,u){let c=t[e*3],f=t[e*3+1],p=t[e*3+2],d=t[i*3],g=t[i*3+1],y=t[i*3+2],v=t[s*3],E=t[s*3+1],M=t[s*3+2],A=t[u*3],_=t[u*3+1],x=t[u*3+2];return Math.abs(f-g)<Math.abs(c-d)?[new Ot(c,1-p),new Ot(d,1-y),new Ot(v,1-M),new Ot(A,1-x)]:[new Ot(f,1-p),new Ot(g,1-y),new Ot(E,1-M),new Ot(_,1-x)]}};function pY(n,t,e){if(e.shapes=[],Array.isArray(n))for(let i=0,s=n.length;i<s;i++){let u=n[i];e.shapes.push(u.uuid)}else e.shapes.push(n.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var od=class n extends ui{constructor(t=new Nl([new Ot(0,.5),new Ot(-.5,-.5),new Ot(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let i=[],s=[],u=[],c=[],f=0,p=0;if(Array.isArray(t)===!1)d(t);else for(let g=0;g<t.length;g++)d(t[g]),this.addGroup(f,p,g),f+=p,p=0;this.setIndex(i),this.setAttribute("position",new _r(s,3)),this.setAttribute("normal",new _r(u,3)),this.setAttribute("uv",new _r(c,2));function d(g){let y=s.length/3,v=g.extractPoints(e),E=v.shape,M=v.holes;ya.isClockWise(E)===!1&&(E=E.reverse());for(let _=0,x=M.length;_<x;_++){let T=M[_];ya.isClockWise(T)===!0&&(M[_]=T.reverse())}let A=ya.triangulateShape(E,M);for(let _=0,x=M.length;_<x;_++){let T=M[_];E=E.concat(T)}for(let _=0,x=E.length;_<x;_++){let T=E[_];s.push(T.x,T.y,0),u.push(0,0,1),c.push(T.x,T.y)}for(let _=0,x=A.length;_<x;_++){let T=A[_],w=T[0]+y,R=T[1]+y,B=T[2]+y;i.push(w,R,B),p+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return dY(e,t)}static fromJSON(t,e){let i=[];for(let s=0,u=t.shapes.length;s<u;s++){let c=e[t.shapes[s]];i.push(c)}return new n(i,t.curveSegments)}};function dY(n,t){if(t.shapes=[],Array.isArray(n))for(let e=0,i=n.length;e<i;e++){let s=n[e];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t}var sd=class extends ui{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){let e=[],i=new Set,s=new st,u=new st;if(t.index!==null){let c=t.attributes.position,f=t.index,p=t.groups;p.length===0&&(p=[{start:0,count:f.count,materialIndex:0}]);for(let d=0,g=p.length;d<g;++d){let y=p[d],v=y.start,E=y.count;for(let M=v,A=v+E;M<A;M+=3)for(let _=0;_<3;_++){let x=f.getX(M+_),T=f.getX(M+(_+1)%3);s.fromBufferAttribute(c,x),u.fromBufferAttribute(c,T),VI(s,u,i)===!0&&(e.push(s.x,s.y,s.z),e.push(u.x,u.y,u.z))}}}else{let c=t.attributes.position;for(let f=0,p=c.count/3;f<p;f++)for(let d=0;d<3;d++){let g=3*f+d,y=3*f+(d+1)%3;s.fromBufferAttribute(c,g),u.fromBufferAttribute(c,y),VI(s,u,i)===!0&&(e.push(s.x,s.y,s.z),e.push(u.x,u.y,u.z))}}this.setAttribute("position",new _r(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}};function VI(n,t,e){let i=`${n.x},${n.y},${n.z}-${t.x},${t.y},${t.z}`,s=`${t.x},${t.y},${t.z}-${n.x},${n.y},${n.z}`;return e.has(i)===!0||e.has(s)===!0?!1:(e.add(i),e.add(s),!0)}function Lp(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 gY(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Ol=class{constructor(t,e,i,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,i=this._cachedIndex,s=e[i],u=e[i-1];n:{t:{let c;e:{r:if(!(t<s)){for(let f=i+2;;){if(s===void 0){if(t<u)break r;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===f)break;if(u=s,s=e[++i],t<s)break t}c=e.length;break e}if(!(t>=u)){let f=e[1];t<f&&(i=2,u=f);for(let p=i-2;;){if(u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===p)break;if(s=u,u=e[--i-1],t>=u)break t}c=i,i=0;break e}break n}for(;i<c;){let f=i+c>>>1;t<e[f]?c=f:i=f+1}if(s=e[i],u=e[i-1],u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,u,s)}return this.interpolate_(i,u,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,i=this.sampleValues,s=this.valueSize,u=t*s;for(let c=0;c!==s;++c)e[c]=i[u+c];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Uv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:XC,endingEnd:XC}}intervalChanged_(t,e,i){let s=this.parameterPositions,u=t-2,c=t+1,f=s[u],p=s[c];if(f===void 0)switch(this.getSettings_().endingStart){case YC:u=t,f=2*e-i;break;case $C:u=s.length-2,f=e+s[u]-s[u+1];break;default:u=t,f=i}if(p===void 0)switch(this.getSettings_().endingEnd){case YC:c=t,p=2*i-e;break;case $C:c=1,p=i+s[1]-s[0];break;default:c=t-1,p=e}let d=(i-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-i),this._offsetPrev=u*g,this._offsetNext=c*g}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,y=this._offsetNext,v=this._weightPrev,E=this._weightNext,M=(i-e)/(s-e),A=M*M,_=A*M,x=-v*_+2*v*A-v*M,T=(1+v)*_+(-1.5-2*v)*A+(-.5+v)*M+1,w=(-1-E)*_+(1.5+E)*A+.5*M,R=E*_-E*A;for(let B=0;B!==f;++B)u[B]=x*c[g+B]+T*c[d+B]+w*c[p+B]+R*c[y+B];return u}},Bv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(i-e)/(s-e),y=1-g;for(let v=0;v!==f;++v)u[v]=c[d+v]*y+c[p+v]*g;return u}},zv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}},Do=class{constructor(t,e,i,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=Lp(e,this.TimeBufferType),this.values=Lp(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Lp(t.times,Array),values:Lp(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(i.interpolation=s)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new zv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Bv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Uv(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Op:e=this.InterpolantFactoryMethodDiscrete;break;case Dp:e=this.InterpolantFactoryMethodLinear;break;case xy:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Op;case this.InterpolantFactoryMethodLinear:return Dp;case this.InterpolantFactoryMethodSmooth:return xy}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]*=t}return this}trim(t,e){let i=this.times,s=i.length,u=0,c=s-1;for(;u!==s&&i[u]<t;)++u;for(;c!==-1&&i[c]>e;)--c;if(++c,u!==0||c!==s){u>=c&&(c=Math.max(c,1),u=c-1);let f=this.getValueSize();this.times=i.slice(u,c),this.values=this.values.slice(u*f,c*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 i=this.times,s=this.values,u=i.length;u===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let c=null;for(let f=0;f!==u;f++){let p=i[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(c!==null&&c>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,c),t=!1;break}c=p}if(s!==void 0&&gY(s))for(let f=0,p=s.length;f!==p;++f){let d=s[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(),i=this.getValueSize(),s=this.getInterpolation()===xy,u=t.length-1,c=1;for(let f=1;f<u;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(s)p=!0;else{let y=f*i,v=y-i,E=y+i;for(let M=0;M!==i;++M){let A=e[y+M];if(A!==e[v+M]||A!==e[E+M]){p=!0;break}}}if(p){if(f!==c){t[c]=t[f];let y=f*i,v=c*i;for(let E=0;E!==i;++E)e[v+E]=e[y+E]}++c}}if(u>0){t[c]=t[u];for(let f=u*i,p=c*i,d=0;d!==i;++d)e[p+d]=e[f+d];++c}return c!==t.length?(this.times=t.slice(0,c),this.values=e.slice(0,c*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=this.constructor,s=new i(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};Do.prototype.TimeBufferType=Float32Array;Do.prototype.ValueBufferType=Float32Array;Do.prototype.DefaultInterpolation=Dp;var hu=class extends Do{};hu.prototype.ValueTypeName="bool";hu.prototype.ValueBufferType=Array;hu.prototype.DefaultInterpolation=Op;hu.prototype.InterpolantFactoryMethodLinear=void 0;hu.prototype.InterpolantFactoryMethodSmooth=void 0;var Gv=class extends Do{};Gv.prototype.ValueTypeName="color";var kv=class extends Do{};kv.prototype.ValueTypeName="number";var qv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=(i-e)/(s-e),d=t*f;for(let g=d+f;d!==g;d+=4)lo.slerpFlat(u,0,c,d-f,c,d,p);return u}},vf=class extends Do{InterpolantFactoryMethodLinear(t){return new qv(this.times,this.values,this.getValueSize(),t)}};vf.prototype.ValueTypeName="quaternion";vf.prototype.DefaultInterpolation=Dp;vf.prototype.InterpolantFactoryMethodSmooth=void 0;var pu=class extends Do{};pu.prototype.ValueTypeName="string";pu.prototype.ValueBufferType=Array;pu.prototype.DefaultInterpolation=Op;pu.prototype.InterpolantFactoryMethodLinear=void 0;pu.prototype.InterpolantFactoryMethodSmooth=void 0;var Vv=class extends Do{};Vv.prototype.ValueTypeName="vector";var Hv=class{constructor(t,e,i){let s=this,u=!1,c=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(g){f++,u===!1&&s.onStart!==void 0&&s.onStart(g,c,f),u=!0},this.itemEnd=function(g){c++,s.onProgress!==void 0&&s.onProgress(g,c,f),c===f&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(g){s.onError!==void 0&&s.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,y){return d.push(g,y),this},this.removeHandler=function(g){let y=d.indexOf(g);return y!==-1&&d.splice(y,2),this},this.getHandler=function(g){for(let y=0,v=d.length;y<v;y+=2){let E=d[y],M=d[y+1];if(E.global&&(E.lastIndex=0),E.test(g))return M}return null}}},mY=new Hv,Wv=class{constructor(t){this.manager=t!==void 0?t:mY,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let i=this;return new Promise(function(s,u){i.load(t,s,e,u)})}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}};Wv.DEFAULT_MATERIAL_NAME="__DEFAULT";var ad=class extends ui{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}};var Kv="\\[\\]\\.:\\/",yY=new RegExp("["+Kv+"]","g"),Qv="[^"+Kv+"]",vY="[^"+Kv.replace("\\.","")+"]",_Y=/((?:WC+[\/:])*)/.source.replace("WC",Qv),xY=/(WCOD+)?/.source.replace("WCOD",vY),EY=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qv),SY=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qv),wY=new RegExp("^"+_Y+xY+EY+SY+"$"),MY=["material","materials","bones","map"],Xv=class{constructor(t,e,i){let s=i||Yn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(t,e)}setValue(t,e){let i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,u=i.length;s!==u;++s)i[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Yn=class n{constructor(t,e,i){this.path=e,this.parsedPath=i||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,i){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,i):new n(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(yY,"")}static parseTrackName(t){let e=wY.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let u=i.nodeName.substring(s+1);MY.indexOf(u)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=u)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(i!==void 0)return i}if(t.children){let i=function(u){for(let c=0;c<u.length;c++){let f=u[c];if(f.name===e||f.uuid===e)return f;let p=i(f.children);if(p)return p}return null},s=i(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 i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)t[e++]=i[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 i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[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,i=e.objectName,s=e.propertyName,u=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(i){let d=e.objectIndex;switch(i){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[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[i]}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 c=t[s];if(c===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+s+" 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(u!==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[u]!==void 0&&(u=t.morphTargetDictionary[u])}p=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=u}else c.fromArray!==void 0&&c.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=c):Array.isArray(c)?(p=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=s;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}};Yn.Composite=Xv;Yn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Yn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Yn.prototype.GetterByBindingType=[Yn.prototype._getValue_direct,Yn.prototype._getValue_array,Yn.prototype._getValue_arrayElement,Yn.prototype._getValue_toArray];Yn.prototype.SetterByBindingTypeAndVersioning=[[Yn.prototype._setValue_direct,Yn.prototype._setValue_direct_setNeedsUpdate,Yn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Yn.prototype._setValue_array,Yn.prototype._setValue_array_setNeedsUpdate,Yn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Yn.prototype._setValue_arrayElement,Yn.prototype._setValue_arrayElement_setNeedsUpdate,Yn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Yn.prototype._setValue_fromArray,Yn.prototype._setValue_fromArray_setNeedsUpdate,Yn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Mot=new Float32Array(1);var _f=class extends pf{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Yv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Yv);function hd(n,t){t===void 0&&(t=[]);let e=new Nl(n.map(i=>new Ot(...i)));return t.length&&t.forEach(i=>{var s=new Ll(i.map(u=>new Ot(...u)));e.holes.push(s)}),e}var MAt=Jt(Yu(),1);var Ur=63710088e-1,kot={centimeters:Ur*100,centimetres:Ur*100,degrees:Ur/111325,feet:Ur*3.28084,inches:Ur*39.37,kilometers:Ur/1e3,kilometres:Ur/1e3,meters:Ur,metres:Ur,miles:Ur/1609.344,millimeters:Ur*1e3,millimetres:Ur*1e3,nauticalmiles:Ur/1852,radians:1,yards:Ur*1.0936},qot={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/Ur,yards:1.0936133};function Ai(n,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}function Dn(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(!es(n[0])||!es(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return Ai(i,t,e)}function Un(n,t,e){e===void 0&&(e={});for(var i=0,s=n;i<s.length;i++){var u=s[i];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var c=0;c<u[u.length-1].length;c++)if(u[u.length-1][c]!==u[0][c])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:n};return Ai(f,t,e)}function Br(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 i={type:"LineString",coordinates:n};return Ai(i,t,e)}function u_(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return Ai(i,t,e)}function es(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Sr(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,g=0,y=0,v,E=n.type,M=E==="FeatureCollection",A=E==="Feature",_=M?n.features.length:1,x=0;x<_;x++){d=M?n.features[x].geometry:A?n.geometry:n,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var T=0;T<f;T++){var w=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var B=c.type;switch(g=e&&(B==="Polygon"||B==="MultiPolygon")?1:0,B){case null:break;case"Point":if(t(p,y,x,w,R)===!1)return!1;y++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,w,R)===!1)return!1;y++,B==="MultiPoint"&&w++}B==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-g;s++){if(t(p[i][s],y,x,w,R)===!1)return!1;y++}B==="MultiLineString"&&w++,B==="Polygon"&&R++}B==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<p.length;i++){for(R=0,s=0;s<p[i].length;s++){for(u=0;u<p[i][s].length-g;u++){if(t(p[i][s][u],y,x,w,R)===!1)return!1;y++}R++}w++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(Sr(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TP(n,t,e,i){var s=e;return Sr(n,function(u,c,f,p,d){c===0&&e===void 0?s=u:s=t(s,u,c,f,p,d)},i),s}function Ea(n,t){var e,i,s,u,c,f,p,d,g,y,v=0,E=n.type==="FeatureCollection",M=n.type==="Feature",A=E?n.features.length:1;for(e=0;e<A;e++){for(f=E?n.features[e].geometry:M?n.geometry:n,d=E?n.features[e].properties:M?n.properties:{},g=E?n.features[e].bbox:M?n.bbox:void 0,y=E?n.features[e].id:M?n.id:void 0,p=f?f.type==="GeometryCollection":!1,c=p?f.geometries.length:1,s=0;s<c;s++){if(u=p?f.geometries[s]:f,u===null){if(t(null,v,d,g,y)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,v,d,g,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,g,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Ji(n,t){Ea(n,function(e,i,s,u,c){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Ai(e,s,{bbox:u,id:c}),i,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],y={type:p,coordinates:g};if(t(Ai(y,s),i,d)===!1)return!1}})}function l_(n){var t=[1/0,1/0,-1/0,-1/0];return Sr(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}l_.default=l_;var li=l_;function $r(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 c_(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 Zr(n){return n.type==="Feature"?n.geometry:n}var i$=Jt(md(),1);var d$=Jt(WP(),1);function zr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var i=$r(n),s=Zr(t),u=s.type,c=t.bbox,f=s.coordinates;if(c&&g$(i,c)===!1)return!1;u==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(XP(i,f[d][0],e.ignoreBoundary)){for(var g=!1,y=1;y<f[d].length&&!g;)XP(i,f[d][y],!e.ignoreBoundary)&&(g=!0),y++;g||(p=!0)}return p}function XP(n,t,e){var i=!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,u=t.length-1;s<t.length;u=s++){var c=t[s][0],f=t[s][1],p=t[u][0],d=t[u][1],g=n[1]*(c-p)+f*(p-n[0])+d*(n[0]-c)===0&&(c-n[0])*(p-n[0])<=0&&(f-n[1])*(d-n[1])<=0;if(g)return!e;var y=f>n[1]!=d>n[1]&&n[0]<(p-c)*(n[1]-f)/(d-f)+c;y&&(i=!i)}return i}function g$(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var ZP=new ArrayBuffer(16),yat=new Float64Array(ZP),vat=new Uint32Array(ZP);var P$=Jt(A_(),1);var Hut=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 i=this.points[e],s=this.points[e+1];this.centers.push({x:(i.x+s.x)/2,y:(i.y+s.y)/2,z:(i.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var u=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,c=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+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+c),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+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+c),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 n.prototype.cacheSteps=function(t){var e=[],i=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var u=this.pos(s),c=Math.sqrt((u.x-i.x)*(u.x-i.x)+(u.y-i.y)*(u.y-i.y)+(u.z-i.z)*(u.z-i.z));c>t&&(e.push(s),i=u)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),i=this.pos(t-10);return{angle:180*Math.atan2(e.y-i.y,e.x-i.x)/3.14,speed:Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)+(i.z-e.z)*(i.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 i=e/this.duration;if(i>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*i),u=(this.length-1)*i-s;return R$(u,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function R$(n,t,e,i,s){var u=L$(n),c={x:s.x*u[0]+i.x*u[1]+e.x*u[2]+t.x*u[3],y:s.y*u[0]+i.y*u[1]+e.y*u[2]+t.y*u[3],z:s.z*u[0]+i.z*u[1]+e.z*u[2]+t.z*u[3]};return c}function L$(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 wf(n,t){t===void 0&&(t={});var e=Number(n[0]),i=Number(n[1]),s=Number(n[2]),u=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var c=[e,i],f=[e,u],p=[s,u],d=[s,i];return Un([[c,d,p,f,c]],t.properties,{bbox:n,id:t.id})}function N$(n){return wf(li(n))}var T_=N$;function O$(n,t){t===void 0&&(t={});var e=li(n),i=(e[0]+e[2])/2,s=(e[1]+e[3])/2;return Dn([i,s],t.properties,t)}var du=O$;var j$=Jt(sR(),1);var MZ=Jt(Nd(),1);var AZ=Jt(md(),1);var IZ=Jt(A_(),1);var MR=Math.PI/180,bR=180/Math.PI,Pf=function(n,t){this.lon=n,this.lat=t,this.x=MR*n,this.y=MR*t};Pf.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Pf.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Pf(t,n)};var AR=function(){this.coords=[],this.length=0};AR.prototype.move_to=function(n){this.length++,this.coords.push(n)};var Y_=function(n){this.properties=n||{},this.geometries=[]};Y_.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}};Y_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(u){t+=u[0]+" "+u[1]+","},i=0;i<this.geometries.length;i++){if(this.geometries[i].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[i].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var TR=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 Pf(n.x,n.y),this.end=new Pf(t.x,t.y),this.properties=e||{};var i=this.start.x-this.end.x,s=this.start.y-this.end.y,u=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(i/2),2);if(this.g=2*Math.asin(Math.sqrt(u)),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)};TR.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),i=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),u=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),c=bR*Math.atan2(u,Math.sqrt(Math.pow(i,2)+Math.pow(s,2))),f=bR*Math.atan2(s,i);return[f,c]};TR.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 i=1/(n-1),s=0;s<n;++s){var u=i*s,c=this.interpolate(u);e.push(c)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,y=-180+d,v=360-d,E=1;E<e.length;++E){var M=e[E-1][0],A=e[E][0],_=Math.abs(A-M);_>v&&(A>g&&M<y||M>g&&A<y)?f=!0:_>p&&(p=_)}var x=[];if(f&&p<d){var T=[];x.push(T);for(var w=0;w<e.length;++w){var R=parseFloat(e[w][0]);if(w>0&&Math.abs(R-e[w-1][0])>v){var B=parseFloat(e[w-1][0]),U=parseFloat(e[w-1][1]),D=parseFloat(e[w][0]),P=parseFloat(e[w][1]);if(B>-180&&B<y&&D===180&&w+1<e.length&&e[w-1][0]>-180&&e[w-1][0]<y){T.push([-180,e[w][1]]),w++,T.push([e[w][0],e[w][1]]);continue}else if(B>g&&B<180&&D===-180&&w+1<e.length&&e[w-1][0]>g&&e[w-1][0]<180){T.push([180,e[w][1]]),w++,T.push([e[w][0],e[w][1]]);continue}if(B<y&&D>g){var ct=B;B=D,D=ct;var L=U;U=P,P=L}if(B>g&&D<y&&(D+=360),B<=180&&D>=180&&B<D){var W=(180-B)/(D-B),V=W*P+(1-W)*U;T.push([e[w-1][0]>g?180:-180,V]),T=[],T.push([e[w-1][0]>g?-180:180,V]),x.push(T)}else T=[],x.push(T);T.push([R,e[w][1]])}else T.push([e[w][0],e[w][1]])}}else{var Mt=[];x.push(Mt);for(var $=0;$<e.length;++$)Mt.push([e[$][0],e[$][1]])}for(var gt=new Y_(this.properties),ft=0;ft<x.length;++ft){var vt=new AR;gt.geometries.push(vt);for(var it=x[ft],lt=0;lt<it.length;++lt)vt.move_to(it[lt])}return gt};var LZ=Jt(Nd(),1);var Rj=Jt(Nd(),1);var Lj=Jt(Ex(),1);var Dj=Jt(md(),1);var Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[],$e=[],Ze=[],Je=[],je=[];Oe[85]=Ue[85]=-1;De[85]=Be[85]=0;Fe[85]=ze[85]=1;Xe[85]=Ze[85]=1;Ye[85]=Je[85]=0;$e[85]=je[85]=1;Ce[85]=Re[85]=0;Ie[85]=Le[85]=-1;Pe[85]=qe[85]=0;Ve[85]=Ge[85]=0;He[85]=ke[85]=1;Ne[85]=We[85]=1;Ze[1]=Ze[169]=0;Je[1]=Je[169]=-1;je[1]=je[169]=0;Ge[1]=Ge[169]=-1;ke[1]=ke[169]=0;qe[1]=qe[169]=0;Ue[4]=Ue[166]=0;Be[4]=Be[166]=-1;ze[4]=ze[166]=1;Ve[4]=Ve[166]=1;He[4]=He[166]=0;We[4]=We[166]=0;Oe[16]=Oe[154]=0;De[16]=De[154]=1;Fe[16]=Fe[154]=1;Re[16]=Re[154]=1;Le[16]=Le[154]=0;Ne[16]=Ne[154]=1;Xe[64]=Xe[106]=0;Ye[64]=Ye[106]=1;$e[64]=$e[106]=0;Ce[64]=Ce[106]=-1;Ie[64]=Ie[106]=0;Pe[64]=Pe[106]=1;Xe[2]=Xe[168]=0;Ye[2]=Ye[168]=-1;$e[2]=$e[168]=1;Ze[2]=Ze[168]=0;Je[2]=Je[168]=-1;je[2]=je[168]=0;Ge[2]=Ge[168]=-1;ke[2]=ke[168]=0;qe[2]=qe[168]=0;Ve[2]=Ve[168]=-1;He[2]=He[168]=0;We[2]=We[168]=1;Oe[8]=Oe[162]=0;De[8]=De[162]=-1;Fe[8]=Fe[162]=0;Ue[8]=Ue[162]=0;Be[8]=Be[162]=-1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=1;ke[8]=ke[162]=0;qe[8]=qe[162]=1;Ve[8]=Ve[162]=1;He[8]=He[162]=0;We[8]=We[162]=0;Oe[32]=Oe[138]=0;De[32]=De[138]=1;Fe[32]=Fe[138]=1;Ue[32]=Ue[138]=0;Be[32]=Be[138]=1;ze[32]=ze[138]=0;Ce[32]=Ce[138]=1;Ie[32]=Ie[138]=0;Pe[32]=Pe[138]=0;Re[32]=Re[138]=1;Le[32]=Le[138]=0;Ne[32]=Ne[138]=1;Ze[128]=Ze[42]=0;Je[128]=Je[42]=1;je[128]=je[42]=1;Xe[128]=Xe[42]=0;Ye[128]=Ye[42]=1;$e[128]=$e[42]=0;Ce[128]=Ce[42]=-1;Ie[128]=Ie[42]=0;Pe[128]=Pe[42]=1;Re[128]=Re[42]=-1;Le[128]=Le[42]=0;Ne[128]=Ne[42]=0;Ue[5]=Ue[165]=-1;Be[5]=Be[165]=0;ze[5]=ze[165]=0;Ze[5]=Ze[165]=1;Je[5]=Je[165]=0;je[5]=je[165]=0;Ve[20]=Ve[150]=0;He[20]=He[150]=1;We[20]=We[150]=1;Re[20]=Re[150]=0;Le[20]=Le[150]=-1;Ne[20]=Ne[150]=1;Oe[80]=Oe[90]=-1;De[80]=De[90]=0;Fe[80]=Fe[90]=1;Xe[80]=Xe[90]=1;Ye[80]=Ye[90]=0;$e[80]=$e[90]=1;Ge[65]=Ge[105]=0;ke[65]=ke[105]=1;qe[65]=qe[105]=0;Ce[65]=Ce[105]=0;Ie[65]=Ie[105]=-1;Pe[65]=Pe[105]=0;Oe[160]=Oe[10]=-1;De[160]=De[10]=0;Fe[160]=Fe[10]=1;Ue[160]=Ue[10]=-1;Be[160]=Be[10]=0;ze[160]=ze[10]=0;Ze[160]=Ze[10]=1;Je[160]=Je[10]=0;je[160]=je[10]=0;Xe[160]=Xe[10]=1;Ye[160]=Ye[10]=0;$e[160]=$e[10]=1;Ve[130]=Ve[40]=0;He[130]=He[40]=1;We[130]=We[40]=1;Ge[130]=Ge[40]=0;ke[130]=ke[40]=1;qe[130]=qe[40]=0;Ce[130]=Ce[40]=0;Ie[130]=Ie[40]=-1;Pe[130]=Pe[40]=0;Re[130]=Re[40]=0;Le[130]=Le[40]=-1;Ne[130]=Ne[40]=1;Ue[37]=Ue[133]=0;Be[37]=Be[133]=1;ze[37]=ze[133]=1;Ze[37]=Ze[133]=0;Je[37]=Je[133]=1;je[37]=je[133]=0;Ce[37]=Ce[133]=-1;Ie[37]=Ie[133]=0;Pe[37]=Pe[133]=0;Re[37]=Re[133]=1;Le[37]=Le[133]=0;Ne[37]=Ne[133]=0;Ve[148]=Ve[22]=-1;He[148]=He[22]=0;We[148]=We[22]=0;Ze[148]=Ze[22]=0;Je[148]=Je[22]=-1;je[148]=je[22]=1;Xe[148]=Xe[22]=0;Ye[148]=Ye[22]=1;$e[148]=$e[22]=1;Re[148]=Re[22]=-1;Le[148]=Le[22]=0;Ne[148]=Ne[22]=1;Oe[82]=Oe[88]=0;De[82]=De[88]=-1;Fe[82]=Fe[88]=1;Ve[82]=Ve[88]=1;He[82]=He[88]=0;We[82]=We[88]=1;Ge[82]=Ge[88]=-1;ke[82]=ke[88]=0;qe[82]=qe[88]=1;Xe[82]=Xe[88]=0;Ye[82]=Ye[88]=-1;$e[82]=$e[88]=0;Oe[73]=Oe[97]=0;De[73]=De[97]=1;Fe[73]=Fe[97]=0;Ue[73]=Ue[97]=0;Be[73]=Be[97]=-1;ze[73]=ze[97]=0;Ge[73]=Ge[97]=1;ke[73]=ke[97]=0;qe[73]=qe[97]=0;Ce[73]=Ce[97]=1;Ie[73]=Ie[97]=0;Pe[73]=Pe[97]=1;Oe[145]=Oe[25]=0;De[145]=De[25]=-1;Fe[145]=Fe[25]=0;Ge[145]=Ge[25]=1;ke[145]=ke[25]=0;qe[145]=qe[25]=1;Ze[145]=Ze[25]=0;Je[145]=Je[25]=1;je[145]=je[25]=1;Re[145]=Re[25]=-1;Le[145]=Le[25]=0;Ne[145]=Ne[25]=0;Ue[70]=Ue[100]=0;Be[70]=Be[100]=1;ze[70]=ze[100]=0;Ve[70]=Ve[100]=-1;He[70]=He[100]=0;We[70]=We[100]=1;Xe[70]=Xe[100]=0;Ye[70]=Ye[100]=-1;$e[70]=$e[100]=1;Ce[70]=Ce[100]=1;Ie[70]=Ie[100]=0;Pe[70]=Pe[100]=0;Ue[101]=Ue[69]=0;Be[101]=Be[69]=1;ze[101]=ze[69]=0;Ce[101]=Ce[69]=1;Ie[101]=Ie[69]=0;Pe[101]=Pe[69]=0;Ze[149]=Ze[21]=0;Je[149]=Je[21]=1;je[149]=je[21]=1;Re[149]=Re[21]=-1;Le[149]=Le[21]=0;Ne[149]=Ne[21]=0;Ve[86]=Ve[84]=-1;He[86]=He[84]=0;We[86]=We[84]=1;Xe[86]=Xe[84]=0;Ye[86]=Ye[84]=-1;$e[86]=$e[84]=1;Oe[89]=Oe[81]=0;De[89]=De[81]=-1;Fe[89]=Fe[81]=0;Ge[89]=Ge[81]=1;ke[89]=ke[81]=0;qe[89]=qe[81]=1;Oe[96]=Oe[74]=0;De[96]=De[74]=1;Fe[96]=Fe[74]=0;Ue[96]=Ue[74]=-1;Be[96]=Be[74]=0;ze[96]=ze[74]=1;Xe[96]=Xe[74]=1;Ye[96]=Ye[74]=0;$e[96]=$e[74]=0;Ce[96]=Ce[74]=1;Ie[96]=Ie[74]=0;Pe[96]=Pe[74]=1;Oe[24]=Oe[146]=0;De[24]=De[146]=-1;Fe[24]=Fe[146]=1;Ve[24]=Ve[146]=1;He[24]=He[146]=0;We[24]=We[146]=1;Ge[24]=Ge[146]=0;ke[24]=ke[146]=1;qe[24]=qe[146]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=-1;Ne[24]=Ne[146]=0;Ue[6]=Ue[164]=-1;Be[6]=Be[164]=0;ze[6]=ze[164]=1;Ve[6]=Ve[164]=-1;He[6]=He[164]=0;We[6]=We[164]=0;Ze[6]=Ze[164]=0;Je[6]=Je[164]=-1;je[6]=je[164]=1;Xe[6]=Xe[164]=1;Ye[6]=Ye[164]=0;$e[6]=$e[164]=0;Ge[129]=Ge[41]=0;ke[129]=ke[41]=1;qe[129]=qe[41]=1;Ze[129]=Ze[41]=0;Je[129]=Je[41]=1;je[129]=je[41]=0;Ce[129]=Ce[41]=-1;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=0;Re[129]=Re[41]=0;Le[129]=Le[41]=-1;Ne[129]=Ne[41]=0;Ve[66]=Ve[104]=0;He[66]=He[104]=1;We[66]=We[104]=0;Ge[66]=Ge[104]=-1;ke[66]=ke[104]=0;qe[66]=qe[104]=1;Xe[66]=Xe[104]=0;Ye[66]=Ye[104]=-1;$e[66]=$e[104]=0;Ce[66]=Ce[104]=0;Ie[66]=Ie[104]=-1;Pe[66]=Pe[104]=1;Oe[144]=Oe[26]=-1;De[144]=De[26]=0;Fe[144]=Fe[26]=0;Ze[144]=Ze[26]=1;Je[144]=Je[26]=0;je[144]=je[26]=1;Xe[144]=Xe[26]=0;Ye[144]=Ye[26]=1;$e[144]=$e[26]=1;Re[144]=Re[26]=-1;Le[144]=Le[26]=0;Ne[144]=Ne[26]=1;Ue[36]=Ue[134]=0;Be[36]=Be[134]=1;ze[36]=ze[134]=1;Ve[36]=Ve[134]=0;He[36]=He[134]=1;We[36]=We[134]=0;Ce[36]=Ce[134]=0;Ie[36]=Ie[134]=-1;Pe[36]=Pe[134]=1;Re[36]=Re[134]=1;Le[36]=Le[134]=0;Ne[36]=Ne[134]=0;Oe[9]=Oe[161]=-1;De[9]=De[161]=0;Fe[9]=Fe[161]=0;Ue[9]=Ue[161]=0;Be[9]=Be[161]=-1;ze[9]=ze[161]=0;Ge[9]=Ge[161]=1;ke[9]=ke[161]=0;qe[9]=qe[161]=0;Ze[9]=Ze[161]=1;Je[9]=Je[161]=0;je[9]=je[161]=1;Oe[136]=0;De[136]=1;Fe[136]=1;Ue[136]=0;Be[136]=1;ze[136]=0;Ve[136]=-1;He[136]=0;We[136]=1;Ge[136]=-1;ke[136]=0;qe[136]=0;Ze[136]=0;Je[136]=-1;je[136]=0;Xe[136]=0;Ye[136]=-1;$e[136]=1;Ce[136]=1;Ie[136]=0;Pe[136]=0;Re[136]=1;Le[136]=0;Ne[136]=1;Oe[34]=0;De[34]=-1;Fe[34]=0;Ue[34]=0;Be[34]=-1;ze[34]=1;Ve[34]=1;He[34]=0;We[34]=0;Ge[34]=1;ke[34]=0;qe[34]=1;Ze[34]=0;Je[34]=1;je[34]=1;Xe[34]=0;Ye[34]=1;$e[34]=0;Ce[34]=-1;Ie[34]=0;Pe[34]=1;Re[34]=-1;Le[34]=0;Ne[34]=0;Oe[35]=0;De[35]=1;Fe[35]=1;Ue[35]=0;Be[35]=-1;ze[35]=1;Ve[35]=1;He[35]=0;We[35]=0;Ge[35]=-1;ke[35]=0;qe[35]=0;Ze[35]=0;Je[35]=-1;je[35]=0;Xe[35]=0;Ye[35]=1;$e[35]=0;Ce[35]=-1;Ie[35]=0;Pe[35]=1;Re[35]=1;Le[35]=0;Ne[35]=1;Oe[153]=0;De[153]=1;Fe[153]=1;Ge[153]=-1;ke[153]=0;qe[153]=0;Ze[153]=0;Je[153]=-1;je[153]=0;Re[153]=1;Le[153]=0;Ne[153]=1;Ue[102]=0;Be[102]=-1;ze[102]=1;Ve[102]=1;He[102]=0;We[102]=0;Xe[102]=0;Ye[102]=1;$e[102]=0;Ce[102]=-1;Ie[102]=0;Pe[102]=1;Oe[155]=0;De[155]=-1;Fe[155]=0;Ge[155]=1;ke[155]=0;qe[155]=1;Ze[155]=0;Je[155]=1;je[155]=1;Re[155]=-1;Le[155]=0;Ne[155]=0;Ue[103]=0;Be[103]=1;ze[103]=0;Ve[103]=-1;He[103]=0;We[103]=1;Xe[103]=0;Ye[103]=-1;$e[103]=1;Ce[103]=1;Ie[103]=0;Pe[103]=0;Oe[152]=0;De[152]=1;Fe[152]=1;Ve[152]=-1;He[152]=0;We[152]=1;Ge[152]=-1;ke[152]=0;qe[152]=0;Ze[152]=0;Je[152]=-1;je[152]=0;Xe[152]=0;Ye[152]=-1;$e[152]=1;Re[152]=1;Le[152]=0;Ne[152]=1;Oe[156]=0;De[156]=-1;Fe[156]=1;Ve[156]=1;He[156]=0;We[156]=1;Ge[156]=-1;ke[156]=0;qe[156]=0;Ze[156]=0;Je[156]=-1;je[156]=0;Xe[156]=0;Ye[156]=1;$e[156]=1;Re[156]=-1;Le[156]=0;Ne[156]=1;Oe[137]=0;De[137]=1;Fe[137]=1;Ue[137]=0;Be[137]=1;ze[137]=0;Ge[137]=-1;ke[137]=0;qe[137]=0;Ze[137]=0;Je[137]=-1;je[137]=0;Ce[137]=1;Ie[137]=0;Pe[137]=0;Re[137]=1;Le[137]=0;Ne[137]=1;Oe[139]=0;De[139]=1;Fe[139]=1;Ue[139]=0;Be[139]=-1;ze[139]=0;Ge[139]=1;ke[139]=0;qe[139]=0;Ze[139]=0;Je[139]=1;je[139]=0;Ce[139]=-1;Ie[139]=0;Pe[139]=0;Re[139]=1;Le[139]=0;Ne[139]=1;Oe[98]=0;De[98]=-1;Fe[98]=0;Ue[98]=0;Be[98]=-1;ze[98]=1;Ve[98]=1;He[98]=0;We[98]=0;Ge[98]=1;ke[98]=0;qe[98]=1;Xe[98]=0;Ye[98]=1;$e[98]=0;Ce[98]=-1;Ie[98]=0;Pe[98]=1;Oe[99]=0;De[99]=1;Fe[99]=0;Ue[99]=0;Be[99]=-1;ze[99]=1;Ve[99]=1;He[99]=0;We[99]=0;Ge[99]=-1;ke[99]=0;qe[99]=1;Xe[99]=0;Ye[99]=-1;$e[99]=0;Ce[99]=1;Ie[99]=0;Pe[99]=1;Ue[38]=0;Be[38]=-1;ze[38]=1;Ve[38]=1;He[38]=0;We[38]=0;Ze[38]=0;Je[38]=1;je[38]=1;Xe[38]=0;Ye[38]=1;$e[38]=0;Ce[38]=-1;Ie[38]=0;Pe[38]=1;Re[38]=-1;Le[38]=0;Ne[38]=0;Ue[39]=0;Be[39]=1;ze[39]=1;Ve[39]=-1;He[39]=0;We[39]=0;Ze[39]=0;Je[39]=-1;je[39]=1;Xe[39]=0;Ye[39]=1;$e[39]=0;Ce[39]=-1;Ie[39]=0;Pe[39]=1;Re[39]=1;Le[39]=0;Ne[39]=0;var Sx=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},wx=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},Mx=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},bx=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},Ax=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},Tx=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},Cx=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},Ix=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Fj=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},Uj=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},Bj=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},zj=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},Gj=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},kj=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},qj=function(){return[[0,0],[0,1],[1,1],[1,0]]},Vj=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},Hj=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},Wj=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},Xj=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},Yj=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},$j=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},Zj=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},Jj=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},jj=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},Kj=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},Qj=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},tK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},eK=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},nK=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},rK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},iK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},oK=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},sK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},aK=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]]},uK=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},lK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},cK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},fK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},hK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},pK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},en=[],nn=[],rn=[],on=[],sn=[],an=[],un=[],ln=[];on[1]=sn[1]=18;on[169]=sn[169]=18;rn[4]=nn[4]=12;rn[166]=nn[166]=12;en[16]=ln[16]=4;en[154]=ln[154]=4;an[64]=un[64]=22;an[106]=un[106]=22;rn[2]=an[2]=17;on[2]=sn[2]=18;rn[168]=an[168]=17;on[168]=sn[168]=18;en[8]=on[8]=9;nn[8]=rn[8]=12;en[162]=on[162]=9;nn[162]=rn[162]=12;en[32]=ln[32]=4;nn[32]=un[32]=1;en[138]=ln[138]=4;nn[138]=un[138]=1;sn[128]=ln[128]=21;an[128]=un[128]=22;sn[42]=ln[42]=21;an[42]=un[42]=22;nn[5]=sn[5]=14;nn[165]=sn[165]=14;rn[20]=ln[20]=6;rn[150]=ln[150]=6;en[80]=an[80]=11;en[90]=an[90]=11;on[65]=un[65]=3;on[105]=un[105]=3;en[160]=an[160]=11;nn[160]=sn[160]=14;en[10]=an[10]=11;nn[10]=sn[10]=14;rn[130]=ln[130]=6;on[130]=un[130]=3;rn[40]=ln[40]=6;on[40]=un[40]=3;nn[101]=un[101]=1;nn[69]=un[69]=1;sn[149]=ln[149]=21;sn[21]=ln[21]=21;rn[86]=an[86]=17;rn[84]=an[84]=17;en[89]=on[89]=9;en[81]=on[81]=9;en[96]=un[96]=0;nn[96]=an[96]=15;en[74]=un[74]=0;nn[74]=an[74]=15;en[24]=rn[24]=8;on[24]=ln[24]=7;en[146]=rn[146]=8;on[146]=ln[146]=7;nn[6]=an[6]=15;rn[6]=sn[6]=16;nn[164]=an[164]=15;rn[164]=sn[164]=16;on[129]=ln[129]=7;sn[129]=un[129]=20;on[41]=ln[41]=7;sn[41]=un[41]=20;rn[66]=un[66]=2;on[66]=an[66]=19;rn[104]=un[104]=2;on[104]=an[104]=19;en[144]=sn[144]=10;an[144]=ln[144]=23;en[26]=sn[26]=10;an[26]=ln[26]=23;nn[36]=ln[36]=5;rn[36]=un[36]=2;nn[134]=ln[134]=5;rn[134]=un[134]=2;en[9]=sn[9]=10;nn[9]=on[9]=13;en[161]=sn[161]=10;nn[161]=on[161]=13;nn[37]=ln[37]=5;sn[37]=un[37]=20;nn[133]=ln[133]=5;sn[133]=un[133]=20;rn[148]=sn[148]=16;an[148]=ln[148]=23;rn[22]=sn[22]=16;an[22]=ln[22]=23;en[82]=rn[82]=8;on[82]=an[82]=19;en[88]=rn[88]=8;on[88]=an[88]=19;en[73]=un[73]=0;nn[73]=on[73]=13;en[97]=un[97]=0;nn[97]=on[97]=13;en[145]=on[145]=9;sn[145]=ln[145]=21;en[25]=on[25]=9;sn[25]=ln[25]=21;nn[70]=un[70]=1;rn[70]=an[70]=17;nn[100]=un[100]=1;rn[100]=an[100]=17;en[34]=on[34]=9;nn[34]=rn[34]=12;sn[34]=ln[34]=21;an[34]=un[34]=22;en[136]=ln[136]=4;nn[136]=un[136]=1;rn[136]=an[136]=17;on[136]=sn[136]=18;en[35]=ln[35]=4;nn[35]=rn[35]=12;on[35]=sn[35]=18;an[35]=un[35]=22;en[153]=ln[153]=4;on[153]=sn[153]=18;nn[102]=rn[102]=12;an[102]=un[102]=22;en[155]=on[155]=9;sn[155]=ln[155]=23;nn[103]=un[103]=1;rn[103]=an[103]=17;en[152]=ln[152]=4;rn[152]=an[152]=17;on[152]=sn[152]=18;en[156]=rn[156]=8;on[156]=sn[156]=18;an[156]=ln[156]=23;en[137]=ln[137]=4;nn[137]=un[137]=1;on[137]=sn[137]=18;en[139]=ln[139]=4;nn[139]=on[139]=13;sn[139]=un[139]=20;en[98]=on[98]=9;nn[98]=rn[98]=12;an[98]=un[98]=22;en[99]=un[99]=0;nn[99]=rn[99]=12;on[99]=an[99]=19;nn[38]=rn[38]=12;sn[38]=ln[38]=21;an[38]=un[38]=22;nn[39]=ln[39]=5;rn[39]=sn[39]=16;an[39]=un[39]=22;var Yt=[];Yt[1]=Yt[169]=Sx;Yt[4]=Yt[166]=wx;Yt[16]=Yt[154]=Mx;Yt[64]=Yt[106]=bx;Yt[168]=Yt[2]=Ax;Yt[162]=Yt[8]=Tx;Yt[138]=Yt[32]=Cx;Yt[42]=Yt[128]=Ix;Yt[5]=Yt[165]=Fj;Yt[20]=Yt[150]=Uj;Yt[80]=Yt[90]=Bj;Yt[65]=Yt[105]=zj;Yt[160]=Yt[10]=Gj;Yt[130]=Yt[40]=kj;Yt[85]=qj;Yt[101]=Yt[69]=Vj;Yt[149]=Yt[21]=Hj;Yt[86]=Yt[84]=Wj;Yt[89]=Yt[81]=Xj;Yt[96]=Yt[74]=Yj;Yt[24]=Yt[146]=$j;Yt[6]=Yt[164]=Zj;Yt[129]=Yt[41]=Jj;Yt[66]=Yt[104]=jj;Yt[144]=Yt[26]=Kj;Yt[36]=Yt[134]=Qj;Yt[9]=Yt[161]=tK;Yt[37]=Yt[133]=eK;Yt[148]=Yt[22]=nK;Yt[82]=Yt[88]=rK;Yt[73]=Yt[97]=iK;Yt[145]=Yt[25]=oK;Yt[70]=Yt[100]=sK;Yt[34]=function(n){return[Ix(n),Tx(n)]};Yt[35]=aK;Yt[136]=function(n){return[Cx(n),Ax(n)]};Yt[153]=function(n){return[Mx(n),Sx(n)]};Yt[102]=function(n){return[wx(n),bx(n)]};Yt[155]=uK;Yt[103]=lK;Yt[152]=function(n){return[Mx(n),Ax(n)]};Yt[156]=cK;Yt[137]=function(n){return[Cx(n),Sx(n)]};Yt[139]=fK;Yt[98]=function(n){return[Tx(n),bx(n)]};Yt[99]=hK;Yt[38]=function(n){return[wx(n),Ix(n)]};Yt[39]=pK;function gK(n){return(n>0)-(n<0)||+n}function Ql(n,t,e){var i=t[0]-n[0],s=t[1]-n[1],u=e[0]-t[0],c=e[1]-t[1];return gK(i*c-u*s)}function d2(n,t){var e=n.geometry.coordinates[0].map(function(c){return c[0]}),i=n.geometry.coordinates[0].map(function(c){return c[1]}),s=t.geometry.coordinates[0].map(function(c){return c[0]}),u=t.geometry.coordinates[0].map(function(c){return c[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,i)===Math.max.apply(null,u)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,i)===Math.min.apply(null,u)}function Px(n,t){return t.geometry.coordinates[0].every(function(e){return zr(Dn(e),n)})}function g2(n,t){return n[0]===t[0]&&n[1]===t[1]}var mK=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,i){var s=e.to,u=i.to;if(s.coordinates[0]-t.coordinates[0]>=0&&u.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&u.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&u.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||u.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-u.coordinates[1]:u.coordinates[1]-s.coordinates[1];var c=Ql(t.coordinates,s.coordinates,u.coordinates);if(c<0)return 1;if(c>0)return-1;var f=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),p=Math.pow(u.coordinates[0]-t.coordinates[0],2)+Math.pow(u.coordinates[1]-t.coordinates[1],2);return f-p}),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}(),Rx=mK;var yK=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 Br([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return Ql(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),m2=yK;var vK=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(c,f,p){return f.from.coordinates[1]>t.edges[c].from.coordinates[1]&&(c=p),c},0),i=(e===0?this.length:e)-1,s=(e+1)%this.length,u=Ql(this.edges[i].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return u===0?this.edges[i].from.coordinates[0]>this.edges[s].from.coordinates[0]:u>0},n.prototype.toMultiPoint=function(){return u_(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=Un([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=T_(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var i=t.getEnvelope(),s,u;return e.forEach(function(c){var f=c.getEnvelope();if(u&&(s=u.getEnvelope()),!d2(f,i)&&Px(f,i)){for(var p=t.map(function(M){return M.from.coordinates}),d=void 0,g=function(M){c.some(function(A){return g2(M,A.from.coordinates)})||(d=M)},y=0,v=p;y<v.length;y++){var E=v[y];g(E)}d&&c.inside(Dn(d))&&(!u||Px(s,f))&&(u=c)}}),u},n.prototype.inside=function(t){return zr(t,this.toPolygon())},n}(),Lx=vK;function _K(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 Kdt=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){_K(t);var e=new n;return Ji(t,function(i){c_(i,"LineString","Graph::fromGeoJson"),TP(i,function(s,u){if(s){var c=e.getNode(s),f=e.getNode(u);e.addEdge(c,f)}return u})}),e},n.prototype.getNode=function(t){var e=Rx.buildId(t),i=this.nodes[e];return i||(i=this.nodes[e]=new Rx(t)),i},n.prototype.addEdge=function(t,e){var i=new m2(t,e),s=i.getSymetric();this.edges.push(i),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 i=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),i.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(i){return e._computeNextCWEdges(e.nodes[i])}):t.getOuterEdges().forEach(function(i,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=i})},n.prototype._computeNextCCWEdges=function(t,e){for(var i=t.getOuterEdges(),s,u,c=i.length-1;c>=0;--c){var f=i[c],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(u=g),d&&(u&&(u.next=d,u=void 0),s||(s=d)))}u&&(u.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(i){if(!(i.label>=0)){t.push(i);var s=i;do s.label=e,s=s.next;while(!i.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(i){i.label=void 0}),this._findLabeledEdgeRings().forEach(function(i){t._findIntersectionNodes(i).forEach(function(s){t._computeNextCCWEdges(s,i.label)})});var e=[];return this.edges.forEach(function(i){i.ring||e.push(t._findEdgeRing(i))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],i=t,s=function(){var u=0;i.from.getOuterEdges().forEach(function(c){c.label===t.label&&++u}),u>1&&e.push(i.from),i=i.next};do s();while(!t.isEqual(i));return e},n.prototype._findEdgeRing=function(t){var e=t,i=new Lx;do i.push(e),e.ring=i,e=e.next;while(!t.isEqual(e));return i},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(i){return e.removeEdge(i)}),t.innerEdges.forEach(function(i){return e.removeEdge(i)}),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 wK=Jt(Nx(),1);var MK=Jt(Nx(),1);var AK=Jt(b2(),1);var NK=Jt(D2(),1);function U2(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function DK(){return new B2(function(n){return n.f})}var Ux={search:function(n,t,e,i){n.cleanDirty(),i=i||{};var s=i.heuristic||Ux.heuristics.manhattan,u=i.closest||!1,c=DK(),f=t;for(t.h=s(t,e),c.push(t);c.size()>0;){var p=c.pop();if(p===e)return U2(p);p.closed=!0;for(var d=n.neighbors(p),g=0,y=d.length;g<y;++g){var v=d[g];if(!(v.closed||v.isWall())){var E=p.g+v.getCost(p),M=v.visited;(!M||E<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||s(v,e),v.g=E,v.f=v.g+v.h,n.markDirty(v),u&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),M?c.rescoreElement(v):c.push(v))}}}return u?U2(f):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),i=Math.abs(t.y-n.y);return e+i},diagonal:function(n,t){var e=1,i=Math.sqrt(2),s=Math.abs(t.x-n.x),u=Math.abs(t.y-n.y);return e*(s+u)+(i-2*e)*Math.min(s,u)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function zf(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 i=0,s=n[e];i<s.length;i++){var u=new og(e,i,s[i]);this.grid[e][i]=u,this.nodes.push(u)}}this.init()}zf.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)Ux.cleanNode(this.nodes[n])};zf.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)Ux.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};zf.prototype.markDirty=function(n){this.dirtyNodes.push(n)};zf.prototype.neighbors=function(n){var t=[],e=n.x,i=n.y,s=this.grid;return s[e-1]&&s[e-1][i]&&t.push(s[e-1][i]),s[e+1]&&s[e+1][i]&&t.push(s[e+1][i]),s[e]&&s[e][i-1]&&t.push(s[e][i-1]),s[e]&&s[e][i+1]&&t.push(s[e][i+1]),this.diagonal&&(s[e-1]&&s[e-1][i-1]&&t.push(s[e-1][i-1]),s[e+1]&&s[e+1][i-1]&&t.push(s[e+1][i-1]),s[e-1]&&s[e-1][i+1]&&t.push(s[e-1][i+1]),s[e+1]&&s[e+1][i+1]&&t.push(s[e+1][i+1])),t};zf.prototype.toString=function(){for(var n=[],t=this.grid,e,i,s,u,c=0,f=t.length;c<f;c++){for(e=[],i=t[c],s=0,u=i.length;s<u;s++)e.push(i[s].weight);n.push(e.join(" "))}return n.join(`
3806
- `)};function og(n,t,e){this.x=n,this.y=t,this.weight=e}og.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};og.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};og.prototype.isWall=function(){return this.weight===0};function B2(n){this.content=[],this.scoreFunction=n}B2.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,i=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(i))this.content[e]=t,this.content[n]=i,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],i=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,c=null,f;if(u<t){var p=this.content[u];f=this.scoreFunction(p),f<i&&(c=u)}if(s<t){var d=this.content[s],g=this.scoreFunction(d);g<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function Bx(){this._=null}function ec(n){n.U=n.C=n.L=n.R=n.P=n.N=null}Bx.prototype={constructor:Bx,insert:function(n,t){var e,i,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=z2(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;)i=e.U,e===i.L?(s=i.R,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.R&&(Gf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,kf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(kf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Gf(this,i))),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,i=n.L,s=n.R,u,c;if(i?s?u=z2(s):u=i:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,i&&s?(c=u.C,u.C=n.C,u.L=i,i.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(c=n.C,n=u),n&&(n.U=t),!c){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,Gf(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,kf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Gf(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,kf(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,Gf(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,kf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Gf(n,t){var e=t,i=t.R,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.R=i.L,e.R&&(e.R.U=e),i.L=e}function kf(n,t){var e=t,i=t.L,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.L=i.R,e.L&&(e.L.U=e),i.R=e}function z2(n){for(;n.L;)n=n.L;return n}var zx=Bx;function nc(n,t,e,i){var s=[null,null],u=kr.push(s)-1;return s.left=n,s.right=t,e&&qf(s,n,t,e),i&&qf(s,t,n,i),Ti[n.index].halfedges.push(u),Ti[t.index].halfedges.push(u),s}function rc(n,t,e){var i=[t,e];return i.left=n,i}function qf(n,t,e,i){!n[0]&&!n[1]?(n[0]=i,n.left=t,n.right=e):n.left===e?n[1]=i:n[0]=i}function FK(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],g=c[1],y=0,v=1,E=d-f,M=g-p,A;if(A=t-f,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=i-f,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!M&&A>0)){if(A/=M,M<0){if(A<y)return;A<v&&(v=A)}else if(M>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!M&&A<0)){if(A/=M,M<0){if(A>v)return;A>y&&(y=A)}else if(M>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(n[0]=[f+y*E,p+y*M]),v<1&&(n[1]=[f+v*E,p+v*M])),!0}}}}}function UK(n,t,e,i,s){var u=n[1];if(u)return!0;var c=n[0],f=n.left,p=n.right,d=f[0],g=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(g+v)/2,A,_;if(v===g){if(E<t||E>=i)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-g),_=M-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(g<v){if(!c)c=[t,A*t+_];else if(c[0]>=i)return;u=[i,A*i+_]}else{if(!c)c=[i,A*i+_];else if(c[0]<t)return;u=[t,A*t+_]}return n[0]=c,n[1]=u,!0}function G2(n,t,e,i){for(var s=kr.length,u;s--;)(!UK(u=kr[s],n,t,e,i)||!FK(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Ln||Math.abs(u[0][1]-u[1][1])>Ln))&&delete kr[s]}function k2(n){return Ti[n.index]={site:n,halfedges:[]}}function BK(n,t){var e=n.site,i=t.left,s=t.right;return e===s&&(s=i,i=e),s?Math.atan2(s[1]-i[1],s[0]-i[0]):(e===i?(i=t[1],s=t[0]):(i=t[0],s=t[1]),Math.atan2(i[0]-s[0],s[1]-i[1]))}function Gx(n,t){return t[+(t.left!==n.site)]}function zK(n,t){return t[+(t.left===n.site)]}function q2(){for(var n=0,t=Ti.length,e,i,s,u;n<t;++n)if((e=Ti[n])&&(u=(i=e.halfedges).length)){var c=new Array(u),f=new Array(u);for(s=0;s<u;++s)c[s]=s,f[s]=BK(e,kr[i[s]]);for(c.sort(function(p,d){return f[d]-f[p]}),s=0;s<u;++s)f[s]=i[c[s]];for(s=0;s<u;++s)i[s]=f[s]}}function V2(n,t,e,i){var s=Ti.length,u,c,f,p,d,g,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Ti[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)kr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)M=zK(c,kr[d[p]]),A=M[0],_=M[1],y=Gx(c,kr[d[++p%g]]),v=y[0],E=y[1],(Math.abs(A-v)>Ln||Math.abs(_-E)>Ln)&&(d.splice(p,0,kr.push(rc(f,M,Math.abs(A-n)<Ln&&i-_>Ln?[n,Math.abs(v-n)<Ln?E:i]:Math.abs(_-i)<Ln&&e-A>Ln?[Math.abs(E-i)<Ln?v:e,i]:Math.abs(A-e)<Ln&&_-t>Ln?[e,Math.abs(v-e)<Ln?E:t]:Math.abs(_-t)<Ln&&A-n>Ln?[Math.abs(E-t)<Ln?v:n,t]:null))-1),++g);g&&(x=!1)}if(x){var T,w,R,B=1/0;for(u=0,x=null;u<s;++u)(c=Ti[u])&&(f=c.site,T=f[0]-n,w=f[1]-t,R=T*T+w*w,R<B&&(B=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(kr.push(rc(f=x.site,U,D))-1,kr.push(rc(f,D,P))-1,kr.push(rc(f,P,ct))-1,kr.push(rc(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Ti[u])&&(c.halfedges.length||delete Ti[u])}var H2=[],sg;function GK(){ec(this),this.x=this.y=this.arc=this.site=this.cy=null}function _u(n){var t=n.P,e=n.N;if(!(!t||!e)){var i=t.site,s=n.site,u=e.site;if(i!==u){var c=s[0],f=s[1],p=i[0]-c,d=i[1]-f,g=u[0]-c,y=u[1]-f,v=2*(p*y-d*g);if(!(v>=-W2)){var E=p*p+d*d,M=g*g+y*y,A=(y*E-d*M)/v,_=(p*M-g*E)/v,x=H2.pop()||new GK;x.arc=n,x.site=s,x.x=A+c,x.y=(x.cy=_+f)+Math.sqrt(A*A+_*_),n.circle=x;for(var T=null,w=ic._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}ic.insert(T,x),T||(sg=x)}}}}function xu(n){var t=n.circle;t&&(t.P||(sg=t.N),ic.remove(t),H2.push(t),ec(t),n.circle=null)}var Y2=[];function kK(){ec(this),this.edge=this.site=this.circle=null}function X2(n){var t=Y2.pop()||new kK;return t.site=n,t}function kx(n){xu(n),Eu.remove(n),Y2.push(n),ec(n)}function $2(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];kx(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Ln&&Math.abs(i-p.circle.cy)<Ln;)u=p.P,f.unshift(p),kx(p),p=u;f.unshift(p),xu(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Ln&&Math.abs(i-d.circle.cy)<Ln;)c=d.N,f.push(d),kx(d),d=c;f.push(d),xu(d);var g=f.length,y;for(y=1;y<g;++y)d=f[y],p=f[y-1],qf(d.edge,p.site,d.site,s);p=f[0],d=f[g-1],d.edge=nc(p.site,d.site,null,s),_u(p),_u(d)}function Z2(n){for(var t=n[0],e=n[1],i,s,u,c,f=Eu._;f;)if(u=J2(f,e)-t,u>Ln)f=f.L;else if(c=t-qK(f,e),c>Ln){if(!f.R){i=f;break}f=f.R}else{u>-Ln?(i=f.P,s=f):c>-Ln?(i=f,s=f.N):i=s=f;break}k2(n);var p=X2(n);if(Eu.insert(i,p),!(!i&&!s)){if(i===s){xu(i),s=X2(i.site),Eu.insert(p,s),p.edge=s.edge=nc(i.site,p.site),_u(i),_u(s);return}if(!s){p.edge=nc(i.site,p.site);return}xu(i),xu(s);var d=i.site,g=d[0],y=d[1],v=n[0]-g,E=n[1]-y,M=s.site,A=M[0]-g,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+g,(v*w-A*T)/x+y];qf(s.edge,d,M,R),p.edge=nc(d,n,null,R),s.edge=nc(n,M,null,R),_u(i),_u(s)}}function J2(n,t){var e=n.site,i=e[0],s=e[1],u=s-t;if(!u)return i;var c=n.P;if(!c)return-1/0;e=c.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-i,y=1/u-1/d,v=g/d;return y?(-v+Math.sqrt(v*v-2*y*(g*g/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function qK(n,t){var e=n.N;if(e)return J2(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Ln=1e-6,W2=1e-12,Eu,Ti,ic,kr;function VK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function HK(n,t){return t[1]-n[1]||t[0]-n[0]}function ag(n,t){var e=n.sort(HK).pop(),i,s,u;for(kr=[],Ti=new Array(n.length),Eu=new zx,ic=new zx;;)if(u=sg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(Z2(e),i=e[0],s=e[1]),e=n.pop();else if(u)$2(u.arc);else break;if(q2(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];G2(c,f,p,d),V2(c,f,p,d)}this.edges=kr,this.cells=Ti,Eu=ic=kr=Ti=null}ag.prototype={constructor:ag,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return Gx(t,n[i])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,i){if(f=(u=e.halfedges).length)for(var s=e.site,u,c=-1,f,p,d=t[u[f-1]],g=d.left===s?d.right:d.left;++c<f;)p=g,d=t[u[c]],g=d.left===s?d.right:d.left,p&&g&&i<p.index&&i<g.index&&VK(s,p,g)<0&&n.push([s.data,p.data,g.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 i=this,s,u=i._found||0,c=i.cells.length,f;!(f=i.cells[u]);)if(++u>=c)return null;var p=n-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=i.cells[s=u],u=null,f.halfedges.forEach(function(y){var v=i.edges[y],E=v.left;if(!((E===f.site||!E)&&!(E=v.right))){var M=n-E[0],A=t-E[1],_=M*M+A*A;_<g&&(g=_,u=E.index)}});while(u!==null);return i._found=s,e==null||g<=e*e?f.site:null}};var KK=Jt(oc(),1);var n1=Jt(tO(),1);function Di(){return new cg}function cg(){this.reset()}cg.prototype={constructor:cg,reset:function(){this.s=this.t=0},add:function(n){eO(lg,n,this.t),eO(this,lg.s,this.s),this.s?this.t+=lg.t:this.s=lg.t},valueOf:function(){return this.s}};var lg=new cg;function eO(n,t,e){var i=n.s=t+e,s=i-t,u=i-s;n.t=t-u+(e-s)}var yn=1e-6;var Tn=Math.PI,br=Tn/2,fg=Tn/4,os=Tn*2,Su=180/Tn,Fi=Tn/180,nr=Math.abs,Uo=Math.atan,Ui=Math.atan2,hn=Math.cos;var hg=Math.exp;var Vf=Math.log;var Me=Math.sin;var jr=Math.sqrt,Hf=Math.tan;function Hx(n){return n>1?0:n<-1?Tn:Math.acos(n)}function Ci(n){return n>1?br:n<-1?-br:Math.asin(n)}function Bo(){}var QK=Di(),X0t=Di();function wu(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function Wf(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 Xf(n){var t=jr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var nyt=Di();function rO(n,t){return[n>Tn?n-os:n<-Tn?n+os:n,t]}rO.invert=rO;function Wx(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Bo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Xx(n,t){return nr(n[0]-t[0])<yn&&nr(n[1]-t[1])<yn}function pg(n,t,e,i){this.x=n,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function Yx(n,t,e,i,s){var u=[],c=[],f,p;if(n.forEach(function(M){if(!((A=M.length-1)<=0)){var A,_=M[0],x=M[A],T;if(Xx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new pg(_,M,null,!0)),c.push(T.o=new pg(_,null,T,!1)),u.push(T=new pg(x,M,null,!1)),c.push(T.o=new pg(x,null,T,!0))}}),!!u.length){for(c.sort(t),iO(u),iO(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],g,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;g=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=g.length;f<p;++f)s.point((y=g[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(g=v.p.z,f=g.length-1;f>=0;--f)s.point((y=g[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,g=v.z,E=!E}while(!v.v);s.lineEnd()}}}function iO(n){if(t=n.length){for(var t,e=0,i=n[0],s;++e<t;)i.n=s=n[e],s.p=i,i=s;i.n=s=n[0],s.p=i}}function Aa(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function $x(n){return n.length===1&&(n=nQ(n)),{left:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)<0?i=u+1:s=u}return i},right:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)>0?s=u:i=u+1}return i}}}function nQ(n){return function(t,e){return Aa(n(t),e)}}var oO=$x(Aa),rQ=oO.right,iQ=oO.left;var sO=Array.prototype,sQ=sO.slice,aQ=sO.map;var $yt=Math.sqrt(50),Zyt=Math.sqrt(10),Jyt=Math.sqrt(2);function gg(n){for(var t=n.length,e,i=-1,s=0,u,c;++i<t;)s+=n[i].length;for(u=new Array(s);--t>=0;)for(c=n[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var gQ=1e9,N_t=-gQ;var Zx=Di();function Jx(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;Zx.reset();for(var f=0,p=n.length;f<p;++f)if(g=(d=n[f]).length)for(var d,g,y=d[g-1],v=y[0],E=y[1]/2+fg,M=Me(E),A=hn(E),_=0;_<g;++_,v=T,M=R,A=B,y=x){var x=d[_],T=x[0],w=x[1]/2+fg,R=Me(w),B=hn(w),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>Tn,L=M*R;if(Zx.add(Ui(L*D*Me(P),A*B+L*hn(P))),u+=ct?U+D*os:U,ct^v>=e^T>=e){var W=Wf(wu(y),wu(x));Xf(W);var V=Wf(s,W);Xf(V);var Mt=(ct^U>=0?-1:1)*Ci(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&Zx<-yn)^c&1}var V_t=Di();var uxt=Di(),lxt=Di();var vQ=1/0;var hxt=-vQ;function jx(n){this._context=n}jx.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,os);break}}},result:Bo};var Sxt=Di();function Kx(){this._string=[]}Kx.prototype={_radius:4.5,_circle:lO(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=lO(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 lO(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Qx(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Wx(),d=t(p),g=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=w,M.lineStart=R,M.lineEnd=B,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=gg(v);var U=Jx(y,f);v.length?(g||(u.polygonStart(),g=!0),Yx(v,EQ,U,e,u)):U&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(U,D){var P=s(U,D);n(U=P[0],D=P[1])&&u.point(U,D)}function _(U,D){var P=s(U,D);c.point(P[0],P[1])}function x(){M.point=_,c.lineStart()}function T(){M.point=A,c.lineEnd()}function w(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function B(){w(E[0][0],E[0][1]),d.lineEnd();var U=d.clean(),D=p.result(),P,ct=D.length,L,W,V;if(E.pop(),y.push(E),E=null,!!ct){if(U&1){if(W=D[0],(L=W.length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),P=0;P<L;++P)u.point((V=W[P])[0],V[1]);u.lineEnd()}return}ct>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(xQ))}}return M}}function xQ(n){return n.length>1}function EQ(n,t){return((n=n.x)[0]<0?n[1]-br-yn:br-n[1])-((t=t.x)[0]<0?t[1]-br-yn:br-t[1])}var SQ=Qx(function(){return!0},wQ,bQ,[-Tn,-br]);function wQ(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?Tn:-Tn,p=nr(u-t);nr(p-Tn)<yn?(n.point(t,e=(e+c)/2>0?br:-br),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=Tn&&(nr(t-i)<yn&&(t-=i*yn),nr(u-f)<yn&&(u-=f*yn),e=MQ(t,e,u,c),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=c),i=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function MQ(n,t,e,i){var s,u,c=Me(n-e);return nr(c)>yn?Uo((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function bQ(n,t,e,i){var s;if(n==null)s=e*br,i.point(-Tn,s),i.point(0,s),i.point(Tn,s),i.point(Tn,0),i.point(Tn,-s),i.point(0,-s),i.point(-Tn,-s),i.point(-Tn,0),i.point(-Tn,s);else if(nr(n[0]-t[0])>yn){var u=n[0]<t[0]?Tn:-Tn;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function mg(n){return function(t){var e=new t1;for(var i in n)e[i]=n[i];return e.stream=t,e}}function t1(){}t1.prototype={constructor:t1,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 l1t=hn(30*Fi);var w1t=mg({point:function(n,t){this.stream.point(n*Fi,t*Fi)}});function yg(n){return function(t,e){var i=hn(t),s=hn(e),u=n(i*s);return[u*s*Me(t),u*Me(e)]}}function ss(n){return function(t,e){var i=jr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Ui(t*u,i*c),Ci(i&&e*u/i)]}}var mO=yg(function(n){return jr(2/(1+n))});mO.invert=ss(function(n){return 2*Ci(n/2)});var yO=yg(function(n){return(n=Hx(n))&&n/Me(n)});yO.invert=ss(function(n){return n});function e1(n,t){return[n,Vf(Hf((br+t)/2))]}e1.invert=function(n,t){return[n,2*Uo(hg(t))-br]};function vg(n,t){return[n,t]}vg.invert=vg;function vO(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}vO.invert=ss(Uo);function _O(n,t){var e=t*t,i=e*e;return[n*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}_O.invert=function(n,t){var e=t,i=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(nr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function xO(n,t){return[hn(t)*Me(n),Me(t)]}xO.invert=ss(Ci);function EO(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}EO.invert=ss(function(n){return 2*Uo(n)});function SO(n,t){return[Vf(Hf((br+t)/2)),-n]}SO.invert=function(n,t){return[-t,2*Uo(hg(n))-br]};var RQ=Jt(oc(),1);var LQ=Jt(oc(),1);var OQ=Jt(oc(),1);var DQ=Jt(oc(),1);function Mu(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function MO(n,t,e){let i=new Ot(t[0]-n[0],t[1]-n[1]),s=new Ot(t[0]-e[0],t[1]-e[1]),c=i.angleTo(s)*180/Math.PI,f=new Ot(t[0]-n[0],t[1]-n[1]);return new Ot(e[0]-n[0],e[1]-n[1]).cross(f)>0?c:-c}function bO(n,t){let e=0,i=1/0,[s,u]=t;for(let c=0;c<n.length-1;c++){let[f,p]=n[c],[d,g]=n[c+1],y=Math.min(f,d)<=s&&s<=Math.max(f,d),v=Math.min(p,g)<=u&&u<=Math.max(p,g);if(y&&v){let E=Math.abs((d-f)*(u-p)-(g-p)*(s-f));E<i&&(i=E,e=c)}}return e}function AO(n,t){let e=n[0],i=n[1],s=!1;for(let u=0,c=t.length-1;u<t.length;c=u++){let f=t[u][0],p=t[u][1],d=t[c][0],g=t[c][1];p>i!=g>i&&e<(d-f)*(i-p)/(g-p)+f&&(s=!s)}return s}var zAt=Jt(KO(),1),GAt=Jt(a_(),1),kAt=Jt(Dc(),1);function cD(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function fD(n){let t={};for(let i in n)i.startsWith("on")&&(t[cD(i.slice(2))]=n[i],t[i]=n[i]);let e=i=>Ri(this,null,function*(){let{data:s}=i;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},c)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var ZAt=Jt(CD(),1),JAt=Jt(Yu(),1);function ID(n,t,e){e===void 0&&(e=0),n.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(u=>{Array.isArray(u)&&u.forEach(c=>{c[0]-=t[0],c[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(u=>u.map(c=>uc(c,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(u=>{u.coord=uc(u.coordinate,t)}),i.center&&(i.centerCoords=uc(i.center,t))}else i.geometry.coords=uc(i.geometry.cds,t),i.center&&(i.centerCoords=uc(i.center,t));if(i.center_x&&i.center_y){let[u,c]=uc([i.center_x,i.center_y],t);i.center_coord_x=u,i.center_coord_y=c}});for(let i=0;i<n.length;i++){let s=n[i];s.deltaHeight=1e-5*(e+i+1)}}function uc(n,t){return[n[0]-t[0],n[1]-t[1]]}var iTt=Jt(g0(),1),oTt=Jt(m0(),1),sTt=Jt(y0(),1),aTt=Jt(_0(),1),uTt=Jt(x0(),1),lTt=Jt(M0(),1),cTt=Jt(R0(),1),fTt=Jt(N0(),1),hTt=Jt(O0(),1),pTt=Jt(F0(),1),dTt=Jt(B0(),1),gTt=Jt(q0(),1),mTt=Jt(W0(),1),yTt=Jt(sy(),1),vTt=Jt(ay(),1),_Tt=Jt(Dc(),1),xTt=Jt(Yu(),1);function Eg(n,t=!1){let e=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),u={},c={},f=n[0].morphTargetsRelative,p=new ui,d=0;for(let g=0;g<n.length;++g){let y=n[g],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(f!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,g),d+=E}}if(e){let g=0,y=[];for(let v=0;v<n.length;++v){let E=n[v].index;for(let M=0;M<E.count;++M)y.push(E.getX(M)+g);g+=n[v].attributes.position.count}p.setIndex(y)}for(let g in u){let y=PD(u[g]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;p.setAttribute(g,y)}for(let g in c){let y=c[g][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[g]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[g].length;++A)E.push(c[g][A][v]);let M=PD(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;p.morphAttributes[g].push(M)}}return p}function PD(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let g=n[d];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=g.normalized),i!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=g.gpuType),s!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=g.count*e}let c=new t(u),f=new Zn(c,e,i),p=0;for(let d=0;d<n.length;++d){let g=n[d];if(g.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=g.count;v<E;v++)for(let M=0;M<e;M++){let A=g.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(g.array,p);p+=g.count*e}return s!==void 0&&(f.gpuType=s),f}function RD(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=n.filter(f=>f.geometry.type==="polygon");if(!i.length)return null;let s=i.map(f=>{var p;let d=f.geometry.coords,g=hd(d[0],d.slice(1)),y=new id(g,{steps:1,bevelEnabled:!1,depth:f.height,curveSegments:4});(p=f).deltaHeight||(p.deltaHeight=0),y.translate(0,0,f.airHeight+f.deltaHeight);let v=y.attributes.position.count,E=new Float32Array(v).fill(f.height+f.airHeight+f.deltaHeight);if(y.setAttribute("maxZ",new Zn(E,1)),y.setAttribute("opacity",new Zn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Zn(_,1))}let M=new Te(f.fillColor).convertLinearToSRGB(),A=new Float32Array(v*3);for(let _=0;_<v;_++)A[_*3]=M.r,A[_*3+1]=M.g,A[_*3+2]=M.b;return y.setAttribute("color",new Zn(A,3)),y}),u=Eg(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=Sg(i)||void 0),c}function h1(n){let t=n.filter(p=>p.geometry.type==="polygon");if(!t.length)return null;let e=[],i=[],s=[],u=[],c=[],f=[];return t.map((p,d)=>{var g;(g=p).deltaHeight||(g.deltaHeight=0);let y=p.geometry.coords,v=Mu(y[0][0],y[0][1]),E=Mu(y[0][1],y[0][2]),M=y[0][1][0]-y[0][0][0],A=y[0][1][1]-y[0][0][1],_=Math.atan2(A,M),x=du(Un(y)),T=x.geometry.coordinates[0],w=x.geometry.coordinates[1],R=new $n().compose(new st(T,w,p.deltaHeight+p.airHeight+p.height/2),new lo().setFromAxisAngle(new st(0,0,1),_),new st(v,E,p.height));e.push(...R.toArray()),i.push(...new Te(p.fillColor).convertLinearToSRGB().toArray());var B;s[d]=(B=p.fillOpacity)!=null?B:1;var U;u[d]=((U=p.deltaHeight)!=null?U:0)+p.airHeight+p.height,c[d]=p.id,f[d]=p.airHeight+p.deltaHeight}),{size:t.length,ids:c,matrixes:e,colors:i,opacities:s,maxZs:u,minZs:f}}function Sg(n){let{points:t,colors:e,opacities:i}=iet(n);if(!t.length)return null;let s=new ui().setFromPoints(t);return s.setAttribute("color",new Zn(new Float32Array(e),3)),s.setAttribute("opacity",new Zn(new Float32Array(i),1)),s}function iet(n){let t=[],e=[],i=[];return n.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:f,strokeOpacity:p}=s,d=new Te(f).convertLinearToSRGB();for(let g=0;g<c.length;g++){let y=c[g];for(let v=0;v<y.length;v++){let E=y[v],M=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(M[0],M[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),i.push(p),i.push(p)}}}),{points:t,colors:e,opacities:i}}function LD(n){if(n.length>1)return!1;let t=n[0];if(t.length!==5)return!1;let[e]=t,i=t[t.length-1];if(e[0]!==i[0]||e[1]!==i[1])return!1;let s=[Math.round(Mu(t[0],t[1])),Math.round(Mu(t[1],t[2])),Math.round(Mu(t[2],t[3])),Math.round(Mu(t[3],t[4]))];if(!(s[2]===s[0]&&s[3]===s[1]))return!1;let u=MO(t[0],t[1],t[2]);return Math.abs(Math.abs(u)-90)<1}var $f=function(n){return n.HALF="half",n.POWER="power",n.MECHANICAL="mechanical",n.NORMAL="normal",n.VIP="vip",n}({});var ND=new Ko,wg=new st,Mg=class extends ad{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new _r(t,3)),this.setAttribute("uv",new _r(e,2))}applyMatrix4(t){let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new _f(e,6,1);return this.setAttribute("instanceStart",new ts(i,3,0)),this.setAttribute("instanceEnd",new ts(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new _f(e,6,1);return this.setAttribute("instanceColorStart",new ts(i,3,0)),this.setAttribute("instanceColorEnd",new ts(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new sd(t.geometry)),this}fromLineSegments(t){let e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ko);let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ND.setFromBufferAttribute(e),this.boundingBox.union(ND))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)wg.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(wg)),wg.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(wg));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};var PTt=Jt(lD(),1);var bg=function(n){return n.LAYERED_RENDER_VERSION="layeredRender",n.MERGED_RENDER_VERSION="mergedRender",n}({});var p1=["range","ground","store","facility","parkingSpace"];function OD(n){return p1.indexOf(n.l_type)===-1?p1.length:p1.indexOf(n.l_type)}function oet(n){n.layers.sort((t,e)=>OD(t)-OD(e))}function set(n){let t=n.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];n.layers.map(i=>{if(i.l_type!=="range")return ID(i.elements,e)})}function DD(n){oet(n),set(n)}function Ag(n,t){return t===void 0&&(t=6),n.floor_id+"_"+n.version_id+(t?"_"+t:"")}var lc=[],cc=[];function UD(n,t){return Ri(this,null,function*(){return yield ip(),py(n,""+t)})}function FD(n,t,e){return Ri(this,null,function*(){let{db:i}=yield ip();return hC(n,""+t,e,i)})}function aet(n){return Ri(this,null,function*(){let t=yield fetch(n.map_url).then(e=>e.json());return t.floor=n.floor,DD(t),lc.push(t),t})}function uet(n,t){return Ri(this,null,function*(){let e=Ag(n,t===bg.LAYERED_RENDER_VERSION?1:void 0);try{let i=yield UD(Kc.MAP_DATA,e);return i&&(t===bg.LAYERED_RENDER_VERSION||i.transformed)?(console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i):(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E",e,i),cc.push(n),null)}catch(i){return console.log("[get floor data error]",i),cc.push(n),null}})}function cet(n,t){return t===void 0&&(t=!0),t&&(n.layers.forEach(e=>{switch(e.l_type){case"ground":break;case"store":d1(e.elements),e.mergedElements=Tg(e.elements);break;case"facility":d1(e.elements),e.mergedElements=Tg(e.elements);break;case"parkingSpace":console.time("parkingSpace merge"),e.mergedElements=fet(e.elements),console.timeEnd("parkingSpace merge"),e.mergedParkingTexture=det(e.elements);break;case"graph":d1(e.elements),e.mergedElements=Tg(e.elements);break;case"wall":e.mergedElements=Tg(e.elements,!1,!0);break;case"lane":e.mergedElements=het(e.elements);break;case"texture2d":case"texture3d":e.mergedMatrixes=BD(e.elements);break;case"glb":case"text":}}),n.transformed=!0),n}function Tg(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=[],s=[];n.forEach(p=>{p.geometry.type==="point"||p.doors.length?s.push(p):LD(p.geometry.cds)?i.push(p):s.push(p)});let u=h1(i),c=RD(s,!1,e),f=null;return t&&(f=Sg(n)),[Bu({},n[0],{mergedGeometry:(c==null?void 0:c.geometry.toJSON())||null,lineGeometry:(f==null?void 0:f.toJSON())||null,instancedGeometry:u})]}function fet(n){let t=h1(n),e=Sg(n);return Bu({},t,{lineGeometry:(e==null?void 0:e.toJSON())||null})}function BD(n){let t=n.reduce((i,s)=>{let{iconUrl:u}=s;return i.has(u)||i.set(u,[]),i.get(u).push(s),i},new Map);return Array.from(t.values()).map(i=>{let s=i.map(c=>new $n().compose(new st(c.centerCoords[0],c.centerCoords[1],c.deltaHeight+c.airHeight+c.height),new lo().setFromAxisAngle(new st(0,0,1),c.secondRotate),new st(c.secondWidth,c.secondHeight,1)).toArray());return Bu({},i[0],{mergedMatrixes:{size:s.length,array:s.flat()}})})}function het(n){let t=n.map(u=>{let c=hd(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new od(c,4),p=f.getAttribute("position"),d=[],g=new Te(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(g.r,g.g,g.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Zn(new Float32Array(d),4)),f}),e=Eg(t);t.forEach(u=>u.dispose());let i={mergedGeometry:e.toJSON()};e.dispose();let s=n.filter(u=>{var c,f;return u.double&&((f=u.geometry.otherCoords)==null||(c=f[1])==null?void 0:c.length)});return s.length&&[!0,!1].forEach(u=>{let c=s.filter(g=>g.double===!0&&g.dashed===u);if(!c.length)return;let f=[],p=[];c.forEach(g=>{let y=g.geometry.otherCoords[1],v=g.airHeight+(g.deltaHeight||0)+.01,E=new Te(g.secondColor);for(let M=0;M<y.length-1;M++){let A=y[M],_=y[M+1];f.push(A[0],A[1],v,_[0],_[1],v),p.push(E.r,E.g,E.b,E.r,E.g,E.b)}});let d=new Mg;d.setPositions(f),d.setColors(p),i[u?"dashedLineGeometry":"lineGeometry"]={positions:f,colors:p},d.dispose()}),i}var pet=new Set([$f.HALF,$f.MECHANICAL,$f.POWER,$f.VIP]);function det(n){let t=n.filter(e=>pet.has(e.parkingType)).map(e=>{let i=new Ot(...e.geometry.coords[0][0]),s=new Ot(...e.geometry.coords[0][1]),u=new Ot(...e.geometry.coords[0][2]),c=Math.min(i.distanceTo(s),s.distanceTo(u)),f=0;return c===i.distanceTo(s)?f=s.sub(i).angle()-Math.PI/2:f=u.sub(s).angle()-Math.PI/2,{uuid:e.id,iconUrl:e.parkingType,name:e.texts[0],deltaHeight:(e.deltaHeight||0)+.001,airHeight:e.airHeight,height:e.height,geometry:e.geometry,opacity:e.fillOpacity,visible:!0,secondWidth:c-1,secondHeight:c-1,secondRotate:f,centerCoords:[e.center_coord_x,e.center_coord_y]}});return BD(t)}function d1(n){n.map(t=>{var e;if((e=t.doors)!=null&&e.length&&t.geometry.type==="polygon"){let i=t.geometry.coords[0];t.doors.forEach(s=>{let u=s.type==="single"?.5:1,c=.5,f=bO(i,s.coord),p=new Ot(...s.coord),d=new Ot(...i[f]).sub(new Ot(...s.coord)).normalize(),g=new Ot().addVectors(p,d.clone().multiplyScalar(u)),y=new Ot().addVectors(p,d.clone().multiplyScalar(-u)),v=new Ot(-d.y,d.x),E=new Ot().addVectors(g,v.clone().multiplyScalar(c));AO([E.x,E.y],i)||(v.multiplyScalar(-1),E=new Ot().addVectors(g,v.clone().multiplyScalar(c)));let M=new Ot().addVectors(y,v.clone().multiplyScalar(c)),A=[[g.x,g.y],[E.x,E.y],[M.x,M.y],[y.x,y.y]];i=[...i.slice(0,f+1),...A,...i.slice(f+1)]}),t.geometry.coords[0]=i}})}var g1="";function zD(n){let t=cc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\u8C03\u6574\u697C\u5C42\u8BF7\u6C42\u7684\u4F18\u5148\u7EA7",n,t);let e=cc.splice(t,1)[0];cc.unshift(e)}else g1=n}var m1="";function GD(n){let t=lc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\u8C03\u6574\u697C\u5C42merge\u4F18\u5148\u7EA7",n,t);let e=lc.splice(t,1)[0];lc.unshift(e)}else m1=n}function get(n){zD(n),GD(n)}fD({onLoad(n){return Ri(this,null,function*(){let{floors:t,version:e}=n;for(yield ip(),yield Promise.all(t.map(i=>Ri(this,null,function*(){return uet(i,e)}))),g1&&zD(g1),yield Promise.all(cc.map(i=>Ri(this,null,function*(){let s=yield aet(i);if(s&&e===bg.LAYERED_RENDER_VERSION){let u=Ag(t.find(c=>c.floor===s.floor),1);yield FD(Kc.MAP_DATA,u,s),console.log(s.floor+" \u5199\u5165\u7F13\u5B58\u6210\u529F\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:s.floor}})}}))),m1&&GD(m1);lc.length>0;){let i=lc.shift(),s=cet(i),u=Ag(t.find(f=>f.floor===i.floor));yield FD(Kc.MAP_DATA,u,s),console.log(i.floor+" \u5199\u5165\u7F13\u5B58\u6210\u529F\uFF0Ckey="+u);let c=performance.now();yield UD(Kc.MAP_DATA,u),console.log(i.floor+" \u7F13\u5B58\u7F13\u5B58\u8BFB\u53D6\uFF0Ckey="+u,performance.now()-c),self.postMessage({type:"floor_success",data:{floor:i.floor}})}pC(),console.log("\u6240\u6709\u6570\u636E\u5904\u7406\u5B8C\u6210")})},onAdjustFloorPriority(n){let{floor:t}=n;get(t)}});
3805
+ }`,Sv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(this.texture===null){let s=new uo,u=t.properties.get(s);u.__webglTexture=e.texture,(e.depthNear!=i.depthNear||e.depthFar!=i.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let i=e.cameras[0].viewport,s=new ts({extensions:{fragDepth:!0},vertexShader:U7,fragmentShader:B7,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new No(new jp(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},wv=class extends _a{constructor(t,e){super();let i=this,s=null,u=1,c=null,f="local-floor",p=1,d=null,g=null,y=null,v=null,E=null,M=null,A=new Sv,_=e.getContextAttributes(),x=null,T=null,w=[],R=[],B=new Ot,U=null,D=new Zi;D.layers.enable(1),D.viewport=new Yr;let P=new Zi;P.layers.enable(2),P.viewport=new Yr;let ct=[D,P],L=new Ev;L.layers.enable(1),L.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(nt){let bt=w[nt];return bt===void 0&&(bt=new uf,w[nt]=bt),bt.getTargetRaySpace()},this.getControllerGrip=function(nt){let bt=w[nt];return bt===void 0&&(bt=new uf,w[nt]=bt),bt.getGripSpace()},this.getHand=function(nt){let bt=w[nt];return bt===void 0&&(bt=new uf,w[nt]=bt),bt.getHandSpace()};function Mt(nt){let bt=R.indexOf(nt.inputSource);if(bt===-1)return;let Vt=w[bt];Vt!==void 0&&(Vt.update(nt.inputSource,nt.frame,d||c),Vt.dispatchEvent({type:nt.type,data:nt.inputSource}))}function $(){s.removeEventListener("select",Mt),s.removeEventListener("selectstart",Mt),s.removeEventListener("selectend",Mt),s.removeEventListener("squeeze",Mt),s.removeEventListener("squeezestart",Mt),s.removeEventListener("squeezeend",Mt),s.removeEventListener("end",$),s.removeEventListener("inputsourceschange",gt);for(let nt=0;nt<w.length;nt++){let bt=R[nt];bt!==null&&(R[nt]=null,w[nt].disconnect(bt))}W=null,V=null,A.reset(),t.setRenderTarget(x),E=null,v=null,y=null,s=null,T=null,Kt.stop(),i.isPresenting=!1,t.setPixelRatio(U),t.setSize(B.width,B.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(nt){u=nt,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(nt){f=nt,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||c},this.setReferenceSpace=function(nt){d=nt},this.getBaseLayer=function(){return v!==null?v:E},this.getBinding=function(){return y},this.getFrame=function(){return M},this.getSession=function(){return s},this.setSession=function(nt){return Ri(this,null,function*(){if(s=nt,s!==null){if(x=t.getRenderTarget(),s.addEventListener("select",Mt),s.addEventListener("selectstart",Mt),s.addEventListener("selectend",Mt),s.addEventListener("squeeze",Mt),s.addEventListener("squeezestart",Mt),s.addEventListener("squeezeend",Mt),s.addEventListener("end",$),s.addEventListener("inputsourceschange",gt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),U=t.getPixelRatio(),t.getSize(B),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let bt={antialias:s.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:u};E=new XRWebGLLayer(s,e,bt),s.updateRenderState({baseLayer:E}),t.setPixelRatio(1),t.setSize(E.framebufferWidth,E.framebufferHeight,!1),T=new Us(E.framebufferWidth,E.framebufferHeight,{format:Lo,type:ma,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let bt=null,Vt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,bt=_.stencil?Pl:au,Vt=_.stencil?su:pa);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:u};y=new XRWebGLBinding(s,e),v=y.createProjectionLayer(Ut),s.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),T=new Us(v.textureWidth,v.textureHeight,{format:Lo,type:ma,depthTexture:new Qp(v.textureWidth,v.textureHeight,Vt,void 0,void 0,void 0,void 0,void 0,void 0,bt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Gt=t.properties.get(T);Gt.__ignoreDepthValues=v.ignoreDepthValues}T.isXRRenderTarget=!0,this.setFoveation(p),d=null,c=yield s.requestReferenceSpace(f),Kt.setContext(s),Kt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function gt(nt){for(let bt=0;bt<nt.removed.length;bt++){let Vt=nt.removed[bt],$t=R.indexOf(Vt);$t>=0&&(R[$t]=null,w[$t].disconnect(Vt))}for(let bt=0;bt<nt.added.length;bt++){let Vt=nt.added[bt],$t=R.indexOf(Vt);if($t===-1){for(let Gt=0;Gt<w.length;Gt++)if(Gt>=R.length){R.push(Vt),$t=Gt;break}else if(R[Gt]===null){R[Gt]=Vt,$t=Gt;break}if($t===-1)break}let Ut=w[$t];Ut&&Ut.connect(Vt)}}let ft=new st,vt=new st;function it(nt,bt,Vt){ft.setFromMatrixPosition(bt.matrixWorld),vt.setFromMatrixPosition(Vt.matrixWorld);let $t=ft.distanceTo(vt),Ut=bt.projectionMatrix.elements,Gt=Vt.projectionMatrix.elements,Ct=Ut[14]/(Ut[10]-1),ee=Ut[14]/(Ut[10]+1),Z=(Ut[9]+1)/Ut[5],Dt=(Ut[9]-1)/Ut[5],_t=(Ut[8]-1)/Ut[0],Nt=(Gt[8]+1)/Gt[0],wt=Ct*_t,Ht=Ct*Nt,Xt=$t/(-_t+Nt),Pt=Xt*-_t;bt.matrixWorld.decompose(nt.position,nt.quaternion,nt.scale),nt.translateX(Pt),nt.translateZ(Xt),nt.matrixWorld.compose(nt.position,nt.quaternion,nt.scale),nt.matrixWorldInverse.copy(nt.matrixWorld).invert();let ne=Ct+Xt,Y=ee+Xt,N=wt-Pt,xt=Ht+($t-Pt),St=Z*ee/Y*ne,ot=Dt*ee/Y*ne;nt.projectionMatrix.makePerspective(N,xt,St,ot,ne,Y),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert()}function lt(nt,bt){bt===null?nt.matrixWorld.copy(nt.matrix):nt.matrixWorld.multiplyMatrices(bt.matrixWorld,nt.matrix),nt.matrixWorldInverse.copy(nt.matrixWorld).invert()}this.updateCamera=function(nt){if(s===null)return;A.texture!==null&&(nt.near=A.depthNear,nt.far=A.depthFar),L.near=P.near=D.near=nt.near,L.far=P.far=D.far=nt.far,(W!==L.near||V!==L.far)&&(s.updateRenderState({depthNear:L.near,depthFar:L.far}),W=L.near,V=L.far,D.near=W,D.far=V,P.near=W,P.far=V,D.updateProjectionMatrix(),P.updateProjectionMatrix(),nt.updateProjectionMatrix());let bt=nt.parent,Vt=L.cameras;lt(L,bt);for(let $t=0;$t<Vt.length;$t++)lt(Vt[$t],bt);Vt.length===2?it(L,D,P):L.projectionMatrix.copy(D.projectionMatrix),H(nt,L,bt)};function H(nt,bt,Vt){Vt===null?nt.matrix.copy(bt.matrixWorld):(nt.matrix.copy(Vt.matrixWorld),nt.matrix.invert(),nt.matrix.multiply(bt.matrixWorld)),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.updateMatrixWorld(!0),nt.projectionMatrix.copy(bt.projectionMatrix),nt.projectionMatrixInverse.copy(bt.projectionMatrixInverse),nt.isPerspectiveCamera&&(nt.fov=ov*2*Math.atan(1/nt.projectionMatrix.elements[5]),nt.zoom=1)}this.getCamera=function(){return L},this.getFoveation=function(){if(!(v===null&&E===null))return p},this.setFoveation=function(nt){p=nt,v!==null&&(v.fixedFoveation=nt),E!==null&&E.fixedFoveation!==void 0&&(E.fixedFoveation=nt)},this.hasDepthSensing=function(){return A.texture!==null};let At=null;function It(nt,bt){if(g=bt.getViewerPose(d||c),M=bt,g!==null){let Vt=g.views;E!==null&&(t.setRenderTargetFramebuffer(T,E.framebuffer),t.setRenderTarget(T));let $t=!1;Vt.length!==L.cameras.length&&(L.cameras.length=0,$t=!0);for(let Gt=0;Gt<Vt.length;Gt++){let Ct=Vt[Gt],ee=null;if(E!==null)ee=E.getViewport(Ct);else{let Dt=y.getViewSubImage(v,Ct);ee=Dt.viewport,Gt===0&&(t.setRenderTargetTextures(T,Dt.colorTexture,v.ignoreDepthValues?void 0:Dt.depthStencilTexture),t.setRenderTarget(T))}let Z=ct[Gt];Z===void 0&&(Z=new Zi,Z.layers.enable(Gt),Z.viewport=new Yr,ct[Gt]=Z),Z.matrix.fromArray(Ct.transform.matrix),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.projectionMatrix.fromArray(Ct.projectionMatrix),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert(),Z.viewport.set(ee.x,ee.y,ee.width,ee.height),Gt===0&&(L.matrix.copy(Z.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),$t===!0&&L.cameras.push(Z)}let Ut=s.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Gt=y.getDepthInformation(Vt[0]);Gt&&Gt.isValid&&Gt.texture&&A.init(t,Gt,s.renderState)}}for(let Vt=0;Vt<w.length;Vt++){let $t=R[Vt],Ut=w[Vt];$t!==null&&Ut!==void 0&&Ut.update($t,bt,d||c)}A.render(t,L),At&&At(nt,bt),bt.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:bt}),M=null}let Kt=new oP;Kt.setAnimationLoop(It),this.setAnimationLoop=function(nt){At=nt},this.dispose=function(){}}},Qa=new lu,z7=new $n;function G7(n,t){function e(_,x){_.matrixAutoUpdate===!0&&_.updateMatrix(),x.value.copy(_.matrix)}function i(_,x){x.color.getRGB(_.fogColor.value,iP(n)),x.isFog?(_.fogNear.value=x.near,_.fogFar.value=x.far):x.isFogExp2&&(_.fogDensity.value=x.density)}function s(_,x,T,w,R){x.isMeshBasicMaterial||x.isMeshLambertMaterial?u(_,x):x.isMeshToonMaterial?(u(_,x),y(_,x)):x.isMeshPhongMaterial?(u(_,x),g(_,x)):x.isMeshStandardMaterial?(u(_,x),v(_,x),x.isMeshPhysicalMaterial&&E(_,x,R)):x.isMeshMatcapMaterial?(u(_,x),M(_,x)):x.isMeshDepthMaterial?u(_,x):x.isMeshDistanceMaterial?(u(_,x),A(_,x)):x.isMeshNormalMaterial?u(_,x):x.isLineBasicMaterial?(c(_,x),x.isLineDashedMaterial&&f(_,x)):x.isPointsMaterial?p(_,x,T,w):x.isSpriteMaterial?d(_,x):x.isShadowMaterial?(_.color.value.copy(x.color),_.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function u(_,x){_.opacity.value=x.opacity,x.color&&_.diffuse.value.copy(x.color),x.emissive&&_.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(_.map.value=x.map,e(x.map,_.mapTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.bumpMap&&(_.bumpMap.value=x.bumpMap,e(x.bumpMap,_.bumpMapTransform),_.bumpScale.value=x.bumpScale,x.side===Oi&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,e(x.normalMap,_.normalMapTransform),_.normalScale.value.copy(x.normalScale),x.side===Oi&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,e(x.displacementMap,_.displacementMapTransform),_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap,e(x.emissiveMap,_.emissiveMapTransform)),x.specularMap&&(_.specularMap.value=x.specularMap,e(x.specularMap,_.specularMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest);let T=t.get(x),w=T.envMap,R=T.envMapRotation;if(w&&(_.envMap.value=w,Qa.copy(R),Qa.x*=-1,Qa.y*=-1,Qa.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Qa.y*=-1,Qa.z*=-1),_.envMapRotation.value.setFromMatrix4(z7.makeRotationFromEuler(Qa)),_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=x.reflectivity,_.ior.value=x.ior,_.refractionRatio.value=x.refractionRatio),x.lightMap){_.lightMap.value=x.lightMap;let B=n._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=x.lightMapIntensity*B,e(x.lightMap,_.lightMapTransform)}x.aoMap&&(_.aoMap.value=x.aoMap,_.aoMapIntensity.value=x.aoMapIntensity,e(x.aoMap,_.aoMapTransform))}function c(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,x.map&&(_.map.value=x.map,e(x.map,_.mapTransform))}function f(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}function p(_,x,T,w){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*T,_.scale.value=w*.5,x.map&&(_.map.value=x.map,e(x.map,_.uvTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest)}function d(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map,e(x.map,_.mapTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest)}function g(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4)}function y(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap)}function v(_,x){_.metalness.value=x.metalness,x.metalnessMap&&(_.metalnessMap.value=x.metalnessMap,e(x.metalnessMap,_.metalnessMapTransform)),_.roughness.value=x.roughness,x.roughnessMap&&(_.roughnessMap.value=x.roughnessMap,e(x.roughnessMap,_.roughnessMapTransform)),t.get(x).envMap&&(_.envMapIntensity.value=x.envMapIntensity)}function E(_,x,T){_.ior.value=x.ior,x.sheen>0&&(_.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),_.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(_.sheenColorMap.value=x.sheenColorMap,e(x.sheenColorMap,_.sheenColorMapTransform)),x.sheenRoughnessMap&&(_.sheenRoughnessMap.value=x.sheenRoughnessMap,e(x.sheenRoughnessMap,_.sheenRoughnessMapTransform))),x.clearcoat>0&&(_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap,e(x.clearcoatMap,_.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,e(x.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(_.clearcoatNormalMap.value=x.clearcoatNormalMap,e(x.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===Oi&&_.clearcoatNormalScale.value.negate())),x.iridescence>0&&(_.iridescence.value=x.iridescence,_.iridescenceIOR.value=x.iridescenceIOR,_.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(_.iridescenceMap.value=x.iridescenceMap,e(x.iridescenceMap,_.iridescenceMapTransform)),x.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=x.iridescenceThicknessMap,e(x.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),x.transmission>0&&(_.transmission.value=x.transmission,_.transmissionSamplerMap.value=T.texture,_.transmissionSamplerSize.value.set(T.width,T.height),x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap,e(x.transmissionMap,_.transmissionMapTransform)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap,e(x.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(_.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(_.anisotropyMap.value=x.anisotropyMap,e(x.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=x.specularIntensity,_.specularColor.value.copy(x.specularColor),x.specularColorMap&&(_.specularColorMap.value=x.specularColorMap,e(x.specularColorMap,_.specularColorMapTransform)),x.specularIntensityMap&&(_.specularIntensityMap.value=x.specularIntensityMap,e(x.specularIntensityMap,_.specularIntensityMapTransform))}function M(_,x){x.matcap&&(_.matcap.value=x.matcap)}function A(_,x){let T=t.get(x).light;_.referencePosition.value.setFromMatrixPosition(T.matrixWorld),_.nearDistance.value=T.shadow.camera.near,_.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function k7(n,t,e,i){let s={},u={},c=[],f=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(T,w){let R=w.program;i.uniformBlockBinding(T,R)}function d(T,w){let R=s[T.id];R===void 0&&(M(T),R=g(T),s[T.id]=R,T.addEventListener("dispose",_));let B=w.program;i.updateUBOMapping(T,B);let U=t.render.frame;u[T.id]!==U&&(v(T),u[T.id]=U)}function g(T){let w=y();T.__bindingPointIndex=w;let R=n.createBuffer(),B=T.__size,U=T.usage;return n.bindBuffer(n.UNIFORM_BUFFER,R),n.bufferData(n.UNIFORM_BUFFER,B,U),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,R),R}function y(){for(let T=0;T<f;T++)if(c.indexOf(T)===-1)return c.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(T){let w=s[T.id],R=T.uniforms,B=T.__cache;n.bindBuffer(n.UNIFORM_BUFFER,w);for(let U=0,D=R.length;U<D;U++){let P=Array.isArray(R[U])?R[U]:[R[U]];for(let ct=0,L=P.length;ct<L;ct++){let W=P[ct];if(E(W,U,ct,B)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],$=0;for(let gt=0;gt<Mt.length;gt++){let ft=Mt[gt],vt=A(ft);typeof ft=="number"||typeof ft=="boolean"?(W.__data[0]=ft,n.bufferSubData(n.UNIFORM_BUFFER,V+$,W.__data)):ft.isMatrix3?(W.__data[0]=ft.elements[0],W.__data[1]=ft.elements[1],W.__data[2]=ft.elements[2],W.__data[3]=0,W.__data[4]=ft.elements[3],W.__data[5]=ft.elements[4],W.__data[6]=ft.elements[5],W.__data[7]=0,W.__data[8]=ft.elements[6],W.__data[9]=ft.elements[7],W.__data[10]=ft.elements[8],W.__data[11]=0):(ft.toArray(W.__data,$),$+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,V,W.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function E(T,w,R,B){let U=T.value,D=w+"_"+R;if(B[D]===void 0)return typeof U=="number"||typeof U=="boolean"?B[D]=U:B[D]=U.clone(),!0;{let P=B[D];if(typeof U=="number"||typeof U=="boolean"){if(P!==U)return B[D]=U,!0}else if(P.equals(U)===!1)return P.copy(U),!0}return!1}function M(T){let w=T.uniforms,R=0,B=16;for(let D=0,P=w.length;D<P;D++){let ct=Array.isArray(w[D])?w[D]:[w[D]];for(let L=0,W=ct.length;L<W;L++){let V=ct[L],Mt=Array.isArray(V.value)?V.value:[V.value];for(let $=0,gt=Mt.length;$<gt;$++){let ft=Mt[$],vt=A(ft),it=R%B;it!==0&&B-it<vt.boundary&&(R+=B-it),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=R,R+=vt.storage}}}let U=R%B;return U>0&&(R+=B-U),T.__size=R,T.__cache={},this}function A(T){let w={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(w.boundary=4,w.storage=4):T.isVector2?(w.boundary=8,w.storage=8):T.isVector3||T.isColor?(w.boundary=16,w.storage=12):T.isVector4?(w.boundary=16,w.storage=16):T.isMatrix3?(w.boundary=48,w.storage=48):T.isMatrix4?(w.boundary=64,w.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),w}function _(T){let w=T.target;w.removeEventListener("dispose",_);let R=c.indexOf(w.__bindingPointIndex);c.splice(R,1),n.deleteBuffer(s[w.id]),delete s[w.id],delete u[w.id]}function x(){for(let T in s)n.deleteBuffer(s[T]);c=[],s={},u={}}return{bind:p,update:d,dispose:x}}var Mv=class{constructor(t={}){let{canvas:e=W6(),context:i=null,depth:s=!0,stencil:u=!0,alpha:c=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:y=!1}=t;this.isWebGLRenderer=!0;let v;i!==null?v=i.getContextAttributes().alpha:v=c;let E=new Uint32Array(4),M=new Int32Array(4),A=null,_=null,x=[],T=[];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=Jo,this._useLegacyLights=!1,this.toneMapping=ga,this.toneMappingExposure=1;let w=this,R=!1,B=0,U=0,D=null,P=-1,ct=null,L=new Yr,W=new Yr,V=null,Mt=new Te(0),$=0,gt=e.width,ft=e.height,vt=1,it=null,lt=null,H=new Yr(0,0,gt,ft),At=new Yr(0,0,gt,ft),It=!1,Kt=new Jp,nt=!1,bt=!1,Vt=null,$t=new $n,Ut=new Ot,Gt=new st,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ee(){return D===null?vt:1}let Z=i;function Dt(q,at){for(let Et=0;Et<q.length;Et++){let dt=q[Et],ut=e.getContext(dt,at);if(ut!==null)return ut}return null}try{let q={alpha:!0,depth:s,stencil:u,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:y};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Yv}`),e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",Q,!1),Z===null){let at=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&at.shift(),Z=Dt(at,q),Z===null)throw Dt(at)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&Z instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),Z.getShaderPrecisionFormat===void 0&&(Z.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let _t,Nt,wt,Ht,Xt,Pt,ne,Y,N,xt,St,ot,Lt,ce,Rt,Bt,Wt,j,b,I,F,k,G,rt;function tt(){_t=new r9(Z),Nt=new jX(Z,_t,t),_t.init(Nt),k=new D7(Z,_t,Nt),wt=new N7(Z,_t,Nt),Ht=new s9(Z),Xt=new E7,Pt=new O7(Z,_t,wt,Xt,Nt,k,Ht),ne=new QX(w),Y=new n9(w),N=new h8(Z,Nt),G=new ZX(Z,_t,N,Nt),xt=new i9(Z,N,Ht,G),St=new c9(Z,xt,N,Ht),b=new l9(Z,Nt,Pt),Bt=new KX(Xt),ot=new x7(w,ne,Y,_t,Nt,G,Bt),Lt=new G7(w,Xt),ce=new w7,Rt=new I7(_t,Nt),j=new $X(w,ne,Y,wt,St,v,p),Wt=new L7(w,St,Nt),rt=new k7(Z,Ht,Nt,wt),I=new JX(Z,_t,Ht,Nt),F=new o9(Z,_t,Ht,Nt),Ht.programs=ot.programs,w.capabilities=Nt,w.extensions=_t,w.properties=Xt,w.renderLists=ce,w.shadowMap=Wt,w.state=wt,w.info=Ht}tt();let pt=new wv(w,Z);this.xr=pt,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){let q=_t.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=_t.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(q){q!==void 0&&(vt=q,this.setSize(gt,ft,!1))},this.getSize=function(q){return q.set(gt,ft)},this.setSize=function(q,at,Et=!0){if(pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}gt=q,ft=at,e.width=Math.floor(q*vt),e.height=Math.floor(at*vt),Et===!0&&(e.style.width=q+"px",e.style.height=at+"px"),this.setViewport(0,0,q,at)},this.getDrawingBufferSize=function(q){return q.set(gt*vt,ft*vt).floor()},this.setDrawingBufferSize=function(q,at,Et){gt=q,ft=at,vt=Et,e.width=Math.floor(q*Et),e.height=Math.floor(at*Et),this.setViewport(0,0,q,at)},this.getCurrentViewport=function(q){return q.copy(L)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,at,Et,dt){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,at,Et,dt),wt.viewport(L.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(At)},this.setScissor=function(q,at,Et,dt){q.isVector4?At.set(q.x,q.y,q.z,q.w):At.set(q,at,Et,dt),wt.scissor(W.copy(At).multiplyScalar(vt).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(q){wt.setScissorTest(It=q)},this.setOpaqueSort=function(q){it=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,at=!0,Et=!0){let dt=0;if(q){let ut=!1;if(D!==null){let Qt=D.texture.format;ut=Qt===KI||Qt===jI||Qt===JI}if(ut){let Qt=D.texture.type,te=Qt===ma||Qt===pa||Qt===$v||Qt===su||Qt===$I||Qt===ZI,le=j.getClearColor(),re=j.getClearAlpha(),ve=le.r,fe=le.g,he=le.b;te?(E[0]=ve,E[1]=fe,E[2]=he,E[3]=re,Z.clearBufferuiv(Z.COLOR,0,E)):(M[0]=ve,M[1]=fe,M[2]=he,M[3]=re,Z.clearBufferiv(Z.COLOR,0,M))}else dt|=Z.COLOR_BUFFER_BIT}at&&(dt|=Z.DEPTH_BUFFER_BIT),Et&&(dt|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(dt)},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",ht,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",Q,!1),ce.dispose(),Rt.dispose(),Xt.dispose(),ne.dispose(),Y.dispose(),St.dispose(),G.dispose(),rt.dispose(),ot.dispose(),Wt.dispose(),pt.dispose(),pt.removeEventListener("sessionstart",we),pt.removeEventListener("sessionend",ye),Vt&&(Vt.dispose(),Vt=null),be.stop()};function ht(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),R=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),R=!1;let q=Ht.autoReset,at=Wt.enabled,Et=Wt.autoUpdate,dt=Wt.needsUpdate,ut=Wt.type;tt(),Ht.autoReset=q,Wt.enabled=at,Wt.autoUpdate=Et,Wt.needsUpdate=dt,Wt.type=ut}function Q(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function J(q){let at=q.target;at.removeEventListener("dispose",J),et(at)}function et(q){Tt(q),Xt.remove(q)}function Tt(q){let at=Xt.get(q).programs;at!==void 0&&(at.forEach(function(Et){ot.releaseProgram(Et)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,at,Et,dt,ut,Qt){at===null&&(at=Ct);let te=ut.isMesh&&ut.matrixWorld.determinant()<0,le=En(q,at,Et,dt,ut);wt.setMaterial(dt,te);let re=Et.index,ve=1;if(dt.wireframe===!0){if(re=xt.getWireframeAttribute(Et),re===void 0)return;ve=2}let fe=Et.drawRange,he=Et.attributes.position,cn=fe.start*ve,Tr=(fe.start+fe.count)*ve;Qt!==null&&(cn=Math.max(cn,Qt.start*ve),Tr=Math.min(Tr,(Qt.start+Qt.count)*ve)),re!==null?(cn=Math.max(cn,0),Tr=Math.min(Tr,re.count)):he!=null&&(cn=Math.max(cn,0),Tr=Math.min(Tr,he.count));let qn=Tr-cn;if(qn<0||qn===1/0)return;G.setup(ut,dt,le,Et,re);let hi,wn=I;if(re!==null&&(hi=N.get(re),wn=F,wn.setIndex(hi)),ut.isMesh)dt.wireframe===!0?(wt.setLineWidth(dt.wireframeLinewidth*ee()),wn.setMode(Z.LINES)):wn.setMode(Z.TRIANGLES);else if(ut.isLine){let se=dt.linewidth;se===void 0&&(se=1),wt.setLineWidth(se*ee()),ut.isLineSegments?wn.setMode(Z.LINES):ut.isLineLoop?wn.setMode(Z.LINE_LOOP):wn.setMode(Z.LINE_STRIP)}else ut.isPoints?wn.setMode(Z.POINTS):ut.isSprite&&wn.setMode(Z.TRIANGLES);if(ut.isBatchedMesh)wn.renderMultiDraw(ut._multiDrawStarts,ut._multiDrawCounts,ut._multiDrawCount);else if(ut.isInstancedMesh)wn.renderInstances(cn,qn,ut.count);else if(Et.isInstancedBufferGeometry){let se=Et._maxInstanceCount!==void 0?Et._maxInstanceCount:1/0,bu=Math.min(Et.instanceCount,se);wn.renderInstances(cn,qn,bu)}else wn.render(cn,qn)};function kt(q,at,Et){q.transparent===!0&&q.side===Ns&&q.forceSinglePass===!1?(q.side=Oi,q.needsUpdate=!0,xn(q,at,Et),q.side=va,q.needsUpdate=!0,xn(q,at,Et),q.side=Ns):xn(q,at,Et)}this.compile=function(q,at,Et=null){Et===null&&(Et=q),_=Rt.get(Et),_.init(),T.push(_),Et.traverseVisible(function(ut){ut.isLight&&ut.layers.test(at.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),q!==Et&&q.traverseVisible(function(ut){ut.isLight&&ut.layers.test(at.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),_.setupLights(w._useLegacyLights);let dt=new Set;return q.traverse(function(ut){let Qt=ut.material;if(Qt)if(Array.isArray(Qt))for(let te=0;te<Qt.length;te++){let le=Qt[te];kt(le,Et,ut),dt.add(le)}else kt(Qt,Et,ut),dt.add(Qt)}),T.pop(),_=null,dt},this.compileAsync=function(q,at,Et=null){let dt=this.compile(q,at,Et);return new Promise(ut=>{function Qt(){if(dt.forEach(function(te){Xt.get(te).currentProgram.isReady()&&dt.delete(te)}),dt.size===0){ut(q);return}setTimeout(Qt,10)}_t.get("KHR_parallel_shader_compile")!==null?Qt():setTimeout(Qt,10)})};let ie=null;function oe(q){ie&&ie(q)}function we(){be.stop()}function ye(){be.start()}let be=new oP;be.setAnimationLoop(oe),typeof self!="undefined"&&be.setContext(self),this.setAnimationLoop=function(q){ie=q,pt.setAnimationLoop(q),q===null?be.stop():be.start()},pt.addEventListener("sessionstart",we),pt.addEventListener("sessionend",ye),this.render=function(q,at){if(at!==void 0&&at.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),at.parent===null&&at.matrixWorldAutoUpdate===!0&&at.updateMatrixWorld(),pt.enabled===!0&&pt.isPresenting===!0&&(pt.cameraAutoUpdate===!0&&pt.updateCamera(at),at=pt.getCamera()),q.isScene===!0&&q.onBeforeRender(w,q,at,D),_=Rt.get(q,T.length),_.init(),T.push(_),$t.multiplyMatrices(at.projectionMatrix,at.matrixWorldInverse),Kt.setFromProjectionMatrix($t),bt=this.localClippingEnabled,nt=Bt.init(this.clippingPlanes,bt),A=ce.get(q,x.length),A.init(),x.push(A),Ae(q,at,0,w.sortObjects),A.finish(),w.sortObjects===!0&&A.sort(it,lt),this.info.render.frame++,nt===!0&&Bt.beginShadows();let Et=_.state.shadowsArray;if(Wt.render(Et,q,at),nt===!0&&Bt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(pt.enabled===!1||pt.isPresenting===!1||pt.hasDepthSensing()===!1)&&j.render(A,q),_.setupLights(w._useLegacyLights),at.isArrayCamera){let dt=at.cameras;for(let ut=0,Qt=dt.length;ut<Qt;ut++){let te=dt[ut];Bn(A,q,te,te.viewport)}}else Bn(A,q,at);D!==null&&(Pt.updateMultisampleRenderTarget(D),Pt.updateRenderTargetMipmap(D)),q.isScene===!0&&q.onAfterRender(w,q,at),G.resetDefaultState(),P=-1,ct=null,T.pop(),T.length>0?_=T[T.length-1]:_=null,x.pop(),x.length>0?A=x[x.length-1]:A=null};function Ae(q,at,Et,dt){if(q.visible===!1)return;if(q.layers.test(at.layers)){if(q.isGroup)Et=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(at);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Kt.intersectsSprite(q)){dt&&Gt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let te=St.update(q),le=q.material;le.visible&&A.push(q,te,le,Et,Gt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Kt.intersectsObject(q))){let te=St.update(q),le=q.material;if(dt&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Gt.copy(q.boundingSphere.center)):(te.boundingSphere===null&&te.computeBoundingSphere(),Gt.copy(te.boundingSphere.center)),Gt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(le)){let re=te.groups;for(let ve=0,fe=re.length;ve<fe;ve++){let he=re[ve],cn=le[he.materialIndex];cn&&cn.visible&&A.push(q,te,cn,Et,Gt.z,he)}}else le.visible&&A.push(q,te,le,Et,Gt.z,null)}}let Qt=q.children;for(let te=0,le=Qt.length;te<le;te++)Ae(Qt[te],at,Et,dt)}function Bn(q,at,Et,dt){let ut=q.opaque,Qt=q.transmissive,te=q.transparent;_.setupLightsView(Et),nt===!0&&Bt.setGlobalState(w.clippingPlanes,Et),Qt.length>0&&dr(ut,Qt,at,Et),dt&&wt.viewport(L.copy(dt)),ut.length>0&&_n(ut,at,Et),Qt.length>0&&_n(Qt,at,Et),te.length>0&&_n(te,at,Et),wt.buffers.depth.setTest(!0),wt.buffers.depth.setMask(!0),wt.buffers.color.setMask(!0),wt.setPolygonOffset(!1)}function dr(q,at,Et,dt){if((Et.isScene===!0?Et.overrideMaterial:null)!==null)return;let Qt=Nt.isWebGL2;Vt===null&&(Vt=new Us(1,1,{generateMipmaps:!0,type:_t.has("EXT_color_buffer_half_float")?ff:ma,minFilter:ru,samples:Qt?4:0})),w.getDrawingBufferSize(Ut),Qt?Vt.setSize(Ut.x,Ut.y):Vt.setSize(sv(Ut.x),sv(Ut.y));let te=w.getRenderTarget();w.setRenderTarget(Vt),w.getClearColor(Mt),$=w.getClearAlpha(),$<1&&w.setClearColor(16777215,.5),w.clear();let le=w.toneMapping;w.toneMapping=ga,_n(q,Et,dt),Pt.updateMultisampleRenderTarget(Vt),Pt.updateRenderTargetMipmap(Vt);let re=!1;for(let ve=0,fe=at.length;ve<fe;ve++){let he=at[ve],cn=he.object,Tr=he.geometry,qn=he.material,hi=he.group;if(qn.side===Ns&&cn.layers.test(dt.layers)){let wn=qn.side;qn.side=Oi,qn.needsUpdate=!0,pe(cn,Et,dt,Tr,qn,hi),qn.side=wn,qn.needsUpdate=!0,re=!0}}re===!0&&(Pt.updateMultisampleRenderTarget(Vt),Pt.updateRenderTargetMipmap(Vt)),w.setRenderTarget(te),w.setClearColor(Mt,$),w.toneMapping=le}function _n(q,at,Et){let dt=at.isScene===!0?at.overrideMaterial:null;for(let ut=0,Qt=q.length;ut<Qt;ut++){let te=q[ut],le=te.object,re=te.geometry,ve=dt===null?te.material:dt,fe=te.group;le.layers.test(Et.layers)&&pe(le,at,Et,re,ve,fe)}}function pe(q,at,Et,dt,ut,Qt){q.onBeforeRender(w,at,Et,dt,ut,Qt),q.modelViewMatrix.multiplyMatrices(Et.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ut.onBeforeRender(w,at,Et,dt,q,Qt),ut.transparent===!0&&ut.side===Ns&&ut.forceSinglePass===!1?(ut.side=Oi,ut.needsUpdate=!0,w.renderBufferDirect(Et,at,dt,ut,q,Qt),ut.side=va,ut.needsUpdate=!0,w.renderBufferDirect(Et,at,dt,ut,q,Qt),ut.side=Ns):w.renderBufferDirect(Et,at,dt,ut,q,Qt),q.onAfterRender(w,at,Et,dt,ut,Qt)}function xn(q,at,Et){at.isScene!==!0&&(at=Ct);let dt=Xt.get(q),ut=_.state.lights,Qt=_.state.shadowsArray,te=ut.state.version,le=ot.getParameters(q,ut.state,Qt,at,Et),re=ot.getProgramCacheKey(le),ve=dt.programs;dt.environment=q.isMeshStandardMaterial?at.environment:null,dt.fog=at.fog,dt.envMap=(q.isMeshStandardMaterial?Y:ne).get(q.envMap||dt.environment),dt.envMapRotation=dt.environment!==null&&q.envMap===null?at.environmentRotation:q.envMapRotation,ve===void 0&&(q.addEventListener("dispose",J),ve=new Map,dt.programs=ve);let fe=ve.get(re);if(fe!==void 0){if(dt.currentProgram===fe&&dt.lightsStateVersion===te)return Cn(q,le),fe}else le.uniforms=ot.getUniforms(q),q.onBuild(Et,le,w),q.onBeforeCompile(le,w),fe=ot.acquireProgram(le,re),ve.set(re,fe),dt.uniforms=le.uniforms;let he=dt.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(he.clippingPlanes=Bt.uniform),Cn(q,le),dt.needsLights=Ar(q),dt.lightsStateVersion=te,dt.needsLights&&(he.ambientLightColor.value=ut.state.ambient,he.lightProbe.value=ut.state.probe,he.directionalLights.value=ut.state.directional,he.directionalLightShadows.value=ut.state.directionalShadow,he.spotLights.value=ut.state.spot,he.spotLightShadows.value=ut.state.spotShadow,he.rectAreaLights.value=ut.state.rectArea,he.ltc_1.value=ut.state.rectAreaLTC1,he.ltc_2.value=ut.state.rectAreaLTC2,he.pointLights.value=ut.state.point,he.pointLightShadows.value=ut.state.pointShadow,he.hemisphereLights.value=ut.state.hemi,he.directionalShadowMap.value=ut.state.directionalShadowMap,he.directionalShadowMatrix.value=ut.state.directionalShadowMatrix,he.spotShadowMap.value=ut.state.spotShadowMap,he.spotLightMatrix.value=ut.state.spotLightMatrix,he.spotLightMap.value=ut.state.spotLightMap,he.pointShadowMap.value=ut.state.pointShadowMap,he.pointShadowMatrix.value=ut.state.pointShadowMatrix),dt.currentProgram=fe,dt.uniformsList=null,fe}function Nn(q){if(q.uniformsList===null){let at=q.currentProgram.getUniforms();q.uniformsList=Tl.seqWithValue(at.seq,q.uniforms)}return q.uniformsList}function Cn(q,at){let Et=Xt.get(q);Et.outputColorSpace=at.outputColorSpace,Et.batching=at.batching,Et.instancing=at.instancing,Et.instancingColor=at.instancingColor,Et.instancingMorph=at.instancingMorph,Et.skinning=at.skinning,Et.morphTargets=at.morphTargets,Et.morphNormals=at.morphNormals,Et.morphColors=at.morphColors,Et.morphTargetsCount=at.morphTargetsCount,Et.numClippingPlanes=at.numClippingPlanes,Et.numIntersection=at.numClipIntersection,Et.vertexAlphas=at.vertexAlphas,Et.vertexTangents=at.vertexTangents,Et.toneMapping=at.toneMapping}function En(q,at,Et,dt,ut){at.isScene!==!0&&(at=Ct),Pt.resetTextureUnits();let Qt=at.fog,te=dt.isMeshStandardMaterial?at.environment:null,le=D===null?w.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:xa,re=(dt.isMeshStandardMaterial?Y:ne).get(dt.envMap||te),ve=dt.vertexColors===!0&&!!Et.attributes.color&&Et.attributes.color.itemSize===4,fe=!!Et.attributes.tangent&&(!!dt.normalMap||dt.anisotropy>0),he=!!Et.morphAttributes.position,cn=!!Et.morphAttributes.normal,Tr=!!Et.morphAttributes.color,qn=ga;dt.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(qn=w.toneMapping);let hi=Et.morphAttributes.position||Et.morphAttributes.normal||Et.morphAttributes.color,wn=hi!==void 0?hi.length:0,se=Xt.get(dt),bu=_.state.lights;if(nt===!0&&(bt===!0||q!==ct)){let pi=q===ct&&dt.id===P;Bt.setState(dt,q,pi)}let fn=!1;dt.version===se.__version?(se.needsLights&&se.lightsStateVersion!==bu.state.version||se.outputColorSpace!==le||ut.isBatchedMesh&&se.batching===!1||!ut.isBatchedMesh&&se.batching===!0||ut.isInstancedMesh&&se.instancing===!1||!ut.isInstancedMesh&&se.instancing===!0||ut.isSkinnedMesh&&se.skinning===!1||!ut.isSkinnedMesh&&se.skinning===!0||ut.isInstancedMesh&&se.instancingColor===!0&&ut.instanceColor===null||ut.isInstancedMesh&&se.instancingColor===!1&&ut.instanceColor!==null||ut.isInstancedMesh&&se.instancingMorph===!0&&ut.morphTexture===null||ut.isInstancedMesh&&se.instancingMorph===!1&&ut.morphTexture!==null||se.envMap!==re||dt.fog===!0&&se.fog!==Qt||se.numClippingPlanes!==void 0&&(se.numClippingPlanes!==Bt.numPlanes||se.numIntersection!==Bt.numIntersection)||se.vertexAlphas!==ve||se.vertexTangents!==fe||se.morphTargets!==he||se.morphNormals!==cn||se.morphColors!==Tr||se.toneMapping!==qn||Nt.isWebGL2===!0&&se.morphTargetsCount!==wn)&&(fn=!0):(fn=!0,se.__version=dt.version);let fo=se.currentProgram;fn===!0&&(fo=xn(dt,at,ut));let fc=!1,_e=!1,Pa=!1,Mn=fo.getUniforms(),ho=se.uniforms;if(wt.useProgram(fo.program)&&(fc=!0,_e=!0,Pa=!0),dt.id!==P&&(P=dt.id,_e=!0),fc||ct!==q){Mn.setValue(Z,"projectionMatrix",q.projectionMatrix),Mn.setValue(Z,"viewMatrix",q.matrixWorldInverse);let pi=Mn.map.cameraPosition;pi!==void 0&&pi.setValue(Z,Gt.setFromMatrixPosition(q.matrixWorld)),Nt.logarithmicDepthBuffer&&Mn.setValue(Z,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(dt.isMeshPhongMaterial||dt.isMeshToonMaterial||dt.isMeshLambertMaterial||dt.isMeshBasicMaterial||dt.isMeshStandardMaterial||dt.isShaderMaterial)&&Mn.setValue(Z,"isOrthographic",q.isOrthographicCamera===!0),ct!==q&&(ct=q,_e=!0,Pa=!0)}if(ut.isSkinnedMesh){Mn.setOptional(Z,ut,"bindMatrix"),Mn.setOptional(Z,ut,"bindMatrixInverse");let pi=ut.skeleton;pi&&(Nt.floatVertexTextures?(pi.boneTexture===null&&pi.computeBoneTexture(),Mn.setValue(Z,"boneTexture",pi.boneTexture,Pt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ut.isBatchedMesh&&(Mn.setOptional(Z,ut,"batchingTexture"),Mn.setValue(Z,"batchingTexture",ut._matricesTexture,Pt));let me=Et.morphAttributes;if((me.position!==void 0||me.normal!==void 0||me.color!==void 0&&Nt.isWebGL2===!0)&&b.update(ut,Et,fo),(_e||se.receiveShadow!==ut.receiveShadow)&&(se.receiveShadow=ut.receiveShadow,Mn.setValue(Z,"receiveShadow",ut.receiveShadow)),dt.isMeshGouraudMaterial&&dt.envMap!==null&&(ho.envMap.value=re,ho.flipEnvMap.value=re.isCubeTexture&&re.isRenderTargetTexture===!1?-1:1),_e&&(Mn.setValue(Z,"toneMappingExposure",w.toneMappingExposure),se.needsLights&&Kr(ho,Pa),Qt&&dt.fog===!0&&Lt.refreshFogUniforms(ho,Qt),Lt.refreshMaterialUniforms(ho,dt,vt,ft,Vt),Tl.upload(Z,Nn(se),ho,Pt)),dt.isShaderMaterial&&dt.uniformsNeedUpdate===!0&&(Tl.upload(Z,Nn(se),ho,Pt),dt.uniformsNeedUpdate=!1),dt.isSpriteMaterial&&Mn.setValue(Z,"center",ut.center),Mn.setValue(Z,"modelViewMatrix",ut.modelViewMatrix),Mn.setValue(Z,"normalMatrix",ut.normalMatrix),Mn.setValue(Z,"modelMatrix",ut.matrixWorld),dt.isShaderMaterial||dt.isRawShaderMaterial){let pi=dt.uniformsGroups;for(let hc=0,Au=pi.length;hc<Au;hc++)if(Nt.isWebGL2){let di=pi[hc];rt.update(di,fo),rt.bind(di,fo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return fo}function Kr(q,at){q.ambientLightColor.needsUpdate=at,q.lightProbe.needsUpdate=at,q.directionalLights.needsUpdate=at,q.directionalLightShadows.needsUpdate=at,q.pointLights.needsUpdate=at,q.pointLightShadows.needsUpdate=at,q.spotLights.needsUpdate=at,q.spotLightShadows.needsUpdate=at,q.rectAreaLights.needsUpdate=at,q.hemisphereLights.needsUpdate=at}function Ar(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(q,at,Et){Xt.get(q.texture).__webglTexture=at,Xt.get(q.depthTexture).__webglTexture=Et;let dt=Xt.get(q);dt.__hasExternalTextures=!0,dt.__autoAllocateDepthBuffer=Et===void 0,dt.__autoAllocateDepthBuffer||_t.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),dt.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,at){let Et=Xt.get(q);Et.__webglFramebuffer=at,Et.__useDefaultFramebuffer=at===void 0},this.setRenderTarget=function(q,at=0,Et=0){D=q,B=at,U=Et;let dt=!0,ut=null,Qt=!1,te=!1;if(q){let re=Xt.get(q);re.__useDefaultFramebuffer!==void 0?(wt.bindFramebuffer(Z.FRAMEBUFFER,null),dt=!1):re.__webglFramebuffer===void 0?Pt.setupRenderTarget(q):re.__hasExternalTextures&&Pt.rebindTextures(q,Xt.get(q.texture).__webglTexture,Xt.get(q.depthTexture).__webglTexture);let ve=q.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(te=!0);let fe=Xt.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(fe[at])?ut=fe[at][Et]:ut=fe[at],Qt=!0):Nt.isWebGL2&&q.samples>0&&Pt.useMultisampledRTT(q)===!1?ut=Xt.get(q).__webglMultisampledFramebuffer:Array.isArray(fe)?ut=fe[Et]:ut=fe,L.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else L.copy(H).multiplyScalar(vt).floor(),W.copy(At).multiplyScalar(vt).floor(),V=It;if(wt.bindFramebuffer(Z.FRAMEBUFFER,ut)&&Nt.drawBuffers&&dt&&wt.drawBuffers(q,ut),wt.viewport(L),wt.scissor(W),wt.setScissorTest(V),Qt){let re=Xt.get(q.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+at,re.__webglTexture,Et)}else if(te){let re=Xt.get(q.texture),ve=at||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,re.__webglTexture,Et||0,ve)}P=-1},this.readRenderTargetPixels=function(q,at,Et,dt,ut,Qt,te){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let le=Xt.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&te!==void 0&&(le=le[te]),le){wt.bindFramebuffer(Z.FRAMEBUFFER,le);try{let re=q.texture,ve=re.format,fe=re.type;if(ve!==Lo&&k.convert(ve)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let he=fe===ff&&(_t.has("EXT_color_buffer_half_float")||Nt.isWebGL2&&_t.has("EXT_color_buffer_float"));if(fe!==ma&&k.convert(fe)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(fe===Os&&(Nt.isWebGL2||_t.has("OES_texture_float")||_t.has("WEBGL_color_buffer_float")))&&!he){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}at>=0&&at<=q.width-dt&&Et>=0&&Et<=q.height-ut&&Z.readPixels(at,Et,dt,ut,k.convert(ve),k.convert(fe),Qt)}finally{let re=D!==null?Xt.get(D).__webglFramebuffer:null;wt.bindFramebuffer(Z.FRAMEBUFFER,re)}}},this.copyFramebufferToTexture=function(q,at,Et=0){let dt=Math.pow(2,-Et),ut=Math.floor(at.image.width*dt),Qt=Math.floor(at.image.height*dt);Pt.setTexture2D(at,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Et,0,0,q.x,q.y,ut,Qt),wt.unbindTexture()},this.copyTextureToTexture=function(q,at,Et,dt=0){let ut=at.image.width,Qt=at.image.height,te=k.convert(Et.format),le=k.convert(Et.type);Pt.setTexture2D(Et,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,Et.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Et.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,Et.unpackAlignment),at.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,dt,q.x,q.y,ut,Qt,te,le,at.image.data):at.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,dt,q.x,q.y,at.mipmaps[0].width,at.mipmaps[0].height,te,at.mipmaps[0].data):Z.texSubImage2D(Z.TEXTURE_2D,dt,q.x,q.y,te,le,at.image),dt===0&&Et.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),wt.unbindTexture()},this.copyTextureToTexture3D=function(q,at,Et,dt,ut=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Qt=Math.round(q.max.x-q.min.x),te=Math.round(q.max.y-q.min.y),le=q.max.z-q.min.z+1,re=k.convert(dt.format),ve=k.convert(dt.type),fe;if(dt.isData3DTexture)Pt.setTexture3D(dt,0),fe=Z.TEXTURE_3D;else if(dt.isDataArrayTexture||dt.isCompressedArrayTexture)Pt.setTexture2DArray(dt,0),fe=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,dt.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dt.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,dt.unpackAlignment);let he=Z.getParameter(Z.UNPACK_ROW_LENGTH),cn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Tr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),qn=Z.getParameter(Z.UNPACK_SKIP_ROWS),hi=Z.getParameter(Z.UNPACK_SKIP_IMAGES),wn=Et.isCompressedTexture?Et.mipmaps[ut]:Et.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,wn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,wn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,q.min.x),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,q.min.y),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,q.min.z),Et.isDataTexture||Et.isData3DTexture?Z.texSubImage3D(fe,ut,at.x,at.y,at.z,Qt,te,le,re,ve,wn.data):dt.isCompressedArrayTexture?Z.compressedTexSubImage3D(fe,ut,at.x,at.y,at.z,Qt,te,le,re,wn.data):Z.texSubImage3D(fe,ut,at.x,at.y,at.z,Qt,te,le,re,ve,wn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,he),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,cn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Tr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,qn),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,hi),ut===0&&dt.generateMipmaps&&Z.generateMipmap(fe),wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Pt.setTextureCube(q,0):q.isData3DTexture?Pt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Pt.setTexture2DArray(q,0):Pt.setTexture2D(q,0),wt.unbindTexture()},this.resetState=function(){B=0,U=0,D=null,wt.reset(),G.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ds}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Zv?"display-p3":"srgb",e.unpackColorSpace=Rn.workingColorSpace===ld?"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}},bv=class extends Mv{};bv.prototype.isWebGL1Renderer=!0;var pf=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Fs()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return nP("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,u=this.stride;s<u;s++)this.array[t+s]=e.array[i+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fs()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fs()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},wi=new st,es=class n{constructor(t,e,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)wi.fromBufferAttribute(this,e),wi.applyMatrix4(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)wi.fromBufferAttribute(this,e),wi.applyNormalMatrix(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)wi.fromBufferAttribute(this,e),wi.transformDirection(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=Ko(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Pn(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Pn(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ko(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ko(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ko(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ko(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,e,i,s,u){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pn(e,this.array),i=Pn(i,this.array),s=Pn(s,this.array),u=Pn(u,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=u,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let s=i*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return new Zn(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new n(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let s=i*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Av=class extends cu{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Te(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},fa,of=new st,_l=new st,xl=new st,El=new Ot,sf=new Ot,fP=new $n,Ap=new st,af=new st,Tp=new st,UI=new Ot,Yy=new Ot,BI=new Ot,Tv=class extends Oo{constructor(t=new Av){if(super(),this.isSprite=!0,this.type="Sprite",fa===void 0){fa=new ui;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new pf(e,5);fa.setIndex([0,1,2,0,2,3]),fa.setAttribute("position",new es(i,3,0,!1)),fa.setAttribute("uv",new es(i,2,3,!1))}this.geometry=fa,this.material=t,this.center=new Ot(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),_l.setFromMatrixScale(this.matrixWorld),fP.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),xl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_l.multiplyScalar(-xl.z);let i=this.material.rotation,s,u;i!==0&&(u=Math.cos(i),s=Math.sin(i));let c=this.center;Cp(Ap.set(-.5,-.5,0),xl,c,_l,s,u),Cp(af.set(.5,-.5,0),xl,c,_l,s,u),Cp(Tp.set(.5,.5,0),xl,c,_l,s,u),UI.set(0,0),Yy.set(1,0),BI.set(1,1);let f=t.ray.intersectTriangle(Ap,af,Tp,!1,of);if(f===null&&(Cp(af.set(-.5,.5,0),xl,c,_l,s,u),Yy.set(0,1),f=t.ray.intersectTriangle(Ap,Tp,af,!1,of),f===null))return;let p=t.ray.origin.distanceTo(of);p<t.near||p>t.far||e.push({distance:p,point:of.clone(),uv:iu.getInterpolation(of,Ap,af,Tp,UI,Yy,BI,new Ot),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};Tv.Dispose=function(){fa.dispose(),fa=void 0};function Cp(n,t,e,i,s,u){El.subVectors(n,e).addScalar(.5).multiply(i),s!==void 0?(sf.x=u*El.x-s*El.y,sf.y=s*El.x+u*El.y):sf.copy(El),n.copy(t),n.x+=sf.x,n.y+=sf.y,n.applyMatrix4(fP)}var co=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],i,s=this.getPoint(0),u=0;e.push(0);for(let c=1;c<=t;c++)i=this.getPoint(c/t),u+=i.distanceTo(s),e.push(u),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){let i=this.getLengths(),s=0,u=i.length,c;e?c=e:c=t*i[u-1];let f=0,p=u-1,d;for(;f<=p;)if(s=Math.floor(f+(p-f)/2),d=i[s]-c,d<0)f=s+1;else if(d>0)p=s-1;else{p=s;break}if(s=p,i[s]===c)return s/(u-1);let g=i[s],v=i[s+1]-g,E=(c-g)/v;return(s+E)/(u-1)}getTangent(t,e){let s=t-1e-4,u=t+1e-4;s<0&&(s=0),u>1&&(u=1);let c=this.getPoint(s),f=this.getPoint(u),p=e||(c.isVector2?new Ot:new st);return p.copy(f).sub(c).normalize(),p}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){let i=new st,s=[],u=[],c=[],f=new st,p=new $n;for(let E=0;E<=t;E++){let M=E/t;s[E]=this.getTangentAt(M,new st)}u[0]=new st,c[0]=new st;let d=Number.MAX_VALUE,g=Math.abs(s[0].x),y=Math.abs(s[0].y),v=Math.abs(s[0].z);g<=d&&(d=g,i.set(1,0,0)),y<=d&&(d=y,i.set(0,1,0)),v<=d&&i.set(0,0,1),f.crossVectors(s[0],i).normalize(),u[0].crossVectors(s[0],f),c[0].crossVectors(s[0],u[0]);for(let E=1;E<=t;E++){if(u[E]=u[E-1].clone(),c[E]=c[E-1].clone(),f.crossVectors(s[E-1],s[E]),f.length()>Number.EPSILON){f.normalize();let M=Math.acos(ai(s[E-1].dot(s[E]),-1,1));u[E].applyMatrix4(p.makeRotationAxis(f,M))}c[E].crossVectors(s[E],u[E])}if(e===!0){let E=Math.acos(ai(u[0].dot(u[t]),-1,1));E/=t,s[0].dot(f.crossVectors(u[0],u[t]))>0&&(E=-E);for(let M=1;M<=t;M++)u[M].applyMatrix4(p.makeRotationAxis(s[M],E*M)),c[M].crossVectors(s[M],u[M])}return{tangents:s,normals:u,binormals:c}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},df=class extends co{constructor(t=0,e=0,i=1,s=1,u=0,c=Math.PI*2,f=!1,p=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=u,this.aEndAngle=c,this.aClockwise=f,this.aRotation=p}getPoint(t,e=new Ot){let i=e,s=Math.PI*2,u=this.aEndAngle-this.aStartAngle,c=Math.abs(u)<Number.EPSILON;for(;u<0;)u+=s;for(;u>s;)u-=s;u<Number.EPSILON&&(c?u=0:u=s),this.aClockwise===!0&&!c&&(u===s?u=-s:u=u-s);let f=this.aStartAngle+t*u,p=this.aX+this.xRadius*Math.cos(f),d=this.aY+this.yRadius*Math.sin(f);if(this.aRotation!==0){let g=Math.cos(this.aRotation),y=Math.sin(this.aRotation),v=p-this.aX,E=d-this.aY;p=v*g-E*y+this.aX,d=v*y+E*g+this.aY}return i.set(p,d)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},Cv=class extends df{constructor(t,e,i,s,u,c){super(t,e,i,i,s,u,c),this.isArcCurve=!0,this.type="ArcCurve"}};function jv(){let n=0,t=0,e=0,i=0;function s(u,c,f,p){n=u,t=f,e=-3*u+3*c-2*f-p,i=2*u-2*c+f+p}return{initCatmullRom:function(u,c,f,p,d){s(c,f,d*(f-u),d*(p-c))},initNonuniformCatmullRom:function(u,c,f,p,d,g,y){let v=(c-u)/d-(f-u)/(d+g)+(f-c)/g,E=(f-c)/g-(p-c)/(g+y)+(p-f)/y;v*=g,E*=g,s(c,f,v,E)},calc:function(u){let c=u*u,f=c*u;return n+t*u+e*c+i*f}}}var Ip=new st,$y=new jv,Zy=new jv,Jy=new jv,Iv=class extends co{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new st){let i=e,s=this.points,u=s.length,c=(u-(this.closed?0:1))*t,f=Math.floor(c),p=c-f;this.closed?f+=f>0?0:(Math.floor(Math.abs(f)/u)+1)*u:p===0&&f===u-1&&(f=u-2,p=1);let d,g;this.closed||f>0?d=s[(f-1)%u]:(Ip.subVectors(s[0],s[1]).add(s[0]),d=Ip);let y=s[f%u],v=s[(f+1)%u];if(this.closed||f+2<u?g=s[(f+2)%u]:(Ip.subVectors(s[u-1],s[u-2]).add(s[u-1]),g=Ip),this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?.5:.25,M=Math.pow(d.distanceToSquared(y),E),A=Math.pow(y.distanceToSquared(v),E),_=Math.pow(v.distanceToSquared(g),E);A<1e-4&&(A=1),M<1e-4&&(M=A),_<1e-4&&(_=A),$y.initNonuniformCatmullRom(d.x,y.x,v.x,g.x,M,A,_),Zy.initNonuniformCatmullRom(d.y,y.y,v.y,g.y,M,A,_),Jy.initNonuniformCatmullRom(d.z,y.z,v.z,g.z,M,A,_)}else this.curveType==="catmullrom"&&($y.initCatmullRom(d.x,y.x,v.x,g.x,this.tension),Zy.initCatmullRom(d.y,y.y,v.y,g.y,this.tension),Jy.initCatmullRom(d.z,y.z,v.z,g.z,this.tension));return i.set($y.calc(p),Zy.calc(p),Jy.calc(p)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(new st().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function zI(n,t,e,i,s){let u=(i-t)*.5,c=(s-e)*.5,f=n*n,p=n*f;return(2*e-2*i+u+c)*p+(-3*e+3*i-2*u-c)*f+u*n+e}function q7(n,t){let e=1-n;return e*e*t}function V7(n,t){return 2*(1-n)*n*t}function H7(n,t){return n*n*t}function lf(n,t,e,i){return q7(n,t)+V7(n,e)+H7(n,i)}function W7(n,t){let e=1-n;return e*e*e*t}function X7(n,t){let e=1-n;return 3*e*e*n*t}function Y7(n,t){return 3*(1-n)*n*n*t}function $7(n,t){return n*n*n*t}function cf(n,t,e,i,s){return W7(n,t)+X7(n,e)+Y7(n,i)+$7(n,s)}var td=class extends co{constructor(t=new Ot,e=new Ot,i=new Ot,s=new Ot){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Ot){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(cf(t,s.x,u.x,c.x,f.x),cf(t,s.y,u.y,c.y,f.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Pv=class extends co{constructor(t=new st,e=new st,i=new st,s=new st){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new st){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(cf(t,s.x,u.x,c.x,f.x),cf(t,s.y,u.y,c.y,f.y),cf(t,s.z,u.z,c.z,f.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},ed=class extends co{constructor(t=new Ot,e=new Ot){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ot){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Ot){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Rv=class extends co{constructor(t=new st,e=new st){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new st){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new st){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},nd=class extends co{constructor(t=new Ot,e=new Ot,i=new Ot){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ot){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(lf(t,s.x,u.x,c.x),lf(t,s.y,u.y,c.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Lv=class extends co{constructor(t=new st,e=new st,i=new st){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new st){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(lf(t,s.x,u.x,c.x),lf(t,s.y,u.y,c.y),lf(t,s.z,u.z,c.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},rd=class extends co{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ot){let i=e,s=this.points,u=(s.length-1)*t,c=Math.floor(u),f=u-c,p=s[c===0?c:c-1],d=s[c],g=s[c>s.length-2?s.length-1:c+1],y=s[c>s.length-3?s.length-1:c+2];return i.set(zI(f,p.x,d.x,g.x,y.x),zI(f,p.y,d.y,g.y,y.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(new Ot().fromArray(s))}return this}},Nv=Object.freeze({__proto__:null,ArcCurve:Cv,CatmullRomCurve3:Iv,CubicBezierCurve:td,CubicBezierCurve3:Pv,EllipseCurve:df,LineCurve:ed,LineCurve3:Rv,QuadraticBezierCurve:nd,QuadraticBezierCurve3:Lv,SplineCurve:rd}),Ov=class extends co{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Nv[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),s=this.getCurveLengths(),u=0;for(;u<s.length;){if(s[u]>=i){let c=s[u]-i,f=this.curves[u],p=f.getLength(),d=p===0?0:1-c/p;return f.getPointAt(d,e)}u++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i<s;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],i;for(let s=0,u=this.curves;s<u.length;s++){let c=u[s],f=c.isEllipseCurve?t*2:c.isLineCurve||c.isLineCurve3?1:c.isSplineCurve?t*c.points.length:t,p=c.getPoints(f);for(let d=0;d<p.length;d++){let g=p[d];i&&i.equals(g)||(e.push(g),i=g)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let s=t.curves[e];this.curves.push(new Nv[s.type]().fromJSON(s))}return this}},Ll=class extends Ov{constructor(t){super(),this.type="Path",this.currentPoint=new Ot,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new ed(this.currentPoint.clone(),new Ot(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){let u=new nd(this.currentPoint.clone(),new Ot(t,e),new Ot(i,s));return this.curves.push(u),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,u,c){let f=new td(this.currentPoint.clone(),new Ot(t,e),new Ot(i,s),new Ot(u,c));return this.curves.push(f),this.currentPoint.set(u,c),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new rd(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,s,u,c){let f=this.currentPoint.x,p=this.currentPoint.y;return this.absarc(t+f,e+p,i,s,u,c),this}absarc(t,e,i,s,u,c){return this.absellipse(t,e,i,i,s,u,c),this}ellipse(t,e,i,s,u,c,f,p){let d=this.currentPoint.x,g=this.currentPoint.y;return this.absellipse(t+d,e+g,i,s,u,c,f,p),this}absellipse(t,e,i,s,u,c,f,p){let d=new df(t,e,i,s,u,c,f,p);if(this.curves.length>0){let y=d.getPoint(0);y.equals(this.currentPoint)||this.lineTo(y.x,y.y)}this.curves.push(d);let g=d.getPoint(1);return this.currentPoint.copy(g),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}};var Nl=class extends Ll{constructor(t){super(t),this.uuid=Fs(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i<s;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let s=t.holes[e];this.holes.push(new Ll().fromJSON(s))}return this}},Z7={triangulate:function(n,t,e=2){let i=t&&t.length,s=i?t[0]*e:n.length,u=hP(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;let f,p,d,g,y,v,E;if(i&&(u=tY(n,t,u,e)),n.length>80*e){f=d=n[0],p=g=n[1];for(let M=e;M<s;M+=e)y=n[M],v=n[M+1],y<f&&(f=y),v<p&&(p=v),y>d&&(d=y),v>g&&(g=v);E=Math.max(d-f,g-p),E=E!==0?32767/E:0}return gf(u,c,e,f,p,E,0),c}};function hP(n,t,e,i,s){let u,c;if(s===fY(n,t,e,i)>0)for(u=t;u<e;u+=i)c=GI(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=GI(u,n[u],n[u+1],c);return c&&fd(c,c.next)&&(yf(c),c=c.next),c}function fu(n,t){if(!n)return n;t||(t=n);let e=n,i;do if(i=!1,!e.steiner&&(fd(e,e.next)||jn(e.prev,e,e.next)===0)){if(yf(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function gf(n,t,e,i,s,u,c){if(!n)return;!c&&u&&oY(n,i,s,u);let f=n,p,d;for(;n.prev!==n.next;){if(p=n.prev,d=n.next,u?j7(n,i,s,u):J7(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),yf(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=K7(fu(n),t,e),gf(n,t,e,i,s,u,2)):c===2&&Q7(n,t,e,i,s,u):gf(fu(n),t,e,i,s,u,1);break}}}function J7(n){let t=n.prev,e=n,i=n.next;if(jn(t,e,i)>=0)return!1;let s=t.x,u=e.x,c=i.x,f=t.y,p=e.y,d=i.y,g=s<u?s<c?s:c:u<c?u:c,y=f<p?f<d?f:d:p<d?p:d,v=s>u?s>c?s:c:u>c?u:c,E=f>p?f>d?f:d:p>d?p:d,M=i.next;for(;M!==t;){if(M.x>=g&&M.x<=v&&M.y>=y&&M.y<=E&&Ml(s,f,u,p,c,d,M.x,M.y)&&jn(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function j7(n,t,e,i){let s=n.prev,u=n,c=n.next;if(jn(s,u,c)>=0)return!1;let f=s.x,p=u.x,d=c.x,g=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=g<y?g<v?g:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=g>y?g>v?g:v:y>v?y:v,x=Dv(E,M,t,e,i),T=Dv(A,_,t,e,i),w=n.prevZ,R=n.nextZ;for(;w&&w.z>=x&&R&&R.z<=T;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Ml(f,g,p,y,d,v,w.x,w.y)&&jn(w.prev,w,w.next)>=0||(w=w.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Ml(f,g,p,y,d,v,R.x,R.y)&&jn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;w&&w.z>=x;){if(w.x>=E&&w.x<=A&&w.y>=M&&w.y<=_&&w!==s&&w!==c&&Ml(f,g,p,y,d,v,w.x,w.y)&&jn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Ml(f,g,p,y,d,v,R.x,R.y)&&jn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function K7(n,t,e){let i=n;do{let s=i.prev,u=i.next.next;!fd(s,u)&&pP(s,i,i.next,u)&&mf(s,u)&&mf(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),yf(i),yf(i.next),i=n=u),i=i.next}while(i!==n);return fu(i)}function Q7(n,t,e,i,s,u){let c=n;do{let f=c.next.next;for(;f!==c.prev;){if(c.i!==f.i&&uY(c,f)){let p=dP(c,f);c=fu(c,c.next),p=fu(p,p.next),gf(c,t,e,i,s,u,0),gf(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function tY(n,t,e,i){let s=[],u,c,f,p,d;for(u=0,c=t.length;u<c;u++)f=t[u]*i,p=u<c-1?t[u+1]*i:n.length,d=hP(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(aY(d));for(s.sort(eY),u=0;u<s.length;u++)e=nY(s[u],e);return e}function eY(n,t){return n.x-t.x}function nY(n,t){let e=rY(n,t);if(!e)return t;let i=dP(e,n);return fu(i,i.next),fu(e,e.next)}function rY(n,t){let e=t,i=-1/0,s,u=n.x,c=n.y;do{if(c<=e.y&&c>=e.next.y&&e.next.y!==e.y){let v=e.x+(c-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(v<=u&&v>i&&(i=v,s=e.x<e.next.x?e:e.next,v===u))return s}e=e.next}while(e!==t);if(!s)return null;let f=s,p=s.x,d=s.y,g=1/0,y;e=s;do u>=e.x&&e.x>=p&&u!==e.x&&Ml(c<d?u:i,c,p,d,c<d?i:u,c,e.x,e.y)&&(y=Math.abs(c-e.y)/(u-e.x),mf(e,n)&&(y<g||y===g&&(e.x>s.x||e.x===s.x&&iY(s,e)))&&(s=e,g=y)),e=e.next;while(e!==f);return s}function iY(n,t){return jn(n.prev,n,t.prev)<0&&jn(t.next,n,n.next)<0}function oY(n,t,e,i){let s=n;do s.z===0&&(s.z=Dv(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,sY(s)}function sY(n){let t,e,i,s,u,c,f,p,d=1;do{for(e=n,n=null,u=null,c=0;e;){for(c++,i=e,f=0,t=0;t<d&&(f++,i=i.nextZ,!!i);t++);for(p=d;f>0||p>0&&i;)f!==0&&(p===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,f--):(s=i,i=i.nextZ,p--),u?u.nextZ=s:n=s,s.prevZ=u,u=s;e=i}u.nextZ=null,d*=2}while(c>1);return n}function Dv(n,t,e,i,s){return n=(n-e)*s|0,t=(t-i)*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 aY(n){let 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 Ml(n,t,e,i,s,u,c,f){return(s-c)*(t-f)>=(n-c)*(u-f)&&(n-c)*(i-f)>=(e-c)*(t-f)&&(e-c)*(u-f)>=(s-c)*(i-f)}function uY(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!lY(n,t)&&(mf(n,t)&&mf(t,n)&&cY(n,t)&&(jn(n.prev,n,t.prev)||jn(n,t.prev,t))||fd(n,t)&&jn(n.prev,n,n.next)>0&&jn(t.prev,t,t.next)>0)}function jn(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function fd(n,t){return n.x===t.x&&n.y===t.y}function pP(n,t,e,i){let s=Rp(jn(n,t,e)),u=Rp(jn(n,t,i)),c=Rp(jn(e,i,n)),f=Rp(jn(e,i,t));return!!(s!==u&&c!==f||s===0&&Pp(n,e,t)||u===0&&Pp(n,i,t)||c===0&&Pp(e,n,i)||f===0&&Pp(e,t,i))}function Pp(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 Rp(n){return n>0?1:n<0?-1:0}function lY(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&pP(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function mf(n,t){return jn(n.prev,n,n.next)<0?jn(n,t,n.next)>=0&&jn(n,n.prev,t)>=0:jn(n,t,n.prev)<0||jn(n,n.next,t)<0}function cY(n,t){let e=n,i=!1,s=(n.x+t.x)/2,u=(n.y+t.y)/2;do e.y>u!=e.next.y>u&&e.next.y!==e.y&&s<(e.next.x-e.x)*(u-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==n);return i}function dP(n,t){let e=new Fv(n.i,n.x,n.y),i=new Fv(t.i,t.x,t.y),s=n.next,u=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,i.next=e,e.prev=i,u.next=i,i.prev=u,i}function GI(n,t,e,i){let s=new Fv(n,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function yf(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 Fv(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}function fY(n,t,e,i){let s=0;for(let u=t,c=e-i;u<e;u+=i)s+=(n[c]-n[u])*(n[u+1]+n[c+1]),c=u;return s}var ya=class n{static area(t){let e=t.length,i=0;for(let s=e-1,u=0;u<e;s=u++)i+=t[s].x*t[u].y-t[u].x*t[s].y;return i*.5}static isClockWise(t){return n.area(t)<0}static triangulateShape(t,e){let i=[],s=[],u=[];kI(t),qI(i,t);let c=t.length;e.forEach(kI);for(let p=0;p<e.length;p++)s.push(c),c+=e[p].length,qI(i,e[p]);let f=Z7.triangulate(i,s);for(let p=0;p<f.length;p+=3)u.push(f.slice(p,p+3));return u}};function kI(n){let t=n.length;t>2&&n[t-1].equals(n[0])&&n.pop()}function qI(n,t){for(let e=0;e<t.length;e++)n.push(t[e].x),n.push(t[e].y)}var id=class n extends ui{constructor(t=new Nl([new Ot(.5,.5),new Ot(-.5,.5),new Ot(-.5,-.5),new Ot(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let i=this,s=[],u=[];for(let f=0,p=t.length;f<p;f++){let d=t[f];c(d)}this.setAttribute("position",new _r(s,3)),this.setAttribute("uv",new _r(u,2)),this.computeVertexNormals();function c(f){let p=[],d=e.curveSegments!==void 0?e.curveSegments:12,g=e.steps!==void 0?e.steps:1,y=e.depth!==void 0?e.depth:1,v=e.bevelEnabled!==void 0?e.bevelEnabled:!0,E=e.bevelThickness!==void 0?e.bevelThickness:.2,M=e.bevelSize!==void 0?e.bevelSize:E-.1,A=e.bevelOffset!==void 0?e.bevelOffset:0,_=e.bevelSegments!==void 0?e.bevelSegments:3,x=e.extrudePath,T=e.UVGenerator!==void 0?e.UVGenerator:hY,w,R=!1,B,U,D,P;x&&(w=x.getSpacedPoints(g),R=!0,v=!1,B=x.computeFrenetFrames(g,!1),U=new st,D=new st,P=new st),v||(_=0,E=0,M=0,A=0);let ct=f.extractPoints(d),L=ct.shape,W=ct.holes;if(!ya.isClockWise(L)){L=L.reverse();for(let Z=0,Dt=W.length;Z<Dt;Z++){let _t=W[Z];ya.isClockWise(_t)&&(W[Z]=_t.reverse())}}let Mt=ya.triangulateShape(L,W),$=L;for(let Z=0,Dt=W.length;Z<Dt;Z++){let _t=W[Z];L=L.concat(_t)}function gt(Z,Dt,_t){return Dt||console.error("THREE.ExtrudeGeometry: vec does not exist"),Z.clone().addScaledVector(Dt,_t)}let ft=L.length,vt=Mt.length;function it(Z,Dt,_t){let Nt,wt,Ht,Xt=Z.x-Dt.x,Pt=Z.y-Dt.y,ne=_t.x-Z.x,Y=_t.y-Z.y,N=Xt*Xt+Pt*Pt,xt=Xt*Y-Pt*ne;if(Math.abs(xt)>Number.EPSILON){let St=Math.sqrt(N),ot=Math.sqrt(ne*ne+Y*Y),Lt=Dt.x-Pt/St,ce=Dt.y+Xt/St,Rt=_t.x-Y/ot,Bt=_t.y+ne/ot,Wt=((Rt-Lt)*Y-(Bt-ce)*ne)/(Xt*Y-Pt*ne);Nt=Lt+Xt*Wt-Z.x,wt=ce+Pt*Wt-Z.y;let j=Nt*Nt+wt*wt;if(j<=2)return new Ot(Nt,wt);Ht=Math.sqrt(j/2)}else{let St=!1;Xt>Number.EPSILON?ne>Number.EPSILON&&(St=!0):Xt<-Number.EPSILON?ne<-Number.EPSILON&&(St=!0):Math.sign(Pt)===Math.sign(Y)&&(St=!0),St?(Nt=-Pt,wt=Xt,Ht=Math.sqrt(N)):(Nt=Xt,wt=Pt,Ht=Math.sqrt(N/2))}return new Ot(Nt/Ht,wt/Ht)}let lt=[];for(let Z=0,Dt=$.length,_t=Dt-1,Nt=Z+1;Z<Dt;Z++,_t++,Nt++)_t===Dt&&(_t=0),Nt===Dt&&(Nt=0),lt[Z]=it($[Z],$[_t],$[Nt]);let H=[],At,It=lt.concat();for(let Z=0,Dt=W.length;Z<Dt;Z++){let _t=W[Z];At=[];for(let Nt=0,wt=_t.length,Ht=wt-1,Xt=Nt+1;Nt<wt;Nt++,Ht++,Xt++)Ht===wt&&(Ht=0),Xt===wt&&(Xt=0),At[Nt]=it(_t[Nt],_t[Ht],_t[Xt]);H.push(At),It=It.concat(At)}for(let Z=0;Z<_;Z++){let Dt=Z/_,_t=E*Math.cos(Dt*Math.PI/2),Nt=M*Math.sin(Dt*Math.PI/2)+A;for(let wt=0,Ht=$.length;wt<Ht;wt++){let Xt=gt($[wt],lt[wt],Nt);$t(Xt.x,Xt.y,-_t)}for(let wt=0,Ht=W.length;wt<Ht;wt++){let Xt=W[wt];At=H[wt];for(let Pt=0,ne=Xt.length;Pt<ne;Pt++){let Y=gt(Xt[Pt],At[Pt],Nt);$t(Y.x,Y.y,-_t)}}}let Kt=M+A;for(let Z=0;Z<ft;Z++){let Dt=v?gt(L[Z],It[Z],Kt):L[Z];R?(D.copy(B.normals[0]).multiplyScalar(Dt.x),U.copy(B.binormals[0]).multiplyScalar(Dt.y),P.copy(w[0]).add(D).add(U),$t(P.x,P.y,P.z)):$t(Dt.x,Dt.y,0)}for(let Z=1;Z<=g;Z++)for(let Dt=0;Dt<ft;Dt++){let _t=v?gt(L[Dt],It[Dt],Kt):L[Dt];R?(D.copy(B.normals[Z]).multiplyScalar(_t.x),U.copy(B.binormals[Z]).multiplyScalar(_t.y),P.copy(w[Z]).add(D).add(U),$t(P.x,P.y,P.z)):$t(_t.x,_t.y,y/g*Z)}for(let Z=_-1;Z>=0;Z--){let Dt=Z/_,_t=E*Math.cos(Dt*Math.PI/2),Nt=M*Math.sin(Dt*Math.PI/2)+A;for(let wt=0,Ht=$.length;wt<Ht;wt++){let Xt=gt($[wt],lt[wt],Nt);$t(Xt.x,Xt.y,y+_t)}for(let wt=0,Ht=W.length;wt<Ht;wt++){let Xt=W[wt];At=H[wt];for(let Pt=0,ne=Xt.length;Pt<ne;Pt++){let Y=gt(Xt[Pt],At[Pt],Nt);R?$t(Y.x,Y.y+w[g-1].y,w[g-1].x+_t):$t(Y.x,Y.y,y+_t)}}}nt(),bt();function nt(){let Z=s.length/3;if(v){let Dt=0,_t=ft*Dt;for(let Nt=0;Nt<vt;Nt++){let wt=Mt[Nt];Ut(wt[2]+_t,wt[1]+_t,wt[0]+_t)}Dt=g+_*2,_t=ft*Dt;for(let Nt=0;Nt<vt;Nt++){let wt=Mt[Nt];Ut(wt[0]+_t,wt[1]+_t,wt[2]+_t)}}else{for(let Dt=0;Dt<vt;Dt++){let _t=Mt[Dt];Ut(_t[2],_t[1],_t[0])}for(let Dt=0;Dt<vt;Dt++){let _t=Mt[Dt];Ut(_t[0]+ft*g,_t[1]+ft*g,_t[2]+ft*g)}}i.addGroup(Z,s.length/3-Z,0)}function bt(){let Z=s.length/3,Dt=0;Vt($,Dt),Dt+=$.length;for(let _t=0,Nt=W.length;_t<Nt;_t++){let wt=W[_t];Vt(wt,Dt),Dt+=wt.length}i.addGroup(Z,s.length/3-Z,1)}function Vt(Z,Dt){let _t=Z.length;for(;--_t>=0;){let Nt=_t,wt=_t-1;wt<0&&(wt=Z.length-1);for(let Ht=0,Xt=g+_*2;Ht<Xt;Ht++){let Pt=ft*Ht,ne=ft*(Ht+1),Y=Dt+Nt+Pt,N=Dt+wt+Pt,xt=Dt+wt+ne,St=Dt+Nt+ne;Gt(Y,N,xt,St)}}}function $t(Z,Dt,_t){p.push(Z),p.push(Dt),p.push(_t)}function Ut(Z,Dt,_t){Ct(Z),Ct(Dt),Ct(_t);let Nt=s.length/3,wt=T.generateTopUV(i,s,Nt-3,Nt-2,Nt-1);ee(wt[0]),ee(wt[1]),ee(wt[2])}function Gt(Z,Dt,_t,Nt){Ct(Z),Ct(Dt),Ct(Nt),Ct(Dt),Ct(_t),Ct(Nt);let wt=s.length/3,Ht=T.generateSideWallUV(i,s,wt-6,wt-3,wt-2,wt-1);ee(Ht[0]),ee(Ht[1]),ee(Ht[3]),ee(Ht[1]),ee(Ht[2]),ee(Ht[3])}function Ct(Z){s.push(p[Z*3+0]),s.push(p[Z*3+1]),s.push(p[Z*3+2])}function ee(Z){u.push(Z.x),u.push(Z.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,i=this.parameters.options;return pY(e,i,t)}static fromJSON(t,e){let i=[];for(let u=0,c=t.shapes.length;u<c;u++){let f=e[t.shapes[u]];i.push(f)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Nv[s.type]().fromJSON(s)),new n(i,t.options)}},hY={generateTopUV:function(n,t,e,i,s){let u=t[e*3],c=t[e*3+1],f=t[i*3],p=t[i*3+1],d=t[s*3],g=t[s*3+1];return[new Ot(u,c),new Ot(f,p),new Ot(d,g)]},generateSideWallUV:function(n,t,e,i,s,u){let c=t[e*3],f=t[e*3+1],p=t[e*3+2],d=t[i*3],g=t[i*3+1],y=t[i*3+2],v=t[s*3],E=t[s*3+1],M=t[s*3+2],A=t[u*3],_=t[u*3+1],x=t[u*3+2];return Math.abs(f-g)<Math.abs(c-d)?[new Ot(c,1-p),new Ot(d,1-y),new Ot(v,1-M),new Ot(A,1-x)]:[new Ot(f,1-p),new Ot(g,1-y),new Ot(E,1-M),new Ot(_,1-x)]}};function pY(n,t,e){if(e.shapes=[],Array.isArray(n))for(let i=0,s=n.length;i<s;i++){let u=n[i];e.shapes.push(u.uuid)}else e.shapes.push(n.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var od=class n extends ui{constructor(t=new Nl([new Ot(0,.5),new Ot(-.5,-.5),new Ot(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let i=[],s=[],u=[],c=[],f=0,p=0;if(Array.isArray(t)===!1)d(t);else for(let g=0;g<t.length;g++)d(t[g]),this.addGroup(f,p,g),f+=p,p=0;this.setIndex(i),this.setAttribute("position",new _r(s,3)),this.setAttribute("normal",new _r(u,3)),this.setAttribute("uv",new _r(c,2));function d(g){let y=s.length/3,v=g.extractPoints(e),E=v.shape,M=v.holes;ya.isClockWise(E)===!1&&(E=E.reverse());for(let _=0,x=M.length;_<x;_++){let T=M[_];ya.isClockWise(T)===!0&&(M[_]=T.reverse())}let A=ya.triangulateShape(E,M);for(let _=0,x=M.length;_<x;_++){let T=M[_];E=E.concat(T)}for(let _=0,x=E.length;_<x;_++){let T=E[_];s.push(T.x,T.y,0),u.push(0,0,1),c.push(T.x,T.y)}for(let _=0,x=A.length;_<x;_++){let T=A[_],w=T[0]+y,R=T[1]+y,B=T[2]+y;i.push(w,R,B),p+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return dY(e,t)}static fromJSON(t,e){let i=[];for(let s=0,u=t.shapes.length;s<u;s++){let c=e[t.shapes[s]];i.push(c)}return new n(i,t.curveSegments)}};function dY(n,t){if(t.shapes=[],Array.isArray(n))for(let e=0,i=n.length;e<i;e++){let s=n[e];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t}var sd=class extends ui{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){let e=[],i=new Set,s=new st,u=new st;if(t.index!==null){let c=t.attributes.position,f=t.index,p=t.groups;p.length===0&&(p=[{start:0,count:f.count,materialIndex:0}]);for(let d=0,g=p.length;d<g;++d){let y=p[d],v=y.start,E=y.count;for(let M=v,A=v+E;M<A;M+=3)for(let _=0;_<3;_++){let x=f.getX(M+_),T=f.getX(M+(_+1)%3);s.fromBufferAttribute(c,x),u.fromBufferAttribute(c,T),VI(s,u,i)===!0&&(e.push(s.x,s.y,s.z),e.push(u.x,u.y,u.z))}}}else{let c=t.attributes.position;for(let f=0,p=c.count/3;f<p;f++)for(let d=0;d<3;d++){let g=3*f+d,y=3*f+(d+1)%3;s.fromBufferAttribute(c,g),u.fromBufferAttribute(c,y),VI(s,u,i)===!0&&(e.push(s.x,s.y,s.z),e.push(u.x,u.y,u.z))}}this.setAttribute("position",new _r(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}};function VI(n,t,e){let i=`${n.x},${n.y},${n.z}-${t.x},${t.y},${t.z}`,s=`${t.x},${t.y},${t.z}-${n.x},${n.y},${n.z}`;return e.has(i)===!0||e.has(s)===!0?!1:(e.add(i),e.add(s),!0)}function Lp(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 gY(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Ol=class{constructor(t,e,i,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,i=this._cachedIndex,s=e[i],u=e[i-1];n:{t:{let c;e:{r:if(!(t<s)){for(let f=i+2;;){if(s===void 0){if(t<u)break r;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===f)break;if(u=s,s=e[++i],t<s)break t}c=e.length;break e}if(!(t>=u)){let f=e[1];t<f&&(i=2,u=f);for(let p=i-2;;){if(u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===p)break;if(s=u,u=e[--i-1],t>=u)break t}c=i,i=0;break e}break n}for(;i<c;){let f=i+c>>>1;t<e[f]?c=f:i=f+1}if(s=e[i],u=e[i-1],u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,u,s)}return this.interpolate_(i,u,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,i=this.sampleValues,s=this.valueSize,u=t*s;for(let c=0;c!==s;++c)e[c]=i[u+c];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Uv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:XC,endingEnd:XC}}intervalChanged_(t,e,i){let s=this.parameterPositions,u=t-2,c=t+1,f=s[u],p=s[c];if(f===void 0)switch(this.getSettings_().endingStart){case YC:u=t,f=2*e-i;break;case $C:u=s.length-2,f=e+s[u]-s[u+1];break;default:u=t,f=i}if(p===void 0)switch(this.getSettings_().endingEnd){case YC:c=t,p=2*i-e;break;case $C:c=1,p=i+s[1]-s[0];break;default:c=t-1,p=e}let d=(i-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-i),this._offsetPrev=u*g,this._offsetNext=c*g}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,y=this._offsetNext,v=this._weightPrev,E=this._weightNext,M=(i-e)/(s-e),A=M*M,_=A*M,x=-v*_+2*v*A-v*M,T=(1+v)*_+(-1.5-2*v)*A+(-.5+v)*M+1,w=(-1-E)*_+(1.5+E)*A+.5*M,R=E*_-E*A;for(let B=0;B!==f;++B)u[B]=x*c[g+B]+T*c[d+B]+w*c[p+B]+R*c[y+B];return u}},Bv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(i-e)/(s-e),y=1-g;for(let v=0;v!==f;++v)u[v]=c[d+v]*y+c[p+v]*g;return u}},zv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}},Do=class{constructor(t,e,i,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=Lp(e,this.TimeBufferType),this.values=Lp(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Lp(t.times,Array),values:Lp(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(i.interpolation=s)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new zv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Bv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Uv(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Op:e=this.InterpolantFactoryMethodDiscrete;break;case Dp:e=this.InterpolantFactoryMethodLinear;break;case xy:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Op;case this.InterpolantFactoryMethodLinear:return Dp;case this.InterpolantFactoryMethodSmooth:return xy}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]*=t}return this}trim(t,e){let i=this.times,s=i.length,u=0,c=s-1;for(;u!==s&&i[u]<t;)++u;for(;c!==-1&&i[c]>e;)--c;if(++c,u!==0||c!==s){u>=c&&(c=Math.max(c,1),u=c-1);let f=this.getValueSize();this.times=i.slice(u,c),this.values=this.values.slice(u*f,c*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 i=this.times,s=this.values,u=i.length;u===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let c=null;for(let f=0;f!==u;f++){let p=i[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(c!==null&&c>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,c),t=!1;break}c=p}if(s!==void 0&&gY(s))for(let f=0,p=s.length;f!==p;++f){let d=s[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(),i=this.getValueSize(),s=this.getInterpolation()===xy,u=t.length-1,c=1;for(let f=1;f<u;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(s)p=!0;else{let y=f*i,v=y-i,E=y+i;for(let M=0;M!==i;++M){let A=e[y+M];if(A!==e[v+M]||A!==e[E+M]){p=!0;break}}}if(p){if(f!==c){t[c]=t[f];let y=f*i,v=c*i;for(let E=0;E!==i;++E)e[v+E]=e[y+E]}++c}}if(u>0){t[c]=t[u];for(let f=u*i,p=c*i,d=0;d!==i;++d)e[p+d]=e[f+d];++c}return c!==t.length?(this.times=t.slice(0,c),this.values=e.slice(0,c*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=this.constructor,s=new i(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};Do.prototype.TimeBufferType=Float32Array;Do.prototype.ValueBufferType=Float32Array;Do.prototype.DefaultInterpolation=Dp;var hu=class extends Do{};hu.prototype.ValueTypeName="bool";hu.prototype.ValueBufferType=Array;hu.prototype.DefaultInterpolation=Op;hu.prototype.InterpolantFactoryMethodLinear=void 0;hu.prototype.InterpolantFactoryMethodSmooth=void 0;var Gv=class extends Do{};Gv.prototype.ValueTypeName="color";var kv=class extends Do{};kv.prototype.ValueTypeName="number";var qv=class extends Ol{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=(i-e)/(s-e),d=t*f;for(let g=d+f;d!==g;d+=4)lo.slerpFlat(u,0,c,d-f,c,d,p);return u}},vf=class extends Do{InterpolantFactoryMethodLinear(t){return new qv(this.times,this.values,this.getValueSize(),t)}};vf.prototype.ValueTypeName="quaternion";vf.prototype.DefaultInterpolation=Dp;vf.prototype.InterpolantFactoryMethodSmooth=void 0;var pu=class extends Do{};pu.prototype.ValueTypeName="string";pu.prototype.ValueBufferType=Array;pu.prototype.DefaultInterpolation=Op;pu.prototype.InterpolantFactoryMethodLinear=void 0;pu.prototype.InterpolantFactoryMethodSmooth=void 0;var Vv=class extends Do{};Vv.prototype.ValueTypeName="vector";var Hv=class{constructor(t,e,i){let s=this,u=!1,c=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(g){f++,u===!1&&s.onStart!==void 0&&s.onStart(g,c,f),u=!0},this.itemEnd=function(g){c++,s.onProgress!==void 0&&s.onProgress(g,c,f),c===f&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(g){s.onError!==void 0&&s.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,y){return d.push(g,y),this},this.removeHandler=function(g){let y=d.indexOf(g);return y!==-1&&d.splice(y,2),this},this.getHandler=function(g){for(let y=0,v=d.length;y<v;y+=2){let E=d[y],M=d[y+1];if(E.global&&(E.lastIndex=0),E.test(g))return M}return null}}},mY=new Hv,Wv=class{constructor(t){this.manager=t!==void 0?t:mY,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let i=this;return new Promise(function(s,u){i.load(t,s,e,u)})}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}};Wv.DEFAULT_MATERIAL_NAME="__DEFAULT";var ad=class extends ui{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}};var Kv="\\[\\]\\.:\\/",yY=new RegExp("["+Kv+"]","g"),Qv="[^"+Kv+"]",vY="[^"+Kv.replace("\\.","")+"]",_Y=/((?:WC+[\/:])*)/.source.replace("WC",Qv),xY=/(WCOD+)?/.source.replace("WCOD",vY),EY=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qv),SY=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qv),wY=new RegExp("^"+_Y+xY+EY+SY+"$"),MY=["material","materials","bones","map"],Xv=class{constructor(t,e,i){let s=i||Yn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(t,e)}setValue(t,e){let i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,u=i.length;s!==u;++s)i[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Yn=class n{constructor(t,e,i){this.path=e,this.parsedPath=i||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,i){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,i):new n(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(yY,"")}static parseTrackName(t){let e=wY.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let u=i.nodeName.substring(s+1);MY.indexOf(u)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=u)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(i!==void 0)return i}if(t.children){let i=function(u){for(let c=0;c<u.length;c++){let f=u[c];if(f.name===e||f.uuid===e)return f;let p=i(f.children);if(p)return p}return null},s=i(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 i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)t[e++]=i[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 i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[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,i=e.objectName,s=e.propertyName,u=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(i){let d=e.objectIndex;switch(i){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[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[i]}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 c=t[s];if(c===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+s+" 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(u!==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[u]!==void 0&&(u=t.morphTargetDictionary[u])}p=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=u}else c.fromArray!==void 0&&c.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=c):Array.isArray(c)?(p=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=s;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}};Yn.Composite=Xv;Yn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Yn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Yn.prototype.GetterByBindingType=[Yn.prototype._getValue_direct,Yn.prototype._getValue_array,Yn.prototype._getValue_arrayElement,Yn.prototype._getValue_toArray];Yn.prototype.SetterByBindingTypeAndVersioning=[[Yn.prototype._setValue_direct,Yn.prototype._setValue_direct_setNeedsUpdate,Yn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Yn.prototype._setValue_array,Yn.prototype._setValue_array_setNeedsUpdate,Yn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Yn.prototype._setValue_arrayElement,Yn.prototype._setValue_arrayElement_setNeedsUpdate,Yn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Yn.prototype._setValue_fromArray,Yn.prototype._setValue_fromArray_setNeedsUpdate,Yn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Mot=new Float32Array(1);var _f=class extends pf{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Yv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Yv);function hd(n,t){t===void 0&&(t=[]);let e=new Nl(n.map(i=>new Ot(...i)));return t.length&&t.forEach(i=>{var s=new Ll(i.map(u=>new Ot(...u)));e.holes.push(s)}),e}var MAt=Jt(Yu(),1);var Ur=63710088e-1,kot={centimeters:Ur*100,centimetres:Ur*100,degrees:Ur/111325,feet:Ur*3.28084,inches:Ur*39.37,kilometers:Ur/1e3,kilometres:Ur/1e3,meters:Ur,metres:Ur,miles:Ur/1609.344,millimeters:Ur*1e3,millimetres:Ur*1e3,nauticalmiles:Ur/1852,radians:1,yards:Ur*1.0936},qot={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/Ur,yards:1.0936133};function Ai(n,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}function Dn(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(!ns(n[0])||!ns(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return Ai(i,t,e)}function Un(n,t,e){e===void 0&&(e={});for(var i=0,s=n;i<s.length;i++){var u=s[i];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var c=0;c<u[u.length-1].length;c++)if(u[u.length-1][c]!==u[0][c])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:n};return Ai(f,t,e)}function Br(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 i={type:"LineString",coordinates:n};return Ai(i,t,e)}function u_(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return Ai(i,t,e)}function ns(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Sr(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,g=0,y=0,v,E=n.type,M=E==="FeatureCollection",A=E==="Feature",_=M?n.features.length:1,x=0;x<_;x++){d=M?n.features[x].geometry:A?n.geometry:n,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var T=0;T<f;T++){var w=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var B=c.type;switch(g=e&&(B==="Polygon"||B==="MultiPolygon")?1:0,B){case null:break;case"Point":if(t(p,y,x,w,R)===!1)return!1;y++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,w,R)===!1)return!1;y++,B==="MultiPoint"&&w++}B==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-g;s++){if(t(p[i][s],y,x,w,R)===!1)return!1;y++}B==="MultiLineString"&&w++,B==="Polygon"&&R++}B==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<p.length;i++){for(R=0,s=0;s<p[i].length;s++){for(u=0;u<p[i][s].length-g;u++){if(t(p[i][s][u],y,x,w,R)===!1)return!1;y++}R++}w++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(Sr(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TP(n,t,e,i){var s=e;return Sr(n,function(u,c,f,p,d){c===0&&e===void 0?s=u:s=t(s,u,c,f,p,d)},i),s}function Ea(n,t){var e,i,s,u,c,f,p,d,g,y,v=0,E=n.type==="FeatureCollection",M=n.type==="Feature",A=E?n.features.length:1;for(e=0;e<A;e++){for(f=E?n.features[e].geometry:M?n.geometry:n,d=E?n.features[e].properties:M?n.properties:{},g=E?n.features[e].bbox:M?n.bbox:void 0,y=E?n.features[e].id:M?n.id:void 0,p=f?f.type==="GeometryCollection":!1,c=p?f.geometries.length:1,s=0;s<c;s++){if(u=p?f.geometries[s]:f,u===null){if(t(null,v,d,g,y)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,v,d,g,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,g,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Ji(n,t){Ea(n,function(e,i,s,u,c){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Ai(e,s,{bbox:u,id:c}),i,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],y={type:p,coordinates:g};if(t(Ai(y,s),i,d)===!1)return!1}})}function l_(n){var t=[1/0,1/0,-1/0,-1/0];return Sr(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}l_.default=l_;var li=l_;function $r(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 c_(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 Zr(n){return n.type==="Feature"?n.geometry:n}var i$=Jt(md(),1);var d$=Jt(WP(),1);function zr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var i=$r(n),s=Zr(t),u=s.type,c=t.bbox,f=s.coordinates;if(c&&g$(i,c)===!1)return!1;u==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(XP(i,f[d][0],e.ignoreBoundary)){for(var g=!1,y=1;y<f[d].length&&!g;)XP(i,f[d][y],!e.ignoreBoundary)&&(g=!0),y++;g||(p=!0)}return p}function XP(n,t,e){var i=!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,u=t.length-1;s<t.length;u=s++){var c=t[s][0],f=t[s][1],p=t[u][0],d=t[u][1],g=n[1]*(c-p)+f*(p-n[0])+d*(n[0]-c)===0&&(c-n[0])*(p-n[0])<=0&&(f-n[1])*(d-n[1])<=0;if(g)return!e;var y=f>n[1]!=d>n[1]&&n[0]<(p-c)*(n[1]-f)/(d-f)+c;y&&(i=!i)}return i}function g$(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var ZP=new ArrayBuffer(16),yat=new Float64Array(ZP),vat=new Uint32Array(ZP);var P$=Jt(A_(),1);var Hut=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 i=this.points[e],s=this.points[e+1];this.centers.push({x:(i.x+s.x)/2,y:(i.y+s.y)/2,z:(i.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var u=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,c=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+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+c),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+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+c),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 n.prototype.cacheSteps=function(t){var e=[],i=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var u=this.pos(s),c=Math.sqrt((u.x-i.x)*(u.x-i.x)+(u.y-i.y)*(u.y-i.y)+(u.z-i.z)*(u.z-i.z));c>t&&(e.push(s),i=u)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),i=this.pos(t-10);return{angle:180*Math.atan2(e.y-i.y,e.x-i.x)/3.14,speed:Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)+(i.z-e.z)*(i.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 i=e/this.duration;if(i>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*i),u=(this.length-1)*i-s;return R$(u,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function R$(n,t,e,i,s){var u=L$(n),c={x:s.x*u[0]+i.x*u[1]+e.x*u[2]+t.x*u[3],y:s.y*u[0]+i.y*u[1]+e.y*u[2]+t.y*u[3],z:s.z*u[0]+i.z*u[1]+e.z*u[2]+t.z*u[3]};return c}function L$(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 wf(n,t){t===void 0&&(t={});var e=Number(n[0]),i=Number(n[1]),s=Number(n[2]),u=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var c=[e,i],f=[e,u],p=[s,u],d=[s,i];return Un([[c,d,p,f,c]],t.properties,{bbox:n,id:t.id})}function N$(n){return wf(li(n))}var T_=N$;function O$(n,t){t===void 0&&(t={});var e=li(n),i=(e[0]+e[2])/2,s=(e[1]+e[3])/2;return Dn([i,s],t.properties,t)}var du=O$;var j$=Jt(sR(),1);var MZ=Jt(Nd(),1);var AZ=Jt(md(),1);var IZ=Jt(A_(),1);var MR=Math.PI/180,bR=180/Math.PI,Pf=function(n,t){this.lon=n,this.lat=t,this.x=MR*n,this.y=MR*t};Pf.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Pf.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Pf(t,n)};var AR=function(){this.coords=[],this.length=0};AR.prototype.move_to=function(n){this.length++,this.coords.push(n)};var Y_=function(n){this.properties=n||{},this.geometries=[]};Y_.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}};Y_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(u){t+=u[0]+" "+u[1]+","},i=0;i<this.geometries.length;i++){if(this.geometries[i].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[i].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var TR=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 Pf(n.x,n.y),this.end=new Pf(t.x,t.y),this.properties=e||{};var i=this.start.x-this.end.x,s=this.start.y-this.end.y,u=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(i/2),2);if(this.g=2*Math.asin(Math.sqrt(u)),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)};TR.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),i=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),u=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),c=bR*Math.atan2(u,Math.sqrt(Math.pow(i,2)+Math.pow(s,2))),f=bR*Math.atan2(s,i);return[f,c]};TR.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 i=1/(n-1),s=0;s<n;++s){var u=i*s,c=this.interpolate(u);e.push(c)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,y=-180+d,v=360-d,E=1;E<e.length;++E){var M=e[E-1][0],A=e[E][0],_=Math.abs(A-M);_>v&&(A>g&&M<y||M>g&&A<y)?f=!0:_>p&&(p=_)}var x=[];if(f&&p<d){var T=[];x.push(T);for(var w=0;w<e.length;++w){var R=parseFloat(e[w][0]);if(w>0&&Math.abs(R-e[w-1][0])>v){var B=parseFloat(e[w-1][0]),U=parseFloat(e[w-1][1]),D=parseFloat(e[w][0]),P=parseFloat(e[w][1]);if(B>-180&&B<y&&D===180&&w+1<e.length&&e[w-1][0]>-180&&e[w-1][0]<y){T.push([-180,e[w][1]]),w++,T.push([e[w][0],e[w][1]]);continue}else if(B>g&&B<180&&D===-180&&w+1<e.length&&e[w-1][0]>g&&e[w-1][0]<180){T.push([180,e[w][1]]),w++,T.push([e[w][0],e[w][1]]);continue}if(B<y&&D>g){var ct=B;B=D,D=ct;var L=U;U=P,P=L}if(B>g&&D<y&&(D+=360),B<=180&&D>=180&&B<D){var W=(180-B)/(D-B),V=W*P+(1-W)*U;T.push([e[w-1][0]>g?180:-180,V]),T=[],T.push([e[w-1][0]>g?-180:180,V]),x.push(T)}else T=[],x.push(T);T.push([R,e[w][1]])}else T.push([e[w][0],e[w][1]])}}else{var Mt=[];x.push(Mt);for(var $=0;$<e.length;++$)Mt.push([e[$][0],e[$][1]])}for(var gt=new Y_(this.properties),ft=0;ft<x.length;++ft){var vt=new AR;gt.geometries.push(vt);for(var it=x[ft],lt=0;lt<it.length;++lt)vt.move_to(it[lt])}return gt};var LZ=Jt(Nd(),1);var Rj=Jt(Nd(),1);var Lj=Jt(Ex(),1);var Dj=Jt(md(),1);var Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[],$e=[],Ze=[],Je=[],je=[];Oe[85]=Ue[85]=-1;De[85]=Be[85]=0;Fe[85]=ze[85]=1;Xe[85]=Ze[85]=1;Ye[85]=Je[85]=0;$e[85]=je[85]=1;Ce[85]=Re[85]=0;Ie[85]=Le[85]=-1;Pe[85]=qe[85]=0;Ve[85]=Ge[85]=0;He[85]=ke[85]=1;Ne[85]=We[85]=1;Ze[1]=Ze[169]=0;Je[1]=Je[169]=-1;je[1]=je[169]=0;Ge[1]=Ge[169]=-1;ke[1]=ke[169]=0;qe[1]=qe[169]=0;Ue[4]=Ue[166]=0;Be[4]=Be[166]=-1;ze[4]=ze[166]=1;Ve[4]=Ve[166]=1;He[4]=He[166]=0;We[4]=We[166]=0;Oe[16]=Oe[154]=0;De[16]=De[154]=1;Fe[16]=Fe[154]=1;Re[16]=Re[154]=1;Le[16]=Le[154]=0;Ne[16]=Ne[154]=1;Xe[64]=Xe[106]=0;Ye[64]=Ye[106]=1;$e[64]=$e[106]=0;Ce[64]=Ce[106]=-1;Ie[64]=Ie[106]=0;Pe[64]=Pe[106]=1;Xe[2]=Xe[168]=0;Ye[2]=Ye[168]=-1;$e[2]=$e[168]=1;Ze[2]=Ze[168]=0;Je[2]=Je[168]=-1;je[2]=je[168]=0;Ge[2]=Ge[168]=-1;ke[2]=ke[168]=0;qe[2]=qe[168]=0;Ve[2]=Ve[168]=-1;He[2]=He[168]=0;We[2]=We[168]=1;Oe[8]=Oe[162]=0;De[8]=De[162]=-1;Fe[8]=Fe[162]=0;Ue[8]=Ue[162]=0;Be[8]=Be[162]=-1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=1;ke[8]=ke[162]=0;qe[8]=qe[162]=1;Ve[8]=Ve[162]=1;He[8]=He[162]=0;We[8]=We[162]=0;Oe[32]=Oe[138]=0;De[32]=De[138]=1;Fe[32]=Fe[138]=1;Ue[32]=Ue[138]=0;Be[32]=Be[138]=1;ze[32]=ze[138]=0;Ce[32]=Ce[138]=1;Ie[32]=Ie[138]=0;Pe[32]=Pe[138]=0;Re[32]=Re[138]=1;Le[32]=Le[138]=0;Ne[32]=Ne[138]=1;Ze[128]=Ze[42]=0;Je[128]=Je[42]=1;je[128]=je[42]=1;Xe[128]=Xe[42]=0;Ye[128]=Ye[42]=1;$e[128]=$e[42]=0;Ce[128]=Ce[42]=-1;Ie[128]=Ie[42]=0;Pe[128]=Pe[42]=1;Re[128]=Re[42]=-1;Le[128]=Le[42]=0;Ne[128]=Ne[42]=0;Ue[5]=Ue[165]=-1;Be[5]=Be[165]=0;ze[5]=ze[165]=0;Ze[5]=Ze[165]=1;Je[5]=Je[165]=0;je[5]=je[165]=0;Ve[20]=Ve[150]=0;He[20]=He[150]=1;We[20]=We[150]=1;Re[20]=Re[150]=0;Le[20]=Le[150]=-1;Ne[20]=Ne[150]=1;Oe[80]=Oe[90]=-1;De[80]=De[90]=0;Fe[80]=Fe[90]=1;Xe[80]=Xe[90]=1;Ye[80]=Ye[90]=0;$e[80]=$e[90]=1;Ge[65]=Ge[105]=0;ke[65]=ke[105]=1;qe[65]=qe[105]=0;Ce[65]=Ce[105]=0;Ie[65]=Ie[105]=-1;Pe[65]=Pe[105]=0;Oe[160]=Oe[10]=-1;De[160]=De[10]=0;Fe[160]=Fe[10]=1;Ue[160]=Ue[10]=-1;Be[160]=Be[10]=0;ze[160]=ze[10]=0;Ze[160]=Ze[10]=1;Je[160]=Je[10]=0;je[160]=je[10]=0;Xe[160]=Xe[10]=1;Ye[160]=Ye[10]=0;$e[160]=$e[10]=1;Ve[130]=Ve[40]=0;He[130]=He[40]=1;We[130]=We[40]=1;Ge[130]=Ge[40]=0;ke[130]=ke[40]=1;qe[130]=qe[40]=0;Ce[130]=Ce[40]=0;Ie[130]=Ie[40]=-1;Pe[130]=Pe[40]=0;Re[130]=Re[40]=0;Le[130]=Le[40]=-1;Ne[130]=Ne[40]=1;Ue[37]=Ue[133]=0;Be[37]=Be[133]=1;ze[37]=ze[133]=1;Ze[37]=Ze[133]=0;Je[37]=Je[133]=1;je[37]=je[133]=0;Ce[37]=Ce[133]=-1;Ie[37]=Ie[133]=0;Pe[37]=Pe[133]=0;Re[37]=Re[133]=1;Le[37]=Le[133]=0;Ne[37]=Ne[133]=0;Ve[148]=Ve[22]=-1;He[148]=He[22]=0;We[148]=We[22]=0;Ze[148]=Ze[22]=0;Je[148]=Je[22]=-1;je[148]=je[22]=1;Xe[148]=Xe[22]=0;Ye[148]=Ye[22]=1;$e[148]=$e[22]=1;Re[148]=Re[22]=-1;Le[148]=Le[22]=0;Ne[148]=Ne[22]=1;Oe[82]=Oe[88]=0;De[82]=De[88]=-1;Fe[82]=Fe[88]=1;Ve[82]=Ve[88]=1;He[82]=He[88]=0;We[82]=We[88]=1;Ge[82]=Ge[88]=-1;ke[82]=ke[88]=0;qe[82]=qe[88]=1;Xe[82]=Xe[88]=0;Ye[82]=Ye[88]=-1;$e[82]=$e[88]=0;Oe[73]=Oe[97]=0;De[73]=De[97]=1;Fe[73]=Fe[97]=0;Ue[73]=Ue[97]=0;Be[73]=Be[97]=-1;ze[73]=ze[97]=0;Ge[73]=Ge[97]=1;ke[73]=ke[97]=0;qe[73]=qe[97]=0;Ce[73]=Ce[97]=1;Ie[73]=Ie[97]=0;Pe[73]=Pe[97]=1;Oe[145]=Oe[25]=0;De[145]=De[25]=-1;Fe[145]=Fe[25]=0;Ge[145]=Ge[25]=1;ke[145]=ke[25]=0;qe[145]=qe[25]=1;Ze[145]=Ze[25]=0;Je[145]=Je[25]=1;je[145]=je[25]=1;Re[145]=Re[25]=-1;Le[145]=Le[25]=0;Ne[145]=Ne[25]=0;Ue[70]=Ue[100]=0;Be[70]=Be[100]=1;ze[70]=ze[100]=0;Ve[70]=Ve[100]=-1;He[70]=He[100]=0;We[70]=We[100]=1;Xe[70]=Xe[100]=0;Ye[70]=Ye[100]=-1;$e[70]=$e[100]=1;Ce[70]=Ce[100]=1;Ie[70]=Ie[100]=0;Pe[70]=Pe[100]=0;Ue[101]=Ue[69]=0;Be[101]=Be[69]=1;ze[101]=ze[69]=0;Ce[101]=Ce[69]=1;Ie[101]=Ie[69]=0;Pe[101]=Pe[69]=0;Ze[149]=Ze[21]=0;Je[149]=Je[21]=1;je[149]=je[21]=1;Re[149]=Re[21]=-1;Le[149]=Le[21]=0;Ne[149]=Ne[21]=0;Ve[86]=Ve[84]=-1;He[86]=He[84]=0;We[86]=We[84]=1;Xe[86]=Xe[84]=0;Ye[86]=Ye[84]=-1;$e[86]=$e[84]=1;Oe[89]=Oe[81]=0;De[89]=De[81]=-1;Fe[89]=Fe[81]=0;Ge[89]=Ge[81]=1;ke[89]=ke[81]=0;qe[89]=qe[81]=1;Oe[96]=Oe[74]=0;De[96]=De[74]=1;Fe[96]=Fe[74]=0;Ue[96]=Ue[74]=-1;Be[96]=Be[74]=0;ze[96]=ze[74]=1;Xe[96]=Xe[74]=1;Ye[96]=Ye[74]=0;$e[96]=$e[74]=0;Ce[96]=Ce[74]=1;Ie[96]=Ie[74]=0;Pe[96]=Pe[74]=1;Oe[24]=Oe[146]=0;De[24]=De[146]=-1;Fe[24]=Fe[146]=1;Ve[24]=Ve[146]=1;He[24]=He[146]=0;We[24]=We[146]=1;Ge[24]=Ge[146]=0;ke[24]=ke[146]=1;qe[24]=qe[146]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=-1;Ne[24]=Ne[146]=0;Ue[6]=Ue[164]=-1;Be[6]=Be[164]=0;ze[6]=ze[164]=1;Ve[6]=Ve[164]=-1;He[6]=He[164]=0;We[6]=We[164]=0;Ze[6]=Ze[164]=0;Je[6]=Je[164]=-1;je[6]=je[164]=1;Xe[6]=Xe[164]=1;Ye[6]=Ye[164]=0;$e[6]=$e[164]=0;Ge[129]=Ge[41]=0;ke[129]=ke[41]=1;qe[129]=qe[41]=1;Ze[129]=Ze[41]=0;Je[129]=Je[41]=1;je[129]=je[41]=0;Ce[129]=Ce[41]=-1;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=0;Re[129]=Re[41]=0;Le[129]=Le[41]=-1;Ne[129]=Ne[41]=0;Ve[66]=Ve[104]=0;He[66]=He[104]=1;We[66]=We[104]=0;Ge[66]=Ge[104]=-1;ke[66]=ke[104]=0;qe[66]=qe[104]=1;Xe[66]=Xe[104]=0;Ye[66]=Ye[104]=-1;$e[66]=$e[104]=0;Ce[66]=Ce[104]=0;Ie[66]=Ie[104]=-1;Pe[66]=Pe[104]=1;Oe[144]=Oe[26]=-1;De[144]=De[26]=0;Fe[144]=Fe[26]=0;Ze[144]=Ze[26]=1;Je[144]=Je[26]=0;je[144]=je[26]=1;Xe[144]=Xe[26]=0;Ye[144]=Ye[26]=1;$e[144]=$e[26]=1;Re[144]=Re[26]=-1;Le[144]=Le[26]=0;Ne[144]=Ne[26]=1;Ue[36]=Ue[134]=0;Be[36]=Be[134]=1;ze[36]=ze[134]=1;Ve[36]=Ve[134]=0;He[36]=He[134]=1;We[36]=We[134]=0;Ce[36]=Ce[134]=0;Ie[36]=Ie[134]=-1;Pe[36]=Pe[134]=1;Re[36]=Re[134]=1;Le[36]=Le[134]=0;Ne[36]=Ne[134]=0;Oe[9]=Oe[161]=-1;De[9]=De[161]=0;Fe[9]=Fe[161]=0;Ue[9]=Ue[161]=0;Be[9]=Be[161]=-1;ze[9]=ze[161]=0;Ge[9]=Ge[161]=1;ke[9]=ke[161]=0;qe[9]=qe[161]=0;Ze[9]=Ze[161]=1;Je[9]=Je[161]=0;je[9]=je[161]=1;Oe[136]=0;De[136]=1;Fe[136]=1;Ue[136]=0;Be[136]=1;ze[136]=0;Ve[136]=-1;He[136]=0;We[136]=1;Ge[136]=-1;ke[136]=0;qe[136]=0;Ze[136]=0;Je[136]=-1;je[136]=0;Xe[136]=0;Ye[136]=-1;$e[136]=1;Ce[136]=1;Ie[136]=0;Pe[136]=0;Re[136]=1;Le[136]=0;Ne[136]=1;Oe[34]=0;De[34]=-1;Fe[34]=0;Ue[34]=0;Be[34]=-1;ze[34]=1;Ve[34]=1;He[34]=0;We[34]=0;Ge[34]=1;ke[34]=0;qe[34]=1;Ze[34]=0;Je[34]=1;je[34]=1;Xe[34]=0;Ye[34]=1;$e[34]=0;Ce[34]=-1;Ie[34]=0;Pe[34]=1;Re[34]=-1;Le[34]=0;Ne[34]=0;Oe[35]=0;De[35]=1;Fe[35]=1;Ue[35]=0;Be[35]=-1;ze[35]=1;Ve[35]=1;He[35]=0;We[35]=0;Ge[35]=-1;ke[35]=0;qe[35]=0;Ze[35]=0;Je[35]=-1;je[35]=0;Xe[35]=0;Ye[35]=1;$e[35]=0;Ce[35]=-1;Ie[35]=0;Pe[35]=1;Re[35]=1;Le[35]=0;Ne[35]=1;Oe[153]=0;De[153]=1;Fe[153]=1;Ge[153]=-1;ke[153]=0;qe[153]=0;Ze[153]=0;Je[153]=-1;je[153]=0;Re[153]=1;Le[153]=0;Ne[153]=1;Ue[102]=0;Be[102]=-1;ze[102]=1;Ve[102]=1;He[102]=0;We[102]=0;Xe[102]=0;Ye[102]=1;$e[102]=0;Ce[102]=-1;Ie[102]=0;Pe[102]=1;Oe[155]=0;De[155]=-1;Fe[155]=0;Ge[155]=1;ke[155]=0;qe[155]=1;Ze[155]=0;Je[155]=1;je[155]=1;Re[155]=-1;Le[155]=0;Ne[155]=0;Ue[103]=0;Be[103]=1;ze[103]=0;Ve[103]=-1;He[103]=0;We[103]=1;Xe[103]=0;Ye[103]=-1;$e[103]=1;Ce[103]=1;Ie[103]=0;Pe[103]=0;Oe[152]=0;De[152]=1;Fe[152]=1;Ve[152]=-1;He[152]=0;We[152]=1;Ge[152]=-1;ke[152]=0;qe[152]=0;Ze[152]=0;Je[152]=-1;je[152]=0;Xe[152]=0;Ye[152]=-1;$e[152]=1;Re[152]=1;Le[152]=0;Ne[152]=1;Oe[156]=0;De[156]=-1;Fe[156]=1;Ve[156]=1;He[156]=0;We[156]=1;Ge[156]=-1;ke[156]=0;qe[156]=0;Ze[156]=0;Je[156]=-1;je[156]=0;Xe[156]=0;Ye[156]=1;$e[156]=1;Re[156]=-1;Le[156]=0;Ne[156]=1;Oe[137]=0;De[137]=1;Fe[137]=1;Ue[137]=0;Be[137]=1;ze[137]=0;Ge[137]=-1;ke[137]=0;qe[137]=0;Ze[137]=0;Je[137]=-1;je[137]=0;Ce[137]=1;Ie[137]=0;Pe[137]=0;Re[137]=1;Le[137]=0;Ne[137]=1;Oe[139]=0;De[139]=1;Fe[139]=1;Ue[139]=0;Be[139]=-1;ze[139]=0;Ge[139]=1;ke[139]=0;qe[139]=0;Ze[139]=0;Je[139]=1;je[139]=0;Ce[139]=-1;Ie[139]=0;Pe[139]=0;Re[139]=1;Le[139]=0;Ne[139]=1;Oe[98]=0;De[98]=-1;Fe[98]=0;Ue[98]=0;Be[98]=-1;ze[98]=1;Ve[98]=1;He[98]=0;We[98]=0;Ge[98]=1;ke[98]=0;qe[98]=1;Xe[98]=0;Ye[98]=1;$e[98]=0;Ce[98]=-1;Ie[98]=0;Pe[98]=1;Oe[99]=0;De[99]=1;Fe[99]=0;Ue[99]=0;Be[99]=-1;ze[99]=1;Ve[99]=1;He[99]=0;We[99]=0;Ge[99]=-1;ke[99]=0;qe[99]=1;Xe[99]=0;Ye[99]=-1;$e[99]=0;Ce[99]=1;Ie[99]=0;Pe[99]=1;Ue[38]=0;Be[38]=-1;ze[38]=1;Ve[38]=1;He[38]=0;We[38]=0;Ze[38]=0;Je[38]=1;je[38]=1;Xe[38]=0;Ye[38]=1;$e[38]=0;Ce[38]=-1;Ie[38]=0;Pe[38]=1;Re[38]=-1;Le[38]=0;Ne[38]=0;Ue[39]=0;Be[39]=1;ze[39]=1;Ve[39]=-1;He[39]=0;We[39]=0;Ze[39]=0;Je[39]=-1;je[39]=1;Xe[39]=0;Ye[39]=1;$e[39]=0;Ce[39]=-1;Ie[39]=0;Pe[39]=1;Re[39]=1;Le[39]=0;Ne[39]=0;var Sx=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},wx=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},Mx=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},bx=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},Ax=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},Tx=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},Cx=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},Ix=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Fj=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},Uj=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},Bj=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},zj=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},Gj=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},kj=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},qj=function(){return[[0,0],[0,1],[1,1],[1,0]]},Vj=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},Hj=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},Wj=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},Xj=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},Yj=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},$j=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},Zj=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},Jj=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},jj=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},Kj=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},Qj=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},tK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},eK=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},nK=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},rK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},iK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},oK=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},sK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},aK=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]]},uK=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},lK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},cK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},fK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},hK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},pK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},en=[],nn=[],rn=[],on=[],sn=[],an=[],un=[],ln=[];on[1]=sn[1]=18;on[169]=sn[169]=18;rn[4]=nn[4]=12;rn[166]=nn[166]=12;en[16]=ln[16]=4;en[154]=ln[154]=4;an[64]=un[64]=22;an[106]=un[106]=22;rn[2]=an[2]=17;on[2]=sn[2]=18;rn[168]=an[168]=17;on[168]=sn[168]=18;en[8]=on[8]=9;nn[8]=rn[8]=12;en[162]=on[162]=9;nn[162]=rn[162]=12;en[32]=ln[32]=4;nn[32]=un[32]=1;en[138]=ln[138]=4;nn[138]=un[138]=1;sn[128]=ln[128]=21;an[128]=un[128]=22;sn[42]=ln[42]=21;an[42]=un[42]=22;nn[5]=sn[5]=14;nn[165]=sn[165]=14;rn[20]=ln[20]=6;rn[150]=ln[150]=6;en[80]=an[80]=11;en[90]=an[90]=11;on[65]=un[65]=3;on[105]=un[105]=3;en[160]=an[160]=11;nn[160]=sn[160]=14;en[10]=an[10]=11;nn[10]=sn[10]=14;rn[130]=ln[130]=6;on[130]=un[130]=3;rn[40]=ln[40]=6;on[40]=un[40]=3;nn[101]=un[101]=1;nn[69]=un[69]=1;sn[149]=ln[149]=21;sn[21]=ln[21]=21;rn[86]=an[86]=17;rn[84]=an[84]=17;en[89]=on[89]=9;en[81]=on[81]=9;en[96]=un[96]=0;nn[96]=an[96]=15;en[74]=un[74]=0;nn[74]=an[74]=15;en[24]=rn[24]=8;on[24]=ln[24]=7;en[146]=rn[146]=8;on[146]=ln[146]=7;nn[6]=an[6]=15;rn[6]=sn[6]=16;nn[164]=an[164]=15;rn[164]=sn[164]=16;on[129]=ln[129]=7;sn[129]=un[129]=20;on[41]=ln[41]=7;sn[41]=un[41]=20;rn[66]=un[66]=2;on[66]=an[66]=19;rn[104]=un[104]=2;on[104]=an[104]=19;en[144]=sn[144]=10;an[144]=ln[144]=23;en[26]=sn[26]=10;an[26]=ln[26]=23;nn[36]=ln[36]=5;rn[36]=un[36]=2;nn[134]=ln[134]=5;rn[134]=un[134]=2;en[9]=sn[9]=10;nn[9]=on[9]=13;en[161]=sn[161]=10;nn[161]=on[161]=13;nn[37]=ln[37]=5;sn[37]=un[37]=20;nn[133]=ln[133]=5;sn[133]=un[133]=20;rn[148]=sn[148]=16;an[148]=ln[148]=23;rn[22]=sn[22]=16;an[22]=ln[22]=23;en[82]=rn[82]=8;on[82]=an[82]=19;en[88]=rn[88]=8;on[88]=an[88]=19;en[73]=un[73]=0;nn[73]=on[73]=13;en[97]=un[97]=0;nn[97]=on[97]=13;en[145]=on[145]=9;sn[145]=ln[145]=21;en[25]=on[25]=9;sn[25]=ln[25]=21;nn[70]=un[70]=1;rn[70]=an[70]=17;nn[100]=un[100]=1;rn[100]=an[100]=17;en[34]=on[34]=9;nn[34]=rn[34]=12;sn[34]=ln[34]=21;an[34]=un[34]=22;en[136]=ln[136]=4;nn[136]=un[136]=1;rn[136]=an[136]=17;on[136]=sn[136]=18;en[35]=ln[35]=4;nn[35]=rn[35]=12;on[35]=sn[35]=18;an[35]=un[35]=22;en[153]=ln[153]=4;on[153]=sn[153]=18;nn[102]=rn[102]=12;an[102]=un[102]=22;en[155]=on[155]=9;sn[155]=ln[155]=23;nn[103]=un[103]=1;rn[103]=an[103]=17;en[152]=ln[152]=4;rn[152]=an[152]=17;on[152]=sn[152]=18;en[156]=rn[156]=8;on[156]=sn[156]=18;an[156]=ln[156]=23;en[137]=ln[137]=4;nn[137]=un[137]=1;on[137]=sn[137]=18;en[139]=ln[139]=4;nn[139]=on[139]=13;sn[139]=un[139]=20;en[98]=on[98]=9;nn[98]=rn[98]=12;an[98]=un[98]=22;en[99]=un[99]=0;nn[99]=rn[99]=12;on[99]=an[99]=19;nn[38]=rn[38]=12;sn[38]=ln[38]=21;an[38]=un[38]=22;nn[39]=ln[39]=5;rn[39]=sn[39]=16;an[39]=un[39]=22;var Yt=[];Yt[1]=Yt[169]=Sx;Yt[4]=Yt[166]=wx;Yt[16]=Yt[154]=Mx;Yt[64]=Yt[106]=bx;Yt[168]=Yt[2]=Ax;Yt[162]=Yt[8]=Tx;Yt[138]=Yt[32]=Cx;Yt[42]=Yt[128]=Ix;Yt[5]=Yt[165]=Fj;Yt[20]=Yt[150]=Uj;Yt[80]=Yt[90]=Bj;Yt[65]=Yt[105]=zj;Yt[160]=Yt[10]=Gj;Yt[130]=Yt[40]=kj;Yt[85]=qj;Yt[101]=Yt[69]=Vj;Yt[149]=Yt[21]=Hj;Yt[86]=Yt[84]=Wj;Yt[89]=Yt[81]=Xj;Yt[96]=Yt[74]=Yj;Yt[24]=Yt[146]=$j;Yt[6]=Yt[164]=Zj;Yt[129]=Yt[41]=Jj;Yt[66]=Yt[104]=jj;Yt[144]=Yt[26]=Kj;Yt[36]=Yt[134]=Qj;Yt[9]=Yt[161]=tK;Yt[37]=Yt[133]=eK;Yt[148]=Yt[22]=nK;Yt[82]=Yt[88]=rK;Yt[73]=Yt[97]=iK;Yt[145]=Yt[25]=oK;Yt[70]=Yt[100]=sK;Yt[34]=function(n){return[Ix(n),Tx(n)]};Yt[35]=aK;Yt[136]=function(n){return[Cx(n),Ax(n)]};Yt[153]=function(n){return[Mx(n),Sx(n)]};Yt[102]=function(n){return[wx(n),bx(n)]};Yt[155]=uK;Yt[103]=lK;Yt[152]=function(n){return[Mx(n),Ax(n)]};Yt[156]=cK;Yt[137]=function(n){return[Cx(n),Sx(n)]};Yt[139]=fK;Yt[98]=function(n){return[Tx(n),bx(n)]};Yt[99]=hK;Yt[38]=function(n){return[wx(n),Ix(n)]};Yt[39]=pK;function gK(n){return(n>0)-(n<0)||+n}function Ql(n,t,e){var i=t[0]-n[0],s=t[1]-n[1],u=e[0]-t[0],c=e[1]-t[1];return gK(i*c-u*s)}function d2(n,t){var e=n.geometry.coordinates[0].map(function(c){return c[0]}),i=n.geometry.coordinates[0].map(function(c){return c[1]}),s=t.geometry.coordinates[0].map(function(c){return c[0]}),u=t.geometry.coordinates[0].map(function(c){return c[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,i)===Math.max.apply(null,u)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,i)===Math.min.apply(null,u)}function Px(n,t){return t.geometry.coordinates[0].every(function(e){return zr(Dn(e),n)})}function g2(n,t){return n[0]===t[0]&&n[1]===t[1]}var mK=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,i){var s=e.to,u=i.to;if(s.coordinates[0]-t.coordinates[0]>=0&&u.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&u.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&u.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||u.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-u.coordinates[1]:u.coordinates[1]-s.coordinates[1];var c=Ql(t.coordinates,s.coordinates,u.coordinates);if(c<0)return 1;if(c>0)return-1;var f=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),p=Math.pow(u.coordinates[0]-t.coordinates[0],2)+Math.pow(u.coordinates[1]-t.coordinates[1],2);return f-p}),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}(),Rx=mK;var yK=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 Br([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return Ql(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),m2=yK;var vK=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(c,f,p){return f.from.coordinates[1]>t.edges[c].from.coordinates[1]&&(c=p),c},0),i=(e===0?this.length:e)-1,s=(e+1)%this.length,u=Ql(this.edges[i].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return u===0?this.edges[i].from.coordinates[0]>this.edges[s].from.coordinates[0]:u>0},n.prototype.toMultiPoint=function(){return u_(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=Un([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=T_(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var i=t.getEnvelope(),s,u;return e.forEach(function(c){var f=c.getEnvelope();if(u&&(s=u.getEnvelope()),!d2(f,i)&&Px(f,i)){for(var p=t.map(function(M){return M.from.coordinates}),d=void 0,g=function(M){c.some(function(A){return g2(M,A.from.coordinates)})||(d=M)},y=0,v=p;y<v.length;y++){var E=v[y];g(E)}d&&c.inside(Dn(d))&&(!u||Px(s,f))&&(u=c)}}),u},n.prototype.inside=function(t){return zr(t,this.toPolygon())},n}(),Lx=vK;function _K(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 Kdt=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){_K(t);var e=new n;return Ji(t,function(i){c_(i,"LineString","Graph::fromGeoJson"),TP(i,function(s,u){if(s){var c=e.getNode(s),f=e.getNode(u);e.addEdge(c,f)}return u})}),e},n.prototype.getNode=function(t){var e=Rx.buildId(t),i=this.nodes[e];return i||(i=this.nodes[e]=new Rx(t)),i},n.prototype.addEdge=function(t,e){var i=new m2(t,e),s=i.getSymetric();this.edges.push(i),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 i=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),i.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(i){return e._computeNextCWEdges(e.nodes[i])}):t.getOuterEdges().forEach(function(i,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=i})},n.prototype._computeNextCCWEdges=function(t,e){for(var i=t.getOuterEdges(),s,u,c=i.length-1;c>=0;--c){var f=i[c],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(u=g),d&&(u&&(u.next=d,u=void 0),s||(s=d)))}u&&(u.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(i){if(!(i.label>=0)){t.push(i);var s=i;do s.label=e,s=s.next;while(!i.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(i){i.label=void 0}),this._findLabeledEdgeRings().forEach(function(i){t._findIntersectionNodes(i).forEach(function(s){t._computeNextCCWEdges(s,i.label)})});var e=[];return this.edges.forEach(function(i){i.ring||e.push(t._findEdgeRing(i))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],i=t,s=function(){var u=0;i.from.getOuterEdges().forEach(function(c){c.label===t.label&&++u}),u>1&&e.push(i.from),i=i.next};do s();while(!t.isEqual(i));return e},n.prototype._findEdgeRing=function(t){var e=t,i=new Lx;do i.push(e),e.ring=i,e=e.next;while(!t.isEqual(e));return i},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(i){return e.removeEdge(i)}),t.innerEdges.forEach(function(i){return e.removeEdge(i)}),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 wK=Jt(Nx(),1);var MK=Jt(Nx(),1);var AK=Jt(b2(),1);var NK=Jt(D2(),1);function U2(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function DK(){return new B2(function(n){return n.f})}var Ux={search:function(n,t,e,i){n.cleanDirty(),i=i||{};var s=i.heuristic||Ux.heuristics.manhattan,u=i.closest||!1,c=DK(),f=t;for(t.h=s(t,e),c.push(t);c.size()>0;){var p=c.pop();if(p===e)return U2(p);p.closed=!0;for(var d=n.neighbors(p),g=0,y=d.length;g<y;++g){var v=d[g];if(!(v.closed||v.isWall())){var E=p.g+v.getCost(p),M=v.visited;(!M||E<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||s(v,e),v.g=E,v.f=v.g+v.h,n.markDirty(v),u&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),M?c.rescoreElement(v):c.push(v))}}}return u?U2(f):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),i=Math.abs(t.y-n.y);return e+i},diagonal:function(n,t){var e=1,i=Math.sqrt(2),s=Math.abs(t.x-n.x),u=Math.abs(t.y-n.y);return e*(s+u)+(i-2*e)*Math.min(s,u)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function zf(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 i=0,s=n[e];i<s.length;i++){var u=new og(e,i,s[i]);this.grid[e][i]=u,this.nodes.push(u)}}this.init()}zf.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)Ux.cleanNode(this.nodes[n])};zf.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)Ux.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};zf.prototype.markDirty=function(n){this.dirtyNodes.push(n)};zf.prototype.neighbors=function(n){var t=[],e=n.x,i=n.y,s=this.grid;return s[e-1]&&s[e-1][i]&&t.push(s[e-1][i]),s[e+1]&&s[e+1][i]&&t.push(s[e+1][i]),s[e]&&s[e][i-1]&&t.push(s[e][i-1]),s[e]&&s[e][i+1]&&t.push(s[e][i+1]),this.diagonal&&(s[e-1]&&s[e-1][i-1]&&t.push(s[e-1][i-1]),s[e+1]&&s[e+1][i-1]&&t.push(s[e+1][i-1]),s[e-1]&&s[e-1][i+1]&&t.push(s[e-1][i+1]),s[e+1]&&s[e+1][i+1]&&t.push(s[e+1][i+1])),t};zf.prototype.toString=function(){for(var n=[],t=this.grid,e,i,s,u,c=0,f=t.length;c<f;c++){for(e=[],i=t[c],s=0,u=i.length;s<u;s++)e.push(i[s].weight);n.push(e.join(" "))}return n.join(`
3806
+ `)};function og(n,t,e){this.x=n,this.y=t,this.weight=e}og.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};og.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};og.prototype.isWall=function(){return this.weight===0};function B2(n){this.content=[],this.scoreFunction=n}B2.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,i=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(i))this.content[e]=t,this.content[n]=i,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],i=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,c=null,f;if(u<t){var p=this.content[u];f=this.scoreFunction(p),f<i&&(c=u)}if(s<t){var d=this.content[s],g=this.scoreFunction(d);g<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function Bx(){this._=null}function ec(n){n.U=n.C=n.L=n.R=n.P=n.N=null}Bx.prototype={constructor:Bx,insert:function(n,t){var e,i,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=z2(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;)i=e.U,e===i.L?(s=i.R,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.R&&(Gf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,kf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(kf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Gf(this,i))),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,i=n.L,s=n.R,u,c;if(i?s?u=z2(s):u=i:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,i&&s?(c=u.C,u.C=n.C,u.L=i,i.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(c=n.C,n=u),n&&(n.U=t),!c){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,Gf(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,kf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Gf(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,kf(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,Gf(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,kf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Gf(n,t){var e=t,i=t.R,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.R=i.L,e.R&&(e.R.U=e),i.L=e}function kf(n,t){var e=t,i=t.L,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.L=i.R,e.L&&(e.L.U=e),i.R=e}function z2(n){for(;n.L;)n=n.L;return n}var zx=Bx;function nc(n,t,e,i){var s=[null,null],u=kr.push(s)-1;return s.left=n,s.right=t,e&&qf(s,n,t,e),i&&qf(s,t,n,i),Ti[n.index].halfedges.push(u),Ti[t.index].halfedges.push(u),s}function rc(n,t,e){var i=[t,e];return i.left=n,i}function qf(n,t,e,i){!n[0]&&!n[1]?(n[0]=i,n.left=t,n.right=e):n.left===e?n[1]=i:n[0]=i}function FK(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],g=c[1],y=0,v=1,E=d-f,M=g-p,A;if(A=t-f,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=i-f,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!M&&A>0)){if(A/=M,M<0){if(A<y)return;A<v&&(v=A)}else if(M>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!M&&A<0)){if(A/=M,M<0){if(A>v)return;A>y&&(y=A)}else if(M>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(n[0]=[f+y*E,p+y*M]),v<1&&(n[1]=[f+v*E,p+v*M])),!0}}}}}function UK(n,t,e,i,s){var u=n[1];if(u)return!0;var c=n[0],f=n.left,p=n.right,d=f[0],g=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(g+v)/2,A,_;if(v===g){if(E<t||E>=i)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-g),_=M-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(g<v){if(!c)c=[t,A*t+_];else if(c[0]>=i)return;u=[i,A*i+_]}else{if(!c)c=[i,A*i+_];else if(c[0]<t)return;u=[t,A*t+_]}return n[0]=c,n[1]=u,!0}function G2(n,t,e,i){for(var s=kr.length,u;s--;)(!UK(u=kr[s],n,t,e,i)||!FK(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Ln||Math.abs(u[0][1]-u[1][1])>Ln))&&delete kr[s]}function k2(n){return Ti[n.index]={site:n,halfedges:[]}}function BK(n,t){var e=n.site,i=t.left,s=t.right;return e===s&&(s=i,i=e),s?Math.atan2(s[1]-i[1],s[0]-i[0]):(e===i?(i=t[1],s=t[0]):(i=t[0],s=t[1]),Math.atan2(i[0]-s[0],s[1]-i[1]))}function Gx(n,t){return t[+(t.left!==n.site)]}function zK(n,t){return t[+(t.left===n.site)]}function q2(){for(var n=0,t=Ti.length,e,i,s,u;n<t;++n)if((e=Ti[n])&&(u=(i=e.halfedges).length)){var c=new Array(u),f=new Array(u);for(s=0;s<u;++s)c[s]=s,f[s]=BK(e,kr[i[s]]);for(c.sort(function(p,d){return f[d]-f[p]}),s=0;s<u;++s)f[s]=i[c[s]];for(s=0;s<u;++s)i[s]=f[s]}}function V2(n,t,e,i){var s=Ti.length,u,c,f,p,d,g,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Ti[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)kr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)M=zK(c,kr[d[p]]),A=M[0],_=M[1],y=Gx(c,kr[d[++p%g]]),v=y[0],E=y[1],(Math.abs(A-v)>Ln||Math.abs(_-E)>Ln)&&(d.splice(p,0,kr.push(rc(f,M,Math.abs(A-n)<Ln&&i-_>Ln?[n,Math.abs(v-n)<Ln?E:i]:Math.abs(_-i)<Ln&&e-A>Ln?[Math.abs(E-i)<Ln?v:e,i]:Math.abs(A-e)<Ln&&_-t>Ln?[e,Math.abs(v-e)<Ln?E:t]:Math.abs(_-t)<Ln&&A-n>Ln?[Math.abs(E-t)<Ln?v:n,t]:null))-1),++g);g&&(x=!1)}if(x){var T,w,R,B=1/0;for(u=0,x=null;u<s;++u)(c=Ti[u])&&(f=c.site,T=f[0]-n,w=f[1]-t,R=T*T+w*w,R<B&&(B=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(kr.push(rc(f=x.site,U,D))-1,kr.push(rc(f,D,P))-1,kr.push(rc(f,P,ct))-1,kr.push(rc(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Ti[u])&&(c.halfedges.length||delete Ti[u])}var H2=[],sg;function GK(){ec(this),this.x=this.y=this.arc=this.site=this.cy=null}function _u(n){var t=n.P,e=n.N;if(!(!t||!e)){var i=t.site,s=n.site,u=e.site;if(i!==u){var c=s[0],f=s[1],p=i[0]-c,d=i[1]-f,g=u[0]-c,y=u[1]-f,v=2*(p*y-d*g);if(!(v>=-W2)){var E=p*p+d*d,M=g*g+y*y,A=(y*E-d*M)/v,_=(p*M-g*E)/v,x=H2.pop()||new GK;x.arc=n,x.site=s,x.x=A+c,x.y=(x.cy=_+f)+Math.sqrt(A*A+_*_),n.circle=x;for(var T=null,w=ic._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}ic.insert(T,x),T||(sg=x)}}}}function xu(n){var t=n.circle;t&&(t.P||(sg=t.N),ic.remove(t),H2.push(t),ec(t),n.circle=null)}var Y2=[];function kK(){ec(this),this.edge=this.site=this.circle=null}function X2(n){var t=Y2.pop()||new kK;return t.site=n,t}function kx(n){xu(n),Eu.remove(n),Y2.push(n),ec(n)}function $2(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];kx(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Ln&&Math.abs(i-p.circle.cy)<Ln;)u=p.P,f.unshift(p),kx(p),p=u;f.unshift(p),xu(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Ln&&Math.abs(i-d.circle.cy)<Ln;)c=d.N,f.push(d),kx(d),d=c;f.push(d),xu(d);var g=f.length,y;for(y=1;y<g;++y)d=f[y],p=f[y-1],qf(d.edge,p.site,d.site,s);p=f[0],d=f[g-1],d.edge=nc(p.site,d.site,null,s),_u(p),_u(d)}function Z2(n){for(var t=n[0],e=n[1],i,s,u,c,f=Eu._;f;)if(u=J2(f,e)-t,u>Ln)f=f.L;else if(c=t-qK(f,e),c>Ln){if(!f.R){i=f;break}f=f.R}else{u>-Ln?(i=f.P,s=f):c>-Ln?(i=f,s=f.N):i=s=f;break}k2(n);var p=X2(n);if(Eu.insert(i,p),!(!i&&!s)){if(i===s){xu(i),s=X2(i.site),Eu.insert(p,s),p.edge=s.edge=nc(i.site,p.site),_u(i),_u(s);return}if(!s){p.edge=nc(i.site,p.site);return}xu(i),xu(s);var d=i.site,g=d[0],y=d[1],v=n[0]-g,E=n[1]-y,M=s.site,A=M[0]-g,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+g,(v*w-A*T)/x+y];qf(s.edge,d,M,R),p.edge=nc(d,n,null,R),s.edge=nc(n,M,null,R),_u(i),_u(s)}}function J2(n,t){var e=n.site,i=e[0],s=e[1],u=s-t;if(!u)return i;var c=n.P;if(!c)return-1/0;e=c.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-i,y=1/u-1/d,v=g/d;return y?(-v+Math.sqrt(v*v-2*y*(g*g/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function qK(n,t){var e=n.N;if(e)return J2(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Ln=1e-6,W2=1e-12,Eu,Ti,ic,kr;function VK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function HK(n,t){return t[1]-n[1]||t[0]-n[0]}function ag(n,t){var e=n.sort(HK).pop(),i,s,u;for(kr=[],Ti=new Array(n.length),Eu=new zx,ic=new zx;;)if(u=sg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(Z2(e),i=e[0],s=e[1]),e=n.pop();else if(u)$2(u.arc);else break;if(q2(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];G2(c,f,p,d),V2(c,f,p,d)}this.edges=kr,this.cells=Ti,Eu=ic=kr=Ti=null}ag.prototype={constructor:ag,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return Gx(t,n[i])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,i){if(f=(u=e.halfedges).length)for(var s=e.site,u,c=-1,f,p,d=t[u[f-1]],g=d.left===s?d.right:d.left;++c<f;)p=g,d=t[u[c]],g=d.left===s?d.right:d.left,p&&g&&i<p.index&&i<g.index&&VK(s,p,g)<0&&n.push([s.data,p.data,g.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 i=this,s,u=i._found||0,c=i.cells.length,f;!(f=i.cells[u]);)if(++u>=c)return null;var p=n-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=i.cells[s=u],u=null,f.halfedges.forEach(function(y){var v=i.edges[y],E=v.left;if(!((E===f.site||!E)&&!(E=v.right))){var M=n-E[0],A=t-E[1],_=M*M+A*A;_<g&&(g=_,u=E.index)}});while(u!==null);return i._found=s,e==null||g<=e*e?f.site:null}};var KK=Jt(oc(),1);var n1=Jt(tO(),1);function Di(){return new cg}function cg(){this.reset()}cg.prototype={constructor:cg,reset:function(){this.s=this.t=0},add:function(n){eO(lg,n,this.t),eO(this,lg.s,this.s),this.s?this.t+=lg.t:this.s=lg.t},valueOf:function(){return this.s}};var lg=new cg;function eO(n,t,e){var i=n.s=t+e,s=i-t,u=i-s;n.t=t-u+(e-s)}var yn=1e-6;var Tn=Math.PI,br=Tn/2,fg=Tn/4,ss=Tn*2,Su=180/Tn,Fi=Tn/180,nr=Math.abs,Uo=Math.atan,Ui=Math.atan2,hn=Math.cos;var hg=Math.exp;var Vf=Math.log;var Me=Math.sin;var jr=Math.sqrt,Hf=Math.tan;function Hx(n){return n>1?0:n<-1?Tn:Math.acos(n)}function Ci(n){return n>1?br:n<-1?-br:Math.asin(n)}function Bo(){}var QK=Di(),X0t=Di();function wu(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function Wf(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 Xf(n){var t=jr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var nyt=Di();function rO(n,t){return[n>Tn?n-ss:n<-Tn?n+ss:n,t]}rO.invert=rO;function Wx(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Bo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Xx(n,t){return nr(n[0]-t[0])<yn&&nr(n[1]-t[1])<yn}function pg(n,t,e,i){this.x=n,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function Yx(n,t,e,i,s){var u=[],c=[],f,p;if(n.forEach(function(M){if(!((A=M.length-1)<=0)){var A,_=M[0],x=M[A],T;if(Xx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new pg(_,M,null,!0)),c.push(T.o=new pg(_,null,T,!1)),u.push(T=new pg(x,M,null,!1)),c.push(T.o=new pg(x,null,T,!0))}}),!!u.length){for(c.sort(t),iO(u),iO(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],g,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;g=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=g.length;f<p;++f)s.point((y=g[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(g=v.p.z,f=g.length-1;f>=0;--f)s.point((y=g[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,g=v.z,E=!E}while(!v.v);s.lineEnd()}}}function iO(n){if(t=n.length){for(var t,e=0,i=n[0],s;++e<t;)i.n=s=n[e],s.p=i,i=s;i.n=s=n[0],s.p=i}}function Aa(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function $x(n){return n.length===1&&(n=nQ(n)),{left:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)<0?i=u+1:s=u}return i},right:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)>0?s=u:i=u+1}return i}}}function nQ(n){return function(t,e){return Aa(n(t),e)}}var oO=$x(Aa),rQ=oO.right,iQ=oO.left;var sO=Array.prototype,sQ=sO.slice,aQ=sO.map;var $yt=Math.sqrt(50),Zyt=Math.sqrt(10),Jyt=Math.sqrt(2);function gg(n){for(var t=n.length,e,i=-1,s=0,u,c;++i<t;)s+=n[i].length;for(u=new Array(s);--t>=0;)for(c=n[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var gQ=1e9,N_t=-gQ;var Zx=Di();function Jx(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;Zx.reset();for(var f=0,p=n.length;f<p;++f)if(g=(d=n[f]).length)for(var d,g,y=d[g-1],v=y[0],E=y[1]/2+fg,M=Me(E),A=hn(E),_=0;_<g;++_,v=T,M=R,A=B,y=x){var x=d[_],T=x[0],w=x[1]/2+fg,R=Me(w),B=hn(w),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>Tn,L=M*R;if(Zx.add(Ui(L*D*Me(P),A*B+L*hn(P))),u+=ct?U+D*ss:U,ct^v>=e^T>=e){var W=Wf(wu(y),wu(x));Xf(W);var V=Wf(s,W);Xf(V);var Mt=(ct^U>=0?-1:1)*Ci(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&Zx<-yn)^c&1}var V_t=Di();var uxt=Di(),lxt=Di();var vQ=1/0;var hxt=-vQ;function jx(n){this._context=n}jx.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,ss);break}}},result:Bo};var Sxt=Di();function Kx(){this._string=[]}Kx.prototype={_radius:4.5,_circle:lO(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=lO(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 lO(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Qx(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Wx(),d=t(p),g=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=w,M.lineStart=R,M.lineEnd=B,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=gg(v);var U=Jx(y,f);v.length?(g||(u.polygonStart(),g=!0),Yx(v,EQ,U,e,u)):U&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(U,D){var P=s(U,D);n(U=P[0],D=P[1])&&u.point(U,D)}function _(U,D){var P=s(U,D);c.point(P[0],P[1])}function x(){M.point=_,c.lineStart()}function T(){M.point=A,c.lineEnd()}function w(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function B(){w(E[0][0],E[0][1]),d.lineEnd();var U=d.clean(),D=p.result(),P,ct=D.length,L,W,V;if(E.pop(),y.push(E),E=null,!!ct){if(U&1){if(W=D[0],(L=W.length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),P=0;P<L;++P)u.point((V=W[P])[0],V[1]);u.lineEnd()}return}ct>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(xQ))}}return M}}function xQ(n){return n.length>1}function EQ(n,t){return((n=n.x)[0]<0?n[1]-br-yn:br-n[1])-((t=t.x)[0]<0?t[1]-br-yn:br-t[1])}var SQ=Qx(function(){return!0},wQ,bQ,[-Tn,-br]);function wQ(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?Tn:-Tn,p=nr(u-t);nr(p-Tn)<yn?(n.point(t,e=(e+c)/2>0?br:-br),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=Tn&&(nr(t-i)<yn&&(t-=i*yn),nr(u-f)<yn&&(u-=f*yn),e=MQ(t,e,u,c),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=c),i=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function MQ(n,t,e,i){var s,u,c=Me(n-e);return nr(c)>yn?Uo((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function bQ(n,t,e,i){var s;if(n==null)s=e*br,i.point(-Tn,s),i.point(0,s),i.point(Tn,s),i.point(Tn,0),i.point(Tn,-s),i.point(0,-s),i.point(-Tn,-s),i.point(-Tn,0),i.point(-Tn,s);else if(nr(n[0]-t[0])>yn){var u=n[0]<t[0]?Tn:-Tn;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function mg(n){return function(t){var e=new t1;for(var i in n)e[i]=n[i];return e.stream=t,e}}function t1(){}t1.prototype={constructor:t1,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 l1t=hn(30*Fi);var w1t=mg({point:function(n,t){this.stream.point(n*Fi,t*Fi)}});function yg(n){return function(t,e){var i=hn(t),s=hn(e),u=n(i*s);return[u*s*Me(t),u*Me(e)]}}function as(n){return function(t,e){var i=jr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Ui(t*u,i*c),Ci(i&&e*u/i)]}}var mO=yg(function(n){return jr(2/(1+n))});mO.invert=as(function(n){return 2*Ci(n/2)});var yO=yg(function(n){return(n=Hx(n))&&n/Me(n)});yO.invert=as(function(n){return n});function e1(n,t){return[n,Vf(Hf((br+t)/2))]}e1.invert=function(n,t){return[n,2*Uo(hg(t))-br]};function vg(n,t){return[n,t]}vg.invert=vg;function vO(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}vO.invert=as(Uo);function _O(n,t){var e=t*t,i=e*e;return[n*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}_O.invert=function(n,t){var e=t,i=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(nr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function xO(n,t){return[hn(t)*Me(n),Me(t)]}xO.invert=as(Ci);function EO(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}EO.invert=as(function(n){return 2*Uo(n)});function SO(n,t){return[Vf(Hf((br+t)/2)),-n]}SO.invert=function(n,t){return[-t,2*Uo(hg(n))-br]};var RQ=Jt(oc(),1);var LQ=Jt(oc(),1);var OQ=Jt(oc(),1);var DQ=Jt(oc(),1);function Mu(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function MO(n,t,e){let i=new Ot(t[0]-n[0],t[1]-n[1]),s=new Ot(t[0]-e[0],t[1]-e[1]),c=i.angleTo(s)*180/Math.PI,f=new Ot(t[0]-n[0],t[1]-n[1]);return new Ot(e[0]-n[0],e[1]-n[1]).cross(f)>0?c:-c}function bO(n,t){let e=0,i=1/0,[s,u]=t;for(let c=0;c<n.length-1;c++){let[f,p]=n[c],[d,g]=n[c+1],y=Math.min(f,d)<=s&&s<=Math.max(f,d),v=Math.min(p,g)<=u&&u<=Math.max(p,g);if(y&&v){let E=Math.abs((d-f)*(u-p)-(g-p)*(s-f));E<i&&(i=E,e=c)}}return e}function AO(n,t){let e=n[0],i=n[1],s=!1;for(let u=0,c=t.length-1;u<t.length;c=u++){let f=t[u][0],p=t[u][1],d=t[c][0],g=t[c][1];p>i!=g>i&&e<(d-f)*(i-p)/(g-p)+f&&(s=!s)}return s}var zAt=Jt(KO(),1),GAt=Jt(a_(),1),kAt=Jt(Dc(),1);function cD(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function fD(n){let t={};for(let i in n)i.startsWith("on")&&(t[cD(i.slice(2))]=n[i],t[i]=n[i]);let e=i=>Ri(this,null,function*(){let{data:s}=i;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},c)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var ZAt=Jt(CD(),1),JAt=Jt(Yu(),1);function ID(n,t,e){e===void 0&&(e=0),n.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(u=>{Array.isArray(u)&&u.forEach(c=>{c[0]-=t[0],c[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(u=>u.map(c=>uc(c,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(u=>{u.coord=uc(u.coordinate,t)}),i.center&&(i.centerCoords=uc(i.center,t))}else i.geometry.coords=uc(i.geometry.cds,t),i.center&&(i.centerCoords=uc(i.center,t));if(i.center_x&&i.center_y){let[u,c]=uc([i.center_x,i.center_y],t);i.center_coord_x=u,i.center_coord_y=c}});for(let i=0;i<n.length;i++){let s=n[i];s.deltaHeight=1e-5*(e+i+1)}}function uc(n,t){return[n[0]-t[0],n[1]-t[1]]}var iTt=Jt(g0(),1),oTt=Jt(m0(),1),sTt=Jt(y0(),1),aTt=Jt(_0(),1),uTt=Jt(x0(),1),lTt=Jt(M0(),1),cTt=Jt(R0(),1),fTt=Jt(N0(),1),hTt=Jt(O0(),1),pTt=Jt(F0(),1),dTt=Jt(B0(),1),gTt=Jt(q0(),1),mTt=Jt(W0(),1),yTt=Jt(sy(),1),vTt=Jt(ay(),1),_Tt=Jt(Dc(),1),xTt=Jt(Yu(),1);function Eg(n,t=!1){let e=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),u={},c={},f=n[0].morphTargetsRelative,p=new ui,d=0;for(let g=0;g<n.length;++g){let y=n[g],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(f!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,g),d+=E}}if(e){let g=0,y=[];for(let v=0;v<n.length;++v){let E=n[v].index;for(let M=0;M<E.count;++M)y.push(E.getX(M)+g);g+=n[v].attributes.position.count}p.setIndex(y)}for(let g in u){let y=PD(u[g]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;p.setAttribute(g,y)}for(let g in c){let y=c[g][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[g]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[g].length;++A)E.push(c[g][A][v]);let M=PD(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;p.morphAttributes[g].push(M)}}return p}function PD(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let g=n[d];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=g.normalized),i!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=g.gpuType),s!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=g.count*e}let c=new t(u),f=new Zn(c,e,i),p=0;for(let d=0;d<n.length;++d){let g=n[d];if(g.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=g.count;v<E;v++)for(let M=0;M<e;M++){let A=g.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(g.array,p);p+=g.count*e}return s!==void 0&&(f.gpuType=s),f}function RD(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=n.filter(f=>f.geometry.type==="polygon");if(!i.length)return null;let s=i.map(f=>{var p;let d=f.geometry.coords,g=hd(d[0],d.slice(1)),y=new id(g,{steps:1,bevelEnabled:!1,depth:f.height,curveSegments:4});(p=f).deltaHeight||(p.deltaHeight=0),y.translate(0,0,f.airHeight+f.deltaHeight);let v=y.attributes.position.count,E=new Float32Array(v).fill(f.height+f.airHeight+f.deltaHeight);if(y.setAttribute("maxZ",new Zn(E,1)),y.setAttribute("opacity",new Zn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Zn(_,1))}let M=new Te(f.fillColor).convertLinearToSRGB(),A=new Float32Array(v*3);for(let _=0;_<v;_++)A[_*3]=M.r,A[_*3+1]=M.g,A[_*3+2]=M.b;return y.setAttribute("color",new Zn(A,3)),y}),u=Eg(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=Sg(i)||void 0),c}function h1(n){let t=n.filter(p=>p.geometry.type==="polygon");if(!t.length)return null;let e=[],i=[],s=[],u=[],c=[],f=[];return t.map((p,d)=>{var g;(g=p).deltaHeight||(g.deltaHeight=0);let y=p.geometry.coords,v=Mu(y[0][0],y[0][1]),E=Mu(y[0][1],y[0][2]),M=y[0][1][0]-y[0][0][0],A=y[0][1][1]-y[0][0][1],_=Math.atan2(A,M),x=du(Un(y)),T=x.geometry.coordinates[0],w=x.geometry.coordinates[1],R=new $n().compose(new st(T,w,p.deltaHeight+p.airHeight+p.height/2),new lo().setFromAxisAngle(new st(0,0,1),_),new st(v,E,p.height));e.push(...R.toArray()),i.push(...new Te(p.fillColor).convertLinearToSRGB().toArray());var B;s[d]=(B=p.fillOpacity)!=null?B:1;var U;u[d]=((U=p.deltaHeight)!=null?U:0)+p.airHeight+p.height,c[d]=p.id,f[d]=p.airHeight+p.deltaHeight}),{size:t.length,ids:c,matrixes:e,colors:i,opacities:s,maxZs:u,minZs:f}}function Sg(n){let{points:t,colors:e,opacities:i}=iet(n);if(!t.length)return null;let s=new ui().setFromPoints(t);return s.setAttribute("color",new Zn(new Float32Array(e),3)),s.setAttribute("opacity",new Zn(new Float32Array(i),1)),s}function iet(n){let t=[],e=[],i=[];return n.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:f,strokeOpacity:p}=s,d=new Te(f).convertLinearToSRGB();for(let g=0;g<c.length;g++){let y=c[g];for(let v=0;v<y.length;v++){let E=y[v],M=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(M[0],M[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),i.push(p),i.push(p)}}}),{points:t,colors:e,opacities:i}}function LD(n){if(n.length>1)return!1;let t=n[0];if(t.length!==5)return!1;let[e]=t,i=t[t.length-1];if(e[0]!==i[0]||e[1]!==i[1])return!1;let s=[Math.round(Mu(t[0],t[1])),Math.round(Mu(t[1],t[2])),Math.round(Mu(t[2],t[3])),Math.round(Mu(t[3],t[4]))];if(!(s[2]===s[0]&&s[3]===s[1]))return!1;let u=MO(t[0],t[1],t[2]);return Math.abs(Math.abs(u)-90)<1}var $f=function(n){return n.HALF="half",n.POWER="power",n.MECHANICAL="mechanical",n.NORMAL="normal",n.VIP="vip",n}({});var ND=new Qo,wg=new st,Mg=class extends ad{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new _r(t,3)),this.setAttribute("uv",new _r(e,2))}applyMatrix4(t){let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new _f(e,6,1);return this.setAttribute("instanceStart",new es(i,3,0)),this.setAttribute("instanceEnd",new es(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new _f(e,6,1);return this.setAttribute("instanceColorStart",new es(i,3,0)),this.setAttribute("instanceColorEnd",new es(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new sd(t.geometry)),this}fromLineSegments(t){let e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qo);let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ND.setFromBufferAttribute(e),this.boundingBox.union(ND))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)wg.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(wg)),wg.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(wg));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};var PTt=Jt(lD(),1);var bg=function(n){return n.LAYERED_RENDER_VERSION="layeredRender",n.MERGED_RENDER_VERSION="mergedRender",n}({});var p1=["range","ground","store","facility","parkingSpace"];function OD(n){return p1.indexOf(n.l_type)===-1?p1.length:p1.indexOf(n.l_type)}function oet(n){n.layers.sort((t,e)=>OD(t)-OD(e))}function set(n){let t=n.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];n.layers.map(i=>{if(i.l_type!=="range")return ID(i.elements,e)})}function DD(n){oet(n),set(n)}function Ag(n,t){return t===void 0&&(t=6),n.floor_id+"_"+n.version_id+(t?"_"+t:"")}var lc=[],cc=[];function UD(n,t){return Ri(this,null,function*(){return yield ip(),py(n,""+t)})}function FD(n,t,e){return Ri(this,null,function*(){let{db:i}=yield ip();return hC(n,""+t,e,i)})}function aet(n){return Ri(this,null,function*(){let t=yield fetch(n.map_url).then(e=>e.json());return t.floor=n.floor,DD(t),lc.push(t),t})}function uet(n,t){return Ri(this,null,function*(){let e=Ag(n,t===bg.LAYERED_RENDER_VERSION?1:void 0);try{let i=yield UD(Kc.MAP_DATA,e);return i&&(t===bg.LAYERED_RENDER_VERSION||i.transformed)?(console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i):(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E",e,i),cc.push(n),null)}catch(i){return console.log("[get floor data error]",i),cc.push(n),null}})}function cet(n,t){return t===void 0&&(t=!0),t&&(n.layers.forEach(e=>{switch(e.l_type){case"ground":break;case"store":d1(e.elements),e.mergedElements=Tg(e.elements);break;case"facility":d1(e.elements),e.mergedElements=Tg(e.elements);break;case"parkingSpace":console.time("parkingSpace merge"),e.mergedElements=fet(e.elements),console.timeEnd("parkingSpace merge"),e.mergedParkingTexture=det(e.elements);break;case"graph":d1(e.elements),e.mergedElements=Tg(e.elements);break;case"wall":e.mergedElements=Tg(e.elements,!1,!0);break;case"lane":e.mergedElements=het(e.elements);break;case"texture2d":case"texture3d":e.mergedMatrixes=BD(e.elements);break;case"glb":case"text":}}),n.transformed=!0),n}function Tg(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=[],s=[];n.forEach(p=>{p.geometry.type==="point"||p.doors.length?s.push(p):LD(p.geometry.cds)?i.push(p):s.push(p)});let u=h1(i),c=RD(s,!1,e),f=null;return t&&(f=Sg(n)),[Bu({},n[0],{mergedGeometry:(c==null?void 0:c.geometry.toJSON())||null,lineGeometry:(f==null?void 0:f.toJSON())||null,instancedGeometry:u})]}function fet(n){let t=h1(n),e=Sg(n);return Bu({},t,{lineGeometry:(e==null?void 0:e.toJSON())||null})}function BD(n){let t=n.reduce((i,s)=>{let{iconUrl:u}=s;return i.has(u)||i.set(u,[]),i.get(u).push(s),i},new Map);return Array.from(t.values()).map(i=>{let s=i.map(c=>new $n().compose(new st(c.centerCoords[0],c.centerCoords[1],c.deltaHeight+c.airHeight+c.height),new lo().setFromAxisAngle(new st(0,0,1),c.secondRotate),new st(c.secondWidth,c.secondHeight,1)).toArray());return Bu({},i[0],{mergedMatrixes:{size:s.length,array:s.flat()}})})}function het(n){let t=n.map(u=>{let c=hd(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new od(c,4),p=f.getAttribute("position"),d=[],g=new Te(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(g.r,g.g,g.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Zn(new Float32Array(d),4)),f}),e=Eg(t);t.forEach(u=>u.dispose());let i={mergedGeometry:e.toJSON()};e.dispose();let s=n.filter(u=>{var c,f;return u.double&&((f=u.geometry.otherCoords)==null||(c=f[1])==null?void 0:c.length)});return s.length&&[!0,!1].forEach(u=>{let c=s.filter(g=>g.double===!0&&g.dashed===u);if(!c.length)return;let f=[],p=[];c.forEach(g=>{let y=g.geometry.otherCoords[1],v=g.airHeight+(g.deltaHeight||0)+.01,E=new Te(g.secondColor);for(let M=0;M<y.length-1;M++){let A=y[M],_=y[M+1];f.push(A[0],A[1],v,_[0],_[1],v),p.push(E.r,E.g,E.b,E.r,E.g,E.b)}});let d=new Mg;d.setPositions(f),d.setColors(p),i[u?"dashedLineGeometry":"lineGeometry"]={positions:f,colors:p},d.dispose()}),i}var pet=new Set([$f.HALF,$f.MECHANICAL,$f.POWER,$f.VIP]);function det(n){let t=n.filter(e=>pet.has(e.parkingType)).map(e=>{let i=new Ot(...e.geometry.coords[0][0]),s=new Ot(...e.geometry.coords[0][1]),u=new Ot(...e.geometry.coords[0][2]),c=Math.min(i.distanceTo(s),s.distanceTo(u)),f=0;return c===i.distanceTo(s)?f=s.sub(i).angle()-Math.PI/2:f=u.sub(s).angle()-Math.PI/2,{uuid:e.id,iconUrl:e.parkingType,name:e.texts[0],deltaHeight:(e.deltaHeight||0)+.001,airHeight:e.airHeight,height:e.height,geometry:e.geometry,opacity:e.fillOpacity,visible:!0,secondWidth:c-1,secondHeight:c-1,secondRotate:f,centerCoords:[e.center_coord_x,e.center_coord_y]}});return BD(t)}function d1(n){n.map(t=>{var e;if((e=t.doors)!=null&&e.length&&t.geometry.type==="polygon"){let i=t.geometry.coords[0];t.doors.forEach(s=>{let u=s.type==="single"?.5:1,c=.5,f=bO(i,s.coord),p=new Ot(...s.coord),d=new Ot(...i[f]).sub(new Ot(...s.coord)).normalize(),g=new Ot().addVectors(p,d.clone().multiplyScalar(u)),y=new Ot().addVectors(p,d.clone().multiplyScalar(-u)),v=new Ot(-d.y,d.x),E=new Ot().addVectors(g,v.clone().multiplyScalar(c));AO([E.x,E.y],i)||(v.multiplyScalar(-1),E=new Ot().addVectors(g,v.clone().multiplyScalar(c)));let M=new Ot().addVectors(y,v.clone().multiplyScalar(c)),A=[[g.x,g.y],[E.x,E.y],[M.x,M.y],[y.x,y.y]];i=[...i.slice(0,f+1),...A,...i.slice(f+1)]}),t.geometry.coords[0]=i}})}var g1="";function zD(n){let t=cc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\u8C03\u6574\u697C\u5C42\u8BF7\u6C42\u7684\u4F18\u5148\u7EA7",n,t);let e=cc.splice(t,1)[0];cc.unshift(e)}else g1=n}var m1="";function GD(n){let t=lc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\u8C03\u6574\u697C\u5C42merge\u4F18\u5148\u7EA7",n,t);let e=lc.splice(t,1)[0];lc.unshift(e)}else m1=n}function get(n){zD(n),GD(n)}fD({onLoad(n){return Ri(this,null,function*(){let{floors:t,version:e}=n;for(yield ip(),yield Promise.all(t.map(i=>Ri(this,null,function*(){return uet(i,e)}))),g1&&zD(g1),yield Promise.all(cc.map(i=>Ri(this,null,function*(){let s=yield aet(i);if(s&&e===bg.LAYERED_RENDER_VERSION){let u=Ag(t.find(c=>c.floor===s.floor),1);yield FD(Kc.MAP_DATA,u,s),console.log(s.floor+" \u5199\u5165\u7F13\u5B58\u6210\u529F\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:s.floor}})}}))),m1&&GD(m1);lc.length>0;){let i=lc.shift(),s=cet(i),u=Ag(t.find(f=>f.floor===i.floor));yield FD(Kc.MAP_DATA,u,s),console.log(i.floor+" \u5199\u5165\u7F13\u5B58\u6210\u529F\uFF0Ckey="+u);let c=performance.now();yield UD(Kc.MAP_DATA,u),console.log(i.floor+" \u7F13\u5B58\u7F13\u5B58\u8BFB\u53D6\uFF0Ckey="+u,performance.now()-c),self.postMessage({type:"floor_success",data:{floor:i.floor}})}pC(),console.log("\u6240\u6709\u6570\u636E\u5904\u7406\u5B8C\u6210")})},onAdjustFloorPriority(n){let{floor:t}=n;get(t)}});