gridviz 2.0.8 → 2.0.9

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/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  [Gridviz](https://github.com/eurostat/gridviz/) is a JavaScript library to visualise gridded data (or any tabular dataset with x/y position) in the browser in a large variety of advanced cartographic styles. Unlike traditional raster-based web mapping tools, [Gridviz](https://github.com/eurostat/gridviz/) renders everything client-side, on the fly.
8
8
 
9
9
  [![](/docs/img/overviews/ov_accessibility.png)](docs/reference.md#shapecolorsize-style)
10
+ [![](/docs/img/overviews/ov_side_cat.png)](docs/reference.md#side-category-style)
10
11
  [![](/docs/img/overviews/ov_age_balance.png)](docs/reference.md#shapecolorsize-style)
11
12
  [![shadow effect map](/docs/img/overviews/ov_choco.png)](docs/reference.md#side-style)
12
13
  [![](/docs/img/overviews/ov_dark.png)](docs/reference.md#square-color-webgl-style)
@@ -51,7 +52,7 @@ gridviz = require("gridviz");
51
52
  ### standalone
52
53
 
53
54
  ```javascript
54
- <script src="https://unpkg.com/gridviz/build/gridviz.min.js"></script>
55
+ <script src="https://unpkg.com/gridviz/dist/gridviz.min.js"></script>
55
56
  ```
56
57
 
57
58
  ## Documentation
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gviz=e():t.gviz=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(){}function i(t){return null==t?n:function(){return this.querySelector(t)}}function o(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function r(){return[]}function s(t){return null==t?r:function(){return this.querySelectorAll(t)}}function a(t){return function(){return this.matches(t)}}function l(t){return function(e){return e.matches(t)}}t.r(e),t.d(e,{App:()=>wi,BackgroundLayer:()=>yi,BoundaryLayer:()=>xi,CSVGrid:()=>ui,ColorCategoryLegend:()=>lo,ColorDiscreteLegend:()=>ao,ColorLegend:()=>so,CompositionStyle:()=>_i,ContourStyle:()=>Ai,Dataset:()=>$n,DatasetComponent:()=>ci,DotDensityStyle:()=>Di,JoyPlotStyle:()=>Si,KernelSmoothingStyle:()=>zi,LabelLayer:()=>mi,Layer:()=>Xn,LegoStyle:()=>Oi,MosaicStyle:()=>ji,PillarStyle:()=>Ei,SegmentStyle:()=>Mi,SegmentWidthLegend:()=>co,ShapeColorSizeStyle:()=>bi,SideCatStyle:()=>Fi,SideStyle:()=>Ti,SizeLegend:()=>ho,SquareColorCatWGLStyle:()=>Gi,SquareColorWGLStyle:()=>Bi,StrokeStyle:()=>Ci,TanakaStyle:()=>Wi,TextStyle:()=>ki,TiledGrid:()=>vi,getClass:()=>gi,getEuronymeLabelLayer:()=>Br,getEurostatBoundariesLayer:()=>Wr,getParameterByName:()=>Ur,goToStraight:()=>fo,sCircleHigh:()=>xo,sCircleLow:()=>mo,sExp:()=>vo,sExpInverse:()=>wo,sExpRev:()=>yo,sExpRevInverse:()=>bo,sPow:()=>po,sPowInverse:()=>Co,sPowRev:()=>go,sPowRevInverse:()=>So,zoomTo:()=>uo});var h=Array.prototype.find;function c(){return this.firstElementChild}var u=Array.prototype.filter;function f(){return Array.from(this.children)}function d(t){return new Array(t.length)}function p(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function g(t){return function(){return t}}function v(t,e,n,i,o,r){for(var s,a=0,l=e.length,h=r.length;a<h;++a)(s=e[a])?(s.__data__=r[a],i[a]=s):n[a]=new p(t,r[a]);for(;a<l;++a)(s=e[a])&&(o[a]=s)}function y(t,e,n,i,o,r,s){var a,l,h,c=new Map,u=e.length,f=r.length,d=new Array(u);for(a=0;a<u;++a)(l=e[a])&&(d[a]=h=s.call(l,l.__data__,a,e)+"",c.has(h)?o[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(t,r[a],a,r)+"",(l=c.get(h))?(i[a]=l,l.__data__=r[a],c.delete(h)):n[a]=new p(t,r[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(o[a]=l)}function m(t){return t.__data__}function x(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function w(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}p.prototype={constructor:p,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var b="http://www.w3.org/1999/xhtml";const C={svg:"http://www.w3.org/2000/svg",xhtml:b,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function S(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),C.hasOwnProperty(e)?{space:C[e],local:t}:t}function _(t){return function(){this.removeAttribute(t)}}function M(t){return function(){this.removeAttributeNS(t.space,t.local)}}function k(t,e){return function(){this.setAttribute(t,e)}}function z(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function T(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function A(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function F(t){return function(){this.style.removeProperty(t)}}function P(t,e,n){return function(){this.style.setProperty(t,e,n)}}function L(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function N(t,e){return t.style.getPropertyValue(e)||A(t).getComputedStyle(t,null).getPropertyValue(e)}function R(t){return function(){delete this[t]}}function Z(t,e){return function(){this[t]=e}}function D(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function I(t){return t.trim().split(/^|\s+/)}function B(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=I(t.getAttribute("class")||"")}function U(t,e){for(var n=B(t),i=-1,o=e.length;++i<o;)n.add(e[i])}function G(t,e){for(var n=B(t),i=-1,o=e.length;++i<o;)n.remove(e[i])}function O(t){return function(){U(this,t)}}function Y(t){return function(){G(this,t)}}function j(t,e){return function(){(e.apply(this,arguments)?U:G)(this,t)}}function V(){this.textContent=""}function X(t){return function(){this.textContent=t}}function $(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function q(){this.innerHTML=""}function H(t){return function(){this.innerHTML=t}}function K(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function Q(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===b&&e.documentElement.namespaceURI===b?e.createElement(t):e.createElementNS(n,t)}}function et(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function nt(t){var e=S(t);return(e.local?et:tt)(e)}function it(){return null}function ot(){var t=this.parentNode;t&&t.removeChild(this)}function rt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function st(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function at(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function lt(t){return function(){var e=this.__on;if(e){for(var n,i=0,o=-1,r=e.length;i<r;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?e.length=o:delete this.__on}}}function ht(t,e,n){return function(){var i,o=this.__on,r=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(o)for(var s=0,a=o.length;s<a;++s)if((i=o[s]).type===t.type&&i.name===t.name)return this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),void(i.value=e);this.addEventListener(t.type,r,n),i={type:t.type,name:t.name,value:e,listener:r,options:n},o?o.push(i):this.__on=[i]}}function ct(t,e,n){var i=A(t),o=i.CustomEvent;"function"==typeof o?o=new o(e,n):(o=i.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function ut(t,e){return function(){return ct(this,t,e)}}function ft(t,e){return function(){return ct(this,t,e.apply(this,arguments))}}W.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var dt=[null];function pt(t,e){this._groups=t,this._parents=e}function gt(){return new pt([[document.documentElement]],dt)}pt.prototype=gt.prototype={constructor:pt,select:function(t){"function"!=typeof t&&(t=i(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var s,a,l=e[r],h=l.length,c=o[r]=new Array(h),u=0;u<h;++u)(s=l[u])&&(a=t.call(s,s.__data__,u,l))&&("__data__"in s&&(a.__data__=s.__data__),c[u]=a);return new pt(o,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return o(t.apply(this,arguments))}}(t):s(t);for(var e=this._groups,n=e.length,i=[],r=[],a=0;a<n;++a)for(var l,h=e[a],c=h.length,u=0;u<c;++u)(l=h[u])&&(i.push(t.call(l,l.__data__,u,h)),r.push(l));return new pt(i,r)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return h.call(this.children,t)}}("function"==typeof t?t:l(t)))},selectChildren:function(t){return this.selectAll(null==t?f:function(t){return function(){return u.call(this.children,t)}}("function"==typeof t?t:l(t)))},filter:function(t){"function"!=typeof t&&(t=a(t));for(var e=this._groups,n=e.length,i=new Array(n),o=0;o<n;++o)for(var r,s=e[o],l=s.length,h=i[o]=[],c=0;c<l;++c)(r=s[c])&&t.call(r,r.__data__,c,s)&&h.push(r);return new pt(i,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,m);var n=e?y:v,i=this._parents,o=this._groups;"function"!=typeof t&&(t=g(t));for(var r=o.length,s=new Array(r),a=new Array(r),l=new Array(r),h=0;h<r;++h){var c=i[h],u=o[h],f=u.length,d=x(t.call(c,c&&c.__data__,h,i)),p=d.length,w=a[h]=new Array(p),b=s[h]=new Array(p),C=l[h]=new Array(f);n(c,u,w,b,C,d,e);for(var S,_,M=0,k=0;M<p;++M)if(S=w[M]){for(M>=k&&(k=M+1);!(_=b[k])&&++k<p;);S._next=_||null}}return(s=new pt(s,i))._enter=a,s._exit=l,s},enter:function(){return new pt(this._enter||this._groups.map(d),this._parents)},exit:function(){return new pt(this._exit||this._groups.map(d),this._parents)},join:function(t,e,n){var i=this.enter(),o=this,r=this.exit();return"function"==typeof t?(i=t(i))&&(i=i.selection()):i=i.append(t+""),null!=e&&(o=e(o))&&(o=o.selection()),null==n?r.remove():n(r),i&&o?i.merge(o).order():o},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,o=n.length,r=i.length,s=Math.min(o,r),a=new Array(o),l=0;l<s;++l)for(var h,c=n[l],u=i[l],f=c.length,d=a[l]=new Array(f),p=0;p<f;++p)(h=c[p]||u[p])&&(d[p]=h);for(;l<o;++l)a[l]=n[l];return new pt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,o=t[e],r=o.length-1,s=o[r];--r>=0;)(i=o[r])&&(s&&4^i.compareDocumentPosition(s)&&s.parentNode.insertBefore(i,s),s=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=w);for(var n=this._groups,i=n.length,o=new Array(i),r=0;r<i;++r){for(var s,a=n[r],l=a.length,h=o[r]=new Array(l),c=0;c<l;++c)(s=a[c])&&(h[c]=s);h.sort(e)}return new pt(o,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,e=0,n=t.length;e<n;++e)for(var i=t[e],o=0,r=i.length;o<r;++o){var s=i[o];if(s)return s}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var o,r=e[n],s=0,a=r.length;s<a;++s)(o=r[s])&&t.call(o,o.__data__,s,r);return this},attr:function(t,e){var n=S(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?M:_:"function"==typeof e?n.local?T:E:n.local?z:k)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?F:"function"==typeof e?L:P)(t,e,null==n?"":n)):N(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?R:"function"==typeof e?D:Z)(t,e)):this.node()[t]},classed:function(t,e){var n=I(t+"");if(arguments.length<2){for(var i=B(this.node()),o=-1,r=n.length;++o<r;)if(!i.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?j:e?O:Y)(n,e))},text:function(t){return arguments.length?this.each(null==t?V:("function"==typeof t?$:X)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?q:("function"==typeof t?K:H)(t)):this.node().innerHTML},raise:function(){return this.each(J)},lower:function(){return this.each(Q)},append:function(t){var e="function"==typeof t?t:nt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:nt(t),o=null==e?it:"function"==typeof e?e:i(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(ot)},clone:function(t){return this.select(t?st:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,o,r=at(t+""),s=r.length;if(!(arguments.length<2)){for(a=e?ht:lt,i=0;i<s;++i)this.each(a(r[i],e,n));return this}var a=this.node().__on;if(a)for(var l,h=0,c=a.length;h<c;++h)for(i=0,l=a[h];i<s;++i)if((o=r[i]).type===l.type&&o.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?ft:ut)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i,o=t[e],r=0,s=o.length;r<s;++r)(i=o[r])&&(yield i)}};const vt=gt;function yt(t){return"string"==typeof t?new pt([[document.querySelector(t)]],[document.documentElement]):new pt([[t]],dt)}var mt={value:()=>{}};function xt(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new wt(i)}function wt(t){this._=t}function bt(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Ct(t,e){for(var n,i=0,o=t.length;i<o;++i)if((n=t[i]).name===e)return n.value}function St(t,e,n){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=mt,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}wt.prototype=xt.prototype={constructor:wt,on:function(t,e){var n,i=this._,o=bt(t+"",i),r=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++r<s;)if(n=(t=o[r]).type)i[n]=St(i[n],t.name,e);else if(null==e)for(n in i)i[n]=St(i[n],t.name,null);return this}for(;++r<s;)if((n=(t=o[r]).type)&&(n=Ct(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new wt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,o=new Array(n),r=0;r<n;++r)o[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=0,n=(i=this._[t]).length;r<n;++r)i[r].value.apply(e,o)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)}};const _t=xt,Mt={capture:!0,passive:!1};function kt(t){t.preventDefault(),t.stopImmediatePropagation()}function zt(t){var e=t.document.documentElement,n=yt(t).on("dragstart.drag",kt,Mt);"onselectstart"in e?n.on("selectstart.drag",kt,Mt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Et(t,e){var n=t.document.documentElement,i=yt(t).on("dragstart.drag",null);e&&(i.on("click.drag",kt,Mt),setTimeout((function(){i.on("click.drag",null)}),0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Tt(t){return((t=Math.exp(t))+1/t)/2}const At=function t(e,n,i){function o(t,o){var r,s,a=t[0],l=t[1],h=t[2],c=o[0],u=o[1],f=o[2],d=c-a,p=u-l,g=d*d+p*p;if(g<1e-12)s=Math.log(f/h)/e,r=function(t){return[a+t*d,l+t*p,h*Math.exp(e*t*s)]};else{var v=Math.sqrt(g),y=(f*f-h*h+i*g)/(2*h*n*v),m=(f*f-h*h-i*g)/(2*f*n*v),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(m*m+1)-m);s=(w-x)/e,r=function(t){var i,o=t*s,r=Tt(x),c=h/(n*v)*(r*(i=e*o+x,((i=Math.exp(2*i))-1)/(i+1))-function(t){return((t=Math.exp(t))-1/t)/2}(x));return[a+c*d,l+c*p,h*r/Tt(e*o+x)]}}return r.duration=1e3*s*e/Math.SQRT2,r}return o.rho=function(e){var n=Math.max(.001,+e),i=n*n;return t(n,i,i*i)},o}(Math.SQRT2,2,4);function Ft(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,[(i=i.matrixTransform(e.getScreenCTM().inverse())).x,i.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}var Pt,Lt,Nt=0,Rt=0,Zt=0,Dt=0,It=0,Bt=0,Wt="object"==typeof performance&&performance.now?performance:Date,Ut="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gt(){return It||(Ut(Ot),It=Wt.now()+Bt)}function Ot(){It=0}function Yt(){this._call=this._time=this._next=null}function jt(t,e,n){var i=new Yt;return i.restart(t,e,n),i}function Vt(){It=(Dt=Wt.now())+Bt,Nt=Rt=0;try{!function(){Gt(),++Nt;for(var t,e=Pt;e;)(t=It-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Nt}()}finally{Nt=0,function(){for(var t,e,n=Pt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Pt=e);Lt=t,$t(i)}(),It=0}}function Xt(){var t=Wt.now(),e=t-Dt;e>1e3&&(Bt-=e,Dt=t)}function $t(t){Nt||(Rt&&(Rt=clearTimeout(Rt)),t-It>24?(t<1/0&&(Rt=setTimeout(Vt,t-Wt.now()-Bt)),Zt&&(Zt=clearInterval(Zt))):(Zt||(Dt=Wt.now(),Zt=setInterval(Xt,1e3)),Nt=1,Ut(Vt)))}function qt(t,e,n){var i=new Yt;return e=null==e?0:+e,i.restart((n=>{i.stop(),t(n+e)}),e,n),i}Yt.prototype=jt.prototype={constructor:Yt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Gt():+n)+(null==e?0:+e),this._next||Lt===this||(Lt?Lt._next=this:Pt=this,Lt=this),this._call=t,this._time=n,$t()},stop:function(){this._call&&(this._call=null,this._time=1/0,$t())}};var Ht=_t("start","end","cancel","interrupt"),Kt=[];function Jt(t,e,n,i,o,r){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var i,o=t.__transition;function r(l){var h,c,u,f;if(1!==n.state)return a();for(h in o)if((f=o[h]).name===n.name){if(3===f.state)return qt(r);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete o[h]):+h<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete o[h])}if(qt((function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(l))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,i=new Array(u=n.tween.length),h=0,c=-1;h<u;++h)(f=n.tween[h].value.call(t,t.__data__,n.index,n.group))&&(i[++c]=f);i.length=c+1}}function s(e){for(var o=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(a),n.state=5,1),r=-1,s=i.length;++r<s;)i[r].call(t,o);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){for(var i in n.state=6,n.timer.stop(),delete o[e],o)return;delete t.__transition}o[e]=n,n.timer=jt((function(t){n.state=1,n.timer.restart(r,n.delay,n.time),n.delay<=t&&r(t-n.delay)}),0,n.time)}(t,n,{name:e,index:i,group:o,on:Ht,tween:Kt,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:0})}function Qt(t,e){var n=ee(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function te(t,e){var n=ee(t,e);if(n.state>3)throw new Error("too late; already running");return n}function ee(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ne(t,e){var n,i,o,r=t.__transition,s=!0;if(r){for(o in e=null==e?null:e+"",r)(n=r[o]).name===e?(i=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]):s=!1;s&&delete t.__transition}}function ie(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var oe,re=180/Math.PI,se={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ae(t,e,n,i,o,r){var s,a,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),t*i<e*n&&(t=-t,e=-e,l=-l,s=-s),{translateX:o,translateY:r,rotate:Math.atan2(e,t)*re,skewX:Math.atan(l)*re,scaleX:s,scaleY:a}}function le(t,e,n,i){function o(t){return t.length?t.pop()+" ":""}return function(r,s){var a=[],l=[];return r=t(r),s=t(s),function(t,i,o,r,s,a){if(t!==o||i!==r){var l=s.push("translate(",null,e,null,n);a.push({i:l-4,x:ie(t,o)},{i:l-2,x:ie(i,r)})}else(o||r)&&s.push("translate("+o+e+r+n)}(r.translateX,r.translateY,s.translateX,s.translateY,a,l),function(t,e,n,r){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(o(n)+"rotate(",null,i)-2,x:ie(t,e)})):e&&n.push(o(n)+"rotate("+e+i)}(r.rotate,s.rotate,a,l),function(t,e,n,r){t!==e?r.push({i:n.push(o(n)+"skewX(",null,i)-2,x:ie(t,e)}):e&&n.push(o(n)+"skewX("+e+i)}(r.skewX,s.skewX,a,l),function(t,e,n,i,r,s){if(t!==n||e!==i){var a=r.push(o(r)+"scale(",null,",",null,")");s.push({i:a-4,x:ie(t,n)},{i:a-2,x:ie(e,i)})}else 1===n&&1===i||r.push(o(r)+"scale("+n+","+i+")")}(r.scaleX,r.scaleY,s.scaleX,s.scaleY,a,l),r=s=null,function(t){for(var e,n=-1,i=l.length;++n<i;)a[(e=l[n]).i]=e.x(t);return a.join("")}}}var he=le((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?se:ae(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),ce=le((function(t){return null==t?se:(oe||(oe=document.createElementNS("http://www.w3.org/2000/svg","g")),oe.setAttribute("transform",t),(t=oe.transform.baseVal.consolidate())?ae((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):se)}),", ",")",")");function ue(t,e){var n,i;return function(){var o=te(this,t),r=o.tween;if(r!==n)for(var s=0,a=(i=n=r).length;s<a;++s)if(i[s].name===e){(i=i.slice()).splice(s,1);break}o.tween=i}}function fe(t,e,n){var i,o;if("function"!=typeof n)throw new Error;return function(){var r=te(this,t),s=r.tween;if(s!==i){o=(i=s).slice();for(var a={name:e,value:n},l=0,h=o.length;l<h;++l)if(o[l].name===e){o[l]=a;break}l===h&&o.push(a)}r.tween=o}}function de(t,e,n){var i=t._id;return t.each((function(){var t=te(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return ee(t,i).value[e]}}function pe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ge(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function ve(){}var ye=.7,me=1/ye,xe="\\s*([+-]?\\d+)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ce=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${xe},${xe},${xe}\\)$`),_e=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Me=new RegExp(`^rgba\\(${xe},${xe},${xe},${we}\\)$`),ke=new RegExp(`^rgba\\(${be},${be},${be},${we}\\)$`),ze=new RegExp(`^hsl\\(${we},${be},${be}\\)$`),Ee=new RegExp(`^hsla\\(${we},${be},${be},${we}\\)$`),Te={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 Ae(){return this.rgb().formatHex()}function Fe(){return this.rgb().formatRgb()}function Pe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ce.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Le(e):3===n?new De(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ne(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ne(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Se.exec(t))?new De(e[1],e[2],e[3],1):(e=_e.exec(t))?new De(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Me.exec(t))?Ne(e[1],e[2],e[3],e[4]):(e=ke.exec(t))?Ne(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ze.exec(t))?Oe(e[1],e[2]/100,e[3]/100,1):(e=Ee.exec(t))?Oe(e[1],e[2]/100,e[3]/100,e[4]):Te.hasOwnProperty(t)?Le(Te[t]):"transparent"===t?new De(NaN,NaN,NaN,0):null}function Le(t){return new De(t>>16&255,t>>8&255,255&t,1)}function Ne(t,e,n,i){return i<=0&&(t=e=n=NaN),new De(t,e,n,i)}function Re(t){return t instanceof ve||(t=Pe(t)),t?new De((t=t.rgb()).r,t.g,t.b,t.opacity):new De}function Ze(t,e,n,i){return 1===arguments.length?Re(t):new De(t,e,n,null==i?1:i)}function De(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Ie(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}`}function Be(){const t=We(this.opacity);return`${1===t?"rgb(":"rgba("}${Ue(this.r)}, ${Ue(this.g)}, ${Ue(this.b)}${1===t?")":`, ${t})`}`}function We(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ue(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ge(t){return((t=Ue(t))<16?"0":"")+t.toString(16)}function Oe(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new je(t,e,n,i)}function Ye(t){if(t instanceof je)return new je(t.h,t.s,t.l,t.opacity);if(t instanceof ve||(t=Pe(t)),!t)return new je;if(t instanceof je)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,o=Math.min(e,n,i),r=Math.max(e,n,i),s=NaN,a=r-o,l=(r+o)/2;return a?(s=e===r?(n-i)/a+6*(n<i):n===r?(i-e)/a+2:(e-n)/a+4,a/=l<.5?r+o:2-r-o,s*=60):a=l>0&&l<1?0:s,new je(s,a,l,t.opacity)}function je(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Ve(t){return(t=(t||0)%360)<0?t+360:t}function Xe(t){return Math.max(0,Math.min(1,t||0))}function $e(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function qe(t,e,n,i,o){var r=t*t,s=r*t;return((1-3*t+3*r-s)*e+(4-6*r+3*s)*n+(1+3*t+3*r-3*s)*i+s*o)/6}pe(ve,Pe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ae,formatHex:Ae,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ye(this).formatHsl()},formatRgb:Fe,toString:Fe}),pe(De,Ze,ge(ve,{brighter(t){return t=null==t?me:Math.pow(me,t),new De(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ye:Math.pow(ye,t),new De(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new De(Ue(this.r),Ue(this.g),Ue(this.b),We(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:Ie,formatHex:Ie,formatHex8:function(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}${Ge(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Be,toString:Be})),pe(je,(function(t,e,n,i){return 1===arguments.length?Ye(t):new je(t,e,n,null==i?1:i)}),ge(ve,{brighter(t){return t=null==t?me:Math.pow(me,t),new je(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ye:Math.pow(ye,t),new je(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,o=2*n-i;return new De($e(t>=240?t-240:t+120,o,i),$e(t,o,i),$e(t<120?t+240:t-120,o,i),this.opacity)},clamp(){return new je(Ve(this.h),Xe(this.s),Xe(this.l),We(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=We(this.opacity);return`${1===t?"hsl(":"hsla("}${Ve(this.h)}, ${100*Xe(this.s)}%, ${100*Xe(this.l)}%${1===t?")":`, ${t})`}`}}));const He=t=>()=>t;function Ke(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):He(isNaN(t)?e:t)}const Je=function t(e){var n=function(t){return 1==(t=+t)?Ke:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):He(isNaN(e)?n:e)}}(e);function i(t,e){var i=n((t=Ze(t)).r,(e=Ze(e)).r),o=n(t.g,e.g),r=n(t.b,e.b),s=Ke(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=o(e),t.b=r(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function Qe(t){return function(e){var n,i,o=e.length,r=new Array(o),s=new Array(o),a=new Array(o);for(n=0;n<o;++n)i=Ze(e[n]),r[n]=i.r||0,s[n]=i.g||0,a[n]=i.b||0;return r=t(r),s=t(s),a=t(a),i.opacity=1,function(t){return i.r=r(t),i.g=s(t),i.b=a(t),i+""}}}Qe((function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[i],r=t[i+1],s=i>0?t[i-1]:2*o-r,a=i<e-1?t[i+2]:2*r-o;return qe((n-i/e)*e,s,o,r,a)}})),Qe((function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),o=t[(i+e-1)%e],r=t[i%e],s=t[(i+1)%e],a=t[(i+2)%e];return qe((n-i/e)*e,o,r,s,a)}}));var tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,en=new RegExp(tn.source,"g");function nn(t,e){var n,i,o,r=tn.lastIndex=en.lastIndex=0,s=-1,a=[],l=[];for(t+="",e+="";(n=tn.exec(t))&&(i=en.exec(e));)(o=i.index)>r&&(o=e.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:ie(n,i)})),r=en.lastIndex;return r<e.length&&(o=e.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)a[(n=l[i]).i]=n.x(t);return a.join("")})}function on(t,e){var n;return("number"==typeof e?ie:e instanceof Pe?Je:(n=Pe(e))?(e=n,Je):nn)(t,e)}function rn(t){return function(){this.removeAttribute(t)}}function sn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function an(t,e,n){var i,o,r=n+"";return function(){var s=this.getAttribute(t);return s===r?null:s===i?o:o=e(i=s,n)}}function ln(t,e,n){var i,o,r=n+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===i?o:o=e(i=s,n)}}function hn(t,e,n){var i,o,r;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(t))===(a=l+"")?null:s===i&&a===o?r:(o=a,r=e(i=s,l));this.removeAttribute(t)}}function cn(t,e,n){var i,o,r;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(t.space,t.local))===(a=l+"")?null:s===i&&a===o?r:(o=a,r=e(i=s,l));this.removeAttributeNS(t.space,t.local)}}function un(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function fn(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function dn(t,e){var n,i;function o(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&fn(t,o)),n}return o._value=e,o}function pn(t,e){var n,i;function o(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&un(t,o)),n}return o._value=e,o}function gn(t,e){return function(){Qt(this,t).delay=+e.apply(this,arguments)}}function vn(t,e){return e=+e,function(){Qt(this,t).delay=e}}function yn(t,e){return function(){te(this,t).duration=+e.apply(this,arguments)}}function mn(t,e){return e=+e,function(){te(this,t).duration=e}}function xn(t,e){if("function"!=typeof e)throw new Error;return function(){te(this,t).ease=e}}function wn(t,e,n){var i,o,r=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Qt:te;return function(){var s=r(this,t),a=s.on;a!==i&&(o=(i=a).copy()).on(e,n),s.on=o}}var bn=vt.prototype.constructor;function Cn(t){return function(){this.style.removeProperty(t)}}function Sn(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function _n(t,e,n){var i,o;function r(){var r=e.apply(this,arguments);return r!==o&&(i=(o=r)&&Sn(t,r,n)),i}return r._value=e,r}function Mn(t){return function(e){this.textContent=t.call(this,e)}}function kn(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Mn(i)),e}return i._value=t,i}var zn=0;function En(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Tn(){return++zn}var An=vt.prototype;En.prototype=function(t){return vt().transition(t)}.prototype={constructor:En,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=i(t));for(var o=this._groups,r=o.length,s=new Array(r),a=0;a<r;++a)for(var l,h,c=o[a],u=c.length,f=s[a]=new Array(u),d=0;d<u;++d)(l=c[d])&&(h=t.call(l,l.__data__,d,c))&&("__data__"in l&&(h.__data__=l.__data__),f[d]=h,Jt(f[d],e,n,d,f,ee(l,n)));return new En(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=s(t));for(var i=this._groups,o=i.length,r=[],a=[],l=0;l<o;++l)for(var h,c=i[l],u=c.length,f=0;f<u;++f)if(h=c[f]){for(var d,p=t.call(h,h.__data__,f,c),g=ee(h,n),v=0,y=p.length;v<y;++v)(d=p[v])&&Jt(d,e,n,v,p,g);r.push(p),a.push(h)}return new En(r,a,e,n)},selectChild:An.selectChild,selectChildren:An.selectChildren,filter:function(t){"function"!=typeof t&&(t=a(t));for(var e=this._groups,n=e.length,i=new Array(n),o=0;o<n;++o)for(var r,s=e[o],l=s.length,h=i[o]=[],c=0;c<l;++c)(r=s[c])&&t.call(r,r.__data__,c,s)&&h.push(r);return new En(i,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,o=n.length,r=Math.min(i,o),s=new Array(i),a=0;a<r;++a)for(var l,h=e[a],c=n[a],u=h.length,f=s[a]=new Array(u),d=0;d<u;++d)(l=h[d]||c[d])&&(f[d]=l);for(;a<i;++a)s[a]=e[a];return new En(s,this._parents,this._name,this._id)},selection:function(){return new bn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Tn(),i=this._groups,o=i.length,r=0;r<o;++r)for(var s,a=i[r],l=a.length,h=0;h<l;++h)if(s=a[h]){var c=ee(s,e);Jt(s,t,n,h,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new En(i,this._parents,t,n)},call:An.call,nodes:An.nodes,node:An.node,size:An.size,empty:An.empty,each:An.each,on:function(t,e){var n=this._id;return arguments.length<2?ee(this.node(),n).on.on(t):this.each(wn(n,t,e))},attr:function(t,e){var n=S(t),i="transform"===n?ce:on;return this.attrTween(t,"function"==typeof e?(n.local?cn:hn)(n,i,de(this,"attr."+t,e)):null==e?(n.local?sn:rn)(n):(n.local?ln:an)(n,i,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var i=S(t);return this.tween(n,(i.local?dn:pn)(i,e))},style:function(t,e,n){var i="transform"==(t+="")?he:on;return null==e?this.styleTween(t,function(t,e){var n,i,o;return function(){var r=N(this,t),s=(this.style.removeProperty(t),N(this,t));return r===s?null:r===n&&s===i?o:o=e(n=r,i=s)}}(t,i)).on("end.style."+t,Cn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var i,o,r;return function(){var s=N(this,t),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(t),l=a=N(this,t)),s===l?null:s===i&&l===o?r:(o=l,r=e(i=s,a))}}(t,i,de(this,"style."+t,e))).each(function(t,e){var n,i,o,r,s="style."+e,a="end."+s;return function(){var l=te(this,t),h=l.on,c=null==l.value[s]?r||(r=Cn(e)):void 0;h===n&&o===c||(i=(n=h).copy()).on(a,o=c),l.on=i}}(this._id,t)):this.styleTween(t,function(t,e,n){var i,o,r=n+"";return function(){var s=N(this,t);return s===r?null:s===i?o:o=e(i=s,n)}}(t,i,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;return this.tween(i,_n(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(de(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,kn(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i,o=ee(this.node(),n).tween,r=0,s=o.length;r<s;++r)if((i=o[r]).name===t)return i.value;return null}return this.each((null==e?ue:fe)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?gn:vn)(e,t)):ee(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?yn:mn)(e,t)):ee(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(xn(e,t)):ee(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;te(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,i=n._id,o=n.size();return new Promise((function(r,s){var a={value:s},l={value:function(){0==--o&&r()}};n.each((function(){var n=te(this,i),o=n.on;o!==t&&((e=(t=o).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),n.on=e})),0===o&&r()}))},[Symbol.iterator]:An[Symbol.iterator]};var Fn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Pn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}vt.prototype.interrupt=function(t){return this.each((function(){ne(this,t)}))},vt.prototype.transition=function(t){var e,n;t instanceof En?(e=t._id,t=t._name):(e=Tn(),(n=Fn).time=Gt(),t=null==t?null:t+"");for(var i=this._groups,o=i.length,r=0;r<o;++r)for(var s,a=i[r],l=a.length,h=0;h<l;++h)(s=a[h])&&Jt(s,t,e,h,a,n||Pn(s,e));return new En(i,this._parents,t,e)};const Ln=t=>()=>t;function Nn(t,{sourceEvent:e,target:n,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Rn(t,e,n){this.k=t,this.x=e,this.y=n}Rn.prototype={constructor:Rn,scale:function(t){return 1===t?this:new Rn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Rn(this.k,this.x+this.k*t,this.y+this.k*e)},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 Zn=new Rn(1,0,0);function Dn(t){t.stopImmediatePropagation()}function In(t){t.preventDefault(),t.stopImmediatePropagation()}function Bn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Wn(){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 Un(){return this.__zoom||Zn}function Gn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function On(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yn(t,e,n){var i=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}Rn.prototype;class jn{constructor(t,e,n=1,i){i=i||{},this.canvas=t,this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.canvas.width=this.w,this.canvas.height=this.h;const o=this.canvas.getContext("2d");if(!o)throw"Impossible to create canvas 2D context";this.ctx=o,this.center=e||{x:.5*this.w,y:.5*this.h},this.zf=n,this.backgroundColor=i.backgroundColor||"white",this.onZoomStartFun=i.onZoomStartFun,this.onZoomEndFun=i.onZoomEndFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo();let r=Zn;const s=function(){var t,e,n,i=Bn,o=Wn,r=Yn,s=Gn,a=On,l=[0,1/0],h=[[-1/0,-1/0],[1/0,1/0]],c=250,u=At,f=_t("start","zoom","end"),d=500,p=0,g=10;function v(t){t.property("__zoom",Un).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",M).filter(a).on("touchstart.zoom",k).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new Rn(e,t.x,t.y)}function m(t,e,n){var i=e[0]-n[0]*t.k,o=e[1]-n[1]*t.k;return i===t.x&&o===t.y?t:new Rn(t.k,i,o)}function x(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,i){t.on("start.zoom",(function(){b(this,arguments).event(i).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(i).end()})).tween("zoom",(function(){var t=this,r=arguments,s=b(t,r).event(i),a=o.apply(t,r),l=null==n?x(a):"function"==typeof n?n.apply(t,r):n,h=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),c=t.__zoom,f="function"==typeof e?e.apply(t,r):e,d=u(c.invert(l).concat(h/c.k),f.invert(l).concat(h/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=h/e[2];t=new Rn(n,l[0]-e[0]*n,l[1]-e[1]*n)}s.zoom(null,t)}}))}function b(t,e,n){return!n&&t.__zooming||new C(t,e)}function C(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(t,e),this.taps=0}function S(t,...e){if(i.apply(this,arguments)){var n=b(this,e).event(t),o=this.__zoom,a=Math.max(l[0],Math.min(l[1],o.k*Math.pow(2,s.apply(this,arguments)))),c=Ft(t);if(n.wheel)n.mouse[0][0]===c[0]&&n.mouse[0][1]===c[1]||(n.mouse[1]=o.invert(n.mouse[0]=c)),clearTimeout(n.wheel);else{if(o.k===a)return;n.mouse=[c,o.invert(c)],ne(this),n.start()}In(t),n.wheel=setTimeout(u,150),n.zoom("mouse",r(m(y(o,a),n.mouse[0],n.mouse[1]),n.extent,h))}function u(){n.wheel=null,n.end()}}function _(t,...e){if(!n&&i.apply(this,arguments)){var o=t.currentTarget,s=b(this,e,!0).event(t),a=yt(t.view).on("mousemove.zoom",f,!0).on("mouseup.zoom",d,!0),l=Ft(t,o),c=t.clientX,u=t.clientY;zt(t.view),Dn(t),s.mouse=[l,this.__zoom.invert(l)],ne(this),s.start()}function f(t){if(In(t),!s.moved){var e=t.clientX-c,n=t.clientY-u;s.moved=e*e+n*n>p}s.event(t).zoom("mouse",r(m(s.that.__zoom,s.mouse[0]=Ft(t,o),s.mouse[1]),s.extent,h))}function d(t){a.on("mousemove.zoom mouseup.zoom",null),Et(t.view,s.moved),In(t),s.event(t).end()}}function M(t,...e){if(i.apply(this,arguments)){var n=this.__zoom,s=Ft(t.changedTouches?t.changedTouches[0]:t,this),a=n.invert(s),l=n.k*(t.shiftKey?.5:2),u=r(m(y(n,l),s,a),o.apply(this,e),h);In(t),c>0?yt(this).transition().duration(c).call(w,u,s,t):yt(this).call(v.transform,u,s,t)}}function k(n,...o){if(i.apply(this,arguments)){var r,s,a,l,h=n.touches,c=h.length,u=b(this,o,n.changedTouches.length===c).event(n);for(Dn(n),s=0;s<c;++s)l=[l=Ft(a=h[s],this),this.__zoom.invert(l),a.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,r=!0,u.taps=1+!!t);t&&(t=clearTimeout(t)),r&&(u.taps<2&&(e=l[0],t=setTimeout((function(){t=null}),d)),ne(this),u.start())}}function z(t,...e){if(this.__zooming){var n,i,o,s,a=b(this,e).event(t),l=t.changedTouches,c=l.length;for(In(t),n=0;n<c;++n)o=Ft(i=l[n],this),a.touch0&&a.touch0[2]===i.identifier?a.touch0[0]=o:a.touch1&&a.touch1[2]===i.identifier&&(a.touch1[0]=o);if(i=a.that.__zoom,a.touch1){var u=a.touch0[0],f=a.touch0[1],d=a.touch1[0],p=a.touch1[1],g=(g=d[0]-u[0])*g+(g=d[1]-u[1])*g,v=(v=p[0]-f[0])*v+(v=p[1]-f[1])*v;i=y(i,Math.sqrt(g/v)),o=[(u[0]+d[0])/2,(u[1]+d[1])/2],s=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;o=a.touch0[0],s=a.touch0[1]}a.zoom("touch",r(m(i,o,s),a.extent,h))}}function E(t,...i){if(this.__zooming){var o,r,s=b(this,i).event(t),a=t.changedTouches,l=a.length;for(Dn(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),d),o=0;o<l;++o)r=a[o],s.touch0&&s.touch0[2]===r.identifier?delete s.touch0:s.touch1&&s.touch1[2]===r.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(r=Ft(r,this),Math.hypot(e[0]-r[0],e[1]-r[1])<g)){var h=yt(this).on("dblclick.zoom");h&&h.apply(this,arguments)}}}return v.transform=function(t,e,n,i){var o=t.selection?t.selection():t;o.property("__zoom",Un),t!==o?w(t,e,n,i):o.interrupt().each((function(){b(this,arguments).event(i).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},v.scaleBy=function(t,e,n,i){v.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,i)},v.scaleTo=function(t,e,n,i){v.transform(t,(function(){var t=o.apply(this,arguments),i=this.__zoom,s=null==n?x(t):"function"==typeof n?n.apply(this,arguments):n,a=i.invert(s),l="function"==typeof e?e.apply(this,arguments):e;return r(m(y(i,l),s,a),t,h)}),n,i)},v.translateBy=function(t,e,n,i){v.transform(t,(function(){return r(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),h)}),null,i)},v.translateTo=function(t,e,n,i,s){v.transform(t,(function(){var t=o.apply(this,arguments),s=this.__zoom,a=null==i?x(t):"function"==typeof i?i.apply(this,arguments):i;return r(Zn.translate(a[0],a[1]).scale(s.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,h)}),i,s)},C.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,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=yt(this.that).datum();f.call(t,this.that,new Nn(t,{sourceEvent:this.sourceEvent,target:v,type:t,transform:this.that.__zoom,dispatch:f}),e)}},v.wheelDelta=function(t){return arguments.length?(s="function"==typeof t?t:Ln(+t),v):s},v.filter=function(t){return arguments.length?(i="function"==typeof t?t:Ln(!!t),v):i},v.touchable=function(t){return arguments.length?(a="function"==typeof t?t:Ln(!!t),v):a},v.extent=function(t){return arguments.length?(o="function"==typeof t?t:Ln([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),v):o},v.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],v):[l[0],l[1]]},v.translateExtent=function(t){return arguments.length?(h[0][0]=+t[0][0],h[1][0]=+t[1][0],h[0][1]=+t[0][1],h[1][1]=+t[1][1],v):[[h[0][0],h[0][1]],[h[1][0],h[1][1]]]},v.constrain=function(t){return arguments.length?(r=t,v):r},v.duration=function(t){return arguments.length?(c=+t,v):c},v.interpolate=function(t){return arguments.length?(u=t,v):u},v.on=function(){var t=f.on.apply(f,arguments);return t===f?v:t},v.clickDistance=function(t){return arguments.length?(p=(t=+t)*t,v):Math.sqrt(p)},v.tapDistance=function(t){return arguments.length?(g=+t,v):g},v}().wheelDelta((t=>-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004))).on("zoom",(t=>{const e=t.transform,n=r.k/e.k;if(1==n){const t=r.x-e.x,n=r.y-e.y;this.pan(t*this.getZf(),-n*this.getZf())}else{const e=t.sourceEvent;if(e instanceof WheelEvent)this.zoom(n,this.pixToGeoX(t.sourceEvent.offsetX),this.pixToGeoY(t.sourceEvent.offsetY));else if(e instanceof TouchEvent){let t=0,i=0;for(let n of e.targetTouches)t+=n.clientX,i+=n.clientY;t/=e.targetTouches.length,i/=e.targetTouches.length,this.zoom(n,this.pixToGeoX(t),this.pixToGeoY(i))}}r=e})).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()})).on("end",(t=>{this.redraw(!0),this.canvasSave={c:null,dx:0,dy:0,f:1},this.onZoomEndFun&&this.onZoomEndFun()}));s(yt(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(),e=-this.center.x/this.getZf()+.5*this.w,n=this.center.y/this.getZf()+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n)}getWebGLTransform(){const t=2/(this.w*this.getZf()),e=2/(this.h*this.getZf());return[t,0,0,0,e,0,-t*this.center.x,-e*this.center.y,1]}redraw(t=!0){throw new Error("Method redraw not implemented.")}clear(t="white"){this.ctx&&(this.ctx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h)}pan(t=0,e=0){this.center.x+=t,this.center.y+=e,this.updateExtentGeo(),this.canvasSave.c&&(this.canvasSave.dx-=t/this.getZf(),this.canvasSave.dy+=e/this.getZf(),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy))}zoom(t=1,e=this.center.x,n=this.center.y){if(this.zfExtent[0]==this.getZf()&&t<=1)return;if(this.zfExtent[1]==this.getZf()&&t>=1)return;const i=t*this.getZf();i<this.zfExtent[0]&&(t=this.zfExtent[0]/this.getZf()),i>this.zfExtent[1]&&(t=this.zfExtent[1]/this.getZf()),this.setZf(t*this.getZf());const o=(e-this.center.x)*(1-t);this.center.x+=o;const r=(n-this.center.y)*(1-t);this.center.y+=r,this.updateExtentGeo(),this.canvasSave.c&&(this.clear(this.backgroundColor),this.canvasSave.f/=t,this.canvasSave.dx=this.geoToPixX(e)*(1-this.canvasSave.f),this.canvasSave.dy=this.geoToPixY(n)*(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=jn.getParameterByName("x"),e=jn.getParameterByName("y"),n=jn.getParameterByName("z"),i=this.getCenter();null==t||null==t||isNaN(+t)||(i.x=+t),null==e||null==e||isNaN(+e)||(i.y=+e),null==n||null==n||isNaN(+n)||this.setZf(+n)}addZoomSlider(t,e){(e=e||{}).width=e.width||"30px",e.height=e.height||"300px";const n=yt("#"+t);if(n.empty())return console.error("Could not find div element to build zoom slider. Id: "+t),this;const i=this;return this.slider=n.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 e=+this.value;yt(this).attr("value",e),i.setZf(e),i.redraw()})).style("width",e.width).style("height",e.height).style("opacity",.7).on("mouseover",(function(t){yt(this).style("opacity",1)})).on("mouseout",(function(t){yt(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 e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return e?decodeURIComponent(e[1].replace(/\+/g," ")):null}}class Vn{constructor(t){if(t=t||{},this.offset=t.offset||((t,e,n)=>({dx:0,dy:0})),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,e,n){throw new Error("Method draw not implemented.")}getOffset(){return this.offset}setOffset(t){return this.offset=t,this}updateLegends(t){for(const e of this.legends)e.update(t);return this}static getStatistics(t,e,n){if(!t||0==t.length)return;let i=1/0,o=-1/0;for(const r of t){const t=+e(r);n&&!t||(t<i&&(i=t),t>o&&(o=t))}return{min:i,max:o}}}class Xn{constructor(t,e,n={}){if(n=n||{},this.dataset=t,this.styles=e,this.visible=0!=n.visible,this.minZoom=n.minZoom||0,this.maxZoom=n.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.pixNb=n.pixNb||3,this.cellInfoHTML=n.cellInfoHTML||Xn.defaultCellInfoHTML}getDatasetComponent(t){if(t<this.minZoom||t>this.maxZoom)return;if(1==this.dataset.datasetComponents.length)return this.dataset.datasetComponents[0];const e=this.dataset.resolutions;let n=0,i=e[n]/this.pixNb;for(;i<t&&n<e.length;)n++,i=e[n]/this.pixNb;return n==e.length?this.dataset.datasetComponents[e.length-1]:this.dataset.datasetComponents[n]}static defaultCellInfoHTML(t){const e=[];for(const n of Object.keys(t))"x"!==n&&"y"!==n&&e.push("<b>",n,"</b>"," : ",t[n],"<br>");return e.join("")}}class $n{constructor(t,e,n={}){if(n=n||{},this.datasetComponents=t,this.resolutions=e,this.datasetComponents.length>1&&this.datasetComponents.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasetComponents.length+" "+this.resolutions.length);n.preprocess&&this.setPrepocesses(n.preprocess)}setPrepocesses(t){for(let e of this.datasetComponents)e.preprocess=t;return this}static make(t,e,n){const i=[];for(const n of t)i.push(e(n));return new $n(i,t,n)}}class qn{constructor(t){t=t||{},this.div=t.div||"tooltip_eurostat",this.maxWidth=t.maxWidth||"20em",this.fontSize=t.fontSize||"1.2em",this.background=t.background||"white",this.padding=t.padding||"5px",this.border=t.border||"0px",this["border-radius"]=t["border-radius"]||"5px",this["box-shadow"]=t["box-shadow"]||"5px 5px 5px grey",this["font-family"]=t["font-family"]||"Helvetica, Arial, sans-serif",this.transitionDuration=t.transitionDuration||100,this.xOffset=t.xOffset||30,this.yOffset=t.yOffset||20,this.tooltip=yt("#"+this.div),this.tooltip.empty()&&(this.tooltip=yt("body").append("div").attr("id",this.div)),this.tooltip.style("max-width",this.maxWidth),this.tooltip.style("overflow","hidden"),this.tooltip.style("font-size",this.fontSize),this.tooltip.style("background",this.background),this.tooltip.style("padding",this.padding),this.tooltip.style("border",this.border),this.tooltip.style("border-radius",this["border-radius"]),this.tooltip.style("box-shadow",this["box-shadow"]),this.tooltip.style("font-family",this["font-family"]),this.tooltip.style("position","absolute"),this.tooltip.style("pointer-events","none"),this.tooltip.style("opacity","0")}show(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",1)}hide(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",0)}html(t){this.tooltip.html(t)}setPosition(t){this.tooltip.style("left",t.pageX+this.xOffset+"px").style("top",t.pageY-this.yOffset+"px")}style(t,e){return 1==arguments.length?this.tooltip.style(t):(this.tooltip.style(t,e),this)}attr(t,e){return 1==arguments.length?this.tooltip.attr(t):(this.tooltip.attr(t,e),this)}}var Hn={},Kn={};function Jn(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Qn(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var i in t)i in e||n.push(e[i]=i)})),n}function ti(t,e){var n=t+"",i=n.length;return i<e?new Array(e-i+1).join(0)+n:n}function ei(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function i(t,e){var i,o=[],r=t.length,s=0,a=0,l=r<=0,h=!1;function c(){if(l)return Kn;if(h)return h=!1,Hn;var e,i,o=s;if(34===t.charCodeAt(o)){for(;s++<r&&34!==t.charCodeAt(s)||34===t.charCodeAt(++s););return(e=s)>=r?l=!0:10===(i=t.charCodeAt(s++))?h=!0:13===i&&(h=!0,10===t.charCodeAt(s)&&++s),t.slice(o+1,e-1).replace(/""/g,'"')}for(;s<r;){if(10===(i=t.charCodeAt(e=s++)))h=!0;else if(13===i)h=!0,10===t.charCodeAt(s)&&++s;else if(i!==n)continue;return t.slice(o,e)}return l=!0,t.slice(o,r)}for(10===t.charCodeAt(r-1)&&--r,13===t.charCodeAt(r-1)&&--r;(i=c())!==Kn;){for(var u=[];i!==Hn&&i!==Kn;)u.push(i),i=c();e&&null==(u=e(u,a++))||o.push(u)}return o}function o(e,n){return e.map((function(e){return n.map((function(t){return s(e[t])})).join(t)}))}function r(e){return e.map(s).join(t)}function s(t){return null==t?"":t instanceof Date?(o=(n=t).getUTCHours(),r=n.getUTCMinutes(),s=n.getUTCSeconds(),a=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((i=n.getUTCFullYear())<0?"-"+ti(-i,6):i>9999?"+"+ti(i,6):ti(i,4))+"-"+ti(n.getUTCMonth()+1,2)+"-"+ti(n.getUTCDate(),2)+(a?"T"+ti(o,2)+":"+ti(r,2)+":"+ti(s,2)+"."+ti(a,3)+"Z":s?"T"+ti(o,2)+":"+ti(r,2)+":"+ti(s,2)+"Z":r||o?"T"+ti(o,2)+":"+ti(r,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,i,o,r,s,a}return{parse:function(t,e){var n,o,r=i(t,(function(t,i){if(n)return n(t,i-1);o=t,n=e?function(t,e){var n=Jn(t);return function(i,o){return e(n(i),o,t)}}(t,e):Jn(t)}));return r.columns=o||[],r},parseRows:i,format:function(e,n){return null==n&&(n=Qn(e)),[n.map(s).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Qn(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(r).join("\n")},formatRow:r,formatValue:s}}var ni=ei(","),ii=ni.parse,oi=(ni.parseRows,ni.format,ni.formatBody,ni.formatRows,ni.formatRow,ni.formatValue,ei("\t")),ri=oi.parse;function si(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function ai(t,e){return fetch(t,e).then(si)}function li(t){return function(e,n,i){return 2===arguments.length&&"function"==typeof n&&(i=n,n=void 0),ai(e,n).then((function(e){return t(e,i)}))}}oi.parseRows,oi.format,oi.formatBody,oi.formatRows,oi.formatRow,oi.formatValue;var hi=li(ii);li(ri);class ci{constructor(t,e,n={}){n=n||{},this.url=t,this.resolution=e,this.preprocess=n.preprocess||void 0,this.cellsViewCache=[]}getData(t,e){throw new Error("Method getData not implemented.")}updateViewCache(t){throw new Error("Method updateViewCache not implemented.")}getCellFromPosition(t,e){const n=this.getResolution(),i=n*Math.floor(t.x/n),o=n*Math.floor(t.y/n);for(const t of e)if(t.x==i&&t.y==o)return t}getResolution(){return this.resolution}getViewCache(){return this.cellsViewCache}}class ui extends ci{constructor(t,e,n={}){super(t,e,n),this.cells=[],this.infoLoadingStatus="notLoaded"}getData(t,e){return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",hi(this.url).then((t=>{for(const e of t)e.x=+e.x,e.y=+e.y;if(this.preprocess){this.cells=[];for(const e of t)0!=this.preprocess(e)&&this.cells.push(e)}else this.cells=t;e&&e(),this.infoLoadingStatus="loaded"})).catch((()=>{this.infoLoadingStatus="failed",this.cells=[]}))),this}updateViewCache(t){if(this.cells){this.cellsViewCache=[];for(const e of this.cells)+e.x+this.resolution<t.xMin||+e.x-this.resolution>t.xMax||+e.y+this.resolution<t.yMin||+e.y-this.resolution>t.yMax||this.cellsViewCache.push(e)}}}function fi(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function di(t,e){return fetch(t,e).then(fi)}class pi{constructor(t,e,n,i){this.cells=t,this.x=e,this.y=n;const o=i.resolutionGeo,r=i.tileSizeCell;this.extGeo={xMin:i.originPoint.x+o*r*this.x,xMax:i.originPoint.x+o*r*(this.x+1),yMin:i.originPoint.y+o*r*this.y,yMax:i.originPoint.y+o*r*(this.y+1)};for(let t of this.cells)t.x=this.extGeo.xMin+t.x*o,t.y=this.extGeo.yMin+t.y*o}}function gi(t,e){if(e){if(0==e.length)return 0;if(t<=e[0])return 0;for(let n=1;n<e.length;n++)if(e[n-1]<t&&t<=e[n])return n;return e.length}}class vi extends ci{constructor(t,e,n={}){super(t,0,n),this.app=e,this.info=void 0,this.infoLoadingStatus="notLoaded",this.cache={}}loadInfo(t){return this.info||"notLoaded"!==this.infoLoadingStatus?!t||"loaded"!==this.infoLoadingStatus&&"failed"!==this.infoLoadingStatus||t():(this.infoLoadingStatus="loading",di(this.url+"info.json").then((e=>{this.info=e,this.resolution=e.resolutionGeo,this.infoLoadingStatus="loaded",t&&t()})).catch((()=>{this.infoLoadingStatus="failed"}))),this}getTilingEnvelope(t){if(!this.info)return void this.loadInfo((()=>{}));const e=this.info.originPoint,n=this.info.resolutionGeo,i=this.info.tileSizeCell;return{xMin:Math.floor((t.xMin-e.x)/(n*i)),xMax:Math.floor((t.xMax-e.x)/(n*i)),yMin:Math.floor((t.yMin-e.y)/(n*i)),yMax:Math.floor((t.yMax-e.y)/(n*i))}}getData(t,e){if(!this.info)return this;const n=this.getTilingEnvelope(t);if(!n)return this;const i=this.info.tilingBounds;for(let t=Math.max(n.xMin,i.xMin);t<=Math.min(n.xMax,i.xMax);t++)for(let o=Math.max(n.yMin,i.yMin);o<=Math.min(n.yMax,i.yMax);o++)this.cache[t]||(this.cache[t]={}),this.cache[t][o]||(this.cache[t][o]="loading",hi(this.url+t+"/"+o+".csv").then((n=>{let i;if(this.preprocess){i=[];for(const t of n)0!=this.preprocess(t)&&i.push(t)}else i=n;if(!this.info)return void console.error("Tile info inknown");const r=new pi(i,t,o,this.info);if(this.cache[t][o]=r,!e)return;let s=!1;for(const t of this.app.getActiveLayers())if(t.getDatasetComponent(this.app.getZoomFactor())==this){s=!0;break}if(!s)return;const a=this.app.updateExtentGeo(),l=r.extGeo;a.xMax<=l.xMin||a.xMin>=l.xMax||a.yMax<=l.yMin||a.yMin>=l.yMax||e()})).catch((()=>{this.cache[t][o]="failed"})));return this}updateViewCache(t){if(this.cellsViewCache=[],!this.info)return;const e=this.getTilingEnvelope(t);if(!e)return;const n=this.info.tilingBounds;for(let i=Math.max(e.xMin,n.xMin);i<=Math.min(e.xMax,n.xMax);i++)if(this.cache[i])for(let o=Math.max(e.yMin,n.yMin);o<=Math.min(e.yMax,n.yMax);o++){const e=this.cache[i][o];if(e&&"string"!=typeof e)for(const n of e.cells)+n.x+this.resolution<t.xMin||+n.x-this.resolution>t.xMax||+n.y+this.resolution<t.yMin||+n.y-this.resolution>t.yMax||this.cellsViewCache.push(n)}}}class yi{constructor(t){if(t=t||{},this.visible=0!=t.visible,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.");if(this.cache={},this.url=t.url,this.urlFun=t.urlFun||((t,e,n)=>this.url+n+"/"+t+"/"+e+".png"),this.resolutions=t.resolutions,!this.resolutions||0==this.resolutions.length)throw new Error("No resolutions provided for background layer");this.nbPix=t.nbPix||256,this.origin=t.origin||[0,0],this.z0=t.z0||0,this.filterColor=t.filterColor}get(t,e,n){let i=this.cache[t];if(i&&(i=i[e],i))return i[n]}put(t,e,n,i){this.cache[e]||(this.cache[e]={}),this.cache[e][n]||(this.cache[e][n]={}),this.cache[e][n][i]=t}draw(t){if(!this.resolutions||0==this.resolutions.length)return void console.error("No resolutions provided for background layer");const e=t.getZf(),n=this.origin[0],i=this.origin[1];let o=0;for(o=0;o<this.resolutions.length&&!(this.resolutions[o]<e);o++);o-=1,o=Math.max(0,o),o=Math.min(o,this.resolutions.length-1);const r=this.resolutions[o];o+=this.z0;const s=this.nbPix*r,a=s/e,l=t=>Math.ceil((t-n)/s),h=t=>Math.ceil(-(t-i)/s),c=l(t.extGeo.xMin)-1,u=l(t.extGeo.xMax),f=h(t.extGeo.yMin),d=h(t.extGeo.yMax)-1;for(let e=c;e<u;e++)for(let r=d;r<f;r++){let l=this.get(o,e,r);if(!l){const n=new Image;this.put(n,o,e,r),n.onload=()=>{t.redraw()},n.onerror=()=>{this.put("failed",o,e,r)},n.src=this.urlFun(e,r,o);continue}if("failed"===l)continue;if(!(l instanceof HTMLImageElement)){console.log(l);continue}if(0==l.width||0==l.height)continue;const h=n+e*s,c=i-r*s;try{t.ctx.drawImage(l,t.geoToPixX(h),t.geoToPixY(c),a,a)}catch(t){console.error(t)}}if(this.filterColor){const n=this.filterColor(e);n&&"none"!=n&&(t.ctx.fillStyle=n,t.ctx.fillRect(0,0,t.w,t.h))}}}class mi{constructor(t){t=t||{},this.url=t.url,this.style=t.style||(()=>"bold 1em Arial"),this.color=t.color||(t.dark?()=>"#ddd":()=>"#222"),this.haloColor=t.haloColor||(t.dark?()=>"#000000BB":()=>"#FFFFFFBB"),this.haloWidth=t.haloWidth||(()=>4),this.textAlign=t.textAlign||"start",this.offsetPix=t.offsetPix||[5,5],this.preprocess=t.preprocess,this.labels,this.loadingStatus="notLoaded"}draw(t){if(!this.labels)return void this.load(t.redraw);const e=t.getZf();t.ctx.textAlign=this.textAlign||"start",t.ctx.lineJoin="bevel",t.ctx.lineCap="butt",t.initCanvasTransform();for(const n of this.labels){const i=this.style(n,e);if(!i)continue;if(t.ctx.font=i,!t.toDraw(n))continue;const o=t.geoToPixX(n.x)+this.offsetPix[0],r=t.geoToPixY(n.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){const i=this.haloColor(n,e),s=this.haloWidth(n,e);i&&s&&s>0&&(t.ctx.strokeStyle=i,t.ctx.lineWidth=s,t.ctx.strokeText(n.name,o,r))}if(this.color){const i=this.color(n,e);i&&(t.ctx.fillStyle=i,t.ctx.fillText(n.name,o,r))}}}load(t){if(!this.url)return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",void(this.labels=[]);"notLoaded"===this.loadingStatus&&(this.loadingStatus="loading",hi(this.url).then((e=>{if(this.preprocess){this.labels=[];for(const t of e)0!=this.preprocess(t)&&this.labels.push(t)}else this.labels=e;this.loadingStatus="loaded",t&&t()})).catch((()=>{console.log("Failed loading labels from "+this.url),this.labels=[],this.loadingStatus="failed"})))}}class xi{constructor(t){t=t||{},this.url=t.url,this.preprocess=t.preprocess,this.color=t.color||((t,e)=>"gray"),this.width=t.width||((t,e)=>2),this.lineDash=t.lineDash||((t,e)=>{}),this.fs,this.loadingStatus="notLoaded"}draw(t){if(!this.fs)return void this.load(t.redraw);const e=t.getZf();t.setCanvasTransform();for(const n of this.fs){const i=n.geometry.coordinates;if(i.length<2)continue;const o=this.color(n,e);if(!o||"none"==o)continue;t.ctx.strokeStyle=o;const r=this.width(n,e);if(!r||r<0)continue;t.ctx.lineWidth=r*e;const s=this.lineDash(n,e);s&&t.ctx.setLineDash(s),t.ctx.beginPath(),t.ctx.moveTo(i[0][0],i[0][1]);for(let e=1;e<i.length;e++)t.ctx.lineTo(i[e][0],i[e][1]);t.ctx.stroke()}t.ctx.setLineDash([])}load(t){if(!this.url)return console.log("Failed loading boundaries: No URL specified. "+this.url),this.loadingStatus="failed",void(this.labels=[]);"notLoaded"===this.loadingStatus&&(this.loadingStatus="loading",di(this.url).then((e=>{if(e=e.features,this.preprocess)for(const t of e)this.preprocess(t);this.fs=e,this.loadingStatus="loaded",t&&t()})).catch((()=>{console.log("Failed loading boundaries from "+this.url),this.fs=[],this.loadingStatus="failed"})))}}class wi{constructor(t,e){if(e=e||{},this.layers=[],!(t=t||document.getElementById("gridviz")))return void console.error("Cannot find gridviz container element.");this.w=e.w||t.offsetWidth,this.h=e.h||t.offsetHeight;const n=document.createElement("canvas");n.setAttribute("width",""+this.w),n.setAttribute("height",""+this.h),t.appendChild(n),this.cg=new jn(n),this.cg.redraw=(t=!0)=>{this.legend&&t&&this.legend.selectAll("*").remove(),this.cg.initCanvasTransform(),this.cg.clear(this.cg.backgroundColor);const e=this.getZoomFactor();this.updateExtentGeo();for(const t of this.bgLayers)t.visible&&(e>t.maxZoom||e<t.minZoom||t.draw(this.cg));for(const n of this.layers){if(!n.visible)continue;if(e>n.maxZoom)continue;if(e<n.minZoom)continue;const i=n.getDatasetComponent(e);if(i){if(t&&i.getData(this.cg.extGeo,(()=>{this.cg.redraw()})),t&&i.updateViewCache(this.cg.extGeo),t)for(const t of n.styles)e>t.maxZoom||e<t.minZoom||t.draw(i.getViewCache(),i.getResolution(),this.cg);if(this.legend&&t)for(const t of n.styles)if(!(e>t.maxZoom||e<t.minZoom))for(const e of t.legends)this.legend.node().append(e.div.node())}}return this.showBoundaries&&this.boundaryLayer&&this.boundaryLayer.draw(this.cg),this.showLabels&&this.labelLayer&&this.labelLayer.draw(this.cg),this.canvasSave=null,this},this.bgLayers=[],this.showBgLayers=!0,this.labelLayer=void 0,this.showLabels=!0,this.boundaryLayer=void 0,this.showBoundaries=!0,this.legendDivId=e.legendDivId||"gvizLegend",this.legend=yt("#"+this.legendDivId),this.legend.empty()&&(this.legend=yt("body").append("div").attr("id",this.legendDivId).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFFCC").style("border","0px").style("border-radius","5px").style("box-shadow","5px 5px 5px grey").style("font-family","Helvetica, Arial, sans-serif").style("top","20px").style("right","20px")),this.tooltip=new qn;const i=t=>{const e={x:this.cg.pixToGeoX(t.offsetX),y:this.cg.pixToGeoY(t.offsetY)},n=this.getCellFocusInfo(e);n?(this.tooltip.setPosition(t),this.tooltip.show(),this.tooltip.html(n.html),this.canvasSave?this.cg.ctx.drawImage(this.canvasSave,0,0):(this.canvasSave=document.createElement("canvas"),this.canvasSave.setAttribute("width",""+this.w),this.canvasSave.setAttribute("height",""+this.h),this.canvasSave.getContext("2d").drawImage(this.cg.canvas,0,0)),this.cg.initCanvasTransform(),this.cg.ctx.strokeStyle=this.selectionRectangleColor,this.cg.ctx.lineWidth=this.selectionRectangleWidthPix,this.cg.ctx.beginPath(),this.cg.ctx.rect(this.cg.geoToPixX(n.cell.x)-this.selectionRectangleWidthPix/2,this.cg.geoToPixY(n.cell.y)+this.selectionRectangleWidthPix/2,n.resolution/this.getZoomFactor()+this.selectionRectangleWidthPix,-n.resolution/this.getZoomFactor()-this.selectionRectangleWidthPix),this.cg.ctx.stroke()):(this.tooltip.hide(),this.canvasSave&&this.cg.ctx.drawImage(this.canvasSave,0,0))};t.addEventListener("mouseover",(t=>{i(t)})),t.addEventListener("mousemove",(t=>{i(t)})),t.addEventListener("mouseout",(()=>{this.tooltip.hide()})),this.cg.onZoomStartFun=()=>{this.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=e.selectionRectangleColor||"red",this.selectionRectangleWidthPix=e.selectionRectangleWidthPix||4}getActiveLayers(){const t=[],e=this.getZoomFactor();for(const n of this.layers)n.visible&&n.getDatasetComponent(e)&&t.push(n);return t}hideAllLayers(){for(const t of this.layers)t.visible=!1;return this}updateExtentGeo(t=20){return this.cg.updateExtentGeo(t)}getCellFocusInfo(t){const e=this.getActiveLayers(),n=e[e.length-1];if(!n)return;const i=n.getDatasetComponent(this.getZoomFactor());if(!i)return;const o=i.getCellFromPosition(t,i.getViewCache());return o?{cell:o,html:n.cellInfoHTML(o,i.getResolution()),resolution:i.getResolution()}:void 0}getGeoCenter(){return this.cg.getCenter()}setGeoCenter(t){return this.cg.setCenter(t),this}getZoomFactor(){return this.cg.getZf()}setZoomFactor(t){return this.cg.setZf(t),this}getZoomFactorExtent(){return this.cg.getZfExtent()}setZoomFactorExtent(t){return this.cg.setZfExtent(t),this}getBackgroundColor(){return this.cg.backgroundColor}setBackgroundColor(t){return this.cg.backgroundColor=t,this}getBoundaryLayer(){return this.boundaryLayer}setBoundaryLayer(t){return this.boundaryLayer=new xi(t),this}getLabelLayer(){return this.labelLayer}setLabelLayer(t){return this.labelLayer=new mi(t),this}redraw(){return this.cg.redraw(),this}addLayerFromDataset(t,e,n){const i=new Xn(t,e,n);return this.layers.push(i),this}makeTiledCSVGridDataset(t,e){return new $n([new vi(t,this,e).loadInfo((()=>{this.cg.redraw()}))],[],e)}makeMultiScaleCSVGridDataset(t,e,n){return $n.make(t,(t=>new ui(e(t),t,n).getData(void 0,(()=>{this.cg.redraw()}))),n)}makeMultiScaleTiledCSVGridDataset(t,e,n){return $n.make(t,(t=>new vi(e(t),this,n).loadInfo((()=>{this.cg.redraw()}))),n)}addCSVGridLayer(t,e,n,i){const o=this.makeCSVGridDataset(t,e,i);return this.addLayerFromDataset(o,n,i)}addParquetGridLayer(t,e,n,i){const o=this.makeParquetGridDataset(t,e,i);return this.addLayerFromDataset(o,n,i)}addTiledCSVGridLayer(t,e,n){const i=this.makeTiledCSVGridDataset(t,n);return this.addLayerFromDataset(i,e,n)}addMultiScaleCSVGridLayer(t,e,n,i){const o=this.makeMultiScaleCSVGridDataset(t,e,i);return this.addLayerFromDataset(o,n,i)}addMultiScaleTiledCSVGridLayer(t,e,n,i){const o=this.makeMultiScaleTiledCSVGridDataset(t,e,i);return this.addLayerFromDataset(o,n,i)}addBackgroundLayer(t){return this.bgLayers.push(new yi(t)),this.redraw(),this}addZoomSlider(t,e){return this.cg.addZoomSlider(t,e),this}setViewFromURL(){return this.cg.setViewFromURL(),this}}class bi extends Vn{constructor(t){super(t),t=t||{},this.colorCol=t.colorCol,this.color=t.color||(()=>"#EA6BAC"),this.sizeCol=t.sizeCol,this.size=t.size,this.shape=t.shape||(()=>"square")}draw(t,e,n){const i=n.getZf();let o,r;this.sizeCol&&(t.sort(((t,e)=>e[this.sizeCol]-t[this.sizeCol])),o=Vn.getStatistics(t,(t=>t[this.sizeCol]),!0)),this.colorCol&&(r=Vn.getStatistics(t,(t=>t[this.colorCol]),!0)),n.setCanvasTransform();const s=.5*e;for(let a of t){const t=this.color?this.color(a[this.colorCol],e,r):void 0;if(!t||"none"===t)continue;n.ctx.fillStyle=t;const l=this.shape?this.shape(a):"square";if("none"===l)continue;const h=(this.size||(()=>e))(a[this.sizeCol],e,o,i),c=this.offset(a,e,i);if("square"===l){const t=e*(1-h/e)*.5;n.ctx.fillRect(a.x+t+c.dx,a.y+t+c.dy,h,h)}else if("circle"===l)n.ctx.beginPath(),n.ctx.arc(a.x+s+c.dx,a.y+s+c.dy,.5*h,0,2*Math.PI,!1),n.ctx.fill();else if("donut"===l){const t=a.x+s+c.dx,i=a.y+s+c.dy;n.ctx.beginPath(),n.ctx.moveTo(t,i),n.ctx.arc(t,i,s,0,2*Math.PI),n.ctx.arc(t,i,(1-h/e)*s,0,2*Math.PI,!0),n.ctx.closePath(),n.ctx.fill()}else{if("diamond"!==l)throw new Error("Unexpected shape:"+l);{const t=.5*h;n.ctx.beginPath(),n.ctx.moveTo(a.x+s-t,a.y+s),n.ctx.lineTo(a.x+s,a.y+s+t),n.ctx.lineTo(a.x+s+t,a.y+s),n.ctx.lineTo(a.x+s,a.y+s-t),n.ctx.fill()}}}this.updateLegends({style:this,r:e,zf:i,sSize:o,sColor:r})}}class Ci extends Vn{constructor(t){super(t),t=t||{},this.strokeColorCol=t.strokeColorCol,this.strokeColor=t.strokeColor||(()=>"#666"),this.sizeCol=t.sizeCol,this.size=t.size,this.strokeWidthCol=t.strokeWidthCol,this.strokeWidth=t.strokeWidth,this.shape=t.shape||(()=>"square")}draw(t,e,n){const i=n.getZf();let o,r,s;this.strokeColorCol&&(o=Vn.getStatistics(t,(t=>t[this.strokeColorCol]),!0)),this.sizeCol&&(r=Vn.getStatistics(t,(t=>t[this.sizeCol]),!0)),this.strokeWidthCol&&(s=Vn.getStatistics(t,(t=>t[this.strokeWidthCol]),!0)),n.setCanvasTransform();const a=.5*e;for(let l of t){const t=this.strokeColor?this.strokeColor(l[this.strokeColorCol],e,o):void 0;if(!t||"none"===t)continue;n.ctx.strokeStyle=t;const h=(this.size||(()=>e))(l[this.sizeCol],e,r,i),c=this.strokeWidth?this.strokeWidth(l[this.strokeWidthCol],e,s,i):1*i;if(!c||c<=0)continue;n.ctx.lineWidth=c;const u=this.shape?this.shape(l):"square";if("none"===u)continue;const f=this.offset(l,e,i);if("square"===u){const t=e*(1-h/e)*.5;n.ctx.beginPath(),n.ctx.rect(l.x+t+f.dx,l.y+t+f.dy,h,h),n.ctx.stroke()}else if("circle"===u)n.ctx.beginPath(),n.ctx.arc(l.x+a+f.dx,l.y+a+f.dy,.5*h,0,2*Math.PI,!1),n.ctx.stroke();else if("diamond"===u){const t=.5*h;n.ctx.beginPath(),n.ctx.moveTo(l.x+a-t,l.y+a),n.ctx.lineTo(l.x+a,l.y+a+t),n.ctx.lineTo(l.x+a+t,l.y+a),n.ctx.lineTo(l.x+a,l.y+a-t),n.ctx.lineTo(l.x+a-t,l.y+a),n.ctx.stroke()}else{if("donut"!==u)throw new Error("Unexpected shape:"+u);console.error("Not implemented")}}}}class Si extends Vn{constructor(t){super(t),t=t||{},this.heightCol=t.heightCol,this.height=t.height||(t=>Math.sqrt(t)),this.lineColor=t.lineColor||((t,e,n,i)=>"#BBB"),this.lineWidth=t.lineWidth||((t,e,n,i)=>i),this.fillColor=t.fillColor||((t,e,n,i)=>"#c08c5968")}draw(t,e,n){n.ctx.lineJoin="round";const i=n.getZf(),o=Vn.getStatistics(t,(t=>t[this.heightCol]),!0),r={};for(const n of t){let t=r[n.y];t||(t={},r[n.y]=t),t[n.x]=this.height(n[this.heightCol],e,o,i)}const s=n.extGeo;if(!s)return;const a=Math.floor(s.xMin/e)*e,l=Math.floor(s.xMax/e)*e,h=Math.floor(s.yMin/e)*e,c=Math.floor(s.yMax/e)*e,u={min:h,max:c};n.setCanvasTransform();for(let t=c;t>=h;t-=e){const o=r[t];if(!o)continue;let s;n.ctx.beginPath(),n.ctx.moveTo(a-e/2,t);for(let i=a;i<=l;i+=e){let r=o[i];r||(r=0),r||s?n.ctx.lineTo(i+e/2,t+r):n.ctx.moveTo(i+e/2,t),s=r}s&&n.ctx.lineTo(l+e/2,t);const h=this.fillColor(t,u,e,i);h&&"none"!=h&&(n.ctx.fillStyle=h,n.ctx.fill());const c=this.lineColor(t,u,e,i),f=this.lineWidth(t,u,e,i);c&&"none"!=c&&f>0&&(n.ctx.strokeStyle=c,n.ctx.lineWidth=f,n.ctx.stroke())}}}class _i extends Vn{constructor(t){super(t),t=t||{},this.color=t.color,this.type=t.type,this.sizeCol=t.sizeCol,this.size=t.size||((t,e,n,i)=>e),this.stripesOrientation=t.stripesOrientation||(()=>0),this.offsetAngle=t.offsetAngle||(()=>0),this.agePyramidHeight=t.agePyramidHeight||((t,e,n)=>e),this.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0}draw(t,e,n){const i=n.getZf();let o;this.sizeCol&&(t.sort(((t,e)=>e[this.sizeCol]-t[this.sizeCol])),o=Vn.getStatistics(t,(t=>t[this.sizeCol]),!0));const r=Object.entries(this.color).length;n.setCanvasTransform();for(let s of t){const t=(this.size||(()=>e))(s[this.sizeCol],e,o,i),a=this.offset(s,e,i),l=this.type?this.type(s):"flag",h=s.x+a.dx+("agepyramid"===l?0:.5*e),c=s.y+a.dy+("agepyramid"===l?0:.5*e);if("agepyramid"===l||"radar"===l||"halftone"===l){let o=-1/0;for(let t of Object.keys(this.color)){const e=+s[t];e>o&&(o=e)}let a=0;"agepyramid"===l&&this.agePyramidHeight&&(a=(e-this.agePyramidHeight(s,e,i))/2),"radar"!==l&&"halftone"!==l||(a=Math.PI/2+(this.offsetAngle?this.offsetAngle(s,e,i)*Math.PI/180:0));const u="agepyramid"===l?(this.agePyramidHeight?this.agePyramidHeight(s,e,i):e)/r:"radar"===l||"halftone"===l?2*Math.PI/r:void 0;if(void 0===u)throw new Error("Unexpected symbol type:"+l);for(let[i,r]of Object.entries(this.color))if("agepyramid"===l){n.ctx.fillStyle=r;const l=t*s[i]/o;n.ctx.fillRect(h+(e-l)/2,c+a,l,u),a+=u}else if("radar"===l){n.ctx.fillStyle=r;const e=s[i],l=t/2*Math.sqrt(e/o);n.ctx.beginPath(),n.ctx.moveTo(h,c),n.ctx.arc(h,c,l,a-u,a),n.ctx.lineTo(h,c),n.ctx.fill(),a+=u}else{if("halftone"!==l)throw new Error("Unexpected symbol type:"+l);{n.ctx.fillStyle=r;const l=s[i],f=.333*t*Math.sqrt(l/o);n.ctx.beginPath(),n.ctx.arc(h+.25*e*Math.cos(a),c+.25*e*Math.sin(a),f,0,2*Math.PI),n.ctx.fill(),a+=u}}}else{let o=0;for(let t of Object.keys(this.color)){const e=+s[t];e&&(o+=e)}if(!o||isNaN(o))continue;let r=0;const u=e*(1-t/e)*.5,f=this.stripesOrientation(s,e,i);for(let[i,d]of Object.entries(this.color)){const p=s[i]/o;if(p&&!isNaN(p)){if(n.ctx.fillStyle=d,"flag"===l)0==f?n.ctx.fillRect(s.x+u+a.dx,s.y+u+r*t+a.dy,t,p*t):n.ctx.fillRect(s.x+u+r*t+a.dx,s.y+u+a.dy,p*t,t);else if("piechart"===l){const e=2*r*Math.PI,i=2*(r+p)*Math.PI;n.ctx.beginPath(),n.ctx.moveTo(h,c),n.ctx.arc(h,c,.5*t,e,i),this.pieChartInternalRadiusFactor&&n.ctx.arc(h,c,.5*t*this.pieChartInternalRadiusFactor,e,i,!0),n.ctx.closePath(),n.ctx.fill()}else if("ring"===l)n.ctx.beginPath(),n.ctx.arc(h,c,Math.sqrt(1-r)*t*.5,0,2*Math.PI),n.ctx.fill();else{if("segment"!==l)throw new Error("Unexpected symbol type:"+l);{const i=t*t/e;0==f?n.ctx.fillRect(s.x+a.dx,s.y+(e-i)/2+r*i+a.dy,e,p*i):n.ctx.fillRect(s.x+r*e+a.dx,s.y+(e-i)/2+a.dy,p*e,i)}}r+=p}}}}this.updateLegends({style:this,r:e,zf:i,sSize:o})}}class Mi extends Vn{constructor(t){super(t),t=t||{},this.orientation=t.orientation||(()=>0),this.colorCol=t.colorCol,this.color=t.color||(()=>"#EA6BAC"),this.lengthCol=t.lengthCol,this.length=t.length,this.widthCol=t.widthCol,this.width=t.width}draw(t,e,n){const i=n.getZf();let o,r,s;this.colorCol&&(o=Vn.getStatistics(t,(t=>t[this.colorCol]),!0)),this.lengthCol&&(t.sort(((t,e)=>e[this.lengthCol]-t[this.lengthCol])),r=Vn.getStatistics(t,(t=>t[this.lengthCol]),!0)),this.widthCol&&(s=Vn.getStatistics(t,(t=>t[this.widthCol]),!0)),n.ctx.lineCap="butt";const a=Math.PI/180;n.setCanvasTransform();for(let l of t){const t=this.color?this.color(l[this.colorCol],e,o):void 0;if(!t)continue;const h=this.width?this.width(l[this.widthCol],e,s,i):void 0;if(!h||h<0)continue;const c=this.length?this.length(l[this.lengthCol],e,r,i):void 0;if(!c||c<0)continue;const u=this.orientation(l)*a;if(void 0===u||isNaN(u))continue;const f=this.offset(l,e,i);n.ctx.strokeStyle=t,n.ctx.lineWidth=h;const d=l.x+e/2+f.dx,p=l.y+e/2+f.dy,g=.5*Math.cos(u)*c,v=.5*Math.sin(u)*c;n.ctx.beginPath(),n.ctx.moveTo(d-g,p-v),n.ctx.lineTo(d+g,p+v),n.ctx.stroke()}this.updateLegends({style:this,r:e,zf:i,sColor:o,sLength:r,sWidth:s})}}class ki extends Vn{constructor(t){super(t),t=t||{},this.textCol=t.textCol,this.text=t.text||((t,e,n,i)=>"X"),this.colorCol=t.colorCol,this.color=t.color||(()=>"#EA6BAC"),this.fontSizeCol=t.fontSizeCol,this.fontSize=t.fontSize||((t,e,n,i)=>e-2),this.fontFamily=t.fontFamily||"Arial",this.fontWeight=t.fontWeight||"bold"}draw(t,e,n){const i=n.getZf();let o,r,s;this.textCol&&(o=Vn.getStatistics(t,(t=>t[this.textCol]),!0)),this.colorCol&&(r=Vn.getStatistics(t,(t=>t[this.colorCol]),!0)),this.fontSizeCol&&(t.sort(((t,e)=>e[this.fontSizeCol]-t[this.fontSizeCol])),s=Vn.getStatistics(t,(t=>t[this.fontSizeCol]),!0));for(let a of t){const t=this.text?this.text(a[this.textCol],e,o):void 0;if(!t)continue;const l=this.color?this.color(a[this.colorCol],e,r):void 0;if(!l)continue;n.ctx.fillStyle=l;const h=(this.fontSize||(()=>e/i-2))(a[this.fontSizeCol],e,s,i)/i,c=this.fontFamily||"Arial",u=this.fontWeight||"bold";n.ctx.font=u+" "+h+"px "+c;const f=this.offset(a,e,i);n.ctx.textAlign="center";const d=n.geoToPixX(a.x+.5*e+f.dx),p=n.geoToPixY(a.y+.5*e+f.dy)+.5*h;n.ctx.fillText(t,d,p)}this.updateLegends({style:this,r:e,zf:i,sColor:r})}static getCharLegendFun(t){const e=t.length;return n=>0==n?"":1==n?t[e-1]:t[Math.floor(n*e)]}}class zi extends Vn{constructor(t){super(t),t=t||{},this.value=t.value,this.sigma=t.sigma,this.styles=t.styles}getKernelMatrix(t){const e=Math.floor(3*t),n=2*t*t,i=[];for(let t=0;t<=e;t++){const s=[];for(let i=0;i<=e;i++){const e=(o=t,r=i,Math.exp(-(o*o+r*r)/n));s.push({w:e,val:0})}i.push(s)}var o,r;return i}kernelSmoothing(t,e,n,i){const o=Math.floor(e.xMin/n)*n,r=Math.floor(e.xMax/n)*n,s=Math.floor(e.yMin/n)*n,a=Math.floor(e.yMax/n)*n,l=(r-o)/n+1,h=(a-s)/n+1;for(const e of t)e.ksmval=0;const c={};for(const e of t){const t=Math.floor((e.x-o)/n),i=Math.floor((e.y-s)/n);c[t]||(c[t]={}),c[t][i]=e}const u=this.getKernelMatrix(i),f=u.length;for(const t of Object.keys(c)){const e=+t;for(const i of Object.keys(c[t])){const t=+i,r=c[e][t];if(r.notInputCell)continue;const a=this.value(r);if(!a)continue;let d=0;for(let t=0;t<f;t++)for(let e=0;e<f;e++){const n=u[t][e];n.val=n.w*a,d+=n.w}const p=(t,e)=>t>=0&&t<l&&e>=0&&e<h,g=(t,e,i)=>{const r=c[t]?c[t][e]:void 0;r?r.ksmval?r.ksmval+=i:r.ksmval=i:(c[t]||(c[t]={}),c[t][e]={x:o+t*n,y:s+e*n,ksmval:i,notInputCell:!0})};for(let n=0;n<f;n++)for(let i=0;i<f;i++){let o=u[Math.abs(n)][Math.abs(i)];if(!o)continue;let r=o.val;r&&(r/=d,r&&(p(e+n,t+i)&&g(e+n,t+i,r),0==n&&0==i||(p(e-n,t+i)&&g(e-n,t+i,r),0!=n&&(p(e+n,t-i)&&g(e+n,t-i,r),p(e-n,t-i)&&g(e-n,t-i,r)))))}}}const d=[];for(let t of Object.keys(c))for(const e of Object.keys(c[t]))d.push(c[t][e]);return d}draw(t,e,n){if(!t||0==t.length)return;const i=this.sigma(e,n.zf);t=this.kernelSmoothing(t,n.extGeo,e,i/e);for(let i of this.styles)i.draw(t,e,n)}}class Ei extends Vn{constructor(t){super(t),t=t||{},this.heightCol=t.heightCol,this.height=t.height,this.colorCol=t.colorCol,this.color=t.color||(()=>"#c08c59"),this.widthCol=t.widthCol,this.width=t.width||((t,e)=>.5*e),this.simple=null!=t.simple,this.viewHeightFactor=t.viewHeightFactor||1.5,this.viewSX=null==t.viewSX?0:t.viewSX,this.viewSY=null==t.viewSY?-.5:t.viewSY,this.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,this.shadowFactor=t.shadowFactor||.3,this.shadowColor=t.shadowColor||"#00000033",this.outlineCol=t.outlineCol||"#FFFFFF",this.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix}draw(t,e,n){const i=n.getZf();let o,r,s;this.heightCol&&(o=Vn.getStatistics(t,(t=>t[this.heightCol]),!0)),this.colorCol&&(r=Vn.getStatistics(t,(t=>t[this.colorCol]),!0)),this.widthCol&&(s=Vn.getStatistics(t,(t=>t[this.widthCol]),!0));const a=n.getCenter().x+this.viewSX*n.w*i,l=n.getCenter().y+this.viewSY*n.h*i,h=this.viewHeightFactor*(n.w+n.h)*.5*i;t.sort(((t,e)=>1e8*(e.y-t.y)+t.x-e.x)),n.ctx.lineCap=this.simple?"butt":"round",n.setCanvasTransform(),n.ctx.strokeStyle=this.shadowColor,n.ctx.fillStyle=this.shadowColor;for(let r of t){const t=this.width?this.width(r[this.widthCol],e,s,i):void 0;if(!t||t<0)continue;const a=this.height?this.height(r[this.heightCol],e,o,i):void 0;if(!a||a<0)continue;this.offset(r,e,i),n.ctx.lineWidth=t;const l=r.x+e/2,h=r.y+e/2,c=a*this.shadowFactor;n.ctx.beginPath(),n.ctx.moveTo(l,h),n.ctx.lineTo(l+c*Math.cos(this.shadowDirection),h+c*Math.sin(this.shadowDirection)),n.ctx.stroke()}for(let c of t){const t=this.color?this.color(c[this.colorCol],e,r):void 0;if(!t)continue;const u=this.width?this.width(c[this.widthCol],e,s,i):void 0;if(!u||u<0)continue;const f=this.height?this.height(c[this.heightCol],e,o,i):void 0;if(!f||f<0)continue;this.offset(c,e,i);const d=c.x+e/2,p=c.y+e/2,g=d-a,v=p-l,y=Math.atan2(v,g),m=Math.sqrt(g*g+v*v)*f/(h-f);this.simple?(n.ctx.strokeStyle=t,n.ctx.lineWidth=u,n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.lineTo(d+m*Math.cos(y),p+m*Math.sin(y)),n.ctx.stroke()):(n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=u+2*this.outlineWidthPix*i,n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.lineTo(d+m*Math.cos(y),p+m*Math.sin(y)),n.ctx.stroke(),n.ctx.strokeStyle=t,n.ctx.lineWidth=u,n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.lineTo(d+m*Math.cos(y),p+m*Math.sin(y)),n.ctx.stroke(),n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=this.outlineWidthPix*i,n.ctx.beginPath(),n.ctx.arc(d+m*Math.cos(y),p+m*Math.sin(y),.5*u,0,2*Math.PI,!1),n.ctx.stroke())}n.ctx.lineCap="butt",this.updateLegends({style:this,r:e,zf:i,sColor:r})}}class Ti extends Vn{constructor(t){super(t),t=t||{},this.valueCol=t.valueCol,this.value=t.value||((t,e,n,i,o)=>1),this.color=t.color||(()=>"#EA6BAC"),this.width=t.width||((t,e,n,i)=>e*t.value/5),this.orientation=t.orientation||0,this.fillColor=t.fillColor}draw(t,e,n){const i=n.getZf();let o;this.valueCol&&(o=Vn.getStatistics(t,(t=>t[this.valueCol]),!0));const r=[];t.sort(((t,e)=>e.x==t.x?t.y-e.y:t.x-e.x));let s=t[0];for(let n=1;n<t.length;n++){let a=t[n];s.y+e==a.y&&s.x==a.x?r.push({x:s.x,y:a.y,or:"h",value:this.value(s[this.valueCol],a[this.valueCol],e,o,i)}):(r.push({x:s.x,y:s.y+e,or:"h",value:this.value(s[this.valueCol],void 0,e,o,i)}),r.push({x:a.x,y:a.y,or:"h",value:this.value(void 0,a[this.valueCol],e,o,i)})),s=a}t.sort(((t,e)=>e.y==t.y?t.x-e.x:t.y-e.y)),s=t[0];for(let n=1;n<t.length;n++){let a=t[n];s.x+e==a.x&&s.y==a.y?r.push({x:s.x+e,y:s.y,or:"v",value:this.value(s[this.valueCol],a[this.valueCol],e,o,i)}):(r.push({x:s.x+e,y:s.y,or:"v",value:this.value(s[this.valueCol],void 0,e,o,i)}),r.push({x:a.x,y:a.y,or:"v",value:this.value(void 0,a[this.valueCol],e,o,i)})),s=a}if(0==r.length)return;const a=Ti.getSideStatistics(r,!0);if(n.setCanvasTransform(),this.fillColor)for(let i of t){const t=this.fillColor(i);t&&"none"!=t&&(n.ctx.fillStyle=t,n.ctx.fillRect(i.x,i.y,e,e))}n.ctx.lineCap="butt";const l=e/2;for(let t of r){const o=this.color?this.color(t,e,a,i):void 0;if(!o||"none"==o)continue;const r=this.width?this.width(t,e,a,i):void 0;!r||r<=0||(n.ctx.strokeStyle=o,n.ctx.lineWidth=r,n.ctx.beginPath(),90==this.orientation?(n.ctx.moveTo(t.x+l,t.y+l),"h"===t.or?n.ctx.lineTo(t.x+l,t.y-l):n.ctx.lineTo(t.x-l,t.y+l)):(n.ctx.moveTo(t.x,t.y),n.ctx.lineTo(t.x+("h"===t.or?e:0),t.y+("v"===t.or?e:0))),n.ctx.stroke())}this.updateLegends({style:this,r:e,zf:i})}static getSideStatistics(t,e){if(!t||0==t.length)return;let n=1/0,i=-1/0;for(const o of t){const t=o.value;e&&!t||(t<n&&(n=t),t>i&&(i=t))}return{min:n,max:i}}}class Ai extends Ti{constructor(t){super(t),(t=t||{}).breaks=t.breaks||[100,1e3,1e4,1e5,1e6],t.width=t.width||(()=>1),t.color=t.color||(()=>"#E7A935");const e=function(e){if(null==e)return 0;for(let n=0;n<t.breaks.length;n++)if(e<t.breaks[n])return n;return t.breaks.length};this.value=(t,n,i,o,r)=>Math.abs(e(n)-e(t)),this.color=(e,n,i,o)=>e.value?t.color(e,n,o):void 0,this.width=(e,n,i,o)=>e.value*o*t.width(e,n,o)}}class Fi extends Vn{constructor(t){super(t),t=t||{},this.col=t.col,this.color=t.color,this.width=t.width||((t,e,n)=>.2*e),this.fillColor=t.fillColor}draw(t,e,n){const i=n.getZf(),o=[];t.sort(((t,e)=>e.x==t.x?t.y-e.y:t.x-e.x));let r=t[0],s=r[this.col];for(let n=1;n<t.length;n++){let i=t[n],a=i[this.col];r.y+e==i.y&&r.x==i.x?s!=a&&o.push({x:r.x,y:i.y,or:"h",v1:s,v2:a}):(o.push({x:r.x,y:r.y+e,or:"h",v1:s,v2:void 0}),o.push({x:i.x,y:i.y,or:"h",v1:void 0,v2:a})),r=i,s=a}t.sort(((t,e)=>e.y==t.y?t.x-e.x:t.y-e.y)),r=t[0],s=r[this.col];for(let n=1;n<t.length;n++){let i=t[n],a=i[this.col];r.x+e==i.x&&r.y==i.y?s!=a&&o.push({x:r.x+e,y:r.y,or:"v",v1:s,v2:a}):(o.push({x:r.x+e,y:r.y,or:"v",v1:s,v2:void 0}),o.push({x:i.x,y:i.y,or:"v",v1:void 0,v2:a})),r=i,s=a}if(0!=o.length){if(n.setCanvasTransform(),this.fillColor)for(let i of t){const t=this.fillColor(i);t&&"none"!=t&&(n.ctx.fillStyle=t,n.ctx.fillRect(i.x,i.y,e,e))}n.ctx.lineCap="butt";for(let t of o){const o=this.width?this.width(t,e,i):void 0;if(!o||o<=0)continue;const r=.5*o;n.ctx.lineWidth=o,"h"===t.or?(t.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[t.v2],n.ctx.moveTo(t.x,t.y+r),n.ctx.lineTo(t.x+e,t.y+r),n.ctx.stroke()),t.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[t.v1],n.ctx.moveTo(t.x,t.y-r),n.ctx.lineTo(t.x+e,t.y-r),n.ctx.stroke())):(t.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[t.v2],n.ctx.moveTo(t.x+r,t.y),n.ctx.lineTo(t.x+r,t.y+e),n.ctx.stroke()),t.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[t.v1],n.ctx.moveTo(t.x-r,t.y),n.ctx.lineTo(t.x-r,t.y+e),n.ctx.stroke()))}this.updateLegends({style:this,r:e,zf:i})}}}const Pi=function t(e){function n(t,n){var i,o;return t=null==t?0:+t,n=null==n?1:+n,function(){var r;if(null!=i)r=i,i=null;else do{i=2*e()-1,r=2*e()-1,o=i*i+r*r}while(!o||o>1);return t+n*r*Math.sqrt(-2*Math.log(o)/o)}}return n.source=t,n}(Math.random);function Li(t,e){const n=document.createElement("canvas");n.setAttribute("width",t),n.setAttribute("height",e);const i=n.getContext("webgl");if(!i)throw new Error("Unable to initialize WebGL. Your browser or machine may not support it.");return{canvas:n,gl:i}}function Ni(t,...e){const n=t.createProgram();if(null==n)throw new Error("Cannot create webGL program");for(const i of e)t.attachShader(n,i);if(t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS))return n;throw new Error(t.getProgramInfoLog(n)||"Cannot create webGL program (2)")}function Ri(t,e,...n){const i=t.createShader(e);if(null==i)throw new Error("Cannot create webGL shader");if(t.shaderSource(i,n.join("\n")),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS))return i;throw new Error(t.getShaderInfoLog(i)||"Cannot create webGL shader (2)")}class Zi{constructor(t,e){this.gl=t,this.sizePix=e||10,this.program=Ni(t,Ri(t,t.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vColor = color;\n }\n "),Ri(t,t.FRAGMENT_SHADER,"\n precision mediump float;\n varying vec4 vColor;\n void main(void) {\n vec4 vColor_ = vColor / 255.0;\n vColor_[3] = 255.0 * vColor_[3];\n gl_FragColor = vColor_;\n }")),t.useProgram(this.program),this.verticesBuffer=[],this.colorsBuffer=[]}addPointData(t,e,n){const i=Pe(n);i&&(this.verticesBuffer.push(t,e),this.colorsBuffer.push(i.r,i.g,i.b,i.opacity))}addPointData2(t,e,n,i,o,r){this.verticesBuffer.push(t,e),this.colorsBuffer.push(n,i,o,r)}draw(t){const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.STATIC_DRAW);const n=e.getAttribLocation(this.program,"pos");e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.STATIC_DRAW);var i=e.getAttribLocation(this.program,"color");e.vertexAttribPointer(i,4,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*this.sizePix),e.uniformMatrix3fv(e.getUniformLocation(this.program,"mat"),!1,new Float32Array(t)),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}class Di extends Vn{constructor(t){super(t),t=t||{},this.nbCol=t.nbCol,this.nb=t.nb||((t,e,n,i)=>.3*e*e/(i*i)*t/n.max),this.color=t.color||(()=>"#FF5733"),this.dotSize=t.dotSize,this.sigma=t.sigma}draw(t,e,n){const i=n.getZf();let o;if(this.nbCol&&(o=Vn.getStatistics(t,(t=>t[this.nbCol]),!0)),!o)return;const r=this.dotSize?this.dotSize(e,i):2*i,s=this.sigma?this.sigma(e,i):.4*e,a=Pi(0,s);if(function(){try{const t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){const s=Li(n.w+"",n.h+"");if(!s)return void console.error("No webGL");const l=new Zi(s.gl,r/i),h=e/2;let c,u,f,d,p,g;for(let n of t)if(c=this.color(n),c&&"none"!==c){if(u=this.offset(n,e,i),f=this.nb(n[this.nbCol],e,o,i),d=n.x+u.dx+h,p=n.y+u.dy+h,g=Pe(c),!g)return;for(let t=0;t<=f;t++)l.addPointData2(d+a(),p+a(),g.r,g.g,g.b,g.opacity)}l.draw(n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(s.canvas,0,0)}else{n.setCanvasTransform();for(let s of t){const t=this.color(s);if(!t||"none"===t)continue;n.ctx.fillStyle=t;const l=this.offset(s,e,i),h=this.nb(s[this.nbCol],e,o,i),c=s.x+l.dx+e/2,u=s.y+l.dy+e/2;for(let t=0;t<=h;t++)n.ctx.fillRect(c+a(),u+a(),r,r)}}this.updateLegends({style:this,r:e,zf:i})}}class Ii{constructor(t,e,n,i=10){this.gl=t;const o=Ri(t,t.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float t;\n varying float vt;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vt = t;\n }\n ");let r="\n precision mediump float;\n varying float vt;\n uniform float alpha;"+(()=>{const t=[];for(let n=0;n<e.length;n++)t.push("uniform vec4 c"+n+";");return t.join("")})()+"void main(void) {\n ";if(n?"pow"==n.fun?r+="float t = pow(vt, alpha);":"powRev"==n.fun?r+="float t = 1.0-pow(1.0-vt, 1.0/alpha);":"exp"==n.fun?r+=0==n.alpha?"float t = vt;":"float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);":"expRev"==n.fun?r+=0==n.alpha?"float t = vt;":"float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);":"circleLow"==n.fun?0==n.alpha?r+="float t = vt;":1==n.alpha?r+="float t = sqrt(vt * (2.0 - vt));":r+="float a = alpha / (1.0 - alpha);\n float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;":"circleHigh"==n.fun?0==n.alpha?r+="float t = vt;":1==n.alpha?r+="float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));":r+="float a = alpha / (1.0 - alpha);\n float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;":(console.error("Unexpected stretching function code: "+n.fun),r+="float t = vt;"):r+="float t = vt;",1==e.length)r+="\n vec4 cI=c0;\n vec4 cF=c0;";else if(2==e.length)r+="\n vec4 cI=c0;\n vec4 cF=c1;";else{const t=e.length-1,n=t+".0";r+="\n vec4 cI;\n vec4 cF;\n if(t<1.0/"+n+") { cI=c0; cF=c1; t=t*"+n+"; }";for(let e=2;e<t;e++)r+="else if(t<"+e+".0/"+n+") { cI=c"+(e-1)+"; cF=c"+e+"; t="+n+"*t-"+(e-1)+".0; }";r+="else { cI=c"+(t-1)+"; cF=c"+t+"; t="+n+"*t-"+(t-1)+".0; }"}1==e.length?r+="gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}":r+="gl_FragColor = mix(cI, cF, t);}";const s=Ri(t,t.FRAGMENT_SHADER,r);this.program=Ni(t,o,s),t.useProgram(this.program),t.uniform1f(t.getUniformLocation(this.program,"sizePix"),1*i),t.uniform1f(t.getUniformLocation(this.program,"alpha"),n?1*n.alpha:0);for(let n=0;n<e.length;n++){const i=Pe(e[n]);t.uniform4fv(t.getUniformLocation(this.program,"c"+n),[+i.r/255,+i.g/255,+i.b/255,+i.opacity])}}draw(t,e,n){const i=this.gl,o=this.program;i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t),i.STATIC_DRAW);const r=i.getAttribLocation(o,"pos");i.vertexAttribPointer(r,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(r),i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array(e),i.STATIC_DRAW);const s=i.getAttribLocation(o,"t");i.vertexAttribPointer(s,1,i.FLOAT,!1,0,0),i.enableVertexAttribArray(s),i.uniformMatrix3fv(i.getUniformLocation(o,"mat"),!1,new Float32Array(n)),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.POINTS,0,t.length/2)}}class Bi extends Vn{constructor(t){super(t),t=t||{},this.colorCol=t.colorCol,this.tFun=t.tFun||((t,e,n)=>t/n.max),this.stretching=t.stretching,this.colors=t.colors||["rgb(158, 1, 66)","rgb(248, 142, 83)","rgb(251, 248, 176)","rgb(137, 207, 165)","rgb(94, 79, 162)"].reverse(),t.color&&(this.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),this.size=t.size}draw(t,e,n){const i=n.getZf(),o=Vn.getStatistics(t,(t=>t[this.colorCol]),!0);if(!o)return;const r=Li(n.w+"",n.h+"");if(!r)return void console.error("No webGL");const s=e/2;let a,l=t.length;const h=[],c=[];for(let n=0;n<l;n++){a=t[n];const i=this.tFun(a[this.colorCol],e,o);null!=i&&null!=i&&(h.push(a.x+s,a.y+s),c.push(i>1?1:i<0?0:i))}const u=this.size?this.size(e,i):e+.2*i;new Ii(r.gl,this.colors,this.stretching,u/i).draw(h,c,n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(r.canvas,0,0),this.updateLegends({style:this,r:e,zf:i,sColor:o})}}class Wi{static get(t,e){if(null!=(e=e||{}).nb){e.nb<2&&(console.error("unexpected number of colors in tanaka (<2): "+e.nb),e.nb=2),e.color||(console.error("color function not defined in tanaka"),e.color=()=>"gray"),e.colors=[];for(let t=0;t<e.nb;t++)e.colors.push(e.color(t/(e.nb-1)))}e.colors=e.colors||["#a9bb9e","#c9dcaa","#fde89f","#f9a579","#eb444b"];const n=e.colors.length;e.tFun=e.tFun||((t,e,n)=>(t-n.min)/(n.max-n.min)),e.colDark=e.colDark||"#111",e.colBright=e.colBright||"#ddd",e.widthFactor=e.widthFactor||.08;const i=t=>{if(isNaN(t)||null==t)return console.error("Unexpected t value 1: "+t),-9;for(let e=0;e<n;e++)if(t<=(e+1)/n)return e;return console.error("Unexpected t value 2: "+t),-9};return[new Bi({colorCol:t,colors:e.colors,tFun:(t,o,r)=>{const s=e.tFun(t,o,r);return i(s)/(n-1)},size:(t,e)=>t+.5*e}),new Ti({valueCol:t,value:(t,n,o,r,s)=>{if(void 0===t&&void 0===n)return 0;if(void 0===n){const n=e.tFun(t,o,r);if(null==n||isNaN(n))throw new Error("Unexpected value: "+t+" - "+n);return i(n)+1}if(void 0===t){const t=e.tFun(n,o,r);if(null==t||isNaN(t))throw new Error("Unexpected value: "+n+" - "+t);return-i(t)-1}const a=e.tFun(t,o,r);if(null==a||isNaN(a))throw new Error("Unexpected value: "+t+" - "+a);const l=e.tFun(n,o,r);if(null==l||isNaN(l))throw new Error("Unexpected value: "+n+" - "+l);const h=i(a);return-i(l)+h},color:(t,n,i,o)=>{if(0!==t.value)return"v"===t.or?t.value<0?e.colBright:e.colDark:t.value<0?e.colDark:e.colBright},width:(t,n,i,o)=>e.widthFactor*n*Math.abs(t.value)*("v"===t.or?.5:1)})]}}class Ui{constructor(t){this.colors=t,this.vshString="\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float i;\n varying float vi;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }\n ";const e=[];e.push("precision mediump float;\nvarying float vi;\n"),e.push("uniform vec4");for(let n=0;n<t.length;n++)n>0&&e.push(","),e.push(" c"+n);e.push(";\n"),e.push("void main(void) {\n");for(let n=0;n<t.length;n++)n>0&&e.push("else "),e.push("if(vi=="),e.push(n),e.push(".0) gl_FragColor = vec4(c"),e.push(n),e.push("[0], c"),e.push(n),e.push("[1], c"),e.push(n),e.push("[2], c"),e.push(n),e.push("[3]);\n");e.push("else gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n}"),this.fshString=e.join("")}draw(t,e,n,i,o=10){const r=Ni(t,Ri(t,t.VERTEX_SHADER,this.vshString),Ri(t,t.FRAGMENT_SHADER,this.fshString));t.useProgram(r),t.uniform1f(t.getUniformLocation(r,"sizePix"),1*o);for(let e=0;e<this.colors.length;e++){const n=Pe(this.colors[e]);t.uniform4fv(t.getUniformLocation(r,"c"+e),[+n.r/255,+n.g/255,+n.b/255,+n.opacity])}t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW);const s=t.getAttribLocation(r,"pos");t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s),t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(n),t.STATIC_DRAW);const a=t.getAttribLocation(r,"i");t.vertexAttribPointer(a,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a),t.uniformMatrix3fv(t.getUniformLocation(r,"mat"),!1,new Float32Array(i)),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.POINTS,0,e.length/2)}}class Gi extends Vn{constructor(t){super(t),t=t||{},this.colorCol=t.colorCol,t.color=t.color||void 0;const e=Object.keys(t.color);this.catToI={};for(let t=0;t<e.length;t++)this.catToI[e[t]]=t+"";this.colors=[];for(let n=0;n<e.length;n++)this.colors.push(t.color[""+e[n]]);this.size=t.size,this.wgp=new Ui(this.colors)}draw(t,e,n){const i=n.getZf(),o=e/2;let r,s=t.length;const a=[],l=[];for(let e=0;e<s;e++){r=t[e];const n=r[this.colorCol];if(!n){console.log("Unexpected category: "+n);continue}const i=this.catToI[n];isNaN(+i)?console.log("Unexpected category index: "+n+" "+i):(a.push(r.x+o,r.y+o),l.push(+i))}const h=Li(n.w+"",n.h+"");if(!h)return void console.error("No webGL");const c=this.size?this.size(e,i):e+.2*i;this.wgp.draw(h.gl,a,l,n.getWebGLTransform(),c/i),n.initCanvasTransform(),n.ctx.drawImage(h.canvas,0,0),this.updateLegends({style:this,r:e,zf:i})}}class Oi{static get(t,e){(e=e||{}).colors=e.colors||["#00852b","#afd246","#fac80a","#d67923","#bb805a","#cb4e29","#b40000","#720012"],e.colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",e.widthFactor=e.widthFactor||.12;const n=Wi.get(t,e),i=new Ci({strokeColor:()=>"#666",strokeWidth:(t,e,n,i)=>.2*i});return[n[0],i,n[1],new Yi({colDark:e.colDark,colBright:e.colBright})]}static getCat(t,e){return(e=e||{}).colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",[new Gi({colorCol:t,color:e.color}),new Ci({strokeColor:()=>"#666",strokeWidth:(t,e,n,i)=>.2*i}),new Yi({colDark:e.colDark,colBright:e.colBright})]}}class Yi extends Vn{constructor(t){super(t),t=t||{},this.colDark=t.colDark||"#333",this.colBright=t.colBright||"#aaa"}draw(t,e,n){n.ctx.lineWidth=.6*n.getZf(),n.ctx.strokeStyle=this.colDark;for(let i of t)n.ctx.beginPath(),n.ctx.arc(i.x+.5*e,i.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!0),n.ctx.stroke();n.ctx.strokeStyle=this.colBright;for(let i of t)n.ctx.beginPath(),n.ctx.arc(i.x+.5*e,i.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!1),n.ctx.stroke()}}class ji extends Vn{constructor(t){super(t),t=t||{},this.colorCol=t.colorCol,this.color=t.color||(()=>"#EA6BAC"),this.mosaicFactor=t.mosaicFactor||.15,this.shadowFactor=t.shadowFactor||.2,this.shadowColor=t.shadowColor||"#555"}draw(t,e,n){const i=n.getZf();let o;this.colorCol&&(o=Vn.getStatistics(t,(t=>t[this.colorCol]),!0)),n.ctx.strokeStyle=this.shadowColor,n.ctx.lineWidth=this.shadowFactor*e,n.ctx.lineJoin="round",n.ctx.lineCap="butt";const r=e*this.mosaicFactor,s=()=>({x:Math.random()*r,y:Math.random()*r});n.setCanvasTransform();for(let r of t){const t=this.color?this.color(r[this.colorCol],e,o):void 0;if(!t||"none"===t)continue;n.ctx.fillStyle=t;const a=this.offset(r,e,i),l=s(),h=s(),c=s(),u=s();this.shadowFactor>0&&(n.ctx.beginPath(),n.ctx.moveTo(r.x+a.dx+l.x,r.y+a.dy+l.y),n.ctx.lineTo(r.x+a.dx+e-c.x,r.y+a.dy+c.y),n.ctx.lineTo(r.x+a.dx+e-u.x,r.y+a.dy+e-u.y),n.ctx.stroke()),n.ctx.beginPath(),n.ctx.moveTo(r.x+a.dx+l.x,r.y+a.dy+l.y),n.ctx.lineTo(r.x+a.dx+e-c.x,r.y+a.dy+c.y),n.ctx.lineTo(r.x+a.dx+e-u.x,r.y+a.dy+e-u.y),n.ctx.lineTo(r.x+a.dx+h.x,r.y+a.dy+e-h.y),n.ctx.fill()}this.updateLegends({style:this,r:e,zf:i,sColor:o})}}class Vi{constructor(t){t=t||{},this.id=t.id,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.background=t.background||"none",this.padding=t.padding||"5px",this.border=t.border||"0px",this["border-radius"]=t["border-radius"]||"none",this["box-shadow"]=t["box-shadow"]||"none",this["font-family"]=t["font-family"]||"Helvetica, Arial, sans-serif",this.width=t.width,this.height=t.height,this.id&&(this.div=yt("#"+this.id)),this.div&&!this.div.empty()||(this.div=yt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this.div.style("background",this.background).style("padding",this.padding).style("border",this.border).style("border-radius",this["border-radius"]).style("box-shadow",this["box-shadow"]).style("font-family",this["font-family"]),this.width&&this.div.style("width",this.width),this.height&&this.div.style("height",this.height)}update(t){console.error("Legend update not implemented yet.")}}function Xi(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}var $i,qi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Hi(t){if(!(e=qi.exec(t)))throw new Error("invalid format: "+t);var e;return new Ki({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Ki(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 Ji(t,e){var n=Xi(t,e);if(!n)return t+"";var i=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}Hi.prototype=Ki.prototype,Ki.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 Qi={"%":(t,e)=>(100*t).toFixed(e),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,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ji(100*t,e),r:Ji,s:function(t,e){var n=Xi(t,e);if(!n)return t+"";var i=n[0],o=n[1],r=o-($i=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,s=i.length;return r===s?i:r>s?i+new Array(r-s+1).join("0"):r>0?i.slice(0,r)+"."+i.slice(r):"0."+new Array(1-r).join("0")+Xi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function to(t){return t}var eo,no,io=Array.prototype.map,oo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ro(t){return eo=function(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?to:(e=io.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var o=t.length,r=[],s=0,a=e[0],l=0;o>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),r.push(t.substring(o-=a,o+a)),!((l+=a+1)>i));)a=e[s=(s+1)%e.length];return r.reverse().join(n)}),o=void 0===t.currency?"":t.currency[0]+"",r=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?to:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(io.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=Hi(t)).fill,n=t.align,u=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,v=t.precision,y=t.trim,m=t.type;"n"===m?(g=!0,m="g"):Qi[m]||(void 0===v&&(v=12),y=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var x="$"===f?o:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===f?r:/[%p]/.test(m)?l:"",b=Qi[m],C=/[defgprs%]/.test(m);function S(t){var o,r,l,f=x,S=w;if("c"===m)S=b(t)+S,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),v),y&&(t=function(t){t:for(var e,n=t.length,i=1,o=-1;i<n;++i)switch(t[i]){case".":o=e=i;break;case"0":0===o&&(o=i),e=i;break;default:if(!+t[i])break t;o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),_&&0==+t&&"+"!==u&&(_=!1),f=(_?"("===u?u:h:"-"===u||"("===u?"":u)+f,S=("s"===m?oo[8+$i/3]:"")+S+(_&&"("===u?")":""),C)for(o=-1,r=t.length;++o<r;)if(48>(l=t.charCodeAt(o))||l>57){S=(46===l?s+t.slice(o+1):t.slice(o))+S,t=t.slice(0,o);break}}g&&!d&&(t=i(t,1/0));var M=f.length+t.length+S.length,k=M<p?new Array(p-M+1).join(e):"";switch(g&&d&&(t=i(k+t,k.length?p-S.length:1/0),k=""),n){case"<":t=f+t+S+k;break;case"=":t=f+k+t+S;break;case"^":t=k.slice(0,M=k.length>>1)+f+t+S+k.slice(M);break;default:t=k+f+t+S}return a(t)}return v=void 0===v?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),S.toString=function(){return t+""},S}return{format:u,formatPrefix:function(t,e){var n,i=u(((t=Hi(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Xi(Math.abs(n)))?n[1]:NaN)/3)))),r=Math.pow(10,-o),s=oo[8+o/3];return function(t){return i(r*t)+s}}}}(t),no=eo.format,eo.formatPrefix,eo}ro({thousands:",",grouping:[3],currency:["$",""]});class so extends Vi{constructor(t){super(t),t=t||{},this.colorRamp=t.colorRamp,this.fun=t.fun,this.title=t.title,this.tickSize=t.tickSize||6,this.width=t.width||300,this.height=t.height||15,this.margin=t.margin||5,this.ticks=t.ticks||Math.floor(this.width/50),this.tickFormat=t.tickFormat||",.0f",this.tickUnit=t.tickUnit,this.fontSize=t.fontSize||"0.8em",this.invert=t.invert}update(t){if(!t.sColor)return;this.div.selectAll("*").remove();const e=this.width+2*this.margin,n=this.height+3*this.margin+12+this.tickSize+10,i=this.div.append("svg").attr("width",e).attr("height",n);i.append("text").attr("x",this.margin).attr("y",this.margin).style("font-size","0.8em").style("font-weight","bold").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.title);const o=i.append("g").attr("transform","translate("+this.margin+" "+(2*this.margin+12)+")"),r=this.width,s=this.height;for(let t=0;t<r;t+=5){let e=t/(r-1);this.invert&&(e=1-e),o.append("rect").attr("x",t).attr("y",0).attr("width",5).attr("height",s).style("fill",this.colorRamp(e))}for(let t=0;t<this.ticks;t++){let e=t/(this.ticks-1);o.append("line").attr("x1",r*e).attr("y1",0).attr("x2",r*e).attr("y2",s+this.tickSize).style("stroke","black"),o.append("text").attr("id","ticklabel_"+t).attr("x",r*e).attr("y",s+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==t?"start":t==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}const a=this.tickFormat&&"text"!=this.tickFormat?no(this.tickFormat):t=>t;for(let e=0;e<this.ticks;e++){let n=e/(this.ticks-1);const i=this.fun(n,t.r,t.sColor),o=(i?a(i):"0")+(this.tickUnit?this.tickUnit:"");this.div.select("#ticklabel_"+e).text(o)}}}class ao extends Vi{constructor(t){super(t),t=t||{},this.colors=t.colors,this.breaksText=t.breaksText,this.width=t.width||300,this.height=t.height||15,this.title=t.title,this.titleFontSize=t.titleFontSize||"0.8em",this.titleFontWeight=t.titleFontWeight||"bold",this.tickSize=t.tickSize||3,this.labelFontSize=t.labelFontSize||"0.8em",this.invert=t.invert}update(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);const e=this.colors.length;if(0==e)return;const n=this.width/e,i=this.div.append("svg").attr("width",this.width).attr("height",this.height+this.tickSize+2+10);for(let t=0;t<e;t++)i.append("rect").attr("x",t*n).attr("y",0).attr("width",n).attr("height",this.height).style("fill",this.colors[t]);for(let t=1;t<e;t++)i.append("line").attr("x1",n*t).attr("y1",0).attr("x2",n*t).attr("y2",this.height+this.tickSize).style("stroke","black");for(let t=1;t<e;t++)i.append("text").attr("id","ticklabel_"+t).attr("x",n*t).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSize).style("text-anchor",0==t?"start":t==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.breaksText[t-1])}}class lo extends Vi{constructor(t){super(t),t=t||{},this.colCat=t.colCat||[["gray","-"]],this.shape=t.shape||"circle",this.dimension=t.dimension||{r:8},this.strokeColor=t.strokeColor||"gray",this.strokeWidth=t.strokeWidth||1,this.title=t.title,this.titleFontSize=t.titleFontSize||"0.8em",this.titleFontWeight=t.titleFontWeight||"bold",this.labelFontSize=t.labelFontSize||"0.8em"}update(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);const e=this.colCat.length;if(0!=e)for(let t=0;t<e;t++){const e=this.colCat[t],n=this.div.append("div"),i=this.strokeWidth;if("square"===this.shape){const t=this.dimension.h||15,o=this.dimension.w||20;n.append("div").style("display","inline").append("svg").attr("width",o+2*i).attr("height",t+2*i).append("rect").attr("x",i).attr("y",i).attr("width",o).attr("height",t).style("fill",e[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else{if("circle"!==this.shape)throw new Error("Unexpected shape:"+this.shape);{const t=this.dimension.r||8,o=2*t+2*i;n.append("div").style("display","inline").append("svg").attr("width",o).attr("height",o).append("circle").attr("cx",t+i).attr("cy",t+i).attr("r",t).style("fill",e[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}}n.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(e[1])}}}class ho extends Vi{constructor(t){super(t),t=t||{},this.exaggerationFactor=t.exaggerationFactor||.8,this.shape=t.shape||"circle",this.fillColor=t.fillColor||"none",this.strokeColor=t.strokeColor||"gray",this.strokeWidth=t.strokeWidth||1,this.labelFontSize=t.labelFontSize||"0.8em",this.labelUnitText=t.labelUnitText||"",this.labelFormat=t.labelFormat||",.2r"}update(t){if(!t.sSize)return;this.div.selectAll("*").remove();const e=t.sSize.max*this.exaggerationFactor;let n=Math.log10(e);n=Math.floor(n);let i=Math.pow(10,n);8*i<=e?i*=8:6*i<=e?i*=6:5*i<=e?i*=5:4*i<=e?i*=4:2.5*i<=e?i*=2.5:2*i<=e&&(i*=2);const o=this.div.append("div"),r=t.style.size(i,t.r,t.sSize,t.zf)/t.zf,s=o.append("svg").attr("width",r+this.strokeWidth+2).attr("height",r+this.strokeWidth+2).style("","inline-block");if("square"===this.shape)s.append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",r).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){const t=.5*(r+this.strokeWidth);s.append("circle").attr("cx",t+1).attr("cy",t+1).attr("r",t).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else if("donut"===this.shape);else if("diamond"!==this.shape)throw new Error("Unexpected shape:"+this.shape);const a=no(this.labelFormat)(i);o.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(a+(this.labelUnitText?" ":"")+this.labelUnitText)}}class co extends Vi{constructor(t){super(t),t=t||{},this.exaggerationFactor=t.exaggerationFactor||.5,this.color=t.color||"gray",this.orientation=t.orientation||0,this.labelFontSize=t.labelFontSize||"0.8em",this.labelUnitText=t.labelUnitText||"",this.div.style("text-align","center")}update(t){if(!t.sWidth)return;this.div.selectAll("*").remove();const e=t.sWidth.max*this.exaggerationFactor;let n=Math.log10(e);n=Math.floor(n);let i=Math.pow(10,n);8*i<=e?i*=8:6*i<=e?i*=6:5*i<=e?i*=5:4*i<=e?i*=4:2.5*i<=e?i*=2.5:2*i<=e&&(i*=2);const o=t.style.width(i,t.r,t.sWidth,t.zf)/t.zf,r=1*t.r/t.zf;this.div.append("svg").attr("width",r).attr("height",o).style("","inline-block").append("line").attr("x1",0).attr("y1",o/2).attr("x2",r).attr("y2",o/2).style("stroke",this.color).style("stroke-width",o);const s=no(",.2r")(i);this.div.append("div").style("font-size",this.labelFontSize).style("","inline-block").text(s+(this.labelUnitText?" ":"")+this.labelUnitText)}}function uo(t,e,n=1.01,i=0,o,r=0){(n=n||1.01)<1&&console.error("Unexpected value for factor: "+n+". Set to default value 1.01");const s=t.getZoomFactor();if(e==s)return;e<s&&(n=1/n);let a=s,l=setInterval((()=>{a=t.getZoomFactor()*n,e>s&&a>e&&(a=e),e<s&&a<e&&(a=e),t.setZoomFactor(a),t.cg.redraw(),a==e&&(clearInterval(l),o&&setTimeout((()=>{o()}),r))}),i);return l}function fo(t,e=NaN,n=NaN,i=NaN,o=5,r=0,s,a=0){const l=t.getZoomFactor(),h=t.getGeoCenter();e=isNaN(e)?h.x:e,n=isNaN(n)?h.y:n,i=isNaN(i)?l:i;const c=e-h.x,u=n-h.y;let f=Math.hypot(c,u);const d=o*l*c/f,p=o*l*u/f;let g=i/l;const v=f/(o*l),y=f>0?Math.pow(g,1/v):Math.pow(g,.1);let m=setInterval((()=>{if(f>0){const i=t.getGeoCenter();let o=i.x+d,r=i.y+p;o<e&&e<i.x&&(o=e),i.x<e&&e<o&&(o=e),r<n&&n<i.y&&(r=n),i.y<n&&n<r&&(r=n),t.setGeoCenter({x:o,y:r}),o==e&&r==n&&(f=0)}if(1!=g){const e=t.getZoomFactor();let n=y*e;n<i&&i<e&&(n=i),e<i&&i<n&&(n=i),t.setZoomFactor(n),n==i&&(g=1)}t.cg.redraw(),0==f&&1==g&&(console.log("OK !"),clearInterval(m),s&&setTimeout((()=>{s()}),a))}),r);return m}const po=(t,e=3)=>Math.pow(t,e),go=(t,e=3)=>1-Math.pow(1-t,1/e),vo=(t,e=3)=>0==e?t:(Math.exp(t*e)-1)/(Math.exp(e)-1),yo=(t,e=3)=>0==e?t:1-1/e*Math.log(Math.exp(e)*(1-t)+t),mo=(t,e=.8)=>{if(0==e)return t;if(1==e)return Math.sqrt(t*(2-t));const n=e/(1-e);return Math.sqrt(1/(n*n)+t*(2/n+2-t))-1/n},xo=(t,e=.8)=>1-mo(1-t,e),wo=(t,e=3)=>0==e?t:1/e*Math.log(1-t+t*Math.exp(e)),bo=(t,e=3)=>(Math.exp(-e*t)-1)/(Math.exp(-e)-1),Co=(t,e=3)=>Math.pow(t,1/e),So=(t,e=3)=>1-Math.pow(1-t,e);var _o=1e-6,Mo=Math.PI,ko=Mo/2,zo=Mo/4,Eo=2*Mo,To=180/Mo,Ao=Mo/180,Fo=Math.abs,Po=Math.atan,Lo=Math.atan2,No=Math.cos,Ro=(Math.ceil,Math.exp,Math.floor,Math.hypot,Math.log,Math.pow,Math.sin),Zo=Math.sign||function(t){return t>0?1:t<0?-1:0},Do=Math.sqrt;function Io(t){return t>1?ko:t<-1?-ko:Math.asin(t)}function Bo(){}function Wo(){var t,e=[];return{point:function(e,n,i){t.push([e,n,i])},lineStart:function(){e.push(t=[])},lineEnd:Bo,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Uo(t,e){return Fo(t[0]-e[0])<_o&&Fo(t[1]-e[1])<_o}function Go(t,e,n,i){this.x=t,this.z=e,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function Oo(t,e,n,i,o){var r,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,i=t[0],s=t[e];if(Uo(i,s)){if(!i[2]&&!s[2]){for(o.lineStart(),r=0;r<e;++r)o.point((i=t[r])[0],i[1]);return void o.lineEnd()}s[0]+=2e-6}a.push(n=new Go(i,t,null,!0)),l.push(n.o=new Go(i,null,n,!1)),a.push(n=new Go(s,t,null,!1)),l.push(n.o=new Go(s,null,n,!0))}})),a.length){for(l.sort(e),Yo(a),Yo(l),r=0,s=l.length;r<s;++r)l[r].e=n=!n;for(var h,c,u=a[0];;){for(var f=u,d=!0;f.v;)if((f=f.n)===u)return;h=f.z,o.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(r=0,s=h.length;r<s;++r)o.point((c=h[r])[0],c[1]);else i(f.x,f.n.x,1,o);f=f.n}else{if(d)for(h=f.p.z,r=h.length-1;r>=0;--r)o.point((c=h[r])[0],c[1]);else i(f.x,f.p.x,-1,o);f=f.p}h=(f=f.o).z,d=!d}while(!f.v);o.lineEnd()}}}function Yo(t){if(e=t.length){for(var e,n,i=0,o=t[0];++i<e;)o.n=n=t[i],n.p=o,o=n;o.n=n=t[0],n.p=o}}Math.tan;class jo{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const o=e[i],r=t+o,s=Math.abs(t)<Math.abs(o)?t-(r-o):o-(r-t);s&&(e[n++]=s),t=r}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,i,o=this._n,r=0;if(o>0){for(r=t[--o];o>0&&(e=r,n=t[--o],r=e+n,i=n-(r-e),!i););o>0&&(i<0&&t[o-1]<0||i>0&&t[o-1]>0)&&(n=2*i,e=r+n,n==e-r&&(r=e))}return r}}function Vo(t){return[Lo(t[1],t[0]),Io(t[2])]}function Xo(t){var e=t[0],n=t[1],i=No(n);return[i*No(e),i*Ro(e),Ro(n)]}function $o(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function qo(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Ho(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ko(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Jo(t){var e=Do(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Qo(t){return Fo(t[0])<=Mo?t[0]:Zo(t[0])*((Fo(t[0])+Mo)%Eo-Mo)}function tr(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function er(t,e,n,i){return function(o){var r,s,a,l=e(o),h=Wo(),c=e(h),u=!1,f={point:d,lineStart:g,lineEnd:v,polygonStart:function(){f.point=y,f.lineStart=m,f.lineEnd=x,s=[],r=[]},polygonEnd:function(){f.point=d,f.lineStart=g,f.lineEnd=v,s=tr(s);var t=function(t,e){var n=Qo(e),i=e[1],o=Ro(i),r=[Ro(n),-No(n),0],s=0,a=0,l=new jo;1===o?i=ko+_o:-1===o&&(i=-ko-_o);for(var h=0,c=t.length;h<c;++h)if(f=(u=t[h]).length)for(var u,f,d=u[f-1],p=Qo(d),g=d[1]/2+zo,v=Ro(g),y=No(g),m=0;m<f;++m,p=w,v=C,y=S,d=x){var x=u[m],w=Qo(x),b=x[1]/2+zo,C=Ro(b),S=No(b),_=w-p,M=_>=0?1:-1,k=M*_,z=k>Mo,E=v*C;if(l.add(Lo(E*M*Ro(k),y*S+E*No(k))),s+=z?_+M*Eo:_,z^p>=n^w>=n){var T=qo(Xo(d),Xo(x));Jo(T);var A=qo(r,T);Jo(A);var F=(z^_>=0?-1:1)*Io(A[2]);(i>F||i===F&&(T[0]||T[1]))&&(a+=z^_>=0?1:-1)}}return(s<-_o||s<_o&&l<-1e-12)^1&a}(r,i);s.length?(u||(o.polygonStart(),u=!0),Oo(s,ir,t,n,o)):t&&(u||(o.polygonStart(),u=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),u&&(o.polygonEnd(),u=!1),s=r=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,n){t(e,n)&&o.point(e,n)}function p(t,e){l.point(t,e)}function g(){f.point=p,l.lineStart()}function v(){f.point=d,l.lineEnd()}function y(t,e){a.push([t,e]),c.point(t,e)}function m(){c.lineStart(),a=[]}function x(){y(a[0][0],a[0][1]),c.lineEnd();var t,e,n,i,l=c.clean(),f=h.result(),d=f.length;if(a.pop(),r.push(a),a=null,d)if(1&l){if((e=(n=f[0]).length-1)>0){for(u||(o.polygonStart(),u=!0),o.lineStart(),t=0;t<e;++t)o.point((i=n[t])[0],i[1]);o.lineEnd()}}else d>1&&2&l&&f.push(f.pop().concat(f.shift())),s.push(f.filter(nr))}return f}}function nr(t){return t.length>1}function ir(t,e){return((t=t.x)[0]<0?t[1]-ko-_o:ko-t[1])-((e=e.x)[0]<0?e[1]-ko-_o:ko-e[1])}const or=er((function(){return!0}),(function(t){var e,n=NaN,i=NaN,o=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,s){var a=r>0?Mo:-Mo,l=Fo(r-n);Fo(l-Mo)<_o?(t.point(n,i=(i+s)/2>0?ko:-ko),t.point(o,i),t.lineEnd(),t.lineStart(),t.point(a,i),t.point(r,i),e=0):o!==a&&l>=Mo&&(Fo(n-o)<_o&&(n-=o*_o),Fo(r-a)<_o&&(r-=a*_o),i=function(t,e,n,i){var o,r,s=Ro(t-n);return Fo(s)>_o?Po((Ro(e)*(r=No(i))*Ro(n)-Ro(i)*(o=No(e))*Ro(t))/(o*r*s)):(e+i)/2}(n,i,r,s),t.point(o,i),t.lineEnd(),t.lineStart(),t.point(a,i),e=0),t.point(n=r,i=s),o=a},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}}),(function(t,e,n,i){var o;if(null==t)o=n*ko,i.point(-Mo,o),i.point(0,o),i.point(Mo,o),i.point(Mo,0),i.point(Mo,-o),i.point(0,-o),i.point(-Mo,-o),i.point(-Mo,0),i.point(-Mo,o);else if(Fo(t[0]-e[0])>_o){var r=t[0]<e[0]?Mo:-Mo;o=n*r/2,i.point(-r,o),i.point(0,o),i.point(r,o)}else i.point(e[0],e[1])}),[-Mo,-ko]);function rr(t,e){(e=Xo(e))[0]-=t,Jo(e);var n,i=(n=-e[1])>1?0:n<-1?Mo:Math.acos(n);return((-e[2]<0?-i:i)+Eo-_o)%Eo}function sr(t){var e=No(t),n=6*Ao,i=e>0,o=Fo(e)>_o;function r(t,n){return No(t)*No(n)>e}function s(t,n,i){var o=[1,0,0],r=qo(Xo(t),Xo(n)),s=$o(r,r),a=r[0],l=s-a*a;if(!l)return!i&&t;var h=e*s/l,c=-e*a/l,u=qo(o,r),f=Ko(o,h);Ho(f,Ko(r,c));var d=u,p=$o(f,d),g=$o(d,d),v=p*p-g*($o(f,f)-1);if(!(v<0)){var y=Do(v),m=Ko(d,(-p-y)/g);if(Ho(m,f),m=Vo(m),!i)return m;var x,w=t[0],b=n[0],C=t[1],S=n[1];b<w&&(x=w,w=b,b=x);var _=b-w,M=Fo(_-Mo)<_o;if(!M&&S<C&&(x=C,C=S,S=x),M||_<_o?M?C+S>0^m[1]<(Fo(m[0]-w)<_o?C:S):C<=m[1]&&m[1]<=S:_>Mo^(w<=m[0]&&m[0]<=b)){var k=Ko(d,(-p+y)/g);return Ho(k,f),[m,Vo(k)]}}}function a(e,n){var o=i?t:Mo-t,r=0;return e<-o?r|=1:e>o&&(r|=2),n<-o?r|=4:n>o&&(r|=8),r}return er(r,(function(t){var e,n,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(u,f){var d,p=[u,f],g=r(u,f),v=i?g?0:a(u,f):g?a(u+(u<0?Mo:-Mo),f):0;if(!e&&(h=l=g)&&t.lineStart(),g!==l&&(!(d=s(e,p))||Uo(e,d)||Uo(p,d))&&(p[2]=1),g!==l)c=0,g?(t.lineStart(),d=s(p,e),t.point(d[0],d[1])):(d=s(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(o&&e&&i^g){var y;v&n||!(y=s(p,e,!0))||(c=0,i?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&Uo(e,p)||t.point(p[0],p[1]),e=p,l=g,n=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,i,o,r){!function(t,e,n,i,o,r){if(n){var s=No(e),a=Ro(e),l=i*n;null==o?(o=e+i*Eo,r=e-l/2):(o=rr(s,o),r=rr(s,r),(i>0?o<r:o>r)&&(o+=i*Eo));for(var h,c=o;i>0?c>r:c<r;c-=l)h=Vo([s,-a*No(c),-a*Ro(c)]),t.point(h[0],h[1])}}(r,t,n,o,e,i)}),i?[0,-t]:[-Mo,t-Mo])}var ar=1e9,lr=-ar;function hr(t,e,n,i){function o(o,r){return t<=o&&o<=n&&e<=r&&r<=i}function r(o,r,a,h){var c=0,u=0;if(null==o||(c=s(o,a))!==(u=s(r,a))||l(o,r)<0^a>0)do{h.point(0===c||3===c?t:n,c>1?i:e)}while((c=(c+a+4)%4)!==u);else h.point(r[0],r[1])}function s(i,o){return Fo(i[0]-t)<_o?o>0?0:3:Fo(i[0]-n)<_o?o>0?2:1:Fo(i[1]-e)<_o?o>0?1:0:o>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var n=s(t,1),i=s(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var l,h,c,u,f,d,p,g,v,y,m,x=s,w=Wo(),b={point:C,lineStart:function(){b.point=S,h&&h.push(c=[]),y=!0,v=!1,p=g=NaN},lineEnd:function(){l&&(S(u,f),d&&v&&w.rejoin(),l.push(w.result())),b.point=C,v&&x.lineEnd()},polygonStart:function(){x=w,l=[],h=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,o=h.length;n<o;++n)for(var r,s,a=h[n],l=1,c=a.length,u=a[0],f=u[0],d=u[1];l<c;++l)r=f,s=d,f=(u=a[l])[0],d=u[1],s<=i?d>i&&(f-r)*(i-s)>(d-s)*(t-r)&&++e:d<=i&&(f-r)*(i-s)<(d-s)*(t-r)&&--e;return e}(),n=m&&e,o=(l=tr(l)).length;(n||o)&&(s.polygonStart(),n&&(s.lineStart(),r(null,null,1,s),s.lineEnd()),o&&Oo(l,a,e,r,s),s.polygonEnd()),x=s,l=h=c=null}};function C(t,e){o(t,e)&&x.point(t,e)}function S(r,s){var a=o(r,s);if(h&&c.push([r,s]),y)u=r,f=s,d=a,y=!1,a&&(x.lineStart(),x.point(r,s));else if(a&&v)x.point(r,s);else{var l=[p=Math.max(lr,Math.min(ar,p)),g=Math.max(lr,Math.min(ar,g))],w=[r=Math.max(lr,Math.min(ar,r)),s=Math.max(lr,Math.min(ar,s))];!function(t,e,n,i,o,r){var s,a=t[0],l=t[1],h=0,c=1,u=e[0]-a,f=e[1]-l;if(s=n-a,u||!(s>0)){if(s/=u,u<0){if(s<h)return;s<c&&(c=s)}else if(u>0){if(s>c)return;s>h&&(h=s)}if(s=o-a,u||!(s<0)){if(s/=u,u<0){if(s>c)return;s>h&&(h=s)}else if(u>0){if(s<h)return;s<c&&(c=s)}if(s=i-l,f||!(s>0)){if(s/=f,f<0){if(s<h)return;s<c&&(c=s)}else if(f>0){if(s>c)return;s>h&&(h=s)}if(s=r-l,f||!(s<0)){if(s/=f,f<0){if(s>c)return;s>h&&(h=s)}else if(f>0){if(s<h)return;s<c&&(c=s)}return h>0&&(t[0]=a+h*u,t[1]=l+h*f),c<1&&(e[0]=a+c*u,e[1]=l+c*f),!0}}}}}(l,w,t,e,n,i)?a&&(x.lineStart(),x.point(r,s),m=!1):(v||(x.lineStart(),x.point(l[0],l[1])),x.point(w[0],w[1]),a||x.lineEnd(),m=!1)}p=r,g=s,v=a}return b}}function cr(t,e){function n(n,i){return n=t(n,i),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,i){return(n=e.invert(n,i))&&t.invert(n[0],n[1])}),n}const ur=t=>t;function fr(t,e){return[Fo(t)>Mo?t+Math.round(-t/Eo)*Eo:t,e]}function dr(t){return function(e,n){return[(e+=t)>Mo?e-Eo:e<-Mo?e+Eo:e,n]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){var n=No(t),i=Ro(t),o=No(e),r=Ro(e);function s(t,e){var s=No(e),a=No(t)*s,l=Ro(t)*s,h=Ro(e),c=h*n+a*i;return[Lo(l*o-c*r,a*n-h*i),Io(c*o+l*r)]}return s.invert=function(t,e){var s=No(e),a=No(t)*s,l=Ro(t)*s,h=Ro(e),c=h*o-l*r;return[Lo(l*o+h*r,a*n+c*i),Io(c*n-a*i)]},s}function vr(t){return function(e){var n=new yr;for(var i in t)n[i]=t[i];return n.stream=e,n}}function yr(){}function mr(t,e){t&&wr.hasOwnProperty(t.type)&&wr[t.type](t,e)}fr.invert=fr,yr.prototype={constructor:yr,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var xr={Feature:function(t,e){mr(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,o=n.length;++i<o;)mr(n[i].geometry,e)}},wr={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,i=-1,o=n.length;++i<o;)t=n[i],e.point(t[0],t[1],t[2])},LineString:function(t,e){br(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,i=-1,o=n.length;++i<o;)br(n[i],e,0)},Polygon:function(t,e){Cr(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,i=-1,o=n.length;++i<o;)Cr(n[i],e)},GeometryCollection:function(t,e){for(var n=t.geometries,i=-1,o=n.length;++i<o;)mr(n[i],e)}};function br(t,e,n){var i,o=-1,r=t.length-n;for(e.lineStart();++o<r;)i=t[o],e.point(i[0],i[1],i[2]);e.lineEnd()}function Cr(t,e){var n=-1,i=t.length;for(e.polygonStart();++n<i;)br(t[n],e,1);e.polygonEnd()}var Sr=1/0,_r=Sr,Mr=-Sr,kr=Mr,zr={point:function(t,e){t<Sr&&(Sr=t),t>Mr&&(Mr=t),e<_r&&(_r=e),e>kr&&(kr=e)},lineStart:Bo,lineEnd:Bo,polygonStart:Bo,polygonEnd:Bo,result:function(){var t=[[Sr,_r],[Mr,kr]];return Mr=kr=-(_r=Sr=1/0),t}};const Er=zr;function Tr(t,e,n){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),function(t,e){t&&xr.hasOwnProperty(t.type)?xr[t.type](t,e):mr(t,e)}(n,t.stream(Er)),e(Er.result()),null!=i&&t.clipExtent(i),t}function Ar(t,e,n){return Tr(t,(function(n){var i=e[1][0]-e[0][0],o=e[1][1]-e[0][1],r=Math.min(i/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),s=+e[0][0]+(i-r*(n[1][0]+n[0][0]))/2,a=+e[0][1]+(o-r*(n[1][1]+n[0][1]))/2;t.scale(150*r).translate([s,a])}),n)}var Fr=No(30*Ao);function Pr(t,e){return+e?function(t,e){function n(i,o,r,s,a,l,h,c,u,f,d,p,g,v){var y=h-i,m=c-o,x=y*y+m*m;if(x>4*e&&g--){var w=s+f,b=a+d,C=l+p,S=Do(w*w+b*b+C*C),_=Io(C/=S),M=Fo(Fo(C)-1)<_o||Fo(r-u)<_o?(r+u)/2:Lo(b,w),k=t(M,_),z=k[0],E=k[1],T=z-i,A=E-o,F=m*T-y*A;(F*F/x>e||Fo((y*T+m*A)/x-.5)>.3||s*f+a*d+l*p<Fr)&&(n(i,o,r,s,a,l,z,E,M,w/=S,b/=S,C,g,v),v.point(z,E),n(z,E,M,w,b,C,h,c,u,f,d,p,g,v))}}return function(e){var i,o,r,s,a,l,h,c,u,f,d,p,g={point:v,lineStart:y,lineEnd:x,polygonStart:function(){e.polygonStart(),g.lineStart=w},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function v(n,i){n=t(n,i),e.point(n[0],n[1])}function y(){c=NaN,g.point=m,e.lineStart()}function m(i,o){var r=Xo([i,o]),s=t(i,o);n(c,u,h,f,d,p,c=s[0],u=s[1],h=i,f=r[0],d=r[1],p=r[2],16,e),e.point(c,u)}function x(){g.point=v,e.lineEnd()}function w(){y(),g.point=b,g.lineEnd=C}function b(t,e){m(i=t,e),o=c,r=u,s=f,a=d,l=p,g.point=m}function C(){n(c,u,h,f,d,p,o,r,i,s,a,l,16,e),g.lineEnd=x,x()}return g}}(t,e):function(t){return vr({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Lr=vr({point:function(t,e){this.stream.point(t*Ao,e*Ao)}});function Nr(t,e,n,i,o,r){if(!r)return function(t,e,n,i,o){function r(r,s){return[e+t*(r*=i),n-t*(s*=o)]}return r.invert=function(r,s){return[(r-e)/t*i,(n-s)/t*o]},r}(t,e,n,i,o);var s=No(r),a=Ro(r),l=s*t,h=a*t,c=s/t,u=a/t,f=(a*n-s*e)/t,d=(a*e+s*n)/t;function p(t,r){return[l*(t*=i)-h*(r*=o)+e,n-h*t-l*r]}return p.invert=function(t,e){return[i*(c*t-u*e+f),o*(d-u*t-c*e)]},p}function Rr(t){return function(t){var e,n,i,o,r,s,a,l,h,c,u=150,f=480,d=250,p=0,g=0,v=0,y=0,m=0,x=0,w=1,b=1,C=null,S=or,_=null,M=ur,k=.5;function z(t){return l(t[0]*Ao,t[1]*Ao)}function E(t){return(t=l.invert(t[0],t[1]))&&[t[0]*To,t[1]*To]}function T(){var t=Nr(u,0,0,w,b,x).apply(null,e(p,g)),i=Nr(u,f-t[0],d-t[1],w,b,x);return n=function(t,e,n){return(t%=Eo)?e||n?cr(pr(t),gr(e,n)):pr(t):e||n?gr(e,n):fr}(v,y,m),a=cr(e,i),l=cr(n,a),s=Pr(a,k),A()}function A(){return h=c=null,z}return z.stream=function(t){return h&&c===t?h:h=Lr(function(t){return vr({point:function(e,n){var i=t(e,n);return this.stream.point(i[0],i[1])}})}(n)(S(s(M(c=t)))))},z.preclip=function(t){return arguments.length?(S=t,C=void 0,A()):S},z.postclip=function(t){return arguments.length?(M=t,_=i=o=r=null,A()):M},z.clipAngle=function(t){return arguments.length?(S=+t?sr(C=t*Ao):(C=null,or),A()):C*To},z.clipExtent=function(t){return arguments.length?(M=null==t?(_=i=o=r=null,ur):hr(_=+t[0][0],i=+t[0][1],o=+t[1][0],r=+t[1][1]),A()):null==_?null:[[_,i],[o,r]]},z.scale=function(t){return arguments.length?(u=+t,T()):u},z.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],T()):[f,d]},z.center=function(t){return arguments.length?(p=t[0]%360*Ao,g=t[1]%360*Ao,T()):[p*To,g*To]},z.rotate=function(t){return arguments.length?(v=t[0]%360*Ao,y=t[1]%360*Ao,m=t.length>2?t[2]%360*Ao:0,T()):[v*To,y*To,m*To]},z.angle=function(t){return arguments.length?(x=t%360*Ao,T()):x*To},z.reflectX=function(t){return arguments.length?(w=t?-1:1,T()):w<0},z.reflectY=function(t){return arguments.length?(b=t?-1:1,T()):b<0},z.precision=function(t){return arguments.length?(s=Pr(a,k=t*t),A()):Do(k)},z.fitExtent=function(t,e){return Ar(z,t,e)},z.fitSize=function(t,e){return function(t,e,n){return Ar(t,[[0,0],e],n)}(z,t,e)},z.fitWidth=function(t,e){return function(t,e,n){return Tr(t,(function(n){var i=+e,o=i/(n[1][0]-n[0][0]),r=(i-o*(n[1][0]+n[0][0]))/2,s=-o*n[0][1];t.scale(150*o).translate([r,s])}),n)}(z,t,e)},z.fitHeight=function(t,e){return function(t,e,n){return Tr(t,(function(n){var i=+e,o=i/(n[1][1]-n[0][1]),r=-o*n[0][0],s=(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([r,s])}),n)}(z,t,e)},function(){return e=t.apply(this,arguments),z.invert=e.invert&&E,T()}}((function(){return t}))()}var Zr,Dr,Ir=(Zr=function(t){return Do(2/(1+t))},function(t,e){var n=No(t),i=No(e),o=Zr(n*i);return o===1/0?[2,0]:[o*i*Ro(t),o*Ro(e)]});Ir.invert=(Dr=function(t){return 2*Io(t/2)},function(t,e){var n=Do(t*t+e*e),i=Dr(n),o=Ro(i),r=No(i);return[Lo(t*o,n*r),Io(n&&e*o/n)]});const Br=function(t="EUR",e=50,n){const i=(n=n||{}).ex||1.2,o=n.fontFamily||"Arial",r=n.exSize||1;return n.style=n.style||((t,e)=>{if(!(t.rs<i*e))return t.r1<i*e?r+"em "+o:1.5*r+"em "+o}),n.proj=n.proj||Rr(Ir).scale(124.75).clipAngle(179.999).rotate([-10,-52]).reflectX(!1).reflectY(!0).scale(6378137).translate([4321e3,321e4]),n.preprocess=t=>{if(n.ccIn&&t.cc&&!(n.ccIn.indexOf(t.cc)>=0))return!1;const e=n.proj([t.lon,t.lat]);t.x=e[0],t.y=e[1],delete t.lon,delete t.lat},n.baseURL=n.baseURL||"https://raw.githubusercontent.com/eurostat/euronym/main/pub/v2/UTF/",n.url=n.baseURL+e+"/"+t+".csv",n},Wr=function(t){const e=(t=t||{}).nutsYear||"2021",n=t.crs||"3035",i=t.scale||"03M",o=t.nutsLevel||"3",r=t.col||"#888";return t.color=t.color||((t,e)=>{const n=t.properties;return"T"===n.co||e<400?r:e<1e3?n.lvl>=3?"":r:e<2e3?n.lvl>=2?"":r:n.lvl>=1?"":r}),t.width=t.width||((t,e)=>{const n=t.properties;return"T"===n.co?.5:e<400?3==n.lvl||2==n.lvl||1==n.lvl?2.2:4:e<1e3?2==n.lvl||1==n.lvl?1.8:2.5:e<2e3?1==n.lvl?1.8:2.5:1.2}),t.lineDash=t.lineDash||((t,e)=>{const n=t.properties;return"T"===n.co?[]:e<400?3==n.lvl?[2*e,2*e]:2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<1e3?2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<2e3&&1==n.lvl?[5*e,2*e]:[10*e,3*e]}),t.baseURL=t.baseURL||"https://raw.githubusercontent.com/eurostat/Nuts2json/master/pub/v2/",t.url=t.baseURL+e+"/"+n+"/"+i+"/nutsbn_"+o+".json",t},Ur=jn.getParameterByName;return ro({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridviz",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Visualization tool for gridded statistics",
5
5
  "keywords": [
6
6
  "statistics",
@@ -27,46 +27,29 @@
27
27
  "url": "https://github.com/eurostat/gridviz/issues",
28
28
  "email": "Joseph.DAVIES@ext.ec.europa.eu"
29
29
  },
30
- "main": "build/gridviz.min.js",
30
+ "main": "dist/gridviz.min.js",
31
31
  "scripts": {
32
- "test": "echo \"Error: no test specified\" && exit 1",
33
- "start": "npm run build-dev",
32
+ "start": "export NODE_OPTIONS=--openssl-legacy-provider && npm run build-dev",
34
33
  "build": "npm run build-prod",
35
- "doc": "./node_modules/.bin/jsdoc src/js/ src/js/dataset src/js/legend src/js/style -d docs/jsdoc",
34
+ "doc": "./node_modules/.bin/jsdoc src/ src/dataset src/legend src/style -d docs/jsdoc",
36
35
  "build-dev": "webpack --config webpack.config.dev.js",
37
36
  "build-prod": "webpack --config webpack.config.prod.js"
38
37
  },
39
38
  "files": [
40
- "build/gridviz.min.js"
39
+ "dist/gridviz.min.js"
41
40
  ],
42
41
  "dependencies": {
43
- "@babel/runtime": "^7.12.1",
44
42
  "d3-color": "^3.1.0",
45
43
  "d3-fetch": "^3.0.1",
46
44
  "d3-format": "^3.1.0",
47
- "d3-random": "^3.0.1",
48
45
  "d3-geo": "^3.0.1",
46
+ "d3-random": "^3.0.1",
49
47
  "d3-selection": "^3.0.0",
50
- "d3-zoom": "^3.0.0",
51
- "geotiff": "^2.0.5",
52
- "publish": "^0.6.0",
53
- "puppeteer": "^1.13.0",
54
- "rbush": "^3.0.1"
48
+ "d3-zoom": "^3.0.0"
55
49
  },
56
50
  "devDependencies": {
57
- "@babel/core": "^7.9.0",
58
- "@babel/plugin-transform-runtime": "^7.12.1",
59
- "@babel/preset-env": "^7.9.0",
60
- "babel-loader": "^8.1.0",
61
- "css-loader": "^3.4.2",
62
- "file-loader": "^6.2.0",
63
- "jsdoc": "^3.6.3",
64
- "style-loader": "^1.1.3",
65
- "url-loader": "^4.1.1",
66
- "jest": "^26.6.1",
67
- "jshint": "^2.12.0",
68
- "webpack": "^4.41.2",
69
- "webpack-cli": "^3.3.10",
70
- "webpack-livereload-plugin": "^2.3.0"
51
+ "webpack": "^5.75.0",
52
+ "webpack-cli": "^5.0.0",
53
+ "webpack-livereload-plugin": "^3.0.2"
71
54
  }
72
55
  }
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gviz=e():t.gviz=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="build/",n(n.s=9)}({10:function(t,e,n){"use strict";function r(){}n.r(e),n.d(e,"App",(function(){return So})),n.d(e,"Layer",(function(){return dr})),n.d(e,"Dataset",(function(){return ur})),n.d(e,"DatasetComponent",(function(){return nr})),n.d(e,"TiledGrid",(function(){return uo})),n.d(e,"CSVGrid",(function(){return Gr})),n.d(e,"ShapeColorSizeStyle",(function(){return Mo})),n.d(e,"StrokeStyle",(function(){return Do})),n.d(e,"JoyPlotStyle",(function(){return qo})),n.d(e,"CompositionStyle",(function(){return ii})),n.d(e,"SegmentStyle",(function(){return pi})),n.d(e,"TextStyle",(function(){return _i})),n.d(e,"KernelSmoothingStyle",(function(){return Ti})),n.d(e,"PillarStyle",(function(){return Zi})),n.d(e,"SideStyle",(function(){return Hi})),n.d(e,"ContourStyle",(function(){return ra})),n.d(e,"SideCatStyle",(function(){return ha})),n.d(e,"DotDensityStyle",(function(){return Pa})),n.d(e,"TanakaStyle",(function(){return Ba})),n.d(e,"LegoStyle",(function(){return iu})),n.d(e,"SquareColorWGLStyle",(function(){return La})),n.d(e,"SquareColorCatWGLStyle",(function(){return Xa})),n.d(e,"MosaicStyle",(function(){return vu})),n.d(e,"BackgroundLayer",(function(){return co})),n.d(e,"LabelLayer",(function(){return yo})),n.d(e,"BoundaryLayer",(function(){return bo})),n.d(e,"ColorLegend",(function(){return zu})),n.d(e,"ColorCategoryLegend",(function(){return Zu})),n.d(e,"SizeLegend",(function(){return Xu})),n.d(e,"SegmentWidthLegend",(function(){return el})),n.d(e,"goToStraight",(function(){return rl})),n.d(e,"zoomTo",(function(){return nl})),n.d(e,"sPow",(function(){return ol})),n.d(e,"sPowRev",(function(){return il})),n.d(e,"sExp",(function(){return al})),n.d(e,"sExpRev",(function(){return ul})),n.d(e,"sCircleLow",(function(){return ll})),n.d(e,"sCircleHigh",(function(){return cl})),n.d(e,"sExpInverse",(function(){return fl})),n.d(e,"sExpRevInverse",(function(){return sl})),n.d(e,"sPowInverse",(function(){return hl})),n.d(e,"sPowRevInverse",(function(){return yl})),n.d(e,"getEuronymeLabelLayer",(function(){return Ac})),n.d(e,"getEurostatBoundariesLayer",(function(){return Ec})),n.d(e,"getParameterByName",(function(){return Mc}));var o=function(t){return null==t?r:function(){return this.querySelector(t)}};function i(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function a(){return[]}var u=function(t){return null==t?a:function(){return this.querySelectorAll(t)}};var l=function(t){return function(){return this.matches(t)}};function c(t){return function(e){return e.matches(t)}}var f=Array.prototype.find;function s(){return this.firstElementChild}var h=Array.prototype.filter;function y(){return Array.from(this.children)}var p=function(t){return new Array(t.length)};function v(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}v.prototype={constructor:v,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var d=function(t){return function(){return t}};function g(t,e,n,r,o,i){for(var a,u=0,l=e.length,c=i.length;u<c;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):n[u]=new v(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function b(t,e,n,r,o,i,a){var u,l,c,f=new Map,s=e.length,h=i.length,y=new Array(s);for(u=0;u<s;++u)(l=e[u])&&(y[u]=c=a.call(l,l.__data__,u,e)+"",f.has(c)?o[u]=l:f.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=f.get(c))?(r[u]=l,l.__data__=i[u],f.delete(c)):n[u]=new v(t,i[u]);for(u=0;u<s;++u)(l=e[u])&&f.get(y[u])===l&&(o[u]=l)}function m(t){return t.__data__}function w(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function x(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var S="http://www.w3.org/1999/xhtml",_={svg:"http://www.w3.org/2000/svg",xhtml:S,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},O=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),_.hasOwnProperty(e)?{space:_[e],local:t}:t};function C(t){return function(){this.removeAttribute(t)}}function k(t){return function(){this.removeAttributeNS(t.space,t.local)}}function P(t,e){return function(){this.setAttribute(t,e)}}function j(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function A(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var M=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function T(t){return function(){this.style.removeProperty(t)}}function R(t,e,n){return function(){this.style.setProperty(t,e,n)}}function z(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function F(t,e){return t.style.getPropertyValue(e)||M(t).getComputedStyle(t,null).getPropertyValue(e)}function I(t){return function(){delete this[t]}}function L(t,e){return function(){this[t]=e}}function N(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function B(t){return t.trim().split(/^|\s+/)}function D(t){return t.classList||new Z(t)}function Z(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function U(t,e){for(var n=D(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function W(t,e){for(var n=D(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function G(t){return function(){U(this,t)}}function $(t){return function(){W(this,t)}}function Y(t,e){return function(){(e.apply(this,arguments)?U:W)(this,t)}}Z.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function V(){this.textContent=""}function X(t){return function(){this.textContent=t}}function q(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function H(){this.innerHTML=""}function K(t){return function(){this.innerHTML=t}}function J(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Q(){this.nextSibling&&this.parentNode.appendChild(this)}function tt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function et(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===S&&e.documentElement.namespaceURI===S?e.createElement(t):e.createElementNS(n,t)}}function nt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var rt=function(t){var e=O(t);return(e.local?nt:et)(e)};function ot(){return null}function it(){var t=this.parentNode;t&&t.removeChild(this)}function at(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ut(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function lt(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function ct(t){return function(){var e=this.__on;if(e){for(var n,r=0,o=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?e.length=o:delete this.__on}}}function ft(t,e,n){return function(){var r,o=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function st(t,e,n){var r=M(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function ht(t,e){return function(){return st(this,t,e)}}function yt(t,e){return function(){return st(this,t,e.apply(this,arguments))}}var pt=[null];function vt(t,e){this._groups=t,this._parents=e}function dt(){return new vt([[document.documentElement]],pt)}vt.prototype=dt.prototype={constructor:vt,select:function(t){"function"!=typeof t&&(t=o(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,u,l=e[i],c=l.length,f=r[i]=new Array(c),s=0;s<c;++s)(a=l[s])&&(u=t.call(a,a.__data__,s,l))&&("__data__"in a&&(u.__data__=a.__data__),f[s]=u);return new vt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return i(t.apply(this,arguments))}}(t):u(t);for(var e=this._groups,n=e.length,r=[],o=[],a=0;a<n;++a)for(var l,c=e[a],f=c.length,s=0;s<f;++s)(l=c[s])&&(r.push(t.call(l,l.__data__,s,c)),o.push(l));return new vt(r,o)},selectChild:function(t){return this.select(null==t?s:function(t){return function(){return f.call(this.children,t)}}("function"==typeof t?t:c(t)))},selectChildren:function(t){return this.selectAll(null==t?y:function(t){return function(){return h.call(this.children,t)}}("function"==typeof t?t:c(t)))},filter:function(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,c=r[o]=[],f=0;f<u;++f)(i=a[f])&&t.call(i,i.__data__,f,a)&&c.push(i);return new vt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,m);var n=e?b:g,r=this._parents,o=this._groups;"function"!=typeof t&&(t=d(t));for(var i=o.length,a=new Array(i),u=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],s=o[c],h=s.length,y=w(t.call(f,f&&f.__data__,c,r)),p=y.length,v=u[c]=new Array(p),x=a[c]=new Array(p),S=l[c]=new Array(h);n(f,s,v,x,S,y,e);for(var _,O,C=0,k=0;C<p;++C)if(_=v[C]){for(C>=k&&(k=C+1);!(O=x[k])&&++k<p;);_._next=O||null}}return(a=new vt(a,r))._enter=u,a._exit=l,a},enter:function(){return new vt(this._enter||this._groups.map(p),this._parents)},exit:function(){return new vt(this._exit||this._groups.map(p),this._parents)},join:function(t,e,n){var r=this.enter(),o=this,i=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(o=e(o))&&(o=o.selection()),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,a=Math.min(o,i),u=new Array(o),l=0;l<a;++l)for(var c,f=n[l],s=r[l],h=f.length,y=u[l]=new Array(h),p=0;p<h;++p)(c=f[p]||s[p])&&(y[p]=c);for(;l<o;++l)u[l]=n[l];return new vt(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=x);for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a,u=n[i],l=u.length,c=o[i]=new Array(l),f=0;f<l;++f)(a=u[f])&&(c[f]=a);c.sort(e)}return new vt(o,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,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o,i=e[n],a=0,u=i.length;a<u;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this},attr:function(t,e){var n=O(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?k:C:"function"==typeof e?n.local?E:A:n.local?j:P)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?T:"function"==typeof e?z:R)(t,e,null==n?"":n)):F(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?I:"function"==typeof e?N:L)(t,e)):this.node()[t]},classed:function(t,e){var n=B(t+"");if(arguments.length<2){for(var r=D(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?Y:e?G:$)(n,e))},text:function(t){return arguments.length?this.each(null==t?V:("function"==typeof t?q:X)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?H:("function"==typeof t?J:K)(t)):this.node().innerHTML},raise:function(){return this.each(Q)},lower:function(){return this.each(tt)},append:function(t){var e="function"==typeof t?t:rt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:rt(t),r=null==e?ot:"function"==typeof e?e:o(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(it)},clone:function(t){return this.select(t?ut:at)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=lt(t+""),a=i.length;if(!(arguments.length<2)){for(u=e?ft:ct,r=0;r<a;++r)this.each(u(i[r],e,n));return this}var u=this.node().__on;if(u)for(var l,c=0,f=u.length;c<f;++c)for(r=0,l=u[c];r<a;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?yt:ht)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,o=t[e],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};var gt=dt,bt=function(t){return"string"==typeof t?new vt([[document.querySelector(t)]],[document.documentElement]):new vt([[t]],pt)},mt={value:()=>{}};function wt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new xt(r)}function xt(t){this._=t}function St(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function _t(t,e){for(var n,r=0,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function Ot(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=mt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}xt.prototype=wt.prototype={constructor:xt,on:function(t,e){var n,r=this._,o=St(t+"",r),i=-1,a=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++i<a;)if(n=(t=o[i]).type)r[n]=Ot(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Ot(r[n],t.name,null);return this}for(;++i<a;)if((n=(t=o[i]).type)&&(n=_t(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new xt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,o=new Array(n),i=0;i<n;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,o)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};var Ct=wt;const kt={capture:!0,passive:!1};var Pt=function(t){t.preventDefault(),t.stopImmediatePropagation()},jt=function(t){var e=t.document.documentElement,n=bt(t).on("dragstart.drag",Pt,kt);"onselectstart"in e?n.on("selectstart.drag",Pt,kt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")};function At(t,e){var n=t.document.documentElement,r=bt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Pt,kt),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Et(t){return((t=Math.exp(t))+1/t)/2}var Mt,Tt,Rt=function t(e,n,r){function o(t,o){var i,a,u=t[0],l=t[1],c=t[2],f=o[0],s=o[1],h=o[2],y=f-u,p=s-l,v=y*y+p*p;if(v<1e-12)a=Math.log(h/c)/e,i=function(t){return[u+t*y,l+t*p,c*Math.exp(e*t*a)]};else{var d=Math.sqrt(v),g=(h*h-c*c+r*v)/(2*c*n*d),b=(h*h-c*c-r*v)/(2*h*n*d),m=Math.log(Math.sqrt(g*g+1)-g),w=Math.log(Math.sqrt(b*b+1)-b);a=(w-m)/e,i=function(t){var r,o=t*a,i=Et(m),f=c/(n*d)*(i*(r=e*o+m,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(m));return[u+f*y,l+f*p,c*i/Et(e*o+m)]}}return i.duration=1e3*a*e/Math.SQRT2,i}return o.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},o}(Math.SQRT2,2,4),zt=function(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]},Ft=0,It=0,Lt=0,Nt=0,Bt=0,Dt=0,Zt="object"==typeof performance&&performance.now?performance:Date,Ut="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Wt(){return Bt||(Ut(Gt),Bt=Zt.now()+Dt)}function Gt(){Bt=0}function $t(){this._call=this._time=this._next=null}function Yt(t,e,n){var r=new $t;return r.restart(t,e,n),r}function Vt(){Bt=(Nt=Zt.now())+Dt,Ft=It=0;try{!function(){Wt(),++Ft;for(var t,e=Mt;e;)(t=Bt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ft}()}finally{Ft=0,function(){var t,e,n=Mt,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Mt=e);Tt=t,qt(r)}(),Bt=0}}function Xt(){var t=Zt.now(),e=t-Nt;e>1e3&&(Dt-=e,Nt=t)}function qt(t){Ft||(It&&(It=clearTimeout(It)),t-Bt>24?(t<1/0&&(It=setTimeout(Vt,t-Zt.now()-Dt)),Lt&&(Lt=clearInterval(Lt))):(Lt||(Nt=Zt.now(),Lt=setInterval(Xt,1e3)),Ft=1,Ut(Vt)))}$t.prototype=Yt.prototype={constructor:$t,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Wt():+n)+(null==e?0:+e),this._next||Tt===this||(Tt?Tt._next=this:Mt=this,Tt=this),this._call=t,this._time=n,qt()},stop:function(){this._call&&(this._call=null,this._time=1/0,qt())}};var Ht=function(t,e,n){var r=new $t;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r},Kt=Ct("start","end","cancel","interrupt"),Jt=[],Qt=function(t,e,n,r,o,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,o=t.__transition;function i(l){var c,f,s,h;if(1!==n.state)return u();for(c in o)if((h=o[c]).name===n.name){if(3===h.state)return Ht(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[c]):+c<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[c])}if(Ht((function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(l))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(s=n.tween.length),c=0,f=-1;c<s;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(e){for(var o=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=5,1),i=-1,a=r.length;++i<a;)r[i].call(t,o);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=6,n.timer.stop(),delete o[e],o)return;delete t.__transition}o[e]=n,n.timer=Yt((function(t){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=t&&i(t-n.delay)}),0,n.time)}(t,n,{name:e,index:r,group:o,on:Kt,tween:Jt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})};function te(t,e){var n=ne(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function ee(t,e){var n=ne(t,e);if(n.state>3)throw new Error("too late; already running");return n}function ne(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var re,oe=function(t,e){var n,r,o,i=t.__transition,a=!0;if(i){for(o in e=null==e?null:e+"",i)(n=i[o]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[o]):a=!1;a&&delete t.__transition}},ie=function(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}},ae=180/Math.PI,ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},le=function(t,e,n,r,o,i){var a,u,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,l/=u),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*ae,skewX:Math.atan(l)*ae,scaleX:a,scaleY:u}};function ce(t,e,n,r){function o(t){return t.length?t.pop()+" ":""}return function(i,a){var u=[],l=[];return i=t(i),a=t(a),function(t,r,o,i,a,u){if(t!==o||r!==i){var l=a.push("translate(",null,e,null,n);u.push({i:l-4,x:ie(t,o)},{i:l-2,x:ie(r,i)})}else(o||i)&&a.push("translate("+o+e+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,u,l),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(o(n)+"rotate(",null,r)-2,x:ie(t,e)})):e&&n.push(o(n)+"rotate("+e+r)}(i.rotate,a.rotate,u,l),function(t,e,n,i){t!==e?i.push({i:n.push(o(n)+"skewX(",null,r)-2,x:ie(t,e)}):e&&n.push(o(n)+"skewX("+e+r)}(i.skewX,a.skewX,u,l),function(t,e,n,r,i,a){if(t!==n||e!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:ie(t,n)},{i:u-2,x:ie(e,r)})}else 1===n&&1===r||i.push(o(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,l),i=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)u[(e=l[n]).i]=e.x(t);return u.join("")}}}var fe=ce((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ue:le(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),se=ce((function(t){return null==t?ue:(re||(re=document.createElementNS("http://www.w3.org/2000/svg","g")),re.setAttribute("transform",t),(t=re.transform.baseVal.consolidate())?(t=t.matrix,le(t.a,t.b,t.c,t.d,t.e,t.f)):ue)}),", ",")",")");function he(t,e){var n,r;return function(){var o=ee(this,t),i=o.tween;if(i!==n)for(var a=0,u=(r=n=i).length;a<u;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}o.tween=r}}function ye(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=ee(this,t),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:e,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===e){o[l]=u;break}l===c&&o.push(u)}i.tween=o}}function pe(t,e,n){var r=t._id;return t.each((function(){var t=ee(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return ne(t,r).value[e]}}var ve=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function de(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ge(){}var be="\\s*([+-]?\\d+)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xe=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),_e=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),Oe=new RegExp(`^rgba\\(${be},${be},${be},${me}\\)$`),Ce=new RegExp(`^rgba\\(${we},${we},${we},${me}\\)$`),ke=new RegExp(`^hsl\\(${me},${we},${we}\\)$`),Pe=new RegExp(`^hsla\\(${me},${we},${we},${me}\\)$`),je={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 Ae(){return this.rgb().formatHex()}function Ee(){return this.rgb().formatRgb()}function Me(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Te(e):3===n?new Ie(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Re(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Re(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Se.exec(t))?new Ie(e[1],e[2],e[3],1):(e=_e.exec(t))?new Ie(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Oe.exec(t))?Re(e[1],e[2],e[3],e[4]):(e=Ce.exec(t))?Re(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ke.exec(t))?Ue(e[1],e[2]/100,e[3]/100,1):(e=Pe.exec(t))?Ue(e[1],e[2]/100,e[3]/100,e[4]):je.hasOwnProperty(t)?Te(je[t]):"transparent"===t?new Ie(NaN,NaN,NaN,0):null}function Te(t){return new Ie(t>>16&255,t>>8&255,255&t,1)}function Re(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ie(t,e,n,r)}function ze(t){return t instanceof ge||(t=Me(t)),t?new Ie((t=t.rgb()).r,t.g,t.b,t.opacity):new Ie}function Fe(t,e,n,r){return 1===arguments.length?ze(t):new Ie(t,e,n,null==r?1:r)}function Ie(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Le(){return`#${Ze(this.r)}${Ze(this.g)}${Ze(this.b)}`}function Ne(){const t=Be(this.opacity);return`${1===t?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${1===t?")":`, ${t})`}`}function Be(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function De(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ze(t){return((t=De(t))<16?"0":"")+t.toString(16)}function Ue(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ge(t,e,n,r)}function We(t){if(t instanceof Ge)return new Ge(t.h,t.s,t.l,t.opacity);if(t instanceof ge||(t=Me(t)),!t)return new Ge;if(t instanceof Ge)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),a=NaN,u=i-o,l=(i+o)/2;return u?(a=e===i?(n-r)/u+6*(n<r):n===i?(r-e)/u+2:(e-n)/u+4,u/=l<.5?i+o:2-i-o,a*=60):u=l>0&&l<1?0:a,new Ge(a,u,l,t.opacity)}function Ge(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function $e(t){return(t=(t||0)%360)<0?t+360:t}function Ye(t){return Math.max(0,Math.min(1,t||0))}function Ve(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Xe(t,e,n,r,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*n+(1+3*t+3*i-3*a)*r+a*o)/6}ve(ge,Me,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ae,formatHex:Ae,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return We(this).formatHsl()},formatRgb:Ee,toString:Ee}),ve(Ie,Fe,de(ge,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ie(De(this.r),De(this.g),De(this.b),Be(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:Le,formatHex:Le,formatHex8:function(){return`#${Ze(this.r)}${Ze(this.g)}${Ze(this.b)}${Ze(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ne,toString:Ne})),ve(Ge,(function(t,e,n,r){return 1===arguments.length?We(t):new Ge(t,e,n,null==r?1:r)}),de(ge,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ge(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Ge(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new Ie(Ve(t>=240?t-240:t+120,o,r),Ve(t,o,r),Ve(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Ge($e(this.h),Ye(this.s),Ye(this.l),Be(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=Be(this.opacity);return`${1===t?"hsl(":"hsla("}${$e(this.h)}, ${100*Ye(this.s)}%, ${100*Ye(this.l)}%${1===t?")":`, ${t})`}`}}));var qe=t=>()=>t;function He(t,e){return function(n){return t+n*e}}function Ke(t){return 1==(t=+t)?Je:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):qe(isNaN(e)?n:e)}}function Je(t,e){var n=e-t;return n?He(t,n):qe(isNaN(t)?e:t)}var Qe=function t(e){var n=Ke(e);function r(t,e){var r=n((t=Fe(t)).r,(e=Fe(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=Je(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function tn(t){return function(e){var n,r,o=e.length,i=new Array(o),a=new Array(o),u=new Array(o);for(n=0;n<o;++n)r=Fe(e[n]),i[n]=r.r||0,a[n]=r.g||0,u[n]=r.b||0;return i=t(i),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=i(t),r.g=a(t),r.b=u(t),r+""}}}tn((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[r],i=t[r+1],a=r>0?t[r-1]:2*o-i,u=r<e-1?t[r+2]:2*i-o;return Xe((n-r/e)*e,a,o,i,u)}})),tn((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],a=t[(r+1)%e],u=t[(r+2)%e];return Xe((n-r/e)*e,o,i,a,u)}}));var en=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nn=new RegExp(en.source,"g");var rn=function(t,e){var n,r,o,i=en.lastIndex=nn.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=en.exec(t))&&(r=nn.exec(e));)(o=r.index)>i&&(o=e.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,l.push({i:a,x:ie(n,r)})),i=nn.lastIndex;return i<e.length&&(o=e.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)u[(n=l[r]).i]=n.x(t);return u.join("")})},on=function(t,e){var n;return("number"==typeof e?ie:e instanceof Me?Qe:(n=Me(e))?(e=n,Qe):rn)(t,e)};function an(t){return function(){this.removeAttribute(t)}}function un(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ln(t,e,n){var r,o,i=n+"";return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function cn(t,e,n){var r,o,i=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function fn(t,e,n){var r,o,i;return function(){var a,u,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(u=l+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,l));this.removeAttribute(t)}}function sn(t,e,n){var r,o,i;return function(){var a,u,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(u=l+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function hn(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function yn(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function pn(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&yn(t,o)),n}return o._value=e,o}function vn(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&hn(t,o)),n}return o._value=e,o}function dn(t,e){return function(){te(this,t).delay=+e.apply(this,arguments)}}function gn(t,e){return e=+e,function(){te(this,t).delay=e}}function bn(t,e){return function(){ee(this,t).duration=+e.apply(this,arguments)}}function mn(t,e){return e=+e,function(){ee(this,t).duration=e}}function wn(t,e){if("function"!=typeof e)throw new Error;return function(){ee(this,t).ease=e}}function xn(t,e,n){var r,o,i=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?te:ee;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(e,n),a.on=o}}var Sn=gt.prototype.constructor;function _n(t){return function(){this.style.removeProperty(t)}}function On(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Cn(t,e,n){var r,o;function i(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&On(t,i,n)),r}return i._value=e,i}function kn(t){return function(e){this.textContent=t.call(this,e)}}function Pn(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&kn(r)),e}return r._value=t,r}var jn=0;function An(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function En(){return++jn}var Mn=gt.prototype;An.prototype=function(t){return gt().transition(t)}.prototype={constructor:An,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=o(t));for(var r=this._groups,i=r.length,a=new Array(i),u=0;u<i;++u)for(var l,c,f=r[u],s=f.length,h=a[u]=new Array(s),y=0;y<s;++y)(l=f[y])&&(c=t.call(l,l.__data__,y,f))&&("__data__"in l&&(c.__data__=l.__data__),h[y]=c,Qt(h[y],e,n,y,h,ne(l,n)));return new An(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=u(t));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var c,f=r[l],s=f.length,h=0;h<s;++h)if(c=f[h]){for(var y,p=t.call(c,c.__data__,h,f),v=ne(c,n),d=0,g=p.length;d<g;++d)(y=p[d])&&Qt(y,e,n,d,p,v);i.push(p),a.push(c)}return new An(i,a,e,n)},selectChild:Mn.selectChild,selectChildren:Mn.selectChildren,filter:function(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,c=r[o]=[],f=0;f<u;++f)(i=a[f])&&t.call(i,i.__data__,f,a)&&c.push(i);return new An(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var l,c=e[u],f=n[u],s=c.length,h=a[u]=new Array(s),y=0;y<s;++y)(l=c[y]||f[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new An(a,this._parents,this._name,this._id)},selection:function(){return new Sn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=En(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],l=u.length,c=0;c<l;++c)if(a=u[c]){var f=ne(a,e);Qt(a,t,n,c,u,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new An(r,this._parents,t,n)},call:Mn.call,nodes:Mn.nodes,node:Mn.node,size:Mn.size,empty:Mn.empty,each:Mn.each,on:function(t,e){var n=this._id;return arguments.length<2?ne(this.node(),n).on.on(t):this.each(xn(n,t,e))},attr:function(t,e){var n=O(t),r="transform"===n?se:on;return this.attrTween(t,"function"==typeof e?(n.local?sn:fn)(n,r,pe(this,"attr."+t,e)):null==e?(n.local?un:an)(n):(n.local?cn:ln)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=O(t);return this.tween(n,(r.local?pn:vn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?fe:on;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=F(this,t),a=(this.style.removeProperty(t),F(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,_n(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=F(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=F(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,pe(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=ee(this,t),c=l.on,f=null==l.value[a]?i||(i=_n(e)):void 0;c===n&&o===f||(r=(n=c).copy()).on(u,o=f),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,o,i=n+"";return function(){var a=F(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,Cn(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(pe(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,Pn(t))},remove:function(){return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}));var t},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,o=ne(this.node(),n).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===t)return r.value;return null}return this.each((null==e?he:ye)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?dn:gn)(e,t)):ne(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?bn:mn)(e,t)):ne(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(wn(e,t)):ne(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;ee(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,o=n.size();return new Promise((function(i,a){var u={value:a},l={value:function(){0==--o&&i()}};n.each((function(){var n=ee(this,r),o=n.on;o!==t&&((e=(t=o).copy())._.cancel.push(u),e._.interrupt.push(u),e._.end.push(l)),n.on=e})),0===o&&i()}))},[Symbol.iterator]:Mn[Symbol.iterator]};var Tn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Rn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}gt.prototype.interrupt=function(t){return this.each((function(){oe(this,t)}))},gt.prototype.transition=function(t){var e,n;t instanceof An?(e=t._id,t=t._name):(e=En(),(n=Tn).time=Wt(),t=null==t?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],l=u.length,c=0;c<l;++c)(a=u[c])&&Qt(a,t,e,c,u,n||Rn(a,e));return new An(r,this._parents,t,e)};var zn=t=>()=>t;function Fn(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function In(t,e,n){this.k=t,this.x=e,this.y=n}In.prototype={constructor:In,scale:function(t){return 1===t?this:new In(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new In(this.k,this.x+this.k*t,this.y+this.k*e)},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 Ln=new In(1,0,0);function Nn(t){t.stopImmediatePropagation()}In.prototype;var Bn=function(t){t.preventDefault(),t.stopImmediatePropagation()};function Dn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Zn(){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 Un(){return this.__zoom||Ln}function Wn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Gn(){return navigator.maxTouchPoints||"ontouchstart"in this}function $n(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}var Yn=function(){var t,e,n,r=Dn,o=Zn,i=$n,a=Wn,u=Gn,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],f=250,s=Rt,h=Ct("start","zoom","end"),y=0,p=10;function v(t){t.property("__zoom",Un).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",O).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new In(e,t.x,t.y)}function g(t,e,n){var r=e[0]-n[0]*t.k,o=e[1]-n[1]*t.k;return r===t.x&&o===t.y?t:new In(t.k,r,o)}function b(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function m(t,e,n,r){t.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,i=arguments,a=w(t,i).event(r),u=o.apply(t,i),l=null==n?b(u):"function"==typeof n?n.apply(t,i):n,c=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),f=t.__zoom,h="function"==typeof e?e.apply(t,i):e,y=s(f.invert(l).concat(c/f.k),h.invert(l).concat(c/h.k));return function(t){if(1===t)t=h;else{var e=y(t),n=c/e[2];t=new In(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}}))}function w(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(t,e),this.taps=0}function S(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),o=this.__zoom,u=Math.max(l[0],Math.min(l[1],o.k*Math.pow(2,a.apply(this,arguments)))),f=zt(t);if(n.wheel)n.mouse[0][0]===f[0]&&n.mouse[0][1]===f[1]||(n.mouse[1]=o.invert(n.mouse[0]=f)),clearTimeout(n.wheel);else{if(o.k===u)return;n.mouse=[f,o.invert(f)],oe(this),n.start()}Bn(t),n.wheel=setTimeout(s,150),n.zoom("mouse",i(g(d(o,u),n.mouse[0],n.mouse[1]),n.extent,c))}function s(){n.wheel=null,n.end()}}function _(t,...e){if(!n&&r.apply(this,arguments)){var o=t.currentTarget,a=w(this,e,!0).event(t),u=bt(t.view).on("mousemove.zoom",h,!0).on("mouseup.zoom",p,!0),l=zt(t,o),f=t.clientX,s=t.clientY;jt(t.view),Nn(t),a.mouse=[l,this.__zoom.invert(l)],oe(this),a.start()}function h(t){if(Bn(t),!a.moved){var e=t.clientX-f,n=t.clientY-s;a.moved=e*e+n*n>y}a.event(t).zoom("mouse",i(g(a.that.__zoom,a.mouse[0]=zt(t,o),a.mouse[1]),a.extent,c))}function p(t){u.on("mousemove.zoom mouseup.zoom",null),At(t.view,a.moved),Bn(t),a.event(t).end()}}function O(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=zt(t.changedTouches?t.changedTouches[0]:t,this),u=n.invert(a),l=n.k*(t.shiftKey?.5:2),s=i(g(d(n,l),a,u),o.apply(this,e),c);Bn(t),f>0?bt(this).transition().duration(f).call(m,s,a,t):bt(this).call(v.transform,s,a,t)}}function C(n,...o){if(r.apply(this,arguments)){var i,a,u,l,c=n.touches,f=c.length,s=w(this,o,n.changedTouches.length===f).event(n);for(Nn(n),a=0;a<f;++a)u=c[a],l=[l=zt(u,this),this.__zoom.invert(l),u.identifier],s.touch0?s.touch1||s.touch0[2]===l[2]||(s.touch1=l,s.taps=0):(s.touch0=l,i=!0,s.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(s.taps<2&&(e=l[0],t=setTimeout((function(){t=null}),500)),oe(this),s.start())}}function k(t,...e){if(this.__zooming){var n,r,o,a,u=w(this,e).event(t),l=t.changedTouches,f=l.length;for(Bn(t),n=0;n<f;++n)r=l[n],o=zt(r,this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var s=u.touch0[0],h=u.touch0[1],y=u.touch1[0],p=u.touch1[1],v=(v=y[0]-s[0])*v+(v=y[1]-s[1])*v,b=(b=p[0]-h[0])*b+(b=p[1]-h[1])*b;r=d(r,Math.sqrt(v/b)),o=[(s[0]+y[0])/2,(s[1]+y[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(g(r,o,a),u.extent,c))}}function P(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(Nn(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),o=0;o<l;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.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&&(i=zt(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<p)){var c=bt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return v.transform=function(t,e,n,r){var o=t.selection?t.selection():t;o.property("__zoom",Un),t!==o?m(t,e,n,r):o.interrupt().each((function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},v.scaleBy=function(t,e,n,r){v.scaleTo(t,(function(){var t=this.__zoom.k,n="function"==typeof e?e.apply(this,arguments):e;return t*n}),n,r)},v.scaleTo=function(t,e,n,r){v.transform(t,(function(){var t=o.apply(this,arguments),r=this.__zoom,a=null==n?b(t):"function"==typeof n?n.apply(this,arguments):n,u=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return i(g(d(r,l),a,u),t,c)}),n,r)},v.translateBy=function(t,e,n,r){v.transform(t,(function(){return i(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),c)}),null,r)},v.translateTo=function(t,e,n,r,a){v.transform(t,(function(){var t=o.apply(this,arguments),a=this.__zoom,u=null==r?b(t):"function"==typeof r?r.apply(this,arguments):r;return i(Ln.translate(u[0],u[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),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,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=bt(this.that).datum();h.call(t,this.that,new Fn(t,{sourceEvent:this.sourceEvent,target:v,type:t,transform:this.that.__zoom,dispatch:h}),e)}},v.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:zn(+t),v):a},v.filter=function(t){return arguments.length?(r="function"==typeof t?t:zn(!!t),v):r},v.touchable=function(t){return arguments.length?(u="function"==typeof t?t:zn(!!t),v):u},v.extent=function(t){return arguments.length?(o="function"==typeof t?t:zn([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),v):o},v.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],v):[l[0],l[1]]},v.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],v):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},v.constrain=function(t){return arguments.length?(i=t,v):i},v.duration=function(t){return arguments.length?(f=+t,v):f},v.interpolate=function(t){return arguments.length?(s=t,v):s},v.on=function(){var t=h.on.apply(h,arguments);return t===h?v:t},v.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,v):Math.sqrt(y)},v.tapDistance=function(t){return arguments.length?(p=+t,v):p},v};function Vn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Xn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xn(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Xn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function qn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Kn=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;qn(this,t),i=i||{},this.canvas=e,this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.canvas.width=this.w,this.canvas.height=this.h;var a=this.canvas.getContext("2d");if(!a)throw"Impossible to create canvas 2D context";this.ctx=a,this.center=r||{x:.5*this.w,y:.5*this.h},this.zf=o,this.backgroundColor=i.backgroundColor||"white",this.onZoomStartFun=i.onZoomStartFun,this.onZoomEndFun=i.onZoomEndFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo();var u=Ln,l=Yn().wheelDelta((function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)})).on("zoom",(function(t){var e=t.transform,r=u.k/e.k;if(1==r){var o=u.x-e.x,i=u.y-e.y;n.pan(o*n.getZf(),-i*n.getZf())}else{var a=t.sourceEvent;if(a instanceof WheelEvent)n.zoom(r,n.pixToGeoX(t.sourceEvent.offsetX),n.pixToGeoY(t.sourceEvent.offsetY));else if(a instanceof TouchEvent){var l,c=0,f=0,s=Vn(a.targetTouches);try{for(s.s();!(l=s.n()).done;){var h=l.value;c+=h.clientX,f+=h.clientY}}catch(t){s.e(t)}finally{s.f()}c/=a.targetTouches.length,f/=a.targetTouches.length,n.zoom(r,n.pixToGeoX(c),n.pixToGeoY(f))}}u=e})).on("start",(function(t){n.canvasSave.c=document.createElement("canvas"),n.canvasSave.c.setAttribute("width",""+n.w),n.canvasSave.c.setAttribute("height",""+n.h),n.canvasSave.c.getContext("2d").drawImage(n.canvas,0,0),n.canvasSave.dx=0,n.canvasSave.dy=0,n.canvasSave.f=1,n.onZoomStartFun&&n.onZoomStartFun()})).on("end",(function(t){n.redraw(!0),n.canvasSave={c:null,dx:0,dy:0,f:1},n.onZoomEndFun&&n.onZoomEndFun()}));l(bt(this.canvas)),this.zfExtent=[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}var e,n,r;return e=t,r=[{key:"getParameterByName",value:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return e?decodeURIComponent(e[1].replace(/\+/g," ")):null}}],(n=[{key:"setCenter",value:function(t){this.center=t}},{key:"getCenter",value:function(){return this.center}},{key:"setZf",value:function(t){this.zf=t,this.slider&&this.slider.attr("value",+this.zf)}},{key:"getZf",value:function(){return this.zf}},{key:"setZfExtent",value:function(t){this.zfExtent=t}},{key:"getZfExtent",value:function(){return this.zfExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.getZf(),e=-this.center.x/this.getZf()+.5*this.w,n=this.center.y/this.getZf()+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.getZf()),e=2/(this.h*this.getZf());return[t,0,0,0,e,0,-t*this.center.x,-e*this.center.y,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"white";this.ctx&&(this.ctx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h)}},{key:"pan",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.center.x+=t,this.center.y+=e,this.updateExtentGeo(),this.canvasSave.c&&(this.canvasSave.dx-=t/this.getZf(),this.canvasSave.dy+=e/this.getZf(),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy))}},{key:"zoom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.center.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.center.y;if(!(this.zfExtent[0]==this.getZf()&&t<=1||this.zfExtent[1]==this.getZf()&&t>=1)){var 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());var o=(e-this.center.x)*(1-t);this.center.x+=o;var i=(n-this.center.y)*(1-t);this.center.y+=i,this.updateExtentGeo(),this.canvasSave.c&&(this.clear(this.backgroundColor),this.canvasSave.f/=t,this.canvasSave.dx=this.geoToPixX(e)*(1-this.canvasSave.f),this.canvasSave.dy=this.geoToPixY(n)*(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))}}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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}},{key:"toDraw",value:function(t){return!(t.x<this.extGeo.xMin||t.x>this.extGeo.xMax||t.y<this.extGeo.yMin||t.y>this.extGeo.yMax)}},{key:"geoToPixX",value:function(t){return(t-this.center.x)/this.getZf()+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.center.y)/this.getZf()+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.getZf()+this.center.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.getZf()+this.center.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z"),o=this.getCenter();null==e||null==e||isNaN(+e)||(o.x=+e),null==n||null==n||isNaN(+n)||(o.y=+n),null==r||null==r||isNaN(+r)||this.setZf(+r)}},{key:"addZoomSlider",value:function(t,e){(e=e||{}).width=e.width||"30px",e.height=e.height||"300px";var n=bt("#"+t);if(n.empty())return console.error("Could not find div element to build zoom slider. Id: "+t),this;var r=this;return this.slider=n.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){var e=+this.value;bt(this).attr("value",e),r.setZf(e),r.redraw()}})).style("width",e.width).style("height",e.height).style("opacity",.7).on("mouseover",(function(t){bt(this).style("opacity",1)})).on("mouseout",(function(t){bt(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}}])&&Hn(e.prototype,n),r&&Hn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Jn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Qn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qn(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Qn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function tr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function er(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var nr=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};tr(this,t),r=r||{},this.url=e,this.resolution=n,this.preprocess=r.preprocess||void 0,this.cellsViewCache=[]}var e,n,r;return e=t,(n=[{key:"getData",value:function(t,e){throw new Error("Method getData not implemented.")}},{key:"updateViewCache",value:function(t){throw new Error("Method updateViewCache not implemented.")}},{key:"getCellFromPosition",value:function(t,e){var n,r=this.getResolution(),o=r*Math.floor(t.x/r),i=r*Math.floor(t.y/r),a=Jn(e);try{for(a.s();!(n=a.n()).done;){var u=n.value;if(u.x==o&&u.y==i)return u}}catch(t){a.e(t)}finally{a.f()}}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}}])&&er(e.prototype,n),r&&er(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function rr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return or(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return or(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ir(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ar(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var ur=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(ir(this,t),r=r||{},this.datasetComponents=e,this.resolutions=n,this.datasetComponents.length>1&&this.datasetComponents.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasetComponents.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)}var e,n,r;return e=t,r=[{key:"make",value:function(e,n,r){var o,i=[],a=rr(e);try{for(a.s();!(o=a.n()).done;){var u=o.value;i.push(n(u))}}catch(t){a.e(t)}finally{a.f()}return new t(i,e,r)}}],(n=[{key:"setPrepocesses",value:function(t){var e,n=rr(this.datasetComponents);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&ar(e.prototype,n),r&&ar(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function lr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var cr=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.id=e.id,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.background=e.background||"none",this.padding=e.padding||"5px",this.border=e.border||"0px",this["border-radius"]=e["border-radius"]||"none",this["box-shadow"]=e["box-shadow"]||"none",this["font-family"]=e["font-family"]||"Helvetica, Arial, sans-serif",this.id&&(this.div=bt("#"+this.id)),this.div&&!this.div.empty()||(this.div=bt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this.div.style("background",this.background).style("padding",this.padding).style("border",this.border).style("border-radius",this["border-radius"]).style("box-shadow",this["box-shadow"]).style("font-family",this["font-family"])}var e,n,r;return e=t,(n=[{key:"update",value:function(t){console.error("Legend update not implemented yet.")}}])&&lr(e.prototype,n),r&&lr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function fr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return sr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sr(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function sr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function hr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var yr=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.offset=e.offset||function(t,e,n){return{dx:0,dy:0}},this.minZoom=e.minZoom||0,this.maxZoom=e.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=[]}var e,n,r;return e=t,r=[{key:"getStatistics",value:function(t,e,n){if(t&&0!=t.length){var r,o=1/0,i=-1/0,a=fr(t);try{for(a.s();!(r=a.n()).done;){var u=+e(r.value);n&&!u||(u<o&&(o=u),u>i&&(i=u))}}catch(t){a.e(t)}finally{a.f()}return{min:o,max:i}}}}],(n=[{key:"draw",value:function(t,e,n){throw new Error("Method draw not implemented.")}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){var e,n=fr(this.legends);try{for(n.s();!(e=n.n()).done;)e.value.update(t)}catch(t){n.e(t)}finally{n.f()}return this}}])&&hr(e.prototype,n),r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function pr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var dr=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(pr(this,t),r=r||{},this.dataset=e,this.styles=n,this.visible=0!=r.visible,this.minZoom=r.minZoom||0,this.maxZoom=r.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.pixNb=r.pixNb||3,this.cellInfoHTML=r.cellInfoHTML||t.defaultCellInfoHTML}var e,n,r;return e=t,r=[{key:"defaultCellInfoHTML",value:function(t){for(var e=[],n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];"x"!==o&&"y"!==o&&e.push("<b>",o,"</b>"," : ",t[o],"<br>")}return e.join("")}}],(n=[{key:"getDatasetComponent",value:function(t){if(!(t<this.minZoom||t>this.maxZoom)){if(1==this.dataset.datasetComponents.length)return this.dataset.datasetComponents[0];for(var e=this.dataset.resolutions,n=0,r=e[n]/this.pixNb;r<t&&n<e.length;)r=e[++n]/this.pixNb;return n==e.length?this.dataset.datasetComponents[e.length-1]:this.dataset.datasetComponents[n]}}}])&&vr(e.prototype,n),r&&vr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function gr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function br(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var mr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;gr(this,t),e=e||{},this.div=e.div||"tooltip_eurostat",this.maxWidth=e.maxWidth||"20em",this.fontSize=e.fontSize||"1.2em",this.background=e.background||"white",this.padding=e.padding||"5px",this.border=e.border||"0px",this["border-radius"]=e["border-radius"]||"5px",this["box-shadow"]=e["box-shadow"]||"5px 5px 5px grey",this["font-family"]=e["font-family"]||"Helvetica, Arial, sans-serif",this.transitionDuration=e.transitionDuration||100,this.xOffset=e.xOffset||30,this.yOffset=e.yOffset||20,this.tooltip=bt("#"+this.div),this.tooltip.empty()&&(this.tooltip=bt("body").append("div").attr("id",this.div)),this.tooltip.style("max-width",this.maxWidth),this.tooltip.style("overflow","hidden"),this.tooltip.style("font-size",this.fontSize),this.tooltip.style("background",this.background),this.tooltip.style("padding",this.padding),this.tooltip.style("border",this.border),this.tooltip.style("border-radius",this["border-radius"]),this.tooltip.style("box-shadow",this["box-shadow"]),this.tooltip.style("font-family",this["font-family"]),this.tooltip.style("position","absolute"),this.tooltip.style("pointer-events","none"),this.tooltip.style("opacity","0")}var e,n,r;return e=t,(n=[{key:"show",value:function(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",1)}},{key:"hide",value:function(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",0)}},{key:"html",value:function(t){this.tooltip.html(t)}},{key:"setPosition",value:function(t){this.tooltip.style("left",t.pageX+this.xOffset+"px").style("top",t.pageY-this.yOffset+"px")}},{key:"style",value:function(t,e){return 1==arguments.length?this.tooltip.style(t):(this.tooltip.style(t,e),this)}},{key:"attr",value:function(t,e){return 1==arguments.length?this.tooltip.attr(t):(this.tooltip.attr(t,e),this)}}])&&br(e.prototype,n),r&&br(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),wr={},xr={};function Sr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function _r(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Or(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Cr(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),o=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Or(-e,6):e>9999?"+"+Or(e,6):Or(e,4))+"-"+Or(t.getUTCMonth()+1,2)+"-"+Or(t.getUTCDate(),2)+(i?"T"+Or(n,2)+":"+Or(r,2)+":"+Or(o,2)+"."+Or(i,3)+"Z":o?"T"+Or(n,2)+":"+Or(r,2)+":"+Or(o,2)+"Z":r||n?"T"+Or(n,2)+":"+Or(r,2)+"Z":"")}var kr=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,o=[],i=t.length,a=0,u=0,l=i<=0,c=!1;function f(){if(l)return xr;if(c)return c=!1,wr;var e,r,o=a;if(34===t.charCodeAt(o)){for(;a++<i&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=i?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(o+1,e-1).replace(/""/g,'"')}for(;a<i;){if(10===(r=t.charCodeAt(e=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(o,e)}return l=!0,t.slice(o,i)}for(10===t.charCodeAt(i-1)&&--i,13===t.charCodeAt(i-1)&&--i;(r=f())!==xr;){for(var s=[];r!==wr&&r!==xr;)s.push(r),r=f();e&&null==(s=e(s,u++))||o.push(s)}return o}function o(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function i(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Cr(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,o,i=r(t,(function(t,r){if(n)return n(t,r-1);o=t,n=e?function(t,e){var n=Sr(t);return function(r,o){return e(n(r),o,t)}}(t,e):Sr(t)}));return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=_r(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=_r(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}},Pr=kr(","),jr=Pr.parse,Ar=(Pr.parseRows,Pr.format,Pr.formatBody,Pr.formatRows,Pr.formatRow,Pr.formatValue,kr("\t")),Er=Ar.parse;Ar.parseRows,Ar.format,Ar.formatBody,Ar.formatRows,Ar.formatRow,Ar.formatValue;function Mr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}var Tr=function(t,e){return fetch(t,e).then(Mr)};function Rr(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),Tr(e,n).then((function(e){return t(e,r)}))}}var zr=Rr(jr);Rr(Er);function Fr(t){return(Fr="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})(t)}function Ir(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Lr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lr(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Lr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Nr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Br(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Dr(t,e){return(Dr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Zr(t){var e=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}}();return function(){var n,r=Wr(t);if(e){var o=Wr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ur(this,n)}}function Ur(t,e){if(e&&("object"===Fr(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Wr(t){return(Wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Gr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dr(t,e)}(i,t);var e,n,r,o=Zr(i);function i(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Nr(this,i),(n=o.call(this,t,e,r)).cells=[],n.infoLoadingStatus="notLoaded",n}return e=i,(n=[{key:"getData",value:function(t,e){var n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",zr(this.url).then((function(t){var r,o=Ir(t);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.x=+i.x,i.y=+i.y}}catch(t){o.e(t)}finally{o.f()}if(n.preprocess){n.cells=[];var a,u=Ir(t);try{for(u.s();!(a=u.n()).done;){var l=a.value;0!=n.preprocess(l)&&n.cells.push(l)}}catch(t){u.e(t)}finally{u.f()}}else n.cells=t;e&&e(),n.infoLoadingStatus="loaded"})).catch((function(){n.infoLoadingStatus="failed",n.cells=[]}))),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Ir(this.cells);try{for(n.s();!(e=n.n()).done;){var r=e.value;+r.x+this.resolution<t.xMin||+r.x-this.resolution>t.xMax||+r.y+this.resolution<t.yMin||+r.y-this.resolution>t.yMax||this.cellsViewCache.push(r)}}catch(t){n.e(t)}finally{n.f()}}}}])&&Br(e.prototype,n),r&&Br(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(nr);function $r(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}var Yr=function(t,e){return fetch(t,e).then($r)};function Vr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Xr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xr(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Xr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function qr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Hr(t,e,n){return e&&qr(t.prototype,e),n&&qr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var Kr=Hr((function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cells=e,this.x=n,this.y=r;var i=o.resolutionGeo,a=o.tileSizeCell;this.extGeo={xMin:o.originPoint.x+i*a*this.x,xMax:o.originPoint.x+i*a*(this.x+1),yMin:o.originPoint.y+i*a*this.y,yMax:o.originPoint.y+i*a*(this.y+1)};var u,l=Vr(this.cells);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.x=this.extGeo.xMin+c.x*i,c.y=this.extGeo.yMin+c.y*i}}catch(t){l.e(t)}finally{l.f()}}));function Jr(t){return(Jr="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})(t)}function Qr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return to(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return to(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function to(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function eo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function no(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ro(t,e){return(ro=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function oo(t){var e=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}}();return function(){var n,r=ao(t);if(e){var o=ao(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return io(this,n)}}function io(t,e){if(e&&("object"===Jr(e)||"function"==typeof e))return e;if(void 0!==e)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)}function ao(t){return(ao=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var uo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ro(t,e)}(i,t);var e,n,r,o=oo(i);function i(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return eo(this,i),(n=o.call(this,t,0,r)).app=e,n.info=void 0,n.infoLoadingStatus="notLoaded",n.cache={},n}return e=i,(n=[{key:"loadInfo",value:function(t){var e=this;return this.info||"notLoaded"!==this.infoLoadingStatus?!t||"loaded"!==this.infoLoadingStatus&&"failed"!==this.infoLoadingStatus||t():(this.infoLoadingStatus="loading",Yr(this.url+"info.json").then((function(n){e.info=n,e.resolution=n.resolutionGeo,e.infoLoadingStatus="loaded",t&&t()})).catch((function(){e.infoLoadingStatus="failed"}))),this}},{key:"getTilingEnvelope",value:function(t){if(this.info){var e=this.info.originPoint,n=this.info.resolutionGeo,r=this.info.tileSizeCell;return{xMin:Math.floor((t.xMin-e.x)/(n*r)),xMax:Math.floor((t.xMax-e.x)/(n*r)),yMin:Math.floor((t.yMin-e.y)/(n*r)),yMax:Math.floor((t.yMax-e.y)/(n*r))}}this.loadInfo((function(){}))}},{key:"getData",value:function(t,e){var n=this;if(!this.info)return this;var r=this.getTilingEnvelope(t);if(!r)return this;for(var o=this.info.tilingBounds,i=function(t){for(var i=function(r){if(n.cache[t]||(n.cache[t]={}),n.cache[t][r])return"continue";n.cache[t][r]="loading",zr(n.url+t+"/"+r+".csv").then((function(o){var i;if(n.preprocess){i=[];var a,u=Qr(o);try{for(u.s();!(a=u.n()).done;){var l=a.value;0!=n.preprocess(l)&&i.push(l)}}catch(t){u.e(t)}finally{u.f()}}else i=o;if(n.info){var c=new Kr(i,t,r,n.info);if(n.cache[t][r]=c,e){var f,s=!1,h=Qr(n.app.getActiveLayers());try{for(h.s();!(f=h.n()).done;)if(f.value.getDatasetComponent(n.app.getZoomFactor())==n){s=!0;break}}catch(t){h.e(t)}finally{h.f()}if(s){var y=n.app.updateExtentGeo(),p=c.extGeo;y.xMax<=p.xMin||y.xMin>=p.xMax||y.yMax<=p.yMin||y.yMin>=p.yMax||e()}}}else console.error("Tile info inknown")})).catch((function(){n.cache[t][r]="failed"}))},a=Math.max(r.yMin,o.yMin);a<=Math.min(r.yMax,o.yMax);a++)i(a)},a=Math.max(r.xMin,o.xMin);a<=Math.min(r.xMax,o.xMax);a++)i(a);return this}},{key:"updateViewCache",value:function(t){if(this.cellsViewCache=[],this.info){var e=this.getTilingEnvelope(t);if(e)for(var n=this.info.tilingBounds,r=Math.max(e.xMin,n.xMin);r<=Math.min(e.xMax,n.xMax);r++)if(this.cache[r])for(var o=Math.max(e.yMin,n.yMin);o<=Math.min(e.yMax,n.yMax);o++){var i=this.cache[r][o];if(i&&"string"!=typeof i){var a,u=Qr(i.cells);try{for(u.s();!(a=u.n()).done;){var l=a.value;+l.x+this.resolution<t.xMin||+l.x-this.resolution>t.xMax||+l.y+this.resolution<t.yMin||+l.y-this.resolution>t.yMax||this.cellsViewCache.push(l)}}catch(t){u.e(t)}finally{u.f()}}}}}}])&&no(e.prototype,n),r&&no(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(nr);function lo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var co=function(){function t(e){var n=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.visible=0!=e.visible,this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");if(this.cache={},this.url=e.url,this.urlFun=e.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},this.resolutions=e.resolutions,!this.resolutions||0==this.resolutions.length)throw new Error("No resolutions provided for background layer");this.nbPix=e.nbPix||256,this.origin=e.origin||[0,0],this.z0=e.z0||0,this.filterColor=e.filterColor}var e,n,r;return e=t,(n=[{key:"get",value:function(t,e,n){var r=this.cache[t];if(r&&(r=r[e]))return r[n]}},{key:"put",value:function(t,e,n,r){this.cache[e]||(this.cache[e]={}),this.cache[e][n]||(this.cache[e][n]={}),this.cache[e][n][r]=t}},{key:"draw",value:function(t){var e=this;if(this.resolutions&&0!=this.resolutions.length){var n=t.getZf(),r=this.origin[0],o=this.origin[1],i=0;for(i=0;i<this.resolutions.length&&!(this.resolutions[i]<n);i++);i-=1,i=Math.max(0,i),i=Math.min(i,this.resolutions.length-1);var a=this.resolutions[i];i+=this.z0;for(var u=this.nbPix*a,l=u/n,c=function(t){return Math.ceil((t-r)/u)},f=function(t){return Math.ceil(-(t-o)/u)},s=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),y=f(t.extGeo.yMin),p=f(t.extGeo.yMax)-1,v=function(n){for(var a=function(a){var c=e.get(i,n,a);if(!c){var f=new Image;return e.put(f,i,n,a),f.onload=function(){t.redraw()},f.onerror=function(){e.put("failed",i,n,a)},f.src=e.urlFun(n,a,i),"continue"}if("failed"===c)return"continue";if(!(c instanceof HTMLImageElement))return console.log(c),"continue";var s=r+n*u,h=o-a*u;t.ctx.drawImage(c,t.geoToPixX(s),t.geoToPixY(h),l,l)},c=p;c<y;c++)a(c)},d=s;d<h;d++)v(d);if(this.filterColor){var g=this.filterColor(n);g&&"none"!=g&&(t.ctx.fillStyle=g,t.ctx.fillRect(0,0,t.w,t.h))}}else console.error("No resolutions provided for background layer")}}])&&lo(e.prototype,n),r&&lo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function fo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return so(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return so(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function so(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ho(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var yo=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.url=e.url,this.style=e.style||function(){return"bold 1em Arial"},this.color=e.color||(e.dark?function(){return"#ddd"}:function(){return"#222"}),this.haloColor=e.haloColor||(e.dark?function(){return"#000000BB"}:function(){return"#FFFFFFBB"}),this.haloWidth=e.haloWidth||function(){return 4},this.textAlign=e.textAlign||"start",this.offsetPix=e.offsetPix||[5,5],this.preprocess=e.preprocess,this.labels,this.loadingStatus="notLoaded"}var e,n,r;return e=t,(n=[{key:"draw",value:function(t){if(this.labels){var e=t.getZf();t.ctx.textAlign=this.textAlign||"start",t.initCanvasTransform();var n,r=fo(this.labels);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=this.style(o,e);if(i&&(t.ctx.font=i,t.toDraw(o))){var a=t.geoToPixX(o.x)+this.offsetPix[0],u=t.geoToPixY(o.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var l=this.haloColor(o,e),c=this.haloWidth(o,e);l&&c&&c>0&&(t.ctx.strokeStyle=l,t.ctx.lineWidth=c,t.ctx.strokeText(o.name,a,u))}if(this.color){var f=this.color(o,e);f&&(t.ctx.fillStyle=f,t.ctx.fillText(o.name,a,u))}}}}catch(t){r.e(t)}finally{r.f()}}else this.load(t.redraw)}},{key:"load",value:function(t){var e=this;if(!this.url)return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",void(this.labels=[]);"notLoaded"===this.loadingStatus&&(this.loadingStatus="loading",zr(this.url).then((function(n){if(e.preprocess){var r,o=fo(n);try{for(o.s();!(r=o.n()).done;){var i=r.value;e.preprocess(i)}}catch(t){o.e(t)}finally{o.f()}}e.labels=n,e.loadingStatus="loaded",t&&t()})).catch((function(){console.log("Failed loading labels from "+e.url),e.labels=[],e.loadingStatus="failed"})))}}])&&ho(e.prototype,n),r&&ho(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function po(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return vo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vo(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function vo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function go(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var bo=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.url=e.url,this.preprocess=e.preprocess,this.color=e.color||function(t,e){return"gray"},this.width=e.width||function(t,e){return 2},this.lineDash=e.lineDash||function(t,e){},this.fs,this.loadingStatus="notLoaded"}var e,n,r;return e=t,(n=[{key:"draw",value:function(t){if(this.fs){var e=t.getZf();t.setCanvasTransform();var n,r=po(this.fs);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=o.geometry.coordinates;if(!(i.length<2)){var a=this.color(o,e);if(a&&"none"!=a){t.ctx.strokeStyle=a;var u=this.width(o,e);if(u&&!(u<0)){t.ctx.lineWidth=u*e;var l=this.lineDash(o,e);l&&t.ctx.setLineDash(l),t.ctx.beginPath(),t.ctx.moveTo(i[0][0],i[0][1]);for(var c=1;c<i.length;c++)t.ctx.lineTo(i[c][0],i[c][1]);t.ctx.stroke()}}}}}catch(t){r.e(t)}finally{r.f()}t.ctx.setLineDash([])}else this.load(t.redraw)}},{key:"load",value:function(t){var e=this;if(!this.url)return console.log("Failed loading boundaries: No URL specified. "+this.url),this.loadingStatus="failed",void(this.labels=[]);"notLoaded"===this.loadingStatus&&(this.loadingStatus="loading",Yr(this.url).then((function(n){if(n=n.features,e.preprocess){var r,o=po(n);try{for(o.s();!(r=o.n()).done;){var i=r.value;e.preprocess(i)}}catch(t){o.e(t)}finally{o.f()}}e.fs=n,e.loadingStatus="loaded",t&&t()})).catch((function(){console.log("Failed loading boundaries from "+e.url),e.fs=[],e.loadingStatus="failed"})))}}])&&go(e.prototype,n),r&&go(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function mo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return wo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wo(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function wo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function xo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var So=function(){function t(e,n){var r=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=n||{},this.layers=[],e=e||document.getElementById("gridviz")){this.w=n.w||e.offsetWidth,this.h=n.h||e.offsetHeight;var o=document.createElement("canvas");o.setAttribute("width",""+this.w),o.setAttribute("height",""+this.h),e.appendChild(o),this.cg=new Kn(o),this.cg.redraw=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r.legend&&t&&r.legend.selectAll("*").remove(),r.cg.initCanvasTransform(),r.cg.clear(r.cg.backgroundColor);var e=r.getZoomFactor();r.updateExtentGeo();var n,o=mo(r.bgLayers);try{for(o.s();!(n=o.n()).done;){var i=n.value;i.visible&&(e>i.maxZoom||e<i.minZoom||i.draw(r.cg))}}catch(t){o.e(t)}finally{o.f()}var a,u=mo(r.layers);try{for(u.s();!(a=u.n()).done;){var l=a.value;if(l.visible&&!(e>l.maxZoom||e<l.minZoom)){var c=l.getDatasetComponent(e);if(c){if(t&&c.getData(r.cg.extGeo,(function(){r.cg.redraw()})),t&&c.updateViewCache(r.cg.extGeo),t){var f,s=mo(l.styles);try{for(s.s();!(f=s.n()).done;){var h=f.value;e>h.maxZoom||(e<h.minZoom||h.draw(c.getViewCache(),c.getResolution(),r.cg))}}catch(t){s.e(t)}finally{s.f()}}if(r.legend&&t){var y,p=mo(l.styles);try{for(p.s();!(y=p.n()).done;){var v=y.value;if(!(e>v.maxZoom)&&!(e<v.minZoom)){var d,g=mo(v.legends);try{for(g.s();!(d=g.n()).done;){var b=d.value;r.legend.node().append(b.div.node())}}catch(t){g.e(t)}finally{g.f()}}}}catch(t){p.e(t)}finally{p.f()}}}}}}catch(t){u.e(t)}finally{u.f()}return r.showBoundaries&&r.boundaryLayer&&r.boundaryLayer.draw(r.cg),r.showLabels&&r.labelLayer&&r.labelLayer.draw(r.cg),r.canvasSave=null,r},this.bgLayers=[],this.showBgLayers=!0,this.labelLayer=void 0,this.showLabels=!0,this.boundaryLayer=void 0,this.showBoundaries=!0,this.legendDivId=n.legendDivId||"gvizLegend",this.legend=bt("#"+this.legendDivId),this.legend.empty()&&(this.legend=bt("body").append("div").attr("id",this.legendDivId).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFFCC").style("border","0px").style("border-radius","5px").style("box-shadow","5px 5px 5px grey").style("font-family","Helvetica, Arial, sans-serif").style("top","20px").style("right","20px")),this.tooltip=new mr;var i=function(t){var e={x:r.cg.pixToGeoX(t.offsetX),y:r.cg.pixToGeoY(t.offsetY)},n=r.getCellFocusInfo(e);n?(r.tooltip.setPosition(t),r.tooltip.show(),r.tooltip.html(n.html),r.canvasSave?r.cg.ctx.drawImage(r.canvasSave,0,0):(r.canvasSave=document.createElement("canvas"),r.canvasSave.setAttribute("width",""+r.w),r.canvasSave.setAttribute("height",""+r.h),r.canvasSave.getContext("2d").drawImage(r.cg.canvas,0,0)),r.cg.initCanvasTransform(),r.cg.ctx.strokeStyle=r.selectionRectangleColor,r.cg.ctx.lineWidth=r.selectionRectangleWidthPix,r.cg.ctx.beginPath(),r.cg.ctx.rect(r.cg.geoToPixX(n.cell.x)-r.selectionRectangleWidthPix/2,r.cg.geoToPixY(n.cell.y)+r.selectionRectangleWidthPix/2,n.resolution/r.getZoomFactor()+r.selectionRectangleWidthPix,-n.resolution/r.getZoomFactor()-r.selectionRectangleWidthPix),r.cg.ctx.stroke()):(r.tooltip.hide(),r.canvasSave&&r.cg.ctx.drawImage(r.canvasSave,0,0))};e.addEventListener("mouseover",(function(t){i(t)})),e.addEventListener("mousemove",(function(t){i(t)})),e.addEventListener("mouseout",(function(){r.tooltip.hide()})),this.cg.onZoomStartFun=function(){r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"red",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||4}else console.error("Cannot find gridviz container element.")}var e,n,r;return e=t,(n=[{key:"getActiveLayers",value:function(){var t,e=[],n=this.getZoomFactor(),r=mo(this.layers);try{for(r.s();!(t=r.n()).done;){var o=t.value;o.visible&&o.getDatasetComponent(n)&&e.push(o)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"hideAllLayers",value:function(){var t,e=mo(this.layers);try{for(e.s();!(t=e.n()).done;)t.value.visible=!1}catch(t){e.e(t)}finally{e.f()}return this}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.cg.updateExtentGeo(t)}},{key:"getCellFocusInfo",value:function(t){var e=this.getActiveLayers(),n=e[e.length-1];if(n){var r=n.getDatasetComponent(this.getZoomFactor());if(r){var o=r.getCellFromPosition(t,r.getViewCache());if(o)return{cell:o,html:n.cellInfoHTML(o),resolution:r.getResolution()}}}}},{key:"getGeoCenter",value:function(){return this.cg.getCenter()}},{key:"setGeoCenter",value:function(t){return this.cg.setCenter(t),this}},{key:"getZoomFactor",value:function(){return this.cg.getZf()}},{key:"setZoomFactor",value:function(t){return this.cg.setZf(t),this}},{key:"getZoomFactorExtent",value:function(){return this.cg.getZfExtent()}},{key:"setZoomFactorExtent",value:function(t){return this.cg.setZfExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.cg.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.cg.backgroundColor=t,this}},{key:"getBoundaryLayer",value:function(){return this.boundaryLayer}},{key:"setBoundaryLayer",value:function(t){return this.boundaryLayer=new bo(t),this}},{key:"getLabelLayer",value:function(){return this.labelLayer}},{key:"setLabelLayer",value:function(t){return this.labelLayer=new yo(t),this}},{key:"redraw",value:function(){return this.cg.redraw(),this}},{key:"addLayerFromDataset",value:function(t,e,n){var r=new dr(t,e,n);return this.layers.push(r),this}},{key:"makeCSVGridDataset",value:function(t,e,n){var r=this;return new ur([new Gr(t,e,n).getData(void 0,(function(){r.cg.redraw()}))],[],n)}},{key:"makeTiledCSVGridDataset",value:function(t,e){var n=this;return new ur([new uo(t,this,e).loadInfo((function(){n.cg.redraw()}))],[],e)}},{key:"makeMultiScaleCSVGridDataset",value:function(t,e,n){var r=this;return ur.make(t,(function(t){return new Gr(e(t),t,n).getData(void 0,(function(){r.cg.redraw()}))}),n)}},{key:"makeMultiScaleTiledCSVGridDataset",value:function(t,e,n){var r=this;return ur.make(t,(function(t){return new uo(e(t),r,n).loadInfo((function(){r.cg.redraw()}))}),n)}},{key:"addCSVGridLayer",value:function(t,e,n,r){var o=this.makeCSVGridDataset(t,e,r);return this.addLayerFromDataset(o,n,r)}},{key:"addTiledCSVGridLayer",value:function(t,e,n){var r=this.makeTiledCSVGridDataset(t,n);return this.addLayerFromDataset(r,e,n)}},{key:"addMultiScaleCSVGridLayer",value:function(t,e,n,r){var o=this.makeMultiScaleCSVGridDataset(t,e,r);return this.addLayerFromDataset(o,n,r)}},{key:"addMultiScaleTiledCSVGridLayer",value:function(t,e,n,r){var o=this.makeMultiScaleTiledCSVGridDataset(t,e,r);return this.addLayerFromDataset(o,n,r)}},{key:"addBackgroundLayer",value:function(t){return this.bgLayers.push(new co(t)),this.redraw(),this}},{key:"addZoomSlider",value:function(t,e){return this.cg.addZoomSlider(t,e),this}},{key:"setViewFromURL",value:function(){return this.cg.setViewFromURL(),this}}])&&xo(e.prototype,n),r&&xo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function _o(t){return(_o="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})(t)}function Oo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Co(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Co(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Co(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ko(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Po(t,e){return(Po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function jo(t){var e=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}}();return function(){var n,r=Eo(t);if(e){var o=Eo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ao(this,n)}}function Ao(t,e){if(e&&("object"===_o(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Eo(t){return(Eo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Mo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Po(t,e)}(i,t);var e,n,r,o=jo(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.sizeCol=t.sizeCol,e.size=t.size,e.shape=t.shape||function(){return"square"},e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o,i=this,a=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[i.sizeCol]-t[i.sizeCol]})),r=yr.getStatistics(t,(function(t){return t[i.sizeCol]}),!0)),this.colorCol&&(o=yr.getStatistics(t,(function(t){return t[i.colorCol]}),!0)),n.setCanvasTransform();var u,l=.5*e,c=Oo(t);try{for(c.s();!(u=c.n()).done;){var f=u.value,s=this.color?this.color(f[this.colorCol],e,o):void 0;if(s&&"none"!==s){n.ctx.fillStyle=s;var h=this.shape?this.shape(f):"square";if("none"!==h){var y=(this.size||function(){return e})(f[this.sizeCol],e,r,a),p=this.offset(f,e,a);if("square"===h){var v=e*(1-y/e)*.5;n.ctx.fillRect(f.x+v+p.dx,f.y+v+p.dy,y,y)}else if("circle"===h)n.ctx.beginPath(),n.ctx.arc(f.x+l+p.dx,f.y+l+p.dy,.5*y,0,2*Math.PI,!1),n.ctx.fill();else if("donut"===h){var d=f.x+l+p.dx,g=f.y+l+p.dy;n.ctx.beginPath(),n.ctx.moveTo(d,g),n.ctx.arc(d,g,l,0,2*Math.PI),n.ctx.arc(d,g,(1-y/e)*l,0,2*Math.PI,!0),n.ctx.closePath(),n.ctx.fill()}else{if("diamond"!==h)throw new Error("Unexpected shape:"+h);var b=.5*y;n.ctx.beginPath(),n.ctx.moveTo(f.x+l-b,f.y+l),n.ctx.lineTo(f.x+l,f.y+l+b),n.ctx.lineTo(f.x+l+b,f.y+l),n.ctx.lineTo(f.x+l,f.y+l-b),n.ctx.fill()}}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:a,sSize:r,sColor:o})}}])&&ko(e.prototype,n),r&&ko(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function To(t){return(To="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})(t)}function Ro(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return zo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zo(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function zo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Fo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Io(t,e){return(Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Lo(t){var e=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}}();return function(){var n,r=Bo(t);if(e){var o=Bo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return No(this,n)}}function No(t,e){if(e&&("object"===To(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Bo(t){return(Bo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Do=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Io(t,e)}(i,t);var e,n,r,o=Lo(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.strokeColorCol=t.strokeColorCol,e.strokeColor=t.strokeColor||function(){return"#666"},e.sizeCol=t.sizeCol,e.size=t.size,e.strokeWidthCol=t.strokeWidthCol,e.strokeWidth=t.strokeWidth,e.shape=t.shape||function(){return"square"},e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o,i,a=this,u=n.getZf();this.strokeColorCol&&(r=yr.getStatistics(t,(function(t){return t[a.strokeColorCol]}),!0)),this.sizeCol&&(o=yr.getStatistics(t,(function(t){return t[a.sizeCol]}),!0)),this.strokeWidthCol&&(i=yr.getStatistics(t,(function(t){return t[a.strokeWidthCol]}),!0)),n.setCanvasTransform();var l,c=.5*e,f=Ro(t);try{for(f.s();!(l=f.n()).done;){var s=l.value,h=this.strokeColor?this.strokeColor(s[this.strokeColorCol],e,r):void 0;if(h&&"none"!==h){n.ctx.strokeStyle=h;var y=(this.size||function(){return e})(s[this.sizeCol],e,o,u),p=this.strokeWidth?this.strokeWidth(s[this.strokeWidthCol],e,i,u):1*u;if(p&&!(p<=0)){n.ctx.lineWidth=p;var v=this.shape?this.shape(s):"square";if("none"!==v){var d=this.offset(s,e,u);if("square"===v){var g=e*(1-y/e)*.5;n.ctx.beginPath(),n.ctx.rect(s.x+g+d.dx,s.y+g+d.dy,y,y),n.ctx.stroke()}else if("circle"===v)n.ctx.beginPath(),n.ctx.arc(s.x+c+d.dx,s.y+c+d.dy,.5*y,0,2*Math.PI,!1),n.ctx.stroke();else if("diamond"===v){var b=.5*y;n.ctx.beginPath(),n.ctx.moveTo(s.x+c-b,s.y+c),n.ctx.lineTo(s.x+c,s.y+c+b),n.ctx.lineTo(s.x+c+b,s.y+c),n.ctx.lineTo(s.x+c,s.y+c-b),n.ctx.lineTo(s.x+c-b,s.y+c),n.ctx.stroke()}else{if("donut"!==v)throw new Error("Unexpected shape:"+v);console.error("Not implemented")}}}}}}catch(t){f.e(t)}finally{f.f()}}}])&&Fo(e.prototype,n),r&&Fo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Zo(t){return(Zo="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})(t)}function Uo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Wo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wo(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Wo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Go(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $o(t,e){return($o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Yo(t){var e=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}}();return function(){var n,r=Xo(t);if(e){var o=Xo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Vo(this,n)}}function Vo(t,e){if(e&&("object"===Zo(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Xo(t){return(Xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var qo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$o(t,e)}(i,t);var e,n,r,o=Yo(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.heightCol=t.heightCol,e.height=t.height||function(t){return Math.sqrt(t)},e.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},e.lineWidth=t.lineWidth||function(t,e,n,r){return r},e.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r=this;n.ctx.lineJoin="round";var o,i=n.getZf(),a=yr.getStatistics(t,(function(t){return t[r.heightCol]}),!0),u={},l=Uo(t);try{for(l.s();!(o=l.n()).done;){var c=o.value,f=u[c.y];f||(f={},u[c.y]=f),f[c.x]=this.height(c[this.heightCol],e,a,i)}}catch(t){l.e(t)}finally{l.f()}var s=n.extGeo;if(s){var h=Math.floor(s.xMin/e)*e,y=Math.floor(s.xMax/e)*e,p=Math.floor(s.yMin/e)*e,v=Math.floor(s.yMax/e)*e,d={min:p,max:v};n.setCanvasTransform();for(var g=v;g>=p;g-=e){var b=u[g];if(b){n.ctx.beginPath(),n.ctx.moveTo(h-e/2,g);for(var m=void 0,w=h;w<=y;w+=e){var x=b[w];x||(x=0),x||m?n.ctx.lineTo(w+e/2,g+x):n.ctx.moveTo(w+e/2,g),m=x}m&&n.ctx.lineTo(y+e/2,g);var S=this.fillColor(g,d,e,i);S&&"none"!=S&&(n.ctx.fillStyle=S,n.ctx.fill());var _=this.lineColor(g,d,e,i),O=this.lineWidth(g,d,e,i);_&&"none"!=_&&O>0&&(n.ctx.strokeStyle=_,n.ctx.lineWidth=O,n.ctx.stroke())}}}}}])&&Go(e.prototype,n),r&&Go(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Ho(t){return(Ho="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})(t)}function Ko(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(t,e)||Jo(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jo(t,e){if(t){if("string"==typeof t)return Qo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qo(t,e):void 0}}function Qo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ti(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ei(t,e){return(ei=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ni(t){var e=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}}();return function(){var n,r=oi(t);if(e){var o=oi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ri(this,n)}}function ri(t,e){if(e&&("object"===Ho(e)||"function"==typeof e))return e;if(void 0!==e)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)}function oi(t){return(oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ii=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ei(t,e)}(i,t);var e,n,r,o=ni(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.color=t.color,e.type=t.type,e.sizeCol=t.sizeCol,e.size=t.size||function(t,e,n,r){return e},e.stripesOrientation=t.stripesOrientation||function(){return 0},e.offsetAngle=t.offsetAngle||function(){return 0},e.agePyramidHeight=t.agePyramidHeight||function(t,e,n){return e},e.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o=this,i=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[o.sizeCol]-t[o.sizeCol]})),r=yr.getStatistics(t,(function(t){return t[o.sizeCol]}),!0));var a=Object.entries(this.color).length;n.setCanvasTransform();var u,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Jo(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(u=l.n()).done;){var c=u.value,f=(this.size||function(){return e})(c[this.sizeCol],e,r,i),s=this.offset(c,e,i),h=this.type?this.type(c):"flag",y=c.x+s.dx+("agepyramid"===h?0:.5*e),p=c.y+s.dy+("agepyramid"===h?0:.5*e);if("agepyramid"===h||"radar"===h||"halftone"===h){for(var v=-1/0,d=0,g=Object.keys(this.color);d<g.length;d++){var b=+c[g[d]];b>v&&(v=b)}var m=0;"agepyramid"===h&&this.agePyramidHeight&&(m=(e-this.agePyramidHeight(c,e,i))/2),"radar"!==h&&"halftone"!==h||(m=Math.PI/2+(this.offsetAngle?this.offsetAngle(c,e,i)*Math.PI/180:0));var w="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,e,i):e)/a:"radar"===h||"halftone"===h?2*Math.PI/a:void 0;if(void 0===w)throw new Error("Unexpected symbol type:"+h);for(var x=0,S=Object.entries(this.color);x<S.length;x++){var _=Ko(S[x],2),O=_[0],C=_[1];if("agepyramid"===h){n.ctx.fillStyle=C;var k=f*c[O]/v;n.ctx.fillRect(y+(e-k)/2,p+m,k,w),m+=w}else if("radar"===h){n.ctx.fillStyle=C;var P=c[O],j=f/2*Math.sqrt(P/v);n.ctx.beginPath(),n.ctx.moveTo(y,p),n.ctx.arc(y,p,j,m-w,m),n.ctx.lineTo(y,p),n.ctx.fill(),m+=w}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);n.ctx.fillStyle=C;var A=c[O],E=.333*f*Math.sqrt(A/v);n.ctx.beginPath(),n.ctx.arc(y+.25*e*Math.cos(m),p+.25*e*Math.sin(m),E,0,2*Math.PI),n.ctx.fill(),m+=w}}}else{for(var M=0,T=0,R=Object.keys(this.color);T<R.length;T++){var z=+c[R[T]];z&&(M+=z)}if(!M||isNaN(M))continue;for(var F=0,I=e*(1-f/e)*.5,L=this.stripesOrientation(c,e,i),N=0,B=Object.entries(this.color);N<B.length;N++){var D=Ko(B[N],2),Z=D[0],U=D[1],W=c[Z]/M;if(W&&!isNaN(W)){if(n.ctx.fillStyle=U,"flag"===h)0==L?n.ctx.fillRect(c.x+I+s.dx,c.y+I+F*f+s.dy,f,W*f):n.ctx.fillRect(c.x+I+F*f+s.dx,c.y+I+s.dy,W*f,f);else if("piechart"===h){var G=2*F*Math.PI,$=2*(F+W)*Math.PI;n.ctx.beginPath(),n.ctx.moveTo(y,p),n.ctx.arc(y,p,.5*f,G,$),this.pieChartInternalRadiusFactor&&n.ctx.arc(y,p,.5*f*this.pieChartInternalRadiusFactor,G,$,!0),n.ctx.closePath(),n.ctx.fill()}else if("ring"===h)n.ctx.beginPath(),n.ctx.arc(y,p,Math.sqrt(1-F)*f*.5,0,2*Math.PI),n.ctx.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var Y=f*f/e;0==L?n.ctx.fillRect(c.x+s.dx,c.y+(e-Y)/2+F*Y+s.dy,e,W*Y):n.ctx.fillRect(c.x+F*e+s.dx,c.y+(e-Y)/2+s.dy,W*e,Y)}F+=W}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,r:e,zf:i,sSize:r})}}])&&ti(e.prototype,n),r&&ti(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function ai(t){return(ai="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})(t)}function ui(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return li(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return li(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function li(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ci(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function fi(t,e){return(fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function si(t){var e=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}}();return function(){var n,r=yi(t);if(e){var o=yi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return hi(this,n)}}function hi(t,e){if(e&&("object"===ai(e)||"function"==typeof e))return e;if(void 0!==e)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)}function yi(t){return(yi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var pi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fi(t,e)}(i,t);var e,n,r,o=si(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.orientation=t.orientation||function(){return 0},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.lengthCol=t.lengthCol,e.length=t.length,e.widthCol=t.widthCol,e.width=t.width,e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o,i,a=this,u=n.getZf();this.colorCol&&(r=yr.getStatistics(t,(function(t){return t[a.colorCol]}),!0)),this.lengthCol&&(t.sort((function(t,e){return e[a.lengthCol]-t[a.lengthCol]})),o=yr.getStatistics(t,(function(t){return t[a.lengthCol]}),!0)),this.widthCol&&(i=yr.getStatistics(t,(function(t){return t[a.widthCol]}),!0)),n.ctx.lineCap="butt";var l=Math.PI/180;n.setCanvasTransform();var c,f=ui(t);try{for(f.s();!(c=f.n()).done;){var s=c.value,h=this.color?this.color(s[this.colorCol],e,r):void 0;if(h){var y=this.width?this.width(s[this.widthCol],e,i,u):void 0;if(y&&!(y<0)){var p=this.length?this.length(s[this.lengthCol],e,o,u):void 0;if(p&&!(p<0)){var v=this.orientation(s)*l;if(void 0!==v&&!isNaN(v)){var d=this.offset(s,e,u);n.ctx.strokeStyle=h,n.ctx.lineWidth=y;var g=s.x+e/2+d.dx,b=s.y+e/2+d.dy,m=.5*Math.cos(v)*p,w=.5*Math.sin(v)*p;n.ctx.beginPath(),n.ctx.moveTo(g-m,b-w),n.ctx.lineTo(g+m,b+w),n.ctx.stroke()}}}}}}catch(t){f.e(t)}finally{f.f()}this.updateLegends({style:this,r:e,zf:u,sColor:r,sLength:o,sWidth:i})}}])&&ci(e.prototype,n),r&&ci(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function vi(t){return(vi="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})(t)}function di(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return gi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gi(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function gi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function bi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function mi(t,e){return(mi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function wi(t){var e=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}}();return function(){var n,r=Si(t);if(e){var o=Si(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return xi(this,n)}}function xi(t,e){if(e&&("object"===vi(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Si(t){return(Si=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var _i=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mi(t,e)}(i,t);var e,n,r,o=wi(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.textCol=t.textCol,e.text=t.text||function(t,e,n,r){return"X"},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.fontSizeCol=t.fontSizeCol,e.fontSize=t.fontSize||function(t,e,n,r){return e-2},e.fontFamily=t.fontFamily||"Arial",e.fontWeight=t.fontWeight||"bold",e}return e=i,r=[{key:"getCharLegendFun",value:function(t){var e=t.length;return function(n){return 0==n?"":1==n?t[e-1]:t[Math.floor(n*e)]}}}],(n=[{key:"draw",value:function(t,e,n){var r,o,i,a=this,u=n.getZf();this.textCol&&(r=yr.getStatistics(t,(function(t){return t[a.textCol]}),!0)),this.colorCol&&(o=yr.getStatistics(t,(function(t){return t[a.colorCol]}),!0)),this.fontSizeCol&&(t.sort((function(t,e){return e[a.fontSizeCol]-t[a.fontSizeCol]})),i=yr.getStatistics(t,(function(t){return t[a.fontSizeCol]}),!0));var l,c=di(t);try{for(c.s();!(l=c.n()).done;){var f=l.value,s=this.text?this.text(f[this.textCol],e,r):void 0;if(s){var h=this.color?this.color(f[this.colorCol],e,o):void 0;if(h){n.ctx.fillStyle=h;var y=(this.fontSize||function(){return e/u-2})(f[this.fontSizeCol],e,i,u)/u,p=this.fontFamily||"Arial",v=this.fontWeight||"bold";n.ctx.font=v+" "+y+"px "+p;var d=this.offset(f,e,u);n.ctx.textAlign="center";var g=n.geoToPixX(f.x+.5*e+d.dx),b=n.geoToPixY(f.y+.5*e+d.dy)+.5*y;n.ctx.fillText(s,g,b)}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:u,sColor:o})}}])&&bi(e.prototype,n),r&&bi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Oi(t){return(Oi="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})(t)}function Ci(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return ki(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ki(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function ki(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Pi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ji(t,e){return(ji=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ai(t){var e=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}}();return function(){var n,r=Mi(t);if(e){var o=Mi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ei(this,n)}}function Ei(t,e){if(e&&("object"===Oi(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Mi(t){return(Mi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Ti=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ji(t,e)}(i,t);var e,n,r,o=Ai(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.value=t.value,e.sigma=t.sigma,e.styles=t.styles,e}return e=i,(n=[{key:"getKernelMatrix",value:function(t){for(var e,n,r=Math.floor(3*t),o=2*t*t,i=[],a=0;a<=r;a++){for(var u=[],l=0;l<=r;l++){var c=(e=a,n=l,Math.exp(-(e*e+n*n)/o));u.push({w:c,val:0})}i.push(u)}return i}},{key:"kernelSmoothing",value:function(t,e,n,r){var o,i=Math.floor(e.xMin/n)*n,a=Math.floor(e.xMax/n)*n,u=Math.floor(e.yMin/n)*n,l=Math.floor(e.yMax/n)*n,c=(a-i)/n+1,f=(l-u)/n+1,s=Ci(t);try{for(s.s();!(o=s.n()).done;)o.value.ksmval=0}catch(t){s.e(t)}finally{s.f()}var h,y={},p=Ci(t);try{for(p.s();!(h=p.n()).done;){var v=h.value,d=Math.floor((v.x-i)/n),g=Math.floor((v.y-u)/n);y[d]||(y[d]={}),y[d][g]=v}}catch(t){p.e(t)}finally{p.f()}for(var b=this.getKernelMatrix(r),m=b.length,w=0,x=Object.keys(y);w<x.length;w++)for(var S=x[w],_=+S,O=0,C=Object.keys(y[S]);O<C.length;O++){var k=+C[O],P=y[_][k];if(!P.notInputCell){var j=this.value(P);if(j){for(var A=0,E=0;E<m;E++)for(var M=0;M<m;M++){var T=b[E][M];T.val=T.w*j,A+=T.w}for(var R=function(t,e){return t>=0&&t<c&&e>=0&&e<f},z=function(t,e,r){var o=y[t]?y[t][e]:void 0;o?o.ksmval?o.ksmval+=r:o.ksmval=r:(y[t]||(y[t]={}),y[t][e]={x:i+t*n,y:u+e*n,ksmval:r,notInputCell:!0})},F=0;F<m;F++)for(var I=0;I<m;I++){var L=b[Math.abs(F)][Math.abs(I)];if(L){var N=L.val;N&&(N/=A)&&(R(_+F,k+I)&&z(_+F,k+I,N),0==F&&0==I||(R(_-F,k+I)&&z(_-F,k+I,N),0!=F&&(R(_+F,k-I)&&z(_+F,k-I,N),R(_-F,k-I)&&z(_-F,k-I,N))))}}}}}for(var B=[],D=0,Z=Object.keys(y);D<Z.length;D++)for(var U=Z[D],W=0,G=Object.keys(y[U]);W<G.length;W++){var $=G[W];B.push(y[U][$])}return B}},{key:"draw",value:function(t,e,n){if(t&&0!=t.length){var r=this.sigma(e,n.zf);t=this.kernelSmoothing(t,n.extGeo,e,r/e);var o,i=Ci(this.styles);try{for(i.s();!(o=i.n()).done;)o.value.draw(t,e,n)}catch(t){i.e(t)}finally{i.f()}}}}])&&Pi(e.prototype,n),r&&Pi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Ri(t){return(Ri="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})(t)}function zi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Fi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fi(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Fi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ii(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Li(t,e){return(Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ni(t){var e=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}}();return function(){var n,r=Di(t);if(e){var o=Di(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Bi(this,n)}}function Bi(t,e){if(e&&("object"===Ri(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Di(t){return(Di=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Zi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Li(t,e)}(i,t);var e,n,r,o=Ni(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.heightCol=t.heightCol,e.height=t.height,e.colorCol=t.colorCol,e.color=t.color||function(){return"#c08c59"},e.widthCol=t.widthCol,e.width=t.width||function(t,e){return.5*e},e.viewHeightFactor=5,e.shadowDirection=-40.3*Math.PI/180,e.shadowFactor=.3,e.shadowColor="#00000033",e.viewSX=-.25,e.viewSY=-1.5,e.outlineCol="#FFFFFF",e.outlineWidthPix=.5,e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o,i,a=this,u=n.getZf();this.heightCol&&(r=yr.getStatistics(t,(function(t){return t[a.heightCol]}),!0)),this.colorCol&&(o=yr.getStatistics(t,(function(t){return t[a.colorCol]}),!0)),this.widthCol&&(i=yr.getStatistics(t,(function(t){return t[a.widthCol]}),!0));var l=n.getCenter().x+this.viewSX*n.w*u,c=n.getCenter().y+this.viewSY*n.h*u,f=this.viewHeightFactor*(n.w+n.h)*.5*u;t.sort((function(t,e){return 1e8*(e.y-t.y)+t.x-e.x})),n.ctx.lineCap="round",n.setCanvasTransform(),n.ctx.strokeStyle=this.shadowColor;var s,h=zi(t);try{for(h.s();!(s=h.n()).done;){var y=s.value,p=this.width?this.width(y[this.widthCol],e,i,u):void 0;if(p&&!(p<0)){var v=this.height?this.height(y[this.heightCol],e,r,u):void 0;if(v&&!(v<0)){this.offset(y,e,u),n.ctx.lineWidth=p;var d=y.x+e/2,g=y.y+e/2,b=v*this.shadowFactor;n.ctx.beginPath(),n.ctx.moveTo(d,g),n.ctx.lineTo(d+b*Math.cos(this.shadowDirection),g+b*Math.sin(this.shadowDirection)),n.ctx.stroke(),n.ctx.fillStyle="gray",n.ctx.beginPath(),n.ctx.arc(d,g,.5*p,0,2*Math.PI,!1),n.ctx.fill()}}}}catch(t){h.e(t)}finally{h.f()}var m,w=zi(t);try{for(w.s();!(m=w.n()).done;){var x=m.value,S=this.color?this.color(x[this.colorCol],e,o):void 0;if(S){var _=this.width?this.width(x[this.widthCol],e,i,u):void 0;if(_&&!(_<0)){var O=this.height?this.height(x[this.heightCol],e,r,u):void 0;if(O&&!(O<0)){this.offset(x,e,u);var C=x.x+e/2,k=x.y+e/2,P=C-l,j=k-c,A=Math.atan2(j,P),E=Math.sqrt(P*P+j*j)*O/(f-O);n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=_+2*this.outlineWidthPix*u,n.ctx.beginPath(),n.ctx.moveTo(C,k),n.ctx.lineTo(C+E*Math.cos(A),k+E*Math.sin(A)),n.ctx.stroke(),n.ctx.strokeStyle=S,n.ctx.lineWidth=_,n.ctx.beginPath(),n.ctx.moveTo(C,k),n.ctx.lineTo(C+E*Math.cos(A),k+E*Math.sin(A)),n.ctx.stroke(),n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=this.outlineWidthPix*u,n.ctx.beginPath(),n.ctx.arc(C+E*Math.cos(A),k+E*Math.sin(A),.5*_,0,2*Math.PI,!1),n.ctx.stroke()}}}}}catch(t){w.e(t)}finally{w.f()}n.ctx.lineCap="butt",this.updateLegends({style:this,r:e,zf:u,sColor:o})}}])&&Ii(e.prototype,n),r&&Ii(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Ui(t){return(Ui="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})(t)}function Wi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Gi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gi(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Gi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Yi(t,e){return(Yi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Vi(t){var e=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}}();return function(){var n,r=qi(t);if(e){var o=qi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Xi(this,n)}}function Xi(t,e){if(e&&("object"===Ui(e)||"function"==typeof e))return e;if(void 0!==e)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)}function qi(t){return(qi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Hi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yi(t,e)}(i,t);var e,n,r,o=Vi(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.valueCol=t.valueCol,e.value=t.value||function(t,e,n,r,o){return 1},e.color=t.color||function(){return"#EA6BAC"},e.width=t.width||function(t,e,n,r){return e*t.value/5},e.orientation=t.orientation||0,e.fillColor=t.fillColor,e}return e=i,r=[{key:"getSideStatistics",value:function(t,e){if(t&&0!=t.length){var n,r=1/0,o=-1/0,i=Wi(t);try{for(i.s();!(n=i.n()).done;){var a=n.value.value;e&&!a||(a<r&&(r=a),a>o&&(o=a))}}catch(t){i.e(t)}finally{i.f()}return{min:r,max:o}}}}],(n=[{key:"draw",value:function(t,e,n){var r,o=this,a=n.getZf();this.valueCol&&(r=yr.getStatistics(t,(function(t){return t[o.valueCol]}),!0));var u=[];t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var l=t[0],c=1;c<t.length;c++){var f=t[c];l.y+e==f.y&&l.x==f.x?u.push({x:l.x,y:f.y,or:"h",value:this.value(l[this.valueCol],f[this.valueCol],e,r,a)}):(u.push({x:l.x,y:l.y+e,or:"h",value:this.value(l[this.valueCol],void 0,e,r,a)}),u.push({x:f.x,y:f.y,or:"h",value:this.value(void 0,f[this.valueCol],e,r,a)})),l=f}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),l=t[0];for(var s=1;s<t.length;s++){var h=t[s];l.x+e==h.x&&l.y==h.y?u.push({x:l.x+e,y:l.y,or:"v",value:this.value(l[this.valueCol],h[this.valueCol],e,r,a)}):(u.push({x:l.x+e,y:l.y,or:"v",value:this.value(l[this.valueCol],void 0,e,r,a)}),u.push({x:h.x,y:h.y,or:"v",value:this.value(void 0,h[this.valueCol],e,r,a)})),l=h}if(0!=u.length){var y=i.getSideStatistics(u,!0);if(n.setCanvasTransform(),this.fillColor){var p,v=Wi(t);try{for(v.s();!(p=v.n()).done;){var d=p.value,g=this.fillColor(d);g&&"none"!=g&&(n.ctx.fillStyle=g,n.ctx.fillRect(d.x,d.y,e,e))}}catch(t){v.e(t)}finally{v.f()}}n.ctx.lineCap="butt";for(var b=e/2,m=0,w=u;m<w.length;m++){var x=w[m],S=this.color?this.color(x,e,y,a):void 0;if(S&&"none"!=S){var _=this.width?this.width(x,e,y,a):void 0;!_||_<=0||(n.ctx.strokeStyle=S,n.ctx.lineWidth=_,n.ctx.beginPath(),90==this.orientation?(n.ctx.moveTo(x.x+b,x.y+b),"h"===x.or?n.ctx.lineTo(x.x+b,x.y-b):n.ctx.lineTo(x.x-b,x.y+b)):(n.ctx.moveTo(x.x,x.y),n.ctx.lineTo(x.x+("h"===x.or?e:0),x.y+("v"===x.or?e:0))),n.ctx.stroke())}}this.updateLegends({style:this,r:e,zf:a})}}}])&&$i(e.prototype,n),r&&$i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Ki(t){return(Ki="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})(t)}function Ji(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Qi(t,e){return(Qi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ta(t){var e=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}}();return function(){var n,r=na(t);if(e){var o=na(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ea(this,n)}}function ea(t,e){if(e&&("object"===Ki(e)||"function"==typeof e))return e;if(void 0!==e)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)}function na(t){return(na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ra=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qi(t,e)}(i,t);var e,n,r,o=ta(i);function i(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),(t=t||{}).breaks=t.breaks||[100,1e3,1e4,1e5,1e6],t.width=t.width||function(){return 1},t.color=t.color||function(){return"#E7A935"};var n=function(e){if(null==e)return 0;for(var n=0;n<t.breaks.length;n++)if(e<t.breaks[n])return n;return t.breaks.length};return e.value=function(t,e,r,o,i){return Math.abs(n(e)-n(t))},e.color=function(e,n,r,o){return e.value?t.color(e,n,o):void 0},e.width=function(e,n,r,o){return e.value*o*t.width(e,n,o)},e}return e=i,n&&Ji(e.prototype,n),r&&Ji(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(Hi);function oa(t){return(oa="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})(t)}function ia(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return aa(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return aa(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function aa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ua(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function la(t,e){return(la=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ca(t){var e=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}}();return function(){var n,r=sa(t);if(e){var o=sa(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return fa(this,n)}}function fa(t,e){if(e&&("object"===oa(e)||"function"==typeof e))return e;if(void 0!==e)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)}function sa(t){return(sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ha=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&la(t,e)}(i,t);var e,n,r,o=ca(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.col=t.col,e.color=t.color,e.width=t.width||function(t,e,n){return.2*e},e.fillColor=t.fillColor,e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r=n.getZf(),o=[];t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var i=t[0],a=i[this.col],u=1;u<t.length;u++){var l=t[u],c=l[this.col];i.y+e==l.y&&i.x==l.x?a!=c&&o.push({x:i.x,y:l.y,or:"h",v1:a,v2:c}):(o.push({x:i.x,y:i.y+e,or:"h",v1:a,v2:void 0}),o.push({x:l.x,y:l.y,or:"h",v1:void 0,v2:c})),i=l,a=c}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),a=(i=t[0])[this.col];for(var f=1;f<t.length;f++){var s=t[f],h=s[this.col];i.x+e==s.x&&i.y==s.y?a!=h&&o.push({x:i.x+e,y:i.y,or:"v",v1:a,v2:h}):(o.push({x:i.x+e,y:i.y,or:"v",v1:a,v2:void 0}),o.push({x:s.x,y:s.y,or:"v",v1:void 0,v2:h})),i=s,a=h}if(0!=o.length){if(n.setCanvasTransform(),this.fillColor){var y,p=ia(t);try{for(p.s();!(y=p.n()).done;){var v=y.value,d=this.fillColor(v);d&&"none"!=d&&(n.ctx.fillStyle=d,n.ctx.fillRect(v.x,v.y,e,e))}}catch(t){p.e(t)}finally{p.f()}}n.ctx.lineCap="butt";for(var g=0,b=o;g<b.length;g++){var m=b[g],w=this.width?this.width(m,e,r):void 0;if(w&&!(w<=0)){var x=.5*w;n.ctx.lineWidth=w,"h"===m.or?(m.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[m.v2],n.ctx.moveTo(m.x,m.y+x),n.ctx.lineTo(m.x+e,m.y+x),n.ctx.stroke()),m.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[m.v1],n.ctx.moveTo(m.x,m.y-x),n.ctx.lineTo(m.x+e,m.y-x),n.ctx.stroke())):(m.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[m.v2],n.ctx.moveTo(m.x+x,m.y),n.ctx.lineTo(m.x+x,m.y+e),n.ctx.stroke()),m.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[m.v1],n.ctx.moveTo(m.x-x,m.y),n.ctx.lineTo(m.x-x,m.y+e),n.ctx.stroke()))}}this.updateLegends({style:this,r:e,zf:r})}}}])&&ua(e.prototype,n),r&&ua(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr),ya=function t(e){function n(t,n){var r,o;return t=null==t?0:+t,n=null==n?1:+n,function(){var i;if(null!=r)i=r,r=null;else do{r=2*e()-1,i=2*e()-1,o=r*r+i*i}while(!o||o>1);return t+n*i*Math.sqrt(-2*Math.log(o)/o)}}return n.source=t,n}(Math.random);function pa(t,e){var n=document.createElement("canvas");n.setAttribute("width",t),n.setAttribute("height",e);var r=n.getContext("webgl");if(!r)throw new Error("Unable to initialize WebGL. Your browser or machine may not support it.");return{canvas:n,gl:r}}function va(t){var e=t.createProgram();if(null==e)throw new Error("Cannot create webGL program");for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,a=r;i<a.length;i++){var u=a[i];t.attachShader(e,u)}if(t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS))return e;throw new Error(t.getProgramInfoLog(e)||"Cannot create webGL program (2)")}function da(t,e){var n=t.createShader(e);if(null==n)throw new Error("Cannot create webGL shader");for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];if(t.shaderSource(n,o.join("\n")),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS))return n;throw new Error(t.getShaderInfoLog(n)||"Cannot create webGL shader (2)")}function ga(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var ba=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.sizePix=n||10,this.program=va(e,da(e,e.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vColor = color;\n }\n "),da(e,e.FRAGMENT_SHADER,"\n precision mediump float;\n varying vec4 vColor;\n void main(void) {\n vec4 vColor_ = vColor / 255.0;\n vColor_[3] = 255.0 * vColor_[3];\n gl_FragColor = vColor_;\n }")),e.useProgram(this.program),this.verticesBuffer=[],this.colorsBuffer=[]}var e,n,r;return e=t,(n=[{key:"addPointData",value:function(t,e,n){var r=Me(n);r&&(this.verticesBuffer.push(t,e),this.colorsBuffer.push(r.r,r.g,r.b,r.opacity))}},{key:"addPointData2",value:function(t,e,n,r,o,i){this.verticesBuffer.push(t,e),this.colorsBuffer.push(n,r,o,i)}},{key:"draw",value:function(t){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.STATIC_DRAW);var n=e.getAttribLocation(this.program,"pos");e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.STATIC_DRAW);var r=e.getAttribLocation(this.program,"color");e.vertexAttribPointer(r,4,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*this.sizePix),e.uniformMatrix3fv(e.getUniformLocation(this.program,"mat"),!1,new Float32Array(t)),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}])&&ga(e.prototype,n),r&&ga(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ma(t){return(ma="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})(t)}function wa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return xa(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xa(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function xa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Sa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _a(t,e){return(_a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Oa(t){var e=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}}();return function(){var n,r=ka(t);if(e){var o=ka(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ca(this,n)}}function Ca(t,e){if(e&&("object"===ma(e)||"function"==typeof e))return e;if(void 0!==e)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)}function ka(t){return(ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Pa=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_a(t,e)}(i,t);var e,n,r,o=Oa(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.nbCol=t.nbCol,e.nb=t.nb||function(t,e,n,r){return.3*e*e/(r*r)*t/n.max},e.color=t.color||function(){return"#FF5733"},e.dotSize=t.dotSize,e.sigma=t.sigma,e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o=this,i=n.getZf();if(this.nbCol&&(r=yr.getStatistics(t,(function(t){return t[o.nbCol]}),!0)),r){var a=this.dotSize?this.dotSize(e,i):2*i,u=this.sigma?this.sigma(e,i):.4*e,l=ya(0,u);if(function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){var c=pa(n.w+"",n.h+"");if(!c)return void console.error("No webGL");var f,s,h,y,p,v,d,g=new ba(c.gl,a/i),b=e/2,m=wa(t);try{for(m.s();!(d=m.n()).done;){var w=d.value;if((f=this.color(w))&&"none"!==f){if(s=this.offset(w,e,i),h=this.nb(w[this.nbCol],e,r,i),y=w.x+s.dx+b,p=w.y+s.dy+b,!(v=Me(f)))return;for(var x=0;x<=h;x++)g.addPointData2(y+l(),p+l(),v.r,v.g,v.b,v.opacity)}}}catch(t){m.e(t)}finally{m.f()}g.draw(n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(c.canvas,0,0)}else{n.setCanvasTransform();var S,_=wa(t);try{for(_.s();!(S=_.n()).done;){var O=S.value,C=this.color(O);if(C&&"none"!==C){n.ctx.fillStyle=C;for(var k=this.offset(O,e,i),P=this.nb(O[this.nbCol],e,r,i),j=O.x+k.dx+e/2,A=O.y+k.dy+e/2,E=0;E<=P;E++)n.ctx.fillRect(j+l(),A+l(),a,a)}}}catch(t){_.e(t)}finally{_.f()}}this.updateLegends({style:this,r:e,zf:i})}}}])&&Sa(e.prototype,n),r&&Sa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function ja(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Aa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Ea=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;ja(this,t),this.gl=e;var i=da(e,e.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float t;\n varying float vt;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vt = t;\n }\n "),a="\n precision mediump float;\n varying float vt;\n uniform float alpha;"+function(){for(var t=[],e=0;e<n.length;e++)t.push("uniform vec4 c"+e+";");return t.join("")}()+"void main(void) {\n ";if(r?"pow"==r.fun?a+="float t = pow(vt, alpha);":"powRev"==r.fun?a+="float t = 1.0-pow(1.0-vt, 1.0/alpha);":"exp"==r.fun?a+=0==r.alpha?"float t = vt;":"float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);":"expRev"==r.fun?a+=0==r.alpha?"float t = vt;":"float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);":"circleLow"==r.fun?0==r.alpha?a+="float t = vt;":1==r.alpha?a+="float t = sqrt(vt * (2.0 - vt));":a+="float a = alpha / (1.0 - alpha);\n float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;":"circleHigh"==r.fun?0==r.alpha?a+="float t = vt;":1==r.alpha?a+="float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));":a+="float a = alpha / (1.0 - alpha);\n float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;":(console.error("Unexpected stretching function code: "+r.fun),a+="float t = vt;"):a+="float t = vt;",1==n.length)a+="\n vec4 cI=c0;\n vec4 cF=c0;";else if(2==n.length)a+="\n vec4 cI=c0;\n vec4 cF=c1;";else{var u=n.length-1,l=u+".0";a+="\n vec4 cI;\n vec4 cF;\n if(t<1.0/"+l+") { cI=c0; cF=c1; t=t*"+l+"; }";for(var c=2;c<u;c++)a+="else if(t<"+c+".0/"+l+") { cI=c"+(c-1)+"; cF=c"+c+"; t="+l+"*t-"+(c-1)+".0; }";a+="else { cI=c"+(u-1)+"; cF=c"+u+"; t="+l+"*t-"+(u-1)+".0; }"}1==n.length?a+="gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}":a+="gl_FragColor = mix(cI, cF, t);}";var f=da(e,e.FRAGMENT_SHADER,a);this.program=va(e,i,f),e.useProgram(this.program),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*o),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var s=0;s<n.length;s++){var h=Me(n[s]);e.uniform4fv(e.getUniformLocation(this.program,"c"+s),[+h.r/255,+h.g/255,+h.b/255,+h.opacity])}}var e,n,r;return e=t,(n=[{key:"draw",value:function(t,e,n){var r=this.gl,o=this.program;r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.STATIC_DRAW);var i=r.getAttribLocation(o,"pos");r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r.STATIC_DRAW);var a=r.getAttribLocation(o,"t");r.vertexAttribPointer(a,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(a),r.uniformMatrix3fv(r.getUniformLocation(o,"mat"),!1,new Float32Array(n)),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.POINTS,0,t.length/2)}}])&&Aa(e.prototype,n),r&&Aa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ma(t){return(Ma="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})(t)}function Ta(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ra(t,e){return(Ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function za(t){var e=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}}();return function(){var n,r=Ia(t);if(e){var o=Ia(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Fa(this,n)}}function Fa(t,e){if(e&&("object"===Ma(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Ia(t){return(Ia=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var La=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ra(t,e)}(i,t);var e,n,r,o=za(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.tFun=t.tFun||function(t,e,n){return t/n.max},e.stretching=t.stretching,e.colors=t.colors||["rgb(158, 1, 66)","rgb(248, 142, 83)","rgb(251, 248, 176)","rgb(137, 207, 165)","rgb(94, 79, 162)"].reverse(),t.color&&(e.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),e.size=t.size,e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r=this,o=n.getZf(),i=yr.getStatistics(t,(function(t){return t[r.colorCol]}),!0);if(i){var a=pa(n.w+"",n.h+"");if(a){for(var u,l=e/2,c=t.length,f=[],s=[],h=0;h<c;h++){u=t[h];var y=this.tFun(u[this.colorCol],e,i);null!=y&&null!=y&&(f.push(u.x+l,u.y+l),s.push(y>1?1:y<0?0:y))}var p=this.size?this.size(e,o):e+.2*o;new Ea(a.gl,this.colors,this.stretching,p/o).draw(f,s,n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(a.canvas,0,0),this.updateLegends({style:this,r:e,zf:o,sColor:i})}else console.error("No webGL")}}}])&&Ta(e.prototype,n),r&&Ta(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function Na(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Ba=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,r=[{key:"get",value:function(t,e){if(null!=(e=e||{}).nb){e.nb<2&&(console.error("unexpected number of colors in tanaka (<2): "+e.nb),e.nb=2),e.color||(console.error("color function not defined in tanaka"),e.color=function(){return"gray"}),e.colors=[];for(var n=0;n<e.nb;n++)e.colors.push(e.color(n/(e.nb-1)))}e.colors=e.colors||["#a9bb9e","#c9dcaa","#fde89f","#f9a579","#eb444b"];var r=e.colors.length;e.tFun=e.tFun||function(t,e,n){return(t-n.min)/(n.max-n.min)},e.colDark=e.colDark||"#111",e.colBright=e.colBright||"#ddd",e.widthFactor=e.widthFactor||.08;var o=function(t){if(isNaN(t)||null==t)return console.error("Unexpected t value 1: "+t),-9;for(var e=0;e<r;e++)if(t<=(e+1)/r)return e;return console.error("Unexpected t value 2: "+t),-9};return[new La({colorCol:t,colors:e.colors,tFun:function(t,n,i){var a=e.tFun(t,n,i);return o(a)/(r-1)},size:function(t,e){return t+.5*e}}),new Hi({valueCol:t,value:function(t,n,r,i,a){if(void 0===t&&void 0===n)return 0;if(void 0===n){var u=e.tFun(t,r,i);if(null==u||isNaN(u))throw new Error("Unexpected value: "+t+" - "+u);return o(u)+1}if(void 0===t){var l=e.tFun(n,r,i);if(null==l||isNaN(l))throw new Error("Unexpected value: "+n+" - "+l);return-o(l)-1}var c=e.tFun(t,r,i);if(null==c||isNaN(c))throw new Error("Unexpected value: "+t+" - "+c);var f=e.tFun(n,r,i);if(null==f||isNaN(f))throw new Error("Unexpected value: "+n+" - "+f);var s=o(c);return-o(f)+s},color:function(t,n,r,o){if(0!==t.value)return"v"===t.or?t.value<0?e.colBright:e.colDark:t.value<0?e.colDark:e.colBright},width:function(t,n,r,o){return e.widthFactor*n*Math.abs(t.value)*("v"===t.or?.5:1)}})]}}],(n=null)&&Na(e.prototype,n),r&&Na(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Da(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Za=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.colors=e,this.vshString="\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float i;\n varying float vi;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }\n ";var n=[];n.push("precision mediump float;\nvarying float vi;\n"),n.push("uniform vec4");for(var r=0;r<e.length;r++)r>0&&n.push(","),n.push(" c"+r);n.push(";\n"),n.push("void main(void) {\n");for(var o=0;o<e.length;o++)o>0&&n.push("else "),n.push("if(vi=="),n.push(o),n.push(".0) gl_FragColor = vec4(c"),n.push(o),n.push("[0], c"),n.push(o),n.push("[1], c"),n.push(o),n.push("[2], c"),n.push(o),n.push("[3]);\n");n.push("else gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n}"),this.fshString=n.join("")}var e,n,r;return e=t,(n=[{key:"draw",value:function(t,e,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,i=da(t,t.VERTEX_SHADER,this.vshString),a=da(t,t.FRAGMENT_SHADER,this.fshString),u=va(t,i,a);t.useProgram(u),t.uniform1f(t.getUniformLocation(u,"sizePix"),1*o);for(var l=0;l<this.colors.length;l++){var c=Me(this.colors[l]);t.uniform4fv(t.getUniformLocation(u,"c"+l),[+c.r/255,+c.g/255,+c.b/255,+c.opacity])}t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW);var f=t.getAttribLocation(u,"pos");t.vertexAttribPointer(f,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(f),t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(n),t.STATIC_DRAW);var s=t.getAttribLocation(u,"i");t.vertexAttribPointer(s,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s),t.uniformMatrix3fv(t.getUniformLocation(u,"mat"),!1,new Float32Array(r)),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.POINTS,0,e.length/2)}}])&&Da(e.prototype,n),r&&Da(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ua(t){return(Ua="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})(t)}function Wa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ga(t,e){return(Ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function $a(t){var e=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}}();return function(){var n,r=Va(t);if(e){var o=Va(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ya(this,n)}}function Ya(t,e){if(e&&("object"===Ua(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Va(t){return(Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Xa=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ga(t,e)}(i,t);var e,n,r,o=$a(i);function i(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,t.color=t.color||void 0;var n=Object.keys(t.color);e.catToI={};for(var r=0;r<n.length;r++)e.catToI[n[r]]=r+"";e.colors=[];for(var a=0;a<n.length;a++)e.colors.push(t.color[""+n[a]]);return e.size=t.size,e.wgp=new Za(e.colors),e}return e=i,(n=[{key:"draw",value:function(t,e,n){for(var r,o=n.getZf(),i=e/2,a=t.length,u=[],l=[],c=0;c<a;c++){var f=(r=t[c])[this.colorCol];if(f){var s=this.catToI[f];isNaN(+s)?console.log("Unexpected category index: "+f+" "+s):(u.push(r.x+i,r.y+i),l.push(+s))}else console.log("Unexpected category: "+f)}var h=pa(n.w+"",n.h+"");if(h){var y=this.size?this.size(e,o):e+.2*o;this.wgp.draw(h.gl,u,l,n.getWebGLTransform(),y/o),n.initCanvasTransform(),n.ctx.drawImage(h.canvas,0,0),this.updateLegends({style:this,r:e,zf:o})}else console.error("No webGL")}}])&&Wa(e.prototype,n),r&&Wa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function qa(t){return(qa="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})(t)}function Ha(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Ka(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ka(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Ka(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ja(t,e){return(Ja=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Qa(t){var e=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}}();return function(){var n,r=eu(t);if(e){var o=eu(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return tu(this,n)}}function tu(t,e){if(e&&("object"===qa(e)||"function"==typeof e))return e;if(void 0!==e)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)}function eu(t){return(eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function nu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ru(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ou(t,e,n){return e&&ru(t.prototype,e),n&&ru(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var iu=function(){function t(){nu(this,t)}return ou(t,null,[{key:"get",value:function(t,e){(e=e||{}).colors=e.colors||["#00852b","#afd246","#fac80a","#d67923","#bb805a","#cb4e29","#b40000","#720012"],e.colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",e.widthFactor=e.widthFactor||.12;var n=Ba.get(t,e),r=new Do({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n,r){return.2*r}});return[n[0],r,n[1],new au({colDark:e.colDark,colBright:e.colBright})]}},{key:"getCat",value:function(t,e){return(e=e||{}).colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",[new Xa({colorCol:t,color:e.color}),new Do({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n,r){return.2*r}}),new au({colDark:e.colDark,colBright:e.colBright})]}}]),t}(),au=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ja(t,e)}(n,t);var e=Qa(n);function n(t){var r;return nu(this,n),r=e.call(this,t),t=t||{},r.colDark=t.colDark||"#333",r.colBright=t.colBright||"#aaa",r}return ou(n,[{key:"draw",value:function(t,e,n){n.ctx.lineWidth=.6*n.getZf(),n.ctx.strokeStyle=this.colDark;var r,o=Ha(t);try{for(o.s();!(r=o.n()).done;){var i=r.value;n.ctx.beginPath(),n.ctx.arc(i.x+.5*e,i.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!0),n.ctx.stroke()}}catch(t){o.e(t)}finally{o.f()}n.ctx.strokeStyle=this.colBright;var a,u=Ha(t);try{for(u.s();!(a=u.n()).done;){var l=a.value;n.ctx.beginPath(),n.ctx.arc(l.x+.5*e,l.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!1),n.ctx.stroke()}}catch(t){u.e(t)}finally{u.f()}}}]),n}(yr);function uu(t){return(uu="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})(t)}function lu(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return cu(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cu(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function cu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function fu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function su(t,e){return(su=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function hu(t){var e=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}}();return function(){var n,r=pu(t);if(e){var o=pu(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return yu(this,n)}}function yu(t,e){if(e&&("object"===uu(e)||"function"==typeof e))return e;if(void 0!==e)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)}function pu(t){return(pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var vu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&su(t,e)}(i,t);var e,n,r,o=hu(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.mosaicFactor=t.mosaicFactor||.15,e.shadowFactor=t.shadowFactor||.2,e.shadowColor=t.shadowColor||"#555",e}return e=i,(n=[{key:"draw",value:function(t,e,n){var r,o=this,i=n.getZf();this.colorCol&&(r=yr.getStatistics(t,(function(t){return t[o.colorCol]}),!0)),n.ctx.strokeStyle=this.shadowColor,n.ctx.lineWidth=this.shadowFactor*e,n.ctx.lineJoin="round",n.ctx.lineCap="butt";var a=e*this.mosaicFactor,u=function(){return{x:Math.random()*a,y:Math.random()*a}};n.setCanvasTransform();var l,c=lu(t);try{for(c.s();!(l=c.n()).done;){var f=l.value,s=this.color?this.color(f[this.colorCol],e,r):void 0;if(s&&"none"!==s){n.ctx.fillStyle=s;var h=this.offset(f,e,i),y=u(),p=u(),v=u(),d=u();this.shadowFactor>0&&(n.ctx.beginPath(),n.ctx.moveTo(f.x+h.dx+y.x,f.y+h.dy+y.y),n.ctx.lineTo(f.x+h.dx+e-v.x,f.y+h.dy+v.y),n.ctx.lineTo(f.x+h.dx+e-d.x,f.y+h.dy+e-d.y),n.ctx.stroke()),n.ctx.beginPath(),n.ctx.moveTo(f.x+h.dx+y.x,f.y+h.dy+y.y),n.ctx.lineTo(f.x+h.dx+e-v.x,f.y+h.dy+v.y),n.ctx.lineTo(f.x+h.dx+e-d.x,f.y+h.dy+e-d.y),n.ctx.lineTo(f.x+h.dx+p.x,f.y+h.dy+e-p.y),n.ctx.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:i,sColor:r})}}])&&fu(e.prototype,n),r&&fu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(yr);function du(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var gu=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bu(t){if(!(e=gu.exec(t)))throw new Error("invalid format: "+t);var e;return new mu({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function mu(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+""}bu.prototype=mu.prototype,mu.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var wu,xu,Su,_u=function(t,e){var n=du(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")},Ou={"%":(t,e)=>(100*t).toFixed(e),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,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>_u(100*t,e),r:_u,s:function(t,e){var n=du(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(wu=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=r.length;return i===a?r:i>a?r+new Array(i-a+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+du(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)},Cu=function(t){return t},ku=Array.prototype.map,Pu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ju(t){return(ju="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})(t)}function Au(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Eu(t,e){return(Eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Mu(t){var e=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}}();return function(){var n,r=Ru(t);if(e){var o=Ru(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Tu(this,n)}}function Tu(t,e){if(e&&("object"===ju(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Ru(t){return(Ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}xu=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Cu:(e=ku.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var o=t.length,i=[],a=0,u=e[0],l=0;o>0&&u>0&&(l+u+1>r&&(u=Math.max(1,r-l)),i.push(t.substring(o-=u,o+u)),!((l+=u+1)>r));)u=e[a=(a+1)%e.length];return i.reverse().join(n)}),o=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Cu:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ku.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function s(t){var e=(t=bu(t)).fill,n=t.align,s=t.sign,h=t.symbol,y=t.zero,p=t.width,v=t.comma,d=t.precision,g=t.trim,b=t.type;"n"===b?(v=!0,b="g"):Ou[b]||(void 0===d&&(d=12),g=!0,b="g"),(y||"0"===e&&"="===n)&&(y=!0,e="0",n="=");var m="$"===h?o:"#"===h&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===h?i:/[%p]/.test(b)?l:"",x=Ou[b],S=/[defgprs%]/.test(b);function _(t){var o,i,l,h=m,_=w;if("c"===b)_=x(t)+_,t="";else{var O=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),d),g&&(t=function(t){t:for(var e,n=t.length,r=1,o=-1;r<n;++r)switch(t[r]){case".":o=e=r;break;case"0":0===o&&(o=r),e=r;break;default:if(!+t[r])break t;o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),O&&0==+t&&"+"!==s&&(O=!1),h=(O?"("===s?s:c:"-"===s||"("===s?"":s)+h,_=("s"===b?Pu[8+wu/3]:"")+_+(O&&"("===s?")":""),S)for(o=-1,i=t.length;++o<i;)if(48>(l=t.charCodeAt(o))||l>57){_=(46===l?a+t.slice(o+1):t.slice(o))+_,t=t.slice(0,o);break}}v&&!y&&(t=r(t,1/0));var C=h.length+t.length+_.length,k=C<p?new Array(p-C+1).join(e):"";switch(v&&y&&(t=r(k+t,k.length?p-_.length:1/0),k=""),n){case"<":t=h+t+_+k;break;case"=":t=h+k+t+_;break;case"^":t=k.slice(0,C=k.length>>1)+h+t+_+k.slice(C);break;default:t=k+h+t+_}return u(t)}return d=void 0===d?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),_.toString=function(){return t+""},_}return{format:s,formatPrefix:function(t,e){var n,r=s(((t=bu(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=du(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-o),a=Pu[8+o/3];return function(t){return r(i*t)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),Su=xu.format,xu.formatPrefix;var zu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Eu(t,e)}(i,t);var e,n,r,o=Mu(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.colorRamp=t.colorRamp,e.fun=t.fun,e.title=t.title,e.tickSize=t.tickSize||6,e.width=t.width||300,e.height=t.height||15,e.margin=t.margin||5,e.ticks=t.ticks||Math.floor(e.width/50),e.tickFormat=t.tickFormat||".0f",e.tickUnit=t.tickUnit,e.fontSize=t.fontSize||"0.8em",e.invert=t.invert,e}return e=i,(n=[{key:"update",value:function(t){if(t.sColor){this.div.selectAll("*").remove();var e=this.width+2*this.margin,n=this.height+3*this.margin+12+this.tickSize+10,r=this.div.append("svg").attr("width",e).attr("height",n);r.append("text").attr("x",this.margin).attr("y",this.margin).style("font-size","0.8em").style("font-weight","bold").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.title);for(var o=r.append("g").attr("transform","translate("+this.margin+" "+(2*this.margin+12)+")"),i=this.width,a=this.height,u=0;u<i;u+=5){var l=u/(i-1);this.invert&&(l=1-l),o.append("rect").attr("x",u).attr("y",0).attr("width",5).attr("height",a).style("fill",this.colorRamp(l))}for(var c=0;c<this.ticks;c++){var f=c/(this.ticks-1);o.append("line").attr("x1",i*f).attr("y1",0).attr("x2",i*f).attr("y2",a+this.tickSize).style("stroke","black"),o.append("text").attr("id","ticklabel_"+c).attr("x",i*f).attr("y",a+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==c?"start":c==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var s=this.tickFormat&&"text"!=this.tickFormat?Su(this.tickFormat):function(t){return t},h=0;h<this.ticks;h++){var y=h/(this.ticks-1),p=this.fun(y,t.r,t.sColor),v=(p?s(p):"0")+(this.tickUnit?this.tickUnit:"");this.div.select("#ticklabel_"+h).text(v)}}}}])&&Au(e.prototype,n),r&&Au(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(cr);function Fu(t){return(Fu="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})(t)}function Iu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Lu(t,e){return(Lu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Nu(t){var e=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}}();return function(){var n,r=Du(t);if(e){var o=Du(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Bu(this,n)}}function Bu(t,e){if(e&&("object"===Fu(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Du(t){return(Du=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Zu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lu(t,e)}(i,t);var e,n,r,o=Nu(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.colCat=t.colCat||[["gray","-"]],e.shape=t.shape||"circle",e.dimension=t.dimension||{r:8},e.strokeColor=t.strokeColor||"gray",e.strokeWidth=t.strokeWidth||1,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.labelFontSize=t.labelFontSize||"0.8em",e}return e=i,(n=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);var e=this.colCat.length;if(0!=e)for(var n=0;n<e;n++){var r=this.colCat[n],o=this.div.append("div"),i=this.strokeWidth;if("square"===this.shape)o.append("svg").attr("width",(this.dimension.w||20)+2*i).attr("height",(this.dimension.h||15)+2*i).append("rect").attr("x",i).attr("y",i).attr("width",(this.dimension.w||20)+2*i).attr("height",(this.dimension.h||15)+2*i).style("fill",r[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else{if("circle"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var a=this.dimension.r||8;o.append("svg").attr("width",2*a+2*i).attr("height",2*a+2*i).append("circle").attr("cx",a+i).attr("cy",a+i).attr("r",a).style("fill",r[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}o.append("div").style("float","right").style("padding-left","5px").style("font-size",this.labelFontSize).text(r[1])}}}])&&Iu(e.prototype,n),r&&Iu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(cr);function Uu(t){return(Uu="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})(t)}function Wu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Gu(t,e){return(Gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function $u(t){var e=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}}();return function(){var n,r=Vu(t);if(e){var o=Vu(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Yu(this,n)}}function Yu(t,e){if(e&&("object"===Uu(e)||"function"==typeof e))return e;if(void 0!==e)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)}function Vu(t){return(Vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Xu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gu(t,e)}(i,t);var e,n,r,o=$u(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.exaggerationFactor=t.exaggerationFactor||.8,e.shape=t.shape||"circle",e.fillColor=t.fillColor||"none",e.strokeColor=t.strokeColor||"gray",e.strokeWidth=t.strokeWidth||1,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e.labelFormat=t.labelFormat||",.2r",e}return e=i,(n=[{key:"update",value:function(t){if(t.sSize){this.div.selectAll("*").remove();var e=t.sSize.max*this.exaggerationFactor,n=Math.log10(e);n=Math.floor(n);var r=Math.pow(10,n);8*r<=e?r*=8:6*r<=e?r*=6:5*r<=e?r*=5:4*r<=e?r*=4:2.5*r<=e?r*=2.5:2*r<=e&&(r*=2);var o=t.style.size(r,t.r,t.sSize,t.zf)/t.zf,i=this.div.append("svg").attr("width",o+this.strokeWidth+2).attr("height",o+this.strokeWidth+2).style("","inline-block");if("square"===this.shape)i.append("rect").attr("x",0).attr("y",0).attr("width",o).attr("height",o).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(o+this.strokeWidth);i.append("circle").attr("cx",a+1).attr("cy",a+1).attr("r",a).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else if("donut"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=Su(this.labelFormat)(r);this.div.append("div").style("display","inline-block").style("left","4px").style("font-size",this.labelFontSize).text(u+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&Wu(e.prototype,n),r&&Wu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(cr);function qu(t){return(qu="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})(t)}function Hu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ku(t,e){return(Ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ju(t){var e=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}}();return function(){var n,r=tl(t);if(e){var o=tl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Qu(this,n)}}function Qu(t,e){if(e&&("object"===qu(e)||"function"==typeof e))return e;if(void 0!==e)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)}function tl(t){return(tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var el=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ku(t,e)}(i,t);var e,n,r,o=Ju(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=o.call(this,t),t=t||{},e.exaggerationFactor=t.exaggerationFactor||.5,e.color=t.color||"gray",e.orientation=t.orientation||0,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e.div.style("text-align","center"),e}return e=i,(n=[{key:"update",value:function(t){if(t.sWidth){this.div.selectAll("*").remove();var e=t.sWidth.max*this.exaggerationFactor,n=Math.log10(e);n=Math.floor(n);var r=Math.pow(10,n);8*r<=e?r*=8:6*r<=e?r*=6:5*r<=e?r*=5:4*r<=e?r*=4:2.5*r<=e?r*=2.5:2*r<=e&&(r*=2);var o=t.style.width(r,t.r,t.sWidth,t.zf)/t.zf,i=1*t.r/t.zf;this.div.append("svg").attr("width",i).attr("height",o).style("","inline-block").append("line").attr("x1",0).attr("y1",o/2).attr("x2",i).attr("y2",o/2).style("stroke",this.color).style("stroke-width",o);var a=Su(",.2r")(r);this.div.append("div").style("font-size",this.labelFontSize).style("","inline-block").text(a+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&Hu(e.prototype,n),r&&Hu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(cr);function nl(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.01,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;(n=n||1.01)<1&&console.error("Unexpected value for factor: "+n+". Set to default value 1.01");var a=t.getZoomFactor();if(e!=a){e<a&&(n=1/n);var u=a,l=setInterval((function(){u=t.getZoomFactor()*n,e>a&&u>e&&(u=e),e<a&&u<e&&(u=e),t.setZoomFactor(u),t.cg.redraw(),u==e&&(clearInterval(l),o&&setTimeout((function(){o()}),i))}),r);return l}}function rl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NaN,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:NaN,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6?arguments[6]:void 0,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,l=t.getZoomFactor(),c=t.getGeoCenter();e=isNaN(e)?c.x:e,n=isNaN(n)?c.y:n,r=isNaN(r)?l:r;var f=e-c.x,s=n-c.y,h=Math.hypot(f,s),y=o*l*f/h,p=o*l*s/h,v=r/l,d=h/(o*l),g=h>0?Math.pow(v,1/d):Math.pow(v,.1),b=setInterval((function(){if(h>0){var o=t.getGeoCenter(),i=o.x+y,l=o.y+p;i<e&&e<o.x&&(i=e),o.x<e&&e<i&&(i=e),l<n&&n<o.y&&(l=n),o.y<n&&n<l&&(l=n),t.setGeoCenter({x:i,y:l}),i==e&&l==n&&(h=0)}if(1!=v){var c=t.getZoomFactor(),f=g*c;f<r&&r<c&&(f=r),c<r&&r<f&&(f=r),t.setZoomFactor(f),f==r&&(v=1)}t.cg.redraw(),0==h&&1==v&&(console.log("OK !"),clearInterval(b),a&&setTimeout((function(){a()}),u))}),i);return b}var ol=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return Math.pow(t,e)},il=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 1-Math.pow(1-t,1/e)},al=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:(Math.exp(t*e)-1)/(Math.exp(e)-1)},ul=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:1-1/e*Math.log(Math.exp(e)*(1-t)+t)},ll=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.8;if(0==e)return t;if(1==e)return Math.sqrt(t*(2-t));var n=e/(1-e);return Math.sqrt(1/(n*n)+t*(2/n+2-t))-1/n},cl=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.8;return 1-ll(1-t,e)},fl=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:1/e*Math.log(1-t+t*Math.exp(e))},sl=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return(Math.exp(-e*t)-1)/(Math.exp(-e)-1)},hl=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return Math.pow(t,1/e)},yl=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 1-Math.pow(1-t,e)},pl=1e-6,vl=Math.PI,dl=vl/2,gl=vl/4,bl=2*vl,ml=180/vl,wl=vl/180,xl=Math.abs,Sl=Math.atan,_l=Math.atan2,Ol=Math.cos,Cl=(Math.ceil,Math.exp,Math.floor,Math.hypot,Math.log,Math.pow,Math.sin),kl=Math.sign||function(t){return t>0?1:t<0?-1:0},Pl=Math.sqrt;Math.tan;function jl(t){return t>1?dl:t<-1?-dl:Math.asin(t)}function Al(){}var El=function(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Al,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}},Ml=function(t,e){return xl(t[0]-e[0])<pl&&xl(t[1]-e[1])<pl};function Tl(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}var Rl=function(t,e,n,r,o){var i,a,u=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(Ml(r,a)){if(!r[2]&&!a[2]){for(o.lineStart(),i=0;i<e;++i)o.point((r=t[i])[0],r[1]);return void o.lineEnd()}a[0]+=2*pl}u.push(n=new Tl(r,t,null,!0)),l.push(n.o=new Tl(r,null,n,!1)),u.push(n=new Tl(a,t,null,!1)),l.push(n.o=new Tl(a,null,n,!0))}})),u.length){for(l.sort(e),zl(u),zl(l),i=0,a=l.length;i<a;++i)l[i].e=n=!n;for(var c,f,s=u[0];;){for(var h=s,y=!0;h.v;)if((h=h.n)===s)return;c=h.z,o.lineStart();do{if(h.v=h.o.v=!0,h.e){if(y)for(i=0,a=c.length;i<a;++i)o.point((f=c[i])[0],f[1]);else r(h.x,h.n.x,1,o);h=h.n}else{if(y)for(c=h.p.z,i=c.length-1;i>=0;--i)o.point((f=c[i])[0],f[1]);else r(h.x,h.p.x,-1,o);h=h.p}c=(h=h.o).z,y=!y}while(!h.v);o.lineEnd()}}};function zl(t){if(e=t.length){for(var e,n,r=0,o=t[0];++r<e;)o.n=n=t[r],n.p=o,o=n;o.n=n=t[0],n.p=o}}class Fl{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const o=e[r],i=t+o,a=Math.abs(t)<Math.abs(o)?t-(i-o):o-(i-t);a&&(e[n++]=a),t=i}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,o=this._n,i=0;if(o>0){for(i=t[--o];o>0&&(e=i,n=t[--o],i=e+n,r=n-(i-e),!r););o>0&&(r<0&&t[o-1]<0||r>0&&t[o-1]>0)&&(n=2*r,e=i+n,n==e-i&&(i=e))}return i}}function Il(t){return[_l(t[1],t[0]),jl(t[2])]}function Ll(t){var e=t[0],n=t[1],r=Ol(n);return[r*Ol(e),r*Cl(e),Cl(n)]}function Nl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Bl(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Dl(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Zl(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ul(t){var e=Pl(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Wl(t){return xl(t[0])<=vl?t[0]:kl(t[0])*((xl(t[0])+vl)%bl-vl)}function Gl(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}var $l=function(t,e,n,r){return function(o){var i,a,u,l=e(o),c=El(),f=e(c),s=!1,h={point:y,lineStart:v,lineEnd:d,polygonStart:function(){h.point=g,h.lineStart=b,h.lineEnd=m,a=[],i=[]},polygonEnd:function(){h.point=y,h.lineStart=v,h.lineEnd=d,a=Gl(a);var t=function(t,e){var n=Wl(e),r=e[1],o=Cl(r),i=[Cl(n),-Ol(n),0],a=0,u=0,l=new Fl;1===o?r=dl+pl:-1===o&&(r=-dl-pl);for(var c=0,f=t.length;c<f;++c)if(h=(s=t[c]).length)for(var s,h,y=s[h-1],p=Wl(y),v=y[1]/2+gl,d=Cl(v),g=Ol(v),b=0;b<h;++b,p=w,d=S,g=_,y=m){var m=s[b],w=Wl(m),x=m[1]/2+gl,S=Cl(x),_=Ol(x),O=w-p,C=O>=0?1:-1,k=C*O,P=k>vl,j=d*S;if(l.add(_l(j*C*Cl(k),g*_+j*Ol(k))),a+=P?O+C*bl:O,P^p>=n^w>=n){var A=Bl(Ll(y),Ll(m));Ul(A);var E=Bl(i,A);Ul(E);var M=(P^O>=0?-1:1)*jl(E[2]);(r>M||r===M&&(A[0]||A[1]))&&(u+=P^O>=0?1:-1)}}return(a<-pl||a<pl&&l<-1e-12)^1&u}(i,r);a.length?(s||(o.polygonStart(),s=!0),Rl(a,Vl,t,n,o)):t&&(s||(o.polygonStart(),s=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),s&&(o.polygonEnd(),s=!1),a=i=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function y(e,n){t(e,n)&&o.point(e,n)}function p(t,e){l.point(t,e)}function v(){h.point=p,l.lineStart()}function d(){h.point=y,l.lineEnd()}function g(t,e){u.push([t,e]),f.point(t,e)}function b(){f.lineStart(),u=[]}function m(){g(u[0][0],u[0][1]),f.lineEnd();var t,e,n,r,l=f.clean(),h=c.result(),y=h.length;if(u.pop(),i.push(u),u=null,y)if(1&l){if((e=(n=h[0]).length-1)>0){for(s||(o.polygonStart(),s=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else y>1&&2&l&&h.push(h.pop().concat(h.shift())),a.push(h.filter(Yl))}return h}};function Yl(t){return t.length>1}function Vl(t,e){return((t=t.x)[0]<0?t[1]-dl-pl:dl-t[1])-((e=e.x)[0]<0?e[1]-dl-pl:dl-e[1])}var Xl=$l((function(){return!0}),(function(t){var e,n=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,a){var u=i>0?vl:-vl,l=xl(i-n);xl(l-vl)<pl?(t.point(n,r=(r+a)/2>0?dl:-dl),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(i,r),e=0):o!==u&&l>=vl&&(xl(n-o)<pl&&(n-=o*pl),xl(i-u)<pl&&(i-=u*pl),r=function(t,e,n,r){var o,i,a=Cl(t-n);return xl(a)>pl?Sl((Cl(e)*(i=Ol(r))*Cl(n)-Cl(r)*(o=Ol(e))*Cl(t))/(o*i*a)):(e+r)/2}(n,r,i,a),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),e=0),t.point(n=i,r=a),o=u},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var o;if(null==t)o=n*dl,r.point(-vl,o),r.point(0,o),r.point(vl,o),r.point(vl,0),r.point(vl,-o),r.point(0,-o),r.point(-vl,-o),r.point(-vl,0),r.point(-vl,o);else if(xl(t[0]-e[0])>pl){var i=t[0]<e[0]?vl:-vl;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(e[0],e[1])}),[-vl,-dl]);var ql=function(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n};function Hl(t,e){return[xl(t)>vl?t+Math.round(-t/bl)*bl:t,e]}function Kl(t,e,n){return(t%=bl)?e||n?ql(Ql(t),tc(e,n)):Ql(t):e||n?tc(e,n):Hl}function Jl(t){return function(e,n){return[(e+=t)>vl?e-bl:e<-vl?e+bl:e,n]}}function Ql(t){var e=Jl(t);return e.invert=Jl(-t),e}function tc(t,e){var n=Ol(t),r=Cl(t),o=Ol(e),i=Cl(e);function a(t,e){var a=Ol(e),u=Ol(t)*a,l=Cl(t)*a,c=Cl(e),f=c*n+u*r;return[_l(l*o-f*i,u*n-c*r),jl(f*o+l*i)]}return a.invert=function(t,e){var a=Ol(e),u=Ol(t)*a,l=Cl(t)*a,c=Cl(e),f=c*o-l*i;return[_l(l*o+c*i,u*n+f*r),jl(f*n-u*r)]},a}Hl.invert=Hl;function ec(t,e,n,r,o,i){if(n){var a=Ol(e),u=Cl(e),l=r*n;null==o?(o=e+r*bl,i=e-l/2):(o=nc(a,o),i=nc(a,i),(r>0?o<i:o>i)&&(o+=r*bl));for(var c,f=o;r>0?f>i:f<i;f-=l)c=Il([a,-u*Ol(f),-u*Cl(f)]),t.point(c[0],c[1])}}function nc(t,e){(e=Ll(e))[0]-=t,Ul(e);var n,r=(n=-e[1])>1?0:n<-1?vl:Math.acos(n);return((-e[2]<0?-r:r)+bl-pl)%bl}var rc=function(t){var e=Ol(t),n=6*wl,r=e>0,o=xl(e)>pl;function i(t,n){return Ol(t)*Ol(n)>e}function a(t,n,r){var o=[1,0,0],i=Bl(Ll(t),Ll(n)),a=Nl(i,i),u=i[0],l=a-u*u;if(!l)return!r&&t;var c=e*a/l,f=-e*u/l,s=Bl(o,i),h=Zl(o,c);Dl(h,Zl(i,f));var y=s,p=Nl(h,y),v=Nl(y,y),d=p*p-v*(Nl(h,h)-1);if(!(d<0)){var g=Pl(d),b=Zl(y,(-p-g)/v);if(Dl(b,h),b=Il(b),!r)return b;var m,w=t[0],x=n[0],S=t[1],_=n[1];x<w&&(m=w,w=x,x=m);var O=x-w,C=xl(O-vl)<pl;if(!C&&_<S&&(m=S,S=_,_=m),C||O<pl?C?S+_>0^b[1]<(xl(b[0]-w)<pl?S:_):S<=b[1]&&b[1]<=_:O>vl^(w<=b[0]&&b[0]<=x)){var k=Zl(y,(-p+g)/v);return Dl(k,h),[b,Il(k)]}}}function u(e,n){var o=r?t:vl-t,i=0;return e<-o?i|=1:e>o&&(i|=2),n<-o?i|=4:n>o&&(i|=8),i}return $l(i,(function(t){var e,n,l,c,f;return{lineStart:function(){c=l=!1,f=1},point:function(s,h){var y,p=[s,h],v=i(s,h),d=r?v?0:u(s,h):v?u(s+(s<0?vl:-vl),h):0;if(!e&&(c=l=v)&&t.lineStart(),v!==l&&(!(y=a(e,p))||Ml(e,y)||Ml(p,y))&&(p[2]=1),v!==l)f=0,v?(t.lineStart(),y=a(p,e),t.point(y[0],y[1])):(y=a(e,p),t.point(y[0],y[1],2),t.lineEnd()),e=y;else if(o&&e&&r^v){var g;d&n||!(g=a(p,e,!0))||(f=0,r?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1],3)))}!v||e&&Ml(e,p)||t.point(p[0],p[1]),e=p,l=v,n=d},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return f|(c&&l)<<1}}}),(function(e,r,o,i){ec(i,t,n,o,e,r)}),r?[0,-t]:[-vl,t-vl])};function oc(t,e,n,r){function o(o,i){return t<=o&&o<=n&&e<=i&&i<=r}function i(o,i,u,c){var f=0,s=0;if(null==o||(f=a(o,u))!==(s=a(i,u))||l(o,i)<0^u>0)do{c.point(0===f||3===f?t:n,f>1?r:e)}while((f=(f+u+4)%4)!==s);else c.point(i[0],i[1])}function a(r,o){return xl(r[0]-t)<pl?o>0?0:3:xl(r[0]-n)<pl?o>0?2:1:xl(r[1]-e)<pl?o>0?1:0:o>0?3:2}function u(t,e){return l(t.x,e.x)}function l(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,f,s,h,y,p,v,d,g,b,m=a,w=El(),x={point:S,lineStart:function(){x.point=_,c&&c.push(f=[]);g=!0,d=!1,p=v=NaN},lineEnd:function(){l&&(_(s,h),y&&d&&w.rejoin(),l.push(w.result()));x.point=S,d&&m.lineEnd()},polygonStart:function(){m=w,l=[],c=[],b=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,o=c.length;n<o;++n)for(var i,a,u=c[n],l=1,f=u.length,s=u[0],h=s[0],y=s[1];l<f;++l)i=h,a=y,s=u[l],h=s[0],y=s[1],a<=r?y>r&&(h-i)*(r-a)>(y-a)*(t-i)&&++e:y<=r&&(h-i)*(r-a)<(y-a)*(t-i)&&--e;return e}(),n=b&&e,o=(l=Gl(l)).length;(n||o)&&(a.polygonStart(),n&&(a.lineStart(),i(null,null,1,a),a.lineEnd()),o&&Rl(l,u,e,i,a),a.polygonEnd());m=a,l=c=f=null}};function S(t,e){o(t,e)&&m.point(t,e)}function _(i,a){var u=o(i,a);if(c&&f.push([i,a]),g)s=i,h=a,y=u,g=!1,u&&(m.lineStart(),m.point(i,a));else if(u&&d)m.point(i,a);else{var l=[p=Math.max(-1e9,Math.min(1e9,p)),v=Math.max(-1e9,Math.min(1e9,v))],w=[i=Math.max(-1e9,Math.min(1e9,i)),a=Math.max(-1e9,Math.min(1e9,a))];!function(t,e,n,r,o,i){var a,u=t[0],l=t[1],c=0,f=1,s=e[0]-u,h=e[1]-l;if(a=n-u,s||!(a>0)){if(a/=s,s<0){if(a<c)return;a<f&&(f=a)}else if(s>0){if(a>f)return;a>c&&(c=a)}if(a=o-u,s||!(a<0)){if(a/=s,s<0){if(a>f)return;a>c&&(c=a)}else if(s>0){if(a<c)return;a<f&&(f=a)}if(a=r-l,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=i-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}return c>0&&(t[0]=u+c*s,t[1]=l+c*h),f<1&&(e[0]=u+f*s,e[1]=l+f*h),!0}}}}}(l,w,t,e,n,r)?u&&(m.lineStart(),m.point(i,a),b=!1):(d||(m.lineStart(),m.point(l[0],l[1])),m.point(w[0],w[1]),u||m.lineEnd(),b=!1)}p=i,v=a,d=u}return x}}var ic=t=>t;function ac(t){return function(e){var n=new uc;for(var r in t)n[r]=t[r];return n.stream=e,n}}function uc(){}function lc(t,e){t&&fc.hasOwnProperty(t.type)&&fc[t.type](t,e)}uc.prototype={constructor:uc,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var cc={Feature:function(t,e){lc(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)lc(n[r].geometry,e)}},fc={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){sc(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)sc(n[r],e,0)},Polygon:function(t,e){hc(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)hc(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)lc(n[r],e)}};function sc(t,e,n){var r,o=-1,i=t.length-n;for(e.lineStart();++o<i;)r=t[o],e.point(r[0],r[1],r[2]);e.lineEnd()}function hc(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)sc(t[n],e,1);e.polygonEnd()}var yc=1/0,pc=yc,vc=-yc,dc=vc;var gc={point:function(t,e){t<yc&&(yc=t);t>vc&&(vc=t);e<pc&&(pc=e);e>dc&&(dc=e)},lineStart:Al,lineEnd:Al,polygonStart:Al,polygonEnd:Al,result:function(){var t=[[yc,pc],[vc,dc]];return vc=dc=-(pc=yc=1/0),t}};function bc(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),function(t,e){t&&cc.hasOwnProperty(t.type)?cc[t.type](t,e):lc(t,e)}(n,t.stream(gc)),e(gc.result()),null!=r&&t.clipExtent(r),t}function mc(t,e,n){return bc(t,(function(n){var r=e[1][0]-e[0][0],o=e[1][1]-e[0][1],i=Math.min(r/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),a=+e[0][0]+(r-i*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(o-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([a,u])}),n)}var wc=Ol(30*wl),xc=function(t,e){return+e?function(t,e){function n(r,o,i,a,u,l,c,f,s,h,y,p,v,d){var g=c-r,b=f-o,m=g*g+b*b;if(m>4*e&&v--){var w=a+h,x=u+y,S=l+p,_=Pl(w*w+x*x+S*S),O=jl(S/=_),C=xl(xl(S)-1)<pl||xl(i-s)<pl?(i+s)/2:_l(x,w),k=t(C,O),P=k[0],j=k[1],A=P-r,E=j-o,M=b*A-g*E;(M*M/m>e||xl((g*A+b*E)/m-.5)>.3||a*h+u*y+l*p<wc)&&(n(r,o,i,a,u,l,P,j,C,w/=_,x/=_,S,v,d),d.point(P,j),n(P,j,C,w,x,S,c,f,s,h,y,p,v,d))}}return function(e){var r,o,i,a,u,l,c,f,s,h,y,p,v={point:d,lineStart:g,lineEnd:m,polygonStart:function(){e.polygonStart(),v.lineStart=w},polygonEnd:function(){e.polygonEnd(),v.lineStart=g}};function d(n,r){n=t(n,r),e.point(n[0],n[1])}function g(){f=NaN,v.point=b,e.lineStart()}function b(r,o){var i=Ll([r,o]),a=t(r,o);n(f,s,c,h,y,p,f=a[0],s=a[1],c=r,h=i[0],y=i[1],p=i[2],16,e),e.point(f,s)}function m(){v.point=d,e.lineEnd()}function w(){g(),v.point=x,v.lineEnd=S}function x(t,e){b(r=t,e),o=f,i=s,a=h,u=y,l=p,v.point=b}function S(){n(f,s,c,h,y,p,o,i,r,a,u,l,16,e),v.lineEnd=m,m()}return v}}(t,e):function(t){return ac({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)};var Sc=ac({point:function(t,e){this.stream.point(t*wl,e*wl)}});function _c(t,e,n,r,o,i){if(!i)return function(t,e,n,r,o){function i(i,a){return[e+t*(i*=r),n-t*(a*=o)]}return i.invert=function(i,a){return[(i-e)/t*r,(n-a)/t*o]},i}(t,e,n,r,o);var a=Ol(i),u=Cl(i),l=a*t,c=u*t,f=a/t,s=u/t,h=(u*n-a*e)/t,y=(u*e+a*n)/t;function p(t,i){return[l*(t*=r)-c*(i*=o)+e,n-c*t-l*i]}return p.invert=function(t,e){return[r*(f*t-s*e+h),o*(y-s*t-f*e)]},p}function Oc(t){return function(t){var e,n,r,o,i,a,u,l,c,f,s=150,h=480,y=250,p=0,v=0,d=0,g=0,b=0,m=0,w=1,x=1,S=null,_=Xl,O=null,C=ic,k=.5;function P(t){return l(t[0]*wl,t[1]*wl)}function j(t){return(t=l.invert(t[0],t[1]))&&[t[0]*ml,t[1]*ml]}function A(){var t=_c(s,0,0,w,x,m).apply(null,e(p,v)),r=_c(s,h-t[0],y-t[1],w,x,m);return n=Kl(d,g,b),u=ql(e,r),l=ql(n,u),a=xc(u,k),E()}function E(){return c=f=null,P}return P.stream=function(t){return c&&f===t?c:c=Sc(function(t){return ac({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(_(a(C(f=t)))))},P.preclip=function(t){return arguments.length?(_=t,S=void 0,E()):_},P.postclip=function(t){return arguments.length?(C=t,O=r=o=i=null,E()):C},P.clipAngle=function(t){return arguments.length?(_=+t?rc(S=t*wl):(S=null,Xl),E()):S*ml},P.clipExtent=function(t){return arguments.length?(C=null==t?(O=r=o=i=null,ic):oc(O=+t[0][0],r=+t[0][1],o=+t[1][0],i=+t[1][1]),E()):null==O?null:[[O,r],[o,i]]},P.scale=function(t){return arguments.length?(s=+t,A()):s},P.translate=function(t){return arguments.length?(h=+t[0],y=+t[1],A()):[h,y]},P.center=function(t){return arguments.length?(p=t[0]%360*wl,v=t[1]%360*wl,A()):[p*ml,v*ml]},P.rotate=function(t){return arguments.length?(d=t[0]%360*wl,g=t[1]%360*wl,b=t.length>2?t[2]%360*wl:0,A()):[d*ml,g*ml,b*ml]},P.angle=function(t){return arguments.length?(m=t%360*wl,A()):m*ml},P.reflectX=function(t){return arguments.length?(w=t?-1:1,A()):w<0},P.reflectY=function(t){return arguments.length?(x=t?-1:1,A()):x<0},P.precision=function(t){return arguments.length?(a=xc(u,k=t*t),E()):Pl(k)},P.fitExtent=function(t,e){return mc(P,t,e)},P.fitSize=function(t,e){return function(t,e,n){return mc(t,[[0,0],e],n)}(P,t,e)},P.fitWidth=function(t,e){return function(t,e,n){return bc(t,(function(n){var r=+e,o=r/(n[1][0]-n[0][0]),i=(r-o*(n[1][0]+n[0][0]))/2,a=-o*n[0][1];t.scale(150*o).translate([i,a])}),n)}(P,t,e)},P.fitHeight=function(t,e){return function(t,e,n){return bc(t,(function(n){var r=+e,o=r/(n[1][1]-n[0][1]),i=-o*n[0][0],a=(r-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([i,a])}),n)}(P,t,e)},function(){return e=t.apply(this,arguments),P.invert=e.invert&&j,A()}}((function(){return t}))()}var Cc,kc,Pc=(Cc=function(t){return Pl(2/(1+t))},function(t,e){var n=Ol(t),r=Ol(e),o=Cc(n*r);return o===1/0?[2,0]:[o*r*Cl(t),o*Cl(e)]});Pc.invert=(kc=function(t){return 2*jl(t/2)},function(t,e){var n=Pl(t*t+e*e),r=kc(n),o=Cl(r),i=Ol(r);return[_l(t*o,n*i),jl(n&&e*o/n)]});var jc=function(){return Oc(Pc).scale(124.75).clipAngle(179.999)},Ac=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EUR",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,n=arguments.length>2?arguments[2]:void 0,r=(n=n||{}).ex||1.2,o=n.fontFamily||"Arial",i=n.exSize||1;return n.style=n.style||function(t,e){if(!(t.rs<r*e))return t.r1<r*e?i+"em "+o:1.5*i+"em "+o},n.proj=n.proj||jc().rotate([-10,-52]).reflectX(!1).reflectY(!0).scale(6378137).translate([4321e3,321e4]),n.preprocess=function(t){var e=n.proj([t.lon,t.lat]);t.x=e[0],t.y=e[1],delete t.lon,delete t.lat},n.url="https://raw.githubusercontent.com/eurostat/euronym/main/pub/v1/"+e+"/"+t+".csv",n},Ec=function(t){var e=(t=t||{}).nutsYear||"2021",n=t.crs||"3035",r=t.scale||"03M",o=t.nutsLevel||"3",i=t.col||"#888";return t.color=t.color||function(t,e){var n=t.properties;return"T"===n.co||e<400?i:e<1e3?n.lvl>=3?"":i:e<2e3?n.lvl>=2?"":i:n.lvl>=1?"":i},t.width=t.width||function(t,e){var n=t.properties;return"T"===n.co?.5:e<400?3==n.lvl||2==n.lvl||1==n.lvl?2.2:4:e<1e3?2==n.lvl||1==n.lvl?1.8:2.5:e<2e3?1==n.lvl?1.8:2.5:1.2},t.lineDash=t.lineDash||function(t,e){var n=t.properties;return"T"===n.co?[]:e<400?3==n.lvl?[2*e,2*e]:2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<1e3?2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<2e3&&1==n.lvl?[5*e,2*e]:[10*e,3*e]},t.url="https://raw.githubusercontent.com/eurostat/Nuts2json/master/pub/v2/"+e+"/"+n+"/"+r+"/nutsbn_"+o+".json",t},Mc=Kn.getParameterByName},9:function(t,e,n){t.exports=n(10)}})}));