/*! For license information please see 1326.bundle.js.LICENSE.txt */ (self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[1326],{72759:e=>{"use strict";var t=/("(?:[^\\"]|\\.)*")|[:,]/g;e.exports=function(e,n){var i,r,o;return n=n||{},i=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===i?1/0:void 0===n.maxLength?80:n.maxLength,o=n.replacer,function e(n,a,s){var l,u,c,f,d,h,p,m,g,y,v,b;if(n&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===(v=JSON.stringify(n,o)))return v;if(p=r-a.length-s,v.length<=p&&(g=v.replace(t,(function(e,t){return t||e+" "}))).length<=p)return g;if(null!=o&&(n=JSON.parse(v),o=void 0),"object"==typeof n&&null!==n){if(m=a+i,c=[],u=0,Array.isArray(n))for(y="[",l="]",p=n.length;u0)return[y,i+c.join(",\n"+m),l].join("\n"+a)}return v}(e,"",0)}},27061:e=>{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],u=!1,c=-1;function f(){u&&s&&(u=!1,s.length?l=s.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=a(f);u=!0;for(var t=l.length;t;){for(s=l,l=[];++c1)for(var n=1;n{"use strict";n.r(t),n.d(t,{DEFAULT_ACTIONS:()=>GY,default:()=>tJ,guessMode:()=>KY,vega:()=>UY,vegaLite:()=>qY,version:()=>jY});var i={};n.r(i),n.d(i,{JsonPatchError:()=>M,_areEquals:()=>j,applyOperation:()=>R,applyPatch:()=>P,applyReducer:()=>L,deepClone:()=>O,getValueByPointer:()=>T,validate:()=>I,validator:()=>B});var r={};n.r(r),n.d(r,{compare:()=>X,generate:()=>V,observe:()=>H,unobserve:()=>G});var o={};n.r(o),n.d(o,{aggregate:()=>ba,bin:()=>xa,collect:()=>_a,compare:()=>ka,countpattern:()=>Aa,cross:()=>$a,density:()=>Fa,dotbin:()=>Ta,expression:()=>Ra,extent:()=>La,facet:()=>Ia,field:()=>ja,filter:()=>qa,flatten:()=>Wa,fold:()=>Ga,formula:()=>Ha,generate:()=>Va,impute:()=>Ya,joinaggregate:()=>Ja,kde:()=>Qa,key:()=>Ka,load:()=>ts,lookup:()=>is,multiextent:()=>rs,multivalues:()=>as,params:()=>ls,pivot:()=>us,prefacet:()=>cs,project:()=>fs,proxy:()=>ds,quantile:()=>hs,relay:()=>ps,sample:()=>ms,sequence:()=>gs,sieve:()=>ys,subflow:()=>Ba,timeunit:()=>vs,tupleindex:()=>xs,values:()=>ws,window:()=>$s});var a={};n.r(a),n.d(a,{bound:()=>pm,identifier:()=>ym,mark:()=>vm,overlap:()=>bm,render:()=>$m,viewlayout:()=>Vm});var s={};n.r(s),n.d(s,{axisticks:()=>Xm,datajoin:()=>Ym,encode:()=>Qm,legendentries:()=>Km,linkpath:()=>rg,pie:()=>ug,scale:()=>dg,sortitems:()=>gg,stack:()=>wg});var l={};n.r(l),n.d(l,{contour:()=>rx,geojson:()=>sx,geopath:()=>lx,geopoint:()=>ux,geoshape:()=>cx,graticule:()=>fx,heatmap:()=>dx,isocontour:()=>Zb,kde2d:()=>tx,projection:()=>px});var u={};n.r(u),n.d(u,{force:()=>jx});var c={};n.r(c),n.d(c,{nest:()=>Gw,pack:()=>Jw,partition:()=>Kw,stratify:()=>e_,tree:()=>i_,treelinks:()=>r_,treemap:()=>s_});var f={};n.r(f),n.d(f,{label:()=>C_});var d={};n.r(d),n.d(d,{loess:()=>M_,regression:()=>N_});var h={};n.r(h),n.d(h,{voronoi:()=>uk});var p={};n.r(p),n.d(p,{wordcloud:()=>Ek});var m={};n.r(m),n.d(m,{crossfilter:()=>Mk,resolvefilter:()=>Ok});var g={};n.r(g),n.d(g,{Bounds:()=>ef,CanvasHandler:()=>Oh,CanvasRenderer:()=>Ph,DATE:()=>yn,DAY:()=>vn,DAYOFYEAR:()=>bn,Dataflow:()=>qr,Debug:()=>ve,Error:()=>me,EventStream:()=>Cr,Gradient:()=>rc,GroupItem:()=>nf,HOURS:()=>xn,Handler:()=>ph,Info:()=>ye,Item:()=>tf,MILLISECONDS:()=>kn,MINUTES:()=>wn,MONTH:()=>mn,Marks:()=>Qd,MultiPulse:()=>Br,None:()=>pe,Operator:()=>$r,Parameters:()=>kr,Pulse:()=>Tr,QUARTER:()=>pn,RenderType:()=>Sp,Renderer:()=>gh,ResourceLoader:()=>rf,SECONDS:()=>_n,SVGHandler:()=>Bh,SVGRenderer:()=>fp,SVGStringRenderer:()=>Ap,Scenegraph:()=>ah,TIME_UNITS:()=>En,Transform:()=>Gr,View:()=>yS,WEEK:()=>gn,Warn:()=>ge,YEAR:()=>hn,accessor:()=>Q,accessorFields:()=>ee,accessorName:()=>K,array:()=>Ge,ascending:()=>Ye,bandwidthNRD:()=>lo,bin:()=>uo,bootstrapCI:()=>ho,boundClip:()=>Rp,boundContext:()=>Af,boundItem:()=>Kd,boundMark:()=>th,boundStroke:()=>sf,changeset:()=>wr,clampRange:()=>He,codegenExpression:()=>cA,compare:()=>Xe,constant:()=>et,cumulativeLogNormal:()=>So,cumulativeNormal:()=>_o,cumulativeUniform:()=>zo,dayofyear:()=>Mn,debounce:()=>tt,defaultLocale:()=>Ni,definition:()=>Vr,densityLogNormal:()=>Do,densityNormal:()=>wo,densityUniform:()=>No,domChild:()=>ch,domClear:()=>fh,domCreate:()=>lh,domFind:()=>uh,dotbin:()=>po,error:()=>re,expressionFunction:()=>gD,extend:()=>nt,extent:()=>it,extentIndex:()=>rt,falsy:()=>de,fastmap:()=>lt,field:()=>ae,flush:()=>ut,font:()=>Wd,fontFamily:()=>qd,fontSize:()=>Ld,format:()=>ir,formatLocale:()=>Ai,formats:()=>rr,hasOwnProperty:()=>at,id:()=>se,identity:()=>le,inferType:()=>Yi,inferTypes:()=>Ji,ingest:()=>mr,inherits:()=>ct,inrange:()=>ft,interpolate:()=>Du,interpolateColors:()=>Eu,interpolateRange:()=>ku,intersect:()=>Mp,intersectBoxLine:()=>Rf,intersectPath:()=>Of,intersectPoint:()=>Nf,intersectRule:()=>Tf,isArray:()=>xe,isBoolean:()=>dt,isDate:()=>ht,isFunction:()=>Ve,isIterable:()=>pt,isNumber:()=>mt,isObject:()=>we,isRegExp:()=>gt,isString:()=>yt,isTuple:()=>dr,key:()=>vt,lerp:()=>bt,lineHeight:()=>Bd,loader:()=>sr,locale:()=>Oi,logger:()=>be,lruCache:()=>wt,markup:()=>ip,merge:()=>_t,mergeConfig:()=>ke,multiLineOffset:()=>jd,one:()=>ce,pad:()=>Et,panLinear:()=>ze,panLog:()=>Te,panPow:()=>Re,panSymlog:()=>Pe,parse:()=>HO,parseExpression:()=>sA,parseSelector:()=>TS,path:()=>el.ET,pathCurves:()=>ac,pathEqual:()=>Bp,pathParse:()=>dc,pathRectangle:()=>Rc,pathRender:()=>kc,pathSymbols:()=>Dc,pathTrail:()=>Pc,peek:()=>$e,point:()=>hh,projection:()=>Tb,quantileLogNormal:()=>Co,quantileNormal:()=>ko,quantileUniform:()=>To,quantiles:()=>ao,quantizeInterpolator:()=>Au,quarter:()=>qe,quartiles:()=>so,random:()=>co,randomInteger:()=>go,randomKDE:()=>Ao,randomLCG:()=>mo,randomLogNormal:()=>Fo,randomMixture:()=>Mo,randomNormal:()=>Eo,randomUniform:()=>Ro,read:()=>ar,regressionConstant:()=>Po,regressionExp:()=>Wo,regressionLinear:()=>Uo,regressionLoess:()=>Jo,regressionLog:()=>qo,regressionPoly:()=>Vo,regressionPow:()=>Go,regressionQuad:()=>Ho,renderModule:()=>Fp,repeat:()=>kt,resetDefaultLocale:()=>zi,resetSVGClipId:()=>Qc,resetSVGDefIds:()=>Ip,responseType:()=>or,runtimeContext:()=>$D,sampleCurve:()=>ta,sampleLogNormal:()=>$o,sampleNormal:()=>xo,sampleUniform:()=>Oo,scale:()=>hu,sceneEqual:()=>Lp,sceneFromJSON:()=>rh,scenePickVisit:()=>Vf,sceneToJSON:()=>ih,sceneVisit:()=>Hf,sceneZOrder:()=>Gf,scheme:()=>Mu,serializeXML:()=>rp,setRandom:()=>fo,span:()=>At,splitAccessPath:()=>oe,stringValue:()=>$t,textMetrics:()=>Od,timeBin:()=>gi,timeFloor:()=>Vn,timeFormatLocale:()=>Fi,timeInterval:()=>Kn,timeOffset:()=>ni,timeSequence:()=>oi,timeUnitSpecifier:()=>Sn,timeUnits:()=>$n,toBoolean:()=>Dt,toDate:()=>Ct,toNumber:()=>De,toSet:()=>Mt,toString:()=>Ft,transform:()=>Zr,transforms:()=>Hr,truncate:()=>Ot,truthy:()=>fe,tupleid:()=>hr,typeParsers:()=>Vi,utcFloor:()=>Yn,utcInterval:()=>ei,utcOffset:()=>ii,utcSequence:()=>ai,utcdayofyear:()=>Pn,utcquarter:()=>We,utcweek:()=>Ln,version:()=>VO,visitArray:()=>Nt,week:()=>On,writeConfig:()=>Ee,zero:()=>ue,zoomLinear:()=>Be,zoomLog:()=>Ie,zoomPow:()=>je,zoomSymlog:()=>Ue});var y={};n.r(y),n.d(y,{accessPathDepth:()=>UN,accessPathWithDatum:()=>RN,compile:()=>fZ,contains:()=>gN,deepEqual:()=>QN,deleteNestedProperty:()=>zN,duplicate:()=>cN,entries:()=>FN,every:()=>vN,fieldIntersection:()=>$N,flatAccessWithDatum:()=>PN,getFirstDefined:()=>qN,hasIntersection:()=>EN,hash:()=>pN,internalField:()=>VN,isBoolean:()=>MN,isEmpty:()=>DN,isEqual:()=>_N,isInternalField:()=>ZN,isNullOrFalse:()=>mN,isNumeric:()=>YN,keys:()=>SN,logicalExpr:()=>NN,mergeDeep:()=>bN,never:()=>fN,normalize:()=>jU,normalizeAngle:()=>XN,omit:()=>hN,pick:()=>dN,prefixGenerator:()=>AN,removePathFromField:()=>jN,replaceAll:()=>IN,replacePathInField:()=>BN,resetIdCounter:()=>HN,setEqual:()=>kN,some:()=>yN,stringify:()=>KN,titleCase:()=>TN,unique:()=>wN,uniqueId:()=>GN,vals:()=>CN,varName:()=>ON,version:()=>dZ});var v={};n.r(v),n.d(v,{carbong10:()=>fX,carbong100:()=>hX,carbong90:()=>dX,carbonwhite:()=>cX,dark:()=>gZ,excel:()=>vZ,fivethirtyeight:()=>kZ,ggplot2:()=>AZ,googlecharts:()=>HZ,latimes:()=>MZ,powerbi:()=>oX,quartz:()=>zZ,urbaninstitute:()=>UZ,version:()=>pX,vox:()=>RZ});var b,x=(b=function(e,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},b(e,t)},function(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),w=Object.prototype.hasOwnProperty;function _(e,t){return w.call(e,t)}function k(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0}function $(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function D(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function S(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t0&&"constructor"==s[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===f&&(void 0===l[d]?f=s.slice(0,u).join("/"):u==c-1&&(f=t.path),void 0!==f&&h(t,0,e,f)),u++,Array.isArray(l)){if("-"===d)d=l.length;else{if(n&&!A(d))throw new M("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);A(d)&&(d=~~d)}if(u>=c){if(n&&"add"===t.op&&d>l.length)throw new M("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=z[t.op].call(t,l,d,e)).test)throw new M("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=N[t.op].call(t,l,d,e)).test)throw new M("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u0)throw new M('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new M("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new M("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&S(e.value))throw new M("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new M("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new M("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=I([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new M("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function I(e,t,n){try{if(!Array.isArray(e))throw new M("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)P(E(t),E(e),n||!0);else{n=n||B;for(var i=0;i0&&(e.patches=[],e.callback&&e.callback(i)),i}function Z(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=k(t),a=k(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!_(t,f)||void 0===t[f]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+$(f),value:E(u)}),n.push({op:"remove",path:i+"/"+$(f)}),s=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}));else{var c=t[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?Z(u,c,n,i+"/"+$(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+$(f),value:E(u)}),n.push({op:"replace",path:i+"/"+$(f),value:E(c)}))}}if(s||o.length!=a.length)for(l=0;lfunction(t){return t[e]},ie=e=>{const t=e.length;return function(n){for(let i=0;ii&&u(),s=i=r+1):"]"===o&&(s||re("Access path missing open bracket: "+e),s>0&&u(),s=0,i=r+1):r>i?u():i=r+1}return s&&re("Access path missing closing bracket: "+e),a&&re("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function ae(e,t,n){const i=oe(e);return e=1===i.length?i[0]:e,Q((n&&n.get||te)(i),[e],t||e)}const se=ae("id"),le=Q((e=>e),[],"identity"),ue=Q((()=>0),[],"zero"),ce=Q((()=>1),[],"one"),fe=Q((()=>!0),[],"true"),de=Q((()=>!1),[],"false");function he(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const pe=0,me=1,ge=2,ye=3,ve=4;function be(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he,i=e||pe;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=me&&n(t||"error","ERROR",arguments),this},warn(){return i>=ge&&n(t||"warn","WARN",arguments),this},info(){return i>=ye&&n(t||"log","INFO",arguments),this},debug(){return i>=ve&&n(t||"log","DEBUG",arguments),this}}}var xe=Array.isArray;function we(e){return e===Object(e)}const _e=e=>"__proto__"!==e;function ke(){for(var e=arguments.length,t=new Array(e),n=0;n{for(const n in t)if("signals"===n)e.signals=Ae(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;Ee(e,n,t[n],i)}return e}),{})}function Ee(e,t,n,i){if(!_e(t))return;let r,o;if(we(n)&&!xe(n))for(r in o=we(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?Ee(o,r,n[r]):_e(r)&&(o[r]=n[r]);else e[t]=n}function Ae(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function $e(e){return e[e.length-1]}function De(e){return null==e||""===e?null:+e}const Se=e=>t=>e*Math.exp(t),Ce=e=>t=>Math.log(e*t),Fe=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Me=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Oe=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function Ne(e,t,n,i){const r=n(e[0]),o=n($e(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function ze(e,t){return Ne(e,t,De,le)}function Te(e,t){var n=Math.sign(e[0]);return Ne(e,t,Ce(n),Se(n))}function Re(e,t,n){return Ne(e,t,Oe(n),Oe(1/n))}function Pe(e,t,n){return Ne(e,t,Fe(n),Me(n))}function Le(e,t,n,i,r){const o=i(e[0]),a=i($e(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}function Be(e,t,n){return Le(e,t,n,De,le)}function Ie(e,t,n){const i=Math.sign(e[0]);return Le(e,t,n,Ce(i),Se(i))}function je(e,t,n,i){return Le(e,t,n,Oe(i),Oe(1/i))}function Ue(e,t,n,i){return Le(e,t,n,Fe(i),Me(i))}function qe(e){return 1+~~(new Date(e).getMonth()/3)}function We(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ge(e){return null!=e?xe(e)?e:[e]:[]}function He(e,t,n){let i,r=e[0],o=e[1];return o=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]}function Ve(e){return"function"==typeof e}const Ze="descending";function Xe(e,t,n){n=n||{},t=Ge(t)||[];const i=[],r=[],o={},a=n.comparator||Je;return Ge(e).forEach(((e,a)=>{null!=e&&(i.push(t[a]===Ze?-1:1),r.push(e=Ve(e)?e:ae(e,null,n)),(ee(e)||[]).forEach((e=>o[e]=1)))})),0===r.length?null:Q(a(r,i),Object.keys(o))}const Ye=(e,t)=>(et||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),Je=(e,t)=>1===e.length?Qe(e[0],t[0]):Ke(e,t,e.length),Qe=(e,t)=>function(n,i){return Ye(e(n),e(i))*t},Ke=(e,t,n)=>(t.push(0),function(i,r){let o,a=0,s=-1;for(;0===a&&++se}function tt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout((()=>(t(i),n=null)),e)}}function nt(e){for(let t,n,i=1,r=arguments.length;io&&(o=i))}else{for(i=t(e[a]);ao&&(o=i))}return[r,o]}function rt(e,t){const n=e.length;let i,r,o,a,s,l=-1;if(null==t){for(;++l=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++lr&&(i=r,a=l),o=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++lr&&(i=r,a=l),oi(e)?n[e]:void 0,set(e,t){return i(e)||(++r.size,n[e]===st&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=st),this},clear(){r.size=r.empty=0,r.object=n={}},test(e){return arguments.length?(t=e,r):t},clean(){const e={};let i=0;for(const r in n){const o=n[r];o===st||t&&t(o)||(e[r]=o,++i)}r.size=i,r.empty=0,r.object=n=e}};return e&&Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}function ut(e,t,n,i,r,o){if(!n&&0!==n)return o;const a=+n;let s,l=e[0],u=$e(e);ua&&(r=o,o=a,a=r),i=void 0===i||i,((n=void 0===n||n)?o<=e:oe.replace(/\\(.)/g,"$1"))):Ge(e));const i=e&&e.length,r=n&&n.get||te,o=e=>r(t?[e]:oe(e));let a;if(i)if(1===i){const t=o(e[0]);a=function(e){return""+t(e)}}else{const t=e.map(o);a=function(e){let n=""+t[0](e),r=0;for(;++r{t={},n={},i=0},o=(r,o)=>(++i>e&&(n=t,t={},i=1),t[r]=o);return r(),{clear:r,has:e=>at(t,e)||at(n,e),get:e=>at(t,e)?t[e]:at(n,e)?o(e,n[e]):void 0,set:(e,n)=>at(t,e)?t[e]=n:o(e,n)}}function _t(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const a=i||new t.constructor(r+o);let s=0,l=0,u=0;for(;s0?n[l++]:t[s++];for(;s=0;)n+=e;return n}function Et(e,t,n,i){const r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?kt(r,a)+o:"center"===i?kt(r,~~(a/2))+o+kt(r,Math.ceil(a/2)):o+kt(r,a)}function At(e){return e&&$e(e)-e[0]||0}function $t(e){return xe(e)?"["+e.map($t)+"]":we(e)||yt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function Dt(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)}const St=e=>mt(e)||ht(e)?e:Date.parse(e);function Ct(e,t){return t=t||St,null==e||""===e?null:t(e)}function Ft(e){return null==e||""===e?null:e+""}function Mt(e){const t={},n=e.length;for(let i=0;i=o?l=!0:(i=e.charCodeAt(a++))===Pt?u=!0:i===Lt&&(u=!0,e.charCodeAt(a)===Pt&&++a),e.slice(r+1,t-1).replace(/""/g,'"')}for(;a9999?"+"+jt(e,6):jt(e,4)}(n.getUTCFullYear())+"-"+jt(n.getUTCMonth()+1,2)+"-"+jt(n.getUTCDate(),2)+(a?"T"+jt(i,2)+":"+jt(r,2)+":"+jt(o,2)+"."+jt(a,3)+"Z":o?"T"+jt(i,2)+":"+jt(r,2)+":"+jt(o,2)+"Z":r||i?"T"+jt(i,2)+":"+jt(r,2)+"Z":"")):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e;var n,i,r,o,a}return{parse:function(e,t){var n,r,o=i(e,(function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=Bt(e);return function(i,r){return t(n(i),r,e)}}(e,t):Bt(e)}));return o.columns=r||[],o},parseRows:i,format:function(t,n){return null==n&&(n=It(t)),[n.map(a).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=It(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(o).join("\n")},formatRow:o,formatValue:a}}function qt(e){return e}function Wt(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return Gt(e,t)}))}:Gt(e,t)}function Gt(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,o=Ht(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:o}:null==i?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function Ht(e,t){var n=function(e){if(null==e)return qt;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,u=e.length,c=new Array(u);for(c[0]=(t+=e[0])*i+o,c[1]=(n+=e[1])*r+a;l1)i=function(e,t,n){var i,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:i})}function s(e){e.forEach(a)}function l(e){e.forEach(s)}return function e(t){switch(i=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),o.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}(0,t,n);else for(r=0,i=new Array(o=e.arcs.length);r(e[t]=1+n,e)),{});function $n(e){const t=Ge(e).slice(),n={};return t.length||re("Missing time unit."),t.forEach((e=>{at(An,e)?n[e]=1:re(`Invalid time unit: ${e}.`)})),(n[gn]||n[vn]?1:0)+(n[pn]||n[mn]||n[yn]?1:0)+(n[bn]?1:0)>1&&re(`Incompatible time units: ${e}`),t.sort(((e,t)=>An[e]-An[t])),t}const Dn={[hn]:"%Y ",[pn]:"Q%q ",[mn]:"%b ",[yn]:"%d ",[gn]:"W%U ",[vn]:"%a ",[bn]:"%j ",[xn]:"%H:00",[wn]:"00:%M",[_n]:":%S",[kn]:".%L",[`${hn}-${mn}`]:"%Y-%m ",[`${hn}-${mn}-${yn}`]:"%Y-%m-%d ",[`${xn}-${wn}`]:"%H:%M"};function Sn(e,t){const n=nt({},Dn,t),i=$n(e),r=i.length;let o,a,s="",l=0;for(l=0;ll;--o)if(a=i.slice(l,o).join("-"),null!=n[a]){s+=n[a],l=o;break}return s.trim()}const Cn=new Date;function Fn(e){return Cn.setFullYear(e),Cn.setMonth(0),Cn.setDate(1),Cn.setHours(0,0,0,0),Cn}function Mn(e){return Nn(new Date(e))}function On(e){return zn(new Date(e))}function Nn(e){return rn.rr.count(Fn(e.getFullYear())-1,e)}function zn(e){return on.Zy.count(Fn(e.getFullYear())-1,e)}function Tn(e){return Fn(e).getDay()}function Rn(e,t,n,i,r,o,a){if(0<=e&&e<100){const s=new Date(-1,t,n,i,r,o,a);return s.setFullYear(e),s}return new Date(e,t,n,i,r,o,a)}function Pn(e){return Bn(new Date(e))}function Ln(e){return In(new Date(e))}function Bn(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return rn.AN.count(t-1,e)}function In(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return on.pI.count(t-1,e)}function jn(e){return Cn.setTime(Date.UTC(e,0,1)),Cn.getUTCDay()}function Un(e,t,n,i,r,o,a){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,i,r,o,a));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,i,r,o,a))}function qn(e,t,n,i,r){const o=t||1,a=$e(e),s=(e,t,r)=>function(e,t,n,i){const r=n<=1?e:i?(t,r)=>i+n*Math.floor((e(t,r)-i)/n):(t,i)=>n*Math.floor(e(t,i)/n);return t?(e,n)=>t(r(e,n),n):r}(n[r=r||e],i[r],e===a&&o,t),l=new Date,u=Mt(e),c=u[hn]?s(hn):et(2012),f=u[mn]?s(mn):u[pn]?s(pn):ue,d=u[gn]&&u[vn]?s(vn,1,gn+vn):u[gn]?s(gn,1):u[vn]?s(vn,1):u[yn]?s(yn,1):u[bn]?s(bn,1):ce,h=u[xn]?s(xn):ue,p=u[wn]?s(wn):ue,m=u[_n]?s(_n):ue,g=u[kn]?s(kn):ue;return function(e){l.setTime(+e);const t=c(l);return r(t,f(l),d(l,t),h(l),p(l),m(l),g(l))}}function Wn(e,t,n){return t+7*e-(n+6)%7}const Gn={[hn]:e=>e.getFullYear(),[pn]:e=>Math.floor(e.getMonth()/3),[mn]:e=>e.getMonth(),[yn]:e=>e.getDate(),[xn]:e=>e.getHours(),[wn]:e=>e.getMinutes(),[_n]:e=>e.getSeconds(),[kn]:e=>e.getMilliseconds(),[bn]:e=>Nn(e),[gn]:e=>zn(e),[gn+vn]:(e,t)=>Wn(zn(e),e.getDay(),Tn(t)),[vn]:(e,t)=>Wn(1,e.getDay(),Tn(t))},Hn={[pn]:e=>3*e,[gn]:(e,t)=>Wn(e,0,Tn(t))};function Vn(e,t){return qn(e,t||1,Gn,Hn,Rn)}const Zn={[hn]:e=>e.getUTCFullYear(),[pn]:e=>Math.floor(e.getUTCMonth()/3),[mn]:e=>e.getUTCMonth(),[yn]:e=>e.getUTCDate(),[xn]:e=>e.getUTCHours(),[wn]:e=>e.getUTCMinutes(),[_n]:e=>e.getUTCSeconds(),[kn]:e=>e.getUTCMilliseconds(),[bn]:e=>Bn(e),[gn]:e=>In(e),[vn]:(e,t)=>Wn(1,e.getUTCDay(),jn(t)),[gn+vn]:(e,t)=>Wn(In(e),e.getUTCDay(),jn(t))},Xn={[pn]:e=>3*e,[gn]:(e,t)=>Wn(e,0,jn(t))};function Yn(e,t){return qn(e,t||1,Zn,Xn,Un)}const Jn={[hn]:an.jB,[pn]:sn.F0.every(3),[mn]:sn.F0,[gn]:on.Zy,[yn]:rn.rr,[vn]:rn.rr,[bn]:rn.rr,[xn]:ln.WQ,[wn]:un.Z_,[_n]:cn.E,[kn]:fn.A},Qn={[hn]:an.ol,[pn]:sn.me.every(3),[mn]:sn.me,[gn]:on.pI,[yn]:rn.AN,[vn]:rn.AN,[bn]:rn.AN,[xn]:ln.lM,[wn]:un.rz,[_n]:cn.E,[kn]:fn.A};function Kn(e){return Jn[e]}function ei(e){return Qn[e]}function ti(e,t,n){return e?e.offset(t,n):void 0}function ni(e,t,n){return ti(Kn(e),t,n)}function ii(e,t,n){return ti(ei(e),t,n)}function ri(e,t,n,i){return e?e.range(t,n,i):void 0}function oi(e,t,n,i){return ri(Kn(e),t,n,i)}function ai(e,t,n,i){return ri(ei(e),t,n,i)}const si=31536e6,li=[hn,mn,yn,xn,wn,_n,kn],ui=li.slice(0,-1),ci=ui.slice(0,-1),fi=ci.slice(0,-1),di=fi.slice(0,-1),hi=[hn,mn],pi=[hn],mi=[[ui,1,1e3],[ui,5,5e3],[ui,15,15e3],[ui,30,3e4],[ci,1,6e4],[ci,5,3e5],[ci,15,9e5],[ci,30,18e5],[fi,1,36e5],[fi,3,108e5],[fi,6,216e5],[fi,12,432e5],[di,1,864e5],[[hn,gn],1,6048e5],[hi,1,2592e6],[hi,3,7776e6],[pi,1,si]];function gi(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(At(t))/n;let r,o,a=(0,dn.Z)((e=>e[2])).right(mi,i);return a===mi.length?(r=pi,o=(0,Yt.ly)(t[0]/si,t[1]/si,n)):a?(a=mi[i/mi[a-1][2]t[n]||(t[n]=e(n))}function xi(e){const t=bi(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=(0,Jt.Z)(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let o=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const a=or;)if("0"!==i[o]){++o;break}return i.slice(0,o)+a}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,o){o=(0,Jt.Z)(null==o?",f":o);const a=(0,Yt.ly)(e,i,r),s=Math.max(Math.abs(e),Math.abs(i));let l;if(null==o.precision)switch(o.type){case"s":return isNaN(l=(0,Qt.Z)(a,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=(0,Kt.Z)(a,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=(0,en.Z)(a))||(o.precision=l-2*("%"===o.type))}return t(o)}}}let wi,_i;function ki(){return wi=xi({format:tn.WU,formatPrefix:tn.jH})}function Ei(e){return xi((0,nn.Z)(e))}function Ai(e){return arguments.length?wi=Ei(e):wi}function $i(e,t,n){we(n=n||{})||re(`Invalid time multi-format specifier: ${n}`);const i=t(_n),r=t(wn),o=t(xn),a=t(yn),s=t(gn),l=t(mn),u=t(pn),c=t(hn),f=e(n[kn]||".%L"),d=e(n[_n]||":%S"),h=e(n[wn]||"%I:%M"),p=e(n[xn]||"%I %p"),m=e(n[yn]||n[vn]||"%a %d"),g=e(n[gn]||"%b %d"),y=e(n[mn]||"%B"),v=e(n[pn]||"%B"),b=e(n[hn]||"%Y");return e=>(i(e)yt(e)?t(e):$i(t,Kn,e),utcFormat:e=>yt(e)?n(e):$i(n,ei,e),timeParse:bi(e.parse),utcParse:bi(e.utcParse)}}function Si(){return _i=Di({format:yi.i$,parse:yi.Z1,utcFormat:yi.g0,utcParse:yi.wp})}function Ci(e){return Di((0,vi.Z)(e))}function Fi(e){return arguments.length?_i=Ci(e):_i}ki(),Si();const Mi=(e,t)=>nt({},e,t);function Oi(e,t){const n=e?Ei(e):Ai(),i=t?Ci(t):Fi();return Mi(n,i)}function Ni(e,t){const n=arguments.length;return n&&2!==n&&re("defaultLocale expects either zero or two arguments."),n?Mi(Ai(e),Fi(t)):Mi(Ai(),Fi())}function zi(){return ki(),Si(),Ni()}const Ti=/^(data:|([A-Za-z]+:)?\/\/)/,Ri=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Pi=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Li="file://";async function Bi(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function Ii(e,t){t=nt({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,a;const s=Ri.test(e.replace(Pi,""));null!=e&&"string"==typeof e&&s||re("Sanitize failure, invalid URI: "+$t(e));const l=Ti.test(e);return(a=t.baseURL)&&!l&&(e.startsWith("/")||a.endsWith("/")||(e="/"+e),e=a+e),o=(r=e.startsWith(Li))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!o}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function ji(e){return e?t=>new Promise(((n,i)=>{e.readFile(t,((e,t)=>{e?i(e):n(t)}))})):Ui}async function Ui(){re("No file system access.")}function qi(e){return e?async function(t,n){const i=nt({},this.options.http,n),r=n&&n.response,o=await e(t,i);return o.ok?Ve(o[r])?o[r]():o.text():re(o.status+""+o.statusText)}:Wi}async function Wi(){re("No HTTP fetch method available.")}const Gi=e=>null!=e&&e==e,Hi=e=>!(Number.isNaN(+e)||e instanceof Date),Vi={boolean:Dt,integer:De,number:De,date:Ct,string:Ft,unknown:le},Zi=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>Hi(e)&&Number.isInteger(+e),Hi,e=>!Number.isNaN(Date.parse(e))],Xi=["boolean","integer","number","date"];function Yi(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=Zi.length,r=Zi.map(((e,t)=>t+1));for(let o,a,s=0,l=0;s0===e?t:e),0)-1]}function Ji(e,t){return t.reduce(((t,n)=>(t[n]=Yi(e,n),t)),{})}function Qi(e){const t=function(t,n){const i={delimiter:e};return Ki(t,n?nt(n,i):i)};return t.responseType="text",t}function Ki(e,t){return t.header&&(e=t.header.map($t).join(t.delimiter)+"\n"+e),Ut(t.delimiter).parse(e+"")}function er(e,t){const n=t&&t.property?ae(t.property):le;return!we(e)||(i=e,"function"==typeof Buffer&&Ve(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){return!xe(e)&&pt(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}Ki.responseType="text",er.responseType="json";const tr={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function nr(e,t){let n,i,r,o;return e=er(e,t),t&&t.feature?(n=Wt,r=t.feature):t&&t.mesh?(n=Zt,r=t.mesh,o=tr[t.filter]):re("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):re("Invalid TopoJSON object: "+r),i&&i.features||[i]}nr.responseType="json";const ir={dsv:Ki,csv:Qi(","),tsv:Qi("\t"),json:er,topojson:nr};function rr(e,t){return arguments.length>1?(ir[e]=t,this):at(ir,e)?ir[e]:null}function or(e){const t=rr(e);return t&&t.responseType||"text"}function ar(e,t,n,i){const r=rr((t=t||{}).type||"json");return r||re("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=Fi();n=n||r.timeParse,i=i||r.utcParse;let o,a,s,l,u,c,f=e.columns||Object.keys(e[0]);"auto"===t&&(t=Ji(e,f)),f=Object.keys(t);const d=f.map((e=>{const r=t[e];let o,a;if(r&&(r.startsWith("date:")||r.startsWith("utc:")))return o=r.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?i:n)(a);if(!Vi[r])throw Error("Illegal format pattern: "+e+":"+r);return Vi[r]}));for(s=0,u=e.length,c=f.length;s({options:t||{},sanitize:Ii,load:Bi,fileAccess:!1,file:ji(null),http:qi(e)})}("undefined"!=typeof fetch&&fetch);function lr(e){const t=e||le,n=[],i={};return n.add=e=>{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function ur(e,t){try{await t(e)}catch(t){e.error(t)}}const cr=Symbol("vega_id");let fr=1;function dr(e){return!(!e||!hr(e))}function hr(e){return e[cr]}function pr(e,t){return e[cr]=t,e}function mr(e){const t=e===Object(e)?e:{data:e};return hr(t)?t:pr(t,fr++)}function gr(e){return yr(e,mr({}))}function yr(e,t){for(const n in e)t[n]=e[n];return t}function vr(e,t){return pr(t,hr(e))}function br(e,t){return e?t?(n,i)=>e(n,i)||hr(t(n))-hr(t(i)):(t,n)=>e(t,n)||hr(t)-hr(n):null}function xr(e){return e&&e.constructor===wr}function wr(){const e=[],t=[],n=[],i=[],r=[];let o=null,a=!1;return{constructor:wr,insert(t){const n=Ge(t),i=n.length;for(let t=0;t{p(e)&&(u[hr(e)]=-1)}));for(f=0,d=e.length;f0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=r.length;f{p(e)&&u[hr(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(a)s.mod=t.length||i.length?l.filter((e=>u[hr(e)]>0)):l.slice();else for(g in c)s.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&s.clean(!0),s}}}const _r="_:mod:_";function kr(){Object.defineProperty(this,_r,{writable:!0,value:{}})}kr.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[_r];return null!=t&&t>=0?(o[t]!==n||i)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||i)&&(r[e]=n,a[e]=xe(n)?1+n.length:-1),r},modified(e,t){const n=this[_r];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(xe(e)){for(let t=0;t=0?t+1{a instanceof $r?(a!==this&&(t&&a.targets().add(this),o.push(a)),r.push({op:a,name:e,index:n})):i.set(e,n,a)};for(a in e)if(s=e[a],"pulse"===a)Ge(s).forEach((e=>{e instanceof $r?e!==this&&(e.targets().add(this),o.push(e)):re("Pulse parameters must be operator instances.")})),this.source=s;else if(xe(s))for(i.set(a,-1,Array(l=s.length)),u=0;u{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=Fr();return this.targets().add(Fr(null,null,tt(e,(e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between(e,t){let n=!1;return e.targets().add(Fr(null,null,(()=>n=!0))),t.targets().add(Fr(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=fe,this._targets=null}};const Mr={skip:!0};function Or(e,t,n,i,r,o){const a=nt({},o,Mr);let s,l;Ve(n)||(n=et(n)),void 0===i?s=t=>e.touch(n(t)):Ve(i)?(l=new $r(null,i,r,!1),s=t=>{l.evaluate(t);const i=n(t),r=l.value;xr(r)?e.pulse(i,r,o):e.update(i,r,a)}):s=t=>e.update(n(t),i,a),t.apply(s)}function Nr(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const a=o||{},s=new $r(null,function(e,t){return t=Ve(t)?t:et(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);s.modified(a.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}const zr={};function Tr(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Rr(e,t){const n=[];return Nt(e,t,(e=>n.push(e))),n}function Pr(e,t){const n={};return e.visit(t,(e=>{n[hr(e)]=1})),e=>n[hr(e)]?null:e}function Lr(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function Br(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const e of n)if(e.stamp===t){if(e.fields){const t=r.fields||(r.fields={});for(const n in e.fields)t[n]=1}e.changed(r.ADD)&&(o|=r.ADD),e.changed(r.REM)&&(o|=r.REM),e.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function Ir(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Tr.prototype={StopPropagation:zr,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new Tr(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new Tr(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,Pr(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return xe(e)?e.forEach((e=>t[e]=!0)):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?xe(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=Lr(n.addF,t)),2&e&&(n.remF=Lr(n.remF,t)),4&e&&(n.modF=Lr(n.modF,t)),16&e&&(n.srcF=Lr(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=Rr(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=Rr(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=Rr(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return Nt(n.source,n.srcF,i),n;1&e&&Nt(n.add,n.addF,i),2&e&&Nt(n.rem,n.remF,i),4&e&&Nt(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||Nt(r,e?Pr(n,5):n.srcF,i)}return n}},ct(Br,Tr,{fork(e){const t=new Tr(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(e=>t.add.push(e))),e&t.REM&&this.visit(t.REM,(e=>t.rem.push(e))),e&t.MOD&&this.visit(t.MOD,(e=>t.mod.push(e)))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?xe(e)?e.some((e=>n[e])):n[e]:0},filter(){re("MultiPulse does not support filtering.")},materialize(){re("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;ot&&(o=n-1>>1,r=e[o],i(a,r)<0);)e[n]=r,n=o;return e[n]=a}function qr(){this.logger(be()),this.logLevel(me),this._clock=0,this._rank=0,this._locale=Ni();try{this._loader=sr()}catch(e){}this._touched=lr(se),this._input={},this._pulse=null,this._heap=function(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Ur(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,o=e[t];let a,s=1+(t<<1);for(;s=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,Ur(e,i,t,n)}(t,0,e)):i=n,i}}}(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function Wr(e){return function(){return this._log[e].apply(this,arguments)}}function Gr(e,t){$r.call(this,e,null,t)}qr.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:Wr("error"),warn:Wr("warn"),info:Wr("info"),debug:Wr("debug"),logLevel:Wr("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof $r?r=e:e&&e.prototype instanceof $r?r=new e:Ve(e)?r=new $r(null,e):(o=0,r=new $r(e,t)),this.rank(r),o&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r=0;)t.push(n=i[r]),n===e&&re("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||jr);const i=new Tr(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||jr;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||jr;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:wr,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return ar(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise((e=>t=e));return n.requests=0,n.done=()=>{0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(fe).insert(o.data||[])),r.done(),o},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:or(t&&t.type)});try{i=n.parse(i,t)}catch(t){r=-2,n.warn("Data ingestion failed",e,t)}}catch(t){r=-1,n.warn("Loading failed",e,t)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=Fr(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(e){r.error(e)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):Ge(e);const l=s.length;for(let e=0;ei._enqueue(e,!0))),i._touched=lr(se);let a,s,l,u=0;try{for(;i._heap.size()>0;)a=i._heap.pop(),a.rank===a.qrank?(s=a.run(i._getPulse(a,e)),s.then?s=await s:s.async&&(r.push(s.async),s=zr),s!==zr&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++u):i._enqueue(a,!0)}catch(e){i._heap.clear(),l=e}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;ti.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(e){i.error(e)}}))})))),i},run:function(e,t,n){return this._pulse?Ir(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}},_enqueue:function(e,t){const n=e.stampe.pulse)),t):this._input[e.id]||function(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==zr&&(e.source=t.source),e)}(this._pulse,n&&n.pulse)}},ct(Gr,$r,{run(e){if(e.stampthis.pulse=e)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const Hr={};function Vr(e){const t=Zr(e);return t&&t.Definition||null}function Zr(e){return e=e&&e.toLowerCase(),at(Hr,e)?Hr[e]:null}var Xr=n(31655),Yr=n(53856),Jr=n(93571);function Qr(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(et?1:0)}function Kr(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=void 0===r?Qr:function(e=Xr.Z){if(e===Xr.Z)return Qr;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||0===i?i:(0===e(n,n))-(0===e(t,t))}}(r);i>n;){if(i-n>600){const o=i-n+1,a=t-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Kr(e,t,Math.max(n,Math.floor(t-a*l/o+u)),Math.min(i,Math.floor(t+(o-a)*l/o+u)),r)}const o=e[t];let a=n,s=i;for(eo(e,n,t),r(e[i],o)>0&&eo(e,n,i);a0;)--s}0===r(e[n],o)?eo(e,n,s):(++s,eo(e,s,i)),s<=t&&(n=s+1),t<=s&&(i=s-1)}return e}function eo(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}var to=n(53612);function no(e,t,n){if((i=(e=Float64Array.from((0,to.K)(e,n))).length)&&!isNaN(t=+t)){if(t<=0||i<2)return(0,Jr.Z)(e);if(t>=1)return(0,Yr.Z)(e);var i,r=(i-1)*t,o=Math.floor(r),a=(0,Yr.Z)(Kr(e,o).subarray(0,o+1));return a+((0,Jr.Z)(e.subarray(o+1))-a)*(r-o)}}function io(e,t,n=to.Z){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(r-o)}}function ro(e,t){return no(e,.5,t)}function*oo(e,t){if(null==t)for(let t of e)null!=t&&""!==t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function ao(e,t,n){const i=Float64Array.from(oo(e,n));return i.sort(Xr.Z),t.map((e=>io(i,e)))}function so(e,t){return ao(e,[.25,.5,.75],t)}function lo(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,o=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-r,r+=n/++i,o+=n*(t-r));else{let a=-1;for(let s of e)null!=(s=t(s,++a,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,o+=n*(s-r))}if(i>1)return o/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=so(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function uo(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,l,u,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)o=e.step;else if(e.steps){for(l=h/t,u=0,c=e.steps.length;ut;)o*=n;for(u=0,c=r.length;u=s&&h/l<=t&&(o=l)}l=Math.log(o);const p=l>=0?0:1+~~(-l/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(f/o+m)*o,f=fe);const r=e.length,o=new Float64Array(r);let a,s=0,l=1,u=i(e[0]),c=u,f=u+t;for(;l=f){for(c=(u+c)/2;s>1);ra;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}function mo(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function go(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*co()),pdf:e=>e===Math.floor(e)&&e>=n&&e=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return o.min(e).max(t)}const yo=Math.sqrt(2*Math.PI),vo=Math.SQRT2;let bo=NaN;function xo(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(bo==bo)r=bo,bo=NaN;else{do{r=2*co()-1,o=2*co()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,bo=o*i}return e+r*t}function wo(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*yo)}function _o(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let o;if(r>37)o=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,o=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,o/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,o=e/t/2.506628274631)}return i>0?1-o:o}function ko(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*vo*function(e){let t,n=-Math.log((1-e)*(1+e));return n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0,t*e}(2*e-1)}function Eo(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>xo(n,i),pdf:e=>wo(e,n,i),cdf:e=>_o(e,n,i),icdf:e=>ko(e,n,i)};return r.mean(e).stdev(t)}function Ao(e,t){const n=Eo();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=lo(e)),r):t},sample:()=>e[~~(co()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;a$o(n,i),pdf:e=>Do(e,n,i),cdf:e=>So(e,n,i),icdf:e=>Co(e,n,i)};return r.mean(e).stdev(t)}function Mo(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n=t&&e<=n?1/(n-t):0}function zo(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function To(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Ro(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Oo(n,i),pdf:e=>No(e,n,i),cdf:e=>zo(e,n,i),icdf:e=>To(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function Po(e,t,n){let i=0,r=0;for(const o of e){const e=n(o);null==t(o)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function Lo(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function Bo(e,t,n,i){e=e.filter((e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r})),i&&e.sort(((e,n)=>t(e)-t(n)));const r=e.length,o=new Float64Array(r),a=new Float64Array(r);let s,l,u,c=0,f=0,d=0;for(u of e)o[c]=s=+t(u),a[c]=l=+n(u),++c,f+=(s-f)/c,d+=(l-d)/c;for(c=0;c=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function jo(e,t,n,i,r){let o=0,a=0;return Io(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function Uo(e,t,n){let i=0,r=0,o=0,a=0,s=0;Io(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=Lo(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:jo(e,t,n,r,u)}}function qo(e,t,n){let i=0,r=0,o=0,a=0,s=0;Io(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=Lo(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:jo(e,t,n,r,u)}}function Wo(e,t,n){const[i,r,o,a]=Bo(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;Io(e,t,n,((e,t)=>{s=i[p++],l=Math.log(t),u=s*t,c+=(t*l-c)/p,f+=(u-f)/p,d+=(u*l-d)/p,h+=(s*u-h)/p}));const[m,g]=Lo(f/a,c/a,d/a,h/a),y=e=>Math.exp(m+g*(e-o));return{coef:[Math.exp(m-g*o),g],predict:y,rSquared:jo(e,t,n,a,y)}}function Go(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;Io(e,t,n,((e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,o+=(n*u-o)/l,a+=(n*n-a)/l,s+=(t-s)/l}));const u=Lo(i,r,o,a),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:jo(e,t,n,s,c)}}function Ho(e,t,n){const[i,r,o,a]=Bo(e,t,n),s=i.length;let l,u,c,f,d=0,h=0,p=0,m=0,g=0;for(l=0;lb*(e-=o)*e+x*e+w+a;return{coef:[w-x*o+b*o*o+a,x-2*b*o,b],predict:_,rSquared:jo(e,t,n,a,_)}}function Vo(e,t,n,i){if(0===i)return Po(e,t,n);if(1===i)return Uo(e,t,n);if(2===i)return Ho(e,t,n);const[r,o,a,s]=Bo(e,t,n),l=r.length,u=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;dMath.abs(e[i][a])&&(a=r);for(o=i;o=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,o=r+1;o{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d=0;--o)for(s=t[o],l=1,r[o]+=s,a=1;a<=o;++a)l*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*l;return r[0]+=i,r}const Xo=2,Yo=1e-12;function Jo(e,t,n,i){const[r,o,a,s]=Bo(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),f=new Float64Array(l),d=new Float64Array(l).fill(1);for(let e=-1;++e<=Xo;){const t=[0,u-1];for(let e=0;er[a]-n?i:a;let l=0,u=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-n||1);for(let e=i;e<=a;++e){const t=r[e],i=o[e],a=Qo(Math.abs(n-t)*g)*d[e],s=t*a;l+=a,u+=s,h+=i*a,p+=i*s,m+=t*s}const[y,v]=Lo(u/l,h/l,p/l,m/l);c[e]=y+v*n,f[e]=Math.abs(o[e]-c[e]),Ko(r,e+1,t)}if(e===Xo)break;const n=ro(f);if(Math.abs(n)=1?Yo:(t=1-e*e)*t}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,l=0,u=[];for(;s=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const ea=.5*Math.PI/180;function ta(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],o=t[0],a=t[1],s=a-o,l=s/i,u=[r(o)],c=[];if(n===i){for(let e=1;e0;)c.push(r(o+e/n*s));let f=u[0],d=c[c.length-1];const h=1/s,p=function(e,t){let n=e,i=e;const r=t.length;for(let e=0;ei&&(i=r)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=l&&na(f,e,d,h,p)>ea?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function na(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-a)}var ia=n(53353);function ra(e){return e&&e.length?1===e.length?e[0]:(t=e,e=>{const n=t.length;let i=1,r=String(t[0](e));for(;i{},sa={init:aa,add:aa,rem:aa,idx:0},la={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},ua=Object.keys(la).filter((e=>"__count__"!==e));function ca(e,t){return la[e](t)}function fa(e,t){return e.idx-t.idx}function da(){this.valid=0,this.missing=0,this._ops.forEach((e=>e.init(this)))}function ha(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function pa(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function ma(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function ga(e,t){const n=t||le,i=function(e){const t={};e.forEach((e=>t[e.name]=e));const n=e=>{e.req&&e.req.forEach((e=>{t[e]||n(t[e]=la[e]())}))};return e.forEach(n),Object.values(t).sort(fa)}(e),r=e.slice().sort(fa);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=da,o.prototype.add=ha,o.prototype.rem=pa,o.prototype.set=ma,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function ya(e){this._key=e?ae(e):hr,this.reset()}[...ua,"__count__"].forEach((e=>{la[e]=function(e,t){return n=>nt({name:e,out:n||e},sa,t)}(e,la[e])}));const va=ya.prototype;function ba(e){Gr.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function xa(e){Gr.call(this,null,e)}function wa(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.push(e),remove:e=>a[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!a[i(e)])),a={},s=0),t&&e&&r.sort(e),o.length&&(r=e?_t(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function _a(e){Gr.call(this,[],e)}function ka(e){$r.call(this,null,Ea,e)}function Ea(e){return this.value&&!e.modified()?this.value:Xe(e.fields,e.orders)}function Aa(e){Gr.call(this,null,e)}function $a(e){Gr.call(this,null,e)}va.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},va.add=function(e){this._add.push(e)},va.rem=function(e){this._rem.push(e)},va.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),a={};let s,l,u;for(s=0;s=0;)i=e(t[r])+"",at(n,i)||(n[i]=1,++o);return o},va.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=rt(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},va.argmin=function(e){return this.extent(e)[0]||{}},va.argmax=function(e){return this.extent(e)[1]||{}},va.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},va.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},va.quartile=function(e){return this._get===e&&this._q||(this._q=so(this.values(),e),this._get=e),this._q},va.q1=function(e){return this.quartile(e)[0]},va.q2=function(e){return this.quartile(e)[1]},va.q3=function(e){return this.quartile(e)[2]},va.ci=function(e){return this._get===e&&this._ci||(this._ci=ho(this.values(),1e3,.05,e),this._get=e),this._ci},va.ci0=function(e){return this.ci(e)[0]},va.ci1=function(e){return this.ci(e)[1]},ba.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ua},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},ct(ba,Gr,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(e=>n.add(e)))):(n.value=n.value||n.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter((()=>this.clean())),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map((()=>({}))),r=n.length;function o(e){let t,o,a,s;for(t in e)for(a=e[t].tuple,o=0;o{const t=K(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:ra(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.as||[],l=o.length,u={};let c,f,d,h,p,m;for(l!==a.length&&re("Unmatched number of fields and aggregate ops."),m=0;mga(e,e.field))),Object.create(null)},cellkey:ra(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp{const t=i(e);e[s]=t,e[l]=null==t?null:r+o*(1+(t-r)/o)}:e=>e[s]=i(e)),t.modifies(n?a:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=uo(e),i=n.step;let r,o,a=n.start,s=a+Math.ceil((n.stop-a)/i)*i;null!=(r=e.anchor)&&(o=r-(a+i*Math.floor((r-a)/i)),a+=o,s+=o);const l=function(e){let n=De(t(e));return null==n?null:ns?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return l.start=a,l.stop=n.stop,l.step=i,this.value=Q(l,ee(t),e.name||"bin_"+K(t))}}),_a.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ct(_a,Gr,{transform(e,t){const n=t.fork(t.ALL),i=wa(hr,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(br(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),ct(ka,$r),Aa.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},ct(Aa,Gr,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(s(n),e.case,o)||[],l=0,u=r.length;lr[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,l,u;for(s in n)l=i[s],u=n[s]||0,!l&&u?(i[s]=l=mr({}),l[r]=s,l[o]=u,a.add.push(l)):0===u?(l&&a.rem.push(l),n[s]=null,i[s]=null):l[o]!==u&&(l[o]=u,a.mod.push(l));return a.modifies(t)}}),$a.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ct($a,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,o,a=[],s={},l=e.length,u=0;uCa(e,t)))):typeof i[n]===Sa&&i[n](e[n]);return i}function Fa(e){Gr.call(this,null,e)}const Ma=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Oa={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Ma},{name:"weights",type:"number",array:!0}]};function Na(e,t){return e?e.map(((e,n)=>t[n]||K(e))):null}function za(e,t,n){const i=[],r=e=>e(l);let o,a,s,l,u,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;at(n,e)),ee(t),K(t))}function La(e){Gr.call(this,[void 0,void 0],e)}function Ba(e,t){$r.call(this,e),this.parent=t,this.count=0}function Ia(e){Gr.call(this,{},e),this._keys=lt();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;nae(e))):ae(e.name,e.as)}function qa(e){Gr.call(this,lt(),e)}function Wa(e){Gr.call(this,[],e)}function Ga(e){Gr.call(this,[],e)}function Ha(e){Gr.call(this,null,e)}function Va(e){Gr.call(this,[],e)}Fa.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:Ma.concat(Oa)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ct(Fa,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=Ca(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let a=e.method||"pdf";"pdf"!==a&&"cdf"!==a&&re("Invalid density method: "+a),e.extent||i.data||re("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],l=ta(a,e.extent||it(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],mr(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),Ta.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]},ct(Ta,Gr,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=za(t.source,e.groupby,le),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>At(it(e,t))/30)(n,o),s=br(((e,t)=>o(e)-o(t))),l=e.as||"bin",u=i.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=t),e[++c][l]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(l)}}),ct(Ra,$r),La.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ct(La,Gr,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],a=n[1];if((r||null==o)&&(o=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=De(i(e));null!=t&&(ta&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=K(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),ct(Ba,$r,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),ct(Ia,Gr,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=at(r,e)&&r[e];return s?s.value.stampe&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;rthis.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=hr(e),n=o.get(t);void 0!==n&&(o.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);o.set(hr(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=hr(e),n=o.get(t),r=i(e);n===r?s(r).mod(e):(o.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(o.get(hr(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=hr(e),n=o.get(t),r=i(e);n!==r&&(o.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}}),ct(ja,$r),qa.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ct(qa,Gr,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,l=e.expr;let u=!0;function c(t){const n=hr(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?u&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=hr(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(hr(t),1)})),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),Wa.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},ct(Wa,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=Na(i,e.as||[]),o=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{const t=i.map((t=>t(e))),s=t.reduce(((e,t)=>Math.max(e,t.length)),0);let l,u,c,f=0;for(;f{for(let t,o=0;ot[i]=n(t,e)))}}),ct(Va,Gr,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,l=e.size-s.length;if(l>0){for(r=[];--l>=0;)r.push(a=mr(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-l);return n.source=this.value=s,n}});const Za={value:"value",median:ro,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,i+=t);else{let r=-1;for(let o of e)null!=(o=t(o,++r,e))&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n},min:Jr.Z,max:Yr.Z},Xa=[];function Ya(e){Gr.call(this,[],e)}function Ja(e){ba.call(this,e)}function Qa(e){Gr.call(this,null,e)}function Ka(e){$r.call(this,null,es,e)}function es(e){return this.value&&!e.modified()?this.value:vt(e.fields,e.flat)}function ts(e){Gr.call(this,[],e),this._pending=null}function ns(e,t,n){n.forEach(mr);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function is(e){Gr.call(this,{},e)}function rs(e){$r.call(this,null,os,e)}function os(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,o=1/0,a=-1/0;for(i=0;ia&&(a=r[1]);return[o,a]}function as(e){$r.call(this,null,ss,e)}function ss(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function ls(e){Gr.call(this,null,e)}function us(e){ba.call(this,e)}function cs(e){Ia.call(this,e)}function fs(e){Gr.call(this,null,e)}function ds(e){Gr.call(this,null,e)}function hs(e){Gr.call(this,null,e)}function ps(e){Gr.call(this,null,e)}function ms(e){Gr.call(this,[],e),this.count=0}function gs(e){Gr.call(this,null,e)}function ys(e){Gr.call(this,null,e),this.modified(!0)}function vs(e){Gr.call(this,null,e)}Ya.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},ct(Ya,Gr,{transform(e,t){var n,i,r,o,a,s,l,u,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||Za.value;if(null!=Za[n])return n===Za.value?(t=void 0!==e.value?e.value:0,()=>t):Za[n];re("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=K(e.field),g=K(e.key),y=(e.groupby||[]).map(K),v=function(e,t,n,i){var r,o,a,s,l,u,c,f,d=e=>e(f),h=[],p=i?i.slice():[],m={},g={};for(p.forEach(((e,t)=>m[e]=t+1)),s=0,c=e.length;sn.add(e)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),n.changes(),t.visit(t.SOURCE,(e=>{nt(e,r[n.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n{const n=Ao(t,a)[s],i=e.counts?t.length:1;ta(n,c||it(t),f,d).forEach((e=>{const n={};for(let e=0;e(this._pending=Ge(e.data),e=>e.touch(this))));return{async:t}}return n.request(e.url,e.format).then((e=>ns(this,t,Ge(e.data))))}}),is.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},ct(is,Gr,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=null==e.default?null:e.default,a=e.modified(),s=n.length;let l,u,c,f=a?t.SOURCE:t.ADD,d=t,h=e.as;return r?(u=r.length,s>1&&!h&&re('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*u&&re('The "as" parameter has too few output field names.'),h=h||r.map(K),l=function(e){for(var t,a,l=0,c=0;lt.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,l),d.modifies(h)}}),ct(rs,$r),ct(as,$r),ct(ls,Gr,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),us.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:ua,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ct(us,ba,{_transform:ba.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",o=ee(n).concat(ee(i)),a=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,(t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))})),r.sort(Ye),t?r.slice(0,t):r}(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return Q((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,o))),as:a.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),ct(cs,Ia,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(hr(e),n,t,e);return(e.modified("field")||i&&t.modified(ee(i)))&&re("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(e=>{const t=r(e);i(e).forEach((e=>t.mod(e)))})),t.visit(t.ADD,(e=>{const t=r(e);i(e).forEach((e=>t.add(mr(e))))})),t.visit(t.REM,(e=>{const t=r(e);i(e).forEach((e=>t.rem(e)))}))):(t.visit(t.MOD,(e=>r(e).mod(e))),t.visit(t.ADD,(e=>r(e).add(e))),t.visit(t.REM,(e=>r(e).rem(e)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),fs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ct(fs,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=Na(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r{const t=hr(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,mr({}));a[hr(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[hr(e)]))})),n}}),ct(ds,Gr,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),hs.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]},ct(hs,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=za(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(K),a=[],s=e.step||.01,l=e.probs||(0,ia.Z)(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=ao(e,l);for(let n=0;n{const t=hr(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=gr(e);i[hr(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[hr(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),ms.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ct(ms,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[hr(t)]=1,e)),{});let a=this.value,s=this.count,l=0;function u(e){let t,i;a.length=l&&(t=a[i],o[hr(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=hr(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[hr(e)]))),(t.rem.length||i)&&a.length{o[hr(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t{o[hr(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[hr(e)]))),this.count=s,this.value=n.source=a,n}}),gs.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},ct(gs,Gr,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=(0,ia.Z)(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,mr(t)})),n.add=t.add.concat(this.value),n}}),ct(ys,Gr,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const bs=["unit0","unit1"];function xs(e){Gr.call(this,lt(),e)}function ws(e){Gr.call(this,null,e)}vs.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:En,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:bs}]},ct(vs,Gr,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?ei:Kn)(o.unit).offset,s=e.as||bs,l=s[0],u=s[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(ee(n)))&&(h=(t=t.reflow(!0)).SOURCE,f=1/0,d=-1/0),t.visit(h,(e=>{const t=n(e);let r,s;null==t?(e[l]=null,i&&(e[u]=null)):(e[l]=r=s=o(t),i&&(e[u]=s=a(r,c)),rd&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:gi({extent:e.extent||it(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=$n(i),a=this.value||{},s=(n?Yn:Vn)(o,r);return s.unit=$e(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),ct(xs,Gr,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=e=>r.set(i(e),e);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,o)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),ct(ws,Gr,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(br(e.sort)):t.source).map(e.field))}});const _s={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=_s.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e0||re("ntile num must be greater than zero.");const n=_s.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||re("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return it=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;ns[e]=1))}d(e.sort),t.forEach(((e,t)=>{const s=n[t],h=K(s),p=oa(e,h,r[t]);if(d(s),o.push(p),at(_s,e))a.push(function(e,t,n,i){const r=_s[e](t,n);return{init:r.init||ue,update:function(e,t){t[i]=r.next(e)}}}(e,n[t],i[t],p));else{if(null==s&&"count"!==e&&re("Null aggregate field specified."),"count"===e)return void u.push(p);f=!1;let t=l[h];t||(t=l[h]=[],t.field=s,c.push(t)),t.push(ca(e,p))}})),(u.length||c.length)&&(this.cell=function(e,t,n){e=e.map((e=>ga(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),a=0;a0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),ie.init())),this.cell&&this.cell.init()},As.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let a;if(n){for(a=e.p0;athis.group(r(e));let a=this.state;a&&!n||(a=this.state=new Es(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,(e=>o(e).add(e)))):(t.visit(t.REM,(e=>o(e).remove(e))),t.visit(t.ADD,(e=>o(e).add(e))));for(let t=0,n=this._mlen;t=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,u),v[c]=+t(h,c,u),s.point(i?+i(h,c,u):y[c],n?+n(h,c,u):v[c]))}if(p)return s=null,p+""||null}function c(){return(0,Zs.Z)().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?Ys.x:(0,Vs.Z)(+e),t="function"==typeof t?t:void 0===t?(0,Vs.Z)(0):(0,Vs.Z)(+t),n="function"==typeof n?n:void 0===n?Ys.y:(0,Vs.Z)(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:(0,Vs.Z)(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:(0,Vs.Z)(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:(0,Vs.Z)(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:(0,Vs.Z)(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:(0,Vs.Z)(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:(0,Vs.Z)(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:(0,Vs.Z)(!!e),u):r},u.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),u):a},u.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),u):o},u}var Qs=n(90596);(0,Qs._b)(3);const Ks={draw(e,t){const n=(0,Qs._b)(t/Qs.pi);e.moveTo(n,0),e.arc(0,0,n,0,Qs.BZ)}};(0,Qs._b)(1/3),(0,Qs.O$)(Qs.pi/10),(0,Qs.O$)(7*Qs.pi/10);(0,Qs.O$)(Qs.BZ/10),(0,Qs.mC)(Qs.BZ/10),(0,Qs._b)(3),(0,Qs._b)(3),(0,Qs._b)(3),(0,Qs._b)(12);var el=n(3791);function tl(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}const nl=()=>"undefined"!=typeof Image?Image:null;var il=n(10321),rl=n(29387),ol=n(26481),al=n(78319),sl=n(20356),ll=n(42287);function ul(e){return Math.log(e)}function cl(e){return Math.exp(e)}function fl(e){return-Math.log(-e)}function dl(e){return-Math.exp(-e)}function hl(e){return isFinite(e)?+("1e"+e):e<0?0:e}function pl(e){return(t,n)=>-e(-t,n)}function ml(e){const t=e(ul,cl),n=t.domain;let i,r,o=10;function a(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),r=function(e){return 10===e?hl:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=pl(i),r=pl(r),e(fl,dl)):e(ul,cl),t}return t.base=function(e){return arguments.length?(o=+e,a()):o},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=e=>{const t=n();let a=t[0],s=t[t.length-1];const l=s0){for(;f<=d;++f)for(u=1;us)break;p.push(c)}}else for(;f<=d;++f)for(u=o-1;u>=1;--u)if(c=f>0?u/r(-f):u*r(f),!(cs)break;p.push(c)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=(0,Jt.Z)(n)).precision||(n.trim=!0),n=(0,tn.WU)(n)),e===1/0)return n;const a=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*on((0,al.Z)(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function gl(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function yl(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function vl(e){return e<0?-e*e:e*e}function bl(e){var t=e(sl.yR,sl.yR),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(sl.yR,sl.yR):.5===n?e(yl,vl):e(gl(n),gl(1/n)):n},(0,rl.Q)(t)}function xl(){var e=bl((0,sl.l4)());return e.copy=function(){return(0,sl.JG)(e,xl()).exponent(e.exponent())},ll.o.apply(e,arguments),e}function wl(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function _l(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function kl(e){var t=1,n=e(wl(t),_l(t));return n.constant=function(n){return arguments.length?e(wl(t=+n),_l(t)):t},(0,rl.Q)(n)}var El=n(61941),Al=n(18744),$l=n(54289),Dl=n(58687);function Sl(){var e,t,n,i,r,o=0,a=1,s=sl.yR,l=!1;function u(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,s=e(n,i),u):[s(0),s(1)]}}return u.domain=function(r){return arguments.length?([o,a]=r,e=i(o=+o),t=i(a=+a),n=e===t?0:1/(t-e),u):[o,a]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(s=e,u):s},u.range=c($l.Z),u.rangeRound=c(Dl.Z),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(o),t=r(a),n=e===t?0:1/(t-e),u}}function Cl(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Fl(){var e=(0,rl.Q)(Sl()(sl.yR));return e.copy=function(){return Cl(e,Fl())},ll.O.apply(e,arguments)}function Ml(){var e=bl(Sl());return e.copy=function(){return Cl(e,Ml()).exponent(e.exponent())},ll.O.apply(e,arguments)}var Ol=n(73682);function Nl(){var e,t,n,i,r,o,a,s=0,l=.5,u=1,c=1,f=sl.yR,d=!1;function h(e){return isNaN(e=+e)?a:(e=.5+((e=+o(e))-t)*(c*e0?i:1:0}const Bl="linear",Il="log",jl="pow",Ul="sqrt",ql="symlog",Wl="time",Gl="utc",Hl="sequential",Vl="diverging",Zl="quantile",Xl="quantize",Yl="threshold",Jl="ordinal",Ql="point",Kl="band",eu="bin-ordinal",tu="continuous",nu="discrete",iu="discretizing",ru="interpolating",ou="temporal";function au(){const e=(0,Tl.Z)().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,l=0,u=.5;function c(){const e=t().length,c=o[1]h+i*e));return n(c?p.reverse():p)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(o=[+e[0],+e[1]],c()):o.slice()},e.rangeRound=function(e){return o=[+e[0],+e[1]],a=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(a=!!e,c()):a},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),s=l,c()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),c()):s},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]o[1-i])?void 0:(l=Math.max(0,(0,il.ml)(a,f)-1),u=f===d?l:(0,il.ml)(a,d)-1,f-a[l]>r+1e-10&&++l,i&&(c=l,l=s-u,u=s-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return au().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function su(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return su(t())},e}var lu=Array.prototype.map;const uu=Array.prototype.slice,cu=new Map,fu=Symbol("vega_scale");function du(e){return e[fu]=!0,e}function hu(e,t,n){return arguments.length>1?(cu.set(e,function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r=s&&n[o]<=l&&(u<0&&(u=o),i=o);if(!(u<0))return s=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,du(n)};return i.metadata=Mt(Ge(n)),i}(e,t,n)),this):pu(e)?cu.get(e):void 0}function pu(e){return cu.has(e)}function mu(e,t){const n=cu.get(e);return n&&n.metadata[t]}function gu(e){return mu(e,tu)}function yu(e){return mu(e,nu)}function vu(e){return mu(e,iu)}function bu(e){return mu(e,Il)}function xu(e){return mu(e,ru)}function wu(e){return mu(e,Zl)}hu("identity",(function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,ol.Z),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,ol.Z):[0,1],(0,rl.Q)(i)})),hu(Bl,rl.Z,tu),hu(Il,(function e(){const t=ml((0,sl.l4)()).domain([1,10]);return t.copy=()=>(0,sl.JG)(t,e()).base(t.base()),ll.o.apply(t,arguments),t}),[tu,Il]),hu(jl,xl,tu),hu(Ul,(function(){return xl.apply(null,arguments).exponent(.5)}),tu),hu(ql,(function e(){var t=kl((0,sl.l4)());return t.copy=function(){return(0,sl.JG)(t,e()).constant(t.constant())},ll.o.apply(t,arguments)}),tu),hu(Wl,El.Z,[tu,ou]),hu(Gl,(function(){return ll.o.apply((0,El.Y)(Al.WG,Al.jo,an.ol,sn.me,on.pI,rn.AN,ln.lM,un.rz,cn.E,yi.g0).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[tu,ou]),hu(Hl,Fl,[tu,ru]),hu(`${Hl}-${Bl}`,Fl,[tu,ru]),hu(`${Hl}-${Il}`,(function e(){var t=ml(Sl()).domain([1,10]);return t.copy=function(){return Cl(t,e()).base(t.base())},ll.O.apply(t,arguments)}),[tu,ru,Il]),hu(`${Hl}-${jl}`,Ml,[tu,ru]),hu(`${Hl}-${Ul}`,(function(){return Ml.apply(null,arguments).exponent(.5)}),[tu,ru]),hu(`${Hl}-${ql}`,(function e(){var t=kl(Sl());return t.copy=function(){return Cl(t,e()).constant(t.constant())},ll.O.apply(t,arguments)}),[tu,ru]),hu(`${Vl}-${Bl}`,(function e(){var t=(0,rl.Q)(Nl()(sl.yR));return t.copy=function(){return Cl(t,e())},ll.O.apply(t,arguments)}),[tu,ru]),hu(`${Vl}-${Il}`,(function e(){var t=ml(Nl()).domain([.1,1,10]);return t.copy=function(){return Cl(t,e()).base(t.base())},ll.O.apply(t,arguments)}),[tu,ru,Il]),hu(`${Vl}-${jl}`,zl,[tu,ru]),hu(`${Vl}-${Ul}`,(function(){return zl.apply(null,arguments).exponent(.5)}),[tu,ru]),hu(`${Vl}-${ql}`,(function e(){var t=kl(Nl());return t.copy=function(){return Cl(t,e()).constant(t.constant())},ll.O.apply(t,arguments)}),[tu,ru]),hu(Zl,(function e(){var t,n=[],i=[],r=[];function o(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e0?r[t-1]:n[0],t=r?[o[r-1],i]:[o[t-1],o[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return e().domain([n,i]).range(a).unknown(t)},ll.o.apply((0,rl.Q)(s),arguments)}),iu),hu(Yl,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[(0,il.ZP)(n,e,0,r)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),o):n.slice()},o.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),o):i.slice()},o.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},o.unknown=function(e){return arguments.length?(t=e,o):t},o.copy=function(){return e().domain(n).range(i).unknown(t)},ll.o.apply(o,arguments)}),iu),hu(eu,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[((0,il.ZP)(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return lu.call(e,De)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=uu.call(e),i):n.slice()},i.tickFormat=function(e,n){return(0,Rl.Z)(t[0],$e(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[nu,iu]),hu(Jl,Tl.Z,nu),hu(Kl,au,nu),hu(Ql,(function(){return su(au().paddingInner(1))}),nu);const _u=["clamp","base","constant","exponent"];function ku(e,t){const n=t[0],i=$e(t)-n;return function(t){return e(n+t*i)}}function Eu(e,t,n){return Ol.Z(Du(t||"rgb",n),e)}function Au(e,t){const n=new Array(t),i=t+1;for(let r=0;re[t]?a[t](e[t]()):0)),a):et(.5)}function Du(e,t){const n=Pl[function(e){return"interpolate"+e.toLowerCase().split("-").map((e=>e[0].toUpperCase()+e.slice(1))).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function Su(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i1?(Fu[e]=t,this):Fu[e]}Cu({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Su),Cu({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>Eu(Su(e))));const Ou="symbol",Nu="discrete",zu=e=>xe(e)?e.map((e=>String(e))):String(e),Tu=(e,t)=>e[1]-t[1],Ru=(e,t)=>t[1]-e[1];function Pu(e,t,n){let i;return mt(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(At(e.domain())/n||1)))),we(t)&&(i=t.step,t=t.interval),yt(t)&&(t=e.type===Wl?Kn(t):e.type==Gl?ei(t):re("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function Lu(e,t,n){let i=e.range(),r=i[0],o=$e(i),a=Tu;if(r>o&&(i=o,o=r,r=i,a=Ru),r=Math.floor(r),o=Math.ceil(o),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=o)).sort(a).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],$e(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function Bu(e,t){return e.bins?Lu(e,e.bins):e.ticks?e.ticks(t):e.domain()}function Iu(e,t,n,i,r,o){const a=t.type;let s=zu;if(a===Wl||r===Wl)s=e.timeFormat(i);else if(a===Gl||r===Gl)s=e.utcFormat(i);else if(bu(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=ju(t,n,!1);s=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();s=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(s=e.format(i));return s}function ju(e,t,n){const i=Bu(e,t),r=e.base(),o=Math.log(r),a=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/o));return t*rUu[e.type]||e.bins;function Hu(e,t,n,i,r,o,a){const s=qu[t.type]&&o!==Wl&&o!==Gl?function(e,t,n){const i=t[qu[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o(t,n,i)=>{const r=Zu(i[n+1],Zu(i.max,1/0)),o=Ju(t,e),a=Ju(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Zu=(e,t)=>null!=e?e:t,Xu=e=>(t,n)=>n?e(t):null,Yu=e=>t=>e(t),Ju=(e,t)=>Number.isFinite(e)?t(e):null;function Qu(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=function(e,t,n,i){const r=i||t.type;return yt(n)&&function(e){return mu(e,ou)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==Wl?n||r!==Gl?Hu(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}(e,t,n.format,n.formatType);if(vu(t.type)){const e=Wu(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(yu(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r($e(e))}`}}let Ku=0;const ec="p_";function tc(e){return e&&e.gradient}function nc(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?ec:"";return r||(r=e.id="gradient_"+Ku++,"radial"===i?(e.x1=ic(e.x1,.5),e.y1=ic(e.y1,.5),e.r1=ic(e.r1,0),e.x2=ic(e.x2,.5),e.y2=ic(e.y2,.5),e.r2=ic(e.r2,.5),o=ec):(e.x1=ic(e.x1,0),e.y1=ic(e.y1,0),e.x2=ic(e.x2,1),e.y2=ic(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function ic(e,t){return null!=e?e:t}function rc(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const oc={basis:{curve:Fs.ZP},"basis-closed":{curve:Ms.Z},"basis-open":{curve:Os.Z},bundle:{curve:Ns.Z,tension:"beta",value:.85},cardinal:{curve:zs.ZP,tension:"tension",value:0},"cardinal-open":{curve:Ts.Z,tension:"tension",value:0},"cardinal-closed":{curve:Rs.Z,tension:"tension",value:0},"catmull-rom":{curve:Ps.Z,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ls.Z,tension:"alpha",value:.5},"catmull-rom-open":{curve:Bs.Z,tension:"alpha",value:.5},linear:{curve:Is.Z},"linear-closed":{curve:js.Z},monotone:{horizontal:Us.s,vertical:Us.Z},natural:{curve:qs.Z},step:{curve:Ws.ZP},"step-after":{curve:Ws.cD},"step-before":{curve:Ws.RN}};function ac(e,t,n){var i=at(oc,e)&&oc[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const sc={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},lc=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,uc=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,cc=/^((\s+,?\s*)|(,\s*))/,fc=/^[01]/;function dc(e){const t=[];return(e.match(lc)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=sc[i],o=function(e,t,n){const i=[];for(let r=0;t&&r1&&(m=Math.sqrt(m),n*=m,i*=m);const g=d/n,y=f/n,v=-f/i,b=d/i,x=g*s+y*l,w=v*s+b*l,_=g*e+y*t,k=v*e+b*t;let E=1/((_-x)*(_-x)+(k-w)*(k-w))-.25;E<0&&(E=0);let A=Math.sqrt(E);o==r&&(A=-A);const $=.5*(x+_)-A*(k-w),D=.5*(w+k)+A*(_-x),S=Math.atan2(w-D,x-$);let C=Math.atan2(k-D,_-$)-S;C<0&&1===o?C+=mc:C>0&&0===o&&(C-=mc);const F=Math.ceil(Math.abs(C/(pc+.001))),M=[];for(let e=0;e+e}function Tc(e,t,n){return Math.max(t,Math.min(e,n))}function Rc(){var e=Fc,t=Mc,n=Oc,i=Nc,r=zc(0),o=r,a=r,s=r,l=null;function u(u,c,f){var d,h=null!=c?c:+e.call(this,u),p=null!=f?f:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,v=Tc(+r.call(this,u),0,y),b=Tc(+o.call(this,u),0,y),x=Tc(+a.call(this,u),0,y),w=Tc(+s.call(this,u),0,y);if(l||(l=d=(0,el.ET)()),v<=0&&b<=0&&x<=0&&w<=0)l.rect(h,p,m,g);else{var _=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(_-b,p),l.bezierCurveTo(_-Cc*b,p,_,p+Cc*b,_,p+b),l.lineTo(_,k-w),l.bezierCurveTo(_,k-Cc*w,_-Cc*w,k,_-w,k),l.lineTo(h+x,k),l.bezierCurveTo(h+Cc*x,k,h,k-Cc*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+Cc*v,h+Cc*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=zc(t),u):e},u.y=function(e){return arguments.length?(t=zc(e),u):t},u.width=function(e){return arguments.length?(n=zc(e),u):n},u.height=function(e){return arguments.length?(i=zc(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=zc(e),o=null!=t?zc(t):r,s=null!=n?zc(n):r,a=null!=i?zc(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function Pc(){var e,t,n,i,r,o,a,s,l=null;function u(e,t,n){const i=n/2;if(r){var u=a-t,c=e-o;if(u||c){var f=Math.sqrt(u*u+c*c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(o-d,a-h),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,p-Math.PI,p),l.lineTo(o+d,a+h),l.arc(o,a,s,p,p+Math.PI)}else l.arc(e,t,i,0,mc);l.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==l&&(l=c=(0,el.ET)()),a=0;a<=f;++a)!(ae.x||0,Ic=e=>e.y||0,jc=e=>!(!1===e.defined),Uc=(0,Gs.Z)().startAngle((e=>e.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),qc=Js().x(Bc).y1(Ic).y0((e=>(e.y||0)+(e.height||0))).defined(jc),Wc=Js().y(Ic).x1(Bc).x0((e=>(e.x||0)+(e.width||0))).defined(jc),Gc=(0,Zs.Z)().x(Bc).y(Ic).defined(jc),Hc=Rc().x(Bc).y(Ic).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>Lc(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>Lc(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>Lc(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>Lc(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),Vc=function(e,t){let n=null,i=(0,Xs.d)(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:(0,Vs.Z)(e||Ks),t="function"==typeof t?t:(0,Vs.Z)(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:(0,Vs.Z)(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:(0,Vs.Z)(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>Dc(e.shape||"circle"))).size((e=>Lc(e.size,64))),Zc=Pc().x(Bc).y(Ic).defined(jc).size((e=>e.size||1));function Xc(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Yc(e,t,n,i){return Hc.context(e)(t,n,i)}var Jc=1;function Qc(){Jc=1}function Kc(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+Jc++),a=r.clipping[o]||(r.clipping[o]={id:o});return Ve(i)?a.path=i(null):Xc(n)?a.path=Yc(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function ef(e){this.clear(),e&&this.union(e)}function tf(e){this.mark=e,this.bounds=this.bounds||new ef}function nf(e){tf.call(this,e),this.items=this.items||[]}function rf(e){this._pending=0,this._loader=e||sr()}function of(e){e._pending+=1}function af(e){e._pending-=1}function sf(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}ef.prototype={clone(){return new ef(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:a}=this,s=Math.cos(e),l=Math.sin(e),u=t-t*s+n*l,c=n-t*l-n*s;return[s*i-l*r+u,l*i+s*r+c,s*i-l*a+u,l*i+s*a+c,s*o-l*r+u,l*o+s*r+c,s*o-l*a+u,l*o+s*a+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},ct(nf,tf),rf.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return of(t),t._loader.sanitize(e,{context:"href"}).then((e=>(af(t),e))).catch((()=>(af(t),null)))},loadImage(e){const t=this,n=nl();return of(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=at(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>af(t),r.onerror=()=>af(t),r.src=i,r})).catch((e=>(af(t),{complete:!1,width:0,height:0,src:e&&e.url||""})))},ready(){const e=this;return new Promise((t=>{!function n(i){e.pending()?setTimeout((()=>{n(!0)}),10):t(i)}(!1)}))}};const lf=mc-1e-8;let uf,cf,ff,df,hf,pf,mf,gf;const yf=(e,t)=>uf.add(e,t),vf=(e,t)=>yf(cf=e,ff=t),bf=e=>yf(e,uf.y1),xf=e=>yf(uf.x1,e),wf=(e,t)=>hf*e+mf*t,_f=(e,t)=>pf*e+gf*t,kf=(e,t)=>yf(wf(e,t),_f(e,t)),Ef=(e,t)=>vf(wf(e,t),_f(e,t));function Af(e,t){return uf=e,t?(df=t*hc,hf=gf=Math.cos(df),pf=Math.sin(df),mf=-pf):(hf=gf=1,df=pf=mf=0),$f}const $f={beginPath(){},closePath(){},moveTo:Ef,lineTo:Ef,rect(e,t,n,i){df?(kf(e+n,t),kf(e+n,t+i),kf(e,t+i),Ef(e,t)):(yf(e+n,t+i),vf(e,t))},quadraticCurveTo(e,t,n,i){const r=wf(e,t),o=_f(e,t),a=wf(n,i),s=_f(n,i);Df(cf,r,a,bf),Df(ff,o,s,xf),vf(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=wf(e,t),s=_f(e,t),l=wf(n,i),u=_f(n,i),c=wf(r,o),f=_f(r,o);Sf(cf,a,l,c,bf),Sf(ff,s,u,f,xf),vf(c,f)},arc(e,t,n,i,r,o){if(i+=df,r+=df,cf=n*Math.cos(r)+e,ff=n*Math.sin(r)+t,Math.abs(r-i)>lf)yf(e-n,t-n),yf(e+n,t+n);else{const a=i=>yf(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=mc)<0&&(i+=mc),(r%=mc)<0&&(r+=mc),rr;++l,s-=pc)a(s);else for(s=i-i%pc+pc,l=0;l<4&&s1e-14?(l=a*a+s*o,l>=0&&(l=Math.sqrt(l),u=(-a+l)/o,c=(-a-l)/o)):u=.5*s/a,0g)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(e.globalAlpha=n,e.fillStyle=If(e,t,t.fill),!0)}var Uf=[];function qf(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&(n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=If(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Uf),e.lineDashOffset=t.strokeDashOffset||0),!0)}function Wf(e,t){return e.zindex-t.zindex||e.index-t.index}function Gf(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n=0;)if(n=t(r[i]))return n;if(r===o)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function Zf(e){return function(t,n,i){Hf(n,(n=>{i&&!i.intersects(n.bounds)||Yf(e,t,n,n)}))}}function Xf(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Yf(e,t,n.items[0],n.items)}}function Yf(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(Pf(t,n),n.fill&&jf(t,n,r)&&t.fill(),n.stroke&&qf(t,n,r)&&t.stroke()))}function Jf(e){return e=e||fe,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,Vf(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return e(t,n,i,r,o,a)?n:void 0}))}}function Qf(e,t){return function(n,i,r,o){var a,s,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(a=l.strokeWidth,s=l.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Kf(e){return Jf(Qf(e))}function ed(e,t){return"translate("+e+","+t+")"}function td(e){return"rotate("+e+")"}function nd(e){return ed(e.x||0,e.y||0)}function id(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,o=n.angle||0;e.translate(i,r),o&&e.rotate(o*=hc),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return ed(e.x||0,e.y||0)+(e.angle?" "+td(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(Af(e,n.angle),n),sf(e,n).translate(n.x||0,n.y||0)},draw:Zf(i),pick:Kf(i),isect:n||Of(i)}}var rd=id("arc",(function(e,t){return Uc.context(e)(t)}));function od(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=Qf(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(Af(e),i),sf(e,i[0]))},draw:Xf(i),pick:function(e,t,n,i,o,a){var s=t.items,l=t.bounds;return!s||!s.length||l&&!l.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:Nf,tip:n}}var ad=od("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?Wc:qc).curve(ac(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,s=1/0;--a>=0;)!1!==e[a].defined&&(i=Math.abs(e[a][o]-r)).5&&t<1.5?.5-Math.abs(t-1):0}function ud(e,t){const n=ld(t);e("d",Yc(null,t,n,n))}function cd(e,t,n,i){const r=ld(t);e.beginPath(),Yc(e,t,(n||0)+r,(i||0)+r)}const fd=Qf(cd),dd=Qf(cd,!1),hd=Qf(cd,!0);var pd={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",nd(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t{const i=t.x||0,r=t.y||0,o=t.strokeForeground,a=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&a&&(cd(e,t,i,r),Pf(e,t),t.fill&&jf(e,t,a)&&e.fill(),t.stroke&&!o&&qf(e,t,a)&&e.stroke()),e.save(),e.translate(i,r),t.clip&&sd(e,t),n&&n.translate(-i,-r),Hf(t,(t=>{this.draw(e,t,n)})),n&&n.translate(i,r),e.restore(),o&&t.stroke&&a&&(cd(e,t,i,r),Pf(e,t),qf(e,t,a)&&e.stroke())}))},pick:function(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const a=n*e.pixelRatio,s=i*e.pixelRatio;return Vf(t,(l=>{let u,c,f;const d=l.bounds;if(d&&!d.contains(r,o))return;c=l.x||0,f=l.y||0;const h=c+(l.width||0),p=f+(l.height||0),m=l.clip;if(m&&(rh||op))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Xc(l)&&!hd(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&dd(e,l,a,s)?(e.restore(),l):(u=Vf(l,(e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,f)?this.pick(e,n,i,c,f):null)),!u&&y&&(l.fill||!g&&l.stroke)&&fd(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:zf,content:function(e,t,n){e("clip-path",t.clip?Kc(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),ud(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?ud(e,t):e("d","")}},md={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function gd(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((t=>{e.image=t,e.image.url=e.url}))),n}function yd(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function vd(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function bd(e,t){return"center"===e?t/2:"right"===e?t:0}function xd(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var wd={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=gd(t,n),r=yd(t,i),o=vd(t,i),a=(t.x||0)-bd(t.align,r),s=(t.y||0)-xd(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",md["xmlns:xlink"],"xlink:href"),e("transform",ed(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=yd(t,n),r=vd(t,n),o=(t.x||0)-bd(t.align,i),a=(t.y||0)-xd(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){Hf(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=gd(t,this);let r=yd(t,i),o=vd(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-bd(t.align,r),f=(t.y||0)-xd(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,l=t.width/t.height,s==s&&l==l&&s!==l&&(l=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&Dd(e,t,i)&&(Pf(e,t),e.stroke())}}))},pick:Jf((function(e,t,n,i){return!!e.isPointInStroke&&Dd(e,t,1)&&e.isPointInStroke(n,i)})),isect:Tf},Cd=id("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),Fd=id("symbol",(function(e,t){return Vc.context(e)(t)}),Nf);const Md=wt();var Od={height:Ld,measureWidth:Rd,estimateWidth:zd,width:zd,canvas:Nd};function Nd(e){Od.width=e&&Ff?Rd:zd}function zd(e,t){return Td(Ud(e,t),Ld(e))}function Td(e,t){return~~(.8*e.length*t)}function Rd(e,t){return Ld(e)<=0||!(t=Ud(e,t))?0:Pd(t,Wd(e))}function Pd(e,t){const n=`(${t}) ${e}`;let i=Md.get(n);return void 0===i&&(Ff.font=t,i=Ff.measureText(e).width,Md.set(n,i)),i}function Ld(e){return null!=e.fontSize?+e.fontSize||0:11}function Bd(e){return null!=e.lineHeight?e.lineHeight:Ld(e)+2}function Id(e){return t=e.lineBreak&&e.text&&!xe(e.text)?e.text.split(e.lineBreak):e.text,xe(t)?t.length>1?t:t[0]:t;var t}function jd(e){const t=Id(e);return(xe(t)?t.length-1:0)*Bd(e)}function Ud(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(Od.width===Rd){const t=Wd(e);return e=>Pd(e,t)}{const t=Ld(e);return e=>Td(e,t)}}(e);if(i(t)>>1,i(t.slice(r))>n?s=r+1:l=r;return o+t.slice(s)}for(;s>>1),i(t.slice(0,r))Math.max(e,Od.width(t,n))),0)):i=Od.width(t,f),"center"===o?u-=i/2:"right"===o&&(u-=i),e.set(u+=s,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*hc,s,l);else if(2===n)return e.rotatedPoints(t.angle*hc,s,l);return e}var Yd={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+Gd(t),o=Zd(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",Hd[t.align]||"start"),l?(n=ed(a,s)+" "+td(l),(i||r)&&(n+=" "+ed(i,r))):n=ed(a+i,s+r),e("transform",n)},bound:Xd,draw:function(e,t,n){Hf(t,(t=>{var i,r,o,a,s,l,u,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=Wd(t),e.textAlign=t.align||"left",r=(i=Zd(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*hc),r=o=0),r+=t.dx||0,o+=(t.dy||0)+Gd(t),l=Id(t),Pf(e,t),xe(l))for(s=Bd(t),a=0;a=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null})),Qd={arc:rd,area:ad,group:pd,image:wd,line:_d,path:Ed,rect:$d,rule:Sd,shape:Cd,symbol:Fd,text:Yd,trail:Jd};function Kd(e,t,n){var i=Qd[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new ef),e,n)}var eh={mark:null};function th(e,t,n){var i,r,o,a,s=Qd[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(eh.mark=e,o=eh),a=Kd(o,l,n),t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new ef,c)for(i=0,r=u.length;it;)e.removeChild(n[--i]);return e}function dh(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function hh(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function ph(e,t){this._active=null,this._handlers={},this._loader=e||sr(),this._tooltip=t||mh}function mh(e,t,n,i){e.element().setAttribute("title",i||"")}function gh(e){this._el=null,this._bgcolor=null,this._loader=new rf(e)}ah.prototype={toJSON(e){return ih(this.root,e||0)},mark(e,t,n){const i=sh(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},ph.prototype={initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1},handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const e in t)n.push(...t[e]);return n},eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)},handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((t=>{const n=new MouseEvent(e.type,e),i=lh(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)})).catch((()=>{}))},handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,o,a=e&&e.mark;if(a&&(r=Qd[a.marktype]).tip){for((o=hh(t,n))[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=r.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}},getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,o=r.width(),a=r.height();let s=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,l+=e.y||0;return{x:s,y:l,width:o,height:a,left:s,top:l,right:s+o,bottom:l+a}}},gh.prototype={initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this},dirty(){},render(e){const t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},_render(){},renderAsync(e){const t=this.render(e);return this._ready?this._ready.then((()=>t)):Promise.resolve(t)},_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then((t=>{t&&e(),n._ready=null}))}return i},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};const yh="dragenter",vh="dragleave",bh="dragover",xh="mousedown",wh="mousemove",_h="mouseout",kh="mouseover",Eh="click",Ah="mousewheel",$h="touchstart",Dh="touchmove",Sh="touchend",Ch=wh,Fh=_h,Mh=Eh;function Oh(e,t){ph.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function Nh(e,t){(e=>e===$h||e===Dh||e===Sh?[$h,Dh,Sh]:[e])(t).forEach((t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t)))}function zh(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||this.fire(n,i),this._active=o,this.fire(t,i)),this.fire(e,i)}}function Th(e){return function(t){this.fire(e,t),this._active=null}}ct(Oh,ph,{initialize(e,t,n){return this._canvas=e&&uh(e,"canvas"),[Eh,xh,wh,_h,vh].forEach((e=>Nh(this,e))),ph.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",yh,vh,bh,xh,"mouseup",wh,_h,kh,Eh,"dblclick","wheel",Ah,$h,Dh,Sh],DOMMouseScroll(e){this.fire(Ah,e)},mousemove:zh(wh,kh,_h),dragover:zh(bh,yh,vh),mouseout:Th(_h),dragleave:Th(vh),mousedown(e){this._down=this._active,this.fire(xh,e)},click(e){this._down===this._active&&(this.fire(Eh,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire($h,e,!0)},touchmove(e){this.fire(Dh,e,!0)},touchend(e){this.fire(Sh,e,!0),this._touch=null},fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===Mh&&i&&i.href?this.handleHref(t,i,i.href):e!==Ch&&e!==Fh||this.handleTooltip(t,i,e!==Fh),r)for(let e=0,n=r.length;e=0&&i.splice(r,1),this},pickEvent(e){const t=hh(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},pick(e,t,n,i,r){const o=this.context();return Qd[e.marktype].pick.call(this,o,e,t,n,i,r)}});var Rh="undefined"!=typeof window&&window.devicePixelRatio||1;function Ph(e){gh.call(this,e),this._options={},this._redraw=!1,this._dirty=new ef,this._tempb=new ef}const Lh=gh.prototype;function Bh(e,t){ph.call(this,e,t);const n=this;n._hrefHandler=Ih(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=Ih(n,((e,t)=>{n.handleTooltip(e,t,e.type!==Fh)}))}ct(Ph,gh,{initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:tl(1,1,this._options.type),e&&this._canvas&&(fh(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Lh.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if(Lh.resize.call(this,e,t,n,i),this._canvas)!function(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=a?Rh:r;e.width=t*l,e.height=n*l;for(const e in o)s[e]=o[e];a&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||re("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)},_render(e){const t=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty,a=((e,t,n)=>(new ef).set(0,0,t,n).translate(-e[0],-e[1]))(n,i,r);t.save();const s=this._redraw||o.empty()?(this._redraw=!1,a.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,a.intersect(o),n);return this.clear(-n[0],-n[1],i,r),this.draw(t,e,s),t.restore(),o.clear(),this},draw(e,t,n){const i=Qd[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Ve(n)?(e.beginPath(),n(e),e.clip()):sd(e,t.group)}(e,t),i.draw.call(this,e,t,n),t.clip&&e.restore()},clear(e,t,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(e,t,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(e,t,n,i))}});const Ih=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)};ct(Bh,ph,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(Mh,this._hrefHandler),i.removeEventListener(Ch,this._tooltipHandler),i.removeEventListener(Fh,this._tooltipHandler)),this._svg=i=e&&uh(e,"svg"),i&&(i.addEventListener(Mh,this._hrefHandler),i.addEventListener(Ch,this._tooltipHandler),i.addEventListener(Fh,this._tooltipHandler)),ph.prototype.initialize.call(this,e,t,n)},canvas(){return this._svg},on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:Ih(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}});const jh="aria-hidden",Uh="aria-label",qh="role",Wh="aria-roledescription",Gh="graphics-object",Hh="graphics-symbol",Vh=(e,t,n)=>({[qh]:e,[Wh]:t,[Uh]:n||void 0}),Zh=Mt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Xh={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?ep(e):null,r=e.context,o=r.scales[t.scale].value,a=r.dataflow.locale(),s=o.type;return`${"left"===n||"right"===n?"Y":"X"}-axis`+(i?` titled '${i}'`:"")+` for a ${yu(s)?"discrete":s} scale`+` with ${Qu(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?ep(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,l=a.dataflow.locale();return((u=i).length?u[0].toUpperCase()+u.slice(1):u)+(n?` titled '${n}'`:"")+` for ${function(e){return(e=e.map((e=>e+("fill"===e||"stroke"===e?" color":"")))).length<2?e[0]:e.slice(0,-1).join(", ")+" and "+$e(e)}(o)}`+` with ${Qu(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${Kh(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Kh(e)}'`}},Yh={ariaRole:qh,ariaRoleDescription:Wh,description:Uh};function Jh(e,t){const n=!1===t.aria;if(e(jh,n||void 0),n||null==t.description)for(const t in Yh)e(Yh[t],void 0);else{const n=t.mark.marktype;e(Uh,t.description),e(qh,t.ariaRole||("group"===n?Gh:Hh)),e(Wh,t.ariaRoleDescription||`${n} mark`)}}function Qh(e){return!1===e.aria?{[jh]:!0}:Zh[e.role]?null:Xh[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return Vh(t.role||Hh,t.desc,n.description||i(n))}catch(e){return null}}(e,Xh[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return Vh(n?Gh:Hh,`${t} mark container`,e.description)}(e)}function Kh(e){return Ge(e.text).join(" ")}function ep(e){try{return Ge($e(e.items).items[0].text).join(" ")}catch(e){return null}}const tp=e=>(e+"").replace(/&/g,"&").replace(//g,">"),np=e=>tp(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function ip(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>(null!=n&&(t+=` ${e}="${np(n)}"`),a),a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c${n}`:"/>"):``,r(),a},attr:o,text:e=>(n+=tp(e),a),toString:()=>e};return a}const rp=e=>op(ip(),e)+"";function op(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}ct(fp,gh,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=ch(e,0,"svg",cp),this._svg.setAttributeNS(up,"xmlns",cp),this._svg.setAttributeNS(up,"xmlns:xlink",md["xmlns:xlink"]),this._svg.setAttribute("version",md.version),this._svg.setAttribute("class","marks"),fh(e,1),this._root=ch(this._svg,0,"g",cp),_p(this._root,lp),fh(this._svg,1)),this.background(this._bgcolor),dp.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),dp.background.apply(this,arguments)},resize(e,t,n,i){return dp.resize.call(this,e,t,n,i),this._svg&&(_p(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=ch(e,0,"rect",cp),_p(n,{width:this._width,height:this._height,fill:t}));const i=rp(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i},_render(e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e),fh(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,l;for(a=0,s=e.length;a{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.removeChild(n._svg)),n._svg=null):(n=o.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,hp(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n){if(!this.isDirty(t))return t._svg;const i=this._svg,r=Qd[t.marktype],o=!1===t.interactive?"none":null,a="g"===r.tag,s=gp(t,e,n,"g",i);s.setAttribute("class",dh(t));const l=Qh(t);for(const e in l)kp(s,e,l[e]);a||kp(s,"pointer-events",o),kp(s,"clip-path",t.clip?Kc(this,t,t.group):null);let u=null,c=0;const f=e=>{const t=this.isDirty(e),n=gp(e,s,u,r.tag,i);t&&(this._update(r,n,e),a&&function(e,t,n){t=t.lastChild.previousSibling;let i,r=0;Hf(n,(n=>{i=e.mark(t,n,i),++r})),fh(t,1+r)}(this,n,e)),u=n,++c};return r.nested?t.items.length&&f(t.items[0]):Hf(t,f),fh(s,c),s},_update(e,t,n){yp=t,vp=t.__values__,Jh(xp,n),e.attr(xp,n,this);const i=bp[e.type];i&&i.call(this,e,t,n),yp&&this.style(yp,n)},style(e,t){if(null!=t){for(const n in ap){let i="font"===n?qd(t):t[n];if(i===vp[n])continue;const r=ap[n];null==i?e.removeAttribute(r):(tc(i)&&(i=nc(i,this._defs.gradient,Ep())),e.setAttribute(r,i+"")),vp[n]=i}for(const n in sp)wp(e,sp[n],t[n])}},defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=ch(e,1,"defs",cp)),i=pp(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=ch(e,1,"defs",cp)),i=mp(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):fh(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let yp=null,vp=null;const bp={group(e,t,n){const i=yp=t.childNodes[2];vp=i.__values__,e.foreground(xp,n,this),vp=t.__values__,yp=t.childNodes[1],e.content(xp,n,this);const r=yp=t.childNodes[0];e.background(xp,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==vp.events&&(kp(i,"pointer-events",o),kp(r,"pointer-events",o),vp.events=o),n.strokeForeground&&n.stroke){const e=n.fill;kp(i,"display",null),this.style(r,n),kp(r,"stroke",null),e&&(n.fill=null),vp=i.__values__,this.style(i,n),e&&(n.fill=e),yp=null}else kp(i,"display","none")},image(e,t,n){!1===n.smooth?(wp(t,"image-rendering","optimizeSpeed"),wp(t,"image-rendering","pixelated")):wp(t,"image-rendering",null)},text(e,t,n){const i=Id(n);let r,o,a,s;xe(i)?(o=i.map((e=>Ud(n,e))),r=o.join("\n"),r!==vp.text&&(fh(t,0),a=t.ownerDocument,s=Bd(n),o.forEach(((e,i)=>{const r=lh(a,"tspan",cp);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),vp.text=r)):(o=Ud(n,i),o!==vp.text&&(t.textContent=o,vp.text=o)),kp(t,"font-family",qd(n)),kp(t,"font-size",Ld(n)+"px"),kp(t,"font-style",n.fontStyle),kp(t,"font-variant",n.fontVariant),kp(t,"font-weight",n.fontWeight)}};function xp(e,t,n){t!==vp[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(yp,e,t,n):kp(yp,e,t),vp[e]=t)}function wp(e,t,n){n!==vp[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),vp[t]=n)}function _p(e,t){for(const n in t)kp(e,n,t[n])}function kp(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function Ep(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function Ap(e){gh.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}ct(Ap,gh,{svg(){return this._text},_render(e){const t=ip();t.open("svg",nt({},md,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",lp,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=Qd[t.marktype],i=n.tag,r=[Jh,n.attr];e.open("g",{class:dh(t),"clip-path":t.clip?Kc(this,t,t.group):null},Qh(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&e.open("a",a),e.open(i,this.attr(t,o,r,"g"!==i?i:null)),"text"===i){const t=Id(o);if(xe(t)){const n={x:0,dy:Bd(o)};for(let i=0;ithis.mark(e,t))),e.close(),i&&a?(r&&(o.fill=null),o.stroke=a,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),r&&(o.fill=r)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),a&&e.close()};return n.nested?t.items&&t.items.length&&o(t.items[0]):Hf(t,o),e.close()},href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e}))}return null},attr(e,t,n,i){const r={},o=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(o,t,this))):n(o,t,this),i&&function(e,t,n,i,r){let o;if(null==t)return e;if("bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none"),"bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===i&&(e["font-family"]=qd(t),e["font-size"]=Ld(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in ap){let i=t[n];const o=ap[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(tc(i)&&(i=nc(i,r.gradient,"")),e[o]=i)}for(const e in sp){const n=t[e];null!=n&&(o=o||[],o.push(`${sp[e]}: ${n};`))}o&&(e.style=o.join(" "))}(r,t,e,i,this._defs),r},defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:ec+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t1?(Cp[e]=t,this):Cp[e]}function Mp(e,t,n){const i=[],r=(new ef).union(t),o=e.marktype;return o?Op(e,r,n,i):"group"===o?Np(e,r,n,i):re("Intersect scene must be mark node or group item.")}function Op(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,o=e.marktype,a=r.length;let s=0;if("group"===o)for(;s=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!Lp(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function Bp(e,t){return Lp(dc(e),dc(t))}function Ip(){Qc(),Ku=0}const jp="top",Up="left",qp="right",Wp="bottom",Gp="start",Hp="middle",Vp="end",Zp="x",Xp="y",Yp="group",Jp="axis",Qp="title",Kp="legend",em="row-header",tm="row-footer",nm="row-title",im="column-header",rm="column-footer",om="column-title",am="fit-x",sm="fit-y",lm="none",um="all",cm="each",fm="flush",dm="column",hm="row";function pm(e){Gr.call(this,null,e)}function mm(e,t,n){return t(e.bounds.clear(),e,n)}ct(pm,Gr,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=Qd[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=mm(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===Yp||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(mm(e,a)))),i.role){case Jp:case Kp:case Qp:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(mm(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(mm(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return Rp(i),t.modifies("bounds")}});const gm=":vega_identifier:";function ym(e){Gr.call(this,0,e)}function vm(e){Gr.call(this,null,e)}function bm(e){Gr.call(this,null,e)}ym.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ct(ym,Gr,{transform(e,t){const n=(r=t.dataflow)._signals[gm]||(r._signals[gm]=r.add(0)),i=e.as;var r;let o=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++o)),n.set(this.value=o),t}}),ct(vm,Gr,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===Yp?nf:tf;return t.visit(t.ADD,(e=>i.call(e,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const xm={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&wm(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},wm=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),_m=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i{const t=e.bounds;return t.width()>1&&t.height()>1},Em=e=>(e.forEach((e=>e.opacity=1)),e),Am=(e,t)=>e.reflow(t.modified()).modifies("opacity");function $m(e){Gr.call(this,null,e)}ct(bm,Gr,{transform(e,t){const n=xm[e.method]||xm.parity,i=e.separation||0;let r,o,a=t.materialize(t.SOURCE).source;if(!a||!a.length)return;if(!e.method)return e.modified("method")&&(Em(a),t=Am(t,e)),t;if(a=a.filter(km),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=Em(a),t=Am(t,e),r.length>=3&&_m(r,i)){do{r=n(r,i)}while(r.length>=3&&_m(r,i));r.length<3&&!$e(a).opacity&&(r.length>1&&($e(r).opacity=0),$e(a).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=((e,t,n)=>{var i=e.range(),r=new ef;return t===jp||t===Wp?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),e=>r.encloses(e.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),a.forEach((e=>{o(e)||(e.opacity=0)})));const s=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&s.union(e.bounds)})),t}}),ct($m,Gr,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,(e=>n.dirty(e))),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const Dm=new ef;function Sm(e,t,n){return e[t]===n?0:(e[t]=n,1)}function Cm(e){var t=e.items[0].orient;return t===Up||t===qp}function Fm(e,t,n,i){var r,o,a=t.items[0],s=a.datum,l=null!=a.translate?a.translate:.5,u=a.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,b=g&&jd(g),x=0,w=0;switch(Dm.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(a.items[r].bounds),(r=c[1])>-1&&v.union(a.items[r].bounds),u){case jp:x=h||0,w=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&Mm(e,g,o,y,b,0,-1,v);break;case Up:x=-d,w=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&Mm(e,g,o,y,b,1,-1,v);break;case qp:x=n+d,w=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&Mm(e,g,o,y,b,1,1,v);break;case Wp:x=h||0,w=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&Mm(e,g,o,y,0,0,1,v);break;default:x=a.x,w=a.y}return sf(v.translate(x,w),a),Sm(a,"x",x+l)|Sm(a,"y",w+l)&&(a.bounds=Dm,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function Mm(e,t,n,i,r,o,a,s){const l=t.bounds;if(t.auto){const s=a*(n+r+i);let u=0,c=0;e.dirty(t),o?u=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}s.union(l)}const Om=(e,t)=>Math.floor(Math.min(e,t)),Nm=(e,t)=>Math.ceil(Math.max(e,t));function zm(e){return(new ef).set(0,0,e.width||0,e.height||0)}function Tm(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function Rm(e,t,n){const i=we(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function Pm(e){return e<0?Math.ceil(-e):0}function Lm(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===fm?zm:Tm,g=Dm.set(0,0,0,0),y=Rm(n.align,dm),v=Rm(n.align,hm),b=Rm(n.padding,dm),x=Rm(n.padding,hm),w=n.columns||t.length,_=w<=0?1:Math.ceil(t.length/w),k=t.length,E=Array(k),A=Array(w),$=0,D=Array(k),S=Array(_),C=0,F=Array(k),M=Array(k),O=Array(k);for(r=0;r1)for(r=0;r0&&(F[r]+=f/2);if(v&&Rm(n.center,hm)&&1!==w)for(r=0;r0&&(M[r]+=d/2);for(r=0;rr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=o,m=0,y=t.length;m=0&&null==(x=n[g]);g-=d);s?(w=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),_=E):(w=E,_=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(w-(b.x||0),_-(b.y||0))),b.x=w,b.y=_,e.dirty(b),A=a(A,v[u])}return A}function Um(e,t,n,i,r,o){if(t){e.dirty(t);var a=n,s=n;i?a=Math.round(r.x1+o*r.width()):s=Math.round(r.y1+o*r.height()),t.bounds.translate(a-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=s,e.dirty(t)}}function qm(e,t,n,i,r,o,a){const s=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),l=function(e,t){let n=-1/0;return e.forEach((e=>{null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,s("offset",0)),u=s("anchor",Gp),c=u===Vp?1:u===Hp?.5:0,f={align:cm,bounds:s("bounds",fm),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case Up:f.anchor={x:Math.floor(i.x1)-l,column:Vp,y:c*(a||i.height()+2*i.y1),row:u};break;case qp:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case jp:f.anchor={y:Math.floor(r.y1)-l,row:Vp,x:c*(o||r.width()+2*r.x1),column:u};break;case Wp:f.anchor={y:Math.ceil(r.y2)+l,x:c*(o||r.width()+2*r.x1),column:u};break;case"top-left":f.anchor={x:l,y:l};break;case"top-right":f.anchor={x:o-l,y:l,column:Vp};break;case"bottom-left":f.anchor={x:l,y:a-l,row:Vp};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:Vp,row:Vp}}return f}function Wm(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,l=r.x,u=r.y;return r._bounds?r._bounds.clear().union(s):r._bounds=s.clone(),s.clear(),function(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(t.datum.title){var a=t.items[1].items[0],s=a.anchor,l=t.titlePadding||0,u=i-a.x,c=i-a.y;switch(a.orient){case Up:r+=Math.ceil(a.bounds.width())+l;break;case qp:case Wp:break;default:o+=a.bounds.height()+l}switch((r||o)&&Hm(e,n,r,o),a.orient){case Up:c+=Gm(t,n,a,s,1,1);break;case qp:u+=Gm(t,n,a,Vp,0,0)+l,c+=Gm(t,n,a,s,1,1);break;case Wp:u+=Gm(t,n,a,s,0,0),c+=Gm(t,n,a,Vp,-1,0,1)+l;break;default:u+=Gm(t,n,a,s,0,0)}(u||c)&&Hm(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(Hm(e,n,-u,0),Hm(e,a,-u,0))}else(r||o)&&Hm(e,n,r,o)}(e,r,r.items[0].items[0]),s=function(e,t){return e.items.forEach((e=>t.union(e.bounds))),t.x1=e.padding,t.y1=e.padding,t}(r,s),n=2*r.padding,i=2*r.padding,s.empty()||(n=Math.ceil(s.width()+n),i=Math.ceil(s.height()+i)),"symbol"===o.type&&function(e){const t=e.reduce(((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e)),{});e.forEach((e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y}))}(r.items[0].items[0].items[0].items),a!==lm&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,sf(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function Gm(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!s||!o&&l||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&o?u:0,f=l&&o?0:u,d=r<=0?0:jd(n);return Math.round(i===Gp?c:i===Vp?f-d:.5*(u-d))}function Hm(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function Vm(e){Gr.call(this,null,e)}function Zm(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function Xm(e){Gr.call(this,null,e)}function Ym(e){Gr.call(this,null,e)}function Jm(){return mr({})}function Qm(e){Gr.call(this,null,e)}function Km(e){Gr.call(this,[],e)}ct(Vm,Gr,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&function(e,t,n){var i,r,o,a,s,l,u,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o{(o=e.orient||qp)!==lm&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];Lm(e,r,qm(r,i,n.legends,d,h,u,c))}p.forEach((t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||"fit"!==n.autosize.type&&n.autosize.type!==am&&n.autosize.type!==sm)f.union(i);else switch(t.orient){case Up:case qp:f.add(i.x1,0).add(i.x2,0);break;case jp:case Wp:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var o,a=t.items[0],s=a.frame,l=a.orient,u=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=l===Up||l===qp?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Yp?l===Up?(m=r.y2,p=r.y1):l===qp?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===Up&&(m=i,p=0),o=u===Gp?m:u===Vp?p:(m+p)/2,h&&h.text){switch(l){case jp:case Wp:b=d.bounds.height()+f;break;case Up:v=d.bounds.width()+f;break;case qp:v=-d.bounds.width()-f}Dm.clear().union(h.bounds),Dm.translate(v-(h.x||0),b-(h.y||0)),Sm(h,"x",v)|Sm(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(Dm),h.mark.bounds.clear().union(Dm),e.dirty(h)),Dm.clear().union(h.bounds)}else Dm.clear();switch(Dm.union(d.bounds),l){case jp:g=o,y=r.y1-Dm.height()-c;break;case Up:g=r.x1-Dm.width()-c,y=o;break;case qp:g=r.x2+Dm.width()+c,y=o;break;case Wp:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return Sm(a,"x",g)|Sm(a,"y",y)&&(Dm.translate(g,y),e.dirty(a),a.bounds.clear().union(Dm),t.bounds.clear().union(Dm),e.dirty(a)),a.bounds}(e,i,u,c,f)),t.clip&&f.set(0,0,t.width||0,t.height||0),function(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let a=e._width,s=e._height,l=Math.max(0,t.width||0),u=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-l)),h=Math.max(0,Math.ceil(n.y2-c));if("padding"===r.contains){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===lm?(u=0,f=0,l=a,c=s):"fit"===o?(l=Math.max(0,a-u-d),c=Math.max(0,s-f-h)):o===am?(l=Math.max(0,a-u-d),s=c+f+h):o===sm?(a=l+u+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=l+u+d,s=c+f+h),e._resizeView(a,s,l,c,[u,f],r.resize)}(e,t,f,n)}(n,t,e)})),function(e){return e&&"legend-entry"!==e.mark.role}(e.mark.group)?t.reflow():t}}),ct(Xm,Gr,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,a=Pu(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||Iu(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?Lu(o,e.values,a):Bu(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>mr({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(mr({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),ct(Ym,Gr,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||Jm,o=e.key||hr,a=this.value;return xe(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&re("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=lt().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(o)),t.visit(t.ADD,(e=>{const t=o(e);let n=a.get(t);n?n.exit?(a.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),a.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=o(e),n=a.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=o(e),n=a.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),i}}),ct(Qm,Gr,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(xe(o)){if(!n.changed()&&!o.every((e=>r[e])))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=r.update||de,l=r.enter||de,u=r.exit||de,c=(o&&!a?r[o]:s)||de;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{l(t,e),s(t,e)})),n.modifies(l.output),n.modifies(s.output),c!==de&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&u!==de&&(t.visit(t.REM,(t=>{u(t,e)})),n.modifies(u.output)),a||c!==de){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=l(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(l.output)):t.visit(r,(t=>{(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}}),ct(Km,Gr,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,a,s=t.dataflow.locale(),l=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=this.value,c=e.type||Ou,f=e.scale,d=+e.limit,h=Pu(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===Ou,m=e.format||Hu(s,f,h,c,e.formatSpecifier,e.formatType,p),g=e.values||Wu(f,h);return u&&(l.rem=u),c===Ou?(d&&g.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),u=g.slice(0,d-1),a=!0):u=g,Ve(r=e.size)?(e.values||0!==f(u[0])||(u=u.slice(1)),o=u.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=et(o=r||8),u=u.map(((t,n)=>mr({index:n,label:m(t,n,u),value:t,offset:o,size:r(t,e)}))),a&&(a=g[u.length],u.push(mr({index:u.length,label:`…${g.length-u.length} entries`,value:a,offset:o,size:r(a,e)})))):"gradient"===c?(n=f.domain(),i=$u(f,n[0],$e(n)),g.length<3&&!e.values&&n[0]!==$e(n)&&(g=[n[0],$e(n)]),u=g.map(((e,t)=>mr({index:t,label:m(e,t,g),value:e,perc:i(e)})))):(r=g.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+$e(t),o=r-i;if(e.type===Yl){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(f),u=g.map(((e,t)=>mr({index:t,label:m(e,t,g),value:e,perc:t?i(e):0,perc2:t===r?1:i(g[t+1])})))),l.source=u,l.add=u,this.value=u,l}});const eg=e=>e.source.x,tg=e=>e.source.y,ng=e=>e.target.x,ig=e=>e.target.y;function rg(e){Gr.call(this,{},e)}rg.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"}]},ct(rg,Gr,{transform(e,t){var n=e.sourceX||eg,i=e.sourceY||tg,r=e.targetX||ng,o=e.targetY||ig,a=e.as||"path",s=e.orient||"vertical",l=e.shape||"line",u=lg.get(l+"-"+s)||lg.get(l);return u||re("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=u(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const og=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,ag=(e,t,n,i)=>{var r=n-e,o=i-t,a=Math.hypot(r,o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,r)/Math.PI+" 0 1 "+n+","+i},sg=(e,t,n,i)=>{const r=n-e,o=i-t,a=.2*(r+o),s=.2*(o-r);return"M"+e+","+t+"C"+(e+a)+","+(t+s)+" "+(n+s)+","+(i-a)+" "+n+","+i},lg=lt({line:og,"line-radial":(e,t,n,i)=>og(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:ag,"arc-radial":(e,t,n,i)=>ag(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:sg,"curve-radial":(e,t,n,i)=>sg(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*a+","+t*s+"L"+i*a+","+i*s},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=(t+i)/2;return"M"+t*r+","+t*o+"C"+l*r+","+l*o+" "+l*a+","+l*s+" "+i*a+","+i*s}});function ug(e){Gr.call(this,null,e)}ug.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"]}]},ct(ug,Gr,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||ce,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(l),h=d.length,p=u,m=(c-u)/Zm(d),g=(0,ia.Z)(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;ne+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+$t(t)));return t}function pg(e,t,n){return Ve(e)&&(t||n)?ku(e,mg(t||[0,1],n)):e}function mg(e,t){return t?e.slice().reverse():e}function gg(e){Gr.call(this,null,e)}ct(dg,Gr,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";return n===Hl?Hl+"-"+Bl:(function(e){const t=e.type;return gu(t)&&t!==Wl&&t!==Gl&&(e.scheme||e.range&&e.range.length&&e.range.every(yt))}(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?Hl+"-":3===t?Vl+"-":""),(i+n||Bl).toLowerCase())}(e);for(r in i&&r===i.type||(this.value=i=hu(r)()),e)if(!fg[r]){if("padding"===r&&cg(i.type))continue;Ve(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){e!==Kl&&e!==Ql&&re("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===Ql?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Ll(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;return xe(t.scheme)?i=Eu(t.scheme,t.interpolate,t.interpolateGamma):(i=Mu(t.scheme.toLowerCase()))||re(`Unrecognized scheme name: ${t.scheme}`),n=e===Yl?n+1:e===eu?n-1:e===Zl||e===Xl?+t.schemeCount||5:n,xu(e)?pg(i,r,t.reverse):Ve(i)?Au(pg(i,r),n):e===Jl?i:i.slice(0,n)}(i,t,n),Ve(o))){if(e.interpolator)return e.interpolator(o);re(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&xu(i))return e.interpolator(Eu(mg(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(Du(t.interpolate,t.interpolateGamma)):Ve(e.round)?e.round(r):Ve(e.rangeRound)&&e.interpolate(r?Dl.Z:$l.Z),o&&e.range(mg(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!xe(i)){const t=e.domain(),n=t[0],r=$e(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||re("Scale bins parameter missing step property."),ar&&(s=o*Math.floor(r/o)),i=(0,ia.Z)(a,s+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===eu&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain()),n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(hg(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,o,a=t.domain,s=e.type,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===Bl||t===jl||t===Ul)}(e);if(!a)return 0;if(cg(s)&&t.padding&&a[0]!==$e(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs($e(n)-n[0]),s=a/(a-2*i),l=e===Il?Ie(t,null,s):e===Ul?je(t,null,s,.5):e===jl?je(t,null,s,r||1):e===ql?Ue(t,null,s,o||1):Be(t,null,s);return(t=t.slice())[0]=l[0],t[t.length-1]=l[1],t}(s,a,t.range,t.padding,t.exponent,t.constant)),(l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,l&&(a[0]>0&&(a[0]=0),a[r]<0&&(a[r]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[r]=t.domainMax),null!=t.domainMid)){const e=(o=t.domainMid)>a[r]?r+1:oe(l);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;od&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,u,c),i=0,r=n.length,o=n.max;ie;function $g(e,t){e&&Sg.hasOwnProperty(e.type)&&Sg[e.type](e,t)}var Dg={Feature:function(e,t){$g(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i0){for(o=e[--r];r>0&&(t=o,n=e[--r],o=t+n,i=n-(o-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=o+n,n==t-o&&(o=t))}return o}}var Ng=1e-6,zg=1e-12,Tg=Math.PI,Rg=Tg/2,Pg=Tg/4,Lg=2*Tg,Bg=180/Tg,Ig=Tg/180,jg=Math.abs,Ug=Math.atan,qg=Math.atan2,Wg=Math.cos,Gg=Math.ceil,Hg=Math.exp,Vg=(Math.floor,Math.hypot),Zg=Math.log,Xg=Math.pow,Yg=Math.sin,Jg=Math.sign||function(e){return e>0?1:e<0?-1:0},Qg=Math.sqrt,Kg=Math.tan;function ey(e){return e>1?0:e<-1?Tg:Math.acos(e)}function ty(e){return e>1?Rg:e<-1?-Rg:Math.asin(e)}function ny(){}var iy,ry,oy,ay,sy=new Og,ly=new Og,uy={point:ny,lineStart:ny,lineEnd:ny,polygonStart:function(){uy.lineStart=cy,uy.lineEnd=hy},polygonEnd:function(){uy.lineStart=uy.lineEnd=uy.point=ny,sy.add(jg(ly)),ly=new Og},result:function(){var e=sy/2;return sy=new Og,e}};function cy(){uy.point=fy}function fy(e,t){uy.point=dy,iy=oy=e,ry=ay=t}function dy(e,t){ly.add(ay*e-oy*t),oy=e,ay=t}function hy(){dy(iy,ry)}const py=uy;var my=1/0,gy=my,yy=-my,vy=yy,by={point:function(e,t){eyy&&(yy=e),tvy&&(vy=t)},lineStart:ny,lineEnd:ny,polygonStart:ny,polygonEnd:ny,result:function(){var e=[[my,gy],[yy,vy]];return yy=vy=-(gy=my=1/0),e}};const xy=by;var wy,_y,ky,Ey,Ay=0,$y=0,Dy=0,Sy=0,Cy=0,Fy=0,My=0,Oy=0,Ny=0,zy={point:Ty,lineStart:Ry,lineEnd:By,polygonStart:function(){zy.lineStart=Iy,zy.lineEnd=jy},polygonEnd:function(){zy.point=Ty,zy.lineStart=Ry,zy.lineEnd=By},result:function(){var e=Ny?[My/Ny,Oy/Ny]:Fy?[Sy/Fy,Cy/Fy]:Dy?[Ay/Dy,$y/Dy]:[NaN,NaN];return Ay=$y=Dy=Sy=Cy=Fy=My=Oy=Ny=0,e}};function Ty(e,t){Ay+=e,$y+=t,++Dy}function Ry(){zy.point=Py}function Py(e,t){zy.point=Ly,Ty(ky=e,Ey=t)}function Ly(e,t){var n=e-ky,i=t-Ey,r=Qg(n*n+i*i);Sy+=r*(ky+e)/2,Cy+=r*(Ey+t)/2,Fy+=r,Ty(ky=e,Ey=t)}function By(){zy.point=Ty}function Iy(){zy.point=Uy}function jy(){qy(wy,_y)}function Uy(e,t){zy.point=qy,Ty(wy=ky=e,_y=Ey=t)}function qy(e,t){var n=e-ky,i=t-Ey,r=Qg(n*n+i*i);Sy+=r*(ky+e)/2,Cy+=r*(Ey+t)/2,Fy+=r,My+=(r=Ey*e-ky*t)*(ky+e),Oy+=r*(Ey+t),Ny+=3*r,Ty(ky=e,Ey=t)}const Wy=zy;function Gy(e){this._context=e}Gy.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Lg)}},result:ny};var Hy,Vy,Zy,Xy,Yy,Jy=new Og,Qy={point:ny,lineStart:function(){Qy.point=Ky},lineEnd:function(){Hy&&ev(Vy,Zy),Qy.point=ny},polygonStart:function(){Hy=!0},polygonEnd:function(){Hy=null},result:function(){var e=+Jy;return Jy=new Og,e}};function Ky(e,t){Qy.point=ev,Vy=Xy=e,Zy=Yy=t}function ev(e,t){Xy-=e,Yy-=t,Jy.add(Qg(Xy*Xy+Yy*Yy)),Xy=e,Yy=t}const tv=Qy;let nv,iv,rv,ov;class av{constructor(e){this._append=null==e?sv:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return sv;if(t!==nv){const e=10**t;nv=t,iv=function(t){let n=1;this._+=t[0];for(const i=t.length;n=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new av(r)),a},a.projection(e).digits(r).context(t)}function uv(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:ny,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function cv(e,t){return jg(e[0]-t[0])=0;--o)r.point((c=u[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function hv(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i=0?1:-1,$=A*E,D=$>Tg,S=g*_;if(l.add(qg(S*A*Yg($),y*k+S*Wg($))),a+=D?E+A*Lg:E,D^p>=n^x>=n){var C=yv(mv(h),mv(b));xv(C);var F=yv(o,C);xv(F);var M=(D^E>=0?-1:1)*ty(F[2]);(i>M||i===M&&(C[0]||C[1]))&&(s+=D^E>=0?1:-1)}}return(a<-Ng||a0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(Ev))}return d}}function Ev(e){return e.length>1}function Av(e,t){return((e=e.x)[0]<0?e[1]-Rg-Ng:Rg-e[1])-((t=t.x)[0]<0?t[1]-Rg-Ng:Rg-t[1])}const $v=kv((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Tg:-Tg,l=jg(o-n);jg(l-Tg)0?Rg:-Rg),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=Tg&&(jg(n-r)Ng?Ug((Yg(t)*(o=Wg(i))*Yg(n)-Yg(i)*(r=Wg(t))*Yg(e))/(r*o*a)):(t+i)/2}(n,i,o,a),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=o,i=a),r=s},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}}),(function(e,t,n,i){var r;if(null==e)r=n*Rg,i.point(-Tg,r),i.point(0,r),i.point(Tg,r),i.point(Tg,0),i.point(Tg,-r),i.point(0,-r),i.point(-Tg,-r),i.point(-Tg,0),i.point(-Tg,r);else if(jg(e[0]-t[0])>Ng){var o=e[0]0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else u.point(o[0],o[1])}function a(i,r){return jg(i[0]-e)0?0:3:jg(i[0]-n)0?2:1:jg(i[1]-t)0?1:0:r>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),i=a(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var l,u,c,f,d,h,p,m,g,y,v,b=a,x=uv(),w={point:_,lineStart:function(){w.point=k,u&&u.push(c=[]),y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(k(f,d),h&&g&&x.rejoin(),l.push(x.result())),w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],u=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;ni&&(d-o)*(i-a)>(h-a)*(e-o)&&++t:h<=i&&(d-o)*(i-a)<(h-a)*(e-o)&&--t;return t}(),n=v&&t,r=(l=_v(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&dv(l,s,t,o,a),a.polygonEnd()),b=a,l=u=c=null}};function _(e,t){r(e,t)&&b.point(e,t)}function k(o,a){var s=r(o,a);if(u&&c.push([o,a]),y)f=o,d=a,h=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var l=[p=Math.max(Cv,Math.min(Sv,p)),m=Math.max(Cv,Math.min(Sv,m))],x=[o=Math.max(Cv,Math.min(Sv,o)),a=Math.max(Cv,Math.min(Sv,a))];!function(e,t,n,i,r,o){var a,s=e[0],l=e[1],u=0,c=1,f=t[0]-s,d=t[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>u&&(u=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>u&&(u=a)}else if(d>0){if(a0&&(e[0]=s+u*f,e[1]=l+u*d),c<1&&(t[0]=s+c*f,t[1]=l+c*d),!0}}}}}(l,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}function Mv(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function Ov(e,t){return jg(e)>Tg&&(e-=Math.round(e/Lg)*Lg),[e,t]}function Nv(e,t,n){return(e%=Lg)?t||n?Mv(Tv(e),Rv(t,n)):Tv(e):t||n?Rv(t,n):Ov}function zv(e){return function(t,n){return jg(t+=e)>Tg&&(t-=Math.round(t/Lg)*Lg),[t,n]}}function Tv(e){var t=zv(e);return t.invert=zv(-e),t}function Rv(e,t){var n=Wg(e),i=Yg(e),r=Wg(t),o=Yg(t);function a(e,t){var a=Wg(t),s=Wg(e)*a,l=Yg(e)*a,u=Yg(t),c=u*n+s*i;return[qg(l*r-c*o,s*n-u*i),ty(c*r+l*o)]}return a.invert=function(e,t){var a=Wg(t),s=Wg(e)*a,l=Yg(e)*a,u=Yg(t),c=u*r-l*o;return[qg(l*r+u*o,s*n+c*i),ty(c*n-s*i)]},a}function Pv(e){return function(t){var n=new Lv;for(var i in e)n[i]=e[i];return n.stream=t,n}}function Lv(){}function Bv(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),Mg(n,e.stream(xy)),t(xy.result()),null!=i&&e.clipExtent(i),e}function Iv(e,t,n){return Bv(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+t[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])}),n)}function jv(e,t,n){return Iv(e,[[0,0],t],n)}function Uv(e,t,n){return Bv(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];e.scale(150*r).translate([o,a])}),n)}function qv(e,t,n){return Bv(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([o,a])}),n)}Ov.invert=Ov,Lv.prototype={constructor:Lv,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Wv=16,Gv=Wg(30*Ig);function Hv(e,t){return+t?function(e,t){function n(i,r,o,a,s,l,u,c,f,d,h,p,m,g){var y=u-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,w=s+h,_=l+p,k=Qg(x*x+w*w+_*_),E=ty(_/=k),A=jg(jg(_)-1)t||jg((y*C+v*F)/b-.5)>.3||a*d+s*h+l*p0,r=jg(t)>Ng;function o(e,n){return Wg(e)*Wg(n)>t}function a(e,n,i){var r=[1,0,0],o=yv(mv(e),mv(n)),a=gv(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=yv(r,o),d=bv(r,u);vv(d,bv(o,c));var h=f,p=gv(d,h),m=gv(h,h),g=p*p-m*(gv(d,d)-1);if(!(g<0)){var y=Qg(g),v=bv(h,(-p-y)/m);if(vv(v,d),v=pv(v),!i)return v;var b,x=e[0],w=n[0],_=e[1],k=n[1];w0^v[1]<(jg(v[0]-x)Tg^(x<=v[0]&&v[0]<=w)){var $=bv(h,(-p+y)/m);return vv($,d),[v,pv($)]}}}function s(t,n){var r=i?e:Tg-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return kv(o,(function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?Tg:-Tg),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||cv(t,h)||cv(p,h))&&(p[2]=1),m!==l)c=0,m?(e.lineStart(),h=a(p,t),e.point(h[0],h[1])):(h=a(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=a(p,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&cv(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=Wg(t),s=Yg(t),l=i*n;null==r?(r=t+i*Lg,o=t-l/2):(r=Dv(a,r),o=Dv(a,o),(i>0?ro)&&(r+=i*Lg));for(var u,c=r;i>0?c>o:c2?e[2]%360*Ig:0,C()):[g*Bg,y*Bg,v*Bg]},D.angle=function(e){return arguments.length?(b=e%360*Ig,C()):b*Bg},D.reflectX=function(e){return arguments.length?(x=e?-1:1,C()):x<0},D.reflectY=function(e){return arguments.length?(w=e?-1:1,C()):w<0},D.precision=function(e){return arguments.length?(a=Hv(s,$=e*e),F()):Qg($)},D.fitExtent=function(e,t){return Iv(D,e,t)},D.fitSize=function(e,t){return jv(D,e,t)},D.fitWidth=function(e,t){return Uv(D,e,t)},D.fitHeight=function(e,t){return qv(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,C()}}function Jv(e){var t=0,n=Tg/3,i=Yv(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*Ig,n=e[1]*Ig):[t*Bg,n*Bg]},r}function Qv(e,t){var n=Yg(e),i=(n+Yg(t))/2;if(jg(i)2?e[2]*Ig:0),t.invert=function(t){return(t=e.invert(t[0]*Ig,t[1]*Ig))[0]*=Bg,t[1]*=Bg,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===ob?[[Math.max(s[0]-o,u),t],[Math.min(s[0]+o,n),i]]:[[u,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,i)]])}return r.scale=function(e){return arguments.length?(a(e),c()):a()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(o(e),c()):o()},r.clipExtent=function(e){return arguments.length?(null==e?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function sb(e){return Kg((Rg+e)/2)}function lb(e,t){var n=Wg(e),i=e===t?Yg(e):Zg(n/Wg(t))/Zg(sb(t)/sb(e)),r=n*Xg(sb(e),i)/i;if(!i)return ob;function o(e,t){r>0?t<-Rg+Ng&&(t=-Rg+Ng):t>Rg-Ng&&(t=Rg-Ng);var n=r/Xg(sb(t),i);return[n*Yg(i*e),r-n*Wg(i*e)]}return o.invert=function(e,t){var n=r-t,o=Jg(i)*Qg(e*e+n*n),a=qg(e,jg(n))*Jg(n);return n*i<0&&(a-=Tg*Jg(e)*Jg(n)),[a/i,2*Ug(Xg(r/o,1/i))-Rg]},o}function ub(e,t){return[e,t]}function cb(e,t){var n=Wg(e),i=e===t?Yg(e):(n-Wg(t))/(t-e),r=n/i+e;if(jg(i)Ng&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},bb.invert=nb(ty),xb.invert=nb((function(e){return 2*Ug(e)})),wb.invert=function(e,t){return[-t,2*Ug(Hg(e))-Rg]};var _b=Math.abs,kb=(Math.atan,Math.atan2,Math.ceil,Math.cos),Eb=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),Ab=(Math.tan,1e-6),$b=Math.PI,Db=$b/2,Sb=(Math.SQRT1_2,Fb(2));function Cb(e){return e>1?Db:e<-1?-Db:Math.asin(e)}function Fb(e){return e>0?Math.sqrt(e):0}function Mb(e,t){var n,i=e*Eb(t),r=30;do{t-=n=(t+Eb(t)-i)/(1+kb(t))}while(_b(n)>Ab&&--r>0);return t/2}Fb($b);var Ob=function(e,t,n){function i(i,r){return[e*i*kb(r=Mb(n,r)),t*Eb(r)]}return i.invert=function(i,r){return r=Cb(r/t),[i/(e*kb(r)),Cb((2*r+Eb(2*r))/n)]},i}(Sb/Db,Sb,$b);const Nb=lv(),zb=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Tb(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Pb[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=lv().projection(i),i.copy=i.copy||function(){const e=n();return zb.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},du(i)}}(e,t),this):Pb[e]||null}function Rb(e){return e&&e.path||Nb}const Pb={albers:eb,albersusa:function(){var e,t,n,i,r,o,a=eb(),s=Kv().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Kv().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,t){o=[e,t]}};function c(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(i.point(t,a),o)||(r.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?l:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const e in Pb)Tb(e,Pb[e]);function Lb(e,t,n){var i=(0,ia.Z)(e,t-Ng,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function Bb(e,t,n){var i=(0,ia.Z)(e,t-Ng,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}var Ib=n(12738);function jb(){}const Ub=[[],[[[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 qb(){var e=1,t=1,n=a;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var a=[],s=[];return function(n,i,r){var a,s,l,u,c,f,d=new Array,h=new Array;for(a=s=-1,u=n[0]>=i,Ub[u<<1].forEach(p);++a=i,Ub[l|u<<1].forEach(p);for(Ub[u<<0].forEach(p);++s=i,c=n[s*e]>=i,Ub[u<<1|c<<2].forEach(p);++a=i,f=c,c=n[s*e+a+1]>=i,Ub[l|u<<1|c<<2|f<<3].forEach(p);Ub[u|c<<3].forEach(p)}for(a=-1,c=n[s*e]>=i,Ub[c<<2].forEach(p);++a=i,Ub[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],l=[e[1][0]+a,e[1][1]+s],u=o(i),c=o(l);(t=h[u])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(l),r(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(l),h[t.end=c]=t):(t=d[c])?(n=h[u])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(l),r(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(i),d[t.start=u]=t):d[u]=h[c]={start:u,end:c,ring:[i,l]}}Ub[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n{var o,a=n[0],s=n[1],l=0|a,u=0|s,c=i[u*e+l];a>0&&a0&&s=0&&o>=0||re("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:jb,i):n===a},i}function Wb(e,t){for(var n,i=-1,r=t.length;++ii!=h>i&&n<(d-u)*(i-c)/(h-c)+u&&(r=-r)}return r}function Hb(e,t,n){var i,r,o,a;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],o=n[i],a=t[i],r<=o&&o<=a||a<=o&&o<=r)}function Vb(e,t,n){return function(i){var r=it(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?(0,Yt.ly)(o,a,e):s/(e+1);return(0,ia.Z)(o+l,a,l)}}function Zb(e){Gr.call(this,null,e)}function Xb(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function l(e){e.forEach(u)}function u(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+i,e[1]=(e[1]-a)*n+r}return function(e){return e.coordinates.forEach(l),e}}function Yb(e,t,n){const i=e>=0?e:lo(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function Jb(e){return Ve(e)?e:et(+e)}function Qb(){var e=e=>e[0],t=e=>e[1],n=ce,i=[-1,-1],r=960,o=500,a=2;function s(s,l){const u=Yb(i[0],s,e)>>a,c=Yb(i[1],s,t)>>a,f=u?u+2:0,d=c?c+2:0,h=2*f+(r>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;s.forEach((i=>{const r=f+(+e(i)>>a),o=d+(+t(i)>>a);r>=0&&r=0&&o0&&c>0?(Kb(h,p,m,g,u),ex(h,p,g,m,c),Kb(h,p,m,g,u),ex(h,p,g,m,c),Kb(h,p,m,g,u),ex(h,p,g,m,c)):u>0?(Kb(h,p,m,g,u),Kb(h,p,g,m,u),Kb(h,p,m,g,u),y=g):c>0&&(ex(h,p,m,g,c),ex(h,p,g,m,c),ex(h,p,m,g,c),y=g);const v=l?Math.pow(2,-2*a):1/Zm(y);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=Jb(t),s):e},s.y=function(e){return arguments.length?(t=Jb(e),s):t},s.weight=function(e){return arguments.length?(n=Jb(e),s):n},s.size=function(e){if(!arguments.length)return[r,o];var t=+e[0],n=+e[1];return t>=0&&n>=0||re("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||re("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<=r&&(t>=o&&(s-=n[t-o+a*e]),i[t-r+a*e]=s/Math.min(t+1,e-1+o-t,o))}function ex(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a=r&&(s>=o&&(l-=n[a+(s-o)*e]),i[a+(s-r)*e]=l/Math.min(s+1,t-1+o-s,o))}function tx(e){Gr.call(this,null,e)}Zb.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"}]},ct(Zb,Gr,{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,r=e.field||le,o=qb().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const i=Vb(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>(0,Yr.Z)(t(e).values))))}(i,r,e),s=null===e.as?null:e.as||"contour",l=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,xe(a)?a:a(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;if(Ve(r)&&(r=r(n,i)),Ve(o)&&(o=o(n,i)),(1===r||null==r)&&!o)return;const a=(mt(r)?r:r[0])||1,s=(mt(r)?r:r[1])||1,l=o&&o[0]||0,u=o&&o[1]||0;e.forEach(Xb(t,a,s,l,u))}(i,n,t,e),i.forEach((e=>{l.push(yr(t,mr(null!=s?{[s]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),tx.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 nx=["x","y","weight","size","cellSize","bandwidth"];function ix(e,t){return nx.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function rx(e){Gr.call(this,null,e)}ct(tx,Gr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,o,a,s,l=[],u=e=>e(o);if(null==t)l.push(e);else for(n={},i=0,r=e.length;imr(function(e,t){for(let n=0;nNg})).map(l)).concat((0,ia.Z)(Gg(o/h)*h,r,h).filter((function(e){return jg(e%m)>Ng})).map(u))}return y.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[i,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),o>r&&(n=o,o=r,r=n),y.precision(g)):[[t,o],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],y):[d,h]},y.precision=function(d){return arguments.length?(g=+d,l=Lb(o,r,90),u=Bb(t,e,g),c=Lb(s,a,90),f=Bb(i,n,g),y):g},y.extentMajor([[-180,-90+Ng],[180,90-Ng]]).extentMinor([[-180,-80-Ng],[180,80+Ng]])}()}function dx(e){Gr.call(this,null,e)}function hx(e){if(!Ve(e))return!1;const t=Mt(ee(e));return t.$x||t.$y||t.$value||t.$max}function px(e){Gr.call(this,null,e),this.modified(!0)}function mx(e,t,n){Ve(e[t])&&e[t](n)}function gx(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,l,u,c,f,d,h=e._root,p={data:i},m=e._x0,g=e._y0,y=e._x1,v=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a,r=h,!(h=h[f=c<<1|u]))return r[f]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)return p.next=h,r?r[f]=p:e._root=p,e;do{r=r?r[f]=new Array(4):e._root=new Array(4),(u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|u)==(d=(l>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function yx(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function vx(e){return e[0]}function bx(e){return e[1]}function xx(e,t,n){var i=new wx(null==t?vx:t,null==n?bx:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function wx(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function _x(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}sx.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ct(sx,Gr,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],l=e.geojson||!o&&le,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(ee(l))||a&&t.modified(ee(a))||s&&t.modified(ee(s)),this.value&&!n||(u=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(u,(e=>i.push(l(e)))),a&&s&&(t.visit(u,(e=>{var t=a(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:ox,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:ax,features:i}}}),lx.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"}]},ct(lx,Gr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||le,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=Rb(e.projection),n.materialize().reflow()):a=r===le||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();return e.context(null),null!=t&&e.pointRadius(t),n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),ux.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"]}]},ct(ux,Gr,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],l=a[1];function u(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[l]=t[1]):(e[s]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(a)}}),cx.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"}]},ct(cx,Gr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(r),o};return i.context=t=>(e.context(t),i),i}(Rb(e.projection),e.field||ae("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),fx.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}]},ct(fx,Gr,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const t in e)Ve(r[t])&&r[t](e[t]);return n=r(),i.length?t.mod.push(vr(i[0],n)):t.add.push(mr(n)),i[0]=n,t}}),dx.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"}]},ct(dx,Gr,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||le,o=function(e,t){let n;return Ve(e)?(n=n=>e(n,t),n.dep=hx(e)):e?n=et(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}(e.opacity,e),a=function(e,t){let n;return Ve(e)?(n=n=>(0,Ib.B8)(e(n,t)),n.dep=hx(e)):n=et((0,Ib.B8)(e||"#888")),n}(e.color,e),s=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?(0,Yr.Z)(n.map((e=>(0,Yr.Z)(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=nt({},e,l);i||(n.$max=(0,Yr.Z)(t.values||[])),e[s]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,l=e.x2||r,u=e.y2||o,c=e.values,f=c?e=>c[e]:ue,d=tl(l-a,u-s),h=d.getContext("2d"),p=h.getImageData(0,0,l-a,u-s),m=p.data;for(let e=s,o=0;e{null!=e[t]&&mx(n,t,e[t])}))):zb.forEach((t=>{e.modified(t)&&mx(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return 1===(e=Ge(e)).length?e[0]:{type:ax,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===ax?e.features:Ge(e).filter((e=>null!=e)).map((e=>e.type===ox?e:{type:ox,geometry:e}))}(t))),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});var kx=xx.prototype=wx.prototype;function Ex(e){return function(){return e}}function Ax(e){return 1e-6*(e()-.5)}function $x(e){return e.x+e.vx}function Dx(e){return e.y+e.vy}kx.copy=function(){var e,t,n=new wx(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=_x(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=_x(t));return n},kx.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return gx(this.cover(t,n),t,n,e)},kx.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),l=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),rf&&(f=r));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),n=0;ne||e>=r||i>t||t>=o;)switch(s=(td||(o=l.y0)>h||(a=l.x1)=y)<<1|e>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=l)}else{var v=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=v*v+b*b;if(x=(s=(p+g)/2))?p=s:g=s,(c=a>=(l=(m+y)/2))?m=l:y=l,t=h,!(h=h[f=c<<1|u]))return this;if(!h.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,d=f)}for(;h.data!==e;)if(i=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,i?(r?i.next=r:delete i.next,this):t?(r?t[f]=r:delete t[f],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=r,this)},kx.removeAll=function(e){for(var t=0,n=e.length;tu+p||oc+p||al.index){var m=u-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;ye.r&&(e.r=e[t].r)}function l(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=Ax(n))*f),0===d&&(p+=(d=Ax(n))*d),p[s(e,t,i),e])));for(a=0,r=new Array(u);at(e,n):t)}function Hx(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function Vx(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=Xx)):void 0===t&&(t=Zx);for(var n,i,r,o,a,s=new Qx(e),l=[s];n=l.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new Qx(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(Jx)}function Zx(e){return e.children}function Xx(e){return Array.isArray(e)?e[1]:null}function Yx(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function Jx(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function Qx(e){this.data=e,this.depth=this.height=0,this.parent=null}function Kx(e){return null==e?null:ew(e)}function ew(e){if("function"!=typeof e)throw new Error;return e}function tw(){return 0}function nw(e){return function(){return e}}jx.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:Ix}]},ct(jx,Gr,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(Lx),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&Ux(r,e,0,t)):(this.value=r=function(e,t){const n=function(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=(0,Cx.HT)(f),u=(0,Sx.Z)("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Fx)/Fx}();function f(){d(),u.call("tick",t),n1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u1?(u.on(e,n),t):u.on(e)}}}(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),Ux(n,t,!0).on("end",(()=>o=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(o=!0,r.tick()),t.modifies("index")),a||o||e.modified(Bx)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/s)),e.static)for(r.stop();--s>=0;)r.tick();else if(r.stopped()&&r.restart(),!o)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let e,t=this._argops,s=0,l=t.length;s=0;--i)o.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;for(e=n.pop(),t=i.pop();e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Vx(this).eachBefore(Yx)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,o=[r];do{for(e=o.reverse(),o=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n0&&n*n>i*i+r*r}function sw(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*$*S))/(2*$):S/D);return{x:i+_+k*C,y:r+E+A*C,r:C}}function fw(e,t,n){var i,r,o,a,s=e.x-t.x,l=e.y-t.y,u=s*s+l*l;u?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(u+a-r)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),n.x=e.x-i*s-o*l,n.y=e.y-i*l+o*s):(i=(u+r-a)/(2*u),o=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*s-o*l,n.y=t.y+i*l+o*s)):(n.x=t.x+n.r,n.y=t.y)}function dw(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function hw(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function pw(e){this._=e,this.next=null,this.previous=null}function mw(e,t){if(!(o=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,o,a,s,l,u,c,f,d;if((n=e[0]).x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;fw(i,n,r=e[2]),n=new pw(n),i=new pw(i),r=new pw(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(l=3;lfunction(e){let t=(e=`${e}`).length;return Cw(e,t-1)&&!Cw(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(Sw),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(Sw(e)),d.push(Ew));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a=0&&(u=d[e]).data===Ew;--e)u.data=null}if(s.parent=_w,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(Jx),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=Kx(e),i):t},i.parentId=function(e){return arguments.length?(n=Kx(e),i):n},i.path=function(t){return arguments.length?(e=Kx(t),i):e},i}function Sw(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Cw(e,t););return e.slice(0,t)}function Cw(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function Fw(e,t){return e.parent===t.parent?1:2}function Mw(e){var t=e.children;return t?t[0]:e.t}function Ow(e){var t=e.children;return t?t[t.length-1]:e.t}function Nw(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function zw(e,t,n){return e.a.parent===t.parent?e.a:n}function Tw(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function Rw(e,t){return e.parent===t.parent?1:2}function Pw(e,t){return e+t.x}function Lw(e,t){return Math.max(e,t.y)}function Bw(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(r-n)/e.value;++sd&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(a={value:c,dice:l1?t:1)},n}(Iw),qw=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,l,u,c,f=-1,d=a.length,h=e.value;++f1?t:1)},n}(Iw);function Ww(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function Gw(e){Gr.call(this,null,e)}Gw.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const Hw=e=>e.values;function Vw(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,o=e[i++],a={},s={};let l,u,c,f=-1;for(;++fe.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function Zw(e){Gr.call(this,null,e)}ct(Gw,Gr,{transform(e,t){t.source||re("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),o=this.value;return(!o||i||t.changed())&&(o&&o.each((e=>{e.children&&dr(e.data)&&r.rem.push(e.data)})),this.value=o=Vx({values:Ge(e.keys).reduce(((e,t)=>(e.key(t),e)),Vw()).entries(r.source)},Hw),n&&o.each((e=>{e.children&&(e=mr(e.data),r.add.push(e),r.source.push(e))})),Ww(o,hr,hr)),r.source.root=o,r}});const Xw=(e,t)=>e.parent===t.parent?1:2;ct(Zw,Gr,{transform(e,t){t.source&&t.source.root||re(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(br(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;rfunction(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o(e=(1664525*e+1013904223)%iw)/iw}();return r.x=t/2,r.y=n/2,e?r.eachBefore(yw(e)).eachAfter(vw(i,.5,o)).eachBefore(bw(1)):r.eachBefore(yw(gw)).eachAfter(vw(tw,1,o)).eachAfter(vw(i,r.r/Math.min(t,n),o)).eachBefore(bw(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=Kx(t),r):e},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:nw(+e),r):i},r},params:["radius","size","padding"],fields:Yw});const Qw=["x0","y0","x1","y1","depth","children"];function Kw(e){Zw.call(this,e)}function e_(e){Gr.call(this,null,e)}Kw.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Qw.length,default:Qw}]},ct(Kw,Zw,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/o,r.eachBefore(function(e,t){return function(i){i.children&&ww(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a=0;--r)s.push(n=t.children[r]=new Tw(i[r],r)),n.parent=t;return(a.parent=new Tw(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var u=r,c=r,f=r;r.eachBefore((function(e){e.xc.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=u===c?1:e(u,c)/2,h=d-u.x,p=t/(c.x+d+h),m=n/(f.depth||1);r.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return r}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,o=r.length;--o>=0;)(t=r[o]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,o=t,a=t,s=n,l=o.parent.children[0],u=o.m,c=a.m,f=s.m,d=l.m;s=Ow(s),o=Mw(o),s&&o;)l=Mw(l),(a=Ow(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(Nw(zw(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!Ow(a)&&(a.t=s,a.m+=f-c),o&&!Mw(l)&&(l.t=o,l.m+=u-d,i=t)}return i}(t,r,t.parent.A||i[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=Rw,t=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(Pw,0)/e.length}(n),t.y=function(e){return 1+e.reduce(Lw,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=s.x-e(s,l)/2,c=l.x+e(l,s)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-u)/(c-u)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},n_=["x","y","depth","children"];function i_(e){Zw.call(this,e)}function r_(e){Gr.call(this,[],e)}i_.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:n_.length,default:n_}]},ct(i_,Zw,{layout(e){const t=e||"tidy";if(at(t_,t))return t_[t]();re("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:n_}),r_.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ct(r_,Gr,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||re("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[hr(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[hr(t)]&&o[hr(n)]&&r.add.push(mr({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[hr(e)]=1)),n.forEach((e=>{(o[hr(e.source)]||o[hr(e.target)])&&r.mod.push(e)}))),r}});const o_={binary:function(e,t,n,i,r){var o,a,s=e.children,l=s.length,u=new Array(l+1);for(u[0]=a=o=0;o=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=l)}for(var f=u[t],d=i/2+f,h=t+1,p=n-1;h>>1;u[m]l-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,l),e(h,n,y,v,o,a,l)}else{var b=i?(o*y+l*g)/i:l;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,l)}}(0,l,e.value,t,n,i,r)},dice:ww,slice:Bw,slicedice:function(e,t,n,i,r){(1&e.depth?Bw:ww)(e,t,n,i,r)},squarify:Uw,resquarify:qw},a_=["x0","y0","x1","y1","depth","children"];function s_(e){Zw.call(this,e)}s_.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:a_.length,default:a_}]},ct(s_,Zw,{layout(){const e=function(){var e=Uw,t=!1,n=1,i=1,r=[0],o=tw,a=tw,s=tw,l=tw,u=tw;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(xw),e}function f(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{at(o_,t)?e.tile(o_[t]):re("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:a_});const l_=4278190080;function u_(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function c_(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>c_(e,t.items,n)))})):Qd[i].draw(e,{items:n?t.map(f_):t})}function f_(e){const t=yr(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const d_=5,h_=31,p_=32,m_=new Uint32Array(p_+1),g_=new Uint32Array(p_+1);g_[0]=0,m_[0]=~g_[0];for(let e=1;e<=p_;++e)g_[e]=g_[e-1]<<1|1,m_[e]=~g_[e];function y_(e,t,n,i,r,o){let a=n/2;return e-a<0||e+a>r||t-(a=i/2)<0||t+a>o}function v_(e,t,n,i,r,o,a,s){const l=r*o/(2*i),u=e(t-l),c=e(t+l),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(u,f,c,d)||a.getRange(u,f,c,d)||s&&s.getRange(u,f,c,d)}const b_=[-1,-1,1,1],x_=[-1,1,-1,1],w_=["right","center","left"],__=["bottom","middle","top"];function k_(e,t,n,i,r,o,a,s,l,u,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const E_={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},A_={naive:function(e,t,n,i){const r=e.width,o=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,a=e.datum.fontSize,s=Od.width(e.datum,e.datum.text);let l,u,c,f,d,h,p,m=0;for(let i=0;i=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,l=e.x-d,u=e.x+d,c=e.y-h,f=e.y+h,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r=1;)d=(h+p)/2,v_(e,c,f,u,l,d,a,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,u=s.length,c=t.datum.fontSize,f=Od.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,w,_,k,E,A,$,D,S,C=n?c:0,F=!1,M=!1,O=0;for(let i=0;ih&&(S=d,d=h,h=S),p>m&&(S=p,p=m,m=S),x=e(d),_=e(h),w=~~((x+_)/2),k=e(p),A=e(m),E=~~((k+A)/2),v=w;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,C,f,c),D&&([t.x,t.y,C,F]=D);for(v=w;v<=_;++v)for(b=E;b<=A;++b)D=l(v,b,C,f,c),D&&([t.x,t.y,C,F]=D);F||n||($=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,$>=O&&!y_(g,y,f,c,r,o)&&!v_(e,g,y,c,f,c,a,null)&&(O=$,t.x=g,t.y=y,M=!0))}return!(!F&&!M||(g=f/2,y=c/2,a.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",0))}},floodfill:function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,f=t.datum.fontSize,d=Od.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,w,_,k,E,A,$=n?f:0,D=!1,S=!1,C=0;for(let i=0;i=1;)E=(_+k)/2,v_(e,v,b,f,d,E,a,s)?k=E:_=E;_>$&&(t.x=v,t.y=b,$=_,D=!0)}}D||n||(A=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,A>=C&&!y_(v,b,d,f,r,o)&&!v_(e,v,b,f,d,f,a,null)&&(C=A,t.x=v,t.y=b,S=!0))}return!(!D&&!S||(v=d/2,b=f/2,a.setRange(e(t.x-v),e(t.y-b),e(t.x+v),e(t.y+b)),t.align="center",t.baseline="middle",0))}}};function $_(e,t,n,i,r,o,a,s,l,u,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=function(e,t){const n=new Float64Array(t),i=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(p,m,s,l),v=null===u||u===1/0,b=g&&"naive"===c;var x;let w=-1,_=-1;const k=e.map((e=>{const t=v?Od.width(e,e.text):void 0;return w=Math.max(w,t),_=Math.max(_,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));u=null===u||u===1/0?Math.max(w,_)+Math.max(...i):u;const E=function(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),a=e=>~~((e+n)/i);return a.invert=e=>e*i-n,a.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+p_)/p_));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>d_]&1<<(r&h_)},set:(t,n)=>{const r=n*e+t;i(r>>>d_,1<<(r&h_))},clear:(t,n)=>{const i=n*e+t;r(i>>>d_,~(1<<(i&h_)))},getRange:(t,i,r,o)=>{let a,s,l,u,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,l=a>>>d_,u=s>>>d_,l===u){if(n[l]&m_[a&h_]&g_[1+(s&h_)])return!0}else{if(n[l]&m_[a&h_])return!0;if(n[u]&g_[1+(s&h_)])return!0;for(let e=l+1;e{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,l=a>>>d_,u=s>>>d_,l===u)i(l,m_[a&h_]&g_[1+(s&h_)]);else for(i(l,m_[a&h_]),i(u,g_[1+(s&h_)]),c=l+1;c{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,l=a>>>d_,u=s>>>d_,l===u)r(l,g_[a&h_]|m_[1+(s&h_)]);else for(r(l,g_[a&h_]),r(u,m_[1+(s&h_)]),c=l+1;cn<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}(t[0],t[1],u);let A;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;ee.datum));A=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=tl(o,a).getContext("2d"),u=tl(o,a).getContext("2d"),c=s&&tl(o,a).getContext("2d");n.forEach((e=>c_(l,e,!1))),c_(u,t,!1),s&&c_(c,t,!0);const f=u_(l,o,a),d=u_(u,o,a),h=s&&u_(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,w,_,k;for(y=0;yn.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(E,a&&k)}const $=g?A_[c](E,A,a,l):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,w,_,k,E,A,$=t.textWidth??0;for(let r=0;r>>2&3)-1,h=0===f&&0===d||i[r]<0,p=f&&d?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=u[1+f]+i[r]*f*p,w=u[4+d]+m*c*d/2+i[r]*d*p,v=w-c/2,b=w+c/2,_=e(g),E=e(v),A=e(b),!$){if(!k_(_,_,E,A,a,s,0,0,0,0,0,h))continue;$=Od.width(t.datum,t.datum.text)}if(x=g+m*$*f/2,g=x-$/2,y=x+$/2,_=e(g),k=e(y),k_(_,k,E,A,a,s,0,0,0,0,0,h))return t.x=f?f*m<0?y:g:x,t.y=d?d*m<0?b:v:w,t.align=w_[f*m+1],t.baseline=__[d*m+1],a.setRange(_,E,k,A),!0}return!1}}(E,A,h,d);return k.forEach((e=>e.opacity=+$(e))),k}const D_=["x","y","opacity","align","baseline"],S_=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function C_(e){Gr.call(this,null,e)}function F_(e,t){var n,i,r,o,a,s,l=[],u=function(e){return e(o)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline})),t.reflow(n).modifies(i)}}),M_.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},ct(M_,Gr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=F_(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(K),o=r.length,a=e.as||[K(e.x),K(e.y)],s=[];i.forEach((t=>{Jo(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let e=0;e"poly"===e?t:"quad"===e?2:1)(o,a),l=e.as||[K(e.x),K(e.y)],u=O_[o],c=[];let f=e.extent;at(O_,o)||re("Invalid regression method: "+o),null!=f&&"log"===o&&f[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=u(n,e.x,e.y,a);if(e.params)return void c.push(mr({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const d=f||it(n,e.x),h=e=>{const t={};for(let e=0;eh([e,i.predict(e)]))):ta(i.predict,d,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const z_=134217729;function T_(e,t,n,i,r){let o,a,s,l,u=t[0],c=i[0],f=0,d=0;c>u==c>-u?(o=u,u=t[++f]):(o=c,c=i[++d]);let h=0;if(fu==c>-u?(a=u+o,s=o-(a-u),u=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);fu==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f=33306690738754716e-32*u?l:-function(e,t,n,i,r,o,a){let s,l,u,c,f,d,h,p,m,g,y,v,b,x,w,_,k,E;const A=e-r,$=n-r,D=t-o,S=i-o;x=A*S,d=z_*A,h=d-(d-A),p=A-h,d=z_*S,m=d-(d-S),g=S-m,w=p*g-(x-h*m-p*m-h*g),_=D*$,d=z_*D,h=d-(d-D),p=D-h,d=z_*$,m=d-(d-$),g=$-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,P_[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,P_[1]=b-(y+f)+(f-_),E=v+y,f=E-v,P_[2]=v-(E-f)+(y-f),P_[3]=E;let C=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,P_),F=22204460492503146e-32*a;if(C>=F||-C>=F)return C;if(f=e-A,s=e-(A+f)+(f-r),f=n-$,u=n-($+f)+(f-r),f=t-D,l=t-(D+f)+(f-o),f=i-S,c=i-(S+f)+(f-o),0===s&&0===l&&0===u&&0===c)return C;if(F=11093356479670487e-47*a+33306690738754706e-32*Math.abs(C),C+=A*c+S*s-(D*u+$*l),C>=F||-C>=F)return C;x=s*S,d=z_*s,h=d-(d-s),p=s-h,d=z_*S,m=d-(d-S),g=S-m,w=p*g-(x-h*m-p*m-h*g),_=l*$,d=z_*l,h=d-(d-l),p=l-h,d=z_*$,m=d-(d-$),g=$-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,j_[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,j_[1]=b-(y+f)+(f-_),E=v+y,f=E-v,j_[2]=v-(E-f)+(y-f),j_[3]=E;const M=T_(4,P_,4,j_,L_);x=A*c,d=z_*A,h=d-(d-A),p=A-h,d=z_*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=D*u,d=z_*D,h=d-(d-D),p=D-h,d=z_*u,m=d-(d-u),g=u-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,j_[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,j_[1]=b-(y+f)+(f-_),E=v+y,f=E-v,j_[2]=v-(E-f)+(y-f),j_[3]=E;const O=T_(M,L_,4,j_,B_);x=s*c,d=z_*s,h=d-(d-s),p=s-h,d=z_*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=l*u,d=z_*l,h=d-(d-l),p=l-h,d=z_*u,m=d-(d-u),g=u-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,j_[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,j_[1]=b-(y+f)+(f-_),E=v+y,f=E-v,j_[2]=v-(E-f)+(y-f),j_[3]=E;const N=T_(O,B_,4,j_,I_);return I_[N-1]}(e,t,n,i,r,o,u)}R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(8),R_(8),R_(8),R_(4),R_(8),R_(8),R_(8),R_(12),R_(192),R_(192),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(8),R_(8),R_(8),R_(8),R_(8),R_(8),R_(8),R_(8),R_(8),R_(4),R_(4),R_(4),R_(8),R_(16),R_(16),R_(16),R_(32),R_(32),R_(48),R_(64),R_(1152),R_(1152),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(4),R_(24),R_(24),R_(24),R_(24),R_(24),R_(24),R_(24),R_(24),R_(24),R_(24),R_(1152),R_(1152),R_(1152),R_(1152),R_(1152),R_(2304),R_(2304),R_(3456),R_(5760),R_(8),R_(8),R_(8),R_(16),R_(24),R_(48),R_(48),R_(96),R_(192),R_(384),R_(384),R_(384),R_(768),R_(96),R_(96),R_(96),R_(1152);const q_=Math.pow(2,-52),W_=new Uint32Array(512);class G_{static from(e,t=J_,n=Q_){const i=e.length,r=new Float64Array(2*i);for(let o=0;o>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=e.length>>1;let a=1/0,s=1/0,l=-1/0,u=-1/0;for(let t=0;tl&&(l=n),i>u&&(u=i),this._ids[t]=t}const c=(a+l)/2,f=(s+u)/2;let d,h,p,m=1/0;for(let t=0;t0&&(h=t,m=n)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;ti&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(U_(g,y,v,b,w,_)<0){const e=h,t=v,n=b;h=p,v=w,b=_,p=e,w=t,_=n}const k=function(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l);return{x:e+(u*c-s*f)*d,y:t+(a*f-l*c)*d}}(g,y,v,b,w,_);this._cx=k.x,this._cy=k.y;for(let t=0;t0&&Math.abs(u-o)<=q_&&Math.abs(c-a)<=q_)continue;if(o=u,a=c,l===d||l===h||l===p)continue;let f=0;for(let e=0,t=this._hashKey(u,c);e=0;)if(g=m,g===f){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(y+2),i[g]=y,E++;let v=n[g];for(;m=n[v],U_(u,c,e[2*v],e[2*v+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(v,l,m,i[l],-1,i[v]),i[l]=this._legalize(y+2),n[v]=v,E--,v=m;if(g===f)for(;m=t[g],U_(u,c,e[2*m],e[2*m+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(y+2),i[m]=y,n[g]=g,E--,g=m;this._hullStart=t[l]=g,n[g]=t[v]=l,n[l]=v,r[this._hashKey(u,c)]=l,r[this._hashKey(e[2*g],e[2*g+1])]=g}this.hull=new Uint32Array(E);for(let e=0,t=this._hullStart;e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const a=n[e],s=e-e%3;if(o=s+(e+2)%3,-1===a){if(0===r)break;e=W_[--r];continue}const l=a-a%3,u=s+(e+1)%3,c=l+(a+2)%3,f=t[o],d=t[e],h=t[u],p=t[c];if(V_(i[2*f],i[2*f+1],i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1])){t[e]=p,t[a]=f;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(a,n[o]),this._link(o,c);const s=l+(a+1)%3;r=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;Y_(e,n+i>>1,r),t[e[n]]>t[e[i]]&&Y_(e,n,i),t[e[r]]>t[e[i]]&&Y_(e,r,i),t[e[n]]>t[e[r]]&&Y_(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]s);if(o=o-n?(X_(e,t,r,i),X_(e,t,n,o-1)):(X_(e,t,n,o-1),X_(e,t,r,i))}}function Y_(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function J_(e){return e[0]}function Q_(e){return e[1]}const K_=1e-6;class ek{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>K_||Math.abs(this._y1-r)>K_)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class tk{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class nk{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this;let r,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let i,s,l=0,u=0,c=n.length;l1;)r-=2;for(let e=2;e0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,2===i.length&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new nk(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:o,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=rk(t-l[2*e],2)+rk(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=rk(t-l[2*i],2)+rk(n-l[2*i+1],2);if(f>5<<5,l=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(l>h&&(h=l),f+a>=hk<<5&&(f=0,d+=h,h=0),d+l>=pk)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*dk),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=a,t.height=l,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var w=r.getImageData(0,0,(hk<<5)/o,pk/o).data,_=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u>5),$=w[(d+c)*(hk<<5)+(f+u)<<2]?1<<31-u%32:0;_[A]|=$,k|=$}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=_.slice(0,(t.y1-t.y0)*s)}}}function gk(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,l=32-s,u=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f>>s:0))&t[c+d])return!0;c+=n}return!1}function yk(e,t){var n=e[0],i=e[1];t.x+t.x0i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function vk(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0=f));)if(t.x=a+r,t.y=u+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1])&&(!n||!gk(t,e,s[0]))&&(!n||vk(t,n))){for(var m,g=t.sprite,y=t.width>>5,v=s[0]>>5,b=t.x-(y<<4),x=127&b,w=32-x,_=t.y1-t.y0,k=(t.y+t.y0)*v+(b>>5),E=0;E<_;E++){m=0;for(var A=0;A<=y;A++)e[k+A]|=m<>>x:0);k+=v}return t.sprite=null,!0}return!1}return f.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=(hk<<5)/t,e.height=pk/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(tl()),f=function(e){for(var t=[],n=-1;++n>5)*s[1]),h=null,p=u.length,m=-1,g=[],y=u.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((e,t)=>t.size-e.size));++m>1,v.y=s[1]*(c()+.5)>>1,mk(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?yk(h,v):h=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return g},f.words=function(e){return arguments.length?(u=e,f):u},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=xk(e),f):t},f.fontStyle=function(e){return arguments.length?(i=xk(e),f):i},f.fontWeight=function(e){return arguments.length?(r=xk(e),f):r},f.rotate=function(e){return arguments.length?(o=xk(e),f):o},f.text=function(t){return arguments.length?(e=xk(t),f):e},f.spiral=function(e){return arguments.length?(l=wk[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=xk(e),f):n},f.padding=function(e){return arguments.length?(a=xk(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}(),e)}Ek.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:_k}]},ct(Ek,Gr,{transform(e,t){!e.size||e.size[0]&&e.size[1]||re("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||kk.some((function(n){const i=e[n];return Ve(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||_k;let a,s=e.fontSize||14;if(Ve(s)?a=e.fontSizeRange:s=et(s),a){const e=s,t=hu("sqrt")().domain(it(i,e)).range(a);s=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const l=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(s).random(co).layout(),u=r.size(),c=u[0]>>1,f=u[1]>>1,d=l.length;for(let e,t,n=0;nnew Uint8Array(e),$k=e=>new Uint16Array(e),Dk=e=>new Uint32Array(e);function Sk(e,t,n){const i=(t<257?Ak:t<65537?$k:Dk)(e);return n&&i.set(n),i}function Ck(e,t,n){const i=1<{const i=e[t],r=e[n];return ir?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,l),a)u=t,c=e,t=Array(a+s),e=Dk(a+s),function(e,t,n,i,r,o,a,s,l){let u,c=0,f=0;for(u=0;c0)for(f=0;fe,size:()=>n}}function Mk(e){Gr.call(this,function(){let e=8,t=[],n=Dk(0),i=Sk(0,e),r=Sk(0,e);return{data:()=>t,seen:()=>n=function(e,t,n){return e.length>=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length),add(e){for(let n,i=0,r=t.length,o=e.length;it.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=Sk(t,e,i),r=Sk(t,e))}}}(),e),this._indices=null,this._dims=null}function Ok(e){Gr.call(this,null,e)}Mk.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},ct(Mk,Gr,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((e=>t.modified(e.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],a=i.length;let s,l,u=0;for(;u{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)}))},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,a=i.length;let s,l,u=0;for(n.filters=0,l=0;lh)for(g=h,y=Math.min(f,p);gp)for(g=Math.max(f,p),y=d;gc)for(h=c,p=Math.min(l,f);hf)for(h=Math.max(l,f),p=u;hs[e]&n?null:a[e];return o.filter(o.MOD,u),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^l[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return!t||t^t^l[e]&n?null:a[e]}))):(o.filter(o.ADD,u),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>u(e._index)))}});const Nk="Literal",zk="CallExpression";function Tk(e){this.type=e}var Rk,Pk,Lk,Bk,Ik;Tk.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case"ArrayExpression":return e.elements;case"BinaryExpression":case"LogicalExpression":return[e.left,e.right];case zk:return[e.callee].concat(e.arguments);case"ConditionalExpression":return[e.test,e.consequent,e.alternate];case"MemberExpression":return[e.object,e.property];case"ObjectExpression":return e.properties;case"Property":return[e.key,e.value];case"UnaryExpression":return[e.argument];default:return[]}}(this),n=0,i=t.length;n",Rk[qk]="Identifier",Rk[Wk]="Keyword",Rk[Gk]="Null",Rk[Hk]="Numeric",Rk[Vk]="Punctuator",Rk[Zk]="String",Rk[9]="RegularExpression";var Xk="ArrayExpression",Yk="BinaryExpression",Jk="CallExpression",Qk="ConditionalExpression",Kk="Identifier",eE="Literal",tE="LogicalExpression",nE="MemberExpression",iE="ObjectExpression",rE="Property",oE="UnaryExpression",aE="Unexpected token %0",sE="Unexpected number",lE="Unexpected string",uE="Unexpected identifier",cE="Unexpected reserved word",fE="Unexpected end of input",dE="Invalid regular expression",hE="Invalid regular expression: missing /",pE="Octal literals are not allowed in strict mode.",mE="Duplicate data property in object literal not allowed in strict mode",gE="ILLEGAL",yE="Disabled.",vE=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),bE=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function xE(e,t){if(!e)throw new Error("ASSERT: "+t)}function wE(e){return e>=48&&e<=57}function _E(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function kE(e){return"01234567".indexOf(e)>=0}function EE(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function AE(e){return 10===e||13===e||8232===e||8233===e}function $E(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&vE.test(String.fromCharCode(e))}function DE(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&bE.test(String.fromCharCode(e))}const SE={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function CE(){for(;Lk1114111||"}"!==e)&&WE({},aE,gE),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function OE(){var e,t;for(e=Pk.charCodeAt(Lk++),t=String.fromCharCode(e),92===e&&(117!==Pk.charCodeAt(Lk)&&WE({},aE,gE),++Lk,(e=FE("u"))&&"\\"!==e&&$E(e.charCodeAt(0))||WE({},aE,gE),t=e);Lk>>="===(i=Pk.substr(Lk,4))?{type:Vk,value:i,start:r,end:Lk+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:Vk,value:n,start:r,end:Lk+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:Vk,value:t,start:r,end:Lk+=2}:("//"===t&&WE({},aE,gE),"<>=!+-*%&|^/".indexOf(a)>=0?(++Lk,{type:Vk,value:a,start:r,end:Lk}):void WE({},aE,gE))}function zE(){var e,t,n;if(xE(wE((n=Pk[Lk]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=Lk,e="","."!==n){if(e=Pk[Lk++],n=Pk[Lk],"0"===e){if("x"===n||"X"===n)return++Lk,function(e){let t="";for(;Lk=Bk)return{type:Uk,start:Lk,end:Lk};const e=Pk.charCodeAt(Lk);return $E(e)?function(){var e,t;return e=Lk,t=92===Pk.charCodeAt(Lk)?OE():function(){var e,t;for(e=Lk++;Lk=0&&Lk(xE(t=0&&WE({},dE,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";WE({},dE)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){WE({},dE)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:Lk}}()),PE()):GE(RE())}return n}function KE(){const e=[];if(HE("("),!VE(")"))for(;Lk":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function oA(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=Ik,l=iA(),0===(r=rA(i=Ik)))return l;for(i.prec=r,RE(),t=[e,Ik],o=[l,i,a=iA()];(r=rA(Ik))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=LE(s,l,a),o.push(n);(i=RE()).prec=r,o.push(i),t.push(Ik),n=iA(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=LE(o[u-1].value,o[u-2],n),u-=2;return n}(),VE("?")&&(RE(),t=oA(),HE(":"),e=function(e,t,n){const i=new Tk(Qk);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,oA())),e}function aA(){const e=oA();if(VE(","))throw new Error(yE);return e}function sA(e){Lk=0,Bk=(Pk=e).length,Ik=null,PE();const t=aA();if(Ik.type!==Uk)throw new Error("Unexpect token after expression.");return t}var lA={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function uA(e){function t(t,n,i){return r=>function(t,n,i,r){let o=e(n[0]);return i&&(o=i+"("+o+")",0===i.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&re("Missing arguments to clamp function."),t.length>3&&re("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),regexp:r,test:t("test",r),if:function(t){t.length<3&&re("Missing arguments to if function."),t.length>3&&re("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function cA(e){const t=(e=e||{}).allowed?Mt(e.allowed):{},n=e.forbidden?Mt(e.forbidden):{},i=e.constants||lA,r=(e.functions||uA)(f),o=e.globalvar,a=e.fieldvar,s=Ve(o)?o:e=>`${o}["${e}"]`;let l={},u={},c=0;function f(e){if(yt(e))return e;const t=d[e.type];return null==t&&re("Unsupported type: "+e.type),t(e)}const d={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:at(n,r)?re("Illegal identifier: "+r):at(i,r)?i[r]:at(t,r)?r:(l[r]=1,s(r))},MemberExpression:e=>{const t=!e.computed,n=f(e.object);t&&(c+=1);const i=f(e.property);return n===a&&(u[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&re("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=at(r,t)&&r[t];return i||re("Unrecognized function: "+t),Ve(i)?i(n):i+"("+n.map(f).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(f).join(",")+"]",BinaryExpression:e=>"("+f(e.left)+" "+e.operator+" "+f(e.right)+")",UnaryExpression:e=>"("+e.operator+f(e.argument)+")",ConditionalExpression:e=>"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")",LogicalExpression:e=>"("+f(e.left)+e.operator+f(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(f).join(",")+"}",Property:e=>{c+=1;const t=f(e.key);return c-=1,t+":"+f(e.value)}};function h(e){const t={code:f(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return h.functions=r,h.constants=i,h}var fA,dA,hA,pA,mA,gA,yA,vA,bA,xA,wA,_A,kA,EA,AA,$A,DA=new Og,SA=new Og,CA={point:ny,lineStart:ny,lineEnd:ny,polygonStart:function(){DA=new Og,CA.lineStart=FA,CA.lineEnd=MA},polygonEnd:function(){var e=+DA;SA.add(e<0?Lg+e:e),this.lineStart=this.lineEnd=this.point=ny},sphere:function(){SA.add(Lg)}};function FA(){CA.point=OA}function MA(){NA(fA,dA)}function OA(e,t){CA.point=NA,fA=e,dA=t,hA=e*=Ig,pA=Wg(t=(t*=Ig)/2+Pg),mA=Yg(t)}function NA(e,t){var n=(e*=Ig)-hA,i=n>=0?1:-1,r=i*n,o=Wg(t=(t*=Ig)/2+Pg),a=Yg(t),s=mA*a,l=pA*o+s*Wg(r),u=s*i*Yg(r);DA.add(qg(u,l)),hA=e,pA=o,mA=a}var zA,TA,RA,PA,LA,BA,IA,jA,UA,qA,WA,GA,HA,VA,ZA,XA,YA={point:JA,lineStart:KA,lineEnd:e$,polygonStart:function(){YA.point=t$,YA.lineStart=n$,YA.lineEnd=i$,EA=new Og,CA.polygonStart()},polygonEnd:function(){CA.polygonEnd(),YA.point=JA,YA.lineStart=KA,YA.lineEnd=e$,DA<0?(gA=-(vA=180),yA=-(bA=90)):EA>Ng?bA=90:EA<-Ng&&(yA=-90),$A[0]=gA,$A[1]=vA},sphere:function(){gA=-(vA=180),yA=-(bA=90)}};function JA(e,t){AA.push($A=[gA=e,vA=e]),tbA&&(bA=t)}function QA(e,t){var n=mv([e*Ig,t*Ig]);if(kA){var i=yv(kA,n),r=yv([i[1],-i[0],0],i);xv(r),r=pv(r);var o,a=e-xA,s=a>0?1:-1,l=r[0]*Bg*s,u=jg(a)>180;u^(s*xAbA&&(bA=o):u^(s*xA<(l=(l+360)%360-180)&&lbA&&(bA=t)),u?er$(gA,vA)&&(vA=e):r$(e,vA)>r$(gA,vA)&&(gA=e):vA>=gA?(evA&&(vA=e)):e>xA?r$(gA,e)>r$(gA,vA)&&(vA=e):r$(e,vA)>r$(gA,vA)&&(gA=e)}else AA.push($A=[gA=e,vA=e]);tbA&&(bA=t),kA=n,xA=e}function KA(){YA.point=QA}function e$(){$A[0]=gA,$A[1]=vA,YA.point=JA,kA=null}function t$(e,t){if(kA){var n=e-xA;EA.add(jg(n)>180?n+(n>0?360:-360):n)}else wA=e,_A=t;CA.point(e,t),QA(e,t)}function n$(){CA.lineStart()}function i$(){t$(wA,_A),CA.lineEnd(),jg(EA)>Ng&&(gA=-(vA=180)),$A[0]=gA,$A[1]=vA,kA=null}function r$(e,t){return(t-=e)<0?t+360:t}function o$(e,t){return e[0]-t[0]}function a$(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tt.indexOf(e)>=0)):t},R_union:function(e,t){var n=De(t[0]),i=De(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]i&&(n=t[1],i=t[0]),e.length?ii&&(e[1]=i),e):[n,i]}};function M$(e,t,n,i){t[0].type!==Nk&&re("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&$e(t).value)!==w$||at(i,a)||(i[a]=n.getData(r).indataRef(n,o)),at(i,s)||(i[s]=n.getData(r).tuplesRef())}function O$(e){const t=this.context.data[e];return t?t.values.value:[]}const N$=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},z$=N$("format"),T$=N$("timeFormat"),R$=N$("utcFormat"),P$=N$("timeParse"),L$=N$("utcParse"),B$=new Date(2e3,0,1);function I$(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(B$.setYear(2e3),B$.setMonth(e),B$.setDate(t),T$.call(this,B$,n)):""}const j$="%",U$="$";function q$(e,t,n,i){t[0].type!==Nk&&re("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!at(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(e){}}function W$(e,t,n,i){if(t[0].type===Nk)G$(n,i,t[0].value);else for(e in n.scales)G$(n,i,e)}function G$(e,t,n){const i=j$+n;if(!at(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function H$(e,t){if(Ve(e))return e;if(yt(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[fu])?i.value:void 0}var n}function V$(e,t){return function(n,i,r){if(n){const t=H$(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const Z$=V$("area",(function(e){return SA=new Og,Mg(e,CA),2*SA})),X$=V$("bounds",(function(e){var t,n,i,r,o,a,s;if(bA=vA=-(gA=yA=1/0),AA=[],Mg(e,YA),n=AA.length){for(AA.sort(o$),t=1,o=[i=AA[0]];tr$(i[0],i[1])&&(i[1]=r[1]),r$(r[0],i[1])>r$(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,t=0,i=o[n=o.length-1];t<=n;i=r,++t)r=o[t],(s=r$(i[1],r[0]))>a&&(a=s,gA=r[0],vA=i[1])}return AA=$A=null,gA===1/0||yA===1/0?[[NaN,NaN],[NaN,NaN]]:[[gA,yA],[vA,bA]]})),Y$=V$("centroid",(function(e){zA=TA=RA=PA=LA=BA=IA=jA=0,UA=new Og,qA=new Og,WA=new Og,Mg(e,s$);var t=+UA,n=+qA,i=+WA,r=Vg(t,n,i);return rtD(e,t)}const iD={};function rD(e){return xe(e)||ArrayBuffer.isView(e)?e:null}function oD(e){return rD(e)||(yt(e)?e:null)}const aD=e=>e.data;function sD(e,t){const n=O$.call(t,e);return n.root&&n.root.lookup||{}}const lD=()=>"undefined"!=typeof window&&window||null;function uD(e,t,n){if(!e)return[];const[i,r]=e,o=(new ef).set(i[0],i[1],r[0],r[1]);return Mp(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=Ge(e.marktype),i=Ge(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const cD={random:()=>co(),cumulativeNormal:_o,cumulativeLogNormal:So,cumulativeUniform:zo,densityNormal:wo,densityLogNormal:Do,densityUniform:No,quantileNormal:ko,quantileLogNormal:Co,quantileUniform:To,sampleNormal:xo,sampleLogNormal:$o,sampleUniform:Oo,isArray:xe,isBoolean:dt,isDate:ht,isDefined:e=>void 0!==e,isNumber:mt,isObject:we,isRegExp:gt,isString:yt,isTuple:dr,isValid:e=>null!=e&&e==e,toBoolean:Dt,toDate:e=>Ct(e),toNumber:De,toString:Ft,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;iit(e),inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:uD,clampRange:He,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=lD();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=lD();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Ll(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(fe).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?kc(n,t=t||dc(e)):e}},panLinear:ze,panLog:Te,panPow:Re,panSymlog:Pe,zoomLinear:Be,zoomLog:Ie,zoomPow:je,zoomSymlog:Ue,encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,o){const a=this.context.dataflow,s=this.context.data[e],l=s.input,u=a.stamp();let c,f,d=s.changes;if(!1===a._trigger||!(l.value.length||t||i))return 0;if((!d||d.stamp{s.modified=!0,a.pulse(l,d).run()}),!0,1)),n&&(c=!0===n?fe:xe(n)||dr(n)?n:nD(n),d.remove(c)),t&&d.insert(t),i&&(c=nD(i),l.value.some(c)?d.remove(c):d.insert(i)),r)for(f in o)d.modify(r,f,o[f]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=Ge(e))[e.length-1];return void 0===r||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return Ge(e).reduce(((t,n,i)=>{let[r,o]=n;return t+(0==i?`M ${r},${o} `:i===e.length-1?" Z":`L ${r},${o} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:o}=n,a=(new ef).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[e,n]of t)ea.x2&&(a.x2=e),na.y2&&(a.y2=n);return a.translate(i,r),uD([[a.x1,a.y1],[a.x2,a.y2]],e,o).filter((e=>function(e,t,n){let i=0;for(let r=0,o=n.length-1;rt!=s>t&&e<(a-l)*(t-u)/(s-u)+l&&i++}return 1&i}(e.x,e.y,t)))}},fD=["view","item","group","xy","x","y"],dD="this.",hD={},pD={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${$t(U$+e)}]`,functions:function(e){const t=uA(e);fD.forEach((e=>t[e]="event.vega."+e));for(const e in cD)t[e]=dD+e;return nt(t,function(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=W$,n._range=W$,n._scale=W$;const i=t=>"_["+(t.type===Nk?$t(j$+t.value):$t(j$)+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}(e,cD,hD)),t},constants:lA,visitors:hD},mD=cA(pD);function gD(e,t,n){return 1===arguments.length?cD[e]:(cD[e]=t,n&&(hD[e]=n),mD&&(mD.functions[e]=dD+e),this)}function yD(e,t){const n={};let i;try{i=sA(e=yt(e)?e:$t(e)+"")}catch(t){re("Expression parse error: "+e)}i.visit((e=>{if(e.type!==zk)return;const i=e.callee.name,r=pD.visitors[i];r&&r(i,e.arguments,t,n)}));const r=mD(i);return r.globals.forEach((e=>{const i=U$+e;!at(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:nt({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}gD("bandwidth",(function(e,t){const n=H$(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),W$),gD("copy",(function(e,t){const n=H$(e,(t||this).context);return n?n.copy():void 0}),W$),gD("domain",(function(e,t){const n=H$(e,(t||this).context);return n?n.domain():[]}),W$),gD("range",(function(e,t){const n=H$(e,(t||this).context);return n&&n.range?n.range():[]}),W$),gD("invert",(function(e,t,n){const i=H$(e,(n||this).context);return i?xe(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),W$),gD("scale",(function(e,t,n){const i=H$(e,(n||this).context);return i?i(t):void 0}),W$),gD("gradient",(function(e,t,n,i,r){e=H$(e,(r||this).context);const o=rc(t,n);let a=e.domain(),s=a[0],l=$e(a),u=le;return l-s?u=$u(e,s,l):e=(e.interpolator?hu("sequential")().interpolator(e.interpolator()):hu("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,l=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),l!==$e(a)&&a.push(l)),a.forEach((t=>o.stop(u(t),e(t)))),o}),W$),gD("geoArea",Z$,W$),gD("geoBounds",X$,W$),gD("geoCentroid",Y$,W$),gD("geoShape",(function(e,t,n){const i=H$(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),W$),gD("indata",(function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r}),(function(e,t,n,i){t[0].type!==Nk&&re("First argument to indata must be a string literal."),t[1].type!==Nk&&re("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;at(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),gD("data",O$,q$),gD("treePath",(function(e,t,n){const i=sD(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(aD):void 0}),q$),gD("treeAncestors",(function(e,t){const n=sD(e,this)[t];return n?n.ancestors().map(aD):void 0}),q$),gD("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,l=this.context.data[e],u=l?l.values.value:[],c=l?l[A$]&&l[A$].value:void 0,f=n===w$,d=u.length,h=0;h(e[o[n].field]=t,e)),{}))}else l=k$,u=E$(r),(f=(c=v[l]||(v[l]={}))[s]||(c[s]=[])).push(u),n&&(f=b[s]||(b[s]=[])).push({[k$]:u});return t=t||_$,v[k$]?v[k$]=F$[`${k$}_${t}`](...Object.values(v[k$])):Object.keys(v).forEach((e=>{v[e]=Object.keys(v[e]).map((t=>v[e][t])).reduce(((n,i)=>void 0===n?i:F$[`${x[e]}_${t}`](n,i)))})),y=Object.keys(b),n&&y.length&&(v[i?"vlPoint":"vlMulti"]=t===_$?{or:y.reduce(((e,t)=>(e.push(...b[t]),e)),[])}:{and:y.map((e=>({or:b[e]})))}),v}),M$),gD("vlSelectionTuples",(function(e,t){return e.map((e=>nt(t.fields?{values:t.fields.map((t=>(t.getter||(t.getter=ae(t.field)))(e.datum)))}:{[k$]:E$(e.datum)},t)))}));const vD=Mt(["rule"]),bD=Mt(["group","image","rect"]);function xD(e){return(e+"").toLowerCase()}function wD(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var _D={operator:(e,t)=>wD(e,["_"],t.code),parameter:(e,t)=>wD(e,["datum","_"],t.code),event:(e,t)=>wD(e,["event"],t.code),handler:(e,t)=>wD(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const e in i){const t="o["+$t(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return vD[t]||(e.x2&&(e.x?(bD[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(bD[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",wD(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map($t).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map(((e,i)=>{const r=t[i];let o,a;return e.path?(o=`a${e.path}`,a=`b${e.path}`):((n=n||{})["f"+i]=e,o=`this.f${i}(a)`,a=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(o,a,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function kD(e,t,n){if(!e||!we(e))return e;for(let i,r=0,o=ED.length;re&&e.$tupleid?hr:e));return t.fn[n]||(t.fn[n]=Xe(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const o=t.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(r),a.detachSubflow=()=>t.detach(o),a}}},{key:"$tupleid",parse:function(){return hr}}];const AD={skip:!0};function $D(e,t,n,i){return new DD(e,t,n,i)}function DD(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||_D,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function SD(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function CD(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}DD.prototype=SD.prototype={fork(){const e=new SD(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),"collect"===xD(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push((()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const i in e.data){const r=n.data[i]||(n.data[i]={});e.data[i].forEach((e=>r[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[xD(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((e=>t.parseOperator(e))),n.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==xD(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||re("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=xe(r)?r.map((e=>kD(e,n,t))):kD(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map((e=>n.get(e))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((e=>n.get(e))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&re("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=we(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||re("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(e,r,t,o,a)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach((n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)}))}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map((t=>t.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach((e=>{n.update(t.signals[e],r[e],AD)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(fe).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const FD="default";function MD(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function OD(e,t){var n=e._runtime.data;return at(n,t)||re("Unrecognized data set: "+t),n[t]}function ND(e,t){xr(t)||re("Second argument to changes must be a changeset.");const n=OD(this,e);return n.modified=!0,this.pulse(n.input,t)}function zD(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function TD(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function RD(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}const PD="view",LD={trap:!1};function BD(e,t,n,i){e._eventListeners.push({type:n,sources:Ge(t),handler:i})}function ID(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||we(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function jD(e){return e.item}function UD(e){return e.item.mark.source}function qD(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function WD(e,t,n){const i=document.createElement(e);for(const e in t)i.setAttribute(e,t[e]);return null!=n&&(i.textContent=n),i}const GD="vega-bind-radio";function HD(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),BD(i,t,r,o),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function VD(e,t,n,i){const r=i.signal(n.signal),o=WD("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(WD("label"));a.appendChild(WD("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=ZD;switch(n.input){case"checkbox":s=XD;break;case"select":s=YD;break;case"radio":s=JD;break;case"range":s=QD}s(e,a,n,r)}function ZD(e,t,n,i){const r=WD("input");for(const e in n)"signal"!==e&&"element"!==e&&r.setAttribute("input"===e?"type":e,n[e]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=e=>r.value=e}function XD(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=WD("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function YD(e,t,n,i){const r=WD("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};KD(e,i)&&(n.selected=!0),r.appendChild(WD("option",n,(o[t]||e)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t{const s={type:"radio",name:n.signal,value:t};KD(t,i)&&(s.checked=!0);const l=WD("input",s);l.addEventListener("change",(()=>e.update(t)));const u=WD("label",{},(o[a]||t)+"");return u.prepend(l),r.appendChild(u),l})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e{l.textContent=s.value,e.update(+s.value)};s.addEventListener("input",u),s.addEventListener("change",u),e.elements=[s],e.set=e=>{s.value=e,l.textContent=e}}function KD(e,t){return e===t||e+""==t+""}function eS(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,zD(e),TD(e),RD(e),r,o).background(e.background())}function tS(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function nS(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(n){t=null,e.error(n)}return t}const iS=e=>+e||0;function rS(e){return we(e)?{top:iS(e.top),bottom:iS(e.bottom),left:iS(e.left),right:iS(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(iS(e))}async function oS(e,t,n,i){const r=Fp(t),o=r&&r.headless;return o||re("Unrecognized renderer type: "+t),await e.runAsync(),eS(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var aS="width",sS="height",lS="padding",uS={skip:!0};function cS(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===lS?i.left+i.right:0)}function fS(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===lS?i.top+i.bottom:0)}function dS(e,t){return t.modified&&xe(t.input.value)&&e.indexOf("_:vega:_")}function hS(e,t){return!("parent"===e||t instanceof Hr.proxy)}function pS(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":xe(e)?mS(e):we(e)&&!ht(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(xe(n)?mS(n):gS(n))})).join("\n")):e+"";var t}(i))}function mS(e){return"["+e.map(gS).join(", ")+"]"}function gS(e){return xe(e)?"[…]":we(e)&&!ht(e)?"{…}":e}function yS(e,t){const n=this;if(t=t||{},qr.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=nt({},e.locale,t.locale);n.locale(Oi(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Sp.Canvas,n._scenegraph=new ah;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||pS,n._redraw=!0,n._handler=(new Oh).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=nt({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{xe(e[t])&&(e[t]=Mt(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return $D(e,Hr,cD,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:nt({},e)}))),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=cS(n,n._width),n._viewHeight=fS(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[aS],i=t[sS],r=t[lS];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=cS(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=fS(e,t.size),o()}),{size:i});const a=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}(n),function(e){e.add(null,(t=>(e._background=t.bg,e._resize=1,t.bg)),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:FD,item:null}));e.on(e.events("view","mousemove"),t,((e,n)=>{const i=t.value,r=i?yt(i)?i:i.user:FD,o=n.item&&n.item.cursor||null;return i&&r===i.user&&o==i.item?i:{user:r,item:o}})),e.add(null,(function(t){let n=t.cursor,i=this.value;return yt(n)||(i=n.item,n=n.user),MD(e,n&&n!==FD?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function vS(e,t){return at(e._signals,t)?e._signals[t]:re("Unrecognized signal name: "+$t(t))}function bS(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function xS(e,t,n,i){let r=bS(n,i);return r||(r=tS(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function wS(e,t,n){const i=bS(t,n);return i&&t._targets.remove(i),e}ct(yS,qr,{async evaluate(e,t,n){if(await qr.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=RD(i=this),o=zD(i),a=TD(i),i._renderer.background(i.background()),i._renderer.resize(o,a,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(o,a)}catch(e){i.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var i,r,o,a;return n&&ur(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&CD(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=vS(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",rS(e)):rS(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(Fp(e)||re("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(qr.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(vS(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(aS,n,uS),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(sS,i,uS),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),a._origin[0]===r[0]&&a._origin[1]===r[1]||(a._resize=1,a._origin=r),s&&a.run("enter"),o&&a.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=tS(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),o=r.length;--o>=0;)if(i=r[o].type,n=r[o].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return xS(this,e,vS(this,e),t)},removeSignalListener(e,t){return wS(this,vS(this,e),t)},addDataListener(e,t){return xS(this,e,OD(this,e).values,t)},removeDataListener(e,t){return wS(this,OD(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=MD(this,null);this._globalCursor=!!e,t&&MD(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new Cx.B7,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?(0,Cx.zO)():+n,i._restart((function o(a){a+=r,i._restart(o,r+=t,n),e(a)}),t,n)},i.restart(e,t,n),i)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},events:function(e,t,n){var i,r=this,o=new Cr(n),a=function(n,i){r.runAsync(null,(()=>{e===PD&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),o.receive(function(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=RD(e),(i=hh(t.changedTouches?t.changedTouches[0]:t,a))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function o(e){if(!e)return n;yt(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:et(e),item:et(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}(r,n,i))}))};if("timer"===e)ID(r,"timer",t)&&r.timer(a,t);else if(e===PD)ID(r,"view",t)&&r.addEventListener(t,a,LD);else if("window"===e?ID(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&ID(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,l=i.length;s=0;)r[e].stop();for(e=o.length;--e>=0;)for(t=(n=o[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return i&&i.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",jD),UD,qD(e)),this.on(this.events("view","mouseout",jD),UD,qD(t)),this},data:function(e,t){return arguments.length<2?OD(this,e).values.value:ND.call(this,e,wr().remove(fe).insert(t))},change:ND,insert:function(e,t){return ND.call(this,e,wr().insert(t))},remove:function(e,t){return ND.call(this,e,wr().remove(t))},scale:function(e){var t=this._runtime.scales;return at(t,e)||re("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=Fp(i);e=n._el=e?nS(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),CD(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||Oh,s=e?o.renderer:o.headless;return n._renderer=s?eS(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),tS(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,RD(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,a),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=nS(n,t,!0):e.appendChild(WD("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=nS(n,e.param.element,!!e.param.input))})),n._bind.forEach((e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,(()=>{r.source=!0,e.signal(i.signal,t)}))}},i.debounce&&(r.update=tt(i.debounce,r.update))),(null==i.input&&i.element?HD:VD)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,(()=>{r.source?r.source=!1:r.set(e.signal(i.signal))})),r.active=!0)}(n,e.element||t,e)}))),n},toImageURL:async function(e,t){e!==Sp.Canvas&&e!==Sp.SVG&&e!==Sp.PNG&&re("Unrecognized image type: "+e);const n=await oS(this,e,t);return e===Sp.SVG?function(e,t){const n=new Blob([e],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(n.svg()):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await oS(this,Sp.Canvas,e,t)).canvas()},toSVG:async function(e){return(await oS(this,Sp.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:dS,signals:hS,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this}});const _S="view",kS="[",ES="]",AS="{",$S="}",DS=":",SS=",",CS="@",FS=">",MS=/[[\]{}]/,OS={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let NS,zS;function TS(e,t,n){return NS=t||_S,zS=n||OS,PS(e.trim()).map(LS)}function RS(e,t,n,i,r){const o=e.length;let a,s=0;for(;t=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function PS(e){const t=[],n=e.length;let i=0,r=0;for(;r' after between selector: "+e;n=n.map(LS);const r=LS(e.slice(1).trim());return r.between?{between:n,stream:r}:(r.between=n,r)}(e):function(e){const t={source:NS},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if(e[l-1]===$S){if(u=e.lastIndexOf(AS),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(SS);if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;if(e[0]===CS&&(a=++u),i=RS(e,u,DS),i1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],zS[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0],"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1)),null!=r&&(t.filter=r),o[0]&&(t.throttle=o[0]),o[1]&&(t.debounce=o[1]),t}(e)}function BS(e){return we(e)?e:{type:e||"pad"}}const IS=e=>+e||0,jS=e=>({top:e,bottom:e,left:e,right:e});function US(e){return we(e)?e.signal?e:{top:IS(e.top),bottom:IS(e.bottom),left:IS(e.left),right:IS(e.right)}:jS(IS(e))}const qS=e=>we(e)&&!xe(e)?nt({},e):{value:e};function WS(e,t,n,i){return null!=n?(we(n)&&!xe(n)||xe(n)&&n.length&&we(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function GS(e,t,n){for(const n in t)WS(e,n,t[n]);for(const t in n)WS(e,t,n[t],"update")}function HS(e,t,n){for(const i in t)n&&at(n,i)||(e[i]=nt(e[i]||{},t[i]));return e}function VS(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const ZS="mark",XS="frame",YS="scope",JS="axis",QS="axis-domain",KS="axis-grid",eC="axis-label",tC="axis-tick",nC="axis-title",iC="legend",rC="legend-band",oC="legend-entry",aC="legend-gradient",sC="legend-label",lC="legend-symbol",uC="legend-title",cC="title",fC="title-text",dC="title-subtitle";function hC(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const pC=e=>yt(e)?$t(e):e.signal?`(${e.signal})`:vC(e);function mC(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:$t(e)));for(;t.length&&null==$e(t);)t.pop();return t.unshift(pC(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?gC("hcl",e.h,e.c,e.l):e.h||e.s?gC("hsl",e.h,e.s,e.l):e.l||e.a?gC("lab",e.l,e.a,e.b):e.r||e.g||e.b?gC("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?vC(e.field):void 0!==e.value?$t(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=pC(e.scale);return null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+yC(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0")),t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${yC(e.exponent)})`),null!=e.mult&&(t+=`*${yC(e.mult)}`),null!=e.offset&&(t+=`+${yC(e.offset)}`),e.round&&(t=`round(${t})`),t}const gC=(e,t,n,i)=>`(${e}(${[t,n,i].map(mC).join(",")})+'')`;function yC(e){return we(e)?"("+mC(e)+")":e}function vC(e){return bC(we(e)?e:{datum:e})}function bC(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):re("Invalid field reference: "+$t(e));return e.signal||(i=yt(i)?oe(i).map($t).join("]["):bC(i)),t+"["+i+"]"}function xC(e,t,n,i,r,o){const a={};(o=o||{}).encoders={$encode:a},e=function(e,t,n,i,r){const o={},a={};let s,l,u,c;for(l in l="lineBreak","text"!==t||null==r[l]||VS(l,e)||hC(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===XS?r.group:n===ZS?nt({},r.mark,r[t]):null,c)u=VS(l,e)||("fill"===l||"stroke"===l)&&(VS("fill",e)||VS("stroke",e)),u||hC(o,l,c[l]);for(l in Ge(i).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)VS(t,e)||hC(o,t,n[t])})),e=nt({},e),o)c=o[l],c.signal?(s=s||{})[l]=c:a[l]=c;return e.enter=nt(a,e.enter),s&&(e.update=nt(s,e.update)),e}(e,t,n,i,r.config);for(const n in e)a[n]=wC(e[n],t,o,r);return o}function wC(e,t,n,i){const r={},o={};for(const t in e)null!=e[t]&&(r[t]=_C((a=e[t],xe(a)?function(e){let t="";return e.forEach((e=>{const n=mC(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===$e(t)&&(t+="null"),t}(a):mC(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function _C(e,t,n,i){const r=yD(e,t);return r.$fields.forEach((e=>i[e]=1)),nt(n,r.$params),r.$expr}const kC="outer",EC=["value","update","init","react","bind"];function AC(e,t){re(e+' for "outer" push: '+$t(t))}function $C(e,t){const n=e.name;if(e.push===kC)t.signals[n]||AC("No prior signal definition",n),EC.forEach((t=>{void 0!==e[t]&&AC("Invalid property ",t)}));else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function DC(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function SC(e,t,n,i){return new DC(e,t,n,i)}function CC(e,t){return SC("operator",e,t)}function FC(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function MC(e,t){return t?{$field:e,$name:t}:{$field:e}}const OC=MC("key");function NC(e,t){return{$compare:e,$order:t}}function zC(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const TC="scope",RC="view";function PC(e){return e&&e.signal}function LC(e){if(PC(e))return!0;if(we(e))for(const t in e)if(LC(e[t]))return!0;return!1}function BC(e,t){return null!=e?e:t}function IC(e){return e&&e.signal||e}const jC="timer";function UC(e,t){return(e.merge?qC:e.stream?WC:e.type?GC:re("Invalid stream specification: "+$t(e)))(e,t)}function qC(e,t){const n=HC({merge:e.merge.map((e=>UC(e,t)))},e,t);return t.addStream(n).id}function WC(e,t){const n=HC({stream:UC(e.stream,t)},e,t);return t.addStream(n).id}function GC(e,t){let n;var i;e.type===jC?(n=t.event(jC,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===TC?RC:i||RC,e.type);const r=HC({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function HC(e,t,n){let i=t.between;return i&&(2!==i.length&&re('Stream "between" parameter must have 2 entries: '+$t(t)),e.between=[UC(i[0],n),UC(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===TC&&i.push("inScope(event.item)"),i.length&&(e.filter=yD("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const VC={code:"_.$value",ast:{type:"Identifier",value:"value"}};function ZC(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const XC=e=>(t,n,i)=>SC(e,n,t||void 0,i),YC=XC("aggregate"),JC=XC("axisticks"),QC=XC("bound"),KC=XC("collect"),eF=XC("compare"),tF=XC("datajoin"),nF=XC("encode"),iF=XC("expression"),rF=XC("facet"),oF=XC("field"),aF=XC("key"),sF=XC("legendentries"),lF=XC("load"),uF=XC("mark"),cF=XC("multiextent"),fF=XC("multivalues"),dF=XC("overlap"),hF=XC("params"),pF=XC("prefacet"),mF=XC("projection"),gF=XC("proxy"),yF=XC("relay"),vF=XC("render"),bF=XC("scale"),xF=XC("sieve"),wF=XC("sortitems"),_F=XC("viewlayout"),kF=XC("values");let EF=0;const AF={min:"min",max:"max",count:"sum"};function $F(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=FF(e.domain,e,t),null!=e.range&&(n.range=LF(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=DF(e.type||e),null!=e.gamma&&(t.interpolateGamma=DF(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return we(e)?{interval:DF(e.interval),step:DF(e.step)}:DF(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||xe(e)?SF(e,t):t.objectProperty(e)}(e.bins,t)),e)at(n,i)||"name"===i||(n[i]=DF(e[i],t))}function DF(e,t){return we(e)?e.signal?t.signalRef(e.signal):re("Unsupported object: "+$t(e)):e}function SF(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>DF(e,t)))}function CF(e){re("Can not find data set: "+$t(e))}function FF(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(xe(e)?MF:e.fields?NF:OF)(e,t,n);null==t.domainMin&&null==t.domainMax||re("No scale domain defined for domainMin/domainMax to override.")}function MF(e,t,n){return e.map((e=>DF(e,n)))}function OF(e,t,n){const i=n.getData(e.data);return i||CF(e.data),yu(t.type)?i.valuesRef(n,e.field,TF(e.sort,!1)):wu(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function NF(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=yt(t)?{data:i,field:t}:xe(t)||t.signal?function(e,t){const n="_:vega:_"+EF++,i=KC({});if(xe(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+$t(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,xF({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(yu(t.type)?zF:wu(t.type)?RF:PF)(e,n,r)}function zF(e,t,n){const i=TF(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||CF(e.data),n.countsRef(t,e.field,i)})),s={groupby:OC,pulse:a};i&&(r=i.op||"count",o=i.field?zC(r,i.field):"count",s.ops=[AF[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(YC(s));const l=t.add(KC({pulse:FC(r)}));return o=t.add(kF({field:OC,sort:t.sortRef(i),pulse:FC(l)})),FC(o)}function TF(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!AF[e.op]&&re("Multiple domain scales can not be sorted using "+e.op):re("No field provided for sort aggregate op: "+e.op):we(e)?e.field="key":e={field:"key"}),e}function RF(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||CF(e.data),n.domainRef(t,e.field)}));return FC(t.add(fF({values:i})))}function PF(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||CF(e.data),n.extentRef(t,e.field)}));return FC(t.add(cF({extents:i})))}function LF(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(yt(r)){if(i&&at(i,r))return LF(e=nt({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=yu(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:re("Unrecognized scale range value: "+$t(r))}else{if(r.scheme)return n.scheme=xe(r.scheme)?SF(r.scheme,t):DF(r.scheme,t),r.extent&&(n.schemeExtent=SF(r.extent,t)),void(r.count&&(n.schemeCount=DF(r.count,t)));if(r.step)return void(n.rangeStep=DF(r.step,t));if(yu(e.type)&&!xe(r))return FF(r,e,t);xe(r)||re("Unsupported range type: "+$t(r))}return r.map((e=>(xe(e)?SF:DF)(e,t)))}function BF(e,t,n){return xe(e)?e.map((e=>BF(e,t,n))):we(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:re("Unsupported parameter object: "+$t(e)):e}const IF="top",jF="left",UF="right",qF="bottom",WF="center",GF="vertical",HF="start",VF="end",ZF="index",XF="label",YF="offset",JF="perc",QF="perc2",KF="value",eM="guide-label",tM="guide-title",nM="group-title",iM="group-subtitle",rM="symbol",oM="gradient",aM="discrete",sM="size",lM=[sM,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],uM={name:1,style:1,interactive:1},cM={value:0},fM={value:1},dM="group",hM="rect",pM="rule",mM="symbol",gM="text";function yM(e){return e.type=dM,e.interactive=e.interactive||!1,e}function vM(e,t){const n=(n,i)=>BC(e[n],BC(t[n],i));return n.isVertical=n=>GF===BC(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>BC(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>BC(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>BC(e.columns,BC(t.columns,+n.isVertical(!0))),n}function bM(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function xM(e,t,n){return`item.anchor === '${HF}' ? ${e} : item.anchor === '${VF}' ? ${t} : ${n}`}const wM=xM($t(jF),$t(UF),$t(WF));function _M(e,t){return t?e?we(e)?Object.assign({},e,{offset:_M(e.offset,t)}):{value:e,offset:t}:t:e}function kM(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=HS(e.encode,t,uM)):e.interactive=!1,e}function EM(e,t,n,i){const r=vM(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let l,u,c,f,d;o?(u=[0,1],c=[0,0],f=a,d=s):(u=[0,0],c=[1,0],f=s,d=a);const h={enter:l={opacity:cM,x:cM,y:cM,width:qS(f),height:qS(d)},update:nt({},l,{opacity:fM,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:cM}};return GS(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),kM({type:hM,role:aC,encode:h},i)}function AM(e,t,n,i,r){const o=vM(e,n),a=o.isVertical(),s=o.gradientThickness(),l=o.gradientLength();let u,c,f,d,h="";a?(u="y",f="y2",c="x",d="width",h="1-"):(u="x",f="x2",c="y",d="height");const p={opacity:cM,fill:{scale:t,field:KF}};p[u]={signal:h+"datum."+JF,mult:l},p[c]=cM,p[f]={signal:h+"datum."+QF,mult:l},p[d]=qS(s);const m={enter:p,update:nt({},p,{opacity:fM}),exit:{opacity:cM}};return GS(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),kM({type:hM,role:rC,key:KF,from:r,encode:m},i)}const $M=`datum.${JF}<=0?"${jF}":datum.${JF}>=1?"${UF}":"${WF}"`,DM=`datum.${JF}<=0?"${qF}":datum.${JF}>=1?"${IF}":"middle"`;function SM(e,t,n,i){const r=vM(e,t),o=r.isVertical(),a=qS(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:cM},update:u={opacity:fM,text:{field:XF}},exit:{opacity:cM}};return GS(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:BC(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:DM},c="y",f="x",h="1-"):(l.align=u.align={signal:$M},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+JF,mult:s},l[f]=u[f]=a,a.offset=BC(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+ZF}:void 0,kM({type:gM,role:sC,style:eM,key:KF,from:i,encode:p,overlap:d},n)}function CM(e,t,n,i,r){const o=vM(e,t),a=n.entries,s=!(!a||!a.interactive),l=a?a.name:void 0,u=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${YF} : datum.${sM}`,h=u?qS(u):{field:sM},p=`datum.${ZF}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:cM,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:fM,x:y.x,y:y.y},exit:{opacity:cM}};let w=null,_=null;e.fill||(w=t.symbolBaseFillColor,_=t.symbolBaseStrokeColor),GS(g,{fill:o("symbolFillColor",w),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",_),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),lM.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:KF})}));const k=kM({type:mM,role:lC,key:KF,from:f,clip:!!u||void 0,encode:g},n.symbols),E=qS(c);E.offset=o("labelOffset"),g={enter:y={opacity:cM,x:{signal:d,offset:E},y:h},update:v={opacity:fM,text:{field:XF},x:y.x,y:y.y},exit:{opacity:cM}},GS(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=kM({type:gM,role:sC,style:eM,key:KF,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:cM,height:u?qS(u):cM,opacity:cM},exit:{opacity:cM},update:v={opacity:fM,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${b}`,v.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,x={field:p}),v.column.signal=`(${r})?${v.column.signal}:${p}`,yM({role:YS,from:i={facet:{data:i,name:"value",groupby:ZF}},encode:HS(g,a,uM),marks:[k,A],name:l,interactive:s,sort:x})}const FM='item.orient === "left"',MM='item.orient === "right"',OM=`(${FM} || ${MM})`,NM=`datum.vgrad && ${OM}`,zM=xM('"top"','"bottom"','"middle"'),TM=`datum.vgrad && ${MM} ? (${xM('"right"','"left"','"center"')}) : (${OM} && !(datum.vgrad && ${FM})) ? "left" : ${wM}`,RM=`item._anchor || (${OM} ? "middle" : "start")`,PM=`${NM} ? (${FM} ? -90 : 90) : 0`,LM=`${OM} ? (datum.vgrad ? (${MM} ? "bottom" : "top") : ${zM}) : "top"`;function BM(e,t){let n;return we(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+IM(e.path)+")":e.sphere&&(n="geoShape("+IM(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function IM(e){return we(e)&&e.signal?e.signal:$t(e)}function jM(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===dM?YS:t||ZS:t}function UM(e){return{marktype:e.type,name:e.name||void 0,role:e.role||jM(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function qM(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function WM(e,t){const n=Vr(e.type);n||re("Unrecognized transform type: "+$t(e.type));const i=SC(n.type.toLowerCase(),null,GM(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function GM(e,t,n){const i={},r=e.params.length;for(let o=0;oZM(e,t,n)))):ZM(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!PC(r)?r.map((t=>VM(e,t,n))):VM(e,r,n):void(e.required&&re("Missing required "+$t(t.type)+" parameter: "+$t(e.name)))}function VM(e,t,n){const i=e.type;if(PC(t))return QM(i)?re("Expression references can not be signals."):KM(i)?n.fieldRef(t):eO(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||KM(i);return r&&XM(t)?n.exprRef(t.expr,t.as):r&&YM(t)?MC(t.field,t.as):QM(i)?yD(t,n):JM(i)?FC(n.getData(t).values):KM(i)?MC(t):eO(i)?n.compareRef(t):t}}function ZM(e,t,n){const i=e.params.length;let r;for(let n=0;ne&&e.expr,YM=e=>e&&e.field,JM=e=>"data"===e,QM=e=>"expr"===e,KM=e=>"field"===e,eO=e=>"compare"===e;function tO(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:FC(t.getData(e.data).output)}function nO(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function iO(e){return yt(e)?e:null}function rO(e,t,n){const i=zC(n.op,n.field);let r;if(t.ops){for(let e=0,n=t.as.length;enull==e?"null":e)).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function sO(e,t){const n=jM(e),i=e.type===dM,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,u,c,f,d,h=e.layout||n===YS||n===XS;const p=n===ZS||h||r,m=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||re("Only group marks can be faceted."),null!=i.field?a=s=tO(i,n):(e.data?s=FC(n.getData(e.data).aggregate):(o=WM(nt({type:"aggregate",groupby:Ge(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=tO(i,n),a=s=FC(n.add(o))),r=n.keyRef(i.groupby,!0))):a=FC(n.add(KC(null,[{}]))),a||(a=tO(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(tF({key:m.key||(e.key?MC(e.key):void 0),pulse:m.pulse,clean:!i}));const g=FC(s);s=l=t.add(KC({pulse:g})),s=t.add(uF({markdef:UM(e),interactive:qM(e.interactive,t),clip:BM(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:FC(s)}));const y=FC(s);s=u=t.add(nF(xC(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=WM(e,t),i=n.metadata;(i.generates||i.changes)&&re("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=FC(s),t.add(s=n)})),e.sort&&(s=t.add(wF({sort:t.compareRef(e.sort),pulse:FC(s)})));const v=FC(s);(r||h)&&(h=t.add(_F({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:v})),f=FC(h));const b=t.add(QC({mark:y,pulse:f||v}));d=FC(b),i&&(p&&(a=t.operators,a.pop(),h&&a.pop()),t.pushState(v,f||d,g),r?function(e,t,n){const i=e.from.facet,r=i.name,o=tO(i,t);let a;i.name||re("Facet must have a name: "+$t(i)),i.data||re("Facet must reference a data set: "+$t(i)),i.field?a=t.add(pF({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(rF({key:t.keyRef(i.groupby),group:FC(t.proxy(n.parent)),pulse:o})):re("Facet must specify groupby or field: "+$t(i));const s=t.fork(),l=s.add(KC()),u=s.add(xF({pulse:FC(l)}));s.addData(r,new nO(s,l,l,u)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,m):p?function(e,t,n){const i=t.add(pF({pulse:n.pulse})),r=t.fork();r.add(xF()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,m):t.parse(e),t.popState(),p&&(h&&a.push(h),a.push(b))),o&&(d=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:PC(o)?n.signalRef(o.signal):o,method:PC(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(a.sort=n.compareRef({field:e.order})),r){const e=r.tolerance;a.boundTolerance=PC(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return FC(n.add(dF(a)))}(o,d,t));const x=t.add(vF({pulse:d})),w=t.add(xF({pulse:FC(x)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new nO(t,l,x,w)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&re("Marks only support modify triggers."),aO(e,t,c)})))}function lO(e,t,n){const i={enter:{},update:{}};return GS(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function uO(e,t,n){return t[e]?`scale("${t[e]}",datum)`:bM(e,n[0].encode)}nO.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],a=null,s=1;for(o&&"load"===o.type&&(o=t[1]),e.add(t[0]);se===qF||e===IF,mO=(e,t,n)=>PC(e)?_O(e.signal,t,n):e===jF||e===IF?t:n,gO=(e,t,n)=>PC(e)?xO(e.signal,t,n):pO(e)?t:n,yO=(e,t,n)=>PC(e)?wO(e.signal,t,n):pO(e)?n:t,vO=(e,t,n)=>PC(e)?kO(e.signal,t,n):e===IF?{value:t}:{value:n},bO=(e,t,n)=>PC(e)?EO(e.signal,t,n):e===UF?{value:t}:{value:n},xO=(e,t,n)=>AO(`${e} === '${IF}' || ${e} === '${qF}'`,t,n),wO=(e,t,n)=>AO(`${e} !== '${IF}' && ${e} !== '${qF}'`,t,n),_O=(e,t,n)=>DO(`${e} === '${jF}' || ${e} === '${IF}'`,t,n),kO=(e,t,n)=>DO(`${e} === '${IF}'`,t,n),EO=(e,t,n)=>DO(`${e} === '${UF}'`,t,n),AO=(e,t,n)=>(t=null!=t?qS(t):t,n=null!=n?qS(n):n,$O(t)&&$O(n)?{signal:`${e} ? (${t=t?t.signal||$t(t.value):null}) : (${n=n?n.signal||$t(n.value):null})`}:[nt({test:e},t)].concat(n||[])),$O=e=>null==e||1===Object.keys(e).length,DO=(e,t,n)=>({signal:`${e} ? (${CO(t)}) : (${CO(n)})`}),SO=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${jF}' ? (${CO(i)}) : `:"")+(null!=n?`${e} === '${qF}' ? (${CO(n)}) : `:"")+(null!=r?`${e} === '${UF}' ? (${CO(r)}) : `:"")+(null!=t?`${e} === '${IF}' ? (${CO(t)}) : `:"")+"(null)"}),CO=e=>PC(e)?e.signal:null==e?null:$t(e),FO=(e,t)=>0===t?0:PC(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},MO=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function OO(e,t,n,i){let r;if(t&&at(t,e))return t[e];if(at(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[tM][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[eM][r]}return null}function NO(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function zO(e,t){return{scale:e.scale,range:t}}function TO(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function RO(e,t){const n=function(e,t){var n,i,r,o=t.config,a=o.style,s=o.axis,l="band"===t.scaleType(e.scale)&&o.axisBand,u=e.orient;if(PC(u)){const e=NO([o.axisX,o.axisY]),t=NO([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(r of(n={},e))n[r]=gO(u,OO(r,o.axisX,s,a),OO(r,o.axisY,s,a));for(r of(i={},t))i[r]=SO(u.signal,OO(r,o.axisTop,s,a),OO(r,o.axisBottom,s,a),OO(r,o.axisLeft,s,a),OO(r,o.axisRight,s,a))}else n=u===IF||u===qF?o.axisX:o.axisY,i=o["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?nt({},s,n,i,l):s}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,l=vM(e,n),u=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},we(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},f=FC(t.add(KC({},[c]))),d=FC(t.add(JC({scale:t.scaleRef(e.scale),extra:t.property(u.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(function(e,t,n,i,r){const o=vM(e,t),a=e.orient,s=e.gridScale,l=mO(a,1,-1),u=function(e,t){if(1===t);else if(we(e)){let n=e=nt({},e);for(;null!=n.mult;){if(!we(n.mult))return n.mult=PC(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=nt({},n.mult)}n.mult=t}else e=PC(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:cM},update:d={opacity:fM},exit:f={opacity:cM}};GS(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:e.scale,field:KF,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=gO(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:l,offset:u}:{value:0,offset:u},y=s?{scale:s,range:1,mult:l,offset:u}:nt(m,{mult:l,offset:u});return c.x=d.x=gO(a,p,g),c.y=d.y=yO(a,p,g),c.x2=d.x2=yO(a,y),c.y2=d.y2=gO(a,y),f.x=gO(a,p),f.y=yO(a,p),kM({type:pM,role:KS,key:KF,from:i,encode:h},n)}(e,n,i.grid,d,u)),c.ticks&&(p=l("tickSize"),h.push(function(e,t,n,i,r,o){const a=vM(e,t),s=e.orient,l=mO(s,-1,1);let u,c,f;const d={enter:u={opacity:cM},update:f={opacity:fM},exit:c={opacity:cM}};GS(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=qS(r);h.mult=l;const p={scale:e.scale,field:KF,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=gO(s,cM,p),f.y2=u.y2=gO(s,h),c.x=gO(s,p),f.x=u.x=yO(s,cM,p),f.x2=u.x2=yO(s,h),c.y=yO(s,p),kM({type:pM,role:tC,key:KF,from:i,encode:d},n)}(e,n,i.ticks,d,p,u))),c.labels&&(p=c.ticks?p:0,h.push(function(e,t,n,i,r,o){const a=vM(e,t),s=e.orient,l=e.scale,u=mO(s,-1,1),c=IC(a("labelFlush")),f=IC(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=qS(r);g.mult=u,g.offset=qS(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:KF,band:.5,offset:_M(o.offset,a("labelOffset"))},v=gO(s,m?TO(l,c,'"left"','"right"','"center"'):{value:"center"},bO(s,"left","right")),b=gO(s,vO(s,"bottom","top"),m?TO(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=TO(l,c,`-(${f})`,f,0);m=m&&f;const w={opacity:cM,x:gO(s,y,g),y:yO(s,y,g)},_={enter:w,update:p={opacity:fM,text:{field:XF},x:w.x,y:w.y,align:v,baseline:b},exit:{opacity:cM,x:w.x,y:w.y}};GS(_,{dx:!d&&m?gO(s,x):null,dy:!h&&m?yO(s,x):null}),GS(_,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:h});const k=a("labelBound");let E=a("labelOverlap");return E=E||k?{separation:a("labelSeparation"),method:E,order:"datum.index",bound:k?{scale:l,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=MO(p.align,v)),p.baseline!==b&&(p.baseline=MO(p.baseline,b)),kM({type:gM,role:eC,style:eM,key:KF,from:i,encode:_,overlap:E},n)}(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=vM(e,t),o=e.orient;let a,s;const l={enter:a={opacity:cM},update:s={opacity:fM},exit:{opacity:cM}};GS(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=zO(e,0),c=zO(e,1);return a.x=s.x=gO(o,u,cM),a.x2=s.x2=gO(o,c),a.y=s.y=yO(o,u,cM),a.y2=s.y2=yO(o,c),kM({type:pM,role:QS,from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(function(e,t,n,i){const r=vM(e,t),o=e.orient,a=mO(o,-1,1);let s,l;const u={enter:s={opacity:cM,anchor:qS(r("titleAnchor",null)),align:{signal:wM}},update:l=nt({},s,{opacity:fM,text:qS(e.title)}),exit:{opacity:cM}},c={signal:`lerp(range("${e.scale}"), ${xM(0,1,.5)})`};return l.x=gO(o,c),l.y=yO(o,c),s.angle=gO(o,cM,FO(a,90)),s.baseline=gO(o,vO(o,qF,IF),{value:qF}),l.angle=s.angle,l.baseline=s.baseline,GS(u,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const r=(e,t)=>null!=e?(n.update[t]=MO(qS(e),n.update[t]),!1):!VS(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?qS(a):gO(t,qS(a),qS(o))}(r,o,u,n),u.update.align=MO(u.update.align,s.align),u.update.angle=MO(u.update.angle,s.angle),u.update.baseline=MO(u.update.baseline,s.baseline),kM({type:gM,role:nC,style:tM,from:i,encode:u},n)}(e,n,i.title,f)),sO(yM({role:JS,from:f,encode:HS(PO(l,e),r,uM),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function PO(e,t){const n={enter:{},update:{}};return GS(n,{orient:e("orient"),offset:e("offset")||0,position:BC(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function LO(e,t,n){const i=Ge(e.signals),r=Ge(e.scales);return n||i.forEach((e=>$C(e,t))),Ge(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=BF(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=BF(n[e],e,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";pu(n)||re("Unrecognized scale type: "+$t(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),Ge(e.data).forEach((e=>function(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(WM(e,t))})),e.on&&e.on.forEach((n=>{aO(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,u=null,c=!1,f=!1;for(e.values?PC(e.values)||LC(e.format)?(i.push(hO(t,e)),i.push(u=dO())):i.push(u=dO({$ingest:e.values,$format:e.format})):e.url?LC(e.url)||LC(e.format)?(i.push(hO(t,e)),i.push(u=dO())):i.push(u=dO({$request:e.url,$format:e.format})):e.source&&(u=r=Ge(e.source).map((e=>FC(t.getData(e).output))),i.push(null)),o=0,a=n.length;o$F(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?re("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=yD(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>function(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||re("Signal update missing events specification."),yt(o)&&(o=TS(o,t.isSubscope()?TC:RC)),o=Ge(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[ZC(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&re("Signal encode and update are mutually exclusive."),a="encode(item(),"+$t(i)+")"),r.update=yt(a)?yD(a,t):null!=a.expr?yD(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:VC,$params:{$value:t.signalRef(a.signal)}}:re("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(nt(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):UC(e,t)}}(e,t),r))))}(e,t,n.id)))}(e,t))),Ge(e.axes).forEach((e=>RO(e,t))),Ge(e.marks).forEach((e=>sO(e,t))),Ge(e.legends).forEach((e=>function(e,t){const n=t.config.legend,i=e.encode||{},r=vM(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,u={};let c,f,d,h=0;lM.forEach((t=>e[t]?(u[t]=e[t],h=h||e[t]):0)),h||re("Missing valid scale for legend.");const p=function(e,t){let n=e.type||rM;return e.type||1!==function(e){return lM.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=gu(t)?oM:vu(t)?aM:rM),n!==oM?n:vu(t)?aM:oM}(e,t.scaleType(h)),m={title:null!=e.title,scales:u,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=FC(t.add(KC(null,[m]))),y=FC(t.add(sF(f={type:p,scale:t.scaleRef(h),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return p===oM?(d=[EM(e,h,n,i.gradient),SM(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${IC(r.gradientLength())})/100))`)):p===aM?d=[AM(e,h,n,i.gradient,y),SM(e,n,i.labels,y)]:(c=function(e,t){const n=vM(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[CM(e,n,i,y,IC(c.columns))],f.size=function(e,t,n){const i=IC(uO("size",e,n)),r=IC(uO("strokeWidth",e,n)),o=IC(function(e,t,n){return bM("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i.fontSize}(0,t,n)}(n[1].encode,t,eM));return yD(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,d[0].marks)),d=[yM({role:oC,from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(e,t,n,i){const r=vM(e,t),o={enter:{opacity:cM},update:{opacity:fM,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:cM}};return GS(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:RM},angle:{signal:PM},align:{signal:TM},baseline:{signal:LM},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),kM({type:gM,role:uC,style:tM,from:i,encode:o},n)}(e,n,i.title,g)),sO(yM({role:iC,from:g,encode:HS(lO(r,e,n),o,uM),marks:d,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:l}),t)}(e,t))),e.title&&function(e,t){const n=vM(e=yt(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,l=[],u=FC(t.add(KC(null,[{}])));l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return GS(o,{text:e.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kM({type:gM,role:fC,style:nM,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||nt({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return GS(o,{text:e.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kM({type:gM,role:dC,style:iM,from:i,encode:o},n)}(e,n,i.subtitle,u)),sO(yM({role:cC,from:u,encode:fO(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}(e.title,t),t.parseLambdas(),t}const BO=e=>HS({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function IO(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function jO(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function UO(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function qO(e){return(xe(e)?WO:GO)(e)}function WO(e){const t=e.length;let n="[";for(let i=0;i0?",":"")+(we(t)?t.signal||qO(t):$t(t))}return n+"]"}function GO(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+$t(t)+":"+(we(n)?n.signal||qO(n):$t(n));return i+"}"}function HO(e,t,n){return we(e)||re("Input Vega specification must be an object."),t=ke(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:r},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:r,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),t,e.config),function(e,t){const n=t.config,i=FC(t.root=t.add(CC())),r=function(e,t){const n=n=>BC(e[n],t[n]),i=[IO("background",n("background")),IO("autosize",BS(n("autosize"))),IO("padding",US(n("padding"))),IO("width",n("width")||0),IO("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return Ge(e.signals).forEach((e=>{at(r,e.name)?e=nt(r[e.name],e):i.push(e),o[e.name]=e})),Ge(t.signals).forEach((e=>{at(o,e.name)||at(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>$C(e,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const o=t.add(KC()),a=t.add(nF(xC(BO(e.encode),dM,XS,e.style,t,{pulse:FC(o)}))),s=t.add(_F({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:FC(a)}));t.operators.pop(),t.pushState(FC(a),FC(s),null),LO(e,t,r),t.operators.push(s);let l=t.add(QC({mark:i,pulse:FC(s)}));return l=t.add(vF({pulse:FC(l)})),l=t.add(xF({pulse:FC(l)})),t.addData("root",new nO(t,o,o,l)),t}(e,new jO(t,n)).toRuntime()}jO.prototype=UO.prototype={parse(e){return LO(e,this)},fork(){return new UO(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){const t=e instanceof DC?FC(e):e;return this.add(gF({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(FC(this.add(xF({pulse:e})))),this._parent.push(t),this._lookup.push(n?FC(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return $e(this._parent)},encode(){return $e(this._encode)},lookup(){return $e(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(yt(e))return MC(e,t);e.signal||re("Unsupported field reference: "+$t(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=FC(this.add(oF(e)))}return i},compareRef(e){let t=!1;const n=e=>PC(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=Ge(e.field).map(n),r=Ge(e.order).map(n);return t?FC(this.add(eF({fields:i,orders:r}))):NC(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=Ge(e).map((e=>PC(e)?(n=!0,FC(i[e.signal])):e)),n?FC(this.add(aF({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=zC(e.op,e.field),n=e.order||"ascending";return n.signal?FC(this.add(eF({fields:t,orders:this.signalRef(n.signal)}))):NC(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return at(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&re("Duplicate signal name: "+$t(e));const n=t instanceof DC?t:this.add(CC(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||re("Unrecognized signal name: "+$t(e)),this.signals[e]},signalRef(e){return this.signals[e]?FC(this.signals[e]):(at(this.lambdas,e)||(this.lambdas[e]=this.add(CC(null))),FC(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;te*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},YO={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const JO=Array.prototype.slice,QO=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,JO.call(t,1))};var KO={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,i,r,o,a)=>new Date(e,t||0,null!=n?n:1,i||0,r||0,o||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return QO("join",arguments)},indexof:function(){return QO("indexOf",arguments)},lastindexof:function(){return QO("lastIndexOf",arguments)},slice:function(){return QO("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return QO("substring",arguments,String)},split:function(){return QO("split",arguments,String)},replace:function(){return QO("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const eN=["view","item","group","xy","x","y"],tN=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&tN.add(setImmediate);const nN={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:ZO[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!tN.has(i[r]))return i[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),"if"===i?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||KO[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>XO[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>YO[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const i=e(n.key);return e.memberDepth-=1,tN.has(e(n.value))?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):t[i]=e(n.value),t}),{})};function iN(e,t,n,i,r,o){const a=e=>nN[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=o,eN.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var rN={operator(e,t){const n=t.ast,i=e.functions;return e=>iN(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>iN(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>iN(n,i,void 0,void 0,e)},handler(e,t){const n=t.ast,i=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return iN(n,i,e,r,t)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in i)s=iN(i[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,i,o),l}}};function oN(e){return!!e.or}function aN(e){return!!e.and}function sN(e){return!!e.not}function lN(e,t){if(sN(e))lN(e.not,t);else if(aN(e))for(const n of e.and)lN(n,t);else if(oN(e))for(const n of e.or)lN(n,t);else t(e)}function uN(e,t){return sN(e)?{not:uN(e.not,t)}:aN(e)?{and:e.and.map((e=>uN(e,t)))}:oN(e)?{or:e.or.map((e=>uN(e,t)))}:t(e)}const cN=structuredClone;function fN(e){throw new Error(e)}function dN(e,t){const n={};for(const i of t)at(e,i)&&(n[i]=e[i]);return n}function hN(e,t){const n={...e};for(const e of t)delete n[e];return n}function pN(e){if(mt(e))return e;const t=yt(e)?e:KN(e);if(t.length<250)return t;let n=0;for(let e=0;e0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of i)t.add(e)}return t}function $N(e,t){return void 0===e||void 0===t||EN(AN(e),AN(t))}function DN(e){return 0===SN(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>KN(e))).join(",")})`};const SN=Object.keys,CN=Object.values,FN=Object.entries;function MN(e){return!0===e||!1===e}function ON(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function NN(e,t){return sN(e)?`!(${NN(e.not,t)})`:aN(e)?`(${e.and.map((e=>NN(e,t))).join(") && (")})`:oN(e)?`(${e.or.map((e=>NN(e,t))).join(") || (")})`:t(e)}function zN(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&zN(e[n],t)&&delete e[n],DN(e)}function TN(e){return e.charAt(0).toUpperCase()+e.substr(1)}function RN(e,t="datum"){const n=oe(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map($t).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function PN(e,t="datum"){return`${t}[${$t(oe(e).join("."))}]`}function LN(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function BN(e){return`${oe(e).map(LN).join("\\.")}`}function IN(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function jN(e){return`${oe(e).join(".")}`}function UN(e){return e?oe(e).length:0}function qN(...e){for(const t of e)if(void 0!==t)return t}let WN=42;function GN(e){const t=++WN;return e?String(e)+t:t}function HN(){WN=42}function VN(e){return ZN(e)?e:`__${e}`}function ZN(e){return e.startsWith("__")}function XN(e){if(void 0!==e)return(e%360+360)%360}function YN(e){return!!mt(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const JN=Object.getPrototypeOf(structuredClone({}));function QN(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!QN(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!QN(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==JN.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==JN.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!QN(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function KN(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;ihR(e[t])?ON(`_${t}_${FN(e[t])}`):ON(`_${t}_${e[t]}`))).join("")}function cR(e){return!0===e||dR(e)&&!e.binned}function fR(e){return"binned"===e||dR(e)&&!0===e.binned}function dR(e){return we(e)}function hR(e){return e?.param}function pR(e){switch(e){case ez:case tz:case wz:case yz:case vz:case bz:case $z:case kz:case Ez:case Az:case xz:return 6;case Dz:return 4;default:return 10}}function mR(e){return!!e?.expr}function gR(e){const t=SN(e||{}),n={};for(const i of t)n[i]=$R(e[i]);return n}function yR(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:u,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=e,g={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},y={...l?{subtitleColor:l}:{},...u?{subtitleFont:u}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:dN(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function vR(e){return yt(e)||xe(e)&&yt(e[0])}function bR(e){return!!e?.signal}function xR(e){return!!e.step}function wR(e){return!xe(e)&&"field"in e&&"data"in e}const _R=SN({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),kR={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},ER=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function AR(e){const t=xe(e.condition)?e.condition.map(DR):DR(e.condition);return{...$R(e),condition:t}}function $R(e){if(mR(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function DR(e){if(mR(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function SR(e){if(mR(e)){const{expr:t,...n}=e;return{signal:t,...n}}return bR(e)?e:void 0!==e?{value:e}:void 0}function CR(e){return bR(e)?e.signal:$t(e)}function FR(e){return bR(e)?e.signal:$t(e.value)}function MR(e){return bR(e)?e.signal:null==e?null:$t(e)}function OR(e,t,n){for(const i of n){const n=TR(i,t.markDef,t.config);void 0!==n&&(e[i]=SR(n))}return e}function NR(e){return[].concat(e.type,e.style??[])}function zR(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?TR(e,t,n,i):void 0}function TR(e,t,n,{vgChannel:i}={}){return qN(i?RR(e,t,n.style):void 0,RR(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function RR(e,t,n){return PR(e,NR(t),n)}function PR(e,t,n){let i;t=Ge(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function LR(e,t){return Ge(e).reduce(((e,n)=>(e.field.push(nI(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function BR(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(QN(t,e))return;n.push(e)})),n}function IR(e,t){return QN(e,t)||!t?e:e?[...Ge(e),...Ge(t)].join(", "):t}function jR(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((vR(n)||bR(n))&&(vR(i)||bR(i)))return{explicit:e.explicit,value:IR(n,i)};if(vR(n)||bR(n))return{explicit:e.explicit,value:n};if(vR(i)||bR(i))return{explicit:e.explicit,value:i};if(!(vR(n)||bR(n)||vR(i)||bR(i)))return{explicit:e.explicit,value:BR(n,i)};throw new Error("It should never reach here")}function UR(e){return`Invalid specification ${KN(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const qR='Autosize "fit" only works for single views and layered views.';function WR(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function GR(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function HR(e){return e?`Dropping "fit-${e}" because spec has discrete ${lT(e)}.`:'Dropping "fit" because spec has discrete size.'}function VR(e){return`Unknown field for ${e}. Cannot calculate view size.`}function ZR(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function XR(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function YR(e){return`Selection not supported for ${e} yet.`}function JR(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function QR(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function KR(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function eP(e){return`${e}Offset dropped because ${e} is continuous`}function tP(e){return`There is no ${e} encoding. Replacing ${e}Offset encoding as ${e}.`}function nP(e){return`Invalid field type "${e}".`}function iP(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function rP(e,t){return`Dropping ${KN(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function oP(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function aP(e){return`${e} encoding has no scale, so specified scale is ignored.`}function sP(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function lP(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function uP(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function cP(e){return`Using unaggregated domain with raw field has no effect (${KN(e)}).`}function fP(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function dP(e){return`Unaggregated domain is currently unsupported for log scale (${KN(e)}).`}function hP(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function pP(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const mP="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function gP(e,t){return`Invalid ${e}: ${KN(t)}.`}function yP(e){return`1D error band does not support ${e}.`}function vP(e){return`Channel ${e} is required for "binned" bin.`}const bP=be(ge);let xP=bP;function wP(...e){xP.warn(...e)}function _P(e){if(e&&we(e))for(const t of FP)if(t in e)return!0;return!1}new WeakMap;const kP=["january","february","march","april","may","june","july","august","september","october","november","december"],EP=kP.map((e=>e.substr(0,3))),AP=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],$P=AP.map((e=>e.substr(0,3)));function DP(e,t){const n=[];if(t&&void 0!==e.day&&SN(e).length>1&&(wP(function(e){return`Dropping day from datetime ${KN(e)} as day cannot be combined with other units.`}(e)),delete(e=cN(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(YN(e)&&(e=+e),mt(e))return e-1;{const t=e.toLowerCase(),n=kP.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=EP.indexOf(i);if(-1!==r)return r;throw new Error(gP("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(YN(e)&&(e=+e),mt(e))return e>4&&wP(gP("quarter",e)),e-1;throw new Error(gP("quarter",e))}(e.quarter):e.quarter;n.push(mt(i)?3*i:`${i}*3`)}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(YN(e)&&(e=+e),mt(e))return e%7;{const t=e.toLowerCase(),n=AP.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=$P.indexOf(i);if(-1!==r)return r;throw new Error(gP("day",e))}}(e.day):e.day;n.push(mt(i)?i+1:`${i}+1`)}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function SP(e){const t=DP(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const CP={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},FP=SN(CP);function MP(e){return we(e)?e.binned:OP(e)}function OP(e){return e&&e.startsWith("binned")}function NP(e){return e.startsWith("utc")}const zP={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function TP(e){return FP.filter((t=>PP(e,t)))}function RP(e){const t=TP(e);return t[t.length-1]}function PP(e,t){const n=e.indexOf(t);return!(n<0||n>0&&"seconds"===t&&"i"===e.charAt(n-1)||e.length>n+3&&"day"===t&&"o"===e.charAt(n+3)||n>0&&"year"===t&&"f"===e.charAt(n-1))}function LP(e){if(e)return`timeUnitSpecifier(${KN(TP(e))}, ${KN(zP)})`}function BP(e){if(!e)return;let t;return yt(e)?t=OP(e)?{unit:e.substring(6),binned:!0}:{unit:e}:we(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),NP(t.unit)&&(t.utc=!0,t.unit=function(e){return e.substring(3)}(t.unit)),t}function IP(e,t=(e=>e)){const n=BP(e),i=RP(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=UP(i,n.step);return`${t(SP({...e,[o]:+e[o]+r}))} - ${t(SP(e))}`}}const jP={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function UP(e,t=1){if(function(e){return!!jP[e]}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function qP(e){return!!e?.field&&void 0!==e.equal}function WP(e){return!!e?.field&&void 0!==e.lt}function GP(e){return!!e?.field&&void 0!==e.lte}function HP(e){return!!e?.field&&void 0!==e.gt}function VP(e){return!!e?.field&&void 0!==e.gte}function ZP(e){if(e?.field){if(xe(e.range)&&2===e.range.length)return!0;if(bR(e.range))return!0}return!1}function XP(e){return!!e?.field&&(xe(e.oneOf)||xe(e.in))}function YP(e){return XP(e)||qP(e)||ZP(e)||WP(e)||HP(e)||GP(e)||VP(e)}function JP(e,t){return bI(e,{timeUnit:t,wrapTime:!0})}function QP(e,t=!0){const{field:n}=e,i=BP(e.timeUnit),{unit:r,binned:o}=i||{},a=nI(e,{expr:"datum"}),s=r?`time(${o?a:function(e,t,{end:n}={end:!1}){const i=RN(t),r=NP(e)?"utc":"";let o;const a={};for(const t of FP)PP(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=DP(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}(r,n)})`:a;if(qP(e))return`${s}===${JP(e.equal,r)}`;if(WP(e))return`${s}<${JP(e.lt,r)}`;if(HP(e))return`${s}>${JP(e.gt,r)}`;if(GP(e))return`${s}<=${JP(e.lte,r)}`;if(VP(e))return`${s}>=${JP(e.gte,r)}`;if(XP(e))return`indexof([${function(e,t){return e.map((e=>JP(e,t)))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return KP(s,e.valid);if(ZP(e)){const{range:n}=e,i=bR(n)?{signal:`${n.signal}[0]`}:n[0],o=bR(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+JP(i,r)+", "+JP(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${JP(i,r)}`),null!==o&&a.push(`${s} <= ${JP(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${KN(e)}`)}function KP(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function eL(e){return YP(e)&&e.timeUnit?{...e,timeUnit:BP(e.timeUnit)}:e}const tL={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function nL(e){return"ordinal"===e||"nominal"===e}const iL=tL.quantitative,rL=tL.ordinal,oL=tL.temporal,aL=tL.nominal,sL=tL.geojson;SN(tL);const lL={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},uL={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function cL(e,t){const n=uL[e],i=uL[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}SN(uL);const fL={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function dL(e){return fL[e]}const hL=new Set(["linear","log","pow","sqrt","symlog"]),pL=new Set([...hL,"time","utc"]);function mL(e){return hL.has(e)}const gL=new Set(["quantile","quantize","threshold"]),yL=new Set([...pL,...gL,"sequential","identity"]),vL=new Set(["ordinal","bin-ordinal","point","band"]);function bL(e){return vL.has(e)}function xL(e){return yL.has(e)}function wL(e){return pL.has(e)}function _L(e){return gL.has(e)}function kL(e){return e?.param}new Set(["time","utc"]);const EL={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:AL,domain:$L,range:DL,rangeMax:SL,rangeMin:CL,scheme:FL,...ML}=(SN(EL),EL),OL=SN(ML);function NL(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return wL(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return wL(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return wL(e);case"nice":return wL(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return xL(e)&&!gN(["log","time","utc","threshold","quantile"],e)}}function zL(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return qz(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const TL={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},RL=TL.arc,PL=TL.area,LL=TL.bar,BL=TL.image,IL=TL.line,jL=TL.point,UL=TL.rect,qL=TL.rule,WL=TL.text,GL=TL.tick,HL=TL.trail,VL=TL.circle,ZL=TL.square,XL=TL.geoshape;function YL(e){return["line","area","trail"].includes(e)}function JL(e){return["rect","bar","image","arc"].includes(e)}const QL=new Set(SN(TL));function KL(e){return e.type}const eB=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],tB=SN({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),nB=SN({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function iB(e){return e&&null!=e.band}const rB={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]};function oB(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=cB(e);return UB(n)&&!aR(n.aggregate)&&r&&wL(r.get("type"))?function({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(YL(n.type))return i;return null===zR("invalid",n,r)?[aB(e,t),i]:i}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function aB(e,t){return{test:sB(e,!0),..."y"===oT(t)?{field:{group:"height"}}:{value:0}}}function sB(e,t=!0){return KP(yt(e)?e:nI(e,{expr:"datum"}),!t)}function lB(e,t,n,i){const r={};if(t&&(r.scale=t),WB(e)){const{datum:t}=e;_P(t)?r.signal=SP(t):bR(t)?r.signal=t.signal:mR(t)?r.signal=t.expr:r.value=t}else r.field=nI(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function uB({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,bandPosition:o=.5}){const a=!bR(o)&&0ON(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+SN(n).map((e=>ON(`_${e}_${n[e]}`))).join("")}(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?jN(n):t.expr?PN(n,t.expr)+o:BN(n)+o}function iI(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return UB(e)&&!!e.bin;case"temporal":return!1}throw new Error(nP(e.type))}const rI=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(iR(t))return`${r} for argmax(${t.argmax})`;if(nR(t))return`${r} for argmin(${t.argmin})`;const o=i&&!MP(i)?BP(i):void 0,a=t||o?.unit||o?.maxbins&&"timeunit"||cR(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(cR(i))return`${n} (binned)`;if(r&&!MP(r)){const e=BP(r)?.unit;if(e)return`${n} (${TP(e).join("-")})`}else if(o)return iR(o)?`${n} for max ${o.argmax}`:nR(o)?`${n} for min ${o.argmin}`:`${TN(o)} of ${n}`;return n}(e,t)}};let oI=rI;function aI(e){oI=e}function sI(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=lI(e)?.title;if(!UB(e))return r??e.title;const o=e,a=i?uI(o,t):void 0;return n?qN(r,o.title,a):r??o.title??a}function lI(e){return QB(e)&&e.axis?e.axis:KB(e)&&e.legend?e.legend:MB(e)&&e.header?e.header:void 0}function uI(e,t){return oI(e,t)}function cI(e){if(eI(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=lI(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function fI(e){return UB(e)?e:IB(e)?e.condition:void 0}function dI(e){return ZB(e)?e:jB(e)?e.condition:void 0}function hI(e,t,n,i={}){return yt(e)||mt(e)||dt(e)?(wP(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${KN(n)}}.`}(t,yt(e)?"string":mt(e)?"number":"boolean",e)),{value:e}):ZB(e)?pI(e,t,n,i):jB(e)?{...e,condition:pI(e.condition,t,n,i)}:e}function pI(e,t,n,i){if(eI(e)){const{format:r,formatType:o,...a}=e;if(dB(o)&&!n.customFormatTypes)return wP(KR(t)),pI(a,t,n,i)}else{const r=QB(e)?"axis":KB(e)?"legend":MB(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(dB(a)&&!n.customFormatTypes)return wP(KR(t)),pI({...e,[r]:s},t,n,i)}}return UB(e)?mI(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=mt(n)?"quantitative":yt(n)?"nominal":_P(n)?"temporal":void 0,{...e,type:t}}(e)}function mI(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||rR(i)||iR(i)||nR(i)||(wP(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=BP(r)),a&&(s.field=`${a}`),cR(o)&&(s.bin=gI(o,t)),fR(o)&&!MT(t)&&wP(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),XB(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case iL:return"quantitative";case"t":case oL:return"temporal";case"o":case rL:return"ordinal";case"n":case aL:return"nominal";case sL:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&aR(i)&&(wP(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!rT(t)){const e=function(e,t){switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(zB(e)&&xe(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!iR(n)&&!nR(n))return"quantitative";if(JB(e)&&e.scale?.type)switch(uL[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(XB(s)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case ez:case tz:case nz:return iI(e)?yI:{compatible:!1,warning:sP(t)};case iz:case rz:case sz:case lz:case yz:case vz:case bz:case Sz:case Fz:case Mz:case Oz:case Nz:case zz:case _z:case fz:case uz:case Tz:return yI;case pz:case gz:case hz:case mz:return n!==iL?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:yI;case kz:case Ez:case Az:case $z:case wz:case dz:case cz:case oz:case az:return"nominal"!==n||e.sort?yI:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case xz:case Dz:return iI(e)||function(e){return JB(e)&&_L(e.scale?.type)}(e)?yI:{compatible:!1,warning:lP(t)};case Cz:return"nominal"!==e.type||"sort"in e?yI:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,t)||{};!1===e&&wP(n)}if(zB(s)&&yt(s.sort)){const{sort:e}=s;if($B(e))return{...s,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&$B(t))return{...s,sort:{encoding:t,order:"descending"}}}if(MB(s)){const{header:e}=s;if(e){const{orient:t,...n}=e;if(t)return{...s,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return s}function gI(e,t){return dt(e)?{maxbins:pR(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:pR(t)}}const yI={compatible:!0};function vI(e){const{formatType:t}=cI(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||UB(e)&&!!e.timeUnit)}(e)}function bI(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const o=t&&BP(t)?.unit;let a,s=o||"temporal"===n;return mR(e)?a=e.expr:bR(e)?a=e.signal:_P(e)?(s=!0,a=SP(e)):(yt(e)||mt(e))&&s&&(a=`datetime(${KN(e)})`,function(e){return!!CP[e]}(o)&&(mt(e)&&e<1e4||yt(e)&&isNaN(Date.parse(e)))&&(a=SP({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:KN(e)}function xI(e,t){const{type:n}=e;return t.map((t=>{const i=bI(t,{timeUnit:UB(e)&&!MP(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function wI(e,t){return cR(e.bin)?XT(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const _I={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function kI(e){return e?.condition}const EI=["domain","grid","labels","ticks","title"],AI={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},$I={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},DI={...$I,style:1,labelExpr:1,encoding:1};function SI(e){return!!DI[e]}SN(DI);const CI=SN({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function FI(e){return"mark"in e}class MI{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!FI(e)&&function(e){return KL(e)?e.type:e}(e.mark)===this.name}}function OI(e,t){const n=e&&e[t];return!!n&&(xe(n)?yN(n,(e=>!!e.field)):UB(n)||IB(n))}function NI(e,t){const n=e&&e[t];return!!n&&(xe(n)?yN(n,(e=>!!e.field)):UB(n)||WB(n)||jB(n))}function zI(e,t){if(MT(t)){const n=e[t];if((UB(n)||WB(n))&&(nL(n.type)||UB(n)&&n.timeUnit))return NI(e,cT(t))}return!1}function TI(e){return yN(Vz,(t=>{if(OI(e,t)){const n=e[t];if(xe(n))return yN(n,(e=>!!e.aggregate));{const e=fI(n);return e&&!!e.aggregate}}return!1}))}function RI(e,t){const n=[],i=[],r=[],o=[],a={};return BI(e,((s,l)=>{if(UB(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=lI(s),p=e?.title;let m=nI(s,{forAs:!0});const g={...p?[]:{title:sI(s,t,{allowDisabling:!0})},...h,field:m};if(c){let e;if(iR(c)?(e="argmax",m=nI({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):nR(c)?(e="argmin",m=nI({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};u&&(t.field=u),o.push(t)}}else if(n.push(m),XB(s)&&cR(f)){if(i.push({bin:f,field:u,as:m}),n.push(nI(s,{binSuffix:"end"})),wI(s,l)&&n.push(nI(s,{binSuffix:"range"})),MT(l)){const e={field:`${m}_end`};a[`${l}2`]=e}g.bin="binned",rT(l)||(g.type=iL)}else if(d&&!MP(d)){r.push({timeUnit:d,field:u,as:m});const e=XB(s)&&s.type!==oL&&"time";e&&(l===Sz||l===Oz?g.formatType=e:function(e){return!!DT[e]}(l)?g.legend={formatType:e,...g.legend}:MT(l)&&(g.axis={formatType:e,...g.axis}))}a[l]=g}else n.push(u),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function PI(e,t,n){const i=function(e,t){return function(e){switch(e){case yz:case vz:case bz:case Tz:case Fz:case Mz:case Oz:case Nz:case Cz:case kz:case Ez:case Az:case $z:case nz:case ez:case tz:return YT;case iz:case rz:case sz:case lz:case hz:case pz:return QT;case oz:case az:case mz:case gz:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case wz:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Dz:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case xz:return{point:"always",geoshape:"always"};case Sz:return{text:"always"};case _z:return{point:"always",square:"always",text:"always"};case zz:return{image:"always"};case fz:case uz:return{text:"always",arc:"always"};case dz:case cz:return{arc:"always"}}}(e)[t]}(t,n);if(!i)return!1;if("binned"===i){const n=e[t===oz?iz:rz];return!!(UB(n)&&UB(e[t])&&fR(n.bin))}return!0}function LI(e,t){const n={};for(const i of SN(e)){const r=hI(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function BI(e,t,n){if(e)for(const i of SN(e)){const r=e[i];if(xe(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function II(e,t){return SN(t).reduce(((n,i)=>{switch(i){case iz:case rz:case Nz:case Tz:case zz:case oz:case az:case sz:case lz:case fz:case dz:case uz:case cz:case hz:case pz:case mz:case gz:case Sz:case xz:case _z:case Oz:return n;case Cz:if("line"===e||"trail"===e)return n;case Fz:case Mz:{const e=t[i];if(xe(e)||UB(e))for(const t of Ge(e))t.aggregate||n.push(nI(t,{}));return n}case wz:if("trail"===e)return n;case yz:case vz:case bz:case kz:case Ez:case Az:case Dz:case $z:{const e=fI(t[i]);return e&&!e.aggregate&&n.push(nI(e,{})),n}}}),[])}function jI(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${UI(t)}`:"";return{field:e+t.field,type:t.type,title:bR(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),o=function(e){const t=[];for(const n of SN(e))if(OI(e,n)){const i=Ge(e[n]);for(const e of i)UB(e)?t.push(e):IB(e)&&t.push(e.condition)}return t}(n).map(tI);return{tooltip:[...r,...wN(o,pN)]}}function UI(e){const{title:t,field:n}=e;return qN(t,n)}function qI(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=UI(n);return WI(e,s,r,{mark:l,encoding:{[t]:{field:`${u}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...yt(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function WI(e,t,n,i){const{clip:r,color:o,opacity:a}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...a?{opacity:a}:{},...KL(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...dt(e[t])?{}:e[t]}}]:[]}function GI(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:HI(o,n),continuousAxisChannelDef2:HI(a,n),continuousAxisChannelDefError:HI(s,n),continuousAxisChannelDefError2:HI(l,n),continuousAxis:r}}function HI(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&wP(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function VI(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(KL(n)&&n.orient)return n.orient;if(GB(r)){if(GB(o)){const e=UB(r)&&r.aggregate,n=UB(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return vI(o)&&!vI(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(GB(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const ZI="boxplot",XI=new MI(ZI,JI);function YI(e){return mt(e)?"tukey":e}function JI(e,{config:t}){e={...e,encoding:LI(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=KL(n)?n:{type:n};r&&wP(YR("boxplot"));const l=s.extent??t.boxplot.extent,u=zR("size",s,t),c=s.invalid,f=YI(l),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:_}=function(e,t,n){const i=VI(e,ZI),{continuousAxisChannelDef:r,continuousAxis:o}=GI(e,i,ZI),a=r.field,s=YI(t),l=[...QI(a),{op:"median",field:a,as:`mid_box_${a}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+a}],u="min-max"===s||"tukey"===s?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:`iqr_${a}`},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:`upper_whisker_${a}`},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:`lower_whisker_${a}`}],{[o]:c,...f}=e.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:h}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(xe(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return xe(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(f),{bins:p,timeUnits:m,aggregate:g,groupby:y,encoding:v}=RI(h,n),b="vertical"===i?"horizontal":"vertical",x=i;return{bins:p,timeUnits:m,transform:[...p,...m,{aggregate:[...g,...l],groupby:y},...u],groupby:y,aggregate:g,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:d}}(e,l,t),{color:k,size:E,...A}=b,$=e=>qI(s,g,m,e,t.boxplot),D=$(A),S=$(b),C=$({...A,...E?{size:E}:{}}),F=jI([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],m,b),M={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O="min-max"===f?F:jI([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,b),N=[...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:O}),...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:O}),...D({partName:"ticks",mark:M,positionPrefix:"lower_whisker",extraEncoding:O}),...D({partName:"ticks",mark:M,positionPrefix:"upper_whisker",extraEncoding:O})],z=[..."tukey"!==f?N:[],...S({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:w,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:F}),...C({partName:"median",mark:{type:"tick",invalid:c,...we(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...u?{size:u}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:F})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(p),layer:z};const T=`datum["lower_box_${m.field}"]`,R=`datum["upper_box_${m.field}"]`,P=`(${R} - ${T})`,L=`${T} - ${l} * ${P}`,B=`${R} + ${l} * ${P}`,I=`datum["${m.field}"]`,j={joinaggregate:QI(m.field),groupby:y},U={transform:[{filter:`(${L} <= ${I}) && (${I} <= ${B})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${m.field}`},{op:"max",field:m.field,as:`upper_whisker_${m.field}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${m.field}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${m.field}`},...v],groupby:y}],layer:N},{tooltip:q,...W}=A,{scale:G,axis:H}=m,V=UI(m),Z=hN(H,["title"]),X=WI(s,"outliers",t.boxplot,{transform:[{filter:`(${I} < ${L}) || (${I} > ${B})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...void 0!==V?{title:V}:{},...void 0!==G?{scale:G}:{},...DN(Z)?{}:{axis:Z}},...W,...k?{color:k}:{},..._?{tooltip:_}:{}}})[0];let Y;const J=[...d,...h,j];return X?Y={transform:J,layer:[X,U]}:(Y=U,Y.transform.unshift(...J)),{...a,layer:[Y,{transform:p,layer:z}]}}function QI(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const KI="errorbar",ej=new MI(KI,tj);function tj(e,{config:t}){e={...e,encoding:LI(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=nj(e,KI,t);delete o.size;const c=qI(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function nj(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=KL(i)?i:{type:i};o&&wP(YR(t));const{orient:u,inputType:c}=function(e,t){const{encoding:n}=e;if(function(e){return(ZB(e.x)||ZB(e.y))&&!ZB(e.x2)&&!ZB(e.y2)&&!ZB(e.xError)&&!ZB(e.xError2)&&!ZB(e.yError)&&!ZB(e.yError2)}(n))return{orient:VI(e,t),inputType:"raw"};const i=function(e){return ZB(e.x2)||ZB(e.y2)}(n),r=function(e){return ZB(e.xError)||ZB(e.xError2)||ZB(e.yError)||ZB(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(ZB(e)&&ZB(i))throw new Error(`${t} cannot have both x2 and y2`);if(ZB(e)){if(GB(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(ZB(i)){if(GB(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(ZB(i)&&!ZB(e))throw new Error(`${t} cannot have xError2 without xError`);if(ZB(s)&&!ZB(r))throw new Error(`${t} cannot have yError2 without yError`);if(ZB(e)&&ZB(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(ZB(e)){if(GB(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(ZB(r)){if(GB(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=GI(e,u,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],u=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&wP(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:TN(t)},{fieldPrefix:"upper_",titlePrefix:ij(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:ij(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{op:t,field:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:sI({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:sI({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:sI({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&wP(function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],u=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:IN(IN(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:w,["x"===m?"xError":"yError"]:_,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:A,timeUnits:$,aggregate:D,groupby:S,encoding:C}=RI(E,n),F=[...D,...g],M="raw"!==c?[]:S,O=jI(v,f,C,b);return{transform:[...s.transform??[],...A,...$,...0===F.length?[]:[{aggregate:F,groupby:M}],...y],groupby:M,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:C,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function ij(e,t,n){return`${TN(e)} ${n} ${t}`}const rj="errorband",oj=new MI(rj,aj);function aj(e,{config:t}){e={...e,encoding:LI(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=nj(e,rj,t),u=a,c=qI(u,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):u.interpolate?wP(yP("interpolate")):u.tension&&wP(yP("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:l})]}}const sj={};function lj(e,t,n){const i=new MI(e,t);sj[e]={normalizer:i,parts:n}}lj(ZI,JI,["box","median","outliers","rule","ticks"]),lj(KI,tj,["ticks","rule"]),lj(rj,aj,["band","borders"]);const uj=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],cj={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},fj={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},dj=SN(cj),hj=SN(fj),pj=SN({header:1,headerRow:1,headerColumn:1,headerFacet:1}),mj=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],gj={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},yj=(SN(gj),"_vgsid_"),vj={point:{on:"click",fields:[yj],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function bj(e){return"legend"===e||!!e?.legend}function xj(e){return bj(e)&&we(e)}function wj(e){return!!e?.select}function _j(e){const t=[];for(const n of e||[]){if(wj(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function kj(e){return"concat"in e}function Ej(e){return"vconcat"in e}function Aj(e){return"hconcat"in e}function $j({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function Dj(e){return we(e)&&void 0!==e.step}function Sj(e){return e.view||e.width||e.height}const Cj=SN({align:1,bounds:1,center:1,columns:1,spacing:1});function Fj(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function Mj(e,t){const n=Oj(e,t);return Dj(n)?n.step:Nj}function Oj(e,t){return qN(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Nj=20,zj={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Nj},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:{binSpacing:1,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},circle:{},geoshape:{},image:{},line:{},point:{},rect:{binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:vj,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Tj=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Rj={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Pj={blue:Tj[0],orange:Tj[1],red:Tj[2],teal:Tj[3],green:Tj[4],yellow:Tj[5],purple:Tj[6],pink:Tj[7],brown:Tj[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Lj(e){const t=SN(e||{}),n={};for(const i of t){const t=e[i];n[i]=kI(t)?AR(t):$R(t)}return n}const Bj=[...nB,...CI,...pj,"background","padding","legend","lineBreak","scale","style","title","view"];function Ij(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=ke({},cN(zj),n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:we(e)?{...Pj,...e}:Pj}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:we(e)?{...Rj,...e}:Rj}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},o||{});r&&Ee(a,"selection",r,!0);const s=hN(a,Bj);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=$R(a[e]));for(const e of nB)a[e]&&(s[e]=gR(a[e]));for(const e of CI)a[e]&&(s[e]=Lj(a[e]));for(const e of pj)a[e]&&(s[e]=gR(a[e]));return a.legend&&(s.legend=gR(a.legend)),a.scale&&(s.scale=gR(a.scale)),a.style&&(s.style=function(e){const t=SN(e),n={};for(const i of t)n[i]=Lj(e[i]);return n}(a.style)),a.title&&(s.title=gR(a.title)),a.view&&(s.view=gR(a.view)),s}const jj=new Set(["view",...QL]),Uj=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],qj={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]};function Wj(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};DN(r)||(e.style[n??t]=r),i||delete e[t]}function Gj(e){return"layer"in e}class Hj{map(e,t){return OB(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):Aj(e)?this.mapHConcat(e,t):Ej(e)?this.mapVConcat(e,t):kj(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Gj(e))return this.mapLayer(e,t);if(FI(e))return this.mapUnit(e,t);throw new Error(UR(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const Vj={zero:1,center:1,normalize:1},Zj=new Set([RL,LL,PL,qL,jL,VL,ZL,IL,WL,GL]),Xj=new Set([LL,PL,RL]);function Yj(e){return UB(e)&&"quantitative"===qB(e)&&!e.bin}function Jj(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t,a=e[t],s=e[r];if(UB(a)&&UB(s))if(Yj(a)&&Yj(s)){if(a.stack)return t;if(s.stack)return r;const e=UB(a)&&!!a.aggregate;if(e!==(UB(s)&&!!s.aggregate))return e?t:r;if(o&&["bar","area"].includes(i)){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(Yj(a))return t;if(Yj(s))return r}else{if(Yj(a))return t;if(Yj(s))return r}}function Qj(e,t){const n=KL(e)?e:{type:e},i=n.type;if(!Zj.has(i))return null;const r=Jj(t,"x",n)||Jj(t,"theta",n);if(!r)return null;const o=t[r],a=UB(o)?nI(o,{}):void 0,s=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),l=[],u=new Set;if(t[s]){const e=t[s],n=UB(e)?nI(e,{}):void 0;n&&n!==a&&(l.push(s),u.add(n));const i="x"===s?"xOffset":"yOffset",r=t[i],o=UB(r)?nI(r,{}):void 0;o&&o!==a&&(l.push(i),u.add(o))}const c=ST.reduce(((e,n)=>{if("tooltip"!==n&&OI(t,n)){const i=t[n];for(const t of Ge(i)){const i=fI(t);if(i.aggregate)continue;const r=nI(i,{});r&&u.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let f;return void 0!==o.stack?f=dt(o.stack)?o.stack?"zero":null:o.stack:Xj.has(i)&&(f="zero"),f&&f in Vj?TI(t)&&0===c.length?null:o?.scale?.type&&o?.scale?.type!==lL.LINEAR?(o?.stack&&wP(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type)),null):ZB(t[sT(r)])?(void 0!==o.stack&&wP(`Cannot stack "${d=r}" if there is already "${d}2".`),null):(UB(o)&&o.aggregate&&!sR.has(o.aggregate)&&wP(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:r,impute:null!==o.impute&&YL(i),stackBy:c,offset:f}):null;var d}function Kj(e,t,n){const i=gR(e),r=zR("orient",i,n);if(i.orient=function(e,t,n){switch(e){case jL:case VL:case ZL:case WL:case UL:case BL:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case LL:if(UB(i)&&(fR(i.bin)||UB(r)&&r.aggregate&&!i.aggregate))return"vertical";if(UB(r)&&(fR(r.bin)||UB(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(UB(i)&&i.type===iL&&!cR(i.bin)||VB(i))&&UB(r)&&fR(r.bin)?"horizontal":"vertical";if(!a)return(UB(r)&&r.type===iL&&!cR(r.bin)||VB(r))&&UB(i)&&fR(i.bin)?"vertical":"horizontal"}case qL:if(o&&(!UB(i)||!fR(i.bin))&&a&&(!UB(r)||!fR(r.bin)))return;case PL:if(a)return UB(r)&&fR(r.bin)?"horizontal":"vertical";if(o)return UB(i)&&fR(i.bin)?"vertical":"horizontal";if(e===qL){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case IL:case GL:{const t=HB(i),o=HB(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=XB(i)&&i.type===oL,t=XB(r)&&r.type===oL;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&wP(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=zR("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:rB[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}return void 0===zR("opacity",i,n)&&(i.opacity=function(e,t){if(gN([jL,GL,VL,ZL],e)&&!TI(t))return.7}(i.type,t)),void 0===zR("cursor",i,n)&&(i.cursor=function(e,t,n){return t.href||e.href||zR("href",e,n)?"pointer":e.cursor}(i,t,n)),i}function eU(e){const{point:t,line:n,...i}=e;return SN(i).length>1?i:i.type}function tU(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:hN(e[t],["point","line"])});return e}function nU(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?we(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?we(t.point)?t.point:{}:void 0}function iU(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class rU{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(FI(e)){const{mark:n,encoding:i}=e,r=KL(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!nU(r,t[r.type],i);case"area":return!!nU(r,t[r.type],i)||!!iU(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...u}=e,c=LI(l,i),f=KL(a)?a:{type:a},d=nU(f,i[f.type],c),h="area"===f.type&&iU(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:eU({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:hN(c,["shape"])}],m=Qj(Kj(f,c,i),c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=hN(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...dN(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...dN(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:tU(i)})}}function oU(e,t){return t?FB(e)?fU(e,t):lU(e,t):e}function aU(e,t){return t?fU(e,t):e}function sU(e,t,n){const i=t[e];return function(e){return e&&!yt(e)&&"repeat"in e}(i)?i.repeat in n?{...t,[e]:n[i.repeat]}:void wP(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function lU(e,t){if(void 0!==(e=sU("field",e,t))){if(null===e)return null;if(zB(e)&&SB(e.sort)){const n=sU("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function uU(e,t){if(UB(e))return lU(e,t);{const n=sU("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function cU(e,t){if(!ZB(e)){if(jB(e)){const n=uU(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=uU(e,t);if(n)return n;if(BB(e))return{condition:e.condition}}}function fU(e,t){const n={};for(const i in e)if(at(e,i)){const r=e[i];if(xe(r))n[i]=r.map((e=>cU(e,t))).filter((e=>e));else{const e=cU(r,t);void 0!==e&&(n[i]=e)}}return n}class dU{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(FI(e)){const{encoding:t,mark:n}=e;if("line"===n||KL(n)&&"line"===n.type)for(const e of iT){const n=t[oT(e)];if(t[e]&&(UB(n)&&!fR(n.bin)||WB(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return wP((o=!!i.x2,a=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&a?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:we(r)?{...r,type:"rule"}:"rule"},t)}}function hU({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...SN(e),...SN(t)]);for(const o of r){const r=t[o],a=e[o];if(ZB(r)){const e={...a,...r};i[o]=e}else jB(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||YB(a)||bR(a)||ZB(a)||xe(a))&&(i[o]=a)}}else i=t;return!i||DN(i)?void 0:i}function pU(e){const{parentProjection:t,projection:n}=e;return t&&n&&wP(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${KN(t)} is overridden by a child projection ${KN(n)}.`}({parentProjection:t,projection:n})),n??t}function mU(e){return"filter"in e}function gU(e){return void 0!==e?.stop}function yU(e){return"lookup"in e}function vU(e){return"pivot"in e}function bU(e){return"density"in e}function xU(e){return"quantile"in e}function wU(e){return"regression"in e}function _U(e){return"loess"in e}function kU(e){return"sample"in e}function EU(e){return"window"in e}function AU(e){return"joinaggregate"in e}function $U(e){return"flatten"in e}function DU(e){return"calculate"in e}function SU(e){return"bin"in e}function CU(e){return"impute"in e}function FU(e){return"timeUnit"in e}function MU(e){return"aggregate"in e}function OU(e){return"stack"in e}function NU(e){return"fold"in e}function zU(e){return"extent"in e&&!("density"in e)}function TU(e,t){const{transform:n,...i}=e;if(n){const e=n.map((e=>{if(mU(e))return{filter:LU(e,t)};if(SU(e)&&dR(e.bin))return{...e,bin:PU(e.bin)};if(yU(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}));return{...i,transform:e}}return e}function RU(e,t){const n=cN(e);if(UB(n)&&dR(n.bin)&&(n.bin=PU(n.bin)),JB(n)&&n.scale?.domain?.selection){const{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(BB(n))if(xe(n.condition))n.condition=n.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:LU(e,t)}}));else{const{selection:e,param:i,test:r,...o}=RU(n.condition,t);n.condition=i?n.condition:{...o,test:LU(n.condition,t)}}return n}function PU(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function LU(e,t){const n=e=>uN(e,(e=>{var n;const i={param:e,empty:t.emptySelections[e]??!0};return(n=t.selectionPredicates)[e]??(n[e]=[]),t.selectionPredicates[e].push(i),i}));return e.selection?n(e.selection):uN(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class BU extends Hj{map(e,t){const n=t.selections??[];if(e.params&&!FI(e)){const t=[];for(const i of e.params)wj(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){const n=t.selections;if(!n||!n.length)return e;const i=(t.path??[]).concat(e.name),r=[];for(const t of n)if(t.views&&t.views.length)for(const n of t.views)(yt(n)&&(n===e.name||i.includes(n))||xe(n)&&n.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(t);else r.push(t);return r.length&&(e.params=r),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=BU.prototype[e];BU.prototype[e]=function(e,n){return t.call(this,e,IU(e,n))}}function IU(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function jU(e,t){void 0===t&&(t=Ij(e.config));const n=function(e,t={}){const n={config:t};return WU.map(UU.map(qU.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=FI(e)||Gj(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(wP(WR("width")),i=void 0),"container"==r&&(wP(WR("height")),r=void 0));const s={type:"pad",...a,...n?GU(n.autosize):{},...GU(e.autosize)};if("fit"!==s.type||o||(wP(qR),s.type="pad"),"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&wP(GR("width")),"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&wP(GR("height")),!QN(s,{type:"pad"}))return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const UU=new class extends Hj{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[XI,ej,oj,new rU,new dU]}map(e,t){if(FI(e)){const n=OI(e.encoding,ez),i=OI(e.encoding,tz),r=OI(e.encoding,nz);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=aU(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!xe(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:l={},repeaterPrefix:u=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+u}child__layer_${ON(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...o}=e;!xe(n)&&e.columns&&(e=hN(e,["columns"]),wP(JR("repeat")));const a=[],{repeater:s={},repeaterPrefix:l=""}=t,u=!xe(n)&&n.row||[s?s.row:null],c=!xe(n)&&n.column||[s?s.column:null],f=xe(n)&&n||[s?s.repeat:null];for(const e of f)for(const r of u)for(const o of c){const u={repeat:e,row:r,column:o,layer:s.layer},c=(i.name?`${i.name}_`:"")+l+"child__"+(xe(n)?`${ON(e)}`:(n.row?`row_${ON(r)}`:"")+(n.column?`column_${ON(o)}`:"")),f=this.map(i,{...t,repeater:u,repeaterPrefix:c});f.name=c,a.push(hN(f,["data"]))}const d=xe(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:d,concat:a}}mapFacet(e,t){const{facet:n}=e;return FB(n)&&e.columns&&(e=hN(e,["columns"]),wP(JR("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=pU({parentProjection:o,projection:i}),l=hU({parentEncoding:r,encoding:aU(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:u,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=aU(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...u?{height:u}:{},...c?{view:c}:{},...l?{projection:l}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&wP(`Facet encoding dropped as ${(o=[...n?[ez]:[],...i?[tz]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[ez,tz]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??(a[e]={}),a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:oU(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:hU({parentEncoding:t,encoding:r,layer:!0}),parentProjection:pU({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},qU=new class extends Hj{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=TU(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=TU(e,t)).encoding){const n={};for(const[i,r]of FN(e.encoding))n[i]=RU(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:FN(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const n of CN(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},WU=new BU;function GU(e){return yt(e)?{type:e}:e??{}}const HU=["background","padding"];function VU(e,t){const n={};for(const t of HU)e&&void 0!==e[t]&&(n[t]=$R(e[t]));return t&&(n.params=e.params),n}class ZU{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new ZU(cN(this.explicit),cN(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return qN(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of SN(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function XU(e){return{explicit:!0,value:e}}function YU(e){return{explicit:!1,value:e}}function JU(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:QU(t,n,i,r)}}function QU(e,t,n,i){return e.explicit&&t.explicit&&wP(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${KN(n)} and ${KN(i)}). Using ${KN(n)}.`}(n,i,e.value,t.value)),e}function KU(e,t,n,i,r=QU){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:QN(e.value,t.value)?e:r(e,t,n,i)}class eq extends ZU{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function tq(e){return"url"in e}function nq(e){return"values"in e}function iq(e){return"name"in e&&!tq(e)&&!nq(e)&&!rq(e)}function rq(e){return e&&(oq(e)||aq(e)||sq(e))}function oq(e){return"sequence"in e}function aq(e){return"sphere"in e}function sq(e){return"graticule"in e}var lq;function uq(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=BN(r.field),r}function cq(e,t=!0,n=le){if(xe(e)){const i=e.map((e=>cq(e,t,n)));return t?`[${i.join(", ")}]`:i}return _P(e)?n(t?SP(e):function(e){const t=DP(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(KN(e)):e}function fq(e,t){for(const n of CN(e.component.selection??{})){const i=n.name;let r=`${i}${MW}, ${"global"===n.resolve?"true":`{unit: ${TW(e)}}`}`;for(const i of zW)i.defined(n)&&(i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(r=i.modifyExpr(e,n,r)));t.push({name:i+OW,on:[{events:{signal:n.name+MW},update:`modify(${$t(n.name+FW)}, ${r})`}]})}return pq(t)}function dq(e,t){if(e.component.selection&&SN(e.component.selection).length){const n=$t(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:TS("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return pq(t)}function hq(e,t){for(const n of CN(e.component.selection??{}))for(const i of zW)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function pq(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(lq||(lq={}));class mq{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?wP("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class gq extends mq{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${GN()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function yq(e){return void 0!==e.as}function vq(e){return`${e}_end`}class bq extends mq{clone(){return new bq(null,cN(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n)=>{const{field:i,timeUnit:r}=n;if(r){let o;if(MP(r)){if(dV(t)){const{mark:e}=t;(JL(e)||n.bandPosition)&&(o={timeUnit:BP(r),field:i})}}else o={as:nI(n,{forAs:!0}),field:i,timeUnit:r};o&&(e[pN(o)]=o)}return e}),{});return DN(n)?null:new bq(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:BP(n)};return new bq(e,{[pN(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of FN(this.timeUnits)){const r=yq(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(CN(this.timeUnits).map((e=>yq(e)?e.as:vq(e.field))))}dependentFields(){return new Set(CN(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${pN(this.timeUnits)}`}assemble(){const e=[];for(const t of CN(this.timeUnits))if(yq(t)){const{field:n,as:i,timeUnit:r}=t,{unit:o,utc:a,...s}=BP(r);e.push({field:BN(n),type:"timeunit",...o?{units:TP(o)}:{},...a?{timezone:"utc"}:{},...s,as:[i,`${i}_end`]})}else if(t){const{field:n,timeUnit:i}=t,r=n.replaceAll("\\.","."),o=RP(i?.unit),{part:a,step:s}=UP(o,i.step);e.push({type:"formula",expr:`timeOffset('${a}', datum['${r}'], ${s})`,as:vq(r)})}return e}}const xq="_tuple_fields";class wq{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const _q={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new wq),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=ON(`${i}_${n}`);for(let e=1;s.has(r);e++)r=ON(`${i}_${n}_${e}`);return s.add(r),{[t]:r}},u=t.type,c=e.config.selection[u],f=void 0!==n.value?Ge(n.value):null;let{fields:d,encodings:h}=we(n.select)?n.select:{};if(!d&&!h&&f)for(const e of f)if(we(e))for(const t of SN(e))tT[t]?(h||(h=[])).push(t):"interval"===u?(wP('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(t);d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const t of h??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){wP(XR(t,n.aggregate));continue}if(!i){wP(ZR(t));continue}if(n.timeUnit&&!MP(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};a[pN(r)]=r}if(!o[i]){const a={field:i,channel:t,type:"interval"===u&&XT(t)&&xL(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:r.items.length};a.signals={...l(a,"data"),...l(a,"visual")},r.items.push(o[i]=a),r.hasField[i]=o[i],r.hasSelectionId=r.hasSelectionId||i===yj,Iz(t)?(a.geoChannel=t,a.channel=Bz(t),r.hasChannel[a.channel]=o[i]):r.hasChannel[t]=o[i]}}else wP(ZR(t))}for(const e of d??[]){if(r.hasField[e])continue;const t={type:"E",field:e,index:r.items.length};t.signals={...l(t,"data")},r.items.push(t),r.hasField[e]=t,r.hasSelectionId=r.hasSelectionId||e===yj}f&&(t.init=f.map((e=>r.items.map((t=>we(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),DN(a)||(r.timeUnit=new bq(null,a))},signals:(e,t,n)=>{const i=t.name+xq;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(uq)})}},kq=_q,Eq={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!XT(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&xL(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):wP("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter((e=>0===n.filter((t=>t.name===e.signals.data)).length));if(!e.parent||Dq(e)||0===i.length)return n;const r=n.filter((e=>e.name===t.name))[0];let o=r.update;if(o.indexOf(NW)>=0)r.update=`{${i.map((e=>`${$t(BN(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${$t(BN(e.field))}: ${e.signals.data}`;o.includes(t)||(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!Dq(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}},Aq=Eq;function $q(e,t){return`domain(${$t(e.scaleName(t))})`}function Dq(e){return e.parent&&mV(e.parent)&&(!e.parent.parent??Dq(e.parent.parent))}const Sq="_brush",Cq="_scale_trigger",Fq="geo_interval_init_tick",Mq="_init",Oq={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...we(n.select)?n.select:{}};e.fields=[yj],e.encodings||(e.encodings=n.value?SN(n.value):[pz,hz]),n.select={type:"interval",...e}}if(t.translate&&!Aq.defined(t)){const e=`!event.item || event.item.mark.name !== ${$t(t.name+Sq)}`;for(const n of t.events){if(!n.between){wP(`${n} is not an ordered event stream for interval selections.`);continue}const t=Ge((i=n.between[0]).filter??(i.filter=[]));t.indexOf(e)<0&&t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+MW,o=CN(t.project.hasChannel).filter((e=>e.channel===iz||e.channel===rz)),a=t.init?t.init[0]:null;if(n.push(...o.reduce(((n,i)=>n.concat(function(e,t,n,i){const r=!e.hasProjection,o=n.channel,a=n.signals.visual,s=$t(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===iz?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${c}, ${c}]`},{events:t,update:`[${a}[0], clamp(${c}, 0, ${u})]`}]),[]);if(r){const r=n.signals.data,u=Aq.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:cq(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+Cq},update:xL(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:cq(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===iz?0:1,n=t.name+Mq;return[{name:a,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:f}]}}(e,t,i,a&&a[i.index]))),[])),e.hasProjection){const s=$t(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:c}=t.project.hasChannel,f=u&&u.signals.visual,d=c&&c.signals.visual,h=u?a&&a[u.index]:`${l}[0]`,p=c?a&&a[c.index]:`${l}[1]`,m=t=>e.getSizeSignalRef(t).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;if(a&&(n.unshift({name:i+Mq,init:`[scale(${s}, [${u?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${u?h[1]:h}, ${c?p[1]:p}])]`}),!u||!c)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(intersect(${g}, {markname: ${$t(e.getName("marks"))}}, unit.mark), {unit: ${TW(e)}})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:Fq}]:[]],update:y}]})}{if(!Aq.defined(t)){const t=i+Cq,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=$t(e.scaleName(n)),a=xL(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${a}invert(${o}, ${r})[0] === ${a}${i}[0] && ${a}invert(${o}, ${r})[1] === ${a}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const s=o.map((e=>e.signals.data)),l=`unit: ${TW(e)}, fields: ${i+xq}, values`;return n.concat({name:r,...a?{init:`{${l}: ${cq(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(dV(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===Fq)).length||n.unshift({name:Fq,value:null,on:[{events:"timer{1}",update:`${Fq} === null ? {} : ${Fq}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=r?.signals.visual,s=o?.signals.visual,l=`data(${$t(t.name+FW)})`;if(Aq.defined(t)||!r&&!o)return n;const u={x:void 0!==r?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${s}[0]`}:{value:0},x2:void 0!==r?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of SN(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${TW(e)}`,...u[t]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=SN(h).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${s}[0] !== ${s}[1]`].filter((e=>e)).join(" && "),value:h[t]},{value:null}],e)),{});return[{name:`${i+Sq}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+Sq,type:"rect",clip:!0,encode:{enter:{...d?{cursor:{value:d}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}},Nq=Oq,zq={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+xq,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=CN(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Sq):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let u=`unit: ${TW(e)}, `;t.project.hasSelectionId?u+=`${yj}: ${a}[${$t(yj)}]`:u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${a}[${$t(e.vgField(t.channel,{}))}], ${a}[${$t(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${$t(t.field)}]`})).join(", ")}]`;const c=t.events;return n.concat([{name:i+MW,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}},Tq=zq;function Rq(e,t,n,i){const r=BB(t)&&t.condition,o=i(t);if(r){const t=Ge(r).map((t=>{const n=i(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:UW(e,{param:i,empty:r}),...n}}return{test:WW(e,t.test),...n}}));return{[n]:[...t,...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function Pq(e,t="text"){const n=e.encoding[t];return Rq(e,n,t,(t=>Lq(t,e.config)))}function Lq(e,t,n="datum"){if(e){if(YB(e))return SR(e.value);if(ZB(e)){const{format:i,formatType:r}=cI(e);return mB({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function Bq(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(xe(a))return{tooltip:jq({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return Rq(e,a,"tooltip",(e=>{const a=Lq(e,r,s);if(a)return a;if(null===e)return;let l=zR("tooltip",i,r);return!0===l&&(l={content:"encoding"}),yt(l)?{value:l}:we(l)?bR(l)?l:"encoding"===l.content?jq(n,o,r,t):{signal:s}:void 0}))}}function Iq(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o={},a=i?"datum.datum":"datum",s=[];function l(n,i){const l=oT(i),u=XB(n)?n:{...n,type:e[l].type},c=Ge(u.title||uI(u,r)).join(", ").replaceAll(/"/g,'\\"');let f;if(MT(i)){const t="x"===i?"x2":"y2",n=fI(e[t]);if(fR(u.bin)&&n){const e=nI(u,{expr:a}),i=nI(n,{expr:a}),{format:s,formatType:l}=cI(u);f=kB(e,i,s,l,r),o[t]=!0}}if((MT(i)||i===fz||i===uz)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=cI(u);f=mB({fieldOrDatumDef:u,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}f??(f=Lq(u,r,a).signal),s.push({channel:i,key:c,value:f})}BI(e,((e,t)=>{UB(e)?l(e,t):IB(e)&&l(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of s)o[e]||u[t]||(u[t]=n);return u}function jq(e,t,n,{reactiveGeom:i}={}){const r=Iq(e,t,n,{reactiveGeom:i}),o=FN(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function Uq(e){const{markDef:t,config:n}=e,i=zR("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...qq(e),...Wq(e)}}function qq(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=zR("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in kR?{}:{ariaRoleDescription:{value:t}}}function Wq(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return Rq(e,o,"description",(t=>Lq(t,e.config)));const a=zR("description",n,i);if(null!=a)return{description:SR(a)};if(!1===i.aria)return{};const s=Iq(t,r,i);return DN(s)?void 0:{description:{signal:FN(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function Gq(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;void 0===s&&(l??(l=zR(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==l&&(s=SR(l)));const u=r[e];return Rq(t,u,a??e,(n=>cB({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function Hq(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??zR("filled",n,r),s=gN(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=zR(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=zR(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:SR(l)}:{},...u?{stroke:SR(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&wP(iP("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...Gq("color",e,{vgChannel:c,defaultValue:a?l:u}),...Gq("fill",e,{defaultValue:i.fill?l:void 0}),...Gq("stroke",e,{defaultValue:i.stroke?u:void 0})}}function Vq(e){const{encoding:t,mark:n}=e,i=t.order;return!YL(n)&&YB(i)?Rq(e,i,"zindex",(e=>SR(e.value))):{}}function Zq({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s)return{offsetType:"encoding",offset:cB({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:SR(a),bandPosition:r})};const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function Xq(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[sT(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=Zq({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=Yq({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&MT(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(ZB(n)&&r&&t===r.fieldChannel){if(UB(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return uB({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return lB(n,i,{suffix:"end"},{offset:o})}return oB(e)}({channel:e,channelDef:l,channel2Def:u,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function Yq({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=oT(n),l=aT(n),u=zR(n,o,a,{vgChannel:l});if(void 0!==u)return fB(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(gN([lL.LOG,lL.TIME,lL.UTC],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===s?{field:{group:"height"}}:{value:0};switch(s){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...e[lT(n)],mult:.5}}}}const Jq={left:"x",center:"xc",right:"x2"},Qq={top:"y",middle:"yc",bottom:"y2"};function Kq(e,t,n,i="middle"){if("radius"===e||"theta"===e)return aT(e);const r="x"===e?"align":"baseline",o=zR(r,t,n);let a;return bR(o)?(wP(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?Jq[a||("top"===i?"left":"center")]:Qq[a||i]}function eW(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?tW(e,t,{defaultPos:n,defaultPos2:i}):Xq(e,t,{defaultPos:n})}function tW(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=sT(e),s=lT(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=oT(n),u=lT(n),c=aT(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=Zq(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=lT(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:l,defaultRef:u}){return ZB(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?lB(t,o,{suffix:"start"},{offset:l}):oB({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});return void 0!==m?{[c]:m}:nW(n,o)||nW(n,{[n]:RR(n,o,s.style),[u]:RR(u,o,s.style)})||nW(n,s[r])||nW(n,s.mark)||{[c]:Yq({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...Xq(e,t,{defaultPos:n,vgChannel:l[s]?Kq(e,r,o):aT(e)}),...l}}function nW(e,t){const n=lT(e),i=aT(e);if(void 0!==t[i])return{[i]:fB(e,t[i])};if(void 0!==t[e])return{[i]:fB(e,t[e])};if(t[n]){const i=t[n];if(!iB(i))return{[n]:fB(e,i)};wP(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function iW(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=sT(t),s=lT(t),l=i[t],u=i[a],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,h=i[s]??i.size??zR("size",r,n,{vgChannel:s}),p=uT(t),m="bar"===o&&("x"===t?"vertical"===d:"horizontal"===d);return!UB(l)||!(cR(l.bin)||fR(l.bin)||l.timeUnit&&!u)||h&&!iB(h)||i[p]||bL(f)?(ZB(l)&&bL(f)||m)&&!u?function(e,t,n){const{markDef:i,encoding:r,config:o,stack:a}=n,s=i.orient,l=n.scaleName(t),u=n.getScaleComponent(t),c=lT(t),f=sT(t),d=uT(t),h=n.scaleName(d),p=n.getScaleComponent(cT(t)),m="horizontal"===s&&"y"===t||"vertical"===s&&"x"===t;let g;(r.size||i.size)&&(m?g=Gq("size",n,{vgChannel:c,defaultRef:SR(i.size)}):wP(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(i.type)));const y=!!g,v=RB({channel:t,fieldDef:e,markDef:i,config:o,scaleType:u?.get("type"),useVlSizeChannel:m});g=g||{[c]:rW(c,h||l,p||u,o,v,!!e,i.type)};const b=Kq(t,i,o,"band"===u?.get("type")&&iB(v)&&!y?"top":"middle"),x="xc"===b||"yc"===b,{offset:w,offsetType:_}=Zq({channel:t,markDef:i,encoding:r,model:n,bandPosition:x?.5:0}),k=oB({channel:t,channelDef:e,markDef:i,config:o,scaleName:l,scale:u,stack:a,offset:w,defaultRef:Yq({model:n,defaultPos:"mid",channel:t,scaleName:l,scale:u}),bandPosition:x?"encoding"===_?0:.5:bR(v)?{signal:`(1-${v})/2`}:iB(v)?(1-v.band)/2:0});if(c)return{[b]:k,...g};{const e=aT(f),t=g[c],n=w?{...t,offset:w}:t;return{[b]:k,[e]:xe(k)?[k[0],{...k[1],offset:n}]:{...k,offset:n}}}}(l,t,e):tW(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:o,encoding:a}=i,s=i.getScaleComponent(n),l=i.scaleName(n),u=s?s.get("type"):void 0,c=s.get("reverse"),f=RB({channel:n,fieldDef:e,markDef:o,config:r,scaleType:u}),d=i.component.axes[n]?.[0],h=d?.get("translate")??.5,p=MT(n)?zR("binSpacing",o,r)??0:0,m=sT(n),g=aT(n),y=aT(m),v=TR("minBandSize",o,r),{offset:b}=Zq({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),{offset:x}=Zq({channel:m,markDef:o,encoding:a,model:i,bandPosition:0}),w=function({scaleName:e,fieldDef:t}){const n=nI(t,{expr:"datum"});return`abs(scale("${e}", ${nI(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),_=oW(n,p,c,h,b,v,w),k=oW(m,p,c,h,x??b,v,w),E=bR(f)?{signal:`(1-${f.signal})/2`}:iB(f)?(1-f.band)/2:.5;if(cR(e.bin)||e.timeUnit)return{[y]:aW({fieldDef:e,scaleName:l,bandPosition:E,offset:k}),[g]:aW({fieldDef:e,scaleName:l,bandPosition:bR(E)?{signal:`1-${E.signal}`}:1-E,offset:_})};if(fR(e.bin)){const n=lB(e,l,{},{offset:k});if(UB(t))return{[y]:n,[g]:lB(t,l,{},{offset:_})};if(dR(e.bin)&&e.bin.step)return{[y]:n,[g]:{signal:`scale("${l}", ${nI(e,{expr:"datum"})} + ${e.bin.step})`,offset:_}}}wP(vP(m))}({fieldDef:l,fieldDef2:u,channel:t,model:e})}function rW(e,t,n,i,r,o,a){if(iB(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==r.band&&(e=`${r.band} * ${e}`);const n=TR("minBandSize",{type:a},i);return{signal:n?`max(${MR(n)}, ${e})`:e}}1!==r.band&&(wP(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(bR(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(xR(e)&&mt(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r}=i.scale,o=qN(t,"bar"===a?n:r);if(bR(o))return{signal:`(1 - (${o.signal})) * ${e}`};if(mt(o))return{signal:`${1-o} * ${e}`}}return{value:Mj(i.view,e)-2}}function oW(e,t,n,i,r,o,a){if(Pz(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(bR(n)||bR(r)||bR(i)||o){const e=MR(n),t=MR(r),u=MR(i),c=MR(o),f=o?`(${a} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${a})) : ${l})`:l;return{signal:(u?`${u} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-l:+r+l)}function aW({fieldDef:e,scaleName:t,bandPosition:n,offset:i}){return uB({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i})}const sW=new Set(["aria","width","height"]);function lW(e,t){const{fill:n,stroke:i}="include"===t.color?Hq(e):{};return{...cW(e.markDef,t),...uW(e,"fill",n),...uW(e,"stroke",i),...Gq("opacity",e),...Gq("fillOpacity",e),...Gq("strokeOpacity",e),...Gq("strokeWidth",e),...Gq("strokeDash",e),...Vq(e),...Bq(e),...Pq(e,"href"),...Uq(e)}}function uW(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===zR("invalid",o,i)&&n&&!YL(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&xL(r)&&(t[o]=!0)}return t}),{}),r=SN(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>sB(e,t))).join(` ${e} `)}}(e,{invalid:!0,channels:ZT});if(i)return{[t]:[{test:i,value:null},...Ge(n)]}}return n?{[t]:n}:{}}function cW(e,t){return _R.reduce(((n,i)=>(sW.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=SR(e[i])),n)),{})}function fW(e){const{config:t,markDef:n}=e;if(zR("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});o&&xL(r)&&(t[o]=!0)}return t}),{}),r=SN(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>sB(e,t))).join(` ${e} `)}}(e,{channels:FT});if(t)return{defined:{signal:t}}}return{}}function dW(e,t){if(void 0!==t)return{[e]:SR(t)}}const hW="voronoi",pW={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(hW)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(YL(o))return wP(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(hW),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Bq(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.indexOf(hW)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},mW=pW,gW={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!bj(e.bind),parse:(e,t,n)=>PW(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=mW.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=ON(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:cq(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${$t(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter((e=>e.name===i+MW))[0],a=i+xq,s=r.items.map((e=>ON(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},yW=gW,vW="_toggle",bW={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+vW,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+MW,i=t.name+vW;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${TW(e)}}, `)+`${i} ? ${n} : null`}},xW={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=yt(t.clear)?TS(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(yW.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===ON(`${t.name}_${e.field}`)));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));i(t,"[0, 0]"),-1===t&&i(n.findIndex((t=>t.name===e.signals.data)),"null")}else{let e=n.findIndex((e=>e.name===t.name+MW));i(e,"null"),bW.defined(t)&&(e=n.findIndex((e=>e.name===t.name+vW)),i(e,"false"))}return n}},wW={defined:e=>{const t="global"===e.resolve&&e.bind&&bj(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==yj;return t&&!n&&wP("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=cN(n);if(i.select=yt(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},PW(t,i),we(n.select)&&(n.select.on||n.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=Ge(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=xj(t.bind)?t.bind.legend:"click",o=yt(r)?TS(r,"view"):Ge(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=xj(t.bind)&&t.bind.legend,o=e=>t=>{const n=cN(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${ON(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+MW)),a=i+xq,s=r.items.filter((e=>e.hasLegend)).map((e=>ON(`${i}_${ON(e.field)}_legend`))),l=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const u=n.find((e=>e.name===i+vW)),c=xj(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}},_W="_translate_anchor",kW="_translate_delta",EW={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Aq.defined(t),o=i+_W,{x:a,y:s}=t.project.hasChannel;let l=TS(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+Sq,e)))),n.push({name:o,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?$q(e,iz):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?$q(e,rz):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+kW,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&AW(e,t,a,"width",n),void 0!==s&&AW(e,t,s,"height",n),n}};function AW(e,t,n,i,r){const o=t.name,a=o+_W,s=o+kW,l=n.channel,u=Aq.defined(t),c=r.filter((e=>e.name===n.signals[u?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${l}`,g=`${u&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${u?l===iz?p?"":"-":p?"-":"":""}${s}.${l} / ${u?`${f}`:`span(${m})`}${u?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:u?g:`clampRange(${g}, 0, ${f})`})}const $W="_zoom_anchor",DW="_zoom_delta",SW={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Aq.defined(t),o=i+DW,{x:a,y:s}=t.project.hasChannel,l=$t(e.scaleName(iz)),u=$t(e.scaleName(rz));let c=TS(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+Sq,e)))),n.push({name:i+$W,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&CW(e,t,a,"width",n),void 0!==s&&CW(e,t,s,"height",n),n}};function CW(e,t,n,i,r){const o=t.name,a=n.channel,s=Aq.defined(t),l=r.filter((e=>e.name===n.signals[s?"data":"visual"]))[0],u=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?$q(e,a):l.name,h=o+DW,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${$W}.${a}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;l.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${u})`})}const FW="_store",MW="_tuple",OW="_modify",NW="vlSelectionResolve",zW=[Tq,Nq,kq,bW,yW,Aq,wW,xW,EW,SW,mW];function TW(e,{escape:t}={escape:!0}){let n=t?$t(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!hV(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of Gz)e[t]&&(n+=` + '__facet_${t}_' + (facet[${$t(i.vgField(t))}])`)}return n}function RW(e){return CN(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function PW(e,t){!yt(t.select)&&t.select.on||delete e.events,!yt(t.select)&&t.select.clear||delete e.clear,!yt(t.select)&&t.select.toggle||delete e.toggle}function LW(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...LW(e.object)),t.push(...LW(e.property))),t)}function BW(e){return"MemberExpression"===e.object.type?BW(e.object):"datum"===e.object.name}function IW(e){const t=sA(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&BW(e)&&n.add(LW(e).slice(1).join("."))})),n}class jW extends mq{clone(){return new jW(null,this.model,cN(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=WW(this.model,this.filter,this),this._dependentFields=IW(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function UW(e,t,n,i="datum"){const r=yt(t)?t:t.param,o=ON(r),a=$t(o+FW);let s;try{s=e.getSelectionComponent(o,r)}catch(e){return`!!${o}`}if(s.project.timeUnit){const t=n??e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const l=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${$t(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function qW(e,t,n){const i=ON(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(e){return i}if(r||a){if(r&&!a){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(a=o.project.items[0].field,wP((e.length?"Multiple ":"No ")+`matching ${$t(r)} encoding found for selection ${$t(n.param)}. `+`Using "field": ${$t(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&wP(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${$t(a)}.`);return`${o.name}[${$t(BN(a))}]`}function WW(e,t,n){return NN(t,(t=>yt(t)?t:function(e){return e?.param}(t)?UW(e,t,n):QP(t)))}function GW(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function HW(e,t,n,i={header:!1}){const{disable:r,orient:o,scale:a,labelExpr:s,title:l,zindex:u,...c}=e.combine();if(!r){for(const e in c){const n=AI[e],i=c[e];if(n&&n!==t&&"both"!==n)delete c[e];else if(kI(i)){const{condition:t,...n}=i,r=Ge(t),o=_I[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((e=>{const{test:t,...n}=e;return{test:WW(null,t),...n}})),n];GW(c,i,t,a),delete c[e]}else if(null===o){const t={signal:r.map((e=>{const{test:t,...n}=e;return`${WW(null,t)} ? ${FR(n)} : `})).join("")+FR(n)};c[e]=t}}else if(bR(i)){const t=_I[e];if(t){const{vgProp:n,part:r}=t;GW(c,r,n,i),delete c[e]}}gN(["labelAlign","labelBaseline"],e)&&null===c[e]&&delete c[e]}if("grid"===t){if(!c.grid)return;if(c.encode){const{grid:e}=c.encode;c.encode={...e?{grid:e}:{}},DN(c.encode)&&delete c.encode}return{scale:a,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:qN(u,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==s){let e=s;c.encode?.labels?.update&&bR(c.encode.labels.update.text)&&(e=IN(s,"datum.label",c.encode.labels.update.text.signal)),GW(c,"labels","text",{signal:e})}if(null===c.labelAlign&&delete c.labelAlign,c.encode){for(const t of EI)e.hasAxisPart(t)||delete c.encode[t];DN(c.encode)&&delete c.encode}const t=function(e,t){if(e)return xe(e)&&!vR(e)?e.map((e=>uI(e,t))).join(", "):e}(l,n);return{scale:a,orient:o,grid:!1,...t?{title:t}:{},...c,...!1===n.aria?{aria:!1}:{},zindex:qN(u,0)}}}}function VW(e){const{axes:t}=e.component,n=[];for(const i of FT)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function ZW(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...SN(r),...SN(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${MR(r[t])} : ${MR(o[t])}`};return s}return t[e]}))])}function XW(e,t){const n=[{}];for(const i of e){let e=t[i]?.style;if(e){e=Ge(e);for(const i of e)n.push(t.style[i])}}return Object.assign.apply(null,n)}function YW(e,t,n,i={}){const r=PR(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const JW={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!bL(e)&&UB(t)&&!cR(t?.bin)&&!fR(t?.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||eG(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||KW(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&gN(["quantitative","temporal"],e))return!0}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!we(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy"}(t.type,n,UB(t)&&!!t.timeUnit,UB(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){if(!i&&!bL(t)&&"log"!==t){if(UB(e)){if(cR(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&gN(["month","hours","day","quarter"],BP(e.timeUnit)?.unit))return}return{signal:`ceil(${n.signal}/40)`}}}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(UB(t)){const{timeUnit:e}=t;if(e){const t=IP(e);if(t)return{signal:t}}}},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=tG(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return BR(r?[NB(r)]:[],UB(a)?[NB(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;return xe(n)?xI(t,n):bR(n)?n:void 0}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){return"rect"===e&&iI(t)?1:0}(n,t)};function QW(e){return`(((${e.signal} % 360) + 360) % 360)`}function KW(e,t,n,i){if(void 0!==e){if("x"===n){if(bR(e)){const n=QW(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${bR(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(JB(t)&&CB(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${QP({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new nG(e,{calculate:a,as:iG(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${pN(this.transform)}`}}function iG(e,t,n){return nI(e,{prefix:t,suffix:"sort_index",...n??{}})}function rG(e,t){return gN(["top","bottom"],t)?"column":gN(["left","right"],t)||"row"===e?"row":"column"}function oG(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return qN((t||{})[e],r[e],n.header[e])}function aG(e,t,n,i){const r={};for(const o of e){const e=oG(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const sG=["row","column"],lG=["header","footer"];function uG(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=aG(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=rG(t,s),u=XN(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...fG(u,l),...cG(l,u,o),...vG(i,r,t,dj,cj)}}}function cG(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=eG(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function fG(e,t){const n=KW(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function dG(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of lG)if(n[r])for(const o of n[r]){const a=mG(e,t,r,n,o);null!=a&&i.push(a)}return i}function hG(e,t){const{sort:n}=e;return SB(n)?{field:nI(n,{expr:"datum"}),order:n.order??"ascending"}:xe(n)?{field:iG(e,t,{expr:"datum"}),order:"ascending"}:{field:nI(e,{expr:"datum"}),order:n??"ascending"}}function pG(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=aG(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=mB({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=rG(t,s);return{text:{signal:l?IN(IN(l,"datum.label",u),"datum.value",nI(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...fG(o,c),...cG(c,o,a),...vG(n,e,t,hj,fj)}}function mG(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=aG(["labelOrient"],a.header,s,t);("row"===t&&!gN(["top","bottom"],e)||"column"===t&&!gN(["left","right"],e))&&(o=pG(a,t,s))}const l=hV(e)&&!FB(e.facet),u=r.axes,c=u?.length>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:hG(a,t)}:{},...c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:u}:{}}}}return null}const gG={column:{start:0,end:1},row:{start:1,end:0}};function yG(e,t){return gG[t][e]}function vG(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=oG(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function bG(e){return[...xG(e,"width"),...xG(e,"height"),...xG(e,"childWidth"),...xG(e,"childHeight")]}function xG(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(bL(i)&&xR(o)){const i=e.scaleName(n);return hV(e.parent)&&"independent"===e.parent.component.resolve.scale[n]?[wG(i,o)]:[wG(i,o),{name:r,update:_G(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${Fj(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function wG(e,t){const n=`${e}_step`;return bR(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function _G(e,t,n){const i=t.get("type"),r=t.get("padding"),o=qN(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${MR(a)}, ${MR(o)}) * ${e}_step`}function kG(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function EG(e,t){return SN(e).reduce(((n,i)=>{const r=e[i];return{...n,...Rq(t,r,i,(e=>SR(e.value)))}}),{})}function AG(e,t){if(hV(t))return"theta"===e?"independent":"shared";if(mV(t))return"shared";if(pV(t))return MT(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function $G(e,t){const n=e.scale[t],i=MT(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&wP(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const DG={...gj,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},SG=SN(DG);class CG extends ZU{}const FG={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:l,mark:u}=n,c=a.filled&&"trail"!==u;let f={...OR({},n,eB),...Hq(n,{filled:c})};const d=r.get("symbolOpacity")??l.legend.symbolOpacity,h=r.get("symbolFillColor")??l.legend.symbolFillColor,p=r.get("symbolStrokeColor")??l.legend.symbolStrokeColor,m=void 0===d?MG(s.opacity)??a.opacity:void 0;if(f.fill)if("fill"===i||c&&i===yz)delete f.fill;else if(f.fill.field)h?delete f.fill:(f.fill=SR(l.legend.symbolBaseFillColor??"black"),f.fillOpacity=SR(m??1));else if(xe(f.fill)){const e=OG(s.fill??s.color)??a.fill??(c&&a.color);e&&(f.fill=SR(e))}if(f.stroke)if("stroke"===i||!c&&i===yz)delete f.stroke;else if(f.stroke.field||p)delete f.stroke;else if(xe(f.stroke)){const e=qN(OG(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(f.stroke={value:e})}if(i!==kz){const e=UB(t)&&zG(0,r,t);e?f.opacity=[{test:e,...SR(m??1)},SR(l.legend.unselectedOpacity)]:m&&(f.opacity=SR(m))}return f={...f,...e},DN(f)?void 0:f},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const l=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?MG(a.opacity)||o.opacity:void 0;return l&&(s.opacity=SR(l)),s={...s,...e},DN(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=UB(t)?zG(0,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;dB(c)?f=yB({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:a}):void 0===u&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=yB({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&UB(t)&&void 0===t.timeUnit&&(f=yB({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return DN(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function MG(e){return NG(e,((e,t)=>Math.max(e,t.value)))}function OG(e){return NG(e,((e,t)=>qN(e,t.value)))}function NG(e,t){return function(e){const t=e?.condition;return!!t&&(xe(t)||YB(t))}(e)?Ge(e.condition).reduce(t,e.value):YB(e)?e.value:void 0}function zG(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=$t(n.field);return i.map((e=>`(!length(data(${$t(ON(e)+FW)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const TG={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return vB(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return bB(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:l}=e;if(wL(r))return"horizontal"===n?"top"===i||"bottom"===i?PG(t,"width",a,o):a:PG(t,"height",l,s)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(gN(["quantile","threshold","log","symlog"],e))return"greedy"}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=OG(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>sI(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(qz(n)&&wL(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;return xe(n)?xI(t,n):bR(n)?n:void 0}(t,e)};function RG({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}function PG(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function LG(e){const t=dV(e)?function(e){const{encoding:t}=e,n={};for(const i of[yz,...mj]){const r=dI(t[i]);r&&e.getScaleComponent(i)&&(i===xz&&UB(r)&&r.type===sL||(n[i]=IG(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){LG(i);for(const r of SN(i.component.legends))n.legend[r]=$G(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=jG(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of SN(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function BG(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function IG(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new CG({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){const i=e.fieldDef(t)?.field;for(const r of CN(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&wW.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const u=e.getScaleComponent(t).get("type"),c=dI(r[t]),f=UB(c)?BP(c.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",h=function(e){const{legend:t}=e;return qN(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(qz(e)){if(gN(["quarter","month","day"],t))return"symbol";if(wL(n))return"gradient"}return"symbol"}(e))}({legend:n,channel:t,timeUnit:f,scaleType:u}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:a,config:o,scaleType:u,orient:d,legendType:h,direction:RG({legend:n,legendType:h,orient:d,legendConfig:a})};for(const i of SG){if("gradient"===h&&i.startsWith("symbol")||"symbol"===h&&i.startsWith("gradient"))continue;const r=i in TG?TG[i](p):n[i];if(void 0!==r){const a=BG(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const m=n?.encoding??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:s,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=EG(m[t]??{},e),i=t in FG?FG[t](n,v):n;void 0===i||DN(i)||(y[t]={...g?.length&&UB(c)?{name:`${ON(c.field)}_legend_${t}`}:{},...g?.length?{interactive:!!g}:{},update:i})}return DN(y)||s.set("encode",y,!!n?.encoding),s}function jG(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of SG){const i=KU(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return i=e,"circle"===(o=t).value?o:i;case"title":return jR(e,t);case"type":return r=!0,YU("symbol")}var i,o;return QU(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&zN(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&zN(e.explicit,["encode","gradient"])),e}function UG(e){const t=e.component.legends,n={};for(const i of SN(t)){const r=KN(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r])jG(e,t[i])||n[r].push(t[i]);else n[r]=[t[i].clone()]}const i=CN(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(!n){if(!1===t.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of mj)o[t]&&delete e[t]}if(o.title||delete o.title,void 0!==i){let e=i;o.encode?.labels?.update&&bR(o.encode.labels.update.text)&&(e=IN(i,"datum.label",o.encode.labels.update.text.signal)),function(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update.text=i}(o,"labels",0,{signal:e})}return o}}(t,e.config))).filter((e=>void 0!==e));return i}function qG(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=bR(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return gN(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const WG=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class GG extends ZU{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function HG(e){e.component.projection=dV(e)?function(e){if(e.hasProjection){const t=gR(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[pz,hz],[gz,mz]])(dI(n[i[0]])||dI(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(xz)&&e.typedFieldDef(xz).type===sL&&t.push({signal:e.getName(`geojson_${t.length}`)}),0===t.length&&t.push(e.requestDataName(lq.Main)),t}(e):void 0,o=new GG(e.projectionName(!0),{...gR(e.config.projection)??{},...t??{}},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)HG(t);const n=vN(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=vN(WG,(n=>!at(e.explicit,n)&&!at(t.explicit,n)||!!(at(e.explicit,n)&&at(t.explicit,n)&&QN(e.get(n),t.get(n)))));if(QN(e.size,t.size)){if(n)return e;if(QN(e.explicit,{}))return t;if(QN(t.explicit,{}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0}));if(t&&n){const n=e.projectionName(!0),i=new GG(n,t.specifiedProjection,t.size,cN(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}}(e)}function VG(e,t,n,i){if(wI(t,n)){const r=dV(e)?e.axis(n)??e.legend(n)??{}:{},o=nI(t,{expr:"datum"}),a=nI(t,{expr:"datum",binSuffix:"end"});return{formulaAs:nI(t,{binSuffix:"range",forAs:!0}),formula:kB(o,a,r.format,r.formatType,i)}}return{}}function ZG(e,t){return`${uR(e)}_${t}`}function XG(e,t,n){const i=ZG(gI(n,void 0)??{},t);return e.getName(`${i}_bins`)}function YG(e,t,n){let i,r;i=function(e){return"as"in e}(e)?yt(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[nI(e,{forAs:!0}),nI(e,{binSuffix:"end",forAs:!0})];const o={...gI(t,void 0)},a=ZG(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(hR(o.extent)){const e=o.extent;r=qW(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class JG extends mq{clone(){return new JG(null,cN(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(XB(n)&&cR(n.bin)){const{key:r,binComponent:o}=YG(n,n.bin,t);e[r]={...o,...e[r],...VG(t,n,i,t.config)}}return e}),{});return DN(n)?null:new JG(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=YG(t,t.bin,n);return new JG(e,{[i]:r})}merge(e,t){for(const n of SN(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=wN([...this.bins[n].as,...e.bins[n].as],pN)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(CN(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(CN(this.bins).map((e=>e.field)))}hash(){return`Bin ${pN(this.bins)}`}assemble(){return CN(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:BN(e.field),as:n,signal:e.signal,...hR(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:BN(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:nI({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}class QG extends mq{clone(){return new QG(null,new Set(this.dimensions),cN(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??(i["*"]={}),i["*"].count=new Set([nI(e,{forAs:!0})]);else{if(nR(o)||iR(o)){const e=nR(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([nI({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([nI(e,{forAs:!0})]);XT(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([nI({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([nI({field:a,aggregate:"max"},{forAs:!0})]))}else!function(e,t,n,i){const r=dV(i)?i.encoding[sT(t)]:void 0;if(XB(n)&&dV(i)&&PB(n,r,i.markDef,i.config))e.add(nI(n,{})),e.add(nI(n,{suffix:"end"})),n.bin&&wI(n,t)&&e.add(nI(n,{binSuffix:"range"}));else if(Iz(t)){const n=Bz(t);e.add(i.getName(n))}else e.add(nI(n));JB(n)&&function(e){return we(e)&&"field"in e}(n.scale?.range)&&e.add(n.scale.range.field)}(r,n,e,t)})),r.size+SN(i).length===0?null:new QG(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??(i["*"]={}),i["*"].count=new Set([r||nI(e,{forAs:!0})])):(i[n]??(i[n]={}),i[n][t]=new Set([r||nI(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+SN(i).length===0?null:new QG(e,n,i)}merge(e){return kN(this.dimensions,e.dimensions)?(function(e,t){for(const n of SN(t)){const i=t[n];for(const t of SN(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){xP.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...SN(this.measures)])}producedFields(){const e=new Set;for(const t of SN(this.measures))for(const n of SN(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${pN({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of SN(this.measures))for(const r of SN(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:BN(i));return{type:"aggregate",groupby:[...this.dimensions].map(BN),ops:e,fields:t,as:n}}}class KG extends mq{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of Gz){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]={name:t.getName(`${e}_domain`),fields:[nI(n),...cR(i)?[nI(n,{binSuffix:"end"})]:[]],...SB(r)?{sortField:r}:xe(r)?{sortIndexField:iG(n,e)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of Gz)this[t]&&(e+=` ${t.charAt(0)}:${pN(this[t])}`);return e}get fields(){const e=[];for(const t of Gz)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of Gz)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of FT){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(bL(i)&&xR(r)){const n=qH(WH(this.childModel,t));n?e[t]=n:wP(VR(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:l}=this[e];if(s){const{op:e=EB,field:t}=s;r.push(t),o.push(e),a.push(nI(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of sG){for(const t of lG){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[tz,ez])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function eH(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function tH(e){const t={};return lN(e.filter,(e=>{if(YP(e)){let n=null;qP(e)?n=$R(e.equal):GP(e)?n=$R(e.lte):WP(e)?n=$R(e.lt):HP(e)?n=$R(e.gt):VP(e)?n=$R(e.gte):ZP(e)?n=e.range[0]:XP(e)&&(n=(e.oneOf??e.in)[0]),n&&(_P(n)?t[e.field]="date":mt(n)?t[e.field]="number":yt(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}class nH extends mq{clone(){return new nH(null,cN(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${pN(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!rq(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of SN(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:wP(QR(e,n[e],t.value)))}for(const e of SN(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:wP(QR(e,t[e],n)))}const r=new ZU(t,n);i.copyAll(r);const o={};for(const e of SN(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===SN(o).length||i.parseNothing?null:new nH(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of SN(this._parse)){const n=this._parse[t];1===UN(t)&&(e[t]=n)}return e}producedFields(){return new Set(SN(this._parse))}dependentFields(){return new Set(SN(this._parse))}assembleTransforms(e=!1){return SN(this._parse).filter((t=>!e||UN(t)>1)).map((e=>{const t=function(e,t){const n=RN(e);return"number"===t?`toNumber(${n})`:"boolean"===t?`toBoolean(${n})`:"string"===t?`toString(${n})`:"date"===t?`toDate(${n})`:"flatten"===t?n:t.startsWith("date:")?`timeParse(${n},'${eH(t.slice(5,t.length))}')`:t.startsWith("utc:")?`utcParse(${n},'${eH(t.slice(4,t.length))}')`:(wP(`Unrecognized parse "${t}".`),null)}(e,this._parse[e]);return t?{type:"formula",expr:t,as:jN(e)}:null})).filter((e=>null!==e))}}class iH extends mq{clone(){return new iH(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([yj])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:yj}}}class rH extends mq{clone(){return new rH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${pN(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class oH extends mq{clone(){return new oH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${pN(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class aH extends mq{constructor(e){let t;if(super(null),e??(e={name:"source"}),rq(e)||(t=e.format?{...hN(e.format,["parse"])}:{}),nq(e))this._data={values:e.values};else if(tq(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];gN(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else aq(e)?this._data={values:[{type:"Sphere"}]}:(iq(e)||rq(e))&&(this._data={});this._generator=rq(e),e.name&&(this._name=e.name),t&&!DN(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var sH,lH=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};function uH(e){return e instanceof aH||e instanceof rH||e instanceof oH}class cH{constructor(){sH.set(this,void 0),lH(this,sH,!1,"f")}setModified(){lH(this,sH,!0,"f")}get modifiedFlag(){return function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}(this,sH,"f")}}sH=new WeakMap;class fH extends cH{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const e of t)this.run(e[0]);return this.modifiedFlag}}class dH extends cH{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class hH extends dH{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class pH extends dH{constructor(e){super(),this.requiresSelectionId=e&&RW(e)}run(e){e instanceof iH&&(this.requiresSelectionId&&(uH(e.parent)||e.parent instanceof QG||e.parent instanceof nH)||(this.setModified(),e.remove()))}}class mH extends cH{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof bq&&(n=e.producedFields(),EN(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class gH extends dH{constructor(){super()}run(e){e instanceof gq&&!e.isRequired()&&(this.setModified(),e.remove())}}class yH extends fH{run(e){if(!(uH(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof nH)if(e instanceof nH)this.setModified(),e.merge(t);else{if($N(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class vH extends fH{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof nH));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of SN(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!DN(i)){this.setModified();const n=new nH(e,i);for(const r of t){if(r instanceof nH)for(const e of SN(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof nH&&0===SN(r.parse).length&&r.remove()}}}}}class bH extends fH{run(e){e instanceof gq||e.numChildren()>0||e instanceof KG||e instanceof aH||(this.setModified(),e.remove())}}class xH extends fH{run(e){const t=e.children.filter((e=>e instanceof bq)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class wH extends fH{run(e){const t=e.children.filter((e=>e instanceof QG)),n={};for(const e of t){const t=pN(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of SN(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class _H extends fH{constructor(e){super(),this.model=e}run(e){const t=!(uH(e)||e instanceof jW||e instanceof nH||e instanceof iH),n=[],i=[];for(const r of e.children)r instanceof JG&&(t&&!$N(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof JG?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class kH extends fH{run(e){const t=[...e.children];if(!yN(t,(e=>e instanceof gq))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof gq){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof gq))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class EH extends mq{clone(){return new EH(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=wN(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??nI(e)}hash(){return`JoinAggregateTransform ${pN(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class AH extends mq{clone(){return new AH(null,cN(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,a=[],s=[];if(void 0!==t.sort)for(const e of t.sort)a.push(e.field),s.push(qN(e.order,"ascending"));const l={field:a,order:s};let u;return u=function(e){return xe(e)&&e.every((e=>yt(e)))&&e.length>1}(r)?r:yt(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new AH(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:o,offset:a,impute:s}=n,l=r.map((e=>fI(i[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=nI(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let f;if(xe(c)||UB(c))f=LR(c);else{const e=LB(c)?c.sort:"y"===o?"descending":"ascending";f=u.reduce(((t,n)=>(t.field.push(n),t.order.push(e),t)),{field:[],order:[]})}return new AH(e,{dimensionFieldDefs:l,stackField:t.vgField(o),facetby:[],stackby:u,sort:f,offset:a,impute:s,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${pN(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[nI(e,{binSuffix:"mid"})]:[nI(e,{}),nI(e,{binSuffix:"end"})]:[nI(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=nI(o,{expr:"datum"}),i=nI(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:nI(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:nI(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class $H extends mq{clone(){return new $H(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=wN(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??nI(e)}hash(){return`WindowTransform ${pN(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>rR(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function DH(e){if(e instanceof KG)if(1!==e.numChildren()||e.children[0]instanceof gq){const n=e.model.component.data.main;SH(n);const i=(t=e,function e(n){if(!(n instanceof KG)){const i=n.clone();if(i instanceof gq){const e=CH+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof QG||i instanceof AH||i instanceof $H||i instanceof EH)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof QG||t instanceof AH||t instanceof $H||t instanceof EH)&&t.addDimensions(e.fields),t.swapWithParent(),DH(e)}else e.children.map(DH);var t}function SH(e){if(e instanceof gq&&e.type===lq.Main&&1===e.numChildren()){const t=e.children[0];t instanceof KG||(t.swapWithParent(),SH(e))}}const CH="scale_",FH=5;function MH(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!MH(t.children))return!1}return!0}function OH(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function NH(e,t,n){let i=e.sources,r=!1;return r=OH(new gH,i)||r,r=OH(new pH(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=OH(new bH,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=OH(new yH,i)||r,r=OH(new _H(t),i)||r,r=OH(new mH,i)||r,r=OH(new vH,i)||r,r=OH(new wH,i)||r,r=OH(new xH,i)||r,r=OH(new hH,i)||r,r=OH(new kH,i)||r),e.sources=i,r}class zH{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new zH((()=>e(t)))}}function TH(e){dV(e)?function(e){const t=e.component.scales;for(const n of SN(t)){const i=RH(e,n);if(t[n].setWithExplicit("domains",i),IH(e,n),e.component.data.isFaceted){let t=e;for(;!hV(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)wR(e)&&(e.data=CH+e.data.replace(CH,""))}}}(e):function(e){for(const t of e.children)TH(t);const t=e.component.scales;for(const n of SN(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):KU(i,e.getWithExplicit("domains"),"domains","scale",UH);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&wP("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function RH(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=jH(t,n);if(!e)return void wP(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=jH(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&dI(i.x2)?dI(i.x)?KU(LH(n,r,e,"x"),LH(n,r,e,"x2"),"domain","scale",UH):LH(n,r,e,"x2"):"y"===t&&dI(i.y2)?dI(i.y)?KU(LH(n,r,e,"y"),LH(n,r,e,"y2"),"domain","scale",UH):LH(n,r,e,"y2"):LH(n,r,e,t)}function PH(e,t,n){const i=BP(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${bI(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function LH(e,t,n,i){const{encoding:r}=n,o=dI(r[i]),{type:a}=o,s=o.timeUnit;if(function(e){return e?.unionWith}(t)){const r=LH(e,void 0,n,i);return XU([...PH(t.unionWith,a,s),...r.value])}if(bR(t))return XU([t]);if(t&&"unaggregated"!==t&&!kL(t))return XU(PH(t,a,s));const l=n.stack;if(l&&i===l.fieldChannel){if("normalize"===l.offset)return YU([[0,1]]);const e=n.requestDataName(lq.Main);return YU([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const u=XT(i)&&UB(o)?function(e,t,n){if(!bL(n))return;const i=e.fieldDef(t),r=i.sort;if(CB(r))return{op:"min",field:iG(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(SB(r))return BH(r,o&&!a.has(r.field));if(DB(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(nR(s)||iR(s))return BH({field:nI(i),order:n},u);if(rR(s)||!s)return BH({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(gN(["ascending",void 0],r))return!0}}(n,i,e):void 0;if(WB(o))return YU(PH([o.datum],a,s));const c=o;if("unaggregated"===t){const e=n.requestDataName(lq.Main),{field:t}=o;return YU([{data:e,field:nI({field:t,aggregate:"min"})},{data:e,field:nI({field:t,aggregate:"max"})}])}if(cR(c.bin)){if(bL(e))return YU("bin-ordinal"===e?[]:[{data:MN(u)?n.requestDataName(lq.Main):n.requestDataName(lq.Raw),field:n.vgField(i,wI(c,i)?{binSuffix:"range"}:{}),sort:!0!==u&&we(u)?u:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=c;if(cR(e)){const t=XG(n,c.field,e);return YU([new zH((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return YU([{data:n.requestDataName(lq.Main),field:n.vgField(i,{})}])}}if(c.timeUnit&&gN(["time","utc"],e)&&PB(c,dV(n)?n.encoding[sT(i)]:void 0,n.markDef,n.config)){const e=n.requestDataName(lq.Main);return YU([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return YU(u?[{data:MN(u)?n.requestDataName(lq.Main):n.requestDataName(lq.Raw),field:n.vgField(i),sort:u}]:[{data:n.requestDataName(lq.Main),field:n.vgField(i)}])}function BH(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":EB),...i?{field:BN(i)}:{},...r?{order:r}:{}}}function IH(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=kL(i)&&i,a=dR(r)&&hR(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function jH(e,t){const{aggregate:n,type:i}=e;return n?yt(n)&&!lR.has(n)?{valid:!1,reason:fP(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:dP(e)}:{valid:!0}:{valid:!1,reason:cP(e)}}function UH(e,t,n,i){return e.explicit&&t.explicit&&wP(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${KN(n)} and ${KN(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function qH(e){if(wR(e)&&yt(e.field))return e.field;if(function(e){return!xe(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(wR(n)&&yt(n.field))if(t){if(t!==n.field)return wP("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return wP("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!xe(e)&&"fields"in e&&"data"in e}(e)){wP("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return yt(t)?t:void 0}}function WH(e,t){return function(e){const t=wN(e.map((e=>{if(wR(e)){const{sort:t,...n}=e;return n}return e})),pN),n=wN(e.map((e=>{if(wR(e)){const t=e.sort;return void 0===t||MN(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),pN);if(0===t.length)return;if(1===t.length){const t=e[0];if(wR(t)&&n.length>0){let e=n[0];if(n.length>1){wP(mP);const t=n.filter((e=>we(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>we(e)&&"op"in e))||1!==t.length||t[0]}else if(we(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const i=wN(n.map((e=>MN(e)||!("op"in e)||yt(e.op)&&e.op in tR?e:(wP(function(e){return`Dropping sort property ${KN(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),pN);let r;1===i.length?r=i[0]:i.length>1&&(wP(mP),r=!0);const o=wN(e.map((e=>wR(e)?e.data:null)),(e=>e));return 1===o.length&&null!==o[0]?{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}(e.component.scales[t].get("domains").map((t=>(wR(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function GH(e){return mV(e)||pV(e)?e.children.reduce(((e,t)=>e.concat(GH(t))),HH(e)):HH(e)}function HH(e){return SN(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:a,selectionExtent:s,domains:l,range:u,reverse:c,...f}=r,d=function(e,t,n,i){if(MT(n)){if(xR(e))return{step:{signal:`${t}_step`}}}else if(we(e)&&wR(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),h=WH(e,n),p=s?function(e,t,n,i){const r=qW(e,t.param,t);return{signal:xL(n.get("type"))&&xe(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,h):null;return t.push({name:o,type:a,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...void 0!==c?{reverse:c}:{},...f}),t}),[])}class VH extends ZU{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||yN(this.get("domains"),(e=>xe(e)&&2===e.length&&mt(e[0])&&e[0]<=0&&mt(e[1])&&e[1]>=0))}}const ZH=["range","scheme"];function XH(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,o=lT(t),a=e.getName(o);if(we(i)&&i.binned&&void 0!==i.step)return new zH((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(cR(i)){const t=XG(e,r,i);return new zH((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function YH(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of ZH)if(void 0!==n[i]){const o=NL(r,i),a=zL(e,i);if(o)if(a)wP(a);else switch(i){case"range":{const i=n.range;if(xe(i)){if(MT(e))return XU(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return zH.fromName(i,n)}return e})))}else if(we(i))return XU({data:t.requestDataName(lq.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return XU(i)}case"scheme":return XU(JH(n[i]))}else wP(hP(r,i,e))}const o=e===iz||"xOffset"===e?"width":"height",a=i[o];if(Dj(a))if(MT(e))if(bL(r)){const n=QH(a,t,e);if(n)return XU({step:n})}else wP(pP(o));else if(RT(e)){const n=e===sz?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=KH(a,r);if(e)return XU(e)}}const{rangeMin:s,rangeMax:l}=n,u=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,a=t.getSignalName.bind(t),{type:s}=dI(o[e]),l=t.getScaleComponent(e).get("type"),{domain:u,domainMid:c}=t.specifiedScales[e];switch(e){case iz:case rz:{if(gN(["point","band"],l)){const r=eV(e,n,i.view);if(Dj(r))return{step:QH(r,t,e)}}const r=lT(e),o=t.getName(r);return e===rz&&xL(l)?[zH.fromName(a,o),0]:[0,zH.fromName(a,o)]}case sz:case lz:return function(e,t,n){const i=e===sz?"x":"y",r=t.getScaleComponent(i).get("type"),o=t.scaleName(i);if("band"===r){const e=eV(i,t.size,t.config.view);if(Dj(e)){const t=KH(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}{const n=t.encoding[i];if(UB(n)&&n.timeUnit){const e=IP(n.timeUnit,(e=>`scale('${o}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner;return i?[{signal:`${bR(i)?`${i.signal}/2`:""+i/2} * (${e})`},{signal:`${bR(i)?`(1 - ${i.signal}/2)`:""+(1-i/2)} * (${e})`}]:[0,{signal:e}]}return fN(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,l);case wz:{const o=tV(r,t.component.scales[e].get("zero"),i),a=function(e,t,n,i){const r={x:XH(n,"x"),y:XH(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=iV(t,r,i.view);return mt(e)?e-1:new zH((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=iV(t,r,i.view);return mt(e)?Math.pow(nV*e,2):new zH((()=>`pow(${nV} * ${e.signal}, 2)`))}}throw new Error(oP("size",e))}(r,n,t,i);return _L(l)?function(e,t,n){const i=()=>{const i=MR(t),r=MR(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return bR(t)?new zH(i):{signal:i()}}(o,a,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&xe(n)?n.length+1:(wP(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(l,i,u,e)):[o,a]}case fz:return[0,2*Math.PI];case _z:return[0,360];case uz:return[0,new zH((()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`))];case $z:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Dz:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case xz:return"symbol";case yz:case vz:case bz:return"ordinal"===l?"nominal"===s?"category":"ordinal":void 0!==c?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case kz:case Ez:case Az:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==l)&&NL(r,"rangeMin")&&xe(u)&&2===u.length?XU([s??u[0],l??u[1]]):YU(u)}function JH(e){return function(e){return!yt(e)&&!!e.name}(e)?{scheme:e.name,...hN(e,["name"])}:{scheme:e}}function QH(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=cT(n),a=i[o];if("offset"===$j({step:e,offsetIsDiscrete:ZB(a)&&nL(a.type)})&&NI(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;"band"===n.get("type")&&(i=`bandspace(${i}, ${n.get("paddingInner")??n.get("padding")??0}, ${n.get("paddingOuter")??n.get("padding")??0})`);const a=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${CR(a)})`}}return e.step}function KH(e,t){if("offset"===$j({step:e,offsetIsDiscrete:bL(t)}))return{step:e.step}}function eV(e,t,n){const i=e===iz?"width":"height";return t[i]||Oj(n,i)}function tV(e,t,n){if(t)return bR(t)?{signal:`${t.signal} ? 0 : ${tV(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(oP("size",e))}const nV=.95;function iV(e,t,n){const i=Dj(e.width)?e.width.step:Mj(n,"width"),r=Dj(e.height)?e.height.step:Mj(n,"height");return t.x||t.y?new zH((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function rV(e,t){dV(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of SN(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=dI(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=NL(h,t),y=zL(s,t);if(void 0!==d&&(g?y&&wP(y):wP(hP(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":_P(l[t])||"temporal"===n||e?u.set(t,{signal:bI(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=t in oV?oV[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:zI(r,s),hasSecondaryRangeChannel:!!r[sT(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):sV(e,t)}const oV={bins:({model:e,fieldOrDatumDef:t})=>UB(t)?function(e,t){const n=t.bin;if(cR(n)){const i=XG(e,t.field,n);return new zH((()=>e.getSignalName(i)))}if(fR(n)&&dR(n)&&void 0!==n.step)return{step:n.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(gN([yz,vz,bz],e)&&"nominal"!==t)return"hcl"}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){if(!(fI(o)?.bin||xe(n)||null!=r||null!=i||gN([lL.TIME,lL.UTC],e)))return!!MT(t)||void 0}(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(MT(e)){if(wL(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!UB(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===lL.POINT)return n.pointPadding}}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0===e){if(MT(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:qN(e,"bar"===n?t:i)}return RT(t)&&i===lL.BAND?r.offsetBandPaddingInner:void 0}}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0===e)if(MT(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===lL.BAND)return qN(e,bR(i)?{signal:`${i.signal}/2`}:i/2)}else if(RT(t)){if(n===lL.POINT)return.5;if(n===lL.BAND)return r.offsetBandPaddingOuter}}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){return"x"===n&&void 0!==i.xReverse?xL(e)&&"descending"===t?bR(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse:!(!xL(e)||"descending"!==t)||void 0}(t,UB(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:a})=>function(e,t,n,i,r,o,a){if(n&&"unaggregated"!==n&&xL(r)){if(xe(n)){const e=n[0],t=n[n.length-1];if(mt(e)&&e<=0&&mt(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!_L(r))return!0;if((!UB(t)||!t.bin)&&gN([...FT,...NT],e)){const{orient:t,type:n}=i;return(!gN(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!gN(["bar","area"],n)||a)||o?.zero)}return!1}(e,t,n,i,r,o.scale,a)};function aV(e){dV(e)?function(e){const t=e.component.scales;for(const n of ZT){const i=t[n];if(!i)continue;const r=YH(n,e);i.setWithExplicit("range",r)}}(e):sV(e,"range")}function sV(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?aV(n):rV(n,t);for(const i of SN(n)){let r;for(const n of e.children){const e=n.component.scales[i];e&&(r=KU(r,e.getWithExplicit(t),t,"scale",JU(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))))}n[i].setWithExplicit(t,r)}}function lV(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(qz(e)||"discrete"===KT(e))return"shape"===e&&"ordinal"===t.type&&wP(uP(e,"ordinal")),"ordinal";if(MT(e)||RT(e)){if(gN(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in OT)return"band";return iB(n[lT(e)])||QB(t)&&t.axis?.tickBand?"band":"point";case"temporal":return qz(e)?"time":"discrete"===KT(e)?(wP(uP(e,"temporal")),"ordinal"):UB(t)&&t.timeUnit&&BP(t.timeUnit).utc?"utc":"time";case"quantitative":return qz(e)?UB(t)&&cR(t.bin)?"bin-ordinal":"linear":"discrete"===KT(e)?(wP(uP(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(nP(t.type))}(t,n,i,r),{type:a}=e;return XT(t)?void 0!==a?function(e,t,n=!1){if(!XT(e))return!1;switch(e){case iz:case rz:case sz:case lz:case fz:case uz:return!!wL(t)||"band"===t||"point"===t&&!n;case wz:case $z:case kz:case Ez:case Az:case _z:return wL(t)||_L(t)||gN(["band","point","ordinal"],t);case yz:case vz:case bz:return"band"!==t;case Dz:case xz:return"ordinal"===t||_L(t)}}(t,a)?UB(n)&&(s=a,l=n.type,!(gN([rL,aL],l)?void 0===s||bL(s):l===oL?gN([lL.TIME,lL.UTC,void 0],s):l!==iL||mL(s)||_L(s)||void 0===s))?(wP(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(wP(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,l}function uV(e){dV(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of ZT){const a=dI(t[o]);if(a&&n===XL&&o===xz&&a.type===sL)continue;let s=a&&a.scale;if(!RT(o)||zI(t,fT(o))){if(a&&null!==s&&!1!==s){s??(s={});const n=lV(s,o,a,i,zI(t,o));r[o]=new VH(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}else s&&wP(aP(o))}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){uV(n);for(const o of SN(n.component.scales))if((t=r.scale)[o]??(t[o]=AG(o,e)),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?cL(e.value,t.value)?i[o]=KU(e,t,"type","scale",cV):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of SN(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new VH(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const cV=JU(((e,t)=>dL(e)-dL(t)));class fV{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function dV(e){return"unit"===e?.type}function hV(e){return"facet"===e?.type}function pV(e){return"concat"===e?.type}function mV(e){return"layer"===e?.type}class gV{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.view=gR(a),this.name=e.name??i,this.title=vR(e.title)?{text:e.title}:e.title?gR(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new fV,this.projectionNameMap=n?n.projectionNameMap:new fV,this.signalNameMap=n?n.signalNameMap:new fV,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>mU(e)?{filter:uN(e.filter,eL)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){const i=n[t],r={},{spacing:o,columns:a}=i;void 0!==o&&(r.spacing=o),void 0!==a&&(OB(e)&&!FB(e.facet)||kj(e))&&(r.columns=a),Ej(e)&&(r.columns=1);for(const t of Cj)if(void 0!==e[t])if("spacing"===t){const n=e[t];r[t]=mt(n)?n:{row:n.row??o,column:n.column??o}}else r[t]=e[t];return r}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:OB(e)||n?.component.data.isFaceted&&void 0===e.data},layoutSize:new ZU,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?cN(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){uV(e),TH(e);for(const t of OL)rV(e,t);t||aV(e)}(this)}parseProjection(){HG(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){LG(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of SN(n)){const t=n[e];void 0!==t&&(i[e]=SR(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=SR(this.description)),"unit"!==this.type&&"layer"!==this.type)?DN(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t??{}}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of Gz){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=aG(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=rG(i,o),s=yG(e,a);void 0!==s&&(n[a]=s)}}return DN(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of Gz)e[n].title&&t.push(uG(this,n));for(const e of sG)t=t.concat(dG(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>HW(e,"grid",t))),...i.map((e=>HW(e,"grid",t))),...n.map((e=>HW(e,"main",t))),...i.map((e=>HW(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return UG(this)}assembleProjections(){return mV(e=this)||pV(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),qG(e))}(e):qG(e);var e}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...yR(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return gN(["unit","layer"],this.type)?gN(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),DN(n)?void 0:n}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||hV(this.parent)?GH(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return ON((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(lq[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(hV(this.parent)){const t=zT(kG(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(bL(e)&&xR(i)){const e=n.get("name"),i=qH(WH(this,t));return i?{signal:_G(e,n,nI({aggregate:"distinct",field:i},{expr:"datum"}))}:(wP(VR(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):nT(e)&&XT(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class yV extends gV{vgField(e,t={}){const n=this.fieldDef(e);if(n)return nI(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?SN(e).reduce(((n,r)=>{const o=e[r];return xe(o)?o.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,o,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=fI(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){BI(this.getMapping(),((t,n)=>{const i=fI(t);i&&e(i,n)}),t)}}class vV extends mq{clone(){return new vV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"]}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${pN(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return this.transform.groupby&&(n.resolve="shared"),n}}class bV extends mq{clone(){return new bV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${pN(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class xV extends mq{clone(){return new xV(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==zR("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=XT(r)&&t.getScaleComponent(r);return o&&xL(o.get("type"))&&"count"!==n.aggregate&&!YL(i)&&(e[n.field]=n),e}),{});return SN(o).length?new xV(e,o):null}dependentFields(){return new Set(SN(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${pN(this.filter)}`}assemble(){const e=SN(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=nI(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class wV extends mq{clone(){return new wV(this.parent,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${pN(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class _V extends mq{clone(){return new _V(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${pN(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class kV extends mq{clone(){return new kV(null,cN(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[pz,hz],[gz,mz]]){const r=i.map((e=>{const n=dI(t.encoding[e]);return UB(n)?n.field:WB(n)?{expr:`${n.datum}`}:YB(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new kV(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(xz)){const i=t.typedFieldDef(xz);i.type===sL&&(e=new kV(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(yt);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${pN(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class EV extends mq{clone(){return new EV(null,this.projection,cN(this.fields),cN(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[pz,hz],[gz,mz]]){const i=n.map((e=>{const n=dI(t.encoding[e]);return UB(n)?n.field:WB(n)?{expr:`${n.datum}`}:YB(n)?{expr:`${n.value}`}:void 0})),r=n[0]===gz?"2":"";(i[0]||i[1])&&(e=new EV(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(yt))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${pN(this.fields)} ${pN(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class AV extends mq{clone(){return new AV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new AV(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(UB(i)&&UB(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:l,frame:u,keyvals:c}=o.impute,f=II(t.mark,n);return new AV(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...u?{frame:u}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${pN(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:gU(n)?this.processSequence(n):n}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};return i&&"value"!==i?[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}}class $V extends mq{clone(){return new $V(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${pN(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class DV extends mq{clone(){return new DV(null,cN(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return"data"in e}(o)){let e=jV(o.data,r);e||(e=new aH(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new gq(e,n,lq.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(ON(e),e)}catch(t){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new DV(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Ge(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${pN({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:Ge(this.transform.as)}:{}};else{let t=this.transform.as;yt(t)||(wP('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class SV extends mq{clone(){return new SV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${pN(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class CV extends mq{clone(){return new CV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=cN(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${pN(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class FV extends mq{clone(){return new FV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=wN((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${pN(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class MV extends mq{clone(){return new MV(null,cN(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${pN(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function OV(e){let t=0;return function n(i,r){if(i instanceof aH&&!i.isGenerator&&!tq(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof nH&&(i.parent instanceof aH&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof KG)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());switch((i instanceof rH||i instanceof oH||i instanceof xV||i instanceof jW||i instanceof nG||i instanceof EV||i instanceof QG||i instanceof DV||i instanceof $H||i instanceof EH||i instanceof _V||i instanceof wV||i instanceof vV||i instanceof $V||i instanceof SV||i instanceof CV||i instanceof iH||i instanceof MV||i instanceof FV||i instanceof bV)&&r.transform.push(i.assemble()),(i instanceof JG||i instanceof bq||i instanceof AV||i instanceof AH||i instanceof kV)&&r.transform.push(...i.assemble()),i instanceof gq&&(r.source&&0===r.transform.length?i.setSource(r.source):i.parent instanceof gq?i.setSource(r.name):(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof gq&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children)n(e,{name:null,source:o,transform:[]});break}}}}function NV(e,t){const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],s=oG("title",null,i,t);let l=sI(a,i,{allowDisabling:!0,includeDefault:void 0===s||!!s});r.component.layoutHeaders[t].title&&(l=xe(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const u=oG("labelOrient",a.header,i,t),c=null!==a.header&&qN(a.header?.labels,i.header.labels,!0),f=gN(["bottom","right"],u)?"footer":"header";o.layoutHeaders[t]={title:null!==a.header?l:null,facetFieldDef:a,[f]:"facet"===t?[]:[zV(e,t,c)]}}}function zV(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function TV(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=$G(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||bR(i)?"header":"footer";a[t]??(a[t]=[zV(e,o,!1)]);const n=HW(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function RV(e){for(const t of e.children)t.parseLayoutSize()}function PV(e,t){const n=kG(t),i=zT(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??AG(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=KU(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function LV(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(bL(e)){const e=Oj(i.view,t);return xR(n)||Dj(e)?"step":e}return Fj(i.view,t)}if(e.hasProjection||"arc"===e.mark)return Fj(i.view,t);{const e=Oj(i.view,t);return Dj(e)?e.step:e}}function BV(e,t,n){return nI(t,{suffix:`by_${nI(e)}`,...n??{}})}class IV extends yV{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=cZ(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!FB(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=SN(e),n={};for(const i of t){if(![ez,tz].includes(i)){wP(oP(i,"facet"));break}const t=e[i];if(void 0===t.field){wP(rP(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=mI(e,t);return n.header?n.header=gR(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=UV(this),this.child.parseData()}parseLayoutSize(){RV(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Gz)NV(e,t);TV(e,"x"),TV(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of Gz)for(const n of lG){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=oG("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=rG(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(r?.[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??(e[o]={}),e[o][t]=.5),i.title&&(e.offset??(e.offset={}),e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof IV))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof IV?{...this.channelHasField("column")?{encode:{update:{columns:{field:nI(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof IV){if(this.child.channelHasField("column")){const i=nI(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of FT){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(bL(o)&&xR(a)){const r=qH(WH(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):wP(VR(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:a}=this.getCardinalityAggregateForChild(),s=[];for(const e of Gz){const t=this.facet[e];if(t){s.push(nI(t));const{bin:l,sort:u}=t;if(cR(l)&&s.push(nI(t,{binSuffix:"end"})),SB(u)){const{field:e,op:s=EB}=u,l=BV(t,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(e),o.push(s),a.push(l))}else if(xe(u)){const n=iG(t,e);r.push(n),o.push("max"),a.push(n)}}}const l=!!n&&!!i;return{name:e,data:t,groupby:s,...l||r.length>0?{aggregate:{...l?{cross:l}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?SB(n.sort)?[BV(n,n.sort,{expr:"datum"})]:xe(n.sort)?[iG(n,e,{expr:"datum"})]:[nI(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(SB(e)?e.order:!xe(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return pG(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of sG)if(e[i]){const r=oG("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return pG(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=OV(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:Gz.map((e=>this.facetSortFields(e))).flat(),order:Gz.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(dq(this,[]))}]}getMapping(){return this.facet}}function jV(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(nq(e)&&nq(t)){if(QN(e.values,t.values))return n}else if(tq(e)&&tq(t)){if(e.url===t.url)return n}else if(iq(e)&&e.name===n.dataName)return n}return null}function UV(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new aH({values:[]});return t.push(e),e}const n=jV(e.data,t);if(n)return rq(e.data)||(n.data.format=bN({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new aH(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=r&&(rq(r)||tq(r)||nq(r))||!e.parent?new eq:e.parent.component.data.ancestorParse.clone();rq(r)?(oq(r)?t=new oH(t,r.sequence):sq(r)&&(t=new rH(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=nH.makeExplicit(t,e,o)??t,t=new iH(t);const a=e.parent&&mV(e.parent);(dV(e)||hV(e))&&a&&(t=JG.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(DU(r))a=e=new nG(e,r),o="derived";else if(mU(r)){const i=tH(r);a=e=nH.makeWithAncestors(e,{},i,n)??e,e=new jW(e,t,r.filter)}else if(SU(r))a=e=JG.makeFromTransform(e,r,t),o="number";else if(FU(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new nH(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=bq.makeFromTransform(e,r);else if(MU(r))a=e=QG.makeFromTransform(e,r),o="number",RW(t)&&(e=new iH(e));else if(yU(r))a=e=DV.make(e,t,r,i++),o="derived";else if(EU(r))a=e=new $H(e,r),o="number";else if(AU(r))a=e=new EH(e,r),o="number";else if(OU(r))a=e=AH.makeFromTransform(e,r),o="derived";else if(NU(r))a=e=new _V(e,r),o="derived";else if(zU(r))a=e=new bV(e,r),o="derived";else if($U(r))a=e=new wV(e,r),o="derived";else if(vU(r))a=e=new FV(e,r),o="derived";else if(kU(r))e=new MV(e,r);else if(CU(r))a=e=AV.makeFromTransform(e,r),o="derived";else if(bU(r))a=e=new vV(e,r),o="derived";else if(xU(r))a=e=new SV(e,r),o="derived";else if(wU(r))a=e=new CV(e,r),o="derived";else{if(!_U(r)){wP(`Ignoring an invalid transform: ${KN(r)}.`);continue}a=e=new $V(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(dV(e)&&e.component.selection)for(const n of SN(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&UN(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=function(e){const t={};function n(e){var n;vI(e)?t[e.field]="date":"quantitative"===e.type&&yt(n=e.aggregate)&&gN(["min","max"],n)?t[e.field]="number":UN(e.field)>1?e.field in t||(t[e.field]="flatten"):JB(e)&&SB(e.sort)&&UN(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((dV(e)||hV(e))&&e.forEachFieldDef(((t,i)=>{if(XB(t))n(t);else{const r=oT(i),o=e.fieldDef(r);n({...t,type:o.type})}})),dV(e)){const{mark:n,markDef:i,encoding:r}=e;if(YL(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];UB(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}(e);t=nH.makeWithAncestors(t,{},{...s,...l},o)??t,dV(e)&&(t=kV.parseAll(t,e),t=EV.parseAll(t,e)),(dV(e)||hV(e))&&(a||(t=JG.makeFromEncoding(t,e)??t),t=bq.makeFromEncoding(t,e)??t,t=nG.parseAllForSortIndex(t,e));const u=e.getDataName(lq.Raw),c=new gq(t,u,lq.Raw,i);if(n[u]=c,t=c,dV(e)){const n=QG.makeFromEncoding(t,e);n&&(t=n,RW(e)&&(t=new iH(t))),t=AV.makeFromEncoding(t,e)??t,t=AH.makeFromEncoding(t,e)??t}dV(e)&&(t=xV.make(t,e)??t);const f=e.getDataName(lq.Main),d=new gq(t,f,lq.Main,i);n[f]=d,t=d,dV(e)&&function(e,t){for(const[n,i]of FN(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new gq(new jW(t,e,{param:n}),r,lq.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let h=null;if(hV(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(SB(r.sort)){const{field:n,op:i=EB}=r.sort;e=t=new EH(e,{joinaggregate:[{op:i,field:n,as:BV(r,r.sort,{forAs:!0})}],groupby:[nI(r)]})}return t}return null}(t,e.facet)??t,h=new KG(t,e,i,d.getSource()),n[i]=h}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:d,facetRoot:h,ancestorParse:o}}class qV extends gV{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||wP("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>cZ(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=UV(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of SN(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Ej(e)?e.vconcat:Aj(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){RV(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";PV(e,t),PV(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=bG(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const WV={disable:1,gridScale:1,scale:1,...$I,labelExpr:1,encode:1},GV=SN(WV);class HV extends ZU{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new HV(cN(this.explicit),cN(this.implicit),this.mainExtracted)}hasAxisPart(e){return!("axis"!==e&&("grid"===e||"title"===e?!this.get(e):(t=this.get(e),!1===t||null===t)));var t}hasOrientSignalRef(){return bR(this.explicit.orient)}}const VV={bottom:"top",top:"bottom",left:"right",right:"left"};function ZV(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return jR(e,t);case"gridScale":return{explicit:e.explicit,value:qN(e.value,t.value)}}return QU(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function YV(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(bR(n.labelAngle)?n.labelAngle:XN(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===tG(i,r))return!0}return e===n[t]}const JV=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function QV(e,t){let n=t.axis(e);const i=new HV,r=dI(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),u=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:mL(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=bR(n)?"axisOrient":`axis${TN(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:ZW(s,i,e,n),vgAxisConfig:ZW(l,i,e,n),axisConfigStyle:XW([...l,...s],i)}}(e,l,s,t.config),c=void 0!==n?!n:YW("disable",a.style,n?.style,u).configValue;if(i.set("disable",c,void 0!==n),c)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return bR(o)?o:XN(o);{const{configValue:o}=YW("labelAngle",i,t?.style,r);return void 0!==o?XN(o):n!==iz||!gN([aL,rL],e.type)||UB(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,u),d=bB(n.formatType,r,l),h=vB(r,r.type,n.format,n.formatType,a,!0),p={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const r of GV){const o=r in JW?JW[r](p):SI(r)?n[r]:void 0,s=void 0!==o,l=YV(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=SI(r)&&"values"!==r?YW(r,a.style,n.style,u):{},c=void 0!==e;s&&!c?i.set(r,o,l):("vgAxisConfig"!==t||JV.has(r)&&c||kI(e)||bR(e))&&i.set(r,e,!1)}}const m=n.encoding??{},g=EI.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=EG(m[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=dI(i[t])??dI(i[sT(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(dB(l))return{text:yB({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===qB(o)){if(QB(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:yB({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:yB({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===qB(o)&&r.timeFormatType&&UB(o)&&!o.timeUnit)return{text:yB({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||DN(a)||(n[r]={update:a}),n}),{});return DN(g)||i.set("encode",g,!!n.encoding||void 0!==n.labelAngle),i}function KV(e,t){const{config:n}=e;return{...lW(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Xq("x",e,{defaultPos:"mid"}),...Xq("y",e,{defaultPos:"mid"}),...Gq("size",e),...Gq("angle",e),...eZ(e,0,t)}}function eZ(e,t,n){return n?{shape:{value:n}}:Gq("shape",e)}function tZ(e,t,n){if(void 0===zR("align",e,n))return"center"}function nZ(e,t,n){if(void 0===zR("baseline",e,n))return"middle"}function iZ(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),a=zR("size",n,t,{vgChannel:r})??t.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&xR(e)&&mt(e.step)?3*e.step/4:3*Mj(t.view,r)/4}}const rZ={arc:{vgMark:"arc",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Xq("x",e,{defaultPos:"mid"}),...Xq("y",e,{defaultPos:"mid"}),...iW(e,"radius"),...iW(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...eW("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...eW("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...fW(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...iW(e,"x"),...iW(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>KV(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&UB(n)&&n.type===sL?{field:nI(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...iW(e,"x"),...iW(e,"y"),...Pq(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Xq("x",e,{defaultPos:"mid"}),...Xq("y",e,{defaultPos:"mid"}),...Gq("size",e,{vgChannel:"strokeWidth"}),...fW(e)})},point:{vgMark:"symbol",encodeEntry:e=>KV(e)},rect:{vgMark:"rect",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...iW(e,"x"),...iW(e,"y")})},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...lW(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...eW("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...eW("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...Gq("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>KV(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...lW(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Xq("x",e,{defaultPos:"mid"}),...Xq("y",e,{defaultPos:"mid"}),...Pq(e),...Gq("size",e,{vgChannel:"fontSize"}),...Gq("angle",e),...dW("align",tZ(e.markDef,0,t)),...dW("baseline",nZ(e.markDef,0,t)),...Xq("radius",e,{defaultPos:null}),...Xq("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return{...lW(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Xq("x",e,{defaultPos:"mid",vgChannel:"xc"}),...Xq("y",e,{defaultPos:"mid",vgChannel:"yc"}),...Gq("size",e,{defaultValue:iZ(e),vgChannel:r}),[o]:SR(zR("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...lW(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Xq("x",e,{defaultPos:"mid"}),...Xq("y",e,{defaultPos:"mid"}),...Gq("size",e),...fW(e)})}};const oZ="faceted_path_",aZ="stack_group_";function sZ(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=qN(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=NR(i),l=r.key,u=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!xe(a)&&YB(a)&&mN(a.value)||!a&&mN(zR("order",r,o)))){if((xe(a)||UB(a))&&!n)return LR(a,{expr:"datum"});if(YL(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(UB(i)){const t=i.sort;return xe(t)?{field:nI(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:SB(t)?{field:nI({aggregate:TI(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:DB(t)?{field:nI(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:nI(i,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),c=function(e){if(!e.component.selection)return null;const t=SN(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=SN(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),f=zR("aria",i,o),d=rZ[n].postEncodingTransform?rZ[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:rZ[n].vgMark,...a?{clip:!0}:{},...s?{style:s}:{},...l?{key:l.field}:{},...u?{sort:u}:{},...c||{},...!1===f?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(lq.Main)},encode:{update:rZ[n].encodeEntry(e)},...d?{transform:d}:{}}]}class lZ extends yV{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,Sj(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const o=KL(e.mark)?{...e.mark}:{type:e.mark},a=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=TR("filled",e,t),r=e.type;return qN(i,r!==jL&&r!==IL&&r!==qL)}(o,r,{graticule:e.data&&sq(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const t of SN(e))nT(t)||wP(`${o=t}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let o of dT){if(!e[o])continue;const s=e[o];if(RT(o)){const e=fT(o),t=r[e];if(UB(t)){if(("quantitative"===(a=t.type)||"temporal"===a)&&UB(s)&&!t.timeUnit){wP(eP(e));continue}}else o=e,wP(tP(e))}if("angle"!==o||"arc"!==t||e.theta||(wP("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=fz),PI(e,o,t)){if(o===wz&&"line"===t){const t=fI(e[o]);if(t?.aggregate){wP("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===yz&&(n?"fill"in e:"stroke"in e))wP(iP("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(o===Fz||o===Cz&&!xe(s)&&!YB(s)||o===Oz&&xe(s)){if(s){if(o===Cz){const t=e[o];if(LB(t)){r[o]=t;continue}}r[o]=Ge(s).reduce(((e,t)=>(UB(t)?e.push(mI(t,o)):wP(rP(t,o)),e)),[])}}else{if(o===Oz&&null===s)r[o]=null;else if(!(UB(s)||WB(s)||YB(s)||BB(s)||bR(s))){wP(rP(s,o));continue}r[o]=hI(s,o,i)}}else wP(oP(o,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=Kj(o,s,r),this.size=function({encoding:e,size:t}){for(const n of FT){const i=lT(n);Dj(t[i])&&GB(e[n])&&(delete t[i],wP(pP(i)))}return t}({encoding:s,size:Sj(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=Qj(this.markDef,s),this.specifiedScales=this.initScales(a,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>wj(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===XL,n=e&&jz.some((t=>ZB(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return ZT.reduce(((e,n)=>{const i=dI(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=gR(e);return xe(t)&&(i.domain=t.map($R)),xe(n)&&(i.range=n.map($R)),i}initAxes(e){return FT.reduce(((t,n)=>{const i=e[n];if(ZB(i)||n===iz&&ZB(e.x2)||n===rz&&ZB(e.y2)){const e=ZB(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=SN(e),n={};for(const i of t){const t=e[i];n[i]=kI(t)?AR(t):$R(t)}return n}initLegends(e){return HT.reduce(((t,n)=>{const i=dI(e[n]);if(i&&function(e){switch(e){case yz:case vz:case bz:case wz:case xz:case kz:case $z:case Dz:return!0;case Ez:case Az:case _z:return!1}}(n)){const e=i.legend;t[n]=e?gR(e):e}return t}),{})}parseData(){this.component.data=UV(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of FT){const r=lT(i);if(t[r]){const e=t[r];n.layoutSize.set(r,Dj(e)?"step":e,!0)}else{const t=LV(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;for(const r of t){const t=ON(r.name),o=r.select,a=yt(o)?o:o.type,s=we(o)?cN(o):{type:a},l=i[a];for(const e in l)"fields"!==e&&"encodings"!==e&&("mark"===e&&(s[e]={...l[e],...s[e]}),void 0!==s[e]&&!0!==s[e]||(s[e]=cN(l[e]??s[e])));const u=n[t]={...s,name:t,type:a,init:r.value,bind:r.bind,events:yt(s.on)?TS(s.on,"scope"):Ge(cN(s.on))},c=cN(r);for(const t of zW)t.defined(u)&&t.parse&&t.parse(e,u,c)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(e){if(gN([IL,PL,HL],e.mark)){const t=II(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:oZ+e.requestDataName(lq.Main),data:e.requestDataName(lq.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:sZ(e,{fromPrefix:oZ})}]}(e,t)}else if(e.mark===LL){const t=ER.some((t=>zR(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=sZ(e,{fromPrefix:aZ}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...dN(t.encode.update,["y","yc","y2","height",...ER]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...hN(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...dN(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...hN(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of ER){const i=TR(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=SR(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=nI(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(nI(n,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=TR(i,e.markDef,e.config);return void 0!==t?{...n,[i]:SR(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(lq.Main),name:aZ+e.requestDataName(lq.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return sZ(e)}(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,FT.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[QV(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of CN(e.component.selection??{})){const r=i.name,o=$t(r+FW);if(0===t.filter((e=>e.name===r)).length){const e="global"===i.resolve?"union":i.resolve,n="point"===i.type?", true, true)":")";t.push({name:i.name,update:`${NW}(${o}, ${$t(e)}${n}`})}n=!0;for(const n of zW)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}if(n){0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return pq(t)}(this,e)}assembleSignals(){return[...VW(this),...fq(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=TW(e,{escape:!1});for(const t of CN(e.component.selection??{})){const e={name:t.name+FW};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:yj}}]),t.init){const n=t.project.items.map(uq);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[yj]:cq(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:cq(e,!1)})))}n.filter((e=>e.name===t.name+FW)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return bG(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&mV(this.parent)||(e=hq(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return OI(this.encoding,e)}fieldDef(e){return fI(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return XB(t)?t:null}}class uZ extends gV{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Gj(e))return new uZ(e,this,this.getName(`layer_${t}`),o,r);if(FI(e))return new lZ(e,this,this.getName(`layer_${t}`),o,r);throw new Error(UR(e))}))}parseData(){this.component.data=UV(this);for(const e of this.children)e.parseData()}parseLayoutSize(){RV(this),PV(this,"width"),PV(this,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of SN(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of SN(i.component.axes))n.axis[r]=$G(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=ZV(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of FT){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!bR(t)){if(i[t]>0&&!n){const n=VV[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),VW(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),bG(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const t of this.children)for(const n of Ge(t.assembleGroupStyle()))e.add(n);const t=Array.from(e);return t.length>1?t:1===t.length?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)dV(n)&&(t=hq(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),UG(this))}}function cZ(e,t,n,i,r){if(OB(e))return new IV(e,t,n,r);if(Gj(e))return new uZ(e,t,n,i,r);if(FI(e))return new lZ(e,t,n,i,r);if(function(e){return Ej(e)||Aj(e)||kj(e)}(e))return new qV(e,t,n,r);throw new Error(UR(e))}function fZ(e,t={}){var n;t.logger&&(n=t.logger,xP=n),t.fieldTitle&&aI(t.fieldTitle);try{const n=Ij(ke(t.config,e.config)),i=jU(e,n),r=cZ(i,null,"",void 0,n);r.parse(),function(e,t){MH(e.sources);let n=0,i=0;for(let i=0;i"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),..._j(f)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");if(void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):yt(t)&&(t={type:t}),r&&o&&("fit"===(a=t.type)||"fit-x"===a||"fit-y"===a))if("step"===r&&"step"===o)wP(HR()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";wP(HR(zT(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${zT(e)}`:"fit"}(n)}var a;return{...1===SN(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...VU(n,!1),...VU(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(xP=bP),t.fieldTitle&&aI(rI)}}const dZ="5.15.1",hZ=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};const pZ="#fff",mZ="#888",gZ={background:"#333",view:{stroke:mZ},title:{color:pZ,subtitleColor:pZ},style:{"guide-label":{fill:pZ},"guide-title":{fill:pZ}},axis:{domainColor:pZ,gridColor:mZ,tickColor:pZ}},yZ="#4572a7",vZ={background:"#fff",arc:{fill:yZ},area:{fill:yZ},line:{stroke:yZ,strokeWidth:2},path:{stroke:yZ},rect:{fill:yZ},shape:{stroke:yZ},symbol:{fill:yZ,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},bZ="#30a2da",xZ="#cbcbcb",wZ="#f0f0f0",_Z="#333",kZ={arc:{fill:bZ},area:{fill:bZ},axis:{domainColor:xZ,grid:!0,gridColor:xZ,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:xZ,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:wZ,group:{fill:wZ},legend:{labelColor:_Z,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:_Z,titleFontSize:14,titlePadding:10},line:{stroke:bZ,strokeWidth:2},path:{stroke:bZ,strokeWidth:.5},rect:{fill:bZ},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:bZ},bar:{binSpacing:2,fill:bZ,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},EZ="#000",AZ={group:{fill:"#e5e5e5"},arc:{fill:EZ},area:{fill:EZ},line:{stroke:EZ},path:{stroke:EZ},rect:{fill:EZ},shape:{stroke:EZ},symbol:{fill:EZ,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},$Z="Benton Gothic, sans-serif",DZ="#82c6df",SZ="Benton Gothic Bold, sans-serif",CZ="normal",FZ={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},MZ={background:"#ffffff",title:{anchor:"start",color:"#000000",font:SZ,fontSize:22,fontWeight:"normal"},arc:{fill:DZ},area:{fill:DZ},line:{stroke:DZ,strokeWidth:2},path:{stroke:DZ},rect:{fill:DZ},shape:{stroke:DZ},symbol:{fill:DZ,size:30},axis:{labelFont:$Z,labelFontSize:11.5,labelFontWeight:"normal",titleFont:SZ,titleFontSize:13,titleFontWeight:CZ},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:$Z,labelFontSize:11.5,symbolType:"square",titleFont:SZ,titleFontSize:13,titleFontWeight:CZ},range:{category:FZ["category-6"],diverging:FZ["fireandice-6"],heatmap:FZ["fire-7"],ordinal:FZ["fire-7"],ramp:FZ["fire-7"]}},OZ="#ab5787",NZ="#979797",zZ={background:"#f9f9f9",arc:{fill:OZ},area:{fill:OZ},line:{stroke:OZ},path:{stroke:OZ},rect:{fill:OZ},shape:{stroke:OZ},symbol:{fill:OZ,size:30},axis:{domainColor:NZ,domainWidth:.5,gridWidth:.2,labelColor:NZ,tickColor:NZ,tickWidth:.2,titleColor:NZ},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},TZ="#3e5c69",RZ={background:"#fff",arc:{fill:TZ},area:{fill:TZ},line:{stroke:TZ},path:{stroke:TZ},rect:{fill:TZ},shape:{stroke:TZ},symbol:{fill:TZ},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},PZ="#1696d2",LZ="#000000",BZ="Lato",IZ="Lato",jZ={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},UZ={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:BZ},axisX:{domain:!0,domainColor:LZ,domainWidth:1,grid:!1,labelFontSize:12,labelFont:IZ,labelAngle:0,tickColor:LZ,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:BZ},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:IZ,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:BZ,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:IZ,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:BZ,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:jZ["six-groups-cat-1"],diverging:jZ["diverging-colors"],heatmap:jZ["diverging-colors"],ordinal:jZ["six-groups-seq"],ramp:jZ["shades-blue"]},area:{fill:PZ},rect:{fill:PZ},line:{color:PZ,stroke:PZ,strokeWidth:5},trail:{color:PZ,stroke:PZ,strokeWidth:0,size:1},path:{stroke:PZ,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:PZ,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:PZ,stroke:null}},arc:{fill:PZ},shape:{stroke:PZ},symbol:{fill:PZ,size:30}},qZ="#3366CC",WZ="#ccc",GZ="Arial, sans-serif",HZ={arc:{fill:qZ},area:{fill:qZ},path:{stroke:qZ},rect:{fill:qZ},shape:{stroke:qZ},symbol:{stroke:qZ},circle:{fill:qZ},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:GZ,fontSize:12},"guide-title":{font:GZ,fontSize:12},"group-title":{font:GZ,fontSize:12}},title:{font:GZ,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:WZ,tickColor:WZ,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},VZ=e=>e*(1/3+1),ZZ=VZ(9),XZ=VZ(10),YZ=VZ(12),JZ="Segoe UI",QZ="wf_standard-font, helvetica, arial, sans-serif",KZ="#252423",eX="#605E5C",tX="transparent",nX="#118DFF",iX="#DEEFFF",rX=[iX,nX],oX={view:{stroke:tX},background:tX,font:JZ,header:{titleFont:QZ,titleFontSize:YZ,titleColor:KZ,labelFont:JZ,labelFontSize:XZ,labelColor:eX},axis:{ticks:!1,grid:!1,domain:!1,labelColor:eX,labelFontSize:ZZ,titleFont:QZ,titleColor:KZ,titleFontSize:YZ,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:nX},line:{stroke:nX,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:JZ,fontSize:ZZ,fill:eX},arc:{fill:nX},area:{fill:nX,line:!0,opacity:.6},path:{stroke:nX},rect:{fill:nX},point:{fill:nX,filled:!0,size:75},shape:{stroke:nX},symbol:{fill:nX,strokeWidth:1.5,size:50},legend:{titleFont:JZ,titleFontWeight:"bold",titleColor:eX,labelFont:JZ,labelFontSize:XZ,labelColor:eX,symbolType:"circle",symbolSize:75},range:{category:[nX,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:rX,heatmap:rX,ordinal:[iX,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",nX]}},aX='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',sX=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],lX=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function uX({type:e,background:t}){const n="dark"===e?"#161616":"#ffffff",i="dark"===e?"#f4f4f4":"#161616",r="dark"===e?"#d4bbff":"#6929c4";return{background:t,arc:{fill:r},area:{fill:r},path:{stroke:r},rect:{fill:r},shape:{stroke:r},symbol:{stroke:r},circle:{fill:r},view:{fill:n,stroke:n},group:{fill:n},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:aX,fontWeight:600},axis:{labelColor:i,labelFontSize:12,grid:!0,gridColor:"#525252",titleColor:i,labelAngle:0},style:{"guide-label":{font:aX,fill:i,fontWeight:400},"guide-title":{font:aX,fill:i,fontWeight:400}},range:{category:"dark"===e?sX:lX,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const cX=uX({type:"light",background:"#ffffff"}),fX=uX({type:"light",background:"#f4f4f4"}),dX=uX({type:"dark",background:"#262626"}),hX=uX({type:"dark",background:"#161616"}),pX="2.14.0";function mX(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}const gX="vg-tooltip-element",yX={offsetX:10,offsetY:10,id:gX,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(yt(e)?e:mX(e,n)))).join(", ")}]`;if(we(e)){let i="";const{title:r,image:o,...a}=e;r&&(i+=`

${t(r)}

`),o&&(i+=``);const s=Object.keys(a);if(s.length>0){i+="";for(const e of s){let r=a[e];void 0!==r&&(we(r)&&(r=mX(r,n)),i+=``)}i+="
${t(e)}${t(r)}
"}return i||"{}"}return t(e)}};class vX{constructor(e){this.options={...yX,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n".toString().replace(gX,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:o}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let o=e.clientY+i;return o+t.height>window.innerHeight&&(o=+e.clientY-i-t.height),{x:r,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${r}px`}}var bX,xX,wX=n(27061);function _X(e){return _X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_X(e)}function kX(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==_X(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==_X(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===_X(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EX(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AX=$X;function $X(e){var t=this;if(t instanceof $X||(t=new $X),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},$X.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},$X.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},$X.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},$X.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new $X;if(tthis.length&&(t=this.length);for(var i=0,r=this.head;null!==r&&ithis.length&&(t=this.length);for(var i=this.length,r=this.tail;null!==r&&i>t;i--)r=r.prev;for(;null!==r&&i>e;i--,r=r.prev)n.push(r.value);return n},$X.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,r=this.head;null!==r&&i1,qX=(e,t,n)=>{const i=e[IX].get(t);if(i){const t=i.value;if(WX(e,t)){if(HX(e,i),!e[TX])return}else n&&(e[jX]&&(i.value.now=Date.now()),e[BX].unshiftNode(i));return t.value}},WX=(e,t)=>{if(!t||!t.maxAge&&!e[RX])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[RX]&&n>e[RX]},GX=e=>{if(e[NX]>e[OX])for(let t=e[BX].tail;e[NX]>e[OX]&&null!==t;){const n=t.prev;HX(e,t),t=n}},HX=(e,t)=>{if(t){const n=t.value;e[PX]&&e[PX](n.key,n.value),e[NX]-=n.length,e[IX].delete(n.key),e[BX].removeNode(t)}};class VX{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const ZX=(e,t,n,i)=>{let r=n.value;WX(e,r)&&(HX(e,n),e[TX]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};var XX=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[OX]=e.max||1/0;const t=e.length||UX;if(this[zX]="function"!=typeof t?UX:t,this[TX]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[RX]=e.maxAge||0,this[PX]=e.dispose,this[LX]=e.noDisposeOnSet||!1,this[jX]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[OX]=e||1/0,GX(this)}get max(){return this[OX]}set allowStale(e){this[TX]=!!e}get allowStale(){return this[TX]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[RX]=e,GX(this)}get maxAge(){return this[RX]}set lengthCalculator(e){"function"!=typeof e&&(e=UX),e!==this[zX]&&(this[zX]=e,this[NX]=0,this[BX].forEach((e=>{e.length=this[zX](e.value,e.key),this[NX]+=e.length}))),GX(this)}get lengthCalculator(){return this[zX]}get length(){return this[NX]}get itemCount(){return this[BX].length}rforEach(e,t){t=t||this;for(let n=this[BX].tail;null!==n;){const i=n.prev;ZX(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[BX].head;null!==n;){const i=n.next;ZX(this,e,n,t),n=i}}keys(){return this[BX].toArray().map((e=>e.key))}values(){return this[BX].toArray().map((e=>e.value))}reset(){this[PX]&&this[BX]&&this[BX].length&&this[BX].forEach((e=>this[PX](e.key,e.value))),this[IX]=new Map,this[BX]=new MX,this[NX]=0}dump(){return this[BX].map((e=>!WX(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[BX]}set(e,t,n){if((n=n||this[RX])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[zX](t,e);if(this[IX].has(e)){if(r>this[OX])return HX(this,this[IX].get(e)),!1;const o=this[IX].get(e).value;return this[PX]&&(this[LX]||this[PX](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[NX]+=r-o.length,o.length=r,this.get(e),GX(this),!0}const o=new VX(e,t,r,i,n);return o.length>this[OX]?(this[PX]&&this[PX](e,t),!1):(this[NX]+=o.length,this[BX].unshift(o),this[IX].set(e,this[BX].head),GX(this),!0)}has(e){if(!this[IX].has(e))return!1;const t=this[IX].get(e).value;return!WX(this,t)}get(e){return qX(this,e,!0)}peek(e){return qX(this,e,!1)}pop(){const e=this[BX].tail;return e?(HX(this,e),e.value):null}del(e){HX(this,this[IX].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[IX].forEach(((e,t)=>qX(this,t,!1)))}};const YX=Object.freeze({loose:!0}),JX=Object.freeze({});var QX=e=>e?"object"!=typeof e?YX:e:JX,KX={exports:{}},eY={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},tY="object"==typeof wX&&wX.env&&wX.env.NODE_DEBUG&&/\bsemver\b/i.test(wX.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=eY,o=tY,a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],u=t.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",r],[f,i]],h=(e,t,n)=>{const i=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),r=c++;o(e,r,t),u[e]=r,l[r]=t,a[r]=new RegExp(t,n?"g":void 0),s[r]=new RegExp(i,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${l[u.NUMERICIDENTIFIER]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NUMERICIDENTIFIERLOOSE]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),h("FULL",`^${l[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),h("LOOSE",`^${l[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),h("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),h("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),h("COERCERTL",l[u.COERCE],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(KX,KX.exports);var nY=KX.exports;const iY=/^[0-9]+$/,rY=(e,t)=>{const n=iY.test(e),i=iY.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:erY(t,e)};const aY=tY,{MAX_LENGTH:sY,MAX_SAFE_INTEGER:lY}=eY,{safeRe:uY,t:cY}=nY,fY=QX,{compareIdentifiers:dY}=oY;var hY=class e{constructor(t,n){if(n=fY(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>sY)throw new TypeError(`version is longer than ${sY} characters`);aY("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?uY[cY.LOOSE]:uY[cY.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>lY||this.major<0)throw new TypeError("Invalid major version");if(this.minor>lY||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>lY||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===n&&(i=[t]),0===dY(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const pY=hY;var mY=(e,t,n)=>new pY(e,n).compare(new pY(t,n));const gY=mY;const yY=mY;const vY=mY;const bY=mY;const xY=mY;const wY=mY;const _Y=(e,t,n)=>0===gY(e,t,n),kY=(e,t,n)=>0!==yY(e,t,n),EY=(e,t,n)=>vY(e,t,n)>0,AY=(e,t,n)=>bY(e,t,n)>=0,$Y=(e,t,n)=>xY(e,t,n)<0,DY=(e,t,n)=>wY(e,t,n)<=0;var SY,CY,FY,MY,OY=(e,t,n,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return _Y(e,n,i);case"!=":return kY(e,n,i);case">":return EY(e,n,i);case">=":return AY(e,n,i);case"<":return $Y(e,n,i);case"<=":return DY(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const NY=function e(){if(MY)return FY;MY=1;class t{constructor(e,n){if(n=i(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,i=n.get(t);if(i)return i;const a=this.options.loose,m=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(m,D(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(s[l.TILDETRIM],c),o("tilde trim",e),e=e.replace(s[l.CARETTRIM],f),o("caret trim",e);let g=e.split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>$(e,this.options)));a&&(g=g.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",g);const v=new Map,b=g.map((e=>new r(e,this.options)));for(const e of b){if(p(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const x=[...v.values()];return n.set(t,x),x}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>g(t,n)&&e.set.some((e=>g(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}SY=n;const i=QX,{safeRe:r,t:o}=nY,a=OY,s=tY,l=hY,u=e();return SY}(),o=tY,a=hY,{safeRe:s,t:l,comparatorTrimReplace:u,tildeTrimReplace:c,caretTrimReplace:f}=nY,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=eY,p=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every((e=>r.intersects(e,t))),r=i.pop();return n},y=(e,t)=>(o("comp",e,t),e=w(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=k(e,t),o("xrange",e),e=A(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>x(e,t))).join(" "),x=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,i,r,a)=>{let s;return o("tilde",e,t,n,i,r,a),v(n)?s="":v(i)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(r)?s=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${i}.${r}-${a} <${n}.${+i+1}.0-0`):s=`>=${n}.${i}.${r} <${n}.${+i+1}.0-0`,o("tilde return",s),s}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,a,s)=>{let l;return o("caret",e,t,n,r,a,s),v(n)?l="":v(r)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${r}.0${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${i} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===r?`>=${n}.${r}.${a}-${s} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}-${s} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===r?`>=${n}.${r}.${a}${i} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},k=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>E(e,t))).join(" ")),E=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,i,r,a,s,l)=>{o("xRange",e,n,i,r,a,s,l);const u=v(r),c=u||v(a),f=c||v(s),d=f;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(c&&(a=0),s=0,">"===i?(i=">=",c?(r=+r+1,a=0,s=0):(a=+a+1,s=0)):"<="===i&&(i="<",c?r=+r+1:a=+a+1),"<"===i&&(l="-0"),n=`${i+r}.${a}.${s}${l}`):c?n=`>=${r}.0.0${l} <${+r+1}.0.0-0`:f&&(n=`>=${r}.${a}.0${l} <${r}.${+a+1}.0-0`),o("xRange return",n),n}))},A=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),$=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,n,i,r,o,a,s,l,u,c,f,d,h)=>`${n=v(i)?"":v(r)?`>=${i}.0.0${e?"-0":""}`:v(o)?`>=${i}.${r}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(f)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${f}-${d}`:e?`<${u}.${c}.${+f+1}-0`:`<=${l}`}`.trim(),S=(e,t,n)=>{for(let n=0;n0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return FY}();var zY=(e,t,n)=>{try{t=new NY(t,n)}catch(e){return!1}return t.test(e)},TY=EX(zY),RY='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n';function PY(e,...t){for(const n of t)LY(e,n);return e}function LY(e,t){for(const n of Object.keys(t))Ee(e,n,t[n],!0)}function BY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function IY(e){for(var t=1;te,"vega-lite":(e,t)=>qY.compile(e,{config:t}).spec},YY='\n\n \n \n \n',JY="chart-wrapper";function QY(e,t,n,i){const r=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(r+e+o),a.document.title=`${VY[i]} JSON Source`}function KY(e,t){if(e.$schema){const n=hZ(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${VY[n.library]}, but mode argument sets ${VY[t]??t}.`);const i=n.library;return TY(ZY[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${VY[i]} ${n.version}, but the current version of ${VY[i]} is v${ZY[i]}.`),i}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}function eJ(e){return(t=e)&&"load"in t?e:UY.loader(e);var t}async function tJ(e,t,n={}){let i,r;yt(t)?(r=eJ(n.loader),i=JSON.parse(await r.load(t))):i=t;const o=function(e){const t=e.usermeta?.embedOptions??{};return yt(t.defaultStyle)&&(t.defaultStyle=!1),t}(i),a=o.loader;r&&!a||(r=eJ(n.loader??a));const s=await nJ(o,r),l=await nJ(n,r),u=IY(IY({},PY(l,s)),{},{config:ke(l.config??{},s.config??{})});return await async function(e,t,n={},i){const r=n.theme?ke(v[n.theme],n.config??{}):n.config,o=dt(n.actions)?n.actions:PY({},GY,n.actions??{}),a=IY(IY({},HY),n.i18n),s=n.renderer??"canvas",l=n.logLevel??UY.Warn,u=n.downloadFileName??"visualization",c="string"==typeof e?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(!1!==n.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:i}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(c);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===n.defaultStyle||!0===n.defaultStyle?RY.toString():n.defaultStyle,i.appendChild(t)}}const f=KY(t,n.mode);let d=XY[f](t,r);if("vega-lite"===f&&d.$schema){const e=hZ(d.$schema);TY(ZY.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${ZY.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(o){const e=document.createElement("div");e.classList.add(JY),c.appendChild(e),h=e}const p=n.patch;if(p&&(d=p instanceof Function?p(d):P(d,p,!0,!1).newDocument),n.formatLocale&&UY.formatLocale(n.formatLocale),n.timeFormatLocale&&UY.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const e in n.expressionFunctions){const t=n.expressionFunctions[e];"fn"in t?UY.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&UY.expressionFunction(e,t)}const{ast:m}=n,g=UY.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||UY.View)(g,IY({loader:i,logLevel:l,renderer:s},m?{expr:UY.expressionInterpreter??n.expr??rN}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new vX(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let b,{hover:x}=n;if(void 0===x&&(x="vega"===f),x){const{hoverSet:e,updateSet:t}="boolean"==typeof x?{}:x;y.hover(e,t)}if(n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding)),await y.initialize(h,n.bind).runAsync(),!1!==o){let e=c;if(!1!==n.defaultStyle||n.forceActionsMenu){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML=YY,t.append(n),b=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",b)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===o||!1!==o.export)for(const e of["svg","png"])if(!0===o||!0===o.export||o.export[e]){const t=a[`${e.toUpperCase()}_ACTION`],r=document.createElement("a"),o=we(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;r.text=t,r.href="#",r.target="_blank",r.download=`${u}.${e}`,r.addEventListener("mousedown",(async function(t){t.preventDefault();const n=await y.toImageURL(e,o);this.href=n})),i.append(r)}if(!0===o||!1!==o.source){const e=document.createElement("a");e.text=a.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){QY(J()(t),n.sourceHeader??"",n.sourceFooter??"",f),e.preventDefault()})),i.append(e)}if("vega-lite"===f&&(!0===o||!1!==o.compiled)){const e=document.createElement("a");e.text=a.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){QY(J()(d),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===o||!1!==o.editor){const e=n.editorUrl??"https://vega.github.io/editor/",o=document.createElement("a");o.text=a.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===i&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(i.postMessage(n,r),setTimeout(e,250),o-=1)}),250)}(window,e,{config:r,mode:f,renderer:s,spec:J()(t)}),n.preventDefault()})),i.append(o)}}return{view:y,spec:t,vgSpec:d,finalize:function(){b&&document.removeEventListener("click",b),y.finalize()},embedOptions:n}}(e,i,u,r)}async function nJ(e,t){const n=yt(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=yt(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return IY(IY(IY({},e),i?{patch:i}:{}),n?{config:n}:{})}}}]);