/** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. * Original file: /npm/d3-delaunay@6.0.4/src/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ import t from"../delaunator@5.0.1/e67acb27.js";const e=1e-6;class i{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,i,n){const s=(t=+t)+(n=+n),l=i=+i;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${s},${l}`:(Math.abs(this._x1-s)>e||Math.abs(this._y1-l)>e)&&(this._+="L"+s+","+l),n&&(this._+=`A${n},${n},0,1,1,${t-n},${i}A${n},${n},0,1,1,${this._x1=s},${this._y1=l}`)}rect(t,e,i,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+i}v${+n}h${-i}Z`}value(){return this._||null}}class n{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class s{constructor(t,[e,i,n,s]=[0,0,960,500]){if(!((n=+n)>=(e=+e)&&(s=+s)>=(i=+i)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=n,this.xmin=e,this.ymax=s,this.ymin=i,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:i},vectors:n}=this;let s,l;const h=this.circumcenters=this._circumcenters.subarray(0,i.length/3*2);for(let n,r,o=0,a=0,c=i.length;o1;)l-=2;for(let t=2;t0){if(e>=this.ymax)return null;(s=(this.ymax-e)/n)0){if(t>=this.xmax)return null;(s=(this.xmax-t)/i)this.xmax?2:0)|(ethis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e2&&function(t){const{triangles:e,coords:i}=t;for(let t=0;t1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:i.length/2},((t,e)=>e)).sort(((t,e)=>i[2*t]-i[2*e]||i[2*t+1]-i[2*e+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],s=[i[2*e],i[2*e+1],i[2*n],i[2*n+1]],l=1e-8*Math.hypot(s[3]-s[1],s[2]-s[0]);for(let t=0,e=i.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=s[0],h[s[0]]=1,2===s.length&&(h[s[1]]=0,this.triangles[1]=s[1],this.triangles[2]=s[1]))}voronoi(t){return new s(this,t)}*neighbors(t){const{inedges:e,hull:i,_hullIndex:n,halfedges:s,triangles:l,collinear:h}=this;if(h){const e=h.indexOf(t);return e>0&&(yield h[e-1]),void(e=0&&s!==i&&s!==n;)i=s;return s}_step(t,e,i){const{inedges:n,hull:s,_hullIndex:l,halfedges:r,triangles:o,points:a}=this;if(-1===n[t]||!a.length)return(t+1)%(a.length>>1);let c=t,u=h(e-a[2*t],2)+h(i-a[2*t+1],2);const g=n[t];let d=g;do{let n=o[d];const g=h(e-a[2*n],2)+h(i-a[2*n+1],2);if(g