gridviz-smoothing 1.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gridviz-smoothing.js +10982 -10655
- package/dist/gridviz-smoothing.min.js +1 -1
- package/package.json +6 -6
- package/src/KernelSmoothingStyle.js +26 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.gviz_sm=n():t.gviz_sm=n()}(self,(()=>(()=>{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};function e(){}function r(t){return null==t?e:function(){return this.querySelector(t)}}function i(){return[]}function o(t){return null==t?i:function(){return this.querySelectorAll(t)}}function a(t){return function(){return this.matches(t)}}function s(t){return function(n){return n.matches(t)}}t.r(n),t.d(n,{KernelSmoothingStyle:()=>fr});var u=Array.prototype.find;function c(){return this.firstElementChild}var l=Array.prototype.filter;function h(){return Array.from(this.children)}function f(t){return new Array(t.length)}function p(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function d(t,n,e,r,i,o){for(var a,s=0,u=n.length,c=o.length;s<c;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new p(t,o[s]);for(;s<u;++s)(a=n[s])&&(i[s]=a)}function m(t,n,e,r,i,o,a){var s,u,c,l=new Map,h=n.length,f=o.length,d=new Array(h);for(s=0;s<h;++s)(u=n[s])&&(d[s]=c=a.call(u,u.__data__,s,n)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=a.call(t,o[s],s,o)+"",(u=l.get(c))?(r[s]=u,u.__data__=o[s],l.delete(c)):e[s]=new p(t,o[s]);for(s=0;s<h;++s)(u=n[s])&&l.get(d[s])===u&&(i[s]=u)}function v(t){return t.__data__}function y(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function g(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}p.prototype={constructor:p,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var w="http://www.w3.org/1999/xhtml";const _={svg:"http://www.w3.org/2000/svg",xhtml:w,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function x(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),_.hasOwnProperty(n)?{space:_[n],local:t}:t}function b(t){return function(){this.removeAttribute(t)}}function M(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,n){return function(){this.setAttribute(t,n)}}function k(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function E(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function A(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function N(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function z(t){return function(){this.style.removeProperty(t)}}function T(t,n,e){return function(){this.style.setProperty(t,n,e)}}function C(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function $(t,n){return t.style.getPropertyValue(n)||N(t).getComputedStyle(t,null).getPropertyValue(n)}function P(t){return function(){delete this[t]}}function Z(t,n){return function(){this[t]=n}}function O(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function j(t){return t.trim().split(/^|\s+/)}function X(t){return t.classList||new F(t)}function F(t){this._node=t,this._names=j(t.getAttribute("class")||"")}function Y(t,n){for(var e=X(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function G(t,n){for(var e=X(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function R(t){return function(){Y(this,t)}}function q(t){return function(){G(this,t)}}function I(t,n){return function(){(n.apply(this,arguments)?Y:G)(this,t)}}function B(){this.textContent=""}function D(t){return function(){this.textContent=t}}function L(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function H(){this.innerHTML=""}function V(t){return function(){this.innerHTML=t}}function U(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function K(){this.nextSibling&&this.parentNode.appendChild(this)}function W(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===w&&n.documentElement.namespaceURI===w?n.createElement(t):n.createElementNS(e,t)}}function J(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tt(t){var n=x(t);return(n.local?J:Q)(n)}function nt(){return null}function et(){var t=this.parentNode;t&&t.removeChild(this)}function rt(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function it(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ot(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function at(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function st(t,n,e){var r=N(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ut(t,n){return function(){return st(this,t,n)}}function ct(t,n){return function(){return st(this,t,n.apply(this,arguments))}}F.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lt=[null];function ht(t,n){this._groups=t,this._parents=n}function ft(){return new ht([[document.documentElement]],lt)}ht.prototype=ft.prototype={constructor:ht,select:function(t){"function"!=typeof t&&(t=r(t));for(var n=this._groups,e=n.length,i=new Array(e),o=0;o<e;++o)for(var a,s,u=n[o],c=u.length,l=i[o]=new Array(c),h=0;h<c;++h)(a=u[h])&&(s=t.call(a,a.__data__,h,u))&&("__data__"in a&&(s.__data__=a.__data__),l[h]=s);return new ht(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(n=t.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(t):o(t);for(var n=this._groups,e=n.length,r=[],i=[],a=0;a<e;++a)for(var s,u=n[a],c=u.length,l=0;l<c;++l)(s=u[l])&&(r.push(t.call(s,s.__data__,l,u)),i.push(s));return new ht(r,i)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return u.call(this.children,t)}}("function"==typeof t?t:s(t)))},selectChildren:function(t){return this.selectAll(null==t?h:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:s(t)))},filter:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,s=n[i],u=s.length,c=r[i]=[],l=0;l<u;++l)(o=s[l])&&t.call(o,o.__data__,l,s)&&c.push(o);return new ht(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,v);var e,r=n?m:d,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,s=new Array(a),u=new Array(a),c=new Array(a),l=0;l<a;++l){var h=i[l],f=o[l],p=f.length,g=y(t.call(h,h&&h.__data__,l,i)),w=g.length,_=u[l]=new Array(w),x=s[l]=new Array(w);r(h,f,_,x,c[l]=new Array(p),g,n);for(var b,M,S=0,k=0;S<w;++S)if(b=_[S]){for(S>=k&&(k=S+1);!(M=x[k])&&++k<w;);b._next=M||null}}return(s=new ht(s,i))._enter=u,s._exit=c,s},enter:function(){return new ht(this._enter||this._groups.map(f),this._parents)},exit:function(){return new ht(this._exit||this._groups.map(f),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u<a;++u)for(var c,l=e[u],h=r[u],f=l.length,p=s[u]=new Array(f),d=0;d<f;++d)(c=l[d]||h[d])&&(p[d]=c);for(;u<i;++u)s[u]=e[u];return new ht(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=g);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,s=e[o],u=s.length,c=i[o]=new Array(u),l=0;l<u;++l)(a=s[l])&&(c[l]=a);c.sort(n)}return new ht(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=x(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?M:b:"function"==typeof n?e.local?A:E:e.local?k:S)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?z:"function"==typeof n?C:T)(t,n,null==e?"":e)):$(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?P:"function"==typeof n?O:Z)(t,n)):this.node()[t]},classed:function(t,n){var e=j(t+"");if(arguments.length<2){for(var r=X(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?I:n?R:q)(e,n))},text:function(t){return arguments.length?this.each(null==t?B:("function"==typeof t?L:D)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?H:("function"==typeof t?U:V)(t)):this.node().innerHTML},raise:function(){return this.each(K)},lower:function(){return this.each(W)},append:function(t){var n="function"==typeof t?t:tt(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:tt(t),i=null==n?nt:"function"==typeof n?n:r(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(et)},clone:function(t){return this.select(t?it:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=n?at:ot,r=0;r<a;++r)this.each(s(o[r],n,e));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(r=0,u=s[c];r<a;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,n){return this.each(("function"==typeof n?ct:ut)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const pt=ft;function dt(t){return"string"==typeof t?new ht([[document.querySelector(t)]],[document.documentElement]):new ht([[t]],lt)}var mt={value:()=>{}};function vt(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new yt(r)}function yt(t){this._=t}function gt(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function wt(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=mt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}yt.prototype=vt.prototype={constructor:yt,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<s;)if(e=(t=o[a]).type)i[e]=wt(i[e],t.name,n);else if(null==n)for(e in i)i[e]=wt(i[e],t.name,null);return this}for(;++a<s;)if((e=(t=o[a]).type)&&(e=gt(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new yt(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};const _t=vt,xt={capture:!0,passive:!1};function bt(t){t.preventDefault(),t.stopImmediatePropagation()}function Mt(t){return((t=Math.exp(t))+1/t)/2}const St=function t(n,e,r){function i(t,i){var o,a,s=t[0],u=t[1],c=t[2],l=i[0],h=i[1],f=i[2],p=l-s,d=h-u,m=p*p+d*d;if(m<1e-12)a=Math.log(f/c)/n,o=function(t){return[s+t*p,u+t*d,c*Math.exp(n*t*a)]};else{var v=Math.sqrt(m),y=(f*f-c*c+r*m)/(2*c*e*v),g=(f*f-c*c-r*m)/(2*f*e*v),w=Math.log(Math.sqrt(y*y+1)-y),_=Math.log(Math.sqrt(g*g+1)-g);a=(_-w)/n,o=function(t){var r,i=t*a,o=Mt(w),l=c/(e*v)*(o*(r=n*i+w,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(w));return[s+l*p,u+l*d,c*o/Mt(n*i+w)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function kt(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}var Et,At,Nt=0,zt=0,Tt=0,Ct=1e3,$t=0,Pt=0,Zt=0,Ot="object"==typeof performance&&performance.now?performance:Date,jt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Xt(){return Pt||(jt(Ft),Pt=Ot.now()+Zt)}function Ft(){Pt=0}function Yt(){this._call=this._time=this._next=null}function Gt(t,n,e){var r=new Yt;return r.restart(t,n,e),r}function Rt(){Pt=($t=Ot.now())+Zt,Nt=zt=0;try{!function(){Xt(),++Nt;for(var t,n=Et;n;)(t=Pt-n._time)>=0&&n._call.call(void 0,t),n=n._next;--Nt}()}finally{Nt=0,function(){for(var t,n,e=Et,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Et=n);At=t,It(r)}(),Pt=0}}function qt(){var t=Ot.now(),n=t-$t;n>Ct&&(Zt-=n,$t=t)}function It(t){Nt||(zt&&(zt=clearTimeout(zt)),t-Pt>24?(t<1/0&&(zt=setTimeout(Rt,t-Ot.now()-Zt)),Tt&&(Tt=clearInterval(Tt))):(Tt||($t=Ot.now(),Tt=setInterval(qt,Ct)),Nt=1,jt(Rt)))}function Bt(t,n,e){var r=new Yt;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Yt.prototype=Gt.prototype={constructor:Yt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Xt():+e)+(null==n?0:+n),this._next||At===this||(At?At._next=this:Et=this,At=this),this._call=t,this._time=e,It()},stop:function(){this._call&&(this._call=null,this._time=1/0,It())}};var Dt=_t("start","end","cancel","interrupt"),Lt=[],Ht=0,Vt=2,Ut=3,Kt=5,Wt=6;function Qt(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(u){var c,l,h,f;if(1!==e.state)return s();for(c in i)if((f=i[c]).name===e.name){if(f.state===Ut)return Bt(o);4===f.state?(f.state=Wt,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c<n&&(f.state=Wt,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[c])}if(Bt((function(){e.state===Ut&&(e.state=4,e.timer.restart(a,e.delay,e.time),a(u))})),e.state=Vt,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Vt){for(e.state=Ut,r=new Array(h=e.tween.length),c=0,l=-1;c<h;++c)(f=e.tween[c].value.call(t,t.__data__,e.index,e.group))&&(r[++l]=f);r.length=l+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(s),e.state=Kt,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);e.state===Kt&&(e.on.call("end",t,t.__data__,e.index,e.group),s())}function s(){for(var r in e.state=Wt,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=Gt((function(t){e.state=1,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)}),0,e.time)}(t,e,{name:n,index:r,group:i,on:Dt,tween:Lt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ht})}function Jt(t,n){var e=nn(t,n);if(e.state>Ht)throw new Error("too late; already scheduled");return e}function tn(t,n){var e=nn(t,n);if(e.state>Ut)throw new Error("too late; already running");return e}function nn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function en(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Vt&&e.state<Kt,e.state=Wt,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function rn(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var on,an=180/Math.PI,sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function un(t,n,e,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(u=t*e+n*r)&&(e-=t*u,r-=n*u),(s=Math.sqrt(e*e+r*r))&&(e/=s,r/=s,u/=s),t*r<n*e&&(t=-t,n=-n,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*an,skewX:Math.atan(u)*an,scaleX:a,scaleY:s}}function cn(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,n,null,e);s.push({i:u-4,x:rn(t,i)},{i:u-2,x:rn(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:rn(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,s,u),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:rn(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,s,u),function(t,n,e,r,o,a){if(t!==e||n!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:rn(t,e)},{i:s-2,x:rn(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var n,e=-1,r=u.length;++e<r;)s[(n=u[e]).i]=n.x(t);return s.join("")}}}var ln=cn((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?sn:un(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),hn=cn((function(t){return null==t?sn:(on||(on=document.createElementNS("http://www.w3.org/2000/svg","g")),on.setAttribute("transform",t),(t=on.transform.baseVal.consolidate())?un((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):sn)}),", ",")",")");function fn(t,n){var e,r;return function(){var i=tn(this,t),o=i.tween;if(o!==e)for(var a=0,s=(r=e=o).length;a<s;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}function pn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=tn(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:n,value:e},u=0,c=i.length;u<c;++u)if(i[u].name===n){i[u]=s;break}u===c&&i.push(s)}o.tween=i}}function dn(t,n,e){var r=t._id;return t.each((function(){var t=tn(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return nn(t,r).value[n]}}function mn(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function vn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function yn(){}var gn=.7,wn=1/gn,_n="\\s*([+-]?\\d+)\\s*",xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mn=/^#([0-9a-f]{3,8})$/,Sn=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),kn=new RegExp(`^rgb\\(${bn},${bn},${bn}\\)$`),En=new RegExp(`^rgba\\(${_n},${_n},${_n},${xn}\\)$`),An=new RegExp(`^rgba\\(${bn},${bn},${bn},${xn}\\)$`),Nn=new RegExp(`^hsl\\(${xn},${bn},${bn}\\)$`),zn=new RegExp(`^hsla\\(${xn},${bn},${bn},${xn}\\)$`),Tn={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 Cn(){return this.rgb().formatHex()}function $n(){return this.rgb().formatRgb()}function Pn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Mn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Zn(n):3===e?new Xn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?On(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?On(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Sn.exec(t))?new Xn(n[1],n[2],n[3],1):(n=kn.exec(t))?new Xn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=En.exec(t))?On(n[1],n[2],n[3],n[4]):(n=An.exec(t))?On(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Nn.exec(t))?In(n[1],n[2]/100,n[3]/100,1):(n=zn.exec(t))?In(n[1],n[2]/100,n[3]/100,n[4]):Tn.hasOwnProperty(t)?Zn(Tn[t]):"transparent"===t?new Xn(NaN,NaN,NaN,0):null}function Zn(t){return new Xn(t>>16&255,t>>8&255,255&t,1)}function On(t,n,e,r){return r<=0&&(t=n=e=NaN),new Xn(t,n,e,r)}function jn(t,n,e,r){return 1===arguments.length?((i=t)instanceof yn||(i=Pn(i)),i?new Xn((i=i.rgb()).r,i.g,i.b,i.opacity):new Xn):new Xn(t,n,e,null==r?1:r);var i}function Xn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Fn(){return`#${qn(this.r)}${qn(this.g)}${qn(this.b)}`}function Yn(){const t=Gn(this.opacity);return`${1===t?"rgb(":"rgba("}${Rn(this.r)}, ${Rn(this.g)}, ${Rn(this.b)}${1===t?")":`, ${t})`}`}function Gn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Rn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function qn(t){return((t=Rn(t))<16?"0":"")+t.toString(16)}function In(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Dn(t,n,e,r)}function Bn(t){if(t instanceof Dn)return new Dn(t.h,t.s,t.l,t.opacity);if(t instanceof yn||(t=Pn(t)),!t)return new Dn;if(t instanceof Dn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Dn(a,s,u,t.opacity)}function Dn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ln(t){return(t=(t||0)%360)<0?t+360:t}function Hn(t){return Math.max(0,Math.min(1,t||0))}function Vn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function Un(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}mn(yn,Pn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Cn,formatHex:Cn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Bn(this).formatHsl()},formatRgb:$n,toString:$n}),mn(Xn,jn,vn(yn,{brighter(t){return t=null==t?wn:Math.pow(wn,t),new Xn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?gn:Math.pow(gn,t),new Xn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Xn(Rn(this.r),Rn(this.g),Rn(this.b),Gn(this.opacity))},displayable(){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:Fn,formatHex:Fn,formatHex8:function(){return`#${qn(this.r)}${qn(this.g)}${qn(this.b)}${qn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Yn,toString:Yn})),mn(Dn,(function(t,n,e,r){return 1===arguments.length?Bn(t):new Dn(t,n,e,null==r?1:r)}),vn(yn,{brighter(t){return t=null==t?wn:Math.pow(wn,t),new Dn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?gn:Math.pow(gn,t),new Dn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Xn(Vn(t>=240?t-240:t+120,i,r),Vn(t,i,r),Vn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Dn(Ln(this.h),Hn(this.s),Hn(this.l),Gn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Gn(this.opacity);return`${1===t?"hsl(":"hsla("}${Ln(this.h)}, ${100*Hn(this.s)}%, ${100*Hn(this.l)}%${1===t?")":`, ${t})`}`}}));const Kn=t=>()=>t;function Wn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Kn(isNaN(t)?n:t)}const Qn=function t(n){var e=function(t){return 1==(t=+t)?Wn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Kn(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=jn(t)).r,(n=jn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Wn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Jn(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),s=new Array(i);for(e=0;e<i;++e)r=jn(n[e]),o[e]=r.r||0,a[e]=r.g||0,s[e]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}Jn((function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<n-1?t[r+2]:2*o-i;return Un((e-r/n)*n,a,i,o,s)}})),Jn((function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],s=t[(r+2)%n];return Un((e-r/n)*n,i,o,a,s)}}));var te=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ne=new RegExp(te.source,"g");function ee(t,n){var e,r,i,o=te.lastIndex=ne.lastIndex=0,a=-1,s=[],u=[];for(t+="",n+="";(e=te.exec(t))&&(r=ne.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:rn(e,r)})),o=ne.lastIndex;return o<n.length&&(i=n.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?function(t){return function(n){return t(n)+""}}(u[0].x):function(t){return function(){return t}}(n):(n=u.length,function(t){for(var e,r=0;r<n;++r)s[(e=u[r]).i]=e.x(t);return s.join("")})}function re(t,n){var e;return("number"==typeof n?rn:n instanceof Pn?Qn:(e=Pn(n))?(n=e,Qn):ee)(t,n)}function ie(t){return function(){this.removeAttribute(t)}}function oe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ae(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}}function se(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}function ue(t,n,e){var r,i,o;return function(){var a,s,u=e(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=n(r=a,u));this.removeAttribute(t)}}function ce(t,n,e){var r,i,o;return function(){var a,s,u=e(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=n(r=a,u));this.removeAttributeNS(t.space,t.local)}}function le(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}(t,i)),e}return i._value=n,i}function he(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}(t,i)),e}return i._value=n,i}function fe(t,n){return function(){Jt(this,t).delay=+n.apply(this,arguments)}}function pe(t,n){return n=+n,function(){Jt(this,t).delay=n}}function de(t,n){return function(){tn(this,t).duration=+n.apply(this,arguments)}}function me(t,n){return n=+n,function(){tn(this,t).duration=n}}var ve=pt.prototype.constructor;function ye(t){return function(){this.style.removeProperty(t)}}var ge=0;function we(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function _e(){return++ge}var xe=pt.prototype;we.prototype=function(t){return pt().transition(t)}.prototype={constructor:we,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=r(t));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s<o;++s)for(var u,c,l=i[s],h=l.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=l[p])&&(c=t.call(u,u.__data__,p,l))&&("__data__"in u&&(c.__data__=u.__data__),f[p]=c,Qt(f[p],n,e,p,f,nn(u,e)));return new we(a,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=o(t));for(var r=this._groups,i=r.length,a=[],s=[],u=0;u<i;++u)for(var c,l=r[u],h=l.length,f=0;f<h;++f)if(c=l[f]){for(var p,d=t.call(c,c.__data__,f,l),m=nn(c,e),v=0,y=d.length;v<y;++v)(p=d[v])&&Qt(p,n,e,v,d,m);a.push(d),s.push(c)}return new we(a,s,n,e)},selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,s=n[i],u=s.length,c=r[i]=[],l=0;l<u;++l)(o=s[l])&&t.call(o,o.__data__,l,s)&&c.push(o);return new we(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,c=n[s],l=e[s],h=c.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=c[p]||l[p])&&(f[p]=u);for(;s<r;++s)a[s]=n[s];return new we(a,this._parents,this._name,this._id)},selection:function(){return new ve(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=_e(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,c=0;c<u;++c)if(a=s[c]){var l=nn(a,n);Qt(a,t,e,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new we(r,this._parents,t,e)},call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:function(t,n){var e=this._id;return arguments.length<2?nn(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Jt:tn;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=x(t),r="transform"===e?hn:re;return this.attrTween(t,"function"==typeof n?(e.local?ce:ue)(e,r,dn(this,"attr."+t,n)):null==n?(e.local?oe:ie)(e):(e.local?se:ae)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=x(t);return this.tween(e,(r.local?le:he)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?ln:re;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=$(this,t),a=(this.style.removeProperty(t),$(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,ye(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=$(this,t),s=e(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=$(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}}(t,r,dn(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,s="end."+a;return function(){var u=tn(this,t),c=u.on,l=null==u.value[a]?o||(o=ye(n)):void 0;c===e&&i===l||(r=(e=c).copy()).on(s,i=l),u.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=$(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(dn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=nn(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?fn:pn)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?fe:pe)(n,t)):nn(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?de:me)(n,t)):nn(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){tn(this,t).ease=n}}(n,t)):nn(this.node(),n).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,n){return function(){var e=n.apply(this,arguments);if("function"!=typeof e)throw new Error;tn(this,t).ease=e}}(this._id,t))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,a){var s={value:a},u={value:function(){0==--i&&o()}};e.each((function(){var e=tn(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(s),n._.interrupt.push(s),n._.end.push(u)),e.on=n})),0===i&&o()}))},[Symbol.iterator]:xe[Symbol.iterator]};var be={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Me(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}pt.prototype.interrupt=function(t){return this.each((function(){en(this,t)}))},pt.prototype.transition=function(t){var n,e;t instanceof we?(n=t._id,t=t._name):(n=_e(),(e=be).time=Xt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,c=0;c<u;++c)(a=s[c])&&Qt(a,t,n,c,s,e||Me(a,n));return new we(r,this._parents,t,n)};const Se=t=>()=>t;function ke(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ee(t,n,e){this.k=t,this.x=n,this.y=e}Ee.prototype={constructor:Ee,scale:function(t){return 1===t?this:new Ee(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Ee(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ae=new Ee(1,0,0);function Ne(t){t.stopImmediatePropagation()}function ze(t){t.preventDefault(),t.stopImmediatePropagation()}function Te(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Ce(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function $e(){return this.__zoom||Ae}function Pe(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ze(){return navigator.maxTouchPoints||"ontouchstart"in this}function Oe(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Ee.prototype;class je{constructor(t,n,e,r){this.opts=r||{},this.canvas=t,this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.canvas.width=this.w,this.canvas.height=this.h;const i=this.canvas.getContext("2d");if(!i)throw"Impossible to create canvas 2D context";if(this.ctx=i,this.center=n||{x:.5*this.w,y:.5*this.h},this.zf=e,this.backgroundColor=r.backgroundColor||"white",this.onZoomStartFun=r.onZoomStartFun,this.onZoomEndFun=r.onZoomEndFun,this.onZoomFun=r.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!r.disableZoom){let t=Ae;(function(){var t,n,e,r=Te,i=Ce,o=Oe,a=Pe,s=Ze,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,h=St,f=_t("start","zoom","end"),p=500,d=150,m=0,v=10;function y(t){t.property("__zoom",$e).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",E).filter(s).on("touchstart.zoom",A).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(t,n){return(n=Math.max(u[0],Math.min(u[1],n)))===t.k?t:new Ee(n,t.x,t.y)}function w(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new Ee(t.k,r,i)}function _(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function x(t,n,e,r){t.on("start.zoom",(function(){b(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=b(t,o).event(r),s=i.apply(t,o),u=null==e?_(s):"function"==typeof e?e.apply(t,o):e,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=t.__zoom,f="function"==typeof n?n.apply(t,o):n,p=h(l.invert(u).concat(c/l.k),f.invert(u).concat(c/f.k));return function(t){if(1===t)t=f;else{var n=p(t),e=c/n[2];t=new Ee(e,u[0]-n[0]*e,u[1]-n[1]*e)}a.zoom(null,t)}}))}function b(t,n,e){return!e&&t.__zooming||new M(t,n)}function M(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,n),this.taps=0}function S(t,...n){if(r.apply(this,arguments)){var e=b(this,n).event(t),i=this.__zoom,s=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,a.apply(this,arguments)))),l=kt(t);if(e.wheel)e.mouse[0][0]===l[0]&&e.mouse[0][1]===l[1]||(e.mouse[1]=i.invert(e.mouse[0]=l)),clearTimeout(e.wheel);else{if(i.k===s)return;e.mouse=[l,i.invert(l)],en(this),e.start()}ze(t),e.wheel=setTimeout((function(){e.wheel=null,e.end()}),d),e.zoom("mouse",o(w(g(i,s),e.mouse[0],e.mouse[1]),e.extent,c))}}function k(t,...n){if(!e&&r.apply(this,arguments)){var i=t.currentTarget,a=b(this,n,!0).event(t),s=dt(t.view).on("mousemove.zoom",(function(t){if(ze(t),!a.moved){var n=t.clientX-l,e=t.clientY-h;a.moved=n*n+e*e>m}a.event(t).zoom("mouse",o(w(a.that.__zoom,a.mouse[0]=kt(t,i),a.mouse[1]),a.extent,c))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,n){var e=t.document.documentElement,r=dt(t).on("dragstart.drag",null);n&&(r.on("click.drag",bt,xt),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,a.moved),ze(t),a.event(t).end()}),!0),u=kt(t,i),l=t.clientX,h=t.clientY;!function(t){var n=t.document.documentElement,e=dt(t).on("dragstart.drag",bt,xt);"onselectstart"in n?e.on("selectstart.drag",bt,xt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(t.view),Ne(t),a.mouse=[u,this.__zoom.invert(u)],en(this),a.start()}}function E(t,...n){if(r.apply(this,arguments)){var e=this.__zoom,a=kt(t.changedTouches?t.changedTouches[0]:t,this),s=e.invert(a),u=e.k*(t.shiftKey?.5:2),h=o(w(g(e,u),a,s),i.apply(this,n),c);ze(t),l>0?dt(this).transition().duration(l).call(x,h,a,t):dt(this).call(y.transform,h,a,t)}}function A(e,...i){if(r.apply(this,arguments)){var o,a,s,u,c=e.touches,l=c.length,h=b(this,i,e.changedTouches.length===l).event(e);for(Ne(e),a=0;a<l;++a)u=[u=kt(s=c[a],this),this.__zoom.invert(u),s.identifier],h.touch0?h.touch1||h.touch0[2]===u[2]||(h.touch1=u,h.taps=0):(h.touch0=u,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(n=u[0],t=setTimeout((function(){t=null}),p)),en(this),h.start())}}function N(t,...n){if(this.__zooming){var e,r,i,a,s=b(this,n).event(t),u=t.changedTouches,l=u.length;for(ze(t),e=0;e<l;++e)i=kt(r=u[e],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var h=s.touch0[0],f=s.touch0[1],p=s.touch1[0],d=s.touch1[1],m=(m=p[0]-h[0])*m+(m=p[1]-h[1])*m,v=(v=d[0]-f[0])*v+(v=d[1]-f[1])*v;r=g(r,Math.sqrt(m/v)),i=[(h[0]+p[0])/2,(h[1]+p[1])/2],a=[(f[0]+d[0])/2,(f[1]+d[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],a=s.touch0[1]}s.zoom("touch",o(w(r,i,a),s.extent,c))}}function z(t,...r){if(this.__zooming){var i,o,a=b(this,r).event(t),s=t.changedTouches,u=s.length;for(Ne(t),e&&clearTimeout(e),e=setTimeout((function(){e=null}),p),i=0;i<u;++i)o=s[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=kt(o,this),Math.hypot(n[0]-o[0],n[1]-o[1])<v)){var c=dt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return y.transform=function(t,n,e,r){var i=t.selection?t.selection():t;i.property("__zoom",$e),t!==i?x(t,n,e,r):i.interrupt().each((function(){b(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(t,n,e,r){y.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),e,r)},y.scaleTo=function(t,n,e,r){y.transform(t,(function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==e?_(t):"function"==typeof e?e.apply(this,arguments):e,s=r.invert(a),u="function"==typeof n?n.apply(this,arguments):n;return o(w(g(r,u),a,s),t,c)}),e,r)},y.translateBy=function(t,n,e,r){y.transform(t,(function(){return o(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),i.apply(this,arguments),c)}),null,r)},y.translateTo=function(t,n,e,r,a){y.transform(t,(function(){var t=i.apply(this,arguments),a=this.__zoom,s=null==r?_(t):"function"==typeof r?r.apply(this,arguments):r;return o(Ae.translate(s[0],s[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,c)}),r,a)},M.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var n=dt(this.that).datum();f.call(t,this.that,new ke(t,{sourceEvent:this.sourceEvent,target:y,type:t,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:Se(+t),y):a},y.filter=function(t){return arguments.length?(r="function"==typeof t?t:Se(!!t),y):r},y.touchable=function(t){return arguments.length?(s="function"==typeof t?t:Se(!!t),y):s},y.extent=function(t){return arguments.length?(i="function"==typeof t?t:Se([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):i},y.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],y):[u[0],u[1]]},y.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],y):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},y.constrain=function(t){return arguments.length?(o=t,y):o},y.duration=function(t){return arguments.length?(l=+t,y):l},y.interpolate=function(t){return arguments.length?(h=t,y):h},y.on=function(){var t=f.on.apply(f,arguments);return t===f?y:t},y.clickDistance=function(t){return arguments.length?(m=(t=+t)*t,y):Math.sqrt(m)},y.tapDistance=function(t){return arguments.length?(v=+t,y):v},y})().wheelDelta((t=>-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004))).on("zoom",(n=>{const e=n.transform,r=t.k/e.k;if(1==r){const n=t.x-e.x,r=t.y-e.y;this.pan(n*this.getZf(),-r*this.getZf())}else{const t=n.sourceEvent;if(t instanceof WheelEvent)this.zoom(r,this.pixToGeoX(n.sourceEvent.offsetX),this.pixToGeoY(n.sourceEvent.offsetY));else if(t instanceof TouchEvent){let n=0,e=0;for(let r of t.targetTouches)n+=r.clientX,e+=r.clientY;n/=t.targetTouches.length,e/=t.targetTouches.length,this.zoom(r,this.pixToGeoX(n),this.pixToGeoY(e))}}t=e,this.onZoomFun&&this.onZoomFun(n)})).on("start",(t=>{this.canvasSave.c=document.createElement("canvas"),this.canvasSave.c.setAttribute("width",""+this.w),this.canvasSave.c.setAttribute("height",""+this.h),this.canvasSave.c.getContext("2d").drawImage(this.canvas,0,0),this.canvasSave.dx=0,this.canvasSave.dy=0,this.canvasSave.f=1,this.onZoomStartFun&&this.onZoomStartFun(t)})).on("end",(t=>{this.redraw(!0),this.canvasSave={c:null,dx:0,dy:0,f:1},this.onZoomEndFun&&this.onZoomEndFun(t)}))(dt(this.canvas))}this.zfExtent=[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}setCenter(t){this.center=t}getCenter(){return this.center}setZf(t){this.zf=t,this.slider&&this.slider.attr("value",+this.zf)}getZf(){return this.zf}setZfExtent(t){this.zfExtent=t}getZfExtent(){return this.zfExtent}initCanvasTransform(){this.ctx.setTransform(1,0,0,1,0,0)}setCanvasTransform(){const t=1/this.getZf(),n=-this.center.x/this.getZf()+.5*this.w,e=this.center.y/this.getZf()+.5*this.h;this.ctx.setTransform(t,0,0,-t,n,e)}getWebGLTransform(){const t=2/(this.w*this.getZf()),n=2/(this.h*this.getZf());return[t,0,0,0,n,0,-t*this.center.x,-n*this.center.y,1]}redraw(t=!0){throw new Error("Method redraw not implemented.")}clear(t="white"){this.opts.transparentBackground?this.ctx.clearRect(0,0,this.w,this.h):(this.ctx&&(this.ctx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h))}pan(t=0,n=0){this.center.x+=t,this.center.y+=n,this.updateExtentGeo(),this.canvasSave.c&&(this.canvasSave.dx-=t/this.getZf(),this.canvasSave.dy+=n/this.getZf(),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy))}zoom(t=1,n=this.center.x,e=this.center.y){if(this.zfExtent[0]==this.getZf()&&t<=1)return;if(this.zfExtent[1]==this.getZf()&&t>=1)return;const r=t*this.getZf();r<this.zfExtent[0]&&(t=this.zfExtent[0]/this.getZf()),r>this.zfExtent[1]&&(t=this.zfExtent[1]/this.getZf()),this.setZf(t*this.getZf());const i=(n-this.center.x)*(1-t);this.center.x+=i;const o=(e-this.center.y)*(1-t);this.center.y+=o,this.updateExtentGeo(),this.canvasSave.c&&(this.clear(this.backgroundColor),this.canvasSave.f/=t,this.canvasSave.dx=this.geoToPixX(n)*(1-this.canvasSave.f),this.canvasSave.dy=this.geoToPixY(e)*(1-this.canvasSave.f),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy,this.canvasSave.f*this.canvasSave.c.width,this.canvasSave.f*this.canvasSave.c.height))}updateExtentGeo(t=20){return this.extGeo={xMin:this.pixToGeoX(-t),xMax:this.pixToGeoX(this.w+t),yMin:this.pixToGeoY(this.h+t),yMax:this.pixToGeoY(-t)},this.extGeo}toDraw(t){return!(t.x<this.extGeo.xMin||t.x>this.extGeo.xMax||t.y<this.extGeo.yMin||t.y>this.extGeo.yMax)}geoToPixX(t){return(t-this.center.x)/this.getZf()+.5*this.w}geoToPixY(t){return-(t-this.center.y)/this.getZf()+.5*this.h}pixToGeoX(t){return(t-.5*this.w)*this.getZf()+this.center.x}pixToGeoY(t){return-(t-.5*this.h)*this.getZf()+this.center.y}setViewFromURL(){const t=je.getParameterByName("x"),n=je.getParameterByName("y"),e=je.getParameterByName("z"),r=this.getCenter();null==t||null==t||isNaN(+t)||(r.x=+t),null==n||null==n||isNaN(+n)||(r.y=+n),null==e||null==e||isNaN(+e)||this.setZf(+e)}addZoomSlider(t,n){(n=n||{}).width=n.width||"30px",n.height=n.height||"300px";const e=dt("#"+t);if(e.empty())return console.error("Could not find div element to build zoom slider. Id: "+t),this;const r=this;return this.slider=e.append("input").attr("type","range").attr("min",this.getZfExtent()[0]).attr("max",this.getZfExtent()[1]).attr("value",this.getZf()).on("input",(function(t){if(!this||!this.value)return;const n=+this.value;dt(this).attr("value",n),r.setZf(n),r.redraw()})).style("width",n.width).style("height",n.height).style("opacity",.7).on("mouseover",(function(t){dt(this).style("opacity",1)})).on("mouseout",(function(t){dt(this).style("opacity",.7)})).style("-webkit-appearance","slider-vertical").style("writing-mode","bt-lr").attr("orient","vertical").style("background","lightgray").style("outline","none").style("-webkit-transition",".2s").style("transition","opacity .2s"),this}static getParameterByName(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return n?decodeURIComponent(n[1].replace(/\+/g," ")):null}}class Xe{constructor(t){if(t=t||{},this.filter=t.filter||(()=>!0),this.offset=t.offset||((t,n,e)=>({dx:0,dy:0})),this.visible=!1!==t.visible,this.alpha=t.alpha,this.blendOperation=t.blendOperation||(t=>"normal"),this.minZoom=t.minZoom||0,this.maxZoom=t.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.legends=[]}draw(t,n,e){throw new Error("Method draw not implemented.")}getOffset(){return this.offset}setOffset(t){return this.offset=t,this}updateLegends(t){for(const n of this.legends)n.update(t);return this}static getStatistics(t,n,e){if(!t||0==t.length)return;let r=1/0,i=-1/0;for(const o of t){const t=+n(o);e&&!t||(t<r&&(r=t),t>i&&(i=t))}return{min:r,max:i}}}function Fe(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}var Ye,Ge=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Re(t){if(!(n=Ge.exec(t)))throw new Error("invalid format: "+t);var n;return new qe({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function qe(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Ie(t,n){var e=Fe(t,n);if(!e)return t+"";var r=e[0],i=e[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")}Re.prototype=qe.prototype,qe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Be={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Ie(100*t,n),r:Ie,s:function(t,n){var e=Fe(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Ye=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")+Fe(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function De(t){return t}var Le,He=Array.prototype.map,Ve=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ue(t){return Le=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?De:(n=He.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=n[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?De:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(He.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=Re(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,m=t.comma,v=t.precision,y=t.trim,g=t.type;"n"===g?(m=!0,g="g"):Be[g]||(void 0===v&&(v=12),y=!0,g="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var w="$"===f?i:"#"===f&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",_="$"===f?o:/[%p]/.test(g)?u:"",x=Be[g],b=/[defgprs%]/.test(g);function M(t){var i,o,u,f=w,M=_;if("c"===g)M=x(t)+M,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),v),y&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),S&&0==+t&&"+"!==h&&(S=!1),f=(S?"("===h?h:c:"-"===h||"("===h?"":h)+f,M=("s"===g?Ve[8+Ye/3]:"")+M+(S&&"("===h?")":""),b)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var k=f.length+t.length+M.length,E=k<d?new Array(d-k+1).join(n):"";switch(m&&p&&(t=r(E+t,E.length?d-M.length:1/0),E=""),e){case"<":t=f+t+M+E;break;case"=":t=f+E+t+M;break;case"^":t=E.slice(0,k=E.length>>1)+f+t+M+E.slice(k);break;default:t=E+f+t+M}return s(t)}return v=void 0===v?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e,r=h(((t=Re(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((e=n,((e=Fe(Math.abs(e)))?e[1]:NaN)/3)))),o=Math.pow(10,-i),a=Ve[8+i/3];return function(t){return r(o*t)+a}}}}(t),Le.format,Le.formatPrefix,Le}function Ke(t,n){return null==t?n:"function"==typeof t?t:n=>n[t]}function We(t,n=!1){const e=new Float64Array(5),r=new Float64Array(4);!function(t,n,e){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/e),o=Math.exp(-1.723/e),a=.6318/e,s=1.997/e,u=Float64Array.of(-i*Math.cos(a),i*Math.sin(a),-i*Math.cos(-a),i*Math.sin(-a),-o*Math.cos(s),o*Math.sin(s),-o*Math.cos(-s),o*Math.sin(-s)),c=2.5066282746310007*e,l=Float64Array.of(r[0],r[1],0,0,0,0,0,0),h=Float64Array.of(1,0,u[0],u[1],0,0,0,0,0,0);let f,p;for(p=2;p<8;p+=2){for(l[p]=u[p]*l[p-2]-u[p+1]*l[p-1],l[p+1]=u[p]*l[p-1]+u[p+1]*l[p-2],f=p-2;f>0;f-=2)l[f]+=u[p]*l[f-2]-u[p+1]*l[f-1],l[f+1]+=u[p]*l[f-1]+u[p+1]*l[f-2];for(f=0;f<=p;f+=2)l[f]+=r[p]*h[f]-r[p+1]*h[f+1],l[f+1]+=r[p]*h[f+1]+r[p+1]*h[f];for(h[p+2]=u[p]*h[p]-u[p+1]*h[p+1],h[p+3]=u[p]*h[p+1]+u[p+1]*h[p],f=p;f>0;f-=2)h[f]+=u[p]*h[f-2]-u[p+1]*h[f-1],h[f+1]+=u[p]*h[f-1]+u[p+1]*h[f-2]}for(p=0;p<4;++p)f=p<<1,n[p]=l[f]/c,t[p+1]=h[f+2]}(e,r,t);const i=Float64Array.of(0,r[1]-e[1]*r[0],r[2]-e[2]*r[0],r[3]-e[3]*r[0],-e[4]*r[0]),o=1+e[1]+e[2]+e[3]+e[4];return{sigma:t,negative:n,a:e,b_causal:r,b_anticausal:i,sum_causal:(r[0]+r[1]+r[2]+r[3])/o,sum_anticausal:(i[1]+i[2]+i[3]+i[4])/o}}function Qe(t,n,e,r=1,i=new Float64Array(e),o=new Float64Array(e),a=new Float64Array(5),s=i,u=Je){const c=2*r,l=3*r,h=4*r,f=r*e;let p,d;for(u(i,n,e,r,t.b_causal,3,t.a,4,t.sum_causal,a,t.sigma),d=4,p=h;d<e;++d,p+=r)i[d]=t.b_causal[0]*n[p]+t.b_causal[1]*n[p-r]+t.b_causal[2]*n[p-c]+t.b_causal[3]*n[p-l]-t.a[1]*i[d-1]-t.a[2]*i[d-2]-t.a[3]*i[d-3]-t.a[4]*i[d-4];for(u(o,n,e,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,a,t.sigma),d=4,p=f-5*r;d<e;++d,p-=r)o[d]=t.b_anticausal[1]*n[p+r]+t.b_anticausal[2]*n[p+c]+t.b_anticausal[3]*n[p+l]+t.b_anticausal[4]*n[p+h]-t.a[1]*o[d-1]-t.a[2]*o[d-2]-t.a[3]*o[d-3]-t.a[4]*o[d-4];if(t.negative)for(d=0,p=0;d<e;++d,p+=r)s[p]=i[d]+o[e-d-1];else for(d=0,p=0;d<e;++d,p+=r)s[p]=Math.max(0,i[d]+o[e-d-1]);return s}function Je(t,n,e,r,i,o,a,s,u,c){const l=Math.abs(r)*e,h=r<0?l+r:0;let f,p,d;for(p=0;p<s;++p)for(c[p]=p<=o?i[p]:0,d=1;d<=s&&d<=p;++d)c[p]-=a[d]*c[p-d];for(d=0;d<s;++d)for(t[d]=0,p=1;p<=d;++p)f=h+r*p,f>=0&&f<l&&(t[d]+=c[d-p]*n[f]);const m=n[h];if(m>0)for(d=0;d<s;++d)t[d]+=c[d]*m}function tr(t,n,e=0){const r=t.length;let i,o;for(let e=0;e<r;++e){const r=n(t[e],e,t);null!=r&&(void 0===i?r>=r&&(i=o=r):(r<i&&(i=r),r>o&&(o=r)))}return[i-e,o+e]}function nr(t,n){const e=t.length;for(let r=0;r<e;++r)t[r]>n&&(n=t[r]);return n}function er(t,n){const e=t.length;for(let r=0;r<e;++r)t[r]<n&&(n=t[r]);return n}function rr(t,n){const e=t.map(n).filter((t=>null!=t&&t>=t));e.sort(((t,n)=>t-n));const r=function(t){const n=t.length;let e,r=0,i=0,o=0;for(let a=0;a<n;++a){const n=t[a];e=n-i,i+=e/++r,o+=e*(n-i)}return r>1?Math.sqrt(o/(r-1)):NaN}(e),i=ir(e,.25),o=ir(e,.75),a=e.length,s=(o-i)/1.34;return 1.06*(Math.min(r,s)||r||Math.abs(i)||1)*Math.pow(a,-.2)}function ir(t,n){const e=t.length;if(!e)return NaN;if((n=+n)<=0||e<2)return t[0];if(n>=1)return t[e-1];const r=(e-1)*n,i=Math.floor(r),o=t[i];return o+(t[i+1]-o)*(r-i)}function or(t,n={}){const{adjust:e=1,pad:r=3,bins:i=[256,256]}=n,o=Ke(n.x,(t=>t[0])),a=Ke(n.y,(t=>t[1])),s=Ke(n.weight,(()=>1/t.length));let[u=e*rr(t,o),c=e*rr(t,a)]=ar(n.bandwidth);const[[l,h]=tr(t,o,r*u),[f,p]=tr(t,a,r*c)]=null==(d=n.extent)?[void 0,void 0]:"number"==typeof d[0]?[d,d]:d;var d;const[m,v]=ar(i),y=function(t,n,e,r,i,o,a,s,u,c){const l=new Float64Array(a*c),h=(a-1)/(o-i),f=(c-1)/(u-s);for(let o=0;o<t.length;++o){const u=t[o],p=n(u,o,t),d=e(u,o,t),m=r(u,o,t);if(!(Number.isFinite(p)&&Number.isFinite(d)&&Number.isFinite(m)))continue;const v=(p-i)*h,y=Math.floor(v),g=y+1,w=(d-s)*f,_=Math.floor(w),x=_+1;0<=y&&g<a?0<=_&&x<c?(l[y+_*a]+=(g-v)*(x-w)*m,l[y+x*a]+=(g-v)*(w-_)*m,l[g+_*a]+=(v-y)*(x-w)*m,l[g+x*a]+=(v-y)*(w-_)*m):-1===_?(l[y+x*a]+=(g-v)*(w-_)*m,l[g+x*a]+=(v-y)*(w-_)*m):x===c&&(l[g+_*a]+=(v-y)*(x-w)*m,l[y+_*a]+=(g-v)*(x-w)*m):-1===y?0<=_&&x<c?(l[g+_*a]+=(v-y)*(x-w)*m,l[g+x*a]+=(v-y)*(w-_)*m):-1===_?l[g+x*a]+=(v-y)*(w-_)*m:x===c&&(l[g+_*a]+=(v-y)*(x-w)*m):g===a&&(0<=_&&x<c?(l[y+_*a]+=(g-v)*(x-w)*m,l[y+x*a]+=(g-v)*(w-_)*m):-1===_?l[y+x*a]+=(g-v)*(w-_)*m:x===c&&(l[y+_*a]+=(g-v)*(x-w)*m))}return l}(t,o,a,s,l,h,m,f,p,v),g=(h-l)/(m-1),w=(p-f)/(v-1),_=y.some((t=>t<0));let x,b=We(u/g,_),M=We(c/w,_);function*S(t="x",n="y",e="z"){const r=k.grid(),i=1/(g*w);for(let o=0,a=0;a<v;++a)for(let s=0;s<m;++s,++o)yield{[t]:l+s*g,[n]:f+a*w,[e]:r[o]*i}}const k={[Symbol.iterator]:S,points:S,grid:()=>x||(x=function(t,n,e,[r,i]){const o=new Float64Array(Math.max(r,i)),a=new Float64Array(Math.max(r,i)),s=new Float64Array(5),u=new Float64Array(e.length);for(let n=0,c=0;n<i;++n,c+=r){const n=u.subarray(c);Qe(t,e.subarray(c),r,1,o,a,s,n)}for(let t=0;t<r;++t){const e=u.subarray(t);Qe(n,e,i,r,o,a,s,e)}return u}(b,M,y,[m,v])),extent:()=>[[l,h],[f,p]],heatmap:({color:t,clamp:n,canvas:e,maxColors:r}={})=>function(t,n,e,r=(t=>({r:0,g:0,b:0,opacity:t})),[i,o]=[er(t,0),nr(t,0)],a=function(t,n){if("undefined"!=typeof document){const e=document.createElement("canvas");return e.setAttribute("width",t),e.setAttribute("height",n),e}throw"Can not create a canvas instance, provide a canvas as a parameter."}(n,e),s=256){const u=1/(o-i),c=a.getContext("2d"),l=c.getImageData(0,0,n,e),h=l.data,f=s-1,p=function(t,n){const e=new Uint8ClampedArray(4*(t+1));for(let r=0;r<=t;++r){const i=n(r/t),{r:o,g:a,b:s,opacity:u=1}="string"==typeof i?jn(i):i,c=r<<2;e[c+0]=o,e[c+1]=a,e[c+2]=s,e[c+3]=255*u|0}return e}(f,r);for(let r=0,o=0;r<e;++r)for(let a=0,s=(e-r-1)*n;a<n;++a,o+=4){const n=f*Math.min(1,Math.max(t[a+s]-i,0)*u)<<2;h[o+0]=p[n+0],h[o+1]=p[n+1],h[o+2]=p[n+2],h[o+3]=p[n+3]}return c.putImageData(l,0,0),a}(k.grid(),m,v,t,n,e,r),bandwidth(t){if(arguments.length){const[n,e]=ar(t);return n!==u&&(x=null,b=We((u=n)/g,_)),e!==c&&(x=null,M=We((c=e)/w,_)),k}return[u,c]}};return k}function ar(t){return null==t?[void 0,void 0]:"number"==typeof t?[t,t]:t}function sr(t){return sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sr(t)}function ur(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function cr(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,n){if("object"!==sr(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!==sr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===sr(i)?i:String(i)),r)}var i}function lr(t,n){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},lr(t,n)}function hr(t){return hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hr(t)}Ue({thousands:",",grouping:[3],currency:["$",""]}),je.getParameterByName,Ue({decimal:".",thousands:" ",grouping:[3],currency:["","€"]});var fr=function(t){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&lr(t,n)}(a,t);var n,e,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=hr(r);if(i){var e=hr(this).constructor;t=Reflect.construct(n,arguments,e)}else t=n.apply(this,arguments);return function(t,n){if(n&&("object"===sr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t){var n;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,a),n=o.call(this,t),t=t||{},n.value=t.value,n.sigma=t.sigma,n.factor=t.factor||2,n.filterSm=t.filterSm,n.sCol=t.sCol||"ksmval",n.styles=t.styles||[],n}return n=a,(e=[{key:"draw",value:function(t,n,e){var r=this;if(this.filter&&(t=t.filter(this.filter)),t&&0!=t.length){var i=this.sigma(n,e.zf),o=Math.ceil(e.w/this.factor),a=Math.ceil(e.h/this.factor),s=[[e.pixToGeoX(0),e.pixToGeoX(o*this.factor)],[e.pixToGeoY(a*this.factor),e.pixToGeoY(0)]],u=or(t,{x:function(t){return t.x+n/2},y:function(t){return t.y+n/2},weight:function(t){return r.value(t)},bins:[o,a],bandwidth:i,extent:s}).grid(),c=(s[0][1]-s[0][0])/o;t=[];for(var l=0;l<u.length;l++){var h=u[l];if(!this.filterSm||this.filterSm(h)){var f=Math.floor(l/o),p=l%o,d={x:s[0][0]+p*c,y:s[1][0]+f*c};d[this.sCol]=h,t.push(d)}}var m,v=function(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,n){if(t){if("string"==typeof t)return ur(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ur(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}(this.styles);try{for(v.s();!(m=v.n()).done;){var y=m.value;e.ctx.globalAlpha=y.alpha?y.alpha(e.zf):1,e.ctx.globalCompositeOperation=y.blendOperation(e.zf),y.draw(t,c,e)}}catch(t){v.e(t)}finally{v.f()}}}}])&&cr(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),a}(Xe);return n})()));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.gridviz_smoothing=n():t.gridviz_smoothing=n()}(self,()=>(()=>{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};function e(){}function r(t){return null==t?e:function(){return this.querySelector(t)}}function i(){return[]}function o(t){return null==t?i:function(){return this.querySelectorAll(t)}}function a(t){return function(){return this.matches(t)}}function s(t){return function(n){return n.matches(t)}}t.r(n),t.d(n,{KernelSmoothingStyle:()=>br});var u=Array.prototype.find;function c(){return this.firstElementChild}var l=Array.prototype.filter;function h(){return Array.from(this.children)}function f(t){return new Array(t.length)}function p(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function v(t,n,e,r,i,o){for(var a,s=0,u=n.length,c=o.length;s<c;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new p(t,o[s]);for(;s<u;++s)(a=n[s])&&(i[s]=a)}function d(t,n,e,r,i,o,a){var s,u,c,l=new Map,h=n.length,f=o.length,v=new Array(h);for(s=0;s<h;++s)(u=n[s])&&(v[s]=c=a.call(u,u.__data__,s,n)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=a.call(t,o[s],s,o)+"",(u=l.get(c))?(r[s]=u,u.__data__=o[s],l.delete(c)):e[s]=new p(t,o[s]);for(s=0;s<h;++s)(u=n[s])&&l.get(v[s])===u&&(i[s]=u)}function m(t){return t.__data__}function y(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function g(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}p.prototype={constructor:p,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var w="http://www.w3.org/1999/xhtml";const _={svg:"http://www.w3.org/2000/svg",xhtml:w,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function x(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),_.hasOwnProperty(n)?{space:_[n],local:t}:t}function b(t){return function(){this.removeAttribute(t)}}function M(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,n){return function(){this.setAttribute(t,n)}}function A(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function E(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function z(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function C(t){return function(){this.style.removeProperty(t)}}function N(t,n,e){return function(){this.style.setProperty(t,n,e)}}function T(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function P(t,n){return t.style.getPropertyValue(n)||z(t).getComputedStyle(t,null).getPropertyValue(n)}function O(t){return function(){delete this[t]}}function $(t,n){return function(){this[t]=n}}function j(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function R(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new X(t)}function X(t){this._node=t,this._names=R(t.getAttribute("class")||"")}function Y(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function G(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function q(t){return function(){Y(this,t)}}function B(t){return function(){G(this,t)}}function I(t,n){return function(){(n.apply(this,arguments)?Y:G)(this,t)}}function Z(){this.textContent=""}function D(t){return function(){this.textContent=t}}function L(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function U(){this.innerHTML=""}function V(t){return function(){this.innerHTML=t}}function H(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function K(){this.nextSibling&&this.parentNode.appendChild(this)}function W(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===w&&n.documentElement.namespaceURI===w?n.createElement(t):n.createElementNS(e,t)}}function J(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tt(t){var n=x(t);return(n.local?J:Q)(n)}function nt(){return null}function et(){var t=this.parentNode;t&&t.removeChild(this)}function rt(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function it(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ot(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function at(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function st(t,n,e){var r=z(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ut(t,n){return function(){return st(this,t,n)}}function ct(t,n){return function(){return st(this,t,n.apply(this,arguments))}}X.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lt=[null];function ht(t,n){this._groups=t,this._parents=n}function ft(){return new ht([[document.documentElement]],lt)}ht.prototype=ft.prototype={constructor:ht,select:function(t){"function"!=typeof t&&(t=r(t));for(var n=this._groups,e=n.length,i=new Array(e),o=0;o<e;++o)for(var a,s,u=n[o],c=u.length,l=i[o]=new Array(c),h=0;h<c;++h)(a=u[h])&&(s=t.call(a,a.__data__,h,u))&&("__data__"in a&&(s.__data__=a.__data__),l[h]=s);return new ht(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(n=t.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(t):o(t);for(var n=this._groups,e=n.length,r=[],i=[],a=0;a<e;++a)for(var s,u=n[a],c=u.length,l=0;l<c;++l)(s=u[l])&&(r.push(t.call(s,s.__data__,l,u)),i.push(s));return new ht(r,i)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return u.call(this.children,t)}}("function"==typeof t?t:s(t)))},selectChildren:function(t){return this.selectAll(null==t?h:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:s(t)))},filter:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,s=n[i],u=s.length,c=r[i]=[],l=0;l<u;++l)(o=s[l])&&t.call(o,o.__data__,l,s)&&c.push(o);return new ht(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,m);var e,r=n?d:v,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,s=new Array(a),u=new Array(a),c=new Array(a),l=0;l<a;++l){var h=i[l],f=o[l],p=f.length,g=y(t.call(h,h&&h.__data__,l,i)),w=g.length,_=u[l]=new Array(w),x=s[l]=new Array(w);r(h,f,_,x,c[l]=new Array(p),g,n);for(var b,M,S=0,A=0;S<w;++S)if(b=_[S]){for(S>=A&&(A=S+1);!(M=x[A])&&++A<w;);b._next=M||null}}return(s=new ht(s,i))._enter=u,s._exit=c,s},enter:function(){return new ht(this._enter||this._groups.map(f),this._parents)},exit:function(){return new ht(this._exit||this._groups.map(f),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u<a;++u)for(var c,l=e[u],h=r[u],f=l.length,p=s[u]=new Array(f),v=0;v<f;++v)(c=l[v]||h[v])&&(p[v]=c);for(;u<i;++u)s[u]=e[u];return new ht(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=g);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,s=e[o],u=s.length,c=i[o]=new Array(u),l=0;l<u;++l)(a=s[l])&&(c[l]=a);c.sort(n)}return new ht(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=x(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?M:b:"function"==typeof n?e.local?k:E:e.local?A:S)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?C:"function"==typeof n?T:N)(t,n,null==e?"":e)):P(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?O:"function"==typeof n?j:$)(t,n)):this.node()[t]},classed:function(t,n){var e=R(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?I:n?q:B)(e,n))},text:function(t){return arguments.length?this.each(null==t?Z:("function"==typeof t?L:D)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?U:("function"==typeof t?H:V)(t)):this.node().innerHTML},raise:function(){return this.each(K)},lower:function(){return this.each(W)},append:function(t){var n="function"==typeof t?t:tt(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:tt(t),i=null==n?nt:"function"==typeof n?n:r(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(et)},clone:function(t){return this.select(t?it:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=n?at:ot,r=0;r<a;++r)this.each(s(o[r],n,e));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(r=0,u=s[c];r<a;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,n){return this.each(("function"==typeof n?ct:ut)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const pt=ft;function vt(t){return"string"==typeof t?new ht([[document.querySelector(t)]],[document.documentElement]):new ht([[t]],lt)}var dt={value:()=>{}};function mt(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new yt(r)}function yt(t){this._=t}function gt(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function wt(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=dt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}yt.prototype=mt.prototype={constructor:yt,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<s;)if(e=(t=o[a]).type)i[e]=wt(i[e],t.name,n);else if(null==n)for(e in i)i[e]=wt(i[e],t.name,null);return this}for(;++a<s;)if((e=(t=o[a]).type)&&(e=gt(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new yt(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};const _t=mt,xt={capture:!0,passive:!1};function bt(t){t.preventDefault(),t.stopImmediatePropagation()}function Mt(t){return((t=Math.exp(t))+1/t)/2}const St=function t(n,e,r){function i(t,i){var o,a,s=t[0],u=t[1],c=t[2],l=i[0],h=i[1],f=i[2],p=l-s,v=h-u,d=p*p+v*v;if(d<1e-12)a=Math.log(f/c)/n,o=function(t){return[s+t*p,u+t*v,c*Math.exp(n*t*a)]};else{var m=Math.sqrt(d),y=(f*f-c*c+r*d)/(2*c*e*m),g=(f*f-c*c-r*d)/(2*f*e*m),w=Math.log(Math.sqrt(y*y+1)-y),_=Math.log(Math.sqrt(g*g+1)-g);a=(_-w)/n,o=function(t){var r,i=t*a,o=Mt(w),l=c/(e*m)*(o*(r=n*i+w,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(w));return[s+l*p,u+l*v,c*o/Mt(n*i+w)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function At(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}var Et,kt,zt=0,Ct=0,Nt=0,Tt=0,Pt=0,Ot=0,$t="object"==typeof performance&&performance.now?performance:Date,jt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Rt(){return Pt||(jt(Ft),Pt=$t.now()+Ot)}function Ft(){Pt=0}function Xt(){this._call=this._time=this._next=null}function Yt(t,n,e){var r=new Xt;return r.restart(t,n,e),r}function Gt(){Pt=(Tt=$t.now())+Ot,zt=Ct=0;try{!function(){Rt(),++zt;for(var t,n=Et;n;)(t=Pt-n._time)>=0&&n._call.call(void 0,t),n=n._next;--zt}()}finally{zt=0,function(){for(var t,n,e=Et,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Et=n);kt=t,Bt(r)}(),Pt=0}}function qt(){var t=$t.now(),n=t-Tt;n>1e3&&(Ot-=n,Tt=t)}function Bt(t){zt||(Ct&&(Ct=clearTimeout(Ct)),t-Pt>24?(t<1/0&&(Ct=setTimeout(Gt,t-$t.now()-Ot)),Nt&&(Nt=clearInterval(Nt))):(Nt||(Tt=$t.now(),Nt=setInterval(qt,1e3)),zt=1,jt(Gt)))}function It(t,n,e){var r=new Xt;return n=null==n?0:+n,r.restart(e=>{r.stop(),t(e+n)},n,e),r}Xt.prototype=Yt.prototype={constructor:Xt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Rt():+e)+(null==n?0:+n),this._next||kt===this||(kt?kt._next=this:Et=this,kt=this),this._call=t,this._time=e,Bt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bt())}};var Zt=_t("start","end","cancel","interrupt"),Dt=[];function Lt(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(u){var c,l,h,f;if(1!==e.state)return s();for(c in i)if((f=i[c]).name===e.name){if(3===f.state)return It(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c<n&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[c])}if(It(function(){3===e.state&&(e.state=4,e.timer.restart(a,e.delay,e.time),a(u))}),e.state=2,e.on.call("start",t,t.__data__,e.index,e.group),2===e.state){for(e.state=3,r=new Array(h=e.tween.length),c=0,l=-1;c<h;++c)(f=e.tween[c].value.call(t,t.__data__,e.index,e.group))&&(r[++l]=f);r.length=l+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(s),e.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===e.state&&(e.on.call("end",t,t.__data__,e.index,e.group),s())}function s(){for(var r in e.state=6,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=Yt(function(t){e.state=1,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:Zt,tween:Dt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Ut(t,n){var e=Ht(t,n);if(e.state>0)throw new Error("too late; already scheduled");return e}function Vt(t,n){var e=Ht(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Ht(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Kt(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Wt(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var Qt,Jt=180/Math.PI,tn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function nn(t,n,e,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(u=t*e+n*r)&&(e-=t*u,r-=n*u),(s=Math.sqrt(e*e+r*r))&&(e/=s,r/=s,u/=s),t*r<n*e&&(t=-t,n=-n,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Jt,skewX:Math.atan(u)*Jt,scaleX:a,scaleY:s}}function en(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,n,null,e);s.push({i:u-4,x:Wt(t,i)},{i:u-2,x:Wt(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Wt(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,s,u),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Wt(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,s,u),function(t,n,e,r,o,a){if(t!==e||n!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Wt(t,e)},{i:s-2,x:Wt(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var n,e=-1,r=u.length;++e<r;)s[(n=u[e]).i]=n.x(t);return s.join("")}}}var rn=en(function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?tn:nn(n.a,n.b,n.c,n.d,n.e,n.f)},"px, ","px)","deg)"),on=en(function(t){return null==t?tn:(Qt||(Qt=document.createElementNS("http://www.w3.org/2000/svg","g")),Qt.setAttribute("transform",t),(t=Qt.transform.baseVal.consolidate())?nn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):tn)},", ",")",")");function an(t,n){var e,r;return function(){var i=Vt(this,t),o=i.tween;if(o!==e)for(var a=0,s=(r=e=o).length;a<s;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}function sn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Vt(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:n,value:e},u=0,c=i.length;u<c;++u)if(i[u].name===n){i[u]=s;break}u===c&&i.push(s)}o.tween=i}}function un(t,n,e){var r=t._id;return t.each(function(){var t=Vt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Ht(t,r).value[n]}}function cn(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function ln(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function hn(){}var fn=.7,pn=1/fn,vn="\\s*([+-]?\\d+)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yn=/^#([0-9a-f]{3,8})$/,gn=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),wn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),_n=new RegExp(`^rgba\\(${vn},${vn},${vn},${dn}\\)$`),xn=new RegExp(`^rgba\\(${mn},${mn},${mn},${dn}\\)$`),bn=new RegExp(`^hsl\\(${dn},${mn},${mn}\\)$`),Mn=new RegExp(`^hsla\\(${dn},${mn},${mn},${dn}\\)$`),Sn={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 An(){return this.rgb().formatHex()}function En(){return this.rgb().formatRgb()}function kn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=yn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?zn(n):3===e?new Tn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Cn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Cn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=gn.exec(t))?new Tn(n[1],n[2],n[3],1):(n=wn.exec(t))?new Tn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=_n.exec(t))?Cn(n[1],n[2],n[3],n[4]):(n=xn.exec(t))?Cn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=bn.exec(t))?Fn(n[1],n[2]/100,n[3]/100,1):(n=Mn.exec(t))?Fn(n[1],n[2]/100,n[3]/100,n[4]):Sn.hasOwnProperty(t)?zn(Sn[t]):"transparent"===t?new Tn(NaN,NaN,NaN,0):null}function zn(t){return new Tn(t>>16&255,t>>8&255,255&t,1)}function Cn(t,n,e,r){return r<=0&&(t=n=e=NaN),new Tn(t,n,e,r)}function Nn(t,n,e,r){return 1===arguments.length?((i=t)instanceof hn||(i=kn(i)),i?new Tn((i=i.rgb()).r,i.g,i.b,i.opacity):new Tn):new Tn(t,n,e,null==r?1:r);var i}function Tn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Pn(){return`#${Rn(this.r)}${Rn(this.g)}${Rn(this.b)}`}function On(){const t=$n(this.opacity);return`${1===t?"rgb(":"rgba("}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${1===t?")":`, ${t})`}`}function $n(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function jn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Rn(t){return((t=jn(t))<16?"0":"")+t.toString(16)}function Fn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Yn(t,n,e,r)}function Xn(t){if(t instanceof Yn)return new Yn(t.h,t.s,t.l,t.opacity);if(t instanceof hn||(t=kn(t)),!t)return new Yn;if(t instanceof Yn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Yn(a,s,u,t.opacity)}function Yn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Gn(t){return(t=(t||0)%360)<0?t+360:t}function qn(t){return Math.max(0,Math.min(1,t||0))}function Bn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function In(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}cn(hn,kn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:An,formatHex:An,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xn(this).formatHsl()},formatRgb:En,toString:En}),cn(Tn,Nn,ln(hn,{brighter(t){return t=null==t?pn:Math.pow(pn,t),new Tn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?fn:Math.pow(fn,t),new Tn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Tn(jn(this.r),jn(this.g),jn(this.b),$n(this.opacity))},displayable(){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:Pn,formatHex:Pn,formatHex8:function(){return`#${Rn(this.r)}${Rn(this.g)}${Rn(this.b)}${Rn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:On,toString:On})),cn(Yn,function(t,n,e,r){return 1===arguments.length?Xn(t):new Yn(t,n,e,null==r?1:r)},ln(hn,{brighter(t){return t=null==t?pn:Math.pow(pn,t),new Yn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?fn:Math.pow(fn,t),new Yn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Tn(Bn(t>=240?t-240:t+120,i,r),Bn(t,i,r),Bn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Yn(Gn(this.h),qn(this.s),qn(this.l),$n(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=$n(this.opacity);return`${1===t?"hsl(":"hsla("}${Gn(this.h)}, ${100*qn(this.s)}%, ${100*qn(this.l)}%${1===t?")":`, ${t})`}`}}));const Zn=t=>()=>t;function Dn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Zn(isNaN(t)?n:t)}const Ln=function t(n){var e=function(t){return 1===(t=+t)?Dn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Zn(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=Nn(t)).r,(n=Nn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Dn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Un(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),s=new Array(i);for(e=0;e<i;++e)r=Nn(n[e]),o[e]=r.r||0,a[e]=r.g||0,s[e]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}Un(function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<n-1?t[r+2]:2*o-i;return In((e-r/n)*n,a,i,o,s)}}),Un(function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],s=t[(r+2)%n];return In((e-r/n)*n,i,o,a,s)}});var Vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hn=new RegExp(Vn.source,"g");function Kn(t,n){var e,r,i,o=Vn.lastIndex=Hn.lastIndex=0,a=-1,s=[],u=[];for(t+="",n+="";(e=Vn.exec(t))&&(r=Hn.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Wt(e,r)})),o=Hn.lastIndex;return o<n.length&&(i=n.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?function(t){return function(n){return t(n)+""}}(u[0].x):function(t){return function(){return t}}(n):(n=u.length,function(t){for(var e,r=0;r<n;++r)s[(e=u[r]).i]=e.x(t);return s.join("")})}function Wn(t,n){var e;return("number"==typeof n?Wt:n instanceof kn?Ln:(e=kn(n))?(n=e,Ln):Kn)(t,n)}function Qn(t){return function(){this.removeAttribute(t)}}function Jn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function te(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}}function ne(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}function ee(t,n,e){var r,i,o;return function(){var a,s,u=e(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=n(r=a,u));this.removeAttribute(t)}}function re(t,n,e){var r,i,o;return function(){var a,s,u=e(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=n(r=a,u));this.removeAttributeNS(t.space,t.local)}}function ie(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}(t,i)),e}return i._value=n,i}function oe(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}(t,i)),e}return i._value=n,i}function ae(t,n){return function(){Ut(this,t).delay=+n.apply(this,arguments)}}function se(t,n){return n=+n,function(){Ut(this,t).delay=n}}function ue(t,n){return function(){Vt(this,t).duration=+n.apply(this,arguments)}}function ce(t,n){return n=+n,function(){Vt(this,t).duration=n}}var le=pt.prototype.constructor;function he(t){return function(){this.style.removeProperty(t)}}var fe=0;function pe(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ve(){return++fe}var de=pt.prototype;pe.prototype=function(t){return pt().transition(t)}.prototype={constructor:pe,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=r(t));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s<o;++s)for(var u,c,l=i[s],h=l.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=l[p])&&(c=t.call(u,u.__data__,p,l))&&("__data__"in u&&(c.__data__=u.__data__),f[p]=c,Lt(f[p],n,e,p,f,Ht(u,e)));return new pe(a,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=o(t));for(var r=this._groups,i=r.length,a=[],s=[],u=0;u<i;++u)for(var c,l=r[u],h=l.length,f=0;f<h;++f)if(c=l[f]){for(var p,v=t.call(c,c.__data__,f,l),d=Ht(c,e),m=0,y=v.length;m<y;++m)(p=v[m])&&Lt(p,n,e,m,v,d);a.push(v),s.push(c)}return new pe(a,s,n,e)},selectChild:de.selectChild,selectChildren:de.selectChildren,filter:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,s=n[i],u=s.length,c=r[i]=[],l=0;l<u;++l)(o=s[l])&&t.call(o,o.__data__,l,s)&&c.push(o);return new pe(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,c=n[s],l=e[s],h=c.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=c[p]||l[p])&&(f[p]=u);for(;s<r;++s)a[s]=n[s];return new pe(a,this._parents,this._name,this._id)},selection:function(){return new le(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=ve(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,c=0;c<u;++c)if(a=s[c]){var l=Ht(a,n);Lt(a,t,e,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new pe(r,this._parents,t,e)},call:de.call,nodes:de.nodes,node:de.node,size:de.size,empty:de.empty,each:de.each,on:function(t,n){var e=this._id;return arguments.length<2?Ht(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?Ut:Vt;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=x(t),r="transform"===e?on:Wn;return this.attrTween(t,"function"==typeof n?(e.local?re:ee)(e,r,un(this,"attr."+t,n)):null==n?(e.local?Jn:Qn)(e):(e.local?ne:te)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=x(t);return this.tween(e,(r.local?ie:oe)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?rn:Wn;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=P(this,t),a=(this.style.removeProperty(t),P(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,he(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=P(this,t),s=e(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=P(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}}(t,r,un(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,s="end."+a;return function(){var u=Vt(this,t),c=u.on,l=null==u.value[a]?o||(o=he(n)):void 0;c===e&&i===l||(r=(e=c).copy()).on(s,i=l),u.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=P(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(un(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Ht(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?an:sn)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ae:se)(n,t)):Ht(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ue:ce)(n,t)):Ht(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){Vt(this,t).ease=n}}(n,t)):Ht(this.node(),n).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,n){return function(){var e=n.apply(this,arguments);if("function"!=typeof e)throw new Error;Vt(this,t).ease=e}}(this._id,t))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise(function(o,a){var s={value:a},u={value:function(){0===--i&&o()}};e.each(function(){var e=Vt(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(s),n._.interrupt.push(s),n._.end.push(u)),e.on=n}),0===i&&o()})},[Symbol.iterator]:de[Symbol.iterator]};var me={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function ye(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}pt.prototype.interrupt=function(t){return this.each(function(){Kt(this,t)})},pt.prototype.transition=function(t){var n,e;t instanceof pe?(n=t._id,t=t._name):(n=ve(),(e=me).time=Rt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,c=0;c<u;++c)(a=s[c])&&Lt(a,t,n,c,s,e||ye(a,n));return new pe(r,this._parents,t,n)};const ge=t=>()=>t;function we(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function _e(t,n,e){this.k=t,this.x=n,this.y=e}_e.prototype={constructor:_e,scale:function(t){return 1===t?this:new _e(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new _e(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var xe=new _e(1,0,0);function be(t){t.stopImmediatePropagation()}function Me(t){t.preventDefault(),t.stopImmediatePropagation()}function Se(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Ae(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Ee(){return this.__zoom||xe}function ke(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ze(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ce(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}_e.prototype;class Ne{constructor(t,n=0,e=0,r=0,i=void 0){this.opts=i||{},this.canvas=t,this.canvas.style.cursor="grab",this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.offscreenCanvas=document.createElement("canvas"),this.offscreenCanvas.width=this.w,this.offscreenCanvas.height=this.h;const o=this.canvas.getContext("2d"),a=this.offscreenCanvas.getContext("2d");if(!o)throw"Impossible to create canvas 2D context";if(!a)throw"Impossible to create canvas 2D context";if(this.ctx=o,this.offscreenCtx=a,this.view={x:n,y:e,z:r},this.backgroundColor=i.backgroundColor||"white",this.onZoomStartFun=i.onZoomStartFun,this.onZoomEndFun=i.onZoomEndFun,this.onZoomFun=i.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!i.disableZoom){let t=xe;(function(){var t,n,e,r=Se,i=Ae,o=Ce,a=ke,s=ze,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,h=St,f=_t("start","zoom","end"),p=0,v=10;function d(t){t.property("__zoom",Ee).on("wheel.zoom",b,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",S).filter(s).on("touchstart.zoom",A).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(t,n){return(n=Math.max(u[0],Math.min(u[1],n)))===t.k?t:new _e(n,t.x,t.y)}function y(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new _e(t.k,r,i)}function g(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,n,e,r){t.on("start.zoom",function(){_(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(r).end()}).tween("zoom",function(){var t=this,o=arguments,a=_(t,o).event(r),s=i.apply(t,o),u=null==e?g(s):"function"==typeof e?e.apply(t,o):e,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=t.__zoom,f="function"==typeof n?n.apply(t,o):n,p=h(l.invert(u).concat(c/l.k),f.invert(u).concat(c/f.k));return function(t){if(1===t)t=f;else{var n=p(t),e=c/n[2];t=new _e(e,u[0]-n[0]*e,u[1]-n[1]*e)}a.zoom(null,t)}})}function _(t,n,e){return!e&&t.__zooming||new x(t,n)}function x(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,n),this.taps=0}function b(t,...n){if(r.apply(this,arguments)){var e=_(this,n).event(t),i=this.__zoom,s=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,a.apply(this,arguments)))),l=At(t);if(e.wheel)e.mouse[0][0]===l[0]&&e.mouse[0][1]===l[1]||(e.mouse[1]=i.invert(e.mouse[0]=l)),clearTimeout(e.wheel);else{if(i.k===s)return;e.mouse=[l,i.invert(l)],Kt(this),e.start()}Me(t),e.wheel=setTimeout(function(){e.wheel=null,e.end()},150),e.zoom("mouse",o(y(m(i,s),e.mouse[0],e.mouse[1]),e.extent,c))}}function M(t,...n){if(!e&&r.apply(this,arguments)){var i=t.currentTarget,a=_(this,n,!0).event(t),s=vt(t.view).on("mousemove.zoom",function(t){if(Me(t),!a.moved){var n=t.clientX-l,e=t.clientY-h;a.moved=n*n+e*e>p}a.event(t).zoom("mouse",o(y(a.that.__zoom,a.mouse[0]=At(t,i),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,n){var e=t.document.documentElement,r=vt(t).on("dragstart.drag",null);n&&(r.on("click.drag",bt,xt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,a.moved),Me(t),a.event(t).end()},!0),u=At(t,i),l=t.clientX,h=t.clientY;!function(t){var n=t.document.documentElement,e=vt(t).on("dragstart.drag",bt,xt);"onselectstart"in n?e.on("selectstart.drag",bt,xt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(t.view),be(t),a.mouse=[u,this.__zoom.invert(u)],Kt(this),a.start()}}function S(t,...n){if(r.apply(this,arguments)){var e=this.__zoom,a=At(t.changedTouches?t.changedTouches[0]:t,this),s=e.invert(a),u=e.k*(t.shiftKey?.5:2),h=o(y(m(e,u),a,s),i.apply(this,n),c);Me(t),l>0?vt(this).transition().duration(l).call(w,h,a,t):vt(this).call(d.transform,h,a,t)}}function A(e,...i){if(r.apply(this,arguments)){var o,a,s,u,c=e.touches,l=c.length,h=_(this,i,e.changedTouches.length===l).event(e);for(be(e),a=0;a<l;++a)u=[u=At(s=c[a],this),this.__zoom.invert(u),s.identifier],h.touch0?h.touch1||h.touch0[2]===u[2]||(h.touch1=u,h.taps=0):(h.touch0=u,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(n=u[0],t=setTimeout(function(){t=null},500)),Kt(this),h.start())}}function E(t,...n){if(this.__zooming){var e,r,i,a,s=_(this,n).event(t),u=t.changedTouches,l=u.length;for(Me(t),e=0;e<l;++e)i=At(r=u[e],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var h=s.touch0[0],f=s.touch0[1],p=s.touch1[0],v=s.touch1[1],d=(d=p[0]-h[0])*d+(d=p[1]-h[1])*d,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(d/g)),i=[(h[0]+p[0])/2,(h[1]+p[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],a=s.touch0[1]}s.zoom("touch",o(y(r,i,a),s.extent,c))}}function k(t,...r){if(this.__zooming){var i,o,a=_(this,r).event(t),s=t.changedTouches,u=s.length;for(be(t),e&&clearTimeout(e),e=setTimeout(function(){e=null},500),i=0;i<u;++i)o=s[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=At(o,this),Math.hypot(n[0]-o[0],n[1]-o[1])<v)){var c=vt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return d.transform=function(t,n,e,r){var i=t.selection?t.selection():t;i.property("__zoom",Ee),t!==i?w(t,n,e,r):i.interrupt().each(function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},d.scaleBy=function(t,n,e,r){d.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)},e,r)},d.scaleTo=function(t,n,e,r){d.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==e?g(t):"function"==typeof e?e.apply(this,arguments):e,s=r.invert(a),u="function"==typeof n?n.apply(this,arguments):n;return o(y(m(r,u),a,s),t,c)},e,r)},d.translateBy=function(t,n,e,r){d.transform(t,function(){return o(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),i.apply(this,arguments),c)},null,r)},d.translateTo=function(t,n,e,r,a){d.transform(t,function(){var t=i.apply(this,arguments),a=this.__zoom,s=null==r?g(t):"function"==typeof r?r.apply(this,arguments):r;return o(xe.translate(s[0],s[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,c)},r,a)},x.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var n=vt(this.that).datum();f.call(t,this.that,new we(t,{sourceEvent:this.sourceEvent,target:d,type:t,transform:this.that.__zoom,dispatch:f}),n)}},d.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:ge(+t),d):a},d.filter=function(t){return arguments.length?(r="function"==typeof t?t:ge(!!t),d):r},d.touchable=function(t){return arguments.length?(s="function"==typeof t?t:ge(!!t),d):s},d.extent=function(t){return arguments.length?(i="function"==typeof t?t:ge([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),d):i},d.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],d):[u[0],u[1]]},d.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],d):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},d.constrain=function(t){return arguments.length?(o=t,d):o},d.duration=function(t){return arguments.length?(l=+t,d):l},d.interpolate=function(t){return arguments.length?(h=t,d):h},d.on=function(){var t=f.on.apply(f,arguments);return t===f?d:t},d.clickDistance=function(t){return arguments.length?(p=(t=+t)*t,d):Math.sqrt(p)},d.tapDistance=function(t){return arguments.length?(v=+t,d):v},d})().wheelDelta(t=>-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)).on("zoom",e=>{this._isZooming=!0;const r=e.transform,i=t.k/r.k;if(1==i){const n=t.x-r.x,e=t.y-r.y;this.applyPan(n*this.view.z,-e*this.view.z)}else n(e,i);t=r,this.onZoomFun&&this.onZoomFun(e)}).on("start",t=>{try{this.canvas.style.cursor="grabbing"}catch(t){}this._isZooming=!0,this.canvasSave.c=document.createElement("canvas"),this.canvasSave.c.setAttribute("width",""+this.w),this.canvasSave.c.setAttribute("height",""+this.h),this.canvasSave.c.getContext("2d")?.drawImage(this.canvas,0,0),this.canvasSave.dx=0,this.canvasSave.dy=0,this.canvasSave.f=1,this.onZoomStartFun&&this.onZoomStartFun(t)}).on("end",t=>{try{this.canvas.style.cursor="grab"}catch(t){}this._isZooming=!1,this.redraw(),this.canvasSave={c:null,dx:0,dy:0,f:1},this.onZoomEndFun&&this.onZoomEndFun(t)})(vt(this.canvas));const n=(t,n)=>{this.cancelCurrentRequests();const e=t.sourceEvent;if(e instanceof WheelEvent)this.applyZoom(n,this.pixToGeoX(e.offsetX),this.pixToGeoY(e.offsetY));else if(e instanceof TouchEvent){let t=0,r=0;for(let n of e.targetTouches)t+=n.clientX,r+=n.clientY;t/=e.targetTouches.length,r/=e.targetTouches.length,this.applyZoom(n,this.pixToGeoX(t),this.pixToGeoY(r))}}}this.xMin=i.centerExtent?i.centerExtent[0]:void 0,this.yMin=i.centerExtent?i.centerExtent[1]:void 0,this.xMax=i.centerExtent?i.centerExtent[2]:void 0,this.yMax=i.centerExtent?i.centerExtent[3]:void 0,this.zoomExtent=i.zoomExtent||[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}applyPan(t=0,n=0){if(null!=this.xMin&&this.view.x+t<this.xMin&&(t=this.xMin-this.view.x),null!=this.yMin&&this.view.y+n<this.yMin&&(n=this.yMin-this.view.y),null!=this.xMax&&this.view.x+t>this.xMax&&(t=this.xMax-this.view.x),null!=this.yMax&&this.view.y+n>this.yMax&&(n=this.yMax-this.view.y),this.view.x+=t,this.view.y+=n,this.updateExtentGeo(),this.canvasSave.c){const e=1/this.view.z;this.canvasSave.dx-=t*e,this.canvasSave.dy+=n*e,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy),this.ctx.drawImage(this.offscreenCtx.canvas,0,0)}else console.log("no canvas save")}applyZoom(t=1,n=this.view.x,e=this.view.y){if(this.zoomExtent[0]==this.view.z&&t<=1)return;if(this.zoomExtent[1]==this.view.z&&t>=1)return;const r=t*this.view.z;r<this.zoomExtent[0]&&(t=this.zoomExtent[0]/this.view.z),r>this.zoomExtent[1]&&(t=this.zoomExtent[1]/this.view.z),this.view.z*=t;let i=(n-this.view.x)*(1-t),o=(e-this.view.y)*(1-t);null!=this.xMin&&this.view.x+i<this.xMin&&(i=this.xMin-this.view.x),null!=this.yMin&&this.view.y+o<this.yMin&&(o=this.yMin-this.view.y),null!=this.xMax&&this.view.x+i>this.xMax&&(i=this.xMax-this.view.x),null!=this.yMax&&this.view.y+o>this.yMax&&(o=this.yMax-this.view.y),this.view.x+=i,this.view.y+=o,this.updateExtentGeo(),this._drawZoomFrame(t,n,e)}_drawZoomFrame(t,n,e){this.canvasSave.c&&(this.clear(this.backgroundColor),this.canvasSave.f/=t,this.canvasSave.dx=this.geoToPixX(n)*(1-this.canvasSave.f),this.canvasSave.dy=this.geoToPixY(e)*(1-this.canvasSave.f),this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy,this.canvasSave.f*this.canvasSave.c.width,this.canvasSave.f*this.canvasSave.c.height),this.ctx.drawImage(this.offscreenCanvas,0,0,this.canvas.width,this.canvas.height))}clear(t="white"){this.opts.transparentBackground?(this.ctx.clearRect(0,0,this.w,this.h),this.offscreenCtx.clearRect(0,0,this.w,this.h)):(this.ctx&&(this.ctx.fillStyle=t),this.offscreenCtx&&(this.offscreenCtx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h),this.offscreenCtx.fillRect(0,0,this.w,this.h))}getView(){return this.view}setCenterExtent(t){this.xMin=t[0],this.yMin=t[1],this.xMax=t[2],this.yMax=t[3]}getCenterExtent(){return[this.xMin,this.yMin,this.xMax,this.yMax]}setZoomExtent(t){this.zoomExtent=t}getZoomExtent(){return this.zoomExtent}initCanvasTransform(){this.ctx.setTransform(1,0,0,1,0,0),this.offscreenCtx.setTransform(1,0,0,1,0,0)}setCanvasTransform(){const t=1/this.view.z,n=-this.view.x/this.view.z+.5*this.w,e=this.view.y/this.view.z+.5*this.h;this.ctx.setTransform(t,0,0,-t,n,e),this.offscreenCtx.setTransform(t,0,0,-t,n,e)}getWebGLTransform(){const t=2/(this.w*this.view.z),n=2/(this.h*this.view.z);return[t,0,0,0,n,0,-t*this.view.x,-n*this.view.y,1]}redraw(){throw new Error("Method redraw not implemented.")}cancelCurrentRequests(){throw new Error("Method cancelCurrentRequests not implemented.")}updateExtentGeo(t=20){return this.extGeo={xMin:this.pixToGeoX(-t),xMax:this.pixToGeoX(this.w+t),yMin:this.pixToGeoY(this.h+t),yMax:this.pixToGeoY(-t)},this.extGeo}toDraw(t){return!(t.x<this.extGeo.xMin||t.x>this.extGeo.xMax||t.y<this.extGeo.yMin||t.y>this.extGeo.yMax)}geoToPixX(t){return(t-this.view.x)/this.view.z+.5*this.w}geoToPixY(t){return-(t-this.view.y)/this.view.z+.5*this.h}pixToGeoX(t){return(t-.5*this.w)*this.view.z+this.view.x}pixToGeoY(t){return-(t-.5*this.h)*this.view.z+this.view.y}setViewFromURL(){const t=Ne.getParameterByName("x"),n=Ne.getParameterByName("y"),e=Ne.getParameterByName("z");null==t||null==t||isNaN(+t)||(this.view.x=+t),null==n||null==n||isNaN(+n)||(this.view.y=+n),null==e||null==e||isNaN(+e)||(this.view.z=+e)}static getParameterByName(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return n?decodeURIComponent(n[1].replace(/\+/g," ")):null}}class Te{constructor(t){t=t||{},this.visible=t.visible,this.alpha=t.alpha,this.blendOperation=t.blendOperation||(t=>"source-over"),this.filterColor=t.filterColor,this.filterBlendOperation=t.filterBlendOperation}drawFilter(t){if(!this.filterColor)return;const n=this.filterColor(t.view.z);if(!n||"none"==n)return;let e,r;t.offscreenCtx.fillStyle=n,this.filterBlendOperation&&(e=t.offscreenCtx.globalCompositeOperation,r=this.filterBlendOperation(t.view.z)),r&&"none"!=r&&(t.offscreenCtx.globalCompositeOperation=r),t.offscreenCtx.fillRect(0,0,t.w,t.h),e&&(t.offscreenCtx.globalCompositeOperation=e)}}class Pe extends Te{constructor(t){super(t),t=t||{},this.viewScale=t.viewScale,this.filter=t.filter||void 0,this.offset=t.offset||((t,n,e)=>({dx:0,dy:0})),this.drawFun=t.drawFun,this.legends=[]}draw(t,n,e){if(!this.drawFun)throw new Error("Method draw not implemented.");this.drawFun(t,n,e)}getOffset(){return this.offset}setOffset(t){return this.offset=t,this}updateLegends(t){return Pe.updateLegendsRecursive(this.legends,t),this}static updateLegendsRecursive(t,n){if(Array.isArray(t))for(const e of t)this.updateLegendsRecursive(e,n);else t.update(n)}addLegends(t){for(let n of t)this.legends.push(n);return this}}var Oe={},$e={};function je(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'}).join(",")+"}")}function Re(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}function Fe(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function Xe(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,s=0,u=o<=0,c=!1;function l(){if(u)return $e;if(c)return c=!1,Oe;var n,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(n=a)>=o?u=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(n=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==e)continue;return t.slice(i,n)}return u=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=l())!==$e;){for(var h=[];r!==Oe&&r!==$e;)h.push(r),r=l();n&&null==(h=n(h,s++))||i.push(h)}return i}function i(n,e){return n.map(function(n){return e.map(function(t){return a(n[t])}).join(t)})}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?(i=(e=t).getUTCHours(),o=e.getUTCMinutes(),a=e.getUTCSeconds(),s=e.getUTCMilliseconds(),isNaN(e)?"Invalid Date":((r=e.getUTCFullYear())<0?"-"+Fe(-r,6):r>9999?"+"+Fe(r,6):Fe(r,4))+"-"+Fe(e.getUTCMonth()+1,2)+"-"+Fe(e.getUTCDate(),2)+(s?"T"+Fe(i,2)+":"+Fe(o,2)+":"+Fe(a,2)+"."+Fe(s,3)+"Z":a?"T"+Fe(i,2)+":"+Fe(o,2)+":"+Fe(a,2)+"Z":o||i?"T"+Fe(i,2)+":"+Fe(o,2)+"Z":"")):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var e,r,i,o,a,s}return{parse:function(t,n){var e,i,o=r(t,function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=je(t);return function(r,i){return n(e(r),i,t)}}(t,n):je(t)});return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=Re(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=Re(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var Ye=Xe(","),Ge=Ye.parse,qe=(Ye.parseRows,Ye.format,Ye.formatBody,Ye.formatRows,Ye.formatRow,Ye.formatValue,Xe("\t")),Be=qe.parse;function Ie(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Ze(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),function(t,n){return fetch(t,n).then(Ie)}(n,e).then(function(n){return t(n,r)})}}qe.parseRows,qe.format,qe.formatBody,qe.formatRows,qe.formatRow,qe.formatValue,Ze(Ge),Ze(Be),function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(Math.random);const De=t=>t;function Le(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}De.invert=De;var Ue,Ve=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function He(t){if(!(n=Ve.exec(t)))throw new Error("invalid format: "+t);var n;return new Ke({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Ke(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function We(t,n){var e=Le(t,n);if(!e)return t+"";var r=e[0],i=e[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")}He.prototype=Ke.prototype,Ke.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Qe={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>We(100*t,n),r:We,s:function(t,n){var e=Le(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Ue=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")+Le(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Je(t){return t}var tr,nr=Array.prototype.map,er=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function rr(t){return tr=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Je:(n=nr.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=n[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Je:function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(nr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=He(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,v=t.width,d=t.comma,m=t.precision,y=t.trim,g=t.type;"n"===g?(d=!0,g="g"):Qe[g]||(void 0===m&&(m=12),y=!0,g="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var w="$"===f?i:"#"===f&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",_="$"===f?o:/[%p]/.test(g)?u:"",x=Qe[g],b=/[defgprs%]/.test(g);function M(t){var i,o,u,f=w,M=_;if("c"===g)M=x(t)+M,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),m),y&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),S&&0===+t&&"+"!==h&&(S=!1),f=(S?"("===h?h:c:"-"===h||"("===h?"":h)+f,M=("s"===g?er[8+Ue/3]:"")+M+(S&&"("===h?")":""),b)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}d&&!p&&(t=r(t,1/0));var A=f.length+t.length+M.length,E=A<v?new Array(v-A+1).join(n):"";switch(d&&p&&(t=r(E+t,E.length?v-M.length:1/0),E=""),e){case"<":t=f+t+M+E;break;case"=":t=f+E+t+M;break;case"^":t=E.slice(0,A=E.length>>1)+f+t+M+E.slice(A);break;default:t=E+f+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e,r=h(((t=He(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((e=n,((e=Le(Math.abs(e)))?e[1]:NaN)/3)))),o=Math.pow(10,-i),a=er[8+i/3];return function(t){return r(o*t)+a}}}}(t),tr.format,tr.formatPrefix,tr}function ir(t,n){return null==t?n:"function"==typeof t?t:n=>n[t]}function or(t,n=!1){const e=new Float64Array(5),r=new Float64Array(4);!function(t,n,e){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/e),o=Math.exp(-1.723/e),a=.6318/e,s=1.997/e,u=Float64Array.of(-i*Math.cos(a),i*Math.sin(a),-i*Math.cos(-a),i*Math.sin(-a),-o*Math.cos(s),o*Math.sin(s),-o*Math.cos(-s),o*Math.sin(-s)),c=2.5066282746310007*e,l=Float64Array.of(r[0],r[1],0,0,0,0,0,0),h=Float64Array.of(1,0,u[0],u[1],0,0,0,0,0,0);let f,p;for(p=2;p<8;p+=2){for(l[p]=u[p]*l[p-2]-u[p+1]*l[p-1],l[p+1]=u[p]*l[p-1]+u[p+1]*l[p-2],f=p-2;f>0;f-=2)l[f]+=u[p]*l[f-2]-u[p+1]*l[f-1],l[f+1]+=u[p]*l[f-1]+u[p+1]*l[f-2];for(f=0;f<=p;f+=2)l[f]+=r[p]*h[f]-r[p+1]*h[f+1],l[f+1]+=r[p]*h[f+1]+r[p+1]*h[f];for(h[p+2]=u[p]*h[p]-u[p+1]*h[p+1],h[p+3]=u[p]*h[p+1]+u[p+1]*h[p],f=p;f>0;f-=2)h[f]+=u[p]*h[f-2]-u[p+1]*h[f-1],h[f+1]+=u[p]*h[f-1]+u[p+1]*h[f-2]}for(p=0;p<4;++p)f=p<<1,n[p]=l[f]/c,t[p+1]=h[f+2]}(e,r,t);const i=Float64Array.of(0,r[1]-e[1]*r[0],r[2]-e[2]*r[0],r[3]-e[3]*r[0],-e[4]*r[0]),o=1+e[1]+e[2]+e[3]+e[4];return{sigma:t,negative:n,a:e,b_causal:r,b_anticausal:i,sum_causal:(r[0]+r[1]+r[2]+r[3])/o,sum_anticausal:(i[1]+i[2]+i[3]+i[4])/o}}function ar(t,n,e,r=1,i=new Float64Array(e),o=new Float64Array(e),a=new Float64Array(5),s=i,u=sr){const c=2*r,l=3*r,h=4*r,f=r*e;let p,v;for(u(i,n,e,r,t.b_causal,3,t.a,4,t.sum_causal,a,t.sigma),v=4,p=h;v<e;++v,p+=r)i[v]=t.b_causal[0]*n[p]+t.b_causal[1]*n[p-r]+t.b_causal[2]*n[p-c]+t.b_causal[3]*n[p-l]-t.a[1]*i[v-1]-t.a[2]*i[v-2]-t.a[3]*i[v-3]-t.a[4]*i[v-4];for(u(o,n,e,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,a,t.sigma),v=4,p=f-5*r;v<e;++v,p-=r)o[v]=t.b_anticausal[1]*n[p+r]+t.b_anticausal[2]*n[p+c]+t.b_anticausal[3]*n[p+l]+t.b_anticausal[4]*n[p+h]-t.a[1]*o[v-1]-t.a[2]*o[v-2]-t.a[3]*o[v-3]-t.a[4]*o[v-4];if(t.negative)for(v=0,p=0;v<e;++v,p+=r)s[p]=i[v]+o[e-v-1];else for(v=0,p=0;v<e;++v,p+=r)s[p]=Math.max(0,i[v]+o[e-v-1]);return s}function sr(t,n,e,r,i,o,a,s,u,c,l,h=.5){const f=Math.abs(r)*e,p=r<0?f+r:0;let v,d,m;for(d=0;d<s;++d)for(c[d]=d<=o?i[d]:0,m=1;m<=s&&m<=d;++m)c[d]-=a[m]*c[d-m];for(m=0;m<s;++m)for(t[m]=0,d=1;d<=m;++d)v=p+r*d,v>=0&&v<f&&(t[m]+=c[m-d]*n[v]);const y=n[p],g=Math.ceil(10*l);for(d=0;d<g;++d){for(m=0;m<s;++m)t[m]+=c[m]*y;if((u-=Math.abs(c[0]))<=h)break;for(c[s]=d+s<=o?i[d+s]:0,m=1;m<=s;++m)c[s]-=a[m]*c[s-m];for(m=0;m<s;++m)c[m]=c[m+1]}}function ur(t,n,e=0){const r=t.length;let i,o;for(let e=0;e<r;++e){const r=n(t[e],e,t);null!=r&&(void 0===i?r>=r&&(i=o=r):(r<i&&(i=r),r>o&&(o=r)))}return[i-e,o+e]}function cr(t,n){const e=t.length;for(let r=0;r<e;++r)t[r]>n&&(n=t[r]);return n}function lr(t,n){const e=t.length;for(let r=0;r<e;++r)t[r]<n&&(n=t[r]);return n}function hr(t,n){const e=t.map(n).filter(t=>null!=t&&t>=t);e.sort((t,n)=>t-n);const r=function(t){const n=t.length;let e,r=0,i=0,o=0;for(let a=0;a<n;++a){const n=t[a];e=n-i,i+=e/++r,o+=e*(n-i)}return r>1?Math.sqrt(o/(r-1)):NaN}(e),i=fr(e,.25),o=fr(e,.75),a=e.length,s=(o-i)/1.34;return 1.06*(Math.min(r,s)||r||Math.abs(i)||1)*Math.pow(a,-.2)}function fr(t,n){const e=t.length;if(!e)return NaN;if((n=+n)<=0||e<2)return t[0];if(n>=1)return t[e-1];const r=(e-1)*n,i=Math.floor(r),o=t[i];return o+(t[i+1]-o)*(r-i)}function pr(t,n={}){const{adjust:e=1,pad:r=3,bins:i=[256,256]}=n,o=ir(n.x,t=>t[0]),a=ir(n.y,t=>t[1]),s=ir(n.weight,()=>1/t.length);let[u=e*hr(t,o),c=e*hr(t,a)]=vr(n.bandwidth);const[[l,h]=ur(t,o,r*u),[f,p]=ur(t,a,r*c)]=null==(v=n.extent)?[void 0,void 0]:"number"==typeof v[0]?[v,v]:v;var v;const[d,m]=vr(i),y=function(t,n,e,r,i,o,a,s,u,c){const l=new Float64Array(a*c),h=(a-1)/(o-i),f=(c-1)/(u-s);for(let o=0;o<t.length;++o){const u=t[o],p=n(u,o,t),v=e(u,o,t),d=r(u,o,t);if(!(Number.isFinite(p)&&Number.isFinite(v)&&Number.isFinite(d)))continue;const m=(p-i)*h,y=Math.floor(m),g=y+1,w=(v-s)*f,_=Math.floor(w),x=_+1;0<=y&&g<a?0<=_&&x<c?(l[y+_*a]+=(g-m)*(x-w)*d,l[y+x*a]+=(g-m)*(w-_)*d,l[g+_*a]+=(m-y)*(x-w)*d,l[g+x*a]+=(m-y)*(w-_)*d):-1===_?(l[y+x*a]+=(g-m)*(w-_)*d,l[g+x*a]+=(m-y)*(w-_)*d):x===c&&(l[g+_*a]+=(m-y)*(x-w)*d,l[y+_*a]+=(g-m)*(x-w)*d):-1===y?0<=_&&x<c?(l[g+_*a]+=(m-y)*(x-w)*d,l[g+x*a]+=(m-y)*(w-_)*d):-1===_?l[g+x*a]+=(m-y)*(w-_)*d:x===c&&(l[g+_*a]+=(m-y)*(x-w)*d):g===a&&(0<=_&&x<c?(l[y+_*a]+=(g-m)*(x-w)*d,l[y+x*a]+=(g-m)*(w-_)*d):-1===_?l[y+x*a]+=(g-m)*(w-_)*d:x===c&&(l[y+_*a]+=(g-m)*(x-w)*d))}return l}(t,o,a,s,l,h,d,f,p,m),g=(h-l)/(d-1),w=(p-f)/(m-1),_=y.some(t=>t<0);let x,b=or(u/g,_),M=or(c/w,_);function*S(t="x",n="y",e="z"){const r=A.grid(),i=1/(g*w);for(let o=0,a=0;a<m;++a)for(let s=0;s<d;++s,++o)yield{[t]:l+s*g,[n]:f+a*w,[e]:r[o]*i}}const A={[Symbol.iterator]:S,points:S,grid:()=>x||(x=function(t,n,e,[r,i]){const o=new Float64Array(Math.max(r,i)),a=new Float64Array(Math.max(r,i)),s=new Float64Array(5),u=new Float64Array(e.length);for(let n=0,c=0;n<i;++n,c+=r){const n=u.subarray(c);ar(t,e.subarray(c),r,1,o,a,s,n)}for(let t=0;t<r;++t){const e=u.subarray(t);ar(n,e,i,r,o,a,s,e)}return u}(b,M,y,[d,m])),extent:()=>[[l,h],[f,p]],heatmap:({color:t,clamp:n,canvas:e,maxColors:r}={})=>function(t,n,e,r=t=>({r:0,g:0,b:0,opacity:t}),[i,o]=[lr(t,0),cr(t,0)],a=function(t,n){if("undefined"!=typeof document){const e=document.createElement("canvas");return e.setAttribute("width",t),e.setAttribute("height",n),e}throw"Can not create a canvas instance, provide a canvas as a parameter."}(n,e),s=256){const u=1/(o-i),c=a.getContext("2d"),l=c.getImageData(0,0,n,e),h=l.data,f=s-1,p=function(t,n){const e=new Uint8ClampedArray(4*(t+1));for(let r=0;r<=t;++r){const i=n(r/t),{r:o,g:a,b:s,opacity:u=1}="string"==typeof i?Nn(i):i,c=r<<2;e[c+0]=o,e[c+1]=a,e[c+2]=s,e[c+3]=255*u|0}return e}(f,r);for(let r=0,o=0;r<e;++r)for(let a=0,s=(e-r-1)*n;a<n;++a,o+=4){const n=f*Math.min(1,Math.max(t[a+s]-i,0)*u)<<2;h[o+0]=p[n+0],h[o+1]=p[n+1],h[o+2]=p[n+2],h[o+3]=p[n+3]}return c.putImageData(l,0,0),a}(A.grid(),d,m,t,n,e,r),bandwidth(t){if(arguments.length){const[n,e]=vr(t);return n!==u&&(x=null,b=or((u=n)/g,_)),e!==c&&(x=null,M=or((c=e)/w,_)),A}return[u,c]}};return A}function vr(t){return null==t?[void 0,void 0]:"number"==typeof t?[t,t]:t}function dr(t){return dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(t)}function mr(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function yr(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gr(r.key),r)}}function gr(t){var n=function(t){if("object"!=dr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,"string");if("object"!=dr(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dr(n)?n:n+""}function wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wr=function(){return!!t})()}function _r(t){return _r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_r(t)}function xr(t,n){return xr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},xr(t,n)}rr({thousands:",",grouping:[3],currency:["$",""]}),Ne.getParameterByName,rr({decimal:".",thousands:" ",grouping:[3],currency:["","€"]});var br=function(t){function n(t){var e;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),e=function(t,n,e){return n=_r(n),function(t,n){if(n&&("object"==dr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,wr()?Reflect.construct(n,e||[],_r(t).constructor):n.apply(t,e))}(this,n,[t]),t=t||{},e.value=t.value,e.sigma=t.sigma,e.factor=t.factor||2,e.filterSmoothed=t.filterSmoothed,e.smoothedProperty=t.smoothedProperty||"ksmval",e.styles=t.styles||[],e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&xr(t,n)}(n,t),e=n,(r=[{key:"draw",value:function(t,n,e){var r=this;if(this.filter&&(t=t.filter(this.filter)),t&&0!=t.length){var i=n.view.z,o=this.sigma(e,i),a=Math.ceil(n.w/this.factor),s=Math.ceil(n.h/this.factor),u=[[n.pixToGeoX(0),n.pixToGeoX(a*this.factor)],[n.pixToGeoY(s*this.factor),n.pixToGeoY(0)]],c=pr(t,{x:function(t){return t.x+e/2},y:function(t){return t.y+e/2},weight:function(t){return r.value(t)},bins:[a,s],bandwidth:o,extent:u}).grid(),l=(u[0][1]-u[0][0])/a;t=[];for(var h=0;h<c.length;h++){var f=c[h];if(!this.filterSmoothed||this.filterSmoothed(f)){var p=Math.floor(h/a),v=h%a,d={x:u[0][0]+v*l,y:u[1][0]+p*l};d[this.smoothedProperty]=f,t.push(d)}}var m,y=function(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,n){if(t){if("string"==typeof t)return mr(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?mr(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}(this.styles);try{for(y.s();!(m=y.n()).done;){var g=m.value;n.ctx.globalAlpha=g.alpha?g.alpha(i):1,n.ctx.globalCompositeOperation=g.blendOperation(i),g.draw(t,n,l)}}catch(t){y.e(t)}finally{y.f()}}}}])&&yr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r}(Pe);return n})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gridviz-smoothing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Gaussian kernel density smoothing for GridViz",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/eurostat/gridviz-smoothing",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"start-dev": "webpack --config webpack.config.dev.cjs",
|
|
27
27
|
"server": "webpack serve -c webpack.config.dev.js --static ./",
|
|
28
28
|
"doc": "./node_modules/.bin/jsdoc src/ src/dataset src/legend src/style -d docs/jsdoc",
|
|
29
|
-
"
|
|
29
|
+
"bp": "webpack --config webpack.config.prod.cjs",
|
|
30
30
|
"test": "jest"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"src/**/*.js"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"fast-kde": "^0.2.2",
|
|
38
|
+
"gridviz": "^3.0.31"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/core": "^7.9.0",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.9.0",
|
|
44
44
|
"@babel/runtime": "^7.12.1",
|
|
45
45
|
"babel-loader": "^8.1.0",
|
|
46
|
-
"jest": "^
|
|
46
|
+
"jest": "^30.2.0",
|
|
47
47
|
"jshint": "^2.12.0",
|
|
48
48
|
"prettier": "2.8.8",
|
|
49
49
|
"puppeteer": "^9.1.1",
|
|
50
50
|
"webpack": "^5.75.0",
|
|
51
51
|
"webpack-cli": "^5.0.0",
|
|
52
|
-
"webpack-dev-server": "^
|
|
52
|
+
"webpack-dev-server": "^5.2.2",
|
|
53
53
|
"webpack-livereload-plugin": "^3.0.2"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
@@ -41,12 +41,12 @@ export class KernelSmoothingStyle extends Style {
|
|
|
41
41
|
* Return true to keep the cell, false otherwise.
|
|
42
42
|
* @type { function(number):boolean }
|
|
43
43
|
*/
|
|
44
|
-
this.
|
|
44
|
+
this.filterSmoothed = opts.filterSmoothed
|
|
45
45
|
|
|
46
|
-
/** The name of the
|
|
46
|
+
/** The name of the cell property where the smoothed value is stored in the output smoothed grid.
|
|
47
47
|
* @type { string }
|
|
48
48
|
*/
|
|
49
|
-
this.
|
|
49
|
+
this.smoothedProperty = opts.smoothedProperty || 'ksmval'
|
|
50
50
|
|
|
51
51
|
/** The styles to represent the smoothed grid.
|
|
52
52
|
* @type {Array.<Style>}
|
|
@@ -55,36 +55,40 @@ export class KernelSmoothingStyle extends Style {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
draw(cells,
|
|
58
|
+
* Draw the smoothed cells depending on the list of styles specified.
|
|
59
|
+
* @param {Array.<Cell>} cells
|
|
60
|
+
* @param {GeoCanvas} geoCanvas
|
|
61
|
+
* @param {number} resolution
|
|
62
|
+
* @override
|
|
63
|
+
*/
|
|
64
|
+
draw(cells, geoCanvas, resolution) {
|
|
65
65
|
|
|
66
66
|
//filter
|
|
67
67
|
if (this.filter) cells = cells.filter(this.filter)
|
|
68
68
|
|
|
69
69
|
if (!cells || cells.length == 0) return
|
|
70
70
|
|
|
71
|
+
//
|
|
72
|
+
const z = geoCanvas.view.z
|
|
73
|
+
|
|
71
74
|
//get smoothing param in geo unit
|
|
72
75
|
/** @type {number} */
|
|
73
|
-
const sG = this.sigma(
|
|
76
|
+
const sG = this.sigma(resolution, z)
|
|
74
77
|
|
|
75
78
|
//compute smoothed grid dimensions
|
|
76
|
-
|
|
77
|
-
const
|
|
79
|
+
//TODO ceil ? why not floor ?
|
|
80
|
+
const nbX = Math.ceil(geoCanvas.w / this.factor)
|
|
81
|
+
const nbY = Math.ceil(geoCanvas.h / this.factor)
|
|
78
82
|
//compute smoothed grid geo extent
|
|
79
83
|
const e_ = [
|
|
80
|
-
[
|
|
81
|
-
[
|
|
84
|
+
[geoCanvas.pixToGeoX(0), geoCanvas.pixToGeoX(nbX * this.factor)],
|
|
85
|
+
[geoCanvas.pixToGeoY(nbY * this.factor), geoCanvas.pixToGeoY(0)],
|
|
82
86
|
]
|
|
83
87
|
|
|
84
88
|
//compute smoothed grid
|
|
85
89
|
let g = density2d(cells, {
|
|
86
|
-
x: (c) => c.x +
|
|
87
|
-
y: (c) => c.y +
|
|
90
|
+
x: (c) => c.x + resolution / 2,
|
|
91
|
+
y: (c) => c.y + resolution / 2,
|
|
88
92
|
weight: (c) => this.value(c),
|
|
89
93
|
bins: [nbX, nbY],
|
|
90
94
|
bandwidth: sG,
|
|
@@ -98,20 +102,20 @@ export class KernelSmoothingStyle extends Style {
|
|
|
98
102
|
cells = []
|
|
99
103
|
for (let ind = 0; ind < g.length; ind++) {
|
|
100
104
|
const v = g[ind]
|
|
101
|
-
if (this.
|
|
105
|
+
if (this.filterSmoothed && !this.filterSmoothed(v)) continue
|
|
102
106
|
const row = Math.floor(ind / nbX)
|
|
103
107
|
const col = ind % nbX
|
|
104
108
|
const c = { x: e_[0][0] + col * resSmoothed, y: e_[1][0] + row * resSmoothed }
|
|
105
|
-
c[this.
|
|
109
|
+
c[this.smoothedProperty] = v
|
|
106
110
|
cells.push(c)
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
//draw smoothed cells from styles
|
|
110
114
|
for (let s of this.styles) {
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
geoCanvas.ctx.globalAlpha = s.alpha ? s.alpha(z) : 1.0
|
|
116
|
+
geoCanvas.ctx.globalCompositeOperation = s.blendOperation(z)
|
|
113
117
|
|
|
114
|
-
s.draw(cells,
|
|
118
|
+
s.draw(cells, geoCanvas, resSmoothed)
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
//update legends
|