import{Transform as x,rederive as de,ingest as $,replace as ce}from"/-/vega-dataflow@v5.7.6-WDoszrJUyhTwz7sPwzda/dist=es2020,mode=imports,min/optimized/vega-dataflow.js";import{inherits as S,identity as F,isArray as Z,isFunction as j,isNumber as _,accessorName as he,accessorFields as A,field as pe,extend as ye,constant as N,toSet as ge,array as L,error as G,extent as ve,zero as xe,one as ze}from"/-/vega-util@v1.17.2-LUfkDhormMyfWqy3Ts6U/dist=es2020,mode=imports,min/optimized/vega-util.js";import{max as I,range as Ee,tickStep as De,sum as we}from"/-/d3-array@v3.2.4-G4hy00bPnjF6FrSYpT32/dist=es2020,mode=imports,min/optimized/d3-array.js";import{bandwidthNRD as Se}from"/-/vega-statistics@v1.9.0-Qw8CjSQVQOg2M6VMgsme/dist=es2020,mode=imports,min/optimized/vega-statistics.js";import{getProjectionPath as ee,projectionProperties as te,projection as be}from"/-/vega-projection@v1.6.1-zBdxeV9K67u1hPOXPxMf/dist=es2020,mode=imports,min/optimized/vega-projection.js";import{geoGraticule as Me}from"/-/d3-geo@v3.1.1-IFH102ROpDQE4rIMzW42/dist=es2020,mode=imports,min/optimized/d3-geo.js";import{rgb as ne}from"/-/d3-color@v3.1.0-MWHDMwd2Pvp3NFjvrHgn/dist=es2020,mode=imports,min/optimized/d3-color.js";import{canvas as Oe}from"/-/vega-canvas@v1.2.7-hCEcvULuKIOqBVGX1Tn8/dist=es2020,mode=imports,min/optimized/vega-canvas.js";function je(){}const O=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function re(){var e=1,t=1,n=o;function i(r,m){return m.map(f=>a(r,f))}function a(r,m){var f=[],l=[];return s(r,m,d=>{n(d,r,m),Re(d)>0?f.push([d]):l.push(d)}),l.forEach(d=>{for(var g=0,h=f.length,y;g=m,O[c<<1].forEach(D);++g=m,O[y|c<<1].forEach(D);for(O[c<<0].forEach(D);++h=m,p=r[h*e]>=m,O[c<<1|p<<2].forEach(D);++g=m,E=p,p=r[h*e+g+1]>=m,O[y|c<<1|p<<2|E<<3].forEach(D);O[c|p<<3].forEach(D)}for(g=-1,p=r[h*e]>=m,O[p<<2].forEach(D);++g=m,O[p<<2|E<<3].forEach(D);O[p<<3].forEach(D);function D(z){var b=[z[0][0]+g,z[0][1]+h],M=[z[1][0]+g,z[1][1]+h],C=u(b),U=u(M),v,w;(v=d[C])?(w=l[U])?(delete d[v.end],delete l[w.start],v===w?(v.ring.push(M),f(v.ring)):l[v.start]=d[w.end]={start:v.start,end:w.end,ring:v.ring.concat(w.ring)}):(delete d[v.end],v.ring.push(M),d[v.end=U]=v):(v=l[U])?(w=d[C])?(delete l[v.start],delete d[w.end],v===w?(v.ring.push(M),f(v.ring)):l[w.start]=d[v.end]={start:w.start,end:v.end,ring:w.ring.concat(v.ring)}):(delete l[v.start],v.ring.unshift(b),l[v.start=C]=v):l[C]=d[U]={start:C,end:U,ring:[b,M]}}}function u(r){return r[0]*2+r[1]*(e+1)*4}function o(r,m,f){r.forEach(l=>{var d=l[0],g=l[1],h=d|0,y=g|0,c,p=m[y*e+h];d>0&&d0&&g=0&&f>=0||G("invalid size"),e=m,t=f,i},i.smooth=function(r){return arguments.length?(n=r?o:je,i):n===o},i}function Re(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++ti!==g>i&&n<(d-m)*(i-f)/(g-f)+m&&(a=-a)}return a}function Ue(e,t,n){var i;return Fe(e,t,n)&&Ne(e[i=+(e[0]===t[0])],n[i],t[i])}function Fe(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Ne(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function ie(e,t,n){return function(i){var a=ve(i),s=n?Math.min(a[0],0):a[0],u=a[1],o=u-s,r=t?De(s,u,e):o/(e+1);return Ee(s+r,u,r)}}function k(e){x.call(this,null,e)}k.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},S(k,x,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,a=e.field||F,s=re().smooth(e.smooth!==!1),u=e.thresholds||Ge(i,a,e),o=e.as===null?null:e.as||"contour",r=[];return i.forEach(m=>{const f=a(m),l=s.size([f.width,f.height])(f.values,Z(u)?u:u(f.values));$e(l,f,m,e),l.forEach(d=>{r.push(de(m,$(o!=null?{[o]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=r,n}});function Ge(e,t,n){const i=ie(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?i:i(e.map(a=>I(t(a).values)))}function $e(e,t,n,i){let a=i.scale||t.scale,s=i.translate||t.translate;if(j(a)&&(a=a(n,i)),j(s)&&(s=s(n,i)),(a===1||a==null)&&!s)return;const u=(_(a)?a:a[0])||1,o=(_(a)?a:a[1])||1,r=s&&s[0]||0,m=s&&s[1]||0;e.forEach(ae(t,u,o,r,m))}function ae(e,t,n,i,a){const s=e.x1||0,u=e.y1||0,o=t*n<0;function r(l){l.forEach(m)}function m(l){o&&l.reverse(),l.forEach(f)}function f(l){l[0]=(l[0]-s)*t+i,l[1]=(l[1]-u)*n+a}return function(l){return l.coordinates.forEach(r),l}}function oe(e,t,n){const i=e>=0?e:Se(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function q(e){return j(e)?e:N(+e)}function se(){var e=r=>r[0],t=r=>r[1],n=ze,i=[-1,-1],a=960,s=500,u=2;function o(r,m){const f=oe(i[0],r,e)>>u,l=oe(i[1],r,t)>>u,d=f?f+2:0,g=l?l+2:0,h=2*d+(a>>u),y=2*g+(s>>u),c=new Float32Array(h*y),p=new Float32Array(h*y);let E=c;r.forEach(z=>{const b=d+(+e(z)>>u),M=g+(+t(z)>>u);b>=0&&b=0&&M0&&l>0?(R(h,y,c,p,f),P(h,y,p,c,l),R(h,y,c,p,f),P(h,y,p,c,l),R(h,y,c,p,f),P(h,y,p,c,l)):f>0?(R(h,y,c,p,f),R(h,y,p,c,f),R(h,y,c,p,f),E=p):l>0&&(P(h,y,c,p,l),P(h,y,p,c,l),P(h,y,c,p,l),E=p);const D=m?Math.pow(2,-2*u):1/we(E);for(let z=0,b=h*y;z>u),y2:g+(s>>u)}}return o.x=function(r){return arguments.length?(e=q(r),o):e},o.y=function(r){return arguments.length?(t=q(r),o):t},o.weight=function(r){return arguments.length?(n=q(r),o):n},o.size=function(r){if(!arguments.length)return[a,s];var m=+r[0],f=+r[1];return m>=0&&f>=0||G("invalid size"),a=m,s=f,o},o.cellSize=function(r){return arguments.length?((r=+r)>=1||G("invalid cell size"),u=Math.floor(Math.log(r)/Math.LN2),o):1<=a&&(o>=s&&(r-=n[o-s+u*e]),i[o-a+u*e]=r/Math.min(o+1,e-1+s-o,s))}function P(e,t,n,i,a){const s=(a<<1)+1;for(let u=0;u=a&&(o>=s&&(r-=n[u+(o-s)*e]),i[u+(o-a)*e]=r/Math.min(o+1,t-1+s-o,s))}function T(e){x.call(this,null,e)}T.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const Ae=["x","y","weight","size","cellSize","bandwidth"];function ue(e,t){return Ae.forEach(n=>t[n]!=null?e[n](t[n]):0),e}S(T,x,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,a=Ie(i,e.groupby),s=(e.groupby||[]).map(he),u=ue(se(),e),o=e.as||"grid",r=[];function m(f,l){for(let d=0;d$(m({[o]:u(f,e.counts)},f.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=r,n}});function Ie(e,t){var n=[],i=f=>f(o),a,s,u,o,r,m;if(t==null)n.push(e);else for(a={},s=0,u=e.length;sn.push(o(f))),s&&u&&(t.visit(r,f=>{var l=s(f),d=u(f);l!=null&&d!=null&&(l=+l)===l&&(d=+d)===d&&i.push([l,d])}),n=n.concat({type:H,geometry:{type:Le,coordinates:i}})),this.value={type:J,features:n}}});function Q(e){x.call(this,null,e)}Q.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},S(Q,x,{transform(e,t){var n=t.fork(t.ALL),i=this.value,a=e.field||F,s=e.as||"path",u=n.SOURCE;!i||e.modified()?(this.value=i=ee(e.projection),n.materialize().reflow()):u=a===F||t.modified(a.fields)?n.ADD_MOD:n.ADD;const o=ke(i,e.pointRadius);return n.visit(u,r=>r[s]=i(a(r))),i.pointRadius(o),n.modifies(s)}});function ke(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function V(e){x.call(this,null,e)}V.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},S(V,x,{transform(e,t){var n=e.projection,i=e.fields[0],a=e.fields[1],s=e.as||["x","y"],u=s[0],o=s[1],r;function m(f){const l=n([i(f),a(f)]);l?(f[u]=l[0],f[o]=l[1]):(f[u]=void 0,f[o]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,m):(r=t.modified(i.fields)||t.modified(a.fields),t.visit(r?t.ADD_MOD:t.ADD,m)),t.modifies(s)}});function W(e){x.call(this,null,e)}W.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},S(W,x,{transform(e,t){var n=t.fork(t.ALL),i=this.value,a=e.as||"shape",s=n.ADD;return(!i||e.modified())&&(this.value=i=qe(ee(e.projection),e.field||pe("datum"),e.pointRadius),n.materialize().reflow(),s=n.SOURCE),n.visit(s,u=>u[a]=i),n.modifies(a)}});function qe(e,t,n){const i=n==null?a=>e(t(a)):a=>{var s=e.pointRadius(),u=e.pointRadius(n)(t(a));return e.pointRadius(s),u};return i.context=a=>(e.context(a),i),i}function X(e){x.call(this,[],e),this.generator=Me()}X.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},S(X,x,{transform(e,t){var n=this.value,i=this.generator,a;if(!n.length||e.modified())for(const s in e)j(i[s])&&i[s](e[s]);return a=i(),n.length?t.mod.push(ce(n[0],a)):t.add.push($(a)),n[0]=a,t}});function Y(e){x.call(this,null,e)}Y.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},S(Y,x,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i=e.resolve==="shared",a=e.field||F,s=Be(e.opacity,e),u=Te(e.color,e),o=e.as||"image",r={$x:0,$y:0,$value:0,$max:i?I(n.map(m=>I(a(m).values))):0};return n.forEach(m=>{const f=a(m),l=ye({},m,r);i||(l.$max=I(f.values||[])),m[o]=He(f,l,u.dep?u:N(u(l)),s.dep?s:N(s(l)))}),t.reflow(!0).modifies(o)}});function Te(e,t){let n;return j(e)?(n=i=>ne(e(i,t)),n.dep=fe(e)):n=N(ne(e||"#888")),n}function Be(e,t){let n;return j(e)?(n=i=>e(i,t),n.dep=fe(e)):e?n=N(e):(n=i=>i.$value/i.$max||0,n.dep=!0),n}function fe(e){if(!j(e))return!1;const t=ge(A(e));return t.$x||t.$y||t.$value||t.$max}function He(e,t,n,i){const a=e.width,s=e.height,u=e.x1||0,o=e.y1||0,r=e.x2||a,m=e.y2||s,f=e.values,l=f?c=>f[c]:xe,d=Oe(r-u,m-o),g=d.getContext("2d"),h=g.getImageData(0,0,r-u,m-o),y=h.data;for(let c=o,p=0;c{e[i]!=null&&me(n,i,e[i])})):te.forEach(i=>{e.modified(i)&&me(n,i,e[i])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&Je(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function Je(e,t){const n=Qe(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function Ke(e){const t=be((e||"mercator").toLowerCase());return t||G("Unrecognized projection type: "+e),t()}function me(e,t,n){j(e[t])&&e[t](n)}function Qe(e){return e=L(e),e.length===1?e[0]:{type:J,features:e.reduce((t,n)=>t.concat(Ve(n)),[])}}function Ve(e){return e.type===J?e.features:L(e).filter(t=>t!=null).map(t=>t.type===H?t:{type:H,geometry:t})}export{B as contour,K as geojson,Q as geopath,V as geopoint,W as geoshape,X as graticule,Y as heatmap,k as isocontour,T as kde2d,le as projection};export default null;