From fa001c5ada6ca9b16b37e212948e087731fa26e9 Mon Sep 17 00:00:00 2001 From: jrdzha Date: Sat, 25 Apr 2020 00:06:46 -0700 Subject: [PATCH] work in progress -- adding shelves --- css/widget.css | 5 +- luxWidget/nbextension/static/index.js | 4 +- luxWidget/nbextension/static/index.js.map | 2 +- luxWidget/widget.py | 6 +- run.sh | 3 + src/currentView.tsx | 14 +-- src/widget.tsx | 103 +++++++++++++++++++--- 7 files changed, 110 insertions(+), 27 deletions(-) create mode 100644 run.sh diff --git a/css/widget.css b/css/widget.css index ba75c1e..7519f3f 100644 --- a/css/widget.css +++ b/css/widget.css @@ -1,5 +1,5 @@ #widgetContainer{ - height:312px; + height:380px; width:100%; display:inline-flex; } @@ -108,7 +108,6 @@ input[type=text], select { overflow-x: hidden; display: flex; min-width: 30%; - height: 100%; } #mainVizInnerContainer{ @@ -131,7 +130,7 @@ input[type=text], select { position: absolute; /* bottom: 90%; */ /* left: 97%; */ - top: 0px; + top: 70px; right: 0px; font-size: 20px; padding: 5px; diff --git a/luxWidget/nbextension/static/index.js b/luxWidget/nbextension/static/index.js index 5610afd..e49a492 100644 --- a/luxWidget/nbextension/static/index.js +++ b/luxWidget/nbextension/static/index.js @@ -60,7 +60,7 @@ var S=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__: * (c) 2017 Joachim Wester * MIT license */ -var G=new WeakMap,X=function(e){this.observers=new Map,this.obj=e},K=function(e,t){this.callback=e,this.observer=t};function J(e,t){t.unobserve()}function Q(e,t){var n,r=function(e){return G.get(e)}(e);if(r){var i=function(e,t){return e.observers.get(t)}(r,t);n=i&&i.observer}else r=new X(e),G.set(e,r);if(n)return n;if(n={},r.value=T(e),t){n.callback=t,n.next=null;var o=function(){Z(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){Z(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(r,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},r.observers.set(t,new K(t,n)),n}function Z(e,t){void 0===t&&(t=!1);var n=G.get(e.object);ee(n.value,e.object,e.patches,"",t),e.patches.length&&q(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function ee(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=N(t),a=N(e),u=!1,s=a.length-1;s>=0;s--){var l=e[f=a[s]];if(!A(t,f)||void 0===t[f]&&void 0!==l&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+M(f),value:T(l)}),n.push({op:"remove",path:r+"/"+M(f)}),u=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}),!0);else{var c=t[f];"object"==typeof l&&null!=l&&"object"==typeof c&&null!=c?ee(l,c,n,r+"/"+M(f),i):l!==c&&(!0,i&&n.push({op:"test",path:r+"/"+M(f),value:T(l)}),n.push({op:"replace",path:r+"/"+M(f),value:T(c)}))}}if(u||o.length!=a.length)for(s=0;s=0&&n.splice(i,1)),n},n}var ue=async function(e,t){try{await t(e)}catch(t){e.error(t)}},se=Symbol("vega_id"),le=1;function ce(e){return!(!e||!fe(e))}function fe(e){return e[se]}function de(e,t){return e[se]=t,e}function he(e){var t=e===Object(e)?e:{data:e};return fe(t)?t:de(t,le++)}function pe(e){return me(e,he({}))}function me(e,t){for(var n in e)t[n]=e[n];return t}function ge(e,t){return de(t,fe(e))}function ve(e,t){return e?t?(n,r)=>e(n,r)||fe(t(n))-fe(t(r)):(t,n)=>e(t,n)||fe(t)-fe(n):null}function ye(e){return e&&e.constructor===be}function be(){var e=[],t=[],n=[],r=[],i=[],o=!1;return{constructor:be,insert:function(t){for(var n=Object(oe.i)(t),r=0,i=n.length;r0&&(g(d,f,c.value),a.modifies(f));for(s=0,l=i.length;s0&&g(e,c.field,c.value)})),a.modifies(c.field);if(o)a.mod=t.length||r.length?u.filter((function(e){return p[fe(e)]>0})):u.slice();else for(h in m)a.mod.push(m[h]);return a}}}var xe="_:mod:_";function we(){Object.defineProperty(this,xe,{writable:!0,value:{}})}var _e=we.prototype;_e.set=function(e,t,n,r){var i=this,o=i[e],a=i[xe];return null!=t&&t>=0?(o[t]!==n||r)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||r)&&(i[e]=n,a[e]=Object(oe.A)(n)?1+n.length:-1),i},_e.modified=function(e,t){var n,r=this[xe];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(Object(oe.A)(e)){for(n=0;n=0?t+1e?(t=n,1):0}))},Te.debounce=function(e){var t=Ne();return this.targets().add(Ne(null,null,Object(oe.m)(e,(function(e){var n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},Te.between=function(e,t){var n=!1;return e.targets().add(Ne(null,null,(function(){n=!0}))),t.targets().add(Ne(null,null,(function(){n=!1}))),this.filter((function(){return n}))};const De=/^([A-Za-z]+:)?\/\//,Me=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Fe=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Pe(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function Re(e,t){t=Object(oe.o)({},this.options,t);const n=this.fileAccess,r={href:null};let i,o,a;const u=Me.test(e.replace(Fe,""));null!=e&&"string"==typeof e&&u||Object(oe.n)("Sanitize failure, invalid URI: "+Object(oe.Y)(e));const s=De.test(e);return(a=t.baseURL)&&!s&&(e.startsWith("/")||"/"===a[a.length-1]||(e="/"+e),e=a+e),o=(i=e.startsWith("file://"))||"file"===t.mode||"http"!==t.mode&&!s&&n,i?e=e.slice("file://".length):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(r,"localFile",{value:!!o}),r.href=e,t.target&&(r.target=t.target+""),t.rel&&(r.rel=t.rel+""),r}function ze(e){return e?function(t){return new Promise((function(n,r){e.readFile(t,(function(e,t){e?r(e):n(t)}))}))}:Le}async function Le(){Object(oe.n)("No file system access.")}function Ie(e){return e?async function(t,n){const r=Object(oe.o)({},this.options.http,n),i=n&&n.response,o=await e(t,r);return o.ok?Object(oe.D)(o[i])?o[i]():o.text():Object(oe.n)(o.status+""+o.statusText)}:$e}async function $e(){Object(oe.n)("No HTTP fetch method available.")}var Be={boolean:oe.Z,integer:oe.bb,number:oe.bb,date:oe.ab,string:oe.db,unknown:oe.x},Ue=[function(e){return"true"===e||"false"===e||!0===e||!1===e},function(e){return Ye(e)&&Number.isInteger(+e)},Ye,function(e){return!Number.isNaN(Date.parse(e))}],qe=["boolean","integer","number","date"];function We(e,t){if(!e||!e.length)return"unknown";var n,r,i,o,a=0,u=e.length,s=Ue.length,l=Ue.map((function(e,t){return t+1}));for(r=0,u=e.length;r9999?"+"+Je(t,6):Je(t,4))+"-"+Je(e.getUTCMonth()+1,2)+"-"+Je(e.getUTCDate(),2)+(o?"T"+Je(n,2)+":"+Je(r,2)+":"+Je(i,2)+"."+Je(o,3)+"Z":i?"T"+Je(n,2)+":"+Je(r,2)+":"+Je(i,2)+"Z":r||n?"T"+Je(n,2)+":"+Je(r,2)+"Z":"")}var Ze=function(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function r(e,t){var r,i=[],o=e.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return Ge;if(l)return l=!1,Ve;var t,r,i=a;if(34===e.charCodeAt(i)){for(;a++=o?s=!0:10===(r=e.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===e.charCodeAt(a)&&++a),e.slice(i+1,t-1).replace(/""/g,'"')}for(;a1)r=ft(e,t,n);else for(i=0,r=new Array(o=e.arcs.length);ie!==t,exterior:(e,t)=>e===t};function ht(e,t){let n,r,i,o;return e=Object(nt.a)(e,t),t&&t.feature?(n=ot,i=t.feature):t&&t.mesh?(n=lt,i=t.mesh,o=dt[t.filter]):Object(oe.n)("Missing TopoJSON feature or mesh parameter."),r=(r=e.objects[i])?n(e,r,o):Object(oe.n)("Invalid TopoJSON object: "+i),r&&r.features||[r]}ht.responseType="json";const pt={dsv:tt,csv:et(","),tsv:et("\t"),json:nt.a,topojson:ht};function mt(e,t){return arguments.length>1?(pt[e]=t,this):Object(oe.v)(pt,e)?pt[e]:null}function gt(e){const t=mt(e);return t&&t.responseType||"text"}var vt=new Date,yt=new Date;function bt(e,t,n,r){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=function(t){return e(t=new Date(+t)),t},i.ceil=function(n){return e(n=new Date(n-1)),t(n,1),e(n),n},i.round=function(e){var t=i(e),n=i.ceil(e);return e-t0))return u;do{u.push(a=new Date(+n)),t(n,o),e(n)}while(a=t)for(;e(t),!n(t);)t.setTime(t-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}))},n&&(i.count=function(t,r){return vt.setTime(+t),yt.setTime(+r),e(vt),e(yt),Math.floor(n(vt,yt))},i.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?function(t){return r(t)%e==0}:function(t){return i.count(0,t)%e==0}):i:null}),i}function xt(e){return bt((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var wt=xt(0),_t=xt(1),Et=xt(2),Ot=xt(3),kt=xt(4),jt=xt(5),St=xt(6),Ct=(wt.range,_t.range,Et.range,Ot.range,kt.range,jt.range,St.range,bt((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1}))),At=Ct;Ct.range;function Nt(e){return bt((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var Tt=Nt(0),Dt=Nt(1),Mt=Nt(2),Ft=Nt(3),Pt=Nt(4),Rt=Nt(5),zt=Nt(6),Lt=(Tt.range,Dt.range,Mt.range,Ft.range,Pt.range,Rt.range,zt.range,bt((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1}))),It=Lt,$t=(Lt.range,bt((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()})));$t.every=function(e){return isFinite(e=Math.floor(e))&&e>0?bt((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var Bt=$t,Ut=($t.range,bt((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()})));Ut.every=function(e){return isFinite(e=Math.floor(e))&&e>0?bt((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var qt=Ut;Ut.range;function Wt(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Ht(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Yt(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var Vt,Gt,Xt,Kt,Jt,Qt={"-":"",_:" ",0:"0"},Zt=/^\s*\d+/,en=/^%/,tn=/[\\^$*+?|[\]().{}]/g;function nn(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o68?1900:2e3),n+r[0].length):-1}function pn(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function mn(e,t,n){var r=Zt.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function gn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function vn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function yn(e,t,n){var r=Zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function bn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function wn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function _n(e,t,n){var r=Zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function En(e,t,n){var r=Zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function On(e,t,n){var r=en.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function kn(e,t,n){var r=Zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function jn(e,t,n){var r=Zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Sn(e,t){return nn(e.getDate(),t,2)}function Cn(e,t){return nn(e.getHours(),t,2)}function An(e,t){return nn(e.getHours()%12||12,t,2)}function Nn(e,t){return nn(1+It.count(Bt(e),e),t,3)}function Tn(e,t){return nn(e.getMilliseconds(),t,3)}function Dn(e,t){return Tn(e,t)+"000"}function Mn(e,t){return nn(e.getMonth()+1,t,2)}function Fn(e,t){return nn(e.getMinutes(),t,2)}function Pn(e,t){return nn(e.getSeconds(),t,2)}function Rn(e){var t=e.getDay();return 0===t?7:t}function zn(e,t){return nn(Tt.count(Bt(e)-1,e),t,2)}function Ln(e,t){var n=e.getDay();return e=n>=4||0===n?Pt(e):Pt.ceil(e),nn(Pt.count(Bt(e),e)+(4===Bt(e).getDay()),t,2)}function In(e){return e.getDay()}function $n(e,t){return nn(Dt.count(Bt(e)-1,e),t,2)}function Bn(e,t){return nn(e.getFullYear()%100,t,2)}function Un(e,t){return nn(e.getFullYear()%1e4,t,4)}function qn(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+nn(t/60|0,"0",2)+nn(t%60,"0",2)}function Wn(e,t){return nn(e.getUTCDate(),t,2)}function Hn(e,t){return nn(e.getUTCHours(),t,2)}function Yn(e,t){return nn(e.getUTCHours()%12||12,t,2)}function Vn(e,t){return nn(1+At.count(qt(e),e),t,3)}function Gn(e,t){return nn(e.getUTCMilliseconds(),t,3)}function Xn(e,t){return Gn(e,t)+"000"}function Kn(e,t){return nn(e.getUTCMonth()+1,t,2)}function Jn(e,t){return nn(e.getUTCMinutes(),t,2)}function Qn(e,t){return nn(e.getUTCSeconds(),t,2)}function Zn(e){var t=e.getUTCDay();return 0===t?7:t}function er(e,t){return nn(wt.count(qt(e)-1,e),t,2)}function tr(e,t){var n=e.getUTCDay();return e=n>=4||0===n?kt(e):kt.ceil(e),nn(kt.count(qt(e),e)+(4===qt(e).getUTCDay()),t,2)}function nr(e){return e.getUTCDay()}function rr(e,t){return nn(_t.count(qt(e)-1,e),t,2)}function ir(e,t){return nn(e.getUTCFullYear()%100,t,2)}function or(e,t){return nn(e.getUTCFullYear()%1e4,t,4)}function ar(){return"+0000"}function ur(){return"%"}function sr(e){return+e}function lr(e){return Math.floor(+e/1e3)}function cr(e){return Vt=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,a=e.shortDays,u=e.months,s=e.shortMonths,l=on(i),c=an(i),f=on(o),d=an(o),h=on(a),p=an(a),m=on(u),g=an(u),v=on(s),y=an(s),b={a:function(e){return a[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return u[e.getMonth()]},c:null,d:Sn,e:Sn,f:Dn,H:Cn,I:An,j:Nn,L:Tn,m:Mn,M:Fn,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:sr,s:lr,S:Pn,u:Rn,U:zn,V:Ln,w:In,W:$n,x:null,X:null,y:Bn,Y:Un,Z:qn,"%":ur},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return s[e.getUTCMonth()]},B:function(e){return u[e.getUTCMonth()]},c:null,d:Wn,e:Wn,f:Xn,H:Hn,I:Yn,j:Vn,L:Gn,m:Kn,M:Jn,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:sr,s:lr,S:Qn,u:Zn,U:er,V:tr,w:nr,W:rr,x:null,X:null,y:ir,Y:or,Z:ar,"%":ur},w={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=v.exec(t.slice(n));return r?(e.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=m.exec(t.slice(n));return r?(e.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return O(e,t,n,r)},d:vn,e:vn,f:En,H:bn,I:bn,j:yn,L:_n,m:gn,M:xn,p:function(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:mn,Q:kn,s:jn,S:wn,u:sn,U:ln,V:cn,w:un,W:fn,x:function(e,t,r){return O(e,n,t,r)},X:function(e,t,n){return O(e,r,t,n)},y:hn,Y:dn,Z:pn,"%":On};function _(e,t){return function(n){var r,i,o,a=[],u=-1,s=0,l=e.length;for(n instanceof Date||(n=new Date(+n));++u53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Ht(Yt(o.y,0,1))).getUTCDay(),r=i>4||0===i?_t.ceil(r):_t(r),r=At.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Wt(Yt(o.y,0,1))).getDay(),r=i>4||0===i?Dt.ceil(r):Dt(r),r=It.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.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),i="Z"in o?Ht(Yt(o.y,0,1)).getUTCDay():Wt(Yt(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Ht(o)):Wt(o)}}function O(e,t,n,r){for(var i,o,a=0,u=t.length,s=n.length;a=s)return-1;if(37===(i=t.charCodeAt(a++))){if(i=t.charAt(a++),!(o=w[i in Qt?t.charAt(a++):i])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return(b.x=_(n,b),b.X=_(r,b),b.c=_(t,b),x.x=_(n,x),x.X=_(r,x),x.c=_(t,x),{format:function(e){var t=_(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=E(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=_(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=E(e+="",!0);return t.toString=function(){return e},t}})}(e),Gt=Vt.format,Xt=Vt.parse,Kt=Vt.utcFormat,Jt=Vt.utcParse,Vt}cr({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"]});var fr=function(e,t,n){const r=mt((t=t||{}).type||"json");return r||Object(oe.n)("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n){if(!e.length)return;n=n||Xt;var r,i,o,a,u,s,l,c=e.columns||Object.keys(e[0]);"auto"===t&&(t=He(e,c));for(c=Object.keys(t),r=c.map((function(e){var r,i,o=t[e];if(o&&(0===o.indexOf("date:")||0===o.indexOf("utc:")))return("'"===(i=(r=o.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?Jt(i):n(i);if(!Be[o])throw Error("Illegal format pattern: "+e+":"+o);return Be[o]})),a=0,s=e.length,l=c.length;ae.touch(n(t)):Object(oe.D)(r)?(u=new ke(null,r,i,!1),a=t=>{u.evaluate(t);const r=n(t),i=u.value;ye(i)?e.pulse(r,i,o):e.update(r,i,s)}):a=t=>e.update(n(t),r,s),t.apply(a)}function gr(e,t,n,r,i,o){if(void 0===r)t.targets().add(n);else{const a=o||{},u=new ke(null,function(e,t){return t=Object(oe.D)(t)?t:Object(oe.l)(t),e?function(n,r){const i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}(n,r),i,!1);u.modified(a.force),u.rank=t.rank,t.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),e.connect(n,[u]))}}var vr={};function yr(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}var br=yr.prototype;function xr(e,t){return e?function(n,r){return e(n,r)&&t(n,r)}:t}function wr(e,t){var n=[];return Object(oe.hb)(e,t,(function(e){n.push(e)})),n}function _r(e,t){var n={};return e.visit(t,(function(e){n[fe(e)]=1})),function(e){return n[fe(e)]?null:e}}function Er(e,t,n,r){var i,o,a,u,s,l=this,c=0;for(this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n,a=0,u=n.length;at[e]=!0):t[e]=!0,this},br.modified=function(e,t){var n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?Object(oe.A)(e)?e.some((function(e){return n[e]})):n[e]:!!n)},br.filter=function(e,t){var n=this;return 1&e&&(n.addF=xr(n.addF,t)),2&e&&(n.remF=xr(n.remF,t)),4&e&&(n.modF=xr(n.modF,t)),16&e&&(n.srcF=xr(n.srcF,t)),n},br.materialize=function(e){var t=this;return 1&(e=e||7)&&t.addF&&(t.add=wr(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=wr(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=wr(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},br.visit=function(e,t){var n,r,i=this,o=t;return 16&e?(Object(oe.hb)(i.source,i.srcF,o),i):(1&e&&Object(oe.hb)(i.add,i.addF,o),2&e&&Object(oe.hb)(i.rem,i.remF,o),4&e&&Object(oe.hb)(i.mod,i.modF,o),8&e&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||(r?Object(oe.hb)(n,_r(i,5),o):Object(oe.hb)(n,i.srcF,o))),i)};var Or=Object(oe.y)(Er,yr);function kr(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Or.fork=function(e){var t=new yr(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(function(e){return t.add.push(e)})),e&t.REM&&this.visit(t.REM,(function(e){return t.rem.push(e)})),e&t.MOD&&this.visit(t.MOD,(function(e){return t.mod.push(e)}))),t},Or.changed=function(e){return this.changes&e},Or.modified=function(e){var t=this,n=t.fields;return n&&t.changes&t.MOD?Object(oe.A)(e)?e.some((function(e){return n[e]})):n[e]:0},Or.filter=function(){Object(oe.n)("MultiPulse does not support filtering.")},Or.materialize=function(){Object(oe.n)("MultiPulse does not support materialization.")},Or.visit=function(e,t){var n=this,r=n.pulses,i=r.length,o=0;if(e&n.SOURCE)for(;ot=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Cr(t,0,t.length-1,e)),pop:()=>{var n,r=t.pop();return t.length?(n=t[0],t[0]=r,function(e,t,n){var r,i=t,o=e.length,a=e[t],u=1+(t<<1);for(;u=0&&(u=r),e[t]=e[u],u=1+((t=u)<<1);e[t]=a,Cr(e,i,t,n)}(t,0,e)):n=r,n}}}function Cr(e,t,n,r){var i,o,a;for(i=e[n];n>t&&r(i,o=e[a=n-1>>1])<0;)e[n]=o,n=a;return e[n]=i}function Ar(){this.logger(Object(oe.K)()),this.logLevel(oe.b),this._clock=0,this._rank=0;try{this._loader=dr()}catch(e){}this._touched=ae(oe.w),this._input={},this._pulse=null,this._heap=Sr((e,t)=>e.qrank-t.qrank),this._postrun=[]}var Nr=Ar.prototype;function Tr(e){return function(){return this._log[e].apply(this,arguments)}}function Dr(e,t){ke.call(this,e,null,t)}Nr.stamp=function(){return this._clock},Nr.loader=function(e){return arguments.length?(this._loader=e,this):this._loader},Nr.cleanThreshold=1e4,Nr.add=function(e,t,n,r){var i,o=1;return e instanceof ke?i=e:e&&e.prototype instanceof ke?i=new e:Object(oe.D)(e)?i=new ke(null,e):(o=0,i=new ke(e,t)),this.rank(i),o&&(r=n,n=t),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},Nr.connect=function(e,t){var n,r,i=e.rank;for(n=0,r=t.length;n=0;)i.push(t=n[r]),t===e&&Object(oe.n)("Cycle detected in dataflow graph.")},Nr.pulse=function(e,t,n){this.touch(e,n||jr);var r=new yr(this,this._clock+(this._pulse?0:1)),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this},Nr.touch=function(e,t){var n=t||jr;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},Nr.update=function(e,t,n){var r=n||jr;return(e.set(t)||r.force)&&this.touch(e,r),this},Nr.changeset=be,Nr.ingest=function(e,t,n){return this.pulse(e,this.changeset().insert(hr(t,n)))},Nr.parse=hr,Nr.preload=async function(e,t,n){const r=this,i=r._pending||function(e){var t,n=new Promise((function(e){t=e}));return n.requests=0,n.done=function(){0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(r);i.requests+=1;const o=await r.request(t,n);return r.pulse(e,r.changeset().remove(oe.fb).insert(o.data||[])),i.done(),o},Nr.request=async function(e,t){const n=this;let r,i=0;try{r=await n.loader().load(e,{context:"dataflow",response:gt(t&&t.type)});try{r=hr(r,t)}catch(t){i=-2,n.warn("Data ingestion failed",e,t)}}catch(t){i=-1,n.warn("Loading failed",e,t)}return{data:r,status:i}},Nr.events=function(e,t,n,r){for(var i,o=this,a=Ne(n,r),u=function(e){e.dataflow=o;try{a.receive(e)}catch(e){o.error(e)}finally{o.run()}},s=0,l=(i="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):Object(oe.i)(e)).length;s=oe.c&&(s=Date.now(),r.debug("-- START PROPAGATION ("+c+") -----")),r._touched.forEach(e=>r._enqueue(e,!0)),r._touched=ae(oe.w);try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,e)),u.then?u=await u:u.async&&(o.push(u.async),u=vr),i>=oe.a&&r.debug(a.id,u===vr?"STOP":u,a),u!==vr&&a._targets&&a._targets.forEach(e=>r._enqueue(e)),++f):r._enqueue(a,!0)}catch(e){r._heap.clear(),l=e}if(r._input={},r._pulse=null,i>=oe.c&&(s=Date.now()-s,r.info("> Pulse "+c+": "+f+" operators; "+s+"ms")),l&&(r._postrun=[],r.error(l)),r._postrun.length){const e=r._postrun.sort((e,t)=>t.priority-e.priority);r._postrun=[];for(let t=0;tr.runAsync(null,()=>{e.forEach(e=>{try{e(r)}catch(e){r.error(e)}})})),r},Nr.run=function(e,t,n){return this._pulse?kr(this):(this.evaluate(e,t,n),this)},Nr.runAsync=async function(e,t,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running},Nr.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)}},Nr._enqueue=function(e,t){var n=e.stampe.pulse),t):this._input[e.id]||function(e,t){if(t&&t.stamp===e.stamp)return t;e=e.fork(),t&&t!==vr&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)},Nr.logger=function(e){return arguments.length?(this._log=e,this):this._log},Nr.error=Tr("error"),Nr.warn=Tr("warn"),Nr.info=Tr("info"),Nr.debug=Tr("debug"),Nr.logLevel=Tr("level");var Mr=Object(oe.y)(Dr,ke);Mr.run=function(e){return e.stampthis.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t);var t},Mr.evaluate=function(e){var t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},Mr.transform=function(){};var Fr={};function Pr(e){var t=Rr(e);return t&&t.Definition||null}function Rr(e){return e=e&&e.toLowerCase(),Object(oe.v)(Fr,e)?Fr[e]:null}function zr(e){return e&&e.length?1===e.length?e[0]:(t=e,function(e){for(var n=t.length,r=1,i=String(t[0](e));r 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:Ur({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:Ur({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:Ur({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:Ur({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:Ur({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:Ur({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:Ur({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:Ur({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:Ur({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:Ur({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:Ur({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:Ur({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:Ur({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (Number.isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:Ur({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (Number.isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},$r=Object.keys(Ir);function Br(e,t){return Ir[e](t)}function Ur(e){return function(t){var n=Object(oe.o)({init:"",add:"",rem:"",idx:0},e);return n.out=t||e.name,n}}function qr(e,t){return e.idx-t.idx}function Wr(e,t){var n=t||oe.x,r=function(e,t){var n,r=e.reduce((function e(n,r){function i(t){n[t]||e(n,n[t]=Ir[t]())}return r.req&&r.req.forEach(i),t&&r.str&&r.str.forEach(i),n}),e.reduce((function(e,t){return e[t.name]=t,e}),{})),i=[];for(n in r)i.push(r[n]);return i.sort(qr)}(e,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",o="this.cell = cell; this.init();",a="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",u="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach((function(e){i+=e.init,a+=e.add,u+=e.rem})),e.slice().sort(qr).forEach((function(e){s+="t["+Object(oe.Y)(e.out)+"]="+e.set+";"})),s+="return t;",(o=Function("cell",o)).prototype.init=Function(i),o.prototype.add=Function("v","t",a),o.prototype.rem=Function("v","t",u),o.prototype.set=Function("t",s),o.prototype.get=n,o.fields=e.map((function(e){return e.out})),o}var Hr=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 r of e)null!=(r=t(r,++n,e))&&(r=+r)>=r&&(yield r)}},Yr=function(e,t){return et?1:e>=t?0:NaN};function Vr(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n=i)&&(n=i)}return n}function Gr(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 r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Xr(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}var Kr=function(e){return null===e?NaN:+e};function Jr(e,t,n){if(r=(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 r of e)null!=(r=t(r,++n,e))&&(r=+r)>=r&&(yield r)}}(e,n))).length){if((t=+t)<=0||r<2)return Gr(e);if(t>=1)return Vr(e);var r,i=(r-1)*t,o=Math.floor(i),a=Vr(function e(t,n,r=0,i=t.length-1,o=Yr){for(;i>r;){if(i-r>600){const a=i-r+1,u=n-r+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(u-a/2<0?-1:1);e(t,n,Math.max(r,Math.floor(n-u*l/a+c)),Math.min(i,Math.floor(n+(a-u)*l/a+c)),o)}const a=t[n];let u=r,s=i;for(Xr(t,r,n),o(t[i],a)>0&&Xr(t,r,i);u0;)--s}0===o(t[r],a)?Xr(t,r,s):(++s,Xr(t,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return t}(e,o).subarray(0,o+1));return a+(Gr(e.subarray(o+1))-a)*(i-o)}}var Qr=function(e,t,n){var r=Float64Array.from(Hr(e,n));return r.sort(Yr),t.map(e=>function(e,t,n=Kr){if(r=e.length){if((t=+t)<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(i-o)}}(r,e))},Zr=function(e,t){return Qr(e,[.25,.5,.75],t)};var ei=function(e,t){var n=e.length,r=function(e,t){const n=function(e,t){let n,r=0,i=0,o=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-i,i+=n/++r,o+=n*(t-i));else{let a=-1;for(let u of e)null!=(u=t(u,++a,e))&&(u=+u)>=u&&(n=u-i,i+=n/++r,o+=n*(u-i))}if(r>1)return o/(r-1)}(e,t);return n?Math.sqrt(n):n}(e,t),i=Zr(e,t),o=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)},ti=function(e){var t,n,r,i,o,a,u,s,l=e.maxbins||20,c=e.base||10,f=Math.log(c),d=e.divide||[5,2],h=e.extent[0],p=e.extent[1],m=e.span||p-h||Math.abs(h)||1;if(e.step)t=e.step;else if(e.steps){for(o=m/l,a=0,u=e.steps.length;al;)t*=c;for(a=0,u=d.length;a=r&&m/o<=l&&(t=o)}return i=(o=Math.log(t))>=0?0:1+~~(-o/f),s=Math.pow(c,-i-1),(e.nice||void 0===e.nice)&&(h=h<(o=Math.floor(h/t+s)*t)?o-t:o,p=Math.ceil(p/t)*t),{start:h,stop:p===h?h+t:p,step:t}},ni=Math.random;function ri(e){ni=e}var ii=function(e,t,n,r){if(!e.length)return[void 0,void 0];var i,o,a,u,s=Float64Array.from(Hr(e,r)),l=s.length,c=t;for(a=0,u=Array(c);ae);let i,o=0,a=1,u=e.length,s=new Float64Array(u),l=r(e[0]),c=l,f=l+t;for(;a=f){for(c=(l+c)/2;o>1);ra;)e[r--]=e[o]}o=a,a=n}return e}(s,t+t/4):s};var ai=function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},ui=function(e,t){null==t&&(t=e,e=0);var n,r,i,o={};return o.min=function(e){return arguments.length?(i=r-(n=e||0),o):n},o.max=function(e){return arguments.length?(i=(r=e||0)-n,o):r},o.sample=function(){return n+Math.floor(i*ni())},o.pdf=function(e){return e===Math.floor(e)&&e>=n&&e=r?1:(t-n+1)/i},o.icdf=function(e){return e>=0&&e<=1?n-1+Math.floor(e*i):NaN},o.min(e).max(t)};const si=Math.sqrt(2*Math.PI),li=Math.SQRT2;let ci=NaN;function fi(e,t){e=e||0,t=null==t?1:t;let n,r,i=0,o=0;if(ci==ci)i=ci,ci=NaN;else{do{i=2*ni()-1,o=2*ni()-1,n=i*i+o*o}while(0===n||n>1);r=Math.sqrt(-2*Math.log(n)/n),i*=r,ci=o*r}return e+i*t}function di(e,t,n){const r=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*si)}function hi(e,t,n){let r,i=(e-(t=t||0))/(n=null==n?1:n),o=Math.abs(i);if(o>37)r=0;else{let e,t=Math.exp(-o*o/2);o<7.07106781186547?(e=.0352624965998911*o+.700383064443688,e=e*o+6.37396220353165,e=e*o+33.912866078383,e=e*o+112.079291497871,e=e*o+221.213596169931,e=e*o+220.206867912376,r=t*e,e=.0883883476483184*o+1.75566716318264,e=e*o+16.064177579207,e=e*o+86.7807322029461,e=e*o+296.564248779674,e=e*o+637.333633378831,e=e*o+793.826512519948,e=e*o+440.413735824752,r/=e):(e=o+.65,e=o+4/e,e=o+3/e,e=o+2/e,e=o+1/e,r=t/e/2.506628274631)}return i>0?1-r:r}function pi(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*li*function(e){let t,n=-Math.log((1-e)*(1+e));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;return t*e}(2*e-1)}var mi=function(e,t){var n,r,i={mean:function(e){return arguments.length?(n=e||0,i):n},stdev:function(e){return arguments.length?(r=null==e?1:e,i):r},sample:()=>fi(n,r),pdf:e=>di(e,n,r),cdf:e=>hi(e,n,r),icdf:e=>pi(e,n,r)};return i.mean(e).stdev(t)},gi=function(e,t){var n=mi(),r={},i=0;return r.data=function(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},r.bandwidth=function(n){return arguments.length?(!(t=n)&&e&&(t=ei(e)),r):t},r.sample=function(){return e[~~(ni()*i)]+t*n.sample()},r.pdf=function(r){for(var o=0,a=0;avi(n,r),pdf:e=>yi(e,n,r),cdf:e=>bi(e,n,r),icdf:e=>xi(e,n,r)};return i.mean(e).stdev(t)},_i=function(e,t){var n,r={},i=0;function o(e){var t,n=[],r=0;for(t=0;t=t&&e<=n?1/(n-t):0}function ki(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function ji(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}var Si=function(e,t){var n,r,i={min:function(e){return arguments.length?(n=e||0,i):n},max:function(e){return arguments.length?(r=null==e?1:e,i):r},sample:()=>Ei(n,r),pdf:e=>Oi(e,n,r),cdf:e=>ki(e,n,r),icdf:e=>ji(e,n,r)};return null==t&&(t=null==e?1:e,e=0),i.min(e).max(t)},Ci=function(e,t,n,r){const i=r-e*e,o=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-o*e,o]};function Ai(e,t,n,r){e=e.filter(e=>{let r=t(e),i=n(e);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&e.sort((e,n)=>t(e)-t(n));const i=e.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,l,c=0,f=0,d=0;for(l of e)o[c]=u=+t(l),a[c]=s=+n(l),++c,f+=(u-f)/c,d+=(s-d)/c;for(c=0;c=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}var Ti=function(e,t,n,r,i){let o=0,a=0;return Ni(e,t,n,(e,t)=>{const n=t-i(e),u=t-r;o+=n*n,a+=u*u}),1-o/a},Di=function(e,t,n){let r=0,i=0,o=0,a=0,u=0;Ni(e,t,n,(e,t)=>{++u,r+=(e-r)/u,i+=(t-i)/u,o+=(e*t-o)/u,a+=(e*e-a)/u});const s=Ci(r,i,o,a),l=e=>s[0]+s[1]*e;return{coef:s,predict:l,rSquared:Ti(e,t,n,i,l)}},Mi=function(e,t,n){let r=0,i=0,o=0,a=0,u=0;Ni(e,t,n,(e,t)=>{++u,e=Math.log(e),r+=(e-r)/u,i+=(t-i)/u,o+=(e*t-o)/u,a+=(e*e-a)/u});const s=Ci(r,i,o,a),l=e=>s[0]+s[1]*Math.log(e);return{coef:s,predict:l,rSquared:Ti(e,t,n,i,l)}},Fi=function(e,t,n){let r=0,i=0,o=0,a=0,u=0,s=0;Ni(e,t,n,(e,t)=>{const n=Math.log(t),l=e*t;++s,r+=(t-r)/s,o+=(l-o)/s,u+=(e*l-u)/s,i+=(t*n-i)/s,a+=(l*n-a)/s});const l=Ci(o/r,i/r,a/r,u/r),c=e=>l[0]*Math.exp(l[1]*e);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ti(e,t,n,r,c)}},Pi=function(e,t,n){let r=0,i=0,o=0,a=0,u=0,s=0;Ni(e,t,n,(e,t)=>{const n=Math.log(e),l=Math.log(t);++s,r+=(n-r)/s,i+=(l-i)/s,o+=(n*l-o)/s,a+=(n*n-a)/s,u+=(t-u)/s});const l=Ci(r,i,o,a),c=e=>l[0]*Math.pow(e,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ti(e,t,n,u,c)}},Ri=function(e,t,n){const[r,i,o,a]=Ai(e,t,n),u=r.length;let s,l,c,f,d=0,h=0,p=0,m=0,g=0;for(s=0;sb*(e-=o)*e+x*e+w+a;return{coef:[w-x*o+b*o*o+a,x-2*b*o,b],predict:_,rSquared:Ti(e,t,n,0,_)}},zi=function(e,t,n,r){if(1===r)return Di(e,t,n);if(2===r)return Ri(e,t,n);const[i,o,a,u]=Ai(e,t,n),s=i.length,l=[],c=[],f=r+1;let d,h,p,m,g;for(d=0;dMath.abs(e[r][a])&&(a=i);for(o=r;o=r;o--)e[o][i]-=e[o][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(u=0,o=i+1;o{e-=a;let t=u+v[0]+v[1]*e+v[2]*e*e;for(d=3;d=0;--o)for(u=t[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(n,a)*s;return i[0]+=r,i}var Ii=function(e,t){return Jr(e,.5,t)};var $i=function(e,t,n,r){const[i,o,a,u]=Ai(e,t,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),d=new Float64Array(s).fill(1);for(let e=-1;++e<=2;){const t=[0,l-1];for(let e=0;ei[a]-n?r:a;let s=0,l=0,h=0,p=0,m=0,g=1/Math.abs(i[u]-n||1);for(let e=r;e<=a;++e){const t=i[e],r=o[e],a=Bi(Math.abs(n-t)*g)*d[e],u=t*a;s+=a,l+=u,h+=r*a,p+=r*u,m+=t*u}const[v,y]=Ci(l/s,h/s,p/s,m/s);c[e]=v+y*n,f[e]=Math.abs(o[e]-c[e]),Ui(i,e+1,t)}if(2===e)break;const n=Ii(f);if(Math.abs(n)<1e-12)break;for(let e,t,r=0;r=1?1e-12:(t=1-e*e)*t}return function(e,t,n,r){const i=e.length,o=[];let a,u=0,s=0,l=[];for(;u=e.length))for(;t>i&&e[o]-r<=r-e[i];)n[0]=++i,n[1]=o,++o}const qi=.1*Math.PI/180;var Wi=function(e,t,n,r){n=n||25,r=Math.max(n,r||200);const i=t=>[t,e(t)],o=t[0],a=t[1],u=a-o,s=u/r,l=[i(o)],c=[];if(n===r){for(let e=1;e0;)c.push(i(o+e/n*u));let f=l[0],d=c[c.length-1];for(;d;){const e=i((f[0]+d[0])/2);e[0]-f[0]>=s&&Hi(f,e,d)>qi?c.push(e):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l};function Hi(e,t,n){const r=Math.atan2(n[1]-e[1],n[0]-e[0]),i=Math.atan2(t[1]-e[1],t[0]-e[0]);return Math.abs(r-i)}function Yi(e){this._key=e?Object(oe.t)(e):fe,this.reset()}var Vi=Yi.prototype;function Gi(e){Dr.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}Vi.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Vi.add=function(e){this._add.push(e)},Vi.rem=function(e){this._rem.push(e)},Vi.values=function(){if(this._get=null,0===this._rem.length)return this._add;var e,t,n,r=this._add,i=this._rem,o=this._key,a=r.length,u=i.length,s=Array(a-u),l={};for(e=0;e=0;)t=e(n[r])+"",Object(oe.v)(i,t)||(i[t]=1,++o);return o},Vi.extent=function(e){if(this._get!==e||!this._ext){var t=this.values(),n=Object(oe.q)(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Vi.argmin=function(e){return this.extent(e)[0]||{}},Vi.argmax=function(e){return this.extent(e)[1]||{}},Vi.min=function(e){var t=this.extent(e)[0];return null!=t?e(t):void 0},Vi.max=function(e){var t=this.extent(e)[1];return null!=t?e(t):void 0},Vi.quartile=function(e){return this._get===e&&this._q||(this._q=Zr(this.values(),e),this._get=e),this._q},Vi.q1=function(e){return this.quartile(e)[0]},Vi.q2=function(e){return this.quartile(e)[1]},Vi.q3=function(e){return this.quartile(e)[2]},Vi.ci=function(e){return this._get===e&&this._ci||(this._ci=ii(this.values(),1e3,.05,e),this._get=e),this._ci},Vi.ci0=function(e){return this.ci(e)[0]},Vi.ci1=function(e){return this.ci(e)[1]},Gi.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:$r},{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"}]};var Xi=Object(oe.y)(Gi,Dr);Xi.transform=function(e,t){var n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):{},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))),r.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),n.changes(r)},Xi.cross=function(){var e=this,t=e.value,n=e._dnames,r=n.map((function(){return{}})),i=n.length;function o(e){var t,o,a,u;for(t in e)for(a=e[t].tuple,o=0;ou?1/0:(t=Math.max(a,Math.min(+t,u-o)),a+o*Math.floor(1e-14+(t-a)/o))};return s.start=a,s.stop=i.stop,s.step=o,this.value=Object(oe.f)(s,Object(oe.g)(r),e.name||"bin_"+Object(oe.h)(r))};var Qi=function(e,t,n){var r=e,i=t||[],o=n||[],a={},u=0;return{add:function(e){o.push(e)},remove:function(e){a[r(e)]=++u},size:function(){return i.length},data:function(e,t){return u&&(i=i.filter((function(e){return!a[r(e)]})),a={},u=0),t&&e&&i.sort(e),o.length&&(i=e?Object(oe.L)(e,i,o.sort(e)):i.concat(o),o=[]),i}}};function Zi(e){Dr.call(this,[],e)}function eo(e){ke.call(this,null,to,e)}function to(e){return this.value&&!e.modified()?this.value:Object(oe.k)(e.fields,e.orders)}function no(e){Dr.call(this,null,e)}Zi.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Object(oe.y)(Zi,Dr).transform=function(e,t){var n=t.fork(t.ALL),r=Qi(fe,this.value,n.materialize(n.ADD).add),i=e.sort,o=t.changed()||i&&(e.modified("sort")||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(ve(i),o),t.source&&t.source.root&&(this.value.root=t.source.root),n},Object(oe.y)(eo,ke),no.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"]}]};var ro=Object(oe.y)(no,Dr);function io(e){Dr.call(this,null,e)}ro.transform=function(e,t){function n(t){return function(n){for(var r,i=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(u(n),e.case,o)||[],s=0,l=i.length;s{var t={};return t[u[0]]=e[0],t[u[1]]=e[1],he(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n};function fo(e){Dr.call(this,null,e)}function ho(e){ke.call(this,null,po,e),this.modified(!0)}function po(e){var t=e.expr;return this.value&&!e.modified("expr")?this.value:Object(oe.f)(n=>t(n,e),Object(oe.g)(t),Object(oe.h)(t))}function mo(e){Dr.call(this,[void 0,void 0],e)}function go(e,t){ke.call(this,e),this.parent=t}fo.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"}]},Object(oe.y)(fo,Dr).transform=function(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,r=co(t.source,e.groupby,oe.x),i=e.smooth||!1,o=e.field,a=e.step||function(e,t){return Object(oe.W)(Object(oe.p)(e,t))/30}(n,o),u=ve((e,t)=>o(e)-o(t)),s=e.as||"bin",l=r.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=t),e[++c][s]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(s)},Object(oe.y)(ho,ke),mo.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},Object(oe.y)(mo,Dr).transform=function(e,t){var n,r=this.value,i=e.field,o=r[0],a=r[1];if(((n=t.changed()||t.modified(i.fields)||e.modified("field"))||null==o)&&(o=1/0,a=-1/0),t.visit(n?t.SOURCE:t.ADD,(function(e){var t=i(e);null!=t&&((t=+t)a&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=Object(oe.h)(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]};var vo=Object(oe.y)(go,ke);function yo(e){Dr.call(this,{},e),this._keys=Object(oe.s)();var t=this._targets=[];t.active=0,t.forEach=function(e){for(var n=0,r=t.active;nn.cleanThreshold&&n.runAfter(a.clean),t},Object(oe.y)(xo,ke),_o.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},Object(oe.y)(_o,Dr).transform=function(e,t){var n=t.dataflow,r=this.value,i=t.fork(),o=i.add,a=i.rem,u=i.mod,s=e.expr,l=!0;function c(t){var n=fe(t),i=s(t,e),c=r.get(n);i&&c?(r.delete(n),o.push(t)):i||c?l&&i&&!c&&u.push(t):(r.set(n,1),a.push(t))}return t.visit(t.REM,(function(e){var t=fe(e);r.has(t)?r.delete(t):a.push(e)})),t.visit(t.ADD,(function(t){s(t,e)?o.push(t):r.set(fe(t),1)})),t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},Eo.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}]},Object(oe.y)(Eo,Dr).transform=function(e,t){var n=t.fork(t.NO_SOURCE),r=e.fields,i=lo(r,e.as||[]),o=e.index||null,a=i.length;return n.rem=this.value,t.visit(t.SOURCE,(function(e){for(var t,u,s,l=r.map(t=>t(e)),c=l.reduce((e,t)=>Math.max(e,t.length),0),f=0;ft[r]=n(t,e))},Object(oe.y)(jo,Dr).transform=function(e,t){var n,r,i,o=this.value,a=t.fork(t.ALL),u=e.size-o.length,s=e.generator;if(u>0){for(n=[];--u>=0;)n.push(i=he(s(e))),o.push(i);a.add=a.add.length?a.materialize(a.ADD).add.concat(n):n}else r=o.slice(0,-u),a.rem=a.rem.length?a.materialize(a.REM).rem.concat(r):r,o=o.slice(-u);return a.source=this.value=o,a};var So={value:"value",median:Ii,mean:function(e,t){let n=0,r=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let o of e)null!=(o=t(o,++i,e))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:Gr,max:Vr},Co=[];function Ao(e){Dr.call(this,[],e)}function No(e){Gi.call(this,e)}Ao.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}]},Object(oe.y)(Ao,Dr).transform=function(e,t){var n,r,i,o,a,u,s,l,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||So.value;if(null!=So[n])return n===So.value?(t=void 0!==e.value?e.value:0,function(){return t}):So[n];Object(oe.n)("Unrecognized imputation method: "+n)}(e),p=function(e){var t=e.field;return function(e){return e?t(e):NaN}}(e),m=Object(oe.h)(e.field),g=Object(oe.h)(e.key),v=(e.groupby||[]).map(oe.h),y=function(e,t,n,r){var i,o,a,u,s,l,c,f,d=function(e){return e(f)},h=[],p=r?r.slice():[],m={},g={};for(p.forEach((function(e,t){m[e]=t+1})),u=0,c=e.length;uo&&(o=r[1]);return[i,o]}function $o(e){ke.call(this,null,Bo,e)}function Bo(e){return this.value&&!e.modified()?this.value:e.values.reduce((function(e,t){return e.concat(t)}),[])}function Uo(e){Dr.call(this,null,e)}function qo(e){Gi.call(this,e)}To.transform=function(e,t){var n,r=this,i=e.modified();return r.value&&(i||t.modified(r._inputs,!0))?(n=r.value=i?r.init(e):{},t.visit(t.SOURCE,(function(e){r.add(e)}))):(n=r.value=r.value||this.init(e),t.visit(t.REM,(function(e){r.rem(e)})),t.visit(t.ADD,(function(e){r.add(e)}))),r.changes(),t.visit(t.SOURCE,(function(e){Object(oe.o)(e,n[r.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},To.changes=function(){var e,t,n=this._adds,r=this._mods;for(e=0,t=this._alen;e{const n=gi(t,a)[u],r=e.counts?t.length:1,i=c||Object(oe.p)(t);Wi(n,i,f,d).forEach(e=>{const n={};for(let e=0;e(this._pending=Object(oe.i)(e.data),e=>e.touch(this)))}}return n.request(e.url,e.format).then(e=>Ro(this,t,Object(oe.i)(e.data)))},zo.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}]},Object(oe.y)(zo,Dr).transform=function(e,t){var n,r,i=t,o=e.as,a=e.fields,u=e.index,s=e.values,l=null==e.default?null:e.default,c=e.modified(),f=c?t.SOURCE:t.ADD,d=a.length;return s?(r=s.length,d>1&&!o&&Object(oe.n)('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==d*r&&Object(oe.n)('The "as" parameter has too few output field names.'),o=o||s.map(oe.h),n=function(e){for(var t,n,i=0,c=0;it||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)})),t?i.slice(0,t):i}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:a.map((function(){return i})),fields:a.map((function(e){return function(e,t,n,r){return Object(oe.f)((function(r){return t(r)===e?n(r):NaN}),r,e+"")}(e,n,r,o)})),as:a.map((function(e){return e+""})),modified:e.modified.bind(e)}}(e,t),t)},Object(oe.y)(Ho,yo).transform=function(e,t){var n=this,r=e.subflow,i=e.field;return(e.modified("field")||i&&t.modified(Object(oe.g)(i)))&&Object(oe.n)("PreFacet does not support field modification."),this._targets.active=0,t.visit(t.MOD,(function(e){var o=n.subflow(fe(e),r,t,e);i?i(e).forEach((function(e){o.mod(e)})):o.mod(e)})),t.visit(t.ADD,(function(e){var o=n.subflow(fe(e),r,t,e);i?i(e).forEach((function(e){o.add(he(e))})):o.add(e)})),t.visit(t.REM,(function(e){var o=n.subflow(fe(e),r,t,e);i?i(e).forEach((function(e){o.rem(e)})):o.rem(e)})),t},Yo.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},Object(oe.y)(Yo,Dr).transform=function(e,t){var n,r,i=e.fields,o=lo(e.fields,e.as||[]),a=i?function(e,t){return function(e,t,n,r){for(var i=0,o=n.length;i{const t=Qr(e,s);for(let n=0;n{var t=fe(e);n.rem.push(r[t]),r[t]=null}),t.visit(t.ADD,e=>{var t=pe(e);r[fe(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{var t,i=r[fe(e)];for(t in e)i[t]=e[t],n.modifies(t);n.mod.push(i)})),n},Qo.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},Object(oe.y)(Qo,Dr).transform=function(e,t){var n=t.fork(t.NO_SOURCE),r=e.modified("size"),i=e.size,o=this.value,a=this.count,u=0,s=o.reduce((function(e,t){return e[fe(t)]=1,e}),{});function l(e){var t,r;o.length=u&&(t=o[r],s[fe(t)]&&n.rem.push(t),o[r]=e),++a}if(t.rem.length&&(t.visit(t.REM,(function(e){var t=fe(e);s[t]&&(s[t]=-1,n.rem.push(e)),--a})),o=o.filter((function(e){return-1!==s[fe(e)]}))),(t.rem.length||r)&&o.lengthi){for(var c=0,f=o.length-i;c(e[t]=1+n,e),{});function da(e){const t=Object(oe.i)(e).slice(),n={};return t.length||Object(oe.n)("Missing time unit."),t.forEach(e=>{Object(oe.v)(fa,e)?n[e]=1:Object(oe.n)(`Invalid time unit: ${e}.`)}),(n[ia]||n[aa])&&(n[na]||n[ra]||n[oa])&&Object(oe.n)(`Incompatible time units: ${e}`),t.sort((e,t)=>fa[e]-fa[t]),t}const ha=new Date;function pa(e,t,n,r){const i=t||1,o=Object(oe.T)(e),a=(e,t,r)=>function(e,t,n){return t<=1?e:n?(r,i)=>n+t*Math.floor((e(r,i)-n)/t):(n,r)=>t*Math.floor(e(n,r)/t)}(n[r||e],e===o&&i,t),u=new Date,s=Object(oe.cb)(e),l=s[ta]?a(ta):Object(oe.l)(2012),c=s[ra]?a(ra):s[na]?a(na):oe.jb,f=s[ia]&&s[aa]?a(aa,1,ia+aa):s[ia]?a(ia,1):s[aa]?a(aa,1):s[oa]?a(oa,1):oe.N,d=s[ua]?a(ua):oe.jb,h=s[sa]?a(sa):oe.jb,p=s[la]?a(la):oe.jb,m=s[ca]?a(ca):oe.jb;return function(e){u.setTime(+e);const t=l(u);return r(t,c(u),f(u,t),d(u),h(u),p(u),m(u))}}function ma(e,t,n){return t+7*e-(n+6)%7}const ga={[ta]:e=>e.getFullYear(),[na]:e=>3*~~(e.getMonth()/3),[ra]:e=>e.getMonth(),[oa]:e=>e.getDate(),[ua]:e=>e.getHours(),[sa]:e=>e.getMinutes(),[la]:e=>e.getSeconds(),[ca]:e=>e.getMilliseconds(),[aa]:(e,t)=>ma(1,e.getDay(),ba(t)),[ia]:(e,t)=>ma(ya(e),0,ba(t)),[ia+aa]:(e,t)=>ma(ya(e),e.getDay(),ba(t))};function va(e){return ha.setFullYear(e),ha.setMonth(0),ha.setDate(1),ha.setHours(0,0,0,0),ha}function ya(e){return Tt.count(va(e.getFullYear())-1,e)}function ba(e){return va(e).getDay()}function xa(e,t,n,r,i,o,a){if(0<=e&&e<100){var u=new Date(-1,t,n,r,i,o,a);return u.setFullYear(e),u}return new Date(e,t,n,r,i,o,a)}function wa(e,t){return pa(e,t||1,ga,xa)}const _a={[ta]:e=>e.getUTCFullYear(),[na]:e=>3*~~(e.getUTCMonth()/3),[ra]:e=>e.getUTCMonth(),[oa]:e=>e.getUTCDate(),[ua]:e=>e.getUTCHours(),[sa]:e=>e.getUTCMinutes(),[la]:e=>e.getUTCSeconds(),[ca]:e=>e.getUTCMilliseconds(),[aa]:(e,t)=>ma(1,e.getUTCDay(),Oa(t)),[ia]:(e,t)=>ma(Ea(e),0,Oa(t)),[ia+aa]:(e,t)=>ma(Ea(e),e.getUTCDay(),Oa(t))};function Ea(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return wt.count(t-1,e)}function Oa(e){return ha.setTime(Date.UTC(e,0,1)),ha.getUTCDay()}function ka(e,t,n,r,i,o,a){if(0<=e&&e<100){var u=new Date(Date.UTC(-1,t,n,r,i,o,a));return u.setUTCFullYear(n.y),u}return new Date(Date.UTC(e,t,n,r,i,o,a))}function ja(e,t){return pa(e,t||1,_a,ka)}var Sa=bt((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),Ca=Sa,Aa=(Sa.range,bt((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()}))),Na=Aa,Ta=(Aa.range,bt((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()}))),Da=Ta,Ma=(Ta.range,bt((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()}))),Fa=Ma,Pa=(Ma.range,bt((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e})));Pa.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?bt((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):Pa:null};var Ra=Pa,za=(Pa.range,bt((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()}))),La=za,Ia=(za.range,bt((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()}))),$a=Ia,Ba=(Ia.range,bt((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()}))),Ua=Ba;Ba.range;const qa={[ta]:Bt,[na]:Ca.every(3),[ra]:Ca,[ia]:Tt,[oa]:It,[aa]:It,[ua]:Na,[sa]:Da,[la]:Fa,[ca]:Ra},Wa={[ta]:qt,[na]:La.every(3),[ra]:La,[ia]:wt,[oa]:At,[aa]:At,[ua]:$a,[sa]:Ua,[la]:Fa,[ca]:Ra};function Ha(e){return qa[e]}function Ya(e){return Wa[e]}function Va(e,t,n){return e?e.offset(t,n):void 0}function Ga(e,t,n){return Va(Ha(e),t,n)}function Xa(e,t,n){return Va(Ya(e),t,n)}function Ka(e,t,n,r){return e?e.range(t,n,r):void 0}function Ja(e,t,n,r){return Ka(Ha(e),t,n,r)}function Qa(e,t,n,r){return Ka(Ya(e),t,n,r)}const Za={[ta]:"%Y ",[na]:"Q%q ",[ra]:"%b ",[oa]:"%d ",[ia]:"W%U ",[aa]:"%a ",[ua]:"%H:00",[sa]:"00:%M",[la]:":%S",[ca]:".%L",[`${ta}-${ra}`]:"%Y-%m ",[`${ta}-${ra}-${oa}`]:"%Y-%m-%d ",[`${ua}-${sa}`]:"%H:%M"};function eu(e,t){const n=Object(oe.o)({},Za,t),r=da(e),i=r.length;let o,a,u="",s=0;for(s=0;ss;--o)if(a=r.slice(s,o).join("-"),null!=n[a]){u+=n[a],s=o;break}return u.trim()}function tu(e){return ru(Gt,Ha,e)}function nu(e){return ru(Kt,Ya,e)}function ru(e,t,n){return Object(oe.H)(n)?e(n):function(e,t,n){n=n||{},Object(oe.F)(n)||Object(oe.n)(`Invalid time multi-format specifier: ${n}`);const r=t(la),i=t(sa),o=t(ua),a=t(oa),u=t(ia),s=t(ra),l=t(na),c=t(ta),f=e(n[ca]||".%L"),d=e(n[la]||":%S"),h=e(n[sa]||"%I:%M"),p=e(n[ua]||"%I %p"),m=e(n[oa]||n[aa]||"%a %d"),g=e(n[ia]||"%b %d"),v=e(n[ra]||"%B"),y=e(n[na]||"%B"),b=e(n[ta]||"%Y");return function(e){return(r(e)>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)>0?i=o:r=o+1}return r}}};var ou=Math.sqrt(50),au=Math.sqrt(10),uu=Math.sqrt(2),su=function(e,t,n){var r,i,o,a,u=-1;if(n=+n,(e=+e)===(t=+t)&&n>0)return[e];if((r=t0)for(e=Math.ceil(e/a),t=Math.floor(t/a),o=new Array(i=Math.ceil(t-e+1));++u=0?(o>=ou?10:o>=au?5:o>=uu?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ou?10:o>=au?5:o>=uu?2:1)}function cu(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=ou?i*=10:o>=au?i*=5:o>=uu&&(i*=2),te[2]).right(yu,r);return a===yu.length?(i=vu,o=cu(t[0]/31536e6,t[1]/31536e6,n)):a?(a=yu[r/yu[a-1][2]f&&(f=i))})),o.start=c,o.stop=f,t.modifies(r?u:s)},_u._floor=function(e,t){const n="utc"===e.timezone;let{units:r,step:i}=e.units?{units:e.units,step:e.step||1}:bu({extent:Object(oe.p)(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins});r=da(r);const o=this.value||{},a=(n?ja:wa)(r,i);return a.unit=Object(oe.T)(r),a.units=r,a.step=i,a.start=o.start,a.stop=o.stop,this.value=a},Object(oe.y)(Eu,Dr).transform=function(e,t){var n=t.dataflow,r=e.field,i=this.value,o=!0;function a(e){i.set(r(e),e)}return e.modified("field")||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,(function(e){i.delete(r(e))})),t.visit(t.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()},Object(oe.y)(Ou,Dr).transform=function(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(ve(e.sort)):t.source).map(e.field))};const ku={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){let e=ku.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=>{let n=t.index,r=t.data,i=t.compare;if(e0||Object(oe.n)("ntile num must be greater than zero.");let n=ku.cume_dist(),r=n.next;return{init:n.init,next:e=>Math.ceil(t*r(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let r=n.index+t,i=n.data;return re(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||Object(oe.n)("nth_value nth must be greater than zero."),{next:n=>{let r=n.i0+(t-1);return r{let r=e(n.data[n.index]);return null!=r?t=r:t}}},next_value:function(e){let t=null,n=-1;return{next:r=>{let i=r.data;return r.index<=n?t:(n=function(e,t,n){for(let r=t.length;ns[e]=1)}h(e.sort),n.forEach((function(e,t){let n=r[t],s=Object(oe.h)(n),p=Lr(e,s,o[t]);if(h(n),a.push(p),Object(oe.v)(ku,e))u.push(function(e,t,n,r){let i=ku[e](t,n);return{init:i.init||oe.jb,update:function(e,t){t[r]=i.next(e)}}}(e,r[t],i[t],p));else{if(null==n&&"count"!==e&&Object(oe.n)("Null aggregate field specified."),"count"===e)return void f.push(p);c=!1;let t=l[s];t||(t=l[s]=[],t.field=n,d.push(t)),t.push(Br(e,p))}})),(f.length||d.length)&&(t.cell=function(e,t,n){e=e.map(e=>Wr(e,e.field));let r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,o=r.agg=Array(i),a=0;ae.init()),this.cell&&this.cell.init()},Cu.update=function(e,t){let n,r=this.cell,i=this.windows,o=e.data,a=i&&i.length;if(r){for(n=e.p0;n0&&!i(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),rthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},$u.expand=function(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},$u.round=function(){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},$u.translate=function(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},$u.rotate=function(e,t,n){const r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},$u.rotatedPoints=function(e,t,n){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(e),s=Math.sin(e),l=t-t*u+n*s,c=n-t*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*a+l,s*r+u*a+c,u*o-s*i+l,s*o+u*i+c,u*o-s*a+l,s*o+u*a+c]},$u.union=function(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},$u.intersect=function(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},$u.alignsWith=function(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},$u.intersects=function(e){return e&&!(this.x2e.x2||this.y2e.y2)},$u.contains=function(e,t){return!(ethis.x2||tthis.y2)},$u.width=function(){return this.x2-this.x1},$u.height=function(){return this.y2-this.y1};var Bu=0;function Uu(e){return e&&e.gradient}function qu(e,t,n){let r=e.id,i=e.gradient,o="radial"===i?"p_":"";return r||(r=e.id="gradient_"+Bu++,"radial"===i?(e.x1=Wu(e.x1,.5),e.y1=Wu(e.y1,.5),e.r1=Wu(e.r1,0),e.x2=Wu(e.x2,.5),e.y2=Wu(e.y2,.5),e.r2=Wu(e.r2,.5),o="p_"):(e.x1=Wu(e.x1,0),e.y1=Wu(e.y1,0),e.x2=Wu(e.x2,1),e.y2=Wu(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Wu(e,t){return null!=e?e:t}var Hu=function(e,t){var n,r=[];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:r,stop:function(e,t){return r.push({offset:e,color:t}),n}}};function Yu(e){this.mark=e,this.bounds=this.bounds||new Iu}function Vu(e){Yu.call(this,e),this.items=this.items||[]}function Gu(e,t){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}function Xu(){return"undefined"!=typeof Image?Image:null}function Ku(e){this._pending=0,this._loader=e||dr()}Object(oe.y)(Vu,Yu);var Ju=Ku.prototype;function Qu(e){e._pending+=1}function Zu(e){e._pending-=1}function es(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function ts(e){this._context=e}Ju.pending=function(){return this._pending},Ju.sanitizeURL=function(e){var t=this;return Qu(t),t._loader.sanitize(e,{context:"href"}).then((function(e){return Zu(t),e})).catch((function(){return Zu(t),null}))},Ju.loadImage=function(e){var t=this,n=Xu();return Qu(t),t._loader.sanitize(e,{context:"image"}).then((function(e){var r=e.href;if(!r||!n)throw{url:r};var i=new n;return i.onload=function(){Zu(t)},i.onerror=function(){Zu(t)},i.src=r,i})).catch((function(e){return Zu(t),{complete:!1,width:0,height:0,src:e&&e.url||""}}))},Ju.ready=function(){var e=this;return new Promise((function(t){!function n(r){e.pending()?setTimeout((function(){n(!0)}),10):t(r)}(!1)}))},ts.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:es(this,this._x1,this._y1);case 2:this._context.lineTo(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;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:es(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var ns=function(){};function rs(e){this._context=e}rs.prototype={areaStart:ns,areaEnd:ns,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:es(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function is(e){this._context=e}is.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=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;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:es(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function os(e,t){this._basis=new ts(e),this._beta=t}os.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r,i=e[0],o=t[0],a=e[n]-i,u=t[n]-o,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(i+r*a),this._beta*t[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var as=function e(t){function n(e){return 1===t?new ts(e):new os(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function us(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 ss(e,t){this._context=e,this._k=(1-t)/6}ss.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:us(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:us(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}};var ls=function e(t){function n(e){return new ss(e,t)}return n.tension=function(t){return e(+t)},n}(0);function cs(e,t){this._context=e,this._k=(1-t)/6}cs.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:us(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}};var fs=function e(t){function n(e){return new cs(e,t)}return n.tension=function(t){return e(+t)},n}(0);function ds(e,t){this._context=e,this._k=(1-t)/6}ds.prototype={areaStart:ns,areaEnd:ns,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:us(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}};var hs=function e(t){function n(e){return new ds(e,t)}return n.tension=function(t){return e(+t)},n}(0),ps=Math.abs,ms=Math.atan2,gs=Math.cos,vs=Math.max,ys=Math.min,bs=Math.sin,xs=Math.sqrt,ws=Math.PI,_s=ws/2,Es=2*ws;function Os(e){return e>1?0:e<-1?ws:Math.acos(e)}function ks(e){return e>=1?_s:e<=-1?-_s:Math.asin(e)}function js(e,t,n){var r=e._x1,i=e._y1,o=e._x2,a=e._y2;if(e._l01_a>1e-12){var u=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,s=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*u-e._x0*e._l12_2a+e._x2*e._l01_2a)/s,i=(i*u-e._y0*e._l12_2a+e._y2*e._l01_2a)/s}if(e._l23_a>1e-12){var l=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*l+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*l+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(r,i,o,a,e._x2,e._y2)}function Ss(e,t){this._context=e,this._alpha=t}Ss.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,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:js(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}};var Cs=function e(t){function n(e){return t?new Ss(e,t):new ss(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function As(e,t){this._context=e,this._alpha=t}As.prototype={areaStart:ns,areaEnd:ns,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,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:js(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}};var Ns=function e(t){function n(e){return t?new As(e,t):new ds(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ts(e,t){this._context=e,this._alpha=t}Ts.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,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:js(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}};var Ds=function e(t){function n(e){return t?new Ts(e,t):new cs(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ms(e){this._context=e}Ms.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(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;default:this._context.lineTo(e,t)}}};var Fs=function(e){return new Ms(e)};function Ps(e){this._context=e}Ps.prototype={areaStart:ns,areaEnd:ns,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Rs(e){return e<0?-1:1}function zs(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),a=(n-e._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(Rs(o)+Rs(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function Ls(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Is(e,t,n){var r=e._x0,i=e._y0,o=e._x1,a=e._y1,u=(o-r)/3;e._context.bezierCurveTo(r+u,i+u*t,o-u,a-u*n,o,a)}function $s(e){this._context=e}function Bs(e){this._context=new Us(e)}function Us(e){this._context=e}function qs(e){this._context=e}function Ws(e){var t,n,r=e.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(a[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-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}};var Ys={basis:{curve:function(e){return new ts(e)}},"basis-closed":{curve:function(e){return new rs(e)}},"basis-open":{curve:function(e){return new is(e)}},bundle:{curve:as,tension:"beta",value:.85},cardinal:{curve:ls,tension:"tension",value:0},"cardinal-open":{curve:fs,tension:"tension",value:0},"cardinal-closed":{curve:hs,tension:"tension",value:0},"catmull-rom":{curve:Cs,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ns,tension:"alpha",value:.5},"catmull-rom-open":{curve:Ds,tension:"alpha",value:.5},linear:{curve:Fs},"linear-closed":{curve:function(e){return new Ps(e)}},monotone:{horizontal:function(e){return new Bs(e)},vertical:function(e){return new $s(e)}},natural:{curve:function(e){return new qs(e)}},step:{curve:function(e){return new Hs(e,.5)}},"step-after":{curve:function(e){return new Hs(e,1)}},"step-before":{curve:function(e){return new Hs(e,0)}}};function Vs(e,t,n){var r=Object(oe.v)(Ys,e)&&Ys[e],i=null;return r&&(i=r.curve||r[t||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var Gs={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},Xs=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/],Ks=function(e){var t,n,r,i,o,a,u,s,l,c,f,d=[];for(s=0,c=(t=e.slice().replace(Xs[0],"###$1").split(Xs[1]).slice(1)).length;su)for(l=1,f=i.length;l1&&(n*=m=Math.sqrt(m),r*=m);var g=d/n,v=f/n,y=-f/r,b=d/r,x=g*u+v*s,w=y*u+b*s,_=g*e+v*t,E=y*e+b*t,O=(_-x)*(_-x)+(E-w)*(E-w),k=1/O-.25;k<0&&(k=0);var j=Math.sqrt(k);o==i&&(j=-j);var S=.5*(x+_)-j*(E-w),C=.5*(w+E)+j*(_-x),A=Math.atan2(w-C,x-S),N=Math.atan2(E-C,_-S),T=N-A;T<0&&1===o?T+=Zs:T>0&&0===o&&(T-=Zs);for(var D=Math.ceil(Math.abs(T/(Qs+.001))),M=[],F=0;F1e-6)if(Math.abs(c*u-s*l)>1e-6&&i){var d=n-o,h=r-a,p=u*u+s*s,m=d*d+h*h,g=Math.sqrt(p),v=Math.sqrt(f),y=i*Math.tan((dl-Math.acos((p+f-m)/(2*g*v)))/2),b=y/v,x=y/g;Math.abs(b-1)>1e-6&&(this._+="L"+(e+b*l)+","+(t+b*c)),this._+="A"+i+","+i+",0,0,"+ +(c*d>l*h)+","+(this._x1=e+x*u)+","+(this._y1=t+x*s)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,r,i,o){e=+e,t=+t,o=!!o;var a=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=e+a,l=t+u,c=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%hl+hl),f>pl?this._+="A"+n+","+n+",0,1,"+c+","+(e-a)+","+(t-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=dl)+","+c+","+(this._x1=e+n*Math.cos(i))+","+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var vl=gl;const yl=.448084975506;function bl(e){return e.x}function xl(e){return e.y}function wl(e){return e.width}function _l(e){return e.height}function El(e){return"function"==typeof e?e:()=>+e}function Ol(e,t,n){return Math.max(t,Math.min(e,n))}var kl=function(){var e=bl,t=xl,n=wl,r=_l,i=El(0),o=i,a=i,u=i,s=null;function l(l,c,f){var d,h=null!=c?c:+e.call(this,l),p=null!=f?f:+t.call(this,l),m=+n.call(this,l),g=+r.call(this,l),v=Math.min(m,g)/2,y=Ol(+i.call(this,l),0,v),b=Ol(+o.call(this,l),0,v),x=Ol(+a.call(this,l),0,v),w=Ol(+u.call(this,l),0,v);if(s||(s=d=vl()),y<=0&&b<=0&&x<=0&&w<=0)s.rect(h,p,m,g);else{var _=h+m,E=p+g;s.moveTo(h+y,p),s.lineTo(_-b,p),s.bezierCurveTo(_-yl*b,p,_,p+yl*b,_,p+b),s.lineTo(_,E-w),s.bezierCurveTo(_,E-yl*w,_-yl*w,E,_-w,E),s.lineTo(h+x,E),s.bezierCurveTo(h+yl*x,E,h,E-yl*x,h,E-x),s.lineTo(h,p+y),s.bezierCurveTo(h,p+yl*y,h+yl*y,p,h+y,p),s.closePath()}if(d)return s=null,d+""||null}return l.x=function(t){return arguments.length?(e=El(t),l):e},l.y=function(e){return arguments.length?(t=El(e),l):t},l.width=function(e){return arguments.length?(n=El(e),l):n},l.height=function(e){return arguments.length?(r=El(e),l):r},l.cornerRadius=function(e,t,n,r){return arguments.length?(i=El(e),o=null!=t?El(t):i,u=null!=n?El(n):i,a=null!=r?El(r):o,l):i},l.context=function(e){return arguments.length?(s=null==e?null:e,l):s},l},jl=function(){var e,t,n,r,i,o,a,u,s=null;function l(e,t,n){var r=n/2;if(i){var l=a-t,c=e-o;if(l||c){var f=Math.sqrt(l*l+c*c),d=(l/=f)*u,h=(c/=f)*u,p=Math.atan2(c,l);s.moveTo(o-d,a-h),s.lineTo(e-l*r,t-c*r),s.arc(e,t,r,p-Math.PI,p),s.lineTo(o+d,a+h),s.arc(o,a,u,p,p+Math.PI)}else s.arc(e,t,r,0,Zs);s.closePath()}else i=1;o=e,a=t,u=r}function c(o){var a,u,c,f=o.length,d=!1;for(null==s&&(s=c=vl()),a=0;a<=f;++a)!(aN*N+T*T&&(O=j,k=S),{cx:O,cy:k,x01:-c,y01:-f,x11:O*(i/w-1),y11:k*(i/w-1)}}function Pl(e){return e[0]}function Rl(e){return e[1]}var zl=function(){var e=Pl,t=Rl,n=Sl(!0),r=null,i=Fs,o=null;function a(a){var u,s,l,c=a.length,f=!1;for(null==r&&(o=i(l=vl())),u=0;u<=c;++u)!(u=c;--f)u.point(g[f],v[f]);u.lineEnd(),u.areaEnd()}m&&(g[l]=+e(d,l,s),v[l]=+n(d,l,s),u.point(t?+t(d,l,s):g[l],r?+r(d,l,s):v[l]))}if(h)return u=null,h+""||null}function l(){return zl().defined(i).curve(a).context(o)}return s.x=function(n){return arguments.length?(e="function"==typeof n?n:Sl(+n),t=null,s):e},s.x0=function(t){return arguments.length?(e="function"==typeof t?t:Sl(+t),s):e},s.x1=function(e){return arguments.length?(t=null==e?null:"function"==typeof e?e:Sl(+e),s):t},s.y=function(e){return arguments.length?(n="function"==typeof e?e:Sl(+e),r=null,s):n},s.y0=function(e){return arguments.length?(n="function"==typeof e?e:Sl(+e),s):n},s.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:Sl(+e),s):r},s.lineX0=s.lineY0=function(){return l().x(e).y(n)},s.lineY1=function(){return l().x(e).y(r)},s.lineX1=function(){return l().x(t).y(n)},s.defined=function(e){return arguments.length?(i="function"==typeof e?e:Sl(!!e),s):i},s.curve=function(e){return arguments.length?(a=e,null!=o&&(u=a(o)),s):a},s.context=function(e){return arguments.length?(null==e?o=u=null:u=a(o=e),s):o},s},Il={draw:function(e,t){var n=Math.sqrt(t/ws);e.moveTo(n,0),e.arc(0,0,n,0,Es)}},$l=(Math.sqrt(1/3),Math.sin(ws/10)/Math.sin(7*ws/10));Math.sin(Es/10),Math.cos(Es/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12);function Bl(e,t){return null!=e?e:t}const Ul=e=>e.x||0,ql=e=>e.y||0,Wl=e=>!(!1===e.defined),Hl=function(){var e=Cl,t=Al,n=Sl(0),r=null,i=Nl,o=Tl,a=Dl,u=null;function s(){var s,l,c=+e.apply(this,arguments),f=+t.apply(this,arguments),d=i.apply(this,arguments)-_s,h=o.apply(this,arguments)-_s,p=ps(h-d),m=h>d;if(u||(u=s=vl()),f1e-12)if(p>Es-1e-12)u.moveTo(f*gs(d),f*bs(d)),u.arc(0,0,f,d,h,!m),c>1e-12&&(u.moveTo(c*gs(h),c*bs(h)),u.arc(0,0,c,h,d,m));else{var g,v,y=d,b=h,x=d,w=h,_=p,E=p,O=a.apply(this,arguments)/2,k=O>1e-12&&(r?+r.apply(this,arguments):xs(c*c+f*f)),j=ys(ps(f-c)/2,+n.apply(this,arguments)),S=j,C=j;if(k>1e-12){var A=ks(k/c*bs(O)),N=ks(k/f*bs(O));(_-=2*A)>1e-12?(x+=A*=m?1:-1,w-=A):(_=0,x=w=(d+h)/2),(E-=2*N)>1e-12?(y+=N*=m?1:-1,b-=N):(E=0,y=b=(d+h)/2)}var T=f*gs(y),D=f*bs(y),M=c*gs(w),F=c*bs(w);if(j>1e-12){var P,R=f*gs(b),z=f*bs(b),L=c*gs(x),I=c*bs(x);if(p1e-12?C>1e-12?(g=Fl(L,I,T,D,f,C,m),v=Fl(R,z,M,F,f,C,m),u.moveTo(g.cx+g.x01,g.cy+g.y01),C1e-12&&_>1e-12?S>1e-12?(g=Fl(M,F,R,z,c,-S,m),v=Fl(T,D,L,I,c,-S,m),u.lineTo(g.cx+g.x01,g.cy+g.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),Yl=Ll().x(Ul).y1(ql).y0(e=>(e.y||0)+(e.height||0)).defined(Wl),Vl=Ll().y(ql).x1(Ul).x0(e=>(e.x||0)+(e.width||0)).defined(Wl),Gl=zl().x(Ul).y(ql).defined(Wl),Xl=kl().x(Ul).y(ql).width(e=>e.width||0).height(e=>e.height||0).cornerRadius(e=>Bl(e.cornerRadiusTopLeft,e.cornerRadius)||0,e=>Bl(e.cornerRadiusTopRight,e.cornerRadius)||0,e=>Bl(e.cornerRadiusBottomRight,e.cornerRadius)||0,e=>Bl(e.cornerRadiusBottomLeft,e.cornerRadius)||0),Kl=function(){var e=Sl(Il),t=Sl(64),n=null;function r(){var r;if(n||(n=r=vl()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(t){return arguments.length?(e="function"==typeof t?t:Sl(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:Sl(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type(e=>cl(e.shape||"circle")).size(e=>Bl(e.size,64)),Jl=jl().x(Ul).y(ql).defined(Wl).size(e=>e.size||1);function Ql(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Zl(e,t,n,r){return Xl.context(e)(t,n,r)}var ec=function(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const r=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(r+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,r):0))}return e};var tc,nc,rc,ic=Zs-1e-8;function oc(e){return tc=e,oc}function ac(){}function uc(e,t){tc.add(e,t)}function sc(e,t){uc(nc=e,rc=t)}function lc(e){uc(e,tc.y1)}function cc(e){uc(tc.x1,e)}function fc(e,t,n,r){const i=(e-t)/(e+n-2*t);01e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),l=(-a+s)/o,c=(-a-s)/o)):l=.5*u/a,0ic)uc(e-n,t-n),uc(e+n,t+n);else{const a=r=>uc(n*Math.cos(r)+e,n*Math.sin(r)+t);let u,s;if(a(r),a(i),i!==r)if((r%=Zs)<0&&(r+=Zs),(i%=Zs)<0&&(i+=Zs),ii;++s,u-=Qs)a(u);else for(u=r-r%Qs+Qs,s=0;s<4&&ug)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(e.globalAlpha=n,e.fillStyle=_c(e,t,t.fill),!0)},Oc=[],kc=function(e,t,n){var r=null!=(r=t.strokeWidth)?r:1;return!(r<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=_c(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Oc),e.lineDashOffset=t.strokeDashOffset||0),!0))};function jc(e,t){return e.zindex-t.zindex||e.index-t.index}function Sc(e){if(!e.zdirty)return e.zitems;var t,n,r,i=e.items,o=[];for(n=0,r=i.length;n=0;)if(n=t(i[r]))return n;if(i===o)for(r=(i=e.items).length;--r>=0;)if(!i[r].zindex&&(n=t(i[r])))return n;return null}function Nc(e){return function(t,n,r){Cc(n,(function(n){r&&!r.intersects(n.bounds)||Tc(e,t,n,n)}))}}function Tc(e,t,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(e(t,r)||(n.fill&&Ec(t,n,i)&&t.fill(),n.stroke&&kc(t,n,i)&&t.stroke()))}function Dc(e){return e=e||oe.fb,function(t,n,r,i,o,a){return r*=t.pixelRatio,i*=t.pixelRatio,Ac(n,(function(n){var u=n.bounds;if((!u||u.contains(o,a))&&u)return e(t,n,r,i,o,a)?n:void 0}))}}function Mc(e,t){return function(n,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,l=null==t?s.fill:t,c=s.stroke&&n.isPointInStroke;return c&&(a=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=u?u:"butt"),!e(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function Fc(e){return Dc(Mc(e))}function Pc(e,t){return"translate("+e+","+t+")"}function Rc(e){return"rotate("+e+")"}function zc(e){return Pc(e.x||0,e.y||0)}function Lc(e){return Pc(e.x||0,e.y||0)+(e.angle?" "+Rc(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}var Ic=function(e,t,n){function r(e,n){var r=n.x||0,i=n.y||0,o=n.angle||0;e.translate(r,i),o&&e.rotate(o*=Js),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-r,-i)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",Lc(n)),e("d",t(null,n))},bound:function(e,n){var r=n.x||0,i=n.y||0;return t(oc(e),n),ec(e,n).translate(r,i),n.angle&&e.rotate(n.angle*Js,r,i),e},draw:Nc(r),pick:Fc(r),isect:n||gc(r)}},$c=Ic("arc",(function(e,t){return Hl.context(e)(t)}));var Bc=function(e,t,n){function r(e,n){e.beginPath(),t(e,n)}var i,o=Mc(r);return{type:e,tag:"path",nested:!0,attr:function(e,n){var r=n.mark.items;r.length&&e("d",t(null,r))},bound:function(e,n){var r=n.items;return 0===r.length?e:(t(oc(e),r),ec(e,r[0]))},draw:(i=r,function(e,t,n){!t.items.length||n&&!n.intersects(t.bounds)||Tc(i,e,t.items[0],t.items)}),pick:function(e,t,n,r,i,a){var u=t.items,s=t.bounds;return!u||!u.length||s&&!s.contains(i,a)?null:(n*=e.pixelRatio,r*=e.pixelRatio,o(e,u,n,r)?u[0]:null)},isect:vc,tip:n}},Uc=Bc("area",(function(e,t){var n=t[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Vl:Yl).curve(Vs(r,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,r,i="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,u=1/0;--a>=0;)!1!==e[a].defined&&(r=Math.abs(e[a][o]-i)).5&&t<1.5?.5-Math.abs(t-1):0}function Gc(e,t){var n=Vc(t);e("d",Zl(null,t,n,n))}function Xc(e,t,n,r){var i=Vc(t);e.beginPath(),Zl(e,t,(n||0)+i,(r||0)+i)}var Kc=Mc(Xc),Jc=Mc(Xc,!1);var Qc={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",zc(t))},bound:function(e,t){if(!t.clip&&t.items)for(var n=t.items,r=0,i=n.length;rm||og)))return e.save(),e.translate(h,p),h=i-h,p=o-p,y&&Ql(l)&&!Kc(e,l,u,s)?(e.restore(),null):(f=l.strokeForeground,(d=!1!==t.interactive)&&f&&l.stroke&&Jc(e,l,u,s)?(e.restore(),l):(!(c=Ac(l,(function(e){return function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,h,p)?a.pick(e,n,r,h,p):null})))&&d&&(l.fill||!f&&l.stroke)&&Kc(e,l,u,s)&&(c=l),e.restore(),c||null))}))},isect:yc,content:function(e,t,n){e("clip-path",t.clip?Yc(n,t,t):null)},background:function(e,t){e("class","background"),Gc(e,t)},foreground:function(e,t){e("class","foreground"),t.strokeForeground?Gc(e,t):e("d","")}};function Zc(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 ef(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 tf(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 nf(e,t){return"center"===e?t/2:"right"===e?t:0}function rf(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var of={type:"image",tag:"image",nested:!1,attr:function(e,t,n){var r=Zc(t,n),i=t.x||0,o=t.y||0,a=ef(t,r),u=tf(t,r),s=!1===t.aspect?"none":"xMidYMid";i-=nf(t.align,a),o-=rf(t.baseline,u),!r.src&&r.toDataURL?e("href",r.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):e("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),e("transform",Pc(i,o)),e("width",a),e("height",u),e("preserveAspectRatio",s)},bound:function(e,t){var n=t.image,r=t.x||0,i=t.y||0,o=ef(t,n),a=tf(t,n);return r-=nf(t.align,o),i-=rf(t.baseline,a),e.set(r,i,r+o,i+a)},draw:function(e,t,n){var r=this;Cc(t,(function(t){if(!n||n.intersects(t.bounds)){var i,o,a,u,s=Zc(t,r),l=t.x||0,c=t.y||0,f=ef(t,s),d=tf(t,s);l-=nf(t.align,f),c-=rf(t.baseline,d),!1!==t.aspect&&(o=s.width/s.height,a=t.width/t.height,o==o&&a==a&&o!==a&&(a=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(r=e[o].y-t[1])*r1?t:t[0]:t;var t}function kf(e){const t=Of(e);return(Object(oe.A)(t)?t.length-1:0)*Ef(e)}function jf(e,t){return null==t?"":e.limit>0?function(e,t){var n,r=+e.limit,i=t+"";gf.width===bf?(pc.font=Cf(e),n=xf):(df=wf(e),n=yf);if(n(i)>>1,n(i.slice(o))>r?s=o+1:l=o;return a+i.slice(s)}for(;s>>1),n(i.slice(0,o))Math.max(e,gf.width(t,n)),0)):r=gf.width(t,f),"center"===o?l-=r/2:"right"===o&&(l-=r),e.set(l+=u,c+=s,l+r,c+i),t.angle&&!n)e.rotate(t.angle*Js,u,s);else if(2===n)return e.rotatedPoints(t.angle*Js,u,s);return e}var Ff={arc:$c,area:Uc,group:Qc,image:of,line:af,path:sf,rect:cf,rule:hf,shape:pf,symbol:mf,text:{type:"text",tag:"text",nested:!1,attr:function(e,t){var n,r=t.dx||0,i=(t.dy||0)+Af(t),o=Df(t),a=o.x1,u=o.y1,s=t.angle||0;e("text-anchor",Nf[t.align]||"start"),s?(n=Pc(a,u)+" "+Rc(s),(r||i)&&(n+=" "+Pc(r,i))):n=Pc(a+r,u+i),e("transform",n)},bound:Mf,draw:function(e,t,n){Cc(t,(function(t){var r,i,o,a,u,s,l,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=Cf(t),e.textAlign=t.align||"left",i=(r=Df(t)).x1,o=r.y1,t.angle&&(e.save(),e.translate(i,o),e.rotate(t.angle*Js),i=o=0),i+=t.dx||0,o+=(t.dy||0)+Af(t),s=Of(t),Object(oe.A)(s))for(u=Ef(t),a=0;a=0;)if(!1!==e[i].defined&&(n=e[i].x-t[0])*n+(r=e[i].y-t[1])*r<(n=e[i].size||1)*n)return e[i];return null}))},Pf=function(e,t,n){var r=Ff[e.mark.marktype],i=t||r.bound;return r.nested&&(e=e.mark),i(e.bounds||(e.bounds=new Iu),e,n)},Rf={mark:null},zf=function(e,t,n){var r,i,o,a,u=Ff[e.marktype],s=u.bound,l=e.items,c=l&&l.length;if(u.nested)return c?o=l[0]:(Rf.mark=e,o=Rf),a=Pf(o,s,n),t=t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Iu,c)for(r=0,i=l.length;rt;)e.removeChild(n[--r]);return e}function Gf(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}Uf.toJSON=function(e){return If(this.root,e||0)},Uf.mark=function(e,t,n){var r=qf(e,t=t||this.root.items[0]);return t.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};var Xf=function(e,t){var n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]};function Kf(e,t){this._active=null,this._handlers={},this._loader=e||dr(),this._tooltip=t||Jf}function Jf(e,t,n,r){e.element().setAttribute("title",r||"")}var Qf=Kf.prototype;function Zf(e){this._el=null,this._bgcolor=null,this._loader=new Ku(e)}Qf.initialize=function(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},Qf.element=function(){return this._el},Qf.canvas=function(){return this._el&&this._el.firstChild},Qf.origin=function(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},Qf.scene=function(e){return arguments.length?(this._scene=e,this):this._scene},Qf.on=function(){},Qf.off=function(){},Qf._handlerIndex=function(e,t,n){for(var r=e?e.length:0;--r>=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1},Qf.handlers=function(e){var t,n=this._handlers,r=[];if(e)r.push.apply(r,n[this.eventName(e)]);else for(t in n)r.push.apply(r,n[t]);return r},Qf.eventName=function(e){var t=e.indexOf(".");return t<0?e:e.slice(0,t)},Qf.handleHref=function(e,t,n){this._loader.sanitize(n,{context:"href"}).then((function(t){var n=new MouseEvent(e.type,e),r=Wf(null,"a");for(var i in t)r.setAttribute(i,t[i]);r.dispatchEvent(n)})).catch((function(){}))},Qf.handleTooltip=function(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,r){var i,o,a=e&&e.mark;if(a&&(i=Ff[a.marktype]).tip){for((o=Xf(t,n))[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=i.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);var r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}},Qf.getItemBoundingClientRect=function(e){if(t=this.canvas()){for(var t,n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,o=i.x1+r[0]+n.left,a=i.y1+r[1]+n.top,u=i.width(),s=i.height();e.mark&&(e=e.mark.group);)o+=e.x||0,a+=e.y||0;return{x:o,y:a,width:u,height:s,left:o,top:a,right:o+u,bottom:a+s}}};var ed=Zf.prototype;ed.initialize=function(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)},ed.element=function(){return this._el},ed.canvas=function(){return this._el&&this._el.firstChild},ed.background=function(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},ed.resize=function(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this},ed.dirty=function(){},ed.render=function(e){var t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},ed._render=function(){},ed.renderAsync=function(e){var t=this.render(e);return this._ready?this._ready.then((function(){return t})):Promise.resolve(t)},ed._load=function(e,t){var n=this,r=n._loader[e](t);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(e){e&&i(),n._ready=null}))}return r},ed.sanitizeURL=function(e){return this._load("sanitizeURL",e)},ed.loadImage=function(e){return this._load("loadImage",e)};function td(e,t){Kf.call(this,e,t),this._down=null,this._touch=null,this._first=!0}var nd=Object(oe.y)(td,Kf);function rd(e,t,n){return function(r){var i=this._active,o=this.pickEvent(r);o===i?this.fire(e,r):(i&&i.exit||this.fire(n,r),this._active=o,this.fire(t,r),this.fire(e,r))}}function id(e){return function(t){this.fire(e,t),this._active=null}}nd.initialize=function(e,t,n){var r=this._canvas=e&&Hf(e,"canvas");if(r){var i=this;this.events.forEach((function(e){r.addEventListener(e,(function(t){nd[e]?nd[e].call(i,t):i.fire(e,t)}))}))}return Kf.prototype.initialize.call(this,e,t,n)},nd.canvas=function(){return this._canvas},nd.context=function(){return this._canvas.getContext("2d")},nd.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],nd.DOMMouseScroll=function(e){this.fire("mousewheel",e)},nd.mousemove=rd("mousemove","mouseover","mouseout"),nd.dragover=rd("dragover","dragenter","dragleave"),nd.mouseout=id("mouseout"),nd.dragleave=id("dragleave"),nd.mousedown=function(e){this._down=this._active,this.fire("mousedown",e)},nd.click=function(e){this._down===this._active&&(this.fire("click",e),this._down=null)},nd.touchstart=function(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",e,!0)},nd.touchmove=function(e){this.fire("touchmove",e,!0)},nd.touchend=function(e){this.fire("touchend",e,!0),this._touch=null},nd.fire=function(e,t,n){var r,i,o=n?this._touch:this._active,a=this._handlers[e];if(t.vegaType=e,"click"===e&&o&&o.href?this.handleHref(t,o,o.href):"mousemove"!==e&&"mouseout"!==e||this.handleTooltip(t,o,"mouseout"!==e),a)for(r=0,i=a.length;r=0&&r.splice(i,1),this},nd.pickEvent=function(e){var t=Xf(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},nd.pick=function(e,t,n,r,i){var o=this.context();return Ff[e.marktype].pick.call(this,o,e,t,n,r,i)};var od="undefined"!=typeof window&&window.devicePixelRatio||1;function ad(e){Zf.call(this,e),this._redraw=!1,this._dirty=new Iu}var ud=Object(oe.y)(ad,Zf),sd=Zf.prototype,ld=new Iu;function cd(e,t,n){return ld.set(0,0,t,n).translate(-e[0],-e[1])}function fd(e,t){Kf.call(this,e,t);var n=this;n._hrefHandler=hd(n,(function(e,t){t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=hd(n,(function(e,t){n.handleTooltip(e,t,"mouseout"!==e.type)}))}ud.initialize=function(e,t,n,r,i,o){return this._options=o,this._canvas=Gu(1,1,o&&o.type),e&&(Vf(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),sd.initialize.call(this,e,t,n,r,i)},ud.resize=function(e,t,n,r){return sd.resize.call(this,e,t,n,r),function(e,t,n,r,i,o){var a,u="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=u?od:i;for(a in e.width=t*l,e.height=n*l,o)s[a]=o[a];u&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*r[0],l*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},ud.canvas=function(){return this._canvas},ud.context=function(){return this._canvas?this._canvas.getContext("2d"):null},ud.dirty=function(e){var t=function(e,t){if(null==t)return e;for(var n=ld.clear().union(e);null!=t;t=t.mark.group)n.translate(t.x||0,t.y||0);return n}(e.bounds,e.mark.group);this._dirty.union(t)},ud._render=function(e){var t=this.context(),n=this._origin,r=this._width,i=this._height,o=this._dirty;return t.save(),this._redraw||o.empty()?(this._redraw=!1,o=cd(n,r,i).expand(1)):o=function(e,t,n){return t.expand(1).round(),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,o.intersect(cd(n,r,i)),n),this.clear(-n[0],-n[1],r,i),this.draw(t,e,o),t.restore(),this._dirty.clear(),this},ud.draw=function(e,t,n){var r=Ff[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Object(oe.D)(n)?(e.beginPath(),n(e),e.clip()):qc(e,t.group)}(e,t),r.draw.call(this,e,t,n),t.clip&&e.restore()},ud.clear=function(e,t,n,r){var i=this.context();i.clearRect(e,t,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(e,t,n,r))};var dd=Object(oe.y)(fd,Kf);function hd(e,t){return function(n){var r=n.target.__data__;n.vegaType=n.type,r=Array.isArray(r)?r[0]:r,t.call(e._obj,n,r)}}function pd(e,t,n){var r,i,o="<"+e;if(t)for(r in t)null!=(i=t[r])&&(o+=" "+r+'="'+i+'"');return n&&(o+=" "+n),o+">"}function md(e){return""}dd.initialize=function(e,t,n){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener("mouseout",this._tooltipHandler)),this._svg=r=e&&Hf(e,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener("mouseout",this._tooltipHandler)),Kf.prototype.initialize.call(this,e,t,n)},dd.canvas=function(){return this._svg},dd.on=function(e,t){var n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){var i={type:e,handler:t,listener:hd(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},dd.off=function(e,t){var n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var gd={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},vd={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},yd=Object.keys(vd),bd=gd.xmlns;function xd(e){Zf.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var wd=Object(oe.y)(xd,Zf),_d=Zf.prototype;function Ed(e,t,n){var r,i,o;if("radial"===t.gradient){var a=Yf(e,n++,"pattern",bd);a.setAttribute("id","p_"+t.id),a.setAttribute("viewBox","0,0,1,1"),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("preserveAspectRatio","xMidYMid slice"),(a=Yf(a,0,"rect",bd)).setAttribute("width","1"),a.setAttribute("height","1"),a.setAttribute("fill","url("+Dd()+"#"+t.id+")"),(e=Yf(e,n++,"radialGradient",bd)).setAttribute("id",t.id),e.setAttribute("fx",t.x1),e.setAttribute("fy",t.y1),e.setAttribute("fr",t.r1),e.setAttribute("cx",t.x2),e.setAttribute("cy",t.y2),e.setAttribute("r",t.r2)}else(e=Yf(e,n++,"linearGradient",bd)).setAttribute("id",t.id),e.setAttribute("x1",t.x1),e.setAttribute("x2",t.x2),e.setAttribute("y1",t.y1),e.setAttribute("y2",t.y2);for(r=0,i=t.stops.length;r1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}wd.initialize=function(e,t,n,r){return e&&(this._svg=Yf(e,0,"svg",bd),this._svg.setAttribute("class","marks"),Vf(e,1),this._root=Yf(this._svg,0,"g",bd),Vf(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),_d.initialize.call(this,e,t,n,r)},wd.background=function(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),_d.background.apply(this,arguments)},wd.resize=function(e,t,n,r){return _d.resize.call(this,e,t,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},wd.canvas=function(){return this._svg},wd.svg=function(){if(!this._svg)return null;var e={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var t in gd)e[t]=gd[t];var n=this._bgcolor?pd("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+md("rect"):"";return pd("svg",e)+n+this._svg.innerHTML+md("svg")},wd._render=function(e){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,e),Vf(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},wd.updateDefs=function(){var e,t=this._svg,n=this._defs,r=n.el,i=0;for(e in n.gradient)r||(n.el=r=Yf(t,0,"defs",bd)),i=Ed(r,n.gradient[e],i);for(e in n.clipping)r||(n.el=r=Yf(t,0,"defs",bd)),i=Od(r,n.clipping[e],i);r&&(0===i?(t.removeChild(r),n.el=null):Vf(r,i))},wd._resetDefs=function(){var e=this._defs;e.gradient={},e.clipping={}},wd.dirty=function(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},wd.isDirty=function(e){return this._dirtyAll||!e._svg||e.dirty===this._dirtyID},wd._dirtyCheck=function(){this._dirtyAll=!0;var e=this._dirty;if(!e.length||!this._dirtyID)return!0;var t,n,r,i,o,a,u,s=++this._dirtyID;for(o=0,a=e.length;ojf(n,e))).join("\n"))!==Cd.text&&(Vf(t,0),o=t.ownerDocument,a=Ef(n),i.forEach((e,r)=>{const i=Wf(o,"tspan",bd);i.__data__=n,i.textContent=e,r&&(i.setAttribute("x",0),i.setAttribute("dy",a)),t.appendChild(i)}),Cd.text=r):(i=jf(n,u))!==Cd.text&&(t.textContent=i,Cd.text=i),Nd(t,"font-family",Sf(n)),Nd(t,"font-size",wf(n)+"px"),Nd(t,"font-style",n.fontStyle),Nd(t,"font-variant",n.fontVariant),Nd(t,"font-weight",n.fontWeight)}};function Nd(e,t,n){n!==Cd[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Cd[t]=n)}function Td(e,t,n){t!==Cd[e]&&(null!=t?n?Sd.setAttributeNS(n,e,t):Sd.setAttribute(e,t):n?Sd.removeAttributeNS(n,e):Sd.removeAttribute(e),Cd[e]=t)}function Dd(){var e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function Md(e){Zf.call(this,e),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}wd._update=function(e,t,n){Sd=t,Cd=t.__values__,e.attr(Td,n,this);var r=Ad[e.type];r&&r.call(this,e,t,n),Sd&&this.style(Sd,n)},wd.style=function(e,t){var n,r,i,o,a;if(null!=t)for(n=0,r=yd.length;n/g,">")}Pd.resize=function(e,t,n,r){Rd.resize.call(this,e,t,n,r);var i=this._origin,o=this._text,a={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var u in gd)a[u]=gd[u];o.head=pd("svg",a);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),o.bg=s?pd("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+md("rect"):"",o.root=pd("g",{transform:"translate("+i+")"}),o.foot=md("g")+md("svg"),this},Pd.background=function(){var e=Rd.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),e},Pd.svg=function(){var e=this._text;return e.head+e.bg+e.defs+e.root+e.body+e.foot},Pd._render=function(e){return this._text.body=this.mark(e),this._text.defs=this.buildDefs(),this},Pd.buildDefs=function(){var e,t,n,r,i,o=this._defs,a="";for(t in o.gradient){for(i=(n=o.gradient[t]).stops,"radial"===n.gradient?(a+=pd(r="pattern",{id:"p_"+t,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),a+=pd("rect",{width:"1",height:"1",fill:"url(#"+t+")"})+md("rect"),a+=md(r),a+=pd(r="radialGradient",{id:t,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):a+=pd(r="linearGradient",{id:t,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),e=0;e0?pd("defs")+a+md("defs"):""},Pd.attributes=function(e,t){return Fd={},e(zd,t,this),Fd},Pd.href=function(e){var t,n=this,r=e.href;if(r){if(t=n._hrefs&&n._hrefs[r])return t;n.sanitizeURL(r).then((function(e){e["xlink:href"]=e.href,e.href=null,(n._hrefs||(n._hrefs={}))[r]=e}))}return null},Pd.mark=function(e){var t,n=this,r=Ff[e.marktype],i=r.tag,o=this._defs,a="";function u(u){var s=n.href(u);if(s&&(a+=pd("a",s)),t="g"!==i?Ld(u,e,i,o):null,a+=pd(i,n.attributes(r.attr,u),t),"text"===i){const e=Of(u);if(Object(oe.A)(e)){const t={x:0,dy:Ef(u)};for(let n=0;n1?(Bd[e]=t,this):Bd[e]}function qd(e,t,n){const r=[],i=(new Iu).union(t),o=e.marktype;return o?Wd(e,i,n,r):"group"===o?Hd(e,i,n,r):Object(oe.n)("Intersect scene must be mark node or group item.")}function Wd(e,t,n,r){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 i=e.items,o=e.marktype,a=i.length;let u=0;if("group"===o)for(;u=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!Xd(e[n],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function Kd(e,t){return Xd(Ks(e),Ks(t))}function Jd(e){Dr.call(this,null,e)}function Qd(e,t,n){return t(e.bounds.clear(),e,n)}Object(oe.y)(Jd,Dr).transform=function(e,t){var n,r=t.dataflow,i=e.mark,o=i.marktype,a=Ff[o],u=a.bound,s=i.bounds;if(a.nested)i.items.length&&r.dirty(i.items[0]),s=Qd(i,u),i.items.forEach((function(e){e.bounds.clear().union(s)}));else if("group"===o||e.modified())switch(t.visit(t.MOD,(function(e){r.dirty(e)})),s.clear(),i.items.forEach((function(e){s.union(Qd(e,u))})),i.role){case"axis":case"legend":case"title":t.reflow()}else n=t.changed(t.REM),t.visit(t.ADD,(function(e){s.union(Qd(e,u))})),t.visit(t.MOD,(function(e){n=n||s.alignsWith(e.bounds),r.dirty(e),s.union(Qd(e,u))})),n&&(s.clear(),i.items.forEach((function(e){s.union(e.bounds)})));return Gd(i),t.modifies("bounds")};function Zd(e){Dr.call(this,0,e)}function eh(e){Dr.call(this,null,e)}function th(e){Dr.call(this,null,e)}Zd.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Object(oe.y)(Zd,Dr).transform=function(e,t){var n=function(e){var t=e._signals[":vega_identifier:"];t||(e._signals[":vega_identifier:"]=t=e.add(0));return t}(t.dataflow),r=n.value,i=e.as;return t.visit(t.ADD,(function(e){e[i]||(e[i]=++r)})),n.set(this.value=r),t},Object(oe.y)(eh,Dr).transform=function(e,t){var n=this.value;n||((n=t.dataflow.scenegraph().mark(e.markdef,function(e){var 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)).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);var r="group"===n.marktype?Vu:Yu;return t.visit(t.ADD,(function(e){r.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};var nh=Object(oe.y)(th,Dr),rh={parity:function(e){return e.filter((e,t)=>t%2?e.opacity=0:1)},greedy:function(e,t){var n;return e.filter((e,r)=>r&&ih(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1))}};function ih(e,t,n){return n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2)}function oh(e,t){for(var n,r=1,i=e.length,o=e[0].bounds;r1&&t.height()>1}function uh(e){return e.forEach(e=>e.opacity=1),e}function sh(e,t){return e.reflow(t.modified()).modifies("opacity")}function lh(e){Dr.call(this,null,e)}nh.transform=function(e,t){var n,r,i,o=rh[e.method]||rh.parity,a=t.materialize(t.SOURCE).source,u=e.separation||0;if(a&&a.length){if(!e.method)return e.modified("method")&&(uh(a),t=sh(t,e)),t;if(e.sort&&(a=a.slice().sort(e.sort)),n=uh(a=a.filter(ah)),t=sh(t,e),n.length>=3&&oh(n,u)){do{n=o(n,u)}while(n.length>=3&&oh(n,u));n.length<3&&!Object(oe.T)(a).opacity&&(n.length>1&&(Object(oe.T)(n).opacity=0),Object(oe.T)(a).opacity=1)}var s,l,c,f,d;return e.boundScale&&e.boundTolerance>=0&&(s=e.boundScale,l=e.boundOrient,c=+e.boundTolerance,f=s.range(),d=new Iu,l===Fu||"bottom"===l?d.set(f[0],-1/0,f[1],1/0):d.set(-1/0,f[0],1/0,f[1]),d.expand(c||1),r=e=>d.encloses(e.bounds),a.forEach(e=>{r(e)||(e.opacity=0)})),i=n[0].mark.bounds.clear(),a.forEach(e=>{e.opacity&&i.union(e.bounds)}),t}},Object(oe.y)(lh,Dr).transform=function(e,t){var n=t.dataflow;if(t.visit(t.ALL,(function(e){n.dirty(e)})),t.fields&&t.fields.zindex){var r=t.source&&t.source[0];r&&(r.mark.zdirty=!0)}};const ch=new Iu;function fh(e,t,n){return e[t]===n?0:(e[t]=n,1)}function dh(e){var t=e.items[0].datum.orient;return t===Pu||t===Ru}function hh(e,t,n,r){var i,o,a=t.items[0],u=a.datum,s=u.orient,l=null!=u.translate?u.translate:.5,c=function(e){var t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(u),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=u.title&&a.items[c[2]].items[0],v=a.titlePadding,y=a.bounds,b=g&&kf(g),x=0,w=0;switch(ch.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(a.items[i].bounds),(i=c[1])>-1&&y.union(a.items[i].bounds),s){case Fu:x=h||0,w=-d,o=Math.max(p,Math.min(m,-y.y1)),g&&(o=ph(e,g,o,v,b,0,-1,y)),y.add(0,-o).add(f,0);break;case Pu:x=-d,w=h||0,o=Math.max(p,Math.min(m,-y.x1)),g&&(o=ph(e,g,o,v,b,1,-1,y)),y.add(-o,0).add(0,f);break;case Ru:x=n+d,w=h||0,o=Math.max(p,Math.min(m,y.x2)),g&&(o=ph(e,g,o,v,b,1,1,y)),y.add(0,0).add(o,f);break;case"bottom":x=h||0,w=r+d,o=Math.max(p,Math.min(m,y.y2)),g&&(o=ph(e,g,o,v,0,0,1,y)),y.add(0,0).add(f,o);break;default:x=a.x,w=a.y}return ec(y.translate(x,w),a),fh(a,"x",x+l)|fh(a,"y",w+l)&&(a.bounds=ch,e.dirty(a),a.bounds=y,e.dirty(a)),a.mark.bounds.clear().union(y)}function ph(e,t,n,r,i,o,a,u){var s=t.bounds,l=0,c=0;return t.auto?(e.dirty(t),n+=r,o?l=(t.x||0)-(t.x=a*(n+i)):c=(t.y||0)-(t.y=a*(n+i)),t.mark.bounds.clear().union(s.translate(-l,-c)),e.dirty(t),o?(u.add(0,s.y1).add(0,s.y2),n+=s.width()):(u.add(s.x1,0).add(s.x2,0),n+=s.height())):u.union(s),n}function mh(e){return(new Iu).set(0,0,e.width||0,e.height||0)}function gh(e){var t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function vh(e,t,n){var r=Object(oe.F)(e)?e[t]:e;return null!=r?r:void 0!==n?n:0}function yh(e){return e<0?Math.ceil(-e):0}function bh(e,t,n){var r,i,o,a,u,s,l,c,f,d,h,p=!n.nodirty,m="flush"===n.bounds?mh:gh,g=ch.set(0,0,0,0),v=vh(n.align,"column"),y=vh(n.align,Lu),b=vh(n.padding,"column"),x=vh(n.padding,Lu),w=n.columns||t.length,_=w<0?1:Math.ceil(t.length/w),E=t.length,O=Array(E),k=Array(w),j=0,S=Array(E),C=Array(_),A=0,N=Array(E),T=Array(E),D=Array(E);for(i=0;i1)for(i=0;i0&&(N[i]+=f/2);if(y&&vh(n.center,Lu)&&1!==w)for(i=0;i0&&(T[i]+=d/2);for(i=0;ii&&(e.warn("Grid headers exceed limit: "+i),t=t.slice(0,i)),O+=o,m=0,v=t.length;m=0&&null==(x=n[g]);g-=d);u?(w=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),_=O):(w=O,_=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),y.union(b.bounds.translate(w-(b.x||0),_-(b.y||0))),b.x=w,b.y=_,e.dirty(b),k=a(k,y[l])}return k}function kh(e,t,n,r,i,o){if(t){e.dirty(t);var a=n,u=n;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),t.bounds.translate(a-(t.x||0),u-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=u,e.dirty(t)}}function jh(e,t,n,r,i,o,a){const u=function(e,t){const n=e[t]||{};return(t,r)=>null!=n[t]?n[t]:null!=e[t]?e[t]:r}(n,t),s=(f=e,d=u("offset",0),h=-1/0,f.forEach(e=>{null!=e.offset&&(h=Math.max(h,e.offset))}),h>-1/0?h:d),l=u("anchor","start"),c=l===zu?1:"middle"===l?.5:0;var f,d,h;const p={align:"each",bounds:u("bounds","flush"),columns:"vertical"===u("direction")?1:e.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(t){case Pu:p.anchor={x:Math.floor(r.x1)-s,column:zu,y:c*(a||r.height()+2*r.y1),row:l};break;case Ru:p.anchor={x:Math.ceil(r.x2)+s,y:c*(a||r.height()+2*r.y1),row:l};break;case Fu:p.anchor={y:Math.floor(i.y1)-s,row:zu,x:c*(o||i.width()+2*i.x1),column:l};break;case"bottom":p.anchor={y:Math.ceil(i.y2)+s,x:c*(o||i.width()+2*i.x1),column:l};break;case"top-left":p.anchor={x:s,y:s};break;case"top-right":p.anchor={x:o-s,y:s,column:zu};break;case"bottom-left":p.anchor={x:s,y:a-s,row:zu};break;case"bottom-right":p.anchor={x:o-s,y:a-s,column:zu,row:zu}}return p}function Sh(e,t){var n,r,i,o,a=t.items[0],u=a.datum,s=a.orient,l=a.bounds,c=a.x,f=a.y;return a._bounds?a._bounds.clear().union(l):a._bounds=l.clone(),l.clear(),function(e,t,n){var r=t.padding,i=r-n.x,o=r-n.y;if(t.datum.title){var a=t.items[1].items[0],u=a.anchor,s=t.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case Pu:i+=Math.ceil(a.bounds.width())+s;break;case Ru:case"bottom":break;default:o+=a.bounds.height()+s}switch((i||o)&&Ah(e,n,i,o),a.orient){case Pu:c+=Ch(t,n,a,u,1,1);break;case Ru:l+=Ch(t,n,a,zu,0,0)+s,c+=Ch(t,n,a,u,1,1);break;case"bottom":l+=Ch(t,n,a,u,0,0),c+=Ch(t,n,a,zu,-1,0,1)+s;break;default:l+=Ch(t,n,a,u,0,0)}(l||c)&&Ah(e,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(Ah(e,n,-l,0),Ah(e,a,-l,0))}else(i||o)&&Ah(e,n,i,o)}(e,a,a.items[0].items[0]),l=function(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.x1=e.padding,t.y1=e.padding,t}(a,l),n=2*a.padding,r=2*a.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===u.type&&(i=a.items[0].items[0].items[0].items,o=i.reduce((function(e,t){return e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e}),{}),i.forEach((function(e){e.width=o[e.column],e.height=e.bounds.y2-e.y}))),"none"!==s&&(a.x=c=0,a.y=f=0),a.width=n,a.height=r,ec(l.set(c,f,c+n,f+r),a),a.mark.bounds.clear().union(l),a}function Ch(e,t,n,r,i,o,a){const u="symbol"!==e.datum.type,s=n.datum.vgrad,l=(!u||!o&&s||a?t:t.items[0]).bounds[i?"y2":"x2"]-e.padding,c=s&&o?l:0,f=s&&o?0:l,d=i<=0?0:kf(n);return Math.round("start"===r?c:r===zu?f-d:.5*(l-d))}function Ah(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function Nh(e){Dr.call(this,null,e)}Object(oe.y)(Nh,Dr).transform=function(e,t){var n=t.dataflow;return e.mark.items.forEach((function(t){e.layout&&function(e,t,n){var r,i,o,a,u,s,l,c=function(e){for(var t,n,r=e.items,i=r.length,o=0,a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};o{"none"!==(o=e.orient||Ru)&&(t[o]||(t[o]=[])).push(e)});for(let r in t){const i=t[r];bh(e,i,jh(i,r,n.legends,d,h,l,c))}p.forEach(t=>{const r=t.bounds;if(r.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=r,e.dirty(t)),n.autosize&&"fit"===n.autosize.type)switch(t.orient){case Pu:case Ru:f.add(r.x1,0).add(r.x2,0);break;case Fu:case"bottom":f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(d).union(h),r&&f.union(function(e,t,n,r,i){var o,a=t.items[0],u=a.frame,s=a.orient,l=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=s===Pu||s===Ru?r:n,m=0,g=0,v=0,y=0,b=0;if("group"!==u?s===Pu?(m=i.y2,p=i.y1):s===Ru?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2):s===Pu&&(m=r,p=0),o="start"===l?m:l===zu?p:(m+p)/2,h&&h.text){switch(s){case Fu:case"bottom":b=d.bounds.height()+f;break;case Pu:y=d.bounds.width()+f;break;case Ru:y=-d.bounds.width()-f}ch.clear().union(h.bounds),ch.translate(y-(h.x||0),b-(h.y||0)),fh(h,"x",y)|fh(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(ch),h.mark.bounds.clear().union(ch),e.dirty(h)),ch.clear().union(h.bounds)}else ch.clear();switch(ch.union(d.bounds),s){case Fu:g=o,v=i.y1-ch.height()-c;break;case Pu:g=i.x1-ch.width()-c,v=o;break;case Ru:g=i.x2+ch.width()+c,v=o;break;case"bottom":g=o,v=i.y2+c;break;default:g=a.x,v=a.y}return fh(a,"x",g)|fh(a,"y",v)&&(ch.translate(g,v),e.dirty(a),a.bounds.clear().union(ch),t.bounds.clear().union(ch),e.dirty(a)),a.bounds}(e,r,l,c,f));t.clip&&f.set(0,0,t.width||0,t.height||0);!function(e,t,n,r){var i=r.autosize||{},o=i.type,a=e._width,u=e._height,s=e.padding();if(e._autosize<1||!o)return;var l=Math.max(0,t.width||0),c=Math.max(0,Math.ceil(-n.x1)),f=Math.max(0,Math.ceil(n.x2-l)),d=Math.max(0,t.height||0),h=Math.max(0,Math.ceil(-n.y1)),p=Math.max(0,Math.ceil(n.y2-d));"padding"===i.contains&&(a-=s.left+s.right,u-=s.top+s.bottom);"none"===o?(c=0,h=0,l=a,d=u):"fit"===o?(l=Math.max(0,a-c-f),d=Math.max(0,u-h-p)):"fit-x"===o?(l=Math.max(0,a-c-f),u=d+h+p):"fit-y"===o?(a=l+c+f,d=Math.max(0,u-h-p)):"pad"===o&&(a=l+c+f,u=d+h+p);e._resizeView(a,u,l,d,[c,h],i.resize)}(e,t,f,n)}(n,t,e)})),e.modified()&&t.reflow(),t};var Th=function(e,t,n){var r=e-t+2*n;return e?r>0?r:1:0};const Dh="log",Mh="utc",Fh="continuous";var Ph=iu(Yr),Rh=Ph.right,zh=Ph.left,Lh=Rh;function Ih(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function $h(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}const Bh=Symbol("implicit");function Uh(){var e=new Map,t=[],n=[],r=Bh;function i(i){var o=i+"",a=e.get(o);if(!a){if(r!==Bh)return r;e.set(o,a=t.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Map;for(const r of n){const n=r+"";e.has(n)||e.set(n,t.push(r))}return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Uh(t,n).unknown(r)},Ih.apply(i,arguments),i}function qh(){var e,t,n=Uh().unknown(void 0),r=n.domain,i=n.range,o=[0,1],a=!1,u=0,s=0,l=.5;function c(){var n=r().length,c=o[1]o[1-c])))return n=Math.max(0,Rh(f,s)-1),a=s===l?n:Rh(f,l)-1,s-f[n]>t+1e-10&&++n,c&&(u=n,n=d-a,a=d-u),n>a?void 0:r().slice(n,a+1)}},n.invert=function(e){var t=n.invertRange([e,e]);return t?t[0]:t},n.copy=function(){return qh().domain(r()).range(o).round(a).paddingInner(u).paddingOuter(s).align(l)},c()}var Wh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Hh(e){if(!(t=Wh.exec(e)))throw new Error("invalid format: "+e);var t;return new Yh({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 Yh(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+""}Hh.prototype=Yh.prototype,Yh.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};var Vh,Gh,Xh,Kh,Jh=function(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]},Qh=function(e){return(e=Jh(Math.abs(e)))?e[1]:NaN},Zh=function(e,t){var n=Jh(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},ep={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return Zh(100*e,t)},r:Zh,s:function(e,t){var n=Jh(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Vh=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Jh(e,Math.max(0,t+o-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},tp=function(e){return e},np=Array.prototype.map,rp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],ip=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?tp:(t=np.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,o=[],a=0,u=t[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(e.substring(i-=u,i+u)),!((s+=u+1)>r));)u=t[a=(a+1)%t.length];return o.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",u=void 0===e.numerals?tp:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(np.call(e.numerals,String)),s=void 0===e.percent?"%":e.percent+"",l=void 0===e.minus?"-":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=Hh(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):ep[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===d?o:/[%p]/.test(y)?s:"",w=ep[y],_=/[defgprs%]/.test(y);function E(e){var i,o,s,d=b,E=x;if("c"===y)E=w(e)+E,e="";else{var O=(e=+e)<0;if(e=isNaN(e)?c:w(Math.abs(e),g),v&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),O&&0==+e&&(O=!1),d=(O?"("===f?f:l:"-"===f||"("===f?"":f)+d,E=("s"===y?rp[8+Vh/3]:"")+E+(O&&"("===f?")":""),_)for(i=-1,o=e.length;++i(s=e.charCodeAt(i))||s>57){E=(46===s?a+e.slice(i+1):e.slice(i))+E,e=e.slice(0,i);break}}m&&!h&&(e=r(e,1/0));var k=d.length+e.length+E.length,j=k>1)+d+e+E+j.slice(k);break;default:e=j+d+e+E}return u(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return e+""},E}return{format:f,formatPrefix:function(e,t){var n=f(((e=Hh(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(Qh(t)/3))),i=Math.pow(10,-r),o=rp[8+r/3];return function(e){return n(i*e)+o}}}};function op(e){return Gh=ip(e),Xh=Gh.format,Kh=Gh.formatPrefix,Gh}op({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});var ap=function(e,t,n,r){var i,o=cu(e,t,n);switch((r=Hh(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Qh(t)/3)))-Qh(Math.abs(e)))}(o,a))||(r.precision=i),Kh(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Qh(t)-Qh(e))+1}(o,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(e){return Math.max(0,-Qh(Math.abs(e)))}(o))||(r.precision=i-2*("%"===r.type))}return Xh(r)},up=Array.prototype.map;function sp(e){return up.call(e,(function(e){return+e}))}var lp=Array.prototype.slice;var cp=function(e,t,n){e.prototype=t.prototype=n,n.constructor=e};function fp(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function dp(){}var hp="\\s*([+-]?\\d+)\\s*",pp="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",mp="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gp=/^#([0-9a-f]{3,8})$/,vp=new RegExp("^rgb\\("+[hp,hp,hp]+"\\)$"),yp=new RegExp("^rgb\\("+[mp,mp,mp]+"\\)$"),bp=new RegExp("^rgba\\("+[hp,hp,hp,pp]+"\\)$"),xp=new RegExp("^rgba\\("+[mp,mp,mp,pp]+"\\)$"),wp=new RegExp("^hsl\\("+[pp,mp,mp]+"\\)$"),_p=new RegExp("^hsla\\("+[pp,mp,mp,pp]+"\\)$"),Ep={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 Op(){return this.rgb().formatHex()}function kp(){return this.rgb().formatRgb()}function jp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=gp.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Sp(t):3===n?new Tp(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?new Tp(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?new Tp(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=vp.exec(e))?new Tp(t[1],t[2],t[3],1):(t=yp.exec(e))?new Tp(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=bp.exec(e))?Cp(t[1],t[2],t[3],t[4]):(t=xp.exec(e))?Cp(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=wp.exec(e))?Pp(t[1],t[2]/100,t[3]/100,1):(t=_p.exec(e))?Pp(t[1],t[2]/100,t[3]/100,t[4]):Ep.hasOwnProperty(e)?Sp(Ep[e]):"transparent"===e?new Tp(NaN,NaN,NaN,0):null}function Sp(e){return new Tp(e>>16&255,e>>8&255,255&e,1)}function Cp(e,t,n,r){return r<=0&&(e=t=n=NaN),new Tp(e,t,n,r)}function Ap(e){return e instanceof dp||(e=jp(e)),e?new Tp((e=e.rgb()).r,e.g,e.b,e.opacity):new Tp}function Np(e,t,n,r){return 1===arguments.length?Ap(e):new Tp(e,t,n,null==r?1:r)}function Tp(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Dp(){return"#"+Fp(this.r)+Fp(this.g)+Fp(this.b)}function Mp(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Fp(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Pp(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Lp(e,t,n,r)}function Rp(e){if(e instanceof Lp)return new Lp(e.h,e.s,e.l,e.opacity);if(e instanceof dp||(e=jp(e)),!e)return new Lp;if(e instanceof Lp)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=t===o?(n-r)/u+6*(n0&&s<1?0:a,new Lp(a,u,s,e.opacity)}function zp(e,t,n,r){return 1===arguments.length?Rp(e):new Lp(e,t,n,null==r?1:r)}function Lp(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ip(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 $p(e,t,n,r,i){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)*r+a*i)/6}cp(dp,jp,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:Op,formatHex:Op,formatHsl:function(){return Rp(this).formatHsl()},formatRgb:kp,toString:kp}),cp(Tp,Np,fp(dp,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Tp(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Tp(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dp,formatHex:Dp,formatRgb:Mp,toString:Mp})),cp(Lp,zp,fp(dp,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Lp(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Lp(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Tp(Ip(e>=240?e-240:e+120,i,r),Ip(e,i,r),Ip(e<120?e+240:e-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var Bp=function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],a=r>0?e[r-1]:2*i-o,u=r180||n<-180?n-360*Math.round(n/360):n):qp(isNaN(e)?t:e)}function Yp(e){return 1==(e=+e)?Vp: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(r){return Math.pow(e+r*t,n)}}(t,n,e):qp(isNaN(t)?n:t)}}function Vp(e,t){var n=t-e;return n?Wp(e,n):qp(isNaN(e)?t:e)}var Gp=function e(t){var n=Yp(t);function r(e,t){var r=n((e=Np(e)).r,(t=Np(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),a=Vp(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1);function Xp(e){return function(t){var n,r,i=t.length,o=new Array(i),a=new Array(i),u=new Array(i);for(n=0;no&&(i=t.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:rm(n,r)})),o=am.lastIndex;return ot&&(n=e,e=t,t=n),l=function(n){return Math.max(e,Math.min(t,n))}),r=s>2?mm:pm,i=o=null,f}function f(t){return isNaN(t=+t)?n:(i||(i=r(a.map(e),u,s)))(e(l(t)))}return f.invert=function(n){return l(t((o||(o=r(u,a.map(e),rm)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,cm),c()):a.slice()},f.range=function(e){return arguments.length?(u=Array.from(e),c()):u.slice()},f.rangeRound=function(e){return u=Array.from(e),s=lm,c()},f.clamp=function(e){return arguments.length?(l=!!e||dm,c()):l!==dm},f.interpolate=function(e){return arguments.length?(s=e,c()):s},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,r){return e=n,t=r,c()}}function ym(){return vm()(dm,dm)}function bm(e){var t=e.domain;return e.ticks=function(e){var n=t();return su(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return ap(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i=t(),o=0,a=i.length-1,u=i[o],s=i[a];return s0?r=lu(u=Math.floor(u/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=lu(u=Math.ceil(u*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(s/r)*r,t(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(s*r)/r,t(i)),e},e}var xm=function(e,t){var n,r=0,i=(e=e.slice()).length-1,o=e[r],a=e[i];return a0){for(;d<=h;++d)for(c=1,l=n(d);cs)break;m.push(f)}}else for(;d<=h;++d)for(c=o-1,l=n(d);c>=1;--c)if(!((f=l*c)s)break;m.push(f)}2*m.length=u&&a[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return u=e.invertExtent(a[l]),s=e.invertExtent(a[n]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=e,n};return r.metadata=Object(oe.cb)(Object(oe.i)(n)),r}function Gm(e,t,n){return arguments.length>1?(Ym[e]=Vm(e,t,n),this):Xm(e)?Ym[e]:void 0}function Xm(e){return Object(oe.v)(Ym,e)}function Km(e,t){const n=Ym[e];return n&&n.metadata[t]}function Jm(e){return Km(e,Fh)}function Qm(e){return Km(e,"discrete")}function Zm(e){return Km(e,"discretizing")}function eg(e){return Km(e,Dh)}function tg(e){return Km(e,"interpolating")}function ng(e){return Km(e,"quantile")}Gm("identity",(function e(t){var n;function r(e){return isNaN(e=+e)?n:e}return r.invert=r,r.domain=r.range=function(e){return arguments.length?(t=Array.from(e,cm),r):t.slice()},r.unknown=function(e){return arguments.length?(n=e,r):n},r.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,cm):[0,1],bm(r)})),Gm("linear",(function e(){var t=ym();return t.copy=function(){return gm(t,e())},Ih.apply(t,arguments),bm(t)}),Fh),Gm(Dh,(function e(){var t=Sm(vm()).domain([1,10]);return t.copy=function(){return gm(t,e()).base(t.base())},Ih.apply(t,arguments),t}),[Fh,Dh]),Gm("pow",Dm,Fh),Gm("sqrt",(function(){return Dm.apply(null,arguments).exponent(.5)}),Fh),Gm("symlog",(function e(){var t=Pm(vm());return t.copy=function(){return gm(t,e()).constant(t.constant())},Ih.apply(t,arguments)}),Fh),Gm("time",(function(){return Ih.apply(Lm(Bt,Ca,Tt,It,Na,Da,Fa,Ra,Gt).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Fh,"temporal"]),Gm(Mh,(function(){return Ih.apply(Lm(qt,La,wt,At,$a,Ua,Fa,Ra,Kt).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Fh,"temporal"]),Gm("sequential",Bm,[Fh,"interpolating"]),Gm("sequential-linear",Bm,[Fh,"interpolating"]),Gm("sequential-log",(function e(){var t=Sm(Im()).domain([1,10]);return t.copy=function(){return $m(t,e()).base(t.base())},$h.apply(t,arguments)}),[Fh,"interpolating",Dh]),Gm("sequential-pow",Um,[Fh,"interpolating"]),Gm("sequential-sqrt",(function(){return Um.apply(null,arguments).exponent(.5)}),[Fh,"interpolating"]),Gm("sequential-symlog",(function e(){var t=Pm(Im());return t.copy=function(){return $m(t,e()).constant(t.constant())},$h.apply(t,arguments)}),[Fh,"interpolating"]),Gm("diverging-linear",(function e(){var t=bm(Wm()(dm));return t.copy=function(){return $m(t,e())},$h.apply(t,arguments)}),[Fh,"interpolating"]),Gm("diverging-log",(function e(){var t=Sm(Wm()).domain([.1,1,10]);return t.copy=function(){return $m(t,e()).base(t.base())},$h.apply(t,arguments)}),[Fh,"interpolating",Dh]),Gm("diverging-pow",Hm,[Fh,"interpolating"]),Gm("diverging-sqrt",(function(){return Hm.apply(null,arguments).exponent(.5)}),[Fh,"interpolating"]),Gm("diverging-symlog",(function e(){var t=Pm(Wm());return t.copy=function(){return $m(t,e()).constant(t.constant())},$h.apply(t,arguments)}),[Fh,"interpolating"]),Gm("quantile",(function e(){var t,n=[],r=[],i=[];function o(){var e=0,t=Math.max(1,r.length);for(i=new Array(t-1);++e0?i[t-1]:n[0],t=i?[o[i-1],r]:[o[t-1],o[t]]},u.unknown=function(e){return arguments.length?(t=e,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return e().domain([n,r]).range(a).unknown(t)},Ih.apply(bm(u),arguments)}),"discretizing"),Gm("threshold",(function e(){var t,n=[.5],r=[0,1],i=1;function o(e){return e<=e?r[Lh(n,e,0,i)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(e){return arguments.length?(r=Array.from(e),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(e){var t=r.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(r).unknown(t)},Ih.apply(o,arguments)}),"discretizing"),Gm("bin-ordinal",(function e(){var t=[],n=[];function r(e){return null==e||e!=e?void 0:n[(Lh(t,e)-1)%n.length]}return r.domain=function(e){return arguments.length?(t=sp(e),r):t.slice()},r.range=function(e){return arguments.length?(n=lp.call(e),r):n.slice()},r.tickFormat=function(e,n){return ap(t[0],Object(oe.T)(t),null==e?10:e,n)},r.copy=function(){return e().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),Gm("ordinal",Uh,"discrete"),Gm("band",qh,"discrete"),Gm("point",(function(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return e(n())},t}(qh().paddingInner(1))}),"discrete");var rg,ig,og,ag,ug=function(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}},sg=function(e,t){var n=Hp(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}},lg=180/Math.PI,cg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},fg=function(e,t,n,r,i,o){var a,u,s;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(s=e*n+t*r)&&(n-=e*s,r-=t*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),e*r180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:rm(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,a.rotate,u,s),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:rm(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,a.skewX,u,s),function(e,t,n,r,o,a){if(e!==n||t!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:rm(e,n)},{i:u-2,x:rm(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(e){for(var t,n=-1,r=s.length;++n6/29*(6/29)*(6/29)?Math.pow(e,1/3):e/(6/29*3*(6/29))+4/29}function Sg(e){return e>6/29?e*e*e:6/29*3*(6/29)*(e-4/29)}function Cg(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ag(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ng(e){if(e instanceof Dg)return new Dg(e.h,e.c,e.l,e.opacity);if(e instanceof kg||(e=Eg(e)),0===e.a&&0===e.b)return new Dg(NaN,0e[t]?o[t](e[t]()):0),o):Object(oe.l)(.5)}function ev(e,t){var n=u[function(e){return"interpolate"+e.toLowerCase().split("-").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function tv(e){for(var t=e.length/6|0,n=new Array(t),r=0;r1?(rv[e]=t,this):rv[e]}function ov(e,t,n){var r;return Object(oe.E)(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,~~(Object(oe.W)(e.domain())/n)||1))),Object(oe.F)(t)&&(r=t.step,t=t.interval),Object(oe.H)(t)&&(t="time"===e.type?Ha(t):e.type==Mh?Ya(t):Object(oe.n)("Only time and utc scales accept interval strings."),r&&(t=t.every(r))),t}function av(e,t,n){var r=e.range(),i=Math.floor(r[0]),o=Math.ceil(Object(oe.T)(r));if(i>o&&(r=o,o=i,i=r),t=t.filter((function(t){return t=e(t),i<=t&&t<=o})),n>0&&t.length>1){for(var a=[t[0],Object(oe.T)(t)];t.length>n&&t.length>=3;)t=t.filter((function(e,t){return!(t%2)}));t.length<3&&(t=a)}return t}function uv(e,t){return e.bins?av(e,e.bins):e.ticks?e.ticks(t):e.domain()}function sv(e,t,n,r,i){var o,a,u=e.type,s="time"===u||"time"===r?tu(n):u===Mh||r===Mh?nu(n):e.tickFormat?e.tickFormat(t,n):n?Xh(n):String;if(eg(u)){var l=function(e){var t=Hh(e||",");if(null==t.precision){switch(t.precision=12,t.type){case"%":t.precision-=2;break;case"e":t.precision-=1}return function(e,t){return function(n){var r,i,o=e(n),a=o.indexOf(t);if(a<0)return o;for(i=(r=function(e,t){var n,r=e.lastIndexOf("e");if(r>0)return r;for(r=e.length;--r>t;)if((n=e.charCodeAt(r))>=48&&n<=57)return r+1}(o,a))a;)if("0"!==o[r]){++r;break}return o.slice(0,r)+i}}(Xh(t),Xh(".1f")(1)[1])}return Xh(t)}(n);s=i||e.bins?l:(o=s,a=l,e=>o(e)?a(e):"")}return s}function lv(e){Dr.call(this,null,e)}function cv(e){Dr.call(this,null,e)}function fv(){return he({})}function dv(e){return e.exit}function hv(e){Dr.call(this,null,e)}nv({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"},tv),nv({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",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",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=>Jg(tv(e))),Object(oe.y)(lv,Dr).transform=function(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,i=e.scale,o=ov(i,null==e.count?e.values?e.values.length:10:e.count,e.minstep),a=e.format||sv(i,o,e.formatSpecifier,e.formatType,!!e.values),u=e.values?av(i,e.values,o):uv(i,o);return r&&(n.rem=r),r=u.map((function(e,t){return he({index:t/(u.length-1||1),value:e,label:a(e)})})),e.extra&&r.length&&r.push(he({index:-1,extra:{value:r[0].value},label:""})),n.source=r,n.add=r,this.value=r,n},Object(oe.y)(cv,Dr).transform=function(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||fv,o=e.key||fe,a=this.value;return Object(oe.A)(r.encode)&&(r.encode=null),a&&(e.modified("key")||t.modified(o))&&Object(oe.n)("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=Object(oe.s)().test(dv),a.lookup=function(e){return a.get(o(e))}),t.visit(t.ADD,(function(e){var t=o(e),n=a.get(t);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(a.set(t,n=i(e)),r.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(function(e){var t=o(e),n=a.get(t);n&&(n.datum=e,r.mod.push(n))})),t.visit(t.REM,(function(e){var t=o(e),n=a.get(t);e!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&r.modifies("datum"),e.clean&&a.empty>n.cleanThreshold&&n.runAfter(a.clean),r},Object(oe.y)(hv,Dr).transform=function(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,o=t.encode;if(Object(oe.A)(o)){if(!n.changed()&&!o.every((function(e){return i[e]})))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,u=i.update||oe.r,s=i.enter||oe.r,l=i.exit||oe.r,c=(o&&!a?i[o]:u)||oe.r;if(t.changed(t.ADD)&&(t.visit(t.ADD,(function(t){s(t,e),u(t,e)})),n.modifies(s.output),n.modifies(u.output),c!==oe.r&&c!==u&&(t.visit(t.ADD,(function(t){c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&l!==oe.r&&(t.visit(t.REM,(function(t){l(t,e)})),n.modifies(l.output)),a||c!==oe.r){var f=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(f,(function(t){var i=s(t,e)||r;(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(s.output)):t.visit(f,(function(t){(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation};const pv={quantile:"quantiles",quantize:"thresholds",threshold:"domain"},mv={quantile:"quantiles",quantize:"domain"};function gv(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=Object(oe.T)(e),t}(e.bins):pv[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[pv[e.type]]()):uv(e,t)}function vv(e,t,n,r,i,o){const a=mv[e.type]&&"time"!==i&&i!==Mh?function(e,t){var n,r=e[mv[e.type]](),i=r.length,o=i>1?r[1]-r[0]:r[0];for(n=1;nf?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),s=p.slice(0,f-1),a=!0):s=p,Object(oe.D)(i=e.size)?(e.values||0!==c(s[0])||(s=s.slice(1)),o=s.reduce((function(t,n){return Math.max(t,i(n,e))}),0)):i=Object(oe.l)(o=i||8),s=s.map((function(t,n){return he({index:n,label:h(t,n,s),value:t,offset:o,size:i(t,e)})})),a&&(a=p[s.length],s.push(he({index:s.length,label:`…${p.length-s.length} entries`,value:a,offset:o,size:i(a,e)})))):"gradient"===l?(n=c.domain(),r=Zg(c,n[0],Object(oe.T)(n)),p.length<3&&!e.values&&n[0]!==Object(oe.T)(n)&&(p=[n[0],Object(oe.T)(n)]),s=p.map((function(e,t){return he({index:t,label:h(e,t,p),value:e,perc:r(e)})}))):(i=p.length-1,r=function(e){var t=e.domain(),n=t.length-1,r=+t[0],i=+Object(oe.T)(t),o=i-r;if("threshold"===e.type){var a=n?o/n:.1;o=(i+=a)-(r-=a)}return function(e){return(e-r)/o}}(c),s=p.map((function(e,t){return he({index:t,label:h(e,t,p),value:e,perc:t?r(e):0,perc2:t===i?1:r(p[t+1])})}))),u.source=s,u.add=s,this.value=s,u};var wv=Object(oe.s)({line:Sv,"line-radial":function(e,t,n,r){return Sv(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},arc:Cv,"arc-radial":function(e,t,n,r){return Cv(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},curve:Av,"curve-radial":function(e,t,n,r){return Av(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(e,t,n,r){return"M"+e+","+t+"V"+r+"H"+n},"orthogonal-vertical":function(e,t,n,r){return"M"+e+","+t+"H"+n+"V"+r},"orthogonal-radial":function(e,t,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),u=Math.sin(n),s=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*i+","+t*o+"A"+t+","+t+" 0 0,"+(s?1:0)+" "+t*a+","+t*u+"L"+r*a+","+r*u},"diagonal-horizontal":function(e,t,n,r){var i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(e,t,n,r){var i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(e,t,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),u=Math.sin(n),s=(t+r)/2;return"M"+t*i+","+t*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function _v(e){return e.source.x}function Ev(e){return e.source.y}function Ov(e){return e.target.x}function kv(e){return e.target.y}function jv(e){Dr.call(this,{},e)}function Sv(e,t,n,r){return"M"+e+","+t+"L"+n+","+r}function Cv(e,t,n,r){var i=n-e,o=r-t,a=Math.sqrt(i*i+o*o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r}function Av(e,t,n,r){var i=n-e,o=r-t,a=.2*(i+o),u=.2*(o-i);return"M"+e+","+t+"C"+(e+a)+","+(t+u)+" "+(n+u)+","+(r-a)+" "+n+","+r}function Nv(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Tv(e){Dr.call(this,null,e)}jv.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"}]},Object(oe.y)(jv,Dr).transform=function(e,t){var n=e.sourceX||_v,r=e.sourceY||Ev,i=e.targetX||Ov,o=e.targetY||kv,a=e.as||"path",u=e.orient||"vertical",s=e.shape||"line",l=wv.get(s+"-"+u)||wv.get(s);return l||Object(oe.n)("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(function(e){e[a]=l(n(e),r(e),i(e),o(e))})),t.reflow(e.modified()).modifies(a)},Tv.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"]}]},Object(oe.y)(Tv,Dr).transform=function(e,t){var n,r,i,o=e.as||["startAngle","endAngle"],a=o[0],u=o[1],s=e.field||oe.N,l=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(s),h=d.length,p=l,m=(c-l)/Nv(d),g=Go(h);for(e.sort&&g.sort((function(e,t){return d[e]-d[t]})),n=0;n0?1:0)}),0))!==t.length&&n.warn("Log scale domain includes zero: "+Object(oe.Y)(t)));return t}function Rv(e,t,n){return Object(oe.D)(e)&&(t||n)?Kg(e,zv(t||[0,1],n)):e}function zv(e,t){return t?e.slice().reverse():e}function Lv(e){Dr.call(this,null,e)}Object(oe.y)(Fv,Dr).transform=function(e,t){var n=t.dataflow,r=this.value,i=function(e){var t,n=e.type,r="";if("sequential"===n)return"sequential-linear";(function(e){const t=e.type;return Jm(t)&&"time"!==t&&t!==Mh&&(e.scheme||e.range&&e.range.length&&e.range.every(oe.H))})(e)&&(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0,r=2===t?"sequential-":3===t?"diverging-":"");return(r+n||"linear").toLowerCase()}(e);for(i in r&&i===r.type||(this.value=r=Gm(i)()),e)if(!Mv[i]){if("padding"===i&&Dv(r.type))continue;Object(oe.D)(r[i])?r[i](e[i]):n.warn("Unsupported scale property: "+i)}return function(e,t,n){var r=e.type,i=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){"band"!==e&&"point"!==e&&Object(oe.n)("Only band and point scales support rangeStep.");var r=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,i="point"===e?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Th(n,i,r)]}(r,t,n);else if(t.scheme&&(o=function(e,t,n){var r,i,o=t.schemeExtent;Object(oe.A)(t.scheme)?i=Jg(t.scheme,t.interpolate,t.interpolateGamma):(r=t.scheme.toLowerCase(),(i=iv(r))||Object(oe.n)(`Unrecognized scheme name: ${t.scheme}`));return n="threshold"===e?n+1:"bin-ordinal"===e?n-1:"quantile"===e||"quantize"===e?+t.schemeCount||5:n,tg(e)?Rv(i,o,t.reverse):Object(oe.D)(i)?Qg(Rv(i,o),n):"ordinal"===e?i:i.slice(0,n)}(r,t,n),Object(oe.D)(o))){if(e.interpolator)return e.interpolator(o);Object(oe.n)(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&tg(r))return e.interpolator(Jg(zv(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(ev(t.interpolate,t.interpolateGamma)):Object(oe.D)(e.round)?e.round(i):Object(oe.D)(e.rangeRound)&&e.interpolate(i?lm:sm);o&&e.range(zv(o,t.reverse))}(r,e,function(e,t,n){let r=t.bins;if(r&&!Object(oe.A)(r)){let t=e.domain(),n=t[0],i=Object(oe.T)(t),o=null==r.start?n:r.start,a=null==r.stop?i:r.stop,u=r.step;u||Object(oe.n)("Scale bins parameter missing step property."),oi&&(a=u*Math.floor(i/u)),r=Go(o,a+u/2,u)}r?e.bins=r:e.bins&&delete e.bins;"bin-ordinal"===e.type&&(r?t.domain||t.domainRaw||(e.domain(r),n=r.length):e.bins=e.domain());return n}(r,e,function(e,t,n){var r=function(e,t,n){return t?(e.domain(Pv(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(r>-1)return r;var i,o,a=t.domain,u=e.type,s=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&("linear"===t||"pow"===t||"sqrt"===t)}(e);if(!a)return 0;Dv(u)&&t.padding&&a[0]!==Object(oe.T)(a)&&(a=function(e,t,n,r,i,o){var a=Math.abs(Object(oe.T)(n)-n[0]),u=a/(a-2*r),s=e===Dh?Object(oe.lb)(t,null,u):"sqrt"===e?Object(oe.mb)(t,null,u,.5):"pow"===e?Object(oe.mb)(t,null,u,i||1):"symlog"===e?Object(oe.nb)(t,null,u,o||1):Object(oe.kb)(t,null,u);return(t=t.slice())[0]=s[0],t[t.length-1]=s[1],t}(u,a,t.range,t.padding,t.exponent,t.constant));(s||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[i]=t.domainMax),null!=t.domainMid&&(((o=t.domainMid)a[i])&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(i,0,o)));e.domain(Pv(u,a,n)),"ordinal"===u&&e.unknown(t.domainImplicit?Bh:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&ov(e,t.nice)||null);return a.length}(r,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)},Object(oe.y)(Lv,Dr).transform=function(e,t){var n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(ve(e.sort)),this.modified(n),t};var Iv=["y0","y1"];function $v(e){Dr.call(this,null,e)}function Bv(e,t,n,r,i){for(var o,a=(t-e.sum)/2,u=e.length,s=0;sd&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,l,c),r=0,i=n.length,o=n.max;ri(e,t))}function i(r,i){var a=[],u=[];return function(n,r,i){var a,u,s,l,c,f,d=new Array,h=new Array;a=u=-1,l=n[0]>=r,Hv[l<<1].forEach(p);for(;++a=r,Hv[s|l<<1].forEach(p);Hv[l<<0].forEach(p);for(;++u=r,c=n[u*e]>=r,Hv[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[u*e+a+1]>=r,Hv[s|l<<1|c<<2|f<<3].forEach(p);Hv[l|c<<3].forEach(p)}a=-1,c=n[u*e]>=r,Hv[c<<2].forEach(p);for(;++a=r,Hv[c<<2|f<<3].forEach(p);function p(e){var t,n,r=[e[0][0]+a,e[0][1]+u],s=[e[1][0]+a,e[1][1]+u],l=o(r),c=o(s);(t=h[l])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(s),i(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(s),h[t.end=c]=t):(t=d[c])?(n=h[l])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(s),i(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(r),d[t.start=l]=t):d[l]=h[c]={start:l,end:c,ring:[r,s]}}Hv[c<<3].forEach(p)}(r,i,(function(e){n(e,r,i),function(e){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t0?a.push([e]):u.push(e)})),u.forEach((function(e){for(var t,n=0,r=a.length;n0&&a0&&u0&&o>0||Object(oe.n)("invalid size"),e=i,t=o,r},r.smooth=function(e){return arguments.length?(n=e?a:Wv,r):n===a},r};function Vv(e,t){for(var n,r=-1,i=t.length;++rr!=h>r&&n<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function Xv(e,t,n){var r,i,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)&&(i=e[r=+(e[0]===t[0])],o=n[r],a=t[r],i<=o&&o<=a||a<=o&&o<=i)}var Kv=function(e,t,n){return function(r){var i=Object(oe.p)(r),o=n?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=t?cu(o,a,e):u/(e+1);return Go(s,a,s)}};function Jv(e){Dr.call(this,null,e)}function Qv(e,t,n,r,i){const o=e.x1||0,a=e.y1||0,u=t*n<0;function s(e){e.forEach(l)}function l(e){u&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+r,e[1]=(e[1]-a)*n+i}return function(e){return e.coordinates.forEach(s),e}}function Zv(e,t,n){const r=e>=0?e:ei(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function ey(e){return Object(oe.D)(e)?e:Object(oe.l)(+e)}Jv.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"}]},Object(oe.y)(Jv,Dr).transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||oe.x,o=Yv().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const r=Kv(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(e.map(e=>Vr(t(e).values)))}(r,i,e),u=null===e.as?null:e.as||"contour",s=[];return r.forEach(t=>{const n=i(t),r=o.size([n.width,n.height])(n.values,Object(oe.A)(a)?a:a(n.values));!function(e,t,n,r){let i=r.scale||t.scale,o=r.translate||t.translate;Object(oe.D)(i)&&(i=i(n,r));Object(oe.D)(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(Object(oe.E)(i)?i:i[0])||1,u=(Object(oe.E)(i)?i:i[1])||1,s=o&&o[0]||0,l=o&&o[1]||0;e.forEach(Qv(t,a,u,s,l))}(r,n,t,e),r.forEach(e=>{s.push(me(t,he(null!=u?{[u]:e}:e)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n};var ty=function(){var e=e=>e[0],t=e=>e[1],n=oe.N,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const l=Zv(r[0],u,e)>>a,c=Zv(r[1],u,t)>>a,f=l?l+2:0,d=c?c+2:0,h=2*f+(i>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let v=m;u.forEach(r=>{const i=f+(+e(r)>>a),o=d+(+t(r)>>a);i>=0&&i=0&&o0&&c>0?(ny(h,p,m,g,l),ry(h,p,g,m,c),ny(h,p,m,g,l),ry(h,p,g,m,c),ny(h,p,m,g,l),ry(h,p,g,m,c)):l>0?(ny(h,p,m,g,l),ny(h,p,g,m,l),ny(h,p,m,g,l),v=g):c>0&&(ry(h,p,m,g,c),ry(h,p,g,m,c),ry(h,p,m,g,c),v=g);let y=s?Math.pow(2,-2*a):1/Nv(v);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return u.x=function(t){return arguments.length?(e=ey(t),u):e},u.y=function(e){return arguments.length?(t=ey(e),u):t},u.weight=function(e){return arguments.length?(n=ey(e),u):n},u.size=function(e){if(!arguments.length)return[i,o];var t=Math.ceil(e[0]),n=Math.ceil(e[1]);return t>=0||t>=0||Object(oe.n)("invalid size"),i=t,o=n,u},u.cellSize=function(e){return arguments.length?((e=+e)>=1||Object(oe.n)("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),u):1<=i&&(t>=o&&(u-=n[t-o+a*e]),r[t-i+a*e]=u/Math.min(t+1,e-1+o-t,o))}function ry(e,t,n,r,i){const o=1+(i<<1);for(let a=0;a=i&&(u>=o&&(s-=n[a+(u-o)*e]),r[a+(u-i)*e]=s/Math.min(u+1,t-1+o-u,o))}function iy(e){Dr.call(this,null,e)}iy.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"}]};var oy=Object(oe.y)(iy,Dr);const ay=["x","y","weight","size","cellSize","bandwidth"];function uy(e,t){return ay.forEach(n=>null!=t[n]?e[n](t[n]):0),e}function sy(e){Dr.call(this,null,e)}oy.transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=function(e,t){var n,r,i,o,a,u,s=[],l=e=>e(o);if(null==t)s.push(e);else for(n={},r=0,i=e.length;rhe(function(e,t){for(let n=0;n0?1:e<0?-1:0},zy=Math.sqrt,Ly=Math.tan;function Iy(e){return e>1?0:e<-1?wy:Math.acos(e)}function $y(e){return e>1?_y:e<-1?-_y:Math.asin(e)}function By(){}var Uy,qy,Wy,Hy,Yy=vy(),Vy=vy(),Gy={point:By,lineStart:By,lineEnd:By,polygonStart:function(){Gy.lineStart=Xy,Gy.lineEnd=Qy},polygonEnd:function(){Gy.lineStart=Gy.lineEnd=Gy.point=By,Yy.add(Sy(Vy)),Vy.reset()},result:function(){var e=Yy/2;return Yy.reset(),e}};function Xy(){Gy.point=Ky}function Ky(e,t){Gy.point=Jy,Uy=Wy=e,qy=Hy=t}function Jy(e,t){Vy.add(Hy*e-Wy*t),Wy=e,Hy=t}function Qy(){Jy(Uy,qy)}var Zy=Gy,eb=1/0,tb=eb,nb=-eb,rb=nb;var ib,ob,ab,ub,sb={point:function(e,t){enb&&(nb=e);trb&&(rb=t)},lineStart:By,lineEnd:By,polygonStart:By,polygonEnd:By,result:function(){var e=[[eb,tb],[nb,rb]];return nb=rb=-(tb=eb=1/0),e}},lb=0,cb=0,fb=0,db=0,hb=0,pb=0,mb=0,gb=0,vb=0,yb={point:bb,lineStart:xb,lineEnd:Eb,polygonStart:function(){yb.lineStart=Ob,yb.lineEnd=kb},polygonEnd:function(){yb.point=bb,yb.lineStart=xb,yb.lineEnd=Eb},result:function(){var e=vb?[mb/vb,gb/vb]:pb?[db/pb,hb/pb]:fb?[lb/fb,cb/fb]:[NaN,NaN];return lb=cb=fb=db=hb=pb=mb=gb=vb=0,e}};function bb(e,t){lb+=e,cb+=t,++fb}function xb(){yb.point=wb}function wb(e,t){yb.point=_b,bb(ab=e,ub=t)}function _b(e,t){var n=e-ab,r=t-ub,i=zy(n*n+r*r);db+=i*(ab+e)/2,hb+=i*(ub+t)/2,pb+=i,bb(ab=e,ub=t)}function Eb(){yb.point=bb}function Ob(){yb.point=jb}function kb(){Sb(ib,ob)}function jb(e,t){yb.point=Sb,bb(ib=ab=e,ob=ub=t)}function Sb(e,t){var n=e-ab,r=t-ub,i=zy(n*n+r*r);db+=i*(ab+e)/2,hb+=i*(ub+t)/2,pb+=i,mb+=(i=ub*e-ab*t)*(ab+e),gb+=i*(ub+t),vb+=3*i,bb(ab=e,ub=t)}var Cb=yb;function Ab(e){this._context=e}Ab.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,Oy)}},result:By};var Nb,Tb,Db,Mb,Fb,Pb=vy(),Rb={point:By,lineStart:function(){Rb.point=zb},lineEnd:function(){Nb&&Lb(Tb,Db),Rb.point=By},polygonStart:function(){Nb=!0},polygonEnd:function(){Nb=null},result:function(){var e=+Pb;return Pb.reset(),e}};function zb(e,t){Rb.point=Lb,Tb=Mb=e,Db=Fb=t}function Lb(e,t){Mb-=e,Fb-=t,Pb.add(zy(Mb*Mb+Fb*Fb)),Mb=e,Fb=t}var Ib=Rb;function $b(){this._string=[]}function Bb(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}$b.prototype={_radius:4.5,_circle:Bb(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._string.push("M",e,",",t),this._point=1;break;case 1:this._string.push("L",e,",",t);break;default:null==this._circle&&(this._circle=Bb(this._radius)),this._string.push("M",e,",",t,this._circle)}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}return null}};var Ub=function(e,t){var n,r,i=4.5;function o(e){return e&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),gy(e,n(r))),r.result()}return o.area=function(e){return gy(e,n(Zy)),Zy.result()},o.measure=function(e){return gy(e,n(Ib)),Ib.result()},o.bounds=function(e){return gy(e,n(sb)),sb.result()},o.centroid=function(e){return gy(e,n(Cb)),Cb.result()},o.projection=function(t){return arguments.length?(n=null==t?(e=null,cy):(e=t).stream,o):e},o.context=function(e){return arguments.length?(r=null==e?(t=null,new $b):new Ab(t=e),"function"!=typeof i&&r.pointRadius(i),o):t},o.pointRadius=function(e){return arguments.length?(i="function"==typeof e?e:(r.pointRadius(+e),+e),o):i},o.projection(e).context(t)},qb=function(){var e,t=[];return{point:function(t,n){e.push([t,n])},lineStart:function(){t.push(e=[])},lineEnd:By,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}},Wb=function(e,t){return Sy(e[0]-t[0])<1e-6&&Sy(e[1]-t[1])<1e-6};function Hb(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}var Yb=function(e,t,n,r,i){var o,a,u=[],s=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,r=e[0],a=e[t];if(Wb(r,a)){for(i.lineStart(),o=0;o=0;--o)i.point((c=l[o])[0],c[1]);else r(d.x,d.p.x,-1,i);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}};function Vb(e){if(t=e.length){for(var t,n,r=0,i=e[0];++rt?1:e>=t?0:NaN};var ix,ox;1===(ix=rx).length&&(ox=ix,ix=function(e,t){return rx(ox(e),t)});var ax=Array.prototype,ux=(ax.slice,ax.map,function(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(i);++r=0;)for(t=(r=e[i]).length;--t>=0;)n[--a]=r[t];return n};var lx=function(e,t,n,r){return function(i){var o,a,u,s=t(i),l=qb(),c=t(l),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=v,d.lineStart=y,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=sx(a);var e=function(e,t){var n=nx(t),r=t[1],i=Py(r),o=[Py(n),-Ny(n),0],a=0,u=0;tx.reset(),1===i?r=_y+1e-6:-1===i&&(r=-_y-1e-6);for(var s=0,l=e.length;s=0?1:-1,k=O*E,j=k>wy,S=m*w;if(tx.add(Ay(S*O*Py(k),g*_+S*Ny(k))),a+=j?E+O*Oy:E,j^h>=n^b>=n){var C=Jb(Xb(d),Xb(y));ex(C);var A=Jb(o,C);ex(A);var N=(j^E>=0?-1:1)*$y(A[2]);(r>N||r===N&&(C[0]||C[1]))&&(u+=j^E>=0?1:-1)}}return(a<-1e-6||a<1e-6&&tx<-1e-6)^1&u}(o,r);a.length?(f||(i.polygonStart(),f=!0),Yb(a,fx,e,n,i)):e&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(t,n){e(t,n)&&i.point(t,n)}function p(e,t){s.point(e,t)}function m(){d.point=p,s.lineStart()}function g(){d.point=h,s.lineEnd()}function v(e,t){u.push([e,t]),c.point(e,t)}function y(){c.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),c.lineEnd();var e,t,n,r,s=c.clean(),d=l.result(),h=d.length;if(u.pop(),o.push(u),u=null,h)if(1&s){if((t=(n=d[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),e=0;e1&&2&s&&d.push(d.pop().concat(d.shift())),a.push(d.filter(cx))}return d}};function cx(e){return e.length>1}function fx(e,t){return((e=e.x)[0]<0?e[1]-_y-1e-6:_y-e[1])-((t=t.x)[0]<0?t[1]-_y-1e-6:_y-t[1])}var dx=lx((function(){return!0}),(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var u=o>0?wy:-wy,s=Sy(o-n);Sy(s-wy)<1e-6?(e.point(n,r=(r+a)/2>0?_y:-_y),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(u,r),e.point(o,r),t=0):i!==u&&s>=wy&&(Sy(n-i)<1e-6&&(n-=1e-6*i),Sy(o-u)<1e-6&&(o-=1e-6*u),r=function(e,t,n,r){var i,o,a=Py(e-n);return Sy(a)>1e-6?Cy((Py(t)*(o=Ny(r))*Py(n)-Py(r)*(i=Ny(t))*Py(e))/(i*o*a)):(t+r)/2}(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(u,r),t=0),e.point(n=o,r=a),i=u},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*_y,r.point(-wy,i),r.point(0,i),r.point(wy,i),r.point(wy,0),r.point(wy,-i),r.point(0,-i),r.point(-wy,-i),r.point(-wy,0),r.point(-wy,i);else if(Sy(e[0]-t[0])>1e-6){var o=e[0]wy?e+Math.round(-e/Oy)*Oy:e,t]}function mx(e,t,n){return(e%=Oy)?t||n?hx(vx(e),yx(t,n)):vx(e):t||n?yx(t,n):px}function gx(e){return function(t,n){return[(t+=e)>wy?t-Oy:t<-wy?t+Oy:t,n]}}function vx(e){var t=gx(e);return t.invert=gx(-e),t}function yx(e,t){var n=Ny(e),r=Py(e),i=Ny(t),o=Py(t);function a(e,t){var a=Ny(t),u=Ny(e)*a,s=Py(e)*a,l=Py(t),c=l*n+u*r;return[Ay(s*i-c*o,u*n-l*r),$y(c*i+s*o)]}return a.invert=function(e,t){var a=Ny(t),u=Ny(e)*a,s=Py(e)*a,l=Py(t),c=l*i-s*o;return[Ay(s*i+l*o,u*n+c*r),$y(c*n-u*r)]},a}px.invert=px;function bx(e,t,n,r,i,o){if(n){var a=Ny(t),u=Py(t),s=r*n;null==i?(i=t+r*Oy,o=t-s/2):(i=xx(a,i),o=xx(a,o),(r>0?io)&&(i+=r*Oy));for(var l,c=i;r>0?c>o:c0,i=Sy(t)>1e-6;function o(e,n){return Ny(e)*Ny(n)>t}function a(e,n,r){var i=[1,0,0],o=Jb(Xb(e),Xb(n)),a=Kb(o,o),u=o[0],s=a-u*u;if(!s)return!r&&e;var l=t*a/s,c=-t*u/s,f=Jb(i,o),d=Zb(i,l);Qb(d,Zb(o,c));var h=f,p=Kb(d,h),m=Kb(h,h),g=p*p-m*(Kb(d,d)-1);if(!(g<0)){var v=zy(g),y=Zb(h,(-p-v)/m);if(Qb(y,d),y=Gb(y),!r)return y;var b,x=e[0],w=n[0],_=e[1],E=n[1];w0^y[1]<(Sy(y[0]-x)<1e-6?_:E):_<=y[1]&&y[1]<=E:O>wy^(x<=y[0]&&y[0]<=w)){var j=Zb(h,(-p+v)/m);return Qb(j,d),[y,Gb(j)]}}}function u(t,n){var i=r?e:wy-e,o=0;return t<-i?o|=1:t>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return lx(o,(function(e){var t,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=r?m?0:u(f,d):m?u(f+(f<0?wy:-wy),d):0;if(!t&&(l=s=m)&&e.lineStart(),m!==s&&(!(h=a(t,p))||Wb(t,h)||Wb(p,h))&&(p[0]+=1e-6,p[1]+=1e-6,m=o(p[0],p[1])),m!==s)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]),e.lineEnd()),t=h;else if(i&&t&&r^m){var v;g&n||!(v=a(p,t,!0))||(c=0,r?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1])))}!m||t&&Wb(t,p)||e.point(p[0],p[1]),t=p,s=m,n=g},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return c|(l&&s)<<1}}}),(function(t,r,i,o){bx(o,e,n,i,t,r)}),r?[0,-e]:[-wy,e-wy])};function _x(e,t,n,r){function i(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function o(i,o,u,l){var c=0,f=0;if(null==i||(c=a(i,u))!==(f=a(o,u))||s(i,o)<0^u>0)do{l.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+u+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return Sy(r[0]-e)<1e-6?i>0?0:3:Sy(r[0]-n)<1e-6?i>0?2:1:Sy(r[1]-t)<1e-6?i>0?1:0:i>0?3:2}function u(e,t){return s(e.x,t.x)}function s(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r: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 s,l,c,f,d,h,p,m,g,v,y,b=a,x=qb(),w={point:_,lineStart:function(){w.point=E,l&&l.push(c=[]);v=!0,g=!1,p=m=NaN},lineEnd:function(){s&&(E(f,d),h&&g&&x.rejoin(),s.push(x.result()));w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,s=[],l=[],y=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=l.length;nr&&(d-o)*(r-a)>(h-a)*(e-o)&&++t:h<=r&&(d-o)*(r-a)<(h-a)*(e-o)&&--t;return t}(),n=y&&t,i=(s=sx(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Yb(s,u,t,o,a),a.polygonEnd());b=a,s=l=c=null}};function _(e,t){i(e,t)&&b.point(e,t)}function E(o,a){var u=i(o,a);if(l&&c.push([o,a]),v)f=o,d=a,h=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var s=[p=Math.max(-1e9,Math.min(1e9,p)),m=Math.max(-1e9,Math.min(1e9,m))],x=[o=Math.max(-1e9,Math.min(1e9,o)),a=Math.max(-1e9,Math.min(1e9,a))];!function(e,t,n,r,i,o){var a,u=e[0],s=e[1],l=0,c=1,f=t[0]-u,d=t[1]-s;if(a=n-u,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-u,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-s,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>l&&(l=a)}else if(d>0){if(a0&&(e[0]=u+l*f,e[1]=s+l*d),c<1&&(t[0]=u+c*f,t[1]=s+c*d),!0}}}}}(s,x,e,t,n,r)?u&&(b.lineStart(),b.point(o,a),y=!1):(g||(b.lineStart(),b.point(s[0],s[1])),b.point(x[0],x[1]),u||b.lineEnd(),y=!1)}p=o,m=a,g=u}return w}}function Ex(e){return function(t){var n=new Ox;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Ox(){}function kx(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),gy(n,e.stream(sb)),t(sb.result()),null!=r&&e.clipExtent(r),e}function jx(e,t,n){return kx(e,(function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,u=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,u])}),n)}function Sx(e,t,n){return jx(e,[[0,0],t],n)}function Cx(e,t,n){return kx(e,(function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])}),n)}function Ax(e,t,n){return kx(e,(function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])}),n)}Ox.prototype={constructor:Ox,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 Nx=Ny(30*jy),Tx=function(e,t){return+t?function(e,t){function n(r,i,o,a,u,s,l,c,f,d,h,p,m,g){var v=l-r,y=c-i,b=v*v+y*y;if(b>4*t&&m--){var x=a+d,w=u+h,_=s+p,E=zy(x*x+w*w+_*_),O=$y(_/=E),k=Sy(Sy(_)-1)<1e-6||Sy(o-f)<1e-6?(o+f)/2:Ay(w,x),j=e(k,O),S=j[0],C=j[1],A=S-r,N=C-i,T=y*A-v*N;(T*T/b>t||Sy((v*A+y*N)/b-.5)>.3||a*d+u*h+s*p2?e[2]%360*jy:0,S()):[g*ky,v*ky,y*ky]},k.angle=function(e){return arguments.length?(b=e%360*jy,S()):b*ky},k.precision=function(e){return arguments.length?(a=Tx(u,O=e*e),C()):zy(O)},k.fitExtent=function(e,t){return jx(k,e,t)},k.fitSize=function(e,t){return Sx(k,e,t)},k.fitWidth=function(e,t){return Cx(k,e,t)},k.fitHeight=function(e,t){return Ax(k,e,t)},function(){return t=e.apply(this,arguments),k.invert=t.invert&&j,S()}}function zx(e){var t=0,n=wy/3,r=Rx(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*jy,n=e[1]*jy):[t*ky,n*ky]},i}function Lx(e,t){var n=Py(e),r=(n+Py(t))/2;if(Sy(r)<1e-6)return function(e){var t=Ny(e);function n(e,n){return[e*t,Py(n)/t]}return n.invert=function(e,n){return[e/t,$y(n*t)]},n}(e);var i=1+n*(2*r-n),o=zy(i)/r;function a(e,t){var n=zy(i-2*r*Py(t))/r;return[n*Py(e*=r),o-n*Ny(e)]}return a.invert=function(e,t){var n=o-t;return[Ay(e,Sy(n))/r*Ry(n),$y((i-(e*e+n*n)*r*r)/(2*r))]},a}var Ix=function(){return zx(Lx).scale(155.424).center([0,33.6442])},$x=function(){return Ix().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])};function Bx(e){return function(t,n){var r=Ny(t),i=Ny(n),o=e(r*i);return[o*i*Py(t),o*Py(n)]}}function Ux(e){return function(t,n){var r=zy(t*t+n*n),i=e(r),o=Py(i),a=Ny(i);return[Ay(t*o,r*a),$y(r&&n*o/r)]}}var qx=Bx((function(e){return zy(2/(1+e))}));qx.invert=Ux((function(e){return 2*$y(e/2)}));var Wx=Bx((function(e){return(e=Iy(e))&&e/Py(e)}));Wx.invert=Ux((function(e){return e}));function Hx(e,t){return[e,My(Ly((_y+t)/2))]}Hx.invert=function(e,t){return[e,2*Cy(Dy(t))-_y]};function Yx(e){var t,n,r,i=Px(e),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,l=null;function c(){var o=wy*a(),u=i(function(e){function t(t){return(t=e(t[0]*jy,t[1]*jy))[0]*=ky,t[1]*=ky,t}return e=mx(e[0]*jy,e[1]*jy,e.length>2?e[2]*jy:0),t.invert=function(t){return(t=e.invert(t[0]*jy,t[1]*jy))[0]*=ky,t[1]*=ky,t},t}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:e===Hx?[[Math.max(u[0]-o,l),t],[Math.min(u[0]+o,n),r]]:[[l,Math.max(u[1]-o,t)],[n,Math.min(u[1]+o,r)]])}return i.scale=function(e){return arguments.length?(a(e),c()):a()},i.translate=function(e){return arguments.length?(u(e),c()):u()},i.center=function(e){return arguments.length?(o(e),c()):o()},i.clipExtent=function(e){return arguments.length?(null==e?l=t=n=r=null:(l=+e[0][0],t=+e[0][1],n=+e[1][0],r=+e[1][1]),c()):null==l?null:[[l,t],[n,r]]},c()}function Vx(e){return Ly((_y+e)/2)}function Gx(e,t){var n=Ny(e),r=e===t?Py(e):My(n/Ny(t))/My(Vx(t)/Vx(e)),i=n*Fy(Vx(e),r)/r;if(!r)return Hx;function o(e,t){i>0?t<1e-6-_y&&(t=1e-6-_y):t>_y-1e-6&&(t=_y-1e-6);var n=i/Fy(Vx(t),r);return[n*Py(r*e),i-n*Ny(r*e)]}return o.invert=function(e,t){var n=i-t,o=Ry(r)*zy(e*e+n*n);return[Ay(e,Sy(n))/r*Ry(n),2*Cy(Fy(i/o,1/r))-_y]},o}function Xx(e,t){return[e,t]}Xx.invert=Xx;function Kx(e,t){var n=Ny(e),r=e===t?Py(e):(n-Ny(t))/(t-e),i=n/r+e;if(Sy(r)<1e-6)return Xx;function o(e,t){var n=i-t,o=r*e;return[n*Py(o),i-n*Ny(o)]}return o.invert=function(e,t){var n=i-t;return[Ay(e,Sy(n))/r*Ry(n),i-Ry(r)*zy(e*e+n*n)]},o}var Jx=1.340264,Qx=-.081106,Zx=893e-6,ew=.003796,tw=zy(3)/2;function nw(e,t){var n=$y(tw*Py(t)),r=n*n,i=r*r*r;return[e*Ny(n)/(tw*(Jx+3*Qx*r+i*(7*Zx+9*ew*r))),n*(Jx+Qx*r+i*(Zx+ew*r))]}nw.invert=function(e,t){for(var n,r=t,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(Jx+Qx*i+o*(Zx+ew*i))-t)/(Jx+3*Qx*i+o*(7*Zx+9*ew*i)))*r)*i*i,!(Sy(n)<1e-12));++a);return[tw*e*(Jx+3*Qx*i+o*(7*Zx+9*ew*i))/Ny(r),$y(Py(r)/tw)]};function rw(e,t){var n=Ny(t),r=Ny(e)*n;return[n*Py(e)/r,Py(t)/r]}rw.invert=Ux(Cy);function iw(e,t,n,r){return 1===e&&1===t&&0===n&&0===r?cy:Ex({point:function(i,o){this.stream.point(i*e+n,o*t+r)}})}function ow(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}ow.invert=function(e,t){var n,r=t,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Sy(n)>1e-6&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]};function aw(e,t){return[Ny(t)*Py(e),Py(t)]}aw.invert=Ux($y);function uw(e,t){var n=Ny(t),r=1+Ny(e)*n;return[n*Py(e)/r,Py(t)/r]}uw.invert=Ux((function(e){return 2*Cy(e)}));function sw(e,t){return[My(Ly((_y+t)/2)),-e]}sw.invert=function(e,t){return[-t,2*Cy(Dy(e))-_y]};var lw=Math.abs,cw=(Math.atan,Math.atan2,Math.ceil,Math.cos),fw=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),dw=(Math.tan,Math.PI),hw=dw/2,pw=(Math.SQRT1_2,gw(2));gw(dw);function mw(e){return e>1?hw:e<-1?-hw:Math.asin(e)}function gw(e){return e>0?Math.sqrt(e):0}function vw(e,t){var n,r=e*fw(t),i=30;do{t-=n=(t+fw(t)-r)/(1+cw(t))}while(lw(n)>1e-6&&--i>0);return t/2}var yw=function(e,t,n){function r(r,i){return[e*r*cw(i=vw(n,i)),t*fw(i)]}return r.invert=function(r,i){return i=mw(i/t),[r/(e*cw(i)),mw((2*i+fw(2*i))/n)]},r}(pw/hw,pw,dw),bw=Ub(),xw=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function ww(e,t){return function n(){var r=t();return r.type=e,r.path=Ub().projection(r),r.copy=r.copy||function(){var e=n();return xw.forEach((function(t){r[t]&&e[t](r[t]())})),e.path.pointRadius(r.path.pointRadius()),e},r}}function _w(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Ow[e]=ww(e,t),this):Ow[e]||null}function Ew(e){return e&&e.path||bw}var Ow={albers:$x,albersusa:function(){var e,t,n,r,i,o,a=$x(),u=Ix().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Ix().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={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||(r.point(t,a),o)||(i.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(e)},c.stream=function(n){return e&&t===n?e:(r=[a.stream(t=n),u.stream(n),s.stream(n)],i=r.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(var kw in Ow)_w(kw,Ow[kw]);function jw(e){Dr.call(this,null,e)}function Sw(e){Dr.call(this,null,e)}function Cw(e){Dr.call(this,null,e)}function Aw(e,t,n){var r=ux(e,t-1e-6,n).concat(t);return function(e){return r.map((function(t){return[e,t]}))}}function Nw(e,t,n){var r=ux(e,t-1e-6,n).concat(t);return function(e){return r.map((function(t){return[t,e]}))}}function Tw(){var e,t,n,r,i,o,a,u,s,l,c,f,d=10,h=d,p=90,m=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return ux(Ty(r/p)*p,n,p).map(c).concat(ux(Ty(u/m)*m,a,m).map(f)).concat(ux(Ty(t/d)*d,e,d).filter((function(e){return Sy(e%p)>1e-6})).map(s)).concat(ux(Ty(o/h)*h,i,h).filter((function(e){return Sy(e%m)>1e-6})).map(l))}return v.lines=function(){return y().map((function(e){return{type:"LineString",coordinates:e}}))},v.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(u).reverse().slice(1))]}},v.extent=function(e){return arguments.length?v.extentMajor(e).extentMinor(e):v.extentMinor()},v.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],u=+e[0][1],a=+e[1][1],r>n&&(e=r,r=n,n=e),u>a&&(e=u,u=a,a=e),v.precision(g)):[[r,u],[n,a]]},v.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),o>i&&(n=o,o=i,i=n),v.precision(g)):[[t,o],[e,i]]},v.step=function(e){return arguments.length?v.stepMajor(e).stepMinor(e):v.stepMinor()},v.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],v):[p,m]},v.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],v):[d,h]},v.precision=function(d){return arguments.length?(g=+d,s=Aw(o,i,90),l=Nw(t,e,g),c=Aw(u,a,90),f=Nw(r,n,g),v):g},v.extentMajor([[-180,1e-6-90],[180,90-1e-6]]).extentMinor([[-180,-80-1e-6],[180,80+1e-6]])}function Dw(e){Dr.call(this,[],e),this.generator=Tw()}function Mw(e){Dr.call(this,null,e)}function Fw(e){if(!Object(oe.D)(e))return!1;const t=Object(oe.cb)(Object(oe.g)(e));return t.$x||t.$y||t.$value||t.$max}function Pw(e){Dr.call(this,null,e),this.modified(!0)}function Rw(e,t,n){Object(oe.D)(e[t])&&e[t](n)}jw.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"}]},Object(oe.y)(jw,Dr).transform=function(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||oe.x,o=e.as||"path",a=n.SOURCE;!r||e.modified()?(this.value=r=Ew(e.projection),n.materialize().reflow()):a=i===oe.x||t.modified(i.fields)?n.ADD_MOD:n.ADD;var u=function(e,t){var n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(r,e.pointRadius);return n.visit(a,(function(e){e[o]=r(i(e))})),r.pointRadius(u),n.modifies(o)},Sw.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"]}]},Object(oe.y)(Sw,Dr).transform=function(e,t){var n,r=e.projection,i=e.fields[0],o=e.fields[1],a=e.as||["x","y"],u=a[0],s=a[1];function l(e){var t=r([i(e),o(e)]);t?(e[u]=t[0],e[s]=t[1]):(e[u]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(n=t.modified(i.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,l)),t.modifies(a)},Cw.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"}]},Object(oe.y)(Cw,Dr).transform=function(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||"shape",o=n.ADD;return r&&!e.modified()||(this.value=r=function(e,t,n){var r=null==n?function(n){return e(t(n))}:function(r){var i=e.pointRadius(),o=e.pointRadius(n)(t(r));return e.pointRadius(i),o};return r.context=function(t){return e.context(t),r},r}(Ew(e.projection),e.field||Object(oe.t)("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(function(e){e[i]=r})),n.modifies(i)},Dw.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}]},Object(oe.y)(Dw,Dr).transform=function(e,t){var n,r=this.value,i=this.generator;if(!r.length||e.modified())for(var o in e)Object(oe.D)(i[o])&&i[o](e[o]);return n=i(),r.length?t.mod.push(ge(r[0],n)):t.add.push(he(n)),r[0]=n,t},Mw.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"}]},Object(oe.y)(Mw,Dr).transform=function(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r="shared"===e.resolve,i=e.field||oe.x,o=function(e,t){let n;Object(oe.D)(e)?(n=n=>e(n,t),n.dep=Fw(e)):e?n=Object(oe.l)(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),a=function(e,t){let n;Object(oe.D)(e)?(n=n=>Np(e(n,t)),n.dep=Fw(e)):n=Object(oe.l)(Np(e||"#888"));return n}(e.color,e),u=e.as||"image",s={$x:0,$y:0,$value:0,$max:r?Vr(n.map(e=>Vr(i(e).values))):0};return n.forEach(e=>{const t=i(e),n=Object(oe.o)({},e,s);r||(n.$max=Vr(t.values||[])),e[u]=function(e,t,n,r){const i=e.width,o=e.height,a=e.x1||0,u=e.y1||0,s=e.x2||i,l=e.y2||o,c=e.values,f=c?e=>c[e]:oe.jb,d=Gu(s-a,l-u),h=d.getContext("2d"),p=h.getImageData(0,0,s-a,l-u),m=p.data;for(let e=u,o=0;ee.concat(function(e){return"FeatureCollection"===e.type?e.features:Object(oe.i)(e).filter(e=>null!=e).map(e=>"Feature"===e.type?e:{type:"Feature",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)};function zw(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o,a,u,s,l,c,f,d,h=e._root,p={data:r},m=e._x0,g=e._y0,v=e._x1,y=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((l=t>=(o=(m+v)/2))?m=o:v=o,(c=n>=(a=(g+y)/2))?g=a:y=a,i=h,!(h=h[f=c<<1|l]))return i[f]=p,e;if(u=+e._x.call(null,h.data),s=+e._y.call(null,h.data),t===u&&n===s)return p.next=h,i?i[f]=p:e._root=p,e;do{i=i?i[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(m+v)/2))?m=o:v=o,(c=n>=(a=(g+y)/2))?g=a:y=a}while((f=c<<1|l)==(d=(s>=a)<<1|u>=o));return i[d]=h,i[f]=p,e}var Lw=function(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i};function Iw(e){return e[0]}function $w(e){return e[1]}function Bw(e,t,n){var r=new Uw(null==t?Iw:t,null==n?$w:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}function Uw(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function qw(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ww=Bw.prototype=Uw.prototype;Ww.copy=function(){var e,t,n=new Uw(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=qw(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var i=0;i<4;++i)(t=r.source[i])&&(t.length?e.push({source:t,target:r.target[i]=new Array(4)}):r.target[i]=qw(t));return n},Ww.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return zw(this.cover(t,n),t,n,e)},Ww.addAll=function(e){var t,n,r,i,o=e.length,a=new Array(o),u=new Array(o),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;ne||e>=i||r>t||t>=o;)switch(u=(td||(o=s.y0)>h||(a=s.x1)=v)<<1|e>=g)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=y*y+b*b;if(x=(u=(p+g)/2))?p=u:g=u,(c=a>=(s=(m+v)/2))?m=s:v=s,t=h,!(h=h[f=c<<1|l]))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(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):t?(i?t[f]=i: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=i,this)},Ww.removeAll=function(e){for(var t=0,n=e.length;t=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function t_(e,t){for(var n,r=0,i=e.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&t._call.call(null,e),t=t._next;--a_}()}finally{a_=0,function(){var e,t,n=r_,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:r_=t);i_=e,x_(r)}(),c_=0}}function b_(){var e=d_.now(),t=e-l_;t>1e3&&(f_-=t,l_=e)}function x_(e){a_||(u_&&(u_=clearTimeout(u_)),e-c_>24?(e<1/0&&(u_=setTimeout(y_,e-d_.now()-f_)),s_&&(s_=clearInterval(s_))):(s_||(l_=d_.now(),s_=setInterval(b_,1e3)),a_=1,h_(y_)))}function w_(e){return e.x}function __(e){return e.y}g_.prototype=v_.prototype={constructor:g_,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?p_():+n)+(null==t?0:+t),this._next||i_===this||(i_?i_._next=this:r_=this,i_=this),this._call=e,this._time=n,x_()},stop:function(){this._call&&(this._call=null,this._time=1/0,x_())}};var E_=Math.PI*(3-Math.sqrt(5)),O_={center:function(e,t){var n;function r(){var r,i,o=n.length,a=0,u=0;for(r=0;rs+h||il+h||ou.index){var p=s-a.x-a.vx,m=l-a.y-a.vy,g=p*p+m*m;ge.r&&(e.r=e[t].r)}function u(){if(t){var r,i,o=t.length;for(n=new Array(o),r=0;r=a)){(e.data!==t||e.next)&&(0===c&&(h+=(c=Yw())*c),0===f&&(h+=(f=Yw())*f),h[a(e,t,r),e]));for(u=0,i=new Array(l);u1?(null==n?u.delete(e):u.set(e,h(n)),t):u.get(e)},find:function(t,n,r){var i,o,a,u,s,l=0,c=e.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(e,n),t):l.on(e)}}}(e),r=!1,i=n.stop,o=n.restart;return n.stopped=function(){return r},n.restart=function(){return r=!1,o()},n.stop=function(){return r=!0,i()},N_(n,t,!0).on("end",(function(){r=!0}))}(t.source,e),i.on("tick",(n=t.dataflow,r=this,function(){n.touch(r).run()})),e.static||(o=!0,i.tick()),t.modifies("index")),a||o||e.modified(j_)||t.changed()&&e.restart)if(i.alpha(Math.max(i.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),e.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return t.StopPropagation;return this.finish(e,t)},A_.finish=function(e,t){for(var n,r=t.dataflow,i=this._argops,o=0,a=i.length;o=0;)t+=n[r].value;else t=1;e.value=t}function R_(e,t){var n,r,i,o,a,u=new $_(e),s=+e.value&&(u.value=e.value),l=[u];for(null==t&&(t=z_);n=l.pop();)if(s&&(n.value=+n.data.value),(i=t(n.data))&&(a=i.length))for(n.children=new Array(a),o=a-1;o>=0;--o)l.push(r=n.children[o]=new $_(i[o])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(I_)}function z_(e){return e.children}function L_(e){e.data=e.data.data}function I_(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function $_(e){this.data=e,this.depth=this.height=0,this.parent=null}function B_(e){Dr.call(this,null,e)}function U_(e){return e.values}function q_(){var e,t=[];return e={entries:e=>function e(n,r){if(++r>t.length)return n;var i,o=[];for(i in n)o.push({key:i,values:e(n[i],r)});return o}(function e(n,r){if(r>=t.length)return n;for(var i,o,a,u=-1,s=n.length,l=t[r++],c={},f={};++u(t.push(n),e)}}function W_(e){Dr.call(this,null,e)}function H_(e,t){return e.parent===t.parent?1:2}$_.prototype=R_.prototype={constructor:$_,count:function(){return this.eachAfter(P_)},each:function(e){var t,n,r,i,o=this,a=[o];do{for(t=a.reverse(),a=[];o=t.pop();)if(e(o),n=o.children)for(r=0,i=n.length;r=0;--n)i.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].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(),r=t.ancestors(),i=null;e=n.pop(),t=r.pop();for(;e===t;)i=e,e=n.pop(),t=r.pop();return i}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},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 R_(this).eachBefore(L_)}},B_.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},Object(oe.y)(B_,Dr).transform=function(e,t){t.source||Object(oe.n)("Nest transform requires an upstream data source.");var n=e.generate,r=e.modified(),i=t.clone(),o=this.value;return(!o||r||t.changed())&&(o&&o.each(e=>{e.children&&ce(e.data)&&i.rem.push(e.data)}),this.value=o=R_({values:Object(oe.i)(e.keys).reduce((e,t)=>(e.key(t),e),q_()).entries(i.source)},U_),n&&o.each(e=>{e.children&&(e=he(e.data),i.add.push(e),i.source.push(e))}),F_(o,fe,fe)),i.source.root=o,i},Object(oe.y)(W_,Dr).transform=function(e,t){t.source&&t.source.root||Object(oe.n)(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(e.method),r=this.fields,i=t.source.root,o=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(ve(e.sort,e=>e.data)),function(e,t,n){for(var r,i=0,o=t.length;i0&&n*n>r*r+i*i}function J_(e,t){for(var n=0;n(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=e.x-r*u-o*s,n.y=e.y-r*s+o*u):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=t.x+r*u-o*s,n.y=t.y+r*s+o*u)):(n.x=t.x+n.r,n.y=t.y)}function nE(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function rE(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,o=(t.y*n.r+n.y*t.r)/r;return i*i+o*o}function iE(e){this._=e,this.next=null,this.previous=null}function oE(e){if(!(i=e.length))return 0;var t,n,r,i,o,a,u,s,l,c,f;if((t=e[0]).x=0,t.y=0,!(i>1))return t.r;if(n=e[1],t.x=-n.r,n.x=t.r,n.y=0,!(i>2))return t.r+n.r;tE(n,t,r=e[2]),t=new iE(t),n=new iE(n),r=new iE(r),t.next=r.previous=n,n.next=t.previous=r,r.next=n.previous=t;e:for(u=3;u0)throw new Error("cycle");return o}return n.id=function(t){return arguments.length?(e=uE(t),n):e},n.parentId=function(e){return arguments.length?(t=uE(e),n):t},n};function SE(e){Dr.call(this,null,e)}function CE(e,t){return e.parent===t.parent?1:2}function AE(e){var t=e.children;return t?t[0]:e.t}function NE(e){var t=e.children;return t?t[t.length-1]:e.t}function TE(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function DE(e,t,n){return e.a.parent===t.parent?e.a:n}function ME(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}SE.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},Object(oe.y)(SE,Dr).transform=function(e,t){t.source||Object(oe.n)("Stratify transform requires an upstream data source.");var n=this.value,r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),o=!this.value||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),o&&(n=i.source.length?F_(jE().id(e.key).parentId(e.parentKey)(i.source),e.key,oe.fb):F_(jE()([{}]),e.key,e.key)),i.source.root=this.value=n,i},ME.prototype=Object.create($_.prototype);function FE(e,t){return e.parent===t.parent?1:2}function PE(e,t){return e+t.x}function RE(e,t){return Math.max(e,t.y)}var zE={tidy:function(){var e=CE,t=1,n=1,r=null;function i(i){var s=function(e){for(var t,n,r,i,o,a=new ME(e,0),u=[a];t=u.pop();)if(r=t._.children)for(t.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(n=t.children[i]=new ME(r[i],i)),n.parent=t;return(a.parent=new ME(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var l=i,c=i,f=i;i.eachBefore((function(e){e.xc.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=l===c?1:e(l,c)/2,h=d-l.x,p=t/(c.x+d+h),m=n/(f.depth||1);i.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return i}function o(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,i=e.children,o=i.length;--o>=0;)(t=i[o]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,a=t,u=n,s=o.parent.children[0],l=o.m,c=a.m,f=u.m,d=s.m;u=NE(u),o=AE(o),u&&o;)s=AE(s),(a=NE(a)).a=t,(i=u.z+f-o.z-l+e(u._,o._))>0&&(TE(DE(u,t,r),t,i),l+=i,c+=i),f+=u.m,l+=o.m,d+=s.m,c+=a.m;u&&!NE(a)&&(a.t=u,a.m+=f-c),o&&!AE(s)&&(s.t=o,s.m+=l-d,r=t)}return r}(t,i,t.parent.A||r[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function u(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i},cluster:function(){var e=FE,t=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(PE,0)/e.length}(n),t.y=function(e){return 1+e.reduce(RE,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var u=function(e){for(var t;t=e.children;)e=t[0];return e}(i),s=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(i),l=u.x-e(u,s)/2,c=s.x+e(s,u)/2;return i.eachAfter(r?function(e){e.x=(e.x-i.x)*t,e.y=(i.y-e.y)*n}:function(e){e.x=(e.x-l)/(c-l)*t,e.y=(1-(i.y?e.y/i.y:1))*n})}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}},LE=["x","y","depth","children"];function IE(e){W_.call(this,e)}IE.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:LE.length,default:LE}]};var $E=Object(oe.y)(IE,W_);function BE(e){Dr.call(this,[],e)}$E.layout=function(e){var t=e||"tidy";if(Object(oe.v)(zE,t))return zE[t]();Object(oe.n)("Unrecognized Tree layout method: "+t)},$E.params=["size","nodeSize"],$E.fields=LE,BE.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},Object(oe.y)(BE,Dr).transform=function(e,t){var n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),o={};return r||Object(oe.n)("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,(function(e){o[fe(e)]=1})),r.each((function(e){var t=e.data,n=e.parent&&e.parent.data;n&&o[fe(t)]&&o[fe(n)]&&i.add.push(he({source:n,target:t}))})),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,(function(e){o[fe(e)]=1})),n.forEach((function(e){(o[fe(e.source)]||o[fe(e.target)])&&i.mod.push(e)}))),i};var UE=function(e,t,n,r,i){for(var o,a=e.children,u=-1,s=a.length,l=e.value&&(i-n)/e.value;++ud&&(d=u),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=u;break}p=h}v.push(a={value:c,dice:s1?t:1)},n}(qE),YE=function e(t){function n(e,n,r,i,o){if((a=e._squarify)&&a.ratio===t)for(var a,u,s,l,c,f=-1,d=a.length,h=e.value;++f1?t:1)},n}(qE),VE={binary:function(e,t,n,r,i){var o,a,u=e.children,s=u.length,l=new Array(s+1);for(l[0]=a=o=0;o=n-1){var c=u[t];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=s)}var f=l[t],d=r/2+f,h=t+1,p=n-1;for(;h>>1;l[m]s-o){var y=(i*v+a*g)/r;e(t,h,g,i,o,y,s),e(h,n,v,y,o,a,s)}else{var b=(o*v+s*g)/r;e(t,h,g,i,o,a,b),e(h,n,v,i,b,a,s)}}(0,s,e.value,t,n,r,i)},dice:yE,slice:UE,slicedice:function(e,t,n,r,i){(1&e.depth?UE:yE)(e,t,n,r,i)},squarify:HE,resquarify:YE},GE=["x0","y0","x1","y1","depth","children"];function XE(e){W_.call(this,e)}XE.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:GE.length,default:GE}]};var KE=Object(oe.y)(XE,W_);KE.layout=function(){var e=function(){var e=HE,t=!1,n=1,r=1,i=[0],o=sE,a=sE,u=sE,s=sE,l=sE;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(f),i=[0],t&&e.eachBefore(vE),e}function f(t){var n=i[t.depth],r=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f{$i(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{const n={};for(let e=0;e{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const r=c(n,e.x,e.y,u);if(e.params)return void f.push(he({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||Object(oe.p)(n,e.x),h=e=>{const t={};for(let e=0;eh([e,r.predict(e)])):Wi(r.predict,i,25,200).forEach(h)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n};const tO=Math.pow(2,-52),nO=new Uint32Array(512);class rO{static from(e,t=fO,n=dO){const r=e.length,i=new Float64Array(2*r);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:r,_hullHash:i}=this,o=e.length>>1;let a=1/0,u=1/0,s=-1/0,l=-1/0;for(let t=0;ts&&(s=n),r>l&&(l=r),this._ids[t]=t}const c=(a+s)/2,f=(u+l)/2;let d,h,p,m=1/0;for(let t=0;t0&&(h=t,m=n)}let y=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;tr&&(t[n++]=i,r=this._dists[i])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(aO(g,v,y,b,w,_)){const e=h,t=y,n=b;h=p,y=w,b=_,p=e,w=t,_=n}const E=function(e,t,n,r,i,o){const a=n-e,u=r-t,s=i-e,l=o-t,c=a*a+u*u,f=s*s+l*l,d=.5/(a*l-u*s);return{x:e+(l*c-u*f)*d,y:t+(a*f-s*c)*d}}(g,v,y,b,w,_);this._cx=E.x,this._cy=E.y;for(let t=0;t0&&Math.abs(l-o)<=tO&&Math.abs(c-a)<=tO)continue;if(o=l,a=c,s===d||s===h||s===p)continue;let f=0;for(let e=0,t=this._hashKey(l,c);e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[e],u=e-e%3;if(o=u+(e+2)%3,-1===a){if(0===i)break;e=nO[--i];continue}const s=a-a%3,l=u+(e+1)%3,c=s+(a+2)%3,f=t[o],d=t[e],h=t[l],p=t[c];if(uO(r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1])){t[e]=p,t[a]=f;const r=n[c];if(-1===r){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,r),this._link(a,n[o]),this._link(o,c);const u=s+(a+1)%3;i=33306690738754716e-32*Math.abs(a+u)?a-u:0}function aO(e,t,n,r,i,o){return(oO(i,o,e,t,n,r)||oO(e,t,n,r,i,o)||oO(n,r,i,o,e,t))<0}function uO(e,t,n,r,i,o,a,u){const s=e-a,l=t-u,c=n-a,f=r-u,d=i-a,h=o-u,p=c*c+f*f,m=d*d+h*h;return s*(f*m-p*h)-l*(c*m-p*d)+(s*s+l*l)*(c*h-f*d)<0}function sO(e,t,n,r,i,o){const a=n-e,u=r-t,s=i-e,l=o-t,c=a*a+u*u,f=s*s+l*l,d=.5/(a*l-u*s),h=(l*c-u*f)*d,p=(a*f-s*c)*d;return h*h+p*p}function lO(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=e[i],o=t[r];let a=i-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=r}else{let i=n+1,o=r;cO(e,n+r>>1,i),t[e[n]]>t[e[r]]&&cO(e,n,r),t[e[i]]>t[e[r]]&&cO(e,i,r),t[e[n]]>t[e[i]]&&cO(e,n,i);const a=e[i],u=t[a];for(;;){do{i++}while(t[e[i]]u);if(o=o-n?(lO(e,t,i,r),lO(e,t,n,o-1)):(lO(e,t,n,o-1),lO(e,t,i,r))}}function cO(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function fO(e){return e[0]}function dO(e){return e[1]}class hO{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 r=(e=+e)+(n=+n),i=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class pO{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 mO{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t)&&(i=+i)>=(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=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let t,r,o=0,a=0,u=n.length;o1;)i-=2;for(let e=2;e4)for(let e=0;e0){if(t>=this.ymax)return null;(i=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(i=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}}const gO=2*Math.PI;function vO(e){return e[0]}function yO(e){return e[1]}function bO(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class xO{constructor(e){this._delaunator=new rO(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&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],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.sqrt((r[3]-r[1])**2+(r[2]-r[0])**2);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]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],o[r[0]]=1,2===r.length&&(o[r[1]]=0))}voronoi(e){return new mO(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:o}=this;if(this.collinear){const t=this.collinear.indexOf(e);return t>0&&(yield this.collinear[t-1]),void(t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[e]||!s.length)return(e+1)%(s.length>>1);let l=e,c=(t-s[2*e])**2+(n-s[2*e+1])**2;const f=r[e];let d=f;do{let r=u[d];const f=(t-s[2*r])**2+(n-s[2*r+1])**2;if(f=h));)if(t.x=f+i,t.y=d+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>u[0]||t.y+t.y1>u[1]||n&&CO(t,e,u[0])||n&&(l=n,!((a=t).x+a.x1>l[0].x&&a.x+a.x0l[0].y&&a.y+a.y0>5,x=u[0]>>5,w=t.x-(b<<4),_=127&w,E=32-_,O=t.y1-t.y0,k=(t.y+t.y0)*x+(w>>5),j=0;j>>_:0);k+=x}return t.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=2048/t,e.height=2048/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Gu()),f=function(e){var t=[],n=-1;for(;++n>5)*u[1]),h=null,p=l.length,m=-1,g=[],v=l.map((function(u){return{text:e(u),font:t(u),style:r(u),weight:i(u),rotate:o(u),size:~~(n(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}})).sort((function(e,t){return t.size-e.size}));++m>1,y.y=u[1]*(c()+.5)>>1,SO(s,y,v,m),y.hasText&&d(f,y,h)&&(g.push(y),h?AO(h,y):h=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},f.words=function(e){return arguments.length?(l=e,f):l},f.size=function(e){return arguments.length?(u=[+e[0],+e[1]],f):u},f.font=function(e){return arguments.length?(t=TO(e),f):t},f.fontStyle=function(e){return arguments.length?(r=TO(e),f):r},f.fontWeight=function(e){return arguments.length?(i=TO(e),f):i},f.rotate=function(e){return arguments.length?(o=TO(e),f):o},f.text=function(t){return arguments.length?(e=TO(t),f):e},f.spiral=function(e){return arguments.length?(s=DO[e]||e,f):s},f.fontSize=function(e){return arguments.length?(n=TO(e),f):n},f.padding=function(e){return arguments.length?(a=TO(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f};function SO(e,t,n,r){if(!t.sprite){var i=e.context,o=e.ratio;i.clearRect(0,0,2048/o,2048/o);var a,u,s,l,c,f=0,d=0,h=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else a=a+31>>5<<5;if(s>h&&(h=s),f+a>=2048&&(f=0,d+=h,h=0),d+s>=2048)break;i.translate((f+(a>>1))/o,(d+(s>>1))/o),t.rotate&&i.rotate(t.rotate*kO),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=a,t.height=s,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=s>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var w=i.getImageData(0,0,2048/o,2048/o).data,_=[];--r>=0;)if((t=n[r]).hasText){for(u=(a=t.width)>>5,s=t.y1-t.y0,l=0;l>5),j=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;_[k]|=j,E|=j}E?O=c:(t.y0++,s--,c--,d++)}t.y1=t.y0+O,t.sprite=_.slice(0,(t.y1-t.y0)*u)}}}function CO(e,t,n){n>>=5;for(var r,i=e.sprite,o=e.width>>5,a=e.x-(o<<4),u=127&a,s=32-u,l=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f>>u:0))&t[c+d])return!0;c+=n}return!1}function AO(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function NO(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function TO(e){return"function"==typeof e?e:function(){return e}}var DO={archimedean:NO,rectangular:function(e){var t=4*e[0]/e[1],n=0,r=0;return function(e){var i=e<0?-1:1;switch(Math.sqrt(1+4*i*e)-i&3){case 0:n+=t;break;case 1:r+=4;break;case 2:n-=t;break;default:r-=4}return[n,r]}}},MO=["x","y","font","fontSize","fontStyle","fontWeight","angle"],FO=["text","font","rotate","fontSize","fontStyle","fontWeight"];function PO(e){Dr.call(this,jO(),e)}function RO(e){return new Uint8Array(e)}function zO(e){return new Uint16Array(e)}function LO(e){return new Uint32Array(e)}function IO(e,t,n){var r=(t<257?RO:t<65537?zO:LO)(e);return n&&r.set(n),r}PO.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:MO}]},Object(oe.y)(PO,Dr).transform=function(e,t){!e.size||e.size[0]&&e.size[1]||Object(oe.n)("Wordcloud size dimensions must be non-zero.");var n=e.modified();if(n||t.changed(t.ADD_REM)||FO.some((function(n){var r=e[n];return Object(oe.D)(r)&&t.modified(r.fields)}))){var r,i=t.materialize(t.SOURCE).source,o=this.value,a=e.as||MO,u=e.fontSize||14;if(Object(oe.D)(u)?r=e.fontSizeRange:u=Object(oe.l)(u),r){var s=u,l=Gm("sqrt")().domain(Object(oe.p)(i,s)).range(r);u=function(e){return l(s(e))}}i.forEach((function(e){e[a[0]]=NaN,e[a[1]]=NaN,e[a[3]]=0}));for(var c,f,d=o.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(u).random(ni).layout(),h=o.size(),p=h[0]>>1,m=h[1]>>1,g=0,v=d.length;gi?1:0})),function(e,t){return Array.from(t,t=>e[t])}(e,t)}(f,d),l)a=t,u=e,t=Array(l+c),e=LO(l+c),function(e,t,n,r,i,o,a,u,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=t?e:((i=i||new e.constructor(t)).set(e),i);var e,t,i},add:function(e){for(var t,r=0,i=n.length,o=e.length;ri.length||n>t)&&(t=Math.max(n,t),i=IO(e,t,i),o=IO(e,t))}}),e),this._indices=null,this._dims=null}UO.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}}]};var qO=Object(oe.y)(UO,Dr);function WO(e){Dr.call(this,null,e)}qO.transform=function(e,t){return this._dims?e.modified("fields")||e.fields.some((function(e){return t.modified(e.fields)}))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},qO.init=function(e,t){for(var n,r,i=e.fields,o=e.query,a=this._indices={},u=this._dims=[],s=o.length,l=0;lg)for(i=g,o=Math.min(p,v);iv)for(i=Math.max(p,v),o=m;ih)for(i=h,o=Math.min(f,p);ip)for(i=Math.max(f,p),o=d;i",gk[3]="Identifier",gk[4]="Keyword",gk[5]="Null",gk[6]="Numeric",gk[7]="Punctuator",gk[8]="String",gk[9]="RegularExpression";var _k="ILLEGAL",Ek=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]"),Ok=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 kk(e,t){if(!e)throw new Error("ASSERT: "+t)}function jk(e){return e>=48&&e<=57}function Sk(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function Ck(e){return"01234567".indexOf(e)>=0}function Ak(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 Nk(e){return 10===e||13===e||8232===e||8233===e}function Tk(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Ek.test(String.fromCharCode(e))}function Dk(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Ok.test(String.fromCharCode(e))}var Mk={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 Fk(){for(var e;yk1114111||"}"!==e)&&Jk({},"Unexpected token %0",_k),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),r=56320+(t-65536&1023),String.fromCharCode(n,r))}function zk(){var e,t;for(e=vk.charCodeAt(yk++),t=String.fromCharCode(e),92===e&&(117!==vk.charCodeAt(yk)&&Jk({},"Unexpected token %0",_k),++yk,(e=Pk("u"))&&"\\"!==e&&Tk(e.charCodeAt(0))||Jk({},"Unexpected token %0",_k),t=e);yk>>="===(r=vk.substr(yk,4))?{type:7,value:r,start:i,end:yk+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:yk+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:7,value:t,start:i,end:yk+=2}:"<>=!+-*%&|^/".indexOf(a)>=0?{type:7,value:a,start:i,end:++yk}:void Jk({},"Unexpected token %0",_k)}function $k(){var e,t,n;if(kk(jk((n=vk[yk]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=yk,e="","."!==n){if(e=vk[yk++],n=vk[yk],"0"===e){if("x"===n||"X"===n)return++yk,function(e){for(var t="";yk=0&&Jk({},"Invalid regular expression",n),{value:n,literal:t}}(),r=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(e,t){if(parseInt(t,16)<=1114111)return"x";Jk({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Jk({},"Invalid regular expression")}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:yk}}function Uk(){var e;return Fk(),yk>=bk?{type:2,start:yk,end:yk}:Tk(e=vk.charCodeAt(yk))?Lk():40===e||41===e||59===e?Ik():39===e||34===e?function(){var e,t,n,r,i="",o=!1;for(kk("'"===(e=vk[yk])||'"'===e,"String literal must starts with a quote"),t=yk,++yk;yk=0&&yk":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 pj(){var e,t;return e=function(){var e,t,n,r,i,o,a,u,s,l;if(e=xk,s=dj(),0===(i=hj(r=xk)))return s;for(r.prec=i,qk(),t=[e,xk],o=[s,r,a=dj()];(i=hj(xk))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),t.pop(),n=Hk(u,s,a),o.push(n);(r=qk()).prec=i,o.push(r),t.push(xk),n=dj(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=Hk(o[l-1].value,o[l-2],n),l-=2;return n}(),ej("?")&&(qk(),t=pj(),Zk(":"),e=function(e,t,n){var r=new wk("ConditionalExpression");return r.test=e,r.consequent=t,r.alternate=n,r}(e,t,pj())),e}function mj(){var e=pj();if(ej(","))throw new Error("Disabled.");return e}var gj=function(e){yk=0,bk=(vk=e).length,xk=null,Wk();var t=mj();if(2!==xk.type)throw new Error("Unexpect token after expression.");return t},vj={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"},yj=function(e){function t(t,n,r){return function(i){return function(t,n,r,i){var o=e(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(i<0?"":0===i?"()":"("+n.slice(1).map(e).join(",")+")")}(t,i,n,r)}}var n="new Date";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",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&&Object(oe.n)("Missing arguments to clamp function."),t.length>3&&Object(oe.n)("Too many arguments to clamp function.");var 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),join:t("join",null),indexof:t("indexOf",null),lastindexof:t("lastIndexOf",null),slice:t("slice",null),reverse:function(t){return"("+e(t[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase","String",0),lower:t("toLowerCase","String",0),substring:t("substring","String"),split:t("split","String"),replace:t("replace","String"),trim:t("trim","String",0),regexp:"RegExp",test:t("test","RegExp"),if:function(t){t.length<3&&Object(oe.n)("Missing arguments to if function."),t.length>3&&Object(oe.n)("Too many arguments to if function.");var n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}};function bj(e,t){for(var n,r,i=t.fields,o=t.values,a=i.length,u=0;u=0})):t},R_union:function(e,t){var n=Object(oe.bb)(t[0]),r=Object(oe.bb)(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}};function wj(e,t,n,r){"Literal"!==t[0].type&&Object(oe.n)("First argument to selection functions must be a string literal.");const i=t[0].value,o=":"+i;"intersect"!==(t.length>=2&&Object(oe.T)(t).value)||Object(oe.v)(r,"@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),Object(oe.v)(r,o)||(r[o]=n.getData(i).tuplesRef())}function _j(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ej(e){const t=Np(e);return.2126*_j(t.r)+.7152*_j(t.g)+.0722*_j(t.b)}function Oj(e){const t=this.context.data[e];return t?t.values.value:[]}const kj={};function jj(e,t,n){let r=e+":"+n,i=kj[r];return i&&i[0]===t||(kj[r]=i=[t,t(n)]),i[1]}function Sj(e,t){return jj("timeFormat",tu,t)(e)}var Cj=new Date(2e3,0,1);function Aj(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(Cj.setYear(2e3),Cj.setMonth(e),Cj.setDate(t),Sj(Cj,n)):""}function Nj(e,t){let n;return Object(oe.D)(e)?e:Object(oe.H)(e)?(n=t.scales[e])&&n.value:void 0}var Tj,Dj,Mj,Fj,Pj,Rj=vy(),zj=vy(),Lj={point:By,lineStart:By,lineEnd:By,polygonStart:function(){Rj.reset(),Lj.lineStart=Ij,Lj.lineEnd=$j},polygonEnd:function(){var e=+Rj;zj.add(e<0?Oy+e:e),this.lineStart=this.lineEnd=this.point=By},sphere:function(){zj.add(Oy)}};function Ij(){Lj.point=Bj}function $j(){Uj(Tj,Dj)}function Bj(e,t){Lj.point=Uj,Tj=e,Dj=t,Mj=e*=jy,Fj=Ny(t=(t*=jy)/2+Ey),Pj=Py(t)}function Uj(e,t){var n=(e*=jy)-Mj,r=n>=0?1:-1,i=r*n,o=Ny(t=(t*=jy)/2+Ey),a=Py(t),u=Pj*a,s=Fj*o+u*Ny(i),l=u*r*Py(i);Rj.add(Ay(l,s)),Mj=e,Fj=o,Pj=a}var qj,Wj,Hj,Yj,Vj,Gj,Xj,Kj,Jj,Qj,Zj=vy(),eS={point:tS,lineStart:rS,lineEnd:iS,polygonStart:function(){eS.point=oS,eS.lineStart=aS,eS.lineEnd=uS,Zj.reset(),Lj.polygonStart()},polygonEnd:function(){Lj.polygonEnd(),eS.point=tS,eS.lineStart=rS,eS.lineEnd=iS,Rj<0?(qj=-(Hj=180),Wj=-(Yj=90)):Zj>1e-6?Yj=90:Zj<-1e-6&&(Wj=-90),Qj[0]=qj,Qj[1]=Hj},sphere:function(){qj=-(Hj=180),Wj=-(Yj=90)}};function tS(e,t){Jj.push(Qj=[qj=e,Hj=e]),tYj&&(Yj=t)}function nS(e,t){var n=Xb([e*jy,t*jy]);if(Kj){var r=Jb(Kj,n),i=Jb([r[1],-r[0],0],r);ex(i),i=Gb(i);var o,a=e-Vj,u=a>0?1:-1,s=i[0]*ky*u,l=Sy(a)>180;l^(u*VjYj&&(Yj=o):l^(u*Vj<(s=(s+360)%360-180)&&sYj&&(Yj=t)),l?esS(qj,Hj)&&(Hj=e):sS(e,Hj)>sS(qj,Hj)&&(qj=e):Hj>=qj?(eHj&&(Hj=e)):e>Vj?sS(qj,e)>sS(qj,Hj)&&(Hj=e):sS(e,Hj)>sS(qj,Hj)&&(qj=e)}else Jj.push(Qj=[qj=e,Hj=e]);tYj&&(Yj=t),Kj=n,Vj=e}function rS(){eS.point=nS}function iS(){Qj[0]=qj,Qj[1]=Hj,eS.point=tS,Kj=null}function oS(e,t){if(Kj){var n=e-Vj;Zj.add(Sy(n)>180?n+(n>0?360:-360):n)}else Gj=e,Xj=t;Lj.point(e,t),nS(e,t)}function aS(){Lj.lineStart()}function uS(){oS(Gj,Xj),Lj.lineEnd(),Sy(Zj)>1e-6&&(qj=-(Hj=180)),Qj[0]=qj,Qj[1]=Hj,Kj=null}function sS(e,t){return(t-=e)<0?t+360:t}function lS(e,t){return e[0]-t[0]}function cS(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tsS(r[0],r[1])&&(r[1]=i[1]),sS(i[0],r[1])>sS(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];t<=n;r=i,++t)i=o[t],(u=sS(r[1],i[0]))>a&&(a=u,qj=i[0],Hj=r[1])}return Jj=Qj=null,qj===1/0||Wj===1/0?[[NaN,NaN],[NaN,NaN]]:[[qj,Wj],[Hj,Yj]]})),BS=LS("centroid",(function(e){fS=dS=hS=pS=mS=gS=vS=yS=bS=xS=wS=0,gy(e,SS);var t=bS,n=xS,r=wS,i=t*t+n*n+r*r;return i<1e-12&&(t=gS,n=vS,r=yS,dS<1e-6&&(t=hS,n=pS,r=mS),(i=t*t+n*n+r*r)<1e-12)?[NaN,NaN]:[Ay(n,t)*ky,$y(r/zy(i))*ky]}));function US(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function qS(e,t){return e===t||e!=e&&t!=t||(Object(oe.A)(e)?!(!Object(oe.A)(t)||e.length!==t.length)&&function(e,t){for(let n=0,r=e.length;nWS(e,t)}const YS={};function VS(e){return e.data}function GS(e,t){const n=Oj.call(t,e);return n.root&&n.root.lookup||YS}const XS="undefined"!=typeof window&&window||null;function KS(e,t,n,r){"Literal"!==t[0].type&&Object(oe.n)("First argument to data functions must be a string literal.");const i=t[0].value,o=":"+i;if(!Object(oe.v)(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(e){}}function JS(e,t,n,r){if("Literal"===t[0].type)QS(n,r,t[0].value);else if("Identifier"===t[0].type)for(e in n.scales)QS(n,r,e)}function QS(e,t,n){const r="%"+n;if(!Object(oe.v)(t,r))try{t[r]=e.scaleRef(n)}catch(e){}}const ZS={random:function(){return ni()},cumulativeNormal:hi,cumulativeLogNormal:bi,cumulativeUniform:ki,densityNormal:di,densityLogNormal:yi,densityUniform:Oi,quantileNormal:pi,quantileLogNormal:xi,quantileUniform:ji,sampleNormal:fi,sampleLogNormal:vi,sampleUniform:Ei,isArray:oe.A,isBoolean:oe.B,isDate:oe.C,isDefined:function(e){return void 0!==e},isNumber:oe.E,isObject:oe.F,isRegExp:oe.G,isString:oe.H,isTuple:ce,isValid:function(e){return null!=e&&e==e},toBoolean:oe.Z,toDate:oe.ab,toNumber:oe.bb,toString:oe.db,flush:oe.u,lerp:oe.J,merge:function(){var e=[].slice.call(arguments);return e.unshift({}),oe.o.apply(null,e)},pad:oe.O,peek:oe.T,span:oe.W,inrange:oe.z,truncate:oe.eb,rgb:Np,lab:Og,hcl:Tg,hsl:zp,luminance:Ej,contrast:function(e,t){const n=Ej(e),r=Ej(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:Go,format:function(e,t){return jj("format",Xh,t)(e)},utcFormat:function(e,t){return jj("utcFormat",nu,t)(e)},utcParse:function(e,t){return jj("utcParse",Jt,t)(e)},utcOffset:Xa,utcSequence:Qa,timeFormat:Sj,timeParse:function(e,t){return jj("timeParse",Xt,t)(e)},timeOffset:Ga,timeSequence:Ja,timeUnitSpecifier:eu,monthFormat:function(e){return Aj(e,1,"%B")},monthAbbrevFormat:function(e){return Aj(e,1,"%b")},dayFormat:function(e){return Aj(0,2+e,"%A")},dayAbbrevFormat:function(e){return Aj(0,2+e,"%a")},quarter:oe.U,utcquarter:oe.gb,warn:function(){return US(this.context.dataflow,"warn",arguments)},info:function(){return US(this.context.dataflow,"info",arguments)},debug:function(){return US(this.context.dataflow,"debug",arguments)},extent:oe.p,inScope:function(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:function(e,t,n){if(!e)return[];const[r,i]=e,o=(new Iu).set(r[0],r[1],i[0],i[1]);return qd(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=Object(oe.i)(e.marktype),r=Object(oe.i)(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!r.length||r.some(t=>e.name===t))}return t}(t))},clampRange:oe.j,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){return XS?XS.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(){return XS?[XS.innerWidth,XS.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Th(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(oe.fb).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?ul(n,t=t||Ks(e)):e}},panLinear:oe.P,panLog:oe.Q,panPow:oe.R,panSymlog:oe.S,zoomLinear:oe.kb,zoomLog:oe.lb,zoomPow:oe.mb,zoomSymlog:oe.nb,encode:function(e,t,n){if(e){const n=this.context.dataflow,r=e.mark.source;n.pulse(r,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,r,i,o){let a,u,s=this.context.dataflow,l=this.context.data[e],c=l.input,f=l.changes,d=s.stamp();if(!1===s._trigger||!(c.value.length||t||r))return 0;if((!f||f.stampo.stop(l(t),e(t))),o}),JS),nC("geoArea",IS,JS),nC("geoBounds",$S,JS),nC("geoCentroid",BS,JS),nC("geoShape",(function(e,t,n){const r=Nj(e,(n||this).context);return function(e){return r?r.path.context(e)(t):""}}),JS),nC("indata",(function(e,t,n){const r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(e,t,n,r){"Literal"!==t[0].type&&Object(oe.n)("First argument to indata must be a string literal."),"Literal"!==t[1].type&&Object(oe.n)("Second argument to indata must be a string literal.");const i=t[0].value,o=t[1].value,a="@"+o;Object(oe.v)(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),nC("data",Oj,KS),nC("treePath",(function(e,t,n){const r=GS(e,this),i=r[t],o=r[n];return i&&o?i.path(o).map(VS):void 0}),KS),nC("treeAncestors",(function(e,t){const n=GS(e,this)[t];return n?n.ancestors().map(VS):void 0}),KS),nC("vlSelectionTest",(function(e,t,n){for(var r,i,o,a,u,s=this.context.data[e],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,f="intersect"===n,d=l.length,h=0;h(e[i[n].field]=t,e),{}))}return t=t||"union",Object.keys(g).forEach((function(e){g[e]=Object.keys(g[e]).map(t=>g[e][t]).reduce((n,r)=>void 0===n?r:xj[y[e]+"_"+t](n,r))})),m=Object.keys(v),n&&m.length&&(g.vlMulti="union"===t?{or:m.reduce((e,t)=>(e.push.apply(e,v[t]),e),[])}:{and:m.map(e=>({or:v[e]}))}),g}),wj);const rC={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(e){return"_["+Object(oe.Y)("$"+e)+"]"},functions:function(e){const t=yj(e);eC.forEach(e=>t[e]="event.vega."+e);for(let e in ZS)t[e]="this."+e;return t},constants:vj,visitors:tC};var iC=function(e){var t=(e=e||{}).whitelist?Object(oe.cb)(e.whitelist):{},n=e.blacklist?Object(oe.cb)(e.blacklist):{},r=e.constants||vj,i=(e.functions||yj)(f),o=e.globalvar,a=e.fieldvar,u={},s={},l=0,c=Object(oe.D)(o)?o:function(e){return o+'["'+e+'"]'};function f(e){if(Object(oe.H)(e))return e;var t=d[e.type];return null==t&&Object(oe.n)("Unsupported type: "+e.type),t(e)}var d={Literal:function(e){return e.raw},Identifier:function(e){var i=e.name;return l>0?i:Object(oe.v)(n,i)?Object(oe.n)("Illegal identifier: "+i):Object(oe.v)(r,i)?r[i]:Object(oe.v)(t,i)?i:(u[i]=1,c(i))},MemberExpression:function(e){var t=!e.computed,n=f(e.object);t&&(l+=1);var r=f(e.property);return n===a&&(s[function(e){var t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(r)]=1),t&&(l-=1),n+(t?"."+r:"["+r+"]")},CallExpression:function(e){"Identifier"!==e.callee.type&&Object(oe.n)("Illegal callee type: "+e.callee.type);var t=e.callee.name,n=e.arguments,r=Object(oe.v)(i,t)&&i[t];return r||Object(oe.n)("Unrecognized function: "+t),Object(oe.D)(r)?r(n):r+"("+n.map(f).join(",")+")"},ArrayExpression:function(e){return"["+e.elements.map(f).join(",")+"]"},BinaryExpression:function(e){return"("+f(e.left)+e.operator+f(e.right)+")"},UnaryExpression:function(e){return"("+e.operator+f(e.argument)+")"},ConditionalExpression:function(e){return"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")"},LogicalExpression:function(e){return"("+f(e.left)+e.operator+f(e.right)+")"},ObjectExpression:function(e){return"{"+e.properties.map(f).join(",")+"}"},Property:function(e){l+=1;var t=f(e.key);return l-=1,t+":"+f(e.value)}};function h(e){var t={code:f(e),globals:Object.keys(u),fields:Object.keys(s)};return u={},s={},t}return h.functions=i,h.constants=r,h}(rC);function oC(e,t,n){";"!==t[t.length-1]&&(t="return("+t+");");var r=Function.apply(null,e.concat(t));return n&&n.functions?r.bind(n.functions):r}function aC(e,t){return oC(["event"],e,t)}function uC(e,t){return oC(["item","_"],e,t)}function sC(e,t,n){var r,i;for(r in n=n||{},e)i=e[r],n[r]=Object(oe.A)(i)?i.map((function(e){return lC(e,t,n)})):lC(i,t,n);return n}function lC(e,t,n){if(!e||!Object(oe.F)(e))return e;for(var r,i=0,o=cC.length;i{t.forEach(t=>{Object(oe.A)(e[t])&&(e[t]=Object(oe.cb)(e[t]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig);var r=function(e,t,n){return pC(t,gC(e,Fr,n||ZS))}(this,e,t.functions);this._runtime=r,this._signals=r.signals,this._bind=(e.bindings||[]).map((function(e){return{state:null,param:Object(oe.o)({},e)}})),r.root&&r.root.set(n),n.source=r.data.root.input,this.pulse(r.data.root.input,this.changeset().insert(n.items)),this._background=t.background||r.background||null,this._width=this.width(),this._height=this.height(),this._viewWidth=xC(this,this._width),this._viewHeight=wC(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(e){var t=e._signals,n=t.width,r=t.height,i=t.padding;function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(function(t){e._width=t.size,e._viewWidth=xC(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(function(t){e._height=t.size,e._viewHeight=wC(e,t.size),o()}),{size:r});var a=e.add(null,o,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(this),YO(this),t.hover&&this.hover(),t.container&&this.initialize(t.container,t.bind)}var CC=Object(oe.y)(SC,Ar);function AC(e,t){return Object(oe.v)(e._signals,t)?e._signals[t]:Object(oe.n)("Unrecognized signal name: "+Object(oe.Y)(t))}function NC(e,t){var n=(e._targets||[]).filter((function(e){var n=e._update;return n&&n.handler===t}));return n.length?n[0]:null}function TC(e,t,n,r){var i=NC(n,r);return i||((i=hk(this,(function(){r(t,n.value)}))).handler=r,e.on(n,null,i)),e}function DC(e,t,n){var r=NC(t,n);return r&&t._targets.remove(r),e}CC.evaluate=async function(e,t,n){if(await Ar.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,i=JO(r=this),o=XO(r),a=KO(r),r._renderer.background(r._background),r._renderer.resize(o,a,i),r._handler.origin(i),r._resizeListeners.forEach((function(e){try{e(o,a)}catch(e){r.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var r,i,o,a;return n&&ue(this,n),this},CC.dirty=function(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},CC.container=function(){return this._el},CC.scenegraph=function(){return this._scenegraph},CC.origin=function(){return this._origin.slice()},CC.signal=function(e,t,n){var r=AC(this,e);return 1===arguments.length?r.value:this.update(r,t,n)},CC.background=function(e){return arguments.length?(this._background=e,this._resize=1,this):this._background},CC.width=function(e){return arguments.length?this.signal("width",e):this.signal("width")},CC.height=function(e){return arguments.length?this.signal("height",e):this.signal("height")},CC.padding=function(e){return arguments.length?this.signal("padding",e):this.signal("padding")},CC.autosize=function(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},CC.renderer=function(e){return arguments.length?(Ud(e)||Object(oe.n)("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},CC.tooltip=function(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},CC.loader=function(e){return arguments.length?(e!==this._loader&&(Ar.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},CC.resize=function(){return this._autosize=1,this.touch(AC(this,"autosize"))},CC._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},CC._resizeView=function(e,t,n,r,i,o){this.runAfter((function(a){var u=0;a._autosize=0,a.width()!==n&&(u=1,a.signal("width",n,bC),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal("height",r,bC),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]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter(e=>e.resize())}),!1,1)},CC.addEventListener=function(e,t,n){var r=t;return n&&!1===n.trap||((r=hk(this,t)).raw=t),this._handler.on(e,r),this},CC.removeEventListener=function(e,t){for(var n,r,i=this._handler.handlers(e),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,e===r&&(t===n||t===n.raw)){this._handler.off(r,n);break}return this},CC.addResizeListener=function(e){var t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},CC.removeResizeListener=function(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},CC.addSignalListener=function(e,t){return TC(this,e,AC(this,e),t)},CC.removeSignalListener=function(e,t){return DC(this,AC(this,e),t)},CC.addDataListener=function(e,t){return TC(this,e,VO(this,e).values,t)},CC.removeDataListener=function(e,t){return DC(this,VO(this,e).values,t)},CC.preventDefault=function(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},CC.timer=function(e,t){this._timers.push(function(e,t,n){var r=new g_,i=t;return null==t?(r.restart(e,t,n),r):(t=+t,n=null==n?p_():+n,r.restart((function o(a){a+=i,r.restart(o,i+=t,n),e(a)}),t,n),r)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},CC.events=function(e,t,n){var r,i=this,o=new Ae(n),a=function(n,r){i.runAsync(null,()=>{"view"===e&&function(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[t]:i?!i[t]:e.preventDefault()))}(i,t)&&n.preventDefault(),o.receive(QO(i,n,r))})};if("timer"===e)ek(i,"timer",t)&&i.timer(a,t);else if("view"===e)ek(i,"view",t)&&i.addEventListener(t,a,ZO);else if("window"===e?ek(i,"window",t)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&ek(i,"selector",t)&&(r=document.querySelectorAll(e)),r){for(var u=0,s=r.length;u=0;)i[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 r&&r.call(this,this._handler,null,null,null),this},CC.hover=function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",tk),nk,rk(e)),this.on(this.events("view","mouseout",tk),nk,rk(t)),this},CC.data=function(e,t){return arguments.length<2?VO(this,e).values.value:GO.call(this,e,be().remove(oe.fb).insert(t))},CC.change=GO,CC.insert=function(e,t){return GO.call(this,e,be().insert(t))},CC.remove=function(e,t){return GO.call(this,e,be().remove(t))},CC.scale=function(e){var t=this._runtime.scales;return Object(oe.v)(t,e)||Object(oe.n)("Unrecognized scale or projection: "+e),t[e].value},CC.initialize=function(e,t){var n,r,i=this,o=i._renderType,a=i._eventConfig.bind,u=Ud(o);return e=i._el=e?pk(i,e):null,u||i.error("Unrecognized renderer type: "+o),n=u.handler||td,r=e?u.renderer:u.headless,i._renderer=r?dk(i,i._renderer,e,r):null,i._handler=function(e,t,n,r){var i=new r(e.loader(),hk(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,JO(e),e);return t&&t.handlers().forEach((function(e){i.on(e.type,e.handler)})),i}(i,i._handler,e,n),i._redraw=!0,e&&"none"!==a&&(t=t?i._elBind=pk(i,t):e.appendChild(ik("div",{class:"vega-bindings"})),i._bind.forEach((function(e){e.param.element&&"container"!==a&&(e.element=pk(i,e.param.element))})),i._bind.forEach((function(e){ok(i,e.element||t,e)}))),i},CC.toImageURL=async function(e,t){e!==$d.Canvas&&e!==$d.SVG&&e!==$d.PNG&&Object(oe.n)("Unrecognized image type: "+e);const n=await mk(this,e,t);return e===$d.SVG?(r=n.svg(),i=new Blob([r],{type:"image/svg+xml"}),window.URL.createObjectURL(i)):n.canvas().toDataURL("image/png");var r,i},CC.toCanvas=async function(e,t){return(await mk(this,$d.Canvas,e,t)).canvas()},CC.toSVG=async function(e){return(await mk(this,$d.SVG,e)).svg()},CC.getState=function(e){return this._runtime.getState(e||{data:_C,signals:EC,recurse:!0})},CC.setState=function(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this};function MC(e){return+e||0}var FC=["value","update","init","react","bind"];function PC(e,t){Object(oe.n)(e+' for "outer" push: '+Object(oe.Y)(t))}var RC=function(e,t){var n=e.name;if("outer"===e.push)t.signals[n]||PC("No prior signal definition",n),FC.forEach((function(t){void 0!==e[t]&&PC("Invalid property ",t)}));else{var r=t.addSignal(n,e.value);!1===e.react&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}},zC=function(e,t,n){var r,i,o={};try{e=Object(oe.H)(e)?e:Object(oe.Y)(e)+"",r=gj(e)}catch(t){Object(oe.n)("Expression parse error: "+e)}return r.visit((function(e){if("CallExpression"===e.type){var n=e.callee.name,r=rC.visitors[n];r&&r(n,e.arguments,t,o)}})),(i=iC(r)).globals.forEach((function(e){var n="$"+e;!Object(oe.v)(o,n)&&t.getSignal(e)&&(o[n]=t.signalRef(e))})),{$expr:n?n+"return("+i.code+");":i.code,$fields:i.fields,$params:o}};function LC(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function IC(e,t,n,r){return new LC(e,t,n,r)}function $C(e,t){return IC("operator",e,t)}function BC(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function UC(e,t){return t?{$field:e,$name:t}:{$field:e}}var qC=UC("key");function WC(e,t){return{$compare:e,$order:t}}function HC(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function YC(e){return e&&e.signal}function VC(e){if(YC(e))return!0;if(Object(oe.F)(e))for(var t in e)if(VC(e[t]))return!0;return!1}function GC(e,t){return null!=e?e:t}function XC(e){return e&&e.signal||e}function KC(e,t){return(e.merge?JC:e.stream?QC:e.type?ZC:Object(oe.n)("Invalid stream specification: "+Object(oe.Y)(e)))(e,t)}function JC(e,t){var n=eA({merge:e.merge.map(e=>KC(e,t))},e,t);return t.addStream(n).id}function QC(e,t){var n=eA({stream:KC(e.stream,t)},e,t);return t.addStream(n).id}function ZC(e,t){var n,r,i;return"timer"===e.type?(n=t.event("timer",e.throttle),e={between:e.between,filter:e.filter}):n=t.event("scope"===(i=e.source)?"view":i||"view",e.type),r=eA({stream:n},e,t),1===Object.keys(r).length?n:t.addStream(r).id}function eA(e,t,n){var r,i,o,a,u=t.between;return u&&(2!==u.length&&Object(oe.n)('Stream "between" parameter must have 2 entries: '+Object(oe.Y)(t)),e.between=[KC(u[0],n),KC(u[1],n)]),u=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&u.push((r=t.marktype,i=t.markname,o=t.markrole,(a="event.item")+(r&&"*"!==r?"&&"+a+".mark.marktype==='"+r+"'":"")+(o?"&&"+a+".mark.role==='"+o+"'":"")+(i?"&&"+a+".mark.name==='"+i+"'":""))),"scope"===t.source&&u.push("inScope(event.item)"),u.length&&(e.filter=zC("("+u.join(")&&(")+")").$expr),null!=(u=t.throttle)&&(e.throttle=+u),null!=(u=t.debounce)&&(e.debounce=+u),t.consume&&(e.consume=!0),e}var tA,nA,rA=function(e,t,n){return tA=t||iA,nA=n||aA,sA(e.trim()).map(lA)},iA="view",oA=/[[\]{}]/,aA={"*":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};function uA(e,t,n,r,i){for(var o,a=0,u=e.length;t=0?--a:r&&r.indexOf(o)>=0&&++a}return t}function sA(e){for(var t=[],n=0,r=e.length,i=0;i"!==(e=e.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+e;if(t=t.map(lA),(n=lA(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t;return n}(e):function(e){var t,n,r={source:tA},i=[],o=[0,0],a=0,u=0,s=e.length,l=0;if("}"===e[s-1]){if(!((l=e.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+e;try{o=function(e){var t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((function(t){var n=+t;if(n!=n)throw e;return n}))}(e.substring(l+1,s-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,l).trim(),s=e.length,l=0}if(!s)throw e;"@"===e[0]&&(a=++l);(t=uA(e,l,":"))1?(r.type=i[1],a?r.markname=i[0].slice(1):(c=i[0],nA[c]?r.marktype=i[0]:r.source=i[0])):r.type=i[0];var c;"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);o[0]&&(r.throttle=o[0]);o[1]&&(r.debounce=o[1]);return r}(e)}var cA=function(e,t,n){var r=e.events,i=e.update,o=e.encode,a=[],u={target:n};r||Object(oe.n)("Signal update missing events specification."),Object(oe.H)(r)&&(r=rA(r,t.isSubscope()?"scope":"view")),r=Object(oe.i)(r).filter(e=>e.signal||e.scale?(a.push(e),0):1),a.length>1&&(a=[fA(a)]),r.length&&a.push(r.length>1?{merge:r}:r[0]),null!=o&&(i&&Object(oe.n)("Signal encode and update are mutually exclusive."),i="encode(item(),"+Object(oe.Y)(o)+")"),u.update=Object(oe.H)(i)?zC(i,t,"var datum=event.item&&event.item.datum;"):null!=i.expr?zC(i.expr,t,"var datum=event.item&&event.item.datum;"):null!=i.value?i.value:null!=i.signal?{$expr:"_.value",$params:{value:t.signalRef(i.signal)}}:Object(oe.n)("Invalid signal update specification."),e.force&&(u.options={force:!0}),a.forEach((function(e){t.addUpdate(Object(oe.o)(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):KC(e,t)}}(e,t),u))}))};function fA(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function dA(e){return function(t,n,r){return IC(e,n,t||void 0,r)}}var hA=dA("aggregate"),pA=dA("axisticks"),mA=dA("bound"),gA=dA("collect"),vA=dA("compare"),yA=dA("datajoin"),bA=dA("encode"),xA=dA("expression"),wA=(dA("extent"),dA("facet")),_A=dA("field"),EA=dA("key"),OA=dA("legendentries"),kA=dA("load"),jA=dA("mark"),SA=dA("multiextent"),CA=dA("multivalues"),AA=dA("overlap"),NA=dA("params"),TA=dA("prefacet"),DA=dA("projection"),MA=dA("proxy"),FA=dA("relay"),PA=dA("render"),RA=dA("scale"),zA=dA("sieve"),LA=dA("sortitems"),IA=dA("viewlayout"),$A=dA("values"),BA=0,UA={min:"min",max:"max",count:"sum"};function qA(e,t){var n,r,i=t.getScale(e.name).params;for(n in i.domain=VA(e.domain,e,t),null!=e.range&&(i.range=function e(t,n,r){var i=t.range,o=n.config.range;if(i.signal)return n.signalRef(i.signal);if(Object(oe.H)(i)){if(o&&Object(oe.v)(o,i))return t=Object(oe.o)({},t,{range:o[i]}),e(t,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=Qm(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Object(oe.n)("Unrecognized scale range value: "+Object(oe.Y)(i))}else{if(i.scheme)return r.scheme=Object(oe.A)(i.scheme)?HA(i.scheme,n):WA(i.scheme,n),i.extent&&(r.schemeExtent=HA(i.extent,n)),void(i.count&&(r.schemeCount=WA(i.count,n)));if(i.step)return void(r.rangeStep=WA(i.step,n));if(Qm(t.type)&&!Object(oe.A)(i))return VA(i,t,n);Object(oe.A)(i)||Object(oe.n)("Unsupported range type: "+Object(oe.Y)(i))}return i.map(e=>(Object(oe.A)(e)?HA:WA)(e,n))}(e,t,i)),null!=e.interpolate&&function(e,t){t.interpolate=WA(e.type||e),null!=e.gamma&&(t.interpolateGamma=WA(e.gamma))}(e.interpolate,i),null!=e.nice&&(i.nice=(r=e.nice,Object(oe.F)(r)?{interval:WA(r.interval),step:WA(r.step)}:WA(r))),null!=e.bins&&(i.bins=function(e,t){return e.signal||Object(oe.A)(e)?HA(e,t):t.objectProperty(e)}(e.bins,t)),e)Object(oe.v)(i,n)||"name"===n||(i[n]=WA(e[n],t))}function WA(e,t){return Object(oe.F)(e)?e.signal?t.signalRef(e.signal):Object(oe.n)("Unsupported object: "+Object(oe.Y)(e)):e}function HA(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>WA(e,t))}function YA(e){Object(oe.n)("Can not find data set: "+Object(oe.Y)(e))}function VA(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Object(oe.A)(e)?GA:e.fields?KA:XA)(e,t,n);null==t.domainMin&&null==t.domainMax||Object(oe.n)("No scale domain defined for domainMin/domainMax to override.")}function GA(e,t,n){return e.map((function(e){return WA(e,n)}))}function XA(e,t,n){var r=n.getData(e.data);return r||YA(e.data),Qm(t.type)?r.valuesRef(n,e.field,QA(e.sort,!1)):ng(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function KA(e,t,n){var r=e.data,i=e.fields.reduce((function(e,t){return t=Object(oe.H)(t)?{data:r,field:t}:Object(oe.A)(t)||t.signal?function(e,t){var n="_:vega:_"+BA++,r=gA({});if(Object(oe.A)(e))r.value={$ingest:e};else if(e.signal){var i="setdata("+Object(oe.Y)(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,zA({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e}),[]);return(Qm(t.type)?JA:ng(t.type)?ZA:eN)(e,n,i)}function JA(e,t,n){var r,i,o,a,u,s=QA(e.sort,!0);return r=n.map((function(e){var n=t.getData(e.data);return n||YA(e.data),n.countsRef(t,e.field,s)})),i={groupby:qC,pulse:r},s&&(o=s.op||"count",u=s.field?HC(o,s.field):"count",i.ops=[UA[o]],i.fields=[t.fieldRef(u)],i.as=[u]),o=t.add(hA(i)),a=t.add(gA({pulse:BC(o)})),u=t.add($A({field:qC,sort:t.sortRef(s),pulse:BC(a)})),BC(u)}function QA(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!UA[e.op]&&Object(oe.n)("Multiple domain scales can not be sorted using "+e.op):Object(oe.n)("No field provided for sort aggregate op: "+e.op):Object(oe.F)(e)?e.field="key":e={field:"key"}),e}function ZA(e,t,n){var r=n.map((function(e){var n=t.getData(e.data);return n||YA(e.data),n.domainRef(t,e.field)}));return BC(t.add(CA({values:r})))}function eN(e,t,n){var r=n.map((function(e){var n=t.getData(e.data);return n||YA(e.data),n.extentRef(t,e.field)}));return BC(t.add(SA({extents:r})))}function tN(e,t,n){return Object(oe.A)(e)?e.map((function(e){return tN(e,t,n)})):Object(oe.F)(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:Object(oe.n)("Unsupported parameter object: "+Object(oe.Y)(e)):e}const nN="value",rN=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],iN={name:1,style:1,interactive:1},oN={value:0},aN={value:1};var uN=Object(oe.cb)(["rule"]),sN=Object(oe.cb)(["group","image","rect"]),lN=function(e,t,n,r){var i=zC(e,t);return i.$fields.forEach((function(e){r[e]=1})),Object(oe.o)(n,i.$params),i.$expr},cN=function(e,t,n,r){return function e(t,n,r,i){var o,a,u;if(t.signal)o="datum",u=lN(t.signal,n,r,i);else if(t.group||t.parent){for(a=Math.max(1,t.level||1),o="item";a-- >0;)o+=".mark.group";t.parent?(u=t.parent,o+=".datum"):u=t.group}else t.datum?(o="datum",u=t.datum):Object(oe.n)("Invalid field reference: "+Object(oe.Y)(t));t.signal||(Object(oe.H)(u)?(i[u]=1,u=Object(oe.X)(u).map(oe.Y).join("][")):u=e(u,n,r,i));return o+"["+u+"]"}(Object(oe.F)(e)?e:{datum:e},t,n,r)};var fN=function(e,t,n,r){return Object(oe.F)(e)?"("+pN(null,e,t,n,r)+")":e},dN=function(e,t,n,r,i){var o,a,u,s=hN(e.scale,n,r,i);return null!=e.range?(a=s+".range()",t=0===(o=+e.range)?a+"[0]":"($="+a+","+(1===o?"$[$.length-1]":"$[0]+"+o+"*($[$.length-1]-$[0])")+")"):(void 0!==t&&(t=s+"("+t+")"),e.band&&(u=function(e,t){if(!Object(oe.H)(e))return-1;var n=t.scaleType(e);return"band"===n||"point"===n?1:0}(e.scale,n))&&(a=s+".bandwidth",o=e.band.signal?a+"()*"+fN(e.band,n,r,i):a+"()"+(1===(o=+e.band)?"":"*"+o),u<0&&(o="("+a+"?"+o+":0)"),t=(t?t+"+":"")+o,e.extra&&(t="(datum.extra?"+s+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t};function hN(e,t,n,r){var i;if(Object(oe.H)(e))i="%"+e,Object(oe.v)(n,i)||(n[i]=t.scaleRef(e)),i=Object(oe.Y)(i);else{for(i in t.scales)n["%"+i]=t.scaleRef(i);i=Object(oe.Y)("%")+"+"+(e.signal?"("+lN(e.signal,t,n,r)+")":cN(e,t,n,r))}return"_["+i+"]"}var pN=function(e,t,n,r,i){if(null!=t.gradient)return function(e,t,n,r){return"this.gradient("+hN(e.gradient,t,n,r)+","+Object(oe.Y)(e.start)+","+Object(oe.Y)(e.stop)+","+Object(oe.Y)(e.count)+")"}(t,n,r,i);var o=t.signal?lN(t.signal,n,r,i):t.color?function(e,t,n,r){function i(e,i,o,a){return"this."+e+"("+[pN(null,i,t,n,r),pN(null,o,t,n,r),pN(null,a,t,n,r)].join(",")+").toString()"}return e.c?i("hcl",e.h,e.c,e.l):e.h||e.s?i("hsl",e.h,e.s,e.l):e.l||e.a?i("lab",e.l,e.a,e.b):e.r||e.g||e.b?i("rgb",e.r,e.g,e.b):null}(t.color,n,r,i):null!=t.field?cN(t.field,n,r,i):void 0!==t.value?Object(oe.Y)(t.value):void 0;return null!=t.scale&&(o=dN(t,o,n,r,i)),void 0===o&&(o=null),null!=t.exponent&&(o="Math.pow("+o+","+fN(t.exponent,n,r,i)+")"),null!=t.mult&&(o+="*"+fN(t.mult,n,r,i)),null!=t.offset&&(o+="+"+fN(t.offset,n,r,i)),t.round&&(o="Math.round("+o+")"),o},mN=function(e,t,n){const r=e+"["+Object(oe.Y)(t)+"]";return`$=${n};if(${r}!==$)${r}=$,m=1;`},gN=function(e,t,n,r,i){var o="";return t.forEach((function(t){var a=pN(e,t,n,r,i);o+=t.test?lN(t.test,n,r,i)+"?"+a+":":a})),":"===Object(oe.T)(o)&&(o+="null"),mN("o",e,o)};function vN(e,t,n,r){var i,o,a,u={},s="var o=item,datum=o.datum,m=0,$;";for(i in e)o=e[i],Object(oe.A)(o)?s+=gN(i,o,r,n,u):(a=pN(i,o,r,n,u),s+=mN("o",i,a));return s+=function(e,t){var n="";return uN[t]?n:(e.x2&&(e.x?(sN[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?(sN[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)}(e,t),{$expr:s+="return m;",$fields:Object.keys(u),$output:Object.keys(e)}}function yN(e){return Object(oe.F)(e)&&!Object(oe.A)(e)?Object(oe.o)({},e):{value:e}}function bN(e,t,n,r){return null!=n?(Object(oe.F)(n)&&!Object(oe.A)(n)?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function xN(e,t,n){for(let n in t)bN(e,n,t[n]);for(let t in n)bN(e,t,n[t],"update")}function wN(e,t,n){for(var r in t)n&&Object(oe.v)(n,r)||(e[r]=Object(oe.o)(e[r]||{},t[r]));return e}function _N(e,t,n,r,i,o){var a,u;for(u in(o=o||{}).encoders={$encode:a={}},e=function(e,t,n,r,i){var o,a,u,s={},l={};"legend"!=n&&0!==String(n).indexOf("axis")||(n=null);for(a in u="frame"===n?i.group:"mark"===n?Object(oe.o)({},i.mark,i[t]):null)ON(a,e)||("fill"===a||"stroke"===a)&&(ON("fill",e)||ON("stroke",e))||EN(s,a,u[a]);for(a in Object(oe.i)(r).forEach((function(t){var n=i.style&&i.style[t];for(var r in n)ON(r,e)||EN(s,r,n[r])})),e=Object(oe.o)({},e),s)(u=s[a]).signal?(o=o||{})[a]=u:l[a]=u;e.enter=Object(oe.o)(l,e.enter),o&&(e.update=Object(oe.o)(o,e.update));return e}(e,t,n,r,i.config))a[u]=vN(e[u],t,o,i);return o}function EN(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function ON(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}var kN=function(e,t,n,r,i,o,a){return{type:e,name:a?a.name:void 0,role:t,style:a&&a.style||n,key:r,from:i,interactive:!(!a||!a.interactive),encode:wN(o,a,iN)}};function jN(e,t){const n=(n,r)=>GC(e[n],GC(t[n],r));return n.isVertical=n=>"vertical"===GC(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>GC(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>GC(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>GC(e.columns,GC(t.columns,+n.isVertical(!0))),n}function SN(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function CN(e,t,n){return`item.anchor === "start" ? ${e} : item.anchor === "end" ? ${t} : ${n}`}const AN=CN(Object(oe.Y)("left"),Object(oe.Y)("right"),Object(oe.Y)("center"));var NN=function(e,t,n,r){var i,o,a,u,s,l,c=jN(e,n),f=c.isVertical(),d=c.gradientThickness(),h=c.gradientLength();return f?(a=[0,1],u=[0,0],s=d,l=h):(a=[0,0],u=[1,0],s=h,l=d),xN(i={enter:o={opacity:oN,x:oN,y:oN,width:yN(s),height:yN(l)},update:Object(oe.o)({},o,{opacity:aN,fill:{gradient:t,start:a,stop:u}}),exit:{opacity:oN}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),kN("rect","legend-gradient",null,void 0,void 0,i,r)},TN=function(e,t,n,r,i){var o,a,u,s,l,c,f=jN(e,n),d=f.isVertical(),h=f.gradientThickness(),p=f.gradientLength(),m="";return d?(u="y",l="y2",s="x",c="width",m="1-"):(u="x",l="x2",s="y",c="height"),(a={opacity:oN,fill:{scale:t,field:nN}})[u]={signal:m+"datum.perc",mult:p},a[s]=oN,a[l]={signal:m+"datum.perc2",mult:p},a[c]=yN(h),xN(o={enter:a,update:Object(oe.o)({},a,{opacity:aN}),exit:{opacity:oN}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),kN("rect","legend-band",null,nN,i,o,r)};var DN=function(e,t,n,r){var i,o,a,u,s,l=jN(e,t),c=l.isVertical(),f=yN(l.gradientThickness()),d=l.gradientLength(),h=l("labelOverlap"),p=l("labelSeparation"),m="";return xN(i={enter:o={opacity:oN},update:a={opacity:aN,text:{field:"label"}},exit:{opacity:oN}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:GC(e.labelLimit,t.gradientLabelLimit)}),c?(o.align={value:"left"},o.baseline=a.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},u="y",s="x",m="1-"):(o.align=a.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},o.baseline={value:"top"},u="x",s="y"),o[u]=a[u]={signal:m+"datum.perc",mult:d},o[s]=a[s]=f,f.offset=GC(e.labelOffset,t.gradientLabelOffset)||0,e=kN("text","legend-label","guide-label",nN,r,i,n),h&&(e.overlap={separation:p,method:h,order:"datum.index"}),e},MN=function(e,t,n,r,i,o,a,u){return{type:"group",name:n,role:e,style:t,from:r,interactive:i||!1,encode:o,marks:a,layout:u}},FN=function(e,t,n,r,i){var o,a,u,s,l,c,f,d=jN(e,t),h=n.entries,p=!(!h||!h.interactive),m=h?h.name:void 0,g=d("clipHeight"),v=d("symbolOffset"),y={data:"value"},b={},x=`${i} ? datum.offset : datum.size`,w=g?yN(g):{field:"size"},_="datum.index",E=`max(1, ${i})`;w.mult=.5,b={enter:o={opacity:oN,x:{signal:x,mult:.5,offset:v},y:w},update:a={opacity:aN,x:o.x,y:o.y},exit:{opacity:oN}};var O=null,k=null;return e.fill||(O=t.symbolBaseFillColor,k=t.symbolBaseStrokeColor),xN(b,{fill:d("symbolFillColor",O),shape:d("symbolType"),size:d("symbolSize"),stroke:d("symbolStrokeColor",k),strokeDash:d("symbolDash"),strokeDashOffset:d("symbolDashOffset"),strokeWidth:d("symbolStrokeWidth")},{opacity:d("symbolOpacity")}),rN.forEach((function(t){e[t]&&(a[t]=o[t]={scale:e[t],field:nN})})),s=kN("symbol","legend-symbol",null,nN,y,b,n.symbols),g&&(s.clip=!0),(u=yN(v)).offset=d("labelOffset"),xN(b={enter:o={opacity:oN,x:{signal:x,offset:u},y:w},update:a={opacity:aN,text:{field:"label"},x:o.x,y:o.y},exit:{opacity:oN}},{align:d("labelAlign"),baseline:d("labelBaseline"),fill:d("labelColor"),fillOpacity:d("labelOpacity"),font:d("labelFont"),fontSize:d("labelFontSize"),fontStyle:d("labelFontStyle"),fontWeight:d("labelFontWeight"),limit:d("labelLimit")}),l=kN("text","legend-label","guide-label",nN,y,b,n.labels),b={enter:{noBound:{value:!g},width:oN,height:g?yN(g):oN,opacity:oN},exit:{opacity:oN},update:a={opacity:aN,row:{signal:null},column:{signal:null}}},d.isVertical(!0)?(c=`ceil(item.mark.items.length / ${E})`,a.row.signal=`${_}%${c}`,a.column.signal=`floor(${_} / ${c})`,f={field:["row",_]}):(a.row.signal=`floor(${_} / ${E})`,a.column.signal=`${_} % ${E}`,f={field:_}),a.column.signal=`${i}?${a.column.signal}:${_}`,(e=MN("scope",null,m,r={facet:{data:r,name:"value",groupby:"index"}},p,wN(b,h,iN),[s,l])).sort=f,e};const PN='item.orient === "left"',RN='item.orient === "right"',zN=`(${PN} || ${RN})`,LN=`datum.vgrad && ${zN}`,IN=CN('"top"','"bottom"','"middle"'),$N=`datum.vgrad && ${RN} ? (${CN('"right"','"left"','"center"')}) : (${zN} && !(datum.vgrad && ${PN})) ? "left" : ${AN}`,BN=`item._anchor || (${zN} ? "middle" : "start")`,UN=`${LN} ? (${PN} ? -90 : 90) : 0`,qN=`${zN} ? (datum.vgrad ? (${RN} ? "bottom" : "top") : ${IN}) : "top"`;var WN=function(e,t){var n;return Object(oe.F)(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+HN(e.path)+")":e.sphere&&(n="geoShape("+HN(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e};function HN(e){return Object(oe.F)(e)&&e.signal?e.signal:Object(oe.Y)(e)}var YN=function(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?"group"===e.type?"scope":t||"mark":t},VN=function(e){return{marktype:e.type,name:e.name||void 0,role:e.role||YN(e),zindex:+e.zindex||void 0}},GN=function(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e},XN=function(e,t){var n=Pr(e.type);n||Object(oe.n)("Unrecognized transform type: "+Object(oe.Y)(e.type));var r=IC(n.type.toLowerCase(),null,KN(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r};function KN(e,t,n){var r,i,o,a={};for(i=0,o=e.params.length;iRC(e,t)),Object(oe.i)(e.projections).forEach(e=>function(e,t){var n=t.config.projection||{},r={};for(var i in e)"name"!==i&&(r[i]=tN(e[i],i,t));for(i in n)null==r[i]&&(r[i]=tN(n[i],i,t));t.addProjection(e.name,r)}(e,t)),i.forEach(e=>function(e,t){var n=e.type||"linear";Xm(n)||Object(oe.n)("Unrecognized scale type: "+Object(oe.Y)(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t)),Object(oe.i)(e.data).forEach(e=>pT(e,t)),i.forEach(e=>qA(e,t)),(n||r).forEach(e=>function(e,t){var n=t.getSignal(e.name),r=e.update;e.init&&(r?Object(oe.n)("Signals can not include both init and update expressions."):(r=e.init,n.initonly=!0)),r&&(r=zC(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach((function(e){cA(e,t,n.id)}))}(e,t)),Object(oe.i)(e.axes).forEach(e=>xT(e,t)),Object(oe.i)(e.marks).forEach(e=>cT(e,t)),Object(oe.i)(e.legends).forEach(e=>fT(e,t)),e.title&&hT(e.title,t),t.parseLambdas(),t},_T=Object(oe.cb)(["width","height","padding","autosize"]);function ET(e,t){var n,r,i,o,a,u,s=t.config;return t.background=e.background||s.background,t.eventConfig=s.events,a=BC(t.root=t.add($C())),t.addSignal("width",e.width||0),t.addSignal("height",e.height||0),t.addSignal("padding",function(e,t){return e=e||t.padding,Object(oe.F)(e)?{top:MC(e.top),bottom:MC(e.bottom),left:MC(e.left),right:MC(e.right)}:{top:n=MC(e),bottom:n,left:n,right:n};var n}(e.padding,s)),t.addSignal("autosize",function(e,t){return e=e||t.autosize,Object(oe.F)(e)?e:{type:e||"pad"}}(e.autosize,s)),t.legends=t.objectProperty(s.legend&&s.legend.layout),u=function(e,t,n){if(Object(oe.i)(t).forEach(t=>{_T[t.name]||RC(t,e)}),!n)return t;const r=Object(oe.i)(t).slice();return Object(oe.i)(n).forEach(t=>{e.hasOwnSignal(t.name)||(RC(t,e),r.push(t))}),r}(t,e.signals,s.signals),r=t.add(gA()),i=wN({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),i=t.add(bA(_N(i,"group","frame",e.style,t,{pulse:BC(r)}))),o=t.add(IA({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:a,pulse:BC(i)})),t.operators.pop(),t.pushState(BC(i),BC(o),null),wT(e,t,u),t.operators.push(o),n=t.add(mA({mark:a,pulse:BC(o)})),n=t.add(PA({pulse:BC(n)})),n=t.add(zA({pulse:BC(n)})),t.addData("root",new iT(t,r,r,n)),t}function OT(e){this.config=e,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function kT(e){this.config=e.config,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}var jT=OT.prototype=kT.prototype;function ST(e){return(Object(oe.A)(e)?CT:AT)(e)}function CT(e){for(var t,n="[",r=0,i=e.length;r0?",":"")+(Object(oe.F)(t)?t.signal||ST(t):Object(oe.Y)(t));return n+"]"}function AT(e){var t,n,r="{",i=0;for(t in e)n=e[t],r+=(++i>1?",":"")+Object(oe.Y)(t)+":"+(Object(oe.F)(n)?n.signal||ST(n):Object(oe.Y)(n));return r+"}"}jT.fork=function(){return new kT(this)},jT.isSubscope=function(){return this._subid>0},jT.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},jT.id=function(){return(this._subid?this._subid+":":0)+this._id++},jT.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((function(t){t.$ref=e.id})),e.refs=null),e},jT.proxy=function(e){var t=e instanceof LC?BC(e):e;return this.add(MA({value:t}))},jT.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},jT.addUpdate=function(e){return this.updates.push(e),e},jT.finish=function(){var 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){var r;e&&((r=e.data||(e.data={}))[t]||(r[t]=[])).push(n)}for(e in this.data)for(var r in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[r],e,"index:"+r);return this},jT.pushState=function(e,t,n){this._encode.push(BC(this.add(zA({pulse:e})))),this._parent.push(t),this._lookup.push(n?BC(this.proxy(n)):null),this._markpath.push(-1)},jT.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},jT.parent=function(){return Object(oe.T)(this._parent)},jT.encode=function(){return Object(oe.T)(this._encode)},jT.lookup=function(){return Object(oe.T)(this._lookup)},jT.markpath=function(){var e=this._markpath;return++e[e.length-1]},jT.fieldRef=function(e,t){if(Object(oe.H)(e))return UC(e,t);e.signal||Object(oe.n)("Unsupported field reference: "+Object(oe.Y)(e));var n,r=e.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},t&&(n.as=t),this.field[r]=i=BC(this.add(_A(n)))),i},jT.compareRef=function(e){function t(e){return YC(e)?(r=!0,n.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(r=!0,n.exprRef(e.expr)):e}var n=this,r=!1,i=Object(oe.i)(e.field).map(t),o=Object(oe.i)(e.order).map(t);return r?BC(this.add(vA({fields:i,orders:o}))):WC(i,o)},jT.keyRef=function(e,t){var n=this.signals,r=!1;return e=Object(oe.i)(e).map((function(e){return YC(e)?(r=!0,BC(n[e.signal])):e})),r?BC(this.add(EA({fields:e,flat:t}))):function(e,t){var n={$key:e};return t&&(n.$flat=!0),n}(e,t)},jT.sortRef=function(e){if(!e)return e;var t=HC(e.op,e.field),n=e.order||"ascending";return n.signal?BC(this.add(vA({fields:t,orders:this.signalRef(n.signal)}))):WC(t,n)},jT.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},jT.hasOwnSignal=function(e){return Object(oe.v)(this.signals,e)},jT.addSignal=function(e,t){this.hasOwnSignal(e)&&Object(oe.n)("Duplicate signal name: "+Object(oe.Y)(e));var n=t instanceof LC?t:this.add($C(t));return this.signals[e]=n},jT.getSignal=function(e){return this.signals[e]||Object(oe.n)("Unrecognized signal name: "+Object(oe.Y)(e)),this.signals[e]},jT.signalRef=function(e){return this.signals[e]?BC(this.signals[e]):(Object(oe.v)(this.lambdas,e)||(this.lambdas[e]=this.add($C(null))),BC(this.lambdas[e]))},jT.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;tBT(e,t))}:LT(e)?{or:e.or.map(e=>BT(e,t))}:t(e)}const UT=PT.a,qT=MT.a;function WT(e,t){const n={};for(const r of t)Object(oe.v)(e,r)&&(n[r]=e[r]);return n}function HT(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>zT()(e)).join(",")})`};const YT=zT.a;function VT(e){if(Object(oe.E)(e))return e;const t=Object(oe.H)(e)?e:zT()(e);if(t.length<250)return t;let n=0;for(let e=0;e-1}function KT(e,t){let n=0;for(const[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}function JT(e,t){let n=0;for(const[r,i]of e.entries())if(!t(i,r,n++))return!1;return!0}function QT(e,t){for(const n of Object.keys(t))Object(oe.ib)(e,n,t[n],!0)}function ZT(e,t){const n=[],r={};let i;for(const o of e)i=t(o),i in r||(r[i]=1,n.push(o));return n}function eD(e,t){for(const n of e)if(t.has(n))return!0;return!1}function tD(e){const t=new Set;for(const n of e){const e=Object(oe.X)(n).map((e,t)=>0===t?e:`[${e}]`);e.map((t,n)=>e.slice(0,n+1).join("")).forEach(e=>t.add(e))}return t}function nD(e,t){return void 0===e||void 0===t||eD(tD(e),tD(t))}const rD=Object.keys;function iD(e){const t=[];for(const n in e)Object(oe.v)(e,n)&&t.push(e[n]);return t}function oD(e){return!0===e||!1===e}function aD(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function uD(e,t){return $T(e)?"!("+uD(e.not,t)+")":IT(e)?"("+e.and.map(e=>uD(e,t)).join(") && (")+")":LT(e)?"("+e.or.map(e=>uD(e,t)).join(") || (")+")":t(e)}function sD(e,t){if(0===t.length)return!0;const n=t.shift();return sD(e[n],t)&&delete e[n],0===rD(e).length}function lD(e){return e.charAt(0).toUpperCase()+e.substr(1)}function cD(e,t="datum"){const n=Object(oe.X)(e),r=[];for(let e=1;e<=n.length;e++){const i=`[${n.slice(0,e).map(oe.Y).join("][")}]`;r.push(`${t}${i}`)}return r.join(" && ")}function fD(e){return`${Object(oe.X)(e).map(e=>dD(e,".","\\.")).join("\\.")}`}function dD(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function hD(e){return e?Object(oe.X)(e).length:0}function pD(...e){for(const t of e)if(void 0!==t)return t}let mD=42;function gD(e){const t=++mD;return e?String(e)+t:t}function vD(e){return(e%360+360)%360}const yD={area:1,bar:1,image:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1};function bD(e){return XT(["line","area","trail"],e)}function xD(e){return XT(["rect","bar","image"],e)}const wD=rD(yD);function _D(e){return e.type}Object(oe.cb)(wD);const ED=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],OD=["filled","color","tooltip","invalid","timeUnitBandPosition","timeUnitBand"],kD={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},jD={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function SD(e){return!!e.mark}class CD{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!SD(e)&&(_D(t=e.mark)?t.type:t)===this.name;var t}}const AD={argmax:1,argmin:1,average:1,count:1,distinct: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},ND={count:1,min:1,max:1};function TD(e){return!!e&&!!e.argmin}function DD(e){return!!e&&!!e.argmax}rD(AD);function MD(e){return Object(oe.H)(e)&&!!AD[e]}const FD=["count","valid","missing","distinct"];function PD(e){return Object(oe.H)(e)&&XT(FD,e)}const RD=["count","sum","distinct","valid","missing"],zD=Object(oe.cb)(["mean","average","median","q1","q3","min","max"]),LD="row",ID="x",$D="y",BD="color",UD="fill",qD="stroke",WD="shape",HD="size",YD="opacity",VD="fillOpacity",GD="strokeOpacity",XD="strokeWidth",KD={x:1,y:1,x2:1,y2:1};const JD={longitude:1,longitude2:1,latitude:1,latitude2:1};const QD=rD(JD),ZD=Object.assign(Object.assign(Object.assign({},KD),JD),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1});function eM(e){return"color"===e||"fill"===e||"stroke"===e}const tM={row:1,column:1,facet:1},nM=rD(tM),rM=Object.assign(Object.assign({},ZD),tM),iM=rD(rM),{order:oM,detail:aM,tooltip:uM}=rM,sM=k(rM,["order","detail","tooltip"]),{row:lM,column:cM,facet:fM}=sM,dM=k(sM,["row","column","facet"]);rD(sM),rD(dM);function hM(e){return!!rM[e]}const pM=["x2","y2","latitude2","longitude2"];function mM(e){return gM(e)!==e}function gM(e){switch(e){case"x2":return"x";case"y2":return"y";case"latitude2":return"latitude";case"longitude2":return"longitude"}return e}function vM(e){switch(e){case"x":return"x2";case"y":return"y2";case"latitude":return"latitude2";case"longitude":return"longitude2"}}rD(ZD);const{x:yM,y:bM,x2:xM,y2:wM,latitude:_M,longitude:EM,latitude2:OM,longitude2:kM}=ZD,jM=k(ZD,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]),SM=rD(jM),CM={x:1,y:1},AM=rD(CM);function NM(e){return"x"===e?"width":"height"}function TM(e){return"width"===e?"x":"y"}const{text:DM,tooltip:MM,href:FM,url:PM,detail:RM,key:zM,order:LM}=jM,IM=k(jM,["text","tooltip","href","url","detail","key","order"]),$M=rD(IM);const BM=Object.assign(Object.assign({},CM),IM),UM=rD(BM);function qM(e){return!!BM[e]}function WM(e,t){return function(e){switch(e){case BD:case UD:case qD:case"detail":case"key":case"tooltip":case"href":case"order":case YD:case VD:case GD:case XD:case"facet":case LD:case"column":return HM;case ID:case $D:case"latitude":case"longitude":return VM;case"x2":case"y2":case"latitude2":case"longitude2":return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case HD:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case WD:return{point:"always",geoshape:"always"};case"text":return{text:"always"};case"url":return{image:"always"}}}(e)[t]}const HM={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:YM}=HM,VM=k(HM,["geoshape"]);function GM(e){switch(e){case ID:case $D:case HD:case XD:case YD:case VD:case GD:case"x2":case"y2":return;case"facet":case LD:case"column":case WD:case"text":case"tooltip":case"href":case"url":return"discrete";case BD:case UD:case qD:return"flexible";case"latitude":case"longitude":case"latitude2":case"longitude2":case"detail":case"key":case"order":return}}function XM(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const KM='Autosize "fit" only works for single views and layered views.';function JM(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function QM(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-x".`}function ZM(e){return e?`Dropping "fit-${e}" because spec has discrete ${NM(e)}.`:'Dropping "fit" because spec has discrete size.'}function eF(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function tF(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function nF(e){return`The "nearest" transform is not supported for ${e} marks.`}function rF(e){return`Selection not supported for ${e} yet.`}function iF(e){return`Cannot find a selection named "${e}".`}const oF="Scale bindings are currently only supported for scales with unbinned, continuous domains.",aF="Legend bindings are only supported for selections over an individual field or encoding channel.";function uF(e){return`Cannot define and lookup the "${e}" selection in the same view. `+"Try moving the lookup into a second, layered view?"}function sF(e){return`Unknown repeated value "${e}".`}function lF(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const cF="Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).",fF="Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function dF(e){return`Unrecognized parse "${e}".`}function hF(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function pF(e){return`Ignoring an invalid transform: ${YT(e)}.`}const mF='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.';function gF(e){return`Layer's shared ${e.join(",")} channel ${1===e.length?"is":"are"} overriden.`}function vF(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${YT(t)} is overridden by a child projection ${YT(n)}.`}function yF(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${YT(n)}}.`}function bF(e){return`Invalid field type "${e}".`}function xF(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${e}'s ${t}. This can be misleading as the ${"x"===t?"width":"height"} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`}function wF(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function _F(e){return`Invalid aggregation operator "${e}".`}function EF(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}function OF(e,t){const{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?"fill and stroke":n?"fill":"stroke"}.`}function kF(e,t){return`Dropping ${YT(e)} from channel "${t}" since it does not contain data field or value.`}function jF(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`}const SF="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function CF(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function AF(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function NF(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function TF(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function DF(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function MF(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function FF(e,t){return`Specified orient "${e}" overridden with "${t}".`}const PF="Custom domain scale cannot be unioned with default field-based domain.",RF='Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.';function zF(e){return`Cannot use the scale property "${e}" with non-color channel.`}function LF(e){return`Using unaggregated domain with raw field has no effect (${YT(e)}).`}function IF(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function $F(e){return`Unaggregated domain is currently unsupported for log scale (${YT(e)}).`}function BF(e){return`Cannot apply size to non-oriented mark "${e}".`}function UF(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function qF(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function WF(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function HF(e,t){return`Scale type "${t}" does not work with mark "${e}".`}function YF(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}function VF(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${YT(n)} and ${YT(r)}). Using ${YT(n)}.`}function GF(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${YT(n)} and ${YT(r)}). Using the union of the two domains.`}function XF(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function KF(e){return`Dropping sort property ${YT(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const JF="Unable to merge domains.",QF="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",ZF="Invalid channel for axis.";function eP(e){return`Cannot stack "${e}" if there is already "${e}2".`}function tP(e){return`Cannot stack non-linear scale (${e}).`}function nP(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function rP(e,t){return`Invalid ${e}: ${YT(t)}.`}function iP(e){return`Time unit "${e}" is not supported. We are replacing it with ${dD(e,"day","date")}.`}function oP(e){return`Dropping day from datetime ${YT(e)} as day cannot be combined with other units.`}function aP(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function uP(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function sP(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function lP(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}function cP(e){return`1D error band does not support ${e}.`}function fP(e){return`Channel ${e} is required for "binned" bin.`}function dP(e){return`Domain for ${e} is required for threshold scale.`}const hP=v,pP=Object(oe.K)(oe.e);let mP=pP;function gP(){return mP=pP,mP}function vP(...e){mP.warn(...e)}function yP(e){return!!(e&&(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds))}const bP=["january","february","march","april","may","june","july","august","september","october","november","december"],xP=bP.map(e=>e.substr(0,3)),wP=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],_P=wP.map(e=>e.substr(0,3));function EP(e,t=!1,n=!1){const r=[];if(t&&void 0!==e.day&&rD(e).length>1&&(vP(hP.droppedDay(e)),delete(e=qT(e)).day),void 0!==e.year?r.push(e.year):void 0!==e.day?r.push(2006):r.push(0),void 0!==e.month){const n=t?function(e){if(Object(oe.E)(e))return(e-1).toString();{const t=e.toLowerCase(),n=bP.indexOf(t);if(-1!==n)return n+"";const r=t.substr(0,3),i=xP.indexOf(r);if(-1!==i)return i+"";throw new Error(hP.invalidTimeUnit("month",e))}}(e.month):e.month;r.push(n)}else if(void 0!==e.quarter){const n=t?function(e){if(Object(oe.E)(e))return e>4&&vP(hP.invalidTimeUnit("quarter",e)),(e-1).toString();throw new Error(hP.invalidTimeUnit("quarter",e))}(e.quarter):e.quarter;r.push(n+"*3")}else r.push(0);if(void 0!==e.date)r.push(e.date);else if(void 0!==e.day){const n=t?function(e){if(Object(oe.E)(e))return e%7+"";{const t=e.toLowerCase(),n=wP.indexOf(t);if(-1!==n)return n+"";const r=t.substr(0,3),i=_P.indexOf(r);if(-1!==i)return i+"";throw new Error(hP.invalidTimeUnit("day",e))}}(e.day):e.day;r.push(n+"+1")}else r.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];r.push(void 0===n?0:n)}const i=r.join(", ");return n?e.utc?new Function(`return +new Date(Date.UTC(${i}))`)():new Function(`return +new Date(${i})`)():e.utc?`utc(${i})`:`datetime(${i})`}var OP;!function(e){e.YEAR="year",e.MONTH="month",e.DAY="day",e.DATE="date",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.MILLISECONDS="milliseconds",e.YEARMONTH="yearmonth",e.YEARMONTHDATE="yearmonthdate",e.YEARMONTHDATEHOURS="yearmonthdatehours",e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",e.MONTHDATE="monthdate",e.MONTHDATEHOURS="monthdatehours",e.HOURSMINUTES="hoursminutes",e.HOURSMINUTESSECONDS="hoursminutesseconds",e.MINUTESSECONDS="minutesseconds",e.SECONDSMILLISECONDS="secondsmilliseconds",e.QUARTER="quarter",e.YEARQUARTER="yearquarter",e.QUARTERMONTH="quartermonth",e.YEARQUARTERMONTH="yearquartermonth",e.UTCYEAR="utcyear",e.UTCMONTH="utcmonth",e.UTCDAY="utcday",e.UTCDATE="utcdate",e.UTCHOURS="utchours",e.UTCMINUTES="utcminutes",e.UTCSECONDS="utcseconds",e.UTCMILLISECONDS="utcmilliseconds",e.UTCYEARMONTH="utcyearmonth",e.UTCYEARMONTHDATE="utcyearmonthdate",e.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",e.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",e.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",e.UTCMONTHDATE="utcmonthdate",e.UTCMONTHDATEHOURS="utcmonthdatehours",e.UTCHOURSMINUTES="utchoursminutes",e.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",e.UTCMINUTESSECONDS="utcminutesseconds",e.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",e.UTCQUARTER="utcquarter",e.UTCYEARQUARTER="utcyearquarter",e.UTCQUARTERMONTH="utcquartermonth",e.UTCYEARQUARTERMONTH="utcyearquartermonth"}(OP||(OP={}));const kP={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},jP=rD(kP);const SP={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};const CP={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},AP=Object.assign(Object.assign({},SP),CP);const NP=Object.assign(Object.assign(Object.assign(Object.assign({},kP),SP),{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1}),CP),TP=(rD(NP),{"year-month":"%b %Y ","year-month-date":"%b %d, %Y "});function DP(e){return jP.reduce((t,n)=>MP(e,n)?[...t,n]:t,[])}function MP(e,t){const n=e.indexOf(t);return n>-1&&(t!==OP.SECONDS||0===n||"i"!==e.charAt(n-1))}function FP(e,t,{end:n}={end:!1}){const r=cD(t),i=AP[e]?"utc":"";let o;const a=jP.reduce((t,n)=>{var a;return MP(e,n)&&(t[n]=(a=n)===OP.QUARTER?`(${i}quarter(${r})-1)`:`${i}${a}(${r})`,o=n),t},{});return n&&(a[o]+="+1"),EP(a)}function PP(e,t,n){if(!e)return;const r=function(e){if(!e)return;const t=DP(e);return`timeUnitSpecifier(${zT()(t)}, ${zT()(TP)})`}(e);return n?`utcFormat(${t}, ${r})`:`timeFormat(${t}, ${r})`}function RP(e){return"day"!==e&&e.indexOf("day")>=0?(vP(hP.dayReplacedWithDate(e)),dD(e,"day","date")):e}function zP(e){return e&&!!e.field&&void 0!==e.equal}function LP(e){return e&&!!e.field&&void 0!==e.lt}function IP(e){return e&&!!e.field&&void 0!==e.lte}function $P(e){return e&&!!e.field&&void 0!==e.gt}function BP(e){return e&&!!e.field&&void 0!==e.gte}function UP(e){return!!(e&&e.field&&Object(oe.A)(e.range)&&2===e.range.length)}function qP(e){return e&&!!e.field&&(Object(oe.A)(e.oneOf)||Object(oe.A)(e.in))}function WP(e){return qP(e)||zP(e)||UP(e)||LP(e)||$P(e)||IP(e)||BP(e)}function HP(e,t){return kz(e,{timeUnit:t,time:!0})}function YP(e,t=!0){const{field:n,timeUnit:r}=e,i=r?"time("+FP(r,n)+")":sz(e,{expr:"datum"});if(zP(e))return i+"==="+HP(e.equal,r);if(LP(e)){return`${i}<${HP(e.lt,r)}`}if($P(e)){return`${i}>${HP(e.gt,r)}`}if(IP(e)){return`${i}<=${HP(e.lte,r)}`}if(BP(e)){return`${i}>=${HP(e.gte,r)}`}if(qP(e))return`indexof([${function(e,t){return e.map(e=>HP(e,t))}(e.oneOf,r).join(",")}], ${i}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return VP(i,e.valid);if(UP(e)){const n=e.range[0],o=e.range[1];if(null!==n&&null!==o&&t)return"inrange("+i+", ["+HP(n,r)+", "+HP(o,r)+"])";const a=[];return null!==n&&a.push(`${i} >= ${HP(n,r)}`),null!==o&&a.push(`${i} <= ${HP(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`)}function VP(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function GP(e){return WP(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:RP(e.timeUnit)}):e}const XP={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1};var KP;!function(e){e.LINEAR="linear",e.LOG="log",e.POW="pow",e.SQRT="sqrt",e.SYMLOG="symlog",e.TIME="time",e.UTC="utc",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.BIN_ORDINAL="bin-ordinal",e.ORDINAL="ordinal",e.POINT="point",e.BAND="band"}(KP||(KP={}));const JP={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},QP=rD(JP);function ZP(e,t){const n=JP[e],r=JP[t];return n===r||"ordinal-position"===n&&"time"===r||"ordinal-position"===r&&"time"===n}const eR={linear:0,log:1,pow:1,sqrt:1,symlog:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function tR(e){return eR[e]}const nR=["linear","log","pow","sqrt","symlog","time","utc"],rR=Object(oe.cb)(nR),iR=Object(oe.cb)(["quantile","quantize","threshold"]),oR=nR.concat(["quantile","quantize","threshold"]),aR=Object(oe.cb)(oR),uR=Object(oe.cb)(["ordinal","bin-ordinal","point","band"]);function sR(e){return e in uR}function lR(e){return e in aR}function cR(e){return e in rR}function fR(e){return e in iR}function dR(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}const hR={type:1,domain:1,align:1,range: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:pR,domain:mR,range:gR,scheme:vR}=(rD(hR),hR),yR=k(hR,["type","domain","range","scheme"]),bR=rD(yR);!function(){var e;const t={};for(const n of iM)for(const r of rD(XP))for(const i of QP){const o=OR(n,r);ER(n,i)&&_R(i,r)&&(t[o]=null!=(e=t[o])?e:[],t[o].push(i))}}();function xR(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!XT(["point","band","identity"],e);case"bins":return!XT(["point","band","identity","ordinal"],e);case"round":return cR(e)||"band"===e||"point"===e;case"padding":return cR(e)||XT(["point","band"],e);case"paddingOuter":case"align":return XT(["point","band"],e);case"paddingInner":return"band"===e;case"clamp":return cR(e);case"nice":return cR(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return lR(e)&&!XT(["log","time","utc","threshold","quantile"],e)}}function wR(e,t){switch(t){case"interpolate":case"scheme":return eM(e)?void 0:hP.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"reverse":case"round":case"clamp":case"zero":return}}function _R(e,t){return XT(["ordinal","nominal"],t)?void 0===e||sR(e):"temporal"===t?XT([KP.TIME,KP.UTC,void 0],e):"quantitative"!==t||XT([KP.LOG,KP.POW,KP.SQRT,KP.SYMLOG,KP.QUANTILE,KP.QUANTIZE,KP.THRESHOLD,KP.LINEAR,void 0],e)}function ER(e,t){switch(e){case ID:case $D:return cR(t)||XT(["band","point"],t);case HD:case XD:case YD:case VD:case GD:return cR(t)||fR(t)||XT(["band","point"],t);case BD:case UD:case qD:return"band"!==t;case WD:return"ordinal"===t}return!1}function OR(e,t){return e+"_"+t}function kR(e){const{anchor:t,frame:n,offset:r,orient:i,color:o}=e,a=k(e,["anchor","frame","offset","orient","color"]);return{mark:Object.assign(Object.assign({},a),o?{fill:o}:{}),nonMark:Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),r?{offset:r}:{}),i?{orient:i}:{})}}function jR(e){return Object(oe.H)(e)||Object(oe.A)(e)&&Object(oe.H)(e[0])}function SR(e){var t;return[].concat(e.type,null!=(t=e.style)?t:[])}function CR(e,t,n){return pD(t[e],AR(e,t,n))}function AR(e,t,n,{vgChannel:r}={}){return pD(r?NR(e,t,n.style):void 0,NR(e,t,n.style),r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function NR(e,t,n){const r=SR(t);let i;for(const t of r){const r=n[t],o=e;r&&void 0!==r[o]&&(i=r[o])}return i}function TR(e,t,n,r){if(Oz(e)){const i=oz(e)&&e.scale&&e.scale.type===KP.UTC;return{signal:RR(sz(e,{expr:n}),e.timeUnit,t,r.timeFormat,i,!0)}}{const i=DR(e,t,r);if(Az(e.bin)){return{signal:PR(sz(e,{expr:n}),sz(e,{expr:n,binSuffix:"end"}),i,r)}}return"quantitative"===e.type||i?{signal:`${MR(sz(e,{expr:n,binSuffix:"range"}),i)}`}:{signal:`''+${sz(e,{expr:n})}`}}}function DR(e,t,n){return t||("quantitative"===e.type?n.numberFormat:void 0)}function MR(e,t){return`format(${e}, "${t||""}")`}function FR(e,t,n){return MR(e,null!=t?t:n.numberFormat)}function PR(e,t,n,r){return`${VP(e,!1)} ? "null" : ${FR(e,n,r)} + " – " + ${FR(t,n,r)}`}function RR(e,t,n,r,i,o=!1){return!t||n?(n=null!=n?n:r)||o?`${i?"utc":"time"}Format(${e}, '${n}')`:void 0:PP(t,e,i)}function zR(e,t){return Object(oe.i)(e).reduce((e,n)=>{var r;return e.field.push(sz(n,t)),e.order.push(null!=(r=n.sort)?r:"ascending"),e},{field:[],order:[]})}function LR(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if(UT(t,e))return;n.push(e)}),n}function IR(e,t){return UT(e,t)||!t?e:e?[...Object(oe.i)(e),...Object(oe.i)(t)].join(", "):t}function $R(e,t){const n=e.value,r=t.value;if(null==n||null===r)return{explicit:e.explicit,value:null};if(jR(n)&&jR(r))return{explicit:e.explicit,value:IR(n,r)};if(!jR(n)&&!jR(r))return{explicit:e.explicit,value:LR(n,r)};throw new Error("It should never reach here")}const BR="mean",UR={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function qR(e){return!!UR[e]}function WR(e){return!!e&&!!e.encoding}function HR(e){return!(!e||"count"!==e.op&&!e.field)}function YR(e){return!!e&&Object(oe.A)(e)}function VR(e){return!!e.row||!!e.column}function GR(e){return void 0!==e.facet}function XR(e){const{field:t,timeUnit:n,bin:r,aggregate:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},n?{timeUnit:n}:{}),r?{bin:r}:{}),i?{aggregate:i}:{}),{field:t})}function KR(e){return nz(e)&&!!e.sort}function JR(e,t,n,r,i,{isMidPoint:o}={}){const{timeUnit:a,bin:u}=t;if(XT(["x","y"],e)){if(az(t)&&void 0!==t.band)return t.band;if(a&&!n)return o?AR("timeUnitBandPosition",r,i):xD(r.type)?AR("timeUnitBand",r,i):0;if(Az(u))return xD(r.type)&&!o?1:.5}}function QR(e,t,n,r,i){return!!(Az(t.bin)||t.timeUnit&&nz(t)&&"temporal"===t.type)&&!!JR(e,t,n,r,i)}function ZR(e){return!!e&&!!e.condition}function ez(e){return!!e&&!!e.condition&&!Object(oe.A)(e.condition)&&tz(e.condition)}function tz(e){return!(!e||!e.field&&"count"!==e.aggregate)}function nz(e){return!!e&&(!!e.field&&!!e.type||"count"===e.aggregate)}function rz(e){return tz(e)&&Object(oe.H)(e.field)}function iz(e){return e&&"value"in e&&void 0!==e.value}function oz(e){return!(!e||!e.scale&&!e.sort)}function az(e){return!(!e||!e.axis&&!e.stack&&!e.impute&&void 0===e.band)}function uz(e){return!!e&&!!e.format}function sz(e,t={}){var n,r,i;let o=e.field;const a=t.prefix;let u=t.suffix,s="";if(function(e){return"count"===e.aggregate}(e))o=function(e){return 0===e.indexOf("__")}(l="count")?l:`__${l}`;else{let a;if(!t.nofn)if(function(e){return!!e.op}(e))a=e.op;else{const{bin:l,aggregate:c,timeUnit:f}=e;Az(l)?(a=Cz(l),u=(null!=(n=t.binSuffix)?n:"")+(null!=(r=t.suffix)?r:"")):c?DD(c)?(s=`.${o}`,o=`argmax_${c.argmax}`):TD(c)?(s=`.${o}`,o=`argmin_${c.argmin}`):a=String(c):f&&(a=String(f),u=(!XT(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!=(i=t.suffix)?i:""))}a&&(o=o?`${a}_${o}`:a)}var l;return u&&(o=`${o}_${u}`),a&&(o=`${a}_${o}`),t.forAs?o:t.expr?function(e,t="datum"){return`${t}[${Object(oe.Y)(Object(oe.X)(e).join("."))}]`}(o,t.expr)+s:fD(o)+s}function lz(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(hP.invalidFieldType(e.type))}function cz(e){return!lz(e)}const fz=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:r,field:i}=e;if(DD(t))return`${i} for argmax(${t.argmax})`;if(TD(t))return`${i} for argmin(${t.argmin})`;const o=t||r||Az(n)&&"bin";return o?o.toUpperCase()+"("+i+")":i}(e);default:return function(e,t){const{field:n,bin:r,timeUnit:i,aggregate:o}=e;if("count"===o)return t.countTitle;if(Az(r))return`${n} (binned)`;if(i){return`${n} (${DP(i).join("-")})`}return o?DD(o)?`${n} for max ${o.argmax}`:TD(o)?`${n} for min ${o.argmin}`:`${lD(o)} of ${n}`:n}(e,t)}};let dz=fz;function hz(e){dz=e}function pz(e,t,{allowDisabling:n,includeDefault:r=!0}){var i,o;const a=(null!=(i=mz(e))?i:{}).title,u=r?gz(e,t):void 0;return n?pD(a,e.title,u):null!=(o=null!=a?a:e.title)?o:u}function mz(e){return az(e)&&e.axis?e.axis:(t=e)&&t.legend&&e.legend?e.legend:function(e){return!!e&&!!e.header}(e)&&e.header?e.header:void 0;var t}function gz(e,t){return dz(e,t)}function vz(e){var t;if(uz(e)&&e.format)return e.format;return(null!=(t=mz(e))?t:{}).format}function yz(e){return tz(e)?e:ez(e)?e.condition:void 0}function bz(e){return tz(e)?e:ez(e)?e.condition:void 0}function xz(e,t){if(Object(oe.H)(e)||Object(oe.E)(e)||Object(oe.B)(e)){const n=Object(oe.H)(e)?"string":Object(oe.E)(e)?"number":"boolean";return vP(hP.primitiveChannelDef(t,n,e)),{value:e}}return tz(e)?wz(e,t):ez(e)?Object.assign(Object.assign({},e),{condition:wz(e.condition,t)}):e}function wz(e,t){const{aggregate:n,timeUnit:r,bin:i,field:o}=e,a=Object.assign({},e);if(!n||MD(n)||DD(n)||TD(n)||(vP(hP.invalidAggregate(n)),delete a.aggregate),r&&(a.timeUnit=RP(r)),o&&(a.field=`${o}`),Az(i)&&(a.bin=_z(i,t)),Nz(i)&&!XT(AM,t)&&vP(`Channel ${t} should not be used with "binned" bin`),nz(a)){const{type:e}=a,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case"quantitative":return"quantitative";case"t":case"temporal":return"temporal";case"o":case"ordinal":return"ordinal";case"n":case"nominal":return"nominal";case"geojson":return"geojson"}}(e);e!==t&&(a.type=t),"quantitative"!==e&&PD(n)&&(vP(hP.invalidFieldTypeForCountAggregate(e,n)),a.type="quantitative")}else if(!mM(t)){const e=function(e,t){if(e.timeUnit)return"temporal";if(Az(e.bin))return"quantitative";switch(GM(t)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}(a,t);vP(hP.missingFieldType(t,e)),a.type=e}if(nz(a)){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"row":case"column":case"facet":return cz(e)?{compatible:!1,warning:hP.facetChannelShouldBeDiscrete(t)}:Ez;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":case"url":return Ez;case"longitude":case"longitude2":case"latitude":case"latitude2":return"quantitative"!==n?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Ez;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return"nominal"!==n||e.sort?Ez:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return XT(["ordinal","nominal","geojson"],e.type)?Ez:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==e.type||"sort"in e?Ez:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}(a,t);e||vP(n)}if(KR(a)&&Object(oe.H)(a.sort)){const{sort:e}=a;if(qR(e))return Object.assign(Object.assign({},a),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&qR(t))return Object.assign(Object.assign({},a),{sort:{encoding:t,order:"descending"}})}return a}function _z(e,t){return Object(oe.B)(e)?{maxbins:Mz(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:Mz(t)})}const Ez={compatible:!0};function Oz(e){const t=mz(e),n=t&&t.formatType||uz(e)&&e.formatType;return"time"===n||!n&&function(e){return"temporal"===e.type||!!e.timeUnit}(e)}function kz(e,{timeUnit:t,type:n,time:r,undefinedIfExprNotRequired:i}){let o;var a;return yP(e)?o=EP(e,!0):(Object(oe.H)(e)||Object(oe.E)(e))&&(t||"temporal"===n)&&(o=function(e){return!!kP[e]}(t)?EP({[t]:e},!0):function(e){return!!SP[e]}(t)?kz(e,{timeUnit:(a=t,a.substr(3))}):`datetime(${JSON.stringify(e)})`),o?r?`time(${o})`:o:i?void 0:JSON.stringify(e)}function jz(e,t){const{timeUnit:n,type:r}=e;return t.map(e=>{const t=kz(e,{timeUnit:n,type:r,undefinedIfExprNotRequired:!0});return void 0!==t?{signal:t}:e})}function Sz(e,t){return Az(e.bin)?qM(t)&&XT(["ordinal","nominal"],e.type):(console.warn("Only use this method with binned field defs"),!1)}function Cz(e){return Object(oe.B)(e)&&(e=_z(e,void 0)),"bin"+rD(e).map(t=>Dz(e[t])?aD(`_${t}_${Object.entries(e[t])}`):aD(`_${t}_${e[t]}`)).join("")}function Az(e){return!0===e||Tz(e)&&!e.binned}function Nz(e){return"binned"===e||Tz(e)&&!0===e.binned}function Tz(e){return Object(oe.F)(e)}function Dz(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}function Mz(e){switch(e){case LD:case"column":case HD:case BD:case UD:case qD:case XD:case YD:case VD:case GD:case WD:return 6;default:return 10}}function Fz(e,t){const n=e&&e[t];return!!n&&(Object(oe.A)(n)?KT(n,e=>!!e.field):tz(n)||ez(n))}function Pz(e){return KT(iM,t=>{if(Fz(e,t)){const n=e[t];if(Object(oe.A)(n))return KT(n,e=>!!e.aggregate);{const e=yz(n);return e&&!!e.aggregate}}return!1})}function Rz(e,t){const n=[],r=[],i=[],o=[],a={};return Iz(e,(u,s)=>{if(tz(u)){const{field:l,aggregate:c,timeUnit:f,bin:d}=u,h=k(u,["field","aggregate","timeUnit","bin"]);if(c||f||d){const e=mz(u),p=e&&e.title;let m=sz(u,{forAs:!0});const g=Object.assign(Object.assign(Object.assign({},p?[]:{title:pz(u,t,{allowDisabling:!0})}),h),{field:m}),v="x"===s||"y"===s;if(c){let e;if(DD(c)?(e="argmax",m=sz({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${l}`):TD(c)?(e="argmin",m=sz({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${l}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};l&&(t.field=l),o.push(t)}}else if(n.push(m),nz(u)&&Az(d)){if(r.push({bin:d,field:l,as:m}),n.push(sz(u,{binSuffix:"end"})),Sz(u,s)&&n.push(sz(u,{binSuffix:"range"})),v){const e={field:m+"_end"};a[s+"2"]=e}g.bin="binned",mM(s)||(g.type="quantitative")}else if(f){i.push({timeUnit:f,field:l,as:m});const e=nz(u)&&"temporal"!==u.type&&"time";e&&("text"===s||"tooltip"===s?g.formatType=e:!function(e){return!!jM[e]}(s)?v&&(g.axis=Object.assign({formatType:e},g.axis)):g.legend=Object.assign({formatType:e},g.legend))}a[s]=g}else n.push(l),a[s]=e[s]}else a[s]=e[s]}),{bins:r,timeUnits:i,aggregate:o,groupby:n,encoding:a}}function zz(e,t){const n=t.type;return rD(e).reduce((r,i)=>{var o;if(!hM(i))return vP(hP.invalidEncodingChannel(i)),r;if(!function(e,t,n){const r=WM(t,n);if(!r)return!1;if("binned"===r){const n=e["x2"===t?"x":"y"];return!!(tz(n)&&tz(e[t])&&Nz(n.bin))}return!0}(e,i,n))return vP(hP.incompatibleChannel(i,n)),r;if("size"===i&&"line"===n){if(null===(o=bz(e[i]))||void 0===o?void 0:o.aggregate)return vP(hP.LINE_WITH_VARYING_SIZE),r}if("color"===i&&(t.filled?"fill"in e:"stroke"in e))return vP(hP.droppingColor("encoding",{fill:"fill"in e,stroke:"stroke"in e})),r;const a=e[i];if("detail"===i||"order"===i&&!Object(oe.A)(a)&&!iz(a)||"tooltip"===i&&Object(oe.A)(a))a&&(r[i]=(Object(oe.A)(a)?a:[a]).reduce((e,t)=>(tz(t)?e.push(wz(t,i)):vP(hP.emptyFieldDef(t,i)),e),[]));else{if("tooltip"===i&&null===a)r[i]=null;else if(!tz(a)&&!iz(a)&&!ZR(a))return vP(hP.emptyFieldDef(a,i)),r;r[i]=xz(a,i)}return r},{})}function Lz(e){const t=[];for(const n of rD(e))if(Fz(e,n)){const r=e[n],i=Object(oe.A)(r)?r:[r];for(const e of i)tz(e)?t.push(e):ez(e)&&t.push(e.condition)}return t}function Iz(e,t,n){if(e)for(const r of rD(e)){const i=e[r];Object(oe.A)(i)?i.forEach(e=>{t.call(n,e,r)}):t.call(n,i,r)}}function $z(e,t,n,r){return e?rD(e).reduce((n,i)=>{const o=e[i];return Object(oe.A)(o)?o.reduce((e,n)=>t.call(r,e,n,i),n):t.call(r,n,o,i)},n):n}function Bz(e,t){return rD(t).reduce((n,r)=>{switch(r){case"x":case"y":case"href":case"url":case"x2":case"y2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case"shape":case"tooltip":return n;case"order":if("line"===e||"trail"===e)return n;case"detail":case"key":{const e=t[r];return(Object(oe.A)(e)||tz(e))&&(Object(oe.A)(e)?e:[e]).forEach(e=>{e.aggregate||n.push(sz(e,{}))}),n}case"size":if("trail"===e)return n;case"color":case"fill":case"stroke":case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":{const e=bz(t[r]);return e&&!e.aggregate&&n.push(sz(e,{})),n}}},[])}function Uz(e,t,n,r=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>({field:e+t.field,type:t.type,title:n+(r?" of "+t.field:"")})),...Lz(n)]}}function qz(e){const{axis:t,title:n,field:r}=e;return t&&void 0!==t.title?void 0:pD(n,r)}function Wz(e,t,n,r,i){const{scale:o,axis:a}=n;return({partName:u,mark:s,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=qz(n);return Hz(e,u,i,{mark:s,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:l+"_"+n.field,type:n.type},void 0!==d?{title:d}:{}),void 0!==o?{scale:o}:{}),void 0!==a?{axis:a}:{})},Object(oe.H)(c)?{[t+"2"]:{field:c+"_"+n.field,type:n.type}}:{}),r),f)})}}function Hz(e,t,n,r){const{clip:i,color:o,opacity:a}=e,u=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},r),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),i?{clip:i}:{}),o?{color:o}:{}),a?{opacity:a}:{}),_D(r.mark)?r.mark:{type:r.mark}),{style:`${u}-${t}`}),Object(oe.B)(e[t])?{}:e[t])})]:[]}function Yz(e,t,n){const{encoding:r}=e,i="vertical"===t?"y":"x",o=r[i],a=r[i+"2"],u=r[i+"Error"],s=r[i+"Error2"];return{continuousAxisChannelDef:Vz(o,n),continuousAxisChannelDef2:Vz(a,n),continuousAxisChannelDefError:Vz(u,n),continuousAxisChannelDefError2:Vz(s,n),continuousAxis:i}}function Vz(e,t){if(e&&e.aggregate){const{aggregate:n}=e,r=k(e,["aggregate"]);return n!==t&&vP(hP.errorBarContinuousAxisHasCustomizedAggregate(n,t)),r}return e}function Gz(e,t){const{mark:n,encoding:r}=e;if(tz(r.x)&&cz(r.x)){if(tz(r.y)&&cz(r.y)){if(void 0===r.x.aggregate&&r.y.aggregate===t)return"vertical";if(void 0===r.y.aggregate&&r.x.aggregate===t)return"horizontal";if(r.x.aggregate===t&&r.y.aggregate===t)throw new Error("Both x and y cannot have aggregate");return _D(n)&&n.orient?n.orient:"vertical"}return"horizontal"}if(tz(r.y)&&cz(r.y))return"vertical";throw new Error("Need a valid continuous axis for "+t+"s")}const Xz=rD({box:1,median:1,outliers:1,rule:1,ticks:1}),Kz=new CD("boxplot",Qz);function Jz(e){return Object(oe.E)(e)?"tukey":e}function Qz(e,{config:t}){var n,r;const{mark:i,encoding:o,selection:a,projection:u}=e,s=k(e,["mark","encoding","selection","projection"]),l=_D(i)?i:{type:i};a&&vP(hP.selectionNotSupported("boxplot"));const c=null!=(n=l.extent)?n:t.boxplot.extent,f=pD(l.size,t.boxplot.size),d=Jz(c),{transform:h,continuousAxisChannelDef:p,continuousAxis:m,groupby:g,aggregate:v,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:w}=function(e,t,n){const r=Gz(e,"boxplot"),{continuousAxisChannelDef:i,continuousAxis:o}=Yz(e,r,"boxplot"),a=i.field,u=Jz(t),s=[...Zz(a),{op:"median",field:a,as:"mid_box_"+a},{op:"min",field:a,as:("min-max"===u?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===u?"upper_whisker_":"max_")+a}],l="min-max"===u||"tukey"===u?[]:[{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}],c=e.encoding,f=o,d=(c[f],k(c,["symbol"==typeof f?f:f+""])),{customTooltipWithoutAggregatedField:h,filteredEncoding:p}=function(e){const{tooltip:t}=e,n=k(e,["tooltip"]);if(!t)return{filteredEncoding:e};let r,i;return Object(oe.A)(t)?(t.forEach(e=>{e.aggregate?(r||(r=[]),r.push(e)):(i||(i=[]),i.push(e))}),r&&(n.tooltip=r)):t.aggregate?n.tooltip=t:i=t,Object(oe.A)(i)&&1===i.length&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}(d),{bins:m,timeUnits:g,aggregate:v,groupby:y,encoding:b}=Rz(p,n),x="vertical"===r?"horizontal":"vertical",w=r;return{transform:[...m,...g,{aggregate:[...v,...s],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:h}}(e,c,t),{color:_,size:E}=y,O=k(y,["color","size"]),j=e=>Wz(l,m,p,e,t.boxplot),S=j(O),C=j(y),A=j(Object.assign(Object.assign({},O),E?{size:E}:{})),N=Uz([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],p,y),T={type:"tick",color:"black",opacity:1,orient:b,invalid:null},D="min-max"===d?N:Uz([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,y),M=[...S({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:D}),...S({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:D}),...S({partName:"ticks",mark:T,positionPrefix:"lower_whisker",extraEncoding:D}),...S({partName:"ticks",mark:T,positionPrefix:"upper_whisker",extraEncoding:D})],F=[..."tukey"!==d?M:[],...C({partName:"box",mark:Object.assign(Object.assign({type:"bar"},f?{size:f}:{}),{orient:x,invalid:null}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:N}),...A({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},Object(oe.F)(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),f?{size:f}:{}),{orient:b}),positionPrefix:"mid_box",extraEncoding:N})];let P;if("min-max"!==d){const e=`datum["lower_box_${p.field}"]`,n=`datum["upper_box_${p.field}"]`,r=`(${n} - ${e})`,i=`${e} - ${c} * ${r}`,o=`${n} + ${c} * ${r}`,a=`datum["${p.field}"]`,u={joinaggregate:Zz(p.field),groupby:g};let s=void 0;"tukey"===d&&(s={transform:[{filter:`(${i} <= ${a}) && (${a} <= ${o})`},{aggregate:[{op:"min",field:p.field,as:"lower_whisker_"+p.field},{op:"max",field:p.field,as:"upper_whisker_"+p.field},{op:"min",field:"lower_box_"+p.field,as:"lower_box_"+p.field},{op:"max",field:"upper_box_"+p.field,as:"upper_box_"+p.field},...v],groupby:g}],layer:M});const{tooltip:f}=O,h=k(O,["tooltip"]),{scale:y,axis:b}=p,x=qz(p),_=Hz(l,"outliers",t.boxplot,{transform:[{filter:`(${a} < ${i}) || (${a} > ${o})`}],mark:"point",encoding:Object.assign(Object.assign({[m]:Object.assign(Object.assign(Object.assign({field:p.field,type:p.type},void 0!==x?{title:x}:{}),void 0!==y?{scale:y}:{}),void 0!==b?{axis:b}:{})},h),w?{tooltip:w}:{})})[0];_&&s?P={transform:[u],layer:[_,s]}:_?(P=_,P.transform.unshift(u)):s&&(P=s,P.transform.unshift(u))}return P?Object.assign(Object.assign({},s),{layer:[P,{transform:h,layer:F}]}):Object.assign(Object.assign({},s),{transform:(r=s.transform,null!=r?r:[]).concat(h),layer:F})}function Zz(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const eL=rD({ticks:1,rule:1}),tL=new CD("errorbar",nL);function nL(e,{config:t}){const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:u,outerSpec:s,tooltipEncoding:l}=iL(e,"errorbar",t),c=Wz(u,i,r,o,t.errorbar),f={type:"tick",orient:a};return Object.assign(Object.assign({},s),{transform:n,layer:[...c({partName:"ticks",mark:f,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:f,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:"rule",positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})]})}function rL(e,t){const{encoding:n}=e;if(function(e){return(tz(e.x)||tz(e.y))&&!tz(e.x2)&&!tz(e.y2)&&!tz(e.xError)&&!tz(e.xError2)&&!tz(e.yError)&&!tz(e.yError2)}(n))return{orient:Gz(e,t),inputType:"raw"};const r=function(e){return tz(e.x2)||tz(e.y2)}(n),i=function(e){return tz(e.xError)||tz(e.xError2)||tz(e.yError)||tz(e.yError2)}(n),o=n.x,a=n.y;if(r){if(i)throw new Error(t+" cannot be both type aggregated-upper-lower and aggregated-error");const e=n.x2,r=n.y2;if(tz(e)&&tz(r))throw new Error(t+" cannot have both x2 and y2");if(tz(e)){if(tz(o)&&cz(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+t)}if(tz(r)){if(tz(a)&&cz(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,r=n.xError2,i=n.yError,u=n.yError2;if(tz(r)&&!tz(e))throw new Error(t+" cannot have xError2 without xError");if(tz(u)&&!tz(i))throw new Error(t+" cannot have yError2 without yError");if(tz(e)&&tz(i))throw new Error(t+" cannot have both xError and yError with both are quantiative");if(tz(e)){if(tz(o)&&cz(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(tz(i)){if(tz(a)&&cz(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")}}function iL(e,t,n){var r;const{mark:i,encoding:o,selection:a,projection:u}=e,s=k(e,["mark","encoding","selection","projection"]),l=_D(i)?i:{type:i};a&&vP(hP.selectionNotSupported(t));const{orient:c,inputType:f}=rL(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:h,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:g}=Yz(e,c,t),{errorBarSpecificAggregate:v,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:x}=function(e,t,n,r,i,o,a,u){let s=[],l=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":u.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&vP(hP.errorBarCenterIsUsedWithWrongExtent(t,n,a)),"stderr"===n||"stdev"===n)s=[{op:n,field:c,as:"extent_"+c},{op:t,field:c,as:"center_"+c}],l=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:"upper_"+c},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:"lower_"+c}],f=[{fieldPrefix:"center_",titlePrefix:lD(t)},{fieldPrefix:"upper_",titlePrefix:oL(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:oL(t,n,"-")}],d=!0;else{let t,r,i;e.center&&e.extent&&vP(hP.errorBarCenterIsNotNeeded(e.extent,a)),"ci"===n?(t="mean",r="ci0",i="ci1"):(t="median",r="q1",i="q3"),s=[{op:r,field:c,as:"lower_"+c},{op:i,field:c,as:"upper_"+c},{op:t,field:c,as:"center_"+c}],f=[{fieldPrefix:"upper_",titlePrefix:pz({field:c,aggregate:i,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:pz({field:c,aggregate:r,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:pz({field:c,aggregate:t,type:"quantitative"},u,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&vP(hP.errorBarCenterAndExtentAreNotNeeded(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:`datum["${n.field}"]`,as:"upper_"+c},{calculate:`datum["${c}"]`,as:"lower_"+c}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`datum["${c}"] + datum["${r.field}"]`,as:"upper_"+c}],i?l.push({calculate:`datum["${c}"] + datum["${i.field}"]`,as:"lower_"+c}):l.push({calculate:`datum["${c}"] - datum["${r.field}"]`,as:"lower_"+c}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:dD(dD(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:s,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,d,h,p,m,f,t,n),w=g,_=(o[w],"x"===g?"x2":"y2"),E=(o[_],"x"===g?"xError":"yError"),O=(o[E],"x"===g?"xError2":"yError2"),j=(o[O],k(o,["symbol"==typeof w?w:w+"","symbol"==typeof _?_:_+"","symbol"==typeof E?E:E+"","symbol"==typeof O?O:O+""])),{bins:S,timeUnits:C,aggregate:A,groupby:N,encoding:T}=Rz(j,n),D=[...A,...v],M="raw"!==f?[]:N,F=Uz(b,d,T,x);return{transform:[...(r=s.transform,null!=r?r:[]),...S,...C,...0===D.length?[]:[{aggregate:D,groupby:M}],...y],groupby:M,continuousAxisChannelDef:d,continuousAxis:g,encodingWithoutContinuousAxis:T,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:F}}function oL(e,t,n){return lD(e)+" "+n+" "+t}const aL=rD({band:1,borders:1}),uL=new CD("errorband",sL);function sL(e,{config:t}){const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:u,tooltipEncoding:s}=iL(e,"errorband",t),l=a,c=Wz(l,i,r,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=Object.assign(Object.assign({},l.interpolate?{interpolate:l.interpolate}:{}),l.tension&&l.interpolate?{interpolate:l.tension}:{});return f?(d=Object.assign(Object.assign({},d),p),h=Object.assign(Object.assign({},h),p)):l.interpolate?vP(hP.errorBand1DNotSupport("interpolate")):l.tension&&vP(hP.errorBand1DNotSupport("tension")),Object.assign(Object.assign({},u),{transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:s}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:s}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:s})]})}const lL={};function cL(e,t,n){const r=new CD(e,t);lL[e]={normalizer:r,parts:n}}cL("boxplot",Qz,Xz),cL("errorbar",nL,eL),cL("errorband",sL,aL);const fL=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],dL={clipHeight:1,columnPadding:1,columns:1,cornerRadius: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},hL=(rD(dL),{single:{on:"click",fields:["_vgsid_"],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:["_vgsid_"],toggle:"event.shiftKey",resolve:"global",empty:"all",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 pL(e){return!(!e||"legend"!==e&&!e.legend)}function mL(e){return pL(e)&&Object(oe.F)(e)}function gL(e){return void 0!==e.concat}function vL(e){return void 0!==e.vconcat}function yL(e){return void 0!==e.hconcat}function bL(e){return void 0!==e.repeat}function xL(e){return Object(oe.F)(e)&&void 0!==e.step}const wL=rD({align:1,bounds:1,center:1,columns:1,spacing:1});function _L(e,t){var n;return null!=(n=e[t])?n:e["width"===t?"continuousWidth":"continuousHeight"]}function EL(e,t){const n=OL(e,t);return xL(n)?n.step:kL}function OL(e,t){var n;return pD(null!=(n=e[t])?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const kL=20;const jL={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:kL},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},area:{},bar:kD,circle:{},geoshape:{},image:{},line:{},point:{},rect:jD,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,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},axis:{},axisX:{},axisY:{},axisLeft:{},axisRight:{},axisTop:{},axisBottom:{},axisBand:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:hL,style:{},title:{},facet:{spacing:20},repeat:{spacing:20},concat:{spacing:20}};function SL(e){return Object(oe.M)({},jL,e)}const CL=["view",...wD],AL=["background","padding","facet","concat","repeat","numberFormat","timeFormat","countTitle","header","scale","selection","overlay"],NL=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function TL(e){e=qT(e);for(const t of AL)delete e[t];if(e.legend)for(const t of fL)delete e.legend[t];if(e.mark)for(const t of OD)delete e.mark[t];for(const t of CL){for(const n of OD)delete e[t][n];const n=NL[t];if(n)for(const r of n)delete e[t][r];DL(e,t)}for(const t of rD(lL))delete e[t];DL(e,"title","group-title");for(const t in e)Object(oe.F)(e[t])&&0===rD(e[t]).length&&delete e[t];return rD(e).length>0?e:void 0}function DL(e,t,n,r){const i="title"===t?kR(e.title).mark:r?e[t][r]:e[t];"view"===t&&(n="cell");const o=Object.assign(Object.assign({},i),e.style[t]);rD(o).length>0&&(e.style[null!=n?n:t]=o),r||delete e[t]}function ML(e){return void 0!==e.layer}class FL{map(e,t){return GR(e)?this.mapFacet(e,t):bL(e)?this.mapRepeat(e,t):yL(e)?this.mapHConcat(e,t):vL(e)?this.mapVConcat(e,t):gL(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(ML(e))return this.mapLayer(e,t);if(SD(e))return this.mapUnit(e,t);throw new Error(hP.invalidSpec(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,r=k(e,["concat"]);return Object.assign(Object.assign({},r),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}const PL={zero:1,center:1,normalize:1};const RL=["bar","area","rule","point","circle","square","line","text","tick"],zL=["bar","area"];function LL(e,t,n={}){const r=_D(e)?e.type:e;if(!XT(RL,r))return null;const i=function(e){const t=e.x,n=e.y;if(tz(t)&&tz(n))if("quantitative"===t.type&&"quantitative"===n.type){if(t.stack)return"x";if(n.stack)return"y";if(!!t.aggregate!=!!n.aggregate)return t.aggregate?"x":"y"}else{if("quantitative"===t.type)return"x";if("quantitative"===n.type)return"y"}else{if(tz(t)&&"quantitative"===t.type)return"x";if(tz(n)&&"quantitative"===n.type)return"y"}}(t);if(!i)return null;const o=t[i],a=rz(o)?sz(o,{}):void 0,u="x"===i?"y":"x",s=t[u],l=rz(s)?sz(s,{}):void 0,c=SM.reduce((e,n)=>{if("tooltip"!==n&&Fz(t,n)){const r=t[n];(Object(oe.A)(r)?r:[r]).forEach(t=>{const r=bz(t);if(r.aggregate)return;const i=rz(r)?sz(r,{}):void 0;(!i||i!==l&&i!==a)&&e.push({channel:n,fieldDef:r})})}return e},[]);let f;if(void 0!==o.stack?f=Object(oe.B)(o.stack)?o.stack?"zero":null:o.stack:c.length>0&&XT(zL,r)&&(f="zero"),!f||!PL[f])return null;if(Pz(t)&&0===c.length)return null;if(o.scale&&o.scale.type&&o.scale.type!==KP.LINEAR){if(n.disallowNonLinearStack)return null;vP(hP.cannotStackNonLinearScale(o.scale.type))}return Fz(t,i===ID?"x2":"y2")?(void 0!==o.stack&&vP(hP.cannotStackRangedMark(i)),null):(o.aggregate&&!XT(RD,o.aggregate)&&vP(hP.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:s?u:void 0,fieldChannel:i,impute:null!==o.impute&&bD(r),stackBy:c,offset:f})}function IL(e){const{point:t,line:n}=e,r=k(e,["point","line"]);return rD(r).length>1?r:r.type}function $L(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:HT(e[t],["point","line"])}));return e}function BL(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?Object(oe.F)(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?Object(oe.F)(t.point)?t.point:{}:void 0}function UL(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 qL{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(SD(e)){const{mark:n,encoding:r}=e,i=_D(n)?n:{type:n};switch(i.type){case"line":case"rule":case"trail":return!!BL(i,t[i.type],r);case"area":return!!BL(i,t[i.type],r)||!!UL(i,t[i.type])}}return!1}run(e,t,n){const{config:r}=t,{selection:i,projection:o,encoding:a,mark:u}=e,s=k(e,["selection","projection","encoding","mark"]),l=_D(u)?u:{type:u},c=BL(l,r[l.type],a),f="area"===l.type&&UL(l,r[l.type]),d=[Object.assign(Object.assign({},i?{selection:i}:{}),{mark:IL(Object.assign(Object.assign({},l),"area"===l.type?{opacity:.7}:{})),encoding:HT(a,["shape"])})],h=LL(l,a);let p=a;if(h){const{fieldChannel:e,offset:t}=h;p=Object.assign(Object.assign({},a),{[e]:Object.assign(Object.assign({},a[e]),t?{stack:t}:{})})}return f&&d.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"line"},WT(l,["clip","interpolate","tension","tooltip"])),f),encoding:p})),c&&d.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},WT(l,["clip","tooltip"])),c),encoding:p})),n(Object.assign(Object.assign({},s),{layer:d}),Object.assign(Object.assign({},t),{config:$L(r)}))}}class WL{constructor(){this.name="RangeStep"}hasMatchingType(e){var t,n;if(SD(e)&&e.encoding)for(const r of AM){const i=e.encoding[r];if(i&&tz(i)&&(null===(n=null===(t=i)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep))return!0}return!1}run(e){var t,n;const r={};let i=Object.assign({},e.encoding);for(const e of AM){const o=NM(e),a=i[e];if(a&&tz(a)&&(null===(n=null===(t=a)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep)){const{scale:t}=a,n=k(a,["scale"]),u=t,{rangeStep:s}=u,l=k(u,["rangeStep"]);r[o]={step:t.rangeStep},vP(hP.RANGE_STEP_DEPRECATED),i=Object.assign(Object.assign({},i),{[e]:Object.assign(Object.assign({},n),rD(l).length>0?{scale:l}:{})})}}return Object.assign(Object.assign(Object.assign({},r),e),{encoding:i})}}class HL{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(SD(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of pM){const n=t[gM(e)];if(t[e]&&tz(n)&&!Nz(n.bin))return!0}}return!1}run(e,t,n){const{encoding:r}=e;return vP(hP.lineWithRange(!!r.x2,!!r.y2)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function YL(e){const{parentEncoding:t,encoding:n}=e;if(t&&n){const e=rD(t).reduce((e,t)=>(n[t]&&e.push(t),e),[]);e.length>0&&vP(hP.encodingOverridden(e))}const r=Object.assign(Object.assign({},null!=t?t:{}),null!=n?n:{});return rD(r).length>0?r:void 0}function VL(e){const{parentProjection:t,projection:n}=e;return t&&n&&vP(hP.projectionOverridden({parentProjection:t,projection:n})),null!=n?n:t}function GL(e,t){void 0===t&&(t=SL(e.config));const n=function(e,t={}){return XL.map(e,{config:t})}(e,t),{width:r,height:i}=e,o=function(e,t,n){let{width:r,height:i}=t;const o=SD(e)||ML(e),a={};o?"container"==r&&"container"==i?(a.type="fit",a.contains="padding"):"container"==r?(a.type="fit-x",a.contains="padding"):"container"==i&&(a.type="fit-y",a.contains="padding"):("container"==r&&(vP(hP.containerSizeNonSingle("width")),r=void 0),"container"==i&&(vP(hP.containerSizeNonSingle("height")),i=void 0));const u=Object.assign(Object.assign(Object.assign({type:"pad"},a),n?KL(n.autosize):{}),KL(e.autosize));"fit"!==u.type||o||(vP(hP.FIT_NON_SINGLE),u.type="pad");"container"==r&&"fit"!=u.type&&"fit-x"!=u.type&&vP(hP.containerSizeNotCompatibleWithAutosize("width"));"container"==i&&"fit"!=u.type&&"fit-y"!=u.type&&vP(hP.containerSizeNotCompatibleWithAutosize("height"));if(UT(u,{type:"pad"}))return;return u}(n,{width:r,height:i,autosize:e.autosize},t);return Object.assign(Object.assign({},n),o?{autosize:o}:{})}const XL=new class extends FL{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[Kz,tL,uL,new qL,new HL,new WL]}map(e,t){if(SD(e)){const n=Fz(e.encoding,LD),r=Fz(e.encoding,"column"),i=Fz(e.encoding,"facet");if(n||r||i)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:r}=t;if(n||r)return this.mapUnitWithParentEncodingOrProjection(e,t);const i=this.mapLayerOrUnit.bind(this);for(const n of this.nonFacetUnitNormalizers)if(n.hasMatchingType(e,t.config))return n.run(e,t,i);return e}mapRepeat(e,t){const{repeat:n}=e;return!Object(oe.A)(n)&&e.columns&&(e=HT(e,["columns"]),vP(hP.columnsNotSupportByRowCol("repeat"))),Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapFacet(e,t){const{facet:n}=e;return VR(n)&&e.columns&&(e=HT(e,["columns"]),vP(hP.columnsNotSupportByRowCol("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:r}=e,{parentEncoding:i,parentProjection:o,config:a}=t,u=VL({parentProjection:o,projection:r}),s=YL({parentEncoding:i,encoding:n});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),u?{projection:u}:{}),s?{encoding:s}:{}),{config:a})}mapFacetedUnit(e,t){const n=e.encoding,{row:r,column:i,facet:o}=n,a=k(n,["row","column","facet"]),{mark:u,width:s,projection:l,height:c,selection:f,encoding:d}=e,h=k(e,["mark","width","projection","height","selection","encoding"]),{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:r,column:i,facet:o});return this.mapFacet(Object.assign(Object.assign(Object.assign({},h),m),{facet:p,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l?{projection:l}:{}),{mark:u}),s?{width:s}:{}),c?{height:c}:{}),{encoding:a}),f?{selection:f}:{})}),t)}getFacetMappingAndLayout(e){var t;const{row:n,column:r,facet:i}=e;if(n||r){i&&vP(hP.facetChannelDropped([...n?[LD]:[],...r?["column"]:[]]));const o={},a={};for(const n of[LD,"column"]){const r=e[n];if(r){const{align:e,center:i,spacing:u,columns:s}=r,l=k(r,["align","center","spacing","columns"]);o[n]=l;for(const e of["align","center","spacing"])void 0!==r[e]&&(a[e]=null!=(t=a[e])?t:{},a[e][n]=r[e])}}return{facetMapping:o,layout:a}}{const{align:e,center:t,spacing:n,columns:r}=i;return{facetMapping:k(i,["align","center","spacing","columns"]),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),t?{center:t}:{}),n?{spacing:n}:{}),r?{columns:r}:{})}}}mapLayer(e,t){var{parentEncoding:n,parentProjection:r}=t,i=k(t,["parentEncoding","parentProjection"]);const{encoding:o,projection:a}=e,u=k(e,["encoding","projection"]),s=Object.assign(Object.assign({},i),{parentEncoding:YL({parentEncoding:n,encoding:o}),parentProjection:VL({parentProjection:r,projection:a})});return super.mapLayer(u,s)}};function KL(e){return Object(oe.H)(e)?{type:e}:null!=e?e:{}}const JL=["background","padding"];function QL(e){return JL.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}function ZL(e){return!!e.url}function eI(e){return!!e.values}function tI(e){return!(!e.name||ZL(e)||eI(e)||nI(e))}function nI(e){return e&&(rI(e)||iI(e)||oI(e))}function rI(e){return!!e.sequence}function iI(e){return!!e.sphere}function oI(e){return!!e.graticule}const aI="main";function uI(e){return void 0!==e.filter}function sI(e){return void 0!==e.lookup}function lI(e){return void 0!==e.pivot}function cI(e){return void 0!==e.density}function fI(e){return void 0!==e.quantile}function dI(e){return void 0!==e.regression}function hI(e){return void 0!==e.loess}function pI(e){return void 0!==e.sample}function mI(e){return void 0!==e.window}function gI(e){return void 0!==e.joinaggregate}function vI(e){return void 0!==e.flatten}function yI(e){return void 0!==e.calculate}function bI(e){return!!e.bin}function xI(e){return void 0!==e.impute}function wI(e){return void 0!==e.timeUnit}function _I(e){return void 0!==e.aggregate}function EI(e){return void 0!==e.stack}function OI(e){return void 0!==e.fold}function kI(e){return!!e.signal}function jI(e){return!!e.step}function SI(e){return!Object(oe.A)(e)&&("field"in e&&"data"in e)}const CI=rD({opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeMiterLimit: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,x:1,y:1,x2:1,y2:1,width:1,height:1,aspect:1}),AI=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"],NI={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"},gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDash"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDash"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickWidth:{part:"ticks",vgProp:"strokeWidth"}};const TI=["domain","grid","labels","ticks","title"],DI={grid:"grid",gridColor:"grid",gridDash:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",domain:"main",domainColor:"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",labelFontWeight:"main",labelLimit:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",maxExtent:"main",minExtent:"main",offset:"main",position:"main",tickColor:"main",tickExtra:"main",tickOffset:"both",tickOpacity:"main",tickRound:"main",ticks:"main",tickSize:"main",title:"main",titleAlign:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",tickWidth:"both",tickCount:"both",values:"both",scale:"both",zindex:"both"},MI={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid: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,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand: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,values:1,translate:1,zindex:1},FI=Object.assign(Object.assign({},MI),{labelExpr:1,encoding:1});rD(FI);function PI(e,t,n,r){const i=t&&t.condition,o=r(t);if(i){return{[n]:[...Object(oe.i)(i).map(t=>{const n=r(t),i=function(e){return e.selection}(t)?J$(e,t.selection):Z$(e,t.test);return Object.assign({test:i},n)}),...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function RI(e){const{channel:t,channelDef:n,markDef:r,scale:i}=e,o=UI(e);return tz(n)&&!PD(n.aggregate)&&i&&cR(i.get("type"))&&!1===i.get("zero")?zI({fieldDef:n,channel:t,markDef:r,ref:o}):o}function zI({fieldDef:e,channel:t,markDef:n,ref:r}){return bD(n.type)?r:[LI(e,t),r]}function LI(e,t){const n=II(e,!0),r="x"===gM(t)?{value:0}:{field:{group:"height"}};return Object.assign({test:n},r)}function II(e,t=!0){return VP(Object(oe.H)(e)?e:sz(e,{expr:"datum"}),!t)}function $I(e,t,n,r){const i=Object.assign(Object.assign({},t?{scale:t}:{}),{field:sz(e,n)});if(r){const{offset:e,band:t}=r;return Object.assign(Object.assign(Object.assign({},i),e?{offset:e}:{}),t?{band:t}:{})}return i}function BI({scaleName:e,fieldDef:t,fieldDef2:n,offset:r,startSuffix:i,band:o=.5}){const a=0UI({channel:e,channelDef:n,markDef:r,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:u}))}function HI(e){const{markDef:t,encoding:n,config:r}=e,{filled:i,type:o}=t,a={fill:AR("fill",t,r),stroke:AR("stroke",t,r),color:AR("color",t,r)},u=XT(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,s=pD(t.fill,!0===i?t.color:void 0,a.fill,!0===i?a.color:void 0,u),l=pD(t.stroke,!1===i?t.color:void 0,a.stroke,!1===i?a.color:void 0),c=i?"fill":"stroke",f=Object.assign(Object.assign({},s?{fill:{value:s}}:{}),l?{stroke:{value:l}}:{});return t.color&&(i?t.fill:t.stroke)&&vP(hP.droppingColor("property",{fill:"fill"in t,stroke:"stroke"in t})),Object.assign(Object.assign(Object.assign(Object.assign({},f),WI("color",e,{vgChannel:c,defaultValue:i?s:l})),WI("fill",e,{defaultValue:n.fill?s:void 0})),WI("stroke",e,{defaultValue:n.stroke?l:void 0}))}function YI(e,t="text"){const n=e.encoding[t];return PI(e,n,t,t=>VI(t,e.config))}function VI(e,t,n="datum"){if(e){if(iz(e))return{value:e.value};if(nz(e))return TR(e,vz(e),n,t)}}function GI(e,t={}){const{encoding:n,markDef:r,config:i}=e,o=n.tooltip;return Object(oe.A)(o)?{tooltip:XI({tooltip:o},i,t)}:PI(e,o,"tooltip",o=>{const a=VI(o,e.config,t.reactiveGeom?"datum.datum":"datum");if(a)return a;if(null===o)return;let u=pD(r.tooltip,AR("tooltip",r,i));return!0===u&&(u={content:"encoding"}),Object(oe.H)(u)?{value:u}:Object(oe.F)(u)?"encoding"===u.content?XI(n,i,t):{signal:"datum"}:void 0})}function XI(e,t,{reactiveGeom:n}={}){const r=[],i={},o={},a=n?"datum.datum":"datum",u=[];function s(n,r){const i=gM(r),s=nz(n)?n:Object.assign(Object.assign({},n),{type:e[i].type}),l=Object(oe.i)(pz(s,t,{allowDisabling:!1})).join(", ");let c=VI(s,t,a).signal;if("x"===r||"y"===r){const n="x"===r?"x2":"y2",i=yz(e[n]);if(Nz(s.bin)&&i){c=PR(sz(s,{expr:a}),sz(i,{expr:a}),vz(s),t),o[n]=!0}}u.push({channel:r,key:l,value:c})}Iz(e,(e,t)=>{tz(e)?s(e,t):ez(e)&&s(e.condition,t)});for(const{channel:e,key:t,value:n}of u)o[e]||i[t]||(r.push(`${Object(oe.Y)(t)}: ${n}`),i[t]=!0);return r.length>0?{signal:`{${r.join(", ")}}`}:void 0}function KI(e,t){const n=t[e+"Offset"];if(n)return n}function JI(e,t,{defaultPos:n,vgChannel:r}){const{encoding:i,mark:o,markDef:a,config:u,stack:s}=t,l=i[e],c=i[e===ID?"x2":"y2"],f=t.scaleName(e),d=t.getScaleComponent(e),h=KI(e,t.markDef),p=QI({model:t,markDef:a,config:u,defaultPos:n,channel:e,scaleName:f,scale:d,mark:o,checkBarAreaWithoutZero:!c});return{[null!=r?r:e]:l||!i.latitude&&!i.longitude?function(e){const{channel:t,channelDef:n,scaleName:r,stack:i,offset:o}=e;if(tz(n)&&i&&t===i.fieldChannel)return az(n)&&void 0!==n.band?BI({scaleName:r,fieldDef:n,startSuffix:"start",band:n.band,offset:0}):$I(n,r,{suffix:"end"},{offset:o});return RI(e)}({channel:e,channelDef:l,channel2Def:c,markDef:a,config:u,scaleName:f,scale:d,stack:s,offset:h,defaultRef:p}):{field:t.getName(e)}}}function QI({model:e,markDef:t,config:n,defaultPos:r,channel:i,scaleName:o,scale:a,mark:u,checkBarAreaWithoutZero:s}){return()=>{const l=gM(i),c=pD(t[i],AR(i,t,n));if(void 0!==c)return qI(i,c);if("zeroOrMin"===r||"zeroOrMax"===r){if(o){const e=a.get("type");if(XT([KP.LOG,KP.TIME,KP.UTC],e))!s||"bar"!==u&&"area"!==u||vP(hP.nonZeroScaleUsedWithLengthMark(u,l,{scaleType:e}));else{if(a.domainDefinitelyIncludesZero())return{scale:o,value:0};!s||"bar"!==u&&"area"!==u||vP(hP.nonZeroScaleUsedWithLengthMark(u,l,{zeroFalse:!1===a.explicit.zero}))}}return"zeroOrMin"===r?"x"===l?{value:0}:{field:{group:"height"}}:"x"===l?{field:{group:"width"}}:{value:0}}{const t=e["x"===l?"width":"height"];return Object.assign(Object.assign({},t),{mult:.5})}}}const ZI={left:"x",center:"xc",right:"x2"},e$={top:"y",middle:"yc",bottom:"y2"};function t$(e,t,n){const r="x"===e?"align":"baseline",i=pD(t[r],AR(r,t,n));return"x"===e?ZI[null!=i?i:"center"]:e$[null!=i?i:"middle"]}function n$(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?r$(e,t,{defaultPos:n,defaultPos2:r}):JI(e,t,{defaultPos:n})}function r$(e,t,{defaultPos:n,defaultPos2:r}){const{markDef:i,config:o}=t,a="x"===e?"width":"height",u=function(e,t,n){const{encoding:r,mark:i,markDef:o,stack:a,config:u}=e,s="x2"===n?"x":"y",l="x2"===n?"width":"height",c=r[s],f=e.scaleName(s),d=e.getScaleComponent(s),h=KI(n,e.markDef);if(!c&&(r.latitude||r.longitude))return{[n]:{field:e.getName(n)}};const p=function({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:l}){if(tz(t)&&u&&e.charAt(0)===u.fieldChannel.charAt(0))return $I(t,o,{suffix:"start"},{offset:s});return RI({channel:e,channelDef:n,scaleName:o,scale:a,stack:u,markDef:r,config:i,offset:s,defaultRef:l})}({channel:n,channelDef:c,channel2Def:r[n],markDef:o,config:u,scaleName:f,scale:d,stack:a,offset:h,defaultRef:void 0});if(void 0!==p)return{[n]:p};const m=QI({model:e,markDef:o,config:u,defaultPos:t,channel:n,scaleName:f,scale:d,mark:i,checkBarAreaWithoutZero:!r[n]})();return pD(i$(n,o),i$(n,{[n]:NR(n,o,u.style),[l]:NR(l,o,u.style)}),i$(n,u[i]),i$(n,u.mark),{[n]:m})}(t,r,"x"===e?"x2":"y2"),s=u[a]?t$(e,i,o):e;return Object.assign(Object.assign({},JI(e,t,{defaultPos:n,vgChannel:s})),u)}function i$(e,t){const n="x2"===e?"width":"height";return t[e]?{[e]:qI(e,t[e])}:t[n]?{[n]:{value:t[n]}}:void 0}function o$(e,t,n){var r,i,o,a;const{config:u,encoding:s,markDef:l}=e,c="x"===t?"x2":"y2",f="x"===t?"width":"height",d=s[t],h=s[c],p=e.getScaleComponent(t),m=p?p.get("type"):void 0,g=e.scaleName(t),v=l.orient,y=null!=(a=null!=(o=null!=(i=null!=(r=s[f])?r:s.size)?i:l[f])?o:l.size)?a:AR("size",l,u,{vgChannel:f}),b="x"===t?"vertical"===v:"horizontal"===v;if(tz(d)&&(Az(d.bin)||Nz(d.bin)||d.timeUnit&&!h)&&!y&&!sR(m)){return function({fieldDef:e,fieldDef2:t,channel:n,band:r,scaleName:i,markDef:o,spacing:a=0,reverse:u}){const s={x:u?a:0,x2:u?0:a,y:u?0:a,y2:u?a:0},l=n===ID?"x2":"y2";return Az(e.bin)||e.timeUnit?{[l]:s$({channel:n,fieldDef:e,scaleName:i,markDef:o,band:(1-r)/2,offset:s[`${n}2`]}),[n]:s$({channel:n,fieldDef:e,scaleName:i,markDef:o,band:1-(1-r)/2,offset:s[n]})}:Nz(e.bin)&&tz(t)?{[l]:$I(e,i,{},{offset:s[`${n}2`]}),[n]:$I(t,i,{},{offset:s[n]})}:void vP(hP.channelRequiredForBinned(l))}({fieldDef:d,fieldDef2:h,channel:t,markDef:l,scaleName:g,band:JR(t,d,void 0,l,u),spacing:pD(l.binSpacing,u[n].binSpacing),reverse:p.get("reverse")})}if((tz(d)&&sR(m)||b)&&!h){if(tz(d)&&m===KP.BAND){return function(e,t,n,r){var i;const o=n.scaleName(t),a="x"===t?"width":"height",{markDef:u,encoding:s,config:l}=n,c={[t$(t,u,l)]:$I(e,o,{},{band:.5})};if(s.size||null!==u.size&&void 0!==u.size){if(u.orient){if(bz(s.size)||iz(s.size))return Object.assign(Object.assign({},c),WI("size",n,{vgChannel:a}));if(void 0!==u.size)return Object.assign(Object.assign({},c),{[a]:{value:u.size}})}else vP(hP.cannotApplySizeToNonOrientedMark(u.type))}if(void 0!==(null===(i=r)||void 0===i?void 0:i.value))return Object.assign(Object.assign({},c),{[a]:r});const{band:f=1}=e;return{[t]:$I(e,o,{binSuffix:"range"},{band:(1-f)/2}),[a]:null!=r?r:u$(o,f)}}(d,t,e,a$(n,l,f,g,p,u,az(d)?d.band:void 0))}return function(e,t,n){const r="x"===e?"xc":"yc",i="x"===e?"width":"height";return Object.assign(Object.assign({},JI(e,t,{defaultPos:"mid",vgChannel:r})),WI("size",t,{defaultRef:n,vgChannel:i}))}(t,e,a$(n,l,f,g,p,u))}return r$(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function a$(e,t,n,r,i,o,a){const u=pD(t[n],t.size,AR("size",t,o,{vgChannel:n}));if(void 0!==u)return{value:u};if(i){const t=i.get("type");if("point"===t||"band"===t){if(void 0!==o[e].discreteBandSize)return{value:o[e].discreteBandSize};if(t===KP.POINT){const e=i.get("range");return jI(e)&&Object(oe.E)(e.step)?{value:e.step-2}:{value:kL-2}}return u$(r,a)}return{value:o[e].continuousBandSize}}const s=EL(o.view,n);return{value:pD(o[e].discreteBandSize,s-2)}}function u$(e,t=!0){return{scale:e,band:t}}function s$({channel:e,fieldDef:t,scaleName:n,markDef:r,band:i,offset:o}){return zI({fieldDef:t,channel:e,markDef:r,ref:BI({scaleName:n,fieldDef:t,band:i,offset:o})})}function l$(e,t){const{fill:n,stroke:r}="include"===t.color?HI(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return CI.reduce((n,r)=>(void 0!==e[r]&&"ignore"!==t[r]&&(n[r]={value:e[r]}),n),{})}(e.markDef,t)),c$(e,"fill",n)),c$(e,"stroke",r)),WI("opacity",e)),WI("fillOpacity",e)),WI("strokeOpacity",e)),WI("strokeWidth",e)),GI(e)),YI(e,"href"))}function c$(e,t,n){const{config:r,mark:i,markDef:o}=e;if("hide"===CR("invalid",o,r)&&n&&!bD(i)){const r=function(e,{invalid:t=!1,channels:n}){const r=n.reduce((t,n)=>{const r=e.getScaleComponent(n);if(r){const i=r.get("type"),o=e.vgField(n,{expr:"datum"});o&&lR(i)&&(t[o]=!0)}return t},{}),i=rD(r);if(i.length>0){const e=t?"||":"&&";return i.map(e=>II(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:UM});if(r)return{[t]:[{test:r,value:null},...Object(oe.i)(n)]}}return n?{[t]:n}:{}}function f$(e){const{config:t,markDef:n}=e;if(CR("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const r=n.reduce((t,n)=>{const r=e.getScaleComponent(n);if(r){const i=r.get("type"),o=e.vgField(n,{expr:"datum"});o&&lR(i)&&(t[o]=!0)}return t},{}),i=rD(r);if(i.length>0){const e=t?"||":"&&";return i.map(e=>II(e,t)).join(` ${e} `)}return}(e,{channels:["x","y"]});if(t)return{defined:{signal:t}}}return{}}function d$(e,t){if(void 0!==t)return{[e]:{value:t}}}var h$={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName("voronoi")},marks:(e,t,n)=>{const{x:r,y:i}=t.project.hasChannel,o=e.mark;if(bD(o))return vP(hP.nearestNotSupportForContinuous(o)),n;const a={name:e.getName("voronoi"),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},GI(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let u=0,s=!1;return n.forEach((t,n)=>{var r;const i=null!=(r=t.name)?r:"";i===e.component.mark[0].name?u=n:i.indexOf("voronoi")>=0&&(s=!0)}),s||n.splice(u+1,0,a),n}};class p${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.indexOf(e)>-1?console.warn("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),e.parent.removeChild(e),this.parent=t,e.parent=this}}class m$ extends p${constructor(e,t,n,r){super(e,t),this.type=n,this.refCounts=r,this._source=this._name=t,!this.refCounts||this._name in this.refCounts||(this.refCounts[this._name]=0)}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}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${gD()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class g$ extends p${constructor(e,t){super(e),this.formula=t}clone(){return new g$(null,qT(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,r)=>{const{timeUnit:i,field:o}=n,a=Eq(t)?t.encoding[vM(r)]:void 0,u=Eq(t)&&QR(r,n,a,t.markDef,t.config);if(i){const t=sz(n,{forAs:!0});e[VT({as:t,timeUnit:i,field:o})]=Object.assign({as:t,timeUnit:i,field:o},u?{band:!0}:{})}return e},{});return 0===rD(n).length?null:new g$(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t);return new g$(e,{[VT(n)]:n})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(iD(this.formula).map(e=>e.as))}dependentFields(){return new Set(iD(this.formula).map(e=>e.field))}hash(){return`TimeUnit ${VT(this.formula)}`}assemble(){const e=[];for(const t of iD(this.formula)){const{timeUnit:n,field:r,as:i}=t;e.push({field:r,type:"timeunit",units:DP(n),as:[i,`${i}_end`]})}return e}}class v${constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}var y$={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!pL(e.bind),parse:(e,t,n,r)=>{r.on||delete t.events,r.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const r=t.name,i=t.project,o=t.bind,a=t.init&&t.init[0],u=h$.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((e,i)=>{var s,l;const c=aD(`${r}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift(Object.assign(Object.assign({name:c},a?{init:D$(a[i])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${Object(oe.Y)(e.field)}] : null`}]:[],bind:(s=o[e.field],l=null!=s?s:o[e.channel],null!=l?l:o)}))}),n},signals:(e,t,n)=>{const r=t.name,i=t.project,o=n.filter(e=>e.name===r+U$)[0],a=r+"_tuple_fields",u=i.items.map(e=>aD(`${r}_${e.field}`)),s=u.map(e=>`${e} !== null`).join(" && ");return u.length&&(o.update=`${s} ? {fields: ${a}, values: [${u.join(", ")}]} : null`),delete o.value,delete o.on,n}};var b$={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+U$,r=t.name+"_toggle";return`${r} ? null : ${n}, `+("global"===t.resolve?`${r} ? null : true, `:`${r} ? null : {unit: ${V$(e)}}, `)+`${r} ? ${n} : null`}};const x$={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=Object(oe.H)(n.clear)?rA(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>(y$.has(t)&&t.project.items.forEach(e=>{const r=n.findIndex(n=>n.name===aD(`${t.name}_${e.field}`));-1!==r&&n[r].on.push({events:t.clear,update:"null"})}),n),signals:(e,t,n)=>{function r(e,r){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:r})}if("interval"===t.type)t.project.items.forEach(e=>{const t=n.findIndex(t=>t.name===e.signals.visual);if(r(t,"[0, 0]"),-1===t){r(n.findIndex(t=>t.name===e.signals.data),"null")}});else{let e=n.findIndex(e=>e.name===t.name+U$);r(e,"null"),b$.has(t)&&(e=n.findIndex(e=>e.name===t.name+"_toggle"),r(e,"false"))}return n}};var w$={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const r of t.project.items){const i=r.channel;if(!qM(i))continue;const o=e.getScaleComponent(i),a=o?o.get("type"):void 0;if(!o||!lR(a)){vP(hP.SCALE_BINDINGS_CONTINUOUS);continue}const u={selection:t.name,field:r.field};if(o.set("selectionExtent",u,!0),n.push(r),e.repeater&&e.repeater.row===e.repeater.column){e.getScaleComponent(i===ID?$D:ID).set("selectionExtent",u,!0)}}},topLevelSignals:(e,t,n)=>{const r=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||E$(e)||0===r.length)return n;const i=n.filter(e=>e.name===t.name)[0];let o=i.update;if(o.indexOf(W$)>=0)i.update=`{${r.map(e=>`${Object(oe.Y)(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of r){const t=`${Object(oe.Y)(e.field)}: ${e.signals.data}`;o.indexOf(t)<0&&(o=`${o.substring(0,o.length-1)}, ${t}}`)}i.update=o}return n.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!E$(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}};function _$(e,t){return`domain(${Object(oe.Y)(e.scaleName(t))})`}function E$(e){var t;return e.parent&&Sq(e.parent)&&(null!=(t=!e.parent.parent)?t:E$(e.parent.parent))}const O$={has:e=>{const t="global"===e.resolve&&e.bind&&pL(e.bind),n=1===e.project.items.length&&"_vgsid_"!==e.project.items[0].field;return t&&!n&&vP(hP.LEGEND_BINDINGS_PROJECT_LENGTH),t&&n},parse:(e,t,n,r)=>{var i;if(r.on||delete t.events,r.clear||delete t.clear,r.on||r.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=Object(oe.i)(null!=(i=n.filter)?i:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const o=mL(t.bind)?t.bind.legend:"click",a=Object(oe.H)(o)?rA(o,"view"):Object(oe.i)(o);t.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const r=t.name,i=mL(t.bind)&&t.bind.legend,o=e=>t=>{const n=qT(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${e.field}_legend`,u=`${r}_${a}`;if(0===n.filter(e=>e.name===u).length){const e=i.merge.map(o(`${a}_symbols`)).concat(i.merge.map(o(`${a}_labels`))).concat(i.merge.map(o(`${a}_entries`)));n.unshift(Object.assign(Object.assign({name:u},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]}))}}return n},signals:(e,t,n)=>{const r=t.name,i=t.project,o=n.find(e=>e.name===r+U$),a=r+"_tuple_fields",u=i.items.filter(e=>e.hasLegend).map(e=>aD(`${r}_${e.field}_legend`)),s=`${u.map(e=>`${e} !== null`).join(" && ")} ? {fields: ${a}, values: [${u.join(", ")}]} : null`;t.events&&u.length>0?o.on.push({events:u.map(e=>({signal:e})),update:s}):u.length>0&&(o.update=s,delete o.value,delete o.on);const l=n.find(e=>e.name===r+"_toggle"),c=mL(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push(Object.assign(Object.assign({},l.on[0]),{events:c})):l.on[0].events=c),n}};const k$="_translate_delta",j$={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const r=t.name,i=w$.has(t),o=r+"_translate_anchor",{x:a,y:u}=t.project.hasChannel;let s=rA(t.translate,"scope");return i||(s=s.map(e=>(e.between[0].markname=r+P$,e))),n.push({name:o,value:{},on:[{events:s.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==a?", extent_x: "+(i?_$(e,ID):`slice(${a.signals.visual})`):"")+(void 0!==u?", extent_y: "+(i?_$(e,$D):`slice(${u.signals.visual})`):"")+"}"}]},{name:r+k$,value:{},on:[{events:s,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&S$(e,t,a,"width",n),void 0!==u&&S$(e,t,u,"height",n),n}};function S$(e,t,n,r,i){var o;const a=t.name,u=a+"_translate_anchor",s=a+k$,l=n.channel,c=w$.has(t),f=i.filter(e=>e.name===n.signals[c?"data":"visual"])[0],d=e.getSizeSignalRef(r).signal,h=e.getScaleComponent(l),p=h.get("type"),m=`${u}.extent_${l}`,g=`${c?"log"===p?"panLog":"pow"===p?"panPow":"panLinear":"panLinear"}(${m}, ${`${c&&l===ID?"-":""}${s}.${l} / `+(c?`${d}`:`span(${m})`)}`+(c&&"pow"===p?`, ${o=h.get("exponent"),null!=o?o:1}`:"")+")";f.on.push({events:{signal:s},update:c?g:`clampRange(${g}, 0, ${d})`})}const C$={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const r=t.name,i=w$.has(t),o=r+"_zoom_delta",{x:a,y:u}=t.project.hasChannel,s=Object(oe.Y)(e.scaleName(ID)),l=Object(oe.Y)(e.scaleName($D));let c=rA(t.zoom,"scope");return i||(c=c.map(e=>(e.markname=r+P$,e))),n.push({name:r+"_zoom_anchor",on:[{events:c,update:i?"{"+[s?`x: invert(${s}, x(unit))`:"",l?`y: invert(${l}, 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&&A$(e,t,a,"width",n),void 0!==u&&A$(e,t,u,"height",n),n}};function A$(e,t,n,r,i){var o;const a=t.name,u=n.channel,s=w$.has(t),l=i.filter(e=>e.name===n.signals[s?"data":"visual"])[0],c=e.getSizeSignalRef(r).signal,f=e.getScaleComponent(u),d=f.get("type"),h=s?_$(e,u):l.name,p=a+"_zoom_delta",m=`${s?"log"===d?"zoomLog":"pow"===d?"zoomPow":"zoomLinear":"zoomLinear"}(${h}, ${`${a}_zoom_anchor.${u}`}, ${p}`+(s&&"pow"===d?`, ${o=f.get("exponent"),null!=o?o:1}`:"")+")";l.on.push({events:{signal:p},update:s?m:`clampRange(${m}, 0, ${c})`})}const N$=[{has:()=>!0,parse:(e,t,n)=>{var r,i,o;const a=t.name,u=null!=(r=t.project)?r:t.project=new v$,s={},l={},c=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=aD(`${a}_${n}`);for(let e=1;c.has(r);e++)r=aD(`${a}_${n}_${e}`);return c.add(r),{[t]:r}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of Object(oe.i)(n.init))for(const r of rD(e))dM[r]?(n.encodings||(n.encodings=[])).push(r):"interval"===n.type?(vP('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(r);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!=(i=n.fields)?i:[]){const t={type:"E",field:e};t.signals=Object.assign({},f(t,"data")),u.items.push(t),u.hasField[e]=t}for(const r of null!=(o=n.encodings)?o:[]){const n=e.fieldDef(r);if(n){let i=n.field;if(n.aggregate){vP(hP.cannotProjectAggregate(r,n.aggregate));continue}if(!i){vP(hP.cannotProjectOnChannelWithoutField(r));continue}if(n.timeUnit){i=e.vgField(r);const t={as:i,field:n.field,timeUnit:n.timeUnit};l[VT(t)]=t}if(!s[i]){let o="E";if("interval"===t.type){lR(e.getScaleComponent(r).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const a={field:i,channel:r,type:o};a.signals=Object.assign(Object.assign({},f(a,"data")),f(a,"visual")),u.items.push(s[i]=a),u.hasField[i]=u.hasChannel[r]=s[i]}}else vP(hP.cannotProjectOnChannelWithoutField(r))}if(n.init){const e=e=>u.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const r=Object(oe.A)(n.init)?n.init:[n.init];t.init=r.map(e)}}rD(l).length>0&&(u.timeUnit=new g$(null,l))},signals:(e,t,n)=>{const r=t.name+"_tuple_fields";return n.filter(e=>e.name===r).length>0?n:n.concat({name:r,value:t.project.items.map(e=>{const{signals:t,hasLegend:n}=e,r=k(e,["signals","hasLegend"]),i=qT(r);return i.field=fD(i.field),i})})}},b$,w$,O$,j$,C$,y$,h$,x$];function T$(e,t){for(const n of N$)n.has(e)&&t(n)}function D$(e,t=!0,n=oe.x){if(Object(oe.A)(e)){const r=e.map(e=>D$(e,t,n));return t?`[${r.join(", ")}]`:r}return yP(e)?n(EP(e,!1,!t)):t?n(JSON.stringify(e)):e}function M$(e,t){return Y$(e,(n,r)=>{t=r.marks?r.marks(e,n,t):t,T$(n,r=>{r.marks&&(t=r.marks(e,n,t))})}),t}function F$(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const P$="_brush",R$={signals:(e,t)=>{const n=t.name,r=n+"_tuple_fields",i=w$.has(t),o=[],a=[],u=[];if(t.translate&&!i){const e=`!event.item || event.item.mark.name !== ${Object(oe.Y)(n+P$)}`;z$(t,(t,n)=>{var r;const i=Object(oe.i)(null!=(r=n.between[0].filter)?r:n.between[0].filter=[]);return i.indexOf(e)<0&&i.push(e),t})}t.project.items.forEach((n,r)=>{const i=n.channel;if(i!==ID&&i!==$D)return void vP("Interval selections only support x and y encoding channels.");const s=t.init?t.init[r]:null,l=function(e,t,n,r){const i=n.channel,o=n.signals.visual,a=n.signals.data,u=w$.has(t),s=Object(oe.Y)(e.scaleName(i)),l=e.getScaleComponent(i),c=l?l.get("type"):void 0,f=e=>`scale(${s}, ${e})`,d=e.getSizeSignalRef(i===ID?"width":"height").signal,h=`${i}(unit)`,p=z$(t,(e,t)=>[...e,{events:t.between[0],update:`[${h}, ${h}]`},{events:t,update:`[${o}[0], clamp(${h}, 0, ${d})]`}]);return p.push({events:{signal:t.name+"_scale_trigger"},update:lR(c)?`[${f(`${a}[0]`)}, ${f(`${a}[1]`)}]`:"[0, 0]"}),u?[{name:a,on:[]}]:[Object.assign(Object.assign({name:o},r?{init:D$(r,!0,f)}:{value:[]}),{on:p}),Object.assign(Object.assign({name:a},r?{init:D$(r)}:{}),{on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${s}, ${o})`}]})]}(e,t,n,s),c=n.signals.data,f=n.signals.visual,d=Object(oe.Y)(e.scaleName(i)),h=lR(e.getScaleComponent(i).get("type"))?"+":"";o.push(...l),a.push(c),u.push({scaleName:e.scaleName(i),expr:`(!isArray(${c}) || `+`(${h}invert(${d}, ${f})[0] === ${h}${c}[0] && `+`${h}invert(${d}, ${f})[1] === ${h}${c}[1]))`})}),i||o.push({name:n+"_scale_trigger",value:{},on:[{events:u.map(e=>({scale:e.scaleName})),update:u.map(e=>e.expr).join(" && ")+` ? ${n+"_scale_trigger"} : {}`}]});const s=t.init,l=`unit: ${V$(e)}, fields: ${r}, values`;return o.concat(Object.assign(Object.assign({name:n+U$},s?{init:`{${l}: ${D$(s)}}`}:{}),{on:[{events:[{signal:a.join(" || ")}],update:a.join(" && ")+` ? {${l}: [${a}]} : null`}]}))},modifyExpr:(e,t)=>t.name+U$+", "+("global"===t.resolve?"true":`{unit: ${V$(e)}}`),marks:(e,t,n)=>{const r=t.name,{x:i,y:o}=t.project.hasChannel,a=i&&i.signals.visual,u=o&&o.signals.visual,s=`data(${Object(oe.Y)(t.name+B$)})`;if(w$.has(t))return n;const l={x:void 0!==i?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==i?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of rD(l))l[t]=[Object.assign({test:`${s}.length && ${s}[0].unit === ${V$(e)}`},l[t]),{value:0}];const c=t.mark,{fill:f,fillOpacity:d}=c,h=k(c,["fill","fillOpacity"]),p=rD(h).reduce((e,t)=>(e[t]=[{test:[void 0!==i&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter(e=>e).join(" && "),value:h[t]},{value:null}],e),{});return[{name:r+P$+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:l}},...n,{name:r+P$,type:"rect",clip:!0,encode:{enter:{fill:{value:"transparent"}},update:Object.assign(Object.assign({},l),p)}}]}};function z$(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(vP(`${n} is not an ordered event stream for interval selections.`),e),[])}function L$(e,t){const n=t.name,r=n+"_tuple_fields",i=t.project,o="(item().isVoronoi ? datum.datum : datum)",a=i.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${o}[${Object(oe.Y)(e.vgField(t.channel,{}))}], `+`${o}[${Object(oe.Y)(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${o}[${Object(oe.Y)(t.field)}]`}).join(", "),u=`unit: ${V$(e)}, fields: ${r}, values`,s=t.events;return[{name:n+U$,on:s?[{events:s,update:`datum && item().mark.marktype !== 'group' ? {${u}: [${a}]} : null`,force:!0}]:[]}]}const I$={signals:L$,modifyExpr:(e,t)=>t.name+U$+", "+("global"===t.resolve?"null":`{unit: ${V$(e)}}`)};const $$={signals:L$,modifyExpr:(e,t)=>t.name+U$+", "+("global"===t.resolve?"true":`{unit: ${V$(e)}}`)};const B$="_store",U$="_tuple",q$="_modify",W$="vlSelectionResolve",H$={single:$$,multi:I$,interval:R$};function Y$(e,t){const n=e.component.selection;if(n)for(const e in n)if(Object(oe.v)(n,e)){const r=n[e];if(!0===t(r,H$[r.type]))break}}function V$(e,{escape:t}={escape:!0}){let n=t?Object(oe.Y)(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!Oq(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const t of nM)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Object(oe.Y)(r.vgField(t))}])`)}return n}function G$(e){let t=!1;return Y$(e,e=>{t=t||e.project.items.some(e=>"_vgsid_"===e.field)}),t}function X$(e){const t=gj(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&function e(t){return"MemberExpression"===t.object.type?e(t.object):"datum"===t.object.name}(e)&&n.add(function e(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...e(t.object)),n.push(...e(t.property))),n)}(e).slice(1).join("."))}),n}class K$ extends p${constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Z$(this.model,this.filter,this),this._dependentFields=X$(this.expr)}clone(){return new K$(null,this.model,qT(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function J$(e,t,n,r="datum"){const i=[];const o=uD(t,(function(t){const o=aD(t),a=e.getSelectionComponent(o,t),u=Object(oe.Y)(o+B$);if(a.project.timeUnit){const t=null!=n?n:e.component.data.raw,r=a.project.timeUnit.clone();t.parent?r.insertAsParentOf(t):t.parent=r}return"none"!==a.empty&&i.push(u),`vlSelectionTest(${u}, ${r}`+("global"===a.resolve?")":`, ${Object(oe.Y)(a.resolve)})`)}));return(i.length?"!("+i.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${o})`}function Q$(e,t){const n=t.encoding;let r=t.field;if(n||r){if(n&&!r){const i=e.project.items.filter(e=>e.channel===n);!i.length||i.length>1?(r=e.project.items[0].field,vP((i.length?"Multiple ":"No ")+`matching ${Object(oe.Y)(n)} encoding found for selection ${Object(oe.Y)(t.selection)}. `+`Using "field": ${Object(oe.Y)(r)}.`)):r=i[0].field}}else r=e.project.items[0].field,e.project.items.length>1&&vP('A "field" or "encoding" must be specified when using a selection as a scale domain. '+`Using "field": ${Object(oe.Y)(r)}.`);return`${e.name}[${Object(oe.Y)(r)}]`}function Z$(e,t,n){return uD(t,t=>Object(oe.H)(t)?t:function(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}(t)?J$(e,t.selection,n):YP(t))}function eB(e,t,n,r){var i,o,a;e.encode=null!=(i=e.encode)?i:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(a=e.encode[t].update)?a:{},e.encode[t].update[n]=r}function tB(e,t,n,r={header:!1}){var i,o;const a=e.combine(),{orient:u,scale:s,labelExpr:l,title:c,zindex:f}=a,d=k(a,["orient","scale","labelExpr","title","zindex"]);if(rD(d).forEach(e=>{const n=DI[e],r=d[e];if(n&&n!==t&&"both"!==n)delete d[e];else if(r.condition){const{vgProp:t,part:n}=NI[e],{condition:i,value:o}=r,a=[...(Object(oe.A)(i)?i:[i]).map(e=>{const{value:t,test:n}=e;return{test:Z$(null,n),value:t}}),{value:o}];eB(d,n,t,a),delete d[e]}}),"grid"===t){if(!d.grid)return;if(d.encode){const{grid:e}=d.encode;d.encode=Object.assign({},e?{grid:e}:{}),0===rD(d.encode).length&&delete d.encode}return Object.assign(Object.assign({scale:s,orient:u},d),{domain:!1,labels:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:pD(f,0)})}{if(!r.header&&e.mainExtracted)return;if(void 0!==l){let e=l;(null===(o=null===(i=d.encode)||void 0===i?void 0:i.labels)||void 0===o?void 0:o.update)&&kI(d.encode.labels.update.text)&&(e=dD(l,"datum.label",d.encode.labels.update.text.signal)),eB(d,"labels","text",{signal:e})}if(d.encode){for(const t of TI)e.hasAxisPart(t)||delete d.encode[t];0===rD(d.encode).length&&delete d.encode}const t=function(e,t){if(e)return jR(e)?e:e.map(e=>gz(e,t)).join(", ")}(c,n);return Object.assign(Object.assign(Object.assign({scale:s,orient:u,grid:!1},t?{title:t}:{}),d),{zindex:pD(f,0)})}}function nB(e){const{axes:t}=e.component;for(const n of AM)if(t[n])for(const r of t[n])if(!r.get("gridScale")){const t="x"===n?"height":"width";return[{name:t,update:e.getSizeSignalRef(t).signal}]}return[]}const rB={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"},iB={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelLimit:"limit",labelOrient:"orient",labelPadding:"offset"},oB=rD(rB),aB=rD(iB);function uB(e,t,n,r,i){var o;const a=[..."band"===i?["axisBand"]:[],"x"===n?"axisX":"axisY",...r?["axis"+r.substr(0,1).toUpperCase()+r.substr(1)]:[],"axis"];for(const n of a)if(void 0!==(null===(o=t[n])||void 0===o?void 0:o[e]))return t[n][e]}function sB(e,t){if(void 0!==e)return e=vD(e),"top"===t||"bottom"===t?e<=45||315<=e?"top"===t?"bottom":"top":135<=e&&e<=225?"top"===t?"top":"bottom":"middle":e<=45||315<=e||135<=e&&e<=225?"middle":45<=e&&e<=135?"left"===t?"top":"bottom":"left"===t?"bottom":"top"}function lB(e,t){if(void 0!==e)return e=vD(e),"top"===t||"bottom"===t?e%180==0?"center":0{if(oz(t)&&YR(t.sort)){const{field:r,timeUnit:i}=t,o=t.sort,a=o.map((e,t)=>`${YP({field:r,timeUnit:i,equal:e})} ? ${t} : `).join("")+o.length;e=new fB(e,{calculate:a,as:dB(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 ${VT(this.transform)}`}}function dB(e,t,n){return sz(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function hB(e,t){return XT(["top","bottom"],t)?"column":XT(["left","right"],t)?"row":"row"===e?"row":"column"}function pB(e,t,n,r){const i="row"===r?n.headerRow:"column"===r?n.headerColumn:n.headerFacet;return pD(t&&t.header?t.header[e]:void 0,i[e],n.header[e])}function mB(e,t,n,r){const i={};for(const o of e){const e=pB(o,t,n,r);void 0!==e&&(i[o]=e)}return i}const gB=["row","column"],vB=["header","footer"];function yB(e,t){const n=e.component.layoutHeaders[t].title,r=e.config?e.config:void 0,i=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:u}=mB(["titleAnchor","titleAngle","titleOrient"],i,r,t),s=hB(t,u);return{name:`${t}-title`,type:"group",role:`${s}-title`,title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),xB(a,s)),bB(s,a,o)),SB(r,i,t,oB,rB))}}function bB(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const r=lB(t,"row"===e?"left":"top");return r?{align:r}:{}}function xB(e,t){const n=sB(e,"row"===t?"left":"top");return n?{baseline:n}:{}}function wB(e,t){const n=e.component.layoutHeaders[t],r=[];for(const i of vB)if(n[i])for(const o of n[i])r.push(OB(e,t,i,n,o));return r}function _B(e,t){var n;const{sort:r}=e;return HR(r)?{field:sz(r,{expr:"datum"}),order:(n=r.order,null!=n?n:"ascending")}:Object(oe.A)(r)?{field:dB(e,t,{expr:"datum"}),order:"ascending"}:{field:sz(e,{expr:"datum"}),order:null!=r?r:"ascending"}}function EB(e,t,n){const{format:r,labelAngle:i,labelAnchor:o,labelOrient:a,labelExpr:u}=mB(["format","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),s=TR(e,r,"parent",n).signal,l=hB(t,a);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:u?dD(dD(u,"datum.label",s),"datum.value",sz(e,{expr:"parent"})):s}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),xB(i,l)),bB(l,i,o)),SB(n,e,t,aB,iB))}function OB(e,t,n,r,i){var o;if(i){let a=null;const{facetFieldDef:u}=r,s=e.config?e.config:void 0;if(u&&i.labels){const{labelOrient:e}=mB(["labelOrient"],u,s,t);("row"===t&&!XT(["top","bottom"],e)||"column"===t&&!XT(["left","right"],e))&&(a=EB(u,t,s))}const l=Oq(e)&&!VR(e.facet),c=i.axes,f=(null===(o=c)||void 0===o?void 0:o.length)>0;if(a||f){const o="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},r.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:_B(u,t)}:{}),f&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{}),a?{title:a}:{}),i.sizeSignal?{encode:{update:{[o]:i.sizeSignal}}}:{}),f?{axes:c}:{})}}return null}const kB={column:{start:0,end:1},row:{start:1,end:0}};function jB(e,t){return kB[t][e]}function SB(e,t,n,r,i){const o={};for(const a of r){if(!i[a])continue;const r=pB(a,t,e,n);void 0!==r&&(o[i[a]]=r)}return o}function CB(e){return[...AB(e,"width"),...AB(e,"height")]}function AB(e,t){const n="width"===t?"x":"y",r=e.component.layoutSize.get(t);if(!r||"merged"===r)return[];const i=e.getSizeSignalRef(t).signal;if("step"===r){const t=e.getScaleComponent(n);if(t){const r=t.get("type"),o=t.get("range");if(sR(r)&&jI(o)){const r=e.scaleName(n);if(Oq(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[NB(r,o)]}return[NB(r,o),{name:i,update:TB(r,t,`domain('${r}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==r){const t=i.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",r=`isFinite(${n}) ? ${n} : ${_L(e.config.view,t?"width":"height")}`;return[{name:i,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:i,value:r}]}function NB(e,t){return{name:e+"_step",value:t.step}}function TB(e,t,n){const r=t.get("type"),i=t.get("padding"),o=pD(t.get("paddingOuter"),i);let a=t.get("paddingInner");return a="band"===r?void 0!==a?a:i:1,`bandspace(${n}, ${a}, ${o}) * ${e}_step`}function DB(e,t){return rD(e).reduce((n,r)=>{const i=e[r];return Object.assign(Object.assign({},n),PI(t,i,r,e=>({value:e.value})))},{})}function MB(e,t){if(Sq(t)||Oq(t))return"shared";if(jq(t)||kq(t))return XT(AM,e)?"independent":"shared";throw new Error("invalid model type for resolve")}function FB(e,t){const n=e.scale[t],r=XT(AM,t)?"axis":"legend";return"independent"===n?("shared"===e[r][t]&&vP(hP.independentScaleMeansIndependentGuide(t)),"independent"):e[r][t]||"shared"}class PB{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new PB(qT(this.explicit),qT(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return pD(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,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of rD(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function RB(e){return{explicit:!0,value:e}}function zB(e){return{explicit:!1,value:e}}function LB(e){return(t,n,r,i)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:IB(t,n,r,i)}}function IB(e,t,n,r){return e.explicit&&t.explicit&&vP(hP.mergeConflictingProperty(n,r,e.value,t.value)),e}function $B(e,t,n,r,i=IB){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:UT(e.value,t.value)?e:i(e,t,n,r)}const BB=Object.assign(Object.assign({},dL),{labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),UB=rD(BB);class qB extends PB{}function WB(e){const{legend:t}=e;return pD(t.type,HB(e))}function HB({channel:e,timeUnit:t,scaleType:n,alwaysReturn:r}){if(eM(e)){if(XT(["quarter","month","day"],t))return"symbol";if(cR(n))return r?"gradient":void 0}return r?"symbol":void 0}function YB({legend:e,legendConfig:t,timeUnit:n,channel:r,scaleType:i}){const o=pD(e.orient,t.orient,"right"),a=WB({legend:e,channel:r,timeUnit:n,scaleType:i,alwaysReturn:!0});return pD(e.direction,t[a?"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}}(o,a))}function VB(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function GB(e,t,n){const r=t.getScaleComponent(n).get("type");return pD(e.get("type"),HB({channel:n,scaleType:r,alwaysReturn:!0}))}function XB(e,t,n,r,i){var o,a,u,s,l;if("symbol"!==GB(i,n,r))return;let c=Object.assign(Object.assign({},function(e,t,n){for(const r of n){const n=AR(r,t.markDef,t.config);void 0!==n&&(e[r]={value:n})}return e}({},n,ED)),HI(n));const{markDef:f,encoding:d,config:h}=n,p=f.filled,m=null!=(o=ZB(d.opacity))?o:f.opacity,g=nU(n,i,e);if(c.fill)if("fill"===r||p&&r===BD)delete c.fill;else if(c.fill.field)i.get("symbolFillColor")?delete c.fill:(c.fill={value:(a=h.legend.symbolBaseFillColor,null!=a?a:"black")},c.fillOpacity={value:null!=m?m:1});else if(Object(oe.A)(c.fill)){const e=null!=(l=null!=(s=eU(null!=(u=d.fill)?u:d.color))?s:f.fill)?l:p&&f.color;e&&(c.fill={value:e})}if(c.stroke)if("stroke"===r||!p&&r===BD)delete c.stroke;else if(c.stroke.field)delete c.stroke;else if(Object(oe.A)(c.stroke)){const e=pD(eU(d.stroke||d.color),f.stroke,p?f.color:void 0);e&&(c.stroke={value:e})}return r!==YD&&(g?c.opacity=[{test:g,value:null!=m?m:1},{value:h.legend.unselectedOpacity}]:m&&(c.opacity={value:m})),c=Object.assign(Object.assign({},c),t),rD(c).length>0?c:void 0}function KB(e,t,n,r,i){if("gradient"!==GB(i,n,r))return;let o={};const a=ZB(n.encoding.opacity)||n.markDef.opacity;return a&&(o.opacity={value:a}),o=Object.assign(Object.assign({},o),t),rD(o).length>0?o:void 0}function JB(e,t,n,r,i){const o=n.legend(r),a=n.config,u=nU(n,i,e);let s={};if(Oz(e)){const i=n.getScaleComponent(r).get("type")===KP.UTC,u=RR("datum.value",e.timeUnit,o.format,a.timeFormat,i);t=Object.assign(Object.assign({},u?{text:{signal:u}}:{}),t)}return u&&(t.opacity=[{test:u,value:1},{value:a.legend.unselectedOpacity}]),s=Object.assign(Object.assign({},s),t),rD(s).length>0?s:void 0}function QB(e,t,n,r,i){var o;return(null===(o=i.get("selections"))||void 0===o?void 0:o.length)?{fill:{value:"transparent"}}:void 0}function ZB(e){return tU(e,(e,t)=>Math.max(e,t.value))}function eU(e){return tU(e,(e,t)=>pD(e,t.value))}function tU(e,t){return function(e){return!!e&&!!e.condition&&(Object(oe.A)(e.condition)||iz(e.condition))}(e)?(Object(oe.A)(e.condition)?e.condition:[e.condition]).reduce(t,e.value):iz(e)?e.value:void 0}function nU(e,t,n){var r;const i=t.get("selections");if(!(null===(r=i)||void 0===r?void 0:r.length))return;const o=Object(oe.Y)(n.field);return i.map(e=>`(!length(data(${Object(oe.Y)(aD(e)+B$)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`).join(" || ")}function rU(e){Eq(e)?e.component.legends=function(e){const{encoding:t}=e;return[BD,UD,qD,XD,HD,WD,YD,VD,GD].reduce((n,r)=>{const i=t[r];return!e.legend(r)||!e.getScaleComponent(r)||tz(i)&&r===WD&&"geojson"===i.type||(n[r]=function(e,t){var n;const r=e.fieldDef(t),i=e.legend(t),o=new qB({},function(e,t){const n=e.scaleName(BD);if("color"===t)return e.markDef.filled?{fill:n}:{stroke:n};return{[t]:e.scaleName(t)}}(e,t));!function(e,t,n){const r=e.fieldDef(t).field;Y$(e,e=>{var i,o;const a=null!=(i=e.project.hasField[r])?i:e.project.hasChannel[t];if(a&&O$.has(e)){const t=null!=(o=n.get("selections"))?o:[];t.push(e.name),n.set("selections",t,!1),a.hasLegend=!0}})}(e,t,o);for(const n of UB){const a=oU(n,i,t,e);if(void 0!==a){const t=iU(a,n,i,r);(t||void 0===e.config.legend[n])&&o.set(n,a,t)}}const a=null!==(n=i.encoding)&&void 0!==n?n:{},u=o.get("selections"),s=["labels","legend","title","symbols","gradient","entries"].reduce((n,i)=>{var s,l,c;const f=DB(null!=(s=a[i])?s:{},e),d=y[i]?y[i](r,f,e,t,o):f;return void 0!==d&&rD(d).length>0&&(n[i]=Object.assign(Object.assign(Object.assign({},(null===(l=u)||void 0===l?void 0:l.length)?{name:`${r.field}_legend_${i}`}:{}),(null===(c=u)||void 0===c?void 0:c.length)?{interactive:!!u}:{}),{update:d})),n},{});rD(s).length>0&&o.set("encode",s,!!i.encoding);return o}(e,r)),n},{})}(e):e.component.legends=function(e){const{legends:t,resolve:n}=e.component;for(const r of e.children)rU(r),rD(r.component.legends).forEach(i=>{n.legend[i]=FB(e.component.resolve,i),"shared"===n.legend[i]&&(t[i]=aU(t[i],r.component.legends[i]),t[i]||(n.legend[i]="independent",delete t[i]))});return rD(t).forEach(t=>{for(const r of e.children)r.component.legends[t]&&"shared"===n.legend[t]&&delete r.component.legends[t]}),t}(e)}function iU(e,t,n,r){switch(t){case"values":return!!n.values;case"title":if("title"===t&&e===r.title)return!0}return e===n[t]}function oU(e,t,n,r){const{encoding:i,mark:o}=r,a=bz(i[n]),u=r.config.legend,{timeUnit:s}=a,l=r.getScaleComponent(n).get("type");switch(e){case"direction":return YB({legend:t,legendConfig:u,timeUnit:s,channel:n,scaleType:l});case"format":if(Oz(a))return;return DR(a,t.format,r.config);case"formatType":if(Oz(a))return;return t.formatType;case"gradientLength":return pD(t.gradientLength,u.gradientLength,function({legend:e,legendConfig:t,model:n,channel:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:u,gradientVerticalMinLength:s}=t;if("horizontal"===YB({legend:e,legendConfig:t,channel:r,scaleType:i})){const r=pD(e.orient,t.orient);return"top"===r||"bottom"===r?VB(n,"width",a,o):a}return VB(n,"height",s,u)}({model:r,legend:t,legendConfig:u,channel:n,scaleType:l}));case"labelOverlap":return pD(t.labelOverlap,function(e){if(XT(["quantile","threshold","log"],e))return"greedy"}(l));case"symbolType":return pD(t.symbolType,function(e,t,n,r){var i;if("shape"!==t){const e=null!=(i=eU(n))?i:r;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"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(o,n,i.shape,r.markDef.shape));case"title":return pz(a,r.config,{allowDisabling:!0})||void 0;case"type":return WB({legend:t,channel:n,timeUnit:s,scaleType:l,alwaysReturn:!1});case"values":return function(e,t){const n=e.values;if(n)return jz(t,n)}(t,a)}return t[e]}function aU(e,t){var n,r,i,o,a,u;if(!e)return t.clone();const s=e.getWithExplicit("orient"),l=t.getWithExplicit("orient");if(s.explicit&&l.explicit&&s.value!==l.value)return;let c=!1;for(const n of UB){const r=$B(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return uU(e,t);case"title":return $R(e,t);case"type":return c=!0,zB("symbol")}return IB(e,t,n,"legend")});e.setWithExplicit(n,r)}return c&&((null==(i=null===(r=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===r?void 0:r.gradient)||i)&&sD(e.implicit,["encode","gradient"]),(null==(u=null===(a=null===(o=e.explicit)||void 0===o?void 0:o.encode)||void 0===a?void 0:a.gradient)||u)&&sD(e.explicit,["encode","gradient"])),e}function uU(e,t){return"circle"===t.value?t:e}function sU(e){const t=e.component.legends,n={};for(const r of rD(t)){const i=e.getScaleComponent(r),o=YT(i.get("domains"));if(n[o])for(const e of n[o]){aU(e,t[r])||n[o].push(t[r])}else n[o]=[t[r].clone()]}return iD(n).flat().map(e=>{var t,n,r,i;const o=e.combine(),{labelExpr:a,selections:u}=o,s=k(o,["labelExpr","selections"]);if(null===(t=s.encode)||void 0===t?void 0:t.symbols){const e=s.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||s.stroke||(e.stroke={value:"transparent"}),s.fill&&delete e.fill}if(void 0!==a){let e=a;(null===(i=null===(r=null===(n=s.encode)||void 0===n?void 0:n.labels)||void 0===r?void 0:r.update)||void 0===i?void 0:i.text)&&kI(s.encode.labels.update.text)&&(e=dD(a,"datum.label",s.encode.labels.update.text.signal)),function(e,t,n,r){var i,o,a;e.encode=null!=(i=e.encode)?i:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(a=e.encode[t].update)?a:{},e.encode[t].update[n]=r}(s,"labels","text",{signal:e})}return s})}function lU(e){return Sq(e)||jq(e)||kq(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),cU(e))}(e):cU(e)}function cU(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:r}=n,i=k(n,["name"]);if(t.data){const n={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const r=kI(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return XT(t,r)||t.push(r),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:r,size:n,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]}},i)]}return[Object.assign(Object.assign({name:r},{translate:{signal:"[width / 2, height / 2]"}}),i)]}const fU=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class dU extends PB{constructor(e,t,n,r){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=r,this.merged=!1}get isFit(){return!!this.data}}function hU(e){e.component.projection=Eq(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,r=!(n&&(null!=n.scale||null!=n.translate)),i=r?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,o=r?function(e){const t=[];for(const n of[["longitude","latitude"],["longitude2","latitude2"]])(e.channelHasField(n[0])||e.channelHasField(n[1]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(WD)&&"geojson"===e.fieldDef(WD).type&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(aI));return t}(e):void 0;return new dU(e.projectionName(!0),Object.assign(Object.assign({},null!=(t=e.config.projection)?t:{}),null!=n?n:{}),i,o)}return}(e):function(e){if(0===e.children.length)return;let t;e.children.forEach(e=>hU(e));const n=JT(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=JT(fU,n=>!Object(oe.v)(e.explicit,n)&&!Object(oe.v)(t.explicit,n)||!(!Object(oe.v)(e.explicit,n)||!Object(oe.v)(t.explicit,n)||YT(e.get(n))!==YT(t.get(n))));if(YT(e.size)===YT(t.size)){if(n)return e;if(YT(e.explicit)===YT({}))return t;if(YT(t.explicit)===YT({}))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),r=new dU(n,t.specifiedProjection,t.size,qT(t.data));return e.children.forEach(e=>{const t=e.component.projection;t&&(t.isFit&&r.data.push(...e.component.projection.data),e.renameProjection(t.get("name"),n),t.merged=!0)}),r}return}(e)}function pU(e,t){return`${Cz(e)}_${t}`}function mU(e,t,n){var r;const i=pU(null!=(r=_z(n,void 0))?r:{},t);return e.getName(`${i}_bins`)}function gU(e,t,n){let r,i;r=function(e){return"as"in e}(e)?Object(oe.H)(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[sz(e,{forAs:!0}),sz(e,{binSuffix:"end",forAs:!0})];const o=Object.assign({},_z(t,void 0)),a=pU(o,e.field),{signal:u,extentSignal:s}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(Dz(o.extent)){const e=o.extent,t=e.selection;i=Q$(n.getSelectionComponent(aD(t),t),e),delete o.extent}return{key:a,binComponent:Object.assign(Object.assign(Object.assign({bin:o,field:e.field,as:[r]},u?{signal:u}:{}),s?{extentSignal:s}:{}),i?{span:i}:{})}}class vU extends p${constructor(e,t){super(e),this.bins=t}clone(){return new vU(null,qT(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,r)=>{if(nz(n)&&Az(n.bin)){const{key:i,binComponent:o}=gU(n,n.bin,t);e[i]=Object.assign(Object.assign(Object.assign({},o),e[i]),function(e,t,n,r){var i,o;if(Sz(t,n)){const a=Eq(e)?null!=(o=null!=(i=e.axis(n))?i:e.legend(n))?o:{}:{},u=sz(t,{expr:"datum"}),s=sz(t,{expr:"datum",binSuffix:"end"});return{formulaAs:sz(t,{binSuffix:"range",forAs:!0}),formula:PR(u,s,a.format,r)}}return{}}(t,n,r,t.config))}return e},{});return 0===rD(n).length?null:new vU(e,n)}static makeFromTransform(e,t,n){const{key:r,binComponent:i}=gU(t,t.bin,n);return new vU(e,{[r]:i})}merge(e,t){for(const n of rD(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=ZT([...this.bins[n].as,...e.bins[n].as],VT)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(iD(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(iD(this.bins).map(e=>e.field))}hash(){return`Bin ${VT(this.bins)}`}assemble(){return iD(this.bins).flatMap(e=>{const t=[],[n,...r]=e.as,i=e.bin,{extent:o}=i,a=k(i,["extent"]),u=Object.assign(Object.assign(Object.assign({type:"bin",field:fD(e.field),as:n,signal:e.signal},Dz(o)?{extent:null}:{extent:o}),e.span?{span:{signal:`span(${e.span})`}}:{}),a);!o&&e.extentSignal&&(t.push({type:"extent",field:fD(e.field),signal:e.extentSignal}),u.extent={signal:e.extentSignal}),t.push(u);for(const e of r)for(let r=0;r<2;r++)t.push({type:"formula",expr:sz({field:n[r]},{expr:"datum"}),as:e[r]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}class yU extends p${constructor(e){let t;if(super(null),nI(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},HT(e.format,["parse"])):{}),eI(e))this._data={values:e.values};else if(ZL(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];XT(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else iI(e)?this._data={values:[{type:"Sphere"}]}:(tI(e)||nI(e))&&(this._data={});this._generator=nI(e),e.name&&(this._name=e.name),t&&rD(t).length>0&&(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 Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}function bU(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return console.error("Dataflow graph is inconsistent.",t,e),!1;if(!bU(t.children))return!1}return!0}class xU extends p${constructor(e,t){super(e),this.params=t}clone(){return new xU(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${VT(this.params)}`}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class wU extends p${constructor(e,t){super(e),this.params=t}clone(){return new wU(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([(e=this.params.as,null!=e?e:"data")])}hash(){return`Hash ${VT(this.params)}`}assemble(){return Object.assign({type:"sequence"},this.params)}}function _U(e){return e instanceof yU||e instanceof xU||e instanceof wU}class EU{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class OU extends EU{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:e,mutatedFlag:t}){e&&this.setContinue(),t&&this.setMutated()}reset(){}optimizeNextFromLeaves(e){if(_U(e))return!1;const t=e.parent,{continueFlag:n}=this.run(e);return n&&this.optimizeNextFromLeaves(t),this.mutatedFlag}}class kU extends EU{}function jU(e,t,n,r){const i=Eq(r)?r.encoding[vM(t)]:void 0;if(nz(n)&&Eq(r)&&QR(t,n,i,r.markDef,r.config))e.add(sz(n,{})),e.add(sz(n,{suffix:"end"})),Sz(n,t)&&e.add(sz(n,{binSuffix:"range"}));else if(t in JD){const n=function(e){switch(e){case"latitude":return"y";case"latitude2":return"y2";case"longitude":return"x";case"longitude2":return"x2"}}(t);e.add(r.getName(n))}else e.add(sz(n));return e}class SU extends p${constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new SU(null,new Set(this.dimensions),qT(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const r={},i=new Set;return n?(t.forEachFieldDef((e,n)=>{var o,a,u,s;const{aggregate:l,field:c}=e;if(l)if("count"===l)r["*"]=null!=(o=r["*"])?o:{},r["*"].count=new Set([sz(e,{forAs:!0})]);else{if(TD(l)||DD(l)){const e=TD(l)?"argmin":"argmax",t=l[e];r[t]=null!=(a=r[t])?a:{},r[t][e]=new Set([sz({op:e,field:t},{forAs:!0})])}else r[c]=null!=(u=r[c])?u:{},r[c][l]=new Set([sz(e,{forAs:!0})]);qM(n)&&"unaggregated"===t.scaleDomain(n)&&(r[c]=null!=(s=r[c])?s:{},r[c].min=new Set([sz({field:c,aggregate:"min"},{forAs:!0})]),r[c].max=new Set([sz({field:c,aggregate:"max"},{forAs:!0})]))}else jU(i,n,e,t)}),i.size+rD(r).length===0?null:new SU(e,i,r)):null}static makeFromTransform(e,t){var n,r,i;const o=new Set,a={};for(const e of t.aggregate){const{op:t,field:i,as:o}=e;t&&("count"===t?(a["*"]=null!=(n=a["*"])?n:{},a["*"].count=new Set([o||sz(e,{forAs:!0})])):(a[i]=null!=(r=a[i])?r:{},a[i][t]=new Set([o||sz(e,{forAs:!0})])))}for(const e of null!=(i=t.groupby)?i:[])o.add(e);return o.size+rD(a).length===0?null:new SU(e,o,a)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const r of rD(t)){const i=t[r];for(const t of rD(i))r in e?e[r][t]=new Set([...(n=e[r][t],null!=n?n:[]),...i[t]]):e[r]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){mP.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...rD(this.measures)])}producedFields(){const e=new Set;for(const t of rD(this.measures))for(const n of rD(this.measures[t])){const r=this.measures[t][n];0===r.size?e.add(`${n}_${t}`):r.forEach(e.add,e)}return e}hash(){return`Aggregate ${VT({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const r of rD(this.measures))for(const i of rD(this.measures[r]))for(const o of this.measures[r][i])n.push(o),e.push(i),t.push("*"===r?null:fD(r));return{type:"aggregate",groupby:[...this.dimensions],ops:e,fields:t,as:n}}}class CU extends p${constructor(e,t,n,r){super(e),this.model=t,this.name=n,this.data=r;for(const e of nM){const n=t.facet[e];if(n){const{bin:r,sort:i}=n;this[e]=Object.assign({name:t.getName(`${e}_domain`),fields:[sz(n),...Az(r)?[sz(n,{binSuffix:"end"})]:[]]},HR(i)?{sortField:i}:Object(oe.A)(i)?{sortIndexField:dB(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of nM)this[t]&&(e+=` ${t.charAt(0)}:${VT(this[t])}`);return e}get fields(){var e;const t=[];for(const n of nM)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of nM)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["x","y"]){const n=this.childModel.component.scales[t];if(n&&!n.merged){const r=n.get("type"),i=n.get("range");if(sR(r)&&jI(i)){const n=aq(uq(this.childModel,t));n?e[t]=n:vP(`Unknown field for ${t}. Cannot calculate view size.`)}}}return e}assembleRowColumnHeaderData(e,t,n){const r={row:"y",column:"x"}[e],i=[],o=[],a=[];n&&n[r]&&(t?(i.push(`distinct_${n[r]}`),o.push("max")):(i.push(n[r]),o.push("distinct")),a.push(`distinct_${n[r]}`));const{sortField:u,sortIndexField:s}=this[e];if(u){const{op:e=BR,field:t}=u;i.push(t),o.push(e),a.push(sz(u,{forAs:!0}))}else s&&(i.push(s),o.push("max"),a.push(s));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},i.length?{fields:i,ops:o,as:a}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:r}=this.model.layout,{layoutHeaders:i}=this.model.component,o=[],a={};for(const e of gB){for(const r of vB){const o=null!=(t=i[e]&&i[e][r])?t:[];for(const t of o)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){a[e]=!0;break}}if(a[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?r?{signal:`ceil(${t} / ${r})`}:1:r?{signal:`min(${t}, ${r})`}:{signal:t};o.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:u,column:s}=a;return(u||s)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,e)),o}assemble(){var e,t;const n=[];let r=null;const i=this.getChildIndependentFieldsWithStep(),{column:o,row:a,facet:u}=this;if(o&&a&&(i.x||i.y)){r=`cross_${this.column.name}_${this.row.name}`;const o=[].concat(null!=(e=i.x)?e:[],null!=(t=i.y)?t:[]),a=o.map(()=>"distinct");n.push({name:r,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:a}]})}for(const e of["column",LD])this[e]&&n.push(this.assembleRowColumnHeaderData(e,r,i));if(u){const e=this.assembleFacetHeaderData(i);e&&n.push(...e)}return n}}function AU(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function NU(e){const t={};return function e(t,n){if($T(t))e(t.not,n);else if(IT(t))for(const r of t.and)e(r,n);else if(LT(t))for(const r of t.or)e(r,n);else n(t)}(e.filter,e=>{var n;if(WP(e)){let r=null;zP(e)?r=e.equal:UP(e)?r=e.range[0]:qP(e)&&(r=(n=e.oneOf,null!=n?n:e.in)[0]),r&&(yP(r)?t[e.field]="date":Object(oe.E)(r)?t[e.field]="number":Object(oe.H)(r)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function TU(e){const t={};function n(e){var n;Oz(e)?t[e.field]="date":"quantitative"===e.type&&(n=e.aggregate,Object(oe.H)(n)&&XT(["min","max"],n))?t[e.field]="number":hD(e.field)>1?e.field in t||(t[e.field]="flatten"):oz(e)&&HR(e.sort)&&hD(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((Eq(e)||Oq(e))&&e.forEachFieldDef((t,r)=>{if(nz(t))n(t);else{const i=gM(r),o=e.fieldDef(i);n(Object.assign(Object.assign({},t),{type:o.type}))}}),Eq(e)){const{mark:n,markDef:r,encoding:i}=e;if(bD(n)&&!e.encoding.order){const e=i["horizontal"===r.orient?"y":"x"];!tz(e)||"quantitative"!==e.type||e.field in t||(t[e.field]="number")}}return t}class DU extends p${constructor(e,t){super(e),this._parse=t}clone(){return new DU(null,qT(this._parse))}hash(){return`Parse ${VT(this._parse)}`}static makeExplicit(e,t,n){let r={};const i=t.data;return!nI(i)&&i&&i.format&&i.format.parse&&(r=i.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(e,t,n,r){for(const e of rD(n)){const t=r.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:vP(hP.differentParse(e,n[e],t.value)))}for(const e of rD(t)){const n=r.get(e);void 0!==n&&(n===t[e]?delete t[e]:vP(hP.differentParse(e,t[e],n)))}const i=new PB(t,n);r.copyAll(i);const o={};for(const e of rD(i.combine())){const t=i.get(e);null!==t&&(o[e]=t)}return 0===rD(o).length||r.parseNothing?null:new DU(e,o)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of rD(this._parse)){const n=this._parse[t];1===hD(t)&&(e[t]=n)}return e}producedFields(){return new Set(rD(this._parse))}dependentFields(){return new Set(rD(this._parse))}assembleTransforms(e=!1){return rD(this._parse).filter(t=>!e||hD(t)>1).map(e=>{const t=function(e,t){const n=cD(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:")){return`timeParse(${n},'${AU(t.slice(5,t.length))}')`}if(0===t.indexOf("utc:")){return`utcParse(${n},'${AU(t.slice(4,t.length))}')`}return vP(hP.unrecognizedParse(t)),null}(e,this._parse[e]);return t?{type:"formula",expr:t,as:(n=e,`${Object(oe.X)(n).join(".")}`)}:null;var n}).filter(e=>null!==e)}}class MU extends p${constructor(e,t){super(e),this.transform=t}clone(){return new MU(null,qT(this.transform))}addDimensions(e){this.transform.groupby=ZT(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t=>e.add(t)),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(t=>e.add(t)),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:sz(e)}hash(){return`JoinAggregateTransform ${VT(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(void 0===r.field?null:r.field);const r=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==r?{groupby:r}:{})}}class FU extends p${constructor(e,t){super(e),this._stack=t}clone(){return new FU(null,qT(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:r,as:i,offset:o="zero"}=t,a=[],u=[];if(void 0!==t.sort)for(const e of t.sort)a.push(e.field),u.push(pD(e.order,"ascending"));const s={field:a,order:u};let l;return l=function(e){return Object(oe.A)(e)&&e.every(e=>Object(oe.H)(e))&&e.length>1}(i)?i:Object(oe.H)(i)?[i,i+"_end"]:[t.stack+"_start",t.stack+"_end"],new FU(e,{stackField:n,groupby:r,offset:o,sort:s,facetby:[],as:l})}static makeFromEncoding(e,t){const n=t.stack,{encoding:r}=t;if(!n)return null;let i;if(n.groupbyChannel){i=bz(r[n.groupbyChannel])}const o=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=sz(t.fieldDef);return n&&e.push(n),e},[])}(t),a=t.encoding.order;let u;return u=Object(oe.A)(a)||tz(a)?zR(a):o.reduce((e,t)=>(e.field.push(t),e.order.push("descending"),e),{field:[],order:[]}),new FU(e,{dimensionFieldDef:i,stackField:t.vgField(n.fieldChannel),facetby:[],stackby:o,sort:u,offset:n.offset,impute:n.impute,as:[t.vgField(n.fieldChannel,{suffix:"start",forAs:!0}),t.vgField(n.fieldChannel,{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(t=>e.add(t)),this._stack.facetby.forEach(t=>e.add(t)),this._stack.sort.field.forEach(t=>e.add(t)),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${VT(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[sz(e,{binSuffix:"mid"})]:[sz(e,{}),sz(e,{binSuffix:"end"})]:[sz(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:r,stackby:i,sort:o,offset:a,impute:u,as:s}=this._stack;if(u&&n){const{band:o=.5,bin:a}=n;a&&e.push({type:"formula",expr:`${o}*`+sz(n,{expr:"datum"})+`+${1-o}*`+sz(n,{expr:"datum",binSuffix:"end"}),as:sz(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:r,groupby:[...i,...t],key:sz(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:r,sort:o,as:s,offset:a}),e}}class PU extends p${constructor(e,t){super(e),this.transform=t}clone(){return new PU(null,qT(this.transform))}addDimensions(e){this.transform.groupby=ZT(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(e=this.transform.groupby,null!=e?e:[]).forEach(e=>n.add(e)),(t=this.transform.sort,null!=t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(e=>n.add(e)),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:sz(e)}hash(){return`WindowTransform ${VT(this.transform)}`}assemble(){var e;const t=[],n=[],r=[],i=[];for(const e of this.transform.window)n.push(e.op),r.push(this.getDefaultName(e)),i.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const o=this.transform.frame,a=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&n.every(e=>MD(e)))return Object.assign({type:"joinaggregate",as:r,ops:n,fields:t},void 0!==a?{groupby:a}:{});const u=[],s=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)u.push(t.field),s.push(null!=(e=t.order)?e:"ascending");const l={field:u,order:s},c=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:i,as:r,ops:n,fields:t,sort:l},void 0!==c?{ignorePeers:c}:{}),void 0!==a?{groupby:a}:{}),void 0!==o?{frame:o}:{})}}class RU extends p${clone(){return new RU(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set(["_vgsid_"])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:"_vgsid_"}}}class zU extends OU{run(e){const t=e.parent;if(e instanceof DU){if(_U(t))return this.flags;if(t.numChildren()>1)return this.setContinue(),this.flags;if(t instanceof DU)this.setMutated(),t.merge(e);else{if(nD(t.producedFields(),e.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),e.swapWithParent()}}return this.setContinue(),this.flags}}class LU extends kU{mergeNodes(e,t){const n=t.shift();for(const r of t)e.removeChild(r),r.parent=n,r.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let r=0;r1&&(this.setMutated(),this.mergeNodes(e,n[t]));for(const t of e.children)this.run(t);return this.mutatedFlag}}class IU extends OU{run(e){return e instanceof m$||e.numChildren()>0||e instanceof CU?this.flags:(this.setMutated(),e.remove(),this.flags)}}class $U extends OU{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(e){if(this.setContinue(),e instanceof g$){const t=e.producedFields();eD(t,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...t]),this.prev=e}return this.flags}reset(){this.fields.clear()}}class BU extends OU{run(e){this.setContinue();const t=e.parent.children.filter(e=>e instanceof g$),n=t.pop();for(const e of t)this.setMutated(),n.merge(e);return this.flags}}function UU(e){if(e instanceof CU)if(1!==e.numChildren()||e.children[0]instanceof m$){const n=e.model.component.data.main;!function e(t){if(t instanceof m$&&t.type===aI&&1===t.numChildren()){const n=t.children[0];n instanceof CU||(n.swapWithParent(),e(t))}}(n);const r=(t=e,function e(n){if(!(n instanceof CU)){const r=n.clone();if(r instanceof m$){const e=XU+r.getSource();r.setSource(e),t.model.component.data.outputNodes[e]=r}else(r instanceof SU||r instanceof FU||r instanceof PU||r instanceof MU)&&r.addDimensions(t.fields);return n.children.flatMap(e).forEach(e=>e.parent=r),[r]}return n.children.flatMap(e)}),i=e.children.map(r).flat();for(const e of i)e.parent=n}else{const t=e.children[0];(t instanceof SU||t instanceof FU||t instanceof PU||t instanceof MU)&&t.addDimensions(e.fields),t.swapWithParent(),UU(e)}else e.children.map(UU);var t}class qU extends kU{constructor(){super()}run(e){e instanceof m$&&!e.isRequired()&&(this.setMutated(),e.remove());for(const t of e.children)this.run(t);return this.mutatedFlag}}class WU extends kU{constructor(e){super(),this.requiresSelectionId=e&&G$(e)}run(e){e instanceof RU&&(this.requiresSelectionId&&(_U(e.parent)||e.parent instanceof SU||e.parent instanceof DU)||(this.setMutated(),e.remove()));for(const t of e.children)this.run(t);return this.mutatedFlag}}class HU extends OU{run(e){const t=e.parent,n=[...t.children],r=t.children.filter(e=>e instanceof DU);if(t.numChildren()>1&&r.length>=1){const e={},i=new Set;for(const t of r){const n=t.parse;for(const t of rD(n))t in e?e[t]!==n[t]&&i.add(t):e[t]=n[t]}for(const t of i)delete e[t];if(0!==rD(e).length){this.setMutated();const r=new DU(t,e);for(const i of n){if(i instanceof DU)for(const t of rD(e))delete i.parse[t];t.removeChild(i),i.parent=r,i instanceof DU&&0===rD(i.parse).length&&i.remove()}}}return this.setContinue(),this.flags}}class YU extends OU{run(e){const t=e.parent,n=t.children.filter(e=>e instanceof SU),r={};for(const e of n){const t=VT(e.groupBy);t in r||(r[t]=[]),r[t].push(e)}for(const e of rD(r)){const n=r[e];if(n.length>1){const e=n.pop();for(const r of n)e.merge(r)&&(t.removeChild(r),r.parent=e,r.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class VU extends OU{constructor(e){super(),this.model=e}run(e){const t=e.parent,n=!(_U(t)||t instanceof K$||t instanceof DU||t instanceof RU),r=[],i=[];for(const e of t.children)e instanceof vU&&(n&&!nD(t.producedFields(),e.dependentFields())?r.push(e):i.push(e));if(r.length>0){const e=r.pop();for(const t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated(),t instanceof vU?t.merge(e,this.model.renameSignal.bind(this.model)):e.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class GU extends OU{run(e){const t=e.parent,n=[...t.children];if(!KT(n,e=>e instanceof m$)||t.numChildren()<=1)return this.setContinue(),this.flags;const r=[];let i;for(const e of n)if(e instanceof m$){let n=e;for(;1===n.numChildren();){const e=n.children[0];if(!(e instanceof m$))break;n=e}r.push(...n.children),i?(t.removeChild(e),e.parent=i.parent,i.parent.removeChild(i),i.parent=n,this.setMutated()):i=n}else r.push(e);if(r.length){this.setMutated();for(const e of r)e.parent.removeChild(e),e.parent=i}return this.setContinue(),this.flags}}const XU="scale_";function KU(e){const t=[];return e.forEach((function e(n){0===n.numChildren()?t.push(n):n.children.forEach(e)})),t}function JU(e){return e}function QU(e,t){return t.map(t=>{if(e instanceof OU){const n=e.optimizeNextFromLeaves(t);return e.reset(),n}return e.run(t)}).some(JU)}function ZU(e,t){let n=e.sources;const r=new Set;return r.add(QU(new qU,n)),r.add(QU(new WU(t),n)),n=n.filter(e=>e.numChildren()>0),r.add(QU(new IU,KU(n))),n=n.filter(e=>e.numChildren()>0),r.add(QU(new zU,KU(n))),r.add(QU(new VU(t),KU(n))),r.add(QU(new $U,KU(n))),r.add(QU(new HU,KU(n))),r.add(QU(new YU,KU(n))),r.add(QU(new BU,KU(n))),r.add(QU(new LU,n)),r.add(QU(new GU,KU(n))),e.sources=n,r.has(!0)}class eq{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new eq(()=>e(t))}}function tq(e){Eq(e)?function(e){const t=e.component.scales;rD(t).forEach(n=>{const r=function(e,t){const n=e.getScaleComponent(t).get("type"),r=function(e,t,n,r){if("unaggregated"===e){const{valid:e,reason:r}=iq(t,n);if(!e)return void vP(r)}else if(void 0===e&&r.useUnaggregatedDomain){const{valid:e}=iq(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.fieldDef(t),n,e.config.scale);r!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:r}));if("x"===t&&e.channelHasField("x2"))return e.channelHasField("x")?$B(nq(n,r,e,"x"),nq(n,r,e,"x2"),"domain","scale",oq):nq(n,r,e,"x2");if("y"===t&&e.channelHasField("y2"))return e.channelHasField("y")?$B(nq(n,r,e,"y"),nq(n,r,e,"y2"),"domain","scale",oq):nq(n,r,e,"y2");return nq(n,r,e,t)}(e,n);if(t[n].setWithExplicit("domains",r),function(e,t){const n=e.component.scales[t],r=e.specifiedScales[t].domain,i=e.fieldDef(t).bin,o=dR(r)&&r,a=Tz(i)&&Dz(i.extent)&&i.extent;(o||a)&&n.set("selectionExtent",null!=o?o:a,!0)}(e,n),e.component.data.isFaceted){let t=e;for(;!Oq(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of r.value)SI(e)&&(e.data=XU+e.data.replace(XU,""))}})}(e):function(e){for(const t of e.children)tq(t);const t=e.component.scales;rD(t).forEach(n=>{let r,i=null;for(const t of e.children){const e=t.component.scales[n];if(e){r=void 0===r?e.getWithExplicit("domains"):$B(r,e.getWithExplicit("domains"),"domains","scale",oq);const t=e.get("selectionExtent");i&&t&&i.selection!==t.selection&&vP("The same selection must be used to override scale domains in a layered view."),i=t}}t[n].setWithExplicit("domains",r),i&&t[n].set("selectionExtent",i,!0)})}(e)}function nq(e,t,n,r){const i=n.fieldDef(r);if(t&&"unaggregated"!==t&&!dR(t)){const{type:e,timeUnit:n}=i;return RB("temporal"===e||n?function(e,t,n){return e.map(e=>({signal:`{data: ${kz(e,{timeUnit:n,type:t})}}`}))}(t,e,n):[t])}const o=n.stack;if(o&&r===o.fieldChannel){if("normalize"===o.offset)return zB([[0,1]]);const e=n.requestDataName(aI);return zB([{data:e,field:n.vgField(r,{suffix:"start"})},{data:e,field:n.vgField(r,{suffix:"end"})}])}const a=qM(r)?function(e,t,n){if(!sR(n))return;const r=e.fieldDef(t),i=r.sort;if(YR(i))return{op:"min",field:dB(r,t),order:"ascending"};const o=null!==e.stack;if(HR(i))return rq(i,o);if(WR(i)){const{encoding:t,order:n}=i,r=e.fieldDef(t),{aggregate:a,field:u}=r;if(TD(a)||DD(a))return rq({field:sz(r),order:n},o);if(MD(a)||!a)return rq({op:a,field:u,order:n},o)}else{if("descending"===i)return{op:"min",field:e.vgField(t),order:"descending"};if(XT(["ascending",void 0],i))return!0}return}(n,r,e):void 0;if("unaggregated"===t){const e=n.requestDataName(aI),{field:t}=i;return zB([{data:e,field:sz({field:t,aggregate:"min"})},{data:e,field:sz({field:t,aggregate:"max"})}])}if(Az(i.bin)){if(sR(e))return zB("bin-ordinal"===e?[]:[{data:oD(a)?n.requestDataName(aI):n.requestDataName("raw"),field:n.vgField(r,Sz(i,r)?{binSuffix:"range"}:{}),sort:!0!==a&&Object(oe.F)(a)?a:{field:n.vgField(r,{}),op:"min"}}]);{const{bin:e}=i;if(Az(e)){const t=mU(n,i.field,e);return zB([new eq(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return zB([{data:n.requestDataName(aI),field:n.vgField(r,{})}])}}if(i.timeUnit&&XT(["time","utc"],e)&&QR(r,i,Eq(n)?n.encoding[vM(r)]:void 0,n.markDef,n.config)){const e=n.requestDataName(aI);return zB([{data:e,field:n.vgField(r)},{data:e,field:n.vgField(r,{suffix:"end"})}])}return zB(a?[{data:oD(a)?n.requestDataName(aI):n.requestDataName("raw"),field:n.vgField(r),sort:a}]:[{data:n.requestDataName(aI),field:n.vgField(r)}])}function rq(e,t){const{op:n,field:r,order:i}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":BR},r?{field:fD(r)}:{}),i?{order:i}:{})}function iq(e,t){const{aggregate:n,type:r}=e;return n?Object(oe.H)(n)&&!zD[n]?{valid:!1,reason:hP.unaggregateDomainWithNonSharedDomainOp(n)}:"quantitative"===r&&"log"===t?{valid:!1,reason:hP.unaggregatedDomainWithLogScale(e)}:{valid:!0}:{valid:!1,reason:hP.unaggregateDomainHasNoEffectForRawField(e)}}function oq(e,t,n,r){return e.explicit&&t.explicit&&vP(hP.mergeConflictingDomainProperty(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function aq(e){if(SI(e)&&Object(oe.H)(e.field))return e.field;if(function(e){return!Object(oe.A)(e)&&("fields"in e&&!("data"in e))}(e)){let t;for(const n of e.fields)if(SI(n)&&Object(oe.H)(n.field))if(t){if(t!==n.field)return vP("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 vP("Detected faceted independent scales that union domain of identical fields from different source detected. We will assume that this is the same field from a different fork of the same data source. However, if this is not case, the result view size maybe incorrect."),t}if(function(e){return!Object(oe.A)(e)&&("fields"in e&&"data"in e)}(e)){vP("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 Object(oe.H)(t)?t:void 0}}function uq(e,t){return function(e){const t=ZT(e.map(e=>{if(SI(e)){const{sort:t}=e;return k(e,["sort"])}return e}),VT),n=ZT(e.map(e=>{if(SI(e)){const t=e.sort;return void 0===t||oD(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),VT);if(0===t.length)return;if(1===t.length){const t=e[0];if(SI(t)&&n.length>0){let e=n[0];return n.length>1&&(vP(hP.MORE_THAN_ONE_SORT),e=!0),Object.assign(Object.assign({},t),{sort:e})}return t}const r=ZT(n.map(e=>oD(e)||!("op"in e)||e.op in ND?e:(vP(hP.domainSortDropped(e)),!0)),VT);let i;1===r.length?i=r[0]:r.length>1&&(vP(hP.MORE_THAN_ONE_SORT),i=!0);const o=ZT(e.map(e=>SI(e)?e.data:null),e=>e);if(1===o.length&&null!==o[0]){return Object.assign({data:o[0],fields:t.map(e=>e.field)},i?{sort:i}:{})}return Object.assign({fields:t},i?{sort:i}:{})}(e.component.scales[t].get("domains").map(t=>(SI(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function sq(e){return rD(e.component.scales).reduce((t,n)=>{const r=e.component.scales[n];if(r.merged)return t;const i=r.combine(),{name:o,type:a,selectionExtent:u,domains:s,range:l}=i,c=k(i,["name","type","selectionExtent","domains","range"]),f=function(e,t,n){if(("x"===n||"y"===n)&&jI(e))return{step:{signal:t+"_step"}};return e}(i.range,o,n);let d;u&&(d=function(e,t){const n=t.selection;return{signal:Q$(e.getSelectionComponent(n,aD(n)),t)}}(e,u));const h=uq(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign({name:o,type:a},h?{domain:h}:{}),d?{domainRaw:d}:{}),{range:f}),c)),t},[])}class lq extends PB{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||KT(this.get("domains"),e=>Object(oe.A)(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const cq=["range","scheme"];function fq(e){return"x"===e?"width":"y"===e?"height":void 0}function dq(e){const t=e.component.scales;UM.forEach(n=>{const r=t[n];if(!r)return;const i=function(e,t){const n=t.specifiedScales[e],{size:r}=t,i=t.getScaleComponent(e).get("type");for(const t of cq)if(void 0!==n[t]){const r=xR(i,t),o=wR(e,t);if(r)if(o)vP(o);else switch(t){case"range":return RB(n[t]);case"scheme":return RB(pq(n[t]))}else vP(hP.scalePropertyNotWorkWithScaleType(i,t,e))}if(e===ID||e===$D){const t=e===ID?"width":"height",n=r[t];if(xL(n)){if(sR(i))return RB({step:n.step});vP(hP.stepDropped(t))}}return zB(function(e,t){const{size:n,config:r,mark:i}=t,o=t.getSignalName.bind(t),{type:a}=t.fieldDef(e),u=t.getScaleComponent(e).get("type"),{domain:s}=t.specifiedScales[e];switch(e){case ID:case $D:{if(XT(["point","band"],u))if(e!==ID||n.width){if(e===$D&&!n.height){const e=OL(r.view,"height");if(xL(e))return e}}else{const e=OL(r.view,"width");if(xL(e))return e}const i=fq(e),a=t.getName(i);return e===$D&&lR(u)?[eq.fromName(o,a),0]:[0,eq.fromName(o,a)]}case HD:{const o=t.component.scales[e].get("zero"),a=function(e,t,n){if(t)return 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(hP.incompatibleChannel("size",e))}(i,o,r),l=function(e,t,n,r){const i={x:hq(n,"x"),y:hq(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=mq(t,i,r.view);return Object(oe.E)(e)?e-1:new eq(()=>`${e.signal} - 1`)}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=mq(t,i,r.view);return Object(oe.E)(e)?Math.pow(.95*e,2):new eq(()=>`pow(0.95 * ${e.signal}, 2)`)}}throw new Error(hP.incompatibleChannel("size",e))}(i,n,t,r);return fR(u)?function(e,t,n){const r=()=>{const r=`(${kI(t)?t.signal:t} - ${e}) / (${n} - 1)`;return`sequence(${e}, ${t} + ${r}, ${r})`};return kI(t)?new eq(r):{signal:r()}}(a,l,function(e,t,n,r){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&Object(oe.A)(n)?n.length+1:(vP(hP.domainRequiredForThresholdScale(r)),3)}}(u,r,s,e)):[a,l]}case XD:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case WD:return"symbol";case BD:case UD:case qD:return"ordinal"===u?"nominal"===a?"category":"ordinal":"rect"===i||"geoshape"===i?"heatmap":"ramp";case YD:case VD:case GD:return[r.scale.minOpacity,r.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${e}`)}(e,t))}(n,e);r.setWithExplicit("range",i)})}function hq(e,t){const n=e.fieldDef(t);if(n&&n.bin&&Az(n.bin)){const r=mU(e,n.field,n.bin),i=fq(t),o=e.getName(i);return new eq(()=>{const t=e.getSignalName(r),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(o)} / (${n})`})}}function pq(e){return function(e){return!Object(oe.H)(e)&&!!e.name}(e)?Object.assign({scheme:e.name},HT(e,["name"])):{scheme:e}}function mq(e,t,n){const r=xL(e.width)?e.width.step:EL(n,"width"),i=xL(e.height)?e.height.step:EL(n,"height");return t.x||t.y?new eq(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(", ")})`):Math.min(r,i)}function gq(e,t){Eq(e)?function(e,t){const n=e.component.scales;rD(n).forEach(r=>{const i=e.specifiedScales[r],o=n[r],a=e.getScaleComponent(r),u=e.fieldDef(r),s=e.config,l=i[t],c=a.get("type"),f=xR(c,t),d=wR(r,t);if(void 0!==l&&(f?d&&vP(d):vP(hP.scalePropertyNotWorkWithScaleType(c,t,r))),f&&void 0===d)if(void 0!==l)o.copyKeyFromObject(t,i);else{const n=function(e,t,n,r,i,o,a,u,s,l){const c=l.scale,{type:f,sort:d}=r;switch(e){case"bins":return function(e,t){const n=t.bin;if(Az(n)){const r=mU(e,t.field,n);return new eq(()=>e.getSignalName(r))}if(Nz(n)&&Tz(n)&&void 0!==n.step)return{step:n.step};return}(t,r);case"interpolate":return function(e,t){if(XT([BD,UD,qD],e)&&"nominal"!==t)return"hcl";return}(n,f);case"nice":return function(e,t,n){if(n.bin||XT([KP.TIME,KP.UTC],e))return;return!!XT([ID,$D],t)||void 0}(i,n,r);case"padding":return function(e,t,n,r,i,o){if(XT([ID,$D],e)){if(cR(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=i;if("bar"===t&&!r.bin&&!r.timeUnit&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===KP.POINT)return n.pointPadding}return}(n,i,c,r,s,l.bar);case"paddingInner":return function(e,t,n,r){if(void 0!==e)return;if(XT([ID,$D],t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i}=r;return pD(e,"bar"===n?t:i)}return}(o,n,s.type,c);case"paddingOuter":return function(e,t,n,r,i,o){if(void 0!==e)return;if(XT([ID,$D],t)&&n===KP.BAND){const{bandPaddingOuter:e}=o;return pD(e,i/2)}return}(o,n,i,s.type,a,c);case"reverse":return function(e,t){if(lR(e)&&"descending"===t)return!0;return}(i,d);case"zero":return function(e,t,n,r,i){if(n&&"unaggregated"!==n&&lR(i)){if(Object(oe.A)(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&&!fR(i))return!0;if(!t.bin&&XT([ID,$D],e)){const{orient:t,type:n}=r;return!XT(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(n,r,u,s,i)}return c[e]}(t,e,r,u,a.get("type"),a.get("padding"),a.get("paddingInner"),i.domain,e.markDef,s);void 0!==n&&o.set(t,n,!1)}})}(e,t):yq(e,t)}function vq(e){Eq(e)?dq(e):yq(e,"range")}function yq(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?vq(n):gq(n,t);rD(n).forEach(r=>{let i;for(const n of e.children){const e=n.component.scales[r];if(e){i=$B(i,e.getWithExplicit(t),t,"scale",LB((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0}))}}n[r].setWithExplicit(t,i)})}function bq(e,t,n,r){const i=function(e,t,n){switch(t.type){case"nominal":case"ordinal":return eM(e)||"discrete"===GM(e)?("shape"===e&&"ordinal"===t.type&&vP(hP.discreteChannelCannotEncode(e,"ordinal")),"ordinal"):XT(["x","y"],e)&&XT(["rect","bar","image","rule"],n)?"band":"point";case"temporal":return eM(e)?"time":"discrete"===GM(e)?(vP(hP.discreteChannelCannotEncode(e,"temporal")),"ordinal"):"time";case"quantitative":return eM(e)?Az(t.bin)?"bin-ordinal":"linear":"discrete"===GM(e)?(vP(hP.discreteChannelCannotEncode(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(hP.invalidFieldType(t.type))}(t,n,r),{type:o}=e;return qM(t)?void 0!==o?ER(t,o)?_R(o,n.type)?o:(vP(hP.scaleTypeNotWorkWithFieldDef(o,i)),i):(vP(hP.scaleTypeNotWorkWithChannel(t,o,i)),i):i:null}function xq(e){Eq(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return UM.reduce((r,i)=>{let o,a;const u=t[i];if(tz(u)&&"geoshape"===n&&i===WD&&"geojson"===u.type)return r;if(tz(u)?(o=u,a=u.scale):ez(u)&&(o=u.condition,a=u.condition.scale),o&&null!==a&&!1!==a){a=null!=a?a:{};const t=bq(a,i,o,n);r[i]=new lq(e.scaleName(i+"",!0),{value:t,explicit:a.type===t})}return r},{})}(e):e.component.scales=function(e){const t=e.component.scales={},n={},r=e.component.resolve;for(const t of e.children)xq(t),rD(t.component.scales).forEach(i=>{var o;if(r.scale[i]=null!=(o=r.scale[i])?o:MB(i,e),"shared"===r.scale[i]){const e=n[i],o=t.component.scales[i].getWithExplicit("type");e?ZP(e.value,o.value)?n[i]=$B(e,o,"type","scale",wq):(r.scale[i]="independent",delete n[i]):n[i]=o}});for(const r of rD(n)){const i=e.scaleName(r,!0),o=n[r];t[r]=new lq(i,o);for(const t of e.children){const e=t.component.scales[r];e&&(t.renameScale(e.get("name"),i),e.merged=!0)}}return t}(e)}const wq=LB((e,t)=>tR(e)-tR(t));class _q{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 Eq(e){var t;return"unit"===(null===(t=e)||void 0===t?void 0:t.type)}function Oq(e){var t;return"facet"===(null===(t=e)||void 0===t?void 0:t.type)}function kq(e){var t;return"repeat"===(null===(t=e)||void 0===t?void 0:t.type)}function jq(e){var t;return"concat"===(null===(t=e)||void 0===t?void 0:t.type)}function Sq(e){var t;return"layer"===(null===(t=e)||void 0===t?void 0:t.type)}class Cq{constructor(e,t,n,r,i,o,a,u){var s,l;this.type=t,this.parent=n,this.config=i,this.repeater=o,this.view=u,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=i,this.repeater=o,this.name=null!=(s=e.name)?s:r,this.title=jR(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new _q,this.projectionNameMap=n?n.projectionNameMap:new _q,this.signalNameMap=n?n.signalNameMap:new _q,this.data=e.data,this.description=e.description,this.transforms=(l=e.transform,(null!=l?l:[]).map(e=>uI(e)?{filter:BT(e.filter,GP)}:e)),this.layout=SD(e)||ML(e)?{}:function(e,t,n){var r,i;const o=n[t],a={},{spacing:u,columns:s}=o;void 0!==u&&(a.spacing=u),void 0!==s&&(GR(e)&&!VR(e.facet)||bL(e)&&Object(oe.A)(e.repeat)||gL(e))&&(a.columns=s);for(const t of wL)if(void 0!==e[t])if("spacing"===t){const n=e[t];a[t]=Object(oe.E)(n)?n:{row:(r=n.row,null!=r?r:u),column:(i=n.column,null!=i?i:u)}}else a[t]=e[t];return a}(e,t,i),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:GR(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new PB,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},a?qT(a):{}),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}={}){xq(e),tq(e);for(const t of bR)gq(e,t);t||vq(e)}(this)}parseProjection(){hU(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){rU(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!=(t=null===(e=this.view)||void 0===e?void 0:e.style)?t:"cell"}assembleEncodeFromView(e){const{style:t}=e,n=k(e,["style"]),r={};for(const e in n)if(Object(oe.v)(n,e)){const t=n[e];void 0!==t&&(r[e]={value:t})}return r}assembleGroupEncodeEntry(e){let t=void 0;return this.view&&(t=this.assembleEncodeFromView(this.view)),e||"unit"!==this.type&&"layer"!==this.type?t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=k(e,["spacing"]),{component:r,config:i}=this,o=function(e,t){var n;const r={};for(const i of nM){const o=e[i];if(null===(n=o)||void 0===n?void 0:n.facetFieldDef){const{titleAnchor:e,titleOrient:n}=mB(["titleAnchor","titleOrient"],o.facetFieldDef,t,i),a=hB(i,n),u=jB(e,a);void 0!==u&&(r[a]=u)}}return rD(r).length>0?r:void 0}(r.layoutHeaders,i);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),o?{titleBand:o}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of nM)e[n].title&&t.push(yB(this,n));for(const e of gB)t=t.concat(wB(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:r=[]}=e;return[...n.map(e=>tB(e,"grid",t)),...r.map(e=>tB(e,"grid",t)),...n.map(e=>tB(e,"main",t)),...r.map(e=>tB(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return sU(this)}assembleProjections(){return lU(this)}assembleTitle(){var e,t,n;const r=null!=(e=this.title)?e:{},{encoding:i}=r,o=k(r,["encoding"]),a=Object.assign(Object.assign(Object.assign({},kR(this.config.title).nonMark),o),i?{encode:{update:i}}:{});if(a.text)return XT(["unit","layer"],this.type)?XT(["middle",void 0],a.anchor)&&(a.frame=null!=(t=a.frame)?t:"group"):a.anchor=null!=(n=a.anchor)?n:"start",rD(a).length>0?a:void 0}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 r=!this.parent||Oq(this.parent)?function e(t){return Sq(t)||jq(t)||kq(t)?t.children.reduce((t,n)=>t.concat(e(n)),sq(t)):sq(t)}(this):[];r.length>0&&(t.scales=r);const i=this.assembleAxes();i.length>0&&(t.axes=i);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}hasDescendantWithFieldOnChannel(e){for(const t of this.children)if(Eq(t)){if(t.channelHasField(e))return!0}else if(t.hasDescendantWithFieldOnChannel(e))return!0;return!1}getName(e){return aD((this.name?this.name+"_":"")+e)}requestDataName(e){var t;const n=this.getName(e),r=this.component.data.outputNodeRefCounts;return r[n]=(null!=(t=r[n])?t:0)+1,n}getSizeSignalRef(e){if(Oq(this.parent)){const t=TM(e),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),r=n.get("range");if(sR(e)&&jI(r)){const e=n.get("name"),r=aq(uq(this,t));if(r){return{signal:TB(e,n,sz({aggregate:"distinct",field:r},{expr:"datum"}))}}return vP(`Unknown field for ${t}. Cannot calculate view size.`),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):hM(e)&&qM(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(hP.selectionNotFound(t));return n}}class Aq extends Cq{vgField(e,t={}){const n=this.fieldDef(e);if(n)return sz(n,t)}reduceFieldDef(e,t){return $z(this.getMapping(),(t,n,r)=>{const i=yz(n);return i?e(t,i,r):t},t)}forEachFieldDef(e,t){Iz(this.getMapping(),(t,n)=>{const r=yz(t);r&&e(r,n)},t)}}class Nq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:"value"),(i=o[1],null!=i?i:"density")]}clone(){return new Nq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{density:t}=e,n=k(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class Tq extends p${constructor(e,t){super(e),this.filter=t}clone(){return new Tq(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:r,markDef:i}=t;if("filter"!==CR("invalid",i,n))return null;const o=t.reduceFieldDef((e,n,i)=>{const o=qM(i)&&t.getScaleComponent(i);if(o){!lR(o.get("type"))||n.aggregate||bD(r)||(e[n.field]=n)}return e},{});return rD(o).length?new Tq(e,o):null}dependentFields(){return new Set(rD(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${VT(this.filter)}`}assemble(){const e=rD(this.filter).reduce((e,t)=>{const n=this.filter[t],r=sz(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${r}) || (isValid(${r}) && isFinite(+${r})))`):"quantitative"===n.type&&(e.push(`isValid(${r})`),e.push(`isFinite(+${r})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Dq extends p${constructor(e,t){super(e),this.transform=t,this.transform=qT(t);const{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!=(n=r[t])?n:e})}clone(){return new Dq(this.parent,qT(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${VT(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Mq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:"key"),(i=o[1],null!=i?i:"value")]}clone(){return new Mq(null,qT(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${VT(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Fq extends p${constructor(e,t,n,r){super(e),this.fields=t,this.geojson=n,this.signal=r}clone(){return new Fq(null,qT(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 r of[["longitude","latitude"],["longitude2","latitude2"]]){const i=r.map(e=>t.channelHasField(e)?t.fieldDef(e).field:iz(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0);(i[0]||i[1])&&(e=new Fq(e,i,null,t.getName(`geojson_${n++}`)))}if(t.channelHasField(WD)){const r=t.fieldDef(WD);"geojson"===r.type&&(e=new Fq(e,null,r.field,t.getName(`geojson_${n++}`)))}return e}dependentFields(){var e;const t=(e=this.fields,null!=e?e:[]).filter(oe.H);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${VT(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class Pq extends p${constructor(e,t,n,r){super(e),this.projection=t,this.fields=n,this.as=r}clone(){return new Pq(null,this.projection,qT(this.fields),qT(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[["longitude","latitude"],["longitude2","latitude2"]]){const r=n.map(e=>t.channelHasField(e)?t.fieldDef(e).field:iz(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0),i="longitude2"===n[0]?"2":"";(r[0]||r[1])&&(e=new Pq(e,t.projectionName(),r,[t.getName("x"+i),t.getName("y"+i)]))}return e}dependentFields(){return new Set(this.fields.filter(oe.H))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${VT(this.fields)} ${VT(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Rq extends p${constructor(e,t){super(e),this.transform=t}clone(){return new Rq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:r}=e;return{signal:`sequence(${[t,n,...r?[r]:[]].join(",")})`}}static makeFromTransform(e,t){return new Rq(e,t)}static makeFromEncoding(e,t){const n=t.encoding,r=n.x,i=n.y;if(tz(r)&&tz(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:u,value:s,frame:l,keyvals:c}=o.impute,f=Bz(t.mark,n);return new Rq(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:o.field,key:a.field},u?{method:u}:{}),void 0!==s?{value:s}:{}),l?{frame:l}:{}),void 0!==c?{keyvals:c}:{}),f.length?{groupby:f}:{}))}return null}hash(){return`Impute ${VT(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform,u=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(s=n,void 0!==(null===(l=s)||void 0===l?void 0:l.stop)?this.processSequence(n):n)}:{}),{method:"value"}),i?{groupby:i}:{}),{value:null});var s,l;let c;if(r&&"value"!==r){c=[Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[r],fields:[e],frame:a,ignorePeers:!1},i?{groupby:i}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}else{c=[{type:"formula",expr:`datum.${e} === null ? ${o} : datum.${e}`,as:e}]}return[u,...c]}}class zq extends PB{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}}class Lq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:t.on),(i=o[1],null!=i?i:t.loess)]}clone(){return new Lq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{loess:t,on:n}=e,r=k(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},r)}}class Iq extends p${constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new Iq(null,qT(this.transform),this.secondary)}static make(e,t,n,r){var i;const o=t.component.data.sources,{from:a}=n;let u=null;if(function(e){return void 0!==e.data}(a)){let e=aW(a.data,o);e||(e=new yU(a.data),o.push(e));const n=t.getName(`lookup_${r}`);u=new m$(e,n,"lookup",t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=u}else if(function(e){return void 0!==e.selection}(a)){const e=a.selection;if(n.as=null!=(i=n.as)?i:e,u=t.getSelectionComponent(aD(e),e).materialized,!u)throw new Error(hP.noSameUnitLookup(e))}return new Iq(e,n,u.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Object(oe.i)(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${VT({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:Object(oe.i)(this.transform.as)}:{});else{let t=this.transform.as;Object(oe.H)(t)||(vP(hP.NO_FIELDS_NEEDS_AS),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class $q extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:"prob"),(i=o[1],null!=i?i:"value")]}clone(){return new $q(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{quantile:t}=e,n=k(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Bq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:t.on),(i=o[1],null!=i?i:t.regression)]}clone(){return new Bq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{regression:t,on:n}=e,r=k(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},r)}}class Uq extends p${constructor(e,t){super(e),this.transform=t}clone(){return new Uq(null,qT(this.transform))}addDimensions(e){var t;this.transform.groupby=ZT((t=this.transform.groupby,null!=t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...(e=this.transform.groupby,null!=e?e:[])])}hash(){return`PivotTransform ${VT(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:r,op:i}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==r?{limit:r}:{}),void 0!==i?{op:i}:{}),void 0!==n?{groupby:n}:{})}}class qq extends p${constructor(e,t){super(e),this.transform=t}clone(){return new qq(null,qT(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${VT(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function Wq(e){let t=0;return function n(r,i){var o;if(r instanceof yU&&!r.isGenerator&&!ZL(r.data)){e.push(i),i={name:null,source:i.name,transform:[]}}if(r instanceof DU&&(r.parent instanceof yU&&!i.source?(i.format=Object.assign(Object.assign({},null!=(o=i.format)?o:{}),{parse:r.assembleFormatParse()}),i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof CU)return i.name||(i.name=`data_${t++}`),!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,void r.assemble().forEach(t=>e.push(t));if((r instanceof xU||r instanceof wU||r instanceof Tq||r instanceof K$||r instanceof fB||r instanceof Pq||r instanceof Fq||r instanceof SU||r instanceof Iq||r instanceof PU||r instanceof MU||r instanceof Mq||r instanceof Dq||r instanceof Nq||r instanceof Lq||r instanceof $q||r instanceof Bq||r instanceof RU||r instanceof qq||r instanceof Uq)&&i.transform.push(r.assemble()),(r instanceof vU||r instanceof g$||r instanceof Rq||r instanceof FU)&&i.transform.push(...r.assemble()),r instanceof m$)if(i.source&&0===i.transform.length)r.setSource(i.source);else if(r.parent instanceof m$)r.setSource(i.name);else if(i.name||(i.name=`data_${t++}`),r.setSource(i.name),1===r.numChildren()){e.push(i),i={name:null,source:i.name,transform:[]}}switch(r.numChildren()){case 0:r instanceof m$&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||(i.name=`data_${t++}`);let o=i.name;!i.source||i.transform.length>0?e.push(i):o=i.source,r.children.forEach(e=>{n(e,{name:null,source:o,transform:[]})});break}}}}function Hq(e,t){var n;if(e.channelHasField(t)){const r=e.facet[t],i=pB("title",null,e.config,t);let o=pz(r,e.config,{allowDisabling:!0,includeDefault:void 0===i||!!i});e.child.component.layoutHeaders[t].title&&(o=Object(oe.A)(o)?o.join(", "):o,o+=" / "+e.child.component.layoutHeaders[t].title,e.child.component.layoutHeaders[t].title=null);const a=pB("labelOrient",r,e.config,t),u=pD((null!=(n=r.header)?n:{}).labels,!0),s=XT(["bottom","right"],a)?"footer":"header";e.component.layoutHeaders[t]={title:o,facetFieldDef:r,[s]:"facet"===t?[]:[Yq(e,t,u)]}}}function Yq(e,t,n){const r="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function Vq(e,t){var n;const{child:r}=e;if(r.component.axes[t]){const{layoutHeaders:o,resolve:a}=e.component;if(a.axis[t]=FB(a,t),"shared"===a.axis[t]){const a="x"===t?"column":"row",u=o[a];for(const o of r.component.axes[t]){const t="top"===(i=o.get("orient"))||"left"===i?"header":"footer";u[t]=null!=(n=u[t])?n:[Yq(e,a,!1)];const r=tB(o,"main",e.config,{header:!0});u[t][0].axes.push(r),o.mainExtracted=!0}}}var i}function Gq(e){Jq(e);const t=e.component.layoutSize;t.setWithExplicit("width",Qq(e,"width")),t.setWithExplicit("height",Qq(e,"height"))}const Xq=Gq,Kq={vconcat:"width",hconcat:"height"};function Jq(e){for(const t of e.children)t.parseLayoutSize()}function Qq(e,t){const n="width"===t?"x":"y",r=e.component.resolve;let i;for(const o of e.children){const e=o.component.layoutSize.getWithExplicit(t),a=r.scale[n];if("independent"===a&&"step"===e.value){i=void 0;break}if(i){if("independent"===a&&i.value!==e.value){i=void 0;break}i=$B(i,e,t,"")}else i=e}if(i){for(const n of e.children)e.renameSignal(n.getName(t),e.getName(t)),n.component.layoutSize.set(t,"merged",!1);return i}return{explicit:!1,value:void 0}}function Zq(e,t){const n="width"===t?"x":"y",r=e.config,i=e.getScaleComponent(n);if(i){const e=i.get("type"),n=i.get("range");if(sR(e)){const e=OL(r.view,t);return jI(n)||xL(e)?"step":e}return _L(r.view,t)}if(e.hasProjection)return _L(r.view,t);{const e=OL(r.view,t);return xL(e)?e.step:e}}function eW(e,t){return(n=e.field)&&!Object(oe.H)(n)&&"repeat"in n?e.field.repeat in t?Object.assign(Object.assign({},e),{field:t[e.field.repeat]}):void vP(hP.noSuchRepeatedValue(e.field.repeat)):e;var n}function tW(e,t){if(void 0!==(e=eW(e,t))){if(null===e)return null;if(KR(e)&&HR(e.sort)){const n=eW(e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function nW(e,t){if(!tz(e)){if(ez(e)){const n=tW(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});{const{condition:t}=e;return k(e,["condition"])}}return e}{const n=tW(e,t);if(n)return n;if(ZR(e))return{condition:e.condition}}}function rW(e,t){const n={};for(const r in e)if(Object(oe.v)(e,r)){const i=e[r];if(Object(oe.A)(i))n[r]=i.map(e=>nW(e,t)).filter(e=>e);else{const e=nW(i,t);void 0!==e&&(n[r]=e)}}return n}function iW(e,t,n){return sz(t,Object.assign({suffix:`by_${sz(e)}`},null!=n?n:{}))}class oW extends Aq{constructor(e,t,n,r,i){super(e,"facet",t,n,i,r,e.resolve),this.child=CW(e.spec,this,this.getName("child"),void 0,r,i),this.children=[this.child];const o=function(e,t){return VR(e)?rW(e,t):tW(e,t)}(e.facet,r);this.facet=this.initFacet(o)}initFacet(e){return VR(e)?$z(e,(e,t,n)=>XT([LD,"column"],n)?void 0===t.field?(vP(hP.emptyFieldDef(t,n)),e):(e[n]=xz(t,n),e):(vP(hP.incompatibleChannel(n,"facet")),e),{}):{facet:xz(e,"facet")}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=sW(this),this.child.parseData()}parseLayoutSize(){Jq(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 nM)Hq(e,t);Vq(e,"x"),Vq(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n,r;const i={};for(const o of nM)for(const a of vB){const u=this.component.layoutHeaders[o],s=u[a],{facetFieldDef:l}=u;if(l){const t=pB("titleOrient",l,this.config,o);if(XT(["right","bottom"],t)){const n=hB(o,t);i.titleAnchor=null!=(e=i.titleAnchor)?e:{},i.titleAnchor[n]="end"}}if(null===(t=s)||void 0===t?void 0:t[0]){const e="row"===o?"height":"width",t="header"===a?"headerBand":"footerBand";"facet"===o||this.child.component.layoutSize.get(e)||(i[t]=null!=(n=i[t])?n:{},i[t][o]=.5),u.title&&(i.offset=null!=(r=i.offset)?r:{},i.offset["row"===o?"rowTitle":"columnTitle"]=10)}}return i}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let r="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(r="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:r})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof oW)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof oW?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:sz(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof oW){if(this.child.channelHasField("column")){const r=sz(this.child.facet.column);e.push(r),t.push("distinct"),n.push(`distinct_${r}`)}}else for(const r of["x","y"]){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(sR(o)&&jI(a)){const i=aq(uq(this.child,r));i?(e.push(i),t.push("distinct"),n.push(`distinct_${i}`)):vP(`Unknown field for ${r}. Cannot calculate view size.`)}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const e of nM){const t=this.facet[e];if(t){u.push(sz(t));const{bin:s,sort:l}=t;if(Az(s)&&u.push(sz(t,{binSuffix:"end"})),HR(l)){const{field:e,op:u=BR}=l,s=iW(t,l);n&&r?(i.push(s),o.push("max"),a.push(s)):(i.push(e),o.push(u),a.push(s))}else if(Object(oe.A)(l)){const n=dB(t,e);i.push(n),o.push("max"),a.push(n)}}}const s=!!n&&!!r;return Object.assign({name:e,data:t,groupby:u},s||i.length>0?{aggregate:Object.assign(Object.assign({},s?{cross:s}:{}),i.length?{fields:i,ops:o,as:a}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?HR(n.sort)?[iW(n,n.sort,{expr:"datum"})]:Object(oe.A)(n.sort)?[dB(n,e,{expr:"datum"})]:[sz(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(HR(e)?e.order:!Object(oe.A)(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return EB(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const r of gB)if(e[r]){const i=pB("labelOrient",e[r],t,r);if(XT(n[r],i))return EB(e[r],r,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Wq(t);return e.children.forEach(t=>n(t,{source:e.name,name:null,transform:[]})),t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||e.assembleTitle(),i=e.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},r?{title:r}:{}),i?{style:i}:{}),{from:{facet:this.assembleFacet()},sort:{field:nM.map(e=>this.facetSortFields(e)).flat(),order:nM.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&rD(e.component.selection).length){const n=Object(oe.Y)(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:rA("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return F$(t)}(this,[])))]}getMapping(){return this.facet}}function aW(e,t){var n,r,i,o,a,u,s,l,c,f;for(const d of t){const t=d.data;if((!e.name||!d.hasName()||e.name===d.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(r=t.format)||void 0===r?void 0:r.feature)||((null===(i=e.format)||void 0===i?void 0:i.feature)||(null===(o=t.format)||void 0===o?void 0:o.feature))&&(null===(a=e.format)||void 0===a?void 0:a.feature)!==(null===(u=t.format)||void 0===u?void 0:u.feature)||((null===(s=e.format)||void 0===s?void 0:s.mesh)||(null===(l=t.format)||void 0===l?void 0:l.mesh))&&(null===(c=e.format)||void 0===c?void 0:c.mesh)!==(null===(f=t.format)||void 0===f?void 0:f.mesh)))if(eI(e)&&eI(t)){if(UT(e.values,t.values))return d}else if(ZL(e)&&ZL(t)){if(e.url===t.url)return d}else if(tI(e)&&e.name===d.dataName)return d}return null}function uW(e,t){if(e.data||!e.parent){if(null===e.data){const e=new yU([]);return t.push(e),e}const n=aW(e.data,t);if(n)return nI(e.data)||(n.data.format=function(e,...t){for(const n of t)QT(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new yU(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function sW(e){var t,n,r,i,o,a,u,s,l,c,f;let d=uW(e,e.component.data.sources);const{outputNodes:h,outputNodeRefCounts:p}=e.component.data,m=e.parent?e.parent.component.data.ancestorParse.clone():new zq,g=e.data;nI(g)?(rI(g)?d=new wU(d,g.sequence):oI(g)&&(d=new xU(d,g.graticule)),m.parseNothing=!0):null===(null===(n=null===(t=g)||void 0===t?void 0:t.format)||void 0===n?void 0:n.parse)&&(m.parseNothing=!0),d=null!=(r=DU.makeExplicit(d,e,m))?r:d,d=new RU(d);const v=e.parent&&Sq(e.parent);(Eq(e)||Oq(e))&&v&&(d=null!=(i=vU.makeFromEncoding(d,e))?i:d),e.transforms.length>0&&(d=function(e,t,n){var r,i;let o=0;for(const a of t.transforms){let u,s=void 0;if(yI(a))u=e=new fB(e,a),s="derived";else if(uI(a)){const i=NU(a);u=e=null!=(r=DU.makeWithAncestors(e,{},i,n))?r:e,e=new K$(e,t,a.filter)}else if(bI(a))u=e=vU.makeFromTransform(e,a,t),s="number";else if(wI(a)){s="date",void 0===n.getWithExplicit(a.field).value&&(e=new DU(e,{[a.field]:s}),n.set(a.field,s,!1)),u=e=g$.makeFromTransform(e,a)}else if(_I(a))u=e=SU.makeFromTransform(e,a),s="number",G$(t)&&(e=new RU(e));else if(sI(a))u=e=Iq.make(e,t,a,o++),s="derived";else if(mI(a))u=e=new PU(e,a),s="number";else if(gI(a))u=e=new MU(e,a),s="number";else if(EI(a))u=e=FU.makeFromTransform(e,a),s="derived";else if(OI(a))u=e=new Mq(e,a),s="derived";else if(vI(a))u=e=new Dq(e,a),s="derived";else if(lI(a))u=e=new Uq(e,a),s="derived";else if(pI(a))e=new qq(e,a);else if(xI(a))u=e=Rq.makeFromTransform(e,a),s="derived";else if(cI(a))u=e=new Nq(e,a),s="derived";else if(fI(a))u=e=new $q(e,a),s="derived";else if(dI(a))u=e=new Bq(e,a),s="derived";else{if(!hI(a)){vP(hP.invalidTransformIgnored(a));continue}u=e=new Lq(e,a),s="derived"}if(u&&void 0!==s)for(const e of null!=(i=u.producedFields())?i:[])n.set(e,s,!1)}return e}(d,e,m));const y=function(e){const t={};if(Eq(e)&&e.component.selection)for(const n of rD(e.component.selection)){const r=e.component.selection[n];for(const e of r.project.items)!e.channel&&hD(e.field)>1&&(t[e.field]="flatten")}return t}(e),b=TU(e);d=null!=(o=DU.makeWithAncestors(d,{},Object.assign(Object.assign({},y),b),m))?o:d,Eq(e)&&(d=Fq.parseAll(d,e),d=Pq.parseAll(d,e)),(Eq(e)||Oq(e))&&(v||(d=null!=(a=vU.makeFromEncoding(d,e))?a:d),d=null!=(u=g$.makeFromEncoding(d,e))?u:d,d=fB.parseAllForSortIndex(d,e));const x=e.getName("raw"),w=new m$(d,x,"raw",p);if(h[x]=w,d=w,Eq(e)){const t=SU.makeFromEncoding(d,e);t&&(d=t,G$(e)&&(d=new RU(d))),d=null!=(s=Rq.makeFromEncoding(d,e))?s:d,d=null!=(l=FU.makeFromEncoding(d,e))?l:d}Eq(e)&&(d=null!=(c=Tq.make(d,e))?c:d);const _=e.getName(aI),E=new m$(d,_,aI,p);h[_]=E,d=E,Eq(e)&&function(e,t){Y$(e,n=>{const r=n.name,i=e.getName(`lookup_${r}`);e.component.data.outputNodes[i]=n.materialized=new m$(new K$(t,e,{selection:r}),i,"lookup",e.component.data.outputNodeRefCounts)})}(e,E);let O=null;if(Oq(e)){const t=e.getName("facet");d=fB.parseAllForSortIndex(d,e),d=null!=(f=function(e,t){const{row:n,column:r}=t;if(n&&r){let t=null;for(const i of[n,r])if(HR(i.sort)){const{field:n,op:r=BR}=i.sort;e=t=new MU(e,{joinaggregate:[{op:r,field:n,as:iW(i,i.sort,{forAs:!0})}],groupby:[sz(i)]})}return t}return null}(d,e.facet))?f:d,O=new CU(d,e,t,E.getSource()),h[t]=O,d=O}return Object.assign(Object.assign({},e.component.data),{outputNodes:h,outputNodeRefCounts:p,raw:w,main:E,facetRoot:O,ancestorParse:m})}class lW extends Cq{constructor(e,t,n,r,i,o,a){super(e,t,n,r,i,o,a)}parseData(){this.component.data=sW(this),this.children.forEach(e=>{e.parseData()})}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),rD(e.component.selection).forEach(t=>{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()}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){return this.children.reduce((e,t)=>[...e,...t.assembleLayoutSignals()],CB(this))}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(),r=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),r?{encode:{update:r}}:{}),e.assembleGroup())})}}class cW extends lW{constructor(e,t,n,r,i){var o,a,u,s;super(e,"concat",t,n,i,r,e.resolve),"shared"!==(null===(a=null===(o=e.resolve)||void 0===o?void 0:o.axis)||void 0===a?void 0:a.x)&&"shared"!==(null===(s=null===(u=e.resolve)||void 0===u?void 0:u.axis)||void 0===s?void 0:s.y)||vP(hP.CONCAT_CANNOT_SHARE_AXIS),this.concatType=vL(e)?"vconcat":yL(e)?"hconcat":"concat",this.children=this.getChildren(e).map((e,t)=>CW(e,this,this.getName("concat_"+t),void 0,r,i))}getChildren(e){return vL(e)?e.vconcat:yL(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Jq(e);const t=e.component.layoutSize,n=Kq[e.concatType];n&&t.setWithExplicit(n,Qq(e,n))}(this)}parseAxisGroup(){return null}assembleDefaultLayout(){return Object.assign(Object.assign({},"vconcat"===this.concatType?{columns:1}:{}),{bounds:"full",align:"each"})}}const fW=Object.assign(Object.assign({gridScale:1,scale:1},MI),{labelExpr:1,encode:1}),dW=rD(fW);class hW extends PB{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new hW(qT(this.explicit),qT(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}}const pW={bottom:"top",top:"bottom",left:"right",right:"left"};function mW(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let r=0;r{switch(n){case"title":return $R(e,t);case"gridScale":return{explicit:e.explicit,value:pD(e.value,t.value)}}return IB(e,t,n,"axis")});e.setWithExplicit(n,r)}return e}function vW(e,t){const n="x"===t?"x2":"y2",r=e.fieldDef(t),i=e.fieldDef(n),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?IR(o,a):o||(a||(void 0!==o?o:void 0!==a?a:void 0))}function yW(e,t){var n;const r=t.axis(e),i=new hW;dW.forEach(n=>{const o=function(e,t,n,r){const i=r.fieldDef(n),o=function(e,t,n,r){if(void 0!==t.labelAngle)return vD(t.labelAngle);{const t=uB("labelAngle",e.config,n,cB(n),e.getScaleComponent(n).get("type"));return void 0!==t?vD(t):n===ID&&XT(["nominal","ordinal"],r.type)?270:void 0}}(r,t,n,i),a=pD(t.orient,cB(n)),{mark:u,config:s}=r;switch(e){case"scale":return r.scaleName(n);case"gridScale":return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(r,n);case"format":if(Oz(i))return;return DR(i,t.format,s);case"formatType":if(Oz(i))return;return t.formatType;case"grid":if(Nz(r.fieldDef(n).bin))return!1;{const e=r.getScaleComponent(n).get("type");return pD(t.grid,function(e,t){return!sR(e)&&!Az(t.bin)}(e,i))}case"labelAlign":return pD(t.labelAlign,lB(o,a));case"labelAngle":return o;case"labelBaseline":return pD(t.labelBaseline,sB(o,a));case"labelFlush":return pD(t.labelFlush,function(e,t){if("x"===t&&XT(["quantitative","temporal"],e.type))return!0}(i,n));case"labelOverlap":{const e=r.getScaleComponent(n).get("type");return pD(t.labelOverlap,function(e,t){if("nominal"!==e.type)return"log"!==t||"greedy"}(i,e))}case"orient":return a;case"tickCount":{const e=r.getScaleComponent(n).get("type"),o="x"===n?"width":"y"===n?"height":void 0,a=o?r.getSizeSignalRef(o):void 0;return pD(t.tickCount,function({fieldDef:e,scaleType:t,size:n}){if(!sR(t)&&"log"!==t&&!XT(["month","hours","day","quarter"],e.timeUnit))return Az(e.bin)?{signal:`ceil(${n.signal}/10)`}:{signal:`ceil(${n.signal}/40)`}}({fieldDef:i,scaleType:e,size:a}))}case"title":{const e="x"===n?"x2":"y2",o=r.fieldDef(e);return pD(t.title,vW(r,n),LR([XR(i)],o?[XR(o)]:[]))}case"values":return function(e,t,n){const r=e.values;if(r)return jz(n,r)}(t,0,i);case"zindex":return pD(t.zindex,function(e,t){return"rect"===e&&lz(t)?1:0}(u,i))}return l=e,FI[l]?t[e]:void 0;var l}(n,r,e,t);if(void 0!==o){const a=function(e,t,n,r,i){switch(t){case"titleAngle":case"labelAngle":return e===vD(n[t]);case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===vW(r,i))return!0}return e===n[t]}(o,n,r,t,e),u=uB(n,t.config,e,i.get("orient"),t.getScaleComponent(e).get("type"));a||void 0===u?i.set(n,o,a):XT(["grid","orient"],n)&&u&&i.set(n,u,!1)}});const o=null!=(n=r.encoding)?n:{},a=TI.reduce((n,r)=>{var a;if(!i.hasAxisPart(r))return n;const u=DB(null!=(a=o[r])?a:{},t),s="labels"===r?function(e,t,n){var r;const i=null!=(r=e.fieldDef(t))?r:"x"===t?e.fieldDef("x2"):"y"===t?e.fieldDef("y2"):void 0,o=e.axis(t);let a={};if(Oz(i)){const n=e.getScaleComponent(t).get("type")===KP.UTC,r=RR("datum.value",i.timeUnit,o.format,null,n);r&&(a.text={signal:r})}return a=Object.assign(Object.assign({},a),n),0===rD(a).length?void 0:a}(t,e,u):u;return void 0!==s&&rD(s).length>0&&(n[r]={update:s}),n},{});return rD(a).length>0&&i.set("encode",a,!!r.encoding||void 0!==r.labelAngle),i}function bW(e,t,n,{graticule:r}){var i,o;const a=_D(e)?Object.assign({},e):{type:e},u=null!=(i=a.orient)?i:AR("orient",a,n);return a.orient=function(e,t,n){switch(e){case"point":case"circle":case"square":case"text":case"rect":case"image":return}const{x:r,y:i,x2:o,y2:a}=t;switch(e){case"bar":if(tz(r)&&(Nz(r.bin)||tz(i)&&i.aggregate&&!r.aggregate))return"vertical";if(tz(i)&&(Nz(i.bin)||tz(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o&&tz(r)&&"quantitative"===r.type&&!Az(r.bin))return"horizontal";if(!a&&tz(i)&&"quantitative"===i.type&&!Az(i.bin))return"vertical"}case"rule":if(o&&a)return;case"area":if(a)return tz(i)&&Nz(i.bin)?"horizontal":"vertical";if(o)return tz(r)&&Nz(r.bin)?"vertical":"horizontal";if("rule"===e){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case"line":case"tick":{const t=tz(r)&&cz(r),o=tz(i)&&cz(i);if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=r,o=i,a="temporal"===t.type,u="temporal"===o.type;return a&&!u?"tick"!==e?"vertical":"horizontal":!a&&u?"tick"!==e?"horizontal":"vertical":!t.aggregate&&o.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!o.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(a.type,t,u),void 0!==u&&u!==a.orient&&vP(hP.orientOverridden(a.orient,u)),void 0===pD(a.opacity,AR("opacity",a,n))&&(a.opacity=function(e,t){if(XT(["point","tick","circle","square"],e)&&!Pz(t))return.7;return}(a.type,t)),void 0===a.filled&&(a.filled=!r&&function(e,t){const n=AR("filled",e,t),r=e.type;return pD(n,"point"!==r&&"line"!==r&&"rule"!==r)}(a,n)),void 0===(null!=(o=a.cursor)?o:AR("cursor",a,n))&&(a.cursor=function(e,t,n){if(t.href||e.href||AR("href",e,n))return"pointer";return e.cursor}(a,t,n)),a}function xW(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),WI("size",e)),function(e,t,n){if(n)return{shape:{value:n}};return WI("shape",e)}(e,0,t))}function wW(e){const{config:t,markDef:n}=e,{orient:r}=n,i="horizontal"===r?"width":"height",o=e.getScaleComponent("horizontal"===r?"x":"y"),a=pD(n[i],n.size,AR("size",n,t,{vgChannel:i}),t.tick.bandSize);if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&jI(e)&&Object(oe.E)(e.step)?3*e.step/4:3*EL(t.view,i)/4}}const _W={area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore"})),n$("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),n$("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),f$(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),o$(e,"x","bar")),o$(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>xW(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&tz(n)&&"geojson"===n.type?{field:sz(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore"})),o$(e,"x","image")),o$(e,"y","image")),YI(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),WI("size",e,{vgChannel:"strokeWidth"})),f$(e))},point:{vgMark:"symbol",encodeEntry:e=>xW(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),o$(e,"x","rect")),o$(e,"y","rect"))},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?Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),n$("x",e,{defaultPos:"horizontal"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"vertical"!==n})),n$("y",e,{defaultPos:"vertical"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"horizontal"!==n})),WI("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>xW(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),YI(e)),WI("size",e,{vgChannel:"fontSize"})),d$("align",function(e,t,n){var r;if(void 0===(null!==(r=e.align)&&void 0!==r?r:AR("align",e,n)))return"center";return}(e.markDef,0,t))),d$("baseline",function(e,t,n){var r;if(void 0===(null!==(r=e.baseline)&&void 0!==r?r:AR("baseline",e,n)))return"middle";return}(e.markDef,0,t)))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,r=n.orient,i="horizontal"===r?"width":"height",o="horizontal"===r?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),JI("x",e,{defaultPos:"mid",vgChannel:"xc"})),JI("y",e,{defaultPos:"mid",vgChannel:"yc"})),WI("size",e,{defaultValue:wW(e),vgChannel:i})),{[o]:{value:pD(n.thickness,t.tick.thickness)}})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),WI("size",e)),f$(e))}};function EW(e){return XT(["line","area","trail"],e.mark)?function(e){const t=Bz(e.mark,e.encoding),n=OW(e,{fromPrefix:t.length>0?"faceted_path_":""});return t.length>0?[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:"faceted_path_"+e.requestDataName(aI),data:e.requestDataName(aI),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n}]:n}(e):XT(["bar"],e.mark)?function(e){var t;const n=AI.some(t=>e.markDef[t]||AR(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&n){const[n]=OW(e,{fromPrefix:"stack_group_"}),r=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(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('${r}',${e})`).join(",")})`;let a,u;"x"===e.stack.fieldChannel?(a=Object.assign(Object.assign({},WT(n.encode.update,["y","yc","y2","height",...AI])),{x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}}),u={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update=Object.assign(Object.assign({},HT(n.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(a=Object.assign(Object.assign({},WT(n.encode.update,["x","xc","x2","width"])),{y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}}),u={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update=Object.assign(Object.assign({},HT(n.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const t of AI){const r=AR(t,e.markDef,e.config);n.encode.update[t]?(a[t]=n.encode.update[t],delete n.encode.update[t]):r&&(a[t]={value:r}),r&&(n.encode.update[t]={value:0})}const s=e.vgField(e.stack.groupbyChannel)?[e.vgField(e.stack.groupbyChannel)]:[];return(null===(t=e.fieldDef(e.stack.groupbyChannel))||void 0===t?void 0:t.bin)&&s.push(e.vgField(e.stack.groupbyChannel,{binSuffix:"end"})),a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((t,r)=>{if(n.encode.update[r])return Object.assign(Object.assign({},t),{[r]:n.encode.update[r]});{const n=AR(r,e.markDef,e.config);return void 0!==n?Object.assign(Object.assign({},t),{[r]:{value:n}}):t}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(aI),name:"stack_group_"+e.requestDataName(aI),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:u},marks:[n]}]}]}return OW(e)}(e):OW(e)}function OW(e,t={fromPrefix:""}){const n=e.mark,r=pD(e.markDef.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),i=SR(e.markDef),o=e.encoding.key,a=function(e){const{encoding:t,stack:n,mark:r,markDef:i,config:o}=e,a=t.order;if(!(!Object(oe.A)(a)&&iz(a)&>(a.value)||!a&>(i.order)||GT(AR("order",i,o)))){if((Object(oe.A)(a)||tz(a))&&!n)return zR(a,{expr:"datum"});if(bD(r)){const n="horizontal"===i.orient?"y":"x",r=t[n];if(tz(r)){const t=r.sort;if(Object(oe.A)(t))return{field:sz(r,{prefix:n,suffix:"sort_index",expr:"datum"})};if(HR(t))return{field:sz({aggregate:Pz(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})};if(WR(t)){return{field:sz(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}}return{field:sz(r,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}else;}}(e),u=function(e){if(!e.component.selection)return null;const t=rD(e.component.selection).length;let n=t,r=e.parent;for(;r&&0===n;)n=rD(r.component.selection).length,r=r.parent;return n?{interactive:t>0}:null}(e),s=_W[n].postEncodingTransform?_W[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:_W[n].vgMark},r?{clip:!0}:{}),i?{style:i}:{}),o?{key:o.field}:{}),a?{sort:a}:{}),u||{}),{from:{data:t.fromPrefix+e.requestDataName(aI)},encode:{update:_W[n].encodeEntry(e)}}),s?{transform:s}:{})]}class kW extends Aq{constructor(e,t,n,r={},i,o){var a;super(e,"unit",t,n,o,i,void 0,e.view),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const u=_D(e.mark)?e.mark.type:e.mark,s=function(e,t){return rW(e,t)}(null!=(a=e.encoding)?a:{},i);this.markDef=bW(e.mark,s,o,{graticule:e.data&&oI(e.data)});const l=this.encoding=zz(s,this.markDef);this.size=function({encoding:e,size:t}){for(const n of AM){const r=NM(n),i=yz(e[n]);xL(t[r])&&i&&cz(i)&&(delete t[r],vP(hP.stepDropped(r)))}return t}({encoding:l,size:Object.assign(Object.assign(Object.assign({},r),e.width?{width:e.width}:{}),e.height?{height:e.height}:{})}),this.stack=LL(u,l),this.specifiedScales=this.initScales(u,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegend(l),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t="geoshape"===this.mark,n=e&&QD.some(t=>tz(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 UM.reduce((e,n)=>{let r,i;const o=t[n];return tz(o)?(r=o,i=o.scale):ez(o)&&(r=o.condition,i=o.condition.scale),r&&(e[n]=null!=i?i:{}),e},{})}initAxes(e){return[ID,$D].reduce((t,n)=>{const r=e[n];if(tz(r)||n===ID&&tz(e.x2)||n===$D&&tz(e.y2)){const e=tz(r)?r.axis:null;null!==e&&(t[n]=Object.assign({},e))}return t},{})}initLegend(e){return $M.reduce((t,n)=>{const r=e[n];if(r){const e=tz(r)?r.legend:ez(r)?r.condition.legend:null;null!==e&&!1!==e&&function(e){switch(e){case BD:case UD:case qD:case HD:case WD:case YD:case XD:return!0;case VD:case GD:return!1}}(n)&&(t[n]=Object.assign({},e))}return t},{})}parseData(){this.component.data=sW(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const r of AM){const i=NM(r);if(t[i]){const e=t[i];n.layoutSize.set(i,xL(e)?"step":e,!0)}else{const t=Zq(e,i);n.layoutSize.set(i,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const r={},i=e.config.selection;for(const o in t){if(!Object(oe.v)(t,o))continue;const a=qT(t[o]),u=i[a.type],{fields:s,encodings:l}=u,c=k(u,["fields","encodings"]);for(const e in c)"encodings"===e&&a.fields||"fields"===e&&a.encodings||("mark"===e&&(a[e]=Object.assign(Object.assign({},c[e]),a[e])),void 0!==a[e]&&!0!==a[e]||(a[e]=null!=(n=c[e])?n:a[e]));const f=aD(o),d=r[f]=Object.assign(Object.assign({},a),{name:f,events:Object(oe.H)(a.on)?rA(a.on,"scope"):qT(a.on)});T$(d,n=>{n.has(d)&&n.parse&&n.parse(e,d,a,t[o])})}return r}(this,this.selection)}parseMarkGroup(){this.component.mark=EW(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,AM.reduce((t,n)=>(e.component.scales[n]&&e.axis(n)&&(t[n]=[yW(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;if(Y$(e,(r,i)=>{const o=r.name,a=Object(oe.Y)(o+B$);if(0===t.filter(e=>e.name===o).length){const e="global"===r.resolve?"union":r.resolve,n="multi"===r.type?", true)":")";t.push({name:r.name,update:`${W$}(${a}, ${Object(oe.Y)(e)}${n}`})}n=!0,i.topLevelSignals&&(t=i.topLevelSignals(e,r,t)),T$(r,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,r,t))})}),n){0===t.filter(e=>"unit"===e.name).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return F$(t)}(this,e)}assembleSignals(){return[...nB(this),...(e=this,t=[],Y$(e,(n,r)=>{const i=n.name;let o=r.modifyExpr(e,n);t.push(...r.signals(e,n)),T$(n,r=>{r.signals&&(t=r.signals(e,n,t)),r.modifyExpr&&(o=r.modifyExpr(e,n,o))}),t.push({name:i+q$,on:[{events:{signal:n.name+U$},update:`modify(${Object(oe.Y)(n.name+B$)}, ${o})`}]})}),F$(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return Y$(e,t=>{const r={name:t.name+B$};if(t.init){const n=t.project.items.map(e=>{const{signals:t}=e;return k(e,["signals"])}),i=t.init.map(e=>D$(e,!1));r.values="interval"===t.type?[{unit:V$(e,{escape:!1}),fields:n,values:i}]:i.map(t=>({unit:V$(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+B$).length||n.push(r)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return CB(this)}assembleMarks(){var e;let t=null!=(e=this.component.mark)?e:[];return this.parent&&Sq(this.parent)||(t=M$(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Fz(this.encoding,e)}fieldDef(e){return bz(this.encoding[e])}}class jW extends Cq{constructor(e,t,n,r,i,o){super(e,"layer",t,n,o,i,e.resolve,e.view);const a=Object.assign(Object.assign(Object.assign({},r),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(ML(e))return new jW(e,this,this.getName("layer_"+t),a,i,o);if(SD(e))return new kW(e,this,this.getName("layer_"+t),a,i,o);throw new Error(hP.invalidSpec(e))})}parseData(){this.component.data=sW(this);for(const e of this.children)e.parseData()}parseLayoutSize(){Gq(this)}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),rD(e.component.selection).forEach(t=>{this.component.selection[t]=e.component.selection[t]})}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:r}=e.component,i={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const i of rD(t.component.axes))r.axis[i]=FB(e.component.resolve,i),"shared"===r.axis[i]&&(n[i]=mW(n[i],t.component.axes[i]),n[i]||(r.axis[i]="independent",delete n[i]))}for(const o of[ID,$D]){for(const a of e.children)if(a.component.axes[o]){if("independent"===r.axis[o]){n[o]=(t=n[o],null!=t?t:[]).concat(a.component.axes[o]);for(const e of a.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(i[t]>0&&!n){const n=pW[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}delete a.component.axes[o]}if("independent"===r.axis[o]&&n[o]&&n[o].length>1)for(const e of n[o])e.get("grid")&&!e.explicit.grid&&(e.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()),nB(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),CB(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}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)Eq(n)&&(t=M$(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),sU(this))}}class SW extends lW{constructor(e,t,n,r,i){super(e,"repeat",t,n,i,r,e.resolve),e.resolve&&e.resolve.axis&&("shared"===e.resolve.axis.x||"shared"===e.resolve.axis.y)&&vP(hP.REPEAT_CANNOT_SHARE_AXIS),this.repeat=e.repeat,this.children=this._initChildren(e,this.repeat,r,i)}_initChildren(e,t,n,r){const i=[],o=!Object(oe.A)(t)&&t.row||[n?n.row:null],a=!Object(oe.A)(t)&&t.column||[n?n.column:null],u=Object(oe.A)(t)&&t||[n?n.repeat:null];for(const t of u)for(const n of o)for(const o of a){const a=(t?`__repeat_repeat_${t}`:"")+(n?`__repeat_row_${n}`:"")+(o?`__repeat_column_${o}`:""),u={repeat:t,row:n,column:o};i.push(CW(e.spec,this,this.getName("child"+a),void 0,u,r))}return i}parseLayoutSize(){Xq(this)}assembleDefaultLayout(){const{repeat:e}=this,t=Object(oe.A)(e)?void 0:e.column?e.column.length:1;return Object.assign(Object.assign({},t?{columns:t}:{}),{bounds:"full",align:"all"})}}function CW(e,t,n,r,i,o){if(GR(e))return new oW(e,t,n,i,o);if(ML(e))return new jW(e,t,n,r,i,o);if(SD(e))return new kW(e,t,n,r,i,o);if(bL(e))return new SW(e,t,n,i,o);if(function(e){return vL(e)||yL(e)||gL(e)}(e))return new cW(e,t,n,i,o);throw new Error(hP.invalidSpec(e))}function AW(e,t={}){var n;t.logger&&(n=t.logger,mP=n),t.fieldTitle&&hz(t.fieldTitle);try{const n=SL(Object(oe.M)({},t.config,e.config)),r=GL(e,n),i=CW(r,null,"",void 0,void 0,n);return i.parse(),function(e,t){bU(e.sources);let n=0,r=0;for(let r=0;r<5&&ZU(e,t);r++)n++;e.sources.map(UU);for(let n=0;n<5&&ZU(e,t);n++)r++;bU(e.sources),5===Math.max(n,r)&&vP("Maximum optimization runs(5) reached.")}(i.component.data,i),{spec:function(e,t,n={},r){const i=e.config?TL(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){var n,r;const i=[],o=Wq(i);let a=0;e.sources.forEach(e=>{e.hasName()||(e.dataName=`source_${a++}`);const t=e.assemble();o(e,t)}),i.forEach(e=>{0===e.transform.length&&delete e.transform});let u=0;for(const[e,t]of i.entries())0!==(n=t.transform,null!=n?n:[]).length||t.source||i.splice(u++,0,i.splice(e,1)[0]);for(const t of i)for(const n of null!=(r=t.transform)?r:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of i)e.name in t&&(e.values=t[e.name]);return i}(e.component.data,n)),a=e.assembleProjections(),u=e.assembleTitle(),s=e.assembleGroupStyle(),l=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();return c=c.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),u?{title:u}:{}),s?{style:s}:{}),l?{encode:{update:l}}:{}),{data:o}),a.length>0?{projections:a}:{}),e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([])])),i?{config:i}:{}),r?{usermeta:r}:{})}(i,function(e,t,n,r){const i=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");void 0===t?t={type:"pad"}:Object(oe.H)(t)&&(t={type:t});if(i&&o&&(a=t.type,"fit"===a||"fit-x"===a||"fit-y"===a))if("step"===i&&"step"===o)vP(hP.droppingFit()),t.type="pad";else if("step"===i||"step"===o){const e="step"===i?"width":"height";vP(hP.droppingFit(TM(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${TM(e)}`:"fit"}(n)}var a;return Object.assign(Object.assign(Object.assign({},1===rD(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),QL(n)),QL(e))}(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&gP(),t.fieldTitle&&hz(fz)}}const NW=new class extends FL{mapUnit(e,{config:t}){if(e.encoding){const{encoding:n,transform:r}=e,{bins:i,timeUnits:o,aggregate:a,groupby:u,encoding:s}=Rz(n,t),l=[...r||[],...i,...o,...0===a.length?[]:[{aggregate:a,groupby:u}]];return Object.assign(Object.assign(Object.assign({},e),l.length>0?{transform:l}:{}),{encoding:s})}return e}};function TW(e,t){return NW.map(e,{config:t})}const DW=TT.version;var MW=n(23),FW=n.n(MW),PW=n(35);var RW={background:"#333",title:{color:"#fff"},style:{"guide-label":{fill:"#fff"},"guide-title":{fill:"#fff"}},axis:{domainColor:"#fff",gridColor:"#888",tickColor:"#fff"}};var zW={background:"#fff",arc:{fill:"#4572a7"},area:{fill:"#4572a7"},line:{stroke:"#4572a7",strokeWidth:2},path:{stroke:"#4572a7"},rect:{fill:"#4572a7"},shape:{stroke:"#4572a7"},symbol:{fill:"#4572a7",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"]}};var LW={arc:{fill:"#30a2da"},area:{fill:"#30a2da"},axis:{domainColor:"#cbcbcb",grid:!0,gridColor:"#cbcbcb",gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:"#cbcbcb",tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:"#f0f0f0",group:{fill:"#f0f0f0"},legend:{labelColor:"#333",labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:"#333",titleFontSize:14,titlePadding:10},line:{stroke:"#30a2da",strokeWidth:2},path:{stroke:"#30a2da",strokeWidth:.5},rect:{fill:"#30a2da"},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:"#30a2da"},style:{bar:{binSpacing:2,fill:"#30a2da",stroke:null}},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}};var IW={group:{fill:"#e5e5e5"},arc:{fill:"#000"},area:{fill:"#000"},line:{stroke:"#000"},path:{stroke:"#000"},rect:{fill:"#000"},shape:{stroke:"#000"},symbol:{fill:"#000",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"]}};const $W="Benton Gothic Bold, sans-serif",BW={"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"]};var UW={background:"#ffffff",title:{anchor:"start",color:"#000000",font:$W,fontSize:22,fontWeight:"normal"},arc:{fill:"#82c6df"},area:{fill:"#82c6df"},line:{stroke:"#82c6df",strokeWidth:2},path:{stroke:"#82c6df"},rect:{fill:"#82c6df"},shape:{stroke:"#82c6df"},symbol:{fill:"#82c6df",size:30},axis:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,labelFontWeight:"normal",titleFont:$W,titleFontSize:13,titleFontWeight:"normal"},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:"Benton Gothic, sans-serif",labelFontSize:11.5,symbolType:"square",titleFont:$W,titleFontSize:13,titleFontWeight:"normal"},range:{category:BW["category-6"],diverging:BW["fireandice-6"],heatmap:BW["fire-7"],ordinal:BW["fire-7"],ramp:BW["fire-7"]}};var qW={background:"#f9f9f9",arc:{fill:"#ab5787"},area:{fill:"#ab5787"},line:{stroke:"#ab5787"},path:{stroke:"#ab5787"},rect:{fill:"#ab5787"},shape:{stroke:"#ab5787"},symbol:{fill:"#ab5787",size:30},axis:{domainColor:"#979797",domainWidth:.5,gridWidth:.2,labelColor:"#979797",tickColor:"#979797",tickWidth:.2,titleColor:"#979797"},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"]}};var WW={background:"#fff",arc:{fill:"#3e5c69"},area:{fill:"#3e5c69"},line:{stroke:"#3e5c69"},path:{stroke:"#3e5c69"},rect:{fill:"#3e5c69"},shape:{stroke:"#3e5c69"},symbol:{fill:"#3e5c69"},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"]}};const HW={"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"]};var YW={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:"Lato"},axisX:{domain:!0,domainColor:"#000000",domainWidth:1,grid:!1,labelFontSize:12,labelFont:"Lato",labelAngle:0,tickColor:"#000000",tickSize:5,titleFontSize:12,titlePadding:10,titleFont:"Lato"},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:"Lato",labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:"Lato",titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:"Lato",symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:"Lato",orient:"right",offset:10},view:{stroke:"transparent"},range:{category:HW["six-groups-cat-1"],diverging:HW["diverging-colors"],heatmap:HW["diverging-colors"],ordinal:HW["six-groups-seq"],ramp:HW["shades-blue"]},area:{fill:"#1696d2"},rect:{fill:"#1696d2"},line:{color:"#1696d2",stroke:"#1696d2",strokeWidth:5},trail:{color:"#1696d2",stroke:"#1696d2",strokeWidth:0,size:1},path:{stroke:"#1696d2",strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:"#1696d2",fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:"#1696d2",stroke:null}},arc:{fill:"#1696d2"},shape:{stroke:"#1696d2"},symbol:{fill:"#1696d2",size:30}};const VW=PW.version;var GW=n(36),XW="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black; }\n #vg-tooltip-element.visible {\n visibility: visible; }\n #vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px; }\n #vg-tooltip-element table {\n border-spacing: 0; }\n #vg-tooltip-element table tr {\n border: none; }\n #vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px; }\n #vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px; }\n #vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left; }\n #vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white; }\n #vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf; }\n";const KW="vg-tooltip-element",JW={offsetX:10,offsetY:10,id:KW,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}class eH{constructor(e){this.options=Object.assign(Object.assign({},JW),e);const t=this.options.id;if(this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return XW.toString().replace(KW,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}this.el=document.getElementById(t),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",t),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el))}tooltipHandler(e,t,n,r){if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=function(e,t,n){if(Object(oe.A)(e))return`[${e.map(e=>t(Object(oe.H)(e)?e:ZW(e,n))).join(", ")}]`;if(Object(oe.F)(e)){let r="";const i=e,{title:o}=i,a=QW(i,["title"]);o&&(r+=`

${t(o)}

`);const u=Object.keys(a);if(u.length>0){r+="";for(const e of u){let i=a[e];void 0!==i&&(Object(oe.F)(i)&&(i=ZW(i,n)),r+=``)}r+="
${t(e)}:${t(i)}
"}return r||"{}"}return t(e)}(r,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}=function(e,t,n,r){let i=e.clientX+n;i+t.width>window.innerWidth&&(i=+e.clientX-n-t.width);let o=e.clientY+r;return o+t.height>window.innerHeight&&(o=+e.clientY-r-t.height),{x:i,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${o}px; left: ${i}px`)}}GW.version;var tH='.vega-embed {\n position: relative;\n display: inline-block; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\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 outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\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 .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 .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: scroll;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n';function nH(e,...t){for(const n of t)rH(e,n);return e}function rH(e,t){for(const n of Object.keys(t))Object(oe.ib)(e,n,t[n],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});const iH=g;let oH=b;const aH=window;void 0===oH&&aH.vl&&aH.vl.compile&&(oH=aH.vl);const uH={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},sH={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},lH={vega:"Vega","vega-lite":"Vega-Lite"},cH={vega:iH.version,"vega-lite":oH?oH.version:"not available"},fH={vega:e=>e,"vega-lite":(e,t)=>oH.compile(e,{config:t}).spec};function dH(e,t,n,r){const i=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(i+e+o),a.document.title=`${lH[r]} JSON Source`}function hH(e,t,n={}){var r,i,o;return j(this,void 0,void 0,(function*(){const a=(u=n.loader)&&"load"in u?n.loader:iH.loader(n.loader);var u;const s=Object(oe.H)(t)?JSON.parse(yield a.load(t)):t,l=yield pH((r=s.usermeta&&s.usermeta.embedOptions,null!=r?r:{}),a),c=yield pH(n,a),f=Object.assign(Object.assign({},nH(c,l)),{config:Object(oe.M)((i=c.config,null!=i?i:{}),(o=l.config,null!=o?o:{}))});return yield function(e,t,n={},r){var i,o,a,u,s,l;return j(this,void 0,void 0,(function*(){const c=n.theme?Object(oe.M)(x[n.theme],null!=(i=n.config)?i:{}):n.config,f=Object(oe.B)(n.actions)?n.actions:nH({},uH,null!=(o=n.actions)?o:{}),d=Object.assign(Object.assign({},sH),n.i18n),h=null!=(a=n.renderer)?a:"canvas",p=null!=(u=n.logLevel)?u:iH.Warn,m=null!=(s=n.downloadFileName)?s:"visualization";if(!1!==n.defaultStyle){const e="vega-embed-style";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerText=void 0===n.defaultStyle||!0===n.defaultStyle?tH.toString():n.defaultStyle,document.head.appendChild(t)}}const g=function(e,t){var n;if(e.$schema){const r=FW()(e.$schema);t&&t!==r.library&&console.warn(`The given visualization spec is written in ${lH[r.library]}, but mode argument sets ${n=lH[t],null!=n?n:t}.`);const i=r.library;return Object(ie.satisfies)(cH[i],`^${r.version.slice(1)}`)||console.warn(`The input spec uses ${lH[i]} ${r.version}, but the current version of ${lH[i]} is v${cH[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":null!=t?t:"vega"}(t,n.mode);let v=fH[g](t,c);if("vega-lite"===g&&v.$schema){const e=FW()(v.$schema);Object(ie.satisfies)(cH.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${cH.vega}.`)}const y="string"==typeof e?document.querySelector(e):e;if(!y)throw Error("${el} does not exist");y.classList.add("vega-embed"),f&&y.classList.add("has-actions"),y.innerHTML="";const b=n.patch;b&&(v=b instanceof Function?b(v):q(v,b,!0,!1).newDocument),n.formatLocale&&iH.formatLocale(n.formatLocale),n.timeFormatLocale&&iH.timeFormatLocale(n.timeFormatLocale);const w=iH.parse(v,"vega-lite"===g?{}:c),_=new iH.View(w,{loader:r,logLevel:p,renderer:h});if(!1!==n.tooltip){let e;e="function"==typeof n.tooltip?n.tooltip:new eH(!0===n.tooltip?{}:n.tooltip).call,_.tooltip(e)}let E,{hover:O}=n;if(void 0===O&&(O="vega"===g),O){const{hoverSet:e,updateSet:t}="boolean"==typeof O?{}:O;_.hover(e,t)}if(n&&(n.width&&_.width(n.width),n.height&&_.height(n.height),n.padding&&_.padding(n.padding)),yield _.initialize(e).runAsync(),!1!==f){let e=y;if(!1!==n.defaultStyle){const t=document.createElement("details");t.title=d.CLICK_TO_VIEW_ACTIONS,y.append(t),e=t;const n=document.createElement("summary");n.innerHTML='\n\n \n \n \n',t.append(n),E=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",E)}const r=document.createElement("div");if(e.append(r),r.classList.add("vega-actions"),!0===f||!1!==f.export)for(const e of["svg","png"])if(!0===f||!0===f.export||f.export[e]){const t=d[`${e.toUpperCase()}_ACTION`],i=document.createElement("a");i.text=t,i.href="#",i.target="_blank",i.download=`${m}.${e}`,i.addEventListener("mousedown",(function(t){_.toImageURL(e,n.scaleFactor).then(e=>{this.href=e}).catch(e=>{throw e}),t.preventDefault()})),r.append(i)}if(!0===f||!1!==f.source){const e=document.createElement("a");e.text=d.SOURCE_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var r,i;dH(re()(t),null!=(r=n.sourceHeader)?r:"",null!=(i=n.sourceFooter)?i:"",g),e.preventDefault()})),r.append(e)}if("vega-lite"===g&&(!0===f||!1!==f.compiled)){const e=document.createElement("a");e.text=d.COMPILED_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var t,r;dH(re()(v),null!=(t=n.sourceHeader)?t:"",null!=(r=n.sourceFooter)?r:"","vega"),e.preventDefault()})),r.append(e)}if(!0===f||!1!==f.editor){const e=null!=(l=n.editorUrl)?l:"https://vega.github.io/editor/",i=document.createElement("a");i.text=d.EDITOR_ACTION,i.href="#",i.addEventListener("mousedown",(function(n){!function(e,t,n){const r=e.open(t);let i=40;e.addEventListener("message",(function t(n){n.source===r&&(i=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){i<=0||(r.postMessage(n,"*"),setTimeout(e,250),i-=1)}),250)}(window,e,{config:c,mode:g,renderer:h,spec:re()(t)}),n.preventDefault()})),r.append(i)}}return{view:_,spec:t,vgSpec:v,finalize:function(){E&&document.removeEventListener("click",E),_.finalize()}}}))}(e,s,f,a)}))}function pH(e,t){var n;return j(this,void 0,void 0,(function*(){const r=Object(oe.H)(e.config)?JSON.parse(yield t.load(e.config)):null!=(n=e.config)?n:{},i=Object(oe.H)(e.patch)?JSON.parse(yield t.load(e.patch)):e.patch;return Object.assign(Object.assign(Object.assign({},e),i?{patch:i}:{}),r?{config:r}:{})}))}var mH={};function gH(e,t){void 0===e&&(e=mH),void 0===t&&(t=mH);var n=Object.keys(e),r=Object.keys(t);return e===t||n.length===r.length&&n.every((function(n){return e[n]===t[n]}))}var vH=function(){};function yH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xH=function(e){function t(){for(var t,n=arguments.length,r=Array(n),i=0;i>",e)}})),0 build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/","renameschema":"scripts/rename-schema.sh","presite":"yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh","site":"pushd site && bundle exec jekyll serve -I -l && popd","tsc:src":"tsc -b src/tsconfig.src.json","tsc:site":"tsc -b site/tsconfig.site.json","prettierbase":"prettier \'**/*.{md,css,yml}\'","eslintbase":"eslint --ext .ts .","format":"yarn eslintbase --fix && yarn prettierbase --write","lint":"yarn eslintbase && yarn prettierbase --check","test":"jest test/ && yarn lint && yarn schema && jest examples/ && yarn test:runtime","test:inspect":"node --inspect-brk ./node_modules/.bin/jest --runInBand test","test:runtime":"TZ=America/Los_Angeles jest test-runtime/","test:runtime:generate":"yarn build:only && rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime","watch:build":"yarn build:only && concurrently --kill-others -n Typescript,Rollup \'yarn tsc:src -w\' \'rollup -c -w\'","watch:site":"concurrently --kill-others -n Typescript,Rollup \'yarn tsc:site -w\' \'rollup -c site/rollup.config.js -w\'","watch:test":"jest --watch"},"repository":{"type":"git","url":"https://github.com/vega/vega-lite.git"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/vega/vega-lite/issues"},"devDependencies":{"@commitlint/cli":"^8.2.0","@commitlint/config-conventional":"^8.2.0","@types/chai":"^4.2.6","@types/d3":"^5.7.2","@types/highlight.js":"^9.12.3","@types/jest":"^24.0.23","@types/jest-environment-puppeteer":"^4.3.1","@types/mkdirp":"^0.5.2","@types/puppeteer":"^2.0.0","@typescript-eslint/eslint-plugin":"^2.10.0","@typescript-eslint/parser":"^2.10.0","ajv":"^6.10.2","chai":"^4.2.0","cheerio":"^1.0.0-rc.2","codecov":"^3.6.1","concurrently":"^5.0.0","d3":"^5.14.2","eslint":"^6.7.2","eslint-config-prettier":"^6.7.0","eslint-plugin-prettier":"^3.1.1","gh-pages":"^2.1.1","highlight.js":"^9.16.2","http-server":"^0.12.0","husky":"^3.1.0","jest":"^24.9.0","jest-puppeteer":"^4.3.0","lint-staged":"^9.5.0","mkdirp":"^0.5.1","prettier":"^1.19.1","puppeteer":"^2.0.0","rollup":"^1.27.8","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-json":"^4.0.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-sourcemaps":"^0.4.2","rollup-plugin-terser":"^5.1.2","svg2png-many":"^0.0.7","terser":"^4.4.2","ts-jest":"^24.2.0","ts-json-schema-generator":"^0.57.0","typescript":"~3.7.3","vega-cli":"^5.9.0","vega-datasets":"^1.28.0","vega-embed":"^6.2.0","vega-tooltip":"^0.19.1","yaml-front-matter":"^4.0.0"},"dependencies":{"@types/clone":"~0.1.30","@types/fast-json-stable-stringify":"^2.0.0","array-flat-polyfill":"^1.0.1","clone":"~2.1.2","fast-deep-equal":"~3.1.1","fast-json-stable-stringify":"~2.0.0","json-stringify-pretty-compact":"~2.0.0","tslib":"~1.10.0","vega-event-selector":"~2.0.2","vega-expression":"~2.6.3","vega-typings":"~0.12.0","vega-util":"~1.12.1","yargs":"~15.0.2"},"peerDependencies":{"vega":"^5.9.0"},"husky":{"hooks":{"pre-commit":"lint-staged","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"lint-staged":{"*.ts":["eslint --fix","git add"],"*.{md,css,yml}":["prettier --write","git add"]},"jest":{"preset":"jest-puppeteer","transform":{"^.+\\\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"testPathIgnorePatterns":["/node_modules","/build","/_site","/src"],"coverageDirectory":"./coverage/","collectCoverage":false}}')},function(e,t,n){(function(t){var n=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var n,r,i;try{n=Map}catch(e){n=function(){}}try{r=Set}catch(e){r=function(){}}try{i=Promise}catch(e){i=function(){}}function o(a,s,l,c,f){"object"==typeof s&&(l=s.depth,c=s.prototype,f=s.includeNonEnumerable,s=s.circular);var d=[],h=[],p=void 0!==t;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function a(l,m){if(null===l)return null;if(0===m)return l;var g,v;if("object"!=typeof l)return l;if(e(l,n))g=new n;else if(e(l,r))g=new r;else if(e(l,i))g=new i((function(e,t){l.then((function(t){e(a(t,m-1))}),(function(e){t(a(e,m-1))}))}));else if(o.__isArray(l))g=[];else if(o.__isRegExp(l))g=new RegExp(l.source,u(l)),l.lastIndex&&(g.lastIndex=l.lastIndex);else if(o.__isDate(l))g=new Date(l.getTime());else{if(p&&t.isBuffer(l))return g=t.allocUnsafe?t.allocUnsafe(l.length):new t(l.length),l.copy(g),g;e(l,Error)?g=Object.create(l):void 0===c?(v=Object.getPrototypeOf(l),g=Object.create(v)):(g=Object.create(c),v=c)}if(s){var y=d.indexOf(l);if(-1!=y)return h[y];d.push(l),h.push(g)}for(var b in e(l,n)&&l.forEach((function(e,t){var n=a(t,m-1),r=a(e,m-1);g.set(n,r)})),e(l,r)&&l.forEach((function(e){var t=a(e,m-1);g.add(t)})),l){var x;v&&(x=Object.getOwnPropertyDescriptor(v,b)),x&&null==x.set||(g[b]=a(l[b],m-1))}if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(l);for(b=0;b build/vega-themes.min.js","deploy:gh":"yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples","prepublishOnly":"yarn clean && yarn build","preversion":"yarn lint","serve":"browser-sync start -s -f build examples --serveStatic examples","start":"yarn build && concurrently --kill-others -n Server,Typescript,Rollup \'yarn serve\' \'tsc -w\' \'rollup -c -w\'"},"devDependencies":{"browser-sync":"^2.26.7","concurrently":"^5.0.0","gh-pages":"^2.1.1","rollup":"^1.27.8","rollup-plugin-json":"^4.0.0","terser":"^4.4.2","typescript":"~3.7.3","vega":"^5.9.0","vega-lite":"^4.0.0","vega-lite-dev-config":"^0.3.1"},"peerDependencies":{"vega":"*","vega-lite":"*"},"beemo":{"module":"vega-lite-dev-config","drivers":["prettier","eslint"]}}')},function(e){e.exports=JSON.parse('{"name":"vega-tooltip","version":"0.19.1","description":"A tooltip plugin for Vega-Lite and Vega visualizations.","main":"build/vega-tooltip.js","module":"build/src/index.js","unpkg":"build/vega-tooltip.min.js","jsdelivr":"build/vega-tooltip.min.js","typings":"build/src/index.d.ts","repository":{"type":"git","url":"https://github.com/vega/vega-tooltip.git"},"keywords":["vega-lite","vega","tooltip"],"author":{"name":"UW Interactive Data Lab","url":"https://idl.cs.washington.edu"},"collaborators":["Dominik Moritz","Sira Horradarn","Zening Qu","Kanit Wongsuphasawat","Yuri Astrakhan","Jeffrey Heer"],"license":"BSD-3-Clause","bugs":{"url":"https://github.com/vega/vega-tooltip/issues"},"homepage":"https://github.com/vega/vega-tooltip#readme","scripts":{"prepare":"beemo create-config --silent","tsc:src":"tsc -b tsconfig.src.json","build":"yarn tsc:src && rollup -c","clean":"rm -rf build examples/data && rm -f src/style.ts","copy:data":"rsync -r node_modules/vega-datasets/data/* examples/data","copy:build":"rsync -r build/* examples/build","deploy:gh":"yarn build && yarn copy:build && gh-pages -d examples && yarn clean","prettierbase":"beemo prettier \'examples/*.{html,scss,css}\'","eslintbase":"beemo eslint \'{src,test,types}/**/*.ts\'","format":"yarn eslintbase --fix && yarn prettierbase --write","lint":"yarn eslintbase && yarn prettierbase --check","postbuild":"terser build/vega-tooltip.js -c -m -o build/vega-tooltip.min.js","prebuild":"mkdir -p build && yarn copy:data && ./build-style.sh","prepublishOnly":"yarn clean && yarn build","preversion":"yarn lint","start":"yarn build && concurrently --kill-others -n Server,Typescript,Rollup \'browser-sync start -s -f build examples --serveStatic examples\' \'yarn tsc:src -w\' \'rollup -c -w\'","pretest":"./build-style.sh","test":"jest"},"devDependencies":{"@types/jest":"^24.0.18","browser-sync":"^2.26.7","concurrently":"^4.1.2","gh-pages":"^2.1.1","jest":"^24.9.0","node-sass":"^4.12.0","path":"^0.12.7","rollup":"^1.20.3","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-json":"^4.0.0","rollup-plugin-node-resolve":"^5.2.0","terser":"^4.2.1","ts-jest":"^24.0.2","typescript":"^3.6.2","vega-datasets":"^1.25.0","vega-lite-dev-config":"^0.2.5","vega-typings":"^0.8.1"},"dependencies":{"vega-util":"^1.11.1"},"beemo":{"module":"vega-lite-dev-config","drivers":["prettier","eslint"]},"jest":{"testURL":"http://localhost/","transform":{"^.+\\\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"testPathIgnorePatterns":["node_modules","/build","src"]}}')},,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),window.__webpack_public_path__=document.querySelector("body").getAttribute("data-base-url")+"nbextensions/displayWidget",function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(41))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(24)),r(n(43))},function(e){e.exports=JSON.parse('{"name":"lux-widget","version":"0.0.6","description":"A Custom Jupyter Widget Library","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["webpack.config.js","tsconfig.json","luxWidget/*.py","luxWidget/nbextension/static/*","*.py","src/*.tsx","src/*.ts","lib/**/*.js","lib/**/*.js.map","lib/**/*.ts","dist/*.js","dist/*.js.map","css/*.css"],"homepage":"https://github.com/lux-org/lux-widget","bugs":{"url":"https://github.com/lux-org/lux-widget/issues"},"license":"Apache License","author":{"name":"Doris Jung-Lin Lee","email":"dorisjunglinlee@gmail.com"},"main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/lux-org/lux-widget"},"scripts":{"postinstall":"pwd && ls && pip install . && jupyter nbextension install --sys-prefix --symlink --overwrite --py luxWidget && jupyter nbextension enable --sys-prefix --py luxWidget","build":"npm install; npm run build:lib && npm run build:nbextension","build:labextension":"npm run clean:labextension && mkdirp luxWidget/labextension && cd luxWidget/labextension && npm pack ../..","build:lib":"tsc","build:nbextension":"webpack -p","build:all":"npm run build:labextension && npm run build:nbextension","clean":"npm run clean:lib && npm run clean:nbextension","clean:lib":"rimraf lib","clean:labextension":"rimraf luxWidget/labextension","clean:nbextension":"rimraf luxWidget/nbextension/static/index.js","prepack":"npm run build:lib","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch"},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2","bootstrap":"^4.4.1","detect-libc":"^1.0.3","needle":"^2.4.0","nopt":"^4.0.1","rc":"^1.2.8","react":"^16.12.0","react-bootstrap":"^1.0.0-beta.16","react-dom":"^16.12.0","react-vega":"^7.1.1","vega":"^5.9.0","vega-embed":"^6.2.1","vega-lite":"^4.0.2"},"devDependencies":{"@babel/preset-react":"^7.7.4","@phosphor/application":"^1.6.0","@phosphor/widgets":"^1.6.0","@types/expect.js":"^0.3.29","@types/mocha":"^5.2.5","@types/node":"^10.11.6","@types/react":"^16.9.16","@types/react-dom":"^16.9.4","@types/webpack-env":"^1.13.6","css-loader":"^3.2.0","expect.js":"^0.3.1","fs-extra":"^7.0.0","mkdirp":"^0.5.1","mocha":"^5.2.0","npm-run-all":"^4.1.3","rimraf":"^2.6.2","source-map-loader":"^0.2.4","style-loader":"^1.0.0","ts-loader":"^6.2.1","typescript":"^3.7.4","webpack":"^4.41.4","webpack-cli":"^3.3.10"},"jupyterlab":{"extension":"lib/plugin"},"presets":["@babel/preset-env","@babel/preset-react"]}')},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(44),a=n(24);n(45);const u=r(n(1)),s=r(n(5)),l=i(n(26)),c=n(64),f=i(n(57)),d=i(n(63));class h extends o.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:h.model_name,_model_module:h.model_module,_model_module_version:h.model_module_version,_view_name:h.view_name,_view_module:h.view_module,value:"Hello World"})}}t.ExampleModel=h,h.serializers=Object.assign({},o.DOMWidgetModel.serializers),h.model_name="ExampleModel",h.model_module=a.MODULE_NAME,h.model_module_version=a.MODULE_VERSION,h.view_name="JupyterWidgetView",h.view_module=a.MODULE_NAME;class p extends o.DOMWidgetView{initialize(){let e=this;class t extends u.Component{constructor(e){super(e),console.log("view:",e),this.state={currentView:e.model.get("current_view"),recommendations:e.model.get("recommendations"),activeTab:e.activeTab,showAlert:!1,selectedRec:{},selectedVisLst:[]},console.log("this.state:",this.state),this.handleSelect=this.handleSelect.bind(this),this.exportSelection=this.exportSelection.bind(this)}onChange(e){this.setState(e.changed)}componentDidMount(){e.listenTo(e.model,"change",this.onChange.bind(this))}componentDidUpdate(){console.log("componentDidUpdate:",e.model.get("selectedVisLst")),e.model.save_changes()}handleSelect(e){this.setState({activeTab:e})}onListChanged(e,t){this.state.selectedRec[e]=t;var n=[];for(var r of Object.keys(this.state.selectedRec))n[r]=l.default.clone(l.default.omit(this.state.recommendations[r],"vspec")),n[r].vspec=l.default.at(this.state.recommendations[r].vspec,this.state.selectedRec[r]);this.setState({selectedVisLst:n})}exportSelection(){console.log("export selection"),this.setState(e=>({showAlert:!0})),setTimeout(()=>{this.setState(e=>({showAlert:!1}))},7e3),e.model.set("selectedVisLst",this.state.selectedVisLst)}render(){console.log("this.state.activeTab:",this.state.activeTab);const e=this.state.recommendations.map((e,t)=>u.createElement(c.Tab,{eventKey:e.action,title:e.action},u.createElement(f.default,{multiple:!0,maxSelectable:10,onChange:this.onListChanged.bind(this,t),graphSpec:e.vspec})));let t,n;return e.length>0&&(t=u.createElement("i",{id:"exportBtn",className:"fa fa-upload",title:"Export selected visualization into variable",onClick:e=>this.exportSelection()})),this.state.showAlert&&(n=u.createElement(c.Alert,{id:"alertBox",key:"infoAlert",variant:"info",dismissible:!0},"Exported selected visualizations to Python variable `widget.selectedVisLst`")),u.createElement("div",{id:"widgetContainer"},u.createElement(d.default,{currentViewSpec:this.state.currentView}),u.createElement("div",{id:"tabBanner"},u.createElement(c.Tabs,{activeKey:this.state.activeTab,id:"tabBannerList",onSelect:this.handleSelect},e)),t,n)}}const n=document.createElement("div"),r=u.createElement(t,e);s.render(r,n),e.el.append(n)}}t.JupyterWidgetView=p},function(t,n){t.exports=e},function(e,t,n){var r=n(46);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);var i={insert:"head",singleton:!1};n(48)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=n(47)(!1)).push([e.i,"#widgetContainer{\n height:312px;\n width:100%;\n display:inline-flex;\n}\ninput[type=text], select {\n width: 100%;\n padding: 12px 20px;\n margin: 8px 0;\n display: inline-block;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-sizing: border-box;\n}\n#mult-graph-container{\n display: inline-flex;\n}\n.recommendationStaticContentOuter{\n scroll-snap-align: start;\n border: 0.5px solid #bcbdbd;\n overflow-x: auto;\n overflow-y: hidden;\n display: inline-block;\n text-align: left;\n /* padding-left: 20px; */\n /* padding-top: 10px; */\n /* height: 100%; */\n height: 280px;\n box-sizing: border-box;\n width: 100%;\n position: relative;\n}\n.recommendationContentOuter{\n /* overflow: scroll; */\n /* Prevents unneccesary x-scroll for specified facet */\n /* width: 100%; */\n /*height: 225px;*/\n display: flex;\n /* display: inline-block;*/\n margin-left: 10px;\n text-align: left;\n}\n.vega-embed {\n position: relative;\n display: inline-block;\n /* padding-right: 38px; */\n flex: 1 0 auto;\n padding-right: 10px !important;\n}\n/* .vega-embed:hover{\n border: solid 1px;\n border-color: rgba(0, 0, 0, 0.4);\n box-shadow: 5px 5px 5px 0px rgba(0,0,0,0.5);\n cursor: pointer;\n} */\n.vega-embed:checked{\n border: solid 1px;\n border-color: blue;\n}\n.recommendationContentInner{\n /*width: auto;\n max-width: 150%;*/\n /*display: inline-block;*/\n /*margin-left: 8px;*/\n text-align: left;\n display: flex;\n flex-wrap: nowrap;\n align-items: flex-end;\n /* overflow-x: auto; */\n overflow-x: initial;\n padding-right: 50px;\n /*height: 280px;*/\n /* width: max-content;\n overflow-x: auto; */\n /* height: 100px; */\n}\n\n.toolDiv{\n position: relative;\n top: -20px;\n left: -5px;\n}\n.fa {\n color:gray;\n}\n.fa:hover{\n color:black;\n}\n.graph-container{\n height: 250px;\n max-height: 270px;\n margin: 10px 0px 5px 5px;\n padding: 0px 0px 0px 0px;\n overflow-y: auto;\n}\n#mainVizTitle{\n font-size: 20px;\n display: inline-block;\n left: 10%;\n top: 0px;\n position: absolute;\n}\n#mainVizContainer{\n padding: 10px 10px 0px 0px;\n /* position: absolute; */\n border: 0.5px solid #bcbdbd;\n overflow-y: auto;\n overflow-x: hidden;\n display: flex;\n min-width: 30%;\n height: 100%;\n}\n\n#mainVizInnerContainer{\n width: 300px;\n height: 245px;\n top: 21%;\n left: 3%;\n position: absolute;\n}\n#placeHolderVizContainer{\n min-height: 100%;\n min-width: 1px;\n}\n#tabBanner{\n width: auto;\n overflow: hidden;\n min-width: 70%;\n}\n#exportBtn{\n position: absolute;\n /* bottom: 90%; */\n /* left: 97%; */\n top: 0px;\n right: 0px;\n font-size: 20px;\n padding: 5px;\n}\n#alertBox{\n position: absolute;\n left: 33%;\n width: 65%;\n bottom: 6%;\n padding: 5px 30px 5px 10px;\n}\n/* canvas{\n width: 229px;\n height: 245px;\n} */\n/* Override .fade default to show tab*/\n.fade {\n opacity:1;\n}\n/* Copied from bootstrap.css */\n.nav {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n padding-left: 0;\n margin-bottom: 0;\n list-style: none;\n}\n\n.nav-link {\n display: block;\n padding: 0.5rem 1rem;\n}\n\n.nav-link:hover, .nav-link:focus {\n text-decoration: none;\n}\n\n.nav-link.disabled {\n color: #6c757d;\n pointer-events: none;\n cursor: default;\n}\n\n.nav-tabs {\n border-bottom: 1px solid #dee2e6;\n}\n\n.nav-tabs .nav-item {\n margin-bottom: -1px;\n}\n\n.nav-tabs .nav-link {\n border: 1px solid transparent;\n border-top-left-radius: 0.25rem;\n border-top-right-radius: 0.25rem;\n}\n\n.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus {\n border-color: #e9ecef #e9ecef #dee2e6;\n}\n\n.nav-tabs .nav-link.disabled {\n color: #6c757d;\n background-color: transparent;\n border-color: transparent;\n}\n\n.nav-tabs .nav-link.active,\n.nav-tabs .nav-item.show .nav-link {\n color: #495057;\n background-color: #fff;\n border-color: #dee2e6 #dee2e6 #fff;\n}\n\n.nav-tabs .dropdown-menu {\n margin-top: -1px;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n\n.nav-pills .nav-link {\n border-radius: 0.25rem;\n}\n\n.nav-pills .nav-link.active,\n.nav-pills .show > .nav-link {\n color: #fff;\n background-color: #007bff;\n}\n\n.nav-fill .nav-item {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n text-align: center;\n}\n\n.nav-justified .nav-item {\n -ms-flex-preferred-size: 0;\n flex-basis: 0;\n -ms-flex-positive: 1;\n flex-grow: 1;\n text-align: center;\n}\n\n.tab-content > .tab-pane {\n display: none;\n}\n\n.tab-content > .active {\n display: block;\n}\n/* Selectable Card React Component CSS */\n/* Card */\n.card {\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n background: #fff;\n margin: 20px 10px;\n cursor: pointer;\n}\n.card:hover {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n/* Selectable */\n.card .selectable {\n position: relative;\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n border: 4px solid transparent;\n}\n.card .selectable .check {\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n position: absolute;\n top: 0;\n right: 0;\n z-index: 10;\n width: 20px;\n height: 20px;\n}\n.card .selectable .check:before {\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n content: '';\n border: 20px solid;\n border-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n z-index: -1;\n}\n.card .selectable .check .checkmark {\n display: block;\n font: 20px sans-serif;\n line-height: 20px;\n text-align: center;\n color: transparent;\n}\n.card .selectable.selected {\n border-color: #4ad;\n}\n.card .selectable.selected .check:before {\n border-color: #4ad #4ad rgba(0, 0, 255, 0) rgba(255, 0, 0, 0);\n}\n.card .selectable.selected .check .checkmark {\n color: #fff;\n}\n.content {\n padding: 24px;\n}\n.content .title, .content .description {\n margin: 0;\n padding: 4px;\n}\n.column {\n float: left;\n width: 50%;\n}\n.column > .title {\n text-align: center;\n}\nbutton.card {\n display: block;\n cursor: pointer;\n width: 180px;\n margin: 20px auto;\n text-align: center;\n padding: 16px;\n border-color: transparent;\n border-radius: 10px;\n background: #4ad !important;\n color: #fff;\n text-transform: uppercase;\n font-weight: bold;\n outline: none;\n}\nbutton.card:focus {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n}\n",""]),e.exports=t},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(a=r,u=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(u),"/*# ".concat(s," */")),o=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot).concat(e," */")}));return[n].concat(o).concat([i]).join("\n")}var a,u,s;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function ee(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=N(t),a=N(e),u=!1,s=a.length-1;s>=0;s--){var l=e[f=a[s]];if(!A(t,f)||void 0===t[f]&&void 0!==l&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+M(f),value:T(l)}),n.push({op:"remove",path:r+"/"+M(f)}),u=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}),!0);else{var c=t[f];"object"==typeof l&&null!=l&&"object"==typeof c&&null!=c?ee(l,c,n,r+"/"+M(f),i):l!==c&&(!0,i&&n.push({op:"test",path:r+"/"+M(f),value:T(l)}),n.push({op:"replace",path:r+"/"+M(f),value:T(c)}))}}if(u||o.length!=a.length)for(s=0;s=0&&n.splice(i,1)),n},n}var ue=async function(e,t){try{await t(e)}catch(t){e.error(t)}},se=Symbol("vega_id"),le=1;function ce(e){return!(!e||!fe(e))}function fe(e){return e[se]}function de(e,t){return e[se]=t,e}function he(e){var t=e===Object(e)?e:{data:e};return fe(t)?t:de(t,le++)}function pe(e){return me(e,he({}))}function me(e,t){for(var n in e)t[n]=e[n];return t}function ge(e,t){return de(t,fe(e))}function ve(e,t){return e?t?(n,r)=>e(n,r)||fe(t(n))-fe(t(r)):(t,n)=>e(t,n)||fe(t)-fe(n):null}function ye(e){return e&&e.constructor===be}function be(){var e=[],t=[],n=[],r=[],i=[],o=!1;return{constructor:be,insert:function(t){for(var n=Object(oe.i)(t),r=0,i=n.length;r0&&(g(d,f,c.value),a.modifies(f));for(s=0,l=i.length;s0&&g(e,c.field,c.value)})),a.modifies(c.field);if(o)a.mod=t.length||r.length?u.filter((function(e){return p[fe(e)]>0})):u.slice();else for(h in m)a.mod.push(m[h]);return a}}}var xe="_:mod:_";function we(){Object.defineProperty(this,xe,{writable:!0,value:{}})}var _e=we.prototype;_e.set=function(e,t,n,r){var i=this,o=i[e],a=i[xe];return null!=t&&t>=0?(o[t]!==n||r)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||r)&&(i[e]=n,a[e]=Object(oe.A)(n)?1+n.length:-1),i},_e.modified=function(e,t){var n,r=this[xe];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(Object(oe.A)(e)){for(n=0;n=0?t+1e?(t=n,1):0}))},Te.debounce=function(e){var t=Ne();return this.targets().add(Ne(null,null,Object(oe.m)(e,(function(e){var n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},Te.between=function(e,t){var n=!1;return e.targets().add(Ne(null,null,(function(){n=!0}))),t.targets().add(Ne(null,null,(function(){n=!1}))),this.filter((function(){return n}))};const De=/^([A-Za-z]+:)?\/\//,Me=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Fe=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Pe(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function Re(e,t){t=Object(oe.o)({},this.options,t);const n=this.fileAccess,r={href:null};let i,o,a;const u=Me.test(e.replace(Fe,""));null!=e&&"string"==typeof e&&u||Object(oe.n)("Sanitize failure, invalid URI: "+Object(oe.Y)(e));const s=De.test(e);return(a=t.baseURL)&&!s&&(e.startsWith("/")||"/"===a[a.length-1]||(e="/"+e),e=a+e),o=(i=e.startsWith("file://"))||"file"===t.mode||"http"!==t.mode&&!s&&n,i?e=e.slice("file://".length):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(r,"localFile",{value:!!o}),r.href=e,t.target&&(r.target=t.target+""),t.rel&&(r.rel=t.rel+""),r}function ze(e){return e?function(t){return new Promise((function(n,r){e.readFile(t,(function(e,t){e?r(e):n(t)}))}))}:Le}async function Le(){Object(oe.n)("No file system access.")}function Ie(e){return e?async function(t,n){const r=Object(oe.o)({},this.options.http,n),i=n&&n.response,o=await e(t,r);return o.ok?Object(oe.D)(o[i])?o[i]():o.text():Object(oe.n)(o.status+""+o.statusText)}:$e}async function $e(){Object(oe.n)("No HTTP fetch method available.")}var Be={boolean:oe.Z,integer:oe.bb,number:oe.bb,date:oe.ab,string:oe.db,unknown:oe.x},Ue=[function(e){return"true"===e||"false"===e||!0===e||!1===e},function(e){return Ye(e)&&Number.isInteger(+e)},Ye,function(e){return!Number.isNaN(Date.parse(e))}],qe=["boolean","integer","number","date"];function We(e,t){if(!e||!e.length)return"unknown";var n,r,i,o,a=0,u=e.length,s=Ue.length,l=Ue.map((function(e,t){return t+1}));for(r=0,u=e.length;r9999?"+"+Je(t,6):Je(t,4))+"-"+Je(e.getUTCMonth()+1,2)+"-"+Je(e.getUTCDate(),2)+(o?"T"+Je(n,2)+":"+Je(r,2)+":"+Je(i,2)+"."+Je(o,3)+"Z":i?"T"+Je(n,2)+":"+Je(r,2)+":"+Je(i,2)+"Z":r||n?"T"+Je(n,2)+":"+Je(r,2)+"Z":"")}var Ze=function(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function r(e,t){var r,i=[],o=e.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return Ge;if(l)return l=!1,Ve;var t,r,i=a;if(34===e.charCodeAt(i)){for(;a++=o?s=!0:10===(r=e.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===e.charCodeAt(a)&&++a),e.slice(i+1,t-1).replace(/""/g,'"')}for(;a1)r=ft(e,t,n);else for(i=0,r=new Array(o=e.arcs.length);ie!==t,exterior:(e,t)=>e===t};function ht(e,t){let n,r,i,o;return e=Object(nt.a)(e,t),t&&t.feature?(n=ot,i=t.feature):t&&t.mesh?(n=lt,i=t.mesh,o=dt[t.filter]):Object(oe.n)("Missing TopoJSON feature or mesh parameter."),r=(r=e.objects[i])?n(e,r,o):Object(oe.n)("Invalid TopoJSON object: "+i),r&&r.features||[r]}ht.responseType="json";const pt={dsv:tt,csv:et(","),tsv:et("\t"),json:nt.a,topojson:ht};function mt(e,t){return arguments.length>1?(pt[e]=t,this):Object(oe.v)(pt,e)?pt[e]:null}function gt(e){const t=mt(e);return t&&t.responseType||"text"}var vt=new Date,yt=new Date;function bt(e,t,n,r){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=function(t){return e(t=new Date(+t)),t},i.ceil=function(n){return e(n=new Date(n-1)),t(n,1),e(n),n},i.round=function(e){var t=i(e),n=i.ceil(e);return e-t0))return u;do{u.push(a=new Date(+n)),t(n,o),e(n)}while(a=t)for(;e(t),!n(t);)t.setTime(t-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}))},n&&(i.count=function(t,r){return vt.setTime(+t),yt.setTime(+r),e(vt),e(yt),Math.floor(n(vt,yt))},i.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?function(t){return r(t)%e==0}:function(t){return i.count(0,t)%e==0}):i:null}),i}function xt(e){return bt((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var wt=xt(0),_t=xt(1),Et=xt(2),Ot=xt(3),kt=xt(4),jt=xt(5),St=xt(6),Ct=(wt.range,_t.range,Et.range,Ot.range,kt.range,jt.range,St.range,bt((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1}))),At=Ct;Ct.range;function Nt(e){return bt((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var Tt=Nt(0),Dt=Nt(1),Mt=Nt(2),Ft=Nt(3),Pt=Nt(4),Rt=Nt(5),zt=Nt(6),Lt=(Tt.range,Dt.range,Mt.range,Ft.range,Pt.range,Rt.range,zt.range,bt((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1}))),It=Lt,$t=(Lt.range,bt((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()})));$t.every=function(e){return isFinite(e=Math.floor(e))&&e>0?bt((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var Bt=$t,Ut=($t.range,bt((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()})));Ut.every=function(e){return isFinite(e=Math.floor(e))&&e>0?bt((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var qt=Ut;Ut.range;function Wt(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Ht(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Yt(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var Vt,Gt,Xt,Kt,Jt,Qt={"-":"",_:" ",0:"0"},Zt=/^\s*\d+/,en=/^%/,tn=/[\\^$*+?|[\]().{}]/g;function nn(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o68?1900:2e3),n+r[0].length):-1}function pn(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function mn(e,t,n){var r=Zt.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function gn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function vn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function yn(e,t,n){var r=Zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function bn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function wn(e,t,n){var r=Zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function _n(e,t,n){var r=Zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function En(e,t,n){var r=Zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function On(e,t,n){var r=en.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function kn(e,t,n){var r=Zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function jn(e,t,n){var r=Zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Sn(e,t){return nn(e.getDate(),t,2)}function Cn(e,t){return nn(e.getHours(),t,2)}function An(e,t){return nn(e.getHours()%12||12,t,2)}function Nn(e,t){return nn(1+It.count(Bt(e),e),t,3)}function Tn(e,t){return nn(e.getMilliseconds(),t,3)}function Dn(e,t){return Tn(e,t)+"000"}function Mn(e,t){return nn(e.getMonth()+1,t,2)}function Fn(e,t){return nn(e.getMinutes(),t,2)}function Pn(e,t){return nn(e.getSeconds(),t,2)}function Rn(e){var t=e.getDay();return 0===t?7:t}function zn(e,t){return nn(Tt.count(Bt(e)-1,e),t,2)}function Ln(e,t){var n=e.getDay();return e=n>=4||0===n?Pt(e):Pt.ceil(e),nn(Pt.count(Bt(e),e)+(4===Bt(e).getDay()),t,2)}function In(e){return e.getDay()}function $n(e,t){return nn(Dt.count(Bt(e)-1,e),t,2)}function Bn(e,t){return nn(e.getFullYear()%100,t,2)}function Un(e,t){return nn(e.getFullYear()%1e4,t,4)}function qn(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+nn(t/60|0,"0",2)+nn(t%60,"0",2)}function Wn(e,t){return nn(e.getUTCDate(),t,2)}function Hn(e,t){return nn(e.getUTCHours(),t,2)}function Yn(e,t){return nn(e.getUTCHours()%12||12,t,2)}function Vn(e,t){return nn(1+At.count(qt(e),e),t,3)}function Gn(e,t){return nn(e.getUTCMilliseconds(),t,3)}function Xn(e,t){return Gn(e,t)+"000"}function Kn(e,t){return nn(e.getUTCMonth()+1,t,2)}function Jn(e,t){return nn(e.getUTCMinutes(),t,2)}function Qn(e,t){return nn(e.getUTCSeconds(),t,2)}function Zn(e){var t=e.getUTCDay();return 0===t?7:t}function er(e,t){return nn(wt.count(qt(e)-1,e),t,2)}function tr(e,t){var n=e.getUTCDay();return e=n>=4||0===n?kt(e):kt.ceil(e),nn(kt.count(qt(e),e)+(4===qt(e).getUTCDay()),t,2)}function nr(e){return e.getUTCDay()}function rr(e,t){return nn(_t.count(qt(e)-1,e),t,2)}function ir(e,t){return nn(e.getUTCFullYear()%100,t,2)}function or(e,t){return nn(e.getUTCFullYear()%1e4,t,4)}function ar(){return"+0000"}function ur(){return"%"}function sr(e){return+e}function lr(e){return Math.floor(+e/1e3)}function cr(e){return Vt=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,a=e.shortDays,u=e.months,s=e.shortMonths,l=on(i),c=an(i),f=on(o),d=an(o),h=on(a),p=an(a),m=on(u),g=an(u),v=on(s),y=an(s),b={a:function(e){return a[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return u[e.getMonth()]},c:null,d:Sn,e:Sn,f:Dn,H:Cn,I:An,j:Nn,L:Tn,m:Mn,M:Fn,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:sr,s:lr,S:Pn,u:Rn,U:zn,V:Ln,w:In,W:$n,x:null,X:null,y:Bn,Y:Un,Z:qn,"%":ur},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return s[e.getUTCMonth()]},B:function(e){return u[e.getUTCMonth()]},c:null,d:Wn,e:Wn,f:Xn,H:Hn,I:Yn,j:Vn,L:Gn,m:Kn,M:Jn,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:sr,s:lr,S:Qn,u:Zn,U:er,V:tr,w:nr,W:rr,x:null,X:null,y:ir,Y:or,Z:ar,"%":ur},w={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=v.exec(t.slice(n));return r?(e.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=m.exec(t.slice(n));return r?(e.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return O(e,t,n,r)},d:vn,e:vn,f:En,H:bn,I:bn,j:yn,L:_n,m:gn,M:xn,p:function(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:mn,Q:kn,s:jn,S:wn,u:sn,U:ln,V:cn,w:un,W:fn,x:function(e,t,r){return O(e,n,t,r)},X:function(e,t,n){return O(e,r,t,n)},y:hn,Y:dn,Z:pn,"%":On};function _(e,t){return function(n){var r,i,o,a=[],u=-1,s=0,l=e.length;for(n instanceof Date||(n=new Date(+n));++u53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Ht(Yt(o.y,0,1))).getUTCDay(),r=i>4||0===i?_t.ceil(r):_t(r),r=At.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Wt(Yt(o.y,0,1))).getDay(),r=i>4||0===i?Dt.ceil(r):Dt(r),r=It.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.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),i="Z"in o?Ht(Yt(o.y,0,1)).getUTCDay():Wt(Yt(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Ht(o)):Wt(o)}}function O(e,t,n,r){for(var i,o,a=0,u=t.length,s=n.length;a=s)return-1;if(37===(i=t.charCodeAt(a++))){if(i=t.charAt(a++),!(o=w[i in Qt?t.charAt(a++):i])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return(b.x=_(n,b),b.X=_(r,b),b.c=_(t,b),x.x=_(n,x),x.X=_(r,x),x.c=_(t,x),{format:function(e){var t=_(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=E(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=_(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=E(e+="",!0);return t.toString=function(){return e},t}})}(e),Gt=Vt.format,Xt=Vt.parse,Kt=Vt.utcFormat,Jt=Vt.utcParse,Vt}cr({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"]});var fr=function(e,t,n){const r=mt((t=t||{}).type||"json");return r||Object(oe.n)("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n){if(!e.length)return;n=n||Xt;var r,i,o,a,u,s,l,c=e.columns||Object.keys(e[0]);"auto"===t&&(t=He(e,c));for(c=Object.keys(t),r=c.map((function(e){var r,i,o=t[e];if(o&&(0===o.indexOf("date:")||0===o.indexOf("utc:")))return("'"===(i=(r=o.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?Jt(i):n(i);if(!Be[o])throw Error("Illegal format pattern: "+e+":"+o);return Be[o]})),a=0,s=e.length,l=c.length;ae.touch(n(t)):Object(oe.D)(r)?(u=new ke(null,r,i,!1),a=t=>{u.evaluate(t);const r=n(t),i=u.value;ye(i)?e.pulse(r,i,o):e.update(r,i,s)}):a=t=>e.update(n(t),r,s),t.apply(a)}function gr(e,t,n,r,i,o){if(void 0===r)t.targets().add(n);else{const a=o||{},u=new ke(null,function(e,t){return t=Object(oe.D)(t)?t:Object(oe.l)(t),e?function(n,r){const i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}(n,r),i,!1);u.modified(a.force),u.rank=t.rank,t.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),e.connect(n,[u]))}}var vr={};function yr(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}var br=yr.prototype;function xr(e,t){return e?function(n,r){return e(n,r)&&t(n,r)}:t}function wr(e,t){var n=[];return Object(oe.hb)(e,t,(function(e){n.push(e)})),n}function _r(e,t){var n={};return e.visit(t,(function(e){n[fe(e)]=1})),function(e){return n[fe(e)]?null:e}}function Er(e,t,n,r){var i,o,a,u,s,l=this,c=0;for(this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n,a=0,u=n.length;at[e]=!0):t[e]=!0,this},br.modified=function(e,t){var n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?Object(oe.A)(e)?e.some((function(e){return n[e]})):n[e]:!!n)},br.filter=function(e,t){var n=this;return 1&e&&(n.addF=xr(n.addF,t)),2&e&&(n.remF=xr(n.remF,t)),4&e&&(n.modF=xr(n.modF,t)),16&e&&(n.srcF=xr(n.srcF,t)),n},br.materialize=function(e){var t=this;return 1&(e=e||7)&&t.addF&&(t.add=wr(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=wr(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=wr(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},br.visit=function(e,t){var n,r,i=this,o=t;return 16&e?(Object(oe.hb)(i.source,i.srcF,o),i):(1&e&&Object(oe.hb)(i.add,i.addF,o),2&e&&Object(oe.hb)(i.rem,i.remF,o),4&e&&Object(oe.hb)(i.mod,i.modF,o),8&e&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||(r?Object(oe.hb)(n,_r(i,5),o):Object(oe.hb)(n,i.srcF,o))),i)};var Or=Object(oe.y)(Er,yr);function kr(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Or.fork=function(e){var t=new yr(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(function(e){return t.add.push(e)})),e&t.REM&&this.visit(t.REM,(function(e){return t.rem.push(e)})),e&t.MOD&&this.visit(t.MOD,(function(e){return t.mod.push(e)}))),t},Or.changed=function(e){return this.changes&e},Or.modified=function(e){var t=this,n=t.fields;return n&&t.changes&t.MOD?Object(oe.A)(e)?e.some((function(e){return n[e]})):n[e]:0},Or.filter=function(){Object(oe.n)("MultiPulse does not support filtering.")},Or.materialize=function(){Object(oe.n)("MultiPulse does not support materialization.")},Or.visit=function(e,t){var n=this,r=n.pulses,i=r.length,o=0;if(e&n.SOURCE)for(;ot=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Cr(t,0,t.length-1,e)),pop:()=>{var n,r=t.pop();return t.length?(n=t[0],t[0]=r,function(e,t,n){var r,i=t,o=e.length,a=e[t],u=1+(t<<1);for(;u=0&&(u=r),e[t]=e[u],u=1+((t=u)<<1);e[t]=a,Cr(e,i,t,n)}(t,0,e)):n=r,n}}}function Cr(e,t,n,r){var i,o,a;for(i=e[n];n>t&&r(i,o=e[a=n-1>>1])<0;)e[n]=o,n=a;return e[n]=i}function Ar(){this.logger(Object(oe.K)()),this.logLevel(oe.b),this._clock=0,this._rank=0;try{this._loader=dr()}catch(e){}this._touched=ae(oe.w),this._input={},this._pulse=null,this._heap=Sr((e,t)=>e.qrank-t.qrank),this._postrun=[]}var Nr=Ar.prototype;function Tr(e){return function(){return this._log[e].apply(this,arguments)}}function Dr(e,t){ke.call(this,e,null,t)}Nr.stamp=function(){return this._clock},Nr.loader=function(e){return arguments.length?(this._loader=e,this):this._loader},Nr.cleanThreshold=1e4,Nr.add=function(e,t,n,r){var i,o=1;return e instanceof ke?i=e:e&&e.prototype instanceof ke?i=new e:Object(oe.D)(e)?i=new ke(null,e):(o=0,i=new ke(e,t)),this.rank(i),o&&(r=n,n=t),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},Nr.connect=function(e,t){var n,r,i=e.rank;for(n=0,r=t.length;n=0;)i.push(t=n[r]),t===e&&Object(oe.n)("Cycle detected in dataflow graph.")},Nr.pulse=function(e,t,n){this.touch(e,n||jr);var r=new yr(this,this._clock+(this._pulse?0:1)),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this},Nr.touch=function(e,t){var n=t||jr;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},Nr.update=function(e,t,n){var r=n||jr;return(e.set(t)||r.force)&&this.touch(e,r),this},Nr.changeset=be,Nr.ingest=function(e,t,n){return this.pulse(e,this.changeset().insert(hr(t,n)))},Nr.parse=hr,Nr.preload=async function(e,t,n){const r=this,i=r._pending||function(e){var t,n=new Promise((function(e){t=e}));return n.requests=0,n.done=function(){0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(r);i.requests+=1;const o=await r.request(t,n);return r.pulse(e,r.changeset().remove(oe.fb).insert(o.data||[])),i.done(),o},Nr.request=async function(e,t){const n=this;let r,i=0;try{r=await n.loader().load(e,{context:"dataflow",response:gt(t&&t.type)});try{r=hr(r,t)}catch(t){i=-2,n.warn("Data ingestion failed",e,t)}}catch(t){i=-1,n.warn("Loading failed",e,t)}return{data:r,status:i}},Nr.events=function(e,t,n,r){for(var i,o=this,a=Ne(n,r),u=function(e){e.dataflow=o;try{a.receive(e)}catch(e){o.error(e)}finally{o.run()}},s=0,l=(i="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):Object(oe.i)(e)).length;s=oe.c&&(s=Date.now(),r.debug("-- START PROPAGATION ("+c+") -----")),r._touched.forEach(e=>r._enqueue(e,!0)),r._touched=ae(oe.w);try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,e)),u.then?u=await u:u.async&&(o.push(u.async),u=vr),i>=oe.a&&r.debug(a.id,u===vr?"STOP":u,a),u!==vr&&a._targets&&a._targets.forEach(e=>r._enqueue(e)),++f):r._enqueue(a,!0)}catch(e){r._heap.clear(),l=e}if(r._input={},r._pulse=null,i>=oe.c&&(s=Date.now()-s,r.info("> Pulse "+c+": "+f+" operators; "+s+"ms")),l&&(r._postrun=[],r.error(l)),r._postrun.length){const e=r._postrun.sort((e,t)=>t.priority-e.priority);r._postrun=[];for(let t=0;tr.runAsync(null,()=>{e.forEach(e=>{try{e(r)}catch(e){r.error(e)}})})),r},Nr.run=function(e,t,n){return this._pulse?kr(this):(this.evaluate(e,t,n),this)},Nr.runAsync=async function(e,t,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running},Nr.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)}},Nr._enqueue=function(e,t){var n=e.stampe.pulse),t):this._input[e.id]||function(e,t){if(t&&t.stamp===e.stamp)return t;e=e.fork(),t&&t!==vr&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)},Nr.logger=function(e){return arguments.length?(this._log=e,this):this._log},Nr.error=Tr("error"),Nr.warn=Tr("warn"),Nr.info=Tr("info"),Nr.debug=Tr("debug"),Nr.logLevel=Tr("level");var Mr=Object(oe.y)(Dr,ke);Mr.run=function(e){return e.stampthis.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t);var t},Mr.evaluate=function(e){var t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},Mr.transform=function(){};var Fr={};function Pr(e){var t=Rr(e);return t&&t.Definition||null}function Rr(e){return e=e&&e.toLowerCase(),Object(oe.v)(Fr,e)?Fr[e]:null}function zr(e){return e&&e.length?1===e.length?e[0]:(t=e,function(e){for(var n=t.length,r=1,i=String(t[0](e));r 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:Ur({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:Ur({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:Ur({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:Ur({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:Ur({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:Ur({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:Ur({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:Ur({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:Ur({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:Ur({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:Ur({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:Ur({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:Ur({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (Number.isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:Ur({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (Number.isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},$r=Object.keys(Ir);function Br(e,t){return Ir[e](t)}function Ur(e){return function(t){var n=Object(oe.o)({init:"",add:"",rem:"",idx:0},e);return n.out=t||e.name,n}}function qr(e,t){return e.idx-t.idx}function Wr(e,t){var n=t||oe.x,r=function(e,t){var n,r=e.reduce((function e(n,r){function i(t){n[t]||e(n,n[t]=Ir[t]())}return r.req&&r.req.forEach(i),t&&r.str&&r.str.forEach(i),n}),e.reduce((function(e,t){return e[t.name]=t,e}),{})),i=[];for(n in r)i.push(r[n]);return i.sort(qr)}(e,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",o="this.cell = cell; this.init();",a="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",u="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach((function(e){i+=e.init,a+=e.add,u+=e.rem})),e.slice().sort(qr).forEach((function(e){s+="t["+Object(oe.Y)(e.out)+"]="+e.set+";"})),s+="return t;",(o=Function("cell",o)).prototype.init=Function(i),o.prototype.add=Function("v","t",a),o.prototype.rem=Function("v","t",u),o.prototype.set=Function("t",s),o.prototype.get=n,o.fields=e.map((function(e){return e.out})),o}var Hr=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 r of e)null!=(r=t(r,++n,e))&&(r=+r)>=r&&(yield r)}},Yr=function(e,t){return et?1:e>=t?0:NaN};function Vr(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n=i)&&(n=i)}return n}function Gr(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 r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Xr(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}var Kr=function(e){return null===e?NaN:+e};function Jr(e,t,n){if(r=(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 r of e)null!=(r=t(r,++n,e))&&(r=+r)>=r&&(yield r)}}(e,n))).length){if((t=+t)<=0||r<2)return Gr(e);if(t>=1)return Vr(e);var r,i=(r-1)*t,o=Math.floor(i),a=Vr(function e(t,n,r=0,i=t.length-1,o=Yr){for(;i>r;){if(i-r>600){const a=i-r+1,u=n-r+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(u-a/2<0?-1:1);e(t,n,Math.max(r,Math.floor(n-u*l/a+c)),Math.min(i,Math.floor(n+(a-u)*l/a+c)),o)}const a=t[n];let u=r,s=i;for(Xr(t,r,n),o(t[i],a)>0&&Xr(t,r,i);u0;)--s}0===o(t[r],a)?Xr(t,r,s):(++s,Xr(t,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return t}(e,o).subarray(0,o+1));return a+(Gr(e.subarray(o+1))-a)*(i-o)}}var Qr=function(e,t,n){var r=Float64Array.from(Hr(e,n));return r.sort(Yr),t.map(e=>function(e,t,n=Kr){if(r=e.length){if((t=+t)<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(i-o)}}(r,e))},Zr=function(e,t){return Qr(e,[.25,.5,.75],t)};var ei=function(e,t){var n=e.length,r=function(e,t){const n=function(e,t){let n,r=0,i=0,o=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-i,i+=n/++r,o+=n*(t-i));else{let a=-1;for(let u of e)null!=(u=t(u,++a,e))&&(u=+u)>=u&&(n=u-i,i+=n/++r,o+=n*(u-i))}if(r>1)return o/(r-1)}(e,t);return n?Math.sqrt(n):n}(e,t),i=Zr(e,t),o=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)},ti=function(e){var t,n,r,i,o,a,u,s,l=e.maxbins||20,c=e.base||10,f=Math.log(c),d=e.divide||[5,2],h=e.extent[0],p=e.extent[1],m=e.span||p-h||Math.abs(h)||1;if(e.step)t=e.step;else if(e.steps){for(o=m/l,a=0,u=e.steps.length;al;)t*=c;for(a=0,u=d.length;a=r&&m/o<=l&&(t=o)}return i=(o=Math.log(t))>=0?0:1+~~(-o/f),s=Math.pow(c,-i-1),(e.nice||void 0===e.nice)&&(h=h<(o=Math.floor(h/t+s)*t)?o-t:o,p=Math.ceil(p/t)*t),{start:h,stop:p===h?h+t:p,step:t}},ni=Math.random;function ri(e){ni=e}var ii=function(e,t,n,r){if(!e.length)return[void 0,void 0];var i,o,a,u,s=Float64Array.from(Hr(e,r)),l=s.length,c=t;for(a=0,u=Array(c);ae);let i,o=0,a=1,u=e.length,s=new Float64Array(u),l=r(e[0]),c=l,f=l+t;for(;a=f){for(c=(l+c)/2;o>1);ra;)e[r--]=e[o]}o=a,a=n}return e}(s,t+t/4):s};var ai=function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},ui=function(e,t){null==t&&(t=e,e=0);var n,r,i,o={};return o.min=function(e){return arguments.length?(i=r-(n=e||0),o):n},o.max=function(e){return arguments.length?(i=(r=e||0)-n,o):r},o.sample=function(){return n+Math.floor(i*ni())},o.pdf=function(e){return e===Math.floor(e)&&e>=n&&e=r?1:(t-n+1)/i},o.icdf=function(e){return e>=0&&e<=1?n-1+Math.floor(e*i):NaN},o.min(e).max(t)};const si=Math.sqrt(2*Math.PI),li=Math.SQRT2;let ci=NaN;function fi(e,t){e=e||0,t=null==t?1:t;let n,r,i=0,o=0;if(ci==ci)i=ci,ci=NaN;else{do{i=2*ni()-1,o=2*ni()-1,n=i*i+o*o}while(0===n||n>1);r=Math.sqrt(-2*Math.log(n)/n),i*=r,ci=o*r}return e+i*t}function di(e,t,n){const r=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*si)}function hi(e,t,n){let r,i=(e-(t=t||0))/(n=null==n?1:n),o=Math.abs(i);if(o>37)r=0;else{let e,t=Math.exp(-o*o/2);o<7.07106781186547?(e=.0352624965998911*o+.700383064443688,e=e*o+6.37396220353165,e=e*o+33.912866078383,e=e*o+112.079291497871,e=e*o+221.213596169931,e=e*o+220.206867912376,r=t*e,e=.0883883476483184*o+1.75566716318264,e=e*o+16.064177579207,e=e*o+86.7807322029461,e=e*o+296.564248779674,e=e*o+637.333633378831,e=e*o+793.826512519948,e=e*o+440.413735824752,r/=e):(e=o+.65,e=o+4/e,e=o+3/e,e=o+2/e,e=o+1/e,r=t/e/2.506628274631)}return i>0?1-r:r}function pi(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*li*function(e){let t,n=-Math.log((1-e)*(1+e));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;return t*e}(2*e-1)}var mi=function(e,t){var n,r,i={mean:function(e){return arguments.length?(n=e||0,i):n},stdev:function(e){return arguments.length?(r=null==e?1:e,i):r},sample:()=>fi(n,r),pdf:e=>di(e,n,r),cdf:e=>hi(e,n,r),icdf:e=>pi(e,n,r)};return i.mean(e).stdev(t)},gi=function(e,t){var n=mi(),r={},i=0;return r.data=function(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},r.bandwidth=function(n){return arguments.length?(!(t=n)&&e&&(t=ei(e)),r):t},r.sample=function(){return e[~~(ni()*i)]+t*n.sample()},r.pdf=function(r){for(var o=0,a=0;avi(n,r),pdf:e=>yi(e,n,r),cdf:e=>bi(e,n,r),icdf:e=>xi(e,n,r)};return i.mean(e).stdev(t)},_i=function(e,t){var n,r={},i=0;function o(e){var t,n=[],r=0;for(t=0;t=t&&e<=n?1/(n-t):0}function ki(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function ji(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}var Si=function(e,t){var n,r,i={min:function(e){return arguments.length?(n=e||0,i):n},max:function(e){return arguments.length?(r=null==e?1:e,i):r},sample:()=>Ei(n,r),pdf:e=>Oi(e,n,r),cdf:e=>ki(e,n,r),icdf:e=>ji(e,n,r)};return null==t&&(t=null==e?1:e,e=0),i.min(e).max(t)},Ci=function(e,t,n,r){const i=r-e*e,o=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-o*e,o]};function Ai(e,t,n,r){e=e.filter(e=>{let r=t(e),i=n(e);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&e.sort((e,n)=>t(e)-t(n));const i=e.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,l,c=0,f=0,d=0;for(l of e)o[c]=u=+t(l),a[c]=s=+n(l),++c,f+=(u-f)/c,d+=(s-d)/c;for(c=0;c=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}var Ti=function(e,t,n,r,i){let o=0,a=0;return Ni(e,t,n,(e,t)=>{const n=t-i(e),u=t-r;o+=n*n,a+=u*u}),1-o/a},Di=function(e,t,n){let r=0,i=0,o=0,a=0,u=0;Ni(e,t,n,(e,t)=>{++u,r+=(e-r)/u,i+=(t-i)/u,o+=(e*t-o)/u,a+=(e*e-a)/u});const s=Ci(r,i,o,a),l=e=>s[0]+s[1]*e;return{coef:s,predict:l,rSquared:Ti(e,t,n,i,l)}},Mi=function(e,t,n){let r=0,i=0,o=0,a=0,u=0;Ni(e,t,n,(e,t)=>{++u,e=Math.log(e),r+=(e-r)/u,i+=(t-i)/u,o+=(e*t-o)/u,a+=(e*e-a)/u});const s=Ci(r,i,o,a),l=e=>s[0]+s[1]*Math.log(e);return{coef:s,predict:l,rSquared:Ti(e,t,n,i,l)}},Fi=function(e,t,n){let r=0,i=0,o=0,a=0,u=0,s=0;Ni(e,t,n,(e,t)=>{const n=Math.log(t),l=e*t;++s,r+=(t-r)/s,o+=(l-o)/s,u+=(e*l-u)/s,i+=(t*n-i)/s,a+=(l*n-a)/s});const l=Ci(o/r,i/r,a/r,u/r),c=e=>l[0]*Math.exp(l[1]*e);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ti(e,t,n,r,c)}},Pi=function(e,t,n){let r=0,i=0,o=0,a=0,u=0,s=0;Ni(e,t,n,(e,t)=>{const n=Math.log(e),l=Math.log(t);++s,r+=(n-r)/s,i+=(l-i)/s,o+=(n*l-o)/s,a+=(n*n-a)/s,u+=(t-u)/s});const l=Ci(r,i,o,a),c=e=>l[0]*Math.pow(e,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ti(e,t,n,u,c)}},Ri=function(e,t,n){const[r,i,o,a]=Ai(e,t,n),u=r.length;let s,l,c,f,d=0,h=0,p=0,m=0,g=0;for(s=0;sb*(e-=o)*e+x*e+w+a;return{coef:[w-x*o+b*o*o+a,x-2*b*o,b],predict:_,rSquared:Ti(e,t,n,0,_)}},zi=function(e,t,n,r){if(1===r)return Di(e,t,n);if(2===r)return Ri(e,t,n);const[i,o,a,u]=Ai(e,t,n),s=i.length,l=[],c=[],f=r+1;let d,h,p,m,g;for(d=0;dMath.abs(e[r][a])&&(a=i);for(o=r;o=r;o--)e[o][i]-=e[o][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(u=0,o=i+1;o{e-=a;let t=u+v[0]+v[1]*e+v[2]*e*e;for(d=3;d=0;--o)for(u=t[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(n,a)*s;return i[0]+=r,i}var Ii=function(e,t){return Jr(e,.5,t)};var $i=function(e,t,n,r){const[i,o,a,u]=Ai(e,t,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),d=new Float64Array(s).fill(1);for(let e=-1;++e<=2;){const t=[0,l-1];for(let e=0;ei[a]-n?r:a;let s=0,l=0,h=0,p=0,m=0,g=1/Math.abs(i[u]-n||1);for(let e=r;e<=a;++e){const t=i[e],r=o[e],a=Bi(Math.abs(n-t)*g)*d[e],u=t*a;s+=a,l+=u,h+=r*a,p+=r*u,m+=t*u}const[v,y]=Ci(l/s,h/s,p/s,m/s);c[e]=v+y*n,f[e]=Math.abs(o[e]-c[e]),Ui(i,e+1,t)}if(2===e)break;const n=Ii(f);if(Math.abs(n)<1e-12)break;for(let e,t,r=0;r=1?1e-12:(t=1-e*e)*t}return function(e,t,n,r){const i=e.length,o=[];let a,u=0,s=0,l=[];for(;u=e.length))for(;t>i&&e[o]-r<=r-e[i];)n[0]=++i,n[1]=o,++o}const qi=.1*Math.PI/180;var Wi=function(e,t,n,r){n=n||25,r=Math.max(n,r||200);const i=t=>[t,e(t)],o=t[0],a=t[1],u=a-o,s=u/r,l=[i(o)],c=[];if(n===r){for(let e=1;e0;)c.push(i(o+e/n*u));let f=l[0],d=c[c.length-1];for(;d;){const e=i((f[0]+d[0])/2);e[0]-f[0]>=s&&Hi(f,e,d)>qi?c.push(e):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l};function Hi(e,t,n){const r=Math.atan2(n[1]-e[1],n[0]-e[0]),i=Math.atan2(t[1]-e[1],t[0]-e[0]);return Math.abs(r-i)}function Yi(e){this._key=e?Object(oe.t)(e):fe,this.reset()}var Vi=Yi.prototype;function Gi(e){Dr.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}Vi.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Vi.add=function(e){this._add.push(e)},Vi.rem=function(e){this._rem.push(e)},Vi.values=function(){if(this._get=null,0===this._rem.length)return this._add;var e,t,n,r=this._add,i=this._rem,o=this._key,a=r.length,u=i.length,s=Array(a-u),l={};for(e=0;e=0;)t=e(n[r])+"",Object(oe.v)(i,t)||(i[t]=1,++o);return o},Vi.extent=function(e){if(this._get!==e||!this._ext){var t=this.values(),n=Object(oe.q)(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Vi.argmin=function(e){return this.extent(e)[0]||{}},Vi.argmax=function(e){return this.extent(e)[1]||{}},Vi.min=function(e){var t=this.extent(e)[0];return null!=t?e(t):void 0},Vi.max=function(e){var t=this.extent(e)[1];return null!=t?e(t):void 0},Vi.quartile=function(e){return this._get===e&&this._q||(this._q=Zr(this.values(),e),this._get=e),this._q},Vi.q1=function(e){return this.quartile(e)[0]},Vi.q2=function(e){return this.quartile(e)[1]},Vi.q3=function(e){return this.quartile(e)[2]},Vi.ci=function(e){return this._get===e&&this._ci||(this._ci=ii(this.values(),1e3,.05,e),this._get=e),this._ci},Vi.ci0=function(e){return this.ci(e)[0]},Vi.ci1=function(e){return this.ci(e)[1]},Gi.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:$r},{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"}]};var Xi=Object(oe.y)(Gi,Dr);Xi.transform=function(e,t){var n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):{},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))),r.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),n.changes(r)},Xi.cross=function(){var e=this,t=e.value,n=e._dnames,r=n.map((function(){return{}})),i=n.length;function o(e){var t,o,a,u;for(t in e)for(a=e[t].tuple,o=0;ou?1/0:(t=Math.max(a,Math.min(+t,u-o)),a+o*Math.floor(1e-14+(t-a)/o))};return s.start=a,s.stop=i.stop,s.step=o,this.value=Object(oe.f)(s,Object(oe.g)(r),e.name||"bin_"+Object(oe.h)(r))};var Qi=function(e,t,n){var r=e,i=t||[],o=n||[],a={},u=0;return{add:function(e){o.push(e)},remove:function(e){a[r(e)]=++u},size:function(){return i.length},data:function(e,t){return u&&(i=i.filter((function(e){return!a[r(e)]})),a={},u=0),t&&e&&i.sort(e),o.length&&(i=e?Object(oe.L)(e,i,o.sort(e)):i.concat(o),o=[]),i}}};function Zi(e){Dr.call(this,[],e)}function eo(e){ke.call(this,null,to,e)}function to(e){return this.value&&!e.modified()?this.value:Object(oe.k)(e.fields,e.orders)}function no(e){Dr.call(this,null,e)}Zi.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Object(oe.y)(Zi,Dr).transform=function(e,t){var n=t.fork(t.ALL),r=Qi(fe,this.value,n.materialize(n.ADD).add),i=e.sort,o=t.changed()||i&&(e.modified("sort")||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(ve(i),o),t.source&&t.source.root&&(this.value.root=t.source.root),n},Object(oe.y)(eo,ke),no.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"]}]};var ro=Object(oe.y)(no,Dr);function io(e){Dr.call(this,null,e)}ro.transform=function(e,t){function n(t){return function(n){for(var r,i=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(u(n),e.case,o)||[],s=0,l=i.length;s{var t={};return t[u[0]]=e[0],t[u[1]]=e[1],he(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n};function fo(e){Dr.call(this,null,e)}function ho(e){ke.call(this,null,po,e),this.modified(!0)}function po(e){var t=e.expr;return this.value&&!e.modified("expr")?this.value:Object(oe.f)(n=>t(n,e),Object(oe.g)(t),Object(oe.h)(t))}function mo(e){Dr.call(this,[void 0,void 0],e)}function go(e,t){ke.call(this,e),this.parent=t}fo.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"}]},Object(oe.y)(fo,Dr).transform=function(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,r=co(t.source,e.groupby,oe.x),i=e.smooth||!1,o=e.field,a=e.step||function(e,t){return Object(oe.W)(Object(oe.p)(e,t))/30}(n,o),u=ve((e,t)=>o(e)-o(t)),s=e.as||"bin",l=r.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=t),e[++c][s]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(s)},Object(oe.y)(ho,ke),mo.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},Object(oe.y)(mo,Dr).transform=function(e,t){var n,r=this.value,i=e.field,o=r[0],a=r[1];if(((n=t.changed()||t.modified(i.fields)||e.modified("field"))||null==o)&&(o=1/0,a=-1/0),t.visit(n?t.SOURCE:t.ADD,(function(e){var t=i(e);null!=t&&((t=+t)a&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=Object(oe.h)(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]};var vo=Object(oe.y)(go,ke);function yo(e){Dr.call(this,{},e),this._keys=Object(oe.s)();var t=this._targets=[];t.active=0,t.forEach=function(e){for(var n=0,r=t.active;nn.cleanThreshold&&n.runAfter(a.clean),t},Object(oe.y)(xo,ke),_o.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},Object(oe.y)(_o,Dr).transform=function(e,t){var n=t.dataflow,r=this.value,i=t.fork(),o=i.add,a=i.rem,u=i.mod,s=e.expr,l=!0;function c(t){var n=fe(t),i=s(t,e),c=r.get(n);i&&c?(r.delete(n),o.push(t)):i||c?l&&i&&!c&&u.push(t):(r.set(n,1),a.push(t))}return t.visit(t.REM,(function(e){var t=fe(e);r.has(t)?r.delete(t):a.push(e)})),t.visit(t.ADD,(function(t){s(t,e)?o.push(t):r.set(fe(t),1)})),t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},Eo.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}]},Object(oe.y)(Eo,Dr).transform=function(e,t){var n=t.fork(t.NO_SOURCE),r=e.fields,i=lo(r,e.as||[]),o=e.index||null,a=i.length;return n.rem=this.value,t.visit(t.SOURCE,(function(e){for(var t,u,s,l=r.map(t=>t(e)),c=l.reduce((e,t)=>Math.max(e,t.length),0),f=0;ft[r]=n(t,e))},Object(oe.y)(jo,Dr).transform=function(e,t){var n,r,i,o=this.value,a=t.fork(t.ALL),u=e.size-o.length,s=e.generator;if(u>0){for(n=[];--u>=0;)n.push(i=he(s(e))),o.push(i);a.add=a.add.length?a.materialize(a.ADD).add.concat(n):n}else r=o.slice(0,-u),a.rem=a.rem.length?a.materialize(a.REM).rem.concat(r):r,o=o.slice(-u);return a.source=this.value=o,a};var So={value:"value",median:Ii,mean:function(e,t){let n=0,r=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let o of e)null!=(o=t(o,++i,e))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:Gr,max:Vr},Co=[];function Ao(e){Dr.call(this,[],e)}function No(e){Gi.call(this,e)}Ao.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}]},Object(oe.y)(Ao,Dr).transform=function(e,t){var n,r,i,o,a,u,s,l,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||So.value;if(null!=So[n])return n===So.value?(t=void 0!==e.value?e.value:0,function(){return t}):So[n];Object(oe.n)("Unrecognized imputation method: "+n)}(e),p=function(e){var t=e.field;return function(e){return e?t(e):NaN}}(e),m=Object(oe.h)(e.field),g=Object(oe.h)(e.key),v=(e.groupby||[]).map(oe.h),y=function(e,t,n,r){var i,o,a,u,s,l,c,f,d=function(e){return e(f)},h=[],p=r?r.slice():[],m={},g={};for(p.forEach((function(e,t){m[e]=t+1})),u=0,c=e.length;uo&&(o=r[1]);return[i,o]}function $o(e){ke.call(this,null,Bo,e)}function Bo(e){return this.value&&!e.modified()?this.value:e.values.reduce((function(e,t){return e.concat(t)}),[])}function Uo(e){Dr.call(this,null,e)}function qo(e){Gi.call(this,e)}To.transform=function(e,t){var n,r=this,i=e.modified();return r.value&&(i||t.modified(r._inputs,!0))?(n=r.value=i?r.init(e):{},t.visit(t.SOURCE,(function(e){r.add(e)}))):(n=r.value=r.value||this.init(e),t.visit(t.REM,(function(e){r.rem(e)})),t.visit(t.ADD,(function(e){r.add(e)}))),r.changes(),t.visit(t.SOURCE,(function(e){Object(oe.o)(e,n[r.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},To.changes=function(){var e,t,n=this._adds,r=this._mods;for(e=0,t=this._alen;e{const n=gi(t,a)[u],r=e.counts?t.length:1,i=c||Object(oe.p)(t);Wi(n,i,f,d).forEach(e=>{const n={};for(let e=0;e(this._pending=Object(oe.i)(e.data),e=>e.touch(this)))}}return n.request(e.url,e.format).then(e=>Ro(this,t,Object(oe.i)(e.data)))},zo.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}]},Object(oe.y)(zo,Dr).transform=function(e,t){var n,r,i=t,o=e.as,a=e.fields,u=e.index,s=e.values,l=null==e.default?null:e.default,c=e.modified(),f=c?t.SOURCE:t.ADD,d=a.length;return s?(r=s.length,d>1&&!o&&Object(oe.n)('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==d*r&&Object(oe.n)('The "as" parameter has too few output field names.'),o=o||s.map(oe.h),n=function(e){for(var t,n,i=0,c=0;it||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)})),t?i.slice(0,t):i}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:a.map((function(){return i})),fields:a.map((function(e){return function(e,t,n,r){return Object(oe.f)((function(r){return t(r)===e?n(r):NaN}),r,e+"")}(e,n,r,o)})),as:a.map((function(e){return e+""})),modified:e.modified.bind(e)}}(e,t),t)},Object(oe.y)(Ho,yo).transform=function(e,t){var n=this,r=e.subflow,i=e.field;return(e.modified("field")||i&&t.modified(Object(oe.g)(i)))&&Object(oe.n)("PreFacet does not support field modification."),this._targets.active=0,t.visit(t.MOD,(function(e){var o=n.subflow(fe(e),r,t,e);i?i(e).forEach((function(e){o.mod(e)})):o.mod(e)})),t.visit(t.ADD,(function(e){var o=n.subflow(fe(e),r,t,e);i?i(e).forEach((function(e){o.add(he(e))})):o.add(e)})),t.visit(t.REM,(function(e){var o=n.subflow(fe(e),r,t,e);i?i(e).forEach((function(e){o.rem(e)})):o.rem(e)})),t},Yo.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},Object(oe.y)(Yo,Dr).transform=function(e,t){var n,r,i=e.fields,o=lo(e.fields,e.as||[]),a=i?function(e,t){return function(e,t,n,r){for(var i=0,o=n.length;i{const t=Qr(e,s);for(let n=0;n{var t=fe(e);n.rem.push(r[t]),r[t]=null}),t.visit(t.ADD,e=>{var t=pe(e);r[fe(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{var t,i=r[fe(e)];for(t in e)i[t]=e[t],n.modifies(t);n.mod.push(i)})),n},Qo.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},Object(oe.y)(Qo,Dr).transform=function(e,t){var n=t.fork(t.NO_SOURCE),r=e.modified("size"),i=e.size,o=this.value,a=this.count,u=0,s=o.reduce((function(e,t){return e[fe(t)]=1,e}),{});function l(e){var t,r;o.length=u&&(t=o[r],s[fe(t)]&&n.rem.push(t),o[r]=e),++a}if(t.rem.length&&(t.visit(t.REM,(function(e){var t=fe(e);s[t]&&(s[t]=-1,n.rem.push(e)),--a})),o=o.filter((function(e){return-1!==s[fe(e)]}))),(t.rem.length||r)&&o.lengthi){for(var c=0,f=o.length-i;c(e[t]=1+n,e),{});function da(e){const t=Object(oe.i)(e).slice(),n={};return t.length||Object(oe.n)("Missing time unit."),t.forEach(e=>{Object(oe.v)(fa,e)?n[e]=1:Object(oe.n)(`Invalid time unit: ${e}.`)}),(n[ia]||n[aa])&&(n[na]||n[ra]||n[oa])&&Object(oe.n)(`Incompatible time units: ${e}`),t.sort((e,t)=>fa[e]-fa[t]),t}const ha=new Date;function pa(e,t,n,r){const i=t||1,o=Object(oe.T)(e),a=(e,t,r)=>function(e,t,n){return t<=1?e:n?(r,i)=>n+t*Math.floor((e(r,i)-n)/t):(n,r)=>t*Math.floor(e(n,r)/t)}(n[r||e],e===o&&i,t),u=new Date,s=Object(oe.cb)(e),l=s[ta]?a(ta):Object(oe.l)(2012),c=s[ra]?a(ra):s[na]?a(na):oe.jb,f=s[ia]&&s[aa]?a(aa,1,ia+aa):s[ia]?a(ia,1):s[aa]?a(aa,1):s[oa]?a(oa,1):oe.N,d=s[ua]?a(ua):oe.jb,h=s[sa]?a(sa):oe.jb,p=s[la]?a(la):oe.jb,m=s[ca]?a(ca):oe.jb;return function(e){u.setTime(+e);const t=l(u);return r(t,c(u),f(u,t),d(u),h(u),p(u),m(u))}}function ma(e,t,n){return t+7*e-(n+6)%7}const ga={[ta]:e=>e.getFullYear(),[na]:e=>3*~~(e.getMonth()/3),[ra]:e=>e.getMonth(),[oa]:e=>e.getDate(),[ua]:e=>e.getHours(),[sa]:e=>e.getMinutes(),[la]:e=>e.getSeconds(),[ca]:e=>e.getMilliseconds(),[aa]:(e,t)=>ma(1,e.getDay(),ba(t)),[ia]:(e,t)=>ma(ya(e),0,ba(t)),[ia+aa]:(e,t)=>ma(ya(e),e.getDay(),ba(t))};function va(e){return ha.setFullYear(e),ha.setMonth(0),ha.setDate(1),ha.setHours(0,0,0,0),ha}function ya(e){return Tt.count(va(e.getFullYear())-1,e)}function ba(e){return va(e).getDay()}function xa(e,t,n,r,i,o,a){if(0<=e&&e<100){var u=new Date(-1,t,n,r,i,o,a);return u.setFullYear(e),u}return new Date(e,t,n,r,i,o,a)}function wa(e,t){return pa(e,t||1,ga,xa)}const _a={[ta]:e=>e.getUTCFullYear(),[na]:e=>3*~~(e.getUTCMonth()/3),[ra]:e=>e.getUTCMonth(),[oa]:e=>e.getUTCDate(),[ua]:e=>e.getUTCHours(),[sa]:e=>e.getUTCMinutes(),[la]:e=>e.getUTCSeconds(),[ca]:e=>e.getUTCMilliseconds(),[aa]:(e,t)=>ma(1,e.getUTCDay(),Oa(t)),[ia]:(e,t)=>ma(Ea(e),0,Oa(t)),[ia+aa]:(e,t)=>ma(Ea(e),e.getUTCDay(),Oa(t))};function Ea(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return wt.count(t-1,e)}function Oa(e){return ha.setTime(Date.UTC(e,0,1)),ha.getUTCDay()}function ka(e,t,n,r,i,o,a){if(0<=e&&e<100){var u=new Date(Date.UTC(-1,t,n,r,i,o,a));return u.setUTCFullYear(n.y),u}return new Date(Date.UTC(e,t,n,r,i,o,a))}function ja(e,t){return pa(e,t||1,_a,ka)}var Sa=bt((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),Ca=Sa,Aa=(Sa.range,bt((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()}))),Na=Aa,Ta=(Aa.range,bt((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()}))),Da=Ta,Ma=(Ta.range,bt((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()}))),Fa=Ma,Pa=(Ma.range,bt((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e})));Pa.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?bt((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):Pa:null};var Ra=Pa,za=(Pa.range,bt((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()}))),La=za,Ia=(za.range,bt((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()}))),$a=Ia,Ba=(Ia.range,bt((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()}))),Ua=Ba;Ba.range;const qa={[ta]:Bt,[na]:Ca.every(3),[ra]:Ca,[ia]:Tt,[oa]:It,[aa]:It,[ua]:Na,[sa]:Da,[la]:Fa,[ca]:Ra},Wa={[ta]:qt,[na]:La.every(3),[ra]:La,[ia]:wt,[oa]:At,[aa]:At,[ua]:$a,[sa]:Ua,[la]:Fa,[ca]:Ra};function Ha(e){return qa[e]}function Ya(e){return Wa[e]}function Va(e,t,n){return e?e.offset(t,n):void 0}function Ga(e,t,n){return Va(Ha(e),t,n)}function Xa(e,t,n){return Va(Ya(e),t,n)}function Ka(e,t,n,r){return e?e.range(t,n,r):void 0}function Ja(e,t,n,r){return Ka(Ha(e),t,n,r)}function Qa(e,t,n,r){return Ka(Ya(e),t,n,r)}const Za={[ta]:"%Y ",[na]:"Q%q ",[ra]:"%b ",[oa]:"%d ",[ia]:"W%U ",[aa]:"%a ",[ua]:"%H:00",[sa]:"00:%M",[la]:":%S",[ca]:".%L",[`${ta}-${ra}`]:"%Y-%m ",[`${ta}-${ra}-${oa}`]:"%Y-%m-%d ",[`${ua}-${sa}`]:"%H:%M"};function eu(e,t){const n=Object(oe.o)({},Za,t),r=da(e),i=r.length;let o,a,u="",s=0;for(s=0;ss;--o)if(a=r.slice(s,o).join("-"),null!=n[a]){u+=n[a],s=o;break}return u.trim()}function tu(e){return ru(Gt,Ha,e)}function nu(e){return ru(Kt,Ya,e)}function ru(e,t,n){return Object(oe.H)(n)?e(n):function(e,t,n){n=n||{},Object(oe.F)(n)||Object(oe.n)(`Invalid time multi-format specifier: ${n}`);const r=t(la),i=t(sa),o=t(ua),a=t(oa),u=t(ia),s=t(ra),l=t(na),c=t(ta),f=e(n[ca]||".%L"),d=e(n[la]||":%S"),h=e(n[sa]||"%I:%M"),p=e(n[ua]||"%I %p"),m=e(n[oa]||n[aa]||"%a %d"),g=e(n[ia]||"%b %d"),v=e(n[ra]||"%B"),y=e(n[na]||"%B"),b=e(n[ta]||"%Y");return function(e){return(r(e)>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)>0?i=o:r=o+1}return r}}};var ou=Math.sqrt(50),au=Math.sqrt(10),uu=Math.sqrt(2),su=function(e,t,n){var r,i,o,a,u=-1;if(n=+n,(e=+e)===(t=+t)&&n>0)return[e];if((r=t0)for(e=Math.ceil(e/a),t=Math.floor(t/a),o=new Array(i=Math.ceil(t-e+1));++u=0?(o>=ou?10:o>=au?5:o>=uu?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ou?10:o>=au?5:o>=uu?2:1)}function cu(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=ou?i*=10:o>=au?i*=5:o>=uu&&(i*=2),te[2]).right(yu,r);return a===yu.length?(i=vu,o=cu(t[0]/31536e6,t[1]/31536e6,n)):a?(a=yu[r/yu[a-1][2]f&&(f=i))})),o.start=c,o.stop=f,t.modifies(r?u:s)},_u._floor=function(e,t){const n="utc"===e.timezone;let{units:r,step:i}=e.units?{units:e.units,step:e.step||1}:bu({extent:Object(oe.p)(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins});r=da(r);const o=this.value||{},a=(n?ja:wa)(r,i);return a.unit=Object(oe.T)(r),a.units=r,a.step=i,a.start=o.start,a.stop=o.stop,this.value=a},Object(oe.y)(Eu,Dr).transform=function(e,t){var n=t.dataflow,r=e.field,i=this.value,o=!0;function a(e){i.set(r(e),e)}return e.modified("field")||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,(function(e){i.delete(r(e))})),t.visit(t.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()},Object(oe.y)(Ou,Dr).transform=function(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(ve(e.sort)):t.source).map(e.field))};const ku={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){let e=ku.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=>{let n=t.index,r=t.data,i=t.compare;if(e0||Object(oe.n)("ntile num must be greater than zero.");let n=ku.cume_dist(),r=n.next;return{init:n.init,next:e=>Math.ceil(t*r(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let r=n.index+t,i=n.data;return re(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||Object(oe.n)("nth_value nth must be greater than zero."),{next:n=>{let r=n.i0+(t-1);return r{let r=e(n.data[n.index]);return null!=r?t=r:t}}},next_value:function(e){let t=null,n=-1;return{next:r=>{let i=r.data;return r.index<=n?t:(n=function(e,t,n){for(let r=t.length;ns[e]=1)}h(e.sort),n.forEach((function(e,t){let n=r[t],s=Object(oe.h)(n),p=Lr(e,s,o[t]);if(h(n),a.push(p),Object(oe.v)(ku,e))u.push(function(e,t,n,r){let i=ku[e](t,n);return{init:i.init||oe.jb,update:function(e,t){t[r]=i.next(e)}}}(e,r[t],i[t],p));else{if(null==n&&"count"!==e&&Object(oe.n)("Null aggregate field specified."),"count"===e)return void f.push(p);c=!1;let t=l[s];t||(t=l[s]=[],t.field=n,d.push(t)),t.push(Br(e,p))}})),(f.length||d.length)&&(t.cell=function(e,t,n){e=e.map(e=>Wr(e,e.field));let r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,o=r.agg=Array(i),a=0;ae.init()),this.cell&&this.cell.init()},Cu.update=function(e,t){let n,r=this.cell,i=this.windows,o=e.data,a=i&&i.length;if(r){for(n=e.p0;n0&&!i(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),rthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},$u.expand=function(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},$u.round=function(){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},$u.translate=function(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},$u.rotate=function(e,t,n){const r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},$u.rotatedPoints=function(e,t,n){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(e),s=Math.sin(e),l=t-t*u+n*s,c=n-t*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*a+l,s*r+u*a+c,u*o-s*i+l,s*o+u*i+c,u*o-s*a+l,s*o+u*a+c]},$u.union=function(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},$u.intersect=function(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},$u.alignsWith=function(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},$u.intersects=function(e){return e&&!(this.x2e.x2||this.y2e.y2)},$u.contains=function(e,t){return!(ethis.x2||tthis.y2)},$u.width=function(){return this.x2-this.x1},$u.height=function(){return this.y2-this.y1};var Bu=0;function Uu(e){return e&&e.gradient}function qu(e,t,n){let r=e.id,i=e.gradient,o="radial"===i?"p_":"";return r||(r=e.id="gradient_"+Bu++,"radial"===i?(e.x1=Wu(e.x1,.5),e.y1=Wu(e.y1,.5),e.r1=Wu(e.r1,0),e.x2=Wu(e.x2,.5),e.y2=Wu(e.y2,.5),e.r2=Wu(e.r2,.5),o="p_"):(e.x1=Wu(e.x1,0),e.y1=Wu(e.y1,0),e.x2=Wu(e.x2,1),e.y2=Wu(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Wu(e,t){return null!=e?e:t}var Hu=function(e,t){var n,r=[];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:r,stop:function(e,t){return r.push({offset:e,color:t}),n}}};function Yu(e){this.mark=e,this.bounds=this.bounds||new Iu}function Vu(e){Yu.call(this,e),this.items=this.items||[]}function Gu(e,t){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}function Xu(){return"undefined"!=typeof Image?Image:null}function Ku(e){this._pending=0,this._loader=e||dr()}Object(oe.y)(Vu,Yu);var Ju=Ku.prototype;function Qu(e){e._pending+=1}function Zu(e){e._pending-=1}function es(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function ts(e){this._context=e}Ju.pending=function(){return this._pending},Ju.sanitizeURL=function(e){var t=this;return Qu(t),t._loader.sanitize(e,{context:"href"}).then((function(e){return Zu(t),e})).catch((function(){return Zu(t),null}))},Ju.loadImage=function(e){var t=this,n=Xu();return Qu(t),t._loader.sanitize(e,{context:"image"}).then((function(e){var r=e.href;if(!r||!n)throw{url:r};var i=new n;return i.onload=function(){Zu(t)},i.onerror=function(){Zu(t)},i.src=r,i})).catch((function(e){return Zu(t),{complete:!1,width:0,height:0,src:e&&e.url||""}}))},Ju.ready=function(){var e=this;return new Promise((function(t){!function n(r){e.pending()?setTimeout((function(){n(!0)}),10):t(r)}(!1)}))},ts.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:es(this,this._x1,this._y1);case 2:this._context.lineTo(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;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:es(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var ns=function(){};function rs(e){this._context=e}rs.prototype={areaStart:ns,areaEnd:ns,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:es(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function is(e){this._context=e}is.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=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;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:es(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function os(e,t){this._basis=new ts(e),this._beta=t}os.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r,i=e[0],o=t[0],a=e[n]-i,u=t[n]-o,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(i+r*a),this._beta*t[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var as=function e(t){function n(e){return 1===t?new ts(e):new os(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function us(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 ss(e,t){this._context=e,this._k=(1-t)/6}ss.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:us(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:us(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}};var ls=function e(t){function n(e){return new ss(e,t)}return n.tension=function(t){return e(+t)},n}(0);function cs(e,t){this._context=e,this._k=(1-t)/6}cs.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:us(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}};var fs=function e(t){function n(e){return new cs(e,t)}return n.tension=function(t){return e(+t)},n}(0);function ds(e,t){this._context=e,this._k=(1-t)/6}ds.prototype={areaStart:ns,areaEnd:ns,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:us(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}};var hs=function e(t){function n(e){return new ds(e,t)}return n.tension=function(t){return e(+t)},n}(0),ps=Math.abs,ms=Math.atan2,gs=Math.cos,vs=Math.max,ys=Math.min,bs=Math.sin,xs=Math.sqrt,ws=Math.PI,_s=ws/2,Es=2*ws;function Os(e){return e>1?0:e<-1?ws:Math.acos(e)}function ks(e){return e>=1?_s:e<=-1?-_s:Math.asin(e)}function js(e,t,n){var r=e._x1,i=e._y1,o=e._x2,a=e._y2;if(e._l01_a>1e-12){var u=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,s=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*u-e._x0*e._l12_2a+e._x2*e._l01_2a)/s,i=(i*u-e._y0*e._l12_2a+e._y2*e._l01_2a)/s}if(e._l23_a>1e-12){var l=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*l+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*l+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(r,i,o,a,e._x2,e._y2)}function Ss(e,t){this._context=e,this._alpha=t}Ss.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,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:js(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}};var Cs=function e(t){function n(e){return t?new Ss(e,t):new ss(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function As(e,t){this._context=e,this._alpha=t}As.prototype={areaStart:ns,areaEnd:ns,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,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:js(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}};var Ns=function e(t){function n(e){return t?new As(e,t):new ds(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ts(e,t){this._context=e,this._alpha=t}Ts.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,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:js(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}};var Ds=function e(t){function n(e){return t?new Ts(e,t):new cs(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ms(e){this._context=e}Ms.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(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;default:this._context.lineTo(e,t)}}};var Fs=function(e){return new Ms(e)};function Ps(e){this._context=e}Ps.prototype={areaStart:ns,areaEnd:ns,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Rs(e){return e<0?-1:1}function zs(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),a=(n-e._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(Rs(o)+Rs(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function Ls(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Is(e,t,n){var r=e._x0,i=e._y0,o=e._x1,a=e._y1,u=(o-r)/3;e._context.bezierCurveTo(r+u,i+u*t,o-u,a-u*n,o,a)}function $s(e){this._context=e}function Bs(e){this._context=new Us(e)}function Us(e){this._context=e}function qs(e){this._context=e}function Ws(e){var t,n,r=e.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(a[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-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}};var Ys={basis:{curve:function(e){return new ts(e)}},"basis-closed":{curve:function(e){return new rs(e)}},"basis-open":{curve:function(e){return new is(e)}},bundle:{curve:as,tension:"beta",value:.85},cardinal:{curve:ls,tension:"tension",value:0},"cardinal-open":{curve:fs,tension:"tension",value:0},"cardinal-closed":{curve:hs,tension:"tension",value:0},"catmull-rom":{curve:Cs,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ns,tension:"alpha",value:.5},"catmull-rom-open":{curve:Ds,tension:"alpha",value:.5},linear:{curve:Fs},"linear-closed":{curve:function(e){return new Ps(e)}},monotone:{horizontal:function(e){return new Bs(e)},vertical:function(e){return new $s(e)}},natural:{curve:function(e){return new qs(e)}},step:{curve:function(e){return new Hs(e,.5)}},"step-after":{curve:function(e){return new Hs(e,1)}},"step-before":{curve:function(e){return new Hs(e,0)}}};function Vs(e,t,n){var r=Object(oe.v)(Ys,e)&&Ys[e],i=null;return r&&(i=r.curve||r[t||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var Gs={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},Xs=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/],Ks=function(e){var t,n,r,i,o,a,u,s,l,c,f,d=[];for(s=0,c=(t=e.slice().replace(Xs[0],"###$1").split(Xs[1]).slice(1)).length;su)for(l=1,f=i.length;l1&&(n*=m=Math.sqrt(m),r*=m);var g=d/n,v=f/n,y=-f/r,b=d/r,x=g*u+v*s,w=y*u+b*s,_=g*e+v*t,E=y*e+b*t,O=(_-x)*(_-x)+(E-w)*(E-w),k=1/O-.25;k<0&&(k=0);var j=Math.sqrt(k);o==i&&(j=-j);var S=.5*(x+_)-j*(E-w),C=.5*(w+E)+j*(_-x),A=Math.atan2(w-C,x-S),N=Math.atan2(E-C,_-S),T=N-A;T<0&&1===o?T+=Zs:T>0&&0===o&&(T-=Zs);for(var D=Math.ceil(Math.abs(T/(Qs+.001))),M=[],F=0;F1e-6)if(Math.abs(c*u-s*l)>1e-6&&i){var d=n-o,h=r-a,p=u*u+s*s,m=d*d+h*h,g=Math.sqrt(p),v=Math.sqrt(f),y=i*Math.tan((dl-Math.acos((p+f-m)/(2*g*v)))/2),b=y/v,x=y/g;Math.abs(b-1)>1e-6&&(this._+="L"+(e+b*l)+","+(t+b*c)),this._+="A"+i+","+i+",0,0,"+ +(c*d>l*h)+","+(this._x1=e+x*u)+","+(this._y1=t+x*s)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,r,i,o){e=+e,t=+t,o=!!o;var a=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=e+a,l=t+u,c=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%hl+hl),f>pl?this._+="A"+n+","+n+",0,1,"+c+","+(e-a)+","+(t-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=dl)+","+c+","+(this._x1=e+n*Math.cos(i))+","+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var vl=gl;const yl=.448084975506;function bl(e){return e.x}function xl(e){return e.y}function wl(e){return e.width}function _l(e){return e.height}function El(e){return"function"==typeof e?e:()=>+e}function Ol(e,t,n){return Math.max(t,Math.min(e,n))}var kl=function(){var e=bl,t=xl,n=wl,r=_l,i=El(0),o=i,a=i,u=i,s=null;function l(l,c,f){var d,h=null!=c?c:+e.call(this,l),p=null!=f?f:+t.call(this,l),m=+n.call(this,l),g=+r.call(this,l),v=Math.min(m,g)/2,y=Ol(+i.call(this,l),0,v),b=Ol(+o.call(this,l),0,v),x=Ol(+a.call(this,l),0,v),w=Ol(+u.call(this,l),0,v);if(s||(s=d=vl()),y<=0&&b<=0&&x<=0&&w<=0)s.rect(h,p,m,g);else{var _=h+m,E=p+g;s.moveTo(h+y,p),s.lineTo(_-b,p),s.bezierCurveTo(_-yl*b,p,_,p+yl*b,_,p+b),s.lineTo(_,E-w),s.bezierCurveTo(_,E-yl*w,_-yl*w,E,_-w,E),s.lineTo(h+x,E),s.bezierCurveTo(h+yl*x,E,h,E-yl*x,h,E-x),s.lineTo(h,p+y),s.bezierCurveTo(h,p+yl*y,h+yl*y,p,h+y,p),s.closePath()}if(d)return s=null,d+""||null}return l.x=function(t){return arguments.length?(e=El(t),l):e},l.y=function(e){return arguments.length?(t=El(e),l):t},l.width=function(e){return arguments.length?(n=El(e),l):n},l.height=function(e){return arguments.length?(r=El(e),l):r},l.cornerRadius=function(e,t,n,r){return arguments.length?(i=El(e),o=null!=t?El(t):i,u=null!=n?El(n):i,a=null!=r?El(r):o,l):i},l.context=function(e){return arguments.length?(s=null==e?null:e,l):s},l},jl=function(){var e,t,n,r,i,o,a,u,s=null;function l(e,t,n){var r=n/2;if(i){var l=a-t,c=e-o;if(l||c){var f=Math.sqrt(l*l+c*c),d=(l/=f)*u,h=(c/=f)*u,p=Math.atan2(c,l);s.moveTo(o-d,a-h),s.lineTo(e-l*r,t-c*r),s.arc(e,t,r,p-Math.PI,p),s.lineTo(o+d,a+h),s.arc(o,a,u,p,p+Math.PI)}else s.arc(e,t,r,0,Zs);s.closePath()}else i=1;o=e,a=t,u=r}function c(o){var a,u,c,f=o.length,d=!1;for(null==s&&(s=c=vl()),a=0;a<=f;++a)!(aN*N+T*T&&(O=j,k=S),{cx:O,cy:k,x01:-c,y01:-f,x11:O*(i/w-1),y11:k*(i/w-1)}}function Pl(e){return e[0]}function Rl(e){return e[1]}var zl=function(){var e=Pl,t=Rl,n=Sl(!0),r=null,i=Fs,o=null;function a(a){var u,s,l,c=a.length,f=!1;for(null==r&&(o=i(l=vl())),u=0;u<=c;++u)!(u=c;--f)u.point(g[f],v[f]);u.lineEnd(),u.areaEnd()}m&&(g[l]=+e(d,l,s),v[l]=+n(d,l,s),u.point(t?+t(d,l,s):g[l],r?+r(d,l,s):v[l]))}if(h)return u=null,h+""||null}function l(){return zl().defined(i).curve(a).context(o)}return s.x=function(n){return arguments.length?(e="function"==typeof n?n:Sl(+n),t=null,s):e},s.x0=function(t){return arguments.length?(e="function"==typeof t?t:Sl(+t),s):e},s.x1=function(e){return arguments.length?(t=null==e?null:"function"==typeof e?e:Sl(+e),s):t},s.y=function(e){return arguments.length?(n="function"==typeof e?e:Sl(+e),r=null,s):n},s.y0=function(e){return arguments.length?(n="function"==typeof e?e:Sl(+e),s):n},s.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:Sl(+e),s):r},s.lineX0=s.lineY0=function(){return l().x(e).y(n)},s.lineY1=function(){return l().x(e).y(r)},s.lineX1=function(){return l().x(t).y(n)},s.defined=function(e){return arguments.length?(i="function"==typeof e?e:Sl(!!e),s):i},s.curve=function(e){return arguments.length?(a=e,null!=o&&(u=a(o)),s):a},s.context=function(e){return arguments.length?(null==e?o=u=null:u=a(o=e),s):o},s},Il={draw:function(e,t){var n=Math.sqrt(t/ws);e.moveTo(n,0),e.arc(0,0,n,0,Es)}},$l=(Math.sqrt(1/3),Math.sin(ws/10)/Math.sin(7*ws/10));Math.sin(Es/10),Math.cos(Es/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12);function Bl(e,t){return null!=e?e:t}const Ul=e=>e.x||0,ql=e=>e.y||0,Wl=e=>!(!1===e.defined),Hl=function(){var e=Cl,t=Al,n=Sl(0),r=null,i=Nl,o=Tl,a=Dl,u=null;function s(){var s,l,c=+e.apply(this,arguments),f=+t.apply(this,arguments),d=i.apply(this,arguments)-_s,h=o.apply(this,arguments)-_s,p=ps(h-d),m=h>d;if(u||(u=s=vl()),f1e-12)if(p>Es-1e-12)u.moveTo(f*gs(d),f*bs(d)),u.arc(0,0,f,d,h,!m),c>1e-12&&(u.moveTo(c*gs(h),c*bs(h)),u.arc(0,0,c,h,d,m));else{var g,v,y=d,b=h,x=d,w=h,_=p,E=p,O=a.apply(this,arguments)/2,k=O>1e-12&&(r?+r.apply(this,arguments):xs(c*c+f*f)),j=ys(ps(f-c)/2,+n.apply(this,arguments)),S=j,C=j;if(k>1e-12){var A=ks(k/c*bs(O)),N=ks(k/f*bs(O));(_-=2*A)>1e-12?(x+=A*=m?1:-1,w-=A):(_=0,x=w=(d+h)/2),(E-=2*N)>1e-12?(y+=N*=m?1:-1,b-=N):(E=0,y=b=(d+h)/2)}var T=f*gs(y),D=f*bs(y),M=c*gs(w),F=c*bs(w);if(j>1e-12){var P,R=f*gs(b),z=f*bs(b),L=c*gs(x),I=c*bs(x);if(p1e-12?C>1e-12?(g=Fl(L,I,T,D,f,C,m),v=Fl(R,z,M,F,f,C,m),u.moveTo(g.cx+g.x01,g.cy+g.y01),C1e-12&&_>1e-12?S>1e-12?(g=Fl(M,F,R,z,c,-S,m),v=Fl(T,D,L,I,c,-S,m),u.lineTo(g.cx+g.x01,g.cy+g.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),Yl=Ll().x(Ul).y1(ql).y0(e=>(e.y||0)+(e.height||0)).defined(Wl),Vl=Ll().y(ql).x1(Ul).x0(e=>(e.x||0)+(e.width||0)).defined(Wl),Gl=zl().x(Ul).y(ql).defined(Wl),Xl=kl().x(Ul).y(ql).width(e=>e.width||0).height(e=>e.height||0).cornerRadius(e=>Bl(e.cornerRadiusTopLeft,e.cornerRadius)||0,e=>Bl(e.cornerRadiusTopRight,e.cornerRadius)||0,e=>Bl(e.cornerRadiusBottomRight,e.cornerRadius)||0,e=>Bl(e.cornerRadiusBottomLeft,e.cornerRadius)||0),Kl=function(){var e=Sl(Il),t=Sl(64),n=null;function r(){var r;if(n||(n=r=vl()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(t){return arguments.length?(e="function"==typeof t?t:Sl(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:Sl(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type(e=>cl(e.shape||"circle")).size(e=>Bl(e.size,64)),Jl=jl().x(Ul).y(ql).defined(Wl).size(e=>e.size||1);function Ql(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Zl(e,t,n,r){return Xl.context(e)(t,n,r)}var ec=function(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const r=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(r+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,r):0))}return e};var tc,nc,rc,ic=Zs-1e-8;function oc(e){return tc=e,oc}function ac(){}function uc(e,t){tc.add(e,t)}function sc(e,t){uc(nc=e,rc=t)}function lc(e){uc(e,tc.y1)}function cc(e){uc(tc.x1,e)}function fc(e,t,n,r){const i=(e-t)/(e+n-2*t);01e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),l=(-a+s)/o,c=(-a-s)/o)):l=.5*u/a,0ic)uc(e-n,t-n),uc(e+n,t+n);else{const a=r=>uc(n*Math.cos(r)+e,n*Math.sin(r)+t);let u,s;if(a(r),a(i),i!==r)if((r%=Zs)<0&&(r+=Zs),(i%=Zs)<0&&(i+=Zs),ii;++s,u-=Qs)a(u);else for(u=r-r%Qs+Qs,s=0;s<4&&ug)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(e.globalAlpha=n,e.fillStyle=_c(e,t,t.fill),!0)},Oc=[],kc=function(e,t,n){var r=null!=(r=t.strokeWidth)?r:1;return!(r<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=_c(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Oc),e.lineDashOffset=t.strokeDashOffset||0),!0))};function jc(e,t){return e.zindex-t.zindex||e.index-t.index}function Sc(e){if(!e.zdirty)return e.zitems;var t,n,r,i=e.items,o=[];for(n=0,r=i.length;n=0;)if(n=t(i[r]))return n;if(i===o)for(r=(i=e.items).length;--r>=0;)if(!i[r].zindex&&(n=t(i[r])))return n;return null}function Nc(e){return function(t,n,r){Cc(n,(function(n){r&&!r.intersects(n.bounds)||Tc(e,t,n,n)}))}}function Tc(e,t,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(e(t,r)||(n.fill&&Ec(t,n,i)&&t.fill(),n.stroke&&kc(t,n,i)&&t.stroke()))}function Dc(e){return e=e||oe.fb,function(t,n,r,i,o,a){return r*=t.pixelRatio,i*=t.pixelRatio,Ac(n,(function(n){var u=n.bounds;if((!u||u.contains(o,a))&&u)return e(t,n,r,i,o,a)?n:void 0}))}}function Mc(e,t){return function(n,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,l=null==t?s.fill:t,c=s.stroke&&n.isPointInStroke;return c&&(a=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=u?u:"butt"),!e(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function Fc(e){return Dc(Mc(e))}function Pc(e,t){return"translate("+e+","+t+")"}function Rc(e){return"rotate("+e+")"}function zc(e){return Pc(e.x||0,e.y||0)}function Lc(e){return Pc(e.x||0,e.y||0)+(e.angle?" "+Rc(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}var Ic=function(e,t,n){function r(e,n){var r=n.x||0,i=n.y||0,o=n.angle||0;e.translate(r,i),o&&e.rotate(o*=Js),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-r,-i)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",Lc(n)),e("d",t(null,n))},bound:function(e,n){var r=n.x||0,i=n.y||0;return t(oc(e),n),ec(e,n).translate(r,i),n.angle&&e.rotate(n.angle*Js,r,i),e},draw:Nc(r),pick:Fc(r),isect:n||gc(r)}},$c=Ic("arc",(function(e,t){return Hl.context(e)(t)}));var Bc=function(e,t,n){function r(e,n){e.beginPath(),t(e,n)}var i,o=Mc(r);return{type:e,tag:"path",nested:!0,attr:function(e,n){var r=n.mark.items;r.length&&e("d",t(null,r))},bound:function(e,n){var r=n.items;return 0===r.length?e:(t(oc(e),r),ec(e,r[0]))},draw:(i=r,function(e,t,n){!t.items.length||n&&!n.intersects(t.bounds)||Tc(i,e,t.items[0],t.items)}),pick:function(e,t,n,r,i,a){var u=t.items,s=t.bounds;return!u||!u.length||s&&!s.contains(i,a)?null:(n*=e.pixelRatio,r*=e.pixelRatio,o(e,u,n,r)?u[0]:null)},isect:vc,tip:n}},Uc=Bc("area",(function(e,t){var n=t[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Vl:Yl).curve(Vs(r,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,r,i="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,u=1/0;--a>=0;)!1!==e[a].defined&&(r=Math.abs(e[a][o]-i)).5&&t<1.5?.5-Math.abs(t-1):0}function Gc(e,t){var n=Vc(t);e("d",Zl(null,t,n,n))}function Xc(e,t,n,r){var i=Vc(t);e.beginPath(),Zl(e,t,(n||0)+i,(r||0)+i)}var Kc=Mc(Xc),Jc=Mc(Xc,!1);var Qc={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",zc(t))},bound:function(e,t){if(!t.clip&&t.items)for(var n=t.items,r=0,i=n.length;rm||og)))return e.save(),e.translate(h,p),h=i-h,p=o-p,y&&Ql(l)&&!Kc(e,l,u,s)?(e.restore(),null):(f=l.strokeForeground,(d=!1!==t.interactive)&&f&&l.stroke&&Jc(e,l,u,s)?(e.restore(),l):(!(c=Ac(l,(function(e){return function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,h,p)?a.pick(e,n,r,h,p):null})))&&d&&(l.fill||!f&&l.stroke)&&Kc(e,l,u,s)&&(c=l),e.restore(),c||null))}))},isect:yc,content:function(e,t,n){e("clip-path",t.clip?Yc(n,t,t):null)},background:function(e,t){e("class","background"),Gc(e,t)},foreground:function(e,t){e("class","foreground"),t.strokeForeground?Gc(e,t):e("d","")}};function Zc(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 ef(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 tf(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 nf(e,t){return"center"===e?t/2:"right"===e?t:0}function rf(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var of={type:"image",tag:"image",nested:!1,attr:function(e,t,n){var r=Zc(t,n),i=t.x||0,o=t.y||0,a=ef(t,r),u=tf(t,r),s=!1===t.aspect?"none":"xMidYMid";i-=nf(t.align,a),o-=rf(t.baseline,u),!r.src&&r.toDataURL?e("href",r.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):e("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),e("transform",Pc(i,o)),e("width",a),e("height",u),e("preserveAspectRatio",s)},bound:function(e,t){var n=t.image,r=t.x||0,i=t.y||0,o=ef(t,n),a=tf(t,n);return r-=nf(t.align,o),i-=rf(t.baseline,a),e.set(r,i,r+o,i+a)},draw:function(e,t,n){var r=this;Cc(t,(function(t){if(!n||n.intersects(t.bounds)){var i,o,a,u,s=Zc(t,r),l=t.x||0,c=t.y||0,f=ef(t,s),d=tf(t,s);l-=nf(t.align,f),c-=rf(t.baseline,d),!1!==t.aspect&&(o=s.width/s.height,a=t.width/t.height,o==o&&a==a&&o!==a&&(a=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(r=e[o].y-t[1])*r1?t:t[0]:t;var t}function kf(e){const t=Of(e);return(Object(oe.A)(t)?t.length-1:0)*Ef(e)}function jf(e,t){return null==t?"":e.limit>0?function(e,t){var n,r=+e.limit,i=t+"";gf.width===bf?(pc.font=Cf(e),n=xf):(df=wf(e),n=yf);if(n(i)>>1,n(i.slice(o))>r?s=o+1:l=o;return a+i.slice(s)}for(;s>>1),n(i.slice(0,o))Math.max(e,gf.width(t,n)),0)):r=gf.width(t,f),"center"===o?l-=r/2:"right"===o&&(l-=r),e.set(l+=u,c+=s,l+r,c+i),t.angle&&!n)e.rotate(t.angle*Js,u,s);else if(2===n)return e.rotatedPoints(t.angle*Js,u,s);return e}var Ff={arc:$c,area:Uc,group:Qc,image:of,line:af,path:sf,rect:cf,rule:hf,shape:pf,symbol:mf,text:{type:"text",tag:"text",nested:!1,attr:function(e,t){var n,r=t.dx||0,i=(t.dy||0)+Af(t),o=Df(t),a=o.x1,u=o.y1,s=t.angle||0;e("text-anchor",Nf[t.align]||"start"),s?(n=Pc(a,u)+" "+Rc(s),(r||i)&&(n+=" "+Pc(r,i))):n=Pc(a+r,u+i),e("transform",n)},bound:Mf,draw:function(e,t,n){Cc(t,(function(t){var r,i,o,a,u,s,l,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=Cf(t),e.textAlign=t.align||"left",i=(r=Df(t)).x1,o=r.y1,t.angle&&(e.save(),e.translate(i,o),e.rotate(t.angle*Js),i=o=0),i+=t.dx||0,o+=(t.dy||0)+Af(t),s=Of(t),Object(oe.A)(s))for(u=Ef(t),a=0;a=0;)if(!1!==e[i].defined&&(n=e[i].x-t[0])*n+(r=e[i].y-t[1])*r<(n=e[i].size||1)*n)return e[i];return null}))},Pf=function(e,t,n){var r=Ff[e.mark.marktype],i=t||r.bound;return r.nested&&(e=e.mark),i(e.bounds||(e.bounds=new Iu),e,n)},Rf={mark:null},zf=function(e,t,n){var r,i,o,a,u=Ff[e.marktype],s=u.bound,l=e.items,c=l&&l.length;if(u.nested)return c?o=l[0]:(Rf.mark=e,o=Rf),a=Pf(o,s,n),t=t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Iu,c)for(r=0,i=l.length;rt;)e.removeChild(n[--r]);return e}function Gf(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}Uf.toJSON=function(e){return If(this.root,e||0)},Uf.mark=function(e,t,n){var r=qf(e,t=t||this.root.items[0]);return t.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};var Xf=function(e,t){var n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]};function Kf(e,t){this._active=null,this._handlers={},this._loader=e||dr(),this._tooltip=t||Jf}function Jf(e,t,n,r){e.element().setAttribute("title",r||"")}var Qf=Kf.prototype;function Zf(e){this._el=null,this._bgcolor=null,this._loader=new Ku(e)}Qf.initialize=function(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},Qf.element=function(){return this._el},Qf.canvas=function(){return this._el&&this._el.firstChild},Qf.origin=function(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},Qf.scene=function(e){return arguments.length?(this._scene=e,this):this._scene},Qf.on=function(){},Qf.off=function(){},Qf._handlerIndex=function(e,t,n){for(var r=e?e.length:0;--r>=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1},Qf.handlers=function(e){var t,n=this._handlers,r=[];if(e)r.push.apply(r,n[this.eventName(e)]);else for(t in n)r.push.apply(r,n[t]);return r},Qf.eventName=function(e){var t=e.indexOf(".");return t<0?e:e.slice(0,t)},Qf.handleHref=function(e,t,n){this._loader.sanitize(n,{context:"href"}).then((function(t){var n=new MouseEvent(e.type,e),r=Wf(null,"a");for(var i in t)r.setAttribute(i,t[i]);r.dispatchEvent(n)})).catch((function(){}))},Qf.handleTooltip=function(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,r){var i,o,a=e&&e.mark;if(a&&(i=Ff[a.marktype]).tip){for((o=Xf(t,n))[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=i.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);var r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}},Qf.getItemBoundingClientRect=function(e){if(t=this.canvas()){for(var t,n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,o=i.x1+r[0]+n.left,a=i.y1+r[1]+n.top,u=i.width(),s=i.height();e.mark&&(e=e.mark.group);)o+=e.x||0,a+=e.y||0;return{x:o,y:a,width:u,height:s,left:o,top:a,right:o+u,bottom:a+s}}};var ed=Zf.prototype;ed.initialize=function(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)},ed.element=function(){return this._el},ed.canvas=function(){return this._el&&this._el.firstChild},ed.background=function(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},ed.resize=function(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this},ed.dirty=function(){},ed.render=function(e){var t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},ed._render=function(){},ed.renderAsync=function(e){var t=this.render(e);return this._ready?this._ready.then((function(){return t})):Promise.resolve(t)},ed._load=function(e,t){var n=this,r=n._loader[e](t);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(e){e&&i(),n._ready=null}))}return r},ed.sanitizeURL=function(e){return this._load("sanitizeURL",e)},ed.loadImage=function(e){return this._load("loadImage",e)};function td(e,t){Kf.call(this,e,t),this._down=null,this._touch=null,this._first=!0}var nd=Object(oe.y)(td,Kf);function rd(e,t,n){return function(r){var i=this._active,o=this.pickEvent(r);o===i?this.fire(e,r):(i&&i.exit||this.fire(n,r),this._active=o,this.fire(t,r),this.fire(e,r))}}function id(e){return function(t){this.fire(e,t),this._active=null}}nd.initialize=function(e,t,n){var r=this._canvas=e&&Hf(e,"canvas");if(r){var i=this;this.events.forEach((function(e){r.addEventListener(e,(function(t){nd[e]?nd[e].call(i,t):i.fire(e,t)}))}))}return Kf.prototype.initialize.call(this,e,t,n)},nd.canvas=function(){return this._canvas},nd.context=function(){return this._canvas.getContext("2d")},nd.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],nd.DOMMouseScroll=function(e){this.fire("mousewheel",e)},nd.mousemove=rd("mousemove","mouseover","mouseout"),nd.dragover=rd("dragover","dragenter","dragleave"),nd.mouseout=id("mouseout"),nd.dragleave=id("dragleave"),nd.mousedown=function(e){this._down=this._active,this.fire("mousedown",e)},nd.click=function(e){this._down===this._active&&(this.fire("click",e),this._down=null)},nd.touchstart=function(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",e,!0)},nd.touchmove=function(e){this.fire("touchmove",e,!0)},nd.touchend=function(e){this.fire("touchend",e,!0),this._touch=null},nd.fire=function(e,t,n){var r,i,o=n?this._touch:this._active,a=this._handlers[e];if(t.vegaType=e,"click"===e&&o&&o.href?this.handleHref(t,o,o.href):"mousemove"!==e&&"mouseout"!==e||this.handleTooltip(t,o,"mouseout"!==e),a)for(r=0,i=a.length;r=0&&r.splice(i,1),this},nd.pickEvent=function(e){var t=Xf(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},nd.pick=function(e,t,n,r,i){var o=this.context();return Ff[e.marktype].pick.call(this,o,e,t,n,r,i)};var od="undefined"!=typeof window&&window.devicePixelRatio||1;function ad(e){Zf.call(this,e),this._redraw=!1,this._dirty=new Iu}var ud=Object(oe.y)(ad,Zf),sd=Zf.prototype,ld=new Iu;function cd(e,t,n){return ld.set(0,0,t,n).translate(-e[0],-e[1])}function fd(e,t){Kf.call(this,e,t);var n=this;n._hrefHandler=hd(n,(function(e,t){t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=hd(n,(function(e,t){n.handleTooltip(e,t,"mouseout"!==e.type)}))}ud.initialize=function(e,t,n,r,i,o){return this._options=o,this._canvas=Gu(1,1,o&&o.type),e&&(Vf(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),sd.initialize.call(this,e,t,n,r,i)},ud.resize=function(e,t,n,r){return sd.resize.call(this,e,t,n,r),function(e,t,n,r,i,o){var a,u="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=u?od:i;for(a in e.width=t*l,e.height=n*l,o)s[a]=o[a];u&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*r[0],l*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},ud.canvas=function(){return this._canvas},ud.context=function(){return this._canvas?this._canvas.getContext("2d"):null},ud.dirty=function(e){var t=function(e,t){if(null==t)return e;for(var n=ld.clear().union(e);null!=t;t=t.mark.group)n.translate(t.x||0,t.y||0);return n}(e.bounds,e.mark.group);this._dirty.union(t)},ud._render=function(e){var t=this.context(),n=this._origin,r=this._width,i=this._height,o=this._dirty;return t.save(),this._redraw||o.empty()?(this._redraw=!1,o=cd(n,r,i).expand(1)):o=function(e,t,n){return t.expand(1).round(),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,o.intersect(cd(n,r,i)),n),this.clear(-n[0],-n[1],r,i),this.draw(t,e,o),t.restore(),this._dirty.clear(),this},ud.draw=function(e,t,n){var r=Ff[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Object(oe.D)(n)?(e.beginPath(),n(e),e.clip()):qc(e,t.group)}(e,t),r.draw.call(this,e,t,n),t.clip&&e.restore()},ud.clear=function(e,t,n,r){var i=this.context();i.clearRect(e,t,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(e,t,n,r))};var dd=Object(oe.y)(fd,Kf);function hd(e,t){return function(n){var r=n.target.__data__;n.vegaType=n.type,r=Array.isArray(r)?r[0]:r,t.call(e._obj,n,r)}}function pd(e,t,n){var r,i,o="<"+e;if(t)for(r in t)null!=(i=t[r])&&(o+=" "+r+'="'+i+'"');return n&&(o+=" "+n),o+">"}function md(e){return""}dd.initialize=function(e,t,n){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener("mouseout",this._tooltipHandler)),this._svg=r=e&&Hf(e,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener("mouseout",this._tooltipHandler)),Kf.prototype.initialize.call(this,e,t,n)},dd.canvas=function(){return this._svg},dd.on=function(e,t){var n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){var i={type:e,handler:t,listener:hd(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},dd.off=function(e,t){var n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var gd={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},vd={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},yd=Object.keys(vd),bd=gd.xmlns;function xd(e){Zf.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var wd=Object(oe.y)(xd,Zf),_d=Zf.prototype;function Ed(e,t,n){var r,i,o;if("radial"===t.gradient){var a=Yf(e,n++,"pattern",bd);a.setAttribute("id","p_"+t.id),a.setAttribute("viewBox","0,0,1,1"),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("preserveAspectRatio","xMidYMid slice"),(a=Yf(a,0,"rect",bd)).setAttribute("width","1"),a.setAttribute("height","1"),a.setAttribute("fill","url("+Dd()+"#"+t.id+")"),(e=Yf(e,n++,"radialGradient",bd)).setAttribute("id",t.id),e.setAttribute("fx",t.x1),e.setAttribute("fy",t.y1),e.setAttribute("fr",t.r1),e.setAttribute("cx",t.x2),e.setAttribute("cy",t.y2),e.setAttribute("r",t.r2)}else(e=Yf(e,n++,"linearGradient",bd)).setAttribute("id",t.id),e.setAttribute("x1",t.x1),e.setAttribute("x2",t.x2),e.setAttribute("y1",t.y1),e.setAttribute("y2",t.y2);for(r=0,i=t.stops.length;r1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}wd.initialize=function(e,t,n,r){return e&&(this._svg=Yf(e,0,"svg",bd),this._svg.setAttribute("class","marks"),Vf(e,1),this._root=Yf(this._svg,0,"g",bd),Vf(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),_d.initialize.call(this,e,t,n,r)},wd.background=function(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),_d.background.apply(this,arguments)},wd.resize=function(e,t,n,r){return _d.resize.call(this,e,t,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},wd.canvas=function(){return this._svg},wd.svg=function(){if(!this._svg)return null;var e={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var t in gd)e[t]=gd[t];var n=this._bgcolor?pd("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+md("rect"):"";return pd("svg",e)+n+this._svg.innerHTML+md("svg")},wd._render=function(e){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,e),Vf(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},wd.updateDefs=function(){var e,t=this._svg,n=this._defs,r=n.el,i=0;for(e in n.gradient)r||(n.el=r=Yf(t,0,"defs",bd)),i=Ed(r,n.gradient[e],i);for(e in n.clipping)r||(n.el=r=Yf(t,0,"defs",bd)),i=Od(r,n.clipping[e],i);r&&(0===i?(t.removeChild(r),n.el=null):Vf(r,i))},wd._resetDefs=function(){var e=this._defs;e.gradient={},e.clipping={}},wd.dirty=function(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},wd.isDirty=function(e){return this._dirtyAll||!e._svg||e.dirty===this._dirtyID},wd._dirtyCheck=function(){this._dirtyAll=!0;var e=this._dirty;if(!e.length||!this._dirtyID)return!0;var t,n,r,i,o,a,u,s=++this._dirtyID;for(o=0,a=e.length;ojf(n,e))).join("\n"))!==Cd.text&&(Vf(t,0),o=t.ownerDocument,a=Ef(n),i.forEach((e,r)=>{const i=Wf(o,"tspan",bd);i.__data__=n,i.textContent=e,r&&(i.setAttribute("x",0),i.setAttribute("dy",a)),t.appendChild(i)}),Cd.text=r):(i=jf(n,u))!==Cd.text&&(t.textContent=i,Cd.text=i),Nd(t,"font-family",Sf(n)),Nd(t,"font-size",wf(n)+"px"),Nd(t,"font-style",n.fontStyle),Nd(t,"font-variant",n.fontVariant),Nd(t,"font-weight",n.fontWeight)}};function Nd(e,t,n){n!==Cd[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Cd[t]=n)}function Td(e,t,n){t!==Cd[e]&&(null!=t?n?Sd.setAttributeNS(n,e,t):Sd.setAttribute(e,t):n?Sd.removeAttributeNS(n,e):Sd.removeAttribute(e),Cd[e]=t)}function Dd(){var e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function Md(e){Zf.call(this,e),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}wd._update=function(e,t,n){Sd=t,Cd=t.__values__,e.attr(Td,n,this);var r=Ad[e.type];r&&r.call(this,e,t,n),Sd&&this.style(Sd,n)},wd.style=function(e,t){var n,r,i,o,a;if(null!=t)for(n=0,r=yd.length;n/g,">")}Pd.resize=function(e,t,n,r){Rd.resize.call(this,e,t,n,r);var i=this._origin,o=this._text,a={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var u in gd)a[u]=gd[u];o.head=pd("svg",a);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),o.bg=s?pd("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+md("rect"):"",o.root=pd("g",{transform:"translate("+i+")"}),o.foot=md("g")+md("svg"),this},Pd.background=function(){var e=Rd.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),e},Pd.svg=function(){var e=this._text;return e.head+e.bg+e.defs+e.root+e.body+e.foot},Pd._render=function(e){return this._text.body=this.mark(e),this._text.defs=this.buildDefs(),this},Pd.buildDefs=function(){var e,t,n,r,i,o=this._defs,a="";for(t in o.gradient){for(i=(n=o.gradient[t]).stops,"radial"===n.gradient?(a+=pd(r="pattern",{id:"p_"+t,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),a+=pd("rect",{width:"1",height:"1",fill:"url(#"+t+")"})+md("rect"),a+=md(r),a+=pd(r="radialGradient",{id:t,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):a+=pd(r="linearGradient",{id:t,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),e=0;e0?pd("defs")+a+md("defs"):""},Pd.attributes=function(e,t){return Fd={},e(zd,t,this),Fd},Pd.href=function(e){var t,n=this,r=e.href;if(r){if(t=n._hrefs&&n._hrefs[r])return t;n.sanitizeURL(r).then((function(e){e["xlink:href"]=e.href,e.href=null,(n._hrefs||(n._hrefs={}))[r]=e}))}return null},Pd.mark=function(e){var t,n=this,r=Ff[e.marktype],i=r.tag,o=this._defs,a="";function u(u){var s=n.href(u);if(s&&(a+=pd("a",s)),t="g"!==i?Ld(u,e,i,o):null,a+=pd(i,n.attributes(r.attr,u),t),"text"===i){const e=Of(u);if(Object(oe.A)(e)){const t={x:0,dy:Ef(u)};for(let n=0;n1?(Bd[e]=t,this):Bd[e]}function qd(e,t,n){const r=[],i=(new Iu).union(t),o=e.marktype;return o?Wd(e,i,n,r):"group"===o?Hd(e,i,n,r):Object(oe.n)("Intersect scene must be mark node or group item.")}function Wd(e,t,n,r){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 i=e.items,o=e.marktype,a=i.length;let u=0;if("group"===o)for(;u=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!Xd(e[n],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function Kd(e,t){return Xd(Ks(e),Ks(t))}function Jd(e){Dr.call(this,null,e)}function Qd(e,t,n){return t(e.bounds.clear(),e,n)}Object(oe.y)(Jd,Dr).transform=function(e,t){var n,r=t.dataflow,i=e.mark,o=i.marktype,a=Ff[o],u=a.bound,s=i.bounds;if(a.nested)i.items.length&&r.dirty(i.items[0]),s=Qd(i,u),i.items.forEach((function(e){e.bounds.clear().union(s)}));else if("group"===o||e.modified())switch(t.visit(t.MOD,(function(e){r.dirty(e)})),s.clear(),i.items.forEach((function(e){s.union(Qd(e,u))})),i.role){case"axis":case"legend":case"title":t.reflow()}else n=t.changed(t.REM),t.visit(t.ADD,(function(e){s.union(Qd(e,u))})),t.visit(t.MOD,(function(e){n=n||s.alignsWith(e.bounds),r.dirty(e),s.union(Qd(e,u))})),n&&(s.clear(),i.items.forEach((function(e){s.union(e.bounds)})));return Gd(i),t.modifies("bounds")};function Zd(e){Dr.call(this,0,e)}function eh(e){Dr.call(this,null,e)}function th(e){Dr.call(this,null,e)}Zd.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Object(oe.y)(Zd,Dr).transform=function(e,t){var n=function(e){var t=e._signals[":vega_identifier:"];t||(e._signals[":vega_identifier:"]=t=e.add(0));return t}(t.dataflow),r=n.value,i=e.as;return t.visit(t.ADD,(function(e){e[i]||(e[i]=++r)})),n.set(this.value=r),t},Object(oe.y)(eh,Dr).transform=function(e,t){var n=this.value;n||((n=t.dataflow.scenegraph().mark(e.markdef,function(e){var 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)).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);var r="group"===n.marktype?Vu:Yu;return t.visit(t.ADD,(function(e){r.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};var nh=Object(oe.y)(th,Dr),rh={parity:function(e){return e.filter((e,t)=>t%2?e.opacity=0:1)},greedy:function(e,t){var n;return e.filter((e,r)=>r&&ih(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1))}};function ih(e,t,n){return n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2)}function oh(e,t){for(var n,r=1,i=e.length,o=e[0].bounds;r1&&t.height()>1}function uh(e){return e.forEach(e=>e.opacity=1),e}function sh(e,t){return e.reflow(t.modified()).modifies("opacity")}function lh(e){Dr.call(this,null,e)}nh.transform=function(e,t){var n,r,i,o=rh[e.method]||rh.parity,a=t.materialize(t.SOURCE).source,u=e.separation||0;if(a&&a.length){if(!e.method)return e.modified("method")&&(uh(a),t=sh(t,e)),t;if(e.sort&&(a=a.slice().sort(e.sort)),n=uh(a=a.filter(ah)),t=sh(t,e),n.length>=3&&oh(n,u)){do{n=o(n,u)}while(n.length>=3&&oh(n,u));n.length<3&&!Object(oe.T)(a).opacity&&(n.length>1&&(Object(oe.T)(n).opacity=0),Object(oe.T)(a).opacity=1)}var s,l,c,f,d;return e.boundScale&&e.boundTolerance>=0&&(s=e.boundScale,l=e.boundOrient,c=+e.boundTolerance,f=s.range(),d=new Iu,l===Fu||"bottom"===l?d.set(f[0],-1/0,f[1],1/0):d.set(-1/0,f[0],1/0,f[1]),d.expand(c||1),r=e=>d.encloses(e.bounds),a.forEach(e=>{r(e)||(e.opacity=0)})),i=n[0].mark.bounds.clear(),a.forEach(e=>{e.opacity&&i.union(e.bounds)}),t}},Object(oe.y)(lh,Dr).transform=function(e,t){var n=t.dataflow;if(t.visit(t.ALL,(function(e){n.dirty(e)})),t.fields&&t.fields.zindex){var r=t.source&&t.source[0];r&&(r.mark.zdirty=!0)}};const ch=new Iu;function fh(e,t,n){return e[t]===n?0:(e[t]=n,1)}function dh(e){var t=e.items[0].datum.orient;return t===Pu||t===Ru}function hh(e,t,n,r){var i,o,a=t.items[0],u=a.datum,s=u.orient,l=null!=u.translate?u.translate:.5,c=function(e){var t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(u),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=u.title&&a.items[c[2]].items[0],v=a.titlePadding,y=a.bounds,b=g&&kf(g),x=0,w=0;switch(ch.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(a.items[i].bounds),(i=c[1])>-1&&y.union(a.items[i].bounds),s){case Fu:x=h||0,w=-d,o=Math.max(p,Math.min(m,-y.y1)),g&&(o=ph(e,g,o,v,b,0,-1,y)),y.add(0,-o).add(f,0);break;case Pu:x=-d,w=h||0,o=Math.max(p,Math.min(m,-y.x1)),g&&(o=ph(e,g,o,v,b,1,-1,y)),y.add(-o,0).add(0,f);break;case Ru:x=n+d,w=h||0,o=Math.max(p,Math.min(m,y.x2)),g&&(o=ph(e,g,o,v,b,1,1,y)),y.add(0,0).add(o,f);break;case"bottom":x=h||0,w=r+d,o=Math.max(p,Math.min(m,y.y2)),g&&(o=ph(e,g,o,v,0,0,1,y)),y.add(0,0).add(f,o);break;default:x=a.x,w=a.y}return ec(y.translate(x,w),a),fh(a,"x",x+l)|fh(a,"y",w+l)&&(a.bounds=ch,e.dirty(a),a.bounds=y,e.dirty(a)),a.mark.bounds.clear().union(y)}function ph(e,t,n,r,i,o,a,u){var s=t.bounds,l=0,c=0;return t.auto?(e.dirty(t),n+=r,o?l=(t.x||0)-(t.x=a*(n+i)):c=(t.y||0)-(t.y=a*(n+i)),t.mark.bounds.clear().union(s.translate(-l,-c)),e.dirty(t),o?(u.add(0,s.y1).add(0,s.y2),n+=s.width()):(u.add(s.x1,0).add(s.x2,0),n+=s.height())):u.union(s),n}function mh(e){return(new Iu).set(0,0,e.width||0,e.height||0)}function gh(e){var t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function vh(e,t,n){var r=Object(oe.F)(e)?e[t]:e;return null!=r?r:void 0!==n?n:0}function yh(e){return e<0?Math.ceil(-e):0}function bh(e,t,n){var r,i,o,a,u,s,l,c,f,d,h,p=!n.nodirty,m="flush"===n.bounds?mh:gh,g=ch.set(0,0,0,0),v=vh(n.align,"column"),y=vh(n.align,Lu),b=vh(n.padding,"column"),x=vh(n.padding,Lu),w=n.columns||t.length,_=w<0?1:Math.ceil(t.length/w),E=t.length,O=Array(E),k=Array(w),j=0,S=Array(E),C=Array(_),A=0,N=Array(E),T=Array(E),D=Array(E);for(i=0;i1)for(i=0;i0&&(N[i]+=f/2);if(y&&vh(n.center,Lu)&&1!==w)for(i=0;i0&&(T[i]+=d/2);for(i=0;ii&&(e.warn("Grid headers exceed limit: "+i),t=t.slice(0,i)),O+=o,m=0,v=t.length;m=0&&null==(x=n[g]);g-=d);u?(w=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),_=O):(w=O,_=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),y.union(b.bounds.translate(w-(b.x||0),_-(b.y||0))),b.x=w,b.y=_,e.dirty(b),k=a(k,y[l])}return k}function kh(e,t,n,r,i,o){if(t){e.dirty(t);var a=n,u=n;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),t.bounds.translate(a-(t.x||0),u-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=u,e.dirty(t)}}function jh(e,t,n,r,i,o,a){const u=function(e,t){const n=e[t]||{};return(t,r)=>null!=n[t]?n[t]:null!=e[t]?e[t]:r}(n,t),s=(f=e,d=u("offset",0),h=-1/0,f.forEach(e=>{null!=e.offset&&(h=Math.max(h,e.offset))}),h>-1/0?h:d),l=u("anchor","start"),c=l===zu?1:"middle"===l?.5:0;var f,d,h;const p={align:"each",bounds:u("bounds","flush"),columns:"vertical"===u("direction")?1:e.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(t){case Pu:p.anchor={x:Math.floor(r.x1)-s,column:zu,y:c*(a||r.height()+2*r.y1),row:l};break;case Ru:p.anchor={x:Math.ceil(r.x2)+s,y:c*(a||r.height()+2*r.y1),row:l};break;case Fu:p.anchor={y:Math.floor(i.y1)-s,row:zu,x:c*(o||i.width()+2*i.x1),column:l};break;case"bottom":p.anchor={y:Math.ceil(i.y2)+s,x:c*(o||i.width()+2*i.x1),column:l};break;case"top-left":p.anchor={x:s,y:s};break;case"top-right":p.anchor={x:o-s,y:s,column:zu};break;case"bottom-left":p.anchor={x:s,y:a-s,row:zu};break;case"bottom-right":p.anchor={x:o-s,y:a-s,column:zu,row:zu}}return p}function Sh(e,t){var n,r,i,o,a=t.items[0],u=a.datum,s=a.orient,l=a.bounds,c=a.x,f=a.y;return a._bounds?a._bounds.clear().union(l):a._bounds=l.clone(),l.clear(),function(e,t,n){var r=t.padding,i=r-n.x,o=r-n.y;if(t.datum.title){var a=t.items[1].items[0],u=a.anchor,s=t.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case Pu:i+=Math.ceil(a.bounds.width())+s;break;case Ru:case"bottom":break;default:o+=a.bounds.height()+s}switch((i||o)&&Ah(e,n,i,o),a.orient){case Pu:c+=Ch(t,n,a,u,1,1);break;case Ru:l+=Ch(t,n,a,zu,0,0)+s,c+=Ch(t,n,a,u,1,1);break;case"bottom":l+=Ch(t,n,a,u,0,0),c+=Ch(t,n,a,zu,-1,0,1)+s;break;default:l+=Ch(t,n,a,u,0,0)}(l||c)&&Ah(e,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(Ah(e,n,-l,0),Ah(e,a,-l,0))}else(i||o)&&Ah(e,n,i,o)}(e,a,a.items[0].items[0]),l=function(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.x1=e.padding,t.y1=e.padding,t}(a,l),n=2*a.padding,r=2*a.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===u.type&&(i=a.items[0].items[0].items[0].items,o=i.reduce((function(e,t){return e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e}),{}),i.forEach((function(e){e.width=o[e.column],e.height=e.bounds.y2-e.y}))),"none"!==s&&(a.x=c=0,a.y=f=0),a.width=n,a.height=r,ec(l.set(c,f,c+n,f+r),a),a.mark.bounds.clear().union(l),a}function Ch(e,t,n,r,i,o,a){const u="symbol"!==e.datum.type,s=n.datum.vgrad,l=(!u||!o&&s||a?t:t.items[0]).bounds[i?"y2":"x2"]-e.padding,c=s&&o?l:0,f=s&&o?0:l,d=i<=0?0:kf(n);return Math.round("start"===r?c:r===zu?f-d:.5*(l-d))}function Ah(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function Nh(e){Dr.call(this,null,e)}Object(oe.y)(Nh,Dr).transform=function(e,t){var n=t.dataflow;return e.mark.items.forEach((function(t){e.layout&&function(e,t,n){var r,i,o,a,u,s,l,c=function(e){for(var t,n,r=e.items,i=r.length,o=0,a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};o{"none"!==(o=e.orient||Ru)&&(t[o]||(t[o]=[])).push(e)});for(let r in t){const i=t[r];bh(e,i,jh(i,r,n.legends,d,h,l,c))}p.forEach(t=>{const r=t.bounds;if(r.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=r,e.dirty(t)),n.autosize&&"fit"===n.autosize.type)switch(t.orient){case Pu:case Ru:f.add(r.x1,0).add(r.x2,0);break;case Fu:case"bottom":f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(d).union(h),r&&f.union(function(e,t,n,r,i){var o,a=t.items[0],u=a.frame,s=a.orient,l=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=s===Pu||s===Ru?r:n,m=0,g=0,v=0,y=0,b=0;if("group"!==u?s===Pu?(m=i.y2,p=i.y1):s===Ru?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2):s===Pu&&(m=r,p=0),o="start"===l?m:l===zu?p:(m+p)/2,h&&h.text){switch(s){case Fu:case"bottom":b=d.bounds.height()+f;break;case Pu:y=d.bounds.width()+f;break;case Ru:y=-d.bounds.width()-f}ch.clear().union(h.bounds),ch.translate(y-(h.x||0),b-(h.y||0)),fh(h,"x",y)|fh(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(ch),h.mark.bounds.clear().union(ch),e.dirty(h)),ch.clear().union(h.bounds)}else ch.clear();switch(ch.union(d.bounds),s){case Fu:g=o,v=i.y1-ch.height()-c;break;case Pu:g=i.x1-ch.width()-c,v=o;break;case Ru:g=i.x2+ch.width()+c,v=o;break;case"bottom":g=o,v=i.y2+c;break;default:g=a.x,v=a.y}return fh(a,"x",g)|fh(a,"y",v)&&(ch.translate(g,v),e.dirty(a),a.bounds.clear().union(ch),t.bounds.clear().union(ch),e.dirty(a)),a.bounds}(e,r,l,c,f));t.clip&&f.set(0,0,t.width||0,t.height||0);!function(e,t,n,r){var i=r.autosize||{},o=i.type,a=e._width,u=e._height,s=e.padding();if(e._autosize<1||!o)return;var l=Math.max(0,t.width||0),c=Math.max(0,Math.ceil(-n.x1)),f=Math.max(0,Math.ceil(n.x2-l)),d=Math.max(0,t.height||0),h=Math.max(0,Math.ceil(-n.y1)),p=Math.max(0,Math.ceil(n.y2-d));"padding"===i.contains&&(a-=s.left+s.right,u-=s.top+s.bottom);"none"===o?(c=0,h=0,l=a,d=u):"fit"===o?(l=Math.max(0,a-c-f),d=Math.max(0,u-h-p)):"fit-x"===o?(l=Math.max(0,a-c-f),u=d+h+p):"fit-y"===o?(a=l+c+f,d=Math.max(0,u-h-p)):"pad"===o&&(a=l+c+f,u=d+h+p);e._resizeView(a,u,l,d,[c,h],i.resize)}(e,t,f,n)}(n,t,e)})),e.modified()&&t.reflow(),t};var Th=function(e,t,n){var r=e-t+2*n;return e?r>0?r:1:0};const Dh="log",Mh="utc",Fh="continuous";var Ph=iu(Yr),Rh=Ph.right,zh=Ph.left,Lh=Rh;function Ih(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function $h(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}const Bh=Symbol("implicit");function Uh(){var e=new Map,t=[],n=[],r=Bh;function i(i){var o=i+"",a=e.get(o);if(!a){if(r!==Bh)return r;e.set(o,a=t.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Map;for(const r of n){const n=r+"";e.has(n)||e.set(n,t.push(r))}return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Uh(t,n).unknown(r)},Ih.apply(i,arguments),i}function qh(){var e,t,n=Uh().unknown(void 0),r=n.domain,i=n.range,o=[0,1],a=!1,u=0,s=0,l=.5;function c(){var n=r().length,c=o[1]o[1-c])))return n=Math.max(0,Rh(f,s)-1),a=s===l?n:Rh(f,l)-1,s-f[n]>t+1e-10&&++n,c&&(u=n,n=d-a,a=d-u),n>a?void 0:r().slice(n,a+1)}},n.invert=function(e){var t=n.invertRange([e,e]);return t?t[0]:t},n.copy=function(){return qh().domain(r()).range(o).round(a).paddingInner(u).paddingOuter(s).align(l)},c()}var Wh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Hh(e){if(!(t=Wh.exec(e)))throw new Error("invalid format: "+e);var t;return new Yh({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 Yh(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+""}Hh.prototype=Yh.prototype,Yh.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};var Vh,Gh,Xh,Kh,Jh=function(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]},Qh=function(e){return(e=Jh(Math.abs(e)))?e[1]:NaN},Zh=function(e,t){var n=Jh(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},ep={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return Zh(100*e,t)},r:Zh,s:function(e,t){var n=Jh(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Vh=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Jh(e,Math.max(0,t+o-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},tp=function(e){return e},np=Array.prototype.map,rp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],ip=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?tp:(t=np.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,o=[],a=0,u=t[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(e.substring(i-=u,i+u)),!((s+=u+1)>r));)u=t[a=(a+1)%t.length];return o.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",u=void 0===e.numerals?tp:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(np.call(e.numerals,String)),s=void 0===e.percent?"%":e.percent+"",l=void 0===e.minus?"-":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=Hh(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):ep[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===d?o:/[%p]/.test(y)?s:"",w=ep[y],_=/[defgprs%]/.test(y);function E(e){var i,o,s,d=b,E=x;if("c"===y)E=w(e)+E,e="";else{var O=(e=+e)<0;if(e=isNaN(e)?c:w(Math.abs(e),g),v&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),O&&0==+e&&(O=!1),d=(O?"("===f?f:l:"-"===f||"("===f?"":f)+d,E=("s"===y?rp[8+Vh/3]:"")+E+(O&&"("===f?")":""),_)for(i=-1,o=e.length;++i(s=e.charCodeAt(i))||s>57){E=(46===s?a+e.slice(i+1):e.slice(i))+E,e=e.slice(0,i);break}}m&&!h&&(e=r(e,1/0));var k=d.length+e.length+E.length,j=k>1)+d+e+E+j.slice(k);break;default:e=j+d+e+E}return u(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return e+""},E}return{format:f,formatPrefix:function(e,t){var n=f(((e=Hh(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(Qh(t)/3))),i=Math.pow(10,-r),o=rp[8+r/3];return function(e){return n(i*e)+o}}}};function op(e){return Gh=ip(e),Xh=Gh.format,Kh=Gh.formatPrefix,Gh}op({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});var ap=function(e,t,n,r){var i,o=cu(e,t,n);switch((r=Hh(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Qh(t)/3)))-Qh(Math.abs(e)))}(o,a))||(r.precision=i),Kh(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Qh(t)-Qh(e))+1}(o,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(e){return Math.max(0,-Qh(Math.abs(e)))}(o))||(r.precision=i-2*("%"===r.type))}return Xh(r)},up=Array.prototype.map;function sp(e){return up.call(e,(function(e){return+e}))}var lp=Array.prototype.slice;var cp=function(e,t,n){e.prototype=t.prototype=n,n.constructor=e};function fp(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function dp(){}var hp="\\s*([+-]?\\d+)\\s*",pp="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",mp="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gp=/^#([0-9a-f]{3,8})$/,vp=new RegExp("^rgb\\("+[hp,hp,hp]+"\\)$"),yp=new RegExp("^rgb\\("+[mp,mp,mp]+"\\)$"),bp=new RegExp("^rgba\\("+[hp,hp,hp,pp]+"\\)$"),xp=new RegExp("^rgba\\("+[mp,mp,mp,pp]+"\\)$"),wp=new RegExp("^hsl\\("+[pp,mp,mp]+"\\)$"),_p=new RegExp("^hsla\\("+[pp,mp,mp,pp]+"\\)$"),Ep={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 Op(){return this.rgb().formatHex()}function kp(){return this.rgb().formatRgb()}function jp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=gp.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Sp(t):3===n?new Tp(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?new Tp(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?new Tp(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=vp.exec(e))?new Tp(t[1],t[2],t[3],1):(t=yp.exec(e))?new Tp(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=bp.exec(e))?Cp(t[1],t[2],t[3],t[4]):(t=xp.exec(e))?Cp(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=wp.exec(e))?Pp(t[1],t[2]/100,t[3]/100,1):(t=_p.exec(e))?Pp(t[1],t[2]/100,t[3]/100,t[4]):Ep.hasOwnProperty(e)?Sp(Ep[e]):"transparent"===e?new Tp(NaN,NaN,NaN,0):null}function Sp(e){return new Tp(e>>16&255,e>>8&255,255&e,1)}function Cp(e,t,n,r){return r<=0&&(e=t=n=NaN),new Tp(e,t,n,r)}function Ap(e){return e instanceof dp||(e=jp(e)),e?new Tp((e=e.rgb()).r,e.g,e.b,e.opacity):new Tp}function Np(e,t,n,r){return 1===arguments.length?Ap(e):new Tp(e,t,n,null==r?1:r)}function Tp(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Dp(){return"#"+Fp(this.r)+Fp(this.g)+Fp(this.b)}function Mp(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Fp(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Pp(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Lp(e,t,n,r)}function Rp(e){if(e instanceof Lp)return new Lp(e.h,e.s,e.l,e.opacity);if(e instanceof dp||(e=jp(e)),!e)return new Lp;if(e instanceof Lp)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=t===o?(n-r)/u+6*(n0&&s<1?0:a,new Lp(a,u,s,e.opacity)}function zp(e,t,n,r){return 1===arguments.length?Rp(e):new Lp(e,t,n,null==r?1:r)}function Lp(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ip(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 $p(e,t,n,r,i){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)*r+a*i)/6}cp(dp,jp,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:Op,formatHex:Op,formatHsl:function(){return Rp(this).formatHsl()},formatRgb:kp,toString:kp}),cp(Tp,Np,fp(dp,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Tp(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Tp(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dp,formatHex:Dp,formatRgb:Mp,toString:Mp})),cp(Lp,zp,fp(dp,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Lp(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Lp(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Tp(Ip(e>=240?e-240:e+120,i,r),Ip(e,i,r),Ip(e<120?e+240:e-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var Bp=function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],a=r>0?e[r-1]:2*i-o,u=r180||n<-180?n-360*Math.round(n/360):n):qp(isNaN(e)?t:e)}function Yp(e){return 1==(e=+e)?Vp: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(r){return Math.pow(e+r*t,n)}}(t,n,e):qp(isNaN(t)?n:t)}}function Vp(e,t){var n=t-e;return n?Wp(e,n):qp(isNaN(e)?t:e)}var Gp=function e(t){var n=Yp(t);function r(e,t){var r=n((e=Np(e)).r,(t=Np(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),a=Vp(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1);function Xp(e){return function(t){var n,r,i=t.length,o=new Array(i),a=new Array(i),u=new Array(i);for(n=0;no&&(i=t.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:rm(n,r)})),o=am.lastIndex;return ot&&(n=e,e=t,t=n),l=function(n){return Math.max(e,Math.min(t,n))}),r=s>2?mm:pm,i=o=null,f}function f(t){return isNaN(t=+t)?n:(i||(i=r(a.map(e),u,s)))(e(l(t)))}return f.invert=function(n){return l(t((o||(o=r(u,a.map(e),rm)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,cm),c()):a.slice()},f.range=function(e){return arguments.length?(u=Array.from(e),c()):u.slice()},f.rangeRound=function(e){return u=Array.from(e),s=lm,c()},f.clamp=function(e){return arguments.length?(l=!!e||dm,c()):l!==dm},f.interpolate=function(e){return arguments.length?(s=e,c()):s},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,r){return e=n,t=r,c()}}function ym(){return vm()(dm,dm)}function bm(e){var t=e.domain;return e.ticks=function(e){var n=t();return su(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return ap(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i=t(),o=0,a=i.length-1,u=i[o],s=i[a];return s0?r=lu(u=Math.floor(u/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=lu(u=Math.ceil(u*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(s/r)*r,t(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(s*r)/r,t(i)),e},e}var xm=function(e,t){var n,r=0,i=(e=e.slice()).length-1,o=e[r],a=e[i];return a0){for(;d<=h;++d)for(c=1,l=n(d);cs)break;m.push(f)}}else for(;d<=h;++d)for(c=o-1,l=n(d);c>=1;--c)if(!((f=l*c)s)break;m.push(f)}2*m.length=u&&a[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return u=e.invertExtent(a[l]),s=e.invertExtent(a[n]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=e,n};return r.metadata=Object(oe.cb)(Object(oe.i)(n)),r}function Gm(e,t,n){return arguments.length>1?(Ym[e]=Vm(e,t,n),this):Xm(e)?Ym[e]:void 0}function Xm(e){return Object(oe.v)(Ym,e)}function Km(e,t){const n=Ym[e];return n&&n.metadata[t]}function Jm(e){return Km(e,Fh)}function Qm(e){return Km(e,"discrete")}function Zm(e){return Km(e,"discretizing")}function eg(e){return Km(e,Dh)}function tg(e){return Km(e,"interpolating")}function ng(e){return Km(e,"quantile")}Gm("identity",(function e(t){var n;function r(e){return isNaN(e=+e)?n:e}return r.invert=r,r.domain=r.range=function(e){return arguments.length?(t=Array.from(e,cm),r):t.slice()},r.unknown=function(e){return arguments.length?(n=e,r):n},r.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,cm):[0,1],bm(r)})),Gm("linear",(function e(){var t=ym();return t.copy=function(){return gm(t,e())},Ih.apply(t,arguments),bm(t)}),Fh),Gm(Dh,(function e(){var t=Sm(vm()).domain([1,10]);return t.copy=function(){return gm(t,e()).base(t.base())},Ih.apply(t,arguments),t}),[Fh,Dh]),Gm("pow",Dm,Fh),Gm("sqrt",(function(){return Dm.apply(null,arguments).exponent(.5)}),Fh),Gm("symlog",(function e(){var t=Pm(vm());return t.copy=function(){return gm(t,e()).constant(t.constant())},Ih.apply(t,arguments)}),Fh),Gm("time",(function(){return Ih.apply(Lm(Bt,Ca,Tt,It,Na,Da,Fa,Ra,Gt).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Fh,"temporal"]),Gm(Mh,(function(){return Ih.apply(Lm(qt,La,wt,At,$a,Ua,Fa,Ra,Kt).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Fh,"temporal"]),Gm("sequential",Bm,[Fh,"interpolating"]),Gm("sequential-linear",Bm,[Fh,"interpolating"]),Gm("sequential-log",(function e(){var t=Sm(Im()).domain([1,10]);return t.copy=function(){return $m(t,e()).base(t.base())},$h.apply(t,arguments)}),[Fh,"interpolating",Dh]),Gm("sequential-pow",Um,[Fh,"interpolating"]),Gm("sequential-sqrt",(function(){return Um.apply(null,arguments).exponent(.5)}),[Fh,"interpolating"]),Gm("sequential-symlog",(function e(){var t=Pm(Im());return t.copy=function(){return $m(t,e()).constant(t.constant())},$h.apply(t,arguments)}),[Fh,"interpolating"]),Gm("diverging-linear",(function e(){var t=bm(Wm()(dm));return t.copy=function(){return $m(t,e())},$h.apply(t,arguments)}),[Fh,"interpolating"]),Gm("diverging-log",(function e(){var t=Sm(Wm()).domain([.1,1,10]);return t.copy=function(){return $m(t,e()).base(t.base())},$h.apply(t,arguments)}),[Fh,"interpolating",Dh]),Gm("diverging-pow",Hm,[Fh,"interpolating"]),Gm("diverging-sqrt",(function(){return Hm.apply(null,arguments).exponent(.5)}),[Fh,"interpolating"]),Gm("diverging-symlog",(function e(){var t=Pm(Wm());return t.copy=function(){return $m(t,e()).constant(t.constant())},$h.apply(t,arguments)}),[Fh,"interpolating"]),Gm("quantile",(function e(){var t,n=[],r=[],i=[];function o(){var e=0,t=Math.max(1,r.length);for(i=new Array(t-1);++e0?i[t-1]:n[0],t=i?[o[i-1],r]:[o[t-1],o[t]]},u.unknown=function(e){return arguments.length?(t=e,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return e().domain([n,r]).range(a).unknown(t)},Ih.apply(bm(u),arguments)}),"discretizing"),Gm("threshold",(function e(){var t,n=[.5],r=[0,1],i=1;function o(e){return e<=e?r[Lh(n,e,0,i)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(e){return arguments.length?(r=Array.from(e),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(e){var t=r.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(r).unknown(t)},Ih.apply(o,arguments)}),"discretizing"),Gm("bin-ordinal",(function e(){var t=[],n=[];function r(e){return null==e||e!=e?void 0:n[(Lh(t,e)-1)%n.length]}return r.domain=function(e){return arguments.length?(t=sp(e),r):t.slice()},r.range=function(e){return arguments.length?(n=lp.call(e),r):n.slice()},r.tickFormat=function(e,n){return ap(t[0],Object(oe.T)(t),null==e?10:e,n)},r.copy=function(){return e().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),Gm("ordinal",Uh,"discrete"),Gm("band",qh,"discrete"),Gm("point",(function(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return e(n())},t}(qh().paddingInner(1))}),"discrete");var rg,ig,og,ag,ug=function(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}},sg=function(e,t){var n=Hp(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}},lg=180/Math.PI,cg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},fg=function(e,t,n,r,i,o){var a,u,s;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(s=e*n+t*r)&&(n-=e*s,r-=t*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),e*r180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:rm(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,a.rotate,u,s),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:rm(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,a.skewX,u,s),function(e,t,n,r,o,a){if(e!==n||t!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:rm(e,n)},{i:u-2,x:rm(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(e){for(var t,n=-1,r=s.length;++n6/29*(6/29)*(6/29)?Math.pow(e,1/3):e/(6/29*3*(6/29))+4/29}function Sg(e){return e>6/29?e*e*e:6/29*3*(6/29)*(e-4/29)}function Cg(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ag(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ng(e){if(e instanceof Dg)return new Dg(e.h,e.c,e.l,e.opacity);if(e instanceof kg||(e=Eg(e)),0===e.a&&0===e.b)return new Dg(NaN,0e[t]?o[t](e[t]()):0),o):Object(oe.l)(.5)}function ev(e,t){var n=u[function(e){return"interpolate"+e.toLowerCase().split("-").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function tv(e){for(var t=e.length/6|0,n=new Array(t),r=0;r1?(rv[e]=t,this):rv[e]}function ov(e,t,n){var r;return Object(oe.E)(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,~~(Object(oe.W)(e.domain())/n)||1))),Object(oe.F)(t)&&(r=t.step,t=t.interval),Object(oe.H)(t)&&(t="time"===e.type?Ha(t):e.type==Mh?Ya(t):Object(oe.n)("Only time and utc scales accept interval strings."),r&&(t=t.every(r))),t}function av(e,t,n){var r=e.range(),i=Math.floor(r[0]),o=Math.ceil(Object(oe.T)(r));if(i>o&&(r=o,o=i,i=r),t=t.filter((function(t){return t=e(t),i<=t&&t<=o})),n>0&&t.length>1){for(var a=[t[0],Object(oe.T)(t)];t.length>n&&t.length>=3;)t=t.filter((function(e,t){return!(t%2)}));t.length<3&&(t=a)}return t}function uv(e,t){return e.bins?av(e,e.bins):e.ticks?e.ticks(t):e.domain()}function sv(e,t,n,r,i){var o,a,u=e.type,s="time"===u||"time"===r?tu(n):u===Mh||r===Mh?nu(n):e.tickFormat?e.tickFormat(t,n):n?Xh(n):String;if(eg(u)){var l=function(e){var t=Hh(e||",");if(null==t.precision){switch(t.precision=12,t.type){case"%":t.precision-=2;break;case"e":t.precision-=1}return function(e,t){return function(n){var r,i,o=e(n),a=o.indexOf(t);if(a<0)return o;for(i=(r=function(e,t){var n,r=e.lastIndexOf("e");if(r>0)return r;for(r=e.length;--r>t;)if((n=e.charCodeAt(r))>=48&&n<=57)return r+1}(o,a))a;)if("0"!==o[r]){++r;break}return o.slice(0,r)+i}}(Xh(t),Xh(".1f")(1)[1])}return Xh(t)}(n);s=i||e.bins?l:(o=s,a=l,e=>o(e)?a(e):"")}return s}function lv(e){Dr.call(this,null,e)}function cv(e){Dr.call(this,null,e)}function fv(){return he({})}function dv(e){return e.exit}function hv(e){Dr.call(this,null,e)}nv({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"},tv),nv({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",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",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=>Jg(tv(e))),Object(oe.y)(lv,Dr).transform=function(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,i=e.scale,o=ov(i,null==e.count?e.values?e.values.length:10:e.count,e.minstep),a=e.format||sv(i,o,e.formatSpecifier,e.formatType,!!e.values),u=e.values?av(i,e.values,o):uv(i,o);return r&&(n.rem=r),r=u.map((function(e,t){return he({index:t/(u.length-1||1),value:e,label:a(e)})})),e.extra&&r.length&&r.push(he({index:-1,extra:{value:r[0].value},label:""})),n.source=r,n.add=r,this.value=r,n},Object(oe.y)(cv,Dr).transform=function(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||fv,o=e.key||fe,a=this.value;return Object(oe.A)(r.encode)&&(r.encode=null),a&&(e.modified("key")||t.modified(o))&&Object(oe.n)("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=Object(oe.s)().test(dv),a.lookup=function(e){return a.get(o(e))}),t.visit(t.ADD,(function(e){var t=o(e),n=a.get(t);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(a.set(t,n=i(e)),r.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(function(e){var t=o(e),n=a.get(t);n&&(n.datum=e,r.mod.push(n))})),t.visit(t.REM,(function(e){var t=o(e),n=a.get(t);e!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&r.modifies("datum"),e.clean&&a.empty>n.cleanThreshold&&n.runAfter(a.clean),r},Object(oe.y)(hv,Dr).transform=function(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,o=t.encode;if(Object(oe.A)(o)){if(!n.changed()&&!o.every((function(e){return i[e]})))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,u=i.update||oe.r,s=i.enter||oe.r,l=i.exit||oe.r,c=(o&&!a?i[o]:u)||oe.r;if(t.changed(t.ADD)&&(t.visit(t.ADD,(function(t){s(t,e),u(t,e)})),n.modifies(s.output),n.modifies(u.output),c!==oe.r&&c!==u&&(t.visit(t.ADD,(function(t){c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&l!==oe.r&&(t.visit(t.REM,(function(t){l(t,e)})),n.modifies(l.output)),a||c!==oe.r){var f=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(f,(function(t){var i=s(t,e)||r;(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(s.output)):t.visit(f,(function(t){(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation};const pv={quantile:"quantiles",quantize:"thresholds",threshold:"domain"},mv={quantile:"quantiles",quantize:"domain"};function gv(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=Object(oe.T)(e),t}(e.bins):pv[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[pv[e.type]]()):uv(e,t)}function vv(e,t,n,r,i,o){const a=mv[e.type]&&"time"!==i&&i!==Mh?function(e,t){var n,r=e[mv[e.type]](),i=r.length,o=i>1?r[1]-r[0]:r[0];for(n=1;nf?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),s=p.slice(0,f-1),a=!0):s=p,Object(oe.D)(i=e.size)?(e.values||0!==c(s[0])||(s=s.slice(1)),o=s.reduce((function(t,n){return Math.max(t,i(n,e))}),0)):i=Object(oe.l)(o=i||8),s=s.map((function(t,n){return he({index:n,label:h(t,n,s),value:t,offset:o,size:i(t,e)})})),a&&(a=p[s.length],s.push(he({index:s.length,label:`…${p.length-s.length} entries`,value:a,offset:o,size:i(a,e)})))):"gradient"===l?(n=c.domain(),r=Zg(c,n[0],Object(oe.T)(n)),p.length<3&&!e.values&&n[0]!==Object(oe.T)(n)&&(p=[n[0],Object(oe.T)(n)]),s=p.map((function(e,t){return he({index:t,label:h(e,t,p),value:e,perc:r(e)})}))):(i=p.length-1,r=function(e){var t=e.domain(),n=t.length-1,r=+t[0],i=+Object(oe.T)(t),o=i-r;if("threshold"===e.type){var a=n?o/n:.1;o=(i+=a)-(r-=a)}return function(e){return(e-r)/o}}(c),s=p.map((function(e,t){return he({index:t,label:h(e,t,p),value:e,perc:t?r(e):0,perc2:t===i?1:r(p[t+1])})}))),u.source=s,u.add=s,this.value=s,u};var wv=Object(oe.s)({line:Sv,"line-radial":function(e,t,n,r){return Sv(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},arc:Cv,"arc-radial":function(e,t,n,r){return Cv(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},curve:Av,"curve-radial":function(e,t,n,r){return Av(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(e,t,n,r){return"M"+e+","+t+"V"+r+"H"+n},"orthogonal-vertical":function(e,t,n,r){return"M"+e+","+t+"H"+n+"V"+r},"orthogonal-radial":function(e,t,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),u=Math.sin(n),s=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*i+","+t*o+"A"+t+","+t+" 0 0,"+(s?1:0)+" "+t*a+","+t*u+"L"+r*a+","+r*u},"diagonal-horizontal":function(e,t,n,r){var i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(e,t,n,r){var i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(e,t,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),u=Math.sin(n),s=(t+r)/2;return"M"+t*i+","+t*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function _v(e){return e.source.x}function Ev(e){return e.source.y}function Ov(e){return e.target.x}function kv(e){return e.target.y}function jv(e){Dr.call(this,{},e)}function Sv(e,t,n,r){return"M"+e+","+t+"L"+n+","+r}function Cv(e,t,n,r){var i=n-e,o=r-t,a=Math.sqrt(i*i+o*o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r}function Av(e,t,n,r){var i=n-e,o=r-t,a=.2*(i+o),u=.2*(o-i);return"M"+e+","+t+"C"+(e+a)+","+(t+u)+" "+(n+u)+","+(r-a)+" "+n+","+r}function Nv(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Tv(e){Dr.call(this,null,e)}jv.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"}]},Object(oe.y)(jv,Dr).transform=function(e,t){var n=e.sourceX||_v,r=e.sourceY||Ev,i=e.targetX||Ov,o=e.targetY||kv,a=e.as||"path",u=e.orient||"vertical",s=e.shape||"line",l=wv.get(s+"-"+u)||wv.get(s);return l||Object(oe.n)("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(function(e){e[a]=l(n(e),r(e),i(e),o(e))})),t.reflow(e.modified()).modifies(a)},Tv.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"]}]},Object(oe.y)(Tv,Dr).transform=function(e,t){var n,r,i,o=e.as||["startAngle","endAngle"],a=o[0],u=o[1],s=e.field||oe.N,l=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(s),h=d.length,p=l,m=(c-l)/Nv(d),g=Go(h);for(e.sort&&g.sort((function(e,t){return d[e]-d[t]})),n=0;n0?1:0)}),0))!==t.length&&n.warn("Log scale domain includes zero: "+Object(oe.Y)(t)));return t}function Rv(e,t,n){return Object(oe.D)(e)&&(t||n)?Kg(e,zv(t||[0,1],n)):e}function zv(e,t){return t?e.slice().reverse():e}function Lv(e){Dr.call(this,null,e)}Object(oe.y)(Fv,Dr).transform=function(e,t){var n=t.dataflow,r=this.value,i=function(e){var t,n=e.type,r="";if("sequential"===n)return"sequential-linear";(function(e){const t=e.type;return Jm(t)&&"time"!==t&&t!==Mh&&(e.scheme||e.range&&e.range.length&&e.range.every(oe.H))})(e)&&(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0,r=2===t?"sequential-":3===t?"diverging-":"");return(r+n||"linear").toLowerCase()}(e);for(i in r&&i===r.type||(this.value=r=Gm(i)()),e)if(!Mv[i]){if("padding"===i&&Dv(r.type))continue;Object(oe.D)(r[i])?r[i](e[i]):n.warn("Unsupported scale property: "+i)}return function(e,t,n){var r=e.type,i=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){"band"!==e&&"point"!==e&&Object(oe.n)("Only band and point scales support rangeStep.");var r=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,i="point"===e?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Th(n,i,r)]}(r,t,n);else if(t.scheme&&(o=function(e,t,n){var r,i,o=t.schemeExtent;Object(oe.A)(t.scheme)?i=Jg(t.scheme,t.interpolate,t.interpolateGamma):(r=t.scheme.toLowerCase(),(i=iv(r))||Object(oe.n)(`Unrecognized scheme name: ${t.scheme}`));return n="threshold"===e?n+1:"bin-ordinal"===e?n-1:"quantile"===e||"quantize"===e?+t.schemeCount||5:n,tg(e)?Rv(i,o,t.reverse):Object(oe.D)(i)?Qg(Rv(i,o),n):"ordinal"===e?i:i.slice(0,n)}(r,t,n),Object(oe.D)(o))){if(e.interpolator)return e.interpolator(o);Object(oe.n)(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&tg(r))return e.interpolator(Jg(zv(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(ev(t.interpolate,t.interpolateGamma)):Object(oe.D)(e.round)?e.round(i):Object(oe.D)(e.rangeRound)&&e.interpolate(i?lm:sm);o&&e.range(zv(o,t.reverse))}(r,e,function(e,t,n){let r=t.bins;if(r&&!Object(oe.A)(r)){let t=e.domain(),n=t[0],i=Object(oe.T)(t),o=null==r.start?n:r.start,a=null==r.stop?i:r.stop,u=r.step;u||Object(oe.n)("Scale bins parameter missing step property."),oi&&(a=u*Math.floor(i/u)),r=Go(o,a+u/2,u)}r?e.bins=r:e.bins&&delete e.bins;"bin-ordinal"===e.type&&(r?t.domain||t.domainRaw||(e.domain(r),n=r.length):e.bins=e.domain());return n}(r,e,function(e,t,n){var r=function(e,t,n){return t?(e.domain(Pv(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(r>-1)return r;var i,o,a=t.domain,u=e.type,s=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&("linear"===t||"pow"===t||"sqrt"===t)}(e);if(!a)return 0;Dv(u)&&t.padding&&a[0]!==Object(oe.T)(a)&&(a=function(e,t,n,r,i,o){var a=Math.abs(Object(oe.T)(n)-n[0]),u=a/(a-2*r),s=e===Dh?Object(oe.lb)(t,null,u):"sqrt"===e?Object(oe.mb)(t,null,u,.5):"pow"===e?Object(oe.mb)(t,null,u,i||1):"symlog"===e?Object(oe.nb)(t,null,u,o||1):Object(oe.kb)(t,null,u);return(t=t.slice())[0]=s[0],t[t.length-1]=s[1],t}(u,a,t.range,t.padding,t.exponent,t.constant));(s||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[i]=t.domainMax),null!=t.domainMid&&(((o=t.domainMid)a[i])&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(i,0,o)));e.domain(Pv(u,a,n)),"ordinal"===u&&e.unknown(t.domainImplicit?Bh:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&ov(e,t.nice)||null);return a.length}(r,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)},Object(oe.y)(Lv,Dr).transform=function(e,t){var n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(ve(e.sort)),this.modified(n),t};var Iv=["y0","y1"];function $v(e){Dr.call(this,null,e)}function Bv(e,t,n,r,i){for(var o,a=(t-e.sum)/2,u=e.length,s=0;sd&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,l,c),r=0,i=n.length,o=n.max;ri(e,t))}function i(r,i){var a=[],u=[];return function(n,r,i){var a,u,s,l,c,f,d=new Array,h=new Array;a=u=-1,l=n[0]>=r,Hv[l<<1].forEach(p);for(;++a=r,Hv[s|l<<1].forEach(p);Hv[l<<0].forEach(p);for(;++u=r,c=n[u*e]>=r,Hv[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[u*e+a+1]>=r,Hv[s|l<<1|c<<2|f<<3].forEach(p);Hv[l|c<<3].forEach(p)}a=-1,c=n[u*e]>=r,Hv[c<<2].forEach(p);for(;++a=r,Hv[c<<2|f<<3].forEach(p);function p(e){var t,n,r=[e[0][0]+a,e[0][1]+u],s=[e[1][0]+a,e[1][1]+u],l=o(r),c=o(s);(t=h[l])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(s),i(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(s),h[t.end=c]=t):(t=d[c])?(n=h[l])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(s),i(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(r),d[t.start=l]=t):d[l]=h[c]={start:l,end:c,ring:[r,s]}}Hv[c<<3].forEach(p)}(r,i,(function(e){n(e,r,i),function(e){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t0?a.push([e]):u.push(e)})),u.forEach((function(e){for(var t,n=0,r=a.length;n0&&a0&&u0&&o>0||Object(oe.n)("invalid size"),e=i,t=o,r},r.smooth=function(e){return arguments.length?(n=e?a:Wv,r):n===a},r};function Vv(e,t){for(var n,r=-1,i=t.length;++rr!=h>r&&n<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function Xv(e,t,n){var r,i,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)&&(i=e[r=+(e[0]===t[0])],o=n[r],a=t[r],i<=o&&o<=a||a<=o&&o<=i)}var Kv=function(e,t,n){return function(r){var i=Object(oe.p)(r),o=n?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=t?cu(o,a,e):u/(e+1);return Go(s,a,s)}};function Jv(e){Dr.call(this,null,e)}function Qv(e,t,n,r,i){const o=e.x1||0,a=e.y1||0,u=t*n<0;function s(e){e.forEach(l)}function l(e){u&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+r,e[1]=(e[1]-a)*n+i}return function(e){return e.coordinates.forEach(s),e}}function Zv(e,t,n){const r=e>=0?e:ei(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function ey(e){return Object(oe.D)(e)?e:Object(oe.l)(+e)}Jv.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"}]},Object(oe.y)(Jv,Dr).transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||oe.x,o=Yv().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const r=Kv(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(e.map(e=>Vr(t(e).values)))}(r,i,e),u=null===e.as?null:e.as||"contour",s=[];return r.forEach(t=>{const n=i(t),r=o.size([n.width,n.height])(n.values,Object(oe.A)(a)?a:a(n.values));!function(e,t,n,r){let i=r.scale||t.scale,o=r.translate||t.translate;Object(oe.D)(i)&&(i=i(n,r));Object(oe.D)(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(Object(oe.E)(i)?i:i[0])||1,u=(Object(oe.E)(i)?i:i[1])||1,s=o&&o[0]||0,l=o&&o[1]||0;e.forEach(Qv(t,a,u,s,l))}(r,n,t,e),r.forEach(e=>{s.push(me(t,he(null!=u?{[u]:e}:e)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n};var ty=function(){var e=e=>e[0],t=e=>e[1],n=oe.N,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const l=Zv(r[0],u,e)>>a,c=Zv(r[1],u,t)>>a,f=l?l+2:0,d=c?c+2:0,h=2*f+(i>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let v=m;u.forEach(r=>{const i=f+(+e(r)>>a),o=d+(+t(r)>>a);i>=0&&i=0&&o0&&c>0?(ny(h,p,m,g,l),ry(h,p,g,m,c),ny(h,p,m,g,l),ry(h,p,g,m,c),ny(h,p,m,g,l),ry(h,p,g,m,c)):l>0?(ny(h,p,m,g,l),ny(h,p,g,m,l),ny(h,p,m,g,l),v=g):c>0&&(ry(h,p,m,g,c),ry(h,p,g,m,c),ry(h,p,m,g,c),v=g);let y=s?Math.pow(2,-2*a):1/Nv(v);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return u.x=function(t){return arguments.length?(e=ey(t),u):e},u.y=function(e){return arguments.length?(t=ey(e),u):t},u.weight=function(e){return arguments.length?(n=ey(e),u):n},u.size=function(e){if(!arguments.length)return[i,o];var t=Math.ceil(e[0]),n=Math.ceil(e[1]);return t>=0||t>=0||Object(oe.n)("invalid size"),i=t,o=n,u},u.cellSize=function(e){return arguments.length?((e=+e)>=1||Object(oe.n)("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),u):1<=i&&(t>=o&&(u-=n[t-o+a*e]),r[t-i+a*e]=u/Math.min(t+1,e-1+o-t,o))}function ry(e,t,n,r,i){const o=1+(i<<1);for(let a=0;a=i&&(u>=o&&(s-=n[a+(u-o)*e]),r[a+(u-i)*e]=s/Math.min(u+1,t-1+o-u,o))}function iy(e){Dr.call(this,null,e)}iy.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"}]};var oy=Object(oe.y)(iy,Dr);const ay=["x","y","weight","size","cellSize","bandwidth"];function uy(e,t){return ay.forEach(n=>null!=t[n]?e[n](t[n]):0),e}function sy(e){Dr.call(this,null,e)}oy.transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=function(e,t){var n,r,i,o,a,u,s=[],l=e=>e(o);if(null==t)s.push(e);else for(n={},r=0,i=e.length;rhe(function(e,t){for(let n=0;n0?1:e<0?-1:0},zy=Math.sqrt,Ly=Math.tan;function Iy(e){return e>1?0:e<-1?wy:Math.acos(e)}function $y(e){return e>1?_y:e<-1?-_y:Math.asin(e)}function By(){}var Uy,qy,Wy,Hy,Yy=vy(),Vy=vy(),Gy={point:By,lineStart:By,lineEnd:By,polygonStart:function(){Gy.lineStart=Xy,Gy.lineEnd=Qy},polygonEnd:function(){Gy.lineStart=Gy.lineEnd=Gy.point=By,Yy.add(Sy(Vy)),Vy.reset()},result:function(){var e=Yy/2;return Yy.reset(),e}};function Xy(){Gy.point=Ky}function Ky(e,t){Gy.point=Jy,Uy=Wy=e,qy=Hy=t}function Jy(e,t){Vy.add(Hy*e-Wy*t),Wy=e,Hy=t}function Qy(){Jy(Uy,qy)}var Zy=Gy,eb=1/0,tb=eb,nb=-eb,rb=nb;var ib,ob,ab,ub,sb={point:function(e,t){enb&&(nb=e);trb&&(rb=t)},lineStart:By,lineEnd:By,polygonStart:By,polygonEnd:By,result:function(){var e=[[eb,tb],[nb,rb]];return nb=rb=-(tb=eb=1/0),e}},lb=0,cb=0,fb=0,db=0,hb=0,pb=0,mb=0,gb=0,vb=0,yb={point:bb,lineStart:xb,lineEnd:Eb,polygonStart:function(){yb.lineStart=Ob,yb.lineEnd=kb},polygonEnd:function(){yb.point=bb,yb.lineStart=xb,yb.lineEnd=Eb},result:function(){var e=vb?[mb/vb,gb/vb]:pb?[db/pb,hb/pb]:fb?[lb/fb,cb/fb]:[NaN,NaN];return lb=cb=fb=db=hb=pb=mb=gb=vb=0,e}};function bb(e,t){lb+=e,cb+=t,++fb}function xb(){yb.point=wb}function wb(e,t){yb.point=_b,bb(ab=e,ub=t)}function _b(e,t){var n=e-ab,r=t-ub,i=zy(n*n+r*r);db+=i*(ab+e)/2,hb+=i*(ub+t)/2,pb+=i,bb(ab=e,ub=t)}function Eb(){yb.point=bb}function Ob(){yb.point=jb}function kb(){Sb(ib,ob)}function jb(e,t){yb.point=Sb,bb(ib=ab=e,ob=ub=t)}function Sb(e,t){var n=e-ab,r=t-ub,i=zy(n*n+r*r);db+=i*(ab+e)/2,hb+=i*(ub+t)/2,pb+=i,mb+=(i=ub*e-ab*t)*(ab+e),gb+=i*(ub+t),vb+=3*i,bb(ab=e,ub=t)}var Cb=yb;function Ab(e){this._context=e}Ab.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,Oy)}},result:By};var Nb,Tb,Db,Mb,Fb,Pb=vy(),Rb={point:By,lineStart:function(){Rb.point=zb},lineEnd:function(){Nb&&Lb(Tb,Db),Rb.point=By},polygonStart:function(){Nb=!0},polygonEnd:function(){Nb=null},result:function(){var e=+Pb;return Pb.reset(),e}};function zb(e,t){Rb.point=Lb,Tb=Mb=e,Db=Fb=t}function Lb(e,t){Mb-=e,Fb-=t,Pb.add(zy(Mb*Mb+Fb*Fb)),Mb=e,Fb=t}var Ib=Rb;function $b(){this._string=[]}function Bb(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}$b.prototype={_radius:4.5,_circle:Bb(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._string.push("M",e,",",t),this._point=1;break;case 1:this._string.push("L",e,",",t);break;default:null==this._circle&&(this._circle=Bb(this._radius)),this._string.push("M",e,",",t,this._circle)}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}return null}};var Ub=function(e,t){var n,r,i=4.5;function o(e){return e&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),gy(e,n(r))),r.result()}return o.area=function(e){return gy(e,n(Zy)),Zy.result()},o.measure=function(e){return gy(e,n(Ib)),Ib.result()},o.bounds=function(e){return gy(e,n(sb)),sb.result()},o.centroid=function(e){return gy(e,n(Cb)),Cb.result()},o.projection=function(t){return arguments.length?(n=null==t?(e=null,cy):(e=t).stream,o):e},o.context=function(e){return arguments.length?(r=null==e?(t=null,new $b):new Ab(t=e),"function"!=typeof i&&r.pointRadius(i),o):t},o.pointRadius=function(e){return arguments.length?(i="function"==typeof e?e:(r.pointRadius(+e),+e),o):i},o.projection(e).context(t)},qb=function(){var e,t=[];return{point:function(t,n){e.push([t,n])},lineStart:function(){t.push(e=[])},lineEnd:By,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}},Wb=function(e,t){return Sy(e[0]-t[0])<1e-6&&Sy(e[1]-t[1])<1e-6};function Hb(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}var Yb=function(e,t,n,r,i){var o,a,u=[],s=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,r=e[0],a=e[t];if(Wb(r,a)){for(i.lineStart(),o=0;o=0;--o)i.point((c=l[o])[0],c[1]);else r(d.x,d.p.x,-1,i);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}};function Vb(e){if(t=e.length){for(var t,n,r=0,i=e[0];++rt?1:e>=t?0:NaN};var ix,ox;1===(ix=rx).length&&(ox=ix,ix=function(e,t){return rx(ox(e),t)});var ax=Array.prototype,ux=(ax.slice,ax.map,function(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(i);++r=0;)for(t=(r=e[i]).length;--t>=0;)n[--a]=r[t];return n};var lx=function(e,t,n,r){return function(i){var o,a,u,s=t(i),l=qb(),c=t(l),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=v,d.lineStart=y,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=sx(a);var e=function(e,t){var n=nx(t),r=t[1],i=Py(r),o=[Py(n),-Ny(n),0],a=0,u=0;tx.reset(),1===i?r=_y+1e-6:-1===i&&(r=-_y-1e-6);for(var s=0,l=e.length;s=0?1:-1,k=O*E,j=k>wy,S=m*w;if(tx.add(Ay(S*O*Py(k),g*_+S*Ny(k))),a+=j?E+O*Oy:E,j^h>=n^b>=n){var C=Jb(Xb(d),Xb(y));ex(C);var A=Jb(o,C);ex(A);var N=(j^E>=0?-1:1)*$y(A[2]);(r>N||r===N&&(C[0]||C[1]))&&(u+=j^E>=0?1:-1)}}return(a<-1e-6||a<1e-6&&tx<-1e-6)^1&u}(o,r);a.length?(f||(i.polygonStart(),f=!0),Yb(a,fx,e,n,i)):e&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(t,n){e(t,n)&&i.point(t,n)}function p(e,t){s.point(e,t)}function m(){d.point=p,s.lineStart()}function g(){d.point=h,s.lineEnd()}function v(e,t){u.push([e,t]),c.point(e,t)}function y(){c.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),c.lineEnd();var e,t,n,r,s=c.clean(),d=l.result(),h=d.length;if(u.pop(),o.push(u),u=null,h)if(1&s){if((t=(n=d[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),e=0;e1&&2&s&&d.push(d.pop().concat(d.shift())),a.push(d.filter(cx))}return d}};function cx(e){return e.length>1}function fx(e,t){return((e=e.x)[0]<0?e[1]-_y-1e-6:_y-e[1])-((t=t.x)[0]<0?t[1]-_y-1e-6:_y-t[1])}var dx=lx((function(){return!0}),(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var u=o>0?wy:-wy,s=Sy(o-n);Sy(s-wy)<1e-6?(e.point(n,r=(r+a)/2>0?_y:-_y),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(u,r),e.point(o,r),t=0):i!==u&&s>=wy&&(Sy(n-i)<1e-6&&(n-=1e-6*i),Sy(o-u)<1e-6&&(o-=1e-6*u),r=function(e,t,n,r){var i,o,a=Py(e-n);return Sy(a)>1e-6?Cy((Py(t)*(o=Ny(r))*Py(n)-Py(r)*(i=Ny(t))*Py(e))/(i*o*a)):(t+r)/2}(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(u,r),t=0),e.point(n=o,r=a),i=u},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*_y,r.point(-wy,i),r.point(0,i),r.point(wy,i),r.point(wy,0),r.point(wy,-i),r.point(0,-i),r.point(-wy,-i),r.point(-wy,0),r.point(-wy,i);else if(Sy(e[0]-t[0])>1e-6){var o=e[0]wy?e+Math.round(-e/Oy)*Oy:e,t]}function mx(e,t,n){return(e%=Oy)?t||n?hx(vx(e),yx(t,n)):vx(e):t||n?yx(t,n):px}function gx(e){return function(t,n){return[(t+=e)>wy?t-Oy:t<-wy?t+Oy:t,n]}}function vx(e){var t=gx(e);return t.invert=gx(-e),t}function yx(e,t){var n=Ny(e),r=Py(e),i=Ny(t),o=Py(t);function a(e,t){var a=Ny(t),u=Ny(e)*a,s=Py(e)*a,l=Py(t),c=l*n+u*r;return[Ay(s*i-c*o,u*n-l*r),$y(c*i+s*o)]}return a.invert=function(e,t){var a=Ny(t),u=Ny(e)*a,s=Py(e)*a,l=Py(t),c=l*i-s*o;return[Ay(s*i+l*o,u*n+c*r),$y(c*n-u*r)]},a}px.invert=px;function bx(e,t,n,r,i,o){if(n){var a=Ny(t),u=Py(t),s=r*n;null==i?(i=t+r*Oy,o=t-s/2):(i=xx(a,i),o=xx(a,o),(r>0?io)&&(i+=r*Oy));for(var l,c=i;r>0?c>o:c0,i=Sy(t)>1e-6;function o(e,n){return Ny(e)*Ny(n)>t}function a(e,n,r){var i=[1,0,0],o=Jb(Xb(e),Xb(n)),a=Kb(o,o),u=o[0],s=a-u*u;if(!s)return!r&&e;var l=t*a/s,c=-t*u/s,f=Jb(i,o),d=Zb(i,l);Qb(d,Zb(o,c));var h=f,p=Kb(d,h),m=Kb(h,h),g=p*p-m*(Kb(d,d)-1);if(!(g<0)){var v=zy(g),y=Zb(h,(-p-v)/m);if(Qb(y,d),y=Gb(y),!r)return y;var b,x=e[0],w=n[0],_=e[1],E=n[1];w0^y[1]<(Sy(y[0]-x)<1e-6?_:E):_<=y[1]&&y[1]<=E:O>wy^(x<=y[0]&&y[0]<=w)){var j=Zb(h,(-p+v)/m);return Qb(j,d),[y,Gb(j)]}}}function u(t,n){var i=r?e:wy-e,o=0;return t<-i?o|=1:t>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return lx(o,(function(e){var t,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=r?m?0:u(f,d):m?u(f+(f<0?wy:-wy),d):0;if(!t&&(l=s=m)&&e.lineStart(),m!==s&&(!(h=a(t,p))||Wb(t,h)||Wb(p,h))&&(p[0]+=1e-6,p[1]+=1e-6,m=o(p[0],p[1])),m!==s)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]),e.lineEnd()),t=h;else if(i&&t&&r^m){var v;g&n||!(v=a(p,t,!0))||(c=0,r?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1])))}!m||t&&Wb(t,p)||e.point(p[0],p[1]),t=p,s=m,n=g},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return c|(l&&s)<<1}}}),(function(t,r,i,o){bx(o,e,n,i,t,r)}),r?[0,-e]:[-wy,e-wy])};function _x(e,t,n,r){function i(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function o(i,o,u,l){var c=0,f=0;if(null==i||(c=a(i,u))!==(f=a(o,u))||s(i,o)<0^u>0)do{l.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+u+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return Sy(r[0]-e)<1e-6?i>0?0:3:Sy(r[0]-n)<1e-6?i>0?2:1:Sy(r[1]-t)<1e-6?i>0?1:0:i>0?3:2}function u(e,t){return s(e.x,t.x)}function s(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r: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 s,l,c,f,d,h,p,m,g,v,y,b=a,x=qb(),w={point:_,lineStart:function(){w.point=E,l&&l.push(c=[]);v=!0,g=!1,p=m=NaN},lineEnd:function(){s&&(E(f,d),h&&g&&x.rejoin(),s.push(x.result()));w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,s=[],l=[],y=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=l.length;nr&&(d-o)*(r-a)>(h-a)*(e-o)&&++t:h<=r&&(d-o)*(r-a)<(h-a)*(e-o)&&--t;return t}(),n=y&&t,i=(s=sx(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Yb(s,u,t,o,a),a.polygonEnd());b=a,s=l=c=null}};function _(e,t){i(e,t)&&b.point(e,t)}function E(o,a){var u=i(o,a);if(l&&c.push([o,a]),v)f=o,d=a,h=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var s=[p=Math.max(-1e9,Math.min(1e9,p)),m=Math.max(-1e9,Math.min(1e9,m))],x=[o=Math.max(-1e9,Math.min(1e9,o)),a=Math.max(-1e9,Math.min(1e9,a))];!function(e,t,n,r,i,o){var a,u=e[0],s=e[1],l=0,c=1,f=t[0]-u,d=t[1]-s;if(a=n-u,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-u,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-s,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>l&&(l=a)}else if(d>0){if(a0&&(e[0]=u+l*f,e[1]=s+l*d),c<1&&(t[0]=u+c*f,t[1]=s+c*d),!0}}}}}(s,x,e,t,n,r)?u&&(b.lineStart(),b.point(o,a),y=!1):(g||(b.lineStart(),b.point(s[0],s[1])),b.point(x[0],x[1]),u||b.lineEnd(),y=!1)}p=o,m=a,g=u}return w}}function Ex(e){return function(t){var n=new Ox;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Ox(){}function kx(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),gy(n,e.stream(sb)),t(sb.result()),null!=r&&e.clipExtent(r),e}function jx(e,t,n){return kx(e,(function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,u=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,u])}),n)}function Sx(e,t,n){return jx(e,[[0,0],t],n)}function Cx(e,t,n){return kx(e,(function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])}),n)}function Ax(e,t,n){return kx(e,(function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])}),n)}Ox.prototype={constructor:Ox,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 Nx=Ny(30*jy),Tx=function(e,t){return+t?function(e,t){function n(r,i,o,a,u,s,l,c,f,d,h,p,m,g){var v=l-r,y=c-i,b=v*v+y*y;if(b>4*t&&m--){var x=a+d,w=u+h,_=s+p,E=zy(x*x+w*w+_*_),O=$y(_/=E),k=Sy(Sy(_)-1)<1e-6||Sy(o-f)<1e-6?(o+f)/2:Ay(w,x),j=e(k,O),S=j[0],C=j[1],A=S-r,N=C-i,T=y*A-v*N;(T*T/b>t||Sy((v*A+y*N)/b-.5)>.3||a*d+u*h+s*p2?e[2]%360*jy:0,S()):[g*ky,v*ky,y*ky]},k.angle=function(e){return arguments.length?(b=e%360*jy,S()):b*ky},k.precision=function(e){return arguments.length?(a=Tx(u,O=e*e),C()):zy(O)},k.fitExtent=function(e,t){return jx(k,e,t)},k.fitSize=function(e,t){return Sx(k,e,t)},k.fitWidth=function(e,t){return Cx(k,e,t)},k.fitHeight=function(e,t){return Ax(k,e,t)},function(){return t=e.apply(this,arguments),k.invert=t.invert&&j,S()}}function zx(e){var t=0,n=wy/3,r=Rx(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*jy,n=e[1]*jy):[t*ky,n*ky]},i}function Lx(e,t){var n=Py(e),r=(n+Py(t))/2;if(Sy(r)<1e-6)return function(e){var t=Ny(e);function n(e,n){return[e*t,Py(n)/t]}return n.invert=function(e,n){return[e/t,$y(n*t)]},n}(e);var i=1+n*(2*r-n),o=zy(i)/r;function a(e,t){var n=zy(i-2*r*Py(t))/r;return[n*Py(e*=r),o-n*Ny(e)]}return a.invert=function(e,t){var n=o-t;return[Ay(e,Sy(n))/r*Ry(n),$y((i-(e*e+n*n)*r*r)/(2*r))]},a}var Ix=function(){return zx(Lx).scale(155.424).center([0,33.6442])},$x=function(){return Ix().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])};function Bx(e){return function(t,n){var r=Ny(t),i=Ny(n),o=e(r*i);return[o*i*Py(t),o*Py(n)]}}function Ux(e){return function(t,n){var r=zy(t*t+n*n),i=e(r),o=Py(i),a=Ny(i);return[Ay(t*o,r*a),$y(r&&n*o/r)]}}var qx=Bx((function(e){return zy(2/(1+e))}));qx.invert=Ux((function(e){return 2*$y(e/2)}));var Wx=Bx((function(e){return(e=Iy(e))&&e/Py(e)}));Wx.invert=Ux((function(e){return e}));function Hx(e,t){return[e,My(Ly((_y+t)/2))]}Hx.invert=function(e,t){return[e,2*Cy(Dy(t))-_y]};function Yx(e){var t,n,r,i=Px(e),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,l=null;function c(){var o=wy*a(),u=i(function(e){function t(t){return(t=e(t[0]*jy,t[1]*jy))[0]*=ky,t[1]*=ky,t}return e=mx(e[0]*jy,e[1]*jy,e.length>2?e[2]*jy:0),t.invert=function(t){return(t=e.invert(t[0]*jy,t[1]*jy))[0]*=ky,t[1]*=ky,t},t}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:e===Hx?[[Math.max(u[0]-o,l),t],[Math.min(u[0]+o,n),r]]:[[l,Math.max(u[1]-o,t)],[n,Math.min(u[1]+o,r)]])}return i.scale=function(e){return arguments.length?(a(e),c()):a()},i.translate=function(e){return arguments.length?(u(e),c()):u()},i.center=function(e){return arguments.length?(o(e),c()):o()},i.clipExtent=function(e){return arguments.length?(null==e?l=t=n=r=null:(l=+e[0][0],t=+e[0][1],n=+e[1][0],r=+e[1][1]),c()):null==l?null:[[l,t],[n,r]]},c()}function Vx(e){return Ly((_y+e)/2)}function Gx(e,t){var n=Ny(e),r=e===t?Py(e):My(n/Ny(t))/My(Vx(t)/Vx(e)),i=n*Fy(Vx(e),r)/r;if(!r)return Hx;function o(e,t){i>0?t<1e-6-_y&&(t=1e-6-_y):t>_y-1e-6&&(t=_y-1e-6);var n=i/Fy(Vx(t),r);return[n*Py(r*e),i-n*Ny(r*e)]}return o.invert=function(e,t){var n=i-t,o=Ry(r)*zy(e*e+n*n);return[Ay(e,Sy(n))/r*Ry(n),2*Cy(Fy(i/o,1/r))-_y]},o}function Xx(e,t){return[e,t]}Xx.invert=Xx;function Kx(e,t){var n=Ny(e),r=e===t?Py(e):(n-Ny(t))/(t-e),i=n/r+e;if(Sy(r)<1e-6)return Xx;function o(e,t){var n=i-t,o=r*e;return[n*Py(o),i-n*Ny(o)]}return o.invert=function(e,t){var n=i-t;return[Ay(e,Sy(n))/r*Ry(n),i-Ry(r)*zy(e*e+n*n)]},o}var Jx=1.340264,Qx=-.081106,Zx=893e-6,ew=.003796,tw=zy(3)/2;function nw(e,t){var n=$y(tw*Py(t)),r=n*n,i=r*r*r;return[e*Ny(n)/(tw*(Jx+3*Qx*r+i*(7*Zx+9*ew*r))),n*(Jx+Qx*r+i*(Zx+ew*r))]}nw.invert=function(e,t){for(var n,r=t,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(Jx+Qx*i+o*(Zx+ew*i))-t)/(Jx+3*Qx*i+o*(7*Zx+9*ew*i)))*r)*i*i,!(Sy(n)<1e-12));++a);return[tw*e*(Jx+3*Qx*i+o*(7*Zx+9*ew*i))/Ny(r),$y(Py(r)/tw)]};function rw(e,t){var n=Ny(t),r=Ny(e)*n;return[n*Py(e)/r,Py(t)/r]}rw.invert=Ux(Cy);function iw(e,t,n,r){return 1===e&&1===t&&0===n&&0===r?cy:Ex({point:function(i,o){this.stream.point(i*e+n,o*t+r)}})}function ow(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}ow.invert=function(e,t){var n,r=t,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Sy(n)>1e-6&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]};function aw(e,t){return[Ny(t)*Py(e),Py(t)]}aw.invert=Ux($y);function uw(e,t){var n=Ny(t),r=1+Ny(e)*n;return[n*Py(e)/r,Py(t)/r]}uw.invert=Ux((function(e){return 2*Cy(e)}));function sw(e,t){return[My(Ly((_y+t)/2)),-e]}sw.invert=function(e,t){return[-t,2*Cy(Dy(e))-_y]};var lw=Math.abs,cw=(Math.atan,Math.atan2,Math.ceil,Math.cos),fw=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),dw=(Math.tan,Math.PI),hw=dw/2,pw=(Math.SQRT1_2,gw(2));gw(dw);function mw(e){return e>1?hw:e<-1?-hw:Math.asin(e)}function gw(e){return e>0?Math.sqrt(e):0}function vw(e,t){var n,r=e*fw(t),i=30;do{t-=n=(t+fw(t)-r)/(1+cw(t))}while(lw(n)>1e-6&&--i>0);return t/2}var yw=function(e,t,n){function r(r,i){return[e*r*cw(i=vw(n,i)),t*fw(i)]}return r.invert=function(r,i){return i=mw(i/t),[r/(e*cw(i)),mw((2*i+fw(2*i))/n)]},r}(pw/hw,pw,dw),bw=Ub(),xw=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function ww(e,t){return function n(){var r=t();return r.type=e,r.path=Ub().projection(r),r.copy=r.copy||function(){var e=n();return xw.forEach((function(t){r[t]&&e[t](r[t]())})),e.path.pointRadius(r.path.pointRadius()),e},r}}function _w(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Ow[e]=ww(e,t),this):Ow[e]||null}function Ew(e){return e&&e.path||bw}var Ow={albers:$x,albersusa:function(){var e,t,n,r,i,o,a=$x(),u=Ix().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Ix().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={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||(r.point(t,a),o)||(i.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(e)},c.stream=function(n){return e&&t===n?e:(r=[a.stream(t=n),u.stream(n),s.stream(n)],i=r.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(var kw in Ow)_w(kw,Ow[kw]);function jw(e){Dr.call(this,null,e)}function Sw(e){Dr.call(this,null,e)}function Cw(e){Dr.call(this,null,e)}function Aw(e,t,n){var r=ux(e,t-1e-6,n).concat(t);return function(e){return r.map((function(t){return[e,t]}))}}function Nw(e,t,n){var r=ux(e,t-1e-6,n).concat(t);return function(e){return r.map((function(t){return[t,e]}))}}function Tw(){var e,t,n,r,i,o,a,u,s,l,c,f,d=10,h=d,p=90,m=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return ux(Ty(r/p)*p,n,p).map(c).concat(ux(Ty(u/m)*m,a,m).map(f)).concat(ux(Ty(t/d)*d,e,d).filter((function(e){return Sy(e%p)>1e-6})).map(s)).concat(ux(Ty(o/h)*h,i,h).filter((function(e){return Sy(e%m)>1e-6})).map(l))}return v.lines=function(){return y().map((function(e){return{type:"LineString",coordinates:e}}))},v.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(u).reverse().slice(1))]}},v.extent=function(e){return arguments.length?v.extentMajor(e).extentMinor(e):v.extentMinor()},v.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],u=+e[0][1],a=+e[1][1],r>n&&(e=r,r=n,n=e),u>a&&(e=u,u=a,a=e),v.precision(g)):[[r,u],[n,a]]},v.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),o>i&&(n=o,o=i,i=n),v.precision(g)):[[t,o],[e,i]]},v.step=function(e){return arguments.length?v.stepMajor(e).stepMinor(e):v.stepMinor()},v.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],v):[p,m]},v.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],v):[d,h]},v.precision=function(d){return arguments.length?(g=+d,s=Aw(o,i,90),l=Nw(t,e,g),c=Aw(u,a,90),f=Nw(r,n,g),v):g},v.extentMajor([[-180,1e-6-90],[180,90-1e-6]]).extentMinor([[-180,-80-1e-6],[180,80+1e-6]])}function Dw(e){Dr.call(this,[],e),this.generator=Tw()}function Mw(e){Dr.call(this,null,e)}function Fw(e){if(!Object(oe.D)(e))return!1;const t=Object(oe.cb)(Object(oe.g)(e));return t.$x||t.$y||t.$value||t.$max}function Pw(e){Dr.call(this,null,e),this.modified(!0)}function Rw(e,t,n){Object(oe.D)(e[t])&&e[t](n)}jw.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"}]},Object(oe.y)(jw,Dr).transform=function(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||oe.x,o=e.as||"path",a=n.SOURCE;!r||e.modified()?(this.value=r=Ew(e.projection),n.materialize().reflow()):a=i===oe.x||t.modified(i.fields)?n.ADD_MOD:n.ADD;var u=function(e,t){var n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(r,e.pointRadius);return n.visit(a,(function(e){e[o]=r(i(e))})),r.pointRadius(u),n.modifies(o)},Sw.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"]}]},Object(oe.y)(Sw,Dr).transform=function(e,t){var n,r=e.projection,i=e.fields[0],o=e.fields[1],a=e.as||["x","y"],u=a[0],s=a[1];function l(e){var t=r([i(e),o(e)]);t?(e[u]=t[0],e[s]=t[1]):(e[u]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(n=t.modified(i.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,l)),t.modifies(a)},Cw.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"}]},Object(oe.y)(Cw,Dr).transform=function(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||"shape",o=n.ADD;return r&&!e.modified()||(this.value=r=function(e,t,n){var r=null==n?function(n){return e(t(n))}:function(r){var i=e.pointRadius(),o=e.pointRadius(n)(t(r));return e.pointRadius(i),o};return r.context=function(t){return e.context(t),r},r}(Ew(e.projection),e.field||Object(oe.t)("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(function(e){e[i]=r})),n.modifies(i)},Dw.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}]},Object(oe.y)(Dw,Dr).transform=function(e,t){var n,r=this.value,i=this.generator;if(!r.length||e.modified())for(var o in e)Object(oe.D)(i[o])&&i[o](e[o]);return n=i(),r.length?t.mod.push(ge(r[0],n)):t.add.push(he(n)),r[0]=n,t},Mw.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"}]},Object(oe.y)(Mw,Dr).transform=function(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r="shared"===e.resolve,i=e.field||oe.x,o=function(e,t){let n;Object(oe.D)(e)?(n=n=>e(n,t),n.dep=Fw(e)):e?n=Object(oe.l)(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),a=function(e,t){let n;Object(oe.D)(e)?(n=n=>Np(e(n,t)),n.dep=Fw(e)):n=Object(oe.l)(Np(e||"#888"));return n}(e.color,e),u=e.as||"image",s={$x:0,$y:0,$value:0,$max:r?Vr(n.map(e=>Vr(i(e).values))):0};return n.forEach(e=>{const t=i(e),n=Object(oe.o)({},e,s);r||(n.$max=Vr(t.values||[])),e[u]=function(e,t,n,r){const i=e.width,o=e.height,a=e.x1||0,u=e.y1||0,s=e.x2||i,l=e.y2||o,c=e.values,f=c?e=>c[e]:oe.jb,d=Gu(s-a,l-u),h=d.getContext("2d"),p=h.getImageData(0,0,s-a,l-u),m=p.data;for(let e=u,o=0;ee.concat(function(e){return"FeatureCollection"===e.type?e.features:Object(oe.i)(e).filter(e=>null!=e).map(e=>"Feature"===e.type?e:{type:"Feature",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)};function zw(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o,a,u,s,l,c,f,d,h=e._root,p={data:r},m=e._x0,g=e._y0,v=e._x1,y=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((l=t>=(o=(m+v)/2))?m=o:v=o,(c=n>=(a=(g+y)/2))?g=a:y=a,i=h,!(h=h[f=c<<1|l]))return i[f]=p,e;if(u=+e._x.call(null,h.data),s=+e._y.call(null,h.data),t===u&&n===s)return p.next=h,i?i[f]=p:e._root=p,e;do{i=i?i[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(m+v)/2))?m=o:v=o,(c=n>=(a=(g+y)/2))?g=a:y=a}while((f=c<<1|l)==(d=(s>=a)<<1|u>=o));return i[d]=h,i[f]=p,e}var Lw=function(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i};function Iw(e){return e[0]}function $w(e){return e[1]}function Bw(e,t,n){var r=new Uw(null==t?Iw:t,null==n?$w:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}function Uw(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function qw(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ww=Bw.prototype=Uw.prototype;Ww.copy=function(){var e,t,n=new Uw(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=qw(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var i=0;i<4;++i)(t=r.source[i])&&(t.length?e.push({source:t,target:r.target[i]=new Array(4)}):r.target[i]=qw(t));return n},Ww.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return zw(this.cover(t,n),t,n,e)},Ww.addAll=function(e){var t,n,r,i,o=e.length,a=new Array(o),u=new Array(o),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;ne||e>=i||r>t||t>=o;)switch(u=(td||(o=s.y0)>h||(a=s.x1)=v)<<1|e>=g)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=y*y+b*b;if(x=(u=(p+g)/2))?p=u:g=u,(c=a>=(s=(m+v)/2))?m=s:v=s,t=h,!(h=h[f=c<<1|l]))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(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):t?(i?t[f]=i: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=i,this)},Ww.removeAll=function(e){for(var t=0,n=e.length;t=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function t_(e,t){for(var n,r=0,i=e.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&t._call.call(null,e),t=t._next;--a_}()}finally{a_=0,function(){var e,t,n=r_,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:r_=t);i_=e,x_(r)}(),c_=0}}function b_(){var e=d_.now(),t=e-l_;t>1e3&&(f_-=t,l_=e)}function x_(e){a_||(u_&&(u_=clearTimeout(u_)),e-c_>24?(e<1/0&&(u_=setTimeout(y_,e-d_.now()-f_)),s_&&(s_=clearInterval(s_))):(s_||(l_=d_.now(),s_=setInterval(b_,1e3)),a_=1,h_(y_)))}function w_(e){return e.x}function __(e){return e.y}g_.prototype=v_.prototype={constructor:g_,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?p_():+n)+(null==t?0:+t),this._next||i_===this||(i_?i_._next=this:r_=this,i_=this),this._call=e,this._time=n,x_()},stop:function(){this._call&&(this._call=null,this._time=1/0,x_())}};var E_=Math.PI*(3-Math.sqrt(5)),O_={center:function(e,t){var n;function r(){var r,i,o=n.length,a=0,u=0;for(r=0;rs+h||il+h||ou.index){var p=s-a.x-a.vx,m=l-a.y-a.vy,g=p*p+m*m;ge.r&&(e.r=e[t].r)}function u(){if(t){var r,i,o=t.length;for(n=new Array(o),r=0;r=a)){(e.data!==t||e.next)&&(0===c&&(h+=(c=Yw())*c),0===f&&(h+=(f=Yw())*f),h[a(e,t,r),e]));for(u=0,i=new Array(l);u1?(null==n?u.delete(e):u.set(e,h(n)),t):u.get(e)},find:function(t,n,r){var i,o,a,u,s,l=0,c=e.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(e,n),t):l.on(e)}}}(e),r=!1,i=n.stop,o=n.restart;return n.stopped=function(){return r},n.restart=function(){return r=!1,o()},n.stop=function(){return r=!0,i()},N_(n,t,!0).on("end",(function(){r=!0}))}(t.source,e),i.on("tick",(n=t.dataflow,r=this,function(){n.touch(r).run()})),e.static||(o=!0,i.tick()),t.modifies("index")),a||o||e.modified(j_)||t.changed()&&e.restart)if(i.alpha(Math.max(i.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),e.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return t.StopPropagation;return this.finish(e,t)},A_.finish=function(e,t){for(var n,r=t.dataflow,i=this._argops,o=0,a=i.length;o=0;)t+=n[r].value;else t=1;e.value=t}function R_(e,t){var n,r,i,o,a,u=new $_(e),s=+e.value&&(u.value=e.value),l=[u];for(null==t&&(t=z_);n=l.pop();)if(s&&(n.value=+n.data.value),(i=t(n.data))&&(a=i.length))for(n.children=new Array(a),o=a-1;o>=0;--o)l.push(r=n.children[o]=new $_(i[o])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(I_)}function z_(e){return e.children}function L_(e){e.data=e.data.data}function I_(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function $_(e){this.data=e,this.depth=this.height=0,this.parent=null}function B_(e){Dr.call(this,null,e)}function U_(e){return e.values}function q_(){var e,t=[];return e={entries:e=>function e(n,r){if(++r>t.length)return n;var i,o=[];for(i in n)o.push({key:i,values:e(n[i],r)});return o}(function e(n,r){if(r>=t.length)return n;for(var i,o,a,u=-1,s=n.length,l=t[r++],c={},f={};++u(t.push(n),e)}}function W_(e){Dr.call(this,null,e)}function H_(e,t){return e.parent===t.parent?1:2}$_.prototype=R_.prototype={constructor:$_,count:function(){return this.eachAfter(P_)},each:function(e){var t,n,r,i,o=this,a=[o];do{for(t=a.reverse(),a=[];o=t.pop();)if(e(o),n=o.children)for(r=0,i=n.length;r=0;--n)i.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].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(),r=t.ancestors(),i=null;e=n.pop(),t=r.pop();for(;e===t;)i=e,e=n.pop(),t=r.pop();return i}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},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 R_(this).eachBefore(L_)}},B_.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},Object(oe.y)(B_,Dr).transform=function(e,t){t.source||Object(oe.n)("Nest transform requires an upstream data source.");var n=e.generate,r=e.modified(),i=t.clone(),o=this.value;return(!o||r||t.changed())&&(o&&o.each(e=>{e.children&&ce(e.data)&&i.rem.push(e.data)}),this.value=o=R_({values:Object(oe.i)(e.keys).reduce((e,t)=>(e.key(t),e),q_()).entries(i.source)},U_),n&&o.each(e=>{e.children&&(e=he(e.data),i.add.push(e),i.source.push(e))}),F_(o,fe,fe)),i.source.root=o,i},Object(oe.y)(W_,Dr).transform=function(e,t){t.source&&t.source.root||Object(oe.n)(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(e.method),r=this.fields,i=t.source.root,o=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(ve(e.sort,e=>e.data)),function(e,t,n){for(var r,i=0,o=t.length;i0&&n*n>r*r+i*i}function J_(e,t){for(var n=0;n(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=e.x-r*u-o*s,n.y=e.y-r*s+o*u):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=t.x+r*u-o*s,n.y=t.y+r*s+o*u)):(n.x=t.x+n.r,n.y=t.y)}function nE(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function rE(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,o=(t.y*n.r+n.y*t.r)/r;return i*i+o*o}function iE(e){this._=e,this.next=null,this.previous=null}function oE(e){if(!(i=e.length))return 0;var t,n,r,i,o,a,u,s,l,c,f;if((t=e[0]).x=0,t.y=0,!(i>1))return t.r;if(n=e[1],t.x=-n.r,n.x=t.r,n.y=0,!(i>2))return t.r+n.r;tE(n,t,r=e[2]),t=new iE(t),n=new iE(n),r=new iE(r),t.next=r.previous=n,n.next=t.previous=r,r.next=n.previous=t;e:for(u=3;u0)throw new Error("cycle");return o}return n.id=function(t){return arguments.length?(e=uE(t),n):e},n.parentId=function(e){return arguments.length?(t=uE(e),n):t},n};function SE(e){Dr.call(this,null,e)}function CE(e,t){return e.parent===t.parent?1:2}function AE(e){var t=e.children;return t?t[0]:e.t}function NE(e){var t=e.children;return t?t[t.length-1]:e.t}function TE(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function DE(e,t,n){return e.a.parent===t.parent?e.a:n}function ME(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}SE.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},Object(oe.y)(SE,Dr).transform=function(e,t){t.source||Object(oe.n)("Stratify transform requires an upstream data source.");var n=this.value,r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),o=!this.value||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),o&&(n=i.source.length?F_(jE().id(e.key).parentId(e.parentKey)(i.source),e.key,oe.fb):F_(jE()([{}]),e.key,e.key)),i.source.root=this.value=n,i},ME.prototype=Object.create($_.prototype);function FE(e,t){return e.parent===t.parent?1:2}function PE(e,t){return e+t.x}function RE(e,t){return Math.max(e,t.y)}var zE={tidy:function(){var e=CE,t=1,n=1,r=null;function i(i){var s=function(e){for(var t,n,r,i,o,a=new ME(e,0),u=[a];t=u.pop();)if(r=t._.children)for(t.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(n=t.children[i]=new ME(r[i],i)),n.parent=t;return(a.parent=new ME(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var l=i,c=i,f=i;i.eachBefore((function(e){e.xc.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=l===c?1:e(l,c)/2,h=d-l.x,p=t/(c.x+d+h),m=n/(f.depth||1);i.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return i}function o(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,i=e.children,o=i.length;--o>=0;)(t=i[o]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,a=t,u=n,s=o.parent.children[0],l=o.m,c=a.m,f=u.m,d=s.m;u=NE(u),o=AE(o),u&&o;)s=AE(s),(a=NE(a)).a=t,(i=u.z+f-o.z-l+e(u._,o._))>0&&(TE(DE(u,t,r),t,i),l+=i,c+=i),f+=u.m,l+=o.m,d+=s.m,c+=a.m;u&&!NE(a)&&(a.t=u,a.m+=f-c),o&&!AE(s)&&(s.t=o,s.m+=l-d,r=t)}return r}(t,i,t.parent.A||r[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function u(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i},cluster:function(){var e=FE,t=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(PE,0)/e.length}(n),t.y=function(e){return 1+e.reduce(RE,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var u=function(e){for(var t;t=e.children;)e=t[0];return e}(i),s=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(i),l=u.x-e(u,s)/2,c=s.x+e(s,u)/2;return i.eachAfter(r?function(e){e.x=(e.x-i.x)*t,e.y=(i.y-e.y)*n}:function(e){e.x=(e.x-l)/(c-l)*t,e.y=(1-(i.y?e.y/i.y:1))*n})}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}},LE=["x","y","depth","children"];function IE(e){W_.call(this,e)}IE.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:LE.length,default:LE}]};var $E=Object(oe.y)(IE,W_);function BE(e){Dr.call(this,[],e)}$E.layout=function(e){var t=e||"tidy";if(Object(oe.v)(zE,t))return zE[t]();Object(oe.n)("Unrecognized Tree layout method: "+t)},$E.params=["size","nodeSize"],$E.fields=LE,BE.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},Object(oe.y)(BE,Dr).transform=function(e,t){var n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),o={};return r||Object(oe.n)("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,(function(e){o[fe(e)]=1})),r.each((function(e){var t=e.data,n=e.parent&&e.parent.data;n&&o[fe(t)]&&o[fe(n)]&&i.add.push(he({source:n,target:t}))})),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,(function(e){o[fe(e)]=1})),n.forEach((function(e){(o[fe(e.source)]||o[fe(e.target)])&&i.mod.push(e)}))),i};var UE=function(e,t,n,r,i){for(var o,a=e.children,u=-1,s=a.length,l=e.value&&(i-n)/e.value;++ud&&(d=u),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=u;break}p=h}v.push(a={value:c,dice:s1?t:1)},n}(qE),YE=function e(t){function n(e,n,r,i,o){if((a=e._squarify)&&a.ratio===t)for(var a,u,s,l,c,f=-1,d=a.length,h=e.value;++f1?t:1)},n}(qE),VE={binary:function(e,t,n,r,i){var o,a,u=e.children,s=u.length,l=new Array(s+1);for(l[0]=a=o=0;o=n-1){var c=u[t];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=s)}var f=l[t],d=r/2+f,h=t+1,p=n-1;for(;h>>1;l[m]s-o){var y=(i*v+a*g)/r;e(t,h,g,i,o,y,s),e(h,n,v,y,o,a,s)}else{var b=(o*v+s*g)/r;e(t,h,g,i,o,a,b),e(h,n,v,i,b,a,s)}}(0,s,e.value,t,n,r,i)},dice:yE,slice:UE,slicedice:function(e,t,n,r,i){(1&e.depth?UE:yE)(e,t,n,r,i)},squarify:HE,resquarify:YE},GE=["x0","y0","x1","y1","depth","children"];function XE(e){W_.call(this,e)}XE.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:GE.length,default:GE}]};var KE=Object(oe.y)(XE,W_);KE.layout=function(){var e=function(){var e=HE,t=!1,n=1,r=1,i=[0],o=sE,a=sE,u=sE,s=sE,l=sE;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(f),i=[0],t&&e.eachBefore(vE),e}function f(t){var n=i[t.depth],r=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f{$i(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{const n={};for(let e=0;e{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const r=c(n,e.x,e.y,u);if(e.params)return void f.push(he({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||Object(oe.p)(n,e.x),h=e=>{const t={};for(let e=0;eh([e,r.predict(e)])):Wi(r.predict,i,25,200).forEach(h)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n};const tO=Math.pow(2,-52),nO=new Uint32Array(512);class rO{static from(e,t=fO,n=dO){const r=e.length,i=new Float64Array(2*r);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:r,_hullHash:i}=this,o=e.length>>1;let a=1/0,u=1/0,s=-1/0,l=-1/0;for(let t=0;ts&&(s=n),r>l&&(l=r),this._ids[t]=t}const c=(a+s)/2,f=(u+l)/2;let d,h,p,m=1/0;for(let t=0;t0&&(h=t,m=n)}let y=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;tr&&(t[n++]=i,r=this._dists[i])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(aO(g,v,y,b,w,_)){const e=h,t=y,n=b;h=p,y=w,b=_,p=e,w=t,_=n}const E=function(e,t,n,r,i,o){const a=n-e,u=r-t,s=i-e,l=o-t,c=a*a+u*u,f=s*s+l*l,d=.5/(a*l-u*s);return{x:e+(l*c-u*f)*d,y:t+(a*f-s*c)*d}}(g,v,y,b,w,_);this._cx=E.x,this._cy=E.y;for(let t=0;t0&&Math.abs(l-o)<=tO&&Math.abs(c-a)<=tO)continue;if(o=l,a=c,s===d||s===h||s===p)continue;let f=0;for(let e=0,t=this._hashKey(l,c);e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[e],u=e-e%3;if(o=u+(e+2)%3,-1===a){if(0===i)break;e=nO[--i];continue}const s=a-a%3,l=u+(e+1)%3,c=s+(a+2)%3,f=t[o],d=t[e],h=t[l],p=t[c];if(uO(r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1])){t[e]=p,t[a]=f;const r=n[c];if(-1===r){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,r),this._link(a,n[o]),this._link(o,c);const u=s+(a+1)%3;i=33306690738754716e-32*Math.abs(a+u)?a-u:0}function aO(e,t,n,r,i,o){return(oO(i,o,e,t,n,r)||oO(e,t,n,r,i,o)||oO(n,r,i,o,e,t))<0}function uO(e,t,n,r,i,o,a,u){const s=e-a,l=t-u,c=n-a,f=r-u,d=i-a,h=o-u,p=c*c+f*f,m=d*d+h*h;return s*(f*m-p*h)-l*(c*m-p*d)+(s*s+l*l)*(c*h-f*d)<0}function sO(e,t,n,r,i,o){const a=n-e,u=r-t,s=i-e,l=o-t,c=a*a+u*u,f=s*s+l*l,d=.5/(a*l-u*s),h=(l*c-u*f)*d,p=(a*f-s*c)*d;return h*h+p*p}function lO(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=e[i],o=t[r];let a=i-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=r}else{let i=n+1,o=r;cO(e,n+r>>1,i),t[e[n]]>t[e[r]]&&cO(e,n,r),t[e[i]]>t[e[r]]&&cO(e,i,r),t[e[n]]>t[e[i]]&&cO(e,n,i);const a=e[i],u=t[a];for(;;){do{i++}while(t[e[i]]u);if(o=o-n?(lO(e,t,i,r),lO(e,t,n,o-1)):(lO(e,t,n,o-1),lO(e,t,i,r))}}function cO(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function fO(e){return e[0]}function dO(e){return e[1]}class hO{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 r=(e=+e)+(n=+n),i=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class pO{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 mO{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t)&&(i=+i)>=(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=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let t,r,o=0,a=0,u=n.length;o1;)i-=2;for(let e=2;e4)for(let e=0;e0){if(t>=this.ymax)return null;(i=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(i=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}}const gO=2*Math.PI;function vO(e){return e[0]}function yO(e){return e[1]}function bO(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class xO{constructor(e){this._delaunator=new rO(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&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],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.sqrt((r[3]-r[1])**2+(r[2]-r[0])**2);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]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],o[r[0]]=1,2===r.length&&(o[r[1]]=0))}voronoi(e){return new mO(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:o}=this;if(this.collinear){const t=this.collinear.indexOf(e);return t>0&&(yield this.collinear[t-1]),void(t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[e]||!s.length)return(e+1)%(s.length>>1);let l=e,c=(t-s[2*e])**2+(n-s[2*e+1])**2;const f=r[e];let d=f;do{let r=u[d];const f=(t-s[2*r])**2+(n-s[2*r+1])**2;if(f=h));)if(t.x=f+i,t.y=d+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>u[0]||t.y+t.y1>u[1]||n&&CO(t,e,u[0])||n&&(l=n,!((a=t).x+a.x1>l[0].x&&a.x+a.x0l[0].y&&a.y+a.y0>5,x=u[0]>>5,w=t.x-(b<<4),_=127&w,E=32-_,O=t.y1-t.y0,k=(t.y+t.y0)*x+(w>>5),j=0;j>>_:0);k+=x}return t.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=2048/t,e.height=2048/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Gu()),f=function(e){var t=[],n=-1;for(;++n>5)*u[1]),h=null,p=l.length,m=-1,g=[],v=l.map((function(u){return{text:e(u),font:t(u),style:r(u),weight:i(u),rotate:o(u),size:~~(n(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}})).sort((function(e,t){return t.size-e.size}));++m>1,y.y=u[1]*(c()+.5)>>1,SO(s,y,v,m),y.hasText&&d(f,y,h)&&(g.push(y),h?AO(h,y):h=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},f.words=function(e){return arguments.length?(l=e,f):l},f.size=function(e){return arguments.length?(u=[+e[0],+e[1]],f):u},f.font=function(e){return arguments.length?(t=TO(e),f):t},f.fontStyle=function(e){return arguments.length?(r=TO(e),f):r},f.fontWeight=function(e){return arguments.length?(i=TO(e),f):i},f.rotate=function(e){return arguments.length?(o=TO(e),f):o},f.text=function(t){return arguments.length?(e=TO(t),f):e},f.spiral=function(e){return arguments.length?(s=DO[e]||e,f):s},f.fontSize=function(e){return arguments.length?(n=TO(e),f):n},f.padding=function(e){return arguments.length?(a=TO(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f};function SO(e,t,n,r){if(!t.sprite){var i=e.context,o=e.ratio;i.clearRect(0,0,2048/o,2048/o);var a,u,s,l,c,f=0,d=0,h=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else a=a+31>>5<<5;if(s>h&&(h=s),f+a>=2048&&(f=0,d+=h,h=0),d+s>=2048)break;i.translate((f+(a>>1))/o,(d+(s>>1))/o),t.rotate&&i.rotate(t.rotate*kO),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=a,t.height=s,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=s>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var w=i.getImageData(0,0,2048/o,2048/o).data,_=[];--r>=0;)if((t=n[r]).hasText){for(u=(a=t.width)>>5,s=t.y1-t.y0,l=0;l>5),j=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;_[k]|=j,E|=j}E?O=c:(t.y0++,s--,c--,d++)}t.y1=t.y0+O,t.sprite=_.slice(0,(t.y1-t.y0)*u)}}}function CO(e,t,n){n>>=5;for(var r,i=e.sprite,o=e.width>>5,a=e.x-(o<<4),u=127&a,s=32-u,l=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f>>u:0))&t[c+d])return!0;c+=n}return!1}function AO(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function NO(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function TO(e){return"function"==typeof e?e:function(){return e}}var DO={archimedean:NO,rectangular:function(e){var t=4*e[0]/e[1],n=0,r=0;return function(e){var i=e<0?-1:1;switch(Math.sqrt(1+4*i*e)-i&3){case 0:n+=t;break;case 1:r+=4;break;case 2:n-=t;break;default:r-=4}return[n,r]}}},MO=["x","y","font","fontSize","fontStyle","fontWeight","angle"],FO=["text","font","rotate","fontSize","fontStyle","fontWeight"];function PO(e){Dr.call(this,jO(),e)}function RO(e){return new Uint8Array(e)}function zO(e){return new Uint16Array(e)}function LO(e){return new Uint32Array(e)}function IO(e,t,n){var r=(t<257?RO:t<65537?zO:LO)(e);return n&&r.set(n),r}PO.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:MO}]},Object(oe.y)(PO,Dr).transform=function(e,t){!e.size||e.size[0]&&e.size[1]||Object(oe.n)("Wordcloud size dimensions must be non-zero.");var n=e.modified();if(n||t.changed(t.ADD_REM)||FO.some((function(n){var r=e[n];return Object(oe.D)(r)&&t.modified(r.fields)}))){var r,i=t.materialize(t.SOURCE).source,o=this.value,a=e.as||MO,u=e.fontSize||14;if(Object(oe.D)(u)?r=e.fontSizeRange:u=Object(oe.l)(u),r){var s=u,l=Gm("sqrt")().domain(Object(oe.p)(i,s)).range(r);u=function(e){return l(s(e))}}i.forEach((function(e){e[a[0]]=NaN,e[a[1]]=NaN,e[a[3]]=0}));for(var c,f,d=o.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(u).random(ni).layout(),h=o.size(),p=h[0]>>1,m=h[1]>>1,g=0,v=d.length;gi?1:0})),function(e,t){return Array.from(t,t=>e[t])}(e,t)}(f,d),l)a=t,u=e,t=Array(l+c),e=LO(l+c),function(e,t,n,r,i,o,a,u,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=t?e:((i=i||new e.constructor(t)).set(e),i);var e,t,i},add:function(e){for(var t,r=0,i=n.length,o=e.length;ri.length||n>t)&&(t=Math.max(n,t),i=IO(e,t,i),o=IO(e,t))}}),e),this._indices=null,this._dims=null}UO.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}}]};var qO=Object(oe.y)(UO,Dr);function WO(e){Dr.call(this,null,e)}qO.transform=function(e,t){return this._dims?e.modified("fields")||e.fields.some((function(e){return t.modified(e.fields)}))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},qO.init=function(e,t){for(var n,r,i=e.fields,o=e.query,a=this._indices={},u=this._dims=[],s=o.length,l=0;lg)for(i=g,o=Math.min(p,v);iv)for(i=Math.max(p,v),o=m;ih)for(i=h,o=Math.min(f,p);ip)for(i=Math.max(f,p),o=d;i",gk[3]="Identifier",gk[4]="Keyword",gk[5]="Null",gk[6]="Numeric",gk[7]="Punctuator",gk[8]="String",gk[9]="RegularExpression";var _k="ILLEGAL",Ek=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]"),Ok=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 kk(e,t){if(!e)throw new Error("ASSERT: "+t)}function jk(e){return e>=48&&e<=57}function Sk(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function Ck(e){return"01234567".indexOf(e)>=0}function Ak(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 Nk(e){return 10===e||13===e||8232===e||8233===e}function Tk(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Ek.test(String.fromCharCode(e))}function Dk(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Ok.test(String.fromCharCode(e))}var Mk={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 Fk(){for(var e;yk1114111||"}"!==e)&&Jk({},"Unexpected token %0",_k),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),r=56320+(t-65536&1023),String.fromCharCode(n,r))}function zk(){var e,t;for(e=vk.charCodeAt(yk++),t=String.fromCharCode(e),92===e&&(117!==vk.charCodeAt(yk)&&Jk({},"Unexpected token %0",_k),++yk,(e=Pk("u"))&&"\\"!==e&&Tk(e.charCodeAt(0))||Jk({},"Unexpected token %0",_k),t=e);yk>>="===(r=vk.substr(yk,4))?{type:7,value:r,start:i,end:yk+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:yk+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:7,value:t,start:i,end:yk+=2}:"<>=!+-*%&|^/".indexOf(a)>=0?{type:7,value:a,start:i,end:++yk}:void Jk({},"Unexpected token %0",_k)}function $k(){var e,t,n;if(kk(jk((n=vk[yk]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=yk,e="","."!==n){if(e=vk[yk++],n=vk[yk],"0"===e){if("x"===n||"X"===n)return++yk,function(e){for(var t="";yk=0&&Jk({},"Invalid regular expression",n),{value:n,literal:t}}(),r=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(e,t){if(parseInt(t,16)<=1114111)return"x";Jk({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Jk({},"Invalid regular expression")}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:yk}}function Uk(){var e;return Fk(),yk>=bk?{type:2,start:yk,end:yk}:Tk(e=vk.charCodeAt(yk))?Lk():40===e||41===e||59===e?Ik():39===e||34===e?function(){var e,t,n,r,i="",o=!1;for(kk("'"===(e=vk[yk])||'"'===e,"String literal must starts with a quote"),t=yk,++yk;yk=0&&yk":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 pj(){var e,t;return e=function(){var e,t,n,r,i,o,a,u,s,l;if(e=xk,s=dj(),0===(i=hj(r=xk)))return s;for(r.prec=i,qk(),t=[e,xk],o=[s,r,a=dj()];(i=hj(xk))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),t.pop(),n=Hk(u,s,a),o.push(n);(r=qk()).prec=i,o.push(r),t.push(xk),n=dj(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=Hk(o[l-1].value,o[l-2],n),l-=2;return n}(),ej("?")&&(qk(),t=pj(),Zk(":"),e=function(e,t,n){var r=new wk("ConditionalExpression");return r.test=e,r.consequent=t,r.alternate=n,r}(e,t,pj())),e}function mj(){var e=pj();if(ej(","))throw new Error("Disabled.");return e}var gj=function(e){yk=0,bk=(vk=e).length,xk=null,Wk();var t=mj();if(2!==xk.type)throw new Error("Unexpect token after expression.");return t},vj={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"},yj=function(e){function t(t,n,r){return function(i){return function(t,n,r,i){var o=e(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(i<0?"":0===i?"()":"("+n.slice(1).map(e).join(",")+")")}(t,i,n,r)}}var n="new Date";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",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&&Object(oe.n)("Missing arguments to clamp function."),t.length>3&&Object(oe.n)("Too many arguments to clamp function.");var 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),join:t("join",null),indexof:t("indexOf",null),lastindexof:t("lastIndexOf",null),slice:t("slice",null),reverse:function(t){return"("+e(t[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase","String",0),lower:t("toLowerCase","String",0),substring:t("substring","String"),split:t("split","String"),replace:t("replace","String"),trim:t("trim","String",0),regexp:"RegExp",test:t("test","RegExp"),if:function(t){t.length<3&&Object(oe.n)("Missing arguments to if function."),t.length>3&&Object(oe.n)("Too many arguments to if function.");var n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}};function bj(e,t){for(var n,r,i=t.fields,o=t.values,a=i.length,u=0;u=0})):t},R_union:function(e,t){var n=Object(oe.bb)(t[0]),r=Object(oe.bb)(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}};function wj(e,t,n,r){"Literal"!==t[0].type&&Object(oe.n)("First argument to selection functions must be a string literal.");const i=t[0].value,o=":"+i;"intersect"!==(t.length>=2&&Object(oe.T)(t).value)||Object(oe.v)(r,"@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),Object(oe.v)(r,o)||(r[o]=n.getData(i).tuplesRef())}function _j(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ej(e){const t=Np(e);return.2126*_j(t.r)+.7152*_j(t.g)+.0722*_j(t.b)}function Oj(e){const t=this.context.data[e];return t?t.values.value:[]}const kj={};function jj(e,t,n){let r=e+":"+n,i=kj[r];return i&&i[0]===t||(kj[r]=i=[t,t(n)]),i[1]}function Sj(e,t){return jj("timeFormat",tu,t)(e)}var Cj=new Date(2e3,0,1);function Aj(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(Cj.setYear(2e3),Cj.setMonth(e),Cj.setDate(t),Sj(Cj,n)):""}function Nj(e,t){let n;return Object(oe.D)(e)?e:Object(oe.H)(e)?(n=t.scales[e])&&n.value:void 0}var Tj,Dj,Mj,Fj,Pj,Rj=vy(),zj=vy(),Lj={point:By,lineStart:By,lineEnd:By,polygonStart:function(){Rj.reset(),Lj.lineStart=Ij,Lj.lineEnd=$j},polygonEnd:function(){var e=+Rj;zj.add(e<0?Oy+e:e),this.lineStart=this.lineEnd=this.point=By},sphere:function(){zj.add(Oy)}};function Ij(){Lj.point=Bj}function $j(){Uj(Tj,Dj)}function Bj(e,t){Lj.point=Uj,Tj=e,Dj=t,Mj=e*=jy,Fj=Ny(t=(t*=jy)/2+Ey),Pj=Py(t)}function Uj(e,t){var n=(e*=jy)-Mj,r=n>=0?1:-1,i=r*n,o=Ny(t=(t*=jy)/2+Ey),a=Py(t),u=Pj*a,s=Fj*o+u*Ny(i),l=u*r*Py(i);Rj.add(Ay(l,s)),Mj=e,Fj=o,Pj=a}var qj,Wj,Hj,Yj,Vj,Gj,Xj,Kj,Jj,Qj,Zj=vy(),eS={point:tS,lineStart:rS,lineEnd:iS,polygonStart:function(){eS.point=oS,eS.lineStart=aS,eS.lineEnd=uS,Zj.reset(),Lj.polygonStart()},polygonEnd:function(){Lj.polygonEnd(),eS.point=tS,eS.lineStart=rS,eS.lineEnd=iS,Rj<0?(qj=-(Hj=180),Wj=-(Yj=90)):Zj>1e-6?Yj=90:Zj<-1e-6&&(Wj=-90),Qj[0]=qj,Qj[1]=Hj},sphere:function(){qj=-(Hj=180),Wj=-(Yj=90)}};function tS(e,t){Jj.push(Qj=[qj=e,Hj=e]),tYj&&(Yj=t)}function nS(e,t){var n=Xb([e*jy,t*jy]);if(Kj){var r=Jb(Kj,n),i=Jb([r[1],-r[0],0],r);ex(i),i=Gb(i);var o,a=e-Vj,u=a>0?1:-1,s=i[0]*ky*u,l=Sy(a)>180;l^(u*VjYj&&(Yj=o):l^(u*Vj<(s=(s+360)%360-180)&&sYj&&(Yj=t)),l?esS(qj,Hj)&&(Hj=e):sS(e,Hj)>sS(qj,Hj)&&(qj=e):Hj>=qj?(eHj&&(Hj=e)):e>Vj?sS(qj,e)>sS(qj,Hj)&&(Hj=e):sS(e,Hj)>sS(qj,Hj)&&(qj=e)}else Jj.push(Qj=[qj=e,Hj=e]);tYj&&(Yj=t),Kj=n,Vj=e}function rS(){eS.point=nS}function iS(){Qj[0]=qj,Qj[1]=Hj,eS.point=tS,Kj=null}function oS(e,t){if(Kj){var n=e-Vj;Zj.add(Sy(n)>180?n+(n>0?360:-360):n)}else Gj=e,Xj=t;Lj.point(e,t),nS(e,t)}function aS(){Lj.lineStart()}function uS(){oS(Gj,Xj),Lj.lineEnd(),Sy(Zj)>1e-6&&(qj=-(Hj=180)),Qj[0]=qj,Qj[1]=Hj,Kj=null}function sS(e,t){return(t-=e)<0?t+360:t}function lS(e,t){return e[0]-t[0]}function cS(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tsS(r[0],r[1])&&(r[1]=i[1]),sS(i[0],r[1])>sS(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];t<=n;r=i,++t)i=o[t],(u=sS(r[1],i[0]))>a&&(a=u,qj=i[0],Hj=r[1])}return Jj=Qj=null,qj===1/0||Wj===1/0?[[NaN,NaN],[NaN,NaN]]:[[qj,Wj],[Hj,Yj]]})),BS=LS("centroid",(function(e){fS=dS=hS=pS=mS=gS=vS=yS=bS=xS=wS=0,gy(e,SS);var t=bS,n=xS,r=wS,i=t*t+n*n+r*r;return i<1e-12&&(t=gS,n=vS,r=yS,dS<1e-6&&(t=hS,n=pS,r=mS),(i=t*t+n*n+r*r)<1e-12)?[NaN,NaN]:[Ay(n,t)*ky,$y(r/zy(i))*ky]}));function US(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function qS(e,t){return e===t||e!=e&&t!=t||(Object(oe.A)(e)?!(!Object(oe.A)(t)||e.length!==t.length)&&function(e,t){for(let n=0,r=e.length;nWS(e,t)}const YS={};function VS(e){return e.data}function GS(e,t){const n=Oj.call(t,e);return n.root&&n.root.lookup||YS}const XS="undefined"!=typeof window&&window||null;function KS(e,t,n,r){"Literal"!==t[0].type&&Object(oe.n)("First argument to data functions must be a string literal.");const i=t[0].value,o=":"+i;if(!Object(oe.v)(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(e){}}function JS(e,t,n,r){if("Literal"===t[0].type)QS(n,r,t[0].value);else if("Identifier"===t[0].type)for(e in n.scales)QS(n,r,e)}function QS(e,t,n){const r="%"+n;if(!Object(oe.v)(t,r))try{t[r]=e.scaleRef(n)}catch(e){}}const ZS={random:function(){return ni()},cumulativeNormal:hi,cumulativeLogNormal:bi,cumulativeUniform:ki,densityNormal:di,densityLogNormal:yi,densityUniform:Oi,quantileNormal:pi,quantileLogNormal:xi,quantileUniform:ji,sampleNormal:fi,sampleLogNormal:vi,sampleUniform:Ei,isArray:oe.A,isBoolean:oe.B,isDate:oe.C,isDefined:function(e){return void 0!==e},isNumber:oe.E,isObject:oe.F,isRegExp:oe.G,isString:oe.H,isTuple:ce,isValid:function(e){return null!=e&&e==e},toBoolean:oe.Z,toDate:oe.ab,toNumber:oe.bb,toString:oe.db,flush:oe.u,lerp:oe.J,merge:function(){var e=[].slice.call(arguments);return e.unshift({}),oe.o.apply(null,e)},pad:oe.O,peek:oe.T,span:oe.W,inrange:oe.z,truncate:oe.eb,rgb:Np,lab:Og,hcl:Tg,hsl:zp,luminance:Ej,contrast:function(e,t){const n=Ej(e),r=Ej(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:Go,format:function(e,t){return jj("format",Xh,t)(e)},utcFormat:function(e,t){return jj("utcFormat",nu,t)(e)},utcParse:function(e,t){return jj("utcParse",Jt,t)(e)},utcOffset:Xa,utcSequence:Qa,timeFormat:Sj,timeParse:function(e,t){return jj("timeParse",Xt,t)(e)},timeOffset:Ga,timeSequence:Ja,timeUnitSpecifier:eu,monthFormat:function(e){return Aj(e,1,"%B")},monthAbbrevFormat:function(e){return Aj(e,1,"%b")},dayFormat:function(e){return Aj(0,2+e,"%A")},dayAbbrevFormat:function(e){return Aj(0,2+e,"%a")},quarter:oe.U,utcquarter:oe.gb,warn:function(){return US(this.context.dataflow,"warn",arguments)},info:function(){return US(this.context.dataflow,"info",arguments)},debug:function(){return US(this.context.dataflow,"debug",arguments)},extent:oe.p,inScope:function(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:function(e,t,n){if(!e)return[];const[r,i]=e,o=(new Iu).set(r[0],r[1],i[0],i[1]);return qd(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=Object(oe.i)(e.marktype),r=Object(oe.i)(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!r.length||r.some(t=>e.name===t))}return t}(t))},clampRange:oe.j,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){return XS?XS.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(){return XS?[XS.innerWidth,XS.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Th(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(oe.fb).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?ul(n,t=t||Ks(e)):e}},panLinear:oe.P,panLog:oe.Q,panPow:oe.R,panSymlog:oe.S,zoomLinear:oe.kb,zoomLog:oe.lb,zoomPow:oe.mb,zoomSymlog:oe.nb,encode:function(e,t,n){if(e){const n=this.context.dataflow,r=e.mark.source;n.pulse(r,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,r,i,o){let a,u,s=this.context.dataflow,l=this.context.data[e],c=l.input,f=l.changes,d=s.stamp();if(!1===s._trigger||!(c.value.length||t||r))return 0;if((!f||f.stampo.stop(l(t),e(t))),o}),JS),nC("geoArea",IS,JS),nC("geoBounds",$S,JS),nC("geoCentroid",BS,JS),nC("geoShape",(function(e,t,n){const r=Nj(e,(n||this).context);return function(e){return r?r.path.context(e)(t):""}}),JS),nC("indata",(function(e,t,n){const r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(e,t,n,r){"Literal"!==t[0].type&&Object(oe.n)("First argument to indata must be a string literal."),"Literal"!==t[1].type&&Object(oe.n)("Second argument to indata must be a string literal.");const i=t[0].value,o=t[1].value,a="@"+o;Object(oe.v)(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),nC("data",Oj,KS),nC("treePath",(function(e,t,n){const r=GS(e,this),i=r[t],o=r[n];return i&&o?i.path(o).map(VS):void 0}),KS),nC("treeAncestors",(function(e,t){const n=GS(e,this)[t];return n?n.ancestors().map(VS):void 0}),KS),nC("vlSelectionTest",(function(e,t,n){for(var r,i,o,a,u,s=this.context.data[e],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,f="intersect"===n,d=l.length,h=0;h(e[i[n].field]=t,e),{}))}return t=t||"union",Object.keys(g).forEach((function(e){g[e]=Object.keys(g[e]).map(t=>g[e][t]).reduce((n,r)=>void 0===n?r:xj[y[e]+"_"+t](n,r))})),m=Object.keys(v),n&&m.length&&(g.vlMulti="union"===t?{or:m.reduce((e,t)=>(e.push.apply(e,v[t]),e),[])}:{and:m.map(e=>({or:v[e]}))}),g}),wj);const rC={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(e){return"_["+Object(oe.Y)("$"+e)+"]"},functions:function(e){const t=yj(e);eC.forEach(e=>t[e]="event.vega."+e);for(let e in ZS)t[e]="this."+e;return t},constants:vj,visitors:tC};var iC=function(e){var t=(e=e||{}).whitelist?Object(oe.cb)(e.whitelist):{},n=e.blacklist?Object(oe.cb)(e.blacklist):{},r=e.constants||vj,i=(e.functions||yj)(f),o=e.globalvar,a=e.fieldvar,u={},s={},l=0,c=Object(oe.D)(o)?o:function(e){return o+'["'+e+'"]'};function f(e){if(Object(oe.H)(e))return e;var t=d[e.type];return null==t&&Object(oe.n)("Unsupported type: "+e.type),t(e)}var d={Literal:function(e){return e.raw},Identifier:function(e){var i=e.name;return l>0?i:Object(oe.v)(n,i)?Object(oe.n)("Illegal identifier: "+i):Object(oe.v)(r,i)?r[i]:Object(oe.v)(t,i)?i:(u[i]=1,c(i))},MemberExpression:function(e){var t=!e.computed,n=f(e.object);t&&(l+=1);var r=f(e.property);return n===a&&(s[function(e){var t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(r)]=1),t&&(l-=1),n+(t?"."+r:"["+r+"]")},CallExpression:function(e){"Identifier"!==e.callee.type&&Object(oe.n)("Illegal callee type: "+e.callee.type);var t=e.callee.name,n=e.arguments,r=Object(oe.v)(i,t)&&i[t];return r||Object(oe.n)("Unrecognized function: "+t),Object(oe.D)(r)?r(n):r+"("+n.map(f).join(",")+")"},ArrayExpression:function(e){return"["+e.elements.map(f).join(",")+"]"},BinaryExpression:function(e){return"("+f(e.left)+e.operator+f(e.right)+")"},UnaryExpression:function(e){return"("+e.operator+f(e.argument)+")"},ConditionalExpression:function(e){return"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")"},LogicalExpression:function(e){return"("+f(e.left)+e.operator+f(e.right)+")"},ObjectExpression:function(e){return"{"+e.properties.map(f).join(",")+"}"},Property:function(e){l+=1;var t=f(e.key);return l-=1,t+":"+f(e.value)}};function h(e){var t={code:f(e),globals:Object.keys(u),fields:Object.keys(s)};return u={},s={},t}return h.functions=i,h.constants=r,h}(rC);function oC(e,t,n){";"!==t[t.length-1]&&(t="return("+t+");");var r=Function.apply(null,e.concat(t));return n&&n.functions?r.bind(n.functions):r}function aC(e,t){return oC(["event"],e,t)}function uC(e,t){return oC(["item","_"],e,t)}function sC(e,t,n){var r,i;for(r in n=n||{},e)i=e[r],n[r]=Object(oe.A)(i)?i.map((function(e){return lC(e,t,n)})):lC(i,t,n);return n}function lC(e,t,n){if(!e||!Object(oe.F)(e))return e;for(var r,i=0,o=cC.length;i{t.forEach(t=>{Object(oe.A)(e[t])&&(e[t]=Object(oe.cb)(e[t]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig);var r=function(e,t,n){return pC(t,gC(e,Fr,n||ZS))}(this,e,t.functions);this._runtime=r,this._signals=r.signals,this._bind=(e.bindings||[]).map((function(e){return{state:null,param:Object(oe.o)({},e)}})),r.root&&r.root.set(n),n.source=r.data.root.input,this.pulse(r.data.root.input,this.changeset().insert(n.items)),this._background=t.background||r.background||null,this._width=this.width(),this._height=this.height(),this._viewWidth=xC(this,this._width),this._viewHeight=wC(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(e){var t=e._signals,n=t.width,r=t.height,i=t.padding;function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(function(t){e._width=t.size,e._viewWidth=xC(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(function(t){e._height=t.size,e._viewHeight=wC(e,t.size),o()}),{size:r});var a=e.add(null,o,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(this),YO(this),t.hover&&this.hover(),t.container&&this.initialize(t.container,t.bind)}var CC=Object(oe.y)(SC,Ar);function AC(e,t){return Object(oe.v)(e._signals,t)?e._signals[t]:Object(oe.n)("Unrecognized signal name: "+Object(oe.Y)(t))}function NC(e,t){var n=(e._targets||[]).filter((function(e){var n=e._update;return n&&n.handler===t}));return n.length?n[0]:null}function TC(e,t,n,r){var i=NC(n,r);return i||((i=hk(this,(function(){r(t,n.value)}))).handler=r,e.on(n,null,i)),e}function DC(e,t,n){var r=NC(t,n);return r&&t._targets.remove(r),e}CC.evaluate=async function(e,t,n){if(await Ar.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,i=JO(r=this),o=XO(r),a=KO(r),r._renderer.background(r._background),r._renderer.resize(o,a,i),r._handler.origin(i),r._resizeListeners.forEach((function(e){try{e(o,a)}catch(e){r.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var r,i,o,a;return n&&ue(this,n),this},CC.dirty=function(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},CC.container=function(){return this._el},CC.scenegraph=function(){return this._scenegraph},CC.origin=function(){return this._origin.slice()},CC.signal=function(e,t,n){var r=AC(this,e);return 1===arguments.length?r.value:this.update(r,t,n)},CC.background=function(e){return arguments.length?(this._background=e,this._resize=1,this):this._background},CC.width=function(e){return arguments.length?this.signal("width",e):this.signal("width")},CC.height=function(e){return arguments.length?this.signal("height",e):this.signal("height")},CC.padding=function(e){return arguments.length?this.signal("padding",e):this.signal("padding")},CC.autosize=function(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},CC.renderer=function(e){return arguments.length?(Ud(e)||Object(oe.n)("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},CC.tooltip=function(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},CC.loader=function(e){return arguments.length?(e!==this._loader&&(Ar.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},CC.resize=function(){return this._autosize=1,this.touch(AC(this,"autosize"))},CC._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},CC._resizeView=function(e,t,n,r,i,o){this.runAfter((function(a){var u=0;a._autosize=0,a.width()!==n&&(u=1,a.signal("width",n,bC),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal("height",r,bC),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]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter(e=>e.resize())}),!1,1)},CC.addEventListener=function(e,t,n){var r=t;return n&&!1===n.trap||((r=hk(this,t)).raw=t),this._handler.on(e,r),this},CC.removeEventListener=function(e,t){for(var n,r,i=this._handler.handlers(e),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,e===r&&(t===n||t===n.raw)){this._handler.off(r,n);break}return this},CC.addResizeListener=function(e){var t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},CC.removeResizeListener=function(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},CC.addSignalListener=function(e,t){return TC(this,e,AC(this,e),t)},CC.removeSignalListener=function(e,t){return DC(this,AC(this,e),t)},CC.addDataListener=function(e,t){return TC(this,e,VO(this,e).values,t)},CC.removeDataListener=function(e,t){return DC(this,VO(this,e).values,t)},CC.preventDefault=function(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},CC.timer=function(e,t){this._timers.push(function(e,t,n){var r=new g_,i=t;return null==t?(r.restart(e,t,n),r):(t=+t,n=null==n?p_():+n,r.restart((function o(a){a+=i,r.restart(o,i+=t,n),e(a)}),t,n),r)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},CC.events=function(e,t,n){var r,i=this,o=new Ae(n),a=function(n,r){i.runAsync(null,()=>{"view"===e&&function(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[t]:i?!i[t]:e.preventDefault()))}(i,t)&&n.preventDefault(),o.receive(QO(i,n,r))})};if("timer"===e)ek(i,"timer",t)&&i.timer(a,t);else if("view"===e)ek(i,"view",t)&&i.addEventListener(t,a,ZO);else if("window"===e?ek(i,"window",t)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&ek(i,"selector",t)&&(r=document.querySelectorAll(e)),r){for(var u=0,s=r.length;u=0;)i[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 r&&r.call(this,this._handler,null,null,null),this},CC.hover=function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",tk),nk,rk(e)),this.on(this.events("view","mouseout",tk),nk,rk(t)),this},CC.data=function(e,t){return arguments.length<2?VO(this,e).values.value:GO.call(this,e,be().remove(oe.fb).insert(t))},CC.change=GO,CC.insert=function(e,t){return GO.call(this,e,be().insert(t))},CC.remove=function(e,t){return GO.call(this,e,be().remove(t))},CC.scale=function(e){var t=this._runtime.scales;return Object(oe.v)(t,e)||Object(oe.n)("Unrecognized scale or projection: "+e),t[e].value},CC.initialize=function(e,t){var n,r,i=this,o=i._renderType,a=i._eventConfig.bind,u=Ud(o);return e=i._el=e?pk(i,e):null,u||i.error("Unrecognized renderer type: "+o),n=u.handler||td,r=e?u.renderer:u.headless,i._renderer=r?dk(i,i._renderer,e,r):null,i._handler=function(e,t,n,r){var i=new r(e.loader(),hk(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,JO(e),e);return t&&t.handlers().forEach((function(e){i.on(e.type,e.handler)})),i}(i,i._handler,e,n),i._redraw=!0,e&&"none"!==a&&(t=t?i._elBind=pk(i,t):e.appendChild(ik("div",{class:"vega-bindings"})),i._bind.forEach((function(e){e.param.element&&"container"!==a&&(e.element=pk(i,e.param.element))})),i._bind.forEach((function(e){ok(i,e.element||t,e)}))),i},CC.toImageURL=async function(e,t){e!==$d.Canvas&&e!==$d.SVG&&e!==$d.PNG&&Object(oe.n)("Unrecognized image type: "+e);const n=await mk(this,e,t);return e===$d.SVG?(r=n.svg(),i=new Blob([r],{type:"image/svg+xml"}),window.URL.createObjectURL(i)):n.canvas().toDataURL("image/png");var r,i},CC.toCanvas=async function(e,t){return(await mk(this,$d.Canvas,e,t)).canvas()},CC.toSVG=async function(e){return(await mk(this,$d.SVG,e)).svg()},CC.getState=function(e){return this._runtime.getState(e||{data:_C,signals:EC,recurse:!0})},CC.setState=function(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this};function MC(e){return+e||0}var FC=["value","update","init","react","bind"];function PC(e,t){Object(oe.n)(e+' for "outer" push: '+Object(oe.Y)(t))}var RC=function(e,t){var n=e.name;if("outer"===e.push)t.signals[n]||PC("No prior signal definition",n),FC.forEach((function(t){void 0!==e[t]&&PC("Invalid property ",t)}));else{var r=t.addSignal(n,e.value);!1===e.react&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}},zC=function(e,t,n){var r,i,o={};try{e=Object(oe.H)(e)?e:Object(oe.Y)(e)+"",r=gj(e)}catch(t){Object(oe.n)("Expression parse error: "+e)}return r.visit((function(e){if("CallExpression"===e.type){var n=e.callee.name,r=rC.visitors[n];r&&r(n,e.arguments,t,o)}})),(i=iC(r)).globals.forEach((function(e){var n="$"+e;!Object(oe.v)(o,n)&&t.getSignal(e)&&(o[n]=t.signalRef(e))})),{$expr:n?n+"return("+i.code+");":i.code,$fields:i.fields,$params:o}};function LC(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function IC(e,t,n,r){return new LC(e,t,n,r)}function $C(e,t){return IC("operator",e,t)}function BC(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function UC(e,t){return t?{$field:e,$name:t}:{$field:e}}var qC=UC("key");function WC(e,t){return{$compare:e,$order:t}}function HC(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function YC(e){return e&&e.signal}function VC(e){if(YC(e))return!0;if(Object(oe.F)(e))for(var t in e)if(VC(e[t]))return!0;return!1}function GC(e,t){return null!=e?e:t}function XC(e){return e&&e.signal||e}function KC(e,t){return(e.merge?JC:e.stream?QC:e.type?ZC:Object(oe.n)("Invalid stream specification: "+Object(oe.Y)(e)))(e,t)}function JC(e,t){var n=eA({merge:e.merge.map(e=>KC(e,t))},e,t);return t.addStream(n).id}function QC(e,t){var n=eA({stream:KC(e.stream,t)},e,t);return t.addStream(n).id}function ZC(e,t){var n,r,i;return"timer"===e.type?(n=t.event("timer",e.throttle),e={between:e.between,filter:e.filter}):n=t.event("scope"===(i=e.source)?"view":i||"view",e.type),r=eA({stream:n},e,t),1===Object.keys(r).length?n:t.addStream(r).id}function eA(e,t,n){var r,i,o,a,u=t.between;return u&&(2!==u.length&&Object(oe.n)('Stream "between" parameter must have 2 entries: '+Object(oe.Y)(t)),e.between=[KC(u[0],n),KC(u[1],n)]),u=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&u.push((r=t.marktype,i=t.markname,o=t.markrole,(a="event.item")+(r&&"*"!==r?"&&"+a+".mark.marktype==='"+r+"'":"")+(o?"&&"+a+".mark.role==='"+o+"'":"")+(i?"&&"+a+".mark.name==='"+i+"'":""))),"scope"===t.source&&u.push("inScope(event.item)"),u.length&&(e.filter=zC("("+u.join(")&&(")+")").$expr),null!=(u=t.throttle)&&(e.throttle=+u),null!=(u=t.debounce)&&(e.debounce=+u),t.consume&&(e.consume=!0),e}var tA,nA,rA=function(e,t,n){return tA=t||iA,nA=n||aA,sA(e.trim()).map(lA)},iA="view",oA=/[[\]{}]/,aA={"*":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};function uA(e,t,n,r,i){for(var o,a=0,u=e.length;t=0?--a:r&&r.indexOf(o)>=0&&++a}return t}function sA(e){for(var t=[],n=0,r=e.length,i=0;i"!==(e=e.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+e;if(t=t.map(lA),(n=lA(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t;return n}(e):function(e){var t,n,r={source:tA},i=[],o=[0,0],a=0,u=0,s=e.length,l=0;if("}"===e[s-1]){if(!((l=e.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+e;try{o=function(e){var t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((function(t){var n=+t;if(n!=n)throw e;return n}))}(e.substring(l+1,s-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,l).trim(),s=e.length,l=0}if(!s)throw e;"@"===e[0]&&(a=++l);(t=uA(e,l,":"))1?(r.type=i[1],a?r.markname=i[0].slice(1):(c=i[0],nA[c]?r.marktype=i[0]:r.source=i[0])):r.type=i[0];var c;"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);o[0]&&(r.throttle=o[0]);o[1]&&(r.debounce=o[1]);return r}(e)}var cA=function(e,t,n){var r=e.events,i=e.update,o=e.encode,a=[],u={target:n};r||Object(oe.n)("Signal update missing events specification."),Object(oe.H)(r)&&(r=rA(r,t.isSubscope()?"scope":"view")),r=Object(oe.i)(r).filter(e=>e.signal||e.scale?(a.push(e),0):1),a.length>1&&(a=[fA(a)]),r.length&&a.push(r.length>1?{merge:r}:r[0]),null!=o&&(i&&Object(oe.n)("Signal encode and update are mutually exclusive."),i="encode(item(),"+Object(oe.Y)(o)+")"),u.update=Object(oe.H)(i)?zC(i,t,"var datum=event.item&&event.item.datum;"):null!=i.expr?zC(i.expr,t,"var datum=event.item&&event.item.datum;"):null!=i.value?i.value:null!=i.signal?{$expr:"_.value",$params:{value:t.signalRef(i.signal)}}:Object(oe.n)("Invalid signal update specification."),e.force&&(u.options={force:!0}),a.forEach((function(e){t.addUpdate(Object(oe.o)(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):KC(e,t)}}(e,t),u))}))};function fA(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function dA(e){return function(t,n,r){return IC(e,n,t||void 0,r)}}var hA=dA("aggregate"),pA=dA("axisticks"),mA=dA("bound"),gA=dA("collect"),vA=dA("compare"),yA=dA("datajoin"),bA=dA("encode"),xA=dA("expression"),wA=(dA("extent"),dA("facet")),_A=dA("field"),EA=dA("key"),OA=dA("legendentries"),kA=dA("load"),jA=dA("mark"),SA=dA("multiextent"),CA=dA("multivalues"),AA=dA("overlap"),NA=dA("params"),TA=dA("prefacet"),DA=dA("projection"),MA=dA("proxy"),FA=dA("relay"),PA=dA("render"),RA=dA("scale"),zA=dA("sieve"),LA=dA("sortitems"),IA=dA("viewlayout"),$A=dA("values"),BA=0,UA={min:"min",max:"max",count:"sum"};function qA(e,t){var n,r,i=t.getScale(e.name).params;for(n in i.domain=VA(e.domain,e,t),null!=e.range&&(i.range=function e(t,n,r){var i=t.range,o=n.config.range;if(i.signal)return n.signalRef(i.signal);if(Object(oe.H)(i)){if(o&&Object(oe.v)(o,i))return t=Object(oe.o)({},t,{range:o[i]}),e(t,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=Qm(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Object(oe.n)("Unrecognized scale range value: "+Object(oe.Y)(i))}else{if(i.scheme)return r.scheme=Object(oe.A)(i.scheme)?HA(i.scheme,n):WA(i.scheme,n),i.extent&&(r.schemeExtent=HA(i.extent,n)),void(i.count&&(r.schemeCount=WA(i.count,n)));if(i.step)return void(r.rangeStep=WA(i.step,n));if(Qm(t.type)&&!Object(oe.A)(i))return VA(i,t,n);Object(oe.A)(i)||Object(oe.n)("Unsupported range type: "+Object(oe.Y)(i))}return i.map(e=>(Object(oe.A)(e)?HA:WA)(e,n))}(e,t,i)),null!=e.interpolate&&function(e,t){t.interpolate=WA(e.type||e),null!=e.gamma&&(t.interpolateGamma=WA(e.gamma))}(e.interpolate,i),null!=e.nice&&(i.nice=(r=e.nice,Object(oe.F)(r)?{interval:WA(r.interval),step:WA(r.step)}:WA(r))),null!=e.bins&&(i.bins=function(e,t){return e.signal||Object(oe.A)(e)?HA(e,t):t.objectProperty(e)}(e.bins,t)),e)Object(oe.v)(i,n)||"name"===n||(i[n]=WA(e[n],t))}function WA(e,t){return Object(oe.F)(e)?e.signal?t.signalRef(e.signal):Object(oe.n)("Unsupported object: "+Object(oe.Y)(e)):e}function HA(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>WA(e,t))}function YA(e){Object(oe.n)("Can not find data set: "+Object(oe.Y)(e))}function VA(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Object(oe.A)(e)?GA:e.fields?KA:XA)(e,t,n);null==t.domainMin&&null==t.domainMax||Object(oe.n)("No scale domain defined for domainMin/domainMax to override.")}function GA(e,t,n){return e.map((function(e){return WA(e,n)}))}function XA(e,t,n){var r=n.getData(e.data);return r||YA(e.data),Qm(t.type)?r.valuesRef(n,e.field,QA(e.sort,!1)):ng(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function KA(e,t,n){var r=e.data,i=e.fields.reduce((function(e,t){return t=Object(oe.H)(t)?{data:r,field:t}:Object(oe.A)(t)||t.signal?function(e,t){var n="_:vega:_"+BA++,r=gA({});if(Object(oe.A)(e))r.value={$ingest:e};else if(e.signal){var i="setdata("+Object(oe.Y)(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,zA({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e}),[]);return(Qm(t.type)?JA:ng(t.type)?ZA:eN)(e,n,i)}function JA(e,t,n){var r,i,o,a,u,s=QA(e.sort,!0);return r=n.map((function(e){var n=t.getData(e.data);return n||YA(e.data),n.countsRef(t,e.field,s)})),i={groupby:qC,pulse:r},s&&(o=s.op||"count",u=s.field?HC(o,s.field):"count",i.ops=[UA[o]],i.fields=[t.fieldRef(u)],i.as=[u]),o=t.add(hA(i)),a=t.add(gA({pulse:BC(o)})),u=t.add($A({field:qC,sort:t.sortRef(s),pulse:BC(a)})),BC(u)}function QA(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!UA[e.op]&&Object(oe.n)("Multiple domain scales can not be sorted using "+e.op):Object(oe.n)("No field provided for sort aggregate op: "+e.op):Object(oe.F)(e)?e.field="key":e={field:"key"}),e}function ZA(e,t,n){var r=n.map((function(e){var n=t.getData(e.data);return n||YA(e.data),n.domainRef(t,e.field)}));return BC(t.add(CA({values:r})))}function eN(e,t,n){var r=n.map((function(e){var n=t.getData(e.data);return n||YA(e.data),n.extentRef(t,e.field)}));return BC(t.add(SA({extents:r})))}function tN(e,t,n){return Object(oe.A)(e)?e.map((function(e){return tN(e,t,n)})):Object(oe.F)(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:Object(oe.n)("Unsupported parameter object: "+Object(oe.Y)(e)):e}const nN="value",rN=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],iN={name:1,style:1,interactive:1},oN={value:0},aN={value:1};var uN=Object(oe.cb)(["rule"]),sN=Object(oe.cb)(["group","image","rect"]),lN=function(e,t,n,r){var i=zC(e,t);return i.$fields.forEach((function(e){r[e]=1})),Object(oe.o)(n,i.$params),i.$expr},cN=function(e,t,n,r){return function e(t,n,r,i){var o,a,u;if(t.signal)o="datum",u=lN(t.signal,n,r,i);else if(t.group||t.parent){for(a=Math.max(1,t.level||1),o="item";a-- >0;)o+=".mark.group";t.parent?(u=t.parent,o+=".datum"):u=t.group}else t.datum?(o="datum",u=t.datum):Object(oe.n)("Invalid field reference: "+Object(oe.Y)(t));t.signal||(Object(oe.H)(u)?(i[u]=1,u=Object(oe.X)(u).map(oe.Y).join("][")):u=e(u,n,r,i));return o+"["+u+"]"}(Object(oe.F)(e)?e:{datum:e},t,n,r)};var fN=function(e,t,n,r){return Object(oe.F)(e)?"("+pN(null,e,t,n,r)+")":e},dN=function(e,t,n,r,i){var o,a,u,s=hN(e.scale,n,r,i);return null!=e.range?(a=s+".range()",t=0===(o=+e.range)?a+"[0]":"($="+a+","+(1===o?"$[$.length-1]":"$[0]+"+o+"*($[$.length-1]-$[0])")+")"):(void 0!==t&&(t=s+"("+t+")"),e.band&&(u=function(e,t){if(!Object(oe.H)(e))return-1;var n=t.scaleType(e);return"band"===n||"point"===n?1:0}(e.scale,n))&&(a=s+".bandwidth",o=e.band.signal?a+"()*"+fN(e.band,n,r,i):a+"()"+(1===(o=+e.band)?"":"*"+o),u<0&&(o="("+a+"?"+o+":0)"),t=(t?t+"+":"")+o,e.extra&&(t="(datum.extra?"+s+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t};function hN(e,t,n,r){var i;if(Object(oe.H)(e))i="%"+e,Object(oe.v)(n,i)||(n[i]=t.scaleRef(e)),i=Object(oe.Y)(i);else{for(i in t.scales)n["%"+i]=t.scaleRef(i);i=Object(oe.Y)("%")+"+"+(e.signal?"("+lN(e.signal,t,n,r)+")":cN(e,t,n,r))}return"_["+i+"]"}var pN=function(e,t,n,r,i){if(null!=t.gradient)return function(e,t,n,r){return"this.gradient("+hN(e.gradient,t,n,r)+","+Object(oe.Y)(e.start)+","+Object(oe.Y)(e.stop)+","+Object(oe.Y)(e.count)+")"}(t,n,r,i);var o=t.signal?lN(t.signal,n,r,i):t.color?function(e,t,n,r){function i(e,i,o,a){return"this."+e+"("+[pN(null,i,t,n,r),pN(null,o,t,n,r),pN(null,a,t,n,r)].join(",")+").toString()"}return e.c?i("hcl",e.h,e.c,e.l):e.h||e.s?i("hsl",e.h,e.s,e.l):e.l||e.a?i("lab",e.l,e.a,e.b):e.r||e.g||e.b?i("rgb",e.r,e.g,e.b):null}(t.color,n,r,i):null!=t.field?cN(t.field,n,r,i):void 0!==t.value?Object(oe.Y)(t.value):void 0;return null!=t.scale&&(o=dN(t,o,n,r,i)),void 0===o&&(o=null),null!=t.exponent&&(o="Math.pow("+o+","+fN(t.exponent,n,r,i)+")"),null!=t.mult&&(o+="*"+fN(t.mult,n,r,i)),null!=t.offset&&(o+="+"+fN(t.offset,n,r,i)),t.round&&(o="Math.round("+o+")"),o},mN=function(e,t,n){const r=e+"["+Object(oe.Y)(t)+"]";return`$=${n};if(${r}!==$)${r}=$,m=1;`},gN=function(e,t,n,r,i){var o="";return t.forEach((function(t){var a=pN(e,t,n,r,i);o+=t.test?lN(t.test,n,r,i)+"?"+a+":":a})),":"===Object(oe.T)(o)&&(o+="null"),mN("o",e,o)};function vN(e,t,n,r){var i,o,a,u={},s="var o=item,datum=o.datum,m=0,$;";for(i in e)o=e[i],Object(oe.A)(o)?s+=gN(i,o,r,n,u):(a=pN(i,o,r,n,u),s+=mN("o",i,a));return s+=function(e,t){var n="";return uN[t]?n:(e.x2&&(e.x?(sN[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?(sN[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)}(e,t),{$expr:s+="return m;",$fields:Object.keys(u),$output:Object.keys(e)}}function yN(e){return Object(oe.F)(e)&&!Object(oe.A)(e)?Object(oe.o)({},e):{value:e}}function bN(e,t,n,r){return null!=n?(Object(oe.F)(n)&&!Object(oe.A)(n)?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function xN(e,t,n){for(let n in t)bN(e,n,t[n]);for(let t in n)bN(e,t,n[t],"update")}function wN(e,t,n){for(var r in t)n&&Object(oe.v)(n,r)||(e[r]=Object(oe.o)(e[r]||{},t[r]));return e}function _N(e,t,n,r,i,o){var a,u;for(u in(o=o||{}).encoders={$encode:a={}},e=function(e,t,n,r,i){var o,a,u,s={},l={};"legend"!=n&&0!==String(n).indexOf("axis")||(n=null);for(a in u="frame"===n?i.group:"mark"===n?Object(oe.o)({},i.mark,i[t]):null)ON(a,e)||("fill"===a||"stroke"===a)&&(ON("fill",e)||ON("stroke",e))||EN(s,a,u[a]);for(a in Object(oe.i)(r).forEach((function(t){var n=i.style&&i.style[t];for(var r in n)ON(r,e)||EN(s,r,n[r])})),e=Object(oe.o)({},e),s)(u=s[a]).signal?(o=o||{})[a]=u:l[a]=u;e.enter=Object(oe.o)(l,e.enter),o&&(e.update=Object(oe.o)(o,e.update));return e}(e,t,n,r,i.config))a[u]=vN(e[u],t,o,i);return o}function EN(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function ON(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}var kN=function(e,t,n,r,i,o,a){return{type:e,name:a?a.name:void 0,role:t,style:a&&a.style||n,key:r,from:i,interactive:!(!a||!a.interactive),encode:wN(o,a,iN)}};function jN(e,t){const n=(n,r)=>GC(e[n],GC(t[n],r));return n.isVertical=n=>"vertical"===GC(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>GC(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>GC(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>GC(e.columns,GC(t.columns,+n.isVertical(!0))),n}function SN(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function CN(e,t,n){return`item.anchor === "start" ? ${e} : item.anchor === "end" ? ${t} : ${n}`}const AN=CN(Object(oe.Y)("left"),Object(oe.Y)("right"),Object(oe.Y)("center"));var NN=function(e,t,n,r){var i,o,a,u,s,l,c=jN(e,n),f=c.isVertical(),d=c.gradientThickness(),h=c.gradientLength();return f?(a=[0,1],u=[0,0],s=d,l=h):(a=[0,0],u=[1,0],s=h,l=d),xN(i={enter:o={opacity:oN,x:oN,y:oN,width:yN(s),height:yN(l)},update:Object(oe.o)({},o,{opacity:aN,fill:{gradient:t,start:a,stop:u}}),exit:{opacity:oN}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),kN("rect","legend-gradient",null,void 0,void 0,i,r)},TN=function(e,t,n,r,i){var o,a,u,s,l,c,f=jN(e,n),d=f.isVertical(),h=f.gradientThickness(),p=f.gradientLength(),m="";return d?(u="y",l="y2",s="x",c="width",m="1-"):(u="x",l="x2",s="y",c="height"),(a={opacity:oN,fill:{scale:t,field:nN}})[u]={signal:m+"datum.perc",mult:p},a[s]=oN,a[l]={signal:m+"datum.perc2",mult:p},a[c]=yN(h),xN(o={enter:a,update:Object(oe.o)({},a,{opacity:aN}),exit:{opacity:oN}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),kN("rect","legend-band",null,nN,i,o,r)};var DN=function(e,t,n,r){var i,o,a,u,s,l=jN(e,t),c=l.isVertical(),f=yN(l.gradientThickness()),d=l.gradientLength(),h=l("labelOverlap"),p=l("labelSeparation"),m="";return xN(i={enter:o={opacity:oN},update:a={opacity:aN,text:{field:"label"}},exit:{opacity:oN}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:GC(e.labelLimit,t.gradientLabelLimit)}),c?(o.align={value:"left"},o.baseline=a.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},u="y",s="x",m="1-"):(o.align=a.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},o.baseline={value:"top"},u="x",s="y"),o[u]=a[u]={signal:m+"datum.perc",mult:d},o[s]=a[s]=f,f.offset=GC(e.labelOffset,t.gradientLabelOffset)||0,e=kN("text","legend-label","guide-label",nN,r,i,n),h&&(e.overlap={separation:p,method:h,order:"datum.index"}),e},MN=function(e,t,n,r,i,o,a,u){return{type:"group",name:n,role:e,style:t,from:r,interactive:i||!1,encode:o,marks:a,layout:u}},FN=function(e,t,n,r,i){var o,a,u,s,l,c,f,d=jN(e,t),h=n.entries,p=!(!h||!h.interactive),m=h?h.name:void 0,g=d("clipHeight"),v=d("symbolOffset"),y={data:"value"},b={},x=`${i} ? datum.offset : datum.size`,w=g?yN(g):{field:"size"},_="datum.index",E=`max(1, ${i})`;w.mult=.5,b={enter:o={opacity:oN,x:{signal:x,mult:.5,offset:v},y:w},update:a={opacity:aN,x:o.x,y:o.y},exit:{opacity:oN}};var O=null,k=null;return e.fill||(O=t.symbolBaseFillColor,k=t.symbolBaseStrokeColor),xN(b,{fill:d("symbolFillColor",O),shape:d("symbolType"),size:d("symbolSize"),stroke:d("symbolStrokeColor",k),strokeDash:d("symbolDash"),strokeDashOffset:d("symbolDashOffset"),strokeWidth:d("symbolStrokeWidth")},{opacity:d("symbolOpacity")}),rN.forEach((function(t){e[t]&&(a[t]=o[t]={scale:e[t],field:nN})})),s=kN("symbol","legend-symbol",null,nN,y,b,n.symbols),g&&(s.clip=!0),(u=yN(v)).offset=d("labelOffset"),xN(b={enter:o={opacity:oN,x:{signal:x,offset:u},y:w},update:a={opacity:aN,text:{field:"label"},x:o.x,y:o.y},exit:{opacity:oN}},{align:d("labelAlign"),baseline:d("labelBaseline"),fill:d("labelColor"),fillOpacity:d("labelOpacity"),font:d("labelFont"),fontSize:d("labelFontSize"),fontStyle:d("labelFontStyle"),fontWeight:d("labelFontWeight"),limit:d("labelLimit")}),l=kN("text","legend-label","guide-label",nN,y,b,n.labels),b={enter:{noBound:{value:!g},width:oN,height:g?yN(g):oN,opacity:oN},exit:{opacity:oN},update:a={opacity:aN,row:{signal:null},column:{signal:null}}},d.isVertical(!0)?(c=`ceil(item.mark.items.length / ${E})`,a.row.signal=`${_}%${c}`,a.column.signal=`floor(${_} / ${c})`,f={field:["row",_]}):(a.row.signal=`floor(${_} / ${E})`,a.column.signal=`${_} % ${E}`,f={field:_}),a.column.signal=`${i}?${a.column.signal}:${_}`,(e=MN("scope",null,m,r={facet:{data:r,name:"value",groupby:"index"}},p,wN(b,h,iN),[s,l])).sort=f,e};const PN='item.orient === "left"',RN='item.orient === "right"',zN=`(${PN} || ${RN})`,LN=`datum.vgrad && ${zN}`,IN=CN('"top"','"bottom"','"middle"'),$N=`datum.vgrad && ${RN} ? (${CN('"right"','"left"','"center"')}) : (${zN} && !(datum.vgrad && ${PN})) ? "left" : ${AN}`,BN=`item._anchor || (${zN} ? "middle" : "start")`,UN=`${LN} ? (${PN} ? -90 : 90) : 0`,qN=`${zN} ? (datum.vgrad ? (${RN} ? "bottom" : "top") : ${IN}) : "top"`;var WN=function(e,t){var n;return Object(oe.F)(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+HN(e.path)+")":e.sphere&&(n="geoShape("+HN(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e};function HN(e){return Object(oe.F)(e)&&e.signal?e.signal:Object(oe.Y)(e)}var YN=function(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?"group"===e.type?"scope":t||"mark":t},VN=function(e){return{marktype:e.type,name:e.name||void 0,role:e.role||YN(e),zindex:+e.zindex||void 0}},GN=function(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e},XN=function(e,t){var n=Pr(e.type);n||Object(oe.n)("Unrecognized transform type: "+Object(oe.Y)(e.type));var r=IC(n.type.toLowerCase(),null,KN(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r};function KN(e,t,n){var r,i,o,a={};for(i=0,o=e.params.length;iRC(e,t)),Object(oe.i)(e.projections).forEach(e=>function(e,t){var n=t.config.projection||{},r={};for(var i in e)"name"!==i&&(r[i]=tN(e[i],i,t));for(i in n)null==r[i]&&(r[i]=tN(n[i],i,t));t.addProjection(e.name,r)}(e,t)),i.forEach(e=>function(e,t){var n=e.type||"linear";Xm(n)||Object(oe.n)("Unrecognized scale type: "+Object(oe.Y)(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t)),Object(oe.i)(e.data).forEach(e=>pT(e,t)),i.forEach(e=>qA(e,t)),(n||r).forEach(e=>function(e,t){var n=t.getSignal(e.name),r=e.update;e.init&&(r?Object(oe.n)("Signals can not include both init and update expressions."):(r=e.init,n.initonly=!0)),r&&(r=zC(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach((function(e){cA(e,t,n.id)}))}(e,t)),Object(oe.i)(e.axes).forEach(e=>xT(e,t)),Object(oe.i)(e.marks).forEach(e=>cT(e,t)),Object(oe.i)(e.legends).forEach(e=>fT(e,t)),e.title&&hT(e.title,t),t.parseLambdas(),t},_T=Object(oe.cb)(["width","height","padding","autosize"]);function ET(e,t){var n,r,i,o,a,u,s=t.config;return t.background=e.background||s.background,t.eventConfig=s.events,a=BC(t.root=t.add($C())),t.addSignal("width",e.width||0),t.addSignal("height",e.height||0),t.addSignal("padding",function(e,t){return e=e||t.padding,Object(oe.F)(e)?{top:MC(e.top),bottom:MC(e.bottom),left:MC(e.left),right:MC(e.right)}:{top:n=MC(e),bottom:n,left:n,right:n};var n}(e.padding,s)),t.addSignal("autosize",function(e,t){return e=e||t.autosize,Object(oe.F)(e)?e:{type:e||"pad"}}(e.autosize,s)),t.legends=t.objectProperty(s.legend&&s.legend.layout),u=function(e,t,n){if(Object(oe.i)(t).forEach(t=>{_T[t.name]||RC(t,e)}),!n)return t;const r=Object(oe.i)(t).slice();return Object(oe.i)(n).forEach(t=>{e.hasOwnSignal(t.name)||(RC(t,e),r.push(t))}),r}(t,e.signals,s.signals),r=t.add(gA()),i=wN({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),i=t.add(bA(_N(i,"group","frame",e.style,t,{pulse:BC(r)}))),o=t.add(IA({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:a,pulse:BC(i)})),t.operators.pop(),t.pushState(BC(i),BC(o),null),wT(e,t,u),t.operators.push(o),n=t.add(mA({mark:a,pulse:BC(o)})),n=t.add(PA({pulse:BC(n)})),n=t.add(zA({pulse:BC(n)})),t.addData("root",new iT(t,r,r,n)),t}function OT(e){this.config=e,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function kT(e){this.config=e.config,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}var jT=OT.prototype=kT.prototype;function ST(e){return(Object(oe.A)(e)?CT:AT)(e)}function CT(e){for(var t,n="[",r=0,i=e.length;r0?",":"")+(Object(oe.F)(t)?t.signal||ST(t):Object(oe.Y)(t));return n+"]"}function AT(e){var t,n,r="{",i=0;for(t in e)n=e[t],r+=(++i>1?",":"")+Object(oe.Y)(t)+":"+(Object(oe.F)(n)?n.signal||ST(n):Object(oe.Y)(n));return r+"}"}jT.fork=function(){return new kT(this)},jT.isSubscope=function(){return this._subid>0},jT.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},jT.id=function(){return(this._subid?this._subid+":":0)+this._id++},jT.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((function(t){t.$ref=e.id})),e.refs=null),e},jT.proxy=function(e){var t=e instanceof LC?BC(e):e;return this.add(MA({value:t}))},jT.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},jT.addUpdate=function(e){return this.updates.push(e),e},jT.finish=function(){var 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){var r;e&&((r=e.data||(e.data={}))[t]||(r[t]=[])).push(n)}for(e in this.data)for(var r in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[r],e,"index:"+r);return this},jT.pushState=function(e,t,n){this._encode.push(BC(this.add(zA({pulse:e})))),this._parent.push(t),this._lookup.push(n?BC(this.proxy(n)):null),this._markpath.push(-1)},jT.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},jT.parent=function(){return Object(oe.T)(this._parent)},jT.encode=function(){return Object(oe.T)(this._encode)},jT.lookup=function(){return Object(oe.T)(this._lookup)},jT.markpath=function(){var e=this._markpath;return++e[e.length-1]},jT.fieldRef=function(e,t){if(Object(oe.H)(e))return UC(e,t);e.signal||Object(oe.n)("Unsupported field reference: "+Object(oe.Y)(e));var n,r=e.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},t&&(n.as=t),this.field[r]=i=BC(this.add(_A(n)))),i},jT.compareRef=function(e){function t(e){return YC(e)?(r=!0,n.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(r=!0,n.exprRef(e.expr)):e}var n=this,r=!1,i=Object(oe.i)(e.field).map(t),o=Object(oe.i)(e.order).map(t);return r?BC(this.add(vA({fields:i,orders:o}))):WC(i,o)},jT.keyRef=function(e,t){var n=this.signals,r=!1;return e=Object(oe.i)(e).map((function(e){return YC(e)?(r=!0,BC(n[e.signal])):e})),r?BC(this.add(EA({fields:e,flat:t}))):function(e,t){var n={$key:e};return t&&(n.$flat=!0),n}(e,t)},jT.sortRef=function(e){if(!e)return e;var t=HC(e.op,e.field),n=e.order||"ascending";return n.signal?BC(this.add(vA({fields:t,orders:this.signalRef(n.signal)}))):WC(t,n)},jT.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},jT.hasOwnSignal=function(e){return Object(oe.v)(this.signals,e)},jT.addSignal=function(e,t){this.hasOwnSignal(e)&&Object(oe.n)("Duplicate signal name: "+Object(oe.Y)(e));var n=t instanceof LC?t:this.add($C(t));return this.signals[e]=n},jT.getSignal=function(e){return this.signals[e]||Object(oe.n)("Unrecognized signal name: "+Object(oe.Y)(e)),this.signals[e]},jT.signalRef=function(e){return this.signals[e]?BC(this.signals[e]):(Object(oe.v)(this.lambdas,e)||(this.lambdas[e]=this.add($C(null))),BC(this.lambdas[e]))},jT.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;tBT(e,t))}:LT(e)?{or:e.or.map(e=>BT(e,t))}:t(e)}const UT=PT.a,qT=MT.a;function WT(e,t){const n={};for(const r of t)Object(oe.v)(e,r)&&(n[r]=e[r]);return n}function HT(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>zT()(e)).join(",")})`};const YT=zT.a;function VT(e){if(Object(oe.E)(e))return e;const t=Object(oe.H)(e)?e:zT()(e);if(t.length<250)return t;let n=0;for(let e=0;e-1}function KT(e,t){let n=0;for(const[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}function JT(e,t){let n=0;for(const[r,i]of e.entries())if(!t(i,r,n++))return!1;return!0}function QT(e,t){for(const n of Object.keys(t))Object(oe.ib)(e,n,t[n],!0)}function ZT(e,t){const n=[],r={};let i;for(const o of e)i=t(o),i in r||(r[i]=1,n.push(o));return n}function eD(e,t){for(const n of e)if(t.has(n))return!0;return!1}function tD(e){const t=new Set;for(const n of e){const e=Object(oe.X)(n).map((e,t)=>0===t?e:`[${e}]`);e.map((t,n)=>e.slice(0,n+1).join("")).forEach(e=>t.add(e))}return t}function nD(e,t){return void 0===e||void 0===t||eD(tD(e),tD(t))}const rD=Object.keys;function iD(e){const t=[];for(const n in e)Object(oe.v)(e,n)&&t.push(e[n]);return t}function oD(e){return!0===e||!1===e}function aD(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function uD(e,t){return $T(e)?"!("+uD(e.not,t)+")":IT(e)?"("+e.and.map(e=>uD(e,t)).join(") && (")+")":LT(e)?"("+e.or.map(e=>uD(e,t)).join(") || (")+")":t(e)}function sD(e,t){if(0===t.length)return!0;const n=t.shift();return sD(e[n],t)&&delete e[n],0===rD(e).length}function lD(e){return e.charAt(0).toUpperCase()+e.substr(1)}function cD(e,t="datum"){const n=Object(oe.X)(e),r=[];for(let e=1;e<=n.length;e++){const i=`[${n.slice(0,e).map(oe.Y).join("][")}]`;r.push(`${t}${i}`)}return r.join(" && ")}function fD(e){return`${Object(oe.X)(e).map(e=>dD(e,".","\\.")).join("\\.")}`}function dD(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function hD(e){return e?Object(oe.X)(e).length:0}function pD(...e){for(const t of e)if(void 0!==t)return t}let mD=42;function gD(e){const t=++mD;return e?String(e)+t:t}function vD(e){return(e%360+360)%360}const yD={area:1,bar:1,image:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1};function bD(e){return XT(["line","area","trail"],e)}function xD(e){return XT(["rect","bar","image"],e)}const wD=rD(yD);function _D(e){return e.type}Object(oe.cb)(wD);const ED=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],OD=["filled","color","tooltip","invalid","timeUnitBandPosition","timeUnitBand"],kD={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},jD={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function SD(e){return!!e.mark}class CD{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!SD(e)&&(_D(t=e.mark)?t.type:t)===this.name;var t}}const AD={argmax:1,argmin:1,average:1,count:1,distinct: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},ND={count:1,min:1,max:1};function TD(e){return!!e&&!!e.argmin}function DD(e){return!!e&&!!e.argmax}rD(AD);function MD(e){return Object(oe.H)(e)&&!!AD[e]}const FD=["count","valid","missing","distinct"];function PD(e){return Object(oe.H)(e)&&XT(FD,e)}const RD=["count","sum","distinct","valid","missing"],zD=Object(oe.cb)(["mean","average","median","q1","q3","min","max"]),LD="row",ID="x",$D="y",BD="color",UD="fill",qD="stroke",WD="shape",HD="size",YD="opacity",VD="fillOpacity",GD="strokeOpacity",XD="strokeWidth",KD={x:1,y:1,x2:1,y2:1};const JD={longitude:1,longitude2:1,latitude:1,latitude2:1};const QD=rD(JD),ZD=Object.assign(Object.assign(Object.assign({},KD),JD),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1});function eM(e){return"color"===e||"fill"===e||"stroke"===e}const tM={row:1,column:1,facet:1},nM=rD(tM),rM=Object.assign(Object.assign({},ZD),tM),iM=rD(rM),{order:oM,detail:aM,tooltip:uM}=rM,sM=k(rM,["order","detail","tooltip"]),{row:lM,column:cM,facet:fM}=sM,dM=k(sM,["row","column","facet"]);rD(sM),rD(dM);function hM(e){return!!rM[e]}const pM=["x2","y2","latitude2","longitude2"];function mM(e){return gM(e)!==e}function gM(e){switch(e){case"x2":return"x";case"y2":return"y";case"latitude2":return"latitude";case"longitude2":return"longitude"}return e}function vM(e){switch(e){case"x":return"x2";case"y":return"y2";case"latitude":return"latitude2";case"longitude":return"longitude2"}}rD(ZD);const{x:yM,y:bM,x2:xM,y2:wM,latitude:_M,longitude:EM,latitude2:OM,longitude2:kM}=ZD,jM=k(ZD,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]),SM=rD(jM),CM={x:1,y:1},AM=rD(CM);function NM(e){return"x"===e?"width":"height"}function TM(e){return"width"===e?"x":"y"}const{text:DM,tooltip:MM,href:FM,url:PM,detail:RM,key:zM,order:LM}=jM,IM=k(jM,["text","tooltip","href","url","detail","key","order"]),$M=rD(IM);const BM=Object.assign(Object.assign({},CM),IM),UM=rD(BM);function qM(e){return!!BM[e]}function WM(e,t){return function(e){switch(e){case BD:case UD:case qD:case"detail":case"key":case"tooltip":case"href":case"order":case YD:case VD:case GD:case XD:case"facet":case LD:case"column":return HM;case ID:case $D:case"latitude":case"longitude":return VM;case"x2":case"y2":case"latitude2":case"longitude2":return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case HD:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case WD:return{point:"always",geoshape:"always"};case"text":return{text:"always"};case"url":return{image:"always"}}}(e)[t]}const HM={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:YM}=HM,VM=k(HM,["geoshape"]);function GM(e){switch(e){case ID:case $D:case HD:case XD:case YD:case VD:case GD:case"x2":case"y2":return;case"facet":case LD:case"column":case WD:case"text":case"tooltip":case"href":case"url":return"discrete";case BD:case UD:case qD:return"flexible";case"latitude":case"longitude":case"latitude2":case"longitude2":case"detail":case"key":case"order":return}}function XM(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const KM='Autosize "fit" only works for single views and layered views.';function JM(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function QM(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-x".`}function ZM(e){return e?`Dropping "fit-${e}" because spec has discrete ${NM(e)}.`:'Dropping "fit" because spec has discrete size.'}function eF(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function tF(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function nF(e){return`The "nearest" transform is not supported for ${e} marks.`}function rF(e){return`Selection not supported for ${e} yet.`}function iF(e){return`Cannot find a selection named "${e}".`}const oF="Scale bindings are currently only supported for scales with unbinned, continuous domains.",aF="Legend bindings are only supported for selections over an individual field or encoding channel.";function uF(e){return`Cannot define and lookup the "${e}" selection in the same view. `+"Try moving the lookup into a second, layered view?"}function sF(e){return`Unknown repeated value "${e}".`}function lF(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const cF="Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).",fF="Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function dF(e){return`Unrecognized parse "${e}".`}function hF(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function pF(e){return`Ignoring an invalid transform: ${YT(e)}.`}const mF='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.';function gF(e){return`Layer's shared ${e.join(",")} channel ${1===e.length?"is":"are"} overriden.`}function vF(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${YT(t)} is overridden by a child projection ${YT(n)}.`}function yF(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${YT(n)}}.`}function bF(e){return`Invalid field type "${e}".`}function xF(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${e}'s ${t}. This can be misleading as the ${"x"===t?"width":"height"} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`}function wF(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function _F(e){return`Invalid aggregation operator "${e}".`}function EF(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}function OF(e,t){const{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?"fill and stroke":n?"fill":"stroke"}.`}function kF(e,t){return`Dropping ${YT(e)} from channel "${t}" since it does not contain data field or value.`}function jF(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`}const SF="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function CF(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function AF(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function NF(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function TF(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function DF(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function MF(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function FF(e,t){return`Specified orient "${e}" overridden with "${t}".`}const PF="Custom domain scale cannot be unioned with default field-based domain.",RF='Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.';function zF(e){return`Cannot use the scale property "${e}" with non-color channel.`}function LF(e){return`Using unaggregated domain with raw field has no effect (${YT(e)}).`}function IF(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function $F(e){return`Unaggregated domain is currently unsupported for log scale (${YT(e)}).`}function BF(e){return`Cannot apply size to non-oriented mark "${e}".`}function UF(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function qF(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function WF(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function HF(e,t){return`Scale type "${t}" does not work with mark "${e}".`}function YF(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}function VF(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${YT(n)} and ${YT(r)}). Using ${YT(n)}.`}function GF(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${YT(n)} and ${YT(r)}). Using the union of the two domains.`}function XF(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function KF(e){return`Dropping sort property ${YT(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const JF="Unable to merge domains.",QF="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",ZF="Invalid channel for axis.";function eP(e){return`Cannot stack "${e}" if there is already "${e}2".`}function tP(e){return`Cannot stack non-linear scale (${e}).`}function nP(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function rP(e,t){return`Invalid ${e}: ${YT(t)}.`}function iP(e){return`Time unit "${e}" is not supported. We are replacing it with ${dD(e,"day","date")}.`}function oP(e){return`Dropping day from datetime ${YT(e)} as day cannot be combined with other units.`}function aP(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function uP(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function sP(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function lP(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}function cP(e){return`1D error band does not support ${e}.`}function fP(e){return`Channel ${e} is required for "binned" bin.`}function dP(e){return`Domain for ${e} is required for threshold scale.`}const hP=v,pP=Object(oe.K)(oe.e);let mP=pP;function gP(){return mP=pP,mP}function vP(...e){mP.warn(...e)}function yP(e){return!!(e&&(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds))}const bP=["january","february","march","april","may","june","july","august","september","october","november","december"],xP=bP.map(e=>e.substr(0,3)),wP=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],_P=wP.map(e=>e.substr(0,3));function EP(e,t=!1,n=!1){const r=[];if(t&&void 0!==e.day&&rD(e).length>1&&(vP(hP.droppedDay(e)),delete(e=qT(e)).day),void 0!==e.year?r.push(e.year):void 0!==e.day?r.push(2006):r.push(0),void 0!==e.month){const n=t?function(e){if(Object(oe.E)(e))return(e-1).toString();{const t=e.toLowerCase(),n=bP.indexOf(t);if(-1!==n)return n+"";const r=t.substr(0,3),i=xP.indexOf(r);if(-1!==i)return i+"";throw new Error(hP.invalidTimeUnit("month",e))}}(e.month):e.month;r.push(n)}else if(void 0!==e.quarter){const n=t?function(e){if(Object(oe.E)(e))return e>4&&vP(hP.invalidTimeUnit("quarter",e)),(e-1).toString();throw new Error(hP.invalidTimeUnit("quarter",e))}(e.quarter):e.quarter;r.push(n+"*3")}else r.push(0);if(void 0!==e.date)r.push(e.date);else if(void 0!==e.day){const n=t?function(e){if(Object(oe.E)(e))return e%7+"";{const t=e.toLowerCase(),n=wP.indexOf(t);if(-1!==n)return n+"";const r=t.substr(0,3),i=_P.indexOf(r);if(-1!==i)return i+"";throw new Error(hP.invalidTimeUnit("day",e))}}(e.day):e.day;r.push(n+"+1")}else r.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];r.push(void 0===n?0:n)}const i=r.join(", ");return n?e.utc?new Function(`return +new Date(Date.UTC(${i}))`)():new Function(`return +new Date(${i})`)():e.utc?`utc(${i})`:`datetime(${i})`}var OP;!function(e){e.YEAR="year",e.MONTH="month",e.DAY="day",e.DATE="date",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.MILLISECONDS="milliseconds",e.YEARMONTH="yearmonth",e.YEARMONTHDATE="yearmonthdate",e.YEARMONTHDATEHOURS="yearmonthdatehours",e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",e.MONTHDATE="monthdate",e.MONTHDATEHOURS="monthdatehours",e.HOURSMINUTES="hoursminutes",e.HOURSMINUTESSECONDS="hoursminutesseconds",e.MINUTESSECONDS="minutesseconds",e.SECONDSMILLISECONDS="secondsmilliseconds",e.QUARTER="quarter",e.YEARQUARTER="yearquarter",e.QUARTERMONTH="quartermonth",e.YEARQUARTERMONTH="yearquartermonth",e.UTCYEAR="utcyear",e.UTCMONTH="utcmonth",e.UTCDAY="utcday",e.UTCDATE="utcdate",e.UTCHOURS="utchours",e.UTCMINUTES="utcminutes",e.UTCSECONDS="utcseconds",e.UTCMILLISECONDS="utcmilliseconds",e.UTCYEARMONTH="utcyearmonth",e.UTCYEARMONTHDATE="utcyearmonthdate",e.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",e.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",e.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",e.UTCMONTHDATE="utcmonthdate",e.UTCMONTHDATEHOURS="utcmonthdatehours",e.UTCHOURSMINUTES="utchoursminutes",e.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",e.UTCMINUTESSECONDS="utcminutesseconds",e.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",e.UTCQUARTER="utcquarter",e.UTCYEARQUARTER="utcyearquarter",e.UTCQUARTERMONTH="utcquartermonth",e.UTCYEARQUARTERMONTH="utcyearquartermonth"}(OP||(OP={}));const kP={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},jP=rD(kP);const SP={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};const CP={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},AP=Object.assign(Object.assign({},SP),CP);const NP=Object.assign(Object.assign(Object.assign(Object.assign({},kP),SP),{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1}),CP),TP=(rD(NP),{"year-month":"%b %Y ","year-month-date":"%b %d, %Y "});function DP(e){return jP.reduce((t,n)=>MP(e,n)?[...t,n]:t,[])}function MP(e,t){const n=e.indexOf(t);return n>-1&&(t!==OP.SECONDS||0===n||"i"!==e.charAt(n-1))}function FP(e,t,{end:n}={end:!1}){const r=cD(t),i=AP[e]?"utc":"";let o;const a=jP.reduce((t,n)=>{var a;return MP(e,n)&&(t[n]=(a=n)===OP.QUARTER?`(${i}quarter(${r})-1)`:`${i}${a}(${r})`,o=n),t},{});return n&&(a[o]+="+1"),EP(a)}function PP(e,t,n){if(!e)return;const r=function(e){if(!e)return;const t=DP(e);return`timeUnitSpecifier(${zT()(t)}, ${zT()(TP)})`}(e);return n?`utcFormat(${t}, ${r})`:`timeFormat(${t}, ${r})`}function RP(e){return"day"!==e&&e.indexOf("day")>=0?(vP(hP.dayReplacedWithDate(e)),dD(e,"day","date")):e}function zP(e){return e&&!!e.field&&void 0!==e.equal}function LP(e){return e&&!!e.field&&void 0!==e.lt}function IP(e){return e&&!!e.field&&void 0!==e.lte}function $P(e){return e&&!!e.field&&void 0!==e.gt}function BP(e){return e&&!!e.field&&void 0!==e.gte}function UP(e){return!!(e&&e.field&&Object(oe.A)(e.range)&&2===e.range.length)}function qP(e){return e&&!!e.field&&(Object(oe.A)(e.oneOf)||Object(oe.A)(e.in))}function WP(e){return qP(e)||zP(e)||UP(e)||LP(e)||$P(e)||IP(e)||BP(e)}function HP(e,t){return kz(e,{timeUnit:t,time:!0})}function YP(e,t=!0){const{field:n,timeUnit:r}=e,i=r?"time("+FP(r,n)+")":sz(e,{expr:"datum"});if(zP(e))return i+"==="+HP(e.equal,r);if(LP(e)){return`${i}<${HP(e.lt,r)}`}if($P(e)){return`${i}>${HP(e.gt,r)}`}if(IP(e)){return`${i}<=${HP(e.lte,r)}`}if(BP(e)){return`${i}>=${HP(e.gte,r)}`}if(qP(e))return`indexof([${function(e,t){return e.map(e=>HP(e,t))}(e.oneOf,r).join(",")}], ${i}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return VP(i,e.valid);if(UP(e)){const n=e.range[0],o=e.range[1];if(null!==n&&null!==o&&t)return"inrange("+i+", ["+HP(n,r)+", "+HP(o,r)+"])";const a=[];return null!==n&&a.push(`${i} >= ${HP(n,r)}`),null!==o&&a.push(`${i} <= ${HP(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`)}function VP(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function GP(e){return WP(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:RP(e.timeUnit)}):e}const XP={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1};var KP;!function(e){e.LINEAR="linear",e.LOG="log",e.POW="pow",e.SQRT="sqrt",e.SYMLOG="symlog",e.TIME="time",e.UTC="utc",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.BIN_ORDINAL="bin-ordinal",e.ORDINAL="ordinal",e.POINT="point",e.BAND="band"}(KP||(KP={}));const JP={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},QP=rD(JP);function ZP(e,t){const n=JP[e],r=JP[t];return n===r||"ordinal-position"===n&&"time"===r||"ordinal-position"===r&&"time"===n}const eR={linear:0,log:1,pow:1,sqrt:1,symlog:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function tR(e){return eR[e]}const nR=["linear","log","pow","sqrt","symlog","time","utc"],rR=Object(oe.cb)(nR),iR=Object(oe.cb)(["quantile","quantize","threshold"]),oR=nR.concat(["quantile","quantize","threshold"]),aR=Object(oe.cb)(oR),uR=Object(oe.cb)(["ordinal","bin-ordinal","point","band"]);function sR(e){return e in uR}function lR(e){return e in aR}function cR(e){return e in rR}function fR(e){return e in iR}function dR(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}const hR={type:1,domain:1,align:1,range: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:pR,domain:mR,range:gR,scheme:vR}=(rD(hR),hR),yR=k(hR,["type","domain","range","scheme"]),bR=rD(yR);!function(){var e;const t={};for(const n of iM)for(const r of rD(XP))for(const i of QP){const o=OR(n,r);ER(n,i)&&_R(i,r)&&(t[o]=null!=(e=t[o])?e:[],t[o].push(i))}}();function xR(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!XT(["point","band","identity"],e);case"bins":return!XT(["point","band","identity","ordinal"],e);case"round":return cR(e)||"band"===e||"point"===e;case"padding":return cR(e)||XT(["point","band"],e);case"paddingOuter":case"align":return XT(["point","band"],e);case"paddingInner":return"band"===e;case"clamp":return cR(e);case"nice":return cR(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return lR(e)&&!XT(["log","time","utc","threshold","quantile"],e)}}function wR(e,t){switch(t){case"interpolate":case"scheme":return eM(e)?void 0:hP.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"reverse":case"round":case"clamp":case"zero":return}}function _R(e,t){return XT(["ordinal","nominal"],t)?void 0===e||sR(e):"temporal"===t?XT([KP.TIME,KP.UTC,void 0],e):"quantitative"!==t||XT([KP.LOG,KP.POW,KP.SQRT,KP.SYMLOG,KP.QUANTILE,KP.QUANTIZE,KP.THRESHOLD,KP.LINEAR,void 0],e)}function ER(e,t){switch(e){case ID:case $D:return cR(t)||XT(["band","point"],t);case HD:case XD:case YD:case VD:case GD:return cR(t)||fR(t)||XT(["band","point"],t);case BD:case UD:case qD:return"band"!==t;case WD:return"ordinal"===t}return!1}function OR(e,t){return e+"_"+t}function kR(e){const{anchor:t,frame:n,offset:r,orient:i,color:o}=e,a=k(e,["anchor","frame","offset","orient","color"]);return{mark:Object.assign(Object.assign({},a),o?{fill:o}:{}),nonMark:Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),r?{offset:r}:{}),i?{orient:i}:{})}}function jR(e){return Object(oe.H)(e)||Object(oe.A)(e)&&Object(oe.H)(e[0])}function SR(e){var t;return[].concat(e.type,null!=(t=e.style)?t:[])}function CR(e,t,n){return pD(t[e],AR(e,t,n))}function AR(e,t,n,{vgChannel:r}={}){return pD(r?NR(e,t,n.style):void 0,NR(e,t,n.style),r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function NR(e,t,n){const r=SR(t);let i;for(const t of r){const r=n[t],o=e;r&&void 0!==r[o]&&(i=r[o])}return i}function TR(e,t,n,r){if(Oz(e)){const i=oz(e)&&e.scale&&e.scale.type===KP.UTC;return{signal:RR(sz(e,{expr:n}),e.timeUnit,t,r.timeFormat,i,!0)}}{const i=DR(e,t,r);if(Az(e.bin)){return{signal:PR(sz(e,{expr:n}),sz(e,{expr:n,binSuffix:"end"}),i,r)}}return"quantitative"===e.type||i?{signal:`${MR(sz(e,{expr:n,binSuffix:"range"}),i)}`}:{signal:`''+${sz(e,{expr:n})}`}}}function DR(e,t,n){return t||("quantitative"===e.type?n.numberFormat:void 0)}function MR(e,t){return`format(${e}, "${t||""}")`}function FR(e,t,n){return MR(e,null!=t?t:n.numberFormat)}function PR(e,t,n,r){return`${VP(e,!1)} ? "null" : ${FR(e,n,r)} + " – " + ${FR(t,n,r)}`}function RR(e,t,n,r,i,o=!1){return!t||n?(n=null!=n?n:r)||o?`${i?"utc":"time"}Format(${e}, '${n}')`:void 0:PP(t,e,i)}function zR(e,t){return Object(oe.i)(e).reduce((e,n)=>{var r;return e.field.push(sz(n,t)),e.order.push(null!=(r=n.sort)?r:"ascending"),e},{field:[],order:[]})}function LR(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if(UT(t,e))return;n.push(e)}),n}function IR(e,t){return UT(e,t)||!t?e:e?[...Object(oe.i)(e),...Object(oe.i)(t)].join(", "):t}function $R(e,t){const n=e.value,r=t.value;if(null==n||null===r)return{explicit:e.explicit,value:null};if(jR(n)&&jR(r))return{explicit:e.explicit,value:IR(n,r)};if(!jR(n)&&!jR(r))return{explicit:e.explicit,value:LR(n,r)};throw new Error("It should never reach here")}const BR="mean",UR={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function qR(e){return!!UR[e]}function WR(e){return!!e&&!!e.encoding}function HR(e){return!(!e||"count"!==e.op&&!e.field)}function YR(e){return!!e&&Object(oe.A)(e)}function VR(e){return!!e.row||!!e.column}function GR(e){return void 0!==e.facet}function XR(e){const{field:t,timeUnit:n,bin:r,aggregate:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},n?{timeUnit:n}:{}),r?{bin:r}:{}),i?{aggregate:i}:{}),{field:t})}function KR(e){return nz(e)&&!!e.sort}function JR(e,t,n,r,i,{isMidPoint:o}={}){const{timeUnit:a,bin:u}=t;if(XT(["x","y"],e)){if(az(t)&&void 0!==t.band)return t.band;if(a&&!n)return o?AR("timeUnitBandPosition",r,i):xD(r.type)?AR("timeUnitBand",r,i):0;if(Az(u))return xD(r.type)&&!o?1:.5}}function QR(e,t,n,r,i){return!!(Az(t.bin)||t.timeUnit&&nz(t)&&"temporal"===t.type)&&!!JR(e,t,n,r,i)}function ZR(e){return!!e&&!!e.condition}function ez(e){return!!e&&!!e.condition&&!Object(oe.A)(e.condition)&&tz(e.condition)}function tz(e){return!(!e||!e.field&&"count"!==e.aggregate)}function nz(e){return!!e&&(!!e.field&&!!e.type||"count"===e.aggregate)}function rz(e){return tz(e)&&Object(oe.H)(e.field)}function iz(e){return e&&"value"in e&&void 0!==e.value}function oz(e){return!(!e||!e.scale&&!e.sort)}function az(e){return!(!e||!e.axis&&!e.stack&&!e.impute&&void 0===e.band)}function uz(e){return!!e&&!!e.format}function sz(e,t={}){var n,r,i;let o=e.field;const a=t.prefix;let u=t.suffix,s="";if(function(e){return"count"===e.aggregate}(e))o=function(e){return 0===e.indexOf("__")}(l="count")?l:`__${l}`;else{let a;if(!t.nofn)if(function(e){return!!e.op}(e))a=e.op;else{const{bin:l,aggregate:c,timeUnit:f}=e;Az(l)?(a=Cz(l),u=(null!=(n=t.binSuffix)?n:"")+(null!=(r=t.suffix)?r:"")):c?DD(c)?(s=`.${o}`,o=`argmax_${c.argmax}`):TD(c)?(s=`.${o}`,o=`argmin_${c.argmin}`):a=String(c):f&&(a=String(f),u=(!XT(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!=(i=t.suffix)?i:""))}a&&(o=o?`${a}_${o}`:a)}var l;return u&&(o=`${o}_${u}`),a&&(o=`${a}_${o}`),t.forAs?o:t.expr?function(e,t="datum"){return`${t}[${Object(oe.Y)(Object(oe.X)(e).join("."))}]`}(o,t.expr)+s:fD(o)+s}function lz(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(hP.invalidFieldType(e.type))}function cz(e){return!lz(e)}const fz=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:r,field:i}=e;if(DD(t))return`${i} for argmax(${t.argmax})`;if(TD(t))return`${i} for argmin(${t.argmin})`;const o=t||r||Az(n)&&"bin";return o?o.toUpperCase()+"("+i+")":i}(e);default:return function(e,t){const{field:n,bin:r,timeUnit:i,aggregate:o}=e;if("count"===o)return t.countTitle;if(Az(r))return`${n} (binned)`;if(i){return`${n} (${DP(i).join("-")})`}return o?DD(o)?`${n} for max ${o.argmax}`:TD(o)?`${n} for min ${o.argmin}`:`${lD(o)} of ${n}`:n}(e,t)}};let dz=fz;function hz(e){dz=e}function pz(e,t,{allowDisabling:n,includeDefault:r=!0}){var i,o;const a=(null!=(i=mz(e))?i:{}).title,u=r?gz(e,t):void 0;return n?pD(a,e.title,u):null!=(o=null!=a?a:e.title)?o:u}function mz(e){return az(e)&&e.axis?e.axis:(t=e)&&t.legend&&e.legend?e.legend:function(e){return!!e&&!!e.header}(e)&&e.header?e.header:void 0;var t}function gz(e,t){return dz(e,t)}function vz(e){var t;if(uz(e)&&e.format)return e.format;return(null!=(t=mz(e))?t:{}).format}function yz(e){return tz(e)?e:ez(e)?e.condition:void 0}function bz(e){return tz(e)?e:ez(e)?e.condition:void 0}function xz(e,t){if(Object(oe.H)(e)||Object(oe.E)(e)||Object(oe.B)(e)){const n=Object(oe.H)(e)?"string":Object(oe.E)(e)?"number":"boolean";return vP(hP.primitiveChannelDef(t,n,e)),{value:e}}return tz(e)?wz(e,t):ez(e)?Object.assign(Object.assign({},e),{condition:wz(e.condition,t)}):e}function wz(e,t){const{aggregate:n,timeUnit:r,bin:i,field:o}=e,a=Object.assign({},e);if(!n||MD(n)||DD(n)||TD(n)||(vP(hP.invalidAggregate(n)),delete a.aggregate),r&&(a.timeUnit=RP(r)),o&&(a.field=`${o}`),Az(i)&&(a.bin=_z(i,t)),Nz(i)&&!XT(AM,t)&&vP(`Channel ${t} should not be used with "binned" bin`),nz(a)){const{type:e}=a,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case"quantitative":return"quantitative";case"t":case"temporal":return"temporal";case"o":case"ordinal":return"ordinal";case"n":case"nominal":return"nominal";case"geojson":return"geojson"}}(e);e!==t&&(a.type=t),"quantitative"!==e&&PD(n)&&(vP(hP.invalidFieldTypeForCountAggregate(e,n)),a.type="quantitative")}else if(!mM(t)){const e=function(e,t){if(e.timeUnit)return"temporal";if(Az(e.bin))return"quantitative";switch(GM(t)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}(a,t);vP(hP.missingFieldType(t,e)),a.type=e}if(nz(a)){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"row":case"column":case"facet":return cz(e)?{compatible:!1,warning:hP.facetChannelShouldBeDiscrete(t)}:Ez;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":case"url":return Ez;case"longitude":case"longitude2":case"latitude":case"latitude2":return"quantitative"!==n?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Ez;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return"nominal"!==n||e.sort?Ez:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return XT(["ordinal","nominal","geojson"],e.type)?Ez:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==e.type||"sort"in e?Ez:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}(a,t);e||vP(n)}if(KR(a)&&Object(oe.H)(a.sort)){const{sort:e}=a;if(qR(e))return Object.assign(Object.assign({},a),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&qR(t))return Object.assign(Object.assign({},a),{sort:{encoding:t,order:"descending"}})}return a}function _z(e,t){return Object(oe.B)(e)?{maxbins:Mz(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:Mz(t)})}const Ez={compatible:!0};function Oz(e){const t=mz(e),n=t&&t.formatType||uz(e)&&e.formatType;return"time"===n||!n&&function(e){return"temporal"===e.type||!!e.timeUnit}(e)}function kz(e,{timeUnit:t,type:n,time:r,undefinedIfExprNotRequired:i}){let o;var a;return yP(e)?o=EP(e,!0):(Object(oe.H)(e)||Object(oe.E)(e))&&(t||"temporal"===n)&&(o=function(e){return!!kP[e]}(t)?EP({[t]:e},!0):function(e){return!!SP[e]}(t)?kz(e,{timeUnit:(a=t,a.substr(3))}):`datetime(${JSON.stringify(e)})`),o?r?`time(${o})`:o:i?void 0:JSON.stringify(e)}function jz(e,t){const{timeUnit:n,type:r}=e;return t.map(e=>{const t=kz(e,{timeUnit:n,type:r,undefinedIfExprNotRequired:!0});return void 0!==t?{signal:t}:e})}function Sz(e,t){return Az(e.bin)?qM(t)&&XT(["ordinal","nominal"],e.type):(console.warn("Only use this method with binned field defs"),!1)}function Cz(e){return Object(oe.B)(e)&&(e=_z(e,void 0)),"bin"+rD(e).map(t=>Dz(e[t])?aD(`_${t}_${Object.entries(e[t])}`):aD(`_${t}_${e[t]}`)).join("")}function Az(e){return!0===e||Tz(e)&&!e.binned}function Nz(e){return"binned"===e||Tz(e)&&!0===e.binned}function Tz(e){return Object(oe.F)(e)}function Dz(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}function Mz(e){switch(e){case LD:case"column":case HD:case BD:case UD:case qD:case XD:case YD:case VD:case GD:case WD:return 6;default:return 10}}function Fz(e,t){const n=e&&e[t];return!!n&&(Object(oe.A)(n)?KT(n,e=>!!e.field):tz(n)||ez(n))}function Pz(e){return KT(iM,t=>{if(Fz(e,t)){const n=e[t];if(Object(oe.A)(n))return KT(n,e=>!!e.aggregate);{const e=yz(n);return e&&!!e.aggregate}}return!1})}function Rz(e,t){const n=[],r=[],i=[],o=[],a={};return Iz(e,(u,s)=>{if(tz(u)){const{field:l,aggregate:c,timeUnit:f,bin:d}=u,h=k(u,["field","aggregate","timeUnit","bin"]);if(c||f||d){const e=mz(u),p=e&&e.title;let m=sz(u,{forAs:!0});const g=Object.assign(Object.assign(Object.assign({},p?[]:{title:pz(u,t,{allowDisabling:!0})}),h),{field:m}),v="x"===s||"y"===s;if(c){let e;if(DD(c)?(e="argmax",m=sz({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${l}`):TD(c)?(e="argmin",m=sz({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${l}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};l&&(t.field=l),o.push(t)}}else if(n.push(m),nz(u)&&Az(d)){if(r.push({bin:d,field:l,as:m}),n.push(sz(u,{binSuffix:"end"})),Sz(u,s)&&n.push(sz(u,{binSuffix:"range"})),v){const e={field:m+"_end"};a[s+"2"]=e}g.bin="binned",mM(s)||(g.type="quantitative")}else if(f){i.push({timeUnit:f,field:l,as:m});const e=nz(u)&&"temporal"!==u.type&&"time";e&&("text"===s||"tooltip"===s?g.formatType=e:!function(e){return!!jM[e]}(s)?v&&(g.axis=Object.assign({formatType:e},g.axis)):g.legend=Object.assign({formatType:e},g.legend))}a[s]=g}else n.push(l),a[s]=e[s]}else a[s]=e[s]}),{bins:r,timeUnits:i,aggregate:o,groupby:n,encoding:a}}function zz(e,t){const n=t.type;return rD(e).reduce((r,i)=>{var o;if(!hM(i))return vP(hP.invalidEncodingChannel(i)),r;if(!function(e,t,n){const r=WM(t,n);if(!r)return!1;if("binned"===r){const n=e["x2"===t?"x":"y"];return!!(tz(n)&&tz(e[t])&&Nz(n.bin))}return!0}(e,i,n))return vP(hP.incompatibleChannel(i,n)),r;if("size"===i&&"line"===n){if(null===(o=bz(e[i]))||void 0===o?void 0:o.aggregate)return vP(hP.LINE_WITH_VARYING_SIZE),r}if("color"===i&&(t.filled?"fill"in e:"stroke"in e))return vP(hP.droppingColor("encoding",{fill:"fill"in e,stroke:"stroke"in e})),r;const a=e[i];if("detail"===i||"order"===i&&!Object(oe.A)(a)&&!iz(a)||"tooltip"===i&&Object(oe.A)(a))a&&(r[i]=(Object(oe.A)(a)?a:[a]).reduce((e,t)=>(tz(t)?e.push(wz(t,i)):vP(hP.emptyFieldDef(t,i)),e),[]));else{if("tooltip"===i&&null===a)r[i]=null;else if(!tz(a)&&!iz(a)&&!ZR(a))return vP(hP.emptyFieldDef(a,i)),r;r[i]=xz(a,i)}return r},{})}function Lz(e){const t=[];for(const n of rD(e))if(Fz(e,n)){const r=e[n],i=Object(oe.A)(r)?r:[r];for(const e of i)tz(e)?t.push(e):ez(e)&&t.push(e.condition)}return t}function Iz(e,t,n){if(e)for(const r of rD(e)){const i=e[r];Object(oe.A)(i)?i.forEach(e=>{t.call(n,e,r)}):t.call(n,i,r)}}function $z(e,t,n,r){return e?rD(e).reduce((n,i)=>{const o=e[i];return Object(oe.A)(o)?o.reduce((e,n)=>t.call(r,e,n,i),n):t.call(r,n,o,i)},n):n}function Bz(e,t){return rD(t).reduce((n,r)=>{switch(r){case"x":case"y":case"href":case"url":case"x2":case"y2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case"shape":case"tooltip":return n;case"order":if("line"===e||"trail"===e)return n;case"detail":case"key":{const e=t[r];return(Object(oe.A)(e)||tz(e))&&(Object(oe.A)(e)?e:[e]).forEach(e=>{e.aggregate||n.push(sz(e,{}))}),n}case"size":if("trail"===e)return n;case"color":case"fill":case"stroke":case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":{const e=bz(t[r]);return e&&!e.aggregate&&n.push(sz(e,{})),n}}},[])}function Uz(e,t,n,r=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>({field:e+t.field,type:t.type,title:n+(r?" of "+t.field:"")})),...Lz(n)]}}function qz(e){const{axis:t,title:n,field:r}=e;return t&&void 0!==t.title?void 0:pD(n,r)}function Wz(e,t,n,r,i){const{scale:o,axis:a}=n;return({partName:u,mark:s,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=qz(n);return Hz(e,u,i,{mark:s,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:l+"_"+n.field,type:n.type},void 0!==d?{title:d}:{}),void 0!==o?{scale:o}:{}),void 0!==a?{axis:a}:{})},Object(oe.H)(c)?{[t+"2"]:{field:c+"_"+n.field,type:n.type}}:{}),r),f)})}}function Hz(e,t,n,r){const{clip:i,color:o,opacity:a}=e,u=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},r),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),i?{clip:i}:{}),o?{color:o}:{}),a?{opacity:a}:{}),_D(r.mark)?r.mark:{type:r.mark}),{style:`${u}-${t}`}),Object(oe.B)(e[t])?{}:e[t])})]:[]}function Yz(e,t,n){const{encoding:r}=e,i="vertical"===t?"y":"x",o=r[i],a=r[i+"2"],u=r[i+"Error"],s=r[i+"Error2"];return{continuousAxisChannelDef:Vz(o,n),continuousAxisChannelDef2:Vz(a,n),continuousAxisChannelDefError:Vz(u,n),continuousAxisChannelDefError2:Vz(s,n),continuousAxis:i}}function Vz(e,t){if(e&&e.aggregate){const{aggregate:n}=e,r=k(e,["aggregate"]);return n!==t&&vP(hP.errorBarContinuousAxisHasCustomizedAggregate(n,t)),r}return e}function Gz(e,t){const{mark:n,encoding:r}=e;if(tz(r.x)&&cz(r.x)){if(tz(r.y)&&cz(r.y)){if(void 0===r.x.aggregate&&r.y.aggregate===t)return"vertical";if(void 0===r.y.aggregate&&r.x.aggregate===t)return"horizontal";if(r.x.aggregate===t&&r.y.aggregate===t)throw new Error("Both x and y cannot have aggregate");return _D(n)&&n.orient?n.orient:"vertical"}return"horizontal"}if(tz(r.y)&&cz(r.y))return"vertical";throw new Error("Need a valid continuous axis for "+t+"s")}const Xz=rD({box:1,median:1,outliers:1,rule:1,ticks:1}),Kz=new CD("boxplot",Qz);function Jz(e){return Object(oe.E)(e)?"tukey":e}function Qz(e,{config:t}){var n,r;const{mark:i,encoding:o,selection:a,projection:u}=e,s=k(e,["mark","encoding","selection","projection"]),l=_D(i)?i:{type:i};a&&vP(hP.selectionNotSupported("boxplot"));const c=null!=(n=l.extent)?n:t.boxplot.extent,f=pD(l.size,t.boxplot.size),d=Jz(c),{transform:h,continuousAxisChannelDef:p,continuousAxis:m,groupby:g,aggregate:v,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:w}=function(e,t,n){const r=Gz(e,"boxplot"),{continuousAxisChannelDef:i,continuousAxis:o}=Yz(e,r,"boxplot"),a=i.field,u=Jz(t),s=[...Zz(a),{op:"median",field:a,as:"mid_box_"+a},{op:"min",field:a,as:("min-max"===u?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===u?"upper_whisker_":"max_")+a}],l="min-max"===u||"tukey"===u?[]:[{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}],c=e.encoding,f=o,d=(c[f],k(c,["symbol"==typeof f?f:f+""])),{customTooltipWithoutAggregatedField:h,filteredEncoding:p}=function(e){const{tooltip:t}=e,n=k(e,["tooltip"]);if(!t)return{filteredEncoding:e};let r,i;return Object(oe.A)(t)?(t.forEach(e=>{e.aggregate?(r||(r=[]),r.push(e)):(i||(i=[]),i.push(e))}),r&&(n.tooltip=r)):t.aggregate?n.tooltip=t:i=t,Object(oe.A)(i)&&1===i.length&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}(d),{bins:m,timeUnits:g,aggregate:v,groupby:y,encoding:b}=Rz(p,n),x="vertical"===r?"horizontal":"vertical",w=r;return{transform:[...m,...g,{aggregate:[...v,...s],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:h}}(e,c,t),{color:_,size:E}=y,O=k(y,["color","size"]),j=e=>Wz(l,m,p,e,t.boxplot),S=j(O),C=j(y),A=j(Object.assign(Object.assign({},O),E?{size:E}:{})),N=Uz([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],p,y),T={type:"tick",color:"black",opacity:1,orient:b,invalid:null},D="min-max"===d?N:Uz([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,y),M=[...S({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:D}),...S({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:D}),...S({partName:"ticks",mark:T,positionPrefix:"lower_whisker",extraEncoding:D}),...S({partName:"ticks",mark:T,positionPrefix:"upper_whisker",extraEncoding:D})],F=[..."tukey"!==d?M:[],...C({partName:"box",mark:Object.assign(Object.assign({type:"bar"},f?{size:f}:{}),{orient:x,invalid:null}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:N}),...A({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},Object(oe.F)(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),f?{size:f}:{}),{orient:b}),positionPrefix:"mid_box",extraEncoding:N})];let P;if("min-max"!==d){const e=`datum["lower_box_${p.field}"]`,n=`datum["upper_box_${p.field}"]`,r=`(${n} - ${e})`,i=`${e} - ${c} * ${r}`,o=`${n} + ${c} * ${r}`,a=`datum["${p.field}"]`,u={joinaggregate:Zz(p.field),groupby:g};let s=void 0;"tukey"===d&&(s={transform:[{filter:`(${i} <= ${a}) && (${a} <= ${o})`},{aggregate:[{op:"min",field:p.field,as:"lower_whisker_"+p.field},{op:"max",field:p.field,as:"upper_whisker_"+p.field},{op:"min",field:"lower_box_"+p.field,as:"lower_box_"+p.field},{op:"max",field:"upper_box_"+p.field,as:"upper_box_"+p.field},...v],groupby:g}],layer:M});const{tooltip:f}=O,h=k(O,["tooltip"]),{scale:y,axis:b}=p,x=qz(p),_=Hz(l,"outliers",t.boxplot,{transform:[{filter:`(${a} < ${i}) || (${a} > ${o})`}],mark:"point",encoding:Object.assign(Object.assign({[m]:Object.assign(Object.assign(Object.assign({field:p.field,type:p.type},void 0!==x?{title:x}:{}),void 0!==y?{scale:y}:{}),void 0!==b?{axis:b}:{})},h),w?{tooltip:w}:{})})[0];_&&s?P={transform:[u],layer:[_,s]}:_?(P=_,P.transform.unshift(u)):s&&(P=s,P.transform.unshift(u))}return P?Object.assign(Object.assign({},s),{layer:[P,{transform:h,layer:F}]}):Object.assign(Object.assign({},s),{transform:(r=s.transform,null!=r?r:[]).concat(h),layer:F})}function Zz(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const eL=rD({ticks:1,rule:1}),tL=new CD("errorbar",nL);function nL(e,{config:t}){const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:u,outerSpec:s,tooltipEncoding:l}=iL(e,"errorbar",t),c=Wz(u,i,r,o,t.errorbar),f={type:"tick",orient:a};return Object.assign(Object.assign({},s),{transform:n,layer:[...c({partName:"ticks",mark:f,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:f,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:"rule",positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})]})}function rL(e,t){const{encoding:n}=e;if(function(e){return(tz(e.x)||tz(e.y))&&!tz(e.x2)&&!tz(e.y2)&&!tz(e.xError)&&!tz(e.xError2)&&!tz(e.yError)&&!tz(e.yError2)}(n))return{orient:Gz(e,t),inputType:"raw"};const r=function(e){return tz(e.x2)||tz(e.y2)}(n),i=function(e){return tz(e.xError)||tz(e.xError2)||tz(e.yError)||tz(e.yError2)}(n),o=n.x,a=n.y;if(r){if(i)throw new Error(t+" cannot be both type aggregated-upper-lower and aggregated-error");const e=n.x2,r=n.y2;if(tz(e)&&tz(r))throw new Error(t+" cannot have both x2 and y2");if(tz(e)){if(tz(o)&&cz(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+t)}if(tz(r)){if(tz(a)&&cz(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,r=n.xError2,i=n.yError,u=n.yError2;if(tz(r)&&!tz(e))throw new Error(t+" cannot have xError2 without xError");if(tz(u)&&!tz(i))throw new Error(t+" cannot have yError2 without yError");if(tz(e)&&tz(i))throw new Error(t+" cannot have both xError and yError with both are quantiative");if(tz(e)){if(tz(o)&&cz(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(tz(i)){if(tz(a)&&cz(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")}}function iL(e,t,n){var r;const{mark:i,encoding:o,selection:a,projection:u}=e,s=k(e,["mark","encoding","selection","projection"]),l=_D(i)?i:{type:i};a&&vP(hP.selectionNotSupported(t));const{orient:c,inputType:f}=rL(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:h,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:g}=Yz(e,c,t),{errorBarSpecificAggregate:v,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:x}=function(e,t,n,r,i,o,a,u){let s=[],l=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":u.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&vP(hP.errorBarCenterIsUsedWithWrongExtent(t,n,a)),"stderr"===n||"stdev"===n)s=[{op:n,field:c,as:"extent_"+c},{op:t,field:c,as:"center_"+c}],l=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:"upper_"+c},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:"lower_"+c}],f=[{fieldPrefix:"center_",titlePrefix:lD(t)},{fieldPrefix:"upper_",titlePrefix:oL(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:oL(t,n,"-")}],d=!0;else{let t,r,i;e.center&&e.extent&&vP(hP.errorBarCenterIsNotNeeded(e.extent,a)),"ci"===n?(t="mean",r="ci0",i="ci1"):(t="median",r="q1",i="q3"),s=[{op:r,field:c,as:"lower_"+c},{op:i,field:c,as:"upper_"+c},{op:t,field:c,as:"center_"+c}],f=[{fieldPrefix:"upper_",titlePrefix:pz({field:c,aggregate:i,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:pz({field:c,aggregate:r,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:pz({field:c,aggregate:t,type:"quantitative"},u,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&vP(hP.errorBarCenterAndExtentAreNotNeeded(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:`datum["${n.field}"]`,as:"upper_"+c},{calculate:`datum["${c}"]`,as:"lower_"+c}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`datum["${c}"] + datum["${r.field}"]`,as:"upper_"+c}],i?l.push({calculate:`datum["${c}"] + datum["${i.field}"]`,as:"lower_"+c}):l.push({calculate:`datum["${c}"] - datum["${r.field}"]`,as:"lower_"+c}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:dD(dD(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:s,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,d,h,p,m,f,t,n),w=g,_=(o[w],"x"===g?"x2":"y2"),E=(o[_],"x"===g?"xError":"yError"),O=(o[E],"x"===g?"xError2":"yError2"),j=(o[O],k(o,["symbol"==typeof w?w:w+"","symbol"==typeof _?_:_+"","symbol"==typeof E?E:E+"","symbol"==typeof O?O:O+""])),{bins:S,timeUnits:C,aggregate:A,groupby:N,encoding:T}=Rz(j,n),D=[...A,...v],M="raw"!==f?[]:N,F=Uz(b,d,T,x);return{transform:[...(r=s.transform,null!=r?r:[]),...S,...C,...0===D.length?[]:[{aggregate:D,groupby:M}],...y],groupby:M,continuousAxisChannelDef:d,continuousAxis:g,encodingWithoutContinuousAxis:T,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:F}}function oL(e,t,n){return lD(e)+" "+n+" "+t}const aL=rD({band:1,borders:1}),uL=new CD("errorband",sL);function sL(e,{config:t}){const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:u,tooltipEncoding:s}=iL(e,"errorband",t),l=a,c=Wz(l,i,r,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=Object.assign(Object.assign({},l.interpolate?{interpolate:l.interpolate}:{}),l.tension&&l.interpolate?{interpolate:l.tension}:{});return f?(d=Object.assign(Object.assign({},d),p),h=Object.assign(Object.assign({},h),p)):l.interpolate?vP(hP.errorBand1DNotSupport("interpolate")):l.tension&&vP(hP.errorBand1DNotSupport("tension")),Object.assign(Object.assign({},u),{transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:s}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:s}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:s})]})}const lL={};function cL(e,t,n){const r=new CD(e,t);lL[e]={normalizer:r,parts:n}}cL("boxplot",Qz,Xz),cL("errorbar",nL,eL),cL("errorband",sL,aL);const fL=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],dL={clipHeight:1,columnPadding:1,columns:1,cornerRadius: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},hL=(rD(dL),{single:{on:"click",fields:["_vgsid_"],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:["_vgsid_"],toggle:"event.shiftKey",resolve:"global",empty:"all",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 pL(e){return!(!e||"legend"!==e&&!e.legend)}function mL(e){return pL(e)&&Object(oe.F)(e)}function gL(e){return void 0!==e.concat}function vL(e){return void 0!==e.vconcat}function yL(e){return void 0!==e.hconcat}function bL(e){return void 0!==e.repeat}function xL(e){return Object(oe.F)(e)&&void 0!==e.step}const wL=rD({align:1,bounds:1,center:1,columns:1,spacing:1});function _L(e,t){var n;return null!=(n=e[t])?n:e["width"===t?"continuousWidth":"continuousHeight"]}function EL(e,t){const n=OL(e,t);return xL(n)?n.step:kL}function OL(e,t){var n;return pD(null!=(n=e[t])?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const kL=20;const jL={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:kL},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},area:{},bar:kD,circle:{},geoshape:{},image:{},line:{},point:{},rect:jD,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,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},axis:{},axisX:{},axisY:{},axisLeft:{},axisRight:{},axisTop:{},axisBottom:{},axisBand:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:hL,style:{},title:{},facet:{spacing:20},repeat:{spacing:20},concat:{spacing:20}};function SL(e){return Object(oe.M)({},jL,e)}const CL=["view",...wD],AL=["background","padding","facet","concat","repeat","numberFormat","timeFormat","countTitle","header","scale","selection","overlay"],NL=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function TL(e){e=qT(e);for(const t of AL)delete e[t];if(e.legend)for(const t of fL)delete e.legend[t];if(e.mark)for(const t of OD)delete e.mark[t];for(const t of CL){for(const n of OD)delete e[t][n];const n=NL[t];if(n)for(const r of n)delete e[t][r];DL(e,t)}for(const t of rD(lL))delete e[t];DL(e,"title","group-title");for(const t in e)Object(oe.F)(e[t])&&0===rD(e[t]).length&&delete e[t];return rD(e).length>0?e:void 0}function DL(e,t,n,r){const i="title"===t?kR(e.title).mark:r?e[t][r]:e[t];"view"===t&&(n="cell");const o=Object.assign(Object.assign({},i),e.style[t]);rD(o).length>0&&(e.style[null!=n?n:t]=o),r||delete e[t]}function ML(e){return void 0!==e.layer}class FL{map(e,t){return GR(e)?this.mapFacet(e,t):bL(e)?this.mapRepeat(e,t):yL(e)?this.mapHConcat(e,t):vL(e)?this.mapVConcat(e,t):gL(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(ML(e))return this.mapLayer(e,t);if(SD(e))return this.mapUnit(e,t);throw new Error(hP.invalidSpec(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,r=k(e,["concat"]);return Object.assign(Object.assign({},r),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}const PL={zero:1,center:1,normalize:1};const RL=["bar","area","rule","point","circle","square","line","text","tick"],zL=["bar","area"];function LL(e,t,n={}){const r=_D(e)?e.type:e;if(!XT(RL,r))return null;const i=function(e){const t=e.x,n=e.y;if(tz(t)&&tz(n))if("quantitative"===t.type&&"quantitative"===n.type){if(t.stack)return"x";if(n.stack)return"y";if(!!t.aggregate!=!!n.aggregate)return t.aggregate?"x":"y"}else{if("quantitative"===t.type)return"x";if("quantitative"===n.type)return"y"}else{if(tz(t)&&"quantitative"===t.type)return"x";if(tz(n)&&"quantitative"===n.type)return"y"}}(t);if(!i)return null;const o=t[i],a=rz(o)?sz(o,{}):void 0,u="x"===i?"y":"x",s=t[u],l=rz(s)?sz(s,{}):void 0,c=SM.reduce((e,n)=>{if("tooltip"!==n&&Fz(t,n)){const r=t[n];(Object(oe.A)(r)?r:[r]).forEach(t=>{const r=bz(t);if(r.aggregate)return;const i=rz(r)?sz(r,{}):void 0;(!i||i!==l&&i!==a)&&e.push({channel:n,fieldDef:r})})}return e},[]);let f;if(void 0!==o.stack?f=Object(oe.B)(o.stack)?o.stack?"zero":null:o.stack:c.length>0&&XT(zL,r)&&(f="zero"),!f||!PL[f])return null;if(Pz(t)&&0===c.length)return null;if(o.scale&&o.scale.type&&o.scale.type!==KP.LINEAR){if(n.disallowNonLinearStack)return null;vP(hP.cannotStackNonLinearScale(o.scale.type))}return Fz(t,i===ID?"x2":"y2")?(void 0!==o.stack&&vP(hP.cannotStackRangedMark(i)),null):(o.aggregate&&!XT(RD,o.aggregate)&&vP(hP.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:s?u:void 0,fieldChannel:i,impute:null!==o.impute&&bD(r),stackBy:c,offset:f})}function IL(e){const{point:t,line:n}=e,r=k(e,["point","line"]);return rD(r).length>1?r:r.type}function $L(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:HT(e[t],["point","line"])}));return e}function BL(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?Object(oe.F)(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?Object(oe.F)(t.point)?t.point:{}:void 0}function UL(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 qL{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(SD(e)){const{mark:n,encoding:r}=e,i=_D(n)?n:{type:n};switch(i.type){case"line":case"rule":case"trail":return!!BL(i,t[i.type],r);case"area":return!!BL(i,t[i.type],r)||!!UL(i,t[i.type])}}return!1}run(e,t,n){const{config:r}=t,{selection:i,projection:o,encoding:a,mark:u}=e,s=k(e,["selection","projection","encoding","mark"]),l=_D(u)?u:{type:u},c=BL(l,r[l.type],a),f="area"===l.type&&UL(l,r[l.type]),d=[Object.assign(Object.assign({},i?{selection:i}:{}),{mark:IL(Object.assign(Object.assign({},l),"area"===l.type?{opacity:.7}:{})),encoding:HT(a,["shape"])})],h=LL(l,a);let p=a;if(h){const{fieldChannel:e,offset:t}=h;p=Object.assign(Object.assign({},a),{[e]:Object.assign(Object.assign({},a[e]),t?{stack:t}:{})})}return f&&d.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"line"},WT(l,["clip","interpolate","tension","tooltip"])),f),encoding:p})),c&&d.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},WT(l,["clip","tooltip"])),c),encoding:p})),n(Object.assign(Object.assign({},s),{layer:d}),Object.assign(Object.assign({},t),{config:$L(r)}))}}class WL{constructor(){this.name="RangeStep"}hasMatchingType(e){var t,n;if(SD(e)&&e.encoding)for(const r of AM){const i=e.encoding[r];if(i&&tz(i)&&(null===(n=null===(t=i)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep))return!0}return!1}run(e){var t,n;const r={};let i=Object.assign({},e.encoding);for(const e of AM){const o=NM(e),a=i[e];if(a&&tz(a)&&(null===(n=null===(t=a)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep)){const{scale:t}=a,n=k(a,["scale"]),u=t,{rangeStep:s}=u,l=k(u,["rangeStep"]);r[o]={step:t.rangeStep},vP(hP.RANGE_STEP_DEPRECATED),i=Object.assign(Object.assign({},i),{[e]:Object.assign(Object.assign({},n),rD(l).length>0?{scale:l}:{})})}}return Object.assign(Object.assign(Object.assign({},r),e),{encoding:i})}}class HL{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(SD(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of pM){const n=t[gM(e)];if(t[e]&&tz(n)&&!Nz(n.bin))return!0}}return!1}run(e,t,n){const{encoding:r}=e;return vP(hP.lineWithRange(!!r.x2,!!r.y2)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function YL(e){const{parentEncoding:t,encoding:n}=e;if(t&&n){const e=rD(t).reduce((e,t)=>(n[t]&&e.push(t),e),[]);e.length>0&&vP(hP.encodingOverridden(e))}const r=Object.assign(Object.assign({},null!=t?t:{}),null!=n?n:{});return rD(r).length>0?r:void 0}function VL(e){const{parentProjection:t,projection:n}=e;return t&&n&&vP(hP.projectionOverridden({parentProjection:t,projection:n})),null!=n?n:t}function GL(e,t){void 0===t&&(t=SL(e.config));const n=function(e,t={}){return XL.map(e,{config:t})}(e,t),{width:r,height:i}=e,o=function(e,t,n){let{width:r,height:i}=t;const o=SD(e)||ML(e),a={};o?"container"==r&&"container"==i?(a.type="fit",a.contains="padding"):"container"==r?(a.type="fit-x",a.contains="padding"):"container"==i&&(a.type="fit-y",a.contains="padding"):("container"==r&&(vP(hP.containerSizeNonSingle("width")),r=void 0),"container"==i&&(vP(hP.containerSizeNonSingle("height")),i=void 0));const u=Object.assign(Object.assign(Object.assign({type:"pad"},a),n?KL(n.autosize):{}),KL(e.autosize));"fit"!==u.type||o||(vP(hP.FIT_NON_SINGLE),u.type="pad");"container"==r&&"fit"!=u.type&&"fit-x"!=u.type&&vP(hP.containerSizeNotCompatibleWithAutosize("width"));"container"==i&&"fit"!=u.type&&"fit-y"!=u.type&&vP(hP.containerSizeNotCompatibleWithAutosize("height"));if(UT(u,{type:"pad"}))return;return u}(n,{width:r,height:i,autosize:e.autosize},t);return Object.assign(Object.assign({},n),o?{autosize:o}:{})}const XL=new class extends FL{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[Kz,tL,uL,new qL,new HL,new WL]}map(e,t){if(SD(e)){const n=Fz(e.encoding,LD),r=Fz(e.encoding,"column"),i=Fz(e.encoding,"facet");if(n||r||i)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:r}=t;if(n||r)return this.mapUnitWithParentEncodingOrProjection(e,t);const i=this.mapLayerOrUnit.bind(this);for(const n of this.nonFacetUnitNormalizers)if(n.hasMatchingType(e,t.config))return n.run(e,t,i);return e}mapRepeat(e,t){const{repeat:n}=e;return!Object(oe.A)(n)&&e.columns&&(e=HT(e,["columns"]),vP(hP.columnsNotSupportByRowCol("repeat"))),Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapFacet(e,t){const{facet:n}=e;return VR(n)&&e.columns&&(e=HT(e,["columns"]),vP(hP.columnsNotSupportByRowCol("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:r}=e,{parentEncoding:i,parentProjection:o,config:a}=t,u=VL({parentProjection:o,projection:r}),s=YL({parentEncoding:i,encoding:n});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),u?{projection:u}:{}),s?{encoding:s}:{}),{config:a})}mapFacetedUnit(e,t){const n=e.encoding,{row:r,column:i,facet:o}=n,a=k(n,["row","column","facet"]),{mark:u,width:s,projection:l,height:c,selection:f,encoding:d}=e,h=k(e,["mark","width","projection","height","selection","encoding"]),{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:r,column:i,facet:o});return this.mapFacet(Object.assign(Object.assign(Object.assign({},h),m),{facet:p,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l?{projection:l}:{}),{mark:u}),s?{width:s}:{}),c?{height:c}:{}),{encoding:a}),f?{selection:f}:{})}),t)}getFacetMappingAndLayout(e){var t;const{row:n,column:r,facet:i}=e;if(n||r){i&&vP(hP.facetChannelDropped([...n?[LD]:[],...r?["column"]:[]]));const o={},a={};for(const n of[LD,"column"]){const r=e[n];if(r){const{align:e,center:i,spacing:u,columns:s}=r,l=k(r,["align","center","spacing","columns"]);o[n]=l;for(const e of["align","center","spacing"])void 0!==r[e]&&(a[e]=null!=(t=a[e])?t:{},a[e][n]=r[e])}}return{facetMapping:o,layout:a}}{const{align:e,center:t,spacing:n,columns:r}=i;return{facetMapping:k(i,["align","center","spacing","columns"]),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),t?{center:t}:{}),n?{spacing:n}:{}),r?{columns:r}:{})}}}mapLayer(e,t){var{parentEncoding:n,parentProjection:r}=t,i=k(t,["parentEncoding","parentProjection"]);const{encoding:o,projection:a}=e,u=k(e,["encoding","projection"]),s=Object.assign(Object.assign({},i),{parentEncoding:YL({parentEncoding:n,encoding:o}),parentProjection:VL({parentProjection:r,projection:a})});return super.mapLayer(u,s)}};function KL(e){return Object(oe.H)(e)?{type:e}:null!=e?e:{}}const JL=["background","padding"];function QL(e){return JL.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}function ZL(e){return!!e.url}function eI(e){return!!e.values}function tI(e){return!(!e.name||ZL(e)||eI(e)||nI(e))}function nI(e){return e&&(rI(e)||iI(e)||oI(e))}function rI(e){return!!e.sequence}function iI(e){return!!e.sphere}function oI(e){return!!e.graticule}const aI="main";function uI(e){return void 0!==e.filter}function sI(e){return void 0!==e.lookup}function lI(e){return void 0!==e.pivot}function cI(e){return void 0!==e.density}function fI(e){return void 0!==e.quantile}function dI(e){return void 0!==e.regression}function hI(e){return void 0!==e.loess}function pI(e){return void 0!==e.sample}function mI(e){return void 0!==e.window}function gI(e){return void 0!==e.joinaggregate}function vI(e){return void 0!==e.flatten}function yI(e){return void 0!==e.calculate}function bI(e){return!!e.bin}function xI(e){return void 0!==e.impute}function wI(e){return void 0!==e.timeUnit}function _I(e){return void 0!==e.aggregate}function EI(e){return void 0!==e.stack}function OI(e){return void 0!==e.fold}function kI(e){return!!e.signal}function jI(e){return!!e.step}function SI(e){return!Object(oe.A)(e)&&("field"in e&&"data"in e)}const CI=rD({opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeMiterLimit: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,x:1,y:1,x2:1,y2:1,width:1,height:1,aspect:1}),AI=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"],NI={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"},gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDash"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDash"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickWidth:{part:"ticks",vgProp:"strokeWidth"}};const TI=["domain","grid","labels","ticks","title"],DI={grid:"grid",gridColor:"grid",gridDash:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",domain:"main",domainColor:"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",labelFontWeight:"main",labelLimit:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",maxExtent:"main",minExtent:"main",offset:"main",position:"main",tickColor:"main",tickExtra:"main",tickOffset:"both",tickOpacity:"main",tickRound:"main",ticks:"main",tickSize:"main",title:"main",titleAlign:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",tickWidth:"both",tickCount:"both",values:"both",scale:"both",zindex:"both"},MI={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid: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,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand: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,values:1,translate:1,zindex:1},FI=Object.assign(Object.assign({},MI),{labelExpr:1,encoding:1});rD(FI);function PI(e,t,n,r){const i=t&&t.condition,o=r(t);if(i){return{[n]:[...Object(oe.i)(i).map(t=>{const n=r(t),i=function(e){return e.selection}(t)?J$(e,t.selection):Z$(e,t.test);return Object.assign({test:i},n)}),...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function RI(e){const{channel:t,channelDef:n,markDef:r,scale:i}=e,o=UI(e);return tz(n)&&!PD(n.aggregate)&&i&&cR(i.get("type"))&&!1===i.get("zero")?zI({fieldDef:n,channel:t,markDef:r,ref:o}):o}function zI({fieldDef:e,channel:t,markDef:n,ref:r}){return bD(n.type)?r:[LI(e,t),r]}function LI(e,t){const n=II(e,!0),r="x"===gM(t)?{value:0}:{field:{group:"height"}};return Object.assign({test:n},r)}function II(e,t=!0){return VP(Object(oe.H)(e)?e:sz(e,{expr:"datum"}),!t)}function $I(e,t,n,r){const i=Object.assign(Object.assign({},t?{scale:t}:{}),{field:sz(e,n)});if(r){const{offset:e,band:t}=r;return Object.assign(Object.assign(Object.assign({},i),e?{offset:e}:{}),t?{band:t}:{})}return i}function BI({scaleName:e,fieldDef:t,fieldDef2:n,offset:r,startSuffix:i,band:o=.5}){const a=0UI({channel:e,channelDef:n,markDef:r,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:u}))}function HI(e){const{markDef:t,encoding:n,config:r}=e,{filled:i,type:o}=t,a={fill:AR("fill",t,r),stroke:AR("stroke",t,r),color:AR("color",t,r)},u=XT(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,s=pD(t.fill,!0===i?t.color:void 0,a.fill,!0===i?a.color:void 0,u),l=pD(t.stroke,!1===i?t.color:void 0,a.stroke,!1===i?a.color:void 0),c=i?"fill":"stroke",f=Object.assign(Object.assign({},s?{fill:{value:s}}:{}),l?{stroke:{value:l}}:{});return t.color&&(i?t.fill:t.stroke)&&vP(hP.droppingColor("property",{fill:"fill"in t,stroke:"stroke"in t})),Object.assign(Object.assign(Object.assign(Object.assign({},f),WI("color",e,{vgChannel:c,defaultValue:i?s:l})),WI("fill",e,{defaultValue:n.fill?s:void 0})),WI("stroke",e,{defaultValue:n.stroke?l:void 0}))}function YI(e,t="text"){const n=e.encoding[t];return PI(e,n,t,t=>VI(t,e.config))}function VI(e,t,n="datum"){if(e){if(iz(e))return{value:e.value};if(nz(e))return TR(e,vz(e),n,t)}}function GI(e,t={}){const{encoding:n,markDef:r,config:i}=e,o=n.tooltip;return Object(oe.A)(o)?{tooltip:XI({tooltip:o},i,t)}:PI(e,o,"tooltip",o=>{const a=VI(o,e.config,t.reactiveGeom?"datum.datum":"datum");if(a)return a;if(null===o)return;let u=pD(r.tooltip,AR("tooltip",r,i));return!0===u&&(u={content:"encoding"}),Object(oe.H)(u)?{value:u}:Object(oe.F)(u)?"encoding"===u.content?XI(n,i,t):{signal:"datum"}:void 0})}function XI(e,t,{reactiveGeom:n}={}){const r=[],i={},o={},a=n?"datum.datum":"datum",u=[];function s(n,r){const i=gM(r),s=nz(n)?n:Object.assign(Object.assign({},n),{type:e[i].type}),l=Object(oe.i)(pz(s,t,{allowDisabling:!1})).join(", ");let c=VI(s,t,a).signal;if("x"===r||"y"===r){const n="x"===r?"x2":"y2",i=yz(e[n]);if(Nz(s.bin)&&i){c=PR(sz(s,{expr:a}),sz(i,{expr:a}),vz(s),t),o[n]=!0}}u.push({channel:r,key:l,value:c})}Iz(e,(e,t)=>{tz(e)?s(e,t):ez(e)&&s(e.condition,t)});for(const{channel:e,key:t,value:n}of u)o[e]||i[t]||(r.push(`${Object(oe.Y)(t)}: ${n}`),i[t]=!0);return r.length>0?{signal:`{${r.join(", ")}}`}:void 0}function KI(e,t){const n=t[e+"Offset"];if(n)return n}function JI(e,t,{defaultPos:n,vgChannel:r}){const{encoding:i,mark:o,markDef:a,config:u,stack:s}=t,l=i[e],c=i[e===ID?"x2":"y2"],f=t.scaleName(e),d=t.getScaleComponent(e),h=KI(e,t.markDef),p=QI({model:t,markDef:a,config:u,defaultPos:n,channel:e,scaleName:f,scale:d,mark:o,checkBarAreaWithoutZero:!c});return{[null!=r?r:e]:l||!i.latitude&&!i.longitude?function(e){const{channel:t,channelDef:n,scaleName:r,stack:i,offset:o}=e;if(tz(n)&&i&&t===i.fieldChannel)return az(n)&&void 0!==n.band?BI({scaleName:r,fieldDef:n,startSuffix:"start",band:n.band,offset:0}):$I(n,r,{suffix:"end"},{offset:o});return RI(e)}({channel:e,channelDef:l,channel2Def:c,markDef:a,config:u,scaleName:f,scale:d,stack:s,offset:h,defaultRef:p}):{field:t.getName(e)}}}function QI({model:e,markDef:t,config:n,defaultPos:r,channel:i,scaleName:o,scale:a,mark:u,checkBarAreaWithoutZero:s}){return()=>{const l=gM(i),c=pD(t[i],AR(i,t,n));if(void 0!==c)return qI(i,c);if("zeroOrMin"===r||"zeroOrMax"===r){if(o){const e=a.get("type");if(XT([KP.LOG,KP.TIME,KP.UTC],e))!s||"bar"!==u&&"area"!==u||vP(hP.nonZeroScaleUsedWithLengthMark(u,l,{scaleType:e}));else{if(a.domainDefinitelyIncludesZero())return{scale:o,value:0};!s||"bar"!==u&&"area"!==u||vP(hP.nonZeroScaleUsedWithLengthMark(u,l,{zeroFalse:!1===a.explicit.zero}))}}return"zeroOrMin"===r?"x"===l?{value:0}:{field:{group:"height"}}:"x"===l?{field:{group:"width"}}:{value:0}}{const t=e["x"===l?"width":"height"];return Object.assign(Object.assign({},t),{mult:.5})}}}const ZI={left:"x",center:"xc",right:"x2"},e$={top:"y",middle:"yc",bottom:"y2"};function t$(e,t,n){const r="x"===e?"align":"baseline",i=pD(t[r],AR(r,t,n));return"x"===e?ZI[null!=i?i:"center"]:e$[null!=i?i:"middle"]}function n$(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?r$(e,t,{defaultPos:n,defaultPos2:r}):JI(e,t,{defaultPos:n})}function r$(e,t,{defaultPos:n,defaultPos2:r}){const{markDef:i,config:o}=t,a="x"===e?"width":"height",u=function(e,t,n){const{encoding:r,mark:i,markDef:o,stack:a,config:u}=e,s="x2"===n?"x":"y",l="x2"===n?"width":"height",c=r[s],f=e.scaleName(s),d=e.getScaleComponent(s),h=KI(n,e.markDef);if(!c&&(r.latitude||r.longitude))return{[n]:{field:e.getName(n)}};const p=function({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:l}){if(tz(t)&&u&&e.charAt(0)===u.fieldChannel.charAt(0))return $I(t,o,{suffix:"start"},{offset:s});return RI({channel:e,channelDef:n,scaleName:o,scale:a,stack:u,markDef:r,config:i,offset:s,defaultRef:l})}({channel:n,channelDef:c,channel2Def:r[n],markDef:o,config:u,scaleName:f,scale:d,stack:a,offset:h,defaultRef:void 0});if(void 0!==p)return{[n]:p};const m=QI({model:e,markDef:o,config:u,defaultPos:t,channel:n,scaleName:f,scale:d,mark:i,checkBarAreaWithoutZero:!r[n]})();return pD(i$(n,o),i$(n,{[n]:NR(n,o,u.style),[l]:NR(l,o,u.style)}),i$(n,u[i]),i$(n,u.mark),{[n]:m})}(t,r,"x"===e?"x2":"y2"),s=u[a]?t$(e,i,o):e;return Object.assign(Object.assign({},JI(e,t,{defaultPos:n,vgChannel:s})),u)}function i$(e,t){const n="x2"===e?"width":"height";return t[e]?{[e]:qI(e,t[e])}:t[n]?{[n]:{value:t[n]}}:void 0}function o$(e,t,n){var r,i,o,a;const{config:u,encoding:s,markDef:l}=e,c="x"===t?"x2":"y2",f="x"===t?"width":"height",d=s[t],h=s[c],p=e.getScaleComponent(t),m=p?p.get("type"):void 0,g=e.scaleName(t),v=l.orient,y=null!=(a=null!=(o=null!=(i=null!=(r=s[f])?r:s.size)?i:l[f])?o:l.size)?a:AR("size",l,u,{vgChannel:f}),b="x"===t?"vertical"===v:"horizontal"===v;if(tz(d)&&(Az(d.bin)||Nz(d.bin)||d.timeUnit&&!h)&&!y&&!sR(m)){return function({fieldDef:e,fieldDef2:t,channel:n,band:r,scaleName:i,markDef:o,spacing:a=0,reverse:u}){const s={x:u?a:0,x2:u?0:a,y:u?0:a,y2:u?a:0},l=n===ID?"x2":"y2";return Az(e.bin)||e.timeUnit?{[l]:s$({channel:n,fieldDef:e,scaleName:i,markDef:o,band:(1-r)/2,offset:s[`${n}2`]}),[n]:s$({channel:n,fieldDef:e,scaleName:i,markDef:o,band:1-(1-r)/2,offset:s[n]})}:Nz(e.bin)&&tz(t)?{[l]:$I(e,i,{},{offset:s[`${n}2`]}),[n]:$I(t,i,{},{offset:s[n]})}:void vP(hP.channelRequiredForBinned(l))}({fieldDef:d,fieldDef2:h,channel:t,markDef:l,scaleName:g,band:JR(t,d,void 0,l,u),spacing:pD(l.binSpacing,u[n].binSpacing),reverse:p.get("reverse")})}if((tz(d)&&sR(m)||b)&&!h){if(tz(d)&&m===KP.BAND){return function(e,t,n,r){var i;const o=n.scaleName(t),a="x"===t?"width":"height",{markDef:u,encoding:s,config:l}=n,c={[t$(t,u,l)]:$I(e,o,{},{band:.5})};if(s.size||null!==u.size&&void 0!==u.size){if(u.orient){if(bz(s.size)||iz(s.size))return Object.assign(Object.assign({},c),WI("size",n,{vgChannel:a}));if(void 0!==u.size)return Object.assign(Object.assign({},c),{[a]:{value:u.size}})}else vP(hP.cannotApplySizeToNonOrientedMark(u.type))}if(void 0!==(null===(i=r)||void 0===i?void 0:i.value))return Object.assign(Object.assign({},c),{[a]:r});const{band:f=1}=e;return{[t]:$I(e,o,{binSuffix:"range"},{band:(1-f)/2}),[a]:null!=r?r:u$(o,f)}}(d,t,e,a$(n,l,f,g,p,u,az(d)?d.band:void 0))}return function(e,t,n){const r="x"===e?"xc":"yc",i="x"===e?"width":"height";return Object.assign(Object.assign({},JI(e,t,{defaultPos:"mid",vgChannel:r})),WI("size",t,{defaultRef:n,vgChannel:i}))}(t,e,a$(n,l,f,g,p,u))}return r$(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function a$(e,t,n,r,i,o,a){const u=pD(t[n],t.size,AR("size",t,o,{vgChannel:n}));if(void 0!==u)return{value:u};if(i){const t=i.get("type");if("point"===t||"band"===t){if(void 0!==o[e].discreteBandSize)return{value:o[e].discreteBandSize};if(t===KP.POINT){const e=i.get("range");return jI(e)&&Object(oe.E)(e.step)?{value:e.step-2}:{value:kL-2}}return u$(r,a)}return{value:o[e].continuousBandSize}}const s=EL(o.view,n);return{value:pD(o[e].discreteBandSize,s-2)}}function u$(e,t=!0){return{scale:e,band:t}}function s$({channel:e,fieldDef:t,scaleName:n,markDef:r,band:i,offset:o}){return zI({fieldDef:t,channel:e,markDef:r,ref:BI({scaleName:n,fieldDef:t,band:i,offset:o})})}function l$(e,t){const{fill:n,stroke:r}="include"===t.color?HI(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return CI.reduce((n,r)=>(void 0!==e[r]&&"ignore"!==t[r]&&(n[r]={value:e[r]}),n),{})}(e.markDef,t)),c$(e,"fill",n)),c$(e,"stroke",r)),WI("opacity",e)),WI("fillOpacity",e)),WI("strokeOpacity",e)),WI("strokeWidth",e)),GI(e)),YI(e,"href"))}function c$(e,t,n){const{config:r,mark:i,markDef:o}=e;if("hide"===CR("invalid",o,r)&&n&&!bD(i)){const r=function(e,{invalid:t=!1,channels:n}){const r=n.reduce((t,n)=>{const r=e.getScaleComponent(n);if(r){const i=r.get("type"),o=e.vgField(n,{expr:"datum"});o&&lR(i)&&(t[o]=!0)}return t},{}),i=rD(r);if(i.length>0){const e=t?"||":"&&";return i.map(e=>II(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:UM});if(r)return{[t]:[{test:r,value:null},...Object(oe.i)(n)]}}return n?{[t]:n}:{}}function f$(e){const{config:t,markDef:n}=e;if(CR("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const r=n.reduce((t,n)=>{const r=e.getScaleComponent(n);if(r){const i=r.get("type"),o=e.vgField(n,{expr:"datum"});o&&lR(i)&&(t[o]=!0)}return t},{}),i=rD(r);if(i.length>0){const e=t?"||":"&&";return i.map(e=>II(e,t)).join(` ${e} `)}return}(e,{channels:["x","y"]});if(t)return{defined:{signal:t}}}return{}}function d$(e,t){if(void 0!==t)return{[e]:{value:t}}}var h$={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName("voronoi")},marks:(e,t,n)=>{const{x:r,y:i}=t.project.hasChannel,o=e.mark;if(bD(o))return vP(hP.nearestNotSupportForContinuous(o)),n;const a={name:e.getName("voronoi"),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},GI(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let u=0,s=!1;return n.forEach((t,n)=>{var r;const i=null!=(r=t.name)?r:"";i===e.component.mark[0].name?u=n:i.indexOf("voronoi")>=0&&(s=!0)}),s||n.splice(u+1,0,a),n}};class p${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.indexOf(e)>-1?console.warn("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),e.parent.removeChild(e),this.parent=t,e.parent=this}}class m$ extends p${constructor(e,t,n,r){super(e,t),this.type=n,this.refCounts=r,this._source=this._name=t,!this.refCounts||this._name in this.refCounts||(this.refCounts[this._name]=0)}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}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${gD()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class g$ extends p${constructor(e,t){super(e),this.formula=t}clone(){return new g$(null,qT(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,r)=>{const{timeUnit:i,field:o}=n,a=Eq(t)?t.encoding[vM(r)]:void 0,u=Eq(t)&&QR(r,n,a,t.markDef,t.config);if(i){const t=sz(n,{forAs:!0});e[VT({as:t,timeUnit:i,field:o})]=Object.assign({as:t,timeUnit:i,field:o},u?{band:!0}:{})}return e},{});return 0===rD(n).length?null:new g$(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t);return new g$(e,{[VT(n)]:n})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(iD(this.formula).map(e=>e.as))}dependentFields(){return new Set(iD(this.formula).map(e=>e.field))}hash(){return`TimeUnit ${VT(this.formula)}`}assemble(){const e=[];for(const t of iD(this.formula)){const{timeUnit:n,field:r,as:i}=t;e.push({field:r,type:"timeunit",units:DP(n),as:[i,`${i}_end`]})}return e}}class v${constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}var y$={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!pL(e.bind),parse:(e,t,n,r)=>{r.on||delete t.events,r.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const r=t.name,i=t.project,o=t.bind,a=t.init&&t.init[0],u=h$.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((e,i)=>{var s,l;const c=aD(`${r}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift(Object.assign(Object.assign({name:c},a?{init:D$(a[i])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${Object(oe.Y)(e.field)}] : null`}]:[],bind:(s=o[e.field],l=null!=s?s:o[e.channel],null!=l?l:o)}))}),n},signals:(e,t,n)=>{const r=t.name,i=t.project,o=n.filter(e=>e.name===r+U$)[0],a=r+"_tuple_fields",u=i.items.map(e=>aD(`${r}_${e.field}`)),s=u.map(e=>`${e} !== null`).join(" && ");return u.length&&(o.update=`${s} ? {fields: ${a}, values: [${u.join(", ")}]} : null`),delete o.value,delete o.on,n}};var b$={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+U$,r=t.name+"_toggle";return`${r} ? null : ${n}, `+("global"===t.resolve?`${r} ? null : true, `:`${r} ? null : {unit: ${V$(e)}}, `)+`${r} ? ${n} : null`}};const x$={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=Object(oe.H)(n.clear)?rA(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>(y$.has(t)&&t.project.items.forEach(e=>{const r=n.findIndex(n=>n.name===aD(`${t.name}_${e.field}`));-1!==r&&n[r].on.push({events:t.clear,update:"null"})}),n),signals:(e,t,n)=>{function r(e,r){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:r})}if("interval"===t.type)t.project.items.forEach(e=>{const t=n.findIndex(t=>t.name===e.signals.visual);if(r(t,"[0, 0]"),-1===t){r(n.findIndex(t=>t.name===e.signals.data),"null")}});else{let e=n.findIndex(e=>e.name===t.name+U$);r(e,"null"),b$.has(t)&&(e=n.findIndex(e=>e.name===t.name+"_toggle"),r(e,"false"))}return n}};var w$={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const r of t.project.items){const i=r.channel;if(!qM(i))continue;const o=e.getScaleComponent(i),a=o?o.get("type"):void 0;if(!o||!lR(a)){vP(hP.SCALE_BINDINGS_CONTINUOUS);continue}const u={selection:t.name,field:r.field};if(o.set("selectionExtent",u,!0),n.push(r),e.repeater&&e.repeater.row===e.repeater.column){e.getScaleComponent(i===ID?$D:ID).set("selectionExtent",u,!0)}}},topLevelSignals:(e,t,n)=>{const r=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||E$(e)||0===r.length)return n;const i=n.filter(e=>e.name===t.name)[0];let o=i.update;if(o.indexOf(W$)>=0)i.update=`{${r.map(e=>`${Object(oe.Y)(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of r){const t=`${Object(oe.Y)(e.field)}: ${e.signals.data}`;o.indexOf(t)<0&&(o=`${o.substring(0,o.length-1)}, ${t}}`)}i.update=o}return n.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!E$(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}};function _$(e,t){return`domain(${Object(oe.Y)(e.scaleName(t))})`}function E$(e){var t;return e.parent&&Sq(e.parent)&&(null!=(t=!e.parent.parent)?t:E$(e.parent.parent))}const O$={has:e=>{const t="global"===e.resolve&&e.bind&&pL(e.bind),n=1===e.project.items.length&&"_vgsid_"!==e.project.items[0].field;return t&&!n&&vP(hP.LEGEND_BINDINGS_PROJECT_LENGTH),t&&n},parse:(e,t,n,r)=>{var i;if(r.on||delete t.events,r.clear||delete t.clear,r.on||r.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=Object(oe.i)(null!=(i=n.filter)?i:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const o=mL(t.bind)?t.bind.legend:"click",a=Object(oe.H)(o)?rA(o,"view"):Object(oe.i)(o);t.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const r=t.name,i=mL(t.bind)&&t.bind.legend,o=e=>t=>{const n=qT(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${e.field}_legend`,u=`${r}_${a}`;if(0===n.filter(e=>e.name===u).length){const e=i.merge.map(o(`${a}_symbols`)).concat(i.merge.map(o(`${a}_labels`))).concat(i.merge.map(o(`${a}_entries`)));n.unshift(Object.assign(Object.assign({name:u},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]}))}}return n},signals:(e,t,n)=>{const r=t.name,i=t.project,o=n.find(e=>e.name===r+U$),a=r+"_tuple_fields",u=i.items.filter(e=>e.hasLegend).map(e=>aD(`${r}_${e.field}_legend`)),s=`${u.map(e=>`${e} !== null`).join(" && ")} ? {fields: ${a}, values: [${u.join(", ")}]} : null`;t.events&&u.length>0?o.on.push({events:u.map(e=>({signal:e})),update:s}):u.length>0&&(o.update=s,delete o.value,delete o.on);const l=n.find(e=>e.name===r+"_toggle"),c=mL(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push(Object.assign(Object.assign({},l.on[0]),{events:c})):l.on[0].events=c),n}};const k$="_translate_delta",j$={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const r=t.name,i=w$.has(t),o=r+"_translate_anchor",{x:a,y:u}=t.project.hasChannel;let s=rA(t.translate,"scope");return i||(s=s.map(e=>(e.between[0].markname=r+P$,e))),n.push({name:o,value:{},on:[{events:s.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==a?", extent_x: "+(i?_$(e,ID):`slice(${a.signals.visual})`):"")+(void 0!==u?", extent_y: "+(i?_$(e,$D):`slice(${u.signals.visual})`):"")+"}"}]},{name:r+k$,value:{},on:[{events:s,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&S$(e,t,a,"width",n),void 0!==u&&S$(e,t,u,"height",n),n}};function S$(e,t,n,r,i){var o;const a=t.name,u=a+"_translate_anchor",s=a+k$,l=n.channel,c=w$.has(t),f=i.filter(e=>e.name===n.signals[c?"data":"visual"])[0],d=e.getSizeSignalRef(r).signal,h=e.getScaleComponent(l),p=h.get("type"),m=`${u}.extent_${l}`,g=`${c?"log"===p?"panLog":"pow"===p?"panPow":"panLinear":"panLinear"}(${m}, ${`${c&&l===ID?"-":""}${s}.${l} / `+(c?`${d}`:`span(${m})`)}`+(c&&"pow"===p?`, ${o=h.get("exponent"),null!=o?o:1}`:"")+")";f.on.push({events:{signal:s},update:c?g:`clampRange(${g}, 0, ${d})`})}const C$={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const r=t.name,i=w$.has(t),o=r+"_zoom_delta",{x:a,y:u}=t.project.hasChannel,s=Object(oe.Y)(e.scaleName(ID)),l=Object(oe.Y)(e.scaleName($D));let c=rA(t.zoom,"scope");return i||(c=c.map(e=>(e.markname=r+P$,e))),n.push({name:r+"_zoom_anchor",on:[{events:c,update:i?"{"+[s?`x: invert(${s}, x(unit))`:"",l?`y: invert(${l}, 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&&A$(e,t,a,"width",n),void 0!==u&&A$(e,t,u,"height",n),n}};function A$(e,t,n,r,i){var o;const a=t.name,u=n.channel,s=w$.has(t),l=i.filter(e=>e.name===n.signals[s?"data":"visual"])[0],c=e.getSizeSignalRef(r).signal,f=e.getScaleComponent(u),d=f.get("type"),h=s?_$(e,u):l.name,p=a+"_zoom_delta",m=`${s?"log"===d?"zoomLog":"pow"===d?"zoomPow":"zoomLinear":"zoomLinear"}(${h}, ${`${a}_zoom_anchor.${u}`}, ${p}`+(s&&"pow"===d?`, ${o=f.get("exponent"),null!=o?o:1}`:"")+")";l.on.push({events:{signal:p},update:s?m:`clampRange(${m}, 0, ${c})`})}const N$=[{has:()=>!0,parse:(e,t,n)=>{var r,i,o;const a=t.name,u=null!=(r=t.project)?r:t.project=new v$,s={},l={},c=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=aD(`${a}_${n}`);for(let e=1;c.has(r);e++)r=aD(`${a}_${n}_${e}`);return c.add(r),{[t]:r}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of Object(oe.i)(n.init))for(const r of rD(e))dM[r]?(n.encodings||(n.encodings=[])).push(r):"interval"===n.type?(vP('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(r);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!=(i=n.fields)?i:[]){const t={type:"E",field:e};t.signals=Object.assign({},f(t,"data")),u.items.push(t),u.hasField[e]=t}for(const r of null!=(o=n.encodings)?o:[]){const n=e.fieldDef(r);if(n){let i=n.field;if(n.aggregate){vP(hP.cannotProjectAggregate(r,n.aggregate));continue}if(!i){vP(hP.cannotProjectOnChannelWithoutField(r));continue}if(n.timeUnit){i=e.vgField(r);const t={as:i,field:n.field,timeUnit:n.timeUnit};l[VT(t)]=t}if(!s[i]){let o="E";if("interval"===t.type){lR(e.getScaleComponent(r).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const a={field:i,channel:r,type:o};a.signals=Object.assign(Object.assign({},f(a,"data")),f(a,"visual")),u.items.push(s[i]=a),u.hasField[i]=u.hasChannel[r]=s[i]}}else vP(hP.cannotProjectOnChannelWithoutField(r))}if(n.init){const e=e=>u.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const r=Object(oe.A)(n.init)?n.init:[n.init];t.init=r.map(e)}}rD(l).length>0&&(u.timeUnit=new g$(null,l))},signals:(e,t,n)=>{const r=t.name+"_tuple_fields";return n.filter(e=>e.name===r).length>0?n:n.concat({name:r,value:t.project.items.map(e=>{const{signals:t,hasLegend:n}=e,r=k(e,["signals","hasLegend"]),i=qT(r);return i.field=fD(i.field),i})})}},b$,w$,O$,j$,C$,y$,h$,x$];function T$(e,t){for(const n of N$)n.has(e)&&t(n)}function D$(e,t=!0,n=oe.x){if(Object(oe.A)(e)){const r=e.map(e=>D$(e,t,n));return t?`[${r.join(", ")}]`:r}return yP(e)?n(EP(e,!1,!t)):t?n(JSON.stringify(e)):e}function M$(e,t){return Y$(e,(n,r)=>{t=r.marks?r.marks(e,n,t):t,T$(n,r=>{r.marks&&(t=r.marks(e,n,t))})}),t}function F$(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const P$="_brush",R$={signals:(e,t)=>{const n=t.name,r=n+"_tuple_fields",i=w$.has(t),o=[],a=[],u=[];if(t.translate&&!i){const e=`!event.item || event.item.mark.name !== ${Object(oe.Y)(n+P$)}`;z$(t,(t,n)=>{var r;const i=Object(oe.i)(null!=(r=n.between[0].filter)?r:n.between[0].filter=[]);return i.indexOf(e)<0&&i.push(e),t})}t.project.items.forEach((n,r)=>{const i=n.channel;if(i!==ID&&i!==$D)return void vP("Interval selections only support x and y encoding channels.");const s=t.init?t.init[r]:null,l=function(e,t,n,r){const i=n.channel,o=n.signals.visual,a=n.signals.data,u=w$.has(t),s=Object(oe.Y)(e.scaleName(i)),l=e.getScaleComponent(i),c=l?l.get("type"):void 0,f=e=>`scale(${s}, ${e})`,d=e.getSizeSignalRef(i===ID?"width":"height").signal,h=`${i}(unit)`,p=z$(t,(e,t)=>[...e,{events:t.between[0],update:`[${h}, ${h}]`},{events:t,update:`[${o}[0], clamp(${h}, 0, ${d})]`}]);return p.push({events:{signal:t.name+"_scale_trigger"},update:lR(c)?`[${f(`${a}[0]`)}, ${f(`${a}[1]`)}]`:"[0, 0]"}),u?[{name:a,on:[]}]:[Object.assign(Object.assign({name:o},r?{init:D$(r,!0,f)}:{value:[]}),{on:p}),Object.assign(Object.assign({name:a},r?{init:D$(r)}:{}),{on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${s}, ${o})`}]})]}(e,t,n,s),c=n.signals.data,f=n.signals.visual,d=Object(oe.Y)(e.scaleName(i)),h=lR(e.getScaleComponent(i).get("type"))?"+":"";o.push(...l),a.push(c),u.push({scaleName:e.scaleName(i),expr:`(!isArray(${c}) || `+`(${h}invert(${d}, ${f})[0] === ${h}${c}[0] && `+`${h}invert(${d}, ${f})[1] === ${h}${c}[1]))`})}),i||o.push({name:n+"_scale_trigger",value:{},on:[{events:u.map(e=>({scale:e.scaleName})),update:u.map(e=>e.expr).join(" && ")+` ? ${n+"_scale_trigger"} : {}`}]});const s=t.init,l=`unit: ${V$(e)}, fields: ${r}, values`;return o.concat(Object.assign(Object.assign({name:n+U$},s?{init:`{${l}: ${D$(s)}}`}:{}),{on:[{events:[{signal:a.join(" || ")}],update:a.join(" && ")+` ? {${l}: [${a}]} : null`}]}))},modifyExpr:(e,t)=>t.name+U$+", "+("global"===t.resolve?"true":`{unit: ${V$(e)}}`),marks:(e,t,n)=>{const r=t.name,{x:i,y:o}=t.project.hasChannel,a=i&&i.signals.visual,u=o&&o.signals.visual,s=`data(${Object(oe.Y)(t.name+B$)})`;if(w$.has(t))return n;const l={x:void 0!==i?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==i?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of rD(l))l[t]=[Object.assign({test:`${s}.length && ${s}[0].unit === ${V$(e)}`},l[t]),{value:0}];const c=t.mark,{fill:f,fillOpacity:d}=c,h=k(c,["fill","fillOpacity"]),p=rD(h).reduce((e,t)=>(e[t]=[{test:[void 0!==i&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter(e=>e).join(" && "),value:h[t]},{value:null}],e),{});return[{name:r+P$+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:l}},...n,{name:r+P$,type:"rect",clip:!0,encode:{enter:{fill:{value:"transparent"}},update:Object.assign(Object.assign({},l),p)}}]}};function z$(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(vP(`${n} is not an ordered event stream for interval selections.`),e),[])}function L$(e,t){const n=t.name,r=n+"_tuple_fields",i=t.project,o="(item().isVoronoi ? datum.datum : datum)",a=i.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${o}[${Object(oe.Y)(e.vgField(t.channel,{}))}], `+`${o}[${Object(oe.Y)(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${o}[${Object(oe.Y)(t.field)}]`}).join(", "),u=`unit: ${V$(e)}, fields: ${r}, values`,s=t.events;return[{name:n+U$,on:s?[{events:s,update:`datum && item().mark.marktype !== 'group' ? {${u}: [${a}]} : null`,force:!0}]:[]}]}const I$={signals:L$,modifyExpr:(e,t)=>t.name+U$+", "+("global"===t.resolve?"null":`{unit: ${V$(e)}}`)};const $$={signals:L$,modifyExpr:(e,t)=>t.name+U$+", "+("global"===t.resolve?"true":`{unit: ${V$(e)}}`)};const B$="_store",U$="_tuple",q$="_modify",W$="vlSelectionResolve",H$={single:$$,multi:I$,interval:R$};function Y$(e,t){const n=e.component.selection;if(n)for(const e in n)if(Object(oe.v)(n,e)){const r=n[e];if(!0===t(r,H$[r.type]))break}}function V$(e,{escape:t}={escape:!0}){let n=t?Object(oe.Y)(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!Oq(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const t of nM)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Object(oe.Y)(r.vgField(t))}])`)}return n}function G$(e){let t=!1;return Y$(e,e=>{t=t||e.project.items.some(e=>"_vgsid_"===e.field)}),t}function X$(e){const t=gj(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&function e(t){return"MemberExpression"===t.object.type?e(t.object):"datum"===t.object.name}(e)&&n.add(function e(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...e(t.object)),n.push(...e(t.property))),n)}(e).slice(1).join("."))}),n}class K$ extends p${constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Z$(this.model,this.filter,this),this._dependentFields=X$(this.expr)}clone(){return new K$(null,this.model,qT(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function J$(e,t,n,r="datum"){const i=[];const o=uD(t,(function(t){const o=aD(t),a=e.getSelectionComponent(o,t),u=Object(oe.Y)(o+B$);if(a.project.timeUnit){const t=null!=n?n:e.component.data.raw,r=a.project.timeUnit.clone();t.parent?r.insertAsParentOf(t):t.parent=r}return"none"!==a.empty&&i.push(u),`vlSelectionTest(${u}, ${r}`+("global"===a.resolve?")":`, ${Object(oe.Y)(a.resolve)})`)}));return(i.length?"!("+i.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${o})`}function Q$(e,t){const n=t.encoding;let r=t.field;if(n||r){if(n&&!r){const i=e.project.items.filter(e=>e.channel===n);!i.length||i.length>1?(r=e.project.items[0].field,vP((i.length?"Multiple ":"No ")+`matching ${Object(oe.Y)(n)} encoding found for selection ${Object(oe.Y)(t.selection)}. `+`Using "field": ${Object(oe.Y)(r)}.`)):r=i[0].field}}else r=e.project.items[0].field,e.project.items.length>1&&vP('A "field" or "encoding" must be specified when using a selection as a scale domain. '+`Using "field": ${Object(oe.Y)(r)}.`);return`${e.name}[${Object(oe.Y)(r)}]`}function Z$(e,t,n){return uD(t,t=>Object(oe.H)(t)?t:function(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}(t)?J$(e,t.selection,n):YP(t))}function eB(e,t,n,r){var i,o,a;e.encode=null!=(i=e.encode)?i:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(a=e.encode[t].update)?a:{},e.encode[t].update[n]=r}function tB(e,t,n,r={header:!1}){var i,o;const a=e.combine(),{orient:u,scale:s,labelExpr:l,title:c,zindex:f}=a,d=k(a,["orient","scale","labelExpr","title","zindex"]);if(rD(d).forEach(e=>{const n=DI[e],r=d[e];if(n&&n!==t&&"both"!==n)delete d[e];else if(r.condition){const{vgProp:t,part:n}=NI[e],{condition:i,value:o}=r,a=[...(Object(oe.A)(i)?i:[i]).map(e=>{const{value:t,test:n}=e;return{test:Z$(null,n),value:t}}),{value:o}];eB(d,n,t,a),delete d[e]}}),"grid"===t){if(!d.grid)return;if(d.encode){const{grid:e}=d.encode;d.encode=Object.assign({},e?{grid:e}:{}),0===rD(d.encode).length&&delete d.encode}return Object.assign(Object.assign({scale:s,orient:u},d),{domain:!1,labels:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:pD(f,0)})}{if(!r.header&&e.mainExtracted)return;if(void 0!==l){let e=l;(null===(o=null===(i=d.encode)||void 0===i?void 0:i.labels)||void 0===o?void 0:o.update)&&kI(d.encode.labels.update.text)&&(e=dD(l,"datum.label",d.encode.labels.update.text.signal)),eB(d,"labels","text",{signal:e})}if(d.encode){for(const t of TI)e.hasAxisPart(t)||delete d.encode[t];0===rD(d.encode).length&&delete d.encode}const t=function(e,t){if(e)return jR(e)?e:e.map(e=>gz(e,t)).join(", ")}(c,n);return Object.assign(Object.assign(Object.assign({scale:s,orient:u,grid:!1},t?{title:t}:{}),d),{zindex:pD(f,0)})}}function nB(e){const{axes:t}=e.component;for(const n of AM)if(t[n])for(const r of t[n])if(!r.get("gridScale")){const t="x"===n?"height":"width";return[{name:t,update:e.getSizeSignalRef(t).signal}]}return[]}const rB={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"},iB={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelLimit:"limit",labelOrient:"orient",labelPadding:"offset"},oB=rD(rB),aB=rD(iB);function uB(e,t,n,r,i){var o;const a=[..."band"===i?["axisBand"]:[],"x"===n?"axisX":"axisY",...r?["axis"+r.substr(0,1).toUpperCase()+r.substr(1)]:[],"axis"];for(const n of a)if(void 0!==(null===(o=t[n])||void 0===o?void 0:o[e]))return t[n][e]}function sB(e,t){if(void 0!==e)return e=vD(e),"top"===t||"bottom"===t?e<=45||315<=e?"top"===t?"bottom":"top":135<=e&&e<=225?"top"===t?"top":"bottom":"middle":e<=45||315<=e||135<=e&&e<=225?"middle":45<=e&&e<=135?"left"===t?"top":"bottom":"left"===t?"bottom":"top"}function lB(e,t){if(void 0!==e)return e=vD(e),"top"===t||"bottom"===t?e%180==0?"center":0{if(oz(t)&&YR(t.sort)){const{field:r,timeUnit:i}=t,o=t.sort,a=o.map((e,t)=>`${YP({field:r,timeUnit:i,equal:e})} ? ${t} : `).join("")+o.length;e=new fB(e,{calculate:a,as:dB(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 ${VT(this.transform)}`}}function dB(e,t,n){return sz(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function hB(e,t){return XT(["top","bottom"],t)?"column":XT(["left","right"],t)?"row":"row"===e?"row":"column"}function pB(e,t,n,r){const i="row"===r?n.headerRow:"column"===r?n.headerColumn:n.headerFacet;return pD(t&&t.header?t.header[e]:void 0,i[e],n.header[e])}function mB(e,t,n,r){const i={};for(const o of e){const e=pB(o,t,n,r);void 0!==e&&(i[o]=e)}return i}const gB=["row","column"],vB=["header","footer"];function yB(e,t){const n=e.component.layoutHeaders[t].title,r=e.config?e.config:void 0,i=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:u}=mB(["titleAnchor","titleAngle","titleOrient"],i,r,t),s=hB(t,u);return{name:`${t}-title`,type:"group",role:`${s}-title`,title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),xB(a,s)),bB(s,a,o)),SB(r,i,t,oB,rB))}}function bB(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const r=lB(t,"row"===e?"left":"top");return r?{align:r}:{}}function xB(e,t){const n=sB(e,"row"===t?"left":"top");return n?{baseline:n}:{}}function wB(e,t){const n=e.component.layoutHeaders[t],r=[];for(const i of vB)if(n[i])for(const o of n[i])r.push(OB(e,t,i,n,o));return r}function _B(e,t){var n;const{sort:r}=e;return HR(r)?{field:sz(r,{expr:"datum"}),order:(n=r.order,null!=n?n:"ascending")}:Object(oe.A)(r)?{field:dB(e,t,{expr:"datum"}),order:"ascending"}:{field:sz(e,{expr:"datum"}),order:null!=r?r:"ascending"}}function EB(e,t,n){const{format:r,labelAngle:i,labelAnchor:o,labelOrient:a,labelExpr:u}=mB(["format","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),s=TR(e,r,"parent",n).signal,l=hB(t,a);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:u?dD(dD(u,"datum.label",s),"datum.value",sz(e,{expr:"parent"})):s}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),xB(i,l)),bB(l,i,o)),SB(n,e,t,aB,iB))}function OB(e,t,n,r,i){var o;if(i){let a=null;const{facetFieldDef:u}=r,s=e.config?e.config:void 0;if(u&&i.labels){const{labelOrient:e}=mB(["labelOrient"],u,s,t);("row"===t&&!XT(["top","bottom"],e)||"column"===t&&!XT(["left","right"],e))&&(a=EB(u,t,s))}const l=Oq(e)&&!VR(e.facet),c=i.axes,f=(null===(o=c)||void 0===o?void 0:o.length)>0;if(a||f){const o="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},r.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:_B(u,t)}:{}),f&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{}),a?{title:a}:{}),i.sizeSignal?{encode:{update:{[o]:i.sizeSignal}}}:{}),f?{axes:c}:{})}}return null}const kB={column:{start:0,end:1},row:{start:1,end:0}};function jB(e,t){return kB[t][e]}function SB(e,t,n,r,i){const o={};for(const a of r){if(!i[a])continue;const r=pB(a,t,e,n);void 0!==r&&(o[i[a]]=r)}return o}function CB(e){return[...AB(e,"width"),...AB(e,"height")]}function AB(e,t){const n="width"===t?"x":"y",r=e.component.layoutSize.get(t);if(!r||"merged"===r)return[];const i=e.getSizeSignalRef(t).signal;if("step"===r){const t=e.getScaleComponent(n);if(t){const r=t.get("type"),o=t.get("range");if(sR(r)&&jI(o)){const r=e.scaleName(n);if(Oq(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[NB(r,o)]}return[NB(r,o),{name:i,update:TB(r,t,`domain('${r}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==r){const t=i.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",r=`isFinite(${n}) ? ${n} : ${_L(e.config.view,t?"width":"height")}`;return[{name:i,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:i,value:r}]}function NB(e,t){return{name:e+"_step",value:t.step}}function TB(e,t,n){const r=t.get("type"),i=t.get("padding"),o=pD(t.get("paddingOuter"),i);let a=t.get("paddingInner");return a="band"===r?void 0!==a?a:i:1,`bandspace(${n}, ${a}, ${o}) * ${e}_step`}function DB(e,t){return rD(e).reduce((n,r)=>{const i=e[r];return Object.assign(Object.assign({},n),PI(t,i,r,e=>({value:e.value})))},{})}function MB(e,t){if(Sq(t)||Oq(t))return"shared";if(jq(t)||kq(t))return XT(AM,e)?"independent":"shared";throw new Error("invalid model type for resolve")}function FB(e,t){const n=e.scale[t],r=XT(AM,t)?"axis":"legend";return"independent"===n?("shared"===e[r][t]&&vP(hP.independentScaleMeansIndependentGuide(t)),"independent"):e[r][t]||"shared"}class PB{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new PB(qT(this.explicit),qT(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return pD(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,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of rD(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function RB(e){return{explicit:!0,value:e}}function zB(e){return{explicit:!1,value:e}}function LB(e){return(t,n,r,i)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:IB(t,n,r,i)}}function IB(e,t,n,r){return e.explicit&&t.explicit&&vP(hP.mergeConflictingProperty(n,r,e.value,t.value)),e}function $B(e,t,n,r,i=IB){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:UT(e.value,t.value)?e:i(e,t,n,r)}const BB=Object.assign(Object.assign({},dL),{labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),UB=rD(BB);class qB extends PB{}function WB(e){const{legend:t}=e;return pD(t.type,HB(e))}function HB({channel:e,timeUnit:t,scaleType:n,alwaysReturn:r}){if(eM(e)){if(XT(["quarter","month","day"],t))return"symbol";if(cR(n))return r?"gradient":void 0}return r?"symbol":void 0}function YB({legend:e,legendConfig:t,timeUnit:n,channel:r,scaleType:i}){const o=pD(e.orient,t.orient,"right"),a=WB({legend:e,channel:r,timeUnit:n,scaleType:i,alwaysReturn:!0});return pD(e.direction,t[a?"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}}(o,a))}function VB(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function GB(e,t,n){const r=t.getScaleComponent(n).get("type");return pD(e.get("type"),HB({channel:n,scaleType:r,alwaysReturn:!0}))}function XB(e,t,n,r,i){var o,a,u,s,l;if("symbol"!==GB(i,n,r))return;let c=Object.assign(Object.assign({},function(e,t,n){for(const r of n){const n=AR(r,t.markDef,t.config);void 0!==n&&(e[r]={value:n})}return e}({},n,ED)),HI(n));const{markDef:f,encoding:d,config:h}=n,p=f.filled,m=null!=(o=ZB(d.opacity))?o:f.opacity,g=nU(n,i,e);if(c.fill)if("fill"===r||p&&r===BD)delete c.fill;else if(c.fill.field)i.get("symbolFillColor")?delete c.fill:(c.fill={value:(a=h.legend.symbolBaseFillColor,null!=a?a:"black")},c.fillOpacity={value:null!=m?m:1});else if(Object(oe.A)(c.fill)){const e=null!=(l=null!=(s=eU(null!=(u=d.fill)?u:d.color))?s:f.fill)?l:p&&f.color;e&&(c.fill={value:e})}if(c.stroke)if("stroke"===r||!p&&r===BD)delete c.stroke;else if(c.stroke.field)delete c.stroke;else if(Object(oe.A)(c.stroke)){const e=pD(eU(d.stroke||d.color),f.stroke,p?f.color:void 0);e&&(c.stroke={value:e})}return r!==YD&&(g?c.opacity=[{test:g,value:null!=m?m:1},{value:h.legend.unselectedOpacity}]:m&&(c.opacity={value:m})),c=Object.assign(Object.assign({},c),t),rD(c).length>0?c:void 0}function KB(e,t,n,r,i){if("gradient"!==GB(i,n,r))return;let o={};const a=ZB(n.encoding.opacity)||n.markDef.opacity;return a&&(o.opacity={value:a}),o=Object.assign(Object.assign({},o),t),rD(o).length>0?o:void 0}function JB(e,t,n,r,i){const o=n.legend(r),a=n.config,u=nU(n,i,e);let s={};if(Oz(e)){const i=n.getScaleComponent(r).get("type")===KP.UTC,u=RR("datum.value",e.timeUnit,o.format,a.timeFormat,i);t=Object.assign(Object.assign({},u?{text:{signal:u}}:{}),t)}return u&&(t.opacity=[{test:u,value:1},{value:a.legend.unselectedOpacity}]),s=Object.assign(Object.assign({},s),t),rD(s).length>0?s:void 0}function QB(e,t,n,r,i){var o;return(null===(o=i.get("selections"))||void 0===o?void 0:o.length)?{fill:{value:"transparent"}}:void 0}function ZB(e){return tU(e,(e,t)=>Math.max(e,t.value))}function eU(e){return tU(e,(e,t)=>pD(e,t.value))}function tU(e,t){return function(e){return!!e&&!!e.condition&&(Object(oe.A)(e.condition)||iz(e.condition))}(e)?(Object(oe.A)(e.condition)?e.condition:[e.condition]).reduce(t,e.value):iz(e)?e.value:void 0}function nU(e,t,n){var r;const i=t.get("selections");if(!(null===(r=i)||void 0===r?void 0:r.length))return;const o=Object(oe.Y)(n.field);return i.map(e=>`(!length(data(${Object(oe.Y)(aD(e)+B$)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`).join(" || ")}function rU(e){Eq(e)?e.component.legends=function(e){const{encoding:t}=e;return[BD,UD,qD,XD,HD,WD,YD,VD,GD].reduce((n,r)=>{const i=t[r];return!e.legend(r)||!e.getScaleComponent(r)||tz(i)&&r===WD&&"geojson"===i.type||(n[r]=function(e,t){var n;const r=e.fieldDef(t),i=e.legend(t),o=new qB({},function(e,t){const n=e.scaleName(BD);if("color"===t)return e.markDef.filled?{fill:n}:{stroke:n};return{[t]:e.scaleName(t)}}(e,t));!function(e,t,n){const r=e.fieldDef(t).field;Y$(e,e=>{var i,o;const a=null!=(i=e.project.hasField[r])?i:e.project.hasChannel[t];if(a&&O$.has(e)){const t=null!=(o=n.get("selections"))?o:[];t.push(e.name),n.set("selections",t,!1),a.hasLegend=!0}})}(e,t,o);for(const n of UB){const a=oU(n,i,t,e);if(void 0!==a){const t=iU(a,n,i,r);(t||void 0===e.config.legend[n])&&o.set(n,a,t)}}const a=null!==(n=i.encoding)&&void 0!==n?n:{},u=o.get("selections"),s=["labels","legend","title","symbols","gradient","entries"].reduce((n,i)=>{var s,l,c;const f=DB(null!=(s=a[i])?s:{},e),d=y[i]?y[i](r,f,e,t,o):f;return void 0!==d&&rD(d).length>0&&(n[i]=Object.assign(Object.assign(Object.assign({},(null===(l=u)||void 0===l?void 0:l.length)?{name:`${r.field}_legend_${i}`}:{}),(null===(c=u)||void 0===c?void 0:c.length)?{interactive:!!u}:{}),{update:d})),n},{});rD(s).length>0&&o.set("encode",s,!!i.encoding);return o}(e,r)),n},{})}(e):e.component.legends=function(e){const{legends:t,resolve:n}=e.component;for(const r of e.children)rU(r),rD(r.component.legends).forEach(i=>{n.legend[i]=FB(e.component.resolve,i),"shared"===n.legend[i]&&(t[i]=aU(t[i],r.component.legends[i]),t[i]||(n.legend[i]="independent",delete t[i]))});return rD(t).forEach(t=>{for(const r of e.children)r.component.legends[t]&&"shared"===n.legend[t]&&delete r.component.legends[t]}),t}(e)}function iU(e,t,n,r){switch(t){case"values":return!!n.values;case"title":if("title"===t&&e===r.title)return!0}return e===n[t]}function oU(e,t,n,r){const{encoding:i,mark:o}=r,a=bz(i[n]),u=r.config.legend,{timeUnit:s}=a,l=r.getScaleComponent(n).get("type");switch(e){case"direction":return YB({legend:t,legendConfig:u,timeUnit:s,channel:n,scaleType:l});case"format":if(Oz(a))return;return DR(a,t.format,r.config);case"formatType":if(Oz(a))return;return t.formatType;case"gradientLength":return pD(t.gradientLength,u.gradientLength,function({legend:e,legendConfig:t,model:n,channel:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:u,gradientVerticalMinLength:s}=t;if("horizontal"===YB({legend:e,legendConfig:t,channel:r,scaleType:i})){const r=pD(e.orient,t.orient);return"top"===r||"bottom"===r?VB(n,"width",a,o):a}return VB(n,"height",s,u)}({model:r,legend:t,legendConfig:u,channel:n,scaleType:l}));case"labelOverlap":return pD(t.labelOverlap,function(e){if(XT(["quantile","threshold","log"],e))return"greedy"}(l));case"symbolType":return pD(t.symbolType,function(e,t,n,r){var i;if("shape"!==t){const e=null!=(i=eU(n))?i:r;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"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(o,n,i.shape,r.markDef.shape));case"title":return pz(a,r.config,{allowDisabling:!0})||void 0;case"type":return WB({legend:t,channel:n,timeUnit:s,scaleType:l,alwaysReturn:!1});case"values":return function(e,t){const n=e.values;if(n)return jz(t,n)}(t,a)}return t[e]}function aU(e,t){var n,r,i,o,a,u;if(!e)return t.clone();const s=e.getWithExplicit("orient"),l=t.getWithExplicit("orient");if(s.explicit&&l.explicit&&s.value!==l.value)return;let c=!1;for(const n of UB){const r=$B(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return uU(e,t);case"title":return $R(e,t);case"type":return c=!0,zB("symbol")}return IB(e,t,n,"legend")});e.setWithExplicit(n,r)}return c&&((null==(i=null===(r=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===r?void 0:r.gradient)||i)&&sD(e.implicit,["encode","gradient"]),(null==(u=null===(a=null===(o=e.explicit)||void 0===o?void 0:o.encode)||void 0===a?void 0:a.gradient)||u)&&sD(e.explicit,["encode","gradient"])),e}function uU(e,t){return"circle"===t.value?t:e}function sU(e){const t=e.component.legends,n={};for(const r of rD(t)){const i=e.getScaleComponent(r),o=YT(i.get("domains"));if(n[o])for(const e of n[o]){aU(e,t[r])||n[o].push(t[r])}else n[o]=[t[r].clone()]}return iD(n).flat().map(e=>{var t,n,r,i;const o=e.combine(),{labelExpr:a,selections:u}=o,s=k(o,["labelExpr","selections"]);if(null===(t=s.encode)||void 0===t?void 0:t.symbols){const e=s.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||s.stroke||(e.stroke={value:"transparent"}),s.fill&&delete e.fill}if(void 0!==a){let e=a;(null===(i=null===(r=null===(n=s.encode)||void 0===n?void 0:n.labels)||void 0===r?void 0:r.update)||void 0===i?void 0:i.text)&&kI(s.encode.labels.update.text)&&(e=dD(a,"datum.label",s.encode.labels.update.text.signal)),function(e,t,n,r){var i,o,a;e.encode=null!=(i=e.encode)?i:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(a=e.encode[t].update)?a:{},e.encode[t].update[n]=r}(s,"labels","text",{signal:e})}return s})}function lU(e){return Sq(e)||jq(e)||kq(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),cU(e))}(e):cU(e)}function cU(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:r}=n,i=k(n,["name"]);if(t.data){const n={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const r=kI(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return XT(t,r)||t.push(r),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:r,size:n,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]}},i)]}return[Object.assign(Object.assign({name:r},{translate:{signal:"[width / 2, height / 2]"}}),i)]}const fU=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class dU extends PB{constructor(e,t,n,r){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=r,this.merged=!1}get isFit(){return!!this.data}}function hU(e){e.component.projection=Eq(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,r=!(n&&(null!=n.scale||null!=n.translate)),i=r?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,o=r?function(e){const t=[];for(const n of[["longitude","latitude"],["longitude2","latitude2"]])(e.channelHasField(n[0])||e.channelHasField(n[1]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(WD)&&"geojson"===e.fieldDef(WD).type&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(aI));return t}(e):void 0;return new dU(e.projectionName(!0),Object.assign(Object.assign({},null!=(t=e.config.projection)?t:{}),null!=n?n:{}),i,o)}return}(e):function(e){if(0===e.children.length)return;let t;e.children.forEach(e=>hU(e));const n=JT(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=JT(fU,n=>!Object(oe.v)(e.explicit,n)&&!Object(oe.v)(t.explicit,n)||!(!Object(oe.v)(e.explicit,n)||!Object(oe.v)(t.explicit,n)||YT(e.get(n))!==YT(t.get(n))));if(YT(e.size)===YT(t.size)){if(n)return e;if(YT(e.explicit)===YT({}))return t;if(YT(t.explicit)===YT({}))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),r=new dU(n,t.specifiedProjection,t.size,qT(t.data));return e.children.forEach(e=>{const t=e.component.projection;t&&(t.isFit&&r.data.push(...e.component.projection.data),e.renameProjection(t.get("name"),n),t.merged=!0)}),r}return}(e)}function pU(e,t){return`${Cz(e)}_${t}`}function mU(e,t,n){var r;const i=pU(null!=(r=_z(n,void 0))?r:{},t);return e.getName(`${i}_bins`)}function gU(e,t,n){let r,i;r=function(e){return"as"in e}(e)?Object(oe.H)(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[sz(e,{forAs:!0}),sz(e,{binSuffix:"end",forAs:!0})];const o=Object.assign({},_z(t,void 0)),a=pU(o,e.field),{signal:u,extentSignal:s}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(Dz(o.extent)){const e=o.extent,t=e.selection;i=Q$(n.getSelectionComponent(aD(t),t),e),delete o.extent}return{key:a,binComponent:Object.assign(Object.assign(Object.assign({bin:o,field:e.field,as:[r]},u?{signal:u}:{}),s?{extentSignal:s}:{}),i?{span:i}:{})}}class vU extends p${constructor(e,t){super(e),this.bins=t}clone(){return new vU(null,qT(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,r)=>{if(nz(n)&&Az(n.bin)){const{key:i,binComponent:o}=gU(n,n.bin,t);e[i]=Object.assign(Object.assign(Object.assign({},o),e[i]),function(e,t,n,r){var i,o;if(Sz(t,n)){const a=Eq(e)?null!=(o=null!=(i=e.axis(n))?i:e.legend(n))?o:{}:{},u=sz(t,{expr:"datum"}),s=sz(t,{expr:"datum",binSuffix:"end"});return{formulaAs:sz(t,{binSuffix:"range",forAs:!0}),formula:PR(u,s,a.format,r)}}return{}}(t,n,r,t.config))}return e},{});return 0===rD(n).length?null:new vU(e,n)}static makeFromTransform(e,t,n){const{key:r,binComponent:i}=gU(t,t.bin,n);return new vU(e,{[r]:i})}merge(e,t){for(const n of rD(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=ZT([...this.bins[n].as,...e.bins[n].as],VT)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(iD(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(iD(this.bins).map(e=>e.field))}hash(){return`Bin ${VT(this.bins)}`}assemble(){return iD(this.bins).flatMap(e=>{const t=[],[n,...r]=e.as,i=e.bin,{extent:o}=i,a=k(i,["extent"]),u=Object.assign(Object.assign(Object.assign({type:"bin",field:fD(e.field),as:n,signal:e.signal},Dz(o)?{extent:null}:{extent:o}),e.span?{span:{signal:`span(${e.span})`}}:{}),a);!o&&e.extentSignal&&(t.push({type:"extent",field:fD(e.field),signal:e.extentSignal}),u.extent={signal:e.extentSignal}),t.push(u);for(const e of r)for(let r=0;r<2;r++)t.push({type:"formula",expr:sz({field:n[r]},{expr:"datum"}),as:e[r]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}class yU extends p${constructor(e){let t;if(super(null),nI(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},HT(e.format,["parse"])):{}),eI(e))this._data={values:e.values};else if(ZL(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];XT(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else iI(e)?this._data={values:[{type:"Sphere"}]}:(tI(e)||nI(e))&&(this._data={});this._generator=nI(e),e.name&&(this._name=e.name),t&&rD(t).length>0&&(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 Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}function bU(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return console.error("Dataflow graph is inconsistent.",t,e),!1;if(!bU(t.children))return!1}return!0}class xU extends p${constructor(e,t){super(e),this.params=t}clone(){return new xU(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${VT(this.params)}`}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class wU extends p${constructor(e,t){super(e),this.params=t}clone(){return new wU(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([(e=this.params.as,null!=e?e:"data")])}hash(){return`Hash ${VT(this.params)}`}assemble(){return Object.assign({type:"sequence"},this.params)}}function _U(e){return e instanceof yU||e instanceof xU||e instanceof wU}class EU{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class OU extends EU{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:e,mutatedFlag:t}){e&&this.setContinue(),t&&this.setMutated()}reset(){}optimizeNextFromLeaves(e){if(_U(e))return!1;const t=e.parent,{continueFlag:n}=this.run(e);return n&&this.optimizeNextFromLeaves(t),this.mutatedFlag}}class kU extends EU{}function jU(e,t,n,r){const i=Eq(r)?r.encoding[vM(t)]:void 0;if(nz(n)&&Eq(r)&&QR(t,n,i,r.markDef,r.config))e.add(sz(n,{})),e.add(sz(n,{suffix:"end"})),Sz(n,t)&&e.add(sz(n,{binSuffix:"range"}));else if(t in JD){const n=function(e){switch(e){case"latitude":return"y";case"latitude2":return"y2";case"longitude":return"x";case"longitude2":return"x2"}}(t);e.add(r.getName(n))}else e.add(sz(n));return e}class SU extends p${constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new SU(null,new Set(this.dimensions),qT(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const r={},i=new Set;return n?(t.forEachFieldDef((e,n)=>{var o,a,u,s;const{aggregate:l,field:c}=e;if(l)if("count"===l)r["*"]=null!=(o=r["*"])?o:{},r["*"].count=new Set([sz(e,{forAs:!0})]);else{if(TD(l)||DD(l)){const e=TD(l)?"argmin":"argmax",t=l[e];r[t]=null!=(a=r[t])?a:{},r[t][e]=new Set([sz({op:e,field:t},{forAs:!0})])}else r[c]=null!=(u=r[c])?u:{},r[c][l]=new Set([sz(e,{forAs:!0})]);qM(n)&&"unaggregated"===t.scaleDomain(n)&&(r[c]=null!=(s=r[c])?s:{},r[c].min=new Set([sz({field:c,aggregate:"min"},{forAs:!0})]),r[c].max=new Set([sz({field:c,aggregate:"max"},{forAs:!0})]))}else jU(i,n,e,t)}),i.size+rD(r).length===0?null:new SU(e,i,r)):null}static makeFromTransform(e,t){var n,r,i;const o=new Set,a={};for(const e of t.aggregate){const{op:t,field:i,as:o}=e;t&&("count"===t?(a["*"]=null!=(n=a["*"])?n:{},a["*"].count=new Set([o||sz(e,{forAs:!0})])):(a[i]=null!=(r=a[i])?r:{},a[i][t]=new Set([o||sz(e,{forAs:!0})])))}for(const e of null!=(i=t.groupby)?i:[])o.add(e);return o.size+rD(a).length===0?null:new SU(e,o,a)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const r of rD(t)){const i=t[r];for(const t of rD(i))r in e?e[r][t]=new Set([...(n=e[r][t],null!=n?n:[]),...i[t]]):e[r]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){mP.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...rD(this.measures)])}producedFields(){const e=new Set;for(const t of rD(this.measures))for(const n of rD(this.measures[t])){const r=this.measures[t][n];0===r.size?e.add(`${n}_${t}`):r.forEach(e.add,e)}return e}hash(){return`Aggregate ${VT({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const r of rD(this.measures))for(const i of rD(this.measures[r]))for(const o of this.measures[r][i])n.push(o),e.push(i),t.push("*"===r?null:fD(r));return{type:"aggregate",groupby:[...this.dimensions],ops:e,fields:t,as:n}}}class CU extends p${constructor(e,t,n,r){super(e),this.model=t,this.name=n,this.data=r;for(const e of nM){const n=t.facet[e];if(n){const{bin:r,sort:i}=n;this[e]=Object.assign({name:t.getName(`${e}_domain`),fields:[sz(n),...Az(r)?[sz(n,{binSuffix:"end"})]:[]]},HR(i)?{sortField:i}:Object(oe.A)(i)?{sortIndexField:dB(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of nM)this[t]&&(e+=` ${t.charAt(0)}:${VT(this[t])}`);return e}get fields(){var e;const t=[];for(const n of nM)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of nM)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["x","y"]){const n=this.childModel.component.scales[t];if(n&&!n.merged){const r=n.get("type"),i=n.get("range");if(sR(r)&&jI(i)){const n=aq(uq(this.childModel,t));n?e[t]=n:vP(`Unknown field for ${t}. Cannot calculate view size.`)}}}return e}assembleRowColumnHeaderData(e,t,n){const r={row:"y",column:"x"}[e],i=[],o=[],a=[];n&&n[r]&&(t?(i.push(`distinct_${n[r]}`),o.push("max")):(i.push(n[r]),o.push("distinct")),a.push(`distinct_${n[r]}`));const{sortField:u,sortIndexField:s}=this[e];if(u){const{op:e=BR,field:t}=u;i.push(t),o.push(e),a.push(sz(u,{forAs:!0}))}else s&&(i.push(s),o.push("max"),a.push(s));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},i.length?{fields:i,ops:o,as:a}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:r}=this.model.layout,{layoutHeaders:i}=this.model.component,o=[],a={};for(const e of gB){for(const r of vB){const o=null!=(t=i[e]&&i[e][r])?t:[];for(const t of o)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){a[e]=!0;break}}if(a[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?r?{signal:`ceil(${t} / ${r})`}:1:r?{signal:`min(${t}, ${r})`}:{signal:t};o.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:u,column:s}=a;return(u||s)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,e)),o}assemble(){var e,t;const n=[];let r=null;const i=this.getChildIndependentFieldsWithStep(),{column:o,row:a,facet:u}=this;if(o&&a&&(i.x||i.y)){r=`cross_${this.column.name}_${this.row.name}`;const o=[].concat(null!=(e=i.x)?e:[],null!=(t=i.y)?t:[]),a=o.map(()=>"distinct");n.push({name:r,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:a}]})}for(const e of["column",LD])this[e]&&n.push(this.assembleRowColumnHeaderData(e,r,i));if(u){const e=this.assembleFacetHeaderData(i);e&&n.push(...e)}return n}}function AU(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function NU(e){const t={};return function e(t,n){if($T(t))e(t.not,n);else if(IT(t))for(const r of t.and)e(r,n);else if(LT(t))for(const r of t.or)e(r,n);else n(t)}(e.filter,e=>{var n;if(WP(e)){let r=null;zP(e)?r=e.equal:UP(e)?r=e.range[0]:qP(e)&&(r=(n=e.oneOf,null!=n?n:e.in)[0]),r&&(yP(r)?t[e.field]="date":Object(oe.E)(r)?t[e.field]="number":Object(oe.H)(r)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function TU(e){const t={};function n(e){var n;Oz(e)?t[e.field]="date":"quantitative"===e.type&&(n=e.aggregate,Object(oe.H)(n)&&XT(["min","max"],n))?t[e.field]="number":hD(e.field)>1?e.field in t||(t[e.field]="flatten"):oz(e)&&HR(e.sort)&&hD(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((Eq(e)||Oq(e))&&e.forEachFieldDef((t,r)=>{if(nz(t))n(t);else{const i=gM(r),o=e.fieldDef(i);n(Object.assign(Object.assign({},t),{type:o.type}))}}),Eq(e)){const{mark:n,markDef:r,encoding:i}=e;if(bD(n)&&!e.encoding.order){const e=i["horizontal"===r.orient?"y":"x"];!tz(e)||"quantitative"!==e.type||e.field in t||(t[e.field]="number")}}return t}class DU extends p${constructor(e,t){super(e),this._parse=t}clone(){return new DU(null,qT(this._parse))}hash(){return`Parse ${VT(this._parse)}`}static makeExplicit(e,t,n){let r={};const i=t.data;return!nI(i)&&i&&i.format&&i.format.parse&&(r=i.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(e,t,n,r){for(const e of rD(n)){const t=r.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:vP(hP.differentParse(e,n[e],t.value)))}for(const e of rD(t)){const n=r.get(e);void 0!==n&&(n===t[e]?delete t[e]:vP(hP.differentParse(e,t[e],n)))}const i=new PB(t,n);r.copyAll(i);const o={};for(const e of rD(i.combine())){const t=i.get(e);null!==t&&(o[e]=t)}return 0===rD(o).length||r.parseNothing?null:new DU(e,o)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of rD(this._parse)){const n=this._parse[t];1===hD(t)&&(e[t]=n)}return e}producedFields(){return new Set(rD(this._parse))}dependentFields(){return new Set(rD(this._parse))}assembleTransforms(e=!1){return rD(this._parse).filter(t=>!e||hD(t)>1).map(e=>{const t=function(e,t){const n=cD(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:")){return`timeParse(${n},'${AU(t.slice(5,t.length))}')`}if(0===t.indexOf("utc:")){return`utcParse(${n},'${AU(t.slice(4,t.length))}')`}return vP(hP.unrecognizedParse(t)),null}(e,this._parse[e]);return t?{type:"formula",expr:t,as:(n=e,`${Object(oe.X)(n).join(".")}`)}:null;var n}).filter(e=>null!==e)}}class MU extends p${constructor(e,t){super(e),this.transform=t}clone(){return new MU(null,qT(this.transform))}addDimensions(e){this.transform.groupby=ZT(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t=>e.add(t)),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(t=>e.add(t)),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:sz(e)}hash(){return`JoinAggregateTransform ${VT(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(void 0===r.field?null:r.field);const r=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==r?{groupby:r}:{})}}class FU extends p${constructor(e,t){super(e),this._stack=t}clone(){return new FU(null,qT(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:r,as:i,offset:o="zero"}=t,a=[],u=[];if(void 0!==t.sort)for(const e of t.sort)a.push(e.field),u.push(pD(e.order,"ascending"));const s={field:a,order:u};let l;return l=function(e){return Object(oe.A)(e)&&e.every(e=>Object(oe.H)(e))&&e.length>1}(i)?i:Object(oe.H)(i)?[i,i+"_end"]:[t.stack+"_start",t.stack+"_end"],new FU(e,{stackField:n,groupby:r,offset:o,sort:s,facetby:[],as:l})}static makeFromEncoding(e,t){const n=t.stack,{encoding:r}=t;if(!n)return null;let i;if(n.groupbyChannel){i=bz(r[n.groupbyChannel])}const o=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=sz(t.fieldDef);return n&&e.push(n),e},[])}(t),a=t.encoding.order;let u;return u=Object(oe.A)(a)||tz(a)?zR(a):o.reduce((e,t)=>(e.field.push(t),e.order.push("descending"),e),{field:[],order:[]}),new FU(e,{dimensionFieldDef:i,stackField:t.vgField(n.fieldChannel),facetby:[],stackby:o,sort:u,offset:n.offset,impute:n.impute,as:[t.vgField(n.fieldChannel,{suffix:"start",forAs:!0}),t.vgField(n.fieldChannel,{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(t=>e.add(t)),this._stack.facetby.forEach(t=>e.add(t)),this._stack.sort.field.forEach(t=>e.add(t)),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${VT(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[sz(e,{binSuffix:"mid"})]:[sz(e,{}),sz(e,{binSuffix:"end"})]:[sz(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:r,stackby:i,sort:o,offset:a,impute:u,as:s}=this._stack;if(u&&n){const{band:o=.5,bin:a}=n;a&&e.push({type:"formula",expr:`${o}*`+sz(n,{expr:"datum"})+`+${1-o}*`+sz(n,{expr:"datum",binSuffix:"end"}),as:sz(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:r,groupby:[...i,...t],key:sz(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:r,sort:o,as:s,offset:a}),e}}class PU extends p${constructor(e,t){super(e),this.transform=t}clone(){return new PU(null,qT(this.transform))}addDimensions(e){this.transform.groupby=ZT(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(e=this.transform.groupby,null!=e?e:[]).forEach(e=>n.add(e)),(t=this.transform.sort,null!=t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(e=>n.add(e)),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:sz(e)}hash(){return`WindowTransform ${VT(this.transform)}`}assemble(){var e;const t=[],n=[],r=[],i=[];for(const e of this.transform.window)n.push(e.op),r.push(this.getDefaultName(e)),i.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const o=this.transform.frame,a=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&n.every(e=>MD(e)))return Object.assign({type:"joinaggregate",as:r,ops:n,fields:t},void 0!==a?{groupby:a}:{});const u=[],s=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)u.push(t.field),s.push(null!=(e=t.order)?e:"ascending");const l={field:u,order:s},c=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:i,as:r,ops:n,fields:t,sort:l},void 0!==c?{ignorePeers:c}:{}),void 0!==a?{groupby:a}:{}),void 0!==o?{frame:o}:{})}}class RU extends p${clone(){return new RU(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set(["_vgsid_"])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:"_vgsid_"}}}class zU extends OU{run(e){const t=e.parent;if(e instanceof DU){if(_U(t))return this.flags;if(t.numChildren()>1)return this.setContinue(),this.flags;if(t instanceof DU)this.setMutated(),t.merge(e);else{if(nD(t.producedFields(),e.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),e.swapWithParent()}}return this.setContinue(),this.flags}}class LU extends kU{mergeNodes(e,t){const n=t.shift();for(const r of t)e.removeChild(r),r.parent=n,r.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let r=0;r1&&(this.setMutated(),this.mergeNodes(e,n[t]));for(const t of e.children)this.run(t);return this.mutatedFlag}}class IU extends OU{run(e){return e instanceof m$||e.numChildren()>0||e instanceof CU?this.flags:(this.setMutated(),e.remove(),this.flags)}}class $U extends OU{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(e){if(this.setContinue(),e instanceof g$){const t=e.producedFields();eD(t,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...t]),this.prev=e}return this.flags}reset(){this.fields.clear()}}class BU extends OU{run(e){this.setContinue();const t=e.parent.children.filter(e=>e instanceof g$),n=t.pop();for(const e of t)this.setMutated(),n.merge(e);return this.flags}}function UU(e){if(e instanceof CU)if(1!==e.numChildren()||e.children[0]instanceof m$){const n=e.model.component.data.main;!function e(t){if(t instanceof m$&&t.type===aI&&1===t.numChildren()){const n=t.children[0];n instanceof CU||(n.swapWithParent(),e(t))}}(n);const r=(t=e,function e(n){if(!(n instanceof CU)){const r=n.clone();if(r instanceof m$){const e=XU+r.getSource();r.setSource(e),t.model.component.data.outputNodes[e]=r}else(r instanceof SU||r instanceof FU||r instanceof PU||r instanceof MU)&&r.addDimensions(t.fields);return n.children.flatMap(e).forEach(e=>e.parent=r),[r]}return n.children.flatMap(e)}),i=e.children.map(r).flat();for(const e of i)e.parent=n}else{const t=e.children[0];(t instanceof SU||t instanceof FU||t instanceof PU||t instanceof MU)&&t.addDimensions(e.fields),t.swapWithParent(),UU(e)}else e.children.map(UU);var t}class qU extends kU{constructor(){super()}run(e){e instanceof m$&&!e.isRequired()&&(this.setMutated(),e.remove());for(const t of e.children)this.run(t);return this.mutatedFlag}}class WU extends kU{constructor(e){super(),this.requiresSelectionId=e&&G$(e)}run(e){e instanceof RU&&(this.requiresSelectionId&&(_U(e.parent)||e.parent instanceof SU||e.parent instanceof DU)||(this.setMutated(),e.remove()));for(const t of e.children)this.run(t);return this.mutatedFlag}}class HU extends OU{run(e){const t=e.parent,n=[...t.children],r=t.children.filter(e=>e instanceof DU);if(t.numChildren()>1&&r.length>=1){const e={},i=new Set;for(const t of r){const n=t.parse;for(const t of rD(n))t in e?e[t]!==n[t]&&i.add(t):e[t]=n[t]}for(const t of i)delete e[t];if(0!==rD(e).length){this.setMutated();const r=new DU(t,e);for(const i of n){if(i instanceof DU)for(const t of rD(e))delete i.parse[t];t.removeChild(i),i.parent=r,i instanceof DU&&0===rD(i.parse).length&&i.remove()}}}return this.setContinue(),this.flags}}class YU extends OU{run(e){const t=e.parent,n=t.children.filter(e=>e instanceof SU),r={};for(const e of n){const t=VT(e.groupBy);t in r||(r[t]=[]),r[t].push(e)}for(const e of rD(r)){const n=r[e];if(n.length>1){const e=n.pop();for(const r of n)e.merge(r)&&(t.removeChild(r),r.parent=e,r.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class VU extends OU{constructor(e){super(),this.model=e}run(e){const t=e.parent,n=!(_U(t)||t instanceof K$||t instanceof DU||t instanceof RU),r=[],i=[];for(const e of t.children)e instanceof vU&&(n&&!nD(t.producedFields(),e.dependentFields())?r.push(e):i.push(e));if(r.length>0){const e=r.pop();for(const t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated(),t instanceof vU?t.merge(e,this.model.renameSignal.bind(this.model)):e.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class GU extends OU{run(e){const t=e.parent,n=[...t.children];if(!KT(n,e=>e instanceof m$)||t.numChildren()<=1)return this.setContinue(),this.flags;const r=[];let i;for(const e of n)if(e instanceof m$){let n=e;for(;1===n.numChildren();){const e=n.children[0];if(!(e instanceof m$))break;n=e}r.push(...n.children),i?(t.removeChild(e),e.parent=i.parent,i.parent.removeChild(i),i.parent=n,this.setMutated()):i=n}else r.push(e);if(r.length){this.setMutated();for(const e of r)e.parent.removeChild(e),e.parent=i}return this.setContinue(),this.flags}}const XU="scale_";function KU(e){const t=[];return e.forEach((function e(n){0===n.numChildren()?t.push(n):n.children.forEach(e)})),t}function JU(e){return e}function QU(e,t){return t.map(t=>{if(e instanceof OU){const n=e.optimizeNextFromLeaves(t);return e.reset(),n}return e.run(t)}).some(JU)}function ZU(e,t){let n=e.sources;const r=new Set;return r.add(QU(new qU,n)),r.add(QU(new WU(t),n)),n=n.filter(e=>e.numChildren()>0),r.add(QU(new IU,KU(n))),n=n.filter(e=>e.numChildren()>0),r.add(QU(new zU,KU(n))),r.add(QU(new VU(t),KU(n))),r.add(QU(new $U,KU(n))),r.add(QU(new HU,KU(n))),r.add(QU(new YU,KU(n))),r.add(QU(new BU,KU(n))),r.add(QU(new LU,n)),r.add(QU(new GU,KU(n))),e.sources=n,r.has(!0)}class eq{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new eq(()=>e(t))}}function tq(e){Eq(e)?function(e){const t=e.component.scales;rD(t).forEach(n=>{const r=function(e,t){const n=e.getScaleComponent(t).get("type"),r=function(e,t,n,r){if("unaggregated"===e){const{valid:e,reason:r}=iq(t,n);if(!e)return void vP(r)}else if(void 0===e&&r.useUnaggregatedDomain){const{valid:e}=iq(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.fieldDef(t),n,e.config.scale);r!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:r}));if("x"===t&&e.channelHasField("x2"))return e.channelHasField("x")?$B(nq(n,r,e,"x"),nq(n,r,e,"x2"),"domain","scale",oq):nq(n,r,e,"x2");if("y"===t&&e.channelHasField("y2"))return e.channelHasField("y")?$B(nq(n,r,e,"y"),nq(n,r,e,"y2"),"domain","scale",oq):nq(n,r,e,"y2");return nq(n,r,e,t)}(e,n);if(t[n].setWithExplicit("domains",r),function(e,t){const n=e.component.scales[t],r=e.specifiedScales[t].domain,i=e.fieldDef(t).bin,o=dR(r)&&r,a=Tz(i)&&Dz(i.extent)&&i.extent;(o||a)&&n.set("selectionExtent",null!=o?o:a,!0)}(e,n),e.component.data.isFaceted){let t=e;for(;!Oq(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of r.value)SI(e)&&(e.data=XU+e.data.replace(XU,""))}})}(e):function(e){for(const t of e.children)tq(t);const t=e.component.scales;rD(t).forEach(n=>{let r,i=null;for(const t of e.children){const e=t.component.scales[n];if(e){r=void 0===r?e.getWithExplicit("domains"):$B(r,e.getWithExplicit("domains"),"domains","scale",oq);const t=e.get("selectionExtent");i&&t&&i.selection!==t.selection&&vP("The same selection must be used to override scale domains in a layered view."),i=t}}t[n].setWithExplicit("domains",r),i&&t[n].set("selectionExtent",i,!0)})}(e)}function nq(e,t,n,r){const i=n.fieldDef(r);if(t&&"unaggregated"!==t&&!dR(t)){const{type:e,timeUnit:n}=i;return RB("temporal"===e||n?function(e,t,n){return e.map(e=>({signal:`{data: ${kz(e,{timeUnit:n,type:t})}}`}))}(t,e,n):[t])}const o=n.stack;if(o&&r===o.fieldChannel){if("normalize"===o.offset)return zB([[0,1]]);const e=n.requestDataName(aI);return zB([{data:e,field:n.vgField(r,{suffix:"start"})},{data:e,field:n.vgField(r,{suffix:"end"})}])}const a=qM(r)?function(e,t,n){if(!sR(n))return;const r=e.fieldDef(t),i=r.sort;if(YR(i))return{op:"min",field:dB(r,t),order:"ascending"};const o=null!==e.stack;if(HR(i))return rq(i,o);if(WR(i)){const{encoding:t,order:n}=i,r=e.fieldDef(t),{aggregate:a,field:u}=r;if(TD(a)||DD(a))return rq({field:sz(r),order:n},o);if(MD(a)||!a)return rq({op:a,field:u,order:n},o)}else{if("descending"===i)return{op:"min",field:e.vgField(t),order:"descending"};if(XT(["ascending",void 0],i))return!0}return}(n,r,e):void 0;if("unaggregated"===t){const e=n.requestDataName(aI),{field:t}=i;return zB([{data:e,field:sz({field:t,aggregate:"min"})},{data:e,field:sz({field:t,aggregate:"max"})}])}if(Az(i.bin)){if(sR(e))return zB("bin-ordinal"===e?[]:[{data:oD(a)?n.requestDataName(aI):n.requestDataName("raw"),field:n.vgField(r,Sz(i,r)?{binSuffix:"range"}:{}),sort:!0!==a&&Object(oe.F)(a)?a:{field:n.vgField(r,{}),op:"min"}}]);{const{bin:e}=i;if(Az(e)){const t=mU(n,i.field,e);return zB([new eq(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return zB([{data:n.requestDataName(aI),field:n.vgField(r,{})}])}}if(i.timeUnit&&XT(["time","utc"],e)&&QR(r,i,Eq(n)?n.encoding[vM(r)]:void 0,n.markDef,n.config)){const e=n.requestDataName(aI);return zB([{data:e,field:n.vgField(r)},{data:e,field:n.vgField(r,{suffix:"end"})}])}return zB(a?[{data:oD(a)?n.requestDataName(aI):n.requestDataName("raw"),field:n.vgField(r),sort:a}]:[{data:n.requestDataName(aI),field:n.vgField(r)}])}function rq(e,t){const{op:n,field:r,order:i}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":BR},r?{field:fD(r)}:{}),i?{order:i}:{})}function iq(e,t){const{aggregate:n,type:r}=e;return n?Object(oe.H)(n)&&!zD[n]?{valid:!1,reason:hP.unaggregateDomainWithNonSharedDomainOp(n)}:"quantitative"===r&&"log"===t?{valid:!1,reason:hP.unaggregatedDomainWithLogScale(e)}:{valid:!0}:{valid:!1,reason:hP.unaggregateDomainHasNoEffectForRawField(e)}}function oq(e,t,n,r){return e.explicit&&t.explicit&&vP(hP.mergeConflictingDomainProperty(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function aq(e){if(SI(e)&&Object(oe.H)(e.field))return e.field;if(function(e){return!Object(oe.A)(e)&&("fields"in e&&!("data"in e))}(e)){let t;for(const n of e.fields)if(SI(n)&&Object(oe.H)(n.field))if(t){if(t!==n.field)return vP("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 vP("Detected faceted independent scales that union domain of identical fields from different source detected. We will assume that this is the same field from a different fork of the same data source. However, if this is not case, the result view size maybe incorrect."),t}if(function(e){return!Object(oe.A)(e)&&("fields"in e&&"data"in e)}(e)){vP("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 Object(oe.H)(t)?t:void 0}}function uq(e,t){return function(e){const t=ZT(e.map(e=>{if(SI(e)){const{sort:t}=e;return k(e,["sort"])}return e}),VT),n=ZT(e.map(e=>{if(SI(e)){const t=e.sort;return void 0===t||oD(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),VT);if(0===t.length)return;if(1===t.length){const t=e[0];if(SI(t)&&n.length>0){let e=n[0];return n.length>1&&(vP(hP.MORE_THAN_ONE_SORT),e=!0),Object.assign(Object.assign({},t),{sort:e})}return t}const r=ZT(n.map(e=>oD(e)||!("op"in e)||e.op in ND?e:(vP(hP.domainSortDropped(e)),!0)),VT);let i;1===r.length?i=r[0]:r.length>1&&(vP(hP.MORE_THAN_ONE_SORT),i=!0);const o=ZT(e.map(e=>SI(e)?e.data:null),e=>e);if(1===o.length&&null!==o[0]){return Object.assign({data:o[0],fields:t.map(e=>e.field)},i?{sort:i}:{})}return Object.assign({fields:t},i?{sort:i}:{})}(e.component.scales[t].get("domains").map(t=>(SI(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function sq(e){return rD(e.component.scales).reduce((t,n)=>{const r=e.component.scales[n];if(r.merged)return t;const i=r.combine(),{name:o,type:a,selectionExtent:u,domains:s,range:l}=i,c=k(i,["name","type","selectionExtent","domains","range"]),f=function(e,t,n){if(("x"===n||"y"===n)&&jI(e))return{step:{signal:t+"_step"}};return e}(i.range,o,n);let d;u&&(d=function(e,t){const n=t.selection;return{signal:Q$(e.getSelectionComponent(n,aD(n)),t)}}(e,u));const h=uq(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign({name:o,type:a},h?{domain:h}:{}),d?{domainRaw:d}:{}),{range:f}),c)),t},[])}class lq extends PB{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||KT(this.get("domains"),e=>Object(oe.A)(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const cq=["range","scheme"];function fq(e){return"x"===e?"width":"y"===e?"height":void 0}function dq(e){const t=e.component.scales;UM.forEach(n=>{const r=t[n];if(!r)return;const i=function(e,t){const n=t.specifiedScales[e],{size:r}=t,i=t.getScaleComponent(e).get("type");for(const t of cq)if(void 0!==n[t]){const r=xR(i,t),o=wR(e,t);if(r)if(o)vP(o);else switch(t){case"range":return RB(n[t]);case"scheme":return RB(pq(n[t]))}else vP(hP.scalePropertyNotWorkWithScaleType(i,t,e))}if(e===ID||e===$D){const t=e===ID?"width":"height",n=r[t];if(xL(n)){if(sR(i))return RB({step:n.step});vP(hP.stepDropped(t))}}return zB(function(e,t){const{size:n,config:r,mark:i}=t,o=t.getSignalName.bind(t),{type:a}=t.fieldDef(e),u=t.getScaleComponent(e).get("type"),{domain:s}=t.specifiedScales[e];switch(e){case ID:case $D:{if(XT(["point","band"],u))if(e!==ID||n.width){if(e===$D&&!n.height){const e=OL(r.view,"height");if(xL(e))return e}}else{const e=OL(r.view,"width");if(xL(e))return e}const i=fq(e),a=t.getName(i);return e===$D&&lR(u)?[eq.fromName(o,a),0]:[0,eq.fromName(o,a)]}case HD:{const o=t.component.scales[e].get("zero"),a=function(e,t,n){if(t)return 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(hP.incompatibleChannel("size",e))}(i,o,r),l=function(e,t,n,r){const i={x:hq(n,"x"),y:hq(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=mq(t,i,r.view);return Object(oe.E)(e)?e-1:new eq(()=>`${e.signal} - 1`)}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=mq(t,i,r.view);return Object(oe.E)(e)?Math.pow(.95*e,2):new eq(()=>`pow(0.95 * ${e.signal}, 2)`)}}throw new Error(hP.incompatibleChannel("size",e))}(i,n,t,r);return fR(u)?function(e,t,n){const r=()=>{const r=`(${kI(t)?t.signal:t} - ${e}) / (${n} - 1)`;return`sequence(${e}, ${t} + ${r}, ${r})`};return kI(t)?new eq(r):{signal:r()}}(a,l,function(e,t,n,r){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&Object(oe.A)(n)?n.length+1:(vP(hP.domainRequiredForThresholdScale(r)),3)}}(u,r,s,e)):[a,l]}case XD:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case WD:return"symbol";case BD:case UD:case qD:return"ordinal"===u?"nominal"===a?"category":"ordinal":"rect"===i||"geoshape"===i?"heatmap":"ramp";case YD:case VD:case GD:return[r.scale.minOpacity,r.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${e}`)}(e,t))}(n,e);r.setWithExplicit("range",i)})}function hq(e,t){const n=e.fieldDef(t);if(n&&n.bin&&Az(n.bin)){const r=mU(e,n.field,n.bin),i=fq(t),o=e.getName(i);return new eq(()=>{const t=e.getSignalName(r),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(o)} / (${n})`})}}function pq(e){return function(e){return!Object(oe.H)(e)&&!!e.name}(e)?Object.assign({scheme:e.name},HT(e,["name"])):{scheme:e}}function mq(e,t,n){const r=xL(e.width)?e.width.step:EL(n,"width"),i=xL(e.height)?e.height.step:EL(n,"height");return t.x||t.y?new eq(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(", ")})`):Math.min(r,i)}function gq(e,t){Eq(e)?function(e,t){const n=e.component.scales;rD(n).forEach(r=>{const i=e.specifiedScales[r],o=n[r],a=e.getScaleComponent(r),u=e.fieldDef(r),s=e.config,l=i[t],c=a.get("type"),f=xR(c,t),d=wR(r,t);if(void 0!==l&&(f?d&&vP(d):vP(hP.scalePropertyNotWorkWithScaleType(c,t,r))),f&&void 0===d)if(void 0!==l)o.copyKeyFromObject(t,i);else{const n=function(e,t,n,r,i,o,a,u,s,l){const c=l.scale,{type:f,sort:d}=r;switch(e){case"bins":return function(e,t){const n=t.bin;if(Az(n)){const r=mU(e,t.field,n);return new eq(()=>e.getSignalName(r))}if(Nz(n)&&Tz(n)&&void 0!==n.step)return{step:n.step};return}(t,r);case"interpolate":return function(e,t){if(XT([BD,UD,qD],e)&&"nominal"!==t)return"hcl";return}(n,f);case"nice":return function(e,t,n){if(n.bin||XT([KP.TIME,KP.UTC],e))return;return!!XT([ID,$D],t)||void 0}(i,n,r);case"padding":return function(e,t,n,r,i,o){if(XT([ID,$D],e)){if(cR(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=i;if("bar"===t&&!r.bin&&!r.timeUnit&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===KP.POINT)return n.pointPadding}return}(n,i,c,r,s,l.bar);case"paddingInner":return function(e,t,n,r){if(void 0!==e)return;if(XT([ID,$D],t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i}=r;return pD(e,"bar"===n?t:i)}return}(o,n,s.type,c);case"paddingOuter":return function(e,t,n,r,i,o){if(void 0!==e)return;if(XT([ID,$D],t)&&n===KP.BAND){const{bandPaddingOuter:e}=o;return pD(e,i/2)}return}(o,n,i,s.type,a,c);case"reverse":return function(e,t){if(lR(e)&&"descending"===t)return!0;return}(i,d);case"zero":return function(e,t,n,r,i){if(n&&"unaggregated"!==n&&lR(i)){if(Object(oe.A)(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&&!fR(i))return!0;if(!t.bin&&XT([ID,$D],e)){const{orient:t,type:n}=r;return!XT(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(n,r,u,s,i)}return c[e]}(t,e,r,u,a.get("type"),a.get("padding"),a.get("paddingInner"),i.domain,e.markDef,s);void 0!==n&&o.set(t,n,!1)}})}(e,t):yq(e,t)}function vq(e){Eq(e)?dq(e):yq(e,"range")}function yq(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?vq(n):gq(n,t);rD(n).forEach(r=>{let i;for(const n of e.children){const e=n.component.scales[r];if(e){i=$B(i,e.getWithExplicit(t),t,"scale",LB((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0}))}}n[r].setWithExplicit(t,i)})}function bq(e,t,n,r){const i=function(e,t,n){switch(t.type){case"nominal":case"ordinal":return eM(e)||"discrete"===GM(e)?("shape"===e&&"ordinal"===t.type&&vP(hP.discreteChannelCannotEncode(e,"ordinal")),"ordinal"):XT(["x","y"],e)&&XT(["rect","bar","image","rule"],n)?"band":"point";case"temporal":return eM(e)?"time":"discrete"===GM(e)?(vP(hP.discreteChannelCannotEncode(e,"temporal")),"ordinal"):"time";case"quantitative":return eM(e)?Az(t.bin)?"bin-ordinal":"linear":"discrete"===GM(e)?(vP(hP.discreteChannelCannotEncode(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(hP.invalidFieldType(t.type))}(t,n,r),{type:o}=e;return qM(t)?void 0!==o?ER(t,o)?_R(o,n.type)?o:(vP(hP.scaleTypeNotWorkWithFieldDef(o,i)),i):(vP(hP.scaleTypeNotWorkWithChannel(t,o,i)),i):i:null}function xq(e){Eq(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return UM.reduce((r,i)=>{let o,a;const u=t[i];if(tz(u)&&"geoshape"===n&&i===WD&&"geojson"===u.type)return r;if(tz(u)?(o=u,a=u.scale):ez(u)&&(o=u.condition,a=u.condition.scale),o&&null!==a&&!1!==a){a=null!=a?a:{};const t=bq(a,i,o,n);r[i]=new lq(e.scaleName(i+"",!0),{value:t,explicit:a.type===t})}return r},{})}(e):e.component.scales=function(e){const t=e.component.scales={},n={},r=e.component.resolve;for(const t of e.children)xq(t),rD(t.component.scales).forEach(i=>{var o;if(r.scale[i]=null!=(o=r.scale[i])?o:MB(i,e),"shared"===r.scale[i]){const e=n[i],o=t.component.scales[i].getWithExplicit("type");e?ZP(e.value,o.value)?n[i]=$B(e,o,"type","scale",wq):(r.scale[i]="independent",delete n[i]):n[i]=o}});for(const r of rD(n)){const i=e.scaleName(r,!0),o=n[r];t[r]=new lq(i,o);for(const t of e.children){const e=t.component.scales[r];e&&(t.renameScale(e.get("name"),i),e.merged=!0)}}return t}(e)}const wq=LB((e,t)=>tR(e)-tR(t));class _q{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 Eq(e){var t;return"unit"===(null===(t=e)||void 0===t?void 0:t.type)}function Oq(e){var t;return"facet"===(null===(t=e)||void 0===t?void 0:t.type)}function kq(e){var t;return"repeat"===(null===(t=e)||void 0===t?void 0:t.type)}function jq(e){var t;return"concat"===(null===(t=e)||void 0===t?void 0:t.type)}function Sq(e){var t;return"layer"===(null===(t=e)||void 0===t?void 0:t.type)}class Cq{constructor(e,t,n,r,i,o,a,u){var s,l;this.type=t,this.parent=n,this.config=i,this.repeater=o,this.view=u,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=i,this.repeater=o,this.name=null!=(s=e.name)?s:r,this.title=jR(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new _q,this.projectionNameMap=n?n.projectionNameMap:new _q,this.signalNameMap=n?n.signalNameMap:new _q,this.data=e.data,this.description=e.description,this.transforms=(l=e.transform,(null!=l?l:[]).map(e=>uI(e)?{filter:BT(e.filter,GP)}:e)),this.layout=SD(e)||ML(e)?{}:function(e,t,n){var r,i;const o=n[t],a={},{spacing:u,columns:s}=o;void 0!==u&&(a.spacing=u),void 0!==s&&(GR(e)&&!VR(e.facet)||bL(e)&&Object(oe.A)(e.repeat)||gL(e))&&(a.columns=s);for(const t of wL)if(void 0!==e[t])if("spacing"===t){const n=e[t];a[t]=Object(oe.E)(n)?n:{row:(r=n.row,null!=r?r:u),column:(i=n.column,null!=i?i:u)}}else a[t]=e[t];return a}(e,t,i),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:GR(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new PB,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},a?qT(a):{}),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}={}){xq(e),tq(e);for(const t of bR)gq(e,t);t||vq(e)}(this)}parseProjection(){hU(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){rU(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!=(t=null===(e=this.view)||void 0===e?void 0:e.style)?t:"cell"}assembleEncodeFromView(e){const{style:t}=e,n=k(e,["style"]),r={};for(const e in n)if(Object(oe.v)(n,e)){const t=n[e];void 0!==t&&(r[e]={value:t})}return r}assembleGroupEncodeEntry(e){let t=void 0;return this.view&&(t=this.assembleEncodeFromView(this.view)),e||"unit"!==this.type&&"layer"!==this.type?t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=k(e,["spacing"]),{component:r,config:i}=this,o=function(e,t){var n;const r={};for(const i of nM){const o=e[i];if(null===(n=o)||void 0===n?void 0:n.facetFieldDef){const{titleAnchor:e,titleOrient:n}=mB(["titleAnchor","titleOrient"],o.facetFieldDef,t,i),a=hB(i,n),u=jB(e,a);void 0!==u&&(r[a]=u)}}return rD(r).length>0?r:void 0}(r.layoutHeaders,i);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),o?{titleBand:o}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of nM)e[n].title&&t.push(yB(this,n));for(const e of gB)t=t.concat(wB(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:r=[]}=e;return[...n.map(e=>tB(e,"grid",t)),...r.map(e=>tB(e,"grid",t)),...n.map(e=>tB(e,"main",t)),...r.map(e=>tB(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return sU(this)}assembleProjections(){return lU(this)}assembleTitle(){var e,t,n;const r=null!=(e=this.title)?e:{},{encoding:i}=r,o=k(r,["encoding"]),a=Object.assign(Object.assign(Object.assign({},kR(this.config.title).nonMark),o),i?{encode:{update:i}}:{});if(a.text)return XT(["unit","layer"],this.type)?XT(["middle",void 0],a.anchor)&&(a.frame=null!=(t=a.frame)?t:"group"):a.anchor=null!=(n=a.anchor)?n:"start",rD(a).length>0?a:void 0}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 r=!this.parent||Oq(this.parent)?function e(t){return Sq(t)||jq(t)||kq(t)?t.children.reduce((t,n)=>t.concat(e(n)),sq(t)):sq(t)}(this):[];r.length>0&&(t.scales=r);const i=this.assembleAxes();i.length>0&&(t.axes=i);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}hasDescendantWithFieldOnChannel(e){for(const t of this.children)if(Eq(t)){if(t.channelHasField(e))return!0}else if(t.hasDescendantWithFieldOnChannel(e))return!0;return!1}getName(e){return aD((this.name?this.name+"_":"")+e)}requestDataName(e){var t;const n=this.getName(e),r=this.component.data.outputNodeRefCounts;return r[n]=(null!=(t=r[n])?t:0)+1,n}getSizeSignalRef(e){if(Oq(this.parent)){const t=TM(e),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),r=n.get("range");if(sR(e)&&jI(r)){const e=n.get("name"),r=aq(uq(this,t));if(r){return{signal:TB(e,n,sz({aggregate:"distinct",field:r},{expr:"datum"}))}}return vP(`Unknown field for ${t}. Cannot calculate view size.`),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):hM(e)&&qM(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(hP.selectionNotFound(t));return n}}class Aq extends Cq{vgField(e,t={}){const n=this.fieldDef(e);if(n)return sz(n,t)}reduceFieldDef(e,t){return $z(this.getMapping(),(t,n,r)=>{const i=yz(n);return i?e(t,i,r):t},t)}forEachFieldDef(e,t){Iz(this.getMapping(),(t,n)=>{const r=yz(t);r&&e(r,n)},t)}}class Nq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:"value"),(i=o[1],null!=i?i:"density")]}clone(){return new Nq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{density:t}=e,n=k(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class Tq extends p${constructor(e,t){super(e),this.filter=t}clone(){return new Tq(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:r,markDef:i}=t;if("filter"!==CR("invalid",i,n))return null;const o=t.reduceFieldDef((e,n,i)=>{const o=qM(i)&&t.getScaleComponent(i);if(o){!lR(o.get("type"))||n.aggregate||bD(r)||(e[n.field]=n)}return e},{});return rD(o).length?new Tq(e,o):null}dependentFields(){return new Set(rD(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${VT(this.filter)}`}assemble(){const e=rD(this.filter).reduce((e,t)=>{const n=this.filter[t],r=sz(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${r}) || (isValid(${r}) && isFinite(+${r})))`):"quantitative"===n.type&&(e.push(`isValid(${r})`),e.push(`isFinite(+${r})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Dq extends p${constructor(e,t){super(e),this.transform=t,this.transform=qT(t);const{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!=(n=r[t])?n:e})}clone(){return new Dq(this.parent,qT(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${VT(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Mq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:"key"),(i=o[1],null!=i?i:"value")]}clone(){return new Mq(null,qT(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${VT(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Fq extends p${constructor(e,t,n,r){super(e),this.fields=t,this.geojson=n,this.signal=r}clone(){return new Fq(null,qT(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 r of[["longitude","latitude"],["longitude2","latitude2"]]){const i=r.map(e=>t.channelHasField(e)?t.fieldDef(e).field:iz(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0);(i[0]||i[1])&&(e=new Fq(e,i,null,t.getName(`geojson_${n++}`)))}if(t.channelHasField(WD)){const r=t.fieldDef(WD);"geojson"===r.type&&(e=new Fq(e,null,r.field,t.getName(`geojson_${n++}`)))}return e}dependentFields(){var e;const t=(e=this.fields,null!=e?e:[]).filter(oe.H);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${VT(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class Pq extends p${constructor(e,t,n,r){super(e),this.projection=t,this.fields=n,this.as=r}clone(){return new Pq(null,this.projection,qT(this.fields),qT(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[["longitude","latitude"],["longitude2","latitude2"]]){const r=n.map(e=>t.channelHasField(e)?t.fieldDef(e).field:iz(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0),i="longitude2"===n[0]?"2":"";(r[0]||r[1])&&(e=new Pq(e,t.projectionName(),r,[t.getName("x"+i),t.getName("y"+i)]))}return e}dependentFields(){return new Set(this.fields.filter(oe.H))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${VT(this.fields)} ${VT(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Rq extends p${constructor(e,t){super(e),this.transform=t}clone(){return new Rq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:r}=e;return{signal:`sequence(${[t,n,...r?[r]:[]].join(",")})`}}static makeFromTransform(e,t){return new Rq(e,t)}static makeFromEncoding(e,t){const n=t.encoding,r=n.x,i=n.y;if(tz(r)&&tz(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:u,value:s,frame:l,keyvals:c}=o.impute,f=Bz(t.mark,n);return new Rq(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:o.field,key:a.field},u?{method:u}:{}),void 0!==s?{value:s}:{}),l?{frame:l}:{}),void 0!==c?{keyvals:c}:{}),f.length?{groupby:f}:{}))}return null}hash(){return`Impute ${VT(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform,u=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(s=n,void 0!==(null===(l=s)||void 0===l?void 0:l.stop)?this.processSequence(n):n)}:{}),{method:"value"}),i?{groupby:i}:{}),{value:null});var s,l;let c;if(r&&"value"!==r){c=[Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[r],fields:[e],frame:a,ignorePeers:!1},i?{groupby:i}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}else{c=[{type:"formula",expr:`datum.${e} === null ? ${o} : datum.${e}`,as:e}]}return[u,...c]}}class zq extends PB{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}}class Lq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:t.on),(i=o[1],null!=i?i:t.loess)]}clone(){return new Lq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{loess:t,on:n}=e,r=k(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},r)}}class Iq extends p${constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new Iq(null,qT(this.transform),this.secondary)}static make(e,t,n,r){var i;const o=t.component.data.sources,{from:a}=n;let u=null;if(function(e){return void 0!==e.data}(a)){let e=aW(a.data,o);e||(e=new yU(a.data),o.push(e));const n=t.getName(`lookup_${r}`);u=new m$(e,n,"lookup",t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=u}else if(function(e){return void 0!==e.selection}(a)){const e=a.selection;if(n.as=null!=(i=n.as)?i:e,u=t.getSelectionComponent(aD(e),e).materialized,!u)throw new Error(hP.noSameUnitLookup(e))}return new Iq(e,n,u.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Object(oe.i)(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${VT({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:Object(oe.i)(this.transform.as)}:{});else{let t=this.transform.as;Object(oe.H)(t)||(vP(hP.NO_FIELDS_NEEDS_AS),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class $q extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:"prob"),(i=o[1],null!=i?i:"value")]}clone(){return new $q(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{quantile:t}=e,n=k(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Bq extends p${constructor(e,t){var n,r,i;super(e),this.transform=t,this.transform=qT(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(r=o[0],null!=r?r:t.on),(i=o[1],null!=i?i:t.regression)]}clone(){return new Bq(null,qT(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${VT(this.transform)}`}assemble(){const e=this.transform,{regression:t,on:n}=e,r=k(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},r)}}class Uq extends p${constructor(e,t){super(e),this.transform=t}clone(){return new Uq(null,qT(this.transform))}addDimensions(e){var t;this.transform.groupby=ZT((t=this.transform.groupby,null!=t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...(e=this.transform.groupby,null!=e?e:[])])}hash(){return`PivotTransform ${VT(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:r,op:i}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==r?{limit:r}:{}),void 0!==i?{op:i}:{}),void 0!==n?{groupby:n}:{})}}class qq extends p${constructor(e,t){super(e),this.transform=t}clone(){return new qq(null,qT(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${VT(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function Wq(e){let t=0;return function n(r,i){var o;if(r instanceof yU&&!r.isGenerator&&!ZL(r.data)){e.push(i),i={name:null,source:i.name,transform:[]}}if(r instanceof DU&&(r.parent instanceof yU&&!i.source?(i.format=Object.assign(Object.assign({},null!=(o=i.format)?o:{}),{parse:r.assembleFormatParse()}),i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof CU)return i.name||(i.name=`data_${t++}`),!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,void r.assemble().forEach(t=>e.push(t));if((r instanceof xU||r instanceof wU||r instanceof Tq||r instanceof K$||r instanceof fB||r instanceof Pq||r instanceof Fq||r instanceof SU||r instanceof Iq||r instanceof PU||r instanceof MU||r instanceof Mq||r instanceof Dq||r instanceof Nq||r instanceof Lq||r instanceof $q||r instanceof Bq||r instanceof RU||r instanceof qq||r instanceof Uq)&&i.transform.push(r.assemble()),(r instanceof vU||r instanceof g$||r instanceof Rq||r instanceof FU)&&i.transform.push(...r.assemble()),r instanceof m$)if(i.source&&0===i.transform.length)r.setSource(i.source);else if(r.parent instanceof m$)r.setSource(i.name);else if(i.name||(i.name=`data_${t++}`),r.setSource(i.name),1===r.numChildren()){e.push(i),i={name:null,source:i.name,transform:[]}}switch(r.numChildren()){case 0:r instanceof m$&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||(i.name=`data_${t++}`);let o=i.name;!i.source||i.transform.length>0?e.push(i):o=i.source,r.children.forEach(e=>{n(e,{name:null,source:o,transform:[]})});break}}}}function Hq(e,t){var n;if(e.channelHasField(t)){const r=e.facet[t],i=pB("title",null,e.config,t);let o=pz(r,e.config,{allowDisabling:!0,includeDefault:void 0===i||!!i});e.child.component.layoutHeaders[t].title&&(o=Object(oe.A)(o)?o.join(", "):o,o+=" / "+e.child.component.layoutHeaders[t].title,e.child.component.layoutHeaders[t].title=null);const a=pB("labelOrient",r,e.config,t),u=pD((null!=(n=r.header)?n:{}).labels,!0),s=XT(["bottom","right"],a)?"footer":"header";e.component.layoutHeaders[t]={title:o,facetFieldDef:r,[s]:"facet"===t?[]:[Yq(e,t,u)]}}}function Yq(e,t,n){const r="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function Vq(e,t){var n;const{child:r}=e;if(r.component.axes[t]){const{layoutHeaders:o,resolve:a}=e.component;if(a.axis[t]=FB(a,t),"shared"===a.axis[t]){const a="x"===t?"column":"row",u=o[a];for(const o of r.component.axes[t]){const t="top"===(i=o.get("orient"))||"left"===i?"header":"footer";u[t]=null!=(n=u[t])?n:[Yq(e,a,!1)];const r=tB(o,"main",e.config,{header:!0});u[t][0].axes.push(r),o.mainExtracted=!0}}}var i}function Gq(e){Jq(e);const t=e.component.layoutSize;t.setWithExplicit("width",Qq(e,"width")),t.setWithExplicit("height",Qq(e,"height"))}const Xq=Gq,Kq={vconcat:"width",hconcat:"height"};function Jq(e){for(const t of e.children)t.parseLayoutSize()}function Qq(e,t){const n="width"===t?"x":"y",r=e.component.resolve;let i;for(const o of e.children){const e=o.component.layoutSize.getWithExplicit(t),a=r.scale[n];if("independent"===a&&"step"===e.value){i=void 0;break}if(i){if("independent"===a&&i.value!==e.value){i=void 0;break}i=$B(i,e,t,"")}else i=e}if(i){for(const n of e.children)e.renameSignal(n.getName(t),e.getName(t)),n.component.layoutSize.set(t,"merged",!1);return i}return{explicit:!1,value:void 0}}function Zq(e,t){const n="width"===t?"x":"y",r=e.config,i=e.getScaleComponent(n);if(i){const e=i.get("type"),n=i.get("range");if(sR(e)){const e=OL(r.view,t);return jI(n)||xL(e)?"step":e}return _L(r.view,t)}if(e.hasProjection)return _L(r.view,t);{const e=OL(r.view,t);return xL(e)?e.step:e}}function eW(e,t){return(n=e.field)&&!Object(oe.H)(n)&&"repeat"in n?e.field.repeat in t?Object.assign(Object.assign({},e),{field:t[e.field.repeat]}):void vP(hP.noSuchRepeatedValue(e.field.repeat)):e;var n}function tW(e,t){if(void 0!==(e=eW(e,t))){if(null===e)return null;if(KR(e)&&HR(e.sort)){const n=eW(e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function nW(e,t){if(!tz(e)){if(ez(e)){const n=tW(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});{const{condition:t}=e;return k(e,["condition"])}}return e}{const n=tW(e,t);if(n)return n;if(ZR(e))return{condition:e.condition}}}function rW(e,t){const n={};for(const r in e)if(Object(oe.v)(e,r)){const i=e[r];if(Object(oe.A)(i))n[r]=i.map(e=>nW(e,t)).filter(e=>e);else{const e=nW(i,t);void 0!==e&&(n[r]=e)}}return n}function iW(e,t,n){return sz(t,Object.assign({suffix:`by_${sz(e)}`},null!=n?n:{}))}class oW extends Aq{constructor(e,t,n,r,i){super(e,"facet",t,n,i,r,e.resolve),this.child=CW(e.spec,this,this.getName("child"),void 0,r,i),this.children=[this.child];const o=function(e,t){return VR(e)?rW(e,t):tW(e,t)}(e.facet,r);this.facet=this.initFacet(o)}initFacet(e){return VR(e)?$z(e,(e,t,n)=>XT([LD,"column"],n)?void 0===t.field?(vP(hP.emptyFieldDef(t,n)),e):(e[n]=xz(t,n),e):(vP(hP.incompatibleChannel(n,"facet")),e),{}):{facet:xz(e,"facet")}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=sW(this),this.child.parseData()}parseLayoutSize(){Jq(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 nM)Hq(e,t);Vq(e,"x"),Vq(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n,r;const i={};for(const o of nM)for(const a of vB){const u=this.component.layoutHeaders[o],s=u[a],{facetFieldDef:l}=u;if(l){const t=pB("titleOrient",l,this.config,o);if(XT(["right","bottom"],t)){const n=hB(o,t);i.titleAnchor=null!=(e=i.titleAnchor)?e:{},i.titleAnchor[n]="end"}}if(null===(t=s)||void 0===t?void 0:t[0]){const e="row"===o?"height":"width",t="header"===a?"headerBand":"footerBand";"facet"===o||this.child.component.layoutSize.get(e)||(i[t]=null!=(n=i[t])?n:{},i[t][o]=.5),u.title&&(i.offset=null!=(r=i.offset)?r:{},i.offset["row"===o?"rowTitle":"columnTitle"]=10)}}return i}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let r="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(r="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:r})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof oW)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof oW?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:sz(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof oW){if(this.child.channelHasField("column")){const r=sz(this.child.facet.column);e.push(r),t.push("distinct"),n.push(`distinct_${r}`)}}else for(const r of["x","y"]){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(sR(o)&&jI(a)){const i=aq(uq(this.child,r));i?(e.push(i),t.push("distinct"),n.push(`distinct_${i}`)):vP(`Unknown field for ${r}. Cannot calculate view size.`)}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const e of nM){const t=this.facet[e];if(t){u.push(sz(t));const{bin:s,sort:l}=t;if(Az(s)&&u.push(sz(t,{binSuffix:"end"})),HR(l)){const{field:e,op:u=BR}=l,s=iW(t,l);n&&r?(i.push(s),o.push("max"),a.push(s)):(i.push(e),o.push(u),a.push(s))}else if(Object(oe.A)(l)){const n=dB(t,e);i.push(n),o.push("max"),a.push(n)}}}const s=!!n&&!!r;return Object.assign({name:e,data:t,groupby:u},s||i.length>0?{aggregate:Object.assign(Object.assign({},s?{cross:s}:{}),i.length?{fields:i,ops:o,as:a}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?HR(n.sort)?[iW(n,n.sort,{expr:"datum"})]:Object(oe.A)(n.sort)?[dB(n,e,{expr:"datum"})]:[sz(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(HR(e)?e.order:!Object(oe.A)(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return EB(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const r of gB)if(e[r]){const i=pB("labelOrient",e[r],t,r);if(XT(n[r],i))return EB(e[r],r,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Wq(t);return e.children.forEach(t=>n(t,{source:e.name,name:null,transform:[]})),t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||e.assembleTitle(),i=e.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},r?{title:r}:{}),i?{style:i}:{}),{from:{facet:this.assembleFacet()},sort:{field:nM.map(e=>this.facetSortFields(e)).flat(),order:nM.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&rD(e.component.selection).length){const n=Object(oe.Y)(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:rA("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return F$(t)}(this,[])))]}getMapping(){return this.facet}}function aW(e,t){var n,r,i,o,a,u,s,l,c,f;for(const d of t){const t=d.data;if((!e.name||!d.hasName()||e.name===d.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(r=t.format)||void 0===r?void 0:r.feature)||((null===(i=e.format)||void 0===i?void 0:i.feature)||(null===(o=t.format)||void 0===o?void 0:o.feature))&&(null===(a=e.format)||void 0===a?void 0:a.feature)!==(null===(u=t.format)||void 0===u?void 0:u.feature)||((null===(s=e.format)||void 0===s?void 0:s.mesh)||(null===(l=t.format)||void 0===l?void 0:l.mesh))&&(null===(c=e.format)||void 0===c?void 0:c.mesh)!==(null===(f=t.format)||void 0===f?void 0:f.mesh)))if(eI(e)&&eI(t)){if(UT(e.values,t.values))return d}else if(ZL(e)&&ZL(t)){if(e.url===t.url)return d}else if(tI(e)&&e.name===d.dataName)return d}return null}function uW(e,t){if(e.data||!e.parent){if(null===e.data){const e=new yU([]);return t.push(e),e}const n=aW(e.data,t);if(n)return nI(e.data)||(n.data.format=function(e,...t){for(const n of t)QT(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new yU(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function sW(e){var t,n,r,i,o,a,u,s,l,c,f;let d=uW(e,e.component.data.sources);const{outputNodes:h,outputNodeRefCounts:p}=e.component.data,m=e.parent?e.parent.component.data.ancestorParse.clone():new zq,g=e.data;nI(g)?(rI(g)?d=new wU(d,g.sequence):oI(g)&&(d=new xU(d,g.graticule)),m.parseNothing=!0):null===(null===(n=null===(t=g)||void 0===t?void 0:t.format)||void 0===n?void 0:n.parse)&&(m.parseNothing=!0),d=null!=(r=DU.makeExplicit(d,e,m))?r:d,d=new RU(d);const v=e.parent&&Sq(e.parent);(Eq(e)||Oq(e))&&v&&(d=null!=(i=vU.makeFromEncoding(d,e))?i:d),e.transforms.length>0&&(d=function(e,t,n){var r,i;let o=0;for(const a of t.transforms){let u,s=void 0;if(yI(a))u=e=new fB(e,a),s="derived";else if(uI(a)){const i=NU(a);u=e=null!=(r=DU.makeWithAncestors(e,{},i,n))?r:e,e=new K$(e,t,a.filter)}else if(bI(a))u=e=vU.makeFromTransform(e,a,t),s="number";else if(wI(a)){s="date",void 0===n.getWithExplicit(a.field).value&&(e=new DU(e,{[a.field]:s}),n.set(a.field,s,!1)),u=e=g$.makeFromTransform(e,a)}else if(_I(a))u=e=SU.makeFromTransform(e,a),s="number",G$(t)&&(e=new RU(e));else if(sI(a))u=e=Iq.make(e,t,a,o++),s="derived";else if(mI(a))u=e=new PU(e,a),s="number";else if(gI(a))u=e=new MU(e,a),s="number";else if(EI(a))u=e=FU.makeFromTransform(e,a),s="derived";else if(OI(a))u=e=new Mq(e,a),s="derived";else if(vI(a))u=e=new Dq(e,a),s="derived";else if(lI(a))u=e=new Uq(e,a),s="derived";else if(pI(a))e=new qq(e,a);else if(xI(a))u=e=Rq.makeFromTransform(e,a),s="derived";else if(cI(a))u=e=new Nq(e,a),s="derived";else if(fI(a))u=e=new $q(e,a),s="derived";else if(dI(a))u=e=new Bq(e,a),s="derived";else{if(!hI(a)){vP(hP.invalidTransformIgnored(a));continue}u=e=new Lq(e,a),s="derived"}if(u&&void 0!==s)for(const e of null!=(i=u.producedFields())?i:[])n.set(e,s,!1)}return e}(d,e,m));const y=function(e){const t={};if(Eq(e)&&e.component.selection)for(const n of rD(e.component.selection)){const r=e.component.selection[n];for(const e of r.project.items)!e.channel&&hD(e.field)>1&&(t[e.field]="flatten")}return t}(e),b=TU(e);d=null!=(o=DU.makeWithAncestors(d,{},Object.assign(Object.assign({},y),b),m))?o:d,Eq(e)&&(d=Fq.parseAll(d,e),d=Pq.parseAll(d,e)),(Eq(e)||Oq(e))&&(v||(d=null!=(a=vU.makeFromEncoding(d,e))?a:d),d=null!=(u=g$.makeFromEncoding(d,e))?u:d,d=fB.parseAllForSortIndex(d,e));const x=e.getName("raw"),w=new m$(d,x,"raw",p);if(h[x]=w,d=w,Eq(e)){const t=SU.makeFromEncoding(d,e);t&&(d=t,G$(e)&&(d=new RU(d))),d=null!=(s=Rq.makeFromEncoding(d,e))?s:d,d=null!=(l=FU.makeFromEncoding(d,e))?l:d}Eq(e)&&(d=null!=(c=Tq.make(d,e))?c:d);const _=e.getName(aI),E=new m$(d,_,aI,p);h[_]=E,d=E,Eq(e)&&function(e,t){Y$(e,n=>{const r=n.name,i=e.getName(`lookup_${r}`);e.component.data.outputNodes[i]=n.materialized=new m$(new K$(t,e,{selection:r}),i,"lookup",e.component.data.outputNodeRefCounts)})}(e,E);let O=null;if(Oq(e)){const t=e.getName("facet");d=fB.parseAllForSortIndex(d,e),d=null!=(f=function(e,t){const{row:n,column:r}=t;if(n&&r){let t=null;for(const i of[n,r])if(HR(i.sort)){const{field:n,op:r=BR}=i.sort;e=t=new MU(e,{joinaggregate:[{op:r,field:n,as:iW(i,i.sort,{forAs:!0})}],groupby:[sz(i)]})}return t}return null}(d,e.facet))?f:d,O=new CU(d,e,t,E.getSource()),h[t]=O,d=O}return Object.assign(Object.assign({},e.component.data),{outputNodes:h,outputNodeRefCounts:p,raw:w,main:E,facetRoot:O,ancestorParse:m})}class lW extends Cq{constructor(e,t,n,r,i,o,a){super(e,t,n,r,i,o,a)}parseData(){this.component.data=sW(this),this.children.forEach(e=>{e.parseData()})}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),rD(e.component.selection).forEach(t=>{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()}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){return this.children.reduce((e,t)=>[...e,...t.assembleLayoutSignals()],CB(this))}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(),r=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),r?{encode:{update:r}}:{}),e.assembleGroup())})}}class cW extends lW{constructor(e,t,n,r,i){var o,a,u,s;super(e,"concat",t,n,i,r,e.resolve),"shared"!==(null===(a=null===(o=e.resolve)||void 0===o?void 0:o.axis)||void 0===a?void 0:a.x)&&"shared"!==(null===(s=null===(u=e.resolve)||void 0===u?void 0:u.axis)||void 0===s?void 0:s.y)||vP(hP.CONCAT_CANNOT_SHARE_AXIS),this.concatType=vL(e)?"vconcat":yL(e)?"hconcat":"concat",this.children=this.getChildren(e).map((e,t)=>CW(e,this,this.getName("concat_"+t),void 0,r,i))}getChildren(e){return vL(e)?e.vconcat:yL(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Jq(e);const t=e.component.layoutSize,n=Kq[e.concatType];n&&t.setWithExplicit(n,Qq(e,n))}(this)}parseAxisGroup(){return null}assembleDefaultLayout(){return Object.assign(Object.assign({},"vconcat"===this.concatType?{columns:1}:{}),{bounds:"full",align:"each"})}}const fW=Object.assign(Object.assign({gridScale:1,scale:1},MI),{labelExpr:1,encode:1}),dW=rD(fW);class hW extends PB{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new hW(qT(this.explicit),qT(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}}const pW={bottom:"top",top:"bottom",left:"right",right:"left"};function mW(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let r=0;r{switch(n){case"title":return $R(e,t);case"gridScale":return{explicit:e.explicit,value:pD(e.value,t.value)}}return IB(e,t,n,"axis")});e.setWithExplicit(n,r)}return e}function vW(e,t){const n="x"===t?"x2":"y2",r=e.fieldDef(t),i=e.fieldDef(n),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?IR(o,a):o||(a||(void 0!==o?o:void 0!==a?a:void 0))}function yW(e,t){var n;const r=t.axis(e),i=new hW;dW.forEach(n=>{const o=function(e,t,n,r){const i=r.fieldDef(n),o=function(e,t,n,r){if(void 0!==t.labelAngle)return vD(t.labelAngle);{const t=uB("labelAngle",e.config,n,cB(n),e.getScaleComponent(n).get("type"));return void 0!==t?vD(t):n===ID&&XT(["nominal","ordinal"],r.type)?270:void 0}}(r,t,n,i),a=pD(t.orient,cB(n)),{mark:u,config:s}=r;switch(e){case"scale":return r.scaleName(n);case"gridScale":return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(r,n);case"format":if(Oz(i))return;return DR(i,t.format,s);case"formatType":if(Oz(i))return;return t.formatType;case"grid":if(Nz(r.fieldDef(n).bin))return!1;{const e=r.getScaleComponent(n).get("type");return pD(t.grid,function(e,t){return!sR(e)&&!Az(t.bin)}(e,i))}case"labelAlign":return pD(t.labelAlign,lB(o,a));case"labelAngle":return o;case"labelBaseline":return pD(t.labelBaseline,sB(o,a));case"labelFlush":return pD(t.labelFlush,function(e,t){if("x"===t&&XT(["quantitative","temporal"],e.type))return!0}(i,n));case"labelOverlap":{const e=r.getScaleComponent(n).get("type");return pD(t.labelOverlap,function(e,t){if("nominal"!==e.type)return"log"!==t||"greedy"}(i,e))}case"orient":return a;case"tickCount":{const e=r.getScaleComponent(n).get("type"),o="x"===n?"width":"y"===n?"height":void 0,a=o?r.getSizeSignalRef(o):void 0;return pD(t.tickCount,function({fieldDef:e,scaleType:t,size:n}){if(!sR(t)&&"log"!==t&&!XT(["month","hours","day","quarter"],e.timeUnit))return Az(e.bin)?{signal:`ceil(${n.signal}/10)`}:{signal:`ceil(${n.signal}/40)`}}({fieldDef:i,scaleType:e,size:a}))}case"title":{const e="x"===n?"x2":"y2",o=r.fieldDef(e);return pD(t.title,vW(r,n),LR([XR(i)],o?[XR(o)]:[]))}case"values":return function(e,t,n){const r=e.values;if(r)return jz(n,r)}(t,0,i);case"zindex":return pD(t.zindex,function(e,t){return"rect"===e&&lz(t)?1:0}(u,i))}return l=e,FI[l]?t[e]:void 0;var l}(n,r,e,t);if(void 0!==o){const a=function(e,t,n,r,i){switch(t){case"titleAngle":case"labelAngle":return e===vD(n[t]);case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===vW(r,i))return!0}return e===n[t]}(o,n,r,t,e),u=uB(n,t.config,e,i.get("orient"),t.getScaleComponent(e).get("type"));a||void 0===u?i.set(n,o,a):XT(["grid","orient"],n)&&u&&i.set(n,u,!1)}});const o=null!=(n=r.encoding)?n:{},a=TI.reduce((n,r)=>{var a;if(!i.hasAxisPart(r))return n;const u=DB(null!=(a=o[r])?a:{},t),s="labels"===r?function(e,t,n){var r;const i=null!=(r=e.fieldDef(t))?r:"x"===t?e.fieldDef("x2"):"y"===t?e.fieldDef("y2"):void 0,o=e.axis(t);let a={};if(Oz(i)){const n=e.getScaleComponent(t).get("type")===KP.UTC,r=RR("datum.value",i.timeUnit,o.format,null,n);r&&(a.text={signal:r})}return a=Object.assign(Object.assign({},a),n),0===rD(a).length?void 0:a}(t,e,u):u;return void 0!==s&&rD(s).length>0&&(n[r]={update:s}),n},{});return rD(a).length>0&&i.set("encode",a,!!r.encoding||void 0!==r.labelAngle),i}function bW(e,t,n,{graticule:r}){var i,o;const a=_D(e)?Object.assign({},e):{type:e},u=null!=(i=a.orient)?i:AR("orient",a,n);return a.orient=function(e,t,n){switch(e){case"point":case"circle":case"square":case"text":case"rect":case"image":return}const{x:r,y:i,x2:o,y2:a}=t;switch(e){case"bar":if(tz(r)&&(Nz(r.bin)||tz(i)&&i.aggregate&&!r.aggregate))return"vertical";if(tz(i)&&(Nz(i.bin)||tz(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o&&tz(r)&&"quantitative"===r.type&&!Az(r.bin))return"horizontal";if(!a&&tz(i)&&"quantitative"===i.type&&!Az(i.bin))return"vertical"}case"rule":if(o&&a)return;case"area":if(a)return tz(i)&&Nz(i.bin)?"horizontal":"vertical";if(o)return tz(r)&&Nz(r.bin)?"vertical":"horizontal";if("rule"===e){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case"line":case"tick":{const t=tz(r)&&cz(r),o=tz(i)&&cz(i);if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=r,o=i,a="temporal"===t.type,u="temporal"===o.type;return a&&!u?"tick"!==e?"vertical":"horizontal":!a&&u?"tick"!==e?"horizontal":"vertical":!t.aggregate&&o.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!o.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(a.type,t,u),void 0!==u&&u!==a.orient&&vP(hP.orientOverridden(a.orient,u)),void 0===pD(a.opacity,AR("opacity",a,n))&&(a.opacity=function(e,t){if(XT(["point","tick","circle","square"],e)&&!Pz(t))return.7;return}(a.type,t)),void 0===a.filled&&(a.filled=!r&&function(e,t){const n=AR("filled",e,t),r=e.type;return pD(n,"point"!==r&&"line"!==r&&"rule"!==r)}(a,n)),void 0===(null!=(o=a.cursor)?o:AR("cursor",a,n))&&(a.cursor=function(e,t,n){if(t.href||e.href||AR("href",e,n))return"pointer";return e.cursor}(a,t,n)),a}function xW(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),WI("size",e)),function(e,t,n){if(n)return{shape:{value:n}};return WI("shape",e)}(e,0,t))}function wW(e){const{config:t,markDef:n}=e,{orient:r}=n,i="horizontal"===r?"width":"height",o=e.getScaleComponent("horizontal"===r?"x":"y"),a=pD(n[i],n.size,AR("size",n,t,{vgChannel:i}),t.tick.bandSize);if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&jI(e)&&Object(oe.E)(e.step)?3*e.step/4:3*EL(t.view,i)/4}}const _W={area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore"})),n$("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),n$("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),f$(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),o$(e,"x","bar")),o$(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>xW(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&tz(n)&&"geojson"===n.type?{field:sz(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore"})),o$(e,"x","image")),o$(e,"y","image")),YI(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),WI("size",e,{vgChannel:"strokeWidth"})),f$(e))},point:{vgMark:"symbol",encodeEntry:e=>xW(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),o$(e,"x","rect")),o$(e,"y","rect"))},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?Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),n$("x",e,{defaultPos:"horizontal"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"vertical"!==n})),n$("y",e,{defaultPos:"vertical"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"horizontal"!==n})),WI("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>xW(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),YI(e)),WI("size",e,{vgChannel:"fontSize"})),d$("align",function(e,t,n){var r;if(void 0===(null!==(r=e.align)&&void 0!==r?r:AR("align",e,n)))return"center";return}(e.markDef,0,t))),d$("baseline",function(e,t,n){var r;if(void 0===(null!==(r=e.baseline)&&void 0!==r?r:AR("baseline",e,n)))return"middle";return}(e.markDef,0,t)))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,r=n.orient,i="horizontal"===r?"width":"height",o="horizontal"===r?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),JI("x",e,{defaultPos:"mid",vgChannel:"xc"})),JI("y",e,{defaultPos:"mid",vgChannel:"yc"})),WI("size",e,{defaultValue:wW(e),vgChannel:i})),{[o]:{value:pD(n.thickness,t.tick.thickness)}})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l$(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),JI("x",e,{defaultPos:"mid"})),JI("y",e,{defaultPos:"mid"})),WI("size",e)),f$(e))}};function EW(e){return XT(["line","area","trail"],e.mark)?function(e){const t=Bz(e.mark,e.encoding),n=OW(e,{fromPrefix:t.length>0?"faceted_path_":""});return t.length>0?[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:"faceted_path_"+e.requestDataName(aI),data:e.requestDataName(aI),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n}]:n}(e):XT(["bar"],e.mark)?function(e){var t;const n=AI.some(t=>e.markDef[t]||AR(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&n){const[n]=OW(e,{fromPrefix:"stack_group_"}),r=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(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('${r}',${e})`).join(",")})`;let a,u;"x"===e.stack.fieldChannel?(a=Object.assign(Object.assign({},WT(n.encode.update,["y","yc","y2","height",...AI])),{x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}}),u={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update=Object.assign(Object.assign({},HT(n.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(a=Object.assign(Object.assign({},WT(n.encode.update,["x","xc","x2","width"])),{y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}}),u={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update=Object.assign(Object.assign({},HT(n.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const t of AI){const r=AR(t,e.markDef,e.config);n.encode.update[t]?(a[t]=n.encode.update[t],delete n.encode.update[t]):r&&(a[t]={value:r}),r&&(n.encode.update[t]={value:0})}const s=e.vgField(e.stack.groupbyChannel)?[e.vgField(e.stack.groupbyChannel)]:[];return(null===(t=e.fieldDef(e.stack.groupbyChannel))||void 0===t?void 0:t.bin)&&s.push(e.vgField(e.stack.groupbyChannel,{binSuffix:"end"})),a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((t,r)=>{if(n.encode.update[r])return Object.assign(Object.assign({},t),{[r]:n.encode.update[r]});{const n=AR(r,e.markDef,e.config);return void 0!==n?Object.assign(Object.assign({},t),{[r]:{value:n}}):t}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(aI),name:"stack_group_"+e.requestDataName(aI),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:u},marks:[n]}]}]}return OW(e)}(e):OW(e)}function OW(e,t={fromPrefix:""}){const n=e.mark,r=pD(e.markDef.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),i=SR(e.markDef),o=e.encoding.key,a=function(e){const{encoding:t,stack:n,mark:r,markDef:i,config:o}=e,a=t.order;if(!(!Object(oe.A)(a)&&iz(a)&>(a.value)||!a&>(i.order)||GT(AR("order",i,o)))){if((Object(oe.A)(a)||tz(a))&&!n)return zR(a,{expr:"datum"});if(bD(r)){const n="horizontal"===i.orient?"y":"x",r=t[n];if(tz(r)){const t=r.sort;if(Object(oe.A)(t))return{field:sz(r,{prefix:n,suffix:"sort_index",expr:"datum"})};if(HR(t))return{field:sz({aggregate:Pz(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})};if(WR(t)){return{field:sz(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}}return{field:sz(r,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}else;}}(e),u=function(e){if(!e.component.selection)return null;const t=rD(e.component.selection).length;let n=t,r=e.parent;for(;r&&0===n;)n=rD(r.component.selection).length,r=r.parent;return n?{interactive:t>0}:null}(e),s=_W[n].postEncodingTransform?_W[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:_W[n].vgMark},r?{clip:!0}:{}),i?{style:i}:{}),o?{key:o.field}:{}),a?{sort:a}:{}),u||{}),{from:{data:t.fromPrefix+e.requestDataName(aI)},encode:{update:_W[n].encodeEntry(e)}}),s?{transform:s}:{})]}class kW extends Aq{constructor(e,t,n,r={},i,o){var a;super(e,"unit",t,n,o,i,void 0,e.view),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const u=_D(e.mark)?e.mark.type:e.mark,s=function(e,t){return rW(e,t)}(null!=(a=e.encoding)?a:{},i);this.markDef=bW(e.mark,s,o,{graticule:e.data&&oI(e.data)});const l=this.encoding=zz(s,this.markDef);this.size=function({encoding:e,size:t}){for(const n of AM){const r=NM(n),i=yz(e[n]);xL(t[r])&&i&&cz(i)&&(delete t[r],vP(hP.stepDropped(r)))}return t}({encoding:l,size:Object.assign(Object.assign(Object.assign({},r),e.width?{width:e.width}:{}),e.height?{height:e.height}:{})}),this.stack=LL(u,l),this.specifiedScales=this.initScales(u,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegend(l),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t="geoshape"===this.mark,n=e&&QD.some(t=>tz(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 UM.reduce((e,n)=>{let r,i;const o=t[n];return tz(o)?(r=o,i=o.scale):ez(o)&&(r=o.condition,i=o.condition.scale),r&&(e[n]=null!=i?i:{}),e},{})}initAxes(e){return[ID,$D].reduce((t,n)=>{const r=e[n];if(tz(r)||n===ID&&tz(e.x2)||n===$D&&tz(e.y2)){const e=tz(r)?r.axis:null;null!==e&&(t[n]=Object.assign({},e))}return t},{})}initLegend(e){return $M.reduce((t,n)=>{const r=e[n];if(r){const e=tz(r)?r.legend:ez(r)?r.condition.legend:null;null!==e&&!1!==e&&function(e){switch(e){case BD:case UD:case qD:case HD:case WD:case YD:case XD:return!0;case VD:case GD:return!1}}(n)&&(t[n]=Object.assign({},e))}return t},{})}parseData(){this.component.data=sW(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const r of AM){const i=NM(r);if(t[i]){const e=t[i];n.layoutSize.set(i,xL(e)?"step":e,!0)}else{const t=Zq(e,i);n.layoutSize.set(i,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const r={},i=e.config.selection;for(const o in t){if(!Object(oe.v)(t,o))continue;const a=qT(t[o]),u=i[a.type],{fields:s,encodings:l}=u,c=k(u,["fields","encodings"]);for(const e in c)"encodings"===e&&a.fields||"fields"===e&&a.encodings||("mark"===e&&(a[e]=Object.assign(Object.assign({},c[e]),a[e])),void 0!==a[e]&&!0!==a[e]||(a[e]=null!=(n=c[e])?n:a[e]));const f=aD(o),d=r[f]=Object.assign(Object.assign({},a),{name:f,events:Object(oe.H)(a.on)?rA(a.on,"scope"):qT(a.on)});T$(d,n=>{n.has(d)&&n.parse&&n.parse(e,d,a,t[o])})}return r}(this,this.selection)}parseMarkGroup(){this.component.mark=EW(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,AM.reduce((t,n)=>(e.component.scales[n]&&e.axis(n)&&(t[n]=[yW(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;if(Y$(e,(r,i)=>{const o=r.name,a=Object(oe.Y)(o+B$);if(0===t.filter(e=>e.name===o).length){const e="global"===r.resolve?"union":r.resolve,n="multi"===r.type?", true)":")";t.push({name:r.name,update:`${W$}(${a}, ${Object(oe.Y)(e)}${n}`})}n=!0,i.topLevelSignals&&(t=i.topLevelSignals(e,r,t)),T$(r,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,r,t))})}),n){0===t.filter(e=>"unit"===e.name).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return F$(t)}(this,e)}assembleSignals(){return[...nB(this),...(e=this,t=[],Y$(e,(n,r)=>{const i=n.name;let o=r.modifyExpr(e,n);t.push(...r.signals(e,n)),T$(n,r=>{r.signals&&(t=r.signals(e,n,t)),r.modifyExpr&&(o=r.modifyExpr(e,n,o))}),t.push({name:i+q$,on:[{events:{signal:n.name+U$},update:`modify(${Object(oe.Y)(n.name+B$)}, ${o})`}]})}),F$(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return Y$(e,t=>{const r={name:t.name+B$};if(t.init){const n=t.project.items.map(e=>{const{signals:t}=e;return k(e,["signals"])}),i=t.init.map(e=>D$(e,!1));r.values="interval"===t.type?[{unit:V$(e,{escape:!1}),fields:n,values:i}]:i.map(t=>({unit:V$(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+B$).length||n.push(r)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return CB(this)}assembleMarks(){var e;let t=null!=(e=this.component.mark)?e:[];return this.parent&&Sq(this.parent)||(t=M$(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Fz(this.encoding,e)}fieldDef(e){return bz(this.encoding[e])}}class jW extends Cq{constructor(e,t,n,r,i,o){super(e,"layer",t,n,o,i,e.resolve,e.view);const a=Object.assign(Object.assign(Object.assign({},r),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(ML(e))return new jW(e,this,this.getName("layer_"+t),a,i,o);if(SD(e))return new kW(e,this,this.getName("layer_"+t),a,i,o);throw new Error(hP.invalidSpec(e))})}parseData(){this.component.data=sW(this);for(const e of this.children)e.parseData()}parseLayoutSize(){Gq(this)}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),rD(e.component.selection).forEach(t=>{this.component.selection[t]=e.component.selection[t]})}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:r}=e.component,i={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const i of rD(t.component.axes))r.axis[i]=FB(e.component.resolve,i),"shared"===r.axis[i]&&(n[i]=mW(n[i],t.component.axes[i]),n[i]||(r.axis[i]="independent",delete n[i]))}for(const o of[ID,$D]){for(const a of e.children)if(a.component.axes[o]){if("independent"===r.axis[o]){n[o]=(t=n[o],null!=t?t:[]).concat(a.component.axes[o]);for(const e of a.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(i[t]>0&&!n){const n=pW[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}delete a.component.axes[o]}if("independent"===r.axis[o]&&n[o]&&n[o].length>1)for(const e of n[o])e.get("grid")&&!e.explicit.grid&&(e.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()),nB(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),CB(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}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)Eq(n)&&(t=M$(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),sU(this))}}class SW extends lW{constructor(e,t,n,r,i){super(e,"repeat",t,n,i,r,e.resolve),e.resolve&&e.resolve.axis&&("shared"===e.resolve.axis.x||"shared"===e.resolve.axis.y)&&vP(hP.REPEAT_CANNOT_SHARE_AXIS),this.repeat=e.repeat,this.children=this._initChildren(e,this.repeat,r,i)}_initChildren(e,t,n,r){const i=[],o=!Object(oe.A)(t)&&t.row||[n?n.row:null],a=!Object(oe.A)(t)&&t.column||[n?n.column:null],u=Object(oe.A)(t)&&t||[n?n.repeat:null];for(const t of u)for(const n of o)for(const o of a){const a=(t?`__repeat_repeat_${t}`:"")+(n?`__repeat_row_${n}`:"")+(o?`__repeat_column_${o}`:""),u={repeat:t,row:n,column:o};i.push(CW(e.spec,this,this.getName("child"+a),void 0,u,r))}return i}parseLayoutSize(){Xq(this)}assembleDefaultLayout(){const{repeat:e}=this,t=Object(oe.A)(e)?void 0:e.column?e.column.length:1;return Object.assign(Object.assign({},t?{columns:t}:{}),{bounds:"full",align:"all"})}}function CW(e,t,n,r,i,o){if(GR(e))return new oW(e,t,n,i,o);if(ML(e))return new jW(e,t,n,r,i,o);if(SD(e))return new kW(e,t,n,r,i,o);if(bL(e))return new SW(e,t,n,i,o);if(function(e){return vL(e)||yL(e)||gL(e)}(e))return new cW(e,t,n,i,o);throw new Error(hP.invalidSpec(e))}function AW(e,t={}){var n;t.logger&&(n=t.logger,mP=n),t.fieldTitle&&hz(t.fieldTitle);try{const n=SL(Object(oe.M)({},t.config,e.config)),r=GL(e,n),i=CW(r,null,"",void 0,void 0,n);return i.parse(),function(e,t){bU(e.sources);let n=0,r=0;for(let r=0;r<5&&ZU(e,t);r++)n++;e.sources.map(UU);for(let n=0;n<5&&ZU(e,t);n++)r++;bU(e.sources),5===Math.max(n,r)&&vP("Maximum optimization runs(5) reached.")}(i.component.data,i),{spec:function(e,t,n={},r){const i=e.config?TL(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){var n,r;const i=[],o=Wq(i);let a=0;e.sources.forEach(e=>{e.hasName()||(e.dataName=`source_${a++}`);const t=e.assemble();o(e,t)}),i.forEach(e=>{0===e.transform.length&&delete e.transform});let u=0;for(const[e,t]of i.entries())0!==(n=t.transform,null!=n?n:[]).length||t.source||i.splice(u++,0,i.splice(e,1)[0]);for(const t of i)for(const n of null!=(r=t.transform)?r:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of i)e.name in t&&(e.values=t[e.name]);return i}(e.component.data,n)),a=e.assembleProjections(),u=e.assembleTitle(),s=e.assembleGroupStyle(),l=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();return c=c.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),u?{title:u}:{}),s?{style:s}:{}),l?{encode:{update:l}}:{}),{data:o}),a.length>0?{projections:a}:{}),e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([])])),i?{config:i}:{}),r?{usermeta:r}:{})}(i,function(e,t,n,r){const i=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");void 0===t?t={type:"pad"}:Object(oe.H)(t)&&(t={type:t});if(i&&o&&(a=t.type,"fit"===a||"fit-x"===a||"fit-y"===a))if("step"===i&&"step"===o)vP(hP.droppingFit()),t.type="pad";else if("step"===i||"step"===o){const e="step"===i?"width":"height";vP(hP.droppingFit(TM(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${TM(e)}`:"fit"}(n)}var a;return Object.assign(Object.assign(Object.assign({},1===rD(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),QL(n)),QL(e))}(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&gP(),t.fieldTitle&&hz(fz)}}const NW=new class extends FL{mapUnit(e,{config:t}){if(e.encoding){const{encoding:n,transform:r}=e,{bins:i,timeUnits:o,aggregate:a,groupby:u,encoding:s}=Rz(n,t),l=[...r||[],...i,...o,...0===a.length?[]:[{aggregate:a,groupby:u}]];return Object.assign(Object.assign(Object.assign({},e),l.length>0?{transform:l}:{}),{encoding:s})}return e}};function TW(e,t){return NW.map(e,{config:t})}const DW=TT.version;var MW=n(23),FW=n.n(MW),PW=n(35);var RW={background:"#333",title:{color:"#fff"},style:{"guide-label":{fill:"#fff"},"guide-title":{fill:"#fff"}},axis:{domainColor:"#fff",gridColor:"#888",tickColor:"#fff"}};var zW={background:"#fff",arc:{fill:"#4572a7"},area:{fill:"#4572a7"},line:{stroke:"#4572a7",strokeWidth:2},path:{stroke:"#4572a7"},rect:{fill:"#4572a7"},shape:{stroke:"#4572a7"},symbol:{fill:"#4572a7",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"]}};var LW={arc:{fill:"#30a2da"},area:{fill:"#30a2da"},axis:{domainColor:"#cbcbcb",grid:!0,gridColor:"#cbcbcb",gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:"#cbcbcb",tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:"#f0f0f0",group:{fill:"#f0f0f0"},legend:{labelColor:"#333",labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:"#333",titleFontSize:14,titlePadding:10},line:{stroke:"#30a2da",strokeWidth:2},path:{stroke:"#30a2da",strokeWidth:.5},rect:{fill:"#30a2da"},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:"#30a2da"},style:{bar:{binSpacing:2,fill:"#30a2da",stroke:null}},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}};var IW={group:{fill:"#e5e5e5"},arc:{fill:"#000"},area:{fill:"#000"},line:{stroke:"#000"},path:{stroke:"#000"},rect:{fill:"#000"},shape:{stroke:"#000"},symbol:{fill:"#000",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"]}};const $W="Benton Gothic Bold, sans-serif",BW={"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"]};var UW={background:"#ffffff",title:{anchor:"start",color:"#000000",font:$W,fontSize:22,fontWeight:"normal"},arc:{fill:"#82c6df"},area:{fill:"#82c6df"},line:{stroke:"#82c6df",strokeWidth:2},path:{stroke:"#82c6df"},rect:{fill:"#82c6df"},shape:{stroke:"#82c6df"},symbol:{fill:"#82c6df",size:30},axis:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,labelFontWeight:"normal",titleFont:$W,titleFontSize:13,titleFontWeight:"normal"},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:"Benton Gothic, sans-serif",labelFontSize:11.5,symbolType:"square",titleFont:$W,titleFontSize:13,titleFontWeight:"normal"},range:{category:BW["category-6"],diverging:BW["fireandice-6"],heatmap:BW["fire-7"],ordinal:BW["fire-7"],ramp:BW["fire-7"]}};var qW={background:"#f9f9f9",arc:{fill:"#ab5787"},area:{fill:"#ab5787"},line:{stroke:"#ab5787"},path:{stroke:"#ab5787"},rect:{fill:"#ab5787"},shape:{stroke:"#ab5787"},symbol:{fill:"#ab5787",size:30},axis:{domainColor:"#979797",domainWidth:.5,gridWidth:.2,labelColor:"#979797",tickColor:"#979797",tickWidth:.2,titleColor:"#979797"},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"]}};var WW={background:"#fff",arc:{fill:"#3e5c69"},area:{fill:"#3e5c69"},line:{stroke:"#3e5c69"},path:{stroke:"#3e5c69"},rect:{fill:"#3e5c69"},shape:{stroke:"#3e5c69"},symbol:{fill:"#3e5c69"},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"]}};const HW={"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"]};var YW={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:"Lato"},axisX:{domain:!0,domainColor:"#000000",domainWidth:1,grid:!1,labelFontSize:12,labelFont:"Lato",labelAngle:0,tickColor:"#000000",tickSize:5,titleFontSize:12,titlePadding:10,titleFont:"Lato"},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:"Lato",labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:"Lato",titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:"Lato",symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:"Lato",orient:"right",offset:10},view:{stroke:"transparent"},range:{category:HW["six-groups-cat-1"],diverging:HW["diverging-colors"],heatmap:HW["diverging-colors"],ordinal:HW["six-groups-seq"],ramp:HW["shades-blue"]},area:{fill:"#1696d2"},rect:{fill:"#1696d2"},line:{color:"#1696d2",stroke:"#1696d2",strokeWidth:5},trail:{color:"#1696d2",stroke:"#1696d2",strokeWidth:0,size:1},path:{stroke:"#1696d2",strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:"#1696d2",fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:"#1696d2",stroke:null}},arc:{fill:"#1696d2"},shape:{stroke:"#1696d2"},symbol:{fill:"#1696d2",size:30}};const VW=PW.version;var GW=n(36),XW="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black; }\n #vg-tooltip-element.visible {\n visibility: visible; }\n #vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px; }\n #vg-tooltip-element table {\n border-spacing: 0; }\n #vg-tooltip-element table tr {\n border: none; }\n #vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px; }\n #vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px; }\n #vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left; }\n #vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white; }\n #vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf; }\n";const KW="vg-tooltip-element",JW={offsetX:10,offsetY:10,id:KW,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}class eH{constructor(e){this.options=Object.assign(Object.assign({},JW),e);const t=this.options.id;if(this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return XW.toString().replace(KW,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}this.el=document.getElementById(t),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",t),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el))}tooltipHandler(e,t,n,r){if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=function(e,t,n){if(Object(oe.A)(e))return`[${e.map(e=>t(Object(oe.H)(e)?e:ZW(e,n))).join(", ")}]`;if(Object(oe.F)(e)){let r="";const i=e,{title:o}=i,a=QW(i,["title"]);o&&(r+=`

${t(o)}

`);const u=Object.keys(a);if(u.length>0){r+="";for(const e of u){let i=a[e];void 0!==i&&(Object(oe.F)(i)&&(i=ZW(i,n)),r+=``)}r+="
${t(e)}:${t(i)}
"}return r||"{}"}return t(e)}(r,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}=function(e,t,n,r){let i=e.clientX+n;i+t.width>window.innerWidth&&(i=+e.clientX-n-t.width);let o=e.clientY+r;return o+t.height>window.innerHeight&&(o=+e.clientY-r-t.height),{x:i,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${o}px; left: ${i}px`)}}GW.version;var tH='.vega-embed {\n position: relative;\n display: inline-block; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\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 outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\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 .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 .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: scroll;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n';function nH(e,...t){for(const n of t)rH(e,n);return e}function rH(e,t){for(const n of Object.keys(t))Object(oe.ib)(e,n,t[n],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});const iH=g;let oH=b;const aH=window;void 0===oH&&aH.vl&&aH.vl.compile&&(oH=aH.vl);const uH={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},sH={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},lH={vega:"Vega","vega-lite":"Vega-Lite"},cH={vega:iH.version,"vega-lite":oH?oH.version:"not available"},fH={vega:e=>e,"vega-lite":(e,t)=>oH.compile(e,{config:t}).spec};function dH(e,t,n,r){const i=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(i+e+o),a.document.title=`${lH[r]} JSON Source`}function hH(e,t,n={}){var r,i,o;return j(this,void 0,void 0,(function*(){const a=(u=n.loader)&&"load"in u?n.loader:iH.loader(n.loader);var u;const s=Object(oe.H)(t)?JSON.parse(yield a.load(t)):t,l=yield pH((r=s.usermeta&&s.usermeta.embedOptions,null!=r?r:{}),a),c=yield pH(n,a),f=Object.assign(Object.assign({},nH(c,l)),{config:Object(oe.M)((i=c.config,null!=i?i:{}),(o=l.config,null!=o?o:{}))});return yield function(e,t,n={},r){var i,o,a,u,s,l;return j(this,void 0,void 0,(function*(){const c=n.theme?Object(oe.M)(x[n.theme],null!=(i=n.config)?i:{}):n.config,f=Object(oe.B)(n.actions)?n.actions:nH({},uH,null!=(o=n.actions)?o:{}),d=Object.assign(Object.assign({},sH),n.i18n),h=null!=(a=n.renderer)?a:"canvas",p=null!=(u=n.logLevel)?u:iH.Warn,m=null!=(s=n.downloadFileName)?s:"visualization";if(!1!==n.defaultStyle){const e="vega-embed-style";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerText=void 0===n.defaultStyle||!0===n.defaultStyle?tH.toString():n.defaultStyle,document.head.appendChild(t)}}const g=function(e,t){var n;if(e.$schema){const r=FW()(e.$schema);t&&t!==r.library&&console.warn(`The given visualization spec is written in ${lH[r.library]}, but mode argument sets ${n=lH[t],null!=n?n:t}.`);const i=r.library;return Object(ie.satisfies)(cH[i],`^${r.version.slice(1)}`)||console.warn(`The input spec uses ${lH[i]} ${r.version}, but the current version of ${lH[i]} is v${cH[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":null!=t?t:"vega"}(t,n.mode);let v=fH[g](t,c);if("vega-lite"===g&&v.$schema){const e=FW()(v.$schema);Object(ie.satisfies)(cH.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${cH.vega}.`)}const y="string"==typeof e?document.querySelector(e):e;if(!y)throw Error("${el} does not exist");y.classList.add("vega-embed"),f&&y.classList.add("has-actions"),y.innerHTML="";const b=n.patch;b&&(v=b instanceof Function?b(v):q(v,b,!0,!1).newDocument),n.formatLocale&&iH.formatLocale(n.formatLocale),n.timeFormatLocale&&iH.timeFormatLocale(n.timeFormatLocale);const w=iH.parse(v,"vega-lite"===g?{}:c),_=new iH.View(w,{loader:r,logLevel:p,renderer:h});if(!1!==n.tooltip){let e;e="function"==typeof n.tooltip?n.tooltip:new eH(!0===n.tooltip?{}:n.tooltip).call,_.tooltip(e)}let E,{hover:O}=n;if(void 0===O&&(O="vega"===g),O){const{hoverSet:e,updateSet:t}="boolean"==typeof O?{}:O;_.hover(e,t)}if(n&&(n.width&&_.width(n.width),n.height&&_.height(n.height),n.padding&&_.padding(n.padding)),yield _.initialize(e).runAsync(),!1!==f){let e=y;if(!1!==n.defaultStyle){const t=document.createElement("details");t.title=d.CLICK_TO_VIEW_ACTIONS,y.append(t),e=t;const n=document.createElement("summary");n.innerHTML='\n\n \n \n \n',t.append(n),E=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",E)}const r=document.createElement("div");if(e.append(r),r.classList.add("vega-actions"),!0===f||!1!==f.export)for(const e of["svg","png"])if(!0===f||!0===f.export||f.export[e]){const t=d[`${e.toUpperCase()}_ACTION`],i=document.createElement("a");i.text=t,i.href="#",i.target="_blank",i.download=`${m}.${e}`,i.addEventListener("mousedown",(function(t){_.toImageURL(e,n.scaleFactor).then(e=>{this.href=e}).catch(e=>{throw e}),t.preventDefault()})),r.append(i)}if(!0===f||!1!==f.source){const e=document.createElement("a");e.text=d.SOURCE_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var r,i;dH(re()(t),null!=(r=n.sourceHeader)?r:"",null!=(i=n.sourceFooter)?i:"",g),e.preventDefault()})),r.append(e)}if("vega-lite"===g&&(!0===f||!1!==f.compiled)){const e=document.createElement("a");e.text=d.COMPILED_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var t,r;dH(re()(v),null!=(t=n.sourceHeader)?t:"",null!=(r=n.sourceFooter)?r:"","vega"),e.preventDefault()})),r.append(e)}if(!0===f||!1!==f.editor){const e=null!=(l=n.editorUrl)?l:"https://vega.github.io/editor/",i=document.createElement("a");i.text=d.EDITOR_ACTION,i.href="#",i.addEventListener("mousedown",(function(n){!function(e,t,n){const r=e.open(t);let i=40;e.addEventListener("message",(function t(n){n.source===r&&(i=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){i<=0||(r.postMessage(n,"*"),setTimeout(e,250),i-=1)}),250)}(window,e,{config:c,mode:g,renderer:h,spec:re()(t)}),n.preventDefault()})),r.append(i)}}return{view:_,spec:t,vgSpec:v,finalize:function(){E&&document.removeEventListener("click",E),_.finalize()}}}))}(e,s,f,a)}))}function pH(e,t){var n;return j(this,void 0,void 0,(function*(){const r=Object(oe.H)(e.config)?JSON.parse(yield t.load(e.config)):null!=(n=e.config)?n:{},i=Object(oe.H)(e.patch)?JSON.parse(yield t.load(e.patch)):e.patch;return Object.assign(Object.assign(Object.assign({},e),i?{patch:i}:{}),r?{config:r}:{})}))}var mH={};function gH(e,t){void 0===e&&(e=mH),void 0===t&&(t=mH);var n=Object.keys(e),r=Object.keys(t);return e===t||n.length===r.length&&n.every((function(n){return e[n]===t[n]}))}var vH=function(){};function yH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xH=function(e){function t(){for(var t,n=arguments.length,r=Array(n),i=0;i>",e)}})),0 build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/","renameschema":"scripts/rename-schema.sh","presite":"yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh","site":"pushd site && bundle exec jekyll serve -I -l && popd","tsc:src":"tsc -b src/tsconfig.src.json","tsc:site":"tsc -b site/tsconfig.site.json","prettierbase":"prettier \'**/*.{md,css,yml}\'","eslintbase":"eslint --ext .ts .","format":"yarn eslintbase --fix && yarn prettierbase --write","lint":"yarn eslintbase && yarn prettierbase --check","test":"jest test/ && yarn lint && yarn schema && jest examples/ && yarn test:runtime","test:inspect":"node --inspect-brk ./node_modules/.bin/jest --runInBand test","test:runtime":"TZ=America/Los_Angeles jest test-runtime/","test:runtime:generate":"yarn build:only && rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime","watch:build":"yarn build:only && concurrently --kill-others -n Typescript,Rollup \'yarn tsc:src -w\' \'rollup -c -w\'","watch:site":"concurrently --kill-others -n Typescript,Rollup \'yarn tsc:site -w\' \'rollup -c site/rollup.config.js -w\'","watch:test":"jest --watch"},"repository":{"type":"git","url":"https://github.com/vega/vega-lite.git"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/vega/vega-lite/issues"},"devDependencies":{"@commitlint/cli":"^8.2.0","@commitlint/config-conventional":"^8.2.0","@types/chai":"^4.2.6","@types/d3":"^5.7.2","@types/highlight.js":"^9.12.3","@types/jest":"^24.0.23","@types/jest-environment-puppeteer":"^4.3.1","@types/mkdirp":"^0.5.2","@types/puppeteer":"^2.0.0","@typescript-eslint/eslint-plugin":"^2.10.0","@typescript-eslint/parser":"^2.10.0","ajv":"^6.10.2","chai":"^4.2.0","cheerio":"^1.0.0-rc.2","codecov":"^3.6.1","concurrently":"^5.0.0","d3":"^5.14.2","eslint":"^6.7.2","eslint-config-prettier":"^6.7.0","eslint-plugin-prettier":"^3.1.1","gh-pages":"^2.1.1","highlight.js":"^9.16.2","http-server":"^0.12.0","husky":"^3.1.0","jest":"^24.9.0","jest-puppeteer":"^4.3.0","lint-staged":"^9.5.0","mkdirp":"^0.5.1","prettier":"^1.19.1","puppeteer":"^2.0.0","rollup":"^1.27.8","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-json":"^4.0.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-sourcemaps":"^0.4.2","rollup-plugin-terser":"^5.1.2","svg2png-many":"^0.0.7","terser":"^4.4.2","ts-jest":"^24.2.0","ts-json-schema-generator":"^0.57.0","typescript":"~3.7.3","vega-cli":"^5.9.0","vega-datasets":"^1.28.0","vega-embed":"^6.2.0","vega-tooltip":"^0.19.1","yaml-front-matter":"^4.0.0"},"dependencies":{"@types/clone":"~0.1.30","@types/fast-json-stable-stringify":"^2.0.0","array-flat-polyfill":"^1.0.1","clone":"~2.1.2","fast-deep-equal":"~3.1.1","fast-json-stable-stringify":"~2.0.0","json-stringify-pretty-compact":"~2.0.0","tslib":"~1.10.0","vega-event-selector":"~2.0.2","vega-expression":"~2.6.3","vega-typings":"~0.12.0","vega-util":"~1.12.1","yargs":"~15.0.2"},"peerDependencies":{"vega":"^5.9.0"},"husky":{"hooks":{"pre-commit":"lint-staged","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"lint-staged":{"*.ts":["eslint --fix","git add"],"*.{md,css,yml}":["prettier --write","git add"]},"jest":{"preset":"jest-puppeteer","transform":{"^.+\\\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"testPathIgnorePatterns":["/node_modules","/build","/_site","/src"],"coverageDirectory":"./coverage/","collectCoverage":false}}')},function(e,t,n){(function(t){var n=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var n,r,i;try{n=Map}catch(e){n=function(){}}try{r=Set}catch(e){r=function(){}}try{i=Promise}catch(e){i=function(){}}function o(a,s,l,c,f){"object"==typeof s&&(l=s.depth,c=s.prototype,f=s.includeNonEnumerable,s=s.circular);var d=[],h=[],p=void 0!==t;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function a(l,m){if(null===l)return null;if(0===m)return l;var g,v;if("object"!=typeof l)return l;if(e(l,n))g=new n;else if(e(l,r))g=new r;else if(e(l,i))g=new i((function(e,t){l.then((function(t){e(a(t,m-1))}),(function(e){t(a(e,m-1))}))}));else if(o.__isArray(l))g=[];else if(o.__isRegExp(l))g=new RegExp(l.source,u(l)),l.lastIndex&&(g.lastIndex=l.lastIndex);else if(o.__isDate(l))g=new Date(l.getTime());else{if(p&&t.isBuffer(l))return g=t.allocUnsafe?t.allocUnsafe(l.length):new t(l.length),l.copy(g),g;e(l,Error)?g=Object.create(l):void 0===c?(v=Object.getPrototypeOf(l),g=Object.create(v)):(g=Object.create(c),v=c)}if(s){var y=d.indexOf(l);if(-1!=y)return h[y];d.push(l),h.push(g)}for(var b in e(l,n)&&l.forEach((function(e,t){var n=a(t,m-1),r=a(e,m-1);g.set(n,r)})),e(l,r)&&l.forEach((function(e){var t=a(e,m-1);g.add(t)})),l){var x;v&&(x=Object.getOwnPropertyDescriptor(v,b)),x&&null==x.set||(g[b]=a(l[b],m-1))}if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(l);for(b=0;b build/vega-themes.min.js","deploy:gh":"yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples","prepublishOnly":"yarn clean && yarn build","preversion":"yarn lint","serve":"browser-sync start -s -f build examples --serveStatic examples","start":"yarn build && concurrently --kill-others -n Server,Typescript,Rollup \'yarn serve\' \'tsc -w\' \'rollup -c -w\'"},"devDependencies":{"browser-sync":"^2.26.7","concurrently":"^5.0.0","gh-pages":"^2.1.1","rollup":"^1.27.8","rollup-plugin-json":"^4.0.0","terser":"^4.4.2","typescript":"~3.7.3","vega":"^5.9.0","vega-lite":"^4.0.0","vega-lite-dev-config":"^0.3.1"},"peerDependencies":{"vega":"*","vega-lite":"*"},"beemo":{"module":"vega-lite-dev-config","drivers":["prettier","eslint"]}}')},function(e){e.exports=JSON.parse('{"name":"vega-tooltip","version":"0.19.1","description":"A tooltip plugin for Vega-Lite and Vega visualizations.","main":"build/vega-tooltip.js","module":"build/src/index.js","unpkg":"build/vega-tooltip.min.js","jsdelivr":"build/vega-tooltip.min.js","typings":"build/src/index.d.ts","repository":{"type":"git","url":"https://github.com/vega/vega-tooltip.git"},"keywords":["vega-lite","vega","tooltip"],"author":{"name":"UW Interactive Data Lab","url":"https://idl.cs.washington.edu"},"collaborators":["Dominik Moritz","Sira Horradarn","Zening Qu","Kanit Wongsuphasawat","Yuri Astrakhan","Jeffrey Heer"],"license":"BSD-3-Clause","bugs":{"url":"https://github.com/vega/vega-tooltip/issues"},"homepage":"https://github.com/vega/vega-tooltip#readme","scripts":{"prepare":"beemo create-config --silent","tsc:src":"tsc -b tsconfig.src.json","build":"yarn tsc:src && rollup -c","clean":"rm -rf build examples/data && rm -f src/style.ts","copy:data":"rsync -r node_modules/vega-datasets/data/* examples/data","copy:build":"rsync -r build/* examples/build","deploy:gh":"yarn build && yarn copy:build && gh-pages -d examples && yarn clean","prettierbase":"beemo prettier \'examples/*.{html,scss,css}\'","eslintbase":"beemo eslint \'{src,test,types}/**/*.ts\'","format":"yarn eslintbase --fix && yarn prettierbase --write","lint":"yarn eslintbase && yarn prettierbase --check","postbuild":"terser build/vega-tooltip.js -c -m -o build/vega-tooltip.min.js","prebuild":"mkdir -p build && yarn copy:data && ./build-style.sh","prepublishOnly":"yarn clean && yarn build","preversion":"yarn lint","start":"yarn build && concurrently --kill-others -n Server,Typescript,Rollup \'browser-sync start -s -f build examples --serveStatic examples\' \'yarn tsc:src -w\' \'rollup -c -w\'","pretest":"./build-style.sh","test":"jest"},"devDependencies":{"@types/jest":"^24.0.18","browser-sync":"^2.26.7","concurrently":"^4.1.2","gh-pages":"^2.1.1","jest":"^24.9.0","node-sass":"^4.12.0","path":"^0.12.7","rollup":"^1.20.3","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-json":"^4.0.0","rollup-plugin-node-resolve":"^5.2.0","terser":"^4.2.1","ts-jest":"^24.0.2","typescript":"^3.6.2","vega-datasets":"^1.25.0","vega-lite-dev-config":"^0.2.5","vega-typings":"^0.8.1"},"dependencies":{"vega-util":"^1.11.1"},"beemo":{"module":"vega-lite-dev-config","drivers":["prettier","eslint"]},"jest":{"testURL":"http://localhost/","transform":{"^.+\\\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"testPathIgnorePatterns":["node_modules","/build","src"]}}')},,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),window.__webpack_public_path__=document.querySelector("body").getAttribute("data-base-url")+"nbextensions/displayWidget",function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(41))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(24)),r(n(43))},function(e){e.exports=JSON.parse('{"name":"lux-widget","version":"0.0.7","description":"A Custom Jupyter Widget Library","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["webpack.config.js","tsconfig.json","luxWidget/*.py","luxWidget/nbextension/static/*","*.py","src/*.tsx","src/*.ts","lib/**/*.js","lib/**/*.ts","dist/*.js","css/*.css"],"homepage":"https://github.com/lux-org/lux-widget","bugs":{"url":"https://github.com/lux-org/lux-widget/issues"},"license":"Apache License","author":{"name":"Doris Jung-Lin Lee","email":"dorisjunglinlee@gmail.com"},"main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/lux-org/lux-widget"},"scripts":{"postinstall":"pip install . && jupyter nbextension install --sys-prefix --symlink --overwrite --py luxWidget && jupyter nbextension enable --sys-prefix --py luxWidget","build":"npm install; npm run build:lib && npm run build:nbextension","build:labextension":"npm run clean:labextension && mkdirp luxWidget/labextension && cd luxWidget/labextension && npm pack ../..","build:lib":"tsc","build:nbextension":"webpack -p","build:all":"npm run build:labextension && npm run build:nbextension","clean":"npm run clean:lib && npm run clean:nbextension","clean:lib":"rimraf lib","clean:labextension":"rimraf luxWidget/labextension","clean:nbextension":"rimraf luxWidget/nbextension/static/index.js","prepack":"npm run build:lib","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch"},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2","bootstrap":"^4.4.1","detect-libc":"^1.0.3","needle":"^2.4.0","nopt":"^4.0.1","rc":"^1.2.8","react":"^16.12.0","react-bootstrap":"^1.0.0-beta.16","react-dom":"^16.12.0","react-vega":"7.1.1","vega":"^5.9.0","vega-embed":"^6.2.1","vega-lite":"^4.0.2"},"devDependencies":{"@babel/preset-react":"^7.7.4","@phosphor/application":"^1.6.0","@phosphor/widgets":"^1.6.0","@types/expect.js":"^0.3.29","@types/mocha":"^5.2.5","@types/node":"^10.11.6","@types/react":"^16.9.16","@types/react-dom":"^16.9.4","@types/webpack-env":"^1.13.6","css-loader":"^3.2.0","expect.js":"^0.3.1","fs-extra":"^7.0.0","mkdirp":"^0.5.1","mocha":"^5.2.0","npm-run-all":"^4.1.3","rimraf":"^2.7.1","source-map-loader":"^0.2.4","style-loader":"^1.0.0","ts-loader":"^6.2.1","typescript":"^3.7.4","webpack":"^4.41.4","webpack-cli":"^3.3.10"},"jupyterlab":{"extension":"lib/plugin"},"presets":["@babel/preset-env","@babel/preset-react"]}')},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(44),a=n(24);n(45);const u=r(n(1)),s=r(n(5)),l=i(n(26)),c=n(64),f=i(n(57)),d=i(n(63));class h extends o.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:h.model_name,_model_module:h.model_module,_model_module_version:h.model_module_version,_view_name:h.view_name,_view_module:h.view_module,value:"Hello World"})}}t.ExampleModel=h,h.serializers=Object.assign({},o.DOMWidgetModel.serializers),h.model_name="ExampleModel",h.model_module=a.MODULE_NAME,h.model_module_version=a.MODULE_VERSION,h.view_name="JupyterWidgetView",h.view_module=a.MODULE_NAME;class p extends o.DOMWidgetView{initialize(){let e=this;class t extends u.Component{constructor(e){super(e),console.log("view:",e),this.state={currentView:e.model.get("current_view"),recommendations:e.model.get("recommendations"),activeTab:e.activeTab,showAlert:!1,selectedRec:{},selectedVisLst:[],context:e.model.get("context")},console.log("this.state:",this.state),this.handleSelect=this.handleSelect.bind(this),this.exportSelection=this.exportSelection.bind(this)}onChange(e){this.setState(e.changed)}componentDidMount(){e.listenTo(e.model,"change",this.onChange.bind(this))}componentDidUpdate(){console.log("componentDidUpdate:",e.model.get("selectedVisLst")),e.model.save_changes()}handleSelect(e){this.setState({activeTab:e})}onListChanged(e,t){this.state.selectedRec[e]=t;var n=[];for(var r of Object.keys(this.state.selectedRec))n[r]=l.default.clone(l.default.omit(this.state.recommendations[r],"vspec")),n[r].vspec=l.default.at(this.state.recommendations[r].vspec,this.state.selectedRec[r]);this.setState({selectedVisLst:n})}exportSelection(){console.log("export selection"),this.setState(e=>({showAlert:!0})),setTimeout(()=>{this.setState(e=>({showAlert:!1}))},7e3),e.model.set("selectedVisLst",this.state.selectedVisLst)}render(){console.log("this.state.activeTab:",this.state.activeTab);const e=this.state.recommendations.map((e,t)=>u.createElement(c.Tab,{eventKey:e.action,title:e.action},u.createElement(f.default,{multiple:!0,maxSelectable:10,onChange:this.onListChanged.bind(this,t),graphSpec:e.vspec})));let t,n;e.length>0&&(t=u.createElement("i",{id:"exportBtn",className:"fa fa-upload",title:"Export selected visualization into variable",onClick:e=>this.exportSelection()})),this.state.showAlert&&(n=u.createElement(c.Alert,{id:"alertBox",key:"infoAlert",variant:"info",dismissible:!0},"Exported selected visualizations to Python variable `widget.selectedVisLst`"));let r=u.createElement("div",{style:{display:"flex",flexDirection:"row"}},u.createElement("div",{style:{width:"100%",border:"solid 1px lightgray",borderRadius:"5px",marginBottom:"5px",minHeight:"30px",maxHeight:"30px",display:"flex",flexDirection:"row"}},u.createElement("div",{style:{width:"100px",height:"100%",borderRight:"solid 1px lightgray",paddingLeft:"10px",paddingRight:"10px",display:"flex",flexDirection:"row",backgroundColor:"#f7f7f7"}},u.createElement("i",{id:"attributeIcon",className:"fa fa-th-list",style:{marginTop:"auto",marginBottom:"auto",marginRight:"5px",minWidth:"15px"}}),u.createElement("p",{style:{lineHeight:"28px"}},"Attribute")),u.createElement("div",{style:{height:"100%",display:"flex"}},this.state.context.attributes.map(e=>{u.createElement("div",{style:{marginTop:"2px",marginBottom:"2px",marginLeft:"10px",border:"solid 1px lightgray",borderRadius:"5px",display:"flex",flexDirection:"row",backgroundColor:"#f7f7f7"}},u.createElement("i",{id:"attributeIcon",className:"fa fa-hashtag",style:{marginTop:"auto",marginBottom:"auto",marginRight:"5px",marginLeft:"5px",minWidth:"15px"}}),u.createElement("p",{style:{lineHeight:"22px"}},e),u.createElement("i",{id:"attributeIcon",className:"fa fa-times-circle",style:{marginTop:"auto",marginBottom:"auto",marginRight:"5px",marginLeft:"5px",minWidth:"15px"},onClick:()=>{}}))}))),u.createElement("i",{id:"attributeIcon",className:"fa fa-bars",style:{marginTop:"auto",marginBottom:"auto",marginLeft:"10px",marginRight:"5px",minWidth:"15px"}})),i=u.createElement("div",{style:{display:"flex",flexDirection:"row"}},u.createElement("div",{style:{width:"100%",border:"solid 1px lightgray",borderRadius:"5px",marginBottom:"5px",minHeight:"30px"}},u.createElement("div",{style:{width:"100px",height:"100%",borderRight:"solid 1px lightgray",paddingLeft:"10px",paddingRight:"10px",display:"flex",flexDirection:"row",backgroundColor:"#f7f7f7"}},u.createElement("i",{id:"attributeIcon",className:"fa fa-filter",style:{marginTop:"auto",marginBottom:"auto",marginRight:"3px",marginLeft:"2px",minWidth:"15px"}}),u.createElement("p",{style:{lineHeight:"28px"}},"Filter")),u.createElement("div",{style:{width:"100%"}},this.state.context.filters.map(e=>{u.createElement("div",{style:{marginTop:"2px",marginBottom:"2px",marginLeft:"10px",border:"solid 1px lightgray",borderRadius:"5px",display:"flex",flexDirection:"row",backgroundColor:"#f7f7f7"}},u.createElement("i",{id:"attributeIcon",className:"fa fa-hashtag",style:{marginTop:"auto",marginBottom:"auto",marginRight:"5px",marginLeft:"5px",minWidth:"15px"}}),u.createElement("p",{style:{lineHeight:"22px"}},e),u.createElement("i",{id:"attributeIcon",className:"fa fa-times-circle",style:{marginTop:"auto",marginBottom:"auto",marginRight:"5px",marginLeft:"5px",minWidth:"15px"},onClick:()=>{}}))}))),u.createElement("i",{id:"attributeIcon",className:"fa fa-database",style:{marginTop:"auto",marginBottom:"auto",marginLeft:"10px",marginRight:"5px",minWidth:"15px"}}));return u.createElement("div",{id:"widgetContainer",style:{flexDirection:"column"}},r,i,u.createElement("div",{style:{display:"flex",flexDirection:"row"}},u.createElement(d.default,{currentViewSpec:this.state.currentView}),u.createElement("div",{id:"tabBanner"},u.createElement(c.Tabs,{activeKey:this.state.activeTab,id:"tabBannerList",onSelect:this.handleSelect},e)),t,n))}}const n=document.createElement("div"),r=u.createElement(t,e);s.render(r,n),e.el.append(n)}}t.JupyterWidgetView=p},function(t,n){t.exports=e},function(e,t,n){var r=n(46);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);var i={insert:"head",singleton:!1};n(48)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=n(47)(!1)).push([e.i,"#widgetContainer{\n height:380px;\n width:100%;\n display:inline-flex;\n}\ninput[type=text], select {\n width: 100%;\n padding: 12px 20px;\n margin: 8px 0;\n display: inline-block;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-sizing: border-box;\n}\n#mult-graph-container{\n display: inline-flex;\n}\n.recommendationStaticContentOuter{\n scroll-snap-align: start;\n border: 0.5px solid #bcbdbd;\n overflow-x: auto;\n overflow-y: hidden;\n display: inline-block;\n text-align: left;\n /* padding-left: 20px; */\n /* padding-top: 10px; */\n /* height: 100%; */\n height: 280px;\n box-sizing: border-box;\n width: 100%;\n position: relative;\n}\n.recommendationContentOuter{\n /* overflow: scroll; */\n /* Prevents unneccesary x-scroll for specified facet */\n /* width: 100%; */\n /*height: 225px;*/\n display: flex;\n /* display: inline-block;*/\n margin-left: 10px;\n text-align: left;\n}\n.vega-embed {\n position: relative;\n display: inline-block;\n /* padding-right: 38px; */\n flex: 1 0 auto;\n padding-right: 10px !important;\n}\n/* .vega-embed:hover{\n border: solid 1px;\n border-color: rgba(0, 0, 0, 0.4);\n box-shadow: 5px 5px 5px 0px rgba(0,0,0,0.5);\n cursor: pointer;\n} */\n.vega-embed:checked{\n border: solid 1px;\n border-color: blue;\n}\n.recommendationContentInner{\n /*width: auto;\n max-width: 150%;*/\n /*display: inline-block;*/\n /*margin-left: 8px;*/\n text-align: left;\n display: flex;\n flex-wrap: nowrap;\n align-items: flex-end;\n /* overflow-x: auto; */\n overflow-x: initial;\n padding-right: 50px;\n /*height: 280px;*/\n /* width: max-content;\n overflow-x: auto; */\n /* height: 100px; */\n}\n\n.toolDiv{\n position: relative;\n top: -20px;\n left: -5px;\n}\n.fa {\n color:gray;\n}\n.fa:hover{\n color:black;\n}\n.graph-container{\n height: 250px;\n max-height: 270px;\n margin: 10px 0px 5px 5px;\n padding: 0px 0px 0px 0px;\n overflow-y: auto;\n}\n#mainVizTitle{\n font-size: 20px;\n display: inline-block;\n left: 10%;\n top: 0px;\n position: absolute;\n}\n#mainVizContainer{\n padding: 10px 10px 0px 0px;\n /* position: absolute; */\n border: 0.5px solid #bcbdbd;\n overflow-y: auto;\n overflow-x: hidden;\n display: flex;\n min-width: 30%;\n}\n\n#mainVizInnerContainer{\n width: 300px;\n height: 245px;\n top: 21%;\n left: 3%;\n position: absolute;\n}\n#placeHolderVizContainer{\n min-height: 100%;\n min-width: 1px;\n}\n#tabBanner{\n width: auto;\n overflow: hidden;\n min-width: 70%;\n}\n#exportBtn{\n position: absolute;\n /* bottom: 90%; */\n /* left: 97%; */\n top: 70px;\n right: 0px;\n font-size: 20px;\n padding: 5px;\n}\n#alertBox{\n position: absolute;\n left: 33%;\n width: 65%;\n bottom: 6%;\n padding: 5px 30px 5px 10px;\n}\n/* canvas{\n width: 229px;\n height: 245px;\n} */\n/* Override .fade default to show tab*/\n.fade {\n opacity:1;\n}\n/* Copied from bootstrap.css */\n.nav {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n padding-left: 0;\n margin-bottom: 0;\n list-style: none;\n}\n\n.nav-link {\n display: block;\n padding: 0.5rem 1rem;\n}\n\n.nav-link:hover, .nav-link:focus {\n text-decoration: none;\n}\n\n.nav-link.disabled {\n color: #6c757d;\n pointer-events: none;\n cursor: default;\n}\n\n.nav-tabs {\n border-bottom: 1px solid #dee2e6;\n}\n\n.nav-tabs .nav-item {\n margin-bottom: -1px;\n}\n\n.nav-tabs .nav-link {\n border: 1px solid transparent;\n border-top-left-radius: 0.25rem;\n border-top-right-radius: 0.25rem;\n}\n\n.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus {\n border-color: #e9ecef #e9ecef #dee2e6;\n}\n\n.nav-tabs .nav-link.disabled {\n color: #6c757d;\n background-color: transparent;\n border-color: transparent;\n}\n\n.nav-tabs .nav-link.active,\n.nav-tabs .nav-item.show .nav-link {\n color: #495057;\n background-color: #fff;\n border-color: #dee2e6 #dee2e6 #fff;\n}\n\n.nav-tabs .dropdown-menu {\n margin-top: -1px;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n\n.nav-pills .nav-link {\n border-radius: 0.25rem;\n}\n\n.nav-pills .nav-link.active,\n.nav-pills .show > .nav-link {\n color: #fff;\n background-color: #007bff;\n}\n\n.nav-fill .nav-item {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n text-align: center;\n}\n\n.nav-justified .nav-item {\n -ms-flex-preferred-size: 0;\n flex-basis: 0;\n -ms-flex-positive: 1;\n flex-grow: 1;\n text-align: center;\n}\n\n.tab-content > .tab-pane {\n display: none;\n}\n\n.tab-content > .active {\n display: block;\n}\n/* Selectable Card React Component CSS */\n/* Card */\n.card {\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n background: #fff;\n margin: 20px 10px;\n cursor: pointer;\n}\n.card:hover {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n/* Selectable */\n.card .selectable {\n position: relative;\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n border: 4px solid transparent;\n}\n.card .selectable .check {\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n position: absolute;\n top: 0;\n right: 0;\n z-index: 10;\n width: 20px;\n height: 20px;\n}\n.card .selectable .check:before {\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n content: '';\n border: 20px solid;\n border-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n z-index: -1;\n}\n.card .selectable .check .checkmark {\n display: block;\n font: 20px sans-serif;\n line-height: 20px;\n text-align: center;\n color: transparent;\n}\n.card .selectable.selected {\n border-color: #4ad;\n}\n.card .selectable.selected .check:before {\n border-color: #4ad #4ad rgba(0, 0, 255, 0) rgba(255, 0, 0, 0);\n}\n.card .selectable.selected .check .checkmark {\n color: #fff;\n}\n.content {\n padding: 24px;\n}\n.content .title, .content .description {\n margin: 0;\n padding: 4px;\n}\n.column {\n float: left;\n width: 50%;\n}\n.column > .title {\n text-align: center;\n}\nbutton.card {\n display: block;\n cursor: pointer;\n width: 180px;\n margin: 20px auto;\n text-align: center;\n padding: 16px;\n border-color: transparent;\n border-radius: 10px;\n background: #4ad !important;\n color: #fff;\n text-transform: uppercase;\n font-weight: bold;\n outline: none;\n}\nbutton.card:focus {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n}\n",""]),e.exports=t},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(a=r,u=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(u),"/*# ".concat(s," */")),o=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot).concat(e," */")}));return[n].concat(o).concat([i]).join("\n")}var a,u,s;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r=0;r=_},u=function(){},t.unstable_forceFrameRate=function(e){0>e||125C(a,n))void 0!==s&&0>C(s,a)?(e[r]=s,e[u]=n,r=u):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==s&&0>C(s,n)))break e;e[r]=s,e[u]=n,r=u}}}return t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var A=[],N=[],T=1,D=null,M=3,F=!1,P=!1,R=!1;function z(e){for(var t=j(N);null!==t;){if(null===t.callback)S(N);else{if(!(t.startTime<=e))break;S(N),t.sortIndex=t.expirationTime,k(A,t)}t=j(N)}}function L(e){if(R=!1,z(e),!P)if(null!==j(A))P=!0,r(I);else{var t=j(N);null!==t&&i(L,t.startTime-e)}}function I(e,n){P=!1,R&&(R=!1,o()),F=!0;var r=M;try{for(z(n),D=j(A);null!==D&&(!(D.expirationTime>n)||e&&!a());){var u=D.callback;if(null!==u){D.callback=null,M=D.priorityLevel;var s=u(D.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?D.callback=s:D===j(A)&&S(A),z(n)}else S(A);D=j(A)}if(null!==D)var l=!0;else{var c=j(N);null!==c&&i(L,c.startTime-n),l=!1}return l}finally{D=null,M=r,F=!1}}function $(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var B=u;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=M;M=e;try{return t()}finally{M=n}},t.unstable_next=function(e){switch(M){case 1:case 2:case 3:var t=3;break;default:t=M}var n=M;M=t;try{return e()}finally{M=n}},t.unstable_scheduleCallback=function(e,n,a){var u=t.unstable_now();if("object"==typeof a&&null!==a){var s=a.delay;s="number"==typeof s&&0u?(e.sortIndex=s,k(N,e),null===j(A)&&e===j(N)&&(R?o():R=!0,i(L,s-u))):(e.sortIndex=a,k(A,e),P||F||(P=!0,r(I))),e},t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_wrapCallback=function(e){var t=M;return function(){var n=M;M=t;try{return e.apply(this,arguments)}finally{M=n}}},t.unstable_getCurrentPriorityLevel=function(){return M},t.unstable_shouldYield=function(){var e=t.unstable_now();z(e);var n=j(A);return n!==D&&null!==D&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime>",s=a||r;if(null==n[r])return t?new Error("Required "+o+" `"+s+"` was not specified in `"+u+"`."):null;for(var l=arguments.length,c=Array(l>6?l-6:0),f=6;f{if(n.multiple){var r=t.selected,i=r.indexOf(e);return i>-1?(r.splice(i,1),n.onChange(r)):r.length>=n.maxSelectable||(r.push(e),n.onChange(r)),{selected:r}}return n.onChange(e),{selected:e}})}render(){console.log("this.props.graphSpec:",this.props.graphSpec);const e=this.props.graphSpec.map((e,t)=>o.default.createElement("div",{key:t.toString(),className:"graph-container",id:"graph-container-".concat(t.toString())},o.default.createElement(a.default,{key:t,selected:this.state.selected.indexOf(t)>-1,onClick:e=>this.onItemSelected(t)},o.default.createElement(u.VegaLite,{spec:e,padding:{left:10,top:5,right:5,bottom:5},actions:!1}))));return o.default.createElement("div",{id:"staticOuterDiv",className:"recommendationStaticContentOuter"},o.default.createElement("div",{id:"mult-graph-container",className:"recommendationContentInner"},e))}}t.default=s},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(1));class o extends i.default.Component{render(){var e="selectable "+(this.props.selected?"selected":"");return i.default.createElement("div",{className:"card"},i.default.createElement("div",{className:e,onClick:this.props.onClick},this.props.children,i.default.createElement("div",{className:"check"},i.default.createElement("span",{className:"checkmark"},"✔"))))}}t.default=o},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,f=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&h())}function h(){if(!c){var e=u(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;n0?a-4:a;for(n=0;n>16&255,s[c++]=t>>8&255,s[c++]=255&t;2===u&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,s[c++]=255&t);1===u&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,s[c++]=t>>8&255,s[c++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,u=n-i;au?u:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,o,a=[],u=t;u>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,a,u=8*i-r-1,s=(1<>1,c=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-c)-1,h>>=-c,c+=u;c>0;o=256*o+e[t+f],f+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+f],f+=d,c-=8);if(0===o)o=1-l;else{if(o===s)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,u,s,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(a++,s/=2),a+f>=c?(u=0,a=c):a+f>=1?(u=(t*s-1)*Math.pow(2,i),a+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&u,h+=p,u/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,l-=8);e[n+h-p]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(n(1)),a=n(30),u=i(n(26));class s extends o.Component{constructor(e){super(e)}render(){console.log("this.props.currentViewSpec:",this.props.currentViewSpec);return u.default.isEmpty(this.props.currentViewSpec)?o.default.createElement("div",{className:"placeHolderVizContainer"}):o.default.createElement("div",{id:"mainVizContainer"},o.default.createElement("h2",{id:"mainVizTitle"},"Current View"),o.default.createElement("div",{id:"mainVizInnerContainer"},o.default.createElement("div",{className:"vizContainer",onClick:()=>{return e="main",void console.log(e);var e}},o.default.createElement(a.VegaLite,{spec:this.props.currentViewSpec,padding:{left:10,top:5,right:5,bottom:5},actions:!1}))))}}t.default=s},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}n.r(t);var o=n(2),a=n.n(o),u=n(1),s=n.n(u),l=n(7),c=n.n(l),f=function(){};function d(e,t){return void 0!==e[t]}function h(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function p(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function m(e,t){return Object.keys(t).reduce((function(n,o){var a,s=n,l=s[h(o)],c=s[o],f=i(s,[h(o),o].map(p)),d=t[o],m=function(e,t,n){var r=Object(u.useRef)(void 0!==e),i=Object(u.useState)(t),o=i[0],a=i[1],s=void 0!==e,l=r.current;return r.current=s,!s&&l&&o!==t&&a(t),[s?e:o,Object(u.useCallback)((function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;ift(t.props.children)-1){if(!r)return;i=0}t.select(i,e,"next")}},t.handlePrev=function(e){if(!t._isSliding){var n=t.props,r=n.wrap,i=n.activeIndex-1;if(i<0){if(!r)return;i=ft(t.props.children)-1}t.select(i,e,"prev")}},t}g(t,e);var n=t.prototype;return n.componentDidMount=function(){this.cycle()},t.getDerivedStateFromProps=function(e,t){var n=t.activeIndex;if(e.activeIndex!==n){var r=ft(e.children)-1,i=Math.max(0,Math.min(e.activeIndex,r));return{direction:0===i&&n>=r||n<=i?"next":"prev",previousActiveIndex:n,activeIndex:i}}return null},n.componentDidUpdate=function(e,t){var n=this,r=this.props,i=r.bsPrefix,o=r.slide,u=r.onSlideEnd;if(o&&this.state.activeIndex!==t.activeIndex&&!this._isSliding){var s,l,c=this.state,f=c.activeIndex,d=c.direction;"next"===d?(s=i+"-item-next",l=i+"-item-left"):"prev"===d&&(s=i+"-item-prev",l=i+"-item-right"),this._isSliding=!0,this.pause(),this.safeSetState({prevClasses:"active",currentClasses:s},(function(){var e=n.carousel.current.children[f];ue(e),n.safeSetState({prevClasses:a()("active",l),currentClasses:a()(s,l)},(function(){return X(e,(function(){n.safeSetState({prevClasses:"",currentClasses:"active"},n.handleSlideEnd),u&&u()}))}))}))}},n.componentWillUnmount=function(){clearTimeout(this.timeout),this.isUnmounted=!0},n.safeSetState=function(e,t){var n=this;this.isUnmounted||this.setState(e,(function(){return!n.isUnmounted&&t()}))},n.pause=function(){this._isPaused=!0,clearInterval(this._interval),this._interval=null},n.cycle=function(){this._isPaused=!1,clearInterval(this._interval),this._interval=null,this.props.interval&&!this._isPaused&&(this._interval=setInterval(document.visibilityState?this.handleNextWhenVisible:this.handleNext,this.props.interval))},n.to=function(e,t){var n=this.props.children;e<0||e>ft(n)-1||(this._isSliding?this._pendingIndex=e:this.select(e,t))},n.select=function(e,t,n){var r=this;clearTimeout(this.selectThrottle),t&&t.persist&&t.persist(),this.selectThrottle=setTimeout((function(){clearTimeout(r.timeout);var i=r.props,o=i.activeIndex,a=i.onSelect;e===o||r._isSliding||r.isUnmounted||a(e,n||(e1?a-1:0),s=1;s *"},qt.Menu=zt,qt.Toggle=Bt;var Wt=qt,Ht=s.a.createContext(null),Yt={as:De,disabled:!1},Vt=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.children,c=e.eventKey,f=e.disabled,d=e.href,h=e.onClick,p=e.onSelect,m=e.active,g=e.as,v=i(e,["bsPrefix","className","children","eventKey","disabled","href","onClick","onSelect","active","as"]),y=O(n,"dropdown-item"),b=Object(u.useContext)(A),x=(Object(u.useContext)(Ht)||{}).activeKey,w=C(c,d),_=null==m&&null!=w?C(x)===w:m,E=ye((function(e){f||(h&&h(e),b&&b(w,e),p&&p(w,e))}));return s.a.createElement(g,r({},v,{ref:t,href:d,disabled:f,className:a()(o,y,_&&"active",f&&"disabled"),onClick:E}),l)}));Vt.displayName="DropdownItem",Vt.defaultProps=Yt;var Gt=Vt,Xt=function(e){return e&&"function"!=typeof e?function(t){e.current=t}:e};var Kt=function(e,t){return Object(u.useMemo)((function(){return function(e,t){var n=Xt(e),r=Xt(t);return function(e){n&&n(e),r&&r(e)}}(e,t)}),[e,t])},Jt=s.a.createContext(null);function Qt(e,t){return e}var Zt=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.alignRight,c=e.rootCloseEvent,f=e.flip,d=e.popperConfig,h=e.show,p=e.as,m=void 0===p?"div":p,g=i(e,["bsPrefix","className","alignRight","rootCloseEvent","flip","popperConfig","show","as"]),v=Object(u.useContext)(Jt),y=O(n,"dropdown-menu"),b=Ft({flip:f,popperConfig:d,rootCloseEvent:c,show:h,alignEnd:l,usePopper:!v}),x=b.hasShown,w=b.placement,_=b.show,E=b.alignEnd,k=b.close,j=b.props;if(j.ref=Kt(j.ref,Qt(t)),!x)return null;"string"!=typeof m&&(j.show=_,j.close=k,j.alignRight=E);var S=g.style;return w&&(S=r({},S,{},j.style),g["x-placement"]=w),s.a.createElement(m,r({},g,j,{style:S,className:a()(o,y,_&&"show",E&&y+"-right")}))}));Zt.displayName="DropdownMenu",Zt.defaultProps={alignRight:!1,flip:!0};var en=Zt,tn=(n(15),s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.split,u=e.className,l=e.children,c=e.childBsPrefix,f=e.as,d=void 0===f?He:f,h=i(e,["bsPrefix","split","className","children","childBsPrefix","as"]),p=O(n,"dropdown-toggle");void 0!==c&&(h.bsPrefix=c);var m=Lt(),g=m[0],v=m[1].toggle;return g.ref=Kt(g.ref,Qt(t)),s.a.createElement(d,r({onClick:v,className:a()(u,p,o&&p+"-split")},g,h),l)})));tn.displayName="DropdownToggle";var nn=tn,rn=s.a.forwardRef((function(e,t){var n=m(e,{show:"onToggle"}),o=n.bsPrefix,l=n.drop,c=n.show,f=n.className,d=n.alignRight,h=n.onSelect,p=n.onToggle,g=n.focusFirstItemOnShow,v=n.as,y=void 0===v?"div":v,b=(n.navbar,i(n,["bsPrefix","drop","show","className","alignRight","onSelect","onToggle","focusFirstItemOnShow","as","navbar"])),x=Object(u.useContext)(A),w=O(o,"dropdown"),_=ye((function(e,t,n){void 0===n&&(n=t.type),t.currentTarget===document&&(n="rootClose"),p(e,t,{source:n})})),E=ye((function(e,t){x&&x(e,t),h&&h(e,t),_(!1,t,"select")}));return s.a.createElement(A.Provider,{value:E},s.a.createElement(Wt,{drop:l,show:c,alignEnd:d,onToggle:_,focusFirstItemOnShow:g,itemSelector:"."+w+"-item:not(.disabled):not(:disabled)"},(function(e){var n=e.props;return s.a.createElement(y,r({},b,n,{ref:t,className:a()(f,c&&"show",(!l||"down"===l)&&w,"up"===l&&"dropup","right"===l&&"dropright","left"===l&&"dropleft")}))})))}));rn.displayName="Dropdown",rn.defaultProps={navbar:!1},rn.Toggle=nn,rn.Menu=en,rn.Item=Gt,rn.Header=we("dropdown-header",{defaultProps:{role:"heading"}}),rn.Divider=we("dropdown-divider",{defaultProps:{role:"separator"}});var on=rn,an={id:J.a.any,href:J.a.string,onClick:J.a.func,title:J.a.node.isRequired,disabled:J.a.bool,menuRole:J.a.string,rootCloseEvent:J.a.string,bsPrefix:J.a.string,variant:J.a.string,size:J.a.string},un=s.a.forwardRef((function(e,t){var n=e.title,o=e.children,a=e.bsPrefix,u=e.rootCloseEvent,l=e.variant,c=e.size,f=e.menuRole,d=e.disabled,h=e.href,p=e.id,m=i(e,["title","children","bsPrefix","rootCloseEvent","variant","size","menuRole","disabled","href","id"]);return s.a.createElement(on,r({ref:t},m),s.a.createElement(on.Toggle,{id:p,href:h,size:c,variant:l,disabled:d,childBsPrefix:a},n),s.a.createElement(on.Menu,{role:f,rootCloseEvent:u},o))}));un.displayName="DropdownButton",un.propTypes=an;var sn=un,ln=(n(27),{type:J.a.string.isRequired,as:J.a.elementType}),cn=s.a.forwardRef((function(e,t){var n=e.as,o=void 0===n?"div":n,u=e.className,l=e.type,c=i(e,["as","className","type"]);return s.a.createElement(o,r({},c,{ref:t,className:a()(u,l&&l+"-feedback")}))}));cn.displayName="Feedback",cn.propTypes=ln,cn.defaultProps={type:"valid"};var fn=cn,dn=s.a.createContext({controlId:void 0}),hn=s.a.forwardRef((function(e,t){var n=e.id,o=e.bsPrefix,l=e.bsCustomPrefix,c=e.className,f=e.isValid,d=e.isInvalid,h=e.isStatic,p=e.as,m=void 0===p?"input":p,g=i(e,["id","bsPrefix","bsCustomPrefix","className","isValid","isInvalid","isStatic","as"]),v=Object(u.useContext)(dn),y=v.controlId;return o=v.custom?O(l,"custom-control-input"):O(o,"form-check-input"),s.a.createElement(m,r({},g,{ref:t,id:n||y,className:a()(c,o,f&&"is-valid",d&&"is-invalid",h&&"position-static")}))}));hn.displayName="FormCheckInput",hn.defaultProps={type:"checkbox"};var pn=hn,mn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.bsCustomPrefix,l=e.className,c=e.htmlFor,f=i(e,["bsPrefix","bsCustomPrefix","className","htmlFor"]),d=Object(u.useContext)(dn),h=d.controlId;return n=d.custom?O(o,"custom-control-label"):O(n,"form-check-label"),s.a.createElement("label",r({},f,{ref:t,htmlFor:c||h,className:a()(l,n)}))}));mn.displayName="FormCheckLabel";var gn=mn,vn=s.a.forwardRef((function(e,t){var n=e.id,o=e.bsPrefix,l=e.bsCustomPrefix,c=e.inline,f=e.disabled,d=e.isValid,h=e.isInvalid,p=e.feedback,m=e.className,g=e.style,v=e.title,y=e.type,b=e.label,x=e.children,w=e.custom,_=e.as,E=void 0===_?"input":_,k=i(e,["id","bsPrefix","bsCustomPrefix","inline","disabled","isValid","isInvalid","feedback","className","style","title","type","label","children","custom","as"]),j="switch"===y||w;o=j?O(l,"custom-control"):O(o,"form-check");var S=Object(u.useContext)(dn).controlId,C=Object(u.useMemo)((function(){return{controlId:n||S,custom:j}}),[S,j,n]),A=null!=b&&!1!==b&&!x,N=s.a.createElement(pn,r({},k,{type:"switch"===y?"checkbox":y,ref:t,isValid:d,isInvalid:h,isStatic:!A,disabled:f,as:E}));return s.a.createElement(dn.Provider,{value:C},s.a.createElement("div",{style:g,className:a()(m,o,j&&"custom-"+y,c&&o+"-inline")},x||s.a.createElement(s.a.Fragment,null,N,A&&s.a.createElement(gn,{title:v},b),(d||h)&&s.a.createElement(fn,{type:d?"valid":"invalid"},p))))}));vn.displayName="FormCheck",vn.defaultProps={type:"checkbox",inline:!1,disabled:!1,isValid:!1,isInvalid:!1,title:""},vn.Input=pn,vn.Label=gn;var yn=vn,bn=s.a.forwardRef((function(e,t){var n,o,l=e.bsPrefix,c=e.type,f=e.size,d=e.id,h=e.className,p=e.isValid,m=e.isInvalid,g=e.plaintext,v=e.readOnly,y=e.as,b=void 0===y?"input":y,x=i(e,["bsPrefix","type","size","id","className","isValid","isInvalid","plaintext","readOnly","as"]),w=Object(u.useContext)(dn).controlId;if(l=O(l,"form-control"),g)(o={})[l+"-plaintext"]=!0,n=o;else if("file"===c){var _;(_={})[l+"-file"]=!0,n=_}else{var E;(E={})[l]=!0,E[l+"-"+f]=f,n=E}return s.a.createElement(b,r({},x,{type:c,ref:t,readOnly:v,id:d||w,className:a()(h,n,p&&"is-valid",m&&"is-invalid")}))}));bn.displayName="FormControl",bn.Feedback=fn;var xn=bn,wn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.children,c=e.controlId,f=e.as,d=void 0===f?"div":f,h=i(e,["bsPrefix","className","children","controlId","as"]);n=O(n,"form-group");var p=Object(u.useMemo)((function(){return{controlId:c}}),[c]);return s.a.createElement(dn.Provider,{value:p},s.a.createElement(d,r({},h,{ref:t,className:a()(o,n)}),l))}));wn.displayName="FormGroup";var _n=wn,En=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.column,l=e.srOnly,c=e.className,f=e.htmlFor,d=i(e,["bsPrefix","column","srOnly","className","htmlFor"]),h=Object(u.useContext)(dn).controlId;n=O(n,"form-label");var p=a()(c,n,l&&"sr-only",o&&"col-form-label");return f=f||h,o?s.a.createElement(bt,r({as:"label",className:p,htmlFor:f},d)):s.a.createElement("label",r({ref:t,className:p,htmlFor:f},d))}));En.displayName="FormLabel",En.defaultProps={column:!1,srOnly:!1};var On=En,kn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.as,l=void 0===u?"small":u,c=e.muted,f=i(e,["bsPrefix","className","as","muted"]);return n=O(n,"form-text"),s.a.createElement(l,r({},f,{ref:t,className:a()(o,n,c&&"text-muted")}))}));kn.displayName="FormText";var jn=kn,Sn=s.a.forwardRef((function(e,t){return s.a.createElement(yn,r({},e,{ref:t,type:"switch"}))}));Sn.displayName="Switch",Sn.Input=yn.Input,Sn.Label=yn.Label;var Cn=Sn,An=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.inline,u=e.className,l=e.validated,c=e.as,f=void 0===c?"form":c,d=i(e,["bsPrefix","inline","className","validated","as"]);return n=O(n,"form"),s.a.createElement(f,r({},d,{ref:t,className:a()(u,l&&"was-validated",o&&n+"-inline")}))}));An.displayName="Form",An.defaultProps={inline:!1},An.Row=we("form-row"),An.Group=_n,An.Control=xn,An.Check=yn,An.Switch=Cn,An.Label=On,An.Text=jn;var Nn=An,Tn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.fluid,u=e.as,l=void 0===u?"div":u,c=e.className,f=i(e,["bsPrefix","fluid","as","className"]),d=O(n,"container");return s.a.createElement(l,r({ref:t},f,{className:a()(c,o?d+"-fluid":d)}))}));Tn.displayName="Container",Tn.defaultProps={fluid:!1};var Dn=Tn,Mn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.fluid,l=e.rounded,c=e.roundedCircle,f=e.thumbnail,d=i(e,["bsPrefix","className","fluid","rounded","roundedCircle","thumbnail"]);n=O(n,"img");var h=a()(u&&n+"-fluid",l&&"rounded",c&&"rounded-circle",f&&n+"-thumbnail");return s.a.createElement("img",r({ref:t},d,{className:a()(o,h)}))}));Mn.displayName="Image",Mn.defaultProps={fluid:!1,rounded:!1,roundedCircle:!1,thumbnail:!1};var Fn=Mn,Pn={bsPrefix:J.a.string,fluid:J.a.bool,rounded:J.a.bool,roundedCircle:J.a.bool,thumbnail:J.a.bool},Rn=s.a.forwardRef((function(e,t){var n=e.className,o=i(e,["className"]);return s.a.createElement(Fn,r({ref:t},o,{className:a()(n,"figure-img")}))}));Rn.displayName="FigureImage",Rn.propTypes=Pn,Rn.defaultProps={fluid:!0};var zn=Rn,Ln=we("figure-caption",{Component:"figcaption"}),In=we("figure",{Component:"figure"});In.Image=zn,In.Caption=Ln;var $n=In,Bn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.size,u=e.className,l=e.as,c=void 0===l?"div":l,f=i(e,["bsPrefix","size","className","as"]);return n=O(n,"input-group"),s.a.createElement(c,r({ref:t},f,{className:a()(u,n,o&&n+"-"+o)}))})),Un=we("input-group-append"),qn=we("input-group-prepend"),Wn=we("input-group-text",{Component:"span"});Bn.displayName="InputGroup",Bn.Text=Wn,Bn.Radio=function(e){return s.a.createElement(Wn,null,s.a.createElement("input",r({type:"radio"},e)))},Bn.Checkbox=function(e){return s.a.createElement(Wn,null,s.a.createElement("input",r({type:"checkbox"},e)))},Bn.Append=Un,Bn.Prepend=qn;var Hn=Bn,Yn=s.a.forwardRef((function(e,t){var n,o=e.as,u=void 0===o?"div":o,l=e.className,c=e.fluid,f=e.bsPrefix,d=i(e,["as","className","fluid","bsPrefix"]),h=((n={})[f=O(f,"jumbotron")]=!0,n[f+"-fluid"]=c,n);return s.a.createElement(u,r({ref:t},d,{className:a()(l,h)}))}));Yn.defaultProps={fluid:!1},Yn.displayName="Jumbotron";var Vn=Yn,Gn=s.a.createContext(null),Xn=function(){},Kn=s.a.forwardRef((function(e,t){var n,o,a=e.as,l=void 0===a?"ul":a,c=e.onSelect,f=e.activeKey,d=e.role,h=e.onKeyDown,p=i(e,["as","onSelect","activeKey","role","onKeyDown"]),m=Et(),g=Object(u.useRef)(!1),v=Object(u.useContext)(A),y=Object(u.useContext)(Gn);y&&(d=d||"tablist",f=y.activeKey,n=y.getControlledId,o=y.getControllerId);var b=Object(u.useRef)(null),x=function(e){if(!b.current)return null;var t=wt(b.current,"[data-rb-event-key]:not(.disabled)"),n=b.current.querySelector(".active"),r=t.indexOf(n);if(-1===r)return null;var i=r+e;return i>=t.length&&(i=0),i<0&&(i=t.length-1),t[i]},w=function(e,t){null!=e&&(c&&c(e,t),v&&v(e,t))};Object(u.useEffect)((function(){if(b.current&&g.current){var e=b.current.querySelector("[data-rb-event-key].active");e&&e.focus()}g.current=!1}));var _=Kt(t,b);return s.a.createElement(A.Provider,{value:w},s.a.createElement(Ht.Provider,{value:{role:d,activeKey:C(f),getControlledId:n||Xn,getControllerId:o||Xn}},s.a.createElement(l,r({},p,{onKeyDown:function(e){var t;switch(h&&h(e),e.key){case"ArrowLeft":case"ArrowUp":t=x(-1);break;case"ArrowRight":case"ArrowDown":t=x(1);break;default:return}t&&(e.preventDefault(),w(t.dataset.rbEventKey,e),g.current=!0,m())},ref:_,role:d}))))})),Jn=s.a.forwardRef((function(e,t){var n=e.active,o=e.className,l=e.tabIndex,c=e.eventKey,f=e.onSelect,d=e.onClick,h=e.as,p=i(e,["active","className","tabIndex","eventKey","onSelect","onClick","as"]),m=C(c,p.href),g=Object(u.useContext)(A),v=Object(u.useContext)(Ht),y=n;v&&(p.role||"tablist"!==v.role||(p.role="tab"),p["data-rb-event-key"]=m,p.id=v.getControllerId(m),p["aria-controls"]=v.getControlledId(m),y=null==n&&null!=m?v.activeKey===m:n),"tab"===p.role&&(p.tabIndex=y?l:-1,p["aria-selected"]=y);var b=ye((function(e){d&&d(e),null!=m&&(f&&f(m,e),g&&g(m,e))}));return s.a.createElement(h,r({},p,{ref:t,onClick:b,className:a()(o,y&&"active")}))}));Jn.defaultProps={disabled:!1};var Qn=Jn,Zn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.active,l=e.disabled,c=e.className,f=e.variant,d=e.action,h=e.as,p=e.eventKey,m=e.onClick,g=i(e,["bsPrefix","active","disabled","className","variant","action","as","eventKey","onClick"]);n=O(n,"list-group-item");var v=Object(u.useCallback)((function(e){if(l)return e.preventDefault(),void e.stopPropagation();m&&m(e)}),[l,m]);return s.a.createElement(Qn,r({ref:t},g,{eventKey:C(p,g.href),as:h||(d?g.href?"a":"button":"div"),onClick:v,className:a()(c,n,o&&"active",l&&"disabled",f&&n+"-"+f,d&&n+"-action")}))}));Zn.defaultProps={variant:null,active:!1,disabled:!1},Zn.displayName="ListGroupItem";var er=Zn,tr=s.a.forwardRef((function(e,t){var n,o=m(e,{activeKey:"onSelect"}),u=o.className,l=o.bsPrefix,c=o.variant,f=o.horizontal,d=o.as,h=void 0===d?"div":d,p=i(o,["className","bsPrefix","variant","horizontal","as"]);return l=O(l,"list-group"),n=f?!0===f?"horizontal":"horizontal-"+f:null,s.a.createElement(Kn,r({ref:t},p,{as:h,className:a()(u,l,c&&l+"-"+c,n&&l+"-"+n)}))}));tr.defaultProps={variant:null,horizontal:null},tr.displayName="ListGroup",tr.Item=er;var nr=tr,rr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.as,l=void 0===u?"div":u,c=i(e,["bsPrefix","className","as"]),f=O(n,"media");return s.a.createElement(l,r({},c,{ref:t,className:a()(o,f)}))}));rr.displayName="Media",rr.Body=we("media-body");var ir,or=rr;function ar(e){if((!ir&&0!==ir||e)&&$){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),ir=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return ir}function ur(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sr(e){void 0===e&&(e=M());try{var t=e.activeElement;return t&&t.nodeName?t:null}catch(t){return e.body}}function lr(e,t){e.classList?e.classList.add(t):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(e,t)||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function cr(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function fr(e,t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=cr(e.className,t):e.setAttribute("class",cr(e.className&&e.className.baseVal||"",t))}function dr(e){return"window"in e&&e.window===e?e:"nodeType"in(t=e)&&t.nodeType===document.DOCUMENT_NODE&&e.defaultView||!1;var t}function hr(e){var t;return dr(e)||(t=e)&&"body"===t.tagName.toLowerCase()?function(e){var t=M(e),n=dr(t);return t.body.clientWidthe.clientHeight}var pr=["template","script","style"],mr=function(e,t,n){t=[].concat(t),[].forEach.call(e.children,(function(e){var r,i,o;-1===t.indexOf(e)&&(i=(r=e).nodeType,o=r.tagName,1===i&&-1===pr.indexOf(o.toLowerCase()))&&n(e)}))};function gr(e,t){t&&(e?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden"))}var vr=function(){function e(e){var t=void 0===e?{}:e,n=t.hideSiblingNodes,r=void 0===n||n,i=t.handleContainerOverflow,o=void 0===i||i;this.hideSiblingNodes=r,this.handleContainerOverflow=o,this.modals=[],this.containers=[],this.data=[],this.scrollbarSize=ar()}var t=e.prototype;return t.isContainerOverflowing=function(e){var t=this.data[this.containerIndexFromModal(e)];return t&&t.overflowing},t.containerIndexFromModal=function(e){return t=this.data,n=function(t){return-1!==t.modals.indexOf(e)},r=-1,t.some((function(e,t){return!!n(e,t)&&(r=t,!0)})),r;var t,n,r},t.setContainerStyle=function(e,t){var n={overflow:"hidden"};e.style={overflow:t.style.overflow,paddingRight:t.style.paddingRight},e.overflowing&&(n.paddingRight=parseInt(I(t,"paddingRight")||0,10)+this.scrollbarSize+"px"),I(t,n)},t.removeContainerStyle=function(e,t){var n=e.style;Object.keys(n).forEach((function(e){t.style[e]=n[e]}))},t.add=function(e,t,n){var r=this.modals.indexOf(e),i=this.containers.indexOf(t);if(-1!==r)return r;if(r=this.modals.length,this.modals.push(e),this.hideSiblingNodes&&function(e,t){var n=t.dialog,r=t.backdrop;mr(e,[n,r],(function(e){return gr(!0,e)}))}(t,e),-1!==i)return this.data[i].modals.push(e),r;var o={modals:[e],classes:n?n.split(/\s+/):[],overflowing:hr(t)};return this.handleContainerOverflow&&this.setContainerStyle(o,t),o.classes.forEach(lr.bind(null,t)),this.containers.push(t),this.data.push(o),r},t.remove=function(e){var t=this.modals.indexOf(e);if(-1!==t){var n=this.containerIndexFromModal(e),r=this.data[n],i=this.containers[n];if(r.modals.splice(r.modals.indexOf(e),1),this.modals.splice(t,1),0===r.modals.length)r.classes.forEach(fr.bind(null,i)),this.handleContainerOverflow&&this.removeContainerStyle(r,i),this.hideSiblingNodes&&function(e,t){var n=t.dialog,r=t.backdrop;mr(e,[n,r],(function(e){return gr(!1,e)}))}(i,e),this.containers.splice(n,1),this.data.splice(n,1);else if(this.hideSiblingNodes){var o=r.modals[r.modals.length-1],a=o.backdrop;gr(!1,o.dialog),gr(!1,a)}}},t.isTopModal=function(e){return!!this.modals.length&&this.modals[this.modals.length-1]===e},e}(),yr=function(e){return M(Z.a.findDOMNode(e))},br=function(e){if("undefined"!=typeof document)return null==e?M().body:("function"==typeof e&&(e=e()),e&&e.current&&(e=e.current),e&&e.nodeType?e:null)};function xr(e,t){var n=Object(u.useState)((function(){return br(e)})),r=n[0],i=n[1];if(!r){var o=br(e);o&&i(o)}return Object(u.useEffect)((function(){t&&r&&t(r)}),[t,r]),Object(u.useEffect)((function(){var t=br(e);t!==r&&i(t)}),[e,r]),r}var wr=new vr;var _r=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i1?r-1:0),o=1;o1?r-1:0),o=1;o1?r-1:0),o=1;oM(e).documentElement.clientHeight;this.setState({style:{paddingRight:t&&!n?ar():void 0,paddingLeft:!t&&n?ar():void 0}})}},n.render=function(){var e=this.props,t=e.bsPrefix,n=e.className,o=e.style,u=e.dialogClassName,l=e.children,c=e.dialogAs,f=e.show,d=e.animation,h=e.backdrop,p=e.keyboard,m=e.manager,g=e.onEscapeKeyDown,v=e.onShow,y=e.onHide,b=e.container,x=e.autoFocus,w=e.enforceFocus,_=e.restoreFocus,E=e.onEntered,O=e.onExit,k=e.onExiting,j=(e.onExited,e.onEntering,e.onEnter,e.onEntering,e.backdropClassName,i(e,["bsPrefix","className","style","dialogClassName","children","dialogAs","show","animation","backdrop","keyboard","manager","onEscapeKeyDown","onShow","onHide","container","autoFocus","enforceFocus","restoreFocus","onEntered","onExit","onExiting","onExited","onEntering","onEnter","onEntering","backdropClassName"])),S=!0===h?this.handleClick:null,C=r({},o,{},this.state.style);return d||(C.display="block"),s.a.createElement(Dr.Provider,{value:this.modalContext},s.a.createElement(jr,{show:f,backdrop:h,container:b,keyboard:p,autoFocus:x,enforceFocus:w,restoreFocus:_,onEscapeKeyDown:g,onShow:v,onHide:y,onEntered:E,onExit:O,onExiting:k,manager:m,ref:this.setModalRef,style:C,className:a()(n,t),containerClassName:t+"-open",transition:d?$r:void 0,backdropTransition:d?Br:void 0,renderBackdrop:this.renderBackdrop,onClick:S,onMouseUp:this.handleMouseUp,onEnter:this.handleEnter,onEntering:this.handleEntering,onExited:this.handleExited},s.a.createElement(c,r({},j,{onMouseDown:this.handleDialogMouseDown,className:u}),l)))},t}(s.a.Component);Ur.defaultProps=Ir;var qr=k(Ur,"modal");qr.Body=Tr,qr.Header=zr,qr.Title=Lr,qr.Footer=Pr,qr.Dialog=Fr,qr.TRANSITION_DURATION=300,qr.BACKDROP_TRANSITION_DURATION=150;var Wr=qr,Hr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.children,l=e.as,c=void 0===l?"div":l,f=i(e,["bsPrefix","className","children","as"]);return n=O(n,"nav-item"),s.a.createElement(c,r({},f,{ref:t,className:a()(o,n)}),u)}));Hr.displayName="NavItem";var Yr=Hr,Vr={disabled:!1,as:De},Gr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.disabled,u=e.className,l=e.href,c=e.eventKey,f=e.onSelect,d=e.as,h=i(e,["bsPrefix","disabled","className","href","eventKey","onSelect","as"]);return n=O(n,"nav-link"),s.a.createElement(Qn,r({},h,{href:l,ref:t,eventKey:c,as:d,disabled:o,onSelect:f,className:a()(u,n,o&&"disabled")}))}));Gr.displayName="NavLink",Gr.defaultProps=Vr;var Xr=Gr,Kr=s.a.forwardRef((function(e,t){var n,o,l,c=m(e,{activeKey:"onSelect"}),f=c.as,d=void 0===f?"div":f,h=c.bsPrefix,p=c.variant,g=c.fill,v=c.justify,y=c.navbar,b=c.className,x=c.children,w=c.activeKey,_=i(c,["as","bsPrefix","variant","fill","justify","navbar","className","children","activeKey"]);h=O(h,"nav");var E=Object(u.useContext)(Jt),k=Object(u.useContext)(Ke);return E?(o=E.bsPrefix,y=null==y||y):k&&(l=k.cardHeaderBsPrefix),s.a.createElement(Kn,r({as:d,ref:t,activeKey:w,className:a()(b,(n={},n[h]=!y,n[o+"-nav"]=y,n[l+"-"+p]=!!l,n[h+"-"+p]=!!p,n[h+"-fill"]=g,n[h+"-justified"]=v,n))},_),x)}));Kr.displayName="Nav",Kr.defaultProps={justify:!1,fill:!1},Kr.Item=Yr,Kr.Link=Xr;var Jr=Kr,Qr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.as,l=i(e,["bsPrefix","className","as"]);n=O(n,"navbar-brand");var c=u||(l.href?"a":"span");return s.a.createElement(c,r({},l,{ref:t,className:a()(o,n)}))}));Qr.displayName="NavbarBrand";var Zr=Qr,ei=s.a.forwardRef((function(e,t){var n=e.children,o=e.bsPrefix,a=i(e,["children","bsPrefix"]);return o=O(o,"navbar-collapse"),s.a.createElement(Jt.Consumer,null,(function(e){return s.a.createElement(de,r({in:!(!e||!e.expanded)},a),s.a.createElement("div",{ref:t,className:o},n))}))}));ei.displayName="NavbarCollapse";var ti=ei,ni=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.children,c=e.label,f=e.as,d=void 0===f?"button":f,h=e.onClick,p=i(e,["bsPrefix","className","children","label","as","onClick"]);n=O(n,"navbar-toggler");var m=Object(u.useContext)(Jt)||{},g=m.onToggle,v=m.expanded,y=ye((function(e){h&&h(e),g&&g()}));return"button"===d&&(p.type="button"),s.a.createElement(d,r({},p,{ref:t,onClick:y,"aria-label":c,className:a()(o,n,!v&&"collapsed")}),l||s.a.createElement("span",{className:n+"-icon"}))}));ni.displayName="NavbarToggle",ni.defaultProps={label:"Toggle navigation"};var ri=ni,ii=s.a.forwardRef((function(e,t){var n=m(e,{expanded:"onToggle"}),o=n.bsPrefix,l=n.expand,c=n.variant,f=n.bg,d=n.fixed,h=n.sticky,p=n.className,g=n.children,v=n.as,y=void 0===v?"nav":v,b=n.expanded,x=n.onToggle,w=n.onSelect,_=n.collapseOnSelect,E=i(n,["bsPrefix","expand","variant","bg","fixed","sticky","className","children","as","expanded","onToggle","onSelect","collapseOnSelect"]);o=O(o,"navbar");var k=Object(u.useCallback)((function(){w&&w.apply(void 0,arguments),_&&b&&x(!1)}),[w,_,b,x]);void 0===E.role&&"nav"!==y&&(E.role="navigation");var j=o+"-expand";"string"==typeof l&&(j=j+"-"+l);var S=Object(u.useMemo)((function(){return{onToggle:function(){return x(!b)},bsPrefix:o,expanded:b}}),[o,b,x]);return s.a.createElement(Jt.Provider,{value:S},s.a.createElement(A.Provider,{value:k},s.a.createElement(y,r({ref:t},E,{className:a()(p,o,l&&j,c&&o+"-"+c,f&&"bg-"+f,h&&"sticky-"+h,d&&"fixed-"+d)}),g)))}));ii.defaultProps={expand:!0,variant:"light",collapseOnSelect:!1},ii.displayName="Navbar",ii.Brand=Zr,ii.Toggle=ri,ii.Collapse=ti,ii.Text=we("navbar-text",{Component:"span"});var oi=ii,ai={id:J.a.any,onClick:J.a.func,title:J.a.node.isRequired,disabled:J.a.bool,active:J.a.bool,menuRole:J.a.string,rootCloseEvent:J.a.string,bsPrefix:J.a.string},ui=s.a.forwardRef((function(e,t){var n=e.id,o=e.title,a=e.children,u=e.bsPrefix,l=e.rootCloseEvent,c=e.menuRole,f=e.disabled,d=e.active,h=i(e,["id","title","children","bsPrefix","rootCloseEvent","menuRole","disabled","active"]);return s.a.createElement(on,r({ref:t},h,{as:Yr}),s.a.createElement(on.Toggle,{id:n,eventKey:null,active:d,disabled:f,childBsPrefix:u,as:Xr},o),s.a.createElement(on.Menu,{role:c,rootCloseEvent:l},a))}));ui.displayName="NavDropdown",ui.propTypes=ai,ui.Item=on.Item,ui.Divider=on.Divider,ui.Header=on.Header;var si=ui,li=s.a.forwardRef((function(e,t){var n=e.flip,o=e.placement,a=e.containerPadding,l=e.popperConfig,c=void 0===l?{}:l,f=e.transition,d=_t(),h=d[0],p=d[1],m=_t(),g=m[0],v=m[1],y=Kt(p,t),b=xr(e.container),x=xr(e.target),w=Object(u.useState)(!e.show),_=w[0],E=w[1],O=c.modifiers,k=void 0===O?{}:O,j=Ct(x,h,r({},c,{placement:o||"bottom",enableEvents:e.show,modifiers:r({},k,{preventOverflow:r({padding:a||5},k.preventOverflow),arrow:r({},k.arrow,{enabled:!!g,element:g}),flip:r({enabled:!!n},k.preventOverflow)})})),S=j.styles,C=j.arrowStyles,A=i(j,["styles","arrowStyles"]);e.show?_&&E(!1):e.transition||_||E(!0);var N=e.show||f&&!_;if(Mt(h,e.onHide,{disabled:!e.rootClose||e.rootCloseDisabled,clickTrigger:e.rootCloseEvent}),!N)return null;var T=e.children(r({},A,{show:e.show,props:{style:S,ref:y},arrowProps:{style:C,ref:v}}));if(f){var D=e.onExit,M=e.onExiting,F=e.onEnter,P=e.onEntering,R=e.onEntered;T=s.a.createElement(f,{in:e.show,appear:!0,onExit:D,onExiting:M,onExited:function(){E(!0),e.onExited&&e.onExited.apply(e,arguments)},onEnter:F,onEntering:P,onEntered:R},T)}return b?Z.a.createPortal(T,b):null}));li.displayName="Overlay",li.propTypes={show:J.a.bool,placement:J.a.oneOf(kt.a.placements),target:J.a.any,container:J.a.any,flip:J.a.bool,children:J.a.func.isRequired,containerPadding:J.a.number,popperConfig:J.a.object,rootClose:J.a.bool,rootCloseEvent:J.a.oneOf(["click","mousedown"]),rootCloseDisabled:J.a.bool,onHide:function(e){var t=J.a.func;e.rootClose&&(t=t.isRequired);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=_},u=function(){},t.unstable_forceFrameRate=function(e){0>e||125C(a,n))void 0!==s&&0>C(s,a)?(e[r]=s,e[u]=n,r=u):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==s&&0>C(s,n)))break e;e[r]=s,e[u]=n,r=u}}}return t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var A=[],N=[],T=1,D=null,M=3,F=!1,P=!1,R=!1;function z(e){for(var t=j(N);null!==t;){if(null===t.callback)S(N);else{if(!(t.startTime<=e))break;S(N),t.sortIndex=t.expirationTime,k(A,t)}t=j(N)}}function L(e){if(R=!1,z(e),!P)if(null!==j(A))P=!0,r(I);else{var t=j(N);null!==t&&i(L,t.startTime-e)}}function I(e,n){P=!1,R&&(R=!1,o()),F=!0;var r=M;try{for(z(n),D=j(A);null!==D&&(!(D.expirationTime>n)||e&&!a());){var u=D.callback;if(null!==u){D.callback=null,M=D.priorityLevel;var s=u(D.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?D.callback=s:D===j(A)&&S(A),z(n)}else S(A);D=j(A)}if(null!==D)var l=!0;else{var c=j(N);null!==c&&i(L,c.startTime-n),l=!1}return l}finally{D=null,M=r,F=!1}}function $(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var B=u;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=M;M=e;try{return t()}finally{M=n}},t.unstable_next=function(e){switch(M){case 1:case 2:case 3:var t=3;break;default:t=M}var n=M;M=t;try{return e()}finally{M=n}},t.unstable_scheduleCallback=function(e,n,a){var u=t.unstable_now();if("object"==typeof a&&null!==a){var s=a.delay;s="number"==typeof s&&0u?(e.sortIndex=s,k(N,e),null===j(A)&&e===j(N)&&(R?o():R=!0,i(L,s-u))):(e.sortIndex=a,k(A,e),P||F||(P=!0,r(I))),e},t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_wrapCallback=function(e){var t=M;return function(){var n=M;M=t;try{return e.apply(this,arguments)}finally{M=n}}},t.unstable_getCurrentPriorityLevel=function(){return M},t.unstable_shouldYield=function(){var e=t.unstable_now();z(e);var n=j(A);return n!==D&&null!==D&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime>",s=a||r;if(null==n[r])return t?new Error("Required "+o+" `"+s+"` was not specified in `"+u+"`."):null;for(var l=arguments.length,c=Array(l>6?l-6:0),f=6;f{if(n.multiple){var r=t.selected,i=r.indexOf(e);return i>-1?(r.splice(i,1),n.onChange(r)):r.length>=n.maxSelectable||(r.push(e),n.onChange(r)),{selected:r}}return n.onChange(e),{selected:e}})}render(){console.log("this.props.graphSpec:",this.props.graphSpec);const e=this.props.graphSpec.map((e,t)=>o.default.createElement("div",{key:t.toString(),className:"graph-container",id:"graph-container-".concat(t.toString())},o.default.createElement(a.default,{key:t,selected:this.state.selected.indexOf(t)>-1,onClick:e=>this.onItemSelected(t)},o.default.createElement(u.VegaLite,{spec:e,padding:{left:10,top:5,right:5,bottom:5},actions:!1}))));return o.default.createElement("div",{id:"staticOuterDiv",className:"recommendationStaticContentOuter"},o.default.createElement("div",{id:"mult-graph-container",className:"recommendationContentInner"},e))}}t.default=s},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(1));class o extends i.default.Component{render(){var e="selectable "+(this.props.selected?"selected":"");return i.default.createElement("div",{className:"card"},i.default.createElement("div",{className:e,onClick:this.props.onClick},this.props.children,i.default.createElement("div",{className:"check"},i.default.createElement("span",{className:"checkmark"},"✔"))))}}t.default=o},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,f=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&h())}function h(){if(!c){var e=u(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;n0?a-4:a;for(n=0;n>16&255,s[c++]=t>>8&255,s[c++]=255&t;2===u&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,s[c++]=255&t);1===u&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,s[c++]=t>>8&255,s[c++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,u=n-i;au?u:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,o,a=[],u=t;u>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,a,u=8*i-r-1,s=(1<>1,c=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-c)-1,h>>=-c,c+=u;c>0;o=256*o+e[t+f],f+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+f],f+=d,c-=8);if(0===o)o=1-l;else{if(o===s)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,u,s,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(a++,s/=2),a+f>=c?(u=0,a=c):a+f>=1?(u=(t*s-1)*Math.pow(2,i),a+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&u,h+=p,u/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,l-=8);e[n+h-p]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(n(1)),a=n(30),u=i(n(26));class s extends o.Component{constructor(e){super(e)}render(){console.log("this.props.currentViewSpec:",this.props.currentViewSpec);return u.default.isEmpty(this.props.currentViewSpec)?o.default.createElement("div",{className:"placeHolderVizContainer"}):o.default.createElement("div",{id:"mainVizContainer"},o.default.createElement("div",{style:{display:"flex",flexDirection:"column"}},o.default.createElement("h2",{id:"mainVizTitle",style:{position:"relative",top:"0px",left:"0px",width:"245px",textAlign:"center"}},"Current View"),o.default.createElement("div",{id:"mainVizInnerContainer",style:{position:"relative",top:"0px",left:"0px"}},o.default.createElement("div",{className:"vizContainer",onClick:()=>{return e="main",void console.log(e);var e}},o.default.createElement(a.VegaLite,{spec:this.props.currentViewSpec,padding:{left:10,top:5,right:5,bottom:5},actions:!1})))))}}t.default=s},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}n.r(t);var o=n(2),a=n.n(o),u=n(1),s=n.n(u),l=n(7),c=n.n(l),f=function(){};function d(e,t){return void 0!==e[t]}function h(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function p(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function m(e,t){return Object.keys(t).reduce((function(n,o){var a,s=n,l=s[h(o)],c=s[o],f=i(s,[h(o),o].map(p)),d=t[o],m=function(e,t,n){var r=Object(u.useRef)(void 0!==e),i=Object(u.useState)(t),o=i[0],a=i[1],s=void 0!==e,l=r.current;return r.current=s,!s&&l&&o!==t&&a(t),[s?e:o,Object(u.useCallback)((function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;ift(t.props.children)-1){if(!r)return;i=0}t.select(i,e,"next")}},t.handlePrev=function(e){if(!t._isSliding){var n=t.props,r=n.wrap,i=n.activeIndex-1;if(i<0){if(!r)return;i=ft(t.props.children)-1}t.select(i,e,"prev")}},t}g(t,e);var n=t.prototype;return n.componentDidMount=function(){this.cycle()},t.getDerivedStateFromProps=function(e,t){var n=t.activeIndex;if(e.activeIndex!==n){var r=ft(e.children)-1,i=Math.max(0,Math.min(e.activeIndex,r));return{direction:0===i&&n>=r||n<=i?"next":"prev",previousActiveIndex:n,activeIndex:i}}return null},n.componentDidUpdate=function(e,t){var n=this,r=this.props,i=r.bsPrefix,o=r.slide,u=r.onSlideEnd;if(o&&this.state.activeIndex!==t.activeIndex&&!this._isSliding){var s,l,c=this.state,f=c.activeIndex,d=c.direction;"next"===d?(s=i+"-item-next",l=i+"-item-left"):"prev"===d&&(s=i+"-item-prev",l=i+"-item-right"),this._isSliding=!0,this.pause(),this.safeSetState({prevClasses:"active",currentClasses:s},(function(){var e=n.carousel.current.children[f];ue(e),n.safeSetState({prevClasses:a()("active",l),currentClasses:a()(s,l)},(function(){return X(e,(function(){n.safeSetState({prevClasses:"",currentClasses:"active"},n.handleSlideEnd),u&&u()}))}))}))}},n.componentWillUnmount=function(){clearTimeout(this.timeout),this.isUnmounted=!0},n.safeSetState=function(e,t){var n=this;this.isUnmounted||this.setState(e,(function(){return!n.isUnmounted&&t()}))},n.pause=function(){this._isPaused=!0,clearInterval(this._interval),this._interval=null},n.cycle=function(){this._isPaused=!1,clearInterval(this._interval),this._interval=null,this.props.interval&&!this._isPaused&&(this._interval=setInterval(document.visibilityState?this.handleNextWhenVisible:this.handleNext,this.props.interval))},n.to=function(e,t){var n=this.props.children;e<0||e>ft(n)-1||(this._isSliding?this._pendingIndex=e:this.select(e,t))},n.select=function(e,t,n){var r=this;clearTimeout(this.selectThrottle),t&&t.persist&&t.persist(),this.selectThrottle=setTimeout((function(){clearTimeout(r.timeout);var i=r.props,o=i.activeIndex,a=i.onSelect;e===o||r._isSliding||r.isUnmounted||a(e,n||(e1?a-1:0),s=1;s *"},qt.Menu=zt,qt.Toggle=Bt;var Wt=qt,Ht=s.a.createContext(null),Yt={as:De,disabled:!1},Vt=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.children,c=e.eventKey,f=e.disabled,d=e.href,h=e.onClick,p=e.onSelect,m=e.active,g=e.as,v=i(e,["bsPrefix","className","children","eventKey","disabled","href","onClick","onSelect","active","as"]),y=O(n,"dropdown-item"),b=Object(u.useContext)(A),x=(Object(u.useContext)(Ht)||{}).activeKey,w=C(c,d),_=null==m&&null!=w?C(x)===w:m,E=ye((function(e){f||(h&&h(e),b&&b(w,e),p&&p(w,e))}));return s.a.createElement(g,r({},v,{ref:t,href:d,disabled:f,className:a()(o,y,_&&"active",f&&"disabled"),onClick:E}),l)}));Vt.displayName="DropdownItem",Vt.defaultProps=Yt;var Gt=Vt,Xt=function(e){return e&&"function"!=typeof e?function(t){e.current=t}:e};var Kt=function(e,t){return Object(u.useMemo)((function(){return function(e,t){var n=Xt(e),r=Xt(t);return function(e){n&&n(e),r&&r(e)}}(e,t)}),[e,t])},Jt=s.a.createContext(null);function Qt(e,t){return e}var Zt=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.alignRight,c=e.rootCloseEvent,f=e.flip,d=e.popperConfig,h=e.show,p=e.as,m=void 0===p?"div":p,g=i(e,["bsPrefix","className","alignRight","rootCloseEvent","flip","popperConfig","show","as"]),v=Object(u.useContext)(Jt),y=O(n,"dropdown-menu"),b=Ft({flip:f,popperConfig:d,rootCloseEvent:c,show:h,alignEnd:l,usePopper:!v}),x=b.hasShown,w=b.placement,_=b.show,E=b.alignEnd,k=b.close,j=b.props;if(j.ref=Kt(j.ref,Qt(t)),!x)return null;"string"!=typeof m&&(j.show=_,j.close=k,j.alignRight=E);var S=g.style;return w&&(S=r({},S,{},j.style),g["x-placement"]=w),s.a.createElement(m,r({},g,j,{style:S,className:a()(o,y,_&&"show",E&&y+"-right")}))}));Zt.displayName="DropdownMenu",Zt.defaultProps={alignRight:!1,flip:!0};var en=Zt,tn=(n(15),s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.split,u=e.className,l=e.children,c=e.childBsPrefix,f=e.as,d=void 0===f?He:f,h=i(e,["bsPrefix","split","className","children","childBsPrefix","as"]),p=O(n,"dropdown-toggle");void 0!==c&&(h.bsPrefix=c);var m=Lt(),g=m[0],v=m[1].toggle;return g.ref=Kt(g.ref,Qt(t)),s.a.createElement(d,r({onClick:v,className:a()(u,p,o&&p+"-split")},g,h),l)})));tn.displayName="DropdownToggle";var nn=tn,rn=s.a.forwardRef((function(e,t){var n=m(e,{show:"onToggle"}),o=n.bsPrefix,l=n.drop,c=n.show,f=n.className,d=n.alignRight,h=n.onSelect,p=n.onToggle,g=n.focusFirstItemOnShow,v=n.as,y=void 0===v?"div":v,b=(n.navbar,i(n,["bsPrefix","drop","show","className","alignRight","onSelect","onToggle","focusFirstItemOnShow","as","navbar"])),x=Object(u.useContext)(A),w=O(o,"dropdown"),_=ye((function(e,t,n){void 0===n&&(n=t.type),t.currentTarget===document&&(n="rootClose"),p(e,t,{source:n})})),E=ye((function(e,t){x&&x(e,t),h&&h(e,t),_(!1,t,"select")}));return s.a.createElement(A.Provider,{value:E},s.a.createElement(Wt,{drop:l,show:c,alignEnd:d,onToggle:_,focusFirstItemOnShow:g,itemSelector:"."+w+"-item:not(.disabled):not(:disabled)"},(function(e){var n=e.props;return s.a.createElement(y,r({},b,n,{ref:t,className:a()(f,c&&"show",(!l||"down"===l)&&w,"up"===l&&"dropup","right"===l&&"dropright","left"===l&&"dropleft")}))})))}));rn.displayName="Dropdown",rn.defaultProps={navbar:!1},rn.Toggle=nn,rn.Menu=en,rn.Item=Gt,rn.Header=we("dropdown-header",{defaultProps:{role:"heading"}}),rn.Divider=we("dropdown-divider",{defaultProps:{role:"separator"}});var on=rn,an={id:J.a.any,href:J.a.string,onClick:J.a.func,title:J.a.node.isRequired,disabled:J.a.bool,menuRole:J.a.string,rootCloseEvent:J.a.string,bsPrefix:J.a.string,variant:J.a.string,size:J.a.string},un=s.a.forwardRef((function(e,t){var n=e.title,o=e.children,a=e.bsPrefix,u=e.rootCloseEvent,l=e.variant,c=e.size,f=e.menuRole,d=e.disabled,h=e.href,p=e.id,m=i(e,["title","children","bsPrefix","rootCloseEvent","variant","size","menuRole","disabled","href","id"]);return s.a.createElement(on,r({ref:t},m),s.a.createElement(on.Toggle,{id:p,href:h,size:c,variant:l,disabled:d,childBsPrefix:a},n),s.a.createElement(on.Menu,{role:f,rootCloseEvent:u},o))}));un.displayName="DropdownButton",un.propTypes=an;var sn=un,ln=(n(27),{type:J.a.string.isRequired,as:J.a.elementType}),cn=s.a.forwardRef((function(e,t){var n=e.as,o=void 0===n?"div":n,u=e.className,l=e.type,c=i(e,["as","className","type"]);return s.a.createElement(o,r({},c,{ref:t,className:a()(u,l&&l+"-feedback")}))}));cn.displayName="Feedback",cn.propTypes=ln,cn.defaultProps={type:"valid"};var fn=cn,dn=s.a.createContext({controlId:void 0}),hn=s.a.forwardRef((function(e,t){var n=e.id,o=e.bsPrefix,l=e.bsCustomPrefix,c=e.className,f=e.isValid,d=e.isInvalid,h=e.isStatic,p=e.as,m=void 0===p?"input":p,g=i(e,["id","bsPrefix","bsCustomPrefix","className","isValid","isInvalid","isStatic","as"]),v=Object(u.useContext)(dn),y=v.controlId;return o=v.custom?O(l,"custom-control-input"):O(o,"form-check-input"),s.a.createElement(m,r({},g,{ref:t,id:n||y,className:a()(c,o,f&&"is-valid",d&&"is-invalid",h&&"position-static")}))}));hn.displayName="FormCheckInput",hn.defaultProps={type:"checkbox"};var pn=hn,mn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.bsCustomPrefix,l=e.className,c=e.htmlFor,f=i(e,["bsPrefix","bsCustomPrefix","className","htmlFor"]),d=Object(u.useContext)(dn),h=d.controlId;return n=d.custom?O(o,"custom-control-label"):O(n,"form-check-label"),s.a.createElement("label",r({},f,{ref:t,htmlFor:c||h,className:a()(l,n)}))}));mn.displayName="FormCheckLabel";var gn=mn,vn=s.a.forwardRef((function(e,t){var n=e.id,o=e.bsPrefix,l=e.bsCustomPrefix,c=e.inline,f=e.disabled,d=e.isValid,h=e.isInvalid,p=e.feedback,m=e.className,g=e.style,v=e.title,y=e.type,b=e.label,x=e.children,w=e.custom,_=e.as,E=void 0===_?"input":_,k=i(e,["id","bsPrefix","bsCustomPrefix","inline","disabled","isValid","isInvalid","feedback","className","style","title","type","label","children","custom","as"]),j="switch"===y||w;o=j?O(l,"custom-control"):O(o,"form-check");var S=Object(u.useContext)(dn).controlId,C=Object(u.useMemo)((function(){return{controlId:n||S,custom:j}}),[S,j,n]),A=null!=b&&!1!==b&&!x,N=s.a.createElement(pn,r({},k,{type:"switch"===y?"checkbox":y,ref:t,isValid:d,isInvalid:h,isStatic:!A,disabled:f,as:E}));return s.a.createElement(dn.Provider,{value:C},s.a.createElement("div",{style:g,className:a()(m,o,j&&"custom-"+y,c&&o+"-inline")},x||s.a.createElement(s.a.Fragment,null,N,A&&s.a.createElement(gn,{title:v},b),(d||h)&&s.a.createElement(fn,{type:d?"valid":"invalid"},p))))}));vn.displayName="FormCheck",vn.defaultProps={type:"checkbox",inline:!1,disabled:!1,isValid:!1,isInvalid:!1,title:""},vn.Input=pn,vn.Label=gn;var yn=vn,bn=s.a.forwardRef((function(e,t){var n,o,l=e.bsPrefix,c=e.type,f=e.size,d=e.id,h=e.className,p=e.isValid,m=e.isInvalid,g=e.plaintext,v=e.readOnly,y=e.as,b=void 0===y?"input":y,x=i(e,["bsPrefix","type","size","id","className","isValid","isInvalid","plaintext","readOnly","as"]),w=Object(u.useContext)(dn).controlId;if(l=O(l,"form-control"),g)(o={})[l+"-plaintext"]=!0,n=o;else if("file"===c){var _;(_={})[l+"-file"]=!0,n=_}else{var E;(E={})[l]=!0,E[l+"-"+f]=f,n=E}return s.a.createElement(b,r({},x,{type:c,ref:t,readOnly:v,id:d||w,className:a()(h,n,p&&"is-valid",m&&"is-invalid")}))}));bn.displayName="FormControl",bn.Feedback=fn;var xn=bn,wn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.children,c=e.controlId,f=e.as,d=void 0===f?"div":f,h=i(e,["bsPrefix","className","children","controlId","as"]);n=O(n,"form-group");var p=Object(u.useMemo)((function(){return{controlId:c}}),[c]);return s.a.createElement(dn.Provider,{value:p},s.a.createElement(d,r({},h,{ref:t,className:a()(o,n)}),l))}));wn.displayName="FormGroup";var _n=wn,En=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.column,l=e.srOnly,c=e.className,f=e.htmlFor,d=i(e,["bsPrefix","column","srOnly","className","htmlFor"]),h=Object(u.useContext)(dn).controlId;n=O(n,"form-label");var p=a()(c,n,l&&"sr-only",o&&"col-form-label");return f=f||h,o?s.a.createElement(bt,r({as:"label",className:p,htmlFor:f},d)):s.a.createElement("label",r({ref:t,className:p,htmlFor:f},d))}));En.displayName="FormLabel",En.defaultProps={column:!1,srOnly:!1};var On=En,kn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.as,l=void 0===u?"small":u,c=e.muted,f=i(e,["bsPrefix","className","as","muted"]);return n=O(n,"form-text"),s.a.createElement(l,r({},f,{ref:t,className:a()(o,n,c&&"text-muted")}))}));kn.displayName="FormText";var jn=kn,Sn=s.a.forwardRef((function(e,t){return s.a.createElement(yn,r({},e,{ref:t,type:"switch"}))}));Sn.displayName="Switch",Sn.Input=yn.Input,Sn.Label=yn.Label;var Cn=Sn,An=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.inline,u=e.className,l=e.validated,c=e.as,f=void 0===c?"form":c,d=i(e,["bsPrefix","inline","className","validated","as"]);return n=O(n,"form"),s.a.createElement(f,r({},d,{ref:t,className:a()(u,l&&"was-validated",o&&n+"-inline")}))}));An.displayName="Form",An.defaultProps={inline:!1},An.Row=we("form-row"),An.Group=_n,An.Control=xn,An.Check=yn,An.Switch=Cn,An.Label=On,An.Text=jn;var Nn=An,Tn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.fluid,u=e.as,l=void 0===u?"div":u,c=e.className,f=i(e,["bsPrefix","fluid","as","className"]),d=O(n,"container");return s.a.createElement(l,r({ref:t},f,{className:a()(c,o?d+"-fluid":d)}))}));Tn.displayName="Container",Tn.defaultProps={fluid:!1};var Dn=Tn,Mn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.fluid,l=e.rounded,c=e.roundedCircle,f=e.thumbnail,d=i(e,["bsPrefix","className","fluid","rounded","roundedCircle","thumbnail"]);n=O(n,"img");var h=a()(u&&n+"-fluid",l&&"rounded",c&&"rounded-circle",f&&n+"-thumbnail");return s.a.createElement("img",r({ref:t},d,{className:a()(o,h)}))}));Mn.displayName="Image",Mn.defaultProps={fluid:!1,rounded:!1,roundedCircle:!1,thumbnail:!1};var Fn=Mn,Pn={bsPrefix:J.a.string,fluid:J.a.bool,rounded:J.a.bool,roundedCircle:J.a.bool,thumbnail:J.a.bool},Rn=s.a.forwardRef((function(e,t){var n=e.className,o=i(e,["className"]);return s.a.createElement(Fn,r({ref:t},o,{className:a()(n,"figure-img")}))}));Rn.displayName="FigureImage",Rn.propTypes=Pn,Rn.defaultProps={fluid:!0};var zn=Rn,Ln=we("figure-caption",{Component:"figcaption"}),In=we("figure",{Component:"figure"});In.Image=zn,In.Caption=Ln;var $n=In,Bn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.size,u=e.className,l=e.as,c=void 0===l?"div":l,f=i(e,["bsPrefix","size","className","as"]);return n=O(n,"input-group"),s.a.createElement(c,r({ref:t},f,{className:a()(u,n,o&&n+"-"+o)}))})),Un=we("input-group-append"),qn=we("input-group-prepend"),Wn=we("input-group-text",{Component:"span"});Bn.displayName="InputGroup",Bn.Text=Wn,Bn.Radio=function(e){return s.a.createElement(Wn,null,s.a.createElement("input",r({type:"radio"},e)))},Bn.Checkbox=function(e){return s.a.createElement(Wn,null,s.a.createElement("input",r({type:"checkbox"},e)))},Bn.Append=Un,Bn.Prepend=qn;var Hn=Bn,Yn=s.a.forwardRef((function(e,t){var n,o=e.as,u=void 0===o?"div":o,l=e.className,c=e.fluid,f=e.bsPrefix,d=i(e,["as","className","fluid","bsPrefix"]),h=((n={})[f=O(f,"jumbotron")]=!0,n[f+"-fluid"]=c,n);return s.a.createElement(u,r({ref:t},d,{className:a()(l,h)}))}));Yn.defaultProps={fluid:!1},Yn.displayName="Jumbotron";var Vn=Yn,Gn=s.a.createContext(null),Xn=function(){},Kn=s.a.forwardRef((function(e,t){var n,o,a=e.as,l=void 0===a?"ul":a,c=e.onSelect,f=e.activeKey,d=e.role,h=e.onKeyDown,p=i(e,["as","onSelect","activeKey","role","onKeyDown"]),m=Et(),g=Object(u.useRef)(!1),v=Object(u.useContext)(A),y=Object(u.useContext)(Gn);y&&(d=d||"tablist",f=y.activeKey,n=y.getControlledId,o=y.getControllerId);var b=Object(u.useRef)(null),x=function(e){if(!b.current)return null;var t=wt(b.current,"[data-rb-event-key]:not(.disabled)"),n=b.current.querySelector(".active"),r=t.indexOf(n);if(-1===r)return null;var i=r+e;return i>=t.length&&(i=0),i<0&&(i=t.length-1),t[i]},w=function(e,t){null!=e&&(c&&c(e,t),v&&v(e,t))};Object(u.useEffect)((function(){if(b.current&&g.current){var e=b.current.querySelector("[data-rb-event-key].active");e&&e.focus()}g.current=!1}));var _=Kt(t,b);return s.a.createElement(A.Provider,{value:w},s.a.createElement(Ht.Provider,{value:{role:d,activeKey:C(f),getControlledId:n||Xn,getControllerId:o||Xn}},s.a.createElement(l,r({},p,{onKeyDown:function(e){var t;switch(h&&h(e),e.key){case"ArrowLeft":case"ArrowUp":t=x(-1);break;case"ArrowRight":case"ArrowDown":t=x(1);break;default:return}t&&(e.preventDefault(),w(t.dataset.rbEventKey,e),g.current=!0,m())},ref:_,role:d}))))})),Jn=s.a.forwardRef((function(e,t){var n=e.active,o=e.className,l=e.tabIndex,c=e.eventKey,f=e.onSelect,d=e.onClick,h=e.as,p=i(e,["active","className","tabIndex","eventKey","onSelect","onClick","as"]),m=C(c,p.href),g=Object(u.useContext)(A),v=Object(u.useContext)(Ht),y=n;v&&(p.role||"tablist"!==v.role||(p.role="tab"),p["data-rb-event-key"]=m,p.id=v.getControllerId(m),p["aria-controls"]=v.getControlledId(m),y=null==n&&null!=m?v.activeKey===m:n),"tab"===p.role&&(p.tabIndex=y?l:-1,p["aria-selected"]=y);var b=ye((function(e){d&&d(e),null!=m&&(f&&f(m,e),g&&g(m,e))}));return s.a.createElement(h,r({},p,{ref:t,onClick:b,className:a()(o,y&&"active")}))}));Jn.defaultProps={disabled:!1};var Qn=Jn,Zn=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.active,l=e.disabled,c=e.className,f=e.variant,d=e.action,h=e.as,p=e.eventKey,m=e.onClick,g=i(e,["bsPrefix","active","disabled","className","variant","action","as","eventKey","onClick"]);n=O(n,"list-group-item");var v=Object(u.useCallback)((function(e){if(l)return e.preventDefault(),void e.stopPropagation();m&&m(e)}),[l,m]);return s.a.createElement(Qn,r({ref:t},g,{eventKey:C(p,g.href),as:h||(d?g.href?"a":"button":"div"),onClick:v,className:a()(c,n,o&&"active",l&&"disabled",f&&n+"-"+f,d&&n+"-action")}))}));Zn.defaultProps={variant:null,active:!1,disabled:!1},Zn.displayName="ListGroupItem";var er=Zn,tr=s.a.forwardRef((function(e,t){var n,o=m(e,{activeKey:"onSelect"}),u=o.className,l=o.bsPrefix,c=o.variant,f=o.horizontal,d=o.as,h=void 0===d?"div":d,p=i(o,["className","bsPrefix","variant","horizontal","as"]);return l=O(l,"list-group"),n=f?!0===f?"horizontal":"horizontal-"+f:null,s.a.createElement(Kn,r({ref:t},p,{as:h,className:a()(u,l,c&&l+"-"+c,n&&l+"-"+n)}))}));tr.defaultProps={variant:null,horizontal:null},tr.displayName="ListGroup",tr.Item=er;var nr=tr,rr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.as,l=void 0===u?"div":u,c=i(e,["bsPrefix","className","as"]),f=O(n,"media");return s.a.createElement(l,r({},c,{ref:t,className:a()(o,f)}))}));rr.displayName="Media",rr.Body=we("media-body");var ir,or=rr;function ar(e){if((!ir&&0!==ir||e)&&$){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),ir=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return ir}function ur(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sr(e){void 0===e&&(e=M());try{var t=e.activeElement;return t&&t.nodeName?t:null}catch(t){return e.body}}function lr(e,t){e.classList?e.classList.add(t):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(e,t)||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function cr(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function fr(e,t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=cr(e.className,t):e.setAttribute("class",cr(e.className&&e.className.baseVal||"",t))}function dr(e){return"window"in e&&e.window===e?e:"nodeType"in(t=e)&&t.nodeType===document.DOCUMENT_NODE&&e.defaultView||!1;var t}function hr(e){var t;return dr(e)||(t=e)&&"body"===t.tagName.toLowerCase()?function(e){var t=M(e),n=dr(t);return t.body.clientWidthe.clientHeight}var pr=["template","script","style"],mr=function(e,t,n){t=[].concat(t),[].forEach.call(e.children,(function(e){var r,i,o;-1===t.indexOf(e)&&(i=(r=e).nodeType,o=r.tagName,1===i&&-1===pr.indexOf(o.toLowerCase()))&&n(e)}))};function gr(e,t){t&&(e?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden"))}var vr=function(){function e(e){var t=void 0===e?{}:e,n=t.hideSiblingNodes,r=void 0===n||n,i=t.handleContainerOverflow,o=void 0===i||i;this.hideSiblingNodes=r,this.handleContainerOverflow=o,this.modals=[],this.containers=[],this.data=[],this.scrollbarSize=ar()}var t=e.prototype;return t.isContainerOverflowing=function(e){var t=this.data[this.containerIndexFromModal(e)];return t&&t.overflowing},t.containerIndexFromModal=function(e){return t=this.data,n=function(t){return-1!==t.modals.indexOf(e)},r=-1,t.some((function(e,t){return!!n(e,t)&&(r=t,!0)})),r;var t,n,r},t.setContainerStyle=function(e,t){var n={overflow:"hidden"};e.style={overflow:t.style.overflow,paddingRight:t.style.paddingRight},e.overflowing&&(n.paddingRight=parseInt(I(t,"paddingRight")||0,10)+this.scrollbarSize+"px"),I(t,n)},t.removeContainerStyle=function(e,t){var n=e.style;Object.keys(n).forEach((function(e){t.style[e]=n[e]}))},t.add=function(e,t,n){var r=this.modals.indexOf(e),i=this.containers.indexOf(t);if(-1!==r)return r;if(r=this.modals.length,this.modals.push(e),this.hideSiblingNodes&&function(e,t){var n=t.dialog,r=t.backdrop;mr(e,[n,r],(function(e){return gr(!0,e)}))}(t,e),-1!==i)return this.data[i].modals.push(e),r;var o={modals:[e],classes:n?n.split(/\s+/):[],overflowing:hr(t)};return this.handleContainerOverflow&&this.setContainerStyle(o,t),o.classes.forEach(lr.bind(null,t)),this.containers.push(t),this.data.push(o),r},t.remove=function(e){var t=this.modals.indexOf(e);if(-1!==t){var n=this.containerIndexFromModal(e),r=this.data[n],i=this.containers[n];if(r.modals.splice(r.modals.indexOf(e),1),this.modals.splice(t,1),0===r.modals.length)r.classes.forEach(fr.bind(null,i)),this.handleContainerOverflow&&this.removeContainerStyle(r,i),this.hideSiblingNodes&&function(e,t){var n=t.dialog,r=t.backdrop;mr(e,[n,r],(function(e){return gr(!1,e)}))}(i,e),this.containers.splice(n,1),this.data.splice(n,1);else if(this.hideSiblingNodes){var o=r.modals[r.modals.length-1],a=o.backdrop;gr(!1,o.dialog),gr(!1,a)}}},t.isTopModal=function(e){return!!this.modals.length&&this.modals[this.modals.length-1]===e},e}(),yr=function(e){return M(Z.a.findDOMNode(e))},br=function(e){if("undefined"!=typeof document)return null==e?M().body:("function"==typeof e&&(e=e()),e&&e.current&&(e=e.current),e&&e.nodeType?e:null)};function xr(e,t){var n=Object(u.useState)((function(){return br(e)})),r=n[0],i=n[1];if(!r){var o=br(e);o&&i(o)}return Object(u.useEffect)((function(){t&&r&&t(r)}),[t,r]),Object(u.useEffect)((function(){var t=br(e);t!==r&&i(t)}),[e,r]),r}var wr=new vr;var _r=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i1?r-1:0),o=1;o1?r-1:0),o=1;o1?r-1:0),o=1;oM(e).documentElement.clientHeight;this.setState({style:{paddingRight:t&&!n?ar():void 0,paddingLeft:!t&&n?ar():void 0}})}},n.render=function(){var e=this.props,t=e.bsPrefix,n=e.className,o=e.style,u=e.dialogClassName,l=e.children,c=e.dialogAs,f=e.show,d=e.animation,h=e.backdrop,p=e.keyboard,m=e.manager,g=e.onEscapeKeyDown,v=e.onShow,y=e.onHide,b=e.container,x=e.autoFocus,w=e.enforceFocus,_=e.restoreFocus,E=e.onEntered,O=e.onExit,k=e.onExiting,j=(e.onExited,e.onEntering,e.onEnter,e.onEntering,e.backdropClassName,i(e,["bsPrefix","className","style","dialogClassName","children","dialogAs","show","animation","backdrop","keyboard","manager","onEscapeKeyDown","onShow","onHide","container","autoFocus","enforceFocus","restoreFocus","onEntered","onExit","onExiting","onExited","onEntering","onEnter","onEntering","backdropClassName"])),S=!0===h?this.handleClick:null,C=r({},o,{},this.state.style);return d||(C.display="block"),s.a.createElement(Dr.Provider,{value:this.modalContext},s.a.createElement(jr,{show:f,backdrop:h,container:b,keyboard:p,autoFocus:x,enforceFocus:w,restoreFocus:_,onEscapeKeyDown:g,onShow:v,onHide:y,onEntered:E,onExit:O,onExiting:k,manager:m,ref:this.setModalRef,style:C,className:a()(n,t),containerClassName:t+"-open",transition:d?$r:void 0,backdropTransition:d?Br:void 0,renderBackdrop:this.renderBackdrop,onClick:S,onMouseUp:this.handleMouseUp,onEnter:this.handleEnter,onEntering:this.handleEntering,onExited:this.handleExited},s.a.createElement(c,r({},j,{onMouseDown:this.handleDialogMouseDown,className:u}),l)))},t}(s.a.Component);Ur.defaultProps=Ir;var qr=k(Ur,"modal");qr.Body=Tr,qr.Header=zr,qr.Title=Lr,qr.Footer=Pr,qr.Dialog=Fr,qr.TRANSITION_DURATION=300,qr.BACKDROP_TRANSITION_DURATION=150;var Wr=qr,Hr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.children,l=e.as,c=void 0===l?"div":l,f=i(e,["bsPrefix","className","children","as"]);return n=O(n,"nav-item"),s.a.createElement(c,r({},f,{ref:t,className:a()(o,n)}),u)}));Hr.displayName="NavItem";var Yr=Hr,Vr={disabled:!1,as:De},Gr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.disabled,u=e.className,l=e.href,c=e.eventKey,f=e.onSelect,d=e.as,h=i(e,["bsPrefix","disabled","className","href","eventKey","onSelect","as"]);return n=O(n,"nav-link"),s.a.createElement(Qn,r({},h,{href:l,ref:t,eventKey:c,as:d,disabled:o,onSelect:f,className:a()(u,n,o&&"disabled")}))}));Gr.displayName="NavLink",Gr.defaultProps=Vr;var Xr=Gr,Kr=s.a.forwardRef((function(e,t){var n,o,l,c=m(e,{activeKey:"onSelect"}),f=c.as,d=void 0===f?"div":f,h=c.bsPrefix,p=c.variant,g=c.fill,v=c.justify,y=c.navbar,b=c.className,x=c.children,w=c.activeKey,_=i(c,["as","bsPrefix","variant","fill","justify","navbar","className","children","activeKey"]);h=O(h,"nav");var E=Object(u.useContext)(Jt),k=Object(u.useContext)(Ke);return E?(o=E.bsPrefix,y=null==y||y):k&&(l=k.cardHeaderBsPrefix),s.a.createElement(Kn,r({as:d,ref:t,activeKey:w,className:a()(b,(n={},n[h]=!y,n[o+"-nav"]=y,n[l+"-"+p]=!!l,n[h+"-"+p]=!!p,n[h+"-fill"]=g,n[h+"-justified"]=v,n))},_),x)}));Kr.displayName="Nav",Kr.defaultProps={justify:!1,fill:!1},Kr.Item=Yr,Kr.Link=Xr;var Jr=Kr,Qr=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,u=e.as,l=i(e,["bsPrefix","className","as"]);n=O(n,"navbar-brand");var c=u||(l.href?"a":"span");return s.a.createElement(c,r({},l,{ref:t,className:a()(o,n)}))}));Qr.displayName="NavbarBrand";var Zr=Qr,ei=s.a.forwardRef((function(e,t){var n=e.children,o=e.bsPrefix,a=i(e,["children","bsPrefix"]);return o=O(o,"navbar-collapse"),s.a.createElement(Jt.Consumer,null,(function(e){return s.a.createElement(de,r({in:!(!e||!e.expanded)},a),s.a.createElement("div",{ref:t,className:o},n))}))}));ei.displayName="NavbarCollapse";var ti=ei,ni=s.a.forwardRef((function(e,t){var n=e.bsPrefix,o=e.className,l=e.children,c=e.label,f=e.as,d=void 0===f?"button":f,h=e.onClick,p=i(e,["bsPrefix","className","children","label","as","onClick"]);n=O(n,"navbar-toggler");var m=Object(u.useContext)(Jt)||{},g=m.onToggle,v=m.expanded,y=ye((function(e){h&&h(e),g&&g()}));return"button"===d&&(p.type="button"),s.a.createElement(d,r({},p,{ref:t,onClick:y,"aria-label":c,className:a()(o,n,!v&&"collapsed")}),l||s.a.createElement("span",{className:n+"-icon"}))}));ni.displayName="NavbarToggle",ni.defaultProps={label:"Toggle navigation"};var ri=ni,ii=s.a.forwardRef((function(e,t){var n=m(e,{expanded:"onToggle"}),o=n.bsPrefix,l=n.expand,c=n.variant,f=n.bg,d=n.fixed,h=n.sticky,p=n.className,g=n.children,v=n.as,y=void 0===v?"nav":v,b=n.expanded,x=n.onToggle,w=n.onSelect,_=n.collapseOnSelect,E=i(n,["bsPrefix","expand","variant","bg","fixed","sticky","className","children","as","expanded","onToggle","onSelect","collapseOnSelect"]);o=O(o,"navbar");var k=Object(u.useCallback)((function(){w&&w.apply(void 0,arguments),_&&b&&x(!1)}),[w,_,b,x]);void 0===E.role&&"nav"!==y&&(E.role="navigation");var j=o+"-expand";"string"==typeof l&&(j=j+"-"+l);var S=Object(u.useMemo)((function(){return{onToggle:function(){return x(!b)},bsPrefix:o,expanded:b}}),[o,b,x]);return s.a.createElement(Jt.Provider,{value:S},s.a.createElement(A.Provider,{value:k},s.a.createElement(y,r({ref:t},E,{className:a()(p,o,l&&j,c&&o+"-"+c,f&&"bg-"+f,h&&"sticky-"+h,d&&"fixed-"+d)}),g)))}));ii.defaultProps={expand:!0,variant:"light",collapseOnSelect:!1},ii.displayName="Navbar",ii.Brand=Zr,ii.Toggle=ri,ii.Collapse=ti,ii.Text=we("navbar-text",{Component:"span"});var oi=ii,ai={id:J.a.any,onClick:J.a.func,title:J.a.node.isRequired,disabled:J.a.bool,active:J.a.bool,menuRole:J.a.string,rootCloseEvent:J.a.string,bsPrefix:J.a.string},ui=s.a.forwardRef((function(e,t){var n=e.id,o=e.title,a=e.children,u=e.bsPrefix,l=e.rootCloseEvent,c=e.menuRole,f=e.disabled,d=e.active,h=i(e,["id","title","children","bsPrefix","rootCloseEvent","menuRole","disabled","active"]);return s.a.createElement(on,r({ref:t},h,{as:Yr}),s.a.createElement(on.Toggle,{id:n,eventKey:null,active:d,disabled:f,childBsPrefix:u,as:Xr},o),s.a.createElement(on.Menu,{role:c,rootCloseEvent:l},a))}));ui.displayName="NavDropdown",ui.propTypes=ai,ui.Item=on.Item,ui.Divider=on.Divider,ui.Header=on.Header;var si=ui,li=s.a.forwardRef((function(e,t){var n=e.flip,o=e.placement,a=e.containerPadding,l=e.popperConfig,c=void 0===l?{}:l,f=e.transition,d=_t(),h=d[0],p=d[1],m=_t(),g=m[0],v=m[1],y=Kt(p,t),b=xr(e.container),x=xr(e.target),w=Object(u.useState)(!e.show),_=w[0],E=w[1],O=c.modifiers,k=void 0===O?{}:O,j=Ct(x,h,r({},c,{placement:o||"bottom",enableEvents:e.show,modifiers:r({},k,{preventOverflow:r({padding:a||5},k.preventOverflow),arrow:r({},k.arrow,{enabled:!!g,element:g}),flip:r({enabled:!!n},k.preventOverflow)})})),S=j.styles,C=j.arrowStyles,A=i(j,["styles","arrowStyles"]);e.show?_&&E(!1):e.transition||_||E(!0);var N=e.show||f&&!_;if(Mt(h,e.onHide,{disabled:!e.rootClose||e.rootCloseDisabled,clickTrigger:e.rootCloseEvent}),!N)return null;var T=e.children(r({},A,{show:e.show,props:{style:S,ref:y},arrowProps:{style:C,ref:v}}));if(f){var D=e.onExit,M=e.onExiting,F=e.onEnter,P=e.onEntering,R=e.onEntered;T=s.a.createElement(f,{in:e.show,appear:!0,onExit:D,onExiting:M,onExited:function(){E(!0),e.onExited&&e.onExited.apply(e,arguments)},onEnter:F,onEntering:P,onEntered:R},T)}return b?Z.a.createPortal(T,b):null}));li.displayName="Overlay",li.propTypes={show:J.a.bool,placement:J.a.oneOf(kt.a.placements),target:J.a.any,container:J.a.any,flip:J.a.bool,children:J.a.func.isRequired,containerPadding:J.a.number,popperConfig:J.a.object,rootClose:J.a.bool,rootCloseEvent:J.a.oneOf(["click","mousedown"]),rootCloseDisabled:J.a.bool,onHide:function(e){var t=J.a.func;e.rootClose&&(t=t.isRequired);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i i) {\n push();\n } else {\n i = j + 1;\n }\n } else if (c === '[') {\n if (j > i) push();\n b = i = j + 1;\n } else if (c === ']') {\n if (!b) error('Access path missing open bracket: ' + p);\n if (b > 0) push();\n b = 0;\n i = j + 1;\n }\n }\n\n if (b) error('Access path missing closing bracket: ' + p);\n if (q) error('Access path missing closing quote: ' + p);\n\n if (j > i) {\n j++;\n push();\n }\n\n return path;\n}\n","export default Array.isArray;\n","export default function(_) {\n return _ === Object(_);\n}\n","export default function(_) {\n return typeof _ === 'string';\n}\n","import isArray from './isArray';\nimport isObject from './isObject';\nimport isString from './isString';\n\nexport default function $(x) {\n return isArray(x) ? '[' + x.map($) + ']'\n : isObject(x) || isString(x) ?\n // Output valid JSON and JS source strings.\n // See http://timelessrepo.com/json-isnt-a-javascript-subset\n JSON.stringify(x).replace('\\u2028','\\\\u2028').replace('\\u2029', '\\\\u2029')\n : x;\n}\n","import accessor from './accessor';\nimport splitAccessPath from './splitAccessPath';\nimport stringValue from './stringValue';\n\nexport default function(field, name) {\n var path = splitAccessPath(field),\n code = 'return _[' + path.map(stringValue).join('][') + '];';\n\n return accessor(\n Function('_', code),\n [(field = path.length===1 ? path[0] : field)],\n name || field\n );\n}\n","import accessor from './accessor';\nimport field from './field';\n\nvar empty = [];\n\nexport var id = field('id');\n\nexport var identity = accessor(function(_) { return _; }, empty, 'identity');\n\nexport var zero = accessor(function() { return 0; }, empty, 'zero');\n\nexport var one = accessor(function() { return 1; }, empty, 'one');\n\nexport var truthy = accessor(function() { return true; }, empty, 'true');\n\nexport var falsy = accessor(function() { return false; }, empty, 'false');\n","function log(method, level, input) {\n var args = [level].concat([].slice.call(input));\n console[method].apply(console, args); // eslint-disable-line no-console\n}\n\nexport var None = 0;\nexport var Error = 1;\nexport var Warn = 2;\nexport var Info = 3;\nexport var Debug = 4;\n\nexport default function(_, method) {\n var level = _ || None;\n return {\n level: function(_) {\n if (arguments.length) {\n level = +_;\n return this;\n } else {\n return level;\n }\n },\n error: function() {\n if (level >= Error) log(method || 'error', 'ERROR', arguments);\n return this;\n },\n warn: function() {\n if (level >= Warn) log(method || 'warn', 'WARN', arguments);\n return this;\n },\n info: function() {\n if (level >= Info) log(method || 'log', 'INFO', arguments);\n return this;\n },\n debug: function() {\n if (level >= Debug) log(method || 'log', 'DEBUG', arguments);\n return this;\n }\n }\n}\n","import isArray from './isArray';\nimport isObject from './isObject';\n\nexport function mergeConfig(...configs) {\n return configs.reduce((out, source) => {\n for (var key in source) {\n if (key === 'signals') {\n // for signals, we merge the signals arrays\n // source signals take precedence over\n // existing signals with the same name\n out.signals = mergeNamed(out.signals, source.signals);\n } else {\n // otherwise, merge objects subject to recursion constraints\n // for legend block, recurse for the layout entry only\n // for style block, recurse for all properties\n // otherwise, no recursion: objects overwrite, no merging\n var r = key === 'legend' ? {'layout': 1}\n : key === 'style' ? true\n : null;\n writeConfig(out, key, source[key], r);\n }\n }\n return out;\n }, {});\n}\n\nexport function writeConfig(output, key, value, recurse) {\n var k, o;\n if (isObject(value) && !isArray(value)) {\n o = isObject(output[key]) ? output[key] : (output[key] = {});\n for (k in value) {\n if (recurse && (recurse === true || recurse[k])) {\n writeConfig(o, k, value[k]);\n } else {\n o[k] = value[k];\n }\n }\n } else {\n output[key] = value;\n }\n}\n\nfunction mergeNamed(a, b) {\n if (a == null) return b;\n\n const map = {}, out = [];\n\n function add(_) {\n if (!map[_.name]) {\n map[_.name] = 1;\n out.push(_);\n }\n }\n\n b.forEach(add);\n a.forEach(add);\n return out;\n}\n","export default function(array) {\n return array[array.length - 1];\n}\n","export default function(_) {\n return _ == null || _ === '' ? null : +_;\n}\n","import {identity} from './accessors';\nimport peek from './peek';\nimport toNumber from './toNumber';\n\nfunction exp(sign) {\n return function(x) { return sign * Math.exp(x); };\n}\n\nfunction log(sign) {\n return function(x) { return Math.log(sign * x); };\n}\n\nfunction symlog(c) {\n return function(x) { return Math.sign(x) * Math.log1p(Math.abs(x / c)); };\n}\n\nfunction symexp(c) {\n return function(x) { return Math.sign(x) * Math.expm1(Math.abs(x)) * c; };\n}\n\nfunction pow(exponent) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n };\n}\n\nfunction pan(domain, delta, lift, ground) {\n var d0 = lift(domain[0]),\n d1 = lift(peek(domain)),\n dd = (d1 - d0) * delta;\n\n return [\n ground(d0 - dd),\n ground(d1 - dd)\n ];\n}\n\nexport function panLinear(domain, delta) {\n return pan(domain, delta, toNumber, identity);\n}\n\nexport function panLog(domain, delta) {\n var sign = Math.sign(domain[0]);\n return pan(domain, delta, log(sign), exp(sign));\n}\n\nexport function panPow(domain, delta, exponent) {\n return pan(domain, delta, pow(exponent), pow(1/exponent));\n}\n\nexport function panSymlog(domain, delta, constant) {\n return pan(domain, delta, symlog(constant), symexp(constant));\n}\n\nfunction zoom(domain, anchor, scale, lift, ground) {\n var d0 = lift(domain[0]),\n d1 = lift(peek(domain)),\n da = anchor != null ? lift(anchor) : (d0 + d1) / 2;\n\n return [\n ground(da + (d0 - da) * scale),\n ground(da + (d1 - da) * scale)\n ];\n}\n\nexport function zoomLinear(domain, anchor, scale) {\n return zoom(domain, anchor, scale, toNumber, identity);\n}\n\nexport function zoomLog(domain, anchor, scale) {\n var sign = Math.sign(domain[0]);\n return zoom(domain, anchor, scale, log(sign), exp(sign));\n}\n\nexport function zoomPow(domain, anchor, scale, exponent) {\n return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent));\n}\n\nexport function zoomSymlog(domain, anchor, scale, constant) {\n return zoom(domain, anchor, scale, symlog(constant), symexp(constant));\n}\n","export function quarter(date) {\n return 1 + ~~(new Date(date).getMonth() / 3);\n}\n\nexport function utcquarter(date) {\n return 1 + ~~(new Date(date).getUTCMonth() / 3);\n}\n","import isArray from './isArray';\n\nexport default function(_) {\n return _ != null ? (isArray(_) ? _ : [_]) : [];\n}\n","/**\n * Span-preserving range clamp. If the span of the input range is less\n * than (max - min) and an endpoint exceeds either the min or max value,\n * the range is translated such that the span is preserved and one\n * endpoint touches the boundary of the min/max range.\n * If the span exceeds (max - min), the range [min, max] is returned.\n */\nexport default function(range, min, max) {\n var lo = range[0],\n hi = range[1],\n span;\n\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n span = hi - lo;\n\n return span >= (max - min)\n ? [min, max]\n : [\n (lo = Math.min(Math.max(lo, min), max - span)),\n lo + span\n ];\n}\n","export default function(_) {\n return typeof _ === 'function';\n}\n","import {default as accessor, accessorFields} from './accessor';\nimport array from './array';\nimport isFunction from './isFunction';\nimport splitAccessPath from './splitAccessPath';\nimport stringValue from './stringValue';\n\nexport default function(fields, orders) {\n var idx = [],\n cmp = (fields = array(fields)).map(function(f, i) {\n if (f == null) {\n return null;\n } else {\n idx.push(i);\n return isFunction(f) ? f\n : splitAccessPath(f).map(stringValue).join('][');\n }\n }),\n n = idx.length - 1,\n ord = array(orders),\n code = 'var u,v;return ',\n i, j, f, u, v, d, t, lt, gt;\n\n if (n < 0) return null;\n\n for (j=0; j<=n; ++j) {\n i = idx[j];\n f = cmp[i];\n\n if (isFunction(f)) {\n d = 'f' + i;\n u = '(u=this.' + d + '(a))';\n v = '(v=this.' + d + '(b))';\n (t = t || {})[d] = f;\n } else {\n u = '(u=a['+f+'])';\n v = '(v=b['+f+'])';\n }\n\n d = '((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))';\n\n if (ord[i] !== 'descending') {\n gt = 1;\n lt = -1;\n } else {\n gt = -1;\n lt = 1;\n }\n\n code += '(' + u+'<'+v+'||u==null)&&v!=null?' + lt\n + ':(u>v||v==null)&&u!=null?' + gt\n + ':'+d+'!==u&&v===v?' + lt\n + ':v!==v&&u===u?' + gt\n + (i < n ? ':' : ':0');\n }\n\n f = Function('a', 'b', code + ';');\n if (t) f = f.bind(t);\n\n fields = fields.reduce(function(map, field) {\n if (isFunction(field)) {\n (accessorFields(field) || []).forEach(function(_) { map[_] = 1; });\n } else if (field != null) {\n map[field + ''] = 1;\n }\n return map;\n }, {});\n\n return accessor(f, Object.keys(fields));\n}\n","import isFunction from './isFunction';\n\nexport default function(_) {\n return isFunction(_) ? _ : function() { return _; };\n}\n","export default function(delay, handler) {\n var tid, evt;\n\n function callback() {\n handler(evt);\n tid = evt = null;\n }\n\n return function(e) {\n evt = e;\n if (tid) clearTimeout(tid);\n tid = setTimeout(callback, delay);\n };\n}\n","export default function(_) {\n for (var x, k, i=1, len=arguments.length; i max) max = v;\n }\n }\n } else {\n // find first valid value\n for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i]));\n min = max = v;\n\n // visit all other values\n for (; i max) max = v;\n }\n }\n }\n }\n\n return [min, max];\n}\n","export default function(array, f) {\n var i = -1,\n n = array.length,\n a, b, c, u, v;\n\n if (f == null) {\n while (++i < n) {\n b = array[i];\n if (b != null && b >= b) {\n a = c = b;\n break;\n }\n }\n if (i === n) return [-1, -1];\n u = v = i;\n while (++i < n) {\n b = array[i];\n if (b != null) {\n if (a > b) {\n a = b;\n u = i;\n }\n if (c < b) {\n c = b;\n v = i;\n }\n }\n }\n } else {\n while (++i < n) {\n b = f(array[i], i, array);\n if (b != null && b >= b) {\n a = c = b;\n break;\n }\n }\n if (i === n) return [-1, -1];\n u = v = i;\n while (++i < n) {\n b = f(array[i], i, array);\n if (b != null) {\n if (a > b) {\n a = b;\n u = i;\n }\n if (c < b) {\n c = b;\n v = i;\n }\n }\n }\n }\n\n return [u, v];\n}\n","const hop = Object.prototype.hasOwnProperty;\n\nexport default function(object, property) {\n return hop.call(object, property);\n}\n","import hasOwnProperty from './hasOwnProperty';\n\nvar NULL = {};\n\nexport default function(input) {\n var obj = {},\n map,\n test;\n\n function has(key) {\n return hasOwnProperty(obj, key) && obj[key] !== NULL;\n }\n\n map = {\n size: 0,\n empty: 0,\n object: obj,\n has: has,\n get: function(key) {\n return has(key) ? obj[key] : undefined;\n },\n set: function(key, value) {\n if (!has(key)) {\n ++map.size;\n if (obj[key] === NULL) --map.empty;\n }\n obj[key] = value;\n return this;\n },\n delete: function(key) {\n if (has(key)) {\n --map.size;\n ++map.empty;\n obj[key] = NULL;\n }\n return this;\n },\n clear: function() {\n map.size = map.empty = 0;\n map.object = obj = {};\n },\n test: function(_) {\n if (arguments.length) {\n test = _;\n return map;\n } else {\n return test;\n }\n },\n clean: function() {\n var next = {},\n size = 0,\n key, value;\n for (key in obj) {\n value = obj[key];\n if (value !== NULL && (!test || !test(value))) {\n next[key] = value;\n ++size;\n }\n }\n map.size = size;\n map.empty = 0;\n map.object = (obj = next);\n }\n };\n\n if (input) Object.keys(input).forEach(function(key) {\n map.set(key, input[key]);\n });\n\n return map;\n}\n","import peek from './peek';\n\nexport default function(range, value, threshold, left, right, center) {\n if (!threshold && threshold !== 0) return center;\n\n var a = range[0],\n b = peek(range),\n t = +threshold,\n l, r;\n\n // swap endpoints if range is reversed\n if (b < a) {\n l = a; a = b; b = l;\n }\n\n // compare value to endpoints\n l = Math.abs(value - a);\n r = Math.abs(b - value);\n\n // adjust if value is within threshold distance of endpoint\n return l < r && l <= t ? left : r <= t ? right : center;\n}\n","export default function(child, parent) {\n var proto = (child.prototype = Object.create(parent.prototype));\n proto.constructor = child;\n return proto;\n}\n","/**\n * Predicate that returns true if the value lies within the span\n * of the given range. The left and right flags control the use\n * of inclusive (true) or exclusive (false) comparisons.\n */\nexport default function(value, range, left, right) {\n var r0 = range[0], r1 = range[range.length-1], t;\n if (r0 > r1) {\n t = r0;\n r0 = r1;\n r1 = t;\n }\n left = left === undefined || left;\n right = right === undefined || right;\n\n return (left ? r0 <= value : r0 < value) &&\n (right ? value <= r1 : value < r1);\n}\n","export default function(_) {\n return typeof _ === 'boolean';\n}\n","export default function(_) {\n return Object.prototype.toString.call(_) === '[object Date]';\n}\n","export default function(_) {\n return typeof _ === 'number';\n}\n","export default function(_) {\n return Object.prototype.toString.call(_) === '[object RegExp]';\n}\n","import accessor from './accessor';\nimport array from './array';\nimport splitAccessPath from './splitAccessPath';\nimport stringValue from './stringValue';\n\nexport default function(fields, flat) {\n if (fields) {\n fields = flat\n ? array(fields).map(function(f) { return f.replace(/\\\\(.)/g, '$1'); })\n : array(fields);\n }\n\n var fn = !(fields && fields.length)\n ? function() { return ''; }\n : Function('_', 'return \\'\\'+' +\n fields.map(function(f) {\n return '_[' + (flat\n ? stringValue(f)\n : splitAccessPath(f).map(stringValue).join('][')\n ) + ']';\n }).join('+\\'|\\'+') + ';');\n\n return accessor(fn, fields, 'key');\n}\n","import peek from './peek';\n\nexport default function(array, frac) {\n const lo = array[0],\n hi = peek(array),\n f = +frac;\n return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);\n}\n","export default function(compare, array0, array1, output) {\n var n0 = array0.length,\n n1 = array1.length;\n\n if (!n1) return array0;\n if (!n0) return array1;\n\n var merged = output || new array0.constructor(n0 + n1),\n i0 = 0, i1 = 0, i = 0;\n\n for (; i0 0\n ? array1[i1++]\n : array0[i0++];\n }\n\n for (; i0= 0) s += str;\n return s;\n}\n","import repeat from './repeat';\n\nexport default function(str, length, padchar, align) {\n var c = padchar || ' ',\n s = str + '',\n n = length - s.length;\n\n return n <= 0 ? s\n : align === 'left' ? repeat(c, n) + s\n : align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2))\n : s + repeat(c, n);\n}\n","import peek from './peek';\n\n/**\n * Return the numerical span of an array: the difference between\n * the last and first values.\n */\nexport default function(array) {\n return array && (peek(array) - array[0]) || 0;\n}\n","export default function(_) {\n return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;\n}\n","import isDate from './isDate';\nimport isNumber from './isNumber';\n\nfunction defaultParser(_) {\n return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);\n}\n\nexport default function(_, parser) {\n parser = parser || defaultParser;\n return _ == null || _ === '' ? null : parser(_);\n}\n","export default function(_) {\n return _ == null || _ === '' ? null : _ + '';\n}\n","export default function(_) {\n for (var s={}, i=0, n=_.length; i 1 ? len - 1 : 0);\n for (var key = 1; key < len; key++) {\n args[key - 1] = arguments[key];\n }\n var argIndex = 0;\n var message = 'Warning: ' +\n format.replace(/%s/g, function() {\n return args[argIndex++];\n });\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n }\n\n warning = function(condition, format, args) {\n var len = arguments.length;\n args = new Array(len > 2 ? len - 2 : 0);\n for (var key = 2; key < len; key++) {\n args[key - 2] = arguments[key];\n }\n if (format === undefined) {\n throw new Error(\n '`warning(condition, format, ...args)` requires a warning ' +\n 'message argument'\n );\n }\n if (!condition) {\n printWarning.apply(null, [format].concat(args));\n }\n };\n}\n\nmodule.exports = warning;\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isRequiredForA11y;\nfunction isRequiredForA11y(validator) {\n return function validate(props, propName, componentName, location, propFullName) {\n var componentNameSafe = componentName || '<>';\n var propFullNameSafe = propFullName || propName;\n\n if (props[propName] == null) {\n return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');\n }\n\n for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n args[_key - 5] = arguments[_key];\n }\n\n return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));\n };\n}\nmodule.exports = exports['default'];","export default typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';\n","import isBrowser from './isBrowser';\n\nconst timeoutDuration = (function(){\n const longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];\n for (let i = 0; i < longerTimeoutBrowsers.length; i += 1) {\n if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {\n return 1;\n }\n }\n return 0;\n}());\n\nexport function microtaskDebounce(fn) {\n let called = false\n return () => {\n if (called) {\n return\n }\n called = true\n window.Promise.resolve().then(() => {\n called = false\n fn()\n })\n }\n}\n\nexport function taskDebounce(fn) {\n let scheduled = false;\n return () => {\n if (!scheduled) {\n scheduled = true;\n setTimeout(() => {\n scheduled = false;\n fn();\n }, timeoutDuration);\n }\n };\n}\n\nconst supportsMicroTasks = isBrowser && window.Promise\n\n\n/**\n* Create a debounced version of a method, that's asynchronously deferred\n* but called in the minimum time possible.\n*\n* @method\n* @memberof Popper.Utils\n* @argument {Function} fn\n* @returns {Function}\n*/\nexport default (supportsMicroTasks\n ? microtaskDebounce\n : taskDebounce);\n","/**\n * Check if the given variable is a function\n * @method\n * @memberof Popper.Utils\n * @argument {Any} functionToCheck - variable to check\n * @returns {Boolean} answer to: is a function?\n */\nexport default function isFunction(functionToCheck) {\n const getType = {};\n return (\n functionToCheck &&\n getType.toString.call(functionToCheck) === '[object Function]'\n );\n}\n","/**\n * Get CSS computed property of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Eement} element\n * @argument {String} property\n */\nexport default function getStyleComputedProperty(element, property) {\n if (element.nodeType !== 1) {\n return [];\n }\n // NOTE: 1 DOM access here\n const window = element.ownerDocument.defaultView;\n const css = window.getComputedStyle(element, null);\n return property ? css[property] : css;\n}\n","/**\n * Returns the parentNode or the host of the element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} parent\n */\nexport default function getParentNode(element) {\n if (element.nodeName === 'HTML') {\n return element;\n }\n return element.parentNode || element.host;\n}\n","import getStyleComputedProperty from './getStyleComputedProperty';\nimport getParentNode from './getParentNode';\n\n/**\n * Returns the scrolling parent of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} scroll parent\n */\nexport default function getScrollParent(element) {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n if (!element) {\n return document.body\n }\n\n switch (element.nodeName) {\n case 'HTML':\n case 'BODY':\n return element.ownerDocument.body\n case '#document':\n return element.body\n }\n\n // Firefox want us to check `-x` and `-y` variations as well\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(element);\n if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {\n return element;\n }\n\n return getScrollParent(getParentNode(element));\n}\n","/**\n * Returns the reference node of the reference object, or the reference object itself.\n * @method\n * @memberof Popper.Utils\n * @param {Element|Object} reference - the reference element (the popper will be relative to this)\n * @returns {Element} parent\n */\nexport default function getReferenceNode(reference) {\n return reference && reference.referenceNode ? reference.referenceNode : reference;\n}\n","import isBrowser from './isBrowser';\n\nconst isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);\nconst isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);\n\n/**\n * Determines if the browser is Internet Explorer\n * @method\n * @memberof Popper.Utils\n * @param {Number} version to check\n * @returns {Boolean} isIE\n */\nexport default function isIE(version) {\n if (version === 11) {\n return isIE11;\n }\n if (version === 10) {\n return isIE10;\n }\n return isIE11 || isIE10;\n}\n","import getStyleComputedProperty from './getStyleComputedProperty';\nimport isIE from './isIE';\n/**\n * Returns the offset parent of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} offset parent\n */\nexport default function getOffsetParent(element) {\n if (!element) {\n return document.documentElement;\n }\n\n const noOffsetParent = isIE(10) ? document.body : null;\n\n // NOTE: 1 DOM access here\n let offsetParent = element.offsetParent || null;\n // Skip hidden elements which don't have an offsetParent\n while (offsetParent === noOffsetParent && element.nextElementSibling) {\n offsetParent = (element = element.nextElementSibling).offsetParent;\n }\n\n const nodeName = offsetParent && offsetParent.nodeName;\n\n if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {\n return element ? element.ownerDocument.documentElement : document.documentElement;\n }\n\n // .offsetParent will return the closest TH, TD or TABLE in case\n // no offsetParent is present, I hate this job...\n if (\n ['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 &&\n getStyleComputedProperty(offsetParent, 'position') === 'static'\n ) {\n return getOffsetParent(offsetParent);\n }\n\n return offsetParent;\n}\n","/**\n * Finds the root node (document, shadowDOM root) of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} node\n * @returns {Element} root node\n */\nexport default function getRoot(node) {\n if (node.parentNode !== null) {\n return getRoot(node.parentNode);\n }\n\n return node;\n}\n","import isOffsetContainer from './isOffsetContainer';\nimport getRoot from './getRoot';\nimport getOffsetParent from './getOffsetParent';\n\n/**\n * Finds the offset parent common to the two provided nodes\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element1\n * @argument {Element} element2\n * @returns {Element} common offset parent\n */\nexport default function findCommonOffsetParent(element1, element2) {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {\n return document.documentElement;\n }\n\n // Here we make sure to give as \"start\" the element that comes first in the DOM\n const order =\n element1.compareDocumentPosition(element2) &\n Node.DOCUMENT_POSITION_FOLLOWING;\n const start = order ? element1 : element2;\n const end = order ? element2 : element1;\n\n // Get common ancestor container\n const range = document.createRange();\n range.setStart(start, 0);\n range.setEnd(end, 0);\n const { commonAncestorContainer } = range;\n\n // Both nodes are inside #document\n if (\n (element1 !== commonAncestorContainer &&\n element2 !== commonAncestorContainer) ||\n start.contains(end)\n ) {\n if (isOffsetContainer(commonAncestorContainer)) {\n return commonAncestorContainer;\n }\n\n return getOffsetParent(commonAncestorContainer);\n }\n\n // one of the nodes is inside shadowDOM, find which one\n const element1root = getRoot(element1);\n if (element1root.host) {\n return findCommonOffsetParent(element1root.host, element2);\n } else {\n return findCommonOffsetParent(element1, getRoot(element2).host);\n }\n}\n","import getOffsetParent from './getOffsetParent';\n\nexport default function isOffsetContainer(element) {\n const { nodeName } = element;\n if (nodeName === 'BODY') {\n return false;\n }\n return (\n nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element\n );\n}\n","/**\n * Gets the scroll value of the given element in the given side (top and left)\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @argument {String} side `top` or `left`\n * @returns {number} amount of scrolled pixels\n */\nexport default function getScroll(element, side = 'top') {\n const upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';\n const nodeName = element.nodeName;\n\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n const html = element.ownerDocument.documentElement;\n const scrollingElement = element.ownerDocument.scrollingElement || html;\n return scrollingElement[upperSide];\n }\n\n return element[upperSide];\n}\n","import getScroll from './getScroll';\n\n/*\n * Sum or subtract the element scroll values (left and top) from a given rect object\n * @method\n * @memberof Popper.Utils\n * @param {Object} rect - Rect object you want to change\n * @param {HTMLElement} element - The element from the function reads the scroll values\n * @param {Boolean} subtract - set to true if you want to subtract the scroll values\n * @return {Object} rect - The modifier rect object\n */\nexport default function includeScroll(rect, element, subtract = false) {\n const scrollTop = getScroll(element, 'top');\n const scrollLeft = getScroll(element, 'left');\n const modifier = subtract ? -1 : 1;\n rect.top += scrollTop * modifier;\n rect.bottom += scrollTop * modifier;\n rect.left += scrollLeft * modifier;\n rect.right += scrollLeft * modifier;\n return rect;\n}\n","/*\n * Helper to detect borders of a given element\n * @method\n * @memberof Popper.Utils\n * @param {CSSStyleDeclaration} styles\n * Result of `getStyleComputedProperty` on the given element\n * @param {String} axis - `x` or `y`\n * @return {number} borders - The borders size of the given axis\n */\n\nexport default function getBordersSize(styles, axis) {\n const sideA = axis === 'x' ? 'Left' : 'Top';\n const sideB = sideA === 'Left' ? 'Right' : 'Bottom';\n\n return (\n parseFloat(styles[`border${sideA}Width`], 10) +\n parseFloat(styles[`border${sideB}Width`], 10)\n );\n}\n","import isIE from './isIE';\n\nfunction getSize(axis, body, html, computedStyle) {\n return Math.max(\n body[`offset${axis}`],\n body[`scroll${axis}`],\n html[`client${axis}`],\n html[`offset${axis}`],\n html[`scroll${axis}`],\n isIE(10)\n ? (parseInt(html[`offset${axis}`]) + \n parseInt(computedStyle[`margin${axis === 'Height' ? 'Top' : 'Left'}`]) + \n parseInt(computedStyle[`margin${axis === 'Height' ? 'Bottom' : 'Right'}`]))\n : 0 \n );\n}\n\nexport default function getWindowSizes(document) {\n const body = document.body;\n const html = document.documentElement;\n const computedStyle = isIE(10) && getComputedStyle(html);\n\n return {\n height: getSize('Height', body, html, computedStyle),\n width: getSize('Width', body, html, computedStyle),\n };\n}\n","/**\n * Given element offsets, generate an output similar to getBoundingClientRect\n * @method\n * @memberof Popper.Utils\n * @argument {Object} offsets\n * @returns {Object} ClientRect like output\n */\nexport default function getClientRect(offsets) {\n return {\n ...offsets,\n right: offsets.left + offsets.width,\n bottom: offsets.top + offsets.height,\n };\n}\n","import getStyleComputedProperty from './getStyleComputedProperty';\nimport getBordersSize from './getBordersSize';\nimport getWindowSizes from './getWindowSizes';\nimport getScroll from './getScroll';\nimport getClientRect from './getClientRect';\nimport isIE from './isIE';\n\n/**\n * Get bounding client rect of given element\n * @method\n * @memberof Popper.Utils\n * @param {HTMLElement} element\n * @return {Object} client rect\n */\nexport default function getBoundingClientRect(element) {\n let rect = {};\n\n // IE10 10 FIX: Please, don't ask, the element isn't\n // considered in DOM in some circumstances...\n // This isn't reproducible in IE10 compatibility mode of IE11\n try {\n if (isIE(10)) {\n rect = element.getBoundingClientRect();\n const scrollTop = getScroll(element, 'top');\n const scrollLeft = getScroll(element, 'left');\n rect.top += scrollTop;\n rect.left += scrollLeft;\n rect.bottom += scrollTop;\n rect.right += scrollLeft;\n }\n else {\n rect = element.getBoundingClientRect();\n }\n }\n catch(e){}\n\n const result = {\n left: rect.left,\n top: rect.top,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n\n // subtract scrollbar size from sizes\n const sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};\n const width =\n sizes.width || element.clientWidth || result.width;\n const height =\n sizes.height || element.clientHeight || result.height;\n\n let horizScrollbar = element.offsetWidth - width;\n let vertScrollbar = element.offsetHeight - height;\n\n // if an hypothetical scrollbar is detected, we must be sure it's not a `border`\n // we make this check conditional for performance reasons\n if (horizScrollbar || vertScrollbar) {\n const styles = getStyleComputedProperty(element);\n horizScrollbar -= getBordersSize(styles, 'x');\n vertScrollbar -= getBordersSize(styles, 'y');\n\n result.width -= horizScrollbar;\n result.height -= vertScrollbar;\n }\n\n return getClientRect(result);\n}\n","import getStyleComputedProperty from './getStyleComputedProperty';\nimport includeScroll from './includeScroll';\nimport getScrollParent from './getScrollParent';\nimport getBoundingClientRect from './getBoundingClientRect';\nimport runIsIE from './isIE';\nimport getClientRect from './getClientRect';\n\nexport default function getOffsetRectRelativeToArbitraryNode(children, parent, fixedPosition = false) {\n const isIE10 = runIsIE(10);\n const isHTML = parent.nodeName === 'HTML';\n const childrenRect = getBoundingClientRect(children);\n const parentRect = getBoundingClientRect(parent);\n const scrollParent = getScrollParent(children);\n\n const styles = getStyleComputedProperty(parent);\n const borderTopWidth = parseFloat(styles.borderTopWidth, 10);\n const borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);\n\n // In cases where the parent is fixed, we must ignore negative scroll in offset calc\n if(fixedPosition && isHTML) {\n parentRect.top = Math.max(parentRect.top, 0);\n parentRect.left = Math.max(parentRect.left, 0);\n }\n let offsets = getClientRect({\n top: childrenRect.top - parentRect.top - borderTopWidth,\n left: childrenRect.left - parentRect.left - borderLeftWidth,\n width: childrenRect.width,\n height: childrenRect.height,\n });\n offsets.marginTop = 0;\n offsets.marginLeft = 0;\n\n // Subtract margins of documentElement in case it's being used as parent\n // we do this only on HTML because it's the only element that behaves\n // differently when margins are applied to it. The margins are included in\n // the box of the documentElement, in the other cases not.\n if (!isIE10 && isHTML) {\n const marginTop = parseFloat(styles.marginTop, 10);\n const marginLeft = parseFloat(styles.marginLeft, 10);\n\n offsets.top -= borderTopWidth - marginTop;\n offsets.bottom -= borderTopWidth - marginTop;\n offsets.left -= borderLeftWidth - marginLeft;\n offsets.right -= borderLeftWidth - marginLeft;\n\n // Attach marginTop and marginLeft because in some circumstances we may need them\n offsets.marginTop = marginTop;\n offsets.marginLeft = marginLeft;\n }\n\n if (\n isIE10 && !fixedPosition\n ? parent.contains(scrollParent)\n : parent === scrollParent && scrollParent.nodeName !== 'BODY'\n ) {\n offsets = includeScroll(offsets, parent);\n }\n\n return offsets;\n}\n","import getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';\nimport getScroll from './getScroll';\nimport getClientRect from './getClientRect';\n\nexport default function getViewportOffsetRectRelativeToArtbitraryNode(element, excludeScroll = false) {\n const html = element.ownerDocument.documentElement;\n const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);\n const width = Math.max(html.clientWidth, window.innerWidth || 0);\n const height = Math.max(html.clientHeight, window.innerHeight || 0);\n\n const scrollTop = !excludeScroll ? getScroll(html) : 0;\n const scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;\n\n const offset = {\n top: scrollTop - relativeOffset.top + relativeOffset.marginTop,\n left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,\n width,\n height,\n };\n\n return getClientRect(offset);\n}\n","import getStyleComputedProperty from './getStyleComputedProperty';\nimport getParentNode from './getParentNode';\n\n/**\n * Check if the given element is fixed or is inside a fixed parent\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @argument {Element} customContainer\n * @returns {Boolean} answer to \"isFixed?\"\n */\nexport default function isFixed(element) {\n const nodeName = element.nodeName;\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n return false;\n }\n if (getStyleComputedProperty(element, 'position') === 'fixed') {\n return true;\n }\n const parentNode = getParentNode(element);\n if (!parentNode) {\n return false;\n }\n return isFixed(parentNode);\n}\n","import getStyleComputedProperty from './getStyleComputedProperty';\nimport isIE from './isIE';\n/**\n * Finds the first parent of an element that has a transformed property defined\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} first transformed parent or documentElement\n */\n\nexport default function getFixedPositionOffsetParent(element) {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element || !element.parentElement || isIE()) {\n return document.documentElement;\n }\n let el = element.parentElement;\n while (el && getStyleComputedProperty(el, 'transform') === 'none') {\n el = el.parentElement;\n }\n return el || document.documentElement;\n\n}\n","import getScrollParent from './getScrollParent';\nimport getParentNode from './getParentNode';\nimport getReferenceNode from './getReferenceNode';\nimport findCommonOffsetParent from './findCommonOffsetParent';\nimport getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';\nimport getViewportOffsetRectRelativeToArtbitraryNode from './getViewportOffsetRectRelativeToArtbitraryNode';\nimport getWindowSizes from './getWindowSizes';\nimport isFixed from './isFixed';\nimport getFixedPositionOffsetParent from './getFixedPositionOffsetParent';\n\n/**\n * Computed the boundaries limits and return them\n * @method\n * @memberof Popper.Utils\n * @param {HTMLElement} popper\n * @param {HTMLElement} reference\n * @param {number} padding\n * @param {HTMLElement} boundariesElement - Element used to define the boundaries\n * @param {Boolean} fixedPosition - Is in fixed position mode\n * @returns {Object} Coordinates of the boundaries\n */\nexport default function getBoundaries(\n popper,\n reference,\n padding,\n boundariesElement,\n fixedPosition = false\n) {\n // NOTE: 1 DOM access here\n\n let boundaries = { top: 0, left: 0 };\n const offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));\n\n // Handle viewport case\n if (boundariesElement === 'viewport' ) {\n boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);\n }\n\n else {\n // Handle other cases based on DOM element used as boundaries\n let boundariesNode;\n if (boundariesElement === 'scrollParent') {\n boundariesNode = getScrollParent(getParentNode(reference));\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = popper.ownerDocument.documentElement;\n }\n } else if (boundariesElement === 'window') {\n boundariesNode = popper.ownerDocument.documentElement;\n } else {\n boundariesNode = boundariesElement;\n }\n\n const offsets = getOffsetRectRelativeToArbitraryNode(\n boundariesNode,\n offsetParent,\n fixedPosition\n );\n\n // In case of HTML, we need a different computation\n if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {\n const { height, width } = getWindowSizes(popper.ownerDocument);\n boundaries.top += offsets.top - offsets.marginTop;\n boundaries.bottom = height + offsets.top;\n boundaries.left += offsets.left - offsets.marginLeft;\n boundaries.right = width + offsets.left;\n } else {\n // for all the other DOM elements, this one is good\n boundaries = offsets;\n }\n }\n\n // Add paddings\n padding = padding || 0;\n const isPaddingNumber = typeof padding === 'number';\n boundaries.left += isPaddingNumber ? padding : padding.left || 0; \n boundaries.top += isPaddingNumber ? padding : padding.top || 0; \n boundaries.right -= isPaddingNumber ? padding : padding.right || 0; \n boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; \n\n return boundaries;\n}\n","import getBoundaries from '../utils/getBoundaries';\n\nfunction getArea({ width, height }) {\n return width * height;\n}\n\n/**\n * Utility used to transform the `auto` placement to the placement with more\n * available space.\n * @method\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function computeAutoPlacement(\n placement,\n refRect,\n popper,\n reference,\n boundariesElement,\n padding = 0\n) {\n if (placement.indexOf('auto') === -1) {\n return placement;\n }\n\n const boundaries = getBoundaries(\n popper,\n reference,\n padding,\n boundariesElement\n );\n\n const rects = {\n top: {\n width: boundaries.width,\n height: refRect.top - boundaries.top,\n },\n right: {\n width: boundaries.right - refRect.right,\n height: boundaries.height,\n },\n bottom: {\n width: boundaries.width,\n height: boundaries.bottom - refRect.bottom,\n },\n left: {\n width: refRect.left - boundaries.left,\n height: boundaries.height,\n },\n };\n\n const sortedAreas = Object.keys(rects)\n .map(key => ({\n key,\n ...rects[key],\n area: getArea(rects[key]),\n }))\n .sort((a, b) => b.area - a.area);\n\n const filteredAreas = sortedAreas.filter(\n ({ width, height }) =>\n width >= popper.clientWidth && height >= popper.clientHeight\n );\n\n const computedPlacement = filteredAreas.length > 0\n ? filteredAreas[0].key\n : sortedAreas[0].key;\n\n const variation = placement.split('-')[1];\n\n return computedPlacement + (variation ? `-${variation}` : '');\n}\n","import findCommonOffsetParent from './findCommonOffsetParent';\nimport getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';\nimport getFixedPositionOffsetParent from './getFixedPositionOffsetParent';\nimport getReferenceNode from './getReferenceNode';\n\n/**\n * Get offsets to the reference element\n * @method\n * @memberof Popper.Utils\n * @param {Object} state\n * @param {Element} popper - the popper element\n * @param {Element} reference - the reference element (the popper will be relative to this)\n * @param {Element} fixedPosition - is in fixed position mode\n * @returns {Object} An object containing the offsets which will be applied to the popper\n */\nexport default function getReferenceOffsets(state, popper, reference, fixedPosition = null) {\n const commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));\n return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);\n}\n","/**\n * Get the outer sizes of the given element (offset size + margins)\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Object} object containing width and height properties\n */\nexport default function getOuterSizes(element) {\n const window = element.ownerDocument.defaultView;\n const styles = window.getComputedStyle(element);\n const x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);\n const y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);\n const result = {\n width: element.offsetWidth + y,\n height: element.offsetHeight + x,\n };\n return result;\n}\n","/**\n * Get the opposite placement of the given one\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement\n * @returns {String} flipped placement\n */\nexport default function getOppositePlacement(placement) {\n const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };\n return placement.replace(/left|right|bottom|top/g, matched => hash[matched]);\n}\n","import getOuterSizes from './getOuterSizes';\nimport getOppositePlacement from './getOppositePlacement';\n\n/**\n * Get offsets to the popper\n * @method\n * @memberof Popper.Utils\n * @param {Object} position - CSS position the Popper will get applied\n * @param {HTMLElement} popper - the popper element\n * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)\n * @param {String} placement - one of the valid placement options\n * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper\n */\nexport default function getPopperOffsets(popper, referenceOffsets, placement) {\n placement = placement.split('-')[0];\n\n // Get popper node sizes\n const popperRect = getOuterSizes(popper);\n\n // Add position, width and height to our offsets object\n const popperOffsets = {\n width: popperRect.width,\n height: popperRect.height,\n };\n\n // depending by the popper placement we have to compute its offsets slightly differently\n const isHoriz = ['right', 'left'].indexOf(placement) !== -1;\n const mainSide = isHoriz ? 'top' : 'left';\n const secondarySide = isHoriz ? 'left' : 'top';\n const measurement = isHoriz ? 'height' : 'width';\n const secondaryMeasurement = !isHoriz ? 'height' : 'width';\n\n popperOffsets[mainSide] =\n referenceOffsets[mainSide] +\n referenceOffsets[measurement] / 2 -\n popperRect[measurement] / 2;\n if (placement === secondarySide) {\n popperOffsets[secondarySide] =\n referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];\n } else {\n popperOffsets[secondarySide] =\n referenceOffsets[getOppositePlacement(secondarySide)];\n }\n\n return popperOffsets;\n}\n","/**\n * Mimics the `find` method of Array\n * @method\n * @memberof Popper.Utils\n * @argument {Array} arr\n * @argument prop\n * @argument value\n * @returns index or -1\n */\nexport default function find(arr, check) {\n // use native find if supported\n if (Array.prototype.find) {\n return arr.find(check);\n }\n\n // use `filter` to obtain the same behavior of `find`\n return arr.filter(check)[0];\n}\n","import isFunction from './isFunction';\nimport findIndex from './findIndex';\nimport getClientRect from '../utils/getClientRect';\n\n/**\n * Loop trough the list of modifiers and run them in order,\n * each of them will then edit the data object.\n * @method\n * @memberof Popper.Utils\n * @param {dataObject} data\n * @param {Array} modifiers\n * @param {String} ends - Optional modifier name used as stopper\n * @returns {dataObject}\n */\nexport default function runModifiers(modifiers, data, ends) {\n const modifiersToRun = ends === undefined\n ? modifiers\n : modifiers.slice(0, findIndex(modifiers, 'name', ends));\n\n modifiersToRun.forEach(modifier => {\n if (modifier['function']) { // eslint-disable-line dot-notation\n console.warn('`modifier.function` is deprecated, use `modifier.fn`!');\n }\n const fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation\n if (modifier.enabled && isFunction(fn)) {\n // Add properties to offsets to make them a complete clientRect object\n // we do this before each modifier to make sure the previous one doesn't\n // mess with these values\n data.offsets.popper = getClientRect(data.offsets.popper);\n data.offsets.reference = getClientRect(data.offsets.reference);\n\n data = fn(data, modifier);\n }\n });\n\n return data;\n}\n","import find from './find';\n\n/**\n * Return the index of the matching object\n * @method\n * @memberof Popper.Utils\n * @argument {Array} arr\n * @argument prop\n * @argument value\n * @returns index or -1\n */\nexport default function findIndex(arr, prop, value) {\n // use native findIndex if supported\n if (Array.prototype.findIndex) {\n return arr.findIndex(cur => cur[prop] === value);\n }\n\n // use `find` + `indexOf` if `findIndex` isn't supported\n const match = find(arr, obj => obj[prop] === value);\n return arr.indexOf(match);\n}\n","import computeAutoPlacement from '../utils/computeAutoPlacement';\nimport getReferenceOffsets from '../utils/getReferenceOffsets';\nimport getPopperOffsets from '../utils/getPopperOffsets';\nimport runModifiers from '../utils/runModifiers';\n\n/**\n * Updates the position of the popper, computing the new offsets and applying\n * the new style.
\n * Prefer `scheduleUpdate` over `update` because of performance reasons.\n * @method\n * @memberof Popper\n */\nexport default function update() {\n // if popper is destroyed, don't perform any further update\n if (this.state.isDestroyed) {\n return;\n }\n\n let data = {\n instance: this,\n styles: {},\n arrowStyles: {},\n attributes: {},\n flipped: false,\n offsets: {},\n };\n\n // compute reference element offsets\n data.offsets.reference = getReferenceOffsets(\n this.state,\n this.popper,\n this.reference,\n this.options.positionFixed\n );\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n data.placement = computeAutoPlacement(\n this.options.placement,\n data.offsets.reference,\n this.popper,\n this.reference,\n this.options.modifiers.flip.boundariesElement,\n this.options.modifiers.flip.padding\n );\n\n // store the computed placement inside `originalPlacement`\n data.originalPlacement = data.placement;\n\n data.positionFixed = this.options.positionFixed;\n\n // compute the popper offsets\n data.offsets.popper = getPopperOffsets(\n this.popper,\n data.offsets.reference,\n data.placement\n );\n\n data.offsets.popper.position = this.options.positionFixed\n ? 'fixed'\n : 'absolute';\n\n // run the modifiers\n data = runModifiers(this.modifiers, data);\n\n // the first `update` will call `onCreate` callback\n // the other ones will call `onUpdate` callback\n if (!this.state.isCreated) {\n this.state.isCreated = true;\n this.options.onCreate(data);\n } else {\n this.options.onUpdate(data);\n }\n}\n","/**\n * Helper used to know if the given modifier is enabled.\n * @method\n * @memberof Popper.Utils\n * @returns {Boolean}\n */\nexport default function isModifierEnabled(modifiers, modifierName) {\n return modifiers.some(\n ({ name, enabled }) => enabled && name === modifierName\n );\n}\n","/**\n * Get the prefixed supported property name\n * @method\n * @memberof Popper.Utils\n * @argument {String} property (camelCase)\n * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)\n */\nexport default function getSupportedPropertyName(property) {\n const prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];\n const upperProp = property.charAt(0).toUpperCase() + property.slice(1);\n\n for (let i = 0; i < prefixes.length; i++) {\n const prefix = prefixes[i];\n const toCheck = prefix ? `${prefix}${upperProp}` : property;\n if (typeof document.body.style[toCheck] !== 'undefined') {\n return toCheck;\n }\n }\n return null;\n}\n","import isModifierEnabled from '../utils/isModifierEnabled';\nimport getSupportedPropertyName from '../utils/getSupportedPropertyName';\n\n/**\n * Destroys the popper.\n * @method\n * @memberof Popper\n */\nexport default function destroy() {\n this.state.isDestroyed = true;\n\n // touch DOM only if `applyStyle` modifier is enabled\n if (isModifierEnabled(this.modifiers, 'applyStyle')) {\n this.popper.removeAttribute('x-placement');\n this.popper.style.position = '';\n this.popper.style.top = '';\n this.popper.style.left = '';\n this.popper.style.right = '';\n this.popper.style.bottom = '';\n this.popper.style.willChange = '';\n this.popper.style[getSupportedPropertyName('transform')] = '';\n }\n\n this.disableEventListeners();\n\n // remove the popper if user explicitly asked for the deletion on destroy\n // do not use `remove` because IE11 doesn't support it\n if (this.options.removeOnDestroy) {\n this.popper.parentNode.removeChild(this.popper);\n }\n return this;\n}\n","/**\n * Get the window associated with the element\n * @argument {Element} element\n * @returns {Window}\n */\nexport default function getWindow(element) {\n const ownerDocument = element.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView : window;\n}\n","import getScrollParent from './getScrollParent';\nimport getWindow from './getWindow';\n\nfunction attachToScrollParents(scrollParent, event, callback, scrollParents) {\n const isBody = scrollParent.nodeName === 'BODY';\n const target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;\n target.addEventListener(event, callback, { passive: true });\n\n if (!isBody) {\n attachToScrollParents(\n getScrollParent(target.parentNode),\n event,\n callback,\n scrollParents\n );\n }\n scrollParents.push(target);\n}\n\n/**\n * Setup needed event listeners used to update the popper position\n * @method\n * @memberof Popper.Utils\n * @private\n */\nexport default function setupEventListeners(\n reference,\n options,\n state,\n updateBound\n) {\n // Resize event listener on window\n state.updateBound = updateBound;\n getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });\n\n // Scroll event listener on scroll parents\n const scrollElement = getScrollParent(reference);\n attachToScrollParents(\n scrollElement,\n 'scroll',\n state.updateBound,\n state.scrollParents\n );\n state.scrollElement = scrollElement;\n state.eventsEnabled = true;\n\n return state;\n}\n","import setupEventListeners from '../utils/setupEventListeners';\n\n/**\n * It will add resize/scroll events and start recalculating\n * position of the popper element when they are triggered.\n * @method\n * @memberof Popper\n */\nexport default function enableEventListeners() {\n if (!this.state.eventsEnabled) {\n this.state = setupEventListeners(\n this.reference,\n this.options,\n this.state,\n this.scheduleUpdate\n );\n }\n}\n","import removeEventListeners from '../utils/removeEventListeners';\n\n/**\n * It will remove resize/scroll events and won't recalculate popper position\n * when they are triggered. It also won't trigger `onUpdate` callback anymore,\n * unless you call `update` method manually.\n * @method\n * @memberof Popper\n */\nexport default function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}\n","import getWindow from './getWindow';\n\n/**\n * Remove event listeners used to update the popper position\n * @method\n * @memberof Popper.Utils\n * @private\n */\nexport default function removeEventListeners(reference, state) {\n // Remove resize event listener on window\n getWindow(reference).removeEventListener('resize', state.updateBound);\n\n // Remove scroll event listener on scroll parents\n state.scrollParents.forEach(target => {\n target.removeEventListener('scroll', state.updateBound);\n });\n\n // Reset state\n state.updateBound = null;\n state.scrollParents = [];\n state.scrollElement = null;\n state.eventsEnabled = false;\n return state;\n}\n","/**\n * Tells if a given input is a number\n * @method\n * @memberof Popper.Utils\n * @param {*} input to check\n * @return {Boolean}\n */\nexport default function isNumeric(n) {\n return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);\n}\n","import isNumeric from './isNumeric';\n\n/**\n * Set the style to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the style to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nexport default function setStyles(element, styles) {\n Object.keys(styles).forEach(prop => {\n let unit = '';\n // add unit if the value is numeric and is one of the following\n if (\n ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==\n -1 &&\n isNumeric(styles[prop])\n ) {\n unit = 'px';\n }\n element.style[prop] = styles[prop] + unit;\n });\n}\n","import getSupportedPropertyName from '../utils/getSupportedPropertyName';\nimport find from '../utils/find';\nimport getOffsetParent from '../utils/getOffsetParent';\nimport getBoundingClientRect from '../utils/getBoundingClientRect';\nimport getRoundedOffsets from '../utils/getRoundedOffsets';\nimport isBrowser from '../utils/isBrowser';\n\nconst isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function computeStyle(data, options) {\n const { x, y } = options;\n const { popper } = data.offsets;\n\n // Remove this legacy support in Popper.js v2\n const legacyGpuAccelerationOption = find(\n data.instance.modifiers,\n modifier => modifier.name === 'applyStyle'\n ).gpuAcceleration;\n if (legacyGpuAccelerationOption !== undefined) {\n console.warn(\n 'WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'\n );\n }\n const gpuAcceleration =\n legacyGpuAccelerationOption !== undefined\n ? legacyGpuAccelerationOption\n : options.gpuAcceleration;\n\n const offsetParent = getOffsetParent(data.instance.popper);\n const offsetParentRect = getBoundingClientRect(offsetParent);\n\n // Styles\n const styles = {\n position: popper.position,\n };\n\n const offsets = getRoundedOffsets(\n data,\n window.devicePixelRatio < 2 || !isFirefox\n );\n\n const sideA = x === 'bottom' ? 'top' : 'bottom';\n const sideB = y === 'right' ? 'left' : 'right';\n\n // if gpuAcceleration is set to `true` and transform is supported,\n // we use `translate3d` to apply the position to the popper we\n // automatically use the supported prefixed version if needed\n const prefixedProperty = getSupportedPropertyName('transform');\n\n // now, let's make a step back and look at this code closely (wtf?)\n // If the content of the popper grows once it's been positioned, it\n // may happen that the popper gets misplaced because of the new content\n // overflowing its reference element\n // To avoid this problem, we provide two options (x and y), which allow\n // the consumer to define the offset origin.\n // If we position a popper on top of a reference element, we can set\n // `x` to `top` to make the popper grow towards its top instead of\n // its bottom.\n let left, top;\n if (sideA === 'bottom') {\n // when offsetParent is the positioning is relative to the bottom of the screen (excluding the scrollbar)\n // and not the bottom of the html element\n if (offsetParent.nodeName === 'HTML') {\n top = -offsetParent.clientHeight + offsets.bottom;\n } else {\n top = -offsetParentRect.height + offsets.bottom;\n }\n } else {\n top = offsets.top;\n }\n if (sideB === 'right') {\n if (offsetParent.nodeName === 'HTML') {\n left = -offsetParent.clientWidth + offsets.right;\n } else {\n left = -offsetParentRect.width + offsets.right;\n }\n } else {\n left = offsets.left;\n }\n if (gpuAcceleration && prefixedProperty) {\n styles[prefixedProperty] = `translate3d(${left}px, ${top}px, 0)`;\n styles[sideA] = 0;\n styles[sideB] = 0;\n styles.willChange = 'transform';\n } else {\n // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties\n const invertTop = sideA === 'bottom' ? -1 : 1;\n const invertLeft = sideB === 'right' ? -1 : 1;\n styles[sideA] = top * invertTop;\n styles[sideB] = left * invertLeft;\n styles.willChange = `${sideA}, ${sideB}`;\n }\n\n // Attributes\n const attributes = {\n 'x-placement': data.placement,\n };\n\n // Update `data` attributes, styles and arrowStyles\n data.attributes = { ...attributes, ...data.attributes };\n data.styles = { ...styles, ...data.styles };\n data.arrowStyles = { ...data.offsets.arrow, ...data.arrowStyles };\n\n return data;\n}\n","import find from './find';\n\n/**\n * Helper used to know if the given modifier depends from another one.
\n * It checks if the needed modifier is listed and enabled.\n * @method\n * @memberof Popper.Utils\n * @param {Array} modifiers - list of modifiers\n * @param {String} requestingName - name of requesting modifier\n * @param {String} requestedName - name of requested modifier\n * @returns {Boolean}\n */\nexport default function isModifierRequired(\n modifiers,\n requestingName,\n requestedName\n) {\n const requesting = find(modifiers, ({ name }) => name === requestingName);\n\n const isRequired =\n !!requesting &&\n modifiers.some(modifier => {\n return (\n modifier.name === requestedName &&\n modifier.enabled &&\n modifier.order < requesting.order\n );\n });\n\n if (!isRequired) {\n const requesting = `\\`${requestingName}\\``;\n const requested = `\\`${requestedName}\\``;\n console.warn(\n `${requested} modifier is required by ${requesting} modifier in order to work, be sure to include it before ${requesting}!`\n );\n }\n return isRequired;\n}\n","/**\n * List of accepted placements to use as values of the `placement` option.
\n * Valid placements are:\n * - `auto`\n * - `top`\n * - `right`\n * - `bottom`\n * - `left`\n *\n * Each placement can have a variation from this list:\n * - `-start`\n * - `-end`\n *\n * Variations are interpreted easily if you think of them as the left to right\n * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`\n * is right.
\n * Vertically (`left` and `right`), `start` is top and `end` is bottom.\n *\n * Some valid examples are:\n * - `top-end` (on top of reference, right aligned)\n * - `right-start` (on right of reference, top aligned)\n * - `bottom` (on bottom, centered)\n * - `auto-end` (on the side with more space available, alignment depends by placement)\n *\n * @static\n * @type {Array}\n * @enum {String}\n * @readonly\n * @method placements\n * @memberof Popper\n */\nexport default [\n 'auto-start',\n 'auto',\n 'auto-end',\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n","import placements from '../methods/placements';\n\n// Get rid of `auto` `auto-start` and `auto-end`\nconst validPlacements = placements.slice(3);\n\n/**\n * Given an initial placement, returns all the subsequent placements\n * clockwise (or counter-clockwise).\n *\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement - A valid placement (it accepts variations)\n * @argument {Boolean} counter - Set to true to walk the placements counterclockwise\n * @returns {Array} placements including their variations\n */\nexport default function clockwise(placement, counter = false) {\n const index = validPlacements.indexOf(placement);\n const arr = validPlacements\n .slice(index + 1)\n .concat(validPlacements.slice(0, index));\n return counter ? arr.reverse() : arr;\n}\n","import getOppositePlacement from '../utils/getOppositePlacement';\nimport getOppositeVariation from '../utils/getOppositeVariation';\nimport getPopperOffsets from '../utils/getPopperOffsets';\nimport runModifiers from '../utils/runModifiers';\nimport getBoundaries from '../utils/getBoundaries';\nimport isModifierEnabled from '../utils/isModifierEnabled';\nimport clockwise from '../utils/clockwise';\n\nconst BEHAVIORS = {\n FLIP: 'flip',\n CLOCKWISE: 'clockwise',\n COUNTERCLOCKWISE: 'counterclockwise',\n};\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function flip(data, options) {\n // if `inner` modifier is enabled, we can't use the `flip` modifier\n if (isModifierEnabled(data.instance.modifiers, 'inner')) {\n return data;\n }\n\n if (data.flipped && data.placement === data.originalPlacement) {\n // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides\n return data;\n }\n\n const boundaries = getBoundaries(\n data.instance.popper,\n data.instance.reference,\n options.padding,\n options.boundariesElement,\n data.positionFixed\n );\n\n let placement = data.placement.split('-')[0];\n let placementOpposite = getOppositePlacement(placement);\n let variation = data.placement.split('-')[1] || '';\n\n let flipOrder = [];\n\n switch (options.behavior) {\n case BEHAVIORS.FLIP:\n flipOrder = [placement, placementOpposite];\n break;\n case BEHAVIORS.CLOCKWISE:\n flipOrder = clockwise(placement);\n break;\n case BEHAVIORS.COUNTERCLOCKWISE:\n flipOrder = clockwise(placement, true);\n break;\n default:\n flipOrder = options.behavior;\n }\n\n flipOrder.forEach((step, index) => {\n if (placement !== step || flipOrder.length === index + 1) {\n return data;\n }\n\n placement = data.placement.split('-')[0];\n placementOpposite = getOppositePlacement(placement);\n\n const popperOffsets = data.offsets.popper;\n const refOffsets = data.offsets.reference;\n\n // using floor because the reference offsets may contain decimals we are not going to consider here\n const floor = Math.floor;\n const overlapsRef =\n (placement === 'left' &&\n floor(popperOffsets.right) > floor(refOffsets.left)) ||\n (placement === 'right' &&\n floor(popperOffsets.left) < floor(refOffsets.right)) ||\n (placement === 'top' &&\n floor(popperOffsets.bottom) > floor(refOffsets.top)) ||\n (placement === 'bottom' &&\n floor(popperOffsets.top) < floor(refOffsets.bottom));\n\n const overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);\n const overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);\n const overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);\n const overflowsBottom =\n floor(popperOffsets.bottom) > floor(boundaries.bottom);\n\n const overflowsBoundaries =\n (placement === 'left' && overflowsLeft) ||\n (placement === 'right' && overflowsRight) ||\n (placement === 'top' && overflowsTop) ||\n (placement === 'bottom' && overflowsBottom);\n\n // flip the variation if required\n const isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n\n // flips variation if reference element overflows boundaries\n const flippedVariationByRef =\n !!options.flipVariations &&\n ((isVertical && variation === 'start' && overflowsLeft) ||\n (isVertical && variation === 'end' && overflowsRight) ||\n (!isVertical && variation === 'start' && overflowsTop) ||\n (!isVertical && variation === 'end' && overflowsBottom));\n\n // flips variation if popper content overflows boundaries\n const flippedVariationByContent =\n !!options.flipVariationsByContent &&\n ((isVertical && variation === 'start' && overflowsRight) ||\n (isVertical && variation === 'end' && overflowsLeft) ||\n (!isVertical && variation === 'start' && overflowsBottom) ||\n (!isVertical && variation === 'end' && overflowsTop));\n\n const flippedVariation = flippedVariationByRef || flippedVariationByContent;\n\n if (overlapsRef || overflowsBoundaries || flippedVariation) {\n // this boolean to detect any flip loop\n data.flipped = true;\n\n if (overlapsRef || overflowsBoundaries) {\n placement = flipOrder[index + 1];\n }\n\n if (flippedVariation) {\n variation = getOppositeVariation(variation);\n }\n\n data.placement = placement + (variation ? '-' + variation : '');\n\n // this object contains `position`, we want to preserve it along with\n // any additional property we may add in the future\n data.offsets.popper = {\n ...data.offsets.popper,\n ...getPopperOffsets(\n data.instance.popper,\n data.offsets.reference,\n data.placement\n ),\n };\n\n data = runModifiers(data.instance.modifiers, data, 'flip');\n }\n });\n return data;\n}\n","import isNumeric from '../utils/isNumeric';\nimport getClientRect from '../utils/getClientRect';\nimport find from '../utils/find';\n\n/**\n * Converts a string containing value + unit into a px value number\n * @function\n * @memberof {modifiers~offset}\n * @private\n * @argument {String} str - Value + unit string\n * @argument {String} measurement - `height` or `width`\n * @argument {Object} popperOffsets\n * @argument {Object} referenceOffsets\n * @returns {Number|String}\n * Value in pixels, or original string if no values were extracted\n */\nexport function toValue(str, measurement, popperOffsets, referenceOffsets) {\n // separate value from unit\n const split = str.match(/((?:\\-|\\+)?\\d*\\.?\\d*)(.*)/);\n const value = +split[1];\n const unit = split[2];\n\n // If it's not a number it's an operator, I guess\n if (!value) {\n return str;\n }\n\n if (unit.indexOf('%') === 0) {\n let element;\n switch (unit) {\n case '%p':\n element = popperOffsets;\n break;\n case '%':\n case '%r':\n default:\n element = referenceOffsets;\n }\n\n const rect = getClientRect(element);\n return rect[measurement] / 100 * value;\n } else if (unit === 'vh' || unit === 'vw') {\n // if is a vh or vw, we calculate the size based on the viewport\n let size;\n if (unit === 'vh') {\n size = Math.max(\n document.documentElement.clientHeight,\n window.innerHeight || 0\n );\n } else {\n size = Math.max(\n document.documentElement.clientWidth,\n window.innerWidth || 0\n );\n }\n return size / 100 * value;\n } else {\n // if is an explicit pixel unit, we get rid of the unit and keep the value\n // if is an implicit unit, it's px, and we return just the value\n return value;\n }\n}\n\n/**\n * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.\n * @function\n * @memberof {modifiers~offset}\n * @private\n * @argument {String} offset\n * @argument {Object} popperOffsets\n * @argument {Object} referenceOffsets\n * @argument {String} basePlacement\n * @returns {Array} a two cells array with x and y offsets in numbers\n */\nexport function parseOffset(\n offset,\n popperOffsets,\n referenceOffsets,\n basePlacement\n) {\n const offsets = [0, 0];\n\n // Use height if placement is left or right and index is 0 otherwise use width\n // in this way the first offset will use an axis and the second one\n // will use the other one\n const useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;\n\n // Split the offset string to obtain a list of values and operands\n // The regex addresses values with the plus or minus sign in front (+10, -20, etc)\n const fragments = offset.split(/(\\+|\\-)/).map(frag => frag.trim());\n\n // Detect if the offset string contains a pair of values or a single one\n // they could be separated by comma or space\n const divider = fragments.indexOf(\n find(fragments, frag => frag.search(/,|\\s/) !== -1)\n );\n\n if (fragments[divider] && fragments[divider].indexOf(',') === -1) {\n console.warn(\n 'Offsets separated by white space(s) are deprecated, use a comma (,) instead.'\n );\n }\n\n // If divider is found, we divide the list of values and operands to divide\n // them by ofset X and Y.\n const splitRegex = /\\s*,\\s*|\\s+/;\n let ops = divider !== -1\n ? [\n fragments\n .slice(0, divider)\n .concat([fragments[divider].split(splitRegex)[0]]),\n [fragments[divider].split(splitRegex)[1]].concat(\n fragments.slice(divider + 1)\n ),\n ]\n : [fragments];\n\n // Convert the values with units to absolute pixels to allow our computations\n ops = ops.map((op, index) => {\n // Most of the units rely on the orientation of the popper\n const measurement = (index === 1 ? !useHeight : useHeight)\n ? 'height'\n : 'width';\n let mergeWithPrevious = false;\n return (\n op\n // This aggregates any `+` or `-` sign that aren't considered operators\n // e.g.: 10 + +5 => [10, +, +5]\n .reduce((a, b) => {\n if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {\n a[a.length - 1] = b;\n mergeWithPrevious = true;\n return a;\n } else if (mergeWithPrevious) {\n a[a.length - 1] += b;\n mergeWithPrevious = false;\n return a;\n } else {\n return a.concat(b);\n }\n }, [])\n // Here we convert the string values into number values (in px)\n .map(str => toValue(str, measurement, popperOffsets, referenceOffsets))\n );\n });\n\n // Loop trough the offsets arrays and execute the operations\n ops.forEach((op, index) => {\n op.forEach((frag, index2) => {\n if (isNumeric(frag)) {\n offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);\n }\n });\n });\n return offsets;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @argument {Number|String} options.offset=0\n * The offset value as described in the modifier description\n * @returns {Object} The data object, properly modified\n */\nexport default function offset(data, { offset }) {\n const { placement, offsets: { popper, reference } } = data;\n const basePlacement = placement.split('-')[0];\n\n let offsets;\n if (isNumeric(+offset)) {\n offsets = [+offset, 0];\n } else {\n offsets = parseOffset(offset, popper, reference, basePlacement);\n }\n\n if (basePlacement === 'left') {\n popper.top += offsets[0];\n popper.left -= offsets[1];\n } else if (basePlacement === 'right') {\n popper.top += offsets[0];\n popper.left += offsets[1];\n } else if (basePlacement === 'top') {\n popper.left += offsets[0];\n popper.top -= offsets[1];\n } else if (basePlacement === 'bottom') {\n popper.left += offsets[0];\n popper.top += offsets[1];\n }\n\n data.popper = popper;\n return data;\n}\n","import applyStyle, { applyStyleOnLoad } from './applyStyle';\nimport computeStyle from './computeStyle';\nimport arrow from './arrow';\nimport flip from './flip';\nimport keepTogether from './keepTogether';\nimport offset from './offset';\nimport preventOverflow from './preventOverflow';\nimport shift from './shift';\nimport hide from './hide';\nimport inner from './inner';\n\n/**\n * Modifier function, each modifier can have a function of this type assigned\n * to its `fn` property.
\n * These functions will be called on each update, this means that you must\n * make sure they are performant enough to avoid performance bottlenecks.\n *\n * @function ModifierFn\n * @argument {dataObject} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {dataObject} The data object, properly modified\n */\n\n/**\n * Modifiers are plugins used to alter the behavior of your poppers.
\n * Popper.js uses a set of 9 modifiers to provide all the basic functionalities\n * needed by the library.\n *\n * Usually you don't want to override the `order`, `fn` and `onLoad` props.\n * All the other properties are configurations that could be tweaked.\n * @namespace modifiers\n */\nexport default {\n /**\n * Modifier used to shift the popper on the start or end of its reference\n * element.
\n * It will read the variation of the `placement` property.
\n * It can be one either `-end` or `-start`.\n * @memberof modifiers\n * @inner\n */\n shift: {\n /** @prop {number} order=100 - Index used to define the order of execution */\n order: 100,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: shift,\n },\n\n /**\n * The `offset` modifier can shift your popper on both its axis.\n *\n * It accepts the following units:\n * - `px` or unit-less, interpreted as pixels\n * - `%` or `%r`, percentage relative to the length of the reference element\n * - `%p`, percentage relative to the length of the popper element\n * - `vw`, CSS viewport width unit\n * - `vh`, CSS viewport height unit\n *\n * For length is intended the main axis relative to the placement of the popper.
\n * This means that if the placement is `top` or `bottom`, the length will be the\n * `width`. In case of `left` or `right`, it will be the `height`.\n *\n * You can provide a single value (as `Number` or `String`), or a pair of values\n * as `String` divided by a comma or one (or more) white spaces.
\n * The latter is a deprecated method because it leads to confusion and will be\n * removed in v2.
\n * Additionally, it accepts additions and subtractions between different units.\n * Note that multiplications and divisions aren't supported.\n *\n * Valid examples are:\n * ```\n * 10\n * '10%'\n * '10, 10'\n * '10%, 10'\n * '10 + 10%'\n * '10 - 5vh + 3%'\n * '-10px + 5vh, 5px - 6%'\n * ```\n * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap\n * > with their reference element, unfortunately, you will have to disable the `flip` modifier.\n * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).\n *\n * @memberof modifiers\n * @inner\n */\n offset: {\n /** @prop {number} order=200 - Index used to define the order of execution */\n order: 200,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: offset,\n /** @prop {Number|String} offset=0\n * The offset value as described in the modifier description\n */\n offset: 0,\n },\n\n /**\n * Modifier used to prevent the popper from being positioned outside the boundary.\n *\n * A scenario exists where the reference itself is not within the boundaries.
\n * We can say it has \"escaped the boundaries\" — or just \"escaped\".
\n * In this case we need to decide whether the popper should either:\n *\n * - detach from the reference and remain \"trapped\" in the boundaries, or\n * - if it should ignore the boundary and \"escape with its reference\"\n *\n * When `escapeWithReference` is set to`true` and reference is completely\n * outside its boundaries, the popper will overflow (or completely leave)\n * the boundaries in order to remain attached to the edge of the reference.\n *\n * @memberof modifiers\n * @inner\n */\n preventOverflow: {\n /** @prop {number} order=300 - Index used to define the order of execution */\n order: 300,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: preventOverflow,\n /**\n * @prop {Array} [priority=['left','right','top','bottom']]\n * Popper will try to prevent overflow following these priorities by default,\n * then, it could overflow on the left and on top of the `boundariesElement`\n */\n priority: ['left', 'right', 'top', 'bottom'],\n /**\n * @prop {number} padding=5\n * Amount of pixel used to define a minimum distance between the boundaries\n * and the popper. This makes sure the popper always has a little padding\n * between the edges of its container\n */\n padding: 5,\n /**\n * @prop {String|HTMLElement} boundariesElement='scrollParent'\n * Boundaries used by the modifier. Can be `scrollParent`, `window`,\n * `viewport` or any DOM element.\n */\n boundariesElement: 'scrollParent',\n },\n\n /**\n * Modifier used to make sure the reference and its popper stay near each other\n * without leaving any gap between the two. Especially useful when the arrow is\n * enabled and you want to ensure that it points to its reference element.\n * It cares only about the first axis. You can still have poppers with margin\n * between the popper and its reference element.\n * @memberof modifiers\n * @inner\n */\n keepTogether: {\n /** @prop {number} order=400 - Index used to define the order of execution */\n order: 400,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: keepTogether,\n },\n\n /**\n * This modifier is used to move the `arrowElement` of the popper to make\n * sure it is positioned between the reference element and its popper element.\n * It will read the outer size of the `arrowElement` node to detect how many\n * pixels of conjunction are needed.\n *\n * It has no effect if no `arrowElement` is provided.\n * @memberof modifiers\n * @inner\n */\n arrow: {\n /** @prop {number} order=500 - Index used to define the order of execution */\n order: 500,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: arrow,\n /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */\n element: '[x-arrow]',\n },\n\n /**\n * Modifier used to flip the popper's placement when it starts to overlap its\n * reference element.\n *\n * Requires the `preventOverflow` modifier before it in order to work.\n *\n * **NOTE:** this modifier will interrupt the current update cycle and will\n * restart it if it detects the need to flip the placement.\n * @memberof modifiers\n * @inner\n */\n flip: {\n /** @prop {number} order=600 - Index used to define the order of execution */\n order: 600,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: flip,\n /**\n * @prop {String|Array} behavior='flip'\n * The behavior used to change the popper's placement. It can be one of\n * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid\n * placements (with optional variations)\n */\n behavior: 'flip',\n /**\n * @prop {number} padding=5\n * The popper will flip if it hits the edges of the `boundariesElement`\n */\n padding: 5,\n /**\n * @prop {String|HTMLElement} boundariesElement='viewport'\n * The element which will define the boundaries of the popper position.\n * The popper will never be placed outside of the defined boundaries\n * (except if `keepTogether` is enabled)\n */\n boundariesElement: 'viewport',\n /**\n * @prop {Boolean} flipVariations=false\n * The popper will switch placement variation between `-start` and `-end` when\n * the reference element overlaps its boundaries.\n *\n * The original placement should have a set variation.\n */\n flipVariations: false,\n /**\n * @prop {Boolean} flipVariationsByContent=false\n * The popper will switch placement variation between `-start` and `-end` when\n * the popper element overlaps its reference boundaries.\n *\n * The original placement should have a set variation.\n */\n flipVariationsByContent: false,\n },\n\n /**\n * Modifier used to make the popper flow toward the inner of the reference element.\n * By default, when this modifier is disabled, the popper will be placed outside\n * the reference element.\n * @memberof modifiers\n * @inner\n */\n inner: {\n /** @prop {number} order=700 - Index used to define the order of execution */\n order: 700,\n /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */\n enabled: false,\n /** @prop {ModifierFn} */\n fn: inner,\n },\n\n /**\n * Modifier used to hide the popper when its reference element is outside of the\n * popper boundaries. It will set a `x-out-of-boundaries` attribute which can\n * be used to hide with a CSS selector the popper when its reference is\n * out of boundaries.\n *\n * Requires the `preventOverflow` modifier before it in order to work.\n * @memberof modifiers\n * @inner\n */\n hide: {\n /** @prop {number} order=800 - Index used to define the order of execution */\n order: 800,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: hide,\n },\n\n /**\n * Computes the style that will be applied to the popper element to gets\n * properly positioned.\n *\n * Note that this modifier will not touch the DOM, it just prepares the styles\n * so that `applyStyle` modifier can apply it. This separation is useful\n * in case you need to replace `applyStyle` with a custom implementation.\n *\n * This modifier has `850` as `order` value to maintain backward compatibility\n * with previous versions of Popper.js. Expect the modifiers ordering method\n * to change in future major versions of the library.\n *\n * @memberof modifiers\n * @inner\n */\n computeStyle: {\n /** @prop {number} order=850 - Index used to define the order of execution */\n order: 850,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: computeStyle,\n /**\n * @prop {Boolean} gpuAcceleration=true\n * If true, it uses the CSS 3D transformation to position the popper.\n * Otherwise, it will use the `top` and `left` properties\n */\n gpuAcceleration: true,\n /**\n * @prop {string} [x='bottom']\n * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.\n * Change this if your popper should grow in a direction different from `bottom`\n */\n x: 'bottom',\n /**\n * @prop {string} [x='left']\n * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.\n * Change this if your popper should grow in a direction different from `right`\n */\n y: 'right',\n },\n\n /**\n * Applies the computed styles to the popper element.\n *\n * All the DOM manipulations are limited to this modifier. This is useful in case\n * you want to integrate Popper.js inside a framework or view library and you\n * want to delegate all the DOM manipulations to it.\n *\n * Note that if you disable this modifier, you must make sure the popper element\n * has its position set to `absolute` before Popper.js can do its work!\n *\n * Just disable this modifier and define your own to achieve the desired effect.\n *\n * @memberof modifiers\n * @inner\n */\n applyStyle: {\n /** @prop {number} order=900 - Index used to define the order of execution */\n order: 900,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: applyStyle,\n /** @prop {Function} */\n onLoad: applyStyleOnLoad,\n /**\n * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier\n * @prop {Boolean} gpuAcceleration=true\n * If true, it uses the CSS 3D transformation to position the popper.\n * Otherwise, it will use the `top` and `left` properties\n */\n gpuAcceleration: undefined,\n },\n};\n\n/**\n * The `dataObject` is an object containing all the information used by Popper.js.\n * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.\n * @name dataObject\n * @property {Object} data.instance The Popper.js instance\n * @property {String} data.placement Placement applied to popper\n * @property {String} data.originalPlacement Placement originally defined on init\n * @property {Boolean} data.flipped True if popper has been flipped by flip modifier\n * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper\n * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier\n * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)\n * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)\n * @property {Object} data.boundaries Offsets of the popper boundaries\n * @property {Object} data.offsets The measurements of popper, reference and arrow elements\n * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values\n * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values\n * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0\n */\n","import modifiers from '../modifiers/index';\n\n/**\n * Default options provided to Popper.js constructor.
\n * These can be overridden using the `options` argument of Popper.js.
\n * To override an option, simply pass an object with the same\n * structure of the `options` object, as the 3rd argument. For example:\n * ```\n * new Popper(ref, pop, {\n * modifiers: {\n * preventOverflow: { enabled: false }\n * }\n * })\n * ```\n * @type {Object}\n * @static\n * @memberof Popper\n */\nexport default {\n /**\n * Popper's placement.\n * @prop {Popper.placements} placement='bottom'\n */\n placement: 'bottom',\n\n /**\n * Set this to true if you want popper to position it self in 'fixed' mode\n * @prop {Boolean} positionFixed=false\n */\n positionFixed: false,\n\n /**\n * Whether events (resize, scroll) are initially enabled.\n * @prop {Boolean} eventsEnabled=true\n */\n eventsEnabled: true,\n\n /**\n * Set to true if you want to automatically remove the popper when\n * you call the `destroy` method.\n * @prop {Boolean} removeOnDestroy=false\n */\n removeOnDestroy: false,\n\n /**\n * Callback called when the popper is created.
\n * By default, it is set to no-op.
\n * Access Popper.js instance with `data.instance`.\n * @prop {onCreate}\n */\n onCreate: () => {},\n\n /**\n * Callback called when the popper is updated. This callback is not called\n * on the initialization/creation of the popper, but only on subsequent\n * updates.
\n * By default, it is set to no-op.
\n * Access Popper.js instance with `data.instance`.\n * @prop {onUpdate}\n */\n onUpdate: () => {},\n\n /**\n * List of modifiers used to modify the offsets before they are applied to the popper.\n * They provide most of the functionalities of Popper.js.\n * @prop {modifiers}\n */\n modifiers,\n};\n\n/**\n * @callback onCreate\n * @param {dataObject} data\n */\n\n/**\n * @callback onUpdate\n * @param {dataObject} data\n */\n","/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function shift(data) {\n const placement = data.placement;\n const basePlacement = placement.split('-')[0];\n const shiftvariation = placement.split('-')[1];\n\n // if shift shiftvariation is specified, run the modifier\n if (shiftvariation) {\n const { reference, popper } = data.offsets;\n const isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;\n const side = isVertical ? 'left' : 'top';\n const measurement = isVertical ? 'width' : 'height';\n\n const shiftOffsets = {\n start: { [side]: reference[side] },\n end: {\n [side]: reference[side] + reference[measurement] - popper[measurement],\n },\n };\n\n data.offsets.popper = { ...popper, ...shiftOffsets[shiftvariation] };\n }\n\n return data;\n}\n","import getOffsetParent from '../utils/getOffsetParent';\nimport getBoundaries from '../utils/getBoundaries';\nimport getSupportedPropertyName from '../utils/getSupportedPropertyName';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function preventOverflow(data, options) {\n let boundariesElement =\n options.boundariesElement || getOffsetParent(data.instance.popper);\n\n // If offsetParent is the reference element, we really want to\n // go one step up and use the next offsetParent as reference to\n // avoid to make this modifier completely useless and look like broken\n if (data.instance.reference === boundariesElement) {\n boundariesElement = getOffsetParent(boundariesElement);\n }\n\n // NOTE: DOM access here\n // resets the popper's position so that the document size can be calculated excluding\n // the size of the popper element itself\n const transformProp = getSupportedPropertyName('transform');\n const popperStyles = data.instance.popper.style; // assignment to help minification\n const { top, left, [transformProp]: transform } = popperStyles;\n popperStyles.top = '';\n popperStyles.left = '';\n popperStyles[transformProp] = '';\n\n const boundaries = getBoundaries(\n data.instance.popper,\n data.instance.reference,\n options.padding,\n boundariesElement,\n data.positionFixed\n );\n\n // NOTE: DOM access here\n // restores the original style properties after the offsets have been computed\n popperStyles.top = top;\n popperStyles.left = left;\n popperStyles[transformProp] = transform;\n\n options.boundaries = boundaries;\n\n const order = options.priority;\n let popper = data.offsets.popper;\n\n const check = {\n primary(placement) {\n let value = popper[placement];\n if (\n popper[placement] < boundaries[placement] &&\n !options.escapeWithReference\n ) {\n value = Math.max(popper[placement], boundaries[placement]);\n }\n return { [placement]: value };\n },\n secondary(placement) {\n const mainSide = placement === 'right' ? 'left' : 'top';\n let value = popper[mainSide];\n if (\n popper[placement] > boundaries[placement] &&\n !options.escapeWithReference\n ) {\n value = Math.min(\n popper[mainSide],\n boundaries[placement] -\n (placement === 'right' ? popper.width : popper.height)\n );\n }\n return { [mainSide]: value };\n },\n };\n\n order.forEach(placement => {\n const side =\n ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';\n popper = { ...popper, ...check[side](placement) };\n });\n\n data.offsets.popper = popper;\n\n return data;\n}\n","/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function keepTogether(data) {\n const { popper, reference } = data.offsets;\n const placement = data.placement.split('-')[0];\n const floor = Math.floor;\n const isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n const side = isVertical ? 'right' : 'bottom';\n const opSide = isVertical ? 'left' : 'top';\n const measurement = isVertical ? 'width' : 'height';\n\n if (popper[side] < floor(reference[opSide])) {\n data.offsets.popper[opSide] =\n floor(reference[opSide]) - popper[measurement];\n }\n if (popper[opSide] > floor(reference[side])) {\n data.offsets.popper[opSide] = floor(reference[side]);\n }\n\n return data;\n}\n","import getClientRect from '../utils/getClientRect';\nimport getOuterSizes from '../utils/getOuterSizes';\nimport isModifierRequired from '../utils/isModifierRequired';\nimport getStyleComputedProperty from '../utils/getStyleComputedProperty';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function arrow(data, options) {\n // arrow depends on keepTogether in order to work\n if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {\n return data;\n }\n\n let arrowElement = options.element;\n\n // if arrowElement is a string, suppose it's a CSS selector\n if (typeof arrowElement === 'string') {\n arrowElement = data.instance.popper.querySelector(arrowElement);\n\n // if arrowElement is not found, don't run the modifier\n if (!arrowElement) {\n return data;\n }\n } else {\n // if the arrowElement isn't a query selector we must check that the\n // provided DOM node is child of its popper node\n if (!data.instance.popper.contains(arrowElement)) {\n console.warn(\n 'WARNING: `arrow.element` must be child of its popper element!'\n );\n return data;\n }\n }\n\n const placement = data.placement.split('-')[0];\n const { popper, reference } = data.offsets;\n const isVertical = ['left', 'right'].indexOf(placement) !== -1;\n\n const len = isVertical ? 'height' : 'width';\n const sideCapitalized = isVertical ? 'Top' : 'Left';\n const side = sideCapitalized.toLowerCase();\n const altSide = isVertical ? 'left' : 'top';\n const opSide = isVertical ? 'bottom' : 'right';\n const arrowElementSize = getOuterSizes(arrowElement)[len];\n\n //\n // extends keepTogether behavior making sure the popper and its\n // reference have enough pixels in conjunction\n //\n\n // top/left side\n if (reference[opSide] - arrowElementSize < popper[side]) {\n data.offsets.popper[side] -=\n popper[side] - (reference[opSide] - arrowElementSize);\n }\n // bottom/right side\n if (reference[side] + arrowElementSize > popper[opSide]) {\n data.offsets.popper[side] +=\n reference[side] + arrowElementSize - popper[opSide];\n }\n data.offsets.popper = getClientRect(data.offsets.popper);\n\n // compute center of the popper\n const center = reference[side] + reference[len] / 2 - arrowElementSize / 2;\n\n // Compute the sideValue using the updated popper offsets\n // take popper margin in account because we don't have this info available\n const css = getStyleComputedProperty(data.instance.popper);\n const popperMarginSide = parseFloat(css[`margin${sideCapitalized}`], 10);\n const popperBorderSide = parseFloat(css[`border${sideCapitalized}Width`], 10);\n let sideValue =\n center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;\n\n // prevent arrowElement from being placed not contiguously to its popper\n sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);\n\n data.arrowElement = arrowElement;\n data.offsets.arrow = {\n [side]: Math.round(sideValue),\n [altSide]: '', // make sure to unset any eventual altSide value from the DOM node\n };\n\n return data;\n}\n","/**\n * Get the opposite placement variation of the given one\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement variation\n * @returns {String} flipped placement variation\n */\nexport default function getOppositeVariation(variation) {\n if (variation === 'end') {\n return 'start';\n } else if (variation === 'start') {\n return 'end';\n }\n return variation;\n}\n","import getClientRect from '../utils/getClientRect';\nimport getOppositePlacement from '../utils/getOppositePlacement';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function inner(data) {\n const placement = data.placement;\n const basePlacement = placement.split('-')[0];\n const { popper, reference } = data.offsets;\n const isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;\n\n const subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;\n\n popper[isHoriz ? 'left' : 'top'] =\n reference[basePlacement] -\n (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);\n\n data.placement = getOppositePlacement(placement);\n data.offsets.popper = getClientRect(popper);\n\n return data;\n}\n","import isModifierRequired from '../utils/isModifierRequired';\nimport find from '../utils/find';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function hide(data) {\n if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {\n return data;\n }\n\n const refRect = data.offsets.reference;\n const bound = find(\n data.instance.modifiers,\n modifier => modifier.name === 'preventOverflow'\n ).boundaries;\n\n if (\n refRect.bottom < bound.top ||\n refRect.left > bound.right ||\n refRect.top > bound.bottom ||\n refRect.right < bound.left\n ) {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === true) {\n return data;\n }\n\n data.hide = true;\n data.attributes['x-out-of-boundaries'] = '';\n } else {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === false) {\n return data;\n }\n\n data.hide = false;\n data.attributes['x-out-of-boundaries'] = false;\n }\n\n return data;\n}\n","/**\n * @function\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Boolean} shouldRound - If the offsets should be rounded at all\n * @returns {Object} The popper's position offsets rounded\n *\n * The tale of pixel-perfect positioning. It's still not 100% perfect, but as\n * good as it can be within reason.\n * Discussion here: https://github.com/FezVrasta/popper.js/pull/715\n *\n * Low DPI screens cause a popper to be blurry if not using full pixels (Safari\n * as well on High DPI screens).\n *\n * Firefox prefers no rounding for positioning and does not have blurriness on\n * high DPI screens.\n *\n * Only horizontal placement and left/right values need to be considered.\n */\nexport default function getRoundedOffsets(data, shouldRound) {\n const { popper, reference } = data.offsets;\n const { round, floor } = Math;\n const noRound = v => v;\n \n const referenceWidth = round(reference.width);\n const popperWidth = round(popper.width);\n \n const isVertical = ['left', 'right'].indexOf(data.placement) !== -1;\n const isVariation = data.placement.indexOf('-') !== -1;\n const sameWidthParity = referenceWidth % 2 === popperWidth % 2;\n const bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;\n\n const horizontalToInteger = !shouldRound\n ? noRound\n : isVertical || isVariation || sameWidthParity\n ? round\n : floor;\n const verticalToInteger = !shouldRound ? noRound : round;\n\n return {\n left: horizontalToInteger(\n bothOddWidth && !isVariation && shouldRound\n ? popper.left - 1\n : popper.left\n ),\n top: verticalToInteger(popper.top),\n bottom: verticalToInteger(popper.bottom),\n right: horizontalToInteger(popper.right),\n };\n}\n","import setStyles from '../utils/setStyles';\nimport setAttributes from '../utils/setAttributes';\nimport getReferenceOffsets from '../utils/getReferenceOffsets';\nimport computeAutoPlacement from '../utils/computeAutoPlacement';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} data.styles - List of style properties - values to apply to popper element\n * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The same data object\n */\nexport default function applyStyle(data) {\n // any property present in `data.styles` will be applied to the popper,\n // in this way we can make the 3rd party modifiers add custom styles to it\n // Be aware, modifiers could override the properties defined in the previous\n // lines of this modifier!\n setStyles(data.instance.popper, data.styles);\n\n // any property present in `data.attributes` will be applied to the popper,\n // they will be set as HTML attributes of the element\n setAttributes(data.instance.popper, data.attributes);\n\n // if arrowElement is defined and arrowStyles has some properties\n if (data.arrowElement && Object.keys(data.arrowStyles).length) {\n setStyles(data.arrowElement, data.arrowStyles);\n }\n\n return data;\n}\n\n/**\n * Set the x-placement attribute before everything else because it could be used\n * to add margins to the popper margins needs to be calculated to get the\n * correct popper offsets.\n * @method\n * @memberof Popper.modifiers\n * @param {HTMLElement} reference - The reference element used to position the popper\n * @param {HTMLElement} popper - The HTML element used as popper\n * @param {Object} options - Popper.js options\n */\nexport function applyStyleOnLoad(\n reference,\n popper,\n options,\n modifierOptions,\n state\n) {\n // compute reference element offsets\n const referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n const placement = computeAutoPlacement(\n options.placement,\n referenceOffsets,\n popper,\n reference,\n options.modifiers.flip.boundariesElement,\n options.modifiers.flip.padding\n );\n\n popper.setAttribute('x-placement', placement);\n\n // Apply `position` to popper before anything else because\n // without the position applied we can't guarantee correct computations\n setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });\n\n return options;\n}\n","/**\n * Set the attributes to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the attributes to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nexport default function setAttributes(element, attributes) {\n Object.keys(attributes).forEach(function(prop) {\n const value = attributes[prop];\n if (value !== false) {\n element.setAttribute(prop, attributes[prop]);\n } else {\n element.removeAttribute(prop);\n }\n });\n}\n","// Utils\nimport debounce from './utils/debounce';\nimport isFunction from './utils/isFunction';\n\n// Methods\nimport update from './methods/update';\nimport destroy from './methods/destroy';\nimport enableEventListeners from './methods/enableEventListeners';\nimport disableEventListeners from './methods/disableEventListeners';\nimport Defaults from './methods/defaults';\nimport placements from './methods/placements';\n\nexport default class Popper {\n /**\n * Creates a new Popper.js instance.\n * @class Popper\n * @param {Element|referenceObject} reference - The reference element used to position the popper\n * @param {Element} popper - The HTML / XML element used as the popper\n * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)\n * @return {Object} instance - The generated Popper.js instance\n */\n constructor(reference, popper, options = {}) {\n // make update() debounced, so that it only runs at most once-per-tick\n this.update = debounce(this.update.bind(this));\n\n // with {} we create a new object with the options inside it\n this.options = { ...Popper.Defaults, ...options };\n\n // init state\n this.state = {\n isDestroyed: false,\n isCreated: false,\n scrollParents: [],\n };\n\n // get reference and popper elements (allow jQuery wrappers)\n this.reference = reference && reference.jquery ? reference[0] : reference;\n this.popper = popper && popper.jquery ? popper[0] : popper;\n\n // Deep merge modifiers options\n this.options.modifiers = {};\n Object.keys({\n ...Popper.Defaults.modifiers,\n ...options.modifiers,\n }).forEach(name => {\n this.options.modifiers[name] = {\n // If it's a built-in modifier, use it as base\n ...(Popper.Defaults.modifiers[name] || {}),\n // If there are custom options, override and merge with default ones\n ...(options.modifiers ? options.modifiers[name] : {}),\n };\n });\n\n // Refactoring modifiers' list (Object => Array)\n this.modifiers = Object.keys(this.options.modifiers)\n .map(name => ({\n name,\n ...this.options.modifiers[name],\n }))\n // sort the modifiers by order\n .sort((a, b) => a.order - b.order);\n\n // modifiers have the ability to execute arbitrary code when Popper.js get inited\n // such code is executed in the same order of its modifier\n // they could add new properties to their options configuration\n // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!\n this.modifiers.forEach(modifierOptions => {\n if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {\n modifierOptions.onLoad(\n this.reference,\n this.popper,\n this.options,\n modifierOptions,\n this.state\n );\n }\n });\n\n // fire the first update to position the popper in the right place\n this.update();\n\n const eventsEnabled = this.options.eventsEnabled;\n if (eventsEnabled) {\n // setup event listeners, they will take care of update the position in specific situations\n this.enableEventListeners();\n }\n\n this.state.eventsEnabled = eventsEnabled;\n }\n\n // We can't use class properties because they don't get listed in the\n // class prototype and break stuff like Sinon stubs\n update() {\n return update.call(this);\n }\n destroy() {\n return destroy.call(this);\n }\n enableEventListeners() {\n return enableEventListeners.call(this);\n }\n disableEventListeners() {\n return disableEventListeners.call(this);\n }\n\n /**\n * Schedules an update. It will run on the next UI update available.\n * @method scheduleUpdate\n * @memberof Popper\n */\n scheduleUpdate = () => requestAnimationFrame(this.update);\n\n /**\n * Collection of utilities useful when writing custom modifiers.\n * Starting from version 1.7, this method is available only if you\n * include `popper-utils.js` before `popper.js`.\n *\n * **DEPRECATION**: This way to access PopperUtils is deprecated\n * and will be removed in v2! Use the PopperUtils module directly instead.\n * Due to the high instability of the methods contained in Utils, we can't\n * guarantee them to follow semver. Use them at your own risk!\n * @static\n * @private\n * @type {Object}\n * @deprecated since version 1.8\n * @member Utils\n * @memberof Popper\n */\n static Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;\n\n static placements = placements;\n\n static Defaults = Defaults;\n}\n\n/**\n * The `referenceObject` is an object that provides an interface compatible with Popper.js\n * and lets you use it as replacement of a real DOM node.
\n * You can use this method to position a popper relatively to a set of coordinates\n * in case you don't have a DOM node to use as reference.\n *\n * ```\n * new Popper(referenceObject, popperNode);\n * ```\n *\n * NB: This feature isn't supported in Internet Explorer 10.\n * @name referenceObject\n * @property {Function} data.getBoundingClientRect\n * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.\n * @property {number} data.clientWidth\n * An ES6 getter that will return the width of the virtual reference element.\n * @property {number} data.clientHeight\n * An ES6 getter that will return the height of the virtual reference element.\n */\n","import {field, identity, isFunction, isObject} from 'vega-util';\n\nfunction isBuffer(_) {\n return (typeof Buffer === 'function' && isFunction(Buffer.isBuffer))\n ? Buffer.isBuffer(_) : false;\n}\n\nexport default function json(data, format) {\n const prop = (format && format.property) ? field(format.property) : identity;\n return isObject(data) && !isBuffer(data)\n ? parseJSON(prop(data))\n : prop(JSON.parse(data));\n}\n\njson.responseType = 'json';\n\nfunction parseJSON(data, format) {\n return (format && format.copy)\n ? JSON.parse(JSON.stringify(data))\n : data;\n}\n","\"use strict\";\n\n// Note: This regex matches even invalid JSON strings, but since we’re\n// working on the output of `JSON.stringify` we know that only valid strings\n// are present (unless the user supplied a weird `options.indent` but in\n// that case we don’t care since the output would be invalid anyway).\nvar stringOrChar = /(\"(?:[^\\\\\"]|\\\\.)*\")|[:,]/g;\n\nmodule.exports = function stringify(passedObj, options) {\n var indent, maxLength, replacer;\n\n options = options || {};\n indent = JSON.stringify(\n [1],\n undefined,\n options.indent === undefined ? 2 : options.indent\n ).slice(2, -3);\n maxLength =\n indent === \"\"\n ? Infinity\n : options.maxLength === undefined\n ? 80\n : options.maxLength;\n replacer = options.replacer;\n\n return (function _stringify(obj, currentIndent, reserved) {\n // prettier-ignore\n var end, index, items, key, keyPart, keys, length, nextIndent, prettified, start, string, value;\n\n if (obj && typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n\n string = JSON.stringify(obj, replacer);\n\n if (string === undefined) {\n return string;\n }\n\n length = maxLength - currentIndent.length - reserved;\n\n if (string.length <= length) {\n prettified = string.replace(stringOrChar, function(match, stringLiteral) {\n return stringLiteral || match + \" \";\n });\n if (prettified.length <= length) {\n return prettified;\n }\n }\n\n if (replacer != null) {\n obj = JSON.parse(string);\n replacer = undefined;\n }\n\n if (typeof obj === \"object\" && obj !== null) {\n nextIndent = currentIndent + indent;\n items = [];\n index = 0;\n\n if (Array.isArray(obj)) {\n start = \"[\";\n end = \"]\";\n length = obj.length;\n for (; index < length; index++) {\n items.push(\n _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) ||\n \"null\"\n );\n }\n } else {\n start = \"{\";\n end = \"}\";\n keys = Object.keys(obj);\n length = keys.length;\n for (; index < length; index++) {\n key = keys[index];\n keyPart = JSON.stringify(key) + \": \";\n value = _stringify(\n obj[key],\n nextIndent,\n keyPart.length + (index === length - 1 ? 0 : 1)\n );\n if (value !== undefined) {\n items.push(keyPart + value);\n }\n }\n }\n\n if (items.length > 0) {\n return [start, indent + items.join(\",\\n\" + nextIndent), end].join(\n \"\\n\" + currentIndent\n );\n }\n }\n\n return string;\n })(passedObj, \"\", 0);\n};\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","exports = module.exports = SemVer\n\nvar debug\n/* istanbul ignore next */\nif (typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)) {\n debug = function () {\n var args = Array.prototype.slice.call(arguments, 0)\n args.unshift('SEMVER')\n console.log.apply(console, args)\n }\n} else {\n debug = function () {}\n}\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nexports.SEMVER_SPEC_VERSION = '2.0.0'\n\nvar MAX_LENGTH = 256\nvar MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n /* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nvar MAX_SAFE_COMPONENT_LENGTH = 16\n\n// The actual regexps go on exports.re\nvar re = exports.re = []\nvar src = exports.src = []\nvar t = exports.tokens = {}\nvar R = 0\n\nfunction tok (n) {\n t[n] = R++\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ntok('NUMERICIDENTIFIER')\nsrc[t.NUMERICIDENTIFIER] = '0|[1-9]\\\\d*'\ntok('NUMERICIDENTIFIERLOOSE')\nsrc[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ntok('NONNUMERICIDENTIFIER')\nsrc[t.NONNUMERICIDENTIFIER] = '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*'\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ntok('MAINVERSION')\nsrc[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIER] + ')'\n\ntok('MAINVERSIONLOOSE')\nsrc[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\ntok('PRERELEASEIDENTIFIER')\nsrc[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +\n '|' + src[t.NONNUMERICIDENTIFIER] + ')'\n\ntok('PRERELEASEIDENTIFIERLOOSE')\nsrc[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +\n '|' + src[t.NONNUMERICIDENTIFIER] + ')'\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ntok('PRERELEASE')\nsrc[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +\n '(?:\\\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'\n\ntok('PRERELEASELOOSE')\nsrc[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +\n '(?:\\\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ntok('BUILDIDENTIFIER')\nsrc[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ntok('BUILD')\nsrc[t.BUILD] = '(?:\\\\+(' + src[t.BUILDIDENTIFIER] +\n '(?:\\\\.' + src[t.BUILDIDENTIFIER] + ')*))'\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ntok('FULL')\ntok('FULLPLAIN')\nsrc[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +\n src[t.PRERELEASE] + '?' +\n src[t.BUILD] + '?'\n\nsrc[t.FULL] = '^' + src[t.FULLPLAIN] + '$'\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ntok('LOOSEPLAIN')\nsrc[t.LOOSEPLAIN] = '[v=\\\\s]*' + src[t.MAINVERSIONLOOSE] +\n src[t.PRERELEASELOOSE] + '?' +\n src[t.BUILD] + '?'\n\ntok('LOOSE')\nsrc[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'\n\ntok('GTLT')\nsrc[t.GTLT] = '((?:<|>)?=?)'\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ntok('XRANGEIDENTIFIERLOOSE')\nsrc[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\\\*'\ntok('XRANGEIDENTIFIER')\nsrc[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\\\*'\n\ntok('XRANGEPLAIN')\nsrc[t.XRANGEPLAIN] = '[v=\\\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[t.XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[t.XRANGEIDENTIFIER] + ')' +\n '(?:' + src[t.PRERELEASE] + ')?' +\n src[t.BUILD] + '?' +\n ')?)?'\n\ntok('XRANGEPLAINLOOSE')\nsrc[t.XRANGEPLAINLOOSE] = '[v=\\\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:' + src[t.PRERELEASELOOSE] + ')?' +\n src[t.BUILD] + '?' +\n ')?)?'\n\ntok('XRANGE')\nsrc[t.XRANGE] = '^' + src[t.GTLT] + '\\\\s*' + src[t.XRANGEPLAIN] + '$'\ntok('XRANGELOOSE')\nsrc[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\\\s*' + src[t.XRANGEPLAINLOOSE] + '$'\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ntok('COERCE')\nsrc[t.COERCE] = '(^|[^\\\\d])' +\n '(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +\n '(?:\\\\.(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +\n '(?:\\\\.(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +\n '(?:$|[^\\\\d])'\ntok('COERCERTL')\nre[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ntok('LONETILDE')\nsrc[t.LONETILDE] = '(?:~>?)'\n\ntok('TILDETRIM')\nsrc[t.TILDETRIM] = '(\\\\s*)' + src[t.LONETILDE] + '\\\\s+'\nre[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')\nvar tildeTrimReplace = '$1~'\n\ntok('TILDE')\nsrc[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'\ntok('TILDELOOSE')\nsrc[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ntok('LONECARET')\nsrc[t.LONECARET] = '(?:\\\\^)'\n\ntok('CARETTRIM')\nsrc[t.CARETTRIM] = '(\\\\s*)' + src[t.LONECARET] + '\\\\s+'\nre[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')\nvar caretTrimReplace = '$1^'\n\ntok('CARET')\nsrc[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'\ntok('CARETLOOSE')\nsrc[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ntok('COMPARATORLOOSE')\nsrc[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'\ntok('COMPARATOR')\nsrc[t.COMPARATOR] = '^' + src[t.GTLT] + '\\\\s*(' + src[t.FULLPLAIN] + ')$|^$'\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ntok('COMPARATORTRIM')\nsrc[t.COMPARATORTRIM] = '(\\\\s*)' + src[t.GTLT] +\n '\\\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'\n\n// this one has to use the /g flag\nre[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')\nvar comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ntok('HYPHENRANGE')\nsrc[t.HYPHENRANGE] = '^\\\\s*(' + src[t.XRANGEPLAIN] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[t.XRANGEPLAIN] + ')' +\n '\\\\s*$'\n\ntok('HYPHENRANGELOOSE')\nsrc[t.HYPHENRANGELOOSE] = '^\\\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[t.XRANGEPLAINLOOSE] + ')' +\n '\\\\s*$'\n\n// Star ranges basically just allow anything at all.\ntok('STAR')\nsrc[t.STAR] = '(<|>)?=?\\\\s*\\\\*'\n\n// Compile to actual regexp objects.\n// All are flag-free, unless they were created above with a flag.\nfor (var i = 0; i < R; i++) {\n debug(i, src[i])\n if (!re[i]) {\n re[i] = new RegExp(src[i])\n }\n}\n\nexports.parse = parse\nfunction parse (version, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n if (version.length > MAX_LENGTH) {\n return null\n }\n\n var r = options.loose ? re[t.LOOSE] : re[t.FULL]\n if (!r.test(version)) {\n return null\n }\n\n try {\n return new SemVer(version, options)\n } catch (er) {\n return null\n }\n}\n\nexports.valid = valid\nfunction valid (version, options) {\n var v = parse(version, options)\n return v ? v.version : null\n}\n\nexports.clean = clean\nfunction clean (version, options) {\n var s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\n\nexports.SemVer = SemVer\n\nfunction SemVer (version, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n if (version instanceof SemVer) {\n if (version.loose === options.loose) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError('Invalid Version: ' + version)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')\n }\n\n if (!(this instanceof SemVer)) {\n return new SemVer(version, options)\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n\n var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError('Invalid Version: ' + version)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map(function (id) {\n if (/^[0-9]+$/.test(id)) {\n var num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n}\n\nSemVer.prototype.format = function () {\n this.version = this.major + '.' + this.minor + '.' + this.patch\n if (this.prerelease.length) {\n this.version += '-' + this.prerelease.join('.')\n }\n return this.version\n}\n\nSemVer.prototype.toString = function () {\n return this.version\n}\n\nSemVer.prototype.compare = function (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return this.compareMain(other) || this.comparePre(other)\n}\n\nSemVer.prototype.compareMain = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n}\n\nSemVer.prototype.comparePre = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n var i = 0\n do {\n var a = this.prerelease[i]\n var b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n}\n\nSemVer.prototype.compareBuild = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n var i = 0\n do {\n var a = this.build[i]\n var b = other.build[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n}\n\n// preminor will bump the version up to the next minor release, and immediately\n// down to pre-release. premajor and prepatch work the same way.\nSemVer.prototype.inc = function (release, identifier) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier)\n this.inc('pre', identifier)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier)\n }\n this.inc('pre', identifier)\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 \"pre\" would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n if (this.prerelease.length === 0) {\n this.prerelease = [0]\n } else {\n var i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n this.prerelease.push(0)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n if (this.prerelease[0] === identifier) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = [identifier, 0]\n }\n } else {\n this.prerelease = [identifier, 0]\n }\n }\n break\n\n default:\n throw new Error('invalid increment argument: ' + release)\n }\n this.format()\n this.raw = this.version\n return this\n}\n\nexports.inc = inc\nfunction inc (version, release, loose, identifier) {\n if (typeof (loose) === 'string') {\n identifier = loose\n loose = undefined\n }\n\n try {\n return new SemVer(version, loose).inc(release, identifier).version\n } catch (er) {\n return null\n }\n}\n\nexports.diff = diff\nfunction diff (version1, version2) {\n if (eq(version1, version2)) {\n return null\n } else {\n var v1 = parse(version1)\n var v2 = parse(version2)\n var prefix = ''\n if (v1.prerelease.length || v2.prerelease.length) {\n prefix = 'pre'\n var defaultResult = 'prerelease'\n }\n for (var key in v1) {\n if (key === 'major' || key === 'minor' || key === 'patch') {\n if (v1[key] !== v2[key]) {\n return prefix + key\n }\n }\n }\n return defaultResult // may be undefined\n }\n}\n\nexports.compareIdentifiers = compareIdentifiers\n\nvar numeric = /^[0-9]+$/\nfunction compareIdentifiers (a, b) {\n var anum = numeric.test(a)\n var bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nexports.rcompareIdentifiers = rcompareIdentifiers\nfunction rcompareIdentifiers (a, b) {\n return compareIdentifiers(b, a)\n}\n\nexports.major = major\nfunction major (a, loose) {\n return new SemVer(a, loose).major\n}\n\nexports.minor = minor\nfunction minor (a, loose) {\n return new SemVer(a, loose).minor\n}\n\nexports.patch = patch\nfunction patch (a, loose) {\n return new SemVer(a, loose).patch\n}\n\nexports.compare = compare\nfunction compare (a, b, loose) {\n return new SemVer(a, loose).compare(new SemVer(b, loose))\n}\n\nexports.compareLoose = compareLoose\nfunction compareLoose (a, b) {\n return compare(a, b, true)\n}\n\nexports.compareBuild = compareBuild\nfunction compareBuild (a, b, loose) {\n var versionA = new SemVer(a, loose)\n var versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\n\nexports.rcompare = rcompare\nfunction rcompare (a, b, loose) {\n return compare(b, a, loose)\n}\n\nexports.sort = sort\nfunction sort (list, loose) {\n return list.sort(function (a, b) {\n return exports.compareBuild(a, b, loose)\n })\n}\n\nexports.rsort = rsort\nfunction rsort (list, loose) {\n return list.sort(function (a, b) {\n return exports.compareBuild(b, a, loose)\n })\n}\n\nexports.gt = gt\nfunction gt (a, b, loose) {\n return compare(a, b, loose) > 0\n}\n\nexports.lt = lt\nfunction lt (a, b, loose) {\n return compare(a, b, loose) < 0\n}\n\nexports.eq = eq\nfunction eq (a, b, loose) {\n return compare(a, b, loose) === 0\n}\n\nexports.neq = neq\nfunction neq (a, b, loose) {\n return compare(a, b, loose) !== 0\n}\n\nexports.gte = gte\nfunction gte (a, b, loose) {\n return compare(a, b, loose) >= 0\n}\n\nexports.lte = lte\nfunction lte (a, b, loose) {\n return compare(a, b, loose) <= 0\n}\n\nexports.cmp = cmp\nfunction cmp (a, op, b, loose) {\n switch (op) {\n case '===':\n if (typeof a === 'object')\n a = a.version\n if (typeof b === 'object')\n b = b.version\n return a === b\n\n case '!==':\n if (typeof a === 'object')\n a = a.version\n if (typeof b === 'object')\n b = b.version\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError('Invalid operator: ' + op)\n }\n}\n\nexports.Comparator = Comparator\nfunction Comparator (comp, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n if (!(this instanceof Comparator)) {\n return new Comparator(comp, options)\n }\n\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n}\n\nvar ANY = {}\nComparator.prototype.parse = function (comp) {\n var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n var m = comp.match(r)\n\n if (!m) {\n throw new TypeError('Invalid comparator: ' + comp)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n}\n\nComparator.prototype.toString = function () {\n return this.value\n}\n\nComparator.prototype.test = function (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n}\n\nComparator.prototype.intersects = function (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n var rangeTmp\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n rangeTmp = new Range(comp.value, options)\n return satisfies(this.value, rangeTmp, options)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n rangeTmp = new Range(this.value, options)\n return satisfies(comp.semver, rangeTmp, options)\n }\n\n var sameDirectionIncreasing =\n (this.operator === '>=' || this.operator === '>') &&\n (comp.operator === '>=' || comp.operator === '>')\n var sameDirectionDecreasing =\n (this.operator === '<=' || this.operator === '<') &&\n (comp.operator === '<=' || comp.operator === '<')\n var sameSemVer = this.semver.version === comp.semver.version\n var differentDirectionsInclusive =\n (this.operator === '>=' || this.operator === '<=') &&\n (comp.operator === '>=' || comp.operator === '<=')\n var oppositeDirectionsLessThan =\n cmp(this.semver, '<', comp.semver, options) &&\n ((this.operator === '>=' || this.operator === '>') &&\n (comp.operator === '<=' || comp.operator === '<'))\n var oppositeDirectionsGreaterThan =\n cmp(this.semver, '>', comp.semver, options) &&\n ((this.operator === '<=' || this.operator === '<') &&\n (comp.operator === '>=' || comp.operator === '>'))\n\n return sameDirectionIncreasing || sameDirectionDecreasing ||\n (sameSemVer && differentDirectionsInclusive) ||\n oppositeDirectionsLessThan || oppositeDirectionsGreaterThan\n}\n\nexports.Range = Range\nfunction Range (range, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (range instanceof Range) {\n if (range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n return new Range(range.value, options)\n }\n\n if (!(this instanceof Range)) {\n return new Range(range, options)\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First, split based on boolean or ||\n this.raw = range\n this.set = range.split(/\\s*\\|\\|\\s*/).map(function (range) {\n return this.parseRange(range.trim())\n }, this).filter(function (c) {\n // throw out any that are not relevant for whatever reason\n return c.length\n })\n\n if (!this.set.length) {\n throw new TypeError('Invalid SemVer Range: ' + range)\n }\n\n this.format()\n}\n\nRange.prototype.format = function () {\n this.range = this.set.map(function (comps) {\n return comps.join(' ').trim()\n }).join('||').trim()\n return this.range\n}\n\nRange.prototype.toString = function () {\n return this.range\n}\n\nRange.prototype.parseRange = function (range) {\n var loose = this.options.loose\n range = range.trim()\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace)\n debug('hyphen replace', range)\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range, re[t.COMPARATORTRIM])\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n\n // normalize spaces\n range = range.split(/\\s+/).join(' ')\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n var set = range.split(' ').map(function (comp) {\n return parseComparator(comp, this.options)\n }, this).join(' ').split(/\\s+/)\n if (this.options.loose) {\n // in loose mode, throw out any that are not valid comparators\n set = set.filter(function (comp) {\n return !!comp.match(compRe)\n })\n }\n set = set.map(function (comp) {\n return new Comparator(comp, this.options)\n }, this)\n\n return set\n}\n\nRange.prototype.intersects = function (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some(function (thisComparators) {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some(function (rangeComparators) {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every(function (thisComparator) {\n return rangeComparators.every(function (rangeComparator) {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n}\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nfunction isSatisfiable (comparators, options) {\n var result = true\n var remainingComparators = comparators.slice()\n var testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every(function (otherComparator) {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// Mostly just for testing and legacy API reasons\nexports.toComparators = toComparators\nfunction toComparators (range, options) {\n return new Range(range, options).set.map(function (comp) {\n return comp.map(function (c) {\n return c.value\n }).join(' ').trim().split(' ')\n })\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nfunction parseComparator (comp, options) {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nfunction isX (id) {\n return !id || id.toLowerCase() === 'x' || id === '*'\n}\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0\nfunction replaceTildes (comp, options) {\n return comp.trim().split(/\\s+/).map(function (comp) {\n return replaceTilde(comp, options)\n }).join(' ')\n}\n\nfunction replaceTilde (comp, options) {\n var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n return comp.replace(r, function (_, M, m, p, pr) {\n debug('tilde', comp, _, M, m, p, pr)\n var ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + (+m + 1) + '.0'\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0\n// ^1.2.3 --> >=1.2.3 <2.0.0\n// ^1.2.0 --> >=1.2.0 <2.0.0\nfunction replaceCarets (comp, options) {\n return comp.trim().split(/\\s+/).map(function (comp) {\n return replaceCaret(comp, options)\n }).join(' ')\n}\n\nfunction replaceCaret (comp, options) {\n debug('caret', comp, options)\n var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n return comp.replace(r, function (_, M, m, p, pr) {\n debug('caret', comp, _, M, m, p, pr)\n var ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (isX(p)) {\n if (M === '0') {\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n } else {\n ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + m + '.' + (+p + 1)\n } else {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n } else {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + (+M + 1) + '.0.0'\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + m + '.' + (+p + 1)\n } else {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n } else {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + (+M + 1) + '.0.0'\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nfunction replaceXRanges (comp, options) {\n debug('replaceXRanges', comp, options)\n return comp.split(/\\s+/).map(function (comp) {\n return replaceXRange(comp, options)\n }).join(' ')\n}\n\nfunction replaceXRange (comp, options) {\n comp = comp.trim()\n var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, function (ret, gtlt, M, m, p, pr) {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n var xM = isX(M)\n var xm = xM || isX(m)\n var xp = xm || isX(p)\n var anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n // >1.2.3 => >= 1.2.4\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n ret = gtlt + M + '.' + m + '.' + p + pr\n } else if (xm) {\n ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr\n } else if (xp) {\n ret = '>=' + M + '.' + m + '.0' + pr +\n ' <' + M + '.' + (+m + 1) + '.0' + pr\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nfunction replaceStars (comp, options) {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[t.STAR], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0\nfunction hyphenReplace ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr, tb) {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = '>=' + fM + '.0.0'\n } else if (isX(fp)) {\n from = '>=' + fM + '.' + fm + '.0'\n } else {\n from = '>=' + from\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = '<' + (+tM + 1) + '.0.0'\n } else if (isX(tp)) {\n to = '<' + tM + '.' + (+tm + 1) + '.0'\n } else if (tpr) {\n to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr\n } else {\n to = '<=' + to\n }\n\n return (from + ' ' + to).trim()\n}\n\n// if ANY of the sets match ALL of its comparators, then pass\nRange.prototype.test = function (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (var i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n}\n\nfunction testSet (set, version, options) {\n for (var i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n var allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n\nexports.satisfies = satisfies\nfunction satisfies (version, range, options) {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\n\nexports.maxSatisfying = maxSatisfying\nfunction maxSatisfying (versions, range, options) {\n var max = null\n var maxSV = null\n try {\n var rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach(function (v) {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\n\nexports.minSatisfying = minSatisfying\nfunction minSatisfying (versions, range, options) {\n var min = null\n var minSV = null\n try {\n var rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach(function (v) {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\n\nexports.minVersion = minVersion\nfunction minVersion (range, loose) {\n range = new Range(range, loose)\n\n var minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i]\n\n comparators.forEach(function (comparator) {\n // Clone to avoid manipulating the comparator's semver object.\n var compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!minver || gt(minver, compver)) {\n minver = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error('Unexpected operation: ' + comparator.operator)\n }\n })\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\n\nexports.validRange = validRange\nfunction validRange (range, options) {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\n\n// Determine if version is less than all the versions possible in the range\nexports.ltr = ltr\nfunction ltr (version, range, options) {\n return outside(version, range, '<', options)\n}\n\n// Determine if version is greater than all the versions possible in the range.\nexports.gtr = gtr\nfunction gtr (version, range, options) {\n return outside(version, range, '>', options)\n}\n\nexports.outside = outside\nfunction outside (version, range, hilo, options) {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n var gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisifes the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i]\n\n var high = null\n var low = null\n\n comparators.forEach(function (comparator) {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nexports.prerelease = prerelease\nfunction prerelease (version, options) {\n var parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\n\nexports.intersects = intersects\nfunction intersects (r1, r2, options) {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2)\n}\n\nexports.coerce = coerce\nfunction coerce (version, options) {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n var match = null\n if (!options.rtl) {\n match = version.match(re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n var next\n while ((next = re[t.COERCERTL].exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n re[t.COERCERTL].lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n return parse(match[2] +\n '.' + (match[3] || '0') +\n '.' + (match[4] || '0'), options)\n}\n","/**\n * Parse a vega schema url into library and version.\n */\nexport default function(url: string) {\n const regex = /\\/schema\\/([\\w-]+)\\/([\\w\\.\\-]+)\\.json$/g;\n const [library, version] = regex.exec(url)!.slice(1, 3);\n return {library: library as 'vega' | 'vega-lite', version};\n}\n","const data = require('../package.json');\n\n/**\n * The _model_module_version/_view_module_version this package implements.\n *\n * The html widget manager assumes that this is the same as the npm package\n * version number.\n */\nexport const MODULE_VERSION = data.version;\n\n/*\n * The current package name.\n */\nexport const MODULE_NAME = data.name;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/**\n * @license\n * Lodash \n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined;\n\n /** Used as the semantic version number. */\n var VERSION = '4.17.15';\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Error message constants. */\n var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',\n FUNC_ERROR_TEXT = 'Expected a function';\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500;\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n /** Used to compose bitmasks for function metadata. */\n var WRAP_BIND_FLAG = 1,\n WRAP_BIND_KEY_FLAG = 2,\n WRAP_CURRY_BOUND_FLAG = 4,\n WRAP_CURRY_FLAG = 8,\n WRAP_CURRY_RIGHT_FLAG = 16,\n WRAP_PARTIAL_FLAG = 32,\n WRAP_PARTIAL_RIGHT_FLAG = 64,\n WRAP_ARY_FLAG = 128,\n WRAP_REARG_FLAG = 256,\n WRAP_FLIP_FLAG = 512;\n\n /** Used as default options for `_.truncate`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2,\n LAZY_WHILE_FLAG = 3;\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /** Used to associate wrap methods with their bit flags. */\n var wrapFlags = [\n ['ary', WRAP_ARY_FLAG],\n ['bind', WRAP_BIND_FLAG],\n ['bindKey', WRAP_BIND_KEY_FLAG],\n ['curry', WRAP_CURRY_FLAG],\n ['curryRight', WRAP_CURRY_RIGHT_FLAG],\n ['flip', WRAP_FLIP_FLAG],\n ['partial', WRAP_PARTIAL_FLAG],\n ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],\n ['rearg', WRAP_REARG_FLAG]\n ];\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n domExcTag = '[object DOMException]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]',\n weakSetTag = '[object WeakSet]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,\n reUnescapedHtml = /[&<>\"']/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g,\n reHasRegExpChar = RegExp(reRegExpChar.source);\n\n /** Used to match leading and trailing whitespace. */\n var reTrim = /^\\s+|\\s+$/g,\n reTrimStart = /^\\s+/,\n reTrimEnd = /\\s+$/;\n\n /** Used to match wrap detail comments. */\n var reWrapComment = /\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,\n reWrapDetails = /\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,\n reSplitDetails = /,? & /;\n\n /** Used to match words composed of alphanumeric characters. */\n var reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i;\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n /** Used to match Latin Unicode letters (excluding mathematical operators). */\n var reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to compose unicode character classes. */\n var rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n /** Used to compose unicode capture groups. */\n var rsApos = \"['\\u2019]\",\n rsAstral = '[' + rsAstralRange + ']',\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n /** Used to compose unicode regexes. */\n var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n /** Used to match apostrophes. */\n var reApos = RegExp(rsApos, 'g');\n\n /**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\n var reComboMark = RegExp(rsCombo, 'g');\n\n /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\n var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n /** Used to match complex or compound words. */\n var reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n ].join('|'), 'g');\n\n /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\n var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n /** Used to detect strings that need a more robust regexp to match words. */\n var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\n 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\n '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\n typedArrayTags[errorTag] = typedArrayTags[funcTag] =\n typedArrayTags[mapTag] = typedArrayTags[numberTag] =\n typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\n typedArrayTags[setTag] = typedArrayTags[stringTag] =\n typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\n cloneableTags[boolTag] = cloneableTags[dateTag] =\n cloneableTags[float32Tag] = cloneableTags[float64Tag] =\n cloneableTags[int8Tag] = cloneableTags[int16Tag] =\n cloneableTags[int32Tag] = cloneableTags[mapTag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[setTag] =\n cloneableTags[stringTag] = cloneableTags[symbolTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map Latin Unicode letters to basic Latin letters. */\n var deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseFloat = parseFloat,\n freeParseInt = parseInt;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n /** Used as a reference to the global object. */\n var root = freeGlobal || freeSelf || Function('return this')();\n\n /** Detect free variable `exports`. */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports;\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports && freeGlobal.process;\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n }());\n\n /* Node.js helper references. */\n var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,\n nodeIsDate = nodeUtil && nodeUtil.isDate,\n nodeIsMap = nodeUtil && nodeUtil.isMap,\n nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,\n nodeIsSet = nodeUtil && nodeUtil.isSet,\n nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array == null ? 0 : array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the last element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initAccum) {\n var length = array == null ? 0 : array.length;\n if (initAccum && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n var asciiSize = baseProperty('length');\n\n /**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function asciiToArray(string) {\n return string.split('');\n }\n\n /**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function asciiWords(string) {\n return string.match(reAsciiWord) || [];\n }\n\n /**\n * The base implementation of methods like `_.findKey` and `_.findLastKey`,\n * without support for iteratee shorthands, which iterates over `collection`\n * using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFindKey(collection, predicate, eachFunc) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = key;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n }\n\n /**\n * This function is like `baseIndexOf` except that it accepts a comparator.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOfWith(array, value, fromIndex, comparator) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (comparator(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value;\n }\n\n /**\n * The base implementation of `_.mean` and `_.meanBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the mean.\n */\n function baseMean(array, iteratee) {\n var length = array == null ? 0 : array.length;\n return length ? (baseSum(array, iteratee) / length) : NAN;\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sum` and `_.sumBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(array, iteratee) {\n var result,\n index = -1,\n length = array.length;\n\n while (++index < length) {\n var current = iteratee(array[index]);\n if (current !== undefined) {\n result = result === undefined ? current : (result + current);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\n * of key-value pairs for `object` corresponding to the property names of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the key-value pairs.\n */\n function baseToPairs(object, props) {\n return arrayMap(props, function(key) {\n return [key, object[key]];\n });\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function(value) {\n return func(value);\n };\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key);\n }\n\n /**\n * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the first unmatched string symbol.\n */\n function charsStartIndex(strSymbols, chrSymbols) {\n var index = -1,\n length = strSymbols.length;\n\n while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the last unmatched string symbol.\n */\n function charsEndIndex(strSymbols, chrSymbols) {\n var index = strSymbols.length;\n\n while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Gets the number of `placeholder` occurrences in `array`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} placeholder The placeholder to search for.\n * @returns {number} Returns the placeholder count.\n */\n function countHolders(array, placeholder) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n if (array[length] === placeholder) {\n ++result;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n var deburrLetter = basePropertyOf(deburredLetters);\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n var escapeHtmlChar = basePropertyOf(htmlEscapes);\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined : object[key];\n }\n\n /**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\n function hasUnicode(string) {\n return reHasUnicode.test(string);\n }\n\n /**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\n function hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n }\n\n /**\n * Converts `iterator` to an array.\n *\n * @private\n * @param {Object} iterator The iterator to convert.\n * @returns {Array} Returns the converted array.\n */\n function iteratorToArray(iterator) {\n var data,\n result = [];\n\n while (!(data = iterator.next()).done) {\n result.push(data.value);\n }\n return result;\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value === placeholder || value === PLACEHOLDER) {\n array[index] = PLACEHOLDER;\n result[resIndex++] = index;\n }\n }\n return result;\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n }\n\n /**\n * Converts `set` to its value-value pairs.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the value-value pairs.\n */\n function setToPairs(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = [value, value];\n });\n return result;\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * A specialized version of `_.lastIndexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictLastIndexOf(array, value, fromIndex) {\n var index = fromIndex + 1;\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return index;\n }\n\n /**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\n function stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n }\n\n /**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n var unescapeHtmlChar = basePropertyOf(htmlUnescapes);\n\n /**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n function unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n }\n\n /**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function unicodeToArray(string) {\n return string.match(reUnicode) || [];\n }\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the `context` object.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Util\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // Create a suped-up `defer` in Node.js.\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n var runInContext = (function runInContext(context) {\n context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));\n\n /** Built-in constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = context['__core-js_shared__'];\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n }());\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString = objectProto.toString;\n\n /** Used to infer the `Object` constructor. */\n var objectCtorString = funcToString.call(Object);\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Built-in value references. */\n var Buffer = moduleExports ? context.Buffer : undefined,\n Symbol = context.Symbol,\n Uint8Array = context.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,\n symIterator = Symbol ? Symbol.iterator : undefined,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n var defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n }());\n\n /** Mocked built-ins. */\n var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,\n ctxNow = Date && Date.now !== root.Date.now && Date.now,\n ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeFloor = Math.floor,\n nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeIsFinite = context.isFinite,\n nativeJoin = arrayProto.join,\n nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = Date.now,\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random,\n nativeReverse = arrayProto.reverse;\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(context, 'DataView'),\n Map = getNative(context, 'Map'),\n Promise = getNative(context, 'Promise'),\n Set = getNative(context, 'Set'),\n WeakMap = getNative(context, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit method\n * chain sequences. Methods that operate on and return arrays, collections,\n * and functions can be chained together. Methods that retrieve a single value\n * or may return a primitive value will automatically end the chain sequence\n * and return the unwrapped value. Otherwise, the value must be unwrapped\n * with `_#value`.\n *\n * Explicit chain sequences, which must be unwrapped with `_#value`, may be\n * enabled using `_.chain`.\n *\n * The execution of chained methods is lazy, that is, it's deferred until\n * `_#value` is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion.\n * Shortcut fusion is an optimization to merge iteratee calls; this avoids\n * the creation of intermediate arrays and can greatly reduce the number of\n * iteratee executions. Sections of a chain sequence qualify for shortcut\n * fusion if the section is applied to an array and iteratees accept only\n * one argument. The heuristic for whether a section qualifies for shortcut\n * fusion is subject to change.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\n * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\n * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\n * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\n * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\n * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\n * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\n * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\n * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\n * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\n * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\n * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\n * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\n * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\n * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\n * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\n * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\n * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\n * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\n * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\n * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\n * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\n * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\n * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\n * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\n * `zipObject`, `zipObjectDeep`, and `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\n * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,\n * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,\n * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,\n * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,\n * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,\n * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,\n * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,\n * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,\n * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,\n * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,\n * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,\n * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,\n * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,\n * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,\n * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,\n * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,\n * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,\n * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,\n * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,\n * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,\n * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,\n * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,\n * `upperFirst`, `value`, and `words`\n *\n * @name _\n * @constructor\n * @category Seq\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // Returns an unwrapped value.\n * wrapped.reduce(_.add);\n * // => 6\n *\n * // Returns a wrapped value.\n * var squares = wrapped.map(square);\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n }());\n\n /**\n * The function whose prototype chain sequence wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable explicit method chain sequences.\n */\n function LodashWrapper(value, chainAll) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__chain__ = !!chainAll;\n this.__index__ = 0;\n this.__values__ = undefined;\n }\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': lodash\n }\n };\n\n // Ensure wrappers are instances of `baseLodash`.\n lodash.prototype = baseLodash.prototype;\n lodash.prototype.constructor = lodash;\n\n LodashWrapper.prototype = baseCreate(baseLodash.prototype);\n LodashWrapper.prototype.constructor = LodashWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @constructor\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = MAX_ARRAY_LENGTH;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = copyArray(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = copyArray(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = copyArray(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || (!isRight && arrLength == length && takeCount == length)) {\n return baseWrapperValue(array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n // Ensure `LazyWrapper` is an instance of `baseLodash`.\n LazyWrapper.prototype = baseCreate(baseLodash.prototype);\n LazyWrapper.prototype.constructor = LazyWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n }\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n }\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear;\n Hash.prototype['delete'] = hashDelete;\n Hash.prototype.get = hashGet;\n Hash.prototype.has = hashHas;\n Hash.prototype.set = hashSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear;\n ListCache.prototype['delete'] = listCacheDelete;\n ListCache.prototype.get = listCacheGet;\n ListCache.prototype.has = listCacheHas;\n ListCache.prototype.set = listCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key);\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key);\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear;\n MapCache.prototype['delete'] = mapCacheDelete;\n MapCache.prototype.get = mapCacheGet;\n MapCache.prototype.has = mapCacheHas;\n MapCache.prototype.set = mapCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n }\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value);\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\n SetCache.prototype.has = setCacheHas;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key);\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key);\n }\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear;\n Stack.prototype['delete'] = stackDelete;\n Stack.prototype.get = stackGet;\n Stack.prototype.has = stackHas;\n Stack.prototype.set = stackSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.sample` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @returns {*} Returns the random element.\n */\n function arraySample(array) {\n var length = array.length;\n return length ? array[baseRandom(0, length - 1)] : undefined;\n }\n\n /**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n }\n\n /**\n * A specialized version of `_.shuffle` for arrays.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function arrayShuffle(array) {\n return shuffleSelf(copyArray(array));\n }\n\n /**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n }\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n }\n\n /**\n * The base implementation of `_.at` without support for individual paths.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {string[]} paths The property paths to pick.\n * @returns {Array} Returns the picked elements.\n */\n function baseAt(object, paths) {\n var index = -1,\n length = paths.length,\n result = Array(length),\n skip = object == null;\n\n while (++index < length) {\n result[index] = skip ? undefined : get(object, paths[index]);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\n function baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n }\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n }\n\n /**\n * The base implementation of `_.conforms` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n */\n function baseConforms(source) {\n var props = keys(source);\n return function(object) {\n return baseConformsTo(object, source, props);\n };\n }\n\n /**\n * The base implementation of `_.conformsTo` which accepts `props` to check.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n */\n function baseConformsTo(object, source, props) {\n var length = props.length;\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (length--) {\n var key = props[length],\n predicate = source[key],\n value = object[key];\n\n if ((value === undefined && !(key in object)) || !predicate(value)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts `args`\n * to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Array} args The arguments to provide to `func`.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return object && baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from `props`.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the function names.\n */\n function baseFunctions(object, props) {\n return arrayFilter(props, function(key) {\n return isFunction(object[key]);\n });\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n }\n\n /**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n function baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n }\n\n /**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\n function baseGt(value, other) {\n return value > other;\n }\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object);\n }\n\n /**\n * The base implementation of `_.inRange` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to check.\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n */\n function baseInRange(number, start, end) {\n return number >= nativeMin(start, end) && number < nativeMax(start, end);\n }\n\n /**\n * The base implementation of methods like `_.intersection`, without support\n * for iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of shared values.\n */\n function baseIntersection(arrays, iteratee, comparator) {\n var includes = comparator ? arrayIncludesWith : arrayIncludes,\n length = arrays[0].length,\n othLength = arrays.length,\n othIndex = othLength,\n caches = Array(othLength),\n maxLength = Infinity,\n result = [];\n\n while (othIndex--) {\n var array = arrays[othIndex];\n if (othIndex && iteratee) {\n array = arrayMap(array, baseUnary(iteratee));\n }\n maxLength = nativeMin(array.length, maxLength);\n caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\n ? new SetCache(othIndex && array)\n : undefined;\n }\n array = arrays[0];\n\n var index = -1,\n seen = caches[0];\n\n outer:\n while (++index < length && result.length < maxLength) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (!(seen\n ? cacheHas(seen, computed)\n : includes(result, computed, comparator)\n )) {\n othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if (!(cache\n ? cacheHas(cache, computed)\n : includes(arrays[othIndex], computed, comparator))\n ) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.invert` and `_.invertBy` which inverts\n * `object` with values transformed by `iteratee` and set by `setter`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform values.\n * @param {Object} accumulator The initial inverted object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseInverter(object, setter, iteratee, accumulator) {\n baseForOwn(object, function(value, key, object) {\n setter(accumulator, iteratee(value), key, object);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.invoke` without support for individual\n * method arguments.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function baseInvoke(object, path, args) {\n path = castPath(path, object);\n object = parent(object, path);\n var func = object == null ? object : object[toKey(last(path))];\n return func == null ? undefined : apply(func, object, args);\n }\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n }\n\n /**\n * The base implementation of `_.isArrayBuffer` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n */\n function baseIsArrayBuffer(value) {\n return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;\n }\n\n /**\n * The base implementation of `_.isDate` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n */\n function baseIsDate(value) {\n return isObjectLike(value) && baseGetTag(value) == dateTag;\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n }\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n }\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n }\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n }\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n }\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\n function baseLt(value, other) {\n return value < other;\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n }\n\n /**\n * The base implementation of `_.nth` which doesn't coerce arguments.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {number} n The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n */\n function baseNth(array, n) {\n var length = array.length;\n if (!length) {\n return;\n }\n n += n < 0 ? length : 0;\n return isIndex(n, length) ? array[n] : undefined;\n }\n\n /**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseOrderBy(collection, iteratees, orders) {\n var index = -1;\n iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\n function basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n }\n\n /**\n * The base implementation of `_.pullAllBy` without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n */\n function basePullAll(array, values, iteratee, comparator) {\n var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\n index = -1,\n length = values.length,\n seen = array;\n\n if (array === values) {\n values = copyArray(values);\n }\n if (iteratee) {\n seen = arrayMap(array, baseUnary(iteratee));\n }\n while (++index < length) {\n var fromIndex = 0,\n value = values[index],\n computed = iteratee ? iteratee(value) : value;\n\n while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\n if (seen !== array) {\n splice.call(seen, fromIndex, 1);\n }\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * indexes or capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0,\n lastIndex = length - 1;\n\n while (length--) {\n var index = indexes[length];\n if (length == lastIndex || index !== previous) {\n var previous = index;\n if (isIndex(index)) {\n splice.call(array, index, 1);\n } else {\n baseUnset(array, index);\n }\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\n function baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n }\n\n /**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\n function baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n }\n\n /**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\n function baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n }\n\n /**\n * The base implementation of `_.sample`.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n */\n function baseSample(collection) {\n return arraySample(values(collection));\n }\n\n /**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n };\n\n /**\n * The base implementation of `_.shuffle`.\n *\n * @private\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function baseShuffle(collection) {\n return shuffleSelf(values(collection));\n }\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\n * performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndex(array, value, retHighest) {\n var low = 0,\n high = array == null ? low : array.length;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if (computed !== null && !isSymbol(computed) &&\n (retHighest ? (computed <= value) : (computed < value))) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return baseSortedIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\n * which invokes `iteratee` for `value` and each element of `array` to compute\n * their sort ranking. The iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The iteratee invoked per element.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndexBy(array, value, iteratee, retHighest) {\n value = iteratee(value);\n\n var low = 0,\n high = array == null ? 0 : array.length,\n valIsNaN = value !== value,\n valIsNull = value === null,\n valIsSymbol = isSymbol(value),\n valIsUndefined = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n othIsDefined = computed !== undefined,\n othIsNull = computed === null,\n othIsReflexive = computed === computed,\n othIsSymbol = isSymbol(computed);\n\n if (valIsNaN) {\n var setLow = retHighest || othIsReflexive;\n } else if (valIsUndefined) {\n setLow = othIsReflexive && (retHighest || othIsDefined);\n } else if (valIsNull) {\n setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);\n } else if (valIsSymbol) {\n setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);\n } else if (othIsNull || othIsSymbol) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseSortedUniq(array, iteratee) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n if (!index || !eq(computed, seen)) {\n var seen = computed;\n result[resIndex++] = value === 0 ? 0 : value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toNumber` which doesn't ensure correct\n * conversions of binary, hexadecimal, or octal string values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n */\n function baseToNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n return +value;\n }\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\n function baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n }\n\n /**\n * The base implementation of `_.update`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to update.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseUpdate(object, path, updater, customizer) {\n return baseSet(object, path, updater(baseGet(object, path)), customizer);\n }\n\n /**\n * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\n * without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) &&\n predicate(array[index], index, array)) {}\n\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to perform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n return arrayReduce(actions, function(result, action) {\n return action.func.apply(action.thisArg, arrayPush([result], action.args));\n }, result);\n }\n\n /**\n * The base implementation of methods like `_.xor`, without support for\n * iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of values.\n */\n function baseXor(arrays, iteratee, comparator) {\n var length = arrays.length;\n if (length < 2) {\n return length ? baseUniq(arrays[0]) : [];\n }\n var index = -1,\n result = Array(length);\n\n while (++index < length) {\n var array = arrays[index],\n othIndex = -1;\n\n while (++othIndex < length) {\n if (othIndex != index) {\n result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);\n }\n }\n }\n return baseUniq(baseFlatten(result, 1), iteratee, comparator);\n }\n\n /**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\n function baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n }\n\n /**\n * Casts `value` to an empty array if it's not an array like object.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array|Object} Returns the cast array-like object.\n */\n function castArrayLikeObject(value) {\n return isArrayLikeObject(value) ? value : [];\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity;\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n }\n\n /**\n * A `baseRest` alias which can be replaced with `identity` by module\n * replacement plugins.\n *\n * @private\n * @type {Function}\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n var castRest = baseRest;\n\n /**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\n function castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n }\n\n /**\n * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).\n *\n * @private\n * @param {number|Object} id The timer id or timeout object of the timer to clear.\n */\n var clearTimeout = ctxClearTimeout || function(id) {\n return root.clearTimeout(id);\n };\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n }\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n }\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n }\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n }\n\n /**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersLength = holders.length,\n leftIndex = -1,\n leftLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(leftLength + rangeLength),\n isUncurried = !isCurried;\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n }\n while (rangeLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersIndex = -1,\n holdersLength = holders.length,\n rightIndex = -1,\n rightLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(rangeLength + rightLength),\n isUncurried = !isCurried;\n\n while (++argsIndex < rangeLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n }\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n }\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, getIteratee(iteratee, 2), accumulator);\n };\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the optional `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createBind(func, bitmask, thisArg) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\n function createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n }\n\n /**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtor(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors. See\n // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a function that wraps `func` to enable currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {number} arity The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCurry(func, bitmask, arity) {\n var Ctor = createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length,\n placeholder = getHolder(wrapper);\n\n while (index--) {\n args[index] = arguments[index];\n }\n var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\n ? []\n : replaceHolders(args, placeholder);\n\n length -= holders.length;\n if (length < arity) {\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, undefined,\n args, holders, undefined, undefined, arity - length);\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return apply(fn, this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = getIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return flatRest(function(funcs) {\n var length = funcs.length,\n index = length,\n prereq = LodashWrapper.prototype.thru;\n\n if (fromRight) {\n funcs.reverse();\n }\n while (index--) {\n var func = funcs[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\n var wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? index : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined;\n\n if (data && isLaziable(data[0]) &&\n data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&\n !data[4].length && data[9] == 1\n ) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func))\n ? wrapper[funcName]()\n : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value)) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n });\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with optional `this`\n * binding of `thisArg`, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided\n * to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & WRAP_ARY_FLAG,\n isBind = bitmask & WRAP_BIND_FLAG,\n isBindKey = bitmask & WRAP_BIND_KEY_FLAG,\n isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),\n isFlip = bitmask & WRAP_FLIP_FLAG,\n Ctor = isBindKey ? undefined : createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length;\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (isCurried) {\n var placeholder = getHolder(wrapper),\n holdersCount = countHolders(args, placeholder);\n }\n if (partials) {\n args = composeArgs(args, partials, holders, isCurried);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\n }\n length -= holdersCount;\n if (isCurried && length < arity) {\n var newHolders = replaceHolders(args, placeholder);\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, thisArg,\n args, newHolders, argPos, ary, arity - length\n );\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n length = args.length;\n if (argPos) {\n args = reorder(args, argPos);\n } else if (isFlip && length > 1) {\n args.reverse();\n }\n if (isAry && ary < length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtor(fn);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.invertBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} toIteratee The function to resolve iteratees.\n * @returns {Function} Returns the new inverter function.\n */\n function createInverter(setter, toIteratee) {\n return function(object, iteratee) {\n return baseInverter(object, setter, toIteratee(iteratee), {});\n };\n }\n\n /**\n * Creates a function that performs a mathematical operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @param {number} [defaultValue] The value used for `undefined` arguments.\n * @returns {Function} Returns the new mathematical operation function.\n */\n function createMathOperation(operator, defaultValue) {\n return function(value, other) {\n var result;\n if (value === undefined && other === undefined) {\n return defaultValue;\n }\n if (value !== undefined) {\n result = value;\n }\n if (other !== undefined) {\n if (result === undefined) {\n return other;\n }\n if (typeof value == 'string' || typeof other == 'string') {\n value = baseToString(value);\n other = baseToString(other);\n } else {\n value = baseToNumber(value);\n other = baseToNumber(other);\n }\n result = operator(value, other);\n }\n return result;\n };\n }\n\n /**\n * Creates a function like `_.over`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over iteratees.\n * @returns {Function} Returns the new over function.\n */\n function createOver(arrayFunc) {\n return flatRest(function(iteratees) {\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n return baseRest(function(args) {\n var thisArg = this;\n return arrayFunc(iteratees, function(iteratee) {\n return apply(iteratee, thisArg, args);\n });\n });\n });\n }\n\n /**\n * Creates the padding for `string` based on `length`. The `chars` string\n * is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {number} length The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padding for `string`.\n */\n function createPadding(length, chars) {\n chars = chars === undefined ? ' ' : baseToString(chars);\n\n var charsLength = chars.length;\n if (charsLength < 2) {\n return charsLength ? baseRepeat(chars, length) : chars;\n }\n var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n return hasUnicode(chars)\n ? castSlice(stringToArray(result), 0, length).join('')\n : result.slice(0, length);\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the `this` binding\n * of `thisArg` and `partials` prepended to the arguments it receives.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to\n * the new function.\n * @returns {Function} Returns the new wrapped function.\n */\n function createPartial(func, bitmask, thisArg, partials) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength),\n fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n return apply(fn, isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\n function createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n }\n\n /**\n * Creates a function that performs a relational operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @returns {Function} Returns the new relational operation function.\n */\n function createRelationalOperation(operator) {\n return function(value, other) {\n if (!(typeof value == 'string' && typeof other == 'string')) {\n value = toNumber(value);\n other = toNumber(other);\n }\n return operator(value, other);\n };\n }\n\n /**\n * Creates a function that wraps `func` to continue currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {Function} wrapFunc The function to create the `func` wrapper.\n * @param {*} placeholder The placeholder value.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\n var isCurry = bitmask & WRAP_CURRY_FLAG,\n newHolders = isCurry ? holders : undefined,\n newHoldersRight = isCurry ? undefined : holders,\n newPartials = isCurry ? partials : undefined,\n newPartialsRight = isCurry ? undefined : partials;\n\n bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);\n\n if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {\n bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);\n }\n var newData = [\n func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\n newHoldersRight, argPos, ary, arity\n ];\n\n var result = wrapFunc.apply(undefined, newData);\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return setWrapToString(result, func, bitmask);\n }\n\n /**\n * Creates a function like `_.round`.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n number = toNumber(number);\n precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);\n if (precision && nativeIsFinite(number)) {\n // Shift with exponential notation to avoid floating-point issues.\n // See [MDN](https://mdn.io/round#Examples) for more details.\n var pair = (toString(number) + 'e').split('e'),\n value = func(pair[0] + 'e' + (+pair[1] + precision));\n\n pair = (toString(value) + 'e').split('e');\n return +(pair[0] + 'e' + (+pair[1] - precision));\n }\n return func(number);\n };\n }\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n };\n\n /**\n * Creates a `_.toPairs` or `_.toPairsIn` function.\n *\n * @private\n * @param {Function} keysFunc The function to get the keys of a given object.\n * @returns {Function} Returns the new pairs function.\n */\n function createToPairs(keysFunc) {\n return function(object) {\n var tag = getTag(object);\n if (tag == mapTag) {\n return mapToArray(object);\n }\n if (tag == setTag) {\n return setToPairs(object);\n }\n return baseToPairs(object, keysFunc(object));\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags.\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * 512 - `_.flip`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);\n arity = arity === undefined ? arity : toInteger(arity);\n length -= holders ? holders.length : 0;\n\n if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func);\n\n var newData = [\n func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\n argPos, ary, arity\n ];\n\n if (data) {\n mergeData(newData, data);\n }\n func = newData[0];\n bitmask = newData[1];\n thisArg = newData[2];\n partials = newData[3];\n holders = newData[4];\n arity = newData[9] = newData[9] === undefined\n ? (isBindKey ? 0 : func.length)\n : nativeMax(newData[9] - length, 0);\n\n if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {\n bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);\n }\n if (!bitmask || bitmask == WRAP_BIND_FLAG) {\n var result = createBind(func, bitmask, thisArg);\n } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {\n result = createCurry(func, bitmask, arity);\n } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {\n result = createPartial(func, bitmask, thisArg, partials);\n } else {\n result = createHybrid.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setWrapToString(setter(result, newData), func, bitmask);\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source\n * objects into destination objects that are passed thru.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to merge.\n * @param {Object} object The parent object of `objValue`.\n * @param {Object} source The parent object of `srcValue`.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {\n if (isObject(objValue) && isObject(srcValue)) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, objValue);\n baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);\n stack['delete'](srcValue);\n }\n return objValue;\n }\n\n /**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\n function customOmitClone(value) {\n return isPlainObject(value) ? undefined : value;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n function flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = (func.name + ''),\n array = realNames[result],\n length = hasOwnProperty.call(realNames, result) ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the argument placeholder value for `func`.\n *\n * @private\n * @param {Function} func The function to inspect.\n * @returns {*} Returns the placeholder value.\n */\n function getHolder(func) {\n var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\n return object.placeholder;\n }\n\n /**\n * Gets the appropriate \"iteratee\" function. If `_.iteratee` is customized,\n * this function returns the custom method, otherwise it returns `baseIteratee`.\n * If arguments are provided, the chosen function is invoked with them and\n * its result is returned.\n *\n * @private\n * @param {*} [value] The value to convert to an iteratee.\n * @param {number} [arity] The arity of the created iteratee.\n * @returns {Function} Returns the chosen function or its result.\n */\n function getIteratee() {\n var result = lodash.iteratee || iteratee;\n result = result === iteratee ? baseIteratee : result;\n return arguments.length ? result(arguments[0], arguments[1]) : result;\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n }\n\n /**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\n function getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n }\n\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n };\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n };\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag;\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Extracts wrapper details from the `source` body comment.\n *\n * @private\n * @param {string} source The source to inspect.\n * @returns {Array} Returns the wrapper details.\n */\n function getWrapDetails(source) {\n var match = source.match(reWrapDetails);\n return match ? match[1].split(reSplitDetails) : [];\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n }\n\n /**\n * Inserts wrapper `details` in a comment at the top of the `source` body.\n *\n * @private\n * @param {string} source The source to modify.\n * @returns {Array} details The details to insert.\n * @returns {string} Returns the modified source.\n */\n function insertWrapDetails(source, details) {\n var length = details.length;\n if (!length) {\n return source;\n }\n var lastIndex = length - 1;\n details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];\n details = details.join(length > 2 ? ', ' : ' ');\n return source.replace(reWrapComment, '{\\n/* [wrapped with ' + details + '] */\\n');\n }\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\n * else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func),\n other = lodash[funcName];\n\n if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n return false;\n }\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n }\n\n /**\n * Checks if `func` is capable of being masked.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `func` is maskable, else `false`.\n */\n var isMaskable = coreJsData ? isFunction : stubFalse;\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n }\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers used to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and\n * `_.rearg` modify function arguments, making the order in which they are\n * executed important, preventing the merging of metadata. However, we make\n * an exception for a safe combined case where curried functions have `_.ary`\n * and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);\n\n var isCombo =\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||\n ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & WRAP_BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : value;\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = value;\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & WRAP_ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\n function objectToString(value) {\n return nativeObjectToString.call(value);\n }\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n }\n\n /**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\n function parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = copyArray(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n }\n\n /**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity\n * function to avoid garbage collection pauses in V8. See\n * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = shortOut(baseSetData);\n\n /**\n * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n var setTimeout = ctxSetTimeout || function(func, wait) {\n return root.setTimeout(func, wait);\n };\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString);\n\n /**\n * Sets the `toString` method of `wrapper` to mimic the source of `reference`\n * with wrapper details in a comment at the top of the source body.\n *\n * @private\n * @param {Function} wrapper The function to modify.\n * @param {Function} reference The reference function.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Function} Returns `wrapper`.\n */\n function setWrapToString(wrapper, reference, bitmask) {\n var source = (reference + '');\n return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));\n }\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n }\n\n /**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\n function shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n }\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n });\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n }\n\n /**\n * Updates wrapper `details` based on `bitmask` flags.\n *\n * @private\n * @returns {Array} details The details to modify.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Array} Returns `details`.\n */\n function updateWrapDetails(details, bitmask) {\n arrayEach(wrapFlags, function(pair) {\n var value = '_.' + pair[0];\n if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {\n details.push(value);\n }\n });\n return details.sort();\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n if (wrapper instanceof LazyWrapper) {\n return wrapper.clone();\n }\n var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\n result.__actions__ = copyArray(wrapper.__actions__);\n result.__index__ = wrapper.__index__;\n result.__values__ = wrapper.__values__;\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `array` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the new array of chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {\n size = 1;\n } else {\n size = nativeMax(toInteger(size), 0);\n }\n var length = array == null ? 0 : array.length;\n if (!length || size < 1) {\n return [];\n }\n var index = 0,\n resIndex = 0,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[resIndex++] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates a new array concatenating `array` with any additional arrays\n * and/or values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to concatenate.\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var other = _.concat(array, 2, [3], [[4]]);\n *\n * console.log(other);\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n function concat() {\n var length = arguments.length;\n if (!length) {\n return [];\n }\n var args = Array(length - 1),\n array = arguments[0],\n index = length;\n\n while (index--) {\n args[index - 1] = arguments[index];\n }\n return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `iteratee` which\n * is invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * **Note:** Unlike `_.pullAllBy`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var differenceBy = baseRest(function(array, values) {\n var iteratee = last(values);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `comparator`\n * which is invoked to compare elements of `array` to `values`. The order and\n * references of result values are determined by the first array. The comparator\n * is invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.pullAllWith`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n *\n * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }]\n */\n var differenceWith = baseRest(function(array, values) {\n var comparator = last(values);\n if (isArrayLikeObject(comparator)) {\n comparator = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.dropRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropRightWhile(users, ['active', false]);\n * // => objects for ['barney']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropRightWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.dropWhile(users, function(o) { return !o.active; });\n * // => objects for ['pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropWhile(users, ['active', false]);\n * // => objects for ['pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n function fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index);\n }\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\n * // => 2\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastIndex(users, ['active', false]);\n * // => 2\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n function findLastIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length - 1;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = fromIndex < 0\n ? nativeMax(length + index, 0)\n : nativeMin(index, length - 1);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index, true);\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n }\n\n /**\n * Recursively flattens `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, [3, [4]], 5]]);\n * // => [1, 2, 3, 4, 5]\n */\n function flattenDeep(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, INFINITY) : [];\n }\n\n /**\n * Recursively flatten `array` up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * var array = [1, [2, [3, [4]], 5]];\n *\n * _.flattenDepth(array, 1);\n * // => [1, 2, [3, [4]], 5]\n *\n * _.flattenDepth(array, 2);\n * // => [1, 2, 3, [4], 5]\n */\n function flattenDepth(array, depth) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(array, depth);\n }\n\n /**\n * The inverse of `_.toPairs`; this method returns an object composed\n * from key-value `pairs`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} pairs The key-value pairs.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.fromPairs([['a', 1], ['b', 2]]);\n * // => { 'a': 1, 'b': 2 }\n */\n function fromPairs(pairs) {\n var index = -1,\n length = pairs == null ? 0 : pairs.length,\n result = {};\n\n while (++index < length) {\n var pair = pairs[index];\n result[pair[0]] = pair[1];\n }\n return result;\n }\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return (array && array.length) ? array[0] : undefined;\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 0, -1) : [];\n }\n\n /**\n * Creates an array of unique values that are included in all given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersection([2, 1], [2, 3]);\n * // => [2]\n */\n var intersection = baseRest(function(arrays) {\n var mapped = arrayMap(arrays, castArrayLikeObject);\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped)\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `iteratee`\n * which is invoked for each element of each `arrays` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [2.1]\n *\n * // The `_.property` iteratee shorthand.\n * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }]\n */\n var intersectionBy = baseRest(function(arrays) {\n var iteratee = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n if (iteratee === last(mapped)) {\n iteratee = undefined;\n } else {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `comparator`\n * which is invoked to compare elements of `arrays`. The order and references\n * of result values are determined by the first array. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.intersectionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }]\n */\n var intersectionWith = baseRest(function(arrays) {\n var comparator = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n comparator = typeof comparator == 'function' ? comparator : undefined;\n if (comparator) {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, undefined, comparator)\n : [];\n });\n\n /**\n * Converts all elements in `array` into a string separated by `separator`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to convert.\n * @param {string} [separator=','] The element separator.\n * @returns {string} Returns the joined string.\n * @example\n *\n * _.join(['a', 'b', 'c'], '~');\n * // => 'a~b~c'\n */\n function join(array, separator) {\n return array == null ? '' : nativeJoin.call(array, separator);\n }\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // Search from the `fromIndex`.\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);\n }\n return value === value\n ? strictLastIndexOf(array, value, index)\n : baseFindIndex(array, baseIsNaN, index, true);\n }\n\n /**\n * Gets the element at index `n` of `array`. If `n` is negative, the nth\n * element from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.11.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=0] The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n *\n * _.nth(array, 1);\n * // => 'b'\n *\n * _.nth(array, -2);\n * // => 'c';\n */\n function nth(array, n) {\n return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;\n }\n\n /**\n * Removes all given values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\n * to remove elements from an array by predicate.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pull(array, 'a', 'c');\n * console.log(array);\n * // => ['b', 'b']\n */\n var pull = baseRest(pullAll);\n\n /**\n * This method is like `_.pull` except that it accepts an array of values to remove.\n *\n * **Note:** Unlike `_.difference`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pullAll(array, ['a', 'c']);\n * console.log(array);\n * // => ['b', 'b']\n */\n function pullAll(array, values) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values)\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `iteratee` which is\n * invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The iteratee is invoked with one argument: (value).\n *\n * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n *\n * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\n * console.log(array);\n * // => [{ 'x': 2 }]\n */\n function pullAllBy(array, values, iteratee) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, getIteratee(iteratee, 2))\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `comparator` which\n * is invoked to compare elements of `array` to `values`. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\n *\n * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\n * console.log(array);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\n */\n function pullAllWith(array, values, comparator) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, undefined, comparator)\n : array;\n }\n\n /**\n * Removes elements from `array` corresponding to `indexes` and returns an\n * array of removed elements.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n * var pulled = _.pullAt(array, [1, 3]);\n *\n * console.log(array);\n * // => ['a', 'c']\n *\n * console.log(pulled);\n * // => ['b', 'd']\n */\n var pullAt = flatRest(function(array, indexes) {\n var length = array == null ? 0 : array.length,\n result = baseAt(array, indexes);\n\n basePullAt(array, arrayMap(indexes, function(index) {\n return isIndex(index, length) ? +index : index;\n }).sort(compareAscending));\n\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is invoked\n * with three arguments: (value, index, array).\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\n * to pull elements from an array by value.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getIteratee(predicate, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Reverses `array` so that the first element becomes the last, the second\n * element becomes the second to last, and so on.\n *\n * **Note:** This method mutates `array` and is based on\n * [`Array#reverse`](https://mdn.io/Array/reverse).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.reverse(array);\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function reverse(array) {\n return array == null ? array : nativeReverse.call(array);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n * returned.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n else {\n start = start == null ? 0 : toInteger(start);\n end = end === undefined ? length : toInteger(end);\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n */\n function sortedIndex(array, value) {\n return baseSortedIndex(array, value);\n }\n\n /**\n * This method is like `_.sortedIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedIndexBy(objects, { 'x': 4 }, 'x');\n * // => 0\n */\n function sortedIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));\n }\n\n /**\n * This method is like `_.indexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedIndexOf([4, 5, 5, 5, 6], 5);\n * // => 1\n */\n function sortedIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value);\n if (index < length && eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 5, 5, 5, 6], 5);\n * // => 4\n */\n function sortedLastIndex(array, value) {\n return baseSortedIndex(array, value, true);\n }\n\n /**\n * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 1\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');\n * // => 1\n */\n function sortedLastIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);\n }\n\n /**\n * This method is like `_.lastIndexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);\n * // => 3\n */\n function sortedLastIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value, true) - 1;\n if (eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.uniq` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniq([1, 1, 2]);\n * // => [1, 2]\n */\n function sortedUniq(array) {\n return (array && array.length)\n ? baseSortedUniq(array)\n : [];\n }\n\n /**\n * This method is like `_.uniqBy` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n * // => [1.1, 2.3]\n */\n function sortedUniqBy(array, iteratee) {\n return (array && array.length)\n ? baseSortedUniq(array, getIteratee(iteratee, 2))\n : [];\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.tail([1, 2, 3]);\n * // => [2, 3]\n */\n function tail(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 1, length) : [];\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n if (!(array && array.length)) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.takeRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeRightWhile(users, ['active', false]);\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeRightWhile(users, 'active');\n * // => []\n */\n function takeRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.takeWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeWhile(users, ['active', false]);\n * // => objects for ['barney', 'fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeWhile(users, 'active');\n * // => []\n */\n function takeWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\n var union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n });\n\n /**\n * This method is like `_.union` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which uniqueness is computed. Result values are chosen from the first\n * array in which the value occurs. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.unionBy([2.1], [1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n var unionBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.union` except that it accepts `comparator` which\n * is invoked to compare elements of `arrays`. Result values are chosen from\n * the first array in which the value occurs. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.unionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var unionWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\n function uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return (array && array.length) ? baseUniq(array, undefined, comparator) : [];\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @since 1.2.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n *\n * _.unzip(zipped);\n * // => [['a', 'b'], [1, 2], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var length = 0;\n array = arrayFilter(array, function(group) {\n if (isArrayLikeObject(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n return baseTimes(length, function(index) {\n return arrayMap(array, baseProperty(index));\n });\n }\n\n /**\n * This method is like `_.unzip` except that it accepts `iteratee` to specify\n * how regrouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * regrouped values.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee) {\n if (!(array && array.length)) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n return arrayMap(result, function(group) {\n return apply(iteratee, undefined, group);\n });\n }\n\n /**\n * Creates an array excluding all given values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.pull`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.xor\n * @example\n *\n * _.without([2, 1, 2, 3], 1, 2);\n * // => [3]\n */\n var without = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the\n * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the given arrays. The order of result values is determined by the order\n * they occur in the arrays.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.without\n * @example\n *\n * _.xor([2, 1], [2, 3]);\n * // => [1, 3]\n */\n var xor = baseRest(function(arrays) {\n return baseXor(arrayFilter(arrays, isArrayLikeObject));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which by which they're compared. The order of result values is determined\n * by the order they occur in the arrays. The iteratee is invoked with one\n * argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2, 3.4]\n *\n * // The `_.property` iteratee shorthand.\n * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var xorBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `comparator` which is\n * invoked to compare elements of `arrays`. The order of result values is\n * determined by the order they occur in the arrays. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.xorWith(objects, others, _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var xorWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);\n });\n\n /**\n * Creates an array of grouped elements, the first of which contains the\n * first elements of the given arrays, the second of which contains the\n * second elements of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n */\n var zip = baseRest(unzip);\n\n /**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\n function zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n }\n\n /**\n * This method is like `_.zipObject` except that it supports property paths.\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\n * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\n function zipObjectDeep(props, values) {\n return baseZipObject(props || [], values || [], baseSet);\n }\n\n /**\n * This method is like `_.zip` except that it accepts `iteratee` to specify\n * how grouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * grouped values.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\n * return a + b + c;\n * });\n * // => [111, 222]\n */\n var zipWith = baseRest(function(arrays) {\n var length = arrays.length,\n iteratee = length > 1 ? arrays[length - 1] : undefined;\n\n iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;\n return unzipWith(arrays, iteratee);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` wrapper instance that wraps `value` with explicit method\n * chain sequences enabled. The result of such sequences must be unwrapped\n * with `_#value`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Seq\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _\n * .chain(users)\n * .sortBy('age')\n * .map(function(o) {\n * return o.user + ' is ' + o.age;\n * })\n * .head()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor\n * is invoked with one argument; (value). The purpose of this method is to\n * \"tap into\" a method chain sequence in order to modify intermediate results.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * // Mutate input array.\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor) {\n interceptor(value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n * The purpose of this method is to \"pass thru\" values replacing intermediate\n * results in a method chain sequence.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor) {\n return interceptor(value);\n }\n\n /**\n * This method is the wrapper version of `_.at`.\n *\n * @name at\n * @memberOf _\n * @since 1.0.0\n * @category Seq\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _(object).at(['a[0].b.c', 'a[1]']).value();\n * // => [3, 4]\n */\n var wrapperAt = flatRest(function(paths) {\n var length = paths.length,\n start = length ? paths[0] : 0,\n value = this.__wrapped__,\n interceptor = function(object) { return baseAt(object, paths); };\n\n if (length > 1 || this.__actions__.length ||\n !(value instanceof LazyWrapper) || !isIndex(start)) {\n return this.thru(interceptor);\n }\n value = value.slice(start, +start + (length ? 1 : 0));\n value.__actions__.push({\n 'func': thru,\n 'args': [interceptor],\n 'thisArg': undefined\n });\n return new LodashWrapper(value, this.__chain__).thru(function(array) {\n if (length && !array.length) {\n array.push(undefined);\n }\n return array;\n });\n });\n\n /**\n * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\n *\n * @name chain\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // A sequence without explicit chaining.\n * _(users).head();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // A sequence with explicit chaining.\n * _(users)\n * .chain()\n * .head()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chain sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Gets the next value on a wrapped object following the\n * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\n *\n * @name next\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the next iterator value.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 1 }\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 2 }\n *\n * wrapped.next();\n * // => { 'done': true, 'value': undefined }\n */\n function wrapperNext() {\n if (this.__values__ === undefined) {\n this.__values__ = toArray(this.value());\n }\n var done = this.__index__ >= this.__values__.length,\n value = done ? undefined : this.__values__[this.__index__++];\n\n return { 'done': done, 'value': value };\n }\n\n /**\n * Enables the wrapper to be iterable.\n *\n * @name Symbol.iterator\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the wrapper object.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped[Symbol.iterator]() === wrapped;\n * // => true\n *\n * Array.from(wrapped);\n * // => [1, 2]\n */\n function wrapperToIterator() {\n return this;\n }\n\n /**\n * Creates a clone of the chain sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @param {*} value The value to plant.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2]).map(square);\n * var other = wrapped.plant([3, 4]);\n *\n * other.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n clone.__index__ = 0;\n clone.__values__ = undefined;\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * This method is the wrapper version of `_.reverse`.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({\n 'func': thru,\n 'args': [reverse],\n 'thisArg': undefined\n });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(reverse);\n }\n\n /**\n * Executes the chain sequence to resolve the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @since 0.1.0\n * @alias toJSON, valueOf\n * @category Seq\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': 1, '6': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n ++result[key];\n } else {\n baseAssignValue(result, key, 1);\n }\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n */\n function filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=collection.length-1] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(findLastIndex);\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDeep([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMapDeep(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), INFINITY);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDepth([1, 2], duplicate, 2);\n * // => [[1, 1], [2, 2]]\n */\n function flatMapDepth(collection, iteratee, depth) {\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(map(collection, iteratee), depth);\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @alias eachRight\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEach\n * @example\n *\n * _.forEachRight([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `2` then `1`.\n */\n function forEachRight(collection, iteratee) {\n var func = isArray(collection) ? arrayEachRight : baseEachRight;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n });\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n }\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `path` is a function, it's invoked\n * for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke each method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invokeMap([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invokeMap = baseRest(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the last element responsible for generating the key. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var array = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.keyBy(array, function(o) {\n * return String.fromCharCode(o.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.keyBy(array, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n */\n var keyBy = createAggregator(function(result, value, key) {\n baseAssignValue(result, key, value);\n });\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.sortBy` except that it allows specifying the sort\n * orders of the iteratees to sort by. If `orders` is unspecified, all values\n * are sorted in ascending order. Otherwise, specify an order of \"desc\" for\n * descending or \"asc\" for ascending sort order of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @param {string[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // Sort by `user` in ascending order and by `age` in descending order.\n * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n */\n function orderBy(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n orders = guard ? undefined : orders;\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseOrderBy(collection, iteratees, orders);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n }\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduce\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n function reduceRight(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduceRight : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(getIteratee(predicate, 3)));\n }\n\n /**\n * Gets a random element from `collection`.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n */\n function sample(collection) {\n var func = isArray(collection) ? arraySample : baseSample;\n return func(collection);\n }\n\n /**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\n function sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n var func = isArray(collection) ? arrayShuffle : baseShuffle;\n return func(collection);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]\n */\n var sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\n var now = ctxNow || function() {\n return root.Date.now();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it's called `n` or more times.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => Logs 'done saving!' after the two async saves have completed.\n */\n function after(n, func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that invokes `func`, with up to `n` arguments,\n * ignoring any additional arguments.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n n = guard ? undefined : n;\n n = (func && n == null) ? func.length : n;\n return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it's called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery(element).on('click', _.before(5, addContactToList));\n * // => Allows adding up to 4 contacts to the list.\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and `partials` prepended to the arguments it receives.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind`, this method doesn't set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * function greet(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = baseRest(function(func, thisArg, partials) {\n var bitmask = WRAP_BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bind));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` with `partials`\n * prepended to the arguments it receives.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist. See\n * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Function\n * @param {Object} object The object to invoke the method on.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = baseRest(function(object, key, partials) {\n var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bindKey));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts arguments of `func` and either invokes\n * `func` returning its result, if at least `arity` number of arguments have\n * been provided, or returns a function that accepts the remaining `func`\n * arguments, and so on. The arity of `func` may be specified if `func.length`\n * is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n function curry(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curry.placeholder;\n return result;\n }\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n function curryRight(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curryRight.placeholder;\n return result;\n }\n\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\n function debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n }\n\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // => Logs 'deferred' after one millisecond.\n */\n var defer = baseRest(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => Logs 'later' after one second.\n */\n var delay = baseRest(function(func, wait, args) {\n return baseDelay(func, toNumber(wait) || 0, args);\n });\n\n /**\n * Creates a function that invokes `func` with arguments reversed.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to flip arguments for.\n * @returns {Function} Returns the new flipped function.\n * @example\n *\n * var flipped = _.flip(function() {\n * return _.toArray(arguments);\n * });\n *\n * flipped('a', 'b', 'c', 'd');\n * // => ['d', 'c', 'b', 'a']\n */\n function flip(func) {\n return createWrap(func, WRAP_FLIP_FLAG);\n }\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache;\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first invocation. The `func` is\n * invoked with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with its arguments transformed.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms=[_.identity]]\n * The argument transforms.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var func = _.overArgs(function(x, y) {\n * return [x, y];\n * }, [square, doubled]);\n *\n * func(9, 3);\n * // => [81, 6]\n *\n * func(10, 5);\n * // => [100, 10]\n */\n var overArgs = castRest(function(func, transforms) {\n transforms = (transforms.length == 1 && isArray(transforms[0]))\n ? arrayMap(transforms[0], baseUnary(getIteratee()))\n : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));\n\n var funcsLength = transforms.length;\n return baseRest(function(args) {\n var index = -1,\n length = nativeMin(args.length, funcsLength);\n\n while (++index < length) {\n args[index] = transforms[index].call(this, args[index]);\n }\n return apply(func, this, args);\n });\n });\n\n /**\n * Creates a function that invokes `func` with `partials` prepended to the\n * arguments it receives. This method is like `_.bind` except it does **not**\n * alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 0.2.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // Partially applied with placeholders.\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partial));\n return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);\n });\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to the arguments it receives.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // Partially applied with placeholders.\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partialRight));\n return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);\n });\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified `indexes` where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, [2, 0, 1]);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n */\n var rearg = flatRest(function(func, indexes) {\n return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as\n * an array.\n *\n * **Note:** This method is based on the\n * [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start === undefined ? start : toInteger(start);\n return baseRest(func, start);\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * create function and an array of arguments much like\n * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).\n *\n * **Note:** This method is based on the\n * [spread operator](https://mdn.io/spread_operator).\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @param {number} [start=0] The start position of the spread.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start == null ? 0 : nativeMax(toInteger(start), 0);\n return baseRest(function(args) {\n var array = args[start],\n otherArgs = castSlice(args, 0, start);\n\n if (array) {\n arrayPush(otherArgs, array);\n }\n return apply(func, this, otherArgs);\n });\n }\n\n /**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n }\n\n /**\n * Creates a function that accepts up to one argument, ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.unary(parseInt));\n * // => [6, 8, 10]\n */\n function unary(func) {\n return ary(func, 1);\n }\n\n /**\n * Creates a function that provides `value` to `wrapper` as its first\n * argument. Any additional arguments provided to the function are appended\n * to those provided to the `wrapper`. The wrapper is invoked with the `this`\n * binding of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} [wrapper=identity] The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '

' + func(text) + '

';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '

fred, barney, & pebbles

'\n */\n function wrap(value, wrapper) {\n return partial(castFunction(wrapper), value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Casts `value` as an array if it's not one.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Lang\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast array.\n * @example\n *\n * _.castArray(1);\n * // => [1]\n *\n * _.castArray({ 'a': 1 });\n * // => [{ 'a': 1 }]\n *\n * _.castArray('abc');\n * // => ['abc']\n *\n * _.castArray(null);\n * // => [null]\n *\n * _.castArray(undefined);\n * // => [undefined]\n *\n * _.castArray();\n * // => []\n *\n * var array = [1, 2, 3];\n * console.log(_.castArray(array) === array);\n * // => true\n */\n function castArray() {\n if (!arguments.length) {\n return [];\n }\n var value = arguments[0];\n return isArray(value) ? value : [value];\n }\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.clone` except that it accepts `customizer` which\n * is invoked to produce the cloned value. If `customizer` returns `undefined`,\n * cloning is handled by the method instead. The `customizer` is invoked with\n * up to four arguments; (value [, index|key, object, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeepWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * }\n *\n * var el = _.cloneWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 0\n */\n function cloneWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\n function cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.cloneWith` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the deep cloned value.\n * @see _.cloneWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * }\n *\n * var el = _.cloneDeepWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 20\n */\n function cloneDeepWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * Checks if `object` conforms to `source` by invoking the predicate\n * properties of `source` with the corresponding property values of `object`.\n *\n * **Note:** This method is equivalent to `_.conforms` when `source` is\n * partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 1; } });\n * // => true\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 2; } });\n * // => false\n */\n function conformsTo(object, source) {\n return source == null || baseConformsTo(object, source, keys(source));\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n * @see _.lt\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n var gt = createRelationalOperation(baseGt);\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to\n * `other`, else `false`.\n * @see _.lte\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n var gte = createRelationalOperation(function(value, other) {\n return value >= other;\n });\n\n /**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n };\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray;\n\n /**\n * Checks if `value` is classified as an `ArrayBuffer` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n * @example\n *\n * _.isArrayBuffer(new ArrayBuffer(2));\n * // => true\n *\n * _.isArrayBuffer(new Array(2));\n * // => false\n */\n var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n }\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n }\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false ||\n (isObjectLike(value) && baseGetTag(value) == boolTag);\n }\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse;\n\n /**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;\n\n /**\n * Checks if `value` is likely a DOM element.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('');\n * // => false\n */\n function isElement(value) {\n return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\n function isEqual(value, other) {\n return baseIsEqual(value, other);\n }\n\n /**\n * This method is like `_.isEqual` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with up to\n * six arguments: (objValue, othValue [, index|key, object, other, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, othValue) {\n * if (isGreeting(objValue) && isGreeting(othValue)) {\n * return true;\n * }\n * }\n *\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqualWith(array, other, customizer);\n * // => true\n */\n function isEqualWith(value, other, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n var result = customizer ? customizer(value, other) : undefined;\n return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on\n * [`Number.isFinite`](https://mdn.io/Number/isFinite).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.\n * @example\n *\n * _.isFinite(3);\n * // => true\n *\n * _.isFinite(Number.MIN_VALUE);\n * // => true\n *\n * _.isFinite(Infinity);\n * // => false\n *\n * _.isFinite('3');\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n }\n\n /**\n * Checks if `value` is an integer.\n *\n * **Note:** This method is based on\n * [`Number.isInteger`](https://mdn.io/Number/isInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n *\n * _.isInteger(3);\n * // => true\n *\n * _.isInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isInteger(Infinity);\n * // => false\n *\n * _.isInteger('3');\n * // => false\n */\n function isInteger(value) {\n return typeof value == 'number' && value == toInteger(value);\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return value != null && typeof value == 'object';\n }\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\n /**\n * Performs a partial deep comparison between `object` and `source` to\n * determine if `object` contains equivalent property values.\n *\n * **Note:** This method is equivalent to `_.matches` when `source` is\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.isMatch(object, { 'b': 2 });\n * // => true\n *\n * _.isMatch(object, { 'b': 1 });\n * // => false\n */\n function isMatch(object, source) {\n return object === source || baseIsMatch(object, source, getMatchData(source));\n }\n\n /**\n * This method is like `_.isMatch` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with five\n * arguments: (objValue, srcValue, index|key, object, source).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, srcValue) {\n * if (isGreeting(objValue) && isGreeting(srcValue)) {\n * return true;\n * }\n * }\n *\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatchWith(object, source, customizer);\n * // => true\n */\n function isMatchWith(object, source, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseIsMatch(object, source, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is based on\n * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n * `undefined` and other non-number values.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some\n // ActiveX objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a pristine native function.\n *\n * **Note:** This method can't reliably detect native functions in the presence\n * of the core-js package because core-js circumvents this kind of detection.\n * Despite multiple requests, the core-js maintainer has made it clear: any\n * attempt to fix the detection will be obstructed. As a result, we're left\n * with little choice but to throw an error. Unfortunately, this also affects\n * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),\n * which rely on core-js.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (isMaskable(value)) {\n throw new Error(CORE_ERROR_TEXT);\n }\n return baseIsNative(value);\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is `null` or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\n * @example\n *\n * _.isNil(null);\n * // => true\n *\n * _.isNil(void 0);\n * // => true\n *\n * _.isNil(NaN);\n * // => false\n */\n function isNil(value) {\n return value == null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\n /**\n * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\n * double precision number which isn't the result of a rounded unsafe integer.\n *\n * **Note:** This method is based on\n * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.\n * @example\n *\n * _.isSafeInteger(3);\n * // => true\n *\n * _.isSafeInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isSafeInteger(Infinity);\n * // => false\n *\n * _.isSafeInteger('3');\n * // => false\n */\n function isSafeInteger(value) {\n return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n }\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined;\n }\n\n /**\n * Checks if `value` is classified as a `WeakMap` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.\n * @example\n *\n * _.isWeakMap(new WeakMap);\n * // => true\n *\n * _.isWeakMap(new Map);\n * // => false\n */\n function isWeakMap(value) {\n return isObjectLike(value) && getTag(value) == weakMapTag;\n }\n\n /**\n * Checks if `value` is classified as a `WeakSet` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.\n * @example\n *\n * _.isWeakSet(new WeakSet);\n * // => true\n *\n * _.isWeakSet(new Set);\n * // => false\n */\n function isWeakSet(value) {\n return isObjectLike(value) && baseGetTag(value) == weakSetTag;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n * @see _.gt\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n var lt = createRelationalOperation(baseLt);\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to\n * `other`, else `false`.\n * @see _.gte\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n var lte = createRelationalOperation(function(value, other) {\n return value <= other;\n });\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * _.toArray({ 'a': 1, 'b': 2 });\n * // => [1, 2]\n *\n * _.toArray('abc');\n * // => ['a', 'b', 'c']\n *\n * _.toArray(1);\n * // => []\n *\n * _.toArray(null);\n * // => []\n */\n function toArray(value) {\n if (!value) {\n return [];\n }\n if (isArrayLike(value)) {\n return isString(value) ? stringToArray(value) : copyArray(value);\n }\n if (symIterator && value[symIterator]) {\n return iteratorToArray(value[symIterator]());\n }\n var tag = getTag(value),\n func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\n\n return func(value);\n }\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n }\n\n /**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\n function toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n }\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n }\n\n /**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return copyObject(value, keysIn(value));\n }\n\n /**\n * Converts `value` to a safe integer. A safe integer can be compared and\n * represented correctly.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toSafeInteger(3.2);\n * // => 3\n *\n * _.toSafeInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toSafeInteger(Infinity);\n * // => 9007199254740991\n *\n * _.toSafeInteger('3.2');\n * // => 3\n */\n function toSafeInteger(value) {\n return value\n ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)\n : (value === 0 ? value : 0);\n }\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n });\n\n /**\n * This method is like `_.assign` except that it iterates over own and\n * inherited source properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assign\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assignIn({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }\n */\n var assignIn = createAssigner(function(object, source) {\n copyObject(source, keysIn(source), object);\n });\n\n /**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n });\n\n /**\n * This method is like `_.assign` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignInWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keys(source), object, customizer);\n });\n\n /**\n * Creates an array of values corresponding to `paths` of `object`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Array} Returns the picked values.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _.at(object, ['a[0].b.c', 'a[1]']);\n * // => [3, 4]\n */\n var at = flatRest(baseAt);\n\n /**\n * Creates an object that inherits from the `prototype` object. If a\n * `properties` object is given, its own enumerable string keyed properties\n * are assigned to the created object.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties) {\n var result = baseCreate(prototype);\n return properties == null ? result : baseAssign(result, properties);\n }\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n });\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaults\n * @example\n *\n * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });\n * // => { 'a': { 'b': 2, 'c': 3 } }\n */\n var defaultsDeep = baseRest(function(args) {\n args.push(undefined, customDefaultsMerge);\n return apply(mergeWith, undefined, args);\n });\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(o) { return o.age < 40; });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // The `_.matches` iteratee shorthand.\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n function findKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);\n }\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(o) { return o.age < 40; });\n * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n function findLastKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);\n }\n\n /**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\n function forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\n */\n function forInRight(object, iteratee) {\n return object == null\n ? object\n : baseForRight(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forOwn(object, iteratee) {\n return object && baseForOwn(object, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\n */\n function forOwnRight(object, iteratee) {\n return object && baseForOwnRight(object, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an array of function property names from own enumerable properties\n * of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functionsIn\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functions(new Foo);\n * // => ['a', 'b']\n */\n function functions(object) {\n return object == null ? [] : baseFunctions(object, keys(object));\n }\n\n /**\n * Creates an array of function property names from own and inherited\n * enumerable properties of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functions\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functionsIn(new Foo);\n * // => ['a', 'b', 'c']\n */\n function functionsIn(object) {\n return object == null ? [] : baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite\n * property assignments of previous values.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Object\n * @param {Object} object The object to invert.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n */\n var invert = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n result[value] = key;\n }, constant(identity));\n\n /**\n * This method is like `_.invert` except that the inverted object is generated\n * from the results of running each element of `object` thru `iteratee`. The\n * corresponding inverted value of each inverted key is an array of keys\n * responsible for generating the inverted value. The iteratee is invoked\n * with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Object\n * @param {Object} object The object to invert.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invertBy(object);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n *\n * _.invertBy(object, function(value) {\n * return 'group' + value;\n * });\n * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\n */\n var invertBy = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }, getIteratee);\n\n /**\n * Invokes the method at `path` of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n *\n * _.invoke(object, 'a[0].b.c.slice', 1, 3);\n * // => [2, 3]\n */\n var invoke = baseRest(baseInvoke);\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * string keyed property of `object` thru `iteratee`. The iteratee is invoked\n * with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapValues\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n function mapKeys(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, iteratee(value, key, object), value);\n });\n return result;\n }\n\n /**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n function mapValues(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n }\n\n /**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\n var merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n });\n\n /**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\n var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n });\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\n var omit = flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = arrayMap(paths, function(path) {\n path = castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n copyObject(object, getAllKeysIn(object), result);\n if (isDeep) {\n result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n baseUnset(result, paths[length]);\n }\n return result;\n });\n\n /**\n * The opposite of `_.pickBy`; this method creates an object composed of\n * the own and inherited enumerable string keyed properties of `object` that\n * `predicate` doesn't return truthy for. The predicate is invoked with two\n * arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omitBy(object, _.isNumber);\n * // => { 'b': '2' }\n */\n function omitBy(object, predicate) {\n return pickBy(object, negate(getIteratee(predicate)));\n }\n\n /**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\n var pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n });\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = getIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n }\n\n /**\n * This method is like `_.get` except that if the resolved value is a\n * function it's invoked with the `this` binding of its parent object and\n * its result is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a[0].b.c3', 'default');\n * // => 'default'\n *\n * _.result(object, 'a[0].b.c3', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length;\n\n // Ensure the loop is entered when path is empty.\n if (!length) {\n length = 1;\n object = undefined;\n }\n while (++index < length) {\n var value = object == null ? undefined : object[toKey(path[index])];\n if (value === undefined) {\n index = length;\n value = defaultValue;\n }\n object = isFunction(value) ? value.call(object) : value;\n }\n return object;\n }\n\n /**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n }\n\n /**\n * This method is like `_.set` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.setWith(object, '[0][1]', 'a', Object);\n * // => { '0': { '1': 'a' } }\n */\n function setWith(object, path, value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseSet(object, path, value, customizer);\n }\n\n /**\n * Creates an array of own enumerable string keyed-value pairs for `object`\n * which can be consumed by `_.fromPairs`. If `object` is a map or set, its\n * entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entries\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairs(new Foo);\n * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n */\n var toPairs = createToPairs(keys);\n\n /**\n * Creates an array of own and inherited enumerable string keyed-value pairs\n * for `object` which can be consumed by `_.fromPairs`. If `object` is a map\n * or set, its entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entriesIn\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairsIn(new Foo);\n * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)\n */\n var toPairsIn = createToPairs(keysIn);\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own\n * enumerable string keyed properties thru `iteratee`, with each invocation\n * potentially mutating the `accumulator` object. If `accumulator` is not\n * provided, a new object with the same `[[Prototype]]` will be used. The\n * iteratee is invoked with four arguments: (accumulator, value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * }, []);\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function transform(object, iteratee, accumulator) {\n var isArr = isArray(object),\n isArrLike = isArr || isBuffer(object) || isTypedArray(object);\n\n iteratee = getIteratee(iteratee, 4);\n if (accumulator == null) {\n var Ctor = object && object.constructor;\n if (isArrLike) {\n accumulator = isArr ? new Ctor : [];\n }\n else if (isObject(object)) {\n accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n }\n else {\n accumulator = {};\n }\n }\n (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Removes the property at `path` of `object`.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n * _.unset(object, 'a[0].b.c');\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n *\n * _.unset(object, ['a', '0', 'b', 'c']);\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n */\n function unset(object, path) {\n return object == null ? true : baseUnset(object, path);\n }\n\n /**\n * This method is like `_.set` except that accepts `updater` to produce the\n * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\n * is invoked with one argument: (value).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.update(object, 'a[0].b.c', function(n) { return n * n; });\n * console.log(object.a[0].b.c);\n * // => 9\n *\n * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\n * console.log(object.x[0].y.z);\n * // => 0\n */\n function update(object, path, updater) {\n return object == null ? object : baseUpdate(object, path, castFunction(updater));\n }\n\n /**\n * This method is like `_.update` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.updateWith(object, '[0][1]', _.constant('a'), Object);\n * // => { '0': { '1': 'a' } }\n */\n function updateWith(object, path, updater, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable string keyed property\n * values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return object == null ? [] : baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Clamps `number` within the inclusive `lower` and `upper` bounds.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Number\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n * @example\n *\n * _.clamp(-10, -5, 5);\n * // => -5\n *\n * _.clamp(10, -5, 5);\n * // => 5\n */\n function clamp(number, lower, upper) {\n if (upper === undefined) {\n upper = lower;\n lower = undefined;\n }\n if (upper !== undefined) {\n upper = toNumber(upper);\n upper = upper === upper ? upper : 0;\n }\n if (lower !== undefined) {\n lower = toNumber(lower);\n lower = lower === lower ? lower : 0;\n }\n return baseClamp(toNumber(number), lower, upper);\n }\n\n /**\n * Checks if `n` is between `start` and up to, but not including, `end`. If\n * `end` is not specified, it's set to `start` with `start` then set to `0`.\n * If `start` is greater than `end` the params are swapped to support\n * negative ranges.\n *\n * @static\n * @memberOf _\n * @since 3.3.0\n * @category Number\n * @param {number} number The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n * @see _.range, _.rangeRight\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n *\n * _.inRange(-3, -2, -6);\n * // => true\n */\n function inRange(number, start, end) {\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n number = toNumber(number);\n return baseInRange(number, start, end);\n }\n\n /**\n * Produces a random number between the inclusive `lower` and `upper` bounds.\n * If only one argument is provided a number between `0` and the given number\n * is returned. If `floating` is `true`, or either `lower` or `upper` are\n * floats, a floating-point number is returned instead of an integer.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Number\n * @param {number} [lower=0] The lower bound.\n * @param {number} [upper=1] The upper bound.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(lower, upper, floating) {\n if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\n upper = floating = undefined;\n }\n if (floating === undefined) {\n if (typeof upper == 'boolean') {\n floating = upper;\n upper = undefined;\n }\n else if (typeof lower == 'boolean') {\n floating = lower;\n lower = undefined;\n }\n }\n if (lower === undefined && upper === undefined) {\n lower = 0;\n upper = 1;\n }\n else {\n lower = toFinite(lower);\n if (upper === undefined) {\n upper = lower;\n lower = 0;\n } else {\n upper = toFinite(upper);\n }\n }\n if (lower > upper) {\n var temp = lower;\n lower = upper;\n upper = temp;\n }\n if (floating || lower % 1 || upper % 1) {\n var rand = nativeRandom();\n return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\n }\n return baseRandom(lower, upper);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n });\n\n /**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\n function capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n }\n\n /**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search up to.\n * @returns {boolean} Returns `true` if `string` ends with `target`,\n * else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = toString(string);\n target = baseToString(target);\n\n var length = string.length;\n position = position === undefined\n ? length\n : baseClamp(toInteger(position), 0, length);\n\n var end = position;\n position -= target.length;\n return position >= 0 && string.slice(position, end) == target;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"^\", \"$\", \"\\\", \".\", \"*\", \"+\",\n * \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n */\n function escapeRegExp(string) {\n string = toString(string);\n return (string && reHasRegExpChar.test(string))\n ? string.replace(reRegExpChar, '\\\\$&')\n : string;\n }\n\n /**\n * Converts `string` to\n * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__FOO_BAR__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string`, as space separated words, to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.lowerCase('--Foo-Bar--');\n * // => 'foo bar'\n *\n * _.lowerCase('fooBar');\n * // => 'foo bar'\n *\n * _.lowerCase('__FOO_BAR__');\n * // => 'foo bar'\n */\n var lowerCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toLowerCase();\n });\n\n /**\n * Converts the first character of `string` to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.lowerFirst('Fred');\n * // => 'fred'\n *\n * _.lowerFirst('FRED');\n * // => 'fRED'\n */\n var lowerFirst = createCaseFirst('toLowerCase');\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n if (!length || strLength >= length) {\n return string;\n }\n var mid = (length - strLength) / 2;\n return (\n createPadding(nativeFloor(mid), chars) +\n string +\n createPadding(nativeCeil(mid), chars)\n );\n }\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padEnd('abc', 6);\n * // => 'abc '\n *\n * _.padEnd('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padEnd('abc', 3);\n * // => 'abc'\n */\n function padEnd(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (string + createPadding(length - strLength, chars))\n : string;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padStart('abc', 6);\n * // => ' abc'\n *\n * _.padStart('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padStart('abc', 3);\n * // => 'abc'\n */\n function padStart(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (createPadding(length - strLength, chars) + string)\n : string;\n }\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\n * hexadecimal, in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the\n * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix=10] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n if (guard || radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=1] The number of times to repeat the string.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n, guard) {\n if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n return baseRepeat(toString(string), n);\n }\n\n /**\n * Replaces matches for `pattern` in `string` with `replacement`.\n *\n * **Note:** This method is based on\n * [`String#replace`](https://mdn.io/String/replace).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to modify.\n * @param {RegExp|string} pattern The pattern to replace.\n * @param {Function|string} replacement The match replacement.\n * @returns {string} Returns the modified string.\n * @example\n *\n * _.replace('Hi Fred', 'Fred', 'Barney');\n * // => 'Hi Barney'\n */\n function replace() {\n var args = arguments,\n string = toString(args[0]);\n\n return args.length < 3 ? string : string.replace(args[1], args[2]);\n }\n\n /**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Splits `string` by `separator`.\n *\n * **Note:** This method is based on\n * [`String#split`](https://mdn.io/String/split).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to split.\n * @param {RegExp|string} separator The separator pattern to split by.\n * @param {number} [limit] The length to truncate results to.\n * @returns {Array} Returns the string segments.\n * @example\n *\n * _.split('a-b-c', '-', 2);\n * // => ['a', 'b']\n */\n function split(string, separator, limit) {\n if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\n separator = limit = undefined;\n }\n limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;\n if (!limit) {\n return [];\n }\n string = toString(string);\n if (string && (\n typeof separator == 'string' ||\n (separator != null && !isRegExp(separator))\n )) {\n separator = baseToString(separator);\n if (!separator && hasUnicode(string)) {\n return castSlice(stringToArray(string), 0, limit);\n }\n }\n return string.split(separator, limit);\n }\n\n /**\n * Converts `string` to\n * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @since 3.1.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar--');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__FOO_BAR__');\n * // => 'FOO BAR'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + upperFirst(word);\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`,\n * else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = toString(string);\n position = position == null\n ? 0\n : baseClamp(toInteger(position), 0, string.length);\n\n target = baseToString(target);\n return string.slice(position, position + target.length) == target;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='lodash.templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<%- value %>');\n * compiled({ 'value': '