/*! For license information please see 8548.bundle.js.LICENSE.txt */ (self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[8548],{66471:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var a=o[r];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},56440:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},o={key:i,value:e[i]};return n(r,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n{"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:()=>Q2,default:()=>s3,guessMode:()=>o3,vega:()=>V2,vegaLite:()=>X2,version:()=>Y2});var i={};n.r(i),n.d(i,{JsonPatchError:()=>O,_areEquals:()=>U,applyOperation:()=>P,applyPatch:()=>L,applyReducer:()=>B,deepClone:()=>N,getValueByPointer:()=>R,validate:()=>I,validator:()=>j});var r={};n.r(r),n.d(r,{compare:()=>J,generate:()=>V,observe:()=>Y,unobserve:()=>G});var o={};n.r(o),n.d(o,{aggregate:()=>jl,bin:()=>Il,collect:()=>ql,compare:()=>Wl,countpattern:()=>Gl,cross:()=>Yl,density:()=>Ql,dotbin:()=>nu,expression:()=>iu,extent:()=>ou,facet:()=>su,field:()=>lu,filter:()=>cu,flatten:()=>fu,fold:()=>du,formula:()=>hu,generate:()=>pu,impute:()=>yu,joinaggregate:()=>vu,kde:()=>bu,key:()=>xu,load:()=>wu,lookup:()=>Eu,multiextent:()=>$u,multivalues:()=>Du,params:()=>Mu,pivot:()=>Cu,prefacet:()=>Fu,project:()=>Ou,proxy:()=>Nu,quantile:()=>Tu,relay:()=>zu,sample:()=>Ru,sequence:()=>Pu,sieve:()=>Lu,subflow:()=>au,timeunit:()=>Bu,tupleindex:()=>Iu,values:()=>Uu,window:()=>Yu});var a={};n.r(a),n.d(a,{interpolate:()=>xd,interpolateArray:()=>dd,interpolateBasis:()=>ed,interpolateBasisClosed:()=>td,interpolateCubehelix:()=>pp,interpolateCubehelixLong:()=>mp,interpolateDate:()=>pd,interpolateDiscrete:()=>xh,interpolateHcl:()=>tp,interpolateHclLong:()=>np,interpolateHsl:()=>Oh,interpolateHslLong:()=>Nh,interpolateHue:()=>_h,interpolateLab:()=>Kh,interpolateNumber:()=>md,interpolateNumberArray:()=>cd,interpolateObject:()=>gd,interpolateRgb:()=>ad,interpolateRgbBasis:()=>ld,interpolateRgbBasisClosed:()=>ud,interpolateRound:()=>_d,interpolateString:()=>bd,interpolateTransformCss:()=>Dh,interpolateTransformSvg:()=>Sh,interpolateZoom:()=>Ch,piecewise:()=>uh,quantize:()=>gp});var s={};n.r(s),n.d(s,{bound:()=>Gx,identifier:()=>Xx,mark:()=>Jx,overlap:()=>Qx,render:()=>r_,viewlayout:()=>$_});var l={};n.r(l),n.d(l,{axisticks:()=>D_,datajoin:()=>S_,encode:()=>C_,legendentries:()=>F_,linkpath:()=>R_,pie:()=>I_,scale:()=>W_,sortitems:()=>V_,stack:()=>K_});var u={};n.r(u),n.d(u,{contour:()=>z$,geojson:()=>L$,geopath:()=>B$,geopoint:()=>j$,geoshape:()=>I$,graticule:()=>U$,heatmap:()=>q$,isocontour:()=>$$,kde2d:()=>O$,projection:()=>H$});var c={};n.r(c),n.d(c,{force:()=>jA});var f={};n.r(f),n.d(f,{nest:()=>WD,pack:()=>JD,partition:()=>ZD,stratify:()=>KD,tree:()=>nS,treelinks:()=>iS,treemap:()=>aS});var d={};n.r(d),n.d(d,{label:()=>SS});var h={};n.r(h),n.d(h,{loess:()=>CS,regression:()=>OS});var p={};n.r(p),n.d(p,{voronoi:()=>lM});var m={};n.r(m),n.d(m,{wordcloud:()=>kM});var g={};n.r(g),n.d(g,{crossfilter:()=>CM,resolvefilter:()=>FM});var y={};n.r(y),n.d(y,{Bounds:()=>Ng,CanvasHandler:()=>cb,CanvasRenderer:()=>mb,DATE:()=>mi,DAY:()=>gi,DAYOFYEAR:()=>yi,Dataflow:()=>ds,Debug:()=>be,Error:()=>ge,EventStream:()=>Za,Gradient:()=>Pm,GroupItem:()=>zg,HOURS:()=>vi,Handler:()=>Gv,Info:()=>ve,Item:()=>Tg,MILLISECONDS:()=>_i,MINUTES:()=>bi,MONTH:()=>hi,Marks:()=>Cv,MultiPulse:()=>ls,None:()=>me,Operator:()=>Xa,Parameters:()=>Ga,Pulse:()=>rs,QUARTER:()=>di,RenderType:()=>ax,Renderer:()=>Vv,ResourceLoader:()=>Rg,SECONDS:()=>xi,SVGHandler:()=>yb,SVGRenderer:()=>qb,SVGStringRenderer:()=>ix,Scenegraph:()=>Lv,TIME_UNITS:()=>wi,Transform:()=>ps,View:()=>pT,WEEK:()=>pi,Warn:()=>ye,YEAR:()=>fi,accessor:()=>K,accessorFields:()=>te,accessorName:()=>ee,array:()=>Ge,ascending:()=>Qe,bandwidthNRD:()=>Cs,bin:()=>Fs,bootstrapCI:()=>Ts,boundClip:()=>px,boundContext:()=>iy,boundItem:()=>Fv,boundMark:()=>Nv,boundStroke:()=>Bg,changeset:()=>Wa,clampRange:()=>Ye,codegenExpression:()=>uF,compare:()=>Je,constant:()=>tt,cumulativeLogNormal:()=>Xs,cumulativeNormal:()=>qs,cumulativeUniform:()=>tl,dayofyear:()=>Mi,debounce:()=>nt,defaultLocale:()=>na,definition:()=>gs,densityLogNormal:()=>Vs,densityNormal:()=>Us,densityUniform:()=>el,domChild:()=>Uv,domClear:()=>qv,domCreate:()=>jv,domFind:()=>Iv,dotbin:()=>zs,error:()=>oe,expressionFunction:()=>hN,extend:()=>it,extent:()=>rt,extentIndex:()=>ot,falsy:()=>he,fastmap:()=>ut,field:()=>se,flush:()=>ct,font:()=>wv,fontFamily:()=>_v,fontSize:()=>gv,format:()=>Aa,formatLocale:()=>Vo,formats:()=>Da,hasOwnProperty:()=>st,id:()=>le,identity:()=>ue,inferType:()=>ba,inferTypes:()=>xa,ingest:()=>La,inherits:()=>ft,inrange:()=>dt,interpolate:()=>am,interpolateColors:()=>im,interpolateRange:()=>nm,intersect:()=>ux,intersectBoxLine:()=>py,intersectPath:()=>cy,intersectPoint:()=>fy,intersectRule:()=>hy,isArray:()=>_e,isBoolean:()=>ht,isDate:()=>pt,isFunction:()=>Ve,isIterable:()=>mt,isNumber:()=>gt,isObject:()=>we,isRegExp:()=>yt,isString:()=>vt,isTuple:()=>za,key:()=>bt,lerp:()=>xt,lineHeight:()=>yv,loader:()=>Ca,locale:()=>ta,logger:()=>xe,lruCache:()=>wt,markup:()=>zb,merge:()=>kt,mergeConfig:()=>Ee,multiLineOffset:()=>bv,one:()=>fe,pad:()=>$t,panLinear:()=>ze,panLog:()=>Re,panPow:()=>Pe,panSymlog:()=>Le,parse:()=>qL,parseExpression:()=>aF,parseSelector:()=>OT,path:()=>Jc,pathCurves:()=>Bm,pathEqual:()=>yx,pathParse:()=>Hm,pathRectangle:()=>mg,pathRender:()=>ng,pathSymbols:()=>ag,pathTrail:()=>gg,peek:()=>De,point:()=>Hv,projection:()=>h$,quantileLogNormal:()=>Js,quantileNormal:()=>Ws,quantileUniform:()=>nl,quantiles:()=>Ss,quantizeInterpolator:()=>rm,quarter:()=>We,quartiles:()=>Ms,random:()=>Os,randomInteger:()=>Ps,randomKDE:()=>Gs,randomLCG:()=>Rs,randomLogNormal:()=>Qs,randomMixture:()=>Zs,randomNormal:()=>Hs,randomUniform:()=>il,read:()=>Ma,regressionConstant:()=>rl,regressionExp:()=>fl,regressionLinear:()=>ul,regressionLoess:()=>vl,regressionLog:()=>cl,regressionPoly:()=>pl,regressionPow:()=>dl,regressionQuad:()=>hl,renderModule:()=>lx,repeat:()=>Et,resetDefaultLocale:()=>ia,resetSVGClipId:()=>Fg,resetSVGDefIds:()=>vx,responseType:()=>Sa,runtimeContext:()=>kN,sampleCurve:()=>wl,sampleLogNormal:()=>Ys,sampleNormal:()=>Is,sampleUniform:()=>Ks,scale:()=>Gp,sceneEqual:()=>gx,sceneFromJSON:()=>Rv,scenePickVisit:()=>$y,sceneToJSON:()=>zv,sceneVisit:()=>Ey,sceneZOrder:()=>ky,scheme:()=>cm,serializeXML:()=>Rb,setRandom:()=>Ns,span:()=>At,splitAccessPath:()=>ae,stringValue:()=>Dt,textMetrics:()=>cv,timeBin:()=>pr,timeFloor:()=>Hi,timeFormatLocale:()=>Ko,timeInterval:()=>Qi,timeOffset:()=>er,timeSequence:()=>ir,timeUnitSpecifier:()=>Ai,timeUnits:()=>Ei,toBoolean:()=>St,toDate:()=>Ct,toNumber:()=>Se,toSet:()=>Ot,toString:()=>Ft,transform:()=>ys,transforms:()=>ms,truncate:()=>Nt,truthy:()=>de,tupleid:()=>Ra,typeParsers:()=>ga,utcFloor:()=>Vi,utcInterval:()=>Zi,utcOffset:()=>tr,utcSequence:()=>rr,utcdayofyear:()=>zi,utcquarter:()=>He,utcweek:()=>Ri,version:()=>WL,visitArray:()=>Tt,week:()=>Ci,writeConfig:()=>$e,zero:()=>ce,zoomLinear:()=>je,zoomLog:()=>Ie,zoomPow:()=>Ue,zoomSymlog:()=>qe});var v={};n.r(v),n.d(v,{accessPathDepth:()=>YB,accessPathWithDatum:()=>IB,compile:()=>h0,contains:()=>_B,deepEqual:()=>hB,deleteNestedProperty:()=>BB,duplicate:()=>pB,entries:()=>zB,every:()=>kB,fieldIntersection:()=>FB,flatAccessWithDatum:()=>UB,getFirstDefined:()=>VB,hasIntersection:()=>MB,hash:()=>bB,internalField:()=>ZB,isBoolean:()=>RB,isEmpty:()=>OB,isEqual:()=>DB,isInternalField:()=>KB,isNullOrFalse:()=>xB,isNumeric:()=>tj,keys:()=>NB,logicalExpr:()=>LB,mergeDeep:()=>EB,never:()=>mB,normalize:()=>qV,normalizeAngle:()=>ej,omit:()=>yB,pick:()=>gB,prefixGenerator:()=>CB,removePathFromField:()=>GB,replaceAll:()=>HB,replacePathInField:()=>WB,resetIdCounter:()=>QB,setEqual:()=>SB,some:()=>wB,stringify:()=>vB,titleCase:()=>jB,unique:()=>AB,uniqueId:()=>JB,vals:()=>TB,varName:()=>PB,version:()=>p0});var b={};n.r(b),n.d(b,{carbong10:()=>h1,carbong100:()=>m1,carbong90:()=>p1,carbonwhite:()=>d1,dark:()=>v0,excel:()=>x0,fivethirtyeight:()=>$0,ggplot2:()=>D0,googlecharts:()=>V0,latimes:()=>N0,powerbi:()=>s1,quartz:()=>R0,urbaninstitute:()=>W0,version:()=>g1,vox:()=>L0});var x,_=(x=function(e,t){return x=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])},x(e,t)},function(e,t){function n(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),w=Object.prototype.hasOwnProperty;function k(e,t){return w.call(e,t)}function E(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0}function D(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function S(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function M(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 O("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 O("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 O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=T[t.op].call(t,l,d,e)).test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u0)throw new O('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 O("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 O("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)&&M(e.value))throw new O("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 O("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 O("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 O("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 O("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)L($(t),$(e),n||!0);else{n=n||j;for(var i=0;i0&&(e.patches=[],e.callback&&e.callback(i)),i}function X(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=E(t),a=E(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!k(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+"/"+D(f),value:$(u)}),n.push({op:"remove",path:i+"/"+D(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)?X(u,c,n,i+"/"+D(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+D(f),value:$(u)}),n.push({op:"replace",path:i+"/"+D(f),value:$(c)}))}}if(s||o.length!=a.length)for(l=0;lfunction(t){return t[e]},re=e=>{const t=e.length;return function(n){for(let i=0;ii&&u(),s=i=r+1):"]"===o&&(s||oe("Access path missing open bracket: "+e),s>0&&u(),s=0,i=r+1):r>i?u():i=r+1}return s&&oe("Access path missing closing bracket: "+e),a&&oe("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function se(e,t,n){const i=ae(e);return e=1===i.length?i[0]:e,K((n&&n.get||ne)(i),[e],t||e)}const le=se("id"),ue=K((e=>e),[],"identity"),ce=K((()=>0),[],"zero"),fe=K((()=>1),[],"one"),de=K((()=>!0),[],"true"),he=K((()=>!1),[],"false");function pe(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const me=0,ge=1,ye=2,ve=3,be=4;function xe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pe,i=e||me;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=ge&&n(t||"error","ERROR",arguments),this},warn(){return i>=ye&&n(t||"warn","WARN",arguments),this},info(){return i>=ve&&n(t||"log","INFO",arguments),this},debug(){return i>=be&&n(t||"log","DEBUG",arguments),this}}}var _e=Array.isArray;function we(e){return e===Object(e)}const ke=e=>"__proto__"!==e;function Ee(){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;$e(e,n,t[n],i)}return e}),{})}function $e(e,t,n,i){if(!ke(t))return;let r,o;if(we(n)&&!_e(n))for(r in o=we(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?$e(o,r,n[r]):ke(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 De(e){return e[e.length-1]}function Se(e){return null==e||""===e?null:+e}const Me=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)),Oe=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Ne=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function Te(e,t,n,i){const r=n(e[0]),o=n(De(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function ze(e,t){return Te(e,t,Se,ue)}function Re(e,t){var n=Math.sign(e[0]);return Te(e,t,Ce(n),Me(n))}function Pe(e,t,n){return Te(e,t,Ne(n),Ne(1/n))}function Le(e,t,n){return Te(e,t,Fe(n),Oe(n))}function Be(e,t,n,i,r){const o=i(e[0]),a=i(De(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}function je(e,t,n){return Be(e,t,n,Se,ue)}function Ie(e,t,n){const i=Math.sign(e[0]);return Be(e,t,n,Ce(i),Me(i))}function Ue(e,t,n,i){return Be(e,t,n,Ne(i),Ne(1/i))}function qe(e,t,n,i){return Be(e,t,n,Fe(i),Oe(i))}function We(e){return 1+~~(new Date(e).getMonth()/3)}function He(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ge(e){return null!=e?_e(e)?e:[e]:[]}function Ye(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 Xe="descending";function Je(e,t,n){n=n||{},t=Ge(t)||[];const i=[],r=[],o={},a=n.comparator||Ze;return Ge(e).forEach(((e,a)=>{null!=e&&(i.push(t[a]===Xe?-1:1),r.push(e=Ve(e)?e:se(e,null,n)),(te(e)||[]).forEach((e=>o[e]=1)))})),0===r.length?null:K(a(r,i),Object.keys(o))}const Qe=(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),Ze=(e,t)=>1===e.length?Ke(e[0],t[0]):et(e,t,e.length),Ke=(e,t)=>function(n,i){return Qe(e(n),e(i))*t},et=(e,t,n)=>(t.push(0),function(i,r){let o,a=0,s=-1;for(;0===a&&++se}function nt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout((()=>(t(i),n=null)),e)}}function it(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 ot(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]===lt&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=lt),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===lt||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 ct(e,t,n,i,r,o){if(!n&&0!==n)return o;const a=+n;let s,l=e[0],u=De(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||ne,o=e=>r(t?[e]:ae(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=>st(t,e)||st(n,e),get:e=>st(t,e)?t[e]:st(n,e)?o(e,n[e]):void 0,set:(e,n)=>st(t,e)?t[e]=n:o(e,n)}}function kt(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 $t(e,t,n,i){const r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?Et(r,a)+o:"center"===i?Et(r,~~(a/2))+o+Et(r,Math.ceil(a/2)):o+Et(r,a)}function At(e){return e&&De(e)-e[0]||0}function Dt(e){return _e(e)?"["+e.map(Dt)+"]":we(e)||vt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function St(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)}const Mt=e=>gt(e)||pt(e)?e:Date.parse(e);function Ct(e,t){return t=t||Mt,null==e||""===e?null:t(e)}function Ft(e){return null==e||""===e?null:e+""}function Ot(e){const t={},n=e.length;for(let i=0;i=o?l=!0:(i=e.charCodeAt(a++))===Lt?u=!0:i===Bt&&(u=!0,e.charCodeAt(a)===Lt&&++a),e.slice(r+1,t-1).replace(/""/g,'"')}for(;a9999?"+"+Ut(t,6):Ut(t,4))+"-"+Ut(e.getUTCMonth()+1,2)+"-"+Ut(e.getUTCDate(),2)+(o?"T"+Ut(n,2)+":"+Ut(i,2)+":"+Ut(r,2)+"."+Ut(o,3)+"Z":r?"T"+Ut(n,2)+":"+Ut(i,2)+":"+Ut(r,2)+"Z":i||n?"T"+Ut(n,2)+":"+Ut(i,2)+"Z":"")}(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}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=jt(e);return function(i,r){return t(n(i),r,e)}}(e,t):jt(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 Wt(e){return e}function Ht(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=Yt(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 Yt(e,t){var n=function(e){if(null==e)return Wt;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=Qt?10:o>=Zt?5:o>=Kt?2:1;let s,l,u;return r<0?(u=Math.pow(10,-r)/a,s=Math.round(e*u),l=Math.round(t*u),s/ut&&--l,u=-u):(u=Math.pow(10,r)*a,s=Math.round(e/u),l=Math.round(t/u),s*ut&&--l),l0))return[];if((e=+e)==(t=+t))return[e];const i=t=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let e=0;e=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sn(e){if(!(t=an.exec(e)))throw new Error("invalid format: "+e);var t;return new ln({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ln(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function un(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function cn(e){return(e=un(Math.abs(e)))?e[1]:NaN}function fn(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(cn(t)/3)))-cn(Math.abs(e)))}function dn(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,cn(t)-cn(e))+1}function hn(e){return Math.max(0,-cn(Math.abs(e)))}function pn(e,t){var n=un(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}sn.prototype=ln.prototype,ln.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const mn={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>pn(100*e,t),r:pn,s:function(e,t){var n=un(e,t);if(!n)return e+"";var i=n[0],r=n[1],o=r-(on=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+un(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function gn(e){return e}var yn,vn,bn,xn=Array.prototype.map,_n=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function wn(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?gn:(t=xn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,o=[],a=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(e.substring(r-=s,r+s)),!((l+=s+1)>i));)s=t[a=(a+1)%t.length];return o.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?gn:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(xn.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=sn(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,y=e.trim,v=e.type;"n"===v?(m=!0,v="g"):mn[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===d?o:/[%p]/.test(v)?l:"",_=mn[v],w=/[defgprs%]/.test(v);function k(e){var r,o,l,d=b,k=x;if("c"===v)k=_(e)+k,e="";else{var E=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:_(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==f&&(E=!1),d=(E?"("===f?f:u:"-"===f||"("===f?"":f)+d,k=("s"===v?_n[8+on/3]:"")+k+(E&&"("===f?")":""),w)for(r=-1,o=e.length;++r(l=e.charCodeAt(r))||l>57){k=(46===l?a+e.slice(r+1):e.slice(r))+k,e=e.slice(0,r);break}}m&&!h&&(e=i(e,1/0));var $=d.length+e.length+k.length,A=$>1)+d+e+k+A.slice($);break;default:e=A+d+e+k}return s(e)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return e+""},k}return{format:f,formatPrefix:function(e,t){var n=f(((e=sn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(cn(t)/3))),r=Math.pow(10,-i),o=_n[8+i/3];return function(e){return n(r*e)+o}}}}yn=wn({thousands:",",grouping:[3],currency:["$",""]}),vn=yn.format,bn=yn.formatPrefix;const kn=new Date,En=new Date;function $n(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n0))return a;let s;do{a.push(s=new Date(+n)),t(n,o),e(n)}while(s$n((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););})),n&&(r.count=(t,i)=>(kn.setTime(+t),En.setTime(+i),e(kn),e(En),Math.floor(n(kn,En))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e==0:t=>r.count(0,t)%e==0):r:null)),r}const An=1e3,Dn=6e4,Sn=36e5,Mn=864e5,Cn=6048e5,Fn=31536e6,On=$n((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Dn)/Mn),(e=>e.getDate()-1)),Nn=(On.range,$n((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Mn),(e=>e.getUTCDate()-1))),Tn=(Nn.range,$n((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Mn),(e=>Math.floor(e/Mn))));function zn(e){return $n((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Dn)/Cn))}Tn.range;const Rn=zn(0),Pn=zn(1),Ln=zn(2),Bn=zn(3),jn=zn(4),In=zn(5),Un=zn(6);function qn(e){return $n((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/Cn))}Rn.range,Pn.range,Ln.range,Bn.range,jn.range,In.range,Un.range;const Wn=qn(0),Hn=qn(1),Gn=qn(2),Yn=qn(3),Vn=qn(4),Xn=qn(5),Jn=qn(6),Qn=(Wn.range,Hn.range,Gn.range,Yn.range,Vn.range,Xn.range,Jn.range,$n((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear())));Qn.every=e=>isFinite(e=Math.floor(e))&&e>0?$n((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,Qn.range;const Zn=$n((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));Zn.every=e=>isFinite(e=Math.floor(e))&&e>0?$n((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,Zn.range;const Kn=$n((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth())),ei=(Kn.range,$n((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()))),ti=(ei.range,$n((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*An-e.getMinutes()*Dn)}),((e,t)=>{e.setTime(+e+t*Sn)}),((e,t)=>(t-e)/Sn),(e=>e.getHours()))),ni=(ti.range,$n((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*Sn)}),((e,t)=>(t-e)/Sn),(e=>e.getUTCHours()))),ii=(ni.range,$n((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*An)}),((e,t)=>{e.setTime(+e+t*Dn)}),((e,t)=>(t-e)/Dn),(e=>e.getMinutes()))),ri=(ii.range,$n((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Dn)}),((e,t)=>(t-e)/Dn),(e=>e.getUTCMinutes()))),oi=(ri.range,$n((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*An)}),((e,t)=>(t-e)/An),(e=>e.getUTCSeconds()))),ai=(oi.range,$n((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e)));function si(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function li(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function ui(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r>>1;n(e[t],i)<0?r=t+1:o=t}while(rsi(e(t),n),i=(t,n)=>e(t)-n):(t=e===si||e===li?e:ci,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r>>1;n(e[t],i)<=0?r=t+1:o=t}while(r(e=Math.floor(e),isFinite(e)&&e>0?e>1?$n((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):ai:null),ai.range;const fi="year",di="quarter",hi="month",pi="week",mi="date",gi="day",yi="dayofyear",vi="hours",bi="minutes",xi="seconds",_i="milliseconds",wi=[fi,di,hi,pi,mi,gi,yi,vi,bi,xi,_i],ki=wi.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function Ei(e){const t=Ge(e).slice(),n={};return t.length||oe("Missing time unit."),t.forEach((e=>{st(ki,e)?n[e]=1:oe(`Invalid time unit: ${e}.`)})),(n[pi]||n[gi]?1:0)+(n[di]||n[hi]||n[mi]?1:0)+(n[yi]?1:0)>1&&oe(`Incompatible time units: ${e}`),t.sort(((e,t)=>ki[e]-ki[t])),t}const $i={[fi]:"%Y ",[di]:"Q%q ",[hi]:"%b ",[mi]:"%d ",[pi]:"W%U ",[gi]:"%a ",[yi]:"%j ",[vi]:"%H:00",[bi]:"00:%M",[xi]:":%S",[_i]:".%L",[`${fi}-${hi}`]:"%Y-%m ",[`${fi}-${hi}-${mi}`]:"%Y-%m-%d ",[`${vi}-${bi}`]:"%H:%M"};function Ai(e,t){const n=it({},$i,t),i=Ei(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 Di=new Date;function Si(e){return Di.setFullYear(e),Di.setMonth(0),Di.setDate(1),Di.setHours(0,0,0,0),Di}function Mi(e){return Fi(new Date(e))}function Ci(e){return Oi(new Date(e))}function Fi(e){return On.count(Si(e.getFullYear())-1,e)}function Oi(e){return Rn.count(Si(e.getFullYear())-1,e)}function Ni(e){return Si(e).getDay()}function Ti(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 zi(e){return Pi(new Date(e))}function Ri(e){return Li(new Date(e))}function Pi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Nn.count(t-1,e)}function Li(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Wn.count(t-1,e)}function Bi(e){return Di.setTime(Date.UTC(e,0,1)),Di.getUTCDay()}function ji(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 Ii(e,t,n,i,r){const o=t||1,a=De(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=Ot(e),c=u[fi]?s(fi):tt(2012),f=u[hi]?s(hi):u[di]?s(di):ce,d=u[pi]&&u[gi]?s(gi,1,pi+gi):u[pi]?s(pi,1):u[gi]?s(gi,1):u[mi]?s(mi,1):u[yi]?s(yi,1):fe,h=u[vi]?s(vi):ce,p=u[bi]?s(bi):ce,m=u[xi]?s(xi):ce,g=u[_i]?s(_i):ce;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 Ui(e,t,n){return t+7*e-(n+6)%7}const qi={[fi]:e=>e.getFullYear(),[di]:e=>Math.floor(e.getMonth()/3),[hi]:e=>e.getMonth(),[mi]:e=>e.getDate(),[vi]:e=>e.getHours(),[bi]:e=>e.getMinutes(),[xi]:e=>e.getSeconds(),[_i]:e=>e.getMilliseconds(),[yi]:e=>Fi(e),[pi]:e=>Oi(e),[pi+gi]:(e,t)=>Ui(Oi(e),e.getDay(),Ni(t)),[gi]:(e,t)=>Ui(1,e.getDay(),Ni(t))},Wi={[di]:e=>3*e,[pi]:(e,t)=>Ui(e,0,Ni(t))};function Hi(e,t){return Ii(e,t||1,qi,Wi,Ti)}const Gi={[fi]:e=>e.getUTCFullYear(),[di]:e=>Math.floor(e.getUTCMonth()/3),[hi]:e=>e.getUTCMonth(),[mi]:e=>e.getUTCDate(),[vi]:e=>e.getUTCHours(),[bi]:e=>e.getUTCMinutes(),[xi]:e=>e.getUTCSeconds(),[_i]:e=>e.getUTCMilliseconds(),[yi]:e=>Pi(e),[pi]:e=>Li(e),[gi]:(e,t)=>Ui(1,e.getUTCDay(),Bi(t)),[pi+gi]:(e,t)=>Ui(Li(e),e.getUTCDay(),Bi(t))},Yi={[di]:e=>3*e,[pi]:(e,t)=>Ui(e,0,Bi(t))};function Vi(e,t){return Ii(e,t||1,Gi,Yi,ji)}const Xi={[fi]:Qn,[di]:Kn.every(3),[hi]:Kn,[pi]:Rn,[mi]:On,[gi]:On,[yi]:On,[vi]:ti,[bi]:ii,[xi]:oi,[_i]:ai},Ji={[fi]:Zn,[di]:ei.every(3),[hi]:ei,[pi]:Wn,[mi]:Nn,[gi]:Nn,[yi]:Nn,[vi]:ni,[bi]:ri,[xi]:oi,[_i]:ai};function Qi(e){return Xi[e]}function Zi(e){return Ji[e]}function Ki(e,t,n){return e?e.offset(t,n):void 0}function er(e,t,n){return Ki(Qi(e),t,n)}function tr(e,t,n){return Ki(Zi(e),t,n)}function nr(e,t,n,i){return e?e.range(t,n,i):void 0}function ir(e,t,n,i){return nr(Qi(e),t,n,i)}function rr(e,t,n,i){return nr(Zi(e),t,n,i)}const or=31536e6,ar=[fi,hi,mi,vi,bi,xi,_i],sr=ar.slice(0,-1),lr=sr.slice(0,-1),ur=lr.slice(0,-1),cr=ur.slice(0,-1),fr=[fi,hi],dr=[fi],hr=[[sr,1,1e3],[sr,5,5e3],[sr,15,15e3],[sr,30,3e4],[lr,1,6e4],[lr,5,3e5],[lr,15,9e5],[lr,30,18e5],[ur,1,36e5],[ur,3,108e5],[ur,6,216e5],[ur,12,432e5],[cr,1,864e5],[[fi,pi],1,6048e5],[fr,1,2592e6],[fr,3,7776e6],[dr,1,or]];function pr(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(At(t))/n;let r,o,a=ui((e=>e[2])).right(hr,i);return a===hr.length?(r=dr,o=rn(t[0]/or,t[1]/or,n)):a?(a=hr[i/hr[a-1][2]=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:jo,s:Io,S:ao,u:so,U:lo,V:co,w:fo,W:ho,x:null,X:null,y:po,Y:go,Z:vo,"%":Bo},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:bo,e:bo,f:Eo,g:zo,G:Po,H:xo,I:_o,j:wo,L:ko,m:$o,M:Ao,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:jo,s:Io,S:Do,u:So,U:Mo,V:Fo,w:Oo,W:No,x:null,X:null,y:To,Y:Ro,Z:Lo,"%":Bo},_={a:function(e,t,n){var i=h.exec(t.slice(n));return i?(e.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=f.exec(t.slice(n));return i?(e.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return E(e,t,n,i)},d:Ur,e:Ur,f:Vr,g:Lr,G:Pr,H:Wr,I:Wr,j:qr,L:Yr,m:Ir,M:Hr,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:jr,Q:Jr,s:Qr,S:Gr,u:Nr,U:Tr,V:zr,w:Or,W:Rr,x:function(e,t,i){return E(e,n,t,i)},X:function(e,t,n){return E(e,i,t,n)},y:Lr,Y:Pr,Z:Br,"%":Xr};function w(e,t){return function(n){var i,r,o,a=[],s=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=gr(yr(o.y,0,1))).getUTCDay(),i=r>4||0===r?Hn.ceil(i):Hn(i),i=Nn.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=mr(yr(o.y,0,1))).getDay(),i=r>4||0===r?Pn.ceil(i):Pn(i),i=On.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?gr(yr(o.y,0,1)).getUTCDay():mr(yr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,gr(o)):mr(o)}}function E(e,t,n,i){for(var r,o,a=0,s=t.length,l=n.length;a=l)return-1;if(37===(r=t.charCodeAt(a++))){if(r=t.charAt(a++),!(o=_[r in Er?t.charAt(a++):r])||(i=o(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=w(n,b),b.X=w(i,b),b.c=w(t,b),x.x=w(n,x),x.X=w(i,x),x.c=w(t,x),{format:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}var br,xr,_r,wr,kr,Er={"-":"",_:" ",0:"0"},$r=/^\s*\d+/,Ar=/^%/,Dr=/[\\^$*+?|[\]().{}]/g;function Sr(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",o=r.length;return i+(o[e.toLowerCase(),t])))}function Or(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function Nr(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function Tr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function zr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Rr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function Pr(e,t,n){var i=$r.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function Lr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Br(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function jr(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Ir(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function Ur(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function qr(e,t,n){var i=$r.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function Wr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function Hr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function Gr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function Yr(e,t,n){var i=$r.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function Vr(e,t,n){var i=$r.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Xr(e,t,n){var i=Ar.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function Jr(e,t,n){var i=$r.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function Qr(e,t,n){var i=$r.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function Zr(e,t){return Sr(e.getDate(),t,2)}function Kr(e,t){return Sr(e.getHours(),t,2)}function eo(e,t){return Sr(e.getHours()%12||12,t,2)}function to(e,t){return Sr(1+On.count(Qn(e),e),t,3)}function no(e,t){return Sr(e.getMilliseconds(),t,3)}function io(e,t){return no(e,t)+"000"}function ro(e,t){return Sr(e.getMonth()+1,t,2)}function oo(e,t){return Sr(e.getMinutes(),t,2)}function ao(e,t){return Sr(e.getSeconds(),t,2)}function so(e){var t=e.getDay();return 0===t?7:t}function lo(e,t){return Sr(Rn.count(Qn(e)-1,e),t,2)}function uo(e){var t=e.getDay();return t>=4||0===t?jn(e):jn.ceil(e)}function co(e,t){return e=uo(e),Sr(jn.count(Qn(e),e)+(4===Qn(e).getDay()),t,2)}function fo(e){return e.getDay()}function ho(e,t){return Sr(Pn.count(Qn(e)-1,e),t,2)}function po(e,t){return Sr(e.getFullYear()%100,t,2)}function mo(e,t){return Sr((e=uo(e)).getFullYear()%100,t,2)}function go(e,t){return Sr(e.getFullYear()%1e4,t,4)}function yo(e,t){var n=e.getDay();return Sr((e=n>=4||0===n?jn(e):jn.ceil(e)).getFullYear()%1e4,t,4)}function vo(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Sr(t/60|0,"0",2)+Sr(t%60,"0",2)}function bo(e,t){return Sr(e.getUTCDate(),t,2)}function xo(e,t){return Sr(e.getUTCHours(),t,2)}function _o(e,t){return Sr(e.getUTCHours()%12||12,t,2)}function wo(e,t){return Sr(1+Nn.count(Zn(e),e),t,3)}function ko(e,t){return Sr(e.getUTCMilliseconds(),t,3)}function Eo(e,t){return ko(e,t)+"000"}function $o(e,t){return Sr(e.getUTCMonth()+1,t,2)}function Ao(e,t){return Sr(e.getUTCMinutes(),t,2)}function Do(e,t){return Sr(e.getUTCSeconds(),t,2)}function So(e){var t=e.getUTCDay();return 0===t?7:t}function Mo(e,t){return Sr(Wn.count(Zn(e)-1,e),t,2)}function Co(e){var t=e.getUTCDay();return t>=4||0===t?Vn(e):Vn.ceil(e)}function Fo(e,t){return e=Co(e),Sr(Vn.count(Zn(e),e)+(4===Zn(e).getUTCDay()),t,2)}function Oo(e){return e.getUTCDay()}function No(e,t){return Sr(Hn.count(Zn(e)-1,e),t,2)}function To(e,t){return Sr(e.getUTCFullYear()%100,t,2)}function zo(e,t){return Sr((e=Co(e)).getUTCFullYear()%100,t,2)}function Ro(e,t){return Sr(e.getUTCFullYear()%1e4,t,4)}function Po(e,t){var n=e.getUTCDay();return Sr((e=n>=4||0===n?Vn(e):Vn.ceil(e)).getUTCFullYear()%1e4,t,4)}function Lo(){return"+0000"}function Bo(){return"%"}function jo(e){return+e}function Io(e){return Math.floor(+e/1e3)}function Uo(e){const t={};return n=>t[n]||(t[n]=e(n))}function qo(e){const t=Uo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=sn(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=sn(null==o?",f":o);const a=rn(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=fn(a,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=dn(a,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=hn(a))||(o.precision=l-2*("%"===o.type))}return t(o)}}}let Wo,Ho;function Go(){return Wo=qo({format:vn,formatPrefix:bn})}function Yo(e){return qo(wn(e))}function Vo(e){return arguments.length?Wo=Yo(e):Wo}function Xo(e,t,n){we(n=n||{})||oe(`Invalid time multi-format specifier: ${n}`);const i=t(xi),r=t(bi),o=t(vi),a=t(mi),s=t(pi),l=t(hi),u=t(di),c=t(fi),f=e(n[_i]||".%L"),d=e(n[xi]||":%S"),h=e(n[bi]||"%I:%M"),p=e(n[vi]||"%I %p"),m=e(n[mi]||n[gi]||"%a %d"),g=e(n[pi]||"%b %d"),y=e(n[hi]||"%B"),v=e(n[di]||"%B"),b=e(n[fi]||"%Y");return e=>(i(e)vt(e)?t(e):Xo(t,Qi,e),utcFormat:e=>vt(e)?n(e):Xo(n,Zi,e),timeParse:Uo(e.parse),utcParse:Uo(e.utcParse)}}function Qo(){return Ho=Jo({format:xr,parse:_r,utcFormat:wr,utcParse:kr})}function Zo(e){return Jo(vr(e))}function Ko(e){return arguments.length?Ho=Zo(e):Ho}br=vr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),xr=br.format,_r=br.parse,wr=br.utcFormat,kr=br.utcParse,Go(),Qo();const ea=(e,t)=>it({},e,t);function ta(e,t){const n=e?Yo(e):Vo(),i=t?Zo(t):Ko();return ea(n,i)}function na(e,t){const n=arguments.length;return n&&2!==n&&oe("defaultLocale expects either zero or two arguments."),n?ea(Vo(e),Ko(t)):ea(Vo(),Ko())}function ia(){return Go(),Qo(),na()}const ra=/^(data:|([A-Za-z]+:)?\/\/)/,oa=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,aa=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,sa="file://";async function la(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function ua(e,t){t=it({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,a;const s=oa.test(e.replace(aa,""));null!=e&&"string"==typeof e&&s||oe("Sanitize failure, invalid URI: "+Dt(e));const l=ra.test(e);return(a=t.baseURL)&&!l&&(e.startsWith("/")||a.endsWith("/")||(e="/"+e),e=a+e),o=(r=e.startsWith(sa))||"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 ca(e){return e?t=>new Promise(((n,i)=>{e.readFile(t,((e,t)=>{e?i(e):n(t)}))})):fa}async function fa(){oe("No file system access.")}function da(e){return e?async function(t,n){const i=it({},this.options.http,n),r=n&&n.response,o=await e(t,i);return o.ok?Ve(o[r])?o[r]():o.text():oe(o.status+""+o.statusText)}:ha}async function ha(){oe("No HTTP fetch method available.")}const pa=e=>null!=e&&e==e,ma=e=>!(Number.isNaN(+e)||e instanceof Date),ga={boolean:St,integer:Se,number:Se,date:Ct,string:Ft,unknown:ue},ya=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>ma(e)&&Number.isInteger(+e),ma,e=>!Number.isNaN(Date.parse(e))],va=["boolean","integer","number","date"];function ba(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=ya.length,r=ya.map(((e,t)=>t+1));for(let o,a,s=0,l=0;s0===e?t:e),0)-1]}function xa(e,t){return t.reduce(((t,n)=>(t[n]=ba(e,n),t)),{})}function _a(e){const t=function(t,n){const i={delimiter:e};return wa(t,n?it(n,i):i)};return t.responseType="text",t}function wa(e,t){return t.header&&(e=t.header.map(Dt).join(t.delimiter)+"\n"+e),qt(t.delimiter).parse(e+"")}function ka(e,t){const n=t&&t.property?se(t.property):ue;return!we(e)||(i=e,"function"==typeof Buffer&&Ve(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){return!_e(e)&&mt(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}wa.responseType="text",ka.responseType="json";const Ea={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function $a(e,t){let n,i,r,o;return e=ka(e,t),t&&t.feature?(n=Ht,r=t.feature):t&&t.mesh?(n=Xt,r=t.mesh,o=Ea[t.filter]):oe("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):oe("Invalid TopoJSON object: "+r),i&&i.features||[i]}$a.responseType="json";const Aa={dsv:wa,csv:_a(","),tsv:_a("\t"),json:ka,topojson:$a};function Da(e,t){return arguments.length>1?(Aa[e]=t,this):st(Aa,e)?Aa[e]:null}function Sa(e){const t=Da(e);return t&&t.responseType||"text"}function Ma(e,t,n,i){const r=Da((t=t||{}).type||"json");return r||oe("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=Ko();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=xa(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(!ga[r])throw Error("Illegal format pattern: "+e+":"+r);return ga[r]}));for(s=0,u=e.length,c=f.length;s({options:t||{},sanitize:ua,load:la,fileAccess:!1,file:ca(null),http:da(e)})}("undefined"!=typeof fetch&&fetch);function Fa(e){const t=e||ue,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 Oa(e,t){try{await t(e)}catch(t){e.error(t)}}const Na=Symbol("vega_id");let Ta=1;function za(e){return!(!e||!Ra(e))}function Ra(e){return e[Na]}function Pa(e,t){return e[Na]=t,e}function La(e){const t=e===Object(e)?e:{data:e};return Ra(t)?t:Pa(t,Ta++)}function Ba(e){return ja(e,La({}))}function ja(e,t){for(const n in e)t[n]=e[n];return t}function Ia(e,t){return Pa(t,Ra(e))}function Ua(e,t){return e?t?(n,i)=>e(n,i)||Ra(t(n))-Ra(t(i)):(t,n)=>e(t,n)||Ra(t)-Ra(n):null}function qa(e){return e&&e.constructor===Wa}function Wa(){const e=[],t=[],n=[],i=[],r=[];let o=null,a=!1;return{constructor:Wa,insert(t){const n=Ge(t),i=n.length;for(let t=0;t{p(e)&&(u[Ra(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[Ra(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(a)s.mod=t.length||i.length?l.filter((e=>u[Ra(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 Ha="_:mod:_";function Ga(){Object.defineProperty(this,Ha,{writable:!0,value:{}})}Ga.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[Ha];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]=_e(n)?1+n.length:-1),r},modified(e,t){const n=this[Ha];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(_e(e)){for(let t=0;t=0?t+1{a instanceof Xa?(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 Xa?e!==this&&(e.targets().add(this),o.push(e)):oe("Pulse parameters must be operator instances.")})),this.source=s;else if(_e(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=Ka();return this.targets().add(Ka(null,null,nt(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(Ka(null,null,(()=>n=!0))),t.targets().add(Ka(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=de,this._targets=null}};const es={skip:!0};function ts(e,t,n,i,r,o){const a=it({},o,es);let s,l;Ve(n)||(n=tt(n)),void 0===i?s=t=>e.touch(n(t)):Ve(i)?(l=new Xa(null,i,r,!1),s=t=>{l.evaluate(t);const i=n(t),r=l.value;qa(r)?e.pulse(i,r,o):e.update(i,r,a)}):s=t=>e.update(n(t),i,a),t.apply(s)}function ns(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const a=o||{},s=new Xa(null,function(e,t){return t=Ve(t)?t:tt(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 is={};function rs(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 os(e,t){const n=[];return Tt(e,t,(e=>n.push(e))),n}function as(e,t){const n={};return e.visit(t,(e=>{n[Ra(e)]=1})),e=>n[Ra(e)]?null:e}function ss(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function ls(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 us(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}rs.prototype={StopPropagation:is,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 rs(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 rs(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,as(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return _e(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?_e(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ss(n.addF,t)),2&e&&(n.remF=ss(n.remF,t)),4&e&&(n.modF=ss(n.modF,t)),16&e&&(n.srcF=ss(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=os(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=os(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=os(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 Tt(n.source,n.srcF,i),n;1&e&&Tt(n.add,n.addF,i),2&e&&Tt(n.rem,n.remF,i),4&e&&Tt(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||Tt(r,e?as(n,5):n.srcF,i)}return n}},ft(ls,rs,{fork(e){const t=new rs(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?_e(e)?e.some((e=>n[e])):n[e]:0},filter(){oe("MultiPulse does not support filtering.")},materialize(){oe("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 ds(){this.logger(xe()),this.logLevel(ge),this._clock=0,this._rank=0,this._locale=na();try{this._loader=Ca()}catch(e){}this._touched=Fa(le),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),fs(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,fs(e,i,t,n)}(t,0,e)):i=n,i}}}(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function hs(e){return function(){return this._log[e].apply(this,arguments)}}function ps(e,t){Xa.call(this,e,null,t)}ds.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:hs("error"),warn:hs("warn"),info:hs("info"),debug:hs("debug"),logLevel:hs("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof Xa?r=e:e&&e.prototype instanceof Xa?r=new e:Ve(e)?r=new Xa(null,e):(o=0,r=new Xa(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&&oe("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||cs);const i=new rs(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||cs;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||cs;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:Wa,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 Ma(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(de).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:Sa(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=Ka(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=Fa(le);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=is),s!==is&&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?us(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!==is&&(e.source=t.source),e)}(this._pulse,n&&n.pulse)}},ft(ps,Xa,{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 ms={};function gs(e){const t=ys(e);return t&&t.Definition||null}function ys(e){return e=e&&e.toLowerCase(),st(ms,e)?ms[e]:null}function vs(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n=r)&&(n=r)}return n}function bs(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function xs(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(et?1:0)}function _s(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?xs:function(e=si){if(e===si)return xs;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);_s(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(ws(e,n,t),r(e[i],o)>0&&ws(e,n,i);a0;)--s}0===r(e[n],o)?ws(e,n,s):(++s,ws(e,s,i)),s<=t&&(n=s+1),t<=s&&(i=s-1)}return e}function ws(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ks(e){return null===e?NaN:+e}function Es(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(i=+i)>=i&&(yield i)}}(e,n)),(i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return bs(e);if(t>=1)return vs(e);var i,r=(i-1)*t,o=Math.floor(r),a=vs(_s(e,o).subarray(0,o+1));return a+(bs(e.subarray(o+1))-a)*(r-o)}}function $s(e,t,n=ks){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 As(e,t){return Es(e,.5,t)}function*Ds(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 Ss(e,t,n){const i=Float64Array.from(Ds(e,n));return i.sort(si),t.map((e=>$s(i,e)))}function Ms(e,t){return Ss(e,[.25,.5,.75],t)}function Cs(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=Ms(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 Fs(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 Rs(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function Ps(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*Os()),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 Ls=Math.sqrt(2*Math.PI),Bs=Math.SQRT2;let js=NaN;function Is(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(js==js)r=js,js=NaN;else{do{r=2*Os()-1,o=2*Os()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,js=o*i}return e+r*t}function Us(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ls)}function qs(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 Ws(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Bs*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 Hs(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:()=>Is(n,i),pdf:e=>Us(e,n,i),cdf:e=>qs(e,n,i),icdf:e=>Ws(e,n,i)};return r.mean(e).stdev(t)}function Gs(e,t){const n=Hs();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=Cs(e)),r):t},sample:()=>e[~~(Os()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;aYs(n,i),pdf:e=>Vs(e,n,i),cdf:e=>Xs(e,n,i),icdf:e=>Js(e,n,i)};return r.mean(e).stdev(t)}function Zs(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 tl(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function nl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function il(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:()=>Ks(n,i),pdf:e=>el(e,n,i),cdf:e=>tl(e,n,i),icdf:e=>nl(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function rl(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 ol(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 al(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 ll(e,t,n,i,r){let o=0,a=0;return sl(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function ul(e,t,n){let i=0,r=0,o=0,a=0,s=0;sl(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=ol(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:ll(e,t,n,r,u)}}function cl(e,t,n){let i=0,r=0,o=0,a=0,s=0;sl(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=ol(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:ll(e,t,n,r,u)}}function fl(e,t,n){const[i,r,o,a]=al(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;sl(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]=ol(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:ll(e,t,n,a,y)}}function dl(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;sl(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=ol(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:ll(e,t,n,s,c)}}function hl(e,t,n){const[i,r,o,a]=al(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+_+a;return{coef:[_-x*o+b*o*o+a,x-2*b*o,b],predict:w,rSquared:ll(e,t,n,a,w)}}function pl(e,t,n,i){if(0===i)return rl(e,t,n);if(1===i)return ul(e,t,n);if(2===i)return hl(e,t,n);const[r,o,a,s]=al(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 gl=2,yl=1e-12;function vl(e,t,n,i){const[r,o,a,s]=al(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<=gl;){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=bl(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]=ol(u/l,h/l,p/l,m/l);c[e]=y+v*n,f[e]=Math.abs(o[e]-c[e]),xl(r,e+1,t)}if(e===gl)break;const n=As(f);if(Math.abs(n)=1?yl:(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 _l=.5*Math.PI/180;function wl(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&&kl(f,e,d,h,p)>_l?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function kl(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)}function El(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(r);++i{const n=t.length;let i=1,r=String(t[0](e));for(;i{},Sl={init:Dl,add:Dl,rem:Dl,idx:0},Ml={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}},Cl=Object.keys(Ml).filter((e=>"__count__"!==e));function Fl(e,t){return Ml[e](t)}function Ol(e,t){return e.idx-t.idx}function Nl(){this.valid=0,this.missing=0,this._ops.forEach((e=>e.init(this)))}function Tl(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function zl(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function Rl(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function Pl(e,t){const n=t||ue,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]=Ml[e]())}))};return e.forEach(n),Object.values(t).sort(Ol)}(e),r=e.slice().sort(Ol);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=Nl,o.prototype.add=Tl,o.prototype.rem=zl,o.prototype.set=Rl,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function Ll(e){this._key=e?se(e):Ra,this.reset()}[...Cl,"__count__"].forEach((e=>{Ml[e]=function(e,t){return n=>it({name:e,out:n||e},Sl,t)}(e,Ml[e])}));const Bl=Ll.prototype;function jl(e){ps.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 Il(e){ps.call(this,null,e)}function Ul(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?kt(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function ql(e){ps.call(this,[],e)}function Wl(e){Xa.call(this,null,Hl,e)}function Hl(e){return this.value&&!e.modified()?this.value:Je(e.fields,e.orders)}function Gl(e){ps.call(this,null,e)}function Yl(e){ps.call(this,null,e)}Bl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Bl.add=function(e){this._add.push(e)},Bl.rem=function(e){this._rem.push(e)},Bl.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])+"",st(n,i)||(n[i]=1,++o);return o},Bl.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=ot(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Bl.argmin=function(e){return this.extent(e)[0]||{}},Bl.argmax=function(e){return this.extent(e)[1]||{}},Bl.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},Bl.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},Bl.quartile=function(e){return this._get===e&&this._q||(this._q=Ms(this.values(),e),this._get=e),this._q},Bl.q1=function(e){return this.quartile(e)[0]},Bl.q2=function(e){return this.quartile(e)[1]},Bl.q3=function(e){return this.quartile(e)[2]},Bl.ci=function(e){return this._get===e&&this._ci||(this._ci=Ts(this.values(),1e3,.05,e),this._get=e),this._ci},Bl.ci0=function(e){return this.ci(e)[0]},Bl.ci1=function(e){return this.ci(e)[1]},jl.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Cl},{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"}]},ft(jl,ps,{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=ee(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:$l(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&&oe("Unmatched number of fields and aggregate ops."),m=0;mPl(e,e.field))),Object.create(null)},cellkey:$l(),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=Fs(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=Se(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=K(l,te(t),e.name||"bin_"+ee(t))}}),ql.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ft(ql,ps,{transform(e,t){const n=t.fork(t.ALL),i=Ul(Ra,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(Ua(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),ft(Wl,Xa),Gl.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"]}]},ft(Gl,ps,{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=La({}),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)}}),Yl.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ft(Yl,ps,{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;uJl(e,t)))):typeof i[n]===Xl&&i[n](e[n]);return i}function Ql(e){ps.call(this,null,e)}const Zl=[{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}]}],Kl={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Zl},{name:"weights",type:"number",array:!0}]};function eu(e,t){return e?e.map(((e,n)=>t[n]||ee(e))):null}function tu(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)),te(t),ee(t))}function ou(e){ps.call(this,[void 0,void 0],e)}function au(e,t){Xa.call(this,e),this.parent=t,this.count=0}function su(e){ps.call(this,{},e),this._keys=ut();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;nse(e))):se(e.name,e.as)}function cu(e){ps.call(this,ut(),e)}function fu(e){ps.call(this,[],e)}function du(e){ps.call(this,[],e)}function hu(e){ps.call(this,null,e)}function pu(e){ps.call(this,[],e)}Ql.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:Zl.concat(Kl)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ft(Ql,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=Jl(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&&oe("Invalid density method: "+a),e.extent||i.data||oe("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],l=wl(a,e.extent||rt(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],La(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),nu.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"}]},ft(nu,ps,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=tu(t.source,e.groupby,ue),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>At(rt(e,t))/30)(n,o),s=Ua(((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)}}),ft(iu,Xa),ou.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ft(ou,ps,{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=Se(i(e));null!=t&&(ta&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=ee(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),ft(au,Xa,{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}}),ft(su,ps,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=st(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=Ra(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(Ra(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Ra(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(Ra(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Ra(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}}),ft(lu,Xa),cu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ft(cu,ps,{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=Ra(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=Ra(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(Ra(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}}),fu.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}]},ft(fu,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=eu(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)))}}),ft(pu,ps,{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=La(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 mu={value:"value",median:As,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:bs,max:vs},gu=[];function yu(e){ps.call(this,[],e)}function vu(e){jl.call(this,e)}function bu(e){ps.call(this,null,e)}function xu(e){Xa.call(this,null,_u,e)}function _u(e){return this.value&&!e.modified()?this.value:bt(e.fields,e.flat)}function wu(e){ps.call(this,[],e),this._pending=null}function ku(e,t,n){n.forEach(La);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 Eu(e){ps.call(this,{},e)}function $u(e){Xa.call(this,null,Au,e)}function Au(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 Du(e){Xa.call(this,null,Su,e)}function Su(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function Mu(e){ps.call(this,null,e)}function Cu(e){jl.call(this,e)}function Fu(e){su.call(this,e)}function Ou(e){ps.call(this,null,e)}function Nu(e){ps.call(this,null,e)}function Tu(e){ps.call(this,null,e)}function zu(e){ps.call(this,null,e)}function Ru(e){ps.call(this,[],e),this.count=0}function Pu(e){ps.call(this,null,e)}function Lu(e){ps.call(this,null,e),this.modified(!0)}function Bu(e){ps.call(this,null,e)}yu.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}]},ft(yu,ps,{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||mu.value;if(null!=mu[n])return n===mu.value?(t=void 0!==e.value?e.value:0,()=>t):mu[n];oe("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=ee(e.field),g=ee(e.key),y=(e.groupby||[]).map(ee),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=>{it(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=Gs(t,a)[s],i=e.counts?t.length:1;wl(n,c||rt(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=>ku(this,t,Ge(e.data))))}}),Eu.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}]},ft(Eu,ps,{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&&oe('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*u&&oe('The "as" parameter has too few output field names.'),h=h||r.map(ee),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)}}),ft($u,Xa),ft(Du,Xa),ft(Mu,ps,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Cu.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:Cl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ft(Cu,jl,{_transform:jl.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=te(n).concat(te(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(Qe),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 K((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)}}),ft(Fu,su,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Ra(e),n,t,e);return(e.modified("field")||i&&t.modified(te(i)))&&oe("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(La(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}}),Ou.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ft(Ou,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=eu(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r{const t=Ra(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,La({}));a[Ra(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Ra(e)]))})),n}}),ft(Nu,ps,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),Tu.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"]}]},ft(Tu,ps,{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=tu(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(ee),a=[],s=e.step||.01,l=e.probs||El(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=Ss(e,l);for(let n=0;n{const t=Ra(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Ba(e);i[Ra(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Ra(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),Ru.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ft(Ru,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Ra(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[Ra(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Ra(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Ra(e)]))),(t.rem.length||i)&&a.length{o[Ra(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t{o[Ra(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[Ra(e)]))),this.count=s,this.value=n.source=a,n}}),Pu.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"}]},ft(Pu,ps,{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=El(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,La(t)})),n.add=t.add.concat(this.value),n}}),ft(Lu,ps,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const ju=["unit0","unit1"];function Iu(e){ps.call(this,ut(),e)}function Uu(e){ps.call(this,null,e)}Bu.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:wi,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:ju}]},ft(Bu,ps,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?Zi:Qi)(o.unit).offset,s=e.as||ju,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(te(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}:pr({extent:e.extent||rt(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=Ei(i),a=this.value||{},s=(n?Vi:Hi)(o,r);return s.unit=De(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),ft(Iu,ps,{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()}}),ft(Uu,ps,{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(Ua(e.sort)):t.source).map(e.field))}});const qu={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=qu.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||oe("ntile num must be greater than zero.");const n=qu.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||oe("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=ee(s),p=Al(e,h,r[t]);if(d(s),o.push(p),st(qu,e))a.push(function(e,t,n,i){const r=qu[e](t,n);return{init:r.init||ce,update:function(e,t){t[i]=r.next(e)}}}(e,n[t],i[t],p));else{if(null==s&&"count"!==e&&oe("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(Fl(e,p))}})),(u.length||c.length)&&(this.cell=function(e,t,n){e=e.map((e=>Pl(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()},Gu.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 Hu(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;t0)for(var i,r=e[0],o=t[0],a=e[n]-r,s=t[n]-o,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*a),this._beta*t[l]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const ic=function e(t){function n(e){return 1===t?new Zu(e):new nc(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function rc(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function oc(e,t){this._context=e,this._k=(1-t)/6}oc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:rc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const ac=function e(t){function n(e){return new oc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function sc(e,t){this._context=e,this._k=(1-t)/6}sc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const lc=function e(t){function n(e){return new sc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function uc(e,t){this._context=e,this._k=(1-t)/6}uc.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const cc=function e(t){function n(e){return new uc(e,t)}return n.tension=function(t){return e(+t)},n}(0),fc=Math.abs,dc=Math.atan2,hc=Math.cos,pc=Math.max,mc=Math.min,gc=Math.sin,yc=Math.sqrt,vc=1e-12,bc=Math.PI,xc=bc/2,_c=2*bc;function wc(e){return e>=1?xc:e<=-1?-xc:Math.asin(e)}function kc(e,t,n){var i=e._x1,r=e._y1,o=e._x2,a=e._y2;if(e._l01_a>vc){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>vc){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*u+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,o,a,e._x2,e._y2)}function Ec(e,t){this._context=e,this._alpha=t}Ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const $c=function e(t){function n(e){return t?new Ec(e,t):new oc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ac(e,t){this._context=e,this._alpha=t}Ac.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Dc=function e(t){function n(e){return t?new Ac(e,t):new uc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Sc(e,t){this._context=e,this._alpha=t}Sc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Mc=function e(t){function n(e){return t?new Sc(e,t):new sc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Cc(e){this._context=e}function Fc(e){return new Cc(e)}function Oc(e){this._context=e}function Nc(e){return e<0?-1:1}function Tc(e,t,n){var i=e._x1-e._x0,r=t-e._x1,o=(e._y1-e._y0)/(i||r<0&&-0),a=(n-e._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Nc(o)+Nc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function zc(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Rc(e,t,n){var i=e._x0,r=e._y0,o=e._x1,a=e._y1,s=(o-i)/3;e._context.bezierCurveTo(i+s,r+s*t,o-s,a-s*n,o,a)}function Pc(e){this._context=e}function Lc(e){this._context=new Bc(e)}function Bc(e){this._context=e}function jc(e){this._context=e}function Ic(e){var t,n,i=e.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)r[t]=(a[t]-r[t+1])/o[t];for(o[i-1]=(e[i]+r[i-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const Wc=Math.PI,Hc=2*Wc,Gc=1e-6,Yc=Hc-Gc;function Vc(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Vc;const n=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;tGc)if(Math.abs(c*s-l*u)>Gc&&r){let d=n-o,h=i-a,p=s*s+l*l,m=d*d+h*h,g=Math.sqrt(p),y=Math.sqrt(f),v=r*Math.tan((Wc-Math.acos((p+f-m)/(2*g*y)))/2),b=v/y,x=v/g;Math.abs(b-1)>Gc&&this._append`L${e+b*u},${t+b*c}`,this._append`A${r},${r},0,0,${+(c*d>u*h)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,i,r,o){if(e=+e,t=+t,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),s=n*Math.sin(i),l=e+a,u=t+s,c=1^o,f=o?i-r:r-i;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Gc||Math.abs(this._y1-u)>Gc)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%Hc+Hc),f>Yc?this._append`A${n},${n},0,1,${c},${e-a},${t-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:f>Gc&&this._append`A${n},${n},0,${+(f>=Wc)},${c},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Jc(){return new Xc}function Qc(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Xc(t)}function Zc(e){return e.innerRadius}function Kc(e){return e.outerRadius}function ef(e){return e.startAngle}function tf(e){return e.endAngle}function nf(e){return e&&e.padAngle}function rf(e,t,n,i,r,o,a){var s=e-n,l=t-i,u=(a?o:-o)/yc(s*s+l*l),c=u*l,f=-u*s,d=e+c,h=t+f,p=n+c,m=i+f,g=(d+p)/2,y=(h+m)/2,v=p-d,b=m-h,x=v*v+b*b,_=r-o,w=d*m-p*h,k=(b<0?-1:1)*yc(pc(0,_*_*x-w*w)),E=(w*b-v*k)/x,$=(-w*v-b*k)/x,A=(w*b+v*k)/x,D=(-w*v+b*k)/x,S=E-g,M=$-y,C=A-g,F=D-y;return S*S+M*M>C*C+F*F&&(E=A,$=D),{cx:E,cy:$,x01:-c,y01:-f,x11:E*(r/_-1),y11:$*(r/_-1)}}function of(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function af(e){return e[0]}function sf(e){return e[1]}function lf(e,t){var n=qc(!0),i=null,r=Fc,o=null,a=Qc(s);function s(s){var l,u,c,f=(s=of(s)).length,d=!1;for(null==i&&(o=r(c=a())),l=0;l<=f;++l)!(l=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 lf().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?af:qc(+e),t="function"==typeof t?t:qc(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?sf:qc(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:qc(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:qc(+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:qc(!!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}Jc.prototype=Xc.prototype,Array.prototype.slice,yc(3);const cf={draw(e,t){const n=yc(t/bc);e.moveTo(n,0),e.arc(0,0,n,0,_c)}};yc(1/3),gc(bc/10),gc(7*bc/10);function ff(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}gc(_c/10),hc(_c/10),yc(3),yc(3),yc(3),yc(12);const df=()=>"undefined"!=typeof Image?Image:null,hf=ui(si),pf=hf.right,mf=hf.left,gf=(ui(ks).center,pf);function yf(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function vf(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function bf(){}var xf=.7,_f=1/xf,wf="\\s*([+-]?\\d+)\\s*",kf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ef="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$f=/^#([0-9a-f]{3,8})$/,Af=new RegExp(`^rgb\\(${wf},${wf},${wf}\\)$`),Df=new RegExp(`^rgb\\(${Ef},${Ef},${Ef}\\)$`),Sf=new RegExp(`^rgba\\(${wf},${wf},${wf},${kf}\\)$`),Mf=new RegExp(`^rgba\\(${Ef},${Ef},${Ef},${kf}\\)$`),Cf=new RegExp(`^hsl\\(${kf},${Ef},${Ef}\\)$`),Ff=new RegExp(`^hsla\\(${kf},${Ef},${Ef},${kf}\\)$`),Of={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Nf(){return this.rgb().formatHex()}function Tf(){return this.rgb().formatRgb()}function zf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$f.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Rf(t):3===n?new jf(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Pf(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Pf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Af.exec(e))?new jf(t[1],t[2],t[3],1):(t=Df.exec(e))?new jf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Sf.exec(e))?Pf(t[1],t[2],t[3],t[4]):(t=Mf.exec(e))?Pf(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Cf.exec(e))?Gf(t[1],t[2]/100,t[3]/100,1):(t=Ff.exec(e))?Gf(t[1],t[2]/100,t[3]/100,t[4]):Of.hasOwnProperty(e)?Rf(Of[e]):"transparent"===e?new jf(NaN,NaN,NaN,0):null}function Rf(e){return new jf(e>>16&255,e>>8&255,255&e,1)}function Pf(e,t,n,i){return i<=0&&(e=t=n=NaN),new jf(e,t,n,i)}function Lf(e){return e instanceof bf||(e=zf(e)),e?new jf((e=e.rgb()).r,e.g,e.b,e.opacity):new jf}function Bf(e,t,n,i){return 1===arguments.length?Lf(e):new jf(e,t,n,null==i?1:i)}function jf(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function If(){return`#${Hf(this.r)}${Hf(this.g)}${Hf(this.b)}`}function Uf(){const e=qf(this.opacity);return`${1===e?"rgb(":"rgba("}${Wf(this.r)}, ${Wf(this.g)}, ${Wf(this.b)}${1===e?")":`, ${e})`}`}function qf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hf(e){return((e=Wf(e))<16?"0":"")+e.toString(16)}function Gf(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Xf(e,t,n,i)}function Yf(e){if(e instanceof Xf)return new Xf(e.h,e.s,e.l,e.opacity);if(e instanceof bf||(e=zf(e)),!e)return new Xf;if(e instanceof Xf)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),o=Math.max(t,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=t===o?(n-i)/s+6*(n0&&l<1?0:a,new Xf(a,s,l,e.opacity)}function Vf(e,t,n,i){return 1===arguments.length?Yf(e):new Xf(e,t,n,null==i?1:i)}function Xf(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Jf(e){return(e=(e||0)%360)<0?e+360:e}function Qf(e){return Math.max(0,Math.min(1,e||0))}function Zf(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Kf(e,t,n,i,r){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*i+a*r)/6}function ed(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],o=e[i+1],a=i>0?e[i-1]:2*r-o,s=i=240?e-240:e+120,r,i),Zf(e,r,i),Zf(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new Xf(Jf(this.h),Qf(this.s),Qf(this.l),qf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qf(this.opacity);return`${1===e?"hsl(":"hsla("}${Jf(this.h)}, ${100*Qf(this.s)}%, ${100*Qf(this.l)}%${1===e?")":`, ${e})`}`}}));const nd=e=>()=>e;function id(e,t){return function(n){return e+n*t}}function rd(e,t){var n=t-e;return n?id(e,n>180||n<-180?n-360*Math.round(n/360):n):nd(isNaN(e)?t:e)}function od(e,t){var n=t-e;return n?id(e,n):nd(isNaN(e)?t:e)}const ad=function e(t){var n=function(e){return 1==(e=+e)?od:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):nd(isNaN(t)?n:t)}}(t);function i(e,t){var i=n((e=Bf(e)).r,(t=Bf(t)).r),r=n(e.g,t.g),o=n(e.b,t.b),a=od(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=o(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function sd(e){return function(t){var n,i,r=t.length,o=new Array(r),a=new Array(r),s=new Array(r);for(n=0;no&&(r=t.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:md(n,i)})),o=vd.lastIndex;return ot&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(a[0],a[e-1])),i=e>2?Dd:Ad,r=o=null,f}function f(t){return null==t||isNaN(t=+t)?n:(r||(r=i(a.map(e),s,l)))(e(u(t)))}return f.invert=function(n){return u(t((o||(o=i(s,a.map(e),md)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,wd),c()):a.slice()},f.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},f.rangeRound=function(e){return s=Array.from(e),l=_d,c()},f.clamp=function(e){return arguments.length?(u=!!e||Ed,c()):u!==Ed},f.interpolate=function(e){return arguments.length?(l=e,c()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,i){return e=n,t=i,c()}}function Cd(){return Md()(Ed,Ed)}function Fd(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Od(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function Nd(e,t,n,i){var r,o=rn(e,t,n);switch((i=sn(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=fn(o,a))||(i.precision=r),bn(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=dn(o,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=hn(o))||(i.precision=r-2*("%"===i.type))}return vn(i)}function Td(e){var t=e.domain;return e.ticks=function(e){var n=t();return tn(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return Nd(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,o=t(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u0;){if((r=nn(l,u,n))===i)return o[a]=l,o[s]=u,t(o);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function zd(e,t){var n,i=0,r=(e=e.slice()).length-1,o=e[i],a=e[r];return a-e(-t,n)}function Ud(e){const t=e(Rd,Pd),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?jd:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Id(i),r=Id(r),e(Ld,Bd)):e(Rd,Pd),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=sn(n)).precision||(n.trim=!0),n=vn(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(zd(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function qd(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Wd(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Hd(e){return e<0?-e*e:e*e}function Gd(e){var t=e(Ed,Ed),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(Ed,Ed):.5===n?e(Wd,Hd):e(qd(n),qd(1/n)):n},Td(t)}function Yd(){var e=Gd(Md());return e.copy=function(){return Sd(e,Yd()).exponent(e.exponent())},Fd.apply(e,arguments),e}function Vd(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Xd(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Jd(e){var t=1,n=e(Vd(t),Xd(t));return n.constant=function(n){return arguments.length?e(Vd(t=+n),Xd(t)):t},Td(n)}function Qd(e,t,n,i,r,o){const a=[[oi,1,An],[oi,5,5e3],[oi,15,15e3],[oi,30,3e4],[o,1,Dn],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,Sn],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,Mn],[i,2,1728e5],[n,1,Cn],[t,1,2592e6],[t,3,7776e6],[e,1,Fn]];function s(t,n,i){const r=Math.abs(n-t)/i,o=ui((([,,e])=>e)).right(a,r);if(o===a.length)return e.every(rn(t/Fn,n/Fn,i));if(0===o)return ai.every(Math.max(rn(t,n,i),1));const[s,l]=a[r/a[o-1][2]180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:md(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(o.rotate,a.rotate,s,l),function(e,t,n,o){e!==t?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:md(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(o.skewX,a.skewX,s,l),function(e,t,n,i,o,a){if(e!==n||t!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:md(e,n)},{i:s-2,x:md(t,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(e){for(var t,n=-1,i=l.length;++nUh?Math.pow(e,1/3):e/Ih+Bh}function Yh(e){return e>jh?e*e*e:Ih*(e-Bh)}function Vh(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Xh(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jh(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof Qh)return new Qh(e.h,e.c,e.l,e.opacity);if(e instanceof Hh||(e=qh(e)),0===e.a&&0===e.b)return new Qh(NaN,00?i:1:0}const vp="linear",bp="log",xp="pow",_p="sqrt",wp="symlog",kp="time",Ep="utc",$p="sequential",Ap="diverging",Dp="quantile",Sp="quantize",Mp="threshold",Cp="ordinal",Fp="point",Op="band",Np="bin-ordinal",Tp="continuous",zp="discrete",Rp="discretizing",Pp="interpolating",Lp="temporal";function Bp(){const e=bh().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,pf(a,f)-1),u=f===d?l:pf(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 Bp().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function jp(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return jp(t())},e}var Ip=Array.prototype.map;const Up=Array.prototype.slice,qp=new Map,Wp=Symbol("vega_scale");function Hp(e){return e[Wp]=!0,e}function Gp(e,t,n){return arguments.length>1?(qp.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,Hp(n)};return i.metadata=Ot(Ge(n)),i}(e,t,n)),this):Yp(e)?qp.get(e):void 0}function Yp(e){return qp.has(e)}function Vp(e,t){const n=qp.get(e);return n&&n.metadata[t]}function Xp(e){return Vp(e,Tp)}function Jp(e){return Vp(e,zp)}function Qp(e){return Vp(e,Rp)}function Zp(e){return Vp(e,bp)}function Kp(e){return Vp(e,Pp)}function em(e){return Vp(e,Dp)}Gp("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,wd),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,wd):[0,1],Td(i)})),Gp(vp,(function e(){var t=Cd();return t.copy=function(){return Sd(t,e())},Fd.apply(t,arguments),Td(t)}),Tp),Gp(bp,(function e(){const t=Ud(Md()).domain([1,10]);return t.copy=()=>Sd(t,e()).base(t.base()),Fd.apply(t,arguments),t}),[Tp,bp]),Gp(xp,Yd,Tp),Gp(_p,(function(){return Yd.apply(null,arguments).exponent(.5)}),Tp),Gp(wp,(function e(){var t=Jd(Md());return t.copy=function(){return Sd(t,e()).constant(t.constant())},Fd.apply(t,arguments)}),Tp),Gp(kp,(function(){return Fd.apply(rh(eh,th,Qn,Kn,Rn,On,ti,ii,oi,xr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Tp,Lp]),Gp(Ep,(function(){return Fd.apply(rh(Zd,Kd,Zn,ei,Wn,Nn,ni,ri,oi,wr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Tp,Lp]),Gp($p,sh,[Tp,Pp]),Gp(`${$p}-${vp}`,sh,[Tp,Pp]),Gp(`${$p}-${bp}`,(function e(){var t=Ud(oh()).domain([1,10]);return t.copy=function(){return ah(t,e()).base(t.base())},Od.apply(t,arguments)}),[Tp,Pp,bp]),Gp(`${$p}-${xp}`,lh,[Tp,Pp]),Gp(`${$p}-${_p}`,(function(){return lh.apply(null,arguments).exponent(.5)}),[Tp,Pp]),Gp(`${$p}-${wp}`,(function e(){var t=Jd(oh());return t.copy=function(){return ah(t,e()).constant(t.constant())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(`${Ap}-${vp}`,(function e(){var t=Td(ch()(Ed));return t.copy=function(){return ah(t,e())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(`${Ap}-${bp}`,(function e(){var t=Ud(ch()).domain([.1,1,10]);return t.copy=function(){return ah(t,e()).base(t.base())},Od.apply(t,arguments)}),[Tp,Pp,bp]),Gp(`${Ap}-${xp}`,fh,[Tp,Pp]),Gp(`${Ap}-${_p}`,(function(){return fh.apply(null,arguments).exponent(.5)}),[Tp,Pp]),Gp(`${Ap}-${wp}`,(function e(){var t=Jd(ch());return t.copy=function(){return ah(t,e()).constant(t.constant())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(Dp,(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)},Fd.apply(Td(s),arguments)}),Rp),Gp(Mp,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[gf(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)},Fd.apply(o,arguments)}),Rp),Gp(Np,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(gf(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Ip.call(e,Se)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Up.call(e),i):n.slice()},i.tickFormat=function(e,n){return Nd(t[0],De(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[zp,Rp]),Gp(Cp,bh,zp),Gp(Op,Bp,zp),Gp(Fp,(function(){return jp(Bp().paddingInner(1))}),zp);const tm=["clamp","base","constant","exponent"];function nm(e,t){const n=t[0],i=De(t)-n;return function(t){return e(n+t*i)}}function im(e,t,n){return uh(am(t||"rgb",n),e)}function rm(e,t){const n=new Array(t),i=t+1;for(let r=0;re[t]?a[t](e[t]()):0)),a):tt(.5)}function am(e,t){const n=a[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 sm(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i1?(um[e]=t,this):um[e]}lm({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"},sm),lm({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=>im(sm(e))));const fm="symbol",dm="discrete",hm=e=>_e(e)?e.map((e=>String(e))):String(e),pm=(e,t)=>e[1]-t[1],mm=(e,t)=>t[1]-e[1];function gm(e,t,n){let i;return gt(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),vt(t)&&(t=e.type===kp?Qi(t):e.type==Ep?Zi(t):oe("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function ym(e,t,n){let i=e.range(),r=i[0],o=De(i),a=pm;if(r>o&&(i=o,o=r,r=i,a=mm),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],De(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function vm(e,t){return e.bins?ym(e,e.bins):e.ticks?e.ticks(t):e.domain()}function bm(e,t,n,i,r,o){const a=t.type;let s=hm;if(a===kp||r===kp)s=e.timeFormat(i);else if(a===Ep||r===Ep)s=e.utcFormat(i);else if(Zp(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=xm(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 xm(e,t,n){const i=vm(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*r_m[e.type]||e.bins;function $m(e,t,n,i,r,o,a){const s=wm[t.type]&&o!==kp&&o!==Ep?function(e,t,n){const i=t[wm[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=Dm(i[n+1],Dm(i.max,1/0)),o=Cm(t,e),a=Cm(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Dm=(e,t)=>null!=e?e:t,Sm=e=>(t,n)=>n?e(t):null,Mm=e=>t=>e(t),Cm=(e,t)=>Number.isFinite(e)?t(e):null;function Fm(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 vt(n)&&function(e){return Vp(e,Lp)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==kp?n||r!==Ep?$m(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(Qp(t.type)){const e=km(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Jp(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(De(e))}`}}let Om=0;const Nm="p_";function Tm(e){return e&&e.gradient}function zm(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?Nm:"";return r||(r=e.id="gradient_"+Om++,"radial"===i?(e.x1=Rm(e.x1,.5),e.y1=Rm(e.y1,.5),e.r1=Rm(e.r1,0),e.x2=Rm(e.x2,.5),e.y2=Rm(e.y2,.5),e.r2=Rm(e.r2,.5),o=Nm):(e.x1=Rm(e.x1,0),e.y1=Rm(e.y1,0),e.x2=Rm(e.x2,1),e.y2=Rm(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Rm(e,t){return null!=e?e:t}function Pm(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 Lm={basis:{curve:function(e){return new Zu(e)}},"basis-closed":{curve:function(e){return new ec(e)}},"basis-open":{curve:function(e){return new tc(e)}},bundle:{curve:ic,tension:"beta",value:.85},cardinal:{curve:ac,tension:"tension",value:0},"cardinal-open":{curve:lc,tension:"tension",value:0},"cardinal-closed":{curve:cc,tension:"tension",value:0},"catmull-rom":{curve:$c,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Dc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Mc,tension:"alpha",value:.5},linear:{curve:Fc},"linear-closed":{curve:function(e){return new Oc(e)}},monotone:{horizontal:function(e){return new Lc(e)},vertical:function(e){return new Pc(e)}},natural:{curve:function(e){return new jc(e)}},step:{curve:function(e){return new Uc(e,.5)}},"step-after":{curve:function(e){return new Uc(e,1)}},"step-before":{curve:function(e){return new Uc(e,0)}}};function Bm(e,t,n){var i=st(Lm,e)&&Lm[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const jm={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Im=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Um=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,qm=/^((\s+,?\s*)|(,\s*))/,Wm=/^[01]/;function Hm(e){const t=[];return(e.match(Im)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=jm[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,_=v*s+b*l,w=g*e+y*t,k=v*e+b*t;let E=1/((w-x)*(w-x)+(k-_)*(k-_))-.25;E<0&&(E=0);let $=Math.sqrt(E);o==r&&($=-$);const A=.5*(x+w)-$*(k-_),D=.5*(_+k)+$*(w-x),S=Math.atan2(_-D,x-A);let M=Math.atan2(k-D,w-A)-S;M<0&&1===o?M+=Vm:M>0&&0===o&&(M-=Vm);const C=Math.ceil(Math.abs(M/(Ym+.001))),F=[];for(let e=0;e+e}function pg(e,t,n){return Math.max(t,Math.min(e,n))}function mg(){var e=ug,t=cg,n=fg,i=dg,r=hg(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=pg(+r.call(this,u),0,y),b=pg(+o.call(this,u),0,y),x=pg(+a.call(this,u),0,y),_=pg(+s.call(this,u),0,y);if(l||(l=d=Jc()),v<=0&&b<=0&&x<=0&&_<=0)l.rect(h,p,m,g);else{var w=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(w-b,p),l.bezierCurveTo(w-lg*b,p,w,p+lg*b,w,p+b),l.lineTo(w,k-_),l.bezierCurveTo(w,k-lg*_,w-lg*_,k,w-_,k),l.lineTo(h+x,k),l.bezierCurveTo(h+lg*x,k,h,k-lg*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+lg*v,h+lg*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=hg(t),u):e},u.y=function(e){return arguments.length?(t=hg(e),u):t},u.width=function(e){return arguments.length?(n=hg(e),u):n},u.height=function(e){return arguments.length?(i=hg(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=hg(e),o=null!=t?hg(t):r,s=null!=n?hg(n):r,a=null!=i?hg(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function gg(){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,Vm);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=Jc()),a=0;a<=f;++a)!(ae.x||0,bg=e=>e.y||0,xg=e=>!(!1===e.defined),_g=function(){var e=Zc,t=Kc,n=qc(0),i=null,r=ef,o=tf,a=nf,s=null,l=Qc(u);function u(){var u,c,f=+e.apply(this,arguments),d=+t.apply(this,arguments),h=r.apply(this,arguments)-xc,p=o.apply(this,arguments)-xc,m=fc(p-h),g=p>h;if(s||(s=u=l()),dvc)if(m>_c-vc)s.moveTo(d*hc(h),d*gc(h)),s.arc(0,0,d,h,p,!g),f>vc&&(s.moveTo(f*hc(p),f*gc(p)),s.arc(0,0,f,p,h,g));else{var y,v,b=h,x=p,_=h,w=p,k=m,E=m,$=a.apply(this,arguments)/2,A=$>vc&&(i?+i.apply(this,arguments):yc(f*f+d*d)),D=mc(fc(d-f)/2,+n.apply(this,arguments)),S=D,M=D;if(A>vc){var C=wc(A/f*gc($)),F=wc(A/d*gc($));(k-=2*C)>vc?(_+=C*=g?1:-1,w-=C):(k=0,_=w=(h+p)/2),(E-=2*F)>vc?(b+=F*=g?1:-1,x-=F):(E=0,b=x=(h+p)/2)}var O=d*hc(b),N=d*gc(b),T=f*hc(w),z=f*gc(w);if(D>vc){var R,P=d*hc(x),L=d*gc(x),B=f*hc(_),j=f*gc(_);if(m1?0:e<-1?bc:Math.acos(e)}((I*q+U*W)/(yc(I*I+U*U)*yc(q*q+W*W)))/2),G=yc(R[0]*R[0]+R[1]*R[1]);S=mc(D,(f-G)/(H-1)),M=mc(D,(d-G)/(H+1))}else S=M=0}E>vc?M>vc?(y=rf(B,j,O,N,d,M,g),v=rf(P,L,T,z,d,M,g),s.moveTo(y.cx+y.x01,y.cy+y.y01),Mvc&&k>vc?S>vc?(y=rf(T,z,P,L,f,-S,g),v=rf(O,N,B,j,f,-S,g),s.lineTo(y.cx+y.x01,y.cy+y.y01),Se.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)),wg=uf().x(vg).y1(bg).y0((e=>(e.y||0)+(e.height||0))).defined(xg),kg=uf().y(bg).x1(vg).x0((e=>(e.x||0)+(e.width||0))).defined(xg),Eg=lf().x(vg).y(bg).defined(xg),$g=mg().x(vg).y(bg).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>yg(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>yg(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>yg(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>yg(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),Ag=function(e,t){let n=null,i=Qc(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:qc(e||cf),t="function"==typeof t?t:qc(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:qc(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>ag(e.shape||"circle"))).size((e=>yg(e.size,64))),Dg=gg().x(vg).y(bg).defined(xg).size((e=>e.size||1));function Sg(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Mg(e,t,n,i){return $g.context(e)(t,n,i)}var Cg=1;function Fg(){Cg=1}function Og(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+Cg++),a=r.clipping[o]||(r.clipping[o]={id:o});return Ve(i)?a.path=i(null):Sg(n)?a.path=Mg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Ng(e){this.clear(),e&&this.union(e)}function Tg(e){this.mark=e,this.bounds=this.bounds||new Ng}function zg(e){Tg.call(this,e),this.items=this.items||[]}function Rg(e){this._pending=0,this._loader=e||Ca()}function Pg(e){e._pending+=1}function Lg(e){e._pending-=1}function Bg(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}Ng.prototype={clone(){return new Ng(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}},ft(zg,Tg),Rg.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return Pg(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Lg(t),e))).catch((()=>(Lg(t),null)))},loadImage(e){const t=this,n=df();return Pg(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=st(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Lg(t),r.onerror=()=>Lg(t),r.src=i,r})).catch((e=>(Lg(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 jg=Vm-1e-8;let Ig,Ug,qg,Wg,Hg,Gg,Yg,Vg;const Xg=(e,t)=>Ig.add(e,t),Jg=(e,t)=>Xg(Ug=e,qg=t),Qg=e=>Xg(e,Ig.y1),Zg=e=>Xg(Ig.x1,e),Kg=(e,t)=>Hg*e+Yg*t,ey=(e,t)=>Gg*e+Vg*t,ty=(e,t)=>Xg(Kg(e,t),ey(e,t)),ny=(e,t)=>Jg(Kg(e,t),ey(e,t));function iy(e,t){return Ig=e,t?(Wg=t*Gm,Hg=Vg=Math.cos(Wg),Gg=Math.sin(Wg),Yg=-Gg):(Hg=Vg=1,Wg=Gg=Yg=0),ry}const ry={beginPath(){},closePath(){},moveTo:ny,lineTo:ny,rect(e,t,n,i){Wg?(ty(e+n,t),ty(e+n,t+i),ty(e,t+i),ny(e,t)):(Xg(e+n,t+i),Jg(e,t))},quadraticCurveTo(e,t,n,i){const r=Kg(e,t),o=ey(e,t),a=Kg(n,i),s=ey(n,i);oy(Ug,r,a,Qg),oy(qg,o,s,Zg),Jg(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=Kg(e,t),s=ey(e,t),l=Kg(n,i),u=ey(n,i),c=Kg(r,o),f=ey(r,o);ay(Ug,a,l,c,Qg),ay(qg,s,u,f,Zg),Jg(c,f)},arc(e,t,n,i,r,o){if(i+=Wg,r+=Wg,Ug=n*Math.cos(r)+e,qg=n*Math.sin(r)+t,Math.abs(r-i)>jg)Xg(e-n,t-n),Xg(e+n,t+n);else{const a=i=>Xg(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=Vm)<0&&(i+=Vm),(r%=Vm)<0&&(r+=Vm),rr;++l,s-=Ym)a(s);else for(s=i-i%Ym+Ym,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=vy(e,t,t.fill),!0)}var xy=[];function _y(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=vy(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||xy),e.lineDashOffset=t.strokeDashOffset||0),!0)}function wy(e,t){return e.zindex-t.zindex||e.index-t.index}function ky(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 Ay(e){return function(t,n,i){Ey(n,(n=>{i&&!i.intersects(n.bounds)||Sy(e,t,n,n)}))}}function Dy(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Sy(e,t,n.items[0],n.items)}}function Sy(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(my(t,n),n.fill&&by(t,n,r)&&t.fill(),n.stroke&&_y(t,n,r)&&t.stroke()))}function My(e){return e=e||de,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,$y(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 Cy(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 Fy(e){return My(Cy(e))}function Oy(e,t){return"translate("+e+","+t+")"}function Ny(e){return"rotate("+e+")"}function Ty(e){return Oy(e.x||0,e.y||0)}function zy(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*=Gm),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 Oy(e.x||0,e.y||0)+(e.angle?" "+Ny(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(iy(e,n.angle),n),Bg(e,n).translate(n.x||0,n.y||0)},draw:Ay(i),pick:Fy(i),isect:n||cy(i)}}var Ry=zy("arc",(function(e,t){return _g.context(e)(t)}));function Py(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=Cy(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(iy(e),i),Bg(e,i[0]))},draw:Dy(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:fy,tip:n}}var Ly=Py("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?kg:wg).curve(Bm(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 Iy(e,t){const n=jy(t);e("d",Mg(null,t,n,n))}function Uy(e,t,n,i){const r=jy(t);e.beginPath(),Mg(e,t,(n||0)+r,(i||0)+r)}const qy=Cy(Uy),Wy=Cy(Uy,!1),Hy=Cy(Uy,!0);var Gy={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Ty(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&&(Uy(e,t,i,r),my(e,t),t.fill&&by(e,t,a)&&e.fill(),t.stroke&&!o&&_y(e,t,a)&&e.stroke()),e.save(),e.translate(i,r),t.clip&&By(e,t),n&&n.translate(-i,-r),Ey(t,(t=>{this.draw(e,t,n)})),n&&n.translate(i,r),e.restore(),o&&t.stroke&&a&&(Uy(e,t,i,r),my(e,t),_y(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 $y(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&&Sg(l)&&!Hy(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&Wy(e,l,a,s)?(e.restore(),l):(u=$y(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)&&qy(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:dy,content:function(e,t,n){e("clip-path",t.clip?Og(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Iy(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Iy(e,t):e("d","")}},Yy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Vy(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 Xy(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 Jy(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 Qy(e,t){return"center"===e?t/2:"right"===e?t:0}function Zy(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var Ky={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Vy(t,n),r=Xy(t,i),o=Jy(t,i),a=(t.x||0)-Qy(t.align,r),s=(t.y||0)-Zy(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Yy["xmlns:xlink"],"xlink:href"),e("transform",Oy(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Xy(t,n),r=Jy(t,n),o=(t.x||0)-Qy(t.align,i),a=(t.y||0)-Zy(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){Ey(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Vy(t,this);let r=Xy(t,i),o=Jy(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-Qy(t.align,r),f=(t.y||0)-Zy(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&&ov(e,t,i)&&(my(e,t),e.stroke())}}))},pick:My((function(e,t,n,i){return!!e.isPointInStroke&&ov(e,t,1)&&e.isPointInStroke(n,i)})),isect:hy},sv=zy("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),lv=zy("symbol",(function(e,t){return Ag.context(e)(t)}),fy);const uv=wt();var cv={height:gv,measureWidth:pv,estimateWidth:dv,width:dv,canvas:fv};function fv(e){cv.width=e&&ly?pv:dv}function dv(e,t){return hv(xv(e,t),gv(e))}function hv(e,t){return~~(.8*e.length*t)}function pv(e,t){return gv(e)<=0||!(t=xv(e,t))?0:mv(t,wv(e))}function mv(e,t){const n=`(${t}) ${e}`;let i=uv.get(n);return void 0===i&&(ly.font=t,i=ly.measureText(e).width,uv.set(n,i)),i}function gv(e){return null!=e.fontSize?+e.fontSize||0:11}function yv(e){return null!=e.lineHeight?e.lineHeight:gv(e)+2}function vv(e){return t=e.lineBreak&&e.text&&!_e(e.text)?e.text.split(e.lineBreak):e.text,_e(t)?t.length>1?t:t[0]:t;var t}function bv(e){const t=vv(e);return(_e(t)?t.length-1:0)*yv(e)}function xv(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(cv.width===pv){const t=wv(e);return e=>mv(e,t)}{const t=gv(e);return e=>hv(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,cv.width(t,n))),0)):i=cv.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*Gm,s,l);else if(2===n)return e.rotatedPoints(t.angle*Gm,s,l);return e}var Sv={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+kv(t),o=Av(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",Ev[t.align]||"start"),l?(n=Oy(a,s)+" "+Ny(l),(i||r)&&(n+=" "+Oy(i,r))):n=Oy(a+i,s+r),e("transform",n)},bound:Dv,draw:function(e,t,n){Ey(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=wv(t),e.textAlign=t.align||"left",r=(i=Av(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*Gm),r=o=0),r+=t.dx||0,o+=(t.dy||0)+kv(t),l=vv(t),my(e,t),_e(l))for(s=yv(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})),Cv={arc:Ry,area:Ly,group:Gy,image:Ky,line:ev,path:nv,rect:rv,rule:av,shape:sv,symbol:lv,text:Sv,trail:Mv};function Fv(e,t,n){var i=Cv[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new Ng),e,n)}var Ov={mark:null};function Nv(e,t,n){var i,r,o,a,s=Cv[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(Ov.mark=e,o=Ov),a=Fv(o,l,n),t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Ng,c)for(i=0,r=u.length;it;)e.removeChild(n[--i]);return e}function Wv(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Hv(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Gv(e,t){this._active=null,this._handlers={},this._loader=e||Ca(),this._tooltip=t||Yv}function Yv(e,t,n,i){e.element().setAttribute("title",i||"")}function Vv(e){this._el=null,this._bgcolor=null,this._loader=new Rg(e)}Lv.prototype={toJSON(e){return zv(this.root,e||0)},mark(e,t,n){const i=Bv(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},Gv.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=jv(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=Cv[a.marktype]).tip){for((o=Hv(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}}},Vv.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 Xv="dragenter",Jv="dragleave",Qv="dragover",Zv="mousedown",Kv="mousemove",eb="mouseout",tb="mouseover",nb="click",ib="mousewheel",rb="touchstart",ob="touchmove",ab="touchend",sb=Kv,lb=eb,ub=nb;function cb(e,t){Gv.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function fb(e,t){(e=>e===rb||e===ob||e===ab?[rb,ob,ab]:[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 db(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 hb(e){return function(t){this.fire(e,t),this._active=null}}ft(cb,Gv,{initialize(e,t,n){return this._canvas=e&&Iv(e,"canvas"),[nb,Zv,Kv,eb,Jv].forEach((e=>fb(this,e))),Gv.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",Xv,Jv,Qv,Zv,"mouseup",Kv,eb,tb,nb,"dblclick","wheel",ib,rb,ob,ab],DOMMouseScroll(e){this.fire(ib,e)},mousemove:db(Kv,tb,eb),dragover:db(Qv,Xv,Jv),mouseout:hb(eb),dragleave:hb(Jv),mousedown(e){this._down=this._active,this.fire(Zv,e)},click(e){this._down===this._active&&(this.fire(nb,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(rb,e,!0)},touchmove(e){this.fire(ob,e,!0)},touchend(e){this.fire(ab,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===ub&&i&&i.href?this.handleHref(t,i,i.href):e!==sb&&e!==lb||this.handleTooltip(t,i,e!==lb),r)for(let e=0,n=r.length;e=0&&i.splice(r,1),this},pickEvent(e){const t=Hv(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 Cv[e.marktype].pick.call(this,o,e,t,n,i,r)}});var pb="undefined"!=typeof window&&window.devicePixelRatio||1;function mb(e){Vv.call(this,e),this._options={},this._redraw=!1,this._dirty=new Ng,this._tempb=new Ng}const gb=Vv.prototype;function yb(e,t){Gv.call(this,e,t);const n=this;n._hrefHandler=vb(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=vb(n,((e,t)=>{n.handleTooltip(e,t,e.type!==lb)}))}ft(mb,Vv,{initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:ff(1,1,this._options.type),e&&this._canvas&&(qv(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),gb.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if(gb.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?pb: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||oe("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 Ng).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=Cv[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Ve(n)?(e.beginPath(),n(e),e.clip()):By(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 vb=(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)};ft(yb,Gv,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(ub,this._hrefHandler),i.removeEventListener(sb,this._tooltipHandler),i.removeEventListener(lb,this._tooltipHandler)),this._svg=i=e&&Iv(e,"svg"),i&&(i.addEventListener(ub,this._hrefHandler),i.addEventListener(sb,this._tooltipHandler),i.addEventListener(lb,this._tooltipHandler)),Gv.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:vb(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 bb="aria-hidden",xb="aria-label",_b="role",wb="aria-roledescription",kb="graphics-object",Eb="graphics-symbol",$b=(e,t,n)=>({[_b]:e,[wb]:t,[xb]:n||void 0}),Ab=Ot(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Db={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Ob(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 ${Jp(s)?"discrete":s} scale`+` with ${Fm(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Ob(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 "+De(e)}(o)}`+` with ${Fm(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${Fb(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Fb(e)}'`}},Sb={ariaRole:_b,ariaRoleDescription:wb,description:xb};function Mb(e,t){const n=!1===t.aria;if(e(bb,n||void 0),n||null==t.description)for(const t in Sb)e(Sb[t],void 0);else{const n=t.mark.marktype;e(xb,t.description),e(_b,t.ariaRole||("group"===n?kb:Eb)),e(wb,t.ariaRoleDescription||`${n} mark`)}}function Cb(e){return!1===e.aria?{[bb]:!0}:Ab[e.role]?null:Db[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return $b(t.role||Eb,t.desc,n.description||i(n))}catch(e){return null}}(e,Db[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return $b(n?kb:Eb,`${t} mark container`,e.description)}(e)}function Fb(e){return Ge(e.text).join(" ")}function Ob(e){try{return Ge(De(e.items).items[0].text).join(" ")}catch(e){return null}}const Nb=e=>(e+"").replace(/&/g,"&").replace(//g,">"),Tb=e=>Nb(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function zb(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>(null!=n&&(t+=` ${e}="${Tb(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+=Nb(e),a),toString:()=>e};return a}const Rb=e=>Pb(zb(),e)+"";function Pb(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}ft(qb,Vv,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=Uv(e,0,"svg",Ub),this._svg.setAttributeNS(Ib,"xmlns",Ub),this._svg.setAttributeNS(Ib,"xmlns:xlink",Yy["xmlns:xlink"]),this._svg.setAttribute("version",Yy.version),this._svg.setAttribute("class","marks"),qv(e,1),this._root=Uv(this._svg,0,"g",Ub),ex(this._root,jb),qv(this._svg,1)),this.background(this._bgcolor),Wb.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),Wb.background.apply(this,arguments)},resize(e,t,n,i){return Wb.resize.call(this,e,t,n,i),this._svg&&(ex(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=Uv(e,0,"rect",Ub),ex(n,{width:this._width,height:this._height,fill:t}));const i=Rb(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),qv(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,Hb(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n){if(!this.isDirty(t))return t._svg;const i=this._svg,r=Cv[t.marktype],o=!1===t.interactive?"none":null,a="g"===r.tag,s=Vb(t,e,n,"g",i);s.setAttribute("class",Wv(t));const l=Cb(t);for(const e in l)tx(s,e,l[e]);a||tx(s,"pointer-events",o),tx(s,"clip-path",t.clip?Og(this,t,t.group):null);let u=null,c=0;const f=e=>{const t=this.isDirty(e),n=Vb(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;Ey(n,(n=>{i=e.mark(t,n,i),++r})),qv(t,1+r)}(this,n,e)),u=n,++c};return r.nested?t.items.length&&f(t.items[0]):Ey(t,f),qv(s,c),s},_update(e,t,n){Xb=t,Jb=t.__values__,Mb(Zb,n),e.attr(Zb,n,this);const i=Qb[e.type];i&&i.call(this,e,t,n),Xb&&this.style(Xb,n)},style(e,t){if(null!=t){for(const n in Lb){let i="font"===n?_v(t):t[n];if(i===Jb[n])continue;const r=Lb[n];null==i?e.removeAttribute(r):(Tm(i)&&(i=zm(i,this._defs.gradient,nx())),e.setAttribute(r,i+"")),Jb[n]=i}for(const n in Bb)Kb(e,Bb[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=Uv(e,1,"defs",Ub)),i=Gb(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Uv(e,1,"defs",Ub)),i=Yb(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):qv(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let Xb=null,Jb=null;const Qb={group(e,t,n){const i=Xb=t.childNodes[2];Jb=i.__values__,e.foreground(Zb,n,this),Jb=t.__values__,Xb=t.childNodes[1],e.content(Zb,n,this);const r=Xb=t.childNodes[0];e.background(Zb,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Jb.events&&(tx(i,"pointer-events",o),tx(r,"pointer-events",o),Jb.events=o),n.strokeForeground&&n.stroke){const e=n.fill;tx(i,"display",null),this.style(r,n),tx(r,"stroke",null),e&&(n.fill=null),Jb=i.__values__,this.style(i,n),e&&(n.fill=e),Xb=null}else tx(i,"display","none")},image(e,t,n){!1===n.smooth?(Kb(t,"image-rendering","optimizeSpeed"),Kb(t,"image-rendering","pixelated")):Kb(t,"image-rendering",null)},text(e,t,n){const i=vv(n);let r,o,a,s;_e(i)?(o=i.map((e=>xv(n,e))),r=o.join("\n"),r!==Jb.text&&(qv(t,0),a=t.ownerDocument,s=yv(n),o.forEach(((e,i)=>{const r=jv(a,"tspan",Ub);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),Jb.text=r)):(o=xv(n,i),o!==Jb.text&&(t.textContent=o,Jb.text=o)),tx(t,"font-family",_v(n)),tx(t,"font-size",gv(n)+"px"),tx(t,"font-style",n.fontStyle),tx(t,"font-variant",n.fontVariant),tx(t,"font-weight",n.fontWeight)}};function Zb(e,t,n){t!==Jb[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(Xb,e,t,n):tx(Xb,e,t),Jb[e]=t)}function Kb(e,t,n){n!==Jb[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Jb[t]=n)}function ex(e,t){for(const n in t)tx(e,n,t[n])}function tx(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function nx(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function ix(e){Vv.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}ft(ix,Vv,{svg(){return this._text},_render(e){const t=zb();t.open("svg",it({},Yy,{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",jb,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=Cv[t.marktype],i=n.tag,r=[Mb,n.attr];e.open("g",{class:Wv(t),"clip-path":t.clip?Og(this,t,t.group):null},Cb(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=vv(o);if(_e(t)){const n={x:0,dy:yv(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]):Ey(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"]=_v(t),e["font-size"]=gv(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in Lb){let i=t[n];const o=Lb[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(Tm(i)&&(i=zm(i,r.gradient,"")),e[o]=i)}for(const e in Bb){const n=t[e];null!=n&&(o=o||[],o.push(`${Bb[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:Nm+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?(sx[e]=t,this):sx[e]}function ux(e,t,n){const i=[],r=(new Ng).union(t),o=e.marktype;return o?cx(e,r,n,i):"group"===o?fx(e,r,n,i):oe("Intersect scene must be mark node or group item.")}function cx(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(!gx(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function yx(e,t){return gx(Hm(e),Hm(t))}function vx(){Fg(),Om=0}const bx="top",xx="left",_x="right",wx="bottom",kx="start",Ex="middle",$x="end",Ax="x",Dx="y",Sx="group",Mx="axis",Cx="title",Fx="legend",Ox="row-header",Nx="row-footer",Tx="row-title",zx="column-header",Rx="column-footer",Px="column-title",Lx="fit-x",Bx="fit-y",jx="none",Ix="all",Ux="each",qx="flush",Wx="column",Hx="row";function Gx(e){ps.call(this,null,e)}function Yx(e,t,n){return t(e.bounds.clear(),e,n)}ft(Gx,ps,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=Cv[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=Yx(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===Sx||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(Yx(e,a)))),i.role){case Mx:case Fx:case Cx:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(Yx(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(Yx(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return px(i),t.modifies("bounds")}});const Vx=":vega_identifier:";function Xx(e){ps.call(this,0,e)}function Jx(e){ps.call(this,null,e)}function Qx(e){ps.call(this,null,e)}Xx.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ft(Xx,ps,{transform(e,t){const n=(r=t.dataflow)._signals[Vx]||(r._signals[Vx]=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}}),ft(Jx,ps,{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===Sx?zg:Tg;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 Zx={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&Kx(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},Kx=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),e_=(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},n_=e=>(e.forEach((e=>e.opacity=1)),e),i_=(e,t)=>e.reflow(t.modified()).modifies("opacity");function r_(e){ps.call(this,null,e)}ft(Qx,ps,{transform(e,t){const n=Zx[e.method]||Zx.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")&&(n_(a),t=i_(t,e)),t;if(a=a.filter(t_),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=n_(a),t=i_(t,e),r.length>=3&&e_(r,i)){do{r=n(r,i)}while(r.length>=3&&e_(r,i));r.length<3&&!De(a).opacity&&(r.length>1&&(De(r).opacity=0),De(a).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=((e,t,n)=>{var i=e.range(),r=new Ng;return t===bx||t===wx?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}}),ft(r_,ps,{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 o_=new Ng;function a_(e,t,n){return e[t]===n?0:(e[t]=n,1)}function s_(e){var t=e.items[0].orient;return t===xx||t===_x}function l_(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&&bv(g),x=0,_=0;switch(o_.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 bx:x=h||0,_=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&u_(e,g,o,y,b,0,-1,v);break;case xx:x=-d,_=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&u_(e,g,o,y,b,1,-1,v);break;case _x:x=n+d,_=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&u_(e,g,o,y,b,1,1,v);break;case wx:x=h||0,_=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&u_(e,g,o,y,0,0,1,v);break;default:x=a.x,_=a.y}return Bg(v.translate(x,_),a),a_(a,"x",x+l)|a_(a,"y",_+l)&&(a.bounds=o_,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function u_(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 c_=(e,t)=>Math.floor(Math.min(e,t)),f_=(e,t)=>Math.ceil(Math.max(e,t));function d_(e){return(new Ng).set(0,0,e.width||0,e.height||0)}function h_(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function p_(e,t,n){const i=we(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function m_(e){return e<0?Math.ceil(-e):0}function g_(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===qx?d_:h_,g=o_.set(0,0,0,0),y=p_(n.align,Wx),v=p_(n.align,Hx),b=p_(n.padding,Wx),x=p_(n.padding,Hx),_=n.columns||t.length,w=_<=0?1:Math.ceil(t.length/_),k=t.length,E=Array(k),$=Array(_),A=0,D=Array(k),S=Array(w),M=0,C=Array(k),F=Array(k),O=Array(k);for(r=0;r<_;++r)$[r]=0;for(r=0;r1)for(r=0;r0&&(C[r]+=f/2);if(v&&p_(n.center,Hx)&&1!==_)for(r=0;r0&&(F[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?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),w=E):(_=E,w=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(_-(b.x||0),w-(b.y||0))),b.x=_,b.y=w,e.dirty(b),$=a($,v[u])}return $}function x_(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 __(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",kx),c=u===$x?1:u===Ex?.5:0,f={align:Ux,bounds:s("bounds",qx),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case xx:f.anchor={x:Math.floor(i.x1)-l,column:$x,y:c*(a||i.height()+2*i.y1),row:u};break;case _x:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case bx:f.anchor={y:Math.floor(r.y1)-l,row:$x,x:c*(o||r.width()+2*r.x1),column:u};break;case wx: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:$x};break;case"bottom-left":f.anchor={x:l,y:a-l,row:$x};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:$x,row:$x}}return f}function w_(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 xx:r+=Math.ceil(a.bounds.width())+l;break;case _x:case wx:break;default:o+=a.bounds.height()+l}switch((r||o)&&E_(e,n,r,o),a.orient){case xx:c+=k_(t,n,a,s,1,1);break;case _x:u+=k_(t,n,a,$x,0,0)+l,c+=k_(t,n,a,s,1,1);break;case wx:u+=k_(t,n,a,s,0,0),c+=k_(t,n,a,$x,-1,0,1)+l;break;default:u+=k_(t,n,a,s,0,0)}(u||c)&&E_(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(E_(e,n,-u,0),E_(e,a,-u,0))}else(r||o)&&E_(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!==jx&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,Bg(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function k_(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:bv(n);return Math.round(i===kx?c:i===$x?f-d:.5*(u-d))}function E_(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 $_(e){ps.call(this,null,e)}function A_(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 D_(e){ps.call(this,null,e)}function S_(e){ps.call(this,null,e)}function M_(){return La({})}function C_(e){ps.call(this,null,e)}function F_(e){ps.call(this,[],e)}ft($_,ps,{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||_x)!==jx&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];g_(e,r,__(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!==Lx&&n.autosize.type!==Bx)f.union(i);else switch(t.orient){case xx:case _x:f.add(i.x1,0).add(i.x2,0);break;case bx:case wx: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===xx||l===_x?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Sx?l===xx?(m=r.y2,p=r.y1):l===_x?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===xx&&(m=i,p=0),o=u===kx?m:u===$x?p:(m+p)/2,h&&h.text){switch(l){case bx:case wx:b=d.bounds.height()+f;break;case xx:v=d.bounds.width()+f;break;case _x:v=-d.bounds.width()-f}o_.clear().union(h.bounds),o_.translate(v-(h.x||0),b-(h.y||0)),a_(h,"x",v)|a_(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(o_),h.mark.bounds.clear().union(o_),e.dirty(h)),o_.clear().union(h.bounds)}else o_.clear();switch(o_.union(d.bounds),l){case bx:g=o,y=r.y1-o_.height()-c;break;case xx:g=r.x1-o_.width()-c,y=o;break;case _x:g=r.x2+o_.width()+c,y=o;break;case wx:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return a_(a,"x",g)|a_(a,"y",y)&&(o_.translate(g,y),e.dirty(a),a.bounds.clear().union(o_),t.bounds.clear().union(o_),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===jx?(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===Lx?(l=Math.max(0,a-u-d),s=c+f+h):o===Bx?(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}}),ft(D_,ps,{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=gm(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||bm(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?ym(o,e.values,a):vm(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>La({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(La({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),ft(S_,ps,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||M_,o=e.key||Ra,a=this.value;return _e(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&oe("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=ut().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}}),ft(C_,ps,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(_e(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||he,l=r.enter||he,u=r.exit||he,c=(o&&!a?r[o]:s)||he;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!==he&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&u!==he&&(t.visit(t.REM,(t=>{u(t,e)})),n.modifies(u.output)),a||c!==he){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}}),ft(F_,ps,{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||fm,f=e.scale,d=+e.limit,h=gm(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===fm,m=e.format||$m(s,f,h,c,e.formatSpecifier,e.formatType,p),g=e.values||km(f,h);return u&&(l.rem=u),c===fm?(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=tt(o=r||8),u=u.map(((t,n)=>La({index:n,label:m(t,n,u),value:t,offset:o,size:r(t,e)}))),a&&(a=g[u.length],u.push(La({index:u.length,label:`…${g.length-u.length} entries`,value:a,offset:o,size:r(a,e)})))):"gradient"===c?(n=f.domain(),i=om(f,n[0],De(n)),g.length<3&&!e.values&&n[0]!==De(n)&&(g=[n[0],De(n)]),u=g.map(((e,t)=>La({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=+De(t),o=r-i;if(e.type===Mp){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(f),u=g.map(((e,t)=>La({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 O_=e=>e.source.x,N_=e=>e.source.y,T_=e=>e.target.x,z_=e=>e.target.y;function R_(e){ps.call(this,{},e)}R_.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"}]},ft(R_,ps,{transform(e,t){var n=e.sourceX||O_,i=e.sourceY||N_,r=e.targetX||T_,o=e.targetY||z_,a=e.as||"path",s=e.orient||"vertical",l=e.shape||"line",u=j_.get(l+"-"+s)||j_.get(l);return u||oe("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 P_=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,L_=(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},B_=(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},j_=ut({line:P_,"line-radial":(e,t,n,i)=>P_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:L_,"arc-radial":(e,t,n,i)=>L_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:B_,"curve-radial":(e,t,n,i)=>B_(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 I_(e){ps.call(this,null,e)}I_.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"]}]},ft(I_,ps,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||fe,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)/A_(d),g=El(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: "+Dt(t)));return t}function G_(e,t,n){return Ve(e)&&(t||n)?nm(e,Y_(t||[0,1],n)):e}function Y_(e,t){return t?e.slice().reverse():e}function V_(e){ps.call(this,null,e)}ft(W_,ps,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";return n===$p?$p+"-"+vp:(function(e){const t=e.type;return Xp(t)&&t!==kp&&t!==Ep&&(e.scheme||e.range&&e.range.length&&e.range.every(vt))}(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?$p+"-":3===t?Ap+"-":""),(i+n||vp).toLowerCase())}(e);for(r in i&&r===i.type||(this.value=i=Gp(r)()),e)if(!q_[r]){if("padding"===r&&U_(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!==Op&&e!==Fp&&oe("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===Fp?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*yp(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;return _e(t.scheme)?i=im(t.scheme,t.interpolate,t.interpolateGamma):(i=cm(t.scheme.toLowerCase()))||oe(`Unrecognized scheme name: ${t.scheme}`),n=e===Mp?n+1:e===Np?n-1:e===Dp||e===Sp?+t.schemeCount||5:n,Kp(e)?G_(i,r,t.reverse):Ve(i)?rm(G_(i,r),n):e===Cp?i:i.slice(0,n)}(i,t,n),Ve(o))){if(e.interpolator)return e.interpolator(o);oe(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&Kp(i))return e.interpolator(im(Y_(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(am(t.interpolate,t.interpolateGamma)):Ve(e.round)?e.round(r):Ve(e.rangeRound)&&e.interpolate(r?_d:xd),o&&e.range(Y_(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!_e(i)){const t=e.domain(),n=t[0],r=De(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||oe("Scale bins parameter missing step property."),ar&&(s=o*Math.floor(r/o)),i=El(a,s+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===Np&&(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(H_(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===vp||t===xp||t===_p)}(e);if(!a)return 0;if(U_(s)&&t.padding&&a[0]!==De(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(De(n)-n[0]),s=a/(a-2*i),l=e===bp?Ie(t,null,s):e===_p?Ue(t,null,s,.5):e===xp?Ue(t,null,s,r||1):e===wp?qe(t,null,s,o||1):je(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 rw(e,t){e&&aw.hasOwnProperty(e.type)&&aw[e.type](e,t)}var ow={Feature:function(e,t){rw(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 fw=1e-6,dw=1e-12,hw=Math.PI,pw=hw/2,mw=hw/4,gw=2*hw,yw=180/hw,vw=hw/180,bw=Math.abs,xw=Math.atan,_w=Math.atan2,ww=Math.cos,kw=Math.ceil,Ew=Math.exp,$w=(Math.floor,Math.hypot),Aw=Math.log,Dw=Math.pow,Sw=Math.sin,Mw=Math.sign||function(e){return e>0?1:e<0?-1:0},Cw=Math.sqrt,Fw=Math.tan;function Ow(e){return e>1?0:e<-1?hw:Math.acos(e)}function Nw(e){return e>1?pw:e<-1?-pw:Math.asin(e)}function Tw(){}var zw,Rw,Pw,Lw,Bw=new cw,jw=new cw,Iw={point:Tw,lineStart:Tw,lineEnd:Tw,polygonStart:function(){Iw.lineStart=Uw,Iw.lineEnd=Hw},polygonEnd:function(){Iw.lineStart=Iw.lineEnd=Iw.point=Tw,Bw.add(bw(jw)),jw=new cw},result:function(){var e=Bw/2;return Bw=new cw,e}};function Uw(){Iw.point=qw}function qw(e,t){Iw.point=Ww,zw=Pw=e,Rw=Lw=t}function Ww(e,t){jw.add(Lw*e-Pw*t),Pw=e,Lw=t}function Hw(){Ww(zw,Rw)}const Gw=Iw;var Yw=1/0,Vw=Yw,Xw=-Yw,Jw=Xw,Qw={point:function(e,t){eXw&&(Xw=e),tJw&&(Jw=t)},lineStart:Tw,lineEnd:Tw,polygonStart:Tw,polygonEnd:Tw,result:function(){var e=[[Yw,Vw],[Xw,Jw]];return Xw=Jw=-(Vw=Yw=1/0),e}};const Zw=Qw;var Kw,ek,tk,nk,ik=0,rk=0,ok=0,ak=0,sk=0,lk=0,uk=0,ck=0,fk=0,dk={point:hk,lineStart:pk,lineEnd:yk,polygonStart:function(){dk.lineStart=vk,dk.lineEnd=bk},polygonEnd:function(){dk.point=hk,dk.lineStart=pk,dk.lineEnd=yk},result:function(){var e=fk?[uk/fk,ck/fk]:lk?[ak/lk,sk/lk]:ok?[ik/ok,rk/ok]:[NaN,NaN];return ik=rk=ok=ak=sk=lk=uk=ck=fk=0,e}};function hk(e,t){ik+=e,rk+=t,++ok}function pk(){dk.point=mk}function mk(e,t){dk.point=gk,hk(tk=e,nk=t)}function gk(e,t){var n=e-tk,i=t-nk,r=Cw(n*n+i*i);ak+=r*(tk+e)/2,sk+=r*(nk+t)/2,lk+=r,hk(tk=e,nk=t)}function yk(){dk.point=hk}function vk(){dk.point=xk}function bk(){_k(Kw,ek)}function xk(e,t){dk.point=_k,hk(Kw=tk=e,ek=nk=t)}function _k(e,t){var n=e-tk,i=t-nk,r=Cw(n*n+i*i);ak+=r*(tk+e)/2,sk+=r*(nk+t)/2,lk+=r,uk+=(r=nk*e-tk*t)*(tk+e),ck+=r*(nk+t),fk+=3*r,hk(tk=e,nk=t)}const wk=dk;function kk(e){this._context=e}kk.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,gw)}},result:Tw};var Ek,$k,Ak,Dk,Sk,Mk=new cw,Ck={point:Tw,lineStart:function(){Ck.point=Fk},lineEnd:function(){Ek&&Ok($k,Ak),Ck.point=Tw},polygonStart:function(){Ek=!0},polygonEnd:function(){Ek=null},result:function(){var e=+Mk;return Mk=new cw,e}};function Fk(e,t){Ck.point=Ok,$k=Dk=e,Ak=Sk=t}function Ok(e,t){Dk-=e,Sk-=t,Mk.add(Cw(Dk*Dk+Sk*Sk)),Dk=e,Sk=t}const Nk=Ck;let Tk,zk,Rk,Pk;class Lk{constructor(e){this._append=null==e?Bk:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Bk;if(t!==Tk){const e=10**t;Tk=t,zk=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 Lk(r)),a},a.projection(e).digits(r).context(t)}function Ik(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Tw,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Uk(e,t){return bw(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 Hk(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i=0?1:-1,A=$*E,D=A>hw,S=g*w;if(l.add(_w(S*$*Sw(A),y*k+S*ww(A))),a+=D?E+$*gw:E,D^p>=n^x>=n){var M=Xk(Yk(h),Yk(b));Zk(M);var C=Xk(o,M);Zk(C);var F=(D^E>=0?-1:1)*Nw(C[2]);(i>F||i===F&&(M[0]||M[1]))&&(s+=D^E>=0?1:-1)}}return(a<-fw||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(nE))}return d}}function nE(e){return e.length>1}function iE(e,t){return((e=e.x)[0]<0?e[1]-pw-fw:pw-e[1])-((t=t.x)[0]<0?t[1]-pw-fw:pw-t[1])}const rE=tE((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?hw:-hw,l=bw(o-n);bw(l-hw)0?pw:-pw),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=hw&&(bw(n-r)fw?xw((Sw(t)*(o=ww(i))*Sw(n)-Sw(i)*(r=ww(t))*Sw(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*pw,i.point(-hw,r),i.point(0,r),i.point(hw,r),i.point(hw,0),i.point(hw,-r),i.point(0,-r),i.point(-hw,-r),i.point(-hw,0),i.point(-hw,r);else if(bw(e[0]-t[0])>fw){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 bw(i[0]-e)0?0:3:bw(i[0]-n)0?2:1:bw(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=Ik(),_={point:w,lineStart:function(){_.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())),_.point=w,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=eE(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&Wk(l,s,t,o,a),a.polygonEnd()),b=a,l=u=c=null}};function w(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(sE,Math.min(aE,p)),m=Math.max(sE,Math.min(aE,m))],x=[o=Math.max(sE,Math.min(aE,o)),a=Math.max(sE,Math.min(aE,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 _}}function uE(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 cE(e,t){return bw(e)>hw&&(e-=Math.round(e/gw)*gw),[e,t]}function fE(e,t,n){return(e%=gw)?t||n?uE(hE(e),pE(t,n)):hE(e):t||n?pE(t,n):cE}function dE(e){return function(t,n){return bw(t+=e)>hw&&(t-=Math.round(t/gw)*gw),[t,n]}}function hE(e){var t=dE(e);return t.invert=dE(-e),t}function pE(e,t){var n=ww(e),i=Sw(e),r=ww(t),o=Sw(t);function a(e,t){var a=ww(t),s=ww(e)*a,l=Sw(e)*a,u=Sw(t),c=u*n+s*i;return[_w(l*r-c*o,s*n-u*i),Nw(c*r+l*o)]}return a.invert=function(e,t){var a=ww(t),s=ww(e)*a,l=Sw(e)*a,u=Sw(t),c=u*r-l*o;return[_w(l*r+u*o,s*n+c*i),Nw(c*n-s*i)]},a}function mE(e){return function(t){var n=new gE;for(var i in e)n[i]=e[i];return n.stream=t,n}}function gE(){}function yE(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),uw(n,e.stream(Zw)),t(Zw.result()),null!=i&&e.clipExtent(i),e}function vE(e,t,n){return yE(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 bE(e,t,n){return vE(e,[[0,0],t],n)}function xE(e,t,n){return yE(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 _E(e,t,n){return yE(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)}cE.invert=cE,gE.prototype={constructor:gE,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 wE=16,kE=ww(30*vw);function EE(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,_=s+h,w=l+p,k=Cw(x*x+_*_+w*w),E=Nw(w/=k),$=bw(bw(w)-1)t||bw((y*M+v*C)/b-.5)>.3||a*d+s*h+l*p0,r=bw(t)>fw;function o(e,n){return ww(e)*ww(n)>t}function a(e,n,i){var r=[1,0,0],o=Xk(Yk(e),Yk(n)),a=Vk(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=Xk(r,o),d=Qk(r,u);Jk(d,Qk(o,c));var h=f,p=Vk(d,h),m=Vk(h,h),g=p*p-m*(Vk(d,d)-1);if(!(g<0)){var y=Cw(g),v=Qk(h,(-p-y)/m);if(Jk(v,d),v=Gk(v),!i)return v;var b,x=e[0],_=n[0],w=e[1],k=n[1];_0^v[1]<(bw(v[0]-x)hw^(x<=v[0]&&v[0]<=_)){var A=Qk(h,(-p+y)/m);return Jk(A,d),[v,Gk(A)]}}}function s(t,n){var r=i?e:hw-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return tE(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?hw:-hw),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||Uk(t,h)||Uk(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&&Uk(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=ww(t),s=Sw(t),l=i*n;null==r?(r=t+i*gw,o=t-l/2):(r=oE(a,r),o=oE(a,o),(i>0?ro)&&(r+=i*gw));for(var u,c=r;i>0?c>o:c2?e[2]%360*vw:0,M()):[g*yw,y*yw,v*yw]},D.angle=function(e){return arguments.length?(b=e%360*vw,M()):b*yw},D.reflectX=function(e){return arguments.length?(x=e?-1:1,M()):x<0},D.reflectY=function(e){return arguments.length?(_=e?-1:1,M()):_<0},D.precision=function(e){return arguments.length?(a=EE(s,A=e*e),C()):Cw(A)},D.fitExtent=function(e,t){return vE(D,e,t)},D.fitSize=function(e,t){return bE(D,e,t)},D.fitWidth=function(e,t){return xE(D,e,t)},D.fitHeight=function(e,t){return _E(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,M()}}function ME(e){var t=0,n=hw/3,i=SE(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*vw,n=e[1]*vw):[t*yw,n*yw]},r}function CE(e,t){var n=Sw(e),i=(n+Sw(t))/2;if(bw(i)2?e[2]*vw:0),t.invert=function(t){return(t=e.invert(t[0]*vw,t[1]*vw))[0]*=yw,t[1]*=yw,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===PE?[[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 BE(e){return Fw((pw+e)/2)}function jE(e,t){var n=ww(e),i=e===t?Sw(e):Aw(n/ww(t))/Aw(BE(t)/BE(e)),r=n*Dw(BE(e),i)/i;if(!i)return PE;function o(e,t){r>0?t<-pw+fw&&(t=-pw+fw):t>pw-fw&&(t=pw-fw);var n=r/Dw(BE(t),i);return[n*Sw(i*e),r-n*ww(i*e)]}return o.invert=function(e,t){var n=r-t,o=Mw(i)*Cw(e*e+n*n),a=_w(e,bw(n))*Mw(n);return n*i<0&&(a-=hw*Mw(e)*Mw(n)),[a/i,2*xw(Dw(r/o,1/i))-pw]},o}function IE(e,t){return[e,t]}function UE(e,t){var n=ww(e),i=e===t?Sw(e):(n-ww(t))/(t-e),r=n/i+e;if(bw(i)fw&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},QE.invert=TE(Nw),ZE.invert=TE((function(e){return 2*xw(e)})),KE.invert=function(e,t){return[-t,2*xw(Ew(e))-pw]};var e$=Math.abs,t$=(Math.atan,Math.atan2,Math.ceil,Math.cos),n$=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),i$=(Math.tan,1e-6),r$=Math.PI,o$=r$/2,a$=(Math.SQRT1_2,l$(2));function s$(e){return e>1?o$:e<-1?-o$:Math.asin(e)}function l$(e){return e>0?Math.sqrt(e):0}function u$(e,t){var n,i=e*n$(t),r=30;do{t-=n=(t+n$(t)-i)/(1+t$(t))}while(e$(n)>i$&&--r>0);return t/2}l$(r$);var c$=function(e,t,n){function i(i,r){return[e*i*t$(r=u$(n,r)),t*n$(r)]}return i.invert=function(i,r){return r=s$(r/t),[i/(e*t$(r)),s$((2*r+n$(2*r))/n)]},i}(a$/o$,a$,r$);const f$=jk(),d$=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function h$(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(m$[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=jk().projection(i),i.copy=i.copy||function(){const e=n();return d$.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},Hp(i)}}(e,t),this):m$[e]||null}function p$(e){return e&&e.path||f$}const m$={albers:OE,albersusa:function(){var e,t,n,i,r,o,a=OE(),s=FE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=FE().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 m$)h$(e,m$[e]);function g$(e,t,n){var i=El(e,t-fw,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function y$(e,t,n){var i=El(e,t-fw,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}function v$(){}const b$=[[],[[[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 x$(){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,b$[u<<1].forEach(p);++a=i,b$[l|u<<1].forEach(p);for(b$[u<<0].forEach(p);++s=i,c=n[s*e]>=i,b$[u<<1|c<<2].forEach(p);++a=i,f=c,c=n[s*e+a+1]>=i,b$[l|u<<1|c<<2|f<<3].forEach(p);b$[u|c<<3].forEach(p)}for(a=-1,c=n[s*e]>=i,b$[c<<2].forEach(p);++a=i,b$[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]}}b$[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||oe("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:v$,i):n===a},i}function _$(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 k$(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 E$(e,t,n){return function(i){var r=rt(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?rn(o,a,e):s/(e+1);return El(o+l,a,l)}}function $$(e){ps.call(this,null,e)}function A$(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 D$(e,t,n){const i=e>=0?e:Cs(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function S$(e){return Ve(e)?e:tt(+e)}function M$(){var e=e=>e[0],t=e=>e[1],n=fe,i=[-1,-1],r=960,o=500,a=2;function s(s,l){const u=D$(i[0],s,e)>>a,c=D$(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?(C$(h,p,m,g,u),F$(h,p,g,m,c),C$(h,p,m,g,u),F$(h,p,g,m,c),C$(h,p,m,g,u),F$(h,p,g,m,c)):u>0?(C$(h,p,m,g,u),C$(h,p,g,m,u),C$(h,p,m,g,u),y=g):c>0&&(F$(h,p,m,g,c),F$(h,p,g,m,c),F$(h,p,m,g,c),y=g);const v=l?Math.pow(2,-2*a):1/A_(y);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=S$(t),s):e},s.y=function(e){return arguments.length?(t=S$(e),s):t},s.weight=function(e){return arguments.length?(n=S$(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||oe("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||oe("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 F$(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 O$(e){ps.call(this,null,e)}$$.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"}]},ft($$,ps,{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||ue,o=x$().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const i=E$(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>vs(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,_e(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=(gt(r)?r:r[0])||1,s=(gt(r)?r:r[1])||1,l=o&&o[0]||0,u=o&&o[1]||0;e.forEach(A$(t,a,s,l,u))}(i,n,t,e),i.forEach((e=>{l.push(ja(t,La(null!=s?{[s]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),O$.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 N$=["x","y","weight","size","cellSize","bandwidth"];function T$(e,t){return N$.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function z$(e){ps.call(this,null,e)}ft(O$,ps,{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;iLa(function(e,t){for(let n=0;nfw})).map(l)).concat(El(kw(o/h)*h,r,h).filter((function(e){return bw(e%m)>fw})).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=g$(o,r,90),u=y$(t,e,g),c=g$(s,a,90),f=y$(i,n,g),y):g},y.extentMajor([[-180,-90+fw],[180,90-fw]]).extentMinor([[-180,-80-fw],[180,80+fw]])}()}function q$(e){ps.call(this,null,e)}function W$(e){if(!Ve(e))return!1;const t=Ot(te(e));return t.$x||t.$y||t.$value||t.$max}function H$(e){ps.call(this,null,e),this.modified(!0)}function G$(e,t,n){Ve(e[t])&&e[t](n)}function Y$(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 V$(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function X$(e){return e[0]}function J$(e){return e[1]}function Q$(e,t,n){var i=new Z$(null==t?X$:t,null==n?J$:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function Z$(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 K$(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}L$.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ft(L$,ps,{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&&ue,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(te(l))||a&&t.modified(te(a))||s&&t.modified(te(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:R$,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:P$,features:i}}}),B$.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"}]},ft(B$,ps,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||ue,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=p$(e.projection),n.materialize().reflow()):a=r===ue||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)}}),j$.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"]}]},ft(j$,ps,{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)}}),I$.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"}]},ft(I$,ps,{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}(p$(e.projection),e.field||se("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),U$.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}]},ft(U$,ps,{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(Ia(i[0],n)):t.add.push(La(n)),i[0]=n,t}}),q$.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"}]},ft(q$,ps,{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||ue,o=function(e,t){let n;return Ve(e)?(n=n=>e(n,t),n.dep=W$(e)):e?n=tt(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=>Bf(e(n,t)),n.dep=W$(e)):n=tt(Bf(e||"#888")),n}(e.color,e),s=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?vs(n.map((e=>vs(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=it({},e,l);i||(n.$max=vs(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]:ce,d=ff(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]&&G$(n,t,e[t])}))):d$.forEach((t=>{e.modified(t)&&G$(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:P$,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===P$?e.features:Ge(e).filter((e=>null!=e)).map((e=>e.type===R$?e:{type:R$,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 eA=Q$.prototype=Z$.prototype;function tA(e){return function(){return e}}function nA(e){return 1e-6*(e()-.5)}function iA(e){return e.x+e.vx}function rA(e){return e.y+e.vy}eA.copy=function(){var e,t,n=new Z$(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=K$(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]=K$(t));return n},eA.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Y$(this.cover(t,n),t,n,e)},eA.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)},eA.removeAll=function(e){for(var t=0,n=e.length;t{}};function aA(){for(var e,t=0,n=arguments.length,i={};t=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a0)for(var n,i,r=new Array(n),o=0;o=0&&t._call.call(void 0,e),t=t._next;--hA}()}finally{hA=0,function(){for(var e,t,n=fA,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:fA=t);dA=e,SA(i)}(),vA=0}}function DA(){var e=xA.now(),t=e-yA;t>gA&&(bA-=t,yA=e)}function SA(e){hA||(pA&&(pA=clearTimeout(pA)),e-vA>24?(e<1/0&&(pA=setTimeout(AA,e-xA.now()-bA)),mA&&(mA=clearInterval(mA))):(mA||(yA=xA.now(),mA=setInterval(DA,gA)),hA=1,_A(AA)))}EA.prototype=$A.prototype={constructor:EA,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?wA():+n)+(null==t?0:+t),this._next||dA===this||(dA?dA._next=this:fA=this,dA=this),this._call=e,this._time=n,SA()},stop:function(){this._call&&(this._call=null,this._time=1/0,SA())}};const MA=4294967296;function CA(e){return e.x}function FA(e){return e.y}var OA=Math.PI*(3-Math.sqrt(5));function NA(e){return e.index}function TA(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}const zA={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,l=0;for(r=0;ru+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=nA(n))*f),0===d&&(p+=(d=nA(n))*d),p[s(e,t,i),e])));for(a=0,r=new Array(u);at(e,n):t)}function HA(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 GA(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=VA)):void 0===t&&(t=YA);for(var n,i,r,o,a,s=new QA(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 QA(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(JA)}function YA(e){return e.children}function VA(e){return Array.isArray(e)?e[1]:null}function XA(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function JA(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function QA(e){this.data=e,this.depth=this.height=0,this.parent=null}function ZA(e){return null==e?null:KA(e)}function KA(e){if("function"!=typeof e)throw new Error;return e}function eD(){return 0}function tD(e){return function(){return e}}jA.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:BA}]},ft(jA,ps,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(PA),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&IA(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=$A(f),u=cA("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%MA)/MA}();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()),IA(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(LA)||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 GA(this).eachBefore(XA)},[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 aD(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*A*S))/(2*A):S/D);return{x:i+w+k*M,y:r+E+$*M,r:M}}function cD(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 fD(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 dD(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 hD(e){this._=e,this.next=null,this.previous=null}function pD(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;cD(i,n,r=e[2]),n=new hD(n),i=new hD(i),r=new hD(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 SD(e,t-1)&&!SD(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(DD),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(DD(e)),d.push(kD));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a=0&&(u=d[e]).data===kD;--e)u.data=null}if(s.parent=_D,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(JA),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=ZA(e),i):t},i.parentId=function(e){return arguments.length?(n=ZA(e),i):n},i.path=function(t){return arguments.length?(e=ZA(t),i):e},i}function DD(e){let t=e.length;if(t<2)return"";for(;--t>1&&!SD(e,t););return e.slice(0,t)}function SD(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function MD(e,t){return e.parent===t.parent?1:2}function CD(e){var t=e.children;return t?t[0]:e.t}function FD(e){var t=e.children;return t?t[t.length-1]:e.t}function OD(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 ND(e,t,n){return e.a.parent===t.parent?e.a:n}function TD(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 zD(e,t){return e.parent===t.parent?1:2}function RD(e,t){return e+t.x}function PD(e,t){return Math.max(e,t.y)}function LD(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}(BD),UD=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}(BD);function qD(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function WD(e){ps.call(this,null,e)}WD.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const HD=e=>e.values;function GD(){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 YD(e){ps.call(this,null,e)}ft(WD,ps,{transform(e,t){t.source||oe("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&&za(e.data)&&r.rem.push(e.data)})),this.value=o=GA({values:Ge(e.keys).reduce(((e,t)=>(e.key(t),e)),GD()).entries(r.source)},HD),n&&o.each((e=>{e.children&&(e=La(e.data),r.add.push(e),r.source.push(e))})),qD(o,Ra,Ra)),r.source.root=o,r}});const VD=(e,t)=>e.parent===t.parent?1:2;ft(YD,ps,{transform(e,t){t.source&&t.source.root||oe(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(Ua(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)%nD)/nD}();return r.x=t/2,r.y=n/2,e?r.eachBefore(gD(e)).eachAfter(yD(i,.5,o)).eachBefore(vD(1)):r.eachBefore(gD(mD)).eachAfter(yD(eD,1,o)).eachAfter(yD(i,r.r/Math.min(t,n),o)).eachBefore(vD(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=ZA(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:tD(+e),r):i},r},params:["radius","size","padding"],fields:XD});const QD=["x0","y0","x1","y1","depth","children"];function ZD(e){YD.call(this,e)}function KD(e){ps.call(this,null,e)}ZD.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:QD.length,default:QD}]},ft(ZD,YD,{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&&xD(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 TD(i[r],r)),n.parent=t;return(a.parent=new TD(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=FD(s),o=CD(o),s&&o;)l=CD(l),(a=FD(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(OD(ND(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!FD(a)&&(a.t=s,a.m+=f-c),o&&!CD(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=zD,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(RD,0)/e.length}(n),t.y=function(e){return 1+e.reduce(PD,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}},tS=["x","y","depth","children"];function nS(e){YD.call(this,e)}function iS(e){ps.call(this,[],e)}nS.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:tS.length,default:tS}]},ft(nS,YD,{layout(e){const t=e||"tidy";if(st(eS,t))return eS[t]();oe("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:tS}),iS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ft(iS,ps,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||oe("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Ra(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Ra(t)]&&o[Ra(n)]&&r.add.push(La({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Ra(e)]=1)),n.forEach((e=>{(o[Ra(e.source)]||o[Ra(e.target)])&&r.mod.push(e)}))),r}});const rS={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:xD,slice:LD,slicedice:function(e,t,n,i,r){(1&e.depth?LD:xD)(e,t,n,i,r)},squarify:ID,resquarify:UD},oS=["x0","y0","x1","y1","depth","children"];function aS(e){YD.call(this,e)}aS.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:oS.length,default:oS}]},ft(aS,YD,{layout(){const e=function(){var e=ID,t=!1,n=1,i=1,r=[0],o=eD,a=eD,s=eD,l=eD,u=eD;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(bD),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=>{st(rS,t)?e.tile(rS[t]):oe("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:oS});const sS=4278190080;function lS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function uS(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>uS(e,t.items,n)))})):Cv[i].draw(e,{items:n?t.map(cS):t})}function cS(e){const t=ja(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const fS=5,dS=31,hS=32,pS=new Uint32Array(hS+1),mS=new Uint32Array(hS+1);mS[0]=0,pS[0]=~mS[0];for(let e=1;e<=hS;++e)mS[e]=mS[e-1]<<1|1,pS[e]=~mS[e];function gS(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 yS(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 vS=[-1,-1,1,1],bS=[-1,1,-1,1],xS=["right","center","left"],_S=["bottom","middle","top"];function wS(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 kS={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},ES={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=cv.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,yS(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=cv.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,_,w,k,E,$,A,D,S,M=n?c:0,C=!1,F=!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),w=e(h),_=~~((x+w)/2),k=e(p),$=e(m),E=~~((k+$)/2),v=_;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);for(v=_;v<=w;++v)for(b=E;b<=$;++b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);C||n||(A=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,A>=O&&!gS(g,y,f,c,r,o)&&!yS(e,g,y,c,f,c,a,null)&&(O=A,t.x=g,t.y=y,F=!0))}return!(!C&&!F||(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=cv.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,M=0;for(let i=0;i=1;)E=(w+k)/2,yS(e,v,b,f,d,E,a,s)?k=E:w=E;w>A&&(t.x=v,t.y=b,A=w,D=!0)}}D||n||($=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,$>=M&&!gS(v,b,d,f,r,o)&&!yS(e,v,b,f,d,f,a,null)&&(M=$,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 $S(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 _=-1,w=-1;const k=e.map((e=>{const t=v?cv.width(e,e.text):void 0;return _=Math.max(_,t),w=Math.max(w,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+hS)/hS));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>>>fS]&1<<(r&dS)},set:(t,n)=>{const r=n*e+t;i(r>>>fS,1<<(r&dS))},clear:(t,n)=>{const i=n*e+t;r(i>>>fS,~(1<<(i&dS)))},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>>>fS,u=s>>>fS,l===u){if(n[l]&pS[a&dS]&mS[1+(s&dS)])return!0}else{if(n[l]&pS[a&dS])return!0;if(n[u]&mS[1+(s&dS)])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>>>fS,u=s>>>fS,l===u)i(l,pS[a&dS]&mS[1+(s&dS)]);else for(i(l,pS[a&dS]),i(u,mS[1+(s&dS)]),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>>>fS,u=s>>>fS,l===u)r(l,mS[a&dS]|pS[1+(s&dS)]);else for(r(l,mS[a&dS]),r(u,pS[1+(s&dS)]),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 $;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;ee.datum));$=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=ff(o,a).getContext("2d"),u=ff(o,a).getContext("2d"),c=s&&ff(o,a).getContext("2d");n.forEach((e=>uS(l,e,!1))),uS(u,t,!1),s&&uS(c,t,!0);const f=lS(l,o,a),d=lS(u,o,a),h=s&&lS(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 A=g?ES[c](E,$,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,_=u[4+d]+m*c*d/2+i[r]*d*p,v=_-c/2,b=_+c/2,w=e(g),E=e(v),$=e(b),!A){if(!wS(w,w,E,$,a,s,0,0,0,0,0,h))continue;A=cv.width(t.datum,t.datum.text)}if(x=g+m*A*f/2,g=x-A/2,y=x+A/2,w=e(g),k=e(y),wS(w,k,E,$,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:_,t.align=xS[f*m+1],t.baseline=_S[d*m+1],a.setRange(w,E,k,$),!0}return!1}}(E,$,h,d);return k.forEach((e=>e.opacity=+A(e))),k}const AS=["x","y","opacity","align","baseline"],DS=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function SS(e){ps.call(this,null,e)}function MS(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)}}),CS.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}]},ft(CS,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=MS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ee),o=r.length,a=e.as||[ee(e.x),ee(e.y)],s=[];i.forEach((t=>{vl(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||[ee(e.x),ee(e.y)],u=FS[o],c=[];let f=e.extent;st(FS,o)||oe("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(La({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const d=f||rt(n,e.x),h=e=>{const t={};for(let e=0;eh([e,i.predict(e)]))):wl(i.predict,d,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const NS=134217729;function TS(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 $=e-r,A=n-r,D=t-o,S=i-o;x=$*S,d=NS*$,h=d-(d-$),p=$-h,d=NS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=D*A,d=NS*D,h=d-(d-D),p=D-h,d=NS*A,m=d-(d-A),g=A-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,RS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,RS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,RS[2]=v-(E-f)+(y-f),RS[3]=E;let M=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,RS),C=22204460492503146e-32*a;if(M>=C||-M>=C)return M;if(f=e-$,s=e-($+f)+(f-r),f=n-A,u=n-(A+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 M;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=$*c+S*s-(D*u+A*l),M>=C||-M>=C)return M;x=s*S,d=NS*s,h=d-(d-s),p=s-h,d=NS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=l*A,d=NS*l,h=d-(d-l),p=l-h,d=NS*A,m=d-(d-A),g=A-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const F=TS(4,RS,4,jS,PS);x=$*c,d=NS*$,h=d-(d-$),p=$-h,d=NS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=D*u,d=NS*D,h=d-(d-D),p=D-h,d=NS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const O=TS(F,PS,4,jS,LS);x=s*c,d=NS*s,h=d-(d-s),p=s-h,d=NS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=l*u,d=NS*l,h=d-(d-l),p=l-h,d=NS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const N=TS(O,LS,4,jS,BS);return BS[N-1]}(e,t,n,i,r,o,u)}zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(8),zS(8),zS(8),zS(4),zS(8),zS(8),zS(8),zS(12),zS(192),zS(192),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(4),zS(4),zS(4),zS(8),zS(16),zS(16),zS(16),zS(32),zS(32),zS(48),zS(64),zS(1152),zS(1152),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(1152),zS(1152),zS(1152),zS(1152),zS(1152),zS(2304),zS(2304),zS(3456),zS(5760),zS(8),zS(8),zS(8),zS(16),zS(24),zS(48),zS(48),zS(96),zS(192),zS(384),zS(384),zS(384),zS(768),zS(96),zS(96),zS(96),zS(1152);const US=Math.pow(2,-52),qS=new Uint32Array(512);class WS{static from(e,t=JS,n=QS){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(IS(g,y,v,b,_,w)<0){const e=h,t=v,n=b;h=p,v=_,b=w,p=e,_=t,w=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)<=US&&Math.abs(c-a)<=US)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],IS(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],IS(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=qS[--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(GS(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;XS(e,n+i>>1,r),t[e[n]]>t[e[i]]&&XS(e,n,i),t[e[r]]>t[e[i]]&&XS(e,r,i),t[e[n]]>t[e[r]]&&XS(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]s);if(o=o-n?(VS(e,t,r,i),VS(e,t,n,o-1)):(VS(e,t,n,o-1),VS(e,t,r,i))}}function XS(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function JS(e){return e[0]}function QS(e){return e[1]}const ZS=1e-6;class KS{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)>ZS||Math.abs(this._y1-r)>ZS)&&(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 eM{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 tM{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 tM(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=iM(t-l[2*e],2)+iM(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=iM(t-l[2*i],2)+iM(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>=dM<<5&&(f=0,d+=h,h=0),d+l>=hM)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*fM),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 _=r.getImageData(0,0,(dM<<5)/o,hM/o).data,w=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u>5),A=_[(d+c)*(dM<<5)+(f+u)<<2]?1<<31-u%32:0;w[$]|=A,k|=A}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=w.slice(0,(t.y1-t.y0)*s)}}}function mM(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 gM(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 yM(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||!mM(t,e,s[0]))&&(!n||yM(t,n))){for(var m,g=t.sprite,y=t.width>>5,v=s[0]>>5,b=t.x-(y<<4),x=127&b,_=32-x,w=t.y1-t.y0,k=(t.y+t.y0)*v+(b>>5),E=0;E>>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=(dM<<5)/t,e.height=hM/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(ff()),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,pM(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?gM(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=bM(e),f):t},f.fontStyle=function(e){return arguments.length?(i=bM(e),f):i},f.fontWeight=function(e){return arguments.length?(r=bM(e),f):r},f.rotate=function(e){return arguments.length?(o=bM(e),f):o},f.text=function(t){return arguments.length?(e=bM(t),f):e},f.spiral=function(e){return arguments.length?(l=xM[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=bM(e),f):n},f.padding=function(e){return arguments.length?(a=bM(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}(),e)}kM.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:_M}]},ft(kM,ps,{transform(e,t){!e.size||e.size[0]&&e.size[1]||oe("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||wM.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||_M;let a,s=e.fontSize||14;if(Ve(s)?a=e.fontSizeRange:s=tt(s),a){const e=s,t=Gp("sqrt")().domain(rt(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(Os).layout(),u=r.size(),c=u[0]>>1,f=u[1]>>1,d=l.length;for(let e,t,n=0;nnew Uint8Array(e),$M=e=>new Uint16Array(e),AM=e=>new Uint32Array(e);function DM(e,t,n){const i=(t<257?EM:t<65537?$M:AM)(e);return n&&i.set(n),i}function SM(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=AM(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 CM(e){ps.call(this,function(){let e=8,t=[],n=AM(0),i=DM(0,e),r=DM(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=DM(t,e,i),r=DM(t,e))}}}(),e),this._indices=null,this._dims=null}function FM(e){ps.call(this,null,e)}CM.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}}]},ft(CM,ps,{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 OM="Literal",NM="CallExpression";function TM(e){this.type=e}var zM,RM,PM,LM,BM;TM.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 NM: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",zM[UM]="Identifier",zM[qM]="Keyword",zM[WM]="Null",zM[HM]="Numeric",zM[GM]="Punctuator",zM[YM]="String",zM[9]="RegularExpression";var VM="ArrayExpression",XM="BinaryExpression",JM="CallExpression",QM="ConditionalExpression",ZM="Identifier",KM="Literal",eC="LogicalExpression",tC="MemberExpression",nC="ObjectExpression",iC="Property",rC="UnaryExpression",oC="Unexpected token %0",aC="Unexpected number",sC="Unexpected string",lC="Unexpected identifier",uC="Unexpected reserved word",cC="Unexpected end of input",fC="Invalid regular expression",dC="Invalid regular expression: missing /",hC="Octal literals are not allowed in strict mode.",pC="Duplicate data property in object literal not allowed in strict mode",mC="ILLEGAL",gC="Disabled.",yC=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]"),vC=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 bC(e,t){if(!e)throw new Error("ASSERT: "+t)}function xC(e){return e>=48&&e<=57}function _C(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function wC(e){return"01234567".indexOf(e)>=0}function kC(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 EC(e){return 10===e||13===e||8232===e||8233===e}function $C(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&yC.test(String.fromCharCode(e))}function AC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&vC.test(String.fromCharCode(e))}const DC={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 SC(){for(;PM1114111||"}"!==e)&&qC({},oC,mC),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function FC(){var e,t;for(e=RM.charCodeAt(PM++),t=String.fromCharCode(e),92===e&&(117!==RM.charCodeAt(PM)&&qC({},oC,mC),++PM,(e=MC("u"))&&"\\"!==e&&$C(e.charCodeAt(0))||qC({},oC,mC),t=e);PM>>="===(i=RM.substr(PM,4))?{type:GM,value:i,start:r,end:PM+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:GM,value:n,start:r,end:PM+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:GM,value:t,start:r,end:PM+=2}:("//"===t&&qC({},oC,mC),"<>=!+-*%&|^/".indexOf(a)>=0?(++PM,{type:GM,value:a,start:r,end:PM}):void qC({},oC,mC))}function NC(){var e,t,n;if(bC(xC((n=RM[PM]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=PM,e="","."!==n){if(e=RM[PM++],n=RM[PM],"0"===e){if("x"===n||"X"===n)return++PM,function(e){let t="";for(;PM=LM)return{type:IM,start:PM,end:PM};const e=RM.charCodeAt(PM);return $C(e)?function(){var e,t;return e=PM,t=92===RM.charCodeAt(PM)?FC():function(){var e,t;for(e=PM++;PM=0&&PM(bC(t=0&&qC({},fC,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";qC({},fC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){qC({},fC)}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:PM}}()),RC()):WC(zC())}return n}function ZC(){const e=[];if(HC("("),!GC(")"))for(;PM":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 rF(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=BM,l=nF(),0===(r=iF(i=BM)))return l;for(i.prec=r,zC(),t=[e,BM],o=[l,i,a=nF()];(r=iF(BM))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=PC(s,l,a),o.push(n);(i=zC()).prec=r,o.push(i),t.push(BM),n=nF(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=PC(o[u-1].value,o[u-2],n),u-=2;return n}(),GC("?")&&(zC(),t=rF(),HC(":"),e=function(e,t,n){const i=new TM(QM);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,rF())),e}function oF(){const e=rF();if(GC(","))throw new Error(gC);return e}function aF(e){PM=0,LM=(RM=e).length,BM=null,RC();const t=oF();if(BM.type!==IM)throw new Error("Unexpect token after expression.");return t}var sF={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 lF(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&&oe("Missing arguments to clamp function."),t.length>3&&oe("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&&oe("Missing arguments to if function."),t.length>3&&oe("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function uF(e){const t=(e=e||{}).allowed?Ot(e.allowed):{},n=e.forbidden?Ot(e.forbidden):{},i=e.constants||sF,r=(e.functions||lF)(f),o=e.globalvar,a=e.fieldvar,s=Ve(o)?o:e=>`${o}["${e}"]`;let l={},u={},c=0;function f(e){if(vt(e))return e;const t=d[e.type];return null==t&&oe("Unsupported type: "+e.type),t(e)}const d={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:st(n,r)?oe("Illegal identifier: "+r):st(i,r)?i[r]:st(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&&oe("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=st(r,t)&&r[t];return i||oe("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 cF,fF,dF,hF,pF,mF,gF,yF,vF,bF,xF,_F,wF,kF,EF,$F,AF=new cw,DF=new cw,SF={point:Tw,lineStart:Tw,lineEnd:Tw,polygonStart:function(){AF=new cw,SF.lineStart=MF,SF.lineEnd=CF},polygonEnd:function(){var e=+AF;DF.add(e<0?gw+e:e),this.lineStart=this.lineEnd=this.point=Tw},sphere:function(){DF.add(gw)}};function MF(){SF.point=FF}function CF(){OF(cF,fF)}function FF(e,t){SF.point=OF,cF=e,fF=t,dF=e*=vw,hF=ww(t=(t*=vw)/2+mw),pF=Sw(t)}function OF(e,t){var n=(e*=vw)-dF,i=n>=0?1:-1,r=i*n,o=ww(t=(t*=vw)/2+mw),a=Sw(t),s=pF*a,l=hF*o+s*ww(r),u=s*i*Sw(r);AF.add(_w(u,l)),dF=e,hF=o,pF=a}var NF,TF,zF,RF,PF,LF,BF,jF,IF,UF,qF,WF,HF,GF,YF,VF,XF={point:JF,lineStart:ZF,lineEnd:KF,polygonStart:function(){XF.point=eO,XF.lineStart=tO,XF.lineEnd=nO,kF=new cw,SF.polygonStart()},polygonEnd:function(){SF.polygonEnd(),XF.point=JF,XF.lineStart=ZF,XF.lineEnd=KF,AF<0?(mF=-(yF=180),gF=-(vF=90)):kF>fw?vF=90:kF<-fw&&(gF=-90),$F[0]=mF,$F[1]=yF},sphere:function(){mF=-(yF=180),gF=-(vF=90)}};function JF(e,t){EF.push($F=[mF=e,yF=e]),tvF&&(vF=t)}function QF(e,t){var n=Yk([e*vw,t*vw]);if(wF){var i=Xk(wF,n),r=Xk([i[1],-i[0],0],i);Zk(r),r=Gk(r);var o,a=e-bF,s=a>0?1:-1,l=r[0]*yw*s,u=bw(a)>180;u^(s*bFvF&&(vF=o):u^(s*bF<(l=(l+360)%360-180)&&lvF&&(vF=t)),u?eiO(mF,yF)&&(yF=e):iO(e,yF)>iO(mF,yF)&&(mF=e):yF>=mF?(eyF&&(yF=e)):e>bF?iO(mF,e)>iO(mF,yF)&&(yF=e):iO(e,yF)>iO(mF,yF)&&(mF=e)}else EF.push($F=[mF=e,yF=e]);tvF&&(vF=t),wF=n,bF=e}function ZF(){XF.point=QF}function KF(){$F[0]=mF,$F[1]=yF,XF.point=JF,wF=null}function eO(e,t){if(wF){var n=e-bF;kF.add(bw(n)>180?n+(n>0?360:-360):n)}else xF=e,_F=t;SF.point(e,t),QF(e,t)}function tO(){SF.lineStart()}function nO(){eO(xF,_F),SF.lineEnd(),bw(kF)>fw&&(mF=-(yF=180)),$F[0]=mF,$F[1]=yF,wF=null}function iO(e,t){return(t-=e)<0?t+360:t}function rO(e,t){return e[0]-t[0]}function oO(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=Se(t[0]),i=Se(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 SO(e,t,n,i){t[0].type!==OM&&oe("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&De(t).value)!==vO||st(i,a)||(i[a]=n.getData(r).indataRef(n,o)),st(i,s)||(i[s]=n.getData(r).tuplesRef())}function MO(e){const t=this.context.data[e];return t?t.values.value:[]}const CO=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},FO=CO("format"),OO=CO("timeFormat"),NO=CO("utcFormat"),TO=CO("timeParse"),zO=CO("utcParse"),RO=new Date(2e3,0,1);function PO(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(RO.setYear(2e3),RO.setMonth(e),RO.setDate(t),OO.call(this,RO,n)):""}const LO="%",BO="$";function jO(e,t,n,i){t[0].type!==OM&&oe("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!st(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(e){}}function IO(e,t,n,i){if(t[0].type===OM)UO(n,i,t[0].value);else for(e in n.scales)UO(n,i,e)}function UO(e,t,n){const i=LO+n;if(!st(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function qO(e,t){if(Ve(e))return e;if(vt(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[Wp])?i.value:void 0}var n}function WO(e,t){return function(n,i,r){if(n){const t=qO(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const HO=WO("area",(function(e){return DF=new cw,uw(e,SF),2*DF})),GO=WO("bounds",(function(e){var t,n,i,r,o,a,s;if(vF=yF=-(mF=gF=1/0),EF=[],uw(e,XF),n=EF.length){for(EF.sort(rO),t=1,o=[i=EF[0]];tiO(i[0],i[1])&&(i[1]=r[1]),iO(r[0],i[1])>iO(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=iO(i[1],r[0]))>a&&(a=s,mF=r[0],yF=i[1])}return EF=$F=null,mF===1/0||gF===1/0?[[NaN,NaN],[NaN,NaN]]:[[mF,gF],[yF,vF]]})),YO=WO("centroid",(function(e){NF=TF=zF=RF=PF=LF=BF=jF=0,IF=new cw,UF=new cw,qF=new cw,uw(e,aO);var t=+IF,n=+UF,i=+qF,r=$w(t,n,i);return rZO(e,t)}const eN={};function tN(e){return _e(e)||ArrayBuffer.isView(e)?e:null}function nN(e){return tN(e)||(vt(e)?e:null)}const iN=e=>e.data;function rN(e,t){const n=MO.call(t,e);return n.root&&n.root.lookup||{}}const oN=()=>"undefined"!=typeof window&&window||null;function aN(e,t,n){if(!e)return[];const[i,r]=e,o=(new Ng).set(i[0],i[1],r[0],r[1]);return ux(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 sN={random:()=>Os(),cumulativeNormal:qs,cumulativeLogNormal:Xs,cumulativeUniform:tl,densityNormal:Us,densityLogNormal:Vs,densityUniform:el,quantileNormal:Ws,quantileLogNormal:Js,quantileUniform:nl,sampleNormal:Is,sampleLogNormal:Ys,sampleUniform:Ks,isArray:_e,isBoolean:ht,isDate:pt,isDefined:e=>void 0!==e,isNumber:gt,isObject:we,isRegExp:yt,isString:vt,isTuple:za,isValid:e=>null!=e&&e==e,toBoolean:St,toDate:e=>Ct(e),toNumber:Se,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;irt(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:aN,clampRange:Ye,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=oN();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=oN();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return yp(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(de).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?ng(n,t=t||Hm(e)):e}},panLinear:ze,panLog:Re,panPow:Pe,panSymlog:Le,zoomLinear:je,zoomLog:Ie,zoomPow:Ue,zoomSymlog:qe,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?de:_e(n)||za(n)?n:KO(n),d.remove(c)),t&&d.insert(t),i&&(c=KO(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 Ng).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),aN([[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)))}},lN=["view","item","group","xy","x","y"],uN="this.",cN={},fN={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Dt(BO+e)}]`,functions:function(e){const t=lF(e);lN.forEach((e=>t[e]="event.vega."+e));for(const e in sN)t[e]=uN+e;return it(t,function(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=IO,n._range=IO,n._scale=IO;const i=t=>"_["+(t.type===OM?Dt(LO+t.value):Dt(LO)+"+"+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,sN,cN)),t},constants:sF,visitors:cN},dN=uF(fN);function hN(e,t,n){return 1===arguments.length?sN[e]:(sN[e]=t,n&&(cN[e]=n),dN&&(dN.functions[e]=uN+e),this)}function pN(e,t){const n={};let i;try{i=aF(e=vt(e)?e:Dt(e)+"")}catch(t){oe("Expression parse error: "+e)}i.visit((e=>{if(e.type!==NM)return;const i=e.callee.name,r=fN.visitors[i];r&&r(i,e.arguments,t,n)}));const r=dN(i);return r.globals.forEach((e=>{const i=BO+e;!st(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:it({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}hN("bandwidth",(function(e,t){const n=qO(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),IO),hN("copy",(function(e,t){const n=qO(e,(t||this).context);return n?n.copy():void 0}),IO),hN("domain",(function(e,t){const n=qO(e,(t||this).context);return n?n.domain():[]}),IO),hN("range",(function(e,t){const n=qO(e,(t||this).context);return n&&n.range?n.range():[]}),IO),hN("invert",(function(e,t,n){const i=qO(e,(n||this).context);return i?_e(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),IO),hN("scale",(function(e,t,n){const i=qO(e,(n||this).context);return i?i(t):void 0}),IO),hN("gradient",(function(e,t,n,i,r){e=qO(e,(r||this).context);const o=Pm(t,n);let a=e.domain(),s=a[0],l=De(a),u=ue;return l-s?u=om(e,s,l):e=(e.interpolator?Gp("sequential")().interpolator(e.interpolator()):Gp("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!==De(a)&&a.push(l)),a.forEach((t=>o.stop(u(t),e(t)))),o}),IO),hN("geoArea",HO,IO),hN("geoBounds",GO,IO),hN("geoCentroid",YO,IO),hN("geoShape",(function(e,t,n){const i=qO(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),IO),hN("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!==OM&&oe("First argument to indata must be a string literal."),t[1].type!==OM&&oe("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;st(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),hN("data",MO,jO),hN("treePath",(function(e,t,n){const i=rN(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(iN):void 0}),jO),hN("treeAncestors",(function(e,t){const n=rN(e,this)[t];return n?n.ancestors().map(iN):void 0}),jO),hN("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[wO]&&l[wO].value:void 0,f=n===vO,d=u.length,h=0;h(e[o[n].field]=t,e)),{}))}else l=xO,u=_O(r),(f=(c=v[l]||(v[l]={}))[s]||(c[s]=[])).push(u),n&&(f=b[s]||(b[s]=[])).push({[xO]:u});return t=t||bO,v[xO]?v[xO]=DO[`${xO}_${t}`](...Object.values(v[xO])):Object.keys(v).forEach((e=>{v[e]=Object.keys(v[e]).map((t=>v[e][t])).reduce(((n,i)=>void 0===n?i:DO[`${x[e]}_${t}`](n,i)))})),y=Object.keys(b),n&&y.length&&(v[i?"vlPoint":"vlMulti"]=t===bO?{or:y.reduce(((e,t)=>(e.push(...b[t]),e)),[])}:{and:y.map((e=>({or:b[e]})))}),v}),SO),hN("vlSelectionTuples",(function(e,t){return e.map((e=>it(t.fields?{values:t.fields.map((t=>(t.getter||(t.getter=se(t.field)))(e.datum)))}:{[xO]:_O(e.datum)},t)))}));const mN=Ot(["rule"]),gN=Ot(["group","image","rect"]);function yN(e){return(e+"").toLowerCase()}function vN(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var bN={operator:(e,t)=>vN(e,["_"],t.code),parameter:(e,t)=>vN(e,["datum","_"],t.code),event:(e,t)=>vN(e,["event"],t.code),handler:(e,t)=>vN(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["+Dt(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return mN[t]||(e.x2&&(e.x?(gN[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?(gN[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;",vN(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(Dt).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 xN(e,t,n){if(!e||!we(e))return e;for(let i,r=0,o=_N.length;re&&e.$tupleid?Ra:e));return t.fn[n]||(t.fn[n]=Je(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 Ra}}];const wN={skip:!0};function kN(e,t,n,i){return new EN(e,t,n,i)}function EN(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||bN,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function $N(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 AN(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}EN.prototype=$N.prototype={fork(){const e=new $N(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"===yN(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[yN(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"!==yN(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||oe("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]=_e(r)?r.map((e=>xN(e,n,t))):xN(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&&oe("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||oe("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],wN)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(de).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const DN="default";function SN(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 MN(e,t){var n=e._runtime.data;return st(n,t)||oe("Unrecognized data set: "+t),n[t]}function CN(e,t){qa(t)||oe("Second argument to changes must be a changeset.");const n=MN(this,e);return n.modified=!0,this.pulse(n.input,t)}function FN(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function ON(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function NN(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}const TN="view",zN={trap:!1};function RN(e,t,n,i){e._eventListeners.push({type:n,sources:Ge(t),handler:i})}function PN(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 LN(e){return e.item}function BN(e){return e.item.mark.source}function jN(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function IN(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 UN="vega-bind-radio";function qN(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),RN(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 WN(e,t,n,i){const r=i.signal(n.signal),o=IN("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(IN("label"));a.appendChild(IN("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=HN;switch(n.input){case"checkbox":s=GN;break;case"select":s=YN;break;case"radio":s=VN;break;case"range":s=XN}s(e,a,n,r)}function HN(e,t,n,i){const r=IN("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 GN(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=IN("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function YN(e,t,n,i){const r=IN("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};JN(e,i)&&(n.selected=!0),r.appendChild(IN("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};JN(t,i)&&(s.checked=!0);const l=IN("input",s);l.addEventListener("change",(()=>e.update(t)));const u=IN("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 JN(e,t){return e===t||e+""==t+""}function QN(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,FN(e),ON(e),NN(e),r,o).background(e.background())}function ZN(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function KN(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 eT=e=>+e||0;function tT(e){return we(e)?{top:eT(e.top),bottom:eT(e.bottom),left:eT(e.left),right:eT(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(eT(e))}async function nT(e,t,n,i){const r=lx(t),o=r&&r.headless;return o||oe("Unrecognized renderer type: "+t),await e.runAsync(),QN(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var iT="width",rT="height",oT="padding",aT={skip:!0};function sT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===oT?i.left+i.right:0)}function lT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===oT?i.top+i.bottom:0)}function uT(e,t){return t.modified&&_e(t.input.value)&&e.indexOf("_:vega:_")}function cT(e,t){return!("parent"===e||t instanceof ms.proxy)}function fT(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":_e(e)?dT(e):we(e)&&!pt(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(_e(n)?dT(n):hT(n))})).join("\n")):e+"";var t}(i))}function dT(e){return"["+e.map(hT).join(", ")+"]"}function hT(e){return _e(e)?"[…]":we(e)&&!pt(e)?"{…}":e}function pT(e,t){const n=this;if(t=t||{},ds.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=it({},e.locale,t.locale);n.locale(ta(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||ax.Canvas,n._scenegraph=new Lv;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||fT,n._redraw=!0,n._handler=(new cb).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=it({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{_e(e[t])&&(e[t]=Ot(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 kN(e,ms,sN,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:it({},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=sT(n,n._width),n._viewHeight=lT(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[iT],i=t[rT],r=t[oT];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=sT(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=lT(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:DN,item:null}));e.on(e.events("view","mousemove"),t,((e,n)=>{const i=t.value,r=i?vt(i)?i:i.user:DN,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 vt(n)||(i=n.item,n=n.user),SN(e,n&&n!==DN?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function mT(e,t){return st(e._signals,t)?e._signals[t]:oe("Unrecognized signal name: "+Dt(t))}function gT(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function yT(e,t,n,i){let r=gT(n,i);return r||(r=ZN(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function vT(e,t,n){const i=gT(t,n);return i&&t._targets.remove(i),e}ft(pT,ds,{async evaluate(e,t,n){if(await ds.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=NN(i=this),o=FN(i),a=ON(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&&Oa(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&&AN(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=mT(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",tT(e)):tT(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?(lx(e)||oe("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&&(ds.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(mT(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(iT,n,aT),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(rT,i,aT),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=ZN(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 yT(this,e,mT(this,e),t)},removeSignalListener(e,t){return vT(this,mT(this,e),t)},addDataListener(e,t){return yT(this,e,MN(this,e).values,t)},removeDataListener(e,t){return vT(this,MN(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=SN(this,null);this._globalCursor=!!e,t&&SN(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 EA,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?wA():+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 Za(n),a=function(n,i){r.runAsync(null,(()=>{e===TN&&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=NN(e),(i=Hv(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;vt(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:tt(e),item:tt(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)PN(r,"timer",t)&&r.timer(a,t);else if(e===TN)PN(r,"view",t)&&r.addEventListener(t,a,zN);else if("window"===e?PN(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&PN(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",LN),BN,jN(e)),this.on(this.events("view","mouseout",LN),BN,jN(t)),this},data:function(e,t){return arguments.length<2?MN(this,e).values.value:CN.call(this,e,Wa().remove(de).insert(t))},change:CN,insert:function(e,t){return CN.call(this,e,Wa().insert(t))},remove:function(e,t){return CN.call(this,e,Wa().remove(t))},scale:function(e){var t=this._runtime.scales;return st(t,e)||oe("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=lx(i);e=n._el=e?KN(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),AN(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||cb,s=e?o.renderer:o.headless;return n._renderer=s?QN(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),ZN(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,NN(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=KN(n,t,!0):e.appendChild(IN("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=KN(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=nt(i.debounce,r.update))),(null==i.input&&i.element?qN:WN)(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!==ax.Canvas&&e!==ax.SVG&&e!==ax.PNG&&oe("Unrecognized image type: "+e);const n=await nT(this,e,t);return e===ax.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 nT(this,ax.Canvas,e,t)).canvas()},toSVG:async function(e){return(await nT(this,ax.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:uT,signals:cT,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this}});const bT="view",xT="[",_T="]",wT="{",kT="}",ET=":",$T=",",AT="@",DT=">",ST=/[[\]{}]/,MT={"*":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 CT,FT;function OT(e,t,n){return CT=t||bT,FT=n||MT,TT(e.trim()).map(zT)}function NT(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 TT(e){const t=[],n=e.length;let i=0,r=0;for(;r' after between selector: "+e;n=n.map(zT);const r=zT(e.slice(1).trim());return r.between?{between:n,stream:r}:(r.between=n,r)}(e):function(e){const t={source:CT},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if(e[l-1]===kT){if(u=e.lastIndexOf(wT),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split($T);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]===AT&&(a=++u),i=NT(e,u,ET),i1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],FT[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 RT(e){return we(e)?e:{type:e||"pad"}}const PT=e=>+e||0,LT=e=>({top:e,bottom:e,left:e,right:e});function BT(e){return we(e)?e.signal?e:{top:PT(e.top),bottom:PT(e.bottom),left:PT(e.left),right:PT(e.right)}:LT(PT(e))}const jT=e=>we(e)&&!_e(e)?it({},e):{value:e};function IT(e,t,n,i){return null!=n?(we(n)&&!_e(n)||_e(n)&&n.length&&we(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function UT(e,t,n){for(const n in t)IT(e,n,t[n]);for(const t in n)IT(e,t,n[t],"update")}function qT(e,t,n){for(const i in t)n&&st(n,i)||(e[i]=it(e[i]||{},t[i]));return e}function WT(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const HT="mark",GT="frame",YT="scope",VT="axis",XT="axis-domain",JT="axis-grid",QT="axis-label",ZT="axis-tick",KT="axis-title",ez="legend",tz="legend-band",nz="legend-entry",iz="legend-gradient",rz="legend-label",oz="legend-symbol",az="legend-title",sz="title",lz="title-text",uz="title-subtitle";function cz(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const fz=e=>vt(e)?Dt(e):e.signal?`(${e.signal})`:mz(e);function dz(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:Dt(e)));for(;t.length&&null==De(t);)t.pop();return t.unshift(fz(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?hz("hcl",e.h,e.c,e.l):e.h||e.s?hz("hsl",e.h,e.s,e.l):e.l||e.a?hz("lab",e.l,e.a,e.b):e.r||e.g||e.b?hz("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?mz(e.field):void 0!==e.value?Dt(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=fz(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?"":"*"+pz(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},${pz(e.exponent)})`),null!=e.mult&&(t+=`*${pz(e.mult)}`),null!=e.offset&&(t+=`+${pz(e.offset)}`),e.round&&(t=`round(${t})`),t}const hz=(e,t,n,i)=>`(${e}(${[t,n,i].map(dz).join(",")})+'')`;function pz(e){return we(e)?"("+dz(e)+")":e}function mz(e){return gz(we(e)?e:{datum:e})}function gz(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):oe("Invalid field reference: "+Dt(e));return e.signal||(i=vt(i)?ae(i).map(Dt).join("]["):gz(i)),t+"["+i+"]"}function yz(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]||WT(l,e)||cz(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===GT?r.group:n===HT?it({},r.mark,r[t]):null,c)u=WT(l,e)||("fill"===l||"stroke"===l)&&(WT("fill",e)||WT("stroke",e)),u||cz(o,l,c[l]);for(l in Ge(i).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)WT(t,e)||cz(o,t,n[t])})),e=it({},e),o)c=o[l],c.signal?(s=s||{})[l]=c:a[l]=c;return e.enter=it(a,e.enter),s&&(e.update=it(s,e.update)),e}(e,t,n,i,r.config);for(const n in e)a[n]=vz(e[n],t,o,r);return o}function vz(e,t,n,i){const r={},o={};for(const t in e)null!=e[t]&&(r[t]=bz((a=e[t],_e(a)?function(e){let t="";return e.forEach((e=>{const n=dz(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===De(t)&&(t+="null"),t}(a):dz(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function bz(e,t,n,i){const r=pN(e,t);return r.$fields.forEach((e=>i[e]=1)),it(n,r.$params),r.$expr}const xz="outer",_z=["value","update","init","react","bind"];function wz(e,t){oe(e+' for "outer" push: '+Dt(t))}function kz(e,t){const n=e.name;if(e.push===xz)t.signals[n]||wz("No prior signal definition",n),_z.forEach((t=>{void 0!==e[t]&&wz("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 Ez(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function $z(e,t,n,i){return new Ez(e,t,n,i)}function Az(e,t){return $z("operator",e,t)}function Dz(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Sz(e,t){return t?{$field:e,$name:t}:{$field:e}}const Mz=Sz("key");function Cz(e,t){return{$compare:e,$order:t}}function Fz(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const Oz="scope",Nz="view";function Tz(e){return e&&e.signal}function zz(e){if(Tz(e))return!0;if(we(e))for(const t in e)if(zz(e[t]))return!0;return!1}function Rz(e,t){return null!=e?e:t}function Pz(e){return e&&e.signal||e}const Lz="timer";function Bz(e,t){return(e.merge?jz:e.stream?Iz:e.type?Uz:oe("Invalid stream specification: "+Dt(e)))(e,t)}function jz(e,t){const n=qz({merge:e.merge.map((e=>Bz(e,t)))},e,t);return t.addStream(n).id}function Iz(e,t){const n=qz({stream:Bz(e.stream,t)},e,t);return t.addStream(n).id}function Uz(e,t){let n;var i;e.type===Lz?(n=t.event(Lz,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===Oz?Nz:i||Nz,e.type);const r=qz({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function qz(e,t,n){let i=t.between;return i&&(2!==i.length&&oe('Stream "between" parameter must have 2 entries: '+Dt(t)),e.between=[Bz(i[0],n),Bz(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===Oz&&i.push("inScope(event.item)"),i.length&&(e.filter=pN("("+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 Wz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Hz(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const Gz=e=>(t,n,i)=>$z(e,n,t||void 0,i),Yz=Gz("aggregate"),Vz=Gz("axisticks"),Xz=Gz("bound"),Jz=Gz("collect"),Qz=Gz("compare"),Zz=Gz("datajoin"),Kz=Gz("encode"),eR=Gz("expression"),tR=Gz("facet"),nR=Gz("field"),iR=Gz("key"),rR=Gz("legendentries"),oR=Gz("load"),aR=Gz("mark"),sR=Gz("multiextent"),lR=Gz("multivalues"),uR=Gz("overlap"),cR=Gz("params"),fR=Gz("prefacet"),dR=Gz("projection"),hR=Gz("proxy"),pR=Gz("relay"),mR=Gz("render"),gR=Gz("scale"),yR=Gz("sieve"),vR=Gz("sortitems"),bR=Gz("viewlayout"),xR=Gz("values");let _R=0;const wR={min:"min",max:"max",count:"sum"};function kR(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=DR(e.domain,e,t),null!=e.range&&(n.range=zR(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=ER(e.type||e),null!=e.gamma&&(t.interpolateGamma=ER(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return we(e)?{interval:ER(e.interval),step:ER(e.step)}:ER(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||_e(e)?$R(e,t):t.objectProperty(e)}(e.bins,t)),e)st(n,i)||"name"===i||(n[i]=ER(e[i],t))}function ER(e,t){return we(e)?e.signal?t.signalRef(e.signal):oe("Unsupported object: "+Dt(e)):e}function $R(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>ER(e,t)))}function AR(e){oe("Can not find data set: "+Dt(e))}function DR(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(_e(e)?SR:e.fields?CR:MR)(e,t,n);null==t.domainMin&&null==t.domainMax||oe("No scale domain defined for domainMin/domainMax to override.")}function SR(e,t,n){return e.map((e=>ER(e,n)))}function MR(e,t,n){const i=n.getData(e.data);return i||AR(e.data),Jp(t.type)?i.valuesRef(n,e.field,OR(e.sort,!1)):em(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function CR(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=vt(t)?{data:i,field:t}:_e(t)||t.signal?function(e,t){const n="_:vega:_"+_R++,i=Jz({});if(_e(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+Dt(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,yR({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(Jp(t.type)?FR:em(t.type)?NR:TR)(e,n,r)}function FR(e,t,n){const i=OR(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||AR(e.data),n.countsRef(t,e.field,i)})),s={groupby:Mz,pulse:a};i&&(r=i.op||"count",o=i.field?Fz(r,i.field):"count",s.ops=[wR[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(Yz(s));const l=t.add(Jz({pulse:Dz(r)}));return o=t.add(xR({field:Mz,sort:t.sortRef(i),pulse:Dz(l)})),Dz(o)}function OR(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!wR[e.op]&&oe("Multiple domain scales can not be sorted using "+e.op):oe("No field provided for sort aggregate op: "+e.op):we(e)?e.field="key":e={field:"key"}),e}function NR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||AR(e.data),n.domainRef(t,e.field)}));return Dz(t.add(lR({values:i})))}function TR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||AR(e.data),n.extentRef(t,e.field)}));return Dz(t.add(sR({extents:i})))}function zR(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(vt(r)){if(i&&st(i,r))return zR(e=it({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Jp(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:oe("Unrecognized scale range value: "+Dt(r))}else{if(r.scheme)return n.scheme=_e(r.scheme)?$R(r.scheme,t):ER(r.scheme,t),r.extent&&(n.schemeExtent=$R(r.extent,t)),void(r.count&&(n.schemeCount=ER(r.count,t)));if(r.step)return void(n.rangeStep=ER(r.step,t));if(Jp(e.type)&&!_e(r))return DR(r,e,t);_e(r)||oe("Unsupported range type: "+Dt(r))}return r.map((e=>(_e(e)?$R:ER)(e,t)))}function RR(e,t,n){return _e(e)?e.map((e=>RR(e,t,n))):we(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:oe("Unsupported parameter object: "+Dt(e)):e}const PR="top",LR="left",BR="right",jR="bottom",IR="center",UR="vertical",qR="start",WR="end",HR="index",GR="label",YR="offset",VR="perc",XR="perc2",JR="value",QR="guide-label",ZR="guide-title",KR="group-title",eP="group-subtitle",tP="symbol",nP="gradient",iP="discrete",rP="size",oP=[rP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],aP={name:1,style:1,interactive:1},sP={value:0},lP={value:1},uP="group",cP="rect",fP="rule",dP="symbol",hP="text";function pP(e){return e.type=uP,e.interactive=e.interactive||!1,e}function mP(e,t){const n=(n,i)=>Rz(e[n],Rz(t[n],i));return n.isVertical=n=>UR===Rz(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Rz(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Rz(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Rz(e.columns,Rz(t.columns,+n.isVertical(!0))),n}function gP(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 yP(e,t,n){return`item.anchor === '${qR}' ? ${e} : item.anchor === '${WR}' ? ${t} : ${n}`}const vP=yP(Dt(LR),Dt(BR),Dt(IR));function bP(e,t){return t?e?we(e)?Object.assign({},e,{offset:bP(e.offset,t)}):{value:e,offset:t}:t:e}function xP(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=qT(e.encode,t,aP)):e.interactive=!1,e}function _P(e,t,n,i){const r=mP(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:sP,x:sP,y:sP,width:jT(f),height:jT(d)},update:it({},l,{opacity:lP,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:sP}};return UT(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),xP({type:cP,role:iz,encode:h},i)}function wP(e,t,n,i,r){const o=mP(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:sP,fill:{scale:t,field:JR}};p[u]={signal:h+"datum."+VR,mult:l},p[c]=sP,p[f]={signal:h+"datum."+XR,mult:l},p[d]=jT(s);const m={enter:p,update:it({},p,{opacity:lP}),exit:{opacity:sP}};return UT(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),xP({type:cP,role:tz,key:JR,from:r,encode:m},i)}const kP=`datum.${VR}<=0?"${LR}":datum.${VR}>=1?"${BR}":"${IR}"`,EP=`datum.${VR}<=0?"${jR}":datum.${VR}>=1?"${PR}":"middle"`;function $P(e,t,n,i){const r=mP(e,t),o=r.isVertical(),a=jT(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:sP},update:u={opacity:lP,text:{field:GR}},exit:{opacity:sP}};return UT(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:Rz(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:EP},c="y",f="x",h="1-"):(l.align=u.align={signal:kP},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+VR,mult:s},l[f]=u[f]=a,a.offset=Rz(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+HR}:void 0,xP({type:hP,role:rz,style:QR,key:JR,from:i,encode:p,overlap:d},n)}function AP(e,t,n,i,r){const o=mP(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.${YR} : datum.${rP}`,h=u?jT(u):{field:rP},p=`datum.${HR}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:sP,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:lP,x:y.x,y:y.y},exit:{opacity:sP}};let _=null,w=null;e.fill||(_=t.symbolBaseFillColor,w=t.symbolBaseStrokeColor),UT(g,{fill:o("symbolFillColor",_),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),oP.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:JR})}));const k=xP({type:dP,role:oz,key:JR,from:f,clip:!!u||void 0,encode:g},n.symbols),E=jT(c);E.offset=o("labelOffset"),g={enter:y={opacity:sP,x:{signal:d,offset:E},y:h},update:v={opacity:lP,text:{field:GR},x:y.x,y:y.y},exit:{opacity:sP}},UT(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 $=xP({type:hP,role:rz,style:QR,key:JR,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:sP,height:u?jT(u):sP,opacity:sP},exit:{opacity:sP},update:v={opacity:lP,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}`,pP({role:YT,from:i={facet:{data:i,name:"value",groupby:HR}},encode:qT(g,a,aP),marks:[k,$],name:l,interactive:s,sort:x})}const DP='item.orient === "left"',SP='item.orient === "right"',MP=`(${DP} || ${SP})`,CP=`datum.vgrad && ${MP}`,FP=yP('"top"','"bottom"','"middle"'),OP=`datum.vgrad && ${SP} ? (${yP('"right"','"left"','"center"')}) : (${MP} && !(datum.vgrad && ${DP})) ? "left" : ${vP}`,NP=`item._anchor || (${MP} ? "middle" : "start")`,TP=`${CP} ? (${DP} ? -90 : 90) : 0`,zP=`${MP} ? (datum.vgrad ? (${SP} ? "bottom" : "top") : ${FP}) : "top"`;function RP(e,t){let n;return we(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+PP(e.path)+")":e.sphere&&(n="geoShape("+PP(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function PP(e){return we(e)&&e.signal?e.signal:Dt(e)}function LP(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===uP?YT:t||HT:t}function BP(e){return{marktype:e.type,name:e.name||void 0,role:e.role||LP(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function jP(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function IP(e,t){const n=gs(e.type);n||oe("Unrecognized transform type: "+Dt(e.type));const i=$z(n.type.toLowerCase(),null,UP(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function UP(e,t,n){const i={},r=e.params.length;for(let o=0;oHP(e,t,n)))):HP(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!Tz(r)?r.map((t=>WP(e,t,n))):WP(e,r,n):void(e.required&&oe("Missing required "+Dt(t.type)+" parameter: "+Dt(e.name)))}function WP(e,t,n){const i=e.type;if(Tz(t))return XP(i)?oe("Expression references can not be signals."):JP(i)?n.fieldRef(t):QP(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||JP(i);return r&&GP(t)?n.exprRef(t.expr,t.as):r&&YP(t)?Sz(t.field,t.as):XP(i)?pN(t,n):VP(i)?Dz(n.getData(t).values):JP(i)?Sz(t):QP(i)?n.compareRef(t):t}}function HP(e,t,n){const i=e.params.length;let r;for(let n=0;ne&&e.expr,YP=e=>e&&e.field,VP=e=>"data"===e,XP=e=>"expr"===e,JP=e=>"field"===e,QP=e=>"compare"===e;function ZP(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Dz(t.getData(e.data).output)}function KP(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function eL(e){return vt(e)?e:null}function tL(e,t,n){const i=Fz(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 rL(e,t){const n=LP(e),i=e.type===uP,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,u,c,f,d,h=e.layout||n===YT||n===GT;const p=n===HT||h||r,m=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||oe("Only group marks can be faceted."),null!=i.field?a=s=ZP(i,n):(e.data?s=Dz(n.getData(e.data).aggregate):(o=IP(it({type:"aggregate",groupby:Ge(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=ZP(i,n),a=s=Dz(n.add(o))),r=n.keyRef(i.groupby,!0))):a=Dz(n.add(Jz(null,[{}]))),a||(a=ZP(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(Zz({key:m.key||(e.key?Sz(e.key):void 0),pulse:m.pulse,clean:!i}));const g=Dz(s);s=l=t.add(Jz({pulse:g})),s=t.add(aR({markdef:BP(e),interactive:jP(e.interactive,t),clip:RP(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Dz(s)}));const y=Dz(s);s=u=t.add(Kz(yz(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=IP(e,t),i=n.metadata;(i.generates||i.changes)&&oe("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=Dz(s),t.add(s=n)})),e.sort&&(s=t.add(vR({sort:t.compareRef(e.sort),pulse:Dz(s)})));const v=Dz(s);(r||h)&&(h=t.add(bR({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:v})),f=Dz(h));const b=t.add(Xz({mark:y,pulse:f||v}));d=Dz(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=ZP(i,t);let a;i.name||oe("Facet must have a name: "+Dt(i)),i.data||oe("Facet must reference a data set: "+Dt(i)),i.field?a=t.add(fR({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(tR({key:t.keyRef(i.groupby),group:Dz(t.proxy(n.parent)),pulse:o})):oe("Facet must specify groupby or field: "+Dt(i));const s=t.fork(),l=s.add(Jz()),u=s.add(yR({pulse:Dz(l)}));s.addData(r,new KP(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(fR({pulse:n.pulse})),r=t.fork();r.add(yR()),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:Tz(o)?n.signalRef(o.signal):o,method:Tz(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=Tz(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return Dz(n.add(uR(a)))}(o,d,t));const x=t.add(mR({pulse:d})),_=t.add(yR({pulse:Dz(x)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new KP(t,l,x,_)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&oe("Marks only support modify triggers."),iL(e,t,c)})))}function oL(e,t,n){const i={enter:{},update:{}};return UT(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 aL(e,t,n){return t[e]?`scale("${t[e]}",datum)`:gP(e,n[0].encode)}KP.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===jR||e===PR,dL=(e,t,n)=>Tz(e)?bL(e.signal,t,n):e===LR||e===PR?t:n,hL=(e,t,n)=>Tz(e)?yL(e.signal,t,n):fL(e)?t:n,pL=(e,t,n)=>Tz(e)?vL(e.signal,t,n):fL(e)?n:t,mL=(e,t,n)=>Tz(e)?xL(e.signal,t,n):e===PR?{value:t}:{value:n},gL=(e,t,n)=>Tz(e)?_L(e.signal,t,n):e===BR?{value:t}:{value:n},yL=(e,t,n)=>wL(`${e} === '${PR}' || ${e} === '${jR}'`,t,n),vL=(e,t,n)=>wL(`${e} !== '${PR}' && ${e} !== '${jR}'`,t,n),bL=(e,t,n)=>EL(`${e} === '${LR}' || ${e} === '${PR}'`,t,n),xL=(e,t,n)=>EL(`${e} === '${PR}'`,t,n),_L=(e,t,n)=>EL(`${e} === '${BR}'`,t,n),wL=(e,t,n)=>(t=null!=t?jT(t):t,n=null!=n?jT(n):n,kL(t)&&kL(n)?{signal:`${e} ? (${t=t?t.signal||Dt(t.value):null}) : (${n=n?n.signal||Dt(n.value):null})`}:[it({test:e},t)].concat(n||[])),kL=e=>null==e||1===Object.keys(e).length,EL=(e,t,n)=>({signal:`${e} ? (${AL(t)}) : (${AL(n)})`}),$L=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${LR}' ? (${AL(i)}) : `:"")+(null!=n?`${e} === '${jR}' ? (${AL(n)}) : `:"")+(null!=r?`${e} === '${BR}' ? (${AL(r)}) : `:"")+(null!=t?`${e} === '${PR}' ? (${AL(t)}) : `:"")+"(null)"}),AL=e=>Tz(e)?e.signal:null==e?null:Dt(e),DL=(e,t)=>0===t?0:Tz(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},SL=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function ML(e,t,n,i){let r;if(t&&st(t,e))return t[e];if(st(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[ZR][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[QR][r]}return null}function CL(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function FL(e,t){return{scale:e.scale,range:t}}function OL(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function NL(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(Tz(u)){const e=CL([o.axisX,o.axisY]),t=CL([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(r of(n={},e))n[r]=hL(u,ML(r,o.axisX,s,a),ML(r,o.axisY,s,a));for(r of(i={},t))i[r]=$L(u.signal,ML(r,o.axisTop,s,a),ML(r,o.axisBottom,s,a),ML(r,o.axisLeft,s,a),ML(r,o.axisRight,s,a))}else n=u===PR||u===jR?o.axisX:o.axisY,i=o["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?it({},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=mP(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=Dz(t.add(Jz({},[c]))),d=Dz(t.add(Vz({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=mP(e,t),a=e.orient,s=e.gridScale,l=dL(a,1,-1),u=function(e,t){if(1===t);else if(we(e)){let n=e=it({},e);for(;null!=n.mult;){if(!we(n.mult))return n.mult=Tz(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=it({},n.mult)}n.mult=t}else e=Tz(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:sP},update:d={opacity:lP},exit:f={opacity:sP}};UT(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:JR,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=hL(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}:it(m,{mult:l,offset:u});return c.x=d.x=hL(a,p,g),c.y=d.y=pL(a,p,g),c.x2=d.x2=pL(a,y),c.y2=d.y2=hL(a,y),f.x=hL(a,p),f.y=pL(a,p),xP({type:fP,role:JT,key:JR,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=mP(e,t),s=e.orient,l=dL(s,-1,1);let u,c,f;const d={enter:u={opacity:sP},update:f={opacity:lP},exit:c={opacity:sP}};UT(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=jT(r);h.mult=l;const p={scale:e.scale,field:JR,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=hL(s,sP,p),f.y2=u.y2=hL(s,h),c.x=hL(s,p),f.x=u.x=pL(s,sP,p),f.x2=u.x2=pL(s,h),c.y=pL(s,p),xP({type:fP,role:ZT,key:JR,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=mP(e,t),s=e.orient,l=e.scale,u=dL(s,-1,1),c=Pz(a("labelFlush")),f=Pz(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=jT(r);g.mult=u,g.offset=jT(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:JR,band:.5,offset:bP(o.offset,a("labelOffset"))},v=hL(s,m?OL(l,c,'"left"','"right"','"center"'):{value:"center"},gL(s,"left","right")),b=hL(s,mL(s,"bottom","top"),m?OL(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=OL(l,c,`-(${f})`,f,0);m=m&&f;const _={opacity:sP,x:hL(s,y,g),y:pL(s,y,g)},w={enter:_,update:p={opacity:lP,text:{field:GR},x:_.x,y:_.y,align:v,baseline:b},exit:{opacity:sP,x:_.x,y:_.y}};UT(w,{dx:!d&&m?hL(s,x):null,dy:!h&&m?pL(s,x):null}),UT(w,{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=SL(p.align,v)),p.baseline!==b&&(p.baseline=SL(p.baseline,b)),xP({type:hP,role:QT,style:QR,key:JR,from:i,encode:w,overlap:E},n)}(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=mP(e,t),o=e.orient;let a,s;const l={enter:a={opacity:sP},update:s={opacity:lP},exit:{opacity:sP}};UT(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=FL(e,0),c=FL(e,1);return a.x=s.x=hL(o,u,sP),a.x2=s.x2=hL(o,c),a.y=s.y=pL(o,u,sP),a.y2=s.y2=pL(o,c),xP({type:fP,role:XT,from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(function(e,t,n,i){const r=mP(e,t),o=e.orient,a=dL(o,-1,1);let s,l;const u={enter:s={opacity:sP,anchor:jT(r("titleAnchor",null)),align:{signal:vP}},update:l=it({},s,{opacity:lP,text:jT(e.title)}),exit:{opacity:sP}},c={signal:`lerp(range("${e.scale}"), ${yP(0,1,.5)})`};return l.x=hL(o,c),l.y=pL(o,c),s.angle=hL(o,sP,DL(a,90)),s.baseline=hL(o,mL(o,jR,PR),{value:jR}),l.angle=s.angle,l.baseline=s.baseline,UT(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]=SL(jT(e),n.update[t]),!1):!WT(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?jT(a):hL(t,jT(a),jT(o))}(r,o,u,n),u.update.align=SL(u.update.align,s.align),u.update.angle=SL(u.update.angle,s.angle),u.update.baseline=SL(u.update.baseline,s.baseline),xP({type:hP,role:KT,style:ZR,from:i,encode:u},n)}(e,n,i.title,f)),rL(pP({role:VT,from:f,encode:qT(TL(l,e),r,aP),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function TL(e,t){const n={enter:{},update:{}};return UT(n,{orient:e("orient"),offset:e("offset")||0,position:Rz(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 zL(e,t,n){const i=Ge(e.signals),r=Ge(e.scales);return n||i.forEach((e=>kz(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]=RR(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=RR(n[e],e,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";Yp(n)||oe("Unrecognized scale type: "+Dt(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(IP(e,t))})),e.on&&e.on.forEach((n=>{iL(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?Tz(e.values)||zz(e.format)?(i.push(cL(t,e)),i.push(u=uL())):i.push(u=uL({$ingest:e.values,$format:e.format})):e.url?zz(e.url)||zz(e.format)?(i.push(cL(t,e)),i.push(u=uL())):i.push(u=uL({$request:e.url,$format:e.format})):e.source&&(u=r=Ge(e.source).map((e=>Dz(t.getData(e).output))),i.push(null)),o=0,a=n.length;okR(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?oe("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=pN(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||oe("Signal update missing events specification."),vt(o)&&(o=OT(o,t.isSubscope()?Oz:Nz)),o=Ge(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[Hz(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&oe("Signal encode and update are mutually exclusive."),a="encode(item(),"+Dt(i)+")"),r.update=vt(a)?pN(a,t):null!=a.expr?pN(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:Wz,$params:{$value:t.signalRef(a.signal)}}:oe("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(it(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):Bz(e,t)}}(e,t),r))))}(e,t,n.id)))}(e,t))),Ge(e.axes).forEach((e=>NL(e,t))),Ge(e.marks).forEach((e=>rL(e,t))),Ge(e.legends).forEach((e=>function(e,t){const n=t.config.legend,i=e.encode||{},r=mP(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,u={};let c,f,d,h=0;oP.forEach((t=>e[t]?(u[t]=e[t],h=h||e[t]):0)),h||oe("Missing valid scale for legend.");const p=function(e,t){let n=e.type||tP;return e.type||1!==function(e){return oP.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Xp(t)?nP:Qp(t)?iP:tP),n!==nP?n:Qp(t)?iP:nP}(e,t.scaleType(h)),m={title:null!=e.title,scales:u,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=Dz(t.add(Jz(null,[m]))),y=Dz(t.add(rR(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===nP?(d=[_P(e,h,n,i.gradient),$P(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${Pz(r.gradientLength())})/100))`)):p===iP?d=[wP(e,h,n,i.gradient,y),$P(e,n,i.labels,y)]:(c=function(e,t){const n=mP(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[AP(e,n,i,y,Pz(c.columns))],f.size=function(e,t,n){const i=Pz(aL("size",e,n)),r=Pz(aL("strokeWidth",e,n)),o=Pz(function(e,t,n){return gP("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i.fontSize}(0,t,n)}(n[1].encode,t,QR));return pN(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,d[0].marks)),d=[pP({role:nz,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=mP(e,t),o={enter:{opacity:sP},update:{opacity:lP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:sP}};return UT(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:NP},angle:{signal:TP},align:{signal:OP},baseline:{signal:zP},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")}),xP({type:hP,role:az,style:ZR,from:i,encode:o},n)}(e,n,i.title,g)),rL(pP({role:ez,from:g,encode:qT(oL(r,e,n),o,aP),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=mP(e=vt(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=Dz(t.add(Jz(null,[{}])));l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return UT(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")}),xP({type:hP,role:lz,style:KR,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||it({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 UT(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")}),xP({type:hP,role:uz,style:eP,from:i,encode:o},n)}(e,n,i.subtitle,u)),rL(pP({role:sz,from:u,encode:lL(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 RL=e=>qT({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function PL(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function LL(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 BL(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 jL(e){return(_e(e)?IL:UL)(e)}function IL(e){const t=e.length;let n="[";for(let i=0;i0?",":"")+(we(t)?t.signal||jL(t):Dt(t))}return n+"]"}function UL(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+Dt(t)+":"+(we(n)?n.signal||jL(n):Dt(n));return i+"}"}function qL(e,t,n){return we(e)||oe("Input Vega specification must be an object."),t=Ee(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=Dz(t.root=t.add(Az())),r=function(e,t){const n=n=>Rz(e[n],t[n]),i=[PL("background",n("background")),PL("autosize",RT(n("autosize"))),PL("padding",BT(n("padding"))),PL("width",n("width")||0),PL("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return Ge(e.signals).forEach((e=>{st(r,e.name)?e=it(r[e.name],e):i.push(e),o[e.name]=e})),Ge(t.signals).forEach((e=>{st(o,e.name)||st(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>kz(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(Jz()),a=t.add(Kz(yz(RL(e.encode),uP,GT,e.style,t,{pulse:Dz(o)}))),s=t.add(bR({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:Dz(a)}));t.operators.pop(),t.pushState(Dz(a),Dz(s),null),zL(e,t,r),t.operators.push(s);let l=t.add(Xz({mark:i,pulse:Dz(s)}));return l=t.add(mR({pulse:Dz(l)})),l=t.add(yR({pulse:Dz(l)})),t.addData("root",new KP(t,o,o,l)),t}(e,new LL(t,n)).toRuntime()}LL.prototype=BL.prototype={parse(e){return zL(e,this)},fork(){return new BL(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 Ez?Dz(e):e;return this.add(hR({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(Dz(this.add(yR({pulse:e})))),this._parent.push(t),this._lookup.push(n?Dz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return De(this._parent)},encode(){return De(this._encode)},lookup(){return De(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(vt(e))return Sz(e,t);e.signal||oe("Unsupported field reference: "+Dt(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=Dz(this.add(nR(e)))}return i},compareRef(e){let t=!1;const n=e=>Tz(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?Dz(this.add(Qz({fields:i,orders:r}))):Cz(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=Ge(e).map((e=>Tz(e)?(n=!0,Dz(i[e.signal])):e)),n?Dz(this.add(iR({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=Fz(e.op,e.field),n=e.order||"ascending";return n.signal?Dz(this.add(Qz({fields:t,orders:this.signalRef(n.signal)}))):Cz(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 st(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&oe("Duplicate signal name: "+Dt(e));const n=t instanceof Ez?t:this.add(Az(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||oe("Unrecognized signal name: "+Dt(e)),this.signals[e]},signalRef(e){return this.signals[e]?Dz(this.signals[e]):(st(this.lambdas,e)||(this.lambdas[e]=this.add(Az(null))),Dz(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},YL={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const VL=Array.prototype.slice,XL=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,VL.call(t,1))};var JL={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 XL("join",arguments)},indexof:function(){return XL("indexOf",arguments)},lastindexof:function(){return XL("lastIndexOf",arguments)},slice:function(){return XL("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return XL("substring",arguments,String)},split:function(){return XL("split",arguments,String)},replace:function(){return XL("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const QL=["view","item","group","xy","x","y"],ZL=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&ZL.add(setImmediate);const KL={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:HL[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),!ZL.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]||JL[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>GL[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>YL[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,ZL.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 eB(e,t,n,i,r,o){const a=e=>KL[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,QL.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var tB={operator(e,t){const n=t.ast,i=e.functions;return e=>eB(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>eB(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>eB(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 eB(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=eB(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}}},nB=n(36425),iB=n.n(nB),rB=n(66471),oB=n.n(rB),aB=n(56440),sB=n.n(aB);function lB(e){return!!e.or}function uB(e){return!!e.and}function cB(e){return!!e.not}function fB(e,t){if(cB(e))fB(e.not,t);else if(uB(e))for(const n of e.and)fB(n,t);else if(lB(e))for(const n of e.or)fB(n,t);else t(e)}function dB(e,t){return cB(e)?{not:dB(e.not,t)}:uB(e)?{and:e.and.map((e=>dB(e,t)))}:lB(e)?{or:e.or.map((e=>dB(e,t)))}:t(e)}const hB=oB(),pB=iB();function mB(e){throw new Error(e)}function gB(e,t){const n={};for(const i of t)st(e,i)&&(n[i]=e[i]);return n}function yB(e,t){const n={...e};for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>sB()(e))).join(",")})`};const vB=sB();function bB(e){if(gt(e))return e;const t=vt(e)?e:sB()(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 FB(e,t){return void 0===e||void 0===t||MB(CB(e),CB(t))}function OB(e){return 0===NB(e).length}const NB=Object.keys,TB=Object.values,zB=Object.entries;function RB(e){return!0===e||!1===e}function PB(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function LB(e,t){return cB(e)?`!(${LB(e.not,t)})`:uB(e)?`(${e.and.map((e=>LB(e,t))).join(") && (")})`:lB(e)?`(${e.or.map((e=>LB(e,t))).join(") || (")})`:t(e)}function BB(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&BB(e[n],t)&&delete e[n],OB(e)}function jB(e){return e.charAt(0).toUpperCase()+e.substr(1)}function IB(e,t="datum"){const n=ae(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(Dt).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function UB(e,t="datum"){return`${t}[${Dt(ae(e).join("."))}]`}function qB(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function WB(e){return`${ae(e).map(qB).join("\\.")}`}function HB(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function GB(e){return`${ae(e).join(".")}`}function YB(e){return e?ae(e).length:0}function VB(...e){for(const t of e)if(void 0!==t)return t}let XB=42;function JB(e){const t=++XB;return e?String(e)+t:t}function QB(){XB=42}function ZB(e){return KB(e)?e:`__${e}`}function KB(e){return e.startsWith("__")}function ej(e){if(void 0!==e)return(e%360+360)%360}function tj(e){return!!gt(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const nj="row",ij="column",rj="facet",oj="x",aj="y",sj="x2",lj="y2",uj="xOffset",cj="yOffset",fj="radius",dj="radius2",hj="theta",pj="theta2",mj="latitude",gj="longitude",yj="latitude2",vj="longitude2",bj="color",xj="fill",_j="stroke",wj="shape",kj="size",Ej="angle",$j="opacity",Aj="fillOpacity",Dj="strokeOpacity",Sj="strokeWidth",Mj="strokeDash",Cj="text",Fj="order",Oj="detail",Nj="key",Tj="tooltip",zj="href",Rj="url",Pj="description",Lj={theta:1,theta2:1,radius:1,radius2:1};function Bj(e){return e in Lj}const jj={longitude:1,longitude2:1,latitude:1,latitude2:1};function Ij(e){switch(e){case mj:return"y";case yj:return"y2";case gj:return"x";case vj:return"x2"}}function Uj(e){return e in jj}const qj=NB(jj),Wj={x:1,y:1,x2:1,y2:1,...Lj,...jj,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function Hj(e){return e===bj||e===xj||e===_j}const Gj={row:1,column:1,facet:1},Yj=NB(Gj),Vj={...Wj,...Gj},Xj=NB(Vj),{order:Jj,detail:Qj,tooltip:Zj,...Kj}=Vj,{row:eI,column:tI,facet:nI,...iI}=Kj;function rI(e){return!!Vj[e]}NB(Kj),NB(iI);const oI=[sj,lj,yj,vj,pj,dj];function aI(e){return sI(e)!==e}function sI(e){switch(e){case sj:return oj;case lj:return aj;case yj:return mj;case vj:return gj;case pj:return hj;case dj:return fj}return e}function lI(e){if(Bj(e))switch(e){case hj:return"startAngle";case pj:return"endAngle";case fj:return"outerRadius";case dj:return"innerRadius"}return e}function uI(e){switch(e){case oj:return sj;case aj:return lj;case mj:return yj;case gj:return vj;case hj:return pj;case fj:return dj}}function cI(e){switch(e){case oj:case sj:return"width";case aj:case lj:return"height"}}function fI(e){switch(e){case oj:return"xOffset";case aj:return"yOffset";case sj:return"x2Offset";case lj:return"y2Offset";case hj:return"thetaOffset";case fj:return"radiusOffset";case pj:return"theta2Offset";case dj:return"radius2Offset"}}function dI(e){switch(e){case oj:return"xOffset";case aj:return"yOffset"}}function hI(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const pI=NB(Wj),{x:mI,y:gI,x2:yI,y2:vI,xOffset:bI,yOffset:xI,latitude:_I,longitude:wI,latitude2:kI,longitude2:EI,theta:$I,theta2:AI,radius:DI,radius2:SI,...MI}=Wj,CI=NB(MI),FI={x:1,y:1},OI=NB(FI);function NI(e){return e in FI}const TI={theta:1,radius:1},zI=NB(TI);function RI(e){return"width"===e?oj:aj}const PI={xOffset:1,yOffset:1};function LI(e){return e in PI}NB(PI);const{text:BI,tooltip:jI,href:II,url:UI,description:qI,detail:WI,key:HI,order:GI,...YI}=MI,VI=NB(YI),XI={...FI,...TI,...PI,...YI},JI=NB(XI);function QI(e){return!!XI[e]}const ZI={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:KI,...eU}=ZI;function tU(e){switch(e){case oj:case aj:case hj:case fj:case uj:case cj:case kj:case Ej:case Sj:case $j:case Aj:case Dj:case sj:case lj:case pj:case dj:return;case rj:case nj:case ij:case wj:case Mj:case Cj:case Tj:case zj:case Rj:case Pj:return"discrete";case bj:case xj:case _j:return"flexible";case mj:case gj:case yj:case vj:case Oj:case Nj:case Fj:return}}const nU={argmax:1,argmin:1,average:1,count:1,distinct:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},iU={count:1,min:1,max:1};function rU(e){return!!e&&!!e.argmin}function oU(e){return!!e&&!!e.argmax}function aU(e){return vt(e)&&!!nU[e]}const sU=new Set(["count","valid","missing","distinct"]);function lU(e){return vt(e)&&sU.has(e)}const uU=new Set(["count","sum","distinct","valid","missing"]),cU=new Set(["mean","average","median","q1","q3","min","max"]);function fU(e){return ht(e)&&(e=vG(e,void 0)),"bin"+NB(e).map((t=>mU(e[t])?PB(`_${t}_${zB(e[t])}`):PB(`_${t}_${e[t]}`))).join("")}function dU(e){return!0===e||pU(e)&&!e.binned}function hU(e){return"binned"===e||pU(e)&&!0===e.binned}function pU(e){return we(e)}function mU(e){return e?.param}function gU(e){switch(e){case nj:case ij:case kj:case bj:case xj:case _j:case Sj:case $j:case Aj:case Dj:case wj:return 6;case Mj:return 4;default:return 10}}function yU(e){return!!e?.expr}function vU(e){const t=NB(e||{}),n={};for(const i of t)n[i]=SU(e[i]);return n}function bU(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:gB(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function xU(e){return vt(e)||_e(e)&&vt(e[0])}function _U(e){return!!e?.signal}function wU(e){return!!e.step}function kU(e){return!_e(e)&&"field"in e&&"data"in e}const EU=NB({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}),$U={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},AU=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function DU(e){const t=_e(e.condition)?e.condition.map(MU):MU(e.condition);return{...SU(e),condition:t}}function SU(e){if(yU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function MU(e){if(yU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function CU(e){if(yU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return _U(e)?e:void 0!==e?{value:e}:void 0}function FU(e){return _U(e)?e.signal:Dt(e)}function OU(e){return _U(e)?e.signal:Dt(e.value)}function NU(e){return _U(e)?e.signal:null==e?null:Dt(e)}function TU(e,t,n){for(const i of n){const n=PU(i,t.markDef,t.config);void 0!==n&&(e[i]=CU(n))}return e}function zU(e){return[].concat(e.type,e.style??[])}function RU(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?PU(e,t,n,i):void 0}function PU(e,t,n,{vgChannel:i}={}){return VB(i?LU(e,t,n.style):void 0,LU(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function LU(e,t,n){return BU(e,zU(t),n)}function BU(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 jU(e,t){return Ge(e).reduce(((e,n)=>(e.field.push(rG(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function IU(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(hB(t,e))return;n.push(e)})),n}function UU(e,t){return hB(e,t)||!t?e:e?[...Ge(e),...Ge(t)].join(", "):t}function qU(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((xU(n)||_U(n))&&(xU(i)||_U(i)))return{explicit:e.explicit,value:UU(n,i)};if(xU(n)||_U(n))return{explicit:e.explicit,value:n};if(xU(i)||_U(i))return{explicit:e.explicit,value:i};if(!(xU(n)||_U(n)||xU(i)||_U(i)))return{explicit:e.explicit,value:IU(n,i)};throw new Error("It should never reach here")}function WU(e){return`Invalid specification ${vB(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const HU='Autosize "fit" only works for single views and layered views.';function GU(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function YU(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function VU(e){return e?`Dropping "fit-${e}" because spec has discrete ${cI(e)}.`:'Dropping "fit" because spec has discrete size.'}function XU(e){return`Unknown field for ${e}. Cannot calculate view size.`}function JU(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function QU(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function ZU(e){return`Selection not supported for ${e} yet.`}function KU(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function eq(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function tq(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function nq(e){return`${e}Offset dropped because ${e} is continuous`}function iq(e){return`There is no ${e} encoding. Replacing ${e}Offset encoding as ${e}.`}function rq(e){return`Invalid field type "${e}".`}function oq(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 aq(e,t){return`Dropping ${vB(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function sq(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function lq(e){return`${e} encoding has no scale, so specified scale is ignored.`}function uq(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function cq(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function fq(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function dq(e){return`Using unaggregated domain with raw field has no effect (${vB(e)}).`}function hq(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function pq(e){return`Unaggregated domain is currently unsupported for log scale (${vB(e)}).`}function mq(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function gq(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const yq="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function vq(e,t){return`Invalid ${e}: ${vB(t)}.`}function bq(e){return`1D error band does not support ${e}.`}function xq(e){return`Channel ${e} is required for "binned" bin.`}const _q=xe(ye);let wq=_q;function kq(...e){wq.warn(...e)}function Eq(e){if(e&&we(e))for(const t of Oq)if(t in e)return!0;return!1}new WeakMap;const $q=["january","february","march","april","may","june","july","august","september","october","november","december"],Aq=$q.map((e=>e.substr(0,3))),Dq=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Sq=Dq.map((e=>e.substr(0,3)));function Mq(e,t){const n=[];if(t&&void 0!==e.day&&NB(e).length>1&&(kq(function(e){return`Dropping day from datetime ${vB(e)} as day cannot be combined with other units.`}(e)),delete(e=pB(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(tj(e)&&(e=+e),gt(e))return e-1;{const t=e.toLowerCase(),n=$q.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Aq.indexOf(i);if(-1!==r)return r;throw new Error(vq("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(tj(e)&&(e=+e),gt(e))return e>4&&kq(vq("quarter",e)),e-1;throw new Error(vq("quarter",e))}(e.quarter):e.quarter;n.push(gt(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(tj(e)&&(e=+e),gt(e))return e%7;{const t=e.toLowerCase(),n=Dq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Sq.indexOf(i);if(-1!==r)return r;throw new Error(vq("day",e))}}(e.day):e.day;n.push(gt(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 Cq(e){const t=Mq(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Fq={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Oq=NB(Fq);function Nq(e){return we(e)?e.binned:Tq(e)}function Tq(e){return e&&e.startsWith("binned")}function zq(e){return e.startsWith("utc")}const Rq={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Pq(e){return Oq.filter((t=>Bq(e,t)))}function Lq(e){const t=Pq(e);return t[t.length-1]}function Bq(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 jq(e){if(!e)return;const t=Pq(e);return`timeUnitSpecifier(${vB(t)}, ${vB(Rq)})`}function Iq(e){if(!e)return;let t;return vt(e)?t=Tq(e)?{unit:e.substring(6),binned:!0}:{unit:e}:we(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),zq(t.unit)&&(t.utc=!0,t.unit=function(e){return e.substring(3)}(t.unit)),t}function Uq(e,t=(e=>e)){const n=Iq(e),i=Lq(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}=Wq(i,n.step);return`${t(Cq({...e,[o]:+e[o]+r}))} - ${t(Cq(e))}`}}const qq={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function Wq(e,t=1){if(function(e){return!!qq[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 Hq(e){return!!e?.field&&void 0!==e.equal}function Gq(e){return!!e?.field&&void 0!==e.lt}function Yq(e){return!!e?.field&&void 0!==e.lte}function Vq(e){return!!e?.field&&void 0!==e.gt}function Xq(e){return!!e?.field&&void 0!==e.gte}function Jq(e){if(e?.field){if(_e(e.range)&&2===e.range.length)return!0;if(_U(e.range))return!0}return!1}function Qq(e){return!!e?.field&&(_e(e.oneOf)||_e(e.in))}function Zq(e){return Qq(e)||Hq(e)||Jq(e)||Gq(e)||Vq(e)||Yq(e)||Xq(e)}function Kq(e,t){return _G(e,{timeUnit:t,wrapTime:!0})}function eW(e,t=!0){const{field:n}=e,i=Iq(e.timeUnit),{unit:r,binned:o}=i||{},a=rG(e,{expr:"datum"}),s=r?`time(${o?a:function(e,t,{end:n}={end:!1}){const i=IB(t),r=zq(e)?"utc":"";let o;const a={};for(const t of Oq)Bq(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=Mq(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}(r,n)})`:a;if(Hq(e))return`${s}===${Kq(e.equal,r)}`;if(Gq(e))return`${s}<${Kq(e.lt,r)}`;if(Vq(e))return`${s}>${Kq(e.gt,r)}`;if(Yq(e))return`${s}<=${Kq(e.lte,r)}`;if(Xq(e))return`${s}>=${Kq(e.gte,r)}`;if(Qq(e))return`indexof([${function(e,t){return e.map((e=>Kq(e,t)))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return tW(s,e.valid);if(Jq(e)){const{range:n}=e,i=_U(n)?{signal:`${n.signal}[0]`}:n[0],o=_U(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+Kq(i,r)+", "+Kq(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${Kq(i,r)}`),null!==o&&a.push(`${s} <= ${Kq(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${vB(e)}`)}function tW(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function nW(e){return Zq(e)&&e.timeUnit?{...e,timeUnit:Iq(e.timeUnit)}:e}const iW={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function rW(e){return"ordinal"===e||"nominal"===e}const oW=iW.quantitative,aW=iW.ordinal,sW=iW.temporal,lW=iW.nominal,uW=iW.geojson;NB(iW);const cW={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"},fW={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 dW(e,t){const n=fW[e],i=fW[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}NB(fW);const hW={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 pW(e){return hW[e]}const mW=new Set(["linear","log","pow","sqrt","symlog"]),gW=new Set([...mW,"time","utc"]);function yW(e){return mW.has(e)}const vW=new Set(["quantile","quantize","threshold"]),bW=new Set([...gW,...vW,"sequential","identity"]),xW=new Set(["ordinal","bin-ordinal","point","band"]);function _W(e){return xW.has(e)}function wW(e){return bW.has(e)}function kW(e){return gW.has(e)}function EW(e){return vW.has(e)}function $W(e){return e?.param}new Set(["time","utc"]);const AW={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:DW,domain:SW,range:MW,rangeMax:CW,rangeMin:FW,scheme:OW,...NW}=(NB(AW),AW),TW=NB(NW);function zW(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 kW(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return kW(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 kW(e);case"nice":return kW(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return wW(e)&&!_B(["log","time","utc","threshold","quantile"],e)}}function RW(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Hj(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 PW={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"},LW=PW.arc,BW=PW.area,jW=PW.bar,IW=PW.image,UW=PW.line,qW=PW.point,WW=PW.rect,HW=PW.rule,GW=PW.text,YW=PW.tick,VW=PW.trail,XW=PW.circle,JW=PW.square,QW=PW.geoshape;function ZW(e){return["line","area","trail"].includes(e)}function KW(e){return["rect","bar","image","arc"].includes(e)}const eH=new Set(NB(PW));function tH(e){return e.type}const nH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],iH=NB({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),rH=NB({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 oH(e){return e&&null!=e.band}const aH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]};function sH(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=dH(e);return WH(n)&&!lU(n.aggregate)&&r&&kW(r.get("type"))?function({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(ZW(n.type))return i;return null===RU("invalid",n,r)?[lH(e,t),i]:i}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function lH(e,t){return{test:uH(e,!0),..."y"===sI(t)?{field:{group:"height"}}:{value:0}}}function uH(e,t=!0){return tW(vt(e)?e:rG(e,{expr:"datum"}),!t)}function cH(e,t,n,i){const r={};if(t&&(r.scale=t),GH(e)){const{datum:t}=e;Eq(t)?r.signal=Cq(t):_U(t)?r.signal=t.signal:yU(t)?r.signal=t.expr:r.value=t}else r.field=rG(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function fH({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,bandPosition:o=.5}){const a=0PB(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+NB(n).map((e=>PB(`_${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?GB(n):t.expr?UB(n,t.expr)+o:WB(n)+o}function oG(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return WH(e)&&!!e.bin;case"temporal":return!1}throw new Error(rq(e.type))}const aG=(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(oU(t))return`${r} for argmax(${t.argmax})`;if(rU(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Nq(i)?Iq(i):void 0,a=t||o?.unit||o?.maxbins&&"timeunit"||dU(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(dU(i))return`${n} (binned)`;if(r&&!Nq(r)){const e=Iq(r)?.unit;if(e)return`${n} (${Pq(e).join("-")})`}else if(o)return oU(o)?`${n} for max ${o.argmax}`:rU(o)?`${n} for min ${o.argmin}`:`${jB(o)} of ${n}`;return n}(e,t)}};let sG=aG;function lG(e){sG=e}function uG(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=cG(e)?.title;if(!WH(e))return r??e.title;const o=e,a=i?fG(o,t):void 0;return n?VB(r,o.title,a):r??o.title??a}function cG(e){return eG(e)&&e.axis?e.axis:tG(e)&&e.legend?e.legend:NH(e)&&e.header?e.header:void 0}function fG(e,t){return sG(e,t)}function dG(e){if(nG(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=cG(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function hG(e){return WH(e)?e:UH(e)?e.condition:void 0}function pG(e){return JH(e)?e:qH(e)?e.condition:void 0}function mG(e,t,n,i={}){return vt(e)||gt(e)||ht(e)?(kq(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${vB(n)}}.`}(t,vt(e)?"string":gt(e)?"number":"boolean",e)),{value:e}):JH(e)?gG(e,t,n,i):qH(e)?{...e,condition:gG(e.condition,t,n,i)}:e}function gG(e,t,n,i){if(nG(e)){const{format:r,formatType:o,...a}=e;if(pH(o)&&!n.customFormatTypes)return kq(tq(t)),gG(a,t,n,i)}else{const r=eG(e)?"axis":tG(e)?"legend":NH(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(pH(a)&&!n.customFormatTypes)return kq(tq(t)),gG({...e,[r]:s},t,n,i)}}return WH(e)?yG(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=gt(n)?"quantitative":vt(n)?"nominal":Eq(n)?"temporal":void 0,{...e,type:t}}(e)}function yG(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||aU(i)||oU(i)||rU(i)||(kq(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=Iq(r)),a&&(s.field=`${a}`),dU(o)&&(s.bin=vG(o,t)),hU(o)&&!NI(t)&&kq(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),QH(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case oW:return"quantitative";case"t":case sW:return"temporal";case"o":case aW:return"ordinal";case"n":case lW:return"nominal";case uW:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&lU(i)&&(kq(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!aI(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(RH(e)&&_e(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!oU(n)&&!rU(n))return"quantitative";if(KH(e)&&e.scale?.type)switch(fW[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(QH(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 nj:case ij:case rj:return oG(e)?bG:{compatible:!1,warning:uq(t)};case oj:case aj:case uj:case cj:case bj:case xj:case _j:case Cj:case Oj:case Nj:case Tj:case zj:case Rj:case Ej:case hj:case fj:case Pj:return bG;case gj:case vj:case mj:case yj:return n!==oW?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:bG;case $j:case Aj:case Dj:case Sj:case kj:case pj:case dj:case sj:case lj:return"nominal"!==n||e.sort?bG:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case wj:case Mj:return oG(e)||function(e){return KH(e)&&EW(e.scale?.type)}(e)?bG:{compatible:!1,warning:cq(t)};case Fj:return"nominal"!==e.type||"sort"in e?bG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,t)||{};!1===e&&kq(n)}if(RH(s)&&vt(s.sort)){const{sort:e}=s;if(SH(e))return{...s,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&SH(t))return{...s,sort:{encoding:t,order:"descending"}}}if(NH(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 vG(e,t){return ht(e)?{maxbins:gU(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:gU(t)}}const bG={compatible:!0};function xG(e){const{formatType:t}=dG(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||WH(e)&&!!e.timeUnit)}(e)}function _G(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const o=t&&Iq(t)?.unit;let a,s=o||"temporal"===n;return yU(e)?a=e.expr:_U(e)?a=e.signal:Eq(e)?(s=!0,a=Cq(e)):(vt(e)||gt(e))&&s&&(a=`datetime(${vB(e)})`,function(e){return!!Fq[e]}(o)&&(gt(e)&&e<1e4||vt(e)&&isNaN(Date.parse(e)))&&(a=Cq({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:vB(e)}function wG(e,t){const{type:n}=e;return t.map((t=>{const i=_G(t,{timeUnit:WH(e)&&!Nq(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function kG(e,t){return dU(e.bin)?QI(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const EG={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 $G(e){return e?.condition}const AG=["domain","grid","labels","ticks","title"],DG={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"},SG={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},MG={...SG,style:1,labelExpr:1,encoding:1};function CG(e){return!!MG[e]}NB(MG);const FG=NB({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 OG(e){return"mark"in e}class NG{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!OG(e)&&function(e){return tH(e)?e.type:e}(e.mark)===this.name}}function TG(e,t){const n=e&&e[t];return!!n&&(_e(n)?wB(n,(e=>!!e.field)):WH(n)||UH(n))}function zG(e,t){const n=e&&e[t];return!!n&&(_e(n)?wB(n,(e=>!!e.field)):WH(n)||GH(n)||qH(n))}function RG(e,t){if(NI(t)){const n=e[t];if((WH(n)||GH(n))&&(rW(n.type)||WH(n)&&n.timeUnit))return zG(e,dI(t))}return!1}function PG(e){return wB(Xj,(t=>{if(TG(e,t)){const n=e[t];if(_e(n))return wB(n,(e=>!!e.aggregate));{const e=hG(n);return e&&!!e.aggregate}}return!1}))}function LG(e,t){const n=[],i=[],r=[],o=[],a={};return IG(e,((s,l)=>{if(WH(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=cG(s),p=e?.title;let m=rG(s,{forAs:!0});const g={...p?[]:{title:uG(s,t,{allowDisabling:!0})},...h,field:m};if(c){let e;if(oU(c)?(e="argmax",m=rG({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):rU(c)?(e="argmin",m=rG({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),QH(s)&&dU(f)){if(i.push({bin:f,field:u,as:m}),n.push(rG(s,{binSuffix:"end"})),kG(s,l)&&n.push(rG(s,{binSuffix:"range"})),NI(l)){const e={field:`${m}_end`};a[`${l}2`]=e}g.bin="binned",aI(l)||(g.type=oW)}else if(d&&!Nq(d)){r.push({timeUnit:d,field:u,as:m});const e=QH(s)&&s.type!==sW&&"time";e&&(l===Cj||l===Tj?g.formatType=e:function(e){return!!MI[e]}(l)?g.legend={formatType:e,...g.legend}:NI(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 BG(e,t,n){const i=function(e,t){return function(e){switch(e){case bj:case xj:case _j:case Pj:case Oj:case Nj:case Tj:case zj:case Fj:case $j:case Aj:case Dj:case Sj:case rj:case nj:case ij:return ZI;case oj:case aj:case uj:case cj:case mj:case gj:return eU;case sj:case lj:case yj:case vj:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case kj:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Mj:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case wj:return{point:"always",geoshape:"always"};case Cj:return{text:"always"};case Ej:return{point:"always",square:"always",text:"always"};case Rj:return{image:"always"};case hj:case fj:return{text:"always",arc:"always"};case pj:case dj:return{arc:"always"}}}(e)[t]}(t,n);if(!i)return!1;if("binned"===i){const n=e[t===sj?oj:aj];return!!(WH(n)&&WH(e[t])&&hU(n.bin))}return!0}function jG(e,t){const n={};for(const i of NB(e)){const r=mG(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function IG(e,t,n){if(e)for(const i of NB(e)){const r=e[i];if(_e(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function UG(e,t){return NB(t).reduce(((n,i)=>{switch(i){case oj:case aj:case zj:case Pj:case Rj:case sj:case lj:case uj:case cj:case hj:case pj:case fj:case dj:case mj:case gj:case yj:case vj:case Cj:case wj:case Ej:case Tj:return n;case Fj:if("line"===e||"trail"===e)return n;case Oj:case Nj:{const e=t[i];if(_e(e)||WH(e))for(const t of Ge(e))t.aggregate||n.push(rG(t,{}));return n}case kj:if("trail"===e)return n;case bj:case xj:case _j:case $j:case Aj:case Dj:case Mj:case Sj:{const e=hG(t[i]);return e&&!e.aggregate&&n.push(rG(e,{})),n}}}),[])}function qG(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 ${WG(t)}`:"";return{field:e+t.field,type:t.type,title:_U(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),o=function(e){const t=[];for(const n of NB(e))if(TG(e,n)){const i=Ge(e[n]);for(const e of i)WH(e)?t.push(e):UH(e)&&t.push(e.condition)}return t}(n).map(iG);return{tooltip:[...r,...AB(o,bB)]}}function WG(e){const{title:t,field:n}=e;return VB(t,n)}function HG(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=WG(n);return GG(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}:{}},...vt(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function GG(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}:{},...tH(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...ht(e[t])?{}:e[t]}}]:[]}function YG(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:VG(o,n),continuousAxisChannelDef2:VG(a,n),continuousAxisChannelDefError:VG(s,n),continuousAxisChannelDefError2:VG(l,n),continuousAxis:r}}function VG(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&kq(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function XG(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(tH(n)&&n.orient)return n.orient;if(YH(r)){if(YH(o)){const e=WH(r)&&r.aggregate,n=WH(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 xG(o)&&!xG(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(YH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const JG="boxplot",QG=new NG(JG,KG);function ZG(e){return gt(e)?"tukey":e}function KG(e,{config:t}){e={...e,encoding:jG(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=tH(n)?n:{type:n};r&&kq(ZU("boxplot"));const l=s.extent??t.boxplot.extent,u=RU("size",s,t),c=s.invalid,f=ZG(l),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=XG(e,JG),{continuousAxisChannelDef:r,continuousAxis:o}=YG(e,i,JG),a=r.field,s=ZG(t),l=[...eY(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(_e(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 _e(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(f),{bins:p,timeUnits:m,aggregate:g,groupby:y,encoding:v}=LG(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,...$}=b,A=e=>HG(s,g,m,e,t.boxplot),D=A($),S=A(b),M=A({...$,...E?{size:E}:{}}),C=qG([{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),F={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O="min-max"===f?C:qG([{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:F,positionPrefix:"lower_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"upper_whisker",extraEncoding:O})],T=[..."tukey"!==f?N:[],...S({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:C}),...M({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:C})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(p),layer:T};const z=`datum["lower_box_${m.field}"]`,R=`datum["upper_box_${m.field}"]`,P=`(${R} - ${z})`,L=`${z} - ${l} * ${P}`,B=`${R} + ${l} * ${P}`,j=`datum["${m.field}"]`,I={joinaggregate:eY(m.field),groupby:y},U={transform:[{filter:`(${L} <= ${j}) && (${j} <= ${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}=$,{scale:H,axis:G}=m,Y=WG(m),V=yB(G,["title"]),X=GG(s,"outliers",t.boxplot,{transform:[{filter:`(${j} < ${L}) || (${j} > ${B})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...void 0!==Y?{title:Y}:{},...void 0!==H?{scale:H}:{},...OB(V)?{}:{axis:V}},...W,...k?{color:k}:{},...w?{tooltip:w}:{}}})[0];let J;const Q=[...d,...h,I];return X?J={transform:Q,layer:[X,U]}:(J=U,J.transform.unshift(...Q)),{...a,layer:[J,{transform:p,layer:T}]}}function eY(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const tY="errorbar",nY=new NG(tY,iY);function iY(e,{config:t}){e={...e,encoding:jG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=rY(e,tY,t);delete o.size;const c=HG(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 rY(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=tH(i)?i:{type:i};o&&kq(ZU(t));const{orient:u,inputType:c}=function(e,t){const{encoding:n}=e;if(function(e){return(JH(e.x)||JH(e.y))&&!JH(e.x2)&&!JH(e.y2)&&!JH(e.xError)&&!JH(e.xError2)&&!JH(e.yError)&&!JH(e.yError2)}(n))return{orient:XG(e,t),inputType:"raw"};const i=function(e){return JH(e.x2)||JH(e.y2)}(n),r=function(e){return JH(e.xError)||JH(e.xError2)||JH(e.yError)||JH(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(JH(e)&&JH(i))throw new Error(`${t} cannot have both x2 and y2`);if(JH(e)){if(YH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(JH(i)){if(YH(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(JH(i)&&!JH(e))throw new Error(`${t} cannot have xError2 without xError`);if(JH(s)&&!JH(r))throw new Error(`${t} cannot have yError2 without yError`);if(JH(e)&&JH(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(JH(e)){if(YH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(JH(r)){if(YH(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}=YG(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)&&kq(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:jB(t)},{fieldPrefix:"upper_",titlePrefix:oY(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:oY(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:uG({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:uG({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:uG({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&kq(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:HB(HB(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"]:_,["x"===m?"xError":"yError"]:w,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:$,timeUnits:A,aggregate:D,groupby:S,encoding:M}=LG(E,n),C=[...D,...g],F="raw"!==c?[]:S,O=qG(v,f,M,b);return{transform:[...s.transform??[],...$,...A,...0===C.length?[]:[{aggregate:C,groupby:F}],...y],groupby:F,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:M,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function oY(e,t,n){return`${jB(e)} ${n} ${t}`}const aY="errorband",sY=new NG(aY,lY);function lY(e,{config:t}){e={...e,encoding:jG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=rY(e,aY,t),u=a,c=HG(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?kq(bq("interpolate")):u.tension&&kq(bq("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 uY={};function cY(e,t,n){const i=new NG(e,t);uY[e]={normalizer:i,parts:n}}cY(JG,KG,["box","median","outliers","rule","ticks"]),cY(tY,iY,["ticks","rule"]),cY(aY,lY,["band","borders"]);const fY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],dY={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"},hY={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"},pY=NB(dY),mY=NB(hY),gY=NB({header:1,headerRow:1,headerColumn:1,headerFacet:1}),yY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],vY={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},bY=(NB(vY),"_vgsid_"),xY={point:{on:"click",fields:[bY],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 _Y(e){return"legend"===e||!!e?.legend}function wY(e){return _Y(e)&&we(e)}function kY(e){return!!e?.select}function EY(e){const t=[];for(const n of e||[]){if(kY(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 $Y(e){return"concat"in e}function AY(e){return"vconcat"in e}function DY(e){return"hconcat"in e}function SY({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function MY(e){return we(e)&&void 0!==e.step}function CY(e){return e.view||e.width||e.height}const FY=NB({align:1,bounds:1,center:1,columns:1,spacing:1});function OY(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function NY(e,t){const n=TY(e,t);return MY(n)?n.step:zY}function TY(e,t){return VB(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const zY=20,RY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:zY},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:xY,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},PY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],LY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},BY={blue:PY[0],orange:PY[1],red:PY[2],teal:PY[3],green:PY[4],yellow:PY[5],purple:PY[6],pink:PY[7],brown:PY[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 jY(e){const t=NB(e||{}),n={};for(const i of t){const t=e[i];n[i]=$G(t)?DU(t):SU(t)}return n}const IY=[...rH,...FG,...gY,"background","padding","legend","lineBreak","scale","style","title","view"];function UY(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=Ee({},pB(RY),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)?{...BY,...e}:BY}],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)?{...LY,...e}:LY}],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&&$e(a,"selection",r,!0);const s=yB(a,IY);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=SU(a[e]));for(const e of rH)a[e]&&(s[e]=vU(a[e]));for(const e of FG)a[e]&&(s[e]=jY(a[e]));for(const e of gY)a[e]&&(s[e]=vU(a[e]));return a.legend&&(s.legend=vU(a.legend)),a.scale&&(s.scale=vU(a.scale)),a.style&&(s.style=function(e){const t=NB(e),n={};for(const i of t)n[i]=jY(e[i]);return n}(a.style)),a.title&&(s.title=vU(a.title)),a.view&&(s.view=vU(a.view)),s}const qY=new Set(["view",...eH]),WY=["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"],HY={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 GY(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};OB(r)||(e.style[n??t]=r),i||delete e[t]}function YY(e){return"layer"in e}class VY{map(e,t){return TH(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):DY(e)?this.mapHConcat(e,t):AY(e)?this.mapVConcat(e,t):$Y(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(YY(e))return this.mapLayer(e,t);if(OG(e))return this.mapUnit(e,t);throw new Error(WU(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 XY={zero:1,center:1,normalize:1},JY=new Set([LW,jW,BW,HW,qW,XW,JW,UW,GW,YW]),QY=new Set([jW,BW,LW]);function ZY(e){return WH(e)&&"quantitative"===HH(e)&&!e.bin}function KY(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t,a=e[t],s=e[r];if(WH(a)&&WH(s))if(ZY(a)&&ZY(s)){if(a.stack)return t;if(s.stack)return r;const e=WH(a)&&!!a.aggregate;if(e!==(WH(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(ZY(a))return t;if(ZY(s))return r}else{if(ZY(a))return t;if(ZY(s))return r}}function eV(e,t){const n=tH(e)?e:{type:e},i=n.type;if(!JY.has(i))return null;const r=KY(t,"x",n)||KY(t,"theta",n);if(!r)return null;const o=t[r],a=WH(o)?rG(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=WH(e)?rG(e,{}):void 0;n&&n!==a&&(l.push(s),u.add(n));const i="x"===s?"xOffset":"yOffset",r=t[i],o=WH(r)?rG(r,{}):void 0;o&&o!==a&&(l.push(i),u.add(o))}const c=CI.reduce(((e,n)=>{if("tooltip"!==n&&TG(t,n)){const i=t[n];for(const t of Ge(i)){const i=hG(t);if(i.aggregate)continue;const r=rG(i,{});r&&u.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let f;return void 0!==o.stack?f=ht(o.stack)?o.stack?"zero":null:o.stack:QY.has(i)&&(f="zero"),f&&f in XY?PG(t)&&0===c.length?null:o?.scale?.type&&o?.scale?.type!==cW.LINEAR?(o?.stack&&kq(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type)),null):JH(t[uI(r)])?(void 0!==o.stack&&kq(`Cannot stack "${d=r}" if there is already "${d}2".`),null):(WH(o)&&o.aggregate&&!uU.has(o.aggregate)&&kq(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:r,impute:null!==o.impute&&ZW(i),stackBy:c,offset:f}):null;var d}function tV(e,t,n){const i=vU(e),r=RU("orient",i,n);if(i.orient=function(e,t,n){switch(e){case qW:case XW:case JW:case GW:case WW:case IW:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case jW:if(WH(i)&&(hU(i.bin)||WH(r)&&r.aggregate&&!i.aggregate))return"vertical";if(WH(r)&&(hU(r.bin)||WH(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(WH(i)&&i.type===oW&&!dU(i.bin)||XH(i))&&WH(r)&&hU(r.bin)?"horizontal":"vertical";if(!a)return(WH(r)&&r.type===oW&&!dU(r.bin)||XH(r))&&WH(i)&&hU(i.bin)?"vertical":"horizontal"}case HW:if(o&&(!WH(i)||!hU(i.bin))&&a&&(!WH(r)||!hU(r.bin)))return;case BW:if(a)return WH(r)&&hU(r.bin)?"horizontal":"vertical";if(o)return WH(i)&&hU(i.bin)?"vertical":"horizontal";if(e===HW){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case UW:case YW:{const t=VH(i),o=VH(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=QH(i)&&i.type===sW,t=QH(r)&&r.type===sW;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&kq(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=RU("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:aH[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}return void 0===RU("opacity",i,n)&&(i.opacity=function(e,t){if(_B([qW,YW,XW,JW],e)&&!PG(t))return.7}(i.type,t)),void 0===RU("cursor",i,n)&&(i.cursor=function(e,t,n){return t.href||e.href||RU("href",e,n)?"pointer":e.cursor}(i,t,n)),i}function nV(e){const{point:t,line:n,...i}=e;return NB(i).length>1?i:i.type}function iV(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:yB(e[t],["point","line"])});return e}function rV(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 oV(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 aV{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(OG(e)){const{mark:n,encoding:i}=e,r=tH(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!rV(r,t[r.type],i);case"area":return!!rV(r,t[r.type],i)||!!oV(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=jG(l,i),f=tH(a)?a:{type:a},d=rV(f,i[f.type],c),h="area"===f.type&&oV(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:nV({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:yB(c,["shape"])}],m=eV(tV(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=yB(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...gB(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...gB(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:iV(i)})}}function sV(e,t){return t?OH(e)?hV(e,t):cV(e,t):e}function lV(e,t){return t?hV(e,t):e}function uV(e,t,n){const i=t[e];return function(e){return e&&!vt(e)&&"repeat"in e}(i)?i.repeat in n?{...t,[e]:n[i.repeat]}:void kq(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function cV(e,t){if(void 0!==(e=uV("field",e,t))){if(null===e)return null;if(RH(e)&&CH(e.sort)){const n=uV("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function fV(e,t){if(WH(e))return cV(e,t);{const n=uV("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function dV(e,t){if(!JH(e)){if(qH(e)){const n=fV(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=fV(e,t);if(n)return n;if(IH(e))return{condition:e.condition}}}function hV(e,t){const n={};for(const i in e)if(st(e,i)){const r=e[i];if(_e(r))n[i]=r.map((e=>dV(e,t))).filter((e=>e));else{const e=dV(r,t);void 0!==e&&(n[i]=e)}}return n}class pV{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(OG(e)){const{encoding:t,mark:n}=e;if("line"===n||tH(n)&&"line"===n.type)for(const e of oI){const n=t[sI(e)];if(t[e]&&(WH(n)&&!hU(n.bin)||GH(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return kq((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 mV({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...NB(e),...NB(t)]);for(const o of r){const r=t[o],a=e[o];if(JH(r)){const e={...a,...r};i[o]=e}else qH(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||ZH(a)||_U(a)||JH(a)||_e(a))&&(i[o]=a)}}else i=t;return!i||OB(i)?void 0:i}function gV(e){const{parentProjection:t,projection:n}=e;return t&&n&&kq(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${vB(t)} is overridden by a child projection ${vB(n)}.`}({parentProjection:t,projection:n})),n??t}function yV(e){return"filter"in e}function vV(e){return void 0!==e?.stop}function bV(e){return"lookup"in e}function xV(e){return"pivot"in e}function _V(e){return"density"in e}function wV(e){return"quantile"in e}function kV(e){return"regression"in e}function EV(e){return"loess"in e}function $V(e){return"sample"in e}function AV(e){return"window"in e}function DV(e){return"joinaggregate"in e}function SV(e){return"flatten"in e}function MV(e){return"calculate"in e}function CV(e){return"bin"in e}function FV(e){return"impute"in e}function OV(e){return"timeUnit"in e}function NV(e){return"aggregate"in e}function TV(e){return"stack"in e}function zV(e){return"fold"in e}function RV(e){return"extent"in e&&!("density"in e)}function PV(e,t){const{transform:n,...i}=e;if(n){const e=n.map((e=>{if(yV(e))return{filter:jV(e,t)};if(CV(e)&&pU(e.bin))return{...e,bin:BV(e.bin)};if(bV(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}));return{...i,transform:e}}return e}function LV(e,t){const n=pB(e);if(WH(n)&&pU(n.bin)&&(n.bin=BV(n.bin)),KH(n)&&n.scale?.domain?.selection){const{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(IH(n))if(_e(n.condition))n.condition=n.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:jV(e,t)}}));else{const{selection:e,param:i,test:r,...o}=LV(n.condition,t);n.condition=i?n.condition:{...o,test:jV(n.condition,t)}}return n}function BV(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function jV(e,t){const n=e=>dB(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):dB(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class IV extends VY{map(e,t){const n=t.selections??[];if(e.params&&!OG(e)){const t=[];for(const i of e.params)kY(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)(vt(n)&&(n===e.name||i.includes(n))||_e(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=IV.prototype[e];IV.prototype[e]=function(e,n){return t.call(this,e,UV(e,n))}}function UV(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function qV(e,t){void 0===t&&(t=UY(e.config));const n=function(e,t={}){const n={config:t};return GV.map(WV.map(HV.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=OG(e)||YY(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&&(kq(GU("width")),i=void 0),"container"==r&&(kq(GU("height")),r=void 0));const s={type:"pad",...a,...n?YV(n.autosize):{},...YV(e.autosize)};if("fit"!==s.type||o||(kq(HU),s.type="pad"),"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&kq(YU("width")),"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&kq(YU("height")),!hB(s,{type:"pad"}))return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const WV=new class extends VY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[QG,nY,sY,new aV,new pV]}map(e,t){if(OG(e)){const n=TG(e.encoding,nj),i=TG(e.encoding,ij),r=TG(e.encoding,rj);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=lV(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!_e(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_${PB(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;!_e(n)&&e.columns&&(e=yB(e,["columns"]),kq(KU("repeat")));const a=[],{repeater:s={},repeaterPrefix:l=""}=t,u=!_e(n)&&n.row||[s?s.row:null],c=!_e(n)&&n.column||[s?s.column:null],f=_e(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__"+(_e(n)?`${PB(e)}`:(n.row?`row_${PB(r)}`:"")+(n.column?`column_${PB(o)}`:"")),f=this.map(i,{...t,repeater:u,repeaterPrefix:c});f.name=c,a.push(yB(f,["data"]))}const d=_e(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 OH(n)&&e.columns&&(e=yB(e,["columns"]),kq(KU("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=gV({parentProjection:o,projection:i}),l=mV({parentEncoding:r,encoding:lV(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=lV(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&&kq(`Facet encoding dropped as ${(o=[...n?[nj]:[],...i?[ij]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[nj,ij]){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:sV(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:mV({parentEncoding:t,encoding:r,layer:!0}),parentProjection:gV({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},HV=new class extends VY{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=PV(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=PV(e,t)).encoding){const n={};for(const[i,r]of zB(e.encoding))n[i]=LV(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:zB(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 TB(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},GV=new IV;function YV(e){return vt(e)?{type:e}:e??{}}const VV=["background","padding"];function XV(e,t){const n={};for(const t of VV)e&&void 0!==e[t]&&(n[t]=SU(e[t]));return t&&(n.params=e.params),n}class JV{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new JV(pB(this.explicit),pB(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return VB(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 NB(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function QV(e){return{explicit:!0,value:e}}function ZV(e){return{explicit:!1,value:e}}function KV(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:eX(t,n,i,r)}}function eX(e,t,n,i){return e.explicit&&t.explicit&&kq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${vB(n)} and ${vB(i)}). Using ${vB(n)}.`}(n,i,e.value,t.value)),e}function tX(e,t,n,i,r=eX){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:hB(e.value,t.value)?e:r(e,t,n,i)}class nX extends JV{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 iX(e){return"url"in e}function rX(e){return"values"in e}function oX(e){return"name"in e&&!iX(e)&&!rX(e)&&!aX(e)}function aX(e){return e&&(sX(e)||lX(e)||uX(e))}function sX(e){return"sequence"in e}function lX(e){return"sphere"in e}function uX(e){return"graticule"in e}var cX;function fX(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=WB(r.field),r}function dX(e,t=!0,n=ue){if(_e(e)){const i=e.map((e=>dX(e,t,n)));return t?`[${i.join(", ")}]`:i}return Eq(e)?n(t?Cq(e):function(e){const t=Mq(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(vB(e)):e}function hX(e,t){for(const n of TB(e.component.selection??{})){const i=n.name;let r=`${i}${NJ}, ${"global"===n.resolve?"true":`{unit: ${PJ(e)}}`}`;for(const i of RJ)i.defined(n)&&(i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(r=i.modifyExpr(e,n,r)));t.push({name:i+TJ,on:[{events:{signal:n.name+NJ},update:`modify(${Dt(n.name+OJ)}, ${r})`}]})}return gX(t)}function pX(e,t){if(e.component.selection&&NB(e.component.selection).length){const n=Dt(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:OT("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return gX(t)}function mX(e,t){for(const n of TB(e.component.selection??{}))for(const i of RJ)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function gX(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"}(cX||(cX={}));class yX{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)?kq("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 vX extends yX{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 ${JB()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function bX(e){return void 0!==e.as}function xX(e){return`${e}_end`}class _X extends yX{clone(){return new _X(null,pB(this.formula))}constructor(e,t){super(e),this.formula=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n)=>{const{field:i,timeUnit:r}=n;if(r){let o;if(Nq(r)){if(pK(t)){const{mark:e}=t;(KW(e)||n.bandPosition)&&(o={timeUnit:Iq(r),field:i})}}else o={as:rG(n,{forAs:!0}),field:i,timeUnit:r};o&&(e[bB(o)]=o)}return e}),{});return OB(n)?null:new _X(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Iq(n)};return new _X(e,{[bB(r)]:r})}merge(e){this.formula={...this.formula};for(const t in e.formula)this.formula[t]||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of zB(this.formula)){const r=bX(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.formula=t}producedFields(){return new Set(TB(this.formula).map((e=>bX(e)?e.as:xX(e.field))))}dependentFields(){return new Set(TB(this.formula).map((e=>e.field)))}hash(){return`TimeUnit ${bB(this.formula)}`}assemble(){const e=[];for(const t of TB(this.formula))if(bX(t)){const{field:n,as:i,timeUnit:r}=t,{unit:o,utc:a,...s}=Iq(r);e.push({field:WB(n),type:"timeunit",...o?{units:Pq(o)}:{},...a?{timezone:"utc"}:{},...s,as:[i,`${i}_end`]})}else if(t){const{field:n,timeUnit:i}=t,r=Lq(i?.unit),{part:o,step:a}=Wq(r,i.step);e.push({type:"formula",expr:`timeOffset('${o}', datum['${n}'], ${a})`,as:xX(n)})}return e}}const wX="_tuple_fields";class kX{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const EX={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new kX),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=PB(`${i}_${n}`);for(let e=1;s.has(r);e++)r=PB(`${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 NB(e))iI[t]?(h||(h=[])).push(t):"interval"===u?(kq('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){kq(QU(t,n.aggregate));continue}if(!i){kq(JU(t));continue}if(n.timeUnit&&!Nq(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};a[bB(r)]=r}if(!o[i]){const a={field:i,channel:t,type:"interval"===u&&QI(t)&&wW(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===bY,Uj(t)?(a.geoChannel=t,a.channel=Ij(t),r.hasChannel[a.channel]=o[i]):r.hasChannel[t]=o[i]}}else kq(JU(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===bY}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))))),OB(a)||(r.timeUnit=new _X(null,a))},signals:(e,t,n)=>{const i=t.name+wX;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(fX)})}},$X=EX,AX={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(!QI(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&wW(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):kq("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||MX(e)||0===i.length)return n;const r=n.filter((e=>e.name===t.name))[0];let o=r.update;if(o.indexOf(zJ)>=0)r.update=`{${i.map((e=>`${Dt(WB(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${Dt(WB(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&&!MX(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}},DX=AX;function SX(e,t){return`domain(${Dt(e.scaleName(t))})`}function MX(e){return e.parent&&yK(e.parent)&&(!e.parent.parent??MX(e.parent.parent))}const CX="_brush",FX="_scale_trigger",OX="geo_interval_init_tick",NX="_init",TX={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...we(n.select)?n.select:{}};e.fields=[bY],e.encodings||(e.encodings=n.value?NB(n.value):[gj,mj]),n.select={type:"interval",...e}}if(t.translate&&!DX.defined(t)){const e=`!event.item || event.item.mark.name !== ${Dt(t.name+CX)}`;for(const n of t.events){if(!n.between){kq(`${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+NJ,o=TB(t.project.hasChannel).filter((e=>e.channel===oj||e.channel===aj)),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=Dt(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===oj?"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=DX.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:dX(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+FX},update:wW(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:dX(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===oj?0:1,n=t.name+NX;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=Dt(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+NX,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: ${Dt(e.getName("marks"))}}, unit.mark), {unit: ${PJ(e)}})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:OX}]:[]],update:y}]})}{if(!DX.defined(t)){const t=i+FX,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=Dt(e.scaleName(n)),a=wW(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: ${PJ(e)}, fields: ${i+wX}, values`;return n.concat({name:r,...a?{init:`{${l}: ${dX(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(pK(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===OX)).length||n.unshift({name:OX,value:null,on:[{events:"timer{1}",update:`${OX} === null ? {} : ${OX}`}]})}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(${Dt(t.name+OJ)})`;if(DX.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 NB(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${PJ(e)}`,...u[t]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=NB(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+CX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+CX,type:"rect",clip:!0,encode:{enter:{...d?{cursor:{value:d}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}},zX=TX,RX={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+wX,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=TB(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+CX):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: ${PJ(e)}, `;t.project.hasSelectionId?u+=`${bY}: ${a}[${Dt(bY)}]`:u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${a}[${Dt(e.vgField(t.channel,{}))}], ${a}[${Dt(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${Dt(t.field)}]`})).join(", ")}]`;const c=t.events;return n.concat([{name:i+NJ,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}},PX=RX;function LX(e,t,n,i){const r=IH(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:WJ(e,{param:i,empty:r}),...n}}return{test:GJ(e,t.test),...n}}));return{[n]:[...t,...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function BX(e,t="text"){const n=e.encoding[t];return LX(e,n,t,(t=>jX(t,e.config)))}function jX(e,t,n="datum"){if(e){if(ZH(e))return CU(e.value);if(JH(e)){const{format:i,formatType:r}=dG(e);return yH({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function IX(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(_e(a))return{tooltip:qX({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return LX(e,a,"tooltip",(e=>{const a=jX(e,r,s);if(a)return a;if(null===e)return;let l=RU("tooltip",i,r);return!0===l&&(l={content:"encoding"}),vt(l)?{value:l}:we(l)?_U(l)?l:"encoding"===l.content?qX(n,o,r,t):{signal:s}:void 0}))}}function UX(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o={},a=i?"datum.datum":"datum",s=[];function l(n,i){const l=sI(i),u=QH(n)?n:{...n,type:e[l].type},c=Ge(u.title||fG(u,r)).join(", ").replaceAll(/"/g,'\\"');let f;if(NI(i)){const t="x"===i?"x2":"y2",n=hG(e[t]);if(hU(u.bin)&&n){const e=rG(u,{expr:a}),i=rG(n,{expr:a}),{format:s,formatType:l}=dG(u);f=$H(e,i,s,l,r),o[t]=!0}}if((NI(i)||i===hj||i===fj)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=dG(u);f=yH({fieldOrDatumDef:u,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}f??(f=jX(u,r,a).signal),s.push({channel:i,key:c,value:f})}IG(e,((e,t)=>{WH(e)?l(e,t):UH(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 qX(e,t,n,{reactiveGeom:i}={}){const r=UX(e,t,n,{reactiveGeom:i}),o=zB(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function WX(e){const{markDef:t,config:n}=e,i=RU("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...HX(e),...GX(e)}}function HX(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=RU("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in $U?{}:{ariaRoleDescription:{value:t}}}function GX(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return LX(e,o,"description",(t=>jX(t,e.config)));const a=RU("description",n,i);if(null!=a)return{description:CU(a)};if(!1===i.aria)return{};const s=UX(t,r,i);return OB(s)?void 0:{description:{signal:zB(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function YX(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=RU(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==l&&(s=CU(l)));const u=r[e];return LX(t,u,a??e,(n=>dH({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function VX(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??RU("filled",n,r),s=_B(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=RU(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=RU(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:CU(l)}:{},...u?{stroke:CU(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&kq(oq("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...YX("color",e,{vgChannel:c,defaultValue:a?l:u}),...YX("fill",e,{defaultValue:i.fill?l:void 0}),...YX("stroke",e,{defaultValue:i.stroke?u:void 0})}}function XX(e){const{encoding:t,mark:n}=e,i=t.order;return!ZW(n)&&ZH(i)?LX(e,i,"zindex",(e=>CU(e.value))):{}}function JX({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:dH({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:CU(a),bandPosition:r})};const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function QX(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[uI(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=JX({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=ZX({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&NI(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(JH(n)&&r&&t===r.fieldChannel){if(WH(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return fH({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return cH(n,i,{suffix:"end"},{offset:o})}return sH(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 ZX({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=sI(n),l=lI(n),u=RU(n,o,a,{vgChannel:l});if(void 0!==u)return hH(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(_B([cW.LOG,cW.TIME,cW.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[cI(n)],mult:.5}}}}const KX={left:"x",center:"xc",right:"x2"},eJ={top:"y",middle:"yc",bottom:"y2"};function tJ(e,t,n,i="middle"){if("radius"===e||"theta"===e)return lI(e);const r="x"===e?"align":"baseline",o=RU(r,t,n);let a;return _U(o)?(kq(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?KX[a||("top"===i?"left":"center")]:eJ[a||i]}function nJ(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?iJ(e,t,{defaultPos:n,defaultPos2:i}):QX(e,t,{defaultPos:n})}function iJ(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=uI(e),s=cI(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=sI(n),u=cI(n),c=lI(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=JX(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=cI(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 JH(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?cH(t,o,{suffix:"start"},{offset:l}):sH({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}:rJ(n,o)||rJ(n,{[n]:LU(n,o,s.style),[u]:LU(u,o,s.style)})||rJ(n,s[r])||rJ(n,s.mark)||{[c]:ZX({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...QX(e,t,{defaultPos:n,vgChannel:l[s]?tJ(e,r,o):lI(e)}),...l}}function rJ(e,t){const n=cI(e),i=lI(e);if(void 0!==t[i])return{[i]:hH(e,t[i])};if(void 0!==t[e])return{[i]:hH(e,t[e])};if(t[n]){const i=t[n];if(!oH(i))return{[n]:hH(e,i)};kq(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function oJ(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=uI(t),s=cI(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??RU("size",r,n,{vgChannel:s}),p=fI(t),m="bar"===o&&("x"===t?"vertical"===d:"horizontal"===d);return!WH(l)||!(dU(l.bin)||hU(l.bin)||l.timeUnit&&!u)||h&&!oH(h)||i[p]||_W(f)?(JH(l)&&_W(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=cI(t),f=uI(t),d=fI(t),h=n.scaleName(d),p=n.getScaleComponent(dI(t)),m="horizontal"===s&&"y"===t||"vertical"===s&&"x"===t;let g;(r.size||i.size)&&(m?g=YX("size",n,{vgChannel:c,defaultRef:CU(i.size)}):kq(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(i.type)));const y=!!g,v=LH({channel:t,fieldDef:e,markDef:i,config:o,scaleType:u?.get("type"),useVlSizeChannel:m});g=g||{[c]:aJ(c,h||l,p||u,o,v,!!e,i.type)};const b=tJ(t,i,o,"band"===u?.get("type")&&oH(v)&&!y?"top":"middle"),x="xc"===b||"yc"===b,{offset:_,offsetType:w}=JX({channel:t,markDef:i,encoding:r,model:n,bandPosition:x?.5:0}),k=sH({channel:t,channelDef:e,markDef:i,config:o,scaleName:l,scale:u,stack:a,offset:_,defaultRef:ZX({model:n,defaultPos:"mid",channel:t,scaleName:l,scale:u}),bandPosition:x?"encoding"===w?0:.5:_U(v)?{signal:`(1-${v})/2`}:oH(v)?(1-v.band)/2:0});if(c)return{[b]:k,...g};{const e=lI(f),t=g[c],n=_?{...t,offset:_}:t;return{[b]:k,[e]:_e(k)?[k[0],{...k[1],offset:n}]:{...k,offset:n}}}}(l,t,e):iJ(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=LH({channel:n,fieldDef:e,markDef:o,config:r,scaleType:u}),d=i.component.axes[n]?.[0],h=d?.get("translate")??.5,p=NI(n)?RU("binSpacing",o,r)??0:0,m=uI(n),g=lI(n),y=lI(m),v=PU("minBandSize",o,r),{offset:b}=JX({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),{offset:x}=JX({channel:m,markDef:o,encoding:a,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=rG(t,{expr:"datum"});return`abs(scale("${e}", ${rG(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),w=sJ(n,p,c,h,b,v,_),k=sJ(m,p,c,h,x??b,v,_),E=_U(f)?{signal:`(1-${f.signal})/2`}:oH(f)?(1-f.band)/2:.5;if(dU(e.bin)||e.timeUnit)return{[y]:lJ({fieldDef:e,scaleName:l,bandPosition:E,offset:k}),[g]:lJ({fieldDef:e,scaleName:l,bandPosition:_U(E)?{signal:`1-${E.signal}`}:1-E,offset:w})};if(hU(e.bin)){const n=cH(e,l,{},{offset:k});if(WH(t))return{[y]:n,[g]:cH(t,l,{},{offset:w})};if(pU(e.bin)&&e.bin.step)return{[y]:n,[g]:{signal:`scale("${l}", ${rG(e,{expr:"datum"})} + ${e.bin.step})`,offset:w}}}kq(xq(m))}({fieldDef:l,fieldDef2:u,channel:t,model:e})}function aJ(e,t,n,i,r,o,a){if(oH(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=PU("minBandSize",{type:a},i);return{signal:n?`max(${NU(n)}, ${e})`:e}}1!==r.band&&(kq(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(_U(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(wU(e)&>(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r}=i.scale,o=VB(t,"bar"===a?n:r);if(_U(o))return{signal:`(1 - (${o.signal})) * ${e}`};if(gt(o))return{signal:`${1-o} * ${e}`}}return{value:NY(i.view,e)-2}}function sJ(e,t,n,i,r,o,a){if(Bj(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(_U(n)||_U(r)||_U(i)||o){const e=NU(n),t=NU(r),u=NU(i),c=NU(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 lJ({fieldDef:e,scaleName:t,bandPosition:n,offset:i}){return fH({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i})}const uJ=new Set(["aria","width","height"]);function cJ(e,t){const{fill:n,stroke:i}="include"===t.color?VX(e):{};return{...dJ(e.markDef,t),...fJ(e,"fill",n),...fJ(e,"stroke",i),...YX("opacity",e),...YX("fillOpacity",e),...YX("strokeOpacity",e),...YX("strokeWidth",e),...YX("strokeDash",e),...XX(e),...IX(e),...BX(e,"href"),...WX(e)}}function fJ(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===RU("invalid",o,i)&&n&&!ZW(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&&wW(r)&&(t[o]=!0)}return t}),{}),r=NB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>uH(e,t))).join(` ${e} `)}}(e,{invalid:!0,channels:JI});if(i)return{[t]:[{test:i,value:null},...Ge(n)]}}return n?{[t]:n}:{}}function dJ(e,t){return EU.reduce(((n,i)=>(uJ.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=CU(e[i])),n)),{})}function hJ(e){const{config:t,markDef:n}=e;if(RU("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&&wW(r)&&(t[o]=!0)}return t}),{}),r=NB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>uH(e,t))).join(` ${e} `)}}(e,{channels:OI});if(t)return{defined:{signal:t}}}return{}}function pJ(e,t){if(void 0!==t)return{[e]:CU(t)}}const mJ="voronoi",gJ={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(mJ)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(ZW(o))return kq(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(mJ),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...IX(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(mJ)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},yJ=gJ,vJ={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!_Y(e.bind),parse:(e,t,n)=>BJ(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=yJ.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=PB(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:dX(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${Dt(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+NJ))[0],a=i+wX,s=r.items.map((e=>PB(`${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}},bJ=vJ,xJ="_toggle",_J={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+xJ,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+NJ,i=t.name+xJ;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${PJ(e)}}, `)+`${i} ? ${n} : null`}},wJ={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=vt(t.clear)?OT(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(bJ.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===PB(`${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+NJ));i(e,"null"),_J.defined(t)&&(e=n.findIndex((e=>e.name===t.name+xJ)),i(e,"false"))}return n}},kJ={defined:e=>{const t="global"===e.resolve&&e.bind&&_Y(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==bY;return t&&!n&&kq("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=pB(n);if(i.select=vt(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},BJ(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=wY(t.bind)?t.bind.legend:"click",o=vt(r)?OT(r,"view"):Ge(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=wY(t.bind)&&t.bind.legend,o=e=>t=>{const n=pB(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${PB(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+NJ)),a=i+wX,s=r.items.filter((e=>e.hasLegend)).map((e=>PB(`${i}_${PB(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+xJ)),c=wY(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}},EJ="_translate_anchor",$J="_translate_delta",AJ={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=DX.defined(t),o=i+EJ,{x:a,y:s}=t.project.hasChannel;let l=OT(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+CX,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?SX(e,oj):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?SX(e,aj):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+$J,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&DJ(e,t,a,"width",n),void 0!==s&&DJ(e,t,s,"height",n),n}};function DJ(e,t,n,i,r){const o=t.name,a=o+EJ,s=o+$J,l=n.channel,u=DX.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===oj?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 SJ="_zoom_anchor",MJ="_zoom_delta",CJ={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=DX.defined(t),o=i+MJ,{x:a,y:s}=t.project.hasChannel,l=Dt(e.scaleName(oj)),u=Dt(e.scaleName(aj));let c=OT(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+CX,e)))),n.push({name:i+SJ,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&&FJ(e,t,a,"width",n),void 0!==s&&FJ(e,t,s,"height",n),n}};function FJ(e,t,n,i,r){const o=t.name,a=n.channel,s=DX.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?SX(e,a):l.name,h=o+MJ,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${SJ}.${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 OJ="_store",NJ="_tuple",TJ="_modify",zJ="vlSelectionResolve",RJ=[PX,zX,$X,_J,bJ,DX,kJ,wJ,AJ,CJ,yJ];function PJ(e,{escape:t}={escape:!0}){let n=t?Dt(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!mK(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of Yj)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Dt(i.vgField(t))}])`)}return n}function LJ(e){return TB(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function BJ(e,t){!vt(t.select)&&t.select.on||delete e.events,!vt(t.select)&&t.select.clear||delete e.clear,!vt(t.select)&&t.select.toggle||delete e.toggle}function jJ(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...jJ(e.object)),t.push(...jJ(e.property))),t)}function IJ(e){return"MemberExpression"===e.object.type?IJ(e.object):"datum"===e.object.name}function UJ(e){const t=aF(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&IJ(e)&&n.add(jJ(e).slice(1).join("."))})),n}class qJ extends yX{clone(){return new qJ(null,this.model,pB(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=GJ(this.model,this.filter,this),this._dependentFields=UJ(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function WJ(e,t,n,i="datum"){const r=vt(t)?t:t.param,o=PB(r),a=Dt(o+OJ);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?")":`, ${Dt(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function HJ(e,t,n){const i=PB(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,kq((e.length?"Multiple ":"No ")+`matching ${Dt(r)} encoding found for selection ${Dt(n.param)}. `+`Using "field": ${Dt(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&kq(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Dt(a)}.`);return`${o.name}[${Dt(WB(a))}]`}function GJ(e,t,n){return LB(t,(t=>vt(t)?t:function(e){return e?.param}(t)?WJ(e,t,n):eW(t)))}function YJ(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 VJ(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=DG[e],i=c[e];if(n&&n!==t&&"both"!==n)delete c[e];else if($G(i)){const{condition:t,...n}=i,r=Ge(t),o=EG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((e=>{const{test:t,...n}=e;return{test:GJ(null,t),...n}})),n];YJ(c,i,t,a),delete c[e]}else if(null===o){const t={signal:r.map((e=>{const{test:t,...n}=e;return`${GJ(null,t)} ? ${OU(n)} : `})).join("")+OU(n)};c[e]=t}}else if(_U(i)){const t=EG[e];if(t){const{vgProp:n,part:r}=t;YJ(c,r,n,i),delete c[e]}}_B(["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}:{}},OB(c.encode)&&delete c.encode}return{scale:a,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:VB(u,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==s){let e=s;c.encode?.labels?.update&&_U(c.encode.labels.update.text)&&(e=HB(s,"datum.label",c.encode.labels.update.text.signal)),YJ(c,"labels","text",{signal:e})}if(null===c.labelAlign&&delete c.labelAlign,c.encode){for(const t of AG)e.hasAxisPart(t)||delete c.encode[t];OB(c.encode)&&delete c.encode}const t=function(e,t){if(e)return _e(e)&&!xU(e)?e.map((e=>fG(e,t))).join(", "):e}(l,n);return{scale:a,orient:o,grid:!1,...t?{title:t}:{},...c,...!1===n.aria?{aria:!1}:{},zindex:VB(u,0)}}}}function XJ(e){const{axes:t}=e.component,n=[];for(const i of OI)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 JJ(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([...NB(r),...NB(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${NU(r[t])} : ${NU(o[t])}`};return s}return t[e]}))])}function QJ(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 ZJ(e,t,n,i={}){const r=BU(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 KJ={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!_W(e)&&WH(t)&&!dU(t?.bin)&&!hU(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||nQ(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||tQ(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&_B(["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,WH(t)&&!!t.timeUnit,WH(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&&!_W(t)&&"log"!==t){if(WH(e)){if(dU(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&_B(["month","hours","day","quarter"],Iq(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(WH(t)){const{timeUnit:e}=t;if(e){const t=Uq(e);if(t)return{signal:t}}}},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=iQ(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return IU(r?[zH(r)]:[],WH(a)?[zH(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;return _e(n)?wG(t,n):_U(n)?n:void 0}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){return"rect"===e&&oG(t)?1:0}(n,t)};function eQ(e){return`(((${e.signal} % 360) + 360) % 360)`}function tQ(e,t,n,i){if(void 0!==e){if("x"===n){if(_U(e)){const n=eQ(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${_U(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(KH(t)&&FH(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${eW({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new rQ(e,{calculate:a,as:oQ(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 ${bB(this.transform)}`}}function oQ(e,t,n){return rG(e,{prefix:t,suffix:"sort_index",...n??{}})}function aQ(e,t){return _B(["top","bottom"],t)?"column":_B(["left","right"],t)||"row"===e?"row":"column"}function sQ(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return VB((t||{})[e],r[e],n.header[e])}function lQ(e,t,n,i){const r={};for(const o of e){const e=sQ(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const uQ=["row","column"],cQ=["header","footer"];function fQ(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}=lQ(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=aQ(t,s),u=ej(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...hQ(u,l),...dQ(l,u,o),...xQ(i,r,t,pY,dY)}}}function dQ(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=nQ(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function hQ(e,t){const n=tQ(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function pQ(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of cQ)if(n[r])for(const o of n[r]){const a=yQ(e,t,r,n,o);null!=a&&i.push(a)}return i}function mQ(e,t){const{sort:n}=e;return CH(n)?{field:rG(n,{expr:"datum"}),order:n.order??"ascending"}:_e(n)?{field:oQ(e,t,{expr:"datum"}),order:"ascending"}:{field:rG(e,{expr:"datum"}),order:n??"ascending"}}function gQ(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=lQ(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=yH({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=aQ(t,s);return{text:{signal:l?HB(HB(l,"datum.label",u),"datum.value",rG(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...hQ(o,c),...dQ(c,o,a),...xQ(n,e,t,mY,hY)}}function yQ(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}=lQ(["labelOrient"],a.header,s,t);("row"===t&&!_B(["top","bottom"],e)||"column"===t&&!_B(["left","right"],e))&&(o=gQ(a,t,s))}const l=mK(e)&&!OH(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:mQ(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 vQ={column:{start:0,end:1},row:{start:1,end:0}};function bQ(e,t){return vQ[t][e]}function xQ(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=sQ(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function _Q(e){return[...wQ(e,"width"),...wQ(e,"height"),...wQ(e,"childWidth"),...wQ(e,"childHeight")]}function wQ(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(_W(i)&&wU(o)){const i=e.scaleName(n);return mK(e.parent)&&"independent"===e.parent.component.resolve.scale[n]?[kQ(i,o)]:[kQ(i,o),{name:r,update:EQ(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} : ${OY(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function kQ(e,t){const n=`${e}_step`;return _U(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function EQ(e,t,n){const i=t.get("type"),r=t.get("padding"),o=VB(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${NU(a)}, ${NU(o)}) * ${e}_step`}function $Q(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function AQ(e,t){return NB(e).reduce(((n,i)=>{const r=e[i];return{...n,...LX(t,r,i,(e=>CU(e.value)))}}),{})}function DQ(e,t){if(mK(t))return"theta"===e?"independent":"shared";if(yK(t))return"shared";if(gK(t))return NI(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function SQ(e,t){const n=e.scale[t],i=NI(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&kq(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 MQ={...vY,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},CQ=NB(MQ);class FQ extends JV{}const OQ={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={...TU({},n,nH),...VX(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?NQ(s.opacity)??a.opacity:void 0;if(f.fill)if("fill"===i||c&&i===bj)delete f.fill;else if(f.fill.field)h?delete f.fill:(f.fill=CU(l.legend.symbolBaseFillColor??"black"),f.fillOpacity=CU(m??1));else if(_e(f.fill)){const e=TQ(s.fill??s.color)??a.fill??(c&&a.color);e&&(f.fill=CU(e))}if(f.stroke)if("stroke"===i||!c&&i===bj)delete f.stroke;else if(f.stroke.field||p)delete f.stroke;else if(_e(f.stroke)){const e=VB(TQ(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(f.stroke={value:e})}if(i!==$j){const e=WH(t)&&RQ(0,r,t);e?f.opacity=[{test:e,...CU(m??1)},CU(l.legend.unselectedOpacity)]:m&&(f.opacity=CU(m))}return f={...f,...e},OB(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)?NQ(a.opacity)||o.opacity:void 0;return l&&(s.opacity=CU(l)),s={...s,...e},OB(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=WH(t)?RQ(0,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;pH(c)?f=bH({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=bH({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&WH(t)&&void 0===t.timeUnit&&(f=bH({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return OB(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function NQ(e){return zQ(e,((e,t)=>Math.max(e,t.value)))}function TQ(e){return zQ(e,((e,t)=>VB(e,t.value)))}function zQ(e,t){return function(e){const t=e?.condition;return!!t&&(_e(t)||ZH(t))}(e)?Ge(e.condition).reduce(t,e.value):ZH(e)?e.value:void 0}function RQ(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=Dt(n.field);return i.map((e=>`(!length(data(${Dt(PB(e)+OJ)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const PQ={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return xH(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return _H(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(kW(r))return"horizontal"===n?"top"===i||"bottom"===i?BQ(t,"width",a,o):a:BQ(t,"height",l,s)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(_B(["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=TQ(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})=>uG(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Hj(n)&&kW(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 _e(n)?wG(t,n):_U(n)?n:void 0}(t,e)};function LQ({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 BQ(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function jQ(e){const t=pK(e)?function(e){const{encoding:t}=e,n={};for(const i of[bj,...yY]){const r=pG(t[i]);r&&e.getScaleComponent(i)&&(i===wj&&WH(r)&&r.type===uW||(n[i]=UQ(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){jQ(i);for(const r of NB(i.component.legends))n.legend[r]=SQ(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=qQ(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of NB(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 IQ(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 UQ(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new FQ({},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 TB(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&kJ.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=pG(r[t]),f=WH(c)?Iq(c.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",h=function(e){const{legend:t}=e;return VB(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(Hj(e)){if(_B(["quarter","month","day"],t))return"symbol";if(kW(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:LQ({legend:n,legendType:h,orient:d,legendConfig:a})};for(const i of CQ){if("gradient"===h&&i.startsWith("symbol")||"symbol"===h&&i.startsWith("gradient"))continue;const r=i in PQ?PQ[i](p):n[i];if(void 0!==r){const a=IQ(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=AQ(m[t]??{},e),i=t in OQ?OQ[t](n,v):n;void 0===i||OB(i)||(y[t]={...g?.length&&WH(c)?{name:`${PB(c.field)}_legend_${t}`}:{},...g?.length?{interactive:!!g}:{},update:i})}return OB(y)||s.set("encode",y,!!n?.encoding),s}function qQ(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 CQ){const i=tX(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 qU(e,t);case"type":return r=!0,ZV("symbol")}var i,o;return eX(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&BB(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&BB(e.explicit,["encode","gradient"])),e}function WQ(e){const t=e.component.legends,n={};for(const i of NB(t)){const r=e.getScaleComponent(i),o=vB(r.get("domains"));if(n[o])for(const e of n[o])qQ(e,t[i])||n[o].push(t[i]);else n[o]=[t[i].clone()]}const i=TB(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 yY)o[t]&&delete e[t]}if(o.title||delete o.title,void 0!==i){let e=i;o.encode?.labels?.update&&_U(o.encode.labels.update.text)&&(e=HB(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 HQ(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=_U(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return _B(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 GQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class YQ extends JV{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 VQ(e){e.component.projection=pK(e)?function(e){if(e.hasProjection){const t=vU(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[[gj,mj],[vj,yj]])(pG(n[i[0]])||pG(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(wj)&&e.typedFieldDef(wj).type===uW&&t.push({signal:e.getName(`geojson_${t.length}`)}),0===t.length&&t.push(e.requestDataName(cX.Main)),t}(e):void 0,o=new YQ(e.projectionName(!0),{...vU(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)VQ(t);const n=kB(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=kB(GQ,(n=>!st(e.explicit,n)&&!st(t.explicit,n)||!!(st(e.explicit,n)&&st(t.explicit,n)&&hB(e.get(n),t.get(n)))));if(hB(e.size,t.size)){if(n)return e;if(hB(e.explicit,{}))return t;if(hB(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 YQ(n,t.specifiedProjection,t.size,pB(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 XQ(e,t,n,i){if(kG(t,n)){const r=pK(e)?e.axis(n)??e.legend(n)??{}:{},o=rG(t,{expr:"datum"}),a=rG(t,{expr:"datum",binSuffix:"end"});return{formulaAs:rG(t,{binSuffix:"range",forAs:!0}),formula:$H(o,a,r.format,r.formatType,i)}}return{}}function JQ(e,t){return`${fU(e)}_${t}`}function QQ(e,t,n){const i=JQ(vG(n,void 0)??{},t);return e.getName(`${i}_bins`)}function ZQ(e,t,n){let i,r;i=function(e){return"as"in e}(e)?vt(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[rG(e,{forAs:!0}),rG(e,{binSuffix:"end",forAs:!0})];const o={...vG(t,void 0)},a=JQ(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(mU(o.extent)){const e=o.extent;r=HJ(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 KQ extends yX{clone(){return new KQ(null,pB(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(QH(n)&&dU(n.bin)){const{key:r,binComponent:o}=ZQ(n,n.bin,t);e[r]={...o,...e[r],...XQ(t,n,i,t.config)}}return e}),{});return OB(n)?null:new KQ(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=ZQ(t,t.bin,n);return new KQ(e,{[i]:r})}merge(e,t){for(const n of NB(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=AB([...this.bins[n].as,...e.bins[n].as],bB)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(TB(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(TB(this.bins).map((e=>e.field)))}hash(){return`Bin ${bB(this.bins)}`}assemble(){return TB(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:WB(e.field),as:n,signal:e.signal,...mU(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:WB(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:rG({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}class eZ extends yX{clone(){return new eZ(null,new Set(this.dimensions),pB(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([rG(e,{forAs:!0})]);else{if(rU(o)||oU(o)){const e=rU(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([rG({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([rG(e,{forAs:!0})]);QI(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([rG({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([rG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(e,t,n,i){const r=pK(i)?i.encoding[uI(t)]:void 0;if(QH(n)&&pK(i)&&BH(n,r,i.markDef,i.config))e.add(rG(n,{})),e.add(rG(n,{suffix:"end"})),n.bin&&kG(n,t)&&e.add(rG(n,{binSuffix:"range"}));else if(Uj(t)){const n=Ij(t);e.add(i.getName(n))}else e.add(rG(n));KH(n)&&function(e){return we(e)&&"field"in e}(n.scale?.range)&&e.add(n.scale.range.field)}(r,n,e,t)})),r.size+NB(i).length===0?null:new eZ(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||rG(e,{forAs:!0})])):(i[n]??(i[n]={}),i[n][t]=new Set([r||rG(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+NB(i).length===0?null:new eZ(e,n,i)}merge(e){return SB(this.dimensions,e.dimensions)?(function(e,t){for(const n of NB(t)){const i=t[n];for(const t of NB(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){wq.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...NB(this.measures)])}producedFields(){const e=new Set;for(const t of NB(this.measures))for(const n of NB(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 ${bB({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of NB(this.measures))for(const r of NB(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:WB(i));return{type:"aggregate",groupby:[...this.dimensions].map(WB),ops:e,fields:t,as:n}}}class tZ extends yX{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of Yj){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]={name:t.getName(`${e}_domain`),fields:[rG(n),...dU(i)?[rG(n,{binSuffix:"end"})]:[]],...CH(r)?{sortField:r}:_e(r)?{sortIndexField:oQ(n,e)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of Yj)this[t]&&(e+=` ${t.charAt(0)}:${bB(this[t])}`);return e}get fields(){const e=[];for(const t of Yj)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of Yj)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 OI){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(_W(i)&&wU(r)){const n=HZ(GZ(this.childModel,t));n?e[t]=n:kq(XU(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=AH,field:t}=s;r.push(t),o.push(e),a.push(rG(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 uQ){for(const t of cQ){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[ij,nj])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function nZ(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function iZ(e){const t={};return fB(e.filter,(e=>{if(Zq(e)){let n=null;Hq(e)?n=SU(e.equal):Yq(e)?n=SU(e.lte):Gq(e)?n=SU(e.lt):Vq(e)?n=SU(e.gt):Xq(e)?n=SU(e.gte):Jq(e)?n=e.range[0]:Qq(e)&&(n=(e.oneOf??e.in)[0]),n&&(Eq(n)?t[e.field]="date":gt(n)?t[e.field]="number":vt(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}class rZ extends yX{clone(){return new rZ(null,pB(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${bB(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!aX(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of NB(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]:kq(eq(e,n[e],t.value)))}for(const e of NB(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:kq(eq(e,t[e],n)))}const r=new JV(t,n);i.copyAll(r);const o={};for(const e of NB(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===NB(o).length||i.parseNothing?null:new rZ(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of NB(this._parse)){const n=this._parse[t];1===YB(t)&&(e[t]=n)}return e}producedFields(){return new Set(NB(this._parse))}dependentFields(){return new Set(NB(this._parse))}assembleTransforms(e=!1){return NB(this._parse).filter((t=>!e||YB(t)>1)).map((e=>{const t=function(e,t){const n=IB(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},'${nZ(t.slice(5,t.length))}')`:t.startsWith("utc:")?`utcParse(${n},'${nZ(t.slice(4,t.length))}')`:(kq(`Unrecognized parse "${t}".`),null)}(e,this._parse[e]);return t?{type:"formula",expr:t,as:GB(e)}:null})).filter((e=>null!==e))}}class oZ extends yX{clone(){return new oZ(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([bY])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:bY}}}class aZ extends yX{clone(){return new aZ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${bB(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class sZ extends yX{clone(){return new sZ(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 ${bB(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class lZ extends yX{constructor(e){let t;if(super(null),e??(e={name:"source"}),aX(e)||(t=e.format?{...yB(e.format,["parse"])}:{}),rX(e))this._data={values:e.values};else if(iX(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];_B(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else lX(e)?this._data={values:[{type:"Sphere"}]}:(oX(e)||aX(e))&&(this._data={});this._generator=aX(e),e.name&&(this._name=e.name),t&&!OB(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 uZ,cZ=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 fZ(e){return e instanceof lZ||e instanceof aZ||e instanceof sZ}class dZ{constructor(){uZ.set(this,void 0),cZ(this,uZ,!1,"f")}setModified(){cZ(this,uZ,!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,uZ,"f")}}uZ=new WeakMap;class hZ extends dZ{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 pZ extends dZ{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class mZ extends pZ{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 gZ extends pZ{constructor(e){super(),this.requiresSelectionId=e&&LJ(e)}run(e){e instanceof oZ&&(this.requiresSelectionId&&(fZ(e.parent)||e.parent instanceof eZ||e.parent instanceof rZ)||(this.setModified(),e.remove()))}}class yZ extends dZ{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof _X&&(n=e.producedFields(),MB(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 vZ extends pZ{constructor(){super()}run(e){e instanceof vX&&!e.isRequired()&&(this.setModified(),e.remove())}}class bZ extends hZ{run(e){if(!(fZ(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof rZ)if(e instanceof rZ)this.setModified(),e.merge(t);else{if(FB(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class xZ extends hZ{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof rZ));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 NB(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!OB(i)){this.setModified();const n=new rZ(e,i);for(const r of t){if(r instanceof rZ)for(const e of NB(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof rZ&&0===NB(r.parse).length&&r.remove()}}}}}class _Z extends hZ{run(e){e instanceof vX||e.numChildren()>0||e instanceof tZ||e instanceof lZ||(this.setModified(),e.remove())}}class wZ extends hZ{run(e){const t=e.children.filter((e=>e instanceof _X)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class kZ extends hZ{run(e){const t=e.children.filter((e=>e instanceof eZ)),n={};for(const e of t){const t=bB(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of NB(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 EZ extends hZ{constructor(e){super(),this.model=e}run(e){const t=!(fZ(e)||e instanceof qJ||e instanceof rZ||e instanceof oZ),n=[],i=[];for(const r of e.children)r instanceof KQ&&(t&&!FB(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 KQ?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 $Z extends hZ{run(e){const t=[...e.children];if(!wB(t,(e=>e instanceof vX))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof vX){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof vX))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 AZ extends yX{clone(){return new AZ(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=AB(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??rG(e)}hash(){return`JoinAggregateTransform ${bB(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 DZ extends yX{clone(){return new DZ(null,pB(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(VB(e.order,"ascending"));const l={field:a,order:s};let u;return u=function(e){return _e(e)&&e.every((e=>vt(e)))&&e.length>1}(r)?r:vt(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new DZ(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=>hG(i[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=rG(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let f;if(_e(c)||WH(c))f=jU(c);else{const e=jH(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 DZ(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 ${bB(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[rG(e,{binSuffix:"mid"})]:[rG(e,{}),rG(e,{binSuffix:"end"})]:[rG(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=rG(o,{expr:"datum"}),i=rG(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:rG(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:rG(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 SZ extends yX{clone(){return new SZ(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=AB(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??rG(e)}hash(){return`WindowTransform ${bB(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=>aU(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 MZ(e){if(e instanceof tZ)if(1!==e.numChildren()||e.children[0]instanceof vX){const n=e.model.component.data.main;CZ(n);const i=(t=e,function e(n){if(!(n instanceof tZ)){const i=n.clone();if(i instanceof vX){const e=FZ+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof eZ||i instanceof DZ||i instanceof SZ||i instanceof AZ)&&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 eZ||t instanceof DZ||t instanceof SZ||t instanceof AZ)&&t.addDimensions(e.fields),t.swapWithParent(),MZ(e)}else e.children.map(MZ);var t}function CZ(e){if(e instanceof vX&&e.type===cX.Main&&1===e.numChildren()){const t=e.children[0];t instanceof tZ||(t.swapWithParent(),CZ(e))}}const FZ="scale_",OZ=5;function NZ(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!NZ(t.children))return!1}return!0}function TZ(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function zZ(e,t,n){let i=e.sources,r=!1;return r=TZ(new vZ,i)||r,r=TZ(new gZ(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=TZ(new _Z,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=TZ(new bZ,i)||r,r=TZ(new EZ(t),i)||r,r=TZ(new yZ,i)||r,r=TZ(new xZ,i)||r,r=TZ(new kZ,i)||r,r=TZ(new wZ,i)||r,r=TZ(new mZ,i)||r,r=TZ(new $Z,i)||r),e.sources=i,r}class RZ{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new RZ((()=>e(t)))}}function PZ(e){pK(e)?function(e){const t=e.component.scales;for(const n of NB(t)){const i=LZ(e,n);if(t[n].setWithExplicit("domains",i),UZ(e,n),e.component.data.isFaceted){let t=e;for(;!mK(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)kU(e)&&(e.data=FZ+e.data.replace(FZ,""))}}}(e):function(e){for(const t of e.children)PZ(t);const t=e.component.scales;for(const n of NB(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"):tX(i,e.getWithExplicit("domains"),"domains","scale",WZ);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&kq("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 LZ(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}=qZ(t,n);if(!e)return void kq(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=qZ(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&&pG(i.x2)?pG(i.x)?tX(jZ(n,r,e,"x"),jZ(n,r,e,"x2"),"domain","scale",WZ):jZ(n,r,e,"x2"):"y"===t&&pG(i.y2)?pG(i.y)?tX(jZ(n,r,e,"y"),jZ(n,r,e,"y2"),"domain","scale",WZ):jZ(n,r,e,"y2"):jZ(n,r,e,t)}function BZ(e,t,n){const i=Iq(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${_G(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function jZ(e,t,n,i){const{encoding:r}=n,o=pG(r[i]),{type:a}=o,s=o.timeUnit;if(function(e){return e?.unionWith}(t)){const r=jZ(e,void 0,n,i);return QV([...BZ(t.unionWith,a,s),...r.value])}if(_U(t))return QV([t]);if(t&&"unaggregated"!==t&&!$W(t))return QV(BZ(t,a,s));const l=n.stack;if(l&&i===l.fieldChannel){if("normalize"===l.offset)return ZV([[0,1]]);const e=n.requestDataName(cX.Main);return ZV([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const u=QI(i)&&WH(o)?function(e,t,n){if(!_W(n))return;const i=e.fieldDef(t),r=i.sort;if(FH(r))return{op:"min",field:oQ(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(CH(r))return IZ(r,o&&!a.has(r.field));if(MH(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(rU(s)||oU(s))return IZ({field:rG(i),order:n},u);if(aU(s)||!s)return IZ({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(_B(["ascending",void 0],r))return!0}}(n,i,e):void 0;if(GH(o))return ZV(BZ([o.datum],a,s));const c=o;if("unaggregated"===t){const e=n.requestDataName(cX.Main),{field:t}=o;return ZV([{data:e,field:rG({field:t,aggregate:"min"})},{data:e,field:rG({field:t,aggregate:"max"})}])}if(dU(c.bin)){if(_W(e))return ZV("bin-ordinal"===e?[]:[{data:RB(u)?n.requestDataName(cX.Main):n.requestDataName(cX.Raw),field:n.vgField(i,kG(c,i)?{binSuffix:"range"}:{}),sort:!0!==u&&we(u)?u:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=c;if(dU(e)){const t=QQ(n,c.field,e);return ZV([new RZ((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return ZV([{data:n.requestDataName(cX.Main),field:n.vgField(i,{})}])}}if(c.timeUnit&&_B(["time","utc"],e)&&BH(c,pK(n)?n.encoding[uI(i)]:void 0,n.markDef,n.config)){const e=n.requestDataName(cX.Main);return ZV([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return ZV(u?[{data:RB(u)?n.requestDataName(cX.Main):n.requestDataName(cX.Raw),field:n.vgField(i),sort:u}]:[{data:n.requestDataName(cX.Main),field:n.vgField(i)}])}function IZ(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":AH),...i?{field:WB(i)}:{},...r?{order:r}:{}}}function UZ(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=$W(i)&&i,a=pU(r)&&mU(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function qZ(e,t){const{aggregate:n,type:i}=e;return n?vt(n)&&!cU.has(n)?{valid:!1,reason:hq(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:pq(e)}:{valid:!0}:{valid:!1,reason:dq(e)}}function WZ(e,t,n,i){return e.explicit&&t.explicit&&kq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${vB(n)} and ${vB(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function HZ(e){if(kU(e)&&vt(e.field))return e.field;if(function(e){return!_e(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(kU(n)&&vt(n.field))if(t){if(t!==n.field)return kq("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 kq("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!_e(e)&&"fields"in e&&"data"in e}(e)){kq("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 vt(t)?t:void 0}}function GZ(e,t){return function(e){const t=AB(e.map((e=>{if(kU(e)){const{sort:t,...n}=e;return n}return e})),bB),n=AB(e.map((e=>{if(kU(e)){const t=e.sort;return void 0===t||RB(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),bB);if(0===t.length)return;if(1===t.length){const t=e[0];if(kU(t)&&n.length>0){let e=n[0];if(n.length>1){kq(yq);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=AB(n.map((e=>RB(e)||!("op"in e)||vt(e.op)&&e.op in iU?e:(kq(function(e){return`Dropping sort property ${vB(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),bB);let r;1===i.length?r=i[0]:i.length>1&&(kq(yq),r=!0);const o=AB(e.map((e=>kU(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=>(kU(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function YZ(e){return yK(e)||gK(e)?e.children.reduce(((e,t)=>e.concat(YZ(t))),VZ(e)):VZ(e)}function VZ(e){return NB(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(NI(n)){if(wU(e))return{step:{signal:`${t}_step`}}}else if(we(e)&&kU(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),h=GZ(e,n),p=s?function(e,t,n,i){const r=HJ(e,t.param,t);return{signal:wW(n.get("type"))&&_e(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 XZ extends JV{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||wB(this.get("domains"),(e=>_e(e)&&2===e.length&&e[0]<=0&&e[1]>=0))}}const JZ=["range","scheme"];function QZ(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,o=cI(t),a=e.getName(o);if(we(i)&&i.binned&&void 0!==i.step)return new RZ((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(dU(i)){const t=QQ(e,r,i);return new RZ((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function ZZ(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of JZ)if(void 0!==n[i]){const o=zW(r,i),a=RW(e,i);if(o)if(a)kq(a);else switch(i){case"range":{const i=n.range;if(_e(i)){if(NI(e))return QV(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return RZ.fromName(i,n)}return e})))}else if(we(i))return QV({data:t.requestDataName(cX.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return QV(i)}case"scheme":return QV(KZ(n[i]))}else kq(mq(r,i,e))}const o=e===oj||"xOffset"===e?"width":"height",a=i[o];if(MY(a))if(NI(e))if(_W(r)){const n=eK(a,t,e);if(n)return QV({step:n})}else kq(gq(o));else if(LI(e)){const n=e===uj?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=tK(a,r);if(e)return QV(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}=pG(o[e]),l=t.getScaleComponent(e).get("type"),{domain:u,domainMid:c}=t.specifiedScales[e];switch(e){case oj:case aj:{if(_B(["point","band"],l)){const r=nK(e,n,i.view);if(MY(r))return{step:eK(r,t,e)}}const r=cI(e),o=t.getName(r);return e===aj&&wW(l)?[RZ.fromName(a,o),0]:[0,RZ.fromName(a,o)]}case uj:case cj:return function(e,t,n){const i=e===uj?"x":"y",r=t.getScaleComponent(i).get("type"),o=t.scaleName(i);if("band"===r){const e=nK(i,t.size,t.config.view);if(MY(e)){const t=tK(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}{const n=t.encoding[i];if(WH(n)&&n.timeUnit){const e=Uq(n.timeUnit,(e=>`scale('${o}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner;return i?[{signal:`${_U(i)?`${i.signal}/2`:""+i/2} * (${e})`},{signal:`${_U(i)?`(1 - ${i.signal}/2)`:""+(1-i/2)} * (${e})`}]:[0,{signal:e}]}return mB(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,l);case kj:{const o=iK(r,t.component.scales[e].get("zero"),i),a=function(e,t,n,i){const r={x:QZ(n,"x"),y:QZ(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=oK(t,r,i.view);return gt(e)?e-1:new RZ((()=>`${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=oK(t,r,i.view);return gt(e)?Math.pow(rK*e,2):new RZ((()=>`pow(${rK} * ${e.signal}, 2)`))}}throw new Error(sq("size",e))}(r,n,t,i);return EW(l)?function(e,t,n){const i=()=>{const i=NU(t),r=NU(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return _U(t)?new RZ(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&&_e(n)?n.length+1:(kq(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(l,i,u,e)):[o,a]}case hj:return[0,2*Math.PI];case Ej:return[0,360];case fj:return[0,new RZ((()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`))];case Sj:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Mj:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case wj:return"symbol";case bj:case xj:case _j:return"ordinal"===l?"nominal"===s?"category":"ordinal":void 0!==c?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case $j:case Aj:case Dj:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==l)&&zW(r,"rangeMin")&&_e(u)&&2===u.length?QV([s??u[0],l??u[1]]):ZV(u)}function KZ(e){return function(e){return!vt(e)&&!!e.name}(e)?{scheme:e.name,...yB(e,["name"])}:{scheme:e}}function eK(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=dI(n),a=i[o];if("offset"===SY({step:e,offsetIsDiscrete:JH(a)&&rW(a.type)})&&zG(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-${FU(a)})`}}return e.step}function tK(e,t){if("offset"===SY({step:e,offsetIsDiscrete:_W(t)}))return{step:e.step}}function nK(e,t,n){const i=e===oj?"width":"height";return t[i]||TY(n,i)}function iK(e,t,n){if(t)return _U(t)?{signal:`${t.signal} ? 0 : ${iK(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(sq("size",e))}const rK=.95;function oK(e,t,n){const i=MY(e.width)?e.width.step:NY(n,"width"),r=MY(e.height)?e.height.step:NY(n,"height");return t.x||t.y?new RZ((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function aK(e,t){pK(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of NB(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=pG(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=zW(h,t),y=RW(s,t);if(void 0!==d&&(g?y&&kq(y):kq(mq(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":Eq(l[t])||"temporal"===n||e?u.set(t,{signal:_G(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=t in sK?sK[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:RG(r,s),hasSecondaryRangeChannel:!!r[uI(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):uK(e,t)}const sK={bins:({model:e,fieldOrDatumDef:t})=>WH(t)?function(e,t){const n=t.bin;if(dU(n)){const i=QQ(e,t.field,n);return new RZ((()=>e.getSignalName(i)))}if(hU(n)&&pU(n)&&void 0!==n.step)return{step:n.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(_B([bj,xj,_j],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(!(hG(o)?.bin||_e(n)||null!=r||null!=i||_B([cW.TIME,cW.UTC],e)))return!!NI(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(NI(e)){if(kW(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!WH(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===cW.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(NI(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:VB(e,"bar"===n?t:i)}return LI(t)&&i===cW.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(NI(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===cW.BAND)return VB(e,_U(i)?{signal:`${i.signal}/2`}:i/2)}else if(LI(t)){if(n===cW.POINT)return.5;if(n===cW.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?wW(e)&&"descending"===t?_U(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse:!(!wW(e)||"descending"!==t)||void 0}(t,WH(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&&wW(r)){if(_e(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!EW(r))return!0;if((!WH(t)||!t.bin)&&_B([...OI,...zI],e)){const{orient:t,type:n}=i;return(!_B(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!_B(["bar","area"],n)||a)||o?.zero)}return!1}(e,t,n,i,r,o.scale,a)};function lK(e){pK(e)?function(e){const t=e.component.scales;for(const n of JI){const i=t[n];if(!i)continue;const r=ZZ(n,e);i.setWithExplicit("range",r)}}(e):uK(e,"range")}function uK(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?lK(n):aK(n,t);for(const i of NB(n)){let r;for(const n of e.children){const e=n.component.scales[i];e&&(r=tX(r,e.getWithExplicit(t),t,"scale",KV(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))))}n[i].setWithExplicit(t,r)}}function cK(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(Hj(e)||"discrete"===tU(e))return"shape"===e&&"ordinal"===t.type&&kq(fq(e,"ordinal")),"ordinal";if(NI(e)||LI(e)){if(_B(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in TI)return"band";return oH(n[cI(e)])||eG(t)&&t.axis?.tickBand?"band":"point";case"temporal":return Hj(e)?"time":"discrete"===tU(e)?(kq(fq(e,"temporal")),"ordinal"):WH(t)&&t.timeUnit&&Iq(t.timeUnit).utc?"utc":"time";case"quantitative":return Hj(e)?WH(t)&&dU(t.bin)?"bin-ordinal":"linear":"discrete"===tU(e)?(kq(fq(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(rq(t.type))}(t,n,i,r),{type:a}=e;return QI(t)?void 0!==a?function(e,t,n=!1){if(!QI(e))return!1;switch(e){case oj:case aj:case uj:case cj:case hj:case fj:return!!kW(t)||"band"===t||"point"===t&&!n;case kj:case Sj:case $j:case Aj:case Dj:case Ej:return kW(t)||EW(t)||_B(["band","point","ordinal"],t);case bj:case xj:case _j:return"band"!==t;case Mj:case wj:return"ordinal"===t||EW(t)}}(t,a)?WH(n)&&(s=a,l=n.type,!(_B([aW,lW],l)?void 0===s||_W(s):l===sW?_B([cW.TIME,cW.UTC,void 0],s):l!==oW||yW(s)||EW(s)||void 0===s))?(kq(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(kq(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 fK(e){pK(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of JI){const a=pG(t[o]);if(a&&n===QW&&o===wj&&a.type===uW)continue;let s=a&&a.scale;if(!LI(o)||RG(t,hI(o))){if(a&&null!==s&&!1!==s){s??(s={});const n=cK(s,o,a,i,RG(t,o));r[o]=new XZ(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}else s&&kq(lq(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){fK(n);for(const o of NB(n.component.scales))if((t=r.scale)[o]??(t[o]=DQ(o,e)),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?dW(e.value,t.value)?i[o]=tX(e,t,"type","scale",dK):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of NB(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new XZ(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 dK=KV(((e,t)=>pW(e)-pW(t)));class hK{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 pK(e){return"unit"===e?.type}function mK(e){return"facet"===e?.type}function gK(e){return"concat"===e?.type}function yK(e){return"layer"===e?.type}class vK{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=vU(a),this.name=e.name??i,this.title=xU(e.title)?{text:e.title}:e.title?vU(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new hK,this.projectionNameMap=n?n.projectionNameMap:new hK,this.signalNameMap=n?n.signalNameMap:new hK,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>yV(e)?{filter:dB(e.filter,nW)}: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&&(TH(e)&&!OH(e.facet)||$Y(e))&&(r.columns=a),AY(e)&&(r.columns=1);for(const t of FY)if(void 0!==e[t])if("spacing"===t){const n=e[t];r[t]=gt(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:TH(e)||n?.component.data.isFaceted&&void 0===e.data},layoutSize:new JV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?pB(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}={}){fK(e),PZ(e);for(const t of TW)aK(e,t);t||lK(e)}(this)}parseProjection(){VQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){jQ(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of NB(n)){const t=n[e];void 0!==t&&(i[e]=CU(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=CU(this.description)),"unit"!==this.type&&"layer"!==this.type)?OB(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 Yj){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=lQ(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=aQ(i,o),s=bQ(e,a);void 0!==s&&(n[a]=s)}}return OB(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 Yj)e[n].title&&t.push(fQ(this,n));for(const e of uQ)t=t.concat(pQ(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>VJ(e,"grid",t))),...i.map((e=>VJ(e,"grid",t))),...n.map((e=>VJ(e,"main",t))),...i.map((e=>VJ(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return WQ(this)}assembleProjections(){return yK(e=this)||gK(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),HQ(e))}(e):HQ(e);var e}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...bU(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return _B(["unit","layer"],this.type)?_B(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),OB(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||mK(this.parent)?YZ(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 PB((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(cX[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(mK(this.parent)){const t=RI($Q(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(_W(e)&&wU(i)){const e=n.get("name"),i=HZ(GZ(this,t));return i?{signal:EQ(e,n,rG({aggregate:"distinct",field:i},{expr:"datum"}))}:(kq(XU(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):rI(e)&&QI(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 bK extends vK{vgField(e,t={}){const n=this.fieldDef(e);if(n)return rG(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?NB(e).reduce(((n,r)=>{const o=e[r];return _e(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=hG(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){IG(this.getMapping(),((t,n)=>{const i=hG(t);i&&e(i,n)}),t)}}class xK extends yX{clone(){return new xK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"],t.groupby&&null==t.minsteps&&null==t.maxsteps&&null==t.steps&&(this.transform.steps=200)}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${bB(this.transform)}`}assemble(){const{density:e,...t}=this.transform;return{type:"kde",field:e,...t}}}class _K extends yX{clone(){return new _K(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${bB(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class wK extends yX{clone(){return new wK(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"!==RU("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=QI(r)&&t.getScaleComponent(r);return o&&wW(o.get("type"))&&"count"!==n.aggregate&&!ZW(i)&&(e[n.field]=n),e}),{});return NB(o).length?new wK(e,o):null}dependentFields(){return new Set(NB(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${bB(this.filter)}`}assemble(){const e=NB(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=rG(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 kK extends yX{clone(){return new kK(this.parent,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(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 ${bB(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class EK extends yX{clone(){return new EK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(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 ${bB(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class $K extends yX{clone(){return new $K(null,pB(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[[gj,mj],[vj,yj]]){const r=i.map((e=>{const n=pG(t.encoding[e]);return WH(n)?n.field:GH(n)?{expr:`${n.datum}`}:ZH(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new $K(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(wj)){const i=t.typedFieldDef(wj);i.type===uW&&(e=new $K(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(vt);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${bB(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 AK extends yX{clone(){return new AK(null,this.projection,pB(this.fields),pB(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[[gj,mj],[vj,yj]]){const i=n.map((e=>{const n=pG(t.encoding[e]);return WH(n)?n.field:GH(n)?{expr:`${n.datum}`}:ZH(n)?{expr:`${n.value}`}:void 0})),r=n[0]===vj?"2":"";(i[0]||i[1])&&(e=new AK(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(vt))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${bB(this.fields)} ${bB(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class DK extends yX{clone(){return new DK(null,pB(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 DK(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(WH(i)&&WH(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=UG(t.mark,n);return new DK(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 ${bB(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:vV(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 SK extends yX{clone(){return new SK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(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 ${bB(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class MK extends yX{clone(){return new MK(null,pB(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=qK(o.data,r);e||(e=new lZ(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new vX(e,n,cX.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(PB(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 MK(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 ${bB({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;vt(t)||(kq('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 CK extends yX{clone(){return new CK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(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 ${bB(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class FK extends yX{clone(){return new FK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=pB(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 ${bB(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class OK extends yX{clone(){return new OK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=AB((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${bB(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 NK extends yX{clone(){return new NK(null,pB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${bB(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function TK(e){let t=0;return function n(i,r){if(i instanceof lZ&&!i.isGenerator&&!iX(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof rZ&&(i.parent instanceof lZ&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof tZ)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 aZ||i instanceof sZ||i instanceof wK||i instanceof qJ||i instanceof rQ||i instanceof AK||i instanceof eZ||i instanceof MK||i instanceof SZ||i instanceof AZ||i instanceof EK||i instanceof kK||i instanceof xK||i instanceof SK||i instanceof CK||i instanceof FK||i instanceof oZ||i instanceof NK||i instanceof OK||i instanceof _K)&&r.transform.push(i.assemble()),(i instanceof KQ||i instanceof _X||i instanceof DK||i instanceof DZ||i instanceof $K)&&r.transform.push(...i.assemble()),i instanceof vX&&(r.source&&0===r.transform.length?i.setSource(r.source):i.parent instanceof vX?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 vX&&(!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 zK(e,t){const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],s=sQ("title",null,i,t);let l=uG(a,i,{allowDisabling:!0,includeDefault:void 0===s||!!s});r.component.layoutHeaders[t].title&&(l=_e(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const u=sQ("labelOrient",a.header,i,t),c=null!==a.header&&VB(a.header?.labels,i.header.labels,!0),f=_B(["bottom","right"],u)?"footer":"header";o.layoutHeaders[t]={title:null!==a.header?l:null,facetFieldDef:a,[f]:"facet"===t?[]:[RK(e,t,c)]}}}function RK(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 PK(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=SQ(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||_U(i)?"header":"footer";a[t]??(a[t]=[RK(e,o,!1)]);const n=VJ(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function LK(e){for(const t of e.children)t.parseLayoutSize()}function BK(e,t){const n=$Q(t),i=RI(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]??DQ(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=tX(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 jK(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(_W(e)){const e=TY(i.view,t);return wU(n)||MY(e)?"step":e}return OY(i.view,t)}if(e.hasProjection||"arc"===e.mark)return OY(i.view,t);{const e=TY(i.view,t);return MY(e)?e.step:e}}function IK(e,t,n){return rG(t,{suffix:`by_${rG(e)}`,...n??{}})}class UK extends bK{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=d0(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!OH(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=NB(e),n={};for(const i of t){if(![nj,ij].includes(i)){kq(sq(i,"facet"));break}const t=e[i];if(void 0===t.field){kq(aq(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=yG(e,t);return n.header?n.header=vU(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=WK(this),this.child.parseData()}parseLayoutSize(){LK(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 Yj)zK(e,t);PK(e,"x"),PK(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 Yj)for(const n of cQ){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=sQ("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=aQ(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 UK))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof UK?{...this.channelHasField("column")?{encode:{update:{columns:{field:rG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof UK){if(this.child.channelHasField("column")){const i=rG(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of OI){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(_W(o)&&wU(a)){const r=HZ(GZ(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):kq(XU(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 Yj){const t=this.facet[e];if(t){s.push(rG(t));const{bin:l,sort:u}=t;if(dU(l)&&s.push(rG(t,{binSuffix:"end"})),CH(u)){const{field:e,op:s=AH}=u,l=IK(t,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(e),o.push(s),a.push(l))}else if(_e(u)){const n=oQ(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?CH(n.sort)?[IK(n,n.sort,{expr:"datum"})]:_e(n.sort)?[oQ(n,e,{expr:"datum"})]:[rG(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(CH(e)?e.order:!_e(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return gQ(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of uQ)if(e[i]){const r=sQ("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return gQ(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=TK(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:Yj.map((e=>this.facetSortFields(e))).flat(),order:Yj.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(pX(this,[]))}]}getMapping(){return this.facet}}function qK(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(rX(e)&&rX(t)){if(hB(e.values,t.values))return n}else if(iX(e)&&iX(t)){if(e.url===t.url)return n}else if(oX(e)&&e.name===n.dataName)return n}return null}function WK(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new lZ({values:[]});return t.push(e),e}const n=qK(e.data,t);if(n)return aX(e.data)||(n.data.format=EB({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new lZ(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&&(aX(r)||iX(r)||rX(r))||!e.parent?new nX:e.parent.component.data.ancestorParse.clone();aX(r)?(sX(r)?t=new sZ(t,r.sequence):uX(r)&&(t=new aZ(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=rZ.makeExplicit(t,e,o)??t,t=new oZ(t);const a=e.parent&&yK(e.parent);(pK(e)||mK(e))&&a&&(t=KQ.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(MV(r))a=e=new rQ(e,r),o="derived";else if(yV(r)){const i=iZ(r);a=e=rZ.makeWithAncestors(e,{},i,n)??e,e=new qJ(e,t,r.filter)}else if(CV(r))a=e=KQ.makeFromTransform(e,r,t),o="number";else if(OV(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new rZ(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=_X.makeFromTransform(e,r);else if(NV(r))a=e=eZ.makeFromTransform(e,r),o="number",LJ(t)&&(e=new oZ(e));else if(bV(r))a=e=MK.make(e,t,r,i++),o="derived";else if(AV(r))a=e=new SZ(e,r),o="number";else if(DV(r))a=e=new AZ(e,r),o="number";else if(TV(r))a=e=DZ.makeFromTransform(e,r),o="derived";else if(zV(r))a=e=new EK(e,r),o="derived";else if(RV(r))a=e=new _K(e,r),o="derived";else if(SV(r))a=e=new kK(e,r),o="derived";else if(xV(r))a=e=new OK(e,r),o="derived";else if($V(r))e=new NK(e,r);else if(FV(r))a=e=DK.makeFromTransform(e,r),o="derived";else if(_V(r))a=e=new xK(e,r),o="derived";else if(wV(r))a=e=new CK(e,r),o="derived";else if(kV(r))a=e=new FK(e,r),o="derived";else{if(!EV(r)){kq(`Ignoring an invalid transform: ${vB(r)}.`);continue}a=e=new SK(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(pK(e)&&e.component.selection)for(const n of NB(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&YB(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=function(e){const t={};function n(e){var n;xG(e)?t[e.field]="date":"quantitative"===e.type&&vt(n=e.aggregate)&&_B(["min","max"],n)?t[e.field]="number":YB(e.field)>1?e.field in t||(t[e.field]="flatten"):KH(e)&&CH(e.sort)&&YB(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((pK(e)||mK(e))&&e.forEachFieldDef(((t,i)=>{if(QH(t))n(t);else{const r=sI(i),o=e.fieldDef(r);n({...t,type:o.type})}})),pK(e)){const{mark:n,markDef:i,encoding:r}=e;if(ZW(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];WH(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}(e);t=rZ.makeWithAncestors(t,{},{...s,...l},o)??t,pK(e)&&(t=$K.parseAll(t,e),t=AK.parseAll(t,e)),(pK(e)||mK(e))&&(a||(t=KQ.makeFromEncoding(t,e)??t),t=_X.makeFromEncoding(t,e)??t,t=rQ.parseAllForSortIndex(t,e));const u=e.getDataName(cX.Raw),c=new vX(t,u,cX.Raw,i);if(n[u]=c,t=c,pK(e)){const n=eZ.makeFromEncoding(t,e);n&&(t=n,LJ(e)&&(t=new oZ(t))),t=DK.makeFromEncoding(t,e)??t,t=DZ.makeFromEncoding(t,e)??t}pK(e)&&(t=wK.make(t,e)??t);const f=e.getDataName(cX.Main),d=new vX(t,f,cX.Main,i);n[f]=d,t=d,pK(e)&&function(e,t){for(const[n,i]of zB(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new vX(new qJ(t,e,{param:n}),r,cX.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let h=null;if(mK(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(CH(r.sort)){const{field:n,op:i=AH}=r.sort;e=t=new AZ(e,{joinaggregate:[{op:i,field:n,as:IK(r,r.sort,{forAs:!0})}],groupby:[rG(r)]})}return t}return null}(t,e.facet)??t,h=new tZ(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 HK extends vK{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||kq("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)=>d0(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=WK(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 NB(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 AY(e)?e.vconcat:DY(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){LK(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";BK(e,t),BK(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=_Q(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 GK={disable:1,gridScale:1,scale:1,...SG,labelExpr:1,encode:1},YK=NB(GK);class VK extends JV{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new VK(pB(this.explicit),pB(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 _U(this.explicit.orient)}}const XK={bottom:"top",top:"bottom",left:"right",right:"left"};function JK(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 qU(e,t);case"gridScale":return{explicit:e.explicit,value:VB(e.value,t.value)}}return eX(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function ZK(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(_U(n.labelAngle)?n.labelAngle:ej(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===iQ(i,r))return!0}return e===n[t]}const KK=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function e0(e,t){let n=t.axis(e);const i=new VK,r=pG(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"]:yW(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=_U(n)?"axisOrient":`axis${jB(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:JJ(s,i,e,n),vgAxisConfig:JJ(l,i,e,n),axisConfigStyle:QJ([...l,...s],i)}}(e,l,s,t.config),c=void 0!==n?!n:ZJ("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 _U(o)?o:ej(o);{const{configValue:o}=ZJ("labelAngle",i,t?.style,r);return void 0!==o?ej(o):n!==oj||!_B([lW,aW],e.type)||WH(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,u),d=_H(n.formatType,r,l),h=xH(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 YK){const o=r in KJ?KJ[r](p):CG(r)?n[r]:void 0,s=void 0!==o,l=ZK(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=CG(r)&&"values"!==r?ZJ(r,a.style,n.style,u):{},c=void 0!==e;s&&!c?i.set(r,o,l):("vgAxisConfig"!==t||KK.has(r)&&c||$G(e)||_U(e))&&i.set(r,e,!1)}}const m=n.encoding??{},g=AG.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=AQ(m[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=pG(i[t])??pG(i[uI(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(pH(l))return{text:bH({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===HH(o)){if(eG(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:bH({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:bH({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===HH(o)&&r.timeFormatType&&WH(o)&&!o.timeUnit)return{text:bH({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||OB(a)||(n[r]={update:a}),n}),{});return OB(g)||i.set("encode",g,!!n.encoding||void 0!==n.labelAngle),i}function t0(e,t){const{config:n}=e;return{...cJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...QX("x",e,{defaultPos:"mid"}),...QX("y",e,{defaultPos:"mid"}),...YX("size",e),...YX("angle",e),...n0(e,0,t)}}function n0(e,t,n){return n?{shape:{value:n}}:YX("shape",e)}function i0(e,t,n){if(void 0===RU("align",e,n))return"center"}function r0(e,t,n){if(void 0===RU("baseline",e,n))return"middle"}function o0(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),a=RU("size",n,t,{vgChannel:r})??t.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&wU(e)&>(e.step)?3*e.step/4:3*NY(t.view,r)/4}}const a0={arc:{vgMark:"arc",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...QX("x",e,{defaultPos:"mid"}),...QX("y",e,{defaultPos:"mid"}),...oJ(e,"radius"),...oJ(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...nJ("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...nJ("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...hJ(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...oJ(e,"x"),...oJ(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>t0(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...cJ(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&&WH(n)&&n.type===uW?{field:rG(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...oJ(e,"x"),...oJ(e,"y"),...BX(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...QX("x",e,{defaultPos:"mid"}),...QX("y",e,{defaultPos:"mid"}),...YX("size",e,{vgChannel:"strokeWidth"}),...hJ(e)})},point:{vgMark:"symbol",encodeEntry:e=>t0(e)},rect:{vgMark:"rect",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...oJ(e,"x"),...oJ(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?{...cJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...nJ("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...nJ("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...YX("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>t0(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...cJ(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...QX("x",e,{defaultPos:"mid"}),...QX("y",e,{defaultPos:"mid"}),...BX(e),...YX("size",e,{vgChannel:"fontSize"}),...YX("angle",e),...pJ("align",i0(e.markDef,0,t)),...pJ("baseline",r0(e.markDef,0,t)),...QX("radius",e,{defaultPos:null}),...QX("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{...cJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...QX("x",e,{defaultPos:"mid",vgChannel:"xc"}),...QX("y",e,{defaultPos:"mid",vgChannel:"yc"}),...YX("size",e,{defaultValue:o0(e),vgChannel:r}),[o]:CU(RU("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...cJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...QX("x",e,{defaultPos:"mid"}),...QX("y",e,{defaultPos:"mid"}),...YX("size",e),...hJ(e)})}};const s0="faceted_path_",l0="stack_group_";function u0(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=VB(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=zU(i),l=r.key,u=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!_e(a)&&ZH(a)&&xB(a.value)||!a&&xB(RU("order",r,o)))){if((_e(a)||WH(a))&&!n)return jU(a,{expr:"datum"});if(ZW(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(WH(i)){const t=i.sort;return _e(t)?{field:rG(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:CH(t)?{field:rG({aggregate:PG(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:MH(t)?{field:rG(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:rG(i,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),c=function(e){if(!e.component.selection)return null;const t=NB(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=NB(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),f=RU("aria",i,o),d=a0[n].postEncodingTransform?a0[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:a0[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(cX.Main)},encode:{update:a0[n].encodeEntry(e)},...d?{transform:d}:{}}]}class c0 extends bK{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,CY(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const o=tH(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=PU("filled",e,t),r=e.type;return VB(i,r!==qW&&r!==UW&&r!==HW)}(o,r,{graticule:e.data&&uX(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const t of NB(e))rI(t)||kq(`${o=t}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let o of pI){if(!e[o])continue;const s=e[o];if(LI(o)){const e=hI(o),t=r[e];if(WH(t)){if(("quantitative"===(a=t.type)||"temporal"===a)&&WH(s)&&!t.timeUnit){kq(nq(e));continue}}else o=e,kq(iq(e))}if("angle"!==o||"arc"!==t||e.theta||(kq("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=hj),BG(e,o,t)){if(o===kj&&"line"===t){const t=hG(e[o]);if(t?.aggregate){kq("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===bj&&(n?"fill"in e:"stroke"in e))kq(oq("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(o===Oj||o===Fj&&!_e(s)&&!ZH(s)||o===Tj&&_e(s)){if(s){if(o===Fj){const t=e[o];if(jH(t)){r[o]=t;continue}}r[o]=Ge(s).reduce(((e,t)=>(WH(t)?e.push(yG(t,o)):kq(aq(t,o)),e)),[])}}else{if(o===Tj&&null===s)r[o]=null;else if(!(WH(s)||GH(s)||ZH(s)||IH(s)||_U(s))){kq(aq(s,o));continue}r[o]=mG(s,o,i)}}else kq(sq(o,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=tV(o,s,r),this.size=function({encoding:e,size:t}){for(const n of OI){const i=cI(n);MY(t[i])&&YH(e[n])&&(delete t[i],kq(gq(i)))}return t}({encoding:s,size:CY(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=eV(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=>kY(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===QW,n=e&&qj.some((t=>JH(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 JI.reduce(((e,n)=>{const i=pG(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=vU(e);return _e(t)&&(i.domain=t.map(SU)),_e(n)&&(i.range=n.map(SU)),i}initAxes(e){return OI.reduce(((t,n)=>{const i=e[n];if(JH(i)||n===oj&&JH(e.x2)||n===aj&&JH(e.y2)){const e=JH(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=NB(e),n={};for(const i of t){const t=e[i];n[i]=$G(t)?DU(t):SU(t)}return n}initLegends(e){return VI.reduce(((t,n)=>{const i=pG(e[n]);if(i&&function(e){switch(e){case bj:case xj:case _j:case kj:case wj:case $j:case Sj:case Mj:return!0;case Aj:case Dj:case Ej:return!1}}(n)){const e=i.legend;t[n]=e?vU(e):e}return t}),{})}parseData(){this.component.data=WK(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of OI){const r=cI(i);if(t[r]){const e=t[r];n.layoutSize.set(r,MY(e)?"step":e,!0)}else{const t=jK(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=PB(r.name),o=r.select,a=vt(o)?o:o.type,s=we(o)?pB(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]=pB(l[e]??s[e])));const u=n[t]={...s,name:t,type:a,init:r.value,bind:r.bind,events:vt(s.on)?OT(s.on,"scope"):Ge(pB(s.on))},c=pB(r);for(const t of RJ)t.defined(u)&&t.parse&&t.parse(e,u,c)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(e){if(_B([UW,BW,VW],e.mark)){const t=UG(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:s0+e.requestDataName(cX.Main),data:e.requestDataName(cX.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:u0(e,{fromPrefix:s0})}]}(e,t)}else if(e.mark===jW){const t=AU.some((t=>RU(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=u0(e,{fromPrefix:l0}),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={...gB(t.encode.update,["y","yc","y2","height",...AU]),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={...yB(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...gB(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={...yB(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of AU){const i=PU(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=CU(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=rG(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(rG(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=PU(i,e.markDef,e.config);return void 0!==t?{...n,[i]:CU(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(cX.Main),name:l0+e.requestDataName(cX.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 u0(e)}(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,OI.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[e0(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of TB(e.component.selection??{})){const r=i.name,o=Dt(r+OJ);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:`${zJ}(${o}, ${Dt(e)}${n}`})}n=!0;for(const n of RJ)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 gX(t)}(this,e)}assembleSignals(){return[...XJ(this),...hX(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=PJ(e,{escape:!1});for(const t of TB(e.component.selection??{})){const e={name:t.name+OJ};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:bY}}]),t.init){const n=t.project.items.map(fX);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[bY]:dX(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:dX(e,!1)})))}n.filter((e=>e.name===t.name+OJ)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return _Q(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&yK(this.parent)||(e=mX(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 TG(this.encoding,e)}fieldDef(e){return hG(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return QH(t)?t:null}}class f0 extends vK{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(YY(e))return new f0(e,this,this.getName(`layer_${t}`),o,r);if(OG(e))return new c0(e,this,this.getName(`layer_${t}`),o,r);throw new Error(WU(e))}))}parseData(){this.component.data=WK(this);for(const e of this.children)e.parseData()}parseLayoutSize(){LK(this),BK(this,"width"),BK(this,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of NB(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 NB(i.component.axes))n.axis[r]=SQ(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=JK(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of OI){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(!_U(t)){if(i[t]>0&&!n){const n=XK[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())),XJ(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),_Q(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)pK(n)&&(t=mX(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),WQ(this))}}function d0(e,t,n,i,r){if(TH(e))return new UK(e,t,n,r);if(YY(e))return new f0(e,t,n,i,r);if(OG(e))return new c0(e,t,n,i,r);if(function(e){return AY(e)||DY(e)||$Y(e)}(e))return new HK(e,t,n,r);throw new Error(WU(e))}function h0(e,t={}){var n;t.logger&&(n=t.logger,wq=n),t.fieldTitle&&lG(t.fieldTitle);try{const n=UY(Ee(t.config,e.config)),i=qV(e,n),r=d0(i,null,"",void 0,n);r.parse(),function(e,t){NZ(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([]),...EY(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)):vt(t)&&(t={type:t}),r&&o&&("fit"===(a=t.type)||"fit-x"===a||"fit-y"===a))if("step"===r&&"step"===o)kq(VU()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";kq(VU(RI(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${RI(e)}`:"fit"}(n)}var a;return{...1===NB(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...XV(n,!1),...XV(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(wq=_q),t.fieldTitle&&lG(aG)}}const p0="5.14.1",m0=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};const g0="#fff",y0="#888",v0={background:"#333",view:{stroke:y0},title:{color:g0,subtitleColor:g0},style:{"guide-label":{fill:g0},"guide-title":{fill:g0}},axis:{domainColor:g0,gridColor:y0,tickColor:g0}},b0="#4572a7",x0={background:"#fff",arc:{fill:b0},area:{fill:b0},line:{stroke:b0,strokeWidth:2},path:{stroke:b0},rect:{fill:b0},shape:{stroke:b0},symbol:{fill:b0,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"]}},_0="#30a2da",w0="#cbcbcb",k0="#f0f0f0",E0="#333",$0={arc:{fill:_0},area:{fill:_0},axis:{domainColor:w0,grid:!0,gridColor:w0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:w0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:k0,group:{fill:k0},legend:{labelColor:E0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:E0,titleFontSize:14,titlePadding:10},line:{stroke:_0,strokeWidth:2},path:{stroke:_0,strokeWidth:.5},rect:{fill:_0},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:_0},bar:{binSpacing:2,fill:_0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},A0="#000",D0={group:{fill:"#e5e5e5"},arc:{fill:A0},area:{fill:A0},line:{stroke:A0},path:{stroke:A0},rect:{fill:A0},shape:{stroke:A0},symbol:{fill:A0,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"]}},S0="Benton Gothic, sans-serif",M0="#82c6df",C0="Benton Gothic Bold, sans-serif",F0="normal",O0={"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"]},N0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:C0,fontSize:22,fontWeight:"normal"},arc:{fill:M0},area:{fill:M0},line:{stroke:M0,strokeWidth:2},path:{stroke:M0},rect:{fill:M0},shape:{stroke:M0},symbol:{fill:M0,size:30},axis:{labelFont:S0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:C0,titleFontSize:13,titleFontWeight:F0},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:S0,labelFontSize:11.5,symbolType:"square",titleFont:C0,titleFontSize:13,titleFontWeight:F0},range:{category:O0["category-6"],diverging:O0["fireandice-6"],heatmap:O0["fire-7"],ordinal:O0["fire-7"],ramp:O0["fire-7"]}},T0="#ab5787",z0="#979797",R0={background:"#f9f9f9",arc:{fill:T0},area:{fill:T0},line:{stroke:T0},path:{stroke:T0},rect:{fill:T0},shape:{stroke:T0},symbol:{fill:T0,size:30},axis:{domainColor:z0,domainWidth:.5,gridWidth:.2,labelColor:z0,tickColor:z0,tickWidth:.2,titleColor:z0},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"]}},P0="#3e5c69",L0={background:"#fff",arc:{fill:P0},area:{fill:P0},line:{stroke:P0},path:{stroke:P0},rect:{fill:P0},shape:{stroke:P0},symbol:{fill:P0},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"]}},B0="#1696d2",j0="#000000",I0="Lato",U0="Lato",q0={"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"]},W0={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:I0},axisX:{domain:!0,domainColor:j0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:U0,labelAngle:0,tickColor:j0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:I0},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:U0,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:I0,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:U0,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:I0,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:q0["six-groups-cat-1"],diverging:q0["diverging-colors"],heatmap:q0["diverging-colors"],ordinal:q0["six-groups-seq"],ramp:q0["shades-blue"]},area:{fill:B0},rect:{fill:B0},line:{color:B0,stroke:B0,strokeWidth:5},trail:{color:B0,stroke:B0,strokeWidth:0,size:1},path:{stroke:B0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:B0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:B0,stroke:null}},arc:{fill:B0},shape:{stroke:B0},symbol:{fill:B0,size:30}},H0="#3366CC",G0="#ccc",Y0="Arial, sans-serif",V0={arc:{fill:H0},area:{fill:H0},path:{stroke:H0},rect:{fill:H0},shape:{stroke:H0},symbol:{stroke:H0},circle:{fill:H0},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:Y0,fontSize:12},"guide-title":{font:Y0,fontSize:12},"group-title":{font:Y0,fontSize:12}},title:{font:Y0,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:G0,tickColor:G0,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},X0=e=>e*(1/3+1),J0=X0(9),Q0=X0(10),Z0=X0(12),K0="Segoe UI",e1="wf_standard-font, helvetica, arial, sans-serif",t1="#252423",n1="#605E5C",i1="transparent",r1="#118DFF",o1="#DEEFFF",a1=[o1,r1],s1={view:{stroke:i1},background:i1,font:K0,header:{titleFont:e1,titleFontSize:Z0,titleColor:t1,labelFont:K0,labelFontSize:Q0,labelColor:n1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:n1,labelFontSize:J0,titleFont:e1,titleColor:t1,titleFontSize:Z0,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:r1},line:{stroke:r1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:K0,fontSize:J0,fill:n1},arc:{fill:r1},area:{fill:r1,line:!0,opacity:.6},path:{stroke:r1},rect:{fill:r1},point:{fill:r1,filled:!0,size:75},shape:{stroke:r1},symbol:{fill:r1,strokeWidth:1.5,size:50},legend:{titleFont:K0,titleFontWeight:"bold",titleColor:n1,labelFont:K0,labelFontSize:Q0,labelColor:n1,symbolType:"circle",symbolSize:75},range:{category:[r1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:a1,heatmap:a1,ordinal:[o1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",r1]}},l1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',u1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],c1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function f1({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:l1,fontWeight:600},axis:{labelColor:i,labelFontSize:12,grid:!0,gridColor:"#525252",titleColor:i,labelAngle:0},style:{"guide-label":{font:l1,fill:i,fontWeight:400},"guide-title":{font:l1,fill:i,fontWeight:400}},range:{category:"dark"===e?u1:c1,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 d1=f1({type:"light",background:"#ffffff"}),h1=f1({type:"light",background:"#f4f4f4"}),p1=f1({type:"dark",background:"#262626"}),m1=f1({type:"dark",background:"#161616"}),g1="2.14.0";function y1(e){return y1="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},y1(e)}function v1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==y1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==y1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===y1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const b1=["title","image"];function x1(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 _1="vg-tooltip-element",w1={offsetX:10,offsetY:10,id:_1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(vt(e)?e:x1(e,n)))).join(", ")}]`;if(we(e)){let i="";const r=e,{title:o,image:a}=r,s=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(r,b1);o&&(i+=`

${t(o)}

`),a&&(i+=``);const l=Object.keys(s);if(l.length>0){i+="";for(const e of l){let r=s[e];void 0!==r&&(we(r)&&(r=x1(r,n)),i+=``)}i+="
${t(e)}:${t(r)}
"}return i||"{}"}return t(e)}};function k1(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 E1(e){for(var t=1;t0?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 A1,D1,S1=n(27061);function M1(e){return M1="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},M1(e)}function C1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==M1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==M1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===M1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O1=N1;function N1(e){var t=this;if(t instanceof N1||(t=new N1),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},N1.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},N1.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},N1.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},N1.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new N1;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},N1.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,J1=(e,t,n)=>{const i=e[Y1].get(t);if(i){const t=i.value;if(Q1(e,t)){if(K1(e,i),!e[U1])return}else n&&(e[V1]&&(i.value.now=Date.now()),e[G1].unshiftNode(i));return t.value}},Q1=(e,t)=>{if(!t||!t.maxAge&&!e[q1])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[q1]&&n>e[q1]},Z1=e=>{if(e[j1]>e[B1])for(let t=e[G1].tail;e[j1]>e[B1]&&null!==t;){const n=t.prev;K1(e,t),t=n}},K1=(e,t)=>{if(t){const n=t.value;e[W1]&&e[W1](n.key,n.value),e[j1]-=n.length,e[Y1].delete(n.key),e[G1].removeNode(t)}};class e2{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const t2=(e,t,n,i)=>{let r=n.value;Q1(e,r)&&(K1(e,n),e[U1]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};const n2=Object.freeze({loose:!0}),i2=Object.freeze({});var r2=e=>e?"object"!=typeof e?n2:e:i2,o2={exports:{}},a2={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,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},s2="object"==typeof S1&&S1.env&&S1.env.NODE_DEBUG&&/\bsemver\b/i.test(S1.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=a2,i=s2,r=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let s=0;const l=(e,t,n)=>{const l=s++;i(e,l,t),a[e]=l,o[l]=t,r[l]=new RegExp(t,n?"g":void 0)};l("NUMERICIDENTIFIER","0|[1-9]\\d*"),l("NUMERICIDENTIFIERLOOSE","[0-9]+"),l("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),l("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),l("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),l("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),l("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),l("BUILDIDENTIFIER","[0-9A-Za-z-]+"),l("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),l("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),l("FULL",`^${o[a.FULLPLAIN]}$`),l("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),l("LOOSE",`^${o[a.LOOSEPLAIN]}$`),l("GTLT","((?:<|>)?=?)"),l("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),l("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),l("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),l("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),l("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),l("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),l("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),l("COERCERTL",o[a.COERCE],!0),l("LONETILDE","(?:~>?)"),l("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",l("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),l("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),l("LONECARET","(?:\\^)"),l("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",l("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),l("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),l("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),l("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),l("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",l("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),l("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),l("STAR","(<|>)?=?\\s*\\*"),l("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),l("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(o2,o2.exports);var l2=o2.exports;const u2=/^[0-9]+$/,c2=(e,t)=>{const n=u2.test(e),i=u2.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:ec2(t,e)};const d2=s2,{MAX_LENGTH:h2,MAX_SAFE_INTEGER:p2}=a2,{re:m2,t:g2}=l2,y2=r2,{compareIdentifiers:v2}=f2;var b2=class e{constructor(t,n){if(n=y2(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: ${t}`);if(t.length>h2)throw new TypeError(`version is longer than ${h2} characters`);d2("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?m2[g2.LOOSE]:m2[g2.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>p2||this.major<0)throw new TypeError("Invalid major version");if(this.minor>p2||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>p2||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[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}if(t){const e=Number(n)?1:0;0===v2(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,e]):this.prerelease=[t,e]}break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};const x2=b2;var _2=(e,t,n)=>new x2(e,n).compare(new x2(t,n));const w2=_2;const k2=_2;const E2=_2;const $2=_2;const A2=_2;const D2=_2;const S2=(e,t,n)=>0===w2(e,t,n),M2=(e,t,n)=>0!==k2(e,t,n),C2=(e,t,n)=>E2(e,t,n)>0,F2=(e,t,n)=>$2(e,t,n)>=0,O2=(e,t,n)=>A2(e,t,n)<0,N2=(e,t,n)=>D2(e,t,n)<=0;var T2,z2,R2,P2,L2=(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 S2(e,n,i);case"!=":return M2(e,n,i);case">":return C2(e,n,i);case">=":return F2(e,n,i);case"<":return O2(e,n,i);case"<=":return N2(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const B2=function e(){if(P2)return R2;P2=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,this.set=e.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);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){e=e.trim();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);let g=(e=(e=(e=e.replace(s[l.TILDETRIM],c)).replace(s[l.CARETTRIM],f)).split(/\s+/).join(" ")).split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>A(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.length=this[I1](e.value,e.key),this[j1]+=e.length}))),Z1(this)}get lengthCalculator(){return this[I1]}get length(){return this[j1]}get itemCount(){return this[G1].length}rforEach(e,t){t=t||this;for(let n=this[G1].tail;null!==n;){const i=n.prev;t2(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[G1].head;null!==n;){const i=n.next;t2(this,e,n,t),n=i}}keys(){return this[G1].toArray().map((e=>e.key))}values(){return this[G1].toArray().map((e=>e.value))}reset(){this[W1]&&this[G1]&&this[G1].length&&this[G1].forEach((e=>this[W1](e.key,e.value))),this[Y1]=new Map,this[G1]=new L1,this[j1]=0}dump(){return this[G1].map((e=>!Q1(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[G1]}set(e,t,n){if((n=n||this[q1])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[I1](t,e);if(this[Y1].has(e)){if(r>this[B1])return K1(this,this[Y1].get(e)),!1;const o=this[Y1].get(e).value;return this[W1]&&(this[H1]||this[W1](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[j1]+=r-o.length,o.length=r,this.get(e),Z1(this),!0}const o=new e2(e,t,r,i,n);return o.length>this[B1]?(this[W1]&&this[W1](e,t),!1):(this[j1]+=o.length,this[G1].unshift(o),this[Y1].set(e,this[G1].head),Z1(this),!0)}has(e){if(!this[Y1].has(e))return!1;const t=this[Y1].get(e).value;return!Q1(this,t)}get(e){return J1(this,e,!0)}peek(e){return J1(this,e,!1)}pop(){const e=this[G1].tail;return e?(K1(this,e),e.value):null}del(e){K1(this,this[Y1].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[Y1].forEach(((e,t)=>J1(this,t,!1)))}}({max:1e3}),i=r2,r=function(){if(z2)return T2;z2=1;const t=Symbol("SemVer ANY");class n{static get ANY(){return t}constructor(e,r){if(r=i(r),e instanceof n){if(e.loose===!!r.loose)return e;e=e.value}s("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===t?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(e){const n=this.options.loose?r[o.COMPARATORLOOSE]:r[o.COMPARATOR],i=e.match(n);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new l(i[2],this.options.loose):this.semver=t}toString(){return this.value}test(e){if(s("Comparator.test",e,this.options.loose),this.semver===t||e===t)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return a(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new u(e.value,t).test(this.value):""===e.operator?""===e.value||new u(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!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(">")))}}T2=n;const i=r2,{re:r,t:o}=l2,a=L2,s=s2,l=b2,u=e();return T2}(),o=s2,a=b2,{re:s,t:l,comparatorTrimReplace:u,tildeTrimReplace:c,caretTrimReplace:f}=l2,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=a2,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=_(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=k(e,t),o("xrange",e),e=$(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}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(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}))},$=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),A=(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 R2}();var j2=(e,t,n)=>{try{t=new B2(t,n)}catch(e){return!1}return t.test(e)},I2=F1(j2),U2='.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 q2(e,...t){for(const n of t)W2(e,n);return e}function W2(e,t){for(const n of Object.keys(t))$e(e,n,t[n],!0)}function H2(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 G2(e){for(var t=1;te,"vega-lite":(e,t)=>X2.compile(e,{config:t}).spec},n3='\n\n \n \n \n',i3="chart-wrapper";function r3(e,t,n,i){const r=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(r+e+o),a.document.title=`${K2[i]} JSON Source`}function o3(e,t){if(e.$schema){const n=m0(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${K2[n.library]}, but mode argument sets ${K2[t]??t}.`);const i=n.library;return I2(e3[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${K2[i]} ${n.version}, but the current version of ${K2[i]} is v${e3[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 a3(e){return(t=e)&&"load"in t?e:V2.loader(e);var t}async function s3(e,t,n={}){let i,r;vt(t)?(r=a3(n.loader),i=JSON.parse(await r.load(t))):i=t;const o=function(e){const t=e.usermeta?.embedOptions??{};return vt(t.defaultStyle)&&(t.defaultStyle=!1),t}(i),a=o.loader;r&&!a||(r=a3(n.loader??a));const s=await l3(o,r),l=await l3(n,r),u=G2(G2({},q2(l,s)),{},{config:Ee(l.config??{},s.config??{})});return await async function(e,t,n={},i){const r=n.theme?Ee(b[n.theme],n.config??{}):n.config,o=ht(n.actions)?n.actions:q2({},Q2,n.actions??{}),a=G2(G2({},Z2),n.i18n),s=n.renderer??"canvas",l=n.logLevel??V2.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?U2.toString():n.defaultStyle,i.appendChild(t)}}const f=o3(t,n.mode);let d=t3[f](t,r);if("vega-lite"===f&&d.$schema){const e=m0(d.$schema);I2(e3.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${e3.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(i3),c.appendChild(e),h=e}const p=n.patch;if(p&&(d=p instanceof Function?p(d):L(d,p,!0,!1).newDocument),n.formatLocale&&V2.formatLocale(n.formatLocale),n.timeFormatLocale&&V2.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const e in n.expressionFunctions){const t=n.expressionFunctions[e];"fn"in t?V2.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&V2.expressionFunction(e,t)}const{ast:m}=n,g=V2.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||V2.View)(g,G2({loader:i,logLevel:l,renderer:s},m?{expr:V2.expressionInterpreter??n.expr??tB}:{}));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 $1(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let v,{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){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML=n3,t.append(n),v=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",v)}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){r3(Z()(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){r3(Z()(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:Z()(t)}),n.preventDefault()})),i.append(o)}}return{view:y,spec:t,vgSpec:d,finalize:function(){v&&document.removeEventListener("click",v),y.finalize()},embedOptions:n}}(e,i,u,r)}async function l3(e,t){const n=vt(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=vt(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return G2(G2(G2({},e),i?{patch:i}:{}),n?{config:n}:{})}},36425:e=>{var t=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function r(o,s,l,u,c){"object"==typeof s&&(l=s.depth,u=s.prototype,c=s.includeNonEnumerable,s=s.circular);var f=[],d=[],h="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function o(l,p){if(null===l)return null;if(0===p)return l;var m,g;if("object"!=typeof l)return l;if(e(l,t))m=new t;else if(e(l,n))m=new n;else if(e(l,i))m=new i((function(e,t){l.then((function(t){e(o(t,p-1))}),(function(e){t(o(e,p-1))}))}));else if(r.__isArray(l))m=[];else if(r.__isRegExp(l))m=new RegExp(l.source,a(l)),l.lastIndex&&(m.lastIndex=l.lastIndex);else if(r.__isDate(l))m=new Date(l.getTime());else{if(h&&Buffer.isBuffer(l))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(l.length):new Buffer(l.length),l.copy(m),m;e(l,Error)?m=Object.create(l):void 0===u?(g=Object.getPrototypeOf(l),m=Object.create(g)):(m=Object.create(u),g=u)}if(s){var y=f.indexOf(l);if(-1!=y)return d[y];f.push(l),d.push(m)}for(var v in e(l,t)&&l.forEach((function(e,t){var n=o(t,p-1),i=o(e,p-1);m.set(n,i)})),e(l,n)&&l.forEach((function(e){var t=o(e,p-1);m.add(t)})),l){var b;g&&(b=Object.getOwnPropertyDescriptor(g,v)),b&&null==b.set||(m[v]=o(l[v],p-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(l);for(v=0;v