openapi-gui
Version:
GUI / visual editor for creating and editing OpenApi / Swagger definitions
1 lines • 421 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vega=t.vega||{})}(this,function(y){"use strict";var g=function(t,e,n){return t.fields=e||[],t.fname=n,t};function M(t){return null==t?null:t.fname}function x(t){return null==t?null:t.fields}var rt=function(t){throw Error(t)},m=function(t){var e,n,r,i=[],a=null,o=0,u=t.length,s="";function f(){i.push(s+t.substring(e,n)),s="",e=n+1}for(t+="",e=n=0;n<u;++n)if("\\"===(r=t[n]))s+=t.substring(e,n),e=++n;else if(r===a)f(),a=null,o=-1;else{if(a)continue;e===o&&'"'===r?(e=n+1,a=r):e===o&&"'"===r?(e=n+1,a=r):"."!==r||o?"["===r?(e<n&&f(),o=e=n+1):"]"===r&&(o||rt("Access path missing open bracket: "+t),0<o&&f(),o=0,e=n+1):e<n?f():e=n+1}return o&&rt("Access path missing closing bracket: "+t),a&&rt("Access path missing closing quote: "+t),e<n&&(n++,f()),i},d=Array.isArray,J=function(t){return t===Object(t)},p=function(t){return"string"==typeof t};function Z(t){return d(t)?"["+t.map(Z)+"]":J(t)||p(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}var l=function(t,e){var n=m(t),r="return _["+n.map(Z).join("][")+"];";return g(Function("_",r),[t=1===n.length?n[0]:t],e||t)},t=[],f=l("id"),c=g(function(t){return t},t,"identity"),w=g(function(){return 0},t,"zero"),b=g(function(){return 1},t,"one"),v=g(function(){return!0},t,"true"),h=g(function(){return!1},t,"false");function n(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}var r=1,_=3,k=4,e=function(t){var e=t||0;return{level:function(t){return arguments.length?(e=+t,this):e},error:function(){return r<=e&&n("error","ERROR",arguments),this},warn:function(){return 2<=e&&n("warn","WARN",arguments),this},info:function(){return _<=e&&n("log","INFO",arguments),this},debug:function(){return k<=e&&n("log","DEBUG",arguments),this}}},E=function(t){return t[t.length-1]},S=function(t){return null==t||""===t?null:+t};function i(e){return function(t){return e*Math.exp(t)}}function a(e){return function(t){return Math.log(e*t)}}function o(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function u(t,e,n,r){var i=n(t[0]),a=n(E(t)),o=(a-i)*e;return[r(i-o),r(a-o)]}function s(t,e){return u(t,e,S,c)}function A(t,e){var n=Math.sign(t[0]);return u(t,e,a(n),i(n))}function C(t,e,n){return u(t,e,o(n),o(1/n))}function z(t,e,n,r,i){var a=r(t[0]),o=r(E(t)),u=null!=e?r(e):(a+o)/2;return[i(u+(a-u)*n),i(u+(o-u)*n)]}function D(t,e,n){return z(t,e,n,S,c)}function O(t,e,n){var r=Math.sign(t[0]);return z(t,e,n,a(r),i(r))}function N(t,e,n,r){return z(t,e,n,o(r),o(1/r))}var Q=function(t){return null!=t?d(t)?t:[t]:[]},R=function(t){return"function"==typeof t},T=function(t,e){var n,r,i,a,o,u,s,f,c,l=[],h=(t=Q(t)).map(function(t,e){return null==t?null:(l.push(e),R(t)?t:m(t).map(Z).join("]["))}),d=l.length-1,p=Q(e),v="var u,v;return ";if(d<0)return null;for(r=0;r<=d;++r)i=h[n=l[r]],R(i)?(a="(u=this."+(u="f"+n)+"(a))",o="(v=this."+u+"(b))",(s=s||{})[u]=i):(a="(u=a["+i+"])",o="(v=b["+i+"])"),u="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==p[n]?f=-(c=1):(c=-1,f=1),v+="("+a+"<"+o+"||u==null)&&v!=null?"+f+":(u>v||v==null)&&u!=null?"+c+":"+u+"!==u&&v===v?"+f+":v!==v&&u===u?"+c+(n<d?":":":0");return i=Function("a","b",v+";"),s&&(i=i.bind(s)),t=t.reduce(function(e,t){return R(t)?(x(t)||[]).forEach(function(t){e[t]=1}):null!=t&&(e[t+""]=1),e},{}),g(i,Object.keys(t))},P=function(t){return R(t)?t:function(){return t}},L=function(e,t){var n,r;function i(){t(r),n=r=null}return function(t){r=t,n&&clearTimeout(n),n=setTimeout(i,e)}},Wt=function(t){for(var e,n,r=1,i=arguments.length;r<i;++r)for(n in e=arguments[r])t[n]=e[n];return t},q=function(t,e){var n,r,i,a,o,u=-1,s=t.length;if(null==e){for(;++u<s;)if(null!=(r=t[u])&&r<=r){n=i=r;break}for(a=o=u;++u<s;)null!=(r=t[u])&&(r<n&&(n=r,a=u),i<r&&(i=r,o=u))}else{for(;++u<s;)if(null!=(r=e(t[u],u,t))&&r<=r){n=i=r;break}for(a=o=u;++u<s;)null!=(r=e(t[u],u,t))&&(r<n&&(n=r,a=u),i<r&&(i=r,o=u))}return[a,o]},U={},F=function(e){var i,a,o={};function n(t){return o.hasOwnProperty(t)&&o[t]!==U}return i={size:0,empty:0,object:o,has:n,get:function(t){return n(t)?o[t]:void 0},set:function(t,e){return n(t)||(++i.size,o[t]===U&&--i.empty),o[t]=e,this},delete:function(t){return n(t)&&(--i.size,++i.empty,o[t]=U),this},clear:function(){i.size=i.empty=0,i.object=o={}},test:function(t){return arguments.length?(a=t,i):a},clean:function(){var t,e,n={},r=0;for(t in o)(e=o[t])===U||a&&a(e)||(n[t]=e,++r);i.size=r,i.empty=0,i.object=o=n}},e&&Object.keys(e).forEach(function(t){i.set(t,e[t])}),i},j=function(t,e){var n=t.prototype=Object.create(e.prototype);return n.constructor=t,n},I=function(t){return"boolean"==typeof t},$=function(t){return"[object Date]"===Object.prototype.toString.call(t)},B=function(t){return"number"==typeof t},W=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},Y=function(t,e){t&&(t=e?Q(t).map(function(t){return t.replace(/\\(.)/g,"$1")}):Q(t));var n=t&&t.length?Function("_","return ''+"+t.map(function(t){return"_["+(e?Z(t):m(t).map(Z).join("]["))+"]"}).join("+'|'+")+";"):function(){return""};return g(n,t,"key")},H=function(t,e,n,r){var i=e.length,a=n.length;if(!a)return e;if(!i)return n;for(var o=r||new e.constructor(i+a),u=0,s=0,f=0;u<i&&s<a;++f)o[f]=0<t(e[u],n[s])?n[s++]:e[u++];for(;u<i;++u,++f)o[f]=e[u];for(;s<a;++s,++f)o[f]=n[s];return o},G=function(t,e){for(var n="";0<=--e;)n+=t;return n},V=function(t,e,n,r){var i=n||" ",a=t+"",o=e-a.length;return o<=0?a:"left"===r?G(i,o)+a:"center"===r?G(i,~~(o/2))+a+G(i,Math.ceil(o/2)):a+G(i,o)},X=function(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t};function K(t){return B(t)?t:$(t)?t:Date.parse(t)}var tt=function(t,e){return e=e||K,null==t||""===t?null:e(t)},et=function(t){return null==t||""===t?null:t+""},nt=function(t){for(var e={},n=0,r=t.length;n<r;++n)e[t[n]]=!0;return e},it=function(t,e,n,r){var i=null!=r?r:"…",a=t+"",o=a.length,u=Math.max(0,e-i.length);return o<=e?a:"left"===n?i+a.slice(o-u):"center"===n?a.slice(0,Math.ceil(u/2))+i+a.slice(o-~~(u/2)):a.slice(0,u)+i},at=function(t,e,n){if(t){var r,i=0,a=t.length;if(e)for(;i<a;++i)(r=e(t[i]))&&n(r,i,t);else t.forEach(n)}};function ot(t){var r=t||c,i=[],a={};return i.add=function(t){var e=r(t);return a[e]||(a[e]=1,i.push(t)),i},i.remove=function(t){var e,n=r(t);return a[n]&&(a[n]=0)<=(e=i.indexOf(t))&&i.splice(e,1),i},i}var ut=Symbol("vega_id"),st=1;function ft(t){return!(!t||!ct(t))}function ct(t){return t[ut]}function lt(t,e){return t[ut]=e,t}function ht(t){var e=t===Object(t)?t:{data:t};return ct(e)?e:lt(e,st++)}function dt(t){return pt(t,ht({}))}function pt(t,e){for(var n in t)e[n]=t[n];return e}function vt(t,e){return lt(e,ct(t))}function gt(t){return t&&t.constructor===mt}function mt(){var c=[],l=[],h=[],d=[],p=[],v=!1;return{constructor:mt,insert:function(t){for(var e=Q(t),n=0,r=e.length;n<r;++n)c.push(e[n]);return this},remove:function(t){for(var e=R(t)?d:l,n=Q(t),r=0,i=n.length;r<i;++r)e.push(n[r]);return this},modify:function(t,e,n){var r={field:e,value:P(n)};return R(t)?(r.filter=t,p.push(r)):(r.tuple=t,h.push(r)),this},encode:function(t,e){return R(t)?p.push({filter:t,field:e}):h.push({tuple:t,field:e}),this},reflow:function(){return v=!0,this},pulse:function(r,t){var i,e,n,a,o,u,s;for(e=0,n=c.length;e<n;++e)r.add.push(ht(c[e]));for(i={},e=0,n=l.length;e<n;++e)i[ct(u=l[e])]=u;for(e=0,n=d.length;e<n;++e)o=d[e],t.forEach(function(t){o(t)&&(i[ct(t)]=t)});for(s in i)r.rem.push(i[s]);function f(t,e,n){n?t[e]=n(t):r.encode=e,v||(i[ct(t)]=t)}for(i={},e=0,n=h.length;e<n;++e)f((a=h[e]).tuple,a.field,a.value),r.modifies(a.field);for(e=0,n=p.length;e<n;++e)a=p[e],o=a.filter,t.forEach(function(t){o(t)&&f(t,a.field,a.value)}),r.modifies(a.field);if(v)r.mod=l.length||d.length?t.filter(function(t){return i.hasOwnProperty(ct(t))}):t.slice();else for(s in i)r.mod.push(i[s]);return r}}}var yt="_:mod:_";function bt(){Object.defineProperty(this,yt,{writable:!0,value:{}})}var _t=bt.prototype;_t.set=function(t,e,n,r){var i=this[t],a=this[yt];return null!=e&&0<=e?(i[e]!==n||r)&&(i[e]=n,a[e+":"+t]=-1,a[t]=-1):(i!==n||r)&&(this[t]=n,a[t]=d(n)?1+n.length:-1),this},_t.modified=function(t,e){var n,r=this[yt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(d(t)){for(n=0;n<t.length;++n)if(r[t[n]])return!0;return!1}return null!=e&&0<=e?e+1<r[t]||!!r[e+":"+t]:!!r[t]},_t.clear=function(){return this[yt]={},this};var xt=0,wt=new bt;function Mt(t,e,n,r){this.id=++xt,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}var kt=Mt.prototype;function Et(n){return function(t){var e=this.flags;return 0===arguments.length?!!(e&n):(this.flags=t?e|n:e&~n,this)}}kt.targets=function(){return this._targets||(this._targets=ot(f))},kt.set=function(t){return this.value!==t?(this.value=t,1):0},kt.skip=Et(1),kt.modified=Et(2),kt.parameters=function(t,r){r=!1!==r;var e,n,i,a,o=this,u=o._argval=o._argval||new bt,s=o._argops=o._argops||[],f=[];function c(t,e,n){n instanceof Mt?(n!==o&&(r&&n.targets().add(o),f.push(n)),s.push({op:n,name:t,index:e})):u.set(t,e,n)}for(e in t)if(n=t[e],"pulse"===e)Q(n).forEach(function(t){t instanceof Mt?t!==o&&(t.targets().add(o),f.push(t)):rt("Pulse parameters must be operator instances.")}),o.source=n;else if(d(n))for(u.set(e,-1,Array(i=n.length)),a=0;a<i;++a)c(e,a,n[a]);else c(e,-1,n);return this.marshall().clear(),f},kt.marshall=function(t){var e,n,r,i,a,o=this._argval||wt,u=this._argops;if(u&&(r=u.length))for(n=0;n<r;++n)a=(i=(e=u[n]).op).modified()&&i.stamp===t,o.set(e.name,e.index,i.value,a);return o},kt.evaluate=function(t){if(this._update){var e=this.marshall(t.stamp),n=this._update(e,t);if(e.clear(),n!==this.value)this.value=n;else if(!this.modified())return t.StopPropagation}},kt.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.stamp=t.stamp,(this.pulse=e)||t);var e};var St=0;function At(t,e,n){this.id=++St,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function Ct(t,e,n){return new At(t,e,n)}var zt=At.prototype;zt._filter=v,zt._apply=c,zt.targets=function(){return this._targets||(this._targets=ot(f))},zt.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},zt.receive=function(t){if(this._filter(t)){for(var e=this.value=this._apply(t),n=this._targets,r=n?n.length:0,i=0;i<r;++i)n[i].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},zt.filter=function(t){var e=Ct(t);return this.targets().add(e),e},zt.apply=function(t){var e=Ct(null,t);return this.targets().add(e),e},zt.merge=function(){var t=Ct();this.targets().add(t);for(var e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},zt.throttle=function(e){var n=-1;return this.filter(function(){var t=Date.now();return e<t-n?(n=t,1):0})},zt.debounce=function(t){var n=Ct();return this.targets().add(Ct(null,null,L(t,function(t){var e=t.dataflow;n.receive(t),e&&e.run&&e.run()}))),n},zt.between=function(t,e){var n=!1;return t.targets().add(Ct(null,null,function(){n=!0})),e.targets().add(Ct(null,null,function(){n=!1})),this.filter(function(){return n})};var Dt="$";function Ot(){}function Nt(t,e){var n=new Ot;if(t instanceof Ot)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==e)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e(r=t[i],i,t),r)}else if(t)for(var o in t)n.set(o,t[o]);return n}Ot.prototype=Nt.prototype={constructor:Ot,has:function(t){return Dt+t in this},get:function(t){return this[Dt+t]},set:function(t,e){return this[Dt+t]=e,this},remove:function(t){var e=Dt+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Dt&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Dt&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Dt&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Dt&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Dt&&++t;return t},empty:function(){for(var t in this)if(t[0]===Dt)return!1;return!0},each:function(t){for(var e in this)e[0]===Dt&&t(this[e],e.slice(1),this)}};var Rt=function(){var h,d,e,p=[],o=[];function v(t,n,r,i){if(n>=p.length)return null!=h&&t.sort(h),null!=d?d(t):t;for(var e,a,o,u=-1,s=t.length,f=p[n++],c=Nt(),l=r();++u<s;)(o=c.get(e=f(a=t[u])+""))?o.push(a):c.set(e,[a]);return c.each(function(t,e){i(l,e,v(t,n,r,i))}),l}return e={object:function(t){return v(t,0,Tt,Pt)},map:function(t){return v(t,0,Lt,qt)},entries:function(t){return function n(t,r){if(++r>p.length)return t;var i,a=o[r-1];return null!=d&&r>=p.length?i=t.entries():(i=[],t.each(function(t,e){i.push({key:e,values:n(t,r)})})),null!=a?i.sort(function(t,e){return a(t.key,e.key)}):i}(v(t,0,Lt,qt),0)},key:function(t){return p.push(t),e},sortKeys:function(t){return o[p.length-1]=t,e},sortValues:function(t){return h=t,e},rollup:function(t){return d=t,e}}};function Tt(){return{}}function Pt(t,e,n){t[e]=n}function Lt(){return Nt()}function qt(t,e,n){t.set(e,n)}function Ut(){}var Ft=Nt.prototype;Ut.prototype=function(t,e){var n=new Ut;if(t instanceof Ut)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r<i;)n.add(t[r]);else for(;++r<i;)n.add(e(t[r],r,t))}return n}.prototype={constructor:Ut,has:Ft.has,add:function(t){return this[Dt+(t+="")]=t,this},remove:Ft.remove,clear:Ft.clear,values:Ft.keys,size:Ft.size,empty:Ft.empty,each:Ft.each};var jt={value:function(){}};function It(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new $t(r)}function $t(t){this._=t}function Bt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Yt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=jt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}$t.prototype=It.prototype={constructor:$t,on:function(t,e){var n,r,i=this._,a=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,u=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<u;)if(n=(t=a[o]).type)i[n]=Yt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Yt(i[n],t.name,null);return this}for(;++o<u;)if((n=(t=a[o]).type)&&(n=Bt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $t(t)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};var Ht=function(i,t){var a,o,u,s,f=It("beforesend","progress","load","error"),c=Nt(),l=new XMLHttpRequest,h=null,d=null,p=0;function e(t){var e,n,r,i=l.status;if(!i&&((r=(n=l).responseType)&&"text"!==r?n.response:n.responseText)||200<=i&&i<300||304===i){if(u)try{e=u.call(a,l)}catch(t){return void f.call("error",a,t)}else e=l;f.call("load",a,e)}else f.call("error",a,t)}if("undefined"==typeof XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(i)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=e:l.onreadystatechange=function(t){3<l.readyState&&e(t)},l.onprogress=function(t){f.call("progress",a,t)},a={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?c.get(t):(null==e?c.remove(t):c.set(t,e+""),a)},mimeType:function(t){return arguments.length?(o=null==t?null:t+"",a):o},responseType:function(t){return arguments.length?(s=t,a):s},timeout:function(t){return arguments.length?(p=+t,a):p},user:function(t){return arguments.length<1?h:(h=null==t?null:t+"",a)},password:function(t){return arguments.length<1?d:(d=null==t?null:t+"",a)},response:function(t){return u=t,a},get:function(t,e){return a.send("GET",t,e)},post:function(t,e){return a.send("POST",t,e)},send:function(t,e,n){var r;return l.open(t,i,!0,h,d),null==o||c.has("accept")||c.set("accept",o+",*/*"),l.setRequestHeader&&c.each(function(t,e){l.setRequestHeader(e,t)}),null!=o&&l.overrideMimeType&&l.overrideMimeType(o),null!=s&&(l.responseType=s),0<p&&(l.timeout=p),null==n&&"function"==typeof e&&(n=e,e=null),null!=n&&1===n.length&&(r=n,n=function(t,e){r(null==t?e:null)}),null!=n&&a.on("error",n).on("load",function(t){n(null,t)}),f.call("beforesend",a,l),l.send(null==e?null:e),a},abort:function(){return l.abort(),a},on:function(){var t=f.on.apply(f,arguments);return t===f?a:t}},null!=t){if("function"!=typeof t)throw new Error("invalid callback: "+t);return a.get(t)}return a};var Gt={},Vt={},Xt=34,Jt=10,Zt=13;function Qt(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}var Kt=function(a){var e=new RegExp('["'+a+"\n\r]"),l=a.charCodeAt(0);function n(r,t){var e,n=[],i=r.length,a=0,o=0,u=i<=0,s=!1;function f(){if(u)return Vt;if(s)return s=!1,Gt;var t,e,n=a;if(r.charCodeAt(n)===Xt){for(;a++<i&&r.charCodeAt(a)!==Xt||r.charCodeAt(++a)===Xt;);return(t=a)>=i?u=!0:(e=r.charCodeAt(a++))===Jt?s=!0:e===Zt&&(s=!0,r.charCodeAt(a)===Jt&&++a),r.slice(n+1,t-1).replace(/""/g,'"')}for(;a<i;){if((e=r.charCodeAt(t=a++))===Jt)s=!0;else if(e===Zt)s=!0,r.charCodeAt(a)===Jt&&++a;else if(e!==l)continue;return r.slice(n,t)}return u=!0,r.slice(n,i)}for(r.charCodeAt(i-1)===Jt&&--i,r.charCodeAt(i-1)===Zt&&--i;(e=f())!==Vt;){for(var c=[];e!==Gt&&e!==Vt;)c.push(e),e=f();t&&null==(c=t(c,o++))||n.push(c)}return n}function r(t){return t.map(o).join(a)}function o(t){return null==t?"":e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,a){var o,u,e=n(t,function(t,e){if(o)return o(t,e-1);var n,r,i;u=t,o=a?(r=a,i=Qt(n=t),function(t,e){return r(i(t),e,n)}):Qt(t)});return e.columns=u||[],e},parseRows:n,format:function(t,n){var e,r,i;return null==n&&(e=t,r=Object.create(null),i=[],e.forEach(function(t){for(var e in t)e in r||i.push(r[e]=e)}),n=i),[n.map(o).join(a)].concat(t.map(function(e){return n.map(function(t){return o(e[t])}).join(a)})).join("\n")},formatRows:function(t){return t.map(r).join("\n")}}},te=(Kt(","),Kt("\t"),/^([A-Za-z]+:)?\/\//),ee="file://",ne=["mimeType","responseType","user","password"],re=function(t){return{options:t||{},sanitize:oe,load:ae,file:se,http:ue}};function ie(t,e){return Wt({},t.options,e)}function ae(t,n){var r=this;return r.sanitize(t,n).then(function(t){var e=t.href;return t.localFile?r.file(e):r.http(e,n)})}function oe(u,s){return s=ie(this,s),new Promise(function(t,e){var n,r,i,a,o={href:null};null!=u&&"string"==typeof u?(r=te.test(u),(a=s.baseURL)&&!r&&(ce(u,"/")||"/"===a[a.length-1]||(u="/"+u),u=a+u),i=(n=ce(u,ee))||"file"===s.mode||"http"!==s.mode&&!r&&fe(),n?u=u.slice(ee.length):ce(u,"//")&&("file"===s.defaultProtocol?(u=u.slice(2),i=!0):u=(s.defaultProtocol||"http")+":"+u),Object.defineProperty(o,"localFile",{value:!!i}),o.href=u,s.target&&(o.target=s.target+""),t(o)):e("Sanitize failure, invalid URI: "+Z(u))})}function ue(i,a){return a=ie(this,a),new Promise(function(n,r){var t,e=Ht(i);for(t in a.headers)e.header(t,a.headers[t]);ne.forEach(function(t){a[t]&&e[t](a[t])}),e.on("error",function(t){r(t||"Error loading URL: "+i)}).on("load",function(t){var e=t&&t.responseText;t&&0!==t.status?n(e):r(e||"Error")}).get()})}function se(e){return new Promise(function(n,r){var t=fe();t?t.readFile(e,function(t,e){t?r(t):n(e)}):r("No file system access for "+e)})}function fe(){var t="function"==typeof require&&require("fs");return t&&R(t.readFile)?t:null}function ce(t,e){return null!=t&&0===t.lastIndexOf(e,0)}var le={boolean:X,integer:S,number:S,date:tt,string:et,unknown:c},he=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return ge(t)&&(t=+t)==~~t},ge,function(t){return!isNaN(Date.parse(t))}],de=["boolean","integer","number","date"];function pe(t,e){if(!t||!t.length)return"unknown";var n,r,i,a,o,u=he.slice();for(r=0,i=t.length;r<i;++r){for(n=e?t[r][e]:t[r],a=0;a<u.length;++a)null==(o=n)||o!=o||u[a](n)||(u.splice(a,1),--a);if(0===u.length)return"string"}return de[he.indexOf(u[0])]}function ve(n,t){return t.reduce(function(t,e){return t[e]=pe(n,e),t},{})}function ge(t){return!(isNaN(+t)||t instanceof Date)}function me(r){return function(t,e){var n={delimiter:r};return ye(t,e?Wt(e,n):n)}}function ye(t,e){return e.header&&(t=e.header.map(Z).join(e.delimiter)+"\n"+t),Kt(e.delimiter).parse(t+"")}var be=function(t,e){var n,r,i,a=e&&e.property?l(e.property):c;return!J(t)||(i=t,"function"==typeof Buffer&&R(Buffer.isBuffer)&&Buffer.isBuffer(i))?a(JSON.parse(t)):(n=a(t),r&&r.copy?JSON.parse(JSON.stringify(n)):n)};var _e=function(t){return t},xe=function(t){if(null==t)return _e;var a,o,u=t.scale[0],s=t.scale[1],f=t.translate[0],c=t.translate[1];return function(t,e){e||(a=o=0);var n=2,r=t.length,i=new Array(r);for(i[0]=(a+=t[0])*u+f,i[1]=(o+=t[1])*s+c;n<r;)i[n]=t[n],++n;return i}},we=function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n},Me=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return ke(e,t)})}:ke(e,t)};function ke(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,a=Ee(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:a}:null==r?{type:"Feature",id:n,properties:i,geometry:a}:{type:"Feature",id:n,bbox:r,properties:i,geometry:a}}function Ee(t,e){var a=xe(t.transform),o=t.arcs;function i(t,e){e.length&&e.pop();for(var n=o[t<0?~t:t],r=0,i=n.length;r<i;++r)e.push(a(n[r],r));t<0&&we(e,i)}function u(t){return a(t)}function s(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function n(t){for(var e=s(t);e.length<4;)e.push(e[0]);return e}function f(t){return t.map(n)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=u(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(u);break;case"LineString":n=s(e.arcs);break;case"MultiLineString":n=e.arcs.map(s);break;case"Polygon":n=f(e.arcs);break;case"MultiPolygon":n=e.arcs.map(f);break;default:return null}return{type:r,coordinates:n}}(e)}var Se=function(s,i){var a={},f={},c={},o=[],u=-1;function t(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach(function(t){a[t<0?~t:t]=1}),o.push(r)}}return i.forEach(function(t,e){var n,r=s.arcs[t<0?~t:t];r.length<3&&!r[1][0]&&!r[1][1]&&(n=i[++u],i[u]=t,i[e]=n)}),i.forEach(function(t){var e,n,r=function(t){var e,n=s.arcs[t<0?~t:t],r=n[0];s.transform?(e=[0,0],n.forEach(function(t){e[0]+=t[0],e[1]+=t[1]})):e=n[n.length-1];return t<0?[e,r]:[r,e]}(t),i=r[0],a=r[1];if(e=c[i])if(delete c[e.end],e.push(t),e.end=a,n=f[a]){delete f[n.start];var o=n===e?e:e.concat(n);f[o.start=e.start]=c[o.end=n.end]=o}else f[e.start]=c[e.end]=e;else if(e=f[a])if(delete f[e.start],e.unshift(t),e.start=i,n=c[i]){delete c[n.end];var u=n===e?e:n.concat(e);f[u.start=n.start]=c[u.end=e.end]=u}else f[e.start]=c[e.end]=e;else f[(e=[t]).start=i]=c[e.end=a]=e}),t(c,f),t(f,c),i.forEach(function(t){a[t<0?~t:t]||o.push([t])}),o},Ae=function(t){return Ee(t,function(t,e,n){var r,i,a;if(1<arguments.length)r=function(t,e,n){var r,i=[],a=[];function o(t){var e=t<0?~t:t;(a[e]||(a[e]=[])).push({i:t,g:r})}function u(t){t.forEach(o)}function s(t){t.forEach(u)}return function t(e){switch((r=e).type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":u(e.arcs);break;case"MultiLineString":case"Polygon":s(e.arcs);break;case"MultiPolygon":e.arcs.forEach(s)}}(e),a.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,n);else for(i=0,r=new Array(a=t.arcs.length);i<a;++i)r[i]=i;return{type:"MultiLineString",arcs:Se(t,r)}}.apply(this,arguments))};var Ce={dsv:ye,csv:me(","),tsv:me("\t"),json:be,topojson:function(t,e){var n,r,i;return t=be(t,e),n=e&&(i=e.feature)?Me:e&&(i=e.mesh)?Ae:rt("Missing TopoJSON feature or mesh parameter."),(r=(r=t.objects[i])?n(t,r):rt("Invalid TopoJSON object: "+i))&&r.features||[r]}},ze=function(t,e){return 1<arguments.length?(Ce[t]=e,this):Ce.hasOwnProperty(t)?Ce[t]:null},De=new Date,Oe=new Date;function Ne(a,o,n,r){function u(t){return a(t=new Date(+t)),t}return(u.floor=u).ceil=function(t){return a(t=new Date(t-1)),o(t,1),a(t),t},u.round=function(t){var e=u(t),n=u.ceil(t);return t-e<n-t?e:n},u.offset=function(t,e){return o(t=new Date(+t),null==e?1:Math.floor(e)),t},u.range=function(t,e,n){var r,i=[];if(t=u.ceil(t),n=null==n?1:Math.floor(n),!(t<e&&0<n))return i;for(;i.push(r=new Date(+t)),o(t,n),a(t),r<t&&t<e;);return i},u.filter=function(n){return Ne(function(t){if(t<=t)for(;a(t),!n(t);)t.setTime(t-1)},function(t,e){if(t<=t)if(e<0)for(;++e<=0;)for(;o(t,-1),!n(t););else for(;0<=--e;)for(;o(t,1),!n(t););})},n&&(u.count=function(t,e){return De.setTime(+t),Oe.setTime(+e),a(De),a(Oe),Math.floor(n(De,Oe))},u.every=function(e){return e=Math.floor(e),isFinite(e)&&0<e?1<e?u.filter(r?function(t){return r(t)%e==0}:function(t){return u.count(0,t)%e==0}):u:null}),u}var Re=Ne(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});Re.every=function(n){return n=Math.floor(n),isFinite(n)&&0<n?1<n?Ne(function(t){t.setTime(Math.floor(t/n)*n)},function(t,e){t.setTime(+t+e*n)},function(t,e){return(e-t)/n}):Re:null};var Te=6e4,Pe=36e5,Le=6048e5,qe=Ne(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}),Ue=Ne(function(t){t.setTime(Math.floor(t/Te)*Te)},function(t,e){t.setTime(+t+e*Te)},function(t,e){return(e-t)/Te},function(t){return t.getMinutes()}),Fe=Ne(function(t){var e=t.getTimezoneOffset()*Te%Pe;e<0&&(e+=Pe),t.setTime(Math.floor((+t-e)/Pe)*Pe+e)},function(t,e){t.setTime(+t+e*Pe)},function(t,e){return(e-t)/Pe},function(t){return t.getHours()}),je=Ne(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Te)/864e5},function(t){return t.getDate()-1});function Ie(e){return Ne(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Te)/Le})}var $e=Ie(0),Be=Ie(1),We=(Ie(2),Ie(3),Ie(4)),Ye=(Ie(5),Ie(6),Ne(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()})),He=Ne(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});He.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Ne(function(t){t.setFullYear(Math.floor(t.getFullYear()/n)*n),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e*n)}):null};var Ge=Ne(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*Te)},function(t,e){return(e-t)/Te},function(t){return t.getUTCMinutes()}),Ve=Ne(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+e*Pe)},function(t,e){return(e-t)/Pe},function(t){return t.getUTCHours()}),Xe=Ne(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1});function Je(e){return Ne(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/Le})}var Ze=Je(0),Qe=Je(1),Ke=(Je(2),Je(3),Je(4)),tn=(Je(5),Je(6),Ne(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()})),en=Ne(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});function nn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function rn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function an(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}en.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Ne(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/n)*n),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e*n)}):null};var on,un,sn,fn,cn,ln={"-":"",_:" ",0:"0"},hn=/^\s*\d+/,dn=/^%/,pn=/[\\^$*+?|[\]().{}]/g;function vn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function gn(t){return t.replace(pn,"\\$&")}function mn(t){return new RegExp("^(?:"+t.map(gn).join("|")+")","i")}function yn(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function bn(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function _n(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function xn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function wn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Mn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function kn(t,e,n){var r=hn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function En(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(68<+r[0]?1900:2e3),n+r[0].length):-1}function Sn(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function An(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Cn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Dn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function On(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Nn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Rn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Tn(t,e,n){var r=hn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Pn(t,e,n){var r=dn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ln(t,e,n){var r=hn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function qn(t,e,n){var r=hn.exec(e.slice(n));return r?(t.Q=1e3*+r[0],n+r[0].length):-1}function Un(t,e){return vn(t.getDate(),e,2)}function Fn(t,e){return vn(t.getHours(),e,2)}function jn(t,e){return vn(t.getHours()%12||12,e,2)}function In(t,e){return vn(1+je.count(He(t),t),e,3)}function $n(t,e){return vn(t.getMilliseconds(),e,3)}function Bn(t,e){return $n(t,e)+"000"}function Wn(t,e){return vn(t.getMonth()+1,e,2)}function Yn(t,e){return vn(t.getMinutes(),e,2)}function Hn(t,e){return vn(t.getSeconds(),e,2)}function Gn(t){var e=t.getDay();return 0===e?7:e}function Vn(t,e){return vn($e.count(He(t),t),e,2)}function Xn(t,e){var n=t.getDay();return t=4<=n||0===n?We(t):We.ceil(t),vn(We.count(He(t),t)+(4===He(t).getDay()),e,2)}function Jn(t){return t.getDay()}function Zn(t,e){return vn(Be.count(He(t),t),e,2)}function Qn(t,e){return vn(t.getFullYear()%100,e,2)}function Kn(t,e){return vn(t.getFullYear()%1e4,e,4)}function tr(t){var e=t.getTimezoneOffset();return(0<e?"-":(e*=-1,"+"))+vn(e/60|0,"0",2)+vn(e%60,"0",2)}function er(t,e){return vn(t.getUTCDate(),e,2)}function nr(t,e){return vn(t.getUTCHours(),e,2)}function rr(t,e){return vn(t.getUTCHours()%12||12,e,2)}function ir(t,e){return vn(1+Xe.count(en(t),t),e,3)}function ar(t,e){return vn(t.getUTCMilliseconds(),e,3)}function or(t,e){return ar(t,e)+"000"}function ur(t,e){return vn(t.getUTCMonth()+1,e,2)}function sr(t,e){return vn(t.getUTCMinutes(),e,2)}function fr(t,e){return vn(t.getUTCSeconds(),e,2)}function cr(t){var e=t.getUTCDay();return 0===e?7:e}function lr(t,e){return vn(Ze.count(en(t),t),e,2)}function hr(t,e){var n=t.getUTCDay();return t=4<=n||0===n?Ke(t):Ke.ceil(t),vn(Ke.count(en(t),t)+(4===en(t).getUTCDay()),e,2)}function dr(t){return t.getUTCDay()}function pr(t,e){return vn(Qe.count(en(t),t),e,2)}function vr(t,e){return vn(t.getUTCFullYear()%100,e,2)}function gr(t,e){return vn(t.getUTCFullYear()%1e4,e,4)}function mr(){return"+0000"}function yr(){return"%"}function br(t){return+t}function _r(t){return Math.floor(+t/1e3)}function xr(t){return on=function(t){var r=t.dateTime,i=t.date,a=t.time,e=t.periods,n=t.days,o=t.shortDays,u=t.months,s=t.shortMonths,f=mn(e),c=yn(e),l=mn(n),h=yn(n),d=mn(o),p=yn(o),v=mn(u),g=yn(u),m=mn(s),y=yn(s),b={a:function(t){return o[t.getDay()]},A:function(t){return n[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Un,e:Un,f:Bn,H:Fn,I:jn,j:In,L:$n,m:Wn,M:Yn,p:function(t){return e[+(12<=t.getHours())]},Q:br,s:_r,S:Hn,u:Gn,U:Vn,V:Xn,w:Jn,W:Zn,x:null,X:null,y:Qn,Y:Kn,Z:tr,"%":yr},_={a:function(t){return o[t.getUTCDay()]},A:function(t){return n[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:er,e:er,f:or,H:nr,I:rr,j:ir,L:ar,m:ur,M:sr,p:function(t){return e[+(12<=t.getUTCHours())]},Q:br,s:_r,S:fr,u:cr,U:lr,V:hr,w:dr,W:pr,x:null,X:null,y:vr,Y:gr,Z:mr,"%":yr},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,e,n){return k(t,r,e,n)},d:Cn,e:Cn,f:Tn,H:Dn,I:Dn,j:zn,L:Rn,m:An,M:On,p:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},Q:Ln,s:qn,S:Nn,u:_n,U:xn,V:wn,w:bn,W:Mn,x:function(t,e,n){return k(t,i,e,n)},X:function(t,e,n){return k(t,a,e,n)},y:En,Y:kn,Z:Sn,"%":Pn};function w(s,f){return function(t){var e,n,r,i=[],a=-1,o=0,u=s.length;for(t instanceof Date||(t=new Date(+t));++a<u;)37===s.charCodeAt(a)&&(i.push(s.slice(o,a)),null!=(n=ln[e=s.charAt(++a)])?e=s.charAt(++a):n="e"===e?" ":"0",(r=f[e])&&(e=r(t,n)),i.push(e),o=a+1);return i.push(s.slice(o,a)),i.join("")}}function M(i,a){return function(t){var e,n,r=an(1900);if(k(r,i,t+="",0)!=t.length)return null;if("Q"in r)return new Date(r.Q);if("p"in r&&(r.H=r.H%12+12*r.p),"V"in r){if(r.V<1||53<r.V)return null;"w"in r||(r.w=1),"Z"in r?(e=4<(n=(e=rn(an(r.y))).getUTCDay())||0===n?Qe.ceil(e):Qe(e),e=Xe.offset(e,7*(r.V-1)),r.y=e.getUTCFullYear(),r.m=e.getUTCMonth(),r.d=e.getUTCDate()+(r.w+6)%7):(e=4<(n=(e=a(an(r.y))).getDay())||0===n?Be.ceil(e):Be(e),e=je.offset(e,7*(r.V-1)),r.y=e.getFullYear(),r.m=e.getMonth(),r.d=e.getDate()+(r.w+6)%7)}else("W"in r||"U"in r)&&("w"in r||(r.w="u"in r?r.u%7:"W"in r?1:0),n="Z"in r?rn(an(r.y)).getUTCDay():a(an(r.y)).getDay(),r.m=0,r.d="W"in r?(r.w+6)%7+7*r.W-(n+5)%7:r.w+7*r.U-(n+6)%7);return"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,rn(r)):a(r)}}function k(t,e,n,r){for(var i,a,o=0,u=e.length,s=n.length;o<u;){if(s<=r)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=x[i in ln?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(i,b),b.X=w(a,b),b.c=w(r,b),_.x=w(i,_),_.X=w(a,_),_.c=w(r,_),{format:function(t){var e=w(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",nn);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t,rn);return e.toString=function(){return t},e}}}(t),un=on.format,sn=on.parse,fn=on.utcFormat,cn=on.utcParse,on}xr({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 wr="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||fn(wr);+new Date("2000-01-01T00:00:00.000Z")||cn(wr);var Mr=function(t,e,n){var r=ze((e=e||{}).type||"json");return r||rt("Unknown data format type: "+e.type),t=r(t,e),e.parse&&function(t,i,a){if(!t.length)return;a=a||sn;var e,n,r,o,u,s,f,c=t.columns||Object.keys(t[0]);"auto"===i&&(i=ve(t,c));for(c=Object.keys(i),e=c.map(function(t){var e,n,r=i[t];if(r&&(0===r.indexOf("date:")||0===r.indexOf("utc:")))return("'"===(n=(e=r.split(/:(.+)?/,2))[1])[0]&&"'"===n[n.length-1]||'"'===n[0]&&'"'===n[n.length-1])&&(n=n.slice(1,-1)),"utc"===e[0]?cn(n):a(n);if(!le[r])throw Error("Illegal format pattern: "+t+":"+r);return le[r]}),o=0,s=t.length,f=c.length;o<s;++o)for(n=t[o],u=0;u<f;++u)r=c[u],n[r]=e[u](n[r])}(t,e.parse,n),t.hasOwnProperty("columns")&&delete t.columns,t};var kr={skip:!0};function Er(r,t,i,e,n,a){var o,u,s=Wt({},a,kr);R(i)||(i=P(i)),void 0===e?o=function(t){r.touch(i(t))}:R(e)?(u=new Mt(null,e,n,!1),o=function(t){var e,n=i(t);u.evaluate(t),gt(e=u.value)?r.pulse(n,e,a):r.update(n,e,s)}):o=function(t){r.update(i(t),e,s)},t.apply(o)}function Sr(t,e,r,n,i,a){var o,u;void 0===n?u=r:(o=R(n)?n:P(n),(u=new Mt(null,n=r?function(t,e){var n=o(t,e);return r.skip()?n:r.skip(!0).value=n}:o,i,!1)).modified(a&&a.force),u.rank=0,r&&(u.skip(!0),u.value=r.value,u.targets().add(r))),e.targets().add(u)}var Ar={};function Cr(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}var zr=Cr.prototype;function Dr(n,r){return n?function(t,e){return n(t,e)&&r(t,e)}:r}function Or(t,e){var n=[];return at(t,e,function(t){n.push(t)}),n}function Nr(t,e){var n={};return t.visit(e,function(t){n[ct(t)]=1}),function(t){return n[ct(t)]?null:t}}function Rr(t,e,n,r){var i,a,o,u,s,f=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,o=0,u=(this.pulses=n).length;o<u;++o)if((i=n[o]).stamp===e){if(i.fields)for(s in a=this.fields||(this.fields={}),i.fields)a[s]=1;i.changed(this.ADD)&&(f|=this.ADD),i.changed(this.REM)&&(f|=this.REM),i.changed(this.MOD)&&(f|=this.MOD)}this.changes=f}zr.StopPropagation=Ar,zr.ADD=1,zr.REM=2,zr.MOD=4,zr.ADD_REM=3,zr.ADD_MOD=5,zr.ALL=7,zr.REFLOW=8,zr.SOURCE=16,zr.NO_SOURCE=32,zr.NO_FIELDS=64,zr.fork=function(t){return new Cr(this.dataflow).init(this,t)},zr.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length&&((t=new Cr(this.dataflow).init(this)).add=t.source),t},zr.init=function(t,e){var n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source),n},zr.runAfter=function(t){this.dataflow.runAfter(t)},zr.changed=function(t){var e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},zr.reflow=function(t){if(t)return this.fork(7).reflow();var e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,Nr(this,1))),this},zr.modifies=function(t){var e=Q(t),n=this.fields||(this.fields={});return e.forEach(function(t){n[t]=!0}),this},zr.modified=function(t){var e=this.fields;return!(!this.mod.length||!e)&&(arguments.length?d(t)?t.some(function(t){return e[t]}):e[t]:!!e)},zr.filter=function(t,e){return 1&t&&(this.addF=Dr(this.addF,e)),2&t&&(this.remF=Dr(this.remF,e)),4&t&&(this.modF=Dr(this.modF,e)),16&t&&(this.srcF=Dr(this.srcF,e)),this},zr.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=Or(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Or(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Or(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},zr.visit=function(t,e){var n,r,i=this,a=e;return 16&t?at(i.source,i.srcF,a):(1&t&&at(i.add,i.addF,a),2&t&&at(i.rem,i.remF,a),4&t&&at(i.mod,i.modF,a),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||at(n,r?Nr(i,5):i.srcF,a))),i};var Tr=j(Rr,Cr);function Pr(e,t){try{t(e)}catch(t){e.error(t)}}Tr.fork=function(t){var e=new Cr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,function(t){return e.add.push(t)}),t&e.REM&&this.visit(e.REM,function(t){return e.rem.push(t)}),t&e.MOD&&this.visit(e.MOD,function(t){return e.mod.push(t)})),e},Tr.changed=function(t){return this.changes&t},Tr.modified=function(t){var e=this.fields;return e&&this.changes&this.MOD?d(t)?t.some(function(t){return e[t]}):e[t]:0},Tr.filter=function(){rt("MultiPulse does not support filtering.")},Tr.materialize=function(){rt("MultiPulse does not support materialization.")},Tr.visit=function(t,e){var n=this.pulses,r=n.length,i=0;if(t&this.SOURCE)for(;i<r;++i)n[i].visit(t,e);else for(;i<r;++i)n[i].stamp===this.stamp&&n[i].visit(t,e);return this};var Lr={skip:!1,force:!1};function qr(t){this.cmp=t,this.nodes=[]}var Ur=qr.prototype;function Fr(t,e,n,r){var i,a,o;for(i=t[n];e<n&&r(i,a=t[o=n-1>>1])<0;)t[n]=a,n=o;return t[n]=i}function jr(t,e,n){for(var r,i=e,a=t.length,o=t[e],u=2*e+1;u<a;)(r=u+1)<a&&0<=n(t[u],t[r])&&(u=r),t[e]=t[u],u=2*(e=u)+1;return t[e]=o,Fr(t,i,e,n)}function Ir(){this._log=e(),this.logLevel(r),this._clock=0,this._rank=0;try{this._loader=re()}catch(t){}this._touched=ot(f),this._pulses={},this._pulse=null,this._heap=new qr(function(t,e){return t.qrank-e.qrank}),this._postrun=[]}Ur.size=function(){return this.nodes.length},Ur.clear=function(){return this.nodes=[],this},Ur.peek=function(){return this.nodes[0]},Ur.push=function(t){var e=this.nodes;return e.push(t),Fr(e,0,e.length-1,this.cmp)},Ur.pop=function(){var t,e=this.nodes,n=e.pop();return e.length?(t=e[0],e[0]=n,jr(e,0,this.cmp)):t=n,t},Ur.replace=function(t){var e=this.nodes,n=e[0];return e[0]=t,jr(e,0,this.cmp),n},Ur.pushpop=function(t){var e=this.nodes,n=e[0];return e.length&&this.cmp(n,t)<0&&(e[0]=t,t=n,jr(e,0,this.cmp)),t};var $r=Ir.prototype;function Br(t){return function(){return this._log[t].apply(this,arguments)}}function Wr(t,e){Mt.call(this,t,null,e)}$r.stamp=function(){return this._clock},$r.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},$r.cleanThreshold=1e4,$r.add=function(t,e,n,r){var i,a=1;return t instanceof Mt?i=t:t&&t.prototype instanceof Mt?i=new t:R(t)?i=new Mt(null,t):(a=0,i=new Mt(t,e)),this.rank(i),a&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},$r.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n<r;++n)if(i<e[n].rank)return void this.rerank(t)},$r.rank=function(t){t.rank=++this._rank},$r.rerank=function(t){for(var e,n,r,i=[t];i.length;)if(this.rank(e=i.pop()),n=e._targets)for(r=n.length;0<=--r;)i.push(e=n[r]),e===t&&rt("Cycle detected in dataflow graph.")},$r.pulse=function(t,e,n){this.touch(t,n||Lr);var r=new Cr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._pulses[t.id]=e.pulse(r,i),this},$r.touch=function(t,e){var n=e||Lr;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},$r.update=function(t,e,n){var r=n||Lr;return(t.set(e)||r.force)&&this.touch(t,r),this},$r.changeset=mt,$r.ingest=function(t,e,n){return this.pulse(t,this.changeset().insert(Mr(e,n)))},$r.request=function(e,n,r){var t,i,a,o,u=this,s=u._pending||(t=u,(o=new Promise(function(t,e){i=t,a=e})).requests=0,o.done=function(){0==--o.requests&&t.runAfter(function(){t._pending=null;try{t.run(),i(t)}catch(t){a(t)}})},t._pending=o);s.requests+=1,u.loader().load(n,{context:"dataflow"}).then(function(t){u.ingest(e,t,r)},function(t){u.error("Loading failed",n,t)}).catch(function(t){u.error("Data ingestion failed",n,t)}).then(s.done,s.done)},$r.events=function(t,e,n,r){for(var i,a=this,o=Ct(n,r),u=function(t){t.dataflow=a;try{o.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,f=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):Q(t)).length;s<f;++s)i[s].addEventListener(e,u);return o},$r.on=function(t,e,n,r,i){return(t instanceof Mt?Sr:Er)(this,t,e,n,r,i),this},$r.run=function(t){var e,n,r,i,a=this,o=0,u=a.logLevel();if(a._pending)return a.info("Awaiting requests, delaying dataflow run."),0;if(a._pulse)return a.error("Dataflow invoked recursively. Use the runAfter method to queue invocation."),0;if(!a._touched.length)return a.info("Dataflow invoked, but nothing to do."),0;a._pulse=new Cr(a,++a._clock,t),_<=u&&(r=Date.now(),a.debug("-- START PROPAGATION ("+a._clock+") -----")),a._touched.forEach(function(t){a._enqueue(t,!0)}),a._touched=ot(f);try{for(;0<a._heap.size();)(e=a._heap.pop()).rank===e.qrank?(n=e.run(a._getPulse(e,t)),k<=u&&a.debug(e.id,n===Ar?"STOP":n,e),n!==Ar&&(a._pulse=n,e._targets&&e._targets.forEach(function(t){a._enqueue(t)})),++o):a._enqueue(e,!0)}catch(t){i=t}if(a._pulses={},a._pulse=null,_<=u&&(r=Date.now()-r,a.info("> Pulse "+a._clock+": "+o+" operators; "+r+"ms")),i&&(a._postrun=[],a.error(i)),a._onrun)try{a._onrun(a,o,i)}catch(t){a.error(t)}if(a._postrun.length){var s=a._postrun;a._postrun=[],s.sort(function(t,e){return e.priority-t.priority}).forEach(function(t){Pr(a,t.callback)})}return o},$r.runAsync=function(){return this._pending||Promise.resolve(this.run())},$r.runAfter=function(t,e,n){this._pulse||e?this._postrun.push({priority:n||0,callback:t}):Pr(this,t)},$r._enqueue=function(t,e){var n=!this._pulses[t.id];n&&(this._pulses[t.id]=this._pulse),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},$r._getPulse=function(t,e){var n,r=t.source,i=this._clock;return r&&d(r)?new Rr(this,i,n=r.map(function(t){return t.pulse}),e):(n=this._pulses[t.id],r&&((r=r.pulse)&&r!==Ar?r.stamp===i&&n.target!==t?n=r:n.source=r.source:n.source=[]),n)},$r.error=Br("error"),$r.warn=Br("warn"),$r.info=Br("info"),$r.debug=Br("debug"),$r.logLevel=Br("level");var Yr=j(Wr,Mt);Yr.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?this.skip(!1):e=this.evaluate(t),(e=e||t)!==t.StopPropagation&&(this.pulse=e),this.stamp=t.stamp,e);var e},Yr.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Yr.transform=function(){};var Hr={};function Gr(t){var e=Vr(t);return e&&e.Definition||null}function Vr(t){return t=t&&t.toLowerCase(),Hr.hasOwnProperty(t)?Hr[t]:null}function Xr(t){return t&&t.length?1===t.length?t[0]:(i=t,function(t){for(var e=i.length,n=1,r=String(i[0](t));n<e;++n)r+="|"+i[n](t);return r}):function(){return""};var i}function Jr(t,e,n){return n||t+(e?"_"+e:"")}var Zr={values:ti({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:ti({name:"count",set:"cell.num"}),__count__:ti({name:"count",set:"this.missing + this.valid"}),missing:ti({name:"missing",set:"this.missing"}),valid:ti({name:"valid",set:"this.valid"}),sum:ti({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:ti({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:ti({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:ti({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:ti({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:ti({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:ti({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),stderr:ti({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : 0",req:["variance"],idx:2}),distinct:ti({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:ti({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:ti({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:ti({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:ti({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:ti({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:ti({name:"argmin",init:"this.argmin = null;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:ti({name:"argmax",init:"this.argmax = null;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:ti({name:"min",init:"this.min = null;",add:"if (v < this.min || this.min === null) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:ti({name:"max",init:"this.max = null;",add:"if (v > this.max || this.max === null) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"]