@aibee/crc-bmap 0.13.19 → 0.13.20

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,10 +1,10 @@
1
- var p2=Object.create;var zx=Object.defineProperty;var d2=Object.getOwnPropertyDescriptor;var m2=Object.getOwnPropertyNames;var g2=Object.getPrototypeOf,y2=Object.prototype.hasOwnProperty;var Z=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var v2=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m2(t))!y2.call(n,s)&&s!==e&&zx(n,s,{get:()=>t[s],enumerable:!(i=d2(t,s))||i.enumerable});return n};var ue=(n,t,e)=>(e=n!=null?p2(g2(n)):{},v2(t||!n||!n.__esModule?zx(e,"default",{value:n,enumerable:!0}):e,n));var Tf=(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 wn=Z((nm,Gx)=>{"use strict";var ic=function(n){return n&&n.Math===Math&&n};Gx.exports=ic(typeof globalThis=="object"&&globalThis)||ic(typeof window=="object"&&window)||ic(typeof self=="object"&&self)||ic(typeof global=="object"&&global)||ic(typeof nm=="object"&&nm)||function(){return this}()||Function("return this")()});var Un=Z(($Z,kx)=>{"use strict";kx.exports=function(n){try{return!!n()}catch(t){return!0}}});var ei=Z((ZZ,qx)=>{"use strict";var _2=Un();qx.exports=!_2(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var oc=Z((JZ,Vx)=>{"use strict";var x2=Un();Vx.exports=!x2(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var gi=Z((jZ,Hx)=>{"use strict";var E2=oc(),Cf=Function.prototype.call;Hx.exports=E2?Cf.bind(Cf):function(){return Cf.apply(Cf,arguments)}});var $x=Z(Yx=>{"use strict";var Wx={}.propertyIsEnumerable,Xx=Object.getOwnPropertyDescriptor,w2=Xx&&!Wx.call({1:2},1);Yx.f=w2?function(t){var e=Xx(this,t);return!!e&&e.enumerable}:Wx});var sc=Z((QZ,Zx)=>{"use strict";Zx.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var Zn=Z((tJ,Kx)=>{"use strict";var Jx=oc(),jx=Function.prototype,rm=jx.call,S2=Jx&&jx.bind.bind(rm,rm);Kx.exports=Jx?S2:function(n){return function(){return rm.apply(n,arguments)}}});var Gs=Z((eJ,t1)=>{"use strict";var Qx=Zn(),M2=Qx({}.toString),b2=Qx("".slice);t1.exports=function(n){return b2(M2(n),8,-1)}});var If=Z((nJ,e1)=>{"use strict";var A2=Zn(),T2=Un(),C2=Gs(),im=Object,I2=A2("".split);e1.exports=T2(function(){return!im("z").propertyIsEnumerable(0)})?function(n){return C2(n)==="String"?I2(n,""):im(n)}:im});var Pf=Z((rJ,n1)=>{"use strict";n1.exports=function(n){return n==null}});var Su=Z((iJ,r1)=>{"use strict";var P2=Pf(),R2=TypeError;r1.exports=function(n){if(P2(n))throw new R2("Can't call method on "+n);return n}});var Mu=Z((oJ,i1)=>{"use strict";var L2=If(),N2=Su();i1.exports=function(n){return L2(N2(n))}});var fr=Z((sJ,o1)=>{"use strict";var om=typeof document=="object"&&document.all;o1.exports=typeof om=="undefined"&&om!==void 0?function(n){return typeof n=="function"||n===om}:function(n){return typeof n=="function"}});var yi=Z((aJ,s1)=>{"use strict";var O2=fr();s1.exports=function(n){return typeof n=="object"?n!==null:O2(n)}});var bu=Z((uJ,a1)=>{"use strict";var sm=wn(),D2=fr(),F2=function(n){return D2(n)?n:void 0};a1.exports=function(n,t){return arguments.length<2?F2(sm[n]):sm[n]&&sm[n][t]}});var ac=Z((lJ,u1)=>{"use strict";var U2=Zn();u1.exports=U2({}.isPrototypeOf)});var Au=Z((cJ,f1)=>{"use strict";var B2=wn(),l1=B2.navigator,c1=l1&&l1.userAgent;f1.exports=c1?String(c1):""});var Lf=Z((fJ,y1)=>{"use strict";var g1=wn(),am=Au(),h1=g1.process,p1=g1.Deno,d1=h1&&h1.versions||p1&&p1.version,m1=d1&&d1.v8,yo,Rf;m1&&(yo=m1.split("."),Rf=yo[0]>0&&yo[0]<4?1:+(yo[0]+yo[1]));!Rf&&am&&(yo=am.match(/Edge\/(\d+)/),(!yo||yo[1]>=74)&&(yo=am.match(/Chrome\/(\d+)/),yo&&(Rf=+yo[1])));y1.exports=Rf});var um=Z((hJ,_1)=>{"use strict";var v1=Lf(),z2=Un(),G2=wn(),k2=G2.String;_1.exports=!!Object.getOwnPropertySymbols&&!z2(function(){var n=Symbol("symbol detection");return!k2(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&v1&&v1<41})});var lm=Z((pJ,x1)=>{"use strict";var q2=um();x1.exports=q2&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Nf=Z((dJ,E1)=>{"use strict";var V2=bu(),H2=fr(),W2=ac(),X2=lm(),Y2=Object;E1.exports=X2?function(n){return typeof n=="symbol"}:function(n){var t=V2("Symbol");return H2(t)&&W2(t.prototype,Y2(n))}});var uc=Z((mJ,w1)=>{"use strict";var $2=String;w1.exports=function(n){try{return $2(n)}catch(t){return"Object"}}});var Ca=Z((gJ,S1)=>{"use strict";var Z2=fr(),J2=uc(),j2=TypeError;S1.exports=function(n){if(Z2(n))return n;throw new j2(J2(n)+" is not a function")}});var Of=Z((yJ,M1)=>{"use strict";var K2=Ca(),Q2=Pf();M1.exports=function(n,t){var e=n[t];return Q2(e)?void 0:K2(e)}});var A1=Z((vJ,b1)=>{"use strict";var cm=gi(),fm=fr(),hm=yi(),tO=TypeError;b1.exports=function(n,t){var e,i;if(t==="string"&&fm(e=n.toString)&&!hm(i=cm(e,n))||fm(e=n.valueOf)&&!hm(i=cm(e,n))||t!=="string"&&fm(e=n.toString)&&!hm(i=cm(e,n)))return i;throw new tO("Can't convert object to primitive value")}});var lc=Z((_J,T1)=>{"use strict";T1.exports=!1});var Df=Z((xJ,I1)=>{"use strict";var C1=wn(),eO=Object.defineProperty;I1.exports=function(n,t){try{eO(C1,n,{value:t,configurable:!0,writable:!0})}catch(e){C1[n]=t}return t}});var Ff=Z((EJ,L1)=>{"use strict";var nO=lc(),rO=wn(),iO=Df(),P1="__core-js_shared__",R1=L1.exports=rO[P1]||iO(P1,{});(R1.versions||(R1.versions=[])).push({version:"3.42.0",mode:nO?"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 Uf=Z((wJ,O1)=>{"use strict";var N1=Ff();O1.exports=function(n,t){return N1[n]||(N1[n]=t||{})}});var zo=Z((SJ,D1)=>{"use strict";var oO=Su(),sO=Object;D1.exports=function(n){return sO(oO(n))}});var to=Z((MJ,F1)=>{"use strict";var aO=Zn(),uO=zo(),lO=aO({}.hasOwnProperty);F1.exports=Object.hasOwn||function(t,e){return lO(uO(t),e)}});var Bf=Z((bJ,U1)=>{"use strict";var cO=Zn(),fO=0,hO=Math.random(),pO=cO(1 .toString);U1.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+pO(++fO+hO,36)}});var Vr=Z((AJ,z1)=>{"use strict";var dO=wn(),mO=Uf(),B1=to(),gO=Bf(),yO=um(),vO=lm(),Tu=dO.Symbol,pm=mO("wks"),_O=vO?Tu.for||Tu:Tu&&Tu.withoutSetter||gO;z1.exports=function(n){return B1(pm,n)||(pm[n]=yO&&B1(Tu,n)?Tu[n]:_O("Symbol."+n)),pm[n]}});var dm=Z((TJ,q1)=>{"use strict";var xO=gi(),G1=yi(),k1=Nf(),EO=Of(),wO=A1(),SO=Vr(),MO=TypeError,bO=SO("toPrimitive");q1.exports=function(n,t){if(!G1(n)||k1(n))return n;var e=EO(n,bO),i;if(e){if(t===void 0&&(t="default"),i=xO(e,n,t),!G1(i)||k1(i))return i;throw new MO("Can't convert object to primitive value")}return t===void 0&&(t="number"),wO(n,t)}});var zf=Z((CJ,V1)=>{"use strict";var AO=dm(),TO=Nf();V1.exports=function(n){var t=AO(n,"string");return TO(t)?t:t+""}});var Gf=Z((IJ,W1)=>{"use strict";var CO=wn(),H1=yi(),mm=CO.document,IO=H1(mm)&&H1(mm.createElement);W1.exports=function(n){return IO?mm.createElement(n):{}}});var gm=Z((PJ,X1)=>{"use strict";var PO=ei(),RO=Un(),LO=Gf();X1.exports=!PO&&!RO(function(){return Object.defineProperty(LO("div"),"a",{get:function(){return 7}}).a!==7})});var kf=Z($1=>{"use strict";var NO=ei(),OO=gi(),DO=$x(),FO=sc(),UO=Mu(),BO=zf(),zO=to(),GO=gm(),Y1=Object.getOwnPropertyDescriptor;$1.f=NO?Y1:function(t,e){if(t=UO(t),e=BO(e),GO)try{return Y1(t,e)}catch(i){}if(zO(t,e))return FO(!OO(DO.f,t,e),t[e])}});var ym=Z((LJ,Z1)=>{"use strict";var kO=ei(),qO=Un();Z1.exports=kO&&qO(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Go=Z((NJ,J1)=>{"use strict";var VO=yi(),HO=String,WO=TypeError;J1.exports=function(n){if(VO(n))return n;throw new WO(HO(n)+" is not an object")}});var ko=Z(K1=>{"use strict";var XO=ei(),YO=gm(),$O=ym(),qf=Go(),j1=zf(),ZO=TypeError,vm=Object.defineProperty,JO=Object.getOwnPropertyDescriptor,_m="enumerable",xm="configurable",Em="writable";K1.f=XO?$O?function(t,e,i){if(qf(t),e=j1(e),qf(i),typeof t=="function"&&e==="prototype"&&"value"in i&&Em in i&&!i[Em]){var s=JO(t,e);s&&s[Em]&&(t[e]=i.value,i={configurable:xm in i?i[xm]:s[xm],enumerable:_m in i?i[_m]:s[_m],writable:!1})}return vm(t,e,i)}:vm:function(t,e,i){if(qf(t),e=j1(e),qf(i),YO)try{return vm(t,e,i)}catch(s){}if("get"in i||"set"in i)throw new ZO("Accessors not supported");return"value"in i&&(t[e]=i.value),t}});var hs=Z((DJ,Q1)=>{"use strict";var jO=ei(),KO=ko(),QO=sc();Q1.exports=jO?function(n,t,e){return KO.f(n,t,QO(1,e))}:function(n,t,e){return n[t]=e,n}});var Vf=Z((FJ,eE)=>{"use strict";var wm=ei(),tD=to(),tE=Function.prototype,eD=wm&&Object.getOwnPropertyDescriptor,Sm=tD(tE,"name"),nD=Sm&&function(){}.name==="something",rD=Sm&&(!wm||wm&&eD(tE,"name").configurable);eE.exports={EXISTS:Sm,PROPER:nD,CONFIGURABLE:rD}});var bm=Z((UJ,nE)=>{"use strict";var iD=Zn(),oD=fr(),Mm=Ff(),sD=iD(Function.toString);oD(Mm.inspectSource)||(Mm.inspectSource=function(n){return sD(n)});nE.exports=Mm.inspectSource});var oE=Z((BJ,iE)=>{"use strict";var aD=wn(),uD=fr(),rE=aD.WeakMap;iE.exports=uD(rE)&&/native code/.test(String(rE))});var Hf=Z((zJ,aE)=>{"use strict";var lD=Uf(),cD=Bf(),sE=lD("keys");aE.exports=function(n){return sE[n]||(sE[n]=cD(n))}});var Wf=Z((GJ,uE)=>{"use strict";uE.exports={}});var Pa=Z((kJ,fE)=>{"use strict";var fD=oE(),cE=wn(),hD=yi(),pD=hs(),Am=to(),Tm=Ff(),dD=Hf(),mD=Wf(),lE="Object already initialized",Cm=cE.TypeError,gD=cE.WeakMap,Xf,cc,Yf,yD=function(n){return Yf(n)?cc(n):Xf(n,{})},vD=function(n){return function(t){var e;if(!hD(t)||(e=cc(t)).type!==n)throw new Cm("Incompatible receiver, "+n+" required");return e}};fD||Tm.state?(vo=Tm.state||(Tm.state=new gD),vo.get=vo.get,vo.has=vo.has,vo.set=vo.set,Xf=function(n,t){if(vo.has(n))throw new Cm(lE);return t.facade=n,vo.set(n,t),t},cc=function(n){return vo.get(n)||{}},Yf=function(n){return vo.has(n)}):(Ia=dD("state"),mD[Ia]=!0,Xf=function(n,t){if(Am(n,Ia))throw new Cm(lE);return t.facade=n,pD(n,Ia,t),t},cc=function(n){return Am(n,Ia)?n[Ia]:{}},Yf=function(n){return Am(n,Ia)});var vo,Ia;fE.exports={set:Xf,get:cc,has:Yf,enforce:yD,getterFor:vD}});var Rm=Z((qJ,dE)=>{"use strict";var Pm=Zn(),_D=Un(),xD=fr(),$f=to(),Im=ei(),ED=Vf().CONFIGURABLE,wD=bm(),pE=Pa(),SD=pE.enforce,MD=pE.get,hE=String,Zf=Object.defineProperty,bD=Pm("".slice),AD=Pm("".replace),TD=Pm([].join),CD=Im&&!_D(function(){return Zf(function(){},"length",{value:8}).length!==8}),ID=String(String).split("String"),PD=dE.exports=function(n,t,e){bD(hE(t),0,7)==="Symbol("&&(t="["+AD(hE(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!$f(n,"name")||ED&&n.name!==t)&&(Im?Zf(n,"name",{value:t,configurable:!0}):n.name=t),CD&&e&&$f(e,"arity")&&n.length!==e.arity&&Zf(n,"length",{value:e.arity});try{e&&$f(e,"constructor")&&e.constructor?Im&&Zf(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var i=SD(n);return $f(i,"source")||(i.source=TD(ID,typeof t=="string"?t:"")),n};Function.prototype.toString=PD(function(){return xD(this)&&MD(this).source||wD(this)},"toString")});var Ra=Z((VJ,mE)=>{"use strict";var RD=fr(),LD=ko(),ND=Rm(),OD=Df();mE.exports=function(n,t,e,i){i||(i={});var s=i.enumerable,u=i.name!==void 0?i.name:t;if(RD(e)&&ND(e,u,i),i.global)s?n[t]=e:OD(t,e);else{try{i.unsafe?n[t]&&(s=!0):delete n[t]}catch(c){}s?n[t]=e:LD.f(n,t,{value:e,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return n}});var yE=Z((HJ,gE)=>{"use strict";var DD=Math.ceil,FD=Math.floor;gE.exports=Math.trunc||function(t){var e=+t;return(e>0?FD:DD)(e)}});var _o=Z((WJ,vE)=>{"use strict";var UD=yE();vE.exports=function(n){var t=+n;return t!==t||t===0?0:UD(t)}});var Jf=Z((XJ,_E)=>{"use strict";var BD=_o(),zD=Math.max,GD=Math.min;_E.exports=function(n,t){var e=BD(n);return e<0?zD(e+t,0):GD(e,t)}});var La=Z((YJ,xE)=>{"use strict";var kD=_o(),qD=Math.min;xE.exports=function(n){var t=kD(n);return t>0?qD(t,9007199254740991):0}});var eo=Z(($J,EE)=>{"use strict";var VD=La();EE.exports=function(n){return VD(n.length)}});var ME=Z((ZJ,SE)=>{"use strict";var HD=Mu(),WD=Jf(),XD=eo(),wE=function(n){return function(t,e,i){var s=HD(t),u=XD(s);if(u===0)return!n&&-1;var c=WD(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}};SE.exports={includes:wE(!0),indexOf:wE(!1)}});var Nm=Z((JJ,AE)=>{"use strict";var YD=Zn(),Lm=to(),$D=Mu(),ZD=ME().indexOf,JD=Wf(),bE=YD([].push);AE.exports=function(n,t){var e=$D(n),i=0,s=[],u;for(u in e)!Lm(JD,u)&&Lm(e,u)&&bE(s,u);for(;t.length>i;)Lm(e,u=t[i++])&&(~ZD(s,u)||bE(s,u));return s}});var jf=Z((jJ,TE)=>{"use strict";TE.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Om=Z(CE=>{"use strict";var jD=Nm(),KD=jf(),QD=KD.concat("length","prototype");CE.f=Object.getOwnPropertyNames||function(t){return jD(t,QD)}});var PE=Z(IE=>{"use strict";IE.f=Object.getOwnPropertySymbols});var LE=Z((tj,RE)=>{"use strict";var t3=bu(),e3=Zn(),n3=Om(),r3=PE(),i3=Go(),o3=e3([].concat);RE.exports=t3("Reflect","ownKeys")||function(t){var e=n3.f(i3(t)),i=r3.f;return i?o3(e,i(t)):e}});var Dm=Z((ej,OE)=>{"use strict";var NE=to(),s3=LE(),a3=kf(),u3=ko();OE.exports=function(n,t,e){for(var i=s3(t),s=u3.f,u=a3.f,c=0;c<i.length;c++){var f=i[c];!NE(n,f)&&!(e&&NE(e,f))&&s(n,f,u(t,f))}}});var FE=Z((nj,DE)=>{"use strict";var l3=Un(),c3=fr(),f3=/#|\.prototype\./,fc=function(n,t){var e=p3[h3(n)];return e===m3?!0:e===d3?!1:c3(t)?l3(t):!!t},h3=fc.normalize=function(n){return String(n).replace(f3,".").toLowerCase()},p3=fc.data={},d3=fc.NATIVE="N",m3=fc.POLYFILL="P";DE.exports=fc});var qo=Z((rj,UE)=>{"use strict";var Kf=wn(),g3=kf().f,y3=hs(),v3=Ra(),_3=Df(),x3=Dm(),E3=FE();UE.exports=function(n,t){var e=n.target,i=n.global,s=n.stat,u,c,f,p,d,m;if(i?c=Kf:s?c=Kf[e]||_3(e,{}):c=Kf[e]&&Kf[e].prototype,c)for(f in t){if(d=t[f],n.dontCallGetSet?(m=g3(c,f),p=m&&m.value):p=c[f],u=E3(i?f:e+(s?".":"#")+f,n.forced),!u&&p!==void 0){if(typeof d==typeof p)continue;x3(d,p)}(n.sham||p&&p.sham)&&y3(d,"sham",!0),v3(c,f,d,n)}}});var Fm=Z((ij,BE)=>{"use strict";var w3=Gs();BE.exports=Array.isArray||function(t){return w3(t)==="Array"}});var GE=Z((oj,zE)=>{"use strict";var S3=ei(),M3=Fm(),b3=TypeError,A3=Object.getOwnPropertyDescriptor,T3=S3&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();zE.exports=T3?function(n,t){if(M3(n)&&!A3(n,"length").writable)throw new b3("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var qE=Z((sj,kE)=>{"use strict";var C3=TypeError,I3=9007199254740991;kE.exports=function(n){if(n>I3)throw C3("Maximum allowed index exceeded");return n}});var Qf=Z(()=>{"use strict";var P3=qo(),R3=zo(),L3=eo(),N3=GE(),O3=qE(),D3=Un(),F3=D3(function(){return[].push.call({length:4294967296},1)!==4294967297}),U3=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},B3=F3||!U3();P3({target:"Array",proto:!0,arity:1,forced:B3},{push:function(t){var e=R3(this),i=L3(e),s=arguments.length;O3(i+s);for(var u=0;u<s;u++)e[i]=arguments[u],i++;return N3(e,i),i}})});var YE=Z((lj,XE)=>{"use strict";var z3=Vr(),HE=z3("iterator"),WE=!1;try{VE=0,Um={next:function(){return{done:!!VE++}},return:function(){WE=!0}},Um[HE]=function(){return this},Array.from(Um,function(){throw 2})}catch(n){}var VE,Um;XE.exports=function(n,t){try{if(!t&&!WE)return!1}catch(s){return!1}var e=!1;try{var i={};i[HE]=function(){return{next:function(){return{done:e=!0}}}},n(i)}catch(s){}return e}});var th=Z((cj,$E)=>{"use strict";$E.exports=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"});var jE=Z((fj,JE)=>{"use strict";var G3=Vr(),k3=G3("toStringTag"),ZE={};ZE[k3]="z";JE.exports=String(ZE)==="[object z]"});var ks=Z((hj,KE)=>{"use strict";var q3=jE(),V3=fr(),eh=Gs(),H3=Vr(),W3=H3("toStringTag"),X3=Object,Y3=eh(function(){return arguments}())==="Arguments",$3=function(n,t){try{return n[t]}catch(e){}};KE.exports=q3?eh:function(n){var t,e,i;return n===void 0?"Undefined":n===null?"Null":typeof(e=$3(t=X3(n),W3))=="string"?e:Y3?eh(t):(i=eh(t))==="Object"&&V3(t.callee)?"Arguments":i}});var Cu=Z((pj,tw)=>{"use strict";var QE=Rm(),Z3=ko();tw.exports=function(n,t,e){return e.get&&QE(e.get,t,{getter:!0}),e.set&&QE(e.set,t,{setter:!0}),Z3.f(n,t,e)}});var nw=Z((dj,ew)=>{"use strict";var J3=Un();ew.exports=!J3(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var hc=Z((mj,iw)=>{"use strict";var j3=to(),K3=fr(),Q3=zo(),tF=Hf(),eF=nw(),rw=tF("IE_PROTO"),Bm=Object,nF=Bm.prototype;iw.exports=eF?Bm.getPrototypeOf:function(n){var t=Q3(n);if(j3(t,rw))return t[rw];var e=t.constructor;return K3(e)&&t instanceof e?e.prototype:t instanceof Bm?nF:null}});var nh=Z((gj,ow)=>{"use strict";var rF=Zn(),iF=Ca();ow.exports=function(n,t,e){try{return rF(iF(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(i){}}});var aw=Z((yj,sw)=>{"use strict";var oF=yi();sw.exports=function(n){return oF(n)||n===null}});var lw=Z((vj,uw)=>{"use strict";var sF=aw(),aF=String,uF=TypeError;uw.exports=function(n){if(sF(n))return n;throw new uF("Can't set "+aF(n)+" as a prototype")}});var Iu=Z((_j,cw)=>{"use strict";var lF=nh(),cF=yi(),fF=Su(),hF=lw();cw.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=lF(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(i){}return function(s,u){return fF(s),hF(u),cF(s)&&(n?e(s,u):s.__proto__=u),s}}():void 0)});var Gi=Z((xj,xw)=>{"use strict";var pF=th(),qm=ei(),vi=wn(),dw=fr(),oh=yi(),Vs=to(),Vm=ks(),dF=uc(),mF=hs(),zm=Ra(),gF=Cu(),yF=ac(),sh=hc(),Ru=Iu(),vF=Vr(),_F=Bf(),mw=Pa(),gw=mw.enforce,xF=mw.get,rh=vi.Int8Array,Gm=rh&&rh.prototype,fw=vi.Uint8ClampedArray,hw=fw&&fw.prototype,Vo=rh&&sh(rh),xo=Gm&&sh(Gm),EF=Object.prototype,Hm=vi.TypeError,pw=vF("toStringTag"),km=_F("TYPED_ARRAY_TAG"),ih="TypedArrayConstructor",ps=pF&&!!Ru&&Vm(vi.opera)!=="Opera",yw=!1,Ci,qs,Pu,ds={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Wm={BigInt64Array:8,BigUint64Array:8},wF=function(t){if(!oh(t))return!1;var e=Vm(t);return e==="DataView"||Vs(ds,e)||Vs(Wm,e)},vw=function(n){var t=sh(n);if(oh(t)){var e=xF(t);return e&&Vs(e,ih)?e[ih]:vw(t)}},_w=function(n){if(!oh(n))return!1;var t=Vm(n);return Vs(ds,t)||Vs(Wm,t)},SF=function(n){if(_w(n))return n;throw new Hm("Target is not a typed array")},MF=function(n){if(dw(n)&&(!Ru||yF(Vo,n)))return n;throw new Hm(dF(n)+" is not a typed array constructor")},bF=function(n,t,e,i){if(qm){if(e)for(var s in ds){var u=vi[s];if(u&&Vs(u.prototype,n))try{delete u.prototype[n]}catch(c){try{u.prototype[n]=t}catch(f){}}}(!xo[n]||e)&&zm(xo,n,e?t:ps&&Gm[n]||t,i)}},AF=function(n,t,e){var i,s;if(qm){if(Ru){if(e){for(i in ds)if(s=vi[i],s&&Vs(s,n))try{delete s[n]}catch(u){}}if(!Vo[n]||e)try{return zm(Vo,n,e?t:ps&&Vo[n]||t)}catch(u){}else return}for(i in ds)s=vi[i],s&&(!s[n]||e)&&zm(s,n,t)}};for(Ci in ds)qs=vi[Ci],Pu=qs&&qs.prototype,Pu?gw(Pu)[ih]=qs:ps=!1;for(Ci in Wm)qs=vi[Ci],Pu=qs&&qs.prototype,Pu&&(gw(Pu)[ih]=qs);if((!ps||!dw(Vo)||Vo===Function.prototype)&&(Vo=function(){throw new Hm("Incorrect invocation")},ps))for(Ci in ds)vi[Ci]&&Ru(vi[Ci],Vo);if((!ps||!xo||xo===EF)&&(xo=Vo.prototype,ps))for(Ci in ds)vi[Ci]&&Ru(vi[Ci].prototype,xo);ps&&sh(hw)!==xo&&Ru(hw,xo);if(qm&&!Vs(xo,pw)){yw=!0,gF(xo,pw,{configurable:!0,get:function(){return oh(this)?this[km]:void 0}});for(Ci in ds)vi[Ci]&&mF(vi[Ci],km,Ci)}xw.exports={NATIVE_ARRAY_BUFFER_VIEWS:ps,TYPED_ARRAY_TAG:yw&&km,aTypedArray:SF,aTypedArrayConstructor:MF,exportTypedArrayMethod:bF,exportTypedArrayStaticMethod:AF,getTypedArrayConstructor:vw,isView:wF,isTypedArray:_w,TypedArray:Vo,TypedArrayPrototype:xo}});var Sw=Z((Ej,ww)=>{"use strict";var Ew=wn(),Xm=Un(),TF=YE(),CF=Gi().NATIVE_ARRAY_BUFFER_VIEWS,IF=Ew.ArrayBuffer,Na=Ew.Int8Array;ww.exports=!CF||!Xm(function(){Na(1)})||!Xm(function(){new Na(-1)})||!TF(function(n){new Na,new Na(null),new Na(1.5),new Na(n)},!0)||Xm(function(){return new Na(new IF(2),1,void 0).length!==1})});var bw=Z((wj,Mw)=>{"use strict";var PF=Ra();Mw.exports=function(n,t,e){for(var i in t)PF(n,i,t[i],e);return n}});var Ym=Z((Sj,Aw)=>{"use strict";var RF=ac(),LF=TypeError;Aw.exports=function(n,t){if(RF(t,n))return n;throw new LF("Incorrect invocation")}});var ah=Z((Mj,Tw)=>{"use strict";var NF=_o(),OF=La(),DF=RangeError;Tw.exports=function(n){if(n===void 0)return 0;var t=NF(n),e=OF(t);if(t!==e)throw new DF("Wrong length or index");return e}});var Iw=Z((bj,Cw)=>{"use strict";Cw.exports=Math.sign||function(t){var e=+t;return e===0||e!==e?e:e<0?-1:1}});var Lw=Z((Aj,Rw)=>{"use strict";var FF=2220446049250313e-31,Pw=1/FF;Rw.exports=function(n){return n+Pw-Pw}});var Ow=Z((Tj,Nw)=>{"use strict";var UF=Iw(),BF=Lw(),zF=Math.abs,GF=2220446049250313e-31;Nw.exports=function(n,t,e,i){var s=+n,u=zF(s),c=UF(s);if(u<i)return c*BF(u/i/t)*i*t;var f=(1+t/GF)*u,p=f-(f-u);return p>e||p!==p?c*(1/0):c*p}});var Fw=Z((Cj,Dw)=>{"use strict";var kF=Ow(),qF=11920928955078125e-23,VF=34028234663852886e22,HF=11754943508222875e-54;Dw.exports=Math.fround||function(t){return kF(t,qF,VF,HF)}});var Bw=Z((Ij,Uw)=>{"use strict";var WF=Array,XF=Math.abs,ms=Math.pow,YF=Math.floor,$F=Math.log,ZF=Math.LN2,JF=function(n,t,e){var i=WF(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,m,y,v;for(n=XF(n),n!==n||n===1/0?(y=n!==n?1:0,m=u):(m=YF($F(n)/ZF),v=ms(2,-m),n*v<1&&(m--,v*=2),m+c>=1?n+=f/v:n+=f*ms(2,1-c),n*v>=2&&(m++,v/=2),m+c>=u?(y=0,m=u):m+c>=1?(y=(n*v-1)*ms(2,t),m+=c):(y=n*ms(2,c-1)*ms(2,t),m=0));t>=8;)i[d++]=y&255,y/=256,t-=8;for(m=m<<t|y,s+=t;s>0;)i[d++]=m&255,m/=256,s-=8;return i[d-1]|=p*128,i},jF=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,m;for(p>>=7;c>0;)d=d*256+n[f--],c-=8;for(m=d&(1<<-c)-1,d>>=-c,c+=t;c>0;)m=m*256+n[f--],c-=8;if(d===0)d=1-u;else{if(d===s)return m?NaN:p?-1/0:1/0;m+=ms(2,t),d-=u}return(p?-1:1)*m*ms(2,d-t)};Uw.exports={pack:JF,unpack:jF}});var $m=Z((Pj,Gw)=>{"use strict";var KF=zo(),zw=Jf(),QF=eo();Gw.exports=function(t){for(var e=KF(this),i=QF(e),s=arguments.length,u=zw(s>1?arguments[1]:void 0,i),c=s>2?arguments[2]:void 0,f=c===void 0?i:zw(c,i);f>u;)e[u++]=t;return e}});var Zm=Z((Rj,kw)=>{"use strict";var tU=Zn();kw.exports=tU([].slice)});var Jm=Z((Lj,Vw)=>{"use strict";var eU=fr(),nU=yi(),qw=Iu();Vw.exports=function(n,t,e){var i,s;return qw&&eU(i=t.constructor)&&i!==e&&nU(s=i.prototype)&&s!==e.prototype&&qw(n,s),n}});var pc=Z((Nj,Ww)=>{"use strict";var rU=ko().f,iU=to(),oU=Vr(),Hw=oU("toStringTag");Ww.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!iU(n,Hw)&&rU(n,Hw,{configurable:!0,value:t})}});var dh=Z((Oj,uS)=>{"use strict";var hh=wn(),eg=Zn(),jm=ei(),sU=th(),rS=Vf(),aU=hs(),uU=Cu(),Xw=bw(),Km=Un(),uh=Ym(),lU=_o(),cU=La(),ch=ah(),fU=Fw(),iS=Bw(),hU=hc(),Yw=Iu(),pU=$m(),dU=Zm(),mU=Jm(),gU=Dm(),oS=pc(),ng=Pa(),yU=rS.PROPER,$w=rS.CONFIGURABLE,Nu="ArrayBuffer",ph="DataView",Ou="prototype",vU="Wrong length",sS="Wrong index",Zw=ng.getterFor(Nu),mc=ng.getterFor(ph),Jw=ng.set,Eo=hh[Nu],ki=Eo,Lu=ki&&ki[Ou],Ho=hh[ph],Oa=Ho&&Ho[Ou],jw=Object.prototype,_U=hh.Array,fh=hh.RangeError,xU=eg(pU),EU=eg([].reverse),aS=iS.pack,Kw=iS.unpack,Qw=function(n){return[n&255]},tS=function(n){return[n&255,n>>8&255]},eS=function(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]},nS=function(n){return n[3]<<24|n[2]<<16|n[1]<<8|n[0]},wU=function(n){return aS(fU(n),23,4)},SU=function(n){return aS(n,52,8)},lh=function(n,t,e){uU(n[Ou],t,{configurable:!0,get:function(){return e(this)[t]}})},Hs=function(n,t,e,i){var s=mc(n),u=ch(e),c=!!i;if(u+t>s.byteLength)throw new fh(sS);var f=s.bytes,p=u+s.byteOffset,d=dU(f,p,p+t);return c?d:EU(d)},Ws=function(n,t,e,i,s,u){var c=mc(n),f=ch(e),p=i(+s),d=!!u;if(f+t>c.byteLength)throw new fh(sS);for(var m=c.bytes,y=f+c.byteOffset,v=0;v<t;v++)m[y+v]=p[d?v:t-v-1]};sU?(Qm=yU&&Eo.name!==Nu,!Km(function(){Eo(1)})||!Km(function(){new Eo(-1)})||Km(function(){return new Eo,new Eo(1.5),new Eo(NaN),Eo.length!==1||Qm&&!$w})?(ki=function(t){return uh(this,Lu),mU(new Eo(ch(t)),this,ki)},ki[Ou]=Lu,Lu.constructor=ki,gU(ki,Eo)):Qm&&$w&&aU(Eo,"name",Nu),Yw&&hU(Oa)!==jw&&Yw(Oa,jw),dc=new Ho(new ki(2)),tg=eg(Oa.setInt8),dc.setInt8(0,2147483648),dc.setInt8(1,2147483649),(dc.getInt8(0)||!dc.getInt8(1))&&Xw(Oa,{setInt8:function(t,e){tg(this,t,e<<24>>24)},setUint8:function(t,e){tg(this,t,e<<24>>24)}},{unsafe:!0})):(ki=function(t){uh(this,Lu);var e=ch(t);Jw(this,{type:Nu,bytes:xU(_U(e),0),byteLength:e}),jm||(this.byteLength=e,this.detached=!1)},Lu=ki[Ou],Ho=function(t,e,i){uh(this,Oa),uh(t,Lu);var s=Zw(t),u=s.byteLength,c=lU(e);if(c<0||c>u)throw new fh("Wrong offset");if(i=i===void 0?u-c:cU(i),c+i>u)throw new fh(vU);Jw(this,{type:ph,buffer:t,byteLength:i,byteOffset:c,bytes:s.bytes}),jm||(this.buffer=t,this.byteLength=i,this.byteOffset=c)},Oa=Ho[Ou],jm&&(lh(ki,"byteLength",Zw),lh(Ho,"buffer",mc),lh(Ho,"byteLength",mc),lh(Ho,"byteOffset",mc)),Xw(Oa,{getInt8:function(t){return Hs(this,1,t)[0]<<24>>24},getUint8:function(t){return Hs(this,1,t)[0]},getInt16:function(t){var e=Hs(this,2,t,arguments.length>1?arguments[1]:!1);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=Hs(this,2,t,arguments.length>1?arguments[1]:!1);return e[1]<<8|e[0]},getInt32:function(t){return nS(Hs(this,4,t,arguments.length>1?arguments[1]:!1))},getUint32:function(t){return nS(Hs(this,4,t,arguments.length>1?arguments[1]:!1))>>>0},getFloat32:function(t){return Kw(Hs(this,4,t,arguments.length>1?arguments[1]:!1),23)},getFloat64:function(t){return Kw(Hs(this,8,t,arguments.length>1?arguments[1]:!1),52)},setInt8:function(t,e){Ws(this,1,t,Qw,e)},setUint8:function(t,e){Ws(this,1,t,Qw,e)},setInt16:function(t,e){Ws(this,2,t,tS,e,arguments.length>2?arguments[2]:!1)},setUint16:function(t,e){Ws(this,2,t,tS,e,arguments.length>2?arguments[2]:!1)},setInt32:function(t,e){Ws(this,4,t,eS,e,arguments.length>2?arguments[2]:!1)},setUint32:function(t,e){Ws(this,4,t,eS,e,arguments.length>2?arguments[2]:!1)},setFloat32:function(t,e){Ws(this,4,t,wU,e,arguments.length>2?arguments[2]:!1)},setFloat64:function(t,e){Ws(this,8,t,SU,e,arguments.length>2?arguments[2]:!1)}}));var Qm,dc,tg;oS(ki,Nu);oS(Ho,ph);uS.exports={ArrayBuffer:ki,DataView:Ho}});var cS=Z((Dj,lS)=>{"use strict";var MU=yi(),bU=Math.floor;lS.exports=Number.isInteger||function(t){return!MU(t)&&isFinite(t)&&bU(t)===t}});var hS=Z((Fj,fS)=>{"use strict";var AU=_o(),TU=RangeError;fS.exports=function(n){var t=AU(n);if(t<0)throw new TU("The argument can't be less than 0");return t}});var rg=Z((Uj,pS)=>{"use strict";var CU=hS(),IU=RangeError;pS.exports=function(n,t){var e=CU(n);if(e%t)throw new IU("Wrong offset");return e}});var mS=Z((Bj,dS)=>{"use strict";var PU=Math.round;dS.exports=function(n){var t=PU(n);return t<0?0:t>255?255:t&255}});var yS=Z((zj,gS)=>{"use strict";var RU=Nm(),LU=jf();gS.exports=Object.keys||function(t){return RU(t,LU)}});var _S=Z(vS=>{"use strict";var NU=ei(),OU=ym(),DU=ko(),FU=Go(),UU=Mu(),BU=yS();vS.f=NU&&!OU?Object.defineProperties:function(t,e){FU(t);for(var i=UU(e),s=BU(e),u=s.length,c=0,f;u>c;)DU.f(t,f=s[c++],i[f]);return t}});var ES=Z((kj,xS)=>{"use strict";var zU=bu();xS.exports=zU("document","documentElement")});var Du=Z((qj,CS)=>{"use strict";var GU=Go(),kU=_S(),wS=jf(),qU=Wf(),VU=ES(),HU=Gf(),WU=Hf(),SS=">",MS="<",og="prototype",sg="script",AS=WU("IE_PROTO"),ig=function(){},TS=function(n){return MS+sg+SS+n+MS+"/"+sg+SS},bS=function(n){n.write(TS("")),n.close();var t=n.parentWindow.Object;return n=null,t},XU=function(){var n=HU("iframe"),t="java"+sg+":",e;return n.style.display="none",VU.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(TS("document.F=Object")),e.close(),e.F},mh,gh=function(){try{mh=new ActiveXObject("htmlfile")}catch(t){}gh=typeof document!="undefined"?document.domain&&mh?bS(mh):XU():bS(mh);for(var n=wS.length;n--;)delete gh[og][wS[n]];return gh()};qU[AS]=!0;CS.exports=Object.create||function(t,e){var i;return t!==null?(ig[og]=GU(t),i=new ig,ig[og]=null,i[AS]=t):i=gh(),e===void 0?i:kU.f(i,e)}});var yh=Z((Vj,IS)=>{"use strict";var YU=Gs(),$U=Zn();IS.exports=function(n){if(YU(n)==="Function")return $U(n)}});var vh=Z((Hj,RS)=>{"use strict";var PS=yh(),ZU=Ca(),JU=oc(),jU=PS(PS.bind);RS.exports=function(n,t){return ZU(n),t===void 0?n:JU?jU(n,t):function(){return n.apply(t,arguments)}}});var ug=Z((Wj,FS)=>{"use strict";var KU=Zn(),QU=Un(),LS=fr(),tB=ks(),eB=bu(),nB=bm(),NS=function(){},OS=eB("Reflect","construct"),ag=/^\s*(?:class|function)\b/,rB=KU(ag.exec),iB=!ag.test(NS),gc=function(t){if(!LS(t))return!1;try{return OS(NS,[],t),!0}catch(e){return!1}},DS=function(t){if(!LS(t))return!1;switch(tB(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return iB||!!rB(ag,nB(t))}catch(e){return!0}};DS.sham=!0;FS.exports=!OS||QU(function(){var n;return gc(gc.call)||!gc(Object)||!gc(function(){n=!0})||n})?DS:gc});var BS=Z((Xj,US)=>{"use strict";var oB=ug(),sB=uc(),aB=TypeError;US.exports=function(n){if(oB(n))return n;throw new aB(sB(n)+" is not a constructor")}});var Fu=Z((Yj,zS)=>{"use strict";zS.exports={}});var lg=Z(($j,kS)=>{"use strict";var uB=ks(),GS=Of(),lB=Pf(),cB=Fu(),fB=Vr(),hB=fB("iterator");kS.exports=function(n){if(!lB(n))return GS(n,hB)||GS(n,"@@iterator")||cB[uB(n)]}});var VS=Z((Zj,qS)=>{"use strict";var pB=gi(),dB=Ca(),mB=Go(),gB=uc(),yB=lg(),vB=TypeError;qS.exports=function(n,t){var e=arguments.length<2?yB(n):t;if(dB(e))return mB(pB(e,n));throw new vB(gB(n)+" is not iterable")}});var WS=Z((Jj,HS)=>{"use strict";var _B=Vr(),xB=Fu(),EB=_B("iterator"),wB=Array.prototype;HS.exports=function(n){return n!==void 0&&(xB.Array===n||wB[EB]===n)}});var cg=Z((jj,XS)=>{"use strict";var SB=ks();XS.exports=function(n){var t=SB(n);return t==="BigInt64Array"||t==="BigUint64Array"}});var _h=Z((Kj,YS)=>{"use strict";var MB=dm(),bB=TypeError;YS.exports=function(n){var t=MB(n,"number");if(typeof t=="number")throw new bB("Can't convert number to bigint");return BigInt(t)}});var ZS=Z((Qj,$S)=>{"use strict";var AB=vh(),TB=gi(),CB=BS(),IB=zo(),PB=eo(),RB=VS(),LB=lg(),NB=WS(),OB=cg(),DB=Gi().aTypedArrayConstructor,FB=_h();$S.exports=function(t){var e=CB(this),i=IB(t),s=arguments.length,u=s>1?arguments[1]:void 0,c=u!==void 0,f=LB(i),p,d,m,y,v,E,M,A;if(f&&!NB(f))for(M=RB(i,f),A=M.next,i=[];!(E=TB(A,M)).done;)i.push(E.value);for(c&&s>2&&(u=AB(u,arguments[2])),d=PB(i),m=new(DB(e))(d),y=OB(m),p=0;d>p;p++)v=c?u(i[p],p):i[p],m[p]=y?FB(v):+v;return m}});var QS=Z((tK,KS)=>{"use strict";var JS=Fm(),UB=ug(),BB=yi(),zB=Vr(),GB=zB("species"),jS=Array;KS.exports=function(n){var t;return JS(n)&&(t=n.constructor,UB(t)&&(t===jS||JS(t.prototype))?t=void 0:BB(t)&&(t=t[GB],t===null&&(t=void 0))),t===void 0?jS:t}});var eM=Z((eK,tM)=>{"use strict";var kB=QS();tM.exports=function(n,t){return new(kB(n))(t===0?0:t)}});var iM=Z((nK,rM)=>{"use strict";var qB=vh(),VB=Zn(),HB=If(),WB=zo(),XB=eo(),YB=eM(),nM=VB([].push),Xs=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,m,y){for(var v=WB(p),E=HB(v),M=XB(E),A=qB(d,m),_=0,x=y||YB,T=t?x(p,M):e||c?x(p,0):void 0,S,R;M>_;_++)if((f||_ in E)&&(S=E[_],R=A(S,_,v),n))if(t)T[_]=R;else if(R)switch(n){case 3:return!0;case 5:return S;case 6:return _;case 2:nM(T,S)}else switch(n){case 4:return!1;case 7:nM(T,S)}return u?-1:i||s?s:T}};rM.exports={forEach:Xs(0),map:Xs(1),filter:Xs(2),some:Xs(3),every:Xs(4),find:Xs(5),findIndex:Xs(6),filterReject:Xs(7)}});var fg=Z((rK,sM)=>{"use strict";var $B=bu(),ZB=Cu(),JB=Vr(),jB=ei(),oM=JB("species");sM.exports=function(n){var t=$B(n);jB&&t&&!t[oM]&&ZB(t,oM,{configurable:!0,get:function(){return this}})}});var hg=Z((iK,aM)=>{"use strict";var KB=eo();aM.exports=function(n,t,e){for(var i=0,s=arguments.length>2?e:KB(t),u=new n(s);s>i;)u[i]=t[i++];return u}});var TM=Z((oK,_g)=>{"use strict";var uM=qo(),_M=wn(),lM=gi(),QB=ei(),tz=Sw(),xc=Gi(),xM=dh(),cM=Ym(),ez=sc(),yc=hs(),nz=cS(),rz=La(),fM=ah(),pg=rg(),iz=mS(),EM=zf(),vc=to(),oz=ks(),gg=yi(),sz=Nf(),az=Du(),uz=ac(),xh=Iu(),lz=Om().f,hM=ZS(),cz=iM().forEach,fz=fg(),hz=Cu(),wM=ko(),SM=kf(),pM=hg(),xg=Pa(),pz=Jm(),yg=xg.get,dz=xg.set,mz=xg.enforce,MM=wM.f,gz=SM.f,dg=_M.RangeError,bM=xM.ArrayBuffer,yz=bM.prototype,vz=xM.DataView,Eh=xc.NATIVE_ARRAY_BUFFER_VIEWS,dM=xc.TYPED_ARRAY_TAG,mM=xc.TypedArray,_c=xc.TypedArrayPrototype,vg=xc.isTypedArray,wh="BYTES_PER_ELEMENT",mg="Wrong length",Sh=function(n,t){hz(n,t,{configurable:!0,get:function(){return yg(this)[t]}})},gM=function(n){var t;return uz(yz,n)||(t=oz(n))==="ArrayBuffer"||t==="SharedArrayBuffer"},AM=function(n,t){return vg(n)&&!sz(t)&&t in n&&nz(+t)&&t>=0},yM=function(t,e){return e=EM(e),AM(t,e)?ez(2,t[e]):gz(t,e)},vM=function(t,e,i){return e=EM(e),AM(t,e)&&gg(i)&&vc(i,"value")&&!vc(i,"get")&&!vc(i,"set")&&!i.configurable&&(!vc(i,"writable")||i.writable)&&(!vc(i,"enumerable")||i.enumerable)?(t[e]=i.value,t):MM(t,e,i)};QB?(Eh||(SM.f=yM,wM.f=vM,Sh(_c,"buffer"),Sh(_c,"byteOffset"),Sh(_c,"byteLength"),Sh(_c,"length")),uM({target:"Object",stat:!0,forced:!Eh},{getOwnPropertyDescriptor:yM,defineProperty:vM}),_g.exports=function(n,t,e){var i=n.match(/\d+/)[0]/8,s=n+(e?"Clamped":"")+"Array",u="get"+n,c="set"+n,f=_M[s],p=f,d=p&&p.prototype,m={},y=function(A,_){var x=yg(A);return x.view[u](_*i+x.byteOffset,!0)},v=function(A,_,x){var T=yg(A);T.view[c](_*i+T.byteOffset,e?iz(x):x,!0)},E=function(A,_){MM(A,_,{get:function(){return y(this,_)},set:function(x){return v(this,_,x)},enumerable:!0})};Eh?tz&&(p=t(function(A,_,x,T){return cM(A,d),pz(function(){return gg(_)?gM(_)?T!==void 0?new f(_,pg(x,i),T):x!==void 0?new f(_,pg(x,i)):new f(_):vg(_)?pM(p,_):lM(hM,p,_):new f(fM(_))}(),A,p)}),xh&&xh(p,mM),cz(lz(f),function(A){A in p||yc(p,A,f[A])}),p.prototype=d):(p=t(function(A,_,x,T){cM(A,d);var S=0,R=0,z,U,D;if(!gg(_))D=fM(_),U=D*i,z=new bM(U);else if(gM(_)){z=_,R=pg(x,i);var P=_.byteLength;if(T===void 0){if(P%i)throw new dg(mg);if(U=P-R,U<0)throw new dg(mg)}else if(U=rz(T)*i,U+R>P)throw new dg(mg);D=U/i}else return vg(_)?pM(p,_):lM(hM,p,_);for(dz(A,{buffer:z,byteOffset:R,byteLength:U,length:D,view:new vz(z)});S<D;)E(A,S++)}),xh&&xh(p,mM),d=p.prototype=az(_c)),d.constructor!==p&&yc(d,"constructor",p),mz(d).TypedArrayConstructor=p,dM&&yc(d,dM,s);var M=p!==f;m[s]=p,uM({global:!0,constructor:!0,forced:M,sham:!Eh},m),wh in p||yc(p,wh,i),wh in d||yc(d,wh,i),fz(s)}):_g.exports=function(){}});var Eg=Z(()=>{"use strict";var _z=TM();_z("Float32",function(n){return function(e,i,s){return n(this,e,i,s)}})});var wg=Z(()=>{"use strict";var CM=Gi(),xz=eo(),Ez=_o(),wz=CM.aTypedArray,Sz=CM.exportTypedArrayMethod;Sz("at",function(t){var e=wz(this),i=xz(e),s=Ez(t),u=s>=0?s:i+s;return u<0||u>=i?void 0:e[u]})});var Sg=Z(()=>{"use strict";var IM=Gi(),Mz=$m(),bz=_h(),Az=ks(),Tz=gi(),Cz=Zn(),Iz=Un(),Pz=IM.aTypedArray,Rz=IM.exportTypedArrayMethod,Lz=Cz("".slice),Nz=Iz(function(){var n=0;return new Int8Array(2).fill({valueOf:function(){return n++}}),n!==1});Rz("fill",function(t){var e=arguments.length;Pz(this);var i=Lz(Az(this),0,3)==="Big"?bz(t):+t;return Tz(Mz,this,i,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},Nz)});var Mg=Z((hK,RM)=>{"use strict";var Oz=vh(),Dz=If(),Fz=zo(),Uz=eo(),PM=function(n){var t=n===1;return function(e,i,s){for(var u=Fz(e),c=Dz(u),f=Uz(c),p=Oz(i,s),d,m;f-- >0;)if(d=c[f],m=p(d,f,u),m)switch(n){case 0:return d;case 1:return f}return t?-1:void 0}};RM.exports={findLast:PM(0),findLastIndex:PM(1)}});var bg=Z(()=>{"use strict";var LM=Gi(),Bz=Mg().findLast,zz=LM.aTypedArray,Gz=LM.exportTypedArrayMethod;Gz("findLast",function(t){return Bz(zz(this),t,arguments.length>1?arguments[1]:void 0)})});var Ag=Z(()=>{"use strict";var NM=Gi(),kz=Mg().findLastIndex,qz=NM.aTypedArray,Vz=NM.exportTypedArrayMethod;Vz("findLastIndex",function(t){return kz(qz(this),t,arguments.length>1?arguments[1]:void 0)})});var Pg=Z(()=>{"use strict";var DM=wn(),FM=gi(),Ig=Gi(),Hz=eo(),Wz=rg(),Xz=zo(),UM=Un(),Yz=DM.RangeError,Tg=DM.Int8Array,OM=Tg&&Tg.prototype,BM=OM&&OM.set,$z=Ig.aTypedArray,Zz=Ig.exportTypedArrayMethod,Cg=!UM(function(){var n=new Uint8ClampedArray(2);return FM(BM,n,{length:1,0:3},1),n[1]!==3}),Jz=Cg&&Ig.NATIVE_ARRAY_BUFFER_VIEWS&&UM(function(){var n=new Tg(2);return n.set(1),n.set("2",1),n[0]!==0||n[1]!==2});Zz("set",function(t){$z(this);var e=Wz(arguments.length>1?arguments[1]:void 0,1),i=Xz(t);if(Cg)return FM(BM,this,i,e);var s=this.length,u=Hz(i),c=0;if(u+e>s)throw new Yz("Wrong length");for(;c<u;)this[e+c]=i[c++]},!Cg||Jz)});var kM=Z((_K,GM)=>{"use strict";var zM=Zm(),jz=Math.floor,Rg=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=jz(e/2),f=Rg(zM(n,0,c),t),p=Rg(zM(n,c),t),d=f.length,m=p.length,y=0,v=0;y<d||v<m;)n[y+v]=y<d&&v<m?t(f[y],p[v])<=0?f[y++]:p[v++]:y<d?f[y++]:p[v++];return n};GM.exports=Rg});var HM=Z((xK,VM)=>{"use strict";var Kz=Au(),qM=Kz.match(/firefox\/(\d+)/i);VM.exports=!!qM&&+qM[1]});var XM=Z((EK,WM)=>{"use strict";var Qz=Au();WM.exports=/MSIE|Trident/.test(Qz)});var ZM=Z((wK,$M)=>{"use strict";var tG=Au(),YM=tG.match(/AppleWebKit\/(\d+)\./);$M.exports=!!YM&&+YM[1]});var Ng=Z(()=>{"use strict";var eG=wn(),nG=yh(),Lg=Un(),rG=Ca(),iG=kM(),tb=Gi(),JM=HM(),oG=XM(),jM=Lf(),KM=ZM(),sG=tb.aTypedArray,aG=tb.exportTypedArrayMethod,Ec=eG.Uint16Array,Uu=Ec&&nG(Ec.prototype.sort),uG=!!Uu&&!(Lg(function(){Uu(new Ec(2),null)})&&Lg(function(){Uu(new Ec(2),{})})),QM=!!Uu&&!Lg(function(){if(jM)return jM<74;if(JM)return JM<67;if(oG)return!0;if(KM)return KM<602;var n=new Ec(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(Uu(n,function(s,u){return(s/4|0)-(u/4|0)}),e=0;e<516;e++)if(n[e]!==t[e])return!0}),lG=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}};aG("sort",function(t){return t!==void 0&&rG(t),QM?Uu(this,t):iG(sG(this),lG(t))},!QM||uG)});var nb=Z((bK,eb)=>{"use strict";var cG=eo();eb.exports=function(n,t){for(var e=cG(n),i=new t(e),s=0;s<e;s++)i[s]=n[e-s-1];return i}});var Dg=Z(()=>{"use strict";var fG=nb(),Og=Gi(),hG=Og.aTypedArray,pG=Og.exportTypedArrayMethod,dG=Og.getTypedArrayConstructor;pG("toReversed",function(){return fG(hG(this),dG(this))})});var Fg=Z(()=>{"use strict";var Mh=Gi(),mG=Zn(),gG=Ca(),yG=hg(),vG=Mh.aTypedArray,_G=Mh.getTypedArrayConstructor,xG=Mh.exportTypedArrayMethod,EG=mG(Mh.TypedArrayPrototype.sort);xG("toSorted",function(t){t!==void 0&&gG(t);var e=vG(this),i=yG(_G(e),e);return EG(i,t)})});var ib=Z((PK,rb)=>{"use strict";var wG=eo(),SG=_o(),MG=RangeError;rb.exports=function(n,t,e,i){var s=wG(n),u=SG(e),c=u<0?s+u:u;if(c>=s||c<0)throw new MG("Incorrect index");for(var f=new t(s),p=0;p<s;p++)f[p]=p===c?i:n[p];return f}});var Bg=Z(()=>{"use strict";var bG=ib(),Ug=Gi(),AG=cg(),TG=_o(),CG=_h(),IG=Ug.aTypedArray,PG=Ug.getTypedArrayConstructor,RG=Ug.exportTypedArrayMethod,LG=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(n){return n===8}}();RG("with",function(n,t){var e=IG(this),i=TG(n),s=AG(e)?CG(t):+t;return bG(e,PG(e),i,s)},!LG)});var Gg=Z(()=>{"use strict";var NG=qo(),OG=wn(),DG=dh(),FG=fg(),zg="ArrayBuffer",ob=DG[zg],UG=OG[zg];NG({global:!0,constructor:!0,forced:UG!==ob},{ArrayBuffer:ob});FG(zg)});var Hg=Z(()=>{"use strict";var BG=qo(),qg=yh(),zG=Un(),lb=dh(),sb=Go(),ab=Jf(),GG=La(),Vg=lb.ArrayBuffer,kg=lb.DataView,cb=kg.prototype,ub=qg(Vg.prototype.slice),kG=qg(cb.getUint8),qG=qg(cb.setUint8),VG=zG(function(){return!new Vg(2).slice(1,void 0).byteLength});BG({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:VG},{slice:function(t,e){if(ub&&e===void 0)return ub(sb(this),t);for(var i=sb(this).byteLength,s=ab(t,i),u=ab(e===void 0?i:e,i),c=new Vg(GG(u-s)),f=new kg(this),p=new kg(c),d=0;s<u;)qG(p,d++,kG(f,s++));return c}})});var Wg=Z((UK,pb)=>{"use strict";var hb=wn(),HG=nh(),WG=Gs(),fb=hb.ArrayBuffer,XG=hb.TypeError;pb.exports=fb&&HG(fb.prototype,"byteLength","get")||function(n){if(WG(n)!=="ArrayBuffer")throw new XG("ArrayBuffer expected");return n.byteLength}});var Xg=Z((BK,db)=>{"use strict";var YG=wn(),$G=th(),ZG=Wg(),JG=YG.DataView;db.exports=function(n){if(!$G||ZG(n)!==0)return!1;try{return new JG(n),!1}catch(t){return!0}}});var Yg=Z(()=>{"use strict";var jG=ei(),KG=Cu(),QG=Xg(),mb=ArrayBuffer.prototype;jG&&!("detached"in mb)&&KG(mb,"detached",{configurable:!0,get:function(){return QG(this)}})});var yb=Z((kK,gb)=>{"use strict";var t4=Xg(),e4=TypeError;gb.exports=function(n){if(t4(n))throw new e4("ArrayBuffer is detached");return n}});var $g=Z((qK,vb)=>{"use strict";var wc=wn(),n4=Au(),r4=Gs(),bh=function(n){return n4.slice(0,n.length)===n};vb.exports=function(){return bh("Bun/")?"BUN":bh("Cloudflare-Workers")?"CLOUDFLARE":bh("Deno/")?"DENO":bh("Node.js/")?"NODE":wc.Bun&&typeof Bun.version=="string"?"BUN":wc.Deno&&typeof Deno.version=="object"?"DENO":r4(wc.process)==="process"?"NODE":wc.window&&wc.document?"BROWSER":"REST"}()});var xb=Z((VK,_b)=>{"use strict";var i4=$g();_b.exports=i4==="NODE"});var wb=Z((HK,Eb)=>{"use strict";var o4=wn(),s4=xb();Eb.exports=function(n){if(s4){try{return o4.process.getBuiltinModule(n)}catch(t){}try{return Function('return require("'+n+'")')()}catch(t){}}}});var jg=Z((WK,Mb)=>{"use strict";var a4=wn(),u4=Un(),Zg=Lf(),Jg=$g(),Sb=a4.structuredClone;Mb.exports=!!Sb&&!u4(function(){if(Jg==="DENO"&&Zg>92||Jg==="NODE"&&Zg>94||Jg==="BROWSER"&&Zg>97)return!1;var n=new ArrayBuffer(8),t=Sb(n,{transfer:[n]});return n.byteLength!==0||t.byteLength!==8})});var Cb=Z((XK,Tb)=>{"use strict";var e0=wn(),l4=wb(),c4=jg(),f4=e0.structuredClone,bb=e0.ArrayBuffer,Ah=e0.MessageChannel,t0=!1,Kg,Ab,Th,Qg;if(c4)t0=function(n){f4(n,{transfer:[n]})};else if(bb)try{Ah||(Kg=l4("worker_threads"),Kg&&(Ah=Kg.MessageChannel)),Ah&&(Ab=new Ah,Th=new bb(2),Qg=function(n){Ab.port1.postMessage(null,[n])},Th.byteLength===2&&(Qg(Th),Th.byteLength===0&&(t0=Qg)))}catch(n){}Tb.exports=t0});var a0=Z((YK,Db)=>{"use strict";var i0=wn(),o0=Zn(),Lb=nh(),h4=ah(),p4=yb(),d4=Wg(),Ib=Cb(),n0=jg(),m4=i0.structuredClone,Nb=i0.ArrayBuffer,r0=i0.DataView,g4=Math.min,s0=Nb.prototype,Ob=r0.prototype,y4=o0(s0.slice),Pb=Lb(s0,"resizable","get"),Rb=Lb(s0,"maxByteLength","get"),v4=o0(Ob.getInt8),_4=o0(Ob.setInt8);Db.exports=(n0||Ib)&&function(n,t,e){var i=d4(n),s=t===void 0?i:h4(t),u=!Pb||!Pb(n),c;if(p4(n),n0&&(n=m4(n,{transfer:[n]}),i===s&&(e||u)))return n;if(i>=s&&(!e||u))c=y4(n,0,s);else{var f=e&&!u&&Rb?{maxByteLength:Rb(n)}:void 0;c=new Nb(s,f);for(var p=new r0(n),d=new r0(c),m=g4(s,i),y=0;y<m;y++)_4(d,y,v4(p,y))}return n0||Ib(n),c}});var u0=Z(()=>{"use strict";var x4=qo(),Fb=a0();Fb&&x4({target:"ArrayBuffer",proto:!0},{transfer:function(){return Fb(this,arguments.length?arguments[0]:void 0,!0)}})});var l0=Z(()=>{"use strict";var E4=qo(),Ub=a0();Ub&&E4({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return Ub(this,arguments.length?arguments[0]:void 0,!1)}})});var Bb=Z(()=>{"use strict";var w4=qo(),S4=gi();w4({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return S4(URL.prototype.toString,this)}})});var GT=Z((oQ,zT)=>{"use strict";zT.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 VT=Z((sQ,qT)=>{"use strict";var o8=Gf(),Jy=o8("span").classList,kT=Jy&&Jy.constructor&&Jy.constructor.prototype;qT.exports=kT===Object.prototype?void 0:kT});var WT=Z((aQ,HT)=>{"use strict";var s8=Vr(),a8=Du(),u8=ko().f,jy=s8("unscopables"),Ky=Array.prototype;Ky[jy]===void 0&&u8(Ky,jy,{configurable:!0,value:a8(null)});HT.exports=function(n){Ky[jy][n]=!0}});var nv=Z((uQ,$T)=>{"use strict";var l8=Un(),c8=fr(),f8=yi(),h8=Du(),XT=hc(),p8=Ra(),d8=Vr(),m8=lc(),ev=d8("iterator"),YT=!1,Is,Qy,tv;[].keys&&(tv=[].keys(),"next"in tv?(Qy=XT(XT(tv)),Qy!==Object.prototype&&(Is=Qy)):YT=!0);var g8=!f8(Is)||l8(function(){var n={};return Is[ev].call(n)!==n});g8?Is={}:m8&&(Is=h8(Is));c8(Is[ev])||p8(Is,ev,function(){return this});$T.exports={IteratorPrototype:Is,BUGGY_SAFARI_ITERATORS:YT}});var JT=Z((lQ,ZT)=>{"use strict";var y8=nv().IteratorPrototype,v8=Du(),_8=sc(),x8=pc(),E8=Fu(),w8=function(){return this};ZT.exports=function(n,t,e,i){var s=t+" Iterator";return n.prototype=v8(y8,{next:_8(+!i,e)}),x8(n,s,!1,!0),E8[s]=w8,n}});var aC=Z((cQ,sC)=>{"use strict";var S8=qo(),M8=gi(),Lp=lc(),iC=Vf(),b8=fr(),A8=JT(),jT=hc(),KT=Iu(),T8=pc(),C8=hs(),rv=Ra(),I8=Vr(),QT=Fu(),oC=nv(),P8=iC.PROPER,R8=iC.CONFIGURABLE,tC=oC.IteratorPrototype,Np=oC.BUGGY_SAFARI_ITERATORS,Hc=I8("iterator"),eC="keys",Wc="values",nC="entries",rC=function(){return this};sC.exports=function(n,t,e,i,s,u,c){A8(e,t,i);var f=function(x){if(x===s&&v)return v;if(!Np&&x&&x in m)return m[x];switch(x){case eC:return function(){return new e(this,x)};case Wc:return function(){return new e(this,x)};case nC:return function(){return new e(this,x)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,m=n.prototype,y=m[Hc]||m["@@iterator"]||s&&m[s],v=!Np&&y||f(s),E=t==="Array"&&m.entries||y,M,A,_;if(E&&(M=jT(E.call(new n)),M!==Object.prototype&&M.next&&(!Lp&&jT(M)!==tC&&(KT?KT(M,tC):b8(M[Hc])||rv(M,Hc,rC)),T8(M,p,!0,!0),Lp&&(QT[p]=rC))),P8&&s===Wc&&y&&y.name!==Wc&&(!Lp&&R8?C8(m,"name",Wc):(d=!0,v=function(){return M8(y,this)})),s)if(A={values:f(Wc),keys:u?v:f(eC),entries:f(nC)},c)for(_ in A)(Np||d||!(_ in m))&&rv(m,_,A[_]);else S8({target:t,proto:!0,forced:Np||d},A);return(!Lp||c)&&m[Hc]!==v&&rv(m,Hc,v,{name:s}),QT[t]=v,A}});var lC=Z((fQ,uC)=>{"use strict";uC.exports=function(n,t){return{value:n,done:t}}});var mC=Z((hQ,dC)=>{"use strict";var L8=Mu(),iv=WT(),cC=Fu(),hC=Pa(),N8=ko().f,O8=aC(),Op=lC(),D8=lc(),F8=ei(),pC="Array Iterator",U8=hC.set,B8=hC.getterFor(pC);dC.exports=O8(Array,"Array",function(n,t){U8(this,{type:pC,target:L8(n),index:0,kind:t})},function(){var n=B8(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Op(void 0,!0);switch(n.kind){case"keys":return Op(e,!1);case"values":return Op(t[e],!1)}return Op([e,t[e]],!1)},"values");var fC=cC.Arguments=cC.Array;iv("keys");iv("values");iv("entries");if(!D8&&F8&&fC.name!=="values")try{N8(fC,"name",{value:"values"})}catch(n){}});var av=Z(()=>{"use strict";var gC=wn(),vC=GT(),z8=VT(),Xc=mC(),yC=hs(),G8=pc(),k8=Vr(),ov=k8("iterator"),sv=Xc.values,_C=function(n,t){if(n){if(n[ov]!==sv)try{yC(n,ov,sv)}catch(i){n[ov]=sv}if(G8(n,t,!0),vC[t]){for(var e in Xc)if(n[e]!==Xc[e])try{yC(n,e,Xc[e])}catch(i){n[e]=Xc[e]}}}};for(Dp in vC)_C(gC[Dp]&&gC[Dp].prototype,Dp);var Dp;_C(z8,"DOMTokenList")});var Fp=Z((EQ,xC)=>{"use strict";var q8=ks(),V8=String;xC.exports=function(n){if(q8(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return V8(n)}});var wC=Z((wQ,EC)=>{"use strict";var H8=Go();EC.exports=function(){var n=H8(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 MC=Z((SQ,SC)=>{"use strict";var uv=Un(),W8=wn(),lv=W8.RegExp,cv=uv(function(){var n=lv("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),X8=cv||uv(function(){return!lv("a","y").sticky}),Y8=cv||uv(function(){var n=lv("^r","gy");return n.lastIndex=2,n.exec("str")!==null});SC.exports={BROKEN_CARET:Y8,MISSED_STICKY:X8,UNSUPPORTED_Y:cv}});var AC=Z((MQ,bC)=>{"use strict";var $8=Un(),Z8=wn(),J8=Z8.RegExp;bC.exports=$8(function(){var n=J8(".","s");return!(n.dotAll&&n.test(`
2
- `)&&n.flags==="s")})});var CC=Z((bQ,TC)=>{"use strict";var j8=Un(),K8=wn(),Q8=K8.RegExp;TC.exports=j8(function(){var n=Q8("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var zp=Z((AQ,PC)=>{"use strict";var _l=gi(),Bp=Zn(),tW=Fp(),eW=wC(),nW=MC(),rW=Uf(),iW=Du(),oW=Pa().get,sW=AC(),aW=CC(),uW=rW("native-string-replace",String.prototype.replace),Up=RegExp.prototype.exec,hv=Up,lW=Bp("".charAt),cW=Bp("".indexOf),fW=Bp("".replace),fv=Bp("".slice),pv=function(){var n=/a/,t=/b*/g;return _l(Up,n,"a"),_l(Up,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),IC=nW.BROKEN_CARET,dv=/()??/.exec("")[1]!==void 0,hW=pv||dv||IC||sW||aW;hW&&(hv=function(t){var e=this,i=oW(e),s=tW(t),u=i.raw,c,f,p,d,m,y,v;if(u)return u.lastIndex=e.lastIndex,c=_l(hv,u,s),e.lastIndex=u.lastIndex,c;var E=i.groups,M=IC&&e.sticky,A=_l(eW,e),_=e.source,x=0,T=s;if(M&&(A=fW(A,"y",""),cW(A,"g")===-1&&(A+="g"),T=fv(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&lW(s,e.lastIndex-1)!==`
3
- `)&&(_="(?: "+_+")",T=" "+T,x++),f=new RegExp("^(?:"+_+")",A)),dv&&(f=new RegExp("^"+_+"$(?!\\s)",A)),pv&&(p=e.lastIndex),d=_l(Up,M?f:e,T),M?d?(d.input=fv(d.input,x),d[0]=fv(d[0],x),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:pv&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),dv&&d&&d.length>1&&_l(uW,d[0],f,function(){for(m=1;m<arguments.length-2;m++)arguments[m]===void 0&&(d[m]=void 0)}),d&&E)for(d.groups=y=iW(null),m=0;m<E.length;m++)v=E[m],y[v[0]]=d[v[1]];return d});PC.exports=hv});var mv=Z(()=>{"use strict";var pW=qo(),RC=zp();pW({target:"RegExp",proto:!0,forced:/./.exec!==RC},{exec:RC})});var Gp=Z((DQ,OC)=>{"use strict";var NC=Object.getOwnPropertySymbols,yW=Object.prototype.hasOwnProperty,vW=Object.prototype.propertyIsEnumerable;function _W(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function xW(){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}}OC.exports=xW()?Object.assign:function(n,t){for(var e,i=_W(n),s,u=1;u<arguments.length;u++){e=Object(arguments[u]);for(var c in e)yW.call(e,c)&&(i[c]=e[c]);if(NC){s=NC(e);for(var f=0;f<s.length;f++)vW.call(e,s[f])&&(i[s[f]]=e[s[f]])}}return i}});var Ev=Z((_v,xv)=>{(function(n,t){typeof _v=="object"&&typeof xv!="undefined"?xv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(_v,function(){"use strict";function n(_,x,T,S,R){(function z(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),Y=.5*Math.exp(2*Mt/3),mt=.5*Math.sqrt(Mt*Y*(W-Y)/W)*(V-W/2<0?-1:1),ft=Math.max(P,Math.floor(D-V*Y/W+mt)),vt=Math.min(ct,Math.floor(D+(W-V)*Y/W+mt));z(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,S||_.length-1,R||e)}function t(_,x,T){var S=_[x];_[x]=_[T],_[T]=S}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 S=0;S<x.length;S++)if(T(_,x[S]))return S;return-1}function u(_,x){c(_,0,_.children.length,x,_)}function c(_,x,T,S,R){R||(R=M(null)),R.minX=1/0,R.minY=1/0,R.maxX=-1/0,R.maxY=-1/0;for(var z=x;z<T;z++){var U=_.children[z];f(R,_.leaf?S(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 m(_){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,S,R){for(var z=[x,T];z.length;)if(!((T=z.pop())-(x=z.pop())<=S)){var U=x+Math.ceil((T-x)/S/2)*S;n(_,U,x,T,R),z.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 S=this.toBBox,R=[];x;){for(var z=0;z<x.children.length;z++){var U=x.children[z],D=x.leaf?S(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 S=0;S<x.children.length;S++){var R=x.children[S],z=x.leaf?this.toBBox(R):R;if(E(_,z)){if(x.leaf||v(_,z))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 S=this.data;this.data=T,T=S}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,S,R,z=this.data,U=this.toBBox(_),D=[],P=[];z||D.length;){if(z||(z=D.pop(),S=D[D.length-1],T=P.pop(),R=!0),z.leaf){var ct=s(_,z.children,x);if(ct!==-1)return z.children.splice(ct,1),D.push(z),this._condense(D),this}R||z.leaf||!v(z,U)?S?(T++,z=S.children[T],R=!1):z=null:(D.push(z),P.push(T),T=0,S=z,z=z.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,S){var R,z=T-x+1,U=this._maxEntries;if(z<=U)return u(R=M(_.slice(x,T+1)),this.toBBox),R;S||(S=Math.ceil(Math.log(z)/Math.log(U)),U=Math.ceil(z/Math.pow(U,S-1))),(R=M([])).leaf=!1,R.height=S;var D=Math.ceil(z/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,S-1))}}return u(R,this.toBBox),R},i.prototype._chooseSubtree=function(_,x,T,S){for(;S.push(x),!x.leaf&&S.length-1!==T;){for(var R=1/0,z=1/0,U=void 0,D=0;D<x.children.length;D++){var P=x.children[D],ct=m(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<z?(z=L,R=ct<R?ct:R,U=P):L===z&&ct<R&&(R=ct,U=P)}x=U||x.children[0]}var W,V;return x},i.prototype._insert=function(_,x,T){var S=T?_:this.toBBox(_),R=[],z=this._chooseSubtree(S,this.data,x,R);for(z.children.push(_),f(z,S);x>=0&&R[x].children.length>this._maxEntries;)this._split(R,x),x--;this._adjustParentBBoxes(S,R,x)},i.prototype._split=function(_,x){var T=_[x],S=T.children.length,R=this._minEntries;this._chooseSplitAxis(T,R,S);var z=this._chooseSplitIndex(T,R,S),U=M(T.children.splice(z,T.children.length-z));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 S,R,z,U,D,P,ct,L=1/0,W=1/0,V=x;V<=T-x;V++){var Mt=c(_,0,V,this.toBBox),Y=c(_,V,T,this.toBBox),mt=(R=Mt,z=Y,U=void 0,D=void 0,P=void 0,ct=void 0,U=Math.max(R.minX,z.minX),D=Math.max(R.minY,z.minY),P=Math.min(R.maxX,z.maxX),ct=Math.min(R.maxY,z.maxY),Math.max(0,P-U)*Math.max(0,ct-D)),ft=m(Mt)+m(Y);mt<L?(L=mt,S=V,W=ft<W?ft:W):mt===L&&ft<W&&(W=ft,S=V)}return S||T-x},i.prototype._chooseSplitAxis=function(_,x,T){var S=_.leaf?this.compareMinX:p,R=_.leaf?this.compareMinY:d;this._allDistMargin(_,x,T,S)<this._allDistMargin(_,x,T,R)&&_.children.sort(S)},i.prototype._allDistMargin=function(_,x,T,S){_.children.sort(S);for(var R=this.toBBox,z=c(_,0,x,R),U=c(_,T-x,T,R),D=y(z)+y(U),P=x;P<T-x;P++){var ct=_.children[P];f(z,_.leaf?R(ct):ct),D+=y(z)}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 S=T;S>=0;S--)f(x[S],_)},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 DC=Z((wv,Sv)=>{(function(n,t){typeof wv=="object"&&typeof Sv!="undefined"?Sv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(wv,function(){"use strict";var n=function(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,m=u[d],y=d+1;if(y<this.length&&c(u[y],m)<0&&(d=y,m=u[y]),c(m,p)>=0)break;u[i]=m,i=d}u[i]=p};function t(e,i){return e<i?-1:e>i?1:0}return n})});var UC=Z((kQ,FC)=>{FC.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,m=p-1;d<p;m=d++){var y=e[i+d*2+0],v=e[i+d*2+1],E=e[i+m*2+0],M=e[i+m*2+1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var zC=Z((qQ,BC)=>{BC.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,m=p-1;d<p;m=d++){var y=e[d+i][0],v=e[d+i][1],E=e[m+i][0],M=e[m+i][1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var qC=Z((VQ,Vp)=>{var GC=UC(),kC=zC();Vp.exports=function(t,e,i,s){return e.length>0&&Array.isArray(e[0])?kC(t,e,i,s):GC(t,e,i,s)};Vp.exports.nested=kC;Vp.exports.flat=GC});var HC=Z((Hp,VC)=>{(function(n,t){typeof Hp=="object"&&typeof VC!="undefined"?t(Hp):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(Hp,function(n){"use strict";let e=33306690738754706e-32;function i(E,M,A,_,x){let T,S,R,z,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-((S=U+T)-U),U=M[++P]):(R=T-((S=D+T)-D),D=_[++ct]),T=S,R!==0&&(x[L++]=R);P<E&&ct<A;)D>U==D>-U?(R=T-((S=T+U)-(z=S-T))+(U-z),U=M[++P]):(R=T-((S=T+D)-(z=S-T))+(D-z),D=_[++ct]),T=S,R!==0&&(x[L++]=R);for(;P<E;)R=T-((S=T+U)-(z=S-T))+(U-z),U=M[++P],T=S,R!==0&&(x[L++]=R);for(;ct<A;)R=T-((S=T+D)-(z=S-T))+(D-z),D=_[++ct],T=S,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),m=s(12),y=s(16),v=s(4);n.orient2d=function(E,M,A,_,x,T){let S=(M-T)*(A-x),R=(E-x)*(_-T),z=S-R;if(S===0||R===0||S>0!=R>0)return z;let U=Math.abs(S+R);return Math.abs(z)>=u*U?z:-function(D,P,ct,L,W,V,Mt){let Y,mt,ft,vt,it,lt,H,At,It,jt,nt,bt,qt,$t,Ft,zt,Ct,te,$=D-W,Ot=ct-W,_t=P-V,Nt=L-V;it=(Ft=(At=$-(H=(lt=134217729*$)-(lt-$)))*(jt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=$*Nt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(jt=Ot-(It=(lt=134217729*Ot)-(lt-Ot)))-((zt=_t*Ot)-H*It-At*It-H*jt))),p[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),p[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,p[2]=bt-(te-it)+(nt-it),p[3]=te;let St=function(X,N){let xt=N[0];for(let wt=1;wt<X;wt++)xt+=N[wt];return xt}(4,p),Vt=c*Mt;if(St>=Vt||-St>=Vt||(Y=D-($+(it=D-$))+(it-W),ft=ct-(Ot+(it=ct-Ot))+(it-W),mt=P-(_t+(it=P-_t))+(it-V),vt=L-(Nt+(it=L-Nt))+(it-V),Y===0&&mt===0&&ft===0&&vt===0)||(Vt=f*Mt+e*Math.abs(St),(St+=$*vt+Nt*Y-(_t*ft+Ot*mt))>=Vt||-St>=Vt))return St;it=(Ft=(At=Y-(H=(lt=134217729*Y)-(lt-Y)))*(jt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=Y*Nt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=mt-(H=(lt=134217729*mt)-(lt-mt)))*(jt=Ot-(It=(lt=134217729*Ot)-(lt-Ot)))-((zt=mt*Ot)-H*It-At*It-H*jt))),v[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),v[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,v[2]=bt-(te-it)+(nt-it),v[3]=te;let Xt=i(4,p,4,v,d);it=(Ft=(At=$-(H=(lt=134217729*$)-(lt-$)))*(jt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=$*vt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(jt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((zt=_t*ft)-H*It-At*It-H*jt))),v[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),v[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,v[2]=bt-(te-it)+(nt-it),v[3]=te;let Pt=i(Xt,d,4,v,m);it=(Ft=(At=Y-(H=(lt=134217729*Y)-(lt-Y)))*(jt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=Y*vt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=mt-(H=(lt=134217729*mt)-(lt-mt)))*(jt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((zt=mt*ft)-H*It-At*It-H*jt))),v[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),v[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,v[2]=bt-(te-it)+(nt-it),v[3]=te;let ee=i(Pt,m,4,v,y);return y[ee-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 JC=Z((HQ,Tv)=>{"use strict";var WC=Ev(),Xp=DC(),wW=qC(),SW=HC().orient2d;Xp.default&&(Xp=Xp.default);Tv.exports=ZC;Tv.exports.default=ZC;function ZC(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var i=CW(n),s=new WC(16);s.toBBox=function(T){return{minX:T[0],minY:T[1],maxX:T[0],maxY:T[1]}},s.compareMinX=function(T,S){return T[0]-S[0]},s.compareMinY=function(T,S){return T[1]-S[1]},s.load(n);for(var u=[],c=0,f;c<i.length;c++){var p=i[c];s.remove(p),f=$C(p,f),u.push(f)}var d=new WC(16);for(c=0;c<u.length;c++)d.insert(Mv(u[c]));for(var m=t*t,y=e*e;u.length;){var v=u.shift(),E=v.p,M=v.next.p,A=bv(E,M);if(!(A<y)){var _=A/m;p=MW(s,v.prev.p,E,M,v.next.next.p,_,d),p&&Math.min(bv(p,E),bv(p,M))<=_&&(u.push(v),u.push($C(p,v)),s.remove(p),d.remove(v),d.insert(Mv(v)),d.insert(Mv(v.next)))}}v=f;var x=[];do x.push(v.p),v=v.next;while(v!==f);return x.push(v.p),x}function MW(n,t,e,i,s,u,c){for(var f=new Xp([],bW),p=n.data;p;){for(var d=0;d<p.children.length;d++){var m=p.children[d],y=p.leaf?Av(m,e,i):AW(e,i,m);y>u||f.push({node:m,dist:y})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),E=v.node,M=Av(E,t,e),A=Av(E,i,s);if(v.dist<M&&v.dist<A&&YC(e,E,c)&&YC(i,E,c))return E}p=f.pop(),p&&(p=p.node)}return null}function bW(n,t){return n.dist-t.dist}function AW(n,t,e){if(XC(n,e)||XC(t,e))return 0;var i=Wp(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(i===0)return 0;var s=Wp(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var u=Wp(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(u===0)return 0;var c=Wp(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 XC(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function YC(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(TW(f[p].p,f[p].next.p,n,t))return!1;return!0}function xl(n,t,e){return SW(n[0],n[1],t[0],t[1],e[0],e[1])}function TW(n,t,e,i){return n!==i&&t!==e&&xl(n,t,e)>0!=xl(n,t,i)>0&&xl(e,i,n)>0!=xl(e,i,t)>0}function Mv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function CW(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++)wW(n[u],f)||p.push(n[u]);return PW(p)}function $C(n,t){var e={p:n,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function bv(n,t){var e=n[0]-t[0],i=n[1]-t[1];return e*e+i*i}function Av(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 Wp(n,t,e,i,s,u,c,f){var p=e-n,d=i-t,m=c-s,y=f-u,v=n-s,E=t-u,M=p*p+d*d,A=p*m+d*y,_=m*m+y*y,x=p*v+d*E,T=m*v+y*E,S=M*_-A*A,R,z,U,D,P=S,ct=S;S===0?(z=0,P=1,D=T,ct=_):(z=A*T-_*x,D=M*T-A*x,z<0?(z=0,D=T,ct=_):z>P&&(z=P,D=T+A,ct=_)),D<0?(D=0,-x<0?z=0:-x>M?z=P:(z=-x,P=M)):D>ct&&(D=ct,-x+A<0?z=0:-x+A>M?z=P:(z=-x+A,P=M)),R=z===0?0:z/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,Y=V-L,mt=Mt-W;return Y*Y+mt*mt}function IW(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function PW(n){n.sort(IW);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&xl(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&&xl(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 nI=Z((Iv,Pv)=>{(function(n,t){typeof Iv=="object"&&typeof Pv!="undefined"?Pv.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(Iv,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,m=u-c+1,y=Math.log(d),v=.5*Math.exp(2*y/3),E=.5*Math.sqrt(y*v*(d-v)/d)*(m-d/2<0?-1:1),M=Math.max(c,Math.floor(u-m*v/d+E)),A=Math.min(f,Math.floor(u+(d-m)*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 Ov=Z((vnt,Nv)=>{"use strict";Nv.exports=Zc;Nv.exports.default=Zc;var VW=nI();function Zc(n,t){if(!(this instanceof Zc))return new Zc(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()}Zc.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],i=this.toBBox;if(!$p(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,$p(n,p)&&(t.leaf?e.push(f):Lv(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(!$p(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,$p(n,f)){if(t.leaf||Lv(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=Sl([]),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=HW(n,e.children,t),p!==-1))return e.children.splice(p,1),s.push(e),this._condense(s),this;!d&&!e.leaf&&Lv(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:rI,compareMinY:iI,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=Sl(n.slice(t,e+1)),wl(c,this.toBBox),c;i||(i=Math.ceil(Math.log(s)/Math.log(u)),u=Math.ceil(s/Math.pow(u,i-1))),c=Sl([]),c.leaf=!1,c.height=i;var f=Math.ceil(s/u),p=f*Math.ceil(Math.sqrt(u)),d,m,y,v;for(oI(n,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(y=Math.min(d+p-1,e),oI(n,d,y,f,this.compareMinY),m=d;m<=y;m+=f)v=Math.min(m+f-1,y),c.children.push(this._build(n,m,v,i-1));return wl(c,this.toBBox),c},_chooseSubtree:function(n,t,e,i){for(var s,u,c,f,p,d,m,y;i.push(t),!(t.leaf||i.length-1===e);){for(m=y=1/0,s=0,u=t.children.length;s<u;s++)c=t.children[s],p=Rv(c),d=WW(n,c)-p,d<y?(y=d,m=p<m?p:m,f=c):d===y&&p<m&&(m=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),$c(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=Sl(e.children.splice(u,e.children.length-u));c.height=e.height,c.leaf=e.leaf,wl(e,this.toBBox),wl(c,this.toBBox),t?n[t-1].children.push(c):this._splitRoot(e,c)},_splitRoot:function(n,t){this.data=Sl([n,t]),this.data.height=n.height+1,this.data.leaf=!1,wl(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var i,s,u,c,f,p,d,m;for(p=d=1/0,i=t;i<=e-t;i++)s=Yc(n,0,i,this.toBBox),u=Yc(n,i,e,this.toBBox),c=XW(s,u),f=Rv(s)+Rv(u),c<p?(p=c,m=i,d=f<d?f:d):c===p&&f<d&&(d=f,m=i);return m},_chooseSplitAxis:function(n,t,e){var i=n.leaf?this.compareMinX:rI,s=n.leaf?this.compareMinY:iI,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=Yc(n,0,t,s),c=Yc(n,e-t,e,s),f=Yp(u)+Yp(c),p,d;for(p=t;p<e-t;p++)d=n.children[p],$c(u,n.leaf?s(d):d),f+=Yp(u);for(p=e-t-1;p>=t;p--)d=n.children[p],$c(c,n.leaf?s(d):d),f+=Yp(c);return f},_adjustParentBBoxes:function(n,t,e){for(var i=e;i>=0;i--)$c(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():wl(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 HW(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 wl(n,t){Yc(n,0,n.children.length,t,n)}function Yc(n,t,e,i,s){s||(s=Sl(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],$c(s,n.leaf?i(c):c);return s}function $c(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 rI(n,t){return n.minX-t.minX}function iI(n,t){return n.minY-t.minY}function Rv(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Yp(n){return n.maxX-n.minX+(n.maxY-n.minY)}function WW(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 XW(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 Lv(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function $p(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Sl(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function oI(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,VW(n,c,t,e,s),u.push(t,c,c,e))}});var fI=Z((Rrt,Gv)=>{"use strict";Gv.exports=Kp;Gv.exports.default=Kp;function Kp(n,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:n.length,u=uI(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;var f,p,d,m,y,v,E;if(i&&(u=nX(n,t,u,e)),n.length>80*e){f=d=n[0],p=m=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>m&&(m=v);E=Math.max(d-f,m-p),E=E!==0?32767/E:0}return Kc(u,c,e,f,p,E,0),c}function uI(n,t,e,i,s){var u,c;if(s===zv(n,t,e,i)>0)for(u=t;u<e;u+=i)c=aI(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=aI(u,n[u],n[u+1],c);return c&&Qp(c,c.next)&&(tf(c),c=c.next),c}function eu(n,t){if(!n)return n;t||(t=n);var e=n,i;do if(i=!1,!e.steiner&&(Qp(e,e.next)||Qn(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 Kc(n,t,e,i,s,u,c){if(n){!c&&u&&aX(n,i,s,u);for(var f=n,p,d;n.prev!==n.next;){if(p=n.prev,d=n.next,u?QW(n,i,s,u):KW(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=tX(eu(n),t,e),Kc(n,t,e,i,s,u,2)):c===2&&eX(n,t,e,i,s,u):Kc(eu(n),t,e,i,s,u,1);break}}}}function KW(n){var t=n.prev,e=n,i=n.next;if(Qn(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,m=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>=m&&M.x<=v&&M.y>=y&&M.y<=E&&Al(s,f,u,p,c,d,M.x,M.y)&&Qn(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function QW(n,t,e,i){var s=n.prev,u=n,c=n.next;if(Qn(s,u,c)>=0)return!1;for(var f=s.x,p=u.x,d=c.x,m=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=m<y?m<v?m:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=m>y?m>v?m:v:y>v?y:v,x=Uv(E,M,t,e,i),T=Uv(A,_,t,e,i),S=n.prevZ,R=n.nextZ;S&&S.z>=x&&R&&R.z<=T;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&Al(f,m,p,y,d,v,S.x,S.y)&&Qn(S.prev,S,S.next)>=0||(S=S.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Al(f,m,p,y,d,v,R.x,R.y)&&Qn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;S&&S.z>=x;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&Al(f,m,p,y,d,v,S.x,S.y)&&Qn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Al(f,m,p,y,d,v,R.x,R.y)&&Qn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function tX(n,t,e){var i=n;do{var s=i.prev,u=i.next.next;!Qp(s,u)&&lI(s,i,i.next,u)&&Qc(s,u)&&Qc(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 eu(i)}function eX(n,t,e,i,s,u){var c=n;do{for(var f=c.next.next;f!==c.prev;){if(c.i!==f.i&&cX(c,f)){var p=cI(c,f);c=eu(c,c.next),p=eu(p,p.next),Kc(c,t,e,i,s,u,0),Kc(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function nX(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=uI(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(lX(d));for(s.sort(rX),u=0;u<s.length;u++)e=iX(s[u],e);return e}function rX(n,t){return n.x-t.x}function iX(n,t){var e=oX(n,t);if(!e)return t;var i=cI(e,n);return eu(i,i.next),eu(e,e.next)}function oX(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,m=c.y,y=1/0,v;e=c;do i>=e.x&&e.x>=d&&i!==e.x&&Al(s<m?i:u,s,d,m,s<m?u:i,s,e.x,e.y)&&(v=Math.abs(s-e.y)/(i-e.x),Qc(e,n)&&(v<y||v===y&&(e.x>c.x||e.x===c.x&&sX(c,e)))&&(c=e,y=v)),e=e.next;while(e!==p);return c}function sX(n,t){return Qn(n.prev,n,t.prev)<0&&Qn(t.next,n,n.next)<0}function aX(n,t,e,i){var s=n;do s.z===0&&(s.z=Uv(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,uX(s)}function uX(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 Uv(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 lX(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 Al(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 cX(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!fX(n,t)&&(Qc(n,t)&&Qc(t,n)&&hX(n,t)&&(Qn(n.prev,n,t.prev)||Qn(n,t.prev,t))||Qp(n,t)&&Qn(n.prev,n,n.next)>0&&Qn(t.prev,t,t.next)>0)}function Qn(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Qp(n,t){return n.x===t.x&&n.y===t.y}function lI(n,t,e,i){var s=jp(Qn(n,t,e)),u=jp(Qn(n,t,i)),c=jp(Qn(e,i,n)),f=jp(Qn(e,i,t));return!!(s!==u&&c!==f||s===0&&Jp(n,e,t)||u===0&&Jp(n,i,t)||c===0&&Jp(e,n,i)||f===0&&Jp(e,t,i))}function Jp(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 jp(n){return n>0?1:n<0?-1:0}function fX(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&&lI(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function Qc(n,t){return Qn(n.prev,n,n.next)<0?Qn(n,t,n.next)>=0&&Qn(n,n.prev,t)>=0:Qn(n,t,n.prev)<0||Qn(n,n.next,t)<0}function hX(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 cI(n,t){var e=new Bv(n.i,n.x,n.y),i=new Bv(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 aI(n,t,e,i){var s=new Bv(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 Bv(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Kp.deviation=function(n,t,e,i){var s=t&&t.length,u=s?t[0]*e:n.length,c=Math.abs(zv(n,0,u,e));if(s)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,m=f<p-1?t[f+1]*e:n.length;c-=Math.abs(zv(n,d,m,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 zv(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}Kp.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 Wv=Z(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.earthRadius=63710088e-1;me.factors={centimeters:me.earthRadius*100,centimetres:me.earthRadius*100,degrees:me.earthRadius/111325,feet:me.earthRadius*3.28084,inches:me.earthRadius*39.37,kilometers:me.earthRadius/1e3,kilometres:me.earthRadius/1e3,meters:me.earthRadius,metres:me.earthRadius,miles:me.earthRadius/1609.344,millimeters:me.earthRadius*1e3,millimetres:me.earthRadius*1e3,nauticalmiles:me.earthRadius/1852,radians:1,yards:me.earthRadius*1.0936};me.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/me.earthRadius,yards:1.0936133};me.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 ca(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}me.feature=ca;function dX(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return kv(t).geometry;case"LineString":return Vv(t).geometry;case"Polygon":return qv(t).geometry;case"MultiPoint":return pI(t).geometry;case"MultiLineString":return hI(t).geometry;case"MultiPolygon":return dI(t).geometry;default:throw new Error(n+" is invalid")}}me.geometry=dX;function kv(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!td(n[0])||!td(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return ca(i,t,e)}me.point=kv;function mX(n,t,e){return e===void 0&&(e={}),ed(n.map(function(i){return kv(i,t)}),e)}me.points=mX;function qv(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 ca(f,t,e)}me.polygon=qv;function gX(n,t,e){return e===void 0&&(e={}),ed(n.map(function(i){return qv(i,t)}),e)}me.polygons=gX;function Vv(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:n};return ca(i,t,e)}me.lineString=Vv;function yX(n,t,e){return e===void 0&&(e={}),ed(n.map(function(i){return Vv(i,t)}),e)}me.lineStrings=yX;function ed(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}me.featureCollection=ed;function hI(n,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:n};return ca(i,t,e)}me.multiLineString=hI;function pI(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return ca(i,t,e)}me.multiPoint=pI;function dI(n,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:n};return ca(i,t,e)}me.multiPolygon=dI;function vX(n,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:n};return ca(i,t,e)}me.geometryCollection=vX;function _X(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}me.round=_X;function mI(n,t){t===void 0&&(t="kilometers");var e=me.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}me.radiansToLength=mI;function Hv(n,t){t===void 0&&(t="kilometers");var e=me.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}me.lengthToRadians=Hv;function xX(n,t){return gI(Hv(n,t))}me.lengthToDegrees=xX;function EX(n){var t=n%360;return t<0&&(t+=360),t}me.bearingToAzimuth=EX;function gI(n){var t=n%(2*Math.PI);return t*180/Math.PI}me.radiansToDegrees=gI;function wX(n){var t=n%360;return t*Math.PI/180}me.degreesToRadians=wX;function SX(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 mI(Hv(n,t),e)}me.convertLength=SX;function MX(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=me.areaFactors[t];if(!i)throw new Error("invalid original units");var s=me.areaFactors[e];if(!s)throw new Error("invalid final units");return n/i*s}me.convertArea=MX;function td(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}me.isNumber=td;function bX(n){return!!n&&n.constructor===Object}me.isObject=bX;function AX(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(!td(t))throw new Error("bbox must only contain numbers")})}me.validateBBox=AX;function TX(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")}me.validateId=TX});var Yv=Z(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});var si=Wv();function ef(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,m=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 S=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var z=c.type;switch(m=e&&(z==="Polygon"||z==="MultiPolygon")?1:0,z){case null:break;case"Point":if(t(p,y,x,S,R)===!1)return!1;y++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,S,R)===!1)return!1;y++,z==="MultiPoint"&&S++}z==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-m;s++){if(t(p[i][s],y,x,S,R)===!1)return!1;y++}z==="MultiLineString"&&S++,z==="Polygon"&&R++}z==="Polygon"&&S++;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-m;u++){if(t(p[i][s][u],y,x,S,R)===!1)return!1;y++}R++}S++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(ef(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function CX(n,t,e,i){var s=e;return ef(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 yI(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 IX(n,t,e){var i=e;return yI(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function vI(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 PX(n,t,e){var i=e;return vI(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function RX(n){var t=[];return ef(n,function(e){t.push(e)}),t}function Xv(n,t){var e,i,s,u,c,f,p,d,m,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:{},m=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,m,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,m,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,m,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function LX(n,t,e){var i=e;return Xv(n,function(s,u,c,f,p){u===0&&e===void 0?i=s:i=t(i,s,u,c,f,p)}),i}function nd(n,t){Xv(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(si.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 m=e.coordinates[d],y={type:p,coordinates:m};if(t(si.feature(y,s),i,d)===!1)return!1}})}function NX(n,t,e){var i=e;return nd(n,function(s,u,c){u===0&&c===0&&e===void 0?i=s:i=t(i,s,u,c)}),i}function _I(n,t){nd(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,m=0;if(ef(e,function(y,v,E,M,A){if(f===void 0||i>p||M>d||A>m){f=y,p=i,d=M,m=A,u=0;return}var _=si.lineString([f,y],e.properties);if(t(_,i,s,A,u)===!1)return!1;u++,f=y})===!1)return!1}}})}function OX(n,t,e){var i=e,s=!1;return _I(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 xI(n,t){if(!n)throw new Error("geojson is required");nd(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(si.lineString(c[f],e.properties),i,s,f)===!1)return!1;break}}})}function DX(n,t,e){var i=e;return xI(n,function(s,u,c,f){u===0&&e===void 0?i=s:i=t(i,s,u,c,f)}),i}function FX(n,t){if(t=t||{},!si.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),si.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),si.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),si.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),si.lineString([p[i][s][u],p[i][s][u+1]],c,t)}throw new Error("geojson is invalid")}function UX(n,t){if(t=t||{},!si.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 si.point(p,c,t);case"MultiPoint":return i<0&&(i=p.length+i),si.point(p[i],c,t);case"LineString":return u<0&&(u=p.length+u),si.point(p[u],c,t);case"Polygon":return s<0&&(s=p.length+s),u<0&&(u=p[s].length+u),si.point(p[s][u],c,t);case"MultiLineString":return i<0&&(i=p.length+i),u<0&&(u=p[i].length+u),si.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),si.point(p[i][s][u],c,t)}throw new Error("geojson is invalid")}Er.coordAll=RX;Er.coordEach=ef;Er.coordReduce=CX;Er.featureEach=vI;Er.featureReduce=PX;Er.findPoint=UX;Er.findSegment=FX;Er.flattenEach=nd;Er.flattenReduce=NX;Er.geomEach=Xv;Er.geomReduce=LX;Er.lineEach=xI;Er.lineReduce=DX;Er.propEach=yI;Er.propReduce=IX;Er.segmentEach=_I;Er.segmentReduce=OX});var EI=Z(Zv=>{"use strict";Object.defineProperty(Zv,"__esModule",{value:!0});var BX=Yv();function $v(n){var t=[1/0,1/0,-1/0,-1/0];return BX.coordEach(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}$v.default=$v;Zv.default=$v});var rd=Z((Yrt,Jv)=>{var Jo=Ev(),SI=Wv(),MI=Yv(),Tl=EI().default,zX=MI.featureEach,Wrt=MI.coordEach,Xrt=SI.polygon,wI=SI.featureCollection;function bI(n){var t=new Jo(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Tl(e),Jo.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:Tl(s),i.push(s)}):zX(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Tl(s),i.push(s)}),Jo.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:Tl(e),Jo.prototype.remove.call(this,e,i)},t.clear=function(){return Jo.prototype.clear.call(this)},t.search=function(e){var i=Jo.prototype.search.call(this,this.toBBox(e));return wI(i)},t.collides=function(e){return Jo.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Jo.prototype.all.call(this);return wI(e)},t.toJSON=function(){return Jo.prototype.toJSON.call(this)},t.fromJSON=function(e){return Jo.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=Tl(e);else if(e.type==="FeatureCollection")i=Tl(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Jv.exports=bI;Jv.exports.default=bI});var n_=Z((nst,DI)=>{"use strict";var OI=Object.prototype.toString;DI.exports=function(t){var e=OI.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&OI.call(t.callee)==="[object Function]"),i}});var HI=Z((rst,VI)=>{"use strict";var qI;Object.keys||(of=Object.prototype.hasOwnProperty,r_=Object.prototype.toString,FI=n_(),i_=Object.prototype.propertyIsEnumerable,UI=!i_.call({toString:null},"toString"),BI=i_.call(function(){},"prototype"),sf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ud=function(n){var t=n.constructor;return t&&t.prototype===n},zI={$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},GI=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!zI["$"+n]&&of.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{ud(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),kI=function(n){if(typeof window=="undefined"||!GI)return ud(n);try{return ud(n)}catch(t){return!1}},qI=function(t){var e=t!==null&&typeof t=="object",i=r_.call(t)==="[object Function]",s=FI(t),u=e&&r_.call(t)==="[object String]",c=[];if(!e&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var f=BI&&i;if(u&&t.length>0&&!of.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 m in t)!(f&&m==="prototype")&&of.call(t,m)&&c.push(String(m));if(UI)for(var y=kI(t),v=0;v<sf.length;++v)!(y&&sf[v]==="constructor")&&of.call(t,sf[v])&&c.push(sf[v]);return c});var of,r_,FI,i_,UI,BI,sf,ud,zI,GI,kI;VI.exports=qI});var o_=Z((ist,YI)=>{"use strict";var ZX=Array.prototype.slice,JX=n_(),WI=Object.keys,ld=WI?function(t){return WI(t)}:HI(),XI=Object.keys;ld.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 JX(i)?XI(ZX.call(i)):XI(i)})}else Object.keys=ld;return Object.keys||ld};YI.exports=ld});var s_=Z((ost,$I)=>{"use strict";$I.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 cd=Z((sst,ZI)=>{"use strict";var jX=s_();ZI.exports=function(){return jX()&&!!Symbol.toStringTag}});var a_=Z((ast,JI)=>{"use strict";JI.exports=Object});var u_=Z((ust,jI)=>{"use strict";jI.exports=Error});var QI=Z((lst,KI)=>{"use strict";KI.exports=EvalError});var eP=Z((cst,tP)=>{"use strict";tP.exports=RangeError});var rP=Z((fst,nP)=>{"use strict";nP.exports=ReferenceError});var l_=Z((hst,iP)=>{"use strict";iP.exports=SyntaxError});var nu=Z((pst,oP)=>{"use strict";oP.exports=TypeError});var aP=Z((dst,sP)=>{"use strict";sP.exports=URIError});var lP=Z((mst,uP)=>{"use strict";uP.exports=Math.abs});var fP=Z((gst,cP)=>{"use strict";cP.exports=Math.floor});var pP=Z((yst,hP)=>{"use strict";hP.exports=Math.max});var mP=Z((vst,dP)=>{"use strict";dP.exports=Math.min});var yP=Z((_st,gP)=>{"use strict";gP.exports=Math.pow});var _P=Z((xst,vP)=>{"use strict";vP.exports=Math.round});var EP=Z((Est,xP)=>{"use strict";xP.exports=Number.isNaN||function(t){return t!==t}});var SP=Z((wst,wP)=>{"use strict";var KX=EP();wP.exports=function(t){return KX(t)||t===0?t:t<0?-1:1}});var bP=Z((Sst,MP)=>{"use strict";MP.exports=Object.getOwnPropertyDescriptor});var ru=Z((Mst,AP)=>{"use strict";var fd=bP();if(fd)try{fd([],"length")}catch(n){fd=null}AP.exports=fd});var af=Z((bst,TP)=>{"use strict";var hd=Object.defineProperty||!1;if(hd)try{hd({},"a",{value:1})}catch(n){hd=!1}TP.exports=hd});var PP=Z((Ast,IP)=>{"use strict";var CP=typeof Symbol!="undefined"&&Symbol,QX=s_();IP.exports=function(){return typeof CP!="function"||typeof Symbol!="function"||typeof CP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:QX()}});var c_=Z((Tst,RP)=>{"use strict";RP.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var f_=Z((Cst,LP)=>{"use strict";var t9=a_();LP.exports=t9.getPrototypeOf||null});var DP=Z((Ist,OP)=>{"use strict";var e9="Function.prototype.bind called on incompatible ",n9=Object.prototype.toString,r9=Math.max,i9="[object Function]",NP=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},o9=function(t,e){for(var i=[],s=e||0,u=0;s<t.length;s+=1,u+=1)i[u]=t[s];return i},s9=function(n,t){for(var e="",i=0;i<n.length;i+=1)e+=n[i],i+1<n.length&&(e+=t);return e};OP.exports=function(t){var e=this;if(typeof e!="function"||n9.apply(e)!==i9)throw new TypeError(e9+e);for(var i=o9(arguments,1),s,u=function(){if(this instanceof s){var m=e.apply(this,NP(i,arguments));return Object(m)===m?m:this}return e.apply(t,NP(i,arguments))},c=r9(0,e.length-i.length),f=[],p=0;p<c;p++)f[p]="$"+p;if(s=Function("binder","return function ("+s9(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 Cl=Z((Pst,FP)=>{"use strict";var a9=DP();FP.exports=Function.prototype.bind||a9});var pd=Z((Rst,UP)=>{"use strict";UP.exports=Function.prototype.call});var dd=Z((Lst,BP)=>{"use strict";BP.exports=Function.prototype.apply});var GP=Z((Nst,zP)=>{"use strict";zP.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var h_=Z((Ost,kP)=>{"use strict";var u9=Cl(),l9=dd(),c9=pd(),f9=GP();kP.exports=f9||u9.call(c9,l9)});var md=Z((Dst,qP)=>{"use strict";var h9=Cl(),p9=nu(),d9=pd(),m9=h_();qP.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new p9("a function is required");return m9(h9,d9,t)}});var $P=Z((Fst,YP)=>{"use strict";var g9=md(),VP=ru(),WP;try{WP=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var p_=!!WP&&VP&&VP(Object.prototype,"__proto__"),XP=Object,HP=XP.getPrototypeOf;YP.exports=p_&&typeof p_.get=="function"?g9([p_.get]):typeof HP=="function"?function(t){return HP(t==null?t:XP(t))}:!1});var d_=Z((Ust,KP)=>{"use strict";var ZP=c_(),JP=f_(),jP=$P();KP.exports=ZP?function(t){return ZP(t)}:JP?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return JP(t)}:jP?function(t){return jP(t)}:null});var m_=Z((Bst,QP)=>{"use strict";var y9=Function.prototype.call,v9=Object.prototype.hasOwnProperty,_9=Cl();QP.exports=_9.call(y9,v9)});var v_=Z((zst,oR)=>{"use strict";var Qe,x9=a_(),E9=u_(),w9=QI(),S9=eP(),M9=rP(),Ll=l_(),Rl=nu(),b9=aP(),A9=lP(),T9=fP(),C9=pP(),I9=mP(),P9=yP(),R9=_P(),L9=SP(),rR=Function,g_=function(n){try{return rR('"use strict"; return ('+n+").constructor;")()}catch(t){}},uf=ru(),N9=af(),y_=function(){throw new Rl},O9=uf?function(){try{return arguments.callee,y_}catch(n){try{return uf(arguments,"callee").get}catch(t){return y_}}}():y_,Il=PP()(),Ur=d_(),D9=f_(),F9=c_(),iR=dd(),lf=pd(),Pl={},U9=typeof Uint8Array=="undefined"||!Ur?Qe:Ur(Uint8Array),iu={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Qe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Qe:ArrayBuffer,"%ArrayIteratorPrototype%":Il&&Ur?Ur([][Symbol.iterator]()):Qe,"%AsyncFromSyncIteratorPrototype%":Qe,"%AsyncFunction%":Pl,"%AsyncGenerator%":Pl,"%AsyncGeneratorFunction%":Pl,"%AsyncIteratorPrototype%":Pl,"%Atomics%":typeof Atomics=="undefined"?Qe:Atomics,"%BigInt%":typeof BigInt=="undefined"?Qe:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Qe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Qe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Qe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":E9,"%eval%":eval,"%EvalError%":w9,"%Float16Array%":typeof Float16Array=="undefined"?Qe:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Qe:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Qe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Qe:FinalizationRegistry,"%Function%":rR,"%GeneratorFunction%":Pl,"%Int8Array%":typeof Int8Array=="undefined"?Qe:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Qe:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Qe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Il&&Ur?Ur(Ur([][Symbol.iterator]())):Qe,"%JSON%":typeof JSON=="object"?JSON:Qe,"%Map%":typeof Map=="undefined"?Qe:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Il||!Ur?Qe:Ur(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":x9,"%Object.getOwnPropertyDescriptor%":uf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Qe:Promise,"%Proxy%":typeof Proxy=="undefined"?Qe:Proxy,"%RangeError%":S9,"%ReferenceError%":M9,"%Reflect%":typeof Reflect=="undefined"?Qe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Qe:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Il||!Ur?Qe:Ur(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Qe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Il&&Ur?Ur(""[Symbol.iterator]()):Qe,"%Symbol%":Il?Symbol:Qe,"%SyntaxError%":Ll,"%ThrowTypeError%":O9,"%TypedArray%":U9,"%TypeError%":Rl,"%Uint8Array%":typeof Uint8Array=="undefined"?Qe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Qe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Qe:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Qe:Uint32Array,"%URIError%":b9,"%WeakMap%":typeof WeakMap=="undefined"?Qe:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Qe:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Qe:WeakSet,"%Function.prototype.call%":lf,"%Function.prototype.apply%":iR,"%Object.defineProperty%":N9,"%Object.getPrototypeOf%":D9,"%Math.abs%":A9,"%Math.floor%":T9,"%Math.max%":C9,"%Math.min%":I9,"%Math.pow%":P9,"%Math.round%":R9,"%Math.sign%":L9,"%Reflect.getPrototypeOf%":F9};if(Ur)try{null.error}catch(n){tR=Ur(Ur(n)),iu["%Error.prototype%"]=tR}var tR,B9=function n(t){var e;if(t==="%AsyncFunction%")e=g_("async function () {}");else if(t==="%GeneratorFunction%")e=g_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=g_("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&Ur&&(e=Ur(s.prototype))}return iu[t]=e,e},eR={__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"]},cf=Cl(),gd=m_(),z9=cf.call(lf,Array.prototype.concat),G9=cf.call(iR,Array.prototype.splice),nR=cf.call(lf,String.prototype.replace),yd=cf.call(lf,String.prototype.slice),k9=cf.call(lf,RegExp.prototype.exec),q9=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,V9=/\\(\\)?/g,H9=function(t){var e=yd(t,0,1),i=yd(t,-1);if(e==="%"&&i!=="%")throw new Ll("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ll("invalid intrinsic syntax, expected opening `%`");var s=[];return nR(t,q9,function(u,c,f,p){s[s.length]=f?nR(p,V9,"$1"):c||u}),s},W9=function(t,e){var i=t,s;if(gd(eR,i)&&(s=eR[i],i="%"+s[0]+"%"),gd(iu,i)){var u=iu[i];if(u===Pl&&(u=B9(i)),typeof u=="undefined"&&!e)throw new Rl("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:u}}throw new Ll("intrinsic "+t+" does not exist!")};oR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Rl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Rl('"allowMissing" argument must be a boolean');if(k9(/^%?[^%]*%?$/,t)===null)throw new Ll("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=H9(t),s=i.length>0?i[0]:"",u=W9("%"+s+"%",e),c=u.name,f=u.value,p=!1,d=u.alias;d&&(s=d[0],G9(i,z9([0,1],d)));for(var m=1,y=!0;m<i.length;m+=1){var v=i[m],E=yd(v,0,1),M=yd(v,-1);if((E==='"'||E==="'"||E==="`"||M==='"'||M==="'"||M==="`")&&E!==M)throw new Ll("property names with quotes must have matching quotes");if((v==="constructor"||!y)&&(p=!0),s+="."+v,c="%"+s+"%",gd(iu,c))f=iu[c];else if(f!=null){if(!(v in f)){if(!e)throw new Rl("base intrinsic for "+t+" exists, but the property is not available.");return}if(uf&&m+1>=i.length){var A=uf(f,v);y=!!A,y&&"get"in A&&!("originalValue"in A.get)?f=A.get:f=f[v]}else y=gd(f,v),f=f[v];y&&!p&&(iu[c]=f)}}return f}});var vd=Z((Gst,uR)=>{"use strict";var sR=v_(),aR=md(),X9=aR([sR("%String.prototype.indexOf%")]);uR.exports=function(t,e){var i=sR(t,!!e);return typeof i=="function"&&X9(t,".prototype.")>-1?aR([i]):i}});var fR=Z((kst,cR)=>{"use strict";var Y9=cd()(),$9=vd(),__=$9("Object.prototype.toString"),_d=function(t){return Y9&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:__(t)==="[object Arguments]"},lR=function(t){return _d(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&__(t)!=="[object Array]"&&"callee"in t&&__(t.callee)==="[object Function]"},Z9=function(){return _d(arguments)}();_d.isLegacyArguments=lR;cR.exports=Z9?_d:lR});var xd=Z((qst,dR)=>{"use strict";var hR=af(),J9=l_(),Nl=nu(),pR=ru();dR.exports=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Nl("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Nl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Nl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Nl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Nl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Nl("`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=!!pR&&pR(t,e);if(hR)hR(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 J9("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ed=Z((Vst,gR)=>{"use strict";var x_=af(),mR=function(){return!!x_};mR.hasArrayLengthDefineBug=function(){if(!x_)return null;try{return x_([],"length",{value:1}).length!==1}catch(t){return!0}};gR.exports=mR});var Ol=Z((Hst,xR)=>{"use strict";var j9=o_(),K9=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Q9=Object.prototype.toString,t7=Array.prototype.concat,yR=xd(),e7=function(n){return typeof n=="function"&&Q9.call(n)==="[object Function]"},vR=Ed()(),n7=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!e7(i)||!i())return}vR?yR(n,t,e,!0):yR(n,t,e)},_R=function(n,t){var e=arguments.length>2?arguments[2]:{},i=j9(t);K9&&(i=t7.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s<i.length;s+=1)n7(n,i[s],t[i[s]],e[i[s]])};_R.supportsDescriptors=!!vR;xR.exports=_R});var bR=Z((Wst,MR)=>{"use strict";var r7=v_(),ER=xd(),i7=Ed()(),wR=ru(),SR=nu(),o7=r7("%Math.floor%");MR.exports=function(t,e){if(typeof t!="function")throw new SR("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||o7(e)!==e)throw new SR("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in t&&wR){var c=wR(t,"length");c&&!c.configurable&&(s=!1),c&&!c.writable&&(u=!1)}return(s||u||!i)&&(i7?ER(t,"length",e,!0,!0):ER(t,"length",e)),t}});var TR=Z((Xst,AR)=>{"use strict";var s7=Cl(),a7=dd(),u7=h_();AR.exports=function(){return u7(s7,a7,arguments)}});var E_=Z((Yst,wd)=>{"use strict";var l7=bR(),CR=af(),c7=md(),IR=TR();wd.exports=function(t){var e=c7(arguments),i=t.length-(arguments.length-1);return l7(e,1+(i>0?i:0),!0)};CR?CR(wd.exports,"apply",{value:IR}):wd.exports.apply=IR});var w_=Z(($st,RR)=>{"use strict";var PR=function(n){return n!==n};RR.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||PR(t)&&PR(e))}});var S_=Z((Zst,LR)=>{"use strict";var f7=w_();LR.exports=function(){return typeof Object.is=="function"?Object.is:f7}});var OR=Z((Jst,NR)=>{"use strict";var h7=S_(),p7=Ol();NR.exports=function(){var t=h7();return p7(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var BR=Z((jst,UR)=>{"use strict";var d7=Ol(),m7=E_(),g7=w_(),DR=S_(),y7=OR(),FR=m7(DR(),Object);d7(FR,{getPolyfill:DR,implementation:g7,shim:y7});UR.exports=FR});var HR=Z((Kst,VR)=>{"use strict";var zR=vd(),v7=cd()(),_7=m_(),x7=ru(),A_;v7?(GR=zR("RegExp.prototype.exec"),M_={},Sd=function(){throw M_},b_={toString:Sd,valueOf:Sd},typeof Symbol.toPrimitive=="symbol"&&(b_[Symbol.toPrimitive]=Sd),A_=function(t){if(!t||typeof t!="object")return!1;var e=x7(t,"lastIndex"),i=e&&_7(e,"value");if(!i)return!1;try{GR(t,b_)}catch(s){return s===M_}}):(kR=zR("Object.prototype.toString"),qR="[object RegExp]",A_=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:kR(t)===qR});var GR,M_,Sd,b_,kR,qR;VR.exports=A_});var XR=Z((Qst,WR)=>{"use strict";var hf=function(){return typeof function(){}.name=="string"},ff=Object.getOwnPropertyDescriptor;if(ff)try{ff([],"length")}catch(n){ff=null}hf.functionsHaveConfigurableNames=function(){if(!hf()||!ff)return!1;var t=ff(function(){},"name");return!!t&&!!t.configurable};var E7=Function.prototype.bind;hf.boundFunctionsHaveNames=function(){return hf()&&typeof E7=="function"&&function(){}.bind().name!==""};WR.exports=hf});var ZR=Z((tat,$R)=>{"use strict";var YR=xd(),w7=Ed()(),S7=XR().functionsHaveConfigurableNames(),M7=nu();$R.exports=function(t,e){if(typeof t!="function")throw new M7("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||S7)&&(w7?YR(t,"name",e,!0,!0):YR(t,"name",e)),t}});var T_=Z((eat,JR)=>{"use strict";var b7=ZR(),A7=nu(),T7=Object;JR.exports=b7(function(){if(this==null||this!==T7(this))throw new A7("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 C_=Z((nat,jR)=>{"use strict";var C7=T_(),I7=Ol().supportsDescriptors,P7=Object.getOwnPropertyDescriptor;jR.exports=function(){if(I7&&/a/mig.flags==="gim"){var t=P7(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 C7}});var tL=Z((rat,QR)=>{"use strict";var R7=Ol().supportsDescriptors,L7=C_(),N7=ru(),O7=Object.defineProperty,D7=u_(),KR=d_(),F7=/a/;QR.exports=function(){if(!R7||!KR)throw new D7("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=L7(),e=KR(F7),i=N7(e,"flags");return(!i||i.get!==t)&&O7(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var iL=Z((iat,rL)=>{"use strict";var U7=Ol(),B7=E_(),z7=T_(),eL=C_(),G7=tL(),nL=B7(eL());U7(nL,{getPolyfill:eL,implementation:z7,shim:G7});rL.exports=nL});var aL=Z((oat,sL)=>{"use strict";var oL=vd(),k7=oL("Date.prototype.getDay"),q7=function(t){try{return k7(t),!0}catch(e){return!1}},V7=oL("Object.prototype.toString"),H7="[object Date]",W7=cd()();sL.exports=function(t){return typeof t!="object"||t===null?!1:W7?q7(t):V7(t)===H7}});var I_=Z((sat,vL)=>{var uL=o_(),lL=fR(),cL=BR(),fL=HR(),hL=iL(),pL=aL(),dL=Date.prototype.getTime;function yL(n,t,e){var i=e||{};return(i.strict?cL(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?i.strict?cL(n,t):n==t:X7(n,t,i)}function mL(n){return n==null}function gL(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 X7(n,t,e){var i,s;if(typeof n!=typeof t||mL(n)||mL(t)||n.prototype!==t.prototype||lL(n)!==lL(t))return!1;var u=fL(n),c=fL(t);if(u!==c)return!1;if(u||c)return n.source===t.source&&hL(n)===hL(t);if(pL(n)&&pL(t))return dL.call(n)===dL.call(t);var f=gL(n),p=gL(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=uL(n),m=uL(t)}catch(y){return!1}if(d.length!==m.length)return!1;for(d.sort(),m.sort(),i=d.length-1;i>=0;i--)if(d[i]!=m[i])return!1;for(i=d.length-1;i>=0;i--)if(s=d[i],!yL(n[s],t[s],e))return!1;return!0}vL.exports=yL});var k_=Z((hlt,bL)=>{var FY=I_(),jo=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:UY};jo.prototype.compare=function(n,t){if(n.type!==t.type||!ML(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=SL(n),s=SL(t);return i.every(function(u){return this.some(function(c){return e.compare(u,c)})},s)}}return!1};function SL(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function ML(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}jo.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};jo.prototype.compareLine=function(n,t,e,i){if(!ML(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}};jo.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};jo.prototype.comparePath=function(n,t){var e=this;return n.every(function(i,s){return e.compareCoord(i,this[s])},t)};jo.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};jo.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)};jo.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};jo.prototype.removePseudo=function(n){return n};function UY(n,t){return FY(n,t,{strict:!0})}bL.exports=jo});var AL=Z((Mlt,Ad)=>{function ha(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)}ha.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};ha.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)};ha.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)}};ha.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};ha.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};ha.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};ha.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 Ad!="undefined"&&Ad.exports&&(Ad.exports=ha)});var TL=Z((blt,Td)=>{function pa(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}pa.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)};pa.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(m),f=0,p=0;p<m;p++)c[p]=0;for(var d=0;d<e;d++){var m=this.dataset[d].length;if(u===this.assignments[d]){for(var p=0;p<m;p++)c[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<m;p++)c[p]/=f;this.centroids[u]=c}else this.centroids[u]=this.randomCentroid(),s=!0}}return this.getClusters()};pa.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};pa.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};pa.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};pa.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};pa.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 Td!="undefined"&&Td.exports&&(Td.exports=pa)});var q_=Z((Alt,Cd)=>{function Ko(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}Ko.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)};Ko.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}}};Ko.prototype.forEach=function(n){this._queue.forEach(n)};Ko.prototype.getElements=function(){return this._queue};Ko.prototype.getElementPriority=function(n){return this._priorities[n]};Ko.prototype.getPriorities=function(){return this._priorities};Ko.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};Ko.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)};Ko.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 Cd!="undefined"&&Cd.exports&&(Cd.exports=Ko)});var IL=Z((Tlt,Fl)=>{typeof Fl!="undefined"&&Fl.exports&&(CL=q_());var CL;function Ps(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)}Ps.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 CL(null,null,"asc"),p=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,p,f),this._expandCluster(c,f))}return this.clusters};Ps.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};Ps.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)};Ps.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))}})};Ps.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))}}};Ps.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}};Ps.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};Ps.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 Fl!="undefined"&&Fl.exports&&(Fl.exports=Ps)});var PL=Z((Clt,Id)=>{typeof Id!="undefined"&&Id.exports&&(Id.exports={DBSCAN:AL(),KMEANS:TL(),OPTICS:IL(),PriorityQueue:q_()})});var V_=Z((Olt,LL)=>{"use strict";LL.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 DL=Z((Dlt,OL)=>{"use strict";var NL=V_(),VY=NL.eudist,HY=NL.dist;OL.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?VY:HY,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 m=[],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)}m[M]=A}for(var T=0;T<u;T++)v+=m[T];for(var S=0;S<u;S++)E[S]={i:S,v:t[S],pr:m[S]/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 z=Math.random(),U=0;U<u-1&&E[U++].cs<z;);s.push(E[U-1].v)}return s}}});var GL=Z((Blt,zL)=>{"use strict";var H_=V_(),BL=DL(),WY=H_.eudist,Flt=H_.mandist,Ult=H_.dist,XY=BL.kmrand,YY=BL.kmpp,FL=1e4;function UL(n,t,e){e=e||[];for(var i=0;i<n;i++)e[i]=t;return e}function $Y(n,t,e,i){var s=[],u=[],c=[],f=[],p=!1,d=i||FL,m=n.length,y=n[0].length,v=y>0,E=[];if(e)e=="kmrand"?s=XY(n,t):e=="kmpp"?s=YY(n,t):s=e;else for(var M={};s.length<t;){var A=Math.floor(Math.random()*m);M[A]||(M[A]=!0,s.push(n[A]))}do{UL(t,0,E);for(var _=0;_<m;_++){for(var x=1/0,T=0,S=0;S<t;S++){var f=v?WY(n[_],s[S]):Math.abs(n[_]-s[S]);f<=x&&(x=f,T=S)}c[_]=T,E[T]++}for(var R=[],u=[],z=0,U=0;U<t;U++)R[U]=v?UL(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<m;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 Y=s[Mt],mt=R[Mt],ft=u[Mt],vt=E[Mt],it=0;it<y;it++)Y[it]=mt[it]/vt||0;if(p){for(var lt=0;lt<y;lt++)if(ft[lt]!=Y[lt]){p=!1;break}}}}else{for(var H=0;H<m;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 jt=0;jt<t;jt++)if(u[jt]!=s[jt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:FL-d,k:t,idxs:c,centroids:s}}zL.exports=$Y});var kl=Z((J_,j_)=>{(function(n,t){typeof J_=="object"&&typeof j_!="undefined"?j_.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(J_,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)+`
1
+ var p2=Object.create;var zx=Object.defineProperty;var d2=Object.getOwnPropertyDescriptor;var m2=Object.getOwnPropertyNames;var g2=Object.getPrototypeOf,y2=Object.prototype.hasOwnProperty;var Z=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var v2=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m2(t))!y2.call(n,s)&&s!==e&&zx(n,s,{get:()=>t[s],enumerable:!(i=d2(t,s))||i.enumerable});return n};var ue=(n,t,e)=>(e=n!=null?p2(g2(n)):{},v2(t||!n||!n.__esModule?zx(e,"default",{value:n,enumerable:!0}):e,n));var Cf=(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 wn=Z((nm,Gx)=>{"use strict";var ic=function(n){return n&&n.Math===Math&&n};Gx.exports=ic(typeof globalThis=="object"&&globalThis)||ic(typeof window=="object"&&window)||ic(typeof self=="object"&&self)||ic(typeof global=="object"&&global)||ic(typeof nm=="object"&&nm)||function(){return this}()||Function("return this")()});var Un=Z(($Z,kx)=>{"use strict";kx.exports=function(n){try{return!!n()}catch(t){return!0}}});var ei=Z((ZZ,qx)=>{"use strict";var _2=Un();qx.exports=!_2(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var oc=Z((JZ,Vx)=>{"use strict";var x2=Un();Vx.exports=!x2(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var gi=Z((jZ,Hx)=>{"use strict";var E2=oc(),If=Function.prototype.call;Hx.exports=E2?If.bind(If):function(){return If.apply(If,arguments)}});var $x=Z(Yx=>{"use strict";var Wx={}.propertyIsEnumerable,Xx=Object.getOwnPropertyDescriptor,w2=Xx&&!Wx.call({1:2},1);Yx.f=w2?function(t){var e=Xx(this,t);return!!e&&e.enumerable}:Wx});var sc=Z((QZ,Zx)=>{"use strict";Zx.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var Zn=Z((tJ,Kx)=>{"use strict";var Jx=oc(),jx=Function.prototype,rm=jx.call,S2=Jx&&jx.bind.bind(rm,rm);Kx.exports=Jx?S2:function(n){return function(){return rm.apply(n,arguments)}}});var Gs=Z((eJ,t1)=>{"use strict";var Qx=Zn(),M2=Qx({}.toString),b2=Qx("".slice);t1.exports=function(n){return b2(M2(n),8,-1)}});var Pf=Z((nJ,e1)=>{"use strict";var A2=Zn(),T2=Un(),C2=Gs(),im=Object,I2=A2("".split);e1.exports=T2(function(){return!im("z").propertyIsEnumerable(0)})?function(n){return C2(n)==="String"?I2(n,""):im(n)}:im});var Rf=Z((rJ,n1)=>{"use strict";n1.exports=function(n){return n==null}});var Su=Z((iJ,r1)=>{"use strict";var P2=Rf(),R2=TypeError;r1.exports=function(n){if(P2(n))throw new R2("Can't call method on "+n);return n}});var Mu=Z((oJ,i1)=>{"use strict";var L2=Pf(),N2=Su();i1.exports=function(n){return L2(N2(n))}});var fr=Z((sJ,o1)=>{"use strict";var om=typeof document=="object"&&document.all;o1.exports=typeof om=="undefined"&&om!==void 0?function(n){return typeof n=="function"||n===om}:function(n){return typeof n=="function"}});var yi=Z((aJ,s1)=>{"use strict";var O2=fr();s1.exports=function(n){return typeof n=="object"?n!==null:O2(n)}});var bu=Z((uJ,a1)=>{"use strict";var sm=wn(),D2=fr(),F2=function(n){return D2(n)?n:void 0};a1.exports=function(n,t){return arguments.length<2?F2(sm[n]):sm[n]&&sm[n][t]}});var ac=Z((lJ,u1)=>{"use strict";var U2=Zn();u1.exports=U2({}.isPrototypeOf)});var Au=Z((cJ,f1)=>{"use strict";var B2=wn(),l1=B2.navigator,c1=l1&&l1.userAgent;f1.exports=c1?String(c1):""});var Nf=Z((fJ,y1)=>{"use strict";var g1=wn(),am=Au(),h1=g1.process,p1=g1.Deno,d1=h1&&h1.versions||p1&&p1.version,m1=d1&&d1.v8,yo,Lf;m1&&(yo=m1.split("."),Lf=yo[0]>0&&yo[0]<4?1:+(yo[0]+yo[1]));!Lf&&am&&(yo=am.match(/Edge\/(\d+)/),(!yo||yo[1]>=74)&&(yo=am.match(/Chrome\/(\d+)/),yo&&(Lf=+yo[1])));y1.exports=Lf});var um=Z((hJ,_1)=>{"use strict";var v1=Nf(),z2=Un(),G2=wn(),k2=G2.String;_1.exports=!!Object.getOwnPropertySymbols&&!z2(function(){var n=Symbol("symbol detection");return!k2(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&v1&&v1<41})});var lm=Z((pJ,x1)=>{"use strict";var q2=um();x1.exports=q2&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Of=Z((dJ,E1)=>{"use strict";var V2=bu(),H2=fr(),W2=ac(),X2=lm(),Y2=Object;E1.exports=X2?function(n){return typeof n=="symbol"}:function(n){var t=V2("Symbol");return H2(t)&&W2(t.prototype,Y2(n))}});var uc=Z((mJ,w1)=>{"use strict";var $2=String;w1.exports=function(n){try{return $2(n)}catch(t){return"Object"}}});var Ca=Z((gJ,S1)=>{"use strict";var Z2=fr(),J2=uc(),j2=TypeError;S1.exports=function(n){if(Z2(n))return n;throw new j2(J2(n)+" is not a function")}});var Df=Z((yJ,M1)=>{"use strict";var K2=Ca(),Q2=Rf();M1.exports=function(n,t){var e=n[t];return Q2(e)?void 0:K2(e)}});var A1=Z((vJ,b1)=>{"use strict";var cm=gi(),fm=fr(),hm=yi(),tO=TypeError;b1.exports=function(n,t){var e,i;if(t==="string"&&fm(e=n.toString)&&!hm(i=cm(e,n))||fm(e=n.valueOf)&&!hm(i=cm(e,n))||t!=="string"&&fm(e=n.toString)&&!hm(i=cm(e,n)))return i;throw new tO("Can't convert object to primitive value")}});var lc=Z((_J,T1)=>{"use strict";T1.exports=!1});var Ff=Z((xJ,I1)=>{"use strict";var C1=wn(),eO=Object.defineProperty;I1.exports=function(n,t){try{eO(C1,n,{value:t,configurable:!0,writable:!0})}catch(e){C1[n]=t}return t}});var Uf=Z((EJ,L1)=>{"use strict";var nO=lc(),rO=wn(),iO=Ff(),P1="__core-js_shared__",R1=L1.exports=rO[P1]||iO(P1,{});(R1.versions||(R1.versions=[])).push({version:"3.42.0",mode:nO?"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 Bf=Z((wJ,O1)=>{"use strict";var N1=Uf();O1.exports=function(n,t){return N1[n]||(N1[n]=t||{})}});var zo=Z((SJ,D1)=>{"use strict";var oO=Su(),sO=Object;D1.exports=function(n){return sO(oO(n))}});var to=Z((MJ,F1)=>{"use strict";var aO=Zn(),uO=zo(),lO=aO({}.hasOwnProperty);F1.exports=Object.hasOwn||function(t,e){return lO(uO(t),e)}});var zf=Z((bJ,U1)=>{"use strict";var cO=Zn(),fO=0,hO=Math.random(),pO=cO(1 .toString);U1.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+pO(++fO+hO,36)}});var Vr=Z((AJ,z1)=>{"use strict";var dO=wn(),mO=Bf(),B1=to(),gO=zf(),yO=um(),vO=lm(),Tu=dO.Symbol,pm=mO("wks"),_O=vO?Tu.for||Tu:Tu&&Tu.withoutSetter||gO;z1.exports=function(n){return B1(pm,n)||(pm[n]=yO&&B1(Tu,n)?Tu[n]:_O("Symbol."+n)),pm[n]}});var dm=Z((TJ,q1)=>{"use strict";var xO=gi(),G1=yi(),k1=Of(),EO=Df(),wO=A1(),SO=Vr(),MO=TypeError,bO=SO("toPrimitive");q1.exports=function(n,t){if(!G1(n)||k1(n))return n;var e=EO(n,bO),i;if(e){if(t===void 0&&(t="default"),i=xO(e,n,t),!G1(i)||k1(i))return i;throw new MO("Can't convert object to primitive value")}return t===void 0&&(t="number"),wO(n,t)}});var Gf=Z((CJ,V1)=>{"use strict";var AO=dm(),TO=Of();V1.exports=function(n){var t=AO(n,"string");return TO(t)?t:t+""}});var kf=Z((IJ,W1)=>{"use strict";var CO=wn(),H1=yi(),mm=CO.document,IO=H1(mm)&&H1(mm.createElement);W1.exports=function(n){return IO?mm.createElement(n):{}}});var gm=Z((PJ,X1)=>{"use strict";var PO=ei(),RO=Un(),LO=kf();X1.exports=!PO&&!RO(function(){return Object.defineProperty(LO("div"),"a",{get:function(){return 7}}).a!==7})});var qf=Z($1=>{"use strict";var NO=ei(),OO=gi(),DO=$x(),FO=sc(),UO=Mu(),BO=Gf(),zO=to(),GO=gm(),Y1=Object.getOwnPropertyDescriptor;$1.f=NO?Y1:function(t,e){if(t=UO(t),e=BO(e),GO)try{return Y1(t,e)}catch(i){}if(zO(t,e))return FO(!OO(DO.f,t,e),t[e])}});var ym=Z((LJ,Z1)=>{"use strict";var kO=ei(),qO=Un();Z1.exports=kO&&qO(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Go=Z((NJ,J1)=>{"use strict";var VO=yi(),HO=String,WO=TypeError;J1.exports=function(n){if(VO(n))return n;throw new WO(HO(n)+" is not an object")}});var ko=Z(K1=>{"use strict";var XO=ei(),YO=gm(),$O=ym(),Vf=Go(),j1=Gf(),ZO=TypeError,vm=Object.defineProperty,JO=Object.getOwnPropertyDescriptor,_m="enumerable",xm="configurable",Em="writable";K1.f=XO?$O?function(t,e,i){if(Vf(t),e=j1(e),Vf(i),typeof t=="function"&&e==="prototype"&&"value"in i&&Em in i&&!i[Em]){var s=JO(t,e);s&&s[Em]&&(t[e]=i.value,i={configurable:xm in i?i[xm]:s[xm],enumerable:_m in i?i[_m]:s[_m],writable:!1})}return vm(t,e,i)}:vm:function(t,e,i){if(Vf(t),e=j1(e),Vf(i),YO)try{return vm(t,e,i)}catch(s){}if("get"in i||"set"in i)throw new ZO("Accessors not supported");return"value"in i&&(t[e]=i.value),t}});var hs=Z((DJ,Q1)=>{"use strict";var jO=ei(),KO=ko(),QO=sc();Q1.exports=jO?function(n,t,e){return KO.f(n,t,QO(1,e))}:function(n,t,e){return n[t]=e,n}});var Hf=Z((FJ,eE)=>{"use strict";var wm=ei(),tD=to(),tE=Function.prototype,eD=wm&&Object.getOwnPropertyDescriptor,Sm=tD(tE,"name"),nD=Sm&&function(){}.name==="something",rD=Sm&&(!wm||wm&&eD(tE,"name").configurable);eE.exports={EXISTS:Sm,PROPER:nD,CONFIGURABLE:rD}});var bm=Z((UJ,nE)=>{"use strict";var iD=Zn(),oD=fr(),Mm=Uf(),sD=iD(Function.toString);oD(Mm.inspectSource)||(Mm.inspectSource=function(n){return sD(n)});nE.exports=Mm.inspectSource});var oE=Z((BJ,iE)=>{"use strict";var aD=wn(),uD=fr(),rE=aD.WeakMap;iE.exports=uD(rE)&&/native code/.test(String(rE))});var Wf=Z((zJ,aE)=>{"use strict";var lD=Bf(),cD=zf(),sE=lD("keys");aE.exports=function(n){return sE[n]||(sE[n]=cD(n))}});var Xf=Z((GJ,uE)=>{"use strict";uE.exports={}});var Pa=Z((kJ,fE)=>{"use strict";var fD=oE(),cE=wn(),hD=yi(),pD=hs(),Am=to(),Tm=Uf(),dD=Wf(),mD=Xf(),lE="Object already initialized",Cm=cE.TypeError,gD=cE.WeakMap,Yf,cc,$f,yD=function(n){return $f(n)?cc(n):Yf(n,{})},vD=function(n){return function(t){var e;if(!hD(t)||(e=cc(t)).type!==n)throw new Cm("Incompatible receiver, "+n+" required");return e}};fD||Tm.state?(vo=Tm.state||(Tm.state=new gD),vo.get=vo.get,vo.has=vo.has,vo.set=vo.set,Yf=function(n,t){if(vo.has(n))throw new Cm(lE);return t.facade=n,vo.set(n,t),t},cc=function(n){return vo.get(n)||{}},$f=function(n){return vo.has(n)}):(Ia=dD("state"),mD[Ia]=!0,Yf=function(n,t){if(Am(n,Ia))throw new Cm(lE);return t.facade=n,pD(n,Ia,t),t},cc=function(n){return Am(n,Ia)?n[Ia]:{}},$f=function(n){return Am(n,Ia)});var vo,Ia;fE.exports={set:Yf,get:cc,has:$f,enforce:yD,getterFor:vD}});var Rm=Z((qJ,dE)=>{"use strict";var Pm=Zn(),_D=Un(),xD=fr(),Zf=to(),Im=ei(),ED=Hf().CONFIGURABLE,wD=bm(),pE=Pa(),SD=pE.enforce,MD=pE.get,hE=String,Jf=Object.defineProperty,bD=Pm("".slice),AD=Pm("".replace),TD=Pm([].join),CD=Im&&!_D(function(){return Jf(function(){},"length",{value:8}).length!==8}),ID=String(String).split("String"),PD=dE.exports=function(n,t,e){bD(hE(t),0,7)==="Symbol("&&(t="["+AD(hE(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!Zf(n,"name")||ED&&n.name!==t)&&(Im?Jf(n,"name",{value:t,configurable:!0}):n.name=t),CD&&e&&Zf(e,"arity")&&n.length!==e.arity&&Jf(n,"length",{value:e.arity});try{e&&Zf(e,"constructor")&&e.constructor?Im&&Jf(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var i=SD(n);return Zf(i,"source")||(i.source=TD(ID,typeof t=="string"?t:"")),n};Function.prototype.toString=PD(function(){return xD(this)&&MD(this).source||wD(this)},"toString")});var Ra=Z((VJ,mE)=>{"use strict";var RD=fr(),LD=ko(),ND=Rm(),OD=Ff();mE.exports=function(n,t,e,i){i||(i={});var s=i.enumerable,u=i.name!==void 0?i.name:t;if(RD(e)&&ND(e,u,i),i.global)s?n[t]=e:OD(t,e);else{try{i.unsafe?n[t]&&(s=!0):delete n[t]}catch(c){}s?n[t]=e:LD.f(n,t,{value:e,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return n}});var yE=Z((HJ,gE)=>{"use strict";var DD=Math.ceil,FD=Math.floor;gE.exports=Math.trunc||function(t){var e=+t;return(e>0?FD:DD)(e)}});var _o=Z((WJ,vE)=>{"use strict";var UD=yE();vE.exports=function(n){var t=+n;return t!==t||t===0?0:UD(t)}});var jf=Z((XJ,_E)=>{"use strict";var BD=_o(),zD=Math.max,GD=Math.min;_E.exports=function(n,t){var e=BD(n);return e<0?zD(e+t,0):GD(e,t)}});var La=Z((YJ,xE)=>{"use strict";var kD=_o(),qD=Math.min;xE.exports=function(n){var t=kD(n);return t>0?qD(t,9007199254740991):0}});var eo=Z(($J,EE)=>{"use strict";var VD=La();EE.exports=function(n){return VD(n.length)}});var ME=Z((ZJ,SE)=>{"use strict";var HD=Mu(),WD=jf(),XD=eo(),wE=function(n){return function(t,e,i){var s=HD(t),u=XD(s);if(u===0)return!n&&-1;var c=WD(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}};SE.exports={includes:wE(!0),indexOf:wE(!1)}});var Nm=Z((JJ,AE)=>{"use strict";var YD=Zn(),Lm=to(),$D=Mu(),ZD=ME().indexOf,JD=Xf(),bE=YD([].push);AE.exports=function(n,t){var e=$D(n),i=0,s=[],u;for(u in e)!Lm(JD,u)&&Lm(e,u)&&bE(s,u);for(;t.length>i;)Lm(e,u=t[i++])&&(~ZD(s,u)||bE(s,u));return s}});var Kf=Z((jJ,TE)=>{"use strict";TE.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Om=Z(CE=>{"use strict";var jD=Nm(),KD=Kf(),QD=KD.concat("length","prototype");CE.f=Object.getOwnPropertyNames||function(t){return jD(t,QD)}});var PE=Z(IE=>{"use strict";IE.f=Object.getOwnPropertySymbols});var LE=Z((tj,RE)=>{"use strict";var t3=bu(),e3=Zn(),n3=Om(),r3=PE(),i3=Go(),o3=e3([].concat);RE.exports=t3("Reflect","ownKeys")||function(t){var e=n3.f(i3(t)),i=r3.f;return i?o3(e,i(t)):e}});var Dm=Z((ej,OE)=>{"use strict";var NE=to(),s3=LE(),a3=qf(),u3=ko();OE.exports=function(n,t,e){for(var i=s3(t),s=u3.f,u=a3.f,c=0;c<i.length;c++){var f=i[c];!NE(n,f)&&!(e&&NE(e,f))&&s(n,f,u(t,f))}}});var FE=Z((nj,DE)=>{"use strict";var l3=Un(),c3=fr(),f3=/#|\.prototype\./,fc=function(n,t){var e=p3[h3(n)];return e===m3?!0:e===d3?!1:c3(t)?l3(t):!!t},h3=fc.normalize=function(n){return String(n).replace(f3,".").toLowerCase()},p3=fc.data={},d3=fc.NATIVE="N",m3=fc.POLYFILL="P";DE.exports=fc});var qo=Z((rj,UE)=>{"use strict";var Qf=wn(),g3=qf().f,y3=hs(),v3=Ra(),_3=Ff(),x3=Dm(),E3=FE();UE.exports=function(n,t){var e=n.target,i=n.global,s=n.stat,u,c,f,p,d,m;if(i?c=Qf:s?c=Qf[e]||_3(e,{}):c=Qf[e]&&Qf[e].prototype,c)for(f in t){if(d=t[f],n.dontCallGetSet?(m=g3(c,f),p=m&&m.value):p=c[f],u=E3(i?f:e+(s?".":"#")+f,n.forced),!u&&p!==void 0){if(typeof d==typeof p)continue;x3(d,p)}(n.sham||p&&p.sham)&&y3(d,"sham",!0),v3(c,f,d,n)}}});var Fm=Z((ij,BE)=>{"use strict";var w3=Gs();BE.exports=Array.isArray||function(t){return w3(t)==="Array"}});var GE=Z((oj,zE)=>{"use strict";var S3=ei(),M3=Fm(),b3=TypeError,A3=Object.getOwnPropertyDescriptor,T3=S3&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();zE.exports=T3?function(n,t){if(M3(n)&&!A3(n,"length").writable)throw new b3("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var qE=Z((sj,kE)=>{"use strict";var C3=TypeError,I3=9007199254740991;kE.exports=function(n){if(n>I3)throw C3("Maximum allowed index exceeded");return n}});var hc=Z(()=>{"use strict";var P3=qo(),R3=zo(),L3=eo(),N3=GE(),O3=qE(),D3=Un(),F3=D3(function(){return[].push.call({length:4294967296},1)!==4294967297}),U3=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},B3=F3||!U3();P3({target:"Array",proto:!0,arity:1,forced:B3},{push:function(t){var e=R3(this),i=L3(e),s=arguments.length;O3(i+s);for(var u=0;u<s;u++)e[i]=arguments[u],i++;return N3(e,i),i}})});var YE=Z((lj,XE)=>{"use strict";var z3=Vr(),HE=z3("iterator"),WE=!1;try{VE=0,Um={next:function(){return{done:!!VE++}},return:function(){WE=!0}},Um[HE]=function(){return this},Array.from(Um,function(){throw 2})}catch(n){}var VE,Um;XE.exports=function(n,t){try{if(!t&&!WE)return!1}catch(s){return!1}var e=!1;try{var i={};i[HE]=function(){return{next:function(){return{done:e=!0}}}},n(i)}catch(s){}return e}});var th=Z((cj,$E)=>{"use strict";$E.exports=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"});var jE=Z((fj,JE)=>{"use strict";var G3=Vr(),k3=G3("toStringTag"),ZE={};ZE[k3]="z";JE.exports=String(ZE)==="[object z]"});var ks=Z((hj,KE)=>{"use strict";var q3=jE(),V3=fr(),eh=Gs(),H3=Vr(),W3=H3("toStringTag"),X3=Object,Y3=eh(function(){return arguments}())==="Arguments",$3=function(n,t){try{return n[t]}catch(e){}};KE.exports=q3?eh:function(n){var t,e,i;return n===void 0?"Undefined":n===null?"Null":typeof(e=$3(t=X3(n),W3))=="string"?e:Y3?eh(t):(i=eh(t))==="Object"&&V3(t.callee)?"Arguments":i}});var Cu=Z((pj,tw)=>{"use strict";var QE=Rm(),Z3=ko();tw.exports=function(n,t,e){return e.get&&QE(e.get,t,{getter:!0}),e.set&&QE(e.set,t,{setter:!0}),Z3.f(n,t,e)}});var nw=Z((dj,ew)=>{"use strict";var J3=Un();ew.exports=!J3(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var pc=Z((mj,iw)=>{"use strict";var j3=to(),K3=fr(),Q3=zo(),tF=Wf(),eF=nw(),rw=tF("IE_PROTO"),Bm=Object,nF=Bm.prototype;iw.exports=eF?Bm.getPrototypeOf:function(n){var t=Q3(n);if(j3(t,rw))return t[rw];var e=t.constructor;return K3(e)&&t instanceof e?e.prototype:t instanceof Bm?nF:null}});var nh=Z((gj,ow)=>{"use strict";var rF=Zn(),iF=Ca();ow.exports=function(n,t,e){try{return rF(iF(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(i){}}});var aw=Z((yj,sw)=>{"use strict";var oF=yi();sw.exports=function(n){return oF(n)||n===null}});var lw=Z((vj,uw)=>{"use strict";var sF=aw(),aF=String,uF=TypeError;uw.exports=function(n){if(sF(n))return n;throw new uF("Can't set "+aF(n)+" as a prototype")}});var Iu=Z((_j,cw)=>{"use strict";var lF=nh(),cF=yi(),fF=Su(),hF=lw();cw.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=lF(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(i){}return function(s,u){return fF(s),hF(u),cF(s)&&(n?e(s,u):s.__proto__=u),s}}():void 0)});var Gi=Z((xj,xw)=>{"use strict";var pF=th(),qm=ei(),vi=wn(),dw=fr(),oh=yi(),Vs=to(),Vm=ks(),dF=uc(),mF=hs(),zm=Ra(),gF=Cu(),yF=ac(),sh=pc(),Ru=Iu(),vF=Vr(),_F=zf(),mw=Pa(),gw=mw.enforce,xF=mw.get,rh=vi.Int8Array,Gm=rh&&rh.prototype,fw=vi.Uint8ClampedArray,hw=fw&&fw.prototype,Vo=rh&&sh(rh),xo=Gm&&sh(Gm),EF=Object.prototype,Hm=vi.TypeError,pw=vF("toStringTag"),km=_F("TYPED_ARRAY_TAG"),ih="TypedArrayConstructor",ps=pF&&!!Ru&&Vm(vi.opera)!=="Opera",yw=!1,Ci,qs,Pu,ds={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Wm={BigInt64Array:8,BigUint64Array:8},wF=function(t){if(!oh(t))return!1;var e=Vm(t);return e==="DataView"||Vs(ds,e)||Vs(Wm,e)},vw=function(n){var t=sh(n);if(oh(t)){var e=xF(t);return e&&Vs(e,ih)?e[ih]:vw(t)}},_w=function(n){if(!oh(n))return!1;var t=Vm(n);return Vs(ds,t)||Vs(Wm,t)},SF=function(n){if(_w(n))return n;throw new Hm("Target is not a typed array")},MF=function(n){if(dw(n)&&(!Ru||yF(Vo,n)))return n;throw new Hm(dF(n)+" is not a typed array constructor")},bF=function(n,t,e,i){if(qm){if(e)for(var s in ds){var u=vi[s];if(u&&Vs(u.prototype,n))try{delete u.prototype[n]}catch(c){try{u.prototype[n]=t}catch(f){}}}(!xo[n]||e)&&zm(xo,n,e?t:ps&&Gm[n]||t,i)}},AF=function(n,t,e){var i,s;if(qm){if(Ru){if(e){for(i in ds)if(s=vi[i],s&&Vs(s,n))try{delete s[n]}catch(u){}}if(!Vo[n]||e)try{return zm(Vo,n,e?t:ps&&Vo[n]||t)}catch(u){}else return}for(i in ds)s=vi[i],s&&(!s[n]||e)&&zm(s,n,t)}};for(Ci in ds)qs=vi[Ci],Pu=qs&&qs.prototype,Pu?gw(Pu)[ih]=qs:ps=!1;for(Ci in Wm)qs=vi[Ci],Pu=qs&&qs.prototype,Pu&&(gw(Pu)[ih]=qs);if((!ps||!dw(Vo)||Vo===Function.prototype)&&(Vo=function(){throw new Hm("Incorrect invocation")},ps))for(Ci in ds)vi[Ci]&&Ru(vi[Ci],Vo);if((!ps||!xo||xo===EF)&&(xo=Vo.prototype,ps))for(Ci in ds)vi[Ci]&&Ru(vi[Ci].prototype,xo);ps&&sh(hw)!==xo&&Ru(hw,xo);if(qm&&!Vs(xo,pw)){yw=!0,gF(xo,pw,{configurable:!0,get:function(){return oh(this)?this[km]:void 0}});for(Ci in ds)vi[Ci]&&mF(vi[Ci],km,Ci)}xw.exports={NATIVE_ARRAY_BUFFER_VIEWS:ps,TYPED_ARRAY_TAG:yw&&km,aTypedArray:SF,aTypedArrayConstructor:MF,exportTypedArrayMethod:bF,exportTypedArrayStaticMethod:AF,getTypedArrayConstructor:vw,isView:wF,isTypedArray:_w,TypedArray:Vo,TypedArrayPrototype:xo}});var Sw=Z((Ej,ww)=>{"use strict";var Ew=wn(),Xm=Un(),TF=YE(),CF=Gi().NATIVE_ARRAY_BUFFER_VIEWS,IF=Ew.ArrayBuffer,Na=Ew.Int8Array;ww.exports=!CF||!Xm(function(){Na(1)})||!Xm(function(){new Na(-1)})||!TF(function(n){new Na,new Na(null),new Na(1.5),new Na(n)},!0)||Xm(function(){return new Na(new IF(2),1,void 0).length!==1})});var bw=Z((wj,Mw)=>{"use strict";var PF=Ra();Mw.exports=function(n,t,e){for(var i in t)PF(n,i,t[i],e);return n}});var Ym=Z((Sj,Aw)=>{"use strict";var RF=ac(),LF=TypeError;Aw.exports=function(n,t){if(RF(t,n))return n;throw new LF("Incorrect invocation")}});var ah=Z((Mj,Tw)=>{"use strict";var NF=_o(),OF=La(),DF=RangeError;Tw.exports=function(n){if(n===void 0)return 0;var t=NF(n),e=OF(t);if(t!==e)throw new DF("Wrong length or index");return e}});var Iw=Z((bj,Cw)=>{"use strict";Cw.exports=Math.sign||function(t){var e=+t;return e===0||e!==e?e:e<0?-1:1}});var Lw=Z((Aj,Rw)=>{"use strict";var FF=2220446049250313e-31,Pw=1/FF;Rw.exports=function(n){return n+Pw-Pw}});var Ow=Z((Tj,Nw)=>{"use strict";var UF=Iw(),BF=Lw(),zF=Math.abs,GF=2220446049250313e-31;Nw.exports=function(n,t,e,i){var s=+n,u=zF(s),c=UF(s);if(u<i)return c*BF(u/i/t)*i*t;var f=(1+t/GF)*u,p=f-(f-u);return p>e||p!==p?c*(1/0):c*p}});var Fw=Z((Cj,Dw)=>{"use strict";var kF=Ow(),qF=11920928955078125e-23,VF=34028234663852886e22,HF=11754943508222875e-54;Dw.exports=Math.fround||function(t){return kF(t,qF,VF,HF)}});var Bw=Z((Ij,Uw)=>{"use strict";var WF=Array,XF=Math.abs,ms=Math.pow,YF=Math.floor,$F=Math.log,ZF=Math.LN2,JF=function(n,t,e){var i=WF(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,m,y,v;for(n=XF(n),n!==n||n===1/0?(y=n!==n?1:0,m=u):(m=YF($F(n)/ZF),v=ms(2,-m),n*v<1&&(m--,v*=2),m+c>=1?n+=f/v:n+=f*ms(2,1-c),n*v>=2&&(m++,v/=2),m+c>=u?(y=0,m=u):m+c>=1?(y=(n*v-1)*ms(2,t),m+=c):(y=n*ms(2,c-1)*ms(2,t),m=0));t>=8;)i[d++]=y&255,y/=256,t-=8;for(m=m<<t|y,s+=t;s>0;)i[d++]=m&255,m/=256,s-=8;return i[d-1]|=p*128,i},jF=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,m;for(p>>=7;c>0;)d=d*256+n[f--],c-=8;for(m=d&(1<<-c)-1,d>>=-c,c+=t;c>0;)m=m*256+n[f--],c-=8;if(d===0)d=1-u;else{if(d===s)return m?NaN:p?-1/0:1/0;m+=ms(2,t),d-=u}return(p?-1:1)*m*ms(2,d-t)};Uw.exports={pack:JF,unpack:jF}});var $m=Z((Pj,Gw)=>{"use strict";var KF=zo(),zw=jf(),QF=eo();Gw.exports=function(t){for(var e=KF(this),i=QF(e),s=arguments.length,u=zw(s>1?arguments[1]:void 0,i),c=s>2?arguments[2]:void 0,f=c===void 0?i:zw(c,i);f>u;)e[u++]=t;return e}});var Zm=Z((Rj,kw)=>{"use strict";var tU=Zn();kw.exports=tU([].slice)});var Jm=Z((Lj,Vw)=>{"use strict";var eU=fr(),nU=yi(),qw=Iu();Vw.exports=function(n,t,e){var i,s;return qw&&eU(i=t.constructor)&&i!==e&&nU(s=i.prototype)&&s!==e.prototype&&qw(n,s),n}});var dc=Z((Nj,Ww)=>{"use strict";var rU=ko().f,iU=to(),oU=Vr(),Hw=oU("toStringTag");Ww.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!iU(n,Hw)&&rU(n,Hw,{configurable:!0,value:t})}});var dh=Z((Oj,uS)=>{"use strict";var hh=wn(),eg=Zn(),jm=ei(),sU=th(),rS=Hf(),aU=hs(),uU=Cu(),Xw=bw(),Km=Un(),uh=Ym(),lU=_o(),cU=La(),ch=ah(),fU=Fw(),iS=Bw(),hU=pc(),Yw=Iu(),pU=$m(),dU=Zm(),mU=Jm(),gU=Dm(),oS=dc(),ng=Pa(),yU=rS.PROPER,$w=rS.CONFIGURABLE,Nu="ArrayBuffer",ph="DataView",Ou="prototype",vU="Wrong length",sS="Wrong index",Zw=ng.getterFor(Nu),gc=ng.getterFor(ph),Jw=ng.set,Eo=hh[Nu],ki=Eo,Lu=ki&&ki[Ou],Ho=hh[ph],Oa=Ho&&Ho[Ou],jw=Object.prototype,_U=hh.Array,fh=hh.RangeError,xU=eg(pU),EU=eg([].reverse),aS=iS.pack,Kw=iS.unpack,Qw=function(n){return[n&255]},tS=function(n){return[n&255,n>>8&255]},eS=function(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]},nS=function(n){return n[3]<<24|n[2]<<16|n[1]<<8|n[0]},wU=function(n){return aS(fU(n),23,4)},SU=function(n){return aS(n,52,8)},lh=function(n,t,e){uU(n[Ou],t,{configurable:!0,get:function(){return e(this)[t]}})},Hs=function(n,t,e,i){var s=gc(n),u=ch(e),c=!!i;if(u+t>s.byteLength)throw new fh(sS);var f=s.bytes,p=u+s.byteOffset,d=dU(f,p,p+t);return c?d:EU(d)},Ws=function(n,t,e,i,s,u){var c=gc(n),f=ch(e),p=i(+s),d=!!u;if(f+t>c.byteLength)throw new fh(sS);for(var m=c.bytes,y=f+c.byteOffset,v=0;v<t;v++)m[y+v]=p[d?v:t-v-1]};sU?(Qm=yU&&Eo.name!==Nu,!Km(function(){Eo(1)})||!Km(function(){new Eo(-1)})||Km(function(){return new Eo,new Eo(1.5),new Eo(NaN),Eo.length!==1||Qm&&!$w})?(ki=function(t){return uh(this,Lu),mU(new Eo(ch(t)),this,ki)},ki[Ou]=Lu,Lu.constructor=ki,gU(ki,Eo)):Qm&&$w&&aU(Eo,"name",Nu),Yw&&hU(Oa)!==jw&&Yw(Oa,jw),mc=new Ho(new ki(2)),tg=eg(Oa.setInt8),mc.setInt8(0,2147483648),mc.setInt8(1,2147483649),(mc.getInt8(0)||!mc.getInt8(1))&&Xw(Oa,{setInt8:function(t,e){tg(this,t,e<<24>>24)},setUint8:function(t,e){tg(this,t,e<<24>>24)}},{unsafe:!0})):(ki=function(t){uh(this,Lu);var e=ch(t);Jw(this,{type:Nu,bytes:xU(_U(e),0),byteLength:e}),jm||(this.byteLength=e,this.detached=!1)},Lu=ki[Ou],Ho=function(t,e,i){uh(this,Oa),uh(t,Lu);var s=Zw(t),u=s.byteLength,c=lU(e);if(c<0||c>u)throw new fh("Wrong offset");if(i=i===void 0?u-c:cU(i),c+i>u)throw new fh(vU);Jw(this,{type:ph,buffer:t,byteLength:i,byteOffset:c,bytes:s.bytes}),jm||(this.buffer=t,this.byteLength=i,this.byteOffset=c)},Oa=Ho[Ou],jm&&(lh(ki,"byteLength",Zw),lh(Ho,"buffer",gc),lh(Ho,"byteLength",gc),lh(Ho,"byteOffset",gc)),Xw(Oa,{getInt8:function(t){return Hs(this,1,t)[0]<<24>>24},getUint8:function(t){return Hs(this,1,t)[0]},getInt16:function(t){var e=Hs(this,2,t,arguments.length>1?arguments[1]:!1);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=Hs(this,2,t,arguments.length>1?arguments[1]:!1);return e[1]<<8|e[0]},getInt32:function(t){return nS(Hs(this,4,t,arguments.length>1?arguments[1]:!1))},getUint32:function(t){return nS(Hs(this,4,t,arguments.length>1?arguments[1]:!1))>>>0},getFloat32:function(t){return Kw(Hs(this,4,t,arguments.length>1?arguments[1]:!1),23)},getFloat64:function(t){return Kw(Hs(this,8,t,arguments.length>1?arguments[1]:!1),52)},setInt8:function(t,e){Ws(this,1,t,Qw,e)},setUint8:function(t,e){Ws(this,1,t,Qw,e)},setInt16:function(t,e){Ws(this,2,t,tS,e,arguments.length>2?arguments[2]:!1)},setUint16:function(t,e){Ws(this,2,t,tS,e,arguments.length>2?arguments[2]:!1)},setInt32:function(t,e){Ws(this,4,t,eS,e,arguments.length>2?arguments[2]:!1)},setUint32:function(t,e){Ws(this,4,t,eS,e,arguments.length>2?arguments[2]:!1)},setFloat32:function(t,e){Ws(this,4,t,wU,e,arguments.length>2?arguments[2]:!1)},setFloat64:function(t,e){Ws(this,8,t,SU,e,arguments.length>2?arguments[2]:!1)}}));var Qm,mc,tg;oS(ki,Nu);oS(Ho,ph);uS.exports={ArrayBuffer:ki,DataView:Ho}});var cS=Z((Dj,lS)=>{"use strict";var MU=yi(),bU=Math.floor;lS.exports=Number.isInteger||function(t){return!MU(t)&&isFinite(t)&&bU(t)===t}});var hS=Z((Fj,fS)=>{"use strict";var AU=_o(),TU=RangeError;fS.exports=function(n){var t=AU(n);if(t<0)throw new TU("The argument can't be less than 0");return t}});var rg=Z((Uj,pS)=>{"use strict";var CU=hS(),IU=RangeError;pS.exports=function(n,t){var e=CU(n);if(e%t)throw new IU("Wrong offset");return e}});var mS=Z((Bj,dS)=>{"use strict";var PU=Math.round;dS.exports=function(n){var t=PU(n);return t<0?0:t>255?255:t&255}});var yS=Z((zj,gS)=>{"use strict";var RU=Nm(),LU=Kf();gS.exports=Object.keys||function(t){return RU(t,LU)}});var _S=Z(vS=>{"use strict";var NU=ei(),OU=ym(),DU=ko(),FU=Go(),UU=Mu(),BU=yS();vS.f=NU&&!OU?Object.defineProperties:function(t,e){FU(t);for(var i=UU(e),s=BU(e),u=s.length,c=0,f;u>c;)DU.f(t,f=s[c++],i[f]);return t}});var ES=Z((kj,xS)=>{"use strict";var zU=bu();xS.exports=zU("document","documentElement")});var Du=Z((qj,CS)=>{"use strict";var GU=Go(),kU=_S(),wS=Kf(),qU=Xf(),VU=ES(),HU=kf(),WU=Wf(),SS=">",MS="<",og="prototype",sg="script",AS=WU("IE_PROTO"),ig=function(){},TS=function(n){return MS+sg+SS+n+MS+"/"+sg+SS},bS=function(n){n.write(TS("")),n.close();var t=n.parentWindow.Object;return n=null,t},XU=function(){var n=HU("iframe"),t="java"+sg+":",e;return n.style.display="none",VU.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(TS("document.F=Object")),e.close(),e.F},mh,gh=function(){try{mh=new ActiveXObject("htmlfile")}catch(t){}gh=typeof document!="undefined"?document.domain&&mh?bS(mh):XU():bS(mh);for(var n=wS.length;n--;)delete gh[og][wS[n]];return gh()};qU[AS]=!0;CS.exports=Object.create||function(t,e){var i;return t!==null?(ig[og]=GU(t),i=new ig,ig[og]=null,i[AS]=t):i=gh(),e===void 0?i:kU.f(i,e)}});var yh=Z((Vj,IS)=>{"use strict";var YU=Gs(),$U=Zn();IS.exports=function(n){if(YU(n)==="Function")return $U(n)}});var vh=Z((Hj,RS)=>{"use strict";var PS=yh(),ZU=Ca(),JU=oc(),jU=PS(PS.bind);RS.exports=function(n,t){return ZU(n),t===void 0?n:JU?jU(n,t):function(){return n.apply(t,arguments)}}});var ug=Z((Wj,FS)=>{"use strict";var KU=Zn(),QU=Un(),LS=fr(),tB=ks(),eB=bu(),nB=bm(),NS=function(){},OS=eB("Reflect","construct"),ag=/^\s*(?:class|function)\b/,rB=KU(ag.exec),iB=!ag.test(NS),yc=function(t){if(!LS(t))return!1;try{return OS(NS,[],t),!0}catch(e){return!1}},DS=function(t){if(!LS(t))return!1;switch(tB(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return iB||!!rB(ag,nB(t))}catch(e){return!0}};DS.sham=!0;FS.exports=!OS||QU(function(){var n;return yc(yc.call)||!yc(Object)||!yc(function(){n=!0})||n})?DS:yc});var BS=Z((Xj,US)=>{"use strict";var oB=ug(),sB=uc(),aB=TypeError;US.exports=function(n){if(oB(n))return n;throw new aB(sB(n)+" is not a constructor")}});var Fu=Z((Yj,zS)=>{"use strict";zS.exports={}});var lg=Z(($j,kS)=>{"use strict";var uB=ks(),GS=Df(),lB=Rf(),cB=Fu(),fB=Vr(),hB=fB("iterator");kS.exports=function(n){if(!lB(n))return GS(n,hB)||GS(n,"@@iterator")||cB[uB(n)]}});var VS=Z((Zj,qS)=>{"use strict";var pB=gi(),dB=Ca(),mB=Go(),gB=uc(),yB=lg(),vB=TypeError;qS.exports=function(n,t){var e=arguments.length<2?yB(n):t;if(dB(e))return mB(pB(e,n));throw new vB(gB(n)+" is not iterable")}});var WS=Z((Jj,HS)=>{"use strict";var _B=Vr(),xB=Fu(),EB=_B("iterator"),wB=Array.prototype;HS.exports=function(n){return n!==void 0&&(xB.Array===n||wB[EB]===n)}});var cg=Z((jj,XS)=>{"use strict";var SB=ks();XS.exports=function(n){var t=SB(n);return t==="BigInt64Array"||t==="BigUint64Array"}});var _h=Z((Kj,YS)=>{"use strict";var MB=dm(),bB=TypeError;YS.exports=function(n){var t=MB(n,"number");if(typeof t=="number")throw new bB("Can't convert number to bigint");return BigInt(t)}});var ZS=Z((Qj,$S)=>{"use strict";var AB=vh(),TB=gi(),CB=BS(),IB=zo(),PB=eo(),RB=VS(),LB=lg(),NB=WS(),OB=cg(),DB=Gi().aTypedArrayConstructor,FB=_h();$S.exports=function(t){var e=CB(this),i=IB(t),s=arguments.length,u=s>1?arguments[1]:void 0,c=u!==void 0,f=LB(i),p,d,m,y,v,E,M,A;if(f&&!NB(f))for(M=RB(i,f),A=M.next,i=[];!(E=TB(A,M)).done;)i.push(E.value);for(c&&s>2&&(u=AB(u,arguments[2])),d=PB(i),m=new(DB(e))(d),y=OB(m),p=0;d>p;p++)v=c?u(i[p],p):i[p],m[p]=y?FB(v):+v;return m}});var QS=Z((tK,KS)=>{"use strict";var JS=Fm(),UB=ug(),BB=yi(),zB=Vr(),GB=zB("species"),jS=Array;KS.exports=function(n){var t;return JS(n)&&(t=n.constructor,UB(t)&&(t===jS||JS(t.prototype))?t=void 0:BB(t)&&(t=t[GB],t===null&&(t=void 0))),t===void 0?jS:t}});var eM=Z((eK,tM)=>{"use strict";var kB=QS();tM.exports=function(n,t){return new(kB(n))(t===0?0:t)}});var iM=Z((nK,rM)=>{"use strict";var qB=vh(),VB=Zn(),HB=Pf(),WB=zo(),XB=eo(),YB=eM(),nM=VB([].push),Xs=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,m,y){for(var v=WB(p),E=HB(v),M=XB(E),A=qB(d,m),_=0,x=y||YB,T=t?x(p,M):e||c?x(p,0):void 0,S,R;M>_;_++)if((f||_ in E)&&(S=E[_],R=A(S,_,v),n))if(t)T[_]=R;else if(R)switch(n){case 3:return!0;case 5:return S;case 6:return _;case 2:nM(T,S)}else switch(n){case 4:return!1;case 7:nM(T,S)}return u?-1:i||s?s:T}};rM.exports={forEach:Xs(0),map:Xs(1),filter:Xs(2),some:Xs(3),every:Xs(4),find:Xs(5),findIndex:Xs(6),filterReject:Xs(7)}});var fg=Z((rK,sM)=>{"use strict";var $B=bu(),ZB=Cu(),JB=Vr(),jB=ei(),oM=JB("species");sM.exports=function(n){var t=$B(n);jB&&t&&!t[oM]&&ZB(t,oM,{configurable:!0,get:function(){return this}})}});var hg=Z((iK,aM)=>{"use strict";var KB=eo();aM.exports=function(n,t,e){for(var i=0,s=arguments.length>2?e:KB(t),u=new n(s);s>i;)u[i]=t[i++];return u}});var TM=Z((oK,_g)=>{"use strict";var uM=qo(),_M=wn(),lM=gi(),QB=ei(),tz=Sw(),Ec=Gi(),xM=dh(),cM=Ym(),ez=sc(),vc=hs(),nz=cS(),rz=La(),fM=ah(),pg=rg(),iz=mS(),EM=Gf(),_c=to(),oz=ks(),gg=yi(),sz=Of(),az=Du(),uz=ac(),xh=Iu(),lz=Om().f,hM=ZS(),cz=iM().forEach,fz=fg(),hz=Cu(),wM=ko(),SM=qf(),pM=hg(),xg=Pa(),pz=Jm(),yg=xg.get,dz=xg.set,mz=xg.enforce,MM=wM.f,gz=SM.f,dg=_M.RangeError,bM=xM.ArrayBuffer,yz=bM.prototype,vz=xM.DataView,Eh=Ec.NATIVE_ARRAY_BUFFER_VIEWS,dM=Ec.TYPED_ARRAY_TAG,mM=Ec.TypedArray,xc=Ec.TypedArrayPrototype,vg=Ec.isTypedArray,wh="BYTES_PER_ELEMENT",mg="Wrong length",Sh=function(n,t){hz(n,t,{configurable:!0,get:function(){return yg(this)[t]}})},gM=function(n){var t;return uz(yz,n)||(t=oz(n))==="ArrayBuffer"||t==="SharedArrayBuffer"},AM=function(n,t){return vg(n)&&!sz(t)&&t in n&&nz(+t)&&t>=0},yM=function(t,e){return e=EM(e),AM(t,e)?ez(2,t[e]):gz(t,e)},vM=function(t,e,i){return e=EM(e),AM(t,e)&&gg(i)&&_c(i,"value")&&!_c(i,"get")&&!_c(i,"set")&&!i.configurable&&(!_c(i,"writable")||i.writable)&&(!_c(i,"enumerable")||i.enumerable)?(t[e]=i.value,t):MM(t,e,i)};QB?(Eh||(SM.f=yM,wM.f=vM,Sh(xc,"buffer"),Sh(xc,"byteOffset"),Sh(xc,"byteLength"),Sh(xc,"length")),uM({target:"Object",stat:!0,forced:!Eh},{getOwnPropertyDescriptor:yM,defineProperty:vM}),_g.exports=function(n,t,e){var i=n.match(/\d+/)[0]/8,s=n+(e?"Clamped":"")+"Array",u="get"+n,c="set"+n,f=_M[s],p=f,d=p&&p.prototype,m={},y=function(A,_){var x=yg(A);return x.view[u](_*i+x.byteOffset,!0)},v=function(A,_,x){var T=yg(A);T.view[c](_*i+T.byteOffset,e?iz(x):x,!0)},E=function(A,_){MM(A,_,{get:function(){return y(this,_)},set:function(x){return v(this,_,x)},enumerable:!0})};Eh?tz&&(p=t(function(A,_,x,T){return cM(A,d),pz(function(){return gg(_)?gM(_)?T!==void 0?new f(_,pg(x,i),T):x!==void 0?new f(_,pg(x,i)):new f(_):vg(_)?pM(p,_):lM(hM,p,_):new f(fM(_))}(),A,p)}),xh&&xh(p,mM),cz(lz(f),function(A){A in p||vc(p,A,f[A])}),p.prototype=d):(p=t(function(A,_,x,T){cM(A,d);var S=0,R=0,z,U,D;if(!gg(_))D=fM(_),U=D*i,z=new bM(U);else if(gM(_)){z=_,R=pg(x,i);var P=_.byteLength;if(T===void 0){if(P%i)throw new dg(mg);if(U=P-R,U<0)throw new dg(mg)}else if(U=rz(T)*i,U+R>P)throw new dg(mg);D=U/i}else return vg(_)?pM(p,_):lM(hM,p,_);for(dz(A,{buffer:z,byteOffset:R,byteLength:U,length:D,view:new vz(z)});S<D;)E(A,S++)}),xh&&xh(p,mM),d=p.prototype=az(xc)),d.constructor!==p&&vc(d,"constructor",p),mz(d).TypedArrayConstructor=p,dM&&vc(d,dM,s);var M=p!==f;m[s]=p,uM({global:!0,constructor:!0,forced:M,sham:!Eh},m),wh in p||vc(p,wh,i),wh in d||vc(d,wh,i),fz(s)}):_g.exports=function(){}});var Eg=Z(()=>{"use strict";var _z=TM();_z("Float32",function(n){return function(e,i,s){return n(this,e,i,s)}})});var wg=Z(()=>{"use strict";var CM=Gi(),xz=eo(),Ez=_o(),wz=CM.aTypedArray,Sz=CM.exportTypedArrayMethod;Sz("at",function(t){var e=wz(this),i=xz(e),s=Ez(t),u=s>=0?s:i+s;return u<0||u>=i?void 0:e[u]})});var Sg=Z(()=>{"use strict";var IM=Gi(),Mz=$m(),bz=_h(),Az=ks(),Tz=gi(),Cz=Zn(),Iz=Un(),Pz=IM.aTypedArray,Rz=IM.exportTypedArrayMethod,Lz=Cz("".slice),Nz=Iz(function(){var n=0;return new Int8Array(2).fill({valueOf:function(){return n++}}),n!==1});Rz("fill",function(t){var e=arguments.length;Pz(this);var i=Lz(Az(this),0,3)==="Big"?bz(t):+t;return Tz(Mz,this,i,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},Nz)});var Mg=Z((hK,RM)=>{"use strict";var Oz=vh(),Dz=Pf(),Fz=zo(),Uz=eo(),PM=function(n){var t=n===1;return function(e,i,s){for(var u=Fz(e),c=Dz(u),f=Uz(c),p=Oz(i,s),d,m;f-- >0;)if(d=c[f],m=p(d,f,u),m)switch(n){case 0:return d;case 1:return f}return t?-1:void 0}};RM.exports={findLast:PM(0),findLastIndex:PM(1)}});var bg=Z(()=>{"use strict";var LM=Gi(),Bz=Mg().findLast,zz=LM.aTypedArray,Gz=LM.exportTypedArrayMethod;Gz("findLast",function(t){return Bz(zz(this),t,arguments.length>1?arguments[1]:void 0)})});var Ag=Z(()=>{"use strict";var NM=Gi(),kz=Mg().findLastIndex,qz=NM.aTypedArray,Vz=NM.exportTypedArrayMethod;Vz("findLastIndex",function(t){return kz(qz(this),t,arguments.length>1?arguments[1]:void 0)})});var Pg=Z(()=>{"use strict";var DM=wn(),FM=gi(),Ig=Gi(),Hz=eo(),Wz=rg(),Xz=zo(),UM=Un(),Yz=DM.RangeError,Tg=DM.Int8Array,OM=Tg&&Tg.prototype,BM=OM&&OM.set,$z=Ig.aTypedArray,Zz=Ig.exportTypedArrayMethod,Cg=!UM(function(){var n=new Uint8ClampedArray(2);return FM(BM,n,{length:1,0:3},1),n[1]!==3}),Jz=Cg&&Ig.NATIVE_ARRAY_BUFFER_VIEWS&&UM(function(){var n=new Tg(2);return n.set(1),n.set("2",1),n[0]!==0||n[1]!==2});Zz("set",function(t){$z(this);var e=Wz(arguments.length>1?arguments[1]:void 0,1),i=Xz(t);if(Cg)return FM(BM,this,i,e);var s=this.length,u=Hz(i),c=0;if(u+e>s)throw new Yz("Wrong length");for(;c<u;)this[e+c]=i[c++]},!Cg||Jz)});var kM=Z((_K,GM)=>{"use strict";var zM=Zm(),jz=Math.floor,Rg=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=jz(e/2),f=Rg(zM(n,0,c),t),p=Rg(zM(n,c),t),d=f.length,m=p.length,y=0,v=0;y<d||v<m;)n[y+v]=y<d&&v<m?t(f[y],p[v])<=0?f[y++]:p[v++]:y<d?f[y++]:p[v++];return n};GM.exports=Rg});var HM=Z((xK,VM)=>{"use strict";var Kz=Au(),qM=Kz.match(/firefox\/(\d+)/i);VM.exports=!!qM&&+qM[1]});var XM=Z((EK,WM)=>{"use strict";var Qz=Au();WM.exports=/MSIE|Trident/.test(Qz)});var ZM=Z((wK,$M)=>{"use strict";var tG=Au(),YM=tG.match(/AppleWebKit\/(\d+)\./);$M.exports=!!YM&&+YM[1]});var Ng=Z(()=>{"use strict";var eG=wn(),nG=yh(),Lg=Un(),rG=Ca(),iG=kM(),tb=Gi(),JM=HM(),oG=XM(),jM=Nf(),KM=ZM(),sG=tb.aTypedArray,aG=tb.exportTypedArrayMethod,wc=eG.Uint16Array,Uu=wc&&nG(wc.prototype.sort),uG=!!Uu&&!(Lg(function(){Uu(new wc(2),null)})&&Lg(function(){Uu(new wc(2),{})})),QM=!!Uu&&!Lg(function(){if(jM)return jM<74;if(JM)return JM<67;if(oG)return!0;if(KM)return KM<602;var n=new wc(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(Uu(n,function(s,u){return(s/4|0)-(u/4|0)}),e=0;e<516;e++)if(n[e]!==t[e])return!0}),lG=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}};aG("sort",function(t){return t!==void 0&&rG(t),QM?Uu(this,t):iG(sG(this),lG(t))},!QM||uG)});var nb=Z((bK,eb)=>{"use strict";var cG=eo();eb.exports=function(n,t){for(var e=cG(n),i=new t(e),s=0;s<e;s++)i[s]=n[e-s-1];return i}});var Dg=Z(()=>{"use strict";var fG=nb(),Og=Gi(),hG=Og.aTypedArray,pG=Og.exportTypedArrayMethod,dG=Og.getTypedArrayConstructor;pG("toReversed",function(){return fG(hG(this),dG(this))})});var Fg=Z(()=>{"use strict";var Mh=Gi(),mG=Zn(),gG=Ca(),yG=hg(),vG=Mh.aTypedArray,_G=Mh.getTypedArrayConstructor,xG=Mh.exportTypedArrayMethod,EG=mG(Mh.TypedArrayPrototype.sort);xG("toSorted",function(t){t!==void 0&&gG(t);var e=vG(this),i=yG(_G(e),e);return EG(i,t)})});var ib=Z((PK,rb)=>{"use strict";var wG=eo(),SG=_o(),MG=RangeError;rb.exports=function(n,t,e,i){var s=wG(n),u=SG(e),c=u<0?s+u:u;if(c>=s||c<0)throw new MG("Incorrect index");for(var f=new t(s),p=0;p<s;p++)f[p]=p===c?i:n[p];return f}});var Bg=Z(()=>{"use strict";var bG=ib(),Ug=Gi(),AG=cg(),TG=_o(),CG=_h(),IG=Ug.aTypedArray,PG=Ug.getTypedArrayConstructor,RG=Ug.exportTypedArrayMethod,LG=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(n){return n===8}}();RG("with",function(n,t){var e=IG(this),i=TG(n),s=AG(e)?CG(t):+t;return bG(e,PG(e),i,s)},!LG)});var Gg=Z(()=>{"use strict";var NG=qo(),OG=wn(),DG=dh(),FG=fg(),zg="ArrayBuffer",ob=DG[zg],UG=OG[zg];NG({global:!0,constructor:!0,forced:UG!==ob},{ArrayBuffer:ob});FG(zg)});var Hg=Z(()=>{"use strict";var BG=qo(),qg=yh(),zG=Un(),lb=dh(),sb=Go(),ab=jf(),GG=La(),Vg=lb.ArrayBuffer,kg=lb.DataView,cb=kg.prototype,ub=qg(Vg.prototype.slice),kG=qg(cb.getUint8),qG=qg(cb.setUint8),VG=zG(function(){return!new Vg(2).slice(1,void 0).byteLength});BG({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:VG},{slice:function(t,e){if(ub&&e===void 0)return ub(sb(this),t);for(var i=sb(this).byteLength,s=ab(t,i),u=ab(e===void 0?i:e,i),c=new Vg(GG(u-s)),f=new kg(this),p=new kg(c),d=0;s<u;)qG(p,d++,kG(f,s++));return c}})});var Wg=Z((UK,pb)=>{"use strict";var hb=wn(),HG=nh(),WG=Gs(),fb=hb.ArrayBuffer,XG=hb.TypeError;pb.exports=fb&&HG(fb.prototype,"byteLength","get")||function(n){if(WG(n)!=="ArrayBuffer")throw new XG("ArrayBuffer expected");return n.byteLength}});var Xg=Z((BK,db)=>{"use strict";var YG=wn(),$G=th(),ZG=Wg(),JG=YG.DataView;db.exports=function(n){if(!$G||ZG(n)!==0)return!1;try{return new JG(n),!1}catch(t){return!0}}});var Yg=Z(()=>{"use strict";var jG=ei(),KG=Cu(),QG=Xg(),mb=ArrayBuffer.prototype;jG&&!("detached"in mb)&&KG(mb,"detached",{configurable:!0,get:function(){return QG(this)}})});var yb=Z((kK,gb)=>{"use strict";var t4=Xg(),e4=TypeError;gb.exports=function(n){if(t4(n))throw new e4("ArrayBuffer is detached");return n}});var $g=Z((qK,vb)=>{"use strict";var Sc=wn(),n4=Au(),r4=Gs(),bh=function(n){return n4.slice(0,n.length)===n};vb.exports=function(){return bh("Bun/")?"BUN":bh("Cloudflare-Workers")?"CLOUDFLARE":bh("Deno/")?"DENO":bh("Node.js/")?"NODE":Sc.Bun&&typeof Bun.version=="string"?"BUN":Sc.Deno&&typeof Deno.version=="object"?"DENO":r4(Sc.process)==="process"?"NODE":Sc.window&&Sc.document?"BROWSER":"REST"}()});var xb=Z((VK,_b)=>{"use strict";var i4=$g();_b.exports=i4==="NODE"});var wb=Z((HK,Eb)=>{"use strict";var o4=wn(),s4=xb();Eb.exports=function(n){if(s4){try{return o4.process.getBuiltinModule(n)}catch(t){}try{return Function('return require("'+n+'")')()}catch(t){}}}});var jg=Z((WK,Mb)=>{"use strict";var a4=wn(),u4=Un(),Zg=Nf(),Jg=$g(),Sb=a4.structuredClone;Mb.exports=!!Sb&&!u4(function(){if(Jg==="DENO"&&Zg>92||Jg==="NODE"&&Zg>94||Jg==="BROWSER"&&Zg>97)return!1;var n=new ArrayBuffer(8),t=Sb(n,{transfer:[n]});return n.byteLength!==0||t.byteLength!==8})});var Cb=Z((XK,Tb)=>{"use strict";var e0=wn(),l4=wb(),c4=jg(),f4=e0.structuredClone,bb=e0.ArrayBuffer,Ah=e0.MessageChannel,t0=!1,Kg,Ab,Th,Qg;if(c4)t0=function(n){f4(n,{transfer:[n]})};else if(bb)try{Ah||(Kg=l4("worker_threads"),Kg&&(Ah=Kg.MessageChannel)),Ah&&(Ab=new Ah,Th=new bb(2),Qg=function(n){Ab.port1.postMessage(null,[n])},Th.byteLength===2&&(Qg(Th),Th.byteLength===0&&(t0=Qg)))}catch(n){}Tb.exports=t0});var a0=Z((YK,Db)=>{"use strict";var i0=wn(),o0=Zn(),Lb=nh(),h4=ah(),p4=yb(),d4=Wg(),Ib=Cb(),n0=jg(),m4=i0.structuredClone,Nb=i0.ArrayBuffer,r0=i0.DataView,g4=Math.min,s0=Nb.prototype,Ob=r0.prototype,y4=o0(s0.slice),Pb=Lb(s0,"resizable","get"),Rb=Lb(s0,"maxByteLength","get"),v4=o0(Ob.getInt8),_4=o0(Ob.setInt8);Db.exports=(n0||Ib)&&function(n,t,e){var i=d4(n),s=t===void 0?i:h4(t),u=!Pb||!Pb(n),c;if(p4(n),n0&&(n=m4(n,{transfer:[n]}),i===s&&(e||u)))return n;if(i>=s&&(!e||u))c=y4(n,0,s);else{var f=e&&!u&&Rb?{maxByteLength:Rb(n)}:void 0;c=new Nb(s,f);for(var p=new r0(n),d=new r0(c),m=g4(s,i),y=0;y<m;y++)_4(d,y,v4(p,y))}return n0||Ib(n),c}});var u0=Z(()=>{"use strict";var x4=qo(),Fb=a0();Fb&&x4({target:"ArrayBuffer",proto:!0},{transfer:function(){return Fb(this,arguments.length?arguments[0]:void 0,!0)}})});var l0=Z(()=>{"use strict";var E4=qo(),Ub=a0();Ub&&E4({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return Ub(this,arguments.length?arguments[0]:void 0,!1)}})});var Bb=Z(()=>{"use strict";var w4=qo(),S4=gi();w4({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return S4(URL.prototype.toString,this)}})});var GT=Z((oQ,zT)=>{"use strict";zT.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 VT=Z((sQ,qT)=>{"use strict";var o8=kf(),Jy=o8("span").classList,kT=Jy&&Jy.constructor&&Jy.constructor.prototype;qT.exports=kT===Object.prototype?void 0:kT});var WT=Z((aQ,HT)=>{"use strict";var s8=Vr(),a8=Du(),u8=ko().f,jy=s8("unscopables"),Ky=Array.prototype;Ky[jy]===void 0&&u8(Ky,jy,{configurable:!0,value:a8(null)});HT.exports=function(n){Ky[jy][n]=!0}});var nv=Z((uQ,$T)=>{"use strict";var l8=Un(),c8=fr(),f8=yi(),h8=Du(),XT=pc(),p8=Ra(),d8=Vr(),m8=lc(),ev=d8("iterator"),YT=!1,Is,Qy,tv;[].keys&&(tv=[].keys(),"next"in tv?(Qy=XT(XT(tv)),Qy!==Object.prototype&&(Is=Qy)):YT=!0);var g8=!f8(Is)||l8(function(){var n={};return Is[ev].call(n)!==n});g8?Is={}:m8&&(Is=h8(Is));c8(Is[ev])||p8(Is,ev,function(){return this});$T.exports={IteratorPrototype:Is,BUGGY_SAFARI_ITERATORS:YT}});var JT=Z((lQ,ZT)=>{"use strict";var y8=nv().IteratorPrototype,v8=Du(),_8=sc(),x8=dc(),E8=Fu(),w8=function(){return this};ZT.exports=function(n,t,e,i){var s=t+" Iterator";return n.prototype=v8(y8,{next:_8(+!i,e)}),x8(n,s,!1,!0),E8[s]=w8,n}});var aC=Z((cQ,sC)=>{"use strict";var S8=qo(),M8=gi(),Lp=lc(),iC=Hf(),b8=fr(),A8=JT(),jT=pc(),KT=Iu(),T8=dc(),C8=hs(),rv=Ra(),I8=Vr(),QT=Fu(),oC=nv(),P8=iC.PROPER,R8=iC.CONFIGURABLE,tC=oC.IteratorPrototype,Np=oC.BUGGY_SAFARI_ITERATORS,Wc=I8("iterator"),eC="keys",Xc="values",nC="entries",rC=function(){return this};sC.exports=function(n,t,e,i,s,u,c){A8(e,t,i);var f=function(x){if(x===s&&v)return v;if(!Np&&x&&x in m)return m[x];switch(x){case eC:return function(){return new e(this,x)};case Xc:return function(){return new e(this,x)};case nC:return function(){return new e(this,x)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,m=n.prototype,y=m[Wc]||m["@@iterator"]||s&&m[s],v=!Np&&y||f(s),E=t==="Array"&&m.entries||y,M,A,_;if(E&&(M=jT(E.call(new n)),M!==Object.prototype&&M.next&&(!Lp&&jT(M)!==tC&&(KT?KT(M,tC):b8(M[Wc])||rv(M,Wc,rC)),T8(M,p,!0,!0),Lp&&(QT[p]=rC))),P8&&s===Xc&&y&&y.name!==Xc&&(!Lp&&R8?C8(m,"name",Xc):(d=!0,v=function(){return M8(y,this)})),s)if(A={values:f(Xc),keys:u?v:f(eC),entries:f(nC)},c)for(_ in A)(Np||d||!(_ in m))&&rv(m,_,A[_]);else S8({target:t,proto:!0,forced:Np||d},A);return(!Lp||c)&&m[Wc]!==v&&rv(m,Wc,v,{name:s}),QT[t]=v,A}});var lC=Z((fQ,uC)=>{"use strict";uC.exports=function(n,t){return{value:n,done:t}}});var mC=Z((hQ,dC)=>{"use strict";var L8=Mu(),iv=WT(),cC=Fu(),hC=Pa(),N8=ko().f,O8=aC(),Op=lC(),D8=lc(),F8=ei(),pC="Array Iterator",U8=hC.set,B8=hC.getterFor(pC);dC.exports=O8(Array,"Array",function(n,t){U8(this,{type:pC,target:L8(n),index:0,kind:t})},function(){var n=B8(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Op(void 0,!0);switch(n.kind){case"keys":return Op(e,!1);case"values":return Op(t[e],!1)}return Op([e,t[e]],!1)},"values");var fC=cC.Arguments=cC.Array;iv("keys");iv("values");iv("entries");if(!D8&&F8&&fC.name!=="values")try{N8(fC,"name",{value:"values"})}catch(n){}});var av=Z(()=>{"use strict";var gC=wn(),vC=GT(),z8=VT(),Yc=mC(),yC=hs(),G8=dc(),k8=Vr(),ov=k8("iterator"),sv=Yc.values,_C=function(n,t){if(n){if(n[ov]!==sv)try{yC(n,ov,sv)}catch(i){n[ov]=sv}if(G8(n,t,!0),vC[t]){for(var e in Yc)if(n[e]!==Yc[e])try{yC(n,e,Yc[e])}catch(i){n[e]=Yc[e]}}}};for(Dp in vC)_C(gC[Dp]&&gC[Dp].prototype,Dp);var Dp;_C(z8,"DOMTokenList")});var Fp=Z((EQ,xC)=>{"use strict";var q8=ks(),V8=String;xC.exports=function(n){if(q8(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return V8(n)}});var wC=Z((wQ,EC)=>{"use strict";var H8=Go();EC.exports=function(){var n=H8(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 MC=Z((SQ,SC)=>{"use strict";var uv=Un(),W8=wn(),lv=W8.RegExp,cv=uv(function(){var n=lv("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),X8=cv||uv(function(){return!lv("a","y").sticky}),Y8=cv||uv(function(){var n=lv("^r","gy");return n.lastIndex=2,n.exec("str")!==null});SC.exports={BROKEN_CARET:Y8,MISSED_STICKY:X8,UNSUPPORTED_Y:cv}});var AC=Z((MQ,bC)=>{"use strict";var $8=Un(),Z8=wn(),J8=Z8.RegExp;bC.exports=$8(function(){var n=J8(".","s");return!(n.dotAll&&n.test(`
2
+ `)&&n.flags==="s")})});var CC=Z((bQ,TC)=>{"use strict";var j8=Un(),K8=wn(),Q8=K8.RegExp;TC.exports=j8(function(){var n=Q8("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var zp=Z((AQ,PC)=>{"use strict";var _l=gi(),Bp=Zn(),tW=Fp(),eW=wC(),nW=MC(),rW=Bf(),iW=Du(),oW=Pa().get,sW=AC(),aW=CC(),uW=rW("native-string-replace",String.prototype.replace),Up=RegExp.prototype.exec,hv=Up,lW=Bp("".charAt),cW=Bp("".indexOf),fW=Bp("".replace),fv=Bp("".slice),pv=function(){var n=/a/,t=/b*/g;return _l(Up,n,"a"),_l(Up,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),IC=nW.BROKEN_CARET,dv=/()??/.exec("")[1]!==void 0,hW=pv||dv||IC||sW||aW;hW&&(hv=function(t){var e=this,i=oW(e),s=tW(t),u=i.raw,c,f,p,d,m,y,v;if(u)return u.lastIndex=e.lastIndex,c=_l(hv,u,s),e.lastIndex=u.lastIndex,c;var E=i.groups,M=IC&&e.sticky,A=_l(eW,e),_=e.source,x=0,T=s;if(M&&(A=fW(A,"y",""),cW(A,"g")===-1&&(A+="g"),T=fv(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&lW(s,e.lastIndex-1)!==`
3
+ `)&&(_="(?: "+_+")",T=" "+T,x++),f=new RegExp("^(?:"+_+")",A)),dv&&(f=new RegExp("^"+_+"$(?!\\s)",A)),pv&&(p=e.lastIndex),d=_l(Up,M?f:e,T),M?d?(d.input=fv(d.input,x),d[0]=fv(d[0],x),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:pv&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),dv&&d&&d.length>1&&_l(uW,d[0],f,function(){for(m=1;m<arguments.length-2;m++)arguments[m]===void 0&&(d[m]=void 0)}),d&&E)for(d.groups=y=iW(null),m=0;m<E.length;m++)v=E[m],y[v[0]]=d[v[1]];return d});PC.exports=hv});var mv=Z(()=>{"use strict";var pW=qo(),RC=zp();pW({target:"RegExp",proto:!0,forced:/./.exec!==RC},{exec:RC})});var Gp=Z((DQ,OC)=>{"use strict";var NC=Object.getOwnPropertySymbols,yW=Object.prototype.hasOwnProperty,vW=Object.prototype.propertyIsEnumerable;function _W(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function xW(){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}}OC.exports=xW()?Object.assign:function(n,t){for(var e,i=_W(n),s,u=1;u<arguments.length;u++){e=Object(arguments[u]);for(var c in e)yW.call(e,c)&&(i[c]=e[c]);if(NC){s=NC(e);for(var f=0;f<s.length;f++)vW.call(e,s[f])&&(i[s[f]]=e[s[f]])}}return i}});var Ev=Z((_v,xv)=>{(function(n,t){typeof _v=="object"&&typeof xv!="undefined"?xv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(_v,function(){"use strict";function n(_,x,T,S,R){(function z(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),Y=.5*Math.exp(2*Mt/3),mt=.5*Math.sqrt(Mt*Y*(W-Y)/W)*(V-W/2<0?-1:1),ft=Math.max(P,Math.floor(D-V*Y/W+mt)),vt=Math.min(ct,Math.floor(D+(W-V)*Y/W+mt));z(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,S||_.length-1,R||e)}function t(_,x,T){var S=_[x];_[x]=_[T],_[T]=S}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 S=0;S<x.length;S++)if(T(_,x[S]))return S;return-1}function u(_,x){c(_,0,_.children.length,x,_)}function c(_,x,T,S,R){R||(R=M(null)),R.minX=1/0,R.minY=1/0,R.maxX=-1/0,R.maxY=-1/0;for(var z=x;z<T;z++){var U=_.children[z];f(R,_.leaf?S(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 m(_){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,S,R){for(var z=[x,T];z.length;)if(!((T=z.pop())-(x=z.pop())<=S)){var U=x+Math.ceil((T-x)/S/2)*S;n(_,U,x,T,R),z.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 S=this.toBBox,R=[];x;){for(var z=0;z<x.children.length;z++){var U=x.children[z],D=x.leaf?S(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 S=0;S<x.children.length;S++){var R=x.children[S],z=x.leaf?this.toBBox(R):R;if(E(_,z)){if(x.leaf||v(_,z))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 S=this.data;this.data=T,T=S}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,S,R,z=this.data,U=this.toBBox(_),D=[],P=[];z||D.length;){if(z||(z=D.pop(),S=D[D.length-1],T=P.pop(),R=!0),z.leaf){var ct=s(_,z.children,x);if(ct!==-1)return z.children.splice(ct,1),D.push(z),this._condense(D),this}R||z.leaf||!v(z,U)?S?(T++,z=S.children[T],R=!1):z=null:(D.push(z),P.push(T),T=0,S=z,z=z.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,S){var R,z=T-x+1,U=this._maxEntries;if(z<=U)return u(R=M(_.slice(x,T+1)),this.toBBox),R;S||(S=Math.ceil(Math.log(z)/Math.log(U)),U=Math.ceil(z/Math.pow(U,S-1))),(R=M([])).leaf=!1,R.height=S;var D=Math.ceil(z/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,S-1))}}return u(R,this.toBBox),R},i.prototype._chooseSubtree=function(_,x,T,S){for(;S.push(x),!x.leaf&&S.length-1!==T;){for(var R=1/0,z=1/0,U=void 0,D=0;D<x.children.length;D++){var P=x.children[D],ct=m(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<z?(z=L,R=ct<R?ct:R,U=P):L===z&&ct<R&&(R=ct,U=P)}x=U||x.children[0]}var W,V;return x},i.prototype._insert=function(_,x,T){var S=T?_:this.toBBox(_),R=[],z=this._chooseSubtree(S,this.data,x,R);for(z.children.push(_),f(z,S);x>=0&&R[x].children.length>this._maxEntries;)this._split(R,x),x--;this._adjustParentBBoxes(S,R,x)},i.prototype._split=function(_,x){var T=_[x],S=T.children.length,R=this._minEntries;this._chooseSplitAxis(T,R,S);var z=this._chooseSplitIndex(T,R,S),U=M(T.children.splice(z,T.children.length-z));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 S,R,z,U,D,P,ct,L=1/0,W=1/0,V=x;V<=T-x;V++){var Mt=c(_,0,V,this.toBBox),Y=c(_,V,T,this.toBBox),mt=(R=Mt,z=Y,U=void 0,D=void 0,P=void 0,ct=void 0,U=Math.max(R.minX,z.minX),D=Math.max(R.minY,z.minY),P=Math.min(R.maxX,z.maxX),ct=Math.min(R.maxY,z.maxY),Math.max(0,P-U)*Math.max(0,ct-D)),ft=m(Mt)+m(Y);mt<L?(L=mt,S=V,W=ft<W?ft:W):mt===L&&ft<W&&(W=ft,S=V)}return S||T-x},i.prototype._chooseSplitAxis=function(_,x,T){var S=_.leaf?this.compareMinX:p,R=_.leaf?this.compareMinY:d;this._allDistMargin(_,x,T,S)<this._allDistMargin(_,x,T,R)&&_.children.sort(S)},i.prototype._allDistMargin=function(_,x,T,S){_.children.sort(S);for(var R=this.toBBox,z=c(_,0,x,R),U=c(_,T-x,T,R),D=y(z)+y(U),P=x;P<T-x;P++){var ct=_.children[P];f(z,_.leaf?R(ct):ct),D+=y(z)}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 S=T;S>=0;S--)f(x[S],_)},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 DC=Z((wv,Sv)=>{(function(n,t){typeof wv=="object"&&typeof Sv!="undefined"?Sv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(wv,function(){"use strict";var n=function(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,m=u[d],y=d+1;if(y<this.length&&c(u[y],m)<0&&(d=y,m=u[y]),c(m,p)>=0)break;u[i]=m,i=d}u[i]=p};function t(e,i){return e<i?-1:e>i?1:0}return n})});var UC=Z((kQ,FC)=>{FC.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,m=p-1;d<p;m=d++){var y=e[i+d*2+0],v=e[i+d*2+1],E=e[i+m*2+0],M=e[i+m*2+1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var zC=Z((qQ,BC)=>{BC.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,m=p-1;d<p;m=d++){var y=e[d+i][0],v=e[d+i][1],E=e[m+i][0],M=e[m+i][1],A=v>c!=M>c&&u<(E-y)*(c-v)/(M-v)+y;A&&(f=!f)}return f}});var qC=Z((VQ,Vp)=>{var GC=UC(),kC=zC();Vp.exports=function(t,e,i,s){return e.length>0&&Array.isArray(e[0])?kC(t,e,i,s):GC(t,e,i,s)};Vp.exports.nested=kC;Vp.exports.flat=GC});var HC=Z((Hp,VC)=>{(function(n,t){typeof Hp=="object"&&typeof VC!="undefined"?t(Hp):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(Hp,function(n){"use strict";let e=33306690738754706e-32;function i(E,M,A,_,x){let T,S,R,z,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-((S=U+T)-U),U=M[++P]):(R=T-((S=D+T)-D),D=_[++ct]),T=S,R!==0&&(x[L++]=R);P<E&&ct<A;)D>U==D>-U?(R=T-((S=T+U)-(z=S-T))+(U-z),U=M[++P]):(R=T-((S=T+D)-(z=S-T))+(D-z),D=_[++ct]),T=S,R!==0&&(x[L++]=R);for(;P<E;)R=T-((S=T+U)-(z=S-T))+(U-z),U=M[++P],T=S,R!==0&&(x[L++]=R);for(;ct<A;)R=T-((S=T+D)-(z=S-T))+(D-z),D=_[++ct],T=S,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),m=s(12),y=s(16),v=s(4);n.orient2d=function(E,M,A,_,x,T){let S=(M-T)*(A-x),R=(E-x)*(_-T),z=S-R;if(S===0||R===0||S>0!=R>0)return z;let U=Math.abs(S+R);return Math.abs(z)>=u*U?z:-function(D,P,ct,L,W,V,Mt){let Y,mt,ft,vt,it,lt,H,At,It,jt,nt,bt,qt,$t,Ft,zt,Ct,te,$=D-W,Ot=ct-W,_t=P-V,Nt=L-V;it=(Ft=(At=$-(H=(lt=134217729*$)-(lt-$)))*(jt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=$*Nt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(jt=Ot-(It=(lt=134217729*Ot)-(lt-Ot)))-((zt=_t*Ot)-H*It-At*It-H*jt))),p[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),p[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,p[2]=bt-(te-it)+(nt-it),p[3]=te;let St=function(X,N){let xt=N[0];for(let wt=1;wt<X;wt++)xt+=N[wt];return xt}(4,p),Vt=c*Mt;if(St>=Vt||-St>=Vt||(Y=D-($+(it=D-$))+(it-W),ft=ct-(Ot+(it=ct-Ot))+(it-W),mt=P-(_t+(it=P-_t))+(it-V),vt=L-(Nt+(it=L-Nt))+(it-V),Y===0&&mt===0&&ft===0&&vt===0)||(Vt=f*Mt+e*Math.abs(St),(St+=$*vt+Nt*Y-(_t*ft+Ot*mt))>=Vt||-St>=Vt))return St;it=(Ft=(At=Y-(H=(lt=134217729*Y)-(lt-Y)))*(jt=Nt-(It=(lt=134217729*Nt)-(lt-Nt)))-(($t=Y*Nt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=mt-(H=(lt=134217729*mt)-(lt-mt)))*(jt=Ot-(It=(lt=134217729*Ot)-(lt-Ot)))-((zt=mt*Ot)-H*It-At*It-H*jt))),v[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),v[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,v[2]=bt-(te-it)+(nt-it),v[3]=te;let Xt=i(4,p,4,v,d);it=(Ft=(At=$-(H=(lt=134217729*$)-(lt-$)))*(jt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=$*vt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=_t-(H=(lt=134217729*_t)-(lt-_t)))*(jt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((zt=_t*ft)-H*It-At*It-H*jt))),v[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),v[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,v[2]=bt-(te-it)+(nt-it),v[3]=te;let Pt=i(Xt,d,4,v,m);it=(Ft=(At=Y-(H=(lt=134217729*Y)-(lt-Y)))*(jt=vt-(It=(lt=134217729*vt)-(lt-vt)))-(($t=Y*vt)-H*It-At*It-H*jt))-(nt=Ft-(Ct=(At=mt-(H=(lt=134217729*mt)-(lt-mt)))*(jt=ft-(It=(lt=134217729*ft)-(lt-ft)))-((zt=mt*ft)-H*It-At*It-H*jt))),v[0]=Ft-(nt+it)+(it-Ct),it=(qt=$t-((bt=$t+nt)-(it=bt-$t))+(nt-it))-(nt=qt-zt),v[1]=qt-(nt+it)+(it-zt),it=(te=bt+nt)-bt,v[2]=bt-(te-it)+(nt-it),v[3]=te;let ee=i(Pt,m,4,v,y);return y[ee-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 JC=Z((HQ,Tv)=>{"use strict";var WC=Ev(),Xp=DC(),wW=qC(),SW=HC().orient2d;Xp.default&&(Xp=Xp.default);Tv.exports=ZC;Tv.exports.default=ZC;function ZC(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var i=CW(n),s=new WC(16);s.toBBox=function(T){return{minX:T[0],minY:T[1],maxX:T[0],maxY:T[1]}},s.compareMinX=function(T,S){return T[0]-S[0]},s.compareMinY=function(T,S){return T[1]-S[1]},s.load(n);for(var u=[],c=0,f;c<i.length;c++){var p=i[c];s.remove(p),f=$C(p,f),u.push(f)}var d=new WC(16);for(c=0;c<u.length;c++)d.insert(Mv(u[c]));for(var m=t*t,y=e*e;u.length;){var v=u.shift(),E=v.p,M=v.next.p,A=bv(E,M);if(!(A<y)){var _=A/m;p=MW(s,v.prev.p,E,M,v.next.next.p,_,d),p&&Math.min(bv(p,E),bv(p,M))<=_&&(u.push(v),u.push($C(p,v)),s.remove(p),d.remove(v),d.insert(Mv(v)),d.insert(Mv(v.next)))}}v=f;var x=[];do x.push(v.p),v=v.next;while(v!==f);return x.push(v.p),x}function MW(n,t,e,i,s,u,c){for(var f=new Xp([],bW),p=n.data;p;){for(var d=0;d<p.children.length;d++){var m=p.children[d],y=p.leaf?Av(m,e,i):AW(e,i,m);y>u||f.push({node:m,dist:y})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),E=v.node,M=Av(E,t,e),A=Av(E,i,s);if(v.dist<M&&v.dist<A&&YC(e,E,c)&&YC(i,E,c))return E}p=f.pop(),p&&(p=p.node)}return null}function bW(n,t){return n.dist-t.dist}function AW(n,t,e){if(XC(n,e)||XC(t,e))return 0;var i=Wp(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(i===0)return 0;var s=Wp(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var u=Wp(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(u===0)return 0;var c=Wp(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 XC(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function YC(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(TW(f[p].p,f[p].next.p,n,t))return!1;return!0}function xl(n,t,e){return SW(n[0],n[1],t[0],t[1],e[0],e[1])}function TW(n,t,e,i){return n!==i&&t!==e&&xl(n,t,e)>0!=xl(n,t,i)>0&&xl(e,i,n)>0!=xl(e,i,t)>0}function Mv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function CW(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++)wW(n[u],f)||p.push(n[u]);return PW(p)}function $C(n,t){var e={p:n,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function bv(n,t){var e=n[0]-t[0],i=n[1]-t[1];return e*e+i*i}function Av(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 Wp(n,t,e,i,s,u,c,f){var p=e-n,d=i-t,m=c-s,y=f-u,v=n-s,E=t-u,M=p*p+d*d,A=p*m+d*y,_=m*m+y*y,x=p*v+d*E,T=m*v+y*E,S=M*_-A*A,R,z,U,D,P=S,ct=S;S===0?(z=0,P=1,D=T,ct=_):(z=A*T-_*x,D=M*T-A*x,z<0?(z=0,D=T,ct=_):z>P&&(z=P,D=T+A,ct=_)),D<0?(D=0,-x<0?z=0:-x>M?z=P:(z=-x,P=M)):D>ct&&(D=ct,-x+A<0?z=0:-x+A>M?z=P:(z=-x+A,P=M)),R=z===0?0:z/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,Y=V-L,mt=Mt-W;return Y*Y+mt*mt}function IW(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function PW(n){n.sort(IW);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&xl(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&&xl(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 nI=Z((Iv,Pv)=>{(function(n,t){typeof Iv=="object"&&typeof Pv!="undefined"?Pv.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(Iv,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,m=u-c+1,y=Math.log(d),v=.5*Math.exp(2*y/3),E=.5*Math.sqrt(y*v*(d-v)/d)*(m-d/2<0?-1:1),M=Math.max(c,Math.floor(u-m*v/d+E)),A=Math.min(f,Math.floor(u+(d-m)*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 Ov=Z((vnt,Nv)=>{"use strict";Nv.exports=Jc;Nv.exports.default=Jc;var VW=nI();function Jc(n,t){if(!(this instanceof Jc))return new Jc(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()}Jc.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],i=this.toBBox;if(!$p(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,$p(n,p)&&(t.leaf?e.push(f):Lv(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(!$p(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,$p(n,f)){if(t.leaf||Lv(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=Sl([]),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=HW(n,e.children,t),p!==-1))return e.children.splice(p,1),s.push(e),this._condense(s),this;!d&&!e.leaf&&Lv(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:rI,compareMinY:iI,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=Sl(n.slice(t,e+1)),wl(c,this.toBBox),c;i||(i=Math.ceil(Math.log(s)/Math.log(u)),u=Math.ceil(s/Math.pow(u,i-1))),c=Sl([]),c.leaf=!1,c.height=i;var f=Math.ceil(s/u),p=f*Math.ceil(Math.sqrt(u)),d,m,y,v;for(oI(n,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(y=Math.min(d+p-1,e),oI(n,d,y,f,this.compareMinY),m=d;m<=y;m+=f)v=Math.min(m+f-1,y),c.children.push(this._build(n,m,v,i-1));return wl(c,this.toBBox),c},_chooseSubtree:function(n,t,e,i){for(var s,u,c,f,p,d,m,y;i.push(t),!(t.leaf||i.length-1===e);){for(m=y=1/0,s=0,u=t.children.length;s<u;s++)c=t.children[s],p=Rv(c),d=WW(n,c)-p,d<y?(y=d,m=p<m?p:m,f=c):d===y&&p<m&&(m=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),Zc(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=Sl(e.children.splice(u,e.children.length-u));c.height=e.height,c.leaf=e.leaf,wl(e,this.toBBox),wl(c,this.toBBox),t?n[t-1].children.push(c):this._splitRoot(e,c)},_splitRoot:function(n,t){this.data=Sl([n,t]),this.data.height=n.height+1,this.data.leaf=!1,wl(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var i,s,u,c,f,p,d,m;for(p=d=1/0,i=t;i<=e-t;i++)s=$c(n,0,i,this.toBBox),u=$c(n,i,e,this.toBBox),c=XW(s,u),f=Rv(s)+Rv(u),c<p?(p=c,m=i,d=f<d?f:d):c===p&&f<d&&(d=f,m=i);return m},_chooseSplitAxis:function(n,t,e){var i=n.leaf?this.compareMinX:rI,s=n.leaf?this.compareMinY:iI,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=$c(n,0,t,s),c=$c(n,e-t,e,s),f=Yp(u)+Yp(c),p,d;for(p=t;p<e-t;p++)d=n.children[p],Zc(u,n.leaf?s(d):d),f+=Yp(u);for(p=e-t-1;p>=t;p--)d=n.children[p],Zc(c,n.leaf?s(d):d),f+=Yp(c);return f},_adjustParentBBoxes:function(n,t,e){for(var i=e;i>=0;i--)Zc(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():wl(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 HW(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 wl(n,t){$c(n,0,n.children.length,t,n)}function $c(n,t,e,i,s){s||(s=Sl(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],Zc(s,n.leaf?i(c):c);return s}function Zc(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 rI(n,t){return n.minX-t.minX}function iI(n,t){return n.minY-t.minY}function Rv(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Yp(n){return n.maxX-n.minX+(n.maxY-n.minY)}function WW(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 XW(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 Lv(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function $p(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Sl(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function oI(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,VW(n,c,t,e,s),u.push(t,c,c,e))}});var fI=Z((Rrt,Gv)=>{"use strict";Gv.exports=Kp;Gv.exports.default=Kp;function Kp(n,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:n.length,u=uI(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;var f,p,d,m,y,v,E;if(i&&(u=nX(n,t,u,e)),n.length>80*e){f=d=n[0],p=m=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>m&&(m=v);E=Math.max(d-f,m-p),E=E!==0?32767/E:0}return Qc(u,c,e,f,p,E,0),c}function uI(n,t,e,i,s){var u,c;if(s===zv(n,t,e,i)>0)for(u=t;u<e;u+=i)c=aI(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=aI(u,n[u],n[u+1],c);return c&&Qp(c,c.next)&&(ef(c),c=c.next),c}function eu(n,t){if(!n)return n;t||(t=n);var e=n,i;do if(i=!1,!e.steiner&&(Qp(e,e.next)||Qn(e.prev,e,e.next)===0)){if(ef(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Qc(n,t,e,i,s,u,c){if(n){!c&&u&&aX(n,i,s,u);for(var f=n,p,d;n.prev!==n.next;){if(p=n.prev,d=n.next,u?QW(n,i,s,u):KW(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),ef(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=tX(eu(n),t,e),Qc(n,t,e,i,s,u,2)):c===2&&eX(n,t,e,i,s,u):Qc(eu(n),t,e,i,s,u,1);break}}}}function KW(n){var t=n.prev,e=n,i=n.next;if(Qn(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,m=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>=m&&M.x<=v&&M.y>=y&&M.y<=E&&Al(s,f,u,p,c,d,M.x,M.y)&&Qn(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function QW(n,t,e,i){var s=n.prev,u=n,c=n.next;if(Qn(s,u,c)>=0)return!1;for(var f=s.x,p=u.x,d=c.x,m=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=m<y?m<v?m:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=m>y?m>v?m:v:y>v?y:v,x=Uv(E,M,t,e,i),T=Uv(A,_,t,e,i),S=n.prevZ,R=n.nextZ;S&&S.z>=x&&R&&R.z<=T;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&Al(f,m,p,y,d,v,S.x,S.y)&&Qn(S.prev,S,S.next)>=0||(S=S.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Al(f,m,p,y,d,v,R.x,R.y)&&Qn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;S&&S.z>=x;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&Al(f,m,p,y,d,v,S.x,S.y)&&Qn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&Al(f,m,p,y,d,v,R.x,R.y)&&Qn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function tX(n,t,e){var i=n;do{var s=i.prev,u=i.next.next;!Qp(s,u)&&lI(s,i,i.next,u)&&tf(s,u)&&tf(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),ef(i),ef(i.next),i=n=u),i=i.next}while(i!==n);return eu(i)}function eX(n,t,e,i,s,u){var c=n;do{for(var f=c.next.next;f!==c.prev;){if(c.i!==f.i&&cX(c,f)){var p=cI(c,f);c=eu(c,c.next),p=eu(p,p.next),Qc(c,t,e,i,s,u,0),Qc(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function nX(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=uI(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(lX(d));for(s.sort(rX),u=0;u<s.length;u++)e=iX(s[u],e);return e}function rX(n,t){return n.x-t.x}function iX(n,t){var e=oX(n,t);if(!e)return t;var i=cI(e,n);return eu(i,i.next),eu(e,e.next)}function oX(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,m=c.y,y=1/0,v;e=c;do i>=e.x&&e.x>=d&&i!==e.x&&Al(s<m?i:u,s,d,m,s<m?u:i,s,e.x,e.y)&&(v=Math.abs(s-e.y)/(i-e.x),tf(e,n)&&(v<y||v===y&&(e.x>c.x||e.x===c.x&&sX(c,e)))&&(c=e,y=v)),e=e.next;while(e!==p);return c}function sX(n,t){return Qn(n.prev,n,t.prev)<0&&Qn(t.next,n,n.next)<0}function aX(n,t,e,i){var s=n;do s.z===0&&(s.z=Uv(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,uX(s)}function uX(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 Uv(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 lX(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 Al(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 cX(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!fX(n,t)&&(tf(n,t)&&tf(t,n)&&hX(n,t)&&(Qn(n.prev,n,t.prev)||Qn(n,t.prev,t))||Qp(n,t)&&Qn(n.prev,n,n.next)>0&&Qn(t.prev,t,t.next)>0)}function Qn(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Qp(n,t){return n.x===t.x&&n.y===t.y}function lI(n,t,e,i){var s=jp(Qn(n,t,e)),u=jp(Qn(n,t,i)),c=jp(Qn(e,i,n)),f=jp(Qn(e,i,t));return!!(s!==u&&c!==f||s===0&&Jp(n,e,t)||u===0&&Jp(n,i,t)||c===0&&Jp(e,n,i)||f===0&&Jp(e,t,i))}function Jp(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 jp(n){return n>0?1:n<0?-1:0}function fX(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&&lI(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function tf(n,t){return Qn(n.prev,n,n.next)<0?Qn(n,t,n.next)>=0&&Qn(n,n.prev,t)>=0:Qn(n,t,n.prev)<0||Qn(n,n.next,t)<0}function hX(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 cI(n,t){var e=new Bv(n.i,n.x,n.y),i=new Bv(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 aI(n,t,e,i){var s=new Bv(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 ef(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Bv(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Kp.deviation=function(n,t,e,i){var s=t&&t.length,u=s?t[0]*e:n.length,c=Math.abs(zv(n,0,u,e));if(s)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,m=f<p-1?t[f+1]*e:n.length;c-=Math.abs(zv(n,d,m,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 zv(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}Kp.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 Wv=Z(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.earthRadius=63710088e-1;me.factors={centimeters:me.earthRadius*100,centimetres:me.earthRadius*100,degrees:me.earthRadius/111325,feet:me.earthRadius*3.28084,inches:me.earthRadius*39.37,kilometers:me.earthRadius/1e3,kilometres:me.earthRadius/1e3,meters:me.earthRadius,metres:me.earthRadius,miles:me.earthRadius/1609.344,millimeters:me.earthRadius*1e3,millimetres:me.earthRadius*1e3,nauticalmiles:me.earthRadius/1852,radians:1,yards:me.earthRadius*1.0936};me.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/me.earthRadius,yards:1.0936133};me.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 ca(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}me.feature=ca;function dX(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return kv(t).geometry;case"LineString":return Vv(t).geometry;case"Polygon":return qv(t).geometry;case"MultiPoint":return pI(t).geometry;case"MultiLineString":return hI(t).geometry;case"MultiPolygon":return dI(t).geometry;default:throw new Error(n+" is invalid")}}me.geometry=dX;function kv(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!td(n[0])||!td(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return ca(i,t,e)}me.point=kv;function mX(n,t,e){return e===void 0&&(e={}),ed(n.map(function(i){return kv(i,t)}),e)}me.points=mX;function qv(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 ca(f,t,e)}me.polygon=qv;function gX(n,t,e){return e===void 0&&(e={}),ed(n.map(function(i){return qv(i,t)}),e)}me.polygons=gX;function Vv(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:n};return ca(i,t,e)}me.lineString=Vv;function yX(n,t,e){return e===void 0&&(e={}),ed(n.map(function(i){return Vv(i,t)}),e)}me.lineStrings=yX;function ed(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}me.featureCollection=ed;function hI(n,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:n};return ca(i,t,e)}me.multiLineString=hI;function pI(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return ca(i,t,e)}me.multiPoint=pI;function dI(n,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:n};return ca(i,t,e)}me.multiPolygon=dI;function vX(n,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:n};return ca(i,t,e)}me.geometryCollection=vX;function _X(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}me.round=_X;function mI(n,t){t===void 0&&(t="kilometers");var e=me.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}me.radiansToLength=mI;function Hv(n,t){t===void 0&&(t="kilometers");var e=me.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}me.lengthToRadians=Hv;function xX(n,t){return gI(Hv(n,t))}me.lengthToDegrees=xX;function EX(n){var t=n%360;return t<0&&(t+=360),t}me.bearingToAzimuth=EX;function gI(n){var t=n%(2*Math.PI);return t*180/Math.PI}me.radiansToDegrees=gI;function wX(n){var t=n%360;return t*Math.PI/180}me.degreesToRadians=wX;function SX(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 mI(Hv(n,t),e)}me.convertLength=SX;function MX(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=me.areaFactors[t];if(!i)throw new Error("invalid original units");var s=me.areaFactors[e];if(!s)throw new Error("invalid final units");return n/i*s}me.convertArea=MX;function td(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}me.isNumber=td;function bX(n){return!!n&&n.constructor===Object}me.isObject=bX;function AX(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(!td(t))throw new Error("bbox must only contain numbers")})}me.validateBBox=AX;function TX(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")}me.validateId=TX});var Yv=Z(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});var si=Wv();function nf(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,m=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 S=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var z=c.type;switch(m=e&&(z==="Polygon"||z==="MultiPolygon")?1:0,z){case null:break;case"Point":if(t(p,y,x,S,R)===!1)return!1;y++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,S,R)===!1)return!1;y++,z==="MultiPoint"&&S++}z==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-m;s++){if(t(p[i][s],y,x,S,R)===!1)return!1;y++}z==="MultiLineString"&&S++,z==="Polygon"&&R++}z==="Polygon"&&S++;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-m;u++){if(t(p[i][s][u],y,x,S,R)===!1)return!1;y++}R++}S++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(nf(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function CX(n,t,e,i){var s=e;return nf(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 yI(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 IX(n,t,e){var i=e;return yI(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function vI(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 PX(n,t,e){var i=e;return vI(n,function(s,u){u===0&&e===void 0?i=s:i=t(i,s,u)}),i}function RX(n){var t=[];return nf(n,function(e){t.push(e)}),t}function Xv(n,t){var e,i,s,u,c,f,p,d,m,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:{},m=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,m,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,m,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,m,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function LX(n,t,e){var i=e;return Xv(n,function(s,u,c,f,p){u===0&&e===void 0?i=s:i=t(i,s,u,c,f,p)}),i}function nd(n,t){Xv(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(si.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 m=e.coordinates[d],y={type:p,coordinates:m};if(t(si.feature(y,s),i,d)===!1)return!1}})}function NX(n,t,e){var i=e;return nd(n,function(s,u,c){u===0&&c===0&&e===void 0?i=s:i=t(i,s,u,c)}),i}function _I(n,t){nd(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,m=0;if(nf(e,function(y,v,E,M,A){if(f===void 0||i>p||M>d||A>m){f=y,p=i,d=M,m=A,u=0;return}var _=si.lineString([f,y],e.properties);if(t(_,i,s,A,u)===!1)return!1;u++,f=y})===!1)return!1}}})}function OX(n,t,e){var i=e,s=!1;return _I(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 xI(n,t){if(!n)throw new Error("geojson is required");nd(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(si.lineString(c[f],e.properties),i,s,f)===!1)return!1;break}}})}function DX(n,t,e){var i=e;return xI(n,function(s,u,c,f){u===0&&e===void 0?i=s:i=t(i,s,u,c,f)}),i}function FX(n,t){if(t=t||{},!si.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),si.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),si.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),si.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),si.lineString([p[i][s][u],p[i][s][u+1]],c,t)}throw new Error("geojson is invalid")}function UX(n,t){if(t=t||{},!si.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 si.point(p,c,t);case"MultiPoint":return i<0&&(i=p.length+i),si.point(p[i],c,t);case"LineString":return u<0&&(u=p.length+u),si.point(p[u],c,t);case"Polygon":return s<0&&(s=p.length+s),u<0&&(u=p[s].length+u),si.point(p[s][u],c,t);case"MultiLineString":return i<0&&(i=p.length+i),u<0&&(u=p[i].length+u),si.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),si.point(p[i][s][u],c,t)}throw new Error("geojson is invalid")}Er.coordAll=RX;Er.coordEach=nf;Er.coordReduce=CX;Er.featureEach=vI;Er.featureReduce=PX;Er.findPoint=UX;Er.findSegment=FX;Er.flattenEach=nd;Er.flattenReduce=NX;Er.geomEach=Xv;Er.geomReduce=LX;Er.lineEach=xI;Er.lineReduce=DX;Er.propEach=yI;Er.propReduce=IX;Er.segmentEach=_I;Er.segmentReduce=OX});var EI=Z(Zv=>{"use strict";Object.defineProperty(Zv,"__esModule",{value:!0});var BX=Yv();function $v(n){var t=[1/0,1/0,-1/0,-1/0];return BX.coordEach(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}$v.default=$v;Zv.default=$v});var rd=Z((Yrt,Jv)=>{var Jo=Ev(),SI=Wv(),MI=Yv(),Tl=EI().default,zX=MI.featureEach,Wrt=MI.coordEach,Xrt=SI.polygon,wI=SI.featureCollection;function bI(n){var t=new Jo(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Tl(e),Jo.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:Tl(s),i.push(s)}):zX(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Tl(s),i.push(s)}),Jo.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:Tl(e),Jo.prototype.remove.call(this,e,i)},t.clear=function(){return Jo.prototype.clear.call(this)},t.search=function(e){var i=Jo.prototype.search.call(this,this.toBBox(e));return wI(i)},t.collides=function(e){return Jo.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Jo.prototype.all.call(this);return wI(e)},t.toJSON=function(){return Jo.prototype.toJSON.call(this)},t.fromJSON=function(e){return Jo.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=Tl(e);else if(e.type==="FeatureCollection")i=Tl(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Jv.exports=bI;Jv.exports.default=bI});var n_=Z((nst,DI)=>{"use strict";var OI=Object.prototype.toString;DI.exports=function(t){var e=OI.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&OI.call(t.callee)==="[object Function]"),i}});var HI=Z((rst,VI)=>{"use strict";var qI;Object.keys||(sf=Object.prototype.hasOwnProperty,r_=Object.prototype.toString,FI=n_(),i_=Object.prototype.propertyIsEnumerable,UI=!i_.call({toString:null},"toString"),BI=i_.call(function(){},"prototype"),af=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ud=function(n){var t=n.constructor;return t&&t.prototype===n},zI={$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},GI=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!zI["$"+n]&&sf.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{ud(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),kI=function(n){if(typeof window=="undefined"||!GI)return ud(n);try{return ud(n)}catch(t){return!1}},qI=function(t){var e=t!==null&&typeof t=="object",i=r_.call(t)==="[object Function]",s=FI(t),u=e&&r_.call(t)==="[object String]",c=[];if(!e&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var f=BI&&i;if(u&&t.length>0&&!sf.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 m in t)!(f&&m==="prototype")&&sf.call(t,m)&&c.push(String(m));if(UI)for(var y=kI(t),v=0;v<af.length;++v)!(y&&af[v]==="constructor")&&sf.call(t,af[v])&&c.push(af[v]);return c});var sf,r_,FI,i_,UI,BI,af,ud,zI,GI,kI;VI.exports=qI});var o_=Z((ist,YI)=>{"use strict";var ZX=Array.prototype.slice,JX=n_(),WI=Object.keys,ld=WI?function(t){return WI(t)}:HI(),XI=Object.keys;ld.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 JX(i)?XI(ZX.call(i)):XI(i)})}else Object.keys=ld;return Object.keys||ld};YI.exports=ld});var s_=Z((ost,$I)=>{"use strict";$I.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 cd=Z((sst,ZI)=>{"use strict";var jX=s_();ZI.exports=function(){return jX()&&!!Symbol.toStringTag}});var a_=Z((ast,JI)=>{"use strict";JI.exports=Object});var u_=Z((ust,jI)=>{"use strict";jI.exports=Error});var QI=Z((lst,KI)=>{"use strict";KI.exports=EvalError});var eP=Z((cst,tP)=>{"use strict";tP.exports=RangeError});var rP=Z((fst,nP)=>{"use strict";nP.exports=ReferenceError});var l_=Z((hst,iP)=>{"use strict";iP.exports=SyntaxError});var nu=Z((pst,oP)=>{"use strict";oP.exports=TypeError});var aP=Z((dst,sP)=>{"use strict";sP.exports=URIError});var lP=Z((mst,uP)=>{"use strict";uP.exports=Math.abs});var fP=Z((gst,cP)=>{"use strict";cP.exports=Math.floor});var pP=Z((yst,hP)=>{"use strict";hP.exports=Math.max});var mP=Z((vst,dP)=>{"use strict";dP.exports=Math.min});var yP=Z((_st,gP)=>{"use strict";gP.exports=Math.pow});var _P=Z((xst,vP)=>{"use strict";vP.exports=Math.round});var EP=Z((Est,xP)=>{"use strict";xP.exports=Number.isNaN||function(t){return t!==t}});var SP=Z((wst,wP)=>{"use strict";var KX=EP();wP.exports=function(t){return KX(t)||t===0?t:t<0?-1:1}});var bP=Z((Sst,MP)=>{"use strict";MP.exports=Object.getOwnPropertyDescriptor});var ru=Z((Mst,AP)=>{"use strict";var fd=bP();if(fd)try{fd([],"length")}catch(n){fd=null}AP.exports=fd});var uf=Z((bst,TP)=>{"use strict";var hd=Object.defineProperty||!1;if(hd)try{hd({},"a",{value:1})}catch(n){hd=!1}TP.exports=hd});var PP=Z((Ast,IP)=>{"use strict";var CP=typeof Symbol!="undefined"&&Symbol,QX=s_();IP.exports=function(){return typeof CP!="function"||typeof Symbol!="function"||typeof CP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:QX()}});var c_=Z((Tst,RP)=>{"use strict";RP.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var f_=Z((Cst,LP)=>{"use strict";var t9=a_();LP.exports=t9.getPrototypeOf||null});var DP=Z((Ist,OP)=>{"use strict";var e9="Function.prototype.bind called on incompatible ",n9=Object.prototype.toString,r9=Math.max,i9="[object Function]",NP=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},o9=function(t,e){for(var i=[],s=e||0,u=0;s<t.length;s+=1,u+=1)i[u]=t[s];return i},s9=function(n,t){for(var e="",i=0;i<n.length;i+=1)e+=n[i],i+1<n.length&&(e+=t);return e};OP.exports=function(t){var e=this;if(typeof e!="function"||n9.apply(e)!==i9)throw new TypeError(e9+e);for(var i=o9(arguments,1),s,u=function(){if(this instanceof s){var m=e.apply(this,NP(i,arguments));return Object(m)===m?m:this}return e.apply(t,NP(i,arguments))},c=r9(0,e.length-i.length),f=[],p=0;p<c;p++)f[p]="$"+p;if(s=Function("binder","return function ("+s9(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 Cl=Z((Pst,FP)=>{"use strict";var a9=DP();FP.exports=Function.prototype.bind||a9});var pd=Z((Rst,UP)=>{"use strict";UP.exports=Function.prototype.call});var dd=Z((Lst,BP)=>{"use strict";BP.exports=Function.prototype.apply});var GP=Z((Nst,zP)=>{"use strict";zP.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var h_=Z((Ost,kP)=>{"use strict";var u9=Cl(),l9=dd(),c9=pd(),f9=GP();kP.exports=f9||u9.call(c9,l9)});var md=Z((Dst,qP)=>{"use strict";var h9=Cl(),p9=nu(),d9=pd(),m9=h_();qP.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new p9("a function is required");return m9(h9,d9,t)}});var $P=Z((Fst,YP)=>{"use strict";var g9=md(),VP=ru(),WP;try{WP=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var p_=!!WP&&VP&&VP(Object.prototype,"__proto__"),XP=Object,HP=XP.getPrototypeOf;YP.exports=p_&&typeof p_.get=="function"?g9([p_.get]):typeof HP=="function"?function(t){return HP(t==null?t:XP(t))}:!1});var d_=Z((Ust,KP)=>{"use strict";var ZP=c_(),JP=f_(),jP=$P();KP.exports=ZP?function(t){return ZP(t)}:JP?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return JP(t)}:jP?function(t){return jP(t)}:null});var m_=Z((Bst,QP)=>{"use strict";var y9=Function.prototype.call,v9=Object.prototype.hasOwnProperty,_9=Cl();QP.exports=_9.call(y9,v9)});var v_=Z((zst,oR)=>{"use strict";var Qe,x9=a_(),E9=u_(),w9=QI(),S9=eP(),M9=rP(),Ll=l_(),Rl=nu(),b9=aP(),A9=lP(),T9=fP(),C9=pP(),I9=mP(),P9=yP(),R9=_P(),L9=SP(),rR=Function,g_=function(n){try{return rR('"use strict"; return ('+n+").constructor;")()}catch(t){}},lf=ru(),N9=uf(),y_=function(){throw new Rl},O9=lf?function(){try{return arguments.callee,y_}catch(n){try{return lf(arguments,"callee").get}catch(t){return y_}}}():y_,Il=PP()(),Ur=d_(),D9=f_(),F9=c_(),iR=dd(),cf=pd(),Pl={},U9=typeof Uint8Array=="undefined"||!Ur?Qe:Ur(Uint8Array),iu={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Qe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Qe:ArrayBuffer,"%ArrayIteratorPrototype%":Il&&Ur?Ur([][Symbol.iterator]()):Qe,"%AsyncFromSyncIteratorPrototype%":Qe,"%AsyncFunction%":Pl,"%AsyncGenerator%":Pl,"%AsyncGeneratorFunction%":Pl,"%AsyncIteratorPrototype%":Pl,"%Atomics%":typeof Atomics=="undefined"?Qe:Atomics,"%BigInt%":typeof BigInt=="undefined"?Qe:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Qe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Qe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Qe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":E9,"%eval%":eval,"%EvalError%":w9,"%Float16Array%":typeof Float16Array=="undefined"?Qe:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Qe:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Qe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Qe:FinalizationRegistry,"%Function%":rR,"%GeneratorFunction%":Pl,"%Int8Array%":typeof Int8Array=="undefined"?Qe:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Qe:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Qe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Il&&Ur?Ur(Ur([][Symbol.iterator]())):Qe,"%JSON%":typeof JSON=="object"?JSON:Qe,"%Map%":typeof Map=="undefined"?Qe:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Il||!Ur?Qe:Ur(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":x9,"%Object.getOwnPropertyDescriptor%":lf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Qe:Promise,"%Proxy%":typeof Proxy=="undefined"?Qe:Proxy,"%RangeError%":S9,"%ReferenceError%":M9,"%Reflect%":typeof Reflect=="undefined"?Qe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Qe:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Il||!Ur?Qe:Ur(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Qe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Il&&Ur?Ur(""[Symbol.iterator]()):Qe,"%Symbol%":Il?Symbol:Qe,"%SyntaxError%":Ll,"%ThrowTypeError%":O9,"%TypedArray%":U9,"%TypeError%":Rl,"%Uint8Array%":typeof Uint8Array=="undefined"?Qe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Qe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Qe:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Qe:Uint32Array,"%URIError%":b9,"%WeakMap%":typeof WeakMap=="undefined"?Qe:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Qe:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Qe:WeakSet,"%Function.prototype.call%":cf,"%Function.prototype.apply%":iR,"%Object.defineProperty%":N9,"%Object.getPrototypeOf%":D9,"%Math.abs%":A9,"%Math.floor%":T9,"%Math.max%":C9,"%Math.min%":I9,"%Math.pow%":P9,"%Math.round%":R9,"%Math.sign%":L9,"%Reflect.getPrototypeOf%":F9};if(Ur)try{null.error}catch(n){tR=Ur(Ur(n)),iu["%Error.prototype%"]=tR}var tR,B9=function n(t){var e;if(t==="%AsyncFunction%")e=g_("async function () {}");else if(t==="%GeneratorFunction%")e=g_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=g_("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&Ur&&(e=Ur(s.prototype))}return iu[t]=e,e},eR={__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=Cl(),gd=m_(),z9=ff.call(cf,Array.prototype.concat),G9=ff.call(iR,Array.prototype.splice),nR=ff.call(cf,String.prototype.replace),yd=ff.call(cf,String.prototype.slice),k9=ff.call(cf,RegExp.prototype.exec),q9=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,V9=/\\(\\)?/g,H9=function(t){var e=yd(t,0,1),i=yd(t,-1);if(e==="%"&&i!=="%")throw new Ll("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ll("invalid intrinsic syntax, expected opening `%`");var s=[];return nR(t,q9,function(u,c,f,p){s[s.length]=f?nR(p,V9,"$1"):c||u}),s},W9=function(t,e){var i=t,s;if(gd(eR,i)&&(s=eR[i],i="%"+s[0]+"%"),gd(iu,i)){var u=iu[i];if(u===Pl&&(u=B9(i)),typeof u=="undefined"&&!e)throw new Rl("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:u}}throw new Ll("intrinsic "+t+" does not exist!")};oR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Rl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Rl('"allowMissing" argument must be a boolean');if(k9(/^%?[^%]*%?$/,t)===null)throw new Ll("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=H9(t),s=i.length>0?i[0]:"",u=W9("%"+s+"%",e),c=u.name,f=u.value,p=!1,d=u.alias;d&&(s=d[0],G9(i,z9([0,1],d)));for(var m=1,y=!0;m<i.length;m+=1){var v=i[m],E=yd(v,0,1),M=yd(v,-1);if((E==='"'||E==="'"||E==="`"||M==='"'||M==="'"||M==="`")&&E!==M)throw new Ll("property names with quotes must have matching quotes");if((v==="constructor"||!y)&&(p=!0),s+="."+v,c="%"+s+"%",gd(iu,c))f=iu[c];else if(f!=null){if(!(v in f)){if(!e)throw new Rl("base intrinsic for "+t+" exists, but the property is not available.");return}if(lf&&m+1>=i.length){var A=lf(f,v);y=!!A,y&&"get"in A&&!("originalValue"in A.get)?f=A.get:f=f[v]}else y=gd(f,v),f=f[v];y&&!p&&(iu[c]=f)}}return f}});var vd=Z((Gst,uR)=>{"use strict";var sR=v_(),aR=md(),X9=aR([sR("%String.prototype.indexOf%")]);uR.exports=function(t,e){var i=sR(t,!!e);return typeof i=="function"&&X9(t,".prototype.")>-1?aR([i]):i}});var fR=Z((kst,cR)=>{"use strict";var Y9=cd()(),$9=vd(),__=$9("Object.prototype.toString"),_d=function(t){return Y9&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:__(t)==="[object Arguments]"},lR=function(t){return _d(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&__(t)!=="[object Array]"&&"callee"in t&&__(t.callee)==="[object Function]"},Z9=function(){return _d(arguments)}();_d.isLegacyArguments=lR;cR.exports=Z9?_d:lR});var xd=Z((qst,dR)=>{"use strict";var hR=uf(),J9=l_(),Nl=nu(),pR=ru();dR.exports=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Nl("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Nl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Nl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Nl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Nl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Nl("`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=!!pR&&pR(t,e);if(hR)hR(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 J9("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ed=Z((Vst,gR)=>{"use strict";var x_=uf(),mR=function(){return!!x_};mR.hasArrayLengthDefineBug=function(){if(!x_)return null;try{return x_([],"length",{value:1}).length!==1}catch(t){return!0}};gR.exports=mR});var Ol=Z((Hst,xR)=>{"use strict";var j9=o_(),K9=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Q9=Object.prototype.toString,t7=Array.prototype.concat,yR=xd(),e7=function(n){return typeof n=="function"&&Q9.call(n)==="[object Function]"},vR=Ed()(),n7=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!e7(i)||!i())return}vR?yR(n,t,e,!0):yR(n,t,e)},_R=function(n,t){var e=arguments.length>2?arguments[2]:{},i=j9(t);K9&&(i=t7.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s<i.length;s+=1)n7(n,i[s],t[i[s]],e[i[s]])};_R.supportsDescriptors=!!vR;xR.exports=_R});var bR=Z((Wst,MR)=>{"use strict";var r7=v_(),ER=xd(),i7=Ed()(),wR=ru(),SR=nu(),o7=r7("%Math.floor%");MR.exports=function(t,e){if(typeof t!="function")throw new SR("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||o7(e)!==e)throw new SR("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in t&&wR){var c=wR(t,"length");c&&!c.configurable&&(s=!1),c&&!c.writable&&(u=!1)}return(s||u||!i)&&(i7?ER(t,"length",e,!0,!0):ER(t,"length",e)),t}});var TR=Z((Xst,AR)=>{"use strict";var s7=Cl(),a7=dd(),u7=h_();AR.exports=function(){return u7(s7,a7,arguments)}});var E_=Z((Yst,wd)=>{"use strict";var l7=bR(),CR=uf(),c7=md(),IR=TR();wd.exports=function(t){var e=c7(arguments),i=t.length-(arguments.length-1);return l7(e,1+(i>0?i:0),!0)};CR?CR(wd.exports,"apply",{value:IR}):wd.exports.apply=IR});var w_=Z(($st,RR)=>{"use strict";var PR=function(n){return n!==n};RR.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||PR(t)&&PR(e))}});var S_=Z((Zst,LR)=>{"use strict";var f7=w_();LR.exports=function(){return typeof Object.is=="function"?Object.is:f7}});var OR=Z((Jst,NR)=>{"use strict";var h7=S_(),p7=Ol();NR.exports=function(){var t=h7();return p7(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var BR=Z((jst,UR)=>{"use strict";var d7=Ol(),m7=E_(),g7=w_(),DR=S_(),y7=OR(),FR=m7(DR(),Object);d7(FR,{getPolyfill:DR,implementation:g7,shim:y7});UR.exports=FR});var HR=Z((Kst,VR)=>{"use strict";var zR=vd(),v7=cd()(),_7=m_(),x7=ru(),A_;v7?(GR=zR("RegExp.prototype.exec"),M_={},Sd=function(){throw M_},b_={toString:Sd,valueOf:Sd},typeof Symbol.toPrimitive=="symbol"&&(b_[Symbol.toPrimitive]=Sd),A_=function(t){if(!t||typeof t!="object")return!1;var e=x7(t,"lastIndex"),i=e&&_7(e,"value");if(!i)return!1;try{GR(t,b_)}catch(s){return s===M_}}):(kR=zR("Object.prototype.toString"),qR="[object RegExp]",A_=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:kR(t)===qR});var GR,M_,Sd,b_,kR,qR;VR.exports=A_});var XR=Z((Qst,WR)=>{"use strict";var pf=function(){return typeof function(){}.name=="string"},hf=Object.getOwnPropertyDescriptor;if(hf)try{hf([],"length")}catch(n){hf=null}pf.functionsHaveConfigurableNames=function(){if(!pf()||!hf)return!1;var t=hf(function(){},"name");return!!t&&!!t.configurable};var E7=Function.prototype.bind;pf.boundFunctionsHaveNames=function(){return pf()&&typeof E7=="function"&&function(){}.bind().name!==""};WR.exports=pf});var ZR=Z((tat,$R)=>{"use strict";var YR=xd(),w7=Ed()(),S7=XR().functionsHaveConfigurableNames(),M7=nu();$R.exports=function(t,e){if(typeof t!="function")throw new M7("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||S7)&&(w7?YR(t,"name",e,!0,!0):YR(t,"name",e)),t}});var T_=Z((eat,JR)=>{"use strict";var b7=ZR(),A7=nu(),T7=Object;JR.exports=b7(function(){if(this==null||this!==T7(this))throw new A7("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 C_=Z((nat,jR)=>{"use strict";var C7=T_(),I7=Ol().supportsDescriptors,P7=Object.getOwnPropertyDescriptor;jR.exports=function(){if(I7&&/a/mig.flags==="gim"){var t=P7(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 C7}});var tL=Z((rat,QR)=>{"use strict";var R7=Ol().supportsDescriptors,L7=C_(),N7=ru(),O7=Object.defineProperty,D7=u_(),KR=d_(),F7=/a/;QR.exports=function(){if(!R7||!KR)throw new D7("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=L7(),e=KR(F7),i=N7(e,"flags");return(!i||i.get!==t)&&O7(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var iL=Z((iat,rL)=>{"use strict";var U7=Ol(),B7=E_(),z7=T_(),eL=C_(),G7=tL(),nL=B7(eL());U7(nL,{getPolyfill:eL,implementation:z7,shim:G7});rL.exports=nL});var aL=Z((oat,sL)=>{"use strict";var oL=vd(),k7=oL("Date.prototype.getDay"),q7=function(t){try{return k7(t),!0}catch(e){return!1}},V7=oL("Object.prototype.toString"),H7="[object Date]",W7=cd()();sL.exports=function(t){return typeof t!="object"||t===null?!1:W7?q7(t):V7(t)===H7}});var I_=Z((sat,vL)=>{var uL=o_(),lL=fR(),cL=BR(),fL=HR(),hL=iL(),pL=aL(),dL=Date.prototype.getTime;function yL(n,t,e){var i=e||{};return(i.strict?cL(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?i.strict?cL(n,t):n==t:X7(n,t,i)}function mL(n){return n==null}function gL(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 X7(n,t,e){var i,s;if(typeof n!=typeof t||mL(n)||mL(t)||n.prototype!==t.prototype||lL(n)!==lL(t))return!1;var u=fL(n),c=fL(t);if(u!==c)return!1;if(u||c)return n.source===t.source&&hL(n)===hL(t);if(pL(n)&&pL(t))return dL.call(n)===dL.call(t);var f=gL(n),p=gL(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=uL(n),m=uL(t)}catch(y){return!1}if(d.length!==m.length)return!1;for(d.sort(),m.sort(),i=d.length-1;i>=0;i--)if(d[i]!=m[i])return!1;for(i=d.length-1;i>=0;i--)if(s=d[i],!yL(n[s],t[s],e))return!1;return!0}vL.exports=yL});var k_=Z((hlt,bL)=>{var FY=I_(),jo=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:UY};jo.prototype.compare=function(n,t){if(n.type!==t.type||!ML(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=SL(n),s=SL(t);return i.every(function(u){return this.some(function(c){return e.compare(u,c)})},s)}}return!1};function SL(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function ML(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}jo.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};jo.prototype.compareLine=function(n,t,e,i){if(!ML(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}};jo.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};jo.prototype.comparePath=function(n,t){var e=this;return n.every(function(i,s){return e.compareCoord(i,this[s])},t)};jo.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};jo.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)};jo.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};jo.prototype.removePseudo=function(n){return n};function UY(n,t){return FY(n,t,{strict:!0})}bL.exports=jo});var AL=Z((Mlt,Ad)=>{function ha(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)}ha.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};ha.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)};ha.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)}};ha.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};ha.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};ha.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};ha.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 Ad!="undefined"&&Ad.exports&&(Ad.exports=ha)});var TL=Z((blt,Td)=>{function pa(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}pa.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)};pa.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(m),f=0,p=0;p<m;p++)c[p]=0;for(var d=0;d<e;d++){var m=this.dataset[d].length;if(u===this.assignments[d]){for(var p=0;p<m;p++)c[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<m;p++)c[p]/=f;this.centroids[u]=c}else this.centroids[u]=this.randomCentroid(),s=!0}}return this.getClusters()};pa.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};pa.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};pa.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};pa.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};pa.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 Td!="undefined"&&Td.exports&&(Td.exports=pa)});var q_=Z((Alt,Cd)=>{function Ko(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}Ko.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)};Ko.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}}};Ko.prototype.forEach=function(n){this._queue.forEach(n)};Ko.prototype.getElements=function(){return this._queue};Ko.prototype.getElementPriority=function(n){return this._priorities[n]};Ko.prototype.getPriorities=function(){return this._priorities};Ko.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};Ko.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)};Ko.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 Cd!="undefined"&&Cd.exports&&(Cd.exports=Ko)});var IL=Z((Tlt,Fl)=>{typeof Fl!="undefined"&&Fl.exports&&(CL=q_());var CL;function Ps(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)}Ps.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 CL(null,null,"asc"),p=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,p,f),this._expandCluster(c,f))}return this.clusters};Ps.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};Ps.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)};Ps.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))}})};Ps.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))}}};Ps.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}};Ps.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};Ps.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 Fl!="undefined"&&Fl.exports&&(Fl.exports=Ps)});var PL=Z((Clt,Id)=>{typeof Id!="undefined"&&Id.exports&&(Id.exports={DBSCAN:AL(),KMEANS:TL(),OPTICS:IL(),PriorityQueue:q_()})});var V_=Z((Olt,LL)=>{"use strict";LL.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 DL=Z((Dlt,OL)=>{"use strict";var NL=V_(),VY=NL.eudist,HY=NL.dist;OL.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?VY:HY,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 m=[],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)}m[M]=A}for(var T=0;T<u;T++)v+=m[T];for(var S=0;S<u;S++)E[S]={i:S,v:t[S],pr:m[S]/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 z=Math.random(),U=0;U<u-1&&E[U++].cs<z;);s.push(E[U-1].v)}return s}}});var GL=Z((Blt,zL)=>{"use strict";var H_=V_(),BL=DL(),WY=H_.eudist,Flt=H_.mandist,Ult=H_.dist,XY=BL.kmrand,YY=BL.kmpp,FL=1e4;function UL(n,t,e){e=e||[];for(var i=0;i<n;i++)e[i]=t;return e}function $Y(n,t,e,i){var s=[],u=[],c=[],f=[],p=!1,d=i||FL,m=n.length,y=n[0].length,v=y>0,E=[];if(e)e=="kmrand"?s=XY(n,t):e=="kmpp"?s=YY(n,t):s=e;else for(var M={};s.length<t;){var A=Math.floor(Math.random()*m);M[A]||(M[A]=!0,s.push(n[A]))}do{UL(t,0,E);for(var _=0;_<m;_++){for(var x=1/0,T=0,S=0;S<t;S++){var f=v?WY(n[_],s[S]):Math.abs(n[_]-s[S]);f<=x&&(x=f,T=S)}c[_]=T,E[T]++}for(var R=[],u=[],z=0,U=0;U<t;U++)R[U]=v?UL(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<m;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 Y=s[Mt],mt=R[Mt],ft=u[Mt],vt=E[Mt],it=0;it<y;it++)Y[it]=mt[it]/vt||0;if(p){for(var lt=0;lt<y;lt++)if(ft[lt]!=Y[lt]){p=!1;break}}}}else{for(var H=0;H<m;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 jt=0;jt<t;jt++)if(u[jt]!=s[jt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:FL-d,k:t,idxs:c,centroids:s}}zL.exports=$Y});var kl=Z((J_,j_)=>{(function(n,t){typeof J_=="object"&&typeof j_!="undefined"?j_.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(J_,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(),m(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 m(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,S=(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 z,this.yRounder=new z}round(b,I){return{x:this.xRounder.round(b),y:this.yRounder.round(I)}}}class z{constructor(){this.tree=new p,this.round(0)}round(b){let I=this.tree.add(b),F=this.tree.prev(I);if(F!==null&&S(I.key,F.key)===0)return this.tree.remove(b),F.key;let k=this.tree.next(I);return k!==null&&S(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,Y=(2+12*D)*D,mt=(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,Gt,re,ie,Se,ye,be,Ae,On,pr,_n,pe=j-k,xn=I-k,Rn=b-G,Tn=F-G;be=pe*Tn,J=P*pe,et=J-(J-pe),Tt=pe-et,J=P*Tn,Gt=J-(J-Tn),re=Tn-Gt,Ae=Tt*re-(be-et*Gt-Tt*Gt-et*re),On=Rn*xn,J=P*Rn,et=J-(J-Rn),Tt=Rn-et,J=P*xn,Gt=J-(J-xn),re=xn-Gt,pr=Tt*re-(On-et*Gt-Tt*Gt-et*re),ie=Ae-pr,Q=Ae-ie,ft[0]=Ae-(ie+Q)+(Q-pr),Se=be+ie,Q=Se-be,ye=be-(Se-Q)+(ie-Q),ie=ye-On,Q=ye-ie,ft[1]=ye-(ie+Q)+(Q-On),_n=Se+ie,Q=_n-Se,ft[2]=Se-(_n-Q)+(ie-Q),ft[3]=_n;let En=W(4,ft),Jr=Y*rt;if(En>=Jr||-En>=Jr||(Q=j-pe,tt=j-(pe+Q)+(Q-k),Q=I-xn,ht=I-(xn+Q)+(Q-k),Q=b-Rn,pt=b-(Rn+Q)+(Q-G),Q=F-Tn,O=F-(Tn+Q)+(Q-G),tt===0&&pt===0&&ht===0&&O===0)||(Jr=mt*rt+ct*Math.abs(En),En+=pe*O+Tn*tt-(Rn*ht+xn*pt),En>=Jr||-En>=Jr))return En;be=tt*Tn,J=P*tt,et=J-(J-tt),Tt=tt-et,J=P*Tn,Gt=J-(J-Tn),re=Tn-Gt,Ae=Tt*re-(be-et*Gt-Tt*Gt-et*re),On=pt*xn,J=P*pt,et=J-(J-pt),Tt=pt-et,J=P*xn,Gt=J-(J-xn),re=xn-Gt,pr=Tt*re-(On-et*Gt-Tt*Gt-et*re),ie=Ae-pr,Q=Ae-ie,H[0]=Ae-(ie+Q)+(Q-pr),Se=be+ie,Q=Se-be,ye=be-(Se-Q)+(ie-Q),ie=ye-On,Q=ye-ie,H[1]=ye-(ie+Q)+(Q-On),_n=Se+ie,Q=_n-Se,H[2]=Se-(_n-Q)+(ie-Q),H[3]=_n;let Sr=L(4,ft,4,H,vt);be=pe*O,J=P*pe,et=J-(J-pe),Tt=pe-et,J=P*O,Gt=J-(J-O),re=O-Gt,Ae=Tt*re-(be-et*Gt-Tt*Gt-et*re),On=Rn*ht,J=P*Rn,et=J-(J-Rn),Tt=Rn-et,J=P*ht,Gt=J-(J-ht),re=ht-Gt,pr=Tt*re-(On-et*Gt-Tt*Gt-et*re),ie=Ae-pr,Q=Ae-ie,H[0]=Ae-(ie+Q)+(Q-pr),Se=be+ie,Q=Se-be,ye=be-(Se-Q)+(ie-Q),ie=ye-On,Q=ye-ie,H[1]=ye-(ie+Q)+(Q-On),_n=Se+ie,Q=_n-Se,H[2]=Se-(_n-Q)+(ie-Q),H[3]=_n;let q=L(Sr,vt,4,H,it);be=tt*O,J=P*tt,et=J-(J-tt),Tt=tt-et,J=P*O,Gt=J-(J-O),re=O-Gt,Ae=Tt*re-(be-et*Gt-Tt*Gt-et*re),On=pt*ht,J=P*pt,et=J-(J-pt),Tt=pt-et,J=P*ht,Gt=J-(J-ht),re=ht-Gt,pr=Tt*re-(On-et*Gt-Tt*Gt-et*re),ie=Ae-pr,Q=Ae-ie,H[0]=Ae-(ie+Q)+(Q-pr),Se=be+ie,Q=Se-be,ye=be-(Se-Q)+(ie-Q),ie=ye-On,Q=ye-ie,H[1]=ye-(ie+Q)+(Q-On),_n=Se+ie,Q=_n-Se,H[2]=Se-(_n-Q)+(ie-Q),H[3]=_n;let st=L(q,it,4,H,lt);return lt[st-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 jt=(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},qt=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 jt(k,F)/qt(k)/qt(F)},Ft=(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)/qt(k)/qt(F)},zt=(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)},te=(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 zt(I,F,j.y);if(F.y===0)return zt(j,b,I.y);let k=jt(b,F);if(k==0)return null;let G={x:I.x-j.x,y:I.y-j.y},rt=jt(G,b)/k,tt=jt(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 ${static compare(b,I){let F=$.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:Ft(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 Ot=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=++Ot,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=$.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 $(k,!0),ht=new $(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=te(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 $(b,!0),G=new $(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 $.comparePoints(tt.leftSE.point,tt.rightSE.point)>0&&tt.swapEvents(),$.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 St{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 Vt{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 St(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 Gt=ht[0].point,re=ht[ht.length-1].point;throw new Error(`Unable to complete output ring starting at [${Gt.x}, ${Gt.y}]. Last matching segment found ends at [${re.x}, ${re.y}].`)}if(J.length===1){pt=J[0].otherSE;break}let et=null;for(let Gt=0,re=Q.length;Gt<re;Gt++)if(Q[Gt].point===tt.point){et=Gt;break}if(et!==null){let Gt=Q.splice(et)[0],re=ht.splice(Gt.index);re.unshift(re[0].otherSE),I.push(new Xt(re.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];$.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 ee{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 X{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=$.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 wt{run(b,I,F){ot.type=b,U.reset();let k=[new Vt(I,!0)];for(let Q=0,J=F.length;Q<J;Q++)k.push(new Vt(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,Gt=k.length;Tt<Gt;Tt++)if(_(et.bbox,k[Tt].bbox)===null)return[]}let G=new p($.compare);for(let Q=0,J=k.length;Q<J;Q++){let et=k[Q].getSweepEvents();for(let Tt=0,Gt=et.length;Tt<Gt;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 X(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 Gt=J[et];Gt.consumedBy===void 0&&G.insert(Gt)}tt=G.size,pt=G.pop()}U.reset();let ht=Xt.factory(rt.segments);return new ee(ht).getGeom()}}let ot=new wt;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 oN=Z((Nd,iN)=>{(function(n,t){typeof Nd=="object"&&typeof iN!="undefined"?t(Nd):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(Nd,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 m(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),S=function(){},R={MAX_VALUE:{configurable:!0}};S.isNaN=function(r){return Number.isNaN(r)},S.doubleToLongBits=function(r){return r},S.longBitsToDouble=function(r){return r},S.isInfinite=function(r){return!Number.isFinite(r)},R.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,R);var z=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||S.isNaN(this.z))&&S.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[z,U,t]},P.prototype.getClass=function(){return P},P.hashCode=function(){if(arguments.length===1){var r=arguments[0],o=S.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 S.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 g=L.compare(a.y,l.y);return g!==0?g: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:S.isNaN(r)?S.isNaN(o)?0:-1:S.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 Y=function(r,o){return r.interfaces_&&r.interfaces_().indexOf(o)>-1},mt=function(){},ft={LOG_10:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.log10=function(r){var o=Math.log(r);return S.isInfinite(o)||S.isNaN(o)?o:o/mt.LOG_10},mt.min=function(r,o,a,l){var h=r;return o<h&&(h=o),a<h&&(h=a),l<h&&(h=l),h},mt.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],g=arguments[2];return l<h?h:l>g?g:l}},mt.wrap=function(r,o){return r<0?o- -r%o:r%o},mt.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],g=arguments[1],w=arguments[2],C=arguments[3],B=h;return g>B&&(B=g),w>B&&(B=w),C>B&&(B=C),B}},mt.average=function(r,o){return(r+o)/2},ft.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(mt,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],g=arguments[1];this.init(h,g)}},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 g=l+1,w=new vt,C=H.MAX_PRINT_DIGITS-1,B=0;B<=C;B++){r&&B===g&&w.append(".");var K=Math.trunc(a._hi);if(K<0)break;var gt=!1,yt=0;K>9?(gt=!0,yt="9"):yt="0"+K,w.append(yt),a=a.subtract(H.valueOf(K)).multiply(H.TEN),gt&&a.selfAdd(H.TEN);var Bt=!0,kt=H.magnitude(a._hi);if(kt<0&&Math.abs(kt)>=C-B&&(Bt=!1),!Bt)break}return o[0]=l,w.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,g=null,w=null,C=null,B=null,K=null,gt=null,yt=null;return B=this._hi/a,K=H.SPLIT*B,h=K-B,yt=H.SPLIT*a,h=K-h,g=B-h,w=yt-a,gt=B*a,w=yt-w,C=a-w,yt=h*w-gt+h*C+g*w+g*C,K=(this._hi-gt-yt+this._lo-B*l)/a,yt=B+K,this._hi=yt,this._lo=B-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,g=null,w=null,C=null,B=null;return a=(g=this._hi/r._hi)-(o=(w=H.SPLIT*g)-(o=w-g)),B=o*(l=(B=H.SPLIT*r._hi)-(l=B-r._hi))-(C=g*r._hi)+o*(h=r._hi-l)+a*l+a*h,w=(this._hi-C-B+this._lo-g*r._lo)/r._hi,new H(B=g+w,g-B+w)}if(typeof arguments[0]=="number"){var K=arguments[0];return S.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,g=null,w=null,C=null;return h=this._hi+o,w=h-this._hi,g=h-w,g=o-w+(this._hi-g),C=g+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 B=arguments[0],K=arguments[1],gt=null,yt=null,Bt=null,kt=null,Jt=null,ae=null,dn=null;kt=this._hi+B,yt=this._lo+K,Jt=kt-(ae=kt-this._hi),Bt=yt-(dn=yt-this._lo);var Wn=(gt=kt+(ae=(Jt=B-ae+(this._hi-Jt))+yt))+(ae=(Bt=K-dn+(this._lo-Bt))+(ae+(kt-gt))),Lr=ae+(gt-Wn);return this._hi=Wn,this._lo=Lr,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,g=null,w=null,C=null,B=null,K=null;h=(B=H.SPLIT*this._hi)-this._hi,K=H.SPLIT*a,h=B-h,g=this._hi-h,w=K-a;var gt=(B=this._hi*a)+(K=h*(w=K-w)-B+h*(C=a-w)+g*w+g*C+(this._hi*l+this._lo*a)),yt=K+(h=B-gt);return this._hi=gt,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 S.isNaN(o)?H.createNaN():H.copy(this).selfMultiply(o,0)}},H.prototype.isNaN=function(){return S.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 g=l-a.length;h=a+H.stringOfChar("0",g)+".0"}return this.isNegative()?"-"+h:h},H.prototype.reciprocal=function(){var r=null,o=null,a=null,l=null,h=null,g=null,w=null,C=null;o=(h=1/this._hi)-(r=(g=H.SPLIT*h)-(r=g-h)),a=(C=H.SPLIT*this._hi)-this._hi;var B=h+(g=(1-(w=h*this._hi)-(C=r*(a=C-a)-w+r*(l=this._hi-a)+o*a+o*l)-h*this._lo)/this._hi);return new H(B,h-B+g)},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 g=a.charAt(0)+"."+h;return this.isNegative()?"-"+g+l:g+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,z,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 g=new H,w=0,C=0,B=0;!(o>=a);){var K=r.charAt(o);if(o++,lt.isDigit(K)){var gt=K-"0";g.selfMultiply(H.TEN),g.selfAdd(gt),w++}else{if(K!=="."){if(K==="e"||K==="E"){var yt=r.substring(o);try{B=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=w}}var Bt=g,kt=w-C-B;if(kt===0)Bt=g;else if(kt>0){var Jt=H.TEN.pow(kt);Bt=g.divide(Jt)}else if(kt<0){var ae=H.TEN.pow(-kt);Bt=g.multiply(ae)}return l?Bt.negate():Bt},H.createNaN=function(){return new H(S.NaN,S.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(S.NaN,S.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(){},jt={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),g=H.valueOf(o.y).selfAdd(-r.y),w=H.valueOf(a.x).selfAdd(-o.x),C=H.valueOf(a.y).selfAdd(-o.y);return h.selfMultiply(C).selfSubtract(g.selfMultiply(w)).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)),g=H.valueOf(l.x).selfSubtract(a.x).selfMultiply(H.valueOf(o.y).selfSubtract(r.y)),w=h.subtract(g),C=H.valueOf(l.x).selfSubtract(a.x).selfMultiply(H.valueOf(r.y).selfSubtract(a.y)),B=H.valueOf(l.y).selfSubtract(a.y).selfMultiply(H.valueOf(r.x).selfSubtract(a.x)),K=C.subtract(B).selfDivide(w).doubleValue(),gt=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)),Bt=H.valueOf(o.y).selfSubtract(r.y).selfMultiply(H.valueOf(r.x).selfSubtract(a.x)),kt=yt.subtract(Bt).selfDivide(w).doubleValue(),Jt=H.valueOf(a.y).selfAdd(H.valueOf(l.y).selfSubtract(a.y).selfMultiply(kt)).doubleValue();return new P(gt,Jt)},It.orientationIndexFilter=function(r,o,a){var l=null,h=(r.x-a.x)*(o.y-a.y),g=(r.y-a.y)*(o.x-a.x),w=h-g;if(h>0){if(g<=0)return It.signum(w);l=h+g}else{if(!(h<0)||g>=0)return It.signum(w);l=-h-g}var C=It.DP_SAFE_EPSILON*l;return w>=C||-w>=C?It.signum(w):2},It.signum=function(r){return r>0?1:r<0?-1:0},jt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(It,jt);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 qt=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}(qt),Ft=function(){};Ft.arraycopy=function(r,o,a,l,h){for(var g=0,w=o;w<o+h;w++)a[l+g]=r[w],g++},Ft.getProperty=function(r){return{"line.separator":`
5
- `}[r]};var zt=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],g=arguments[1];this.x=h.y*g.w-g.y*h.w,this.y=g.x*h.w-h.x*g.w,this.w=h.x*g.y-g.x*h.y}else if(arguments[0]instanceof P&&arguments[1]instanceof P){var w=arguments[0],C=arguments[1];this.x=w.y-C.y,this.y=C.x-w.x,this.w=w.x*C.y-C.x*w.y}}else if(arguments.length===3){var B=arguments[0],K=arguments[1],gt=arguments[2];this.x=B,this.y=K,this.w=gt}else if(arguments.length===4){var yt=arguments[0],Bt=arguments[1],kt=arguments[2],Jt=arguments[3],ae=yt.y-Bt.y,dn=Bt.x-yt.x,Wn=yt.x*Bt.y-Bt.x*yt.y,Lr=kt.y-Jt.y,go=Jt.x-kt.x,fs=kt.x*Jt.y-Jt.x*kt.y;this.x=dn*fs-go*Wn,this.y=Lr*Wn-ae*fs,this.w=ae*go-Lr*dn}};zt.prototype.getY=function(){var r=this.y/this.w;if(S.isNaN(r)||S.isInfinite(r))throw new $t;return r},zt.prototype.getX=function(){var r=this.x/this.w;if(S.isNaN(r)||S.isInfinite(r))throw new $t;return r},zt.prototype.getCoordinate=function(){var r=new P;return r.x=this.getX(),r.y=this.getY(),r},zt.prototype.interfaces_=function(){return[]},zt.prototype.getClass=function(){return zt},zt.intersection=function(r,o,a,l){var h=r.y-o.y,g=o.x-r.x,w=r.x*o.y-o.x*r.y,C=a.y-l.y,B=l.x-a.x,K=a.x*l.y-l.x*a.y,gt=h*B-C*g,yt=(g*K-B*w)/gt,Bt=(C*w-h*K)/gt;if(S.isNaN(yt)||S.isInfinite(yt)||S.isNaN(Bt)||S.isInfinite(Bt))throw new $t;return new P(yt,Bt)};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 g=arguments[0],w=arguments[1],C=arguments[2],B=arguments[3];this.init(g,w,C,B)}},te={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],g=arguments[1],w=arguments[2],C=arguments[3];h<g?(this._minx=h,this._maxx=g):(this._minx=g,this._maxx=h),w<C?(this._miny=w,this._maxy=C):(this._miny=C,this._maxy=w)}},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[z,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],g=arguments[2],w=arguments[3],C=Math.min(g.x,w.x),B=Math.max(g.x,w.x),K=Math.min(l.x,h.x),gt=Math.max(l.x,h.x);return!(K>B)&&!(gt<C)&&(C=Math.min(g.y,w.y),B=Math.max(g.y,w.y),K=Math.min(l.y,h.y),gt=Math.max(l.y,h.y),!(K>B)&&!(gt<C))}},te.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,te);var $={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*$/},Ot=function(r){this.geometryFactory=r||new ge};Ot.prototype.read=function(r){var o,a,l;r=r.replace(/[\n\r]/g," ");var h=$.typeStr.exec(r);if(r.search("EMPTY")!==-1&&((h=$.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},Ot.prototype.write=function(r){return this.extractGeometry(r)},Ot.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($.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,g=a.length;h<g;++h)o=a[h].replace($.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,g=a.length;h<g;++h)o=a[h].trim().split($.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,g=a.length;h<g;++h)o=a[h].trim().split($.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($.parenComma),l=[],h=0,g=a.length;h<g;++h)o=a[h].replace($.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,g=r.trim().split($.parenComma),w=[],C=0,B=g.length;C<B;++C)o=g[C].replace($.trimParens,"$1"),a=Nt.linestring.apply(this,[o]),l=this.geometryFactory.createLinearRing(a._points),C===0?h=l:w.push(l);return this.geometryFactory.createPolygon(h,w)},multipolygon:function(r){if(r===void 0)return this.geometryFactory.createMultiPolygon();for(var o,a=r.trim().split($.doubleParenComma),l=[],h=0,g=a.length;h<g;++h)o=a[h].replace($.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)}},St=function(r){this.parser=new Ot(r)};St.prototype.write=function(r){return this.parser.write(r)},St.toLineString=function(r,o){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+o.x+" "+o.y+" )"};var Vt=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}(Vt),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 ee=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},X={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ee.prototype.getIndexAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intLineIndex[r][o]},ee.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()},ee.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)},ee.prototype.getIntersectionNum=function(){return this._result},ee.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)}},ee.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ee.prototype.setPrecisionModel=function(r){this._precisionModel=r},ee.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}},ee.prototype.getIntersection=function(r){return this._intPt[r]},ee.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ee.prototype.hasIntersection=function(){return this._result!==ee.NO_INTERSECTION},ee.prototype.getEdgeDistance=function(r,o){return ee.computeEdgeDistance(this._intPt[o],this._inputLines[r][0],this._inputLines[r][1])},ee.prototype.isCollinear=function(){return this._result===ee.COLLINEAR_INTERSECTION},ee.prototype.toString=function(){return St.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+St.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ee.prototype.getEndpoint=function(r,o){return this._inputLines[r][o]},ee.prototype.isIntersection=function(r){for(var o=0;o<this._result;o++)if(this._intPt[o].equals2D(r))return!0;return!1},ee.prototype.getIntersectionAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[r][o]]},ee.prototype.interfaces_=function(){return[]},ee.prototype.getClass=function(){return ee},ee.computeEdgeDistance=function(r,o,a){var l=Math.abs(a.x-o.x),h=Math.abs(a.y-o.y),g=-1;if(r.equals(o))g=0;else if(r.equals(a))g=l>h?l:h;else{var w=Math.abs(r.x-o.x),C=Math.abs(r.y-o.y);(g=l>h?w:C)!==0||r.equals(o)||(g=Math.max(w,C))}return Pt.isTrue(!(g===0&&!r.equals(o)),"Bad distance calculation"),g},ee.nonRobustComputeEdgeDistance=function(r,o,a){var l=r.x-o.x,h=r.y-o.y,g=Math.sqrt(l*l+h*h);return Pt.isTrue(!(g===0&&!r.equals(o)),"Invalid distance calculation"),g},X.DONT_INTERSECT.get=function(){return 0},X.DO_INTERSECT.get=function(){return 1},X.COLLINEAR.get=function(){return 2},X.NO_INTERSECTION.get=function(){return 0},X.POINT_INTERSECTION.get=function(){return 1},X.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ee,X);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,g,w){w.x=this.smallestInAbsValue(a.x,l.x,h.x,g.x),w.y=this.smallestInAbsValue(a.y,l.y,h.y,g.y),a.x-=w.x,a.y-=w.y,l.x-=w.x,l.y-=w.y,h.x-=w.x,h.y-=w.y,g.x-=w.x,g.y-=w.y},o.prototype.safeHCoordinateIntersection=function(a,l,h,g){var w=null;try{w=zt.intersection(a,l,h,g)}catch(C){if(!(C instanceof $t))throw C;w=o.nearestEndpoint(a,l,h,g)}return w},o.prototype.intersection=function(a,l,h,g){var w=this.intersectionWithNormalization(a,l,h,g);return this.isInSegmentEnvelopes(w)||(w=new P(o.nearestEndpoint(a,l,h,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(w),w},o.prototype.smallestInAbsValue=function(a,l,h,g){var w=a,C=Math.abs(w);return Math.abs(l)<C&&(w=l,C=Math.abs(l)),Math.abs(h)<C&&(w=h,C=Math.abs(h)),Math.abs(g)<C&&(w=g),w},o.prototype.checkDD=function(a,l,h,g,w){var C=It.intersection(a,l,h,g),B=this.isInSegmentEnvelopes(C);Ft.out.println("DD in env = "+B+" --------------------- "+C),w.distance(C)>1e-4&&Ft.out.println("Distance = "+w.distance(C))},o.prototype.intersectionWithNormalization=function(a,l,h,g){var w=new P(a),C=new P(l),B=new P(h),K=new P(g),gt=new P;this.normalizeToEnvCentre(w,C,B,K,gt);var yt=this.safeHCoordinateIntersection(w,C,B,K);return yt.x+=gt.x,yt.y+=gt.y,yt},o.prototype.computeCollinearIntersection=function(a,l,h,g){var w=Ct.intersects(a,l,h),C=Ct.intersects(a,l,g),B=Ct.intersects(h,g,a),K=Ct.intersects(h,g,l);return w&&C?(this._intPt[0]=h,this._intPt[1]=g,r.COLLINEAR_INTERSECTION):B&&K?(this._intPt[0]=a,this._intPt[1]=l,r.COLLINEAR_INTERSECTION):w&&B?(this._intPt[0]=h,this._intPt[1]=a,!h.equals(a)||C||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):w&&K?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||C||B?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&B?(this._intPt[0]=g,this._intPt[1]=a,!g.equals(a)||w||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&K?(this._intPt[0]=g,this._intPt[1]=l,!g.equals(l)||w||B?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):r.NO_INTERSECTION},o.prototype.normalizeToEnvCentre=function(a,l,h,g,w){var C=a.x<l.x?a.x:l.x,B=a.y<l.y?a.y:l.y,K=a.x>l.x?a.x:l.x,gt=a.y>l.y?a.y:l.y,yt=h.x<g.x?h.x:g.x,Bt=h.y<g.y?h.y:g.y,kt=h.x>g.x?h.x:g.x,Jt=h.y>g.y?h.y:g.y,ae=((C>yt?C:yt)+(K<kt?K:kt))/2,dn=((B>Bt?B:Bt)+(gt<Jt?gt:Jt))/2;w.x=ae,w.y=dn,a.x-=w.x,a.y-=w.y,l.x-=w.x,l.y-=w.y,h.x-=w.x,h.y-=w.y,g.x-=w.x,g.y-=w.y},o.prototype.computeIntersect=function(a,l,h,g){if(this._isProper=!1,!Ct.intersects(a,l,h,g))return r.NO_INTERSECTION;var w=ot.orientationIndex(a,l,h),C=ot.orientationIndex(a,l,g);if(w>0&&C>0||w<0&&C<0)return r.NO_INTERSECTION;var B=ot.orientationIndex(h,g,a),K=ot.orientationIndex(h,g,l);return B>0&&K>0||B<0&&K<0?r.NO_INTERSECTION:w===0&&C===0&&B===0&&K===0?this.computeCollinearIntersection(a,l,h,g):(w===0||C===0||B===0||K===0?(this._isProper=!1,a.equals2D(h)||a.equals2D(g)?this._intPt[0]=a:l.equals2D(h)||l.equals2D(g)?this._intPt[0]=l:w===0?this._intPt[0]=new P(h):C===0?this._intPt[0]=new P(g):B===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,g)),r.POINT_INTERSECTION)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.nearestEndpoint=function(a,l,h,g){var w=a,C=ot.distancePointLine(a,h,g),B=ot.distancePointLine(l,h,g);return B<C&&(C=B,w=l),(B=ot.distancePointLine(h,a,l))<C&&(C=B,w=h),(B=ot.distancePointLine(g,a,l))<C&&(C=B,w=g),w},o}(ee),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,g=a.x-o.x,w=a.y-o.y;return xt.signOfDet2x2(l,h,g,w)},xt.signOfDet2x2=function(r,o,a,l){var h=null,g=null,w=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,g=r,r=a,a=g,g=o,o=l,l=g):o<=-l?(h=-h,a=-a,l=-l):(g=r,r=-a,a=g,g=o,o=-l,l=g):l>0?-o<=l?(h=-h,r=-r,o=-o):(g=-r,r=a,a=g,g=-o,o=l,l=g):o>=l?(r=-r,o=-o,a=-a,l=-l):(h=-h,g=-r,r=-a,a=g,g=-o,o=-l,l=g),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(w=Math.floor(a/r),a-=w*r,(l-=w*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||(w=Math.floor(r/a),r-=w*a,(o-=w*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 wt=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var r=arguments[0];this._p=r};wt.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,g=r.y-this._p.y,w=o.x-this._p.x,C=o.y-this._p.y,B=xt.signOfDet2x2(h,g,w,C);if(B===0)return this._isPointOnSegment=!0,null;C<g&&(B=-B),B>0&&this._crossingCount++}},wt.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},wt.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},wt.prototype.isOnSegment=function(){return this._isPointOnSegment},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt},wt.locatePointInRing=function(){if(arguments[0]instanceof P&&Y(arguments[1],nt)){for(var r=arguments[0],o=arguments[1],a=new wt(r),l=new P,h=new P,g=1;g<o.size();g++)if(o.getCoordinate(g,l),o.getCoordinate(g-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 w=arguments[0],C=arguments[1],B=new wt(w),K=1;K<C.length;K++){var gt=C[K],yt=C[K-1];if(B.countSegment(gt,yt),B.isOnSegment())return B.getLocation()}return B.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,g=r[l+1].y;o+=h*(r[l-1].y-g)}return o/2}if(Y(arguments[0],nt)){var w=arguments[0],C=w.size();if(C<3)return 0;var B=new P,K=new P,gt=new P;w.getCoordinate(0,K),w.getCoordinate(1,gt);var yt=K.x;gt.x-=yt;for(var Bt=0,kt=1;kt<C-1;kt++)B.y=K.y,K.x=gt.x,K.y=gt.y,w.getCoordinate(kt+1,gt),gt.x-=yt,Bt+=K.x*(B.y-gt.y);return Bt/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 g=(o.x-r.x)*(l.y-a.y)-(o.y-r.y)*(l.x-a.x);if(g===0)h=!0;else{var w=(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))/g,B=w/g;(B<0||B>1||C<0||C>1)&&(h=!0)}}else h=!0;return h?mt.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,g=l.y,w=1;w<o;w++){r.getCoordinate(w,l);var C=l.x,B=l.y,K=C-h,gt=B-g;a+=Math.sqrt(K*K+gt*gt),h=C,g=B}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 g=r[h];g.y>a.y&&(a=g,l=h)}var w=l;do(w-=1)<0&&(w=o);while(r[w].equals2D(a)&&w!==l);var C=l;do C=(C+1)%o;while(r[C].equals2D(a)&&C!==l);var B=r[w],K=r[C];if(B.equals2D(a)||K.equals2D(a)||B.equals2D(K))return!1;var gt=ot.computeOrientation(B,a,K),yt=!1;return yt=gt===0?B.x>K.x:gt>0,yt},ot.locatePointInRing=function(r,o){return wt.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 g=arguments[0],w=arguments[1],C=arguments[2];if(w.x===C.x&&w.y===C.y)return g.distance(w);var B=(C.x-w.x)*(C.x-w.x)+(C.y-w.y)*(C.y-w.y),K=((g.x-w.x)*(C.x-w.x)+(g.y-w.y)*(C.y-w.y))/B;if(K<=0)return g.distance(w);if(K>=1)return g.distance(C);var gt=((w.y-g.y)*(C.x-w.x)-(w.x-g.x)*(C.y-w.y))/B;return Math.abs(gt)*Math.sqrt(B)}},ot.isOnLine=function(r,o){for(var a=new N,l=1;l<o.length;l++){var h=o[l-1],g=o[l];if(a.computeIntersection(r,h,g),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()},Ut={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(),g=l.next(),w=h.compareTo(g);if(w!==0)return w}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,z,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},Ut.serialVersionUID.get=function(){return 8763622679187377e3},Ut.SORTINDEX_POINT.get=function(){return 0},Ut.SORTINDEX_MULTIPOINT.get=function(){return 1},Ut.SORTINDEX_LINESTRING.get=function(){return 2},Ut.SORTINDEX_LINEARRING.get=function(){return 3},Ut.SORTINDEX_MULTILINESTRING.get=function(){return 4},Ut.SORTINDEX_POLYGON.get=function(){return 5},Ut.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Ut.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Ut.geometryChangedFilter.get=function(){return Wt},Object.defineProperties(Rt,Ut);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,g=this.array_.length;h<g;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],g=arguments[1];this.ensureCapacity(h.length),this.add(h,g)}}}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],g=!1,w=l.iterator();w.hasNext();)this.add(w.next(),h),g=!0;return g}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],g=arguments[1];return this.add(h,g,!0),!0}if(arguments[0]instanceof P&&typeof arguments[1]=="boolean"){var w=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(w))return null;r.prototype.add.call(this,w)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var C=arguments[0],B=arguments[1];return this.add(C,B),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var K=arguments[0],gt=arguments[1];if(arguments[2])for(var yt=0;yt<K.length;yt++)this.add(K[yt],gt);else for(var Bt=K.length-1;Bt>=0;Bt--)this.add(K[Bt],gt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof P){var kt=arguments[0],Jt=arguments[1];if(!arguments[2]){var ae=this.size();if(ae>0&&(kt>0&&this.get(kt-1).equals2D(Jt)||kt<ae&&this.get(kt).equals2D(Jt)))return null}r.prototype.add.call(this,kt,Jt)}}else if(arguments.length===4){var dn=arguments[0],Wn=arguments[1],Lr=arguments[2],go=arguments[3],fs=1;Lr>go&&(fs=-1);for(var em=Lr;em!==go;em+=fs)this.add(dn[em],Wn);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 Gt},Tt.BidirectionalComparator.get=function(){return re},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);Ft.arraycopy(r,a,l,0,r.length-a),Ft.arraycopy(r,0,l,r.length-a,a),Ft.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],g=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var w=0;w<l.length;w++)if(g.compare(l[w],h[w])!==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,g=0;g<r.length;g++)r[g]!==null&&(l[h++]=r[g]);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],g=arguments[2],w=arguments[3],C=arguments[4],B=0;B<C;B++)g[w+B]=new P(l[h+B])},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=mt.clamp(o,0,r.length);var l=(a=mt.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 g=0,w=o;w<=a;w++)h[g++]=r[w];return h},Object.defineProperties(et,Tt);var Gt=function(){};Gt.prototype.compare=function(r,o){return et.compare(r,o)},Gt.prototype.interfaces_=function(){return[D]},Gt.prototype.getClass=function(){return Gt};var re=function(){};re.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},re.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),g=et.increasingDirection(l),w=h>0?0:a.length-1,C=g>0?0:a.length-1,B=0;B<a.length;B++){var K=a[w].compareTo(l[C]);if(K!==0)return K;w+=h,C+=g}return 0},re.prototype.interfaces_=function(){return[D]},re.prototype.getClass=function(){return re};var ie=function(){};ie.prototype.get=function(){},ie.prototype.put=function(){},ie.prototype.size=function(){},ie.prototype.values=function(){},ie.prototype.entrySet=function(){};var Se=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}(ie);(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 Se).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 g=h.value;return h.value=o,g}h=h.right}while(h!==null);var w={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=w:a.right=w,this.fixAfterInsertion(w),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=m(f(f(r)));c(o)===1?(p(f(r),Ae),p(o,Ae),p(f(f(r)),1),r=f(f(r))):(r===m(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 On=function(){};On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},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 pr(this)};var pr=function(r){this.treeSet_=r,this.position_=0};pr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new i;return this.treeSet_.array_[this.position_++]},pr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},pr.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(w,C){return w.compareTo(C)},h.sort(l);else if(arguments.length===2)a=arguments[1],l=function(w,C){return a.compare(w,C)},h.sort(l);else if(arguments.length===3){(o=h.slice(arguments[1],arguments[2])).sort();var g=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length));for(h.splice(0,h.length),r=0;r<g.length;r++)h.push(g[r])}else if(arguments.length===4)for(o=h.slice(arguments[1],arguments[2]),a=arguments[3],l=function(w,C){return a.compare(w,C)},o.sort(l),g=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length)),h.splice(0,h.length),r=0;r<g.length;r++)h.push(g[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 Rn=function(){};Rn.prototype.filter=function(r){},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn};var Tn=function(){};Tn.prototype.filter=function(r,o){},Tn.prototype.isDone=function(){},Tn.prototype.isGeometryChanged=function(){},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn};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,g=0;g<this._geometries.length;g++)for(var w=this._geometries[g].getCoordinates(),C=0;C<w.length;C++)l[++h]=w[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 g=l;if(this._geometries.length!==g._geometries.length)return!1;for(var w=0;w<this._geometries.length;w++)if(!this._geometries[w].equalsExact(g._geometries[w],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),g=0;g<this._geometries.length;g++)h[g]=this._geometries[g].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)),g=new E(_n.asList(l._geometries));return this.compare(h,g)}if(arguments.length===2){for(var w=arguments[0],C=arguments[1],B=w,K=this.getNumGeometries(),gt=B.getNumGeometries(),yt=0;yt<K&&yt<gt;){var Bt=this.getGeometryN(yt),kt=B.getGeometryN(yt),Jt=Bt.compareToSameClass(kt,C);if(Jt!==0)return Jt;yt++}return yt<K?1:yt<gt?-1:0}},o.prototype.apply=function(){if(Y(arguments[0],j))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if(Y(arguments[0],Tn)){var g=arguments[0];if(this._geometries.length===0)return null;for(var w=0;w<this._geometries.length&&(this._geometries[w].apply(g),!g.isDone());w++);g.isGeometryChanged()&&this.geometryChanged()}else if(Y(arguments[0],Rn)){var C=arguments[0];C.filter(this);for(var B=0;B<this._geometries.length;B++)this._geometries[B].apply(C)}else if(Y(arguments[0],ce)){var K=arguments[0];K.filter(this);for(var gt=0;gt<this._geometries.length;gt++)this._geometries[gt].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),Jr=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),g=0;g<this._geometries.length;g++)h[l-1-g]=this._geometries[g].reverse();return this.getFactory().createMultiLineString(h)},o.prototype.getBoundary=function(){return new Sr(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[On]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(o,a),o}(En),Sr=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}};Sr.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)},Sr.prototype.getBoundary=function(){return this._geom instanceof ut?this.boundaryLineString(this._geom):this._geom instanceof Jr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Sr.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()])},Sr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Sr.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 g=h.next(),w=g.getValue().count;this._bnRule.isInBoundary(w)&&o.add(g.getKey())}return et.toCoordinateArray(o)},Sr.prototype.addEndpoint=function(r){var o=this._endpointMap.get(r);o===null&&(o=new q,this._endpointMap.put(r,o)),o.count++},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.getBoundary=function(){if(arguments.length===1){var r=arguments[0];return new Sr(r).getBoundary()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new Sr(o,a).getBoundary()}};var q=function(){this.count=null};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q};var st=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(r,o){for(var a=new Array(o).fill(null),l=0;l<o;l++)a[l]=r;return String(a)},st.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],g="",w=new function(){}(new function(){}(st.getStackTrace(l))),C=0;C<h;C++)try{g+=w.readLine()+st.NEWLINE}catch(B){if(!(B instanceof M))throw B;Pt.shouldNeverReachHere()}return g}},st.split=function(r,o){for(var a=o.length,l=new O,h=""+r,g=h.indexOf(o);g>=0;){var w=h.substring(0,g);l.add(w),g=(h=h.substring(g+a)).indexOf(o)}h.length>0&&l.add(h);for(var C=new Array(l.size()).fill(null),B=0;B<C.length;B++)C[B]=l.get(B);return C},st.toString=function(){if(arguments.length===1){var r=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(r)}},st.spaces=function(r){return st.chars(" ",r)},Et.NEWLINE.get=function(){return Ft.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,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()),g=0;g<h;g++)a.setOrdinate(l,g,r.getOrdinate(o,g))},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 g=0;g<l;g++){var w=r.getOrdinate(h,g),C=o.getOrdinate(h,g);if(r.getOrdinate(h,g)!==o.getOrdinate(h,g)&&(!S.isNaN(w)||!S.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 g=h;g<a;g++)dt.copy(o,h-1,l,g,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 g=0;g<h;g++)dt.copyCoord(r,o+g,a,l+g)},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 g=0;g<a;g++)g>0&&l.append(","),l.append(st.toString(r.getOrdinate(h,g)))}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 g=h;g<a;g++)dt.copy(o,0,l,g,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 g=l;if(this._points.size()!==g._points.size())return!1;for(var w=0;w<this._points.size();w++)if(!this.equal(this._points.getCoordinate(w),g._points.getCoordinate(w),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,g=0;h<this._points.size()&&g<l._points.size();){var w=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(g));if(w!==0)return w;h++,g++}return h<this._points.size()?1:g<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(Y(arguments[0],j))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if(Y(arguments[0],Tn)){var g=arguments[0];if(this._points.size()===0)return null;for(var w=0;w<this._points.size()&&(g.filter(this._points,w),!g.isDone());w++);g.isGeometryChanged()&&this.geometryChanged()}else Y(arguments[0],Rn)?arguments[0].filter(this):Y(arguments[0],ce)&&arguments[0].filter(this)},o.prototype.getBoundary=function(){return new Sr(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[On]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(o,a),o}(Rt),Kt=function(){};Kt.prototype.interfaces_=function(){return[]},Kt.prototype.getClass=function(){return Kt};var Qt=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(Y(arguments[0],j)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if(Y(arguments[0],Tn)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else Y(arguments[0],Rn)?arguments[0].filter(this):Y(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[Kt]},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 ne=function(r){function o(l,h,g){if(r.call(this,g),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,g=this._shell.getCoordinates(),w=0;w<g.length;w++)l[++h]=g[w];for(var C=0;C<this._holes.length;C++)for(var B=this._holes[C].getCoordinates(),K=0;K<B.length;K++)l[++h]=B[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(),g=0;g<5;g++){var w=l.getX(g);if(w!==h.getMinX()&&w!==h.getMaxX())return!1;var C=l.getY(g);if(C!==h.getMinY()&&C!==h.getMaxY())return!1}for(var B=l.getX(0),K=l.getY(0),gt=1;gt<=4;gt++){var yt=l.getX(gt),Bt=l.getY(gt);if(yt!==B==(Bt!==K))return!1;B=yt,K=Bt}return!0},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var g=l,w=this._shell,C=g._shell;if(!w.equalsExact(C,h)||this._holes.length!==g._holes.length)return!1;for(var B=0;B<this._holes.length;B++)if(!this._holes[B].equalsExact(g._holes[B],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],g=arguments[1];if(h.isEmpty())return null;var w=new Array(h.getCoordinates().length-1).fill(null);Ft.arraycopy(h.getCoordinates(),0,w,0,w.length);var C=et.minCoordinate(h.getCoordinates());et.scroll(w,C),Ft.arraycopy(w,0,h.getCoordinates(),0,w.length),h.getCoordinates()[w.length]=w[0],ot.isCCW(h.getCoordinates())===g&&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,g=l._shell;return h.compareToSameClass(g)}if(arguments.length===2){var w=arguments[0],C=arguments[1],B=w,K=this._shell,gt=B._shell,yt=K.compareToSameClass(gt,C);if(yt!==0)return yt;for(var Bt=this.getNumInteriorRing(),kt=B.getNumInteriorRing(),Jt=0;Jt<Bt&&Jt<kt;){var ae=this.getInteriorRingN(Jt),dn=B.getInteriorRingN(Jt),Wn=ae.compareToSameClass(dn,C);if(Wn!==0)return Wn;Jt++}return Jt<Bt?1:Jt<kt?-1:0}},o.prototype.apply=function(l){if(Y(l,j)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if(Y(l,Tn)){if(this._shell.apply(l),!l.isDone())for(var g=0;g<this._holes.length&&(this._holes[g].apply(l),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else if(Y(l,Rn))l.filter(this);else if(Y(l,ce)){l.filter(this),this._shell.apply(l);for(var w=0;w<this._holes.length;w++)this._holes[w].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),g=0;g<h.length;g++)h[g]=this._holes[g].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[Kt]},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 ge&&(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),g=0;g<this._geometries.length;g++)h[g]=this._geometries[g].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 g=this._geometries[h].getBoundary(),w=0;w<g.getNumGeometries();w++)l.add(g.getGeometryN(w));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),ln=function(r){this._factory=r||null,this._isUserDataCopied=!1},Mr={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};ln.prototype.setCopyUserData=function(r){this._isUserDataCopied=r},ln.prototype.edit=function(r,o){if(r===null)return null;var a=this.editInternal(r,o);return this._isUserDataCopied&&a.setUserData(r.getUserData()),a},ln.prototype.editInternal=function(r,o){return this._factory===null&&(this._factory=r.getFactory()),r instanceof En?this.editGeometryCollection(r,o):r instanceof ne?this.editPolygon(r,o):r instanceof Qt?o.edit(r,this._factory):r instanceof ut?o.edit(r,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+r.getClass().getName()),null)},ln.prototype.editGeometryCollection=function(r,o){for(var a=o.edit(r,this._factory),l=new O,h=0;h<a.getNumGeometries();h++){var g=this.edit(a.getGeometryN(h),o);g===null||g.isEmpty()||l.add(g)}return a.getClass()===ve?this._factory.createMultiPoint(l.toArray([])):a.getClass()===Jr?this._factory.createMultiLineString(l.toArray([])):a.getClass()===he?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},ln.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,g=0;g<a.getNumInteriorRing();g++){var w=this.edit(a.getInteriorRingN(g),o);w===null||w.isEmpty()||h.add(w)}return this._factory.createPolygon(l,h.toArray([]))},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.GeometryEditorOperation=function(){},Mr.NoOpGeometryOperation.get=function(){return kn},Mr.CoordinateOperation.get=function(){return ai},Mr.CoordinateSequenceOperation.get=function(){return Sn},Object.defineProperties(ln,Mr);var kn=function(){};kn.prototype.edit=function(r,o){return r},kn.prototype.interfaces_=function(){return[ln.GeometryEditorOperation]},kn.prototype.getClass=function(){return kn};var ai=function(){};ai.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 Qt?a.length>0?o.createPoint(a[0]):o.createPoint():r},ai.prototype.interfaces_=function(){return[ln.GeometryEditorOperation]},ai.prototype.getClass=function(){return ai};var Sn=function(){};Sn.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 Qt?o.createPoint(this.edit(r.getCoordinateSequence(),r)):r},Sn.prototype.interfaces_=function(){return[ln.GeometryEditorOperation]},Sn.prototype.getClass=function(){return Sn};var oe=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(Y(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],g=arguments[1];this._coordinates=h,this._dimension=g,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var w=arguments[0],C=arguments[1];this._coordinates=new Array(w).fill(null),this._dimension=C;for(var B=0;B<w;B++)this._coordinates[B]=new P}}},cu={serialVersionUID:{configurable:!0}};oe.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")}},oe.prototype.size=function(){return this._coordinates.length},oe.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 S.NaN},oe.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}},oe.prototype.getCoordinateCopy=function(r){return new P(this._coordinates[r])},oe.prototype.getDimension=function(){return this._dimension},oe.prototype.getX=function(r){return this._coordinates[r].x},oe.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 oe(r,this._dimension)},oe.prototype.expandEnvelope=function(r){for(var o=0;o<this._coordinates.length;o++)r.expandToInclude(this._coordinates[o]);return r},oe.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 oe(r,this._dimension)},oe.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"()"},oe.prototype.getY=function(r){return this._coordinates[r].y},oe.prototype.toCoordinateArray=function(){return this._coordinates},oe.prototype.interfaces_=function(){return[nt,t]},oe.prototype.getClass=function(){return oe},cu.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(oe,cu);var cn=function(){},oo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};cn.prototype.readResolve=function(){return cn.instance()},cn.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new oe(r)}if(Y(arguments[0],nt)){var o=arguments[0];return new oe(o)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new oe(a):new oe(a,l)}},cn.prototype.interfaces_=function(){return[W,t]},cn.prototype.getClass=function(){return cn},cn.instance=function(){return cn.instanceObject},oo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},oo.instanceObject.get=function(){return new cn},Object.defineProperties(cn,oo);var Wl=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}(ie),_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}}},ga={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 S.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,z]},_e.prototype.getClass=function(){return _e},_e.mostPrecise=function(r,o){return r.compareTo(o)>=0?r:o},ga.serialVersionUID.get=function(){return 7777263578777804e3},ga.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(_e,ga);var Mn=function r(o){this._name=o||null,r.nameToTypeMap.put(o,this)},so={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},so.serialVersionUID.get=function(){return-552860263173159e4},so.nameToTypeMap.get=function(){return new Wl},Object.defineProperties(Mn,so),_e.Type=Mn,_e.FIXED=new Mn("FIXED"),_e.FLOATING=new Mn("FLOATING"),_e.FLOATING_SINGLE=new Mn("FLOATING SINGLE");var ge=function r(){this._precisionModel=new _e,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Y(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]))},ui={serialVersionUID:{configurable:!0}};ge.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)},ge.prototype.createLineString=function(r){return r?r instanceof Array?new ut(this.getCoordinateSequenceFactory().create(r),this):Y(r,nt)?new ut(r,this):void 0:new ut(this.getCoordinateSequenceFactory().create([]),this)},ge.prototype.createMultiLineString=function(){if(arguments.length===0)return new Jr(null,this);if(arguments.length===1){var r=arguments[0];return new Jr(r,this)}},ge.prototype.buildGeometry=function(r){for(var o=null,a=!1,l=!1,h=r.iterator();h.hasNext();){var g=h.next(),w=g.getClass();o===null&&(o=w),w!==o&&(a=!0),g.isGeometryCollectionOrDerived()&&(l=!0)}if(o===null)return this.createGeometryCollection();if(a||l)return this.createGeometryCollection(ge.toGeometryArray(r));var C=r.iterator().next();if(r.size()>1){if(C instanceof ne)return this.createMultiPolygon(ge.toPolygonArray(r));if(C instanceof ut)return this.createMultiLineString(ge.toLineStringArray(r));if(C instanceof Qt)return this.createMultiPoint(ge.toPointArray(r));Pt.shouldNeverReachHere("Unhandled class: "+C.getClass().getName())}return C},ge.prototype.createMultiPointFromCoords=function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)},ge.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(Y(arguments[0],nt)){var o=arguments[0];return new Qt(o,this)}}},ge.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ge.prototype.createPolygon=function(){if(arguments.length===0)return new ne(null,null,this);if(arguments.length===1){if(Y(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 ne(l,h,this)}},ge.prototype.getSRID=function(){return this._SRID},ge.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)}},ge.prototype.createGeometry=function(r){return new ln(this).edit(r,{edit:function(){if(arguments.length===2){var o=arguments[0];return this._coordinateSequenceFactory.create(o)}}})},ge.prototype.getPrecisionModel=function(){return this._precisionModel},ge.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(Y(arguments[0],nt)){var o=arguments[0];return new fe(o,this)}}},ge.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)}},ge.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(Y(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 g=this.getCoordinateSequenceFactory().create(1,a.getDimension());dt.copy(a,h,g,0,1),l[h]=this.createPoint(g)}return this.createMultiPoint(l)}}},ge.prototype.interfaces_=function(){return[t]},ge.prototype.getClass=function(){return ge},ge.toMultiPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toGeometryArray=function(r){if(r===null)return null;var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.getDefaultCoordinateSequenceFactory=function(){return cn.instance()},ge.toMultiLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toMultiPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toLinearRingArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.createPointFromInternalCoord=function(r,o){return o.getPrecisionModel().makePrecise(r),o.getFactory().createPoint(r)},ui.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(ge,ui);var Xl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],fu=function(r){this.geometryFactory=r||new ge};fu.prototype.read=function(r){var o,a=(o=typeof r=="string"?JSON.parse(r):r).type;if(!li[a])throw new Error("Unknown GeoJSON type: "+o.type);return Xl.indexOf(a)!==-1?li[a].apply(this,[o.coordinates]):a==="GeometryCollection"?li[a].apply(this,[o.geometries]):li[a].apply(this,[o])},fu.prototype.write=function(r){var o=r.getGeometryType();if(!No[o])throw new Error("Geometry is not supported");return No[o].apply(this,[r])};var li={Feature:function(r){var o={};for(var a in r)o[a]=r[a];if(r.geometry){var l=r.geometry.type;if(!li[l])throw new Error("Unknown GeoJSON type: "+r.type);o.geometry=this.read(r.geometry)}return r.bbox&&(o.bbox=li.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(li.Point.apply(this,[r[a]]));return this.geometryFactory.createMultiPoint(o)},LineString:function(r){var o=li.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(o)},MultiLineString:function(r){for(var o=[],a=0;a<r.length;++a)o.push(li.LineString.apply(this,[r[a]]));return this.geometryFactory.createMultiLineString(o)},Polygon:function(r){for(var o=li.coordinates.apply(this,[r[0]]),a=this.geometryFactory.createLinearRing(o),l=[],h=1;h<r.length;++h){var g=r[h],w=li.coordinates.apply(this,[g]),C=this.geometryFactory.createLinearRing(w);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(li.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)}},No={coordinate:function(r){return[r.x,r.y]},Point:function(r){return{type:"Point",coordinates:No.coordinate.apply(this,[r.getCoordinate()])}},MultiPoint:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=No.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(No.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=No.LineString.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiLineString",coordinates:o}},Polygon:function(r){var o=[],a=No.LineString.apply(this,[r._shell]);o.push(a.coordinates);for(var l=0;l<r._holes.length;++l){var h=r._holes[l],g=No.LineString.apply(this,[h]);o.push(g.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=No.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(No[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:o}}},Wd=function(r){this.geometryFactory=r||new ge,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new fu(this.geometryFactory)};Wd.prototype.read=function(r){var o=this.parser.read(r);return this.precisionModel.getType()===_e.FIXED&&this.reducePrecision(o),o},Wd.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 _x=function(){this.parser=new fu(this.geometryFactory)};_x.prototype.write=function(r){return this.parser.write(r)};var Dt=function(){},Ef={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Dt.prototype.interfaces_=function(){return[]},Dt.prototype.getClass=function(){return Dt},Dt.opposite=function(r){return r===Dt.LEFT?Dt.RIGHT:r===Dt.RIGHT?Dt.LEFT:r},Ef.ON.get=function(){return 0},Ef.LEFT.get=function(){return 1},Ef.RIGHT.get=function(){return 2},Object.defineProperties(Dt,Ef),(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 Xi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Xi.prototype.getCoordinate=function(){return this._minCoord},Xi.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},Xi.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)},Xi.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=Dt.LEFT;return a[o].y<a[o+1].y&&(l=Dt.RIGHT),l},Xi.prototype.getEdge=function(){return this._orientedDe},Xi.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])},Xi.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)},Xi.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)===Dt.LEFT&&(this._orientedDe=this._minDe.getSym())},Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi};var Oo=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}(Vt),wf=function(){this.array_=[]};wf.prototype.addLast=function(r){this.array_.push(r)},wf.prototype.removeFirst=function(){return this.array_.shift()},wf.prototype.isEmpty=function(){return this.array_.length===0};var br=function(){this._finder=null,this._dirEdgeList=new O,this._nodes=new O,this._rightMostCoord=null,this._env=null,this._finder=new Xi};br.prototype.clearVisitedEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();)r.next().setVisited(!1)},br.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},br.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 Oo("unable to find edge to compute depths at "+r.getCoordinate());r.getEdges().computeDepths(o);for(var h=r.getEdges().iterator();h.hasNext();){var g=h.next();g.setVisited(!0),this.copySymDepths(g)}},br.prototype.computeDepth=function(r){this.clearVisitedEdges();var o=this._finder.getEdge();o.setEdgeDepths(Dt.RIGHT,r),this.copySymDepths(o),this.computeDepths(o)},br.prototype.create=function(r){this.addReachable(r),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},br.prototype.findResultEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();){var o=r.next();o.getDepth(Dt.RIGHT)>=1&&o.getDepth(Dt.LEFT)<=0&&!o.isInteriorAreaEdge()&&o.setInResult(!0)}},br.prototype.computeDepths=function(r){var o=new ye,a=new wf,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 g=h.getEdges().iterator();g.hasNext();){var w=g.next().getSym();if(!w.isVisited()){var C=w.getNode();o.contains(C)||(a.addLast(C),o.add(C))}}}},br.prototype.compareTo=function(r){var o=r;return this._rightMostCoord.x<o._rightMostCoord.x?-1:this._rightMostCoord.x>o._rightMostCoord.x?1:0},br.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},br.prototype.addReachable=function(r){var o=new _;for(o.add(r);!o.empty();){var a=o.pop();this.add(a,o)}},br.prototype.copySymDepths=function(r){var o=r.getSym();o.setDepth(Dt.LEFT,r.getDepth(Dt.RIGHT)),o.setDepth(Dt.RIGHT,r.getDepth(Dt.LEFT))},br.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)}},br.prototype.getNodes=function(){return this._nodes},br.prototype.getDirectedEdges=function(){return this._dirEdgeList},br.prototype.interfaces_=function(){return[z]},br.prototype.getClass=function(){return br};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[Dt.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 g=arguments[0],w=arguments[1],C=arguments[2];this.init(3),this.location[Dt.ON]=g,this.location[Dt.LEFT]=w,this.location[Dt.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[Dt.ON]=this.location[Dt.ON],o[Dt.LEFT]=V.NONE,o[Dt.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[Dt.LEFT];this.location[Dt.LEFT]=this.location[Dt.RIGHT],this.location[Dt.RIGHT]=r},vn.prototype.toString=function(){var r=new vt;return this.location.length>1&&r.append(V.toLocationSymbol(this.location[Dt.LEFT])),r.append(V.toLocationSymbol(this.location[Dt.ON])),this.location.length>1&&r.append(V.toLocationSymbol(this.location[Dt.RIGHT])),r.toString()},vn.prototype.setLocations=function(r,o,a){this.location[Dt.ON]=r,this.location[Dt.LEFT]=o,this.location[Dt.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(Dt.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 g=arguments[0],w=arguments[1],C=arguments[2];this.elt[0]=new vn(g,w,C),this.elt[1]=new vn(g,w,C)}else if(arguments.length===4){var B=arguments[0],K=arguments[1],gt=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[B].setLocations(K,gt,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(Dt.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(Dt.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 qn=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()};qn.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())},qn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},qn.prototype.computePoints=function(r){this._startDe=r;var o=r,a=!0;do{if(o===null)throw new Oo("Found null DirectedEdge");if(o.getEdgeRing()===this)throw new Oo("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)},qn.prototype.getLinearRing=function(){return this._ring},qn.prototype.getCoordinate=function(r){return this._pts.get(r)},qn.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},qn.prototype.addPoints=function(r,o,a){var l=r.getCoordinates();if(o){var h=1;a&&(h=0);for(var g=h;g<l.length;g++)this._pts.add(l[g])}else{var w=l.length-2;a&&(w=l.length-1);for(var C=w;C>=0;C--)this._pts.add(l[C])}},qn.prototype.isHole=function(){return this._isHole},qn.prototype.setInResult=function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)},qn.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},qn.prototype.addHole=function(r){this._holes.add(r)},qn.prototype.isShell=function(){return this._shell===null},qn.prototype.getLabel=function(){return this._label},qn.prototype.getEdges=function(){return this._edges},qn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},qn.prototype.getShell=function(){return this._shell},qn.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,Dt.RIGHT);if(l===V.NONE)return null;if(this._label.getLocation(a)===V.NONE)return this._label.setLocation(a,l),null}},qn.prototype.setShell=function(r){this._shell=r,r!==null&&r.addHole(this)},qn.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)},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var s2=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}(qn),a2=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 s2(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}(qn),ci=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}}};ci.prototype.setVisited=function(r){this._isVisited=r},ci.prototype.setInResult=function(r){this._isInResult=r},ci.prototype.isCovered=function(){return this._isCovered},ci.prototype.isCoveredSet=function(){return this._isCoveredSet},ci.prototype.setLabel=function(r){this._label=r},ci.prototype.getLabel=function(){return this._label},ci.prototype.setCovered=function(r){this._isCovered=r,this._isCoveredSet=!0},ci.prototype.updateIM=function(r){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(r)},ci.prototype.isInResult=function(){return this._isInResult},ci.prototype.isVisited=function(){return this._isVisited},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var Sf=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 g=a.getLocation(l);h!==V.BOUNDARY&&(h=g)}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 g=this.computeMergedLocation(l,h);this._label.getLocation(h)===V.NONE&&this._label.setLocation(h,g)}},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}(ci),Yi=function(){this.nodeMap=new y,this.nodeFact=null;var r=arguments[0];this.nodeFact=r};Yi.prototype.find=function(r){return this.nodeMap.get(r)},Yi.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 Sf){var a=arguments[0],l=this.nodeMap.get(a.getCoordinate());return l===null?(this.nodeMap.put(a.getCoordinate(),a),a):(l.mergeLabel(a),l)}},Yi.prototype.print=function(r){for(var o=this.iterator();o.hasNext();)o.next().print(r)},Yi.prototype.iterator=function(){return this.nodeMap.values().iterator()},Yi.prototype.values=function(){return this.nodeMap.values()},Yi.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},Yi.prototype.add=function(r){var o=r.getCoordinate();this.addNode(o).add(r)},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi};var mn=function(){},Yl={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}},Yl.NE.get=function(){return 0},Yl.NW.get=function(){return 1},Yl.SW.get=function(){return 2},Yl.SE.get=function(){return 3},Object.defineProperties(mn,Yl);var dr=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],g=arguments[1],w=arguments[2],C=arguments[3];this._edge=h,this.init(g,w),this._label=C}};dr.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)},dr.prototype.getDy=function(){return this._dy},dr.prototype.getCoordinate=function(){return this._p0},dr.prototype.setNode=function(r){this._node=r},dr.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)},dr.prototype.compareTo=function(r){var o=r;return this.compareDirection(o)},dr.prototype.getDirectedCoordinate=function(){return this._p1},dr.prototype.getDx=function(){return this._dx},dr.prototype.getLabel=function(){return this._label},dr.prototype.getEdge=function(){return this._edge},dr.prototype.getQuadrant=function(){return this._quadrant},dr.prototype.getNode=function(){return this._node},dr.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},dr.prototype.computeLabel=function(r){},dr.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")},dr.prototype.interfaces_=function(){return[z]},dr.prototype.getClass=function(){return dr};var Xd=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 Oo("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,Dt.LEFT)===V.INTERIOR&&this._label.getLocation(l,Dt.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[Dt.LEFT]+"/"+this._depth[Dt.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 g=1;a===Dt.LEFT&&(g=-1);var w=Dt.opposite(a),C=l+h*g;this.setDepth(a,l),this.setDepth(w,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}(dr),hu=function(){};hu.prototype.createNode=function(r){return new Sf(r,null)},hu.prototype.interfaces_=function(){return[]},hu.prototype.getClass=function(){return hu};var Ln=function(){if(this._edges=new O,this._nodes=null,this._edgeEndList=new O,arguments.length===0)this._nodes=new Yi(new hu);else if(arguments.length===1){var r=arguments[0];this._nodes=new Yi(r)}};Ln.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)}},Ln.prototype.find=function(r){return this._nodes.find(r)},Ln.prototype.addNode=function(){if(arguments[0]instanceof Sf){var r=arguments[0];return this._nodes.addNode(r)}if(arguments[0]instanceof P){var o=arguments[0];return this._nodes.addNode(o)}},Ln.prototype.getNodeIterator=function(){return this._nodes.iterator()},Ln.prototype.linkResultDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkResultDirectedEdges()},Ln.prototype.debugPrintln=function(r){Ft.out.println(r)},Ln.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},Ln.prototype.linkAllDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkAllDirectedEdges()},Ln.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)},Ln.prototype.getEdgeEnds=function(){return this._edgeEndList},Ln.prototype.debugPrint=function(r){Ft.out.print(r)},Ln.prototype.getEdgeIterator=function(){return this._edges.iterator()},Ln.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},Ln.prototype.insertEdge=function(r){this._edges.add(r)},Ln.prototype.findEdgeEnd=function(r){for(var o=this.getEdgeEnds().iterator();o.hasNext();){var a=o.next();if(a.getEdge()===r)return a}return null},Ln.prototype.addEdges=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next();this._edges.add(a);var l=new Xd(a,!0),h=new Xd(a,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},Ln.prototype.add=function(r){this._nodes.add(r),this._edgeEndList.add(r)},Ln.prototype.getNodes=function(){return this._nodes.values()},Ln.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},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.linkResultDirectedEdges=function(r){for(var o=r.iterator();o.hasNext();)o.next().getEdges().linkResultDirectedEdges()};var jr=function(){this._geometryFactory=null,this._shellList=new O;var r=arguments[0];this._geometryFactory=r};jr.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)}},jr.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},jr.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 Oo("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},jr.prototype.buildMinimalEdgeRings=function(r,o,a){for(var l=new O,h=r.iterator();h.hasNext();){var g=h.next();if(g.getMaxNodeDegree()>2){g.linkDirectedEdgesForMinimalEdgeRings();var w=g.buildMinimalRings(),C=this.findShell(w);C!==null?(this.placePolygonHoles(C,w),o.add(C)):a.addAll(w)}else l.add(g)}return l},jr.prototype.containsPoint=function(r){for(var o=this._shellList.iterator();o.hasNext();)if(o.next().containsPoint(r))return!0;return!1},jr.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 a2(l,this._geometryFactory);o.add(h),h.setInResult()}}return o},jr.prototype.placePolygonHoles=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next();l.isHole()&&l.setShell(r)}},jr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},jr.prototype.findEdgeRingContaining=function(r,o){for(var a=r.getLinearRing(),l=a.getEnvelopeInternal(),h=a.getCoordinateN(0),g=null,w=null,C=o.iterator();C.hasNext();){var B=C.next(),K=B.getLinearRing(),gt=K.getEnvelopeInternal();g!==null&&(w=g.getLinearRing().getEnvelopeInternal());var yt=!1;gt.contains(l)&&ot.isPointInRing(h,K.getCoordinates())&&(yt=!0),yt&&(g===null||w.contains(gt))&&(g=B)}return g},jr.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},jr.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];Ln.linkResultDirectedEdges(a);var l=this.buildMaximalEdgeRings(o),h=new O,g=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(g,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr};var pu=function(){};pu.prototype.getBounds=function(){},pu.prototype.interfaces_=function(){return[]},pu.prototype.getClass=function(){return pu};var Di=function(){this._bounds=null,this._item=null;var r=arguments[0],o=arguments[1];this._bounds=r,this._item=o};Di.prototype.getItem=function(){return this._item},Di.prototype.getBounds=function(){return this._bounds},Di.prototype.interfaces_=function(){return[pu,t]},Di.prototype.getClass=function(){return Di};var Do=function(){this._size=null,this._items=null,this._size=0,this._items=new O,this._items.add(null)};Do.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},Do.prototype.size=function(){return this._size},Do.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)},Do.prototype.clear=function(){this._size=0,this._items.clear()},Do.prototype.isEmpty=function(){return this._size===0},Do.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)},Do.prototype.interfaces_=function(){return[]},Do.prototype.getClass=function(){return Do};var es=function(){};es.prototype.visitItem=function(r){},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var ya=function(){};ya.prototype.insert=function(r,o){},ya.prototype.remove=function(r,o){},ya.prototype.query=function(){},ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya};var $n=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}}},xx={serialVersionUID:{configurable:!0}};$n.prototype.getLevel=function(){return this._level},$n.prototype.size=function(){return this._childBoundables.size()},$n.prototype.getChildBoundables=function(){return this._childBoundables},$n.prototype.addChildBoundable=function(r){Pt.isTrue(this._bounds===null),this._childBoundables.add(r)},$n.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},$n.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},$n.prototype.interfaces_=function(){return[pu,t]},$n.prototype.getClass=function(){return $n},xx.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties($n,xx);var Fi=function(){};Fi.reverseOrder=function(){return{compare:function(r,o){return o.compareTo(r)}}},Fi.min=function(r){return Fi.sort(r),r.get(0)},Fi.sort=function(r,o){var a=r.toArray();o?_n.sort(a,o):_n.sort(a);for(var l=r.iterator(),h=0,g=a.length;h<g;h++)l.next(),l.set(a[h])},Fi.singletonList=function(r){var o=new O;return o.add(r),o};var Vn=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()};Vn.prototype.expandToQueue=function(r,o){var a=Vn.isComposite(this._boundable1),l=Vn.isComposite(this._boundable2);if(a&&l)return Vn.area(this._boundable1)>Vn.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")},Vn.prototype.isLeaves=function(){return!(Vn.isComposite(this._boundable1)||Vn.isComposite(this._boundable2))},Vn.prototype.compareTo=function(r){var o=r;return this._distance<o._distance?-1:this._distance>o._distance?1:0},Vn.prototype.expand=function(r,o,a,l){for(var h=r.getChildBoundables().iterator();h.hasNext();){var g=h.next(),w=new Vn(g,o,this._itemDistance);w.getDistance()<l&&a.add(w)}},Vn.prototype.getBoundable=function(r){return r===0?this._boundable1:this._boundable2},Vn.prototype.getDistance=function(){return this._distance},Vn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Vn.prototype.interfaces_=function(){return[z]},Vn.prototype.getClass=function(){return Vn},Vn.area=function(r){return r.getBounds().getArea()},Vn.isComposite=function(r){return r instanceof $n};var er=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}},Mf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};er.prototype.getNodeCapacity=function(){return this._nodeCapacity},er.prototype.lastNode=function(r){return r.get(r.size()-1)},er.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 $n?r+=this.size(a):a instanceof Di&&(r+=1)}return r}},er.prototype.removeItem=function(r,o){for(var a=null,l=r.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof Di&&h.getItem()===o&&(a=h)}return a!==null&&(r.getChildBoundables().remove(a),!0)},er.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 $n){var g=this.itemsTree(h);g!==null&&a.add(g)}else h instanceof Di?a.add(h.getItem()):Pt.shouldNeverReachHere()}return a.size()<=0?null:a}},er.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 Di(r,o))},er.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 g=l.getChildBoundables().iterator();g.hasNext();){var w=g.next();w instanceof $n?this.boundablesAtLevel(a,w,h):(Pt.isTrue(w instanceof Di),a===-1&&h.add(w))}return null}},er.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(Y(arguments[2],es)&&arguments[0]instanceof Object&&arguments[1]instanceof $n)for(var h=arguments[0],g=arguments[1],w=arguments[2],C=g.getChildBoundables(),B=0;B<C.size();B++){var K=C.get(B);this.getIntersectsOp().intersects(K.getBounds(),h)&&(K instanceof $n?this.query(h,K,w):K instanceof Di?w.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if(Y(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof $n)for(var gt=arguments[0],yt=arguments[1],Bt=arguments[2],kt=yt.getChildBoundables(),Jt=0;Jt<kt.size();Jt++){var ae=kt.get(Jt);this.getIntersectsOp().intersects(ae.getBounds(),gt)&&(ae instanceof $n?this.query(gt,ae,Bt):ae instanceof Di?Bt.add(ae.getItem()):Pt.shouldNeverReachHere())}}},er.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},er.prototype.getRoot=function(){return this.build(),this._root},er.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],g=this.removeItem(l,h);if(g)return!0;for(var w=null,C=l.getChildBoundables().iterator();C.hasNext();){var B=C.next();if(this.getIntersectsOp().intersects(B.getBounds(),a)&&B instanceof $n&&(g=this.remove(a,B,h))){w=B;break}}return w!==null&&w.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(w),g}},er.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)},er.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 $n){var l=this.depth(a);l>r&&(r=l)}}return r+1}},er.prototype.createParentBoundables=function(r,o){Pt.isTrue(!r.isEmpty());var a=new O;a.add(this.createNode(o));var l=new O(r);Fi.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var g=h.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(o)),this.lastNode(a).addChildBoundable(g)}return a},er.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},er.prototype.interfaces_=function(){return[t]},er.prototype.getClass=function(){return er},er.compareDoubles=function(r,o){return r>o?1:r<o?-1:0},Mf.IntersectsOp.get=function(){return u2},Mf.serialVersionUID.get=function(){return-3886435814360241e3},Mf.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(er,Mf);var u2=function(){},du=function(){};du.prototype.distance=function(r,o){},du.prototype.interfaces_=function(){return[]},du.prototype.getClass=function(){return du};var Ex=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 g=new O,w=0;w<l.length;w++)g.addAll(this.createParentBoundablesFromVerticalSlice(l[w],h));return g},o.prototype.createNode=function(l){return new wx(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 g=Math.trunc(Math.ceil(l.size()/h)),w=new Array(h).fill(null),C=l.iterator(),B=0;B<h;B++){w[B]=new O;for(var K=0;C.hasNext()&&K<g;){var gt=C.next();w[B].add(gt),K++}}return w},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],g=arguments[1];r.prototype.query.call(this,h,g)}else if(arguments.length===3){if(Y(arguments[2],es)&&arguments[0]instanceof Object&&arguments[1]instanceof $n){var w=arguments[0],C=arguments[1],B=arguments[2];r.prototype.query.call(this,w,C,B)}else if(Y(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof $n){var K=arguments[0],gt=arguments[1],yt=arguments[2];r.prototype.query.call(this,K,gt,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 g=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),w=new O(l);Fi.sort(w,o.xComparator);var C=this.verticalSlices(w,Math.trunc(Math.ceil(Math.sqrt(g))));return this.createParentBoundablesFromVerticalSlices(C,h)},o.prototype.nearestNeighbour=function(){if(arguments.length===1){if(Y(arguments[0],du)){var l=arguments[0],h=new Vn(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof Vn){var g=arguments[0];return this.nearestNeighbour(g,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof o&&Y(arguments[1],du)){var w=arguments[0],C=arguments[1],B=new Vn(this.getRoot(),w.getRoot(),C);return this.nearestNeighbour(B)}if(arguments[0]instanceof Vn&&typeof arguments[1]=="number"){var K=arguments[0],gt=arguments[1],yt=null,Bt=new Do;for(Bt.add(K);!Bt.isEmpty()&&gt>0;){var kt=Bt.poll(),Jt=kt.getDistance();if(Jt>=gt)break;kt.isLeaves()?(gt=Jt,yt=kt):kt.expandToQueue(Bt,gt)}return[yt.getBoundable(0).getItem(),yt.getBoundable(1).getItem()]}}else if(arguments.length===3){var ae=arguments[0],dn=arguments[1],Wn=arguments[2],Lr=new Di(ae,dn),go=new Vn(this.getRoot(),Lr,Wn);return this.nearestNeighbour(go)[0]}},o.prototype.interfaces_=function(){return[ya,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 wx},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}(er),wx=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}($n),zr=function(){};zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.relativeSign=function(r,o){return r<o?-1:r>o?1:0},zr.compare=function(r,o,a){if(o.equals2D(a))return 0;var l=zr.relativeSign(o.x,a.x),h=zr.relativeSign(o.y,a.y);switch(r){case 0:return zr.compareValue(l,h);case 1:return zr.compareValue(h,l);case 2:return zr.compareValue(h,-l);case 3:return zr.compareValue(-l,h);case 4:return zr.compareValue(-l,-h);case 5:return zr.compareValue(-h,-l);case 6:return zr.compareValue(-h,l);case 7:return zr.compareValue(l,-h)}return Pt.shouldNeverReachHere("invalid octant value"),0},zr.compareValue=function(r,o){return r<0?-1:r>0?1:o<0?-1:o>0?1:0};var ns=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))};ns.prototype.getCoordinate=function(){return this.coord},ns.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)},ns.prototype.compareTo=function(r){var o=r;return this.segmentIndex<o.segmentIndex?-1:this.segmentIndex>o.segmentIndex?1:this.coord.equals2D(o.coord)?0:zr.compare(this._segmentOctant,this.coord,o.coord)},ns.prototype.isEndPoint=function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r},ns.prototype.isInterior=function(){return this._isInterior},ns.prototype.interfaces_=function(){return[z]},ns.prototype.getClass=function(){return ns};var Ar=function(){this._nodeMap=new y,this._edge=null;var r=arguments[0];this._edge=r};Ar.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()},Ar.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)}},Ar.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},Ar.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))}},Ar.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 g=r.segmentIndex+1;g<=o.segmentIndex;g++)a.add(this._edge.getCoordinate(g));h&&a.add(new P(o.coord))},Ar.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ar.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}},Ar.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)},Ar.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}},Ar.prototype.getEdge=function(){return this._edge},Ar.prototype.addEndpoints=function(){var r=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(r),r)},Ar.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 g=new Array(a).fill(null),w=0;g[w++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)g[w++]=this._edge.getCoordinate(C);return h&&(g[w]=new P(o.coord)),new Dn(g,this._edge.getData())},Ar.prototype.add=function(r,o){var a=new ns(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)},Ar.prototype.checkSplitEdgesCorrectness=function(r){var o=this._edge.getCoordinates(),a=r.get(0).getCoordinate(0);if(!a.equals2D(o[0]))throw new Vt("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 Vt("bad split edge end point at "+h)},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar};var va=function(){};va.prototype.interfaces_=function(){return[]},va.prototype.getClass=function(){return va},va.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],g=arguments[1],w=g.x-h.x,C=g.y-h.y;if(w===0&&C===0)throw new T("Cannot compute the octant for two identical points "+h);return va.octant(w,C)}};var ao=function(){};ao.prototype.getCoordinates=function(){},ao.prototype.size=function(){},ao.prototype.getCoordinate=function(r){},ao.prototype.isClosed=function(){},ao.prototype.setData=function(r){},ao.prototype.getData=function(){},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao};var $l=function(){};$l.prototype.addIntersection=function(r,o){},$l.prototype.interfaces_=function(){return[ao]},$l.prototype.getClass=function(){return $l};var Dn=function(){this._nodeList=new Ar(this),this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};Dn.prototype.getCoordinates=function(){return this._pts},Dn.prototype.size=function(){return this._pts.length},Dn.prototype.getCoordinate=function(r){return this._pts[r]},Dn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Dn.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))},Dn.prototype.setData=function(r){this._data=r},Dn.prototype.safeOctant=function(r,o){return r.equals2D(o)?0:va.octant(r,o)},Dn.prototype.getData=function(){return this._data},Dn.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],g=new P(a.getIntersection(h));this.addIntersection(g,l)}},Dn.prototype.toString=function(){return St.toLineString(new oe(this._pts))},Dn.prototype.getNodeList=function(){return this._nodeList},Dn.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)},Dn.prototype.addIntersections=function(r,o,a){for(var l=0;l<r.getIntersectionNum();l++)this.addIntersection(r,o,a,l)},Dn.prototype.interfaces_=function(){return[$l]},Dn.prototype.getClass=function(){return Dn},Dn.getNodedSubstrings=function(){if(arguments.length===1){var r=arguments[0],o=new O;return Dn.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 se=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)}},Sx={serialVersionUID:{configurable:!0}};se.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},se.prototype.orientationIndex=function(){if(arguments[0]instanceof se){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)}},se.prototype.toGeometry=function(r){return r.createLineString([this.p0,this.p1])},se.prototype.isVertical=function(){return this.p0.x===this.p1.x},se.prototype.equals=function(r){if(!(r instanceof se))return!1;var o=r;return this.p0.equals(o.p0)&&this.p1.equals(o.p1)},se.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},se.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 se){var l=arguments[0],h=this.projectionFactor(l.p0),g=this.projectionFactor(l.p1);if(h>=1&&g>=1||h<=0&&g<=0)return null;var w=this.project(l.p0);h<0&&(w=this.p0),h>1&&(w=this.p1);var C=this.project(l.p1);return g<0&&(C=this.p0),g>1&&(C=this.p1),new se(w,C)}},se.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},se.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},se.prototype.getCoordinate=function(r){return r===0?this.p0:this.p1},se.prototype.distancePerpendicular=function(r){return ot.distancePointLinePerpendicular(r,this.p0,this.p1)},se.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},se.prototype.midPoint=function(){return se.midPoint(this.p0,this.p1)},se.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?S.NaN:((r.x-this.p0.x)*o+(r.y-this.p0.y)*a)/l},se.prototype.closestPoints=function(r){var o=this.intersection(r);if(o!==null)return[o,o];var a=new Array(2).fill(null),l=S.MAX_VALUE,h=null,g=this.closestPoint(r.p0);l=g.distance(r.p0),a[0]=g,a[1]=r.p0;var w=this.closestPoint(r.p1);(h=w.distance(r.p1))<l&&(l=h,a[0]=w,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 B=r.closestPoint(this.p1);return(h=B.distance(this.p1))<l&&(l=h,a[0]=this.p1,a[1]=B),a},se.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},se.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},se.prototype.getLength=function(){return this.p0.distance(this.p1)},se.prototype.compareTo=function(r){var o=r,a=this.p0.compareTo(o.p0);return a!==0?a:this.p1.compareTo(o.p1)},se.prototype.reverse=function(){var r=this.p0;this.p0=this.p1,this.p1=r},se.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)},se.prototype.lineIntersection=function(r){try{return zt.intersection(this.p0,this.p1,r.p0,r.p1)}catch(o){if(!(o instanceof $t))throw o}return null},se.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},se.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,g=this.p1.y-this.p0.y,w=Math.sqrt(h*h+g*g),C=0,B=0;if(o!==0){if(w<=0)throw new Error("Cannot compute offset from zero-length line segment");C=o*h/w,B=o*g/w}return new P(a-B,l+C)},se.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}},se.prototype.segmentFraction=function(r){var o=this.projectionFactor(r);return o<0?o=0:(o>1||S.isNaN(o))&&(o=1),o},se.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},se.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},se.prototype.distance=function(){if(arguments[0]instanceof se){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)}},se.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},se.prototype.hashCode=function(){var r=S.doubleToLongBits(this.p0.x);r^=31*S.doubleToLongBits(this.p0.y);var o=Math.trunc(r)^Math.trunc(r>>32),a=S.doubleToLongBits(this.p1.x);return a^=31*S.doubleToLongBits(this.p1.y),o^(Math.trunc(a)^Math.trunc(a>>32))},se.prototype.interfaces_=function(){return[z,t]},se.prototype.getClass=function(){return se},se.midPoint=function(r,o){return new P((r.x+o.x)/2,(r.y+o.y)/2)},Sx.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(se,Sx);var Zl=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new se,this._overlapSeg2=new se};Zl.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)}}},Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl};var Kr=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};Kr.prototype.getLineSegment=function(r,o){o.p0=this._pts[r],o.p1=this._pts[r+1]},Kr.prototype.computeSelect=function(r,o,a,l){var h=this._pts[o],g=this._pts[a];if(l.tempEnv1.init(h,g),a-o==1)return l.select(this,o),null;if(!r.intersects(l.tempEnv1))return null;var w=Math.trunc((o+a)/2);o<w&&this.computeSelect(r,o,w,l),w<a&&this.computeSelect(r,w,a,l)},Kr.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},Kr.prototype.computeOverlaps=function(r,o){this.computeOverlapsInternal(this._start,this._end,r,r._start,r._end,o)},Kr.prototype.setId=function(r){this._id=r},Kr.prototype.select=function(r,o){this.computeSelect(r,this._start,this._end,o)},Kr.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},Kr.prototype.getEndIndex=function(){return this._end},Kr.prototype.getStartIndex=function(){return this._start},Kr.prototype.getContext=function(){return this._context},Kr.prototype.getId=function(){return this._id},Kr.prototype.computeOverlapsInternal=function(r,o,a,l,h,g){var w=this._pts[r],C=this._pts[o],B=a._pts[l],K=a._pts[h];if(o-r==1&&h-l==1)return g.overlap(this,r,a,l),null;if(g.tempEnv1.init(w,C),g.tempEnv2.init(B,K),!g.tempEnv1.intersects(g.tempEnv2))return null;var gt=Math.trunc((r+o)/2),yt=Math.trunc((l+h)/2);r<gt&&(l<yt&&this.computeOverlapsInternal(r,gt,a,l,yt,g),yt<h&&this.computeOverlapsInternal(r,gt,a,yt,h,g)),gt<o&&(l<yt&&this.computeOverlapsInternal(gt,o,a,l,yt,g),yt<h&&this.computeOverlapsInternal(gt,o,a,yt,h,g))},Kr.prototype.interfaces_=function(){return[]},Kr.prototype.getClass=function(){return Kr};var $i=function(){};$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.getChainStartIndices=function(r){var o=0,a=new O;a.add(new it(o));do{var l=$i.findChainEnd(r,o);a.add(new it(l)),o=l}while(o<r.length-1);return $i.toIntArray(a)},$i.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},$i.getChains=function(){if(arguments.length===1){var r=arguments[0];return $i.getChains(r,null)}if(arguments.length===2){for(var o=arguments[0],a=arguments[1],l=new O,h=$i.getChainStartIndices(o),g=0;g<h.length-1;g++){var w=new Kr(o,h[g],h[g+1],a);l.add(w)}return l}},$i.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 Rs=function(){};Rs.prototype.computeNodes=function(r){},Rs.prototype.getNodedSubstrings=function(){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Jl=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setSegmentIntersector(r)}}};Jl.prototype.setSegmentIntersector=function(r){this._segInt=r},Jl.prototype.interfaces_=function(){return[Rs]},Jl.prototype.getClass=function(){return Jl};var Yd=function(r){function o(l){l?r.call(this,l):r.call(this),this._monoChains=new O,this._index=new Ex,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 Dn.getNodedSubstrings(this._nodedSegStrings)},o.prototype.getIndex=function(){return this._index},o.prototype.add=function(l){for(var h=$i.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var g=h.next();g.setId(this._idCounter++),this._index.insert(g.getEnvelope(),g),this._monoChains.add(g)}},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 Mx(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var g=h.next(),w=this._index.query(g.getEnvelope()).iterator();w.hasNext();){var C=w.next();if(C.getId()>g.getId()&&(g.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 Mx},Object.defineProperties(o,a),o}(Jl),Mx=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],g=arguments[3],w=a.getContext(),C=h.getContext();this._si.processIntersections(w,l,C,g)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Zl),je=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],g=arguments[1],w=arguments[2],C=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(g),this.setJoinStyle(w),this.setMitreLimit(C)}}},Fo={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}};je.prototype.getEndCapStyle=function(){return this._endCapStyle},je.prototype.isSingleSided=function(){return this._isSingleSided},je.prototype.setQuadrantSegments=function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=je.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=je.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==je.JOIN_ROUND&&(this._quadrantSegments=je.DEFAULT_QUADRANT_SEGMENTS)},je.prototype.getJoinStyle=function(){return this._joinStyle},je.prototype.setJoinStyle=function(r){this._joinStyle=r},je.prototype.setSimplifyFactor=function(r){this._simplifyFactor=r<0?0:r},je.prototype.getSimplifyFactor=function(){return this._simplifyFactor},je.prototype.getQuadrantSegments=function(){return this._quadrantSegments},je.prototype.setEndCapStyle=function(r){this._endCapStyle=r},je.prototype.getMitreLimit=function(){return this._mitreLimit},je.prototype.setMitreLimit=function(r){this._mitreLimit=r},je.prototype.setSingleSided=function(r){this._isSingleSided=r},je.prototype.interfaces_=function(){return[]},je.prototype.getClass=function(){return je},je.bufferDistanceError=function(r){var o=Math.PI/2/r;return 1-Math.cos(o/2)},Fo.CAP_ROUND.get=function(){return 1},Fo.CAP_FLAT.get=function(){return 2},Fo.CAP_SQUARE.get=function(){return 3},Fo.JOIN_ROUND.get=function(){return 1},Fo.JOIN_MITRE.get=function(){return 2},Fo.JOIN_BEVEL.get=function(){return 3},Fo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Fo.DEFAULT_MITRE_LIMIT.get=function(){return 5},Fo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(je,Fo);var Nn=function(r){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ot.COUNTERCLOCKWISE,this._inputLine=r||null},jl={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Nn.prototype.isDeletable=function(r,o,a,l){var h=this._inputLine[r],g=this._inputLine[o],w=this._inputLine[a];return!!this.isConcave(h,g,w)&&!!this.isShallow(h,g,w,l)&&this.isShallowSampled(h,g,r,a,l)},Nn.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]=Nn.DELETE,h=!0,l=!0),r=h?a:o,o=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(o)}return l},Nn.prototype.isShallowConcavity=function(r,o,a,l){return ot.computeOrientation(r,o,a)!==this._angleOrientation?!1:ot.distancePointLine(o,r,a)<l},Nn.prototype.isShallowSampled=function(r,o,a,l,h){var g=Math.trunc((l-a)/Nn.NUM_PTS_TO_CHECK);g<=0&&(g=1);for(var w=a;w<l;w+=g)if(!this.isShallow(r,o,this._inputLine[w],h))return!1;return!0},Nn.prototype.isConcave=function(r,o,a){var l=ot.computeOrientation(r,o,a)===this._angleOrientation;return l},Nn.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()},Nn.prototype.findNextNonDeletedIndex=function(r){for(var o=r+1;o<this._inputLine.length&&this._isDeleted[o]===Nn.DELETE;)o++;return o},Nn.prototype.isShallow=function(r,o,a,l){return ot.distancePointLine(o,r,a)<l},Nn.prototype.collapseLine=function(){for(var r=new J,o=0;o<this._inputLine.length;o++)this._isDeleted[o]!==Nn.DELETE&&r.add(this._inputLine[o]);return r.toCoordinateArray()},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},Nn.simplify=function(r,o){return new Nn(r).simplify(o)},jl.INIT.get=function(){return 0},jl.DELETE.get=function(){return 1},jl.KEEP.get=function(){return 1},jl.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Nn,jl);var fi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new O},bx={COORDINATE_ARRAY_TYPE:{configurable:!0}};fi.prototype.getCoordinates=function(){return this._ptList.toArray(fi.COORDINATE_ARRAY_TYPE)},fi.prototype.setPrecisionModel=function(r){this._precisionModel=r},fi.prototype.addPt=function(r){var o=new P(r);if(this._precisionModel.makePrecise(o),this.isRedundant(o))return null;this._ptList.add(o)},fi.prototype.revere=function(){},fi.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])},fi.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},fi.prototype.toString=function(){return new ge().createLineString(this.getCoordinates()).toString()},fi.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)},fi.prototype.setMinimumVertexDistance=function(r){this._minimimVertexDistance=r},fi.prototype.interfaces_=function(){return[]},fi.prototype.getClass=function(){return fi},bx.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(fi,bx);var xe=function(){},_a={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},_a.PI_TIMES_2.get=function(){return 2*Math.PI},_a.PI_OVER_2.get=function(){return Math.PI/2},_a.PI_OVER_4.get=function(){return Math.PI/4},_a.COUNTERCLOCKWISE.get=function(){return ot.COUNTERCLOCKWISE},_a.CLOCKWISE.get=function(){return ot.CLOCKWISE},_a.NONE.get=function(){return ot.COLLINEAR},Object.defineProperties(xe,_a);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 se,this._seg1=new se,this._offset0=new se,this._offset1=new se,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()===je.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},Kl={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===Dt.LEFT||a===ot.COUNTERCLOCKWISE&&this._side===Dt.RIGHT;a===0?this.addCollinear(o):l?this.addOutsideTurn(a,o):this.addInsideTurn(a,o)},bn.prototype.addLineEndCap=function(r,o){var a=new se(r,o),l=new se;this.computeOffsetSegment(a,Dt.LEFT,this._distance,l);var h=new se;this.computeOffsetSegment(a,Dt.RIGHT,this._distance,h);var g=o.x-r.x,w=o.y-r.y,C=Math.atan2(w,g);switch(this._bufParams.getEndCapStyle()){case je.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 je.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case je.CAP_SQUARE:var B=new P;B.x=Math.abs(this._distance)*Math.cos(C),B.y=Math.abs(this._distance)*Math.sin(C);var K=new P(l.p1.x+B.x,l.p1.y+B.y),gt=new P(h.p1.x+B.x,h.p1.y+B.y);this._segList.addPt(K),this._segList.addPt(gt)}},bn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},bn.prototype.addMitreJoin=function(r,o,a,l){var h=!0,g=null;try{g=zt.intersection(o.p0,o.p1,a.p0,a.p1),(l<=0?1:g.distance(r)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(w){if(!(w instanceof $t))throw w;g=new P(0,0),h=!1}h?this._segList.addPt(g):this.addLimitedMitreJoin(o,a,l,this._bufParams.getMitreLimit())},bn.prototype.addFilletCorner=function(r,o,a,l,h){var g=o.x-r.x,w=o.y-r.y,C=Math.atan2(w,g),B=a.x-r.x,K=a.y-r.y,gt=Math.atan2(K,B);l===ot.CLOCKWISE?C<=gt&&(C+=2*Math.PI):C>=gt&&(C-=2*Math.PI),this._segList.addPt(o),this.addFilletArc(r,C,gt,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()===je.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===je.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,g=xe.angle(h,this._seg0.p0),w=xe.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,C=xe.normalize(g+w),B=xe.normalize(C+Math.PI),K=l*a,gt=a-K*Math.abs(Math.sin(w)),yt=h.x+K*Math.cos(B),Bt=h.y+K*Math.sin(B),kt=new P(yt,Bt),Jt=new se(h,kt),ae=Jt.pointAlongOffset(1,gt),dn=Jt.pointAlongOffset(1,-gt);this._side===Dt.LEFT?(this._segList.addPt(ae),this._segList.addPt(dn)):(this._segList.addPt(dn),this._segList.addPt(ae))},bn.prototype.computeOffsetSegment=function(r,o,a,l){var h=o===Dt.LEFT?1:-1,g=r.p1.x-r.p0.x,w=r.p1.y-r.p0.y,C=Math.sqrt(g*g+w*w),B=h*a*g/C,K=h*a*w/C;l.p0.x=r.p0.x-K,l.p0.y=r.p0.y+B,l.p1.x=r.p1.x-K,l.p1.y=r.p1.y+B},bn.prototype.addFilletArc=function(r,o,a,l,h){var g=l===ot.CLOCKWISE?-1:1,w=Math.abs(o-a),C=Math.trunc(w/this._filletAngleQuantum+.5);if(C<1)return null;for(var B=w/C,K=0,gt=new P;K<w;){var yt=o+g*K;gt.x=r.x+h*Math.cos(yt),gt.y=r.y+h*Math.sin(yt),this._segList.addPt(gt),K+=B}},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 fi,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()===je.JOIN_BEVEL||this._bufParams.getJoinStyle()===je.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},Kl.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Kl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Kl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Kl.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(bn,Kl);var Gr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],o=arguments[1];this._precisionModel=r,this._bufParams=o};Gr.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 g=h.getCoordinates();return a&&et.reverse(g),g},Gr.prototype.computeSingleSidedBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){a.addSegments(r,!0);var h=Nn.simplify(r,-l),g=h.length-1;a.initSideSegments(h[g],h[g-1],Dt.LEFT),a.addFirstSegment();for(var w=g-2;w>=0;w--)a.addNextSegment(h[w],!0)}else{a.addSegments(r,!1);var C=Nn.simplify(r,l),B=C.length-1;a.initSideSegments(C[0],C[1],Dt.LEFT),a.addFirstSegment();for(var K=2;K<=B;K++)a.addNextSegment(C[K],!0)}a.addLastSegment(),a.closeRing()},Gr.prototype.computeRingBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);o===Dt.RIGHT&&(l=-l);var h=Nn.simplify(r,l),g=h.length-1;a.initSideSegments(h[g-1],h[0],o);for(var w=1;w<=g;w++){var C=w!==1;a.addNextSegment(h[w],C)}a.closeRing()},Gr.prototype.computeLineBufferCurve=function(r,o){var a=this.simplifyTolerance(this._distance),l=Nn.simplify(r,a),h=l.length-1;o.initSideSegments(l[0],l[1],Dt.LEFT);for(var g=2;g<=h;g++)o.addNextSegment(l[g],!0);o.addLastSegment(),o.addLineEndCap(l[h-1],l[h]);var w=Nn.simplify(r,-a),C=w.length-1;o.initSideSegments(w[C],w[C-1],Dt.LEFT);for(var B=C-2;B>=0;B--)o.addNextSegment(w[B],!0);o.addLastSegment(),o.addLineEndCap(w[1],w[0]),o.closeRing()},Gr.prototype.computePointCurve=function(r,o){switch(this._bufParams.getEndCapStyle()){case je.CAP_ROUND:o.createCircle(r);break;case je.CAP_SQUARE:o.createSquare(r)}},Gr.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()},Gr.prototype.getBufferParameters=function(){return this._bufParams},Gr.prototype.simplifyTolerance=function(r){return r*this._bufParams.getSimplifyFactor()},Gr.prototype.getRingCurve=function(r,o,a){if(this._distance=a,r.length<=2)return this.getLineCurve(r,a);if(a===0)return Gr.copyCoordinates(r);var l=this.getSegGen(a);return this.computeRingBufferCurve(r,o,l),l.getCoordinates()},Gr.prototype.computeOffsetCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){var h=Nn.simplify(r,-l),g=h.length-1;a.initSideSegments(h[g],h[g-1],Dt.LEFT),a.addFirstSegment();for(var w=g-2;w>=0;w--)a.addNextSegment(h[w],!0)}else{var C=Nn.simplify(r,l),B=C.length-1;a.initSideSegments(C[0],C[1],Dt.LEFT),a.addFirstSegment();for(var K=2;K<=B;K++)a.addNextSegment(C[K],!0)}a.addLastSegment()},Gr.prototype.getSegGen=function(r){return new bn(this._precisionModel,this._bufParams,r)},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr},Gr.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 xa=function(){this._subgraphs=null,this._seg=new se,this._cga=new ot;var r=arguments[0];this._subgraphs=r},Ax={DepthSegment:{configurable:!0}};xa.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(Y(arguments[2],ht)&&arguments[0]instanceof P&&arguments[1]instanceof Xd){for(var g=arguments[0],w=arguments[1],C=arguments[2],B=w.getEdge().getCoordinates(),K=0;K<B.length-1;K++)if(this._seg.p0=B[K],this._seg.p1=B[K+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<g.x)&&!(this._seg.isHorizontal()||g.y<this._seg.p0.y||g.y>this._seg.p1.y||ot.computeOrientation(this._seg.p0,this._seg.p1,g)===ot.RIGHT)){var gt=w.getDepth(Dt.LEFT);this._seg.p0.equals(B[K])||(gt=w.getDepth(Dt.RIGHT));var yt=new Ls(this._seg,gt);C.add(yt)}}else if(Y(arguments[2],ht)&&arguments[0]instanceof P&&Y(arguments[1],ht))for(var Bt=arguments[0],kt=arguments[1],Jt=arguments[2],ae=kt.iterator();ae.hasNext();){var dn=ae.next();dn.isForward()&&this.findStabbedSegments(Bt,dn,Jt)}}},xa.prototype.getDepth=function(r){var o=this.findStabbedSegments(r);return o.size()===0?0:Fi.min(o)._leftDepth},xa.prototype.interfaces_=function(){return[]},xa.prototype.getClass=function(){return xa},Ax.DepthSegment.get=function(){return Ls},Object.defineProperties(xa,Ax);var Ls=function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],o=arguments[1];this._upwardSeg=new se(r),this._leftDepth=o};Ls.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)},Ls.prototype.compareX=function(r,o){var a=r.p0.compareTo(o.p0);return a!==0?a:r.p1.compareTo(o.p1)},Ls.prototype.toString=function(){return this._upwardSeg.toString()},Ls.prototype.interfaces_=function(){return[z]},Ls.prototype.getClass=function(){return Ls};var Ke=function(r,o,a){this.p0=r||null,this.p1=o||null,this.p2=a||null};Ke.prototype.area=function(){return Ke.area(this.p0,this.p1,this.p2)},Ke.prototype.signedArea=function(){return Ke.signedArea(this.p0,this.p1,this.p2)},Ke.prototype.interpolateZ=function(r){if(r===null)throw new T("Supplied point is null.");return Ke.interpolateZ(r,this.p0,this.p1,this.p2)},Ke.prototype.longestSideLength=function(){return Ke.longestSideLength(this.p0,this.p1,this.p2)},Ke.prototype.isAcute=function(){return Ke.isAcute(this.p0,this.p1,this.p2)},Ke.prototype.circumcentre=function(){return Ke.circumcentre(this.p0,this.p1,this.p2)},Ke.prototype.area3D=function(){return Ke.area3D(this.p0,this.p1,this.p2)},Ke.prototype.centroid=function(){return Ke.centroid(this.p0,this.p1,this.p2)},Ke.prototype.inCentre=function(){return Ke.inCentre(this.p0,this.p1,this.p2)},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke},Ke.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)},Ke.signedArea=function(r,o,a){return((a.x-r.x)*(o.y-r.y)-(o.x-r.x)*(a.y-r.y))/2},Ke.det=function(r,o,a,l){return r*l-o*a},Ke.interpolateZ=function(r,o,a,l){var h=o.x,g=o.y,w=a.x-h,C=l.x-h,B=a.y-g,K=l.y-g,gt=w*K-C*B,yt=r.x-h,Bt=r.y-g,kt=(K*yt-C*Bt)/gt,Jt=(-B*yt+w*Bt)/gt;return o.z+kt*(a.z-o.z)+Jt*(l.z-o.z)},Ke.longestSideLength=function(r,o,a){var l=r.distance(o),h=o.distance(a),g=a.distance(r),w=l;return h>w&&(w=h),g>w&&(w=g),w},Ke.isAcute=function(r,o,a){return!!xe.isAcute(r,o,a)&&!!xe.isAcute(o,a,r)&&!!xe.isAcute(a,r,o)},Ke.circumcentre=function(r,o,a){var l=a.x,h=a.y,g=r.x-l,w=r.y-h,C=o.x-l,B=o.y-h,K=2*Ke.det(g,w,C,B),gt=Ke.det(w,g*g+w*w,B,C*C+B*B),yt=Ke.det(g,g*g+w*w,C,C*C+B*B);return new P(l-gt/K,h+yt/K)},Ke.perpendicularBisector=function(r,o){var a=o.x-r.x,l=o.y-r.y,h=new zt(r.x+a/2,r.y+l/2,1),g=new zt(r.x-l+a/2,r.y+a+l/2,1);return new zt(h,g)},Ke.angleBisector=function(r,o,a){var l=o.distance(r),h=l/(l+o.distance(a)),g=a.x-r.x,w=a.y-r.y;return new P(r.x+h*g,r.y+h*w)},Ke.area3D=function(r,o,a){var l=o.x-r.x,h=o.y-r.y,g=o.z-r.z,w=a.x-r.x,C=a.y-r.y,B=a.z-r.z,K=h*B-g*C,gt=g*w-l*B,yt=l*C-h*w,Bt=K*K+gt*gt+yt*yt,kt=Math.sqrt(Bt)/2;return kt},Ke.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)},Ke.inCentre=function(r,o,a){var l=o.distance(a),h=r.distance(a),g=r.distance(o),w=l+h+g,C=(l*r.x+h*o.x+g*a.x)/w,B=(l*r.y+h*o.y+g*a.y)/w;return new P(C,B)};var Ai=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};Ai.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)},Ai.prototype.addPolygon=function(r){var o=this._distance,a=Dt.LEFT;this._distance<0&&(o=-this._distance,a=Dt.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 g=0;g<r.getNumInteriorRing();g++){var w=r.getInteriorRingN(g),C=et.removeRepeatedPoints(w.getCoordinates());this._distance>0&&this.isErodedCompletely(w,-this._distance)||this.addPolygonRing(C,o,Dt.opposite(a),V.INTERIOR,V.EXTERIOR)}},Ai.prototype.isTriangleErodedCompletely=function(r,o){var a=new Ke(r[0],r[1],r[2]),l=a.inCentre();return ot.distancePointLine(l,a.p0,a.p1)<Math.abs(o)},Ai.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)},Ai.prototype.addCurve=function(r,o,a){if(r===null||r.length<2)return null;var l=new Dn(r,new pn(0,V.BOUNDARY,o,a));this._curveList.add(l)},Ai.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ai.prototype.addPolygonRing=function(r,o,a,l,h){if(o===0&&r.length<fe.MINIMUM_VALID_SIZE)return null;var g=l,w=h;r.length>=fe.MINIMUM_VALID_SIZE&&ot.isCCW(r)&&(g=h,w=l,a=Dt.opposite(a));var C=this._curveBuilder.getRingCurve(r,a,o);this.addCurve(C,g,w)},Ai.prototype.add=function(r){if(r.isEmpty())return null;r instanceof ne?this.addPolygon(r):r instanceof ut?this.addLineString(r):r instanceof Qt?this.addPoint(r):r instanceof ve?this.addCollection(r):r instanceof Jr?this.addCollection(r):r instanceof he?this.addCollection(r):r instanceof En&&this.addCollection(r)},Ai.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},Ai.prototype.addCollection=function(r){for(var o=0;o<r.getNumGeometries();o++){var a=r.getGeometryN(o);this.add(a)}},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var mu=function(){};mu.prototype.locate=function(r){},mu.prototype.interfaces_=function(){return[]},mu.prototype.getClass=function(){return mu};var uo=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()};uo.prototype.next=function(){if(this._atStart)return this._atStart=!1,uo.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 uo(r),this._subcollectionIterator.next()):r},uo.prototype.remove=function(){throw new Error(this.getClass().getName())},uo.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)},uo.prototype.interfaces_=function(){return[pt]},uo.prototype.getClass=function(){return uo},uo.isAtomic=function(r){return!(r instanceof En)};var hi=function(){this._geom=null;var r=arguments[0];this._geom=r};hi.prototype.locate=function(r){return hi.locate(r,this._geom)},hi.prototype.interfaces_=function(){return[mu]},hi.prototype.getClass=function(){return hi},hi.isPointInRing=function(r,o){return!!o.getEnvelopeInternal().intersects(r)&&ot.isPointInRing(r,o.getCoordinates())},hi.containsPointInPolygon=function(r,o){if(o.isEmpty())return!1;var a=o.getExteriorRing();if(!hi.isPointInRing(r,a))return!1;for(var l=0;l<o.getNumInteriorRing();l++){var h=o.getInteriorRingN(l);if(hi.isPointInRing(r,h))return!1}return!0},hi.containsPoint=function(r,o){if(o instanceof ne)return hi.containsPointInPolygon(r,o);if(o instanceof En)for(var a=new uo(o);a.hasNext();){var l=a.next();if(l!==o&&hi.containsPoint(r,l))return!0}return!1},hi.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:hi.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,Dt.LEFT)!==V.NONE&&(o=l.getLocation(r,Dt.LEFT))}if(o===V.NONE)return null;for(var h=o,g=this.iterator();g.hasNext();){var w=g.next(),C=w.getLabel();if(C.getLocation(r,Dt.ON)===V.NONE&&C.setLocation(r,Dt.ON,h),C.isArea(r)){var B=C.getLocation(r,Dt.LEFT),K=C.getLocation(r,Dt.RIGHT);if(K!==V.NONE){if(K!==h)throw new Oo("side location conflict",w.getCoordinate());B===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+w.getCoordinate()+")"),h=B}else Pt.isTrue(C.getLocation(r,Dt.LEFT)===V.NONE,"found single null side"),C.setLocation(r,Dt.RIGHT,h),C.setLocation(r,Dt.LEFT,h)}}},mr.prototype.getCoordinate=function(){var r=this.iterator();return r.hasNext()?r.next().getCoordinate():null},mr.prototype.print=function(r){Ft.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,Dt.LEFT);Pt.isTrue(l!==V.NONE,"Found unlabelled area edge");for(var h=l,g=this.iterator();g.hasNext();){var w=g.next().getLabel();Pt.isTrue(w.isArea(r),"Found non-area edge");var C=w.getLocation(r,Dt.LEFT),B=w.getLocation(r,Dt.RIGHT);if(C===B||B!==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]=hi.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 zt=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],g=arguments[1];this.x=h.y*g.w-g.y*h.w,this.y=g.x*h.w-h.x*g.w,this.w=h.x*g.y-g.x*h.y}else if(arguments[0]instanceof P&&arguments[1]instanceof P){var w=arguments[0],C=arguments[1];this.x=w.y-C.y,this.y=C.x-w.x,this.w=w.x*C.y-C.x*w.y}}else if(arguments.length===3){var B=arguments[0],K=arguments[1],gt=arguments[2];this.x=B,this.y=K,this.w=gt}else if(arguments.length===4){var yt=arguments[0],Bt=arguments[1],kt=arguments[2],Jt=arguments[3],ae=yt.y-Bt.y,dn=Bt.x-yt.x,Wn=yt.x*Bt.y-Bt.x*yt.y,Lr=kt.y-Jt.y,go=Jt.x-kt.x,fs=kt.x*Jt.y-Jt.x*kt.y;this.x=dn*fs-go*Wn,this.y=Lr*Wn-ae*fs,this.w=ae*go-Lr*dn}};zt.prototype.getY=function(){var r=this.y/this.w;if(S.isNaN(r)||S.isInfinite(r))throw new $t;return r},zt.prototype.getX=function(){var r=this.x/this.w;if(S.isNaN(r)||S.isInfinite(r))throw new $t;return r},zt.prototype.getCoordinate=function(){var r=new P;return r.x=this.getX(),r.y=this.getY(),r},zt.prototype.interfaces_=function(){return[]},zt.prototype.getClass=function(){return zt},zt.intersection=function(r,o,a,l){var h=r.y-o.y,g=o.x-r.x,w=r.x*o.y-o.x*r.y,C=a.y-l.y,B=l.x-a.x,K=a.x*l.y-l.x*a.y,gt=h*B-C*g,yt=(g*K-B*w)/gt,Bt=(C*w-h*K)/gt;if(S.isNaN(yt)||S.isInfinite(yt)||S.isNaN(Bt)||S.isInfinite(Bt))throw new $t;return new P(yt,Bt)};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 g=arguments[0],w=arguments[1],C=arguments[2],B=arguments[3];this.init(g,w,C,B)}},te={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],g=arguments[1],w=arguments[2],C=arguments[3];h<g?(this._minx=h,this._maxx=g):(this._minx=g,this._maxx=h),w<C?(this._miny=w,this._maxy=C):(this._miny=C,this._maxy=w)}},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[z,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],g=arguments[2],w=arguments[3],C=Math.min(g.x,w.x),B=Math.max(g.x,w.x),K=Math.min(l.x,h.x),gt=Math.max(l.x,h.x);return!(K>B)&&!(gt<C)&&(C=Math.min(g.y,w.y),B=Math.max(g.y,w.y),K=Math.min(l.y,h.y),gt=Math.max(l.y,h.y),!(K>B)&&!(gt<C))}},te.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,te);var $={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*$/},Ot=function(r){this.geometryFactory=r||new ge};Ot.prototype.read=function(r){var o,a,l;r=r.replace(/[\n\r]/g," ");var h=$.typeStr.exec(r);if(r.search("EMPTY")!==-1&&((h=$.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},Ot.prototype.write=function(r){return this.extractGeometry(r)},Ot.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($.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,g=a.length;h<g;++h)o=a[h].replace($.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,g=a.length;h<g;++h)o=a[h].trim().split($.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,g=a.length;h<g;++h)o=a[h].trim().split($.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($.parenComma),l=[],h=0,g=a.length;h<g;++h)o=a[h].replace($.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,g=r.trim().split($.parenComma),w=[],C=0,B=g.length;C<B;++C)o=g[C].replace($.trimParens,"$1"),a=Nt.linestring.apply(this,[o]),l=this.geometryFactory.createLinearRing(a._points),C===0?h=l:w.push(l);return this.geometryFactory.createPolygon(h,w)},multipolygon:function(r){if(r===void 0)return this.geometryFactory.createMultiPolygon();for(var o,a=r.trim().split($.doubleParenComma),l=[],h=0,g=a.length;h<g;++h)o=a[h].replace($.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)}},St=function(r){this.parser=new Ot(r)};St.prototype.write=function(r){return this.parser.write(r)},St.toLineString=function(r,o){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+o.x+" "+o.y+" )"};var Vt=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}(Vt),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 ee=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},X={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ee.prototype.getIndexAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intLineIndex[r][o]},ee.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()},ee.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)},ee.prototype.getIntersectionNum=function(){return this._result},ee.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)}},ee.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ee.prototype.setPrecisionModel=function(r){this._precisionModel=r},ee.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}},ee.prototype.getIntersection=function(r){return this._intPt[r]},ee.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ee.prototype.hasIntersection=function(){return this._result!==ee.NO_INTERSECTION},ee.prototype.getEdgeDistance=function(r,o){return ee.computeEdgeDistance(this._intPt[o],this._inputLines[r][0],this._inputLines[r][1])},ee.prototype.isCollinear=function(){return this._result===ee.COLLINEAR_INTERSECTION},ee.prototype.toString=function(){return St.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+St.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ee.prototype.getEndpoint=function(r,o){return this._inputLines[r][o]},ee.prototype.isIntersection=function(r){for(var o=0;o<this._result;o++)if(this._intPt[o].equals2D(r))return!0;return!1},ee.prototype.getIntersectionAlongSegment=function(r,o){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[r][o]]},ee.prototype.interfaces_=function(){return[]},ee.prototype.getClass=function(){return ee},ee.computeEdgeDistance=function(r,o,a){var l=Math.abs(a.x-o.x),h=Math.abs(a.y-o.y),g=-1;if(r.equals(o))g=0;else if(r.equals(a))g=l>h?l:h;else{var w=Math.abs(r.x-o.x),C=Math.abs(r.y-o.y);(g=l>h?w:C)!==0||r.equals(o)||(g=Math.max(w,C))}return Pt.isTrue(!(g===0&&!r.equals(o)),"Bad distance calculation"),g},ee.nonRobustComputeEdgeDistance=function(r,o,a){var l=r.x-o.x,h=r.y-o.y,g=Math.sqrt(l*l+h*h);return Pt.isTrue(!(g===0&&!r.equals(o)),"Invalid distance calculation"),g},X.DONT_INTERSECT.get=function(){return 0},X.DO_INTERSECT.get=function(){return 1},X.COLLINEAR.get=function(){return 2},X.NO_INTERSECTION.get=function(){return 0},X.POINT_INTERSECTION.get=function(){return 1},X.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ee,X);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,g,w){w.x=this.smallestInAbsValue(a.x,l.x,h.x,g.x),w.y=this.smallestInAbsValue(a.y,l.y,h.y,g.y),a.x-=w.x,a.y-=w.y,l.x-=w.x,l.y-=w.y,h.x-=w.x,h.y-=w.y,g.x-=w.x,g.y-=w.y},o.prototype.safeHCoordinateIntersection=function(a,l,h,g){var w=null;try{w=zt.intersection(a,l,h,g)}catch(C){if(!(C instanceof $t))throw C;w=o.nearestEndpoint(a,l,h,g)}return w},o.prototype.intersection=function(a,l,h,g){var w=this.intersectionWithNormalization(a,l,h,g);return this.isInSegmentEnvelopes(w)||(w=new P(o.nearestEndpoint(a,l,h,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(w),w},o.prototype.smallestInAbsValue=function(a,l,h,g){var w=a,C=Math.abs(w);return Math.abs(l)<C&&(w=l,C=Math.abs(l)),Math.abs(h)<C&&(w=h,C=Math.abs(h)),Math.abs(g)<C&&(w=g),w},o.prototype.checkDD=function(a,l,h,g,w){var C=It.intersection(a,l,h,g),B=this.isInSegmentEnvelopes(C);Ft.out.println("DD in env = "+B+" --------------------- "+C),w.distance(C)>1e-4&&Ft.out.println("Distance = "+w.distance(C))},o.prototype.intersectionWithNormalization=function(a,l,h,g){var w=new P(a),C=new P(l),B=new P(h),K=new P(g),gt=new P;this.normalizeToEnvCentre(w,C,B,K,gt);var yt=this.safeHCoordinateIntersection(w,C,B,K);return yt.x+=gt.x,yt.y+=gt.y,yt},o.prototype.computeCollinearIntersection=function(a,l,h,g){var w=Ct.intersects(a,l,h),C=Ct.intersects(a,l,g),B=Ct.intersects(h,g,a),K=Ct.intersects(h,g,l);return w&&C?(this._intPt[0]=h,this._intPt[1]=g,r.COLLINEAR_INTERSECTION):B&&K?(this._intPt[0]=a,this._intPt[1]=l,r.COLLINEAR_INTERSECTION):w&&B?(this._intPt[0]=h,this._intPt[1]=a,!h.equals(a)||C||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):w&&K?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||C||B?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&B?(this._intPt[0]=g,this._intPt[1]=a,!g.equals(a)||w||K?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):C&&K?(this._intPt[0]=g,this._intPt[1]=l,!g.equals(l)||w||B?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):r.NO_INTERSECTION},o.prototype.normalizeToEnvCentre=function(a,l,h,g,w){var C=a.x<l.x?a.x:l.x,B=a.y<l.y?a.y:l.y,K=a.x>l.x?a.x:l.x,gt=a.y>l.y?a.y:l.y,yt=h.x<g.x?h.x:g.x,Bt=h.y<g.y?h.y:g.y,kt=h.x>g.x?h.x:g.x,Jt=h.y>g.y?h.y:g.y,ae=((C>yt?C:yt)+(K<kt?K:kt))/2,dn=((B>Bt?B:Bt)+(gt<Jt?gt:Jt))/2;w.x=ae,w.y=dn,a.x-=w.x,a.y-=w.y,l.x-=w.x,l.y-=w.y,h.x-=w.x,h.y-=w.y,g.x-=w.x,g.y-=w.y},o.prototype.computeIntersect=function(a,l,h,g){if(this._isProper=!1,!Ct.intersects(a,l,h,g))return r.NO_INTERSECTION;var w=ot.orientationIndex(a,l,h),C=ot.orientationIndex(a,l,g);if(w>0&&C>0||w<0&&C<0)return r.NO_INTERSECTION;var B=ot.orientationIndex(h,g,a),K=ot.orientationIndex(h,g,l);return B>0&&K>0||B<0&&K<0?r.NO_INTERSECTION:w===0&&C===0&&B===0&&K===0?this.computeCollinearIntersection(a,l,h,g):(w===0||C===0||B===0||K===0?(this._isProper=!1,a.equals2D(h)||a.equals2D(g)?this._intPt[0]=a:l.equals2D(h)||l.equals2D(g)?this._intPt[0]=l:w===0?this._intPt[0]=new P(h):C===0?this._intPt[0]=new P(g):B===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,g)),r.POINT_INTERSECTION)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.nearestEndpoint=function(a,l,h,g){var w=a,C=ot.distancePointLine(a,h,g),B=ot.distancePointLine(l,h,g);return B<C&&(C=B,w=l),(B=ot.distancePointLine(h,a,l))<C&&(C=B,w=h),(B=ot.distancePointLine(g,a,l))<C&&(C=B,w=g),w},o}(ee),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,g=a.x-o.x,w=a.y-o.y;return xt.signOfDet2x2(l,h,g,w)},xt.signOfDet2x2=function(r,o,a,l){var h=null,g=null,w=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,g=r,r=a,a=g,g=o,o=l,l=g):o<=-l?(h=-h,a=-a,l=-l):(g=r,r=-a,a=g,g=o,o=-l,l=g):l>0?-o<=l?(h=-h,r=-r,o=-o):(g=-r,r=a,a=g,g=-o,o=l,l=g):o>=l?(r=-r,o=-o,a=-a,l=-l):(h=-h,g=-r,r=-a,a=g,g=-o,o=-l,l=g),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(w=Math.floor(a/r),a-=w*r,(l-=w*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||(w=Math.floor(r/a),r-=w*a,(o-=w*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 wt=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var r=arguments[0];this._p=r};wt.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,g=r.y-this._p.y,w=o.x-this._p.x,C=o.y-this._p.y,B=xt.signOfDet2x2(h,g,w,C);if(B===0)return this._isPointOnSegment=!0,null;C<g&&(B=-B),B>0&&this._crossingCount++}},wt.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},wt.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},wt.prototype.isOnSegment=function(){return this._isPointOnSegment},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt},wt.locatePointInRing=function(){if(arguments[0]instanceof P&&Y(arguments[1],nt)){for(var r=arguments[0],o=arguments[1],a=new wt(r),l=new P,h=new P,g=1;g<o.size();g++)if(o.getCoordinate(g,l),o.getCoordinate(g-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 w=arguments[0],C=arguments[1],B=new wt(w),K=1;K<C.length;K++){var gt=C[K],yt=C[K-1];if(B.countSegment(gt,yt),B.isOnSegment())return B.getLocation()}return B.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,g=r[l+1].y;o+=h*(r[l-1].y-g)}return o/2}if(Y(arguments[0],nt)){var w=arguments[0],C=w.size();if(C<3)return 0;var B=new P,K=new P,gt=new P;w.getCoordinate(0,K),w.getCoordinate(1,gt);var yt=K.x;gt.x-=yt;for(var Bt=0,kt=1;kt<C-1;kt++)B.y=K.y,K.x=gt.x,K.y=gt.y,w.getCoordinate(kt+1,gt),gt.x-=yt,Bt+=K.x*(B.y-gt.y);return Bt/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 g=(o.x-r.x)*(l.y-a.y)-(o.y-r.y)*(l.x-a.x);if(g===0)h=!0;else{var w=(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))/g,B=w/g;(B<0||B>1||C<0||C>1)&&(h=!0)}}else h=!0;return h?mt.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,g=l.y,w=1;w<o;w++){r.getCoordinate(w,l);var C=l.x,B=l.y,K=C-h,gt=B-g;a+=Math.sqrt(K*K+gt*gt),h=C,g=B}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 g=r[h];g.y>a.y&&(a=g,l=h)}var w=l;do(w-=1)<0&&(w=o);while(r[w].equals2D(a)&&w!==l);var C=l;do C=(C+1)%o;while(r[C].equals2D(a)&&C!==l);var B=r[w],K=r[C];if(B.equals2D(a)||K.equals2D(a)||B.equals2D(K))return!1;var gt=ot.computeOrientation(B,a,K),yt=!1;return yt=gt===0?B.x>K.x:gt>0,yt},ot.locatePointInRing=function(r,o){return wt.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 g=arguments[0],w=arguments[1],C=arguments[2];if(w.x===C.x&&w.y===C.y)return g.distance(w);var B=(C.x-w.x)*(C.x-w.x)+(C.y-w.y)*(C.y-w.y),K=((g.x-w.x)*(C.x-w.x)+(g.y-w.y)*(C.y-w.y))/B;if(K<=0)return g.distance(w);if(K>=1)return g.distance(C);var gt=((w.y-g.y)*(C.x-w.x)-(w.x-g.x)*(C.y-w.y))/B;return Math.abs(gt)*Math.sqrt(B)}},ot.isOnLine=function(r,o){for(var a=new N,l=1;l<o.length;l++){var h=o[l-1],g=o[l];if(a.computeIntersection(r,h,g),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()},Ut={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(),g=l.next(),w=h.compareTo(g);if(w!==0)return w}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,z,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},Ut.serialVersionUID.get=function(){return 8763622679187377e3},Ut.SORTINDEX_POINT.get=function(){return 0},Ut.SORTINDEX_MULTIPOINT.get=function(){return 1},Ut.SORTINDEX_LINESTRING.get=function(){return 2},Ut.SORTINDEX_LINEARRING.get=function(){return 3},Ut.SORTINDEX_MULTILINESTRING.get=function(){return 4},Ut.SORTINDEX_POLYGON.get=function(){return 5},Ut.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Ut.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Ut.geometryChangedFilter.get=function(){return Wt},Object.defineProperties(Rt,Ut);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,g=this.array_.length;h<g;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],g=arguments[1];this.ensureCapacity(h.length),this.add(h,g)}}}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],g=!1,w=l.iterator();w.hasNext();)this.add(w.next(),h),g=!0;return g}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],g=arguments[1];return this.add(h,g,!0),!0}if(arguments[0]instanceof P&&typeof arguments[1]=="boolean"){var w=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(w))return null;r.prototype.add.call(this,w)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var C=arguments[0],B=arguments[1];return this.add(C,B),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var K=arguments[0],gt=arguments[1];if(arguments[2])for(var yt=0;yt<K.length;yt++)this.add(K[yt],gt);else for(var Bt=K.length-1;Bt>=0;Bt--)this.add(K[Bt],gt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof P){var kt=arguments[0],Jt=arguments[1];if(!arguments[2]){var ae=this.size();if(ae>0&&(kt>0&&this.get(kt-1).equals2D(Jt)||kt<ae&&this.get(kt).equals2D(Jt)))return null}r.prototype.add.call(this,kt,Jt)}}else if(arguments.length===4){var dn=arguments[0],Wn=arguments[1],Lr=arguments[2],go=arguments[3],fs=1;Lr>go&&(fs=-1);for(var em=Lr;em!==go;em+=fs)this.add(dn[em],Wn);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 Gt},Tt.BidirectionalComparator.get=function(){return re},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);Ft.arraycopy(r,a,l,0,r.length-a),Ft.arraycopy(r,0,l,r.length-a,a),Ft.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],g=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var w=0;w<l.length;w++)if(g.compare(l[w],h[w])!==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,g=0;g<r.length;g++)r[g]!==null&&(l[h++]=r[g]);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],g=arguments[2],w=arguments[3],C=arguments[4],B=0;B<C;B++)g[w+B]=new P(l[h+B])},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=mt.clamp(o,0,r.length);var l=(a=mt.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 g=0,w=o;w<=a;w++)h[g++]=r[w];return h},Object.defineProperties(et,Tt);var Gt=function(){};Gt.prototype.compare=function(r,o){return et.compare(r,o)},Gt.prototype.interfaces_=function(){return[D]},Gt.prototype.getClass=function(){return Gt};var re=function(){};re.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},re.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),g=et.increasingDirection(l),w=h>0?0:a.length-1,C=g>0?0:a.length-1,B=0;B<a.length;B++){var K=a[w].compareTo(l[C]);if(K!==0)return K;w+=h,C+=g}return 0},re.prototype.interfaces_=function(){return[D]},re.prototype.getClass=function(){return re};var ie=function(){};ie.prototype.get=function(){},ie.prototype.put=function(){},ie.prototype.size=function(){},ie.prototype.values=function(){},ie.prototype.entrySet=function(){};var Se=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}(ie);(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 Se).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 g=h.value;return h.value=o,g}h=h.right}while(h!==null);var w={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=w:a.right=w,this.fixAfterInsertion(w),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=m(f(f(r)));c(o)===1?(p(f(r),Ae),p(o,Ae),p(f(f(r)),1),r=f(f(r))):(r===m(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 On=function(){};On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},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 pr(this)};var pr=function(r){this.treeSet_=r,this.position_=0};pr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new i;return this.treeSet_.array_[this.position_++]},pr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},pr.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(w,C){return w.compareTo(C)},h.sort(l);else if(arguments.length===2)a=arguments[1],l=function(w,C){return a.compare(w,C)},h.sort(l);else if(arguments.length===3){(o=h.slice(arguments[1],arguments[2])).sort();var g=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length));for(h.splice(0,h.length),r=0;r<g.length;r++)h.push(g[r])}else if(arguments.length===4)for(o=h.slice(arguments[1],arguments[2]),a=arguments[3],l=function(w,C){return a.compare(w,C)},o.sort(l),g=h.slice(0,arguments[1]).concat(o,h.slice(arguments[2],h.length)),h.splice(0,h.length),r=0;r<g.length;r++)h.push(g[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 Rn=function(){};Rn.prototype.filter=function(r){},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn};var Tn=function(){};Tn.prototype.filter=function(r,o){},Tn.prototype.isDone=function(){},Tn.prototype.isGeometryChanged=function(){},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn};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,g=0;g<this._geometries.length;g++)for(var w=this._geometries[g].getCoordinates(),C=0;C<w.length;C++)l[++h]=w[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 g=l;if(this._geometries.length!==g._geometries.length)return!1;for(var w=0;w<this._geometries.length;w++)if(!this._geometries[w].equalsExact(g._geometries[w],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),g=0;g<this._geometries.length;g++)h[g]=this._geometries[g].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)),g=new E(_n.asList(l._geometries));return this.compare(h,g)}if(arguments.length===2){for(var w=arguments[0],C=arguments[1],B=w,K=this.getNumGeometries(),gt=B.getNumGeometries(),yt=0;yt<K&&yt<gt;){var Bt=this.getGeometryN(yt),kt=B.getGeometryN(yt),Jt=Bt.compareToSameClass(kt,C);if(Jt!==0)return Jt;yt++}return yt<K?1:yt<gt?-1:0}},o.prototype.apply=function(){if(Y(arguments[0],j))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if(Y(arguments[0],Tn)){var g=arguments[0];if(this._geometries.length===0)return null;for(var w=0;w<this._geometries.length&&(this._geometries[w].apply(g),!g.isDone());w++);g.isGeometryChanged()&&this.geometryChanged()}else if(Y(arguments[0],Rn)){var C=arguments[0];C.filter(this);for(var B=0;B<this._geometries.length;B++)this._geometries[B].apply(C)}else if(Y(arguments[0],ce)){var K=arguments[0];K.filter(this);for(var gt=0;gt<this._geometries.length;gt++)this._geometries[gt].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),Jr=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),g=0;g<this._geometries.length;g++)h[l-1-g]=this._geometries[g].reverse();return this.getFactory().createMultiLineString(h)},o.prototype.getBoundary=function(){return new Sr(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[On]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(o,a),o}(En),Sr=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}};Sr.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)},Sr.prototype.getBoundary=function(){return this._geom instanceof ut?this.boundaryLineString(this._geom):this._geom instanceof Jr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Sr.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()])},Sr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Sr.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 g=h.next(),w=g.getValue().count;this._bnRule.isInBoundary(w)&&o.add(g.getKey())}return et.toCoordinateArray(o)},Sr.prototype.addEndpoint=function(r){var o=this._endpointMap.get(r);o===null&&(o=new q,this._endpointMap.put(r,o)),o.count++},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.getBoundary=function(){if(arguments.length===1){var r=arguments[0];return new Sr(r).getBoundary()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new Sr(o,a).getBoundary()}};var q=function(){this.count=null};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q};var st=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(r,o){for(var a=new Array(o).fill(null),l=0;l<o;l++)a[l]=r;return String(a)},st.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],g="",w=new function(){}(new function(){}(st.getStackTrace(l))),C=0;C<h;C++)try{g+=w.readLine()+st.NEWLINE}catch(B){if(!(B instanceof M))throw B;Pt.shouldNeverReachHere()}return g}},st.split=function(r,o){for(var a=o.length,l=new O,h=""+r,g=h.indexOf(o);g>=0;){var w=h.substring(0,g);l.add(w),g=(h=h.substring(g+a)).indexOf(o)}h.length>0&&l.add(h);for(var C=new Array(l.size()).fill(null),B=0;B<C.length;B++)C[B]=l.get(B);return C},st.toString=function(){if(arguments.length===1){var r=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(r)}},st.spaces=function(r){return st.chars(" ",r)},Et.NEWLINE.get=function(){return Ft.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,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()),g=0;g<h;g++)a.setOrdinate(l,g,r.getOrdinate(o,g))},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 g=0;g<l;g++){var w=r.getOrdinate(h,g),C=o.getOrdinate(h,g);if(r.getOrdinate(h,g)!==o.getOrdinate(h,g)&&(!S.isNaN(w)||!S.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 g=h;g<a;g++)dt.copy(o,h-1,l,g,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 g=0;g<h;g++)dt.copyCoord(r,o+g,a,l+g)},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 g=0;g<a;g++)g>0&&l.append(","),l.append(st.toString(r.getOrdinate(h,g)))}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 g=h;g<a;g++)dt.copy(o,0,l,g,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 g=l;if(this._points.size()!==g._points.size())return!1;for(var w=0;w<this._points.size();w++)if(!this.equal(this._points.getCoordinate(w),g._points.getCoordinate(w),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,g=0;h<this._points.size()&&g<l._points.size();){var w=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(g));if(w!==0)return w;h++,g++}return h<this._points.size()?1:g<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(Y(arguments[0],j))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if(Y(arguments[0],Tn)){var g=arguments[0];if(this._points.size()===0)return null;for(var w=0;w<this._points.size()&&(g.filter(this._points,w),!g.isDone());w++);g.isGeometryChanged()&&this.geometryChanged()}else Y(arguments[0],Rn)?arguments[0].filter(this):Y(arguments[0],ce)&&arguments[0].filter(this)},o.prototype.getBoundary=function(){return new Sr(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[On]},o.prototype.getClass=function(){return o},a.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(o,a),o}(Rt),Kt=function(){};Kt.prototype.interfaces_=function(){return[]},Kt.prototype.getClass=function(){return Kt};var Qt=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(Y(arguments[0],j)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if(Y(arguments[0],Tn)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else Y(arguments[0],Rn)?arguments[0].filter(this):Y(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[Kt]},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 ne=function(r){function o(l,h,g){if(r.call(this,g),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,g=this._shell.getCoordinates(),w=0;w<g.length;w++)l[++h]=g[w];for(var C=0;C<this._holes.length;C++)for(var B=this._holes[C].getCoordinates(),K=0;K<B.length;K++)l[++h]=B[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(),g=0;g<5;g++){var w=l.getX(g);if(w!==h.getMinX()&&w!==h.getMaxX())return!1;var C=l.getY(g);if(C!==h.getMinY()&&C!==h.getMaxY())return!1}for(var B=l.getX(0),K=l.getY(0),gt=1;gt<=4;gt++){var yt=l.getX(gt),Bt=l.getY(gt);if(yt!==B==(Bt!==K))return!1;B=yt,K=Bt}return!0},o.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var g=l,w=this._shell,C=g._shell;if(!w.equalsExact(C,h)||this._holes.length!==g._holes.length)return!1;for(var B=0;B<this._holes.length;B++)if(!this._holes[B].equalsExact(g._holes[B],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],g=arguments[1];if(h.isEmpty())return null;var w=new Array(h.getCoordinates().length-1).fill(null);Ft.arraycopy(h.getCoordinates(),0,w,0,w.length);var C=et.minCoordinate(h.getCoordinates());et.scroll(w,C),Ft.arraycopy(w,0,h.getCoordinates(),0,w.length),h.getCoordinates()[w.length]=w[0],ot.isCCW(h.getCoordinates())===g&&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,g=l._shell;return h.compareToSameClass(g)}if(arguments.length===2){var w=arguments[0],C=arguments[1],B=w,K=this._shell,gt=B._shell,yt=K.compareToSameClass(gt,C);if(yt!==0)return yt;for(var Bt=this.getNumInteriorRing(),kt=B.getNumInteriorRing(),Jt=0;Jt<Bt&&Jt<kt;){var ae=this.getInteriorRingN(Jt),dn=B.getInteriorRingN(Jt),Wn=ae.compareToSameClass(dn,C);if(Wn!==0)return Wn;Jt++}return Jt<Bt?1:Jt<kt?-1:0}},o.prototype.apply=function(l){if(Y(l,j)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if(Y(l,Tn)){if(this._shell.apply(l),!l.isDone())for(var g=0;g<this._holes.length&&(this._holes[g].apply(l),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else if(Y(l,Rn))l.filter(this);else if(Y(l,ce)){l.filter(this),this._shell.apply(l);for(var w=0;w<this._holes.length;w++)this._holes[w].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),g=0;g<h.length;g++)h[g]=this._holes[g].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[Kt]},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 ge&&(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),g=0;g<this._geometries.length;g++)h[g]=this._geometries[g].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 g=this._geometries[h].getBoundary(),w=0;w<g.getNumGeometries();w++)l.add(g.getGeometryN(w));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),ln=function(r){this._factory=r||null,this._isUserDataCopied=!1},Mr={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};ln.prototype.setCopyUserData=function(r){this._isUserDataCopied=r},ln.prototype.edit=function(r,o){if(r===null)return null;var a=this.editInternal(r,o);return this._isUserDataCopied&&a.setUserData(r.getUserData()),a},ln.prototype.editInternal=function(r,o){return this._factory===null&&(this._factory=r.getFactory()),r instanceof En?this.editGeometryCollection(r,o):r instanceof ne?this.editPolygon(r,o):r instanceof Qt?o.edit(r,this._factory):r instanceof ut?o.edit(r,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+r.getClass().getName()),null)},ln.prototype.editGeometryCollection=function(r,o){for(var a=o.edit(r,this._factory),l=new O,h=0;h<a.getNumGeometries();h++){var g=this.edit(a.getGeometryN(h),o);g===null||g.isEmpty()||l.add(g)}return a.getClass()===ve?this._factory.createMultiPoint(l.toArray([])):a.getClass()===Jr?this._factory.createMultiLineString(l.toArray([])):a.getClass()===he?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},ln.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,g=0;g<a.getNumInteriorRing();g++){var w=this.edit(a.getInteriorRingN(g),o);w===null||w.isEmpty()||h.add(w)}return this._factory.createPolygon(l,h.toArray([]))},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.GeometryEditorOperation=function(){},Mr.NoOpGeometryOperation.get=function(){return kn},Mr.CoordinateOperation.get=function(){return ai},Mr.CoordinateSequenceOperation.get=function(){return Sn},Object.defineProperties(ln,Mr);var kn=function(){};kn.prototype.edit=function(r,o){return r},kn.prototype.interfaces_=function(){return[ln.GeometryEditorOperation]},kn.prototype.getClass=function(){return kn};var ai=function(){};ai.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 Qt?a.length>0?o.createPoint(a[0]):o.createPoint():r},ai.prototype.interfaces_=function(){return[ln.GeometryEditorOperation]},ai.prototype.getClass=function(){return ai};var Sn=function(){};Sn.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 Qt?o.createPoint(this.edit(r.getCoordinateSequence(),r)):r},Sn.prototype.interfaces_=function(){return[ln.GeometryEditorOperation]},Sn.prototype.getClass=function(){return Sn};var oe=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(Y(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],g=arguments[1];this._coordinates=h,this._dimension=g,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var w=arguments[0],C=arguments[1];this._coordinates=new Array(w).fill(null),this._dimension=C;for(var B=0;B<w;B++)this._coordinates[B]=new P}}},cu={serialVersionUID:{configurable:!0}};oe.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")}},oe.prototype.size=function(){return this._coordinates.length},oe.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 S.NaN},oe.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}},oe.prototype.getCoordinateCopy=function(r){return new P(this._coordinates[r])},oe.prototype.getDimension=function(){return this._dimension},oe.prototype.getX=function(r){return this._coordinates[r].x},oe.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 oe(r,this._dimension)},oe.prototype.expandEnvelope=function(r){for(var o=0;o<this._coordinates.length;o++)r.expandToInclude(this._coordinates[o]);return r},oe.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 oe(r,this._dimension)},oe.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"()"},oe.prototype.getY=function(r){return this._coordinates[r].y},oe.prototype.toCoordinateArray=function(){return this._coordinates},oe.prototype.interfaces_=function(){return[nt,t]},oe.prototype.getClass=function(){return oe},cu.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(oe,cu);var cn=function(){},oo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};cn.prototype.readResolve=function(){return cn.instance()},cn.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new oe(r)}if(Y(arguments[0],nt)){var o=arguments[0];return new oe(o)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new oe(a):new oe(a,l)}},cn.prototype.interfaces_=function(){return[W,t]},cn.prototype.getClass=function(){return cn},cn.instance=function(){return cn.instanceObject},oo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},oo.instanceObject.get=function(){return new cn},Object.defineProperties(cn,oo);var Wl=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}(ie),_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}}},ga={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 S.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,z]},_e.prototype.getClass=function(){return _e},_e.mostPrecise=function(r,o){return r.compareTo(o)>=0?r:o},ga.serialVersionUID.get=function(){return 7777263578777804e3},ga.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(_e,ga);var Mn=function r(o){this._name=o||null,r.nameToTypeMap.put(o,this)},so={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},so.serialVersionUID.get=function(){return-552860263173159e4},so.nameToTypeMap.get=function(){return new Wl},Object.defineProperties(Mn,so),_e.Type=Mn,_e.FIXED=new Mn("FIXED"),_e.FLOATING=new Mn("FLOATING"),_e.FLOATING_SINGLE=new Mn("FLOATING SINGLE");var ge=function r(){this._precisionModel=new _e,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Y(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]))},ui={serialVersionUID:{configurable:!0}};ge.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)},ge.prototype.createLineString=function(r){return r?r instanceof Array?new ut(this.getCoordinateSequenceFactory().create(r),this):Y(r,nt)?new ut(r,this):void 0:new ut(this.getCoordinateSequenceFactory().create([]),this)},ge.prototype.createMultiLineString=function(){if(arguments.length===0)return new Jr(null,this);if(arguments.length===1){var r=arguments[0];return new Jr(r,this)}},ge.prototype.buildGeometry=function(r){for(var o=null,a=!1,l=!1,h=r.iterator();h.hasNext();){var g=h.next(),w=g.getClass();o===null&&(o=w),w!==o&&(a=!0),g.isGeometryCollectionOrDerived()&&(l=!0)}if(o===null)return this.createGeometryCollection();if(a||l)return this.createGeometryCollection(ge.toGeometryArray(r));var C=r.iterator().next();if(r.size()>1){if(C instanceof ne)return this.createMultiPolygon(ge.toPolygonArray(r));if(C instanceof ut)return this.createMultiLineString(ge.toLineStringArray(r));if(C instanceof Qt)return this.createMultiPoint(ge.toPointArray(r));Pt.shouldNeverReachHere("Unhandled class: "+C.getClass().getName())}return C},ge.prototype.createMultiPointFromCoords=function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)},ge.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(Y(arguments[0],nt)){var o=arguments[0];return new Qt(o,this)}}},ge.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ge.prototype.createPolygon=function(){if(arguments.length===0)return new ne(null,null,this);if(arguments.length===1){if(Y(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 ne(l,h,this)}},ge.prototype.getSRID=function(){return this._SRID},ge.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)}},ge.prototype.createGeometry=function(r){return new ln(this).edit(r,{edit:function(){if(arguments.length===2){var o=arguments[0];return this._coordinateSequenceFactory.create(o)}}})},ge.prototype.getPrecisionModel=function(){return this._precisionModel},ge.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(Y(arguments[0],nt)){var o=arguments[0];return new fe(o,this)}}},ge.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)}},ge.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(Y(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 g=this.getCoordinateSequenceFactory().create(1,a.getDimension());dt.copy(a,h,g,0,1),l[h]=this.createPoint(g)}return this.createMultiPoint(l)}}},ge.prototype.interfaces_=function(){return[t]},ge.prototype.getClass=function(){return ge},ge.toMultiPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toGeometryArray=function(r){if(r===null)return null;var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.getDefaultCoordinateSequenceFactory=function(){return cn.instance()},ge.toMultiLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toLineStringArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toMultiPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toLinearRingArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toPointArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.toPolygonArray=function(r){var o=new Array(r.size()).fill(null);return r.toArray(o)},ge.createPointFromInternalCoord=function(r,o){return o.getPrecisionModel().makePrecise(r),o.getFactory().createPoint(r)},ui.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(ge,ui);var Xl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],fu=function(r){this.geometryFactory=r||new ge};fu.prototype.read=function(r){var o,a=(o=typeof r=="string"?JSON.parse(r):r).type;if(!li[a])throw new Error("Unknown GeoJSON type: "+o.type);return Xl.indexOf(a)!==-1?li[a].apply(this,[o.coordinates]):a==="GeometryCollection"?li[a].apply(this,[o.geometries]):li[a].apply(this,[o])},fu.prototype.write=function(r){var o=r.getGeometryType();if(!No[o])throw new Error("Geometry is not supported");return No[o].apply(this,[r])};var li={Feature:function(r){var o={};for(var a in r)o[a]=r[a];if(r.geometry){var l=r.geometry.type;if(!li[l])throw new Error("Unknown GeoJSON type: "+r.type);o.geometry=this.read(r.geometry)}return r.bbox&&(o.bbox=li.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(li.Point.apply(this,[r[a]]));return this.geometryFactory.createMultiPoint(o)},LineString:function(r){var o=li.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(o)},MultiLineString:function(r){for(var o=[],a=0;a<r.length;++a)o.push(li.LineString.apply(this,[r[a]]));return this.geometryFactory.createMultiLineString(o)},Polygon:function(r){for(var o=li.coordinates.apply(this,[r[0]]),a=this.geometryFactory.createLinearRing(o),l=[],h=1;h<r.length;++h){var g=r[h],w=li.coordinates.apply(this,[g]),C=this.geometryFactory.createLinearRing(w);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(li.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)}},No={coordinate:function(r){return[r.x,r.y]},Point:function(r){return{type:"Point",coordinates:No.coordinate.apply(this,[r.getCoordinate()])}},MultiPoint:function(r){for(var o=[],a=0;a<r._geometries.length;++a){var l=r._geometries[a],h=No.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(No.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=No.LineString.apply(this,[l]);o.push(h.coordinates)}return{type:"MultiLineString",coordinates:o}},Polygon:function(r){var o=[],a=No.LineString.apply(this,[r._shell]);o.push(a.coordinates);for(var l=0;l<r._holes.length;++l){var h=r._holes[l],g=No.LineString.apply(this,[h]);o.push(g.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=No.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(No[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:o}}},Wd=function(r){this.geometryFactory=r||new ge,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new fu(this.geometryFactory)};Wd.prototype.read=function(r){var o=this.parser.read(r);return this.precisionModel.getType()===_e.FIXED&&this.reducePrecision(o),o},Wd.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 _x=function(){this.parser=new fu(this.geometryFactory)};_x.prototype.write=function(r){return this.parser.write(r)};var Dt=function(){},wf={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Dt.prototype.interfaces_=function(){return[]},Dt.prototype.getClass=function(){return Dt},Dt.opposite=function(r){return r===Dt.LEFT?Dt.RIGHT:r===Dt.RIGHT?Dt.LEFT:r},wf.ON.get=function(){return 0},wf.LEFT.get=function(){return 1},wf.RIGHT.get=function(){return 2},Object.defineProperties(Dt,wf),(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 Xi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Xi.prototype.getCoordinate=function(){return this._minCoord},Xi.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},Xi.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)},Xi.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=Dt.LEFT;return a[o].y<a[o+1].y&&(l=Dt.RIGHT),l},Xi.prototype.getEdge=function(){return this._orientedDe},Xi.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])},Xi.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)},Xi.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)===Dt.LEFT&&(this._orientedDe=this._minDe.getSym())},Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi};var Oo=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}(Vt),Sf=function(){this.array_=[]};Sf.prototype.addLast=function(r){this.array_.push(r)},Sf.prototype.removeFirst=function(){return this.array_.shift()},Sf.prototype.isEmpty=function(){return this.array_.length===0};var br=function(){this._finder=null,this._dirEdgeList=new O,this._nodes=new O,this._rightMostCoord=null,this._env=null,this._finder=new Xi};br.prototype.clearVisitedEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();)r.next().setVisited(!1)},br.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},br.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 Oo("unable to find edge to compute depths at "+r.getCoordinate());r.getEdges().computeDepths(o);for(var h=r.getEdges().iterator();h.hasNext();){var g=h.next();g.setVisited(!0),this.copySymDepths(g)}},br.prototype.computeDepth=function(r){this.clearVisitedEdges();var o=this._finder.getEdge();o.setEdgeDepths(Dt.RIGHT,r),this.copySymDepths(o),this.computeDepths(o)},br.prototype.create=function(r){this.addReachable(r),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},br.prototype.findResultEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();){var o=r.next();o.getDepth(Dt.RIGHT)>=1&&o.getDepth(Dt.LEFT)<=0&&!o.isInteriorAreaEdge()&&o.setInResult(!0)}},br.prototype.computeDepths=function(r){var o=new ye,a=new Sf,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 g=h.getEdges().iterator();g.hasNext();){var w=g.next().getSym();if(!w.isVisited()){var C=w.getNode();o.contains(C)||(a.addLast(C),o.add(C))}}}},br.prototype.compareTo=function(r){var o=r;return this._rightMostCoord.x<o._rightMostCoord.x?-1:this._rightMostCoord.x>o._rightMostCoord.x?1:0},br.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},br.prototype.addReachable=function(r){var o=new _;for(o.add(r);!o.empty();){var a=o.pop();this.add(a,o)}},br.prototype.copySymDepths=function(r){var o=r.getSym();o.setDepth(Dt.LEFT,r.getDepth(Dt.RIGHT)),o.setDepth(Dt.RIGHT,r.getDepth(Dt.LEFT))},br.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)}},br.prototype.getNodes=function(){return this._nodes},br.prototype.getDirectedEdges=function(){return this._dirEdgeList},br.prototype.interfaces_=function(){return[z]},br.prototype.getClass=function(){return br};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[Dt.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 g=arguments[0],w=arguments[1],C=arguments[2];this.init(3),this.location[Dt.ON]=g,this.location[Dt.LEFT]=w,this.location[Dt.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[Dt.ON]=this.location[Dt.ON],o[Dt.LEFT]=V.NONE,o[Dt.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[Dt.LEFT];this.location[Dt.LEFT]=this.location[Dt.RIGHT],this.location[Dt.RIGHT]=r},vn.prototype.toString=function(){var r=new vt;return this.location.length>1&&r.append(V.toLocationSymbol(this.location[Dt.LEFT])),r.append(V.toLocationSymbol(this.location[Dt.ON])),this.location.length>1&&r.append(V.toLocationSymbol(this.location[Dt.RIGHT])),r.toString()},vn.prototype.setLocations=function(r,o,a){this.location[Dt.ON]=r,this.location[Dt.LEFT]=o,this.location[Dt.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(Dt.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 g=arguments[0],w=arguments[1],C=arguments[2];this.elt[0]=new vn(g,w,C),this.elt[1]=new vn(g,w,C)}else if(arguments.length===4){var B=arguments[0],K=arguments[1],gt=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[B].setLocations(K,gt,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(Dt.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(Dt.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 qn=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()};qn.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())},qn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},qn.prototype.computePoints=function(r){this._startDe=r;var o=r,a=!0;do{if(o===null)throw new Oo("Found null DirectedEdge");if(o.getEdgeRing()===this)throw new Oo("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)},qn.prototype.getLinearRing=function(){return this._ring},qn.prototype.getCoordinate=function(r){return this._pts.get(r)},qn.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},qn.prototype.addPoints=function(r,o,a){var l=r.getCoordinates();if(o){var h=1;a&&(h=0);for(var g=h;g<l.length;g++)this._pts.add(l[g])}else{var w=l.length-2;a&&(w=l.length-1);for(var C=w;C>=0;C--)this._pts.add(l[C])}},qn.prototype.isHole=function(){return this._isHole},qn.prototype.setInResult=function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)},qn.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},qn.prototype.addHole=function(r){this._holes.add(r)},qn.prototype.isShell=function(){return this._shell===null},qn.prototype.getLabel=function(){return this._label},qn.prototype.getEdges=function(){return this._edges},qn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},qn.prototype.getShell=function(){return this._shell},qn.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,Dt.RIGHT);if(l===V.NONE)return null;if(this._label.getLocation(a)===V.NONE)return this._label.setLocation(a,l),null}},qn.prototype.setShell=function(r){this._shell=r,r!==null&&r.addHole(this)},qn.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)},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var s2=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}(qn),a2=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 s2(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}(qn),ci=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}}};ci.prototype.setVisited=function(r){this._isVisited=r},ci.prototype.setInResult=function(r){this._isInResult=r},ci.prototype.isCovered=function(){return this._isCovered},ci.prototype.isCoveredSet=function(){return this._isCoveredSet},ci.prototype.setLabel=function(r){this._label=r},ci.prototype.getLabel=function(){return this._label},ci.prototype.setCovered=function(r){this._isCovered=r,this._isCoveredSet=!0},ci.prototype.updateIM=function(r){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(r)},ci.prototype.isInResult=function(){return this._isInResult},ci.prototype.isVisited=function(){return this._isVisited},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var Mf=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 g=a.getLocation(l);h!==V.BOUNDARY&&(h=g)}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 g=this.computeMergedLocation(l,h);this._label.getLocation(h)===V.NONE&&this._label.setLocation(h,g)}},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}(ci),Yi=function(){this.nodeMap=new y,this.nodeFact=null;var r=arguments[0];this.nodeFact=r};Yi.prototype.find=function(r){return this.nodeMap.get(r)},Yi.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 Mf){var a=arguments[0],l=this.nodeMap.get(a.getCoordinate());return l===null?(this.nodeMap.put(a.getCoordinate(),a),a):(l.mergeLabel(a),l)}},Yi.prototype.print=function(r){for(var o=this.iterator();o.hasNext();)o.next().print(r)},Yi.prototype.iterator=function(){return this.nodeMap.values().iterator()},Yi.prototype.values=function(){return this.nodeMap.values()},Yi.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},Yi.prototype.add=function(r){var o=r.getCoordinate();this.addNode(o).add(r)},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi};var mn=function(){},Yl={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}},Yl.NE.get=function(){return 0},Yl.NW.get=function(){return 1},Yl.SW.get=function(){return 2},Yl.SE.get=function(){return 3},Object.defineProperties(mn,Yl);var dr=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],g=arguments[1],w=arguments[2],C=arguments[3];this._edge=h,this.init(g,w),this._label=C}};dr.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)},dr.prototype.getDy=function(){return this._dy},dr.prototype.getCoordinate=function(){return this._p0},dr.prototype.setNode=function(r){this._node=r},dr.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)},dr.prototype.compareTo=function(r){var o=r;return this.compareDirection(o)},dr.prototype.getDirectedCoordinate=function(){return this._p1},dr.prototype.getDx=function(){return this._dx},dr.prototype.getLabel=function(){return this._label},dr.prototype.getEdge=function(){return this._edge},dr.prototype.getQuadrant=function(){return this._quadrant},dr.prototype.getNode=function(){return this._node},dr.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},dr.prototype.computeLabel=function(r){},dr.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")},dr.prototype.interfaces_=function(){return[z]},dr.prototype.getClass=function(){return dr};var Xd=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 Oo("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,Dt.LEFT)===V.INTERIOR&&this._label.getLocation(l,Dt.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[Dt.LEFT]+"/"+this._depth[Dt.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 g=1;a===Dt.LEFT&&(g=-1);var w=Dt.opposite(a),C=l+h*g;this.setDepth(a,l),this.setDepth(w,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}(dr),hu=function(){};hu.prototype.createNode=function(r){return new Mf(r,null)},hu.prototype.interfaces_=function(){return[]},hu.prototype.getClass=function(){return hu};var Ln=function(){if(this._edges=new O,this._nodes=null,this._edgeEndList=new O,arguments.length===0)this._nodes=new Yi(new hu);else if(arguments.length===1){var r=arguments[0];this._nodes=new Yi(r)}};Ln.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)}},Ln.prototype.find=function(r){return this._nodes.find(r)},Ln.prototype.addNode=function(){if(arguments[0]instanceof Mf){var r=arguments[0];return this._nodes.addNode(r)}if(arguments[0]instanceof P){var o=arguments[0];return this._nodes.addNode(o)}},Ln.prototype.getNodeIterator=function(){return this._nodes.iterator()},Ln.prototype.linkResultDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkResultDirectedEdges()},Ln.prototype.debugPrintln=function(r){Ft.out.println(r)},Ln.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},Ln.prototype.linkAllDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkAllDirectedEdges()},Ln.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)},Ln.prototype.getEdgeEnds=function(){return this._edgeEndList},Ln.prototype.debugPrint=function(r){Ft.out.print(r)},Ln.prototype.getEdgeIterator=function(){return this._edges.iterator()},Ln.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},Ln.prototype.insertEdge=function(r){this._edges.add(r)},Ln.prototype.findEdgeEnd=function(r){for(var o=this.getEdgeEnds().iterator();o.hasNext();){var a=o.next();if(a.getEdge()===r)return a}return null},Ln.prototype.addEdges=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next();this._edges.add(a);var l=new Xd(a,!0),h=new Xd(a,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},Ln.prototype.add=function(r){this._nodes.add(r),this._edgeEndList.add(r)},Ln.prototype.getNodes=function(){return this._nodes.values()},Ln.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},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.linkResultDirectedEdges=function(r){for(var o=r.iterator();o.hasNext();)o.next().getEdges().linkResultDirectedEdges()};var jr=function(){this._geometryFactory=null,this._shellList=new O;var r=arguments[0];this._geometryFactory=r};jr.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)}},jr.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},jr.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 Oo("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},jr.prototype.buildMinimalEdgeRings=function(r,o,a){for(var l=new O,h=r.iterator();h.hasNext();){var g=h.next();if(g.getMaxNodeDegree()>2){g.linkDirectedEdgesForMinimalEdgeRings();var w=g.buildMinimalRings(),C=this.findShell(w);C!==null?(this.placePolygonHoles(C,w),o.add(C)):a.addAll(w)}else l.add(g)}return l},jr.prototype.containsPoint=function(r){for(var o=this._shellList.iterator();o.hasNext();)if(o.next().containsPoint(r))return!0;return!1},jr.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 a2(l,this._geometryFactory);o.add(h),h.setInResult()}}return o},jr.prototype.placePolygonHoles=function(r,o){for(var a=o.iterator();a.hasNext();){var l=a.next();l.isHole()&&l.setShell(r)}},jr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},jr.prototype.findEdgeRingContaining=function(r,o){for(var a=r.getLinearRing(),l=a.getEnvelopeInternal(),h=a.getCoordinateN(0),g=null,w=null,C=o.iterator();C.hasNext();){var B=C.next(),K=B.getLinearRing(),gt=K.getEnvelopeInternal();g!==null&&(w=g.getLinearRing().getEnvelopeInternal());var yt=!1;gt.contains(l)&&ot.isPointInRing(h,K.getCoordinates())&&(yt=!0),yt&&(g===null||w.contains(gt))&&(g=B)}return g},jr.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},jr.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];Ln.linkResultDirectedEdges(a);var l=this.buildMaximalEdgeRings(o),h=new O,g=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(g,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr};var pu=function(){};pu.prototype.getBounds=function(){},pu.prototype.interfaces_=function(){return[]},pu.prototype.getClass=function(){return pu};var Di=function(){this._bounds=null,this._item=null;var r=arguments[0],o=arguments[1];this._bounds=r,this._item=o};Di.prototype.getItem=function(){return this._item},Di.prototype.getBounds=function(){return this._bounds},Di.prototype.interfaces_=function(){return[pu,t]},Di.prototype.getClass=function(){return Di};var Do=function(){this._size=null,this._items=null,this._size=0,this._items=new O,this._items.add(null)};Do.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},Do.prototype.size=function(){return this._size},Do.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)},Do.prototype.clear=function(){this._size=0,this._items.clear()},Do.prototype.isEmpty=function(){return this._size===0},Do.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)},Do.prototype.interfaces_=function(){return[]},Do.prototype.getClass=function(){return Do};var es=function(){};es.prototype.visitItem=function(r){},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var ya=function(){};ya.prototype.insert=function(r,o){},ya.prototype.remove=function(r,o){},ya.prototype.query=function(){},ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya};var $n=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}}},xx={serialVersionUID:{configurable:!0}};$n.prototype.getLevel=function(){return this._level},$n.prototype.size=function(){return this._childBoundables.size()},$n.prototype.getChildBoundables=function(){return this._childBoundables},$n.prototype.addChildBoundable=function(r){Pt.isTrue(this._bounds===null),this._childBoundables.add(r)},$n.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},$n.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},$n.prototype.interfaces_=function(){return[pu,t]},$n.prototype.getClass=function(){return $n},xx.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties($n,xx);var Fi=function(){};Fi.reverseOrder=function(){return{compare:function(r,o){return o.compareTo(r)}}},Fi.min=function(r){return Fi.sort(r),r.get(0)},Fi.sort=function(r,o){var a=r.toArray();o?_n.sort(a,o):_n.sort(a);for(var l=r.iterator(),h=0,g=a.length;h<g;h++)l.next(),l.set(a[h])},Fi.singletonList=function(r){var o=new O;return o.add(r),o};var Vn=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()};Vn.prototype.expandToQueue=function(r,o){var a=Vn.isComposite(this._boundable1),l=Vn.isComposite(this._boundable2);if(a&&l)return Vn.area(this._boundable1)>Vn.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")},Vn.prototype.isLeaves=function(){return!(Vn.isComposite(this._boundable1)||Vn.isComposite(this._boundable2))},Vn.prototype.compareTo=function(r){var o=r;return this._distance<o._distance?-1:this._distance>o._distance?1:0},Vn.prototype.expand=function(r,o,a,l){for(var h=r.getChildBoundables().iterator();h.hasNext();){var g=h.next(),w=new Vn(g,o,this._itemDistance);w.getDistance()<l&&a.add(w)}},Vn.prototype.getBoundable=function(r){return r===0?this._boundable1:this._boundable2},Vn.prototype.getDistance=function(){return this._distance},Vn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Vn.prototype.interfaces_=function(){return[z]},Vn.prototype.getClass=function(){return Vn},Vn.area=function(r){return r.getBounds().getArea()},Vn.isComposite=function(r){return r instanceof $n};var er=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}},bf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};er.prototype.getNodeCapacity=function(){return this._nodeCapacity},er.prototype.lastNode=function(r){return r.get(r.size()-1)},er.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 $n?r+=this.size(a):a instanceof Di&&(r+=1)}return r}},er.prototype.removeItem=function(r,o){for(var a=null,l=r.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof Di&&h.getItem()===o&&(a=h)}return a!==null&&(r.getChildBoundables().remove(a),!0)},er.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 $n){var g=this.itemsTree(h);g!==null&&a.add(g)}else h instanceof Di?a.add(h.getItem()):Pt.shouldNeverReachHere()}return a.size()<=0?null:a}},er.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 Di(r,o))},er.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 g=l.getChildBoundables().iterator();g.hasNext();){var w=g.next();w instanceof $n?this.boundablesAtLevel(a,w,h):(Pt.isTrue(w instanceof Di),a===-1&&h.add(w))}return null}},er.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(Y(arguments[2],es)&&arguments[0]instanceof Object&&arguments[1]instanceof $n)for(var h=arguments[0],g=arguments[1],w=arguments[2],C=g.getChildBoundables(),B=0;B<C.size();B++){var K=C.get(B);this.getIntersectsOp().intersects(K.getBounds(),h)&&(K instanceof $n?this.query(h,K,w):K instanceof Di?w.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if(Y(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof $n)for(var gt=arguments[0],yt=arguments[1],Bt=arguments[2],kt=yt.getChildBoundables(),Jt=0;Jt<kt.size();Jt++){var ae=kt.get(Jt);this.getIntersectsOp().intersects(ae.getBounds(),gt)&&(ae instanceof $n?this.query(gt,ae,Bt):ae instanceof Di?Bt.add(ae.getItem()):Pt.shouldNeverReachHere())}}},er.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},er.prototype.getRoot=function(){return this.build(),this._root},er.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],g=this.removeItem(l,h);if(g)return!0;for(var w=null,C=l.getChildBoundables().iterator();C.hasNext();){var B=C.next();if(this.getIntersectsOp().intersects(B.getBounds(),a)&&B instanceof $n&&(g=this.remove(a,B,h))){w=B;break}}return w!==null&&w.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(w),g}},er.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)},er.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 $n){var l=this.depth(a);l>r&&(r=l)}}return r+1}},er.prototype.createParentBoundables=function(r,o){Pt.isTrue(!r.isEmpty());var a=new O;a.add(this.createNode(o));var l=new O(r);Fi.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var g=h.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(o)),this.lastNode(a).addChildBoundable(g)}return a},er.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},er.prototype.interfaces_=function(){return[t]},er.prototype.getClass=function(){return er},er.compareDoubles=function(r,o){return r>o?1:r<o?-1:0},bf.IntersectsOp.get=function(){return u2},bf.serialVersionUID.get=function(){return-3886435814360241e3},bf.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(er,bf);var u2=function(){},du=function(){};du.prototype.distance=function(r,o){},du.prototype.interfaces_=function(){return[]},du.prototype.getClass=function(){return du};var Ex=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 g=new O,w=0;w<l.length;w++)g.addAll(this.createParentBoundablesFromVerticalSlice(l[w],h));return g},o.prototype.createNode=function(l){return new wx(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 g=Math.trunc(Math.ceil(l.size()/h)),w=new Array(h).fill(null),C=l.iterator(),B=0;B<h;B++){w[B]=new O;for(var K=0;C.hasNext()&&K<g;){var gt=C.next();w[B].add(gt),K++}}return w},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],g=arguments[1];r.prototype.query.call(this,h,g)}else if(arguments.length===3){if(Y(arguments[2],es)&&arguments[0]instanceof Object&&arguments[1]instanceof $n){var w=arguments[0],C=arguments[1],B=arguments[2];r.prototype.query.call(this,w,C,B)}else if(Y(arguments[2],ht)&&arguments[0]instanceof Object&&arguments[1]instanceof $n){var K=arguments[0],gt=arguments[1],yt=arguments[2];r.prototype.query.call(this,K,gt,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 g=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),w=new O(l);Fi.sort(w,o.xComparator);var C=this.verticalSlices(w,Math.trunc(Math.ceil(Math.sqrt(g))));return this.createParentBoundablesFromVerticalSlices(C,h)},o.prototype.nearestNeighbour=function(){if(arguments.length===1){if(Y(arguments[0],du)){var l=arguments[0],h=new Vn(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof Vn){var g=arguments[0];return this.nearestNeighbour(g,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof o&&Y(arguments[1],du)){var w=arguments[0],C=arguments[1],B=new Vn(this.getRoot(),w.getRoot(),C);return this.nearestNeighbour(B)}if(arguments[0]instanceof Vn&&typeof arguments[1]=="number"){var K=arguments[0],gt=arguments[1],yt=null,Bt=new Do;for(Bt.add(K);!Bt.isEmpty()&&gt>0;){var kt=Bt.poll(),Jt=kt.getDistance();if(Jt>=gt)break;kt.isLeaves()?(gt=Jt,yt=kt):kt.expandToQueue(Bt,gt)}return[yt.getBoundable(0).getItem(),yt.getBoundable(1).getItem()]}}else if(arguments.length===3){var ae=arguments[0],dn=arguments[1],Wn=arguments[2],Lr=new Di(ae,dn),go=new Vn(this.getRoot(),Lr,Wn);return this.nearestNeighbour(go)[0]}},o.prototype.interfaces_=function(){return[ya,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 wx},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}(er),wx=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}($n),zr=function(){};zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.relativeSign=function(r,o){return r<o?-1:r>o?1:0},zr.compare=function(r,o,a){if(o.equals2D(a))return 0;var l=zr.relativeSign(o.x,a.x),h=zr.relativeSign(o.y,a.y);switch(r){case 0:return zr.compareValue(l,h);case 1:return zr.compareValue(h,l);case 2:return zr.compareValue(h,-l);case 3:return zr.compareValue(-l,h);case 4:return zr.compareValue(-l,-h);case 5:return zr.compareValue(-h,-l);case 6:return zr.compareValue(-h,l);case 7:return zr.compareValue(l,-h)}return Pt.shouldNeverReachHere("invalid octant value"),0},zr.compareValue=function(r,o){return r<0?-1:r>0?1:o<0?-1:o>0?1:0};var ns=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))};ns.prototype.getCoordinate=function(){return this.coord},ns.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)},ns.prototype.compareTo=function(r){var o=r;return this.segmentIndex<o.segmentIndex?-1:this.segmentIndex>o.segmentIndex?1:this.coord.equals2D(o.coord)?0:zr.compare(this._segmentOctant,this.coord,o.coord)},ns.prototype.isEndPoint=function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r},ns.prototype.isInterior=function(){return this._isInterior},ns.prototype.interfaces_=function(){return[z]},ns.prototype.getClass=function(){return ns};var Ar=function(){this._nodeMap=new y,this._edge=null;var r=arguments[0];this._edge=r};Ar.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()},Ar.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)}},Ar.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},Ar.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))}},Ar.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 g=r.segmentIndex+1;g<=o.segmentIndex;g++)a.add(this._edge.getCoordinate(g));h&&a.add(new P(o.coord))},Ar.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ar.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}},Ar.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)},Ar.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}},Ar.prototype.getEdge=function(){return this._edge},Ar.prototype.addEndpoints=function(){var r=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(r),r)},Ar.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 g=new Array(a).fill(null),w=0;g[w++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)g[w++]=this._edge.getCoordinate(C);return h&&(g[w]=new P(o.coord)),new Dn(g,this._edge.getData())},Ar.prototype.add=function(r,o){var a=new ns(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)},Ar.prototype.checkSplitEdgesCorrectness=function(r){var o=this._edge.getCoordinates(),a=r.get(0).getCoordinate(0);if(!a.equals2D(o[0]))throw new Vt("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 Vt("bad split edge end point at "+h)},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar};var va=function(){};va.prototype.interfaces_=function(){return[]},va.prototype.getClass=function(){return va},va.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],g=arguments[1],w=g.x-h.x,C=g.y-h.y;if(w===0&&C===0)throw new T("Cannot compute the octant for two identical points "+h);return va.octant(w,C)}};var ao=function(){};ao.prototype.getCoordinates=function(){},ao.prototype.size=function(){},ao.prototype.getCoordinate=function(r){},ao.prototype.isClosed=function(){},ao.prototype.setData=function(r){},ao.prototype.getData=function(){},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao};var $l=function(){};$l.prototype.addIntersection=function(r,o){},$l.prototype.interfaces_=function(){return[ao]},$l.prototype.getClass=function(){return $l};var Dn=function(){this._nodeList=new Ar(this),this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};Dn.prototype.getCoordinates=function(){return this._pts},Dn.prototype.size=function(){return this._pts.length},Dn.prototype.getCoordinate=function(r){return this._pts[r]},Dn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Dn.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))},Dn.prototype.setData=function(r){this._data=r},Dn.prototype.safeOctant=function(r,o){return r.equals2D(o)?0:va.octant(r,o)},Dn.prototype.getData=function(){return this._data},Dn.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],g=new P(a.getIntersection(h));this.addIntersection(g,l)}},Dn.prototype.toString=function(){return St.toLineString(new oe(this._pts))},Dn.prototype.getNodeList=function(){return this._nodeList},Dn.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)},Dn.prototype.addIntersections=function(r,o,a){for(var l=0;l<r.getIntersectionNum();l++)this.addIntersection(r,o,a,l)},Dn.prototype.interfaces_=function(){return[$l]},Dn.prototype.getClass=function(){return Dn},Dn.getNodedSubstrings=function(){if(arguments.length===1){var r=arguments[0],o=new O;return Dn.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 se=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)}},Sx={serialVersionUID:{configurable:!0}};se.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},se.prototype.orientationIndex=function(){if(arguments[0]instanceof se){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)}},se.prototype.toGeometry=function(r){return r.createLineString([this.p0,this.p1])},se.prototype.isVertical=function(){return this.p0.x===this.p1.x},se.prototype.equals=function(r){if(!(r instanceof se))return!1;var o=r;return this.p0.equals(o.p0)&&this.p1.equals(o.p1)},se.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},se.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 se){var l=arguments[0],h=this.projectionFactor(l.p0),g=this.projectionFactor(l.p1);if(h>=1&&g>=1||h<=0&&g<=0)return null;var w=this.project(l.p0);h<0&&(w=this.p0),h>1&&(w=this.p1);var C=this.project(l.p1);return g<0&&(C=this.p0),g>1&&(C=this.p1),new se(w,C)}},se.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},se.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},se.prototype.getCoordinate=function(r){return r===0?this.p0:this.p1},se.prototype.distancePerpendicular=function(r){return ot.distancePointLinePerpendicular(r,this.p0,this.p1)},se.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},se.prototype.midPoint=function(){return se.midPoint(this.p0,this.p1)},se.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?S.NaN:((r.x-this.p0.x)*o+(r.y-this.p0.y)*a)/l},se.prototype.closestPoints=function(r){var o=this.intersection(r);if(o!==null)return[o,o];var a=new Array(2).fill(null),l=S.MAX_VALUE,h=null,g=this.closestPoint(r.p0);l=g.distance(r.p0),a[0]=g,a[1]=r.p0;var w=this.closestPoint(r.p1);(h=w.distance(r.p1))<l&&(l=h,a[0]=w,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 B=r.closestPoint(this.p1);return(h=B.distance(this.p1))<l&&(l=h,a[0]=this.p1,a[1]=B),a},se.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},se.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},se.prototype.getLength=function(){return this.p0.distance(this.p1)},se.prototype.compareTo=function(r){var o=r,a=this.p0.compareTo(o.p0);return a!==0?a:this.p1.compareTo(o.p1)},se.prototype.reverse=function(){var r=this.p0;this.p0=this.p1,this.p1=r},se.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)},se.prototype.lineIntersection=function(r){try{return zt.intersection(this.p0,this.p1,r.p0,r.p1)}catch(o){if(!(o instanceof $t))throw o}return null},se.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},se.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,g=this.p1.y-this.p0.y,w=Math.sqrt(h*h+g*g),C=0,B=0;if(o!==0){if(w<=0)throw new Error("Cannot compute offset from zero-length line segment");C=o*h/w,B=o*g/w}return new P(a-B,l+C)},se.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}},se.prototype.segmentFraction=function(r){var o=this.projectionFactor(r);return o<0?o=0:(o>1||S.isNaN(o))&&(o=1),o},se.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},se.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},se.prototype.distance=function(){if(arguments[0]instanceof se){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)}},se.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},se.prototype.hashCode=function(){var r=S.doubleToLongBits(this.p0.x);r^=31*S.doubleToLongBits(this.p0.y);var o=Math.trunc(r)^Math.trunc(r>>32),a=S.doubleToLongBits(this.p1.x);return a^=31*S.doubleToLongBits(this.p1.y),o^(Math.trunc(a)^Math.trunc(a>>32))},se.prototype.interfaces_=function(){return[z,t]},se.prototype.getClass=function(){return se},se.midPoint=function(r,o){return new P((r.x+o.x)/2,(r.y+o.y)/2)},Sx.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(se,Sx);var Zl=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new se,this._overlapSeg2=new se};Zl.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)}}},Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl};var Kr=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};Kr.prototype.getLineSegment=function(r,o){o.p0=this._pts[r],o.p1=this._pts[r+1]},Kr.prototype.computeSelect=function(r,o,a,l){var h=this._pts[o],g=this._pts[a];if(l.tempEnv1.init(h,g),a-o==1)return l.select(this,o),null;if(!r.intersects(l.tempEnv1))return null;var w=Math.trunc((o+a)/2);o<w&&this.computeSelect(r,o,w,l),w<a&&this.computeSelect(r,w,a,l)},Kr.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},Kr.prototype.computeOverlaps=function(r,o){this.computeOverlapsInternal(this._start,this._end,r,r._start,r._end,o)},Kr.prototype.setId=function(r){this._id=r},Kr.prototype.select=function(r,o){this.computeSelect(r,this._start,this._end,o)},Kr.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},Kr.prototype.getEndIndex=function(){return this._end},Kr.prototype.getStartIndex=function(){return this._start},Kr.prototype.getContext=function(){return this._context},Kr.prototype.getId=function(){return this._id},Kr.prototype.computeOverlapsInternal=function(r,o,a,l,h,g){var w=this._pts[r],C=this._pts[o],B=a._pts[l],K=a._pts[h];if(o-r==1&&h-l==1)return g.overlap(this,r,a,l),null;if(g.tempEnv1.init(w,C),g.tempEnv2.init(B,K),!g.tempEnv1.intersects(g.tempEnv2))return null;var gt=Math.trunc((r+o)/2),yt=Math.trunc((l+h)/2);r<gt&&(l<yt&&this.computeOverlapsInternal(r,gt,a,l,yt,g),yt<h&&this.computeOverlapsInternal(r,gt,a,yt,h,g)),gt<o&&(l<yt&&this.computeOverlapsInternal(gt,o,a,l,yt,g),yt<h&&this.computeOverlapsInternal(gt,o,a,yt,h,g))},Kr.prototype.interfaces_=function(){return[]},Kr.prototype.getClass=function(){return Kr};var $i=function(){};$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.getChainStartIndices=function(r){var o=0,a=new O;a.add(new it(o));do{var l=$i.findChainEnd(r,o);a.add(new it(l)),o=l}while(o<r.length-1);return $i.toIntArray(a)},$i.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},$i.getChains=function(){if(arguments.length===1){var r=arguments[0];return $i.getChains(r,null)}if(arguments.length===2){for(var o=arguments[0],a=arguments[1],l=new O,h=$i.getChainStartIndices(o),g=0;g<h.length-1;g++){var w=new Kr(o,h[g],h[g+1],a);l.add(w)}return l}},$i.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 Rs=function(){};Rs.prototype.computeNodes=function(r){},Rs.prototype.getNodedSubstrings=function(){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Jl=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setSegmentIntersector(r)}}};Jl.prototype.setSegmentIntersector=function(r){this._segInt=r},Jl.prototype.interfaces_=function(){return[Rs]},Jl.prototype.getClass=function(){return Jl};var Yd=function(r){function o(l){l?r.call(this,l):r.call(this),this._monoChains=new O,this._index=new Ex,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 Dn.getNodedSubstrings(this._nodedSegStrings)},o.prototype.getIndex=function(){return this._index},o.prototype.add=function(l){for(var h=$i.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var g=h.next();g.setId(this._idCounter++),this._index.insert(g.getEnvelope(),g),this._monoChains.add(g)}},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 Mx(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var g=h.next(),w=this._index.query(g.getEnvelope()).iterator();w.hasNext();){var C=w.next();if(C.getId()>g.getId()&&(g.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 Mx},Object.defineProperties(o,a),o}(Jl),Mx=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],g=arguments[3],w=a.getContext(),C=h.getContext();this._si.processIntersections(w,l,C,g)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Zl),je=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],g=arguments[1],w=arguments[2],C=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(g),this.setJoinStyle(w),this.setMitreLimit(C)}}},Fo={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}};je.prototype.getEndCapStyle=function(){return this._endCapStyle},je.prototype.isSingleSided=function(){return this._isSingleSided},je.prototype.setQuadrantSegments=function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=je.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=je.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==je.JOIN_ROUND&&(this._quadrantSegments=je.DEFAULT_QUADRANT_SEGMENTS)},je.prototype.getJoinStyle=function(){return this._joinStyle},je.prototype.setJoinStyle=function(r){this._joinStyle=r},je.prototype.setSimplifyFactor=function(r){this._simplifyFactor=r<0?0:r},je.prototype.getSimplifyFactor=function(){return this._simplifyFactor},je.prototype.getQuadrantSegments=function(){return this._quadrantSegments},je.prototype.setEndCapStyle=function(r){this._endCapStyle=r},je.prototype.getMitreLimit=function(){return this._mitreLimit},je.prototype.setMitreLimit=function(r){this._mitreLimit=r},je.prototype.setSingleSided=function(r){this._isSingleSided=r},je.prototype.interfaces_=function(){return[]},je.prototype.getClass=function(){return je},je.bufferDistanceError=function(r){var o=Math.PI/2/r;return 1-Math.cos(o/2)},Fo.CAP_ROUND.get=function(){return 1},Fo.CAP_FLAT.get=function(){return 2},Fo.CAP_SQUARE.get=function(){return 3},Fo.JOIN_ROUND.get=function(){return 1},Fo.JOIN_MITRE.get=function(){return 2},Fo.JOIN_BEVEL.get=function(){return 3},Fo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Fo.DEFAULT_MITRE_LIMIT.get=function(){return 5},Fo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(je,Fo);var Nn=function(r){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ot.COUNTERCLOCKWISE,this._inputLine=r||null},jl={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Nn.prototype.isDeletable=function(r,o,a,l){var h=this._inputLine[r],g=this._inputLine[o],w=this._inputLine[a];return!!this.isConcave(h,g,w)&&!!this.isShallow(h,g,w,l)&&this.isShallowSampled(h,g,r,a,l)},Nn.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]=Nn.DELETE,h=!0,l=!0),r=h?a:o,o=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(o)}return l},Nn.prototype.isShallowConcavity=function(r,o,a,l){return ot.computeOrientation(r,o,a)!==this._angleOrientation?!1:ot.distancePointLine(o,r,a)<l},Nn.prototype.isShallowSampled=function(r,o,a,l,h){var g=Math.trunc((l-a)/Nn.NUM_PTS_TO_CHECK);g<=0&&(g=1);for(var w=a;w<l;w+=g)if(!this.isShallow(r,o,this._inputLine[w],h))return!1;return!0},Nn.prototype.isConcave=function(r,o,a){var l=ot.computeOrientation(r,o,a)===this._angleOrientation;return l},Nn.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()},Nn.prototype.findNextNonDeletedIndex=function(r){for(var o=r+1;o<this._inputLine.length&&this._isDeleted[o]===Nn.DELETE;)o++;return o},Nn.prototype.isShallow=function(r,o,a,l){return ot.distancePointLine(o,r,a)<l},Nn.prototype.collapseLine=function(){for(var r=new J,o=0;o<this._inputLine.length;o++)this._isDeleted[o]!==Nn.DELETE&&r.add(this._inputLine[o]);return r.toCoordinateArray()},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},Nn.simplify=function(r,o){return new Nn(r).simplify(o)},jl.INIT.get=function(){return 0},jl.DELETE.get=function(){return 1},jl.KEEP.get=function(){return 1},jl.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Nn,jl);var fi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new O},bx={COORDINATE_ARRAY_TYPE:{configurable:!0}};fi.prototype.getCoordinates=function(){return this._ptList.toArray(fi.COORDINATE_ARRAY_TYPE)},fi.prototype.setPrecisionModel=function(r){this._precisionModel=r},fi.prototype.addPt=function(r){var o=new P(r);if(this._precisionModel.makePrecise(o),this.isRedundant(o))return null;this._ptList.add(o)},fi.prototype.revere=function(){},fi.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])},fi.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},fi.prototype.toString=function(){return new ge().createLineString(this.getCoordinates()).toString()},fi.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)},fi.prototype.setMinimumVertexDistance=function(r){this._minimimVertexDistance=r},fi.prototype.interfaces_=function(){return[]},fi.prototype.getClass=function(){return fi},bx.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(fi,bx);var xe=function(){},_a={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},_a.PI_TIMES_2.get=function(){return 2*Math.PI},_a.PI_OVER_2.get=function(){return Math.PI/2},_a.PI_OVER_4.get=function(){return Math.PI/4},_a.COUNTERCLOCKWISE.get=function(){return ot.COUNTERCLOCKWISE},_a.CLOCKWISE.get=function(){return ot.CLOCKWISE},_a.NONE.get=function(){return ot.COLLINEAR},Object.defineProperties(xe,_a);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 se,this._seg1=new se,this._offset0=new se,this._offset1=new se,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()===je.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},Kl={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===Dt.LEFT||a===ot.COUNTERCLOCKWISE&&this._side===Dt.RIGHT;a===0?this.addCollinear(o):l?this.addOutsideTurn(a,o):this.addInsideTurn(a,o)},bn.prototype.addLineEndCap=function(r,o){var a=new se(r,o),l=new se;this.computeOffsetSegment(a,Dt.LEFT,this._distance,l);var h=new se;this.computeOffsetSegment(a,Dt.RIGHT,this._distance,h);var g=o.x-r.x,w=o.y-r.y,C=Math.atan2(w,g);switch(this._bufParams.getEndCapStyle()){case je.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 je.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case je.CAP_SQUARE:var B=new P;B.x=Math.abs(this._distance)*Math.cos(C),B.y=Math.abs(this._distance)*Math.sin(C);var K=new P(l.p1.x+B.x,l.p1.y+B.y),gt=new P(h.p1.x+B.x,h.p1.y+B.y);this._segList.addPt(K),this._segList.addPt(gt)}},bn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},bn.prototype.addMitreJoin=function(r,o,a,l){var h=!0,g=null;try{g=zt.intersection(o.p0,o.p1,a.p0,a.p1),(l<=0?1:g.distance(r)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(w){if(!(w instanceof $t))throw w;g=new P(0,0),h=!1}h?this._segList.addPt(g):this.addLimitedMitreJoin(o,a,l,this._bufParams.getMitreLimit())},bn.prototype.addFilletCorner=function(r,o,a,l,h){var g=o.x-r.x,w=o.y-r.y,C=Math.atan2(w,g),B=a.x-r.x,K=a.y-r.y,gt=Math.atan2(K,B);l===ot.CLOCKWISE?C<=gt&&(C+=2*Math.PI):C>=gt&&(C-=2*Math.PI),this._segList.addPt(o),this.addFilletArc(r,C,gt,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()===je.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===je.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,g=xe.angle(h,this._seg0.p0),w=xe.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,C=xe.normalize(g+w),B=xe.normalize(C+Math.PI),K=l*a,gt=a-K*Math.abs(Math.sin(w)),yt=h.x+K*Math.cos(B),Bt=h.y+K*Math.sin(B),kt=new P(yt,Bt),Jt=new se(h,kt),ae=Jt.pointAlongOffset(1,gt),dn=Jt.pointAlongOffset(1,-gt);this._side===Dt.LEFT?(this._segList.addPt(ae),this._segList.addPt(dn)):(this._segList.addPt(dn),this._segList.addPt(ae))},bn.prototype.computeOffsetSegment=function(r,o,a,l){var h=o===Dt.LEFT?1:-1,g=r.p1.x-r.p0.x,w=r.p1.y-r.p0.y,C=Math.sqrt(g*g+w*w),B=h*a*g/C,K=h*a*w/C;l.p0.x=r.p0.x-K,l.p0.y=r.p0.y+B,l.p1.x=r.p1.x-K,l.p1.y=r.p1.y+B},bn.prototype.addFilletArc=function(r,o,a,l,h){var g=l===ot.CLOCKWISE?-1:1,w=Math.abs(o-a),C=Math.trunc(w/this._filletAngleQuantum+.5);if(C<1)return null;for(var B=w/C,K=0,gt=new P;K<w;){var yt=o+g*K;gt.x=r.x+h*Math.cos(yt),gt.y=r.y+h*Math.sin(yt),this._segList.addPt(gt),K+=B}},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 fi,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()===je.JOIN_BEVEL||this._bufParams.getJoinStyle()===je.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},Kl.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Kl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Kl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Kl.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(bn,Kl);var Gr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],o=arguments[1];this._precisionModel=r,this._bufParams=o};Gr.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 g=h.getCoordinates();return a&&et.reverse(g),g},Gr.prototype.computeSingleSidedBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){a.addSegments(r,!0);var h=Nn.simplify(r,-l),g=h.length-1;a.initSideSegments(h[g],h[g-1],Dt.LEFT),a.addFirstSegment();for(var w=g-2;w>=0;w--)a.addNextSegment(h[w],!0)}else{a.addSegments(r,!1);var C=Nn.simplify(r,l),B=C.length-1;a.initSideSegments(C[0],C[1],Dt.LEFT),a.addFirstSegment();for(var K=2;K<=B;K++)a.addNextSegment(C[K],!0)}a.addLastSegment(),a.closeRing()},Gr.prototype.computeRingBufferCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);o===Dt.RIGHT&&(l=-l);var h=Nn.simplify(r,l),g=h.length-1;a.initSideSegments(h[g-1],h[0],o);for(var w=1;w<=g;w++){var C=w!==1;a.addNextSegment(h[w],C)}a.closeRing()},Gr.prototype.computeLineBufferCurve=function(r,o){var a=this.simplifyTolerance(this._distance),l=Nn.simplify(r,a),h=l.length-1;o.initSideSegments(l[0],l[1],Dt.LEFT);for(var g=2;g<=h;g++)o.addNextSegment(l[g],!0);o.addLastSegment(),o.addLineEndCap(l[h-1],l[h]);var w=Nn.simplify(r,-a),C=w.length-1;o.initSideSegments(w[C],w[C-1],Dt.LEFT);for(var B=C-2;B>=0;B--)o.addNextSegment(w[B],!0);o.addLastSegment(),o.addLineEndCap(w[1],w[0]),o.closeRing()},Gr.prototype.computePointCurve=function(r,o){switch(this._bufParams.getEndCapStyle()){case je.CAP_ROUND:o.createCircle(r);break;case je.CAP_SQUARE:o.createSquare(r)}},Gr.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()},Gr.prototype.getBufferParameters=function(){return this._bufParams},Gr.prototype.simplifyTolerance=function(r){return r*this._bufParams.getSimplifyFactor()},Gr.prototype.getRingCurve=function(r,o,a){if(this._distance=a,r.length<=2)return this.getLineCurve(r,a);if(a===0)return Gr.copyCoordinates(r);var l=this.getSegGen(a);return this.computeRingBufferCurve(r,o,l),l.getCoordinates()},Gr.prototype.computeOffsetCurve=function(r,o,a){var l=this.simplifyTolerance(this._distance);if(o){var h=Nn.simplify(r,-l),g=h.length-1;a.initSideSegments(h[g],h[g-1],Dt.LEFT),a.addFirstSegment();for(var w=g-2;w>=0;w--)a.addNextSegment(h[w],!0)}else{var C=Nn.simplify(r,l),B=C.length-1;a.initSideSegments(C[0],C[1],Dt.LEFT),a.addFirstSegment();for(var K=2;K<=B;K++)a.addNextSegment(C[K],!0)}a.addLastSegment()},Gr.prototype.getSegGen=function(r){return new bn(this._precisionModel,this._bufParams,r)},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr},Gr.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 xa=function(){this._subgraphs=null,this._seg=new se,this._cga=new ot;var r=arguments[0];this._subgraphs=r},Ax={DepthSegment:{configurable:!0}};xa.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(Y(arguments[2],ht)&&arguments[0]instanceof P&&arguments[1]instanceof Xd){for(var g=arguments[0],w=arguments[1],C=arguments[2],B=w.getEdge().getCoordinates(),K=0;K<B.length-1;K++)if(this._seg.p0=B[K],this._seg.p1=B[K+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<g.x)&&!(this._seg.isHorizontal()||g.y<this._seg.p0.y||g.y>this._seg.p1.y||ot.computeOrientation(this._seg.p0,this._seg.p1,g)===ot.RIGHT)){var gt=w.getDepth(Dt.LEFT);this._seg.p0.equals(B[K])||(gt=w.getDepth(Dt.RIGHT));var yt=new Ls(this._seg,gt);C.add(yt)}}else if(Y(arguments[2],ht)&&arguments[0]instanceof P&&Y(arguments[1],ht))for(var Bt=arguments[0],kt=arguments[1],Jt=arguments[2],ae=kt.iterator();ae.hasNext();){var dn=ae.next();dn.isForward()&&this.findStabbedSegments(Bt,dn,Jt)}}},xa.prototype.getDepth=function(r){var o=this.findStabbedSegments(r);return o.size()===0?0:Fi.min(o)._leftDepth},xa.prototype.interfaces_=function(){return[]},xa.prototype.getClass=function(){return xa},Ax.DepthSegment.get=function(){return Ls},Object.defineProperties(xa,Ax);var Ls=function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],o=arguments[1];this._upwardSeg=new se(r),this._leftDepth=o};Ls.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)},Ls.prototype.compareX=function(r,o){var a=r.p0.compareTo(o.p0);return a!==0?a:r.p1.compareTo(o.p1)},Ls.prototype.toString=function(){return this._upwardSeg.toString()},Ls.prototype.interfaces_=function(){return[z]},Ls.prototype.getClass=function(){return Ls};var Ke=function(r,o,a){this.p0=r||null,this.p1=o||null,this.p2=a||null};Ke.prototype.area=function(){return Ke.area(this.p0,this.p1,this.p2)},Ke.prototype.signedArea=function(){return Ke.signedArea(this.p0,this.p1,this.p2)},Ke.prototype.interpolateZ=function(r){if(r===null)throw new T("Supplied point is null.");return Ke.interpolateZ(r,this.p0,this.p1,this.p2)},Ke.prototype.longestSideLength=function(){return Ke.longestSideLength(this.p0,this.p1,this.p2)},Ke.prototype.isAcute=function(){return Ke.isAcute(this.p0,this.p1,this.p2)},Ke.prototype.circumcentre=function(){return Ke.circumcentre(this.p0,this.p1,this.p2)},Ke.prototype.area3D=function(){return Ke.area3D(this.p0,this.p1,this.p2)},Ke.prototype.centroid=function(){return Ke.centroid(this.p0,this.p1,this.p2)},Ke.prototype.inCentre=function(){return Ke.inCentre(this.p0,this.p1,this.p2)},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke},Ke.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)},Ke.signedArea=function(r,o,a){return((a.x-r.x)*(o.y-r.y)-(o.x-r.x)*(a.y-r.y))/2},Ke.det=function(r,o,a,l){return r*l-o*a},Ke.interpolateZ=function(r,o,a,l){var h=o.x,g=o.y,w=a.x-h,C=l.x-h,B=a.y-g,K=l.y-g,gt=w*K-C*B,yt=r.x-h,Bt=r.y-g,kt=(K*yt-C*Bt)/gt,Jt=(-B*yt+w*Bt)/gt;return o.z+kt*(a.z-o.z)+Jt*(l.z-o.z)},Ke.longestSideLength=function(r,o,a){var l=r.distance(o),h=o.distance(a),g=a.distance(r),w=l;return h>w&&(w=h),g>w&&(w=g),w},Ke.isAcute=function(r,o,a){return!!xe.isAcute(r,o,a)&&!!xe.isAcute(o,a,r)&&!!xe.isAcute(a,r,o)},Ke.circumcentre=function(r,o,a){var l=a.x,h=a.y,g=r.x-l,w=r.y-h,C=o.x-l,B=o.y-h,K=2*Ke.det(g,w,C,B),gt=Ke.det(w,g*g+w*w,B,C*C+B*B),yt=Ke.det(g,g*g+w*w,C,C*C+B*B);return new P(l-gt/K,h+yt/K)},Ke.perpendicularBisector=function(r,o){var a=o.x-r.x,l=o.y-r.y,h=new zt(r.x+a/2,r.y+l/2,1),g=new zt(r.x-l+a/2,r.y+a+l/2,1);return new zt(h,g)},Ke.angleBisector=function(r,o,a){var l=o.distance(r),h=l/(l+o.distance(a)),g=a.x-r.x,w=a.y-r.y;return new P(r.x+h*g,r.y+h*w)},Ke.area3D=function(r,o,a){var l=o.x-r.x,h=o.y-r.y,g=o.z-r.z,w=a.x-r.x,C=a.y-r.y,B=a.z-r.z,K=h*B-g*C,gt=g*w-l*B,yt=l*C-h*w,Bt=K*K+gt*gt+yt*yt,kt=Math.sqrt(Bt)/2;return kt},Ke.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)},Ke.inCentre=function(r,o,a){var l=o.distance(a),h=r.distance(a),g=r.distance(o),w=l+h+g,C=(l*r.x+h*o.x+g*a.x)/w,B=(l*r.y+h*o.y+g*a.y)/w;return new P(C,B)};var Ai=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};Ai.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)},Ai.prototype.addPolygon=function(r){var o=this._distance,a=Dt.LEFT;this._distance<0&&(o=-this._distance,a=Dt.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 g=0;g<r.getNumInteriorRing();g++){var w=r.getInteriorRingN(g),C=et.removeRepeatedPoints(w.getCoordinates());this._distance>0&&this.isErodedCompletely(w,-this._distance)||this.addPolygonRing(C,o,Dt.opposite(a),V.INTERIOR,V.EXTERIOR)}},Ai.prototype.isTriangleErodedCompletely=function(r,o){var a=new Ke(r[0],r[1],r[2]),l=a.inCentre();return ot.distancePointLine(l,a.p0,a.p1)<Math.abs(o)},Ai.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)},Ai.prototype.addCurve=function(r,o,a){if(r===null||r.length<2)return null;var l=new Dn(r,new pn(0,V.BOUNDARY,o,a));this._curveList.add(l)},Ai.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ai.prototype.addPolygonRing=function(r,o,a,l,h){if(o===0&&r.length<fe.MINIMUM_VALID_SIZE)return null;var g=l,w=h;r.length>=fe.MINIMUM_VALID_SIZE&&ot.isCCW(r)&&(g=h,w=l,a=Dt.opposite(a));var C=this._curveBuilder.getRingCurve(r,a,o);this.addCurve(C,g,w)},Ai.prototype.add=function(r){if(r.isEmpty())return null;r instanceof ne?this.addPolygon(r):r instanceof ut?this.addLineString(r):r instanceof Qt?this.addPoint(r):r instanceof ve?this.addCollection(r):r instanceof Jr?this.addCollection(r):r instanceof he?this.addCollection(r):r instanceof En&&this.addCollection(r)},Ai.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},Ai.prototype.addCollection=function(r){for(var o=0;o<r.getNumGeometries();o++){var a=r.getGeometryN(o);this.add(a)}},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var mu=function(){};mu.prototype.locate=function(r){},mu.prototype.interfaces_=function(){return[]},mu.prototype.getClass=function(){return mu};var uo=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()};uo.prototype.next=function(){if(this._atStart)return this._atStart=!1,uo.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 uo(r),this._subcollectionIterator.next()):r},uo.prototype.remove=function(){throw new Error(this.getClass().getName())},uo.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)},uo.prototype.interfaces_=function(){return[pt]},uo.prototype.getClass=function(){return uo},uo.isAtomic=function(r){return!(r instanceof En)};var hi=function(){this._geom=null;var r=arguments[0];this._geom=r};hi.prototype.locate=function(r){return hi.locate(r,this._geom)},hi.prototype.interfaces_=function(){return[mu]},hi.prototype.getClass=function(){return hi},hi.isPointInRing=function(r,o){return!!o.getEnvelopeInternal().intersects(r)&&ot.isPointInRing(r,o.getCoordinates())},hi.containsPointInPolygon=function(r,o){if(o.isEmpty())return!1;var a=o.getExteriorRing();if(!hi.isPointInRing(r,a))return!1;for(var l=0;l<o.getNumInteriorRing();l++){var h=o.getInteriorRingN(l);if(hi.isPointInRing(r,h))return!1}return!0},hi.containsPoint=function(r,o){if(o instanceof ne)return hi.containsPointInPolygon(r,o);if(o instanceof En)for(var a=new uo(o);a.hasNext();){var l=a.next();if(l!==o&&hi.containsPoint(r,l))return!0}return!1},hi.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:hi.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,Dt.LEFT)!==V.NONE&&(o=l.getLocation(r,Dt.LEFT))}if(o===V.NONE)return null;for(var h=o,g=this.iterator();g.hasNext();){var w=g.next(),C=w.getLabel();if(C.getLocation(r,Dt.ON)===V.NONE&&C.setLocation(r,Dt.ON,h),C.isArea(r)){var B=C.getLocation(r,Dt.LEFT),K=C.getLocation(r,Dt.RIGHT);if(K!==V.NONE){if(K!==h)throw new Oo("side location conflict",w.getCoordinate());B===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+w.getCoordinate()+")"),h=B}else Pt.isTrue(C.getLocation(r,Dt.LEFT)===V.NONE,"found single null side"),C.setLocation(r,Dt.RIGHT,h),C.setLocation(r,Dt.LEFT,h)}}},mr.prototype.getCoordinate=function(){var r=this.iterator();return r.hasNext()?r.next().getCoordinate():null},mr.prototype.print=function(r){Ft.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,Dt.LEFT);Pt.isTrue(l!==V.NONE,"Found unlabelled area edge");for(var h=l,g=this.iterator();g.hasNext();){var w=g.next().getLabel();Pt.isTrue(w.isArea(r),"Found non-area edge");var C=w.getLocation(r,Dt.LEFT),B=w.getLocation(r,Dt.RIGHT);if(C===B||B!==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]=hi.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 g=this.iterator();g.hasNext();)for(var w=g.next(),C=w.getLabel(),B=0;B<2;B++)if(C.isAnyNull(B)){var K=V.NONE;if(o[B])K=V.EXTERIOR;else{var gt=w.getCoordinate();K=this.getLocation(B,gt,r)}C.setAllLocationsIfNull(B,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 l2=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,g=0;g<this._resultAreaEdgeList.size();g++){var w=this._resultAreaEdgeList.get(g),C=w.getSym();if(w.getLabel().isArea())switch(a===null&&w.isInResult()&&(a=w),h){case this._SCANNING_FOR_INCOMING:if(!C.isInResult())continue;l=C,h=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!w.isInResult())continue;l.setNext(w),h=this._SCANNING_FOR_INCOMING}}if(h===this._LINKING_TO_OUTGOING){if(a===null)throw new Oo("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 g=a.get(l-1),w=h.getQuadrant(),C=g.getQuadrant();return mn.isNorthern(w)&&mn.isNorthern(C)?h:mn.isNorthern(w)||mn.isNorthern(C)?h.getDy()!==0?h:g.getDy()!==0?g:(Pt.shouldNeverReachHere("found two horizontal edges incident on node"),null):g},o.prototype.print=function(a){Ft.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 g=this._edgeList.get(h),w=g.getSym();l===null&&(l=w),a!==null&&w.setNext(a),a=g}l.setNext(a)},o.prototype.computeDepths=function(){if(arguments.length===1){var a=arguments[0],l=this.findIndex(a),h=a.getDepth(Dt.LEFT),g=a.getDepth(Dt.RIGHT),w=this.computeDepths(l+1,this._edgeList.size(),h);if(this.computeDepths(0,l,w)!==g)throw new Oo("depth mismatch at "+a.getCoordinate())}else if(arguments.length===3){for(var C=arguments[0],B=arguments[1],K=arguments[2],gt=C;gt<B;gt++){var yt=this._edgeList.get(gt);yt.setEdgeDepths(Dt.RIGHT,K),K=yt.getDepth(Dt.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,g=this._SCANNING_FOR_INCOMING,w=this._resultAreaEdgeList.size()-1;w>=0;w--){var C=this._resultAreaEdgeList.get(w),B=C.getSym();switch(l===null&&C.getEdgeRing()===a&&(l=C),g){case this._SCANNING_FOR_INCOMING:if(B.getEdgeRing()!==a)continue;h=B,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(C.getEdgeRing()!==a)continue;h.setNextMin(C),g=this._SCANNING_FOR_INCOMING}}g===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],g=0,w=this.iterator();w.hasNext();)w.next().getEdgeRing()===h&&g++;return g}},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(),g=h.getSym();if(!h.isLineEdge()){if(h.isInResult()){a=V.INTERIOR;break}if(g.isInResult()){a=V.EXTERIOR;break}}}if(a===V.NONE)return null;for(var w=a,C=this.iterator();C.hasNext();){var B=C.next(),K=B.getSym();B.isLineEdge()?B.getEdge().setCovered(w===V.INTERIOR):(B.isInResult()&&(w=V.EXTERIOR),K.isInResult()&&(w=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(),g=0;g<2;g++){var w=h.getLocation(g);w!==V.INTERIOR&&w!==V.BOUNDARY||this._label.setLocation(g,V.INTERIOR)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(mr),Tx=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 Sf(a,new l2)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(hu),rs=function r(){this._pts=null,this._orientation=null;var o=arguments[0];this._pts=o,this._orientation=r.orientation(o)};rs.prototype.compareTo=function(r){var o=r;return rs.compareOriented(this._pts,this._orientation,o._pts,o._orientation)},rs.prototype.interfaces_=function(){return[z]},rs.prototype.getClass=function(){return rs},rs.orientation=function(r){return et.increasingDirection(r)===1},rs.compareOriented=function(r,o,a,l){for(var h=o?1:-1,g=l?1:-1,w=o?r.length:-1,C=l?a.length:-1,B=o?0:r.length-1,K=l?0:a.length-1;;){var gt=r[B].compareTo(a[K]);if(gt!==0)return gt;var yt=(B+=h)===w,Bt=(K+=g)===C;if(yt&&!Bt)return-1;if(!yt&&Bt)return 1;if(yt&&Bt)return 0}};var Ui=function(){this._edges=new O,this._ocaMap=new y};Ui.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(") ")},Ui.prototype.addAll=function(r){for(var o=r.iterator();o.hasNext();)this.add(o.next())},Ui.prototype.findEdgeIndex=function(r){for(var o=0;o<this._edges.size();o++)if(this._edges.get(o).equals(r))return o;return-1},Ui.prototype.iterator=function(){return this._edges.iterator()},Ui.prototype.getEdges=function(){return this._edges},Ui.prototype.get=function(r){return this._edges.get(r)},Ui.prototype.findEqualEdge=function(r){var o=new rs(r.getCoordinates());return this._ocaMap.get(o)},Ui.prototype.add=function(r){this._edges.add(r);var o=new rs(r.getCoordinates());this._ocaMap.put(o,r)},Ui.prototype.interfaces_=function(){return[]},Ui.prototype.getClass=function(){return Ui};var Ns=function(){};Ns.prototype.processIntersections=function(r,o,a,l){},Ns.prototype.isDone=function(){},Ns.prototype.interfaces_=function(){return[]},Ns.prototype.getClass=function(){return Ns};var pi=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};pi.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(pi.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},pi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},pi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},pi.prototype.getLineIntersector=function(){return this._li},pi.prototype.hasProperIntersection=function(){return this._hasProper},pi.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,g,w,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)))},pi.prototype.hasIntersection=function(){return this._hasIntersection},pi.prototype.isDone=function(){return!1},pi.prototype.hasInteriorIntersection=function(){return this._hasInterior},pi.prototype.interfaces_=function(){return[Ns]},pi.prototype.getClass=function(){return pi},pi.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var Zi=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};Zi.prototype.getSegmentIndex=function(){return this.segmentIndex},Zi.prototype.getCoordinate=function(){return this.coord},Zi.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex),r.println(" dist = "+this.dist)},Zi.prototype.compareTo=function(r){var o=r;return this.compare(o.segmentIndex,o.dist)},Zi.prototype.isEndPoint=function(r){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===r},Zi.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Zi.prototype.getDistance=function(){return this.dist},Zi.prototype.compare=function(r,o){return this.segmentIndex<r?-1:this.segmentIndex>r?1:this.dist<o?-1:this.dist>o?1:0},Zi.prototype.interfaces_=function(){return[z]},Zi.prototype.getClass=function(){return Zi};var lo=function(){this._nodeMap=new y,this.edge=null;var r=arguments[0];this.edge=r};lo.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},lo.prototype.iterator=function(){return this._nodeMap.values().iterator()},lo.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}},lo.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)},lo.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 g=new Array(a).fill(null),w=0;g[w++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)g[w++]=this.edge.pts[C];return h&&(g[w]=o.coord),new bf(g,new pn(this.edge._label))},lo.prototype.add=function(r,o,a){var l=new Zi(r,o,a),h=this._nodeMap.get(l);return h!==null?h:(this._nodeMap.put(l,l),l)},lo.prototype.isIntersection=function(r){for(var o=this.iterator();o.hasNext();)if(o.next().coord.equals(r))return!0;return!1},lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo};var Os=function(){};Os.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 Os.toIntArray(a)},Os.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},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},Os.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 Uo=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 Os;this.startIndex=o.getChainStartIndices(this.pts)};Uo.prototype.getCoordinates=function(){return this.pts},Uo.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},Uo.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},Uo.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],g=arguments[1],w=arguments[2],C=arguments[3],B=arguments[4],K=arguments[5],gt=this.pts[h],yt=this.pts[g],Bt=w.pts[C],kt=w.pts[B];if(g-h==1&&B-C==1)return K.addIntersections(this.e,h,w.e,C),null;if(this.env1.init(gt,yt),this.env2.init(Bt,kt),!this.env1.intersects(this.env2))return null;var Jt=Math.trunc((h+g)/2),ae=Math.trunc((C+B)/2);h<Jt&&(C<ae&&this.computeIntersectsForChain(h,Jt,w,C,ae,K),ae<B&&this.computeIntersectsForChain(h,Jt,w,ae,B,K)),Jt<g&&(C<ae&&this.computeIntersectsForChain(Jt,g,w,C,ae,K),ae<B&&this.computeIntersectsForChain(Jt,g,w,ae,B,K))}},Uo.prototype.getStartIndexes=function(){return this.startIndex},Uo.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)},Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo};var or=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},Cx={NULL_VALUE:{configurable:!0}};or.prototype.getDepth=function(r,o){return this._depth[r][o]},or.prototype.setDepth=function(r,o,a){this._depth[r][o]=a},or.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]!==or.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===or.NULL_VALUE}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._depth[l][h]===or.NULL_VALUE}},or.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}}},or.prototype.getDelta=function(r){return this._depth[r][Dt.RIGHT]-this._depth[r][Dt.LEFT]},or.prototype.getLocation=function(r,o){return this._depth[r][o]<=0?V.EXTERIOR:V.INTERIOR},or.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},or.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]=or.depthAtLocation(l):this._depth[o][a]+=or.depthAtLocation(l))}else if(arguments.length===3){var h=arguments[0],g=arguments[1];arguments[2]===V.INTERIOR&&this._depth[h][g]++}},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.depthAtLocation=function(r){return r===V.EXTERIOR?0:r===V.INTERIOR?1:or.NULL_VALUE},Cx.NULL_VALUE.get=function(){return-1},Object.defineProperties(or,Cx);var bf=function(r){function o(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new lo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new or,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,g=!0,w=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[--w])||(g=!1),!h&&!g)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 Uo(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,g){var w=new P(a.getIntersection(g)),C=l,B=a.getEdgeDistance(h,g),K=C+1;if(K<this.pts.length){var gt=this.pts[K];w.equals2D(gt)&&(C=K,B=0)}this.eiList.add(w,C,B)},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 g=0;g<a.getIntersectionNum();g++)this.addIntersection(a,l,h,g)},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,Dt.ON),a.getLocation(1,Dt.ON),1),a.isArea()&&(l.setAtLeastIfValid(a.getLocation(0,Dt.LEFT),a.getLocation(1,Dt.LEFT),2),l.setAtLeastIfValid(a.getLocation(0,Dt.RIGHT),a.getLocation(1,Dt.RIGHT),2))},o}(ci),Tr=function(r){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Ui,this._bufParams=r||null};Tr.prototype.setWorkingPrecisionModel=function(r){this._workingPrecisionModel=r},Tr.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=Tr.depthDelta(l),g=o.getDepthDelta()+h;o.setDepthDelta(g)}else this._edgeList.add(r),r.setDepthDelta(Tr.depthDelta(r.getLabel()))},Tr.prototype.buildSubgraphs=function(r,o){for(var a=new O,l=r.iterator();l.hasNext();){var h=l.next(),g=h.getRightmostCoordinate(),w=new xa(a).getDepth(g);h.computeDepth(w),h.findResultEdges(),a.add(h),o.add(h.getDirectedEdges(),h.getNodes())}},Tr.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 br;h.create(l),o.add(h)}}return Fi.sort(o,Fi.reverseOrder()),o},Tr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Tr.prototype.getNoder=function(r){if(this._workingNoder!==null)return this._workingNoder;var o=new Yd,a=new N;return a.setPrecisionModel(r),o.setSegmentIntersector(new pi(a)),o},Tr.prototype.buffer=function(r,o){var a=this._workingPrecisionModel;a===null&&(a=r.getPrecisionModel()),this._geomFact=r.getFactory();var l=new Gr(a,this._bufParams),h=new Ai(r,o,l).getCurves();if(h.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(h,a),this._graph=new Ln(new Tx),this._graph.addEdges(this._edgeList.getEdges());var g=this.createSubgraphs(this._graph),w=new jr(this._geomFact);this.buildSubgraphs(g,w);var C=w.getPolygons();return C.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(C)},Tr.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(),g=h.getCoordinates();if(g.length!==2||!g[0].equals2D(g[1])){var w=h.getData(),C=new bf(h.getCoordinates(),new pn(w));this.insertUniqueEdge(C)}}},Tr.prototype.setNoder=function(r){this._workingNoder=r},Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Tr.depthDelta=function(r){var o=r.getLocation(0,Dt.LEFT),a=r.getLocation(0,Dt.RIGHT);return o===V.INTERIOR&&a===V.EXTERIOR?1:o===V.EXTERIOR&&a===V.INTERIOR?-1:0},Tr.convertSegStrings=function(r){for(var o=new ge,a=new O;r.hasNext();){var l=r.next(),h=o.createLineString(l.getCoordinates());a.add(h)}return o.buildGeometry(a)};var is=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],g=arguments[3];this._noder=a,this._scaleFactor=l,this._offsetX=h,this._offsetY=g,this._isScaled=!this.isIntegerPrecision()}};is.prototype.rescale=function(){if(Y(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])&&Ft.out.println(a)}},is.prototype.scale=function(){if(Y(arguments[0],tt)){for(var r=arguments[0],o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new Dn(this.scale(l.getCoordinates()),l.getData()))}return o}if(arguments[0]instanceof Array){for(var h=arguments[0],g=new Array(h.length).fill(null),w=0;w<h.length;w++)g[w]=new P(Math.round((h[w].x-this._offsetX)*this._scaleFactor),Math.round((h[w].y-this._offsetY)*this._scaleFactor),h[w].z);return et.removeRepeatedPoints(g)}},is.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},is.prototype.getNodedSubstrings=function(){var r=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(r),r},is.prototype.computeNodes=function(r){var o=r;this._isScaled&&(o=this.scale(r)),this._noder.computeNodes(o)},is.prototype.interfaces_=function(){return[Rs]},is.prototype.getClass=function(){return is};var Ji=function(){this._li=new N,this._segStrings=null;var r=arguments[0];this._segStrings=r},Ix={fact:{configurable:!0}};Ji.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(),g=1;g<h.length-1;g++)if(h[g].equals(a))throw new Vt("found endpt/interior pt intersection at index "+g+" :pt "+a)}},Ji.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],g=arguments[1],w=h.getCoordinates(),C=g.getCoordinates(),B=0;B<w.length-1;B++)for(var K=0;K<C.length-1;K++)this.checkInteriorIntersections(h,B,g,K);else if(arguments.length===4){var gt=arguments[0],yt=arguments[1],Bt=arguments[2],kt=arguments[3];if(gt===Bt&&yt===kt)return null;var Jt=gt.getCoordinates()[yt],ae=gt.getCoordinates()[yt+1],dn=Bt.getCoordinates()[kt],Wn=Bt.getCoordinates()[kt+1];if(this._li.computeIntersection(Jt,ae,dn,Wn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Jt,ae)||this.hasInteriorIntersection(this._li,dn,Wn)))throw new Vt("found non-noded intersection at "+Jt+"-"+ae+" and "+dn+"-"+Wn)}},Ji.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ji.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])},Ji.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},Ji.prototype.checkCollapse=function(r,o,a){if(r.equals(a))throw new Vt("found non-noded collapse at "+Ji.fact.createLineString([r,o,a]))},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ix.fact.get=function(){return new ge},Object.defineProperties(Ji,Ix);var kr=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)},Px={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};kr.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),g=Math.max(r.y,o.y),w=this._maxx<a||this._minx>l||this._maxy<h||this._miny>g;if(w)return!1;var C=this.intersectsToleranceSquare(r,o);return Pt.isTrue(!(w&&C),"Found bad envelope test"),C},kr.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)},kr.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))},kr.prototype.scale=function(r){return Math.round(r*this._scaleFactor)},kr.prototype.getCoordinate=function(){return this._originalPt},kr.prototype.copyScaled=function(r,o){o.x=this.scale(r.x),o.y=this.scale(r.y)},kr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var r=kr.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},kr.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())))},kr.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))))},kr.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)},kr.prototype.interfaces_=function(){return[]},kr.prototype.getClass=function(){return kr},Px.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(kr,Px);var Ql=function(){this.tempEnv1=new Ct,this.selectedSegment=new se};Ql.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)}}},Ql.prototype.interfaces_=function(){return[]},Ql.prototype.getClass=function(){return Ql};var gu=function(){this._index=null;var r=arguments[0];this._index=r},Rx={HotPixelSnapAction:{configurable:!0}};gu.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(),g=new Lx(o,a,l);return this._index.query(h,{interfaces_:function(){return[es]},visitItem:function(w){w.select(h,g)}}),g.isNodeAdded()}},gu.prototype.interfaces_=function(){return[]},gu.prototype.getClass=function(){return gu},Rx.HotPixelSnapAction.get=function(){return Lx},Object.defineProperties(gu,Rx);var Lx=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}(Ql),Ea=function(){this._li=null,this._interiorIntersections=null;var r=arguments[0];this._li=r,this._interiorIntersections=new O};Ea.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;var h=r.getCoordinates()[o],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];if(this._li.computeIntersection(h,g,w,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var B=0;B<this._li.getIntersectionNum();B++)this._interiorIntersections.add(this._li.getIntersection(B));r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1)}},Ea.prototype.isDone=function(){return!1},Ea.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ea.prototype.interfaces_=function(){return[Ns]},Ea.prototype.getClass=function(){return Ea};var co=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()};co.prototype.checkCorrectness=function(r){var o=Dn.getNodedSubstrings(r),a=new Ji(o);try{a.checkValid()}catch(l){if(!(l instanceof qt))throw l;l.printStackTrace()}},co.prototype.getNodedSubstrings=function(){return Dn.getNodedSubstrings(this._nodedSegStrings)},co.prototype.snapRound=function(r,o){var a=this.findInteriorIntersections(r,o);this.computeIntersectionSnaps(a),this.computeVertexSnaps(r)},co.prototype.findInteriorIntersections=function(r,o){var a=new Ea(o);return this._noder.setSegmentIntersector(a),this._noder.computeNodes(r),a.getInteriorIntersections()},co.prototype.computeVertexSnaps=function(){if(Y(arguments[0],tt))for(var r=arguments[0].iterator();r.hasNext();){var o=r.next();this.computeVertexSnaps(o)}else if(arguments[0]instanceof Dn)for(var a=arguments[0],l=a.getCoordinates(),h=0;h<l.length;h++){var g=new kr(l[h],this._scaleFactor,this._li);this._pointSnapper.snap(g,a,h)&&a.addIntersection(l[h],h)}},co.prototype.computeNodes=function(r){this._nodedSegStrings=r,this._noder=new Yd,this._pointSnapper=new gu(this._noder.getIndex()),this.snapRound(r,this._li)},co.prototype.computeIntersectionSnaps=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next(),l=new kr(a,this._scaleFactor,this._li);this._pointSnapper.snap(l)}},co.prototype.interfaces_=function(){return[Rs]},co.prototype.getClass=function(){return co};var sr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new je,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}},yu={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};sr.prototype.bufferFixedPrecision=function(r){var o=new is(new co(new _e(1)),r.getScale()),a=new Tr(this._bufParams);a.setWorkingPrecisionModel(r),a.setNoder(o),this._resultGeometry=a.buffer(this._argGeom,this._distance)},sr.prototype.bufferReducedPrecision=function(){var r=this;if(arguments.length===0){for(var o=sr.MAX_PRECISION_DIGITS;o>=0;o--){try{r.bufferReducedPrecision(o)}catch(g){if(!(g instanceof Oo))throw g;r._saveException=g}if(r._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],l=sr.precisionScaleFactor(this._argGeom,this._distance,a),h=new _e(l);this.bufferFixedPrecision(h)}},sr.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()},sr.prototype.setQuadrantSegments=function(r){this._bufParams.setQuadrantSegments(r)},sr.prototype.bufferOriginalPrecision=function(){try{var r=new Tr(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(o){if(!(o instanceof Vt))throw o;this._saveException=o}},sr.prototype.getResultGeometry=function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry},sr.prototype.setEndCapStyle=function(r){this._bufParams.setEndCapStyle(r)},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr},sr.bufferOp=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new sr(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],g=new sr(a);return g.setQuadrantSegments(h),g.getResultGeometry(l)}if(arguments[2]instanceof je&&arguments[0]instanceof Rt&&typeof arguments[1]=="number"){var w=arguments[0],C=arguments[1],B=arguments[2];return new sr(w,B).getResultGeometry(C)}}else if(arguments.length===4){var K=arguments[0],gt=arguments[1],yt=arguments[2],Bt=arguments[3],kt=new sr(K);return kt.setQuadrantSegments(yt),kt.setEndCapStyle(Bt),kt.getResultGeometry(gt)}},sr.precisionScaleFactor=function(r,o,a){var l=r.getEnvelopeInternal(),h=mt.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(o>0?o:0),g=a-Math.trunc(Math.log(h)/Math.log(10)+1);return Math.pow(10,g)},yu.CAP_ROUND.get=function(){return je.CAP_ROUND},yu.CAP_BUTT.get=function(){return je.CAP_FLAT},yu.CAP_FLAT.get=function(){return je.CAP_FLAT},yu.CAP_SQUARE.get=function(){return je.CAP_SQUARE},yu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(sr,yu);var Cr=function(){this._pt=[new P,new P],this._distance=S.NaN,this._isNull=!0};Cr.prototype.getCoordinates=function(){return this._pt},Cr.prototype.getCoordinate=function(r){return this._pt[r]},Cr.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)}},Cr.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}},Cr.prototype.getDistance=function(){return this._distance},Cr.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)}},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr};var fo=function(){};fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo},fo.computeDistance=function(){if(arguments[2]instanceof Cr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=r.getCoordinates(),h=new se,g=0;g<l.length-1;g++){h.setCoordinates(l[g],l[g+1]);var w=h.closestPoint(o);a.setMinimum(w,o)}else if(arguments[2]instanceof Cr&&arguments[0]instanceof ne&&arguments[1]instanceof P){var C=arguments[0],B=arguments[1],K=arguments[2];fo.computeDistance(C.getExteriorRing(),B,K);for(var gt=0;gt<C.getNumInteriorRing();gt++)fo.computeDistance(C.getInteriorRingN(gt),B,K)}else if(arguments[2]instanceof Cr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],Bt=arguments[1],kt=arguments[2];if(yt instanceof ut)fo.computeDistance(yt,Bt,kt);else if(yt instanceof ne)fo.computeDistance(yt,Bt,kt);else if(yt instanceof En)for(var Jt=yt,ae=0;ae<Jt.getNumGeometries();ae++){var dn=Jt.getGeometryN(ae);fo.computeDistance(dn,Bt,kt)}else kt.setMinimum(yt.getCoordinate(),Bt)}else if(arguments[2]instanceof Cr&&arguments[0]instanceof se&&arguments[1]instanceof P){var Wn=arguments[0],Lr=arguments[1],go=arguments[2],fs=Wn.closestPoint(Lr);go.setMinimum(fs,Lr)}};var Ds=function(r){this._maxPtDist=new Cr,this._inputGeom=r||null},$d={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Ds.prototype.computeMaxMidpointDistance=function(r){var o=new os(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Ds.prototype.computeMaxVertexDistance=function(r){var o=new wa(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Ds.prototype.findDistance=function(r){return this.computeMaxVertexDistance(r),this.computeMaxMidpointDistance(r),this._maxPtDist.getDistance()},Ds.prototype.getDistancePoints=function(){return this._maxPtDist},Ds.prototype.interfaces_=function(){return[]},Ds.prototype.getClass=function(){return Ds},$d.MaxPointDistanceFilter.get=function(){return wa},$d.MaxMidpointDistanceFilter.get=function(){return os},Object.defineProperties(Ds,$d);var wa=function(r){this._maxPtDist=new Cr,this._minPtDist=new Cr,this._geom=r||null};wa.prototype.filter=function(r){this._minPtDist.initialize(),fo.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},wa.prototype.getMaxPointDistance=function(){return this._maxPtDist},wa.prototype.interfaces_=function(){return[j]},wa.prototype.getClass=function(){return wa};var os=function(r){this._maxPtDist=new Cr,this._minPtDist=new Cr,this._geom=r||null};os.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(),fo.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},os.prototype.isDone=function(){return!1},os.prototype.isGeometryChanged=function(){return!1},os.prototype.getMaxPointDistance=function(){return this._maxPtDist},os.prototype.interfaces_=function(){return[Tn]},os.prototype.getClass=function(){return os};var Bo=function(r){this._comps=r||null};Bo.prototype.filter=function(r){r instanceof ne&&this._comps.add(r)},Bo.prototype.interfaces_=function(){return[Rn]},Bo.prototype.getClass=function(){return Bo},Bo.getPolygons=function(){if(arguments.length===1){var r=arguments[0];return Bo.getPolygons(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof ne?a.add(o):o instanceof En&&o.apply(new Bo(a)),a}};var ar=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}};ar.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)},ar.prototype.setForceToLineString=function(r){this._isForcedToLineString=r},ar.prototype.interfaces_=function(){return[ce]},ar.prototype.getClass=function(){return ar},ar.getGeometry=function(){if(arguments.length===1){var r=arguments[0];return r.getFactory().buildGeometry(ar.getLines(r))}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o.getFactory().buildGeometry(ar.getLines(o,a))}},ar.getLines=function(){if(arguments.length===1){var r=arguments[0];return ar.getLines(r,!1)}if(arguments.length===2){if(Y(arguments[0],tt)&&Y(arguments[1],tt)){for(var o=arguments[0],a=arguments[1],l=o.iterator();l.hasNext();){var h=l.next();ar.getLines(h,a)}return a}if(arguments[0]instanceof Rt&&typeof arguments[1]=="boolean"){var g=arguments[0],w=arguments[1],C=new O;return g.apply(new ar(C,w)),C}if(arguments[0]instanceof Rt&&Y(arguments[1],tt)){var B=arguments[0],K=arguments[1];return B instanceof ut?K.add(B):B.apply(new ar(K)),K}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&Y(arguments[0],tt)&&Y(arguments[1],tt)){for(var gt=arguments[0],yt=arguments[1],Bt=arguments[2],kt=gt.iterator();kt.hasNext();){var Jt=kt.next();ar.getLines(Jt,yt,Bt)}return yt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Rt&&Y(arguments[1],tt)){var ae=arguments[0],dn=arguments[1],Wn=arguments[2];return ae.apply(new ar(dn,Wn)),dn}}};var Bi=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}}};Bi.prototype.locateInternal=function(){if(arguments[0]instanceof P&&arguments[1]instanceof ne){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 g=o.getInteriorRingN(h),w=this.locateInPolygonRing(r,g);if(w===V.INTERIOR)return V.EXTERIOR;if(w===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof P&&arguments[1]instanceof ut){var C=arguments[0],B=arguments[1];if(!B.getEnvelopeInternal().intersects(C))return V.EXTERIOR;var K=B.getCoordinates();return B.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 Qt){var gt=arguments[0];return arguments[1].getCoordinate().equals2D(gt)?V.INTERIOR:V.EXTERIOR}},Bi.prototype.locateInPolygonRing=function(r,o){return o.getEnvelopeInternal().intersects(r)?ot.locatePointInRing(r,o.getCoordinates()):V.EXTERIOR},Bi.prototype.intersects=function(r,o){return this.locate(r,o)!==V.EXTERIOR},Bi.prototype.updateLocationInfo=function(r){r===V.INTERIOR&&(this._isIn=!0),r===V.BOUNDARY&&this._numBoundaries++},Bi.prototype.computeLocation=function(r,o){if(o instanceof Qt&&this.updateLocationInfo(this.locateInternal(r,o)),o instanceof ut)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof ne)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof Jr)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 g=o,w=0;w<g.getNumGeometries();w++){var C=g.getGeometryN(w);this.updateLocationInfo(this.locateInternal(r,C))}else if(o instanceof En)for(var B=new uo(o);B.hasNext();){var K=B.next();K!==o&&this.computeLocation(r,K)}},Bi.prototype.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:o instanceof ut?this.locateInternal(r,o):o instanceof ne?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)},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var Ir=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],g=arguments[2];this._component=l,this._segIndex=h,this._pt=g}},Nx={INSIDE_AREA:{configurable:!0}};Ir.prototype.isInsideArea=function(){return this._segIndex===Ir.INSIDE_AREA},Ir.prototype.getCoordinate=function(){return this._pt},Ir.prototype.getGeometryComponent=function(){return this._component},Ir.prototype.getSegmentIndex=function(){return this._segIndex},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir},Nx.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Ir,Nx);var ss=function(r){this._pts=r||null};ss.prototype.filter=function(r){r instanceof Qt&&this._pts.add(r)},ss.prototype.interfaces_=function(){return[Rn]},ss.prototype.getClass=function(){return ss},ss.getPoints=function(){if(arguments.length===1){var r=arguments[0];return r instanceof Qt?Fi.singletonList(r):ss.getPoints(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof Qt?a.add(o):o instanceof En&&o.apply(new ss(a)),a}};var Sa=function(){this._locations=null;var r=arguments[0];this._locations=r};Sa.prototype.filter=function(r){(r instanceof Qt||r instanceof ut||r instanceof ne)&&this._locations.add(new Ir(r,0,r.getCoordinate()))},Sa.prototype.interfaces_=function(){return[Rn]},Sa.prototype.getClass=function(){return Sa},Sa.getLocations=function(r){var o=new O;return r.apply(new Sa(o)),o};var ur=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Bi,this._minDistanceLocation=null,this._minDistance=S.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}};ur.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=Bo.getPolygons(this._geom[o]);if(h.size()>0){var g=Sa.getLocations(this._geom[l]);if(this.computeContainmentDistance(g,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&&Y(arguments[0],ht)&&Y(arguments[1],ht)){for(var w=arguments[0],C=arguments[1],B=arguments[2],K=0;K<w.size();K++)for(var gt=w.get(K),yt=0;yt<C.size();yt++)if(this.computeContainmentDistance(gt,C.get(yt),B),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ir&&arguments[1]instanceof ne){var Bt=arguments[0],kt=arguments[1],Jt=arguments[2],ae=Bt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(ae,kt))return this._minDistance=0,Jt[0]=Bt,Jt[1]=new Ir(kt,ae),null}}},ur.prototype.computeMinDistanceLinesPoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),g=0;g<o.size();g++){var w=o.get(g);if(this.computeMinDistance(h,w,a),this._minDistance<=this._terminateDistance)return null}},ur.prototype.computeFacetDistance=function(){var r=new Array(2).fill(null),o=ar.getLines(this._geom[0]),a=ar.getLines(this._geom[1]),l=ss.getPoints(this._geom[0]),h=ss.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))))},ur.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},ur.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])},ur.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},ur.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 Qt){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(),g=0;g<l.length-1;g++){var w=ot.distancePointLine(h,l[g],l[g+1]);if(w<this._minDistance){this._minDistance=w;var C=new se(l[g],l[g+1]).closestPoint(h);a[0]=new Ir(r,g,C),a[1]=new Ir(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 B=arguments[0],K=arguments[1],gt=arguments[2];if(B.getEnvelopeInternal().distance(K.getEnvelopeInternal())>this._minDistance)return null;for(var yt=B.getCoordinates(),Bt=K.getCoordinates(),kt=0;kt<yt.length-1;kt++)for(var Jt=0;Jt<Bt.length-1;Jt++){var ae=ot.distanceLineLine(yt[kt],yt[kt+1],Bt[Jt],Bt[Jt+1]);if(ae<this._minDistance){this._minDistance=ae;var dn=new se(yt[kt],yt[kt+1]),Wn=new se(Bt[Jt],Bt[Jt+1]),Lr=dn.closestPoints(Wn);gt[0]=new Ir(B,kt,Lr[0]),gt[1]=new Ir(K,Jt,Lr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},ur.prototype.computeMinDistancePoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),g=0;g<o.size();g++){var w=o.get(g),C=h.getCoordinate().distance(w.getCoordinate());if(C<this._minDistance&&(this._minDistance=C,a[0]=new Ir(h,0,h.getCoordinate()),a[1]=new Ir(w,0,w.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},ur.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)},ur.prototype.computeMinDistanceLines=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),g=0;g<o.size();g++){var w=o.get(g);if(this.computeMinDistance(h,w,a),this._minDistance<=this._terminateDistance)return null}},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.distance=function(r,o){return new ur(r,o).distance()},ur.isWithinDistance=function(r,o,a){return new ur(r,o,a).distance()<=a},ur.nearestPoints=function(r,o){return new ur(r,o).nearestPoints()};var gr=function(){this._pt=[new P,new P],this._distance=S.NaN,this._isNull=!0};gr.prototype.getCoordinates=function(){return this._pt},gr.prototype.getCoordinate=function(r){return this._pt[r]},gr.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)}},gr.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}},gr.prototype.toString=function(){return St.toLineString(this._pt[0],this._pt[1])},gr.prototype.getDistance=function(){return this._distance},gr.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)}},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr};var ji=function(){};ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji},ji.computeDistance=function(){if(arguments[2]instanceof gr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=new se,h=r.getCoordinates(),g=0;g<h.length-1;g++){l.setCoordinates(h[g],h[g+1]);var w=l.closestPoint(o);a.setMinimum(w,o)}else if(arguments[2]instanceof gr&&arguments[0]instanceof ne&&arguments[1]instanceof P){var C=arguments[0],B=arguments[1],K=arguments[2];ji.computeDistance(C.getExteriorRing(),B,K);for(var gt=0;gt<C.getNumInteriorRing();gt++)ji.computeDistance(C.getInteriorRingN(gt),B,K)}else if(arguments[2]instanceof gr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],Bt=arguments[1],kt=arguments[2];if(yt instanceof ut)ji.computeDistance(yt,Bt,kt);else if(yt instanceof ne)ji.computeDistance(yt,Bt,kt);else if(yt instanceof En)for(var Jt=yt,ae=0;ae<Jt.getNumGeometries();ae++){var dn=Jt.getGeometryN(ae);ji.computeDistance(dn,Bt,kt)}else kt.setMinimum(yt.getCoordinate(),Bt)}else if(arguments[2]instanceof gr&&arguments[0]instanceof se&&arguments[1]instanceof P){var Wn=arguments[0],Lr=arguments[1],go=arguments[2],fs=Wn.closestPoint(Lr);go.setMinimum(fs,Lr)}};var Ti=function(){this._g0=null,this._g1=null,this._ptDist=new gr,this._densifyFrac=0;var r=arguments[0],o=arguments[1];this._g0=r,this._g1=o},Zd={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Ti.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Ti.prototype.setDensifyFraction=function(r){if(r>1||r<=0)throw new T("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=r},Ti.prototype.compute=function(r,o){this.computeOrientedDistance(r,o,this._ptDist),this.computeOrientedDistance(o,r,this._ptDist)},Ti.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Ti.prototype.computeOrientedDistance=function(r,o,a){var l=new Ma(o);if(r.apply(l),a.setMaximum(l.getMaxPointDistance()),this._densifyFrac>0){var h=new as(o,this._densifyFrac);r.apply(h),a.setMaximum(h.getMaxPointDistance())}},Ti.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.distance=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new Ti(r,o).distance()}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2],g=new Ti(a,l);return g.setDensifyFraction(h),g.distance()}},Zd.MaxPointDistanceFilter.get=function(){return Ma},Zd.MaxDensifiedByFractionDistanceFilter.get=function(){return as},Object.defineProperties(Ti,Zd);var Ma=function(){this._maxPtDist=new gr,this._minPtDist=new gr,this._euclideanDist=new ji,this._geom=null;var r=arguments[0];this._geom=r};Ma.prototype.filter=function(r){this._minPtDist.initialize(),ji.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ma.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ma.prototype.interfaces_=function(){return[j]},Ma.prototype.getClass=function(){return Ma};var as=function(){this._maxPtDist=new gr,this._minPtDist=new gr,this._geom=null,this._numSubSegs=0;var r=arguments[0],o=arguments[1];this._geom=r,this._numSubSegs=Math.trunc(Math.round(1/o))};as.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,g=(l.y-a.y)/this._numSubSegs,w=0;w<this._numSubSegs;w++){var C=a.x+w*h,B=a.y+w*g,K=new P(C,B);this._minPtDist.initialize(),ji.computeDistance(this._geom,K,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},as.prototype.isDone=function(){return!1},as.prototype.isGeometryChanged=function(){return!1},as.prototype.getMaxPointDistance=function(){return this._maxPtDist},as.prototype.interfaces_=function(){return[Tn]},as.prototype.getClass=function(){return as};var Qr=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},Jd={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Qr.prototype.checkMaximumDistance=function(r,o,a){var l=new Ti(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 "+St.toLineString(h[0],h[1])+")"}},Qr.prototype.isValid=function(){var r=Math.abs(this._bufDistance),o=Qr.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(),Qr.VERBOSE&&Ft.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Qr.prototype.checkNegativeValid=function(){if(!(this._input instanceof ne||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)},Qr.prototype.getErrorIndicator=function(){return this._errorIndicator},Qr.prototype.checkMinimumDistance=function(r,o,a){var l=new ur(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 "+St.toLineString(h[0],h[1])+" )"}},Qr.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)},Qr.prototype.getErrorLocation=function(){return this._errorLocation},Qr.prototype.getPolygonLines=function(r){for(var o=new O,a=new ar(o),l=Bo.getPolygons(r).iterator();l.hasNext();)l.next().apply(a);return r.getFactory().buildGeometry(o)},Qr.prototype.getErrorMessage=function(){return this._errMsg},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr},Jd.VERBOSE.get=function(){return!1},Jd.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Qr,Jd);var lr=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},jd={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};lr.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},lr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var r=this._distance*lr.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")},lr.prototype.checkDistance=function(){var r=new Qr(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")},lr.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")},lr.prototype.checkPolygonal=function(){this._result instanceof ne||this._result instanceof he||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},lr.prototype.getErrorIndicator=function(){return this._errorIndicator},lr.prototype.getErrorLocation=function(){return this._errorLocation},lr.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"))},lr.prototype.report=function(r){if(!lr.VERBOSE)return null;Ft.out.println("Check "+r+": "+(this._isValid?"passed":"FAILED"))},lr.prototype.getErrorMessage=function(){return this._errorMsg},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.isValidMsg=function(r,o,a){var l=new lr(r,o,a);return l.isValid()?null:l.getErrorMessage()},lr.isValid=function(r,o,a){return!!new lr(r,o,a).isValid()},jd.VERBOSE.get=function(){return!1},jd.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(lr,jd);var Ki=function(){this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};Ki.prototype.getCoordinates=function(){return this._pts},Ki.prototype.size=function(){return this._pts.length},Ki.prototype.getCoordinate=function(r){return this._pts[r]},Ki.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ki.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:va.octant(this.getCoordinate(r),this.getCoordinate(r+1))},Ki.prototype.setData=function(r){this._data=r},Ki.prototype.getData=function(){return this._data},Ki.prototype.toString=function(){return St.toLineString(new oe(this._pts))},Ki.prototype.interfaces_=function(){return[ao]},Ki.prototype.getClass=function(){return Ki};var nr=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};nr.prototype.getInteriorIntersection=function(){return this._interiorIntersection},nr.prototype.setCheckEndSegmentsOnly=function(r){this._isCheckEndSegmentsOnly=r},nr.prototype.getIntersectionSegments=function(){return this._intSegments},nr.prototype.count=function(){return this._intersectionCount},nr.prototype.getIntersections=function(){return this._intersections},nr.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},nr.prototype.setKeepIntersections=function(r){this._keepIntersections=r},nr.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],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,g,w,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=h,this._intSegments[1]=g,this._intSegments[2]=w,this._intSegments[3]=C,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},nr.prototype.isEndSegment=function(r,o){return o===0||o>=r.size()-2},nr.prototype.hasIntersection=function(){return this._interiorIntersection!==null},nr.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},nr.prototype.interfaces_=function(){return[Ns]},nr.prototype.getClass=function(){return nr},nr.createAllIntersectionsFinder=function(r){var o=new nr(r);return o.setFindAllIntersections(!0),o},nr.createAnyIntersectionFinder=function(r){return new nr(r)},nr.createIntersectionCounter=function(r){var o=new nr(r);return o.setFindAllIntersections(!0),o.setKeepIntersections(!1),o};var zi=function(){this._li=new N,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var r=arguments[0];this._segStrings=r};zi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},zi.prototype.getIntersections=function(){return this._segInt.getIntersections()},zi.prototype.isValid=function(){return this.execute(),this._isValid},zi.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},zi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new nr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var r=new Yd;if(r.setSegmentIntersector(this._segInt),r.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},zi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Oo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},zi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var r=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+St.toLineString(r[0],r[1])+" and "+St.toLineString(r[2],r[3])},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi},zi.computeIntersections=function(r){var o=new zi(r);return o.setFindAllIntersections(!0),o.isValid(),o.getIntersections()};var Fs=function r(){this._nv=null;var o=arguments[0];this._nv=new zi(r.toSegmentStrings(o))};Fs.prototype.checkValid=function(){this._nv.checkValid()},Fs.prototype.interfaces_=function(){return[]},Fs.prototype.getClass=function(){return Fs},Fs.toSegmentStrings=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new Ki(l.getCoordinates(),l))}return o},Fs.checkValid=function(r){new Fs(r).checkValid()};var ba=function(r){this._mapOp=r};ba.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(ge.toGeometryArray(o))},ba.prototype.interfaces_=function(){return[]},ba.prototype.getClass=function(){return ba},ba.map=function(r,o){return new ba(o).map(r)};var Qi=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};Qi.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)}},Qi.prototype.labelIsolatedLine=function(r,o){var a=this._ptLocator.locate(r.getCoordinate(),this._op.getArgGeometry(o));r.getLabel().setLocation(o,a)},Qi.prototype.build=function(r){return this.findCoveredLineEdges(),this.collectLines(r),this.buildLines(r),this._resultLineList},Qi.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)))},Qi.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)}}},Qi.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))}},Qi.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)}},Qi.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))))},Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi};var Aa=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new O;var r=arguments[0],o=arguments[1];this._op=r,this._geometryFactory=o};Aa.prototype.filterCoveredNodeToPoint=function(r){var o=r.getCoordinate();if(!this._op.isCoveredByLA(o)){var a=this._geometryFactory.createPoint(o);this._resultPointList.add(a)}},Aa.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)}}},Aa.prototype.build=function(r){return this.extractNonCoveredResultNodes(r),this._resultPointList},Aa.prototype.interfaces_=function(){return[]},Aa.prototype.getClass=function(){return Aa};var qr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};qr.prototype.transformPoint=function(r,o){return this._factory.createPoint(this.transformCoordinates(r.getCoordinateSequence(),r))},qr.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,g=0;g<r.getNumInteriorRing();g++){var w=this.transformLinearRing(r.getInteriorRingN(g),r);w===null||w.isEmpty()||(w instanceof fe||(a=!1),h.add(w))}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)},qr.prototype.createCoordinateSequence=function(r){return this._factory.getCoordinateSequenceFactory().create(r)},qr.prototype.getInputGeometry=function(){return this._inputGeom},qr.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)},qr.prototype.transformCoordinates=function(r,o){return this.copy(r)},qr.prototype.transformLineString=function(r,o){return this._factory.createLineString(this.transformCoordinates(r.getCoordinateSequence(),r))},qr.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)},qr.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)},qr.prototype.copy=function(r){return r.copy()},qr.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(ge.toGeometryArray(a)):this._factory.buildGeometry(a)},qr.prototype.transform=function(r){if(this._inputGeom=r,this._factory=r.getFactory(),r instanceof Qt)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 Jr)return this.transformMultiLineString(r,null);if(r instanceof ne)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())},qr.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)},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr};var ho=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new se,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}};ho.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),g=this.findSnapForVertex(h,o);g!==null&&(r.set(l,new P(g)),l===0&&this._isClosed&&r.set(r.size()-1,new P(g)))}},ho.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},ho.prototype.snapTo=function(r){var o=new J(this._srcPts);return this.snapVertices(o,r),this.snapSegments(o,r),o.toCoordinateArray()},ho.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],g=this.findSegmentIndexToSnap(h,r);g>=0&&r.add(g+1,new P(h),!1)}},ho.prototype.findSegmentIndexToSnap=function(r,o){for(var a=S.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 g=this._seg.distance(r);g<this._snapTolerance&&g<a&&(a=g,l=h)}return l},ho.prototype.setAllowSnappingToSourceVertices=function(r){this._allowSnappingToSourceVertices=r},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho},ho.isClosed=function(r){return!(r.length<=1)&&r[0].equals2D(r[r.length-1])};var Fn=function(r){this._srcGeom=r||null},Ox={SNAP_PRECISION_FACTOR:{configurable:!0}};Fn.prototype.snapTo=function(r,o){var a=this.extractTargetCoordinates(r);return new Dx(o,a).transform(this._srcGeom)},Fn.prototype.snapToSelf=function(r,o){var a=this.extractTargetCoordinates(this._srcGeom),l=new Dx(r,a,!0).transform(this._srcGeom),h=l;return o&&Y(h,le)&&(h=l.buffer(0)),h},Fn.prototype.computeSnapTolerance=function(r){return this.computeMinimumSegmentLength(r)/10},Fn.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))},Fn.prototype.computeMinimumSegmentLength=function(r){for(var o=S.MAX_VALUE,a=0;a<r.length-1;a++){var l=r[a].distance(r[a+1]);l<o&&(o=l)}return o},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.snap=function(r,o,a){var l=new Array(2).fill(null),h=new Fn(r);l[0]=h.snapTo(o,a);var g=new Fn(o);return l[1]=g.snapTo(l[0],a),l},Fn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var r=arguments[0],o=Fn.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],g=arguments[1];return Math.min(Fn.computeOverlaySnapTolerance(h),Fn.computeOverlaySnapTolerance(g))}},Fn.computeSizeBasedSnapTolerance=function(r){var o=r.getEnvelopeInternal();return Math.min(o.getHeight(),o.getWidth())*Fn.SNAP_PRECISION_FACTOR},Fn.snapToSelf=function(r,o,a){return new Fn(r).snapToSelf(o,a)},Ox.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Fn,Ox);var Dx=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 ho(a,this._snapTolerance);return h.setAllowSnappingToSourceVertices(this._isSelfSnap),h.snapTo(l)},o.prototype.transformCoordinates=function(a,l){var h=a.toCoordinateArray(),g=this.snapLine(h,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(g)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(qr),Pr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Pr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},Pr.prototype.add=function(r){var o=S.doubleToLongBits(r);if(this._isFirst)return this._commonBits=o,this._commonSignExp=Pr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Pr.signExpBits(o)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Pr.numCommonMostSigMantissaBits(this._commonBits,o),this._commonBits=Pr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Pr.prototype.toString=function(){if(arguments.length===1){var r=arguments[0],o=S.longBitsToDouble(r),a="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(r),l=a.substring(a.length-64);return l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+o+" ]"}},Pr.prototype.interfaces_=function(){return[]},Pr.prototype.getClass=function(){return Pr},Pr.getBit=function(r,o){return r&1<<o?1:0},Pr.signExpBits=function(r){return r>>52},Pr.zeroLowerBits=function(r,o){return r&~((1<<o)-1)},Pr.numCommonMostSigMantissaBits=function(r,o){for(var a=0,l=52;l>=0;l--){if(Pr.getBit(r,l)!==Pr.getBit(o,l))return a;a++}return 52};var us=function(){this._commonCoord=null,this._ccFilter=new Ta},Kd={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};us.prototype.addCommonBits=function(r){var o=new ls(this._commonCoord);r.apply(o),r.geometryChanged()},us.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 ls(o);return r.apply(a),r.geometryChanged(),r},us.prototype.getCommonCoordinate=function(){return this._commonCoord},us.prototype.add=function(r){r.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us},Kd.CommonCoordinateFilter.get=function(){return Ta},Kd.Translater.get=function(){return ls},Object.defineProperties(us,Kd);var Ta=function(){this._commonBitsX=new Pr,this._commonBitsY=new Pr};Ta.prototype.filter=function(r){this._commonBitsX.add(r.x),this._commonBitsY.add(r.y)},Ta.prototype.getCommonCoordinate=function(){return new P(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ta.prototype.interfaces_=function(){return[j]},Ta.prototype.getClass=function(){return Ta};var ls=function(){this.trans=null;var r=arguments[0];this.trans=r};ls.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)},ls.prototype.isDone=function(){return!1},ls.prototype.isGeometryChanged=function(){return!0},ls.prototype.interfaces_=function(){return[Tn]},ls.prototype.getClass=function(){return ls};var rr=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()};rr.prototype.selfSnap=function(r){return new Fn(r).snapTo(r,this._snapTolerance)},rr.prototype.removeCommonBits=function(r){this._cbr=new us,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},rr.prototype.prepareResult=function(r){return this._cbr.addCommonBits(r),r},rr.prototype.getResultGeometry=function(r){var o=this.snap(this._geom),a=de.overlayOp(o[0],o[1],r);return this.prepareResult(a)},rr.prototype.checkValid=function(r){r.isValid()||Ft.out.println("Snapped geometry is invalid")},rr.prototype.computeSnapTolerance=function(){this._snapTolerance=Fn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},rr.prototype.snap=function(r){var o=this.removeCommonBits(r);return Fn.snap(o[0],o[1],this._snapTolerance)},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.overlayOp=function(r,o,a){return new rr(r,o).getResultGeometry(a)},rr.union=function(r,o){return rr.overlayOp(r,o,de.UNION)},rr.intersection=function(r,o){return rr.overlayOp(r,o,de.INTERSECTION)},rr.symDifference=function(r,o){return rr.overlayOp(r,o,de.SYMDIFFERENCE)},rr.difference=function(r,o){return rr.overlayOp(r,o,de.DIFFERENCE)};var Rr=function(r,o){this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=o};Rr.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 Vt))throw h;l=h}if(!a)try{o=rr.overlayOp(this._geom[0],this._geom[1],r)}catch(h){throw h instanceof Vt?l:h}return o},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.overlayOp=function(r,o,a){return new Rr(r,o).getResultGeometry(a)},Rr.union=function(r,o){return Rr.overlayOp(r,o,de.UNION)},Rr.intersection=function(r,o){return Rr.overlayOp(r,o,de.INTERSECTION)},Rr.symDifference=function(r,o){return Rr.overlayOp(r,o,de.SYMDIFFERENCE)},Rr.difference=function(r,o){return Rr.overlayOp(r,o,de.DIFFERENCE)};var tc=function(){this.mce=null,this.chainIndex=null;var r=arguments[0],o=arguments[1];this.mce=r,this.chainIndex=o};tc.prototype.computeIntersections=function(r,o){this.mce.computeIntersectsForChain(this.chainIndex,r.mce,r.chainIndex,o)},tc.prototype.interfaces_=function(){return[]},tc.prototype.getClass=function(){return tc};var ti=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],g=arguments[2];this._eventType=r.INSERT,this._label=l,this._xValue=h,this._obj=g}},Qd={INSERT:{configurable:!0},DELETE:{configurable:!0}};ti.prototype.isDelete=function(){return this._eventType===ti.DELETE},ti.prototype.setDeleteEventIndex=function(r){this._deleteEventIndex=r},ti.prototype.getObject=function(){return this._obj},ti.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},ti.prototype.getInsertEvent=function(){return this._insertEvent},ti.prototype.isInsert=function(){return this._eventType===ti.INSERT},ti.prototype.isSameLabel=function(r){return this._label!==null&&this._label===r._label},ti.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ti.prototype.interfaces_=function(){return[z]},ti.prototype.getClass=function(){return ti},Qd.INSERT.get=function(){return 1},Qd.DELETE.get=function(){return 2},Object.defineProperties(ti,Qd);var Af=function(){};Af.prototype.interfaces_=function(){return[]},Af.prototype.getClass=function(){return Af};var cr=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};cr.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(cr.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},cr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cr.prototype.setIsDoneIfProperInt=function(r){this._isDoneWhenProperInt=r},cr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cr.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},cr.prototype.hasProperIntersection=function(){return this._hasProper},cr.prototype.hasIntersection=function(){return this._hasIntersection},cr.prototype.isDone=function(){return this._isDone},cr.prototype.isBoundaryPoint=function(r,o){return o!==null&&(!!this.isBoundaryPointInternal(r,o[0])||!!this.isBoundaryPointInternal(r,o[1]))},cr.prototype.setBoundaryNodes=function(r,o){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=r,this._bdyNodes[1]=o},cr.prototype.addIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,g,w,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))))},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var c2=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(){Fi.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 cr&&Y(arguments[0],ht)&&Y(arguments[1],ht)){var g=arguments[0],w=arguments[1],C=arguments[2];this.addEdges(g,g),this.addEdges(w,w),this.computeIntersections(C)}else if(typeof arguments[2]=="boolean"&&Y(arguments[0],ht)&&arguments[1]instanceof cr){var B=arguments[0],K=arguments[1];arguments[2]?this.addEdges(B,null):this.addEdges(B),this.computeIntersections(K)}}},o.prototype.addEdge=function(a,l){for(var h=a.getMonotoneChainEdge(),g=h.getStartIndexes(),w=0;w<g.length-1;w++){var C=new tc(h,w),B=new ti(l,h.getMinX(w),C);this.events.add(B),this.events.add(new ti(h.getMaxX(w),B))}},o.prototype.processOverlaps=function(a,l,h,g){for(var w=h.getObject(),C=a;C<l;C++){var B=this.events.get(C);if(B.isInsert()){var K=B.getObject();h.isSameLabel(B)||(w.computeIntersections(K,g),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],g=arguments[1],w=h.iterator();w.hasNext();){var C=w.next();this.addEdge(C,g)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Af),po=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},Fx={NodeComparator:{configurable:!0}};po.prototype.getMin=function(){return this._min},po.prototype.intersects=function(r,o){return!(this._min>o||this._max<r)},po.prototype.getMax=function(){return this._max},po.prototype.toString=function(){return St.toLineString(new P(this._min,0),new P(this._max,0))},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po},Fx.NodeComparator.get=function(){return ec},Object.defineProperties(po,Fx);var ec=function(){};ec.prototype.compare=function(r,o){var a=r,l=o,h=(a._min+a._max)/2,g=(l._min+l._max)/2;return h<g?-1:h>g?1:0},ec.prototype.interfaces_=function(){return[D]},ec.prototype.getClass=function(){return ec};var f2=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}(po),h2=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}(po),mo=function(){this._leaves=new O,this._root=null,this._level=0};mo.prototype.buildTree=function(){Fi.sort(this._leaves,new po.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}},mo.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 f2(r,o,a))},mo.prototype.query=function(r,o,a){this.init(),this._root.query(r,o,a)},mo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},mo.prototype.printNode=function(r){Ft.out.println(St.toLineString(new P(r._min,this._level),new P(r._max,this._level)))},mo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},mo.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 h2(r.get(a),r.get(a+1));o.add(h)}}},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo};var vu=function(){this._items=new O};vu.prototype.visitItem=function(r){this._items.add(r)},vu.prototype.getItems=function(){return this._items},vu.prototype.interfaces_=function(){return[es]},vu.prototype.getClass=function(){return vu};var _u=function(){this._index=null;var r=arguments[0];if(!Y(r,le))throw new T("Argument must be Polygonal");this._index=new Us(r)},tm={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};_u.prototype.locate=function(r){var o=new wt(r),a=new xu(o);return this._index.query(r.y,r.y,a),o.getLocation()},_u.prototype.interfaces_=function(){return[mu]},_u.prototype.getClass=function(){return _u},tm.SegmentVisitor.get=function(){return xu},tm.IntervalIndexedGeometry.get=function(){return Us},Object.defineProperties(_u,tm);var xu=function(){this._counter=null;var r=arguments[0];this._counter=r};xu.prototype.visitItem=function(r){var o=r;this._counter.countSegment(o.getCoordinate(0),o.getCoordinate(1))},xu.prototype.interfaces_=function(){return[es]},xu.prototype.getClass=function(){return xu};var Us=function(){this._index=new mo;var r=arguments[0];this.init(r)};Us.prototype.init=function(r){for(var o=ar.getLines(r).iterator();o.hasNext();){var a=o.next().getCoordinates();this.addLine(a)}},Us.prototype.addLine=function(r){for(var o=1;o<r.length;o++){var a=new se(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)}},Us.prototype.query=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=new vu;return this._index.query(r,o,a),a.getItems()}if(arguments.length===3){var l=arguments[0],h=arguments[1],g=arguments[2];this._index.query(l,h,g)}},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us};var nc=function(r){function o(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new Wl,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Bi,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 g=arguments[0],w=arguments[1],C=arguments[2];this._argIndex=g,this._parentGeom=w,this._boundaryNodeRule=C,w!==null&&this.add(w)}}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(),g=1;V.NONE,h.getLocation(a,Dt.ON)===V.BOUNDARY&&g++;var w=o.determineBoundary(this._boundaryNodeRule,g);h.setLocation(a,w)},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],g=arguments[1],w=arguments[2],C=new cr(h,!0,!1);C.setIsDoneIfProperInt(w);var B=this.createEdgeSetIntersector(),K=this._parentGeom instanceof fe||this._parentGeom instanceof ne||this._parentGeom instanceof he,gt=g||!K;return B.computeIntersections(this._edges,C,gt),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 g=new cr(l,h,!0);return g.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,g),g},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 Qt){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 bf(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,g=a.iterator();g.hasNext();){var w=g.next();l[h++]=w.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 g=et.removeRepeatedPoints(a.getCoordinates());if(g.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=g[0],null;var w=l,C=h;ot.isCCW(g)&&(w=h,C=l);var B=new bf(g,new pn(this._argIndex,V.BOUNDARY,w,C));this._lineEdgeMap.put(a,B),this.insertEdge(B),this.insertPoint(this._argIndex,g[0],V.BOUNDARY)},o.prototype.insertPoint=function(a,l,h){var g=this._nodes.addNode(l),w=g.getLabel();w===null?g._label=new pn(a,h):w.setLocation(a,h)},o.prototype.createEdgeSetIntersector=function(){return new c2},o.prototype.addSelfIntersectionNodes=function(a){for(var l=this._edges.iterator();l.hasNext();)for(var h=l.next(),g=h.getLabel().getLocation(a),w=h.eiList.iterator();w.hasNext();){var C=w.next();this.addSelfIntersectionNode(a,C.coord,g)}},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 ne)this.addPolygon(a);else if(a instanceof ut)this.addLineString(a);else if(a instanceof Qt)this.addPoint(a);else if(a instanceof ve)this.addCollection(a);else if(a instanceof Jr)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 Y(this._parentGeom,le)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new _u(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}(Ln),Eu=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 nc(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 nc(0,o,l),this._arg[1]=new nc(1,a,l)}else if(arguments.length===3){var h=arguments[0],g=arguments[1],w=arguments[2];h.getPrecisionModel().compareTo(g.getPrecisionModel())>=0?this.setComputationPrecision(h.getPrecisionModel()):this.setComputationPrecision(g.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new nc(0,h,w),this._arg[1]=new nc(1,g,w)}};Eu.prototype.getArgGeometry=function(r){return this._arg[r].getGeometry()},Eu.prototype.setComputationPrecision=function(r){this._resultPrecisionModel=r,this._li.setPrecisionModel(this._resultPrecisionModel)},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu};var Bs=function(){};Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs},Bs.map=function(){if(arguments[0]instanceof Rt&&Y(arguments[1],Bs.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(Y(arguments[0],tt)&&Y(arguments[1],Bs.MapOp)){for(var g=arguments[0],w=arguments[1],C=new O,B=g.iterator();B.hasNext();){var K=B.next(),gt=w.map(K);gt!==null&&C.add(gt)}return C}},Bs.MapOp=function(){};var de=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l),this._ptLocator=new Bi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Ui,this._resultPolyList=new O,this._resultLineList=new O,this._resultPointList=new O,this._graph=new Ln(new Tx),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(),g=a.getLabel();l.isPointwiseEqual(a)||(g=new pn(a.getLabel())).flip();var w=l.getDepth();w.isNull()&&w.add(h),w.add(g),h.merge(g)}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,g){var w=new O;return w.addAll(a),w.addAll(l),w.addAll(h),w.isEmpty()?o.createEmptyResult(g,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(w)},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 g=h.next();if(this._ptLocator.locate(a,g)!==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(),Fs.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var h=new jr(this._geomFact);h.add(this._graph),this._resultPolyList=h.getPolygons();var g=new Qi(this,this._geomFact,this._ptLocator);this._resultLineList=g.build(a);var w=new Aa(this,this._geomFact,this._ptLocator);this._resultPointList=w.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(),g=h.getLabel();g.isArea()&&!h.isInteriorAreaEdge()&&o.isResultOfOp(g.getLocation(0,Dt.RIGHT),g.getLocation(1,Dt.RIGHT),a)&&h.setInResult(!0)}},o.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var l=a.next(),h=l.getLabel(),g=l.getDepth();if(!g.isNull()){g.normalize();for(var w=0;w<2;w++)h.isNull(w)||!h.isArea()||g.isNull(w)||(g.getDelta(w)===0?h.toLine(w):(Pt.isTrue(!g.isNull(w,Dt.LEFT),"depth of LEFT side has not been initialized"),h.setLocation(w,Dt.LEFT,g.getLocation(w,Dt.LEFT)),Pt.isTrue(!g.isNull(w,Dt.RIGHT),"depth of RIGHT side has not been initialized"),h.setLocation(w,Dt.RIGHT,g.getLocation(w,Dt.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}(Eu);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 ba.map(r,{interfaces_:function(){return[Bs.MapOp]},map:function(l){return l.intersection(a)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Rr.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),Rr.overlayOp(r,o,de.SYMDIFFERENCE)},de.resultDimension=function(r,o,a){var l=o.getDimension(),h=a.getDimension(),g=-1;switch(r){case de.INTERSECTION:g=Math.min(l,h);break;case de.UNION:g=Math.max(l,h);break;case de.DIFFERENCE:g=l;break;case de.SYMDIFFERENCE:g=Math.max(l,h)}return g},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),Rr.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],g=arguments[1],w=arguments[2];switch(h===V.BOUNDARY&&(h=V.INTERIOR),g===V.BOUNDARY&&(g=V.INTERIOR),w){case de.INTERSECTION:return h===V.INTERIOR&&g===V.INTERIOR;case de.UNION:return h===V.INTERIOR||g===V.INTERIOR;case de.DIFFERENCE:return h===V.INTERIOR&&g!==V.INTERIOR;case de.SYMDIFFERENCE:return h===V.INTERIOR&&g!==V.INTERIOR||h!==V.INTERIOR&&g===V.INTERIOR}return!1}},de.INTERSECTION=1,de.UNION=2,de.DIFFERENCE=3,de.SYMDIFFERENCE=4;var cs=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Bi,this._seg=new se;var r=arguments[0],o=arguments[1];this._g=r,this._boundaryDistanceTolerance=o,this._linework=this.extractLinework(r)};cs.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},cs.prototype.getLocation=function(r){return this.isWithinToleranceOfBoundary(r)?V.BOUNDARY:this._ptLocator.locate(r,this._g)},cs.prototype.extractLinework=function(r){var o=new wu;r.apply(o);var a=o.getLinework(),l=ge.toLineStringArray(a);return r.getFactory().createMultiLineString(l)},cs.prototype.interfaces_=function(){return[]},cs.prototype.getClass=function(){return cs};var wu=function(){this._linework=null,this._linework=new O};wu.prototype.getLinework=function(){return this._linework},wu.prototype.filter=function(r){if(r instanceof ne){var o=r;this._linework.add(o.getExteriorRing());for(var a=0;a<o.getNumInteriorRing();a++)this._linework.add(o.getInteriorRingN(a))}},wu.prototype.interfaces_=function(){return[Rn]},wu.prototype.getClass=function(){return wu};var zs=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var r=arguments[0];this._g=r};zs.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)},zs.prototype.setSidesToGenerate=function(r,o){this._doLeft=r,this._doRight=o},zs.prototype.getPoints=function(r){for(var o=new O,a=ar.getLines(this._g).iterator();a.hasNext();){var l=a.next();this.extractPoints(l,r,o)}return o},zs.prototype.computeOffsetPoints=function(r,o,a,l){var h=o.x-r.x,g=o.y-r.y,w=Math.sqrt(h*h+g*g),C=a*h/w,B=a*g/w,K=(o.x+r.x)/2,gt=(o.y+r.y)/2;if(this._doLeft){var yt=new P(K-B,gt+C);l.add(yt)}if(this._doRight){var Bt=new P(K+B,gt-C);l.add(Bt)}},zs.prototype.interfaces_=function(){return[]},zs.prototype.getClass=function(){return zs};var di=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 cs(this._geom[0],this._boundaryDistanceTolerance),new cs(this._geom[1],this._boundaryDistanceTolerance),new cs(this._geom[2],this._boundaryDistanceTolerance)]},Ux={TOLERANCE:{configurable:!0}};di.prototype.reportResult=function(r,o,a){Ft.out.println("Overlay result invalid - A:"+V.toLocationSymbol(o[0])+" B:"+V.toLocationSymbol(o[1])+" expected:"+(a?"i":"e")+" actual:"+V.toLocationSymbol(o[2]))},di.prototype.isValid=function(r){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var o=this.checkValid(r);return o},di.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),!!di.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(l,this._location)}},di.prototype.addTestPts=function(r){var o=new zs(r);this._testCoords.addAll(o.getPoints(5*this._boundaryDistanceTolerance))},di.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},di.prototype.getInvalidLocation=function(){return this._invalidLocation},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di},di.hasLocation=function(r,o){for(var a=0;a<3;a++)if(r[a]===o)return!0;return!1},di.computeBoundaryDistanceTolerance=function(r,o){return Math.min(Fn.computeSizeBasedSnapTolerance(r),Fn.computeSizeBasedSnapTolerance(o))},di.isValid=function(r,o,a,l){return new di(r,o,l).isValid(a)},Ux.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(di,Ux);var mi=function r(o){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(o),this._inputGeoms=o};mi.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)}},mi.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)},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi},mi.combine=function(){if(arguments.length===1){var r=arguments[0];return new mi(r).combine()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new mi(mi.createList(o,a)).combine()}if(arguments.length===3){var l=arguments[0],h=arguments[1],g=arguments[2];return new mi(mi.createList(l,h,g)).combine()}},mi.extractFactory=function(r){return r.isEmpty()?null:r.iterator().next().getFactory()},mi.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],g=arguments[2],w=new O;return w.add(l),w.add(h),w.add(g),w}};var Hn=function(){this._inputPolys=null,this._geomFactory=null;var r=arguments[0];this._inputPolys=r,this._inputPolys===null&&(this._inputPolys=new O)},Bx={STRTREE_NODE_CAPACITY:{configurable:!0}};Hn.prototype.reduceToGeometries=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next(),h=null;Y(l,ht)?h=this.unionTree(l):l instanceof Rt&&(h=l),o.add(h)}return o},Hn.prototype.extractByEnvelope=function(r,o,a){for(var l=new O,h=0;h<o.getNumGeometries();h++){var g=o.getGeometryN(h);g.getEnvelopeInternal().intersects(r)?l.add(g):a.add(g)}return this._geomFactory.buildGeometry(l)},Hn.prototype.unionOptimized=function(r,o){var a=r.getEnvelopeInternal(),l=o.getEnvelopeInternal();if(!a.intersects(l))return mi.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)},Hn.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 Ex(Hn.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)},Hn.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=Hn.getGeometry(o,a);return this.unionSafe(h,null)}if(l-a==2)return this.unionSafe(Hn.getGeometry(o,a),Hn.getGeometry(o,a+1));var g=Math.trunc((l+a)/2),w=this.binaryUnion(o,a,g),C=this.binaryUnion(o,g,l);return this.unionSafe(w,C)}},Hn.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},Hn.prototype.unionSafe=function(r,o){return r===null&&o===null?null:r===null?o.copy():o===null?r.copy():this.unionOptimized(r,o)},Hn.prototype.unionActual=function(r,o){return Hn.restrictToPolygons(r.union(o))},Hn.prototype.unionTree=function(r){var o=this.reduceToGeometries(r);return this.binaryUnion(o)},Hn.prototype.unionUsingEnvelopeIntersection=function(r,o,a){var l=new O,h=this.extractByEnvelope(a,r,l),g=this.extractByEnvelope(a,o,l),w=this.unionActual(h,g);return l.add(w),mi.combine(l)},Hn.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)}},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn},Hn.restrictToPolygons=function(r){if(Y(r,le))return r;var o=Bo.getPolygons(r);return o.size()===1?o.get(0):r.getFactory().createMultiPolygon(ge.toPolygonArray(o))},Hn.getGeometry=function(r,o){return o>=r.size()?null:r.get(o)},Hn.union=function(r){return new Hn(r).union()},Bx.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Hn,Bx);var rc=function(){};rc.prototype.interfaces_=function(){return[]},rc.prototype.getClass=function(){return rc},rc.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),Rr.overlayOp(r,o,de.UNION)},n.GeoJSONReader=Wd,n.GeoJSONWriter=_x,n.OverlayOp=de,n.UnionOp=rc,n.BufferOp=sr,Object.defineProperty(n,"__esModule",{value:!0})})});var NN=Z((d1t,LN)=>{"use strict";var sZ=oc(),RN=Function.prototype,IN=RN.apply,PN=RN.call;LN.exports=typeof Reflect=="object"&&Reflect.apply||(sZ?PN.bind(IN):function(){return PN.apply(IN,arguments)})});var zN=Z((m1t,BN)=>{"use strict";mv();var ON=gi(),DN=Ra(),aZ=zp(),FN=Un(),UN=Vr(),uZ=hs(),lZ=UN("species"),fx=RegExp.prototype;BN.exports=function(n,t,e,i){var s=UN(n),u=!FN(function(){var d={};return d[s]=function(){return 7},""[n](d)!==7}),c=u&&!FN(function(){var d=!1,m=/a/;return n==="split"&&(m={},m.constructor={},m.constructor[lZ]=function(){return m},m.flags="",m[s]=/./[s]),m.exec=function(){return d=!0,null},m[s](""),!d});if(!u||!c||e){var f=/./[s],p=t(s,""[n],function(d,m,y,v,E){var M=m.exec;return M===aZ||M===fx.exec?u&&!E?{done:!0,value:ON(f,m,y,v)}:{done:!0,value:ON(d,y,m,v)}:{done:!1}});DN(String.prototype,n,p[0]),DN(fx,s,p[1])}i&&uZ(fx[s],"sham",!0)}});var VN=Z((g1t,qN)=>{"use strict";var hx=Zn(),cZ=_o(),fZ=Fp(),hZ=Su(),pZ=hx("".charAt),GN=hx("".charCodeAt),dZ=hx("".slice),kN=function(n){return function(t,e){var i=fZ(hZ(t)),s=cZ(e),u=i.length,c,f;return s<0||s>=u?n?"":void 0:(c=GN(i,s),c<55296||c>56319||s+1===u||(f=GN(i,s+1))<56320||f>57343?n?pZ(i,s):c:n?dZ(i,s,s+2):(c-55296<<10)+(f-56320)+65536)}};qN.exports={codeAt:kN(!1),charAt:kN(!0)}});var WN=Z((y1t,HN)=>{"use strict";var mZ=VN().charAt;HN.exports=function(n,t,e){return t+(e?mZ(n,t).length:1)}});var YN=Z((v1t,XN)=>{"use strict";var mx=Zn(),gZ=zo(),yZ=Math.floor,px=mx("".charAt),vZ=mx("".replace),dx=mx("".slice),_Z=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,xZ=/\$([$&'`]|\d{1,2})/g;XN.exports=function(n,t,e,i,s,u){var c=e+n.length,f=i.length,p=xZ;return s!==void 0&&(s=gZ(s),p=_Z),vZ(u,p,function(d,m){var y;switch(px(m,0)){case"$":return"$";case"&":return n;case"`":return dx(t,0,e);case"'":return dx(t,c);case"<":y=s[dx(m,1,-1)];break;default:var v=+m;if(v===0)return d;if(v>f){var E=yZ(v/10);return E===0?d:E<=f?i[E-1]===void 0?px(m,1):i[E-1]+px(m,1):d}y=i[v-1]}return y===void 0?"":y})}});var JN=Z((_1t,ZN)=>{"use strict";var $N=gi(),EZ=Go(),wZ=fr(),SZ=Gs(),MZ=zp(),bZ=TypeError;ZN.exports=function(n,t){var e=n.exec;if(wZ(e)){var i=$N(e,n,t);return i!==null&&EZ(i),i}if(SZ(n)==="RegExp")return $N(MZ,n,t);throw new bZ("RegExp#exec called on incompatible receiver")}});var e2=Z(()=>{"use strict";var AZ=NN(),jN=gi(),Hd=Zn(),TZ=zN(),CZ=Un(),IZ=Go(),PZ=fr(),RZ=yi(),LZ=_o(),NZ=La(),Vl=Fp(),OZ=Su(),DZ=WN(),FZ=Of(),UZ=YN(),BZ=JN(),zZ=Vr(),yx=zZ("replace"),GZ=Math.max,kZ=Math.min,qZ=Hd([].concat),gx=Hd([].push),KN=Hd("".indexOf),QN=Hd("".slice),VZ=function(n){return n===void 0?n:String(n)},HZ=function(){return"a".replace(/./,"$0")==="$0"}(),t2=function(){return/./[yx]?/./[yx]("a","$0")==="":!1}(),WZ=!CZ(function(){var n=/./;return n.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(n,"$<a>")!=="7"});TZ("replace",function(n,t,e){var i=t2?"$":"$0";return[function(u,c){var f=OZ(this),p=RZ(u)?FZ(u,yx):void 0;return p?jN(p,u,f,c):jN(t,Vl(f),u,c)},function(s,u){var c=IZ(this),f=Vl(s);if(typeof u=="string"&&KN(u,i)===-1&&KN(u,"$<")===-1){var p=e(t,c,f,u);if(p.done)return p.value}var d=PZ(u);d||(u=Vl(u));var m=c.global,y;m&&(y=c.unicode,c.lastIndex=0);for(var v=[],E;E=BZ(c,f),!(E===null||(gx(v,E),!m));){var M=Vl(E[0]);M===""&&(c.lastIndex=DZ(f,NZ(c.lastIndex),y))}for(var A="",_=0,x=0;x<v.length;x++){E=v[x];for(var T=Vl(E[0]),S=GZ(kZ(LZ(E.index),f.length),0),R=[],z,U=1;U<E.length;U++)gx(R,VZ(E[U]));var D=E.groups;if(d){var P=qZ([T],R,S,f);D!==void 0&&gx(P,D),z=Vl(AZ(u,void 0,P))}else z=UZ(T,f,S,R,D,u);S>=_&&(A+=QN(f,_,S)+z,_=S+T.length)}return A+QN(f,_)}]},!WZ||!HZ||t2)});var nEt=ue(Qf(),1),rEt=ue(Eg(),1),iEt=ue(wg(),1),oEt=ue(Sg(),1),sEt=ue(bg(),1),aEt=ue(Ag(),1),uEt=ue(Pg(),1),lEt=ue(Ng(),1),cEt=ue(Dg(),1),fEt=ue(Fg(),1),hEt=ue(Bg(),1),pEt=ue(Gg(),1),dEt=ue(Hg(),1),mEt=ue(Yg(),1),gEt=ue(u0(),1),yEt=ue(l0(),1),vEt=ue(Bb(),1);var Vy="162";var M4=0,zb=1,b4=2;var dT=1,A4=2,Es=3,sa=0,Pi=1,Ss=2,na=0,sl=1,Gb=2,kb=3,qb=4,T4=5,qa=100,C4=101,I4=102,Vb=103,Hb=104,P4=200,R4=201,L4=202,N4=203,Y0=204,$0=205,O4=206,D4=207,F4=208,U4=209,B4=210,z4=211,G4=212,k4=213,q4=214,V4=0,H4=1,W4=2,np=3,X4=4,Y4=5,$4=6,Z4=7,mT=0,J4=1,j4=2,ra=0,K4=1,Q4=2,tk=3,ek=4,nk=5,rk=6,ik=7;var gT=300,ll=301,cl=302,Z0=303,J0=304,Cp=306,j0=1e3,bo=1001,K0=1002,Ei=1003,Wb=1004;var Sc=1005;var Ii=1006,c0=1007;var Ha=1008;var ia=1009,ok=1010,sk=1011,Hy=1012,yT=1013,ea=1014,Ms=1015,Oc=1016,vT=1017,_T=1018,Ya=1020,ak=1021,Ao=1023,uk=1024,lk=1025,$a=1026,fl=1027,ck=1028,xT=1029,fk=1030,ET=1031,wT=1033,f0=33776,h0=33777,p0=33778,d0=33779,Xb=35840,Yb=35841,$b=35842,Zb=35843,ST=36196,Jb=37492,jb=37496,Kb=37808,Qb=37809,tA=37810,eA=37811,nA=37812,rA=37813,iA=37814,oA=37815,sA=37816,aA=37817,uA=37818,lA=37819,cA=37820,fA=37821,m0=36492,hA=36494,pA=36495,hk=36283,dA=36284,mA=36285,gA=36286;var rp=2300,ip=2301,g0=2302,yA=2400,vA=2401,_A=2402;var pk=3200,dk=3201,mk=0,gk=1,ta="",Wo="srgb",ua="srgb-linear",Wy="display-p3",Ip="display-p3-linear",op="linear",Bn="srgb",sp="rec709",ap="p3";var Bu=7680;var xA=519,yk=512,vk=513,_k=514,MT=515,xk=516,Ek=517,wk=518,Sk=519,Q0=35044;var EA="300 es",ty=1035,bs=2e3,up=2001,aa=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}}},ni=["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 y0=Math.PI/180,ey=180/Math.PI;function As(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ni[n&255]+ni[n>>8&255]+ni[n>>16&255]+ni[n>>24&255]+"-"+ni[t&255]+ni[t>>8&255]+"-"+ni[t>>16&15|64]+ni[t>>24&255]+"-"+ni[e&63|128]+ni[e>>8&255]+"-"+ni[e>>16&255]+ni[e>>24&255]+ni[i&255]+ni[i>>8&255]+ni[i>>16&255]+ni[i>>24&255]).toLowerCase()}function ii(n,t,e){return Math.max(t,Math.min(e,n))}function Mk(n,t){return(n%t+t)%t}function v0(n,t,e){return(1-e)*n+e*t}function wA(n){return(n&n-1)===0&&n!==0}function ny(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Yo(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 Cn(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 Ht=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(ii(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}},we=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 m=this.elements;return m[0]=t,m[1]=s,m[2]=f,m[3]=e,m[4]=u,m[5]=p,m[6]=i,m[7]=c,m[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],m=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],S=s[4],R=s[7],z=s[2],U=s[5],D=s[8];return u[0]=c*A+f*T+p*z,u[3]=c*_+f*S+p*U,u[6]=c*x+f*R+p*D,u[1]=d*A+m*T+y*z,u[4]=d*_+m*S+y*U,u[7]=d*x+m*R+y*D,u[2]=v*A+E*T+M*z,u[5]=v*_+E*S+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],m=t[8];return e*c*m-e*f*d-i*u*m+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],m=t[8],y=m*c-f*d,v=f*p-m*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-m*i)*A,t[2]=(f*i-s*c)*A,t[3]=v*A,t[4]=(m*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(_0.makeScale(t,e)),this}rotate(t){return this.premultiply(_0.makeRotation(-t)),this}translate(t,e){return this.premultiply(_0.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)}},_0=new we;function bT(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function lp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function bk(){let n=lp("canvas");return n.style.display="block",n}var SA={};function AT(n){n in SA||(SA[n]=!0,console.warn(n))}var MA=new we().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),bA=new we().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ch={[ua]:{transfer:op,primaries:sp,toReference:n=>n,fromReference:n=>n},[Wo]:{transfer:Bn,primaries:sp,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Ip]:{transfer:op,primaries:ap,toReference:n=>n.applyMatrix3(bA),fromReference:n=>n.applyMatrix3(MA)},[Wy]:{transfer:Bn,primaries:ap,toReference:n=>n.convertSRGBToLinear().applyMatrix3(bA),fromReference:n=>n.applyMatrix3(MA).convertLinearToSRGB()}},Ak=new Set([ua,Ip]),In={enabled:!0,_workingColorSpace:ua,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Ak.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=Ch[t].toReference,s=Ch[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 Ch[n].primaries},getTransfer:function(n){return n===ta?op:Ch[n].transfer}};function al(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function x0(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var zu,cp=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{zu===void 0&&(zu=lp("canvas")),zu.width=t.width,zu.height=t.height;let i=zu.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=zu}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=lp("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}},Tk=0,fp=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Tk++}),this.uuid=As(),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(E0(s[c].image)):u.push(E0(s[c]))}else u=E0(s);i.url=u}return e||(t.images[this.uuid]=i),i}};function E0(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?cp.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 Ck=0,ro=class n extends aa{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,i=bo,s=bo,u=Ii,c=Ha,f=Ao,p=ia,d=n.DEFAULT_ANISOTROPY,m=ta){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ck++}),this.uuid=As(),this.name="",this.source=new fp(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 Ht(0,0),this.repeat=new Ht(1,1),this.center=new Ht(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new we,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=m,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!==gT)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case j0:t.x=t.x-Math.floor(t.x);break;case bo:t.x=t.x<0?0:1;break;case K0: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 j0:t.y=t.y-Math.floor(t.y);break;case bo:t.y=t.y<0?0:1;break;case K0: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)}};ro.DEFAULT_IMAGE=null;ro.DEFAULT_MAPPING=gT;ro.DEFAULT_ANISOTROPY=1;var Hr=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],m=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(m-v)<.01&&Math.abs(y-A)<.01&&Math.abs(M-_)<.01){if(Math.abs(m+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 S=(d+1)/2,R=(E+1)/2,z=(x+1)/2,U=(m+v)/4,D=(y+A)/4,P=(M+_)/4;return S>R&&S>z?S<.01?(i=0,s=.707106781,u=.707106781):(i=Math.sqrt(S),s=U/i,u=D/i):R>z?R<.01?(i=.707106781,s=0,u=.707106781):(s=Math.sqrt(R),i=U/s,u=P/s):z<.01?(i=.707106781,s=.707106781,u=0):(u=Math.sqrt(z),i=D/u,s=P/u),this.set(i,s,u,e),this}let T=Math.sqrt((_-M)*(_-M)+(y-A)*(y-A)+(v-m)*(v-m));return Math.abs(T)<.001&&(T=1),this.x=(_-M)/T,this.y=(y-A)/T,this.z=(v-m)/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}},ry=class extends aa{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Hr(0,0,t,e),this.scissorTest=!1,this.viewport=new Hr(0,0,t,e);let s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ii,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let u=new ro(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 fp(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"})}},Ts=class extends ry{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},hp=class extends ro{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=Ei,this.minFilter=Ei,this.wrapR=bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var iy=class extends ro{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=Ei,this.minFilter=Ei,this.wrapR=bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Cs=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],m=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]=m,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||m!==M){let _=1-f,x=p*v+d*E+m*M+y*A,T=x>=0?1:-1,S=1-x*x;if(S>Number.EPSILON){let z=Math.sqrt(S),U=Math.atan2(z,x*T);_=Math.sin(_*U)/z,f=Math.sin(f*U)/z}let R=f*T;if(p=p*_+v*R,d=d*_+E*R,m=m*_+M*R,y=y*_+A*R,_===1-f){let z=1/Math.sqrt(p*p+d*d+m*m+y*y);p*=z,d*=z,m*=z,y*=z}}t[e]=p,t[e+1]=d,t[e+2]=m,t[e+3]=y}static multiplyQuaternionsFlat(t,e,i,s,u,c){let f=i[s],p=i[s+1],d=i[s+2],m=i[s+3],y=u[c],v=u[c+1],E=u[c+2],M=u[c+3];return t[e]=f*M+m*y+p*E-d*v,t[e+1]=p*M+m*v+d*y-f*E,t[e+2]=d*M+m*E+f*v-p*y,t[e+3]=m*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),m=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*m*y+d*E*M,this._y=d*E*y-v*m*M,this._z=d*m*M+v*E*y,this._w=d*m*y-v*E*M;break;case"YXZ":this._x=v*m*y+d*E*M,this._y=d*E*y-v*m*M,this._z=d*m*M-v*E*y,this._w=d*m*y+v*E*M;break;case"ZXY":this._x=v*m*y-d*E*M,this._y=d*E*y+v*m*M,this._z=d*m*M+v*E*y,this._w=d*m*y-v*E*M;break;case"ZYX":this._x=v*m*y-d*E*M,this._y=d*E*y+v*m*M,this._z=d*m*M-v*E*y,this._w=d*m*y+v*E*M;break;case"YZX":this._x=v*m*y+d*E*M,this._y=d*E*y+v*m*M,this._z=d*m*M-v*E*y,this._w=d*m*y-v*E*M;break;case"XZY":this._x=v*m*y-d*E*M,this._y=d*E*y-v*m*M,this._z=d*m*M+v*E*y,this._w=d*m*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],m=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=(m-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=(m-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+m)/E}else{let E=2*Math.sqrt(1+y-i-f);this._w=(c-s)/E,this._x=(u+d)/E,this._y=(p+m)/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(ii(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,m=e._w;return this._x=i*m+c*f+s*d-u*p,this._y=s*m+c*p+u*f-i*d,this._z=u*m+c*d+i*p-s*f,this._w=c*m-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),m=Math.atan2(d,f),y=Math.sin((1-e)*m)/d,v=Math.sin(e*m)/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}},at=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(AA.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(AA.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),m=2*(f*e-u*s),y=2*(u*i-c*e);return this.x=e+p*d+c*y-f*m,this.y=i+p*m+f*d-u*y,this.z=s+p*y+u*m-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 w0.copy(this).projectOnVector(t),this.sub(w0)}reflect(t){return this.sub(w0.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(ii(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}},w0=new at,AA=new Cs,Za=class{constructor(t=new at(1/0,1/0,1/0),e=new at(-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(wo.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(wo.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=wo.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,wo):wo.fromBufferAttribute(u,c),wo.applyMatrix4(t.matrixWorld),this.expandByPoint(wo);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Ih.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ih.copy(i.boundingBox)),Ih.applyMatrix4(t.matrixWorld),this.union(Ih)}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,wo),wo.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(Mc),Ph.subVectors(this.max,Mc),Gu.subVectors(t.a,Mc),ku.subVectors(t.b,Mc),qu.subVectors(t.c,Mc),Ys.subVectors(ku,Gu),$s.subVectors(qu,ku),Da.subVectors(Gu,qu);let e=[0,-Ys.z,Ys.y,0,-$s.z,$s.y,0,-Da.z,Da.y,Ys.z,0,-Ys.x,$s.z,0,-$s.x,Da.z,0,-Da.x,-Ys.y,Ys.x,0,-$s.y,$s.x,0,-Da.y,Da.x,0];return!S0(e,Gu,ku,qu,Ph)||(e=[1,0,0,0,1,0,0,0,1],!S0(e,Gu,ku,qu,Ph))?!1:(Rh.crossVectors(Ys,$s),e=[Rh.x,Rh.y,Rh.z],S0(e,Gu,ku,qu,Ph))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,wo).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(wo).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:(gs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),gs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),gs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),gs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),gs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),gs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),gs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),gs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(gs),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)}},gs=[new at,new at,new at,new at,new at,new at,new at,new at],wo=new at,Ih=new Za,Gu=new at,ku=new at,qu=new at,Ys=new at,$s=new at,Da=new at,Mc=new at,Ph=new at,Rh=new at,Fa=new at;function S0(n,t,e,i,s){for(let u=0,c=n.length-3;u<=c;u+=3){Fa.fromArray(n,u);let f=s.x*Math.abs(Fa.x)+s.y*Math.abs(Fa.y)+s.z*Math.abs(Fa.z),p=t.dot(Fa),d=e.dot(Fa),m=i.dot(Fa);if(Math.max(-Math.max(p,d,m),Math.min(p,d,m))>f)return!1}return!0}var Ik=new Za,bc=new at,M0=new at,Dc=class{constructor(t=new at,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):Ik.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;bc.subVectors(t,this.center);let e=bc.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(bc,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):(M0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(bc.copy(t.center).add(M0)),this.expandByPoint(bc.copy(t.center).sub(M0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ys=new at,b0=new at,Lh=new at,Zs=new at,A0=new at,Nh=new at,T0=new at,oy=class{constructor(t=new at,e=new at(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,ys)),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=ys.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ys.copy(this.origin).addScaledVector(this.direction,e),ys.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){b0.copy(t).add(e).multiplyScalar(.5),Lh.copy(e).sub(t).normalize(),Zs.copy(this.origin).sub(b0);let u=t.distanceTo(e)*.5,c=-this.direction.dot(Lh),f=Zs.dot(this.direction),p=-Zs.dot(Lh),d=Zs.lengthSq(),m=Math.abs(1-c*c),y,v,E,M;if(m>0)if(y=c*p-f,v=c*f-p,M=u*m,y>=0)if(v>=-M)if(v<=M){let A=1/m;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(b0).addScaledVector(Lh,v),E}intersectSphere(t,e){ys.subVectors(t.center,this.origin);let i=ys.dot(this.direction),s=ys.dot(ys)-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,m=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),m>=0?(u=(t.min.y-v.y)*m,c=(t.max.y-v.y)*m):(u=(t.max.y-v.y)*m,c=(t.min.y-v.y)*m),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,ys)!==null}intersectTriangle(t,e,i,s,u){A0.subVectors(e,t),Nh.subVectors(i,t),T0.crossVectors(A0,Nh);let c=this.direction.dot(T0),f;if(c>0){if(s)return null;f=1}else if(c<0)f=-1,c=-c;else return null;Zs.subVectors(this.origin,t);let p=f*this.direction.dot(Nh.crossVectors(Zs,Nh));if(p<0)return null;let d=f*this.direction.dot(A0.cross(Zs));if(d<0||p+d>c)return null;let m=-f*Zs.dot(T0);return m<0?null:this.at(m/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)}},ir=class n{constructor(t,e,i,s,u,c,f,p,d,m,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,m,y,v,E,M,A,_)}set(t,e,i,s,u,c,f,p,d,m,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]=m,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/Vu.setFromMatrixColumn(t,0).length(),u=1/Vu.setFromMatrixColumn(t,1).length(),c=1/Vu.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),m=Math.cos(u),y=Math.sin(u);if(t.order==="XYZ"){let v=c*m,E=c*y,M=f*m,A=f*y;e[0]=p*m,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*m,E=p*y,M=d*m,A=d*y;e[0]=v+A*f,e[4]=M*f-E,e[8]=c*d,e[1]=c*y,e[5]=c*m,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*m,E=p*y,M=d*m,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*m,e[9]=A-v*f,e[2]=-c*d,e[6]=f,e[10]=c*p}else if(t.order==="ZYX"){let v=c*m,E=c*y,M=f*m,A=f*y;e[0]=p*m,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*m,e[4]=A-v*y,e[8]=M*y+E,e[1]=y,e[5]=c*m,e[9]=-f*m,e[2]=-d*m,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*m,e[4]=-y,e[8]=d*m,e[1]=v*y+A,e[5]=c*m,e[9]=E*y-M,e[2]=M*y-E,e[6]=f*m,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(Pk,t,Rk)}lookAt(t,e,i){let s=this.elements;return qi.subVectors(t,e),qi.lengthSq()===0&&(qi.z=1),qi.normalize(),Js.crossVectors(i,qi),Js.lengthSq()===0&&(Math.abs(i.z)===1?qi.x+=1e-4:qi.z+=1e-4,qi.normalize(),Js.crossVectors(i,qi)),Js.normalize(),Oh.crossVectors(qi,Js),s[0]=Js.x,s[4]=Oh.x,s[8]=qi.x,s[1]=Js.y,s[5]=Oh.y,s[9]=qi.y,s[2]=Js.z,s[6]=Oh.z,s[10]=qi.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],m=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],S=i[7],R=i[11],z=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],Y=s[2],mt=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*Y+d*it,u[4]=c*D+f*W+p*mt+d*lt,u[8]=c*P+f*V+p*ft+d*H,u[12]=c*ct+f*Mt+p*vt+d*At,u[1]=m*U+y*L+v*Y+E*it,u[5]=m*D+y*W+v*mt+E*lt,u[9]=m*P+y*V+v*ft+E*H,u[13]=m*ct+y*Mt+v*vt+E*At,u[2]=M*U+A*L+_*Y+x*it,u[6]=M*D+A*W+_*mt+x*lt,u[10]=M*P+A*V+_*ft+x*H,u[14]=M*ct+A*Mt+_*vt+x*At,u[3]=T*U+S*L+R*Y+z*it,u[7]=T*D+S*W+R*mt+z*lt,u[11]=T*P+S*V+R*ft+z*H,u[15]=T*ct+S*Mt+R*vt+z*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],m=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*m-u*p*m)+_*(+e*d*y-e*f*E-u*c*y+i*c*E+u*f*m-i*d*m)+x*(-s*f*m-e*p*y+e*f*v+s*c*y-i*c*v+i*p*m)}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],m=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,S=M*v*d-m*_*d-M*p*E+c*_*E+m*p*x-c*v*x,R=m*A*d-M*y*d+M*f*E-c*A*E-m*f*x+c*y*x,z=M*y*p-m*A*p-M*f*v+c*A*v+m*f*_-c*y*_,U=e*T+i*S+s*R+u*z;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]=S*D,t[5]=(m*_*u-M*v*u+M*s*E-e*_*E-m*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-m*p*u+m*s*d-e*v*d-c*s*E+e*p*E)*D,t[8]=R*D,t[9]=(M*y*u-m*A*u-M*i*E+e*A*E+m*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]=(m*f*u-c*y*u-m*i*d+e*y*d+c*i*E-e*f*E)*D,t[12]=z*D,t[13]=(m*A*s-M*y*s+M*i*v-e*A*v-m*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-m*f*s+m*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,m=u*f;return this.set(d*c+i,d*f-s*p,d*p+s*f,0,d*f+s*p,m*f+i,m*p-s*c,0,d*p-s*f,m*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,m=c+c,y=f+f,v=u*d,E=u*m,M=u*y,A=c*m,_=c*y,x=f*y,T=p*d,S=p*m,R=p*y,z=i.x,U=i.y,D=i.z;return s[0]=(1-(A+x))*z,s[1]=(E+R)*z,s[2]=(M-S)*z,s[3]=0,s[4]=(E-R)*U,s[5]=(1-(v+x))*U,s[6]=(_+T)*U,s[7]=0,s[8]=(M+S)*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=Vu.set(s[0],s[1],s[2]).length(),c=Vu.set(s[4],s[5],s[6]).length(),f=Vu.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],So.copy(this);let d=1/u,m=1/c,y=1/f;return So.elements[0]*=d,So.elements[1]*=d,So.elements[2]*=d,So.elements[4]*=m,So.elements[5]*=m,So.elements[6]*=m,So.elements[8]*=y,So.elements[9]*=y,So.elements[10]*=y,e.setFromRotationMatrix(So),i.x=u,i.y=c,i.z=f,this}makePerspective(t,e,i,s,u,c,f=bs){let p=this.elements,d=2*u/(e-t),m=2*u/(i-s),y=(e+t)/(e-t),v=(i+s)/(i-s),E,M;if(f===bs)E=-(c+u)/(c-u),M=-2*c*u/(c-u);else if(f===up)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]=m,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=bs){let p=this.elements,d=1/(e-t),m=1/(i-s),y=1/(c-u),v=(e+t)*d,E=(i+s)*m,M,A;if(f===bs)M=(c+u)*y,A=-2*y;else if(f===up)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*m,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}},Vu=new at,So=new ir,Pk=new at(0,0,0),Rk=new at(1,1,1),Js=new at,Oh=new at,qi=new at,TA=new ir,CA=new Cs,Ja=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],m=s[9],y=s[2],v=s[6],E=s[10];switch(e){case"XYZ":this._y=Math.asin(ii(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-m,E),this._z=Math.atan2(-c,u)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ii(m,-1,1)),Math.abs(m)<.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(ii(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(-ii(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(ii(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-m,d),this._y=Math.atan2(-y,u)):(this._x=0,this._y=Math.atan2(f,E));break;case"XZY":this._z=Math.asin(-ii(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(f,u)):(this._x=Math.atan2(-m,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 TA.makeRotationFromQuaternion(t),this.setFromRotationMatrix(TA,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return CA.setFromEuler(this),this.setFromQuaternion(CA,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}};Ja.DEFAULT_ORDER="XYZ";var pp=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}},Lk=0,IA=new at,Hu=new Cs,vs=new ir,Dh=new at,Ac=new at,Nk=new at,Ok=new Cs,PA=new at(1,0,0),RA=new at(0,1,0),LA=new at(0,0,1),Dk={type:"added"},Fk={type:"removed"},C0={type:"childadded",child:null},I0={type:"childremoved",child:null},Co=class n extends aa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Lk++}),this.uuid=As(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new at,e=new Ja,i=new Cs,s=new at(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 ir},normalMatrix:{value:new we}}),this.matrix=new ir,this.matrixWorld=new ir,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new pp,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 Hu.setFromAxisAngle(t,e),this.quaternion.multiply(Hu),this}rotateOnWorldAxis(t,e){return Hu.setFromAxisAngle(t,e),this.quaternion.premultiply(Hu),this}rotateX(t){return this.rotateOnAxis(PA,t)}rotateY(t){return this.rotateOnAxis(RA,t)}rotateZ(t){return this.rotateOnAxis(LA,t)}translateOnAxis(t,e){return IA.copy(t).applyQuaternion(this.quaternion),this.position.add(IA.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(PA,t)}translateY(t){return this.translateOnAxis(RA,t)}translateZ(t){return this.translateOnAxis(LA,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(vs.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Dh.copy(t):Dh.set(t,e,i);let s=this.parent;this.updateWorldMatrix(!0,!1),Ac.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?vs.lookAt(Ac,Dh,this.up):vs.lookAt(Dh,Ac,this.up),this.quaternion.setFromRotationMatrix(vs),s&&(vs.extractRotation(s.matrixWorld),Hu.setFromRotationMatrix(vs),this.quaternion.premultiply(Hu.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(Dk),C0.child=t,this.dispatchEvent(C0),C0.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(Fk),I0.child=t,this.dispatchEvent(I0),I0.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),vs.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),vs.multiply(t.parent.matrixWorld)),t.applyMatrix4(vs),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(Ac,t,Nk),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ac,Ok,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,m=p.length;d<m;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),m=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),m.length>0&&(i.images=m),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 m=f[d];delete m.metadata,p.push(m)}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}};Co.DEFAULT_UP=new at(0,1,0);Co.DEFAULT_MATRIX_AUTO_UPDATE=!0;Co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Mo=new at,_s=new at,P0=new at,xs=new at,Wu=new at,Xu=new at,NA=new at,R0=new at,L0=new at,N0=new at,Wa=class n{constructor(t=new at,e=new at,i=new at){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),Mo.subVectors(t,e),s.cross(Mo);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){Mo.subVectors(s,e),_s.subVectors(i,e),P0.subVectors(t,e);let c=Mo.dot(Mo),f=Mo.dot(_s),p=Mo.dot(P0),d=_s.dot(_s),m=_s.dot(P0),y=c*d-f*f;if(y===0)return u.set(0,0,0),null;let v=1/y,E=(d*p-f*m)*v,M=(c*m-f*p)*v;return u.set(1-E-M,M,E)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,xs)===null?!1:xs.x>=0&&xs.y>=0&&xs.x+xs.y<=1}static getInterpolation(t,e,i,s,u,c,f,p){return this.getBarycoord(t,e,i,s,xs)===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,xs.x),p.addScaledVector(c,xs.y),p.addScaledVector(f,xs.z),p)}static isFrontFacing(t,e,i,s){return Mo.subVectors(i,e),_s.subVectors(t,e),Mo.cross(_s).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 Mo.subVectors(this.c,this.b),_s.subVectors(this.a,this.b),Mo.cross(_s).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;Wu.subVectors(s,i),Xu.subVectors(u,i),R0.subVectors(t,i);let p=Wu.dot(R0),d=Xu.dot(R0);if(p<=0&&d<=0)return e.copy(i);L0.subVectors(t,s);let m=Wu.dot(L0),y=Xu.dot(L0);if(m>=0&&y<=m)return e.copy(s);let v=p*y-m*d;if(v<=0&&p>=0&&m<=0)return c=p/(p-m),e.copy(i).addScaledVector(Wu,c);N0.subVectors(t,u);let E=Wu.dot(N0),M=Xu.dot(N0);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(Xu,f);let _=m*M-E*y;if(_<=0&&y-m>=0&&E-M>=0)return NA.subVectors(u,s),f=(y-m)/(y-m+(E-M)),e.copy(s).addScaledVector(NA,f);let x=1/(_+A+v);return c=A*x,f=v*x,e.copy(i).addScaledVector(Wu,c).addScaledVector(Xu,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},TT={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},js={h:0,s:0,l:0},Fh={h:0,s:0,l:0};function O0(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 fn=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=Wo){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,In.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=In.workingColorSpace){return this.r=t,this.g=e,this.b=i,In.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=In.workingColorSpace){if(t=Mk(t,1),e=ii(e,0,1),i=ii(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=O0(c,u,t+1/3),this.g=O0(c,u,t),this.b=O0(c,u,t-1/3)}return In.toWorkingColorSpace(this,s),this}setStyle(t,e=Wo){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=Wo){let i=TT[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=x0(t.r),this.g=x0(t.g),this.b=x0(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Wo){return In.fromWorkingColorSpace(ri.copy(this),t),Math.round(ii(ri.r*255,0,255))*65536+Math.round(ii(ri.g*255,0,255))*256+Math.round(ii(ri.b*255,0,255))}getHexString(t=Wo){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=In.workingColorSpace){In.fromWorkingColorSpace(ri.copy(this),e);let i=ri.r,s=ri.g,u=ri.b,c=Math.max(i,s,u),f=Math.min(i,s,u),p,d,m=(f+c)/2;if(f===c)p=0,d=0;else{let y=c-f;switch(d=m<=.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=m,t}getRGB(t,e=In.workingColorSpace){return In.fromWorkingColorSpace(ri.copy(this),e),t.r=ri.r,t.g=ri.g,t.b=ri.b,t}getStyle(t=Wo){In.fromWorkingColorSpace(ri.copy(this),t);let e=ri.r,i=ri.g,s=ri.b;return t!==Wo?`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(js),this.setHSL(js.h+t,js.s+e,js.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(js),t.getHSL(Fh);let i=v0(js.h,Fh.h,e),s=v0(js.s,Fh.s,e),u=v0(js.l,Fh.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}},ri=new fn;fn.NAMES=TT;var Uk=0,ja=class extends aa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Uk++}),this.uuid=As(),this.name="",this.type="Material",this.blending=sl,this.side=sa,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Y0,this.blendDst=$0,this.blendEquation=qa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new fn(0,0,0),this.blendAlpha=0,this.depthFunc=np,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xA,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bu,this.stencilZFail=Bu,this.stencilZPass=Bu,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!==sl&&(i.blending=this.blending),this.side!==sa&&(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!==Y0&&(i.blendSrc=this.blendSrc),this.blendDst!==$0&&(i.blendDst=this.blendDst),this.blendEquation!==qa&&(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!==xA&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Bu&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Bu&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Bu&&(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++}},dp=class extends ja{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new fn(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 Ja,this.combine=mT,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 hr=new at,Uh=new Ht,Yn=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=Q0,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ms,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return AT("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++)Uh.fromBufferAttribute(this,e),Uh.applyMatrix3(t),this.setXY(e,Uh.x,Uh.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.applyMatrix3(t),this.setXYZ(e,hr.x,hr.y,hr.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.applyMatrix4(t),this.setXYZ(e,hr.x,hr.y,hr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.applyNormalMatrix(t),this.setXYZ(e,hr.x,hr.y,hr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.transformDirection(t),this.setXYZ(e,hr.x,hr.y,hr.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=Yo(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Cn(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Yo(e,this.array)),e}setX(t,e){return this.normalized&&(e=Cn(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Yo(e,this.array)),e}setY(t,e){return this.normalized&&(e=Cn(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=Yo(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Cn(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=Yo(e,this.array)),e}setW(t,e){return this.normalized&&(e=Cn(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Cn(e,this.array),i=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(s,this.array),u=Cn(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!==Q0&&(t.usage=this.usage),t}};var mp=class extends Yn{constructor(t,e,i){super(new Uint16Array(t),e,i)}};var gp=class extends Yn{constructor(t,e,i){super(new Uint32Array(t),e,i)}};var Wr=class extends Yn{constructor(t,e,i){super(new Float32Array(t),e,i)}},Bk=0,no=new ir,D0=new Co,Yu=new at,Vi=new Za,Tc=new Za,Nr=new at,Ri=class n extends aa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Bk++}),this.uuid=As(),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(bT(t)?gp:mp)(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 we().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 no.makeRotationFromQuaternion(t),this.applyMatrix4(no),this}rotateX(t){return no.makeRotationX(t),this.applyMatrix4(no),this}rotateY(t){return no.makeRotationY(t),this.applyMatrix4(no),this}rotateZ(t){return no.makeRotationZ(t),this.applyMatrix4(no),this}translate(t,e,i){return no.makeTranslation(t,e,i),this.applyMatrix4(no),this}scale(t,e,i){return no.makeScale(t,e,i),this.applyMatrix4(no),this}lookAt(t){return D0.lookAt(t),D0.updateMatrix(),this.applyMatrix4(D0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yu).negate(),this.translate(Yu.x,Yu.y,Yu.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 Wr(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Za);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 at(-1/0,-1/0,-1/0),new at(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];Vi.setFromBufferAttribute(u),this.morphTargetsRelative?(Nr.addVectors(this.boundingBox.min,Vi.min),this.boundingBox.expandByPoint(Nr),Nr.addVectors(this.boundingBox.max,Vi.max),this.boundingBox.expandByPoint(Nr)):(this.boundingBox.expandByPoint(Vi.min),this.boundingBox.expandByPoint(Vi.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 Dc);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 at,1/0);return}if(t){let i=this.boundingSphere.center;if(Vi.setFromBufferAttribute(t),e)for(let u=0,c=e.length;u<c;u++){let f=e[u];Tc.setFromBufferAttribute(f),this.morphTargetsRelative?(Nr.addVectors(Vi.min,Tc.min),Vi.expandByPoint(Nr),Nr.addVectors(Vi.max,Tc.max),Vi.expandByPoint(Nr)):(Vi.expandByPoint(Tc.min),Vi.expandByPoint(Tc.max))}Vi.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Nr.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Nr));if(e)for(let u=0,c=e.length;u<c;u++){let f=e[u],p=this.morphTargetsRelative;for(let d=0,m=f.count;d<m;d++)Nr.fromBufferAttribute(f,d),p&&(Yu.fromBufferAttribute(t,d),Nr.add(Yu)),s=Math.max(s,i.distanceToSquared(Nr))}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 Yn(new Float32Array(4*i.count),4));let c=this.getAttribute("tangent"),f=[],p=[];for(let P=0;P<i.count;P++)f[P]=new at,p[P]=new at;let d=new at,m=new at,y=new at,v=new Ht,E=new Ht,M=new Ht,A=new at,_=new at;function x(P,ct,L){d.fromBufferAttribute(i,P),m.fromBufferAttribute(i,ct),y.fromBufferAttribute(i,L),v.fromBufferAttribute(u,P),E.fromBufferAttribute(u,ct),M.fromBufferAttribute(u,L),m.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(m).multiplyScalar(M.y).addScaledVector(y,-E.y).multiplyScalar(W),_.copy(y).multiplyScalar(E.x).addScaledVector(m,-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,Y=W+V;Mt<Y;Mt+=3)x(t.getX(Mt+0),t.getX(Mt+1),t.getX(Mt+2))}let S=new at,R=new at,z=new at,U=new at;function D(P){z.fromBufferAttribute(s,P),U.copy(z);let ct=f[P];S.copy(ct),S.sub(z.multiplyScalar(z.dot(ct))).normalize(),R.crossVectors(U,ct);let W=R.dot(p[P])<0?-1:1;c.setXYZW(P,S.x,S.y,S.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,Y=W+V;Mt<Y;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 Yn(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 at,u=new at,c=new at,f=new at,p=new at,d=new at,m=new at,y=new at;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,_),m.subVectors(c,u),y.subVectors(s,u),m.cross(y),f.fromBufferAttribute(i,M),p.fromBufferAttribute(i,A),d.fromBufferAttribute(i,_),f.add(m),p.add(m),d.add(m),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),m.subVectors(c,u),y.subVectors(s,u),m.cross(y),i.setXYZ(v+0,m.x,m.y,m.z),i.setXYZ(v+1,m.x,m.y,m.z),i.setXYZ(v+2,m.x,m.y,m.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Nr.fromBufferAttribute(t,e),Nr.normalize(),t.setXYZ(e,Nr.x,Nr.y,Nr.z)}toNonIndexed(){function t(f,p){let d=f.array,m=f.itemSize,y=f.normalized,v=new d.constructor(p.length*m),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]*m;for(let x=0;x<m;x++)v[M++]=d[E++]}return new Yn(v,m,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 m=0,y=d.length;m<y;m++){let v=d[m],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],m=[];for(let y=0,v=d.length;y<v;y++){let E=d[y];m.push(E.toJSON(t.data))}m.length>0&&(s[p]=m,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 m=s[d];this.setAttribute(d,m.clone(e))}let u=t.morphAttributes;for(let d in u){let m=[],y=u[d];for(let v=0,E=y.length;v<E;v++)m.push(y[v].clone(e));this.morphAttributes[d]=m}this.morphTargetsRelative=t.morphTargetsRelative;let c=t.groups;for(let d=0,m=c.length;d<m;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"})}},OA=new ir,Ua=new oy,Bh=new Dc,DA=new at,$u=new at,Zu=new at,Ju=new at,F0=new at,zh=new at,Gh=new Ht,kh=new Ht,qh=new Ht,FA=new at,UA=new at,BA=new at,Vh=new at,Hh=new at,To=class extends Co{constructor(t=new Ri,e=new dp){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){zh.set(0,0,0);for(let p=0,d=u.length;p<d;p++){let m=f[p],y=u[p];m!==0&&(F0.fromBufferAttribute(y,t),c?zh.addScaledVector(F0,m):zh.addScaledVector(F0.sub(e),m))}e.add(zh)}return e}raycast(t,e){let i=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Bh.copy(i.boundingSphere),Bh.applyMatrix4(u),Ua.copy(t.ray).recast(t.near),!(Bh.containsPoint(Ua.origin)===!1&&(Ua.intersectSphere(Bh,DA)===null||Ua.origin.distanceToSquared(DA)>(t.far-t.near)**2))&&(OA.copy(u).invert(),Ua.copy(t.ray).applyMatrix4(OA),!(i.boundingBox!==null&&Ua.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Ua)))}_computeIntersections(t,e,i){let s,u=this.geometry,c=this.material,f=u.index,p=u.attributes.position,d=u.attributes.uv,m=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),S=Math.min(f.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,z=S;R<z;R+=3){let U=f.getX(R),D=f.getX(R+1),P=f.getX(R+2);s=Wh(this,x,t,i,d,m,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(_),S=f.getX(_+1),R=f.getX(_+2);s=Wh(this,c,t,i,d,m,y,T,S,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),S=Math.min(p.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,z=S;R<z;R+=3){let U=R,D=R+1,P=R+2;s=Wh(this,x,t,i,d,m,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=_,S=_+1,R=_+2;s=Wh(this,c,t,i,d,m,y,T,S,R),s&&(s.faceIndex=Math.floor(_/3),e.push(s))}}}};function zk(n,t,e,i,s,u,c,f){let p;if(t.side===Pi?p=i.intersectTriangle(c,u,s,!0,f):p=i.intersectTriangle(s,u,c,t.side===sa,f),p===null)return null;Hh.copy(f),Hh.applyMatrix4(n.matrixWorld);let d=e.ray.origin.distanceTo(Hh);return d<e.near||d>e.far?null:{distance:d,point:Hh.clone(),object:n}}function Wh(n,t,e,i,s,u,c,f,p,d){n.getVertexPosition(f,$u),n.getVertexPosition(p,Zu),n.getVertexPosition(d,Ju);let m=zk(n,t,e,i,$u,Zu,Ju,Vh);if(m){s&&(Gh.fromBufferAttribute(s,f),kh.fromBufferAttribute(s,p),qh.fromBufferAttribute(s,d),m.uv=Wa.getInterpolation(Vh,$u,Zu,Ju,Gh,kh,qh,new Ht)),u&&(Gh.fromBufferAttribute(u,f),kh.fromBufferAttribute(u,p),qh.fromBufferAttribute(u,d),m.uv1=Wa.getInterpolation(Vh,$u,Zu,Ju,Gh,kh,qh,new Ht)),c&&(FA.fromBufferAttribute(c,f),UA.fromBufferAttribute(c,p),BA.fromBufferAttribute(c,d),m.normal=Wa.getInterpolation(Vh,$u,Zu,Ju,FA,UA,BA,new at),m.normal.dot(i.direction)>0&&m.normal.multiplyScalar(-1));let y={a:f,b:p,c:d,normal:new at,materialIndex:0};Wa.getNormal($u,Zu,Ju,y.normal),m.face=y}return m}var Fc=class n extends Ri{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=[],m=[],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 Wr(d,3)),this.setAttribute("normal",new Wr(m,3)),this.setAttribute("uv",new Wr(y,2));function M(A,_,x,T,S,R,z,U,D,P,ct){let L=R/D,W=z/P,V=R/2,Mt=z/2,Y=U/2,mt=D+1,ft=P+1,vt=0,it=0,lt=new at;for(let H=0;H<ft;H++){let At=H*W-Mt;for(let It=0;It<mt;It++){let jt=It*L-V;lt[A]=jt*T,lt[_]=At*S,lt[x]=Y,d.push(lt.x,lt.y,lt.z),lt[A]=0,lt[_]=0,lt[x]=U>0?1:-1,m.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+mt*H,jt=v+At+mt*(H+1),nt=v+(At+1)+mt*(H+1),bt=v+(At+1)+mt*H;p.push(It,jt,bt),p.push(jt,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 hl(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 xi(n){let t={};for(let e=0;e<n.length;e++){let i=hl(n[e]);for(let s in i)t[s]=i[s]}return t}function Gk(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function CT(n){return n.getRenderTarget()===null?n.outputColorSpace:In.workingColorSpace}var kk={clone:hl,merge:xi},qk=`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 g=this.iterator();g.hasNext();)for(var w=g.next(),C=w.getLabel(),B=0;B<2;B++)if(C.isAnyNull(B)){var K=V.NONE;if(o[B])K=V.EXTERIOR;else{var gt=w.getCoordinate();K=this.getLocation(B,gt,r)}C.setAllLocationsIfNull(B,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 l2=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,g=0;g<this._resultAreaEdgeList.size();g++){var w=this._resultAreaEdgeList.get(g),C=w.getSym();if(w.getLabel().isArea())switch(a===null&&w.isInResult()&&(a=w),h){case this._SCANNING_FOR_INCOMING:if(!C.isInResult())continue;l=C,h=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!w.isInResult())continue;l.setNext(w),h=this._SCANNING_FOR_INCOMING}}if(h===this._LINKING_TO_OUTGOING){if(a===null)throw new Oo("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 g=a.get(l-1),w=h.getQuadrant(),C=g.getQuadrant();return mn.isNorthern(w)&&mn.isNorthern(C)?h:mn.isNorthern(w)||mn.isNorthern(C)?h.getDy()!==0?h:g.getDy()!==0?g:(Pt.shouldNeverReachHere("found two horizontal edges incident on node"),null):g},o.prototype.print=function(a){Ft.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 g=this._edgeList.get(h),w=g.getSym();l===null&&(l=w),a!==null&&w.setNext(a),a=g}l.setNext(a)},o.prototype.computeDepths=function(){if(arguments.length===1){var a=arguments[0],l=this.findIndex(a),h=a.getDepth(Dt.LEFT),g=a.getDepth(Dt.RIGHT),w=this.computeDepths(l+1,this._edgeList.size(),h);if(this.computeDepths(0,l,w)!==g)throw new Oo("depth mismatch at "+a.getCoordinate())}else if(arguments.length===3){for(var C=arguments[0],B=arguments[1],K=arguments[2],gt=C;gt<B;gt++){var yt=this._edgeList.get(gt);yt.setEdgeDepths(Dt.RIGHT,K),K=yt.getDepth(Dt.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,g=this._SCANNING_FOR_INCOMING,w=this._resultAreaEdgeList.size()-1;w>=0;w--){var C=this._resultAreaEdgeList.get(w),B=C.getSym();switch(l===null&&C.getEdgeRing()===a&&(l=C),g){case this._SCANNING_FOR_INCOMING:if(B.getEdgeRing()!==a)continue;h=B,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(C.getEdgeRing()!==a)continue;h.setNextMin(C),g=this._SCANNING_FOR_INCOMING}}g===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],g=0,w=this.iterator();w.hasNext();)w.next().getEdgeRing()===h&&g++;return g}},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(),g=h.getSym();if(!h.isLineEdge()){if(h.isInResult()){a=V.INTERIOR;break}if(g.isInResult()){a=V.EXTERIOR;break}}}if(a===V.NONE)return null;for(var w=a,C=this.iterator();C.hasNext();){var B=C.next(),K=B.getSym();B.isLineEdge()?B.getEdge().setCovered(w===V.INTERIOR):(B.isInResult()&&(w=V.EXTERIOR),K.isInResult()&&(w=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(),g=0;g<2;g++){var w=h.getLocation(g);w!==V.INTERIOR&&w!==V.BOUNDARY||this._label.setLocation(g,V.INTERIOR)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(mr),Tx=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 Mf(a,new l2)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(hu),rs=function r(){this._pts=null,this._orientation=null;var o=arguments[0];this._pts=o,this._orientation=r.orientation(o)};rs.prototype.compareTo=function(r){var o=r;return rs.compareOriented(this._pts,this._orientation,o._pts,o._orientation)},rs.prototype.interfaces_=function(){return[z]},rs.prototype.getClass=function(){return rs},rs.orientation=function(r){return et.increasingDirection(r)===1},rs.compareOriented=function(r,o,a,l){for(var h=o?1:-1,g=l?1:-1,w=o?r.length:-1,C=l?a.length:-1,B=o?0:r.length-1,K=l?0:a.length-1;;){var gt=r[B].compareTo(a[K]);if(gt!==0)return gt;var yt=(B+=h)===w,Bt=(K+=g)===C;if(yt&&!Bt)return-1;if(!yt&&Bt)return 1;if(yt&&Bt)return 0}};var Ui=function(){this._edges=new O,this._ocaMap=new y};Ui.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(") ")},Ui.prototype.addAll=function(r){for(var o=r.iterator();o.hasNext();)this.add(o.next())},Ui.prototype.findEdgeIndex=function(r){for(var o=0;o<this._edges.size();o++)if(this._edges.get(o).equals(r))return o;return-1},Ui.prototype.iterator=function(){return this._edges.iterator()},Ui.prototype.getEdges=function(){return this._edges},Ui.prototype.get=function(r){return this._edges.get(r)},Ui.prototype.findEqualEdge=function(r){var o=new rs(r.getCoordinates());return this._ocaMap.get(o)},Ui.prototype.add=function(r){this._edges.add(r);var o=new rs(r.getCoordinates());this._ocaMap.put(o,r)},Ui.prototype.interfaces_=function(){return[]},Ui.prototype.getClass=function(){return Ui};var Ns=function(){};Ns.prototype.processIntersections=function(r,o,a,l){},Ns.prototype.isDone=function(){},Ns.prototype.interfaces_=function(){return[]},Ns.prototype.getClass=function(){return Ns};var pi=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};pi.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(pi.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},pi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},pi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},pi.prototype.getLineIntersector=function(){return this._li},pi.prototype.hasProperIntersection=function(){return this._hasProper},pi.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,g,w,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)))},pi.prototype.hasIntersection=function(){return this._hasIntersection},pi.prototype.isDone=function(){return!1},pi.prototype.hasInteriorIntersection=function(){return this._hasInterior},pi.prototype.interfaces_=function(){return[Ns]},pi.prototype.getClass=function(){return pi},pi.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var Zi=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};Zi.prototype.getSegmentIndex=function(){return this.segmentIndex},Zi.prototype.getCoordinate=function(){return this.coord},Zi.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex),r.println(" dist = "+this.dist)},Zi.prototype.compareTo=function(r){var o=r;return this.compare(o.segmentIndex,o.dist)},Zi.prototype.isEndPoint=function(r){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===r},Zi.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Zi.prototype.getDistance=function(){return this.dist},Zi.prototype.compare=function(r,o){return this.segmentIndex<r?-1:this.segmentIndex>r?1:this.dist<o?-1:this.dist>o?1:0},Zi.prototype.interfaces_=function(){return[z]},Zi.prototype.getClass=function(){return Zi};var lo=function(){this._nodeMap=new y,this.edge=null;var r=arguments[0];this.edge=r};lo.prototype.print=function(r){r.println("Intersections:");for(var o=this.iterator();o.hasNext();)o.next().print(r)},lo.prototype.iterator=function(){return this._nodeMap.values().iterator()},lo.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}},lo.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)},lo.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 g=new Array(a).fill(null),w=0;g[w++]=new P(r.coord);for(var C=r.segmentIndex+1;C<=o.segmentIndex;C++)g[w++]=this.edge.pts[C];return h&&(g[w]=o.coord),new Af(g,new pn(this.edge._label))},lo.prototype.add=function(r,o,a){var l=new Zi(r,o,a),h=this._nodeMap.get(l);return h!==null?h:(this._nodeMap.put(l,l),l)},lo.prototype.isIntersection=function(r){for(var o=this.iterator();o.hasNext();)if(o.next().coord.equals(r))return!0;return!1},lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo};var Os=function(){};Os.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 Os.toIntArray(a)},Os.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},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},Os.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 Uo=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 Os;this.startIndex=o.getChainStartIndices(this.pts)};Uo.prototype.getCoordinates=function(){return this.pts},Uo.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},Uo.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},Uo.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],g=arguments[1],w=arguments[2],C=arguments[3],B=arguments[4],K=arguments[5],gt=this.pts[h],yt=this.pts[g],Bt=w.pts[C],kt=w.pts[B];if(g-h==1&&B-C==1)return K.addIntersections(this.e,h,w.e,C),null;if(this.env1.init(gt,yt),this.env2.init(Bt,kt),!this.env1.intersects(this.env2))return null;var Jt=Math.trunc((h+g)/2),ae=Math.trunc((C+B)/2);h<Jt&&(C<ae&&this.computeIntersectsForChain(h,Jt,w,C,ae,K),ae<B&&this.computeIntersectsForChain(h,Jt,w,ae,B,K)),Jt<g&&(C<ae&&this.computeIntersectsForChain(Jt,g,w,C,ae,K),ae<B&&this.computeIntersectsForChain(Jt,g,w,ae,B,K))}},Uo.prototype.getStartIndexes=function(){return this.startIndex},Uo.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)},Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo};var or=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},Cx={NULL_VALUE:{configurable:!0}};or.prototype.getDepth=function(r,o){return this._depth[r][o]},or.prototype.setDepth=function(r,o,a){this._depth[r][o]=a},or.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]!==or.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===or.NULL_VALUE}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._depth[l][h]===or.NULL_VALUE}},or.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}}},or.prototype.getDelta=function(r){return this._depth[r][Dt.RIGHT]-this._depth[r][Dt.LEFT]},or.prototype.getLocation=function(r,o){return this._depth[r][o]<=0?V.EXTERIOR:V.INTERIOR},or.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},or.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]=or.depthAtLocation(l):this._depth[o][a]+=or.depthAtLocation(l))}else if(arguments.length===3){var h=arguments[0],g=arguments[1];arguments[2]===V.INTERIOR&&this._depth[h][g]++}},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.depthAtLocation=function(r){return r===V.EXTERIOR?0:r===V.INTERIOR?1:or.NULL_VALUE},Cx.NULL_VALUE.get=function(){return-1},Object.defineProperties(or,Cx);var Af=function(r){function o(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new lo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new or,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,g=!0,w=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[--w])||(g=!1),!h&&!g)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 Uo(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,g){var w=new P(a.getIntersection(g)),C=l,B=a.getEdgeDistance(h,g),K=C+1;if(K<this.pts.length){var gt=this.pts[K];w.equals2D(gt)&&(C=K,B=0)}this.eiList.add(w,C,B)},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 g=0;g<a.getIntersectionNum();g++)this.addIntersection(a,l,h,g)},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,Dt.ON),a.getLocation(1,Dt.ON),1),a.isArea()&&(l.setAtLeastIfValid(a.getLocation(0,Dt.LEFT),a.getLocation(1,Dt.LEFT),2),l.setAtLeastIfValid(a.getLocation(0,Dt.RIGHT),a.getLocation(1,Dt.RIGHT),2))},o}(ci),Tr=function(r){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Ui,this._bufParams=r||null};Tr.prototype.setWorkingPrecisionModel=function(r){this._workingPrecisionModel=r},Tr.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=Tr.depthDelta(l),g=o.getDepthDelta()+h;o.setDepthDelta(g)}else this._edgeList.add(r),r.setDepthDelta(Tr.depthDelta(r.getLabel()))},Tr.prototype.buildSubgraphs=function(r,o){for(var a=new O,l=r.iterator();l.hasNext();){var h=l.next(),g=h.getRightmostCoordinate(),w=new xa(a).getDepth(g);h.computeDepth(w),h.findResultEdges(),a.add(h),o.add(h.getDirectedEdges(),h.getNodes())}},Tr.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 br;h.create(l),o.add(h)}}return Fi.sort(o,Fi.reverseOrder()),o},Tr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Tr.prototype.getNoder=function(r){if(this._workingNoder!==null)return this._workingNoder;var o=new Yd,a=new N;return a.setPrecisionModel(r),o.setSegmentIntersector(new pi(a)),o},Tr.prototype.buffer=function(r,o){var a=this._workingPrecisionModel;a===null&&(a=r.getPrecisionModel()),this._geomFact=r.getFactory();var l=new Gr(a,this._bufParams),h=new Ai(r,o,l).getCurves();if(h.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(h,a),this._graph=new Ln(new Tx),this._graph.addEdges(this._edgeList.getEdges());var g=this.createSubgraphs(this._graph),w=new jr(this._geomFact);this.buildSubgraphs(g,w);var C=w.getPolygons();return C.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(C)},Tr.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(),g=h.getCoordinates();if(g.length!==2||!g[0].equals2D(g[1])){var w=h.getData(),C=new Af(h.getCoordinates(),new pn(w));this.insertUniqueEdge(C)}}},Tr.prototype.setNoder=function(r){this._workingNoder=r},Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Tr.depthDelta=function(r){var o=r.getLocation(0,Dt.LEFT),a=r.getLocation(0,Dt.RIGHT);return o===V.INTERIOR&&a===V.EXTERIOR?1:o===V.EXTERIOR&&a===V.INTERIOR?-1:0},Tr.convertSegStrings=function(r){for(var o=new ge,a=new O;r.hasNext();){var l=r.next(),h=o.createLineString(l.getCoordinates());a.add(h)}return o.buildGeometry(a)};var is=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],g=arguments[3];this._noder=a,this._scaleFactor=l,this._offsetX=h,this._offsetY=g,this._isScaled=!this.isIntegerPrecision()}};is.prototype.rescale=function(){if(Y(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])&&Ft.out.println(a)}},is.prototype.scale=function(){if(Y(arguments[0],tt)){for(var r=arguments[0],o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new Dn(this.scale(l.getCoordinates()),l.getData()))}return o}if(arguments[0]instanceof Array){for(var h=arguments[0],g=new Array(h.length).fill(null),w=0;w<h.length;w++)g[w]=new P(Math.round((h[w].x-this._offsetX)*this._scaleFactor),Math.round((h[w].y-this._offsetY)*this._scaleFactor),h[w].z);return et.removeRepeatedPoints(g)}},is.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},is.prototype.getNodedSubstrings=function(){var r=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(r),r},is.prototype.computeNodes=function(r){var o=r;this._isScaled&&(o=this.scale(r)),this._noder.computeNodes(o)},is.prototype.interfaces_=function(){return[Rs]},is.prototype.getClass=function(){return is};var Ji=function(){this._li=new N,this._segStrings=null;var r=arguments[0];this._segStrings=r},Ix={fact:{configurable:!0}};Ji.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(),g=1;g<h.length-1;g++)if(h[g].equals(a))throw new Vt("found endpt/interior pt intersection at index "+g+" :pt "+a)}},Ji.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],g=arguments[1],w=h.getCoordinates(),C=g.getCoordinates(),B=0;B<w.length-1;B++)for(var K=0;K<C.length-1;K++)this.checkInteriorIntersections(h,B,g,K);else if(arguments.length===4){var gt=arguments[0],yt=arguments[1],Bt=arguments[2],kt=arguments[3];if(gt===Bt&&yt===kt)return null;var Jt=gt.getCoordinates()[yt],ae=gt.getCoordinates()[yt+1],dn=Bt.getCoordinates()[kt],Wn=Bt.getCoordinates()[kt+1];if(this._li.computeIntersection(Jt,ae,dn,Wn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Jt,ae)||this.hasInteriorIntersection(this._li,dn,Wn)))throw new Vt("found non-noded intersection at "+Jt+"-"+ae+" and "+dn+"-"+Wn)}},Ji.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ji.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])},Ji.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},Ji.prototype.checkCollapse=function(r,o,a){if(r.equals(a))throw new Vt("found non-noded collapse at "+Ji.fact.createLineString([r,o,a]))},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ix.fact.get=function(){return new ge},Object.defineProperties(Ji,Ix);var kr=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)},Px={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};kr.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),g=Math.max(r.y,o.y),w=this._maxx<a||this._minx>l||this._maxy<h||this._miny>g;if(w)return!1;var C=this.intersectsToleranceSquare(r,o);return Pt.isTrue(!(w&&C),"Found bad envelope test"),C},kr.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)},kr.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))},kr.prototype.scale=function(r){return Math.round(r*this._scaleFactor)},kr.prototype.getCoordinate=function(){return this._originalPt},kr.prototype.copyScaled=function(r,o){o.x=this.scale(r.x),o.y=this.scale(r.y)},kr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var r=kr.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},kr.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())))},kr.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))))},kr.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)},kr.prototype.interfaces_=function(){return[]},kr.prototype.getClass=function(){return kr},Px.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(kr,Px);var Ql=function(){this.tempEnv1=new Ct,this.selectedSegment=new se};Ql.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)}}},Ql.prototype.interfaces_=function(){return[]},Ql.prototype.getClass=function(){return Ql};var gu=function(){this._index=null;var r=arguments[0];this._index=r},Rx={HotPixelSnapAction:{configurable:!0}};gu.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(),g=new Lx(o,a,l);return this._index.query(h,{interfaces_:function(){return[es]},visitItem:function(w){w.select(h,g)}}),g.isNodeAdded()}},gu.prototype.interfaces_=function(){return[]},gu.prototype.getClass=function(){return gu},Rx.HotPixelSnapAction.get=function(){return Lx},Object.defineProperties(gu,Rx);var Lx=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}(Ql),Ea=function(){this._li=null,this._interiorIntersections=null;var r=arguments[0];this._li=r,this._interiorIntersections=new O};Ea.prototype.processIntersections=function(r,o,a,l){if(r===a&&o===l)return null;var h=r.getCoordinates()[o],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];if(this._li.computeIntersection(h,g,w,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var B=0;B<this._li.getIntersectionNum();B++)this._interiorIntersections.add(this._li.getIntersection(B));r.addIntersections(this._li,o,0),a.addIntersections(this._li,l,1)}},Ea.prototype.isDone=function(){return!1},Ea.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ea.prototype.interfaces_=function(){return[Ns]},Ea.prototype.getClass=function(){return Ea};var co=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()};co.prototype.checkCorrectness=function(r){var o=Dn.getNodedSubstrings(r),a=new Ji(o);try{a.checkValid()}catch(l){if(!(l instanceof qt))throw l;l.printStackTrace()}},co.prototype.getNodedSubstrings=function(){return Dn.getNodedSubstrings(this._nodedSegStrings)},co.prototype.snapRound=function(r,o){var a=this.findInteriorIntersections(r,o);this.computeIntersectionSnaps(a),this.computeVertexSnaps(r)},co.prototype.findInteriorIntersections=function(r,o){var a=new Ea(o);return this._noder.setSegmentIntersector(a),this._noder.computeNodes(r),a.getInteriorIntersections()},co.prototype.computeVertexSnaps=function(){if(Y(arguments[0],tt))for(var r=arguments[0].iterator();r.hasNext();){var o=r.next();this.computeVertexSnaps(o)}else if(arguments[0]instanceof Dn)for(var a=arguments[0],l=a.getCoordinates(),h=0;h<l.length;h++){var g=new kr(l[h],this._scaleFactor,this._li);this._pointSnapper.snap(g,a,h)&&a.addIntersection(l[h],h)}},co.prototype.computeNodes=function(r){this._nodedSegStrings=r,this._noder=new Yd,this._pointSnapper=new gu(this._noder.getIndex()),this.snapRound(r,this._li)},co.prototype.computeIntersectionSnaps=function(r){for(var o=r.iterator();o.hasNext();){var a=o.next(),l=new kr(a,this._scaleFactor,this._li);this._pointSnapper.snap(l)}},co.prototype.interfaces_=function(){return[Rs]},co.prototype.getClass=function(){return co};var sr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new je,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}},yu={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};sr.prototype.bufferFixedPrecision=function(r){var o=new is(new co(new _e(1)),r.getScale()),a=new Tr(this._bufParams);a.setWorkingPrecisionModel(r),a.setNoder(o),this._resultGeometry=a.buffer(this._argGeom,this._distance)},sr.prototype.bufferReducedPrecision=function(){var r=this;if(arguments.length===0){for(var o=sr.MAX_PRECISION_DIGITS;o>=0;o--){try{r.bufferReducedPrecision(o)}catch(g){if(!(g instanceof Oo))throw g;r._saveException=g}if(r._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],l=sr.precisionScaleFactor(this._argGeom,this._distance,a),h=new _e(l);this.bufferFixedPrecision(h)}},sr.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()},sr.prototype.setQuadrantSegments=function(r){this._bufParams.setQuadrantSegments(r)},sr.prototype.bufferOriginalPrecision=function(){try{var r=new Tr(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(o){if(!(o instanceof Vt))throw o;this._saveException=o}},sr.prototype.getResultGeometry=function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry},sr.prototype.setEndCapStyle=function(r){this._bufParams.setEndCapStyle(r)},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr},sr.bufferOp=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new sr(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],g=new sr(a);return g.setQuadrantSegments(h),g.getResultGeometry(l)}if(arguments[2]instanceof je&&arguments[0]instanceof Rt&&typeof arguments[1]=="number"){var w=arguments[0],C=arguments[1],B=arguments[2];return new sr(w,B).getResultGeometry(C)}}else if(arguments.length===4){var K=arguments[0],gt=arguments[1],yt=arguments[2],Bt=arguments[3],kt=new sr(K);return kt.setQuadrantSegments(yt),kt.setEndCapStyle(Bt),kt.getResultGeometry(gt)}},sr.precisionScaleFactor=function(r,o,a){var l=r.getEnvelopeInternal(),h=mt.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(o>0?o:0),g=a-Math.trunc(Math.log(h)/Math.log(10)+1);return Math.pow(10,g)},yu.CAP_ROUND.get=function(){return je.CAP_ROUND},yu.CAP_BUTT.get=function(){return je.CAP_FLAT},yu.CAP_FLAT.get=function(){return je.CAP_FLAT},yu.CAP_SQUARE.get=function(){return je.CAP_SQUARE},yu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(sr,yu);var Cr=function(){this._pt=[new P,new P],this._distance=S.NaN,this._isNull=!0};Cr.prototype.getCoordinates=function(){return this._pt},Cr.prototype.getCoordinate=function(r){return this._pt[r]},Cr.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)}},Cr.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}},Cr.prototype.getDistance=function(){return this._distance},Cr.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)}},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr};var fo=function(){};fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo},fo.computeDistance=function(){if(arguments[2]instanceof Cr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=r.getCoordinates(),h=new se,g=0;g<l.length-1;g++){h.setCoordinates(l[g],l[g+1]);var w=h.closestPoint(o);a.setMinimum(w,o)}else if(arguments[2]instanceof Cr&&arguments[0]instanceof ne&&arguments[1]instanceof P){var C=arguments[0],B=arguments[1],K=arguments[2];fo.computeDistance(C.getExteriorRing(),B,K);for(var gt=0;gt<C.getNumInteriorRing();gt++)fo.computeDistance(C.getInteriorRingN(gt),B,K)}else if(arguments[2]instanceof Cr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],Bt=arguments[1],kt=arguments[2];if(yt instanceof ut)fo.computeDistance(yt,Bt,kt);else if(yt instanceof ne)fo.computeDistance(yt,Bt,kt);else if(yt instanceof En)for(var Jt=yt,ae=0;ae<Jt.getNumGeometries();ae++){var dn=Jt.getGeometryN(ae);fo.computeDistance(dn,Bt,kt)}else kt.setMinimum(yt.getCoordinate(),Bt)}else if(arguments[2]instanceof Cr&&arguments[0]instanceof se&&arguments[1]instanceof P){var Wn=arguments[0],Lr=arguments[1],go=arguments[2],fs=Wn.closestPoint(Lr);go.setMinimum(fs,Lr)}};var Ds=function(r){this._maxPtDist=new Cr,this._inputGeom=r||null},$d={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Ds.prototype.computeMaxMidpointDistance=function(r){var o=new os(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Ds.prototype.computeMaxVertexDistance=function(r){var o=new wa(this._inputGeom);r.apply(o),this._maxPtDist.setMaximum(o.getMaxPointDistance())},Ds.prototype.findDistance=function(r){return this.computeMaxVertexDistance(r),this.computeMaxMidpointDistance(r),this._maxPtDist.getDistance()},Ds.prototype.getDistancePoints=function(){return this._maxPtDist},Ds.prototype.interfaces_=function(){return[]},Ds.prototype.getClass=function(){return Ds},$d.MaxPointDistanceFilter.get=function(){return wa},$d.MaxMidpointDistanceFilter.get=function(){return os},Object.defineProperties(Ds,$d);var wa=function(r){this._maxPtDist=new Cr,this._minPtDist=new Cr,this._geom=r||null};wa.prototype.filter=function(r){this._minPtDist.initialize(),fo.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},wa.prototype.getMaxPointDistance=function(){return this._maxPtDist},wa.prototype.interfaces_=function(){return[j]},wa.prototype.getClass=function(){return wa};var os=function(r){this._maxPtDist=new Cr,this._minPtDist=new Cr,this._geom=r||null};os.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(),fo.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},os.prototype.isDone=function(){return!1},os.prototype.isGeometryChanged=function(){return!1},os.prototype.getMaxPointDistance=function(){return this._maxPtDist},os.prototype.interfaces_=function(){return[Tn]},os.prototype.getClass=function(){return os};var Bo=function(r){this._comps=r||null};Bo.prototype.filter=function(r){r instanceof ne&&this._comps.add(r)},Bo.prototype.interfaces_=function(){return[Rn]},Bo.prototype.getClass=function(){return Bo},Bo.getPolygons=function(){if(arguments.length===1){var r=arguments[0];return Bo.getPolygons(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof ne?a.add(o):o instanceof En&&o.apply(new Bo(a)),a}};var ar=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}};ar.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)},ar.prototype.setForceToLineString=function(r){this._isForcedToLineString=r},ar.prototype.interfaces_=function(){return[ce]},ar.prototype.getClass=function(){return ar},ar.getGeometry=function(){if(arguments.length===1){var r=arguments[0];return r.getFactory().buildGeometry(ar.getLines(r))}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o.getFactory().buildGeometry(ar.getLines(o,a))}},ar.getLines=function(){if(arguments.length===1){var r=arguments[0];return ar.getLines(r,!1)}if(arguments.length===2){if(Y(arguments[0],tt)&&Y(arguments[1],tt)){for(var o=arguments[0],a=arguments[1],l=o.iterator();l.hasNext();){var h=l.next();ar.getLines(h,a)}return a}if(arguments[0]instanceof Rt&&typeof arguments[1]=="boolean"){var g=arguments[0],w=arguments[1],C=new O;return g.apply(new ar(C,w)),C}if(arguments[0]instanceof Rt&&Y(arguments[1],tt)){var B=arguments[0],K=arguments[1];return B instanceof ut?K.add(B):B.apply(new ar(K)),K}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&Y(arguments[0],tt)&&Y(arguments[1],tt)){for(var gt=arguments[0],yt=arguments[1],Bt=arguments[2],kt=gt.iterator();kt.hasNext();){var Jt=kt.next();ar.getLines(Jt,yt,Bt)}return yt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Rt&&Y(arguments[1],tt)){var ae=arguments[0],dn=arguments[1],Wn=arguments[2];return ae.apply(new ar(dn,Wn)),dn}}};var Bi=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}}};Bi.prototype.locateInternal=function(){if(arguments[0]instanceof P&&arguments[1]instanceof ne){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 g=o.getInteriorRingN(h),w=this.locateInPolygonRing(r,g);if(w===V.INTERIOR)return V.EXTERIOR;if(w===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof P&&arguments[1]instanceof ut){var C=arguments[0],B=arguments[1];if(!B.getEnvelopeInternal().intersects(C))return V.EXTERIOR;var K=B.getCoordinates();return B.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 Qt){var gt=arguments[0];return arguments[1].getCoordinate().equals2D(gt)?V.INTERIOR:V.EXTERIOR}},Bi.prototype.locateInPolygonRing=function(r,o){return o.getEnvelopeInternal().intersects(r)?ot.locatePointInRing(r,o.getCoordinates()):V.EXTERIOR},Bi.prototype.intersects=function(r,o){return this.locate(r,o)!==V.EXTERIOR},Bi.prototype.updateLocationInfo=function(r){r===V.INTERIOR&&(this._isIn=!0),r===V.BOUNDARY&&this._numBoundaries++},Bi.prototype.computeLocation=function(r,o){if(o instanceof Qt&&this.updateLocationInfo(this.locateInternal(r,o)),o instanceof ut)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof ne)this.updateLocationInfo(this.locateInternal(r,o));else if(o instanceof Jr)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 g=o,w=0;w<g.getNumGeometries();w++){var C=g.getGeometryN(w);this.updateLocationInfo(this.locateInternal(r,C))}else if(o instanceof En)for(var B=new uo(o);B.hasNext();){var K=B.next();K!==o&&this.computeLocation(r,K)}},Bi.prototype.locate=function(r,o){return o.isEmpty()?V.EXTERIOR:o instanceof ut?this.locateInternal(r,o):o instanceof ne?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)},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var Ir=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],g=arguments[2];this._component=l,this._segIndex=h,this._pt=g}},Nx={INSIDE_AREA:{configurable:!0}};Ir.prototype.isInsideArea=function(){return this._segIndex===Ir.INSIDE_AREA},Ir.prototype.getCoordinate=function(){return this._pt},Ir.prototype.getGeometryComponent=function(){return this._component},Ir.prototype.getSegmentIndex=function(){return this._segIndex},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir},Nx.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Ir,Nx);var ss=function(r){this._pts=r||null};ss.prototype.filter=function(r){r instanceof Qt&&this._pts.add(r)},ss.prototype.interfaces_=function(){return[Rn]},ss.prototype.getClass=function(){return ss},ss.getPoints=function(){if(arguments.length===1){var r=arguments[0];return r instanceof Qt?Fi.singletonList(r):ss.getPoints(r,new O)}if(arguments.length===2){var o=arguments[0],a=arguments[1];return o instanceof Qt?a.add(o):o instanceof En&&o.apply(new ss(a)),a}};var Sa=function(){this._locations=null;var r=arguments[0];this._locations=r};Sa.prototype.filter=function(r){(r instanceof Qt||r instanceof ut||r instanceof ne)&&this._locations.add(new Ir(r,0,r.getCoordinate()))},Sa.prototype.interfaces_=function(){return[Rn]},Sa.prototype.getClass=function(){return Sa},Sa.getLocations=function(r){var o=new O;return r.apply(new Sa(o)),o};var ur=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Bi,this._minDistanceLocation=null,this._minDistance=S.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}};ur.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=Bo.getPolygons(this._geom[o]);if(h.size()>0){var g=Sa.getLocations(this._geom[l]);if(this.computeContainmentDistance(g,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&&Y(arguments[0],ht)&&Y(arguments[1],ht)){for(var w=arguments[0],C=arguments[1],B=arguments[2],K=0;K<w.size();K++)for(var gt=w.get(K),yt=0;yt<C.size();yt++)if(this.computeContainmentDistance(gt,C.get(yt),B),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ir&&arguments[1]instanceof ne){var Bt=arguments[0],kt=arguments[1],Jt=arguments[2],ae=Bt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(ae,kt))return this._minDistance=0,Jt[0]=Bt,Jt[1]=new Ir(kt,ae),null}}},ur.prototype.computeMinDistanceLinesPoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),g=0;g<o.size();g++){var w=o.get(g);if(this.computeMinDistance(h,w,a),this._minDistance<=this._terminateDistance)return null}},ur.prototype.computeFacetDistance=function(){var r=new Array(2).fill(null),o=ar.getLines(this._geom[0]),a=ar.getLines(this._geom[1]),l=ss.getPoints(this._geom[0]),h=ss.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))))},ur.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},ur.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])},ur.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},ur.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 Qt){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(),g=0;g<l.length-1;g++){var w=ot.distancePointLine(h,l[g],l[g+1]);if(w<this._minDistance){this._minDistance=w;var C=new se(l[g],l[g+1]).closestPoint(h);a[0]=new Ir(r,g,C),a[1]=new Ir(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 B=arguments[0],K=arguments[1],gt=arguments[2];if(B.getEnvelopeInternal().distance(K.getEnvelopeInternal())>this._minDistance)return null;for(var yt=B.getCoordinates(),Bt=K.getCoordinates(),kt=0;kt<yt.length-1;kt++)for(var Jt=0;Jt<Bt.length-1;Jt++){var ae=ot.distanceLineLine(yt[kt],yt[kt+1],Bt[Jt],Bt[Jt+1]);if(ae<this._minDistance){this._minDistance=ae;var dn=new se(yt[kt],yt[kt+1]),Wn=new se(Bt[Jt],Bt[Jt+1]),Lr=dn.closestPoints(Wn);gt[0]=new Ir(B,kt,Lr[0]),gt[1]=new Ir(K,Jt,Lr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},ur.prototype.computeMinDistancePoints=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),g=0;g<o.size();g++){var w=o.get(g),C=h.getCoordinate().distance(w.getCoordinate());if(C<this._minDistance&&(this._minDistance=C,a[0]=new Ir(h,0,h.getCoordinate()),a[1]=new Ir(w,0,w.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},ur.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)},ur.prototype.computeMinDistanceLines=function(r,o,a){for(var l=0;l<r.size();l++)for(var h=r.get(l),g=0;g<o.size();g++){var w=o.get(g);if(this.computeMinDistance(h,w,a),this._minDistance<=this._terminateDistance)return null}},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.distance=function(r,o){return new ur(r,o).distance()},ur.isWithinDistance=function(r,o,a){return new ur(r,o,a).distance()<=a},ur.nearestPoints=function(r,o){return new ur(r,o).nearestPoints()};var gr=function(){this._pt=[new P,new P],this._distance=S.NaN,this._isNull=!0};gr.prototype.getCoordinates=function(){return this._pt},gr.prototype.getCoordinate=function(r){return this._pt[r]},gr.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)}},gr.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}},gr.prototype.toString=function(){return St.toLineString(this._pt[0],this._pt[1])},gr.prototype.getDistance=function(){return this._distance},gr.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)}},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr};var ji=function(){};ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji},ji.computeDistance=function(){if(arguments[2]instanceof gr&&arguments[0]instanceof ut&&arguments[1]instanceof P)for(var r=arguments[0],o=arguments[1],a=arguments[2],l=new se,h=r.getCoordinates(),g=0;g<h.length-1;g++){l.setCoordinates(h[g],h[g+1]);var w=l.closestPoint(o);a.setMinimum(w,o)}else if(arguments[2]instanceof gr&&arguments[0]instanceof ne&&arguments[1]instanceof P){var C=arguments[0],B=arguments[1],K=arguments[2];ji.computeDistance(C.getExteriorRing(),B,K);for(var gt=0;gt<C.getNumInteriorRing();gt++)ji.computeDistance(C.getInteriorRingN(gt),B,K)}else if(arguments[2]instanceof gr&&arguments[0]instanceof Rt&&arguments[1]instanceof P){var yt=arguments[0],Bt=arguments[1],kt=arguments[2];if(yt instanceof ut)ji.computeDistance(yt,Bt,kt);else if(yt instanceof ne)ji.computeDistance(yt,Bt,kt);else if(yt instanceof En)for(var Jt=yt,ae=0;ae<Jt.getNumGeometries();ae++){var dn=Jt.getGeometryN(ae);ji.computeDistance(dn,Bt,kt)}else kt.setMinimum(yt.getCoordinate(),Bt)}else if(arguments[2]instanceof gr&&arguments[0]instanceof se&&arguments[1]instanceof P){var Wn=arguments[0],Lr=arguments[1],go=arguments[2],fs=Wn.closestPoint(Lr);go.setMinimum(fs,Lr)}};var Ti=function(){this._g0=null,this._g1=null,this._ptDist=new gr,this._densifyFrac=0;var r=arguments[0],o=arguments[1];this._g0=r,this._g1=o},Zd={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Ti.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Ti.prototype.setDensifyFraction=function(r){if(r>1||r<=0)throw new T("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=r},Ti.prototype.compute=function(r,o){this.computeOrientedDistance(r,o,this._ptDist),this.computeOrientedDistance(o,r,this._ptDist)},Ti.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Ti.prototype.computeOrientedDistance=function(r,o,a){var l=new Ma(o);if(r.apply(l),a.setMaximum(l.getMaxPointDistance()),this._densifyFrac>0){var h=new as(o,this._densifyFrac);r.apply(h),a.setMaximum(h.getMaxPointDistance())}},Ti.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.distance=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return new Ti(r,o).distance()}if(arguments.length===3){var a=arguments[0],l=arguments[1],h=arguments[2],g=new Ti(a,l);return g.setDensifyFraction(h),g.distance()}},Zd.MaxPointDistanceFilter.get=function(){return Ma},Zd.MaxDensifiedByFractionDistanceFilter.get=function(){return as},Object.defineProperties(Ti,Zd);var Ma=function(){this._maxPtDist=new gr,this._minPtDist=new gr,this._euclideanDist=new ji,this._geom=null;var r=arguments[0];this._geom=r};Ma.prototype.filter=function(r){this._minPtDist.initialize(),ji.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ma.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ma.prototype.interfaces_=function(){return[j]},Ma.prototype.getClass=function(){return Ma};var as=function(){this._maxPtDist=new gr,this._minPtDist=new gr,this._geom=null,this._numSubSegs=0;var r=arguments[0],o=arguments[1];this._geom=r,this._numSubSegs=Math.trunc(Math.round(1/o))};as.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,g=(l.y-a.y)/this._numSubSegs,w=0;w<this._numSubSegs;w++){var C=a.x+w*h,B=a.y+w*g,K=new P(C,B);this._minPtDist.initialize(),ji.computeDistance(this._geom,K,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},as.prototype.isDone=function(){return!1},as.prototype.isGeometryChanged=function(){return!1},as.prototype.getMaxPointDistance=function(){return this._maxPtDist},as.prototype.interfaces_=function(){return[Tn]},as.prototype.getClass=function(){return as};var Qr=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},Jd={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Qr.prototype.checkMaximumDistance=function(r,o,a){var l=new Ti(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 "+St.toLineString(h[0],h[1])+")"}},Qr.prototype.isValid=function(){var r=Math.abs(this._bufDistance),o=Qr.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(),Qr.VERBOSE&&Ft.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Qr.prototype.checkNegativeValid=function(){if(!(this._input instanceof ne||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)},Qr.prototype.getErrorIndicator=function(){return this._errorIndicator},Qr.prototype.checkMinimumDistance=function(r,o,a){var l=new ur(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 "+St.toLineString(h[0],h[1])+" )"}},Qr.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)},Qr.prototype.getErrorLocation=function(){return this._errorLocation},Qr.prototype.getPolygonLines=function(r){for(var o=new O,a=new ar(o),l=Bo.getPolygons(r).iterator();l.hasNext();)l.next().apply(a);return r.getFactory().buildGeometry(o)},Qr.prototype.getErrorMessage=function(){return this._errMsg},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr},Jd.VERBOSE.get=function(){return!1},Jd.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Qr,Jd);var lr=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},jd={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};lr.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},lr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var r=this._distance*lr.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")},lr.prototype.checkDistance=function(){var r=new Qr(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")},lr.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")},lr.prototype.checkPolygonal=function(){this._result instanceof ne||this._result instanceof he||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},lr.prototype.getErrorIndicator=function(){return this._errorIndicator},lr.prototype.getErrorLocation=function(){return this._errorLocation},lr.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"))},lr.prototype.report=function(r){if(!lr.VERBOSE)return null;Ft.out.println("Check "+r+": "+(this._isValid?"passed":"FAILED"))},lr.prototype.getErrorMessage=function(){return this._errorMsg},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.isValidMsg=function(r,o,a){var l=new lr(r,o,a);return l.isValid()?null:l.getErrorMessage()},lr.isValid=function(r,o,a){return!!new lr(r,o,a).isValid()},jd.VERBOSE.get=function(){return!1},jd.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(lr,jd);var Ki=function(){this._pts=null,this._data=null;var r=arguments[0],o=arguments[1];this._pts=r,this._data=o};Ki.prototype.getCoordinates=function(){return this._pts},Ki.prototype.size=function(){return this._pts.length},Ki.prototype.getCoordinate=function(r){return this._pts[r]},Ki.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ki.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:va.octant(this.getCoordinate(r),this.getCoordinate(r+1))},Ki.prototype.setData=function(r){this._data=r},Ki.prototype.getData=function(){return this._data},Ki.prototype.toString=function(){return St.toLineString(new oe(this._pts))},Ki.prototype.interfaces_=function(){return[ao]},Ki.prototype.getClass=function(){return Ki};var nr=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};nr.prototype.getInteriorIntersection=function(){return this._interiorIntersection},nr.prototype.setCheckEndSegmentsOnly=function(r){this._isCheckEndSegmentsOnly=r},nr.prototype.getIntersectionSegments=function(){return this._intSegments},nr.prototype.count=function(){return this._intersectionCount},nr.prototype.getIntersections=function(){return this._intersections},nr.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},nr.prototype.setKeepIntersections=function(r){this._keepIntersections=r},nr.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],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,g,w,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=h,this._intSegments[1]=g,this._intSegments[2]=w,this._intSegments[3]=C,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},nr.prototype.isEndSegment=function(r,o){return o===0||o>=r.size()-2},nr.prototype.hasIntersection=function(){return this._interiorIntersection!==null},nr.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},nr.prototype.interfaces_=function(){return[Ns]},nr.prototype.getClass=function(){return nr},nr.createAllIntersectionsFinder=function(r){var o=new nr(r);return o.setFindAllIntersections(!0),o},nr.createAnyIntersectionFinder=function(r){return new nr(r)},nr.createIntersectionCounter=function(r){var o=new nr(r);return o.setFindAllIntersections(!0),o.setKeepIntersections(!1),o};var zi=function(){this._li=new N,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var r=arguments[0];this._segStrings=r};zi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},zi.prototype.getIntersections=function(){return this._segInt.getIntersections()},zi.prototype.isValid=function(){return this.execute(),this._isValid},zi.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},zi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new nr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var r=new Yd;if(r.setSegmentIntersector(this._segInt),r.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},zi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Oo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},zi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var r=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+St.toLineString(r[0],r[1])+" and "+St.toLineString(r[2],r[3])},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi},zi.computeIntersections=function(r){var o=new zi(r);return o.setFindAllIntersections(!0),o.isValid(),o.getIntersections()};var Fs=function r(){this._nv=null;var o=arguments[0];this._nv=new zi(r.toSegmentStrings(o))};Fs.prototype.checkValid=function(){this._nv.checkValid()},Fs.prototype.interfaces_=function(){return[]},Fs.prototype.getClass=function(){return Fs},Fs.toSegmentStrings=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next();o.add(new Ki(l.getCoordinates(),l))}return o},Fs.checkValid=function(r){new Fs(r).checkValid()};var ba=function(r){this._mapOp=r};ba.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(ge.toGeometryArray(o))},ba.prototype.interfaces_=function(){return[]},ba.prototype.getClass=function(){return ba},ba.map=function(r,o){return new ba(o).map(r)};var Qi=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};Qi.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)}},Qi.prototype.labelIsolatedLine=function(r,o){var a=this._ptLocator.locate(r.getCoordinate(),this._op.getArgGeometry(o));r.getLabel().setLocation(o,a)},Qi.prototype.build=function(r){return this.findCoveredLineEdges(),this.collectLines(r),this.buildLines(r),this._resultLineList},Qi.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)))},Qi.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)}}},Qi.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))}},Qi.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)}},Qi.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))))},Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi};var Aa=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new O;var r=arguments[0],o=arguments[1];this._op=r,this._geometryFactory=o};Aa.prototype.filterCoveredNodeToPoint=function(r){var o=r.getCoordinate();if(!this._op.isCoveredByLA(o)){var a=this._geometryFactory.createPoint(o);this._resultPointList.add(a)}},Aa.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)}}},Aa.prototype.build=function(r){return this.extractNonCoveredResultNodes(r),this._resultPointList},Aa.prototype.interfaces_=function(){return[]},Aa.prototype.getClass=function(){return Aa};var qr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};qr.prototype.transformPoint=function(r,o){return this._factory.createPoint(this.transformCoordinates(r.getCoordinateSequence(),r))},qr.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,g=0;g<r.getNumInteriorRing();g++){var w=this.transformLinearRing(r.getInteriorRingN(g),r);w===null||w.isEmpty()||(w instanceof fe||(a=!1),h.add(w))}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)},qr.prototype.createCoordinateSequence=function(r){return this._factory.getCoordinateSequenceFactory().create(r)},qr.prototype.getInputGeometry=function(){return this._inputGeom},qr.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)},qr.prototype.transformCoordinates=function(r,o){return this.copy(r)},qr.prototype.transformLineString=function(r,o){return this._factory.createLineString(this.transformCoordinates(r.getCoordinateSequence(),r))},qr.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)},qr.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)},qr.prototype.copy=function(r){return r.copy()},qr.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(ge.toGeometryArray(a)):this._factory.buildGeometry(a)},qr.prototype.transform=function(r){if(this._inputGeom=r,this._factory=r.getFactory(),r instanceof Qt)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 Jr)return this.transformMultiLineString(r,null);if(r instanceof ne)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())},qr.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)},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr};var ho=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new se,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}};ho.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),g=this.findSnapForVertex(h,o);g!==null&&(r.set(l,new P(g)),l===0&&this._isClosed&&r.set(r.size()-1,new P(g)))}},ho.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},ho.prototype.snapTo=function(r){var o=new J(this._srcPts);return this.snapVertices(o,r),this.snapSegments(o,r),o.toCoordinateArray()},ho.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],g=this.findSegmentIndexToSnap(h,r);g>=0&&r.add(g+1,new P(h),!1)}},ho.prototype.findSegmentIndexToSnap=function(r,o){for(var a=S.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 g=this._seg.distance(r);g<this._snapTolerance&&g<a&&(a=g,l=h)}return l},ho.prototype.setAllowSnappingToSourceVertices=function(r){this._allowSnappingToSourceVertices=r},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho},ho.isClosed=function(r){return!(r.length<=1)&&r[0].equals2D(r[r.length-1])};var Fn=function(r){this._srcGeom=r||null},Ox={SNAP_PRECISION_FACTOR:{configurable:!0}};Fn.prototype.snapTo=function(r,o){var a=this.extractTargetCoordinates(r);return new Dx(o,a).transform(this._srcGeom)},Fn.prototype.snapToSelf=function(r,o){var a=this.extractTargetCoordinates(this._srcGeom),l=new Dx(r,a,!0).transform(this._srcGeom),h=l;return o&&Y(h,le)&&(h=l.buffer(0)),h},Fn.prototype.computeSnapTolerance=function(r){return this.computeMinimumSegmentLength(r)/10},Fn.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))},Fn.prototype.computeMinimumSegmentLength=function(r){for(var o=S.MAX_VALUE,a=0;a<r.length-1;a++){var l=r[a].distance(r[a+1]);l<o&&(o=l)}return o},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.snap=function(r,o,a){var l=new Array(2).fill(null),h=new Fn(r);l[0]=h.snapTo(o,a);var g=new Fn(o);return l[1]=g.snapTo(l[0],a),l},Fn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var r=arguments[0],o=Fn.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],g=arguments[1];return Math.min(Fn.computeOverlaySnapTolerance(h),Fn.computeOverlaySnapTolerance(g))}},Fn.computeSizeBasedSnapTolerance=function(r){var o=r.getEnvelopeInternal();return Math.min(o.getHeight(),o.getWidth())*Fn.SNAP_PRECISION_FACTOR},Fn.snapToSelf=function(r,o,a){return new Fn(r).snapToSelf(o,a)},Ox.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Fn,Ox);var Dx=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 ho(a,this._snapTolerance);return h.setAllowSnappingToSourceVertices(this._isSelfSnap),h.snapTo(l)},o.prototype.transformCoordinates=function(a,l){var h=a.toCoordinateArray(),g=this.snapLine(h,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(g)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(qr),Pr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Pr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},Pr.prototype.add=function(r){var o=S.doubleToLongBits(r);if(this._isFirst)return this._commonBits=o,this._commonSignExp=Pr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Pr.signExpBits(o)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Pr.numCommonMostSigMantissaBits(this._commonBits,o),this._commonBits=Pr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Pr.prototype.toString=function(){if(arguments.length===1){var r=arguments[0],o=S.longBitsToDouble(r),a="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(r),l=a.substring(a.length-64);return l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+o+" ]"}},Pr.prototype.interfaces_=function(){return[]},Pr.prototype.getClass=function(){return Pr},Pr.getBit=function(r,o){return r&1<<o?1:0},Pr.signExpBits=function(r){return r>>52},Pr.zeroLowerBits=function(r,o){return r&~((1<<o)-1)},Pr.numCommonMostSigMantissaBits=function(r,o){for(var a=0,l=52;l>=0;l--){if(Pr.getBit(r,l)!==Pr.getBit(o,l))return a;a++}return 52};var us=function(){this._commonCoord=null,this._ccFilter=new Ta},Kd={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};us.prototype.addCommonBits=function(r){var o=new ls(this._commonCoord);r.apply(o),r.geometryChanged()},us.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 ls(o);return r.apply(a),r.geometryChanged(),r},us.prototype.getCommonCoordinate=function(){return this._commonCoord},us.prototype.add=function(r){r.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us},Kd.CommonCoordinateFilter.get=function(){return Ta},Kd.Translater.get=function(){return ls},Object.defineProperties(us,Kd);var Ta=function(){this._commonBitsX=new Pr,this._commonBitsY=new Pr};Ta.prototype.filter=function(r){this._commonBitsX.add(r.x),this._commonBitsY.add(r.y)},Ta.prototype.getCommonCoordinate=function(){return new P(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ta.prototype.interfaces_=function(){return[j]},Ta.prototype.getClass=function(){return Ta};var ls=function(){this.trans=null;var r=arguments[0];this.trans=r};ls.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)},ls.prototype.isDone=function(){return!1},ls.prototype.isGeometryChanged=function(){return!0},ls.prototype.interfaces_=function(){return[Tn]},ls.prototype.getClass=function(){return ls};var rr=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()};rr.prototype.selfSnap=function(r){return new Fn(r).snapTo(r,this._snapTolerance)},rr.prototype.removeCommonBits=function(r){this._cbr=new us,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},rr.prototype.prepareResult=function(r){return this._cbr.addCommonBits(r),r},rr.prototype.getResultGeometry=function(r){var o=this.snap(this._geom),a=de.overlayOp(o[0],o[1],r);return this.prepareResult(a)},rr.prototype.checkValid=function(r){r.isValid()||Ft.out.println("Snapped geometry is invalid")},rr.prototype.computeSnapTolerance=function(){this._snapTolerance=Fn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},rr.prototype.snap=function(r){var o=this.removeCommonBits(r);return Fn.snap(o[0],o[1],this._snapTolerance)},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.overlayOp=function(r,o,a){return new rr(r,o).getResultGeometry(a)},rr.union=function(r,o){return rr.overlayOp(r,o,de.UNION)},rr.intersection=function(r,o){return rr.overlayOp(r,o,de.INTERSECTION)},rr.symDifference=function(r,o){return rr.overlayOp(r,o,de.SYMDIFFERENCE)},rr.difference=function(r,o){return rr.overlayOp(r,o,de.DIFFERENCE)};var Rr=function(r,o){this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=o};Rr.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 Vt))throw h;l=h}if(!a)try{o=rr.overlayOp(this._geom[0],this._geom[1],r)}catch(h){throw h instanceof Vt?l:h}return o},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.overlayOp=function(r,o,a){return new Rr(r,o).getResultGeometry(a)},Rr.union=function(r,o){return Rr.overlayOp(r,o,de.UNION)},Rr.intersection=function(r,o){return Rr.overlayOp(r,o,de.INTERSECTION)},Rr.symDifference=function(r,o){return Rr.overlayOp(r,o,de.SYMDIFFERENCE)},Rr.difference=function(r,o){return Rr.overlayOp(r,o,de.DIFFERENCE)};var tc=function(){this.mce=null,this.chainIndex=null;var r=arguments[0],o=arguments[1];this.mce=r,this.chainIndex=o};tc.prototype.computeIntersections=function(r,o){this.mce.computeIntersectsForChain(this.chainIndex,r.mce,r.chainIndex,o)},tc.prototype.interfaces_=function(){return[]},tc.prototype.getClass=function(){return tc};var ti=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],g=arguments[2];this._eventType=r.INSERT,this._label=l,this._xValue=h,this._obj=g}},Qd={INSERT:{configurable:!0},DELETE:{configurable:!0}};ti.prototype.isDelete=function(){return this._eventType===ti.DELETE},ti.prototype.setDeleteEventIndex=function(r){this._deleteEventIndex=r},ti.prototype.getObject=function(){return this._obj},ti.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},ti.prototype.getInsertEvent=function(){return this._insertEvent},ti.prototype.isInsert=function(){return this._eventType===ti.INSERT},ti.prototype.isSameLabel=function(r){return this._label!==null&&this._label===r._label},ti.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ti.prototype.interfaces_=function(){return[z]},ti.prototype.getClass=function(){return ti},Qd.INSERT.get=function(){return 1},Qd.DELETE.get=function(){return 2},Object.defineProperties(ti,Qd);var Tf=function(){};Tf.prototype.interfaces_=function(){return[]},Tf.prototype.getClass=function(){return Tf};var cr=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};cr.prototype.isTrivialIntersection=function(r,o,a,l){if(r===a&&this._li.getIntersectionNum()===1){if(cr.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},cr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cr.prototype.setIsDoneIfProperInt=function(r){this._isDoneWhenProperInt=r},cr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cr.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},cr.prototype.hasProperIntersection=function(){return this._hasProper},cr.prototype.hasIntersection=function(){return this._hasIntersection},cr.prototype.isDone=function(){return this._isDone},cr.prototype.isBoundaryPoint=function(r,o){return o!==null&&(!!this.isBoundaryPointInternal(r,o[0])||!!this.isBoundaryPointInternal(r,o[1]))},cr.prototype.setBoundaryNodes=function(r,o){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=r,this._bdyNodes[1]=o},cr.prototype.addIntersections=function(r,o,a,l){if(r===a&&o===l)return null;this.numTests++;var h=r.getCoordinates()[o],g=r.getCoordinates()[o+1],w=a.getCoordinates()[l],C=a.getCoordinates()[l+1];this._li.computeIntersection(h,g,w,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))))},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.isAdjacentSegments=function(r,o){return Math.abs(r-o)===1};var c2=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(){Fi.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 cr&&Y(arguments[0],ht)&&Y(arguments[1],ht)){var g=arguments[0],w=arguments[1],C=arguments[2];this.addEdges(g,g),this.addEdges(w,w),this.computeIntersections(C)}else if(typeof arguments[2]=="boolean"&&Y(arguments[0],ht)&&arguments[1]instanceof cr){var B=arguments[0],K=arguments[1];arguments[2]?this.addEdges(B,null):this.addEdges(B),this.computeIntersections(K)}}},o.prototype.addEdge=function(a,l){for(var h=a.getMonotoneChainEdge(),g=h.getStartIndexes(),w=0;w<g.length-1;w++){var C=new tc(h,w),B=new ti(l,h.getMinX(w),C);this.events.add(B),this.events.add(new ti(h.getMaxX(w),B))}},o.prototype.processOverlaps=function(a,l,h,g){for(var w=h.getObject(),C=a;C<l;C++){var B=this.events.get(C);if(B.isInsert()){var K=B.getObject();h.isSameLabel(B)||(w.computeIntersections(K,g),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],g=arguments[1],w=h.iterator();w.hasNext();){var C=w.next();this.addEdge(C,g)}},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Tf),po=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},Fx={NodeComparator:{configurable:!0}};po.prototype.getMin=function(){return this._min},po.prototype.intersects=function(r,o){return!(this._min>o||this._max<r)},po.prototype.getMax=function(){return this._max},po.prototype.toString=function(){return St.toLineString(new P(this._min,0),new P(this._max,0))},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po},Fx.NodeComparator.get=function(){return ec},Object.defineProperties(po,Fx);var ec=function(){};ec.prototype.compare=function(r,o){var a=r,l=o,h=(a._min+a._max)/2,g=(l._min+l._max)/2;return h<g?-1:h>g?1:0},ec.prototype.interfaces_=function(){return[D]},ec.prototype.getClass=function(){return ec};var f2=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}(po),h2=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}(po),mo=function(){this._leaves=new O,this._root=null,this._level=0};mo.prototype.buildTree=function(){Fi.sort(this._leaves,new po.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}},mo.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 f2(r,o,a))},mo.prototype.query=function(r,o,a){this.init(),this._root.query(r,o,a)},mo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},mo.prototype.printNode=function(r){Ft.out.println(St.toLineString(new P(r._min,this._level),new P(r._max,this._level)))},mo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},mo.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 h2(r.get(a),r.get(a+1));o.add(h)}}},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo};var vu=function(){this._items=new O};vu.prototype.visitItem=function(r){this._items.add(r)},vu.prototype.getItems=function(){return this._items},vu.prototype.interfaces_=function(){return[es]},vu.prototype.getClass=function(){return vu};var _u=function(){this._index=null;var r=arguments[0];if(!Y(r,le))throw new T("Argument must be Polygonal");this._index=new Us(r)},tm={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};_u.prototype.locate=function(r){var o=new wt(r),a=new xu(o);return this._index.query(r.y,r.y,a),o.getLocation()},_u.prototype.interfaces_=function(){return[mu]},_u.prototype.getClass=function(){return _u},tm.SegmentVisitor.get=function(){return xu},tm.IntervalIndexedGeometry.get=function(){return Us},Object.defineProperties(_u,tm);var xu=function(){this._counter=null;var r=arguments[0];this._counter=r};xu.prototype.visitItem=function(r){var o=r;this._counter.countSegment(o.getCoordinate(0),o.getCoordinate(1))},xu.prototype.interfaces_=function(){return[es]},xu.prototype.getClass=function(){return xu};var Us=function(){this._index=new mo;var r=arguments[0];this.init(r)};Us.prototype.init=function(r){for(var o=ar.getLines(r).iterator();o.hasNext();){var a=o.next().getCoordinates();this.addLine(a)}},Us.prototype.addLine=function(r){for(var o=1;o<r.length;o++){var a=new se(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)}},Us.prototype.query=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],a=new vu;return this._index.query(r,o,a),a.getItems()}if(arguments.length===3){var l=arguments[0],h=arguments[1],g=arguments[2];this._index.query(l,h,g)}},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us};var nc=function(r){function o(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new Wl,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Bi,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 g=arguments[0],w=arguments[1],C=arguments[2];this._argIndex=g,this._parentGeom=w,this._boundaryNodeRule=C,w!==null&&this.add(w)}}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(),g=1;V.NONE,h.getLocation(a,Dt.ON)===V.BOUNDARY&&g++;var w=o.determineBoundary(this._boundaryNodeRule,g);h.setLocation(a,w)},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],g=arguments[1],w=arguments[2],C=new cr(h,!0,!1);C.setIsDoneIfProperInt(w);var B=this.createEdgeSetIntersector(),K=this._parentGeom instanceof fe||this._parentGeom instanceof ne||this._parentGeom instanceof he,gt=g||!K;return B.computeIntersections(this._edges,C,gt),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 g=new cr(l,h,!0);return g.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,g),g},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 Qt){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 Af(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,g=a.iterator();g.hasNext();){var w=g.next();l[h++]=w.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 g=et.removeRepeatedPoints(a.getCoordinates());if(g.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=g[0],null;var w=l,C=h;ot.isCCW(g)&&(w=h,C=l);var B=new Af(g,new pn(this._argIndex,V.BOUNDARY,w,C));this._lineEdgeMap.put(a,B),this.insertEdge(B),this.insertPoint(this._argIndex,g[0],V.BOUNDARY)},o.prototype.insertPoint=function(a,l,h){var g=this._nodes.addNode(l),w=g.getLabel();w===null?g._label=new pn(a,h):w.setLocation(a,h)},o.prototype.createEdgeSetIntersector=function(){return new c2},o.prototype.addSelfIntersectionNodes=function(a){for(var l=this._edges.iterator();l.hasNext();)for(var h=l.next(),g=h.getLabel().getLocation(a),w=h.eiList.iterator();w.hasNext();){var C=w.next();this.addSelfIntersectionNode(a,C.coord,g)}},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 ne)this.addPolygon(a);else if(a instanceof ut)this.addLineString(a);else if(a instanceof Qt)this.addPoint(a);else if(a instanceof ve)this.addCollection(a);else if(a instanceof Jr)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 Y(this._parentGeom,le)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new _u(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}(Ln),Eu=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 nc(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 nc(0,o,l),this._arg[1]=new nc(1,a,l)}else if(arguments.length===3){var h=arguments[0],g=arguments[1],w=arguments[2];h.getPrecisionModel().compareTo(g.getPrecisionModel())>=0?this.setComputationPrecision(h.getPrecisionModel()):this.setComputationPrecision(g.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new nc(0,h,w),this._arg[1]=new nc(1,g,w)}};Eu.prototype.getArgGeometry=function(r){return this._arg[r].getGeometry()},Eu.prototype.setComputationPrecision=function(r){this._resultPrecisionModel=r,this._li.setPrecisionModel(this._resultPrecisionModel)},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu};var Bs=function(){};Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs},Bs.map=function(){if(arguments[0]instanceof Rt&&Y(arguments[1],Bs.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(Y(arguments[0],tt)&&Y(arguments[1],Bs.MapOp)){for(var g=arguments[0],w=arguments[1],C=new O,B=g.iterator();B.hasNext();){var K=B.next(),gt=w.map(K);gt!==null&&C.add(gt)}return C}},Bs.MapOp=function(){};var de=function(r){function o(){var a=arguments[0],l=arguments[1];r.call(this,a,l),this._ptLocator=new Bi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Ui,this._resultPolyList=new O,this._resultLineList=new O,this._resultPointList=new O,this._graph=new Ln(new Tx),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(),g=a.getLabel();l.isPointwiseEqual(a)||(g=new pn(a.getLabel())).flip();var w=l.getDepth();w.isNull()&&w.add(h),w.add(g),h.merge(g)}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,g){var w=new O;return w.addAll(a),w.addAll(l),w.addAll(h),w.isEmpty()?o.createEmptyResult(g,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(w)},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 g=h.next();if(this._ptLocator.locate(a,g)!==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(),Fs.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var h=new jr(this._geomFact);h.add(this._graph),this._resultPolyList=h.getPolygons();var g=new Qi(this,this._geomFact,this._ptLocator);this._resultLineList=g.build(a);var w=new Aa(this,this._geomFact,this._ptLocator);this._resultPointList=w.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(),g=h.getLabel();g.isArea()&&!h.isInteriorAreaEdge()&&o.isResultOfOp(g.getLocation(0,Dt.RIGHT),g.getLocation(1,Dt.RIGHT),a)&&h.setInResult(!0)}},o.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var l=a.next(),h=l.getLabel(),g=l.getDepth();if(!g.isNull()){g.normalize();for(var w=0;w<2;w++)h.isNull(w)||!h.isArea()||g.isNull(w)||(g.getDelta(w)===0?h.toLine(w):(Pt.isTrue(!g.isNull(w,Dt.LEFT),"depth of LEFT side has not been initialized"),h.setLocation(w,Dt.LEFT,g.getLocation(w,Dt.LEFT)),Pt.isTrue(!g.isNull(w,Dt.RIGHT),"depth of RIGHT side has not been initialized"),h.setLocation(w,Dt.RIGHT,g.getLocation(w,Dt.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}(Eu);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 ba.map(r,{interfaces_:function(){return[Bs.MapOp]},map:function(l){return l.intersection(a)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(o),Rr.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),Rr.overlayOp(r,o,de.SYMDIFFERENCE)},de.resultDimension=function(r,o,a){var l=o.getDimension(),h=a.getDimension(),g=-1;switch(r){case de.INTERSECTION:g=Math.min(l,h);break;case de.UNION:g=Math.max(l,h);break;case de.DIFFERENCE:g=l;break;case de.SYMDIFFERENCE:g=Math.max(l,h)}return g},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),Rr.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],g=arguments[1],w=arguments[2];switch(h===V.BOUNDARY&&(h=V.INTERIOR),g===V.BOUNDARY&&(g=V.INTERIOR),w){case de.INTERSECTION:return h===V.INTERIOR&&g===V.INTERIOR;case de.UNION:return h===V.INTERIOR||g===V.INTERIOR;case de.DIFFERENCE:return h===V.INTERIOR&&g!==V.INTERIOR;case de.SYMDIFFERENCE:return h===V.INTERIOR&&g!==V.INTERIOR||h!==V.INTERIOR&&g===V.INTERIOR}return!1}},de.INTERSECTION=1,de.UNION=2,de.DIFFERENCE=3,de.SYMDIFFERENCE=4;var cs=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Bi,this._seg=new se;var r=arguments[0],o=arguments[1];this._g=r,this._boundaryDistanceTolerance=o,this._linework=this.extractLinework(r)};cs.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},cs.prototype.getLocation=function(r){return this.isWithinToleranceOfBoundary(r)?V.BOUNDARY:this._ptLocator.locate(r,this._g)},cs.prototype.extractLinework=function(r){var o=new wu;r.apply(o);var a=o.getLinework(),l=ge.toLineStringArray(a);return r.getFactory().createMultiLineString(l)},cs.prototype.interfaces_=function(){return[]},cs.prototype.getClass=function(){return cs};var wu=function(){this._linework=null,this._linework=new O};wu.prototype.getLinework=function(){return this._linework},wu.prototype.filter=function(r){if(r instanceof ne){var o=r;this._linework.add(o.getExteriorRing());for(var a=0;a<o.getNumInteriorRing();a++)this._linework.add(o.getInteriorRingN(a))}},wu.prototype.interfaces_=function(){return[Rn]},wu.prototype.getClass=function(){return wu};var zs=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var r=arguments[0];this._g=r};zs.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)},zs.prototype.setSidesToGenerate=function(r,o){this._doLeft=r,this._doRight=o},zs.prototype.getPoints=function(r){for(var o=new O,a=ar.getLines(this._g).iterator();a.hasNext();){var l=a.next();this.extractPoints(l,r,o)}return o},zs.prototype.computeOffsetPoints=function(r,o,a,l){var h=o.x-r.x,g=o.y-r.y,w=Math.sqrt(h*h+g*g),C=a*h/w,B=a*g/w,K=(o.x+r.x)/2,gt=(o.y+r.y)/2;if(this._doLeft){var yt=new P(K-B,gt+C);l.add(yt)}if(this._doRight){var Bt=new P(K+B,gt-C);l.add(Bt)}},zs.prototype.interfaces_=function(){return[]},zs.prototype.getClass=function(){return zs};var di=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 cs(this._geom[0],this._boundaryDistanceTolerance),new cs(this._geom[1],this._boundaryDistanceTolerance),new cs(this._geom[2],this._boundaryDistanceTolerance)]},Ux={TOLERANCE:{configurable:!0}};di.prototype.reportResult=function(r,o,a){Ft.out.println("Overlay result invalid - A:"+V.toLocationSymbol(o[0])+" B:"+V.toLocationSymbol(o[1])+" expected:"+(a?"i":"e")+" actual:"+V.toLocationSymbol(o[2]))},di.prototype.isValid=function(r){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var o=this.checkValid(r);return o},di.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),!!di.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(l,this._location)}},di.prototype.addTestPts=function(r){var o=new zs(r);this._testCoords.addAll(o.getPoints(5*this._boundaryDistanceTolerance))},di.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},di.prototype.getInvalidLocation=function(){return this._invalidLocation},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di},di.hasLocation=function(r,o){for(var a=0;a<3;a++)if(r[a]===o)return!0;return!1},di.computeBoundaryDistanceTolerance=function(r,o){return Math.min(Fn.computeSizeBasedSnapTolerance(r),Fn.computeSizeBasedSnapTolerance(o))},di.isValid=function(r,o,a,l){return new di(r,o,l).isValid(a)},Ux.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(di,Ux);var mi=function r(o){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(o),this._inputGeoms=o};mi.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)}},mi.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)},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi},mi.combine=function(){if(arguments.length===1){var r=arguments[0];return new mi(r).combine()}if(arguments.length===2){var o=arguments[0],a=arguments[1];return new mi(mi.createList(o,a)).combine()}if(arguments.length===3){var l=arguments[0],h=arguments[1],g=arguments[2];return new mi(mi.createList(l,h,g)).combine()}},mi.extractFactory=function(r){return r.isEmpty()?null:r.iterator().next().getFactory()},mi.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],g=arguments[2],w=new O;return w.add(l),w.add(h),w.add(g),w}};var Hn=function(){this._inputPolys=null,this._geomFactory=null;var r=arguments[0];this._inputPolys=r,this._inputPolys===null&&(this._inputPolys=new O)},Bx={STRTREE_NODE_CAPACITY:{configurable:!0}};Hn.prototype.reduceToGeometries=function(r){for(var o=new O,a=r.iterator();a.hasNext();){var l=a.next(),h=null;Y(l,ht)?h=this.unionTree(l):l instanceof Rt&&(h=l),o.add(h)}return o},Hn.prototype.extractByEnvelope=function(r,o,a){for(var l=new O,h=0;h<o.getNumGeometries();h++){var g=o.getGeometryN(h);g.getEnvelopeInternal().intersects(r)?l.add(g):a.add(g)}return this._geomFactory.buildGeometry(l)},Hn.prototype.unionOptimized=function(r,o){var a=r.getEnvelopeInternal(),l=o.getEnvelopeInternal();if(!a.intersects(l))return mi.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)},Hn.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 Ex(Hn.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)},Hn.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=Hn.getGeometry(o,a);return this.unionSafe(h,null)}if(l-a==2)return this.unionSafe(Hn.getGeometry(o,a),Hn.getGeometry(o,a+1));var g=Math.trunc((l+a)/2),w=this.binaryUnion(o,a,g),C=this.binaryUnion(o,g,l);return this.unionSafe(w,C)}},Hn.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},Hn.prototype.unionSafe=function(r,o){return r===null&&o===null?null:r===null?o.copy():o===null?r.copy():this.unionOptimized(r,o)},Hn.prototype.unionActual=function(r,o){return Hn.restrictToPolygons(r.union(o))},Hn.prototype.unionTree=function(r){var o=this.reduceToGeometries(r);return this.binaryUnion(o)},Hn.prototype.unionUsingEnvelopeIntersection=function(r,o,a){var l=new O,h=this.extractByEnvelope(a,r,l),g=this.extractByEnvelope(a,o,l),w=this.unionActual(h,g);return l.add(w),mi.combine(l)},Hn.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)}},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn},Hn.restrictToPolygons=function(r){if(Y(r,le))return r;var o=Bo.getPolygons(r);return o.size()===1?o.get(0):r.getFactory().createMultiPolygon(ge.toPolygonArray(o))},Hn.getGeometry=function(r,o){return o>=r.size()?null:r.get(o)},Hn.union=function(r){return new Hn(r).union()},Bx.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Hn,Bx);var rc=function(){};rc.prototype.interfaces_=function(){return[]},rc.prototype.getClass=function(){return rc},rc.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),Rr.overlayOp(r,o,de.UNION)},n.GeoJSONReader=Wd,n.GeoJSONWriter=_x,n.OverlayOp=de,n.UnionOp=rc,n.BufferOp=sr,Object.defineProperty(n,"__esModule",{value:!0})})});var NN=Z((d1t,LN)=>{"use strict";var sZ=oc(),RN=Function.prototype,IN=RN.apply,PN=RN.call;LN.exports=typeof Reflect=="object"&&Reflect.apply||(sZ?PN.bind(IN):function(){return PN.apply(IN,arguments)})});var zN=Z((m1t,BN)=>{"use strict";mv();var ON=gi(),DN=Ra(),aZ=zp(),FN=Un(),UN=Vr(),uZ=hs(),lZ=UN("species"),fx=RegExp.prototype;BN.exports=function(n,t,e,i){var s=UN(n),u=!FN(function(){var d={};return d[s]=function(){return 7},""[n](d)!==7}),c=u&&!FN(function(){var d=!1,m=/a/;return n==="split"&&(m={},m.constructor={},m.constructor[lZ]=function(){return m},m.flags="",m[s]=/./[s]),m.exec=function(){return d=!0,null},m[s](""),!d});if(!u||!c||e){var f=/./[s],p=t(s,""[n],function(d,m,y,v,E){var M=m.exec;return M===aZ||M===fx.exec?u&&!E?{done:!0,value:ON(f,m,y,v)}:{done:!0,value:ON(d,y,m,v)}:{done:!1}});DN(String.prototype,n,p[0]),DN(fx,s,p[1])}i&&uZ(fx[s],"sham",!0)}});var VN=Z((g1t,qN)=>{"use strict";var hx=Zn(),cZ=_o(),fZ=Fp(),hZ=Su(),pZ=hx("".charAt),GN=hx("".charCodeAt),dZ=hx("".slice),kN=function(n){return function(t,e){var i=fZ(hZ(t)),s=cZ(e),u=i.length,c,f;return s<0||s>=u?n?"":void 0:(c=GN(i,s),c<55296||c>56319||s+1===u||(f=GN(i,s+1))<56320||f>57343?n?pZ(i,s):c:n?dZ(i,s,s+2):(c-55296<<10)+(f-56320)+65536)}};qN.exports={codeAt:kN(!1),charAt:kN(!0)}});var WN=Z((y1t,HN)=>{"use strict";var mZ=VN().charAt;HN.exports=function(n,t,e){return t+(e?mZ(n,t).length:1)}});var YN=Z((v1t,XN)=>{"use strict";var mx=Zn(),gZ=zo(),yZ=Math.floor,px=mx("".charAt),vZ=mx("".replace),dx=mx("".slice),_Z=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,xZ=/\$([$&'`]|\d{1,2})/g;XN.exports=function(n,t,e,i,s,u){var c=e+n.length,f=i.length,p=xZ;return s!==void 0&&(s=gZ(s),p=_Z),vZ(u,p,function(d,m){var y;switch(px(m,0)){case"$":return"$";case"&":return n;case"`":return dx(t,0,e);case"'":return dx(t,c);case"<":y=s[dx(m,1,-1)];break;default:var v=+m;if(v===0)return d;if(v>f){var E=yZ(v/10);return E===0?d:E<=f?i[E-1]===void 0?px(m,1):i[E-1]+px(m,1):d}y=i[v-1]}return y===void 0?"":y})}});var JN=Z((_1t,ZN)=>{"use strict";var $N=gi(),EZ=Go(),wZ=fr(),SZ=Gs(),MZ=zp(),bZ=TypeError;ZN.exports=function(n,t){var e=n.exec;if(wZ(e)){var i=$N(e,n,t);return i!==null&&EZ(i),i}if(SZ(n)==="RegExp")return $N(MZ,n,t);throw new bZ("RegExp#exec called on incompatible receiver")}});var e2=Z(()=>{"use strict";var AZ=NN(),jN=gi(),Hd=Zn(),TZ=zN(),CZ=Un(),IZ=Go(),PZ=fr(),RZ=yi(),LZ=_o(),NZ=La(),Vl=Fp(),OZ=Su(),DZ=WN(),FZ=Df(),UZ=YN(),BZ=JN(),zZ=Vr(),yx=zZ("replace"),GZ=Math.max,kZ=Math.min,qZ=Hd([].concat),gx=Hd([].push),KN=Hd("".indexOf),QN=Hd("".slice),VZ=function(n){return n===void 0?n:String(n)},HZ=function(){return"a".replace(/./,"$0")==="$0"}(),t2=function(){return/./[yx]?/./[yx]("a","$0")==="":!1}(),WZ=!CZ(function(){var n=/./;return n.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(n,"$<a>")!=="7"});TZ("replace",function(n,t,e){var i=t2?"$":"$0";return[function(u,c){var f=OZ(this),p=RZ(u)?FZ(u,yx):void 0;return p?jN(p,u,f,c):jN(t,Vl(f),u,c)},function(s,u){var c=IZ(this),f=Vl(s);if(typeof u=="string"&&KN(u,i)===-1&&KN(u,"$<")===-1){var p=e(t,c,f,u);if(p.done)return p.value}var d=PZ(u);d||(u=Vl(u));var m=c.global,y;m&&(y=c.unicode,c.lastIndex=0);for(var v=[],E;E=BZ(c,f),!(E===null||(gx(v,E),!m));){var M=Vl(E[0]);M===""&&(c.lastIndex=DZ(f,NZ(c.lastIndex),y))}for(var A="",_=0,x=0;x<v.length;x++){E=v[x];for(var T=Vl(E[0]),S=GZ(kZ(LZ(E.index),f.length),0),R=[],z,U=1;U<E.length;U++)gx(R,VZ(E[U]));var D=E.groups;if(d){var P=qZ([T],R,S,f);D!==void 0&&gx(P,D),z=Vl(AZ(u,void 0,P))}else z=UZ(T,f,S,R,D,u);S>=_&&(A+=QN(f,_,S)+z,_=S+T.length)}return A+QN(f,_)}]},!WZ||!HZ||t2)});var rEt=ue(hc(),1),iEt=ue(Eg(),1),oEt=ue(wg(),1),sEt=ue(Sg(),1),aEt=ue(bg(),1),uEt=ue(Ag(),1),lEt=ue(Pg(),1),cEt=ue(Ng(),1),fEt=ue(Dg(),1),hEt=ue(Fg(),1),pEt=ue(Bg(),1),dEt=ue(Gg(),1),mEt=ue(Hg(),1),gEt=ue(Yg(),1),yEt=ue(u0(),1),vEt=ue(l0(),1),_Et=ue(Bb(),1);var Vy="162";var M4=0,zb=1,b4=2;var dT=1,A4=2,Es=3,sa=0,Pi=1,Ss=2,na=0,sl=1,Gb=2,kb=3,qb=4,T4=5,qa=100,C4=101,I4=102,Vb=103,Hb=104,P4=200,R4=201,L4=202,N4=203,Y0=204,$0=205,O4=206,D4=207,F4=208,U4=209,B4=210,z4=211,G4=212,k4=213,q4=214,V4=0,H4=1,W4=2,np=3,X4=4,Y4=5,$4=6,Z4=7,mT=0,J4=1,j4=2,ra=0,K4=1,Q4=2,tk=3,ek=4,nk=5,rk=6,ik=7;var gT=300,ll=301,cl=302,Z0=303,J0=304,Cp=306,j0=1e3,bo=1001,K0=1002,Ei=1003,Wb=1004;var Mc=1005;var Ii=1006,c0=1007;var Ha=1008;var ia=1009,ok=1010,sk=1011,Hy=1012,yT=1013,ea=1014,Ms=1015,Dc=1016,vT=1017,_T=1018,Ya=1020,ak=1021,Ao=1023,uk=1024,lk=1025,$a=1026,fl=1027,ck=1028,xT=1029,fk=1030,ET=1031,wT=1033,f0=33776,h0=33777,p0=33778,d0=33779,Xb=35840,Yb=35841,$b=35842,Zb=35843,ST=36196,Jb=37492,jb=37496,Kb=37808,Qb=37809,tA=37810,eA=37811,nA=37812,rA=37813,iA=37814,oA=37815,sA=37816,aA=37817,uA=37818,lA=37819,cA=37820,fA=37821,m0=36492,hA=36494,pA=36495,hk=36283,dA=36284,mA=36285,gA=36286;var rp=2300,ip=2301,g0=2302,yA=2400,vA=2401,_A=2402;var pk=3200,dk=3201,mk=0,gk=1,ta="",Wo="srgb",ua="srgb-linear",Wy="display-p3",Ip="display-p3-linear",op="linear",Bn="srgb",sp="rec709",ap="p3";var Bu=7680;var xA=519,yk=512,vk=513,_k=514,MT=515,xk=516,Ek=517,wk=518,Sk=519,Q0=35044;var EA="300 es",ty=1035,bs=2e3,up=2001,aa=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}}},ni=["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 y0=Math.PI/180,ey=180/Math.PI;function As(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ni[n&255]+ni[n>>8&255]+ni[n>>16&255]+ni[n>>24&255]+"-"+ni[t&255]+ni[t>>8&255]+"-"+ni[t>>16&15|64]+ni[t>>24&255]+"-"+ni[e&63|128]+ni[e>>8&255]+"-"+ni[e>>16&255]+ni[e>>24&255]+ni[i&255]+ni[i>>8&255]+ni[i>>16&255]+ni[i>>24&255]).toLowerCase()}function ii(n,t,e){return Math.max(t,Math.min(e,n))}function Mk(n,t){return(n%t+t)%t}function v0(n,t,e){return(1-e)*n+e*t}function wA(n){return(n&n-1)===0&&n!==0}function ny(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Yo(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 Cn(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 Ht=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(ii(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}},we=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 m=this.elements;return m[0]=t,m[1]=s,m[2]=f,m[3]=e,m[4]=u,m[5]=p,m[6]=i,m[7]=c,m[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],m=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],S=s[4],R=s[7],z=s[2],U=s[5],D=s[8];return u[0]=c*A+f*T+p*z,u[3]=c*_+f*S+p*U,u[6]=c*x+f*R+p*D,u[1]=d*A+m*T+y*z,u[4]=d*_+m*S+y*U,u[7]=d*x+m*R+y*D,u[2]=v*A+E*T+M*z,u[5]=v*_+E*S+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],m=t[8];return e*c*m-e*f*d-i*u*m+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],m=t[8],y=m*c-f*d,v=f*p-m*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-m*i)*A,t[2]=(f*i-s*c)*A,t[3]=v*A,t[4]=(m*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(_0.makeScale(t,e)),this}rotate(t){return this.premultiply(_0.makeRotation(-t)),this}translate(t,e){return this.premultiply(_0.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)}},_0=new we;function bT(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function lp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function bk(){let n=lp("canvas");return n.style.display="block",n}var SA={};function AT(n){n in SA||(SA[n]=!0,console.warn(n))}var MA=new we().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),bA=new we().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ch={[ua]:{transfer:op,primaries:sp,toReference:n=>n,fromReference:n=>n},[Wo]:{transfer:Bn,primaries:sp,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Ip]:{transfer:op,primaries:ap,toReference:n=>n.applyMatrix3(bA),fromReference:n=>n.applyMatrix3(MA)},[Wy]:{transfer:Bn,primaries:ap,toReference:n=>n.convertSRGBToLinear().applyMatrix3(bA),fromReference:n=>n.applyMatrix3(MA).convertLinearToSRGB()}},Ak=new Set([ua,Ip]),In={enabled:!0,_workingColorSpace:ua,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Ak.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=Ch[t].toReference,s=Ch[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 Ch[n].primaries},getTransfer:function(n){return n===ta?op:Ch[n].transfer}};function al(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function x0(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var zu,cp=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{zu===void 0&&(zu=lp("canvas")),zu.width=t.width,zu.height=t.height;let i=zu.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=zu}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=lp("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}},Tk=0,fp=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Tk++}),this.uuid=As(),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(E0(s[c].image)):u.push(E0(s[c]))}else u=E0(s);i.url=u}return e||(t.images[this.uuid]=i),i}};function E0(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?cp.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 Ck=0,ro=class n extends aa{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,i=bo,s=bo,u=Ii,c=Ha,f=Ao,p=ia,d=n.DEFAULT_ANISOTROPY,m=ta){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ck++}),this.uuid=As(),this.name="",this.source=new fp(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 Ht(0,0),this.repeat=new Ht(1,1),this.center=new Ht(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new we,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=m,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!==gT)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case j0:t.x=t.x-Math.floor(t.x);break;case bo:t.x=t.x<0?0:1;break;case K0: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 j0:t.y=t.y-Math.floor(t.y);break;case bo:t.y=t.y<0?0:1;break;case K0: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)}};ro.DEFAULT_IMAGE=null;ro.DEFAULT_MAPPING=gT;ro.DEFAULT_ANISOTROPY=1;var Hr=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],m=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(m-v)<.01&&Math.abs(y-A)<.01&&Math.abs(M-_)<.01){if(Math.abs(m+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 S=(d+1)/2,R=(E+1)/2,z=(x+1)/2,U=(m+v)/4,D=(y+A)/4,P=(M+_)/4;return S>R&&S>z?S<.01?(i=0,s=.707106781,u=.707106781):(i=Math.sqrt(S),s=U/i,u=D/i):R>z?R<.01?(i=.707106781,s=0,u=.707106781):(s=Math.sqrt(R),i=U/s,u=P/s):z<.01?(i=.707106781,s=.707106781,u=0):(u=Math.sqrt(z),i=D/u,s=P/u),this.set(i,s,u,e),this}let T=Math.sqrt((_-M)*(_-M)+(y-A)*(y-A)+(v-m)*(v-m));return Math.abs(T)<.001&&(T=1),this.x=(_-M)/T,this.y=(y-A)/T,this.z=(v-m)/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}},ry=class extends aa{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Hr(0,0,t,e),this.scissorTest=!1,this.viewport=new Hr(0,0,t,e);let s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ii,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let u=new ro(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 fp(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"})}},Ts=class extends ry{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},hp=class extends ro{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=Ei,this.minFilter=Ei,this.wrapR=bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var iy=class extends ro{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=Ei,this.minFilter=Ei,this.wrapR=bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Cs=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],m=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]=m,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||m!==M){let _=1-f,x=p*v+d*E+m*M+y*A,T=x>=0?1:-1,S=1-x*x;if(S>Number.EPSILON){let z=Math.sqrt(S),U=Math.atan2(z,x*T);_=Math.sin(_*U)/z,f=Math.sin(f*U)/z}let R=f*T;if(p=p*_+v*R,d=d*_+E*R,m=m*_+M*R,y=y*_+A*R,_===1-f){let z=1/Math.sqrt(p*p+d*d+m*m+y*y);p*=z,d*=z,m*=z,y*=z}}t[e]=p,t[e+1]=d,t[e+2]=m,t[e+3]=y}static multiplyQuaternionsFlat(t,e,i,s,u,c){let f=i[s],p=i[s+1],d=i[s+2],m=i[s+3],y=u[c],v=u[c+1],E=u[c+2],M=u[c+3];return t[e]=f*M+m*y+p*E-d*v,t[e+1]=p*M+m*v+d*y-f*E,t[e+2]=d*M+m*E+f*v-p*y,t[e+3]=m*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),m=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*m*y+d*E*M,this._y=d*E*y-v*m*M,this._z=d*m*M+v*E*y,this._w=d*m*y-v*E*M;break;case"YXZ":this._x=v*m*y+d*E*M,this._y=d*E*y-v*m*M,this._z=d*m*M-v*E*y,this._w=d*m*y+v*E*M;break;case"ZXY":this._x=v*m*y-d*E*M,this._y=d*E*y+v*m*M,this._z=d*m*M+v*E*y,this._w=d*m*y-v*E*M;break;case"ZYX":this._x=v*m*y-d*E*M,this._y=d*E*y+v*m*M,this._z=d*m*M-v*E*y,this._w=d*m*y+v*E*M;break;case"YZX":this._x=v*m*y+d*E*M,this._y=d*E*y+v*m*M,this._z=d*m*M-v*E*y,this._w=d*m*y-v*E*M;break;case"XZY":this._x=v*m*y-d*E*M,this._y=d*E*y-v*m*M,this._z=d*m*M+v*E*y,this._w=d*m*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],m=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=(m-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=(m-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+m)/E}else{let E=2*Math.sqrt(1+y-i-f);this._w=(c-s)/E,this._x=(u+d)/E,this._y=(p+m)/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(ii(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,m=e._w;return this._x=i*m+c*f+s*d-u*p,this._y=s*m+c*p+u*f-i*d,this._z=u*m+c*d+i*p-s*f,this._w=c*m-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),m=Math.atan2(d,f),y=Math.sin((1-e)*m)/d,v=Math.sin(e*m)/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}},at=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(AA.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(AA.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),m=2*(f*e-u*s),y=2*(u*i-c*e);return this.x=e+p*d+c*y-f*m,this.y=i+p*m+f*d-u*y,this.z=s+p*y+u*m-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 w0.copy(this).projectOnVector(t),this.sub(w0)}reflect(t){return this.sub(w0.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(ii(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}},w0=new at,AA=new Cs,Za=class{constructor(t=new at(1/0,1/0,1/0),e=new at(-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(wo.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(wo.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=wo.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,wo):wo.fromBufferAttribute(u,c),wo.applyMatrix4(t.matrixWorld),this.expandByPoint(wo);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Ih.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ih.copy(i.boundingBox)),Ih.applyMatrix4(t.matrixWorld),this.union(Ih)}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,wo),wo.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(bc),Ph.subVectors(this.max,bc),Gu.subVectors(t.a,bc),ku.subVectors(t.b,bc),qu.subVectors(t.c,bc),Ys.subVectors(ku,Gu),$s.subVectors(qu,ku),Da.subVectors(Gu,qu);let e=[0,-Ys.z,Ys.y,0,-$s.z,$s.y,0,-Da.z,Da.y,Ys.z,0,-Ys.x,$s.z,0,-$s.x,Da.z,0,-Da.x,-Ys.y,Ys.x,0,-$s.y,$s.x,0,-Da.y,Da.x,0];return!S0(e,Gu,ku,qu,Ph)||(e=[1,0,0,0,1,0,0,0,1],!S0(e,Gu,ku,qu,Ph))?!1:(Rh.crossVectors(Ys,$s),e=[Rh.x,Rh.y,Rh.z],S0(e,Gu,ku,qu,Ph))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,wo).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(wo).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:(gs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),gs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),gs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),gs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),gs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),gs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),gs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),gs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(gs),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)}},gs=[new at,new at,new at,new at,new at,new at,new at,new at],wo=new at,Ih=new Za,Gu=new at,ku=new at,qu=new at,Ys=new at,$s=new at,Da=new at,bc=new at,Ph=new at,Rh=new at,Fa=new at;function S0(n,t,e,i,s){for(let u=0,c=n.length-3;u<=c;u+=3){Fa.fromArray(n,u);let f=s.x*Math.abs(Fa.x)+s.y*Math.abs(Fa.y)+s.z*Math.abs(Fa.z),p=t.dot(Fa),d=e.dot(Fa),m=i.dot(Fa);if(Math.max(-Math.max(p,d,m),Math.min(p,d,m))>f)return!1}return!0}var Ik=new Za,Ac=new at,M0=new at,Fc=class{constructor(t=new at,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):Ik.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;Ac.subVectors(t,this.center);let e=Ac.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(Ac,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):(M0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ac.copy(t.center).add(M0)),this.expandByPoint(Ac.copy(t.center).sub(M0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ys=new at,b0=new at,Lh=new at,Zs=new at,A0=new at,Nh=new at,T0=new at,oy=class{constructor(t=new at,e=new at(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,ys)),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=ys.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ys.copy(this.origin).addScaledVector(this.direction,e),ys.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){b0.copy(t).add(e).multiplyScalar(.5),Lh.copy(e).sub(t).normalize(),Zs.copy(this.origin).sub(b0);let u=t.distanceTo(e)*.5,c=-this.direction.dot(Lh),f=Zs.dot(this.direction),p=-Zs.dot(Lh),d=Zs.lengthSq(),m=Math.abs(1-c*c),y,v,E,M;if(m>0)if(y=c*p-f,v=c*f-p,M=u*m,y>=0)if(v>=-M)if(v<=M){let A=1/m;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(b0).addScaledVector(Lh,v),E}intersectSphere(t,e){ys.subVectors(t.center,this.origin);let i=ys.dot(this.direction),s=ys.dot(ys)-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,m=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),m>=0?(u=(t.min.y-v.y)*m,c=(t.max.y-v.y)*m):(u=(t.max.y-v.y)*m,c=(t.min.y-v.y)*m),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,ys)!==null}intersectTriangle(t,e,i,s,u){A0.subVectors(e,t),Nh.subVectors(i,t),T0.crossVectors(A0,Nh);let c=this.direction.dot(T0),f;if(c>0){if(s)return null;f=1}else if(c<0)f=-1,c=-c;else return null;Zs.subVectors(this.origin,t);let p=f*this.direction.dot(Nh.crossVectors(Zs,Nh));if(p<0)return null;let d=f*this.direction.dot(A0.cross(Zs));if(d<0||p+d>c)return null;let m=-f*Zs.dot(T0);return m<0?null:this.at(m/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)}},ir=class n{constructor(t,e,i,s,u,c,f,p,d,m,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,m,y,v,E,M,A,_)}set(t,e,i,s,u,c,f,p,d,m,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]=m,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/Vu.setFromMatrixColumn(t,0).length(),u=1/Vu.setFromMatrixColumn(t,1).length(),c=1/Vu.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),m=Math.cos(u),y=Math.sin(u);if(t.order==="XYZ"){let v=c*m,E=c*y,M=f*m,A=f*y;e[0]=p*m,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*m,E=p*y,M=d*m,A=d*y;e[0]=v+A*f,e[4]=M*f-E,e[8]=c*d,e[1]=c*y,e[5]=c*m,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*m,E=p*y,M=d*m,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*m,e[9]=A-v*f,e[2]=-c*d,e[6]=f,e[10]=c*p}else if(t.order==="ZYX"){let v=c*m,E=c*y,M=f*m,A=f*y;e[0]=p*m,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*m,e[4]=A-v*y,e[8]=M*y+E,e[1]=y,e[5]=c*m,e[9]=-f*m,e[2]=-d*m,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*m,e[4]=-y,e[8]=d*m,e[1]=v*y+A,e[5]=c*m,e[9]=E*y-M,e[2]=M*y-E,e[6]=f*m,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(Pk,t,Rk)}lookAt(t,e,i){let s=this.elements;return qi.subVectors(t,e),qi.lengthSq()===0&&(qi.z=1),qi.normalize(),Js.crossVectors(i,qi),Js.lengthSq()===0&&(Math.abs(i.z)===1?qi.x+=1e-4:qi.z+=1e-4,qi.normalize(),Js.crossVectors(i,qi)),Js.normalize(),Oh.crossVectors(qi,Js),s[0]=Js.x,s[4]=Oh.x,s[8]=qi.x,s[1]=Js.y,s[5]=Oh.y,s[9]=qi.y,s[2]=Js.z,s[6]=Oh.z,s[10]=qi.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],m=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],S=i[7],R=i[11],z=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],Y=s[2],mt=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*Y+d*it,u[4]=c*D+f*W+p*mt+d*lt,u[8]=c*P+f*V+p*ft+d*H,u[12]=c*ct+f*Mt+p*vt+d*At,u[1]=m*U+y*L+v*Y+E*it,u[5]=m*D+y*W+v*mt+E*lt,u[9]=m*P+y*V+v*ft+E*H,u[13]=m*ct+y*Mt+v*vt+E*At,u[2]=M*U+A*L+_*Y+x*it,u[6]=M*D+A*W+_*mt+x*lt,u[10]=M*P+A*V+_*ft+x*H,u[14]=M*ct+A*Mt+_*vt+x*At,u[3]=T*U+S*L+R*Y+z*it,u[7]=T*D+S*W+R*mt+z*lt,u[11]=T*P+S*V+R*ft+z*H,u[15]=T*ct+S*Mt+R*vt+z*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],m=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*m-u*p*m)+_*(+e*d*y-e*f*E-u*c*y+i*c*E+u*f*m-i*d*m)+x*(-s*f*m-e*p*y+e*f*v+s*c*y-i*c*v+i*p*m)}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],m=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,S=M*v*d-m*_*d-M*p*E+c*_*E+m*p*x-c*v*x,R=m*A*d-M*y*d+M*f*E-c*A*E-m*f*x+c*y*x,z=M*y*p-m*A*p-M*f*v+c*A*v+m*f*_-c*y*_,U=e*T+i*S+s*R+u*z;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]=S*D,t[5]=(m*_*u-M*v*u+M*s*E-e*_*E-m*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-m*p*u+m*s*d-e*v*d-c*s*E+e*p*E)*D,t[8]=R*D,t[9]=(M*y*u-m*A*u-M*i*E+e*A*E+m*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]=(m*f*u-c*y*u-m*i*d+e*y*d+c*i*E-e*f*E)*D,t[12]=z*D,t[13]=(m*A*s-M*y*s+M*i*v-e*A*v-m*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-m*f*s+m*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,m=u*f;return this.set(d*c+i,d*f-s*p,d*p+s*f,0,d*f+s*p,m*f+i,m*p-s*c,0,d*p-s*f,m*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,m=c+c,y=f+f,v=u*d,E=u*m,M=u*y,A=c*m,_=c*y,x=f*y,T=p*d,S=p*m,R=p*y,z=i.x,U=i.y,D=i.z;return s[0]=(1-(A+x))*z,s[1]=(E+R)*z,s[2]=(M-S)*z,s[3]=0,s[4]=(E-R)*U,s[5]=(1-(v+x))*U,s[6]=(_+T)*U,s[7]=0,s[8]=(M+S)*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=Vu.set(s[0],s[1],s[2]).length(),c=Vu.set(s[4],s[5],s[6]).length(),f=Vu.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],So.copy(this);let d=1/u,m=1/c,y=1/f;return So.elements[0]*=d,So.elements[1]*=d,So.elements[2]*=d,So.elements[4]*=m,So.elements[5]*=m,So.elements[6]*=m,So.elements[8]*=y,So.elements[9]*=y,So.elements[10]*=y,e.setFromRotationMatrix(So),i.x=u,i.y=c,i.z=f,this}makePerspective(t,e,i,s,u,c,f=bs){let p=this.elements,d=2*u/(e-t),m=2*u/(i-s),y=(e+t)/(e-t),v=(i+s)/(i-s),E,M;if(f===bs)E=-(c+u)/(c-u),M=-2*c*u/(c-u);else if(f===up)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]=m,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=bs){let p=this.elements,d=1/(e-t),m=1/(i-s),y=1/(c-u),v=(e+t)*d,E=(i+s)*m,M,A;if(f===bs)M=(c+u)*y,A=-2*y;else if(f===up)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*m,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}},Vu=new at,So=new ir,Pk=new at(0,0,0),Rk=new at(1,1,1),Js=new at,Oh=new at,qi=new at,TA=new ir,CA=new Cs,Ja=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],m=s[9],y=s[2],v=s[6],E=s[10];switch(e){case"XYZ":this._y=Math.asin(ii(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-m,E),this._z=Math.atan2(-c,u)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ii(m,-1,1)),Math.abs(m)<.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(ii(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(-ii(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(ii(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-m,d),this._y=Math.atan2(-y,u)):(this._x=0,this._y=Math.atan2(f,E));break;case"XZY":this._z=Math.asin(-ii(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(f,u)):(this._x=Math.atan2(-m,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 TA.makeRotationFromQuaternion(t),this.setFromRotationMatrix(TA,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return CA.setFromEuler(this),this.setFromQuaternion(CA,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}};Ja.DEFAULT_ORDER="XYZ";var pp=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}},Lk=0,IA=new at,Hu=new Cs,vs=new ir,Dh=new at,Tc=new at,Nk=new at,Ok=new Cs,PA=new at(1,0,0),RA=new at(0,1,0),LA=new at(0,0,1),Dk={type:"added"},Fk={type:"removed"},C0={type:"childadded",child:null},I0={type:"childremoved",child:null},Co=class n extends aa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Lk++}),this.uuid=As(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new at,e=new Ja,i=new Cs,s=new at(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 ir},normalMatrix:{value:new we}}),this.matrix=new ir,this.matrixWorld=new ir,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new pp,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 Hu.setFromAxisAngle(t,e),this.quaternion.multiply(Hu),this}rotateOnWorldAxis(t,e){return Hu.setFromAxisAngle(t,e),this.quaternion.premultiply(Hu),this}rotateX(t){return this.rotateOnAxis(PA,t)}rotateY(t){return this.rotateOnAxis(RA,t)}rotateZ(t){return this.rotateOnAxis(LA,t)}translateOnAxis(t,e){return IA.copy(t).applyQuaternion(this.quaternion),this.position.add(IA.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(PA,t)}translateY(t){return this.translateOnAxis(RA,t)}translateZ(t){return this.translateOnAxis(LA,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(vs.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Dh.copy(t):Dh.set(t,e,i);let s=this.parent;this.updateWorldMatrix(!0,!1),Tc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?vs.lookAt(Tc,Dh,this.up):vs.lookAt(Dh,Tc,this.up),this.quaternion.setFromRotationMatrix(vs),s&&(vs.extractRotation(s.matrixWorld),Hu.setFromRotationMatrix(vs),this.quaternion.premultiply(Hu.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(Dk),C0.child=t,this.dispatchEvent(C0),C0.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(Fk),I0.child=t,this.dispatchEvent(I0),I0.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),vs.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),vs.multiply(t.parent.matrixWorld)),t.applyMatrix4(vs),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(Tc,t,Nk),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Tc,Ok,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,m=p.length;d<m;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),m=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),m.length>0&&(i.images=m),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 m=f[d];delete m.metadata,p.push(m)}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}};Co.DEFAULT_UP=new at(0,1,0);Co.DEFAULT_MATRIX_AUTO_UPDATE=!0;Co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Mo=new at,_s=new at,P0=new at,xs=new at,Wu=new at,Xu=new at,NA=new at,R0=new at,L0=new at,N0=new at,Wa=class n{constructor(t=new at,e=new at,i=new at){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),Mo.subVectors(t,e),s.cross(Mo);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){Mo.subVectors(s,e),_s.subVectors(i,e),P0.subVectors(t,e);let c=Mo.dot(Mo),f=Mo.dot(_s),p=Mo.dot(P0),d=_s.dot(_s),m=_s.dot(P0),y=c*d-f*f;if(y===0)return u.set(0,0,0),null;let v=1/y,E=(d*p-f*m)*v,M=(c*m-f*p)*v;return u.set(1-E-M,M,E)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,xs)===null?!1:xs.x>=0&&xs.y>=0&&xs.x+xs.y<=1}static getInterpolation(t,e,i,s,u,c,f,p){return this.getBarycoord(t,e,i,s,xs)===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,xs.x),p.addScaledVector(c,xs.y),p.addScaledVector(f,xs.z),p)}static isFrontFacing(t,e,i,s){return Mo.subVectors(i,e),_s.subVectors(t,e),Mo.cross(_s).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 Mo.subVectors(this.c,this.b),_s.subVectors(this.a,this.b),Mo.cross(_s).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;Wu.subVectors(s,i),Xu.subVectors(u,i),R0.subVectors(t,i);let p=Wu.dot(R0),d=Xu.dot(R0);if(p<=0&&d<=0)return e.copy(i);L0.subVectors(t,s);let m=Wu.dot(L0),y=Xu.dot(L0);if(m>=0&&y<=m)return e.copy(s);let v=p*y-m*d;if(v<=0&&p>=0&&m<=0)return c=p/(p-m),e.copy(i).addScaledVector(Wu,c);N0.subVectors(t,u);let E=Wu.dot(N0),M=Xu.dot(N0);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(Xu,f);let _=m*M-E*y;if(_<=0&&y-m>=0&&E-M>=0)return NA.subVectors(u,s),f=(y-m)/(y-m+(E-M)),e.copy(s).addScaledVector(NA,f);let x=1/(_+A+v);return c=A*x,f=v*x,e.copy(i).addScaledVector(Wu,c).addScaledVector(Xu,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},TT={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},js={h:0,s:0,l:0},Fh={h:0,s:0,l:0};function O0(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 fn=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=Wo){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,In.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=In.workingColorSpace){return this.r=t,this.g=e,this.b=i,In.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=In.workingColorSpace){if(t=Mk(t,1),e=ii(e,0,1),i=ii(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=O0(c,u,t+1/3),this.g=O0(c,u,t),this.b=O0(c,u,t-1/3)}return In.toWorkingColorSpace(this,s),this}setStyle(t,e=Wo){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=Wo){let i=TT[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=x0(t.r),this.g=x0(t.g),this.b=x0(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Wo){return In.fromWorkingColorSpace(ri.copy(this),t),Math.round(ii(ri.r*255,0,255))*65536+Math.round(ii(ri.g*255,0,255))*256+Math.round(ii(ri.b*255,0,255))}getHexString(t=Wo){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=In.workingColorSpace){In.fromWorkingColorSpace(ri.copy(this),e);let i=ri.r,s=ri.g,u=ri.b,c=Math.max(i,s,u),f=Math.min(i,s,u),p,d,m=(f+c)/2;if(f===c)p=0,d=0;else{let y=c-f;switch(d=m<=.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=m,t}getRGB(t,e=In.workingColorSpace){return In.fromWorkingColorSpace(ri.copy(this),e),t.r=ri.r,t.g=ri.g,t.b=ri.b,t}getStyle(t=Wo){In.fromWorkingColorSpace(ri.copy(this),t);let e=ri.r,i=ri.g,s=ri.b;return t!==Wo?`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(js),this.setHSL(js.h+t,js.s+e,js.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(js),t.getHSL(Fh);let i=v0(js.h,Fh.h,e),s=v0(js.s,Fh.s,e),u=v0(js.l,Fh.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}},ri=new fn;fn.NAMES=TT;var Uk=0,ja=class extends aa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Uk++}),this.uuid=As(),this.name="",this.type="Material",this.blending=sl,this.side=sa,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Y0,this.blendDst=$0,this.blendEquation=qa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new fn(0,0,0),this.blendAlpha=0,this.depthFunc=np,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xA,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bu,this.stencilZFail=Bu,this.stencilZPass=Bu,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!==sl&&(i.blending=this.blending),this.side!==sa&&(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!==Y0&&(i.blendSrc=this.blendSrc),this.blendDst!==$0&&(i.blendDst=this.blendDst),this.blendEquation!==qa&&(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!==xA&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Bu&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Bu&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Bu&&(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++}},dp=class extends ja{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new fn(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 Ja,this.combine=mT,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 hr=new at,Uh=new Ht,Yn=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=Q0,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ms,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return AT("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++)Uh.fromBufferAttribute(this,e),Uh.applyMatrix3(t),this.setXY(e,Uh.x,Uh.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.applyMatrix3(t),this.setXYZ(e,hr.x,hr.y,hr.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.applyMatrix4(t),this.setXYZ(e,hr.x,hr.y,hr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.applyNormalMatrix(t),this.setXYZ(e,hr.x,hr.y,hr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)hr.fromBufferAttribute(this,e),hr.transformDirection(t),this.setXYZ(e,hr.x,hr.y,hr.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=Yo(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Cn(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Yo(e,this.array)),e}setX(t,e){return this.normalized&&(e=Cn(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Yo(e,this.array)),e}setY(t,e){return this.normalized&&(e=Cn(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=Yo(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Cn(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=Yo(e,this.array)),e}setW(t,e){return this.normalized&&(e=Cn(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Cn(e,this.array),i=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(s,this.array),u=Cn(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!==Q0&&(t.usage=this.usage),t}};var mp=class extends Yn{constructor(t,e,i){super(new Uint16Array(t),e,i)}};var gp=class extends Yn{constructor(t,e,i){super(new Uint32Array(t),e,i)}};var Wr=class extends Yn{constructor(t,e,i){super(new Float32Array(t),e,i)}},Bk=0,no=new ir,D0=new Co,Yu=new at,Vi=new Za,Cc=new Za,Nr=new at,Ri=class n extends aa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Bk++}),this.uuid=As(),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(bT(t)?gp:mp)(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 we().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 no.makeRotationFromQuaternion(t),this.applyMatrix4(no),this}rotateX(t){return no.makeRotationX(t),this.applyMatrix4(no),this}rotateY(t){return no.makeRotationY(t),this.applyMatrix4(no),this}rotateZ(t){return no.makeRotationZ(t),this.applyMatrix4(no),this}translate(t,e,i){return no.makeTranslation(t,e,i),this.applyMatrix4(no),this}scale(t,e,i){return no.makeScale(t,e,i),this.applyMatrix4(no),this}lookAt(t){return D0.lookAt(t),D0.updateMatrix(),this.applyMatrix4(D0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yu).negate(),this.translate(Yu.x,Yu.y,Yu.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 Wr(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Za);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 at(-1/0,-1/0,-1/0),new at(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];Vi.setFromBufferAttribute(u),this.morphTargetsRelative?(Nr.addVectors(this.boundingBox.min,Vi.min),this.boundingBox.expandByPoint(Nr),Nr.addVectors(this.boundingBox.max,Vi.max),this.boundingBox.expandByPoint(Nr)):(this.boundingBox.expandByPoint(Vi.min),this.boundingBox.expandByPoint(Vi.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 Fc);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 at,1/0);return}if(t){let i=this.boundingSphere.center;if(Vi.setFromBufferAttribute(t),e)for(let u=0,c=e.length;u<c;u++){let f=e[u];Cc.setFromBufferAttribute(f),this.morphTargetsRelative?(Nr.addVectors(Vi.min,Cc.min),Vi.expandByPoint(Nr),Nr.addVectors(Vi.max,Cc.max),Vi.expandByPoint(Nr)):(Vi.expandByPoint(Cc.min),Vi.expandByPoint(Cc.max))}Vi.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Nr.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Nr));if(e)for(let u=0,c=e.length;u<c;u++){let f=e[u],p=this.morphTargetsRelative;for(let d=0,m=f.count;d<m;d++)Nr.fromBufferAttribute(f,d),p&&(Yu.fromBufferAttribute(t,d),Nr.add(Yu)),s=Math.max(s,i.distanceToSquared(Nr))}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 Yn(new Float32Array(4*i.count),4));let c=this.getAttribute("tangent"),f=[],p=[];for(let P=0;P<i.count;P++)f[P]=new at,p[P]=new at;let d=new at,m=new at,y=new at,v=new Ht,E=new Ht,M=new Ht,A=new at,_=new at;function x(P,ct,L){d.fromBufferAttribute(i,P),m.fromBufferAttribute(i,ct),y.fromBufferAttribute(i,L),v.fromBufferAttribute(u,P),E.fromBufferAttribute(u,ct),M.fromBufferAttribute(u,L),m.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(m).multiplyScalar(M.y).addScaledVector(y,-E.y).multiplyScalar(W),_.copy(y).multiplyScalar(E.x).addScaledVector(m,-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,Y=W+V;Mt<Y;Mt+=3)x(t.getX(Mt+0),t.getX(Mt+1),t.getX(Mt+2))}let S=new at,R=new at,z=new at,U=new at;function D(P){z.fromBufferAttribute(s,P),U.copy(z);let ct=f[P];S.copy(ct),S.sub(z.multiplyScalar(z.dot(ct))).normalize(),R.crossVectors(U,ct);let W=R.dot(p[P])<0?-1:1;c.setXYZW(P,S.x,S.y,S.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,Y=W+V;Mt<Y;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 Yn(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 at,u=new at,c=new at,f=new at,p=new at,d=new at,m=new at,y=new at;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,_),m.subVectors(c,u),y.subVectors(s,u),m.cross(y),f.fromBufferAttribute(i,M),p.fromBufferAttribute(i,A),d.fromBufferAttribute(i,_),f.add(m),p.add(m),d.add(m),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),m.subVectors(c,u),y.subVectors(s,u),m.cross(y),i.setXYZ(v+0,m.x,m.y,m.z),i.setXYZ(v+1,m.x,m.y,m.z),i.setXYZ(v+2,m.x,m.y,m.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Nr.fromBufferAttribute(t,e),Nr.normalize(),t.setXYZ(e,Nr.x,Nr.y,Nr.z)}toNonIndexed(){function t(f,p){let d=f.array,m=f.itemSize,y=f.normalized,v=new d.constructor(p.length*m),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]*m;for(let x=0;x<m;x++)v[M++]=d[E++]}return new Yn(v,m,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 m=0,y=d.length;m<y;m++){let v=d[m],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],m=[];for(let y=0,v=d.length;y<v;y++){let E=d[y];m.push(E.toJSON(t.data))}m.length>0&&(s[p]=m,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 m=s[d];this.setAttribute(d,m.clone(e))}let u=t.morphAttributes;for(let d in u){let m=[],y=u[d];for(let v=0,E=y.length;v<E;v++)m.push(y[v].clone(e));this.morphAttributes[d]=m}this.morphTargetsRelative=t.morphTargetsRelative;let c=t.groups;for(let d=0,m=c.length;d<m;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"})}},OA=new ir,Ua=new oy,Bh=new Fc,DA=new at,$u=new at,Zu=new at,Ju=new at,F0=new at,zh=new at,Gh=new Ht,kh=new Ht,qh=new Ht,FA=new at,UA=new at,BA=new at,Vh=new at,Hh=new at,To=class extends Co{constructor(t=new Ri,e=new dp){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){zh.set(0,0,0);for(let p=0,d=u.length;p<d;p++){let m=f[p],y=u[p];m!==0&&(F0.fromBufferAttribute(y,t),c?zh.addScaledVector(F0,m):zh.addScaledVector(F0.sub(e),m))}e.add(zh)}return e}raycast(t,e){let i=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Bh.copy(i.boundingSphere),Bh.applyMatrix4(u),Ua.copy(t.ray).recast(t.near),!(Bh.containsPoint(Ua.origin)===!1&&(Ua.intersectSphere(Bh,DA)===null||Ua.origin.distanceToSquared(DA)>(t.far-t.near)**2))&&(OA.copy(u).invert(),Ua.copy(t.ray).applyMatrix4(OA),!(i.boundingBox!==null&&Ua.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Ua)))}_computeIntersections(t,e,i){let s,u=this.geometry,c=this.material,f=u.index,p=u.attributes.position,d=u.attributes.uv,m=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),S=Math.min(f.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,z=S;R<z;R+=3){let U=f.getX(R),D=f.getX(R+1),P=f.getX(R+2);s=Wh(this,x,t,i,d,m,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(_),S=f.getX(_+1),R=f.getX(_+2);s=Wh(this,c,t,i,d,m,y,T,S,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),S=Math.min(p.count,Math.min(_.start+_.count,E.start+E.count));for(let R=T,z=S;R<z;R+=3){let U=R,D=R+1,P=R+2;s=Wh(this,x,t,i,d,m,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=_,S=_+1,R=_+2;s=Wh(this,c,t,i,d,m,y,T,S,R),s&&(s.faceIndex=Math.floor(_/3),e.push(s))}}}};function zk(n,t,e,i,s,u,c,f){let p;if(t.side===Pi?p=i.intersectTriangle(c,u,s,!0,f):p=i.intersectTriangle(s,u,c,t.side===sa,f),p===null)return null;Hh.copy(f),Hh.applyMatrix4(n.matrixWorld);let d=e.ray.origin.distanceTo(Hh);return d<e.near||d>e.far?null:{distance:d,point:Hh.clone(),object:n}}function Wh(n,t,e,i,s,u,c,f,p,d){n.getVertexPosition(f,$u),n.getVertexPosition(p,Zu),n.getVertexPosition(d,Ju);let m=zk(n,t,e,i,$u,Zu,Ju,Vh);if(m){s&&(Gh.fromBufferAttribute(s,f),kh.fromBufferAttribute(s,p),qh.fromBufferAttribute(s,d),m.uv=Wa.getInterpolation(Vh,$u,Zu,Ju,Gh,kh,qh,new Ht)),u&&(Gh.fromBufferAttribute(u,f),kh.fromBufferAttribute(u,p),qh.fromBufferAttribute(u,d),m.uv1=Wa.getInterpolation(Vh,$u,Zu,Ju,Gh,kh,qh,new Ht)),c&&(FA.fromBufferAttribute(c,f),UA.fromBufferAttribute(c,p),BA.fromBufferAttribute(c,d),m.normal=Wa.getInterpolation(Vh,$u,Zu,Ju,FA,UA,BA,new at),m.normal.dot(i.direction)>0&&m.normal.multiplyScalar(-1));let y={a:f,b:p,c:d,normal:new at,materialIndex:0};Wa.getNormal($u,Zu,Ju,y.normal),m.face=y}return m}var Uc=class n extends Ri{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=[],m=[],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 Wr(d,3)),this.setAttribute("normal",new Wr(m,3)),this.setAttribute("uv",new Wr(y,2));function M(A,_,x,T,S,R,z,U,D,P,ct){let L=R/D,W=z/P,V=R/2,Mt=z/2,Y=U/2,mt=D+1,ft=P+1,vt=0,it=0,lt=new at;for(let H=0;H<ft;H++){let At=H*W-Mt;for(let It=0;It<mt;It++){let jt=It*L-V;lt[A]=jt*T,lt[_]=At*S,lt[x]=Y,d.push(lt.x,lt.y,lt.z),lt[A]=0,lt[_]=0,lt[x]=U>0?1:-1,m.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+mt*H,jt=v+At+mt*(H+1),nt=v+(At+1)+mt*(H+1),bt=v+(At+1)+mt*H;p.push(It,jt,bt),p.push(jt,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 hl(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 xi(n){let t={};for(let e=0;e<n.length;e++){let i=hl(n[e]);for(let s in i)t[s]=i[s]}return t}function Gk(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function CT(n){return n.getRenderTarget()===null?n.outputColorSpace:In.workingColorSpace}var kk={clone:hl,merge:xi},qk=`void main() {
8
8
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9
9
  }`,Vk=`void main() {
10
10
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -43,7 +43,7 @@ var p2=Object.create;var zx=Object.defineProperty;var d2=Object.getOwnPropertyDe
43
43
  gl_FragColor = texture2D( tEquirect, sampleUV );
44
44
 
45
45
  }
46
- `},s=new Fc(5,5,5),u=new $o({name:"CubemapFromEquirect",uniforms:hl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pi,blending:na});u.uniforms.tEquirect.value=e;let c=new To(s,u),f=e.minFilter;return e.minFilter===Ha&&(e.minFilter=Ii),new sy(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)}},U0=new at,Hk=new at,Wk=new we,ws=class{constructor(t=new at(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=U0.subVectors(i,e).cross(Hk.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(U0),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||Wk.getNormalMatrix(t),s=this.coplanarPoint(U0).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)}},Ba=new Dc,Xh=new at,_p=class{constructor(t=new ws,e=new ws,i=new ws,s=new ws,u=new ws,c=new ws){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=bs){let i=this.planes,s=t.elements,u=s[0],c=s[1],f=s[2],p=s[3],d=s[4],m=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],S=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+m,_+M,R+T).normalize(),i[3].setComponents(p-c,v-m,_-M,R-T).normalize(),i[4].setComponents(p-f,v-y,_-A,R-S).normalize(),e===bs)i[5].setComponents(p+f,v+y,_+A,R+S).normalize();else if(e===up)i[5].setComponents(f,y,A,S).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(),Ba.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Ba.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ba)}intersectsSprite(t){return Ba.center.set(0,0,0),Ba.radius=.7071067811865476,Ba.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ba)}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(Xh.x=s.normal.x>0?t.max.x:t.min.x,Xh.y=s.normal.y>0?t.max.y:t.min.y,Xh.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Xh)<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 IT(){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 Xk(n,t){let e=t.isWebGL2,i=new WeakMap;function s(d,m){let y=d.array,v=d.usage,E=y.byteLength,M=n.createBuffer();n.bindBuffer(m,M),n.bufferData(m,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,m,y){let v=m.array,E=m._updateRange,M=m.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))}m.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),m.onUploadCallback()}function c(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function f(d){d.isInterleavedBufferAttribute&&(d=d.data);let m=i.get(d);m&&(n.deleteBuffer(m.buffer),i.delete(d))}function p(d,m){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,m));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,m),y.version=d.version}}return{get:c,remove:f,update:p}}var xp=class n extends Ri{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,m=p+1,y=t/f,v=e/p,E=[],M=[],A=[],_=[];for(let x=0;x<m;x++){let T=x*v-c;for(let S=0;S<d;S++){let R=S*y-u;M.push(R,-T,0),A.push(0,0,1),_.push(S/f),_.push(1-x/p)}}for(let x=0;x<p;x++)for(let T=0;T<f;T++){let S=T+d*x,R=T+d*(x+1),z=T+1+d*(x+1),U=T+1+d*x;E.push(S,R,U),E.push(R,z,U)}this.setIndex(E),this.setAttribute("position",new Wr(M,3)),this.setAttribute("normal",new Wr(A,3)),this.setAttribute("uv",new Wr(_,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)}},Yk=`#ifdef USE_ALPHAHASH
46
+ `},s=new Uc(5,5,5),u=new $o({name:"CubemapFromEquirect",uniforms:hl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pi,blending:na});u.uniforms.tEquirect.value=e;let c=new To(s,u),f=e.minFilter;return e.minFilter===Ha&&(e.minFilter=Ii),new sy(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)}},U0=new at,Hk=new at,Wk=new we,ws=class{constructor(t=new at(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=U0.subVectors(i,e).cross(Hk.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(U0),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||Wk.getNormalMatrix(t),s=this.coplanarPoint(U0).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)}},Ba=new Fc,Xh=new at,_p=class{constructor(t=new ws,e=new ws,i=new ws,s=new ws,u=new ws,c=new ws){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=bs){let i=this.planes,s=t.elements,u=s[0],c=s[1],f=s[2],p=s[3],d=s[4],m=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],S=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+m,_+M,R+T).normalize(),i[3].setComponents(p-c,v-m,_-M,R-T).normalize(),i[4].setComponents(p-f,v-y,_-A,R-S).normalize(),e===bs)i[5].setComponents(p+f,v+y,_+A,R+S).normalize();else if(e===up)i[5].setComponents(f,y,A,S).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(),Ba.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Ba.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ba)}intersectsSprite(t){return Ba.center.set(0,0,0),Ba.radius=.7071067811865476,Ba.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ba)}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(Xh.x=s.normal.x>0?t.max.x:t.min.x,Xh.y=s.normal.y>0?t.max.y:t.min.y,Xh.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Xh)<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 IT(){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 Xk(n,t){let e=t.isWebGL2,i=new WeakMap;function s(d,m){let y=d.array,v=d.usage,E=y.byteLength,M=n.createBuffer();n.bindBuffer(m,M),n.bufferData(m,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,m,y){let v=m.array,E=m._updateRange,M=m.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))}m.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),m.onUploadCallback()}function c(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function f(d){d.isInterleavedBufferAttribute&&(d=d.data);let m=i.get(d);m&&(n.deleteBuffer(m.buffer),i.delete(d))}function p(d,m){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,m));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,m),y.version=d.version}}return{get:c,remove:f,update:p}}var xp=class n extends Ri{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,m=p+1,y=t/f,v=e/p,E=[],M=[],A=[],_=[];for(let x=0;x<m;x++){let T=x*v-c;for(let S=0;S<d;S++){let R=S*y-u;M.push(R,-T,0),A.push(0,0,1),_.push(S/f),_.push(1-x/p)}}for(let x=0;x<p;x++)for(let T=0;T<f;T++){let S=T+d*x,R=T+d*(x+1),z=T+1+d*(x+1),U=T+1+d*x;E.push(S,R,U),E.push(R,z,U)}this.setIndex(E),this.setAttribute("position",new Wr(M,3)),this.setAttribute("normal",new Wr(A,3)),this.setAttribute("uv",new Wr(_,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)}},Yk=`#ifdef USE_ALPHAHASH
47
47
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
48
48
  #endif`,$k=`#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
- }`,Ee={alphahash_fragment:Yk,alphahash_pars_fragment:$k,alphamap_fragment:Zk,alphamap_pars_fragment:Jk,alphatest_fragment:jk,alphatest_pars_fragment:Kk,aomap_fragment:Qk,aomap_pars_fragment:tq,batching_pars_vertex:eq,batching_vertex:nq,begin_vertex:rq,beginnormal_vertex:iq,bsdfs:oq,iridescence_fragment:sq,bumpmap_pars_fragment:aq,clipping_planes_fragment:uq,clipping_planes_pars_fragment:lq,clipping_planes_pars_vertex:cq,clipping_planes_vertex:fq,color_fragment:hq,color_pars_fragment:pq,color_pars_vertex:dq,color_vertex:mq,common:gq,cube_uv_reflection_fragment:yq,defaultnormal_vertex:vq,displacementmap_pars_vertex:_q,displacementmap_vertex:xq,emissivemap_fragment:Eq,emissivemap_pars_fragment:wq,colorspace_fragment:Sq,colorspace_pars_fragment:Mq,envmap_fragment:bq,envmap_common_pars_fragment:Aq,envmap_pars_fragment:Tq,envmap_pars_vertex:Cq,envmap_physical_pars_fragment:Gq,envmap_vertex:Iq,fog_vertex:Pq,fog_pars_vertex:Rq,fog_fragment:Lq,fog_pars_fragment:Nq,gradientmap_pars_fragment:Oq,lightmap_fragment:Dq,lightmap_pars_fragment:Fq,lights_lambert_fragment:Uq,lights_lambert_pars_fragment:Bq,lights_pars_begin:zq,lights_toon_fragment:kq,lights_toon_pars_fragment:qq,lights_phong_fragment:Vq,lights_phong_pars_fragment:Hq,lights_physical_fragment:Wq,lights_physical_pars_fragment:Xq,lights_fragment_begin:Yq,lights_fragment_maps:$q,lights_fragment_end:Zq,logdepthbuf_fragment:Jq,logdepthbuf_pars_fragment:jq,logdepthbuf_pars_vertex:Kq,logdepthbuf_vertex:Qq,map_fragment:t5,map_pars_fragment:e5,map_particle_fragment:n5,map_particle_pars_fragment:r5,metalnessmap_fragment:i5,metalnessmap_pars_fragment:o5,morphinstance_vertex:s5,morphcolor_vertex:a5,morphnormal_vertex:u5,morphtarget_pars_vertex:l5,morphtarget_vertex:c5,normal_fragment_begin:f5,normal_fragment_maps:h5,normal_pars_fragment:p5,normal_pars_vertex:d5,normal_vertex:m5,normalmap_pars_fragment:g5,clearcoat_normal_fragment_begin:y5,clearcoat_normal_fragment_maps:v5,clearcoat_pars_fragment:_5,iridescence_pars_fragment:x5,opaque_fragment:E5,packing:w5,premultiplied_alpha_fragment:S5,project_vertex:M5,dithering_fragment:b5,dithering_pars_fragment:A5,roughnessmap_fragment:T5,roughnessmap_pars_fragment:C5,shadowmap_pars_fragment:I5,shadowmap_pars_vertex:P5,shadowmap_vertex:R5,shadowmask_pars_fragment:L5,skinbase_vertex:N5,skinning_pars_vertex:O5,skinning_vertex:D5,skinnormal_vertex:F5,specularmap_fragment:U5,specularmap_pars_fragment:B5,tonemapping_fragment:z5,tonemapping_pars_fragment:G5,transmission_fragment:k5,transmission_pars_fragment:q5,uv_pars_fragment:V5,uv_pars_vertex:H5,uv_vertex:W5,worldpos_vertex:X5,background_vert:Y5,background_frag:$5,backgroundCube_vert:Z5,backgroundCube_frag:J5,cube_vert:j5,cube_frag:K5,depth_vert:Q5,depth_frag:tV,distanceRGBA_vert:eV,distanceRGBA_frag:nV,equirect_vert:rV,equirect_frag:iV,linedashed_vert:oV,linedashed_frag:sV,meshbasic_vert:aV,meshbasic_frag:uV,meshlambert_vert:lV,meshlambert_frag:cV,meshmatcap_vert:fV,meshmatcap_frag:hV,meshnormal_vert:pV,meshnormal_frag:dV,meshphong_vert:mV,meshphong_frag:gV,meshphysical_vert:yV,meshphysical_frag:vV,meshtoon_vert:_V,meshtoon_frag:xV,points_vert:EV,points_frag:wV,shadow_vert:SV,shadow_frag:MV,sprite_vert:bV,sprite_frag:AV},Zt={common:{diffuse:{value:new fn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new we},alphaMap:{value:null},alphaMapTransform:{value:new we},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new we}},envmap:{envMap:{value:null},envMapRotation:{value:new we},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new we}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new we}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new we},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new we},normalScale:{value:new Ht(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new we},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new we}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new we}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new we}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new fn(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 fn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new we},alphaTest:{value:0},uvTransform:{value:new we}},sprite:{diffuse:{value:new fn(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new we},alphaMap:{value:null},alphaMapTransform:{value:new we},alphaTest:{value:0}}},Xo={basic:{uniforms:xi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.fog]),vertexShader:Ee.meshbasic_vert,fragmentShader:Ee.meshbasic_frag},lambert:{uniforms:xi([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 fn(0)}}]),vertexShader:Ee.meshlambert_vert,fragmentShader:Ee.meshlambert_frag},phong:{uniforms:xi([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 fn(0)},specular:{value:new fn(1118481)},shininess:{value:30}}]),vertexShader:Ee.meshphong_vert,fragmentShader:Ee.meshphong_frag},standard:{uniforms:xi([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 fn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ee.meshphysical_vert,fragmentShader:Ee.meshphysical_frag},toon:{uniforms:xi([Zt.common,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.gradientmap,Zt.fog,Zt.lights,{emissive:{value:new fn(0)}}]),vertexShader:Ee.meshtoon_vert,fragmentShader:Ee.meshtoon_frag},matcap:{uniforms:xi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,{matcap:{value:null}}]),vertexShader:Ee.meshmatcap_vert,fragmentShader:Ee.meshmatcap_frag},points:{uniforms:xi([Zt.points,Zt.fog]),vertexShader:Ee.points_vert,fragmentShader:Ee.points_frag},dashed:{uniforms:xi([Zt.common,Zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ee.linedashed_vert,fragmentShader:Ee.linedashed_frag},depth:{uniforms:xi([Zt.common,Zt.displacementmap]),vertexShader:Ee.depth_vert,fragmentShader:Ee.depth_frag},normal:{uniforms:xi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,{opacity:{value:1}}]),vertexShader:Ee.meshnormal_vert,fragmentShader:Ee.meshnormal_frag},sprite:{uniforms:xi([Zt.sprite,Zt.fog]),vertexShader:Ee.sprite_vert,fragmentShader:Ee.sprite_frag},background:{uniforms:{uvTransform:{value:new we},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ee.background_vert,fragmentShader:Ee.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new we}},vertexShader:Ee.backgroundCube_vert,fragmentShader:Ee.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ee.cube_vert,fragmentShader:Ee.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ee.equirect_vert,fragmentShader:Ee.equirect_frag},distanceRGBA:{uniforms:xi([Zt.common,Zt.displacementmap,{referencePosition:{value:new at},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ee.distanceRGBA_vert,fragmentShader:Ee.distanceRGBA_frag},shadow:{uniforms:xi([Zt.lights,Zt.fog,{color:{value:new fn(0)},opacity:{value:1}}]),vertexShader:Ee.shadow_vert,fragmentShader:Ee.shadow_frag}};Xo.physical={uniforms:xi([Xo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new we},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new we},clearcoatNormalScale:{value:new Ht(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new we},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new we},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new we},sheen:{value:0},sheenColor:{value:new fn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new we},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new we},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new we},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new we},attenuationDistance:{value:0},attenuationColor:{value:new fn(0)},specularColor:{value:new fn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new we},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new we},anisotropyVector:{value:new Ht},anisotropyMap:{value:null},anisotropyMapTransform:{value:new we}}]),vertexShader:Ee.meshphysical_vert,fragmentShader:Ee.meshphysical_frag};var Yh={r:0,b:0,g:0},za=new Ja,TV=new ir;function CV(n,t,e,i,s,u,c){let f=new fn(0),p=u===!0?0:1,d,m,y=null,v=0,E=null;function M(_,x){let T=!1,S=x.isScene===!0?x.background:null;S&&S.isTexture&&(S=(x.backgroundBlurriness>0?e:t).get(S)),S===null?A(f,p):S&&S.isColor&&(A(S,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),S&&(S.isCubeTexture||S.mapping===Cp)?(m===void 0&&(m=new To(new Fc(1,1,1),new $o({name:"BackgroundCubeMaterial",uniforms:hl(Xo.backgroundCube.uniforms),vertexShader:Xo.backgroundCube.vertexShader,fragmentShader:Xo.backgroundCube.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(z,U,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(m)),za.copy(x.backgroundRotation),za.x*=-1,za.y*=-1,za.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(za.y*=-1,za.z*=-1),m.material.uniforms.envMap.value=S,m.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(TV.makeRotationFromEuler(za)),m.material.toneMapped=In.getTransfer(S.colorSpace)!==Bn,(y!==S||v!==S.version||E!==n.toneMapping)&&(m.material.needsUpdate=!0,y=S,v=S.version,E=n.toneMapping),m.layers.enableAll(),_.unshift(m,m.geometry,m.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new To(new xp(2,2),new $o({name:"BackgroundMaterial",uniforms:hl(Xo.background.uniforms),vertexShader:Xo.background.vertexShader,fragmentShader:Xo.background.fragmentShader,side:sa,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=S,d.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,d.material.toneMapped=In.getTransfer(S.colorSpace)!==Bn,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(y!==S||v!==S.version||E!==n.toneMapping)&&(d.material.needsUpdate=!0,y=S,v=S.version,E=n.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function A(_,x){_.getRGB(Yh,CT(n)),i.buffers.color.setClear(Yh.r,Yh.g,Yh.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 IV(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,m=!1;function y(Y,mt,ft,vt,it){let lt=!1;if(c){let H=A(vt,ft,mt);d!==H&&(d=H,E(d.object)),lt=x(Y,vt,ft,it),lt&&T(Y,vt,ft,it)}else{let H=mt.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||m)&&(m=!1,P(Y,mt,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(Y){return i.isWebGL2?n.bindVertexArray(Y):u.bindVertexArrayOES(Y)}function M(Y){return i.isWebGL2?n.deleteVertexArray(Y):u.deleteVertexArrayOES(Y)}function A(Y,mt,ft){let vt=ft.wireframe===!0,it=f[Y.id];it===void 0&&(it={},f[Y.id]=it);let lt=it[mt.id];lt===void 0&&(lt={},it[mt.id]=lt);let H=lt[vt];return H===void 0&&(H=_(v()),lt[vt]=H),H}function _(Y){let mt=[],ft=[],vt=[];for(let it=0;it<s;it++)mt[it]=0,ft[it]=0,vt[it]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:mt,enabledAttributes:ft,attributeDivisors:vt,object:Y,attributes:{},index:null}}function x(Y,mt,ft,vt){let it=d.attributes,lt=mt.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"&&Y.instanceMatrix&&(bt=Y.instanceMatrix),It==="instanceColor"&&Y.instanceColor&&(bt=Y.instanceColor)),nt===void 0||nt.attribute!==bt||bt&&nt.data!==bt.data)return!0;H++}return d.attributesNum!==H||d.index!==vt}function T(Y,mt,ft,vt){let it={},lt=mt.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"&&Y.instanceMatrix&&(nt=Y.instanceMatrix),It==="instanceColor"&&Y.instanceColor&&(nt=Y.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 S(){let Y=d.newAttributes;for(let mt=0,ft=Y.length;mt<ft;mt++)Y[mt]=0}function R(Y){z(Y,0)}function z(Y,mt){let ft=d.newAttributes,vt=d.enabledAttributes,it=d.attributeDivisors;ft[Y]=1,vt[Y]===0&&(n.enableVertexAttribArray(Y),vt[Y]=1),it[Y]!==mt&&((i.isWebGL2?n:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](Y,mt),it[Y]=mt)}function U(){let Y=d.newAttributes,mt=d.enabledAttributes;for(let ft=0,vt=mt.length;ft<vt;ft++)mt[ft]!==Y[ft]&&(n.disableVertexAttribArray(ft),mt[ft]=0)}function D(Y,mt,ft,vt,it,lt,H){H===!0?n.vertexAttribIPointer(Y,mt,ft,it,lt):n.vertexAttribPointer(Y,mt,ft,vt,it,lt)}function P(Y,mt,ft,vt){if(i.isWebGL2===!1&&(Y.isInstancedMesh||vt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let it=vt.attributes,lt=ft.getAttributes(),H=mt.defaultAttributeValues;for(let At in lt){let It=lt[At];if(It.location>=0){let jt=it[At];if(jt===void 0&&(At==="instanceMatrix"&&Y.instanceMatrix&&(jt=Y.instanceMatrix),At==="instanceColor"&&Y.instanceColor&&(jt=Y.instanceColor)),jt!==void 0){let nt=jt.normalized,bt=jt.itemSize,qt=e.get(jt);if(qt===void 0)continue;let $t=qt.buffer,Ft=qt.type,zt=qt.bytesPerElement,Ct=i.isWebGL2===!0&&(Ft===n.INT||Ft===n.UNSIGNED_INT||jt.gpuType===yT);if(jt.isInterleavedBufferAttribute){let te=jt.data,$=te.stride,Ot=jt.offset;if(te.isInstancedInterleavedBuffer){for(let _t=0;_t<It.locationSize;_t++)z(It.location+_t,te.meshPerAttribute);Y.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=te.meshPerAttribute*te.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,Ft,nt,$*zt,(Ot+bt/It.locationSize*_t)*zt,Ct)}else{if(jt.isInstancedBufferAttribute){for(let te=0;te<It.locationSize;te++)z(It.location+te,jt.meshPerAttribute);Y.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=jt.meshPerAttribute*jt.count)}else for(let te=0;te<It.locationSize;te++)R(It.location+te);n.bindBuffer(n.ARRAY_BUFFER,$t);for(let te=0;te<It.locationSize;te++)D(It.location+te,bt/It.locationSize,Ft,nt,bt*zt,bt/It.locationSize*te*zt,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 Y in f){let mt=f[Y];for(let ft in mt){let vt=mt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete mt[ft]}delete f[Y]}}function L(Y){if(f[Y.id]===void 0)return;let mt=f[Y.id];for(let ft in mt){let vt=mt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete mt[ft]}delete f[Y.id]}function W(Y){for(let mt in f){let ft=f[mt];if(ft[Y.id]===void 0)continue;let vt=ft[Y.id];for(let it in vt)M(vt[it].object),delete vt[it];delete ft[Y.id]}}function V(){Mt(),m=!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:S,enableAttribute:R,disableUnusedAttributes:U}}function PV(n,t,e,i){let s=i.isWebGL2,u;function c(m){u=m}function f(m,y){n.drawArrays(u,m,y),e.update(y,u,1)}function p(m,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,m,y,v),e.update(y,u,v)}function d(m,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(m[M],y[M]);else{E.multiDrawArraysWEBGL(u,m,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 RV(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"),m=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),S=v>0,R=c||t.has("OES_texture_float"),z=S&&R,U=c?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:c,drawBuffers:d,getMaxAnisotropy:s,getMaxPrecision:u,precision:f,logarithmicDepthBuffer:m,maxTextures:y,maxVertexTextures:v,maxTextureSize:E,maxCubemapSize:M,maxAttributes:A,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:T,vertexTextures:S,floatFragmentTextures:R,floatVertexTextures:z,maxSamples:U}}function LV(n){let t=this,e=null,i=0,s=!1,u=!1,c=new ws,f=new we,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,m(null)},this.endShadows=function(){u=!1},this.setGlobalState=function(y,v){e=m(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?m(null):d();else{let T=u?0:i,S=T*4,R=x.clippingState||null;p.value=R,R=m(M,v,S,E);for(let z=0;z!==S;++z)R[z]=e[z];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 m(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 S=0,R=E;S!==A;++S,R+=4)c.copy(y[S]).applyMatrix4(T,f),c.normal.toArray(_,R),_[R+3]=c.constant}p.value=_,p.needsUpdate=!0}return t.numPlanes=A,t.numIntersection=0,_}}function NV(n){let t=new WeakMap;function e(c,f){return f===Z0?c.mapping=ll:f===J0&&(c.mapping=cl),c}function i(c){if(c&&c.isTexture){let f=c.mapping;if(f===Z0||f===J0)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 ay(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 uy=class extends yp{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,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;u+=d*this.view.offsetX,c=u+d*this.view.width,f-=m*this.view.offsetY,p=f-m*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}},rl=4,kA=[.125,.215,.35,.446,.526,.582],Va=20,B0=new uy,qA=new fn,z0=null,G0=0,k0=0,ka=(1+Math.sqrt(5))/2,Qu=1/ka,VA=[new at(1,1,1),new at(-1,1,1),new at(1,1,-1),new at(-1,1,-1),new at(0,ka,Qu),new at(0,ka,-Qu),new at(Qu,0,ka),new at(-Qu,0,ka),new at(ka,Qu,0),new at(-ka,Qu,0)],Ep=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){z0=this._renderer.getRenderTarget(),G0=this._renderer.getActiveCubeFace(),k0=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=XA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=WA(),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(z0,G0,k0),t.scissorTest=!1,$h(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ll||t.mapping===cl?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),z0=this._renderer.getRenderTarget(),G0=this._renderer.getActiveCubeFace(),k0=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:Ii,minFilter:Ii,generateMipmaps:!1,type:Oc,format:Ao,colorSpace:ua,depthBuffer:!1},s=HA(t,e,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=HA(t,e,i);let{_lodMax:u}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=OV(u)),this._blurMaterial=DV(u,t,e)}return s}_compileMaterial(t){let e=new To(this._lodPlanes[0],t);this._renderer.compile(e,B0)}_sceneToCubeUV(t,e,i,s){let f=new Hi(90,1,e,i),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],m=this._renderer,y=m.autoClear,v=m.toneMapping;m.getClearColor(qA),m.toneMapping=ra,m.autoClear=!1;let E=new dp({name:"PMREM.Background",side:Pi,depthWrite:!1,depthTest:!1}),M=new To(new Fc,E),A=!1,_=t.background;_?_.isColor&&(E.color.copy(_),t.background=null,A=!0):(E.color.copy(qA),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 S=this._cubeSize;$h(s,T*S,x>2?S:0,S,S),m.setRenderTarget(s),A&&m.render(M,f),m.render(t,f)}M.geometry.dispose(),M.material.dispose(),m.toneMapping=v,m.autoClear=y,t.background=_}_textureToCubeUV(t,e){let i=this._renderer,s=t.mapping===ll||t.mapping===cl;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=XA()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=WA());let u=s?this._cubemapMaterial:this._equirectMaterial,c=new To(this._lodPlanes[0],u),f=u.uniforms;f.envMap.value=t;let p=this._cubeSize;$h(e,0,0,3*p,2*p),i.setRenderTarget(e),i.render(c,B0)}_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=VA[(s-1)%VA.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 m=3,y=new To(this._lodPlanes[s],d),v=d.uniforms,E=this._sizeLods[i]-1,M=isFinite(u)?Math.PI/(2*E):2*Math.PI/(2*Va-1),A=u/M,_=isFinite(u)?1+Math.floor(m*A):Va;_>Va&&console.warn(`sigmaRadians, ${u}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Va}`);let x=[],T=0;for(let D=0;D<Va;++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:S}=this;v.dTheta.value=M,v.mipInt.value=S-i;let R=this._sizeLods[s],z=3*R*(s>S-rl?s-S+rl:0),U=4*(this._cubeSize-R);$h(e,z,U,3*R,2*R),p.setRenderTarget(e),p.render(y,B0)}};function OV(n){let t=[],e=[],i=[],s=n,u=n-rl+1+kA.length;for(let c=0;c<u;c++){let f=Math.pow(2,s);e.push(f);let p=1/f;c>n-rl?p=kA[c-n+rl-1]:c===0&&(p=0),i.push(p);let d=1/(f-2),m=-d,y=1+d,v=[m,m,y,m,y,y,m,m,y,y,m,y],E=6,M=6,A=3,_=2,x=1,T=new Float32Array(A*M*E),S=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),S.set(v,_*M*U);let L=[U,U,U,U,U,U];R.set(L,x*M*U)}let z=new Ri;z.setAttribute("position",new Yn(T,A)),z.setAttribute("uv",new Yn(S,_)),z.setAttribute("faceIndex",new Yn(R,x)),t.push(z),s>rl&&s--}return{lodPlanes:t,sizeLods:e,sigmas:i}}function HA(n,t,e){let i=new Ts(n,t,e);return i.texture.mapping=Cp,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function $h(n,t,e,i,s){n.viewport.set(t,e,i,s),n.scissor.set(t,e,i,s)}function DV(n,t,e){let i=new Float32Array(Va),s=new at(0,1,0);return new $o({name:"SphericalGaussianBlur",defines:{n:Va,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:Xy(),fragmentShader:`
3553
+ }`,Ee={alphahash_fragment:Yk,alphahash_pars_fragment:$k,alphamap_fragment:Zk,alphamap_pars_fragment:Jk,alphatest_fragment:jk,alphatest_pars_fragment:Kk,aomap_fragment:Qk,aomap_pars_fragment:tq,batching_pars_vertex:eq,batching_vertex:nq,begin_vertex:rq,beginnormal_vertex:iq,bsdfs:oq,iridescence_fragment:sq,bumpmap_pars_fragment:aq,clipping_planes_fragment:uq,clipping_planes_pars_fragment:lq,clipping_planes_pars_vertex:cq,clipping_planes_vertex:fq,color_fragment:hq,color_pars_fragment:pq,color_pars_vertex:dq,color_vertex:mq,common:gq,cube_uv_reflection_fragment:yq,defaultnormal_vertex:vq,displacementmap_pars_vertex:_q,displacementmap_vertex:xq,emissivemap_fragment:Eq,emissivemap_pars_fragment:wq,colorspace_fragment:Sq,colorspace_pars_fragment:Mq,envmap_fragment:bq,envmap_common_pars_fragment:Aq,envmap_pars_fragment:Tq,envmap_pars_vertex:Cq,envmap_physical_pars_fragment:Gq,envmap_vertex:Iq,fog_vertex:Pq,fog_pars_vertex:Rq,fog_fragment:Lq,fog_pars_fragment:Nq,gradientmap_pars_fragment:Oq,lightmap_fragment:Dq,lightmap_pars_fragment:Fq,lights_lambert_fragment:Uq,lights_lambert_pars_fragment:Bq,lights_pars_begin:zq,lights_toon_fragment:kq,lights_toon_pars_fragment:qq,lights_phong_fragment:Vq,lights_phong_pars_fragment:Hq,lights_physical_fragment:Wq,lights_physical_pars_fragment:Xq,lights_fragment_begin:Yq,lights_fragment_maps:$q,lights_fragment_end:Zq,logdepthbuf_fragment:Jq,logdepthbuf_pars_fragment:jq,logdepthbuf_pars_vertex:Kq,logdepthbuf_vertex:Qq,map_fragment:t5,map_pars_fragment:e5,map_particle_fragment:n5,map_particle_pars_fragment:r5,metalnessmap_fragment:i5,metalnessmap_pars_fragment:o5,morphinstance_vertex:s5,morphcolor_vertex:a5,morphnormal_vertex:u5,morphtarget_pars_vertex:l5,morphtarget_vertex:c5,normal_fragment_begin:f5,normal_fragment_maps:h5,normal_pars_fragment:p5,normal_pars_vertex:d5,normal_vertex:m5,normalmap_pars_fragment:g5,clearcoat_normal_fragment_begin:y5,clearcoat_normal_fragment_maps:v5,clearcoat_pars_fragment:_5,iridescence_pars_fragment:x5,opaque_fragment:E5,packing:w5,premultiplied_alpha_fragment:S5,project_vertex:M5,dithering_fragment:b5,dithering_pars_fragment:A5,roughnessmap_fragment:T5,roughnessmap_pars_fragment:C5,shadowmap_pars_fragment:I5,shadowmap_pars_vertex:P5,shadowmap_vertex:R5,shadowmask_pars_fragment:L5,skinbase_vertex:N5,skinning_pars_vertex:O5,skinning_vertex:D5,skinnormal_vertex:F5,specularmap_fragment:U5,specularmap_pars_fragment:B5,tonemapping_fragment:z5,tonemapping_pars_fragment:G5,transmission_fragment:k5,transmission_pars_fragment:q5,uv_pars_fragment:V5,uv_pars_vertex:H5,uv_vertex:W5,worldpos_vertex:X5,background_vert:Y5,background_frag:$5,backgroundCube_vert:Z5,backgroundCube_frag:J5,cube_vert:j5,cube_frag:K5,depth_vert:Q5,depth_frag:tV,distanceRGBA_vert:eV,distanceRGBA_frag:nV,equirect_vert:rV,equirect_frag:iV,linedashed_vert:oV,linedashed_frag:sV,meshbasic_vert:aV,meshbasic_frag:uV,meshlambert_vert:lV,meshlambert_frag:cV,meshmatcap_vert:fV,meshmatcap_frag:hV,meshnormal_vert:pV,meshnormal_frag:dV,meshphong_vert:mV,meshphong_frag:gV,meshphysical_vert:yV,meshphysical_frag:vV,meshtoon_vert:_V,meshtoon_frag:xV,points_vert:EV,points_frag:wV,shadow_vert:SV,shadow_frag:MV,sprite_vert:bV,sprite_frag:AV},Zt={common:{diffuse:{value:new fn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new we},alphaMap:{value:null},alphaMapTransform:{value:new we},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new we}},envmap:{envMap:{value:null},envMapRotation:{value:new we},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new we}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new we}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new we},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new we},normalScale:{value:new Ht(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new we},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new we}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new we}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new we}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new fn(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 fn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new we},alphaTest:{value:0},uvTransform:{value:new we}},sprite:{diffuse:{value:new fn(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new we},alphaMap:{value:null},alphaMapTransform:{value:new we},alphaTest:{value:0}}},Xo={basic:{uniforms:xi([Zt.common,Zt.specularmap,Zt.envmap,Zt.aomap,Zt.lightmap,Zt.fog]),vertexShader:Ee.meshbasic_vert,fragmentShader:Ee.meshbasic_frag},lambert:{uniforms:xi([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 fn(0)}}]),vertexShader:Ee.meshlambert_vert,fragmentShader:Ee.meshlambert_frag},phong:{uniforms:xi([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 fn(0)},specular:{value:new fn(1118481)},shininess:{value:30}}]),vertexShader:Ee.meshphong_vert,fragmentShader:Ee.meshphong_frag},standard:{uniforms:xi([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 fn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ee.meshphysical_vert,fragmentShader:Ee.meshphysical_frag},toon:{uniforms:xi([Zt.common,Zt.aomap,Zt.lightmap,Zt.emissivemap,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.gradientmap,Zt.fog,Zt.lights,{emissive:{value:new fn(0)}}]),vertexShader:Ee.meshtoon_vert,fragmentShader:Ee.meshtoon_frag},matcap:{uniforms:xi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,Zt.fog,{matcap:{value:null}}]),vertexShader:Ee.meshmatcap_vert,fragmentShader:Ee.meshmatcap_frag},points:{uniforms:xi([Zt.points,Zt.fog]),vertexShader:Ee.points_vert,fragmentShader:Ee.points_frag},dashed:{uniforms:xi([Zt.common,Zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ee.linedashed_vert,fragmentShader:Ee.linedashed_frag},depth:{uniforms:xi([Zt.common,Zt.displacementmap]),vertexShader:Ee.depth_vert,fragmentShader:Ee.depth_frag},normal:{uniforms:xi([Zt.common,Zt.bumpmap,Zt.normalmap,Zt.displacementmap,{opacity:{value:1}}]),vertexShader:Ee.meshnormal_vert,fragmentShader:Ee.meshnormal_frag},sprite:{uniforms:xi([Zt.sprite,Zt.fog]),vertexShader:Ee.sprite_vert,fragmentShader:Ee.sprite_frag},background:{uniforms:{uvTransform:{value:new we},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ee.background_vert,fragmentShader:Ee.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new we}},vertexShader:Ee.backgroundCube_vert,fragmentShader:Ee.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ee.cube_vert,fragmentShader:Ee.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ee.equirect_vert,fragmentShader:Ee.equirect_frag},distanceRGBA:{uniforms:xi([Zt.common,Zt.displacementmap,{referencePosition:{value:new at},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ee.distanceRGBA_vert,fragmentShader:Ee.distanceRGBA_frag},shadow:{uniforms:xi([Zt.lights,Zt.fog,{color:{value:new fn(0)},opacity:{value:1}}]),vertexShader:Ee.shadow_vert,fragmentShader:Ee.shadow_frag}};Xo.physical={uniforms:xi([Xo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new we},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new we},clearcoatNormalScale:{value:new Ht(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new we},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new we},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new we},sheen:{value:0},sheenColor:{value:new fn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new we},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new we},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new we},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new we},attenuationDistance:{value:0},attenuationColor:{value:new fn(0)},specularColor:{value:new fn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new we},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new we},anisotropyVector:{value:new Ht},anisotropyMap:{value:null},anisotropyMapTransform:{value:new we}}]),vertexShader:Ee.meshphysical_vert,fragmentShader:Ee.meshphysical_frag};var Yh={r:0,b:0,g:0},za=new Ja,TV=new ir;function CV(n,t,e,i,s,u,c){let f=new fn(0),p=u===!0?0:1,d,m,y=null,v=0,E=null;function M(_,x){let T=!1,S=x.isScene===!0?x.background:null;S&&S.isTexture&&(S=(x.backgroundBlurriness>0?e:t).get(S)),S===null?A(f,p):S&&S.isColor&&(A(S,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),S&&(S.isCubeTexture||S.mapping===Cp)?(m===void 0&&(m=new To(new Uc(1,1,1),new $o({name:"BackgroundCubeMaterial",uniforms:hl(Xo.backgroundCube.uniforms),vertexShader:Xo.backgroundCube.vertexShader,fragmentShader:Xo.backgroundCube.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(z,U,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(m)),za.copy(x.backgroundRotation),za.x*=-1,za.y*=-1,za.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(za.y*=-1,za.z*=-1),m.material.uniforms.envMap.value=S,m.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(TV.makeRotationFromEuler(za)),m.material.toneMapped=In.getTransfer(S.colorSpace)!==Bn,(y!==S||v!==S.version||E!==n.toneMapping)&&(m.material.needsUpdate=!0,y=S,v=S.version,E=n.toneMapping),m.layers.enableAll(),_.unshift(m,m.geometry,m.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new To(new xp(2,2),new $o({name:"BackgroundMaterial",uniforms:hl(Xo.background.uniforms),vertexShader:Xo.background.vertexShader,fragmentShader:Xo.background.fragmentShader,side:sa,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=S,d.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,d.material.toneMapped=In.getTransfer(S.colorSpace)!==Bn,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(y!==S||v!==S.version||E!==n.toneMapping)&&(d.material.needsUpdate=!0,y=S,v=S.version,E=n.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function A(_,x){_.getRGB(Yh,CT(n)),i.buffers.color.setClear(Yh.r,Yh.g,Yh.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 IV(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,m=!1;function y(Y,mt,ft,vt,it){let lt=!1;if(c){let H=A(vt,ft,mt);d!==H&&(d=H,E(d.object)),lt=x(Y,vt,ft,it),lt&&T(Y,vt,ft,it)}else{let H=mt.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||m)&&(m=!1,P(Y,mt,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(Y){return i.isWebGL2?n.bindVertexArray(Y):u.bindVertexArrayOES(Y)}function M(Y){return i.isWebGL2?n.deleteVertexArray(Y):u.deleteVertexArrayOES(Y)}function A(Y,mt,ft){let vt=ft.wireframe===!0,it=f[Y.id];it===void 0&&(it={},f[Y.id]=it);let lt=it[mt.id];lt===void 0&&(lt={},it[mt.id]=lt);let H=lt[vt];return H===void 0&&(H=_(v()),lt[vt]=H),H}function _(Y){let mt=[],ft=[],vt=[];for(let it=0;it<s;it++)mt[it]=0,ft[it]=0,vt[it]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:mt,enabledAttributes:ft,attributeDivisors:vt,object:Y,attributes:{},index:null}}function x(Y,mt,ft,vt){let it=d.attributes,lt=mt.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"&&Y.instanceMatrix&&(bt=Y.instanceMatrix),It==="instanceColor"&&Y.instanceColor&&(bt=Y.instanceColor)),nt===void 0||nt.attribute!==bt||bt&&nt.data!==bt.data)return!0;H++}return d.attributesNum!==H||d.index!==vt}function T(Y,mt,ft,vt){let it={},lt=mt.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"&&Y.instanceMatrix&&(nt=Y.instanceMatrix),It==="instanceColor"&&Y.instanceColor&&(nt=Y.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 S(){let Y=d.newAttributes;for(let mt=0,ft=Y.length;mt<ft;mt++)Y[mt]=0}function R(Y){z(Y,0)}function z(Y,mt){let ft=d.newAttributes,vt=d.enabledAttributes,it=d.attributeDivisors;ft[Y]=1,vt[Y]===0&&(n.enableVertexAttribArray(Y),vt[Y]=1),it[Y]!==mt&&((i.isWebGL2?n:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](Y,mt),it[Y]=mt)}function U(){let Y=d.newAttributes,mt=d.enabledAttributes;for(let ft=0,vt=mt.length;ft<vt;ft++)mt[ft]!==Y[ft]&&(n.disableVertexAttribArray(ft),mt[ft]=0)}function D(Y,mt,ft,vt,it,lt,H){H===!0?n.vertexAttribIPointer(Y,mt,ft,it,lt):n.vertexAttribPointer(Y,mt,ft,vt,it,lt)}function P(Y,mt,ft,vt){if(i.isWebGL2===!1&&(Y.isInstancedMesh||vt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let it=vt.attributes,lt=ft.getAttributes(),H=mt.defaultAttributeValues;for(let At in lt){let It=lt[At];if(It.location>=0){let jt=it[At];if(jt===void 0&&(At==="instanceMatrix"&&Y.instanceMatrix&&(jt=Y.instanceMatrix),At==="instanceColor"&&Y.instanceColor&&(jt=Y.instanceColor)),jt!==void 0){let nt=jt.normalized,bt=jt.itemSize,qt=e.get(jt);if(qt===void 0)continue;let $t=qt.buffer,Ft=qt.type,zt=qt.bytesPerElement,Ct=i.isWebGL2===!0&&(Ft===n.INT||Ft===n.UNSIGNED_INT||jt.gpuType===yT);if(jt.isInterleavedBufferAttribute){let te=jt.data,$=te.stride,Ot=jt.offset;if(te.isInstancedInterleavedBuffer){for(let _t=0;_t<It.locationSize;_t++)z(It.location+_t,te.meshPerAttribute);Y.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=te.meshPerAttribute*te.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,Ft,nt,$*zt,(Ot+bt/It.locationSize*_t)*zt,Ct)}else{if(jt.isInstancedBufferAttribute){for(let te=0;te<It.locationSize;te++)z(It.location+te,jt.meshPerAttribute);Y.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=jt.meshPerAttribute*jt.count)}else for(let te=0;te<It.locationSize;te++)R(It.location+te);n.bindBuffer(n.ARRAY_BUFFER,$t);for(let te=0;te<It.locationSize;te++)D(It.location+te,bt/It.locationSize,Ft,nt,bt*zt,bt/It.locationSize*te*zt,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 Y in f){let mt=f[Y];for(let ft in mt){let vt=mt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete mt[ft]}delete f[Y]}}function L(Y){if(f[Y.id]===void 0)return;let mt=f[Y.id];for(let ft in mt){let vt=mt[ft];for(let it in vt)M(vt[it].object),delete vt[it];delete mt[ft]}delete f[Y.id]}function W(Y){for(let mt in f){let ft=f[mt];if(ft[Y.id]===void 0)continue;let vt=ft[Y.id];for(let it in vt)M(vt[it].object),delete vt[it];delete ft[Y.id]}}function V(){Mt(),m=!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:S,enableAttribute:R,disableUnusedAttributes:U}}function PV(n,t,e,i){let s=i.isWebGL2,u;function c(m){u=m}function f(m,y){n.drawArrays(u,m,y),e.update(y,u,1)}function p(m,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,m,y,v),e.update(y,u,v)}function d(m,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(m[M],y[M]);else{E.multiDrawArraysWEBGL(u,m,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 RV(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"),m=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),S=v>0,R=c||t.has("OES_texture_float"),z=S&&R,U=c?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:c,drawBuffers:d,getMaxAnisotropy:s,getMaxPrecision:u,precision:f,logarithmicDepthBuffer:m,maxTextures:y,maxVertexTextures:v,maxTextureSize:E,maxCubemapSize:M,maxAttributes:A,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:T,vertexTextures:S,floatFragmentTextures:R,floatVertexTextures:z,maxSamples:U}}function LV(n){let t=this,e=null,i=0,s=!1,u=!1,c=new ws,f=new we,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,m(null)},this.endShadows=function(){u=!1},this.setGlobalState=function(y,v){e=m(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?m(null):d();else{let T=u?0:i,S=T*4,R=x.clippingState||null;p.value=R,R=m(M,v,S,E);for(let z=0;z!==S;++z)R[z]=e[z];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 m(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 S=0,R=E;S!==A;++S,R+=4)c.copy(y[S]).applyMatrix4(T,f),c.normal.toArray(_,R),_[R+3]=c.constant}p.value=_,p.needsUpdate=!0}return t.numPlanes=A,t.numIntersection=0,_}}function NV(n){let t=new WeakMap;function e(c,f){return f===Z0?c.mapping=ll:f===J0&&(c.mapping=cl),c}function i(c){if(c&&c.isTexture){let f=c.mapping;if(f===Z0||f===J0)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 ay(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 uy=class extends yp{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,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;u+=d*this.view.offsetX,c=u+d*this.view.width,f-=m*this.view.offsetY,p=f-m*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}},rl=4,kA=[.125,.215,.35,.446,.526,.582],Va=20,B0=new uy,qA=new fn,z0=null,G0=0,k0=0,ka=(1+Math.sqrt(5))/2,Qu=1/ka,VA=[new at(1,1,1),new at(-1,1,1),new at(1,1,-1),new at(-1,1,-1),new at(0,ka,Qu),new at(0,ka,-Qu),new at(Qu,0,ka),new at(-Qu,0,ka),new at(ka,Qu,0),new at(-ka,Qu,0)],Ep=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){z0=this._renderer.getRenderTarget(),G0=this._renderer.getActiveCubeFace(),k0=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=XA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=WA(),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(z0,G0,k0),t.scissorTest=!1,$h(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ll||t.mapping===cl?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),z0=this._renderer.getRenderTarget(),G0=this._renderer.getActiveCubeFace(),k0=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:Ii,minFilter:Ii,generateMipmaps:!1,type:Dc,format:Ao,colorSpace:ua,depthBuffer:!1},s=HA(t,e,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=HA(t,e,i);let{_lodMax:u}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=OV(u)),this._blurMaterial=DV(u,t,e)}return s}_compileMaterial(t){let e=new To(this._lodPlanes[0],t);this._renderer.compile(e,B0)}_sceneToCubeUV(t,e,i,s){let f=new Hi(90,1,e,i),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],m=this._renderer,y=m.autoClear,v=m.toneMapping;m.getClearColor(qA),m.toneMapping=ra,m.autoClear=!1;let E=new dp({name:"PMREM.Background",side:Pi,depthWrite:!1,depthTest:!1}),M=new To(new Uc,E),A=!1,_=t.background;_?_.isColor&&(E.color.copy(_),t.background=null,A=!0):(E.color.copy(qA),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 S=this._cubeSize;$h(s,T*S,x>2?S:0,S,S),m.setRenderTarget(s),A&&m.render(M,f),m.render(t,f)}M.geometry.dispose(),M.material.dispose(),m.toneMapping=v,m.autoClear=y,t.background=_}_textureToCubeUV(t,e){let i=this._renderer,s=t.mapping===ll||t.mapping===cl;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=XA()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=WA());let u=s?this._cubemapMaterial:this._equirectMaterial,c=new To(this._lodPlanes[0],u),f=u.uniforms;f.envMap.value=t;let p=this._cubeSize;$h(e,0,0,3*p,2*p),i.setRenderTarget(e),i.render(c,B0)}_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=VA[(s-1)%VA.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 m=3,y=new To(this._lodPlanes[s],d),v=d.uniforms,E=this._sizeLods[i]-1,M=isFinite(u)?Math.PI/(2*E):2*Math.PI/(2*Va-1),A=u/M,_=isFinite(u)?1+Math.floor(m*A):Va;_>Va&&console.warn(`sigmaRadians, ${u}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Va}`);let x=[],T=0;for(let D=0;D<Va;++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:S}=this;v.dTheta.value=M,v.mipInt.value=S-i;let R=this._sizeLods[s],z=3*R*(s>S-rl?s-S+rl:0),U=4*(this._cubeSize-R);$h(e,z,U,3*R,2*R),p.setRenderTarget(e),p.render(y,B0)}};function OV(n){let t=[],e=[],i=[],s=n,u=n-rl+1+kA.length;for(let c=0;c<u;c++){let f=Math.pow(2,s);e.push(f);let p=1/f;c>n-rl?p=kA[c-n+rl-1]:c===0&&(p=0),i.push(p);let d=1/(f-2),m=-d,y=1+d,v=[m,m,y,m,y,y,m,m,y,y,m,y],E=6,M=6,A=3,_=2,x=1,T=new Float32Array(A*M*E),S=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),S.set(v,_*M*U);let L=[U,U,U,U,U,U];R.set(L,x*M*U)}let z=new Ri;z.setAttribute("position",new Yn(T,A)),z.setAttribute("uv",new Yn(S,_)),z.setAttribute("faceIndex",new Yn(R,x)),t.push(z),s>rl&&s--}return{lodPlanes:t,sizeLods:e,sigmas:i}}function HA(n,t,e){let i=new Ts(n,t,e);return i.texture.mapping=Cp,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function $h(n,t,e,i,s){n.viewport.set(t,e,i,s),n.scissor.set(t,e,i,s)}function DV(n,t,e){let i=new Float32Array(Va),s=new at(0,1,0);return new $o({name:"SphericalGaussianBlur",defines:{n:Va,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:Xy(),fragmentShader:`
3554
3554
 
3555
3555
  precision mediump float;
3556
3556
  precision mediump int;
@@ -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 h6(n,t,e){let i=new _p,s=new Ht,u=new Ht,c=new Hr,f=new my({depthPacking:dk}),p=new gy,d={},m=e.maxTextureSize,y={[sa]:Pi,[Pi]:sa,[Ss]:Ss},v=new $o({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:c6,fragmentShader:f6}),E=v.clone();E.defines.HORIZONTAL_PASS=1;let M=new Ri;M.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let A=new To(M,v),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=dT;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(na),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Mt=x!==Es&&this.type===Es,Y=x===Es&&this.type!==Es;for(let mt=0,ft=U.length;mt<ft;mt++){let vt=U[mt],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>m||s.y>m)&&(s.x>m&&(u.x=Math.floor(m/lt.x),s.x=u.x*lt.x,it.mapSize.x=u.x),s.y>m&&(u.y=Math.floor(m/lt.y),s.y=u.y*lt.y,it.mapSize.y=u.y)),it.map===null||Mt===!0||Y===!0){let At=this.type!==Es?{minFilter:Ei,magFilter:Ei}:{};it.map!==null&&it.map.dispose(),it.map=new Ts(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===Es&&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 Ts(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 S(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,Y=d[V];Y===void 0&&(Y={},d[V]=Y);let mt=Y[Mt];mt===void 0&&(mt=L.clone(),Y[Mt]=mt,D.addEventListener("dispose",z)),L=mt}if(L.visible=D.visible,L.wireframe=D.wireframe,ct===Es?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===Es)&&(!U.frustumCulled||i.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,U.matrixWorld);let Mt=t.update(U),Y=U.material;if(Array.isArray(Y)){let mt=Mt.groups;for(let ft=0,vt=mt.length;ft<vt;ft++){let it=mt[ft],lt=Y[it.materialIndex];if(lt&&lt.visible){let H=S(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(Y.visible){let mt=S(U,Y,ct,L);U.onBeforeShadow(n,U,D,P,Mt,mt,null),n.renderBufferDirect(P,null,Mt,mt,U,null),U.onAfterShadow(n,U,D,P,Mt,mt,null)}}let V=U.children;for(let Mt=0,Y=V.length;Mt<Y;Mt++)R(V[Mt],D,P,ct,L)}function z(U){U.target.removeEventListener("dispose",z);for(let P in d){let ct=d[P],L=U.target.uuid;L in ct&&(ct[L].dispose(),delete ct[L])}}}function p6(n,t,e){let i=e.isWebGL2;function s(){let O=!1,Q=new Hr,J=null,et=new Hr(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,Gt,re,ie,Se){Se===!0&&(Tt*=ie,Gt*=ie,re*=ie),Q.set(Tt,Gt,re,ie),et.equals(Q)===!1&&(n.clearColor(Tt,Gt,re,ie),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?zt(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 V4:n.depthFunc(n.NEVER);break;case H4:n.depthFunc(n.ALWAYS);break;case W4:n.depthFunc(n.LESS);break;case np:n.depthFunc(n.LEQUAL);break;case X4:n.depthFunc(n.EQUAL);break;case Y4:n.depthFunc(n.GEQUAL);break;case $4:n.depthFunc(n.GREATER);break;case Z4: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,Gt=null,re=null,ie=null,Se=null;return{setTest:function(ye){O||(ye?zt(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){(Gt!==ye||re!==be||ie!==Ae)&&(n.stencilOp(ye,be,Ae),Gt=ye,re=be,ie=Ae)},setLocked:function(ye){O=ye},setClear:function(ye){Se!==ye&&(n.clearStencil(ye),Se=ye)},reset:function(){O=!1,Q=null,J=null,et=null,Tt=null,Gt=null,re=null,ie=null,Se=null}}}let f=new s,p=new u,d=new c,m=new WeakMap,y=new WeakMap,v={},E={},M=new WeakMap,A=[],_=null,x=!1,T=null,S=null,R=null,z=null,U=null,D=null,P=null,ct=new fn(0,0,0),L=0,W=!1,V=null,Mt=null,Y=null,mt=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={},jt=n.getParameter(n.SCISSOR_BOX),nt=n.getParameter(n.VIEWPORT),bt=new Hr().fromArray(jt),qt=new Hr().fromArray(nt);function $t(O,Q,J,et){let Tt=new Uint8Array(4),Gt=n.createTexture();n.bindTexture(O,Gt),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let re=0;re<J;re++)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+re,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Tt);return Gt}let Ft={};Ft[n.TEXTURE_2D]=$t(n.TEXTURE_2D,n.TEXTURE_2D,1),Ft[n.TEXTURE_CUBE_MAP]=$t(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Ft[n.TEXTURE_2D_ARRAY]=$t(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Ft[n.TEXTURE_3D]=$t(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),zt(n.DEPTH_TEST),p.setFunc(np),Xt(!1),Pt(zb),zt(n.CULL_FACE),St(na);function zt(O){v[O]!==!0&&(n.enable(O),v[O]=!0)}function Ct(O){v[O]!==!1&&(n.disable(O),v[O]=!1)}function te(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 $(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 Gt=0,re=Tt.length;Gt<re;Gt++)J[Gt]=n.COLOR_ATTACHMENT0+Gt;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 Ot(O){return _!==O?(n.useProgram(O),_=O,!0):!1}let _t={[qa]:n.FUNC_ADD,[C4]:n.FUNC_SUBTRACT,[I4]:n.FUNC_REVERSE_SUBTRACT};if(i)_t[Vb]=n.MIN,_t[Hb]=n.MAX;else{let O=t.get("EXT_blend_minmax");O!==null&&(_t[Vb]=O.MIN_EXT,_t[Hb]=O.MAX_EXT)}let Nt={[P4]:n.ZERO,[R4]:n.ONE,[L4]:n.SRC_COLOR,[Y0]:n.SRC_ALPHA,[B4]:n.SRC_ALPHA_SATURATE,[F4]:n.DST_COLOR,[O4]:n.DST_ALPHA,[N4]:n.ONE_MINUS_SRC_COLOR,[$0]:n.ONE_MINUS_SRC_ALPHA,[U4]:n.ONE_MINUS_DST_COLOR,[D4]:n.ONE_MINUS_DST_ALPHA,[z4]:n.CONSTANT_COLOR,[G4]:n.ONE_MINUS_CONSTANT_COLOR,[k4]:n.CONSTANT_ALPHA,[q4]:n.ONE_MINUS_CONSTANT_ALPHA};function St(O,Q,J,et,Tt,Gt,re,ie,Se,ye){if(O===na){x===!0&&(Ct(n.BLEND),x=!1);return}if(x===!1&&(zt(n.BLEND),x=!0),O!==T4){if(O!==T||ye!==W){if((S!==qa||U!==qa)&&(n.blendEquation(n.FUNC_ADD),S=qa,U=qa),ye)switch(O){case sl:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Gb:n.blendFunc(n.ONE,n.ONE);break;case kb:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qb: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 sl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Gb:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case kb:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qb:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}R=null,z=null,D=null,P=null,ct.set(0,0,0),L=0,T=O,W=ye}return}Tt=Tt||Q,Gt=Gt||J,re=re||et,(Q!==S||Tt!==U)&&(n.blendEquationSeparate(_t[Q],_t[Tt]),S=Q,U=Tt),(J!==R||et!==z||Gt!==D||re!==P)&&(n.blendFuncSeparate(Nt[J],Nt[et],Nt[Gt],Nt[re]),R=J,z=et,D=Gt,P=re),(ie.equals(ct)===!1||Se!==L)&&(n.blendColor(ie.r,ie.g,ie.b,Se),ct.copy(ie),L=Se),T=O,W=!1}function Vt(O,Q){O.side===Ss?Ct(n.CULL_FACE):zt(n.CULL_FACE);let J=O.side===Pi;Q&&(J=!J),Xt(J),O.blending===sl&&O.transparent===!1?St(na):St(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)),X(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?zt(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!==M4?(zt(n.CULL_FACE),O!==Mt&&(O===zb?n.cullFace(n.BACK):O===b4?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ct(n.CULL_FACE),Mt=O}function ee(O){O!==Y&&(it&&n.lineWidth(O),Y=O)}function X(O,Q,J){O?(zt(n.POLYGON_OFFSET_FILL),(mt!==Q||ft!==J)&&(n.polygonOffset(Q,J),mt=Q,ft=J)):Ct(n.POLYGON_OFFSET_FILL)}function N(O){O?zt(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 wt(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||Ft[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 Ut(){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){qt.equals(O)===!1&&(n.viewport(O.x,O.y,O.z,O.w),qt.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);m.get(Q)!==et&&(n.uniformBlockBinding(Q,et,O.__bindingPointIndex),m.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,S=null,R=null,z=null,U=null,D=null,P=null,ct=new fn(0,0,0),L=0,W=!1,V=null,Mt=null,Y=null,mt=null,ft=null,bt.set(0,0,n.canvas.width,n.canvas.height),qt.set(0,0,n.canvas.width,n.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:zt,disable:Ct,bindFramebuffer:te,drawBuffers:$,useProgram:Ot,setBlending:St,setMaterial:Vt,setFlipSided:Xt,setCullFace:Pt,setLineWidth:ee,setPolygonOffset:X,setScissorTest:N,activeTexture:xt,bindTexture:wt,unbindTexture:ot,compressedTexImage2D:Lt,compressedTexImage3D:ce,texImage2D:F,texImage3D:k,updateUBOMapping:tt,uniformBlockBinding:pt,texStorage2D:b,texStorage3D:I,texSubImage2D:Rt,texSubImage3D:Ut,compressedTexSubImage2D:Wt,compressedTexSubImage3D:j,scissor:G,viewport:rt,reset:ht}}function d6(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),m=new Ht,y=new WeakMap,v,E=new WeakMap,M=!1;try{M=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(X){}function A(X,N){return M?new OffscreenCanvas(X,N):lp("canvas")}function _(X,N,xt,wt){let ot=1,Lt=ee(X);if((Lt.width>wt||Lt.height>wt)&&(ot=wt/Math.max(Lt.width,Lt.height)),ot<1||N===!0)if(typeof HTMLImageElement!="undefined"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&X instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&X instanceof ImageBitmap||typeof VideoFrame!="undefined"&&X instanceof VideoFrame){let ce=N?ny:Math.floor,Rt=ce(ot*Lt.width),Ut=ce(ot*Lt.height);v===void 0&&(v=A(Rt,Ut));let Wt=xt?A(Rt,Ut):v;return Wt.width=Rt,Wt.height=Ut,Wt.getContext("2d").drawImage(X,0,0,Rt,Ut),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Lt.width+"x"+Lt.height+") to ("+Rt+"x"+Ut+")."),Wt}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Lt.width+"x"+Lt.height+")."),X;return X}function x(X){let N=ee(X);return wA(N.width)&&wA(N.height)}function T(X){return f?!1:X.wrapS!==bo||X.wrapT!==bo||X.minFilter!==Ei&&X.minFilter!==Ii}function S(X,N){return X.generateMipmaps&&N&&X.minFilter!==Ei&&X.minFilter!==Ii}function R(X){n.generateMipmap(X)}function z(X,N,xt,wt,ot=!1){if(f===!1)return N;if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}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?op:In.getTransfer(wt);xt===n.FLOAT&&(Lt=n.RGBA32F),xt===n.HALF_FLOAT&&(Lt=n.RGBA16F),xt===n.UNSIGNED_BYTE&&(Lt=ce===Bn?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(X,N,xt){return S(X,xt)===!0||X.isFramebufferTexture&&X.minFilter!==Ei&&X.minFilter!==Ii?Math.log2(Math.max(N.width,N.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?N.mipmaps.length:1}function D(X){return X===Ei||X===Wb||X===Sc?n.NEAREST:n.LINEAR}function P(X){let N=X.target;N.removeEventListener("dispose",P),L(N),N.isVideoTexture&&y.delete(N)}function ct(X){let N=X.target;N.removeEventListener("dispose",ct),V(N)}function L(X){let N=i.get(X);if(N.__webglInit===void 0)return;let xt=X.source,wt=E.get(xt);if(wt){let ot=wt[N.__cacheKey];ot.usedTimes--,ot.usedTimes===0&&W(X),Object.keys(wt).length===0&&E.delete(xt)}i.remove(X)}function W(X){let N=i.get(X);n.deleteTexture(N.__webglTexture);let xt=X.source,wt=E.get(xt);delete wt[N.__cacheKey],c.memory.textures--}function V(X){let N=i.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let wt=0;wt<6;wt++){if(Array.isArray(N.__webglFramebuffer[wt]))for(let ot=0;ot<N.__webglFramebuffer[wt].length;ot++)n.deleteFramebuffer(N.__webglFramebuffer[wt][ot]);else n.deleteFramebuffer(N.__webglFramebuffer[wt]);N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer[wt])}else{if(Array.isArray(N.__webglFramebuffer))for(let wt=0;wt<N.__webglFramebuffer.length;wt++)n.deleteFramebuffer(N.__webglFramebuffer[wt]);else n.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&n.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let wt=0;wt<N.__webglColorRenderbuffer.length;wt++)N.__webglColorRenderbuffer[wt]&&n.deleteRenderbuffer(N.__webglColorRenderbuffer[wt]);N.__webglDepthRenderbuffer&&n.deleteRenderbuffer(N.__webglDepthRenderbuffer)}let xt=X.textures;for(let wt=0,ot=xt.length;wt<ot;wt++){let Lt=i.get(xt[wt]);Lt.__webglTexture&&(n.deleteTexture(Lt.__webglTexture),c.memory.textures--),i.remove(xt[wt])}i.remove(X)}let Mt=0;function Y(){Mt=0}function mt(){let X=Mt;return X>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+s.maxTextures),Mt+=1,X}function ft(X){let N=[];return N.push(X.wrapS),N.push(X.wrapT),N.push(X.wrapR||0),N.push(X.magFilter),N.push(X.minFilter),N.push(X.anisotropy),N.push(X.internalFormat),N.push(X.format),N.push(X.type),N.push(X.generateMipmaps),N.push(X.premultiplyAlpha),N.push(X.flipY),N.push(X.unpackAlignment),N.push(X.colorSpace),N.join()}function vt(X,N){let xt=i.get(X);if(X.isVideoTexture&&Xt(X),X.isRenderTargetTexture===!1&&X.version>0&&xt.__version!==X.version){let wt=X.image;if(wt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(wt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qt(xt,X,N);return}}e.bindTexture(n.TEXTURE_2D,xt.__webglTexture,n.TEXTURE0+N)}function it(X,N){let xt=i.get(X);if(X.version>0&&xt.__version!==X.version){qt(xt,X,N);return}e.bindTexture(n.TEXTURE_2D_ARRAY,xt.__webglTexture,n.TEXTURE0+N)}function lt(X,N){let xt=i.get(X);if(X.version>0&&xt.__version!==X.version){qt(xt,X,N);return}e.bindTexture(n.TEXTURE_3D,xt.__webglTexture,n.TEXTURE0+N)}function H(X,N){let xt=i.get(X);if(X.version>0&&xt.__version!==X.version){$t(xt,X,N);return}e.bindTexture(n.TEXTURE_CUBE_MAP,xt.__webglTexture,n.TEXTURE0+N)}let At={[j0]:n.REPEAT,[bo]:n.CLAMP_TO_EDGE,[K0]:n.MIRRORED_REPEAT},It={[Ei]:n.NEAREST,[Wb]:n.NEAREST_MIPMAP_NEAREST,[Sc]:n.NEAREST_MIPMAP_LINEAR,[Ii]:n.LINEAR,[c0]:n.LINEAR_MIPMAP_NEAREST,[Ha]:n.LINEAR_MIPMAP_LINEAR},jt={[yk]:n.NEVER,[Sk]:n.ALWAYS,[vk]:n.LESS,[MT]:n.LEQUAL,[_k]:n.EQUAL,[wk]:n.GEQUAL,[xk]:n.GREATER,[Ek]:n.NOTEQUAL};function nt(X,N,xt){if(N.type===Ms&&t.has("OES_texture_float_linear")===!1&&(N.magFilter===Ii||N.magFilter===c0||N.magFilter===Sc||N.magFilter===Ha||N.minFilter===Ii||N.minFilter===c0||N.minFilter===Sc||N.minFilter===Ha)&&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(X,n.TEXTURE_WRAP_S,At[N.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,At[N.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,At[N.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,It[N.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,It[N.minFilter])):(n.texParameteri(X,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(X,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==bo||N.wrapT!==bo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(X,n.TEXTURE_MAG_FILTER,D(N.magFilter)),n.texParameteri(X,n.TEXTURE_MIN_FILTER,D(N.minFilter)),N.minFilter!==Ei&&N.minFilter!==Ii&&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(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,jt[N.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===Ei||N.minFilter!==Sc&&N.minFilter!==Ha||N.type===Ms&&t.has("OES_texture_float_linear")===!1||f===!1&&N.type===Oc&&t.has("OES_texture_half_float_linear")===!1)return;if(N.anisotropy>1||i.get(N).__currentAnisotropy){let wt=t.get("EXT_texture_filter_anisotropic");n.texParameterf(X,wt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,s.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy}}}function bt(X,N){let xt=!1;X.__webglInit===void 0&&(X.__webglInit=!0,N.addEventListener("dispose",P));let wt=N.source,ot=E.get(wt);ot===void 0&&(ot={},E.set(wt,ot));let Lt=ft(N);if(Lt!==X.__cacheKey){ot[Lt]===void 0&&(ot[Lt]={texture:n.createTexture(),usedTimes:0},c.memory.textures++,xt=!0),ot[Lt].usedTimes++;let ce=ot[X.__cacheKey];ce!==void 0&&(ot[X.__cacheKey].usedTimes--,ce.usedTimes===0&&W(N)),X.__cacheKey=Lt,X.__webglTexture=ot[Lt].texture}return xt}function qt(X,N,xt){let wt=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(wt=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(wt=n.TEXTURE_3D);let ot=bt(X,N),Lt=N.source;e.bindTexture(wt,X.__webglTexture,n.TEXTURE0+xt);let ce=i.get(Lt);if(Lt.version!==ce.__version||ot===!0){e.activeTexture(n.TEXTURE0+xt);let Rt=In.getPrimaries(In.workingColorSpace),Ut=N.colorSpace===ta?null:In.getPrimaries(N.colorSpace),Wt=N.colorSpace===ta||Rt===Ut?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=z(N.internalFormat,F,k,N.colorSpace,N.isVideoTexture);nt(wt,N,I);let rt,tt=N.mipmaps,pt=f&&N.isVideoTexture!==!0&&G!==ST,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===Ms?G=n.DEPTH_COMPONENT32F:N.type===ea?G=n.DEPTH_COMPONENT24:N.type===Ya?G=n.DEPTH24_STENCIL8:G=n.DEPTH_COMPONENT16:N.type===Ms&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===$a&&G===n.DEPTH_COMPONENT&&N.type!==Hy&&N.type!==ea&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=ea,k=u.convert(N.type)),N.format===fl&&G===n.DEPTH_COMPONENT&&(G=n.DEPTH_STENCIL,N.type!==Ya&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=Ya,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!==Ao?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!==Ao?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=ee(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=ee(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);S(N,I)&&R(wt),ce.__version=Lt.version,N.onUpdate&&N.onUpdate(N)}X.__version=N.version}function $t(X,N,xt){if(N.image.length!==6)return;let wt=bt(X,N),ot=N.source;e.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture,n.TEXTURE0+xt);let Lt=i.get(ot);if(ot.version!==Lt.__version||wt===!0){e.activeTexture(n.TEXTURE0+xt);let ce=In.getPrimaries(In.workingColorSpace),Rt=N.colorSpace===ta?null:In.getPrimaries(N.colorSpace),Ut=N.colorSpace===ta||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,Ut);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=z(N.internalFormat,k,G,N.colorSpace),tt=f&&N.isVideoTexture!==!0,pt=Lt.__version===void 0||wt===!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!==Ao?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=ee(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 Gt=Q[et].image[J].image;tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,0,0,Gt.width,Gt.height,k,G,Gt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,rt,Gt.width,Gt.height,0,k,G,Gt.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])}}}S(N,F)&&R(n.TEXTURE_CUBE_MAP),Lt.__version=ot.version,N.onUpdate&&N.onUpdate(N)}X.__version=N.version}function Ft(X,N,xt,wt,ot,Lt){let ce=u.convert(xt.format,xt.colorSpace),Rt=u.convert(xt.type),Ut=z(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,Ut,j,b,N.depth,0,ce,Rt,null):e.texImage2D(ot,Lt,Ut,j,b,0,ce,Rt,null)}e.bindFramebuffer(n.FRAMEBUFFER,X),Vt(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,wt,ot,i.get(xt).__webglTexture,0,St(N)):(ot===n.TEXTURE_2D||ot>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ot<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,wt,ot,i.get(xt).__webglTexture,Lt),e.bindFramebuffer(n.FRAMEBUFFER,null)}function zt(X,N,xt){if(n.bindRenderbuffer(n.RENDERBUFFER,X),N.depthBuffer&&!N.stencilBuffer){let wt=f===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(xt||Vt(N)){let ot=N.depthTexture;ot&&ot.isDepthTexture&&(ot.type===Ms?wt=n.DEPTH_COMPONENT32F:ot.type===ea&&(wt=n.DEPTH_COMPONENT24));let Lt=St(N);Vt(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Lt,wt,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Lt,wt,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,wt,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,X)}else if(N.depthBuffer&&N.stencilBuffer){let wt=St(N);xt&&Vt(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,wt,n.DEPTH24_STENCIL8,N.width,N.height):Vt(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,wt,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,X)}else{let wt=N.textures;for(let ot=0;ot<wt.length;ot++){let Lt=wt[ot],ce=u.convert(Lt.format,Lt.colorSpace),Rt=u.convert(Lt.type),Ut=z(Lt.internalFormat,ce,Rt,Lt.colorSpace),Wt=St(N);xt&&Vt(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Wt,Ut,N.width,N.height):Vt(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Wt,Ut,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,Ut,N.width,N.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ct(X,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(n.FRAMEBUFFER,X),!(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 wt=i.get(N.depthTexture).__webglTexture,ot=St(N);if(N.depthTexture.format===$a)Vt(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,wt,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,wt,0);else if(N.depthTexture.format===fl)Vt(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,wt,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,wt,0);else throw new Error("Unknown depthTexture format")}function te(X){let N=i.get(X),xt=X.isWebGLCubeRenderTarget===!0;if(X.depthTexture&&!N.__autoAllocateDepthBuffer){if(xt)throw new Error("target.depthTexture not supported in Cube render targets");Ct(N.__webglFramebuffer,X)}else if(xt){N.__webglDepthbuffer=[];for(let wt=0;wt<6;wt++)e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer[wt]),N.__webglDepthbuffer[wt]=n.createRenderbuffer(),zt(N.__webglDepthbuffer[wt],X,!1)}else e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=n.createRenderbuffer(),zt(N.__webglDepthbuffer,X,!1);e.bindFramebuffer(n.FRAMEBUFFER,null)}function $(X,N,xt){let wt=i.get(X);N!==void 0&&Ft(wt.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),xt!==void 0&&te(X)}function Ot(X){let N=X.texture,xt=i.get(X),wt=i.get(N);X.addEventListener("dispose",ct);let ot=X.textures,Lt=X.isWebGLCubeRenderTarget===!0,ce=ot.length>1,Rt=x(X)||f;if(ce||(wt.__webglTexture===void 0&&(wt.__webglTexture=n.createTexture()),wt.__version=N.version,c.memory.textures++),Lt){xt.__webglFramebuffer=[];for(let Ut=0;Ut<6;Ut++)if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer[Ut]=[];for(let Wt=0;Wt<N.mipmaps.length;Wt++)xt.__webglFramebuffer[Ut][Wt]=n.createFramebuffer()}else xt.__webglFramebuffer[Ut]=n.createFramebuffer()}else{if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer=[];for(let Ut=0;Ut<N.mipmaps.length;Ut++)xt.__webglFramebuffer[Ut]=n.createFramebuffer()}else xt.__webglFramebuffer=n.createFramebuffer();if(ce)if(s.drawBuffers)for(let Ut=0,Wt=ot.length;Ut<Wt;Ut++){let j=i.get(ot[Ut]);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&&X.samples>0&&Vt(X)===!1){xt.__webglMultisampledFramebuffer=n.createFramebuffer(),xt.__webglColorRenderbuffer=[],e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglMultisampledFramebuffer);for(let Ut=0;Ut<ot.length;Ut++){let Wt=ot[Ut];xt.__webglColorRenderbuffer[Ut]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,xt.__webglColorRenderbuffer[Ut]);let j=u.convert(Wt.format,Wt.colorSpace),b=u.convert(Wt.type),I=z(Wt.internalFormat,j,b,Wt.colorSpace,X.isXRRenderTarget===!0),F=St(X);n.renderbufferStorageMultisample(n.RENDERBUFFER,F,I,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ut,n.RENDERBUFFER,xt.__webglColorRenderbuffer[Ut])}n.bindRenderbuffer(n.RENDERBUFFER,null),X.depthBuffer&&(xt.__webglDepthRenderbuffer=n.createRenderbuffer(),zt(xt.__webglDepthRenderbuffer,X,!0)),e.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Lt){e.bindTexture(n.TEXTURE_CUBE_MAP,wt.__webglTexture),nt(n.TEXTURE_CUBE_MAP,N,Rt);for(let Ut=0;Ut<6;Ut++)if(f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ft(xt.__webglFramebuffer[Ut][Wt],X,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ut,Wt);else Ft(xt.__webglFramebuffer[Ut],X,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ut,0);S(N,Rt)&&R(n.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(ce){for(let Ut=0,Wt=ot.length;Ut<Wt;Ut++){let j=ot[Ut],b=i.get(j);e.bindTexture(n.TEXTURE_2D,b.__webglTexture),nt(n.TEXTURE_2D,j,Rt),Ft(xt.__webglFramebuffer,X,j,n.COLOR_ATTACHMENT0+Ut,n.TEXTURE_2D,0),S(j,Rt)&&R(n.TEXTURE_2D)}e.unbindTexture()}else{let Ut=n.TEXTURE_2D;if((X.isWebGL3DRenderTarget||X.isWebGLArrayRenderTarget)&&(f?Ut=X.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Ut,wt.__webglTexture),nt(Ut,N,Rt),f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ft(xt.__webglFramebuffer[Wt],X,N,n.COLOR_ATTACHMENT0,Ut,Wt);else Ft(xt.__webglFramebuffer,X,N,n.COLOR_ATTACHMENT0,Ut,0);S(N,Rt)&&R(Ut),e.unbindTexture()}X.depthBuffer&&te(X)}function _t(X){let N=x(X)||f,xt=X.textures;for(let wt=0,ot=xt.length;wt<ot;wt++){let Lt=xt[wt];if(S(Lt,N)){let ce=X.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Rt=i.get(Lt).__webglTexture;e.bindTexture(ce,Rt),R(ce),e.unbindTexture()}}}function Nt(X){if(f&&X.samples>0&&Vt(X)===!1){let N=X.textures,xt=X.width,wt=X.height,ot=n.COLOR_BUFFER_BIT,Lt=[],ce=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Rt=i.get(X),Ut=N.length>1;if(Ut)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),X.depthBuffer&&Lt.push(ce);let j=Rt.__ignoreDepthValues!==void 0?Rt.__ignoreDepthValues:!1;if(j===!1&&(X.depthBuffer&&(ot|=n.DEPTH_BUFFER_BIT),X.stencilBuffer&&(ot|=n.STENCIL_BUFFER_BIT)),Ut&&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])),Ut){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,wt,0,0,xt,wt,ot,n.NEAREST),d&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Lt)}if(e.bindFramebuffer(n.READ_FRAMEBUFFER,null),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Ut)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 St(X){return Math.min(s.maxSamples,X.samples)}function Vt(X){let N=i.get(X);return f&&X.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function Xt(X){let N=c.render.frame;y.get(X)!==N&&(y.set(X,N),X.update())}function Pt(X,N){let xt=X.colorSpace,wt=X.format,ot=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||X.format===ty||xt!==ua&&xt!==ta&&(In.getTransfer(xt)===Bn?f===!1?t.has("EXT_sRGB")===!0&&wt===Ao?(X.format=ty,X.minFilter=Ii,X.generateMipmaps=!1):N=cp.sRGBToLinear(N):(wt!==Ao||ot!==ia)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xt)),N}function ee(X){return typeof HTMLImageElement!="undefined"&&X instanceof HTMLImageElement?(m.width=X.naturalWidth||X.width,m.height=X.naturalHeight||X.height):typeof VideoFrame!="undefined"&&X instanceof VideoFrame?(m.width=X.displayWidth,m.height=X.displayHeight):(m.width=X.width,m.height=X.height),m}this.allocateTextureUnit=mt,this.resetTextureUnits=Y,this.setTexture2D=vt,this.setTexture2DArray=it,this.setTexture3D=lt,this.setTextureCube=H,this.rebindTextures=$,this.setupRenderTarget=Ot,this.updateRenderTargetMipmap=_t,this.updateMultisampleRenderTarget=Nt,this.setupDepthRenderbuffer=te,this.setupFrameBufferTexture=Ft,this.useMultisampledRTT=Vt}function m6(n,t,e){let i=e.isWebGL2;function s(u,c=ta){let f,p=In.getTransfer(c);if(u===ia)return n.UNSIGNED_BYTE;if(u===vT)return n.UNSIGNED_SHORT_4_4_4_4;if(u===_T)return n.UNSIGNED_SHORT_5_5_5_1;if(u===ok)return n.BYTE;if(u===sk)return n.SHORT;if(u===Hy)return n.UNSIGNED_SHORT;if(u===yT)return n.INT;if(u===ea)return n.UNSIGNED_INT;if(u===Ms)return n.FLOAT;if(u===Oc)return i?n.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(u===ak)return n.ALPHA;if(u===Ao)return n.RGBA;if(u===uk)return n.LUMINANCE;if(u===lk)return n.LUMINANCE_ALPHA;if(u===$a)return n.DEPTH_COMPONENT;if(u===fl)return n.DEPTH_STENCIL;if(u===ty)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(u===ck)return n.RED;if(u===xT)return n.RED_INTEGER;if(u===fk)return n.RG;if(u===ET)return n.RG_INTEGER;if(u===wT)return n.RGBA_INTEGER;if(u===f0||u===h0||u===p0||u===d0)if(p===Bn)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(u===f0)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(u===h0)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(u===p0)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(u===d0)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(u===f0)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(u===h0)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(u===p0)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(u===d0)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(u===Xb||u===Yb||u===$b||u===Zb)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(u===Xb)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(u===Yb)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(u===$b)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(u===Zb)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(u===ST)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(u===Jb||u===jb)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(u===Jb)return p===Bn?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(u===jb)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(u===Kb||u===Qb||u===tA||u===eA||u===nA||u===rA||u===iA||u===oA||u===sA||u===aA||u===uA||u===lA||u===cA||u===fA)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(u===Kb)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(u===Qb)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(u===tA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(u===eA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(u===nA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(u===rA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(u===iA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(u===oA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(u===sA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(u===aA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(u===uA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(u===lA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(u===cA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(u===fA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(u===m0||u===hA||u===pA)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(u===m0)return p===Bn?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(u===hA)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(u===pA)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(u===hk||u===dA||u===mA||u===gA)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(u===m0)return f.COMPRESSED_RED_RGTC1_EXT;if(u===dA)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(u===mA)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(u===gA)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return u===Ya?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 yy=class extends Hi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Xa=class extends Co{constructor(){super(),this.isGroup=!0,this.type="Group"}},g6={type:"move"},Rc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Xa,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 Xa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new at,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new at),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Xa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new at,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new at),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 m=d.joints["index-finger-tip"],y=d.joints["thumb-tip"],v=m.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(g6)))}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 Xa;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},y6=`
3781
+ }`;function h6(n,t,e){let i=new _p,s=new Ht,u=new Ht,c=new Hr,f=new my({depthPacking:dk}),p=new gy,d={},m=e.maxTextureSize,y={[sa]:Pi,[Pi]:sa,[Ss]:Ss},v=new $o({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:c6,fragmentShader:f6}),E=v.clone();E.defines.HORIZONTAL_PASS=1;let M=new Ri;M.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let A=new To(M,v),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=dT;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(na),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Mt=x!==Es&&this.type===Es,Y=x===Es&&this.type!==Es;for(let mt=0,ft=U.length;mt<ft;mt++){let vt=U[mt],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>m||s.y>m)&&(s.x>m&&(u.x=Math.floor(m/lt.x),s.x=u.x*lt.x,it.mapSize.x=u.x),s.y>m&&(u.y=Math.floor(m/lt.y),s.y=u.y*lt.y,it.mapSize.y=u.y)),it.map===null||Mt===!0||Y===!0){let At=this.type!==Es?{minFilter:Ei,magFilter:Ei}:{};it.map!==null&&it.map.dispose(),it.map=new Ts(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===Es&&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 Ts(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 S(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,Y=d[V];Y===void 0&&(Y={},d[V]=Y);let mt=Y[Mt];mt===void 0&&(mt=L.clone(),Y[Mt]=mt,D.addEventListener("dispose",z)),L=mt}if(L.visible=D.visible,L.wireframe=D.wireframe,ct===Es?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===Es)&&(!U.frustumCulled||i.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,U.matrixWorld);let Mt=t.update(U),Y=U.material;if(Array.isArray(Y)){let mt=Mt.groups;for(let ft=0,vt=mt.length;ft<vt;ft++){let it=mt[ft],lt=Y[it.materialIndex];if(lt&&lt.visible){let H=S(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(Y.visible){let mt=S(U,Y,ct,L);U.onBeforeShadow(n,U,D,P,Mt,mt,null),n.renderBufferDirect(P,null,Mt,mt,U,null),U.onAfterShadow(n,U,D,P,Mt,mt,null)}}let V=U.children;for(let Mt=0,Y=V.length;Mt<Y;Mt++)R(V[Mt],D,P,ct,L)}function z(U){U.target.removeEventListener("dispose",z);for(let P in d){let ct=d[P],L=U.target.uuid;L in ct&&(ct[L].dispose(),delete ct[L])}}}function p6(n,t,e){let i=e.isWebGL2;function s(){let O=!1,Q=new Hr,J=null,et=new Hr(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,Gt,re,ie,Se){Se===!0&&(Tt*=ie,Gt*=ie,re*=ie),Q.set(Tt,Gt,re,ie),et.equals(Q)===!1&&(n.clearColor(Tt,Gt,re,ie),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?zt(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 V4:n.depthFunc(n.NEVER);break;case H4:n.depthFunc(n.ALWAYS);break;case W4:n.depthFunc(n.LESS);break;case np:n.depthFunc(n.LEQUAL);break;case X4:n.depthFunc(n.EQUAL);break;case Y4:n.depthFunc(n.GEQUAL);break;case $4:n.depthFunc(n.GREATER);break;case Z4: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,Gt=null,re=null,ie=null,Se=null;return{setTest:function(ye){O||(ye?zt(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){(Gt!==ye||re!==be||ie!==Ae)&&(n.stencilOp(ye,be,Ae),Gt=ye,re=be,ie=Ae)},setLocked:function(ye){O=ye},setClear:function(ye){Se!==ye&&(n.clearStencil(ye),Se=ye)},reset:function(){O=!1,Q=null,J=null,et=null,Tt=null,Gt=null,re=null,ie=null,Se=null}}}let f=new s,p=new u,d=new c,m=new WeakMap,y=new WeakMap,v={},E={},M=new WeakMap,A=[],_=null,x=!1,T=null,S=null,R=null,z=null,U=null,D=null,P=null,ct=new fn(0,0,0),L=0,W=!1,V=null,Mt=null,Y=null,mt=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={},jt=n.getParameter(n.SCISSOR_BOX),nt=n.getParameter(n.VIEWPORT),bt=new Hr().fromArray(jt),qt=new Hr().fromArray(nt);function $t(O,Q,J,et){let Tt=new Uint8Array(4),Gt=n.createTexture();n.bindTexture(O,Gt),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let re=0;re<J;re++)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+re,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Tt);return Gt}let Ft={};Ft[n.TEXTURE_2D]=$t(n.TEXTURE_2D,n.TEXTURE_2D,1),Ft[n.TEXTURE_CUBE_MAP]=$t(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Ft[n.TEXTURE_2D_ARRAY]=$t(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Ft[n.TEXTURE_3D]=$t(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),zt(n.DEPTH_TEST),p.setFunc(np),Xt(!1),Pt(zb),zt(n.CULL_FACE),St(na);function zt(O){v[O]!==!0&&(n.enable(O),v[O]=!0)}function Ct(O){v[O]!==!1&&(n.disable(O),v[O]=!1)}function te(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 $(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 Gt=0,re=Tt.length;Gt<re;Gt++)J[Gt]=n.COLOR_ATTACHMENT0+Gt;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 Ot(O){return _!==O?(n.useProgram(O),_=O,!0):!1}let _t={[qa]:n.FUNC_ADD,[C4]:n.FUNC_SUBTRACT,[I4]:n.FUNC_REVERSE_SUBTRACT};if(i)_t[Vb]=n.MIN,_t[Hb]=n.MAX;else{let O=t.get("EXT_blend_minmax");O!==null&&(_t[Vb]=O.MIN_EXT,_t[Hb]=O.MAX_EXT)}let Nt={[P4]:n.ZERO,[R4]:n.ONE,[L4]:n.SRC_COLOR,[Y0]:n.SRC_ALPHA,[B4]:n.SRC_ALPHA_SATURATE,[F4]:n.DST_COLOR,[O4]:n.DST_ALPHA,[N4]:n.ONE_MINUS_SRC_COLOR,[$0]:n.ONE_MINUS_SRC_ALPHA,[U4]:n.ONE_MINUS_DST_COLOR,[D4]:n.ONE_MINUS_DST_ALPHA,[z4]:n.CONSTANT_COLOR,[G4]:n.ONE_MINUS_CONSTANT_COLOR,[k4]:n.CONSTANT_ALPHA,[q4]:n.ONE_MINUS_CONSTANT_ALPHA};function St(O,Q,J,et,Tt,Gt,re,ie,Se,ye){if(O===na){x===!0&&(Ct(n.BLEND),x=!1);return}if(x===!1&&(zt(n.BLEND),x=!0),O!==T4){if(O!==T||ye!==W){if((S!==qa||U!==qa)&&(n.blendEquation(n.FUNC_ADD),S=qa,U=qa),ye)switch(O){case sl:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Gb:n.blendFunc(n.ONE,n.ONE);break;case kb:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qb: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 sl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Gb:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case kb:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qb:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}R=null,z=null,D=null,P=null,ct.set(0,0,0),L=0,T=O,W=ye}return}Tt=Tt||Q,Gt=Gt||J,re=re||et,(Q!==S||Tt!==U)&&(n.blendEquationSeparate(_t[Q],_t[Tt]),S=Q,U=Tt),(J!==R||et!==z||Gt!==D||re!==P)&&(n.blendFuncSeparate(Nt[J],Nt[et],Nt[Gt],Nt[re]),R=J,z=et,D=Gt,P=re),(ie.equals(ct)===!1||Se!==L)&&(n.blendColor(ie.r,ie.g,ie.b,Se),ct.copy(ie),L=Se),T=O,W=!1}function Vt(O,Q){O.side===Ss?Ct(n.CULL_FACE):zt(n.CULL_FACE);let J=O.side===Pi;Q&&(J=!J),Xt(J),O.blending===sl&&O.transparent===!1?St(na):St(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)),X(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?zt(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!==M4?(zt(n.CULL_FACE),O!==Mt&&(O===zb?n.cullFace(n.BACK):O===b4?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ct(n.CULL_FACE),Mt=O}function ee(O){O!==Y&&(it&&n.lineWidth(O),Y=O)}function X(O,Q,J){O?(zt(n.POLYGON_OFFSET_FILL),(mt!==Q||ft!==J)&&(n.polygonOffset(Q,J),mt=Q,ft=J)):Ct(n.POLYGON_OFFSET_FILL)}function N(O){O?zt(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 wt(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||Ft[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 Ut(){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){qt.equals(O)===!1&&(n.viewport(O.x,O.y,O.z,O.w),qt.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);m.get(Q)!==et&&(n.uniformBlockBinding(Q,et,O.__bindingPointIndex),m.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,S=null,R=null,z=null,U=null,D=null,P=null,ct=new fn(0,0,0),L=0,W=!1,V=null,Mt=null,Y=null,mt=null,ft=null,bt.set(0,0,n.canvas.width,n.canvas.height),qt.set(0,0,n.canvas.width,n.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:zt,disable:Ct,bindFramebuffer:te,drawBuffers:$,useProgram:Ot,setBlending:St,setMaterial:Vt,setFlipSided:Xt,setCullFace:Pt,setLineWidth:ee,setPolygonOffset:X,setScissorTest:N,activeTexture:xt,bindTexture:wt,unbindTexture:ot,compressedTexImage2D:Lt,compressedTexImage3D:ce,texImage2D:F,texImage3D:k,updateUBOMapping:tt,uniformBlockBinding:pt,texStorage2D:b,texStorage3D:I,texSubImage2D:Rt,texSubImage3D:Ut,compressedTexSubImage2D:Wt,compressedTexSubImage3D:j,scissor:G,viewport:rt,reset:ht}}function d6(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),m=new Ht,y=new WeakMap,v,E=new WeakMap,M=!1;try{M=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(X){}function A(X,N){return M?new OffscreenCanvas(X,N):lp("canvas")}function _(X,N,xt,wt){let ot=1,Lt=ee(X);if((Lt.width>wt||Lt.height>wt)&&(ot=wt/Math.max(Lt.width,Lt.height)),ot<1||N===!0)if(typeof HTMLImageElement!="undefined"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&X instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&X instanceof ImageBitmap||typeof VideoFrame!="undefined"&&X instanceof VideoFrame){let ce=N?ny:Math.floor,Rt=ce(ot*Lt.width),Ut=ce(ot*Lt.height);v===void 0&&(v=A(Rt,Ut));let Wt=xt?A(Rt,Ut):v;return Wt.width=Rt,Wt.height=Ut,Wt.getContext("2d").drawImage(X,0,0,Rt,Ut),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Lt.width+"x"+Lt.height+") to ("+Rt+"x"+Ut+")."),Wt}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Lt.width+"x"+Lt.height+")."),X;return X}function x(X){let N=ee(X);return wA(N.width)&&wA(N.height)}function T(X){return f?!1:X.wrapS!==bo||X.wrapT!==bo||X.minFilter!==Ei&&X.minFilter!==Ii}function S(X,N){return X.generateMipmaps&&N&&X.minFilter!==Ei&&X.minFilter!==Ii}function R(X){n.generateMipmap(X)}function z(X,N,xt,wt,ot=!1){if(f===!1)return N;if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}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?op:In.getTransfer(wt);xt===n.FLOAT&&(Lt=n.RGBA32F),xt===n.HALF_FLOAT&&(Lt=n.RGBA16F),xt===n.UNSIGNED_BYTE&&(Lt=ce===Bn?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(X,N,xt){return S(X,xt)===!0||X.isFramebufferTexture&&X.minFilter!==Ei&&X.minFilter!==Ii?Math.log2(Math.max(N.width,N.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?N.mipmaps.length:1}function D(X){return X===Ei||X===Wb||X===Mc?n.NEAREST:n.LINEAR}function P(X){let N=X.target;N.removeEventListener("dispose",P),L(N),N.isVideoTexture&&y.delete(N)}function ct(X){let N=X.target;N.removeEventListener("dispose",ct),V(N)}function L(X){let N=i.get(X);if(N.__webglInit===void 0)return;let xt=X.source,wt=E.get(xt);if(wt){let ot=wt[N.__cacheKey];ot.usedTimes--,ot.usedTimes===0&&W(X),Object.keys(wt).length===0&&E.delete(xt)}i.remove(X)}function W(X){let N=i.get(X);n.deleteTexture(N.__webglTexture);let xt=X.source,wt=E.get(xt);delete wt[N.__cacheKey],c.memory.textures--}function V(X){let N=i.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let wt=0;wt<6;wt++){if(Array.isArray(N.__webglFramebuffer[wt]))for(let ot=0;ot<N.__webglFramebuffer[wt].length;ot++)n.deleteFramebuffer(N.__webglFramebuffer[wt][ot]);else n.deleteFramebuffer(N.__webglFramebuffer[wt]);N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer[wt])}else{if(Array.isArray(N.__webglFramebuffer))for(let wt=0;wt<N.__webglFramebuffer.length;wt++)n.deleteFramebuffer(N.__webglFramebuffer[wt]);else n.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&n.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let wt=0;wt<N.__webglColorRenderbuffer.length;wt++)N.__webglColorRenderbuffer[wt]&&n.deleteRenderbuffer(N.__webglColorRenderbuffer[wt]);N.__webglDepthRenderbuffer&&n.deleteRenderbuffer(N.__webglDepthRenderbuffer)}let xt=X.textures;for(let wt=0,ot=xt.length;wt<ot;wt++){let Lt=i.get(xt[wt]);Lt.__webglTexture&&(n.deleteTexture(Lt.__webglTexture),c.memory.textures--),i.remove(xt[wt])}i.remove(X)}let Mt=0;function Y(){Mt=0}function mt(){let X=Mt;return X>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+s.maxTextures),Mt+=1,X}function ft(X){let N=[];return N.push(X.wrapS),N.push(X.wrapT),N.push(X.wrapR||0),N.push(X.magFilter),N.push(X.minFilter),N.push(X.anisotropy),N.push(X.internalFormat),N.push(X.format),N.push(X.type),N.push(X.generateMipmaps),N.push(X.premultiplyAlpha),N.push(X.flipY),N.push(X.unpackAlignment),N.push(X.colorSpace),N.join()}function vt(X,N){let xt=i.get(X);if(X.isVideoTexture&&Xt(X),X.isRenderTargetTexture===!1&&X.version>0&&xt.__version!==X.version){let wt=X.image;if(wt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(wt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qt(xt,X,N);return}}e.bindTexture(n.TEXTURE_2D,xt.__webglTexture,n.TEXTURE0+N)}function it(X,N){let xt=i.get(X);if(X.version>0&&xt.__version!==X.version){qt(xt,X,N);return}e.bindTexture(n.TEXTURE_2D_ARRAY,xt.__webglTexture,n.TEXTURE0+N)}function lt(X,N){let xt=i.get(X);if(X.version>0&&xt.__version!==X.version){qt(xt,X,N);return}e.bindTexture(n.TEXTURE_3D,xt.__webglTexture,n.TEXTURE0+N)}function H(X,N){let xt=i.get(X);if(X.version>0&&xt.__version!==X.version){$t(xt,X,N);return}e.bindTexture(n.TEXTURE_CUBE_MAP,xt.__webglTexture,n.TEXTURE0+N)}let At={[j0]:n.REPEAT,[bo]:n.CLAMP_TO_EDGE,[K0]:n.MIRRORED_REPEAT},It={[Ei]:n.NEAREST,[Wb]:n.NEAREST_MIPMAP_NEAREST,[Mc]:n.NEAREST_MIPMAP_LINEAR,[Ii]:n.LINEAR,[c0]:n.LINEAR_MIPMAP_NEAREST,[Ha]:n.LINEAR_MIPMAP_LINEAR},jt={[yk]:n.NEVER,[Sk]:n.ALWAYS,[vk]:n.LESS,[MT]:n.LEQUAL,[_k]:n.EQUAL,[wk]:n.GEQUAL,[xk]:n.GREATER,[Ek]:n.NOTEQUAL};function nt(X,N,xt){if(N.type===Ms&&t.has("OES_texture_float_linear")===!1&&(N.magFilter===Ii||N.magFilter===c0||N.magFilter===Mc||N.magFilter===Ha||N.minFilter===Ii||N.minFilter===c0||N.minFilter===Mc||N.minFilter===Ha)&&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(X,n.TEXTURE_WRAP_S,At[N.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,At[N.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,At[N.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,It[N.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,It[N.minFilter])):(n.texParameteri(X,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(X,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==bo||N.wrapT!==bo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(X,n.TEXTURE_MAG_FILTER,D(N.magFilter)),n.texParameteri(X,n.TEXTURE_MIN_FILTER,D(N.minFilter)),N.minFilter!==Ei&&N.minFilter!==Ii&&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(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,jt[N.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===Ei||N.minFilter!==Mc&&N.minFilter!==Ha||N.type===Ms&&t.has("OES_texture_float_linear")===!1||f===!1&&N.type===Dc&&t.has("OES_texture_half_float_linear")===!1)return;if(N.anisotropy>1||i.get(N).__currentAnisotropy){let wt=t.get("EXT_texture_filter_anisotropic");n.texParameterf(X,wt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,s.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy}}}function bt(X,N){let xt=!1;X.__webglInit===void 0&&(X.__webglInit=!0,N.addEventListener("dispose",P));let wt=N.source,ot=E.get(wt);ot===void 0&&(ot={},E.set(wt,ot));let Lt=ft(N);if(Lt!==X.__cacheKey){ot[Lt]===void 0&&(ot[Lt]={texture:n.createTexture(),usedTimes:0},c.memory.textures++,xt=!0),ot[Lt].usedTimes++;let ce=ot[X.__cacheKey];ce!==void 0&&(ot[X.__cacheKey].usedTimes--,ce.usedTimes===0&&W(N)),X.__cacheKey=Lt,X.__webglTexture=ot[Lt].texture}return xt}function qt(X,N,xt){let wt=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(wt=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(wt=n.TEXTURE_3D);let ot=bt(X,N),Lt=N.source;e.bindTexture(wt,X.__webglTexture,n.TEXTURE0+xt);let ce=i.get(Lt);if(Lt.version!==ce.__version||ot===!0){e.activeTexture(n.TEXTURE0+xt);let Rt=In.getPrimaries(In.workingColorSpace),Ut=N.colorSpace===ta?null:In.getPrimaries(N.colorSpace),Wt=N.colorSpace===ta||Rt===Ut?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=z(N.internalFormat,F,k,N.colorSpace,N.isVideoTexture);nt(wt,N,I);let rt,tt=N.mipmaps,pt=f&&N.isVideoTexture!==!0&&G!==ST,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===Ms?G=n.DEPTH_COMPONENT32F:N.type===ea?G=n.DEPTH_COMPONENT24:N.type===Ya?G=n.DEPTH24_STENCIL8:G=n.DEPTH_COMPONENT16:N.type===Ms&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===$a&&G===n.DEPTH_COMPONENT&&N.type!==Hy&&N.type!==ea&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=ea,k=u.convert(N.type)),N.format===fl&&G===n.DEPTH_COMPONENT&&(G=n.DEPTH_STENCIL,N.type!==Ya&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=Ya,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!==Ao?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!==Ao?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=ee(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=ee(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);S(N,I)&&R(wt),ce.__version=Lt.version,N.onUpdate&&N.onUpdate(N)}X.__version=N.version}function $t(X,N,xt){if(N.image.length!==6)return;let wt=bt(X,N),ot=N.source;e.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture,n.TEXTURE0+xt);let Lt=i.get(ot);if(ot.version!==Lt.__version||wt===!0){e.activeTexture(n.TEXTURE0+xt);let ce=In.getPrimaries(In.workingColorSpace),Rt=N.colorSpace===ta?null:In.getPrimaries(N.colorSpace),Ut=N.colorSpace===ta||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,Ut);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=z(N.internalFormat,k,G,N.colorSpace),tt=f&&N.isVideoTexture!==!0,pt=Lt.__version===void 0||wt===!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!==Ao?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=ee(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 Gt=Q[et].image[J].image;tt?ht&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,0,0,Gt.width,Gt.height,k,G,Gt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,et+1,rt,Gt.width,Gt.height,0,k,G,Gt.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])}}}S(N,F)&&R(n.TEXTURE_CUBE_MAP),Lt.__version=ot.version,N.onUpdate&&N.onUpdate(N)}X.__version=N.version}function Ft(X,N,xt,wt,ot,Lt){let ce=u.convert(xt.format,xt.colorSpace),Rt=u.convert(xt.type),Ut=z(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,Ut,j,b,N.depth,0,ce,Rt,null):e.texImage2D(ot,Lt,Ut,j,b,0,ce,Rt,null)}e.bindFramebuffer(n.FRAMEBUFFER,X),Vt(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,wt,ot,i.get(xt).__webglTexture,0,St(N)):(ot===n.TEXTURE_2D||ot>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ot<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,wt,ot,i.get(xt).__webglTexture,Lt),e.bindFramebuffer(n.FRAMEBUFFER,null)}function zt(X,N,xt){if(n.bindRenderbuffer(n.RENDERBUFFER,X),N.depthBuffer&&!N.stencilBuffer){let wt=f===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(xt||Vt(N)){let ot=N.depthTexture;ot&&ot.isDepthTexture&&(ot.type===Ms?wt=n.DEPTH_COMPONENT32F:ot.type===ea&&(wt=n.DEPTH_COMPONENT24));let Lt=St(N);Vt(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Lt,wt,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Lt,wt,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,wt,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,X)}else if(N.depthBuffer&&N.stencilBuffer){let wt=St(N);xt&&Vt(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,wt,n.DEPTH24_STENCIL8,N.width,N.height):Vt(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,wt,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,X)}else{let wt=N.textures;for(let ot=0;ot<wt.length;ot++){let Lt=wt[ot],ce=u.convert(Lt.format,Lt.colorSpace),Rt=u.convert(Lt.type),Ut=z(Lt.internalFormat,ce,Rt,Lt.colorSpace),Wt=St(N);xt&&Vt(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Wt,Ut,N.width,N.height):Vt(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Wt,Ut,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,Ut,N.width,N.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ct(X,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(n.FRAMEBUFFER,X),!(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 wt=i.get(N.depthTexture).__webglTexture,ot=St(N);if(N.depthTexture.format===$a)Vt(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,wt,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,wt,0);else if(N.depthTexture.format===fl)Vt(N)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,wt,0,ot):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,wt,0);else throw new Error("Unknown depthTexture format")}function te(X){let N=i.get(X),xt=X.isWebGLCubeRenderTarget===!0;if(X.depthTexture&&!N.__autoAllocateDepthBuffer){if(xt)throw new Error("target.depthTexture not supported in Cube render targets");Ct(N.__webglFramebuffer,X)}else if(xt){N.__webglDepthbuffer=[];for(let wt=0;wt<6;wt++)e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer[wt]),N.__webglDepthbuffer[wt]=n.createRenderbuffer(),zt(N.__webglDepthbuffer[wt],X,!1)}else e.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=n.createRenderbuffer(),zt(N.__webglDepthbuffer,X,!1);e.bindFramebuffer(n.FRAMEBUFFER,null)}function $(X,N,xt){let wt=i.get(X);N!==void 0&&Ft(wt.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),xt!==void 0&&te(X)}function Ot(X){let N=X.texture,xt=i.get(X),wt=i.get(N);X.addEventListener("dispose",ct);let ot=X.textures,Lt=X.isWebGLCubeRenderTarget===!0,ce=ot.length>1,Rt=x(X)||f;if(ce||(wt.__webglTexture===void 0&&(wt.__webglTexture=n.createTexture()),wt.__version=N.version,c.memory.textures++),Lt){xt.__webglFramebuffer=[];for(let Ut=0;Ut<6;Ut++)if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer[Ut]=[];for(let Wt=0;Wt<N.mipmaps.length;Wt++)xt.__webglFramebuffer[Ut][Wt]=n.createFramebuffer()}else xt.__webglFramebuffer[Ut]=n.createFramebuffer()}else{if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer=[];for(let Ut=0;Ut<N.mipmaps.length;Ut++)xt.__webglFramebuffer[Ut]=n.createFramebuffer()}else xt.__webglFramebuffer=n.createFramebuffer();if(ce)if(s.drawBuffers)for(let Ut=0,Wt=ot.length;Ut<Wt;Ut++){let j=i.get(ot[Ut]);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&&X.samples>0&&Vt(X)===!1){xt.__webglMultisampledFramebuffer=n.createFramebuffer(),xt.__webglColorRenderbuffer=[],e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglMultisampledFramebuffer);for(let Ut=0;Ut<ot.length;Ut++){let Wt=ot[Ut];xt.__webglColorRenderbuffer[Ut]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,xt.__webglColorRenderbuffer[Ut]);let j=u.convert(Wt.format,Wt.colorSpace),b=u.convert(Wt.type),I=z(Wt.internalFormat,j,b,Wt.colorSpace,X.isXRRenderTarget===!0),F=St(X);n.renderbufferStorageMultisample(n.RENDERBUFFER,F,I,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ut,n.RENDERBUFFER,xt.__webglColorRenderbuffer[Ut])}n.bindRenderbuffer(n.RENDERBUFFER,null),X.depthBuffer&&(xt.__webglDepthRenderbuffer=n.createRenderbuffer(),zt(xt.__webglDepthRenderbuffer,X,!0)),e.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Lt){e.bindTexture(n.TEXTURE_CUBE_MAP,wt.__webglTexture),nt(n.TEXTURE_CUBE_MAP,N,Rt);for(let Ut=0;Ut<6;Ut++)if(f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ft(xt.__webglFramebuffer[Ut][Wt],X,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ut,Wt);else Ft(xt.__webglFramebuffer[Ut],X,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ut,0);S(N,Rt)&&R(n.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(ce){for(let Ut=0,Wt=ot.length;Ut<Wt;Ut++){let j=ot[Ut],b=i.get(j);e.bindTexture(n.TEXTURE_2D,b.__webglTexture),nt(n.TEXTURE_2D,j,Rt),Ft(xt.__webglFramebuffer,X,j,n.COLOR_ATTACHMENT0+Ut,n.TEXTURE_2D,0),S(j,Rt)&&R(n.TEXTURE_2D)}e.unbindTexture()}else{let Ut=n.TEXTURE_2D;if((X.isWebGL3DRenderTarget||X.isWebGLArrayRenderTarget)&&(f?Ut=X.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Ut,wt.__webglTexture),nt(Ut,N,Rt),f&&N.mipmaps&&N.mipmaps.length>0)for(let Wt=0;Wt<N.mipmaps.length;Wt++)Ft(xt.__webglFramebuffer[Wt],X,N,n.COLOR_ATTACHMENT0,Ut,Wt);else Ft(xt.__webglFramebuffer,X,N,n.COLOR_ATTACHMENT0,Ut,0);S(N,Rt)&&R(Ut),e.unbindTexture()}X.depthBuffer&&te(X)}function _t(X){let N=x(X)||f,xt=X.textures;for(let wt=0,ot=xt.length;wt<ot;wt++){let Lt=xt[wt];if(S(Lt,N)){let ce=X.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Rt=i.get(Lt).__webglTexture;e.bindTexture(ce,Rt),R(ce),e.unbindTexture()}}}function Nt(X){if(f&&X.samples>0&&Vt(X)===!1){let N=X.textures,xt=X.width,wt=X.height,ot=n.COLOR_BUFFER_BIT,Lt=[],ce=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Rt=i.get(X),Ut=N.length>1;if(Ut)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),X.depthBuffer&&Lt.push(ce);let j=Rt.__ignoreDepthValues!==void 0?Rt.__ignoreDepthValues:!1;if(j===!1&&(X.depthBuffer&&(ot|=n.DEPTH_BUFFER_BIT),X.stencilBuffer&&(ot|=n.STENCIL_BUFFER_BIT)),Ut&&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])),Ut){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,wt,0,0,xt,wt,ot,n.NEAREST),d&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Lt)}if(e.bindFramebuffer(n.READ_FRAMEBUFFER,null),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Ut)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 St(X){return Math.min(s.maxSamples,X.samples)}function Vt(X){let N=i.get(X);return f&&X.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function Xt(X){let N=c.render.frame;y.get(X)!==N&&(y.set(X,N),X.update())}function Pt(X,N){let xt=X.colorSpace,wt=X.format,ot=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||X.format===ty||xt!==ua&&xt!==ta&&(In.getTransfer(xt)===Bn?f===!1?t.has("EXT_sRGB")===!0&&wt===Ao?(X.format=ty,X.minFilter=Ii,X.generateMipmaps=!1):N=cp.sRGBToLinear(N):(wt!==Ao||ot!==ia)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xt)),N}function ee(X){return typeof HTMLImageElement!="undefined"&&X instanceof HTMLImageElement?(m.width=X.naturalWidth||X.width,m.height=X.naturalHeight||X.height):typeof VideoFrame!="undefined"&&X instanceof VideoFrame?(m.width=X.displayWidth,m.height=X.displayHeight):(m.width=X.width,m.height=X.height),m}this.allocateTextureUnit=mt,this.resetTextureUnits=Y,this.setTexture2D=vt,this.setTexture2DArray=it,this.setTexture3D=lt,this.setTextureCube=H,this.rebindTextures=$,this.setupRenderTarget=Ot,this.updateRenderTargetMipmap=_t,this.updateMultisampleRenderTarget=Nt,this.setupDepthRenderbuffer=te,this.setupFrameBufferTexture=Ft,this.useMultisampledRTT=Vt}function m6(n,t,e){let i=e.isWebGL2;function s(u,c=ta){let f,p=In.getTransfer(c);if(u===ia)return n.UNSIGNED_BYTE;if(u===vT)return n.UNSIGNED_SHORT_4_4_4_4;if(u===_T)return n.UNSIGNED_SHORT_5_5_5_1;if(u===ok)return n.BYTE;if(u===sk)return n.SHORT;if(u===Hy)return n.UNSIGNED_SHORT;if(u===yT)return n.INT;if(u===ea)return n.UNSIGNED_INT;if(u===Ms)return n.FLOAT;if(u===Dc)return i?n.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(u===ak)return n.ALPHA;if(u===Ao)return n.RGBA;if(u===uk)return n.LUMINANCE;if(u===lk)return n.LUMINANCE_ALPHA;if(u===$a)return n.DEPTH_COMPONENT;if(u===fl)return n.DEPTH_STENCIL;if(u===ty)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(u===ck)return n.RED;if(u===xT)return n.RED_INTEGER;if(u===fk)return n.RG;if(u===ET)return n.RG_INTEGER;if(u===wT)return n.RGBA_INTEGER;if(u===f0||u===h0||u===p0||u===d0)if(p===Bn)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(u===f0)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(u===h0)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(u===p0)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(u===d0)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(u===f0)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(u===h0)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(u===p0)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(u===d0)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(u===Xb||u===Yb||u===$b||u===Zb)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(u===Xb)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(u===Yb)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(u===$b)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(u===Zb)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(u===ST)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(u===Jb||u===jb)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(u===Jb)return p===Bn?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(u===jb)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(u===Kb||u===Qb||u===tA||u===eA||u===nA||u===rA||u===iA||u===oA||u===sA||u===aA||u===uA||u===lA||u===cA||u===fA)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(u===Kb)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(u===Qb)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(u===tA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(u===eA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(u===nA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(u===rA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(u===iA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(u===oA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(u===sA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(u===aA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(u===uA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(u===lA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(u===cA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(u===fA)return p===Bn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(u===m0||u===hA||u===pA)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(u===m0)return p===Bn?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(u===hA)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(u===pA)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(u===hk||u===dA||u===mA||u===gA)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(u===m0)return f.COMPRESSED_RED_RGTC1_EXT;if(u===dA)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(u===mA)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(u===gA)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return u===Ya?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 yy=class extends Hi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Xa=class extends Co{constructor(){super(),this.isGroup=!0,this.type="Group"}},g6={type:"move"},Lc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Xa,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 Xa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new at,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new at),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Xa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new at,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new at),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 m=d.joints["index-finger-tip"],y=d.joints["thumb-tip"],v=m.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(g6)))}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 Xa;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},y6=`
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
- }`,vy=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 ro,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 $o({extensions:{fragDepth:!0},vertexShader:y6,fragmentShader:v6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new To(new xp(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},_y=class extends aa{constructor(t,e){super();let i=this,s=null,u=1,c=null,f="local-floor",p=1,d=null,m=null,y=null,v=null,E=null,M=null,A=new vy,_=e.getContextAttributes(),x=null,T=null,S=[],R=[],z=new Ht,U=null,D=new Hi;D.layers.enable(1),D.viewport=new Hr;let P=new Hi;P.layers.enable(2),P.viewport=new Hr;let ct=[D,P],L=new yy;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=S[nt];return bt===void 0&&(bt=new Rc,S[nt]=bt),bt.getTargetRaySpace()},this.getControllerGrip=function(nt){let bt=S[nt];return bt===void 0&&(bt=new Rc,S[nt]=bt),bt.getGripSpace()},this.getHand=function(nt){let bt=S[nt];return bt===void 0&&(bt=new Rc,S[nt]=bt),bt.getHandSpace()};function Mt(nt){let bt=R.indexOf(nt.inputSource);if(bt===-1)return;let qt=S[bt];qt!==void 0&&(qt.update(nt.inputSource,nt.frame,d||c),qt.dispatchEvent({type:nt.type,data:nt.inputSource}))}function Y(){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",Y),s.removeEventListener("inputsourceschange",mt);for(let nt=0;nt<S.length;nt++){let bt=R[nt];bt!==null&&(R[nt]=null,S[nt].disconnect(bt))}W=null,V=null,A.reset(),t.setRenderTarget(x),E=null,v=null,y=null,s=null,T=null,jt.stop(),i.isPresenting=!1,t.setPixelRatio(U),t.setSize(z.width,z.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 Tf(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",Y),s.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),U=t.getPixelRatio(),t.getSize(z),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 Ts(E.framebufferWidth,E.framebufferHeight,{format:Ao,type:ia,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let bt=null,qt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,bt=_.stencil?fl:$a,qt=_.stencil?Ya:ea);let Ft={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:u};y=new XRWebGLBinding(s,e),v=y.createProjectionLayer(Ft),s.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),T=new Ts(v.textureWidth,v.textureHeight,{format:Ao,type:ia,depthTexture:new wp(v.textureWidth,v.textureHeight,qt,void 0,void 0,void 0,void 0,void 0,void 0,bt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let zt=t.properties.get(T);zt.__ignoreDepthValues=v.ignoreDepthValues}T.isXRRenderTarget=!0,this.setFoveation(p),d=null,c=yield s.requestReferenceSpace(f),jt.setContext(s),jt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function mt(nt){for(let bt=0;bt<nt.removed.length;bt++){let qt=nt.removed[bt],$t=R.indexOf(qt);$t>=0&&(R[$t]=null,S[$t].disconnect(qt))}for(let bt=0;bt<nt.added.length;bt++){let qt=nt.added[bt],$t=R.indexOf(qt);if($t===-1){for(let zt=0;zt<S.length;zt++)if(zt>=R.length){R.push(qt),$t=zt;break}else if(R[zt]===null){R[zt]=qt,$t=zt;break}if($t===-1)break}let Ft=S[$t];Ft&&Ft.connect(qt)}}let ft=new at,vt=new at;function it(nt,bt,qt){ft.setFromMatrixPosition(bt.matrixWorld),vt.setFromMatrixPosition(qt.matrixWorld);let $t=ft.distanceTo(vt),Ft=bt.projectionMatrix.elements,zt=qt.projectionMatrix.elements,Ct=Ft[14]/(Ft[10]-1),te=Ft[14]/(Ft[10]+1),$=(Ft[9]+1)/Ft[5],Ot=(Ft[9]-1)/Ft[5],_t=(Ft[8]-1)/Ft[0],Nt=(zt[8]+1)/zt[0],St=Ct*_t,Vt=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 ee=Ct+Xt,X=te+Xt,N=St-Pt,xt=Vt+($t-Pt),wt=$*te/X*ee,ot=Ot*te/X*ee;nt.projectionMatrix.makePerspective(N,xt,wt,ot,ee,X),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,qt=L.cameras;lt(L,bt);for(let $t=0;$t<qt.length;$t++)lt(qt[$t],bt);qt.length===2?it(L,D,P):L.projectionMatrix.copy(D.projectionMatrix),H(nt,L,bt)};function H(nt,bt,qt){qt===null?nt.matrix.copy(bt.matrixWorld):(nt.matrix.copy(qt.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=ey*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(m=bt.getViewerPose(d||c),M=bt,m!==null){let qt=m.views;E!==null&&(t.setRenderTargetFramebuffer(T,E.framebuffer),t.setRenderTarget(T));let $t=!1;qt.length!==L.cameras.length&&(L.cameras.length=0,$t=!0);for(let zt=0;zt<qt.length;zt++){let Ct=qt[zt],te=null;if(E!==null)te=E.getViewport(Ct);else{let Ot=y.getViewSubImage(v,Ct);te=Ot.viewport,zt===0&&(t.setRenderTargetTextures(T,Ot.colorTexture,v.ignoreDepthValues?void 0:Ot.depthStencilTexture),t.setRenderTarget(T))}let $=ct[zt];$===void 0&&($=new Hi,$.layers.enable(zt),$.viewport=new Hr,ct[zt]=$),$.matrix.fromArray(Ct.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(Ct.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(te.x,te.y,te.width,te.height),zt===0&&(L.matrix.copy($.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),$t===!0&&L.cameras.push($)}let Ft=s.enabledFeatures;if(Ft&&Ft.includes("depth-sensing")){let zt=y.getDepthInformation(qt[0]);zt&&zt.isValid&&zt.texture&&A.init(t,zt,s.renderState)}}for(let qt=0;qt<S.length;qt++){let $t=R[qt],Ft=S[qt];$t!==null&&Ft!==void 0&&Ft.update($t,bt,d||c)}A.render(t,L),At&&At(nt,bt),bt.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:bt}),M=null}let jt=new IT;jt.setAnimationLoop(It),this.setAnimationLoop=function(nt){At=nt},this.dispose=function(){}}},Ga=new Ja,_6=new ir;function x6(n,t){function e(_,x){_.matrixAutoUpdate===!0&&_.updateMatrix(),x.value.copy(_.matrix)}function i(_,x){x.color.getRGB(_.fogColor.value,CT(n)),x.isFog?(_.fogNear.value=x.near,_.fogFar.value=x.far):x.isFogExp2&&(_.fogDensity.value=x.density)}function s(_,x,T,S,R){x.isMeshBasicMaterial||x.isMeshLambertMaterial?u(_,x):x.isMeshToonMaterial?(u(_,x),y(_,x)):x.isMeshPhongMaterial?(u(_,x),m(_,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,S):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===Pi&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,e(x.normalMap,_.normalMapTransform),_.normalScale.value.copy(x.normalScale),x.side===Pi&&_.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),S=T.envMap,R=T.envMapRotation;if(S&&(_.envMap.value=S,Ga.copy(R),Ga.x*=-1,Ga.y*=-1,Ga.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(Ga.y*=-1,Ga.z*=-1),_.envMapRotation.value.setFromMatrix4(_6.makeRotationFromEuler(Ga)),_.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=x.reflectivity,_.ior.value=x.ior,_.refractionRatio.value=x.refractionRatio),x.lightMap){_.lightMap.value=x.lightMap;let z=n._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=x.lightMapIntensity*z,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,S){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*T,_.scale.value=S*.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 m(_,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===Pi&&_.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 E6(n,t,e,i){let s={},u={},c=[],f=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(T,S){let R=S.program;i.uniformBlockBinding(T,R)}function d(T,S){let R=s[T.id];R===void 0&&(M(T),R=m(T),s[T.id]=R,T.addEventListener("dispose",_));let z=S.program;i.updateUBOMapping(T,z);let U=t.render.frame;u[T.id]!==U&&(v(T),u[T.id]=U)}function m(T){let S=y();T.__bindingPointIndex=S;let R=n.createBuffer(),z=T.__size,U=T.usage;return n.bindBuffer(n.UNIFORM_BUFFER,R),n.bufferData(n.UNIFORM_BUFFER,z,U),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,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 S=s[T.id],R=T.uniforms,z=T.__cache;n.bindBuffer(n.UNIFORM_BUFFER,S);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,z)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],Y=0;for(let mt=0;mt<Mt.length;mt++){let ft=Mt[mt],vt=A(ft);typeof ft=="number"||typeof ft=="boolean"?(W.__data[0]=ft,n.bufferSubData(n.UNIFORM_BUFFER,V+Y,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,Y),Y+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,V,W.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function E(T,S,R,z){let U=T.value,D=S+"_"+R;if(z[D]===void 0)return typeof U=="number"||typeof U=="boolean"?z[D]=U:z[D]=U.clone(),!0;{let P=z[D];if(typeof U=="number"||typeof U=="boolean"){if(P!==U)return z[D]=U,!0}else if(P.equals(U)===!1)return P.copy(U),!0}return!1}function M(T){let S=T.uniforms,R=0,z=16;for(let D=0,P=S.length;D<P;D++){let ct=Array.isArray(S[D])?S[D]:[S[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 Y=0,mt=Mt.length;Y<mt;Y++){let ft=Mt[Y],vt=A(ft),it=R%z;it!==0&&z-it<vt.boundary&&(R+=z-it),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=R,R+=vt.storage}}}let U=R%z;return U>0&&(R+=z-U),T.__size=R,T.__cache={},this}function A(T){let S={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(S.boundary=4,S.storage=4):T.isVector2?(S.boundary=8,S.storage=8):T.isVector3||T.isColor?(S.boundary=16,S.storage=12):T.isVector4?(S.boundary=16,S.storage=16):T.isMatrix3?(S.boundary=48,S.storage=48):T.isMatrix4?(S.boundary=64,S.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),S}function _(T){let S=T.target;S.removeEventListener("dispose",_);let R=c.indexOf(S.__bindingPointIndex);c.splice(R,1),n.deleteBuffer(s[S.id]),delete s[S.id],delete u[S.id]}function x(){for(let T in s)n.deleteBuffer(s[T]);c=[],s={},u={}}return{bind:p,update:d,dispose:x}}var xy=class{constructor(t={}){let{canvas:e=bk(),context:i=null,depth:s=!0,stencil:u=!0,alpha:c=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:m="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=Wo,this._useLegacyLights=!1,this.toneMapping=ra,this.toneMappingExposure=1;let S=this,R=!1,z=0,U=0,D=null,P=-1,ct=null,L=new Hr,W=new Hr,V=null,Mt=new fn(0),Y=0,mt=e.width,ft=e.height,vt=1,it=null,lt=null,H=new Hr(0,0,mt,ft),At=new Hr(0,0,mt,ft),It=!1,jt=new _p,nt=!1,bt=!1,qt=null,$t=new ir,Ft=new Ht,zt=new at,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return D===null?vt:1}let $=i;function Ot(q,st){for(let Et=0;Et<q.length;Et++){let dt=q[Et],ut=e.getContext(dt,st);if(ut!==null)return ut}return null}try{let q={alpha:!0,depth:s,stencil:u,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:m,failIfMajorPerformanceCaveat:y};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Vy}`),e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",Q,!1),$===null){let st=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&st.shift(),$=Ot(st,q),$===null)throw Ot(st)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&$ instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),$.getShaderPrecisionFormat===void 0&&($.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let _t,Nt,St,Vt,Xt,Pt,ee,X,N,xt,wt,ot,Lt,ce,Rt,Ut,Wt,j,b,I,F,k,G,rt;function tt(){_t=new UV($),Nt=new RV($,_t,t),_t.init(Nt),k=new m6($,_t,Nt),St=new p6($,_t,Nt),Vt=new GV($),Xt=new e6,Pt=new d6($,_t,St,Xt,Nt,k,Vt),ee=new NV(S),X=new FV(S),N=new Xk($,Nt),G=new IV($,_t,N,Nt),xt=new BV($,N,Vt,G),wt=new HV($,xt,N,Vt),b=new VV($,Nt,Pt),Ut=new LV(Xt),ot=new t6(S,ee,X,_t,Nt,G,Ut),Lt=new x6(S,Xt),ce=new r6,Rt=new l6(_t,Nt),j=new CV(S,ee,X,St,wt,v,p),Wt=new h6(S,wt,Nt),rt=new E6($,Vt,Nt,St),I=new PV($,_t,Vt,Nt),F=new zV($,_t,Vt,Nt),Vt.programs=ot.programs,S.capabilities=Nt,S.extensions=_t,S.properties=Xt,S.renderLists=ce,S.shadowMap=Wt,S.state=St,S.info=Vt}tt();let pt=new _y(S,$);this.xr=pt,this.getContext=function(){return $},this.getContextAttributes=function(){return $.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(mt,ft,!1))},this.getSize=function(q){return q.set(mt,ft)},this.setSize=function(q,st,Et=!0){if(pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,ft=st,e.width=Math.floor(q*vt),e.height=Math.floor(st*vt),Et===!0&&(e.style.width=q+"px",e.style.height=st+"px"),this.setViewport(0,0,q,st)},this.getDrawingBufferSize=function(q){return q.set(mt*vt,ft*vt).floor()},this.setDrawingBufferSize=function(q,st,Et){mt=q,ft=st,vt=Et,e.width=Math.floor(q*Et),e.height=Math.floor(st*Et),this.setViewport(0,0,q,st)},this.getCurrentViewport=function(q){return q.copy(L)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,st,Et,dt){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,st,Et,dt),St.viewport(L.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(At)},this.setScissor=function(q,st,Et,dt){q.isVector4?At.set(q.x,q.y,q.z,q.w):At.set(q,st,Et,dt),St.scissor(W.copy(At).multiplyScalar(vt).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(q){St.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,st=!0,Et=!0){let dt=0;if(q){let ut=!1;if(D!==null){let Kt=D.texture.format;ut=Kt===wT||Kt===ET||Kt===xT}if(ut){let Kt=D.texture.type,Qt=Kt===ia||Kt===ea||Kt===Hy||Kt===Ya||Kt===vT||Kt===_T,le=j.getClearColor(),ne=j.getClearAlpha(),ve=le.r,fe=le.g,he=le.b;Qt?(E[0]=ve,E[1]=fe,E[2]=he,E[3]=ne,$.clearBufferuiv($.COLOR,0,E)):(M[0]=ve,M[1]=fe,M[2]=he,M[3]=ne,$.clearBufferiv($.COLOR,0,M))}else dt|=$.COLOR_BUFFER_BIT}st&&(dt|=$.DEPTH_BUFFER_BIT),Et&&(dt|=$.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),$.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(),ee.dispose(),X.dispose(),wt.dispose(),G.dispose(),rt.dispose(),ot.dispose(),Wt.dispose(),pt.dispose(),pt.removeEventListener("sessionstart",Se),pt.removeEventListener("sessionend",ye),qt&&(qt.dispose(),qt=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=Vt.autoReset,st=Wt.enabled,Et=Wt.autoUpdate,dt=Wt.needsUpdate,ut=Wt.type;tt(),Vt.autoReset=q,Wt.enabled=st,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 st=q.target;st.removeEventListener("dispose",J),et(st)}function et(q){Tt(q),Xt.remove(q)}function Tt(q){let st=Xt.get(q).programs;st!==void 0&&(st.forEach(function(Et){ot.releaseProgram(Et)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,st,Et,dt,ut,Kt){st===null&&(st=Ct);let Qt=ut.isMesh&&ut.matrixWorld.determinant()<0,le=En(q,st,Et,dt,ut);St.setMaterial(dt,Qt);let ne=Et.index,ve=1;if(dt.wireframe===!0){if(ne=xt.getWireframeAttribute(Et),ne===void 0)return;ve=2}let fe=Et.drawRange,he=Et.attributes.position,ln=fe.start*ve,Mr=(fe.start+fe.count)*ve;Kt!==null&&(ln=Math.max(ln,Kt.start*ve),Mr=Math.min(Mr,(Kt.start+Kt.count)*ve)),ne!==null?(ln=Math.max(ln,0),Mr=Math.min(Mr,ne.count)):he!=null&&(ln=Math.max(ln,0),Mr=Math.min(Mr,he.count));let kn=Mr-ln;if(kn<0||kn===1/0)return;G.setup(ut,dt,le,Et,ne);let ai,Sn=I;if(ne!==null&&(ai=N.get(ne),Sn=F,Sn.setIndex(ai)),ut.isMesh)dt.wireframe===!0?(St.setLineWidth(dt.wireframeLinewidth*te()),Sn.setMode($.LINES)):Sn.setMode($.TRIANGLES);else if(ut.isLine){let oe=dt.linewidth;oe===void 0&&(oe=1),St.setLineWidth(oe*te()),ut.isLineSegments?Sn.setMode($.LINES):ut.isLineLoop?Sn.setMode($.LINE_LOOP):Sn.setMode($.LINE_STRIP)}else ut.isPoints?Sn.setMode($.POINTS):ut.isSprite&&Sn.setMode($.TRIANGLES);if(ut.isBatchedMesh)Sn.renderMultiDraw(ut._multiDrawStarts,ut._multiDrawCounts,ut._multiDrawCount);else if(ut.isInstancedMesh)Sn.renderInstances(ln,kn,ut.count);else if(Et.isInstancedBufferGeometry){let oe=Et._maxInstanceCount!==void 0?Et._maxInstanceCount:1/0,cu=Math.min(Et.instanceCount,oe);Sn.renderInstances(ln,kn,cu)}else Sn.render(ln,kn)};function Gt(q,st,Et){q.transparent===!0&&q.side===Ss&&q.forceSinglePass===!1?(q.side=Pi,q.needsUpdate=!0,xn(q,st,Et),q.side=sa,q.needsUpdate=!0,xn(q,st,Et),q.side=Ss):xn(q,st,Et)}this.compile=function(q,st,Et=null){Et===null&&(Et=q),_=Rt.get(Et),_.init(),T.push(_),Et.traverseVisible(function(ut){ut.isLight&&ut.layers.test(st.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),q!==Et&&q.traverseVisible(function(ut){ut.isLight&&ut.layers.test(st.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),_.setupLights(S._useLegacyLights);let dt=new Set;return q.traverse(function(ut){let Kt=ut.material;if(Kt)if(Array.isArray(Kt))for(let Qt=0;Qt<Kt.length;Qt++){let le=Kt[Qt];Gt(le,Et,ut),dt.add(le)}else Gt(Kt,Et,ut),dt.add(Kt)}),T.pop(),_=null,dt},this.compileAsync=function(q,st,Et=null){let dt=this.compile(q,st,Et);return new Promise(ut=>{function Kt(){if(dt.forEach(function(Qt){Xt.get(Qt).currentProgram.isReady()&&dt.delete(Qt)}),dt.size===0){ut(q);return}setTimeout(Kt,10)}_t.get("KHR_parallel_shader_compile")!==null?Kt():setTimeout(Kt,10)})};let re=null;function ie(q){re&&re(q)}function Se(){be.stop()}function ye(){be.start()}let be=new IT;be.setAnimationLoop(ie),typeof self!="undefined"&&be.setContext(self),this.setAnimationLoop=function(q){re=q,pt.setAnimationLoop(q),q===null?be.stop():be.start()},pt.addEventListener("sessionstart",Se),pt.addEventListener("sessionend",ye),this.render=function(q,st){if(st!==void 0&&st.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(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),pt.enabled===!0&&pt.isPresenting===!0&&(pt.cameraAutoUpdate===!0&&pt.updateCamera(st),st=pt.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,st,D),_=Rt.get(q,T.length),_.init(),T.push(_),$t.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),jt.setFromProjectionMatrix($t),bt=this.localClippingEnabled,nt=Ut.init(this.clippingPlanes,bt),A=ce.get(q,x.length),A.init(),x.push(A),Ae(q,st,0,S.sortObjects),A.finish(),S.sortObjects===!0&&A.sort(it,lt),this.info.render.frame++,nt===!0&&Ut.beginShadows();let Et=_.state.shadowsArray;if(Wt.render(Et,q,st),nt===!0&&Ut.endShadows(),this.info.autoReset===!0&&this.info.reset(),(pt.enabled===!1||pt.isPresenting===!1||pt.hasDepthSensing()===!1)&&j.render(A,q),_.setupLights(S._useLegacyLights),st.isArrayCamera){let dt=st.cameras;for(let ut=0,Kt=dt.length;ut<Kt;ut++){let Qt=dt[ut];On(A,q,Qt,Qt.viewport)}}else On(A,q,st);D!==null&&(Pt.updateMultisampleRenderTarget(D),Pt.updateRenderTargetMipmap(D)),q.isScene===!0&&q.onAfterRender(S,q,st),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,st,Et,dt){if(q.visible===!1)return;if(q.layers.test(st.layers)){if(q.isGroup)Et=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(st);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||jt.intersectsSprite(q)){dt&&zt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Qt=wt.update(q),le=q.material;le.visible&&A.push(q,Qt,le,Et,zt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||jt.intersectsObject(q))){let Qt=wt.update(q),le=q.material;if(dt&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),zt.copy(q.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),zt.copy(Qt.boundingSphere.center)),zt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(le)){let ne=Qt.groups;for(let ve=0,fe=ne.length;ve<fe;ve++){let he=ne[ve],ln=le[he.materialIndex];ln&&ln.visible&&A.push(q,Qt,ln,Et,zt.z,he)}}else le.visible&&A.push(q,Qt,le,Et,zt.z,null)}}let Kt=q.children;for(let Qt=0,le=Kt.length;Qt<le;Qt++)Ae(Kt[Qt],st,Et,dt)}function On(q,st,Et,dt){let ut=q.opaque,Kt=q.transmissive,Qt=q.transparent;_.setupLightsView(Et),nt===!0&&Ut.setGlobalState(S.clippingPlanes,Et),Kt.length>0&&pr(ut,Kt,st,Et),dt&&St.viewport(L.copy(dt)),ut.length>0&&_n(ut,st,Et),Kt.length>0&&_n(Kt,st,Et),Qt.length>0&&_n(Qt,st,Et),St.buffers.depth.setTest(!0),St.buffers.depth.setMask(!0),St.buffers.color.setMask(!0),St.setPolygonOffset(!1)}function pr(q,st,Et,dt){if((Et.isScene===!0?Et.overrideMaterial:null)!==null)return;let Kt=Nt.isWebGL2;qt===null&&(qt=new Ts(1,1,{generateMipmaps:!0,type:_t.has("EXT_color_buffer_half_float")?Oc:ia,minFilter:Ha,samples:Kt?4:0})),S.getDrawingBufferSize(Ft),Kt?qt.setSize(Ft.x,Ft.y):qt.setSize(ny(Ft.x),ny(Ft.y));let Qt=S.getRenderTarget();S.setRenderTarget(qt),S.getClearColor(Mt),Y=S.getClearAlpha(),Y<1&&S.setClearColor(16777215,.5),S.clear();let le=S.toneMapping;S.toneMapping=ra,_n(q,Et,dt),Pt.updateMultisampleRenderTarget(qt),Pt.updateRenderTargetMipmap(qt);let ne=!1;for(let ve=0,fe=st.length;ve<fe;ve++){let he=st[ve],ln=he.object,Mr=he.geometry,kn=he.material,ai=he.group;if(kn.side===Ss&&ln.layers.test(dt.layers)){let Sn=kn.side;kn.side=Pi,kn.needsUpdate=!0,pe(ln,Et,dt,Mr,kn,ai),kn.side=Sn,kn.needsUpdate=!0,ne=!0}}ne===!0&&(Pt.updateMultisampleRenderTarget(qt),Pt.updateRenderTargetMipmap(qt)),S.setRenderTarget(Qt),S.setClearColor(Mt,Y),S.toneMapping=le}function _n(q,st,Et){let dt=st.isScene===!0?st.overrideMaterial:null;for(let ut=0,Kt=q.length;ut<Kt;ut++){let Qt=q[ut],le=Qt.object,ne=Qt.geometry,ve=dt===null?Qt.material:dt,fe=Qt.group;le.layers.test(Et.layers)&&pe(le,st,Et,ne,ve,fe)}}function pe(q,st,Et,dt,ut,Kt){q.onBeforeRender(S,st,Et,dt,ut,Kt),q.modelViewMatrix.multiplyMatrices(Et.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ut.onBeforeRender(S,st,Et,dt,q,Kt),ut.transparent===!0&&ut.side===Ss&&ut.forceSinglePass===!1?(ut.side=Pi,ut.needsUpdate=!0,S.renderBufferDirect(Et,st,dt,ut,q,Kt),ut.side=sa,ut.needsUpdate=!0,S.renderBufferDirect(Et,st,dt,ut,q,Kt),ut.side=Ss):S.renderBufferDirect(Et,st,dt,ut,q,Kt),q.onAfterRender(S,st,Et,dt,ut,Kt)}function xn(q,st,Et){st.isScene!==!0&&(st=Ct);let dt=Xt.get(q),ut=_.state.lights,Kt=_.state.shadowsArray,Qt=ut.state.version,le=ot.getParameters(q,ut.state,Kt,st,Et),ne=ot.getProgramCacheKey(le),ve=dt.programs;dt.environment=q.isMeshStandardMaterial?st.environment:null,dt.fog=st.fog,dt.envMap=(q.isMeshStandardMaterial?X:ee).get(q.envMap||dt.environment),dt.envMapRotation=dt.environment!==null&&q.envMap===null?st.environmentRotation:q.envMapRotation,ve===void 0&&(q.addEventListener("dispose",J),ve=new Map,dt.programs=ve);let fe=ve.get(ne);if(fe!==void 0){if(dt.currentProgram===fe&&dt.lightsStateVersion===Qt)return Tn(q,le),fe}else le.uniforms=ot.getUniforms(q),q.onBuild(Et,le,S),q.onBeforeCompile(le,S),fe=ot.acquireProgram(le,ne),ve.set(ne,fe),dt.uniforms=le.uniforms;let he=dt.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(he.clippingPlanes=Ut.uniform),Tn(q,le),dt.needsLights=Sr(q),dt.lightsStateVersion=Qt,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 Rn(q){if(q.uniformsList===null){let st=q.currentProgram.getUniforms();q.uniformsList=ul.seqWithValue(st.seq,q.uniforms)}return q.uniformsList}function Tn(q,st){let Et=Xt.get(q);Et.outputColorSpace=st.outputColorSpace,Et.batching=st.batching,Et.instancing=st.instancing,Et.instancingColor=st.instancingColor,Et.instancingMorph=st.instancingMorph,Et.skinning=st.skinning,Et.morphTargets=st.morphTargets,Et.morphNormals=st.morphNormals,Et.morphColors=st.morphColors,Et.morphTargetsCount=st.morphTargetsCount,Et.numClippingPlanes=st.numClippingPlanes,Et.numIntersection=st.numClipIntersection,Et.vertexAlphas=st.vertexAlphas,Et.vertexTangents=st.vertexTangents,Et.toneMapping=st.toneMapping}function En(q,st,Et,dt,ut){st.isScene!==!0&&(st=Ct),Pt.resetTextureUnits();let Kt=st.fog,Qt=dt.isMeshStandardMaterial?st.environment:null,le=D===null?S.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:ua,ne=(dt.isMeshStandardMaterial?X:ee).get(dt.envMap||Qt),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,ln=!!Et.morphAttributes.normal,Mr=!!Et.morphAttributes.color,kn=ra;dt.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(kn=S.toneMapping);let ai=Et.morphAttributes.position||Et.morphAttributes.normal||Et.morphAttributes.color,Sn=ai!==void 0?ai.length:0,oe=Xt.get(dt),cu=_.state.lights;if(nt===!0&&(bt===!0||q!==ct)){let ui=q===ct&&dt.id===P;Ut.setState(dt,q,ui)}let cn=!1;dt.version===oe.__version?(oe.needsLights&&oe.lightsStateVersion!==cu.state.version||oe.outputColorSpace!==le||ut.isBatchedMesh&&oe.batching===!1||!ut.isBatchedMesh&&oe.batching===!0||ut.isInstancedMesh&&oe.instancing===!1||!ut.isInstancedMesh&&oe.instancing===!0||ut.isSkinnedMesh&&oe.skinning===!1||!ut.isSkinnedMesh&&oe.skinning===!0||ut.isInstancedMesh&&oe.instancingColor===!0&&ut.instanceColor===null||ut.isInstancedMesh&&oe.instancingColor===!1&&ut.instanceColor!==null||ut.isInstancedMesh&&oe.instancingMorph===!0&&ut.morphTexture===null||ut.isInstancedMesh&&oe.instancingMorph===!1&&ut.morphTexture!==null||oe.envMap!==ne||dt.fog===!0&&oe.fog!==Kt||oe.numClippingPlanes!==void 0&&(oe.numClippingPlanes!==Ut.numPlanes||oe.numIntersection!==Ut.numIntersection)||oe.vertexAlphas!==ve||oe.vertexTangents!==fe||oe.morphTargets!==he||oe.morphNormals!==ln||oe.morphColors!==Mr||oe.toneMapping!==kn||Nt.isWebGL2===!0&&oe.morphTargetsCount!==Sn)&&(cn=!0):(cn=!0,oe.__version=dt.version);let oo=oe.currentProgram;cn===!0&&(oo=xn(dt,st,ut));let Wl=!1,_e=!1,ga=!1,Mn=oo.getUniforms(),so=oe.uniforms;if(St.useProgram(oo.program)&&(Wl=!0,_e=!0,ga=!0),dt.id!==P&&(P=dt.id,_e=!0),Wl||ct!==q){Mn.setValue($,"projectionMatrix",q.projectionMatrix),Mn.setValue($,"viewMatrix",q.matrixWorldInverse);let ui=Mn.map.cameraPosition;ui!==void 0&&ui.setValue($,zt.setFromMatrixPosition(q.matrixWorld)),Nt.logarithmicDepthBuffer&&Mn.setValue($,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(dt.isMeshPhongMaterial||dt.isMeshToonMaterial||dt.isMeshLambertMaterial||dt.isMeshBasicMaterial||dt.isMeshStandardMaterial||dt.isShaderMaterial)&&Mn.setValue($,"isOrthographic",q.isOrthographicCamera===!0),ct!==q&&(ct=q,_e=!0,ga=!0)}if(ut.isSkinnedMesh){Mn.setOptional($,ut,"bindMatrix"),Mn.setOptional($,ut,"bindMatrixInverse");let ui=ut.skeleton;ui&&(Nt.floatVertexTextures?(ui.boneTexture===null&&ui.computeBoneTexture(),Mn.setValue($,"boneTexture",ui.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($,ut,"batchingTexture"),Mn.setValue($,"batchingTexture",ut._matricesTexture,Pt));let ge=Et.morphAttributes;if((ge.position!==void 0||ge.normal!==void 0||ge.color!==void 0&&Nt.isWebGL2===!0)&&b.update(ut,Et,oo),(_e||oe.receiveShadow!==ut.receiveShadow)&&(oe.receiveShadow=ut.receiveShadow,Mn.setValue($,"receiveShadow",ut.receiveShadow)),dt.isMeshGouraudMaterial&&dt.envMap!==null&&(so.envMap.value=ne,so.flipEnvMap.value=ne.isCubeTexture&&ne.isRenderTargetTexture===!1?-1:1),_e&&(Mn.setValue($,"toneMappingExposure",S.toneMappingExposure),oe.needsLights&&Jr(so,ga),Kt&&dt.fog===!0&&Lt.refreshFogUniforms(so,Kt),Lt.refreshMaterialUniforms(so,dt,vt,ft,qt),ul.upload($,Rn(oe),so,Pt)),dt.isShaderMaterial&&dt.uniformsNeedUpdate===!0&&(ul.upload($,Rn(oe),so,Pt),dt.uniformsNeedUpdate=!1),dt.isSpriteMaterial&&Mn.setValue($,"center",ut.center),Mn.setValue($,"modelViewMatrix",ut.modelViewMatrix),Mn.setValue($,"normalMatrix",ut.normalMatrix),Mn.setValue($,"modelMatrix",ut.matrixWorld),dt.isShaderMaterial||dt.isRawShaderMaterial){let ui=dt.uniformsGroups;for(let Xl=0,fu=ui.length;Xl<fu;Xl++)if(Nt.isWebGL2){let li=ui[Xl];rt.update(li,oo),rt.bind(li,oo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return oo}function Jr(q,st){q.ambientLightColor.needsUpdate=st,q.lightProbe.needsUpdate=st,q.directionalLights.needsUpdate=st,q.directionalLightShadows.needsUpdate=st,q.pointLights.needsUpdate=st,q.pointLightShadows.needsUpdate=st,q.spotLights.needsUpdate=st,q.spotLightShadows.needsUpdate=st,q.rectAreaLights.needsUpdate=st,q.hemisphereLights.needsUpdate=st}function Sr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(q,st,Et){Xt.get(q.texture).__webglTexture=st,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,st){let Et=Xt.get(q);Et.__webglFramebuffer=st,Et.__useDefaultFramebuffer=st===void 0},this.setRenderTarget=function(q,st=0,Et=0){D=q,z=st,U=Et;let dt=!0,ut=null,Kt=!1,Qt=!1;if(q){let ne=Xt.get(q);ne.__useDefaultFramebuffer!==void 0?(St.bindFramebuffer($.FRAMEBUFFER,null),dt=!1):ne.__webglFramebuffer===void 0?Pt.setupRenderTarget(q):ne.__hasExternalTextures&&Pt.rebindTextures(q,Xt.get(q.texture).__webglTexture,Xt.get(q.depthTexture).__webglTexture);let ve=q.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(Qt=!0);let fe=Xt.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(fe[st])?ut=fe[st][Et]:ut=fe[st],Kt=!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(St.bindFramebuffer($.FRAMEBUFFER,ut)&&Nt.drawBuffers&&dt&&St.drawBuffers(q,ut),St.viewport(L),St.scissor(W),St.setScissorTest(V),Kt){let ne=Xt.get(q.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+st,ne.__webglTexture,Et)}else if(Qt){let ne=Xt.get(q.texture),ve=st||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,ne.__webglTexture,Et||0,ve)}P=-1},this.readRenderTargetPixels=function(q,st,Et,dt,ut,Kt,Qt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let le=Xt.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Qt!==void 0&&(le=le[Qt]),le){St.bindFramebuffer($.FRAMEBUFFER,le);try{let ne=q.texture,ve=ne.format,fe=ne.type;if(ve!==Ao&&k.convert(ve)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let he=fe===Oc&&(_t.has("EXT_color_buffer_half_float")||Nt.isWebGL2&&_t.has("EXT_color_buffer_float"));if(fe!==ia&&k.convert(fe)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_TYPE)&&!(fe===Ms&&(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}st>=0&&st<=q.width-dt&&Et>=0&&Et<=q.height-ut&&$.readPixels(st,Et,dt,ut,k.convert(ve),k.convert(fe),Kt)}finally{let ne=D!==null?Xt.get(D).__webglFramebuffer:null;St.bindFramebuffer($.FRAMEBUFFER,ne)}}},this.copyFramebufferToTexture=function(q,st,Et=0){let dt=Math.pow(2,-Et),ut=Math.floor(st.image.width*dt),Kt=Math.floor(st.image.height*dt);Pt.setTexture2D(st,0),$.copyTexSubImage2D($.TEXTURE_2D,Et,0,0,q.x,q.y,ut,Kt),St.unbindTexture()},this.copyTextureToTexture=function(q,st,Et,dt=0){let ut=st.image.width,Kt=st.image.height,Qt=k.convert(Et.format),le=k.convert(Et.type);Pt.setTexture2D(Et,0),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,Et.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Et.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,Et.unpackAlignment),st.isDataTexture?$.texSubImage2D($.TEXTURE_2D,dt,q.x,q.y,ut,Kt,Qt,le,st.image.data):st.isCompressedTexture?$.compressedTexSubImage2D($.TEXTURE_2D,dt,q.x,q.y,st.mipmaps[0].width,st.mipmaps[0].height,Qt,st.mipmaps[0].data):$.texSubImage2D($.TEXTURE_2D,dt,q.x,q.y,Qt,le,st.image),dt===0&&Et.generateMipmaps&&$.generateMipmap($.TEXTURE_2D),St.unbindTexture()},this.copyTextureToTexture3D=function(q,st,Et,dt,ut=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Kt=Math.round(q.max.x-q.min.x),Qt=Math.round(q.max.y-q.min.y),le=q.max.z-q.min.z+1,ne=k.convert(dt.format),ve=k.convert(dt.type),fe;if(dt.isData3DTexture)Pt.setTexture3D(dt,0),fe=$.TEXTURE_3D;else if(dt.isDataArrayTexture||dt.isCompressedArrayTexture)Pt.setTexture2DArray(dt,0),fe=$.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,dt.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dt.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,dt.unpackAlignment);let he=$.getParameter($.UNPACK_ROW_LENGTH),ln=$.getParameter($.UNPACK_IMAGE_HEIGHT),Mr=$.getParameter($.UNPACK_SKIP_PIXELS),kn=$.getParameter($.UNPACK_SKIP_ROWS),ai=$.getParameter($.UNPACK_SKIP_IMAGES),Sn=Et.isCompressedTexture?Et.mipmaps[ut]:Et.image;$.pixelStorei($.UNPACK_ROW_LENGTH,Sn.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,Sn.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,q.min.x),$.pixelStorei($.UNPACK_SKIP_ROWS,q.min.y),$.pixelStorei($.UNPACK_SKIP_IMAGES,q.min.z),Et.isDataTexture||Et.isData3DTexture?$.texSubImage3D(fe,ut,st.x,st.y,st.z,Kt,Qt,le,ne,ve,Sn.data):dt.isCompressedArrayTexture?$.compressedTexSubImage3D(fe,ut,st.x,st.y,st.z,Kt,Qt,le,ne,Sn.data):$.texSubImage3D(fe,ut,st.x,st.y,st.z,Kt,Qt,le,ne,ve,Sn),$.pixelStorei($.UNPACK_ROW_LENGTH,he),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,ln),$.pixelStorei($.UNPACK_SKIP_PIXELS,Mr),$.pixelStorei($.UNPACK_SKIP_ROWS,kn),$.pixelStorei($.UNPACK_SKIP_IMAGES,ai),ut===0&&dt.generateMipmaps&&$.generateMipmap(fe),St.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),St.unbindTexture()},this.resetState=function(){z=0,U=0,D=null,St.reset(),G.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return bs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Wy?"display-p3":"srgb",e.unpackColorSpace=In.workingColorSpace===Ip?"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}},Ey=class extends xy{};Ey.prototype.isWebGL1Renderer=!0;var Sp=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=Q0,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=As()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return AT("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=As()),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=As()),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}}},_i=new at,Uc=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++)_i.fromBufferAttribute(this,e),_i.applyMatrix4(t),this.setXYZ(e,_i.x,_i.y,_i.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)_i.fromBufferAttribute(this,e),_i.applyNormalMatrix(t),this.setXYZ(e,_i.x,_i.y,_i.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)_i.fromBufferAttribute(this,e),_i.transformDirection(t),this.setXYZ(e,_i.x,_i.y,_i.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=Yo(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Cn(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=Cn(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Cn(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Cn(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Cn(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=Yo(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Yo(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Yo(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Yo(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Cn(e,this.array),i=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(s,this.array),u=Cn(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 Yn(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}}},wy=class extends ja{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new fn(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}},Qs,Cc=new at,tl=new at,el=new at,nl=new Ht,Ic=new Ht,DT=new ir,Zh=new at,Pc=new at,Jh=new at,uT=new Ht,V0=new Ht,lT=new Ht,Sy=class extends Co{constructor(t=new wy){if(super(),this.isSprite=!0,this.type="Sprite",Qs===void 0){Qs=new Ri;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 Sp(e,5);Qs.setIndex([0,1,2,0,2,3]),Qs.setAttribute("position",new Uc(i,3,0,!1)),Qs.setAttribute("uv",new Uc(i,2,3,!1))}this.geometry=Qs,this.material=t,this.center=new Ht(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),tl.setFromMatrixScale(this.matrixWorld),DT.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),el.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&tl.multiplyScalar(-el.z);let i=this.material.rotation,s,u;i!==0&&(u=Math.cos(i),s=Math.sin(i));let c=this.center;jh(Zh.set(-.5,-.5,0),el,c,tl,s,u),jh(Pc.set(.5,-.5,0),el,c,tl,s,u),jh(Jh.set(.5,.5,0),el,c,tl,s,u),uT.set(0,0),V0.set(1,0),lT.set(1,1);let f=t.ray.intersectTriangle(Zh,Pc,Jh,!1,Cc);if(f===null&&(jh(Pc.set(-.5,.5,0),el,c,tl,s,u),V0.set(0,1),f=t.ray.intersectTriangle(Zh,Jh,Pc,!1,Cc),f===null))return;let p=t.ray.origin.distanceTo(Cc);p<t.near||p>t.far||e.push({distance:p,point:Cc.clone(),uv:Wa.getInterpolation(Cc,Zh,Pc,Jh,uT,V0,lT,new Ht),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}};Sy.Dispose=function(){Qs.dispose(),Qs=void 0};function jh(n,t,e,i,s,u){nl.subVectors(n,e).addScalar(.5).multiply(i),s!==void 0?(Ic.x=u*nl.x-s*nl.y,Ic.y=s*nl.x+u*nl.y):Ic.copy(nl),n.copy(t),n.x+=Ic.x,n.y+=Ic.y,n.applyMatrix4(DT)}var io=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 m=i[s],v=i[s+1]-m,E=(c-m)/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 Ht:new at);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 at,s=[],u=[],c=[],f=new at,p=new ir;for(let E=0;E<=t;E++){let M=E/t;s[E]=this.getTangentAt(M,new at)}u[0]=new at,c[0]=new at;let d=Number.MAX_VALUE,m=Math.abs(s[0].x),y=Math.abs(s[0].y),v=Math.abs(s[0].z);m<=d&&(d=m,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(ii(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(ii(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}},Bc=class extends io{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 Ht){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 m=Math.cos(this.aRotation),y=Math.sin(this.aRotation),v=p-this.aX,E=d-this.aY;p=v*m-E*y+this.aX,d=v*y+E*m+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}},My=class extends Bc{constructor(t,e,i,s,u,c){super(t,e,i,i,s,u,c),this.isArcCurve=!0,this.type="ArcCurve"}};function Yy(){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,m,y){let v=(c-u)/d-(f-u)/(d+m)+(f-c)/m,E=(f-c)/m-(p-c)/(m+y)+(p-f)/y;v*=m,E*=m,s(c,f,v,E)},calc:function(u){let c=u*u,f=c*u;return n+t*u+e*c+i*f}}}var Kh=new at,H0=new Yy,W0=new Yy,X0=new Yy,by=class extends io{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 at){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,m;this.closed||f>0?d=s[(f-1)%u]:(Kh.subVectors(s[0],s[1]).add(s[0]),d=Kh);let y=s[f%u],v=s[(f+1)%u];if(this.closed||f+2<u?m=s[(f+2)%u]:(Kh.subVectors(s[u-1],s[u-2]).add(s[u-1]),m=Kh),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(m),E);A<1e-4&&(A=1),M<1e-4&&(M=A),_<1e-4&&(_=A),H0.initNonuniformCatmullRom(d.x,y.x,v.x,m.x,M,A,_),W0.initNonuniformCatmullRom(d.y,y.y,v.y,m.y,M,A,_),X0.initNonuniformCatmullRom(d.z,y.z,v.z,m.z,M,A,_)}else this.curveType==="catmullrom"&&(H0.initCatmullRom(d.x,y.x,v.x,m.x,this.tension),W0.initCatmullRom(d.y,y.y,v.y,m.y,this.tension),X0.initCatmullRom(d.z,y.z,v.z,m.z,this.tension));return i.set(H0.calc(p),W0.calc(p),X0.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 at().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function cT(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 w6(n,t){let e=1-n;return e*e*t}function S6(n,t){return 2*(1-n)*n*t}function M6(n,t){return n*n*t}function Lc(n,t,e,i){return w6(n,t)+S6(n,e)+M6(n,i)}function b6(n,t){let e=1-n;return e*e*e*t}function A6(n,t){let e=1-n;return 3*e*e*n*t}function T6(n,t){return 3*(1-n)*n*n*t}function C6(n,t){return n*n*n*t}function Nc(n,t,e,i,s){return b6(n,t)+A6(n,e)+T6(n,i)+C6(n,s)}var Mp=class extends io{constructor(t=new Ht,e=new Ht,i=new Ht,s=new Ht){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Ht){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(Nc(t,s.x,u.x,c.x,f.x),Nc(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}},Ay=class extends io{constructor(t=new at,e=new at,i=new at,s=new at){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new at){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(Nc(t,s.x,u.x,c.x,f.x),Nc(t,s.y,u.y,c.y,f.y),Nc(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}},bp=class extends io{constructor(t=new Ht,e=new Ht){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ht){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 Ht){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}},Ty=class extends io{constructor(t=new at,e=new at){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new at){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 at){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}},Ap=class extends io{constructor(t=new Ht,e=new Ht,i=new Ht){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ht){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(Lc(t,s.x,u.x,c.x),Lc(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}},Cy=class extends io{constructor(t=new at,e=new at,i=new at){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new at){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(Lc(t,s.x,u.x,c.x),Lc(t,s.y,u.y,c.y),Lc(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}},Tp=class extends io{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ht){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],m=s[c>s.length-2?s.length-1:c+1],y=s[c>s.length-3?s.length-1:c+2];return i.set(cT(f,p.x,d.x,m.x,y.x),cT(f,p.y,d.y,m.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 Ht().fromArray(s))}return this}},Iy=Object.freeze({__proto__:null,ArcCurve:My,CatmullRomCurve3:by,CubicBezierCurve:Mp,CubicBezierCurve3:Ay,EllipseCurve:Bc,LineCurve:bp,LineCurve3:Ty,QuadraticBezierCurve:Ap,QuadraticBezierCurve3:Cy,SplineCurve:Tp}),Py=class extends io{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 Iy[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 m=p[d];i&&i.equals(m)||(e.push(m),i=m)}}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 Iy[s.type]().fromJSON(s))}return this}},pl=class extends Py{constructor(t){super(),this.type="Path",this.currentPoint=new Ht,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 bp(this.currentPoint.clone(),new Ht(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){let u=new Ap(this.currentPoint.clone(),new Ht(t,e),new Ht(i,s));return this.curves.push(u),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,u,c){let f=new Mp(this.currentPoint.clone(),new Ht(t,e),new Ht(i,s),new Ht(u,c));return this.curves.push(f),this.currentPoint.set(u,c),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new Tp(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,m=this.currentPoint.y;return this.absellipse(t+d,e+m,i,s,u,c,f,p),this}absellipse(t,e,i,s,u,c,f,p){let d=new Bc(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 m=d.getPoint(1);return this.currentPoint.copy(m),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 dl=class extends pl{constructor(t){super(t),this.uuid=As(),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 pl().fromJSON(s))}return this}},I6={triangulate:function(n,t,e=2){let i=t&&t.length,s=i?t[0]*e:n.length,u=FT(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;let f,p,d,m,y,v,E;if(i&&(u=O6(n,t,u,e)),n.length>80*e){f=d=n[0],p=m=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>m&&(m=v);E=Math.max(d-f,m-p),E=E!==0?32767/E:0}return zc(u,c,e,f,p,E,0),c}};function FT(n,t,e,i,s){let u,c;if(s===W6(n,t,e,i)>0)for(u=t;u<e;u+=i)c=fT(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=fT(u,n[u],n[u+1],c);return c&&Rp(c,c.next)&&(kc(c),c=c.next),c}function Ka(n,t){if(!n)return n;t||(t=n);let e=n,i;do if(i=!1,!e.steiner&&(Rp(e,e.next)||Jn(e.prev,e,e.next)===0)){if(kc(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function zc(n,t,e,i,s,u,c){if(!n)return;!c&&u&&z6(n,i,s,u);let f=n,p,d;for(;n.prev!==n.next;){if(p=n.prev,d=n.next,u?R6(n,i,s,u):P6(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),kc(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=L6(Ka(n),t,e),zc(n,t,e,i,s,u,2)):c===2&&N6(n,t,e,i,s,u):zc(Ka(n),t,e,i,s,u,1);break}}}function P6(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,m=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>=m&&M.x<=v&&M.y>=y&&M.y<=E&&ol(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 R6(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,m=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=m<y?m<v?m:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=m>y?m>v?m:v:y>v?y:v,x=Ry(E,M,t,e,i),T=Ry(A,_,t,e,i),S=n.prevZ,R=n.nextZ;for(;S&&S.z>=x&&R&&R.z<=T;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&ol(f,m,p,y,d,v,S.x,S.y)&&Jn(S.prev,S,S.next)>=0||(S=S.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&ol(f,m,p,y,d,v,R.x,R.y)&&Jn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;S&&S.z>=x;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&ol(f,m,p,y,d,v,S.x,S.y)&&Jn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&ol(f,m,p,y,d,v,R.x,R.y)&&Jn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function L6(n,t,e){let i=n;do{let s=i.prev,u=i.next.next;!Rp(s,u)&&UT(s,i,i.next,u)&&Gc(s,u)&&Gc(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),kc(i),kc(i.next),i=n=u),i=i.next}while(i!==n);return Ka(i)}function N6(n,t,e,i,s,u){let c=n;do{let f=c.next.next;for(;f!==c.prev;){if(c.i!==f.i&&q6(c,f)){let p=BT(c,f);c=Ka(c,c.next),p=Ka(p,p.next),zc(c,t,e,i,s,u,0),zc(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function O6(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=FT(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(k6(d));for(s.sort(D6),u=0;u<s.length;u++)e=F6(s[u],e);return e}function D6(n,t){return n.x-t.x}function F6(n,t){let e=U6(n,t);if(!e)return t;let i=BT(e,n);return Ka(i,i.next),Ka(e,e.next)}function U6(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,m=1/0,y;e=s;do u>=e.x&&e.x>=p&&u!==e.x&&ol(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),Gc(e,n)&&(y<m||y===m&&(e.x>s.x||e.x===s.x&&B6(s,e)))&&(s=e,m=y)),e=e.next;while(e!==f);return s}function B6(n,t){return Jn(n.prev,n,t.prev)<0&&Jn(t.next,n,n.next)<0}function z6(n,t,e,i){let s=n;do s.z===0&&(s.z=Ry(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,G6(s)}function G6(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 Ry(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 k6(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 ol(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 q6(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!V6(n,t)&&(Gc(n,t)&&Gc(t,n)&&H6(n,t)&&(Jn(n.prev,n,t.prev)||Jn(n,t.prev,t))||Rp(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 Rp(n,t){return n.x===t.x&&n.y===t.y}function UT(n,t,e,i){let s=tp(Jn(n,t,e)),u=tp(Jn(n,t,i)),c=tp(Jn(e,i,n)),f=tp(Jn(e,i,t));return!!(s!==u&&c!==f||s===0&&Qh(n,e,t)||u===0&&Qh(n,i,t)||c===0&&Qh(e,n,i)||f===0&&Qh(e,t,i))}function Qh(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 tp(n){return n>0?1:n<0?-1:0}function V6(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&&UT(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function Gc(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 H6(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 BT(n,t){let e=new Ly(n.i,n.x,n.y),i=new Ly(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 fT(n,t,e,i){let s=new Ly(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 kc(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 Ly(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 W6(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 oa=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=[];hT(t),pT(i,t);let c=t.length;e.forEach(hT);for(let p=0;p<e.length;p++)s.push(c),c+=e[p].length,pT(i,e[p]);let f=I6.triangulate(i,s);for(let p=0;p<f.length;p+=3)u.push(f.slice(p,p+3));return u}};function hT(n){let t=n.length;t>2&&n[t-1].equals(n[0])&&n.pop()}function pT(n,t){for(let e=0;e<t.length;e++)n.push(t[e].x),n.push(t[e].y)}var ml=class n extends Ri{constructor(t=new dl([new Ht(.5,.5),new Ht(-.5,.5),new Ht(-.5,-.5),new Ht(.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 Wr(s,3)),this.setAttribute("uv",new Wr(u,2)),this.computeVertexNormals();function c(f){let p=[],d=e.curveSegments!==void 0?e.curveSegments:12,m=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:X6,S,R=!1,z,U,D,P;x&&(S=x.getSpacedPoints(m),R=!0,v=!1,z=x.computeFrenetFrames(m,!1),U=new at,D=new at,P=new at),v||(_=0,E=0,M=0,A=0);let ct=f.extractPoints(d),L=ct.shape,W=ct.holes;if(!oa.isClockWise(L)){L=L.reverse();for(let $=0,Ot=W.length;$<Ot;$++){let _t=W[$];oa.isClockWise(_t)&&(W[$]=_t.reverse())}}let Mt=oa.triangulateShape(L,W),Y=L;for(let $=0,Ot=W.length;$<Ot;$++){let _t=W[$];L=L.concat(_t)}function mt($,Ot,_t){return Ot||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().addScaledVector(Ot,_t)}let ft=L.length,vt=Mt.length;function it($,Ot,_t){let Nt,St,Vt,Xt=$.x-Ot.x,Pt=$.y-Ot.y,ee=_t.x-$.x,X=_t.y-$.y,N=Xt*Xt+Pt*Pt,xt=Xt*X-Pt*ee;if(Math.abs(xt)>Number.EPSILON){let wt=Math.sqrt(N),ot=Math.sqrt(ee*ee+X*X),Lt=Ot.x-Pt/wt,ce=Ot.y+Xt/wt,Rt=_t.x-X/ot,Ut=_t.y+ee/ot,Wt=((Rt-Lt)*X-(Ut-ce)*ee)/(Xt*X-Pt*ee);Nt=Lt+Xt*Wt-$.x,St=ce+Pt*Wt-$.y;let j=Nt*Nt+St*St;if(j<=2)return new Ht(Nt,St);Vt=Math.sqrt(j/2)}else{let wt=!1;Xt>Number.EPSILON?ee>Number.EPSILON&&(wt=!0):Xt<-Number.EPSILON?ee<-Number.EPSILON&&(wt=!0):Math.sign(Pt)===Math.sign(X)&&(wt=!0),wt?(Nt=-Pt,St=Xt,Vt=Math.sqrt(N)):(Nt=Xt,St=Pt,Vt=Math.sqrt(N/2))}return new Ht(Nt/Vt,St/Vt)}let lt=[];for(let $=0,Ot=Y.length,_t=Ot-1,Nt=$+1;$<Ot;$++,_t++,Nt++)_t===Ot&&(_t=0),Nt===Ot&&(Nt=0),lt[$]=it(Y[$],Y[_t],Y[Nt]);let H=[],At,It=lt.concat();for(let $=0,Ot=W.length;$<Ot;$++){let _t=W[$];At=[];for(let Nt=0,St=_t.length,Vt=St-1,Xt=Nt+1;Nt<St;Nt++,Vt++,Xt++)Vt===St&&(Vt=0),Xt===St&&(Xt=0),At[Nt]=it(_t[Nt],_t[Vt],_t[Xt]);H.push(At),It=It.concat(At)}for(let $=0;$<_;$++){let Ot=$/_,_t=E*Math.cos(Ot*Math.PI/2),Nt=M*Math.sin(Ot*Math.PI/2)+A;for(let St=0,Vt=Y.length;St<Vt;St++){let Xt=mt(Y[St],lt[St],Nt);$t(Xt.x,Xt.y,-_t)}for(let St=0,Vt=W.length;St<Vt;St++){let Xt=W[St];At=H[St];for(let Pt=0,ee=Xt.length;Pt<ee;Pt++){let X=mt(Xt[Pt],At[Pt],Nt);$t(X.x,X.y,-_t)}}}let jt=M+A;for(let $=0;$<ft;$++){let Ot=v?mt(L[$],It[$],jt):L[$];R?(D.copy(z.normals[0]).multiplyScalar(Ot.x),U.copy(z.binormals[0]).multiplyScalar(Ot.y),P.copy(S[0]).add(D).add(U),$t(P.x,P.y,P.z)):$t(Ot.x,Ot.y,0)}for(let $=1;$<=m;$++)for(let Ot=0;Ot<ft;Ot++){let _t=v?mt(L[Ot],It[Ot],jt):L[Ot];R?(D.copy(z.normals[$]).multiplyScalar(_t.x),U.copy(z.binormals[$]).multiplyScalar(_t.y),P.copy(S[$]).add(D).add(U),$t(P.x,P.y,P.z)):$t(_t.x,_t.y,y/m*$)}for(let $=_-1;$>=0;$--){let Ot=$/_,_t=E*Math.cos(Ot*Math.PI/2),Nt=M*Math.sin(Ot*Math.PI/2)+A;for(let St=0,Vt=Y.length;St<Vt;St++){let Xt=mt(Y[St],lt[St],Nt);$t(Xt.x,Xt.y,y+_t)}for(let St=0,Vt=W.length;St<Vt;St++){let Xt=W[St];At=H[St];for(let Pt=0,ee=Xt.length;Pt<ee;Pt++){let X=mt(Xt[Pt],At[Pt],Nt);R?$t(X.x,X.y+S[m-1].y,S[m-1].x+_t):$t(X.x,X.y,y+_t)}}}nt(),bt();function nt(){let $=s.length/3;if(v){let Ot=0,_t=ft*Ot;for(let Nt=0;Nt<vt;Nt++){let St=Mt[Nt];Ft(St[2]+_t,St[1]+_t,St[0]+_t)}Ot=m+_*2,_t=ft*Ot;for(let Nt=0;Nt<vt;Nt++){let St=Mt[Nt];Ft(St[0]+_t,St[1]+_t,St[2]+_t)}}else{for(let Ot=0;Ot<vt;Ot++){let _t=Mt[Ot];Ft(_t[2],_t[1],_t[0])}for(let Ot=0;Ot<vt;Ot++){let _t=Mt[Ot];Ft(_t[0]+ft*m,_t[1]+ft*m,_t[2]+ft*m)}}i.addGroup($,s.length/3-$,0)}function bt(){let $=s.length/3,Ot=0;qt(Y,Ot),Ot+=Y.length;for(let _t=0,Nt=W.length;_t<Nt;_t++){let St=W[_t];qt(St,Ot),Ot+=St.length}i.addGroup($,s.length/3-$,1)}function qt($,Ot){let _t=$.length;for(;--_t>=0;){let Nt=_t,St=_t-1;St<0&&(St=$.length-1);for(let Vt=0,Xt=m+_*2;Vt<Xt;Vt++){let Pt=ft*Vt,ee=ft*(Vt+1),X=Ot+Nt+Pt,N=Ot+St+Pt,xt=Ot+St+ee,wt=Ot+Nt+ee;zt(X,N,xt,wt)}}}function $t($,Ot,_t){p.push($),p.push(Ot),p.push(_t)}function Ft($,Ot,_t){Ct($),Ct(Ot),Ct(_t);let Nt=s.length/3,St=T.generateTopUV(i,s,Nt-3,Nt-2,Nt-1);te(St[0]),te(St[1]),te(St[2])}function zt($,Ot,_t,Nt){Ct($),Ct(Ot),Ct(Nt),Ct(Ot),Ct(_t),Ct(Nt);let St=s.length/3,Vt=T.generateSideWallUV(i,s,St-6,St-3,St-2,St-1);te(Vt[0]),te(Vt[1]),te(Vt[3]),te(Vt[1]),te(Vt[2]),te(Vt[3])}function Ct($){s.push(p[$*3+0]),s.push(p[$*3+1]),s.push(p[$*3+2])}function te($){u.push($.x),u.push($.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 Y6(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 Iy[s.type]().fromJSON(s)),new n(i,t.options)}},X6={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],m=t[s*3+1];return[new Ht(u,c),new Ht(f,p),new Ht(d,m)]},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],m=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-m)<Math.abs(c-d)?[new Ht(c,1-p),new Ht(d,1-y),new Ht(v,1-M),new Ht(A,1-x)]:[new Ht(f,1-p),new Ht(m,1-y),new Ht(E,1-M),new Ht(_,1-x)]}};function Y6(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 qc=class n extends Ri{constructor(t=new dl([new Ht(0,.5),new Ht(-.5,-.5),new Ht(.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 m=0;m<t.length;m++)d(t[m]),this.addGroup(f,p,m),f+=p,p=0;this.setIndex(i),this.setAttribute("position",new Wr(s,3)),this.setAttribute("normal",new Wr(u,3)),this.setAttribute("uv",new Wr(c,2));function d(m){let y=s.length/3,v=m.extractPoints(e),E=v.shape,M=v.holes;oa.isClockWise(E)===!1&&(E=E.reverse());for(let _=0,x=M.length;_<x;_++){let T=M[_];oa.isClockWise(T)===!0&&(M[_]=T.reverse())}let A=oa.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[_],S=T[0]+y,R=T[1]+y,z=T[2]+y;i.push(S,R,z),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 $6(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 $6(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}function ep(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 Z6(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var gl=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_(){}},Ny=class extends gl{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:yA,endingEnd:yA}}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 vA:u=t,f=2*e-i;break;case _A: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 vA:c=t,p=2*i-e;break;case _A:c=1,p=i+s[1]-s[0];break;default:c=t-1,p=e}let d=(i-e)*.5,m=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-i),this._offsetPrev=u*m,this._offsetNext=c*m}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,m=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,S=(-1-E)*_+(1.5+E)*A+.5*M,R=E*_-E*A;for(let z=0;z!==f;++z)u[z]=x*c[m+z]+T*c[d+z]+S*c[p+z]+R*c[y+z];return u}},Oy=class extends gl{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,m=(i-e)/(s-e),y=1-m;for(let v=0;v!==f;++v)u[v]=c[d+v]*y+c[p+v]*m;return u}},Dy=class extends gl{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}},Io=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=ep(e,this.TimeBufferType),this.values=ep(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:ep(t.times,Array),values:ep(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(i.interpolation=s)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Dy(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Oy(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ny(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case rp:e=this.InterpolantFactoryMethodDiscrete;break;case ip:e=this.InterpolantFactoryMethodLinear;break;case g0: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 rp;case this.InterpolantFactoryMethodLinear:return ip;case this.InterpolantFactoryMethodSmooth:return g0}}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&&Z6(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()===g0,u=t.length-1,c=1;for(let f=1;f<u;++f){let p=!1,d=t[f],m=t[f+1];if(d!==m&&(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}};Io.prototype.TimeBufferType=Float32Array;Io.prototype.ValueBufferType=Float32Array;Io.prototype.DefaultInterpolation=ip;var Qa=class extends Io{};Qa.prototype.ValueTypeName="bool";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=rp;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;var Fy=class extends Io{};Fy.prototype.ValueTypeName="color";var Uy=class extends Io{};Uy.prototype.ValueTypeName="number";var By=class extends gl{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 m=d+f;d!==m;d+=4)Cs.slerpFlat(u,0,c,d-f,c,d,p);return u}},Vc=class extends Io{InterpolantFactoryMethodLinear(t){return new By(this.times,this.values,this.getValueSize(),t)}};Vc.prototype.ValueTypeName="quaternion";Vc.prototype.DefaultInterpolation=ip;Vc.prototype.InterpolantFactoryMethodSmooth=void 0;var tu=class extends Io{};tu.prototype.ValueTypeName="string";tu.prototype.ValueBufferType=Array;tu.prototype.DefaultInterpolation=rp;tu.prototype.InterpolantFactoryMethodLinear=void 0;tu.prototype.InterpolantFactoryMethodSmooth=void 0;var zy=class extends Io{};zy.prototype.ValueTypeName="vector";var Gy=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(m){f++,u===!1&&s.onStart!==void 0&&s.onStart(m,c,f),u=!0},this.itemEnd=function(m){c++,s.onProgress!==void 0&&s.onProgress(m,c,f),c===f&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(m){s.onError!==void 0&&s.onError(m)},this.resolveURL=function(m){return p?p(m):m},this.setURLModifier=function(m){return p=m,this},this.addHandler=function(m,y){return d.push(m,y),this},this.removeHandler=function(m){let y=d.indexOf(m);return y!==-1&&d.splice(y,2),this},this.getHandler=function(m){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(m))return M}return null}}},J6=new Gy,ky=class{constructor(t){this.manager=t!==void 0?t:J6,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}};ky.DEFAULT_MATERIAL_NAME="__DEFAULT";var $y="\\[\\]\\.:\\/",j6=new RegExp("["+$y+"]","g"),Zy="[^"+$y+"]",K6="[^"+$y.replace("\\.","")+"]",Q6=/((?:WC+[\/:])*)/.source.replace("WC",Zy),t8=/(WCOD+)?/.source.replace("WCOD",K6),e8=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Zy),n8=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Zy),r8=new RegExp("^"+Q6+t8+e8+n8+"$"),i8=["material","materials","bones","map"],qy=class{constructor(t,e,i){let s=i||Xn.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()}},Xn=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(j6,"")}static parseTrackName(t){let e=r8.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);i8.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 m=0;m<t.length;m++)if(t[m].name===d){d=m;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[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}};Xn.Composite=qy;Xn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Xn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Xn.prototype.GetterByBindingType=[Xn.prototype._getValue_direct,Xn.prototype._getValue_array,Xn.prototype._getValue_arrayElement,Xn.prototype._getValue_toArray];Xn.prototype.SetterByBindingTypeAndVersioning=[[Xn.prototype._setValue_direct,Xn.prototype._setValue_direct_setNeedsUpdate,Xn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Xn.prototype._setValue_array,Xn.prototype._setValue_array_setNeedsUpdate,Xn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Xn.prototype._setValue_arrayElement,Xn.prototype._setValue_arrayElement_setNeedsUpdate,Xn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Xn.prototype._setValue_fromArray,Xn.prototype._setValue_fromArray_setNeedsUpdate,Xn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var nQ=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vy}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vy);var yQ=ue(av(),1),vQ=ue(Qf(),1);function vl(n,t){t===void 0&&(t=[]);let e=new dl(n.map(i=>new Ht(...i)));return t.length&&t.forEach(i=>{var s=new pl(i.map(u=>new Ht(...u)));e.holes.push(s)}),e}var Or=63710088e-1,IQ={centimeters:Or*100,centimetres:Or*100,degrees:Or/111325,feet:Or*3.28084,inches:Or*39.37,kilometers:Or/1e3,kilometres:Or/1e3,meters:Or,metres:Or,miles:Or/1609.344,millimeters:Or*1e3,millimetres:Or*1e3,nauticalmiles:Or/1852,radians:1,yards:Or*1.0936},PQ={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/Or,yards:1.0936133};function wi(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 zn(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(!Zo(n[0])||!Zo(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return wi(i,t,e)}function Gn(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 wi(f,t,e)}function Dr(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 wi(i,t,e)}function gv(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return wi(i,t,e)}function Zo(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function _r(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,m=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 S=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var z=c.type;switch(m=e&&(z==="Polygon"||z==="MultiPolygon")?1:0,z){case null:break;case"Point":if(t(p,y,x,S,R)===!1)return!1;y++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,S,R)===!1)return!1;y++,z==="MultiPoint"&&S++}z==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-m;s++){if(t(p[i][s],y,x,S,R)===!1)return!1;y++}z==="MultiLineString"&&S++,z==="Polygon"&&R++}z==="Polygon"&&S++;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-m;u++){if(t(p[i][s][u],y,x,S,R)===!1)return!1;y++}R++}S++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(_r(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function LC(n,t,e,i){var s=e;return _r(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 la(n,t){var e,i,s,u,c,f,p,d,m,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:{},m=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,m,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,m,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,m,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Wi(n,t){la(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(wi(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 m=e.coordinates[d],y={type:p,coordinates:m};if(t(wi(y,s),i,d)===!1)return!1}})}function yv(n){var t=[1/0,1/0,-1/0,-1/0];return _r(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}yv.default=yv;var Si=yv;function Xr(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 vv(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 Yr(n){return n.type==="Feature"?n.geometry:n}var EW=ue(Gp(),1);var RW=ue(JC(),1);function Fr(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=Xr(n),s=Yr(t),u=s.type,c=t.bbox,f=s.coordinates;if(c&&LW(i,c)===!1)return!1;u==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(jC(i,f[d][0],e.ignoreBoundary)){for(var m=!1,y=1;y<f[d].length&&!m;)jC(i,f[d][y],!e.ignoreBoundary)&&(m=!0),y++;m||(p=!0)}return p}function jC(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],m=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(m)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 LW(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var tI=new ArrayBuffer(16),oet=new Float64Array(tI),set=new Uint32Array(tI);var YW=ue(Ov(),1);var Ont=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 $W(u,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function $W(n,t,e,i,s){var u=ZW(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 ZW(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 Jc(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 Gn([[c,d,p,f,c]],t.properties,{bbox:n,id:t.id})}function JW(n){return Jc(Si(n))}var Dv=JW;var pX=ue(fI(),1);var GX=ue(rd(),1);var qX=ue(Gp(),1);var WX=ue(Ov(),1);var II=Math.PI/180,PI=180/Math.PI,rf=function(n,t){this.lon=n,this.lat=t,this.x=II*n,this.y=II*t};rf.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};rf.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new rf(t,n)};var RI=function(){this.coords=[],this.length=0};RI.prototype.move_to=function(n){this.length++,this.coords.push(n)};var e_=function(n){this.properties=n||{},this.geometries=[]};e_.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}};e_.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 LI=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 rf(n.x,n.y),this.end=new rf(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)};LI.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=PI*Math.atan2(u,Math.sqrt(Math.pow(i,2)+Math.pow(s,2))),f=PI*Math.atan2(s,i);return[f,c]};LI.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,m=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>m&&M<y||M>m&&A<y)?f=!0:_>p&&(p=_)}var x=[];if(f&&p<d){var T=[];x.push(T);for(var S=0;S<e.length;++S){var R=parseFloat(e[S][0]);if(S>0&&Math.abs(R-e[S-1][0])>v){var z=parseFloat(e[S-1][0]),U=parseFloat(e[S-1][1]),D=parseFloat(e[S][0]),P=parseFloat(e[S][1]);if(z>-180&&z<y&&D===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<y){T.push([-180,e[S][1]]),S++,T.push([e[S][0],e[S][1]]);continue}else if(z>m&&z<180&&D===-180&&S+1<e.length&&e[S-1][0]>m&&e[S-1][0]<180){T.push([180,e[S][1]]),S++,T.push([e[S][0],e[S][1]]);continue}if(z<y&&D>m){var ct=z;z=D,D=ct;var L=U;U=P,P=L}if(z>m&&D<y&&(D+=360),z<=180&&D>=180&&z<D){var W=(180-z)/(D-z),V=W*P+(1-W)*U;T.push([e[S-1][0]>m?180:-180,V]),T=[],T.push([e[S-1][0]>m?-180:180,V]),x.push(T)}else T=[],x.push(T);T.push([R,e[S][1]])}else T.push([e[S][0],e[S][1]])}}else{var Mt=[];x.push(Mt);for(var Y=0;Y<e.length;++Y)Mt.push([e[Y][0],e[Y][1]])}for(var mt=new e_(this.properties),ft=0;ft<x.length;++ft){var vt=new RI;mt.geometries.push(vt);for(var it=x[ft],lt=0;lt<it.length;++lt)vt.move_to(it[lt])}return mt};var $X=ue(rd(),1);var Y7=ue(rd(),1);var $7=ue(I_(),1);var j7=ue(Gp(),1);var Te=[],Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[],$e=[],Ze=[],Je=[];Ne[85]=Fe[85]=-1;Oe[85]=Ue[85]=0;De[85]=Be[85]=1;We[85]=$e[85]=1;Xe[85]=Ze[85]=0;Ye[85]=Je[85]=1;Te[85]=Pe[85]=0;Ce[85]=Re[85]=-1;Ie[85]=ke[85]=0;qe[85]=ze[85]=0;Ve[85]=Ge[85]=1;Le[85]=He[85]=1;$e[1]=$e[169]=0;Ze[1]=Ze[169]=-1;Je[1]=Je[169]=0;ze[1]=ze[169]=-1;Ge[1]=Ge[169]=0;ke[1]=ke[169]=0;Fe[4]=Fe[166]=0;Ue[4]=Ue[166]=-1;Be[4]=Be[166]=1;qe[4]=qe[166]=1;Ve[4]=Ve[166]=0;He[4]=He[166]=0;Ne[16]=Ne[154]=0;Oe[16]=Oe[154]=1;De[16]=De[154]=1;Pe[16]=Pe[154]=1;Re[16]=Re[154]=0;Le[16]=Le[154]=1;We[64]=We[106]=0;Xe[64]=Xe[106]=1;Ye[64]=Ye[106]=0;Te[64]=Te[106]=-1;Ce[64]=Ce[106]=0;Ie[64]=Ie[106]=1;We[2]=We[168]=0;Xe[2]=Xe[168]=-1;Ye[2]=Ye[168]=1;$e[2]=$e[168]=0;Ze[2]=Ze[168]=-1;Je[2]=Je[168]=0;ze[2]=ze[168]=-1;Ge[2]=Ge[168]=0;ke[2]=ke[168]=0;qe[2]=qe[168]=-1;Ve[2]=Ve[168]=0;He[2]=He[168]=1;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=-1;De[8]=De[162]=0;Fe[8]=Fe[162]=0;Ue[8]=Ue[162]=-1;Be[8]=Be[162]=1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=0;ke[8]=ke[162]=1;qe[8]=qe[162]=1;Ve[8]=Ve[162]=0;He[8]=He[162]=0;Ne[32]=Ne[138]=0;Oe[32]=Oe[138]=1;De[32]=De[138]=1;Fe[32]=Fe[138]=0;Ue[32]=Ue[138]=1;Be[32]=Be[138]=0;Te[32]=Te[138]=1;Ce[32]=Ce[138]=0;Ie[32]=Ie[138]=0;Pe[32]=Pe[138]=1;Re[32]=Re[138]=0;Le[32]=Le[138]=1;$e[128]=$e[42]=0;Ze[128]=Ze[42]=1;Je[128]=Je[42]=1;We[128]=We[42]=0;Xe[128]=Xe[42]=1;Ye[128]=Ye[42]=0;Te[128]=Te[42]=-1;Ce[128]=Ce[42]=0;Ie[128]=Ie[42]=1;Pe[128]=Pe[42]=-1;Re[128]=Re[42]=0;Le[128]=Le[42]=0;Fe[5]=Fe[165]=-1;Ue[5]=Ue[165]=0;Be[5]=Be[165]=0;$e[5]=$e[165]=1;Ze[5]=Ze[165]=0;Je[5]=Je[165]=0;qe[20]=qe[150]=0;Ve[20]=Ve[150]=1;He[20]=He[150]=1;Pe[20]=Pe[150]=0;Re[20]=Re[150]=-1;Le[20]=Le[150]=1;Ne[80]=Ne[90]=-1;Oe[80]=Oe[90]=0;De[80]=De[90]=1;We[80]=We[90]=1;Xe[80]=Xe[90]=0;Ye[80]=Ye[90]=1;ze[65]=ze[105]=0;Ge[65]=Ge[105]=1;ke[65]=ke[105]=0;Te[65]=Te[105]=0;Ce[65]=Ce[105]=-1;Ie[65]=Ie[105]=0;Ne[160]=Ne[10]=-1;Oe[160]=Oe[10]=0;De[160]=De[10]=1;Fe[160]=Fe[10]=-1;Ue[160]=Ue[10]=0;Be[160]=Be[10]=0;$e[160]=$e[10]=1;Ze[160]=Ze[10]=0;Je[160]=Je[10]=0;We[160]=We[10]=1;Xe[160]=Xe[10]=0;Ye[160]=Ye[10]=1;qe[130]=qe[40]=0;Ve[130]=Ve[40]=1;He[130]=He[40]=1;ze[130]=ze[40]=0;Ge[130]=Ge[40]=1;ke[130]=ke[40]=0;Te[130]=Te[40]=0;Ce[130]=Ce[40]=-1;Ie[130]=Ie[40]=0;Pe[130]=Pe[40]=0;Re[130]=Re[40]=-1;Le[130]=Le[40]=1;Fe[37]=Fe[133]=0;Ue[37]=Ue[133]=1;Be[37]=Be[133]=1;$e[37]=$e[133]=0;Ze[37]=Ze[133]=1;Je[37]=Je[133]=0;Te[37]=Te[133]=-1;Ce[37]=Ce[133]=0;Ie[37]=Ie[133]=0;Pe[37]=Pe[133]=1;Re[37]=Re[133]=0;Le[37]=Le[133]=0;qe[148]=qe[22]=-1;Ve[148]=Ve[22]=0;He[148]=He[22]=0;$e[148]=$e[22]=0;Ze[148]=Ze[22]=-1;Je[148]=Je[22]=1;We[148]=We[22]=0;Xe[148]=Xe[22]=1;Ye[148]=Ye[22]=1;Pe[148]=Pe[22]=-1;Re[148]=Re[22]=0;Le[148]=Le[22]=1;Ne[82]=Ne[88]=0;Oe[82]=Oe[88]=-1;De[82]=De[88]=1;qe[82]=qe[88]=1;Ve[82]=Ve[88]=0;He[82]=He[88]=1;ze[82]=ze[88]=-1;Ge[82]=Ge[88]=0;ke[82]=ke[88]=1;We[82]=We[88]=0;Xe[82]=Xe[88]=-1;Ye[82]=Ye[88]=0;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=1;De[73]=De[97]=0;Fe[73]=Fe[97]=0;Ue[73]=Ue[97]=-1;Be[73]=Be[97]=0;ze[73]=ze[97]=1;Ge[73]=Ge[97]=0;ke[73]=ke[97]=0;Te[73]=Te[97]=1;Ce[73]=Ce[97]=0;Ie[73]=Ie[97]=1;Ne[145]=Ne[25]=0;Oe[145]=Oe[25]=-1;De[145]=De[25]=0;ze[145]=ze[25]=1;Ge[145]=Ge[25]=0;ke[145]=ke[25]=1;$e[145]=$e[25]=0;Ze[145]=Ze[25]=1;Je[145]=Je[25]=1;Pe[145]=Pe[25]=-1;Re[145]=Re[25]=0;Le[145]=Le[25]=0;Fe[70]=Fe[100]=0;Ue[70]=Ue[100]=1;Be[70]=Be[100]=0;qe[70]=qe[100]=-1;Ve[70]=Ve[100]=0;He[70]=He[100]=1;We[70]=We[100]=0;Xe[70]=Xe[100]=-1;Ye[70]=Ye[100]=1;Te[70]=Te[100]=1;Ce[70]=Ce[100]=0;Ie[70]=Ie[100]=0;Fe[101]=Fe[69]=0;Ue[101]=Ue[69]=1;Be[101]=Be[69]=0;Te[101]=Te[69]=1;Ce[101]=Ce[69]=0;Ie[101]=Ie[69]=0;$e[149]=$e[21]=0;Ze[149]=Ze[21]=1;Je[149]=Je[21]=1;Pe[149]=Pe[21]=-1;Re[149]=Re[21]=0;Le[149]=Le[21]=0;qe[86]=qe[84]=-1;Ve[86]=Ve[84]=0;He[86]=He[84]=1;We[86]=We[84]=0;Xe[86]=Xe[84]=-1;Ye[86]=Ye[84]=1;Ne[89]=Ne[81]=0;Oe[89]=Oe[81]=-1;De[89]=De[81]=0;ze[89]=ze[81]=1;Ge[89]=Ge[81]=0;ke[89]=ke[81]=1;Ne[96]=Ne[74]=0;Oe[96]=Oe[74]=1;De[96]=De[74]=0;Fe[96]=Fe[74]=-1;Ue[96]=Ue[74]=0;Be[96]=Be[74]=1;We[96]=We[74]=1;Xe[96]=Xe[74]=0;Ye[96]=Ye[74]=0;Te[96]=Te[74]=1;Ce[96]=Ce[74]=0;Ie[96]=Ie[74]=1;Ne[24]=Ne[146]=0;Oe[24]=Oe[146]=-1;De[24]=De[146]=1;qe[24]=qe[146]=1;Ve[24]=Ve[146]=0;He[24]=He[146]=1;ze[24]=ze[146]=0;Ge[24]=Ge[146]=1;ke[24]=ke[146]=1;Pe[24]=Pe[146]=0;Re[24]=Re[146]=-1;Le[24]=Le[146]=0;Fe[6]=Fe[164]=-1;Ue[6]=Ue[164]=0;Be[6]=Be[164]=1;qe[6]=qe[164]=-1;Ve[6]=Ve[164]=0;He[6]=He[164]=0;$e[6]=$e[164]=0;Ze[6]=Ze[164]=-1;Je[6]=Je[164]=1;We[6]=We[164]=1;Xe[6]=Xe[164]=0;Ye[6]=Ye[164]=0;ze[129]=ze[41]=0;Ge[129]=Ge[41]=1;ke[129]=ke[41]=1;$e[129]=$e[41]=0;Ze[129]=Ze[41]=1;Je[129]=Je[41]=0;Te[129]=Te[41]=-1;Ce[129]=Ce[41]=0;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=0;Re[129]=Re[41]=-1;Le[129]=Le[41]=0;qe[66]=qe[104]=0;Ve[66]=Ve[104]=1;He[66]=He[104]=0;ze[66]=ze[104]=-1;Ge[66]=Ge[104]=0;ke[66]=ke[104]=1;We[66]=We[104]=0;Xe[66]=Xe[104]=-1;Ye[66]=Ye[104]=0;Te[66]=Te[104]=0;Ce[66]=Ce[104]=-1;Ie[66]=Ie[104]=1;Ne[144]=Ne[26]=-1;Oe[144]=Oe[26]=0;De[144]=De[26]=0;$e[144]=$e[26]=1;Ze[144]=Ze[26]=0;Je[144]=Je[26]=1;We[144]=We[26]=0;Xe[144]=Xe[26]=1;Ye[144]=Ye[26]=1;Pe[144]=Pe[26]=-1;Re[144]=Re[26]=0;Le[144]=Le[26]=1;Fe[36]=Fe[134]=0;Ue[36]=Ue[134]=1;Be[36]=Be[134]=1;qe[36]=qe[134]=0;Ve[36]=Ve[134]=1;He[36]=He[134]=0;Te[36]=Te[134]=0;Ce[36]=Ce[134]=-1;Ie[36]=Ie[134]=1;Pe[36]=Pe[134]=1;Re[36]=Re[134]=0;Le[36]=Le[134]=0;Ne[9]=Ne[161]=-1;Oe[9]=Oe[161]=0;De[9]=De[161]=0;Fe[9]=Fe[161]=0;Ue[9]=Ue[161]=-1;Be[9]=Be[161]=0;ze[9]=ze[161]=1;Ge[9]=Ge[161]=0;ke[9]=ke[161]=0;$e[9]=$e[161]=1;Ze[9]=Ze[161]=0;Je[9]=Je[161]=1;Ne[136]=0;Oe[136]=1;De[136]=1;Fe[136]=0;Ue[136]=1;Be[136]=0;qe[136]=-1;Ve[136]=0;He[136]=1;ze[136]=-1;Ge[136]=0;ke[136]=0;$e[136]=0;Ze[136]=-1;Je[136]=0;We[136]=0;Xe[136]=-1;Ye[136]=1;Te[136]=1;Ce[136]=0;Ie[136]=0;Pe[136]=1;Re[136]=0;Le[136]=1;Ne[34]=0;Oe[34]=-1;De[34]=0;Fe[34]=0;Ue[34]=-1;Be[34]=1;qe[34]=1;Ve[34]=0;He[34]=0;ze[34]=1;Ge[34]=0;ke[34]=1;$e[34]=0;Ze[34]=1;Je[34]=1;We[34]=0;Xe[34]=1;Ye[34]=0;Te[34]=-1;Ce[34]=0;Ie[34]=1;Pe[34]=-1;Re[34]=0;Le[34]=0;Ne[35]=0;Oe[35]=1;De[35]=1;Fe[35]=0;Ue[35]=-1;Be[35]=1;qe[35]=1;Ve[35]=0;He[35]=0;ze[35]=-1;Ge[35]=0;ke[35]=0;$e[35]=0;Ze[35]=-1;Je[35]=0;We[35]=0;Xe[35]=1;Ye[35]=0;Te[35]=-1;Ce[35]=0;Ie[35]=1;Pe[35]=1;Re[35]=0;Le[35]=1;Ne[153]=0;Oe[153]=1;De[153]=1;ze[153]=-1;Ge[153]=0;ke[153]=0;$e[153]=0;Ze[153]=-1;Je[153]=0;Pe[153]=1;Re[153]=0;Le[153]=1;Fe[102]=0;Ue[102]=-1;Be[102]=1;qe[102]=1;Ve[102]=0;He[102]=0;We[102]=0;Xe[102]=1;Ye[102]=0;Te[102]=-1;Ce[102]=0;Ie[102]=1;Ne[155]=0;Oe[155]=-1;De[155]=0;ze[155]=1;Ge[155]=0;ke[155]=1;$e[155]=0;Ze[155]=1;Je[155]=1;Pe[155]=-1;Re[155]=0;Le[155]=0;Fe[103]=0;Ue[103]=1;Be[103]=0;qe[103]=-1;Ve[103]=0;He[103]=1;We[103]=0;Xe[103]=-1;Ye[103]=1;Te[103]=1;Ce[103]=0;Ie[103]=0;Ne[152]=0;Oe[152]=1;De[152]=1;qe[152]=-1;Ve[152]=0;He[152]=1;ze[152]=-1;Ge[152]=0;ke[152]=0;$e[152]=0;Ze[152]=-1;Je[152]=0;We[152]=0;Xe[152]=-1;Ye[152]=1;Pe[152]=1;Re[152]=0;Le[152]=1;Ne[156]=0;Oe[156]=-1;De[156]=1;qe[156]=1;Ve[156]=0;He[156]=1;ze[156]=-1;Ge[156]=0;ke[156]=0;$e[156]=0;Ze[156]=-1;Je[156]=0;We[156]=0;Xe[156]=1;Ye[156]=1;Pe[156]=-1;Re[156]=0;Le[156]=1;Ne[137]=0;Oe[137]=1;De[137]=1;Fe[137]=0;Ue[137]=1;Be[137]=0;ze[137]=-1;Ge[137]=0;ke[137]=0;$e[137]=0;Ze[137]=-1;Je[137]=0;Te[137]=1;Ce[137]=0;Ie[137]=0;Pe[137]=1;Re[137]=0;Le[137]=1;Ne[139]=0;Oe[139]=1;De[139]=1;Fe[139]=0;Ue[139]=-1;Be[139]=0;ze[139]=1;Ge[139]=0;ke[139]=0;$e[139]=0;Ze[139]=1;Je[139]=0;Te[139]=-1;Ce[139]=0;Ie[139]=0;Pe[139]=1;Re[139]=0;Le[139]=1;Ne[98]=0;Oe[98]=-1;De[98]=0;Fe[98]=0;Ue[98]=-1;Be[98]=1;qe[98]=1;Ve[98]=0;He[98]=0;ze[98]=1;Ge[98]=0;ke[98]=1;We[98]=0;Xe[98]=1;Ye[98]=0;Te[98]=-1;Ce[98]=0;Ie[98]=1;Ne[99]=0;Oe[99]=1;De[99]=0;Fe[99]=0;Ue[99]=-1;Be[99]=1;qe[99]=1;Ve[99]=0;He[99]=0;ze[99]=-1;Ge[99]=0;ke[99]=1;We[99]=0;Xe[99]=-1;Ye[99]=0;Te[99]=1;Ce[99]=0;Ie[99]=1;Fe[38]=0;Ue[38]=-1;Be[38]=1;qe[38]=1;Ve[38]=0;He[38]=0;$e[38]=0;Ze[38]=1;Je[38]=1;We[38]=0;Xe[38]=1;Ye[38]=0;Te[38]=-1;Ce[38]=0;Ie[38]=1;Pe[38]=-1;Re[38]=0;Le[38]=0;Fe[39]=0;Ue[39]=1;Be[39]=1;qe[39]=-1;Ve[39]=0;He[39]=0;$e[39]=0;Ze[39]=-1;Je[39]=1;We[39]=0;Xe[39]=1;Ye[39]=0;Te[39]=-1;Ce[39]=0;Ie[39]=1;Pe[39]=1;Re[39]=0;Le[39]=0;var P_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},R_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},L_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},N_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},O_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},D_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},F_=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},U_=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},K7=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},Q7=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},tY=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},eY=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},nY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},rY=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},iY=function(){return[[0,0],[0,1],[1,1],[1,0]]},oY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},sY=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},aY=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},uY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},lY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},cY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},fY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},hY=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},pY=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},dY=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},mY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},gY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},yY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},vY=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},_Y=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},xY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},EY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},wY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},SY=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]]},MY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},bY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},AY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},TY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},CY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},IY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},tn=[],en=[],nn=[],rn=[],on=[],sn=[],an=[],un=[];rn[1]=on[1]=18;rn[169]=on[169]=18;nn[4]=en[4]=12;nn[166]=en[166]=12;tn[16]=un[16]=4;tn[154]=un[154]=4;sn[64]=an[64]=22;sn[106]=an[106]=22;nn[2]=sn[2]=17;rn[2]=on[2]=18;nn[168]=sn[168]=17;rn[168]=on[168]=18;tn[8]=rn[8]=9;en[8]=nn[8]=12;tn[162]=rn[162]=9;en[162]=nn[162]=12;tn[32]=un[32]=4;en[32]=an[32]=1;tn[138]=un[138]=4;en[138]=an[138]=1;on[128]=un[128]=21;sn[128]=an[128]=22;on[42]=un[42]=21;sn[42]=an[42]=22;en[5]=on[5]=14;en[165]=on[165]=14;nn[20]=un[20]=6;nn[150]=un[150]=6;tn[80]=sn[80]=11;tn[90]=sn[90]=11;rn[65]=an[65]=3;rn[105]=an[105]=3;tn[160]=sn[160]=11;en[160]=on[160]=14;tn[10]=sn[10]=11;en[10]=on[10]=14;nn[130]=un[130]=6;rn[130]=an[130]=3;nn[40]=un[40]=6;rn[40]=an[40]=3;en[101]=an[101]=1;en[69]=an[69]=1;on[149]=un[149]=21;on[21]=un[21]=21;nn[86]=sn[86]=17;nn[84]=sn[84]=17;tn[89]=rn[89]=9;tn[81]=rn[81]=9;tn[96]=an[96]=0;en[96]=sn[96]=15;tn[74]=an[74]=0;en[74]=sn[74]=15;tn[24]=nn[24]=8;rn[24]=un[24]=7;tn[146]=nn[146]=8;rn[146]=un[146]=7;en[6]=sn[6]=15;nn[6]=on[6]=16;en[164]=sn[164]=15;nn[164]=on[164]=16;rn[129]=un[129]=7;on[129]=an[129]=20;rn[41]=un[41]=7;on[41]=an[41]=20;nn[66]=an[66]=2;rn[66]=sn[66]=19;nn[104]=an[104]=2;rn[104]=sn[104]=19;tn[144]=on[144]=10;sn[144]=un[144]=23;tn[26]=on[26]=10;sn[26]=un[26]=23;en[36]=un[36]=5;nn[36]=an[36]=2;en[134]=un[134]=5;nn[134]=an[134]=2;tn[9]=on[9]=10;en[9]=rn[9]=13;tn[161]=on[161]=10;en[161]=rn[161]=13;en[37]=un[37]=5;on[37]=an[37]=20;en[133]=un[133]=5;on[133]=an[133]=20;nn[148]=on[148]=16;sn[148]=un[148]=23;nn[22]=on[22]=16;sn[22]=un[22]=23;tn[82]=nn[82]=8;rn[82]=sn[82]=19;tn[88]=nn[88]=8;rn[88]=sn[88]=19;tn[73]=an[73]=0;en[73]=rn[73]=13;tn[97]=an[97]=0;en[97]=rn[97]=13;tn[145]=rn[145]=9;on[145]=un[145]=21;tn[25]=rn[25]=9;on[25]=un[25]=21;en[70]=an[70]=1;nn[70]=sn[70]=17;en[100]=an[100]=1;nn[100]=sn[100]=17;tn[34]=rn[34]=9;en[34]=nn[34]=12;on[34]=un[34]=21;sn[34]=an[34]=22;tn[136]=un[136]=4;en[136]=an[136]=1;nn[136]=sn[136]=17;rn[136]=on[136]=18;tn[35]=un[35]=4;en[35]=nn[35]=12;rn[35]=on[35]=18;sn[35]=an[35]=22;tn[153]=un[153]=4;rn[153]=on[153]=18;en[102]=nn[102]=12;sn[102]=an[102]=22;tn[155]=rn[155]=9;on[155]=un[155]=23;en[103]=an[103]=1;nn[103]=sn[103]=17;tn[152]=un[152]=4;nn[152]=sn[152]=17;rn[152]=on[152]=18;tn[156]=nn[156]=8;rn[156]=on[156]=18;sn[156]=un[156]=23;tn[137]=un[137]=4;en[137]=an[137]=1;rn[137]=on[137]=18;tn[139]=un[139]=4;en[139]=rn[139]=13;on[139]=an[139]=20;tn[98]=rn[98]=9;en[98]=nn[98]=12;sn[98]=an[98]=22;tn[99]=an[99]=0;en[99]=nn[99]=12;rn[99]=sn[99]=19;en[38]=nn[38]=12;on[38]=un[38]=21;sn[38]=an[38]=22;en[39]=un[39]=5;nn[39]=on[39]=16;sn[39]=an[39]=22;var Yt=[];Yt[1]=Yt[169]=P_;Yt[4]=Yt[166]=R_;Yt[16]=Yt[154]=L_;Yt[64]=Yt[106]=N_;Yt[168]=Yt[2]=O_;Yt[162]=Yt[8]=D_;Yt[138]=Yt[32]=F_;Yt[42]=Yt[128]=U_;Yt[5]=Yt[165]=K7;Yt[20]=Yt[150]=Q7;Yt[80]=Yt[90]=tY;Yt[65]=Yt[105]=eY;Yt[160]=Yt[10]=nY;Yt[130]=Yt[40]=rY;Yt[85]=iY;Yt[101]=Yt[69]=oY;Yt[149]=Yt[21]=sY;Yt[86]=Yt[84]=aY;Yt[89]=Yt[81]=uY;Yt[96]=Yt[74]=lY;Yt[24]=Yt[146]=cY;Yt[6]=Yt[164]=fY;Yt[129]=Yt[41]=hY;Yt[66]=Yt[104]=pY;Yt[144]=Yt[26]=dY;Yt[36]=Yt[134]=mY;Yt[9]=Yt[161]=gY;Yt[37]=Yt[133]=yY;Yt[148]=Yt[22]=vY;Yt[82]=Yt[88]=_Y;Yt[73]=Yt[97]=xY;Yt[145]=Yt[25]=EY;Yt[70]=Yt[100]=wY;Yt[34]=function(n){return[U_(n),D_(n)]};Yt[35]=SY;Yt[136]=function(n){return[F_(n),O_(n)]};Yt[153]=function(n){return[L_(n),P_(n)]};Yt[102]=function(n){return[R_(n),N_(n)]};Yt[155]=MY;Yt[103]=bY;Yt[152]=function(n){return[L_(n),O_(n)]};Yt[156]=AY;Yt[137]=function(n){return[F_(n),P_(n)]};Yt[139]=TY;Yt[98]=function(n){return[D_(n),N_(n)]};Yt[99]=CY;Yt[38]=function(n){return[R_(n),U_(n)]};Yt[39]=IY;function RY(n){return(n>0)-(n<0)||+n}function Dl(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 RY(i*c-u*s)}function _L(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 B_(n,t){return t.geometry.coordinates[0].every(function(e){return Fr(zn(e),n)})}function xL(n,t){return n[0]===t[0]&&n[1]===t[1]}var LY=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=Dl(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}(),z_=LY;var NY=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 Dr([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return Dl(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),EL=NY;var OY=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=Dl(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 gv(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=Gn([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Dv(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()),!_L(f,i)&&B_(f,i)){for(var p=t.map(function(M){return M.from.coordinates}),d=void 0,m=function(M){c.some(function(A){return xL(M,A.from.coordinates)})||(d=M)},y=0,v=p;y<v.length;y++){var E=v[y];m(E)}d&&c.inside(zn(d))&&(!u||B_(s,f))&&(u=c)}}),u},n.prototype.inside=function(t){return Fr(t,this.toPolygon())},n}(),G_=OY;function DY(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 qut=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){DY(t);var e=new n;return Wi(t,function(i){vv(i,"LineString","Graph::fromGeoJson"),LC(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=z_.buildId(t),i=this.nodes[e];return i||(i=this.nodes[e]=new z_(t)),i},n.prototype.addEdge=function(t,e){var i=new EL(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,m=void 0;f.label===e&&(d=f),p.label===e&&(m=p),!(!d||!m)&&(m&&(u=m),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 G_;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 zY=ue(k_(),1);var GY=ue(k_(),1);var qY=ue(PL(),1);var ZY=ue(GL(),1);function qL(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function jY(){return new VL(function(n){return n.f})}var W_={search:function(n,t,e,i){n.cleanDirty(),i=i||{};var s=i.heuristic||W_.heuristics.manhattan,u=i.closest||!1,c=jY(),f=t;for(t.h=s(t,e),c.push(t);c.size()>0;){var p=c.pop();if(p===e)return qL(p);p.closed=!0;for(var d=n.neighbors(p),m=0,y=d.length;m<y;++m){var v=d[m];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?qL(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 pf(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 Pd(e,i,s[i]);this.grid[e][i]=u,this.nodes.push(u)}}this.init()}pf.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)W_.cleanNode(this.nodes[n])};pf.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)W_.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};pf.prototype.markDirty=function(n){this.dirtyNodes.push(n)};pf.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};pf.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 Pd(n,t,e){this.x=n,this.y=t,this.weight=e}Pd.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Pd.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Pd.prototype.isWall=function(){return this.weight===0};function VL(n){this.content=[],this.scoreFunction=n}VL.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],m=this.scoreFunction(d);m<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function X_(){this._=null}function Ul(n){n.U=n.C=n.L=n.R=n.P=n.N=null}X_.prototype={constructor:X_,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=HL(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&&(df(this,e),n=e,e=n.U),e.C=!1,i.C=!0,mf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(mf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,df(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=HL(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,df(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,mf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,df(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,mf(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,df(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,mf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function df(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 mf(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 HL(n){for(;n.L;)n=n.L;return n}var Y_=X_;function Bl(n,t,e,i){var s=[null,null],u=Br.push(s)-1;return s.left=n,s.right=t,e&&gf(s,n,t,e),i&&gf(s,t,n,i),Mi[n.index].halfedges.push(u),Mi[t.index].halfedges.push(u),s}function zl(n,t,e){var i=[t,e];return i.left=n,i}function gf(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 KY(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],m=c[1],y=0,v=1,E=d-f,M=m-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 QY(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],m=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(m+v)/2,A,_;if(v===m){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-m),_=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(m<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 WL(n,t,e,i){for(var s=Br.length,u;s--;)(!QY(u=Br[s],n,t,e,i)||!KY(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Pn||Math.abs(u[0][1]-u[1][1])>Pn))&&delete Br[s]}function XL(n){return Mi[n.index]={site:n,halfedges:[]}}function t$(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 $_(n,t){return t[+(t.left!==n.site)]}function e$(n,t){return t[+(t.left===n.site)]}function YL(){for(var n=0,t=Mi.length,e,i,s,u;n<t;++n)if((e=Mi[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]=t$(e,Br[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 $L(n,t,e,i){var s=Mi.length,u,c,f,p,d,m,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Mi[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)Br[d[p]]||d.splice(p,1);for(p=0,m=d.length;p<m;)M=e$(c,Br[d[p]]),A=M[0],_=M[1],y=$_(c,Br[d[++p%m]]),v=y[0],E=y[1],(Math.abs(A-v)>Pn||Math.abs(_-E)>Pn)&&(d.splice(p,0,Br.push(zl(f,M,Math.abs(A-n)<Pn&&i-_>Pn?[n,Math.abs(v-n)<Pn?E:i]:Math.abs(_-i)<Pn&&e-A>Pn?[Math.abs(E-i)<Pn?v:e,i]:Math.abs(A-e)<Pn&&_-t>Pn?[e,Math.abs(v-e)<Pn?E:t]:Math.abs(_-t)<Pn&&A-n>Pn?[Math.abs(E-t)<Pn?v:n,t]:null))-1),++m);m&&(x=!1)}if(x){var T,S,R,z=1/0;for(u=0,x=null;u<s;++u)(c=Mi[u])&&(f=c.site,T=f[0]-n,S=f[1]-t,R=T*T+S*S,R<z&&(z=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(Br.push(zl(f=x.site,U,D))-1,Br.push(zl(f,D,P))-1,Br.push(zl(f,P,ct))-1,Br.push(zl(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Mi[u])&&(c.halfedges.length||delete Mi[u])}var ZL=[],Rd;function n$(){Ul(this),this.x=this.y=this.arc=this.site=this.cy=null}function ou(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,m=u[0]-c,y=u[1]-f,v=2*(p*y-d*m);if(!(v>=-JL)){var E=p*p+d*d,M=m*m+y*y,A=(y*E-d*M)/v,_=(p*M-m*E)/v,x=ZL.pop()||new n$;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,S=Gl._;S;)if(x.y<S.y||x.y===S.y&&x.x<=S.x)if(S.L)S=S.L;else{T=S.P;break}else if(S.R)S=S.R;else{T=S;break}Gl.insert(T,x),T||(Rd=x)}}}}function su(n){var t=n.circle;t&&(t.P||(Rd=t.N),Gl.remove(t),ZL.push(t),Ul(t),n.circle=null)}var KL=[];function r$(){Ul(this),this.edge=this.site=this.circle=null}function jL(n){var t=KL.pop()||new r$;return t.site=n,t}function Z_(n){su(n),au.remove(n),KL.push(n),Ul(n)}function QL(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];Z_(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Pn&&Math.abs(i-p.circle.cy)<Pn;)u=p.P,f.unshift(p),Z_(p),p=u;f.unshift(p),su(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Pn&&Math.abs(i-d.circle.cy)<Pn;)c=d.N,f.push(d),Z_(d),d=c;f.push(d),su(d);var m=f.length,y;for(y=1;y<m;++y)d=f[y],p=f[y-1],gf(d.edge,p.site,d.site,s);p=f[0],d=f[m-1],d.edge=Bl(p.site,d.site,null,s),ou(p),ou(d)}function tN(n){for(var t=n[0],e=n[1],i,s,u,c,f=au._;f;)if(u=eN(f,e)-t,u>Pn)f=f.L;else if(c=t-i$(f,e),c>Pn){if(!f.R){i=f;break}f=f.R}else{u>-Pn?(i=f.P,s=f):c>-Pn?(i=f,s=f.N):i=s=f;break}XL(n);var p=jL(n);if(au.insert(i,p),!(!i&&!s)){if(i===s){su(i),s=jL(i.site),au.insert(p,s),p.edge=s.edge=Bl(i.site,p.site),ou(i),ou(s);return}if(!s){p.edge=Bl(i.site,p.site);return}su(i),su(s);var d=i.site,m=d[0],y=d[1],v=n[0]-m,E=n[1]-y,M=s.site,A=M[0]-m,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,S=A*A+_*_,R=[(_*T-E*S)/x+m,(v*S-A*T)/x+y];gf(s.edge,d,M,R),p.edge=Bl(d,n,null,R),s.edge=Bl(n,M,null,R),ou(i),ou(s)}}function eN(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 m=f-i,y=1/u-1/d,v=m/d;return y?(-v+Math.sqrt(v*v-2*y*(m*m/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function i$(n,t){var e=n.N;if(e)return eN(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Pn=1e-6,JL=1e-12,au,Mi,Gl,Br;function o$(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function s$(n,t){return t[1]-n[1]||t[0]-n[0]}function Ld(n,t){var e=n.sort(s$).pop(),i,s,u;for(Br=[],Mi=new Array(n.length),au=new Y_,Gl=new Y_;;)if(u=Rd,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(tN(e),i=e[0],s=e[1]),e=n.pop();else if(u)QL(u.arc);else break;if(YL(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];WL(c,f,p,d),$L(c,f,p,d)}this.edges=Br,this.cells=Mi,au=Gl=Br=Mi=null}Ld.prototype={constructor:Ld,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return $_(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]],m=d.left===s?d.right:d.left;++c<f;)p=m,d=t[u[c]],m=d.left===s?d.right:d.left,p&&m&&i<p.index&&i<m.index&&o$(s,p,m)<0&&n.push([s.data,p.data,m.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],m=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;_<m&&(m=_,u=E.index)}});while(u!==null);return i._found=s,e==null||m<=e*e?f.site:null}};var d$=ue(kl(),1);var cx=ue(oN(),1);function Li(){return new Dd}function Dd(){this.reset()}Dd.prototype={constructor:Dd,reset:function(){this.s=this.t=0},add:function(n){sN(Od,n,this.t),sN(this,Od.s,this.s),this.s?this.t+=Od.t:this.s=Od.t},valueOf:function(){return this.s}};var Od=new Dd;function sN(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 An=Math.PI,wr=An/2,Fd=An/4,Qo=An*2,uu=180/An,Ni=An/180,tr=Math.abs,Ro=Math.atan,Oi=Math.atan2,hn=Math.cos;var Ud=Math.exp;var yf=Math.log;var Me=Math.sin;var Zr=Math.sqrt,vf=Math.tan;function K_(n){return n>1?0:n<-1?An:Math.acos(n)}function bi(n){return n>1?wr:n<-1?-wr:Math.asin(n)}function Lo(){}var m$=Li(),Fft=Li();function lu(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function _f(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=Zr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var Xft=Li();function uN(n,t){return[n>An?n-Qo:n<-An?n+Qo:n,t]}uN.invert=uN;function Q_(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Lo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function tx(n,t){return tr(n[0]-t[0])<yn&&tr(n[1]-t[1])<yn}function Bd(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 ex(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(tx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new Bd(_,M,null,!0)),c.push(T.o=new Bd(_,null,T,!1)),u.push(T=new Bd(x,M,null,!1)),c.push(T.o=new Bd(x,null,T,!0))}}),!!u.length){for(c.sort(t),lN(u),lN(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],m,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;m=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=m.length;f<p;++f)s.point((y=m[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(m=v.p.z,f=m.length-1;f>=0;--f)s.point((y=m[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,m=v.z,E=!E}while(!v.v);s.lineEnd()}}}function lN(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 da(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function nx(n){return n.length===1&&(n=v$(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 v$(n){return function(t,e){return da(n(t),e)}}var cN=nx(da),_$=cN.right,x$=cN.left;var fN=Array.prototype,w$=fN.slice,S$=fN.map;var Bht=Math.sqrt(50),zht=Math.sqrt(10),Ght=Math.sqrt(2);function Gd(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 R$=1e9,Sdt=-R$;var rx=Li();function ix(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;rx.reset();for(var f=0,p=n.length;f<p;++f)if(m=(d=n[f]).length)for(var d,m,y=d[m-1],v=y[0],E=y[1]/2+Fd,M=Me(E),A=hn(E),_=0;_<m;++_,v=T,M=R,A=z,y=x){var x=d[_],T=x[0],S=x[1]/2+Fd,R=Me(S),z=hn(S),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>An,L=M*R;if(rx.add(Oi(L*D*Me(P),A*z+L*hn(P))),u+=ct?U+D*Qo:U,ct^v>=e^T>=e){var W=_f(lu(y),lu(x));xf(W);var V=_f(s,W);xf(V);var Mt=(ct^U>=0?-1:1)*bi(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&rx<-yn)^c&1}var Ndt=Li();var Kdt=Li(),Qdt=Li();var O$=1/0;var nmt=-O$;function ox(n){this._context=n}ox.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,Qo);break}}},result:Lo};var hmt=Li();function sx(){this._string=[]}sx.prototype={_radius:4.5,_circle:dN(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=dN(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 dN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function ax(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Q_(),d=t(p),m=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=S,M.lineStart=R,M.lineEnd=z,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=Gd(v);var U=ix(y,f);v.length?(m||(u.polygonStart(),m=!0),ex(v,U$,U,e,u)):U&&(m||(u.polygonStart(),m=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),m&&(u.polygonEnd(),m=!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 S(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function z(){S(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(m||(u.polygonStart(),m=!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(F$))}}return M}}function F$(n){return n.length>1}function U$(n,t){return((n=n.x)[0]<0?n[1]-wr-yn:wr-n[1])-((t=t.x)[0]<0?t[1]-wr-yn:wr-t[1])}var B$=ax(function(){return!0},z$,k$,[-An,-wr]);function z$(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?An:-An,p=tr(u-t);tr(p-An)<yn?(n.point(t,e=(e+c)/2>0?wr:-wr),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=An&&(tr(t-i)<yn&&(t-=i*yn),tr(u-f)<yn&&(u-=f*yn),e=G$(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 G$(n,t,e,i){var s,u,c=Me(n-e);return tr(c)>yn?Ro((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function k$(n,t,e,i){var s;if(n==null)s=e*wr,i.point(-An,s),i.point(0,s),i.point(An,s),i.point(An,0),i.point(An,-s),i.point(0,-s),i.point(-An,-s),i.point(-An,0),i.point(-An,s);else if(tr(n[0]-t[0])>yn){var u=n[0]<t[0]?An:-An;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function kd(n){return function(t){var e=new ux;for(var i in n)e[i]=n[i];return e.stream=t,e}}function ux(){}ux.prototype={constructor:ux,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 Qmt=hn(30*Ni);var pgt=kd({point:function(n,t){this.stream.point(n*Ni,t*Ni)}});function qd(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 ts(n){return function(t,e){var i=Zr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Oi(t*u,i*c),bi(i&&e*u/i)]}}var EN=qd(function(n){return Zr(2/(1+n))});EN.invert=ts(function(n){return 2*bi(n/2)});var wN=qd(function(n){return(n=K_(n))&&n/Me(n)});wN.invert=ts(function(n){return n});function lx(n,t){return[n,yf(vf((wr+t)/2))]}lx.invert=function(n,t){return[n,2*Ro(Ud(t))-wr]};function Vd(n,t){return[n,t]}Vd.invert=Vd;function SN(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}SN.invert=ts(Ro);function MN(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)))]}MN.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(tr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function bN(n,t){return[hn(t)*Me(n),Me(t)]}bN.invert=ts(bi);function AN(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}AN.invert=ts(function(n){return 2*Ro(n)});function TN(n,t){return[yf(vf((wr+t)/2)),-n]}TN.invert=function(n,t){return[-t,2*Ro(Ud(n))-wr]};var Y$=ue(kl(),1);var $$=ue(kl(),1);var J$=ue(kl(),1);var j$=ue(kl(),1);var w1t=ue(e2(),1),S1t=ue(mv(),1);function n2(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function r2(n){let t={};for(let i in n)i.startsWith("on")&&(t[n2(i.slice(2))]=n[i],t[i]=n[i]);let e=i=>Tf(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 O1t=ue(Eg(),1),D1t=ue(wg(),1),F1t=ue(Sg(),1),U1t=ue(bg(),1),B1t=ue(Ag(),1),z1t=ue(Pg(),1),G1t=ue(Ng(),1),k1t=ue(Dg(),1),q1t=ue(Fg(),1),V1t=ue(Bg(),1),H1t=ue(Gg(),1),W1t=ue(Hg(),1),X1t=ue(Yg(),1),Y1t=ue(u0(),1),$1t=ue(l0(),1),Z1t=ue(Qf(),1),J1t=ue(av(),1);function Hl(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 Ri,d=0;for(let m=0;m<n.length;++m){let y=n[m],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". 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 "+m+'. 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 "+m+". 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 "+m+". .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 "+m+". .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 "+m+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,m),d+=E}}if(e){let m=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)+m);m+=n[v].attributes.position.count}p.setIndex(y)}for(let m in u){let y=i2(u[m]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" attribute."),null;p.setAttribute(m,y)}for(let m in c){let y=c[m][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[m]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[m].length;++A)E.push(c[m][A][v]);let M=i2(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" morphAttribute."),null;p.morphAttributes[m].push(M)}}return p}function i2(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let m=n[d];if(t===void 0&&(t=m.array.constructor),t!==m.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=m.itemSize),e!==m.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=m.normalized),i!==m.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=m.gpuType),s!==m.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=m.count*e}let c=new t(u),f=new Yn(c,e,i),p=0;for(let d=0;d<n.length;++d){let m=n[d];if(m.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=m.count;v<E;v++)for(let M=0;M<e;M++){let A=m.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(m.array,p);p+=m.count*e}return s!==void 0&&(f.gpuType=s),f}function o2(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,m=vl(d[0],d.slice(1)),y=new ml(m,{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 Yn(E,1)),y.setAttribute("opacity",new Yn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Yn(_,1))}let M=new fn(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 Yn(A,3)),y}),u=Hl(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=vx(i)||void 0),c}function vx(n){let{points:t,colors:e,opacities:i}=XZ(n);if(!t.length)return null;let s=new Ri().setFromPoints(t);return s.setAttribute("color",new Yn(new Float32Array(e),3)),s.setAttribute("opacity",new Yn(new Float32Array(i),1)),s}function XZ(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 fn(f).convertLinearToSRGB();for(let m=0;m<c.length;m++){let y=c[m];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 at(E[0],E[1],u)),t.push(new at(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}}r2({onGetMergedGeometryAttributes(n){let{data:t}=n,e=t.map(u=>{let c=u.geometry.coords,f=vl(c[0],c.slice(1));return new ml(f,{steps:1,bevelEnabled:!1,depth:u.height,curveSegments:4})}),i=Hl(e);e.forEach(u=>u.dispose());let s={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),s},onGetMergedShapeGeometryAttributes(n){let{data:t}=n,e=t.map(u=>{let c=vl(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new qc(c,4),p=f.getAttribute("position"),d=[],m=new fn(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(m.r,m.g,m.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Yn(new Float32Array(d),4)),f}),i=Hl(e);e.forEach(u=>u.dispose());let s={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),s},onGetMergedTexture2dShapeGeometryAttributes(n){let{data:t}=n,e=t.map(u=>{let c=vl(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new qc(c,4),p=f.getAttribute("position"),d=[1,1,1,0,0,0,0,1];f.setAttribute("uv",new Wr(d,2));let m=u.height+(u.deltaHeight||0)+u.airHeight;for(let y=0;y<p.count;y++)p.setZ(y,m);return f}),i=Hl(e);e.forEach(u=>u.dispose());let s={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),s},onGetMergedGeometriesJson(n){let{data:t}=n,e=o2(t,!1);return e?{mergedGeometry:e.geometry.toJSON()}:null},onGetMergedGeometriesLineJson(n){let{data:t}=n,e=vx(t);return e?{lineGeometry:e.toJSON()}:null}});
3805
+ }`,vy=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 ro,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 $o({extensions:{fragDepth:!0},vertexShader:y6,fragmentShader:v6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new To(new xp(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},_y=class extends aa{constructor(t,e){super();let i=this,s=null,u=1,c=null,f="local-floor",p=1,d=null,m=null,y=null,v=null,E=null,M=null,A=new vy,_=e.getContextAttributes(),x=null,T=null,S=[],R=[],z=new Ht,U=null,D=new Hi;D.layers.enable(1),D.viewport=new Hr;let P=new Hi;P.layers.enable(2),P.viewport=new Hr;let ct=[D,P],L=new yy;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=S[nt];return bt===void 0&&(bt=new Lc,S[nt]=bt),bt.getTargetRaySpace()},this.getControllerGrip=function(nt){let bt=S[nt];return bt===void 0&&(bt=new Lc,S[nt]=bt),bt.getGripSpace()},this.getHand=function(nt){let bt=S[nt];return bt===void 0&&(bt=new Lc,S[nt]=bt),bt.getHandSpace()};function Mt(nt){let bt=R.indexOf(nt.inputSource);if(bt===-1)return;let qt=S[bt];qt!==void 0&&(qt.update(nt.inputSource,nt.frame,d||c),qt.dispatchEvent({type:nt.type,data:nt.inputSource}))}function Y(){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",Y),s.removeEventListener("inputsourceschange",mt);for(let nt=0;nt<S.length;nt++){let bt=R[nt];bt!==null&&(R[nt]=null,S[nt].disconnect(bt))}W=null,V=null,A.reset(),t.setRenderTarget(x),E=null,v=null,y=null,s=null,T=null,jt.stop(),i.isPresenting=!1,t.setPixelRatio(U),t.setSize(z.width,z.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 Cf(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",Y),s.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),U=t.getPixelRatio(),t.getSize(z),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 Ts(E.framebufferWidth,E.framebufferHeight,{format:Ao,type:ia,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let bt=null,qt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,bt=_.stencil?fl:$a,qt=_.stencil?Ya:ea);let Ft={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:u};y=new XRWebGLBinding(s,e),v=y.createProjectionLayer(Ft),s.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),T=new Ts(v.textureWidth,v.textureHeight,{format:Ao,type:ia,depthTexture:new wp(v.textureWidth,v.textureHeight,qt,void 0,void 0,void 0,void 0,void 0,void 0,bt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let zt=t.properties.get(T);zt.__ignoreDepthValues=v.ignoreDepthValues}T.isXRRenderTarget=!0,this.setFoveation(p),d=null,c=yield s.requestReferenceSpace(f),jt.setContext(s),jt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function mt(nt){for(let bt=0;bt<nt.removed.length;bt++){let qt=nt.removed[bt],$t=R.indexOf(qt);$t>=0&&(R[$t]=null,S[$t].disconnect(qt))}for(let bt=0;bt<nt.added.length;bt++){let qt=nt.added[bt],$t=R.indexOf(qt);if($t===-1){for(let zt=0;zt<S.length;zt++)if(zt>=R.length){R.push(qt),$t=zt;break}else if(R[zt]===null){R[zt]=qt,$t=zt;break}if($t===-1)break}let Ft=S[$t];Ft&&Ft.connect(qt)}}let ft=new at,vt=new at;function it(nt,bt,qt){ft.setFromMatrixPosition(bt.matrixWorld),vt.setFromMatrixPosition(qt.matrixWorld);let $t=ft.distanceTo(vt),Ft=bt.projectionMatrix.elements,zt=qt.projectionMatrix.elements,Ct=Ft[14]/(Ft[10]-1),te=Ft[14]/(Ft[10]+1),$=(Ft[9]+1)/Ft[5],Ot=(Ft[9]-1)/Ft[5],_t=(Ft[8]-1)/Ft[0],Nt=(zt[8]+1)/zt[0],St=Ct*_t,Vt=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 ee=Ct+Xt,X=te+Xt,N=St-Pt,xt=Vt+($t-Pt),wt=$*te/X*ee,ot=Ot*te/X*ee;nt.projectionMatrix.makePerspective(N,xt,wt,ot,ee,X),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,qt=L.cameras;lt(L,bt);for(let $t=0;$t<qt.length;$t++)lt(qt[$t],bt);qt.length===2?it(L,D,P):L.projectionMatrix.copy(D.projectionMatrix),H(nt,L,bt)};function H(nt,bt,qt){qt===null?nt.matrix.copy(bt.matrixWorld):(nt.matrix.copy(qt.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=ey*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(m=bt.getViewerPose(d||c),M=bt,m!==null){let qt=m.views;E!==null&&(t.setRenderTargetFramebuffer(T,E.framebuffer),t.setRenderTarget(T));let $t=!1;qt.length!==L.cameras.length&&(L.cameras.length=0,$t=!0);for(let zt=0;zt<qt.length;zt++){let Ct=qt[zt],te=null;if(E!==null)te=E.getViewport(Ct);else{let Ot=y.getViewSubImage(v,Ct);te=Ot.viewport,zt===0&&(t.setRenderTargetTextures(T,Ot.colorTexture,v.ignoreDepthValues?void 0:Ot.depthStencilTexture),t.setRenderTarget(T))}let $=ct[zt];$===void 0&&($=new Hi,$.layers.enable(zt),$.viewport=new Hr,ct[zt]=$),$.matrix.fromArray(Ct.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(Ct.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(te.x,te.y,te.width,te.height),zt===0&&(L.matrix.copy($.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),$t===!0&&L.cameras.push($)}let Ft=s.enabledFeatures;if(Ft&&Ft.includes("depth-sensing")){let zt=y.getDepthInformation(qt[0]);zt&&zt.isValid&&zt.texture&&A.init(t,zt,s.renderState)}}for(let qt=0;qt<S.length;qt++){let $t=R[qt],Ft=S[qt];$t!==null&&Ft!==void 0&&Ft.update($t,bt,d||c)}A.render(t,L),At&&At(nt,bt),bt.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:bt}),M=null}let jt=new IT;jt.setAnimationLoop(It),this.setAnimationLoop=function(nt){At=nt},this.dispose=function(){}}},Ga=new Ja,_6=new ir;function x6(n,t){function e(_,x){_.matrixAutoUpdate===!0&&_.updateMatrix(),x.value.copy(_.matrix)}function i(_,x){x.color.getRGB(_.fogColor.value,CT(n)),x.isFog?(_.fogNear.value=x.near,_.fogFar.value=x.far):x.isFogExp2&&(_.fogDensity.value=x.density)}function s(_,x,T,S,R){x.isMeshBasicMaterial||x.isMeshLambertMaterial?u(_,x):x.isMeshToonMaterial?(u(_,x),y(_,x)):x.isMeshPhongMaterial?(u(_,x),m(_,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,S):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===Pi&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,e(x.normalMap,_.normalMapTransform),_.normalScale.value.copy(x.normalScale),x.side===Pi&&_.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),S=T.envMap,R=T.envMapRotation;if(S&&(_.envMap.value=S,Ga.copy(R),Ga.x*=-1,Ga.y*=-1,Ga.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(Ga.y*=-1,Ga.z*=-1),_.envMapRotation.value.setFromMatrix4(_6.makeRotationFromEuler(Ga)),_.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=x.reflectivity,_.ior.value=x.ior,_.refractionRatio.value=x.refractionRatio),x.lightMap){_.lightMap.value=x.lightMap;let z=n._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=x.lightMapIntensity*z,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,S){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*T,_.scale.value=S*.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 m(_,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===Pi&&_.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 E6(n,t,e,i){let s={},u={},c=[],f=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(T,S){let R=S.program;i.uniformBlockBinding(T,R)}function d(T,S){let R=s[T.id];R===void 0&&(M(T),R=m(T),s[T.id]=R,T.addEventListener("dispose",_));let z=S.program;i.updateUBOMapping(T,z);let U=t.render.frame;u[T.id]!==U&&(v(T),u[T.id]=U)}function m(T){let S=y();T.__bindingPointIndex=S;let R=n.createBuffer(),z=T.__size,U=T.usage;return n.bindBuffer(n.UNIFORM_BUFFER,R),n.bufferData(n.UNIFORM_BUFFER,z,U),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,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 S=s[T.id],R=T.uniforms,z=T.__cache;n.bindBuffer(n.UNIFORM_BUFFER,S);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,z)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],Y=0;for(let mt=0;mt<Mt.length;mt++){let ft=Mt[mt],vt=A(ft);typeof ft=="number"||typeof ft=="boolean"?(W.__data[0]=ft,n.bufferSubData(n.UNIFORM_BUFFER,V+Y,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,Y),Y+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,V,W.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function E(T,S,R,z){let U=T.value,D=S+"_"+R;if(z[D]===void 0)return typeof U=="number"||typeof U=="boolean"?z[D]=U:z[D]=U.clone(),!0;{let P=z[D];if(typeof U=="number"||typeof U=="boolean"){if(P!==U)return z[D]=U,!0}else if(P.equals(U)===!1)return P.copy(U),!0}return!1}function M(T){let S=T.uniforms,R=0,z=16;for(let D=0,P=S.length;D<P;D++){let ct=Array.isArray(S[D])?S[D]:[S[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 Y=0,mt=Mt.length;Y<mt;Y++){let ft=Mt[Y],vt=A(ft),it=R%z;it!==0&&z-it<vt.boundary&&(R+=z-it),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=R,R+=vt.storage}}}let U=R%z;return U>0&&(R+=z-U),T.__size=R,T.__cache={},this}function A(T){let S={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(S.boundary=4,S.storage=4):T.isVector2?(S.boundary=8,S.storage=8):T.isVector3||T.isColor?(S.boundary=16,S.storage=12):T.isVector4?(S.boundary=16,S.storage=16):T.isMatrix3?(S.boundary=48,S.storage=48):T.isMatrix4?(S.boundary=64,S.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),S}function _(T){let S=T.target;S.removeEventListener("dispose",_);let R=c.indexOf(S.__bindingPointIndex);c.splice(R,1),n.deleteBuffer(s[S.id]),delete s[S.id],delete u[S.id]}function x(){for(let T in s)n.deleteBuffer(s[T]);c=[],s={},u={}}return{bind:p,update:d,dispose:x}}var xy=class{constructor(t={}){let{canvas:e=bk(),context:i=null,depth:s=!0,stencil:u=!0,alpha:c=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:m="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=Wo,this._useLegacyLights=!1,this.toneMapping=ra,this.toneMappingExposure=1;let S=this,R=!1,z=0,U=0,D=null,P=-1,ct=null,L=new Hr,W=new Hr,V=null,Mt=new fn(0),Y=0,mt=e.width,ft=e.height,vt=1,it=null,lt=null,H=new Hr(0,0,mt,ft),At=new Hr(0,0,mt,ft),It=!1,jt=new _p,nt=!1,bt=!1,qt=null,$t=new ir,Ft=new Ht,zt=new at,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return D===null?vt:1}let $=i;function Ot(q,st){for(let Et=0;Et<q.length;Et++){let dt=q[Et],ut=e.getContext(dt,st);if(ut!==null)return ut}return null}try{let q={alpha:!0,depth:s,stencil:u,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:m,failIfMajorPerformanceCaveat:y};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Vy}`),e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",Q,!1),$===null){let st=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&st.shift(),$=Ot(st,q),$===null)throw Ot(st)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&$ instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),$.getShaderPrecisionFormat===void 0&&($.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let _t,Nt,St,Vt,Xt,Pt,ee,X,N,xt,wt,ot,Lt,ce,Rt,Ut,Wt,j,b,I,F,k,G,rt;function tt(){_t=new UV($),Nt=new RV($,_t,t),_t.init(Nt),k=new m6($,_t,Nt),St=new p6($,_t,Nt),Vt=new GV($),Xt=new e6,Pt=new d6($,_t,St,Xt,Nt,k,Vt),ee=new NV(S),X=new FV(S),N=new Xk($,Nt),G=new IV($,_t,N,Nt),xt=new BV($,N,Vt,G),wt=new HV($,xt,N,Vt),b=new VV($,Nt,Pt),Ut=new LV(Xt),ot=new t6(S,ee,X,_t,Nt,G,Ut),Lt=new x6(S,Xt),ce=new r6,Rt=new l6(_t,Nt),j=new CV(S,ee,X,St,wt,v,p),Wt=new h6(S,wt,Nt),rt=new E6($,Vt,Nt,St),I=new PV($,_t,Vt,Nt),F=new zV($,_t,Vt,Nt),Vt.programs=ot.programs,S.capabilities=Nt,S.extensions=_t,S.properties=Xt,S.renderLists=ce,S.shadowMap=Wt,S.state=St,S.info=Vt}tt();let pt=new _y(S,$);this.xr=pt,this.getContext=function(){return $},this.getContextAttributes=function(){return $.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(mt,ft,!1))},this.getSize=function(q){return q.set(mt,ft)},this.setSize=function(q,st,Et=!0){if(pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,ft=st,e.width=Math.floor(q*vt),e.height=Math.floor(st*vt),Et===!0&&(e.style.width=q+"px",e.style.height=st+"px"),this.setViewport(0,0,q,st)},this.getDrawingBufferSize=function(q){return q.set(mt*vt,ft*vt).floor()},this.setDrawingBufferSize=function(q,st,Et){mt=q,ft=st,vt=Et,e.width=Math.floor(q*Et),e.height=Math.floor(st*Et),this.setViewport(0,0,q,st)},this.getCurrentViewport=function(q){return q.copy(L)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,st,Et,dt){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,st,Et,dt),St.viewport(L.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(At)},this.setScissor=function(q,st,Et,dt){q.isVector4?At.set(q.x,q.y,q.z,q.w):At.set(q,st,Et,dt),St.scissor(W.copy(At).multiplyScalar(vt).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(q){St.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,st=!0,Et=!0){let dt=0;if(q){let ut=!1;if(D!==null){let Kt=D.texture.format;ut=Kt===wT||Kt===ET||Kt===xT}if(ut){let Kt=D.texture.type,Qt=Kt===ia||Kt===ea||Kt===Hy||Kt===Ya||Kt===vT||Kt===_T,le=j.getClearColor(),ne=j.getClearAlpha(),ve=le.r,fe=le.g,he=le.b;Qt?(E[0]=ve,E[1]=fe,E[2]=he,E[3]=ne,$.clearBufferuiv($.COLOR,0,E)):(M[0]=ve,M[1]=fe,M[2]=he,M[3]=ne,$.clearBufferiv($.COLOR,0,M))}else dt|=$.COLOR_BUFFER_BIT}st&&(dt|=$.DEPTH_BUFFER_BIT),Et&&(dt|=$.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),$.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(),ee.dispose(),X.dispose(),wt.dispose(),G.dispose(),rt.dispose(),ot.dispose(),Wt.dispose(),pt.dispose(),pt.removeEventListener("sessionstart",Se),pt.removeEventListener("sessionend",ye),qt&&(qt.dispose(),qt=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=Vt.autoReset,st=Wt.enabled,Et=Wt.autoUpdate,dt=Wt.needsUpdate,ut=Wt.type;tt(),Vt.autoReset=q,Wt.enabled=st,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 st=q.target;st.removeEventListener("dispose",J),et(st)}function et(q){Tt(q),Xt.remove(q)}function Tt(q){let st=Xt.get(q).programs;st!==void 0&&(st.forEach(function(Et){ot.releaseProgram(Et)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,st,Et,dt,ut,Kt){st===null&&(st=Ct);let Qt=ut.isMesh&&ut.matrixWorld.determinant()<0,le=En(q,st,Et,dt,ut);St.setMaterial(dt,Qt);let ne=Et.index,ve=1;if(dt.wireframe===!0){if(ne=xt.getWireframeAttribute(Et),ne===void 0)return;ve=2}let fe=Et.drawRange,he=Et.attributes.position,ln=fe.start*ve,Mr=(fe.start+fe.count)*ve;Kt!==null&&(ln=Math.max(ln,Kt.start*ve),Mr=Math.min(Mr,(Kt.start+Kt.count)*ve)),ne!==null?(ln=Math.max(ln,0),Mr=Math.min(Mr,ne.count)):he!=null&&(ln=Math.max(ln,0),Mr=Math.min(Mr,he.count));let kn=Mr-ln;if(kn<0||kn===1/0)return;G.setup(ut,dt,le,Et,ne);let ai,Sn=I;if(ne!==null&&(ai=N.get(ne),Sn=F,Sn.setIndex(ai)),ut.isMesh)dt.wireframe===!0?(St.setLineWidth(dt.wireframeLinewidth*te()),Sn.setMode($.LINES)):Sn.setMode($.TRIANGLES);else if(ut.isLine){let oe=dt.linewidth;oe===void 0&&(oe=1),St.setLineWidth(oe*te()),ut.isLineSegments?Sn.setMode($.LINES):ut.isLineLoop?Sn.setMode($.LINE_LOOP):Sn.setMode($.LINE_STRIP)}else ut.isPoints?Sn.setMode($.POINTS):ut.isSprite&&Sn.setMode($.TRIANGLES);if(ut.isBatchedMesh)Sn.renderMultiDraw(ut._multiDrawStarts,ut._multiDrawCounts,ut._multiDrawCount);else if(ut.isInstancedMesh)Sn.renderInstances(ln,kn,ut.count);else if(Et.isInstancedBufferGeometry){let oe=Et._maxInstanceCount!==void 0?Et._maxInstanceCount:1/0,cu=Math.min(Et.instanceCount,oe);Sn.renderInstances(ln,kn,cu)}else Sn.render(ln,kn)};function Gt(q,st,Et){q.transparent===!0&&q.side===Ss&&q.forceSinglePass===!1?(q.side=Pi,q.needsUpdate=!0,xn(q,st,Et),q.side=sa,q.needsUpdate=!0,xn(q,st,Et),q.side=Ss):xn(q,st,Et)}this.compile=function(q,st,Et=null){Et===null&&(Et=q),_=Rt.get(Et),_.init(),T.push(_),Et.traverseVisible(function(ut){ut.isLight&&ut.layers.test(st.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),q!==Et&&q.traverseVisible(function(ut){ut.isLight&&ut.layers.test(st.layers)&&(_.pushLight(ut),ut.castShadow&&_.pushShadow(ut))}),_.setupLights(S._useLegacyLights);let dt=new Set;return q.traverse(function(ut){let Kt=ut.material;if(Kt)if(Array.isArray(Kt))for(let Qt=0;Qt<Kt.length;Qt++){let le=Kt[Qt];Gt(le,Et,ut),dt.add(le)}else Gt(Kt,Et,ut),dt.add(Kt)}),T.pop(),_=null,dt},this.compileAsync=function(q,st,Et=null){let dt=this.compile(q,st,Et);return new Promise(ut=>{function Kt(){if(dt.forEach(function(Qt){Xt.get(Qt).currentProgram.isReady()&&dt.delete(Qt)}),dt.size===0){ut(q);return}setTimeout(Kt,10)}_t.get("KHR_parallel_shader_compile")!==null?Kt():setTimeout(Kt,10)})};let re=null;function ie(q){re&&re(q)}function Se(){be.stop()}function ye(){be.start()}let be=new IT;be.setAnimationLoop(ie),typeof self!="undefined"&&be.setContext(self),this.setAnimationLoop=function(q){re=q,pt.setAnimationLoop(q),q===null?be.stop():be.start()},pt.addEventListener("sessionstart",Se),pt.addEventListener("sessionend",ye),this.render=function(q,st){if(st!==void 0&&st.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(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),pt.enabled===!0&&pt.isPresenting===!0&&(pt.cameraAutoUpdate===!0&&pt.updateCamera(st),st=pt.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,st,D),_=Rt.get(q,T.length),_.init(),T.push(_),$t.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),jt.setFromProjectionMatrix($t),bt=this.localClippingEnabled,nt=Ut.init(this.clippingPlanes,bt),A=ce.get(q,x.length),A.init(),x.push(A),Ae(q,st,0,S.sortObjects),A.finish(),S.sortObjects===!0&&A.sort(it,lt),this.info.render.frame++,nt===!0&&Ut.beginShadows();let Et=_.state.shadowsArray;if(Wt.render(Et,q,st),nt===!0&&Ut.endShadows(),this.info.autoReset===!0&&this.info.reset(),(pt.enabled===!1||pt.isPresenting===!1||pt.hasDepthSensing()===!1)&&j.render(A,q),_.setupLights(S._useLegacyLights),st.isArrayCamera){let dt=st.cameras;for(let ut=0,Kt=dt.length;ut<Kt;ut++){let Qt=dt[ut];On(A,q,Qt,Qt.viewport)}}else On(A,q,st);D!==null&&(Pt.updateMultisampleRenderTarget(D),Pt.updateRenderTargetMipmap(D)),q.isScene===!0&&q.onAfterRender(S,q,st),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,st,Et,dt){if(q.visible===!1)return;if(q.layers.test(st.layers)){if(q.isGroup)Et=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(st);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||jt.intersectsSprite(q)){dt&&zt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Qt=wt.update(q),le=q.material;le.visible&&A.push(q,Qt,le,Et,zt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||jt.intersectsObject(q))){let Qt=wt.update(q),le=q.material;if(dt&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),zt.copy(q.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),zt.copy(Qt.boundingSphere.center)),zt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(le)){let ne=Qt.groups;for(let ve=0,fe=ne.length;ve<fe;ve++){let he=ne[ve],ln=le[he.materialIndex];ln&&ln.visible&&A.push(q,Qt,ln,Et,zt.z,he)}}else le.visible&&A.push(q,Qt,le,Et,zt.z,null)}}let Kt=q.children;for(let Qt=0,le=Kt.length;Qt<le;Qt++)Ae(Kt[Qt],st,Et,dt)}function On(q,st,Et,dt){let ut=q.opaque,Kt=q.transmissive,Qt=q.transparent;_.setupLightsView(Et),nt===!0&&Ut.setGlobalState(S.clippingPlanes,Et),Kt.length>0&&pr(ut,Kt,st,Et),dt&&St.viewport(L.copy(dt)),ut.length>0&&_n(ut,st,Et),Kt.length>0&&_n(Kt,st,Et),Qt.length>0&&_n(Qt,st,Et),St.buffers.depth.setTest(!0),St.buffers.depth.setMask(!0),St.buffers.color.setMask(!0),St.setPolygonOffset(!1)}function pr(q,st,Et,dt){if((Et.isScene===!0?Et.overrideMaterial:null)!==null)return;let Kt=Nt.isWebGL2;qt===null&&(qt=new Ts(1,1,{generateMipmaps:!0,type:_t.has("EXT_color_buffer_half_float")?Dc:ia,minFilter:Ha,samples:Kt?4:0})),S.getDrawingBufferSize(Ft),Kt?qt.setSize(Ft.x,Ft.y):qt.setSize(ny(Ft.x),ny(Ft.y));let Qt=S.getRenderTarget();S.setRenderTarget(qt),S.getClearColor(Mt),Y=S.getClearAlpha(),Y<1&&S.setClearColor(16777215,.5),S.clear();let le=S.toneMapping;S.toneMapping=ra,_n(q,Et,dt),Pt.updateMultisampleRenderTarget(qt),Pt.updateRenderTargetMipmap(qt);let ne=!1;for(let ve=0,fe=st.length;ve<fe;ve++){let he=st[ve],ln=he.object,Mr=he.geometry,kn=he.material,ai=he.group;if(kn.side===Ss&&ln.layers.test(dt.layers)){let Sn=kn.side;kn.side=Pi,kn.needsUpdate=!0,pe(ln,Et,dt,Mr,kn,ai),kn.side=Sn,kn.needsUpdate=!0,ne=!0}}ne===!0&&(Pt.updateMultisampleRenderTarget(qt),Pt.updateRenderTargetMipmap(qt)),S.setRenderTarget(Qt),S.setClearColor(Mt,Y),S.toneMapping=le}function _n(q,st,Et){let dt=st.isScene===!0?st.overrideMaterial:null;for(let ut=0,Kt=q.length;ut<Kt;ut++){let Qt=q[ut],le=Qt.object,ne=Qt.geometry,ve=dt===null?Qt.material:dt,fe=Qt.group;le.layers.test(Et.layers)&&pe(le,st,Et,ne,ve,fe)}}function pe(q,st,Et,dt,ut,Kt){q.onBeforeRender(S,st,Et,dt,ut,Kt),q.modelViewMatrix.multiplyMatrices(Et.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ut.onBeforeRender(S,st,Et,dt,q,Kt),ut.transparent===!0&&ut.side===Ss&&ut.forceSinglePass===!1?(ut.side=Pi,ut.needsUpdate=!0,S.renderBufferDirect(Et,st,dt,ut,q,Kt),ut.side=sa,ut.needsUpdate=!0,S.renderBufferDirect(Et,st,dt,ut,q,Kt),ut.side=Ss):S.renderBufferDirect(Et,st,dt,ut,q,Kt),q.onAfterRender(S,st,Et,dt,ut,Kt)}function xn(q,st,Et){st.isScene!==!0&&(st=Ct);let dt=Xt.get(q),ut=_.state.lights,Kt=_.state.shadowsArray,Qt=ut.state.version,le=ot.getParameters(q,ut.state,Kt,st,Et),ne=ot.getProgramCacheKey(le),ve=dt.programs;dt.environment=q.isMeshStandardMaterial?st.environment:null,dt.fog=st.fog,dt.envMap=(q.isMeshStandardMaterial?X:ee).get(q.envMap||dt.environment),dt.envMapRotation=dt.environment!==null&&q.envMap===null?st.environmentRotation:q.envMapRotation,ve===void 0&&(q.addEventListener("dispose",J),ve=new Map,dt.programs=ve);let fe=ve.get(ne);if(fe!==void 0){if(dt.currentProgram===fe&&dt.lightsStateVersion===Qt)return Tn(q,le),fe}else le.uniforms=ot.getUniforms(q),q.onBuild(Et,le,S),q.onBeforeCompile(le,S),fe=ot.acquireProgram(le,ne),ve.set(ne,fe),dt.uniforms=le.uniforms;let he=dt.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(he.clippingPlanes=Ut.uniform),Tn(q,le),dt.needsLights=Sr(q),dt.lightsStateVersion=Qt,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 Rn(q){if(q.uniformsList===null){let st=q.currentProgram.getUniforms();q.uniformsList=ul.seqWithValue(st.seq,q.uniforms)}return q.uniformsList}function Tn(q,st){let Et=Xt.get(q);Et.outputColorSpace=st.outputColorSpace,Et.batching=st.batching,Et.instancing=st.instancing,Et.instancingColor=st.instancingColor,Et.instancingMorph=st.instancingMorph,Et.skinning=st.skinning,Et.morphTargets=st.morphTargets,Et.morphNormals=st.morphNormals,Et.morphColors=st.morphColors,Et.morphTargetsCount=st.morphTargetsCount,Et.numClippingPlanes=st.numClippingPlanes,Et.numIntersection=st.numClipIntersection,Et.vertexAlphas=st.vertexAlphas,Et.vertexTangents=st.vertexTangents,Et.toneMapping=st.toneMapping}function En(q,st,Et,dt,ut){st.isScene!==!0&&(st=Ct),Pt.resetTextureUnits();let Kt=st.fog,Qt=dt.isMeshStandardMaterial?st.environment:null,le=D===null?S.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:ua,ne=(dt.isMeshStandardMaterial?X:ee).get(dt.envMap||Qt),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,ln=!!Et.morphAttributes.normal,Mr=!!Et.morphAttributes.color,kn=ra;dt.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(kn=S.toneMapping);let ai=Et.morphAttributes.position||Et.morphAttributes.normal||Et.morphAttributes.color,Sn=ai!==void 0?ai.length:0,oe=Xt.get(dt),cu=_.state.lights;if(nt===!0&&(bt===!0||q!==ct)){let ui=q===ct&&dt.id===P;Ut.setState(dt,q,ui)}let cn=!1;dt.version===oe.__version?(oe.needsLights&&oe.lightsStateVersion!==cu.state.version||oe.outputColorSpace!==le||ut.isBatchedMesh&&oe.batching===!1||!ut.isBatchedMesh&&oe.batching===!0||ut.isInstancedMesh&&oe.instancing===!1||!ut.isInstancedMesh&&oe.instancing===!0||ut.isSkinnedMesh&&oe.skinning===!1||!ut.isSkinnedMesh&&oe.skinning===!0||ut.isInstancedMesh&&oe.instancingColor===!0&&ut.instanceColor===null||ut.isInstancedMesh&&oe.instancingColor===!1&&ut.instanceColor!==null||ut.isInstancedMesh&&oe.instancingMorph===!0&&ut.morphTexture===null||ut.isInstancedMesh&&oe.instancingMorph===!1&&ut.morphTexture!==null||oe.envMap!==ne||dt.fog===!0&&oe.fog!==Kt||oe.numClippingPlanes!==void 0&&(oe.numClippingPlanes!==Ut.numPlanes||oe.numIntersection!==Ut.numIntersection)||oe.vertexAlphas!==ve||oe.vertexTangents!==fe||oe.morphTargets!==he||oe.morphNormals!==ln||oe.morphColors!==Mr||oe.toneMapping!==kn||Nt.isWebGL2===!0&&oe.morphTargetsCount!==Sn)&&(cn=!0):(cn=!0,oe.__version=dt.version);let oo=oe.currentProgram;cn===!0&&(oo=xn(dt,st,ut));let Wl=!1,_e=!1,ga=!1,Mn=oo.getUniforms(),so=oe.uniforms;if(St.useProgram(oo.program)&&(Wl=!0,_e=!0,ga=!0),dt.id!==P&&(P=dt.id,_e=!0),Wl||ct!==q){Mn.setValue($,"projectionMatrix",q.projectionMatrix),Mn.setValue($,"viewMatrix",q.matrixWorldInverse);let ui=Mn.map.cameraPosition;ui!==void 0&&ui.setValue($,zt.setFromMatrixPosition(q.matrixWorld)),Nt.logarithmicDepthBuffer&&Mn.setValue($,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(dt.isMeshPhongMaterial||dt.isMeshToonMaterial||dt.isMeshLambertMaterial||dt.isMeshBasicMaterial||dt.isMeshStandardMaterial||dt.isShaderMaterial)&&Mn.setValue($,"isOrthographic",q.isOrthographicCamera===!0),ct!==q&&(ct=q,_e=!0,ga=!0)}if(ut.isSkinnedMesh){Mn.setOptional($,ut,"bindMatrix"),Mn.setOptional($,ut,"bindMatrixInverse");let ui=ut.skeleton;ui&&(Nt.floatVertexTextures?(ui.boneTexture===null&&ui.computeBoneTexture(),Mn.setValue($,"boneTexture",ui.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($,ut,"batchingTexture"),Mn.setValue($,"batchingTexture",ut._matricesTexture,Pt));let ge=Et.morphAttributes;if((ge.position!==void 0||ge.normal!==void 0||ge.color!==void 0&&Nt.isWebGL2===!0)&&b.update(ut,Et,oo),(_e||oe.receiveShadow!==ut.receiveShadow)&&(oe.receiveShadow=ut.receiveShadow,Mn.setValue($,"receiveShadow",ut.receiveShadow)),dt.isMeshGouraudMaterial&&dt.envMap!==null&&(so.envMap.value=ne,so.flipEnvMap.value=ne.isCubeTexture&&ne.isRenderTargetTexture===!1?-1:1),_e&&(Mn.setValue($,"toneMappingExposure",S.toneMappingExposure),oe.needsLights&&Jr(so,ga),Kt&&dt.fog===!0&&Lt.refreshFogUniforms(so,Kt),Lt.refreshMaterialUniforms(so,dt,vt,ft,qt),ul.upload($,Rn(oe),so,Pt)),dt.isShaderMaterial&&dt.uniformsNeedUpdate===!0&&(ul.upload($,Rn(oe),so,Pt),dt.uniformsNeedUpdate=!1),dt.isSpriteMaterial&&Mn.setValue($,"center",ut.center),Mn.setValue($,"modelViewMatrix",ut.modelViewMatrix),Mn.setValue($,"normalMatrix",ut.normalMatrix),Mn.setValue($,"modelMatrix",ut.matrixWorld),dt.isShaderMaterial||dt.isRawShaderMaterial){let ui=dt.uniformsGroups;for(let Xl=0,fu=ui.length;Xl<fu;Xl++)if(Nt.isWebGL2){let li=ui[Xl];rt.update(li,oo),rt.bind(li,oo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return oo}function Jr(q,st){q.ambientLightColor.needsUpdate=st,q.lightProbe.needsUpdate=st,q.directionalLights.needsUpdate=st,q.directionalLightShadows.needsUpdate=st,q.pointLights.needsUpdate=st,q.pointLightShadows.needsUpdate=st,q.spotLights.needsUpdate=st,q.spotLightShadows.needsUpdate=st,q.rectAreaLights.needsUpdate=st,q.hemisphereLights.needsUpdate=st}function Sr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(q,st,Et){Xt.get(q.texture).__webglTexture=st,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,st){let Et=Xt.get(q);Et.__webglFramebuffer=st,Et.__useDefaultFramebuffer=st===void 0},this.setRenderTarget=function(q,st=0,Et=0){D=q,z=st,U=Et;let dt=!0,ut=null,Kt=!1,Qt=!1;if(q){let ne=Xt.get(q);ne.__useDefaultFramebuffer!==void 0?(St.bindFramebuffer($.FRAMEBUFFER,null),dt=!1):ne.__webglFramebuffer===void 0?Pt.setupRenderTarget(q):ne.__hasExternalTextures&&Pt.rebindTextures(q,Xt.get(q.texture).__webglTexture,Xt.get(q.depthTexture).__webglTexture);let ve=q.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(Qt=!0);let fe=Xt.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(fe[st])?ut=fe[st][Et]:ut=fe[st],Kt=!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(St.bindFramebuffer($.FRAMEBUFFER,ut)&&Nt.drawBuffers&&dt&&St.drawBuffers(q,ut),St.viewport(L),St.scissor(W),St.setScissorTest(V),Kt){let ne=Xt.get(q.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+st,ne.__webglTexture,Et)}else if(Qt){let ne=Xt.get(q.texture),ve=st||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,ne.__webglTexture,Et||0,ve)}P=-1},this.readRenderTargetPixels=function(q,st,Et,dt,ut,Kt,Qt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let le=Xt.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Qt!==void 0&&(le=le[Qt]),le){St.bindFramebuffer($.FRAMEBUFFER,le);try{let ne=q.texture,ve=ne.format,fe=ne.type;if(ve!==Ao&&k.convert(ve)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let he=fe===Dc&&(_t.has("EXT_color_buffer_half_float")||Nt.isWebGL2&&_t.has("EXT_color_buffer_float"));if(fe!==ia&&k.convert(fe)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_TYPE)&&!(fe===Ms&&(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}st>=0&&st<=q.width-dt&&Et>=0&&Et<=q.height-ut&&$.readPixels(st,Et,dt,ut,k.convert(ve),k.convert(fe),Kt)}finally{let ne=D!==null?Xt.get(D).__webglFramebuffer:null;St.bindFramebuffer($.FRAMEBUFFER,ne)}}},this.copyFramebufferToTexture=function(q,st,Et=0){let dt=Math.pow(2,-Et),ut=Math.floor(st.image.width*dt),Kt=Math.floor(st.image.height*dt);Pt.setTexture2D(st,0),$.copyTexSubImage2D($.TEXTURE_2D,Et,0,0,q.x,q.y,ut,Kt),St.unbindTexture()},this.copyTextureToTexture=function(q,st,Et,dt=0){let ut=st.image.width,Kt=st.image.height,Qt=k.convert(Et.format),le=k.convert(Et.type);Pt.setTexture2D(Et,0),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,Et.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Et.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,Et.unpackAlignment),st.isDataTexture?$.texSubImage2D($.TEXTURE_2D,dt,q.x,q.y,ut,Kt,Qt,le,st.image.data):st.isCompressedTexture?$.compressedTexSubImage2D($.TEXTURE_2D,dt,q.x,q.y,st.mipmaps[0].width,st.mipmaps[0].height,Qt,st.mipmaps[0].data):$.texSubImage2D($.TEXTURE_2D,dt,q.x,q.y,Qt,le,st.image),dt===0&&Et.generateMipmaps&&$.generateMipmap($.TEXTURE_2D),St.unbindTexture()},this.copyTextureToTexture3D=function(q,st,Et,dt,ut=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Kt=Math.round(q.max.x-q.min.x),Qt=Math.round(q.max.y-q.min.y),le=q.max.z-q.min.z+1,ne=k.convert(dt.format),ve=k.convert(dt.type),fe;if(dt.isData3DTexture)Pt.setTexture3D(dt,0),fe=$.TEXTURE_3D;else if(dt.isDataArrayTexture||dt.isCompressedArrayTexture)Pt.setTexture2DArray(dt,0),fe=$.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,dt.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dt.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,dt.unpackAlignment);let he=$.getParameter($.UNPACK_ROW_LENGTH),ln=$.getParameter($.UNPACK_IMAGE_HEIGHT),Mr=$.getParameter($.UNPACK_SKIP_PIXELS),kn=$.getParameter($.UNPACK_SKIP_ROWS),ai=$.getParameter($.UNPACK_SKIP_IMAGES),Sn=Et.isCompressedTexture?Et.mipmaps[ut]:Et.image;$.pixelStorei($.UNPACK_ROW_LENGTH,Sn.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,Sn.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,q.min.x),$.pixelStorei($.UNPACK_SKIP_ROWS,q.min.y),$.pixelStorei($.UNPACK_SKIP_IMAGES,q.min.z),Et.isDataTexture||Et.isData3DTexture?$.texSubImage3D(fe,ut,st.x,st.y,st.z,Kt,Qt,le,ne,ve,Sn.data):dt.isCompressedArrayTexture?$.compressedTexSubImage3D(fe,ut,st.x,st.y,st.z,Kt,Qt,le,ne,Sn.data):$.texSubImage3D(fe,ut,st.x,st.y,st.z,Kt,Qt,le,ne,ve,Sn),$.pixelStorei($.UNPACK_ROW_LENGTH,he),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,ln),$.pixelStorei($.UNPACK_SKIP_PIXELS,Mr),$.pixelStorei($.UNPACK_SKIP_ROWS,kn),$.pixelStorei($.UNPACK_SKIP_IMAGES,ai),ut===0&&dt.generateMipmaps&&$.generateMipmap(fe),St.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),St.unbindTexture()},this.resetState=function(){z=0,U=0,D=null,St.reset(),G.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return bs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Wy?"display-p3":"srgb",e.unpackColorSpace=In.workingColorSpace===Ip?"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}},Ey=class extends xy{};Ey.prototype.isWebGL1Renderer=!0;var Sp=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=Q0,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=As()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return AT("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=As()),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=As()),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}}},_i=new at,Bc=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++)_i.fromBufferAttribute(this,e),_i.applyMatrix4(t),this.setXYZ(e,_i.x,_i.y,_i.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)_i.fromBufferAttribute(this,e),_i.applyNormalMatrix(t),this.setXYZ(e,_i.x,_i.y,_i.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)_i.fromBufferAttribute(this,e),_i.transformDirection(t),this.setXYZ(e,_i.x,_i.y,_i.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=Yo(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Cn(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=Cn(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Cn(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Cn(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Cn(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=Yo(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Yo(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Yo(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Yo(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Cn(e,this.array),i=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(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=Cn(e,this.array),i=Cn(i,this.array),s=Cn(s,this.array),u=Cn(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 Yn(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}}},wy=class extends ja{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new fn(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}},Qs,Ic=new at,tl=new at,el=new at,nl=new Ht,Pc=new Ht,DT=new ir,Zh=new at,Rc=new at,Jh=new at,uT=new Ht,V0=new Ht,lT=new Ht,Sy=class extends Co{constructor(t=new wy){if(super(),this.isSprite=!0,this.type="Sprite",Qs===void 0){Qs=new Ri;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 Sp(e,5);Qs.setIndex([0,1,2,0,2,3]),Qs.setAttribute("position",new Bc(i,3,0,!1)),Qs.setAttribute("uv",new Bc(i,2,3,!1))}this.geometry=Qs,this.material=t,this.center=new Ht(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),tl.setFromMatrixScale(this.matrixWorld),DT.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),el.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&tl.multiplyScalar(-el.z);let i=this.material.rotation,s,u;i!==0&&(u=Math.cos(i),s=Math.sin(i));let c=this.center;jh(Zh.set(-.5,-.5,0),el,c,tl,s,u),jh(Rc.set(.5,-.5,0),el,c,tl,s,u),jh(Jh.set(.5,.5,0),el,c,tl,s,u),uT.set(0,0),V0.set(1,0),lT.set(1,1);let f=t.ray.intersectTriangle(Zh,Rc,Jh,!1,Ic);if(f===null&&(jh(Rc.set(-.5,.5,0),el,c,tl,s,u),V0.set(0,1),f=t.ray.intersectTriangle(Zh,Jh,Rc,!1,Ic),f===null))return;let p=t.ray.origin.distanceTo(Ic);p<t.near||p>t.far||e.push({distance:p,point:Ic.clone(),uv:Wa.getInterpolation(Ic,Zh,Rc,Jh,uT,V0,lT,new Ht),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}};Sy.Dispose=function(){Qs.dispose(),Qs=void 0};function jh(n,t,e,i,s,u){nl.subVectors(n,e).addScalar(.5).multiply(i),s!==void 0?(Pc.x=u*nl.x-s*nl.y,Pc.y=s*nl.x+u*nl.y):Pc.copy(nl),n.copy(t),n.x+=Pc.x,n.y+=Pc.y,n.applyMatrix4(DT)}var io=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 m=i[s],v=i[s+1]-m,E=(c-m)/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 Ht:new at);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 at,s=[],u=[],c=[],f=new at,p=new ir;for(let E=0;E<=t;E++){let M=E/t;s[E]=this.getTangentAt(M,new at)}u[0]=new at,c[0]=new at;let d=Number.MAX_VALUE,m=Math.abs(s[0].x),y=Math.abs(s[0].y),v=Math.abs(s[0].z);m<=d&&(d=m,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(ii(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(ii(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}},zc=class extends io{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 Ht){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 m=Math.cos(this.aRotation),y=Math.sin(this.aRotation),v=p-this.aX,E=d-this.aY;p=v*m-E*y+this.aX,d=v*y+E*m+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}},My=class extends zc{constructor(t,e,i,s,u,c){super(t,e,i,i,s,u,c),this.isArcCurve=!0,this.type="ArcCurve"}};function Yy(){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,m,y){let v=(c-u)/d-(f-u)/(d+m)+(f-c)/m,E=(f-c)/m-(p-c)/(m+y)+(p-f)/y;v*=m,E*=m,s(c,f,v,E)},calc:function(u){let c=u*u,f=c*u;return n+t*u+e*c+i*f}}}var Kh=new at,H0=new Yy,W0=new Yy,X0=new Yy,by=class extends io{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 at){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,m;this.closed||f>0?d=s[(f-1)%u]:(Kh.subVectors(s[0],s[1]).add(s[0]),d=Kh);let y=s[f%u],v=s[(f+1)%u];if(this.closed||f+2<u?m=s[(f+2)%u]:(Kh.subVectors(s[u-1],s[u-2]).add(s[u-1]),m=Kh),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(m),E);A<1e-4&&(A=1),M<1e-4&&(M=A),_<1e-4&&(_=A),H0.initNonuniformCatmullRom(d.x,y.x,v.x,m.x,M,A,_),W0.initNonuniformCatmullRom(d.y,y.y,v.y,m.y,M,A,_),X0.initNonuniformCatmullRom(d.z,y.z,v.z,m.z,M,A,_)}else this.curveType==="catmullrom"&&(H0.initCatmullRom(d.x,y.x,v.x,m.x,this.tension),W0.initCatmullRom(d.y,y.y,v.y,m.y,this.tension),X0.initCatmullRom(d.z,y.z,v.z,m.z,this.tension));return i.set(H0.calc(p),W0.calc(p),X0.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 at().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function cT(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 w6(n,t){let e=1-n;return e*e*t}function S6(n,t){return 2*(1-n)*n*t}function M6(n,t){return n*n*t}function Nc(n,t,e,i){return w6(n,t)+S6(n,e)+M6(n,i)}function b6(n,t){let e=1-n;return e*e*e*t}function A6(n,t){let e=1-n;return 3*e*e*n*t}function T6(n,t){return 3*(1-n)*n*n*t}function C6(n,t){return n*n*n*t}function Oc(n,t,e,i,s){return b6(n,t)+A6(n,e)+T6(n,i)+C6(n,s)}var Mp=class extends io{constructor(t=new Ht,e=new Ht,i=new Ht,s=new Ht){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Ht){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(Oc(t,s.x,u.x,c.x,f.x),Oc(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}},Ay=class extends io{constructor(t=new at,e=new at,i=new at,s=new at){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new at){let i=e,s=this.v0,u=this.v1,c=this.v2,f=this.v3;return i.set(Oc(t,s.x,u.x,c.x,f.x),Oc(t,s.y,u.y,c.y,f.y),Oc(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}},bp=class extends io{constructor(t=new Ht,e=new Ht){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ht){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 Ht){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}},Ty=class extends io{constructor(t=new at,e=new at){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new at){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 at){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}},Ap=class extends io{constructor(t=new Ht,e=new Ht,i=new Ht){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ht){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(Nc(t,s.x,u.x,c.x),Nc(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}},Cy=class extends io{constructor(t=new at,e=new at,i=new at){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new at){let i=e,s=this.v0,u=this.v1,c=this.v2;return i.set(Nc(t,s.x,u.x,c.x),Nc(t,s.y,u.y,c.y),Nc(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}},Tp=class extends io{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ht){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],m=s[c>s.length-2?s.length-1:c+1],y=s[c>s.length-3?s.length-1:c+2];return i.set(cT(f,p.x,d.x,m.x,y.x),cT(f,p.y,d.y,m.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 Ht().fromArray(s))}return this}},Iy=Object.freeze({__proto__:null,ArcCurve:My,CatmullRomCurve3:by,CubicBezierCurve:Mp,CubicBezierCurve3:Ay,EllipseCurve:zc,LineCurve:bp,LineCurve3:Ty,QuadraticBezierCurve:Ap,QuadraticBezierCurve3:Cy,SplineCurve:Tp}),Py=class extends io{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 Iy[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 m=p[d];i&&i.equals(m)||(e.push(m),i=m)}}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 Iy[s.type]().fromJSON(s))}return this}},pl=class extends Py{constructor(t){super(),this.type="Path",this.currentPoint=new Ht,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 bp(this.currentPoint.clone(),new Ht(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){let u=new Ap(this.currentPoint.clone(),new Ht(t,e),new Ht(i,s));return this.curves.push(u),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,u,c){let f=new Mp(this.currentPoint.clone(),new Ht(t,e),new Ht(i,s),new Ht(u,c));return this.curves.push(f),this.currentPoint.set(u,c),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new Tp(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,m=this.currentPoint.y;return this.absellipse(t+d,e+m,i,s,u,c,f,p),this}absellipse(t,e,i,s,u,c,f,p){let d=new zc(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 m=d.getPoint(1);return this.currentPoint.copy(m),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 dl=class extends pl{constructor(t){super(t),this.uuid=As(),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 pl().fromJSON(s))}return this}},I6={triangulate:function(n,t,e=2){let i=t&&t.length,s=i?t[0]*e:n.length,u=FT(n,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;let f,p,d,m,y,v,E;if(i&&(u=O6(n,t,u,e)),n.length>80*e){f=d=n[0],p=m=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>m&&(m=v);E=Math.max(d-f,m-p),E=E!==0?32767/E:0}return Gc(u,c,e,f,p,E,0),c}};function FT(n,t,e,i,s){let u,c;if(s===W6(n,t,e,i)>0)for(u=t;u<e;u+=i)c=fT(u,n[u],n[u+1],c);else for(u=e-i;u>=t;u-=i)c=fT(u,n[u],n[u+1],c);return c&&Rp(c,c.next)&&(qc(c),c=c.next),c}function Ka(n,t){if(!n)return n;t||(t=n);let e=n,i;do if(i=!1,!e.steiner&&(Rp(e,e.next)||Jn(e.prev,e,e.next)===0)){if(qc(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Gc(n,t,e,i,s,u,c){if(!n)return;!c&&u&&z6(n,i,s,u);let f=n,p,d;for(;n.prev!==n.next;){if(p=n.prev,d=n.next,u?R6(n,i,s,u):P6(n)){t.push(p.i/e|0),t.push(n.i/e|0),t.push(d.i/e|0),qc(n),n=d.next,f=d.next;continue}if(n=d,n===f){c?c===1?(n=L6(Ka(n),t,e),Gc(n,t,e,i,s,u,2)):c===2&&N6(n,t,e,i,s,u):Gc(Ka(n),t,e,i,s,u,1);break}}}function P6(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,m=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>=m&&M.x<=v&&M.y>=y&&M.y<=E&&ol(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 R6(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,m=s.y,y=u.y,v=c.y,E=f<p?f<d?f:d:p<d?p:d,M=m<y?m<v?m:v:y<v?y:v,A=f>p?f>d?f:d:p>d?p:d,_=m>y?m>v?m:v:y>v?y:v,x=Ry(E,M,t,e,i),T=Ry(A,_,t,e,i),S=n.prevZ,R=n.nextZ;for(;S&&S.z>=x&&R&&R.z<=T;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&ol(f,m,p,y,d,v,S.x,S.y)&&Jn(S.prev,S,S.next)>=0||(S=S.prevZ,R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&ol(f,m,p,y,d,v,R.x,R.y)&&Jn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;S&&S.z>=x;){if(S.x>=E&&S.x<=A&&S.y>=M&&S.y<=_&&S!==s&&S!==c&&ol(f,m,p,y,d,v,S.x,S.y)&&Jn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=M&&R.y<=_&&R!==s&&R!==c&&ol(f,m,p,y,d,v,R.x,R.y)&&Jn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function L6(n,t,e){let i=n;do{let s=i.prev,u=i.next.next;!Rp(s,u)&&UT(s,i,i.next,u)&&kc(s,u)&&kc(u,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),qc(i),qc(i.next),i=n=u),i=i.next}while(i!==n);return Ka(i)}function N6(n,t,e,i,s,u){let c=n;do{let f=c.next.next;for(;f!==c.prev;){if(c.i!==f.i&&q6(c,f)){let p=BT(c,f);c=Ka(c,c.next),p=Ka(p,p.next),Gc(c,t,e,i,s,u,0),Gc(p,t,e,i,s,u,0);return}f=f.next}c=c.next}while(c!==n)}function O6(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=FT(n,f,p,i,!1),d===d.next&&(d.steiner=!0),s.push(k6(d));for(s.sort(D6),u=0;u<s.length;u++)e=F6(s[u],e);return e}function D6(n,t){return n.x-t.x}function F6(n,t){let e=U6(n,t);if(!e)return t;let i=BT(e,n);return Ka(i,i.next),Ka(e,e.next)}function U6(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,m=1/0,y;e=s;do u>=e.x&&e.x>=p&&u!==e.x&&ol(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),kc(e,n)&&(y<m||y===m&&(e.x>s.x||e.x===s.x&&B6(s,e)))&&(s=e,m=y)),e=e.next;while(e!==f);return s}function B6(n,t){return Jn(n.prev,n,t.prev)<0&&Jn(t.next,n,n.next)<0}function z6(n,t,e,i){let s=n;do s.z===0&&(s.z=Ry(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,G6(s)}function G6(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 Ry(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 k6(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 ol(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 q6(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!V6(n,t)&&(kc(n,t)&&kc(t,n)&&H6(n,t)&&(Jn(n.prev,n,t.prev)||Jn(n,t.prev,t))||Rp(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 Rp(n,t){return n.x===t.x&&n.y===t.y}function UT(n,t,e,i){let s=tp(Jn(n,t,e)),u=tp(Jn(n,t,i)),c=tp(Jn(e,i,n)),f=tp(Jn(e,i,t));return!!(s!==u&&c!==f||s===0&&Qh(n,e,t)||u===0&&Qh(n,i,t)||c===0&&Qh(e,n,i)||f===0&&Qh(e,t,i))}function Qh(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 tp(n){return n>0?1:n<0?-1:0}function V6(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&&UT(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function kc(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 H6(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 BT(n,t){let e=new Ly(n.i,n.x,n.y),i=new Ly(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 fT(n,t,e,i){let s=new Ly(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 qc(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 Ly(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 W6(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 oa=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=[];hT(t),pT(i,t);let c=t.length;e.forEach(hT);for(let p=0;p<e.length;p++)s.push(c),c+=e[p].length,pT(i,e[p]);let f=I6.triangulate(i,s);for(let p=0;p<f.length;p+=3)u.push(f.slice(p,p+3));return u}};function hT(n){let t=n.length;t>2&&n[t-1].equals(n[0])&&n.pop()}function pT(n,t){for(let e=0;e<t.length;e++)n.push(t[e].x),n.push(t[e].y)}var ml=class n extends Ri{constructor(t=new dl([new Ht(.5,.5),new Ht(-.5,.5),new Ht(-.5,-.5),new Ht(.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 Wr(s,3)),this.setAttribute("uv",new Wr(u,2)),this.computeVertexNormals();function c(f){let p=[],d=e.curveSegments!==void 0?e.curveSegments:12,m=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:X6,S,R=!1,z,U,D,P;x&&(S=x.getSpacedPoints(m),R=!0,v=!1,z=x.computeFrenetFrames(m,!1),U=new at,D=new at,P=new at),v||(_=0,E=0,M=0,A=0);let ct=f.extractPoints(d),L=ct.shape,W=ct.holes;if(!oa.isClockWise(L)){L=L.reverse();for(let $=0,Ot=W.length;$<Ot;$++){let _t=W[$];oa.isClockWise(_t)&&(W[$]=_t.reverse())}}let Mt=oa.triangulateShape(L,W),Y=L;for(let $=0,Ot=W.length;$<Ot;$++){let _t=W[$];L=L.concat(_t)}function mt($,Ot,_t){return Ot||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().addScaledVector(Ot,_t)}let ft=L.length,vt=Mt.length;function it($,Ot,_t){let Nt,St,Vt,Xt=$.x-Ot.x,Pt=$.y-Ot.y,ee=_t.x-$.x,X=_t.y-$.y,N=Xt*Xt+Pt*Pt,xt=Xt*X-Pt*ee;if(Math.abs(xt)>Number.EPSILON){let wt=Math.sqrt(N),ot=Math.sqrt(ee*ee+X*X),Lt=Ot.x-Pt/wt,ce=Ot.y+Xt/wt,Rt=_t.x-X/ot,Ut=_t.y+ee/ot,Wt=((Rt-Lt)*X-(Ut-ce)*ee)/(Xt*X-Pt*ee);Nt=Lt+Xt*Wt-$.x,St=ce+Pt*Wt-$.y;let j=Nt*Nt+St*St;if(j<=2)return new Ht(Nt,St);Vt=Math.sqrt(j/2)}else{let wt=!1;Xt>Number.EPSILON?ee>Number.EPSILON&&(wt=!0):Xt<-Number.EPSILON?ee<-Number.EPSILON&&(wt=!0):Math.sign(Pt)===Math.sign(X)&&(wt=!0),wt?(Nt=-Pt,St=Xt,Vt=Math.sqrt(N)):(Nt=Xt,St=Pt,Vt=Math.sqrt(N/2))}return new Ht(Nt/Vt,St/Vt)}let lt=[];for(let $=0,Ot=Y.length,_t=Ot-1,Nt=$+1;$<Ot;$++,_t++,Nt++)_t===Ot&&(_t=0),Nt===Ot&&(Nt=0),lt[$]=it(Y[$],Y[_t],Y[Nt]);let H=[],At,It=lt.concat();for(let $=0,Ot=W.length;$<Ot;$++){let _t=W[$];At=[];for(let Nt=0,St=_t.length,Vt=St-1,Xt=Nt+1;Nt<St;Nt++,Vt++,Xt++)Vt===St&&(Vt=0),Xt===St&&(Xt=0),At[Nt]=it(_t[Nt],_t[Vt],_t[Xt]);H.push(At),It=It.concat(At)}for(let $=0;$<_;$++){let Ot=$/_,_t=E*Math.cos(Ot*Math.PI/2),Nt=M*Math.sin(Ot*Math.PI/2)+A;for(let St=0,Vt=Y.length;St<Vt;St++){let Xt=mt(Y[St],lt[St],Nt);$t(Xt.x,Xt.y,-_t)}for(let St=0,Vt=W.length;St<Vt;St++){let Xt=W[St];At=H[St];for(let Pt=0,ee=Xt.length;Pt<ee;Pt++){let X=mt(Xt[Pt],At[Pt],Nt);$t(X.x,X.y,-_t)}}}let jt=M+A;for(let $=0;$<ft;$++){let Ot=v?mt(L[$],It[$],jt):L[$];R?(D.copy(z.normals[0]).multiplyScalar(Ot.x),U.copy(z.binormals[0]).multiplyScalar(Ot.y),P.copy(S[0]).add(D).add(U),$t(P.x,P.y,P.z)):$t(Ot.x,Ot.y,0)}for(let $=1;$<=m;$++)for(let Ot=0;Ot<ft;Ot++){let _t=v?mt(L[Ot],It[Ot],jt):L[Ot];R?(D.copy(z.normals[$]).multiplyScalar(_t.x),U.copy(z.binormals[$]).multiplyScalar(_t.y),P.copy(S[$]).add(D).add(U),$t(P.x,P.y,P.z)):$t(_t.x,_t.y,y/m*$)}for(let $=_-1;$>=0;$--){let Ot=$/_,_t=E*Math.cos(Ot*Math.PI/2),Nt=M*Math.sin(Ot*Math.PI/2)+A;for(let St=0,Vt=Y.length;St<Vt;St++){let Xt=mt(Y[St],lt[St],Nt);$t(Xt.x,Xt.y,y+_t)}for(let St=0,Vt=W.length;St<Vt;St++){let Xt=W[St];At=H[St];for(let Pt=0,ee=Xt.length;Pt<ee;Pt++){let X=mt(Xt[Pt],At[Pt],Nt);R?$t(X.x,X.y+S[m-1].y,S[m-1].x+_t):$t(X.x,X.y,y+_t)}}}nt(),bt();function nt(){let $=s.length/3;if(v){let Ot=0,_t=ft*Ot;for(let Nt=0;Nt<vt;Nt++){let St=Mt[Nt];Ft(St[2]+_t,St[1]+_t,St[0]+_t)}Ot=m+_*2,_t=ft*Ot;for(let Nt=0;Nt<vt;Nt++){let St=Mt[Nt];Ft(St[0]+_t,St[1]+_t,St[2]+_t)}}else{for(let Ot=0;Ot<vt;Ot++){let _t=Mt[Ot];Ft(_t[2],_t[1],_t[0])}for(let Ot=0;Ot<vt;Ot++){let _t=Mt[Ot];Ft(_t[0]+ft*m,_t[1]+ft*m,_t[2]+ft*m)}}i.addGroup($,s.length/3-$,0)}function bt(){let $=s.length/3,Ot=0;qt(Y,Ot),Ot+=Y.length;for(let _t=0,Nt=W.length;_t<Nt;_t++){let St=W[_t];qt(St,Ot),Ot+=St.length}i.addGroup($,s.length/3-$,1)}function qt($,Ot){let _t=$.length;for(;--_t>=0;){let Nt=_t,St=_t-1;St<0&&(St=$.length-1);for(let Vt=0,Xt=m+_*2;Vt<Xt;Vt++){let Pt=ft*Vt,ee=ft*(Vt+1),X=Ot+Nt+Pt,N=Ot+St+Pt,xt=Ot+St+ee,wt=Ot+Nt+ee;zt(X,N,xt,wt)}}}function $t($,Ot,_t){p.push($),p.push(Ot),p.push(_t)}function Ft($,Ot,_t){Ct($),Ct(Ot),Ct(_t);let Nt=s.length/3,St=T.generateTopUV(i,s,Nt-3,Nt-2,Nt-1);te(St[0]),te(St[1]),te(St[2])}function zt($,Ot,_t,Nt){Ct($),Ct(Ot),Ct(Nt),Ct(Ot),Ct(_t),Ct(Nt);let St=s.length/3,Vt=T.generateSideWallUV(i,s,St-6,St-3,St-2,St-1);te(Vt[0]),te(Vt[1]),te(Vt[3]),te(Vt[1]),te(Vt[2]),te(Vt[3])}function Ct($){s.push(p[$*3+0]),s.push(p[$*3+1]),s.push(p[$*3+2])}function te($){u.push($.x),u.push($.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 Y6(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 Iy[s.type]().fromJSON(s)),new n(i,t.options)}},X6={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],m=t[s*3+1];return[new Ht(u,c),new Ht(f,p),new Ht(d,m)]},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],m=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-m)<Math.abs(c-d)?[new Ht(c,1-p),new Ht(d,1-y),new Ht(v,1-M),new Ht(A,1-x)]:[new Ht(f,1-p),new Ht(m,1-y),new Ht(E,1-M),new Ht(_,1-x)]}};function Y6(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 Vc=class n extends Ri{constructor(t=new dl([new Ht(0,.5),new Ht(-.5,-.5),new Ht(.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 m=0;m<t.length;m++)d(t[m]),this.addGroup(f,p,m),f+=p,p=0;this.setIndex(i),this.setAttribute("position",new Wr(s,3)),this.setAttribute("normal",new Wr(u,3)),this.setAttribute("uv",new Wr(c,2));function d(m){let y=s.length/3,v=m.extractPoints(e),E=v.shape,M=v.holes;oa.isClockWise(E)===!1&&(E=E.reverse());for(let _=0,x=M.length;_<x;_++){let T=M[_];oa.isClockWise(T)===!0&&(M[_]=T.reverse())}let A=oa.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[_],S=T[0]+y,R=T[1]+y,z=T[2]+y;i.push(S,R,z),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 $6(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 $6(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}function ep(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 Z6(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var gl=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_(){}},Ny=class extends gl{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:yA,endingEnd:yA}}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 vA:u=t,f=2*e-i;break;case _A: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 vA:c=t,p=2*i-e;break;case _A:c=1,p=i+s[1]-s[0];break;default:c=t-1,p=e}let d=(i-e)*.5,m=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-i),this._offsetPrev=u*m,this._offsetNext=c*m}interpolate_(t,e,i,s){let u=this.resultBuffer,c=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,m=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,S=(-1-E)*_+(1.5+E)*A+.5*M,R=E*_-E*A;for(let z=0;z!==f;++z)u[z]=x*c[m+z]+T*c[d+z]+S*c[p+z]+R*c[y+z];return u}},Oy=class extends gl{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,m=(i-e)/(s-e),y=1-m;for(let v=0;v!==f;++v)u[v]=c[d+v]*y+c[p+v]*m;return u}},Dy=class extends gl{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}},Io=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=ep(e,this.TimeBufferType),this.values=ep(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:ep(t.times,Array),values:ep(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(i.interpolation=s)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Dy(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Oy(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ny(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case rp:e=this.InterpolantFactoryMethodDiscrete;break;case ip:e=this.InterpolantFactoryMethodLinear;break;case g0: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 rp;case this.InterpolantFactoryMethodLinear:return ip;case this.InterpolantFactoryMethodSmooth:return g0}}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&&Z6(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()===g0,u=t.length-1,c=1;for(let f=1;f<u;++f){let p=!1,d=t[f],m=t[f+1];if(d!==m&&(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}};Io.prototype.TimeBufferType=Float32Array;Io.prototype.ValueBufferType=Float32Array;Io.prototype.DefaultInterpolation=ip;var Qa=class extends Io{};Qa.prototype.ValueTypeName="bool";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=rp;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;var Fy=class extends Io{};Fy.prototype.ValueTypeName="color";var Uy=class extends Io{};Uy.prototype.ValueTypeName="number";var By=class extends gl{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 m=d+f;d!==m;d+=4)Cs.slerpFlat(u,0,c,d-f,c,d,p);return u}},Hc=class extends Io{InterpolantFactoryMethodLinear(t){return new By(this.times,this.values,this.getValueSize(),t)}};Hc.prototype.ValueTypeName="quaternion";Hc.prototype.DefaultInterpolation=ip;Hc.prototype.InterpolantFactoryMethodSmooth=void 0;var tu=class extends Io{};tu.prototype.ValueTypeName="string";tu.prototype.ValueBufferType=Array;tu.prototype.DefaultInterpolation=rp;tu.prototype.InterpolantFactoryMethodLinear=void 0;tu.prototype.InterpolantFactoryMethodSmooth=void 0;var zy=class extends Io{};zy.prototype.ValueTypeName="vector";var Gy=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(m){f++,u===!1&&s.onStart!==void 0&&s.onStart(m,c,f),u=!0},this.itemEnd=function(m){c++,s.onProgress!==void 0&&s.onProgress(m,c,f),c===f&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(m){s.onError!==void 0&&s.onError(m)},this.resolveURL=function(m){return p?p(m):m},this.setURLModifier=function(m){return p=m,this},this.addHandler=function(m,y){return d.push(m,y),this},this.removeHandler=function(m){let y=d.indexOf(m);return y!==-1&&d.splice(y,2),this},this.getHandler=function(m){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(m))return M}return null}}},J6=new Gy,ky=class{constructor(t){this.manager=t!==void 0?t:J6,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}};ky.DEFAULT_MATERIAL_NAME="__DEFAULT";var $y="\\[\\]\\.:\\/",j6=new RegExp("["+$y+"]","g"),Zy="[^"+$y+"]",K6="[^"+$y.replace("\\.","")+"]",Q6=/((?:WC+[\/:])*)/.source.replace("WC",Zy),t8=/(WCOD+)?/.source.replace("WCOD",K6),e8=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Zy),n8=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Zy),r8=new RegExp("^"+Q6+t8+e8+n8+"$"),i8=["material","materials","bones","map"],qy=class{constructor(t,e,i){let s=i||Xn.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()}},Xn=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(j6,"")}static parseTrackName(t){let e=r8.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);i8.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 m=0;m<t.length;m++)if(t[m].name===d){d=m;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[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}};Xn.Composite=qy;Xn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Xn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Xn.prototype.GetterByBindingType=[Xn.prototype._getValue_direct,Xn.prototype._getValue_array,Xn.prototype._getValue_arrayElement,Xn.prototype._getValue_toArray];Xn.prototype.SetterByBindingTypeAndVersioning=[[Xn.prototype._setValue_direct,Xn.prototype._setValue_direct_setNeedsUpdate,Xn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Xn.prototype._setValue_array,Xn.prototype._setValue_array_setNeedsUpdate,Xn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Xn.prototype._setValue_arrayElement,Xn.prototype._setValue_arrayElement_setNeedsUpdate,Xn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Xn.prototype._setValue_fromArray,Xn.prototype._setValue_fromArray_setNeedsUpdate,Xn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var nQ=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vy}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vy);var yQ=ue(av(),1),vQ=ue(hc(),1);function vl(n,t){t===void 0&&(t=[]);let e=new dl(n.map(i=>new Ht(...i)));return t.length&&t.forEach(i=>{var s=new pl(i.map(u=>new Ht(...u)));e.holes.push(s)}),e}var Or=63710088e-1,IQ={centimeters:Or*100,centimetres:Or*100,degrees:Or/111325,feet:Or*3.28084,inches:Or*39.37,kilometers:Or/1e3,kilometres:Or/1e3,meters:Or,metres:Or,miles:Or/1609.344,millimeters:Or*1e3,millimetres:Or*1e3,nauticalmiles:Or/1852,radians:1,yards:Or*1.0936},PQ={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/Or,yards:1.0936133};function wi(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 zn(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(!Zo(n[0])||!Zo(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return wi(i,t,e)}function Gn(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 wi(f,t,e)}function Dr(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 wi(i,t,e)}function gv(n,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:n};return wi(i,t,e)}function Zo(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function _r(n,t,e){if(n!==null)for(var i,s,u,c,f,p,d,m=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 S=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var z=c.type;switch(m=e&&(z==="Polygon"||z==="MultiPolygon")?1:0,z){case null:break;case"Point":if(t(p,y,x,S,R)===!1)return!1;y++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<p.length;i++){if(t(p[i],y,x,S,R)===!1)return!1;y++,z==="MultiPoint"&&S++}z==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<p.length;i++){for(s=0;s<p[i].length-m;s++){if(t(p[i][s],y,x,S,R)===!1)return!1;y++}z==="MultiLineString"&&S++,z==="Polygon"&&R++}z==="Polygon"&&S++;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-m;u++){if(t(p[i][s][u],y,x,S,R)===!1)return!1;y++}R++}S++}break;case"GeometryCollection":for(i=0;i<c.geometries.length;i++)if(_r(c.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function LC(n,t,e,i){var s=e;return _r(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 la(n,t){var e,i,s,u,c,f,p,d,m,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:{},m=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,m,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,m,y)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<u.geometries.length;i++)if(t(u.geometries[i],v,d,m,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Wi(n,t){la(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(wi(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 m=e.coordinates[d],y={type:p,coordinates:m};if(t(wi(y,s),i,d)===!1)return!1}})}function yv(n){var t=[1/0,1/0,-1/0,-1/0];return _r(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}yv.default=yv;var Si=yv;function Xr(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 vv(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 Yr(n){return n.type==="Feature"?n.geometry:n}var EW=ue(Gp(),1);var RW=ue(JC(),1);function Fr(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=Xr(n),s=Yr(t),u=s.type,c=t.bbox,f=s.coordinates;if(c&&LW(i,c)===!1)return!1;u==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(jC(i,f[d][0],e.ignoreBoundary)){for(var m=!1,y=1;y<f[d].length&&!m;)jC(i,f[d][y],!e.ignoreBoundary)&&(m=!0),y++;m||(p=!0)}return p}function jC(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],m=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(m)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 LW(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var tI=new ArrayBuffer(16),oet=new Float64Array(tI),set=new Uint32Array(tI);var YW=ue(Ov(),1);var Ont=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 $W(u,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function $W(n,t,e,i,s){var u=ZW(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 ZW(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 jc(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 Gn([[c,d,p,f,c]],t.properties,{bbox:n,id:t.id})}function JW(n){return jc(Si(n))}var Dv=JW;var pX=ue(fI(),1);var GX=ue(rd(),1);var qX=ue(Gp(),1);var WX=ue(Ov(),1);var II=Math.PI/180,PI=180/Math.PI,of=function(n,t){this.lon=n,this.lat=t,this.x=II*n,this.y=II*t};of.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};of.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new of(t,n)};var RI=function(){this.coords=[],this.length=0};RI.prototype.move_to=function(n){this.length++,this.coords.push(n)};var e_=function(n){this.properties=n||{},this.geometries=[]};e_.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}};e_.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 LI=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 of(n.x,n.y),this.end=new of(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)};LI.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=PI*Math.atan2(u,Math.sqrt(Math.pow(i,2)+Math.pow(s,2))),f=PI*Math.atan2(s,i);return[f,c]};LI.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,m=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>m&&M<y||M>m&&A<y)?f=!0:_>p&&(p=_)}var x=[];if(f&&p<d){var T=[];x.push(T);for(var S=0;S<e.length;++S){var R=parseFloat(e[S][0]);if(S>0&&Math.abs(R-e[S-1][0])>v){var z=parseFloat(e[S-1][0]),U=parseFloat(e[S-1][1]),D=parseFloat(e[S][0]),P=parseFloat(e[S][1]);if(z>-180&&z<y&&D===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<y){T.push([-180,e[S][1]]),S++,T.push([e[S][0],e[S][1]]);continue}else if(z>m&&z<180&&D===-180&&S+1<e.length&&e[S-1][0]>m&&e[S-1][0]<180){T.push([180,e[S][1]]),S++,T.push([e[S][0],e[S][1]]);continue}if(z<y&&D>m){var ct=z;z=D,D=ct;var L=U;U=P,P=L}if(z>m&&D<y&&(D+=360),z<=180&&D>=180&&z<D){var W=(180-z)/(D-z),V=W*P+(1-W)*U;T.push([e[S-1][0]>m?180:-180,V]),T=[],T.push([e[S-1][0]>m?-180:180,V]),x.push(T)}else T=[],x.push(T);T.push([R,e[S][1]])}else T.push([e[S][0],e[S][1]])}}else{var Mt=[];x.push(Mt);for(var Y=0;Y<e.length;++Y)Mt.push([e[Y][0],e[Y][1]])}for(var mt=new e_(this.properties),ft=0;ft<x.length;++ft){var vt=new RI;mt.geometries.push(vt);for(var it=x[ft],lt=0;lt<it.length;++lt)vt.move_to(it[lt])}return mt};var $X=ue(rd(),1);var Y7=ue(rd(),1);var $7=ue(I_(),1);var j7=ue(Gp(),1);var Te=[],Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[],$e=[],Ze=[],Je=[];Ne[85]=Fe[85]=-1;Oe[85]=Ue[85]=0;De[85]=Be[85]=1;We[85]=$e[85]=1;Xe[85]=Ze[85]=0;Ye[85]=Je[85]=1;Te[85]=Pe[85]=0;Ce[85]=Re[85]=-1;Ie[85]=ke[85]=0;qe[85]=ze[85]=0;Ve[85]=Ge[85]=1;Le[85]=He[85]=1;$e[1]=$e[169]=0;Ze[1]=Ze[169]=-1;Je[1]=Je[169]=0;ze[1]=ze[169]=-1;Ge[1]=Ge[169]=0;ke[1]=ke[169]=0;Fe[4]=Fe[166]=0;Ue[4]=Ue[166]=-1;Be[4]=Be[166]=1;qe[4]=qe[166]=1;Ve[4]=Ve[166]=0;He[4]=He[166]=0;Ne[16]=Ne[154]=0;Oe[16]=Oe[154]=1;De[16]=De[154]=1;Pe[16]=Pe[154]=1;Re[16]=Re[154]=0;Le[16]=Le[154]=1;We[64]=We[106]=0;Xe[64]=Xe[106]=1;Ye[64]=Ye[106]=0;Te[64]=Te[106]=-1;Ce[64]=Ce[106]=0;Ie[64]=Ie[106]=1;We[2]=We[168]=0;Xe[2]=Xe[168]=-1;Ye[2]=Ye[168]=1;$e[2]=$e[168]=0;Ze[2]=Ze[168]=-1;Je[2]=Je[168]=0;ze[2]=ze[168]=-1;Ge[2]=Ge[168]=0;ke[2]=ke[168]=0;qe[2]=qe[168]=-1;Ve[2]=Ve[168]=0;He[2]=He[168]=1;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=-1;De[8]=De[162]=0;Fe[8]=Fe[162]=0;Ue[8]=Ue[162]=-1;Be[8]=Be[162]=1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=0;ke[8]=ke[162]=1;qe[8]=qe[162]=1;Ve[8]=Ve[162]=0;He[8]=He[162]=0;Ne[32]=Ne[138]=0;Oe[32]=Oe[138]=1;De[32]=De[138]=1;Fe[32]=Fe[138]=0;Ue[32]=Ue[138]=1;Be[32]=Be[138]=0;Te[32]=Te[138]=1;Ce[32]=Ce[138]=0;Ie[32]=Ie[138]=0;Pe[32]=Pe[138]=1;Re[32]=Re[138]=0;Le[32]=Le[138]=1;$e[128]=$e[42]=0;Ze[128]=Ze[42]=1;Je[128]=Je[42]=1;We[128]=We[42]=0;Xe[128]=Xe[42]=1;Ye[128]=Ye[42]=0;Te[128]=Te[42]=-1;Ce[128]=Ce[42]=0;Ie[128]=Ie[42]=1;Pe[128]=Pe[42]=-1;Re[128]=Re[42]=0;Le[128]=Le[42]=0;Fe[5]=Fe[165]=-1;Ue[5]=Ue[165]=0;Be[5]=Be[165]=0;$e[5]=$e[165]=1;Ze[5]=Ze[165]=0;Je[5]=Je[165]=0;qe[20]=qe[150]=0;Ve[20]=Ve[150]=1;He[20]=He[150]=1;Pe[20]=Pe[150]=0;Re[20]=Re[150]=-1;Le[20]=Le[150]=1;Ne[80]=Ne[90]=-1;Oe[80]=Oe[90]=0;De[80]=De[90]=1;We[80]=We[90]=1;Xe[80]=Xe[90]=0;Ye[80]=Ye[90]=1;ze[65]=ze[105]=0;Ge[65]=Ge[105]=1;ke[65]=ke[105]=0;Te[65]=Te[105]=0;Ce[65]=Ce[105]=-1;Ie[65]=Ie[105]=0;Ne[160]=Ne[10]=-1;Oe[160]=Oe[10]=0;De[160]=De[10]=1;Fe[160]=Fe[10]=-1;Ue[160]=Ue[10]=0;Be[160]=Be[10]=0;$e[160]=$e[10]=1;Ze[160]=Ze[10]=0;Je[160]=Je[10]=0;We[160]=We[10]=1;Xe[160]=Xe[10]=0;Ye[160]=Ye[10]=1;qe[130]=qe[40]=0;Ve[130]=Ve[40]=1;He[130]=He[40]=1;ze[130]=ze[40]=0;Ge[130]=Ge[40]=1;ke[130]=ke[40]=0;Te[130]=Te[40]=0;Ce[130]=Ce[40]=-1;Ie[130]=Ie[40]=0;Pe[130]=Pe[40]=0;Re[130]=Re[40]=-1;Le[130]=Le[40]=1;Fe[37]=Fe[133]=0;Ue[37]=Ue[133]=1;Be[37]=Be[133]=1;$e[37]=$e[133]=0;Ze[37]=Ze[133]=1;Je[37]=Je[133]=0;Te[37]=Te[133]=-1;Ce[37]=Ce[133]=0;Ie[37]=Ie[133]=0;Pe[37]=Pe[133]=1;Re[37]=Re[133]=0;Le[37]=Le[133]=0;qe[148]=qe[22]=-1;Ve[148]=Ve[22]=0;He[148]=He[22]=0;$e[148]=$e[22]=0;Ze[148]=Ze[22]=-1;Je[148]=Je[22]=1;We[148]=We[22]=0;Xe[148]=Xe[22]=1;Ye[148]=Ye[22]=1;Pe[148]=Pe[22]=-1;Re[148]=Re[22]=0;Le[148]=Le[22]=1;Ne[82]=Ne[88]=0;Oe[82]=Oe[88]=-1;De[82]=De[88]=1;qe[82]=qe[88]=1;Ve[82]=Ve[88]=0;He[82]=He[88]=1;ze[82]=ze[88]=-1;Ge[82]=Ge[88]=0;ke[82]=ke[88]=1;We[82]=We[88]=0;Xe[82]=Xe[88]=-1;Ye[82]=Ye[88]=0;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=1;De[73]=De[97]=0;Fe[73]=Fe[97]=0;Ue[73]=Ue[97]=-1;Be[73]=Be[97]=0;ze[73]=ze[97]=1;Ge[73]=Ge[97]=0;ke[73]=ke[97]=0;Te[73]=Te[97]=1;Ce[73]=Ce[97]=0;Ie[73]=Ie[97]=1;Ne[145]=Ne[25]=0;Oe[145]=Oe[25]=-1;De[145]=De[25]=0;ze[145]=ze[25]=1;Ge[145]=Ge[25]=0;ke[145]=ke[25]=1;$e[145]=$e[25]=0;Ze[145]=Ze[25]=1;Je[145]=Je[25]=1;Pe[145]=Pe[25]=-1;Re[145]=Re[25]=0;Le[145]=Le[25]=0;Fe[70]=Fe[100]=0;Ue[70]=Ue[100]=1;Be[70]=Be[100]=0;qe[70]=qe[100]=-1;Ve[70]=Ve[100]=0;He[70]=He[100]=1;We[70]=We[100]=0;Xe[70]=Xe[100]=-1;Ye[70]=Ye[100]=1;Te[70]=Te[100]=1;Ce[70]=Ce[100]=0;Ie[70]=Ie[100]=0;Fe[101]=Fe[69]=0;Ue[101]=Ue[69]=1;Be[101]=Be[69]=0;Te[101]=Te[69]=1;Ce[101]=Ce[69]=0;Ie[101]=Ie[69]=0;$e[149]=$e[21]=0;Ze[149]=Ze[21]=1;Je[149]=Je[21]=1;Pe[149]=Pe[21]=-1;Re[149]=Re[21]=0;Le[149]=Le[21]=0;qe[86]=qe[84]=-1;Ve[86]=Ve[84]=0;He[86]=He[84]=1;We[86]=We[84]=0;Xe[86]=Xe[84]=-1;Ye[86]=Ye[84]=1;Ne[89]=Ne[81]=0;Oe[89]=Oe[81]=-1;De[89]=De[81]=0;ze[89]=ze[81]=1;Ge[89]=Ge[81]=0;ke[89]=ke[81]=1;Ne[96]=Ne[74]=0;Oe[96]=Oe[74]=1;De[96]=De[74]=0;Fe[96]=Fe[74]=-1;Ue[96]=Ue[74]=0;Be[96]=Be[74]=1;We[96]=We[74]=1;Xe[96]=Xe[74]=0;Ye[96]=Ye[74]=0;Te[96]=Te[74]=1;Ce[96]=Ce[74]=0;Ie[96]=Ie[74]=1;Ne[24]=Ne[146]=0;Oe[24]=Oe[146]=-1;De[24]=De[146]=1;qe[24]=qe[146]=1;Ve[24]=Ve[146]=0;He[24]=He[146]=1;ze[24]=ze[146]=0;Ge[24]=Ge[146]=1;ke[24]=ke[146]=1;Pe[24]=Pe[146]=0;Re[24]=Re[146]=-1;Le[24]=Le[146]=0;Fe[6]=Fe[164]=-1;Ue[6]=Ue[164]=0;Be[6]=Be[164]=1;qe[6]=qe[164]=-1;Ve[6]=Ve[164]=0;He[6]=He[164]=0;$e[6]=$e[164]=0;Ze[6]=Ze[164]=-1;Je[6]=Je[164]=1;We[6]=We[164]=1;Xe[6]=Xe[164]=0;Ye[6]=Ye[164]=0;ze[129]=ze[41]=0;Ge[129]=Ge[41]=1;ke[129]=ke[41]=1;$e[129]=$e[41]=0;Ze[129]=Ze[41]=1;Je[129]=Je[41]=0;Te[129]=Te[41]=-1;Ce[129]=Ce[41]=0;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=0;Re[129]=Re[41]=-1;Le[129]=Le[41]=0;qe[66]=qe[104]=0;Ve[66]=Ve[104]=1;He[66]=He[104]=0;ze[66]=ze[104]=-1;Ge[66]=Ge[104]=0;ke[66]=ke[104]=1;We[66]=We[104]=0;Xe[66]=Xe[104]=-1;Ye[66]=Ye[104]=0;Te[66]=Te[104]=0;Ce[66]=Ce[104]=-1;Ie[66]=Ie[104]=1;Ne[144]=Ne[26]=-1;Oe[144]=Oe[26]=0;De[144]=De[26]=0;$e[144]=$e[26]=1;Ze[144]=Ze[26]=0;Je[144]=Je[26]=1;We[144]=We[26]=0;Xe[144]=Xe[26]=1;Ye[144]=Ye[26]=1;Pe[144]=Pe[26]=-1;Re[144]=Re[26]=0;Le[144]=Le[26]=1;Fe[36]=Fe[134]=0;Ue[36]=Ue[134]=1;Be[36]=Be[134]=1;qe[36]=qe[134]=0;Ve[36]=Ve[134]=1;He[36]=He[134]=0;Te[36]=Te[134]=0;Ce[36]=Ce[134]=-1;Ie[36]=Ie[134]=1;Pe[36]=Pe[134]=1;Re[36]=Re[134]=0;Le[36]=Le[134]=0;Ne[9]=Ne[161]=-1;Oe[9]=Oe[161]=0;De[9]=De[161]=0;Fe[9]=Fe[161]=0;Ue[9]=Ue[161]=-1;Be[9]=Be[161]=0;ze[9]=ze[161]=1;Ge[9]=Ge[161]=0;ke[9]=ke[161]=0;$e[9]=$e[161]=1;Ze[9]=Ze[161]=0;Je[9]=Je[161]=1;Ne[136]=0;Oe[136]=1;De[136]=1;Fe[136]=0;Ue[136]=1;Be[136]=0;qe[136]=-1;Ve[136]=0;He[136]=1;ze[136]=-1;Ge[136]=0;ke[136]=0;$e[136]=0;Ze[136]=-1;Je[136]=0;We[136]=0;Xe[136]=-1;Ye[136]=1;Te[136]=1;Ce[136]=0;Ie[136]=0;Pe[136]=1;Re[136]=0;Le[136]=1;Ne[34]=0;Oe[34]=-1;De[34]=0;Fe[34]=0;Ue[34]=-1;Be[34]=1;qe[34]=1;Ve[34]=0;He[34]=0;ze[34]=1;Ge[34]=0;ke[34]=1;$e[34]=0;Ze[34]=1;Je[34]=1;We[34]=0;Xe[34]=1;Ye[34]=0;Te[34]=-1;Ce[34]=0;Ie[34]=1;Pe[34]=-1;Re[34]=0;Le[34]=0;Ne[35]=0;Oe[35]=1;De[35]=1;Fe[35]=0;Ue[35]=-1;Be[35]=1;qe[35]=1;Ve[35]=0;He[35]=0;ze[35]=-1;Ge[35]=0;ke[35]=0;$e[35]=0;Ze[35]=-1;Je[35]=0;We[35]=0;Xe[35]=1;Ye[35]=0;Te[35]=-1;Ce[35]=0;Ie[35]=1;Pe[35]=1;Re[35]=0;Le[35]=1;Ne[153]=0;Oe[153]=1;De[153]=1;ze[153]=-1;Ge[153]=0;ke[153]=0;$e[153]=0;Ze[153]=-1;Je[153]=0;Pe[153]=1;Re[153]=0;Le[153]=1;Fe[102]=0;Ue[102]=-1;Be[102]=1;qe[102]=1;Ve[102]=0;He[102]=0;We[102]=0;Xe[102]=1;Ye[102]=0;Te[102]=-1;Ce[102]=0;Ie[102]=1;Ne[155]=0;Oe[155]=-1;De[155]=0;ze[155]=1;Ge[155]=0;ke[155]=1;$e[155]=0;Ze[155]=1;Je[155]=1;Pe[155]=-1;Re[155]=0;Le[155]=0;Fe[103]=0;Ue[103]=1;Be[103]=0;qe[103]=-1;Ve[103]=0;He[103]=1;We[103]=0;Xe[103]=-1;Ye[103]=1;Te[103]=1;Ce[103]=0;Ie[103]=0;Ne[152]=0;Oe[152]=1;De[152]=1;qe[152]=-1;Ve[152]=0;He[152]=1;ze[152]=-1;Ge[152]=0;ke[152]=0;$e[152]=0;Ze[152]=-1;Je[152]=0;We[152]=0;Xe[152]=-1;Ye[152]=1;Pe[152]=1;Re[152]=0;Le[152]=1;Ne[156]=0;Oe[156]=-1;De[156]=1;qe[156]=1;Ve[156]=0;He[156]=1;ze[156]=-1;Ge[156]=0;ke[156]=0;$e[156]=0;Ze[156]=-1;Je[156]=0;We[156]=0;Xe[156]=1;Ye[156]=1;Pe[156]=-1;Re[156]=0;Le[156]=1;Ne[137]=0;Oe[137]=1;De[137]=1;Fe[137]=0;Ue[137]=1;Be[137]=0;ze[137]=-1;Ge[137]=0;ke[137]=0;$e[137]=0;Ze[137]=-1;Je[137]=0;Te[137]=1;Ce[137]=0;Ie[137]=0;Pe[137]=1;Re[137]=0;Le[137]=1;Ne[139]=0;Oe[139]=1;De[139]=1;Fe[139]=0;Ue[139]=-1;Be[139]=0;ze[139]=1;Ge[139]=0;ke[139]=0;$e[139]=0;Ze[139]=1;Je[139]=0;Te[139]=-1;Ce[139]=0;Ie[139]=0;Pe[139]=1;Re[139]=0;Le[139]=1;Ne[98]=0;Oe[98]=-1;De[98]=0;Fe[98]=0;Ue[98]=-1;Be[98]=1;qe[98]=1;Ve[98]=0;He[98]=0;ze[98]=1;Ge[98]=0;ke[98]=1;We[98]=0;Xe[98]=1;Ye[98]=0;Te[98]=-1;Ce[98]=0;Ie[98]=1;Ne[99]=0;Oe[99]=1;De[99]=0;Fe[99]=0;Ue[99]=-1;Be[99]=1;qe[99]=1;Ve[99]=0;He[99]=0;ze[99]=-1;Ge[99]=0;ke[99]=1;We[99]=0;Xe[99]=-1;Ye[99]=0;Te[99]=1;Ce[99]=0;Ie[99]=1;Fe[38]=0;Ue[38]=-1;Be[38]=1;qe[38]=1;Ve[38]=0;He[38]=0;$e[38]=0;Ze[38]=1;Je[38]=1;We[38]=0;Xe[38]=1;Ye[38]=0;Te[38]=-1;Ce[38]=0;Ie[38]=1;Pe[38]=-1;Re[38]=0;Le[38]=0;Fe[39]=0;Ue[39]=1;Be[39]=1;qe[39]=-1;Ve[39]=0;He[39]=0;$e[39]=0;Ze[39]=-1;Je[39]=1;We[39]=0;Xe[39]=1;Ye[39]=0;Te[39]=-1;Ce[39]=0;Ie[39]=1;Pe[39]=1;Re[39]=0;Le[39]=0;var P_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},R_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},L_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},N_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},O_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},D_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},F_=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},U_=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},K7=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},Q7=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},tY=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},eY=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},nY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},rY=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},iY=function(){return[[0,0],[0,1],[1,1],[1,0]]},oY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},sY=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},aY=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},uY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},lY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},cY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},fY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},hY=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},pY=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},dY=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},mY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},gY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},yY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},vY=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},_Y=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},xY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},EY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},wY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},SY=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]]},MY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},bY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},AY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},TY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},CY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},IY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},tn=[],en=[],nn=[],rn=[],on=[],sn=[],an=[],un=[];rn[1]=on[1]=18;rn[169]=on[169]=18;nn[4]=en[4]=12;nn[166]=en[166]=12;tn[16]=un[16]=4;tn[154]=un[154]=4;sn[64]=an[64]=22;sn[106]=an[106]=22;nn[2]=sn[2]=17;rn[2]=on[2]=18;nn[168]=sn[168]=17;rn[168]=on[168]=18;tn[8]=rn[8]=9;en[8]=nn[8]=12;tn[162]=rn[162]=9;en[162]=nn[162]=12;tn[32]=un[32]=4;en[32]=an[32]=1;tn[138]=un[138]=4;en[138]=an[138]=1;on[128]=un[128]=21;sn[128]=an[128]=22;on[42]=un[42]=21;sn[42]=an[42]=22;en[5]=on[5]=14;en[165]=on[165]=14;nn[20]=un[20]=6;nn[150]=un[150]=6;tn[80]=sn[80]=11;tn[90]=sn[90]=11;rn[65]=an[65]=3;rn[105]=an[105]=3;tn[160]=sn[160]=11;en[160]=on[160]=14;tn[10]=sn[10]=11;en[10]=on[10]=14;nn[130]=un[130]=6;rn[130]=an[130]=3;nn[40]=un[40]=6;rn[40]=an[40]=3;en[101]=an[101]=1;en[69]=an[69]=1;on[149]=un[149]=21;on[21]=un[21]=21;nn[86]=sn[86]=17;nn[84]=sn[84]=17;tn[89]=rn[89]=9;tn[81]=rn[81]=9;tn[96]=an[96]=0;en[96]=sn[96]=15;tn[74]=an[74]=0;en[74]=sn[74]=15;tn[24]=nn[24]=8;rn[24]=un[24]=7;tn[146]=nn[146]=8;rn[146]=un[146]=7;en[6]=sn[6]=15;nn[6]=on[6]=16;en[164]=sn[164]=15;nn[164]=on[164]=16;rn[129]=un[129]=7;on[129]=an[129]=20;rn[41]=un[41]=7;on[41]=an[41]=20;nn[66]=an[66]=2;rn[66]=sn[66]=19;nn[104]=an[104]=2;rn[104]=sn[104]=19;tn[144]=on[144]=10;sn[144]=un[144]=23;tn[26]=on[26]=10;sn[26]=un[26]=23;en[36]=un[36]=5;nn[36]=an[36]=2;en[134]=un[134]=5;nn[134]=an[134]=2;tn[9]=on[9]=10;en[9]=rn[9]=13;tn[161]=on[161]=10;en[161]=rn[161]=13;en[37]=un[37]=5;on[37]=an[37]=20;en[133]=un[133]=5;on[133]=an[133]=20;nn[148]=on[148]=16;sn[148]=un[148]=23;nn[22]=on[22]=16;sn[22]=un[22]=23;tn[82]=nn[82]=8;rn[82]=sn[82]=19;tn[88]=nn[88]=8;rn[88]=sn[88]=19;tn[73]=an[73]=0;en[73]=rn[73]=13;tn[97]=an[97]=0;en[97]=rn[97]=13;tn[145]=rn[145]=9;on[145]=un[145]=21;tn[25]=rn[25]=9;on[25]=un[25]=21;en[70]=an[70]=1;nn[70]=sn[70]=17;en[100]=an[100]=1;nn[100]=sn[100]=17;tn[34]=rn[34]=9;en[34]=nn[34]=12;on[34]=un[34]=21;sn[34]=an[34]=22;tn[136]=un[136]=4;en[136]=an[136]=1;nn[136]=sn[136]=17;rn[136]=on[136]=18;tn[35]=un[35]=4;en[35]=nn[35]=12;rn[35]=on[35]=18;sn[35]=an[35]=22;tn[153]=un[153]=4;rn[153]=on[153]=18;en[102]=nn[102]=12;sn[102]=an[102]=22;tn[155]=rn[155]=9;on[155]=un[155]=23;en[103]=an[103]=1;nn[103]=sn[103]=17;tn[152]=un[152]=4;nn[152]=sn[152]=17;rn[152]=on[152]=18;tn[156]=nn[156]=8;rn[156]=on[156]=18;sn[156]=un[156]=23;tn[137]=un[137]=4;en[137]=an[137]=1;rn[137]=on[137]=18;tn[139]=un[139]=4;en[139]=rn[139]=13;on[139]=an[139]=20;tn[98]=rn[98]=9;en[98]=nn[98]=12;sn[98]=an[98]=22;tn[99]=an[99]=0;en[99]=nn[99]=12;rn[99]=sn[99]=19;en[38]=nn[38]=12;on[38]=un[38]=21;sn[38]=an[38]=22;en[39]=un[39]=5;nn[39]=on[39]=16;sn[39]=an[39]=22;var Yt=[];Yt[1]=Yt[169]=P_;Yt[4]=Yt[166]=R_;Yt[16]=Yt[154]=L_;Yt[64]=Yt[106]=N_;Yt[168]=Yt[2]=O_;Yt[162]=Yt[8]=D_;Yt[138]=Yt[32]=F_;Yt[42]=Yt[128]=U_;Yt[5]=Yt[165]=K7;Yt[20]=Yt[150]=Q7;Yt[80]=Yt[90]=tY;Yt[65]=Yt[105]=eY;Yt[160]=Yt[10]=nY;Yt[130]=Yt[40]=rY;Yt[85]=iY;Yt[101]=Yt[69]=oY;Yt[149]=Yt[21]=sY;Yt[86]=Yt[84]=aY;Yt[89]=Yt[81]=uY;Yt[96]=Yt[74]=lY;Yt[24]=Yt[146]=cY;Yt[6]=Yt[164]=fY;Yt[129]=Yt[41]=hY;Yt[66]=Yt[104]=pY;Yt[144]=Yt[26]=dY;Yt[36]=Yt[134]=mY;Yt[9]=Yt[161]=gY;Yt[37]=Yt[133]=yY;Yt[148]=Yt[22]=vY;Yt[82]=Yt[88]=_Y;Yt[73]=Yt[97]=xY;Yt[145]=Yt[25]=EY;Yt[70]=Yt[100]=wY;Yt[34]=function(n){return[U_(n),D_(n)]};Yt[35]=SY;Yt[136]=function(n){return[F_(n),O_(n)]};Yt[153]=function(n){return[L_(n),P_(n)]};Yt[102]=function(n){return[R_(n),N_(n)]};Yt[155]=MY;Yt[103]=bY;Yt[152]=function(n){return[L_(n),O_(n)]};Yt[156]=AY;Yt[137]=function(n){return[F_(n),P_(n)]};Yt[139]=TY;Yt[98]=function(n){return[D_(n),N_(n)]};Yt[99]=CY;Yt[38]=function(n){return[R_(n),U_(n)]};Yt[39]=IY;function RY(n){return(n>0)-(n<0)||+n}function Dl(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 RY(i*c-u*s)}function _L(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 B_(n,t){return t.geometry.coordinates[0].every(function(e){return Fr(zn(e),n)})}function xL(n,t){return n[0]===t[0]&&n[1]===t[1]}var LY=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=Dl(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}(),z_=LY;var NY=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 Dr([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return Dl(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),EL=NY;var OY=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=Dl(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 gv(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=Gn([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Dv(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()),!_L(f,i)&&B_(f,i)){for(var p=t.map(function(M){return M.from.coordinates}),d=void 0,m=function(M){c.some(function(A){return xL(M,A.from.coordinates)})||(d=M)},y=0,v=p;y<v.length;y++){var E=v[y];m(E)}d&&c.inside(zn(d))&&(!u||B_(s,f))&&(u=c)}}),u},n.prototype.inside=function(t){return Fr(t,this.toPolygon())},n}(),G_=OY;function DY(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 qut=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){DY(t);var e=new n;return Wi(t,function(i){vv(i,"LineString","Graph::fromGeoJson"),LC(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=z_.buildId(t),i=this.nodes[e];return i||(i=this.nodes[e]=new z_(t)),i},n.prototype.addEdge=function(t,e){var i=new EL(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,m=void 0;f.label===e&&(d=f),p.label===e&&(m=p),!(!d||!m)&&(m&&(u=m),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 G_;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 zY=ue(k_(),1);var GY=ue(k_(),1);var qY=ue(PL(),1);var ZY=ue(GL(),1);function qL(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function jY(){return new VL(function(n){return n.f})}var W_={search:function(n,t,e,i){n.cleanDirty(),i=i||{};var s=i.heuristic||W_.heuristics.manhattan,u=i.closest||!1,c=jY(),f=t;for(t.h=s(t,e),c.push(t);c.size()>0;){var p=c.pop();if(p===e)return qL(p);p.closed=!0;for(var d=n.neighbors(p),m=0,y=d.length;m<y;++m){var v=d[m];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?qL(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 df(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 Pd(e,i,s[i]);this.grid[e][i]=u,this.nodes.push(u)}}this.init()}df.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)W_.cleanNode(this.nodes[n])};df.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)W_.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};df.prototype.markDirty=function(n){this.dirtyNodes.push(n)};df.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};df.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 Pd(n,t,e){this.x=n,this.y=t,this.weight=e}Pd.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Pd.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Pd.prototype.isWall=function(){return this.weight===0};function VL(n){this.content=[],this.scoreFunction=n}VL.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],m=this.scoreFunction(d);m<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function X_(){this._=null}function Ul(n){n.U=n.C=n.L=n.R=n.P=n.N=null}X_.prototype={constructor:X_,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=HL(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&&(mf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,gf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(gf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,mf(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=HL(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,mf(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,gf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,mf(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,gf(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,mf(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,gf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function mf(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 gf(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 HL(n){for(;n.L;)n=n.L;return n}var Y_=X_;function Bl(n,t,e,i){var s=[null,null],u=Br.push(s)-1;return s.left=n,s.right=t,e&&yf(s,n,t,e),i&&yf(s,t,n,i),Mi[n.index].halfedges.push(u),Mi[t.index].halfedges.push(u),s}function zl(n,t,e){var i=[t,e];return i.left=n,i}function yf(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 KY(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],m=c[1],y=0,v=1,E=d-f,M=m-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 QY(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],m=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(m+v)/2,A,_;if(v===m){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-m),_=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(m<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 WL(n,t,e,i){for(var s=Br.length,u;s--;)(!QY(u=Br[s],n,t,e,i)||!KY(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Pn||Math.abs(u[0][1]-u[1][1])>Pn))&&delete Br[s]}function XL(n){return Mi[n.index]={site:n,halfedges:[]}}function t$(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 $_(n,t){return t[+(t.left!==n.site)]}function e$(n,t){return t[+(t.left===n.site)]}function YL(){for(var n=0,t=Mi.length,e,i,s,u;n<t;++n)if((e=Mi[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]=t$(e,Br[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 $L(n,t,e,i){var s=Mi.length,u,c,f,p,d,m,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Mi[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)Br[d[p]]||d.splice(p,1);for(p=0,m=d.length;p<m;)M=e$(c,Br[d[p]]),A=M[0],_=M[1],y=$_(c,Br[d[++p%m]]),v=y[0],E=y[1],(Math.abs(A-v)>Pn||Math.abs(_-E)>Pn)&&(d.splice(p,0,Br.push(zl(f,M,Math.abs(A-n)<Pn&&i-_>Pn?[n,Math.abs(v-n)<Pn?E:i]:Math.abs(_-i)<Pn&&e-A>Pn?[Math.abs(E-i)<Pn?v:e,i]:Math.abs(A-e)<Pn&&_-t>Pn?[e,Math.abs(v-e)<Pn?E:t]:Math.abs(_-t)<Pn&&A-n>Pn?[Math.abs(E-t)<Pn?v:n,t]:null))-1),++m);m&&(x=!1)}if(x){var T,S,R,z=1/0;for(u=0,x=null;u<s;++u)(c=Mi[u])&&(f=c.site,T=f[0]-n,S=f[1]-t,R=T*T+S*S,R<z&&(z=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(Br.push(zl(f=x.site,U,D))-1,Br.push(zl(f,D,P))-1,Br.push(zl(f,P,ct))-1,Br.push(zl(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Mi[u])&&(c.halfedges.length||delete Mi[u])}var ZL=[],Rd;function n$(){Ul(this),this.x=this.y=this.arc=this.site=this.cy=null}function ou(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,m=u[0]-c,y=u[1]-f,v=2*(p*y-d*m);if(!(v>=-JL)){var E=p*p+d*d,M=m*m+y*y,A=(y*E-d*M)/v,_=(p*M-m*E)/v,x=ZL.pop()||new n$;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,S=Gl._;S;)if(x.y<S.y||x.y===S.y&&x.x<=S.x)if(S.L)S=S.L;else{T=S.P;break}else if(S.R)S=S.R;else{T=S;break}Gl.insert(T,x),T||(Rd=x)}}}}function su(n){var t=n.circle;t&&(t.P||(Rd=t.N),Gl.remove(t),ZL.push(t),Ul(t),n.circle=null)}var KL=[];function r$(){Ul(this),this.edge=this.site=this.circle=null}function jL(n){var t=KL.pop()||new r$;return t.site=n,t}function Z_(n){su(n),au.remove(n),KL.push(n),Ul(n)}function QL(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];Z_(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Pn&&Math.abs(i-p.circle.cy)<Pn;)u=p.P,f.unshift(p),Z_(p),p=u;f.unshift(p),su(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Pn&&Math.abs(i-d.circle.cy)<Pn;)c=d.N,f.push(d),Z_(d),d=c;f.push(d),su(d);var m=f.length,y;for(y=1;y<m;++y)d=f[y],p=f[y-1],yf(d.edge,p.site,d.site,s);p=f[0],d=f[m-1],d.edge=Bl(p.site,d.site,null,s),ou(p),ou(d)}function tN(n){for(var t=n[0],e=n[1],i,s,u,c,f=au._;f;)if(u=eN(f,e)-t,u>Pn)f=f.L;else if(c=t-i$(f,e),c>Pn){if(!f.R){i=f;break}f=f.R}else{u>-Pn?(i=f.P,s=f):c>-Pn?(i=f,s=f.N):i=s=f;break}XL(n);var p=jL(n);if(au.insert(i,p),!(!i&&!s)){if(i===s){su(i),s=jL(i.site),au.insert(p,s),p.edge=s.edge=Bl(i.site,p.site),ou(i),ou(s);return}if(!s){p.edge=Bl(i.site,p.site);return}su(i),su(s);var d=i.site,m=d[0],y=d[1],v=n[0]-m,E=n[1]-y,M=s.site,A=M[0]-m,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,S=A*A+_*_,R=[(_*T-E*S)/x+m,(v*S-A*T)/x+y];yf(s.edge,d,M,R),p.edge=Bl(d,n,null,R),s.edge=Bl(n,M,null,R),ou(i),ou(s)}}function eN(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 m=f-i,y=1/u-1/d,v=m/d;return y?(-v+Math.sqrt(v*v-2*y*(m*m/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function i$(n,t){var e=n.N;if(e)return eN(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Pn=1e-6,JL=1e-12,au,Mi,Gl,Br;function o$(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function s$(n,t){return t[1]-n[1]||t[0]-n[0]}function Ld(n,t){var e=n.sort(s$).pop(),i,s,u;for(Br=[],Mi=new Array(n.length),au=new Y_,Gl=new Y_;;)if(u=Rd,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(tN(e),i=e[0],s=e[1]),e=n.pop();else if(u)QL(u.arc);else break;if(YL(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];WL(c,f,p,d),$L(c,f,p,d)}this.edges=Br,this.cells=Mi,au=Gl=Br=Mi=null}Ld.prototype={constructor:Ld,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return $_(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]],m=d.left===s?d.right:d.left;++c<f;)p=m,d=t[u[c]],m=d.left===s?d.right:d.left,p&&m&&i<p.index&&i<m.index&&o$(s,p,m)<0&&n.push([s.data,p.data,m.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],m=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;_<m&&(m=_,u=E.index)}});while(u!==null);return i._found=s,e==null||m<=e*e?f.site:null}};var d$=ue(kl(),1);var cx=ue(oN(),1);function Li(){return new Dd}function Dd(){this.reset()}Dd.prototype={constructor:Dd,reset:function(){this.s=this.t=0},add:function(n){sN(Od,n,this.t),sN(this,Od.s,this.s),this.s?this.t+=Od.t:this.s=Od.t},valueOf:function(){return this.s}};var Od=new Dd;function sN(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 An=Math.PI,wr=An/2,Fd=An/4,Qo=An*2,uu=180/An,Ni=An/180,tr=Math.abs,Ro=Math.atan,Oi=Math.atan2,hn=Math.cos;var Ud=Math.exp;var vf=Math.log;var Me=Math.sin;var Zr=Math.sqrt,_f=Math.tan;function K_(n){return n>1?0:n<-1?An:Math.acos(n)}function bi(n){return n>1?wr:n<-1?-wr:Math.asin(n)}function Lo(){}var m$=Li(),Fft=Li();function lu(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function xf(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 Ef(n){var t=Zr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var Xft=Li();function uN(n,t){return[n>An?n-Qo:n<-An?n+Qo:n,t]}uN.invert=uN;function Q_(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Lo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function tx(n,t){return tr(n[0]-t[0])<yn&&tr(n[1]-t[1])<yn}function Bd(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 ex(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(tx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new Bd(_,M,null,!0)),c.push(T.o=new Bd(_,null,T,!1)),u.push(T=new Bd(x,M,null,!1)),c.push(T.o=new Bd(x,null,T,!0))}}),!!u.length){for(c.sort(t),lN(u),lN(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],m,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;m=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=m.length;f<p;++f)s.point((y=m[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(m=v.p.z,f=m.length-1;f>=0;--f)s.point((y=m[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,m=v.z,E=!E}while(!v.v);s.lineEnd()}}}function lN(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 da(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function nx(n){return n.length===1&&(n=v$(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 v$(n){return function(t,e){return da(n(t),e)}}var cN=nx(da),_$=cN.right,x$=cN.left;var fN=Array.prototype,w$=fN.slice,S$=fN.map;var Bht=Math.sqrt(50),zht=Math.sqrt(10),Ght=Math.sqrt(2);function Gd(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 R$=1e9,Sdt=-R$;var rx=Li();function ix(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;rx.reset();for(var f=0,p=n.length;f<p;++f)if(m=(d=n[f]).length)for(var d,m,y=d[m-1],v=y[0],E=y[1]/2+Fd,M=Me(E),A=hn(E),_=0;_<m;++_,v=T,M=R,A=z,y=x){var x=d[_],T=x[0],S=x[1]/2+Fd,R=Me(S),z=hn(S),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>An,L=M*R;if(rx.add(Oi(L*D*Me(P),A*z+L*hn(P))),u+=ct?U+D*Qo:U,ct^v>=e^T>=e){var W=xf(lu(y),lu(x));Ef(W);var V=xf(s,W);Ef(V);var Mt=(ct^U>=0?-1:1)*bi(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&rx<-yn)^c&1}var Ndt=Li();var Kdt=Li(),Qdt=Li();var O$=1/0;var nmt=-O$;function ox(n){this._context=n}ox.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,Qo);break}}},result:Lo};var hmt=Li();function sx(){this._string=[]}sx.prototype={_radius:4.5,_circle:dN(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=dN(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 dN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function ax(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Q_(),d=t(p),m=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=S,M.lineStart=R,M.lineEnd=z,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=Gd(v);var U=ix(y,f);v.length?(m||(u.polygonStart(),m=!0),ex(v,U$,U,e,u)):U&&(m||(u.polygonStart(),m=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),m&&(u.polygonEnd(),m=!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 S(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function z(){S(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(m||(u.polygonStart(),m=!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(F$))}}return M}}function F$(n){return n.length>1}function U$(n,t){return((n=n.x)[0]<0?n[1]-wr-yn:wr-n[1])-((t=t.x)[0]<0?t[1]-wr-yn:wr-t[1])}var B$=ax(function(){return!0},z$,k$,[-An,-wr]);function z$(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?An:-An,p=tr(u-t);tr(p-An)<yn?(n.point(t,e=(e+c)/2>0?wr:-wr),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=An&&(tr(t-i)<yn&&(t-=i*yn),tr(u-f)<yn&&(u-=f*yn),e=G$(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 G$(n,t,e,i){var s,u,c=Me(n-e);return tr(c)>yn?Ro((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function k$(n,t,e,i){var s;if(n==null)s=e*wr,i.point(-An,s),i.point(0,s),i.point(An,s),i.point(An,0),i.point(An,-s),i.point(0,-s),i.point(-An,-s),i.point(-An,0),i.point(-An,s);else if(tr(n[0]-t[0])>yn){var u=n[0]<t[0]?An:-An;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function kd(n){return function(t){var e=new ux;for(var i in n)e[i]=n[i];return e.stream=t,e}}function ux(){}ux.prototype={constructor:ux,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 Qmt=hn(30*Ni);var pgt=kd({point:function(n,t){this.stream.point(n*Ni,t*Ni)}});function qd(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 ts(n){return function(t,e){var i=Zr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Oi(t*u,i*c),bi(i&&e*u/i)]}}var EN=qd(function(n){return Zr(2/(1+n))});EN.invert=ts(function(n){return 2*bi(n/2)});var wN=qd(function(n){return(n=K_(n))&&n/Me(n)});wN.invert=ts(function(n){return n});function lx(n,t){return[n,vf(_f((wr+t)/2))]}lx.invert=function(n,t){return[n,2*Ro(Ud(t))-wr]};function Vd(n,t){return[n,t]}Vd.invert=Vd;function SN(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}SN.invert=ts(Ro);function MN(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)))]}MN.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(tr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function bN(n,t){return[hn(t)*Me(n),Me(t)]}bN.invert=ts(bi);function AN(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}AN.invert=ts(function(n){return 2*Ro(n)});function TN(n,t){return[vf(_f((wr+t)/2)),-n]}TN.invert=function(n,t){return[-t,2*Ro(Ud(n))-wr]};var Y$=ue(kl(),1);var $$=ue(kl(),1);var J$=ue(kl(),1);var j$=ue(kl(),1);var w1t=ue(e2(),1),S1t=ue(mv(),1),M1t=ue(hc(),1);function n2(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function r2(n){let t={};for(let i in n)i.startsWith("on")&&(t[n2(i.slice(2))]=n[i],t[i]=n[i]);let e=i=>Cf(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 D1t=ue(Eg(),1),F1t=ue(wg(),1),U1t=ue(Sg(),1),B1t=ue(bg(),1),z1t=ue(Ag(),1),G1t=ue(Pg(),1),k1t=ue(Ng(),1),q1t=ue(Dg(),1),V1t=ue(Fg(),1),H1t=ue(Bg(),1),W1t=ue(Gg(),1),X1t=ue(Hg(),1),Y1t=ue(Yg(),1),$1t=ue(u0(),1),Z1t=ue(l0(),1),J1t=ue(hc(),1),j1t=ue(av(),1);function Hl(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 Ri,d=0;for(let m=0;m<n.length;++m){let y=n[m],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". 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 "+m+'. 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 "+m+". 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 "+m+". .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 "+m+". .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 "+m+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,m),d+=E}}if(e){let m=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)+m);m+=n[v].attributes.position.count}p.setIndex(y)}for(let m in u){let y=i2(u[m]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" attribute."),null;p.setAttribute(m,y)}for(let m in c){let y=c[m][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[m]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[m].length;++A)E.push(c[m][A][v]);let M=i2(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" morphAttribute."),null;p.morphAttributes[m].push(M)}}return p}function i2(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let m=n[d];if(t===void 0&&(t=m.array.constructor),t!==m.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=m.itemSize),e!==m.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=m.normalized),i!==m.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=m.gpuType),s!==m.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=m.count*e}let c=new t(u),f=new Yn(c,e,i),p=0;for(let d=0;d<n.length;++d){let m=n[d];if(m.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=m.count;v<E;v++)for(let M=0;M<e;M++){let A=m.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(m.array,p);p+=m.count*e}return s!==void 0&&(f.gpuType=s),f}function o2(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,m=vl(d[0],d.slice(1)),y=new ml(m,{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 Yn(E,1)),y.setAttribute("opacity",new Yn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Yn(_,1))}let M=new fn(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 Yn(A,3)),y}),u=Hl(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=vx(i)||void 0),c}function vx(n){let{points:t,colors:e,opacities:i}=XZ(n);if(!t.length)return null;let s=new Ri().setFromPoints(t);return s.setAttribute("color",new Yn(new Float32Array(e),3)),s.setAttribute("opacity",new Yn(new Float32Array(i),1)),s}function XZ(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 fn(f).convertLinearToSRGB();for(let m=0;m<c.length;m++){let y=c[m];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 at(E[0],E[1],u)),t.push(new at(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}}r2({onGetMergedGeometryAttributes(n){let{data:t}=n,e=t.map(u=>{let c=u.geometry.coords,f=vl(c[0],c.slice(1));return new ml(f,{steps:1,bevelEnabled:!1,depth:u.height,curveSegments:4})}),i=Hl(e);e.forEach(u=>u.dispose());let s={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),s},onGetMergedShapeGeometryAttributes(n){let{data:t}=n,e=t.map(u=>{let c=vl(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new Vc(c,4),p=f.getAttribute("position"),d=[],m=new fn(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(m.r,m.g,m.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Yn(new Float32Array(d),4)),f}),i=Hl(e);e.forEach(u=>u.dispose());let s={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),s},onGetMergedTexture2dShapeGeometryAttributes(n){let{data:t}=n,e=t.map(u=>{let c=vl(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new Vc(c,4),p=f.getAttribute("position"),d=[1,1,1,0,0,0,0,1];f.setAttribute("uv",new Wr(d,2));let m=u.height+(u.deltaHeight||0)+u.airHeight;for(let y=0;y<p.count;y++)p.setZ(y,m);return f}),i=Hl(e);e.forEach(u=>u.dispose());let s={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),s},onGetMergedGeometriesJson(n){let{data:t}=n,e=o2(t,!1);return e?{mergedGeometry:e.geometry.toJSON()}:null},onGetMergedGeometriesLineJson(n){let{data:t}=n,e=vx(t);return e?{lineGeometry:e.toJSON()}:null}});