import{Transform as h,ingest as S,tupleid as me,stableCompare as T}from"/-/vega-dataflow@v5.7.6-WDoszrJUyhTwz7sPwzda/dist=es2020,mode=imports,min/optimized/vega-dataflow.js";import{tickCount as C,tickFormat as ue,validTicks as ce,tickValues as he,SymbolLegend as O,labelFormat as ge,labelValues as pe,GradientLegend as ve,scaleFraction as Me,labelFraction as ye,scale as ke,isContinuous as F,Sequential as w,Linear as R,Time as Se,UTC as De,Pow as U,Sqrt as N,Ordinal as j,scaleImplicit as be,Log as xe,Symlog as ze,isLogarithmic as we,BinOrdinal as G,bandSpace as Ae,isInterpolating as X,interpolateRange as Ce,quantizeInterpolator as Oe,interpolateColors as Y,interpolate as Re,Band as Le,Point as V,scheme as Pe,Threshold as Ee,Quantile as Ie,Quantize as Te,Diverging as Fe}from"/-/vega-scale@v7.4.1-M0T9Gn9zHGGuV6XhZsTO/dist=es2020,mode=imports,min/optimized/vega-scale.js";import{inherits as y,isArray as A,error as x,falsy as D,isFunction as b,constant as Ue,peek as z,fastmap as $,one as q,toSet as Ne,isString as je,zoomLog as Ge,zoomPow as B,zoomSymlog as Xe,zoomLinear as Ye,stringValue as Ve}from"/-/vega-util@v1.17.2-LUfkDhormMyfWqy3Ts6U/dist=es2020,mode=imports,min/optimized/vega-util.js";import{sum as $e,range as H}from"/-/d3-array@v3.2.4-G4hy00bPnjF6FrSYpT32/dist=es2020,mode=imports,min/optimized/d3-array.js";import{interpolateRound as qe,interpolate as Be}from"/-/d3-interpolate@v3.0.1-i9AsUdFHwyaukRBWNe8d/dist=es2020,mode=imports,min/optimized/d3-interpolate.js";function W(e){h.call(this,null,e)}y(W,h,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),a=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,o=e.scale,l=e.count==null?e.values?e.values.length:10:e.count,r=C(o,l,e.minstep),s=e.format||ue(n,o,r,e.formatSpecifier,e.formatType,!!e.values),d=e.values?ce(o,e.values,r):he(o,r);return i&&(a.rem=i),i=d.map((f,m)=>S({index:m/(d.length-1||1),value:f,label:s(f)})),e.extra&&i.length&&i.push(S({index:-1,extra:{value:i[0].value},label:""})),a.source=i,a.add=i,this.value=i,a}});function Z(e){h.call(this,null,e)}function He(){return S({})}function We(e){const t=$().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}y(Z,h,{transform(e,t){var n=t.dataflow,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||He,o=e.key||me,l=this.value;return A(a.encode)&&(a.encode=null),l&&(e.modified("key")||t.modified(o))&&x("DataJoin does not support modified key function or fields."),l||(t=t.addAll(),this.value=l=We(o)),t.visit(t.ADD,r=>{const s=o(r);let d=l.get(s);d?d.exit?(l.empty--,a.add.push(d)):a.mod.push(d):(d=i(r),l.set(s,d),a.add.push(d)),d.datum=r,d.exit=!1}),t.visit(t.MOD,r=>{const s=o(r),d=l.get(s);d&&(d.datum=r,a.mod.push(d))}),t.visit(t.REM,r=>{const s=o(r),d=l.get(s);r===d.datum&&!d.exit&&(a.rem.push(d),d.exit=!0,++l.empty)}),t.changed(t.ADD_MOD)&&a.modifies("datum"),(t.clean()||e.clean&&l.empty>n.cleanThreshold)&&n.runAfter(l.clean),a}});function J(e){h.call(this,null,e)}y(J,h,{transform(e,t){var n=t.fork(t.ADD_REM),a=e.mod||!1,i=e.encoders,o=t.encode;if(A(o))if(n.changed()||o.every(m=>i[m]))o=o[0],n.encode=null;else return t.StopPropagation;var l=o==="enter",r=i.update||D,s=i.enter||D,d=i.exit||D,f=(o&&!l?i[o]:r)||D;if(t.changed(t.ADD)&&(t.visit(t.ADD,m=>{s(m,e),r(m,e)}),n.modifies(s.output),n.modifies(r.output),f!==D&&f!==r&&(t.visit(t.ADD,m=>{f(m,e)}),n.modifies(f.output))),t.changed(t.REM)&&d!==D&&(t.visit(t.REM,m=>{d(m,e)}),n.modifies(d.output)),l||f!==D){const m=t.MOD|(e.modified()?t.REFLOW:0);l?(t.visit(m,u=>{const g=s(u,e)||a;(f(u,e)||g)&&n.mod.push(u)}),n.mod.length&&n.modifies(s.output)):t.visit(m,u=>{(f(u,e)||a)&&n.mod.push(u)}),n.mod.length&&n.modifies(f.output)}return n.changed()?n:t.StopPropagation}});function K(e){h.call(this,[],e)}y(K,h,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),a=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,o=e.type||O,l=e.scale,r=+e.limit,s=C(l,e.count==null?5:e.count,e.minstep),d=!!e.values||o===O,f=e.format||ge(n,l,s,o,e.formatSpecifier,e.formatType,d),m=e.values||pe(l,s),u,g,c,M,k;return i&&(a.rem=i),o===O?(r&&m.length>r?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),i=m.slice(0,r-1),k=!0):i=m,b(c=e.size)?(!e.values&&l(i[0])===0&&(i=i.slice(1)),M=i.reduce((p,v)=>Math.max(p,c(v,e)),0)):c=Ue(M=c||8),i=i.map((p,v)=>S({index:v,label:f(p,v,i),value:p,offset:M,size:c(p,e)})),k&&(k=m[i.length],i.push(S({index:i.length,label:`\u2026${m.length-i.length} entries`,value:k,offset:M,size:c(k,e)})))):o===ve?(u=l.domain(),g=Me(l,u[0],z(u)),m.length<3&&!e.values&&u[0]!==z(u)&&(m=[u[0],z(u)]),i=m.map((p,v)=>S({index:v,label:f(p,v,m),value:p,perc:g(p)}))):(c=m.length-1,g=ye(l),i=m.map((p,v)=>S({index:v,label:f(p,v,m),value:p,perc:v?g(p):0,perc2:v===c?1:g(m[v+1])}))),a.source=i,a.add=i,this.value=i,a}});const Ze=e=>e.source.x,Je=e=>e.source.y,Ke=e=>e.target.x,Qe=e=>e.target.y;function L(e){h.call(this,{},e)}L.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},y(L,h,{transform(e,t){var n=e.sourceX||Ze,a=e.sourceY||Je,i=e.targetX||Ke,o=e.targetY||Qe,l=e.as||"path",r=e.orient||"vertical",s=e.shape||"line",d=te.get(s+"-"+r)||te.get(s);return d||x("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,f=>{f[l]=d(n(f),a(f),i(f),o(f))}),t.reflow(e.modified()).modifies(l)}});const Q=(e,t,n,a)=>"M"+e+","+t+"L"+n+","+a,_e=(e,t,n,a)=>Q(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),_=(e,t,n,a)=>{var i=n-e,o=a-t,l=Math.hypot(i,o)/2,r=180*Math.atan2(o,i)/Math.PI;return"M"+e+","+t+"A"+l+","+l+" "+r+" 0 1 "+n+","+a},et=(e,t,n,a)=>_(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),ee=(e,t,n,a)=>{const i=n-e,o=a-t,l=.2*(i+o),r=.2*(o-i);return"M"+e+","+t+"C"+(e+l)+","+(t+r)+" "+(n+r)+","+(a-l)+" "+n+","+a},tt=(e,t,n,a)=>ee(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),nt=(e,t,n,a)=>"M"+e+","+t+"V"+a+"H"+n,it=(e,t,n,a)=>"M"+e+","+t+"H"+n+"V"+a,at=(e,t,n,a)=>{const i=Math.cos(e),o=Math.sin(e),l=Math.cos(n),r=Math.sin(n),s=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*i+","+t*o+"A"+t+","+t+" 0 0,"+(s?1:0)+" "+t*l+","+t*r+"L"+a*l+","+a*r},ot=(e,t,n,a)=>{const i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+a+" "+n+","+a},rt=(e,t,n,a)=>{const i=(t+a)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+a},lt=(e,t,n,a)=>{const i=Math.cos(e),o=Math.sin(e),l=Math.cos(n),r=Math.sin(n),s=(t+a)/2;return"M"+t*i+","+t*o+"C"+s*i+","+s*o+" "+s*l+","+s*r+" "+a*l+","+a*r},te=$({line:Q,"line-radial":_e,arc:_,"arc-radial":et,curve:ee,"curve-radial":tt,"orthogonal-horizontal":nt,"orthogonal-vertical":it,"orthogonal-radial":at,"diagonal-horizontal":ot,"diagonal-vertical":rt,"diagonal-radial":lt});function P(e){h.call(this,null,e)}P.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},y(P,h,{transform(e,t){var n=e.as||["startAngle","endAngle"],a=n[0],i=n[1],o=e.field||q,l=e.startAngle||0,r=e.endAngle!=null?e.endAngle:2*Math.PI,s=t.source,d=s.map(o),f=d.length,m=l,u=(r-l)/$e(d),g=H(f),c,M,k;for(e.sort&&g.sort((p,v)=>d[p]-d[v]),c=0;c-1)return a;var i=t.domain,o=e.type,l=t.zero||t.zero===void 0&&dt(e),r,s;if(!i)return 0;if((l||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(r=(i=i.slice()).length-1||1,l&&(i[0]>0&&(i[0]=0),i[r]<0&&(i[r]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[r]=t.domainMax),t.domainMid!=null)){s=t.domainMid;const d=s>i[r]?r+1:si+(o<0?-1:o>0?1:0),0));a!==t.length&&n.warn("Log scale domain includes zero: "+Ve(t))}return t}function pt(e,t,n){let a=t.bins;if(a&&!A(a)){const i=e.domain(),o=i[0],l=z(i),r=a.step;let s=a.start==null?o:a.start,d=a.stop==null?l:a.stop;r||x("Scale bins parameter missing step property."),sl&&(d=r*Math.floor(l/r)),a=H(s,d+r/2,r)}return a?e.bins=a:e.bins&&delete e.bins,e.type===G&&(a?!t.domain&&!t.domainRaw&&(e.domain(a),n=a.length):e.bins=e.domain()),n}function vt(e,t,n){var a=e.type,i=t.round||!1,o=t.range;if(t.rangeStep!=null)o=Mt(a,t,n);else if(t.scheme&&(o=yt(a,t,n),b(o))){if(e.interpolator)return e.interpolator(o);x(`Scale type ${a} does not support interpolating color schemes.`)}if(o&&X(a))return e.interpolator(Y(E(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(Re(t.interpolate,t.interpolateGamma)):b(e.round)?e.round(i):b(e.rangeRound)&&e.interpolate(i?qe:Be),o&&e.range(E(o,t.reverse))}function Mt(e,t,n){e!==Le&&e!==V&&x("Only band and point scales support rangeStep.");var a=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,i=e===V?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Ae(n,i,a)]}function yt(e,t,n){var a=t.schemeExtent,i,o;return A(t.scheme)?o=Y(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),o=Pe(i),o||x(`Unrecognized scheme name: ${t.scheme}`)),n=e===Ee?n+1:e===G?n-1:e===Ie||e===Te?+t.schemeCount||st:n,X(e)?oe(o,a,t.reverse):b(o)?Oe(oe(o,a),n):e===j?o:o.slice(0,n)}function oe(e,t,n){return b(e)&&(t||n)?Ce(e,E(t||[0,1],n)):e}function E(e,t){return t?e.slice().reverse():e}function re(e){h.call(this,null,e)}y(re,h,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(T(e.sort)),this.modified(n),t}});const le="zero",se="center",de="normalize",fe=["y0","y1"];function I(e){h.call(this,null,e)}I.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:le,values:[le,se,de]},{name:"as",type:"string",array:!0,length:2,default:fe}]},y(I,h,{transform(e,t){var n=e.as||fe,a=n[0],i=n[1],o=T(e.sort),l=e.field||q,r=e.offset===se?kt:e.offset===de?St:Dt,s,d,f,m;for(s=bt(t.source,e.groupby,o,l),d=0,f=s.length,m=s.max;dM(f),l,r,s,d,f,m,u,g,c;if(t==null)i.push(e.slice());else for(l={},r=0,s=e.length;rc&&(c=g),n&&u.sort(n)}return i.max=c,i}export{W as axisticks,Z as datajoin,J as encode,K as legendentries,L as linkpath,P as pie,ie as scale,re as sortitems,I as stack};export default null;