@maplat/tin 1.1.0 → 1.1.1

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,5 +1,5 @@
1
- (function(bt,Bt){typeof exports=="object"&&typeof module<"u"?Bt(exports):typeof define=="function"&&define.amd?define(["exports"],Bt):(bt=typeof globalThis<"u"?globalThis:bt||self,Bt(bt.tin={}))})(this,(function(bt){"use strict";function Bt(e,t,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function Dt(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!tn(e[0])||!tn(e[1]))throw new Error("coordinates must contain numbers");return Bt({type:"Point",coordinates:e},t,n)}function Zt(e,t,n={}){for(const o of e){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let r=0;r<o[o.length-1].length;r++)if(o[o.length-1][r]!==o[0][r])throw new Error("First and last Position are not equivalent.")}return Bt({type:"Polygon",coordinates:e},t,n)}function Ze(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return Bt({type:"LineString",coordinates:e},t,n)}function St(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function tn(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function ti(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ei(e){return e.type==="Feature"?e.geometry:e}function Ae(e,t,n){if(e!==null)for(var i,o,r,s,a,h,l,u=0,c=0,f,p=e.type,_=p==="FeatureCollection",g=p==="Feature",I=_?e.features.length:1,M=0;M<I;M++){l=_?e.features[M].geometry:g?e.geometry:e,f=l?l.type==="GeometryCollection":!1,a=f?l.geometries.length:1;for(var m=0;m<a;m++){var b=0,d=0;if(s=f?l.geometries[m]:l,s!==null){h=s.coordinates;var v=s.type;switch(u=n&&(v==="Polygon"||v==="MultiPolygon")?1:0,v){case null:break;case"Point":if(t(h,c,M,b,d)===!1)return!1;c++,b++;break;case"LineString":case"MultiPoint":for(i=0;i<h.length;i++){if(t(h[i],c,M,b,d)===!1)return!1;c++,v==="MultiPoint"&&b++}v==="LineString"&&b++;break;case"Polygon":case"MultiLineString":for(i=0;i<h.length;i++){for(o=0;o<h[i].length-u;o++){if(t(h[i][o],c,M,b,d)===!1)return!1;c++}v==="MultiLineString"&&b++,v==="Polygon"&&d++}v==="Polygon"&&b++;break;case"MultiPolygon":for(i=0;i<h.length;i++){for(d=0,o=0;o<h[i].length;o++){for(r=0;r<h[i][o].length-u;r++){if(t(h[i][o][r],c,M,b,d)===!1)return!1;c++}d++}b++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(Ae(s.geometries[i],t,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}const ut=11102230246251565e-32,U=134217729,en=(3+8*ut)*ut;function ht(e,t,n,i,o){let r,s,a,h,l=t[0],u=i[0],c=0,f=0;u>l==u>-l?(r=l,l=t[++c]):(r=u,u=i[++f]);let p=0;if(c<e&&f<n)for(u>l==u>-l?(s=l+r,a=r-(s-l),l=t[++c]):(s=u+r,a=r-(s-u),u=i[++f]),r=s,a!==0&&(o[p++]=a);c<e&&f<n;)u>l==u>-l?(s=r+l,h=s-r,a=r-(s-h)+(l-h),l=t[++c]):(s=r+u,h=s-r,a=r-(s-h)+(u-h),u=i[++f]),r=s,a!==0&&(o[p++]=a);for(;c<e;)s=r+l,h=s-r,a=r-(s-h)+(l-h),l=t[++c],r=s,a!==0&&(o[p++]=a);for(;f<n;)s=r+u,h=s-r,a=r-(s-h)+(u-h),u=i[++f],r=s,a!==0&&(o[p++]=a);return(r!==0||p===0)&&(o[p++]=r),p}function Mt(e,t,n,i,o,r,s,a){return ht(ht(e,t,n,i,s),s,o,r,a)}function L(e,t,n,i){let o,r,s,a,h,l,u,c,f,p,_;u=U*n,p=u-(u-n),_=n-p;let g=t[0];o=g*n,u=U*g,c=u-(u-g),f=g-c,s=f*_-(o-c*p-f*p-c*_);let I=0;s!==0&&(i[I++]=s);for(let M=1;M<e;M++)g=t[M],a=g*n,u=U*g,c=u-(u-g),f=g-c,h=f*_-(a-c*p-f*p-c*_),r=o+h,l=r-o,s=o-(r-l)+(h-l),s!==0&&(i[I++]=s),o=a+r,s=r-(o-a),s!==0&&(i[I++]=s);return(o!==0||I===0)&&(i[I++]=o),I}function nn(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function tt(e){return new Float64Array(e)}const ni=(3+16*ut)*ut,ii=(2+12*ut)*ut,ri=(9+64*ut)*ut*ut,Gt=tt(4),rn=tt(8),on=tt(12),sn=tt(16),mt=tt(4);function oi(e,t,n,i,o,r,s){let a,h,l,u,c,f,p,_,g,I,M,m,b,d,v,w,A,S;const E=e-o,O=n-o,B=t-r,X=i-r;d=E*X,f=U*E,p=f-(f-E),_=E-p,f=U*X,g=f-(f-X),I=X-g,v=_*I-(d-p*g-_*g-p*I),w=B*O,f=U*B,p=f-(f-B),_=B-p,f=U*O,g=f-(f-O),I=O-g,A=_*I-(w-p*g-_*g-p*I),M=v-A,c=v-M,Gt[0]=v-(M+c)+(c-A),m=d+M,c=m-d,b=d-(m-c)+(M-c),M=b-w,c=b-M,Gt[1]=b-(M+c)+(c-w),S=m+M,c=S-m,Gt[2]=m-(S-c)+(M-c),Gt[3]=S;let F=nn(4,Gt),y=ii*s;if(F>=y||-F>=y||(c=e-E,a=e-(E+c)+(c-o),c=n-O,l=n-(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,r,s,a){const h=e-s,l=n-s,u=o-s,c=t-a,f=i-a,p=r-a,_=l*p,g=u*f,I=h*h+c*c,M=u*c,m=h*p,b=l*l+f*f,d=h*f,v=l*c,w=u*u+p*p,A=I*(_-g)+b*(M-m)+w*(d-v),S=(Math.abs(_)+Math.abs(g))*I+(Math.abs(M)+Math.abs(m))*b+(Math.abs(d)+Math.abs(v))*w,E=si*S;return A>E||-A>E?A:li(e,t,n,i,o,r,s,a,S)}function fi(e,t){var n,i,o=0,r,s,a,h,l,u,c,f=e[0],p=e[1],_=t.length;for(n=0;n<_;n++){i=0;var g=t[n],I=g.length-1;if(u=g[0],u[0]!==g[I][0]&&u[1]!==g[I][1])throw new Error("First and last coordinates in a ring must be the same");for(s=u[0]-f,a=u[1]-p,i;i<I;i++){if(c=g[i+1],h=c[0]-f,l=c[1]-p,a===0&&l===0){if(h<=0&&s>=0||s<=0&&h>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(r=Et(s,h,a,l,0,0),r===0)return 0;(r>0&&l>0&&a<=0||r<0&&l<=0&&a>0)&&o++}u=c,a=l,s=h}}return o%2!==0}function Ce(e,t,n={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const i=ti(e),o=ei(t),r=o.type,s=t.bbox;let a=o.coordinates;if(s&&ui(i,s)===!1)return!1;r==="Polygon"&&(a=[a]);for(var h=0;h<a.length;++h){const l=fi(i,a[h]);if(l===0&&!n.ignoreBoundary)return!0;if(l)return!0}return!1}function ui(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}class De{constructor(t=[],n=di){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:i}=this,o=n[t];for(;t>0;){const r=t-1>>1,s=n[r];if(i(o,s)>=0)break;n[t]=s,t=r}n[t]=o}_down(t){const{data:n,compare:i}=this,o=this.length>>1,r=n[t];for(;t<o;){let s=(t<<1)+1,a=n[s];const h=s+1;if(h<this.length&&i(n[h],a)<0&&(s=h,a=n[h]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}}function di(e,t){return e<t?-1:e>t?1:0}const pi=Object.freeze(Object.defineProperty({__proto__:null,default:De},Symbol.toStringTag,{value:"Module"})),Nt=11102230246251565e-32,dt=134217729,mi=(3+8*Nt)*Nt;function Ye(e,t,n,i,o){let r,s,a,h,l=t[0],u=i[0],c=0,f=0;u>l==u>-l?(r=l,l=t[++c]):(r=u,u=i[++f]);let p=0;if(c<e&&f<n)for(u>l==u>-l?(s=l+r,a=r-(s-l),l=t[++c]):(s=u+r,a=r-(s-u),u=i[++f]),r=s,a!==0&&(o[p++]=a);c<e&&f<n;)u>l==u>-l?(s=r+l,h=s-r,a=r-(s-h)+(l-h),l=t[++c]):(s=r+u,h=s-r,a=r-(s-h)+(u-h),u=i[++f]),r=s,a!==0&&(o[p++]=a);for(;c<e;)s=r+l,h=s-r,a=r-(s-h)+(l-h),l=t[++c],r=s,a!==0&&(o[p++]=a);for(;f<n;)s=r+u,h=s-r,a=r-(s-h)+(u-h),u=i[++f],r=s,a!==0&&(o[p++]=a);return(r!==0||p===0)&&(o[p++]=r),p}function gi(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function te(e){return new Float64Array(e)}const wi=(3+16*Nt)*Nt,yi=(2+12*Nt)*Nt,vi=(9+64*Nt)*Nt*Nt,Kt=te(4),an=te(8),cn=te(12),ln=te(16),yt=te(4);function bi(e,t,n,i,o,r,s){let a,h,l,u,c,f,p,_,g,I,M,m,b,d,v,w,A,S;const E=e-o,O=n-o,B=t-r,X=i-r;d=E*X,f=dt*E,p=f-(f-E),_=E-p,f=dt*X,g=f-(f-X),I=X-g,v=_*I-(d-p*g-_*g-p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,v=_*I-(d-p*g-_*g-p*I),w=h*l,f=dt*h,p=f-(f-h),_=h-p,f=dt*l,g=f-(f-l),I=l-g,A=_*I-(w-p*g-_*g-p*I),M=v-A,c=v-M,yt[0]=v-(M+c)+(c-A),m=d+M,c=m-d,b=d-(m-c)+(M-c),M=b-w,c=b-M,yt[1]=b-(M+c)+(c-w),S=m+M,c=S-m,yt[2]=m-(S-c)+(M-c),yt[3]=S;const T=Ye(k,cn,4,yt,ln);return ln[T-1]}function hn(e,t,n,i,o,r){const s=(t-r)*(n-o),a=(e-o)*(i-r),h=s-a;if(s===0||a===0||s>0!=a>0)return h;const l=Math.abs(s+a);return Math.abs(h)>=wi*l?h:-bi(e,t,n,i,o,r,l)}function xi(e,t){const n=new De([],fn);return Mi(e,n),Si(n,t)}function fn(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x||e.p.x===t.p.x&&(e.featureId!==t.featureId||e.ringId!==t.ringId)&&e.isLeftEndpoint&&!t.isLeftEndpoint?-1:e.p.y!==t.p.y?e.p.y>t.p.y?1:-1:1}function _i(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y!==t.rightSweepEvent.p.y?e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1:1}function Mi(e,t){if(e.type==="FeatureCollection"){const n=e.features;for(let i=0;i<n.length;i++)un(n[i],t)}else un(e,t)}var we=0,ye=0,ve=0;function un(e,t){const n=e.type==="Feature"?e.geometry:e;let i=n.coordinates;(n.type==="Polygon"||n.type==="MultiLineString")&&(i=[i]),n.type==="LineString"&&(i=[[i]]);for(let o=0;o<i.length;o++)for(let r=0;r<i[o].length;r++){let s=i[o][r][0],a=null;ye=ye+1;for(let h=0;h<i[o][r].length-1;h++){a=i[o][r][h+1];const l=new dn(s,we,ye,ve),u=new dn(a,we,ye,ve+1);l.otherEvent=u,u.otherEvent=l,fn(l,u)>0?(u.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,u.isLeftEndpoint=!1),t.push(l),t.push(u),s=a,ve=ve+1}}we=we+1}var dn=class{constructor(e,t,n,i){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=n,this.eventId=i,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}asNewXY(){return[this.p.x,this.p.y]}};function Si(e,t=!1){const n=[],i=new De([],_i);for(;e.length;){const o=e.pop();if(o.isLeftEndpoint){const r=new ki(o);for(let s=0;s<i.data.length;s++){const a=i.data[s];if(t&&a.leftSweepEvent.featureId===o.featureId)continue;const h=Ei(r,a);h!==!1&&n.push(h)}i.push(r)}else o.isLeftEndpoint===!1&&i.pop()}return n}var ki=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function Ei(e,t){if(e===null||t===null)return!1;const n=e.leftSweepEvent.p.x,i=e.leftSweepEvent.p.y,o=e.rightSweepEvent.p.x,r=e.rightSweepEvent.p.y,s=t.leftSweepEvent.p.x,a=t.leftSweepEvent.p.y,h=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,u=hn(n,i,o,r,s,a),c=hn(n,i,o,r,h,l);if(u>0&&c>0)return!1;if(u<0&&c<0)return!1;if(e.leftSweepEvent.ringId===t.leftSweepEvent.ringId){if(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent))return!1}else{if(e.rightSweepEvent.isSamePoint(t.leftSweepEvent))return t.leftSweepEvent.asNewXY();if(e.rightSweepEvent.isSamePoint(t.rightSweepEvent))return t.rightSweepEvent.asNewXY();if(e.leftSweepEvent.isSamePoint(t.leftSweepEvent))return t.leftSweepEvent.asNewXY();if(e.leftSweepEvent.isSamePoint(t.rightSweepEvent))return t.rightSweepEvent.asNewXY()}const f=(l-a)*(o-n)-(h-s)*(r-i),p=(h-s)*(i-a)-(l-a)*(n-s),_=(o-n)*(i-a)-(r-i)*(n-s);if(f===0)return!1;const g=p/f,I=_/f;if(g>=0&&g<=1&&I>=0&&I<=1){const M=n+g*(o-n),m=i+g*(r-i);return[M,m]}return!1}function Ai(e,t,n={}){const{removeDuplicates:i=!0,ignoreSelfIntersections:o=!0}=n;let r=[];e.type==="FeatureCollection"?r=r.concat(e.features):e.type==="Feature"?r.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&r.push(Bt(e)),t.type==="FeatureCollection"?r=r.concat(t.features):t.type==="Feature"?r.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&r.push(Bt(t));const s=xi(St(r),o);let a=[];if(i){const h={};s.forEach(l=>{const u=l.join(",");h[u]||(h[u]=!0,a.push(l))})}else a=s;return St(a.map(h=>Dt(h)))}function Ii(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pi(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var o=!1;try{o=this instanceof i}catch{}return o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}),n}function Oi(e,t={}){let n=0,i=0,o=0;return Ae(e,function(r){n+=r[0],i+=r[1],o++},!0),Dt([n/o,i/o],t.properties)}var be={exports:{}},xe={exports:{}},Bi=xe.exports,pn;function Ni(){return pn||(pn=1,(function(e,t){(function(n,i){e.exports=i()})(Bi,function(){function n(m,b,d,v,w){(function A(S,E,O,B,X){for(;B>O;){if(B-O>600){var F=B-O+1,y=E-O+1,P=Math.log(F),k=.5*Math.exp(2*P/3),T=.5*Math.sqrt(P*k*(F-k)/F)*(y-F/2<0?-1:1),C=Math.max(O,Math.floor(E-y*k/F+T)),Y=Math.min(B,Math.floor(E+(F-y)*k/F+T));A(S,E,C,Y,X)}var x=S[E],N=O,D=B;for(i(S,O,E),X(S[B],x)>0&&i(S,O,B);N<D;){for(i(S,N,D),N++,D--;X(S[N],x)<0;)N++;for(;X(S[D],x)>0;)D--}X(S[O],x)===0?i(S,O,D):i(S,++D,B),D<=E&&(O=D+1),E<=D&&(B=D-1)}})(m,b,d||0,v||m.length-1,w||o)}function i(m,b,d){var v=m[b];m[b]=m[d],m[d]=v}function o(m,b){return m<b?-1:m>b?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(m,b,d){if(!d)return b.indexOf(m);for(var v=0;v<b.length;v++)if(d(m,b[v]))return v;return-1}function a(m,b){h(m,0,m.children.length,b,m)}function h(m,b,d,v,w){w||(w=I(null)),w.minX=1/0,w.minY=1/0,w.maxX=-1/0,w.maxY=-1/0;for(var A=b;A<d;A++){var S=m.children[A];l(w,m.leaf?v(S):S)}return w}function l(m,b){return m.minX=Math.min(m.minX,b.minX),m.minY=Math.min(m.minY,b.minY),m.maxX=Math.max(m.maxX,b.maxX),m.maxY=Math.max(m.maxY,b.maxY),m}function u(m,b){return m.minX-b.minX}function c(m,b){return m.minY-b.minY}function f(m){return(m.maxX-m.minX)*(m.maxY-m.minY)}function p(m){return m.maxX-m.minX+(m.maxY-m.minY)}function _(m,b){return m.minX<=b.minX&&m.minY<=b.minY&&b.maxX<=m.maxX&&b.maxY<=m.maxY}function g(m,b){return b.minX<=m.maxX&&b.minY<=m.maxY&&b.maxX>=m.minX&&b.maxY>=m.minY}function I(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function M(m,b,d,v,w){for(var A=[b,d];A.length;)if(!((d=A.pop())-(b=A.pop())<=v)){var S=b+Math.ceil((d-b)/v/2)*v;n(m,S,b,d,w),A.push(b,S,S,d)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var b=this.data,d=[];if(!g(m,b))return d;for(var v=this.toBBox,w=[];b;){for(var A=0;A<b.children.length;A++){var S=b.children[A],E=b.leaf?v(S):S;g(m,E)&&(b.leaf?d.push(S):_(m,E)?this._all(S,d):w.push(S))}b=w.pop()}return d},r.prototype.collides=function(m){var b=this.data;if(!g(m,b))return!1;for(var d=[];b;){for(var v=0;v<b.children.length;v++){var w=b.children[v],A=b.leaf?this.toBBox(w):w;if(g(m,A)){if(b.leaf||_(m,A))return!0;d.push(w)}}b=d.pop()}return!1},r.prototype.load=function(m){if(!m||!m.length)return this;if(m.length<this._minEntries){for(var b=0;b<m.length;b++)this.insert(m[b]);return this}var d=this._build(m.slice(),0,m.length-1,0);if(this.data.children.length)if(this.data.height===d.height)this._splitRoot(this.data,d);else{if(this.data.height<d.height){var v=this.data;this.data=d,d=v}this._insert(d,this.data.height-d.height-1,!0)}else this.data=d;return this},r.prototype.insert=function(m){return m&&this._insert(m,this.data.height-1),this},r.prototype.clear=function(){return this.data=I([]),this},r.prototype.remove=function(m,b){if(!m)return this;for(var d,v,w,A=this.data,S=this.toBBox(m),E=[],O=[];A||E.length;){if(A||(A=E.pop(),v=E[E.length-1],d=O.pop(),w=!0),A.leaf){var B=s(m,A.children,b);if(B!==-1)return A.children.splice(B,1),E.push(A),this._condense(E),this}w||A.leaf||!_(A,S)?v?(d++,A=v.children[d],w=!1):A=null:(E.push(A),O.push(d),d=0,v=A,A=A.children[0])}return this},r.prototype.toBBox=function(m){return m},r.prototype.compareMinX=function(m,b){return m.minX-b.minX},r.prototype.compareMinY=function(m,b){return m.minY-b.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(m){return this.data=m,this},r.prototype._all=function(m,b){for(var d=[];m;)m.leaf?b.push.apply(b,m.children):d.push.apply(d,m.children),m=d.pop();return b},r.prototype._build=function(m,b,d,v){var w,A=d-b+1,S=this._maxEntries;if(A<=S)return a(w=I(m.slice(b,d+1)),this.toBBox),w;v||(v=Math.ceil(Math.log(A)/Math.log(S)),S=Math.ceil(A/Math.pow(S,v-1))),(w=I([])).leaf=!1,w.height=v;var E=Math.ceil(A/S),O=E*Math.ceil(Math.sqrt(S));M(m,b,d,O,this.compareMinX);for(var B=b;B<=d;B+=O){var X=Math.min(B+O-1,d);M(m,B,X,E,this.compareMinY);for(var F=B;F<=X;F+=E){var y=Math.min(F+E-1,X);w.children.push(this._build(m,F,y,v-1))}}return a(w,this.toBBox),w},r.prototype._chooseSubtree=function(m,b,d,v){for(;v.push(b),!b.leaf&&v.length-1!==d;){for(var w=1/0,A=1/0,S=void 0,E=0;E<b.children.length;E++){var O=b.children[E],B=f(O),X=(F=m,y=O,(Math.max(y.maxX,F.maxX)-Math.min(y.minX,F.minX))*(Math.max(y.maxY,F.maxY)-Math.min(y.minY,F.minY))-B);X<A?(A=X,w=B<w?B:w,S=O):X===A&&B<w&&(w=B,S=O)}b=S||b.children[0]}var F,y;return b},r.prototype._insert=function(m,b,d){var v=d?m:this.toBBox(m),w=[],A=this._chooseSubtree(v,this.data,b,w);for(A.children.push(m),l(A,v);b>=0&&w[b].children.length>this._maxEntries;)this._split(w,b),b--;this._adjustParentBBoxes(v,w,b)},r.prototype._split=function(m,b){var d=m[b],v=d.children.length,w=this._minEntries;this._chooseSplitAxis(d,w,v);var A=this._chooseSplitIndex(d,w,v),S=I(d.children.splice(A,d.children.length-A));S.height=d.height,S.leaf=d.leaf,a(d,this.toBBox),a(S,this.toBBox),b?m[b-1].children.push(S):this._splitRoot(d,S)},r.prototype._splitRoot=function(m,b){this.data=I([m,b]),this.data.height=m.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,b,d){for(var v,w,A,S,E,O,B,X=1/0,F=1/0,y=b;y<=d-b;y++){var P=h(m,0,y,this.toBBox),k=h(m,y,d,this.toBBox),T=(w=P,A=k,S=void 0,E=void 0,O=void 0,B=void 0,S=Math.max(w.minX,A.minX),E=Math.max(w.minY,A.minY),O=Math.min(w.maxX,A.maxX),B=Math.min(w.maxY,A.maxY),Math.max(0,O-S)*Math.max(0,B-E)),C=f(P)+f(k);T<X?(X=T,v=y,F=C<F?C:F):T===X&&C<F&&(F=C,v=y)}return v||d-b},r.prototype._chooseSplitAxis=function(m,b,d){var v=m.leaf?this.compareMinX:u,w=m.leaf?this.compareMinY:c;this._allDistMargin(m,b,d,v)<this._allDistMargin(m,b,d,w)&&m.children.sort(v)},r.prototype._allDistMargin=function(m,b,d,v){m.children.sort(v);for(var w=this.toBBox,A=h(m,0,b,w),S=h(m,d-b,d,w),E=p(A)+p(S),O=b;O<d-b;O++){var B=m.children[O];l(A,m.leaf?w(B):B),E+=p(A)}for(var X=d-b-1;X>=b;X--){var F=m.children[X];l(S,m.leaf?w(F):F),E+=p(S)}return E},r.prototype._adjustParentBBoxes=function(m,b,d){for(var v=d;v>=0;v--)l(b[v],m)},r.prototype._condense=function(m){for(var b=m.length-1,d=void 0;b>=0;b--)m[b].children.length===0?b>0?(d=m[b-1].children).splice(d.indexOf(m[b]),1):this.clear():a(m[b],this.toBBox)},r})})(xe)),xe.exports}const Ti=Pi(pi);var ee={exports:{}},Fe,mn;function Xi(){return mn||(mn=1,Fe=function(t,n,i,o){var r=t[0],s=t[1],a=!1;i===void 0&&(i=0),o===void 0&&(o=n.length);for(var h=(o-i)/2,l=0,u=h-1;l<h;u=l++){var c=n[i+l*2+0],f=n[i+l*2+1],p=n[i+u*2+0],_=n[i+u*2+1],g=f>s!=_>s&&r<(p-c)*(s-f)/(_-f)+c;g&&(a=!a)}return a}),Fe}var Re,gn;function Ci(){return gn||(gn=1,Re=function(t,n,i,o){var r=t[0],s=t[1],a=!1;i===void 0&&(i=0),o===void 0&&(o=n.length);for(var h=o-i,l=0,u=h-1;l<h;u=l++){var c=n[l+i][0],f=n[l+i][1],p=n[u+i][0],_=n[u+i][1],g=f>s!=_>s&&r<(p-c)*(s-f)/(_-f)+c;g&&(a=!a)}return a}),Re}var wn;function Di(){if(wn)return ee.exports;wn=1;var e=Xi(),t=Ci();return ee.exports=function(i,o,r,s){return o.length>0&&Array.isArray(o[0])?t(i,o,r,s):e(i,o,r,s)},ee.exports.nested=t,ee.exports.flat=e,ee.exports}var ne={exports:{}},Yi=ne.exports,yn;function Fi(){return yn||(yn=1,(function(e,t){(function(n,i){i(t)})(Yi,function(n){const o=33306690738754706e-32;function r(g,I,M,m,b){let d,v,w,A,S=I[0],E=m[0],O=0,B=0;E>S==E>-S?(d=S,S=I[++O]):(d=E,E=m[++B]);let X=0;if(O<g&&B<M)for(E>S==E>-S?(w=d-((v=S+d)-S),S=I[++O]):(w=d-((v=E+d)-E),E=m[++B]),d=v,w!==0&&(b[X++]=w);O<g&&B<M;)E>S==E>-S?(w=d-((v=d+S)-(A=v-d))+(S-A),S=I[++O]):(w=d-((v=d+E)-(A=v-d))+(E-A),E=m[++B]),d=v,w!==0&&(b[X++]=w);for(;O<g;)w=d-((v=d+S)-(A=v-d))+(S-A),S=I[++O],d=v,w!==0&&(b[X++]=w);for(;B<M;)w=d-((v=d+E)-(A=v-d))+(E-A),E=m[++B],d=v,w!==0&&(b[X++]=w);return d===0&&X!==0||(b[X++]=d),X}function s(g){return new Float64Array(g)}const a=33306690738754716e-32,h=22204460492503146e-32,l=11093356479670487e-47,u=s(4),c=s(8),f=s(12),p=s(16),_=s(4);n.orient2d=function(g,I,M,m,b,d){const v=(I-d)*(M-b),w=(g-b)*(m-d),A=v-w;if(v===0||w===0||v>0!=w>0)return A;const S=Math.abs(v+w);return Math.abs(A)>=a*S?A:-(function(E,O,B,X,F,y,P){let k,T,C,Y,x,N,D,R,$,j,q,V,J,G,Q,H,Z,W;const ct=E-F,ft=B-F,rt=O-y,ot=X-y;x=(Q=(R=ct-(D=(N=134217729*ct)-(N-ct)))*(j=ot-($=(N=134217729*ot)-(N-ot)))-((G=ct*ot)-D*$-R*$-D*j))-(q=Q-(Z=(R=rt-(D=(N=134217729*rt)-(N-rt)))*(j=ft-($=(N=134217729*ft)-(N-ft)))-((H=rt*ft)-D*$-R*$-D*j))),u[0]=Q-(q+x)+(x-Z),x=(J=G-((V=G+q)-(x=V-G))+(q-x))-(q=J-H),u[1]=J-(q+x)+(x-H),x=(W=V+q)-V,u[2]=V-(W-x)+(q-x),u[3]=W;let jt=(function(ho,Wn){let Zn=Wn[0];for(let We=1;We<ho;We++)Zn+=Wn[We];return Zn})(4,u),de=h*P;if(jt>=de||-jt>=de||(k=E-(ct+(x=E-ct))+(x-F),C=B-(ft+(x=B-ft))+(x-F),T=O-(rt+(x=O-rt))+(x-y),Y=X-(ot+(x=X-ot))+(x-y),k===0&&T===0&&C===0&&Y===0)||(de=l*P+o*Math.abs(jt),(jt+=ct*Y+ot*k-(rt*C+ft*T))>=de||-jt>=de))return jt;x=(Q=(R=k-(D=(N=134217729*k)-(N-k)))*(j=ot-($=(N=134217729*ot)-(N-ot)))-((G=k*ot)-D*$-R*$-D*j))-(q=Q-(Z=(R=T-(D=(N=134217729*T)-(N-T)))*(j=ft-($=(N=134217729*ft)-(N-ft)))-((H=T*ft)-D*$-R*$-D*j))),_[0]=Q-(q+x)+(x-Z),x=(J=G-((V=G+q)-(x=V-G))+(q-x))-(q=J-H),_[1]=J-(q+x)+(x-H),x=(W=V+q)-V,_[2]=V-(W-x)+(q-x),_[3]=W;const ao=r(4,u,4,_,c);x=(Q=(R=ct-(D=(N=134217729*ct)-(N-ct)))*(j=Y-($=(N=134217729*Y)-(N-Y)))-((G=ct*Y)-D*$-R*$-D*j))-(q=Q-(Z=(R=rt-(D=(N=134217729*rt)-(N-rt)))*(j=C-($=(N=134217729*C)-(N-C)))-((H=rt*C)-D*$-R*$-D*j))),_[0]=Q-(q+x)+(x-Z),x=(J=G-((V=G+q)-(x=V-G))+(q-x))-(q=J-H),_[1]=J-(q+x)+(x-H),x=(W=V+q)-V,_[2]=V-(W-x)+(q-x),_[3]=W;const co=r(ao,c,4,_,f);x=(Q=(R=k-(D=(N=134217729*k)-(N-k)))*(j=Y-($=(N=134217729*Y)-(N-Y)))-((G=k*Y)-D*$-R*$-D*j))-(q=Q-(Z=(R=T-(D=(N=134217729*T)-(N-T)))*(j=C-($=(N=134217729*C)-(N-C)))-((H=T*C)-D*$-R*$-D*j))),_[0]=Q-(q+x)+(x-Z),x=(J=G-((V=G+q)-(x=V-G))+(q-x))-(q=J-H),_[1]=J-(q+x)+(x-H),x=(W=V+q)-V,_[2]=V-(W-x)+(q-x),_[3]=W;const lo=r(co,f,4,_,p);return p[lo-1]})(g,I,M,m,b,d,S)},n.orient2dfast=function(g,I,M,m,b,d){return(I-d)*(M-b)-(g-b)*(m-d)},Object.defineProperty(n,"__esModule",{value:!0})})})(ne,ne.exports)),ne.exports}var vn;function Ri(){if(vn)return be.exports;vn=1;var e=Ni(),t=Ti,n=Di(),i=Fi().orient2d;t.default&&(t=t.default),be.exports=o,be.exports.default=o;function o(d,v,w){v=Math.max(0,v===void 0?2:v),w=w||0;var A=p(d),S=new e(16);S.toBBox=function(D){return{minX:D[0],minY:D[1],maxX:D[0],maxY:D[1]}},S.compareMinX=function(D,R){return D[0]-R[0]},S.compareMinY=function(D,R){return D[1]-R[1]},S.load(d);for(var E=[],O=0,B;O<A.length;O++){var X=A[O];S.remove(X),B=_(X,B),E.push(B)}var F=new e(16);for(O=0;O<E.length;O++)F.insert(f(E[O]));for(var y=v*v,P=w*w;E.length;){var k=E.shift(),T=k.p,C=k.next.p,Y=g(T,C);if(!(Y<P)){var x=Y/y;X=r(S,k.prev.p,T,C,k.next.next.p,x,F),X&&Math.min(g(X,T),g(X,C))<=x&&(E.push(k),E.push(_(X,k)),S.remove(X),F.remove(k),F.insert(f(k)),F.insert(f(k.next)))}}k=B;var N=[];do N.push(k.p),k=k.next;while(k!==B);return N.push(k.p),N}function r(d,v,w,A,S,E,O){for(var B=new t([],s),X=d.data;X;){for(var F=0;F<X.children.length;F++){var y=X.children[F],P=X.leaf?I(y,w,A):a(w,A,y);P>E||B.push({node:y,dist:P})}for(;B.length&&!B.peek().node.children;){var k=B.pop(),T=k.node,C=I(T,v,w),Y=I(T,A,S);if(k.dist<C&&k.dist<Y&&l(w,T,O)&&l(A,T,O))return T}X=B.pop(),X&&(X=X.node)}return null}function s(d,v){return d.dist-v.dist}function a(d,v,w){if(h(d,w)||h(v,w))return 0;var A=M(d[0],d[1],v[0],v[1],w.minX,w.minY,w.maxX,w.minY);if(A===0)return 0;var S=M(d[0],d[1],v[0],v[1],w.minX,w.minY,w.minX,w.maxY);if(S===0)return 0;var E=M(d[0],d[1],v[0],v[1],w.maxX,w.minY,w.maxX,w.maxY);if(E===0)return 0;var O=M(d[0],d[1],v[0],v[1],w.minX,w.maxY,w.maxX,w.maxY);return O===0?0:Math.min(A,S,E,O)}function h(d,v){return d[0]>=v.minX&&d[0]<=v.maxX&&d[1]>=v.minY&&d[1]<=v.maxY}function l(d,v,w){for(var A=Math.min(d[0],v[0]),S=Math.min(d[1],v[1]),E=Math.max(d[0],v[0]),O=Math.max(d[1],v[1]),B=w.search({minX:A,minY:S,maxX:E,maxY:O}),X=0;X<B.length;X++)if(c(B[X].p,B[X].next.p,d,v))return!1;return!0}function u(d,v,w){return i(d[0],d[1],v[0],v[1],w[0],w[1])}function c(d,v,w,A){return d!==A&&v!==w&&u(d,v,w)>0!=u(d,v,A)>0&&u(w,A,d)>0!=u(w,A,v)>0}function f(d){var v=d.p,w=d.next.p;return d.minX=Math.min(v[0],w[0]),d.minY=Math.min(v[1],w[1]),d.maxX=Math.max(v[0],w[0]),d.maxY=Math.max(v[1],w[1]),d}function p(d){for(var v=d[0],w=d[0],A=d[0],S=d[0],E=0;E<d.length;E++){var O=d[E];O[0]<v[0]&&(v=O),O[0]>A[0]&&(A=O),O[1]<w[1]&&(w=O),O[1]>S[1]&&(S=O)}var B=[v,w,A,S],X=B.slice();for(E=0;E<d.length;E++)n(d[E],B)||X.push(d[E]);return b(X)}function _(d,v){var w={p:d,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return v?(w.next=v.next,w.prev=v,v.next.prev=w,v.next=w):(w.prev=w,w.next=w),w}function g(d,v){var w=d[0]-v[0],A=d[1]-v[1];return w*w+A*A}function I(d,v,w){var A=v[0],S=v[1],E=w[0]-A,O=w[1]-S;if(E!==0||O!==0){var B=((d[0]-A)*E+(d[1]-S)*O)/(E*E+O*O);B>1?(A=w[0],S=w[1]):B>0&&(A+=E*B,S+=O*B)}return E=d[0]-A,O=d[1]-S,E*E+O*O}function M(d,v,w,A,S,E,O,B){var X=w-d,F=A-v,y=O-S,P=B-E,k=d-S,T=v-E,C=X*X+F*F,Y=X*y+F*P,x=y*y+P*P,N=X*k+F*T,D=y*k+P*T,R=C*x-Y*Y,$,j,q,V,J=R,G=R;R===0?(j=0,J=1,V=D,G=x):(j=Y*D-x*N,V=C*D-Y*N,j<0?(j=0,V=D,G=x):j>J&&(j=J,V=D+Y,G=x)),V<0?(V=0,-N<0?j=0:-N>C?j=J:(j=-N,J=C)):V>G&&(V=G,-N+Y<0?j=0:-N+Y>C?j=J:(j=-N+Y,J=C)),$=j===0?0:j/J,q=V===0?0:V/G;var Q=(1-$)*d+$*w,H=(1-$)*v+$*A,Z=(1-q)*S+q*O,W=(1-q)*E+q*B,ct=Z-Q,ft=W-H;return ct*ct+ft*ft}function m(d,v){return d[0]===v[0]?d[1]-v[1]:d[0]-v[0]}function b(d){d.sort(m);for(var v=[],w=0;w<d.length;w++){for(;v.length>=2&&u(v[v.length-2],v[v.length-1],d[w])<=0;)v.pop();v.push(d[w])}for(var A=[],S=d.length-1;S>=0;S--){for(;A.length>=2&&u(A[A.length-2],A[A.length-1],d[S])<=0;)A.pop();A.push(d[S])}return A.pop(),v.pop(),v.concat(A)}return be.exports}var Li=Ri();const $i=Ii(Li);function bn(e,t={}){t.concavity=t.concavity||1/0;const n=[];if(Ae(e,o=>{n.push([o[0],o[1]])}),!n.length)return null;const i=$i(n,t.concavity);return i.length>3?Zt([i],t.properties):null}function xn(e,t,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function ie(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Mn(e[0])||!Mn(e[1]))throw new Error("coordinates must contain numbers");return xn({type:"Point",coordinates:e},t,n)}function _n(e,t,n={}){for(const i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return xn({type:"Polygon",coordinates:e},t,n)}function Qt(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function Mn(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function ji(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Sn(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Vi(e){return e.type==="Feature"?e.geometry:e}const Tt=11102230246251565e-32,pt=134217729,qi=(3+8*Tt)*Tt;function Le(e,t,n,i,o){let r,s,a,h,l=t[0],u=i[0],c=0,f=0;u>l==u>-l?(r=l,l=t[++c]):(r=u,u=i[++f]);let p=0;if(c<e&&f<n)for(u>l==u>-l?(s=l+r,a=r-(s-l),l=t[++c]):(s=u+r,a=r-(s-u),u=i[++f]),r=s,a!==0&&(o[p++]=a);c<e&&f<n;)u>l==u>-l?(s=r+l,h=s-r,a=r-(s-h)+(l-h),l=t[++c]):(s=r+u,h=s-r,a=r-(s-h)+(u-h),u=i[++f]),r=s,a!==0&&(o[p++]=a);for(;c<e;)s=r+l,h=s-r,a=r-(s-h)+(l-h),l=t[++c],r=s,a!==0&&(o[p++]=a);for(;f<n;)s=r+u,h=s-r,a=r-(s-h)+(u-h),u=i[++f],r=s,a!==0&&(o[p++]=a);return(r!==0||p===0)&&(o[p++]=r),p}function Ui(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function re(e){return new Float64Array(e)}const zi=(3+16*Tt)*Tt,Gi=(2+12*Tt)*Tt,Ji=(9+64*Tt)*Tt*Tt,Ht=re(4),kn=re(8),En=re(12),An=re(16),vt=re(4);function Ki(e,t,n,i,o,r,s){let a,h,l,u,c,f,p,_,g,I,M,m,b,d,v,w,A,S;const E=e-o,O=n-o,B=t-r,X=i-r;d=E*X,f=pt*E,p=f-(f-E),_=E-p,f=pt*X,g=f-(f-X),I=X-g,v=_*I-(d-p*g-_*g-p*I),w=B*O,f=pt*B,p=f-(f-B),_=B-p,f=pt*O,g=f-(f-O),I=O-g,A=_*I-(w-p*g-_*g-p*I),M=v-A,c=v-M,Ht[0]=v-(M+c)+(c-A),m=d+M,c=m-d,b=d-(m-c)+(M-c),M=b-w,c=b-M,Ht[1]=b-(M+c)+(c-w),S=m+M,c=S-m,Ht[2]=m-(S-c)+(M-c),Ht[3]=S;let F=Ui(4,Ht),y=Gi*s;if(F>=y||-F>=y||(c=e-E,a=e-(E+c)+(c-o),c=n-O,l=n-(O+c)+(c-o),c=t-B,h=t-(B+c)+(c-r),c=i-X,u=i-(X+c)+(c-r),a===0&&h===0&&l===0&&u===0)||(y=Ji*s+qi*Math.abs(F),F+=E*u+X*a-(B*l+O*h),F>=y||-F>=y))return F;d=a*X,f=pt*a,p=f-(f-a),_=a-p,f=pt*X,g=f-(f-X),I=X-g,v=_*I-(d-p*g-_*g-p*I),w=h*O,f=pt*h,p=f-(f-h),_=h-p,f=pt*O,g=f-(f-O),I=O-g,A=_*I-(w-p*g-_*g-p*I),M=v-A,c=v-M,vt[0]=v-(M+c)+(c-A),m=d+M,c=m-d,b=d-(m-c)+(M-c),M=b-w,c=b-M,vt[1]=b-(M+c)+(c-w),S=m+M,c=S-m,vt[2]=m-(S-c)+(M-c),vt[3]=S;const P=Le(4,Ht,4,vt,kn);d=E*u,f=pt*E,p=f-(f-E),_=E-p,f=pt*u,g=f-(f-u),I=u-g,v=_*I-(d-p*g-_*g-p*I),w=B*l,f=pt*B,p=f-(f-B),_=B-p,f=pt*l,g=f-(f-l),I=l-g,A=_*I-(w-p*g-_*g-p*I),M=v-A,c=v-M,vt[0]=v-(M+c)+(c-A),m=d+M,c=m-d,b=d-(m-c)+(M-c),M=b-w,c=b-M,vt[1]=b-(M+c)+(c-w),S=m+M,c=S-m,vt[2]=m-(S-c)+(M-c),vt[3]=S;const k=Le(P,kn,4,vt,En);d=a*u,f=pt*a,p=f-(f-a),_=a-p,f=pt*u,g=f-(f-u),I=u-g,v=_*I-(d-p*g-_*g-p*I),w=h*l,f=pt*h,p=f-(f-h),_=h-p,f=pt*l,g=f-(f-l),I=l-g,A=_*I-(w-p*g-_*g-p*I),M=v-A,c=v-M,vt[0]=v-(M+c)+(c-A),m=d+M,c=m-d,b=d-(m-c)+(M-c),M=b-w,c=b-M,vt[1]=b-(M+c)+(c-w),S=m+M,c=S-m,vt[2]=m-(S-c)+(M-c),vt[3]=S;const T=Le(k,En,4,vt,An);return An[T-1]}function Qi(e,t,n,i,o,r){const s=(t-r)*(n-o),a=(e-o)*(i-r),h=s-a,l=Math.abs(s+a);return Math.abs(h)>=zi*l?h:-Ki(e,t,n,i,o,r,l)}function Hi(e,t){var n,i,o=0,r,s,a,h,l,u,c,f=e[0],p=e[1],_=t.length;for(n=0;n<_;n++){i=0;var g=t[n],I=g.length-1;if(u=g[0],u[0]!==g[I][0]&&u[1]!==g[I][1])throw new Error("First and last coordinates in a ring must be the same");for(s=u[0]-f,a=u[1]-p,i;i<I;i++){if(c=g[i+1],h=c[0]-f,l=c[1]-p,a===0&&l===0){if(h<=0&&s>=0||s<=0&&h>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(r=Qi(s,h,a,l,0,0),r===0)return 0;(r>0&&l>0&&a<=0||r<0&&l<=0&&a>0)&&o++}u=c,a=l,s=h}}return o%2!==0}function $e(e,t,n={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const i=ji(e),o=Vi(t),r=o.type,s=t.bbox;let a=o.coordinates;if(s&&Wi(i,s)===!1)return!1;r==="Polygon"&&(a=[a]);for(var h=0;h<a.length;++h){const l=Hi(i,a[h]);if(l===0&&!n.ignoreBoundary||l)return!0}return!1}function Wi(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}function je(e,t){for(let n=0;n<t.features.length;n++)if($e(e,t.features[n]))return t.features[n]}function In(e,t){const n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],r=e.geometry.coordinates,s=t.properties.a.geom,a=t.properties.b.geom,h=t.properties.c.geom,l=[i[0]-n[0],i[1]-n[1]],u=[o[0]-n[0],o[1]-n[1]],c=[r[0]-n[0],r[1]-n[1]],f=[a[0]-s[0],a[1]-s[1]],p=[h[0]-s[0],h[1]-s[1]],_=(u[1]*c[0]-u[0]*c[1])/(l[0]*u[1]-l[1]*u[0]),g=(l[0]*c[1]-l[1]*c[0])/(l[0]*u[1]-l[1]*u[0]);return[_*f[0]+g*p[0]+s[0],_*f[1]+g*p[1]+s[1]]}function Zi(e,t,n){const i=e.geometry.coordinates,o=n.geometry.coordinates,r=Math.atan2(i[0]-o[0],i[1]-o[1]),s=tr(r,t[0]);if(s===void 0)throw new Error("Unable to determine vertex index");const a=t[1][s];return In(e,a.features[0])}function oe(e,t,n,i,o,r,s,a){let h;if(s&&(h=je(e,Qt([s]))),!h)if(n){const l=e.geometry.coordinates,u=n.gridNum,c=n.xOrigin,f=n.yOrigin,p=n.xUnit,_=n.yUnit,g=n.gridCache,I=Ot(l[0],c,p,u),M=Ot(l[1],f,_,u),m=g[I]?g[I][M]?g[I][M]:[]:[],b=Qt(m.map(d=>t.features[d]));h=je(e,b)}else h=je(e,t);return a&&a(h),h?In(e,h):Zi(e,i,o)}function Ot(e,t,n,i){let o=Math.floor((e-t)/n);return o<0&&(o=0),o>=i&&(o=i-1),o}function tr(e,t){let n=Pn(e-t[0]),i=Math.PI*2,o;for(let r=0;r<t.length;r++){const s=(r+1)%t.length,a=Pn(e-t[s]),h=Math.min(Math.abs(n),Math.abs(a));n*a<=0&&h<i&&(i=h,o=r),n=a}return o}function Pn(e,t=!1){const n=2*Math.PI,i=e-Math.floor(e/n)*n;return t?i:i>Math.PI?i-n:i}function On(e){const t=e.features;for(let n=0;n<t.length;n++){const i=t[n];`${i.properties.a.index}`.substring(0,1)==="b"&&`${i.properties.b.index}`.substring(0,1)==="b"?t[n]={geometry:{type:"Polygon",coordinates:[[i.geometry.coordinates[0][2],i.geometry.coordinates[0][0],i.geometry.coordinates[0][1],i.geometry.coordinates[0][2]]]},properties:{a:{geom:i.properties.c.geom,index:i.properties.c.index},b:{geom:i.properties.a.geom,index:i.properties.a.index},c:{geom:i.properties.b.geom,index:i.properties.b.index}},type:"Feature"}:`${i.properties.c.index}`.substring(0,1)==="b"&&`${i.properties.a.index}`.substring(0,1)==="b"&&(t[n]={geometry:{type:"Polygon",coordinates:[[i.geometry.coordinates[0][1],i.geometry.coordinates[0][2],i.geometry.coordinates[0][0],i.geometry.coordinates[0][1]]]},properties:{a:{geom:i.properties.b.geom,index:i.properties.b.index},b:{geom:i.properties.c.geom,index:i.properties.c.index},c:{geom:i.properties.a.geom,index:i.properties.a.index}},type:"Feature"})}return e}function Bn(e){const t=["a","b","c","a"].map(r=>e.properties[r].geom),n=e.geometry.coordinates[0],i=e.properties,o={a:{geom:n[0],index:i.a.index},b:{geom:n[1],index:i.b.index},c:{geom:n[2],index:i.c.index}};return _n([t],o)}function er(e){const t=[0,1,2,0].map(i=>e[i][0][0]),n={a:{geom:e[0][0][1],index:e[0][1]},b:{geom:e[1][0][1],index:e[1][1]},c:{geom:e[2][0][1],index:e[2][1]}};return _n([t],n)}function Ve(e,t,n,i,o,r=!1,s){const a=e.map(h=>{(!s||s<2.00703)&&(h=nr(h));const l=isFinite(h)?t[h]:h==="c"?i:(function(){const u=h.match(/^b(\d+)$/);if(u)return o[parseInt(u[1])];const c=h.match(/^e(\d+)$/);if(c)return n[parseInt(c[1])];throw new Error("Bad index value for indexesToTri")})();return r?[[l[1],l[0]],h]:[[l[0],l[1]],h]});return er(a)}function nr(e){return typeof e=="number"?e:e.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/,"$1$2")}function Nn(e,t){return t&&t>=2.00703||Array.isArray(e[0])?e:e.map(n=>[n.illstNodes,n.mercNodes,n.startEnd])}const ir=2.00704;function rr(e){return!!(e.version!==void 0||!e.tins&&e.points&&e.tins_points)}function or(e){return{points:e.points,strictStatus:ar(e),verticesParams:cr(e),centroid:lr(e),edges:Nn(e.edges||[]),edgeNodes:e.edgeNodes||[],tins:hr(e),kinks:fr(e.kinks_points),yaxisMode:e.yaxisMode??"invert",strictMode:e.strictMode??"auto",vertexMode:e.vertexMode,bounds:e.bounds,boundsPolygon:e.boundsPolygon,wh:e.wh,xy:e.xy??[0,0]}}function sr(e){const t=ur(e),n=t.tins;return{compiled:t,tins:n,points:dr(n),strictStatus:t.strict_status,verticesParams:t.vertices_params,centroid:t.centroid,kinks:t.kinks}}function ar(e){return e.strict_status?e.strict_status:e.kinks_points?"strict_error":e.tins_points.length===2?"loose":"strict"}function cr(e){const t={forw:[e.vertices_params[0]],bakw:[e.vertices_params[1]]};return t.forw[1]=Tn(e,!1),t.bakw[1]=Tn(e,!0),t}function Tn(e,t){const n=e.vertices_points.length;return Array.from({length:n},(i,o)=>{const r=(o+1)%n,s=Ve(["c",`b${o}`,`b${r}`],e.points,e.edgeNodes||[],e.centroid_point,e.vertices_points,t,ir);return Qt([s])})}function lr(e){return{forw:ie(e.centroid_point[0],{target:{geom:e.centroid_point[1],index:"c"}}),bakw:ie(e.centroid_point[1],{target:{geom:e.centroid_point[0],index:"c"}})}}function hr(e){const t=e.tins_points.length===1?0:1;return{forw:Qt(e.tins_points[0].map(n=>Ve(n,e.points,e.edgeNodes||[],e.centroid_point,e.vertices_points,!1,e.version))),bakw:Qt(e.tins_points[t].map(n=>Ve(n,e.points,e.edgeNodes||[],e.centroid_point,e.vertices_points,!0,e.version)))}}function fr(e){if(e)return{bakw:Qt(e.map(t=>ie(t)))}}function ur(e){return JSON.parse(JSON.stringify(e).replace('"cent"','"c"').replace(/"bbox(\d+)"/g,'"b$1"'))}function dr(e){const t=[],n=e.forw.features;for(let i=0;i<n.length;i++){const o=n[i];["a","b","c"].forEach((r,s)=>{const a=o.geometry.coordinates[0][s],h=o.properties[r].geom,l=o.properties[r].index;typeof l=="number"&&(t[l]=[a,h])})}return t}class kt{static VERTEX_PLAIN="plain";static VERTEX_BIRDEYE="birdeye";static MODE_STRICT="strict";static MODE_AUTO="auto";static MODE_LOOSE="loose";static STATUS_STRICT="strict";static STATUS_ERROR="strict_error";static STATUS_LOOSE="loose";static YAXIS_FOLLOW="follow";static YAXIS_INVERT="invert";points=[];pointsWeightBuffer;strict_status;vertices_params;centroid;edgeNodes;edges;tins;kinks;yaxisMode=kt.YAXIS_INVERT;strictMode=kt.MODE_AUTO;vertexMode=kt.VERTEX_PLAIN;bounds;boundsPolygon;wh;xy;indexedTins;stateFull=!1;stateTriangle;stateBackward;priority;importance;xyBounds;mercBounds;constructor(){}setCompiled(t){if(rr(t)){this.applyModernState(or(t));return}this.applyLegacyState(sr(t))}applyModernState(t){this.points=t.points,this.strict_status=t.strictStatus,this.vertices_params=t.verticesParams,this.centroid=t.centroid,this.edges=t.edges,this.edgeNodes=t.edgeNodes||[],this.tins=t.tins,this.addIndexedTin(),this.kinks=t.kinks,this.yaxisMode=t.yaxisMode??kt.YAXIS_INVERT,this.vertexMode=t.vertexMode??kt.VERTEX_PLAIN,this.strictMode=t.strictMode??kt.MODE_AUTO,t.bounds?(this.bounds=t.bounds,this.boundsPolygon=t.boundsPolygon,this.xy=t.xy,this.wh=t.wh):(this.bounds=void 0,this.boundsPolygon=void 0,this.xy=t.xy??[0,0],t.wh&&(this.wh=t.wh))}applyLegacyState(t){this.tins=t.tins,this.addIndexedTin(),this.strict_status=t.strictStatus,this.vertices_params=t.verticesParams,this.centroid=t.centroid,this.kinks=t.kinks,this.points=t.points}addIndexedTin(){const t=this.tins,n=t.forw,i=t.bakw,o=Math.ceil(Math.sqrt(n.features.length));if(o<3){this.indexedTins=void 0;return}let r=[],s=[];const a=n.features.map(g=>{let I=[];return Sn(g)[0].map(M=>{r.length===0?r=[Array.from(M),Array.from(M)]:(M[0]<r[0][0]&&(r[0][0]=M[0]),M[0]>r[1][0]&&(r[1][0]=M[0]),M[1]<r[0][1]&&(r[0][1]=M[1]),M[1]>r[1][1]&&(r[1][1]=M[1])),I.length===0?I=[Array.from(M),Array.from(M)]:(M[0]<I[0][0]&&(I[0][0]=M[0]),M[0]>I[1][0]&&(I[1][0]=M[0]),M[1]<I[0][1]&&(I[0][1]=M[1]),M[1]>I[1][1]&&(I[1][1]=M[1]))}),I}),h=(r[1][0]-r[0][0])/o,l=(r[1][1]-r[0][1])/o,u=a.reduce((g,I,M)=>{const m=Ot(I[0][0],r[0][0],h,o),b=Ot(I[1][0],r[0][0],h,o),d=Ot(I[0][1],r[0][1],l,o),v=Ot(I[1][1],r[0][1],l,o);for(let w=m;w<=b;w++){g[w]||(g[w]=[]);for(let A=d;A<=v;A++)g[w][A]||(g[w][A]=[]),g[w][A].push(M)}return g},[]),c=i.features.map(g=>{let I=[];return Sn(g)[0].map(M=>{s.length===0?s=[Array.from(M),Array.from(M)]:(M[0]<s[0][0]&&(s[0][0]=M[0]),M[0]>s[1][0]&&(s[1][0]=M[0]),M[1]<s[0][1]&&(s[0][1]=M[1]),M[1]>s[1][1]&&(s[1][1]=M[1])),I.length===0?I=[Array.from(M),Array.from(M)]:(M[0]<I[0][0]&&(I[0][0]=M[0]),M[0]>I[1][0]&&(I[1][0]=M[0]),M[1]<I[0][1]&&(I[0][1]=M[1]),M[1]>I[1][1]&&(I[1][1]=M[1]))}),I}),f=(s[1][0]-s[0][0])/o,p=(s[1][1]-s[0][1])/o,_=c.reduce((g,I,M)=>{const m=Ot(I[0][0],s[0][0],f,o),b=Ot(I[1][0],s[0][0],f,o),d=Ot(I[0][1],s[0][1],p,o),v=Ot(I[1][1],s[0][1],p,o);for(let w=m;w<=b;w++){g[w]||(g[w]=[]);for(let A=d;A<=v;A++)g[w][A]||(g[w][A]=[]),g[w][A].push(M)}return g},[]);this.indexedTins={forw:{gridNum:o,xOrigin:r[0][0],yOrigin:r[0][1],xUnit:h,yUnit:l,gridCache:u},bakw:{gridNum:o,xOrigin:s[0][0],yOrigin:s[0][1],xUnit:f,yUnit:p,gridCache:_}}}transform(t,n,i){if(!this.tins)throw new Error("setCompiled() must be called before transform()");if(n&&this.strict_status==kt.STATUS_ERROR)throw new Error('Backward transform is not allowed if strict_status == "strict_error"');this.yaxisMode==kt.YAXIS_FOLLOW&&n&&(t=[t[0],-1*t[1]]);const o=ie(t);if(this.bounds&&!n&&!i&&!$e(o,this.boundsPolygon))return!1;const r=n?this.tins.bakw:this.tins.forw,s=n?this.indexedTins.bakw:this.indexedTins.forw,a=n?this.vertices_params.bakw:this.vertices_params.forw,h=n?this.centroid.bakw:this.centroid.forw;let l,u;this.stateFull&&(this.stateBackward==n?l=this.stateTriangle:(this.stateBackward=n,this.stateTriangle=void 0),u=f=>{this.stateTriangle=f});let c=oe(o,r,s,a,h,void 0,l,u);if(this.bounds&&n&&!i){const f=ie(c);if(!$e(f,this.boundsPolygon))return!1}else this.yaxisMode==kt.YAXIS_FOLLOW&&!n&&(c=[c[0],-1*c[1]]);return c}}const Xn=Math.pow(2,-52),_e=new Uint32Array(512);class qe{static from(t,n=yr,i=vr){const o=t.length,r=new Float64Array(o*2);for(let s=0;s<o;s++){const a=t[s];r[2*s]=n(a),r[2*s+1]=i(a)}return new qe(r)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*n-5,0);this._triangles=new Uint32Array(i*3),this._halfedges=new Int32Array(i*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:i,_hullTri:o,_hullHash:r}=this,s=t.length>>1;let a=1/0,h=1/0,l=-1/0,u=-1/0;for(let E=0;E<s;E++){const O=t[2*E],B=t[2*E+1];O<a&&(a=O),B<h&&(h=B),O>l&&(l=O),B>u&&(u=B),this._ids[E]=E}const c=(a+l)/2,f=(h+u)/2;let p=0,_=0,g=0;for(let E=0,O=1/0;E<s;E++){const B=Ue(c,f,t[2*E],t[2*E+1]);B<O&&(p=E,O=B)}const I=t[2*p],M=t[2*p+1];for(let E=0,O=1/0;E<s;E++){if(E===p)continue;const B=Ue(I,M,t[2*E],t[2*E+1]);B<O&&B>0&&(_=E,O=B)}let m=t[2*_],b=t[2*_+1],d=1/0;for(let E=0;E<s;E++){if(E===p||E===_)continue;const O=gr(I,M,m,b,t[2*E],t[2*E+1]);O<d&&(g=E,d=O)}let v=t[2*g],w=t[2*g+1];if(d===1/0){for(let B=0;B<s;B++)this._dists[B]=t[2*B]-t[0]||t[2*B+1]-t[1];Wt(this._ids,this._dists,0,s-1);const E=new Uint32Array(s);let O=0;for(let B=0,X=-1/0;B<s;B++){const F=this._ids[B],y=this._dists[F];y>X&&(E[O++]=F,X=y)}this.hull=E.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Et(I,M,m,b,v,w)<0){const E=_,O=m,B=b;_=g,m=v,b=w,g=E,v=O,w=B}const A=wr(I,M,m,b,v,w);this._cx=A.x,this._cy=A.y;for(let E=0;E<s;E++)this._dists[E]=Ue(t[2*E],t[2*E+1],A.x,A.y);Wt(this._ids,this._dists,0,s-1),this._hullStart=p;let S=3;i[p]=n[g]=_,i[_]=n[p]=g,i[g]=n[_]=p,o[p]=0,o[_]=1,o[g]=2,r.fill(-1),r[this._hashKey(I,M)]=p,r[this._hashKey(m,b)]=_,r[this._hashKey(v,w)]=g,this.trianglesLen=0,this._addTriangle(p,_,g,-1,-1,-1);for(let E=0,O=0,B=0;E<this._ids.length;E++){const X=this._ids[E],F=t[2*X],y=t[2*X+1];if(E>0&&Math.abs(F-O)<=Xn&&Math.abs(y-B)<=Xn||(O=F,B=y,X===p||X===_||X===g))continue;let P=0;for(let x=0,N=this._hashKey(F,y);x<this._hashSize&&(P=r[(N+x)%this._hashSize],!(P!==-1&&P!==i[P]));x++);P=n[P];let k=P,T;for(;T=i[k],Et(F,y,t[2*k],t[2*k+1],t[2*T],t[2*T+1])>=0;)if(k=T,k===P){k=-1;break}if(k===-1)continue;let C=this._addTriangle(k,X,i[k],-1,-1,o[k]);o[X]=this._legalize(C+2),o[k]=C,S++;let Y=i[k];for(;T=i[Y],Et(F,y,t[2*Y],t[2*Y+1],t[2*T],t[2*T+1])<0;)C=this._addTriangle(Y,X,T,o[X],-1,o[Y]),o[X]=this._legalize(C+2),i[Y]=Y,S--,Y=T;if(k===P)for(;T=n[k],Et(F,y,t[2*T],t[2*T+1],t[2*k],t[2*k+1])<0;)C=this._addTriangle(T,X,k,-1,o[k],o[T]),this._legalize(C+2),o[T]=C,i[k]=k,S--,k=T;this._hullStart=n[X]=k,i[k]=n[Y]=X,i[X]=Y,r[this._hashKey(F,y)]=X,r[this._hashKey(t[2*k],t[2*k+1])]=k}this.hull=new Uint32Array(S);for(let E=0,O=this._hullStart;E<S;E++)this.hull[E]=O,O=i[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(pr(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:i,coords:o}=this;let r=0,s=0;for(;;){const a=i[t],h=t-t%3;if(s=h+(t+2)%3,a===-1){if(r===0)break;t=_e[--r];continue}const l=a-a%3,u=h+(t+1)%3,c=l+(a+2)%3,f=n[s],p=n[t],_=n[u],g=n[c];if(mr(o[2*f],o[2*f+1],o[2*p],o[2*p+1],o[2*_],o[2*_+1],o[2*g],o[2*g+1])){n[t]=g,n[a]=f;const M=i[c];if(M===-1){let b=this._hullStart;do{if(this._hullTri[b]===c){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,M),this._link(a,i[s]),this._link(s,c);const m=l+(a+1)%3;r<_e.length&&(_e[r++]=m)}else{if(r===0)break;t=_e[--r]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,i,o,r,s){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=i,this._link(a,o),this._link(a+1,r),this._link(a+2,s),this.trianglesLen+=3,a}}function pr(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function Ue(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function mr(e,t,n,i,o,r,s,a){const h=e-s,l=t-a,u=n-s,c=i-a,f=o-s,p=r-a,_=h*h+l*l,g=u*u+c*c,I=f*f+p*p;return h*(c*I-g*p)-l*(u*I-g*f)+_*(u*p-c*f)<0}function gr(e,t,n,i,o,r){const s=n-e,a=i-t,h=o-e,l=r-t,u=s*s+a*a,c=h*h+l*l,f=.5/(s*l-a*h),p=(l*u-a*c)*f,_=(s*c-h*u)*f;return p*p+_*_}function wr(e,t,n,i,o,r){const s=n-e,a=i-t,h=o-e,l=r-t,u=s*s+a*a,c=h*h+l*l,f=.5/(s*l-a*h),p=e+(l*u-a*c)*f,_=t+(s*c-h*u)*f;return{x:p,y:_}}function Wt(e,t,n,i){if(i-n<=20)for(let o=n+1;o<=i;o++){const r=e[o],s=t[r];let a=o-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=r}else{const o=n+i>>1;let r=n+1,s=i;se(e,o,r),t[e[n]]>t[e[i]]&&se(e,n,i),t[e[r]]>t[e[i]]&&se(e,r,i),t[e[n]]>t[e[r]]&&se(e,n,r);const a=e[r],h=t[a];for(;;){do r++;while(t[e[r]]<h);do s--;while(t[e[s]]>h);if(s<r)break;se(e,r,s)}e[n+1]=e[s],e[s]=a,i-r+1>=s-n?(Wt(e,t,r,i),Wt(e,t,n,s-1)):(Wt(e,t,n,s-1),Wt(e,t,r,i))}}function se(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function yr(e){return e[0]}function vr(e){return e[1]}class br{bs;width;constructor(t,n){this.width=t,this.bs=n}add(t){const n=Math.floor(t/this.width),i=t%this.width;return this.bs[n]|=1<<i,this}delete(t){const n=Math.floor(t/this.width),i=t%this.width;return this.bs[n]&=~(1<<i),this}set(t,n){const i=Math.floor(t/this.width),r=1<<t%this.width;return this.bs[i]^=(-Number(n)^this.bs[i])&r,n}has(t){const n=Math.floor(t/this.width),i=t%this.width;return(this.bs[n]&1<<i)!==0}forEach(t){const n=this.bs.length;for(let i=0;i<n;i++){let o=0;for(;this.bs[i]&&o<this.width;)this.bs[i]&1<<o&&t(i*this.width+o),o++}return this}}class Cn extends br{constructor(t){super(8,new Uint8Array(Math.ceil(t/8)).fill(0))}}function zt(e){return e%3===2?e-2:e+1}function Xt(e){return e%3===0?e+2:e-1}function Dn(e,t,n,i,o,r,s,a){const h=Et(e,t,o,r,s,a),l=Et(n,i,o,r,s,a);if(h>0&&l>0||h<0&&l<0)return!1;const u=Et(o,r,e,t,n,i),c=Et(s,a,e,t,n,i);return u>0&&c>0||u<0&&c<0?!1:h===0&&l===0&&u===0&&c===0?!(Math.max(o,s)<Math.min(e,n)||Math.max(e,n)<Math.min(o,s)||Math.max(r,a)<Math.min(t,i)||Math.max(t,i)<Math.min(r,a)):!0}class xr{del;constructor(t){this.del=t}}class _r extends xr{vertMap;flips;consd;constructor(t,n){if(!t||typeof t!="object"||!t.triangles||!t.halfedges||!t.coords)throw new Error("Expected an object with Delaunator output");if(t.triangles.length%3||t.halfedges.length!==t.triangles.length||t.coords.length%2)throw new Error("Delaunator output appears inconsistent");if(t.triangles.length<3)throw new Error("No edges in triangulation");super(t);const i=2**32-1,o=t.coords.length>>1,r=t.triangles.length;this.vertMap=new Uint32Array(o).fill(i),this.flips=new Cn(r),this.consd=new Cn(r);for(let s=0;s<r;s++){const a=t.triangles[s];this.vertMap[a]===i&&this.updateVert(s)}n&&this.constrainAll(n)}constrainOne(t,n){const{triangles:i,halfedges:o}=this.del,r=this.vertMap[t];let s=r;do{const l=i[s],u=zt(s);if(l===n)return this.protect(s);const c=Xt(s),f=i[c];if(f===n)return this.protect(u),u;if(this.intersectSegments(t,n,f,l)){s=c;break}s=o[u]}while(s!==-1&&s!==r);let a=s,h=-1;for(;s!==-1;){const l=o[s],u=Xt(s),c=Xt(l),f=zt(l);if(l===-1)throw new Error("Constraining edge exited the hull");if(this.consd.has(s))throw new Error("Edge intersects already constrained edge");if(this.isCollinear(t,n,i[s])||this.isCollinear(t,n,i[l]))throw new Error("Constraining edge intersects point");if(!this.intersectSegments(i[s],i[l],i[u],i[c])){if(h===-1&&(h=s),i[c]===n){if(s===h)throw new Error("Infinite loop: non-convex quadrilateral");s=h,h=-1;continue}if(this.intersectSegments(t,n,i[c],i[l]))s=c;else if(this.intersectSegments(t,n,i[f],i[c]))s=f;else if(h===s)throw new Error("Infinite loop: no further intersect after non-convex");continue}if(this.flipDiagonal(s),this.intersectSegments(t,n,i[u],i[c])&&(h===-1&&(h=u),h===u))throw new Error("Infinite loop: flipped diagonal still intersects");i[c]===n?(a=c,s=h,h=-1):this.intersectSegments(t,n,i[f],i[c])&&(s=f)}return this.protect(a),this.delaunify(!0),this.findEdge(t,n)}delaunify(t=!1){const{halfedges:n}=this.del,i=this.flips,o=this.consd,r=n.length;let s;do{s=0;for(let a=0;a<r;a++){if(o.has(a))continue;i.delete(a);const h=n[a];h!==-1&&(i.delete(h),this.isDelaunay(a)||(this.flipDiagonal(a),s++))}}while(t&&s>0);return this}constrainAll(t){const n=t.length;for(let i=0;i<n;i++){const o=t[i];this.constrainOne(o[0],o[1])}return this}isConstrained(t){return this.consd.has(t)}findEdge(t,n){const i=this.vertMap[n],{triangles:o,halfedges:r}=this.del;let s=i,a;do{if(o[s]===t)return s;a=zt(s),s=r[a]}while(s!==-1&&s!==i);return o[zt(a)]===t?-a:1/0}protect(t){const n=this.del.halfedges[t],i=this.flips,o=this.consd;return i.delete(t),o.add(t),n!==-1?(i.delete(n),o.add(n),n):-t}markFlip(t){const n=this.del.halfedges,i=this.flips;if(this.consd.has(t))return!1;const r=n[t];return r!==-1&&(i.add(t),i.add(r)),!0}flipDiagonal(t){const{triangles:n,halfedges:i}=this.del,o=this.flips,r=this.consd,s=i[t],a=Xt(t),h=zt(t),l=Xt(s),u=zt(s),c=i[a],f=i[l];if(r.has(t))throw new Error("Trying to flip a constrained edge");return n[t]=n[l],i[t]=f,o.set(t,o.has(l))||r.set(t,r.has(l)),f!==-1&&(i[f]=t),i[a]=l,n[s]=n[a],i[s]=c,o.set(s,o.has(a))||r.set(s,r.has(a)),c!==-1&&(i[c]=s),i[l]=a,this.markFlip(t),this.markFlip(h),this.markFlip(s),this.markFlip(u),o.add(a),r.delete(a),o.add(l),r.delete(l),this.updateVert(t),this.updateVert(h),this.updateVert(s),this.updateVert(u),a}isCollinear(t,n,i){const o=this.del.coords;return Et(o[t*2],o[t*2+1],o[n*2],o[n*2+1],o[i*2],o[i*2+1])===0}inCircle(t,n,i,o){const r=this.del.coords;return hi(r[t*2],r[t*2+1],r[n*2],r[n*2+1],r[i*2],r[i*2+1],r[o*2],r[o*2+1])<0}isDelaunay(t){const{triangles:n,halfedges:i}=this.del,o=i[t];if(o===-1)return!0;const r=n[Xt(t)],s=n[t],a=n[zt(t)],h=n[Xt(o)];return!this.inCircle(r,s,a,h)}updateVert(t){const{triangles:n,halfedges:i}=this.del,o=this.vertMap,r=n[t];let s=Xt(t),a=i[s];for(;a!==-1&&a!==t;)s=Xt(a),a=i[s];return o[r]=s,s}intersectSegments(t,n,i,o){const r=this.del.coords;return t===i||t===o||n===i||n===o?!1:Dn(r[t*2],r[t*2+1],r[n*2],r[n*2+1],r[i*2],r[i*2+1],r[o*2],r[o*2+1])}static intersectSegments=Dn}function ae(e,t,n){if(t||(t=[]),typeof e!="object"||e.type!=="FeatureCollection")throw"Argument points must be FeatureCollection";if(!Array.isArray(t))throw"Argument points must be Array of Array";const i=e.features.map(h=>h.geometry.coordinates),o=qe.from(i);let r;const s=[];o.triangles.length!==0&&t.length!==0&&(r=new _r(o),r.constrainAll(t));for(let h=0;h<o.triangles.length;h+=3)s.push([o.triangles[h],o.triangles[h+1],o.triangles[h+2]]);const a=["a","b","c"];return St(s.map(h=>{const l={},u=h.map((c,f)=>{const p=e.features[c],_=p.geometry.coordinates,g=[_[0],_[1]];return _.length===3?g[2]=_[2]:l[a[f]]=p.properties[n],g});return u[3]=u[0],Zt([u],l)}))}function Mr(e,t){const n=[[],[],[],[]],i=[];return Object.keys(e).forEach(o=>{const r=e[o],s=r.forw,a=r.bakw,h=[s[0]-t.forw[0],s[1]-t.forw[1]],l=[a[0]-t.bakw[0],t.bakw[1]-a[1]],u={forw:h,bakw:l};if(i.push(u),h[0]===0||h[1]===0)return;let c=0;h[0]>0&&(c+=1),h[1]>0&&(c+=2),n[c].push(u)}),{perQuad:n,aggregate:i}}function Sr(e){let t=1/0,n=0,i=0;return e.forEach(o=>{const{forw:r,bakw:s}=o,a=Math.hypot(r[0],r[1]),h=Math.hypot(s[0],s[1]);if(h===0)return;const l=a/h,u=Math.atan2(r[0],r[1])-Math.atan2(s[0],s[1]);t=Math.min(t,l),n+=Math.cos(u),i+=Math.sin(u)}),isFinite(t)?[t,Math.atan2(i,n)]:[1,0]}function kr(e,t,n){const{perQuad:i,aggregate:o}=Mr(e,t),r=i.every(h=>h.length>0),a=(n==="birdeye"?r?i:[o]:[o]).map(h=>Sr(h));return a.length===1?[a[0],a[0],a[0],a[0]]:a}function Er(e,t){let n=0;return e[0]>t[0]&&(n+=1),e[1]>t[1]&&(n+=2),n}function Ar(e,t,n){const i=[e[0]-t.forw[0],e[1]-t.forw[1]],r=Math.sqrt(i[0]**2+i[1]**2)/n[0],s=Math.atan2(i[0],i[1])-n[1];return[t.bakw[0]+r*Math.sin(s),t.bakw[1]-r*Math.cos(s)]}function Ir(e,t,n,i){const o=t[0]-e[0],r=t[1]-e[1];if(Math.abs(o)<1e-12&&Math.abs(r)<1e-12)return null;const s=i[0]-n[0],a=i[1]-n[1],h=n[0]-e[0],l=n[1]-e[1],u=o*a-r*s;if(Math.abs(u)<1e-12)return null;const c=(h*a-l*s)/u,f=(h*r-l*o)/u;return c<=1e-10||f<-1e-10||f>1+1e-10?null:{t:c,point:[e[0]+c*o,e[1]+c*r]}}function Pr(e,t,n){const i=n.length;let o=-1/0,r=null;for(let s=0;s<i;s++){const a=(s+1)%i,h=Ir(e,t,n[s].bakw,n[a].bakw);h&&h.t>o&&(o=h.t,r=h.point)}return r}function Yn(e,t){const i=Math.atan2(e[0]-t[0],e[1]-t[1])*(180/Math.PI);return i<0?i+360:i}function Fn(e,t,n,i,o,r){const s=t[0]-e[0],a=t[1]-e[1];if(s===0&&a===0)return null;const h=[];if(s!==0)for(const u of[n,i]){const c=(u-e[0])/s;if(c>0){const f=e[1]+c*a;f>=o&&f<=r&&h.push({t:c,x:u,y:f})}}if(a!==0)for(const u of[o,r]){const c=(u-e[1])/a;if(c>0){const f=e[0]+c*s;f>=n&&f<=i&&h.push({t:c,x:f,y:u})}}if(h.length===0)return null;h.sort((u,c)=>u.t-c.t);const l=h[0];return[l.x,l.y]}function Rn(e,t,n){const i=e.length,o=new Array(i).fill(1);for(const r of t)for(let s=0;s<i;s++){const a=(s+1)%i,h=Ze([e[s].bakw,e[a].bakw]),l=Ze([n.bakw,r.bakw]),u=Ai(h,l);if(u.features.length>0&&u.features[0].geometry){const c=u.features[0],f=Math.sqrt(Math.pow(r.bakw[0]-n.bakw[0],2)+Math.pow(r.bakw[1]-n.bakw[1],2)),p=Math.sqrt(Math.pow(c.geometry.coordinates[0]-n.bakw[0],2)+Math.pow(c.geometry.coordinates[1]-n.bakw[1],2)),_=f/p;_>o[s]&&(o[s]=_),_>o[a]&&(o[a]=_)}}e.forEach((r,s)=>{const a=o[s];r.bakw=[(r.bakw[0]-n.bakw[0])*a+n.bakw[0],(r.bakw[1]-n.bakw[1])*a+n.bakw[1]]})}function Ln(e,t,n){const{convexBuf:i,centroid:o,allGcps:r,minx:s,maxx:a,miny:h,maxy:l}=e,u=kr(i,o,t),f=[[s,h],[a,h],[a,l],[s,l]].map(w=>({forw:w,bakw:Ar(w,o,u[Er(w,o.forw)])}));if(f.sort((w,A)=>Math.atan2(w.forw[0]-o.forw[0],w.forw[1]-o.forw[1])-Math.atan2(A.forw[0]-o.forw[0],A.forw[1]-o.forw[1])),Rn(f,r,o),!n)return f;const p=4,_=f.map(w=>Math.atan2(w.forw[0]-o.forw[0],w.forw[1]-o.forw[1])),g=f.map(w=>Math.atan2(w.bakw[0]-o.bakw[0],-(w.bakw[1]-o.bakw[1])));function I(w){for(let A=0;A<p;A++){const S=(A+1)%p,E=_[A],O=A<p-1?_[S]:_[S]+2*Math.PI;let B=w;for(;B<E;)B+=2*Math.PI;for(;B>=E+2*Math.PI;)B-=2*Math.PI;if(B>=E&&B<O)return{i:A,j:S,frac:(B-E)/(O-E)}}return{i:0,j:1,frac:0}}function M(w){const{i:A,j:S,frac:E}=I(w),O=g[A];let X=g[S]-O;for(;X>Math.PI;)X-=2*Math.PI;for(;X<-Math.PI;)X+=2*Math.PI;return O+E*X}const m=new Set(f.map(w=>Math.floor(Yn(w.forw,o.forw)/10)%36)),b=r.map(w=>({forw:w.forw,bakw:w.bakw,angleDeg:Yn(w.forw,o.forw),forwDist:Math.hypot(w.forw[0]-o.forw[0],w.forw[1]-o.forw[1])})),d=[];for(let w=0;w<36;w++){if(m.has(w))continue;const A=w*10,S=b.filter(P=>P.angleDeg>=A&&P.angleDeg<A+10);let E=null;if(S.length>0){const P=S.reduce((k,T)=>T.forwDist>k.forwDist?T:k);E=Fn(o.forw,P.forw,s,a,h,l)}if(!E){const P=(A+5)%360*(Math.PI/180),k=[o.forw[0]+Math.sin(P),o.forw[1]+Math.cos(P)];E=Fn(o.forw,k,s,a,h,l)}if(!E)continue;const O=[E[0]-o.forw[0],E[1]-o.forw[1]],B=Math.atan2(O[0],O[1]),X=M(B),F=[o.bakw[0]+Math.sin(X),o.bakw[1]-Math.cos(X)],y=Pr(o.bakw,F,f);y&&d.push({forw:E,bakw:y})}const v=[...f,...d];return v.sort((w,A)=>Math.atan2(w.forw[0]-o.forw[0],w.forw[1]-o.forw[1])-Math.atan2(A.forw[0]-o.forw[0],A.forw[1]-o.forw[1])),Rn(v,r,o),v}function Or(e,t=!1){return Ln(e,"plain",t)}function Br(e,t=!1){return Ln(e,"birdeye",t)}function $n(e){const n=new Nr(e).findSegmentIntersections(),i=Gn(n),o=new Map;return i.forEach(r=>{o.set(`${r.x}:${r.y}`,r)}),Array.from(o.values()).map(r=>Dt([r.x,r.y]))}class Nr{_xx;_yy;_ii;_nn;_zz=null;_zlimit=0;_bb=null;_allBounds=null;_arcIter=null;_filteredArcIter=null;buf;constructor(t){this.initArcs(t)}initArcs(t){const n=[],i=[],o=t.map(r=>{const s=r?r.length:0;for(let a=0;a<s;a++)n.push(r[a][0]),i.push(r[a][1]);return s});this.initXYData(o,n,i)}initXYData(t,n,i){const o=t.length;this._xx=new Float64Array(n),this._yy=new Float64Array(i),this._nn=new Uint32Array(t),this._zz=null,this._zlimit=0,this._filteredArcIter=null,this._ii=new Uint32Array(o);let r=0;for(let s=0;s<o;s++)this._ii[s]=r,r+=t[s];(r!=this._xx.length||this._xx.length!=this._yy.length)&&ze("ArcCollection#initXYData() Counting error"),this.initBounds(),this._arcIter=new Wr(this._xx,this._yy)}initBounds(){const t=this.calcArcBounds_(this._xx,this._yy,this._nn);this._bb=t.bb,this._allBounds=t.bounds}calcArcBounds_(t,n,i){const o=i.length,r=new Float64Array(o*4),s=new le;let a=0,h,l,u;for(let c=0;c<o;c++)h=i[c],h>0&&(l=c*4,u=Zr(t,n,a,h),r[l++]=u[0],r[l++]=u[1],r[l++]=u[2],r[l]=u[3],a+=h,s.mergeBounds(u));return{bb:r,bounds:s}}getBounds(){return this._allBounds?this._allBounds.clone():new le}forEachSegment(t){let n=0;for(let i=0,o=this.size();i<o;i++)n+=this.forEachArcSegment(i,t);return n}size(){return this._ii&&this._ii.length||0}forEachArcSegment(t,n){const i=t>=0,o=i?t:~t,r=this.getRetainedInterval(),s=this._nn[o],a=i?1:-1;let h=i?this._ii[o]:this._ii[o]+s-1,l=h,u=0;for(let c=1;c<s;c++)l+=a,(r===0||this._zz[l]>=r)&&(n(h,l,this._xx,this._yy),h=l,u++);return u}getRetainedInterval(){return this._zlimit}getVertexData(){return{xx:this._xx,yy:this._yy,zz:this._zz,bb:this._bb,nn:this._nn,ii:this._ii}}getUint32Array(t){const n=t*4;return(!this.buf||this.buf.byteLength<n)&&(this.buf=new ArrayBuffer(n)),new Uint32Array(this.buf,0,t)}getAvgSegment2(){let t=0,n=0;const i=this.forEachSegment((o,r,s,a)=>{t+=Math.abs(s[o]-s[r]),n+=Math.abs(a[o]-a[r])});return[t/i||0,n/i||0]}calcSegmentIntersectionStripeCount(){const t=this.getBounds().height(),n=this.getAvgSegment2()[1];let i=1;return n>0&&t>0&&(i=Math.ceil(t/n/20)),i||1}findSegmentIntersections(){const t=this.getBounds(),n=t.ymin||0,i=(t.ymax||0)-n,o=this.calcSegmentIntersectionStripeCount(),r=new Uint32Array(o),s=o>1?g=>Math.floor((o-1)*(g-n)/i):()=>0;let a,h;this.forEachSegment((g,I,M,m)=>{let b=s(m[g]);const d=s(m[I]);for(;r[b]=r[b]+2,b!=d;)b+=d>b?1:-1});const l=this.getUint32Array(Cr(r));let u=0;const c=[];Dr(r,g=>{const I=u;u+=g,c.push(l.subarray(I,u))}),Yr(r,0),this.forEachSegment((g,I,M,m)=>{let b=s(m[g]);const d=s(m[I]);let v,w;for(;v=r[b],r[b]=v+2,w=c[b],w[v]=g,w[v+1]=I,b!=d;)b+=d>b?1:-1});const f=this.getVertexData(),p=[];let _;for(a=0;a<o;a++)if(f.xx&&f.yy)for(_=Fr(c[a],f.xx,f.yy),h=0;h<_.length;h++)p.push(_[h]);return Gn(p)}}function ze(...e){const t=e.join(" ");throw new Error(t)}function Ge(e){return e?Xr(e)?!0:Tr(e)?!1:e.length===0?!0:e.length>0:!1}function Tr(e){return e!=null&&e.toString===String.prototype.toString}function Xr(e){return Array.isArray(e)}function Cr(e,t){Ge(e)||ze("utils.sum() expects an array, received:",e);let n=0,i;for(let o=0,r=e.length;o<r;o++)i=e[o],i&&(n+=i);return n}function Dr(e,t,n){if(!Ge(e))throw new Error(`#forEach() takes an array-like argument. ${e}`);for(let i=0,o=e.length;i<o;i++)t.call(n,e[i],i)}function Yr(e,t){for(let n=0,i=e.length;n<i;n++)e[n]=t;return e}function Fr(e,t,n){const i=e.length-2,o=[];let r,s,a,h,l,u,c,f,p,_,g,I,M,m,b,d,v;for(Jr(t,e),d=0;d<i;){for(r=e[d],s=e[d+1],l=t[r],u=t[s],p=n[r],_=n[s],v=d;v<i&&(v+=2,a=e[v],c=t[a],!(u<c));){if(g=n[a],h=e[v+1],f=t[h],I=n[h],p>=g){if(p>I&&_>g&&_>I)continue}else if(p<I&&_<g&&_<I)continue;r==a||r==h||s==a||s==h||(M=Rr(l,p,u,_,c,g,f,I),M&&(m=[r,s],b=[a,h],o.push(Un(M,m,b,t,n)),M.length==4&&o.push(Un(M.slice(2),m,b,t,n))))}d+=2}return o}function Rr(e,t,n,i,o,r,s,a){const h=Lr(e,t,n,i,o,r,s,a);let l=null;return h&&(l=$r(e,t,n,i,o,r,s,a),l?Gr(e,t,n,i,o,r,s,a)&&(l=null):l=zr(e,t,n,i,o,r,s,a)),l}function Lr(e,t,n,i,o,r,s,a){return ce(e,t,n,i,o,r)*ce(e,t,n,i,s,a)<=0&&ce(o,r,s,a,e,t)*ce(o,r,s,a,n,i)<=0}function ce(e,t,n,i,o,r){return jn(e-o,t-r,n-o,i-r)}function jn(e,t,n,i){return e*i-t*n}function $r(e,t,n,i,o,r,s,a){let h=Me(e,t,n,i,o,r,s,a),l;return h&&(l=Vr(h[0],h[1],e,t,n,i,o,r,s,a),l==1?h=Me(n,i,e,t,o,r,s,a):l==2?h=Me(o,r,s,a,e,t,n,i):l==3&&(h=Me(s,a,o,r,e,t,n,i))),h&&Ur(h,e,t,n,i,o,r,s,a),h}function Me(e,t,n,i,o,r,s,a){const h=jn(n-e,i-t,s-o,a-r),l=1e-18;let u;if(h===0)return null;const c=ce(o,r,s,a,e,t)/h;return h<=l&&h>=-l?u=jr(e,t,n,i,o,r,s,a):u=[e+c*(n-e),t+c*(i-t)],u}function jr(e,t,n,i,o,r,s,a){let h=null;return!Ct(e,o,s)&&!Ct(t,r,a)?h=[e,t]:!Ct(n,o,s)&&!Ct(i,r,a)?h=[n,i]:!Ct(o,e,n)&&!Ct(r,t,i)?h=[o,r]:!Ct(s,e,n)&&!Ct(a,t,i)&&(h=[s,a]),h}function Ct(e,t,n){let i;return t<n?i=e<t||e>n:t>n?i=e>t||e<n:i=e!=t,i}function Vr(e,t,...n){let i=-1,o=1/0,r;for(let s=0,a=0,h=n.length;a<h;s++,a+=2)r=qr(e,t,n[a],n[a+1]),r<o&&(o=r,i=s);return i}function qr(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function Ur(e,t,n,i,o,r,s,a,h){let l=e[0],u=e[1];l=Se(l,t,i),l=Se(l,r,a),u=Se(u,n,o),u=Se(u,s,h),e[0]=l,e[1]=u}function Se(e,t,n){let i;return Ct(e,t,n)&&(i=Math.abs(e-t)<Math.abs(e-n)?t:n,e=i),e}function zr(e,t,n,i,o,r,s,a){const h=Math.min(e,n,o,s),l=Math.max(e,n,o,s),u=Math.min(t,i,r,a),c=Math.max(t,i,r,a),f=c-u>l-h;let p=[];return(f?$t(t,u,c):$t(e,h,l))&&p.push(e,t),(f?$t(i,u,c):$t(n,h,l))&&p.push(n,i),(f?$t(r,u,c):$t(o,h,l))&&p.push(o,r),(f?$t(a,u,c):$t(s,h,l))&&p.push(s,a),(p.length!=2&&p.length!=4||p.length==4&&p[0]==p[2]&&p[1]==p[3])&&(p=null),p}function Gr(e,t,n,i,o,r,s,a){return e==o&&t==r||e==s&&t==a||n==o&&i==r||n==s&&i==a}function $t(e,t,n){return e>t&&e<n}function Jr(e,t){Kr(e,t),Vn(e,t,0,t.length-2)}function Kr(e,t){for(let n=0,i=t.length;n<i;n+=2)e[t[n]]>e[t[n+1]]&&Qr(t,n,n+1)}function Qr(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Vn(e,t,n,i){let o=n,r=i,s,a;for(;o<i;){for(s=e[t[n+i>>2<<1]];o<=r;){for(;e[t[o]]<s;)o+=2;for(;e[t[r]]>s;)r-=2;o<=r&&(a=t[o],t[o]=t[r],t[r]=a,a=t[o+1],t[o+1]=t[r+1],t[r+1]=a,o+=2,r-=2)}if(r-n<40?qn(e,t,n,r):Vn(e,t,n,r),i-o<40){qn(e,t,o,i);return}n=o,r=i}}function qn(e,t,n,i){let o,r;for(let s=n+2;s<=i;s+=2){o=t[s],r=t[s+1];let a;for(a=s-2;a>=n&&e[o]<e[t[a]];a-=2)t[a+2]=t[a],t[a+3]=t[a+1];t[a+2]=o,t[a+3]=r}}function Un(e,t,n,i,o){const r=e[0],s=e[1];t=zn(r,s,t[0],t[1],i,o),n=zn(r,s,n[0],n[1],i,o);const a=t[0]<n[0]?t:n,h=a==t?n:t;return{x:r,y:s,a,b:h}}function zn(e,t,n,i,o,r){let s=n<i?n:i,a=s===n?i:n;return o[s]==e&&r[s]==t?a=s:o[a]==e&&r[a]==t&&(s=a),[s,a]}function Gn(e){const t={};return e.filter(n=>{const i=Hr(n);return i in t?!1:(t[i]=!0,!0)})}function Hr(e){return`${e.a.join(",")};${e.b.join(",")}`}class Wr{_i=0;_n=0;_inc=1;_xx;_yy;i=0;x=0;y=0;constructor(t,n){this._xx=t,this._yy=n}}function Zr(e,t,n,i){let o=n|0;const r=isNaN(i)?e.length-o:i+o;let s,a,h,l,u,c;if(r>0)h=u=e[o],l=c=t[o];else return[void 0,void 0,void 0,void 0];for(o++;o<r;o++)s=e[o],a=t[o],s<h&&(h=s),s>u&&(u=s),a<l&&(l=a),a>c&&(c=a);return[h,l,u,c]}class le{xmin;ymin;xmax;ymax;constructor(...t){t.length>0&&this.setBounds(t)}cloneBounds(){return this.clone()}clone(){return new le(this.xmin,this.ymin,this.xmax,this.ymax)}width(){return this.xmax-this.xmin||0}height(){return this.ymax-this.ymin||0}setBounds(t,n,i,o){let r,s,a,h;if(arguments.length==1)if(Ge(t)){const l=t;r=l[0],s=l[1],a=l[2],h=l[3]}else{const l=t;r=l.xmin,s=l.ymin,a=l.xmax,h=l.ymax}else r=t,s=n,a=i,h=o;return this.xmin=r,this.ymin=s,this.xmax=a,this.ymax=h,(r>a||s>h)&&this.update(),this}update(){let t;this.xmin>this.xmax&&(t=this.xmin,this.xmin=this.xmax,this.xmax=t),this.ymin>this.ymax&&(t=this.ymin,this.ymin=this.ymax,this.ymax=t)}mergeBounds(t,...n){let i,o,r,s;return t instanceof le?(i=t.xmin,o=t.ymin,r=t.xmax,s=t.ymax):n.length==3?(i=t,o=n[0],r=n[1],s=n[2]):t.length==4?(i=t[0],o=t[1],r=t[2],s=t[3]):ze("Bounds#mergeBounds() invalid argument:",t),this.xmin===void 0?this.setBounds(i,o,r,s):(i<this.xmin&&(this.xmin=i),o<this.ymin&&(this.ymin=o),r>this.xmax&&(this.xmax=r),s>this.ymax&&(this.ymax=s)),this}}function ke(e){const t=["a","b","c"].map(n=>e.properties[n].index);return[[0,1],[0,2],[1,2],[0,1,2]].map(n=>n.map(i=>t[i]).sort().join("-")).sort()}function Je(e,t,n){const i=ke(t.forw),o=ke(t.bakw);if(JSON.stringify(i)!=JSON.stringify(o))throw`${JSON.stringify(t,null,2)}
1
+ (function(bt,Bt){typeof exports=="object"&&typeof module<"u"?Bt(exports):typeof define=="function"&&define.amd?define(["exports"],Bt):(bt=typeof globalThis<"u"?globalThis:bt||self,Bt(bt.tin={}))})(this,(function(bt){"use strict";function Bt(e,t,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function Dt(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!tn(e[0])||!tn(e[1]))throw new Error("coordinates must contain numbers");return Bt({type:"Point",coordinates:e},t,n)}function te(e,t,n={}){for(const o of e){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let r=0;r<o[o.length-1].length;r++)if(o[o.length-1][r]!==o[0][r])throw new Error("First and last Position are not equivalent.")}return Bt({type:"Polygon",coordinates:e},t,n)}function Ze(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return Bt({type:"LineString",coordinates:e},t,n)}function St(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function tn(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function ti(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ei(e){return e.type==="Feature"?e.geometry:e}function Pe(e,t,n){if(e!==null)for(var i,o,r,s,a,f,l,u=0,c=0,h,p=e.type,M=p==="FeatureCollection",w=p==="Feature",I=M?e.features.length:1,x=0;x<I;x++){l=M?e.features[x].geometry:w?e.geometry:e,h=l?l.type==="GeometryCollection":!1,a=h?l.geometries.length:1;for(var m=0;m<a;m++){var _=0,d=0;if(s=h?l.geometries[m]:l,s!==null){f=s.coordinates;var v=s.type;switch(u=n&&(v==="Polygon"||v==="MultiPolygon")?1:0,v){case null:break;case"Point":if(t(f,c,x,_,d)===!1)return!1;c++,_++;break;case"LineString":case"MultiPoint":for(i=0;i<f.length;i++){if(t(f[i],c,x,_,d)===!1)return!1;c++,v==="MultiPoint"&&_++}v==="LineString"&&_++;break;case"Polygon":case"MultiLineString":for(i=0;i<f.length;i++){for(o=0;o<f[i].length-u;o++){if(t(f[i][o],c,x,_,d)===!1)return!1;c++}v==="MultiLineString"&&_++,v==="Polygon"&&d++}v==="Polygon"&&_++;break;case"MultiPolygon":for(i=0;i<f.length;i++){for(d=0,o=0;o<f[i].length;o++){for(r=0;r<f[i][o].length-u;r++){if(t(f[i][o][r],c,x,_,d)===!1)return!1;c++}d++}_++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(Pe(s.geometries[i],t,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}const ut=11102230246251565e-32,U=134217729,en=(3+8*ut)*ut;function ft(e,t,n,i,o){let r,s,a,f,l=t[0],u=i[0],c=0,h=0;u>l==u>-l?(r=l,l=t[++c]):(r=u,u=i[++h]);let p=0;if(c<e&&h<n)for(u>l==u>-l?(s=l+r,a=r-(s-l),l=t[++c]):(s=u+r,a=r-(s-u),u=i[++h]),r=s,a!==0&&(o[p++]=a);c<e&&h<n;)u>l==u>-l?(s=r+l,f=s-r,a=r-(s-f)+(l-f),l=t[++c]):(s=r+u,f=s-r,a=r-(s-f)+(u-f),u=i[++h]),r=s,a!==0&&(o[p++]=a);for(;c<e;)s=r+l,f=s-r,a=r-(s-f)+(l-f),l=t[++c],r=s,a!==0&&(o[p++]=a);for(;h<n;)s=r+u,f=s-r,a=r-(s-f)+(u-f),u=i[++h],r=s,a!==0&&(o[p++]=a);return(r!==0||p===0)&&(o[p++]=r),p}function Mt(e,t,n,i,o,r,s,a){return ft(ft(e,t,n,i,s),s,o,r,a)}function $(e,t,n,i){let o,r,s,a,f,l,u,c,h,p,M;u=U*n,p=u-(u-n),M=n-p;let w=t[0];o=w*n,u=U*w,c=u-(u-w),h=w-c,s=h*M-(o-c*p-h*p-c*M);let I=0;s!==0&&(i[I++]=s);for(let x=1;x<e;x++)w=t[x],a=w*n,u=U*w,c=u-(u-w),h=w-c,f=h*M-(a-c*p-h*p-c*M),r=o+f,l=r-o,s=o-(r-l)+(f-l),s!==0&&(i[I++]=s),o=a+r,s=r-(o-a),s!==0&&(i[I++]=s);return(o!==0||I===0)&&(i[I++]=o),I}function nn(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function tt(e){return new Float64Array(e)}const ni=(3+16*ut)*ut,ii=(2+12*ut)*ut,ri=(9+64*ut)*ut*ut,Jt=tt(4),rn=tt(8),on=tt(12),sn=tt(16),mt=tt(4);function oi(e,t,n,i,o,r,s){let a,f,l,u,c,h,p,M,w,I,x,m,_,d,v,g,k,S;const A=e-o,O=n-o,B=t-r,C=i-r;d=A*C,h=U*A,p=h-(h-A),M=A-p,h=U*C,w=h-(h-C),I=C-w,v=M*I-(d-p*w-M*w-p*I),g=B*O,h=U*B,p=h-(h-B),M=B-p,h=U*O,w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M=f-p,h=U*l,w=h-(h-l),I=l-w,k=M*I-(g-p*w-M*w-p*I),x=v-k,c=v-x,mt[0]=v-(x+c)+(c-k),m=d+x,c=m-d,_=d-(m-c)+(x-c),x=_-g,c=_-x,mt[1]=_-(x+c)+(c-g),S=m+x,c=S-m,mt[2]=m-(S-c)+(x-c),mt[3]=S;const T=ft(E,on,4,mt,sn);return sn[T-1]}function Et(e,t,n,i,o,r){const s=(t-r)*(n-o),a=(e-o)*(i-r),f=s-a,l=Math.abs(s+a);return Math.abs(f)>=ni*l?f:-oi(e,t,n,i,o,r,l)}const si=(10+96*ut)*ut,ai=(4+48*ut)*ut,ci=(44+576*ut)*ut*ut,Ft=tt(4),Yt=tt(4),Rt=tt(4),At=tt(4),It=tt(4),Pt=tt(4),gt=tt(4),wt=tt(4),Oe=tt(8),Be=tt(8),Ne=tt(8),Te=tt(8),Ce=tt(8),Xe=tt(8),ge=tt(8),we=tt(8),ye=tt(8),Vt=tt(4),qt=tt(4),Ut=tt(4),z=tt(8),K=tt(16),nt=tt(16),it=tt(16),et=tt(32),$t=tt(32),st=tt(48),xt=tt(64);let Kt=tt(1152),De=tt(1152);function at(e,t,n){e=ft(e,Kt,t,n,De);const i=Kt;return Kt=De,De=i,e}function li(e,t,n,i,o,r,s,a,f){let l,u,c,h,p,M,w,I,x,m,_,d,v,g,k,S,A,O,B,C,Y,y,P,E,T,X,F,b,N,D,R,L,j,q,V;const J=e-s,G=n-s,Q=o-s,H=t-a,Z=i-a,W=r-a;R=G*W,P=U*G,E=P-(P-G),T=G-E,P=U*W,X=P-(P-W),F=W-X,L=T*F-(R-E*X-T*X-E*F),j=Q*Z,P=U*Q,E=P-(P-Q),T=Q-E,P=U*Z,X=P-(P-Z),F=Z-X,q=T*F-(j-E*X-T*X-E*F),b=L-q,y=L-b,Ft[0]=L-(b+y)+(y-q),N=R+b,y=N-R,D=R-(N-y)+(b-y),b=D-j,y=D-b,Ft[1]=D-(b+y)+(y-j),V=N+b,y=V-N,Ft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=V,k=ft(4,gt,4,wt,we),R=c*w,P=U*c,E=P-(P-c),T=c-E,P=U*w,X=P-(P-w),F=w-X,L=T*F-(R-E*X-T*X-E*F),j=h*M,P=U*h,E=P-(P-h),T=h-E,P=U*M,X=P-(P-M),F=M-X,q=T*F-(j-E*X-T*X-E*F),b=L-q,y=L-b,qt[0]=L-(b+y)+(y-q),N=R+b,y=N-R,D=R-(N-y)+(b-y),b=D-j,y=D-b,qt[1]=D-(b+y)+(y-j),V=N+b,y=V-N,qt[2]=N-(V-y)+(b-y),qt[3]=V,O=4):(we[0]=0,k=1,qt[0]=0,O=1),u!==0){const rt=$(k,we,u,it);l=at(l,ft($(I,Oe,u,K),K,$(rt,it,2*J,et),et,st),st);const ot=$(O,qt,u,z);l=at(l,Mt($(ot,z,2*J,K),K,$(ot,z,u,nt),nt,$(rt,it,u,et),et,$t,xt),xt),M!==0&&(l=at(l,$($(4,Pt,u,z),z,M,K),K)),w!==0&&(l=at(l,$($(4,It,-u,z),z,w,K),K))}if(p!==0){const rt=$(k,we,p,it);l=at(l,ft($(x,Be,p,K),K,$(rt,it,2*H,et),et,st),st);const ot=$(O,qt,p,z);l=at(l,Mt($(ot,z,2*H,K),K,$(ot,z,p,nt),nt,$(rt,it,p,et),et,$t,xt),xt)}}if(c!==0||M!==0){if(h!==0||w!==0||u!==0||p!==0?(R=h*H,P=U*h,E=P-(P-h),T=h-E,P=U*H,X=P-(P-H),F=H-X,L=T*F-(R-E*X-T*X-E*F),j=Q*p,P=U*Q,E=P-(P-Q),T=Q-E,P=U*p,X=P-(P-p),F=p-X,q=T*F-(j-E*X-T*X-E*F),b=L+q,y=b-L,gt[0]=L-(b-y)+(q-y),N=R+b,y=N-R,D=R-(N-y)+(b-y),b=D+j,y=b-D,gt[1]=D-(b-y)+(j-y),V=N+b,y=V-N,gt[2]=N-(V-y)+(b-y),gt[3]=V,C=-W,Y=-w,R=u*C,P=U*u,E=P-(P-u),T=u-E,P=U*C,X=P-(P-C),F=C-X,L=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it,2*W,et),et,st),st);const ot=$(A,Vt,w,z);l=at(l,Mt($(ot,z,2*W,K),K,$(ot,z,w,nt),nt,$(rt,it,w,et),et,$t,xt),xt)}}return Kt[l-1]}function fi(e,t,n,i,o,r,s,a){const f=e-s,l=n-s,u=o-s,c=t-a,h=i-a,p=r-a,M=l*p,w=u*h,I=f*f+c*c,x=u*c,m=f*p,_=l*l+h*h,d=f*h,v=l*c,g=u*u+p*p,k=I*(M-w)+_*(x-m)+g*(d-v),S=(Math.abs(M)+Math.abs(w))*I+(Math.abs(x)+Math.abs(m))*_+(Math.abs(d)+Math.abs(v))*g,A=si*S;return k>A||-k>A?k:li(e,t,n,i,o,r,s,a,S)}function hi(e,t){var n,i,o=0,r,s,a,f,l,u,c,h=e[0],p=e[1],M=t.length;for(n=0;n<M;n++){i=0;var w=t[n],I=w.length-1;if(u=w[0],u[0]!==w[I][0]&&u[1]!==w[I][1])throw new Error("First and last coordinates in a ring must be the same");for(s=u[0]-h,a=u[1]-p,i;i<I;i++){if(c=w[i+1],f=c[0]-h,l=c[1]-p,a===0&&l===0){if(f<=0&&s>=0||s<=0&&f>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(r=Et(s,f,a,l,0,0),r===0)return 0;(r>0&&l>0&&a<=0||r<0&&l<=0&&a>0)&&o++}u=c,a=l,s=f}}return o%2!==0}function Fe(e,t,n={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const i=ti(e),o=ei(t),r=o.type,s=t.bbox;let a=o.coordinates;if(s&&ui(i,s)===!1)return!1;r==="Polygon"&&(a=[a]);for(var f=0;f<a.length;++f){const l=hi(i,a[f]);if(l===0&&!n.ignoreBoundary)return!0;if(l)return!0}return!1}function ui(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}class Ye{constructor(t=[],n=di){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:i}=this,o=n[t];for(;t>0;){const r=t-1>>1,s=n[r];if(i(o,s)>=0)break;n[t]=s,t=r}n[t]=o}_down(t){const{data:n,compare:i}=this,o=this.length>>1,r=n[t];for(;t<o;){let s=(t<<1)+1,a=n[s];const f=s+1;if(f<this.length&&i(n[f],a)<0&&(s=f,a=n[f]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}}function di(e,t){return e<t?-1:e>t?1:0}const pi=Object.freeze(Object.defineProperty({__proto__:null,default:Ye},Symbol.toStringTag,{value:"Module"})),Nt=11102230246251565e-32,dt=134217729,mi=(3+8*Nt)*Nt;function Re(e,t,n,i,o){let r,s,a,f,l=t[0],u=i[0],c=0,h=0;u>l==u>-l?(r=l,l=t[++c]):(r=u,u=i[++h]);let p=0;if(c<e&&h<n)for(u>l==u>-l?(s=l+r,a=r-(s-l),l=t[++c]):(s=u+r,a=r-(s-u),u=i[++h]),r=s,a!==0&&(o[p++]=a);c<e&&h<n;)u>l==u>-l?(s=r+l,f=s-r,a=r-(s-f)+(l-f),l=t[++c]):(s=r+u,f=s-r,a=r-(s-f)+(u-f),u=i[++h]),r=s,a!==0&&(o[p++]=a);for(;c<e;)s=r+l,f=s-r,a=r-(s-f)+(l-f),l=t[++c],r=s,a!==0&&(o[p++]=a);for(;h<n;)s=r+u,f=s-r,a=r-(s-f)+(u-f),u=i[++h],r=s,a!==0&&(o[p++]=a);return(r!==0||p===0)&&(o[p++]=r),p}function gi(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function ee(e){return new Float64Array(e)}const wi=(3+16*Nt)*Nt,yi=(2+12*Nt)*Nt,vi=(9+64*Nt)*Nt*Nt,Qt=ee(4),an=ee(8),cn=ee(12),ln=ee(16),yt=ee(4);function bi(e,t,n,i,o,r,s){let a,f,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c=_-x,yt[1]=_-(x+c)+(c-g),S=m+x,c=S-m,yt[2]=m-(S-c)+(x-c),yt[3]=S;const E=Re(P,an,4,yt,cn);d=a*u,h=dt*a,p=h-(h-a),M=a-p,h=dt*u,w=h-(h-u),I=u-w,v=M*I-(d-p*w-M*w-p*I),g=f*l,h=dt*f,p=h-(h-f),M=f-p,h=dt*l,w=h-(h-l),I=l-w,k=M*I-(g-p*w-M*w-p*I),x=v-k,c=v-x,yt[0]=v-(x+c)+(c-k),m=d+x,c=m-d,_=d-(m-c)+(x-c),x=_-g,c=_-x,yt[1]=_-(x+c)+(c-g),S=m+x,c=S-m,yt[2]=m-(S-c)+(x-c),yt[3]=S;const T=Re(E,cn,4,yt,ln);return ln[T-1]}function fn(e,t,n,i,o,r){const s=(t-r)*(n-o),a=(e-o)*(i-r),f=s-a;if(s===0||a===0||s>0!=a>0)return f;const l=Math.abs(s+a);return Math.abs(f)>=wi*l?f:-bi(e,t,n,i,o,r,l)}function xi(e,t){const n=new Ye([],hn);return Mi(e,n),Si(n,t)}function hn(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x||e.p.x===t.p.x&&(e.featureId!==t.featureId||e.ringId!==t.ringId)&&e.isLeftEndpoint&&!t.isLeftEndpoint?-1:e.p.y!==t.p.y?e.p.y>t.p.y?1:-1:1}function _i(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y!==t.rightSweepEvent.p.y?e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1:1}function Mi(e,t){if(e.type==="FeatureCollection"){const n=e.features;for(let i=0;i<n.length;i++)un(n[i],t)}else un(e,t)}var ve=0,be=0,xe=0;function un(e,t){const n=e.type==="Feature"?e.geometry:e;let i=n.coordinates;(n.type==="Polygon"||n.type==="MultiLineString")&&(i=[i]),n.type==="LineString"&&(i=[[i]]);for(let o=0;o<i.length;o++)for(let r=0;r<i[o].length;r++){let s=i[o][r][0],a=null;be=be+1;for(let f=0;f<i[o][r].length-1;f++){a=i[o][r][f+1];const l=new dn(s,ve,be,xe),u=new dn(a,ve,be,xe+1);l.otherEvent=u,u.otherEvent=l,hn(l,u)>0?(u.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,u.isLeftEndpoint=!1),t.push(l),t.push(u),s=a,xe=xe+1}}ve=ve+1}var dn=class{constructor(e,t,n,i){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=n,this.eventId=i,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}asNewXY(){return[this.p.x,this.p.y]}};function Si(e,t=!1){const n=[],i=new Ye([],_i);for(;e.length;){const o=e.pop();if(o.isLeftEndpoint){const r=new ki(o);for(let s=0;s<i.data.length;s++){const a=i.data[s];if(t&&a.leftSweepEvent.featureId===o.featureId)continue;const f=Ei(r,a);f!==!1&&n.push(f)}i.push(r)}else o.isLeftEndpoint===!1&&i.pop()}return n}var ki=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function Ei(e,t){if(e===null||t===null)return!1;const n=e.leftSweepEvent.p.x,i=e.leftSweepEvent.p.y,o=e.rightSweepEvent.p.x,r=e.rightSweepEvent.p.y,s=t.leftSweepEvent.p.x,a=t.leftSweepEvent.p.y,f=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,u=fn(n,i,o,r,s,a),c=fn(n,i,o,r,f,l);if(u>0&&c>0)return!1;if(u<0&&c<0)return!1;if(e.leftSweepEvent.ringId===t.leftSweepEvent.ringId){if(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent))return!1}else{if(e.rightSweepEvent.isSamePoint(t.leftSweepEvent))return t.leftSweepEvent.asNewXY();if(e.rightSweepEvent.isSamePoint(t.rightSweepEvent))return t.rightSweepEvent.asNewXY();if(e.leftSweepEvent.isSamePoint(t.leftSweepEvent))return t.leftSweepEvent.asNewXY();if(e.leftSweepEvent.isSamePoint(t.rightSweepEvent))return t.rightSweepEvent.asNewXY()}const h=(l-a)*(o-n)-(f-s)*(r-i),p=(f-s)*(i-a)-(l-a)*(n-s),M=(o-n)*(i-a)-(r-i)*(n-s);if(h===0)return!1;const w=p/h,I=M/h;if(w>=0&&w<=1&&I>=0&&I<=1){const x=n+w*(o-n),m=i+w*(r-i);return[x,m]}return!1}function Ai(e,t,n={}){const{removeDuplicates:i=!0,ignoreSelfIntersections:o=!0}=n;let r=[];e.type==="FeatureCollection"?r=r.concat(e.features):e.type==="Feature"?r.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&r.push(Bt(e)),t.type==="FeatureCollection"?r=r.concat(t.features):t.type==="Feature"?r.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&r.push(Bt(t));const s=xi(St(r),o);let a=[];if(i){const f={};s.forEach(l=>{const u=l.join(",");f[u]||(f[u]=!0,a.push(l))})}else a=s;return St(a.map(f=>Dt(f)))}function Ii(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pi(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var o=!1;try{o=this instanceof i}catch{}return o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}),n}function Oi(e,t={}){let n=0,i=0,o=0;return Pe(e,function(r){n+=r[0],i+=r[1],o++},!0),Dt([n/o,i/o],t.properties)}var _e={exports:{}},Me={exports:{}},Bi=Me.exports,pn;function Ni(){return pn||(pn=1,(function(e,t){(function(n,i){e.exports=i()})(Bi,function(){function n(m,_,d,v,g){(function k(S,A,O,B,C){for(;B>O;){if(B-O>600){var Y=B-O+1,y=A-O+1,P=Math.log(Y),E=.5*Math.exp(2*P/3),T=.5*Math.sqrt(P*E*(Y-E)/Y)*(y-Y/2<0?-1:1),X=Math.max(O,Math.floor(A-y*E/Y+T)),F=Math.min(B,Math.floor(A+(Y-y)*E/Y+T));k(S,A,X,F,C)}var b=S[A],N=O,D=B;for(i(S,O,A),C(S[B],b)>0&&i(S,O,B);N<D;){for(i(S,N,D),N++,D--;C(S[N],b)<0;)N++;for(;C(S[D],b)>0;)D--}C(S[O],b)===0?i(S,O,D):i(S,++D,B),D<=A&&(O=D+1),A<=D&&(B=D-1)}})(m,_,d||0,v||m.length-1,g||o)}function i(m,_,d){var v=m[_];m[_]=m[d],m[d]=v}function o(m,_){return m<_?-1:m>_?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(m,_,d){if(!d)return _.indexOf(m);for(var v=0;v<_.length;v++)if(d(m,_[v]))return v;return-1}function a(m,_){f(m,0,m.children.length,_,m)}function f(m,_,d,v,g){g||(g=I(null)),g.minX=1/0,g.minY=1/0,g.maxX=-1/0,g.maxY=-1/0;for(var k=_;k<d;k++){var S=m.children[k];l(g,m.leaf?v(S):S)}return g}function l(m,_){return m.minX=Math.min(m.minX,_.minX),m.minY=Math.min(m.minY,_.minY),m.maxX=Math.max(m.maxX,_.maxX),m.maxY=Math.max(m.maxY,_.maxY),m}function u(m,_){return m.minX-_.minX}function c(m,_){return m.minY-_.minY}function h(m){return(m.maxX-m.minX)*(m.maxY-m.minY)}function p(m){return m.maxX-m.minX+(m.maxY-m.minY)}function M(m,_){return m.minX<=_.minX&&m.minY<=_.minY&&_.maxX<=m.maxX&&_.maxY<=m.maxY}function w(m,_){return _.minX<=m.maxX&&_.minY<=m.maxY&&_.maxX>=m.minX&&_.maxY>=m.minY}function I(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function x(m,_,d,v,g){for(var k=[_,d];k.length;)if(!((d=k.pop())-(_=k.pop())<=v)){var S=_+Math.ceil((d-_)/v/2)*v;n(m,S,_,d,g),k.push(_,S,S,d)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var _=this.data,d=[];if(!w(m,_))return d;for(var v=this.toBBox,g=[];_;){for(var k=0;k<_.children.length;k++){var S=_.children[k],A=_.leaf?v(S):S;w(m,A)&&(_.leaf?d.push(S):M(m,A)?this._all(S,d):g.push(S))}_=g.pop()}return d},r.prototype.collides=function(m){var _=this.data;if(!w(m,_))return!1;for(var d=[];_;){for(var v=0;v<_.children.length;v++){var g=_.children[v],k=_.leaf?this.toBBox(g):g;if(w(m,k)){if(_.leaf||M(m,k))return!0;d.push(g)}}_=d.pop()}return!1},r.prototype.load=function(m){if(!m||!m.length)return this;if(m.length<this._minEntries){for(var _=0;_<m.length;_++)this.insert(m[_]);return this}var d=this._build(m.slice(),0,m.length-1,0);if(this.data.children.length)if(this.data.height===d.height)this._splitRoot(this.data,d);else{if(this.data.height<d.height){var v=this.data;this.data=d,d=v}this._insert(d,this.data.height-d.height-1,!0)}else this.data=d;return this},r.prototype.insert=function(m){return m&&this._insert(m,this.data.height-1),this},r.prototype.clear=function(){return this.data=I([]),this},r.prototype.remove=function(m,_){if(!m)return this;for(var d,v,g,k=this.data,S=this.toBBox(m),A=[],O=[];k||A.length;){if(k||(k=A.pop(),v=A[A.length-1],d=O.pop(),g=!0),k.leaf){var B=s(m,k.children,_);if(B!==-1)return k.children.splice(B,1),A.push(k),this._condense(A),this}g||k.leaf||!M(k,S)?v?(d++,k=v.children[d],g=!1):k=null:(A.push(k),O.push(d),d=0,v=k,k=k.children[0])}return this},r.prototype.toBBox=function(m){return m},r.prototype.compareMinX=function(m,_){return m.minX-_.minX},r.prototype.compareMinY=function(m,_){return m.minY-_.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(m){return this.data=m,this},r.prototype._all=function(m,_){for(var d=[];m;)m.leaf?_.push.apply(_,m.children):d.push.apply(d,m.children),m=d.pop();return _},r.prototype._build=function(m,_,d,v){var g,k=d-_+1,S=this._maxEntries;if(k<=S)return a(g=I(m.slice(_,d+1)),this.toBBox),g;v||(v=Math.ceil(Math.log(k)/Math.log(S)),S=Math.ceil(k/Math.pow(S,v-1))),(g=I([])).leaf=!1,g.height=v;var A=Math.ceil(k/S),O=A*Math.ceil(Math.sqrt(S));x(m,_,d,O,this.compareMinX);for(var B=_;B<=d;B+=O){var C=Math.min(B+O-1,d);x(m,B,C,A,this.compareMinY);for(var Y=B;Y<=C;Y+=A){var y=Math.min(Y+A-1,C);g.children.push(this._build(m,Y,y,v-1))}}return a(g,this.toBBox),g},r.prototype._chooseSubtree=function(m,_,d,v){for(;v.push(_),!_.leaf&&v.length-1!==d;){for(var g=1/0,k=1/0,S=void 0,A=0;A<_.children.length;A++){var O=_.children[A],B=h(O),C=(Y=m,y=O,(Math.max(y.maxX,Y.maxX)-Math.min(y.minX,Y.minX))*(Math.max(y.maxY,Y.maxY)-Math.min(y.minY,Y.minY))-B);C<k?(k=C,g=B<g?B:g,S=O):C===k&&B<g&&(g=B,S=O)}_=S||_.children[0]}var Y,y;return _},r.prototype._insert=function(m,_,d){var v=d?m:this.toBBox(m),g=[],k=this._chooseSubtree(v,this.data,_,g);for(k.children.push(m),l(k,v);_>=0&&g[_].children.length>this._maxEntries;)this._split(g,_),_--;this._adjustParentBBoxes(v,g,_)},r.prototype._split=function(m,_){var d=m[_],v=d.children.length,g=this._minEntries;this._chooseSplitAxis(d,g,v);var k=this._chooseSplitIndex(d,g,v),S=I(d.children.splice(k,d.children.length-k));S.height=d.height,S.leaf=d.leaf,a(d,this.toBBox),a(S,this.toBBox),_?m[_-1].children.push(S):this._splitRoot(d,S)},r.prototype._splitRoot=function(m,_){this.data=I([m,_]),this.data.height=m.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,_,d){for(var v,g,k,S,A,O,B,C=1/0,Y=1/0,y=_;y<=d-_;y++){var P=f(m,0,y,this.toBBox),E=f(m,y,d,this.toBBox),T=(g=P,k=E,S=void 0,A=void 0,O=void 0,B=void 0,S=Math.max(g.minX,k.minX),A=Math.max(g.minY,k.minY),O=Math.min(g.maxX,k.maxX),B=Math.min(g.maxY,k.maxY),Math.max(0,O-S)*Math.max(0,B-A)),X=h(P)+h(E);T<C?(C=T,v=y,Y=X<Y?X:Y):T===C&&X<Y&&(Y=X,v=y)}return v||d-_},r.prototype._chooseSplitAxis=function(m,_,d){var v=m.leaf?this.compareMinX:u,g=m.leaf?this.compareMinY:c;this._allDistMargin(m,_,d,v)<this._allDistMargin(m,_,d,g)&&m.children.sort(v)},r.prototype._allDistMargin=function(m,_,d,v){m.children.sort(v);for(var g=this.toBBox,k=f(m,0,_,g),S=f(m,d-_,d,g),A=p(k)+p(S),O=_;O<d-_;O++){var B=m.children[O];l(k,m.leaf?g(B):B),A+=p(k)}for(var C=d-_-1;C>=_;C--){var Y=m.children[C];l(S,m.leaf?g(Y):Y),A+=p(S)}return A},r.prototype._adjustParentBBoxes=function(m,_,d){for(var v=d;v>=0;v--)l(_[v],m)},r.prototype._condense=function(m){for(var _=m.length-1,d=void 0;_>=0;_--)m[_].children.length===0?_>0?(d=m[_-1].children).splice(d.indexOf(m[_]),1):this.clear():a(m[_],this.toBBox)},r})})(Me)),Me.exports}const Ti=Pi(pi);var ne={exports:{}},$e,mn;function Ci(){return mn||(mn=1,$e=function(t,n,i,o){var r=t[0],s=t[1],a=!1;i===void 0&&(i=0),o===void 0&&(o=n.length);for(var f=(o-i)/2,l=0,u=f-1;l<f;u=l++){var c=n[i+l*2+0],h=n[i+l*2+1],p=n[i+u*2+0],M=n[i+u*2+1],w=h>s!=M>s&&r<(p-c)*(s-h)/(M-h)+c;w&&(a=!a)}return a}),$e}var Le,gn;function Xi(){return gn||(gn=1,Le=function(t,n,i,o){var r=t[0],s=t[1],a=!1;i===void 0&&(i=0),o===void 0&&(o=n.length);for(var f=o-i,l=0,u=f-1;l<f;u=l++){var c=n[l+i][0],h=n[l+i][1],p=n[u+i][0],M=n[u+i][1],w=h>s!=M>s&&r<(p-c)*(s-h)/(M-h)+c;w&&(a=!a)}return a}),Le}var wn;function Di(){if(wn)return ne.exports;wn=1;var e=Ci(),t=Xi();return ne.exports=function(i,o,r,s){return o.length>0&&Array.isArray(o[0])?t(i,o,r,s):e(i,o,r,s)},ne.exports.nested=t,ne.exports.flat=e,ne.exports}var ie={exports:{}},Fi=ie.exports,yn;function Yi(){return yn||(yn=1,(function(e,t){(function(n,i){i(t)})(Fi,function(n){const o=33306690738754706e-32;function r(w,I,x,m,_){let d,v,g,k,S=I[0],A=m[0],O=0,B=0;A>S==A>-S?(d=S,S=I[++O]):(d=A,A=m[++B]);let C=0;if(O<w&&B<x)for(A>S==A>-S?(g=d-((v=S+d)-S),S=I[++O]):(g=d-((v=A+d)-A),A=m[++B]),d=v,g!==0&&(_[C++]=g);O<w&&B<x;)A>S==A>-S?(g=d-((v=d+S)-(k=v-d))+(S-k),S=I[++O]):(g=d-((v=d+A)-(k=v-d))+(A-k),A=m[++B]),d=v,g!==0&&(_[C++]=g);for(;O<w;)g=d-((v=d+S)-(k=v-d))+(S-k),S=I[++O],d=v,g!==0&&(_[C++]=g);for(;B<x;)g=d-((v=d+A)-(k=v-d))+(A-k),A=m[++B],d=v,g!==0&&(_[C++]=g);return d===0&&C!==0||(_[C++]=d),C}function s(w){return new Float64Array(w)}const a=33306690738754716e-32,f=22204460492503146e-32,l=11093356479670487e-47,u=s(4),c=s(8),h=s(12),p=s(16),M=s(4);n.orient2d=function(w,I,x,m,_,d){const v=(I-d)*(x-_),g=(w-_)*(m-d),k=v-g;if(v===0||g===0||v>0!=g>0)return k;const S=Math.abs(v+g);return Math.abs(k)>=a*S?k:-(function(A,O,B,C,Y,y,P){let E,T,X,F,b,N,D,R,L,j,q,V,J,G,Q,H,Z,W;const ct=A-Y,ht=B-Y,rt=O-y,ot=C-y;b=(Q=(R=ct-(D=(N=134217729*ct)-(N-ct)))*(j=ot-(L=(N=134217729*ot)-(N-ot)))-((G=ct*ot)-D*L-R*L-D*j))-(q=Q-(Z=(R=rt-(D=(N=134217729*rt)-(N-rt)))*(j=ht-(L=(N=134217729*ht)-(N-ht)))-((H=rt*ht)-D*L-R*L-D*j))),u[0]=Q-(q+b)+(b-Z),b=(J=G-((V=G+q)-(b=V-G))+(q-b))-(q=J-H),u[1]=J-(q+b)+(b-H),b=(W=V+q)-V,u[2]=V-(W-b)+(q-b),u[3]=W;let jt=(function(ho,Wn){let Zn=Wn[0];for(let We=1;We<ho;We++)Zn+=Wn[We];return Zn})(4,u),me=f*P;if(jt>=me||-jt>=me||(E=A-(ct+(b=A-ct))+(b-Y),X=B-(ht+(b=B-ht))+(b-Y),T=O-(rt+(b=O-rt))+(b-y),F=C-(ot+(b=C-ot))+(b-y),E===0&&T===0&&X===0&&F===0)||(me=l*P+o*Math.abs(jt),(jt+=ct*F+ot*E-(rt*X+ht*T))>=me||-jt>=me))return jt;b=(Q=(R=E-(D=(N=134217729*E)-(N-E)))*(j=ot-(L=(N=134217729*ot)-(N-ot)))-((G=E*ot)-D*L-R*L-D*j))-(q=Q-(Z=(R=T-(D=(N=134217729*T)-(N-T)))*(j=ht-(L=(N=134217729*ht)-(N-ht)))-((H=T*ht)-D*L-R*L-D*j))),M[0]=Q-(q+b)+(b-Z),b=(J=G-((V=G+q)-(b=V-G))+(q-b))-(q=J-H),M[1]=J-(q+b)+(b-H),b=(W=V+q)-V,M[2]=V-(W-b)+(q-b),M[3]=W;const co=r(4,u,4,M,c);b=(Q=(R=ct-(D=(N=134217729*ct)-(N-ct)))*(j=F-(L=(N=134217729*F)-(N-F)))-((G=ct*F)-D*L-R*L-D*j))-(q=Q-(Z=(R=rt-(D=(N=134217729*rt)-(N-rt)))*(j=X-(L=(N=134217729*X)-(N-X)))-((H=rt*X)-D*L-R*L-D*j))),M[0]=Q-(q+b)+(b-Z),b=(J=G-((V=G+q)-(b=V-G))+(q-b))-(q=J-H),M[1]=J-(q+b)+(b-H),b=(W=V+q)-V,M[2]=V-(W-b)+(q-b),M[3]=W;const lo=r(co,c,4,M,h);b=(Q=(R=E-(D=(N=134217729*E)-(N-E)))*(j=F-(L=(N=134217729*F)-(N-F)))-((G=E*F)-D*L-R*L-D*j))-(q=Q-(Z=(R=T-(D=(N=134217729*T)-(N-T)))*(j=X-(L=(N=134217729*X)-(N-X)))-((H=T*X)-D*L-R*L-D*j))),M[0]=Q-(q+b)+(b-Z),b=(J=G-((V=G+q)-(b=V-G))+(q-b))-(q=J-H),M[1]=J-(q+b)+(b-H),b=(W=V+q)-V,M[2]=V-(W-b)+(q-b),M[3]=W;const fo=r(lo,h,4,M,p);return p[fo-1]})(w,I,x,m,_,d,S)},n.orient2dfast=function(w,I,x,m,_,d){return(I-d)*(x-_)-(w-_)*(m-d)},Object.defineProperty(n,"__esModule",{value:!0})})})(ie,ie.exports)),ie.exports}var vn;function Ri(){if(vn)return _e.exports;vn=1;var e=Ni(),t=Ti,n=Di(),i=Yi().orient2d;t.default&&(t=t.default),_e.exports=o,_e.exports.default=o;function o(d,v,g){v=Math.max(0,v===void 0?2:v),g=g||0;var k=p(d),S=new e(16);S.toBBox=function(D){return{minX:D[0],minY:D[1],maxX:D[0],maxY:D[1]}},S.compareMinX=function(D,R){return D[0]-R[0]},S.compareMinY=function(D,R){return D[1]-R[1]},S.load(d);for(var A=[],O=0,B;O<k.length;O++){var C=k[O];S.remove(C),B=M(C,B),A.push(B)}var Y=new e(16);for(O=0;O<A.length;O++)Y.insert(h(A[O]));for(var y=v*v,P=g*g;A.length;){var E=A.shift(),T=E.p,X=E.next.p,F=w(T,X);if(!(F<P)){var b=F/y;C=r(S,E.prev.p,T,X,E.next.next.p,b,Y),C&&Math.min(w(C,T),w(C,X))<=b&&(A.push(E),A.push(M(C,E)),S.remove(C),Y.remove(E),Y.insert(h(E)),Y.insert(h(E.next)))}}E=B;var N=[];do N.push(E.p),E=E.next;while(E!==B);return N.push(E.p),N}function r(d,v,g,k,S,A,O){for(var B=new t([],s),C=d.data;C;){for(var Y=0;Y<C.children.length;Y++){var y=C.children[Y],P=C.leaf?I(y,g,k):a(g,k,y);P>A||B.push({node:y,dist:P})}for(;B.length&&!B.peek().node.children;){var E=B.pop(),T=E.node,X=I(T,v,g),F=I(T,k,S);if(E.dist<X&&E.dist<F&&l(g,T,O)&&l(k,T,O))return T}C=B.pop(),C&&(C=C.node)}return null}function s(d,v){return d.dist-v.dist}function a(d,v,g){if(f(d,g)||f(v,g))return 0;var k=x(d[0],d[1],v[0],v[1],g.minX,g.minY,g.maxX,g.minY);if(k===0)return 0;var S=x(d[0],d[1],v[0],v[1],g.minX,g.minY,g.minX,g.maxY);if(S===0)return 0;var A=x(d[0],d[1],v[0],v[1],g.maxX,g.minY,g.maxX,g.maxY);if(A===0)return 0;var O=x(d[0],d[1],v[0],v[1],g.minX,g.maxY,g.maxX,g.maxY);return O===0?0:Math.min(k,S,A,O)}function f(d,v){return d[0]>=v.minX&&d[0]<=v.maxX&&d[1]>=v.minY&&d[1]<=v.maxY}function l(d,v,g){for(var k=Math.min(d[0],v[0]),S=Math.min(d[1],v[1]),A=Math.max(d[0],v[0]),O=Math.max(d[1],v[1]),B=g.search({minX:k,minY:S,maxX:A,maxY:O}),C=0;C<B.length;C++)if(c(B[C].p,B[C].next.p,d,v))return!1;return!0}function u(d,v,g){return i(d[0],d[1],v[0],v[1],g[0],g[1])}function c(d,v,g,k){return d!==k&&v!==g&&u(d,v,g)>0!=u(d,v,k)>0&&u(g,k,d)>0!=u(g,k,v)>0}function h(d){var v=d.p,g=d.next.p;return d.minX=Math.min(v[0],g[0]),d.minY=Math.min(v[1],g[1]),d.maxX=Math.max(v[0],g[0]),d.maxY=Math.max(v[1],g[1]),d}function p(d){for(var v=d[0],g=d[0],k=d[0],S=d[0],A=0;A<d.length;A++){var O=d[A];O[0]<v[0]&&(v=O),O[0]>k[0]&&(k=O),O[1]<g[1]&&(g=O),O[1]>S[1]&&(S=O)}var B=[v,g,k,S],C=B.slice();for(A=0;A<d.length;A++)n(d[A],B)||C.push(d[A]);return _(C)}function M(d,v){var g={p:d,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return v?(g.next=v.next,g.prev=v,v.next.prev=g,v.next=g):(g.prev=g,g.next=g),g}function w(d,v){var g=d[0]-v[0],k=d[1]-v[1];return g*g+k*k}function I(d,v,g){var k=v[0],S=v[1],A=g[0]-k,O=g[1]-S;if(A!==0||O!==0){var B=((d[0]-k)*A+(d[1]-S)*O)/(A*A+O*O);B>1?(k=g[0],S=g[1]):B>0&&(k+=A*B,S+=O*B)}return A=d[0]-k,O=d[1]-S,A*A+O*O}function x(d,v,g,k,S,A,O,B){var C=g-d,Y=k-v,y=O-S,P=B-A,E=d-S,T=v-A,X=C*C+Y*Y,F=C*y+Y*P,b=y*y+P*P,N=C*E+Y*T,D=y*E+P*T,R=X*b-F*F,L,j,q,V,J=R,G=R;R===0?(j=0,J=1,V=D,G=b):(j=F*D-b*N,V=X*D-F*N,j<0?(j=0,V=D,G=b):j>J&&(j=J,V=D+F,G=b)),V<0?(V=0,-N<0?j=0:-N>X?j=J:(j=-N,J=X)):V>G&&(V=G,-N+F<0?j=0:-N+F>X?j=J:(j=-N+F,J=X)),L=j===0?0:j/J,q=V===0?0:V/G;var Q=(1-L)*d+L*g,H=(1-L)*v+L*k,Z=(1-q)*S+q*O,W=(1-q)*A+q*B,ct=Z-Q,ht=W-H;return ct*ct+ht*ht}function m(d,v){return d[0]===v[0]?d[1]-v[1]:d[0]-v[0]}function _(d){d.sort(m);for(var v=[],g=0;g<d.length;g++){for(;v.length>=2&&u(v[v.length-2],v[v.length-1],d[g])<=0;)v.pop();v.push(d[g])}for(var k=[],S=d.length-1;S>=0;S--){for(;k.length>=2&&u(k[k.length-2],k[k.length-1],d[S])<=0;)k.pop();k.push(d[S])}return k.pop(),v.pop(),v.concat(k)}return _e.exports}var $i=Ri();const Li=Ii($i);function bn(e,t={}){t.concavity=t.concavity||1/0;const n=[];if(Pe(e,o=>{n.push([o[0],o[1]])}),!n.length)return null;const i=Li(n,t.concavity);return i.length>3?te([i],t.properties):null}function xn(e,t,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function re(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Mn(e[0])||!Mn(e[1]))throw new Error("coordinates must contain numbers");return xn({type:"Point",coordinates:e},t,n)}function _n(e,t,n={}){for(const i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return xn({type:"Polygon",coordinates:e},t,n)}function Ht(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function Mn(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function ji(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Sn(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Vi(e){return e.type==="Feature"?e.geometry:e}const Tt=11102230246251565e-32,pt=134217729,qi=(3+8*Tt)*Tt;function je(e,t,n,i,o){let r,s,a,f,l=t[0],u=i[0],c=0,h=0;u>l==u>-l?(r=l,l=t[++c]):(r=u,u=i[++h]);let p=0;if(c<e&&h<n)for(u>l==u>-l?(s=l+r,a=r-(s-l),l=t[++c]):(s=u+r,a=r-(s-u),u=i[++h]),r=s,a!==0&&(o[p++]=a);c<e&&h<n;)u>l==u>-l?(s=r+l,f=s-r,a=r-(s-f)+(l-f),l=t[++c]):(s=r+u,f=s-r,a=r-(s-f)+(u-f),u=i[++h]),r=s,a!==0&&(o[p++]=a);for(;c<e;)s=r+l,f=s-r,a=r-(s-f)+(l-f),l=t[++c],r=s,a!==0&&(o[p++]=a);for(;h<n;)s=r+u,f=s-r,a=r-(s-f)+(u-f),u=i[++h],r=s,a!==0&&(o[p++]=a);return(r!==0||p===0)&&(o[p++]=r),p}function Ui(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function oe(e){return new Float64Array(e)}const zi=(3+16*Tt)*Tt,Gi=(2+12*Tt)*Tt,Ji=(9+64*Tt)*Tt*Tt,Wt=oe(4),kn=oe(8),En=oe(12),An=oe(16),vt=oe(4);function Ki(e,t,n,i,o,r,s){let a,f,l,u,c,h,p,M,w,I,x,m,_,d,v,g,k,S;const A=e-o,O=n-o,B=t-r,C=i-r;d=A*C,h=pt*A,p=h-(h-A),M=A-p,h=pt*C,w=h-(h-C),I=C-w,v=M*I-(d-p*w-M*w-p*I),g=B*O,h=pt*B,p=h-(h-B),M=B-p,h=pt*O,w=h-(h-O),I=O-w,k=M*I-(g-p*w-M*w-p*I),x=v-k,c=v-x,Wt[0]=v-(x+c)+(c-k),m=d+x,c=m-d,_=d-(m-c)+(x-c),x=_-g,c=_-x,Wt[1]=_-(x+c)+(c-g),S=m+x,c=S-m,Wt[2]=m-(S-c)+(x-c),Wt[3]=S;let Y=Ui(4,Wt),y=Gi*s;if(Y>=y||-Y>=y||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An);return An[T-1]}function Qi(e,t,n,i,o,r){const s=(t-r)*(n-o),a=(e-o)*(i-r),f=s-a,l=Math.abs(s+a);return Math.abs(f)>=zi*l?f:-Ki(e,t,n,i,o,r,l)}function Hi(e,t){var n,i,o=0,r,s,a,f,l,u,c,h=e[0],p=e[1],M=t.length;for(n=0;n<M;n++){i=0;var w=t[n],I=w.length-1;if(u=w[0],u[0]!==w[I][0]&&u[1]!==w[I][1])throw new Error("First and last coordinates in a ring must be the same");for(s=u[0]-h,a=u[1]-p,i;i<I;i++){if(c=w[i+1],f=c[0]-h,l=c[1]-p,a===0&&l===0){if(f<=0&&s>=0||s<=0&&f>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(r=Qi(s,f,a,l,0,0),r===0)return 0;(r>0&&l>0&&a<=0||r<0&&l<=0&&a>0)&&o++}u=c,a=l,s=f}}return o%2!==0}function Ve(e,t,n={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const i=ji(e),o=Vi(t),r=o.type,s=t.bbox;let a=o.coordinates;if(s&&Wi(i,s)===!1)return!1;r==="Polygon"&&(a=[a]);for(var f=0;f<a.length;++f){const l=Hi(i,a[f]);if(l===0&&!n.ignoreBoundary||l)return!0}return!1}function Wi(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}function qe(e,t){for(let n=0;n<t.features.length;n++)if(Ve(e,t.features[n]))return t.features[n]}function In(e,t){const n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],r=e.geometry.coordinates,s=t.properties.a.geom,a=t.properties.b.geom,f=t.properties.c.geom,l=[i[0]-n[0],i[1]-n[1]],u=[o[0]-n[0],o[1]-n[1]],c=[r[0]-n[0],r[1]-n[1]],h=[a[0]-s[0],a[1]-s[1]],p=[f[0]-s[0],f[1]-s[1]],M=(u[1]*c[0]-u[0]*c[1])/(l[0]*u[1]-l[1]*u[0]),w=(l[0]*c[1]-l[1]*c[0])/(l[0]*u[1]-l[1]*u[0]);return[M*h[0]+w*p[0]+s[0],M*h[1]+w*p[1]+s[1]]}function Zi(e,t,n){const i=e.geometry.coordinates,o=n.geometry.coordinates,r=Math.atan2(i[0]-o[0],i[1]-o[1]),s=tr(r,t[0]);if(s===void 0)throw new Error("Unable to determine vertex index");const a=t[1][s];return In(e,a.features[0])}function se(e,t,n,i,o,r,s,a){let f;if(s&&(f=qe(e,Ht([s]))),!f)if(n){const l=e.geometry.coordinates,u=n.gridNum,c=n.xOrigin,h=n.yOrigin,p=n.xUnit,M=n.yUnit,w=n.gridCache,I=Ot(l[0],c,p,u),x=Ot(l[1],h,M,u),m=w[I]?w[I][x]?w[I][x]:[]:[],_=Ht(m.map(d=>t.features[d]));f=qe(e,_)}else f=qe(e,t);return a&&a(f),f?In(e,f):Zi(e,i,o)}function Ot(e,t,n,i){let o=Math.floor((e-t)/n);return o<0&&(o=0),o>=i&&(o=i-1),o}function tr(e,t){let n=Pn(e-t[0]),i=Math.PI*2,o;for(let r=0;r<t.length;r++){const s=(r+1)%t.length,a=Pn(e-t[s]),f=Math.min(Math.abs(n),Math.abs(a));n*a<=0&&f<i&&(i=f,o=r),n=a}return o}function Pn(e,t=!1){const n=2*Math.PI,i=e-Math.floor(e/n)*n;return t?i:i>Math.PI?i-n:i}function On(e){const t=e.features;for(let n=0;n<t.length;n++){const i=t[n];`${i.properties.a.index}`.substring(0,1)==="b"&&`${i.properties.b.index}`.substring(0,1)==="b"?t[n]={geometry:{type:"Polygon",coordinates:[[i.geometry.coordinates[0][2],i.geometry.coordinates[0][0],i.geometry.coordinates[0][1],i.geometry.coordinates[0][2]]]},properties:{a:{geom:i.properties.c.geom,index:i.properties.c.index},b:{geom:i.properties.a.geom,index:i.properties.a.index},c:{geom:i.properties.b.geom,index:i.properties.b.index}},type:"Feature"}:`${i.properties.c.index}`.substring(0,1)==="b"&&`${i.properties.a.index}`.substring(0,1)==="b"&&(t[n]={geometry:{type:"Polygon",coordinates:[[i.geometry.coordinates[0][1],i.geometry.coordinates[0][2],i.geometry.coordinates[0][0],i.geometry.coordinates[0][1]]]},properties:{a:{geom:i.properties.b.geom,index:i.properties.b.index},b:{geom:i.properties.c.geom,index:i.properties.c.index},c:{geom:i.properties.a.geom,index:i.properties.a.index}},type:"Feature"})}return e}function Bn(e){const t=["a","b","c","a"].map(r=>e.properties[r].geom),n=e.geometry.coordinates[0],i=e.properties,o={a:{geom:n[0],index:i.a.index},b:{geom:n[1],index:i.b.index},c:{geom:n[2],index:i.c.index}};return _n([t],o)}function er(e){const t=[0,1,2,0].map(i=>e[i][0][0]),n={a:{geom:e[0][0][1],index:e[0][1]},b:{geom:e[1][0][1],index:e[1][1]},c:{geom:e[2][0][1],index:e[2][1]}};return _n([t],n)}function Ue(e,t,n,i,o,r=!1,s){const a=e.map(f=>{(!s||s<2.00703)&&(f=nr(f));const l=isFinite(f)?t[f]:f==="c"?i:(function(){const u=f.match(/^b(\d+)$/);if(u)return o[parseInt(u[1])];const c=f.match(/^e(\d+)$/);if(c)return n[parseInt(c[1])];throw new Error("Bad index value for indexesToTri")})();return r?[[l[1],l[0]],f]:[[l[0],l[1]],f]});return er(a)}function nr(e){return typeof e=="number"?e:e.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/,"$1$2")}function Nn(e,t){return t&&t>=2.00703||Array.isArray(e[0])?e:e.map(n=>[n.illstNodes,n.mercNodes,n.startEnd])}const ir=2.00704;function rr(e){return!!(e.version!==void 0||!e.tins&&e.points&&e.tins_points)}function or(e){return{points:e.points,strictStatus:ar(e),verticesParams:cr(e),centroid:lr(e),edges:Nn(e.edges||[]),edgeNodes:e.edgeNodes||[],tins:fr(e),kinks:hr(e.kinks_points),yaxisMode:e.yaxisMode??"invert",strictMode:e.strictMode??"auto",vertexMode:e.vertexMode,bounds:e.bounds,boundsPolygon:e.boundsPolygon,wh:e.wh,xy:e.xy??[0,0]}}function sr(e){const t=ur(e),n=t.tins;return{compiled:t,tins:n,points:dr(n),strictStatus:t.strict_status,verticesParams:t.vertices_params,centroid:t.centroid,kinks:t.kinks}}function ar(e){return e.strict_status?e.strict_status:e.kinks_points?"strict_error":e.tins_points.length===2?"loose":"strict"}function cr(e){const t={forw:[e.vertices_params[0]],bakw:[e.vertices_params[1]]};return t.forw[1]=Tn(e,!1),t.bakw[1]=Tn(e,!0),t}function Tn(e,t){const n=e.vertices_points.length;return Array.from({length:n},(i,o)=>{const r=(o+1)%n,s=Ue(["c",`b${o}`,`b${r}`],e.points,e.edgeNodes||[],e.centroid_point,e.vertices_points,t,ir);return Ht([s])})}function lr(e){return{forw:re(e.centroid_point[0],{target:{geom:e.centroid_point[1],index:"c"}}),bakw:re(e.centroid_point[1],{target:{geom:e.centroid_point[0],index:"c"}})}}function fr(e){const t=e.tins_points.length===1?0:1;return{forw:Ht(e.tins_points[0].map(n=>Ue(n,e.points,e.edgeNodes||[],e.centroid_point,e.vertices_points,!1,e.version))),bakw:Ht(e.tins_points[t].map(n=>Ue(n,e.points,e.edgeNodes||[],e.centroid_point,e.vertices_points,!0,e.version)))}}function hr(e){if(e)return{bakw:Ht(e.map(t=>re(t)))}}function ur(e){return JSON.parse(JSON.stringify(e).replace('"cent"','"c"').replace(/"bbox(\d+)"/g,'"b$1"'))}function dr(e){const t=[],n=e.forw.features;for(let i=0;i<n.length;i++){const o=n[i];["a","b","c"].forEach((r,s)=>{const a=o.geometry.coordinates[0][s],f=o.properties[r].geom,l=o.properties[r].index;typeof l=="number"&&(t[l]=[a,f])})}return t}class kt{static VERTEX_PLAIN="plain";static VERTEX_BIRDEYE="birdeye";static MODE_STRICT="strict";static MODE_AUTO="auto";static MODE_LOOSE="loose";static STATUS_STRICT="strict";static STATUS_ERROR="strict_error";static STATUS_LOOSE="loose";static YAXIS_FOLLOW="follow";static YAXIS_INVERT="invert";points=[];pointsWeightBuffer;strict_status;vertices_params;centroid;edgeNodes;edges;tins;kinks;yaxisMode=kt.YAXIS_INVERT;strictMode=kt.MODE_AUTO;vertexMode=kt.VERTEX_PLAIN;bounds;boundsPolygon;wh;xy;indexedTins;stateFull=!1;stateTriangle;stateBackward;priority;importance;xyBounds;mercBounds;constructor(){}setCompiled(t){if(rr(t)){this.applyModernState(or(t));return}this.applyLegacyState(sr(t))}applyModernState(t){this.points=t.points,this.strict_status=t.strictStatus,this.vertices_params=t.verticesParams,this.centroid=t.centroid,this.edges=t.edges,this.edgeNodes=t.edgeNodes||[],this.tins=t.tins,this.addIndexedTin(),this.kinks=t.kinks,this.yaxisMode=t.yaxisMode??kt.YAXIS_INVERT,this.vertexMode=t.vertexMode??kt.VERTEX_PLAIN,this.strictMode=t.strictMode??kt.MODE_AUTO,t.bounds?(this.bounds=t.bounds,this.boundsPolygon=t.boundsPolygon,this.xy=t.xy,this.wh=t.wh):(this.bounds=void 0,this.boundsPolygon=void 0,this.xy=t.xy??[0,0],t.wh&&(this.wh=t.wh))}applyLegacyState(t){this.tins=t.tins,this.addIndexedTin(),this.strict_status=t.strictStatus,this.vertices_params=t.verticesParams,this.centroid=t.centroid,this.kinks=t.kinks,this.points=t.points}addIndexedTin(){const t=this.tins,n=t.forw,i=t.bakw,o=Math.ceil(Math.sqrt(n.features.length));if(o<3){this.indexedTins=void 0;return}let r=[],s=[];const a=n.features.map(w=>{let I=[];return Sn(w)[0].map(x=>{r.length===0?r=[Array.from(x),Array.from(x)]:(x[0]<r[0][0]&&(r[0][0]=x[0]),x[0]>r[1][0]&&(r[1][0]=x[0]),x[1]<r[0][1]&&(r[0][1]=x[1]),x[1]>r[1][1]&&(r[1][1]=x[1])),I.length===0?I=[Array.from(x),Array.from(x)]:(x[0]<I[0][0]&&(I[0][0]=x[0]),x[0]>I[1][0]&&(I[1][0]=x[0]),x[1]<I[0][1]&&(I[0][1]=x[1]),x[1]>I[1][1]&&(I[1][1]=x[1]))}),I}),f=(r[1][0]-r[0][0])/o,l=(r[1][1]-r[0][1])/o,u=a.reduce((w,I,x)=>{const m=Ot(I[0][0],r[0][0],f,o),_=Ot(I[1][0],r[0][0],f,o),d=Ot(I[0][1],r[0][1],l,o),v=Ot(I[1][1],r[0][1],l,o);for(let g=m;g<=_;g++){w[g]||(w[g]=[]);for(let k=d;k<=v;k++)w[g][k]||(w[g][k]=[]),w[g][k].push(x)}return w},[]),c=i.features.map(w=>{let I=[];return Sn(w)[0].map(x=>{s.length===0?s=[Array.from(x),Array.from(x)]:(x[0]<s[0][0]&&(s[0][0]=x[0]),x[0]>s[1][0]&&(s[1][0]=x[0]),x[1]<s[0][1]&&(s[0][1]=x[1]),x[1]>s[1][1]&&(s[1][1]=x[1])),I.length===0?I=[Array.from(x),Array.from(x)]:(x[0]<I[0][0]&&(I[0][0]=x[0]),x[0]>I[1][0]&&(I[1][0]=x[0]),x[1]<I[0][1]&&(I[0][1]=x[1]),x[1]>I[1][1]&&(I[1][1]=x[1]))}),I}),h=(s[1][0]-s[0][0])/o,p=(s[1][1]-s[0][1])/o,M=c.reduce((w,I,x)=>{const m=Ot(I[0][0],s[0][0],h,o),_=Ot(I[1][0],s[0][0],h,o),d=Ot(I[0][1],s[0][1],p,o),v=Ot(I[1][1],s[0][1],p,o);for(let g=m;g<=_;g++){w[g]||(w[g]=[]);for(let k=d;k<=v;k++)w[g][k]||(w[g][k]=[]),w[g][k].push(x)}return w},[]);this.indexedTins={forw:{gridNum:o,xOrigin:r[0][0],yOrigin:r[0][1],xUnit:f,yUnit:l,gridCache:u},bakw:{gridNum:o,xOrigin:s[0][0],yOrigin:s[0][1],xUnit:h,yUnit:p,gridCache:M}}}transform(t,n,i){if(!this.tins)throw new Error("setCompiled() must be called before transform()");if(n&&this.strict_status==kt.STATUS_ERROR)throw new Error('Backward transform is not allowed if strict_status == "strict_error"');this.yaxisMode==kt.YAXIS_FOLLOW&&n&&(t=[t[0],-1*t[1]]);const o=re(t);if(this.bounds&&!n&&!i&&!Ve(o,this.boundsPolygon))return!1;const r=n?this.tins.bakw:this.tins.forw,s=n?this.indexedTins.bakw:this.indexedTins.forw,a=n?this.vertices_params.bakw:this.vertices_params.forw,f=n?this.centroid.bakw:this.centroid.forw;let l,u;this.stateFull&&(this.stateBackward==n?l=this.stateTriangle:(this.stateBackward=n,this.stateTriangle=void 0),u=h=>{this.stateTriangle=h});let c=se(o,r,s,a,f,void 0,l,u);if(this.bounds&&n&&!i){const h=re(c);if(!Ve(h,this.boundsPolygon))return!1}else this.yaxisMode==kt.YAXIS_FOLLOW&&!n&&(c=[c[0],-1*c[1]]);return c}}const Cn=Math.pow(2,-52),Se=new Uint32Array(512);class ze{static from(t,n=yr,i=vr){const o=t.length,r=new Float64Array(o*2);for(let s=0;s<o;s++){const a=t[s];r[2*s]=n(a),r[2*s+1]=i(a)}return new ze(r)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*n-5,0);this._triangles=new Uint32Array(i*3),this._halfedges=new Int32Array(i*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:i,_hullTri:o,_hullHash:r}=this,s=t.length>>1;let a=1/0,f=1/0,l=-1/0,u=-1/0;for(let A=0;A<s;A++){const O=t[2*A],B=t[2*A+1];O<a&&(a=O),B<f&&(f=B),O>l&&(l=O),B>u&&(u=B),this._ids[A]=A}const c=(a+l)/2,h=(f+u)/2;let p=0,M=0,w=0;for(let A=0,O=1/0;A<s;A++){const B=Ge(c,h,t[2*A],t[2*A+1]);B<O&&(p=A,O=B)}const I=t[2*p],x=t[2*p+1];for(let A=0,O=1/0;A<s;A++){if(A===p)continue;const B=Ge(I,x,t[2*A],t[2*A+1]);B<O&&B>0&&(M=A,O=B)}let m=t[2*M],_=t[2*M+1],d=1/0;for(let A=0;A<s;A++){if(A===p||A===M)continue;const O=gr(I,x,m,_,t[2*A],t[2*A+1]);O<d&&(w=A,d=O)}let v=t[2*w],g=t[2*w+1];if(d===1/0){for(let B=0;B<s;B++)this._dists[B]=t[2*B]-t[0]||t[2*B+1]-t[1];Zt(this._ids,this._dists,0,s-1);const A=new Uint32Array(s);let O=0;for(let B=0,C=-1/0;B<s;B++){const Y=this._ids[B],y=this._dists[Y];y>C&&(A[O++]=Y,C=y)}this.hull=A.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Et(I,x,m,_,v,g)<0){const A=M,O=m,B=_;M=w,m=v,_=g,w=A,v=O,g=B}const k=wr(I,x,m,_,v,g);this._cx=k.x,this._cy=k.y;for(let A=0;A<s;A++)this._dists[A]=Ge(t[2*A],t[2*A+1],k.x,k.y);Zt(this._ids,this._dists,0,s-1),this._hullStart=p;let S=3;i[p]=n[w]=M,i[M]=n[p]=w,i[w]=n[M]=p,o[p]=0,o[M]=1,o[w]=2,r.fill(-1),r[this._hashKey(I,x)]=p,r[this._hashKey(m,_)]=M,r[this._hashKey(v,g)]=w,this.trianglesLen=0,this._addTriangle(p,M,w,-1,-1,-1);for(let A=0,O=0,B=0;A<this._ids.length;A++){const C=this._ids[A],Y=t[2*C],y=t[2*C+1];if(A>0&&Math.abs(Y-O)<=Cn&&Math.abs(y-B)<=Cn||(O=Y,B=y,C===p||C===M||C===w))continue;let P=0;for(let b=0,N=this._hashKey(Y,y);b<this._hashSize&&(P=r[(N+b)%this._hashSize],!(P!==-1&&P!==i[P]));b++);P=n[P];let E=P,T;for(;T=i[E],Et(Y,y,t[2*E],t[2*E+1],t[2*T],t[2*T+1])>=0;)if(E=T,E===P){E=-1;break}if(E===-1)continue;let X=this._addTriangle(E,C,i[E],-1,-1,o[E]);o[C]=this._legalize(X+2),o[E]=X,S++;let F=i[E];for(;T=i[F],Et(Y,y,t[2*F],t[2*F+1],t[2*T],t[2*T+1])<0;)X=this._addTriangle(F,C,T,o[C],-1,o[F]),o[C]=this._legalize(X+2),i[F]=F,S--,F=T;if(E===P)for(;T=n[E],Et(Y,y,t[2*T],t[2*T+1],t[2*E],t[2*E+1])<0;)X=this._addTriangle(T,C,E,-1,o[E],o[T]),this._legalize(X+2),o[T]=X,i[E]=E,S--,E=T;this._hullStart=n[C]=E,i[E]=n[F]=C,i[C]=F,r[this._hashKey(Y,y)]=C,r[this._hashKey(t[2*E],t[2*E+1])]=E}this.hull=new Uint32Array(S);for(let A=0,O=this._hullStart;A<S;A++)this.hull[A]=O,O=i[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(pr(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:i,coords:o}=this;let r=0,s=0;for(;;){const a=i[t],f=t-t%3;if(s=f+(t+2)%3,a===-1){if(r===0)break;t=Se[--r];continue}const l=a-a%3,u=f+(t+1)%3,c=l+(a+2)%3,h=n[s],p=n[t],M=n[u],w=n[c];if(mr(o[2*h],o[2*h+1],o[2*p],o[2*p+1],o[2*M],o[2*M+1],o[2*w],o[2*w+1])){n[t]=w,n[a]=h;const x=i[c];if(x===-1){let _=this._hullStart;do{if(this._hullTri[_]===c){this._hullTri[_]=t;break}_=this._hullPrev[_]}while(_!==this._hullStart)}this._link(t,x),this._link(a,i[s]),this._link(s,c);const m=l+(a+1)%3;r<Se.length&&(Se[r++]=m)}else{if(r===0)break;t=Se[--r]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,i,o,r,s){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=i,this._link(a,o),this._link(a+1,r),this._link(a+2,s),this.trianglesLen+=3,a}}function pr(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function Ge(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function mr(e,t,n,i,o,r,s,a){const f=e-s,l=t-a,u=n-s,c=i-a,h=o-s,p=r-a,M=f*f+l*l,w=u*u+c*c,I=h*h+p*p;return f*(c*I-w*p)-l*(u*I-w*h)+M*(u*p-c*h)<0}function gr(e,t,n,i,o,r){const s=n-e,a=i-t,f=o-e,l=r-t,u=s*s+a*a,c=f*f+l*l,h=.5/(s*l-a*f),p=(l*u-a*c)*h,M=(s*c-f*u)*h;return p*p+M*M}function wr(e,t,n,i,o,r){const s=n-e,a=i-t,f=o-e,l=r-t,u=s*s+a*a,c=f*f+l*l,h=.5/(s*l-a*f),p=e+(l*u-a*c)*h,M=t+(s*c-f*u)*h;return{x:p,y:M}}function Zt(e,t,n,i){if(i-n<=20)for(let o=n+1;o<=i;o++){const r=e[o],s=t[r];let a=o-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=r}else{const o=n+i>>1;let r=n+1,s=i;ae(e,o,r),t[e[n]]>t[e[i]]&&ae(e,n,i),t[e[r]]>t[e[i]]&&ae(e,r,i),t[e[n]]>t[e[r]]&&ae(e,n,r);const a=e[r],f=t[a];for(;;){do r++;while(t[e[r]]<f);do s--;while(t[e[s]]>f);if(s<r)break;ae(e,r,s)}e[n+1]=e[s],e[s]=a,i-r+1>=s-n?(Zt(e,t,r,i),Zt(e,t,n,s-1)):(Zt(e,t,n,s-1),Zt(e,t,r,i))}}function ae(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function yr(e){return e[0]}function vr(e){return e[1]}class br{bs;width;constructor(t,n){this.width=t,this.bs=n}add(t){const n=Math.floor(t/this.width),i=t%this.width;return this.bs[n]|=1<<i,this}delete(t){const n=Math.floor(t/this.width),i=t%this.width;return this.bs[n]&=~(1<<i),this}set(t,n){const i=Math.floor(t/this.width),r=1<<t%this.width;return this.bs[i]^=(-Number(n)^this.bs[i])&r,n}has(t){const n=Math.floor(t/this.width),i=t%this.width;return(this.bs[n]&1<<i)!==0}forEach(t){const n=this.bs.length;for(let i=0;i<n;i++){let o=0;for(;this.bs[i]&&o<this.width;)this.bs[i]&1<<o&&t(i*this.width+o),o++}return this}}class Xn extends br{constructor(t){super(8,new Uint8Array(Math.ceil(t/8)).fill(0))}}function zt(e){return e%3===2?e-2:e+1}function Ct(e){return e%3===0?e+2:e-1}function Dn(e,t,n,i,o,r,s,a){const f=Et(e,t,o,r,s,a),l=Et(n,i,o,r,s,a);if(f>0&&l>0||f<0&&l<0)return!1;const u=Et(o,r,e,t,n,i),c=Et(s,a,e,t,n,i);return u>0&&c>0||u<0&&c<0?!1:f===0&&l===0&&u===0&&c===0?!(Math.max(o,s)<Math.min(e,n)||Math.max(e,n)<Math.min(o,s)||Math.max(r,a)<Math.min(t,i)||Math.max(t,i)<Math.min(r,a)):!0}class xr{del;constructor(t){this.del=t}}class _r extends xr{vertMap;flips;consd;constructor(t,n){if(!t||typeof t!="object"||!t.triangles||!t.halfedges||!t.coords)throw new Error("Expected an object with Delaunator output");if(t.triangles.length%3||t.halfedges.length!==t.triangles.length||t.coords.length%2)throw new Error("Delaunator output appears inconsistent");if(t.triangles.length<3)throw new Error("No edges in triangulation");super(t);const i=2**32-1,o=t.coords.length>>1,r=t.triangles.length;this.vertMap=new Uint32Array(o).fill(i),this.flips=new Xn(r),this.consd=new Xn(r);for(let s=0;s<r;s++){const a=t.triangles[s];this.vertMap[a]===i&&this.updateVert(s)}n&&this.constrainAll(n)}constrainOne(t,n){const{triangles:i,halfedges:o}=this.del,r=this.vertMap[t];let s=r;do{const l=i[s],u=zt(s);if(l===n)return this.protect(s);const c=Ct(s),h=i[c];if(h===n)return this.protect(u),u;if(this.intersectSegments(t,n,h,l)){s=c;break}s=o[u]}while(s!==-1&&s!==r);let a=s,f=-1;for(;s!==-1;){const l=o[s],u=Ct(s),c=Ct(l),h=zt(l);if(l===-1)throw new Error("Constraining edge exited the hull");if(this.consd.has(s))throw new Error("Edge intersects already constrained edge");if(this.isCollinear(t,n,i[s])||this.isCollinear(t,n,i[l]))throw new Error("Constraining edge intersects point");if(!this.intersectSegments(i[s],i[l],i[u],i[c])){if(f===-1&&(f=s),i[c]===n){if(s===f)throw new Error("Infinite loop: non-convex quadrilateral");s=f,f=-1;continue}if(this.intersectSegments(t,n,i[c],i[l]))s=c;else if(this.intersectSegments(t,n,i[h],i[c]))s=h;else if(f===s)throw new Error("Infinite loop: no further intersect after non-convex");continue}if(this.flipDiagonal(s),this.intersectSegments(t,n,i[u],i[c])&&(f===-1&&(f=u),f===u))throw new Error("Infinite loop: flipped diagonal still intersects");i[c]===n?(a=c,s=f,f=-1):this.intersectSegments(t,n,i[h],i[c])&&(s=h)}return this.protect(a),this.delaunify(!0),this.findEdge(t,n)}delaunify(t=!1){const{halfedges:n}=this.del,i=this.flips,o=this.consd,r=n.length;let s;do{s=0;for(let a=0;a<r;a++){if(o.has(a))continue;i.delete(a);const f=n[a];f!==-1&&(i.delete(f),this.isDelaunay(a)||(this.flipDiagonal(a),s++))}}while(t&&s>0);return this}constrainAll(t){const n=t.length;for(let i=0;i<n;i++){const o=t[i];this.constrainOne(o[0],o[1])}return this}isConstrained(t){return this.consd.has(t)}findEdge(t,n){const i=this.vertMap[n],{triangles:o,halfedges:r}=this.del;let s=i,a;do{if(o[s]===t)return s;a=zt(s),s=r[a]}while(s!==-1&&s!==i);return o[zt(a)]===t?-a:1/0}protect(t){const n=this.del.halfedges[t],i=this.flips,o=this.consd;return i.delete(t),o.add(t),n!==-1?(i.delete(n),o.add(n),n):-t}markFlip(t){const n=this.del.halfedges,i=this.flips;if(this.consd.has(t))return!1;const r=n[t];return r!==-1&&(i.add(t),i.add(r)),!0}flipDiagonal(t){const{triangles:n,halfedges:i}=this.del,o=this.flips,r=this.consd,s=i[t],a=Ct(t),f=zt(t),l=Ct(s),u=zt(s),c=i[a],h=i[l];if(r.has(t))throw new Error("Trying to flip a constrained edge");return n[t]=n[l],i[t]=h,o.set(t,o.has(l))||r.set(t,r.has(l)),h!==-1&&(i[h]=t),i[a]=l,n[s]=n[a],i[s]=c,o.set(s,o.has(a))||r.set(s,r.has(a)),c!==-1&&(i[c]=s),i[l]=a,this.markFlip(t),this.markFlip(f),this.markFlip(s),this.markFlip(u),o.add(a),r.delete(a),o.add(l),r.delete(l),this.updateVert(t),this.updateVert(f),this.updateVert(s),this.updateVert(u),a}isCollinear(t,n,i){const o=this.del.coords;return Et(o[t*2],o[t*2+1],o[n*2],o[n*2+1],o[i*2],o[i*2+1])===0}inCircle(t,n,i,o){const r=this.del.coords;return fi(r[t*2],r[t*2+1],r[n*2],r[n*2+1],r[i*2],r[i*2+1],r[o*2],r[o*2+1])<0}isDelaunay(t){const{triangles:n,halfedges:i}=this.del,o=i[t];if(o===-1)return!0;const r=n[Ct(t)],s=n[t],a=n[zt(t)],f=n[Ct(o)];return!this.inCircle(r,s,a,f)}updateVert(t){const{triangles:n,halfedges:i}=this.del,o=this.vertMap,r=n[t];let s=Ct(t),a=i[s];for(;a!==-1&&a!==t;)s=Ct(a),a=i[s];return o[r]=s,s}intersectSegments(t,n,i,o){const r=this.del.coords;return t===i||t===o||n===i||n===o?!1:Dn(r[t*2],r[t*2+1],r[n*2],r[n*2+1],r[i*2],r[i*2+1],r[o*2],r[o*2+1])}static intersectSegments=Dn}function ce(e,t,n){if(t||(t=[]),typeof e!="object"||e.type!=="FeatureCollection")throw"Argument points must be FeatureCollection";if(!Array.isArray(t))throw"Argument points must be Array of Array";const i=e.features.map(f=>f.geometry.coordinates),o=ze.from(i);let r;const s=[];o.triangles.length!==0&&t.length!==0&&(r=new _r(o),r.constrainAll(t));for(let f=0;f<o.triangles.length;f+=3)s.push([o.triangles[f],o.triangles[f+1],o.triangles[f+2]]);const a=["a","b","c"];return St(s.map(f=>{const l={},u=f.map((c,h)=>{const p=e.features[c],M=p.geometry.coordinates,w=[M[0],M[1]];return M.length===3?w[2]=M[2]:l[a[h]]=p.properties[n],w});return u[3]=u[0],te([u],l)}))}function Mr(e,t){const n=[[],[],[],[]],i=[];return Object.keys(e).forEach(o=>{const r=e[o],s=r.forw,a=r.bakw,f=[s[0]-t.forw[0],s[1]-t.forw[1]],l=[a[0]-t.bakw[0],t.bakw[1]-a[1]],u={forw:f,bakw:l};if(i.push(u),f[0]===0||f[1]===0)return;let c=0;f[0]>0&&(c+=1),f[1]>0&&(c+=2),n[c].push(u)}),{perQuad:n,aggregate:i}}function Sr(e){let t=1/0,n=0,i=0;return e.forEach(o=>{const{forw:r,bakw:s}=o,a=Math.hypot(r[0],r[1]),f=Math.hypot(s[0],s[1]);if(f===0)return;const l=a/f,u=Math.atan2(r[0],r[1])-Math.atan2(s[0],s[1]);t=Math.min(t,l),n+=Math.cos(u),i+=Math.sin(u)}),isFinite(t)?[t,Math.atan2(i,n)]:[1,0]}function kr(e,t,n){const{perQuad:i,aggregate:o}=Mr(e,t),r=i.every(f=>f.length>0),a=(n==="birdeye"?r?i:[o]:[o]).map(f=>Sr(f));return a.length===1?[a[0],a[0],a[0],a[0]]:a}function Er(e,t){let n=0;return e[0]>t[0]&&(n+=1),e[1]>t[1]&&(n+=2),n}function Ar(e,t,n){const i=[e[0]-t.forw[0],e[1]-t.forw[1]],r=Math.sqrt(i[0]**2+i[1]**2)/n[0],s=Math.atan2(i[0],i[1])-n[1];return[t.bakw[0]+r*Math.sin(s),t.bakw[1]-r*Math.cos(s)]}function Ir(e,t,n,i){const o=t[0]-e[0],r=t[1]-e[1];if(Math.abs(o)<1e-12&&Math.abs(r)<1e-12)return null;const s=i[0]-n[0],a=i[1]-n[1],f=n[0]-e[0],l=n[1]-e[1],u=o*a-r*s;if(Math.abs(u)<1e-12)return null;const c=(f*a-l*s)/u,h=(f*r-l*o)/u;return c<=1e-10||h<-1e-10||h>1+1e-10?null:{t:c,point:[e[0]+c*o,e[1]+c*r]}}function Pr(e,t,n){const i=n.length;let o=-1/0,r=null;for(let s=0;s<i;s++){const a=(s+1)%i,f=Ir(e,t,n[s].bakw,n[a].bakw);f&&f.t>o&&(o=f.t,r=f.point)}return r}function Fn(e,t){const i=Math.atan2(e[0]-t[0],e[1]-t[1])*(180/Math.PI);return i<0?i+360:i}function Yn(e,t,n,i,o,r){const s=t[0]-e[0],a=t[1]-e[1];if(s===0&&a===0)return null;const f=[];if(s!==0)for(const u of[n,i]){const c=(u-e[0])/s;if(c>0){const h=e[1]+c*a;h>=o&&h<=r&&f.push({t:c,x:u,y:h})}}if(a!==0)for(const u of[o,r]){const c=(u-e[1])/a;if(c>0){const h=e[0]+c*s;h>=n&&h<=i&&f.push({t:c,x:h,y:u})}}if(f.length===0)return null;f.sort((u,c)=>u.t-c.t);const l=f[0];return[l.x,l.y]}function Rn(e,t,n){const i=e.length,o=new Array(i).fill(1);for(const r of t)for(let s=0;s<i;s++){const a=(s+1)%i,f=Ze([e[s].bakw,e[a].bakw]),l=Ze([n.bakw,r.bakw]),u=Ai(f,l);if(u.features.length>0&&u.features[0].geometry){const c=u.features[0],h=Math.sqrt(Math.pow(r.bakw[0]-n.bakw[0],2)+Math.pow(r.bakw[1]-n.bakw[1],2)),p=Math.sqrt(Math.pow(c.geometry.coordinates[0]-n.bakw[0],2)+Math.pow(c.geometry.coordinates[1]-n.bakw[1],2)),M=h/p;M>o[s]&&(o[s]=M),M>o[a]&&(o[a]=M)}}e.forEach((r,s)=>{const a=o[s];r.bakw=[(r.bakw[0]-n.bakw[0])*a+n.bakw[0],(r.bakw[1]-n.bakw[1])*a+n.bakw[1]]})}function $n(e,t,n){const{convexBuf:i,centroid:o,allGcps:r,minx:s,maxx:a,miny:f,maxy:l}=e,u=kr(i,o,t),h=[[s,f],[a,f],[a,l],[s,l]].map(g=>({forw:g,bakw:Ar(g,o,u[Er(g,o.forw)])}));if(h.sort((g,k)=>Math.atan2(g.forw[0]-o.forw[0],g.forw[1]-o.forw[1])-Math.atan2(k.forw[0]-o.forw[0],k.forw[1]-o.forw[1])),Rn(h,r,o),!n)return h;const p=4,M=h.map(g=>Math.atan2(g.forw[0]-o.forw[0],g.forw[1]-o.forw[1])),w=h.map(g=>Math.atan2(g.bakw[0]-o.bakw[0],-(g.bakw[1]-o.bakw[1])));function I(g){for(let k=0;k<p;k++){const S=(k+1)%p,A=M[k],O=k<p-1?M[S]:M[S]+2*Math.PI;let B=g;for(;B<A;)B+=2*Math.PI;for(;B>=A+2*Math.PI;)B-=2*Math.PI;if(B>=A&&B<O)return{i:k,j:S,frac:(B-A)/(O-A)}}return{i:0,j:1,frac:0}}function x(g){const{i:k,j:S,frac:A}=I(g),O=w[k];let C=w[S]-O;for(;C>Math.PI;)C-=2*Math.PI;for(;C<-Math.PI;)C+=2*Math.PI;return O+A*C}const m=new Set(h.map(g=>Math.floor(Fn(g.forw,o.forw)/10)%36)),_=r.map(g=>({forw:g.forw,bakw:g.bakw,angleDeg:Fn(g.forw,o.forw),forwDist:Math.hypot(g.forw[0]-o.forw[0],g.forw[1]-o.forw[1])})),d=[];for(let g=0;g<36;g++){if(m.has(g))continue;const k=g*10,S=_.filter(P=>P.angleDeg>=k&&P.angleDeg<k+10);let A=null;if(S.length>0){const P=S.reduce((E,T)=>T.forwDist>E.forwDist?T:E);A=Yn(o.forw,P.forw,s,a,f,l)}if(!A){const P=(k+5)%360*(Math.PI/180),E=[o.forw[0]+Math.sin(P),o.forw[1]+Math.cos(P)];A=Yn(o.forw,E,s,a,f,l)}if(!A)continue;const O=[A[0]-o.forw[0],A[1]-o.forw[1]],B=Math.atan2(O[0],O[1]),C=x(B),Y=[o.bakw[0]+Math.sin(C),o.bakw[1]-Math.cos(C)],y=Pr(o.bakw,Y,h);y&&d.push({forw:A,bakw:y})}const v=[...h,...d];return v.sort((g,k)=>Math.atan2(g.forw[0]-o.forw[0],g.forw[1]-o.forw[1])-Math.atan2(k.forw[0]-o.forw[0],k.forw[1]-o.forw[1])),Rn(v,r,o),v}function Or(e,t=!1){return $n(e,"plain",t)}function Br(e,t=!1){return $n(e,"birdeye",t)}function Ln(e){Nr(e);const n=new Tr(e).findSegmentIntersections(),i=Gn(n),o=new Map;return i.forEach(r=>{o.set(`${r.x}:${r.y}`,r)}),Array.from(o.values()).map(r=>Dt([r.x,r.y]))}function Nr(e){for(let t=0,n=e.length;t<n;t++){const i=e[t];le(i)||Gt("findIntersections() received invalid coordinates:",`line=${t}`,`points=${i}`);for(let o=0,r=i.length;o<r;o++){const s=i[o];(!le(s)||!Number.isFinite(s[0])||!Number.isFinite(s[1]))&&Gt("findIntersections() received non-finite coordinates:",`line=${t}`,`point=${o}`,`coordinates=${JSON.stringify(s)}`)}}}class Tr{_xx;_yy;_ii;_nn;_zz=null;_zlimit=0;_bb=null;_allBounds=null;_arcIter=null;_filteredArcIter=null;buf;constructor(t){this.initArcs(t)}initArcs(t){const n=[],i=[],o=t.map(r=>{const s=r?r.length:0;for(let a=0;a<s;a++)n.push(r[a][0]),i.push(r[a][1]);return s});this.initXYData(o,n,i)}initXYData(t,n,i){const o=t.length;this._xx=new Float64Array(n),this._yy=new Float64Array(i),this._nn=new Uint32Array(t),this._zz=null,this._zlimit=0,this._filteredArcIter=null,this._ii=new Uint32Array(o);let r=0;for(let s=0;s<o;s++)this._ii[s]=r,r+=t[s];(r!=this._xx.length||this._xx.length!=this._yy.length)&&Gt("ArcCollection#initXYData() Counting error"),this.initBounds(),this._arcIter=new Zr(this._xx,this._yy)}initBounds(){const t=this.calcArcBounds_(this._xx,this._yy,this._nn);this._bb=t.bb,this._allBounds=t.bounds}calcArcBounds_(t,n,i){const o=i.length,r=new Float64Array(o*4),s=new he;let a=0,f,l,u;for(let c=0;c<o;c++)f=i[c],f>0&&(l=c*4,u=to(t,n,a,f),r[l++]=u[0],r[l++]=u[1],r[l++]=u[2],r[l]=u[3],a+=f,s.mergeBounds(u));return{bb:r,bounds:s}}getBounds(){return this._allBounds?this._allBounds.clone():new he}forEachSegment(t){let n=0;for(let i=0,o=this.size();i<o;i++)n+=this.forEachArcSegment(i,t);return n}size(){return this._ii&&this._ii.length||0}forEachArcSegment(t,n){const i=t>=0,o=i?t:~t,r=this.getRetainedInterval(),s=this._nn[o],a=i?1:-1;let f=i?this._ii[o]:this._ii[o]+s-1,l=f,u=0;for(let c=1;c<s;c++)l+=a,(r===0||this._zz[l]>=r)&&(n(f,l,this._xx,this._yy),f=l,u++);return u}getRetainedInterval(){return this._zlimit}getVertexData(){return{xx:this._xx,yy:this._yy,zz:this._zz,bb:this._bb,nn:this._nn,ii:this._ii}}getUint32Array(t){const n=t*4;return(!this.buf||this.buf.byteLength<n)&&(this.buf=new ArrayBuffer(n)),new Uint32Array(this.buf,0,t)}getAvgSegment2(){let t=0,n=0;const i=this.forEachSegment((o,r,s,a)=>{t+=Math.abs(s[o]-s[r]),n+=Math.abs(a[o]-a[r])});return[t/i||0,n/i||0]}calcSegmentIntersectionStripeCount(){const t=this.getBounds().height(),n=this.getAvgSegment2()[1];let i=1;return n>0&&t>0&&(i=Math.ceil(t/n/20)),i||1}findSegmentIntersections(){const t=this.getBounds(),n=t.ymin||0,i=(t.ymax||0)-n,o=this.calcSegmentIntersectionStripeCount(),r=new Uint32Array(o),s=o>1?I=>Math.floor((o-1)*(I-n)/i):()=>0,a=o+1;let f,l;this.forEachSegment((I,x,m,_)=>{let d=s(_[I]);const v=s(_[x]);let g=0;for(;r[d]=r[d]+2,d!=v;)g++,g>a&&Gt("findSegmentIntersections() exceeded the stripe iteration limit:",`stripeCount=${o}`,`s1=${d}`,`s2=${v}`),d+=v>d?1:-1});const u=this.getUint32Array(Dr(r));let c=0;const h=[];Fr(r,I=>{const x=c;c+=I,h.push(u.subarray(x,c))}),Yr(r,0),this.forEachSegment((I,x,m,_)=>{let d=s(_[I]);const v=s(_[x]);let g,k,S=0;for(;g=r[d],r[d]=g+2,k=h[d],k[g]=I,k[g+1]=x,d!=v;)S++,S>a&&Gt("findSegmentIntersections() exceeded the stripe iteration limit:",`stripeCount=${o}`,`s1=${d}`,`s2=${v}`),d+=v>d?1:-1});const p=this.getVertexData(),M=[];let w;for(f=0;f<o;f++)if(p.xx&&p.yy)for(w=Rr(h[f],p.xx,p.yy),l=0;l<w.length;l++)M.push(w[l]);return Gn(M)}}function Gt(...e){const t=e.join(" ");throw new Error(t)}function le(e){return e?Xr(e)?!0:Cr(e)?!1:e.length===0?!0:e.length>0:!1}function Cr(e){return e!=null&&e.toString===String.prototype.toString}function Xr(e){return Array.isArray(e)}function Dr(e,t){le(e)||Gt("utils.sum() expects an array, received:",e);let n=0,i;for(let o=0,r=e.length;o<r;o++)i=e[o],i&&(n+=i);return n}function Fr(e,t,n){if(!le(e))throw new Error(`#forEach() takes an array-like argument. ${e}`);for(let i=0,o=e.length;i<o;i++)t.call(n,e[i],i)}function Yr(e,t){for(let n=0,i=e.length;n<i;n++)e[n]=t;return e}function Rr(e,t,n){const i=e.length-2,o=[];let r,s,a,f,l,u,c,h,p,M,w,I,x,m,_,d,v;for(Kr(t,e),d=0;d<i;){for(r=e[d],s=e[d+1],l=t[r],u=t[s],p=n[r],M=n[s],v=d;v<i&&(v+=2,a=e[v],c=t[a],!(u<c));){if(w=n[a],f=e[v+1],h=t[f],I=n[f],p>=w){if(p>I&&M>w&&M>I)continue}else if(p<I&&M<w&&M<I)continue;r==a||r==f||s==a||s==f||(x=$r(l,p,u,M,c,w,h,I),x&&(m=[r,s],_=[a,f],o.push(Un(x,m,_,t,n)),x.length==4&&o.push(Un(x.slice(2),m,_,t,n))))}d+=2}return o}function $r(e,t,n,i,o,r,s,a){const f=Lr(e,t,n,i,o,r,s,a);let l=null;return f&&(l=jr(e,t,n,i,o,r,s,a),l?Jr(e,t,n,i,o,r,s,a)&&(l=null):l=Gr(e,t,n,i,o,r,s,a)),l}function Lr(e,t,n,i,o,r,s,a){return fe(e,t,n,i,o,r)*fe(e,t,n,i,s,a)<=0&&fe(o,r,s,a,e,t)*fe(o,r,s,a,n,i)<=0}function fe(e,t,n,i,o,r){return jn(e-o,t-r,n-o,i-r)}function jn(e,t,n,i){return e*i-t*n}function jr(e,t,n,i,o,r,s,a){let f=ke(e,t,n,i,o,r,s,a),l;return f&&(l=qr(f[0],f[1],e,t,n,i,o,r,s,a),l==1?f=ke(n,i,e,t,o,r,s,a):l==2?f=ke(o,r,s,a,e,t,n,i):l==3&&(f=ke(s,a,o,r,e,t,n,i))),f&&zr(f,e,t,n,i,o,r,s,a),f}function ke(e,t,n,i,o,r,s,a){const f=jn(n-e,i-t,s-o,a-r),l=1e-18;let u;if(f===0)return null;const c=fe(o,r,s,a,e,t)/f;return f<=l&&f>=-l?u=Vr(e,t,n,i,o,r,s,a):u=[e+c*(n-e),t+c*(i-t)],u}function Vr(e,t,n,i,o,r,s,a){let f=null;return!Xt(e,o,s)&&!Xt(t,r,a)?f=[e,t]:!Xt(n,o,s)&&!Xt(i,r,a)?f=[n,i]:!Xt(o,e,n)&&!Xt(r,t,i)?f=[o,r]:!Xt(s,e,n)&&!Xt(a,t,i)&&(f=[s,a]),f}function Xt(e,t,n){let i;return t<n?i=e<t||e>n:t>n?i=e>t||e<n:i=e!=t,i}function qr(e,t,...n){let i=-1,o=1/0,r;for(let s=0,a=0,f=n.length;a<f;s++,a+=2)r=Ur(e,t,n[a],n[a+1]),r<o&&(o=r,i=s);return i}function Ur(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function zr(e,t,n,i,o,r,s,a,f){let l=e[0],u=e[1];l=Ee(l,t,i),l=Ee(l,r,a),u=Ee(u,n,o),u=Ee(u,s,f),e[0]=l,e[1]=u}function Ee(e,t,n){let i;return Xt(e,t,n)&&(i=Math.abs(e-t)<Math.abs(e-n)?t:n,e=i),e}function Gr(e,t,n,i,o,r,s,a){const f=Math.min(e,n,o,s),l=Math.max(e,n,o,s),u=Math.min(t,i,r,a),c=Math.max(t,i,r,a),h=c-u>l-f;let p=[];return(h?Lt(t,u,c):Lt(e,f,l))&&p.push(e,t),(h?Lt(i,u,c):Lt(n,f,l))&&p.push(n,i),(h?Lt(r,u,c):Lt(o,f,l))&&p.push(o,r),(h?Lt(a,u,c):Lt(s,f,l))&&p.push(s,a),(p.length!=2&&p.length!=4||p.length==4&&p[0]==p[2]&&p[1]==p[3])&&(p=null),p}function Jr(e,t,n,i,o,r,s,a){return e==o&&t==r||e==s&&t==a||n==o&&i==r||n==s&&i==a}function Lt(e,t,n){return e>t&&e<n}function Kr(e,t){Qr(e,t),Vn(e,t,0,t.length-2)}function Qr(e,t){for(let n=0,i=t.length;n<i;n+=2)e[t[n]]>e[t[n+1]]&&Hr(t,n,n+1)}function Hr(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Vn(e,t,n,i){let o=n,r=i,s,a;for(;o<i;){for(s=e[t[n+i>>2<<1]];o<=r;){for(;e[t[o]]<s;)o+=2;for(;e[t[r]]>s;)r-=2;o<=r&&(a=t[o],t[o]=t[r],t[r]=a,a=t[o+1],t[o+1]=t[r+1],t[r+1]=a,o+=2,r-=2)}if(r-n<40?qn(e,t,n,r):Vn(e,t,n,r),i-o<40){qn(e,t,o,i);return}n=o,r=i}}function qn(e,t,n,i){let o,r;for(let s=n+2;s<=i;s+=2){o=t[s],r=t[s+1];let a;for(a=s-2;a>=n&&e[o]<e[t[a]];a-=2)t[a+2]=t[a],t[a+3]=t[a+1];t[a+2]=o,t[a+3]=r}}function Un(e,t,n,i,o){const r=e[0],s=e[1];t=zn(r,s,t[0],t[1],i,o),n=zn(r,s,n[0],n[1],i,o);const a=t[0]<n[0]?t:n,f=a==t?n:t;return{x:r,y:s,a,b:f}}function zn(e,t,n,i,o,r){let s=n<i?n:i,a=s===n?i:n;return o[s]==e&&r[s]==t?a=s:o[a]==e&&r[a]==t&&(s=a),[s,a]}function Gn(e){const t={};return e.filter(n=>{const i=Wr(n);return i in t?!1:(t[i]=!0,!0)})}function Wr(e){return`${e.a.join(",")};${e.b.join(",")}`}class Zr{_i=0;_n=0;_inc=1;_xx;_yy;i=0;x=0;y=0;constructor(t,n){this._xx=t,this._yy=n}}function to(e,t,n,i){let o=n|0;const r=isNaN(i)?e.length-o:i+o;let s,a,f,l,u,c;if(r>0)f=u=e[o],l=c=t[o];else return[void 0,void 0,void 0,void 0];for(o++;o<r;o++)s=e[o],a=t[o],s<f&&(f=s),s>u&&(u=s),a<l&&(l=a),a>c&&(c=a);return[f,l,u,c]}class he{xmin;ymin;xmax;ymax;constructor(...t){t.length>0&&this.setBounds(t)}cloneBounds(){return this.clone()}clone(){return new he(this.xmin,this.ymin,this.xmax,this.ymax)}width(){return this.xmax-this.xmin||0}height(){return this.ymax-this.ymin||0}setBounds(t,n,i,o){let r,s,a,f;if(arguments.length==1)if(le(t)){const l=t;r=l[0],s=l[1],a=l[2],f=l[3]}else{const l=t;r=l.xmin,s=l.ymin,a=l.xmax,f=l.ymax}else r=t,s=n,a=i,f=o;return this.xmin=r,this.ymin=s,this.xmax=a,this.ymax=f,(r>a||s>f)&&this.update(),this}update(){let t;this.xmin>this.xmax&&(t=this.xmin,this.xmin=this.xmax,this.xmax=t),this.ymin>this.ymax&&(t=this.ymin,this.ymin=this.ymax,this.ymax=t)}mergeBounds(t,...n){let i,o,r,s;return t instanceof he?(i=t.xmin,o=t.ymin,r=t.xmax,s=t.ymax):n.length==3?(i=t,o=n[0],r=n[1],s=n[2]):t.length==4?(i=t[0],o=t[1],r=t[2],s=t[3]):Gt("Bounds#mergeBounds() invalid argument:",t),this.xmin===void 0?this.setBounds(i,o,r,s):(i<this.xmin&&(this.xmin=i),o<this.ymin&&(this.ymin=o),r>this.xmax&&(this.xmax=r),s>this.ymax&&(this.ymax=s)),this}}function Ae(e){const t=["a","b","c"].map(n=>e.properties[n].index);return[[0,1],[0,2],[1,2],[0,1,2]].map(n=>n.map(i=>t[i]).sort().join("-")).sort()}function Je(e,t,n){const i=Ae(t.forw),o=Ae(t.bakw);if(JSON.stringify(i)!=JSON.stringify(o))throw`${JSON.stringify(t,null,2)}
2
2
  ${JSON.stringify(i)}
3
- ${JSON.stringify(o)}`;for(let r=0;r<i.length;r++){const s=i[r];e[s]||(e[s]=[]),e[s].push(t)}n&&(n.forw.features.push(t.forw),n.bakw.features.push(t.bakw))}function Jn(e,t,n){const i=ke(t.forw),o=ke(t.bakw);if(JSON.stringify(i)!=JSON.stringify(o))throw`${JSON.stringify(t,null,2)}
3
+ ${JSON.stringify(o)}`;for(let r=0;r<i.length;r++){const s=i[r];e[s]||(e[s]=[]),e[s].push(t)}n&&(n.forw.features.push(t.forw),n.bakw.features.push(t.bakw))}function Jn(e,t,n){const i=Ae(t.forw),o=Ae(t.bakw);if(JSON.stringify(i)!=JSON.stringify(o))throw`${JSON.stringify(t,null,2)}
4
4
  ${JSON.stringify(i)}
5
- ${JSON.stringify(o)}`;if(i.forEach(r=>{const s=e[r];if(!s)return;const a=s.filter(h=>h!==t);a.length===0?delete e[r]:e[r]=a}),n){const r=(s,a)=>{!s||!a||(s.features=s.features.filter(h=>h!==a))};r(n.forw,t.forw),r(n.bakw,t.bakw)}}function he(e,t,n){return Dt(e,{target:{geom:t,index:n}})}function fe(e){return Dt(e.properties.target.geom,{target:{geom:e.geometry.coordinates,index:e.properties.target.index}})}function Ke(e,t){const n=e.length,i=t.geometry.coordinates;return Array.from({length:n},(o,r)=>r).map(o=>{const r=(o+1)%n,s=e[o],a=e[r],h=s.geometry.coordinates,l=Math.atan2(h[0]-i[0],h[1]-i[1]),u=[t,s,a,t].map(p=>p.geometry.coordinates),c={a:{geom:t.properties.target.geom,index:t.properties.target.index},b:{geom:s.properties.target.geom,index:s.properties.target.index},c:{geom:a.properties.target.geom,index:a.properties.target.index}},f=St([Zt([u],c)]);return[l,f]}).reduce((o,r)=>(o[0].push(r[0]),o[1].push(r[1]),o),[[],[]])}function Ee(e,t=1e-6){const[n,i]=e[0],[o,r]=e[1],[s,a]=e[2];return Math.abs((o-n)*(a-i)-(s-n)*(r-i))<t}function to(e,t){const n=new Set;return e.forEach(i=>{if(i.length!==2)return;const o=i.map(r=>`${t?.[r]??r}`);n.add(o.sort().join("-"))}),n}function ue(e){return["a","b","c"].map((t,n)=>({prop:e.properties[t],geom:e.geometry.coordinates[0][n]}))}const eo=10;function no(e,t,n,i,o,r){if(!e&&!t)return!1;const s=e?0:1,a=1-s,h=n[s],l=n[a];if(!h||!l)return!1;const u=_t(l.geom);let c=!1,f=!1;for(let p=0;p<=1;p++){const _=i[p];if(!_)continue;const g=[String(_.prop.index),String(h.prop.index)].sort().join("-"),I=o[g];if(!I||I.length<2)continue;const M=I.find(B=>B.bakw!==r[s].bakw);if(!M)continue;const b=ue(M.bakw).find(B=>String(B.prop.index)!==String(_.prop.index)&&String(B.prop.index)!==String(h.prop.index));if(!b)continue;c=!0;const d=_t(b.geom),v=_t(_.geom),w=_t(h.geom),A=w[0]-v[0],S=w[1]-v[1],E=A*(u[1]-v[1])-S*(u[0]-v[0]),O=A*(d[1]-v[1])-S*(d[0]-v[0]);if(E*O>0){f=!0;break}}return c&&!f}function io(e,t,n,i){if(!e&&!t)return!1;if(n[0]&&n[1]&&i[0]&&i[1]){const o=i.map(u=>_t(u.geom)),r=n.map(u=>_t(u.geom)),s=o[1][0]-o[0][0],a=o[1][1]-o[0][1],h=s*(r[0][1]-o[0][1])-a*(r[0][0]-o[0][0]),l=s*(r[1][1]-o[0][1])-a*(r[1][0]-o[0][0]);return h*l<0}return!1}function ro(e,t,n,i){const o=to(n,i),r=new Set;let s=!1;for(let a=0;a<eo;a++){let h=!1;for(const l of Object.keys(t)){if(r.has(l))continue;r.add(l);const u=t[l];if(!u||u.length<2)continue;const c=l.split("-");if(c.length!==2||o.has(l))continue;const f=ue(u[0].bakw),p=ue(u[1].bakw),_=ue(u[0].forw),g=ue(u[1].forw),I=c.map(x=>f.find(N=>`${N.prop.index}`===x)||p.find(N=>`${N.prop.index}`===x)),M=c.map(x=>_.find(N=>`${N.prop.index}`===x)||g.find(N=>`${N.prop.index}`===x));if(I.some(x=>!x)||M.some(x=>!x))continue;const m=[f,p].map(x=>x.find(N=>!c.includes(`${N.prop.index}`))),b=[_,g].map(x=>x.find(N=>!c.includes(`${N.prop.index}`)));if(m.some(x=>!x)||b.some(x=>!x))continue;const d=u[0].bakw.geometry.coordinates[0].slice(0,3).map(x=>_t(x)),v=u[1].bakw.geometry.coordinates[0].slice(0,3).map(x=>_t(x)),w=u[0].forw.geometry.coordinates[0].slice(0,3).map(x=>_t(x)),A=u[1].forw.geometry.coordinates[0].slice(0,3).map(x=>_t(x)),S=Ee(d),E=Ee(v),O=Ee(w),B=Ee(A),X=no(S,E,m,I,t,u),F=io(O,B,m,I);if(!(X||F||Kn(_t(m[0].geom),v)||Kn(_t(m[1].geom),d)))continue;const P=M.map(x=>_t(x.geom)),k=b.map(x=>_t(x.geom)),T=oo([...P,...k]),C=so(T),Y=Qn(P[0],P[1],k[0])+Qn(P[0],P[1],k[1]);Qe(C,Y)&&(Jn(t,u[0],e),Jn(t,u[1],e),I.forEach(x=>{if(!x)return;const N=[x.geom,m[0].geom,m[1].geom,x.geom],D={a:x.prop,b:m[0].prop,c:m[1].prop},R=Zt([N],D),$=Bn(R);Je(t,{forw:$,bakw:R},e)}),h=!0,s=!0)}if(!h)break}return s}function _t(e){return[e[0],e[1]]}function Kn(e,t){const[n,i]=t[0],[o,r]=t[1],[s,a]=t[2],h=s-n,l=a-i,u=o-n,c=r-i,f=e[0]-n,p=e[1]-i,_=h*h+l*l,g=h*u+l*c,I=h*f+l*p,M=u*u+c*c,m=u*f+c*p,b=_*M-g*g;if(b===0)return!1;const d=1/b,v=(M*I-g*m)*d,w=(_*m-g*I)*d,A=1e-9;return v>=-A&&w>=-A&&v+w<=1+A}function oo(e){const t=e.map(s=>s.slice()).filter((s,a,h)=>h.findIndex(l=>Qe(l[0],s[0])&&Qe(l[1],s[1]))===a);if(t.length<=1)return t;const n=t.sort((s,a)=>s[0]===a[0]?s[1]-a[1]:s[0]-a[0]),i=(s,a,h)=>(a[0]-s[0])*(h[1]-s[1])-(a[1]-s[1])*(h[0]-s[0]),o=[];for(const s of n){for(;o.length>=2&&i(o[o.length-2],o[o.length-1],s)<=0;)o.pop();o.push(s)}const r=[];for(let s=n.length-1;s>=0;s--){const a=n[s];for(;r.length>=2&&i(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}return r.pop(),o.pop(),o.concat(r)}function so(e){if(e.length<3)return 0;let t=0;for(let n=0;n<e.length;n++){const[i,o]=e[n],[r,s]=e[(n+1)%e.length];t+=i*s-r*o}return Math.abs(t)/2}function Qn(e,t,n){return Math.abs((e[0]*(t[1]-n[1])+t[0]*(n[1]-e[1])+n[0]*(e[1]-t[1]))/2)}function Qe(e,t,n=1e-9){return Math.abs(e-t)<=n}const He=2.00704,Hn=3.00001;class lt extends kt{importance;priority;pointsSet;useV2Algorithm;constructor(t={}){super(),t.bounds?this.setBounds(t.bounds):(this.setWh(t.wh),this.vertexMode=t.vertexMode||lt.VERTEX_PLAIN),this.strictMode=t.strictMode||lt.MODE_AUTO,this.yaxisMode=t.yaxisMode||lt.YAXIS_INVERT,this.importance=t.importance||0,this.priority=t.priority||0,this.stateFull=t.stateFull||!1,this.useV2Algorithm=t.useV2Algorithm??!1,t.points&&this.setPoints(t.points),t.edges&&this.setEdges(t.edges)}getFormatVersion(){return this.useV2Algorithm?He:Hn}setPoints(t){this.yaxisMode===lt.YAXIS_FOLLOW&&(t=t.map(n=>[n[0],[n[1][0],-1*n[1][1]]])),this.points=t,this.tins=void 0,this.indexedTins=void 0}setEdges(t=[]){this.edges=Nn(t),this.edgeNodes=void 0,this.tins=void 0,this.indexedTins=void 0}setBounds(t){this.bounds=t;let n=t[0][0],i=n,o=t[0][1],r=o;const s=[t[0]];for(let a=1;a<t.length;a++){const h=t[a];h[0]<n&&(n=h[0]),h[0]>i&&(i=h[0]),h[1]<o&&(o=h[1]),h[1]>r&&(r=h[1]),s.push(h)}s.push(t[0]),this.boundsPolygon=Zt([s]),this.xy=[n,o],this.wh=[i-n,r-o],this.vertexMode=lt.VERTEX_PLAIN,this.tins=void 0,this.indexedTins=void 0}getCompiled(){const t={};t.version=this.useV2Algorithm?He:Hn,t.points=this.points,t.weight_buffer={},t.centroid_point=[this.centroid.forw.geometry.coordinates,this.centroid.forw.properties.target.geom],t.vertices_params=[this.vertices_params.forw[0],this.vertices_params.bakw[0]],t.vertices_points=[];const n=this.vertices_params.forw[1];if(n)for(let i=0;i<n.length;i++){const o=n[i].features[0],r=o.geometry.coordinates[0][1],s=o.properties.b.geom;t.vertices_points[i]=[r,s]}return t.strict_status=this.strict_status,t.tins_points=[[]],this.tins.forw.features.map(i=>{t.tins_points[0].push(["a","b","c"].map(o=>i.properties[o].index))}),this.strict_status===lt.STATUS_LOOSE?(t.tins_points[1]=[],this.tins.bakw.features.map(i=>{t.tins_points[1].push(["a","b","c"].map(o=>i.properties[o].index))})):this.strict_status===lt.STATUS_ERROR&&this.kinks?.bakw&&(t.kinks_points=this.kinks.bakw.features.map(i=>i.geometry.coordinates)),t.yaxisMode=this.yaxisMode,t.vertexMode=this.vertexMode,t.strictMode=this.strictMode,this.bounds?(t.bounds=this.bounds,t.boundsPolygon=this.boundsPolygon,this.useV2Algorithm&&(t.xy=this.xy,t.wh=this.wh)):t.wh=this.wh,t.edges=this.edges??[],t.edgeNodes=this.edgeNodes??[],t}setCompiled(t){super.setCompiled(t)}setWh(t){this.wh=t||[100,100],this.xy=[0,0],this.bounds=void 0,this.boundsPolygon=void 0,this.tins=void 0,this.indexedTins=void 0}setVertexMode(t){this.vertexMode=t,this.tins=void 0,this.indexedTins=void 0}setStrictMode(t){this.strictMode=t,this.tins=void 0,this.indexedTins=void 0}calculateStrictTin(){const t=this.tins.forw.features.map(r=>Bn(r));this.tins.bakw=St(t);const n={};this.tins.forw.features.forEach((r,s)=>{const a=this.tins.bakw.features[s];Je(n,{forw:r,bakw:a})});const i=(this.pointsSet?.forw.features??[]).map(r=>r.properties.target.index);ro(this.tins,n,this.pointsSet?.edges||[],i);const o=["forw","bakw"].map(r=>{const s=this.tins[r].features.map(a=>a.geometry.coordinates[0]);return $n(s)});o[0].length===0&&o[1].length===0?(this.strict_status=lt.STATUS_STRICT,delete this.kinks):(this.strict_status=lt.STATUS_ERROR,this.kinks={forw:St(o[0]),bakw:St(o[1])})}generatePointsSet(){const t={forw:[],bakw:[]};for(let o=0;o<this.points.length;o++){const r=this.points[o][0],s=this.points[o][1],a=he(r,s,o);t.forw.push(a),t.bakw.push(fe(a))}const n=[];let i=0;this.edgeNodes=[],this.edges||(this.edges=[]);for(let o=0;o<this.edges.length;o++){const r=this.edges[o][2],s=Object.assign([],this.edges[o][0]),a=Object.assign([],this.edges[o][1]);if(s.length===0&&a.length===0){n.push(r);continue}s.unshift(this.points[r[0]][0]),s.push(this.points[r[1]][0]),a.unshift(this.points[r[0]][1]),a.push(this.points[r[1]][1]);const h=[s,a].map(l=>{const u=l.map((f,p,_)=>{if(p===0)return 0;const g=_[p-1];return Math.sqrt(Math.pow(f[0]-g[0],2)+Math.pow(f[1]-g[1],2))}),c=u.reduce((f,p,_)=>_===0?[0]:(f.push(f[_-1]+p),f),[]);return c.map((f,p,_)=>{const g=f/_[_.length-1];return[l[p],u[p],c[p],g]})});h.map((l,u)=>{const c=h[u?0:1];return l.filter((f,p)=>!(p===0||p===l.length-1||f[4]==="handled")).flatMap(f=>{const p=f[0],_=f[3],g=c.reduce((I,M,m,b)=>{if(I)return I;const d=b[m+1];if(M[3]===_)return M[4]="handled",[M];if(M[3]<_&&d&&d[3]>_)return[M,d]},void 0);if(g&&g.length===1)return u===0?[[p,g[0][0],_]]:[[g[0][0],p,_]];if(g&&g.length===2){const I=g[0],M=g[1],m=(_-I[3])/(M[3]-I[3]),b=[(M[0][0]-I[0][0])*m+I[0][0],(M[0][1]-I[0][1])*m+I[0][1]];return u===0?[[p,b,_]]:[[b,p,_]]}return[]})}).reduce((l,u)=>l.concat(u),[]).sort((l,u)=>l[2]<u[2]?-1:1).map((l,u,c)=>{this.edgeNodes[i]=[l[0],l[1]];const f=he(l[0],l[1],`e${i}`);i++,t.forw.push(f),t.bakw.push(fe(f)),u===0?n.push([r[0],t.forw.length-1]):n.push([t.forw.length-2,t.forw.length-1]),u===c.length-1&&n.push([t.forw.length-1,r[1]])})}return{forw:t.forw,bakw:t.bakw,edges:n}}validateAndPrepareInputs(){const t=this.xy[0]-.05*this.wh[0],n=this.xy[0]+1.05*this.wh[0],i=this.xy[1]-.05*this.wh[1],o=this.xy[1]+1.05*this.wh[1];if(this.bounds&&!this.boundsPolygon)throw new Error("Internal error: bounds is set but boundsPolygon is missing");const r=this.bounds?this.boundsPolygon:void 0;if(!this.points.reduce((h,l)=>h&&(r?Ce(l[0],r):l[0][0]>=t&&l[0][0]<=n&&l[0][1]>=i&&l[0][1]<=o),!0))throw"SOME POINTS OUTSIDE";let a=[];return this.wh&&(a=[[t,i],[n,i],[t,o],[n,o]]),{pointsSet:this.generatePointsSet(),bbox:a,minx:t,maxx:n,miny:i,maxy:o}}computeGcpBbox(){let t=1/0,n=-1/0,i=1/0,o=-1/0;for(const a of this.points){const h=a[0][0],l=a[0][1];h<t&&(t=h),h>n&&(n=h),l<i&&(i=l),l>o&&(o=l)}const r=n-t,s=o-i;return{minx:t-.05*r,maxx:n+.05*r,miny:i-.05*s,maxy:o+.05*s}}updateTin(){let t=this.strictMode;t!==lt.MODE_STRICT&&t!==lt.MODE_LOOSE&&(t=lt.MODE_AUTO);const n=!this.useV2Algorithm;let i,o,r,s,a;if(n){if(this.bounds){const S=this.boundsPolygon;if(!S)throw new Error("Internal error: bounds is set but boundsPolygon is missing");if(!this.points.every(O=>Ce(O[0],S)))throw"SOME POINTS OUTSIDE"}i=this.generatePointsSet(),{minx:o,maxx:r,miny:s,maxy:a}=this.computeGcpBbox()}else{const S=this.validateAndPrepareInputs();i=S.pointsSet,o=S.minx,r=S.maxx,s=S.miny,a=S.maxy}const h={forw:St(i.forw),bakw:St(i.bakw)},l=ae(h.forw,i.edges,"target"),u=ae(h.bakw,i.edges,"target");if(l.features.length===0||u.features.length===0)throw"TOO LINEAR1";const c=Oi(h.forw),f=bn(h.forw);if(!f)throw"TOO LINEAR2";const p={},_=f.geometry.coordinates[0];let g;try{g=_.map(S=>({forw:S,bakw:oe(Dt(S),l)})),g.forEach(S=>{p[`${S.forw[0]}:${S.forw[1]}`]=S})}catch{throw"TOO LINEAR2"}const I=bn(h.bakw);if(!I)throw"TOO LINEAR2";const M=I.geometry.coordinates[0];try{g=M.map(S=>({bakw:S,forw:oe(Dt(S),u)})),g.forEach(S=>{p[`${S.forw[0]}:${S.forw[1]}`]=S})}catch{throw"TOO LINEAR2"}let m;if(n){const S=c.geometry.coordinates,E=l.features.find(O=>Ce(Dt(S),O));if(E){const O=E.geometry.coordinates[0],B=E.properties.a.geom,X=E.properties.b.geom,F=E.properties.c.geom;m={forw:[(O[0][0]+O[1][0]+O[2][0])/3,(O[0][1]+O[1][1]+O[2][1])/3],bakw:[(B[0]+X[0]+F[0])/3,(B[1]+X[1]+F[1])/3]}}else m={forw:S,bakw:oe(c,l)}}else m={forw:c.geometry.coordinates,bakw:oe(c,l)};const b=he(m.forw,m.bakw,"c");this.centroid={forw:b,bakw:fe(b)};const d=[...this.points.map(S=>({forw:S[0],bakw:S[1]})),...(this.edgeNodes??[]).map(S=>({forw:S[0],bakw:S[1]}))],v={convexBuf:p,centroid:m,allGcps:d,minx:o,maxx:r,miny:s,maxy:a},w=this.vertexMode===lt.VERTEX_BIRDEYE?Br(v,n):Or(v,n),A={forw:[],bakw:[]};for(let S=0;S<w.length;S++){const E=w[S].forw,O=w[S].bakw,B=he(E,O,`b${S}`),X=fe(B);i.forw.push(B),i.bakw.push(X),A.forw.push(B),A.bakw.push(X)}this.pointsSet={forw:St(i.forw),bakw:St(i.bakw),edges:i.edges},this.tins={forw:On(ae(this.pointsSet.forw,i.edges,"target"))},(t===lt.MODE_STRICT||t===lt.MODE_AUTO)&&this.calculateStrictTin(),(t===lt.MODE_LOOSE||t===lt.MODE_AUTO&&this.strict_status===lt.STATUS_ERROR)&&(this.tins.bakw=On(ae(this.pointsSet.bakw,i.edges,"target")),delete this.kinks,this.strict_status=lt.STATUS_LOOSE),this.vertices_params={forw:Ke(A.forw,this.centroid.forw),bakw:Ke(A.bakw,this.centroid.bakw)},this.addIndexedTin(),this.pointsWeightBuffer={}}async updateTinAsync(){this.updateTin()}}bt.Tin=lt,bt.constrainedTin=ae,bt.counterPoint=fe,bt.createPoint=he,bt.default=lt,bt.findIntersections=$n,bt.format_version=He,bt.insertSearchIndex=Je,bt.vertexCalc=Ke,Object.defineProperties(bt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
5
+ ${JSON.stringify(o)}`;if(i.forEach(r=>{const s=e[r];if(!s)return;const a=s.filter(f=>f!==t);a.length===0?delete e[r]:e[r]=a}),n){const r=(s,a)=>{!s||!a||(s.features=s.features.filter(f=>f!==a))};r(n.forw,t.forw),r(n.bakw,t.bakw)}}function ue(e,t,n){return Dt(e,{target:{geom:t,index:n}})}function de(e){return Dt(e.properties.target.geom,{target:{geom:e.geometry.coordinates,index:e.properties.target.index}})}function Ke(e,t){const n=e.length,i=t.geometry.coordinates;return Array.from({length:n},(o,r)=>r).map(o=>{const r=(o+1)%n,s=e[o],a=e[r],f=s.geometry.coordinates,l=Math.atan2(f[0]-i[0],f[1]-i[1]),u=[t,s,a,t].map(p=>p.geometry.coordinates),c={a:{geom:t.properties.target.geom,index:t.properties.target.index},b:{geom:s.properties.target.geom,index:s.properties.target.index},c:{geom:a.properties.target.geom,index:a.properties.target.index}},h=St([te([u],c)]);return[l,h]}).reduce((o,r)=>(o[0].push(r[0]),o[1].push(r[1]),o),[[],[]])}function Ie(e,t=1e-6){const[n,i]=e[0],[o,r]=e[1],[s,a]=e[2];return Math.abs((o-n)*(a-i)-(s-n)*(r-i))<t}function eo(e,t){const n=new Set;return e.forEach(i=>{if(i.length!==2)return;const o=i.map(r=>`${t?.[r]??r}`);n.add(o.sort().join("-"))}),n}function pe(e){return["a","b","c"].map((t,n)=>({prop:e.properties[t],geom:e.geometry.coordinates[0][n]}))}const no=10;function io(e,t,n,i,o,r){if(!e&&!t)return!1;const s=e?0:1,a=1-s,f=n[s],l=n[a];if(!f||!l)return!1;const u=_t(l.geom);let c=!1,h=!1;for(let p=0;p<=1;p++){const M=i[p];if(!M)continue;const w=[String(M.prop.index),String(f.prop.index)].sort().join("-"),I=o[w];if(!I||I.length<2)continue;const x=I.find(B=>B.bakw!==r[s].bakw);if(!x)continue;const _=pe(x.bakw).find(B=>String(B.prop.index)!==String(M.prop.index)&&String(B.prop.index)!==String(f.prop.index));if(!_)continue;c=!0;const d=_t(_.geom),v=_t(M.geom),g=_t(f.geom),k=g[0]-v[0],S=g[1]-v[1],A=k*(u[1]-v[1])-S*(u[0]-v[0]),O=k*(d[1]-v[1])-S*(d[0]-v[0]);if(A*O>0){h=!0;break}}return c&&!h}function ro(e,t,n,i){if(!e&&!t)return!1;if(n[0]&&n[1]&&i[0]&&i[1]){const o=i.map(u=>_t(u.geom)),r=n.map(u=>_t(u.geom)),s=o[1][0]-o[0][0],a=o[1][1]-o[0][1],f=s*(r[0][1]-o[0][1])-a*(r[0][0]-o[0][0]),l=s*(r[1][1]-o[0][1])-a*(r[1][0]-o[0][0]);return f*l<0}return!1}function oo(e,t,n,i){const o=eo(n,i),r=new Set;let s=!1;for(let a=0;a<no;a++){let f=!1;for(const l of Object.keys(t)){if(r.has(l))continue;r.add(l);const u=t[l];if(!u||u.length<2)continue;const c=l.split("-");if(c.length!==2||o.has(l))continue;const h=pe(u[0].bakw),p=pe(u[1].bakw),M=pe(u[0].forw),w=pe(u[1].forw),I=c.map(b=>h.find(N=>`${N.prop.index}`===b)||p.find(N=>`${N.prop.index}`===b)),x=c.map(b=>M.find(N=>`${N.prop.index}`===b)||w.find(N=>`${N.prop.index}`===b));if(I.some(b=>!b)||x.some(b=>!b))continue;const m=[h,p].map(b=>b.find(N=>!c.includes(`${N.prop.index}`))),_=[M,w].map(b=>b.find(N=>!c.includes(`${N.prop.index}`)));if(m.some(b=>!b)||_.some(b=>!b))continue;const d=u[0].bakw.geometry.coordinates[0].slice(0,3).map(b=>_t(b)),v=u[1].bakw.geometry.coordinates[0].slice(0,3).map(b=>_t(b)),g=u[0].forw.geometry.coordinates[0].slice(0,3).map(b=>_t(b)),k=u[1].forw.geometry.coordinates[0].slice(0,3).map(b=>_t(b)),S=Ie(d),A=Ie(v),O=Ie(g),B=Ie(k),C=io(S,A,m,I,t,u),Y=ro(O,B,m,I);if(!(C||Y||Kn(_t(m[0].geom),v)||Kn(_t(m[1].geom),d)))continue;const P=x.map(b=>_t(b.geom)),E=_.map(b=>_t(b.geom)),T=so([...P,...E]),X=ao(T),F=Qn(P[0],P[1],E[0])+Qn(P[0],P[1],E[1]);Qe(X,F)&&(Jn(t,u[0],e),Jn(t,u[1],e),I.forEach(b=>{if(!b)return;const N=[b.geom,m[0].geom,m[1].geom,b.geom],D={a:b.prop,b:m[0].prop,c:m[1].prop},R=te([N],D),L=Bn(R);Je(t,{forw:L,bakw:R},e)}),f=!0,s=!0)}if(!f)break}return s}function _t(e){return[e[0],e[1]]}function Kn(e,t){const[n,i]=t[0],[o,r]=t[1],[s,a]=t[2],f=s-n,l=a-i,u=o-n,c=r-i,h=e[0]-n,p=e[1]-i,M=f*f+l*l,w=f*u+l*c,I=f*h+l*p,x=u*u+c*c,m=u*h+c*p,_=M*x-w*w;if(_===0)return!1;const d=1/_,v=(x*I-w*m)*d,g=(M*m-w*I)*d,k=1e-9;return v>=-k&&g>=-k&&v+g<=1+k}function so(e){const t=e.map(s=>s.slice()).filter((s,a,f)=>f.findIndex(l=>Qe(l[0],s[0])&&Qe(l[1],s[1]))===a);if(t.length<=1)return t;const n=t.sort((s,a)=>s[0]===a[0]?s[1]-a[1]:s[0]-a[0]),i=(s,a,f)=>(a[0]-s[0])*(f[1]-s[1])-(a[1]-s[1])*(f[0]-s[0]),o=[];for(const s of n){for(;o.length>=2&&i(o[o.length-2],o[o.length-1],s)<=0;)o.pop();o.push(s)}const r=[];for(let s=n.length-1;s>=0;s--){const a=n[s];for(;r.length>=2&&i(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}return r.pop(),o.pop(),o.concat(r)}function ao(e){if(e.length<3)return 0;let t=0;for(let n=0;n<e.length;n++){const[i,o]=e[n],[r,s]=e[(n+1)%e.length];t+=i*s-r*o}return Math.abs(t)/2}function Qn(e,t,n){return Math.abs((e[0]*(t[1]-n[1])+t[0]*(n[1]-e[1])+n[0]*(e[1]-t[1]))/2)}function Qe(e,t,n=1e-9){return Math.abs(e-t)<=n}const He=2.00704,Hn=3.00001;class lt extends kt{importance;priority;pointsSet;useV2Algorithm;constructor(t={}){super(),t.bounds?this.setBounds(t.bounds):(this.setWh(t.wh),this.vertexMode=t.vertexMode||lt.VERTEX_PLAIN),this.strictMode=t.strictMode||lt.MODE_AUTO,this.yaxisMode=t.yaxisMode||lt.YAXIS_INVERT,this.importance=t.importance||0,this.priority=t.priority||0,this.stateFull=t.stateFull||!1,this.useV2Algorithm=t.useV2Algorithm??!1,t.points&&this.setPoints(t.points),t.edges&&this.setEdges(t.edges)}getFormatVersion(){return this.useV2Algorithm?He:Hn}setPoints(t){this.yaxisMode===lt.YAXIS_FOLLOW&&(t=t.map(n=>[n[0],[n[1][0],-1*n[1][1]]])),this.points=t,this.tins=void 0,this.indexedTins=void 0}setEdges(t=[]){this.edges=Nn(t),this.edgeNodes=void 0,this.tins=void 0,this.indexedTins=void 0}setBounds(t){this.bounds=t;let n=t[0][0],i=n,o=t[0][1],r=o;const s=[t[0]];for(let a=1;a<t.length;a++){const f=t[a];f[0]<n&&(n=f[0]),f[0]>i&&(i=f[0]),f[1]<o&&(o=f[1]),f[1]>r&&(r=f[1]),s.push(f)}s.push(t[0]),this.boundsPolygon=te([s]),this.xy=[n,o],this.wh=[i-n,r-o],this.vertexMode=lt.VERTEX_PLAIN,this.tins=void 0,this.indexedTins=void 0}getCompiled(){const t={};t.version=this.useV2Algorithm?He:Hn,t.points=this.points,t.weight_buffer={},t.centroid_point=[this.centroid.forw.geometry.coordinates,this.centroid.forw.properties.target.geom],t.vertices_params=[this.vertices_params.forw[0],this.vertices_params.bakw[0]],t.vertices_points=[];const n=this.vertices_params.forw[1];if(n)for(let i=0;i<n.length;i++){const o=n[i].features[0],r=o.geometry.coordinates[0][1],s=o.properties.b.geom;t.vertices_points[i]=[r,s]}return t.strict_status=this.strict_status,t.tins_points=[[]],this.tins.forw.features.map(i=>{t.tins_points[0].push(["a","b","c"].map(o=>i.properties[o].index))}),this.strict_status===lt.STATUS_LOOSE?(t.tins_points[1]=[],this.tins.bakw.features.map(i=>{t.tins_points[1].push(["a","b","c"].map(o=>i.properties[o].index))})):this.strict_status===lt.STATUS_ERROR&&this.kinks?.bakw&&(t.kinks_points=this.kinks.bakw.features.map(i=>i.geometry.coordinates)),t.yaxisMode=this.yaxisMode,t.vertexMode=this.vertexMode,t.strictMode=this.strictMode,this.bounds?(t.bounds=this.bounds,t.boundsPolygon=this.boundsPolygon,this.useV2Algorithm&&(t.xy=this.xy,t.wh=this.wh)):t.wh=this.wh,t.edges=this.edges??[],t.edgeNodes=this.edgeNodes??[],t}setCompiled(t){super.setCompiled(t)}setWh(t){this.wh=t||[100,100],this.xy=[0,0],this.bounds=void 0,this.boundsPolygon=void 0,this.tins=void 0,this.indexedTins=void 0}setVertexMode(t){this.vertexMode=t,this.tins=void 0,this.indexedTins=void 0}setStrictMode(t){this.strictMode=t,this.tins=void 0,this.indexedTins=void 0}calculateStrictTin(){const t=this.tins.forw.features.map(r=>Bn(r));this.tins.bakw=St(t);const n={};this.tins.forw.features.forEach((r,s)=>{const a=this.tins.bakw.features[s];Je(n,{forw:r,bakw:a})});const i=(this.pointsSet?.forw.features??[]).map(r=>r.properties.target.index);oo(this.tins,n,this.pointsSet?.edges||[],i);const o=["forw","bakw"].map(r=>{const s=this.tins[r].features.map(a=>a.geometry.coordinates[0]);return Ln(s)});o[0].length===0&&o[1].length===0?(this.strict_status=lt.STATUS_STRICT,delete this.kinks):(this.strict_status=lt.STATUS_ERROR,this.kinks={forw:St(o[0]),bakw:St(o[1])})}generatePointsSet(){const t={forw:[],bakw:[]};for(let o=0;o<this.points.length;o++){const r=this.points[o][0],s=this.points[o][1],a=ue(r,s,o);t.forw.push(a),t.bakw.push(de(a))}const n=[];let i=0;this.edgeNodes=[],this.edges||(this.edges=[]);for(let o=0;o<this.edges.length;o++){const r=this.edges[o][2],s=Object.assign([],this.edges[o][0]),a=Object.assign([],this.edges[o][1]);if(s.length===0&&a.length===0){n.push(r);continue}s.unshift(this.points[r[0]][0]),s.push(this.points[r[1]][0]),a.unshift(this.points[r[0]][1]),a.push(this.points[r[1]][1]);const f=[s,a].map(l=>{const u=l.map((h,p,M)=>{if(p===0)return 0;const w=M[p-1];return Math.sqrt(Math.pow(h[0]-w[0],2)+Math.pow(h[1]-w[1],2))}),c=u.reduce((h,p,M)=>M===0?[0]:(h.push(h[M-1]+p),h),[]);return c.map((h,p,M)=>{const w=h/M[M.length-1];return[l[p],u[p],c[p],w]})});f.map((l,u)=>{const c=f[u?0:1];return l.filter((h,p)=>!(p===0||p===l.length-1||h[4]==="handled")).flatMap(h=>{const p=h[0],M=h[3],w=c.reduce((I,x,m,_)=>{if(I)return I;const d=_[m+1];if(x[3]===M)return x[4]="handled",[x];if(x[3]<M&&d&&d[3]>M)return[x,d]},void 0);if(w&&w.length===1)return u===0?[[p,w[0][0],M]]:[[w[0][0],p,M]];if(w&&w.length===2){const I=w[0],x=w[1],m=(M-I[3])/(x[3]-I[3]),_=[(x[0][0]-I[0][0])*m+I[0][0],(x[0][1]-I[0][1])*m+I[0][1]];return u===0?[[p,_,M]]:[[_,p,M]]}return[]})}).reduce((l,u)=>l.concat(u),[]).sort((l,u)=>l[2]<u[2]?-1:1).map((l,u,c)=>{this.edgeNodes[i]=[l[0],l[1]];const h=ue(l[0],l[1],`e${i}`);i++,t.forw.push(h),t.bakw.push(de(h)),u===0?n.push([r[0],t.forw.length-1]):n.push([t.forw.length-2,t.forw.length-1]),u===c.length-1&&n.push([t.forw.length-1,r[1]])})}return{forw:t.forw,bakw:t.bakw,edges:n}}validateAndPrepareInputs(){const t=this.xy[0]-.05*this.wh[0],n=this.xy[0]+1.05*this.wh[0],i=this.xy[1]-.05*this.wh[1],o=this.xy[1]+1.05*this.wh[1];if(this.bounds&&!this.boundsPolygon)throw new Error("Internal error: bounds is set but boundsPolygon is missing");const r=this.bounds?this.boundsPolygon:void 0;if(!this.points.reduce((f,l)=>f&&(r?Fe(l[0],r):l[0][0]>=t&&l[0][0]<=n&&l[0][1]>=i&&l[0][1]<=o),!0))throw"SOME POINTS OUTSIDE";let a=[];return this.wh&&(a=[[t,i],[n,i],[t,o],[n,o]]),{pointsSet:this.generatePointsSet(),bbox:a,minx:t,maxx:n,miny:i,maxy:o}}computeGcpBbox(){let t=1/0,n=-1/0,i=1/0,o=-1/0;for(const a of this.points){const f=a[0][0],l=a[0][1];f<t&&(t=f),f>n&&(n=f),l<i&&(i=l),l>o&&(o=l)}const r=n-t,s=o-i;return{minx:t-.05*r,maxx:n+.05*r,miny:i-.05*s,maxy:o+.05*s}}updateTin(){let t=this.strictMode;t!==lt.MODE_STRICT&&t!==lt.MODE_LOOSE&&(t=lt.MODE_AUTO);const n=!this.useV2Algorithm;let i,o,r,s,a;if(n){if(this.bounds){const S=this.boundsPolygon;if(!S)throw new Error("Internal error: bounds is set but boundsPolygon is missing");if(!this.points.every(O=>Fe(O[0],S)))throw"SOME POINTS OUTSIDE"}i=this.generatePointsSet(),{minx:o,maxx:r,miny:s,maxy:a}=this.computeGcpBbox()}else{const S=this.validateAndPrepareInputs();i=S.pointsSet,o=S.minx,r=S.maxx,s=S.miny,a=S.maxy}const f={forw:St(i.forw),bakw:St(i.bakw)},l=ce(f.forw,i.edges,"target"),u=ce(f.bakw,i.edges,"target");if(l.features.length===0||u.features.length===0)throw"TOO LINEAR1";const c=Oi(f.forw),h=bn(f.forw);if(!h)throw"TOO LINEAR2";const p={},M=h.geometry.coordinates[0];let w;try{w=M.map(S=>({forw:S,bakw:se(Dt(S),l)})),w.forEach(S=>{p[`${S.forw[0]}:${S.forw[1]}`]=S})}catch{throw"TOO LINEAR2"}const I=bn(f.bakw);if(!I)throw"TOO LINEAR2";const x=I.geometry.coordinates[0];try{w=x.map(S=>({bakw:S,forw:se(Dt(S),u)})),w.forEach(S=>{p[`${S.forw[0]}:${S.forw[1]}`]=S})}catch{throw"TOO LINEAR2"}let m;if(n){const S=c.geometry.coordinates,A=l.features.find(O=>Fe(Dt(S),O));if(A){const O=A.geometry.coordinates[0],B=A.properties.a.geom,C=A.properties.b.geom,Y=A.properties.c.geom;m={forw:[(O[0][0]+O[1][0]+O[2][0])/3,(O[0][1]+O[1][1]+O[2][1])/3],bakw:[(B[0]+C[0]+Y[0])/3,(B[1]+C[1]+Y[1])/3]}}else m={forw:S,bakw:se(c,l)}}else m={forw:c.geometry.coordinates,bakw:se(c,l)};const _=ue(m.forw,m.bakw,"c");this.centroid={forw:_,bakw:de(_)};const d=[...this.points.map(S=>({forw:S[0],bakw:S[1]})),...(this.edgeNodes??[]).map(S=>({forw:S[0],bakw:S[1]}))],v={convexBuf:p,centroid:m,allGcps:d,minx:o,maxx:r,miny:s,maxy:a},g=this.vertexMode===lt.VERTEX_BIRDEYE?Br(v,n):Or(v,n),k={forw:[],bakw:[]};for(let S=0;S<g.length;S++){const A=g[S].forw,O=g[S].bakw,B=ue(A,O,`b${S}`),C=de(B);i.forw.push(B),i.bakw.push(C),k.forw.push(B),k.bakw.push(C)}this.pointsSet={forw:St(i.forw),bakw:St(i.bakw),edges:i.edges},this.tins={forw:On(ce(this.pointsSet.forw,i.edges,"target"))},(t===lt.MODE_STRICT||t===lt.MODE_AUTO)&&this.calculateStrictTin(),(t===lt.MODE_LOOSE||t===lt.MODE_AUTO&&this.strict_status===lt.STATUS_ERROR)&&(this.tins.bakw=On(ce(this.pointsSet.bakw,i.edges,"target")),delete this.kinks,this.strict_status=lt.STATUS_LOOSE),this.vertices_params={forw:Ke(k.forw,this.centroid.forw),bakw:Ke(k.bakw,this.centroid.bakw)},this.addIndexedTin(),this.pointsWeightBuffer={}}async updateTinAsync(){this.updateTin()}}bt.Tin=lt,bt.constrainedTin=ce,bt.counterPoint=de,bt.createPoint=ue,bt.default=lt,bt.findIntersections=Ln,bt.format_version=He,bt.insertSearchIndex=Je,bt.vertexCalc=Ke,Object.defineProperties(bt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.1.0",
7
+ "version": "1.1.1",
8
8
  "description": "JavaScript library which performs homeomorphic conversion mutually between the coordinate systems of two planes based on the control points.",
9
9
  "type": "module",
10
10
  "module": "./dist/maplat_tin.js",
@@ -56,29 +56,29 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@eslint/js": "^10.0.1",
59
- "@testing-library/jest-dom": "^6.9.1",
59
+ "@testing-library/jest-dom": "^7.0.1",
60
60
  "@types/delaunator": "^5.0.3",
61
61
  "@types/estree": "^1.0.8",
62
62
  "@types/geojson": "^7946.0.16",
63
- "@types/node": "^25.5.2",
63
+ "@types/node": "^26.6.5",
64
64
  "@typescript-eslint/eslint-plugin": "^8.66.0",
65
65
  "@typescript-eslint/parser": "^8.66.0",
66
- "@vitest/coverage-v8": "^4.1.11",
66
+ "@vitest/coverage-v8": "^5.0.4",
67
67
  "cross-env": "^10.1.0",
68
68
  "dotenv": "^17.4.0",
69
69
  "dotenv-cli": "^11.0.0",
70
70
  "eslint": "^10.10.0",
71
71
  "eslint-config-prettier": "^10.1.8",
72
- "globals": "^16.5.0",
72
+ "globals": "^17.13.0",
73
73
  "jest-matcher-deep-close-to": "^3.0.2",
74
74
  "jsdom": "^30.0.1",
75
75
  "prettier": "^3.9.6",
76
76
  "robust-segment-intersect": "^1.0.1",
77
- "typescript": "^5.9.3",
77
+ "typescript": "^6.0.3",
78
78
  "typescript-eslint": "^8.66.0",
79
79
  "vite": "^7.3.5",
80
80
  "vite-plugin-dts": "^5.1.0",
81
- "vitest": "^4.1.11"
81
+ "vitest": "^5.0.4"
82
82
  },
83
83
  "scripts": {
84
84
  "dev": "vite --host",
package/src/kinks.ts CHANGED
@@ -7,10 +7,12 @@ import type { IntersectionPoint } from "./types/kinks.d.ts";
7
7
  *
8
8
  * @param coords - 線分群の座標配列。各線分は始点と終点の座標で表現
9
9
  * @returns 検出された交差点のFeature配列
10
+ * @throws {Error} 座標に有限数(Number.isFinite)でない値が含まれる場合
10
11
  */
11
12
  export default function findIntersections(
12
13
  coords: Position[][],
13
14
  ): Feature<Point>[] {
15
+ validateCoordinateValues(coords);
14
16
  const arcs = new ArcCollection(coords);
15
17
  const xy = arcs.findSegmentIntersections();
16
18
  const deduped: IntersectionPoint[] = dedupIntersections(xy);
@@ -25,6 +27,43 @@ export default function findIntersections(
25
27
  );
26
28
  }
27
29
 
30
+ /**
31
+ * 入力座標がすべて有限数(NaN や Infinity でない)であることを検証する
32
+ *
33
+ * 非有限数が混ざると、以降の交差判定のループが終了しなくなる恐れがあるため、
34
+ * 公開関数の入口で受け付けない。
35
+ *
36
+ * @param coords - 検証対象の線分群の座標配列
37
+ * @throws {Error} 有限数でない座標が見つかった場合
38
+ */
39
+ function validateCoordinateValues(coords: Position[][]) {
40
+ for (let i = 0, n = coords.length; i < n; i++) {
41
+ const points = coords[i];
42
+ if (!isArrayLike(points)) {
43
+ error(
44
+ "findIntersections() received invalid coordinates:",
45
+ `line=${i}`,
46
+ `points=${points}`,
47
+ );
48
+ }
49
+ for (let j = 0, m = points.length; j < m; j++) {
50
+ const xy = points[j];
51
+ if (
52
+ !isArrayLike(xy) ||
53
+ !Number.isFinite(xy[0]) ||
54
+ !Number.isFinite(xy[1])
55
+ ) {
56
+ error(
57
+ "findIntersections() received non-finite coordinates:",
58
+ `line=${i}`,
59
+ `point=${j}`,
60
+ `coordinates=${JSON.stringify(xy)}`,
61
+ );
62
+ }
63
+ }
64
+ }
65
+ }
66
+
28
67
  /**
29
68
  * 線分群を管理するクラス
30
69
  * 効率的な交差判定のためのデータ構造と機能を提供
@@ -243,6 +282,9 @@ class ArcCollection {
243
282
  stripeId = stripeCount > 1
244
283
  ? (y: number) => Math.floor(((stripeCount - 1) * (y - ymin)) / yrange)
245
284
  : () => 0;
285
+ // 線分が属するストライプを辿る走査は、高々 stripeCount 回で終わる。
286
+ // 万一の迷走(非有限数に由来する NaN など)に備えて上限を設ける。
287
+ const maxStripeSteps = stripeCount + 1;
246
288
  let i, j;
247
289
 
248
290
  // Count segments in each stripe
@@ -250,9 +292,19 @@ class ArcCollection {
250
292
  (id1: number, id2: number, _xx: Float64Array, yy: Float64Array) => {
251
293
  let s1 = stripeId(yy[id1]);
252
294
  const s2 = stripeId(yy[id2]);
295
+ let steps = 0;
253
296
  while (true) {
254
297
  stripeSizes[s1] = stripeSizes[s1] + 2;
255
298
  if (s1 == s2) break;
299
+ steps++;
300
+ if (steps > maxStripeSteps) {
301
+ error(
302
+ "findSegmentIntersections() exceeded the stripe iteration limit:",
303
+ `stripeCount=${stripeCount}`,
304
+ `s1=${s1}`,
305
+ `s2=${s2}`,
306
+ );
307
+ }
256
308
  s1 += s2 > s1 ? 1 : -1;
257
309
  }
258
310
  },
@@ -275,6 +327,7 @@ class ArcCollection {
275
327
  let s1 = stripeId(yy[id1]);
276
328
  const s2 = stripeId(yy[id2]);
277
329
  let count, stripe;
330
+ let steps = 0;
278
331
  while (true) {
279
332
  count = stripeSizes[s1];
280
333
  stripeSizes[s1] = count + 2;
@@ -282,6 +335,15 @@ class ArcCollection {
282
335
  stripe[count] = id1;
283
336
  stripe[count + 1] = id2;
284
337
  if (s1 == s2) break;
338
+ steps++;
339
+ if (steps > maxStripeSteps) {
340
+ error(
341
+ "findSegmentIntersections() exceeded the stripe iteration limit:",
342
+ `stripeCount=${stripeCount}`,
343
+ `s1=${s1}`,
344
+ `s2=${s2}`,
345
+ );
346
+ }
285
347
  s1 += s2 > s1 ? 1 : -1;
286
348
  }
287
349
  },
@@ -11,6 +11,11 @@ export interface VertexDelta {
11
11
  bakw?: [number, number];
12
12
  }
13
13
 
14
+ /**
15
+ * 三角形ごとの重み付き補間のバッファ(旧 compiled の weight_buffer の中身の形)。
16
+ *
17
+ * @deprecated 1.1.0(compiled 2.00704/3.00001)で weight_buffer の算出を廃止したため、Tin はこの型を使わない(MaplatTin#48)。代わりの型は無い。2.0.0 で削除する
18
+ */
14
19
  export interface WeightBuffer {
15
20
  [target: string]: {
16
21
  [vertexKey: string]: {