gridviz 3.0.41 → 3.1.1
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 +18 -15
- package/dist/gridviz.js +3227 -1941
- package/dist/gridviz.min.js +1 -1
- package/package.json +6 -4
- package/src/button/Button.js +77 -68
- package/src/button/FullscreenButton.js +123 -123
- package/src/button/ZoomButtons.js +109 -104
- package/src/core/Drawable.js +25 -3
- package/src/core/GeoCanvas.js +15 -0
- package/src/core/Legend.js +267 -245
- package/src/core/Map.js +180 -30
- package/src/core/Tooltip.js +191 -185
- package/src/dataset/TiledGrid.js +74 -24
- package/src/index.js +82 -79
- package/src/layer/GridLayer.js +196 -194
- package/src/layer/LabelLayer.js +7 -4
- package/src/legend/ColorCategoryLegend.js +127 -125
- package/src/legend/ColorDiscreteLegend.js +116 -114
- package/src/legend/ColorLegend.js +33 -11
- package/src/legend/OrientationLegend.js +94 -92
- package/src/legend/SizeLegend.js +8 -1
- package/src/legend/TernaryLegend.js +317 -314
- package/src/legend/VennLegend.js +202 -0
- package/src/style/CircleColorSizeWebGLStyle.js +249 -0
- package/src/style/CompositionStyle.js +1 -1
- package/src/style/DotDensityStyle.js +8 -4
- package/src/style/ImageStyle.js +1 -1
- package/src/style/Interpolator.js +31 -6
- package/src/style/IsoFenceStyle.js +1 -1
- package/src/style/LegoStyle.js +6 -5
- package/src/style/MosaicStyle.js +1 -1
- package/src/style/NinjaStarStyle.js +1 -1
- package/src/style/PillarStyle.js +1 -1
- package/src/style/RandomWalkInterpolator.js +213 -0
- package/src/style/ShadingRayStyle.js +16 -2
- package/src/style/ShadingStyle.js +80 -72
- package/src/style/ShapeColorSizeStyle.js +18 -2
- package/src/style/SideCategoryStyle.js +1 -1
- package/src/style/SideStyle.js +1 -1
- package/src/style/SideTanakaStyle.js +1 -1
- package/src/style/SquareColorCategoryWebGLStyle.js +71 -20
- package/src/style/SquareColorWebGLStyle.js +7 -4
- package/src/style/StrokeStyle.js +1 -1
- package/src/style/TextStyle.js +1 -1
- package/src/style/TimeSeriesStyle.js +14 -7
- package/src/utils/WebGLSquareColoringAdvanced.js +47 -9
- package/src/utils/scale.js +20 -0
- package/src/utils/webGLUtils.js +52 -0
package/dist/gridviz.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see gridviz.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gridviz=e():t.gridviz=e()}(self,()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},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 r(t){return null==t?n:function(){return this.querySelector(t)}}function o(){return[]}function i(t){return null==t?o:function(){return this.querySelectorAll(t)}}function a(t){return function(){return this.matches(t)}}function u(t){return function(e){return e.matches(t)}}t.r(e),t.d(e,{BackgroundLayer:()=>Ec,BackgroundLayerImage:()=>$c,BackgroundLayerWMS:()=>Bc,CSVGrid:()=>No,ColorCategoryLegend:()=>Ds,ColorDiscreteLegend:()=>zs,ColorLegend:()=>Ps,CompositionStyle:()=>zi,Dataset:()=>Lr,DotDensityStyle:()=>su,GeoCanvas:()=>Fn,GeoJSONLayer:()=>ps,GridLayer:()=>Oc,ImageStyle:()=>ic,Interpolator:()=>yc,IsoFenceStyle:()=>Hl,JSGrid:()=>Yo,JoyPlotStyle:()=>Oi,LabelLayer:()=>ns,Layer:()=>Er,LegoStyle:()=>Zu,Map:()=>sr,MosaicStyle:()=>bl,MultiResolutionDataset:()=>$r,NinjaStarStyle:()=>jl,OrientationLegend:()=>lf,PillarStyle:()=>oa,SegmentStyle:()=>Gi,ShadingRayStyle:()=>Ia,ShadingStyle:()=>Ua,ShapeColorSizeStyle:()=>ei,SideCategoryStyle:()=>Za,SideStyle:()=>ha,SideTanakaStyle:()=>mu,SizeLegend:()=>Xs,SquareColorCategoryWebGLStyle:()=>Ca,SquareColorWebGLStyle:()=>cl,StrokeStyle:()=>ci,Style:()=>Or,TernaryLegend:()=>df,TextStyle:()=>Xi,TiledGrid:()=>Po,TimeSeriesStyle:()=>Rl,cellsToMatrix:()=>di,circularInverseScale:()=>Of,circularScale:()=>Sf,classifier:()=>Iu,classifierMinMax:()=>Bu,colorClassifier:()=>Lu,discreteColors:()=>Nu,exponentialScale:()=>mf,getParameterByName:()=>oh,logarithmicScale:()=>gf,nice:()=>vi,orientationLegend:()=>cf,powerInverseScale:()=>xf,powerScale:()=>wf,sizeDiscreteLegend:()=>Ks,sizeDiscreteViewScaleLegend:()=>Qs,sizeLegend:()=>Zs,sizeLegendViewScale:()=>Js,ternaryClassifier:()=>$f,ternaryColorClassifier:()=>Hf,viewScale:()=>Eu,viewScaleColor:()=>Mu,viewScaleColorQuantile:()=>zu,viewScaleCombination:()=>Fu,viewScaleQuantile:()=>Au,viewScaleQuantileClassifer:()=>Ru});var l=Array.prototype.find;function c(){return this.firstElementChild}var s=Array.prototype.filter;function f(){return Array.from(this.children)}function h(t){return new Array(t.length)}function y(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function p(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 y(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function v(t,e,n,r,o,i,a){var u,l,c,s=new Map,f=e.length,h=i.length,p=new Array(f);for(u=0;u<f;++u)(l=e[u])&&(p[u]=c=a.call(l,l.__data__,u,e)+"",s.has(c)?o[u]=l:s.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=s.get(c))?(r[u]=l,l.__data__=i[u],s.delete(c)):n[u]=new y(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(p[u])===l&&(o[u]=l)}function d(t){return t.__data__}function b(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function m(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}y.prototype={constructor:y,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 g="http://www.w3.org/1999/xhtml";const w={svg:"http://www.w3.org/2000/svg",xhtml:g,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function x(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),w.hasOwnProperty(e)?{space:w[e],local:t}:t}function S(t){return function(){this.removeAttribute(t)}}function O(t){return function(){this.removeAttributeNS(t.space,t.local)}}function _(t,e){return function(){this.setAttribute(t,e)}}function j(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function k(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 T(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function C(t){return function(){this.style.removeProperty(t)}}function E(t,e,n){return function(){this.style.setProperty(t,e,n)}}function A(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function M(t,e){return t.style.getPropertyValue(e)||T(t).getComputedStyle(t,null).getPropertyValue(e)}function z(t){return function(){delete this[t]}}function R(t,e){return function(){this[t]=e}}function F(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 L(t)}function L(t){this._node=t,this._names=I(t.getAttribute("class")||"")}function N(t,e){for(var n=B(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function D(t,e){for(var n=B(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function G(t){return function(){N(this,t)}}function U(t){return function(){D(this,t)}}function W(t,e){return function(){(e.apply(this,arguments)?N:D)(this,t)}}function $(){this.textContent=""}function H(t){return function(){this.textContent=t}}function q(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Y(){this.innerHTML=""}function V(t){return function(){this.innerHTML=t}}function X(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Z(){this.nextSibling&&this.parentNode.appendChild(this)}function J(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function K(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===g&&e.documentElement.namespaceURI===g?e.createElement(t):e.createElementNS(n,t)}}function Q(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tt(t){var e=x(t);return(e.local?Q:K)(e)}function et(){return null}function nt(){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 ot(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function it(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 at(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 ut(t,e,n){var r=T(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 lt(t,e){return function(){return ut(this,t,e)}}function ct(t,e){return function(){return ut(this,t,e.apply(this,arguments))}}L.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 st=[null];function ft(t,e){this._groups=t,this._parents=e}function ht(){return new ft([[document.documentElement]],st)}ft.prototype=ht.prototype={constructor:ft,select:function(t){"function"!=typeof t&&(t=r(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var a,u,l=e[i],c=l.length,s=o[i]=new Array(c),f=0;f<c;++f)(a=l[f])&&(u=t.call(a,a.__data__,f,l))&&("__data__"in a&&(u.__data__=a.__data__),s[f]=u);return new ft(o,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(t):i(t);for(var e=this._groups,n=e.length,r=[],o=[],a=0;a<n;++a)for(var u,l=e[a],c=l.length,s=0;s<c;++s)(u=l[s])&&(r.push(t.call(u,u.__data__,s,l)),o.push(u));return new ft(r,o)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:u(t)))},selectChildren:function(t){return this.selectAll(null==t?f:function(t){return function(){return s.call(this.children,t)}}("function"==typeof t?t:u(t)))},filter:function(t){"function"!=typeof t&&(t=a(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,u=e[o],l=u.length,c=r[o]=[],s=0;s<l;++s)(i=u[s])&&t.call(i,i.__data__,s,u)&&c.push(i);return new ft(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,d);var n,r=e?v:p,o=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,u=new Array(a),l=new Array(a),c=new Array(a),s=0;s<a;++s){var f=o[s],h=i[s],y=h.length,m=b(t.call(f,f&&f.__data__,s,o)),g=m.length,w=l[s]=new Array(g),x=u[s]=new Array(g);r(f,h,w,x,c[s]=new Array(y),m,e);for(var S,O,_=0,j=0;_<g;++_)if(S=w[_]){for(_>=j&&(j=_+1);!(O=x[j])&&++j<g;);S._next=O||null}}return(u=new ft(u,o))._enter=l,u._exit=c,u},enter:function(){return new ft(this._enter||this._groups.map(h),this._parents)},exit:function(){return new ft(this._exit||this._groups.map(h),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,s=n[l],f=r[l],h=s.length,y=u[l]=new Array(h),p=0;p<h;++p)(c=s[p]||f[p])&&(y[p]=c);for(;l<o;++l)u[l]=n[l];return new ft(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=m);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),s=0;s<l;++s)(a=u[s])&&(c[s]=a);c.sort(e)}return new ft(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=x(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?O:S:"function"==typeof e?n.local?k:P:n.local?j:_)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?C:"function"==typeof e?A:E)(t,e,null==n?"":n)):M(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?z:"function"==typeof e?F:R)(t,e)):this.node()[t]},classed:function(t,e){var n=I(t+"");if(arguments.length<2){for(var r=B(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?W:e?G:U)(n,e))},text:function(t){return arguments.length?this.each(null==t?$:("function"==typeof t?q:H)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Y:("function"==typeof t?X:V)(t)):this.node().innerHTML},raise:function(){return this.each(Z)},lower:function(){return this.each(J)},append:function(t){var e="function"==typeof t?t:tt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:tt(t),o=null==e?et:"function"==typeof e?e:r(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(nt)},clone:function(t){return this.select(t?ot:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=function(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}})}(t+""),a=i.length;if(!(arguments.length<2)){for(u=e?at:it,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,s=u.length;c<s;++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?ct:lt)(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)}};const yt=ht;function pt(t){return"string"==typeof t?new ft([[document.querySelector(t)]],[document.documentElement]):new ft([[t]],st)}var vt={value:()=>{}};function dt(){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 bt(r)}function bt(t){this._=t}function mt(t,e){for(var n,r=0,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function gt(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=vt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}bt.prototype=dt.prototype={constructor:bt,on:function(t,e){var n,r,o=this._,i=(r=o,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(n=(t=i[a]).type)o[n]=gt(o[n],t.name,e);else if(null==e)for(n in o)o[n]=gt(o[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=mt(o[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new bt(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)}};const wt=dt,xt={capture:!0,passive:!1};function St(t){t.preventDefault(),t.stopImmediatePropagation()}function Ot(t){return((t=Math.exp(t))+1/t)/2}const _t=function t(e,n,r){function o(t,o){var i,a,u=t[0],l=t[1],c=t[2],s=o[0],f=o[1],h=o[2],y=s-u,p=f-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),b=(h*h-c*c+r*v)/(2*c*n*d),m=(h*h-c*c-r*v)/(2*h*n*d),g=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-g)/e,i=function(t){var r,o=t*a,i=Ot(g),s=c/(n*d)*(i*(r=e*o+g,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[u+s*y,l+s*p,c*i/Ot(e*o+g)]}}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);function jt(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]}var Pt,kt,Tt=0,Ct=0,Et=0,At=0,Mt=0,zt=0,Rt="object"==typeof performance&&performance.now?performance:Date,Ft="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function It(){return Mt||(Ft(Bt),Mt=Rt.now()+zt)}function Bt(){Mt=0}function Lt(){this._call=this._time=this._next=null}function Nt(t,e,n){var r=new Lt;return r.restart(t,e,n),r}function Dt(){Mt=(At=Rt.now())+zt,Tt=Ct=0;try{!function(){It(),++Tt;for(var t,e=Pt;e;)(t=Mt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Tt}()}finally{Tt=0,function(){for(var t,e,n=Pt,r=1/0;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:Pt=e);kt=t,Ut(r)}(),Mt=0}}function Gt(){var t=Rt.now(),e=t-At;e>1e3&&(zt-=e,At=t)}function Ut(t){Tt||(Ct&&(Ct=clearTimeout(Ct)),t-Mt>24?(t<1/0&&(Ct=setTimeout(Dt,t-Rt.now()-zt)),Et&&(Et=clearInterval(Et))):(Et||(At=Rt.now(),Et=setInterval(Gt,1e3)),Tt=1,Ft(Dt)))}function Wt(t,e,n){var r=new Lt;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Lt.prototype=Nt.prototype={constructor:Lt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?It():+n)+(null==e?0:+e),this._next||kt===this||(kt?kt._next=this:Pt=this,kt=this),this._call=t,this._time=n,Ut()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ut())}};var $t=wt("start","end","cancel","interrupt"),Ht=[];function qt(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,s,f,h;if(1!==n.state)return u();for(c in o)if((h=o[c]).name===n.name){if(3===h.state)return Wt(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(Wt(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(f=n.tween.length),c=0,s=-1;c<f;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++s]=h);r.length=s+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=Nt(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:$t,tween:Ht,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Yt(t,e){var n=Xt(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Vt(t,e){var n=Xt(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Xt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Zt(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}}function Jt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Kt,Qt=180/Math.PI,te={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ee(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)*Qt,skewX:Math.atan(l)*Qt,scaleX:a,scaleY:u}}function ne(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:Jt(t,o)},{i:l-2,x:Jt(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:Jt(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:Jt(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:Jt(t,n)},{i:u-2,x:Jt(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 re=ne(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?te:ee(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),oe=ne(function(t){return null==t?te:(Kt||(Kt=document.createElementNS("http://www.w3.org/2000/svg","g")),Kt.setAttribute("transform",t),(t=Kt.transform.baseVal.consolidate())?ee((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):te)},", ",")",")");function ie(t,e){var n,r;return function(){var o=Vt(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 ae(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=Vt(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 ue(t,e,n){var r=t._id;return t.each(function(){var t=Vt(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Xt(t,r).value[e]}}function le(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ce(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function se(){}var fe=.7,he=1/fe,ye="\\s*([+-]?\\d+)\\s*",pe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ve="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",de=/^#([0-9a-f]{3,8})$/,be=new RegExp(`^rgb\\(${ye},${ye},${ye}\\)$`),me=new RegExp(`^rgb\\(${ve},${ve},${ve}\\)$`),ge=new RegExp(`^rgba\\(${ye},${ye},${ye},${pe}\\)$`),we=new RegExp(`^rgba\\(${ve},${ve},${ve},${pe}\\)$`),xe=new RegExp(`^hsl\\(${pe},${ve},${ve}\\)$`),Se=new RegExp(`^hsla\\(${pe},${ve},${ve},${pe}\\)$`),Oe={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 _e(){return this.rgb().formatHex()}function je(){return this.rgb().formatRgb()}function Pe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=de.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ke(e):3===n?new Ae(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Te(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Te(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=be.exec(t))?new Ae(e[1],e[2],e[3],1):(e=me.exec(t))?new Ae(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ge.exec(t))?Te(e[1],e[2],e[3],e[4]):(e=we.exec(t))?Te(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=xe.exec(t))?Be(e[1],e[2]/100,e[3]/100,1):(e=Se.exec(t))?Be(e[1],e[2]/100,e[3]/100,e[4]):Oe.hasOwnProperty(t)?ke(Oe[t]):"transparent"===t?new Ae(NaN,NaN,NaN,0):null}function ke(t){return new Ae(t>>16&255,t>>8&255,255&t,1)}function Te(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ae(t,e,n,r)}function Ce(t){return t instanceof se||(t=Pe(t)),t?new Ae((t=t.rgb()).r,t.g,t.b,t.opacity):new Ae}function Ee(t,e,n,r){return 1===arguments.length?Ce(t):new Ae(t,e,n,null==r?1:r)}function Ae(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Me(){return`#${Ie(this.r)}${Ie(this.g)}${Ie(this.b)}`}function ze(){const t=Re(this.opacity);return`${1===t?"rgb(":"rgba("}${Fe(this.r)}, ${Fe(this.g)}, ${Fe(this.b)}${1===t?")":`, ${t})`}`}function Re(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ie(t){return((t=Fe(t))<16?"0":"")+t.toString(16)}function Be(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ne(t,e,n,r)}function Le(t){if(t instanceof Ne)return new Ne(t.h,t.s,t.l,t.opacity);if(t instanceof se||(t=Pe(t)),!t)return new Ne;if(t instanceof Ne)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 Ne(a,u,l,t.opacity)}function Ne(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function De(t){return(t=(t||0)%360)<0?t+360:t}function Ge(t){return Math.max(0,Math.min(1,t||0))}function Ue(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 We(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}le(se,Pe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:_e,formatHex:_e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Le(this).formatHsl()},formatRgb:je,toString:je}),le(Ae,Ee,ce(se,{brighter(t){return t=null==t?he:Math.pow(he,t),new Ae(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?fe:Math.pow(fe,t),new Ae(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ae(Fe(this.r),Fe(this.g),Fe(this.b),Re(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:Me,formatHex:Me,formatHex8:function(){return`#${Ie(this.r)}${Ie(this.g)}${Ie(this.b)}${Ie(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ze,toString:ze})),le(Ne,function(t,e,n,r){return 1===arguments.length?Le(t):new Ne(t,e,n,null==r?1:r)},ce(se,{brighter(t){return t=null==t?he:Math.pow(he,t),new Ne(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?fe:Math.pow(fe,t),new Ne(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 Ae(Ue(t>=240?t-240:t+120,o,r),Ue(t,o,r),Ue(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Ne(De(this.h),Ge(this.s),Ge(this.l),Re(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=Re(this.opacity);return`${1===t?"hsl(":"hsla("}${De(this.h)}, ${100*Ge(this.s)}%, ${100*Ge(this.l)}%${1===t?")":`, ${t})`}`}}));const $e=t=>()=>t;function He(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):$e(isNaN(t)?e:t)}const qe=function t(e){var n=function(t){return 1===(t=+t)?He: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):$e(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Ee(t)).r,(e=Ee(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=He(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 Ye(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=Ee(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+""}}}Ye(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 We((n-r/e)*e,a,o,i,u)}}),Ye(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 We((n-r/e)*e,o,i,a,u)}});var Ve=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xe=new RegExp(Ve.source,"g");function Ze(t,e){var n,r,o,i=Ve.lastIndex=Xe.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=Ve.exec(t))&&(r=Xe.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:Jt(n,r)})),i=Xe.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("")})}function Je(t,e){var n;return("number"==typeof e?Jt:e instanceof Pe?qe:(n=Pe(e))?(e=n,qe):Ze)(t,e)}function Ke(t){return function(){this.removeAttribute(t)}}function Qe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tn(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 en(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 nn(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 rn(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 on(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,o)),n}return o._value=e,o}function an(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,o)),n}return o._value=e,o}function un(t,e){return function(){Yt(this,t).delay=+e.apply(this,arguments)}}function ln(t,e){return e=+e,function(){Yt(this,t).delay=e}}function cn(t,e){return function(){Vt(this,t).duration=+e.apply(this,arguments)}}function sn(t,e){return e=+e,function(){Vt(this,t).duration=e}}var fn=yt.prototype.constructor;function hn(t){return function(){this.style.removeProperty(t)}}var yn=0;function pn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function vn(){return++yn}var dn=yt.prototype;pn.prototype=function(t){return yt().transition(t)}.prototype={constructor:pn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=r(t));for(var o=this._groups,i=o.length,a=new Array(i),u=0;u<i;++u)for(var l,c,s=o[u],f=s.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=s[y])&&(c=t.call(l,l.__data__,y,s))&&("__data__"in l&&(c.__data__=l.__data__),h[y]=c,qt(h[y],e,n,y,h,Xt(l,n)));return new pn(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=i(t));for(var r=this._groups,o=r.length,a=[],u=[],l=0;l<o;++l)for(var c,s=r[l],f=s.length,h=0;h<f;++h)if(c=s[h]){for(var y,p=t.call(c,c.__data__,h,s),v=Xt(c,n),d=0,b=p.length;d<b;++d)(y=p[d])&&qt(y,e,n,d,p,v);a.push(p),u.push(c)}return new pn(a,u,e,n)},selectChild:dn.selectChild,selectChildren:dn.selectChildren,filter:function(t){"function"!=typeof t&&(t=a(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,u=e[o],l=u.length,c=r[o]=[],s=0;s<l;++s)(i=u[s])&&t.call(i,i.__data__,s,u)&&c.push(i);return new pn(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],s=n[u],f=c.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=c[y]||s[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new pn(a,this._parents,this._name,this._id)},selection:function(){return new fn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=vn(),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 s=Xt(a,e);qt(a,t,n,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new pn(r,this._parents,t,n)},call:dn.call,nodes:dn.nodes,node:dn.node,size:dn.size,empty:dn.empty,each:dn.each,on:function(t,e){var n=this._id;return arguments.length<2?Xt(this.node(),n).on.on(t):this.each(function(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)?Yt:Vt;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(e,n),a.on=o}}(n,t,e))},attr:function(t,e){var n=x(t),r="transform"===n?oe:Je;return this.attrTween(t,"function"==typeof e?(n.local?rn:nn)(n,r,ue(this,"attr."+t,e)):null==e?(n.local?Qe:Ke)(n):(n.local?en:tn)(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=x(t);return this.tween(n,(r.local?on:an)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?re:Je;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=M(this,t),a=(this.style.removeProperty(t),M(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,hn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=M(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=M(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,ue(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=Vt(this,t),c=l.on,s=null==l.value[a]?i||(i=hn(e)):void 0;c===n&&o===s||(r=(n=c).copy()).on(u,o=s),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,o,i=n+"";return function(){var a=M(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,function(t,e,n){var r,o;function i(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,i,n)),r}return i._value=e,i}(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}}(ue(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,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(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 r,o=Xt(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?ie:ae)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?un:ln)(e,t)):Xt(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?cn:sn)(e,t)):Xt(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Vt(this,t).ease=e}}(e,t)):Xt(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;Vt(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=Vt(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]:dn[Symbol.iterator]};var bn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function mn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}yt.prototype.interrupt=function(t){return this.each(function(){Zt(this,t)})},yt.prototype.transition=function(t){var e,n;t instanceof pn?(e=t._id,t=t._name):(e=vn(),(n=bn).time=It(),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||mn(a,e));return new pn(r,this._parents,t,e)};const gn=t=>()=>t;function wn(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 xn(t,e,n){this.k=t,this.x=e,this.y=n}xn.prototype={constructor:xn,scale:function(t){return 1===t?this:new xn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new xn(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 Sn=new xn(1,0,0);function On(t){t.stopImmediatePropagation()}function _n(t){t.preventDefault(),t.stopImmediatePropagation()}function jn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Pn(){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 kn(){return this.__zoom||Sn}function Tn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Cn(){return navigator.maxTouchPoints||"ontouchstart"in this}function En(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))}function An(t){return An="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},An(t)}function Mn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zn(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,Rn(r.key),r)}}function Rn(t){var e=function(t){if("object"!=An(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=An(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==An(e)?e:e+""}xn.prototype;var Fn=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.opts=a||{},this.canvas=e,this.canvas.style.cursor="grab",this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.offscreenCanvas=document.createElement("canvas"),this.offscreenCanvas.width=this.w,this.offscreenCanvas.height=this.h;var u=this.canvas.getContext("2d"),l=this.offscreenCanvas.getContext("2d");if(!u)throw"Impossible to create canvas 2D context";if(!l)throw"Impossible to create canvas 2D context";if(this.ctx=u,this.offscreenCtx=l,this.view={x:r,y:o,z:i},this.backgroundColor=a.backgroundColor||"white",this.onZoomStartFun=a.onZoomStartFun,this.onZoomEndFun=a.onZoomEndFun,this.onZoomFun=a.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!a.disableZoom){var c=Sn;(function(){var t,e,n,r=jn,o=Pn,i=En,a=Tn,u=Cn,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,f=_t,h=wt("start","zoom","end"),y=0,p=10;function v(t){t.property("__zoom",kn).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",_).filter(u).on("touchstart.zoom",j).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",k).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 xn(e,t.x,t.y)}function b(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 xn(t.k,r,o)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function g(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?m(u):"function"==typeof n?n.apply(t,i):n,c=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=t.__zoom,h="function"==typeof e?e.apply(t,i):e,y=f(s.invert(l).concat(c/s.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 xn(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)))),s=jt(t);if(n.wheel)n.mouse[0][0]===s[0]&&n.mouse[0][1]===s[1]||(n.mouse[1]=o.invert(n.mouse[0]=s)),clearTimeout(n.wheel);else{if(o.k===u)return;n.mouse=[s,o.invert(s)],Zt(this),n.start()}_n(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(b(d(o,u),n.mouse[0],n.mouse[1]),n.extent,c))}}function O(t,...e){if(!n&&r.apply(this,arguments)){var o=t.currentTarget,a=w(this,e,!0).event(t),u=pt(t.view).on("mousemove.zoom",function(t){if(_n(t),!a.moved){var e=t.clientX-s,n=t.clientY-f;a.moved=e*e+n*n>y}a.event(t).zoom("mouse",i(b(a.that.__zoom,a.mouse[0]=jt(t,o),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){u.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=pt(t).on("dragstart.drag",null);e&&(r.on("click.drag",St,xt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,a.moved),_n(t),a.event(t).end()},!0),l=jt(t,o),s=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=pt(t).on("dragstart.drag",St,xt);"onselectstart"in e?n.on("selectstart.drag",St,xt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),On(t),a.mouse=[l,this.__zoom.invert(l)],Zt(this),a.start()}}function _(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=jt(t.changedTouches?t.changedTouches[0]:t,this),u=n.invert(a),l=n.k*(t.shiftKey?.5:2),f=i(b(d(n,l),a,u),o.apply(this,e),c);_n(t),s>0?pt(this).transition().duration(s).call(g,f,a,t):pt(this).call(v.transform,f,a,t)}}function j(n,...o){if(r.apply(this,arguments)){var i,a,u,l,c=n.touches,s=c.length,f=w(this,o,n.changedTouches.length===s).event(n);for(On(n),a=0;a<s;++a)l=[l=jt(u=c[a],this),this.__zoom.invert(l),u.identifier],f.touch0?f.touch1||f.touch0[2]===l[2]||(f.touch1=l,f.taps=0):(f.touch0=l,i=!0,f.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(f.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),Zt(this),f.start())}}function P(t,...e){if(this.__zooming){var n,r,o,a,u=w(this,e).event(t),l=t.changedTouches,s=l.length;for(_n(t),n=0;n<s;++n)o=jt(r=l[n],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 f=u.touch0[0],h=u.touch0[1],y=u.touch1[0],p=u.touch1[1],v=(v=y[0]-f[0])*v+(v=y[1]-f[1])*v,m=(m=p[0]-h[0])*m+(m=p[1]-h[1])*m;r=d(r,Math.sqrt(v/m)),o=[(f[0]+y[0])/2,(f[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(b(r,o,a),u.extent,c))}}function k(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(On(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=jt(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<p)){var c=pt(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",kn),t!==o?g(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(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},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?m(t):"function"==typeof n?n.apply(this,arguments):n,u=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return i(b(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?m(t):"function"==typeof r?r.apply(this,arguments):r;return i(Sn.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=pt(this.that).datum();h.call(t,this.that,new wn(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:gn(+t),v):a},v.filter=function(t){return arguments.length?(r="function"==typeof t?t:gn(!!t),v):r},v.touchable=function(t){return arguments.length?(u="function"==typeof t?t:gn(!!t),v):u},v.extent=function(t){return arguments.length?(o="function"==typeof t?t:gn([[+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?(s=+t,v):s},v.interpolate=function(t){return arguments.length?(f=t,v):f},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})().wheelDelta(function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)}).on("zoom",function(t){n._isZooming=!0;var e=t.transform,r=c.k/e.k;if(1==r){var o=c.x-e.x,i=c.y-e.y;n.applyPan(o*n.view.z,-i*n.view.z)}else s(t,r);c=e,n.onZoomFun&&n.onZoomFun(t)}).on("start",function(t){var e;try{n.canvas.style.cursor="grabbing"}catch(t){}n._isZooming=!0,n.canvasSave.c=document.createElement("canvas"),n.canvasSave.c.setAttribute("width",""+n.w),n.canvasSave.c.setAttribute("height",""+n.h),null===(e=n.canvasSave.c.getContext("2d"))||void 0===e||e.drawImage(n.canvas,0,0),n.canvasSave.dx=0,n.canvasSave.dy=0,n.canvasSave.f=1,n.canvasSave.view={x:n.view.x,y:n.view.y,z:n.view.z},n.onZoomStartFun&&n.onZoomStartFun(t)}).on("end",function(t){try{n.canvas.style.cursor="grab"}catch(t){}n._isZooming=!1,n.redraw(),n.canvasSave={c:null,dx:0,dy:0,f:1},n.onZoomEndFun&&n.onZoomEndFun(t)})(pt(this.canvas));var s=function(t,e){n.cancelCurrentRequests();var r=t.sourceEvent;if(r instanceof WheelEvent)n.applyZoom(e,n.pixToGeoX(r.offsetX),n.pixToGeoY(r.offsetY));else if(r instanceof TouchEvent){var o,i=0,a=0,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Mn(t,e);var n={}.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)?Mn(t,e):void 0}}(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}}}}(r.targetTouches);try{for(u.s();!(o=u.n()).done;){var l=o.value;i+=l.clientX,a+=l.clientY}}catch(t){u.e(t)}finally{u.f()}i/=r.targetTouches.length,a/=r.targetTouches.length,n.applyZoom(e,n.pixToGeoX(i),n.pixToGeoY(a))}}}this.xMin=a.centerExtent?a.centerExtent[0]:void 0,this.yMin=a.centerExtent?a.centerExtent[1]:void 0,this.xMax=a.centerExtent?a.centerExtent[2]:void 0,this.yMax=a.centerExtent?a.centerExtent[3]:void 0,this.zoomExtent=a.zoomExtent||[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}return e=t,n=[{key:"applyPan",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;null!=this.xMin&&this.view.x+t<this.xMin&&(t=this.xMin-this.view.x),null!=this.yMin&&this.view.y+e<this.yMin&&(e=this.yMin-this.view.y),null!=this.xMax&&this.view.x+t>this.xMax&&(t=this.xMax-this.view.x),null!=this.yMax&&this.view.y+e>this.yMax&&(e=this.yMax-this.view.y),this.view.x+=t,this.view.y+=e,this.updateExtentGeo(),this.canvasSave.c?this._drawSnapshot():console.log("no canvas save")}},{key:"applyZoom",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.view.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.view.y;if(!(this.zoomExtent[0]==this.view.z&&t<=1||this.zoomExtent[1]==this.view.z&&t>=1)){var r=t*this.view.z;r<this.zoomExtent[0]&&(t=this.zoomExtent[0]/this.view.z),r>this.zoomExtent[1]&&(t=this.zoomExtent[1]/this.view.z),this.view.z*=t;var o=(e-this.view.x)*(1-t),i=(n-this.view.y)*(1-t);null!=this.xMin&&this.view.x+o<this.xMin&&(o=this.xMin-this.view.x),null!=this.yMin&&this.view.y+i<this.yMin&&(i=this.yMin-this.view.y),null!=this.xMax&&this.view.x+o>this.xMax&&(o=this.xMax-this.view.x),null!=this.yMax&&this.view.y+i>this.yMax&&(i=this.yMax-this.view.y),this.view.x+=o,this.view.y+=i,this.updateExtentGeo(),this._drawZoomFrame(t,e,n)}}},{key:"_drawZoomFrame",value:function(){this.canvasSave.c&&this._drawSnapshot()}},{key:"_drawSnapshot",value:function(){var t=this.canvasSave.view,e=t?t.z/this.view.z:1,n=t?(t.x-.5*this.w*t.z-this.view.x)/this.view.z+.5*this.w:0,r=t?.5*this.h-(t.y+.5*this.h*t.z-this.view.y)/this.view.z:0;this.canvasSave.f=e,this.canvasSave.dx=n,this.canvasSave.dy=r,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,n,r,e*this.canvasSave.c.width,e*this.canvasSave.c.height),this.ctx.drawImage(this.offscreenCanvas,0,0,this.canvas.width,this.canvas.height)}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"white";this.opts.transparentBackground?(this.ctx.clearRect(0,0,this.w,this.h),this.offscreenCtx.clearRect(0,0,this.w,this.h)):(this.ctx&&(this.ctx.fillStyle=t),this.offscreenCtx&&(this.offscreenCtx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h),this.offscreenCtx.fillRect(0,0,this.w,this.h))}},{key:"getView",value:function(){return this.view}},{key:"setCenterExtent",value:function(t){this.xMin=t[0],this.yMin=t[1],this.xMax=t[2],this.yMax=t[3]}},{key:"getCenterExtent",value:function(){return[this.xMin,this.yMin,this.xMax,this.yMax]}},{key:"setZoomExtent",value:function(t){this.zoomExtent=t}},{key:"getZoomExtent",value:function(){return this.zoomExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0),this.offscreenCtx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.view.z,e=-this.view.x/this.view.z+.5*this.w,n=this.view.y/this.view.z+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n),this.offscreenCtx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.view.z),e=2/(this.h*this.view.z);return[t,0,0,0,e,0,-t*this.view.x,-e*this.view.y,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"cancelCurrentRequests",value:function(){throw new Error("Method cancelCurrentRequests not implemented.")}},{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.view.x)/this.view.z+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.view.y)/this.view.z+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.view.z+this.view.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.view.z+this.view.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z");null==e||null==e||isNaN(+e)||(this.view.x=+e),null==n||null==n||isNaN(+n)||(this.view.y=+n),null==r||null==r||isNaN(+r)||(this.view.z=+r)}}],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&&zn(e.prototype,n),r&&zn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function In(t){return In="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},In(t)}function Bn(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,Ln(r.key),r)}}function Ln(t){var e=function(t){if("object"!=In(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:e+""}var Nn=function(){return t=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.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"]||"0px",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.yMouseOffset=e.yMouseOffset||0,this.xMouseOffset=e.xMouseOffset||0,this.parentElement=e.parentElement||document.body,this.tooltipElement=e.tooltipElement||null,this.tooltip=e.tooltipElement?pt(e.tooltipElement):pt(this.parentElement).append("div").attr("id","gridviz-tooltip").attr("class","gridviz-tooltip"),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"),this.tooltip.style("text-wrap","nowrap"),this.tooltip.style("z-index",99999999),this.tooltip.style("left","0"),this.tooltip.style("top","0"),this.tooltip.classed("gridviz-tooltip",!0),this.tooltip.attr("role","tooltip").attr("aria-live","polite")},e=[{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){var e=this.parentElement.getBoundingClientRect(),n=t.clientX-e.left+this.xOffset,r=t.clientY-e.top-this.yOffset;this.tooltip.style("left",n+"px").style("top",r+"px"),this.ensureTooltipInsideContainer(t,e,this.tooltip.node())}},{key:"ensureTooltipInsideContainer",value:function(t,e,n){var r=n,o=e.width,i=e.height;if(r.offsetLeft+r.clientWidth>o){var a=t.clientX-r.clientWidth-this.xOffset;r.style.left=a+"px"}r.offsetTop+r.clientHeight>i&&(r.style.top=i-r.clientHeight+"px"),r.offsetTop<0&&(r.style.top="0px"),r.offsetLeft<0&&(r.style.left="0px")}},{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)}}],e&&Bn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Dn(t){return Dn="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},Dn(t)}function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Un(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,Wn(r.key),r)}}function Wn(t){var e=function(t){if("object"!=Dn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Dn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Dn(e)?e:e+""}var $n=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e.map,this.parentNode=e.parentNode||e.map.container,e.id&&(this.div=pt("#"+e.id)),this.div&&!this.div.empty()||(this.div=pt(document.createElement("div")),e.id&&this.div.attr("id",e.id)),e.title&&this.div.attr("title",e.title),this.div.classed("gridviz-button",!0),e.class){var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gn(t,e);var n={}.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)?Gn(t,e):void 0}}(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}}}}(String(e.class).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}e.onClickFunction&&this.div.on("click",e.onClickFunction),this.style("box-shadow","0 7px 8px rgba(0,47,103,.08), 0 0 22px rgba(0,47,103,.04), 0 12px 17px rgba(0,47,103,.04), 0 -4px 4px rgba(0,47,103,.04)"),this.style("background-color","#ffffff"),this.style("position","absolute"),this.style("cursor","pointer"),this.style("display","flex"),this.style("justify-content","center"),this.style("align-items","center"),this.style("width","35px"),this.style("height","30px"),this.parentNode.appendChild(this.div.node())},(e=[{key:"style",value:function(t,e){return this.div.style(t,e),this}}])&&Un(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Hn(t){return Hn="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},Hn(t)}function qn(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,Yn(r.key),r)}}function Yn(t){var e=function(t){if("object"!=Hn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hn(e)?e:e+""}function Vn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vn=function(){return!!t})()}function Xn(t){return Xn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xn(t)}function Zn(t,e){return Zn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zn(t,e)}var Jn=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Xn(e),function(t,e){if(e&&("object"==Hn(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)}(t,Vn()?Reflect.construct(e,n||[],Xn(t).constructor):e.apply(t,n))}(this,e,[t])).onZoom=t.onZoom,n.delta=t.delta||.2,n.div.classed("gridviz-zoom-buttons",!0),n.zoomInBtn=document.createElement("a"),n.zoomInBtn.id="zoom-in",n.zoomInBtn.className="gridviz-zoom-button gridviz-zoom-button--in",n.zoomInBtn.title="Zoom in",n.zoomInBtn.textContent="+",n.zoomInBtn.addEventListener("click",function(t){n.zoomIn(t)}),n.zoomInBtn.addEventListener("mouseover",function(){n.zoomInBtn.style.backgroundColor="lightgrey"}),n.zoomInBtn.addEventListener("mouseout",function(){n.zoomInBtn.style.backgroundColor="#ffffff"}),n.zoomOutBtn=document.createElement("a"),n.zoomOutBtn.id="zoom-out",n.zoomOutBtn.className="gridviz-zoom-button gridviz-zoom-button--out",n.zoomOutBtn.title="Zoom out",n.zoomOutBtn.textContent="-",n.zoomOutBtn.addEventListener("click",function(t){n.zoomOut(t)}),n.zoomOutBtn.addEventListener("mouseover",function(){n.zoomOutBtn.style.backgroundColor="lightgrey"}),n.zoomOutBtn.addEventListener("mouseout",function(){n.zoomOutBtn.style.backgroundColor="#ffffff"}),[n.zoomInBtn,n.zoomOutBtn].forEach(function(t,e){t.style.alignItems="center",t.style.justifyContent="center",t.style.display="flex",t.style.border="none",t.style.color="black",t.style.textAlign="center",t.style.textDecoration="none",t.style.padding="4px",t.style.fontSize="24px",t.style.fontWeight="bold",t.style.userSelect="none",t.style.backgroundColor="#ffffff",0===e&&(t.style.borderBottom="1px solid grey")}),n.style("height","unset"),n.style("display","unset"),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","10px"),n.div.node().appendChild(n.zoomInBtn),n.div.node().appendChild(n.zoomOutBtn),n}return 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&&Zn(t,e)}(e,t),n=e,r=[{key:"zoomIn",value:function(t){this.map.setZoom(this.map.getZoom()*(1-this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}},{key:"zoomOut",value:function(t){this.map.setZoom(this.map.getZoom()*(1+this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}}],r&&qn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}($n);function Kn(t){return Kn="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},Kn(t)}function Qn(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,rr(r.key),r)}}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function nr(t,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nr(t,e)}function rr(t){var e=function(t){if("object"!=Kn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Kn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kn(e)?e:e+""}var or=function(t){function e(t){var n,r,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=er(e),function(t,e){if(e&&("object"==Kn(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)}(t,tr()?Reflect.construct(e,n||[],er(t).constructor):e.apply(t,n))}(this,e,[t]),r=n,i=!1,(o=rr(o="isFullscreen"))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,n.div.classed("gridviz-fullscreen-button",!0),n.div.node().innerHTML='\n <svg\n class="gridviz-fullscreen-icon"\n style="height: 1.2rem; width: 1.2rem; fill:black; margin:0;"\n focusable="false"\n aria-hidden="true"\n >\n <svg fill="#000000" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg">\n <title/>\n <g>\n <path d="M30,0H6A5.9966,5.9966,0,0,0,0,6V30a6,6,0,0,0,12,0V12H30A6,6,0,0,0,30,0Z"/>\n <path d="M90,0H66a6,6,0,0,0,0,12H84V30a6,6,0,0,0,12,0V6A5.9966,5.9966,0,0,0,90,0Z"/>\n <path d="M30,84H12V66A6,6,0,0,0,0,66V90a5.9966,5.9966,0,0,0,6,6H30a6,6,0,0,0,0-12Z"/>\n <path d="M90,60a5.9966,5.9966,0,0,0-6,6V84H66a6,6,0,0,0,0,12H90a5.9966,5.9966,0,0,0,6-6V66A5.9966,5.9966,0,0,0,90,60Z"/>\n </g>\n </svg>\n </svg>\n ',n.defaultHeight=n.map.h,n.defaultWidth=n.map.w,n.div.on("click",function(t){n.onClickFunction(t)}),n.div.on("mouseover",function(t){n.style("background-color","lightgrey")}),n.div.on("mouseout",function(t){n.style("background-color","#ffffff")}),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","90px"),n}return 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&&nr(t,e)}(e,t),n=e,(r=[{key:"onClickFunction",value:function(t){this.isFullscreen?(this.closeFullscreen(this.map.container),this.map.h=this.defaultHeight,this.map.w=this.defaultWidth,this.map.geoCanvas.h=this.defaultHeight,this.map.geoCanvas.w=this.defaultWidth,this.map.geoCanvas.canvas.setAttribute("width",""+this.defaultWidth),this.map.geoCanvas.canvas.setAttribute("height",""+this.defaultHeight),this.map.redraw(),this.isFullscreen=!1):(this.openFullscreen(this.map.container),this.map.h=window.screen.height,this.map.w=window.screen.width,this.isFullscreen=!0)}},{key:"openFullscreen",value:function(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}},{key:"closeFullscreen",value:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()}}])&&Qn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}($n);function ir(t){return ir="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},ir(t)}function ar(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ur(t,e);var n={}.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)?ur(t,e):void 0}}(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 ur(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,cr(r.key),r)}}function cr(t){var e=function(t){if("object"!=ir(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ir(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ir(e)?e:e+""}var sr=function(){return t=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=n.layers||[],this.asyncRedraw=!!n.asyncRedraw,this._redrawFrame=null,this.container=e||document.getElementById("gridviz"),this.container){this.container.classList.add("gridviz-map"),this.container.style.position="relative",this.w=n.w||this.container.offsetWidth,this.h=n.h||this.container.offsetHeight,this._canvas=n.canvas||this.initialiseCanvas(),this.geoCanvas=new Fn(this._canvas,n.x,n.y,n.z,n),this.geoCanvas.redraw=function(){r.redraw()},this.geoCanvas.cancelCurrentRequests=function(){var t,e=ar(r.layers);try{for(e.s();!(t=e.n()).done;){var n,o,i,a=t.value;if(null!==(n=a.dataset)&&void 0!==n&&n.datasets){var u,l,c=ar(null===(u=a.dataset)||void 0===u?void 0:u.datasets);try{for(c.s();!(l=c.n()).done;){var s=l.value;null!=s&&s.cancelCurrentRequests&&s.cancelCurrentRequests()}}catch(t){c.e(t)}finally{c.f()}}null!==(o=a.dataset)&&void 0!==o&&o.cancelCurrentRequests&&(null===(i=a.dataset)||void 0===i||i.cancelCurrentRequests())}}catch(t){e.e(t)}finally{e.f()}},this.legend=n.legendContainer?pt(n.legendContainer):null,this._legendProvidedByUser=!!n.legendContainer,this.onLegendUpdate=n.onLegendUpdate,this.legend||this.initialiseLegend(),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=this.container),this.tooltip=new Nn(n.tooltip),this.digForTooltip=n.digForTooltip||!1,this._focusFrame=null,this._focusEvent=null;var o=function(t){r._focusEvent=t,r._focusFrame||(r._focusFrame=requestAnimationFrame(function(){r._focusFrame=null;var t=r._focusEvent;r._focusEvent=null,t&&r.focusCell(t)}))};this.mouseOverHandler=o,this.mouseMoveHandler=o,this.mouseOutHandler=function(t){r._focusFrame&&cancelAnimationFrame(r._focusFrame),r._focusFrame=null,r._focusEvent=null,r.tooltip.hide()},this.geoCanvas.canvas.addEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.addEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.addEventListener("mouseout",this.mouseOutHandler),this.defineResizeObserver(),this.geoCanvas.onZoomStartFun=function(t){n.onZoomStartFun&&n.onZoomStartFun(t),r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"#FF6347",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||function(){return 4},this.transparentBackground=n.transparentBackground,this.defaultGlobalCompositeOperation=n.defaultGlobalCompositeOperation||this.geoCanvas.ctx.globalCompositeOperation}else console.error("Cannot find gridviz container element.")},e=[{key:"initialiseCanvas",value:function(){var t=document.createElement("canvas");return t.classList.add("gridviz-canvas"),t.setAttribute("width",""+this.w),t.setAttribute("height",""+this.h),this.container.appendChild(t),t}},{key:"initialiseLegend",value:function(){this.legend=pt(this.container).append("div").attr("id","gridviz-legend").classed("gridviz-legends",!0).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFF").style("border","0px").style("box-shadow","3px 3px 3px grey, -3px -3px 3px #ddd").style("font-family","Helvetica, Arial, sans-serif").style("bottom","15px").style("right","15px")}},{key:"layers_",value:function(t){return 0===arguments.length?this.layers:(1===arguments.length?Array.isArray(t)?this.layers=t:this.layers=[t]:this.layers=arguments,this)}},{key:"redraw",value:function(){var t=this;return this.asyncRedraw?(this._redrawFrame||this._destroyed||(this._redrawFrame=requestAnimationFrame(function(){t._redrawFrame=null,t.redrawNow()})),this):this.redrawNow()}},{key:"redrawNow",value:function(){if(this._redrawFrame&&cancelAnimationFrame(this._redrawFrame),this._redrawFrame=null,this._destroyed)return this;this.legend&&(this.legend.selectAll(":scope > *:not([data-gridviz-hovered])").remove(),this.legend.node()._gridvizLegendCursor=null),this.geoCanvas.initCanvasTransform(),this.geoCanvas.clear(this.geoCanvas.backgroundColor);var t=this.geoCanvas.view.z;this.updateExtentGeo();var e,n=this.geoCanvas.offscreenCtx,r=ar(this.layers);try{for(r.s();!(e=r.n()).done;){var o=e.value;o.visible&&!o.visible(t)||((o.alpha||o.blendOperation)&&(n.save(),o.alpha&&(n.globalAlpha=o.alpha(t)),o.blendOperation&&(n.globalCompositeOperation=o.blendOperation(t))),this.geoCanvas.setCanvasTransform(),o.draw(this.geoCanvas,this.legend),o.filterColor&&o.drawFilter(this.geoCanvas),(o.alpha||o.blendOperation)&&n.restore())}}catch(t){r.e(t)}finally{r.f()}return this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),this.canvasSave=null,this._focusedCell=void 0,this.onLegendUpdate&&this.legend&&this.onLegendUpdate(this.legend.node()),this}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.geoCanvas.updateExtentGeo(t)}},{key:"focusCell",value:function(t){if(!this.geoCanvas._isZooming){var e={x:this.geoCanvas.pixToGeoX(t.offsetX+this.tooltip.xMouseOffset),y:this.geoCanvas.pixToGeoY(t.offsetY+this.tooltip.yMouseOffset)},n=this.getCellFocusInfo(e),r=n?n.cell:null;if(r!==this._focusedCell)if(this._focusedCell=r,this.transparentBackground)if(this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.clearRect(0,0,this.w,this.h),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),n){this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show();var o=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4,i=this.geoCanvas.ctx;i.save(),i.strokeStyle=this.selectionRectangleColor,i.lineWidth=o,i.beginPath();var a=this.geoCanvas.geoToPixX(n.cell.x),u=this.geoCanvas.geoToPixY(n.cell.y),l=n.resolution/this.geoCanvas.view.z,c=-l;i.rect(a-o/2,u+o/2,l+o,c-o),i.stroke(),i.restore()}else this.tooltip.hide();else if(n){var s;this.geoCanvas.canvas.style.cursor="pointer",this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show(),this.canvasSave?this.geoCanvas.offscreenCtx.drawImage(this.canvasSave,0,0):(this.canvasSave=document.createElement("canvas"),this.canvasSave.setAttribute("width",""+this.w),this.canvasSave.setAttribute("height",""+this.h),null===(s=this.canvasSave.getContext("2d"))||void 0===s||s.drawImage(this.geoCanvas.offscreenCanvas,0,0));var f=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4;this.geoCanvas.initCanvasTransform();var h=this.geoCanvas.offscreenCtx;h.strokeStyle=this.selectionRectangleColor,h.lineWidth=f,h.beginPath(),h.rect(this.geoCanvas.geoToPixX(n.cell.x)-f/2,this.geoCanvas.geoToPixY(n.cell.y)+f/2,n.resolution/this.geoCanvas.view.z+f,-n.resolution/this.geoCanvas.view.z-f),h.stroke(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0)}else this.geoCanvas.canvas.style.cursor="default",this.tooltip.hide(),this.canvasSave&&this.geoCanvas.ctx.drawImage(this.canvasSave,0,0);else n?(this.tooltip.setPosition(t),this.tooltip.show()):this.tooltip.hide()}}},{key:"getCellFocusInfo",value:function(t){for(var e=this.geoCanvas.view.z,n=this.layers.length-1;n>=0;n--){var r=this.layers[n];if((!r.visible||r.visible(e))&&"none"!==r.cellInfoHTML&&r.cellInfoHTML&&r.getDataset){var o=r.getDataset(e);if(o){var i=o.getCellFromPosition(t,o.getViewCache());if(!i){if(this.digForTooltip)continue;return}if(o.mixedResolution){var a=+o.mixedResolution(i),u=r.cellInfoHTML(i,a);if(!u)return;return{cell:i,html:u,resolution:a}}var l=r.cellInfoHTML(i,o.getResolution());if(!l)return;return{cell:i,html:l,resolution:o.getResolution()}}}}}},{key:"setView",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.geoCanvas.view.x=t,this.geoCanvas.view.y=e,null!=n&&(this.geoCanvas.view.z=n),this}},{key:"getView",value:function(){return this.geoCanvas.view}},{key:"getZoom",value:function(){return this.geoCanvas.view.z}},{key:"setZoom",value:function(t){return this.geoCanvas.view.z=t,this}},{key:"getCenterExtent",value:function(){return this.geoCanvas.getCenterExtent()}},{key:"setCenterExtent",value:function(t){return this.geoCanvas.setCenterExtent(t),this}},{key:"getZoomExtent",value:function(){return this.geoCanvas.getZoomExtent()}},{key:"setZoomExtent",value:function(t){return this.geoCanvas.setZoomExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.geoCanvas.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.geoCanvas.backgroundColor=t,this}},{key:"addZoomButtons",value:function(t){return this.zoomButtons=new Jn({map:this,id:(null==t?void 0:t.id)||"gridviz-zoom-buttons-"+this.container.id,class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y,onZoom:null==t?void 0:t.onZoom,delta:(null==t?void 0:t.delta)||.2}),this}},{key:"addFullscreenButton",value:function(t){return this.fullscreenButton=new or({map:this,id:(null==t?void 0:t.id)||"gridviz-fullscreen-button",class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y}),this}},{key:"setViewFromURL",value:function(){return this.geoCanvas.setViewFromURL(),this}},{key:"defineResizeObserver",value:function(){var t=this,e=!1,n=new ResizeObserver(function(n){if(Array.isArray(n)&&n.length){var r=t.container;r.clientWidth>0&&r.clientHeight>0&&(e||(e=!0,window.requestAnimationFrame(function(){e=!1,t.h===r.clientHeight&&t.w===r.clientWidth||(t.h=r.clientHeight,t.w=r.clientWidth,t.geoCanvas.h=t.h,t.geoCanvas.w=t.w,t.geoCanvas.canvas.setAttribute("width",String(t.w)),t.geoCanvas.canvas.setAttribute("height",String(t.h)),t.geoCanvas.offscreenCanvas.setAttribute("width",String(t.w)),t.geoCanvas.offscreenCanvas.setAttribute("height",String(t.h)),t.redraw())})))}});n.observe(this.container),this._resizeObserver=n}},{key:"destroy",value:function(){var t,e;this._destroyed=!0,this.layers=[],this.bgLayers=[],this._redrawFrame&&cancelAnimationFrame(this._redrawFrame),this._redrawFrame=null,this._focusFrame&&cancelAnimationFrame(this._focusFrame),this._focusFrame=null,this._resizeObserver&&this._resizeObserver.disconnect(),this._resizeObserver=null,this.geoCanvas.canvas.removeEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.removeEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.removeEventListener("mouseout",this.mouseOutHandler),this.geoCanvas.canvas.remove(),this._legendProvidedByUser||null===(e=this.legend)||void 0===e||e.remove(),null===(t=this.tooltip.tooltip)||void 0===t||t.remove()}}],e&&lr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();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},fr(t)}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,yr(r.key),r)}}function yr(t){var e=function(t){if("object"!=fr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fr(e)?e:e+""}var pr=function(){return t=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.visible=e.visible,this.alpha=e.alpha,this.blendOperation=e.blendOperation,this.filterColor=e.filterColor,this.filterBlendOperation=e.filterBlendOperation},(e=[{key:"drawFilter",value:function(t){if(this.filterColor){var e=this.filterColor(t.view.z);if(e&&"none"!=e){t.offscreenCtx.fillStyle=e;var n=void 0,r=void 0;this.filterBlendOperation&&(n=t.offscreenCtx.globalCompositeOperation,r=this.filterBlendOperation(t.view.z)),r&&"none"!=r&&(t.offscreenCtx.globalCompositeOperation=r),t.offscreenCtx.fillRect(0,0,t.w,t.h),n&&(t.offscreenCtx.globalCompositeOperation=n)}}}}])&&hr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function vr(t){return vr="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},vr(t)}function dr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return br(t,e);var n={}.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)?br(t,e):void 0}}(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 br(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mr(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,gr(r.key),r)}}function gr(t){var e=function(t){if("object"!=vr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vr(e)?e:e+""}function wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wr=function(){return!!t})()}function xr(t){return xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xr(t)}function Sr(t,e){return Sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sr(t,e)}var Or=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=xr(e),function(t,e){if(e&&("object"==vr(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)}(t,wr()?Reflect.construct(e,n||[],xr(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.viewScale=t.viewScale,n.filter=t.filter||void 0,n.offset=t.offset||function(t,e,n){return{dx:0,dy:0}},n.drawFun=t.drawFun,n.legends=[],n.highlightColors=null,n}return 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&&Sr(t,e)}(e,t),n=e,o=[{key:"normalizeColor",value:function(t){var n=e._normalizedColors.get(t);if(void 0===n){var r=Pe(t);n=r?r.formatRgb():String(t),e._normalizedColors.size>1e4&&e._normalizedColors.clear(),e._normalizedColors.set(t,n)}return n}},{key:"updateLegendsRecursive",value:function(t,e){if(Array.isArray(t)){var n,r=dr(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;this.updateLegendsRecursive(o,e)}}catch(t){r.e(t)}finally{r.f()}}else t.update(e)}}],(r=[{key:"setHighlight",value:function(t){return this.highlightColors=t&&t.length?t.map(e.normalizeColor):null,this}},{key:"isHighlighted",value:function(t){return!this.highlightColors||this.highlightColors.includes(e.normalizeColor(t))}},{key:"draw",value:function(t,e,n){if(!this.drawFun)throw new Error("Method draw not implemented.");this.drawFun(t,e,n)}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){return this.highlightColors||e.updateLegendsRecursive(this.legends,t),this}},{key:"addLegends",value:function(t){var e,n=dr(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.legends.push(r)}}catch(t){n.e(t)}finally{n.f()}return this}}])&&mr(n.prototype,r),o&&mr(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(pr);function _r(t){return _r="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},_r(t)}function jr(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,Pr(r.key),r)}}function Pr(t){var e=function(t){if("object"!=_r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_r(e)?e:e+""}function kr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(kr=function(){return!!t})()}function Tr(t){return Tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tr(t)}function Cr(t,e){return Cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cr(t,e)}Or._normalizedColors=new Map;var Er=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Tr(e),function(t,e){if(e&&("object"==_r(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)}(t,kr()?Reflect.construct(e,n||[],Tr(t).constructor):e.apply(t,n))}(this,e,arguments)}return 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&&Cr(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){throw new Error("Method draw not implemented.")}}])&&jr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(pr);function Ar(t){return Ar="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},Ar(t)}function Mr(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Rr(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 zr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Rr(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 Rr(t,e){if(t){if("string"==typeof t)return Fr(t,e);var n={}.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)?Fr(t,e):void 0}}function Fr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ir(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,Br(r.key),r)}}function Br(t){var e=function(t){if("object"!=Ar(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ar(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ar(e)?e:e+""}var Lr=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e,this.url=n,this.resolution=r,this.mixedResolution=o.mixedResolution,this.preprocess=o.preprocess||void 0,this.cellsViewCache=[]},e=[{key:"getData",value:function(){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){if(this.mixedResolution){var n,r=zr(e);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=+this.mixedResolution(o);if(!(t.x<o.x||o.x+i<t.x||t.y<o.y||o.y+i<t.y))return o}}catch(t){r.e(t)}finally{r.f()}}else{var a=this.getResolution(),u=this.cellIndex(e,a);if(u)for(var l=(t.x-u.ox)/a,c=(t.y-u.oy)/a,s=Math.floor(l),f=Math.floor(c),h=0,y=[[0,0],[-1,0],[0,-1],[-1,-1]];h<y.length;h++){var p=Mr(y[h],2),v=p[0],d=p[1];if(!(v&&l!==s||d&&c!==f)){var b=u.cells.get(Nr(s+v,f+d));if(b)return b}}else{var m,g=zr(e);try{for(g.s();!(m=g.n()).done;){var w=m.value;if(!(t.x<w.x||w.x+a<t.x||t.y<w.y||w.y+a<t.y))return w}}catch(t){g.e(t)}finally{g.f()}}}}},{key:"cellIndex",value:function(t,e){if(this._index&&this._indexCells===t&&this._indexLength===t.length&&this._indexR===e)return this._index;var n=null;if(t.length&&e>0){var r=+t[0].x,o=+t[0].y,i=new Map;n={cells:i,ox:r,oy:o};var a,u=zr(t);try{for(u.s();!(a=u.n()).done;){var l=a.value,c=(+l.x-r)/e,s=(+l.y-o)/e,f=Math.round(c),h=Math.round(s);if(Math.abs(c-f)>1e-6||Math.abs(s-h)>1e-6){n=null;break}var y=Nr(f,h);i.has(y)||i.set(y,l)}}catch(t){u.e(t)}finally{u.f()}}return this._index=n,this._indexCells=t,this._indexLength=t.length,this._indexR=e,n}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}},{key:"getDataset",value:function(t,e){return this}}],e&&Ir(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Nr(t,e){return 4194304*t+e}function Dr(t){return Dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dr(t)}function Gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ur(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,Wr(r.key),r)}}function Wr(t){var e=function(t){if("object"!=Dr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Dr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Dr(e)?e:e+""}var $r=function(){return t=function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.resolutions=e,this.datasets="function"==typeof n?this.resolutions.map(n):n,this.datasets.length>1&&this.datasets.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasets.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)},(e=[{key:"getDataset",value:function(t,e){if(1==this.datasets.length)return this.datasets[0];for(var n=this.resolutions,r=0,o=n[r]/e;o<t&&r<n.length;)o=n[++r]/e;return r==n.length?this.datasets[n.length-1]:this.datasets[r]}},{key:"setPrepocesses",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gr(t,e);var n={}.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)?Gr(t,e):void 0}}(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}}}}(this.datasets);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&Ur(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Hr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function qr(t,e){return fetch(t,e).then(Hr)}var Yr={},Vr={};function Xr(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Zr(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 Jr(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Kr(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 s(){if(l)return Vr;if(c)return c=!1,Yr;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=s())!==Vr;){for(var f=[];r!==Yr&&r!==Vr;)f.push(r),r=s();e&&null==(f=e(f,u++))||o.push(f)}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?(o=(n=t).getUTCHours(),i=n.getUTCMinutes(),a=n.getUTCSeconds(),u=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((r=n.getUTCFullYear())<0?"-"+Jr(-r,6):r>9999?"+"+Jr(r,6):Jr(r,4))+"-"+Jr(n.getUTCMonth()+1,2)+"-"+Jr(n.getUTCDate(),2)+(u?"T"+Jr(o,2)+":"+Jr(i,2)+":"+Jr(a,2)+"."+Jr(u,3)+"Z":a?"T"+Jr(o,2)+":"+Jr(i,2)+":"+Jr(a,2)+"Z":i||o?"T"+Jr(o,2)+":"+Jr(i,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,r,o,i,a,u}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=Xr(t);return function(r,o){return e(n(r),o,t)}}(t,e):Xr(t)});return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=Zr(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Zr(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var Qr=Kr(","),to=Qr.parse,eo=(Qr.parseRows,Qr.format,Qr.formatBody,Qr.formatRows,Qr.formatRow,Qr.formatValue,Kr("\t")),no=eo.parse;function ro(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function oo(t,e){return fetch(t,e).then(ro)}function io(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),oo(e,n).then(function(e){return t(e,r)})}}function ao(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var o=Kr(t);return oo(e,n).then(function(t){return o.parse(t,r)})}eo.parseRows,eo.format,eo.formatBody,eo.formatRows,eo.formatRow,eo.formatValue;var uo=io(to);function lo(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(co(t)+" is not iterable")}function co(t){return co="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},co(t)}function so(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=fo(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 fo(t,e){if(t){if("string"==typeof t)return ho(t,e);var n={}.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)?ho(t,e):void 0}}function ho(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return po(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(po(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,po(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,po(f,"constructor",c),po(c,"constructor",l),l.displayName="GeneratorFunction",po(c,o,"GeneratorFunction"),po(f),po(f,o,"Generator"),po(f,r,function(){return this}),po(f,"toString",function(){return"[object Generator]"}),(yo=function(){return{w:i,m:h}})()}function po(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}po=function(t,e,n,r){function i(e,n){po(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},po(t,e,n,r)}function vo(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function bo(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){vo(i,r,o,a,u,"next",t)}function u(t){vo(i,r,o,a,u,"throw",t)}a(void 0)})}}function mo(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,go(r.key),r)}}function go(t){var e=function(t){if("object"!=co(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=co(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==co(e)?e:e+""}function wo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wo=function(){return!!t})()}function xo(t){return xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xo(t)}function So(t,e){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},So(t,e)}io(no);var Oo=new Set,_o=0,jo=function(){return"undefined"!=typeof performance?performance.now():Date.now()},Po=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=function(t,e,n){return e=xo(e),function(t,e){if(e&&("object"==co(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)}(t,wo()?Reflect.construct(e,n||[],xo(t).constructor):e.apply(t,n))}(this,e,[t,n,0,o])).onlyDrawWhenAllTilesReady=o.onlyDrawWhenAllTilesReady||!1,r.info=void 0,r.infoLoadingStatus="notLoaded",r.cache={},r.loadInfo(),r}return 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&&So(t,e)}(e,t),n=e,r=[{key:"loadInfo",value:function(){var t=this;return this.info||"notLoaded"!==this.infoLoadingStatus||(this.infoLoadingStatus="loading",bo(yo().m(function e(){var n;return yo().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,qr(t.url+"info.json");case 1:n=e.v,t.info=n,t.resolution=n.resolutionGeo,t.infoLoadingStatus="loaded",t.isShown()&&t.map.redraw(),e.n=3;break;case 2:e.p=2,e.v,t.infoLoadingStatus="failed";case 3:return e.a(2)}},e,null,[[0,2]])}))()),this}},{key:"isShown",value:function(){if(!this.map||!this.map.layers)return!1;var t,e=this.map.getZoom(),n=so(this.map.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;if((!r.visible||r.visible(e))&&r.getDataset&&r.getDataset(e)==this)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{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()}},{key:"getData",value:(i=bo(yo().m(function t(e){var n,r,o,i,a,u,l,c,s,f,h,y,p,v,d,b,m=this;return yo().w(function(t){for(;;)switch(t.n){case 0:if(this.info){t.n=1;break}return t.a(2,this);case 1:if(this.abortController=new AbortController,n=this.abortController.signal,r=this.getTilingEnvelope(e)){t.n=2;break}return t.a(2,this);case 2:o=this.info.tilingBounds,i=o.xMin,a=o.xMax,u=o.yMin,l=o.yMax,c=Math.max(r.xMin,i),s=Math.min(r.xMax,a),f=Math.max(r.yMin,u),h=Math.min(r.yMax,l),y=(s-c+1)*(h-f+1),p=0,v=[],d=yo().m(function t(e){var r,o;return yo().w(function(t){for(;;)switch(t.n){case 0:r=yo().m(function t(r){return yo().w(function(t){for(;;)switch(t.n){case 0:if(m.cache[e]||(m.cache[e]={}),!m.cache[e][r]||"failed"===m.cache[e][r]){t.n=1;break}return"object"===co(m.cache[e][r])&&(m.cache[e][r].lastUsed=jo()),++p,t.a(2,1);case 1:m.cache[e][r]="loading",v.push(m.loadTile(e,r,n).then(function(t){m.cache[e][r]=t,m._keep(t);var n=++p===y;m.checkAndRedraw(t,n)}).catch(function(){m.cache[e][r]="failed",++p}));case 2:return t.a(2)}},t)}),o=f;case 1:if(!(o<=h)){t.n=4;break}return t.d(lo(r(o)),2);case 2:if(!t.v){t.n=3;break}return t.a(3,3);case 3:o++,t.n=1;break;case 4:return t.a(2)}},t)}),b=c;case 3:if(!(b<=s)){t.n=5;break}return t.d(lo(d(b)),4);case 4:b++,t.n=3;break;case 5:return t.n=6,Promise.allSettled(v);case 6:return t.a(2,this)}},t,this)})),function(t){return i.apply(this,arguments)})},{key:"loadTile",value:(o=bo(yo().m(function t(e,n,r){var o,i,a,u=this;return yo().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,uo("".concat(this.url).concat(e,"/").concat(n,".csv"),{signal:r});case 1:if(o=t.v,i=this.preprocess?o.filter(function(t){return!1!==u.preprocess(t)}):o,this.info){t.n=2;break}throw new Error("Tile info unknown");case 2:return t.a(2,ko(i,e,n,this.info));case 3:throw t.p=3,"AbortError"===(a=t.v).name&&console.warn("Tile request for ".concat(e,", ").concat(n," was aborted.")),a;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e,n){return o.apply(this,arguments)})},{key:"cancelCurrentRequests",value:function(){this.abortController&&this.abortController.abort()}},{key:"checkAndRedraw",value:function(t,e){if(this.isShown()){var n=this.map.updateExtentGeo(),r=t.extGeo,o=r.xMin,i=r.xMax,a=r.yMin,u=r.yMax;n.xMax<=o||n.xMin>=i||n.yMax<=a||n.yMin>=u||(this.onlyDrawWhenAllTilesReady?e&&this.map.redraw():this.map.redraw())}}},{key:"_keep",value:function(t){if(t&&"object"===co(t)&&t.cells&&(t.lastUsed=jo(),t.owner=this,Oo.add(t),!((_o+=t.cells.length)<=e.maxCachedCells))){var n,r=jo()-3e3,o=function(t){return function(t){if(Array.isArray(t))return ho(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||fo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Oo).filter(function(t){return t.lastUsed<r}).sort(function(t,e){return t.lastUsed-e.lastUsed}),i=so(o);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(_o<=e.maxCachedCells)break;a.owner._drop(a)}}catch(t){i.e(t)}finally{i.f()}}}},{key:"_drop",value:function(t){var e=this.cache[t.x];e&&e[t.y]===t&&(delete e[t.y],Object.keys(e).length||delete this.cache[t.x]),Oo.delete(t)&&(_o-=t.cells.length),t.owner=void 0,t.cells=[]}},{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){i.lastUsed=jo();var a,u=so(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()}}}}}}],r&&mo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Lr);function ko(t,e,n,r){var o={};o.cells=t,o.x=e,o.y=n;var i=r.resolutionGeo,a=r.tileSizeCell;o.extGeo={xMin:r.originPoint.x+i*a*o.x,xMax:r.originPoint.x+i*a*(o.x+1),yMin:r.originPoint.y+i*a*o.y,yMax:r.originPoint.y+i*a*(o.y+1)};var u,l=so(o.cells);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.x=o.extGeo.xMin+c.x*i,c.y=o.extGeo.yMin+c.y*i}}catch(t){l.e(t)}finally{l.f()}return o}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},To(t)}function Co(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Eo(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Eo(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Eo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Eo(f,"constructor",c),Eo(c,"constructor",l),l.displayName="GeneratorFunction",Eo(c,o,"GeneratorFunction"),Eo(f),Eo(f,o,"Generator"),Eo(f,r,function(){return this}),Eo(f,"toString",function(){return"[object Generator]"}),(Co=function(){return{w:i,m:h}})()}function Eo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Eo=function(t,e,n,r){function i(e,n){Eo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Eo(t,e,n,r)}function Ao(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Mo(t,e);var n={}.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)?Mo(t,e):void 0}}(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 Mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zo(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Ro(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,Fo(r.key),r)}}function Fo(t){var e=function(t){if("object"!=To(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=To(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==To(e)?e:e+""}function Io(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Io=function(){return!!t})()}function Bo(t){return Bo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bo(t)}function Lo(t,e){return Lo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lo(t,e)}Po.maxCachedCells=15e5;var No=function(t){function e(t,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,n){return e=Bo(e),function(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)}(t,Io()?Reflect.construct(e,n||[],Bo(t).constructor):e.apply(t,n))}(this,e,[t,n,r,i])).cells=[],o.delimiter=i.delimiter||",",o.infoLoadingStatus="notLoaded",o.getData(void 0),o}return 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&&Lo(t,e)}(e,t),n=e,r=[{key:"getData",value:function(t){var e,n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(e=Co().m(function t(){var e,r,o,i,a,u,l,c;return Co().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,ao(n.delimiter,n.url);case 1:e=t.v,r=Ao(e);try{for(r.s();!(o=r.n()).done;)(i=o.value).x=+i.x,i.y=+i.y}catch(t){r.e(t)}finally{r.f()}if(!n.preprocess){t.n=10;break}n.cells=[],a=Ao(e),t.p=2,a.s();case 3:if((u=a.n()).done){t.n=6;break}if(l=u.value,0!=n.preprocess(l)){t.n=4;break}return t.a(3,5);case 4:n.cells.push(l);case 5:t.n=3;break;case 6:t.n=8;break;case 7:t.p=7,c=t.v,a.e(c);case 8:return t.p=8,a.f(),t.f(8);case 9:t.n=11;break;case 10:n.cells=e;case 11:n.map&&n.map.redraw(),n.infoLoadingStatus="loaded",t.n=13;break;case 12:t.p=12,t.v,n.infoLoadingStatus="failed",n.cells=[];case 13:return t.a(2)}},t,null,[[2,7,8,9],[0,12]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){zo(i,r,o,a,u,"next",t)}function u(t){zo(i,r,o,a,u,"throw",t)}a(void 0)})})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Ao(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()}}}}],r&&Ro(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lr);function Do(t){return Do="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},Do(t)}function Go(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uo(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,Wo(r.key),r)}}function Wo(t){var e=function(t){if("object"!=Do(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Do(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Do(e)?e:e+""}function $o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($o=function(){return!!t})()}function Ho(t){return Ho=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ho(t)}function qo(t,e){return qo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qo(t,e)}var Yo=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=function(t,e,n){return e=Ho(e),function(t,e){if(e&&("object"==Do(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)}(t,$o()?Reflect.construct(e,n||[],Ho(t).constructor):e.apply(t,n))}(this,e,[void 0,"",t,o])).cells=n||[],r}return 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&&qo(t,e)}(e,t),n=e,(r=[{key:"getData",value:function(t){return this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Go(t,e);var n={}.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)?Go(t,e):void 0}}(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}}}}(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()}}}}])&&Uo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lr);function Vo(t){return Vo="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},Vo(t)}function Xo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Zo(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,Jo(r.key),r)}}function Jo(t){var e=function(t){if("object"!=Vo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Vo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Vo(e)?e:e+""}function Ko(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ko=function(){return!!t})()}function Qo(t){return Qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qo(t)}function ti(t,e){return ti=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ti(t,e)}var ei=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Qo(e),function(t,e){if(e&&("object"==Vo(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)}(t,Ko()?Reflect.construct(e,n||[],Qo(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||"#EA6BAC",n.size=t.size||function(t,e){return e},n.shape=t.shape||"square",n}return 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&&ti(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=.5*n,u=this.highlightColors,l="function"==typeof this.color,c="function"==typeof this.size,s="function"==typeof this.shape,f=this.color||"black",h=this.size||n,y=this.shape||"square",p=l?this.color:null,v=c?this.size:null,d=s?this.shape:null,b=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Xo(t,e);var n={}.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)?Xo(t,e):void 0}}(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(b.s();!(r=b.n()).done;){var m=r.value,g=p?p(m,n,o,i):f;if(g&&"none"!==g&&(!u||this.isHighlighted(g))){var w=v?v(m,n,o,i):h;if(w){var x=d?d(m,n,o,i):y;if("none"!==x){var S=this.offset(m,n,o),O=e.offscreenCtx;if(O.fillStyle=g,"square"===x){var _=n*(1-w/n)*.5;O.fillRect(m.x+_+S.dx,m.y+_+S.dy,w,w)}else if("circle"===x)O.beginPath(),O.arc(m.x+a+S.dx,m.y+a+S.dy,.5*w,0,2*Math.PI,!1),O.fill();else if("donut"===x){var j=m.x+a+S.dx,P=m.y+a+S.dy;O.beginPath(),O.moveTo(j,P),O.arc(j,P,a,0,2*Math.PI),O.arc(j,P,(1-w/n)*a,0,2*Math.PI,!0),O.closePath(),O.fill()}else if("diamond"===x){var k=.5*w;O.beginPath(),O.moveTo(m.x+a-k,m.y+a),O.lineTo(m.x+a,m.y+a+k),O.lineTo(m.x+a+k,m.y+a),O.lineTo(m.x+a,m.y+a-k),O.fill()}else if("triangle_up"===x){var T=(w-n)/2;O.beginPath(),O.moveTo(m.x-T,m.y-T),O.lineTo(m.x+a,m.y+n+T),O.lineTo(m.x+n+T,m.y-T),O.fill()}else if("triangle_down"===x){var C=(w-n)/2;O.beginPath(),O.moveTo(m.x-C,m.y+n+C),O.lineTo(m.x+a,m.y-C),O.lineTo(m.x+n+C,m.y+n+C),O.fill()}else if("triangle_left"===x){var E=(w-n)/2;O.beginPath(),O.moveTo(m.x+n+E,m.y+n+E),O.lineTo(m.x-E,m.y+a),O.lineTo(m.x+n+E,m.y-E),O.fill()}else{if("triangle_right"!==x)throw new Error("Unexpected shape:"+x);var A=(w-n)/2;O.beginPath(),O.moveTo(m.x-A,m.y-A),O.lineTo(m.x+n+A,m.y+a),O.lineTo(m.x-A,m.y+n+A),O.fill()}}}}}}catch(t){b.e(t)}finally{b.f()}this.updateLegends({viewScale:i,resolution:n,z:o,cells:t})}}],r&&Zo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function ni(t){return ni="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},ni(t)}function ri(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function oi(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,ii(r.key),r)}}function ii(t){var e=function(t){if("object"!=ni(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ni(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ni(e)?e:e+""}function ai(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ai=function(){return!!t})()}function ui(t){return ui=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ui(t)}function li(t,e){return li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},li(t,e)}var ci=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ui(e),function(t,e){if(e&&("object"==ni(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)}(t,ai()?Reflect.construct(e,n||[],ui(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.strokeColor=t.strokeColor||function(){return"#666"},n.size=t.size||function(t,e){return e},n.strokeWidth=t.strokeWidth||function(t,e,n){return 1.5*n},n.shape=t.shape||function(){return"square"},n}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ri(t,e);var n={}.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)?ri(t,e):void 0}}(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();!(r=l.n()).done;){var c=r.value,s=this.strokeColor?this.strokeColor(c,n,o,a):void 0;if(s&&"none"!==s){i.strokeStyle=s;var f=this.size?this.size(c,n,o,a):n,h=this.strokeWidth?this.strokeWidth(c,n,o,a):1*o;if(h&&!(h<=0)){i.lineWidth=h;var y=this.shape?this.shape(c,n,o,a):"square";if("none"!==y){var p=this.offset(c,n,o);if("square"===y){var v=n*(1-f/n)*.5;i.beginPath(),i.rect(c.x+v+p.dx,c.y+v+p.dy,f,f),i.stroke()}else if("circle"===y)i.beginPath(),i.arc(c.x+u+p.dx,c.y+u+p.dy,.5*f,0,2*Math.PI,!1),i.stroke();else if("diamond"===y){var d=.5*f;i.beginPath(),i.moveTo(c.x+u-d,c.y+u),i.lineTo(c.x+u,c.y+u+d),i.lineTo(c.x+u+d,c.y+u),i.lineTo(c.x+u,c.y+u-d),i.lineTo(c.x+u-d,c.y+u),i.stroke()}else if("donut"===y)console.error("Not implemented");else if("triangle_up"===y){var b=(f-n)/2;i.beginPath(),i.moveTo(c.x-b,c.y-b),i.lineTo(c.x+u,c.y+n+b),i.lineTo(c.x+n+b,c.y-b),i.closePath(),i.stroke()}else if("triangle_down"===y){var m=(f-n)/2;i.beginPath(),i.moveTo(c.x-m,c.y+n+m),i.lineTo(c.x+u,c.y-m),i.lineTo(c.x+n+m,c.y+n+m),i.closePath(),i.stroke()}else if("triangle_left"===y){var g=(f-n)/2;i.beginPath(),i.moveTo(c.x+n+g,c.y+n+g),i.lineTo(c.x-g,c.y+u),i.lineTo(c.x+n+g,c.y-g),i.closePath(),i.stroke()}else{if("triangle_right"!==y)throw new Error("Unexpected shape:"+y);var w=(f-n)/2;i.beginPath(),i.moveTo(c.x-w,c.y-w),i.lineTo(c.x+n+w,c.y+u),i.lineTo(c.x-w,c.y+n+w),i.closePath(),i.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&oi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function si(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let o=-1;for(let i of t)null!=(i=e(i,++o,t))&&(void 0===n?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}function fi(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||yi(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 hi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=yi(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 yi(t,e){if(t){if("string"==typeof t)return pi(t,e);var n={}.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)?pi(t,e):void 0}}function pi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function vi(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[8,6,5,4,2.5,2],r=Math.pow(10,Math.floor(Math.log10(t))),o=hi(n);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(r*i<=t)return r*i}}catch(t){o.e(t)}finally{o.f()}return r}function di(t,e,n){var r=si(t,function(t){return t.x}),o=fi(r,2),i=o[0],a=o[1],u=si(t,function(t){return t.y}),l=fi(u,2),c=l[0],s=l[1],f=Math.ceil((s-c)/e)+1,h=Math.ceil((a-i)/e)+1,y=Array.from({length:f},function(){return new Array(h).fill(void 0)});y.x0=i,y.y0=s,y.resolution=e;var p,v=hi(t);try{for(v.s();!(p=v.n()).done;){var d=p.value,b=Math.floor((s-d.y)/e),m=Math.floor((d.x-i)/e),g=n?n(d):d;y[b][m]=g}}catch(t){v.e(t)}finally{v.f()}return y}function bi(t){return bi="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},bi(t)}function mi(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,gi(r.key),r)}}function gi(t){var e=function(t){if("object"!=bi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bi(e)?e:e+""}function wi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wi=function(){return!!t})()}function xi(t){return xi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xi(t)}function Si(t,e){return Si=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Si(t,e)}var Oi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=xi(e),function(t,e){if(e&&("object"==bi(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)}(t,wi()?Reflect.construct(e,n||[],xi(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height||function(t,e){return e*Math.random()},n.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},n.lineWidth=t.lineWidth||function(t,e,n,r){return r},n.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},n}return 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&&Si(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=function(t,e){var n,r={},o=hi(t);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=r[i.y];a||(a={},r[i.y]=a),a[i.x]=e?e(i):i}}catch(t){o.e(t)}finally{o.f()}return r}(t,function(t){return r.height(t,n,o,a)}),l=e.extGeo;if(l){var c=Math.floor(l.xMin/n)*n,s=Math.floor(l.xMax/n)*n,f=Math.floor(l.yMin/n)*n,h=Math.floor(l.yMax/n)*n,y={min:f,max:h};i.lineJoin="round";for(var p=h;p>=f;p-=n){var v=u[p];if(v){i.beginPath(),i.moveTo(c-n/2,p);for(var d=void 0,b=c;b<=s;b+=n){var m=v[b];m||(m=0),m||d?i.lineTo(b+n/2,p+m):i.moveTo(b+n/2,p),d=m}d&&i.lineTo(s+n/2,p);var g=this.fillColor(p,y,n,o);g&&"none"!=g&&(i.fillStyle=g,i.fill());var w=this.lineColor(p,y,n,o),x=this.lineWidth(p,y,n,o);w&&"none"!=w&&x>0&&(i.strokeStyle=w,i.lineWidth=x,i.stroke())}}}}}],r&&mi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function _i(t){return _i="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},_i(t)}function ji(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Pi(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 Pi(t,e){if(t){if("string"==typeof t)return ki(t,e);var n={}.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)?ki(t,e):void 0}}function ki(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=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,Ci(r.key),r)}}function Ci(t){var e=function(t){if("object"!=_i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_i(e)?e:e+""}function Ei(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ei=function(){return!!t})()}function Ai(t){return Ai=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ai(t)}function Mi(t,e){return Mi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mi(t,e)}var zi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ai(e),function(t,e){if(e&&("object"==_i(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)}(t,Ei()?Reflect.construct(e,n||[],Ai(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.type=t.type||function(){return"flag"},n.size=t.size||function(t,e){return e},n.stripesOrientation=t.stripesOrientation||function(){return 0},n.offsetAngle=t.offsetAngle||function(){return 0},n.agePyramidHeight=t.agePyramidHeight||function(t,e){return e},n.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,n}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.entries(this.color).length,l=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Pi(t))){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,s=this.size?this.size(c,n,o,a):n;if(s){var f=this.offset(c,n,o),h=this.type?this.type(c,n,o,a):"flag",y=c.x+f.dx+("agepyramid"===h?0:.5*n),p=c.y+f.dy+("agepyramid"===h?0:.5*n),v=this.offsetAngle?this.offsetAngle(c,n,o,a)*Math.PI/180:0;if("agepyramid"===h||"radar"===h||"halftone"===h){for(var d=-1/0,b=0,m=Object.keys(this.color);b<m.length;b++){var g=+c[m[b]];g>d&&(d=g)}var w=0;"agepyramid"===h&&this.agePyramidHeight&&(w=(n-this.agePyramidHeight(c,n,o,a))/2),"radar"!==h&&"halftone"!==h||(w=Math.PI/2+v);var x="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,n,o,a):n)/u:"radar"===h||"halftone"===h?2*Math.PI/u:void 0;if(void 0===x)throw new Error("Unexpected symbol type:"+h);for(var S=0,O=Object.entries(this.color);S<O.length;S++){var _=ji(O[S],2),j=_[0],P=_[1];if("agepyramid"===h){i.fillStyle=P;var k=s*c[j]/d;i.fillRect(y+(n-k)/2,p+w,k,x),w+=x}else if("radar"===h){i.fillStyle=P;var T=c[j],C=s/2*Math.sqrt(T/d);i.beginPath(),i.moveTo(y,p),i.arc(y,p,C,w-x,w),i.lineTo(y,p),i.fill(),w+=x}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);i.fillStyle=P;var E=c[j],A=.333*s*Math.sqrt(E/d);i.beginPath(),i.arc(y+.25*n*Math.cos(w),p+.25*n*Math.sin(w),A,0,2*Math.PI),i.fill(),w+=x}}}else{for(var M=0,z=0,R=Object.keys(this.color);z<R.length;z++){var F=+c[R[z]];F&&(M+=F)}if(!M||isNaN(M))continue;for(var I=0,B=n*(1-s/n)*.5,L=this.stripesOrientation(c,n,o,a),N=0,D=Object.entries(this.color);N<D.length;N++){var G=ji(D[N],2),U=G[0],W=G[1],$=c[U]/M;if($&&!isNaN($)){if(i.fillStyle=W,"flag"===h)0==L?i.fillRect(c.x+B+f.dx,c.y+B+I*s+f.dy,s,$*s):i.fillRect(c.x+B+I*s+f.dx,c.y+B+f.dy,$*s,s);else if("piechart"===h){var H=2*I*Math.PI,q=2*(I+$)*Math.PI;i.beginPath(),i.moveTo(y,p),i.arc(y,p,.5*s,H+v,q+v),this.pieChartInternalRadiusFactor&&i.arc(y,p,.5*s*this.pieChartInternalRadiusFactor,H+v,q+v,!0),i.closePath(),i.fill()}else if("ring"===h)i.beginPath(),i.arc(y,p,Math.sqrt(1-I)*s*.5,0,2*Math.PI),i.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var Y=s*s/n;0==L?i.fillRect(c.x+f.dx,c.y+(n-Y)/2+I*Y+f.dy,n,$*Y):i.fillRect(c.x+I*n+f.dx,c.y+(n-Y)/2+f.dy,$*n,Y)}I+=$}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&Ti(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);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},Ri(t)}function Fi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=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,Bi(r.key),r)}}function Bi(t){var e=function(t){if("object"!=Ri(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ri(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ri(e)?e:e+""}function Li(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Li=function(){return!!t})()}function Ni(t){return Ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ni(t)}function Di(t,e){return Di=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Di(t,e)}var Gi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ni(e),function(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)}(t,Li()?Reflect.construct(e,n||[],Ni(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.width=t.width||function(t,e){return.1*e},n.length=t.length||function(t,e){return.9*e},n.orientation=t.orientation||function(){return 180*Math.random()},n}return 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&&Di(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.lineCap="butt";var a,u=Math.PI/180,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Fi(t,e);var n={}.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)?Fi(t,e):void 0}}(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();!(a=l.n()).done;){var c=a.value,s=this.color?this.color(c,n,r,i):void 0;if(s){var f=this.width?this.width(c,n,r,i):void 0;if(f&&!(f<0)){var h=this.length?this.length(c,n,r,i):void 0;if(h&&!(h<0)){var y=this.orientation(c,n,r,i)*u;if(void 0!==y&&!isNaN(y)){var p=this.offset(c,n,r);o.strokeStyle=s,o.lineWidth=f;var v=c.x+n/2+p.dx,d=c.y+n/2+p.dy,b=.5*Math.cos(y)*h,m=.5*Math.sin(y)*h;o.beginPath(),o.moveTo(v-b,d-m),o.lineTo(v+b,d+m),o.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({viewScale:i,resolution:n,z:r,cells:t})}}],r&&Ii(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);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},Ui(t)}function Wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=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,Hi(r.key),r)}}function Hi(t){var e=function(t){if("object"!=Ui(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ui(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ui(e)?e:e+""}function qi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qi=function(){return!!t})()}function Yi(t){return Yi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yi(t)}function Vi(t,e){return Vi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vi(t,e)}var Xi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Yi(e),function(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)}(t,qi()?Reflect.construct(e,n||[],Yi(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.text=t.text||function(){return"X"},n.color=t.color||function(){return"black"},n.fontSize=t.fontSize||function(t,e){return e},n.fontFamily=t.fontFamily||function(){return"Arial"},n.fontWeight=t.fontWeight||function(){return"bold"},n}return 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&&Vi(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;e.initCanvasTransform();var a,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Wi(t,e);var n={}.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)?Wi(t,e):void 0}}(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(u.s();!(a=u.n()).done;){var l=a.value,c=this.text?this.text(l,n,r,i):void 0;if(null!=c&&null!=c&&c+""!=""){var s=this.color?this.color(l,n,r,i):void 0;if(s){o.fillStyle=s;var f=this.fontSize(l,n,r,i)/r;if(f){var h=this.fontFamily?this.fontFamily(l,n,r,i):"Arial",y=this.fontWeight?this.fontWeight(l,n,r,i):"bold";o.font=y+" "+f+"px "+h;var p=this.offset(l,n,r);o.textAlign="center";var v=e.geoToPixX(l.x+.5*n+p.dx),d=e.geoToPixY(l.y+.5*n+p.dy)+.3*f;o.fillText(c,v,d)}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],o=[{key:"textScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=t.length;return function(r){return e&&(r=e(r)),0==r?"":r>=1?t[n-1]:t[Math.floor(r*n)]}}}],r&&$i(n.prototype,r),o&&$i(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Or);function Zi(t){return Zi="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},Zi(t)}function Ji(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ki(t,e);var n={}.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)?Ki(t,e):void 0}}(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=Array(e);n<e;n++)r[n]=t[n];return r}function Qi(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,ta(r.key),r)}}function ta(t){var e=function(t){if("object"!=Zi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zi(e)?e:e+""}function ea(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ea=function(){return!!t})()}function na(t){return na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},na(t)}function ra(t,e){return ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ra(t,e)}var oa=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=na(e),function(t,e){if(e&&("object"==Zi(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)}(t,ea()?Reflect.construct(e,n||[],na(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height,n.color=t.color||function(){return"#c08c59"},n.width=t.width||function(t,e){return.5*e},n.simple=t.simple||function(){return!1},n.viewHeightFactor=t.viewHeightFactor||1.5,n.viewSX=null==t.viewSX?0:t.viewSX,n.viewSY=null==t.viewSY?-.5:t.viewSY,n.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,n.shadowFactor=t.shadowFactor||.3,n.shadowColor=t.shadowColor||"#00000033",n.outlineCol=t.outlineCol||"#FFFFFF",n.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix,n}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0,a=e.view.x+this.viewSX*e.w*r,u=e.view.y+this.viewSY*e.h*r,l=this.viewHeightFactor*(e.w+e.h)*.5*r;t.sort(function(t,e){return 1e8*(e.y-t.y)+t.x-e.x});var c=this.simple(n,r,i);o.lineCap=c?"butt":"round",o.strokeStyle=this.shadowColor,o.fillStyle=this.shadowColor;var s,f=Ji(t);try{for(f.s();!(s=f.n()).done;){var h=s.value,y=this.width?this.width(h,n,r,i):void 0;if(y&&!(y<0)){var p=this.height?this.height(h,n,r,i):void 0;if(p&&!(p<0)){o.lineWidth=y;var v=h.x+n/2,d=h.y+n/2,b=p*this.shadowFactor;o.beginPath(),o.moveTo(v,d),o.lineTo(v+b*Math.cos(this.shadowDirection),d+b*Math.sin(this.shadowDirection)),o.stroke()}}}}catch(t){f.e(t)}finally{f.f()}var m,g=Ji(t);try{for(g.s();!(m=g.n()).done;){var w=m.value,x=this.color?this.color(w,n,r,i):void 0;if(x){var S=this.width?this.width(w,n,r,i):void 0;if(S&&!(S<0)){var O=this.height?this.height(w,n,r,i):void 0;if(O&&!(O<0)){var _=w.x+n/2,j=w.y+n/2,P=_-a,k=j-u,T=Math.atan2(k,P),C=Math.sqrt(P*P+k*k)*O/(l-O);c?(o.strokeStyle=x,o.lineWidth=S,o.beginPath(),o.moveTo(_,j),o.lineTo(_+C*Math.cos(T),j+C*Math.sin(T)),o.stroke()):(o.strokeStyle=this.outlineCol,o.lineWidth=S+2*this.outlineWidthPix*r,o.beginPath(),o.moveTo(_,j),o.lineTo(_+C*Math.cos(T),j+C*Math.sin(T)),o.stroke(),o.strokeStyle=x,o.lineWidth=S,o.beginPath(),o.moveTo(_,j),o.lineTo(_+C*Math.cos(T),j+C*Math.sin(T)),o.stroke(),o.strokeStyle=this.outlineCol,o.lineWidth=this.outlineWidthPix*r,o.beginPath(),o.arc(_+C*Math.cos(T),j+C*Math.sin(T),.5*S,0,2*Math.PI,!1),o.stroke())}}}}}catch(t){g.e(t)}finally{g.f()}o.lineCap="butt",this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],r&&Qi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function ia(t){return ia="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},ia(t)}function aa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=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,la(r.key),r)}}function la(t){var e=function(t){if("object"!=ia(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ia(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ia(e)?e:e+""}function ca(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ca=function(){return!!t})()}function sa(t){return sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sa(t)}function fa(t,e){return fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fa(t,e)}var ha=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=sa(e),function(t,e){if(e&&("object"==ia(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)}(t,ca()?Reflect.construct(e,n||[],sa(t).constructor):e.apply(t,n))}(this,e,[n])).color=n.color||function(t,e,n,r){return"#EA6BAC"},t.width=n.width||function(t,e,n,r){return e/5},t.length=n.length||function(t,e,n,r){return e},t.diamond=n.diamond,t}return 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&&fa(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n,r){this.filter&&(t=t.filter(this.filter));var o=n.view.z,i=n.offscreenCtx,a=e.buildSides(t,r);if(0!=a.length){var u=this.viewScale?this.viewScale(a,r,o):void 0;i.lineCap="butt";var l,c=.5*r,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return aa(t,e);var n={}.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)?aa(t,e):void 0}}(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}}}}(a);try{for(s.s();!(l=s.n()).done;){var f=l.value,h=this.color?this.color(f,r,o,u):void 0;if(h&&"none"!=h)if(this.diamond){i.fillStyle=h;var y=f.x,p=f.y;i.beginPath(),i.moveTo(y-c,p),i.lineTo(y,p+c),i.lineTo(y+c,p),i.lineTo(y,p-c),i.closePath(),i.fill()}else{var v=this.width?this.width(f,r,o,u):void 0;if(!v||v<=0)continue;var d=this.length?this.length(f,r,o,u):void 0;if(!d||d<=0)continue;var b=.5*d;i.lineWidth=v,i.strokeStyle=h;var m=f.x,g=f.y;i.beginPath(),"v"===f.or?(i.moveTo(m,g-b),i.lineTo(m,g+b)):(i.moveTo(m-b,g),i.lineTo(m+b,g)),i.stroke()}}}catch(t){s.e(t)}finally{s.f()}this.updateLegends({style:this,resolution:r,z:o,viewScale:u})}}}],o=[{key:"buildSides",value:function(t,e){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.01,r=[],o=arguments.length>4&&void 0!==arguments[4]&&!arguments[4]?0:e/2;n*=e;var i=Math.abs;t.sort(function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x});for(var a=t[0],u=1;u<t.length;u++){var l=t[u];i(a.y+e-l.y)<n&&i(a.x-l.x)<n?r.push({or:"h",x:a.x+o,y:l.y,c1:a,c2:l}):(r.push({or:"h",x:a.x+o,y:a.y+e,c1:a,c2:void 0}),r.push({or:"h",x:l.x+o,y:l.y,c1:void 0,c2:l})),a=l}t.sort(function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y}),a=t[0];for(var c=1;c<t.length;c++){var s=t[c];i(a.x+e-s.x)<n&&i(a.y-s.y)<n?r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:s}):(r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:void 0}),r.push({or:"v",x:s.x,y:s.y+o,c1:void 0,c2:s})),a=s}return r}}],r&&ua(n.prototype,r),o&&ua(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Or),ya=new Map;function pa(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=JSON.stringify(n||{}),o=ya.get(r);return o&&!o.gl.isContextLost()||(o=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var o=n&&2==+n.version?"2":"",i=r.getContext("webgl"+o,n);if(!i)throw new Error("Unable to initialize WebGL"+o+". Your browser or machine may not support it.");return{canvas:r,gl:i,width:t,height:e}}(t+"",e+"",n),o.width=+t,o.height=+e,ya.set(r,o)),o.width==t&&o.height==e||(o.canvas.width=t,o.canvas.height=e,o.width=+t,o.height=+e),o.gl.viewport(0,0,o.width,o.height),o}var va=new WeakMap;function da(t){var e=va.get(t);return e||(e={programs:new Map,buffers:new Map,owners:new Map},va.set(t,e)),e}function ba(t,e,n){var r=da(t).programs,o=e+"\0"+n,i=r.get(o);return i||(i=function(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)")}(t,wa(t,t.VERTEX_SHADER,e),wa(t,t.FRAGMENT_SHADER,n)),r.set(o,i)),i}function ma(t,e){var n=da(t).buffers,r=n.get(e);return r||(r=t.createBuffer(),n.set(e,r)),r}function ga(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=da(t).owners;return void 0!==n&&r.set(e,n),r.get(e)}function wa(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 xa(t){return xa="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},xa(t)}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,Oa(r.key),r)}}function Oa(t){var e=function(t){if("object"!=xa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xa(e)?e:e+""}function _a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_a=function(){return!!t})()}function ja(t){return ja=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ja(t)}function Pa(t,e){return Pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pa(t,e)}var ka="SquareColorCategoryWebGLStyle.pos",Ta="SquareColorCategoryWebGLStyle.i",Ca=function(t){function e(t){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ja(e),function(t,e){if(e&&("object"==xa(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)}(t,_a()?Reflect.construct(e,n||[],ja(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,t.color=t.color||void 0;var r=Object.keys(t.color);n.catToI={};for(var o=0;o<r.length;o++)n.catToI[r[o]]=o+"";n.colors=[];for(var i=0,a=r;i<a.length;i++){var u=a[i];n.colors.push(t.color[""+u])}return n.size=t.size,n.cvWGL=void 0,n.gl=void 0,n.program=void 0,n.lutTexture=void 0,n.pointsNb=0,n.x=void 0,n.y=void 0,n.z=void 0,n.cellsNb=void 0,n.highlightKey="",n}return 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&&Pa(t,e)}(e,t),n=e,r=[{key:"init",value:function(t,e){this.cvWGL=pa(t,e);var n=this.cvWGL.gl,r=this.gl!==n;return r&&(this.gl=n,this.program=ba(n,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute float i;\n varying float vi;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }","\n precision highp float;\n varying float vi;\n uniform sampler2D colorLUT;\n uniform float lutSize;\n void main(void) {\n float idx = floor(vi + 0.5);\n float u = (idx + 0.5) / lutSize;\n gl_FragColor = texture2D(colorLUT, vec2(u, 0.5));\n }"),this.lutTexture=void 0),n.useProgram(this.program),this.bindColors(),r}},{key:"bindColors",value:function(){var t=this.cvWGL.gl,e=this.colors.length;if(!this.lutTexture){for(var n=new Uint8Array(4*e),r=0;r<e;r++){var o=Pe(this.colors[r]);n[4*r]=+o.r,n[4*r+1]=o.g,n[4*r+2]=o.b,n[4*r+3]=255*(null==o?void 0:o.opacity)}this.lutTexture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.lutTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}t.uniform1i(t.getUniformLocation(this.program,"colorLUT"),0),t.uniform1f(t.getUniformLocation(this.program,"lutSize"),e),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.lutTexture)}},{key:"bindVertices",value:function(t,e,n,r){for(var o,i=this,a=this.cvWGL.gl,u=e/2,l=t.length,c=new Float32Array(2*l),s=new Float32Array(l),f=this.highlightColors?this.colors.map(function(t){return i.isHighlighted(t)}):null,h=0,y=0;y<l;y++){o=t[y];var p=this.code(o,e,n,r);if(null!=p){var v=this.catToI[p];isNaN(+v)?console.log("Unexpected category index: "+p+" "+v):f&&!f[+v]||(c[2*h]=o.x+u,c[2*h+1]=o.y+u,s[h]=+v,h++)}}return a.bindBuffer(a.ARRAY_BUFFER,ma(a,ka)),a.bufferData(a.ARRAY_BUFFER,c.subarray(0,2*h),a.DYNAMIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,ma(a,Ta)),a.bufferData(a.ARRAY_BUFFER,s.subarray(0,h),a.DYNAMIC_DRAW),ga(a,ka,this),h}},{key:"bindAttributes",value:function(){var t=this.cvWGL.gl,e=t.getAttribLocation(this.program,"pos");t.bindBuffer(t.ARRAY_BUFFER,ma(t,ka)),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(e);var n=t.getAttribLocation(this.program,"i");t.bindBuffer(t.ARRAY_BUFFER,ma(t,Ta)),t.vertexAttribPointer(n,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n)}},{key:"mapContentChanged",value:function(t,e){return(t.x!=this.x||t.y!=this.y||t.z!=this.z||this.cellsNb!=e)&&(this.x=t.x,this.y=t.y,this.z=t.z,this.cellsNb=e,!0)}},{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.init(e.w,e.h),a=this.cvWGL.gl,u=this.cvWGL.canvas,l=this.size?this.size(n,r)/r:n/r+.2;a.uniform1f(a.getUniformLocation(this.program,"sizePix"),1*l);var c=this.highlightColors?this.highlightColors.join("|"):"",s=c!==this.highlightKey;this.highlightKey=c,(this.mapContentChanged(e.view,t.length)||s||i||ga(a,ka)!==this)&&(this.pointsNb=this.bindVertices(t,n,r,o)),this.bindAttributes(),a.uniformMatrix3fv(a.getUniformLocation(this.program,"mat"),!1,new Float32Array(e.getWebGLTransform())),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.POINTS,0,this.pointsNb),e.initCanvasTransform(),e.offscreenCtx.drawImage(u,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&Sa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function Ea(t){return Ea="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},Ea(t)}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,Ma(r.key),r)}}function Ma(t){var e=function(t){if("object"!=Ea(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ea(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ea(e)?e:e+""}function za(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(za=function(){return!!t})()}function Ra(t){return Ra=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ra(t)}function Fa(t,e){return Fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fa(t,e)}var Ia=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ra(e),function(t,e){if(e&&("object"==Ea(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)}(t,za()?Reflect.construct(e,n||[],Ra(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.elevation=t.elevation,n.sunAzimuth=t.sunAzimuth||function(){return 2.356},n.sunAltitude=t.sunAltitude||function(){return.2},n.color=t.color||function(){return"black"},n.undefinedValue=t.undefinedValue||0,n}return 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&&Fa(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=di(t,n,function(t){return r.elevation(t)}),u=a.x0,l=a.y0;a=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2.356,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.15,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,i=t.length,a=t[0].length,u=Math.sin(n),l=-Math.cos(n),c=Math.tan(r),s=Array.from({length:i},function(){return new Array(a).fill(void 0)}),f=0;f<i;f++)for(var h=0;h<a;h++){var y=t[f][h]||o;if(void 0!==y)for(var p=e;;){var v=h-u*p/e,d=f-l*p/e,b=Math.round(v),m=Math.round(d);if(b<0||m<0||b>=a||m>=i)break;var g=t[m][b]||o;if(void 0===g)break;if(g-y-c*p>0){s[f][h]=1;break}p+=e}}return s}(a,n,this.sunAzimuth(n,o,i),this.sunAltitude(n,o,i),this.undefinedValue),t=[];for(var c=0;c<a.length;c++)for(var s=a[c],f=l-c*n,h=0;h<s.length;h++)if(s[h]){var y={x:u+h*n,y:f};t.push(y)}new Ca({code:function(){return"a"},color:{a:this.color(n,o,i)}}).draw(t,e,n),this.updateLegends({style:this,resolution:n,z:o,viewScale:i})}}}],r&&Aa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function Ba(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let o of t)null!=(o=e(o,++r,t))&&(n<o||void 0===n&&o>=o)&&(n=o)}return n}function La(t){return La="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},La(t)}function Na(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Na=function(){return!!t})()}function Da(t){return Da=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Da(t)}function Ga(t,e){return Ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ga(t,e)}var Ua=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,n){return e=Da(e),function(t,e){if(e&&("object"==La(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)}(t,Na()?Reflect.construct(e,n||[],Da(t).constructor):e.apply(t,n))}(this,e,[n]);var r=n.elevation;t.viewScale=function(t){return Ba(t,function(t){return(e=t).c1&&e.c2&&e.c1[r]&&e.c2[r]?e.v=+e.c2[r]-e.c1[r]:e.v=0,e.v;var e})};var o=n.colorTopLeft||"255,255,255",i=n.colorBottomRight||"0,0,0";if(null!=n.revert&&n.revert){var a=o;o=i,i=a}var u=n.scale;return t.color=function(t,e,n,r){if(0!=t.v){var a=Math.abs(t.v/r);return u&&(a=u(a)),t.v<0&&"h"===t.or||t.v>0&&"v"===t.or?"rgba("+o+","+a+")":"rgba("+i+","+a+")"}},t.width=function(t,e,r){return n.width|Math.min(2*r,e/3)},t.diamond=n.diamond,t}return 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)}(e,t),n=e,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(ha);function Wa(t){return Wa="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},Wa(t)}function $a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ha(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,qa(r.key),r)}}function qa(t){var e=function(t){if("object"!=Wa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Wa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wa(e)?e:e+""}function Ya(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ya=function(){return!!t})()}function Va(t){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(t)}function Xa(t,e){return Xa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xa(t,e)}var Za=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Va(e),function(t,e){if(e&&("object"==Wa(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)}(t,Ya()?Reflect.construct(e,n||[],Va(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,n.color=t.color,n}return 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&&Xa(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=ha.buildSides(t,n);if(0!=i.length){var a=this.viewScale?this.viewScale(i,n,r):void 0;o.lineCap="butt";var u,l=.5*n,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return $a(t,e);var n={}.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)?$a(t,e):void 0}}(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}}}}(i);try{for(c.s();!(u=c.n()).done;){var s=u.value,f=s.c1?this.code(s.c1,n,r):void 0,h=s.c2?this.code(s.c2,n,r):void 0;if(f!=h){var y=this.width?this.width(s,n,r,a):void 0;if(y&&!(y<=0)){var p=.5*y;o.lineWidth=y,"h"===s.or?(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x-l,s.y+p),o.lineTo(s.x+l,s.y+p),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-l,s.y-p),o.lineTo(s.x+l,s.y-p),o.stroke())):(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x+p,s.y-l),o.lineTo(s.x+p,s.y+l),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-p,s.y-l),o.lineTo(s.x-p,s.y+l),o.stroke()))}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:a})}}}],r&&Ha(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ha);const Ja=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 Ka(t){return Ka="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},Ka(t)}function Qa(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,tu(r.key),r)}}function tu(t){var e=function(t){if("object"!=Ka(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ka(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ka(e)?e:e+""}var eu=function(){return t=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=ba(e,"\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 ","\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=[]},(e=[{key:"addPointData",value:function(t,e,n){var r=Pe(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.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,ma(e,"WebGLSquareColoring.pos")),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.DYNAMIC_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,ma(e,"WebGLSquareColoring.color")),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.DYNAMIC_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.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}])&&Qa(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function nu(t){return nu="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},nu(t)}function ru(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ou(t,e);var n={}.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)?ou(t,e):void 0}}(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 ou(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,au(r.key),r)}}function au(t){var e=function(t){if("object"!=nu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=nu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nu(e)?e:e+""}function uu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uu=function(){return!!t})()}function lu(t){return lu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lu(t)}function cu(t,e){return cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cu(t,e)}var su=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=lu(e),function(t,e){if(e&&("object"==nu(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)}(t,uu()?Reflect.construct(e,n||[],lu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.dotNumber=t.dotNumber||function(t,e){return e/100},n.color=t.color||function(){return"#FF5733"},n.dotSize=t.dotSize||function(t,e){return 1.5*e},n.sigma=t.sigma||function(t,e){return t/2},n}return 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&&cu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.dotSize?this.dotSize(n,r,o):r,a=this.sigma?this.sigma(n,r,o):.4*n,u=Ja(0,a),l=e.offscreenCtx;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(e.w,e.h);if(!c)return void console.error("No webGL");var s,f=new eu(c.gl,i/r),h=n/2,y=ru(t);try{for(y.s();!(s=y.n()).done;){var p=s.value,v=this.color(p,n,r,o);if(v&&"none"!==v){var d=this.dotNumber(p,n,r,o),b=this.offset(p,n,r),m=p.x+b.dx+h,g=p.y+b.dy+h,w=Pe(v);if(!w)return;for(var x=0;x<=d;x++)f.addPointData2(m+u(),g+u(),w.r,w.g,w.b,w.opacity)}}}catch(t){y.e(t)}finally{y.f()}f.draw(e.getWebGLTransform()),e.initCanvasTransform(),l.drawImage(c.canvas,0,0)}else{var S,O=ru(t);try{for(O.s();!(S=O.n()).done;){var _=S.value,j=this.color(_,n,r,o);if(j&&"none"!==j){l.fillStyle=j;for(var P=this.dotNumber(_,n,r,o),k=this.offset(_,n,r),T=_.x+k.dx+n/2,C=_.y+k.dy+n/2,E=0;E<=P;E++)l.fillRect(T+u(),C+u(),i,i)}}}catch(t){O.e(t)}finally{O.f()}}this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&iu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);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},fu(t)}function hu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yu(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,pu(r.key),r)}}function pu(t){var e=function(t){if("object"!=fu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fu(e)?e:e+""}function vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vu=function(){return!!t})()}function du(t){return du=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},du(t)}function bu(t,e){return bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bu(t,e)}var mu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=du(e),function(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)}(t,vu()?Reflect.construct(e,n||[],du(t).constructor):e.apply(t,n))}(this,e,[n])).classifier=n.classifier||function(t,e,n){return function(t){return 1}},t.width=n.width||function(t,e,n,r,o){return Math.abs(e)*r},t.length=n.length||function(t,e,n,r){return e},t.colorDark=n.colorDark||"#111",t.colorBright=n.colorBright||"#ddd",t.revert=null!=n.revert&&n.revert,t.diamond=n.diamond,t.limit=n.limit||"steep",t}return 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&&bu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.classifier(t,n,o),u=function(t){var e=t.c1?a(t.c1):void 0,n=t.c2?a(t.c2):void 0;if(void 0!==e||void 0!==n)return void 0===e?"none"==r.limit?void 0:"steep"==r.limit?n:Math.sign(n):void 0===n?"none"==r.limit?void 0:"steep"==r.limit?-e:Math.sign(-e):n-e},l=ha.buildSides(t,n);if(0!=l.length){var c=this.viewScale?this.viewScale(l,n,o):void 0;i.lineCap="butt";var s,f=.5*n,h=this.revert?this.colorBright:this.colorDark,y=this.revert?this.colorDark:this.colorBright,p=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return hu(t,e);var n={}.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)?hu(t,e):void 0}}(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}}}}(l);try{for(p.s();!(s=p.n()).done;){var v=s.value,d=u(v);if(void 0!==d&&0!==d){var b=d<0&&"h"===v.or||d>0&&"v"===v.or?y:h;if(b&&"none"!=b)if(this.diamond){i.fillStyle=b;var m=v.x,g=v.y;i.beginPath(),i.moveTo(m-f,g),i.lineTo(m,g+f),i.lineTo(m+f,g),i.lineTo(m,g-f),i.closePath(),i.fill()}else{var w=this.width?this.width(v,d,n,o,c):void 0;if(!w||w<=0)continue;var x=this.length?this.length(v,n,o,c):void 0;if(!x||x<=0)continue;var S=.5*x;i.lineWidth=w,i.strokeStyle=b;var O=v.x,_=v.y;i.beginPath(),"v"===v.or?(i.moveTo(O,_-S),i.lineTo(O,_+S)):(i.moveTo(O-S,_),i.lineTo(O+S,_)),i.stroke()}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:c})}}}],r&&yu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function gu(t){return null===t?NaN:+t}function wu(t,e,n=gu){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),a=+n(t[i],i,t);return a+(+n(t[i+1],i+1,t)-a)*(o-i)}}function xu(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Su(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Ou(t){let e,n,r;function o(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<0?o=e+1:i=e}while(o<i)}return o}return 2!==t.length?(e=xu,n=(e,n)=>xu(t(e),n),r=(e,n)=>t(e)-n):(e=t===xu||t===Su?t:_u,n=t,r=t),{left:o,center:function(t,e,n=0,i=t.length){const a=o(t,e,n,i-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<=0?o=e+1:i=e}while(o<i)}return o}}}function _u(){return 0}const ju=Ou(xu),Pu=ju.right,ku=(ju.left,Ou(gu).center,Pu);function Tu(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Cu(){var t,e=[],n=[],r=[];function o(){var t=0,o=Math.max(1,n.length);for(r=new Array(o-1);++t<o;)r[t-1]=wu(e,t/o);return i}function i(e){return null==e||isNaN(e=+e)?t:n[ku(r,e)]}return i.invertExtent=function(t){var o=n.indexOf(t);return o<0?[NaN,NaN]:[o>0?r[o-1]:e[0],o<r.length?r[o]:e[e.length-1]]},i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(xu),o()},i.range=function(t){return arguments.length?(n=Array.from(t),o()):n.slice()},i.unknown=function(e){return arguments.length?(t=e,i):t},i.quantiles=function(){return r.slice()},i.copy=function(){return Cu().domain(e).range(n).unknown(t)},Tu.apply(i,arguments)}var Eu=function(t){var e=t.valueFunction,n=t.minValue||0,r=t.minSizePix||0,o=t.maxSizeFactor||1,i=t.stretching,a=t.range,u=t.domain,l=t.classNumber;return function(t,c,s){var f=u||[n,Ba(t,e)],h=a||[r*s,c*o],y=f[1]-f[0],p=f[0],v=h[1]-h[0],d=h[0],b=function(t){return t=(t-p)/y,i&&(t=i(t)),l&&(t=1==t?1:Math.floor(t*l)/(l-1)),d+t*v};return b.invert=function(t){return i&&(t=function(t,e){if(t.invert)return t.invert(e);for(var n=0,r=1,o=0;o<50;o++){var i=(n+r)/2;t(i)<e?n=i:r=i}return(n+r)/2}(i,t)),p+t*y},b}},Au=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.minSizePix||1,o=t.maxSizeFactor||1,i=Cu();return function(t,a,u){i.domain(t.map(e));var l=r*u,c=a*o;return i.range(Array.from({length:n},function(t,e){return l+e*(c-l)/(n-1)})),i.breaks=i.quantiles(),i.values=i.range(),i}},Mu=function(t){var e,n=t.valueFunction,r=t.stretching,o=t.colorScale||function(){return"purple"},i=null===(e=t.colors)||void 0===e?void 0:e.length;return t.colors&&i&&(o=function(e){return t.colors[1==e?i-1:Math.floor(e*i)]}),function(e){if(0!=e.length&&e){var a=si(e,n);if(null!=a[0]){var u=a[1]-a[0],l=function(t){return t=(t-a[0])/u,r&&(t=r(t)),o(t)};if(l.invert=function(t){return r&&(t=r.invert(t)),a[0]+t*u},t.colors&&i){l.breaks=[];for(var c=1;c<i;c++)l.breaks.push(l.invert(c/i))}return l}}}},zu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.colors;t.colorScale&&(r=Nu(t.colorScale,n)),r=r||Array.from({length:n},function(t,e){return"rgb("+Math.floor(255*e/(n-1))+",150,150)"});var o=Cu().range(r);return function(t){return o.domain(t.map(e)),o.breaks=o.quantiles(),o.colors=r,o}},Ru=function(t){var e=t.valueFunction,n=t.classNumber||12,r=Cu().range(Array.from({length:n},function(t,e){return e}));return function(t){return r.domain(t.map(e)),r.breaks=r.quantiles(),r}},Fu=function(t){return function(e,n,r){var o={};for(var i in t)o[i]=t[i](e,n,r);return o}};function Iu(t){var e=t.length,n=function(n){for(var r=0;r<e;){if(n<=t[r])return r;r++}return r};return n.breaks=t,n}function Bu(t,e,n){for(var r=[],o=(e-t)/n,i=1;i<n;i++)r.push(t+i*o);return Iu(r)}function Lu(t,e){var n=Iu(t),r=function(t){return e[n(t)]};return r.breaks=t,r.colors=e,r}function Nu(t,e){if(1==e)return[t(.5)];for(var n=[],r=0;r<e;r++)n.push(t(r/(e-1)));return n}function Du(t){return Du="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},Du(t)}function Gu(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Uu(t,e);var n={}.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)?Uu(t,e):void 0}}(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 Uu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Wu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wu=function(){return!!t})()}function $u(t){return $u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$u(t)}function Hu(t,e){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hu(t,e)}function qu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yu(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,Xu(r.key),r)}}function Vu(t,e,n){return e&&Yu(t.prototype,e),n&&Yu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xu(t){var e=function(t){if("object"!=Du(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Du(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Du(e)?e:e+""}var Zu=function(){return Vu(function t(){qu(this,t)},null,[{key:"get",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(r=r||{}).colorDark=r.colorDark||"#333",r.colorBright=r.colorBright||"#aaa";for(var o=Iu(e),i=function(e){return o(t(e))},a={},u=0;u<n.length;u++)a[u+""]=n[u];var l=new Ca({code:i,color:a}),c=new mu({classifier:function(){return i},colorDark:r.colorDark,colorBright:r.colorBright,diamond:r.diamond});return[l,new ci({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n},filter:r.filter}),c,new Ju({colDark:r.colDark,colBright:r.colBright,filter:r.filter})]}},{key:"getCategory",value:function(t,e,n){return(n=n||{}).colDark=n.colDark||"#333",n.colBright=n.colBright||"#aaa",[new Ca({code:t,color:e}),new ci({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n}}),new Ju({colDark:n.colDark,colBright:n.colBright})]}}])}(),Ju=function(t){function e(t){var n,r,o,i;return qu(this,e),r=this,i=[t],o=$u(o=e),n=function(t,e){if(e&&("object"==Du(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)}(r,Wu()?Reflect.construct(o,i||[],$u(r).constructor):o.apply(r,i)),t=t||{},n.colDark=t.colDark||"#333",n.colBright=t.colBright||"#aaa",n}return 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&&Hu(t,e)}(e,t),Vu(e,[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.offscreenCtx;r.lineWidth=.6*e.view.z,r.strokeStyle=this.colDark;var o,i=Gu(t);try{for(i.s();!(o=i.n()).done;){var a=o.value;r.beginPath(),r.arc(a.x+.5*n,a.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!0),r.stroke()}}catch(t){i.e(t)}finally{i.f()}r.strokeStyle=this.colBright;var u,l=Gu(t);try{for(l.s();!(u=l.n()).done;){var c=u.value;r.beginPath(),r.arc(c.x+.5*n,c.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!1),r.stroke()}}catch(t){l.e(t)}finally{l.f()}}}])}(Or);function Ku(t){return Ku="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},Ku(t)}function Qu(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,tl(r.key),r)}}function tl(t){var e=function(t){if("object"!=Ku(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ku(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ku(e)?e:e+""}var el=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e;var a=[];a.push("precision mediump float;"),a.push("varying float vt;"),a.push("uniform float alpha;");for(var u=0;u<n.length;u++)a.push("uniform vec4 c"+u+";");if(a.push("void main(void) {"),r?"pow"==r.fun?a.push(" float t = pow(vt, alpha);"):"powInv"==r.fun?a.push(" float t = 1.0-pow(1.0-vt, 1.0/alpha);"):"exp"==r.fun?a.push(0==r.alpha?"float t = vt;":" float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);"):"log"==r.fun?a.push(0==r.alpha?"float t = vt;":" float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);"):"circle"==r.fun?0==r.alpha?a.push(" float t = vt;"):1==r.alpha?a.push(" float t = sqrt(vt * (2.0 - vt));"):(a.push(" float a = alpha / (1.0 - alpha);"),a.push(" float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;")):"circleInv"==r.fun?0==r.alpha?a.push(" float t = vt;"):1==r.alpha?a.push(" float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));"):(a.push(" float a = alpha / (1.0 - alpha);"),a.push(" 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.push(" float t = vt;")):a.push(" float t = vt;"),1==n.length)a.push(" vec4 cI=c0;"),a.push(" vec4 cF=c0;");else if(2==n.length)a.push(" vec4 cI=c0;"),a.push(" vec4 cF=c1;");else{var l=n.length-1,c=l+".0";a.push(" vec4 cI;"),a.push(" vec4 cF;"),a.push(" if(t<1.0/"+c+") { cI=c0; cF=c1; t=t*"+c+"; }");for(var s=2;s<l;s++)a.push(" else if(t<"+s+".0/"+c+") { cI=c"+(s-1)+"; cF=c"+s+"; t="+c+"*t-"+(s-1)+".0; }");a.push(" else { cI=c"+(l-1)+"; cF=c"+l+"; t="+c+"*t-"+(l-1)+".0; }")}1==n.length?a.push(" gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}"):a.push(" gl_FragColor = mix(cI, cF, t);}");var f=a.join("");this.program=ba(e,"\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 ",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 h=0;h<n.length;h++){var y=Pe(n[h]),p=y.opacity;1==y.opacity&&null!=i&&(p=i);var v=[+y.r/255,+y.g/255,+y.b/255,+p];e.uniform4fv(e.getUniformLocation(this.program,"c"+h),v)}},e=[{key:"draw",value:function(t,e,n){var r=this.gl,o=this.program;r.useProgram(o),r.bindBuffer(r.ARRAY_BUFFER,ma(r,"WebGLSquareColoringAdvanced.pos")),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.DYNAMIC_DRAW);var i=r.getAttribLocation(o,"pos");r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.bindBuffer(r.ARRAY_BUFFER,ma(r,"WebGLSquareColoringAdvanced.t")),r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r.DYNAMIC_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.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.POINTS,0,t.length/2)}}],e&&Qu(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function nl(t){return nl="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},nl(t)}function rl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ol(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,il(r.key),r)}}function il(t){var e=function(t){if("object"!=nl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=nl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nl(e)?e:e+""}function al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(al=function(){return!!t})()}function ul(t){return ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ul(t)}function ll(t,e){return ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ll(t,e)}var cl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ul(e),function(t,e){if(e&&("object"==nl(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)}(t,al()?Reflect.construct(e,n||[],ul(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.tFun=t.tFun,n.stretching=t.stretching,n.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&&(n.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),n.opacity=t.opacity,n.size=t.size,n}return 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&&ll(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=pa(e.w,e.h,null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(i){var a,u=n/2,l=[],c=[],s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return rl(t,e);var n={}.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)?rl(t,e):void 0}}(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(s.s();!(a=s.n()).done;){var f=a.value,h=this.tFun(f,n,r,o);null!=h&&null!=h&&(l.push(f.x+u,f.y+u),c.push(h>1?1:h<0?0:h))}}catch(t){s.e(t)}finally{s.f()}var y=this.size?this.size(n,r):n+.2*r,p=this.opacity?this.opacity(n,r):void 0;new el(i.gl,this.colors,this.stretching,y/r,p).draw(l,c,e.getWebGLTransform()),e.initCanvasTransform(),e.offscreenCtx.drawImage(i.canvas,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}else console.error("No webGL")}}],r&&ol(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function sl(t){return sl="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},sl(t)}function fl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hl(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,yl(r.key),r)}}function yl(t){var e=function(t){if("object"!=sl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sl(e)?e:e+""}function pl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pl=function(){return!!t})()}function vl(t){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vl(t)}function dl(t,e){return dl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dl(t,e)}var bl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=vl(e),function(t,e){if(e&&("object"==sl(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)}(t,pl()?Reflect.construct(e,n||[],vl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.mosaicFactor=t.mosaicFactor||.15,n.shadowFactor=t.shadowFactor||.2,n.shadowColor=t.shadowColor||"#555",n}return 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&&dl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.strokeStyle=this.shadowColor,o.lineWidth=this.shadowFactor*n,o.lineJoin="round",o.lineCap="butt";var a,u=n*this.mosaicFactor,l=function(){return{x:Math.random()*u,y:Math.random()*u}},c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fl(t,e);var n={}.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)?fl(t,e):void 0}}(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(c.s();!(a=c.n()).done;){var s=a.value,f=this.color?this.color(s,n,r,i):void 0;if(f&&"none"!==f){o.fillStyle=f;var h=this.offset(s,n,r),y=l(),p=l(),v=l(),d=l();this.shadowFactor>0&&(o.beginPath(),o.moveTo(s.x+h.dx+y.x,s.y+h.dy+y.y),o.lineTo(s.x+h.dx+n-v.x,s.y+h.dy+v.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.stroke()),o.beginPath(),o.moveTo(s.x+h.dx+y.x,s.y+h.dy+y.y),o.lineTo(s.x+h.dx+n-v.x,s.y+h.dy+v.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.lineTo(s.x+h.dx+p.x,s.y+h.dy+n-p.y),o.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],r&&hl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function ml(t){return ml="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},ml(t)}function gl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wl(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,xl(r.key),r)}}function xl(t){var e=function(t){if("object"!=ml(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ml(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ml(e)?e:e+""}function Sl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sl=function(){return!!t})()}function Ol(t){return Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ol(t)}function _l(t,e){return _l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_l(t,e)}var jl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ol(e),function(t,e){if(e&&("object"==ml(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)}(t,Sl()?Reflect.construct(e,n||[],Ol(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.size=t.size||function(t,e){return e},n.shape=t.shape||function(){return"o"},n}return 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&&_l(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return gl(t,e);var n={}.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)?gl(t,e):void 0}}(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();!(r=l.n()).done;){var c=r.value,s=this.color?this.color(c,n,o,a):void 0;if(s&&"none"!==s){i.fillStyle=s;var f=this.size(c,n,o,a),h=(f=f<0?0:f>1?1:f)*u,y=this.shape?this.shape(c):"o";if("none"!==y){var p=c.x+u,v=c.y+u;if("p"===y)i.beginPath(),i.moveTo(p,v+u),i.lineTo(p+h,v+h),i.lineTo(p+u,v),i.lineTo(p+h,v-h),i.lineTo(p,v-u),i.lineTo(p-h,v-h),i.lineTo(p-u,v),i.lineTo(p-h,v+h),i.fill();else{if("o"!==y)throw new Error("Unexpected shape:"+y);i.beginPath(),i.moveTo(p,v+h),i.lineTo(p+u,v+u),i.lineTo(p+h,v),i.lineTo(p+u,v-u),i.lineTo(p,v-h),i.lineTo(p-u,v-u),i.lineTo(p-h,v),i.lineTo(p-u,v+u),i.fill()}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&wl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function Pl(t){return Pl="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},Pl(t)}function kl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Tl(t,e);var n={}.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)?Tl(t,e):void 0}}(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 Tl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cl(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,El(r.key),r)}}function El(t){var e=function(t){if("object"!=Pl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Pl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Pl(e)?e:e+""}function Al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Al=function(){return!!t})()}function Ml(t){return Ml=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ml(t)}function zl(t,e){return zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zl(t,e)}var Rl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ml(e),function(t,e){if(e&&("object"==Pl(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)}(t,Al()?Reflect.construct(e,n||[],Ml(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.ts=t.ts,n.noData=t.noData||function(t){return void 0===t||""==t||null===t||isNaN(+t)},n.offsetX=t.offsetX||function(t,e,n){return 0},n.width=t.width||function(t,e,n){return e},n.offsetY=t.offsetY||function(t,e,n){return 0},n.height=t.height||function(t,e,n){return e},n.anchorModeY=t.anchorModeY||function(t,e,n){return"center"},n.lineWidth=t.lineWidth||function(t,e,n,r){return 1.5*r},n.color=t.color||function(){return"black"},n}return 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&&zl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o,i,a=e.view.z,u=e.offscreenCtx,l=this.viewScale?this.viewScale(t,n,a):void 0,c=function(t){var e,n,o,i=kl(r.ts);try{for(i.s();!(o=i.n()).done;){var a=t[o.value];null!=a&&((null==e||a<e)&&(e=a),(null==n||a>n)&&(n=a))}}catch(t){i.e(t)}finally{i.f()}if(null!=e)return n-e},s=kl(t);try{for(s.s();!(i=s.n()).done;){var f=c(i.value);null!=f&&(null==o||f>o)&&(o=f)}}catch(t){s.e(t)}finally{s.f()}if(o){var h=this.ts.length;u.lineCap="butt";var y,p=kl(t);try{for(p.s();!(y=p.n()).done;){var v=y.value,d=this.lineWidth?this.lineWidth(v,n,a,l):void 0;if(d&&!(d<0)){var b=this.color?this.color(v,n,a,l):void 0;if(b){var m=this.offsetX?this.offsetX(v,n,a):0;if(null!=m&&!isNaN(m)){var g=this.width?this.width(v,n,a):n;if(null!=g&&!isNaN(g)){var w=this.offsetY?this.offsetY(v,n,a):0;if(null!=w&&!isNaN(w)){var x=this.height?this.height(v,n,a):n;if(null!=x&&!isNaN(x)){var S=this.anchorModeY?this.anchorModeY(v,n,a):"center";if(S){u.lineWidth=d,u.strokeStyle=b;var O=void 0,_=void 0;if("first"===S)O=v[this.ts[0]],_=0;else if("last"===S)O=v[this.ts[this.ts.length-1]],_=0;else if("bottom"===S){var j,P=kl(this.ts);try{for(P.s();!(j=P.n()).done;){var k=+v[j.value];null!=k&&(null==O||k<O)&&(O=k)}}catch(t){P.e(t)}finally{P.f()}_=0}else if("top"===S){var T,C=kl(this.ts);try{for(C.s();!(T=C.n()).done;){var E=+v[T.value];null!=E&&(null==O||E>O)&&(O=E)}}catch(t){C.e(t)}finally{C.f()}_=n}else{if("center"!==S){console.log("Unexpected anchorModeY: "+S);continue}var A,M=void 0,z=void 0,R=kl(this.ts);try{for(R.s();!(A=R.n()).done;){var F=v[A.value];null!=F&&((null==M||F<M)&&(M=F),(null==z||F>z)&&(z=F))}}catch(t){R.e(t)}finally{R.f()}O=.5*(+z+ +M),_=n/2}var I=g/(h-1),B=v[this.ts[0]];this.noData(B)||(u.beginPath(),u.moveTo(v.x+m,v.y+_+(B-O)*x/o+w));for(var L=void 0,N=1;N<h;N++)L=v[this.ts[N]],this.noData(B)&&this.noData(L)||(!this.noData(B)&&this.noData(L)?u.stroke():this.noData(B)&&!this.noData(L)?(u.beginPath(),u.moveTo(v.x+N*I+m,v.y+_+(L-O)*x/o+w)):(u.lineTo(v.x+N*I+m,v.y+_+(L-O)*x/o+w),N==h-1&&u.stroke())),B=L}}}}}}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:a,viewScale:l})}}}],r&&Cl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or);function Fl(t){return Fl="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},Fl(t)}function Il(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Ll(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 Bl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ll(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 Ll(t,e){if(t){if("string"==typeof t)return Nl(t,e);var n={}.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)?Nl(t,e):void 0}}function Nl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Dl(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,Gl(r.key),r)}}function Gl(t){var e=function(t){if("object"!=Fl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fl(e)?e:e+""}function Ul(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ul=function(){return!!t})()}function Wl(t){return Wl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wl(t)}function $l(t,e){return $l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},$l(t,e)}var Hl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Wl(e),function(t,e){if(e&&("object"==Fl(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)}(t,Ul()?Reflect.construct(e,n||[],Wl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.height=t.height||function(t,e,n,r){return.4*e},n.angle=null!=t.angle?t.angle:50,n.cornerLineStrokeColor=t.cornerLineStrokeColor||function(t,e,n,r){return"#999"},n.cornerLineWidth=t.cornerLineWidth||function(t,e,n,r){return r%90==0?0:.8*n},n.sVert=null==t.sVert||t.sVert,n.sHor=null==t.sHor||t.sHor,n}return 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&&$l(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.keys(this.color),l=n/2,c=this.offset(void 0,n,o),s=c.dx,f=c.dy,h=ha.buildSides(t,n,this.angle%180!=90&&this.sVert,this.angle%180!=0&&this.sHor);if(0!=h.length){var y=this.angle*Math.PI/180,p=Math.cos(y),v=Math.sin(y),d=Math.abs(this.angle)<90?e.extGeo.xMin:e.extGeo.xMax,b=this.angle<0?e.extGeo.yMax:e.extGeo.yMin;h.sort(function(t,e){return Math.hypot(e.x-d,e.y-b)-Math.hypot(t.x-d,t.y-b)});var m=function(t){if(t){var e=r.cornerLineWidth?r.cornerLineWidth(t,n,o,r.angle):.8*o;if(0!=e){i.strokeStyle=r.cornerLineStrokeColor?r.cornerLineStrokeColor(t,n,o,r.angle):"#333",i.lineWidth=e;var u=r.height(t,n,o,a);i.beginPath(),i.moveTo(t.x+l+s,t.y+l+f),i.lineTo(t.x+l+u*p+s,t.y+l+u*v+f),i.stroke()}}};i.lineCap="round";var g,w=Bl(h);try{for(w.s();!(g=w.n()).done;){var x=g.value,S=x.c1,O=x.c2,_=x.x,j=x.y,P=S?this.height(S,n,o,a):0,k=O?this.height(O,n,o,a):0,T=ql(S,u),C=ql(O,u);if(0!=T||0!=C)for(var E=0,A=0,M=0,z=Object.entries(this.color);M<z.length;M++){var R=Il(z[M],2),F=R[0],I=R[1],B=S?+S[F]:0,L=O?+O[F]:0;if(0!=B||0!=L){var N=P*E/T||0,D=P*(E+B)/T||0,G=k*A/C||0,U=k*(A+L)/C||0;i.beginPath(),"h"==x.or?(i.moveTo(_+N*p+s,j-l+N*v+f),i.lineTo(_+G*p+s,j+l+G*v+f),i.lineTo(_+U*p+s,j+l+U*v+f),i.lineTo(_+D*p+s,j-l+D*v+f)):(i.moveTo(_-l+N*p+s,j+N*v+f),i.lineTo(_+l+G*p+s,j+G*v+f),i.lineTo(_+l+U*p+s,j+U*v+f),i.lineTo(_-l+D*p+s,j+D*v+f)),i.fillStyle=I,i.fill(),E+=B,A+=L,m(S),m(O)}}}}catch(t){w.e(t)}finally{w.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}}],r&&Dl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or),ql=function(t,e){if(!t)return 0;var n,r=0,o=Bl(e);try{for(o.s();!(n=o.n()).done;){var i=t[n.value];i&&(r+=+i)}}catch(t){o.e(t)}finally{o.f()}return r||0};function Yl(t){return Yl="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},Yl(t)}function Vl(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(Yl(t)+" is not iterable")}function Xl(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Zl(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Zl(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Zl(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Zl(f,"constructor",c),Zl(c,"constructor",l),l.displayName="GeneratorFunction",Zl(c,o,"GeneratorFunction"),Zl(f),Zl(f,o,"Generator"),Zl(f,r,function(){return this}),Zl(f,"toString",function(){return"[object Generator]"}),(Xl=function(){return{w:i,m:h}})()}function Zl(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Zl=function(t,e,n,r){function i(e,n){Zl(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Zl(t,e,n,r)}function Jl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Kl(t,e);var n={}.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)?Kl(t,e):void 0}}(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 Kl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ql(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function tc(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,ec(r.key),r)}}function ec(t){var e=function(t){if("object"!=Yl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yl(e)?e:e+""}function nc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(nc=function(){return!!t})()}function rc(t){return rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rc(t)}function oc(t,e){return oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oc(t,e)}var ic=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=rc(e),function(t,e){if(e&&("object"==Yl(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)}(t,nc()?Reflect.construct(e,n||[],rc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.image=t.image||function(){return""},n.size=t.size||function(t,e){return e},n.cache={},n}return 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&&oc(t,e)}(e,t),n=e,r=[{key:"draw",value:(o=Xl().m(function t(e,n,r){var o,i,a,u,l,c,s,f,h=this;return Xl().w(function(t){for(;;)switch(t.p=t.n){case 0:o=n.view.z,i=r/o,a=this.viewScale?this.viewScale(e,r,o):void 0,n.initCanvasTransform(),u=Jl(e),t.p=1,c=Xl().m(function t(){var e,u,c,s,f,y;return Xl().w(function(t){for(;;)switch(t.n){case 0:if(e=l.value,u=h.image(e,r,o,a)){t.n=1;break}return t.a(2,0);case 1:if(c=h.size(e,r,o,a)/o){t.n=2;break}return t.a(2,0);case 2:if("loading"!=(s=h.cache[u])){t.n=3;break}return t.a(2,{v:void 0});case 3:if(s){y=(i-c)/2;try{n.offscreenCtx.drawImage(s,n.geoToPixX(e.x)+y,n.geoToPixY(e.y)+y-i,c,c)}catch(t){console.error(t)}}else h.cache[u]="loading",(f=new Image).onload=function(){h.cache[u]=f,n.redraw()},f.onerror=function(){console.warn("Could not retrieve image from",u)},f.src=u;case 4:return t.a(2)}},t)}),u.s();case 2:if((l=u.n()).done){t.n=6;break}return t.d(Vl(c()),3);case 3:if(0!==(s=t.v)){t.n=4;break}return t.a(3,5);case 4:if(!s){t.n=5;break}return t.a(2,s.v);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,f=t.v,u.e(f);case 8:return t.p=8,u.f(),t.f(8);case 9:this.updateLegends({style:this,resolution:r,z:o,viewScale:a});case 10:return t.a(2)}},t,this,[[1,7,8,9]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){Ql(i,n,r,a,u,"next",t)}function u(t){Ql(i,n,r,a,u,"throw",t)}a(void 0)})},function(t,e,n){return i.apply(this,arguments)})}],r&&tc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Or);function ac(t){return ac="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},ac(t)}function uc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function lc(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,cc(r.key),r)}}function cc(t){var e=function(t){if("object"!=ac(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ac(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ac(e)?e:e+""}function sc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sc=function(){return!!t})()}function fc(t){return fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fc(t)}function hc(t,e){return hc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hc(t,e)}var yc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=fc(e),function(t,e){if(e&&("object"==ac(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)}(t,sc()?Reflect.construct(e,n||[],fc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.value=t.value,n.targetResolution=t.targetResolution||function(t,e){return t/5},n.interpolatedProperty=t.interpolatedProperty||"value",n.nodataHandling=t.nodataHandling||"zero",n.styles=t.styles||[],n}return 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&&hc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=di(t,n,function(t){return r.value(t)}),a=i.x0,u=i.y0,l=this.targetResolution(n,o),c=Math.round(n/l);l=n/c,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"zero";if(1===e)return t;var r=t.length;if(0===r)return[];for(var o=t[0].length,i=r*e,a=o*e,u=Array(i).fill().map(function(){return Array(a).fill(void 0)}),l=e%2==0,c=0;c<i;c++)for(var s=Math.min(Math.floor(c/e),r-2),f=c%e/e,h=s*e+e/2,y=0;y<a;y++){var p=Math.min(Math.floor(y/e),o-2),v=y%e/e,d=p*e+e/2,b=t[s][p],m=t[s][p+1],g=t[s+1][p],w=t[s+1][p+1];if(l){if(void 0===b&&c<=h&&y<=d)continue;if(void 0===m&&c<=h&&y>=d)continue;if(void 0===g&&c>=h&&y<=d)continue;if(void 0===w&&c>=h&&y>=d)continue}else{if(void 0===b&&c<h&&y<d)continue;if(void 0===m&&c<h&&y>d)continue;if(void 0===g&&c>h&&y<d)continue;if(void 0===w&&c>h&&y>d)continue}if("zero"!==n)if(void 0===b||void 0===m||void 0===g||void 0===w)if(void 0!==b||void 0===m||void 0===g||void 0===w)if(void 0===b||void 0!==m||void 0===g||void 0===w)if(void 0===b||void 0===m||void 0!==g||void 0===w)if(void 0===b||void 0===m||void 0===g||void 0!==w)if(void 0===b||void 0===w)if(void 0===m||void 0===g)void 0===b||void 0===g?void 0===m||void 0===w?(void 0!==b&&void 0!==m&&(u[c][y]=m*v+b*(1-v)),void 0===g||void 0===w?void 0===b?void 0===m?void 0===g?void 0!==w&&(u[c][y]=w):u[c][y]=g:u[c][y]=m:u[c][y]=b:u[c][y]=w*v+g*(1-v)):u[c][y]=w*f+m*(1-f):u[c][y]=g*f+b*(1-f);else{var x=(1-v+f)*Math.SQRT1_2;u[c][y]=m*(1-x)+g*x}else{var S=(v+f)*Math.SQRT1_2;u[c][y]=b*(1-S)+w*S}else{var O=m+g;u[c][y]=pc(b,m,g,O/2,v,f)}else{var _=b+w;u[c][y]=pc(b,m,_/2,w,v,f)}else{var j=b+w;u[c][y]=pc(b,j/2,g,w,v,f)}else{var P=m+g;u[c][y]=pc(P/2,m,g,w,v,f)}else u[c][y]=pc(b,m,g,w,v,f);else u[c][y]=pc(b||0,m||0,g||0,w||0,v,f)}return u}(i,c,this.nodataHandling),t=[];for(var s=(n-l)/2,f=0;f<i.length;f++)for(var h=i[f],y=u-f*l+s,p=0;p<h.length;p++){var v=h[p];if(v){var d={x:a+p*l+s,y};d[this.interpolatedProperty]=v,t.push(d)}}var b,m=e.offscreenCtx,g=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return uc(t,e);var n={}.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)?uc(t,e):void 0}}(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}}}}(this.styles);try{for(g.s();!(b=g.n()).done;){var w=b.value;w.visible&&!w.visible(o)||((w.alpha||w.blendOperation)&&(m.save(),w.alpha&&(m.globalAlpha=w.alpha(o)),w.blendOperation&&(m.globalCompositeOperation=w.blendOperation(o))),e.setCanvasTransform(),w.draw(t,e,l),w.filterColor&&w.drawFilter(e),(w.alpha||w.blendOperation)&&m.restore())}}catch(t){g.e(t)}finally{g.f()}}}}],r&&lc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Or),pc=function(t,e,n,r,o,i){var a=t+(e-t)*o;return a+(n+(r-n)*o-a)*i};function vc(t){return vc="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},vc(t)}function dc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return bc(t,e);var n={}.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)?bc(t,e):void 0}}(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 bc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mc(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,gc(r.key),r)}}function gc(t){var e=function(t){if("object"!=vc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vc(e)?e:e+""}function wc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wc=function(){return!!t})()}function xc(t){return xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xc(t)}function Sc(t,e){return Sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sc(t,e)}var Oc=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=function(t,e,n){return e=xc(e),function(t,e){if(e&&("object"==vc(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)}(t,wc()?Reflect.construct(e,n||[],xc(t).constructor):e.apply(t,n))}(this,e,[o]),o=o||{},r.dataset=t,r.styles=n,r.minPixelsPerCell=o.minPixelsPerCell||3,r.cellInfoHTML=o.cellInfoHTML||e.defaultCellInfoHTML,r}return 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&&Sc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n){var r=t.view.z,o=t.offscreenCtx,i=this.getDataset(r);if(i){if(i.getData(t.extGeo),i.updateViewCache(t.extGeo),(this.alpha||this.blendOperation)&&(o.save(),this.alpha&&(o.globalAlpha=this.alpha(r)),this.blendOperation&&(o.globalCompositeOperation=this.blendOperation(r))),n){var a,u=dc(this.styles);try{for(u.s();!(a=u.n()).done;){var l=a.value;e.setLegendContainer(n.node(),l.legends,l.styles)}}catch(t){u.e(t)}finally{u.f()}}var c,s=dc(this.styles);try{for(s.s();!(c=s.n()).done;){var f=c.value;f.visible&&!f.visible(r)||((f.alpha||f.blendOperation)&&(o.save(),f.alpha&&(o.globalAlpha=f.alpha(r)),f.blendOperation&&(o.globalCompositeOperation=f.blendOperation(r))),t.setCanvasTransform(),f.draw(i.getViewCache(),t,i.getResolution()),f.filterColor&&f.drawFilter(t),(f.alpha||f.blendOperation)&&o.restore())}}catch(t){s.e(t)}finally{s.f()}if((this.alpha||this.blendOperation)&&o.restore(),n){var h,y=dc(this.styles);try{for(y.s();!(h=y.n()).done;){var p=h.value;if((!p.visible||p.visible(r))&&(e.addLegends(n,p.legends,p,t),p.styles)){var v,d=dc(p.styles);try{for(d.s();!(v=d.n()).done;){var b=v.value;b.visible&&!b.visible(r)||e.addLegends(n,b.legends,b,t)}}catch(t){d.e(t)}finally{d.f()}}}}catch(t){y.e(t)}finally{y.f()}}}}},{key:"getDataset",value:function(t){return this.dataset.getDataset(t,this.minPixelsPerCell)}},{key:"styles_",value:function(t){return 0===arguments.length?this.styles:(1===arguments.length?Array.isArray(t)?this.styles=t:this.styles=[t]:this.styles=arguments,this)}}],o=[{key:"setLegendContainer",value:function(t,n,r){var o=function(e){Array.isArray(e)?e.forEach(o):e&&(e.container=t)};o(n);var i,a=dc(r||[]);try{for(a.s();!(i=a.n()).done;){var u=i.value;e.setLegendContainer(t,u.legends,void 0)}}catch(t){a.e(t)}finally{a.f()}}},{key:"addLegends",value:function(t,e,n,r){if(Array.isArray(e)){var o,i=dc(e);try{for(i.s();!(o=i.n()).done;){var a=o.value;this.addLegends(t,a,n,r)}}catch(t){i.e(t)}finally{i.f()}}else{e.style_=n,e.redraw=function(){return r.redraw?r.redraw():void 0};var u=t.node(),l=e.div.node(),c=u._gridvizLegendCursor;c?l.previousSibling!==c&&c.after(l):u.firstChild!==l&&u.prepend(l),u._gridvizLegendCursor=l}}},{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("")}}],r&&mc(n.prototype,r),o&&mc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Er);function _c(t){return _c="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},_c(t)}function jc(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,Pc(r.key),r)}}function Pc(t){var e=function(t){if("object"!=_c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_c(e)?e:e+""}function kc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(kc=function(){return!!t})()}function Tc(t){return Tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tc(t)}function Cc(t,e){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cc(t,e)}var Ec=function(t){function e(t){var n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Tc(e),function(t,e){if(e&&("object"==_c(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)}(t,kc()?Reflect.construct(e,n||[],Tc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.cache={},n.url=t.url,n.urlFun=t.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},n.resolutions=t.resolutions,!n.resolutions||0==n.resolutions.length)throw new Error("No resolutions provided for background layer");return n.nbPix=t.nbPix||256,n.origin=t.origin||[0,0],n.z0=t.z0||0,n.pixelationCoefficient=t.pixelationCoefficient||1,n}return 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&&Cc(t,e)}(e,t),n=e,(r=[{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.view.z,r=this.origin[0],o=this.origin[1],i=0;for(i=0;i<this.resolutions.length&&!(this.resolutions[i]<n*this.pixelationCoefficient);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)},s=function(t){return Math.ceil(-(t-o)/u)},f=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),y=s(t.extGeo.yMin),p=s(t.extGeo.yMax)-1,v=function(n){for(var a=function(a){var c=e.get(i,n,a);if(!c){var s=new Image;return e.put(s,i,n,a),s.onload=function(){t.redraw()},s.onerror=function(){e.put("failed",i,n,a)},s.src=e.urlFun(n,a,i),0}if("failed"===c)return 0;if(!(c instanceof HTMLImageElement))return console.log(c),0;if(0==c.width||0==c.height)return 0;var f=r+n*u,h=o-a*u;try{t.initCanvasTransform(),t.offscreenCtx.drawImage(c,t.geoToPixX(f),t.geoToPixY(h),l,l)}catch(t){console.error(t)}},c=p;c<y;c++)a(c)},d=f;d<h;d++)v(d)}else console.error("No resolutions provided for background layer")}}])&&jc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Er);function Ac(t){return Ac="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},Ac(t)}function Mc(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,zc(r.key),r)}}function zc(t){var e=function(t){if("object"!=Ac(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ac(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ac(e)?e:e+""}function Rc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Rc=function(){return!!t})()}function Fc(t){return Fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fc(t)}function Ic(t,e){return Ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ic(t,e)}var Bc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Fc(e),function(t,e){if(e&&("object"==Ac(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)}(t,Rc()?Reflect.construct(e,n||[],Fc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.img=void 0,n.xMin=void 0,n.xMax=void 0,n.yMin=void 0,n.yMax=void 0,n}return 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&&Ic(t,e)}(e,t),n=e,(r=[{key:"hasMoved",value:function(t){return t.xMin!=this.xMin||t.xMax!=this.xMax||t.yMin!=this.yMin||t.yMax!=this.yMax}},{key:"draw",value:function(t){if(t.updateExtentGeo(0),!this.hasMoved(t.extGeo)&&this.img)t.initCanvasTransform(),t.offscreenCtx.drawImage(this.img,0,0,t.w,t.h);else{this.xMin=t.extGeo.xMin,this.xMax=t.extGeo.xMax,this.yMin=t.extGeo.yMin,this.yMax=t.extGeo.yMax;var e=[];e.push(this.url),e.push("&width="),e.push(t.w),e.push("&height="),e.push(t.h),e.push("&bbox="),e.push(t.extGeo.xMin),e.push(","),e.push(t.extGeo.yMin),e.push(","),e.push(t.extGeo.xMax),e.push(","),e.push(t.extGeo.yMax);var n=e.join("");this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve WMS background image from",n)}),this.img.src=n}}}])&&Mc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Er);function Lc(t){return Lc="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},Lc(t)}function Nc(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,Dc(r.key),r)}}function Dc(t){var e=function(t){if("object"!=Lc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Lc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lc(e)?e:e+""}function Gc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gc=function(){return!!t})()}function Uc(t){return Uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uc(t)}function Wc(t,e){return Wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wc(t,e)}var $c=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Uc(e),function(t,e){if(e&&("object"==Lc(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)}(t,Gc()?Reflect.construct(e,n||[],Uc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.xMin=t.xMin||0,n.yMax=t.yMax||0,n.width=t.width||2e4,n.height=t.height||2e4,n.img=void 0,n}return 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&&Wc(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){var e=this;if(this.img){var n=t.geoToPixX(this.xMin),r=t.geoToPixY(this.yMax),o=t.getView().z;t.initCanvasTransform(),t.offscreenCtx.drawImage(this.img,n,r,this.width/o,this.height/o)}else this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve background image from",e.url)}),this.img.src=this.url}}])&&Nc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Er);function Hc(t){return Hc="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},Hc(t)}function qc(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Yc(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Yc(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Yc(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Yc(f,"constructor",c),Yc(c,"constructor",l),l.displayName="GeneratorFunction",Yc(c,o,"GeneratorFunction"),Yc(f),Yc(f,o,"Generator"),Yc(f,r,function(){return this}),Yc(f,"toString",function(){return"[object Generator]"}),(qc=function(){return{w:i,m:h}})()}function Yc(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Yc=function(t,e,n,r){function i(e,n){Yc(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Yc(t,e,n,r)}function Vc(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Xc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Zc(t,e);var n={}.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)?Zc(t,e):void 0}}(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 Zc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Jc(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,Kc(r.key),r)}}function Kc(t){var e=function(t){if("object"!=Hc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hc(e)?e:e+""}function Qc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qc=function(){return!!t})()}function ts(t){return ts=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ts(t)}function es(t,e){return es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},es(t,e)}var ns=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ts(e),function(t,e){if(e&&("object"==Hc(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)}(t,Qc()?Reflect.construct(e,n||[],ts(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.style=t.style||function(){return"1.2em Arial"},n.color=t.color||(t.dark?function(){return"white"}:function(){return"black"}),n.haloColor=t.haloColor||(t.dark?function(){return"black"}:function(){return"white"}),n.haloWidth=t.haloWidth||function(){return 2.5},n.textAlign=t.textAlign||"start",n.offsetPix=t.offsetPix||[5,5],n.preprocess=t.preprocess,n.labels=void 0,n.loadingStatus="notLoaded",n}return 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&&es(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.labels){var e=t.view.z,n=t.offscreenCtx;n.textAlign=this.textAlign||"start",n.lineJoin="bevel",n.lineCap="butt",t.initCanvasTransform();var r,o=Xc(this.labels);try{for(o.s();!(r=o.n()).done;){var i=r.value,a=this.style(i,e);if(a&&(n.font=a,t.toDraw(i))){var u=t.geoToPixX(i.x)+this.offsetPix[0],l=t.geoToPixY(i.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var c=this.haloColor(i,e),s=this.haloWidth(i,e);c&&s&&s>0&&(n.strokeStyle=c,n.lineWidth=s,n.strokeText(i.name,u,l))}if(this.color){var f=this.color(i,e);f&&(n.fillStyle=f,n.fillText(i.name,u,l))}}}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"load",value:(o=qc().m(function t(e){var n,r,o,i,a;return qc().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.url){t.n=1;break}return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.a(2);case 1:if("notLoaded"==this.loadingStatus){t.n=2;break}return t.a(2);case 2:return this.loadingStatus="loading",t.p=3,t.n=4,uo(this.url);case 4:if(n=t.v,!this.preprocess){t.n=13;break}this.labels=[],r=Xc(n),t.p=5,r.s();case 6:if((o=r.n()).done){t.n=9;break}if(i=o.value,0!=this.preprocess(i)){t.n=7;break}return t.a(3,8);case 7:this.labels.push(i);case 8:t.n=6;break;case 9:t.n=11;break;case 10:t.p=10,a=t.v,r.e(a);case 11:return t.p=11,r.f(),t.f(11);case 12:t.n=14;break;case 13:this.labels=n;case 14:this.loadingStatus="loaded",e&&e(),t.n=16;break;case 15:t.p=15,t.v,console.log("Failed loading labels from "+this.url),this.labels=[],this.loadingStatus="failed";case 16:return t.a(2)}},t,this,[[5,10,11,12],[3,15]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){Vc(i,n,r,a,u,"next",t)}function u(t){Vc(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&Jc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Er);function rs(t){return rs="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},rs(t)}function os(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return is(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(is(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,is(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,is(f,"constructor",c),is(c,"constructor",l),l.displayName="GeneratorFunction",is(c,o,"GeneratorFunction"),is(f),is(f,o,"Generator"),is(f,r,function(){return this}),is(f,"toString",function(){return"[object Generator]"}),(os=function(){return{w:i,m:h}})()}function is(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}is=function(t,e,n,r){function i(e,n){is(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},is(t,e,n,r)}function as(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function us(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ls(t,e);var n={}.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)?ls(t,e):void 0}}(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 ls(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cs(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,ss(r.key),r)}}function ss(t){var e=function(t){if("object"!=rs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=rs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rs(e)?e:e+""}function fs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(fs=function(){return!!t})()}function hs(t){return hs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hs(t)}function ys(t,e){return ys=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ys(t,e)}var ps=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=hs(e),function(t,e){if(e&&("object"==rs(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)}(t,fs()?Reflect.construct(e,n||[],hs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.preprocess=t.preprocess,n.shape=t.shape||function(t,e){return"circle"},n.size=t.size||function(t,e){return 10},n.strokeStyle=t.strokeStyle||t.color||function(t,e){return"gray"},n.lineWidth=t.lineWidth||t.width||function(t,e){return 2},n.lineDash=t.lineDash||function(t,e){},n.fillStyle=t.fillStyle||function(t,e){return"black"},n.fs=void 0,n.loadingStatus="notLoaded",n}return 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&&ys(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.fs){var e,n=t.view.z,r=t.offscreenCtx,o=us(this.fs);try{for(o.s();!(e=o.n()).done;){var i=e.value;this.drawGeometry(i,i.geometry,i.geometry.type,n,r)}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"drawGeometry",value:function(t,e,n,r,o){if("Point"==n||"MultiPoint"==n){var i=this.shape(t,r);if(!i||"none"==i)return;var a=this.size(t,r)*r;if(!a)return;var u=this.strokeStyle(t,r),l=this.fillStyle(t,r),c=this.lineWidth(t,r)*r;o.save(),u&&(o.strokeStyle=u),l&&(o.fillStyle=l),c&&(o.lineWidth=c);var s=e.coordinates;if("Point"==n&&(s=[s]),"circle"==i){var f,h=us(s);try{for(h.s();!(f=h.n()).done;){var y=f.value;o.beginPath(),o.arc(y[0],y[1],a/2,0,2*Math.PI,!1),l&&o.fill(),u&&c&&o.stroke()}}catch(t){h.e(t)}finally{h.f()}}else if("square"==i){var p,v=us(s);try{for(v.s();!(p=v.n()).done;){var d=p.value;o.beginPath(),o.rect(d[0]-a/2,d[1]-a/2,a,a),l&&o.fill(),u&&c&&o.stroke()}}catch(t){v.e(t)}finally{v.f()}}else console.error("Unexpected shape for point GeoJSON: "+i);o.restore()}else if("LineString"==n||"MultiLineString"==n){var b=this.strokeStyle(t,r);if(!b||"none"===b)return;var m=this.lineWidth(t,r);if(!m||m<0)return;o.save(),o.strokeStyle=b,o.lineWidth=m*r,o.setLineDash(this.lineDash(t,r)||[]);var g,w=us("LineString"===n?[e.coordinates]:e.coordinates);try{for(w.s();!(g=w.n()).done;){var x=g.value;if(!(x.length<2)){o.beginPath(),o.moveTo(x[0][0],x[0][1]);for(var S=1;S<x.length;S++)o.lineTo(x[S][0],x[S][1]);o.stroke()}}}catch(t){w.e(t)}finally{w.f()}o.restore()}else if("Polygon"==n||"MultiPolygon"==n){o.save();var O="Polygon"===n?[e.coordinates]:e.coordinates;o.beginPath();var _,j=us(O);try{for(j.s();!(_=j.n()).done;){var P,k=us(_.value);try{for(k.s();!(P=k.n()).done;){var T=P.value;if(!(T.length<2)){o.moveTo(T[0][0],T[0][1]);for(var C=1;C<T.length;C++)o.lineTo(T[C][0],T[C][1]);o.closePath()}}}catch(t){k.e(t)}finally{k.f()}}}catch(t){j.e(t)}finally{j.f()}var E=this.fillStyle(t,r);E&&"none"!==E&&(o.fillStyle=E,o.fill("evenodd"));var A=this.lineWidth(t,r);if(A&&A>0){var M,z,R,F=null!==(M=null===(z=this.strokeStyle)||void 0===z?void 0:z.call(this,t,r))&&void 0!==M?M:E;F&&"none"!==F&&(o.strokeStyle=F,o.lineWidth=A*r,o.setLineDash((null===(R=this.lineDash)||void 0===R?void 0:R.call(this,t,r))||[]),o.stroke())}o.restore()}else if("GeometryCollection"==n){var I,B=us(e.geometries);try{for(B.s();!(I=B.n()).done;){var L=I.value;this.drawGeometry(t,L,L.type,r,o)}}catch(t){B.e(t)}finally{B.f()}}else console.log("Unexpected geometry type in GeoJSONLayer: "+n)}},{key:"load",value:(o=os().m(function t(e){var n,r,o,i,a,u;return os().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.url){t.n=1;break}return console.log("Failed loading GeoJSON data: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.a(2);case 1:if("notLoaded"==this.loadingStatus){t.n=2;break}return t.a(2);case 2:return this.loadingStatus="loading",t.p=3,t.n=4,qr(this.url);case 4:if(n=t.v,r=n.features,!this.preprocess){t.n=13;break}this.fs=[],o=us(r),t.p=5,o.s();case 6:if((i=o.n()).done){t.n=9;break}if(a=i.value,0!=this.preprocess(a)){t.n=7;break}return t.a(3,8);case 7:this.fs.push(a);case 8:t.n=6;break;case 9:t.n=11;break;case 10:t.p=10,u=t.v,o.e(u);case 11:return t.p=11,o.f(),t.f(11);case 12:t.n=14;break;case 13:this.fs=r;case 14:this.loadingStatus="loaded",e&&e(),t.n=16;break;case 15:t.p=15,t.v,console.log("Failed loading GeoJSON from "+this.url),this.fs=[],this.loadingStatus="failed";case 16:return t.a(2)}},t,this,[[5,10,11,12],[3,15]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){as(i,n,r,a,u,"next",t)}function u(t){as(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&cs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Er);function vs(t){return vs="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},vs(t)}function ds(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bs(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,ms(r.key),r)}}function ms(t){var e=function(t){if("object"!=vs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vs(e)?e:e+""}var gs=function(){return t=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.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=pt("#"+this.id)),this.div&&!this.div.empty()||(this.div=pt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this._set={padding:void 0!==e.padding,fontFamily:void 0!==e["font-family"],titleFontSize:void 0!==e.titleFontSize,titleFontWeight:void 0!==e.titleFontWeight,labelFontSize:void 0!==e.labelFontSize},this.div.classed("gridviz-legend",!0),e.className){var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ds(t,e);var n={}.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)?ds(t,e):void 0}}(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}}}}(String(e.className).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}this.div.style("background",this.background),this.div.style("padding",this._css("padding",this.padding,this._set.padding)),this.div.style("border",this.border),this.div.style("border-radius",this["border-radius"]),this.div.style("box-shadow",this["box-shadow"]),this.div.style("font-family",this._css("font-family",this["font-family"],this._set.fontFamily)),this.title=e.title,this.titleFontSize=e.titleFontSize||"0.8em",this.titleFontWeight=e.titleFontWeight||"bold",this.labelFontSize=e.labelFontSize||"0.8em",this.labelUnitText=e.labelUnitText||"",this.labelFormat=e.labelFormat,this.labelsAsHTML=!0===e.labelsAsHTML,this.interactive=!1!==e.interactive,this.style_=void 0,this.redraw=void 0,this.container=void 0,this.fill="fill"===e.width},e=[{key:"highlight",value:function(t){if(this.interactive&&this.style_){var e=this.style_.highlightColors;this.div&&this.div.attr("data-gridviz-hovered",t&&t.length?"":null),this.style_.setHighlight(t),null===e&&null===this.style_.highlightColors||this.redraw&&this.redraw()}}},{key:"bindHover",value:function(t,e,n){var r=this;this.interactive&&t.style("cursor","pointer").on("mouseenter",function(){n&&n.enter&&n.enter(),r.highlight([e])}).on("mouseleave",function(){n&&n.leave&&n.leave(),r.highlight(null)})}},{key:"_css",value:function(t,e,n){return n?e:"var(--gridviz-legend-".concat(t,", ").concat(e,")")}},{key:"labelFontSizeCSS",value:function(){return this._css("label-font-size",this.labelFontSize,this._set.labelFontSize)}},{key:"setType",value:function(t){this.div.classed("gridviz-legend--"+t,!0)}},{key:"availableWidth",value:function(t){if(!this.fill)return this.width;var e=this.container,n=e&&e.clientWidth;if(!n)return t;var r=parseFloat(this.padding)||0;return Math.max(60,Math.floor(n-2*r))}},{key:"setText",value:function(t,e){return this.labelsAsHTML?t.html(e):t.text(e)}},{key:"makeTitle",value:function(){this.title&&this.setText(this.div.append("div").classed("gridviz-legend-title",!0).style("font-size",this._css("title-font-size",this.titleFontSize,this._set.titleFontSize)).style("font-weight",this._css("title-font-weight",this.titleFontWeight,this._set.titleFontWeight)).style("margin-bottom","7px"),this.title)}},{key:"style",value:function(t,e){return 1==arguments.length?this.div.style(t):(this.div.style(t,e),this)}},{key:"update",value:function(){console.error("Legend update not implemented yet.")}}],e&&bs(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ws(t){return ws="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},ws(t)}function xs(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,Ss(r.key),r)}}function Ss(t){var e=function(t){if("object"!=ws(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ws(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ws(e)?e:e+""}function Os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Os=function(){return!!t})()}function _s(t){return _s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_s(t)}function js(t,e){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},js(t,e)}var Ps=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=_s(e),function(t,e){if(e&&("object"==ws(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)}(t,Os()?Reflect.construct(e,n||[],_s(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorScale=t.colorScale,n.textScale=t.textScale||function(t){return t},n.margin=t.margin||5,n.tickSize=t.tickSize||6,n.ticks=t.ticks||Math.floor(n.width/50),n.tickFormat=t.tickFormat,n.tickUnit=t.tickUnit,n.fontSize=t.fontSize||"0.8em",n.invert=t.invert,n.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.setType("color"),n}return 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&&js(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();for(var e=this.availableWidth(this.width),n=e+2*this.margin,r=this.height+this.margin+this.tickSize+10,o=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n).attr("height",r).append("g").classed("gridviz-legend-bar",!0).attr("transform","translate("+this.margin+" 0)"),i=e,a=this.height,u=0;u<i;u+=5){var l=u/(i-1);this.invert&&(l=1-l),o.append("rect").classed("gridviz-legend-swatch",!0).attr("x",u).attr("y",0).attr("width",5).attr("height",a).style("fill",this.colorScale(l,t.viewScale))}for(var c=0;c<this.ticks;c++){var s=c/(this.ticks-1);o.append("line").classed("gridviz-legend-tick",!0).attr("x1",i*s).attr("y1",0).attr("x2",i*s).attr("y2",a+this.tickSize).style("stroke","black"),o.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+c).attr("x",i*s).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 f=this.tickFormat&&"text"!=this.tickFormat?this.tickFormat:function(t){return t},h=0;h<this.ticks;h++){var y=h/(this.ticks-1),p=this.textScale(y,t.viewScale),v=(p?f(p):"0")+(this.tickUnit?this.tickUnit:"");null!=v&&this.div.select("#ticklabel_"+h).text(v)}}}],r&&xs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gs);function ks(t){return ks="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},ks(t)}function Ts(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,Cs(r.key),r)}}function Cs(t){var e=function(t){if("object"!=ks(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ks(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ks(e)?e:e+""}function Es(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Es=function(){return!!t})()}function As(t){return As=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},As(t)}function Ms(t,e){return Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ms(t,e)}var zs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=As(e),function(t,e){if(e&&("object"==ks(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)}(t,Es()?Reflect.construct(e,n||[],As(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colors=t.colors,n.breaks=t.breaks,n.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.setType("discrete"),n.tickSize=t.tickSize||3,n.invert=t.invert,n}return 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&&Ms(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.colors(t.viewScale),r=this.breaks(t.viewScale);if(r){var o=n.length;if(0!=o){for(var i=this.availableWidth(this.width),a=i/o,u=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",i).attr("height",this.height+this.tickSize+2+10),l=function(){var t=u.append("rect").classed("gridviz-legend-swatch",!0).attr("x",c*a).attr("y",0).attr("width",a).attr("height",e.height).style("fill",n[c]);e.bindHover(t,n[c],{enter:function(){return t.classed("gridviz-legend-swatch--active",!0).attr("stroke","red")},leave:function(){return t.classed("gridviz-legend-swatch--active",!1).attr("stroke",null)}})},c=0;c<o;c++)l();for(var s=1;s<o;s++)u.append("line").classed("gridviz-legend-tick",!0).attr("x1",a*s).attr("y1",0).attr("x2",a*s).attr("y2",this.height+this.tickSize).style("stroke","black");for(var f=1;f<o;f++){var h=r[f-1];isNaN(h)||null==h||(this.labelFormat&&(h=this.labelFormat(h,f)),u.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+f).attr("x",a*f).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSizeCSS()).style("text-anchor","middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(h))}}}}}])&&Ts(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gs);function Rs(t){return Rs="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},Rs(t)}function Fs(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,Is(r.key),r)}}function Is(t){var e=function(t){if("object"!=Rs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rs(e)?e:e+""}function Bs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bs=function(){return!!t})()}function Ls(t){return Ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ls(t)}function Ns(t,e){return Ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ns(t,e)}var Ds=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ls(e),function(t,e){if(e&&("object"==Rs(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)}(t,Bs()?Reflect.construct(e,n||[],Ls(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorLabel=t.colorLabel||[["gray","-"]],n.shape=t.shape||"circle",n.dimension=t.dimension||{r:8},n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n.setType("category"),n}return 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&&Ns(t,e)}(e,t),n=e,(r=[{key:"update",value:function(){var t=this;this.div.selectAll("*").remove(),this.makeTitle();var e=this.colorLabel.length;if(0!=e)for(var n=function(){var e=t.colorLabel[r],n=t.div.append("div").classed("gridviz-legend-category",!0);t.bindHover(n,e[0],{enter:function(){return n.classed("gridviz-legend-category--active",!0).select("svg").select("rect, circle").style("stroke","red")},leave:function(){return n.classed("gridviz-legend-category--active",!1).select("svg").select("rect, circle").style("stroke",t.strokeColor)}});var o=t.strokeWidth;if("square"===t.shape){var i=t.dimension.h||15,a=t.dimension.w||20;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",a+2*o).attr("height",i+2*o).append("rect").classed("gridviz-legend-swatch",!0).attr("x",o).attr("y",o).attr("width",a).attr("height",i).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}else{if("circle"!==t.shape)throw new Error("Unexpected shape:"+t.shape);var u=t.dimension.r||8,l=2*u+2*o;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",l).attr("height",l).append("circle").classed("gridviz-legend-swatch",!0).attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}t.setText(n.append("div").style("display","inline").classed("gridviz-legend-label",!0).style("padding-left","5px").style("font-size",t.labelFontSizeCSS()),e[1])},r=0;r<e;r++)n()}}])&&Fs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gs);function Gs(t){return Gs="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},Gs(t)}function Us(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ws(t,e);var n={}.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)?Ws(t,e):void 0}}(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 Ws(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function $s(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,Hs(r.key),r)}}function Hs(t){var e=function(t){if("object"!=Gs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gs(e)?e:e+""}function qs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qs=function(){return!!t})()}function Ys(t){return Ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ys(t)}function Vs(t,e){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vs(t,e)}var Xs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Ys(e),function(t,e){if(e&&("object"==Gs(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)}(t,qs()?Reflect.construct(e,n||[],Ys(t).constructor):e.apply(t,n))}(this,e,[t])).setType("size"),t=t||{},n.label=t.label||void 0,n.size=t.size||void 0,n.shape=t.shape||"circle",n.fillColor=t.fillColor||"none",n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n.color=t.color||"gray",n.length=t.length||function(t,e,n){return t},n}return 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&&Vs(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n,r=this.label(t.viewScale,t.cells,t.resolution,t.z);if(n=this.size?this.size(t.viewScale,t.resolution,t.z)/t.z:t.viewScale(+r)/t.z){this.labelFormat&&!isNaN(+r)&&(r=this.labelFormat(r));var o=this.div.append("div").classed("gridviz-legend-category",!0),i=function(){return o.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+e.strokeWidth+2).attr("height",n+e.strokeWidth+2).style("","inline-block")};if("square"===this.shape)i().append("rect").classed("gridviz-legend-symbol",!0).attr("x",0).attr("y",0).attr("width",n).attr("height",n).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(n+this.strokeWidth);i().append("circle").classed("gridviz-legend-symbol",!0).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);else if("diamond"===this.shape);else{if("line"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=this.length?this.length(t.resolution,t.z,t.viewScale):t.resolution;u/=t.z,o.append("svg").classed("gridviz-legend-graphic",!0).attr("width",u).attr("height",n).style("","inline-block").append("line").classed("gridviz-legend-symbol",!0).attr("x1",0).attr("y1",n/2).attr("x2",u).attr("y2",n/2).style("stroke",this.color).style("stroke-width",n)}o.append("div").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).text(r+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&$s(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gs);function Zs(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=[],i=Us(t);try{var a=function(){var i=n.value;r.title=i==t[0]?r.title:void 0,r.size=function(){return e(i)},r.label=function(){return i},o.push(new Xs(r))};for(i.s();!(n=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Js(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.k||[.9,.5,.2,.05],o=[],i=Us(r);try{var a=function(){var i=e.value;n.title=i==r[0]?n.title:void 0,n.label=function(e,n){return vi(i*Ba(n,t))},o.push(new Xs(n))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Ks(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.labelFormat||function(t){return t},o=n.labelText||tf(r),i=[],a=function(r){n.title=r==e.length-1?n.title:void 0,n.size=function(){return e[r]},n.label=function(){return o(t[r-1],t[r])},i.push(new Xs(n))},u=e.length-1;u>=0;u--)a(u);return i}function Qs(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.labelFormat||function(t){return t},r=e.labelText||tf(n),o=[],i=e.viewScaleFun||function(t){return t},a=function(n){e.title=n==t-1?e.title:void 0,e.size=function(t){return i(t).values[n]},e.label=function(t){return r(i(t).breaks[n-1],i(t).breaks[n])},o.push(new Xs(e))},u=t-1;u>=0;u--)a(u);return o}function tf(t){return function(e,n){return null==e&&null==n?"":null==n?"> "+t(e):null==e?"< "+t(n):t(e)+" - "+t(n)}}function ef(t){return ef="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},ef(t)}function nf(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,rf(r.key),r)}}function rf(t){var e=function(t){if("object"!=ef(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ef(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ef(e)?e:e+""}function of(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(of=function(){return!!t})()}function af(t){return af=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},af(t)}function uf(t,e){return uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uf(t,e)}var lf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=af(e),function(t,e){if(e&&("object"==ef(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)}(t,of()?Reflect.construct(e,n||[],af(t).constructor):e.apply(t,n))}(this,e,[t])).setType("orientation"),t=t||{},n.orientation=t.orientation||0,n.color=t.color||function(t,e,n){return"gray"},n.width=t.width||function(t,e,n){return 3*e},n.length=t.length||function(t,e,n){return t},n.label=t.label||"-",n}return 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&&uf(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.div.append("div").classed("gridviz-legend-category",!0),n=this.color(t.resolution,t.z,t.viewScale),r=this.width(t.resolution,t.z,t.viewScale)/t.z,o=this.length(t.resolution,t.z,t.viewScale)/t.z,i=Math.max(o,r),a=e.append("svg").classed("gridviz-legend-graphic",!0).attr("width",i).attr("height",i).style("","inline-block"),u=Math.cos(-this.orientation*Math.PI/180),l=Math.sin(-this.orientation*Math.PI/180),c=.5*i,s=.5*o;a.append("line").classed("gridviz-legend-symbol",!0).attr("x1",c-u*s).attr("y1",c-l*s).attr("x2",c+u*s).attr("y2",c+l*s).style("stroke",n).style("stroke-width",r),e.append("div").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).text(this.label+(this.labelUnitText?" ":"")+this.labelUnitText)}}],r&&nf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gs);function cf(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],o=0;o<t.length;o++)n.title=0==o?n.title:void 0,n.orientation=t[o],n.label=e[o],r.push(new lf(n));return r}function sf(t){return sf="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},sf(t)}function ff(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,hf(r.key),r)}}function hf(t){var e=function(t){if("object"!=sf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sf(e)?e:e+""}function yf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yf=function(){return!!t})()}function pf(t){return pf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pf(t)}function vf(t,e){return vf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vf(t,e)}var df=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=pf(e),function(t,e){if(e&&("object"==sf(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)}(t,yf()?Reflect.construct(e,n||[],pf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.classifier=t.classifier,n.width=t.width||150,n.selectionColor=t.selectionColor||"red",n.tooltip=t.tooltip,n.texts=t.texts,n.leftText=t.leftText||"Category 0",n.topText=t.topText||"Category 1",n.rightText=t.rightText||"Category 2",n.centerCoefficient=t.centerCoefficient||n.classifier.centerCoefficient,n.setType("ternary"),n}return 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&&vf(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.width,r=.866025*n,o=this.classifier,i=this.selectionColor,a=this.tooltip,u=this.texts||{},l=this,c=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+0).attr("height",r+8+24);c.append("text").attr("x",n/2).attr("y",14).classed("gridviz-legend-label",!0).text(this.topText).attr("font-size",12).attr("text-anchor","middle"),c.append("text").attr("x",0).attr("y",30+r).classed("gridviz-legend-label",!0).text(this.leftText).attr("font-size",12).attr("text-anchor","start"),c.append("text").attr("x",n).attr("y",30+r).classed("gridviz-legend-label",!0).text(this.rightText).attr("font-size",12).attr("text-anchor","end");var s=c.append("g").classed("gridviz-legend-triangle",!0).attr("transform","translate(0 16)"),f=function(t,n,r){t.attr("fill",n).classed("gridviz-legend-swatch",!0).style("cursor",e.interactive?"pointer":null).on("mouseover",function(t){pt(this).classed("gridviz-legend-swatch--active",!0).attr("fill",i),l.highlight([n]),a&&r&&(a.html(r),a.setPosition(t),a.show())}).on("mouseout",function(){pt(this).classed("gridviz-legend-swatch--active",!1).attr("fill",n),l.highlight(null),a&&a.hide()}),a&&r&&t.on("mousemove",function(t){a.setPosition(t)})};f(s.append("polygon").attr("points","0,"+r+" "+n/3+","+r+" "+n/2+","+2*r/3+" "+n/6+","+2*r/3),o.colors[0],u[0]),f(s.append("polygon").attr("points",n/2+",0 "+2*n/3+","+r/3+" "+n/2+","+2*r/3+" "+n/3+","+r/3),o.colors[1],u[1]),f(s.append("polygon").attr("points",n+","+r+" "+5*n/6+","+2*r/3+" "+n/2+","+2*r/3+" "+2*n/3+","+r),o.colors[2],u[2]),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+5*n/6+","+2*r/3+" "+2*n/3+","+r/3),o.mixColors[0],u.m12),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/3+","+r+" "+2*n/3+","+r),o.mixColors[1],u.m02),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/6+","+2*r/3+" "+n/3+","+r/3),o.mixColors[2],u.m01),this.centerCoefficient&&f(s.append("circle").attr("cx",n/2).attr("cy",2*r/3).attr("r",this.centerCoefficient*r/3),o.centerColor,u.center)}}],r&&ff(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gs),bf=function(t){return t};bf.invert=bf;var mf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return bf;var e=Math.exp(t)-1,n=function(n){return(Math.exp(n*t)-1)/e};return n.invert=function(n){return Math.log(e*n+1)/t},n},gf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return bf;var e=Math.exp(t),n=1-e,r=function(r){return 1-Math.log(e+r*n)/t};return r.invert=function(r){return(Math.exp((1-r)*t)-e)/n},r},wf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return bf;var e=function(e){return Math.pow(e,t)},n=1/t;return e.invert=function(t){return Math.pow(t,n)},e},xf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return bf;var e=1/t,n=function(t){return 1-Math.pow(1-t,e)};return n.invert=function(e){return 1-Math.pow(1-e,t)},n},Sf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return bf;if(1==t)return function(t){return Math.sqrt(t*(2-t))};var e=t/(1-t);return function(t){return Math.sqrt(1/(e*e)+t*(2/e+2-t))-1/e}},Of=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return bf;var e=Sf(t);return function(t){return 1-e(1-t)}};const _f=Math.PI/180,jf=180/Math.PI,Pf=.96422,kf=.82521,Tf=4/29,Cf=6/29,Ef=3*Cf*Cf,Af=Cf*Cf*Cf;function Mf(t){if(t instanceof Rf)return new Rf(t.l,t.a,t.b,t.opacity);if(t instanceof Nf)return Df(t);t instanceof Ae||(t=Ce(t));var e,n,r=Lf(t.r),o=Lf(t.g),i=Lf(t.b),a=Ff((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?e=n=a:(e=Ff((.4360747*r+.3850649*o+.1430804*i)/Pf),n=Ff((.0139322*r+.0971045*o+.7141733*i)/kf)),new Rf(116*a-16,500*(e-a),200*(a-n),t.opacity)}function zf(t,e,n,r){return 1===arguments.length?Mf(t):new Rf(t,e,n,null==r?1:r)}function Rf(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Ff(t){return t>Af?Math.pow(t,1/3):t/Ef+Tf}function If(t){return t>Cf?t*t*t:Ef*(t-Tf)}function Bf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Lf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Nf(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Df(t){if(isNaN(t.h))return new Rf(t.l,0,0,t.opacity);var e=t.h*_f;return new Rf(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function Gf(t,e){var n=He((t=zf(t)).l,(e=zf(e)).l),r=He(t.a,e.a),o=He(t.b,e.b),i=He(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=o(e),t.opacity=i(e),t+""}}function Uf(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wf(t,e);var n={}.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)?Wf(t,e):void 0}}(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 Wf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}le(Rf,zf,ce(se,{brighter(t){return new Rf(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Rf(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Ae(Bf(3.1338561*(e=Pf*If(e))-1.6168667*(t=1*If(t))-.4906146*(n=kf*If(n))),Bf(-.9787684*e+1.9161415*t+.033454*n),Bf(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),le(Nf,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Nf)return new Nf(t.h,t.c,t.l,t.opacity);if(t instanceof Rf||(t=Mf(t)),0===t.a&&0===t.b)return new Nf(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*jf;return new Nf(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Nf(t,e,n,null==r?1:r)},ce(se,{brighter(t){return new Nf(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Nf(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Df(this).rgb()}}));var $f=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t[0],o=t[1],i=t[2],a=Uf(n.center||[1/3,1/3,1/3],3),u=a[0],l=a[1],c=a[2],s=null==n.withMixedClasses||n.withMixedClasses,f=n.centerCoefficient?1-n.centerCoefficient:void 0,h=function(t){var n=e(t);if(n){var a=+t[r]/n,h=+t[o]/n,y=+t[i]/n;return a>=u&&h<=l&&y<=c?null!=f&&(y-c)*(l-f*l)>=(h-f*l)*(f*c-c)?"center":"0":a<=u&&h>=l&&y<=c?null!=f&&(y-c)*(u-f*u)>=(a-f*u)*(f*c-c)?"center":"1":a<=u&&h<=l&&y>=c?null!=f&&(h-l)*(u-f*u)>=(a-f*u)*(f*l-l)?"center":"2":a<=u&&h>=l&&y>=c?null!=f&&a>f*u?"center":s?"m12":h>y?"1":"2":a>=u&&h<=l&&y>=c?null!=f&&h>f*l?"center":s?"m02":a>y?"0":"2":a>=u&&h>=l&&y<=c?null!=f&&y>f*c?"center":s?"m01":h>a?"1":"0":"unknown"}};return h.center=[u,l,c],h.centerCoefficient=n.centerCoefficient,h},Hf=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=Uf(n||["red","green","blue"],3),i=o[0],a=o[1],u=o[2],l=r.colorInterpolation||Gf,c=null==r.withMixedClasses||r.withMixedClasses,s=function(t,e){return l(t,e)(.5)},f=Uf(r.mixedColors||c?[s(a,u),s(i,u),s(i,a)]:[],3),h=f[0],y=f[1],p=f[2],v=r.centerColor||l(s(i,a),u)(.333),d=$f(t,e,r),b=function(t){var e=d(t);return"0"==e?i:"1"==e?a:"2"==e?u:"m12"==e?h:"m02"==e?y:"m01"==e?p:"center"==e?v:r.defaultColor||"black"};return b.center=d.center,b.centerCoefficient=r.centerCoefficient,b.colors=[i,a,u],b.mixColors=[h,y,p],b.centerColor=v,b.classifier=d,b};function qf(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 Yf,Vf=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xf(t){if(!(e=Vf.exec(t)))throw new Error("invalid format: "+t);var e;return new Zf({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 Zf(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 Jf(t,e){var n=qf(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")}Xf.prototype=Zf.prototype,Zf.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 Kf={"%":(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)=>Jf(100*t,e),r:Jf,s:function(t,e){var n=qf(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Yf=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")+qf(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Qf(t){return t}var th,eh=Array.prototype.map,nh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function rh(t){return th=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Qf:(e=eh.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?Qf:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(eh.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Xf(t)).fill,n=t.align,f=t.sign,h=t.symbol,y=t.zero,p=t.width,v=t.comma,d=t.precision,b=t.trim,m=t.type;"n"===m?(v=!0,m="g"):Kf[m]||(void 0===d&&(d=12),b=!0,m="g"),(y||"0"===e&&"="===n)&&(y=!0,e="0",n="=");var g="$"===h?o:"#"===h&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===h?i:/[%p]/.test(m)?l:"",x=Kf[m],S=/[defgprs%]/.test(m);function O(t){var o,i,l,h=g,O=w;if("c"===m)O=x(t)+O,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:x(Math.abs(t),d),b&&(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)),_&&0===+t&&"+"!==f&&(_=!1),h=(_?"("===f?f:c:"-"===f||"("===f?"":f)+h,O=("s"===m?nh[8+Yf/3]:"")+O+(_&&"("===f?")":""),S)for(o=-1,i=t.length;++o<i;)if(48>(l=t.charCodeAt(o))||l>57){O=(46===l?a+t.slice(o+1):t.slice(o))+O,t=t.slice(0,o);break}}v&&!y&&(t=r(t,1/0));var j=h.length+t.length+O.length,P=j<p?new Array(p-j+1).join(e):"";switch(v&&y&&(t=r(P+t,P.length?p-O.length:1/0),P=""),n){case"<":t=h+t+O+P;break;case"=":t=h+P+t+O;break;case"^":t=P.slice(0,j=P.length>>1)+h+t+O+P.slice(j);break;default:t=P+h+t+O}return u(t)}return d=void 0===d?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),O.toString=function(){return t+""},O}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=Xf(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=qf(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-o),a=nh[8+o/3];return function(t){return r(i*t)+a}}}}(t),th.format,th.formatPrefix,th}rh({thousands:",",grouping:[3],currency:["$",""]});var oh=Fn.getParameterByName;return rh({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})());
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gridviz=e():t.gridviz=e()}(self,()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},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(t){return n="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},n(t)}function r(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,o(r.key),r)}}function o(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function i(t,e){var n=t.visible;return"function"==typeof n?!!n(e):!1!==n}t.r(e),t.d(e,{BackgroundLayer:()=>rs,BackgroundLayerImage:()=>bs,BackgroundLayerWMS:()=>ss,CSVGrid:()=>Uo,CircleColorSizeWebGLStyle:()=>kl,ColorCategoryLegend:()=>pf,ColorDiscreteLegend:()=>lf,ColorLegend:()=>tf,CompositionStyle:()=>Ii,Dataset:()=>Gr,DotDensityStyle:()=>bu,GeoCanvas:()=>Dn,GeoJSONLayer:()=>Gs,GridLayer:()=>Zc,ImageStyle:()=>Oc,Interpolator:()=>Mc,IsoFenceStyle:()=>sc,JSGrid:()=>Zo,JoyPlotStyle:()=>Pi,LabelLayer:()=>Ts,Layer:()=>zr,LegoStyle:()=>ol,Map:()=>br,MosaicStyle:()=>Il,MultiResolutionDataset:()=>Vr,NinjaStarStyle:()=>Hl,OrientationLegend:()=>If,PillarStyle:()=>ua,RandomWalkInterpolator:()=>Dc,SegmentStyle:()=>Hi,ShadingRayStyle:()=>Wa,ShadingStyle:()=>Xa,ShapeColorSizeStyle:()=>oi,SideCategoryStyle:()=>ru,SideStyle:()=>pa,SideTanakaStyle:()=>ju,SizeLegend:()=>Of,SquareColorCategoryWebGLStyle:()=>Ia,SquareColorWebGLStyle:()=>bl,StrokeStyle:()=>hi,Style:()=>Pr,TernaryLegend:()=>Hf,TextStyle:()=>Ji,TiledGrid:()=>To,TimeSeriesStyle:()=>Ql,VennLegend:()=>Jf,cellsToMatrix:()=>gi,circularInverseScale:()=>ih,circularScale:()=>oh,classifier:()=>Hu,classifierMinMax:()=>Yu,colorClassifier:()=>$u,discreteColors:()=>Vu,exponentialScale:()=>th,getParameterByName:()=>Dh,logarithmicScale:()=>eh,nice:()=>mi,orientationLegend:()=>Bf,powerInverseScale:()=>rh,powerScale:()=>nh,sizeDiscreteLegend:()=>Cf,sizeDiscreteViewScaleLegend:()=>kf,sizeLegend:()=>jf,sizeLegendViewScale:()=>Pf,stretchedBreaks:()=>Wu,ternaryClassifier:()=>Ph,ternaryColorClassifier:()=>Ch,viewScale:()=>Bu,viewScaleColor:()=>Nu,viewScaleColorQuantile:()=>Du,viewScaleCombination:()=>Uu,viewScaleQuantile:()=>Lu,viewScaleQuantileClassifer:()=>Gu});var a=function(){return t=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.visible=e.visible,this.alpha=e.alpha,this.blendOperation=e.blendOperation,this.filterColor=e.filterColor,this.filterBlendOperation=e.filterBlendOperation},(e=[{key:"isVisible",value:function(t){return i(this,t)}},{key:"drawFilter",value:function(t){if(this.filterColor){var e=this.filterColor(t.view.z);if(e&&"none"!=e){t.offscreenCtx.fillStyle=e;var n=void 0,r=void 0;this.filterBlendOperation&&(n=t.offscreenCtx.globalCompositeOperation,r=this.filterBlendOperation(t.view.z)),r&&"none"!=r&&(t.offscreenCtx.globalCompositeOperation=r),t.offscreenCtx.fillRect(0,0,t.w,t.h),n&&(t.offscreenCtx.globalCompositeOperation=n)}}}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function u(){}function l(t){return null==t?u:function(){return this.querySelector(t)}}function c(){return[]}function s(t){return null==t?c:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function h(t){return function(e){return e.matches(t)}}var y=Array.prototype.find;function v(){return this.firstElementChild}var p=Array.prototype.filter;function d(){return Array.from(this.children)}function b(t){return new Array(t.length)}function m(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}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 m(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function w(t,e,n,r,o,i,a){var u,l,c,s=new Map,f=e.length,h=i.length,y=new Array(f);for(u=0;u<f;++u)(l=e[u])&&(y[u]=c=a.call(l,l.__data__,u,e)+"",s.has(c)?o[u]=l:s.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=s.get(c))?(r[u]=l,l.__data__=i[u],s.delete(c)):n[u]=new m(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(y[u])===l&&(o[u]=l)}function S(t){return t.__data__}function x(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function _(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}m.prototype={constructor:m,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 O="http://www.w3.org/1999/xhtml";const j={svg:"http://www.w3.org/2000/svg",xhtml:O,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function P(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),j.hasOwnProperty(e)?{space:j[e],local:t}:t}function C(t){return function(){this.removeAttribute(t)}}function k(t){return function(){this.removeAttributeNS(t.space,t.local)}}function T(t,e){return function(){this.setAttribute(t,e)}}function A(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 M(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 z(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function R(t){return function(){this.style.removeProperty(t)}}function F(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function B(t,e){return t.style.getPropertyValue(e)||z(t).getComputedStyle(t,null).getPropertyValue(e)}function L(t){return function(){delete this[t]}}function N(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 G(t){return t.trim().split(/^|\s+/)}function U(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function H(t,e){for(var n=U(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function Y(t,e){for(var n=U(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function $(t){return function(){H(this,t)}}function V(t){return function(){Y(this,t)}}function q(t,e){return function(){(e.apply(this,arguments)?H:Y)(this,t)}}function X(){this.textContent=""}function Z(t){return function(){this.textContent=t}}function K(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function J(){this.innerHTML=""}function Q(t){return function(){this.innerHTML=t}}function tt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function et(){this.nextSibling&&this.parentNode.appendChild(this)}function nt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===O&&e.documentElement.namespaceURI===O?e.createElement(t):e.createElementNS(n,t)}}function ot(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function it(t){var e=P(t);return(e.local?ot:rt)(e)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function lt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ct(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function st(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 ht(t,e,n){var r=z(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 yt(t,e){return function(){return ht(this,t,e)}}function vt(t,e){return function(){return ht(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 pt=[null];function dt(t,e){this._groups=t,this._parents=e}function bt(){return new dt([[document.documentElement]],pt)}dt.prototype=bt.prototype={constructor:dt,select: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,u=e[o],c=u.length,s=r[o]=new Array(c),f=0;f<c;++f)(i=u[f])&&(a=t.call(i,i.__data__,f,u))&&("__data__"in i&&(a.__data__=i.__data__),s[f]=a);return new dt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(t):s(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var a,u=e[i],l=u.length,c=0;c<l;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),o.push(a));return new dt(r,o)},selectChild:function(t){return this.select(null==t?v:function(t){return function(){return y.call(this.children,t)}}("function"==typeof t?t:h(t)))},selectChildren:function(t){return this.selectAll(null==t?d:function(t){return function(){return p.call(this.children,t)}}("function"==typeof t?t:h(t)))},filter:function(t){"function"!=typeof t&&(t=f(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,l=r[o]=[],c=0;c<u;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&l.push(i);return new dt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,S);var n,r=e?w:g,o=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,u=new Array(a),l=new Array(a),c=new Array(a),s=0;s<a;++s){var f=o[s],h=i[s],y=h.length,v=x(t.call(f,f&&f.__data__,s,o)),p=v.length,d=l[s]=new Array(p),b=u[s]=new Array(p);r(f,h,d,b,c[s]=new Array(y),v,e);for(var m,_,O=0,j=0;O<p;++O)if(m=d[O]){for(O>=j&&(j=O+1);!(_=b[j])&&++j<p;);m._next=_||null}}return(u=new dt(u,o))._enter=l,u._exit=c,u},enter:function(){return new dt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new dt(this._exit||this._groups.map(b),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,s=n[l],f=r[l],h=s.length,y=u[l]=new Array(h),v=0;v<h;++v)(c=s[v]||f[v])&&(y[v]=c);for(;l<o;++l)u[l]=n[l];return new dt(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=_);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),s=0;s<l;++s)(a=u[s])&&(c[s]=a);c.sort(e)}return new dt(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=P(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?M:E:n.local?A:T)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?R:"function"==typeof e?I:F)(t,e,null==n?"":n)):B(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?L:"function"==typeof e?D:N)(t,e)):this.node()[t]},classed:function(t,e){var n=G(t+"");if(arguments.length<2){for(var r=U(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?q:e?$:V)(n,e))},text:function(t){return arguments.length?this.each(null==t?X:("function"==typeof t?K:Z)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?J:("function"==typeof t?tt:Q)(t)):this.node().innerHTML},raise:function(){return this.each(et)},lower:function(){return this.each(nt)},append:function(t){var e="function"==typeof t?t:it(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:it(t),r=null==e?at:"function"==typeof e?e:l(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?ct:lt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=function(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}})}(t+""),a=i.length;if(!(arguments.length<2)){for(u=e?ft:st,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,s=u.length;c<s;++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?vt:yt)(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)}};const mt=bt;function gt(t){return"string"==typeof t?new dt([[document.querySelector(t)]],[document.documentElement]):new dt([[t]],pt)}var wt={value:()=>{}};function St(){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 _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]=wt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}xt.prototype=St.prototype={constructor:xt,on:function(t,e){var n,r,o=this._,i=(r=o,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(n=(t=i[a]).type)o[n]=Ot(o[n],t.name,e);else if(null==e)for(n in o)o[n]=Ot(o[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=_t(o[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)}};const jt=St,Pt={capture:!0,passive:!1};function Ct(t){t.preventDefault(),t.stopImmediatePropagation()}function kt(t){return((t=Math.exp(t))+1/t)/2}const Tt=function t(e,n,r){function o(t,o){var i,a,u=t[0],l=t[1],c=t[2],s=o[0],f=o[1],h=o[2],y=s-u,v=f-l,p=y*y+v*v;if(p<1e-12)a=Math.log(h/c)/e,i=function(t){return[u+t*y,l+t*v,c*Math.exp(e*t*a)]};else{var d=Math.sqrt(p),b=(h*h-c*c+r*p)/(2*c*n*d),m=(h*h-c*c-r*p)/(2*h*n*d),g=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-g)/e,i=function(t){var r,o=t*a,i=kt(g),s=c/(n*d)*(i*(r=e*o+g,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[u+s*y,l+s*v,c*i/kt(e*o+g)]}}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);function At(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]}var Et,Mt,zt=0,Rt=0,Ft=0,It=0,Bt=0,Lt=0,Nt="object"==typeof performance&&performance.now?performance:Date,Dt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gt(){return Bt||(Dt(Ut),Bt=Nt.now()+Lt)}function Ut(){Bt=0}function Wt(){this._call=this._time=this._next=null}function Ht(t,e,n){var r=new Wt;return r.restart(t,e,n),r}function Yt(){Bt=(It=Nt.now())+Lt,zt=Rt=0;try{!function(){Gt(),++zt;for(var t,e=Et;e;)(t=Bt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zt}()}finally{zt=0,function(){for(var t,e,n=Et,r=1/0;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:Et=e);Mt=t,Vt(r)}(),Bt=0}}function $t(){var t=Nt.now(),e=t-It;e>1e3&&(Lt-=e,It=t)}function Vt(t){zt||(Rt&&(Rt=clearTimeout(Rt)),t-Bt>24?(t<1/0&&(Rt=setTimeout(Yt,t-Nt.now()-Lt)),Ft&&(Ft=clearInterval(Ft))):(Ft||(It=Nt.now(),Ft=setInterval($t,1e3)),zt=1,Dt(Yt)))}function qt(t,e,n){var r=new Wt;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Wt.prototype=Ht.prototype={constructor:Wt,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||Mt===this||(Mt?Mt._next=this:Et=this,Mt=this),this._call=t,this._time=n,Vt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vt())}};var Xt=jt("start","end","cancel","interrupt"),Zt=[];function Kt(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,s,f,h;if(1!==n.state)return u();for(c in o)if((h=o[c]).name===n.name){if(3===h.state)return qt(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(qt(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(f=n.tween.length),c=0,s=-1;c<f;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++s]=h);r.length=s+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=Ht(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:Xt,tween:Zt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Jt(t,e){var n=te(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Qt(t,e){var n=te(t,e);if(n.state>3)throw new Error("too late; already running");return n}function te(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ee(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}}function ne(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var re,oe=180/Math.PI,ie={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ae(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)*oe,skewX:Math.atan(l)*oe,scaleX:a,scaleY:u}}function ue(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:ne(t,o)},{i:l-2,x:ne(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:ne(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:ne(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:ne(t,n)},{i:u-2,x:ne(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 le=ue(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ie:ae(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),ce=ue(function(t){return null==t?ie:(re||(re=document.createElementNS("http://www.w3.org/2000/svg","g")),re.setAttribute("transform",t),(t=re.transform.baseVal.consolidate())?ae((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ie)},", ",")",")");function se(t,e){var n,r;return function(){var o=Qt(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 fe(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=Qt(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 he(t,e,n){var r=t._id;return t.each(function(){var t=Qt(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return te(t,r).value[e]}}function ye(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ve(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function pe(){}var de=.7,be=1/de,me="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Se=/^#([0-9a-f]{3,8})$/,xe=new RegExp(`^rgb\\(${me},${me},${me}\\)$`),_e=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),Oe=new RegExp(`^rgba\\(${me},${me},${me},${ge}\\)$`),je=new RegExp(`^rgba\\(${we},${we},${we},${ge}\\)$`),Pe=new RegExp(`^hsl\\(${ge},${we},${we}\\)$`),Ce=new RegExp(`^hsla\\(${ge},${we},${we},${ge}\\)$`),ke={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 Te(){return this.rgb().formatHex()}function Ae(){return this.rgb().formatRgb()}function Ee(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Se.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Me(e):3===n?new Ie(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ze(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ze(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=xe.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))?ze(e[1],e[2],e[3],e[4]):(e=je.exec(t))?ze(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Pe.exec(t))?Ue(e[1],e[2]/100,e[3]/100,1):(e=Ce.exec(t))?Ue(e[1],e[2]/100,e[3]/100,e[4]):ke.hasOwnProperty(t)?Me(ke[t]):"transparent"===t?new Ie(NaN,NaN,NaN,0):null}function Me(t){return new Ie(t>>16&255,t>>8&255,255&t,1)}function ze(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ie(t,e,n,r)}function Re(t){return t instanceof pe||(t=Ee(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?Re(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 Be(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}`}function Le(){const t=Ne(this.opacity);return`${1===t?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${1===t?")":`, ${t})`}`}function Ne(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 Ge(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 He(t,e,n,r)}function We(t){if(t instanceof He)return new He(t.h,t.s,t.l,t.opacity);if(t instanceof pe||(t=Ee(t)),!t)return new He;if(t instanceof He)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 He(a,u,l,t.opacity)}function He(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ye(t){return(t=(t||0)%360)<0?t+360:t}function $e(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 qe(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}ye(pe,Ee,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Te,formatHex:Te,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return We(this).formatHsl()},formatRgb:Ae,toString:Ae}),ye(Ie,Fe,ve(pe,{brighter(t){return t=null==t?be:Math.pow(be,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?de:Math.pow(de,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),Ne(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:Be,formatHex:Be,formatHex8:function(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}${Ge(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Le,toString:Le})),ye(He,function(t,e,n,r){return 1===arguments.length?We(t):new He(t,e,n,null==r?1:r)},ve(pe,{brighter(t){return t=null==t?be:Math.pow(be,t),new He(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?de:Math.pow(de,t),new He(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 He(Ye(this.h),$e(this.s),$e(this.l),Ne(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=Ne(this.opacity);return`${1===t?"hsl(":"hsla("}${Ye(this.h)}, ${100*$e(this.s)}%, ${100*$e(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Ze(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Ke=function t(e){var n=function(t){return 1===(t=+t)?Ze: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):Xe(isNaN(e)?n:e)}}(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=Ze(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 Je(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+""}}}Je(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 qe((n-r/e)*e,a,o,i,u)}}),Je(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 qe((n-r/e)*e,o,i,a,u)}});var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tn=new RegExp(Qe.source,"g");function en(t,e){var n,r,o,i=Qe.lastIndex=tn.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=Qe.exec(t))&&(r=tn.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:ne(n,r)})),i=tn.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("")})}function nn(t,e){var n;return("number"==typeof e?ne:e instanceof Ee?Ke:(n=Ee(e))?(e=n,Ke):en)(t,e)}function rn(t){return function(){this.removeAttribute(t)}}function on(t){return function(){this.removeAttributeNS(t.space,t.local)}}function an(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 un(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 ln(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 cn(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 sn(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,o)),n}return o._value=e,o}function fn(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,o)),n}return o._value=e,o}function hn(t,e){return function(){Jt(this,t).delay=+e.apply(this,arguments)}}function yn(t,e){return e=+e,function(){Jt(this,t).delay=e}}function vn(t,e){return function(){Qt(this,t).duration=+e.apply(this,arguments)}}function pn(t,e){return e=+e,function(){Qt(this,t).duration=e}}var dn=mt.prototype.constructor;function bn(t){return function(){this.style.removeProperty(t)}}var mn=0;function gn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function wn(){return++mn}var Sn=mt.prototype;gn.prototype=function(t){return mt().transition(t)}.prototype={constructor:gn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=l(t));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],f=s.length,h=i[a]=new Array(f),y=0;y<f;++y)(u=s[y])&&(c=t.call(u,u.__data__,y,s))&&("__data__"in u&&(c.__data__=u.__data__),h[y]=c,Kt(h[y],e,n,y,h,te(u,n)));return new gn(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=s(t));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var l,c=r[u],f=c.length,h=0;h<f;++h)if(l=c[h]){for(var y,v=t.call(l,l.__data__,h,c),p=te(l,n),d=0,b=v.length;d<b;++d)(y=v[d])&&Kt(y,e,n,d,v,p);i.push(v),a.push(l)}return new gn(i,a,e,n)},selectChild:Sn.selectChild,selectChildren:Sn.selectChildren,filter:function(t){"function"!=typeof t&&(t=f(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,l=r[o]=[],c=0;c<u;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&l.push(i);return new gn(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],s=n[u],f=c.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=c[y]||s[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new gn(a,this._parents,this._name,this._id)},selection:function(){return new dn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=wn(),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 s=te(a,e);Kt(a,t,n,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new gn(r,this._parents,t,n)},call:Sn.call,nodes:Sn.nodes,node:Sn.node,size:Sn.size,empty:Sn.empty,each:Sn.each,on:function(t,e){var n=this._id;return arguments.length<2?te(this.node(),n).on.on(t):this.each(function(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)?Jt:Qt;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(e,n),a.on=o}}(n,t,e))},attr:function(t,e){var n=P(t),r="transform"===n?ce:nn;return this.attrTween(t,"function"==typeof e?(n.local?cn:ln)(n,r,he(this,"attr."+t,e)):null==e?(n.local?on:rn)(n):(n.local?un:an)(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=P(t);return this.tween(n,(r.local?sn:fn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?le:nn;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=B(this,t),a=(this.style.removeProperty(t),B(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,bn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=B(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=B(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,he(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=Qt(this,t),c=l.on,s=null==l.value[a]?i||(i=bn(e)):void 0;c===n&&o===s||(r=(n=c).copy()).on(u,o=s),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,o,i=n+"";return function(){var a=B(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,function(t,e,n){var r,o;function i(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,i,n)),r}return i._value=e,i}(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}}(he(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,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(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 r,o=te(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?se:fe)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?hn:yn)(e,t)):te(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?vn:pn)(e,t)):te(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Qt(this,t).ease=e}}(e,t)):te(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;Qt(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=Qt(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]:Sn[Symbol.iterator]};var xn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function _n(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}mt.prototype.interrupt=function(t){return this.each(function(){ee(this,t)})},mt.prototype.transition=function(t){var e,n;t instanceof gn?(e=t._id,t=t._name):(e=wn(),(n=xn).time=Gt(),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])&&Kt(a,t,e,c,u,n||_n(a,e));return new gn(r,this._parents,t,e)};const On=t=>()=>t;function jn(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 Pn(t,e,n){this.k=t,this.x=e,this.y=n}Pn.prototype={constructor:Pn,scale:function(t){return 1===t?this:new Pn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Pn(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 Cn=new Pn(1,0,0);function kn(t){t.stopImmediatePropagation()}function Tn(t){t.preventDefault(),t.stopImmediatePropagation()}function An(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function En(){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 Mn(){return this.__zoom||Cn}function zn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Rn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(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))}function In(t){return In="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},In(t)}function Bn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ln(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,Nn(r.key),r)}}function Nn(t){var e=function(t){if("object"!=In(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:e+""}Pn.prototype;var Dn=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.opts=a||{},this.canvas=e,this.canvas.style.cursor="grab",this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.offscreenCanvas=document.createElement("canvas"),this.offscreenCanvas.width=this.w,this.offscreenCanvas.height=this.h;var u=this.canvas.getContext("2d"),l=this.offscreenCanvas.getContext("2d");if(!u)throw"Impossible to create canvas 2D context";if(!l)throw"Impossible to create canvas 2D context";if(this.ctx=u,this.offscreenCtx=l,this.view={x:r,y:o,z:i},this.backgroundColor=a.backgroundColor||"white",this.onZoomStartFun=a.onZoomStartFun,this.onZoomEndFun=a.onZoomEndFun,this.onZoomFun=a.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!a.disableZoom){var c=Cn;(function(){var t,e,n,r=An,o=En,i=Fn,a=zn,u=Rn,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,f=Tt,h=jt("start","zoom","end"),y=0,v=10;function p(t){t.property("__zoom",Mn).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",O).filter(u).on("touchstart.zoom",j).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",C).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 Pn(e,t.x,t.y)}function b(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 Pn(t.k,r,o)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function g(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?m(u):"function"==typeof n?n.apply(t,i):n,c=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=t.__zoom,h="function"==typeof e?e.apply(t,i):e,y=f(s.invert(l).concat(c/s.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 Pn(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 S(t,e)}function S(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(t,e),this.taps=0}function x(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)))),s=At(t);if(n.wheel)n.mouse[0][0]===s[0]&&n.mouse[0][1]===s[1]||(n.mouse[1]=o.invert(n.mouse[0]=s)),clearTimeout(n.wheel);else{if(o.k===u)return;n.mouse=[s,o.invert(s)],ee(this),n.start()}Tn(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(b(d(o,u),n.mouse[0],n.mouse[1]),n.extent,c))}}function _(t,...e){if(!n&&r.apply(this,arguments)){var o=t.currentTarget,a=w(this,e,!0).event(t),u=gt(t.view).on("mousemove.zoom",function(t){if(Tn(t),!a.moved){var e=t.clientX-s,n=t.clientY-f;a.moved=e*e+n*n>y}a.event(t).zoom("mouse",i(b(a.that.__zoom,a.mouse[0]=At(t,o),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){u.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=gt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Ct,Pt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,a.moved),Tn(t),a.event(t).end()},!0),l=At(t,o),s=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=gt(t).on("dragstart.drag",Ct,Pt);"onselectstart"in e?n.on("selectstart.drag",Ct,Pt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),kn(t),a.mouse=[l,this.__zoom.invert(l)],ee(this),a.start()}}function O(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=At(t.changedTouches?t.changedTouches[0]:t,this),u=n.invert(a),l=n.k*(t.shiftKey?.5:2),f=i(b(d(n,l),a,u),o.apply(this,e),c);Tn(t),s>0?gt(this).transition().duration(s).call(g,f,a,t):gt(this).call(p.transform,f,a,t)}}function j(n,...o){if(r.apply(this,arguments)){var i,a,u,l,c=n.touches,s=c.length,f=w(this,o,n.changedTouches.length===s).event(n);for(kn(n),a=0;a<s;++a)l=[l=At(u=c[a],this),this.__zoom.invert(l),u.identifier],f.touch0?f.touch1||f.touch0[2]===l[2]||(f.touch1=l,f.taps=0):(f.touch0=l,i=!0,f.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(f.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),ee(this),f.start())}}function P(t,...e){if(this.__zooming){var n,r,o,a,u=w(this,e).event(t),l=t.changedTouches,s=l.length;for(Tn(t),n=0;n<s;++n)o=At(r=l[n],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 f=u.touch0[0],h=u.touch0[1],y=u.touch1[0],v=u.touch1[1],p=(p=y[0]-f[0])*p+(p=y[1]-f[1])*p,m=(m=v[0]-h[0])*m+(m=v[1]-h[1])*m;r=d(r,Math.sqrt(p/m)),o=[(f[0]+y[0])/2,(f[1]+y[1])/2],a=[(h[0]+v[0])/2,(h[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(b(r,o,a),u.extent,c))}}function C(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(kn(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=At(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<v)){var c=gt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return p.transform=function(t,e,n,r){var o=t.selection?t.selection():t;o.property("__zoom",Mn),t!==o?g(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()})},p.scaleBy=function(t,e,n,r){p.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},p.scaleTo=function(t,e,n,r){p.transform(t,function(){var t=o.apply(this,arguments),r=this.__zoom,a=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,u=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return i(b(d(r,l),a,u),t,c)},n,r)},p.translateBy=function(t,e,n,r){p.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)},p.translateTo=function(t,e,n,r,a){p.transform(t,function(){var t=o.apply(this,arguments),a=this.__zoom,u=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return i(Cn.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)},S.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=gt(this.that).datum();h.call(t,this.that,new jn(t,{sourceEvent:this.sourceEvent,target:p,type:t,transform:this.that.__zoom,dispatch:h}),e)}},p.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:On(+t),p):a},p.filter=function(t){return arguments.length?(r="function"==typeof t?t:On(!!t),p):r},p.touchable=function(t){return arguments.length?(u="function"==typeof t?t:On(!!t),p):u},p.extent=function(t){return arguments.length?(o="function"==typeof t?t:On([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),p):o},p.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],p):[l[0],l[1]]},p.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],p):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},p.constrain=function(t){return arguments.length?(i=t,p):i},p.duration=function(t){return arguments.length?(s=+t,p):s},p.interpolate=function(t){return arguments.length?(f=t,p):f},p.on=function(){var t=h.on.apply(h,arguments);return t===h?p:t},p.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,p):Math.sqrt(y)},p.tapDistance=function(t){return arguments.length?(v=+t,p):v},p})().wheelDelta(function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)}).on("zoom",function(t){n._isZooming=!0;var e=t.transform,r=c.k/e.k;if(1==r){var o=c.x-e.x,i=c.y-e.y;n.applyPan(o*n.view.z,-i*n.view.z)}else s(t,r);c=e,n.onZoomFun&&n.onZoomFun(t)}).on("start",function(t){var e;try{n.canvas.style.cursor="grabbing"}catch(t){}n._isZooming=!0,n.canvasSave.c=document.createElement("canvas"),n.canvasSave.c.setAttribute("width",""+n.w),n.canvasSave.c.setAttribute("height",""+n.h),null===(e=n.canvasSave.c.getContext("2d"))||void 0===e||e.drawImage(n.canvas,0,0),n.canvasSave.dx=0,n.canvasSave.dy=0,n.canvasSave.f=1,n.canvasSave.view={x:n.view.x,y:n.view.y,z:n.view.z},n.onZoomStartFun&&n.onZoomStartFun(t)}).on("end",function(t){try{n.canvas.style.cursor="grab"}catch(t){}n._isZooming=!1,n.redraw(),n.canvasSave={c:null,dx:0,dy:0,f:1},n.onZoomEndFun&&n.onZoomEndFun(t)})(gt(this.canvas));var s=function(t,e){n.cancelCurrentRequests();var r=t.sourceEvent;if(r instanceof WheelEvent)n.applyZoom(e,n.pixToGeoX(r.offsetX),n.pixToGeoY(r.offsetY));else if(r instanceof TouchEvent){var o,i=0,a=0,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Bn(t,e);var n={}.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)?Bn(t,e):void 0}}(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}}}}(r.targetTouches);try{for(u.s();!(o=u.n()).done;){var l=o.value;i+=l.clientX,a+=l.clientY}}catch(t){u.e(t)}finally{u.f()}i/=r.targetTouches.length,a/=r.targetTouches.length,n.applyZoom(e,n.pixToGeoX(i),n.pixToGeoY(a))}}}this.xMin=a.centerExtent?a.centerExtent[0]:void 0,this.yMin=a.centerExtent?a.centerExtent[1]:void 0,this.xMax=a.centerExtent?a.centerExtent[2]:void 0,this.yMax=a.centerExtent?a.centerExtent[3]:void 0,this.zoomExtent=a.zoomExtent||[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}return e=t,n=[{key:"applyPan",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;null!=this.xMin&&this.view.x+t<this.xMin&&(t=this.xMin-this.view.x),null!=this.yMin&&this.view.y+e<this.yMin&&(e=this.yMin-this.view.y),null!=this.xMax&&this.view.x+t>this.xMax&&(t=this.xMax-this.view.x),null!=this.yMax&&this.view.y+e>this.yMax&&(e=this.yMax-this.view.y),this.view.x+=t,this.view.y+=e,this.updateExtentGeo(),this.canvasSave.c?this._drawSnapshot():console.log("no canvas save")}},{key:"applyZoom",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.view.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.view.y;if(!(this.zoomExtent[0]==this.view.z&&t<=1||this.zoomExtent[1]==this.view.z&&t>=1)){var r=t*this.view.z;r<this.zoomExtent[0]&&(t=this.zoomExtent[0]/this.view.z),r>this.zoomExtent[1]&&(t=this.zoomExtent[1]/this.view.z),this.view.z*=t;var o=(e-this.view.x)*(1-t),i=(n-this.view.y)*(1-t);null!=this.xMin&&this.view.x+o<this.xMin&&(o=this.xMin-this.view.x),null!=this.yMin&&this.view.y+i<this.yMin&&(i=this.yMin-this.view.y),null!=this.xMax&&this.view.x+o>this.xMax&&(o=this.xMax-this.view.x),null!=this.yMax&&this.view.y+i>this.yMax&&(i=this.yMax-this.view.y),this.view.x+=o,this.view.y+=i,this.updateExtentGeo(),this._drawZoomFrame(t,e,n)}}},{key:"_drawZoomFrame",value:function(){this.canvasSave.c&&this._drawSnapshot()}},{key:"_drawSnapshot",value:function(){var t=this.canvasSave.view,e=t?t.z/this.view.z:1,n=t?(t.x-.5*this.w*t.z-this.view.x)/this.view.z+.5*this.w:0,r=t?.5*this.h-(t.y+.5*this.h*t.z-this.view.y)/this.view.z:0;this.canvasSave.f=e,this.canvasSave.dx=n,this.canvasSave.dy=r,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,n,r,e*this.canvasSave.c.width,e*this.canvasSave.c.height),this.ctx.drawImage(this.offscreenCanvas,0,0,this.canvas.width,this.canvas.height)}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"white";this.opts.transparentBackground?(this.ctx.clearRect(0,0,this.w,this.h),this.offscreenCtx.clearRect(0,0,this.w,this.h)):(this.ctx&&(this.ctx.fillStyle=t),this.offscreenCtx&&(this.offscreenCtx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h),this.offscreenCtx.fillRect(0,0,this.w,this.h))}},{key:"getView",value:function(){return this.view}},{key:"setCenterExtent",value:function(t){this.xMin=t[0],this.yMin=t[1],this.xMax=t[2],this.yMax=t[3]}},{key:"getCenterExtent",value:function(){return[this.xMin,this.yMin,this.xMax,this.yMax]}},{key:"setZoomExtent",value:function(t){this.zoomExtent=t}},{key:"getZoomExtent",value:function(){return this.zoomExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0),this.offscreenCtx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.view.z,e=-this.view.x/this.view.z+.5*this.w,n=this.view.y/this.view.z+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n),this.offscreenCtx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.view.z),e=2/(this.h*this.view.z);return[t,0,0,0,e,0,-t*this.view.x,-e*this.view.y,1]}},{key:"getWebGLTransformCentered",value:function(){return[2/(this.w*this.view.z),0,0,0,2/(this.h*this.view.z),0,0,0,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"cancelCurrentRequests",value:function(){throw new Error("Method cancelCurrentRequests not implemented.")}},{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.view.x)/this.view.z+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.view.y)/this.view.z+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.view.z+this.view.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.view.z+this.view.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z");null==e||null==e||isNaN(+e)||(this.view.x=+e),null==n||null==n||isNaN(+n)||(this.view.y=+n),null==r||null==r||isNaN(+r)||(this.view.z=+r)}}],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&&Ln(e.prototype,n),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Gn(t){return Gn="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},Gn(t)}function Un(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,Wn(r.key),r)}}function Wn(t){var e=function(t){if("object"!=Gn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gn(e)?e:e+""}var Hn=function(){return t=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.maxWidth=e.maxWidth||"20em",this.fontSize=e.fontSize||"1rem",this.color=e.color||"#171a22",this.lineHeight=e.lineHeight||"1.5",this.background=e.background||"white",this.padding=e.padding||"4px",this.border=e.border||"1px solid #d5d5d5",this["border-radius"]=e["border-radius"]||"6px",this["box-shadow"]=e["box-shadow"]||"0px 4px 6px rgba(0, 0, 0, 0.1), 0px 1px 3px rgba(0, 0, 0, 0.08)",this["font-family"]=e["font-family"]||"'Helvetica Neue', Arial, Helvetica, sans-serif",this.transitionDuration=e.transitionDuration||100,this.xOffset=e.xOffset||30,this.yOffset=e.yOffset||20,this.yMouseOffset=e.yMouseOffset||0,this.xMouseOffset=e.xMouseOffset||0,this.parentElement=e.parentElement||document.body,this.tooltipElement=e.tooltipElement||null,this.tooltip=e.tooltipElement?gt(e.tooltipElement):gt(this.parentElement).append("div").attr("id","gridviz-tooltip").attr("class","gridviz-tooltip"),this.tooltip.style("max-width",this.maxWidth),this.tooltip.style("overflow","hidden"),this.tooltip.style("font-size",this.fontSize),this.tooltip.style("color",this.color),this.tooltip.style("line-height",this.lineHeight),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"),this.tooltip.style("text-wrap","nowrap"),this.tooltip.style("z-index",99999999),this.tooltip.style("left","0"),this.tooltip.style("top","0"),this.tooltip.classed("gridviz-tooltip",!0),this.tooltip.attr("role","tooltip").attr("aria-live","polite")},e=[{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){var e=this.parentElement.getBoundingClientRect(),n=t.clientX-e.left+this.xOffset,r=t.clientY-e.top-this.yOffset;this.tooltip.style("left",n+"px").style("top",r+"px"),this.ensureTooltipInsideContainer(t,e,this.tooltip.node())}},{key:"ensureTooltipInsideContainer",value:function(t,e,n){var r=n,o=e.width,i=e.height;if(r.offsetLeft+r.clientWidth>o){var a=t.clientX-r.clientWidth-this.xOffset;r.style.left=a+"px"}r.offsetTop+r.clientHeight>i&&(r.style.top=i-r.clientHeight+"px"),r.offsetTop<0&&(r.style.top="0px"),r.offsetLeft<0&&(r.style.left="0px")}},{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)}}],e&&Un(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Yn(t){return Yn="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},Yn(t)}function $n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Vn(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,Xn(r.key),r)}}function qn(t,e,n){return(e=Xn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xn(t){var e=function(t){if("object"!=Yn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yn(e)?e:e+""}var Zn=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e.map,this.parentNode=e.parentNode||e.map.container,e.id&&(this.div=gt("#"+e.id)),this.div&&!this.div.empty()||(this.div=gt(document.createElement("div")),e.id&&this.div.attr("id",e.id)),e.title&&this.div.attr("title",e.title),this.div.classed("gridviz-button",!0),e.class){var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return $n(t,e);var n={}.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)?$n(t,e):void 0}}(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}}}}(String(e.class).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}e.onClickFunction&&this.div.on("click",e.onClickFunction),this.style("box-sizing","border-box"),this.style("box-shadow","none"),this.style("background-color",t.BACKGROUND),this.style("border","1px solid var(--gridviz-button-border-color, #0e47cb)"),this.style("border-radius","var(--gridviz-button-radius, 10px)"),this.style("color","var(--gridviz-button-color, #0e47cb)"),this.style("overflow","hidden"),this.style("position","absolute"),this.style("cursor","pointer"),this.style("display","flex"),this.style("justify-content","center"),this.style("align-items","center"),this.style("width","var(--gridviz-button-size, 38px)"),this.style("height","var(--gridviz-button-size, 38px)"),this.parentNode.appendChild(this.div.node())},(e=[{key:"style",value:function(t,e){return this.div.style(t,e),this}}])&&Vn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Kn(t){return Kn="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},Kn(t)}function Jn(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,Qn(r.key),r)}}function Qn(t){var e=function(t){if("object"!=Kn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Kn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kn(e)?e:e+""}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function nr(t,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nr(t,e)}qn(Zn,"BACKGROUND","var(--gridviz-button-background, #ffffff)"),qn(Zn,"HOVER_BACKGROUND","var(--gridviz-button-hover-background, #f4f4f4)");var rr=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=er(e),function(t,e){if(e&&("object"==Kn(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)}(t,tr()?Reflect.construct(e,n||[],er(t).constructor):e.apply(t,n))}(this,e,[t])).onZoom=t.onZoom,n.delta=t.delta||.2,n.div.classed("gridviz-zoom-buttons",!0),n.zoomInBtn=document.createElement("a"),n.zoomInBtn.id="zoom-in",n.zoomInBtn.className="gridviz-zoom-button gridviz-zoom-button--in",n.zoomInBtn.title="Zoom in",n.zoomInBtn.textContent="+",n.zoomInBtn.addEventListener("click",function(t){n.zoomIn(t)}),n.zoomInBtn.addEventListener("mouseover",function(){n.zoomInBtn.style.backgroundColor=Zn.HOVER_BACKGROUND}),n.zoomInBtn.addEventListener("mouseout",function(){n.zoomInBtn.style.backgroundColor=Zn.BACKGROUND}),n.zoomOutBtn=document.createElement("a"),n.zoomOutBtn.id="zoom-out",n.zoomOutBtn.className="gridviz-zoom-button gridviz-zoom-button--out",n.zoomOutBtn.title="Zoom out",n.zoomOutBtn.textContent=String.fromCharCode(8722),n.zoomOutBtn.addEventListener("click",function(t){n.zoomOut(t)}),n.zoomOutBtn.addEventListener("mouseover",function(){n.zoomOutBtn.style.backgroundColor=Zn.HOVER_BACKGROUND}),n.zoomOutBtn.addEventListener("mouseout",function(){n.zoomOutBtn.style.backgroundColor=Zn.BACKGROUND}),[n.zoomInBtn,n.zoomOutBtn].forEach(function(t,e){t.style.alignItems="center",t.style.justifyContent="center",t.style.display="flex",t.style.border="none",t.style.color="var(--gridviz-button-color, #0e47cb)",t.style.fontFamily="'Helvetica Neue', Arial, Helvetica, sans-serif",t.style.textAlign="center",t.style.textDecoration="none",t.style.padding="0",t.style.boxSizing="border-box",t.style.width="calc(var(--gridviz-button-size, 38px) - 2px)",t.style.height="calc(var(--gridviz-button-size, 38px) - 2px)",t.style.fontSize="22px",t.style.fontWeight="bold",t.style.userSelect="none",t.style.backgroundColor=Zn.BACKGROUND,0===e&&(t.style.borderBottom="1px solid #ccc")}),n.style("height","unset"),n.style("display","unset"),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","10px"),n.div.node().appendChild(n.zoomInBtn),n.div.node().appendChild(n.zoomOutBtn),n}return 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&&nr(t,e)}(e,t),n=e,r=[{key:"zoomIn",value:function(t){this.map.setZoom(this.map.getZoom()*(1-this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}},{key:"zoomOut",value:function(t){this.map.setZoom(this.map.getZoom()*(1+this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}}],r&&Jn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Zn);function or(t){return or="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},or(t)}function ir(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,cr(r.key),r)}}function ar(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ar=function(){return!!t})()}function ur(t){return ur=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ur(t)}function lr(t,e){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lr(t,e)}function cr(t){var e=function(t){if("object"!=or(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=or(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==or(e)?e:e+""}var sr=function(t){function e(t){var n,r,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ur(e),function(t,e){if(e&&("object"==or(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)}(t,ar()?Reflect.construct(e,n||[],ur(t).constructor):e.apply(t,n))}(this,e,[t]),r=n,i=!1,(o=cr(o="isFullscreen"))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,n.div.classed("gridviz-fullscreen-button",!0),n.div.node().innerHTML='\n <svg\n class="gridviz-fullscreen-icon"\n style="height: 20px; width: 20px; fill: currentColor; margin:0;"\n focusable="false"\n aria-hidden="true"\n >\n <svg fill="currentColor" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg">\n <title/>\n <g>\n <path d="M30,0H6A5.9966,5.9966,0,0,0,0,6V30a6,6,0,0,0,12,0V12H30A6,6,0,0,0,30,0Z"/>\n <path d="M90,0H66a6,6,0,0,0,0,12H84V30a6,6,0,0,0,12,0V6A5.9966,5.9966,0,0,0,90,0Z"/>\n <path d="M30,84H12V66A6,6,0,0,0,0,66V90a5.9966,5.9966,0,0,0,6,6H30a6,6,0,0,0,0-12Z"/>\n <path d="M90,60a5.9966,5.9966,0,0,0-6,6V84H66a6,6,0,0,0,0,12H90a5.9966,5.9966,0,0,0,6-6V66A5.9966,5.9966,0,0,0,90,60Z"/>\n </g>\n </svg>\n </svg>\n ',n.defaultHeight=n.map.h,n.defaultWidth=n.map.w,n.div.on("click",function(t){n.onClickFunction(t)}),n.div.on("mouseover",function(t){n.style("background-color",Zn.HOVER_BACKGROUND)}),n.div.on("mouseout",function(t){n.style("background-color",Zn.BACKGROUND)}),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","90px"),n}return 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&&lr(t,e)}(e,t),n=e,(r=[{key:"onClickFunction",value:function(t){this.isFullscreen?(this.closeFullscreen(this.map.container),this.map.h=this.defaultHeight,this.map.w=this.defaultWidth,this.map.geoCanvas.h=this.defaultHeight,this.map.geoCanvas.w=this.defaultWidth,this.map.geoCanvas.canvas.setAttribute("width",""+this.defaultWidth),this.map.geoCanvas.canvas.setAttribute("height",""+this.defaultHeight),this.map.redraw(),this.isFullscreen=!1):(this.openFullscreen(this.map.container),this.map.h=window.screen.height,this.map.w=window.screen.width,this.isFullscreen=!0)}},{key:"openFullscreen",value:function(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}},{key:"closeFullscreen",value:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()}}])&&ir(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Zn);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},fr(t)}function hr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return yr(t,e);var n={}.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)?yr(t,e):void 0}}(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 yr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,pr(r.key),r)}}function pr(t){var e=function(t){if("object"!=fr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fr(e)?e:e+""}function dr(t){return t.cell.x+","+t.cell.y+","+t.resolution}var br=function(){return t=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=n.layers||[],this.asyncRedraw=!1!==n.asyncRedraw,this._redrawFrame=null,this.container=e||document.getElementById("gridviz"),this.container){this.container.classList.add("gridviz-map"),this.container.style.position="relative",this.w=n.w||this.container.offsetWidth,this.h=n.h||this.container.offsetHeight,this._canvas=n.canvas||this.initialiseCanvas(),this.geoCanvas=new Dn(this._canvas,n.x,n.y,n.z,n),this.geoCanvas.redraw=function(){r.redraw()},this.geoCanvas.cancelCurrentRequests=function(){var t,e=hr(r.layers);try{for(e.s();!(t=e.n()).done;){var n,o,i,a=t.value;if(null!==(n=a.dataset)&&void 0!==n&&n.datasets){var u,l,c=hr(null===(u=a.dataset)||void 0===u?void 0:u.datasets);try{for(c.s();!(l=c.n()).done;){var s=l.value;null!=s&&s.cancelCurrentRequests&&s.cancelCurrentRequests()}}catch(t){c.e(t)}finally{c.f()}}null!==(o=a.dataset)&&void 0!==o&&o.cancelCurrentRequests&&(null===(i=a.dataset)||void 0===i||i.cancelCurrentRequests())}}catch(t){e.e(t)}finally{e.f()}},this.legend=n.legendContainer?gt(n.legendContainer):null,this._legendProvidedByUser=!!n.legendContainer,this.onLegendUpdate=n.onLegendUpdate,this.legend||this.initialiseLegend(),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=this.container),this.tooltip=new Hn(n.tooltip),this.digForTooltip=n.digForTooltip||!1,this._focusFrame=null,this._focusEvent=null,this._lastMouseEvent=null,this._hovering=!1,this._hoverKey=null,this._refocusing=!1,this._hoverSource=null,this._triedKey=null,this._triedSource=null,this._pointer=null,this._pointerHandler=function(t){r._pointer={clientX:t.clientX,clientY:t.clientY}},this._pointerLeaveHandler=function(t){t.relatedTarget||(r._pointer=null)};for(var o=0,i=["mousemove","mousedown","wheel"];o<i.length;o++){var a=i[o];window.addEventListener(a,this._pointerHandler,{capture:!0,passive:!0})}window.addEventListener("mouseout",this._pointerLeaveHandler,{capture:!0,passive:!0});var u=function(t){r._lastMouseEvent=t,r._focusEvent=t,r._focusFrame||(r._focusFrame=requestAnimationFrame(function(){r._focusFrame=null;var t=r._focusEvent;r._focusEvent=null,t&&r.focusCell(t)}))};this.mouseOverHandler=u,this.mouseMoveHandler=u,this.mouseOutHandler=function(t){r._focusFrame&&cancelAnimationFrame(r._focusFrame),r._focusFrame=null,r._focusEvent=null,r._lastMouseEvent=null,r._hovering=!1,r._hoverKey=null,r._hoverSource=null,r._triedKey=null,r._triedSource=null,r.tooltip.hide()},this.geoCanvas.canvas.addEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.addEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.addEventListener("mouseout",this.mouseOutHandler),this.defineResizeObserver(),this.geoCanvas.onZoomStartFun=function(t){n.onZoomStartFun&&n.onZoomStartFun(t),r._hovering=!1,r._hoverKey=null,r._hoverSource=null,r._triedKey=null,r._triedSource=null,r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"#FF6347",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||function(){return 4},this.transparentBackground=n.transparentBackground,this.defaultGlobalCompositeOperation=n.defaultGlobalCompositeOperation||this.geoCanvas.ctx.globalCompositeOperation}else console.error("Cannot find gridviz container element.")},e=[{key:"initialiseCanvas",value:function(){var t=document.createElement("canvas");return t.classList.add("gridviz-canvas"),t.setAttribute("width",""+this.w),t.setAttribute("height",""+this.h),this.container.appendChild(t),t}},{key:"initialiseLegend",value:function(){this.legend=gt(this.container).append("div").attr("id","gridviz-legend").classed("gridviz-legends",!0).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFF").style("border","1px solid #d5d5d5").style("border-radius","6px").style("box-shadow","0px 4px 6px rgba(0, 0, 0, 0.1), 0px 1px 3px rgba(0, 0, 0, 0.08)").style("font-family","'Helvetica Neue', Arial, Helvetica, sans-serif").style("bottom","15px").style("right","15px")}},{key:"layers_",value:function(t){return 0===arguments.length?this.layers:(1===arguments.length?Array.isArray(t)?this.layers=t:this.layers=[t]:this.layers=arguments,this)}},{key:"redraw",value:function(){var t=this;return this.asyncRedraw?(this._redrawFrame||this._destroyed||(this._redrawFrame=requestAnimationFrame(function(){t._redrawFrame=null,t.redrawNow()})),this):this.redrawNow()}},{key:"redrawNow",value:function(){if(this._redrawFrame&&cancelAnimationFrame(this._redrawFrame),this._redrawFrame=null,this._destroyed)return this;this.legend&&(this.legend.selectAll(":scope > *:not([data-gridviz-hovered])").remove(),this.legend.node()._gridvizLegendCursor=null),this.geoCanvas.initCanvasTransform(),this.geoCanvas.clear(this.geoCanvas.backgroundColor);var t=this.geoCanvas.view.z;this.updateExtentGeo();var e,n=this.geoCanvas.offscreenCtx,r=hr(this.layers);try{for(r.s();!(e=r.n()).done;){var o=e.value;i(o,t)&&((o.alpha||o.blendOperation)&&(n.save(),o.alpha&&(n.globalAlpha=o.alpha(t)),o.blendOperation&&(n.globalCompositeOperation=o.blendOperation(t))),this.geoCanvas.setCanvasTransform(),o.draw(this.geoCanvas,this.legend),o.filterColor&&o.drawFilter(this.geoCanvas),(o.alpha||o.blendOperation)&&n.restore())}}catch(t){r.e(t)}finally{r.f()}if(this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),this.canvasSave=null,this._focusedCell=void 0,!this._refocusing&&!this.geoCanvas._isZooming){var a=this.pointerEvent()||(this._hovering?this._lastMouseEvent:null);if(a){this._refocusing=!0;try{this.refocusCell(a)}finally{this._refocusing=!1}}}return this.onLegendUpdate&&this.legend&&this.onLegendUpdate(this.legend.node()),this}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.geoCanvas.updateExtentGeo(t)}},{key:"mousePositionGeo",value:function(t){return{x:this.geoCanvas.pixToGeoX(t.offsetX+this.tooltip.xMouseOffset),y:this.geoCanvas.pixToGeoY(t.offsetY+this.tooltip.yMouseOffset)}}},{key:"pointerEvent",value:function(){var t=this._pointer;if(!t)return null;var e=this.geoCanvas.canvas,n=e.getBoundingClientRect();if(t.clientX<n.left||t.clientX>=n.right||t.clientY<n.top||t.clientY>=n.bottom)return null;var r=e.getRootNode?e.getRootNode():document;return(r.elementFromPoint?r:document).elementFromPoint(t.clientX,t.clientY)!==e?null:{offsetX:t.clientX-n.left,offsetY:t.clientY-n.top,clientX:t.clientX,clientY:t.clientY}}},{key:"refocusCell",value:function(t){if(!this.geoCanvas._isZooming){var e=this.getCellFocusInfo(this.mousePositionGeo(t),!1);if(!e)return this._triedKey=null,this._triedSource=null,void(this._hovering&&this.focusCell(t));var n=dr(e),r={layer:e.layer,dataset:e.dataset},o=function(t){return t&&t.layer===r.layer&&t.dataset===r.dataset};n===this._hoverKey&&o(this._hoverSource)?this.focusCell(t,e):n===this._triedKey&&o(this._triedSource)||(this.focusCell(t),this._triedKey=n,this._triedSource=r)}}},{key:"focusCell",value:function(t,e){if(!this.geoCanvas._isZooming){e||this._refocusing||(this._triedKey=null,this._triedSource=null);var n=e||this.getCellFocusInfo(this.mousePositionGeo(t)),r=n?n.cell:null;if(this._hovering=!!n,this._hoverKey=n?dr(n):null,this._hoverSource=n?{layer:n.layer,dataset:n.dataset}:null,r!==this._focusedCell)if(this._focusedCell=r,this.transparentBackground)if(this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.clearRect(0,0,this.w,this.h),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),n){void 0!==n.html&&this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show();var o=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4,i=this.geoCanvas.ctx;i.save(),i.strokeStyle=this.selectionRectangleColor,i.lineWidth=o,i.beginPath();var a=this.geoCanvas.geoToPixX(n.cell.x),u=this.geoCanvas.geoToPixY(n.cell.y),l=n.resolution/this.geoCanvas.view.z,c=-l;i.rect(a-o/2,u+o/2,l+o,c-o),i.stroke(),i.restore()}else this.tooltip.hide();else if(n){var s;this.geoCanvas.canvas.style.cursor="pointer",void 0!==n.html&&this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show(),this.canvasSave?this.geoCanvas.offscreenCtx.drawImage(this.canvasSave,0,0):(this.canvasSave=document.createElement("canvas"),this.canvasSave.setAttribute("width",""+this.w),this.canvasSave.setAttribute("height",""+this.h),null===(s=this.canvasSave.getContext("2d"))||void 0===s||s.drawImage(this.geoCanvas.offscreenCanvas,0,0));var f=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4;this.geoCanvas.initCanvasTransform();var h=this.geoCanvas.offscreenCtx;h.strokeStyle=this.selectionRectangleColor,h.lineWidth=f,h.beginPath(),h.rect(this.geoCanvas.geoToPixX(n.cell.x)-f/2,this.geoCanvas.geoToPixY(n.cell.y)+f/2,n.resolution/this.geoCanvas.view.z+f,-n.resolution/this.geoCanvas.view.z-f),h.stroke(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0)}else this.geoCanvas.canvas.style.cursor="default",this.tooltip.hide(),this.canvasSave&&this.geoCanvas.ctx.drawImage(this.canvasSave,0,0);else n?(this.tooltip.setPosition(t),this.tooltip.show()):this.tooltip.hide()}}},{key:"getCellFocusInfo",value:function(t){for(var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.geoCanvas.view.z,r=this.layers.length-1;r>=0;r--){var o=this.layers[r];if(i(o,n)&&"none"!==o.cellInfoHTML&&o.cellInfoHTML&&o.getDataset){var a=o.getDataset(n);if(a){var u=a.getCellFromPosition(t,a.getViewCache());if(!u){if(this.digForTooltip)continue;return}if(a.mixedResolution){var l=+a.mixedResolution(u),c=e?o.cellInfoHTML(u,l):void 0;if(e&&!c)return;return{cell:u,html:c,resolution:l,layer:o,dataset:a}}var s=e?o.cellInfoHTML(u,a.getResolution()):void 0;if(e&&!s)return;return{cell:u,html:s,resolution:a.getResolution(),layer:o,dataset:a}}}}}},{key:"setView",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.geoCanvas.view.x=t,this.geoCanvas.view.y=e,null!=n&&(this.geoCanvas.view.z=n),this}},{key:"getView",value:function(){return this.geoCanvas.view}},{key:"getZoom",value:function(){return this.geoCanvas.view.z}},{key:"setZoom",value:function(t){return this.geoCanvas.view.z=t,this}},{key:"getCenterExtent",value:function(){return this.geoCanvas.getCenterExtent()}},{key:"setCenterExtent",value:function(t){return this.geoCanvas.setCenterExtent(t),this}},{key:"getZoomExtent",value:function(){return this.geoCanvas.getZoomExtent()}},{key:"setZoomExtent",value:function(t){return this.geoCanvas.setZoomExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.geoCanvas.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.geoCanvas.backgroundColor=t,this}},{key:"addZoomButtons",value:function(t){return this.zoomButtons=new rr({map:this,id:(null==t?void 0:t.id)||"gridviz-zoom-buttons-"+this.container.id,class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y,onZoom:null==t?void 0:t.onZoom,delta:(null==t?void 0:t.delta)||.2}),this}},{key:"addFullscreenButton",value:function(t){return this.fullscreenButton=new sr({map:this,id:(null==t?void 0:t.id)||"gridviz-fullscreen-button",class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y}),this}},{key:"setViewFromURL",value:function(){return this.geoCanvas.setViewFromURL(),this}},{key:"defineResizeObserver",value:function(){var t=this,e=!1,n=new ResizeObserver(function(n){if(Array.isArray(n)&&n.length){var r=t.container;r.clientWidth>0&&r.clientHeight>0&&(e||(e=!0,window.requestAnimationFrame(function(){e=!1,t.h===r.clientHeight&&t.w===r.clientWidth||(t.h=r.clientHeight,t.w=r.clientWidth,t.geoCanvas.h=t.h,t.geoCanvas.w=t.w,t.geoCanvas.canvas.setAttribute("width",String(t.w)),t.geoCanvas.canvas.setAttribute("height",String(t.h)),t.geoCanvas.offscreenCanvas.setAttribute("width",String(t.w)),t.geoCanvas.offscreenCanvas.setAttribute("height",String(t.h)),t.redraw())})))}});n.observe(this.container),this._resizeObserver=n}},{key:"destroy",value:function(){var t,e;this._destroyed=!0,this.layers=[],this.bgLayers=[],this._redrawFrame&&cancelAnimationFrame(this._redrawFrame),this._redrawFrame=null,this._focusFrame&&cancelAnimationFrame(this._focusFrame),this._focusFrame=null,this._resizeObserver&&this._resizeObserver.disconnect(),this._resizeObserver=null;for(var n=0,r=["mousemove","mousedown","wheel"];n<r.length;n++){var o=r[n];window.removeEventListener(o,this._pointerHandler,{capture:!0})}window.removeEventListener("mouseout",this._pointerLeaveHandler,{capture:!0}),this.geoCanvas.canvas.removeEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.removeEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.removeEventListener("mouseout",this.mouseOutHandler),this.geoCanvas.canvas.remove(),this._legendProvidedByUser||null===(e=this.legend)||void 0===e||e.remove(),null===(t=this.tooltip.tooltip)||void 0===t||t.remove()}}],e&&vr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function mr(t){return mr="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},mr(t)}function gr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wr(t,e);var n={}.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)?wr(t,e):void 0}}(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 wr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Sr(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,xr(r.key),r)}}function xr(t){var e=function(t){if("object"!=mr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mr(e)?e:e+""}function _r(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_r=function(){return!!t})()}function Or(t){return Or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Or(t)}function jr(t,e){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jr(t,e)}var Pr=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Or(e),function(t,e){if(e&&("object"==mr(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)}(t,_r()?Reflect.construct(e,n||[],Or(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.viewScale=t.viewScale,n.filter=t.filter||void 0,n.offset=t.offset||function(t,e,n){return{dx:0,dy:0}},n.drawFun=t.drawFun,n.legends=[],n.highlightColors=null,n}return 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&&jr(t,e)}(e,t),n=e,o=[{key:"normalizeColor",value:function(t){var n=e._normalizedColors.get(t);if(void 0===n){var r=Ee(t);n=r?r.formatRgb():String(t),e._normalizedColors.size>1e4&&e._normalizedColors.clear(),e._normalizedColors.set(t,n)}return n}},{key:"updateLegendsRecursive",value:function(t,e){if(Array.isArray(t)){var n,r=gr(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;this.updateLegendsRecursive(o,e)}}catch(t){r.e(t)}finally{r.f()}}else t.update(e)}}],(r=[{key:"setHighlight",value:function(t){return this.highlightColors=t&&t.length?t.map(e.normalizeColor):null,this}},{key:"isHighlighted",value:function(t){return!this.highlightColors||this.highlightColors.includes(e.normalizeColor(t))}},{key:"draw",value:function(t,e,n){if(!this.drawFun)throw new Error("Method draw not implemented.");this.drawFun(t,e,n)}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){return this.highlightColors||e.updateLegendsRecursive(this.legends,t),this}},{key:"addLegends",value:function(t){var e,n=gr(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.legends.push(r)}}catch(t){n.e(t)}finally{n.f()}return this}}])&&Sr(n.prototype,r),o&&Sr(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(a);function Cr(t){return Cr="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},Cr(t)}function kr(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,Tr(r.key),r)}}function Tr(t){var e=function(t){if("object"!=Cr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Cr(e)?e:e+""}function Ar(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ar=function(){return!!t})()}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}function Mr(t,e){return Mr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mr(t,e)}Pr._normalizedColors=new Map;var zr=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Er(e),function(t,e){if(e&&("object"==Cr(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)}(t,Ar()?Reflect.construct(e,n||[],Er(t).constructor):e.apply(t,n))}(this,e,arguments)}return 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&&Mr(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){throw new Error("Method draw not implemented.")}}])&&kr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(a);function Rr(t){return Rr="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},Rr(t)}function Fr(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Br(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 Ir(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Br(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 Br(t,e){if(t){if("string"==typeof t)return Lr(t,e);var n={}.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)?Lr(t,e):void 0}}function Lr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Nr(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,Dr(r.key),r)}}function Dr(t){var e=function(t){if("object"!=Rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rr(e)?e:e+""}var Gr=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e,this.url=n,this.resolution=r,this.mixedResolution=o.mixedResolution,this.preprocess=o.preprocess||void 0,this.cellsViewCache=[]},e=[{key:"getData",value:function(){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){if(this.mixedResolution){var n,r=Ir(e);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=+this.mixedResolution(o);if(!(t.x<o.x||o.x+i<t.x||t.y<o.y||o.y+i<t.y))return o}}catch(t){r.e(t)}finally{r.f()}}else{var a=this.getResolution(),u=this.cellIndex(e,a);if(u)for(var l=(t.x-u.ox)/a,c=(t.y-u.oy)/a,s=Math.floor(l),f=Math.floor(c),h=0,y=[[0,0],[-1,0],[0,-1],[-1,-1]];h<y.length;h++){var v=Fr(y[h],2),p=v[0],d=v[1];if(!(p&&l!==s||d&&c!==f)){var b=u.cells.get(Ur(s+p,f+d));if(b)return b}}else{var m,g=Ir(e);try{for(g.s();!(m=g.n()).done;){var w=m.value;if(!(t.x<w.x||w.x+a<t.x||t.y<w.y||w.y+a<t.y))return w}}catch(t){g.e(t)}finally{g.f()}}}}},{key:"cellIndex",value:function(t,e){if(this._index&&this._indexCells===t&&this._indexLength===t.length&&this._indexR===e)return this._index;var n=null;if(t.length&&e>0){var r=+t[0].x,o=+t[0].y,i=new Map;n={cells:i,ox:r,oy:o};var a,u=Ir(t);try{for(u.s();!(a=u.n()).done;){var l=a.value,c=(+l.x-r)/e,s=(+l.y-o)/e,f=Math.round(c),h=Math.round(s);if(Math.abs(c-f)>1e-6||Math.abs(s-h)>1e-6){n=null;break}var y=Ur(f,h);i.has(y)||i.set(y,l)}}catch(t){u.e(t)}finally{u.f()}}return this._index=n,this._indexCells=t,this._indexLength=t.length,this._indexR=e,n}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}},{key:"getDataset",value:function(t,e){return this}}],e&&Nr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Ur(t,e){return 4194304*t+e}function Wr(t){return Wr="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},Wr(t)}function Hr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yr(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(r.key),r)}}function $r(t){var e=function(t){if("object"!=Wr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Wr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wr(e)?e:e+""}var Vr=function(){return t=function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.resolutions=e,this.datasets="function"==typeof n?this.resolutions.map(n):n,this.datasets.length>1&&this.datasets.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasets.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)},(e=[{key:"getDataset",value:function(t,e){if(1==this.datasets.length)return this.datasets[0];for(var n=this.resolutions,r=0,o=n[r]/e;o<t&&r<n.length;)o=n[++r]/e;return r==n.length?this.datasets[n.length-1]:this.datasets[r]}},{key:"setPrepocesses",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Hr(t,e);var n={}.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)?Hr(t,e):void 0}}(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}}}}(this.datasets);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&Yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function qr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function Xr(t,e){return fetch(t,e).then(qr)}var Zr={},Kr={};function Jr(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Qr(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 to(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function eo(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 s(){if(l)return Kr;if(c)return c=!1,Zr;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=s())!==Kr;){for(var f=[];r!==Zr&&r!==Kr;)f.push(r),r=s();e&&null==(f=e(f,u++))||o.push(f)}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?(o=(n=t).getUTCHours(),i=n.getUTCMinutes(),a=n.getUTCSeconds(),u=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((r=n.getUTCFullYear())<0?"-"+to(-r,6):r>9999?"+"+to(r,6):to(r,4))+"-"+to(n.getUTCMonth()+1,2)+"-"+to(n.getUTCDate(),2)+(u?"T"+to(o,2)+":"+to(i,2)+":"+to(a,2)+"."+to(u,3)+"Z":a?"T"+to(o,2)+":"+to(i,2)+":"+to(a,2)+"Z":i||o?"T"+to(o,2)+":"+to(i,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,r,o,i,a,u}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=Jr(t);return function(r,o){return e(n(r),o,t)}}(t,e):Jr(t)});return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=Qr(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Qr(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var no=eo(","),ro=no.parse,oo=(no.parseRows,no.format,no.formatBody,no.formatRows,no.formatRow,no.formatValue,eo("\t")),io=oo.parse;function ao(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function uo(t,e){return fetch(t,e).then(ao)}function lo(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),uo(e,n).then(function(e){return t(e,r)})}}function co(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var o=eo(t);return uo(e,n).then(function(t){return o.parse(t,r)})}oo.parseRows,oo.format,oo.formatBody,oo.formatRows,oo.formatRow,oo.formatValue;var so=lo(ro);function fo(t){return fo="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},fo(t)}function ho(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(fo(t)+" is not iterable")}function yo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=vo(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){if(t){if("string"==typeof t)return po(t,e);var n={}.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)?po(t,e):void 0}}function po(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return mo(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(mo(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,mo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,mo(f,"constructor",c),mo(c,"constructor",l),l.displayName="GeneratorFunction",mo(c,o,"GeneratorFunction"),mo(f),mo(f,o,"Generator"),mo(f,r,function(){return this}),mo(f,"toString",function(){return"[object Generator]"}),(bo=function(){return{w:i,m:h}})()}function mo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}mo=function(t,e,n,r){function i(e,n){mo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},mo(t,e,n,r)}function go(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function wo(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){go(i,r,o,a,u,"next",t)}function u(t){go(i,r,o,a,u,"throw",t)}a(void 0)})}}function So(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,xo(r.key),r)}}function xo(t){var e=function(t){if("object"!=fo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fo(e)?e:e+""}function _o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_o=function(){return!!t})()}function Oo(t){return Oo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oo(t)}function jo(t,e){return jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jo(t,e)}lo(io);var Po=new Set,Co=0,ko=function(){return"undefined"!=typeof performance?performance.now():Date.now()},To=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=function(t,e,n){return e=Oo(e),function(t,e){if(e&&("object"==fo(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)}(t,_o()?Reflect.construct(e,n||[],Oo(t).constructor):e.apply(t,n))}(this,e,[t,n,0,o])).onlyDrawWhenAllTilesReady=o.onlyDrawWhenAllTilesReady||!1,r.info=void 0,r.infoLoadingStatus="notLoaded",r.cache={},r.loadInfo(),r}return 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&&jo(t,e)}(e,t),n=e,r=[{key:"loadInfo",value:function(){var t=this;return this.info||"notLoaded"!==this.infoLoadingStatus||(this.infoLoadingStatus="loading",wo(bo().m(function e(){var n;return bo().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Xr(t.url+"info.json");case 1:n=e.v,t.info=n,t.resolution=n.resolutionGeo,t.infoLoadingStatus="loaded",t.isShown()&&t.map.redraw(),e.n=3;break;case 2:e.p=2,e.v,t.infoLoadingStatus="failed";case 3:return e.a(2)}},e,null,[[0,2]])}))()),this}},{key:"isShown",value:function(){if(!this.map||!this.map.layers)return!1;var t,e=this.map.getZoom(),n=yo(this.map.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(i(r,e)&&r.getDataset&&r.getDataset(e)==this)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{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()}},{key:"getData",value:(a=wo(bo().m(function t(n){var r,o,i,a,u,l,c,s,f,h,y,v,p,d,b=this;return bo().w(function(t){for(;;)switch(t.n){case 0:if(this.info){t.n=1;break}return t.a(2,this);case 1:if(this.abortController=new AbortController,r=this.abortController.signal,o=this.getTilingEnvelope(n)){t.n=2;break}return t.a(2,this);case 2:i=this.info.tilingBounds,a=i.xMin,u=i.xMax,l=i.yMin,c=i.yMax,s=Math.max(o.xMin,a),f=Math.min(o.xMax,u),h=Math.max(o.yMin,l),y=Math.min(o.yMax,c),v=[],p=bo().m(function t(n){var o,i;return bo().w(function(t){for(;;)switch(t.n){case 0:o=bo().m(function t(o){var i,a;return bo().w(function(t){for(;;)switch(t.n){case 0:if(b.cache[n]||(b.cache[n]={}),i=b.cache[n][o],a=i&&i.failed&&!i.missing&&ko()-i.failed>=e.retryFailedAfterMs,!i||a){t.n=1;break}return i.cells&&(i.lastUsed=ko()),t.a(2,1);case 1:b.cache[n][o]="loading",v.push(b.loadTile(n,o,r).then(function(t){b.cache[n][o]=t,b._keep(t);var e=!b._anyLoading(s,f,h,y);b.checkAndRedraw(t,e)},function(t){t&&"AbortError"===t.name?delete b.cache[n][o]:(b.cache[n][o]={failed:ko(),missing:/^(404|410)\b/.test(t&&t.message)},b.onlyDrawWhenAllTilesReady&&!b._anyLoading(s,f,h,y)&&b.isShown()&&b.map.redraw())}));case 2:return t.a(2)}},t)}),i=h;case 1:if(!(i<=y)){t.n=4;break}return t.d(ho(o(i)),2);case 2:if(!t.v){t.n=3;break}return t.a(3,3);case 3:i++,t.n=1;break;case 4:return t.a(2)}},t)}),d=s;case 3:if(!(d<=f)){t.n=5;break}return t.d(ho(p(d)),4);case 4:d++,t.n=3;break;case 5:return t.n=6,Promise.allSettled(v);case 6:return t.a(2,this)}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"_anyLoading",value:function(t,e,n,r){for(var o=t;o<=e;o++){var i=this.cache[o];if(i)for(var a=n;a<=r;a++)if("loading"===i[a])return!0}return!1}},{key:"loadTile",value:(o=wo(bo().m(function t(e,n,r){var o,i,a,u=this;return bo().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,so("".concat(this.url).concat(e,"/").concat(n,".csv"),{signal:r});case 1:if(o=t.v,i=this.preprocess?o.filter(function(t){return!1!==u.preprocess(t)}):o,this.info){t.n=2;break}throw new Error("Tile info unknown");case 2:return t.a(2,Ao(i,e,n,this.info));case 3:throw t.p=3,"AbortError"===(a=t.v).name&&console.warn("Tile request for ".concat(e,", ").concat(n," was aborted.")),a;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e,n){return o.apply(this,arguments)})},{key:"cancelCurrentRequests",value:function(){this.abortController&&this.abortController.abort()}},{key:"checkAndRedraw",value:function(t,e){if(this.isShown())if(this.onlyDrawWhenAllTilesReady)e&&this.map.redraw();else{var n=this.map.updateExtentGeo(),r=t.extGeo,o=r.xMin,i=r.xMax,a=r.yMin,u=r.yMax;n.xMax<=o||n.xMin>=i||n.yMax<=a||n.yMin>=u||this.map.redraw()}}},{key:"_keep",value:function(t){if(t&&"object"===fo(t)&&t.cells&&(t.lastUsed=ko(),t.owner=this,Po.add(t),!((Co+=t.cells.length)<=e.maxCachedCells))){var n,r=ko()-3e3,o=function(t){return function(t){if(Array.isArray(t))return po(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||vo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Po).filter(function(t){return t.lastUsed<r}).sort(function(t,e){return t.lastUsed-e.lastUsed}),i=yo(o);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(Co<=e.maxCachedCells)break;a.owner._drop(a)}}catch(t){i.e(t)}finally{i.f()}}}},{key:"_drop",value:function(t){var e=this.cache[t.x];e&&e[t.y]===t&&(delete e[t.y],Object.keys(e).length||delete this.cache[t.x]),Po.delete(t)&&(Co-=t.cells.length),t.owner=void 0,t.cells=[]}},{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&&i.cells){i.lastUsed=ko();var a,u=yo(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()}}}}}}],r&&So(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,a}(Gr);function Ao(t,e,n,r){var o={};o.cells=t,o.x=e,o.y=n;var i=r.resolutionGeo,a=r.tileSizeCell;o.extGeo={xMin:r.originPoint.x+i*a*o.x,xMax:r.originPoint.x+i*a*(o.x+1),yMin:r.originPoint.y+i*a*o.y,yMax:r.originPoint.y+i*a*(o.y+1)};var u,l=yo(o.cells);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.x=o.extGeo.xMin+c.x*i,c.y=o.extGeo.yMin+c.y*i}}catch(t){l.e(t)}finally{l.f()}return o}function Eo(t){return Eo="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},Eo(t)}function Mo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return zo(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(zo(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,zo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,zo(f,"constructor",c),zo(c,"constructor",l),l.displayName="GeneratorFunction",zo(c,o,"GeneratorFunction"),zo(f),zo(f,o,"Generator"),zo(f,r,function(){return this}),zo(f,"toString",function(){return"[object Generator]"}),(Mo=function(){return{w:i,m:h}})()}function zo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}zo=function(t,e,n,r){function i(e,n){zo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},zo(t,e,n,r)}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){if("string"==typeof t)return Fo(t,e);var n={}.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)?Fo(t,e):void 0}}(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 Fo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Io(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Bo(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,Lo(r.key),r)}}function Lo(t){var e=function(t){if("object"!=Eo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Eo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Eo(e)?e:e+""}function No(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(No=function(){return!!t})()}function Do(t){return Do=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Do(t)}function Go(t,e){return Go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Go(t,e)}To.maxCachedCells=15e5,To.retryFailedAfterMs=3e4;var Uo=function(t){function e(t,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,n){return e=Do(e),function(t,e){if(e&&("object"==Eo(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)}(t,No()?Reflect.construct(e,n||[],Do(t).constructor):e.apply(t,n))}(this,e,[t,n,r,i])).cells=[],o.delimiter=i.delimiter||",",o.infoLoadingStatus="notLoaded",o.getData(void 0),o}return 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&&Go(t,e)}(e,t),n=e,r=[{key:"getData",value:function(t){var e,n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(e=Mo().m(function t(){var e,r,o,i,a,u,l,c;return Mo().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,co(n.delimiter,n.url);case 1:e=t.v,r=Ro(e);try{for(r.s();!(o=r.n()).done;)(i=o.value).x=+i.x,i.y=+i.y}catch(t){r.e(t)}finally{r.f()}if(!n.preprocess){t.n=10;break}n.cells=[],a=Ro(e),t.p=2,a.s();case 3:if((u=a.n()).done){t.n=6;break}if(l=u.value,0!=n.preprocess(l)){t.n=4;break}return t.a(3,5);case 4:n.cells.push(l);case 5:t.n=3;break;case 6:t.n=8;break;case 7:t.p=7,c=t.v,a.e(c);case 8:return t.p=8,a.f(),t.f(8);case 9:t.n=11;break;case 10:n.cells=e;case 11:n.map&&n.map.redraw(),n.infoLoadingStatus="loaded",t.n=13;break;case 12:t.p=12,t.v,n.infoLoadingStatus="failed",n.cells=[];case 13:return t.a(2)}},t,null,[[2,7,8,9],[0,12]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Io(i,r,o,a,u,"next",t)}function u(t){Io(i,r,o,a,u,"throw",t)}a(void 0)})})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Ro(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()}}}}],r&&Bo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Gr);function Wo(t){return Wo="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},Wo(t)}function Ho(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yo(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,$o(r.key),r)}}function $o(t){var e=function(t){if("object"!=Wo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Wo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wo(e)?e:e+""}function Vo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vo=function(){return!!t})()}function qo(t){return qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qo(t)}function Xo(t,e){return Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xo(t,e)}var Zo=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=function(t,e,n){return e=qo(e),function(t,e){if(e&&("object"==Wo(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)}(t,Vo()?Reflect.construct(e,n||[],qo(t).constructor):e.apply(t,n))}(this,e,[void 0,"",t,o])).cells=n||[],r}return 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&&Xo(t,e)}(e,t),n=e,(r=[{key:"getData",value:function(t){return this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ho(t,e);var n={}.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)?Ho(t,e):void 0}}(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}}}}(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()}}}}])&&Yo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Gr);function Ko(t){return Ko="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},Ko(t)}function Jo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Qo(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,ti(r.key),r)}}function ti(t){var e=function(t){if("object"!=Ko(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ko(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ko(e)?e:e+""}function ei(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ei=function(){return!!t})()}function ni(t){return ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ni(t)}function ri(t,e){return ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ri(t,e)}var oi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ni(e),function(t,e){if(e&&("object"==Ko(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)}(t,ei()?Reflect.construct(e,n||[],ni(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||"#EA6BAC",n.size=t.size||function(t,e){return e},n.shape=t.shape||"square",n.donutOuterSize=t.donutOuterSize,n}return 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&&ri(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=.5*n,u=this.highlightColors,l="function"==typeof this.color,c="function"==typeof this.size,s="function"==typeof this.shape,f=this.color||"black",h=this.size||n,y=this.shape||"square",v=l?this.color:null,p=c?this.size:null,d=s?this.shape:null,b=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Jo(t,e);var n={}.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)?Jo(t,e):void 0}}(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(b.s();!(r=b.n()).done;){var m=r.value,g=v?v(m,n,o,i):f;if(g&&"none"!==g&&(!u||this.isHighlighted(g))){var w=p?p(m,n,o,i):h;if(w){var S=d?d(m,n,o,i):y;if("none"!==S){var x=this.offset(m,n,o),_=e.offscreenCtx;if(_.fillStyle=g,"square"===S){var O=n*(1-w/n)*.5;_.fillRect(m.x+O+x.dx,m.y+O+x.dy,w,w)}else if("circle"===S)_.beginPath(),_.arc(m.x+a+x.dx,m.y+a+x.dy,.5*w,0,2*Math.PI,!1),_.fill();else if("donut"===S){var j=m.x+a+x.dx,P=m.y+a+x.dy,C=void 0===this.donutOuterSize?n:"function"==typeof this.donutOuterSize?this.donutOuterSize(m,n,o,i):this.donutOuterSize;if(!C)continue;var k=.5*C;_.beginPath(),_.moveTo(j,P),_.arc(j,P,k,0,2*Math.PI),_.arc(j,P,Math.max(0,1-w/C)*k,0,2*Math.PI,!0),_.closePath(),_.fill()}else if("diamond"===S){var T=.5*w;_.beginPath(),_.moveTo(m.x+a-T,m.y+a),_.lineTo(m.x+a,m.y+a+T),_.lineTo(m.x+a+T,m.y+a),_.lineTo(m.x+a,m.y+a-T),_.fill()}else if("triangle_up"===S){var A=(w-n)/2;_.beginPath(),_.moveTo(m.x-A,m.y-A),_.lineTo(m.x+a,m.y+n+A),_.lineTo(m.x+n+A,m.y-A),_.fill()}else if("triangle_down"===S){var E=(w-n)/2;_.beginPath(),_.moveTo(m.x-E,m.y+n+E),_.lineTo(m.x+a,m.y-E),_.lineTo(m.x+n+E,m.y+n+E),_.fill()}else if("triangle_left"===S){var M=(w-n)/2;_.beginPath(),_.moveTo(m.x+n+M,m.y+n+M),_.lineTo(m.x-M,m.y+a),_.lineTo(m.x+n+M,m.y-M),_.fill()}else{if("triangle_right"!==S)throw new Error("Unexpected shape:"+S);var z=(w-n)/2;_.beginPath(),_.moveTo(m.x-z,m.y-z),_.lineTo(m.x+n+z,m.y+a),_.lineTo(m.x-z,m.y+n+z),_.fill()}}}}}}catch(t){b.e(t)}finally{b.f()}this.updateLegends({viewScale:i,resolution:n,z:o,cells:t})}}],r&&Qo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function ii(t){return ii="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},ii(t)}function ai(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ui(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,li(r.key),r)}}function li(t){var e=function(t){if("object"!=ii(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ii(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ii(e)?e:e+""}function ci(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ci=function(){return!!t})()}function si(t){return si=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},si(t)}function fi(t,e){return fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fi(t,e)}var hi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=si(e),function(t,e){if(e&&("object"==ii(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)}(t,ci()?Reflect.construct(e,n||[],si(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.strokeColor=t.strokeColor||function(){return"#666"},n.size=t.size||function(t,e){return e},n.strokeWidth=t.strokeWidth||function(t,e,n){return 1.5*n},n.shape=t.shape||function(){return"square"},n}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ai(t,e);var n={}.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)?ai(t,e):void 0}}(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();!(r=l.n()).done;){var c=r.value,s=this.strokeColor?this.strokeColor(c,n,o,a):void 0;if(s&&"none"!==s){i.strokeStyle=s;var f=this.size?this.size(c,n,o,a):n,h=this.strokeWidth?this.strokeWidth(c,n,o,a):1*o;if(h&&!(h<=0)){i.lineWidth=h;var y=this.shape?this.shape(c,n,o,a):"square";if("none"!==y){var v=this.offset(c,n,o);if("square"===y){var p=n*(1-f/n)*.5;i.beginPath(),i.rect(c.x+p+v.dx,c.y+p+v.dy,f,f),i.stroke()}else if("circle"===y)i.beginPath(),i.arc(c.x+u+v.dx,c.y+u+v.dy,.5*f,0,2*Math.PI,!1),i.stroke();else if("diamond"===y){var d=.5*f;i.beginPath(),i.moveTo(c.x+u-d,c.y+u),i.lineTo(c.x+u,c.y+u+d),i.lineTo(c.x+u+d,c.y+u),i.lineTo(c.x+u,c.y+u-d),i.lineTo(c.x+u-d,c.y+u),i.stroke()}else if("donut"===y)console.error("Not implemented");else if("triangle_up"===y){var b=(f-n)/2;i.beginPath(),i.moveTo(c.x-b,c.y-b),i.lineTo(c.x+u,c.y+n+b),i.lineTo(c.x+n+b,c.y-b),i.closePath(),i.stroke()}else if("triangle_down"===y){var m=(f-n)/2;i.beginPath(),i.moveTo(c.x-m,c.y+n+m),i.lineTo(c.x+u,c.y-m),i.lineTo(c.x+n+m,c.y+n+m),i.closePath(),i.stroke()}else if("triangle_left"===y){var g=(f-n)/2;i.beginPath(),i.moveTo(c.x+n+g,c.y+n+g),i.lineTo(c.x-g,c.y+u),i.lineTo(c.x+n+g,c.y-g),i.closePath(),i.stroke()}else{if("triangle_right"!==y)throw new Error("Unexpected shape:"+y);var w=(f-n)/2;i.beginPath(),i.moveTo(c.x-w,c.y-w),i.lineTo(c.x+n+w,c.y+u),i.lineTo(c.x-w,c.y+n+w),i.closePath(),i.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}],r&&ui(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function yi(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let o=-1;for(let i of t)null!=(i=e(i,++o,t))&&(void 0===n?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}function vi(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||di(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 pi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=di(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 di(t,e){if(t){if("string"==typeof t)return bi(t,e);var n={}.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)?bi(t,e):void 0}}function bi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mi(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[8,6,5,4,2.5,2],r=Math.pow(10,Math.floor(Math.log10(t))),o=pi(n);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(r*i<=t)return r*i}}catch(t){o.e(t)}finally{o.f()}return r}function gi(t,e,n){var r=yi(t,function(t){return t.x}),o=vi(r,2),i=o[0],a=o[1],u=yi(t,function(t){return t.y}),l=vi(u,2),c=l[0],s=l[1],f=Math.ceil((s-c)/e)+1,h=Math.ceil((a-i)/e)+1,y=Array.from({length:f},function(){return new Array(h).fill(void 0)});y.x0=i,y.y0=s,y.resolution=e;var v,p=pi(t);try{for(p.s();!(v=p.n()).done;){var d=v.value,b=Math.floor((s-d.y)/e),m=Math.floor((d.x-i)/e),g=n?n(d):d;y[b][m]=g}}catch(t){p.e(t)}finally{p.f()}return y}function wi(t){return wi="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},wi(t)}function Si(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,xi(r.key),r)}}function xi(t){var e=function(t){if("object"!=wi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=wi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wi(e)?e:e+""}function _i(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_i=function(){return!!t})()}function Oi(t){return Oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oi(t)}function ji(t,e){return ji=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ji(t,e)}var Pi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Oi(e),function(t,e){if(e&&("object"==wi(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)}(t,_i()?Reflect.construct(e,n||[],Oi(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height||function(t,e){return e*Math.random()},n.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},n.lineWidth=t.lineWidth||function(t,e,n,r){return r},n.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},n}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=function(t,e){var n,r={},o=pi(t);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=r[i.y];a||(a={},r[i.y]=a),a[i.x]=e?e(i):i}}catch(t){o.e(t)}finally{o.f()}return r}(t,function(t){return r.height(t,n,o,a)}),l=e.extGeo;if(l){var c=Math.floor(l.xMin/n)*n,s=Math.floor(l.xMax/n)*n,f=Math.floor(l.yMin/n)*n,h=Math.floor(l.yMax/n)*n,y={min:f,max:h};i.lineJoin="round";for(var v=h;v>=f;v-=n){var p=u[v];if(p){i.beginPath(),i.moveTo(c-n/2,v);for(var d=void 0,b=c;b<=s;b+=n){var m=p[b];m||(m=0),m||d?i.lineTo(b+n/2,v+m):i.moveTo(b+n/2,v),d=m}d&&i.lineTo(s+n/2,v);var g=this.fillColor(v,y,n,o);g&&"none"!=g&&(i.fillStyle=g,i.fill());var w=this.lineColor(v,y,n,o),S=this.lineWidth(v,y,n,o);w&&"none"!=w&&S>0&&(i.strokeStyle=w,i.lineWidth=S,i.stroke())}}}}}],r&&Si(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Ci(t){return Ci="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},Ci(t)}function ki(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Ti(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 Ti(t,e){if(t){if("string"==typeof t)return Ai(t,e);var n={}.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)?Ai(t,e):void 0}}function Ai(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ei(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,Mi(r.key),r)}}function Mi(t){var e=function(t){if("object"!=Ci(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ci(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ci(e)?e:e+""}function zi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zi=function(){return!!t})()}function Ri(t){return Ri=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ri(t)}function Fi(t,e){return Fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fi(t,e)}var Ii=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ri(e),function(t,e){if(e&&("object"==Ci(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)}(t,zi()?Reflect.construct(e,n||[],Ri(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.type=t.type||function(){return"flag"},n.size=t.size||function(t,e){return e},n.stripesOrientation=t.stripesOrientation||function(){return 0},n.offsetAngle=t.offsetAngle||function(){return 0},n.agePyramidHeight=t.agePyramidHeight||function(t,e){return e},n.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,n}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.entries(this.color).length,l=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Ti(t))){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,s=this.size?this.size(c,n,o,a):n;if(s){var f=this.offset(c,n,o),h=this.type?this.type(c,n,o,a):"flag",y=c.x+f.dx+("agepyramid"===h?0:.5*n),v=c.y+f.dy+("agepyramid"===h?0:.5*n),p=this.offsetAngle?this.offsetAngle(c,n,o,a)*Math.PI/180:0;if("agepyramid"===h||"radar"===h||"halftone"===h){for(var d=-1/0,b=0,m=Object.keys(this.color);b<m.length;b++){var g=+c[m[b]];g>d&&(d=g)}var w=0;"agepyramid"===h&&this.agePyramidHeight&&(w=(n-this.agePyramidHeight(c,n,o,a))/2),"radar"!==h&&"halftone"!==h||(w=Math.PI/2+p);var S="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,n,o,a):n)/u:"radar"===h||"halftone"===h?2*Math.PI/u:void 0;if(void 0===S)throw new Error("Unexpected symbol type:"+h);for(var x=0,_=Object.entries(this.color);x<_.length;x++){var O=ki(_[x],2),j=O[0],P=O[1];if("agepyramid"===h){i.fillStyle=P;var C=s*c[j]/d;i.fillRect(y+(n-C)/2,v+w,C,S),w+=S}else if("radar"===h){i.fillStyle=P;var k=c[j],T=s/2*Math.sqrt(k/d);i.beginPath(),i.moveTo(y,v),i.arc(y,v,T,w-S,w),i.lineTo(y,v),i.fill(),w+=S}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);i.fillStyle=P;var A=c[j],E=.333*s*Math.sqrt(A/d);i.beginPath(),i.arc(y+.25*n*Math.cos(w),v+.25*n*Math.sin(w),E,0,2*Math.PI),i.fill(),w+=S}}}else{for(var M=0,z=0,R=Object.keys(this.color);z<R.length;z++){var F=+c[R[z]];F&&(M+=F)}if(!M||isNaN(M))continue;for(var I=0,B=n*(1-s/n)*.5,L=this.stripesOrientation(c,n,o,a),N=0,D=Object.entries(this.color);N<D.length;N++){var G=ki(D[N],2),U=G[0],W=G[1],H=c[U]/M;if(H&&!isNaN(H)){if(i.fillStyle=W,"flag"===h)0==L?i.fillRect(c.x+B+f.dx,c.y+B+I*s+f.dy,s,H*s):i.fillRect(c.x+B+I*s+f.dx,c.y+B+f.dy,H*s,s);else if("piechart"===h){var Y=2*I*Math.PI,$=2*(I+H)*Math.PI;i.beginPath(),i.moveTo(y,v),i.arc(y,v,.5*s,Y+p,$+p),this.pieChartInternalRadiusFactor&&i.arc(y,v,.5*s*this.pieChartInternalRadiusFactor,Y+p,$+p,!0),i.closePath(),i.fill()}else if("ring"===h)i.beginPath(),i.arc(y,v,Math.sqrt(1-I)*s*.5,0,2*Math.PI),i.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var V=s*s/n;0==L?i.fillRect(c.x+f.dx,c.y+(n-V)/2+I*V+f.dy,n,H*V):i.fillRect(c.x+I*n+f.dx,c.y+(n-V)/2+f.dy,H*n,V)}I+=H}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}],r&&Ei(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Bi(t){return Bi="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},Bi(t)}function Li(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ni(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,Di(r.key),r)}}function Di(t){var e=function(t){if("object"!=Bi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bi(e)?e:e+""}function Gi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gi=function(){return!!t})()}function Ui(t){return Ui=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ui(t)}function Wi(t,e){return Wi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wi(t,e)}var Hi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ui(e),function(t,e){if(e&&("object"==Bi(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)}(t,Gi()?Reflect.construct(e,n||[],Ui(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.width=t.width||function(t,e){return.1*e},n.length=t.length||function(t,e){return.9*e},n.orientation=t.orientation||function(){return 180*Math.random()},n}return 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&&Wi(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.lineCap="butt";var a,u=Math.PI/180,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Li(t,e);var n={}.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)?Li(t,e):void 0}}(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();!(a=l.n()).done;){var c=a.value,s=this.color?this.color(c,n,r,i):void 0;if(s){var f=this.width?this.width(c,n,r,i):void 0;if(f&&!(f<0)){var h=this.length?this.length(c,n,r,i):void 0;if(h&&!(h<0)){var y=this.orientation(c,n,r,i)*u;if(void 0!==y&&!isNaN(y)){var v=this.offset(c,n,r);o.strokeStyle=s,o.lineWidth=f;var p=c.x+n/2+v.dx,d=c.y+n/2+v.dy,b=.5*Math.cos(y)*h,m=.5*Math.sin(y)*h;o.beginPath(),o.moveTo(p-b,d-m),o.lineTo(p+b,d+m),o.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({viewScale:i,resolution:n,z:r,cells:t})}}],r&&Ni(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Yi(t){return Yi="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},Yi(t)}function $i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Vi(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,qi(r.key),r)}}function qi(t){var e=function(t){if("object"!=Yi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yi(e)?e:e+""}function Xi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xi=function(){return!!t})()}function Zi(t){return Zi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zi(t)}function Ki(t,e){return Ki=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ki(t,e)}var Ji=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Zi(e),function(t,e){if(e&&("object"==Yi(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)}(t,Xi()?Reflect.construct(e,n||[],Zi(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.text=t.text||function(){return"X"},n.color=t.color||function(){return"black"},n.fontSize=t.fontSize||function(t,e){return e},n.fontFamily=t.fontFamily||function(){return"Arial"},n.fontWeight=t.fontWeight||function(){return"bold"},n}return 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&&Ki(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;e.initCanvasTransform();var a,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return $i(t,e);var n={}.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)?$i(t,e):void 0}}(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(u.s();!(a=u.n()).done;){var l=a.value,c=this.text?this.text(l,n,r,i):void 0;if(null!=c&&null!=c&&c+""!=""){var s=this.color?this.color(l,n,r,i):void 0;if(s){o.fillStyle=s;var f=this.fontSize(l,n,r,i)/r;if(f){var h=this.fontFamily?this.fontFamily(l,n,r,i):"Arial",y=this.fontWeight?this.fontWeight(l,n,r,i):"bold";o.font=y+" "+f+"px "+h;var v=this.offset(l,n,r);o.textAlign="center";var p=e.geoToPixX(l.x+.5*n+v.dx),d=e.geoToPixY(l.y+.5*n+v.dy)+.3*f;o.fillText(c,p,d)}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i,cells:t})}}],o=[{key:"textScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=t.length;return function(r){return e&&(r=e(r)),0==r?"":r>=1?t[n-1]:t[Math.floor(r*n)]}}}],r&&Vi(n.prototype,r),o&&Vi(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Pr);function Qi(t){return Qi="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},Qi(t)}function ta(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ea(t,e);var n={}.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)?ea(t,e):void 0}}(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 ea(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,ra(r.key),r)}}function ra(t){var e=function(t){if("object"!=Qi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qi(e)?e:e+""}function oa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oa=function(){return!!t})()}function ia(t){return ia=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ia(t)}function aa(t,e){return aa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},aa(t,e)}var ua=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ia(e),function(t,e){if(e&&("object"==Qi(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)}(t,oa()?Reflect.construct(e,n||[],ia(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height,n.color=t.color||function(){return"#c08c59"},n.width=t.width||function(t,e){return.5*e},n.simple=t.simple||function(){return!1},n.viewHeightFactor=t.viewHeightFactor||1.5,n.viewSX=null==t.viewSX?0:t.viewSX,n.viewSY=null==t.viewSY?-.5:t.viewSY,n.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,n.shadowFactor=t.shadowFactor||.3,n.shadowColor=t.shadowColor||"#00000033",n.outlineCol=t.outlineCol||"#FFFFFF",n.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix,n}return 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&&aa(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0,a=e.view.x+this.viewSX*e.w*r,u=e.view.y+this.viewSY*e.h*r,l=this.viewHeightFactor*(e.w+e.h)*.5*r;t.sort(function(t,e){return 1e8*(e.y-t.y)+t.x-e.x});var c=this.simple(n,r,i);o.lineCap=c?"butt":"round",o.strokeStyle=this.shadowColor,o.fillStyle=this.shadowColor;var s,f=ta(t);try{for(f.s();!(s=f.n()).done;){var h=s.value,y=this.width?this.width(h,n,r,i):void 0;if(y&&!(y<0)){var v=this.height?this.height(h,n,r,i):void 0;if(v&&!(v<0)){o.lineWidth=y;var p=h.x+n/2,d=h.y+n/2,b=v*this.shadowFactor;o.beginPath(),o.moveTo(p,d),o.lineTo(p+b*Math.cos(this.shadowDirection),d+b*Math.sin(this.shadowDirection)),o.stroke()}}}}catch(t){f.e(t)}finally{f.f()}var m,g=ta(t);try{for(g.s();!(m=g.n()).done;){var w=m.value,S=this.color?this.color(w,n,r,i):void 0;if(S){var x=this.width?this.width(w,n,r,i):void 0;if(x&&!(x<0)){var _=this.height?this.height(w,n,r,i):void 0;if(_&&!(_<0)){var O=w.x+n/2,j=w.y+n/2,P=O-a,C=j-u,k=Math.atan2(C,P),T=Math.sqrt(P*P+C*C)*_/(l-_);c?(o.strokeStyle=S,o.lineWidth=x,o.beginPath(),o.moveTo(O,j),o.lineTo(O+T*Math.cos(k),j+T*Math.sin(k)),o.stroke()):(o.strokeStyle=this.outlineCol,o.lineWidth=x+2*this.outlineWidthPix*r,o.beginPath(),o.moveTo(O,j),o.lineTo(O+T*Math.cos(k),j+T*Math.sin(k)),o.stroke(),o.strokeStyle=S,o.lineWidth=x,o.beginPath(),o.moveTo(O,j),o.lineTo(O+T*Math.cos(k),j+T*Math.sin(k)),o.stroke(),o.strokeStyle=this.outlineCol,o.lineWidth=this.outlineWidthPix*r,o.beginPath(),o.arc(O+T*Math.cos(k),j+T*Math.sin(k),.5*x,0,2*Math.PI,!1),o.stroke())}}}}}catch(t){g.e(t)}finally{g.f()}o.lineCap="butt",this.updateLegends({style:this,resolution:n,z:r,viewScale:i,cells:t})}}],r&&na(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function la(t){return la="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},la(t)}function ca(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=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,fa(r.key),r)}}function fa(t){var e=function(t){if("object"!=la(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=la(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==la(e)?e:e+""}function ha(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ha=function(){return!!t})()}function ya(t){return ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ya(t)}function va(t,e){return va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},va(t,e)}var pa=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=ya(e),function(t,e){if(e&&("object"==la(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)}(t,ha()?Reflect.construct(e,n||[],ya(t).constructor):e.apply(t,n))}(this,e,[n])).color=n.color||function(t,e,n,r){return"#EA6BAC"},t.width=n.width||function(t,e,n,r){return e/5},t.length=n.length||function(t,e,n,r){return e},t.diamond=n.diamond,t}return 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&&va(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n,r){this.filter&&(t=t.filter(this.filter));var o=n.view.z,i=n.offscreenCtx,a=e.buildSides(t,r);if(0!=a.length){var u=this.viewScale?this.viewScale(a,r,o):void 0;i.lineCap="butt";var l,c=.5*r,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ca(t,e);var n={}.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)?ca(t,e):void 0}}(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}}}}(a);try{for(s.s();!(l=s.n()).done;){var f=l.value,h=this.color?this.color(f,r,o,u):void 0;if(h&&"none"!=h)if(this.diamond){i.fillStyle=h;var y=f.x,v=f.y;i.beginPath(),i.moveTo(y-c,v),i.lineTo(y,v+c),i.lineTo(y+c,v),i.lineTo(y,v-c),i.closePath(),i.fill()}else{var p=this.width?this.width(f,r,o,u):void 0;if(!p||p<=0)continue;var d=this.length?this.length(f,r,o,u):void 0;if(!d||d<=0)continue;var b=.5*d;i.lineWidth=p,i.strokeStyle=h;var m=f.x,g=f.y;i.beginPath(),"v"===f.or?(i.moveTo(m,g-b),i.lineTo(m,g+b)):(i.moveTo(m-b,g),i.lineTo(m+b,g)),i.stroke()}}}catch(t){s.e(t)}finally{s.f()}this.updateLegends({style:this,resolution:r,z:o,viewScale:u,cells:t})}}}],o=[{key:"buildSides",value:function(t,e){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.01,r=[],o=arguments.length>4&&void 0!==arguments[4]&&!arguments[4]?0:e/2;n*=e;var i=Math.abs;t.sort(function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x});for(var a=t[0],u=1;u<t.length;u++){var l=t[u];i(a.y+e-l.y)<n&&i(a.x-l.x)<n?r.push({or:"h",x:a.x+o,y:l.y,c1:a,c2:l}):(r.push({or:"h",x:a.x+o,y:a.y+e,c1:a,c2:void 0}),r.push({or:"h",x:l.x+o,y:l.y,c1:void 0,c2:l})),a=l}t.sort(function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y}),a=t[0];for(var c=1;c<t.length;c++){var s=t[c];i(a.x+e-s.x)<n&&i(a.y-s.y)<n?r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:s}):(r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:void 0}),r.push({or:"v",x:s.x,y:s.y+o,c1:void 0,c2:s})),a=s}return r}}],r&&sa(n.prototype,r),o&&sa(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Pr),da=new Map;function ba(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=JSON.stringify(n||{}),o=da.get(r);return o&&!o.gl.isContextLost()||(o=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var o=n&&2==+n.version?"2":"",i=r.getContext("webgl"+o,n);if(!i)throw new Error("Unable to initialize WebGL"+o+". Your browser or machine may not support it.");return{canvas:r,gl:i,width:t,height:e}}(t+"",e+"",n),o.width=+t,o.height=+e,da.set(r,o)),o.width==t&&o.height==e||(o.canvas.width=t,o.canvas.height=e,o.width=+t,o.height=+e),o.gl.viewport(0,0,o.width,o.height),o}var ma=new WeakMap;function ga(t){var e=ma.get(t);return e||(e={programs:new Map,buffers:new Map,owners:new Map},ma.set(t,e)),e}function wa(t,e,n){var r=ga(t).programs,o=e+"\0"+n,i=r.get(o);return i||(i=function(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)")}(t,_a(t,t.VERTEX_SHADER,e),_a(t,t.FRAGMENT_SHADER,n)),r.set(o,i)),i}function Sa(t,e){var n=ga(t).buffers,r=n.get(e);return r||(r=t.createBuffer(),n.set(e,r)),r}function xa(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=ga(t).owners;return void 0!==n&&r.set(e,n),r.get(e)}function _a(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 Oa(t,e){var n=t.getParameter(t.ALIASED_POINT_SIZE_RANGE),r=n?n[1]:1;return e>Math.min(r,24)}var ja=[-1,-1,1,-1,1,1,-1,-1,1,1,-1,1];function Pa(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=new Float32Array(12*e),o=new Float32Array(12*e),i=n.map(function(){return new Float32Array(6*e)}),a=0;a<e;a++)for(var u=0;u<6;u++){var l=12*a+2*u;r[l]=t[2*a],r[l+1]=t[2*a+1],o[l]=ja[2*u],o[l+1]=ja[2*u+1];for(var c=0;c<n.length;c++)i[c][6*a+u]=n[c][a]}return{positions:r,corners:o,values:i}}function Ca(t){return Ca="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},Ca(t)}function ka(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,Ta(r.key),r)}}function Ta(t){var e=function(t){if("object"!=Ca(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ca(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ca(e)?e:e+""}function Aa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Aa=function(){return!!t})()}function Ea(t){return Ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ea(t)}function Ma(t,e){return Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ma(t,e)}var za="SquareColorCategoryWebGLStyle.pos",Ra="SquareColorCategoryWebGLStyle.i",Fa="SquareColorCategoryWebGLStyle.corner",Ia=function(t){function e(t){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ea(e),function(t,e){if(e&&("object"==Ca(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)}(t,Aa()?Reflect.construct(e,n||[],Ea(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,t.color=t.color||void 0;var r=Object.keys(t.color);n.catToI={};for(var o=0;o<r.length;o++)n.catToI[r[o]]=o+"";n.colors=[];for(var i=0,a=r;i<a.length;i++){var u=a[i];n.colors.push(t.color[""+u])}return n.size=t.size,n.cvWGL=void 0,n.gl=void 0,n.program=void 0,n.lutTexture=void 0,n.pointsNb=0,n.asTriangles=!1,n.x=void 0,n.y=void 0,n.z=void 0,n.cellsNb=void 0,n.highlightKey="",n}return 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&&Ma(t,e)}(e,t),n=e,r=[{key:"init",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.cvWGL=ba(t,e);var r=this.cvWGL.gl,o=this.gl!==r;return o&&(this.gl=r,this.lutTexture=void 0),this.program=wa(r,n?"\n attribute vec2 pos;\n attribute vec2 corner;\n uniform float halfSizeGeo;\n uniform mat3 mat;\n attribute float i;\n varying float vi;\n void main() {\n gl_Position = vec4(mat * vec3(pos + corner * halfSizeGeo, 1.0), 1.0);\n vi = i;\n }":"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute float i;\n varying float vi;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }","\n precision highp float;\n varying float vi;\n uniform sampler2D colorLUT;\n uniform float lutSize;\n void main(void) {\n float idx = floor(vi + 0.5);\n float u = (idx + 0.5) / lutSize;\n gl_FragColor = texture2D(colorLUT, vec2(u, 0.5));\n }"),r.useProgram(this.program),this.bindColors(),o}},{key:"bindColors",value:function(){var t=this.cvWGL.gl,e=this.colors.length;if(!this.lutTexture){for(var n=new Uint8Array(4*e),r=0;r<e;r++){var o=Ee(this.colors[r]);n[4*r]=+o.r,n[4*r+1]=o.g,n[4*r+2]=o.b,n[4*r+3]=255*(null==o?void 0:o.opacity)}this.lutTexture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.lutTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}t.uniform1i(t.getUniformLocation(this.program,"colorLUT"),0),t.uniform1f(t.getUniformLocation(this.program,"lutSize"),e),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.lutTexture)}},{key:"bindVertices",value:function(t,e,n,r,o){for(var i,a=this,u=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=this.cvWGL.gl,c=e/2,s=o.x,f=o.y,h=t.length,y=new Float32Array(2*h),v=new Float32Array(h),p=this.highlightColors?this.colors.map(function(t){return a.isHighlighted(t)}):null,d=0,b=0;b<h;b++){i=t[b];var m=this.code(i,e,n,r);if(null!=m){var g=this.catToI[m];isNaN(+g)?console.log("Unexpected category index: "+m+" "+g):p&&!p[+g]||(y[2*d]=i.x+c-s,y[2*d+1]=i.y+c-f,v[d]=+g,d++)}}var w=y.subarray(0,2*d),S=v.subarray(0,d);if(u){var x=Pa(w,d,[S]);w=x.positions,S=x.values[0],l.bindBuffer(l.ARRAY_BUFFER,Sa(l,Fa)),l.bufferData(l.ARRAY_BUFFER,x.corners,l.DYNAMIC_DRAW)}return l.bindBuffer(l.ARRAY_BUFFER,Sa(l,za)),l.bufferData(l.ARRAY_BUFFER,w,l.DYNAMIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,Sa(l,Ra)),l.bufferData(l.ARRAY_BUFFER,S,l.DYNAMIC_DRAW),xa(l,za,this),d}},{key:"bindAttributes",value:function(){var t=this.cvWGL.gl,e=t.getAttribLocation(this.program,"pos");t.bindBuffer(t.ARRAY_BUFFER,Sa(t,za)),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(e);var n=t.getAttribLocation(this.program,"i");if(t.bindBuffer(t.ARRAY_BUFFER,Sa(t,Ra)),t.vertexAttribPointer(n,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n),this.asTriangles){var r=t.getAttribLocation(this.program,"corner");t.bindBuffer(t.ARRAY_BUFFER,Sa(t,Fa)),t.vertexAttribPointer(r,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(r)}}},{key:"mapContentChanged",value:function(t,e){return(t.x!=this.x||t.y!=this.y||t.z!=this.z||this.cellsNb!=e)&&(this.x=t.x,this.y=t.y,this.z=t.z,this.cellsNb=e,!0)}},{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.size?this.size(n,r):n+.2*r,a=i/r,u=Oa(ba(e.w,e.h).gl,a),l=this.init(e.w,e.h,u),c=this.cvWGL.gl,s=this.cvWGL.canvas;u?c.uniform1f(c.getUniformLocation(this.program,"halfSizeGeo"),i/2):c.uniform1f(c.getUniformLocation(this.program,"sizePix"),1*a);var f=this.highlightColors?this.highlightColors.join("|"):"",h=f!==this.highlightKey;this.highlightKey=f;var y=u!==this.asTriangles;this.asTriangles=u,(this.mapContentChanged(e.view,t.length)||h||y||l||xa(c,za)!==this)&&(this.pointsNb=this.bindVertices(t,n,r,o,e.view,u)),this.bindAttributes(),c.uniformMatrix3fv(c.getUniformLocation(this.program,"mat"),!1,new Float32Array(e.getWebGLTransformCentered())),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),u?c.drawArrays(c.TRIANGLES,0,6*this.pointsNb):c.drawArrays(c.POINTS,0,this.pointsNb),e.initCanvasTransform(),e.offscreenCtx.drawImage(s,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o,cells:t})}}],r&&ka(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Ba(t){return Ba="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},Ba(t)}function La(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,Na(r.key),r)}}function Na(t){var e=function(t){if("object"!=Ba(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ba(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ba(e)?e:e+""}function Da(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Da=function(){return!!t})()}function Ga(t){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(t)}function Ua(t,e){return Ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ua(t,e)}var Wa=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ga(e),function(t,e){if(e&&("object"==Ba(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)}(t,Da()?Reflect.construct(e,n||[],Ga(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.elevation=t.elevation,n.sunAzimuth=t.sunAzimuth||function(){return 2.356},n.sunAltitude=t.sunAltitude||function(){return.2},n.color=t.color||function(){return"black"},n.undefinedValue=t.undefinedValue||0,n}return 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&&Ua(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=t,i=e.view.z,a=this.viewScale?this.viewScale(t,n,i):void 0,u=gi(t,n,function(t){return r.elevation(t)}),l=u.x0,c=u.y0;u=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2.356,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.15,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,i=t.length,a=t[0].length,u=Math.sin(n),l=-Math.cos(n),c=Math.tan(r),s=Array.from({length:i},function(){return new Array(a).fill(void 0)}),f=0;f<i;f++)for(var h=0;h<a;h++){var y=t[f][h]||o;if(void 0!==y)for(var v=e;;){var p=h-u*v/e,d=f-l*v/e,b=Math.round(p),m=Math.round(d);if(b<0||m<0||b>=a||m>=i)break;var g=t[m][b]||o;if(void 0===g)break;if(g-y-c*v>0){s[f][h]=1;break}v+=e}}return s}(u,n,this.sunAzimuth(n,i,a),this.sunAltitude(n,i,a),this.undefinedValue),t=[];for(var s=0;s<u.length;s++)for(var f=u[s],h=c-s*n,y=0;y<f.length;y++)if(f[y]){var v={x:l+y*n,y:h};t.push(v)}new Ia({code:function(){return"a"},color:{a:this.color(n,i,a)}}).draw(t,e,n),this.updateLegends({style:this,resolution:n,z:i,viewScale:a,cells:o})}}}],r&&La(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Ha(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let o of t)null!=(o=e(o,++r,t))&&(n<o||void 0===n&&o>=o)&&(n=o)}return n}function Ya(t){return Ya="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},Ya(t)}function $a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($a=function(){return!!t})()}function Va(t){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(t)}function qa(t,e){return qa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qa(t,e)}var Xa=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,n){return e=Va(e),function(t,e){if(e&&("object"==Ya(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)}(t,$a()?Reflect.construct(e,n||[],Va(t).constructor):e.apply(t,n))}(this,e,[n]);var r=n.elevation;t.viewScale=function(t){return Ha(t,function(t){return(e=t).c1&&e.c2&&e.c1[r]&&e.c2[r]?e.v=+e.c2[r]-e.c1[r]:e.v=0,e.v;var e})};var o=n.colorTopLeft||"255,255,255",i=n.colorBottomRight||"0,0,0";if(null!=n.revert&&n.revert){var a=o;o=i,i=a}var u=n.scale;return t.color=function(t,e,n,r){if(0!=t.v){var a=Math.abs(t.v/r);return u&&(a=u(a)),t.v<0&&"h"===t.or||t.v>0&&"v"===t.or?"rgba("+o+","+a+")":"rgba("+i+","+a+")"}},t.width=function(t,e,r){return n.width||Math.min(2*r,e/3)},t.diamond=n.diamond,t}return 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&&qa(t,e)}(e,t),n=e,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(pa);function Za(t){return Za="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},Za(t)}function Ka(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ja(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,Qa(r.key),r)}}function Qa(t){var e=function(t){if("object"!=Za(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Za(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Za(e)?e:e+""}function tu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tu=function(){return!!t})()}function eu(t){return eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},eu(t)}function nu(t,e){return nu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nu(t,e)}var ru=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=eu(e),function(t,e){if(e&&("object"==Za(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)}(t,tu()?Reflect.construct(e,n||[],eu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,n.color=t.color,n}return 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&&nu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=pa.buildSides(t,n);if(0!=i.length){var a=this.viewScale?this.viewScale(i,n,r):void 0;o.lineCap="butt";var u,l=.5*n,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ka(t,e);var n={}.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)?Ka(t,e):void 0}}(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}}}}(i);try{for(c.s();!(u=c.n()).done;){var s=u.value,f=s.c1?this.code(s.c1,n,r):void 0,h=s.c2?this.code(s.c2,n,r):void 0;if(f!=h){var y=this.width?this.width(s,n,r,a):void 0;if(y&&!(y<=0)){var v=.5*y;o.lineWidth=y,"h"===s.or?(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x-l,s.y+v),o.lineTo(s.x+l,s.y+v),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-l,s.y-v),o.lineTo(s.x+l,s.y-v),o.stroke())):(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x+v,s.y-l),o.lineTo(s.x+v,s.y+l),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-v,s.y-l),o.lineTo(s.x-v,s.y+l),o.stroke()))}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:a,cells:t})}}}],r&&Ja(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(pa);const ou=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 iu(t){return iu="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},iu(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,uu(r.key),r)}}function uu(t){var e=function(t){if("object"!=iu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=iu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==iu(e)?e:e+""}var lu=function(){return t=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=wa(e,"\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 ","\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=[]},(e=[{key:"addPointData",value:function(t,e,n){var r=Ee(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.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,Sa(e,"WebGLSquareColoring.pos")),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.DYNAMIC_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,Sa(e,"WebGLSquareColoring.color")),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.DYNAMIC_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.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}])&&au(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function cu(t){return cu="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},cu(t)}function su(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fu(t,e);var n={}.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)?fu(t,e):void 0}}(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 fu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,yu(r.key),r)}}function yu(t){var e=function(t){if("object"!=cu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cu(e)?e:e+""}function vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vu=function(){return!!t})()}function pu(t){return pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pu(t)}function du(t,e){return du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},du(t,e)}var bu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=pu(e),function(t,e){if(e&&("object"==cu(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)}(t,vu()?Reflect.construct(e,n||[],pu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.dotNumber=t.dotNumber||function(t,e){return e/100},n.color=t.color||function(){return"#FF5733"},n.dotSize=t.dotSize||function(t,e){return 1.5*e},n.sigma=t.sigma||function(t,e){return t/2},n}return 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&&du(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.dotSize?this.dotSize(n,r,o):r,a=this.sigma?this.sigma(n,r,o):.4*n,u=ou(0,a),l=e.offscreenCtx;if(function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){var c=ba(e.w,e.h);if(!c)return void console.error("No webGL");var s,f=new lu(c.gl,i/r),h=n/2,y=e.view.x,v=e.view.y,p=su(t);try{for(p.s();!(s=p.n()).done;){var d=s.value,b=this.color(d,n,r,o);if(b&&"none"!==b){var m=this.dotNumber(d,n,r,o),g=this.offset(d,n,r),w=d.x+g.dx+h-y,S=d.y+g.dy+h-v,x=Ee(b);if(!x)return;for(var _=0;_<=m;_++)f.addPointData2(w+u(),S+u(),x.r,x.g,x.b,x.opacity)}}}catch(t){p.e(t)}finally{p.f()}f.draw(e.getWebGLTransformCentered()),e.initCanvasTransform(),l.drawImage(c.canvas,0,0)}else{var O,j=su(t);try{for(j.s();!(O=j.n()).done;){var P=O.value,C=this.color(P,n,r,o);if(C&&"none"!==C){l.fillStyle=C;for(var k=this.dotNumber(P,n,r,o),T=this.offset(P,n,r),A=P.x+T.dx+n/2,E=P.y+T.dy+n/2,M=0;M<=k;M++)l.fillRect(A+u(),E+u(),i,i)}}}catch(t){j.e(t)}finally{j.f()}}this.updateLegends({style:this,resolution:n,z:r,viewScale:o,cells:t})}}],r&&hu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function mu(t){return mu="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},mu(t)}function gu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,Su(r.key),r)}}function Su(t){var e=function(t){if("object"!=mu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mu(e)?e:e+""}function xu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xu=function(){return!!t})()}function _u(t){return _u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_u(t)}function Ou(t,e){return Ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ou(t,e)}var ju=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=_u(e),function(t,e){if(e&&("object"==mu(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)}(t,xu()?Reflect.construct(e,n||[],_u(t).constructor):e.apply(t,n))}(this,e,[n])).classifier=n.classifier||function(t,e,n){return function(t){return 1}},t.width=n.width||function(t,e,n,r,o){return Math.abs(e)*r},t.length=n.length||function(t,e,n,r){return e},t.colorDark=n.colorDark||"#111",t.colorBright=n.colorBright||"#ddd",t.revert=null!=n.revert&&n.revert,t.diamond=n.diamond,t.limit=n.limit||"steep",t}return 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&&Ou(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.classifier(t,n,o),u=function(t){var e=t.c1?a(t.c1):void 0,n=t.c2?a(t.c2):void 0;if(void 0!==e||void 0!==n)return void 0===e?"none"==r.limit?void 0:"steep"==r.limit?n:Math.sign(n):void 0===n?"none"==r.limit?void 0:"steep"==r.limit?-e:Math.sign(-e):n-e},l=pa.buildSides(t,n);if(0!=l.length){var c=this.viewScale?this.viewScale(l,n,o):void 0;i.lineCap="butt";var s,f=.5*n,h=this.revert?this.colorBright:this.colorDark,y=this.revert?this.colorDark:this.colorBright,v=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return gu(t,e);var n={}.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)?gu(t,e):void 0}}(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}}}}(l);try{for(v.s();!(s=v.n()).done;){var p=s.value,d=u(p);if(void 0!==d&&0!==d){var b=d<0&&"h"===p.or||d>0&&"v"===p.or?y:h;if(b&&"none"!=b)if(this.diamond){i.fillStyle=b;var m=p.x,g=p.y;i.beginPath(),i.moveTo(m-f,g),i.lineTo(m,g+f),i.lineTo(m+f,g),i.lineTo(m,g-f),i.closePath(),i.fill()}else{var w=this.width?this.width(p,d,n,o,c):void 0;if(!w||w<=0)continue;var S=this.length?this.length(p,n,o,c):void 0;if(!S||S<=0)continue;var x=.5*S;i.lineWidth=w,i.strokeStyle=b;var _=p.x,O=p.y;i.beginPath(),"v"===p.or?(i.moveTo(_,O-x),i.lineTo(_,O+x)):(i.moveTo(_-x,O),i.lineTo(_+x,O)),i.stroke()}}}}catch(t){v.e(t)}finally{v.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:c,cells:t})}}}],r&&wu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Pu(t){return null===t?NaN:+t}function Cu(t,e,n=Pu){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),a=+n(t[i],i,t);return a+(+n(t[i+1],i+1,t)-a)*(o-i)}}function ku(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Tu(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Au(t){let e,n,r;function o(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<0?o=e+1:i=e}while(o<i)}return o}return 2!==t.length?(e=ku,n=(e,n)=>ku(t(e),n),r=(e,n)=>t(e)-n):(e=t===ku||t===Tu?t:Eu,n=t,r=t),{left:o,center:function(t,e,n=0,i=t.length){const a=o(t,e,n,i-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<=0?o=e+1:i=e}while(o<i)}return o}}}function Eu(){return 0}const Mu=Au(ku),zu=Mu.right,Ru=(Mu.left,Au(Pu).center,zu);function Fu(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Iu(){var t,e=[],n=[],r=[];function o(){var t=0,o=Math.max(1,n.length);for(r=new Array(o-1);++t<o;)r[t-1]=Cu(e,t/o);return i}function i(e){return null==e||isNaN(e=+e)?t:n[Ru(r,e)]}return i.invertExtent=function(t){var o=n.indexOf(t);return o<0?[NaN,NaN]:[o>0?r[o-1]:e[0],o<r.length?r[o]:e[e.length-1]]},i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(ku),o()},i.range=function(t){return arguments.length?(n=Array.from(t),o()):n.slice()},i.unknown=function(e){return arguments.length?(t=e,i):t},i.quantiles=function(){return r.slice()},i.copy=function(){return Iu().domain(e).range(n).unknown(t)},Fu.apply(i,arguments)}var Bu=function(t){var e=t.valueFunction,n=t.minValue||0,r=t.minSizePix||0,o=t.maxSizeFactor||1,i=t.stretching,a=t.range,u=t.domain,l=t.classNumber;return function(t,c,s){var f=u||[n,Ha(t,e)],h=a||[r*s,c*o],y=f[1]-f[0],v=f[0],p=h[1]-h[0],d=h[0],b=function(t){return t=(t-v)/y,i&&(t=i(t)),l&&(t=1==t?1:Math.floor(t*l)/(l-1)),d+t*p};return b.invert=function(t){return i&&(t=function(t,e){if(t.invert)return t.invert(e);for(var n=0,r=1,o=0;o<50;o++){var i=(n+r)/2;t(i)<e?n=i:r=i}return(n+r)/2}(i,t)),v+t*y},b}},Lu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.minSizePix||1,o=t.maxSizeFactor||1,i=Iu();return function(t,a,u){i.domain(t.map(e));var l=r*u,c=a*o;return i.range(Array.from({length:n},function(t,e){return l+e*(c-l)/(n-1)})),i.breaks=i.quantiles(),i.values=i.range(),i}},Nu=function(t){var e,n=t.valueFunction,r=t.stretching,o=t.colorScale||function(){return"purple"},i=null===(e=t.colors)||void 0===e?void 0:e.length;return t.colors&&i&&(o=function(e){return t.colors[1==e?i-1:Math.floor(e*i)]}),function(e){if(0!=e.length&&e){var a=yi(e,n);if(null!=a[0]){var u=a[1]-a[0],l=function(t){return t=(t-a[0])/u,r&&(t=r(t)),o(t)};if(l.invert=function(t){return r&&(t=r.invert(t)),a[0]+t*u},t.colors&&i){l.breaks=[];for(var c=1;c<i;c++)l.breaks.push(l.invert(c/i))}return l}}}},Du=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.colors;t.colorScale&&(r=Vu(t.colorScale,n)),r=r||Array.from({length:n},function(t,e){return"rgb("+Math.floor(255*e/(n-1))+",150,150)"});var o=Iu().range(r);return function(t){return o.domain(t.map(e)),o.breaks=o.quantiles(),o.colors=r,o}},Gu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=Iu().range(Array.from({length:n},function(t,e){return e}));return function(t){return r.domain(t.map(e)),r.breaks=r.quantiles(),r}},Uu=function(t){return function(e,n,r){var o={};for(var i in t)o[i]=t[i](e,n,r);return o}};function Wu(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=r?r.invert:function(t){return t};if(!o)throw new Error("The stretching function has no invert function");for(var i=[],a=1;a<n;a++)i.push(t+(e-t)*o(a/n));return i}function Hu(t){var e=t.length,n=function(n){for(var r=0;r<e;){if(n<=t[r])return r;r++}return r};return n.breaks=t,n}function Yu(t,e,n){for(var r=[],o=(e-t)/n,i=1;i<n;i++)r.push(t+i*o);return Hu(r)}function $u(t,e){var n=Hu(t),r=function(t){return e[n(t)]};return r.breaks=t,r.colors=e,r}function Vu(t,e){if(1==e)return[t(.5)];for(var n=[],r=0;r<e;r++)n.push(t(r/(e-1)));return n}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},qu(t)}function Xu(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Zu(t,e);var n={}.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)?Zu(t,e):void 0}}(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 Zu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ku=function(){return!!t})()}function Ju(t){return Ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ju(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}function tl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function el(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,rl(r.key),r)}}function nl(t,e,n){return e&&el(t.prototype,e),n&&el(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function rl(t){var e=function(t){if("object"!=qu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qu(e)?e:e+""}var ol=function(){return nl(function t(){tl(this,t)},null,[{key:"get",value:function(t,e,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=(r=r||{}).colDark||r.colorDark||"#333",i=r.colBright||r.colorBright||"#aaa",a=Hu(e),u=function(e){return a(t(e))},l={},c=0;c<n.length;c++)l[c+""]=n[c];var s=new Ia({code:u,color:l}),f=new ju({classifier:function(){return u},colorDark:o,colorBright:i,diamond:r.diamond});return[s,new hi({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n},filter:r.filter}),f,new il({colDark:o,colBright:i,filter:r.filter})]}},{key:"getCategory",value:function(t,e,n){return(n=n||{}).colDark=n.colDark||"#333",n.colBright=n.colBright||"#aaa",[new Ia({code:t,color:e}),new hi({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n}}),new il({colDark:n.colDark,colBright:n.colBright})]}}])}(),il=function(t){function e(t){var n,r,o,i;return tl(this,e),r=this,i=[t],o=Ju(o=e),n=function(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)}(r,Ku()?Reflect.construct(o,i||[],Ju(r).constructor):o.apply(r,i)),t=t||{},n.colDark=t.colDark||"#333",n.colBright=t.colBright||"#aaa",n}return 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&&Qu(t,e)}(e,t),nl(e,[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.offscreenCtx;r.lineWidth=.6*e.view.z,r.strokeStyle=this.colDark;var o,i=Xu(t);try{for(i.s();!(o=i.n()).done;){var a=o.value;r.beginPath(),r.arc(a.x+.5*n,a.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!0),r.stroke()}}catch(t){i.e(t)}finally{i.f()}r.strokeStyle=this.colBright;var u,l=Xu(t);try{for(l.s();!(u=l.n()).done;){var c=u.value;r.beginPath(),r.arc(c.x+.5*n,c.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!1),r.stroke()}}catch(t){l.e(t)}finally{l.f()}}}])}(Pr);function al(t){return al="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},al(t)}function ul(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,ll(r.key),r)}}function ll(t){var e=function(t){if("object"!=al(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=al(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==al(e)?e:e+""}var cl=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.asTriangles=void 0!==a&&Oa(e,o);var u=[];u.push("precision mediump float;"),u.push("varying float vt;"),u.push("uniform float alpha;");for(var l=0;l<n.length;l++)u.push("uniform vec4 c"+l+";");if(u.push("void main(void) {"),r?"pow"==r.fun?u.push(" float t = pow(vt, alpha);"):"powInv"==r.fun?u.push(" float t = 1.0-pow(1.0-vt, 1.0/alpha);"):"exp"==r.fun?u.push(0==r.alpha?"float t = vt;":" float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);"):"log"==r.fun?u.push(0==r.alpha?"float t = vt;":" float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);"):"circle"==r.fun?0==r.alpha?u.push(" float t = vt;"):1==r.alpha?u.push(" float t = sqrt(vt * (2.0 - vt));"):(u.push(" float a = alpha / (1.0 - alpha);"),u.push(" float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;")):"circleInv"==r.fun?0==r.alpha?u.push(" float t = vt;"):1==r.alpha?u.push(" float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));"):(u.push(" float a = alpha / (1.0 - alpha);"),u.push(" 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),u.push(" float t = vt;")):u.push(" float t = vt;"),1==n.length)u.push(" vec4 cI=c0;"),u.push(" vec4 cF=c0;");else if(2==n.length)u.push(" vec4 cI=c0;"),u.push(" vec4 cF=c1;");else{var c=n.length-1,s=c+".0";u.push(" vec4 cI;"),u.push(" vec4 cF;"),u.push(" if(t<1.0/"+s+") { cI=c0; cF=c1; t=t*"+s+"; }");for(var f=2;f<c;f++)u.push(" else if(t<"+f+".0/"+s+") { cI=c"+(f-1)+"; cF=c"+f+"; t="+s+"*t-"+(f-1)+".0; }");u.push(" else { cI=c"+(c-1)+"; cF=c"+c+"; t="+s+"*t-"+(c-1)+".0; }")}1==n.length?u.push(" gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}"):u.push(" gl_FragColor = mix(cI, cF, t);}");var h=u.join("");this.program=wa(e,this.asTriangles?"\n attribute vec2 pos;\n attribute vec2 corner;\n uniform float halfSizeGeo;\n uniform mat3 mat;\n\n attribute float t;\n varying float vt;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos + corner * halfSizeGeo, 1.0), 1.0);\n vt = t;\n }\n ":"\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 ",h),e.useProgram(this.program),this.asTriangles?e.uniform1f(e.getUniformLocation(this.program,"halfSizeGeo"),a/2):e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*o),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var y=0;y<n.length;y++){var v=Ee(n[y]),p=v.opacity;1==v.opacity&&null!=i&&(p=i);var d=[+v.r/255,+v.g/255,+v.b/255,+p];e.uniform4fv(e.getUniformLocation(this.program,"c"+y),d)}},e=[{key:"draw",value:function(t,e,n){var r=this.gl,o=this.program;r.useProgram(o);var i=t.length/2,a=new Float32Array(t),u=new Float32Array(e);if(this.asTriangles){var l=Pa(t,i,[e]);a=l.positions,u=l.values[0],r.bindBuffer(r.ARRAY_BUFFER,Sa(r,"WebGLSquareColoringAdvanced.corner")),r.bufferData(r.ARRAY_BUFFER,l.corners,r.DYNAMIC_DRAW);var c=r.getAttribLocation(o,"corner");r.vertexAttribPointer(c,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(c)}r.bindBuffer(r.ARRAY_BUFFER,Sa(r,"WebGLSquareColoringAdvanced.pos")),r.bufferData(r.ARRAY_BUFFER,a,r.DYNAMIC_DRAW);var s=r.getAttribLocation(o,"pos");r.vertexAttribPointer(s,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(s),r.bindBuffer(r.ARRAY_BUFFER,Sa(r,"WebGLSquareColoringAdvanced.t")),r.bufferData(r.ARRAY_BUFFER,u,r.DYNAMIC_DRAW);var f=r.getAttribLocation(o,"t");r.vertexAttribPointer(f,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(f),r.uniformMatrix3fv(r.getUniformLocation(o,"mat"),!1,new Float32Array(n)),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),this.asTriangles?r.drawArrays(r.TRIANGLES,0,6*i):r.drawArrays(r.POINTS,0,i)}}],e&&ul(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function sl(t){return sl="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},sl(t)}function fl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hl(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,yl(r.key),r)}}function yl(t){var e=function(t){if("object"!=sl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sl(e)?e:e+""}function vl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vl=function(){return!!t})()}function pl(t){return pl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pl(t)}function dl(t,e){return dl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dl(t,e)}var bl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=pl(e),function(t,e){if(e&&("object"==sl(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)}(t,vl()?Reflect.construct(e,n||[],pl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.tFun=t.tFun,n.stretching=t.stretching,n.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&&(n.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),n.opacity=t.opacity,n.size=t.size,n}return 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&&dl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=ba(e.w,e.h,null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(i){var a,u=n/2,l=e.view.x,c=e.view.y,s=[],f=[],h=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fl(t,e);var n={}.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)?fl(t,e):void 0}}(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(h.s();!(a=h.n()).done;){var y=a.value,v=this.tFun(y,n,r,o);null!=v&&null!=v&&(s.push(y.x+u-l,y.y+u-c),f.push(v>1?1:v<0?0:v))}}catch(t){h.e(t)}finally{h.f()}var p=this.size?this.size(n,r):n+.2*r,d=this.opacity?this.opacity(n,r):void 0;new cl(i.gl,this.colors,this.stretching,p/r,d,p).draw(s,f,e.getWebGLTransformCentered()),e.initCanvasTransform(),e.offscreenCtx.drawImage(i.canvas,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o,cells:t})}else console.error("No webGL")}}],r&&hl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function ml(t){return ml="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},ml(t)}function gl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wl(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,Sl(r.key),r)}}function Sl(t){var e=function(t){if("object"!=ml(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ml(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ml(e)?e:e+""}function xl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xl=function(){return!!t})()}function _l(t){return _l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_l(t)}function Ol(t,e){return Ol=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ol(t,e)}var jl=new Map,Pl=function(t){var e=jl.get(t);if(void 0===e){var n=Ee(t);e=n?[n.r/255,n.g/255,n.b/255,n.opacity]:null,jl.size>1e4&&jl.clear(),jl.set(t,e)}return e},Cl=new Float32Array(28672),kl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=_l(e),function(t,e){if(e&&("object"==ml(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)}(t,xl()?Reflect.construct(e,n||[],_l(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||"#EA6BAC",n.size=t.size||function(t,e){return e},n}return 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&&Ol(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=.5*n,a=this.highlightColors,u="function"==typeof this.color?this.color:null,l="function"==typeof this.size?this.size:null,c=e.view.x,s=e.view.y;Cl.length<7*t.length&&(Cl=new Float32Array(7*Math.max(t.length,Cl.length/7*2)));var f,h=0,y=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return gl(t,e);var n={}.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)?gl(t,e):void 0}}(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(y.s();!(f=y.n()).done;){var v=f.value,p=u?u(v,n,r,o):this.color;if(p&&"none"!==p&&(!a||this.isHighlighted(p))){var d=l?l(v,n,r,o):this.size;if(d){var b=Pl(p);if(b){var m=this.offset(v,n,r),g=7*h;Cl[g]=v.x+i+m.dx-c,Cl[g+1]=v.y+i+m.dy-s,Cl[g+2]=.5*d,Cl[g+3]=b[0],Cl[g+4]=b[1],Cl[g+5]=b[2],Cl[g+6]=b[3],h++}}}}}catch(t){y.e(t)}finally{y.f()}h>0&&(this.drawWebGL(e,h,r)||this.drawCanvas(e,h)),this.updateLegends({viewScale:o,resolution:n,z:r,cells:t})}},{key:"drawWebGL",value:function(t,e,n){var r;try{r=ba(t.w,t.h,{version:2})}catch(t){return!1}var o=r.gl;if(!o.drawArraysInstanced)return!1;var i=wa(o,"#version 300 es\nlayout(location = 0) in vec2 corner;\nlayout(location = 1) in vec3 circle;\nlayout(location = 2) in vec4 col;\nuniform vec2 canvasSize;\nuniform float z;\nout vec4 vCol;\nout vec2 vLocal;\nout float vRadius;\nvoid main() {\n float radius = circle.z / z;\n // the quad is a pixel bigger than the circle, for its anti-aliased edge\n vec2 local = corner * (radius + 1.0);\n vec2 pix = circle.xy / z + local;\n gl_Position = vec4(pix * 2.0 / canvasSize, 0.0, 1.0);\n vCol = col;\n vLocal = local;\n vRadius = radius;\n}\n","#version 300 es\nprecision mediump float;\nin vec4 vCol;\nin vec2 vLocal;\nin float vRadius;\nout vec4 outColor;\nvoid main() {\n float a = clamp(vRadius + 0.5 - length(vLocal), 0.0, 1.0) * vCol.a;\n outColor = vec4(vCol.rgb * a, a);\n}\n");return o.useProgram(i),o.uniform2f(o.getUniformLocation(i,"canvasSize"),t.w,t.h),o.uniform1f(o.getUniformLocation(i,"z"),n),o.bindBuffer(o.ARRAY_BUFFER,Sa(o,"CircleColorSizeWebGLStyle.corner")),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.vertexAttribDivisor(0,0),o.bindBuffer(o.ARRAY_BUFFER,Sa(o,"CircleColorSizeWebGLStyle.circles")),o.bufferData(o.ARRAY_BUFFER,Cl.subarray(0,7*e),o.DYNAMIC_DRAW),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,3,o.FLOAT,!1,28,0),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,28,12),o.vertexAttribDivisor(2,1),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.drawArraysInstanced(o.TRIANGLE_STRIP,0,4,e),o.disable(o.BLEND),o.vertexAttribDivisor(1,0),o.vertexAttribDivisor(2,0),o.disableVertexAttribArray(0),o.disableVertexAttribArray(1),o.disableVertexAttribArray(2),t.initCanvasTransform(),t.offscreenCtx.drawImage(r.canvas,0,0),!0}},{key:"drawCanvas",value:function(t,e){var n=t.offscreenCtx,r=t.view.x,o=t.view.y;t.setCanvasTransform();for(var i=0;i<e;i++){var a=7*i;n.fillStyle="rgba("+[255*Cl[a+3],255*Cl[a+4],255*Cl[a+5],Cl[a+6]].join(",")+")",n.beginPath(),n.arc(Cl[a]+r,Cl[a+1]+o,Cl[a+2],0,2*Math.PI),n.fill()}}}],r&&wl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Tl(t){return Tl="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},Tl(t)}function Al(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function El(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,Ml(r.key),r)}}function Ml(t){var e=function(t){if("object"!=Tl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Tl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tl(e)?e:e+""}function zl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zl=function(){return!!t})()}function Rl(t){return Rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rl(t)}function Fl(t,e){return Fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fl(t,e)}var Il=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Rl(e),function(t,e){if(e&&("object"==Tl(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)}(t,zl()?Reflect.construct(e,n||[],Rl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.mosaicFactor=t.mosaicFactor||.15,n.shadowFactor=t.shadowFactor||.2,n.shadowColor=t.shadowColor||"#555",n}return 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&&Fl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.strokeStyle=this.shadowColor,o.lineWidth=this.shadowFactor*n,o.lineJoin="round",o.lineCap="butt";var a,u=n*this.mosaicFactor,l=function(){return{x:Math.random()*u,y:Math.random()*u}},c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Al(t,e);var n={}.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)?Al(t,e):void 0}}(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(c.s();!(a=c.n()).done;){var s=a.value,f=this.color?this.color(s,n,r,i):void 0;if(f&&"none"!==f){o.fillStyle=f;var h=this.offset(s,n,r),y=l(),v=l(),p=l(),d=l();this.shadowFactor>0&&(o.beginPath(),o.moveTo(s.x+h.dx+y.x,s.y+h.dy+y.y),o.lineTo(s.x+h.dx+n-p.x,s.y+h.dy+p.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.stroke()),o.beginPath(),o.moveTo(s.x+h.dx+y.x,s.y+h.dy+y.y),o.lineTo(s.x+h.dx+n-p.x,s.y+h.dy+p.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.lineTo(s.x+h.dx+v.x,s.y+h.dy+n-v.y),o.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i,cells:t})}}],r&&El(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Bl(t){return Bl="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},Bl(t)}function Ll(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Nl(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,Dl(r.key),r)}}function Dl(t){var e=function(t){if("object"!=Bl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bl(e)?e:e+""}function Gl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gl=function(){return!!t})()}function Ul(t){return Ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ul(t)}function Wl(t,e){return Wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wl(t,e)}var Hl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ul(e),function(t,e){if(e&&("object"==Bl(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)}(t,Gl()?Reflect.construct(e,n||[],Ul(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.size=t.size||function(t,e){return e},n.shape=t.shape||function(){return"o"},n}return 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&&Wl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ll(t,e);var n={}.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)?Ll(t,e):void 0}}(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();!(r=l.n()).done;){var c=r.value,s=this.color?this.color(c,n,o,a):void 0;if(s&&"none"!==s){i.fillStyle=s;var f=this.size(c,n,o,a),h=(f=f<0?0:f>1?1:f)*u,y=this.shape?this.shape(c):"o";if("none"!==y){var v=c.x+u,p=c.y+u;if("p"===y)i.beginPath(),i.moveTo(v,p+u),i.lineTo(v+h,p+h),i.lineTo(v+u,p),i.lineTo(v+h,p-h),i.lineTo(v,p-u),i.lineTo(v-h,p-h),i.lineTo(v-u,p),i.lineTo(v-h,p+h),i.fill();else{if("o"!==y)throw new Error("Unexpected shape:"+y);i.beginPath(),i.moveTo(v,p+h),i.lineTo(v+u,p+u),i.lineTo(v+h,p),i.lineTo(v+u,p-u),i.lineTo(v,p-h),i.lineTo(v-u,p-u),i.lineTo(v-h,p),i.lineTo(v-u,p+u),i.fill()}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}],r&&Nl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Yl(t){return Yl="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},Yl(t)}function $l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Vl(t,e);var n={}.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)?Vl(t,e):void 0}}(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 Vl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ql(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,Xl(r.key),r)}}function Xl(t){var e=function(t){if("object"!=Yl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yl(e)?e:e+""}function Zl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zl=function(){return!!t})()}function Kl(t){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(t)}function Jl(t,e){return Jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jl(t,e)}var Ql=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Kl(e),function(t,e){if(e&&("object"==Yl(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)}(t,Zl()?Reflect.construct(e,n||[],Kl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.ts=t.ts,n.noData=t.noData||function(t){return void 0===t||""==t||null===t||isNaN(+t)},n.offsetX=t.offsetX||function(t,e,n){return 0},n.width=t.width||function(t,e,n){return e},n.offsetY=t.offsetY||function(t,e,n){return 0},n.height=t.height||function(t,e,n){return e},n.anchorModeY=t.anchorModeY||function(t,e,n){return"center"},n.lineWidth=t.lineWidth||function(t,e,n){return 1.5*n},n.color=t.color||function(){return"black"},n}return 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&&Jl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o,i,a=e.view.z,u=e.offscreenCtx,l=this.viewScale?this.viewScale(t,n,a):void 0,c=function(t,e){var n=t[e];return r.noData(n)?void 0:+n},s=function(t){var e,n,o,i=$l(r.ts);try{for(i.s();!(o=i.n()).done;){var a=o.value,u=c(t,a);null!=u&&((null==e||u<e)&&(e=u),(null==n||u>n)&&(n=u))}}catch(t){i.e(t)}finally{i.f()}if(null!=e)return n-e},f=$l(t);try{for(f.s();!(i=f.n()).done;){var h=s(i.value);null!=h&&(null==o||h>o)&&(o=h)}}catch(t){f.e(t)}finally{f.f()}if(o){var y=this.ts.length;u.lineCap="butt";var v,p=$l(t);try{for(p.s();!(v=p.n()).done;){var d=v.value,b=this.lineWidth?this.lineWidth(d,n,a,l):void 0;if(b&&!(b<0)){var m=this.color?this.color(d,n,a,l):void 0;if(m){var g=this.offsetX?this.offsetX(d,n,a):0;if(null!=g&&!isNaN(g)){var w=this.width?this.width(d,n,a):n;if(null!=w&&!isNaN(w)){var S=this.offsetY?this.offsetY(d,n,a):0;if(null!=S&&!isNaN(S)){var x=this.height?this.height(d,n,a):n;if(null!=x&&!isNaN(x)){var _=this.anchorModeY?this.anchorModeY(d,n,a):"center";if(_){u.lineWidth=b,u.strokeStyle=m;var O=void 0,j=void 0;if("first"===_)O=d[this.ts[0]],j=0;else if("last"===_)O=d[this.ts[this.ts.length-1]],j=0;else if("bottom"===_){var P,C=$l(this.ts);try{for(C.s();!(P=C.n()).done;){var k=P.value,T=c(d,k);null!=T&&(null==O||T<O)&&(O=T)}}catch(t){C.e(t)}finally{C.f()}j=0}else if("top"===_){var A,E=$l(this.ts);try{for(E.s();!(A=E.n()).done;){var M=A.value,z=c(d,M);null!=z&&(null==O||z>O)&&(O=z)}}catch(t){E.e(t)}finally{E.f()}j=n}else{if("center"!==_){console.log("Unexpected anchorModeY: "+_);continue}var R,F=void 0,I=void 0,B=$l(this.ts);try{for(B.s();!(R=B.n()).done;){var L=R.value,N=c(d,L);null!=N&&((null==F||N<F)&&(F=N),(null==I||N>I)&&(I=N))}}catch(t){B.e(t)}finally{B.f()}O=.5*(I+F),j=n/2}var D=w/(y-1),G=d[this.ts[0]];this.noData(G)||(u.beginPath(),u.moveTo(d.x+g,d.y+j+(G-O)*x/o+S));for(var U=void 0,W=1;W<y;W++)U=d[this.ts[W]],this.noData(G)&&this.noData(U)||(!this.noData(G)&&this.noData(U)?u.stroke():this.noData(G)&&!this.noData(U)?(u.beginPath(),u.moveTo(d.x+W*D+g,d.y+j+(U-O)*x/o+S)):(u.lineTo(d.x+W*D+g,d.y+j+(U-O)*x/o+S),W==y-1&&u.stroke())),G=U}}}}}}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:a,viewScale:l,cells:t})}}}],r&&ql(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function tc(t){return tc="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},tc(t)}function ec(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||rc(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 nc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=rc(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 rc(t,e){if(t){if("string"==typeof t)return oc(t,e);var n={}.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)?oc(t,e):void 0}}function oc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ic(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,ac(r.key),r)}}function ac(t){var e=function(t){if("object"!=tc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=tc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tc(e)?e:e+""}function uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uc=function(){return!!t})()}function lc(t){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lc(t)}function cc(t,e){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cc(t,e)}var sc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=lc(e),function(t,e){if(e&&("object"==tc(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)}(t,uc()?Reflect.construct(e,n||[],lc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.height=t.height||function(t,e,n,r){return.4*e},n.angle=null!=t.angle?t.angle:50,n.cornerLineStrokeColor=t.cornerLineStrokeColor||function(t,e,n,r){return"#999"},n.cornerLineWidth=t.cornerLineWidth||function(t,e,n,r){return r%90==0?0:.8*n},n.sVert=null==t.sVert||t.sVert,n.sHor=null==t.sHor||t.sHor,n}return 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&&cc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.keys(this.color),l=n/2,c=this.offset(void 0,n,o),s=c.dx,f=c.dy,h=pa.buildSides(t,n,this.angle%180!=90&&this.sVert,this.angle%180!=0&&this.sHor);if(0!=h.length){var y=this.angle*Math.PI/180,v=Math.cos(y),p=Math.sin(y),d=Math.abs(this.angle)<90?e.extGeo.xMin:e.extGeo.xMax,b=this.angle<0?e.extGeo.yMax:e.extGeo.yMin;h.sort(function(t,e){return Math.hypot(e.x-d,e.y-b)-Math.hypot(t.x-d,t.y-b)});var m=function(t){if(t){var e=r.cornerLineWidth?r.cornerLineWidth(t,n,o,r.angle):.8*o;if(0!=e){i.strokeStyle=r.cornerLineStrokeColor?r.cornerLineStrokeColor(t,n,o,r.angle):"#333",i.lineWidth=e;var u=r.height(t,n,o,a);i.beginPath(),i.moveTo(t.x+l+s,t.y+l+f),i.lineTo(t.x+l+u*v+s,t.y+l+u*p+f),i.stroke()}}};i.lineCap="round";var g,w=nc(h);try{for(w.s();!(g=w.n()).done;){var S=g.value,x=S.c1,_=S.c2,O=S.x,j=S.y,P=x?this.height(x,n,o,a):0,C=_?this.height(_,n,o,a):0,k=fc(x,u),T=fc(_,u);if(0!=k||0!=T)for(var A=0,E=0,M=0,z=Object.entries(this.color);M<z.length;M++){var R=ec(z[M],2),F=R[0],I=R[1],B=x?+x[F]:0,L=_?+_[F]:0;if(0!=B||0!=L){var N=P*A/k||0,D=P*(A+B)/k||0,G=C*E/T||0,U=C*(E+L)/T||0;i.beginPath(),"h"==S.or?(i.moveTo(O+N*v+s,j-l+N*p+f),i.lineTo(O+G*v+s,j+l+G*p+f),i.lineTo(O+U*v+s,j+l+U*p+f),i.lineTo(O+D*v+s,j-l+D*p+f)):(i.moveTo(O-l+N*v+s,j+N*p+f),i.lineTo(O+l+G*v+s,j+G*p+f),i.lineTo(O+l+U*v+s,j+U*p+f),i.lineTo(O-l+D*v+s,j+D*p+f)),i.fillStyle=I,i.fill(),A+=B,E+=L,m(x),m(_)}}}}catch(t){w.e(t)}finally{w.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}}],r&&ic(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr),fc=function(t,e){if(!t)return 0;var n,r=0,o=nc(e);try{for(o.s();!(n=o.n()).done;){var i=t[n.value];i&&(r+=+i)}}catch(t){o.e(t)}finally{o.f()}return r||0};function hc(t){return hc="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},hc(t)}function yc(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(hc(t)+" is not iterable")}function vc(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return pc(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(pc(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,pc(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,pc(f,"constructor",c),pc(c,"constructor",l),l.displayName="GeneratorFunction",pc(c,o,"GeneratorFunction"),pc(f),pc(f,o,"Generator"),pc(f,r,function(){return this}),pc(f,"toString",function(){return"[object Generator]"}),(vc=function(){return{w:i,m:h}})()}function pc(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}pc=function(t,e,n,r){function i(e,n){pc(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},pc(t,e,n,r)}function dc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return bc(t,e);var n={}.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)?bc(t,e):void 0}}(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 bc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mc(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function gc(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,wc(r.key),r)}}function wc(t){var e=function(t){if("object"!=hc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hc(e)?e:e+""}function Sc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sc=function(){return!!t})()}function xc(t){return xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xc(t)}function _c(t,e){return _c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_c(t,e)}var Oc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=xc(e),function(t,e){if(e&&("object"==hc(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)}(t,Sc()?Reflect.construct(e,n||[],xc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.image=t.image||function(){return""},n.size=t.size||function(t,e){return e},n.cache={},n}return 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&&_c(t,e)}(e,t),n=e,r=[{key:"draw",value:(o=vc().m(function t(e,n,r){var o,i,a,u,l,c,s,f,h=this;return vc().w(function(t){for(;;)switch(t.p=t.n){case 0:o=n.view.z,i=r/o,a=this.viewScale?this.viewScale(e,r,o):void 0,n.initCanvasTransform(),u=dc(e),t.p=1,c=vc().m(function t(){var e,u,c,s,f,y;return vc().w(function(t){for(;;)switch(t.n){case 0:if(e=l.value,u=h.image(e,r,o,a)){t.n=1;break}return t.a(2,0);case 1:if(c=h.size(e,r,o,a)/o){t.n=2;break}return t.a(2,0);case 2:if("loading"!=(s=h.cache[u])){t.n=3;break}return t.a(2,{v:void 0});case 3:if(s){y=(i-c)/2;try{n.offscreenCtx.drawImage(s,n.geoToPixX(e.x)+y,n.geoToPixY(e.y)+y-i,c,c)}catch(t){console.error(t)}}else h.cache[u]="loading",(f=new Image).onload=function(){h.cache[u]=f,n.redraw()},f.onerror=function(){console.warn("Could not retrieve image from",u)},f.src=u;case 4:return t.a(2)}},t)}),u.s();case 2:if((l=u.n()).done){t.n=6;break}return t.d(yc(c()),3);case 3:if(0!==(s=t.v)){t.n=4;break}return t.a(3,5);case 4:if(!s){t.n=5;break}return t.a(2,s.v);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,f=t.v,u.e(f);case 8:return t.p=8,u.f(),t.f(8);case 9:this.updateLegends({style:this,resolution:r,z:o,viewScale:a,cells:e});case 10:return t.a(2)}},t,this,[[1,7,8,9]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){mc(i,n,r,a,u,"next",t)}function u(t){mc(i,n,r,a,u,"throw",t)}a(void 0)})},function(t,e,n){return i.apply(this,arguments)})}],r&&gc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Pr);function jc(t){return jc="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},jc(t)}function Pc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cc(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,kc(r.key),r)}}function kc(t){var e=function(t){if("object"!=jc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jc(e)?e:e+""}function Tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tc=function(){return!!t})()}function Ac(t){return Ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ac(t)}function Ec(t,e){return Ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ec(t,e)}var Mc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ac(e),function(t,e){if(e&&("object"==jc(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)}(t,Tc()?Reflect.construct(e,n||[],Ac(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.value=t.value,n.targetResolution=t.targetResolution||function(t,e){return t/5},n.interpolatedProperty=t.interpolatedProperty||"value",n.nodataHandling=t.nodataHandling||"zero",n.styles=t.styles||[],n}return 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&&Ec(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=gi(t,n,function(t){return r.value(t)}),a=i.x0,u=i.y0,l=this.targetResolution(n,o),c=Math.round(n/l);l=n/c,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"zero";if(1===e)return t;var r=t.length;if(0===r)return[];for(var o=t[0].length,i=r*e,a=o*e,u=Array(i).fill().map(function(){return Array(a).fill(void 0)}),l=e%2==0,c=0;c<i;c++)for(var s=Math.min(Math.floor(c/e),r-2),f=c%e/e,h=s*e+e/2,y=0;y<a;y++){var v=Math.min(Math.floor(y/e),o-2),p=y%e/e,d=v*e+e/2,b=t[s][v],m=t[s][v+1],g=t[s+1][v],w=t[s+1][v+1];if(l){if(void 0===b&&c<=h&&y<=d)continue;if(void 0===m&&c<=h&&y>=d)continue;if(void 0===g&&c>=h&&y<=d)continue;if(void 0===w&&c>=h&&y>=d)continue}else{if(void 0===b&&c<h&&y<d)continue;if(void 0===m&&c<h&&y>d)continue;if(void 0===g&&c>h&&y<d)continue;if(void 0===w&&c>h&&y>d)continue}if("zero"!==n)if(void 0===b||void 0===m||void 0===g||void 0===w)if(void 0!==b||void 0===m||void 0===g||void 0===w)if(void 0===b||void 0!==m||void 0===g||void 0===w)if(void 0===b||void 0===m||void 0!==g||void 0===w)if(void 0===b||void 0===m||void 0===g||void 0!==w)if(void 0===b||void 0===w)if(void 0===m||void 0===g)void 0===b||void 0===g?void 0===m||void 0===w?(void 0!==b&&void 0!==m&&(u[c][y]=m*p+b*(1-p)),void 0===g||void 0===w?void 0===b?void 0===m?void 0===g?void 0!==w&&(u[c][y]=w):u[c][y]=g:u[c][y]=m:u[c][y]=b:u[c][y]=w*p+g*(1-p)):u[c][y]=w*f+m*(1-f):u[c][y]=g*f+b*(1-f);else{var S=(1-p+f)*Math.SQRT1_2;u[c][y]=m*(1-S)+g*S}else{var x=(p+f)*Math.SQRT1_2;u[c][y]=b*(1-x)+w*x}else{var _=m+g;u[c][y]=zc(b,m,g,_/2,p,f)}else{var O=b+w;u[c][y]=zc(b,m,O/2,w,p,f)}else{var j=b+w;u[c][y]=zc(b,j/2,g,w,p,f)}else{var P=m+g;u[c][y]=zc(P/2,m,g,w,p,f)}else u[c][y]=zc(b,m,g,w,p,f);else u[c][y]=zc(b||0,m||0,g||0,w||0,p,f)}return u}(i,c,this.nodataHandling),t=[];for(var s=(n-l)/2,f=0;f<i.length;f++)for(var h=i[f],y=u-f*l+s,v=0;v<h.length;v++){var p=h[v];if(p){var d={x:a+v*l+s,y};d[this.interpolatedProperty]=p,t.push(d)}}this.drawStyles(t,e,l)}}},{key:"drawStyles",value:function(t,e,n){var r,o=e.view.z,a=e.offscreenCtx,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Pc(t,e);var n={}.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)?Pc(t,e):void 0}}(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}}}}(this.styles);try{for(u.s();!(r=u.n()).done;){var l=r.value;i(l,o)&&((l.alpha||l.blendOperation)&&(a.save(),l.alpha&&(a.globalAlpha=l.alpha(o)),l.blendOperation&&(a.globalCompositeOperation=l.blendOperation(o))),e.setCanvasTransform(),l.draw(t,e,n),l.filterColor&&l.drawFilter(e),(l.alpha||l.blendOperation)&&a.restore())}}catch(t){u.e(t)}finally{u.f()}}}],r&&Cc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr),zc=function(t,e,n,r,o,i){var a=t+(e-t)*o;return a+(n+(r-n)*o-a)*i};function Rc(t){return Rc="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},Rc(t)}function Fc(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,Ic(r.key),r)}}function Ic(t){var e=function(t){if("object"!=Rc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rc(e)?e:e+""}function Bc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bc=function(){return!!t})()}function Lc(t){return Lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lc(t)}function Nc(t,e){return Nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nc(t,e)}var Dc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Lc(e),function(t,e){if(e&&("object"==Rc(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)}(t,Bc()?Reflect.construct(e,n||[],Lc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.value=t.value,n.maxSteps=t.maxSteps||function(t){return 6*t*t},n.seed=t.seed||0,n}return 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&&Nc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=this.targetResolution(n,o),a=Math.max(1,Math.round(n/i));i=n/a;for(var u=gi(t,n,function(t){return r.value(t)}),l=u.x0,c=u.y0,s=[],f=new Map,h=u.length,y=h?u[0].length:0,v=new Int32Array(h*y).fill(-1),p=0;p<h;p++)for(var d=0;d<y;d++){var b=u[p][d];if(null!=b){var m=f.get(b);void 0===m&&(m=s.length,s.push(b),f.set(b,m)),v[p*y+d]=m}}for(var g=-Math.round(c/i)-a,w=Math.round(l/i),S=function(t,e,n,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=void 0===o.maxSteps?6*r*r:o.maxSteps,a=0|(o.seed||0),u=o.offsetI||0,l=o.offsetJ||0,c=e*r,s=n*r,f=new Int32Array(c*s).fill(-1),h=Math.floor(r/2),y=0;y<c;y++)for(var v=Math.floor(y/r),p=0;p<s;p++){var d=t[v*n+Math.floor(p/r)];if(!(d<0)){for(var b=Gc(y+u,p+l,a),m=y,g=p,w=-1,S=0;;S++){if(m%r===h&&g%r===h){var x=t[Math.floor(m/r)*n+Math.floor(g/r)];if(x>=0){w=x;break}}if(S>=i)break;b^=b<<13,b^=b>>>17;var _=(b^=b<<5)>>>0&3;if(0===_?m--:1===_?m++:2===_?g--:g++,m<0||m>=c||g<0||g>=s)break}f[y*s+p]=w>=0?w:d}}return f}(v,h,y,a,{maxSteps:this.maxSteps(a),seed:this.seed,offsetI:g,offsetJ:w}),x=[],_=y*a,O=i,j=0;j<h*a;j++)for(var P=c+n-(j+1)*O,C=0;C<_;C++){var k=S[j*_+C];if(!(k<0)){var T={x:l+C*O,y:P};T[this.interpolatedProperty]=s[k],x.push(T)}}this.drawStyles(x,e,i)}}}],r&&Fc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Mc);function Gc(t,e,n){var r=Math.imul(0|t,73856093)^Math.imul(0|e,19349663)^Math.imul(n,83492791)|0;return r=Math.imul(r^r>>>16,2246822507),r=Math.imul(r^r>>>13,3266489909),0==(r^=r>>>16)?1:r}function Uc(t){return Uc="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},Uc(t)}function Wc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Hc(t,e);var n={}.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)?Hc(t,e):void 0}}(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 Hc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yc(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,$c(r.key),r)}}function $c(t){var e=function(t){if("object"!=Uc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Uc(e)?e:e+""}function Vc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vc=function(){return!!t})()}function qc(t){return qc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qc(t)}function Xc(t,e){return Xc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xc(t,e)}var Zc=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=function(t,e,n){return e=qc(e),function(t,e){if(e&&("object"==Uc(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)}(t,Vc()?Reflect.construct(e,n||[],qc(t).constructor):e.apply(t,n))}(this,e,[o]),o=o||{},r.dataset=t,r.styles=n,r.minPixelsPerCell=o.minPixelsPerCell||3,r.cellInfoHTML=o.cellInfoHTML||e.defaultCellInfoHTML,r}return 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&&Xc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n){var r=t.view.z,o=t.offscreenCtx,a=this.getDataset(r);if(a){if(a.getData(t.extGeo),a.updateViewCache(t.extGeo),(this.alpha||this.blendOperation)&&(o.save(),this.alpha&&(o.globalAlpha=this.alpha(r)),this.blendOperation&&(o.globalCompositeOperation=this.blendOperation(r))),n){var u,l=Wc(this.styles);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.setLegendContainer(n.node(),c.legends,c.styles)}}catch(t){l.e(t)}finally{l.f()}}var s,f=Wc(this.styles);try{for(f.s();!(s=f.n()).done;){var h=s.value;i(h,r)&&((h.alpha||h.blendOperation)&&(o.save(),h.alpha&&(o.globalAlpha=h.alpha(r)),h.blendOperation&&(o.globalCompositeOperation=h.blendOperation(r))),t.setCanvasTransform(),h.draw(a.getViewCache(),t,a.getResolution()),h.filterColor&&h.drawFilter(t),(h.alpha||h.blendOperation)&&o.restore())}}catch(t){f.e(t)}finally{f.f()}if((this.alpha||this.blendOperation)&&o.restore(),n){var y,v=Wc(this.styles);try{for(v.s();!(y=v.n()).done;){var p=y.value;if(i(p,r)&&(e.addLegends(n,p.legends,p,t,this.styles),p.styles)){var d,b=Wc(p.styles);try{for(b.s();!(d=b.n()).done;){var m=d.value;i(m,r)&&e.addLegends(n,m.legends,m,t)}}catch(t){b.e(t)}finally{b.f()}}}}catch(t){v.e(t)}finally{v.f()}}}}},{key:"getDataset",value:function(t){return this.dataset.getDataset(t,this.minPixelsPerCell)}},{key:"styles_",value:function(t){return 0===arguments.length?this.styles:(1===arguments.length?Array.isArray(t)?this.styles=t:this.styles=[t]:this.styles=arguments,this)}}],o=[{key:"setLegendContainer",value:function(t,n,r){var o=function(e){Array.isArray(e)?e.forEach(o):e&&(e.container=t)};o(n);var i,a=Wc(r||[]);try{for(a.s();!(i=a.n()).done;){var u=i.value;e.setLegendContainer(t,u.legends,void 0)}}catch(t){a.e(t)}finally{a.f()}}},{key:"addLegends",value:function(t,e,n,r,o){if(Array.isArray(e)){var i,a=Wc(e);try{for(a.s();!(i=a.n()).done;){var u=i.value;this.addLegends(t,u,n,r,o)}}catch(t){a.e(t)}finally{a.f()}}else{e.style_=n,e.layerStyles=o,e.redraw=function(){return r.redraw?r.redraw():void 0};var l=t.node(),c=e.div.node(),s=l._gridvizLegendCursor;s?c.previousSibling!==s&&s.after(c):l.firstChild!==c&&l.prepend(c),l._gridvizLegendCursor=c}}},{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("")}}],r&&Yc(n.prototype,r),o&&Yc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(zr);function Kc(t){return Kc="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},Kc(t)}function Jc(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,Qc(r.key),r)}}function Qc(t){var e=function(t){if("object"!=Kc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Kc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kc(e)?e:e+""}function ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ts=function(){return!!t})()}function es(t){return es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},es(t)}function ns(t,e){return ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ns(t,e)}var rs=function(t){function e(t){var n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=es(e),function(t,e){if(e&&("object"==Kc(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)}(t,ts()?Reflect.construct(e,n||[],es(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.cache={},n.url=t.url,n.urlFun=t.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},n.resolutions=t.resolutions,!n.resolutions||0==n.resolutions.length)throw new Error("No resolutions provided for background layer");return n.nbPix=t.nbPix||256,n.origin=t.origin||[0,0],n.z0=t.z0||0,n.pixelationCoefficient=t.pixelationCoefficient||1,n}return 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&&ns(t,e)}(e,t),n=e,(r=[{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.view.z,r=this.origin[0],o=this.origin[1],i=0;for(i=0;i<this.resolutions.length&&!(this.resolutions[i]<n*this.pixelationCoefficient);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)},s=function(t){return Math.ceil(-(t-o)/u)},f=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),y=s(t.extGeo.yMin),v=s(t.extGeo.yMax)-1,p=function(n){for(var a=function(a){var c=e.get(i,n,a);if(!c){var s=new Image;return e.put(s,i,n,a),s.onload=function(){t.redraw()},s.onerror=function(){e.put("failed",i,n,a)},s.src=e.urlFun(n,a,i),0}if("failed"===c)return 0;if(!(c instanceof HTMLImageElement))return console.log(c),0;if(0==c.width||0==c.height)return 0;var f=r+n*u,h=o-a*u;try{t.initCanvasTransform(),t.offscreenCtx.drawImage(c,t.geoToPixX(f),t.geoToPixY(h),l,l)}catch(t){console.error(t)}},c=v;c<y;c++)a(c)},d=f;d<h;d++)p(d)}else console.error("No resolutions provided for background layer")}}])&&Jc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(zr);function os(t){return os="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},os(t)}function is(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,as(r.key),r)}}function as(t){var e=function(t){if("object"!=os(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=os(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==os(e)?e:e+""}function us(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(us=function(){return!!t})()}function ls(t){return ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ls(t)}function cs(t,e){return cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cs(t,e)}var ss=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ls(e),function(t,e){if(e&&("object"==os(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)}(t,us()?Reflect.construct(e,n||[],ls(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.img=void 0,n.xMin=void 0,n.xMax=void 0,n.yMin=void 0,n.yMax=void 0,n}return 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&&cs(t,e)}(e,t),n=e,(r=[{key:"hasMoved",value:function(t){return t.xMin!=this.xMin||t.xMax!=this.xMax||t.yMin!=this.yMin||t.yMax!=this.yMax}},{key:"draw",value:function(t){if(t.updateExtentGeo(0),!this.hasMoved(t.extGeo)&&this.img)t.initCanvasTransform(),t.offscreenCtx.drawImage(this.img,0,0,t.w,t.h);else{this.xMin=t.extGeo.xMin,this.xMax=t.extGeo.xMax,this.yMin=t.extGeo.yMin,this.yMax=t.extGeo.yMax;var e=[];e.push(this.url),e.push("&width="),e.push(t.w),e.push("&height="),e.push(t.h),e.push("&bbox="),e.push(t.extGeo.xMin),e.push(","),e.push(t.extGeo.yMin),e.push(","),e.push(t.extGeo.xMax),e.push(","),e.push(t.extGeo.yMax);var n=e.join("");this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve WMS background image from",n)}),this.img.src=n}}}])&&is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(zr);function fs(t){return fs="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},fs(t)}function hs(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,ys(r.key),r)}}function ys(t){var e=function(t){if("object"!=fs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fs(e)?e:e+""}function vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vs=function(){return!!t})()}function ps(t){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(t)}function ds(t,e){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ds(t,e)}var bs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ps(e),function(t,e){if(e&&("object"==fs(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)}(t,vs()?Reflect.construct(e,n||[],ps(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.xMin=t.xMin||0,n.yMax=t.yMax||0,n.width=t.width||2e4,n.height=t.height||2e4,n.img=void 0,n}return 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&&ds(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){var e=this;if(this.img){var n=t.geoToPixX(this.xMin),r=t.geoToPixY(this.yMax),o=t.getView().z;t.initCanvasTransform(),t.offscreenCtx.drawImage(this.img,n,r,this.width/o,this.height/o)}else this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve background image from",e.url)}),this.img.src=this.url}}])&&hs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(zr);function ms(t){return ms="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},ms(t)}function gs(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return ws(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ws(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,ws(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,ws(f,"constructor",c),ws(c,"constructor",l),l.displayName="GeneratorFunction",ws(c,o,"GeneratorFunction"),ws(f),ws(f,o,"Generator"),ws(f,r,function(){return this}),ws(f,"toString",function(){return"[object Generator]"}),(gs=function(){return{w:i,m:h}})()}function ws(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ws=function(t,e,n,r){function i(e,n){ws(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ws(t,e,n,r)}function Ss(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function xs(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return _s(t,e);var n={}.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)?_s(t,e):void 0}}(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 _s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Os(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,js(r.key),r)}}function js(t){var e=function(t){if("object"!=ms(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ms(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ms(e)?e:e+""}function Ps(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ps=function(){return!!t})()}function Cs(t){return Cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cs(t)}function ks(t,e){return ks=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ks(t,e)}var Ts=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Cs(e),function(t,e){if(e&&("object"==ms(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)}(t,Ps()?Reflect.construct(e,n||[],Cs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.style=t.style||function(){return"1.2em Arial"},n.color=t.color||(t.dark?function(){return"white"}:function(){return"black"}),n.haloColor=t.haloColor||(t.dark?function(){return"black"}:function(){return"white"}),n.haloWidth=t.haloWidth||function(){return 2.5},n.textAlign=t.textAlign||"start",n.offsetPix=t.offsetPix||[5,5],n.preprocess=t.preprocess,n.labels=void 0,n.loadingStatus="notLoaded",n}return 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&&ks(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.labels){var e,n=t.view.z,r=t.offscreenCtx;r.textAlign=this.textAlign||"start",r.lineJoin="bevel",r.lineCap="butt",t.initCanvasTransform();var o,i=xs(this.labels);try{for(i.s();!(o=i.n()).done;){var a=o.value;if(t.toDraw(a)){var u=this.style(a,n);if(u){u!==e&&(r.font=e=u);var l=t.geoToPixX(a.x)+this.offsetPix[0],c=t.geoToPixY(a.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var s=this.haloColor(a,n),f=this.haloWidth(a,n);s&&f&&f>0&&(r.strokeStyle=s,r.lineWidth=f,r.strokeText(a.name,l,c))}if(this.color){var h=this.color(a,n);h&&(r.fillStyle=h,r.fillText(a.name,l,c))}}}}}catch(t){i.e(t)}finally{i.f()}}else this.load(t.redraw)}},{key:"load",value:(o=gs().m(function t(e){var n,r,o,i,a;return gs().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.url){t.n=1;break}return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.a(2);case 1:if("notLoaded"==this.loadingStatus){t.n=2;break}return t.a(2);case 2:return this.loadingStatus="loading",t.p=3,t.n=4,so(this.url);case 4:if(n=t.v,!this.preprocess){t.n=13;break}this.labels=[],r=xs(n),t.p=5,r.s();case 6:if((o=r.n()).done){t.n=9;break}if(i=o.value,0!=this.preprocess(i)){t.n=7;break}return t.a(3,8);case 7:this.labels.push(i);case 8:t.n=6;break;case 9:t.n=11;break;case 10:t.p=10,a=t.v,r.e(a);case 11:return t.p=11,r.f(),t.f(11);case 12:t.n=14;break;case 13:this.labels=n;case 14:this.loadingStatus="loaded",e&&e(),t.n=16;break;case 15:t.p=15,t.v,console.log("Failed loading labels from "+this.url),this.labels=[],this.loadingStatus="failed";case 16:return t.a(2)}},t,this,[[5,10,11,12],[3,15]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){Ss(i,n,r,a,u,"next",t)}function u(t){Ss(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&Os(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(zr);function As(t){return As="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},As(t)}function Es(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Ms(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ms(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Ms(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Ms(f,"constructor",c),Ms(c,"constructor",l),l.displayName="GeneratorFunction",Ms(c,o,"GeneratorFunction"),Ms(f),Ms(f,o,"Generator"),Ms(f,r,function(){return this}),Ms(f,"toString",function(){return"[object Generator]"}),(Es=function(){return{w:i,m:h}})()}function Ms(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ms=function(t,e,n,r){function i(e,n){Ms(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Ms(t,e,n,r)}function zs(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Rs(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Fs(t,e);var n={}.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)?Fs(t,e):void 0}}(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 Fs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Is(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,Bs(r.key),r)}}function Bs(t){var e=function(t){if("object"!=As(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=As(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==As(e)?e:e+""}function Ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ls=function(){return!!t})()}function Ns(t){return Ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ns(t)}function Ds(t,e){return Ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ds(t,e)}var Gs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ns(e),function(t,e){if(e&&("object"==As(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)}(t,Ls()?Reflect.construct(e,n||[],Ns(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.preprocess=t.preprocess,n.shape=t.shape||function(t,e){return"circle"},n.size=t.size||function(t,e){return 10},n.strokeStyle=t.strokeStyle||t.color||function(t,e){return"gray"},n.lineWidth=t.lineWidth||t.width||function(t,e){return 2},n.lineDash=t.lineDash||function(t,e){},n.fillStyle=t.fillStyle||function(t,e){return"black"},n.fs=void 0,n.loadingStatus="notLoaded",n}return 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&&Ds(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.fs){var e,n=t.view.z,r=t.offscreenCtx,o=Rs(this.fs);try{for(o.s();!(e=o.n()).done;){var i=e.value;this.drawGeometry(i,i.geometry,i.geometry.type,n,r)}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"drawGeometry",value:function(t,e,n,r,o){if("Point"==n||"MultiPoint"==n){var i=this.shape(t,r);if(!i||"none"==i)return;var a=this.size(t,r)*r;if(!a)return;var u=this.strokeStyle(t,r),l=this.fillStyle(t,r),c=this.lineWidth(t,r)*r;o.save(),u&&(o.strokeStyle=u),l&&(o.fillStyle=l),c&&(o.lineWidth=c);var s=e.coordinates;if("Point"==n&&(s=[s]),"circle"==i){var f,h=Rs(s);try{for(h.s();!(f=h.n()).done;){var y=f.value;o.beginPath(),o.arc(y[0],y[1],a/2,0,2*Math.PI,!1),l&&o.fill(),u&&c&&o.stroke()}}catch(t){h.e(t)}finally{h.f()}}else if("square"==i){var v,p=Rs(s);try{for(p.s();!(v=p.n()).done;){var d=v.value;o.beginPath(),o.rect(d[0]-a/2,d[1]-a/2,a,a),l&&o.fill(),u&&c&&o.stroke()}}catch(t){p.e(t)}finally{p.f()}}else console.error("Unexpected shape for point GeoJSON: "+i);o.restore()}else if("LineString"==n||"MultiLineString"==n){var b=this.strokeStyle(t,r);if(!b||"none"===b)return;var m=this.lineWidth(t,r);if(!m||m<0)return;o.save(),o.strokeStyle=b,o.lineWidth=m*r,o.setLineDash(this.lineDash(t,r)||[]);var g,w=Rs("LineString"===n?[e.coordinates]:e.coordinates);try{for(w.s();!(g=w.n()).done;){var S=g.value;if(!(S.length<2)){o.beginPath(),o.moveTo(S[0][0],S[0][1]);for(var x=1;x<S.length;x++)o.lineTo(S[x][0],S[x][1]);o.stroke()}}}catch(t){w.e(t)}finally{w.f()}o.restore()}else if("Polygon"==n||"MultiPolygon"==n){o.save();var _="Polygon"===n?[e.coordinates]:e.coordinates;o.beginPath();var O,j=Rs(_);try{for(j.s();!(O=j.n()).done;){var P,C=Rs(O.value);try{for(C.s();!(P=C.n()).done;){var k=P.value;if(!(k.length<2)){o.moveTo(k[0][0],k[0][1]);for(var T=1;T<k.length;T++)o.lineTo(k[T][0],k[T][1]);o.closePath()}}}catch(t){C.e(t)}finally{C.f()}}}catch(t){j.e(t)}finally{j.f()}var A=this.fillStyle(t,r);A&&"none"!==A&&(o.fillStyle=A,o.fill("evenodd"));var E=this.lineWidth(t,r);if(E&&E>0){var M,z,R,F=null!==(M=null===(z=this.strokeStyle)||void 0===z?void 0:z.call(this,t,r))&&void 0!==M?M:A;F&&"none"!==F&&(o.strokeStyle=F,o.lineWidth=E*r,o.setLineDash((null===(R=this.lineDash)||void 0===R?void 0:R.call(this,t,r))||[]),o.stroke())}o.restore()}else if("GeometryCollection"==n){var I,B=Rs(e.geometries);try{for(B.s();!(I=B.n()).done;){var L=I.value;this.drawGeometry(t,L,L.type,r,o)}}catch(t){B.e(t)}finally{B.f()}}else console.log("Unexpected geometry type in GeoJSONLayer: "+n)}},{key:"load",value:(o=Es().m(function t(e){var n,r,o,i,a,u;return Es().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.url){t.n=1;break}return console.log("Failed loading GeoJSON data: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.a(2);case 1:if("notLoaded"==this.loadingStatus){t.n=2;break}return t.a(2);case 2:return this.loadingStatus="loading",t.p=3,t.n=4,Xr(this.url);case 4:if(n=t.v,r=n.features,!this.preprocess){t.n=13;break}this.fs=[],o=Rs(r),t.p=5,o.s();case 6:if((i=o.n()).done){t.n=9;break}if(a=i.value,0!=this.preprocess(a)){t.n=7;break}return t.a(3,8);case 7:this.fs.push(a);case 8:t.n=6;break;case 9:t.n=11;break;case 10:t.p=10,u=t.v,o.e(u);case 11:return t.p=11,o.f(),t.f(11);case 12:t.n=14;break;case 13:this.fs=r;case 14:this.loadingStatus="loaded",e&&e(),t.n=16;break;case 15:t.p=15,t.v,console.log("Failed loading GeoJSON from "+this.url),this.fs=[],this.loadingStatus="failed";case 16:return t.a(2)}},t,this,[[5,10,11,12],[3,15]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){zs(i,n,r,a,u,"next",t)}function u(t){zs(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&Is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(zr);function Us(t){return Us="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},Us(t)}function Ws(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Hs(t,e);var n={}.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)?Hs(t,e):void 0}}(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 Hs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ys(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,$s(r.key),r)}}function $s(t){var e=function(t){if("object"!=Us(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Us(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Us(e)?e:e+""}var Vs=function(){return t=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.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 Neue', Arial, Helvetica, sans-serif",this.id&&(this.div=gt("#"+this.id)),this.div&&!this.div.empty()||(this.div=gt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this._set={padding:void 0!==e.padding,fontFamily:void 0!==e["font-family"],titleFontSize:void 0!==e.titleFontSize,titleFontWeight:void 0!==e.titleFontWeight,labelFontSize:void 0!==e.labelFontSize},this.div.classed("gridviz-legend",!0),e.className){var n,r=Ws(String(e.className).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}this.div.style("background",this.background),this.div.style("padding",this._css("padding",this.padding,this._set.padding)),this.div.style("border",this.border),this.div.style("border-radius",this["border-radius"]),this.div.style("box-shadow",this["box-shadow"]),this.div.style("font-family",this._css("font-family",this["font-family"],this._set.fontFamily)),this.title=e.title,this.titleFontSize=e.titleFontSize||"15px",this.titleFontWeight=e.titleFontWeight||"500",this.labelFontSize=e.labelFontSize||"14px",this.labelUnitText=e.labelUnitText||"",this.labelFormat=e.labelFormat,this.labelsAsHTML=!0===e.labelsAsHTML,this.interactive=!1!==e.interactive,this.style_=void 0,this.layerStyles=void 0,this.redraw=void 0,this.container=void 0,this.fill="fill"===e.width},e=[{key:"highlight",value:function(t){var e=this.highlightedStyles();if(this.interactive&&e.length){var n=e.some(function(t){return null!==t.highlightColors});this.div&&this.div.attr("data-gridviz-hovered",t&&t.length?"":null);var r,o=Ws(e);try{for(o.s();!(r=o.n()).done;)r.value.setHighlight(t)}catch(t){o.e(t)}finally{o.f()}!n&&e.every(function(t){return null===t.highlightColors})||this.redraw&&this.redraw()}}},{key:"highlightedStyles",value:function(){return this.style_?[this.style_]:[]}},{key:"bindHover",value:function(t,e,n){var r=this;this.interactive&&t.style("cursor","pointer").on("mouseenter",function(){n&&n.enter&&n.enter(),r.highlight([e])}).on("mouseleave",function(){n&&n.leave&&n.leave(),r.highlight(null)})}},{key:"_css",value:function(t,e,n){return n?e:"var(--gridviz-legend-".concat(t,", ").concat(e,")")}},{key:"labelFontSizeCSS",value:function(){return this._css("label-font-size",this.labelFontSize,this._set.labelFontSize)}},{key:"labelColorCSS",value:function(){return"var(--gridviz-legend-label-color, #333)"}},{key:"setType",value:function(t){this.div.classed("gridviz-legend--"+t,!0)}},{key:"availableWidth",value:function(t){if(!this.fill)return this.width;var e=this.container,n=e&&e.clientWidth;if(!n)return t;var r=parseFloat(this.padding)||0;return Math.max(60,Math.floor(n-2*r))}},{key:"setText",value:function(t,e){return this.labelsAsHTML?t.html(e):t.text(e)}},{key:"makeTitle",value:function(){this.title&&this.setText(this.div.append("div").classed("gridviz-legend-title",!0).style("font-size",this._css("title-font-size",this.titleFontSize,this._set.titleFontSize)).style("font-weight",this._css("title-font-weight",this.titleFontWeight,this._set.titleFontWeight)).style("margin-bottom","7px"),this.title)}},{key:"style",value:function(t,e){return 1==arguments.length?this.div.style(t):(this.div.style(t,e),this)}},{key:"update",value:function(){console.error("Legend update not implemented yet.")}}],e&&Ys(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function qs(t){return qs="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},qs(t)}function Xs(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,Zs(r.key),r)}}function Zs(t){var e=function(t){if("object"!=qs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qs(e)?e:e+""}function Ks(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ks=function(){return!!t})()}function Js(t){return Js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Js(t)}function Qs(t,e){return Qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qs(t,e)}var tf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Js(e),function(t,e){if(e&&("object"==qs(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)}(t,Ks()?Reflect.construct(e,n||[],Js(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorScale=t.colorScale,n.textScale=t.textScale||function(t){return t},n.margin=t.margin||5,n.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.tickSize=t.tickSize||6,n.ticks=t.ticks||Math.max(2,Math.floor(n.width/50)),n._defaultTicks=t.ticks?void 0:n.ticks,n.tickFormat=t.tickFormat,n.tickUnit=t.tickUnit,n.fontSize=t.fontSize,n.invert=t.invert,n.setType("color"),n}return 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&&Qs(t,e)}(e,t),n=e,r=[{key:"tickCount",value:function(t){return void 0!==this._defaultTicks&&this.ticks===this._defaultTicks?Math.max(2,Math.floor(t/50)):Math.max(2,this.ticks)}},{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();for(var e=this.availableWidth(this.width),n=this.tickCount(e),r=e+2*this.margin,o=this.height+this.margin+this.tickSize+10,i=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",r).attr("height",o).append("g").classed("gridviz-legend-bar",!0).attr("transform","translate("+this.margin+" 0)"),a=e,u=this.height,l=0;l<a;l+=5){var c=l/(a-1);this.invert&&(c=1-c),i.append("rect").classed("gridviz-legend-swatch",!0).attr("x",l).attr("y",0).attr("width",5).attr("height",u).style("fill",this.colorScale(c,t.viewScale))}for(var s=0;s<n;s++){var f=s/(n-1);i.append("line").classed("gridviz-legend-tick",!0).attr("x1",a*f).attr("y1",0).attr("x2",a*f).attr("y2",u+this.tickSize).style("stroke","black"),i.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+s).attr("x",a*f).attr("y",u+this.tickSize+2).style("font-size",this.fontSize||this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("text-anchor",0==s?"start":s==n-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var h=this.tickFormat&&"text"!=this.tickFormat?this.tickFormat:function(t){return t},y=0;y<n;y++){var v=y/(n-1),p=this.textScale(v,t.viewScale),d=(p?h(p):"0")+(this.tickUnit?this.tickUnit:"");null!=d&&this.div.select("#ticklabel_"+y).text(d)}}}],r&&Xs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function ef(t){return ef="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},ef(t)}function nf(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,rf(r.key),r)}}function rf(t){var e=function(t){if("object"!=ef(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ef(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ef(e)?e:e+""}function of(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(of=function(){return!!t})()}function af(t){return af=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},af(t)}function uf(t,e){return uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uf(t,e)}var lf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=af(e),function(t,e){if(e&&("object"==ef(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)}(t,of()?Reflect.construct(e,n||[],af(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colors=t.colors,n.breaks=t.breaks,n.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.setType("discrete"),n.tickSize=t.tickSize||3,n.invert=t.invert,n}return 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&&uf(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.colors(t.viewScale),r=this.breaks(t.viewScale);if(r){var o=n.length;if(0!=o){for(var i=this.availableWidth(this.width),a=i/o,u=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",i).attr("height",this.height+this.tickSize+2+10),l=function(){var t=u.append("rect").classed("gridviz-legend-swatch",!0).attr("x",c*a).attr("y",0).attr("width",a).attr("height",e.height).style("fill",n[c]);e.bindHover(t,n[c],{enter:function(){return t.classed("gridviz-legend-swatch--active",!0).attr("stroke","red")},leave:function(){return t.classed("gridviz-legend-swatch--active",!1).attr("stroke",null)}})},c=0;c<o;c++)l();for(var s=1;s<o;s++)u.append("line").classed("gridviz-legend-tick",!0).attr("x1",a*s).attr("y1",0).attr("x2",a*s).attr("y2",this.height+this.tickSize).style("stroke","black");for(var f=1;f<o;f++){var h=r[f-1];isNaN(h)||null==h||(this.labelFormat&&(h=this.labelFormat(h,f)),u.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+f).attr("x",a*f).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("color",this.labelColorCSS()).style("text-anchor","middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(h))}}}}}])&&nf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function cf(t){return cf="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},cf(t)}function sf(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,ff(r.key),r)}}function ff(t){var e=function(t){if("object"!=cf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cf(e)?e:e+""}function hf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hf=function(){return!!t})()}function yf(t){return yf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yf(t)}function vf(t,e){return vf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vf(t,e)}var pf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=yf(e),function(t,e){if(e&&("object"==cf(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)}(t,hf()?Reflect.construct(e,n||[],yf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorLabel=t.colorLabel||[["gray","-"]],n.shape=t.shape||"circle",n.dimension=t.dimension||{r:8},n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n.setType("category"),n}return 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&&vf(t,e)}(e,t),n=e,(r=[{key:"update",value:function(){var t=this;this.div.selectAll("*").remove(),this.makeTitle();var e=this.colorLabel.length;if(0!=e)for(var n=function(){var e=t.colorLabel[r],n=t.div.append("div").classed("gridviz-legend-category",!0);t.bindHover(n,e[0],{enter:function(){return n.classed("gridviz-legend-category--active",!0).select("svg").select("rect, circle").style("stroke","red")},leave:function(){return n.classed("gridviz-legend-category--active",!1).select("svg").select("rect, circle").style("stroke",t.strokeColor)}});var o=t.strokeWidth;if("square"===t.shape){var i=t.dimension.h||15,a=t.dimension.w||20;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",a+2*o).attr("height",i+2*o).append("rect").classed("gridviz-legend-swatch",!0).attr("x",o).attr("y",o).attr("width",a).attr("height",i).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}else{if("circle"!==t.shape)throw new Error("Unexpected shape:"+t.shape);var u=t.dimension.r||8,l=2*u+2*o;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",l).attr("height",l).append("circle").classed("gridviz-legend-swatch",!0).attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}t.setText(n.append("div").style("display","inline").classed("gridviz-legend-label",!0).style("padding-left","5px").style("font-size",t.labelFontSizeCSS()).style("fill",t.labelColorCSS()).style("color",t.labelColorCSS()),e[1])},r=0;r<e;r++)n()}}])&&sf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function df(t){return df="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},df(t)}function bf(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return mf(t,e);var n={}.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)?mf(t,e):void 0}}(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 mf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gf(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,wf(r.key),r)}}function wf(t){var e=function(t){if("object"!=df(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=df(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==df(e)?e:e+""}function Sf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sf=function(){return!!t})()}function xf(t){return xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xf(t)}function _f(t,e){return _f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_f(t,e)}var Of=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=xf(e),function(t,e){if(e&&("object"==df(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)}(t,Sf()?Reflect.construct(e,n||[],xf(t).constructor):e.apply(t,n))}(this,e,[t])).setType("size"),t=t||{},n.label=t.label||void 0,n.size=t.size||void 0,n.viewScaleFun=t.viewScaleFun||function(t){return t},n.shape=t.shape||"circle",n.fillColor=t.fillColor||"none",n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n.color=t.color||"gray",n.length=t.length||function(t,e,n){return t},n}return 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&&_f(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n,r=this.label(t.viewScale,t.cells,t.resolution,t.z);if(n=this.size?this.size(t.viewScale,t.resolution,t.z)/t.z:this.viewScaleFun(t.viewScale)(+r)/t.z){this.labelFormat&&!isNaN(+r)&&(r=this.labelFormat(r));var o=this.div.append("div").classed("gridviz-legend-category",!0),i=function(){return o.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+e.strokeWidth+2).attr("height",n+e.strokeWidth+2).style("","inline-block")};if("square"===this.shape)i().append("rect").classed("gridviz-legend-symbol",!0).attr("x",0).attr("y",0).attr("width",n).attr("height",n).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(n+this.strokeWidth);i().append("circle").classed("gridviz-legend-symbol",!0).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);else if("diamond"===this.shape);else{if("line"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=this.length?this.length(t.resolution,t.z,t.viewScale):t.resolution;u/=t.z,o.append("svg").classed("gridviz-legend-graphic",!0).attr("width",u).attr("height",n).style("","inline-block").append("line").classed("gridviz-legend-symbol",!0).attr("x1",0).attr("y1",n/2).attr("x2",u).attr("y2",n/2).style("stroke",this.color).style("stroke-width",n)}o.append("div").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("color",this.labelColorCSS()).text(r+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&gf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function jf(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=[],i=bf(t);try{var a=function(){var i=n.value;r.title=i==t[0]?r.title:void 0,r.size=function(){return e(i)},r.label=function(){return i},o.push(new Of(r))};for(i.s();!(n=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Pf(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.k||[.9,.5,.2,.05],o=[],i=bf(r);try{var a=function(){var i=e.value;n.title=i==r[0]?n.title:void 0,n.label=function(e,n){return mi(i*Ha(n,t))},o.push(new Of(n))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Cf(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.labelFormat||function(t){return t},o=n.labelText||Tf(r),i=[],a=function(r){n.title=r==e.length-1?n.title:void 0,n.size=function(){return e[r]},n.label=function(){return o(t[r-1],t[r])},i.push(new Of(n))},u=e.length-1;u>=0;u--)a(u);return i}function kf(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.labelFormat||function(t){return t},r=e.labelText||Tf(n),o=[],i=e.viewScaleFun||function(t){return t},a=function(n){e.title=n==t-1?e.title:void 0,e.size=function(t){return i(t).values[n]},e.label=function(t){return r(i(t).breaks[n-1],i(t).breaks[n])},o.push(new Of(e))},u=t-1;u>=0;u--)a(u);return o}function Tf(t){return function(e,n){return null==e&&null==n?"":null==n?"> "+t(e):null==e?"< "+t(n):t(e)+" - "+t(n)}}function Af(t){return Af="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},Af(t)}function Ef(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,Mf(r.key),r)}}function Mf(t){var e=function(t){if("object"!=Af(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Af(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Af(e)?e:e+""}function zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zf=function(){return!!t})()}function Rf(t){return Rf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rf(t)}function Ff(t,e){return Ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ff(t,e)}var If=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Rf(e),function(t,e){if(e&&("object"==Af(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)}(t,zf()?Reflect.construct(e,n||[],Rf(t).constructor):e.apply(t,n))}(this,e,[t])).setType("orientation"),t=t||{},n.orientation=t.orientation||0,n.color=t.color||function(t,e,n){return"gray"},n.width=t.width||function(t,e,n){return 3*e},n.length=t.length||function(t,e,n){return t},n.label=t.label||"-",n}return 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&&Ff(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.div.append("div").classed("gridviz-legend-category",!0),n=this.color(t.resolution,t.z,t.viewScale),r=this.width(t.resolution,t.z,t.viewScale)/t.z,o=this.length(t.resolution,t.z,t.viewScale)/t.z,i=Math.max(o,r),a=e.append("svg").classed("gridviz-legend-graphic",!0).attr("width",i).attr("height",i).style("","inline-block"),u=Math.cos(-this.orientation*Math.PI/180),l=Math.sin(-this.orientation*Math.PI/180),c=.5*i,s=.5*o;a.append("line").classed("gridviz-legend-symbol",!0).attr("x1",c-u*s).attr("y1",c-l*s).attr("x2",c+u*s).attr("y2",c+l*s).style("stroke",n).style("stroke-width",r),e.append("div").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("color",this.labelColorCSS()).text(this.label+(this.labelUnitText?" ":"")+this.labelUnitText)}}],r&&Ef(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function Bf(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],o=0;o<t.length;o++)n.title=0==o?n.title:void 0,n.orientation=t[o],n.label=e[o],r.push(new If(n));return r}function Lf(t){return Lf="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},Lf(t)}function Nf(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,Df(r.key),r)}}function Df(t){var e=function(t){if("object"!=Lf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Lf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lf(e)?e:e+""}function Gf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gf=function(){return!!t})()}function Uf(t){return Uf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uf(t)}function Wf(t,e){return Wf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wf(t,e)}var Hf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Uf(e),function(t,e){if(e&&("object"==Lf(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)}(t,Gf()?Reflect.construct(e,n||[],Uf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.classifier=t.classifier,n.width=t.width||150,n.selectionColor=t.selectionColor||"red",n.tooltip=t.tooltip,n.texts=t.texts,n.leftText=t.leftText||"Category 0",n.topText=t.topText||"Category 1",n.rightText=t.rightText||"Category 2",n.centerCoefficient=t.centerCoefficient||n.classifier.centerCoefficient,n.setType("ternary"),n}return 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&&Wf(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.width,r=.866025*n,o=this.classifier,i=this.selectionColor,a=this.tooltip,u=this.texts||{},l=this,c=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+0).attr("height",r+8+28);c.append("text").attr("x",n/2).attr("y",16).classed("gridviz-legend-label",!0).text(this.topText).attr("font-size",14).style("fill",this.labelColorCSS()).attr("text-anchor","middle"),c.append("text").attr("x",0).attr("y",34+r).classed("gridviz-legend-label",!0).text(this.leftText).attr("font-size",14).style("fill",this.labelColorCSS()).attr("text-anchor","start"),c.append("text").attr("x",n).attr("y",34+r).classed("gridviz-legend-label",!0).text(this.rightText).attr("font-size",14).style("fill",this.labelColorCSS()).attr("text-anchor","end");var s=c.append("g").classed("gridviz-legend-triangle",!0).attr("transform","translate(0 18)"),f=function(t,n,r){t.attr("fill",n).classed("gridviz-legend-swatch",!0).style("cursor",e.interactive?"pointer":null).on("mouseover",function(t){gt(this).classed("gridviz-legend-swatch--active",!0).attr("fill",i),l.highlight([n]),a&&r&&(a.html(r),a.setPosition(t),a.show())}).on("mouseout",function(){gt(this).classed("gridviz-legend-swatch--active",!1).attr("fill",n),l.highlight(null),a&&a.hide()}),a&&r&&t.on("mousemove",function(t){a.setPosition(t)})};f(s.append("polygon").attr("points","0,"+r+" "+n/3+","+r+" "+n/2+","+2*r/3+" "+n/6+","+2*r/3),o.colors[0],u[0]),f(s.append("polygon").attr("points",n/2+",0 "+2*n/3+","+r/3+" "+n/2+","+2*r/3+" "+n/3+","+r/3),o.colors[1],u[1]),f(s.append("polygon").attr("points",n+","+r+" "+5*n/6+","+2*r/3+" "+n/2+","+2*r/3+" "+2*n/3+","+r),o.colors[2],u[2]),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+5*n/6+","+2*r/3+" "+2*n/3+","+r/3),o.mixColors[0],u.m12),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/3+","+r+" "+2*n/3+","+r),o.mixColors[1],u.m02),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/6+","+2*r/3+" "+n/3+","+r/3),o.mixColors[2],u.m01),this.centerCoefficient&&f(s.append("circle").attr("cx",n/2).attr("cy",2*r/3).attr("r",this.centerCoefficient*r/3),o.centerColor,u.center)}}],r&&Nf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function Yf(t){return Yf="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},Yf(t)}function $f(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,Vf(r.key),r)}}function Vf(t){var e=function(t){if("object"!=Yf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yf(e)?e:e+""}function qf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qf=function(){return!!t})()}function Xf(){return Xf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Zf(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Xf.apply(null,arguments)}function Zf(t){return Zf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zf(t)}function Kf(t,e){return Kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kf(t,e)}var Jf=function(t){function e(t){var n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Zf(e),function(t,e){if(e&&("object"==Yf(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)}(t,qf()?Reflect.construct(e,n||[],Zf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.items=(t.items||[]).slice(0,3),n.items.length<2)throw new Error("A Venn legend needs two or three items");return n.radius=t.radius||45,n.opacity=void 0===t.opacity?1:t.opacity,n.styles=t.styles,n._hovered=null,n.setType("venn"),n}return 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&&Kf(t,e)}(e,t),n=e,r=[{key:"highlightedStyles",value:function(){return this.styles?this.styles:this.layerStyles&&this.layerStyles.length?this.layerStyles:(t=e,n=this,"function"==typeof(r=Xf(Zf(1&3?t.prototype:t),"highlightedStyles",n))?function(t){return r.apply(n,t)}:r)([]);var t,n,r}},{key:"centers",value:function(){var t=2===this.items.length?1.1*this.radius:1.3*this.radius;return 2===this.items.length?[[-t/2,0],[t/2,0]]:[[-t/2,0],[t/2,0],[0,t*Math.sqrt(3)/2]]}},{key:"update",value:function(){var t=this;this.div.selectAll("*").remove(),this.makeTitle();var e=this.radius,n=this.centers(),r=this.items.length,o=(parseFloat(this.labelFontSize)||14)*(/px$/.test(this.labelFontSize)||!isNaN(+this.labelFontSize)?1:16),i=function(t){return t.length*o*.56},a=i(this.items[0].label)+7,u=i(this.items[1].label)+7,l=n[1][0]-n[0][0],c=n.map(function(t){return a+e+(t[0]-n[0][0])}),s=n.map(function(t){return e+t[1]}),f=Math.ceil(a+2*e+l+u),h=Math.ceil(2===r?2*e:n[2][1]+2*e+7+o),y=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",f).attr("height",h).attr("role","img").attr("aria-label",(this.title?this.title+": ":"")+this.items.map(function(t){return t.label}).join(", ")).style("overflow","visible").style("isolation","isolate"),v=this.items.map(function(n,r){return y.append("circle").classed("gridviz-legend-swatch",!0).attr("cx",c[r]).attr("cy",s[r]).attr("r",e).style("fill",n.color).style("fill-opacity",t.opacity).style("mix-blend-mode","multiply").style("transition","opacity 0.1s")}),p=this.items.map(function(n,r){var i=0===r?"end":1===r?"start":"middle",a=0===r?c[0]-e-7:1===r?c[1]+e+7:c[2],u=2===r?s[2]+e+o:s[r],l=y.append("text").classed("gridviz-legend-label",!0).attr("x",a).attr("y",u).attr("text-anchor",i).attr("dominant-baseline",2===r?"auto":"central").style("font-size",t.labelFontSizeCSS()).style("fill",t.labelColorCSS());return t.setText(l,n.label),l});if(this.interactive){var d=function(e){var n=e.join(",");n!==t._hovered&&(t._hovered=n||null,v.forEach(function(t,n){return t.classed("gridviz-legend-swatch--active",e.includes(n)).style("opacity",e.length&&!e.includes(n)?.25:1)}),t.highlight(e.length?e.map(function(e){return t.items[e].color}):null))};y.style("cursor","pointer").on("mousemove",function(t){for(var n=y.node().getBoundingClientRect(),o=t.clientX-n.left,i=t.clientY-n.top,a=[],u=0;u<r;u++)Math.hypot(o-c[u],i-s[u])<=e&&a.push(u);!a.length&&t.target.classList.contains("gridviz-legend-label")||d(a)}).on("mouseleave",function(){return d([])}),p.forEach(function(t,e){return t.style("cursor","pointer").on("mouseenter",function(){return d([e])})})}}}],r&&$f(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs),Qf=function(t){return t};Qf.invert=Qf;var th=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return Qf;var e=Math.exp(t)-1,n=function(n){return(Math.exp(n*t)-1)/e};return n.invert=function(n){return Math.log(e*n+1)/t},n},eh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return Qf;var e=Math.exp(t),n=1-e,r=function(r){return 1-Math.log(e+r*n)/t};return r.invert=function(r){return(Math.exp((1-r)*t)-e)/n},r},nh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return Qf;var e=function(e){return Math.pow(e,t)},n=1/t;return e.invert=function(t){return Math.pow(t,n)},e},rh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return Qf;var e=1/t,n=function(t){return 1-Math.pow(1-t,e)};return n.invert=function(e){return 1-Math.pow(1-e,t)},n},oh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return Qf;if(1==t)return function(t){return Math.sqrt(t*(2-t))};var e=t/(1-t);return function(t){return Math.sqrt(1/(e*e)+t*(2/e+2-t))-1/e}},ih=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return Qf;var e=oh(t);return function(t){return 1-e(1-t)}};const ah=Math.PI/180,uh=180/Math.PI,lh=.96422,ch=.82521,sh=4/29,fh=6/29,hh=3*fh*fh,yh=fh*fh*fh;function vh(t){if(t instanceof dh)return new dh(t.l,t.a,t.b,t.opacity);if(t instanceof Sh)return xh(t);t instanceof Ie||(t=Re(t));var e,n,r=wh(t.r),o=wh(t.g),i=wh(t.b),a=bh((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?e=n=a:(e=bh((.4360747*r+.3850649*o+.1430804*i)/lh),n=bh((.0139322*r+.0971045*o+.7141733*i)/ch)),new dh(116*a-16,500*(e-a),200*(a-n),t.opacity)}function ph(t,e,n,r){return 1===arguments.length?vh(t):new dh(t,e,n,null==r?1:r)}function dh(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function bh(t){return t>yh?Math.pow(t,1/3):t/hh+sh}function mh(t){return t>fh?t*t*t:hh*(t-sh)}function gh(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function wh(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Sh(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function xh(t){if(isNaN(t.h))return new dh(t.l,0,0,t.opacity);var e=t.h*ah;return new dh(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function _h(t,e){var n=Ze((t=ph(t)).l,(e=ph(e)).l),r=Ze(t.a,e.a),o=Ze(t.b,e.b),i=Ze(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=o(e),t.opacity=i(e),t+""}}function Oh(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){var r,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return jh(t,e);var n={}.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)?jh(t,e):void 0}}(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 jh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}ye(dh,ph,ve(pe,{brighter(t){return new dh(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new dh(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Ie(gh(3.1338561*(e=lh*mh(e))-1.6168667*(t=1*mh(t))-.4906146*(n=ch*mh(n))),gh(-.9787684*e+1.9161415*t+.033454*n),gh(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),ye(Sh,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Sh)return new Sh(t.h,t.c,t.l,t.opacity);if(t instanceof dh||(t=vh(t)),0===t.a&&0===t.b)return new Sh(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*uh;return new Sh(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Sh(t,e,n,null==r?1:r)},ve(pe,{brighter(t){return new Sh(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Sh(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return xh(this).rgb()}}));var Ph=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t[0],o=t[1],i=t[2],a=Oh(n.center||[1/3,1/3,1/3],3),u=a[0],l=a[1],c=a[2],s=null==n.withMixedClasses||n.withMixedClasses,f=n.centerCoefficient?1-n.centerCoefficient:void 0,h=function(t){var n=e(t);if(n){var a=+t[r]/n,h=+t[o]/n,y=+t[i]/n;return a>=u&&h<=l&&y<=c?null!=f&&(y-c)*(l-f*l)>=(h-f*l)*(f*c-c)?"center":"0":a<=u&&h>=l&&y<=c?null!=f&&(y-c)*(u-f*u)>=(a-f*u)*(f*c-c)?"center":"1":a<=u&&h<=l&&y>=c?null!=f&&(h-l)*(u-f*u)>=(a-f*u)*(f*l-l)?"center":"2":a<=u&&h>=l&&y>=c?null!=f&&a>f*u?"center":s?"m12":h>y?"1":"2":a>=u&&h<=l&&y>=c?null!=f&&h>f*l?"center":s?"m02":a>y?"0":"2":a>=u&&h>=l&&y<=c?null!=f&&y>f*c?"center":s?"m01":h>a?"1":"0":"unknown"}};return h.center=[u,l,c],h.centerCoefficient=n.centerCoefficient,h},Ch=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=Oh(n||["red","green","blue"],3),i=o[0],a=o[1],u=o[2],l=r.colorInterpolation||_h,c=null==r.withMixedClasses||r.withMixedClasses,s=function(t,e){return l(t,e)(.5)},f=Oh(r.mixedColors||c?[s(a,u),s(i,u),s(i,a)]:[],3),h=f[0],y=f[1],v=f[2],p=r.centerColor||l(s(i,a),u)(.333),d=Ph(t,e,r),b=function(t){var e=d(t);return"0"==e?i:"1"==e?a:"2"==e?u:"m12"==e?h:"m02"==e?y:"m01"==e?v:"center"==e?p:r.defaultColor||"black"};return b.center=d.center,b.centerCoefficient=r.centerCoefficient,b.colors=[i,a,u],b.mixColors=[h,y,v],b.centerColor=p,b.classifier=d,b};function kh(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 Th,Ah=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Eh(t){if(!(e=Ah.exec(t)))throw new Error("invalid format: "+t);var e;return new Mh({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 Mh(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 zh(t,e){var n=kh(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")}Eh.prototype=Mh.prototype,Mh.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 Rh={"%":(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)=>zh(100*t,e),r:zh,s:function(t,e){var n=kh(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Th=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")+kh(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Fh(t){return t}var Ih,Bh=Array.prototype.map,Lh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Nh(t){return Ih=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Fh:(e=Bh.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?Fh:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Bh.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Eh(t)).fill,n=t.align,f=t.sign,h=t.symbol,y=t.zero,v=t.width,p=t.comma,d=t.precision,b=t.trim,m=t.type;"n"===m?(p=!0,m="g"):Rh[m]||(void 0===d&&(d=12),b=!0,m="g"),(y||"0"===e&&"="===n)&&(y=!0,e="0",n="=");var g="$"===h?o:"#"===h&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===h?i:/[%p]/.test(m)?l:"",S=Rh[m],x=/[defgprs%]/.test(m);function _(t){var o,i,l,h=g,_=w;if("c"===m)_=S(t)+_,t="";else{var O=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:S(Math.abs(t),d),b&&(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&&"+"!==f&&(O=!1),h=(O?"("===f?f:c:"-"===f||"("===f?"":f)+h,_=("s"===m?Lh[8+Th/3]:"")+_+(O&&"("===f?")":""),x)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}}p&&!y&&(t=r(t,1/0));var j=h.length+t.length+_.length,P=j<v?new Array(v-j+1).join(e):"";switch(p&&y&&(t=r(P+t,P.length?v-_.length:1/0),P=""),n){case"<":t=h+t+_+P;break;case"=":t=h+P+t+_;break;case"^":t=P.slice(0,j=P.length>>1)+h+t+_+P.slice(j);break;default:t=P+h+t+_}return u(t)}return d=void 0===d?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),_.toString=function(){return t+""},_}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=Eh(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=kh(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-o),a=Lh[8+o/3];return function(t){return r(i*t)+a}}}}(t),Ih.format,Ih.formatPrefix,Ih}Nh({thousands:",",grouping:[3],currency:["$",""]});var Dh=Dn.getParameterByName;return Nh({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})());
|