@nebula.js/sn-gauge 0.7.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.
@@ -0,0 +1,11 @@
1
+ /*
2
+ * @nebula.js/sn-gauge v0.7.0
3
+ * Copyright (c) 2025 QlikTech International AB
4
+ * Released under the MIT license.
5
+ */
6
+
7
+ import{useElement as t,useOptions as e,useState as n,useEffect as i,useStaleLayout as r,useTheme as o,useApp as a,useModel as s,useRect as l,useTranslator as c,useAppLayout as u,usePromise as h,onTakeSnapshot as d}from"@nebula.js/stardust";function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function p(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function m(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach((function(e){p(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function y(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 i,r,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(t,e)||b(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 x(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||b(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.")}()}function v(t){return v="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},v(t)}function b(t,e){if(t){if("string"==typeof t)return f(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)?f(t,e):void 0}}var w=["American Typewriter, serif","Andalé Mono, monospace","Arial Black, sans-serif","Arial, sans-serif","Bradley Hand, cursive","Brush Script MT, cursive","Comic Sans MS, cursive","Courier, monospace","Didot, serif","Georgia, serif","Impact, sans-serif","Lucida Console, monospace","Luminari, fantasy","Monaco, monospace","QlikView Sans, sans-serif","Source Sans Pro, sans-serif","Tahoma, sans-serif","Times New Roman, serif","Trebuchet MS, sans-serif","Verdana, sans-serif"],M=["Abril Fatface, serif","Bangers, fantasy","Bebas Neue, sans serif","EB Garamond, serif","Fredoka One, fantasy","Graduate, fantasy","Gravitas One, serif","Indie Flower, fantasy","Inter, sans-serif","Lobster, fantasy","Montserrat, sans-serif","Nixie One, sans-serif","Noto Sans, sans-serif","Open Sans, sans-serif","PT Serif, serif","Pacifico, cursive","Permanent Marker, fantasy","QlikView Sans, sans-serif","Raleway, sans-serif","Rammetto One, fantasy","Roboto, sans-serif","Source Sans Pro, sans-serif","Titan One, fantasy","Yanone Kaffeesatz, sans-serif"];var k=function(t){return{value:t,label:t.charAt(0).toUpperCase()+t.slice(1),groupHeader:!1,disabled:!1,styles:{fontFamily:t}}};function _(t){var e=t.theme,n=t.translator,i=t.defaultValue,r=t.flags,o=[],a=e.getStyle("","","fontFamilies");return Array.isArray(a)&&a.length?o.push.apply(o,x(new Set([i].concat(x(a.map((function(t){return t.split(",").map((function(t){return t.trim()})).map((function(t){return t.replace(/\s+/g," ").trim()})).filter(Boolean).join(", ")}))))))):o.push(i),[{value:"ThemeHeader",label:n.get("properties.themeFonts"),metaText:n.get("properties.theme"),groupHeader:!0}].concat(x(o.map((function(t){return k(t)}))),[{value:"DefaultHeader",label:n.get("properties.allFonts"),metaText:n.get("properties.default"),groupHeader:!0}],x(function(t){return null!=t&&t.isEnabled("PS_20852_WYSIWYG_FONT_SUPPORT")?M:w}(r).map((function(t){return k(t)}))))}function S(t){var e=t.theme,n=t.translator,i=t.id,r=t.path,o=t.flags,a=function(){return e.getStyle(i,r,"fontFamily")};return{getDefaultValue:function(){return a()},getOptions:function(){return _({theme:e,translator:n,defaultValue:a(),flags:o})}}}var N,R,A=["10px","11px","12px","13px","14px","15px","16px","17px","18px","19px","20px","21px","22px","23px","24px"],C=function(t){return{value:t,label:t,groupHeader:!1,disabled:!1}};function D(t){var e=t.theme,n=t.translator,i=t.id,r=t.path,o=function(){return e.getStyle(i,r,"fontSize")};return{getDefaultValue:function(){return o()},getOptions:function(){return function(t){var e=t.translator,n=t.defaultValue,i=[],r=t.theme.getStyle("","","fontSizes");return Array.isArray(r)&&r.length?i.push.apply(i,x(new Set([n].concat(x(r))))):i.push(n),[{value:"ThemeHeader",label:e.get("properties.themeFontSizes"),metaText:e.get("properties.theme"),groupHeader:!0}].concat(x(i.map((function(t){return C(t)}))),[{value:"DefaultHeader",label:e.get("properties.allFontSizes"),metaText:e.get("properties.default"),groupHeader:!0}],x(A.map((function(t){return C(t)}))))}({theme:e,translator:n,defaultValue:o()})}}}function O(t){var e=t.theme,n=t.translator,i=t.id,r=t.path;return{fontFamily:S({theme:e,translator:n,id:i,path:r,flags:t.flags}),fontSize:D({theme:e,translator:n,id:i,path:r})}}var z,E=function(){if(R)return N;R=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===e.call(t)},o=function(n){if(!n||"[object Object]"!==e.call(n))return!1;var i,r=t.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&t.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!r&&!o)return!1;for(i in n);return void 0===i||t.call(n,i)},a=function(t,e){n&&"__proto__"===e.name?n(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},s=function(e,n){if("__proto__"===n){if(!t.call(e,n))return;if(i)return i(e,n).value}return e[n]};return N=function t(){var e,n,i,l,c,u,h=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<f;++d)if(null!=(e=arguments[d]))for(n in e)i=s(h,n),h!==(l=s(e,n))&&(p&&l&&(o(l)||(c=r(l)))?(c?(c=!1,u=i&&r(i)?i:[]):u=i&&o(i)?i:{},a(h,{name:n,newValue:t(p,u,l)})):void 0!==l&&a(h,{name:n,newValue:l}));return h},N}(),I=(z=E)&&z.__esModule&&Object.prototype.hasOwnProperty.call(z,"default")?z.default:z;function T(t,e){return{range:function(t){var n=t.resources,i=t.data,r=n.theme.palette("categorical",0===e?i.items.length:e);return i.items.map((function(t){return r[t.value%r.length]}))},valueAccessor:t.value}}function P(t,e){return{range:function(t){var n=t.resources,i=t.data,r=n.theme.palette("categorical",0===e?i.items.length:e);return i.items.map((function(t){return r[t.row.value%r.length]}))},valueAccessor:t.value}}function q(t,e,n,i,r){var o,a,s=r.byRow,l=r.byElemNo;if(i&&(e.input.persistent||t.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&t.hc.qSize.qcy>((null===(a=(o=t.hc).qDataPages[0]||o.qStackedDataPages[0])||void 0===a?void 0:a.qArea.qHeight)||0)))return l(i,i.raw().qCardinal);if(i){var c=e.pic.extract({field:i.key(),trackBy:i.value}).length;return s(i,c)}return{}}function L(t,e){var n=t.hc.qDimensionInfo,i=e.input.byDimDef||{activeDimensionIndex:n.length-1};if(i.activeDimensionIndex>=0){var r=n[i.activeDimensionIndex];i=r.coloring&&r.coloring.colorMapRef?{type:"libraryItem",key:r.coloring.colorMapRef,activeDimensionIndex:i.activeDimensionIndex}:{activeDimensionIndex:i.activeDimensionIndex}}return i}function j(t,e){var n;return e.activeDimensionIndex>=0?n=t.pic.fields().filter((function(t){return"dimension"===t.type()}))[e.activeDimensionIndex]:"libraryItem"===e.type?!1===(n=e.key?t.pic.field((function(t){return t.raw().colorMapRef===e.key})):void 0)&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))):"expression"===e.type&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))),n}function F(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function B(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function V(){}var $=1/.7,H="\\s*([+-]?\\d+)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",U="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Y=/^#([0-9a-f]{3,8})$/,X=new RegExp(`^rgb\\(${H},${H},${H}\\)$`),G=new RegExp(`^rgb\\(${U},${U},${U}\\)$`),K=new RegExp(`^rgba\\(${H},${H},${H},${W}\\)$`),Z=new RegExp(`^rgba\\(${U},${U},${U},${W}\\)$`),J=new RegExp(`^hsl\\(${W},${U},${U}\\)$`),Q=new RegExp(`^hsla\\(${W},${U},${U},${W}\\)$`),tt={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 et(){return this.rgb().formatHex()}function nt(){return this.rgb().formatRgb()}function it(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Y.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?rt(e):3===n?new lt(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ot(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ot(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=X.exec(t))?new lt(e[1],e[2],e[3],1):(e=G.exec(t))?new lt(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=K.exec(t))?ot(e[1],e[2],e[3],e[4]):(e=Z.exec(t))?ot(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=J.exec(t))?pt(e[1],e[2]/100,e[3]/100,1):(e=Q.exec(t))?pt(e[1],e[2]/100,e[3]/100,e[4]):tt.hasOwnProperty(t)?rt(tt[t]):"transparent"===t?new lt(NaN,NaN,NaN,0):null}function rt(t){return new lt(t>>16&255,t>>8&255,255&t,1)}function ot(t,e,n,i){return i<=0&&(t=e=n=NaN),new lt(t,e,n,i)}function at(t){return t instanceof V||(t=it(t)),t?new lt((t=t.rgb()).r,t.g,t.b,t.opacity):new lt}function st(t,e,n,i){return 1===arguments.length?at(t):new lt(t,e,n,null==i?1:i)}function lt(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function ct(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function ut(){const t=ht(this.opacity);return`${1===t?"rgb(":"rgba("}${dt(this.r)}, ${dt(this.g)}, ${dt(this.b)}${1===t?")":`, ${t})`}`}function ht(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function dt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ft(t){return((t=dt(t))<16?"0":"")+t.toString(16)}function pt(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new mt(t,e,n,i)}function gt(t){if(t instanceof mt)return new mt(t.h,t.s,t.l,t.opacity);if(t instanceof V||(t=it(t)),!t)return new mt;if(t instanceof mt)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new mt(a,s,l,t.opacity)}function mt(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function yt(t){return(t=(t||0)%360)<0?t+360:t}function xt(t){return Math.max(0,Math.min(1,t||0))}function vt(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}F(V,it,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:et,formatHex:et,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return gt(this).formatHsl()},formatRgb:nt,toString:nt}),F(lt,st,B(V,{brighter(t){return t=null==t?$:Math.pow($,t),new lt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new lt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lt(dt(this.r),dt(this.g),dt(this.b),ht(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:ct,formatHex:ct,formatHex8:function(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ut,toString:ut})),F(mt,(function(t,e,n,i){return 1===arguments.length?gt(t):new mt(t,e,n,null==i?1:i)}),B(V,{brighter(t){return t=null==t?$:Math.pow($,t),new mt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new mt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new lt(vt(t>=240?t-240:t+120,r,i),vt(t,r,i),vt(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new mt(yt(this.h),xt(this.s),xt(this.l),ht(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=ht(this.opacity);return`${1===t?"hsl(":"hsla("}${yt(this.h)}, ${100*xt(this.s)}%, ${100*xt(this.l)}%${1===t?")":`, ${t})`}`}}));const bt=Math.PI/180,wt=180/Math.PI,Mt=4/29,kt=6/29,_t=3*kt*kt;function St(t){if(t instanceof Nt)return new Nt(t.l,t.a,t.b,t.opacity);if(t instanceof Ot)return zt(t);t instanceof lt||(t=at(t));var e,n,i=Dt(t.r),r=Dt(t.g),o=Dt(t.b),a=Rt((.2225045*i+.7168786*r+.0606169*o)/1);return i===r&&r===o?e=n=a:(e=Rt((.4360747*i+.3850649*r+.1430804*o)/.96422),n=Rt((.0139322*i+.0971045*r+.7141733*o)/.82521)),new Nt(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Nt(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function Rt(t){return t>.008856451679035631?Math.pow(t,1/3):t/_t+Mt}function At(t){return t>kt?t*t*t:_t*(t-Mt)}function Ct(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Dt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ot(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function zt(t){if(isNaN(t.h))return new Nt(t.l,0,0,t.opacity);var e=t.h*bt;return new Nt(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}F(Nt,(function(t,e,n,i){return 1===arguments.length?St(t):new Nt(t,e,n,null==i?1:i)}),B(V,{brighter(t){return new Nt(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Nt(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 lt(Ct(3.1338561*(e=.96422*At(e))-1.6168667*(t=1*At(t))-.4906146*(n=.82521*At(n))),Ct(-.9787684*e+1.9161415*t+.033454*n),Ct(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),F(Ot,(function(t,e,n,i){return 1===arguments.length?function(t){if(t instanceof Ot)return new Ot(t.h,t.c,t.l,t.opacity);if(t instanceof Nt||(t=St(t)),0===t.a&&0===t.b)return new Ot(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*wt;return new Ot(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Ot(t,e,n,null==i?1:i)}),B(V,{brighter(t){return new Ot(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Ot(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return zt(this).rgb()}}));var Et=t=>()=>t;function It(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Et(isNaN(t)?e:t)}var Tt=function t(e){var n=function(t){return 1==(t=+t)?It:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Et(isNaN(e)?n:e)}}(e);function i(t,e){var i=n((t=st(t)).r,(e=st(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=It(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1),Pt=/^class(-pyramid)?/,qt=function(t,e,n,i){var r=void 0!==n.min?n.min:i.min(),o=void 0!==n.max?n.max:i.max(),a=r,s=o,l=e.limits,c={},u="percent"===e.limitType?l.map((function(t){return r+(o-r)*t})):l,h=e.colors.map((function(e){return t.resolveUIColor(e)}));if(r=Math.min.apply(Math,[r].concat(x(u))),o=Math.max.apply(Math,[o].concat(x(u))),c.min=r,c.max=o,e.breakTypes&&-1===e.breakTypes.indexOf(!0))c.type="categorical",Object.assign(c,function(t){var e=t.min,n=t.max,i=t.limits,r=t.range,o=[],a=[];if(i.length)if(i[i.length-1]<e)a.push(e,n),o.push(r[r.length-1],r[r.length-1],r[r.length-1]);else if(i[0]>n)a.push(e,n),o.push(r[0],r[0],r[0]);else{if(i[0]>e)a.push(e),o.push(r[0]);else{a.push(e);for(var s=0;s<i.length;s++)if(e<i[s]){o.push(r[s]);break}}for(var l=0;l<i.length;l++)e<i[l]&&i[l]<n&&(a.push(i[l]),o.push(r[l]));if(i[i.length-1]<n)a.push(n),o.push(r[i.length]),o.push(r[i.length]);else{a.push(n);for(var c=0;c<i.length;c++)if(i[c]>n){o.push(r[c]),o.push(r[c]);break}}}else o.push(r[0]);return{min:e,max:n,range:o,domain:a}}({min:"percent"===e.limitType?r:a,max:"percent"===e.limitType?o:s,range:h,limits:"percent"===e.limitType?u:l}));else if(e.breakTypes){var d=e.breakTypes;c.type="continuous",c.domain=[r],c.range=[h[0]];for(var f=0;f<u.length;f+=1)if(d[f]){var p=h[f],g=h[f+1],m=Tt(p,g)(.5);c.range.push(m),c.domain.push(u[f]),f<u.length-1&&d[f+1]&&(c.range.push(h[f+1]),c.domain.push((u[f]+u[f+1])/2))}else c.range.push(h[f]),c.range.push(h[f+1]),c.domain.push(u[f]),c.domain.push(u[f]+Math.min(1e-6,(o-r)/1e6));c.range.push(h[h.length-1]),c.domain.push(o)}else c.domain=u,c.range=h;return c};function Lt(t,e,n,i,r){var o,a,s,l=0,c=[],u=(t-e)/(i+1);if(0===u)return 1;for(o=0;o<n.length;o+=1)a=.99*(n[o]-e),s=n[o]>t?Math.floor(t/u):n[o]<e?0:Math.floor(a/u),Number.isNaN(s)||(c[s]?c[s]+=1:c[s]=1);for(o=0;o<c.length;o+=1)c[o]&&(l+=1);return l<=i||l>=r?Math.max(l,i):Lt(t,e,n,i+1,r)}var jt=function(t,e,n,i){var r,o,a=e.theme,s=e.hc,l=i.f,c={mode:"field",fieldType:"measure",field:l?l.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(t){return t.resources.theme.palette("quant")}},u=[],h=!0;if(l){if(Number.isNaN(+l.min())||Number.isNaN(+l.max()))return{invalid:!0};(h=!("S"===(r=n.pic.raw()).qMode&&(r.qDataPages[0]&&r.qSize.qcy>r.qDataPages[0].qArea.qHeight||!r.qDataPages.length&&r.qSize.qcy>0)||"K"===r.qMode&&r.qStackedDataPages[0]&&r.qSize.qcy>r.qStackedDataPages[0].qArea.qHeight||"T"===r.qMode&&r.qSize.qcy>r.qTreeDataPages[0].qGroupSize))&&(u=n.pic.extract({field:0,props:{num:{field:l.key()},exclude:{fields:s.qDimensionInfo.map((function(t,e){return{field:"qDimensionInfo/".concat(e)}})),value:function(t){return Math.min.apply(Math,x(t))<0}}}}).filter((function(t){return t.value>=0&&!t.exclude.value})).map((function(t){return t.num.value})).filter((function(t){return"number"==typeof t})))}if(!1===n.input.autoMinMax){if(c.min=n.input.measureMin,c.max=n.input.measureMax,c.max<c.min)return{invalid:!0}}else if(l&&!h)c.min=l.min(),c.max=l.max();else if(l){if(!u.length)return{invalid:!0};c.min=Math.min.apply(Math,x(u)),c.max=Math.max.apply(Math,x(u))}if(n.input.measureScheme&&(c.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(t){return t.key===n.input.measureScheme}))[0];c.type=d&&Pt.test(d.type)?"categorical":"continuous","categorical"===c.type&&(o=d.colors.some((function(t){return Array.isArray(t)}))?Math.max.apply(Math,x(d.colors.map((function(t){return t?t.length:0})))):d.colors.length)}if("categorical"===c.type){for(var f=h?Lt(c.max,c.min,u,1,o):o,p=(c.max-c.min)/f,g=[],m=0;m<f+1;m+=1)g.push(c.min+p*m);c.domain=g,c.range=function(t){for(var e=t.resources.theme.palette("quant",f),n=Math.max(1,Math.floor(e.length/f)),i=[],r=0;r<f;r+=1)i.push(e[r*n]);return[i[0]].concat(i,[i[i.length-1]])}}return c};function Ft(t,e){var n;return e.activeMeasureIndex>=0?n=t.pic.fields().filter((function(t){return"measure"===t.type()}))[e.activeMeasureIndex]:"libraryItem"===e.type?n=t.pic.field((function(t){return t.raw().colorMapRef===e.key&&void 0!==e.key})):"expression"===e.type&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))),n||(n=t.pic.field((function(t){return void 0!==t.raw().matchMeasure})))&&(n=t.pic.fields().filter((function(t){return"measure"===t.type()}))[n.raw().matchMeasure]),n}function Bt(t){t.measureOverrides.every((function(t){return!t}))&&(t.measureOverrides=null)}function Vt(t,e){for(var n=(null==e?void 0:e.domain)||[],i=(null==e?void 0:e.range)||[],r=[],o=0;o<t.length;++o){var a=t[o];if("constant"===(null==a?void 0:a.mode)){var s=n.indexOf(o);-1===s?(n.push(o),i.push(a.primary)):i[s]=a.primary,t[o]=null}else if(a){r.push(o);var l=n.indexOf(o);-1!==l&&(n.splice(l,1),i.splice(l,1))}}return{domain:n,range:i,exclude:r}}function $t(t,e,n,i){var r,o=function(t,e,n,i){if(e.input&&!e.input.auto){if("byMeasure"===e.input.mode)return function(t,e,n){var i=e.theme,r=e.hc,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===o?Ft:o,s=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,s),c=jt(0,{theme:i,hc:r},n,{f:l});if(c.invalid)return c;"expression"===s.type&&(s.activeMeasureIndex<0||void 0===s.activeMeasureIndex)&&(c.label=s.label,l&&"color.altLabel"===l.raw().labelExpRef&&(c.label=n.input.altLabel)),!c.label&&l&&(c.label=l.title());var u=s.activeMeasureIndex>=0?l:null;if(!u&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(u=n.pic.fields().filter((function(t){return"measure"===t.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===s.type)if(u){var h=u.raw().coloring;h&&h.gradient&&I(c,qt(t,h.gradient,c,u))}else c.auxiliary=s;return c}(t,n,e);if("byDimension"===e.input.mode)return function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.getCDef,o=void 0===r?L:r,a=i.getCByField,s=void 0===a?j:a,l=i.getPersistence,c=void 0===l?q:l,u=o(e,n),h=s(n,u),d=h?h.raw():{},f=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!f.qHasOtherValues)return{invalid:!0};var p={mode:"field",fieldType:"dimension",type:"categorical",field:h?h.key():void 0,isFieldLocked:d.qLocked};return("expression"===u.type||u.activeDimensionIndex<0)&&(p.label=u.label,"color.altLabel"===d.labelExpRef&&(p.label=n.input.altLabel)),!p.label&&h&&(p.label=h.title()),n.input.dimensionScheme&&(p.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===u.type&&(p.auxiliary=u),I(p,c(e,n,u,h,{byRow:P,byElemNo:T})),p}(t,n,e);if("byExpression"===e.input.mode)return function(t,e,n,i){var r=e.hc,o=e.theme,a=e.translator,s=n.pic.field((function(t){return"colorByExpression"===t.raw().id}));if(!s||!s.raw().qFallbackTitle&&!n.input.colorExpression||!(Number.isFinite(s.raw().qMin)&&Number.isFinite(s.raw().qMax)||n.input.expressionIsColor))return{mode:"constant",type:"constant",primary:i.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:s?s.key():void 0,type:"color"};var l=jt(0,{hc:r,theme:o},n,{f:s});return l.invalid||(l.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),l}(0,n,e,i);if("byMultiple"===e.input.mode||"primary"===e.input.mode)return function(t,e,n,i){var r=e.hc,o=e.theme,a=e.translator,s=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&r.qMeasureInfo.length>1&&(s="measure"),"measure"===s){var l=[],c=[];"measure"===n.input.useBaseColors&&r.qMeasureInfo.forEach((function(e,n){if(e.baseColor||e.coloring&&e.coloring.baseColor){l.push(n);var r=t.resolveUIColor(e.baseColor||e.coloring.baseColor);"none"===r?c.push(i.primary):c.push(r)}}));var u=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,h=o?o.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&h&&(u={categorical:h.key}),{mode:"measure",type:"categorical",palettes:u,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:c}:void 0}}if("dimension"===s){var d=[],f=[];return r.qDimensionInfo.forEach((function(e,n){if(e.baseColor||e.coloring&&e.coloring.baseColor){d.push(n);var r=t.resolveUIColor(e.baseColor||e.coloring.baseColor);"none"===r?f.push(i.primary):f.push(r)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:f}:void 0}}var p=i.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(p=t.resolveUIColor(n.input.paletteColor));else{var g=n.input.singleColor;"number"!=typeof g||Number.isNaN(g)||(p=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][g])}return{mode:"constant",type:"constant",primary:p}}(t,n,e,i)}return{}}(t,e,n,i);return null!==(r=e.input)&&void 0!==r&&r.measureOverrides?(o.measureOverrides=e.input.measureOverrides.map((function(n,r){return function(t){var e,n=t.cm,i=t.defaults,r=t.index,o=t.input,a=t.pic;if(!o||!o.on)return null;var s=null!==(e=o.mode)&&void 0!==e?e:"primary";return"primary"===s?function(t,e,n){var i=n.primary;return void 0!==e.paletteColor&&e.paletteColor&&(i=t.resolveUIColor(e.paletteColor)),m(m({},n),{},{mode:"constant",type:"constant",primary:i})}(n,o,i):"byExpression"===s?function(t,e,n){var i="qMeasureInfo/".concat(t,"/"),r=e.field((function(t){return t.id().startsWith(i)&&"colorByMeasureExpression"===t.raw().id})),o=r;return m(m({},n),{},o?{mode:"field",fieldType:"expression",field:r?r.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(r,a,i):null}({cm:t,input:n,defaults:i,index:r,pic:e.pic})})),function(t,e){var n,i,r,o=e.translator;if(Bt(t),1===(null===(n=t.measureOverrides)||void 0===n?void 0:n.length))return t.measureOverrides[0];if("measure"===t.mode&&t.measureOverrides&&(t.explicit=Vt(t.measureOverrides,t.explicit),Bt(t)),null!==(i=t.measureOverrides)&&void 0!==i&&i.every((function(t){return"constant"===(null==t?void 0:t.mode)}))){var a={mode:"measure",type:"categorical",label:null==o?void 0:o.get("Common.Measures")};return a.explicit=Vt(t.measureOverrides),a}return null!==(r=t.measureOverrides)&&void 0!==r&&r.every((function(t){return t}))?{invalid:!0,measureOverrides:t.measureOverrides}:t}(o,n)):o}var Ht=function(t,e){var n=t.fieldType,i={};if(e)if("measure"===n){var r=e.coloring;r&&(i.measureGradient=r.gradient)}else if("dimension"===n){var o=e[0],a=e[1];o&&(i.legendDataPage=o),a&&(i.dimValsData=a.colorMap)}return i},Wt=function(t){throw t.isHandled=!0,t};function Ut(t){return function(e){return"object"===v(e.datum[t])?e.datum[t].value:void 0}}function Yt(t){return"object"===v(t.datum.isNull)?t.datum.isNull.value:-2===t.datum.value}function Xt(t){return-3===t.datum.value}var Gt={COLOR:void 0,FONT_SIZE:"16px",FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"},Kt={COLOR:void 0,FONT_SIZE:void 0,FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"};function Zt(t){var e=t.theme,n=t.key,i=t.styleOverrides,r={title:{color:Gt.COLOR,fontSize:Gt.FONT_SIZE,fontFamily:Gt.FONT_FAMILY},label:{color:Kt.COLOR,fontSize:Kt.FONT_SIZE,fontFamily:Kt.FONT_FAMILY}};if(!e&&!i)return r;var o=i||{},a=o.title,s=o.label,l=function(t){var e=t.theme,n=t.key;return function(t,i,r,o){return void 0!==t?t:e?e.getStyle(n,i,r):o}}({theme:e,key:n});return r.title.color=l(null==a?void 0:a.color,"legend.title","color",Gt.COLOR),r.title.fontSize=l(null==a?void 0:a.fontSize,"legend.title","fontSize",Gt.FONT_SIZE),r.title.fontFamily=l(null==a?void 0:a.fontFamily,"legend.title","fontFamily",Gt.FONT_FAMILY),r.label.color=l(null==s?void 0:s.color,"legend.label","color",Kt.COLOR),r.label.fontSize=l(null==s?void 0:s.fontSize,"legend.label","fontSize",Kt.FONT_SIZE),r.label.fontFamily=l(null==s?void 0:s.fontFamily,"legend.label","fontFamily",Kt.FONT_FAMILY),r}var Jt=function(t,e,n){var i=t&&t.dock||void 0;if("auto"!==i)return i||"right";if(e){var r=e.element.getBoundingClientRect();if(r.height>r.width)return"bottom"}return n?"left":"right"},Qt=function(t,e,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&e.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof t.show?t.show():!1!==t.show)};function te(t,e){var n=t.styleReference,i=t.styleOverrides,r=t.chart,o=t.rtl,a=e.legendProps,s=e.coloring,l=e.theme,c=e.hc,u=Zt({theme:l,key:n,styleOverrides:i});return{layout:{minimumLayoutMode:"MEDIUM",dock:Jt(a,r,o)},show:"function"==typeof a.show?function(){return Qt(a,c,s)}:Qt(a,c,s),renderer:"svg",mounted:function(t){t.childNodes[0].style.pointerEvents="none",t.style.overflow="hidden"},settings:{title:{show:!1!==a.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:s.label||"",fill:u.title.color,fontSize:u.title.fontSize,fontFamily:u.title.fontFamily}}}}function ee(t,e,n){var i=[],r=[],o=function(t,e,n){return"categorical"===e.coloring.type?function(t,e,n){var i=te(t,e);if(!i.show)return!1;var r,o=t.key,a=t.styleReference,s=t.styleOverrides,l=t.viewState,c=t.rtl,u=t.settings,h=t.style,d=e.scaleKey,f=e.theme,p=e.scales,g=Zt({theme:f,key:a,styleOverrides:s}),y=i.layout.dock,x="left"===y||"right"===y?{maxLines:2,wordBreak:"break-word"}:{},v={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"};"dimension"===e.coloring.fieldType&&(r=function(t){return t.datum.value>=0||-3===t.datum.value});var b="".concat(d,"Legend");return I(!0,i,{type:"legend-cat",key:"".concat(o,"-cat"),scale:b in p?b:d,settings:{layout:{scrollOffset:function(){return l?l.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(i.layout.dock)?2:1,direction:c?"rtl":"ltr",horizontal:20},item:{show:r,label:m({fill:g.label.color,fontSize:g.label.fontSize,fontFamily:g.label.fontFamily},x)},navigation:{disabled:n,button:{content:function(t,e){var n=e.direction;return t("i",{style:{"pointer-events":"none",fontSize:"12px",display:"inline-block",fontStyle:"normal",lineHeight:"0",textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizelegibility",margin:"0px"}},[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[t("path",{d:v[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:u,style:h})}(t,e,n):"continuous"===e.coloring.type&&function(t,e){var n,i=t.key,r=t.styleReference,o=t.styleOverrides,a=t.rtl,s=t.settings,l=t.style,c=e.scaleKey,u=e.theme,h="".concat(c,"Range"),d=te(t,e);if(!d.show)return!1;var f=Zt({theme:u,key:r,styleOverrides:o}),p=d.layout.dock,g="right"===p||"left"===p,m=null===(n=e.scales)||void 0===n?void 0:n[h];return g&&m&&(m.invert=!0),I(!0,d,{type:"legend-seq",key:"".concat(i,"-seq"),settings:{fill:c,major:h,length:1,tick:{fill:f.label.color,fontSize:f.label.fontSize,fontFamily:f.label.fontFamily},title:{anchor:!a||"top"!==d.layout.dock&&"bottom"!==d.layout.dock?void 0:"right",padding:parseFloat(d.settings.title.fontSize)||16}}},{settings:s,style:l})}(t,e)}(t,e,n&&n.navigationDisabled);return i.push(o),o&&"legend-cat"===o.type&&(r.push(function(t){var e=t.key,n=t.requireFailure,i=t.recognizeWith,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(e),type:"Tap",requireFailure:n,recognizeWith:i,options:{event:"legendtap",interval:10,pointers:1,enable:function(t,n){var i;if(!n)return!0;if(null!=r&&null!==(i=r.interact)&&void 0!==i&&i.enabled&&!r.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(t){return t.key==="".concat(e,"-cat")})))return!1;var o=n.srcEvent.target;return!!(o&&o.hasAttribute("data-action")&&o.hasAttribute("data-component-key"))||!(!o||!o.childNodes[0]||"BUTTON"!==o.childNodes[0].nodeName)}},events:{legendtap:function(t){t.preventDefault();var e=t.srcEvent.target;e&&e.hasAttribute("data-action")&&e.hasAttribute("data-component-key")&&this.chart.component(e.getAttribute("data-component-key")).emit(e.getAttribute("data-action"))}}}}(t,n)),r.push(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.eventName,n=t.key,i=t.requireFailure,r=t.recognizeWith,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(n),type:"Pan",requireFailure:i,recognizeWith:r,options:{event:e,pointers:1,threshold:10,enable:function(t,i){var r;return this.started===e||!i||!(null!=o&&null!==(r=o.interact)&&void 0!==r&&r.enabled&&!o.interact.enabled())&&this.chart.componentsFromPoint({x:i.center.x,y:i.center.y}).some((function(t){return t.key==="".concat(n,"-cat")}))}},events:p(p(p({},"".concat(e,"start"),(function(t){t.preventDefault(),this.started!==e&&(this.started=e,this.chart.component("".concat(n,"-cat")).emit("panstart",t))})),"".concat(e,"move"),(function(t){t.preventDefault(),this.chart.component("".concat(n,"-cat")).emit("panmove",t)})),"".concat(e,"end"),(function(t){t.preventDefault(),this.chart.component("".concat(n,"-cat")).emit("panend",t),this.started=!1}))}}(t,n))),{interactions:r,components:i}}function ne(t){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.auto,n=function(t){var e=m({hc:null,colorProps:null,layout:null,theme:null},t),n={},i={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},r={auto:function(t){return t?(i.auto=t,r):i.auto},getDimensionColorMap:function(t){return t?(i.getDimensionColorMap=t,r):i.getDimensionColorMap},getAttributeDimension:function(t){return t?(i.getAttributeDimension=t,r):i.getAttributeDimension},getMeasure:function(t){return t?(i.getMeasure=t,r):i.getMeasure},set:function(t){var r;if(!t.colorProps)throw new Error('Missing "colorProps"');if(I(e,t),(n={pic:e.picasso.data("q")({data:e.hc,config:{localeInfo:e.localeInfo}}),input:e.colorProps}).input.auto){var o=i.auto(t.layout);n.input=I(!0,{},n.input,o,{auto:!1});var a=e.theme?e.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var s=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(s=+n.input.byDimDef.activeDimensionIndex),e.hc&&e.hc.qDimensionInfo[s]&&e.hc.qDimensionInfo[s].coloring&&e.hc.qDimensionInfo[s].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=e.hc.qDimensionInfo[s].coloring.colorMapRef)}null!==(r=n.input.measureOverrides)&&void 0!==r&&r.every((function(t){return!t||!t.on}))&&(n.input=I(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var t=e.theme,i=[];(t&&t.getDataColorPickerPalettes()||[]).forEach((function(t){i.push({key:"ui",colors:t.colors})})),n.palettes=i}return n.palettes},getAuxiliaryData:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!t.auxiliary&&!/qAttrDimInfo/.test(t.field))return Promise.resolve();var r=(t.auxiliary||{}).key;if("measure"===t.fieldType)return i.getMeasure(r,e).catch((function(){}));if("dimension"===t.fieldType){var o="".concat(n,"/").concat(t.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(t.field)?i.getAttributeDimension(o,e).catch((function(){})):Promise.resolve(),r?i.getDimensionColorMap(r,e).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(t,i){var r=this;return t.auxiliary||/qAttrDimInfo/.test(t.field)?(this.palettes(),this.getAuxiliaryData(t,i).then((function(i){if(!i)return{};if("measure"===t.fieldType){if(i.coloring&&i.coloring.gradient){var o=n.pic.field(t.field);return qt(r,i.coloring.gradient,t,o)}return{}}if("dimension"===t.fieldType){var a={nil:t.nil,others:t.others},s=i[0],l=i[1]?i[1].colorMap:null;if(s){var c=e.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(t.field).raw(),n.pic.field(t.field).raw()],qMeasureInfo:[],qDataPages:s,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=c}return l?function(t,e,n,i){var r=i.external,o=i.field,a=m({},t);I(a,T(o,o.raw().qCardinal));var s=r.theme?r.theme.getDataColorPalettes()[0]:null;return e.nul&&(a.nil=n.resolveUIColor(e.nul)),e.oth&&(a.others=n.resolveUIColor(e.oth)),e.usePal?(a.palettes={categorical:e.pal},s&&!e.pal&&(a.palettes.categorical=s.key,I(a,T(o)))):!1===e.autoFill&&e.single?a.range=[n.resolveUIColor(e.single)]:e.autoFill&&(s&&(a.palettes={categorical:s.key}),I(a,T(o))),e.colors&&e.colors.length&&(a.explicit=function(t,e,n){for(var i={},r=0;r<t.length;r+=1)i[t[r].value]=t[r].baseColor;var o=[];return{domain:function(t){var r=t.data,a=[];o=[];for(var s=0;s<r.items.length;s++){var l=r.items[s],c=(l.text||l).label;i[c]&&-1===a.indexOf(l.value)&&(a.push(l.value),o.push(e.resolveUIColor(i[c])))}return a.push(-3,-2),o.push(n.others),o.push(n.nil),a},range:function(){return o}}}(e.colors,n,a)),a}(a,l,r,{external:e,field:n.pic.field(t.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(t){if(t.index<0||void 0===t.index)return t.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(t){return"ui"===t.key}))[0]||!1),!n.uiPalette)return t.color;var e="none"===n.uiPalette.colors[0]?t.index:t.index-1;return void 0===n.uiPalette.colors[e]?t.color:n.uiPalette.colors[e]},settings:function(){if(this.palettes(),!n.settings){var t={primary:"steelblue",others:"#aaa",nil:"#ddd"},i=e.theme;i&&(t=m(m({},t),i.getDataColorSpecials())),n.settings=I(t,$t(this,n,e,t))}return n.settings}};return r}(t.resources).auto(e||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(t,e){return function(t,e){var n=e.layout,i=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.dimValsData?Promise.resolve({colorMap:n.snapshotData.content.chartData.dimValsData}):Promise.reject():i&&i.getObject?i.getObject("ColorMapModel_".concat(t)).then((function(t){return t.getLayout()})):Promise.reject()}(t,{layout:e.layout,app:e.app})})).getMeasure((function(t,e){return function(t,e){var n=e.layout,i=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.measureGradient?Promise.resolve({coloring:{gradient:n.snapshotData.content.chartData.measureGradient}}):Promise.reject():i&&i.getMeasure?i.getMeasure(t).then((function(t){return t.getMeasure()})):Promise.reject()}(t,{layout:e.layout,app:e.app})})).getAttributeDimension((function(t,e){return function(t,e){var n=e.layout,i=e.model,r=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.legendDataPage?Promise.resolve(n.snapshotData.content.chartData.legendDataPage):Promise.reject():i&&i.session&&r?i.getHyperCubeData(t,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(Wt):Promise.reject()}(t,{layout:e.layout,model:e.model,app:e.app})}));return n.getSnapshotData=Ht,n}({resources:t}),n={},i={},r=function(t){return i.settings||(t||console.warn("settings() called before auxiliarySettings()"),i.settings=e.settings()),i.settings},o={config:function(r){if(n=m({},r),i={},!n.key)throw new Error("Missing key");e.set(m(m({},t),n))},auto:function(t){return t?(e.auto(t),o):e.auto()},getAuxiliarySettings:function(t){return i.auxiliarySettings?Promise.resolve(i.auxiliarySettings):e.getAuxiliarySettings(r(!0),t).then((function(t){return i.auxiliarySettings=t||{},i.settings=m(m({},i.settings),i.auxiliarySettings),i.scales=void 0,i.color=void 0,i.auxiliarySettings}))},getAuxiliaryData:function(){return e.getAuxiliaryData(r())},getSnapshotData:function(t){var n=r();return e.getAuxiliaryData(n,t).then((function(t){return e.getSnapshotData(n,t)}))},resolveUIColor:function(t){return e.resolveUIColor(t)},settings:function(){var t=r();return{mode:t.mode,type:t.type,label:t.label,field:t.field,fieldType:t.fieldType,nil:t.nil,others:t.others,primary:t.primary}},settingsForMeasure:function(t){var e;return(null===(e=r().measureOverrides)||void 0===e?void 0:e[t])||this.settings()},isSelectionLocked:function(t){var e=t.isMeasureSelectionLocked;return function(t,e){var n=e.isMeasureSelectionLocked;return"field"!==t.mode||("dimension"===t.fieldType?t.isFieldLocked:"measure"!==t.fieldType||n)}(r(),{isMeasureSelectionLocked:e})},palettes:function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.colorProps,n=t.coloring,i=t.theme,r=[];if(n&&n.palettes&&i){var o=n.palettes.categorical||e.dimensionScheme,a=i.getDataColorPalettes().filter((function(t){return t.key===o}))[0]||i.getDataColorPalettes()[0];o&&a&&r.push({key:"categorical",colors:a.colors});var s=n.palettes.metric||e.measureScheme,l=i.getDataColorScales().filter((function(t){return t.key===s}))[0]||i.getDataColorScales()[0];if(l){var c=l.colors[0]?l.colors:[[]].concat(x(l.colors.slice(1)));c=Array.isArray(c[0])?c.map((function(t){return t.slice().reverse()})):c.slice().reverse(),r.push({key:"quant",colors:c})}}return r}({coloring:r(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return i.scales=i.scales||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.hc,n=t.coloring,i=t.rtl,r=t.key,o=t.source,a=t.picasso,s={},l=r;if(n){var c={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(x((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(x((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var u,h=function(t){var e=t.hc,n=t.source,i=t.coloring,r={data:{extract:[{source:"dummy",field:0,filter:function(){return r.expando=e.qDataPages[0]?e.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:i.field,trackBy:i.valueAccessor,reduce:"first",props:{row:{reduce:function(){return r.expando++}},text:{value:function(t){return t.qText},reduce:"first"}}}]},expando:0};return r}({hc:e,source:o,coloring:n}).data;if(n.legendDataset){var d=0,f={};a.data("q")({data:e}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(t){var e=t[0];return f[e]=d++,t[0]}}),u={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(t){return t.qElemNumber>=0},props:{row:{value:function(t){return f[t.qElemNumber]}}}}}}var p={data:h,range:n.range,domain:n.domain,explicit:c,type:"categorical-color",label:function(t){return t.datum.text&&t.datum.text.value?t.datum.text.value:t.datum.label}};s[l]=p,u&&(s["".concat(l,"Legend")]=m(m({},p),{},{data:u})),e&&e.qHasOtherValues&&u&&((u||p.data).amend=[{label:e.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var g={data:{field:n.field},min:n.min,max:n.max};s[l]=I({},g,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===s[l].type&&(s["".concat(l,"Range")]=I({},g,{invert:!!i}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var y={data:e.qDimensionInfo.map((function(t,e){return e})),label:function(t){return e.qDimensionInfo[t.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};s[l]=y}else if("measure"===n.mode){var v={data:e.qMeasureInfo.map((function(t,e){return e})).filter((function(t){var e;return!(null!==(e=n.explicit)&&void 0!==e&&null!==(e=e.exclude)&&void 0!==e&&e.includes(t))})),label:function(t){return e.qMeasureInfo[t.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};s[l]=v}}return s}({hc:n.hc,coloring:r(),key:n.key,source:n.source,picasso:t.picasso}),i.scales},color:function(){return i.color=i.color||function(t){var e=t.coloring,n=t.scales,i=t.key,r=Ut(i),o=Ut("".concat(i,"IsAnOther")),a=function(t,e){var i=t.fieldType,a=t.invalid,s=t.mode,l=t.nil,c=t.others,u=t.primary,h=t.type;return a?function(t){return Xt(t)||o(t)?c:l}:n[e]?function(t){return Xt(t)?c:Yt(t)||-2===r(t)&&"dimension"===i||"NaN"===r(t)?l:o(t)?c:t.resources.scale(e)(r(t))||c}:"constant"===s?function(t){return Xt(t)||o(t)?c:Yt(t)?l:u}:"color"===h?function(t){return Xt(t)||o(t)?c:Yt(t)?l:r(t)||c}:null},s=a(e,i);if(e.measureOverrides){var l=Ut("".concat(i,"MeasureIdx")),c=e.measureOverrides.map((function(t){return t&&a(t)}));return function(t){var e=l(t);return c[e]?c[e](t):s(t)}}return s}({coloring:r(),scales:this.scales(),key:n.key}),i.color},datumProps:function(t){return function(t){var e,n,i=t.hc,r=t.coloring,o=t.scales,a=t.key,s=t.addMeasureIx,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=a,u=r.nil;"field"===r.mode&&r.field?e=r.field:o[a]&&"field"===r.mode&&(e=o[a].data.field||r.field),e?(n={field:e,reduce:"first"},"color"===r.type&&(n.value=function(t){return"NaN"!==t.qNum?function(t){return"rgba(".concat([(16711680&t)>>16,(65280&t)>>8,255&t,((4278190080&t)>>>24)/255].join(","),")")}(t.qNum):t.qText&&it(t.qText)?t.qText:u})):"dimension"===r.mode?n=void 0!==r.field?r.field:i.qDimensionInfo.length-1:"measure"===r.mode&&(n=l);var h=p({},c,n);return i.qDimensionInfo.length>1&&(h["".concat(c,"IsAnOther")]={fields:i.qDimensionInfo.map((function(t,e){return{field:"qDimensionInfo/".concat(e)}})),value:function(t){return-1!==t.indexOf(-3)}}),s&&(h["".concat(c,"MeasureIdx")]=l),h}({coloring:this.settingsForMeasure(t),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:r().measureOverrides},t)},data:function(){var t=r(),e={key:"dummy",data:[["field"],["a"]]};return t.legendDataset?[e,{type:"q",key:"attrDim",data:t.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[e]},legend:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.eventName,i=t.key,o=t.viewState,a=t.chart,s=t.rtl,l=t.styleReference,c=void 0===l?"object.legend":l,u=t.styleOverrides,h=t.settings,d=void 0===h?{}:h,f=t.style,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ee({eventName:e,key:i,rtl:s,viewState:o,chart:a,styleReference:c,styleOverrides:u,settings:d,style:void 0===f?{}:f},{legendProps:n.legendProps,scaleKey:n.key,coloring:r(),theme:n.theme,hc:n.hc,scales:this.scales()},p)}};return o}var ie=function(t){return t.baseColor||t.coloring&&t.coloring.baseColor};function re(t){var e=t.qHyperCube,n=e.qDimensionInfo,i=e.qMeasureInfo,r=n.some(ie),o=i.some(ie),a=t.color.useBaseColors;return"measure"===a&&!o||"dimension"===a&&!r?"off":a}var oe=function(t){return t.baseColor||t.coloring&&t.coloring.baseColor};function ae(t){var e,n=t.qHyperCube.qDimensionInfo.some(oe),i=t.qHyperCube.qMeasureInfo.some(oe),r=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(e=null!=r?r:i?"measure":void 0)&&void 0!==e?e:"off",paletteColor:null}}var se=function(){};function le(t){var e,n,i,r,o=t.picasso,a=t.model,s=t.app,l=t.translator,c=t.layoutService,u=void 0===c?void 0:c,h=t.createConfig,d=void 0===h?se:h,f=t.config,p=void 0===f?{}:f,g=t.custom,y=void 0===g?{}:g,x=p.localeInfo,v=p.key,b=p.theme,w=void 0===b?void 0:b,M=p.auto,k=void 0===M?void 0:M,_=p.definitionPath,S=null==u||null===(e=u.getLayout)||void 0===e?void 0:e.call(u),N={theme:w,key:v,localeInfo:x,layout:S,hc:null==u||null===(n=u.getHyperCube)||void 0===n?void 0:n.call(u),legendProps:null==u||null===(i=u.getLayoutValue)||void 0===i?void 0:i.call(u,"legend"),colorProps:m(m({},null==u||null===(r=u.getLayoutValue)||void 0===r?void 0:r.call(u,"color")),{},{useBaseColors:S?re(S):void 0})},R=ne({picasso:o,model:a,app:s,translator:l,auto:k});!1!==k&&R.auto((function(t){return k?k({layout:t,defaultAuto:ae}):ae(t)}));var A=!1,C={getColor:function(){return R.color()},getPaletteColor:function(t){var e=t.index,n=t.color;return R.resolveUIColor({index:e,color:n})},getData:function(){return R.data()},getDatumProps:function(t){return R.datumProps(t)},getSnapshotData:function(){return R.getSnapshotData(_)},getSettingsForMeasure:function(t){return R.settingsForMeasure(t)},getSettings:function(){return R.settings()},getLegend:function(t,e){return R.legend(t,e)},getScales:function(){return R.scales()},getPalettes:function(){return R.palettes()},isSelectionLocked:function(t){var e=t.isMeasureSelectionLocked;return R.isSelectionLocked({isMeasureSelectionLocked:e})},isInitialized:function(){return A},custom:m({},y),initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,e=(void 0===t?d:t)({getUseBaseColors:re}),n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return m(m(m({},t),e),{},{colorProps:m(m({},t.colorProps),e.colorProps||{})})}(N,e);return R.config(n),R.getAuxiliarySettings(_).then((function(){A=!0}))}};return C}var ce="center",ue="bottom";function he(t){var e=t.chart,n=t.logicalSize;if(n)return n;var i=e?e.element.getBoundingClientRect():{};return{width:i.width,height:i.height}}[{key:"NoDataExist",alignment:ce,condition:function(t){var e=t.layoutService;if(!e)return!1;var n=e.meta.size;return n.x*n.y==0}},{key:"OnlyNanDataMeasure",translationKey:"OnlyNanData",alignment:ce,condition:function(t){var e=t.layoutService;return!!e&&e.getHyperCubeValue("qMeasureInfo").every((function(t){return"NaN"===t.qMin&&"NaN"===t.qMax}))}},{key:"OnlyNanDataDimensionContinuous",translationKey:"OnlyNanData",alignment:ce,condition:function(t){var e=t.layoutService;if(!e)return!1;if(!e.meta.isContinuous)return!1;var n=e.getHyperCubeValue("qDimensionInfo.0");return n&&(n.qMax<n.qMin||"NaN"===n.qMax)}},{key:"OnlyNegativeOrZeroValues",alignment:ce},{key:"DataRangeIncludingZero",alignment:ue},{key:"LimitedData",alignment:ue},{key:"NegativeOrZeroValues",alignment:ue}].reduce((function(t,e){return t[e.key]=e,t}),{});var de=[{key:"FULL",size:{width:550,height:450}},{key:"MEDIUM",size:{width:400,height:220}},{key:"SMALL",size:{width:300,height:150}},{key:"XSMALL",size:{width:150,height:75}}];function fe(t){var e=t.width,n=t.height,i=de.filter((function(t){return e>=t.size.width&&n>=t.size.height})).shift();return i?i.key:"SPARK"}var pe={left:"right",right:"left",top:"bottom",bottom:"top",near:"far",far:"near"};function ge(t){var e=t.orientation,n=t.dock,i=t.btt,r=t.rtl,o="horizontal"===e?function(t){return"bottom"===t||"near"===t?"bottom":"top"}(n):function(t,e){var n="left"===t||"near"===t?"left":"right";return e?pe[n]:n}(n,r),a=function(t,e,n){return"vertical"===t?e?"bottom":"top":n?"right":"left"}(e,i,r);return{current:o,opposite:pe[o],start:a,end:pe[a]}}function me(t){var e=t.chart,n=t.layoutService,i=t.config,r=void 0===i?{}:i,o=r.logicalSize,a=void 0!==o&&o,s=r.rtl,l=void 0!==s&&s,c={chart:{size:void 0,mode:void 0},x:{dock:void 0,opposite:void 0,size:void 0},y:{dock:void 0,opposite:void 0,size:void 0}},u={type:"x-y",config:m({},r),meta:c,update:function(t){c.chart.size={width:t.width,height:t.height},c.chart.mode=fe(t);var e=ge({orientation:"horizontal",dock:n.getLayoutValue("xAxis.dock"),btt:!1,rtl:l}),i=e.current,r=e.opposite;c.x.dock=i,c.x.opposite=r,c.x.size=t.width;var o=ge({orientation:"vertical",dock:n.getLayoutValue("yAxis.dock"),btt:!0,rtl:l}),a=o.current,s=o.opposite;c.y.dock=a,c.y.opposite=s,c.y.size=t.height}};return u.update(he({chart:e,logicalSize:a})),u}var ye="vertical",xe="horizontal";function ve(t){var e=t.chart,n=t.layoutService,i=t.config,r=void 0===i?{}:i,o=t.typeConfig,a=void 0===o?{}:o,s=r.logicalSize,l=void 0!==s&&s,c=r.rtl,u=void 0!==c&&c,h=a.fallback===ye?ye:xe,d=!!a.invert,f=a.measureAxes||[{ref:"measureAxis",name:"minor"}],p={chart:{orientation:void 0,size:void 0,mode:void 0},major:{orientation:void 0,dock:void 0,opposite:void 0,size:void 0}},g={type:"major-minor",config:m({},r),meta:p,update:function(t){p.chart.orientation=n.getLayoutValue("orientation",h),p.chart.size={width:t.width,height:t.height},p.chart.mode=fe(t),p.major.orientation=function(t){var e=t.chartOrientation,n=t.invert;return t.layoutService.meta.isContinuous?xe:n?e===ye?xe:ye:e}({layoutService:n,chartOrientation:p.chart.orientation,invert:d});var e=ge({orientation:p.major.orientation,dock:n.getLayoutValue("dimensionAxis.dock"),btt:!1,rtl:u}),i=e.current,r=e.opposite;p.major.dock=i,p.major.opposite=r,p.major.size=p.major.orientation===ye?t.height:t.width,f.forEach((function(e){var i={};i.orientation=p.major.orientation===ye?xe:ye;var r=ge({orientation:i.orientation,dock:n.getLayoutValue("".concat(e.ref,".dock")),btt:!0,rtl:u}),o=r.current,a=r.opposite,s=r.start,l=r.end;i.dock=o,i.opposite=a,i.start=s,i.end=l,i.size=i.orientation===ye?t.height:t.width,p[e.name]=i}))}};return g.update(he({chart:e,logicalSize:l})),g}function be(t){var e=t.chart,n=t.layoutService,i=t.config,r=void 0===i?{}:i,o=t.typeConfig,a=void 0===o?{}:o;return("x-y"===a.type?me:ve)({chart:e,layoutService:n,config:r,typeConfig:a})}function we(t,e,n){if(void 0===t||void 0===e)return n;for(var i=e.split("."),r=t,o=0;o<i.length;++o){var a=i[o];if(void 0===r[a])return n;r=r[a]}return r}var Me=["__proto__","constructor"];function ke(t,e,n){if(void 0!==t&&void 0!==e){var i=e.split("."),r=i[i.length-1];if(!Me.some((function(t){return i.includes(t)}))){for(var o=t,a=0;a<i.length-1;++a){var s=i[a];void 0===o[s]&&(o[s]=Number.isNaN(+i[a+1])?{}:[]),o=o[s]}void 0!==n?o[r]=n:delete o[r]}}}var _e,Se={ERROR_CODES:[7005],DIMENSION:"qDimensionInfo",MEASURE:"qMeasureInfo"},Ne=function(t,e){return t[e].reduce((function(t,e,n){var i;return i=e,Se.ERROR_CODES.some((function(t){var e;return t===(null===(e=i.qError)||void 0===e?void 0:e.qErrorCode)}))?t.filtered.push(n):t.reduced.push(e),t}),{reduced:[],filtered:[]})};function Re(t){var e;return((null==t||null===(e=t.qHyperCube)||void 0===e?void 0:e.qDimensionInfo)||[]).map((function(t){var e,n=null===(e=t.qCardinalities)||void 0===e?void 0:e.qHypercubeCardinal;if(n)return n;var i=t.qStateCounts||{},r=i.qLocked,o=void 0===r?0:r,a=i.qOption,s=void 0===a?0:a,l=i.qSelected;return o+s+(void 0===l?0:l)}))}function Ae(t){switch(t.qHyperCube.qMode){case"S":return function(t){var e=t.qHyperCube.qSize;return{refs:{dataPages:"qHyperCube.qDataPages"},size:{x:e.qcx,y:e.qcy,dimensions:Re(t)}}}(t);case"K":return function(t){var e=Re(t);return{refs:{dataPages:"qHyperCube.qStackedDataPages"},size:{x:t.qHyperCube.qSize.qcx,y:e[0],dimensions:e}}}(t);case"T":return function(t){var e=Re(t);return{refs:{dataPages:"qHyperCube.qTreeDataPages"},size:{x:t.qHyperCube.qSize.qcx,y:e[0],dimensions:e}}}(t);default:throw new Error("Mode not supported")}}function Ce(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function De(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=ze)):void 0===e&&(e=Oe);for(var n,i,r,o,a,s=new Te(t),l=[s];n=l.pop();)if((r=e(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new Te(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(Ie)}function Oe(t){return t.children}function ze(t){return Array.isArray(t)?t[1]:null}function Ee(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Ie(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Te(t){this.data=t,this.depth=this.height=0,this.parent=null}Te.prototype=De.prototype={constructor:Te,count:function(){return this.eachAfter(Ce)},each:function(t,e){let n=-1;for(const i of this)t.call(e,i,++n,this);return this},eachAfter:function(t,e){for(var n,i,r,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(t.call(e,r,++a,this),n=r.children)for(i=n.length-1;i>=0;--i)o.push(n[i]);return this},find:function(t,e){let n=-1;for(const i of this)if(t.call(e,i,++n,this))return i},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return De(this).eachBefore(Ee)},[Symbol.iterator]:function*(){var t,e,n,i,r=this,o=[r];do{for(t=o.reverse(),o=[];r=t.pop();)if(yield r,e=r.children)for(n=0,i=e.length;n<i;++n)o.push(e[n])}while(o.length)}},_e=function(t){
8
+ /*! javascript-number-formatter - v1.1.11 - http://mottie.github.com/javascript-number-formatter/ * © ecava */
9
+ t.exports=function(t,e){if(!t||isNaN(+e))return e;var n,i,r,o,a,s,l,c,u,h,d=t.length,f=t.search(/[0-9\-\+#]/),p=f>0?t.substring(0,f):"",g=t.split("").reverse().join(""),m=g.search(/[0-9\-\+#]/),y=d-m,x=t.substring(y,y+1),v=y+("."===x||","===x?1:0),b=m>0?t.substring(v,d):"";if(n=(e="-"===(t=t.substring(f,v)).charAt(0)?-e:+e)<0?e=-e:0,r=(i=t.match(/[^\d\-\+#]/g))&&i[i.length-1]||".",o=i&&i[1]&&i[0]||",",t=t.split(r),e=+(e=e.toFixed(t[1]&&t[1].length))+"",s=t[1]&&t[1].lastIndexOf("0"),(!(c=e.split("."))[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),u=t[0].split(o),t[0]=u.join(""),(a=t[0]&&t[0].indexOf("0"))>-1)for(;c[0].length<t[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((e=e.split("."))[0]=c[0],l=u[1]&&u[u.length-1].length){for(g="",y=(h=e[0]).length%l,d=h.length,v=0;v<d;v++)g+=h.charAt(v),!((v-y+1)%l)&&v<d-l&&(g+=o);e[0]=g}return e[1]=t[1]&&e[1]?r+e[1]:"","0"!==(i=e.join(""))&&""!==i||(n=!1),p+(n?"-":"")+i+b}},_e({exports:{}});var Pe="'Source Sans Pro', 'Arial', 'sans-serif'",qe="#333333",Le="#595959",je="#737373",Fe="#cccccc",Be="#e6e6e6";function Ve(t){var e={};return[].concat(x(t),x([["","","color"],["object","","fontFamily"],["object","axis.label.name","color",Le],["object","axis.label.name","fontFamily",Pe],["object","axis.label.name","fontSize","12px"],["object","axis.line.major","color",Fe],["object","axis.line.minor","color",Be],["object","axis.title","color"],["object","axis.title","fontFamily",Pe],["object","axis.title","fontSize","13px"],["object","grid.line.highContrast","color",Be],["object","grid.line.major","color",Fe],["object","grid.line.minor","color",Be],["object","label.value","color",Le],["object","label.value","fontFamily",Pe],["object","label.value","fontSize","12px"],[!1,"label.value","darkColor",Le],[!1,"label.value","lightColor",Be],["object","outOfRange","color","#999"],["object","legend.title","color",qe],["object","legend.title","fontFamily",Pe],["object","legend.title","fontSize","15px"],["object","legend.label","color",Le],["object","legend.label","fontFamily",Pe],["object","legend.label","fontSize","13px"],["object","referenceLine.label.name","color",qe],["object","referenceLine.label.name","fontFamily",Pe],["object","referenceLine.label.name","fontSize","12px"],["object","referenceLine.outOfBounds","color",Be],["object","referenceLine.outOfBounds","fontFamily",Pe],["object","referenceLine.outOfBounds","fontSize","12px"],["object","referenceLine.outOfBounds","backgroundColor",je,function(t){return"transparent"===t?je:t}]])).reduce((function(t,n){var i="".concat(n[0],"-").concat(n[1],"-").concat(n[2],"}");return e[i]||(e[i]=!0,t.push(n)),t}),[]).sort((function(t,e){return(t[0].split?t[0].split(".").length:0)-(e[0].split?e[0].split(".").length:0)}))}var $e=function(t){return t};function He(t){var e=t.theme,n=t.id,i=t.transform,r=t.extend,o=t.matrix,a={},s=i.reduce((function(t,e){var n=y(e,2),i=n[0],r=n[1];return t[i]=r,t}),{});return o.forEach((function(t){var i=y(t,5),r=i[0],o=i[1],l=i[2],c=i[3],u=i[4],h=void 0===u?function(t){return t}:u,d=function(t){var e=t.theme,n=t.base,i=t.path,r=t.attribute,o=t.defaultValue,a=void 0===o?void 0:o;if(!e||!1===n)return a;var s=e.getStyle(n,i,r);return void 0===s?a:s}({theme:e,base:"object"===r&&n?"".concat("object",".").concat(n):r,path:o,attribute:l,defaultValue:c}),f=(s["".concat(o,".").concat(l)]||$e)(h(d));ke(a,[o,l].filter(Boolean).join("."),f)})),r.forEach((function(t){var e=y(t,2),n=e[0],i=e[1];ke(a,n,i)})),a}const We=(t,e,n)=>{const i=function(t){var e=t.theme,n=t.translator,i=t.config,r=void 0===i?{}:i,o=t.flags,a=function(t){var e=t.config,n=void 0===e?{}:e,i=n.id,r=n.paths;return{id:void 0===i?"object":"".concat("object",".").concat(i),paths:Array.isArray(r)?r:[]}}({config:r}),s=a.id,l=a.paths,c={};l.forEach((function(t){for(var i=t.split("."),r=c,a=0;a<i.length;a++){var l=i[a];a===i.length-1?r[l]=O({theme:e,translator:n,id:s,path:t,flags:o}):void 0===r[l]&&(r[l]={}),r=r[l]}}));var u=function(t){for(var e=t.split("."),n=c,i=0;i<e.length;i++){var r=e[i];if(void 0===n[r])throw new Error("font-resolver: Path '".concat(t,"' could not be resolved."));n=n[r]}return n};return c.getDefaultValue=function(t){return u(t).getDefaultValue()},c.getOptions=function(t){return u(t).getOptions()},c}({theme:n,translator:e,flags:t,config:{id:"gauge",paths:["axis.title","axis.label.name","label.value"]}});return{component:"styling-panel",chartTitle:"Object.Gauge",translation:"LayerStyleEditor.component.styling",useBackground:!0,subtitle:"LayerStyleEditor.component.styling",ref:"components",useGeneral:!0,items:{axisTitleSection:{translation:"properties.axis.title",component:"panel-section",items:{labelSection:{component:"items",ref:"components",key:"axis",items:{fontWrapper:{component:"inline-wrapper",items:{fontFamily:{ref:"axis.title.fontFamily",component:"dropdown",options:()=>i.getOptions("axis.title.fontFamily"),defaultValue:()=>i.getDefaultValue("axis.title.fontFamily")},fontColor:{ref:"axis.title.color",component:"color-picker",defaultValue:()=>({color:n.getStyle("object.gauge","axis.title","color")}),width:!1}}}}}}},axisLabelSection:{translation:"properties.axis.label",component:"panel-section",items:{labelSection:{component:"items",ref:"components",key:"axis",items:{fontWrapper:{component:"inline-wrapper",items:{fontFamily:{ref:"axis.label.name.fontFamily",component:"dropdown",options:()=>i.getOptions("axis.label.name.fontFamily"),defaultValue:()=>i.getDefaultValue("axis.label.name.fontFamily"),width:!0},fontColor:{ref:"axis.label.name.color",component:"color-picker",defaultValue:()=>({color:n.getStyle("object.gauge","axis.label.name","color")}),width:!1}}}}}}},valueLabelSection:{translation:"properties.value.label",component:"panel-section",items:{labelSection:{component:"items",ref:"components",key:"value",items:{fontWrapper:{component:"inline-wrapper",items:{fontFamily:{ref:"label.value.fontFamily",component:"dropdown",options:()=>i.getOptions("label.value.fontFamily"),defaultValue:()=>i.getDefaultValue("label.value.fontFamily"),width:!0},fontColor:{ref:"label.value.color",component:"color-picker",defaultValue:()=>({color:n.getStyle("object.gauge","label.value","color")}),width:!1}}}}}}}}}};function Ue(t){return"measure"===we(t,"color.useBaseColors")}function Ye(t){const{flags:e,translator:n,sense:i}=t,r=i.theme,o={items:{labels:{items:{header:{show(t){var e;return null===(e=t.qHyperCubeDef.qMeasures)||void 0===e?void 0:e.length}},measureTitle:{component:"checkbox",ref:"measureAxis.show",type:"string",translation:"Simple.Label.Measure.Hide",defaultValue:"all",show(t){var e;return null===(e=t.qHyperCubeDef.qMeasures)||void 0===e?void 0:e.length},convertFunctions:{get:(t,e,n,i)=>"labels"===i.measureAxis.show||"none"===i.measureAxis.show,set(t,e,n,i,r){r.measureAxis.show=t?"labels":"all"}}}}}}};return{definition:{type:"items",component:"accordion",items:{data:{uses:"data"},addons:{type:"items",component:"expandable-items",translation:"properties.addons",items:{dataHandling:{uses:"dataHandling",items:{suppressZero:null,calcCond:{uses:"calcCond"}}},refLines:{uses:"reflines",items:{colorBackground:{show:!1}}}}},settings:{type:"items",uses:"settings",component:"expandable-items",translation:"Common.Appearance",items:{simpleLabels:o,presentation:{type:"items",grouped:!0,translation:"properties.presentation",items:{styleEditor:We(e,n,r),rangeLimits:{type:"items",items:{text:{component:"text",translation:"properties.axis.rangeLimits",style:"sHeader"},min:{ref:"measureAxis.min",translation:"properties.axis.min",type:"number",expression:"optional",invalid:t=>t.measureAxis&&t.measureAxis.min>=t.measureAxis.max},max:{ref:"measureAxis.max",translation:"Common.Max",type:"number",expression:"optional",defaultValue:100,invalid:t=>t.measureAxis&&t.measureAxis.min>=t.measureAxis.max}}},type:{ref:"gaugetype",type:"string",component:"item-selection-list",defaultValue:"radial",horizontal:!0,items:[{icon:"gauge_gauge",component:"icon-item",labelPlacement:"bottom",translation:"properties.gauge.radial",value:"radial"},{icon:"gauge_vertical_bar",component:"icon-item",labelPlacement:"bottom",translation:"properties.gauge.bar",value:"bar"}]},autoOrientation:{ref:"autoOrientation",translation:"properties.orientation",type:"boolean",defaultValue:!0,component:"switch",undefinedValue:!1,options:[{value:!0,translation:"Common.Auto"},{value:!1,translation:"Common.Custom"}],show:t=>"bar"===t.gaugetype},orientation:{ref:"orientation",type:"string",component:"item-selection-list",defaultValue:"horizontal",horizontal:!0,items:[{component:"icon-item",icon:"direction_up_down",labelPlacement:"bottom",translation:"properties.orientation.vertical",value:"vertical"},{icon:"direction_left_right",component:"icon-item",labelPlacement:"bottom",translation:"Common.Horizontal",value:"horizontal"}],show:t=>"bar"===t.gaugetype&&!t.autoOrientation},angle:{ref:"angle",translation:"properties.gauge.angle",type:"number",component:"slider",min:.2,max:.98,step:.1,defaultValue:.7,show:()=>!1},segments:{type:"items",items:{useSegments:{ref:"useSegments",type:"boolean",component:"switch",defaultValue:!1,translation:"properties.gauge.useSegments",change(t){const e=(n=t.segmentInfo).paletteColors&&n.paletteColors.length?n.paletteColors:n.colors&&n.colors.length?n.colors:void 0;var n;e&&(t.useSegments&&1===e.length?t.segmentInfo.paletteColors=[t.paletteProgressColor||t.progressColor]:t.paletteProgressColor=e[0])},options:[{value:!1,translation:"properties.off"},{value:!0,translation:"properties.on"}]},useBaseColor:{ref:"color.useBaseColors",type:"string",defaultValue:"measure",translation:"properties.useLibraryMeasureColors",component:"switch",show:t=>(t.color||(t.color={}),t.color.useBaseColors||(t.color.useBaseColors="off"),!0),options:[{value:"off",translation:"properties.off"},{value:"measure",translation:"properties.on"}]},paletteProgressColor:{component:"color-picker",translation:"properties.color",ref:"paletteProgressColor",type:"object",dualOutput:!0,defaultValue:()=>{var t;if(!r)return-1;const{primary:e}=r.getDataColorSpecials(),n=null===(t=r.getDataColorPickerPalettes()[0])||void 0===t?void 0:t.colors,i=n.indexOf(e);return{index:-1===i?Math.min(6,n.length-1):i}},show:t=>!Ue(t)&&!t.useSegments},maxSegments:{ref:"maxSegments",type:"number",defaultValue:6,show:!1},segmentInfo:{ref:"segments",type:"items",component:"color-scale-creator",show:t=>!Ue(t)&&t.useSegments,items:{limits:{ref:"segmentInfo.limits",type:"array",items:{value:{ref:"value",type:"number",expression:"optional",invalid:(t,e)=>"number"==typeof t.value&&(t.value<e.measureAxis.min||t.value>e.measureAxis.max),defaultValue:1},gradient:{translation:"properties.gradient",ref:"gradient",type:"boolean",show:!1}}},paletteColors:{items:{color:{ref:"color",type:"string"},index:{ref:"index",type:"integer",defaultValue:6}},type:"array",ref:"segmentInfo.paletteColors"}}}}},disclaimerClosed:{ref:"disclaimerClosed",type:"boolean",defaultValue:!1,show:!1}}},measureAxis:{type:"items",translation:"properties.measureAxis",grouped:!0,items:{axis:{type:"items",snapshot:{title:"properties.measureAxis",tid:"property-yAxis"},items:{show:{ref:"measureAxis.show",translation:"properties.axis.labelsAndTitle",type:"string",component:"dropdown",options:[{value:"all",translation:"properties.axis.show.all"},{value:"labels",translation:"properties.axis.show.labels"},{value:"title",translation:"properties.axis.show.title"},{value:"none",translation:"Common.None"}],defaultValue:"all"},spacing:{ref:"measureAxis.spacing",translation:"properties.axis.scale",type:"number",component:"dropdown",defaultValue:1,show:t=>t.measureAxis&&"none"!==t.measureAxis.show&&"title"!==t.measureAxis.show,options:[{value:2,translation:"properties.gridLine.wide"},{value:1,translation:"properties.gridLine.medium"},{value:.5,translation:"properties.gridLine.narrow"}]}}}}}}}}},support:{cssScaling:!1,snapshot:!0,export:!0,sharing:!0,exportData:!0,viewData:!0}}}function Xe(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ge(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Ke(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ge(Object(n),!0).forEach((function(e){Xe(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Ze=Object.prototype.hasOwnProperty,Je=Object.prototype.toString,Qe=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,en=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Je.call(t)},nn=function(t){if(!t||"[object Object]"!==Je.call(t))return!1;var e,n=Ze.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Ze.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Ze.call(t,e)},rn=function(t,e){Qe&&"__proto__"===e.name?Qe(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},on=function(t,e){if("__proto__"===e){if(!Ze.call(t,e))return;if(tn)return tn(t,e).value}return t[e]},an=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=on(s,n),s!==(r=on(e,n))&&(u&&r&&(nn(r)||(o=en(r)))?(o?(o=!1,a=i&&en(i)?i:[]):a=i&&nn(i)?i:{},rn(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&rn(s,{name:n,newValue:r}));return s};function sn(t,e,n,i){if(!t)return-1;const r=n.cache,o=t.origin?t.origin():null;o&&(t=o);let a=r.fields.indexOf(t),s=-1,l=-1;if(-1===a)for(let e=0;e<r.wrappedFields.length;e++)if(l=r.wrappedFields[e].attrDims.map((t=>t.instance)).indexOf(t),s=r.wrappedFields[e].attrExps.map((t=>t.instance)).indexOf(t),-1!==l||-1!==s){a=e;break}if(Array.isArray(i)&&i.some(((t,e)=>t!==e))){const t=i.indexOf(a);-1!==t&&(a=t)}return a-=e.qArea.qLeft,a<0||a>=e.qArea.qWidth?-1:l>=0?t=>t[a].qAttrDims.qValues[l]:s>=0?t=>t[a].qAttrExps.qValues[s]:t=>t[a]}function ln(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function cn(t){let{cache:e,f:n,mainCell:i,p:r,prop:o,page:a,rowIdx:s,row:l,sourceKey:c,target:u,targetProp:h,columnOrder:d}=t,f=i;if(r.field&&r.field!==n){const t=sn(r.field,a,{cache:e},d);if(-1===t)return;f=an({qRow:s},t(l))}u[h]=ln(r,f,{key:c})}function un(t,e,n,i){const r=Array.isArray(t)?t:[t];let o=[];for(let t=0;t<r.length;t++)if(void 0!==r[t].field){const a=e.raw(),s=e.key(),l="object"==typeof r[t].field?r[t].field:e.field(r[t].field),{props:c,main:u}=i.normalizeConfig(r[t],e),h=Object.keys(c),d=!!r[t].trackBy,f=typeof r[t].trackBy,p={},g=[],m=[];for(let e=0;e<a.qDataPages.length;e++){const o=sn(l,a.qDataPages[e],{cache:n},a.qColumnOrder);if(-1!==o)for(let y=0;y<a.qDataPages[e].qMatrix.length;y++){const x=a.qDataPages[e].qArea.qTop+y,v=an({qRow:x},o(a.qDataPages[e].qMatrix[y])),b=ln(u,v,{key:s});if(!(u.filter&&!u.filter(v))){for(let t=0;t<h.length;t++){const i=c[h[t]];let r=i.fields||[i];i.fields&&(b[h[t]]=[]);for(let o=0;o<r.length;o++)cn({cache:n,f:l,mainCell:v,p:r[o],prop:h[t],props:c,page:a.qDataPages[e],rowIdx:x,row:a.qDataPages[e].qMatrix[y],sourceKey:s,target:i.fields?b[h[t]]:b,targetProp:i.fields?o:h[t],columnOrder:a.qColumnOrder});if(i.fields){const e=b[h[t]].map((t=>t.value)),n=b[h[t]].map((t=>t.label));b[h[t]]={value:"function"==typeof i.value?i.value(e):void 0!==i.value?i.value:e,label:"function"==typeof i.label?i.label(n):void 0!==i.label?String(i.label):String(b[h[t]].value)}}}d&&i.track({cfg:r[t],itemData:v,obj:b,target:g,tracker:p,trackType:f}),m.push(b)}}}const y=d?i.collect(g,{main:u,propsArr:h,props:c}):m;o=[...o,...y]}return o}function hn(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function dn(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=pn)):void 0===e&&(e=fn);for(var n,i,r,o,a,s=new yn(t),l=[s];n=l.pop();)if((r=e(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new yn(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(mn)}function fn(t){return t.children}function pn(t){return Array.isArray(t)?t[1]:null}function gn(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function mn(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function yn(t){this.data=t,this.depth=this.height=0,this.parent=null}function xn(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}yn.prototype=dn.prototype={constructor:yn,count:function(){return this.eachAfter(hn)},each:function(t,e){let n=-1;for(const i of this)t.call(e,i,++n,this);return this},eachAfter:function(t,e){for(var n,i,r,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(t.call(e,r,++a,this),n=r.children)for(i=n.length-1;i>=0;--i)o.push(n[i]);return this},find:function(t,e){let n=-1;for(const i of this)if(t.call(e,i,++n,this))return i},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;t=n.pop(),e=i.pop();for(;t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return dn(this).eachBefore(gn)},[Symbol.iterator]:function*(){var t,e,n,i,r=this,o=[r];do{for(t=o.reverse(),o=[];r=t.pop();)if(yield r,e=r.children)for(n=0,i=e.length;n<i;++n)o.push(e[n])}while(o.length)}};var vn={depth:-1},bn={},wn={};function Mn(t){return t.id}function kn(t){return t.parentId}function _n(){var t,e=Mn,n=kn;function i(i){var r,o,a,s,l,c,u,h,d=Array.from(i),f=e,p=n,g=new Map;if(null!=t){const e=d.map(((e,n)=>function(t){t=`${t}`;let e=t.length;Nn(t,e-1)&&!Nn(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,i)))),n=e.map(Sn),r=new Set(e).add("");for(const t of n)r.has(t)||(r.add(t),e.push(t),n.push(Sn(t)),d.push(wn));f=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,r=d.length;a<r;++a)o=d[a],c=d[a]=new yn(o),null!=(u=f(o,a,i))&&(u+="")&&(h=c.id=u,g.set(h,g.has(h)?bn:c)),null!=(u=p(o,a,i))&&(u+="")&&(c.parent=u);for(a=0;a<r;++a)if(u=(c=d[a]).parent){if(!(l=g.get(u)))throw new Error("missing: "+u);if(l===bn)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=t){for(;s.data===wn&&1===s.children.length;)s=s.children[0],--r;for(let t=d.length-1;t>=0&&(c=d[t]).data===wn;--t)c.data=null}if(s.parent=vn,s.eachBefore((function(t){t.depth=t.parent.depth+1,--r})).eachBefore(mn),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(t){return arguments.length?(e=xn(t),i):e},i.parentId=function(t){return arguments.length?(n=xn(t),i):n},i.path=function(e){return arguments.length?(t=xn(e),i):t},i}function Sn(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Nn(t,e););return t.slice(0,e)}function Nn(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}function Rn(t,e){"/"===t.charAt(0)&&(t=t.substring(1));const n=t.split("/");let i,r=e;for(let t=0;t<n.length;t++){if("*"===n[t]&&Array.isArray(r)){const e=[];i=n.slice(t+1).join("/");for(let t=0;t<r.length;t++){let n=Rn(i,r[t]);Array.isArray(n)?e.push(...n):e.push(n)}return e}if(!n[t]&&Array.isArray(r)){const e=new Array(r.length);i=n.slice(t+1).join("/");for(let t=0;t<r.length;t++)e[t]=Rn(i,r[t]);return e}n[t]in r&&(r=r[n[t]])}return r}function An(t,e,n){let i=[];if(!t||!t.length)return i;if(e<=0){const e=n>=0?[t[n]]:t;i=[...i,...e]}else for(let r=0;r<t.length;r++)t[r].children&&t[r].children.length&&(i=[...i,...An(t[r].children,e-1,n)]);return i}function Cn(t,e,n){if(t===e)return t=>t;if(t>e){const n=Math.max(0,Math.min(100,t-e));return t=>{let e=t;for(let t=0;t<n;++t)e=e.parent;return e}}if(e>t){const i=Math.max(0,Math.min(100,e-t));return t=>An(t.children,i-1,n)}return!1}const Dn=/^qDimensionInfo(?:\/(\d+))?/,On=/^\/?qMeasureInfo\/(\d+)/,zn=/\/qAttrExprInfo\/(\d+)/,En=/\/qAttrDimInfo\/(\d+)/;function In(t){return(t.qColumnOrder&&t.qColumnOrder.length?t.qColumnOrder:t.qDimensionInfo.map(((t,e)=>e))).filter((e=>e<t.qDimensionInfo.length))}function Tn(t,e){let{cube:n}=e;if(!t)return-1;let i=t.origin&&t.origin()?t.origin().key():t.key(),r=!1,o=-1,a=-1,s=-1,l=-1,c=-1,u=-1,h=i;const d=n.qEffectiveInterColumnSortOrder,f=In(n);return Dn.test(h)&&(r=!0,o=+Dn.exec(h)[1],h=i.replace(Dn,"")),On.test(h)&&("K"===n.qMode?c=+On.exec(h)[1]:d&&-1!==d.indexOf(-1)?(c=+On.exec(h)[1],u=0):u=+On.exec(h)[1],h=h.replace(On,"")),h&&(En.exec(h)?s=+En.exec(h)[1]:zn.exec(h)&&(a=+zn.exec(h)[1])),l=r?"S"===n.qMode?f[o]:d?d.indexOf(o):o:d&&-1!==d.indexOf(-1)?d.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1),{fieldDepth:l+1,pseudoMeasureIndex:c,measureIdx:u,attrDimIdx:s,attrIdx:a}}function Pn(t,e){let n,i,r=Cn(t.fieldDepth,e.fieldDepth,e.pseudoMeasureIndex);return n=e.measureIdx>=0?t=>t.data.qValues[e.measureIdx]:t=>t.data,e.attrDimIdx>=0?i=t=>{var n;return null==t||null===(n=t.qAttrDims)||void 0===n?void 0:n.qValues[e.attrDimIdx]}:e.attrIdx>=0&&(i=t=>{var n;return null==t||null===(n=t.qAttrExps)||void 0===n?void 0:n.qValues[e.attrIdx]}),{nodeFn:r,attrFn:i,valueFn:n}}function qn(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function Ln(t){let{propsArr:e,props:n,item:i,itemData:r,ret:o,sourceKey:a}=t;for(let t=0;t<e.length;t++){const s=n[e[t]],l=s.fields||[s];let c,u;s.fields&&(c=[],u=[]);for(let n=0;n<l.length;n++){const h=l[n];let d,f,p,g,m,y;if("primitive"===h.type?(p=h.value,y=String(h.value)):("function"==typeof h.value&&(d=t=>h.value(t,i)),"function"==typeof h.label&&(f=t=>h.label(t,i)),h.accessor?(g=h.accessor(i),Array.isArray(g)?(m=g.map(h.valueAccessor),h.attrAccessor&&(m=m.map(h.attrAccessor)),d&&(p=m.map(d),d=null),f&&(y=m.map(f),f=null),p=h.reduce?h.reduce(p):p,y=h.reduceLabel?h.reduceLabel(y,p):String(p)):(p=h.attrAccessor?h.attrAccessor(h.valueAccessor(g)):h.valueAccessor(g),y=p)):(p=r,y=r)),s.fields){const t=d?d(p):p;c.push(t),u.push(f&&null!=y?f(y):null!=y?y:String(t))}else{const n=d?d(p):p;o[e[t]]={value:n,label:f?f(y):null!=y?y:String(n)},h.field&&(o[e[t]].source={field:h.field.key(),key:a})}}c&&(o[e[t]]={value:"function"==typeof s.value?s.value(c,i):c,label:"function"==typeof s.label?s.label(u,i):u})}}const jn=(t,e,n)=>{const i="K"===t.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",r="K"===t.qMode?"qSubNodes":"qNodes",o=Rn(i,t);return o&&o[0]?(e.tree=dn(o[0],n.children||(t=>t[r])),e.tree):null};const Fn=t=>{let{propsArr:e,props:n,cube:i,cache:r,itemDepthObject:o,f:a}=t;for(let t=0;t<e.length;t++){const s=n[e[t]],l=s.fields?s.fields:[s];for(let t=0;t<l.length;t++){const e=l[t];if(e.field!==a){const t=Pn(o,Tn(e.field,{cube:i,cache:r}));e.accessor=t.nodeFn,e.valueAccessor=t.valueFn,e.attrAccessor=t.attrFn}}}};function Bn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;const r=e.raw(),o=e.key(),a="S"===r.qMode?function(t){const e=t.raw().qDataPages.length?t.raw().qDataPages[0].qMatrix:[],n=function(t){const e=t.raw().qColumnOrder,n=t.fields();return e&&e.length===n.length?e:n.map(((t,e)=>e))}(t),i=t.fields(),r=t.fields().filter((t=>"dimension"===t.type())).map((t=>n.indexOf(i.indexOf(t)))),o=t.fields().filter((t=>"measure"===t.type())).map((t=>n.indexOf(i.indexOf(t)))),a={__root:{__id:"__root",qValues:[]}};for(let t=0;t<e.length;t++){const n=e[t];let i="__root",l=!1;for(let t=0;t<r.length;t++){var s;const e=n[r[t]],o="".concat(i,"__").concat(null!==(s=e.qElemNumber)&&void 0!==s?s:e.qElemNo);a[o]||(a[o]=Ke({__id:o,__parent:i,qValues:[]},e),l=!0),i=o}if(l)for(let t=0;t<o.length;t++){const e=n[o[t]];a[i].qValues.push(e)}}const l=Object.keys(a).map((t=>a[t])),c=_n().id((t=>t.__id)).parentId((t=>t.__parent))(l);return c}(e):jn(r,n,t);if(!a)return null;const s=a.height,l=[];for(let o=0;o<=s;o++){let a=null;if(o>0)if("S"===r.qMode){let t=In(r)[o-1];a=n.fields[t]}else{let t=r.qEffectiveInterColumnSortOrder[o-1];o>r.qEffectiveInterColumnSortOrder.length&&(t=r.qDimensionInfo.length),a=n.fields[t]}const{props:s,main:c}=i.normalizeConfig(Ke(Ke({},t),{},{field:a?a.key():void 0}),e),u=Object.keys(s);l[o]={propsArr:u,props:s,main:c};const h=a?Tn(a,{cube:r,cache:n}):{fieldDepth:0};Fn({propsArr:u,props:s,cube:r,cache:n,itemDepthObject:h,f:a})}const c=a.copy().descendants(),u=a.descendants();for(let t=0;t<u.length;t++){const e=l[u[t].depth].propsArr,n=l[u[t].depth].props,i=l[u[t].depth].main,r=c[t],a=r.data,s=qn(i,a,{key:o});Ln({propsArr:e,props:n,item:r,itemData:a,ret:s,sourceKey:o,isTree:!0}),u[t].data=s}return a}function Vn(t,e,n,i){const r=Array.isArray(t)?t:[t];let o=[];for(let a=0;a<r.length;a++)if(void 0!==r[a].field){const s=e.raw(),l=e.key();if(!jn(s,n,t))continue;const c="object"==typeof r[a].field?r[a].field:e.field(r[a].field),{props:u,main:h}=i.normalizeConfig(r[a],e),d=Object.keys(u),f=Tn(c,{cube:s,cache:n}),{nodeFn:p,attrFn:g,valueFn:m}=Pn({fieldDepth:0},f);Fn({propsArr:d,props:u,cube:s,cache:n,itemDepthObject:f,f:c});const y=!!r[a].trackBy,x=typeof r[a].trackBy,v={},b=[],w=p(n.tree),M=[];for(let t=0;t<w.length;t++){const e=w[t],n=g?g(m(e)):m(e);if(h.filter&&!h.filter(n))continue;const o=qn(h,n,{key:l});Ln({propsArr:d,props:u,item:e,itemData:n,ret:o,sourceKey:l}),y&&i.track({cfg:r[a],itemData:n,obj:o,target:b,tracker:v,trackType:x}),M.push(o)}const k=y?i.collect(b,{main:h,propsArr:d,props:u}):M;o=[...o,...k]}return o}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var $n=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){
10
+ /*! javascript-number-formatter - v1.1.11 - http://mottie.github.com/javascript-number-formatter/ * © ecava */
11
+ t.exports=function(t,e){if(!t||isNaN(+e))return e;var n,i,r,o,a,s,l,c,u,h,d=t.length,f=t.search(/[0-9\-\+#]/),p=f>0?t.substring(0,f):"",g=t.split("").reverse().join(""),m=g.search(/[0-9\-\+#]/),y=d-m,x=t.substring(y,y+1),v=y+("."===x||","===x?1:0),b=m>0?t.substring(v,d):"";if(n=(e="-"===(t=t.substring(f,v)).charAt(0)?-e:+e)<0?e=-e:0,r=(i=t.match(/[^\d\-\+#]/g))&&i[i.length-1]||".",o=i&&i[1]&&i[0]||",",t=t.split(r),e=+(e=e.toFixed(t[1]&&t[1].length))+"",s=t[1]&&t[1].lastIndexOf("0"),(!(c=e.split("."))[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),u=t[0].split(o),t[0]=u.join(""),(a=t[0]&&t[0].indexOf("0"))>-1)for(;c[0].length<t[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((e=e.split("."))[0]=c[0],l=u[1]&&u[u.length-1].length){for(g="",y=(h=e[0]).length%l,d=h.length,v=0;v<d;v++)g+=h.charAt(v),!((v-y+1)%l)&&v<d-l&&(g+=o);e[0]=g}return e[1]=t[1]&&e[1]?r+e[1]:"","0"!==(i=e.join(""))&&""!==i||(n=!1),p+(n?"-":"")+i+b}}));function Hn(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}const Wn={3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",24:"Y","-3":"m","-6":"μ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},Un=/%\)?$/,Yn=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Xn=/^\(oct\)/i,Gn=/^\(dec\)/i,Kn=/^\(hex\)/i,Zn=/^\(bin\)/i,Jn=/^\(rom\)/i,Qn=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,ti=/#|0/g;function ei(t,e,n,i){return t=t.toString(e),n[1]===n[1].toUpperCase()&&(t=t.toUpperCase()),t.length-t.indexOf(".")>10&&(t=t.slice(0,t.indexOf(".")+11)),t.replace(".",i||".")}function ni(t,e,n){let i;return Yn.test(e)?t=ei(t,Number(/\d{2}/.exec(e)[0]),e,n):Xn.test(e)?t=ei(t,8,e,n):Gn.test(e)?t=ei(t,10,e,n):Kn.test(e)?t=ei(t,16,e,n):Zn.test(e)?t=ei(t,2,e,n):Jn.test(e)&&(i="",t<0&&(i="-",t=-t),0===(t=Math.floor(t))?t="0":t<=5e5?(t=function(t,e){let n,i="",r=Number(String(t).slice(-3)),o=(t-r)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),s=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();for(;r>0;)for(n=0;n<a.length;n++)if(a[n]<=r){i+=s[n],r-=a[n];break}for(n=0;n<o;n++)i="M".concat(i);return e[1]!==e[1].toUpperCase()&&(i=i.toLowerCase()),i}(t,e),t=i+t):t=e+i+t.toExponential(0)),t}function ii(t,e,n){const i=Hn(t);return n?i:new RegExp(i||"",e)}function ri(t,e,n,i){let r,o,a,s,l,c,u,h,d,f=t.pattern;var p,g;i&&(t.abbreviate=!0),p=e,(g=n)&&(g=Hn(g)),p&&(p=Hn(p)),d=new RegExp("(?:[#0]+".concat(p,")?[#0]+(?:").concat(g,"[#0]+)?")),a=f.match(d),a=a?a[0]:"",s=a?f.substr(0,f.indexOf(a)):f,l=a?f.substring(f.indexOf(a)+a.length):"",a||(a=f?"#":"##########"),e&&e===n&&(r=a.split(n),o=r.pop(),a=r.join("")+n+o,e=""),c=e,e=/,/.test(n)?"¤":",",c&&(a=a.replace(ii(c,"g"),e)),u=n,n=".",u&&(a=a.replace(ii(u,"g"),n)),h=a.match(/#/g),h=h?h.length:0;const m=f.split(u);let y;m[1]&&(y=m[1].match(ti)),t.prefix=s||"",t.postfix=l||"",t.pattern=f,t.maxPrecision=y?y.length:2,t.percentage=Un.test(f),t.numericPattern=a||"",t.numericRegex=new RegExp("".concat(ii(e,null,!0),"|").concat(ii(n,null,!0)),"g"),t.groupTemp=c,t.decTemp=u,t.t=e,t.d=n,t.temp=h}class oi{constructor(t,e,n,i,r){this.localeInfo=t,this.pattern=e,this.thousandDelimiter=n||",",this.decimalDelimiter=i||".",this.type=r||"numeric",this.patternSeparator=";",this.abbreviations=function(t,e){if(!t||!t.qNumericalAbbreviation)return Wn;const n={};return t.qNumericalAbbreviation.split(e).forEach((t=>{let e=t.split(":");2===e.length&&(n[e[0]]=e[1])})),n}(t,this.patternSeparator),this.prepare()}clone(){const t=new oi(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return t.subtype=this.subtype,t}format(t,e,n,i){return this.prepare(e,n,i),this.formatValue(t)}prepare(t,e,n){let i;if(void 0===t&&(t=this.pattern),void 0===e&&(e=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),!t)return void(this._prepared={pattern:!1});this._prepared={positive:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},i=this._prepared,t=t.split(this.patternSeparator),i.positive.pattern=t[0],i.negative.pattern=t[1],i.zero.pattern=t[2],Qn.test(t[0])&&(i.positive.isFunctional=!0),t[1]?Qn.test(t[1])&&(i.negative.isFunctional=!0):i.negative=!1,t[2]?Qn.test(t[2])&&(i.zero.isFunctional=!0):i.zero=!1;const r="U"===this.type;i.positive.isFunctional||ri(i.positive,e,n,r),i.negative&&!i.negative.isFunctional&&ri(i.negative,e,n,r),i.zero&&!i.zero.isFunctional&&ri(i.zero,e,n,r)}formatValue(t){let e,n,i,r,o,a,s,l,c,u=this._prepared,h="",d="",f=t;if(isNaN(t))return"".concat(f);if(t=+t,!1===u.pattern)return t.toString();if(0===t&&u.zero)return u=u.zero,u.pattern;if(t<0&&u.negative?(u=u.negative,t=-t):u=u.positive,o=u.d,a=u.t,u.isFunctional)t=ni(t,u.pattern,o);else{if(u.percentage&&(t*=100),u.abbreviate){const e=Object.keys(this.abbreviations).map((t=>parseInt(t,10))).sort(((t,e)=>t-e));let i,r,o=e[0];for(s=0,n=Number(Number(t).toExponential().split("e")[1]);o<=n&&s<e.length;)s++,o=e[s];s>0&&(i=e[s-1]),i&&n>0&&i>0?r=i:(n<0&&i<0||!i)&&(o<0&&o-n<=u.maxPrecision?r=o:i<=n&&!(o>0&&-n<=u.maxPrecision)&&(r=i)),r&&(h=this.abbreviations[r],t/=10**r)}if(i=Math.abs(t),e=u.temp,l=u.numericPattern,c=l.split(o)[1],"I"===this.type&&(t=Math.round(t)),r=t,c||"#"!==l.slice(-1)[0])if(i>=1e15||i>0&&i<=1e-14)t=i?i.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{const e=Number((t+1e-15*(t<0?-1:1)).toFixed(Math.min(20,c?c.length:0)).split(".")[0]);let n=l.split(o)[0];if(n+=o,t=$n(n,e)||"0",c){const e=Math.max(0,Math.min(14,c.length)),n=c.replace(/#+$/,"").length;let r=("I"===this.type?0:i%1+1e-15).toFixed(e).slice(2).replace(/0+$/,"");for(s=r.length;s<n;s++)r+="0";r&&(t+=o+r)}else 0===e&&(r=0)}else if(i>=10**e||i<1||i<1e-4)0===t?t="0":i<1e-4||i>=1e20?(t=(t=r.toExponential(Math.max(1,Math.min(14,e))-1)).replace(/\.?0+(?=e)/,""),d=""):(t=t.toPrecision(Math.max(1,Math.min(14,e)))).indexOf(".")>=0&&(t=(t=t.replace(t.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",o));else{for(l+=o,e=Math.max(0,Math.min(20,e-Math.ceil(Math.log(i)/Math.log(10)))),s=0;s<e;s++)l+="#";t=$n(l,t)}t=t.replace(u.numericRegex,(t=>t===a?u.groupTemp:t===o?u.decTemp:"")),r<0&&!/^-/.test(t)&&(t="-".concat(t))}return u.prefix+t+d+h+u.postfix}static getStaticFormatter(){return{prepare(){},formatValue:t=>"".concat(t)}}}function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{size:n=5e3,multipleArguments:i=!1,toKey:r=t=>t}=e;let o,a,s=Object.create(null),l=Object.create(null),c=0,u=0;return o=i?function(){return a=r(...arguments),o.has(a)?o.get(a):o.set(a,t(...arguments))}:e=>(a=r(e),o.has(a)?o.get(a):o.set(a,t(e))),o.set=(t,e)=>(c>=n&&(delete s[l[u]],delete l[u],c--,u++),s[t]=e,l[c]=t,c++,e),o.get=t=>s[t],o.has=t=>t in s,o.clear=()=>{s=Object.create(null),l=Object.create(null),c=0,u=0},o.size=()=>c,o}function si(t,e,n,i,r){const o=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new oi(...e)}(r,t,e,n,i),a=ai(o.formatValue.bind(o),{toKey:t=>isNaN(t)?t:+t});function s(t){return a(t)}return s.format=function(t,e,n,i){return a.clear(),o.format(e,t,n,i)},s.pattern=function(t){return t&&(a.clear(),o.pattern=t,o.prepare()),o.pattern},s}const li="D",ci="T",ui="TS",hi="IV",di=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],fi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],pi=["January","February","March","April","May","June","July","August","September","October","November","December"],gi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function mi(t,e){for(let n=t.length;n<e;n++)t="0".concat(t);return t}function yi(t){let e=t.toString().split(".");return e[1]?(e=Number("0.".concat(e[1])),e):0}function xi(t,e){let n,i=function(t){const e=t,n=24*yi(e),i=60*yi(n),r=60*yi(i),o=1e3*yi(r);return{d:Math.floor(e),h:Math.floor(n),m:Math.floor(i),s:Math.floor(r),f:Math.round(o)}}(t),r=i.d,o=i.h,a=i.m,s=i.s,l=i.f,c=0;/w+|t+/gi.test(e)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,Math.round(86400*(t-Math.floor(t))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(e)||(o+=24*r),/h+/gi.test(e)||(a+=60*o),/m+/gi.test(e)||(s+=60*a),/w+/gi.test(e)&&(c=n?n.getDay()-1:0,c<0&&(c=6));let u="";return n&&(u=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:c,date:r,h:o,m:a,s:s,f:l,t:u}}class vi{constructor(t,e,n){const i=t||{};if(i.qCalendarStrings||(i.qCalendarStrings={qLongDayNames:di,qDayNames:fi,qLongMonthNames:pi,qMonthNames:gi}),this.localeInfo=i,this.locale_days=i.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=i.qCalendarStrings.qDayNames.slice(),this.locale_months=i.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=i.qCalendarStrings.qMonthNames.slice(),!e){e={[ci]:i.qTimeFmt||"hh:mm:ss",[li]:i.qDateFmt||"YYYY-MM-DD",[ui]:i.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"}[n]}this.pattern=e}clone(){const t=new vi(this.localeInfo,this.pattern);return t.subtype=this.subtype,t}format(t,e){e||(e=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),e=e.replace(/\[.+]|\[|]/g,"");const n=/t+/gi.test(e);let i;t instanceof Date?i=function(t,e){let n=t.getUTCHours(),i=t.getUTCDay()-1;return e&&(n%=12,n||(n=12)),i<0&&(i=6),{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:i,date:t.getUTCDate(),h:n,m:t.getUTCMinutes(),s:t.getUTCSeconds(),f:t.getUTCMilliseconds(),t:t.getUTCHours()>=12?"pm":"am"}}(t,n):(t<0&&(t=-t,e="-".concat(e)),i=xi(t,e));const r=function(t,e){return{"Y+|y+":{Y:"".concat(Number("".concat(e.year).slice(-2))),YY:mi("".concat(e.year).slice(-2),2),YYY:mi("".concat(e.year).slice(-3),3),def:t=>mi("".concat(e.year),t.length)},"M+":{M:e.month+1,MM:mi("".concat(e.month+1),2),MMM:t.locale_months_abbr[e.month],def:t.locale_months[e.month]},"W+|w+":{W:e.day,WW:mi("".concat(e.day),2),WWW:t.locale_days_abbr[e.day],def:t.locale_days[e.day]},"D+|d+":{D:e.date,def:t=>mi("".concat(e.date),t.length)},"h+|H+":{h:e.h,def:t=>mi("".concat(e.h),t.length)},"m+":{m:e.m,def:t=>mi("".concat(e.m),t.length)},"s+|S+":{s:e.s,def:t=>mi("".concat(e.s),t.length)},"f+|F+":{def(t){let n="".concat(e.f),i=t.length-n.length;if(i>0)for(let t=0;t<i;t++)n+="0";else i<0&&(n=n.slice(0,t.length));return n}},"t{1,2}|T{1,2}":{def(t){let n=e.t;return t[0].toUpperCase()===t[0]&&(n=n.toUpperCase()),n=n.slice(0,t.length),n}}}}(this,i),o=[];for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&o.push(t);const a=new RegExp(o.join("|"),"g"),s=e.replace(a,(t=>{let e,n,i;for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&(e=new RegExp(n),e.test(t)))break;if(!e)return"";for(const e in r[n])if(e===t||e.toLowerCase()===t){i=r[n][e],void 0===i&&(i=r[n][e.toLowerCase()]);break}return void 0===i&&(i=r[n].def),"function"==typeof i&&(i=i(t)),i}));return s}}function bi(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new vi(...e)}function wi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=bi(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,t,e),i=ai(n.format.bind(n),{toKey:t=>"object"==typeof t&&"function"==typeof t.getTime?t.getTime():t});function r(t){return e!==hi?function(t){return new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,0,Math.round(864e5*(t-Math.floor(t)))))}(t):t}function o(t){return t=r(t),i(t)}return o.format=function(t,e){return i.clear(),e=r(e),n.format(e,t)},o.locale=function(r){return n=bi(r,t,e),i=ai(n.format.bind(n),{toKey:t=>"object"==typeof t?t.getTime():t}),this},o.qtype=function(t){return void 0!==t&&(e=t,i.clear()),e},o}function Mi(){let t,{meta:e,id:n,key:i,localeInfo:r,fieldExtractor:o,value:a,type:s,sourceField:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const c=a||("dimension"===s?t=>null==t?void 0:t.qElemNo:t=>null==t?void 0:t.qValue),u="dimension"===s?"first":"avg",h=function(t,e){if(t&&t.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(t.qNumFormat.qType))return wi(t.qNumFormat.qFmt,t.qNumFormat.qType,e);let n="#",i=e&&void 0!==e.qThousandSep?e.qThousandSep:",",r=e&&void 0!==e.qDecimalSep?e.qDecimalSep:".",o="U",a=t&&!!t.qIsAutoFormat;return t&&t.qNumFormat?(n=t.qNumFormat.qFmt||n,i=t.qNumFormat.qThou||i,r=t.qNumFormat.qDec||r,o=t.qNumFormat.qType||o,a=a&&-1===["M"].indexOf(t.qNumFormat.qType)):a=!0,(a||"U"===o)&&(n="#".concat(r,"##"),o="U"),si(n,i,r,o,e)}(e,r),d="dimension"===s?"first":(t,e)=>h(e),f={id:()=>n,key:()=>i,raw:()=>e,title:()=>e.qFallbackTitle||e.label,type:()=>s,origin:()=>l,items:()=>(t||(t=o(f)),t),min:()=>e.qMin,max:()=>e.qMax,value:c,label:t=>(null==t?void 0:t.qText)||"",reduce:u,reduceLabel:d,formatter:()=>h,tags:()=>e.qTags};return f}function ki(t,e,n,i,r){return(e[t]||[]).map(((e,o)=>{const a="".concat(i?"".concat(i,"/"):"").concat(t,"/").concat(o),s={instance:Mi(an({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:e},r))};return s.attrDims=ki("qAttrDimInfo",e,n,a,an({},r,{value:t=>null==t?void 0:t.qElemNo,type:"dimension"})),s.attrExps=ki("qAttrExprInfo",e,n,a,an({},r,{value:t=>null==t?void 0:t.qNum,type:"measure"})),s.measures=ki("qMeasureInfo",e,n,a,an({},r,{value:t=>null==t?void 0:t.qValue,type:"measure"})),s}))}function _i(){let{key:t,data:e,config:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},r=e;if(!r)throw new Error('Missing "data" input');if(!r.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');const o=_i.util,a={cache:i,cube:r,localeInfo:n.localeInfo,fieldExtractor:null,pages:null,hierarchy:()=>null,virtualFields:n.virtualFields},s={key:()=>t,raw:()=>r,field:t=>function(t,e){let{cache:n}=e;if("number"==typeof t)return n.fields[t];const i=n.allFields;if("function"==typeof t){for(let e=0;e<i.length;e++)if(t(i[e]))return i[e];return!1}if("string"==typeof t){for(let e=0;e<i.length;e++)if(i[e].key()===t||i[e].title()===t)return i[e]}else if(t&&-1!==i.indexOf(t))return t;throw Error("Field not found: ".concat(t))}(t,a),fields:()=>i.fields.slice(),extract:t=>a.extractor(t,s,i,o),hierarchy:t=>a.hierarchy(t,s,i,o),_cache:()=>i};"K"===r.qMode||"T"===r.qMode||!r.qMode&&r.qNodesOnDim?(a.extractor=Vn,a.hierarchy=Bn,a.pages="K"===r.qMode?r.qStackedDataPages:r.qTreeDataPages):"S"===r.qMode?(a.extractor=un,a.pages=r.qDataPages,a.hierarchy=Bn):a.extractor=()=>[],a.fieldExtractor=t=>a.extractor({field:t},s,i,o);const l="S"===r.qMode?t=>t.qElemNumber:void 0,c="S"===r.qMode?t=>t.qNum:void 0;i.wrappedFields.push(...ki("qDimensionInfo",r,t,"",an({},a,{value:l,type:"dimension"}))),i.wrappedFields.push(...ki("qMeasureInfo",r,t,"",an({},a,{value:c,type:"measure"}))),i.fields=i.wrappedFields.map((t=>t.instance));const u=t=>{t.forEach((t=>{i.allFields.push(t.instance),u(t.measures),u(t.attrDims),u(t.attrExps)}))};return u(i.wrappedFields),(n.virtualFields||[]).forEach((e=>{const n=s.field(e.from),r=Mi(Ke({meta:n.raw(),id:"".concat(t,"/").concat(e.key),sourceField:n,fieldExtractor:t=>a.extractor({field:t},s,i,o),key:e.key,type:n.type(),localeInfo:a.localeInfo,value:n.value},e.override||{}));i.virtualFields.push(r)})),i.allFields.push(...i.virtualFields),s}const Si=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],Ni=/\/qDimensionInfo(?:\/(\d+))?/,Ri=/\/qMeasureInfo\/(\d+)/,Ai=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,Ci=/\/qAttrExprInfo\/(\d+)/,Di=/\/?qHyperCube/,Oi=/\/?qTreeData/,zi=t=>"".concat(t.substr(0,t.indexOf("/qHyperCubeDef")+14)),Ei=t=>"".concat(t.substr(0,t.indexOf("/qTreeDataDef")+13));function Ii(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const i=e.byCells,r=e.primarySource,o=[],a={},s=t.isActive();let l=!1;if(t.brushes().forEach((t=>{const e=function(t,e){let n=t,i=-1,r=-1,o="",a=t=>t;Di.test(t)?(o="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=zi):Oi.test(t)&&(o="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=Ei);let s=!0;if(Ni.test(t)&&(i=+Ni.exec(t)[1]),Ri.test(t)&&(r=+Ri.exec(t)[1]),Ai.test(t)){r=-1,i=0;const t=+Ai.exec(n)[2];isNaN(t)||(i=t,n=n.replace(/\/\d+$/,"")),s=!1}if(Ci.test(t)){const t=r;if(e){r=0;const a=Rn(o,e);r+=(a.qMeasureInfo||[]).length,i>-1?(r=a.qDimensionInfo.slice(0,i).reduce(((t,e)=>t+e.qAttrExprInfo.length),r),i=-1):(r=a.qDimensionInfo.reduce(((t,e)=>t+e.qAttrExprInfo.length),r),r=a.qMeasureInfo.slice(0,t).reduce(((t,e)=>t+e.qAttrExprInfo.length),r)),r+=+Ci.exec(n)[1]}else i>-1?(i=-1,r=+Ci.exec(n)[1]):r+=+Ci.exec(n)[1]+1}return Si.forEach((t=>{let[e,i]=t;n=n.replace(e,i)})),s&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:r,dimensionIdx:i,path:n}}(t.id,n);if("range"===t.type&&e.measureIdx>-1&&e.dimensionIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.multiRangeSelectTreeDataValues||(a.multiRangeSelectTreeDataValues={path:e.path,ranges:[]}),n.forEach((t=>a.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:e.measureIdx,qDimensionIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}else{if("range"===t.type&&e.measureIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.rangeSelectHyperCubeValues||(a.rangeSelectHyperCubeValues={path:e.path,ranges:[]}),n.forEach((t=>a.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:e.measureIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}if("range"===t.type&&e.dimensionIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.selectHyperCubeContinuousRange||(a.selectHyperCubeContinuousRange={path:e.path,ranges:[]}),n.forEach((t=>a.selectHyperCubeContinuousRange.ranges.push({qDimIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!1}}))))}if("value"===t.type&&e.dimensionIdx>-1)if(i)if(n&&n.qHyperCube&&("P"===n.qHyperCube.qMode||"T"===n.qHyperCube.qMode||"K"===n.qHyperCube.qMode)){const i=n.qHyperCube,o=i.qNoOfLeftDims,s=i.qEffectiveInterColumnSortOrder.indexOf(e.dimensionIdx);if(a.selectPivotCells||(a.selectPivotCells={path:e.path,cells:[]}),t.id===r||!r){const n=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t)));(0===o||s>=o)&&o>-1?n.forEach((t=>{a.selectPivotCells.cells.push({qType:"T",qCol:t,qRow:s-o})})):n.forEach((t=>{a.selectPivotCells.cells.push({qType:"L",qCol:e.dimensionIdx,qRow:t})})),l=!!a.selectPivotCells.cells.length}}else a.selectHyperCubeCells||(a.selectHyperCubeCells={path:e.path,cols:[]}),a.selectHyperCubeCells.cols.push(e.dimensionIdx),t.id!==r&&(r||a.selectHyperCubeCells.values)||(a.selectHyperCubeCells.values=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t))),l=!!a.selectHyperCubeCells.values.length);else{const n=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t)));l=!!n.length,o.push({params:[e.path,e.dimensionIdx,n,!1],method:"selectHyperCubeValues"})}}})),!l&&s)return[{method:"resetMadeSelections",params:[]}];var c;a.rangeSelectHyperCubeValues&&o.push({method:"rangeSelectHyperCubeValues",params:[a.rangeSelectHyperCubeValues.path,a.rangeSelectHyperCubeValues.ranges,[],null===(c=e.orMode)||void 0===c||c]});return a.selectHyperCubeContinuousRange&&o.push({method:"selectHyperCubeContinuousRange",params:[a.selectHyperCubeContinuousRange.path,a.selectHyperCubeContinuousRange.ranges]}),a.selectHyperCubeCells&&o.push({method:"selectHyperCubeCells",params:[a.selectHyperCubeCells.path,a.selectHyperCubeCells.values,a.selectHyperCubeCells.cols]}),a.selectPivotCells&&o.push({method:"selectPivotCells",params:[a.selectPivotCells.path,a.selectPivotCells.cells]}),a.multiRangeSelectTreeDataValues&&o.push({method:"multiRangeSelectTreeDataValues",params:[a.multiRangeSelectTreeDataValues.path,a.multiRangeSelectTreeDataValues.ranges]}),o}function Ti(t){_i.util=t.data("matrix").util,t.data("q",_i),t.formatter("q-number",si),t.formatter("q-time",wi)}Ti.qBrushHelper=Ii,Ti.selections=Ii;var Pi=Object.prototype.hasOwnProperty,qi=Object.prototype.toString,Li=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Fi=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===qi.call(t)},Bi=function(t){if(!t||"[object Object]"!==qi.call(t))return!1;var e,n=Pi.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Pi.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Pi.call(t,e)},Vi=function(t,e){Li&&"__proto__"===e.name?Li(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},$i=function(t,e){if("__proto__"===e){if(!Pi.call(t,e))return;if(ji)return ji(t,e).value}return t[e]},Hi=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=$i(s,n),s!==(r=$i(e,n))&&(u&&r&&(Bi(r)||(o=Fi(r)))?(o?(o=!1,a=i&&Fi(i)?i:[]):a=i&&Bi(i)?i:{},Vi(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&Vi(s,{name:n,newValue:r}));return s},Wi="2.6.0";function Ui(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Xi(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Yi(Object(n),!0).forEach((function(e){Ui(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yi(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Gi(t){return!!t.changedTouches}function Ki(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"number"!=typeof t||isNaN(t)}function Ji(t){const e=t.length;let n=NaN,i=NaN,r=NaN,o=NaN;for(let a=0;a<e;a++)n=isNaN(n)?t[a].x:Math.min(n,t[a].x),i=isNaN(i)?t[a].x:Math.max(i,t[a].x),r=isNaN(r)?t[a].y:Math.min(r,t[a].y),o=isNaN(o)?t[a].y:Math.max(o,t[a].y);return[n,r,i,o]}function Qi(t){return[{x:t.x1||0,y:t.y1||0},{x:t.x2||0,y:t.y2||0}]}function tr(t){return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}]}function er(t){const[e,n,i,r]=Ji(t);return{x:e,y:n,width:i-e,height:r-n}}function nr(t){return{x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y}}function ir(t){const{x:e,y:n,width:i,height:r,x1:o,x2:a,y1:s,y2:l,cx:c,cy:u,r:h,vertices:d}=t||{};return Ki(c)&&Ki(u)&&Ki(h)?"circle":Ki(o)&&Ki(a)&&Ki(s)&&Ki(l)?"line":Ki(e)&&Ki(n)&&Ki(i)&&Ki(r)?"rect":Ki(e)&&Ki(n)?"point":Array.isArray(d)?d.every((t=>Array.isArray(t)))?"geopolygon":"polygon":null}function rr(t,e){return{x:e.x-t,y:e.y-t,width:e.width+t,height:e.height+t}}var or=Math.PI,ar=2*or,sr=1e-6,lr=ar-sr;function cr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ur(){return new cr}function hr(t){return function(){return t}}cr.prototype=ur.prototype={constructor:cr,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+o)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var o=this._x1,a=this._y1,s=n-t,l=i-e,c=o-t,u=a-e,h=c*c+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>sr)if(Math.abs(u*s-l*c)>sr&&r){var d=n-o,f=i-a,p=s*s+l*l,g=d*d+f*f,m=Math.sqrt(p),y=Math.sqrt(h),x=r*Math.tan((or-Math.acos((p+h-g)/(2*m*y)))/2),v=x/y,b=x/m;Math.abs(v-1)>sr&&(this._+="L"+(t+v*c)+","+(e+v*u)),this._+="A"+r+","+r+",0,0,"+ +(u*d>c*f)+","+(this._x1=t+b*s)+","+(this._y1=e+b*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),l=t+a,c=e+s,u=1^o,h=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>sr||Math.abs(this._y1-c)>sr)&&(this._+="L"+l+","+c),n&&(h<0&&(h=h%ar+ar),h>lr?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):h>sr&&(this._+="A"+n+","+n+",0,"+ +(h>=or)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var dr=Math.abs,fr=Math.atan2,pr=Math.cos,gr=Math.max,mr=Math.min,yr=Math.sin,xr=Math.sqrt,vr=1e-12,br=Math.PI,wr=br/2,Mr=2*br;function kr(t){return t>=1?wr:t<=-1?-wr:Math.asin(t)}function _r(t){return t.innerRadius}function Sr(t){return t.outerRadius}function Nr(t){return t.startAngle}function Rr(t){return t.endAngle}function Ar(t){return t&&t.padAngle}function Cr(t,e,n,i,r,o,a){var s=t-n,l=e-i,c=(a?o:-o)/xr(s*s+l*l),u=c*l,h=-c*s,d=t+u,f=e+h,p=n+u,g=i+h,m=(d+p)/2,y=(f+g)/2,x=p-d,v=g-f,b=x*x+v*v,w=r-o,M=d*g-p*f,k=(v<0?-1:1)*xr(gr(0,w*w*b-M*M)),_=(M*v-x*k)/b,S=(-M*x-v*k)/b,N=(M*v+x*k)/b,R=(-M*x+v*k)/b,A=_-m,C=S-y,D=N-m,O=R-y;return A*A+C*C>D*D+O*O&&(_=N,S=R),{cx:_,cy:S,x01:-u,y01:-h,x11:_*(r/w-1),y11:S*(r/w-1)}}function Dr(){var t=_r,e=Sr,n=hr(0),i=null,r=Nr,o=Rr,a=Ar,s=null;function l(){var l,c,u=+t.apply(this,arguments),h=+e.apply(this,arguments),d=r.apply(this,arguments)-wr,f=o.apply(this,arguments)-wr,p=dr(f-d),g=f>d;if(s||(s=l=ur()),h<u&&(c=h,h=u,u=c),h>vr)if(p>Mr-vr)s.moveTo(h*pr(d),h*yr(d)),s.arc(0,0,h,d,f,!g),u>vr&&(s.moveTo(u*pr(f),u*yr(f)),s.arc(0,0,u,f,d,g));else{var m,y,x=d,v=f,b=d,w=f,M=p,k=p,_=a.apply(this,arguments)/2,S=_>vr&&(i?+i.apply(this,arguments):xr(u*u+h*h)),N=mr(dr(h-u)/2,+n.apply(this,arguments)),R=N,A=N;if(S>vr){var C=kr(S/u*yr(_)),D=kr(S/h*yr(_));(M-=2*C)>vr?(b+=C*=g?1:-1,w-=C):(M=0,b=w=(d+f)/2),(k-=2*D)>vr?(x+=D*=g?1:-1,v-=D):(k=0,x=v=(d+f)/2)}var O=h*pr(x),z=h*yr(x),E=u*pr(w),I=u*yr(w);if(N>vr){var T,P=h*pr(v),q=h*yr(v),L=u*pr(b),j=u*yr(b);if(p<br&&(T=function(t,e,n,i,r,o,a,s){var l=n-t,c=i-e,u=a-r,h=s-o,d=h*l-u*c;if(!(d*d<vr))return[t+(d=(u*(e-o)-h*(t-r))/d)*l,e+d*c]}(O,z,L,j,P,q,E,I))){var F=O-T[0],B=z-T[1],V=P-T[0],$=q-T[1],H=1/yr(function(t){return t>1?0:t<-1?br:Math.acos(t)}((F*V+B*$)/(xr(F*F+B*B)*xr(V*V+$*$)))/2),W=xr(T[0]*T[0]+T[1]*T[1]);R=mr(N,(u-W)/(H-1)),A=mr(N,(h-W)/(H+1))}}k>vr?A>vr?(m=Cr(L,j,O,z,h,A,g),y=Cr(P,q,E,I,h,A,g),s.moveTo(m.cx+m.x01,m.cy+m.y01),A<N?s.arc(m.cx,m.cy,A,fr(m.y01,m.x01),fr(y.y01,y.x01),!g):(s.arc(m.cx,m.cy,A,fr(m.y01,m.x01),fr(m.y11,m.x11),!g),s.arc(0,0,h,fr(m.cy+m.y11,m.cx+m.x11),fr(y.cy+y.y11,y.cx+y.x11),!g),s.arc(y.cx,y.cy,A,fr(y.y11,y.x11),fr(y.y01,y.x01),!g))):(s.moveTo(O,z),s.arc(0,0,h,x,v,!g)):s.moveTo(O,z),u>vr&&M>vr?R>vr?(m=Cr(E,I,P,q,u,-R,g),y=Cr(O,z,L,j,u,-R,g),s.lineTo(m.cx+m.x01,m.cy+m.y01),R<N?s.arc(m.cx,m.cy,R,fr(m.y01,m.x01),fr(y.y01,y.x01),!g):(s.arc(m.cx,m.cy,R,fr(m.y01,m.x01),fr(m.y11,m.x11),!g),s.arc(0,0,u,fr(m.cy+m.y11,m.cx+m.x11),fr(y.cy+y.y11,y.cx+y.x11),g),s.arc(y.cx,y.cy,R,fr(y.y11,y.x11),fr(y.y01,y.x01),!g))):s.arc(0,0,u,w,b,g):s.lineTo(E,I)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +o.apply(this,arguments))/2-br/2;return[pr(i)*n,yr(i)*n]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:hr(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:hr(+t),l):e},l.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:hr(+t),l):n},l.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:hr(+t),l):i},l.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:hr(+t),l):r},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:hr(+t),l):o},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:hr(+t),l):a},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Or(t){this._context=t}function zr(t){return new Or(t)}function Er(t){return t[0]}function Ir(t){return t[1]}function Tr(){var t=Er,e=null,n=hr(0),i=Ir,r=hr(!0),o=null,a=zr,s=null;function l(l){var c,u,h,d,f,p=l.length,g=!1,m=new Array(p),y=new Array(p);for(null==o&&(s=a(f=ur())),c=0;c<=p;++c){if(!(c<p&&r(d=l[c],c,l))===g)if(g=!g)u=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=c-1;h>=u;--h)s.point(m[h],y[h]);s.lineEnd(),s.areaEnd()}g&&(m[c]=+t(d,c,l),y[c]=+n(d,c,l),s.point(e?+e(d,c,l):m[c],i?+i(d,c,l):y[c]))}if(f)return s=null,f+""||null}function c(){return function(){var t=Er,e=Ir,n=hr(!0),i=null,r=zr,o=null;function a(a){var s,l,c,u=a.length,h=!1;for(null==i&&(o=r(c=ur())),s=0;s<=u;++s)!(s<u&&n(l=a[s],s,a))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(l,s,a),+e(l,s,a));if(c)return o=null,c+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:hr(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:hr(+t),a):e},a.defined=function(t){return arguments.length?(n="function"==typeof t?t:hr(!!t),a):n},a.curve=function(t){return arguments.length?(r=t,null!=i&&(o=r(i)),a):r},a.context=function(t){return arguments.length?(null==t?i=o=null:o=r(i=t),a):i},a}().defined(r).curve(a).context(o)}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:hr(+n),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:hr(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:hr(+t),l):e},l.y=function(t){return arguments.length?(n="function"==typeof t?t:hr(+t),i=null,l):n},l.y0=function(t){return arguments.length?(n="function"==typeof t?t:hr(+t),l):n},l.y1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:hr(+t),l):i},l.lineX0=l.lineY0=function(){return c().x(t).y(n)},l.lineY1=function(){return c().x(t).y(i)},l.lineX1=function(){return c().x(e).y(n)},l.defined=function(t){return arguments.length?(r="function"==typeof t?t:hr(!!t),l):r},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}function Pr(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function qr(t){return t}Or.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Lr=Array.prototype.slice;function jr(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Fr(t){this._context=t}function Br(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Vr(t,e){this._context=t,this._k=(1-e)/6}Fr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:jr(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:jr(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Vr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Br(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Br(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var $r=function t(e){function n(t){return new Vr(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Hr(t,e){this._context=t,this._alpha=e}Hr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:!function(t,e,n){var i=t._x1,r=t._y1,o=t._x2,a=t._y2;if(t._l01_a>vr){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,r=(r*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>vr){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,o,a,t._x2,t._y2)}(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Wr=function t(e){function n(t){return e?new Hr(t,e):new Vr(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ur(t){return t<0?-1:1}function Yr(t,e,n){var i=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(i||r<0&&-0),a=(n-t._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Ur(o)+Ur(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Xr(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Gr(t,e,n){var i=t._x0,r=t._y0,o=t._x1,a=t._y1,s=(o-i)/3;t._context.bezierCurveTo(i+s,r+s*e,o-s,a-s*n,o,a)}function Kr(t){this._context=t}function Zr(t){this._context=new Jr(t)}function Jr(t){this._context=t}function Qr(t){this._context=t}function to(t){var e,n,i=t.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<i-1;++e)r[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(r[i-1]=2,o[i-1]=7,a[i-1]=8*t[i-1]+t[i],e=1;e<i;++e)n=r[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(r[i-1]=a[i-1]/o[i-1],e=i-2;e>=0;--e)r[e]=(a[e]-r[e+1])/o[e];for(o[i-1]=(t[i]+r[i-1])/2,e=0;e<i-1;++e)o[e]=2*t[e+1]-r[e+1];return[r,o]}function eo(t,e){this._context=t,this._t=e}function no(t,e){if((r=t.length)>1)for(var n,i,r,o=1,a=t[e[0]],s=a.length;o<r;++o)for(i=a,a=t[e[o]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function io(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function ro(t,e){return t[e]}function oo(t){for(var e,n=-1,i=0,r=t.length,o=-1/0;++n<r;)(e=+t[n][1])>o&&(o=e,i=n);return i}function ao(t){for(var e,n=0,i=-1,r=t.length;++i<r;)(e=+t[i][1])&&(n+=e);return n}function so(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unspecified",i=arguments.length>2?arguments[2]:void 0;const r={},o=t||{get:()=>{},has:()=>!1,default:()=>{}};function a(t,e){if(!t||"string"!=typeof t)throw new TypeError("Invalid argument: key must be a non-empty string");return!(t in r)&&(r[t]=e,!0)}function s(t){return r[t]||o.get(t)}function l(t,r){if(void 0!==r)return a(t,r);const o=s(t);return i&&void 0===o&&i.warn("".concat(t," does not exist in ").concat(n," registry")),o||s(e)}return e=o.default(),l.add=a,l.get=s,l.has=function(t){return!!r[t]||o.has(t)},l.remove=function(t){const e=r[t];return delete r[t],e},l.getKeys=function(){return Object.keys(r)},l.getValues=function(){return Object.keys(r).map((t=>r[t]))},l.default=function(t){return void 0!==t&&(e=t),e},l.register=a,l}function lo(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function co(t){return(t=lo(Math.abs(t)))?t[1]:NaN}Kr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Gr(this,this._t0,Xr(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Gr(this,Xr(this,n=Yr(this,t,e)),n);break;default:Gr(this,this._t0,n=Yr(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Zr.prototype=Object.create(Kr.prototype)).point=function(t,e){Kr.prototype.point.call(this,e,t)},Jr.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,r,o){this._context.bezierCurveTo(e,t,i,n,o,r)}},Qr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var i=to(t),r=to(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(i[0][o],r[0][o],i[1][o],r[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},eo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var uo,ho=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fo(t){if(!(e=ho.exec(t)))throw new Error("invalid format: "+t);var e;return new po({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 po(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 go(t,e){var n=lo(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}fo.prototype=po.prototype,po.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var mo={"%":(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)=>go(100*t,e),r:go,s:function(t,e){var n=lo(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(uo=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+lo(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function yo(t){return t}var xo,vo,bo,wo=Array.prototype.map,Mo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ko(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?yo:(e=wo.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],a=0,s=e[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(t.substring(r-=s,r+s)),!((l+=s+1)>i));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?yo:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(wo.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=fo(t)).fill,n=t.align,h=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,x=t.type;"n"===x?(g=!0,x="g"):mo[x]||(void 0===m&&(m=12),y=!0,x="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var v="$"===d?r:"#"===d&&/[boxX]/.test(x)?"0"+x.toLowerCase():"",b="$"===d?o:/[%p]/.test(x)?l:"",w=mo[x],M=/[defgprs%]/.test(x);function k(t){var r,o,l,d=v,k=b;if("c"===x)k=w(t)+k,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),_&&0==+t&&"+"!==h&&(_=!1),d=(_?"("===h?h:c:"-"===h||"("===h?"":h)+d,k=("s"===x?Mo[8+uo/3]:"")+k+(_&&"("===h?")":""),M)for(r=-1,o=t.length;++r<o;)if(48>(l=t.charCodeAt(r))||l>57){k=(46===l?a+t.slice(r+1):t.slice(r))+k,t=t.slice(0,r);break}}g&&!f&&(t=i(t,1/0));var S=d.length+t.length+k.length,N=S<p?new Array(p-S+1).join(e):"";switch(g&&f&&(t=i(N+t,N.length?p-k.length:1/0),N=""),n){case"<":t=d+t+k+N;break;case"=":t=d+N+t+k;break;case"^":t=N.slice(0,S=N.length>>1)+d+t+k+N.slice(S);break;default:t=N+d+t+k}return s(t)}return m=void 0===m?6:/[gprs]/.test(x)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),k.toString=function(){return t+""},k}return{format:h,formatPrefix:function(t,e){var n=h(((t=fo(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(co(e)/3))),r=Math.pow(10,-i),o=Mo[8+i/3];return function(t){return n(r*t)+o}}}}!function(t){xo=ko(t),vo=xo.format,bo=xo.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const _o=new Date,So=new Date;function No(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=e=>(t(e=new Date(+e)),e),r.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),r.round=t=>{const e=r(t),n=r.ceil(t);return t-e<n-t?e:n},r.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<i);return a},r.filter=n=>No((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,i)=>{if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})),n&&(r.count=(e,i)=>(_o.setTime(+e),So.setTime(+i),t(_o),t(So),Math.floor(n(_o,So))),r.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?e=>i(e)%t==0:e=>r.count(0,e)%t==0):r:null)),r}const Ro=6e4,Ao=864e5,Co=6048e5,Do=No((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Ro)/Ao),(t=>t.getDate()-1));Do.range;const Oo=No((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/Ao),(t=>t.getUTCDate()-1));Oo.range;const zo=No((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/Ao),(t=>Math.floor(t/Ao)));function Eo(t){return No((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Ro)/Co))}zo.range;const Io=Eo(0),To=Eo(1),Po=Eo(2),qo=Eo(3),Lo=Eo(4),jo=Eo(5),Fo=Eo(6);function Bo(t){return No((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/Co))}Io.range,To.range,Po.range,qo.range,Lo.range,jo.range,Fo.range;const Vo=Bo(0),$o=Bo(1),Ho=Bo(2),Wo=Bo(3),Uo=Bo(4),Yo=Bo(5),Xo=Bo(6);Vo.range,$o.range,Ho.range,Wo.range,Uo.range,Yo.range,Xo.range;const Go=No((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Go.every=t=>isFinite(t=Math.floor(t))&&t>0?No((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Go.range;const Ko=No((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Zo(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Jo(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Qo(t){let e,n,i;function r(t,i,r=0,o=t.length){if(r<o){if(0!==e(i,i))return o;do{const e=r+o>>>1;n(t[e],i)<0?r=e+1:o=e}while(r<o)}return r}return 2!==t.length?(e=Zo,n=(e,n)=>Zo(t(e),n),i=(e,n)=>t(e)-n):(e=t===Zo||t===Jo?t:ta,n=t,i=t),{left:r,center:function(t,e,n=0,o=t.length){const a=r(t,e,n,o-1);return a>n&&i(t[a-1],e)>-i(t[a],e)?a-1:a},right:function(t,i,r=0,o=t.length){if(r<o){if(0!==e(i,i))return o;do{const e=r+o>>>1;n(t[e],i)<=0?r=e+1:o=e}while(r<o)}return r}}}function ta(){return 0}Ko.every=t=>isFinite(t=Math.floor(t))&&t>0?No((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Ko.range;const ea=Qo(Zo).right;Qo((function(t){return null===t?NaN:+t})).center;var na=ea;class ia extends Map{constructor(t,e=oa){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(ra(this,t))}has(t){return super.has(ra(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},n){const i=e(n);t.has(i)&&(n=t.get(i),t.delete(i));return n}(this,t))}}function ra({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function oa(t){return null!==t&&"object"==typeof t?t.valueOf():t}const aa=Math.sqrt(50),sa=Math.sqrt(10),la=Math.sqrt(2);function ca(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),a=o>=aa?10:o>=sa?5:o>=la?2:1;let s,l,c;return r<0?(c=Math.pow(10,-r)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?ca(t,e,2*n):[s,l,c]}function ua(t,e,n){return ca(t=+t,e=+e,n=+n)[2]}function ha(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function da(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function fa(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function pa(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=wa(r),u=Ma(r),h=wa(o),d=Ma(o),f=wa(a),p=Ma(a),g=wa(s),m=Ma(s),y=wa(l),x=Ma(l),v={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:$a,e:$a,f:Xa,g:os,G:ss,H:Ha,I:Wa,j:Ua,L:Ya,m:Ga,M:Ka,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ds,s:Os,S:Za,u:Ja,U:Qa,V:es,w:ns,W:is,x:null,X:null,y:rs,Y:as,Z:ls,"%":Cs},b={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:cs,e:cs,f:ps,g:Ss,G:Rs,H:us,I:hs,j:ds,L:fs,m:gs,M:ms,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ds,s:Os,S:ys,u:xs,U:vs,V:ws,w:Ms,W:ks,x:null,X:null,y:_s,Y:Ns,Z:As,"%":Cs},w={a:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=y.exec(e.slice(n));return i?(t.m=x.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return _(t,e,n,i)},d:Ea,e:Ea,f:ja,g:Ca,G:Aa,H:Ta,I:Ta,j:Ia,L:La,m:za,M:Pa,p:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:Oa,Q:Ba,s:Va,S:qa,u:_a,U:Sa,V:Na,w:ka,W:Ra,x:function(t,e,i){return _(t,n,e,i)},X:function(t,e,n){return _(t,i,e,n)},y:Ca,Y:Aa,Z:Da,"%":Fa};function M(t,e){return function(n){var i,r,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(r=ga[i=t.charAt(++s)])?i=t.charAt(++s):r="e"===i?" ":"0",(o=e[i])&&(i=o(n,r)),a.push(i),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function k(t,e){return function(n){var i,r,o=fa(1900,void 0,1);if(_(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=da(fa(o.y,0,1))).getUTCDay(),i=r>4||0===r?$o.ceil(i):$o(i),i=Oo.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=ha(fa(o.y,0,1))).getDay(),i=r>4||0===r?To.ceil(i):To(i),i=Do.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?da(fa(o.y,0,1)).getUTCDay():ha(fa(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,da(o)):ha(o)}}function _(t,e,n,i){for(var r,o,a=0,s=e.length,l=n.length;a<s;){if(i>=l)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(o=w[r in ga?e.charAt(a++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return v.x=M(n,v),v.X=M(i,v),v.c=M(e,v),b.x=M(n,b),b.X=M(i,b),b.c=M(e,b),{format:function(t){var e=M(t+="",v);return e.toString=function(){return t},e},parse:function(t){var e=k(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=M(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+="",!0);return e.toString=function(){return t},e}}}var ga={"-":"",_:" ",0:"0"},ma=/^\s*\d+/,ya=/^%/,xa=/[\\^$*+?|[\]().{}]/g;function va(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(e)+r:r)}function ba(t){return t.replace(xa,"\\$&")}function wa(t){return new RegExp("^(?:"+t.map(ba).join("|")+")","i")}function Ma(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function ka(t,e,n){var i=ma.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function _a(t,e,n){var i=ma.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function Sa(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function Na(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function Ra(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function Aa(t,e,n){var i=ma.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Ca(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Da(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Oa(t,e,n){var i=ma.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function za(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Ea(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Ia(t,e,n){var i=ma.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function Ta(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function Pa(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function qa(t,e,n){var i=ma.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function La(t,e,n){var i=ma.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function ja(t,e,n){var i=ma.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Fa(t,e,n){var i=ya.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function Ba(t,e,n){var i=ma.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function Va(t,e,n){var i=ma.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function $a(t,e){return va(t.getDate(),e,2)}function Ha(t,e){return va(t.getHours(),e,2)}function Wa(t,e){return va(t.getHours()%12||12,e,2)}function Ua(t,e){return va(1+Do.count(Go(t),t),e,3)}function Ya(t,e){return va(t.getMilliseconds(),e,3)}function Xa(t,e){return Ya(t,e)+"000"}function Ga(t,e){return va(t.getMonth()+1,e,2)}function Ka(t,e){return va(t.getMinutes(),e,2)}function Za(t,e){return va(t.getSeconds(),e,2)}function Ja(t){var e=t.getDay();return 0===e?7:e}function Qa(t,e){return va(Io.count(Go(t)-1,t),e,2)}function ts(t){var e=t.getDay();return e>=4||0===e?Lo(t):Lo.ceil(t)}function es(t,e){return t=ts(t),va(Lo.count(Go(t),t)+(4===Go(t).getDay()),e,2)}function ns(t){return t.getDay()}function is(t,e){return va(To.count(Go(t)-1,t),e,2)}function rs(t,e){return va(t.getFullYear()%100,e,2)}function os(t,e){return va((t=ts(t)).getFullYear()%100,e,2)}function as(t,e){return va(t.getFullYear()%1e4,e,4)}function ss(t,e){var n=t.getDay();return va((t=n>=4||0===n?Lo(t):Lo.ceil(t)).getFullYear()%1e4,e,4)}function ls(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+va(e/60|0,"0",2)+va(e%60,"0",2)}function cs(t,e){return va(t.getUTCDate(),e,2)}function us(t,e){return va(t.getUTCHours(),e,2)}function hs(t,e){return va(t.getUTCHours()%12||12,e,2)}function ds(t,e){return va(1+Oo.count(Ko(t),t),e,3)}function fs(t,e){return va(t.getUTCMilliseconds(),e,3)}function ps(t,e){return fs(t,e)+"000"}function gs(t,e){return va(t.getUTCMonth()+1,e,2)}function ms(t,e){return va(t.getUTCMinutes(),e,2)}function ys(t,e){return va(t.getUTCSeconds(),e,2)}function xs(t){var e=t.getUTCDay();return 0===e?7:e}function vs(t,e){return va(Vo.count(Ko(t)-1,t),e,2)}function bs(t){var e=t.getUTCDay();return e>=4||0===e?Uo(t):Uo.ceil(t)}function ws(t,e){return t=bs(t),va(Uo.count(Ko(t),t)+(4===Ko(t).getUTCDay()),e,2)}function Ms(t){return t.getUTCDay()}function ks(t,e){return va($o.count(Ko(t)-1,t),e,2)}function _s(t,e){return va(t.getUTCFullYear()%100,e,2)}function Ss(t,e){return va((t=bs(t)).getUTCFullYear()%100,e,2)}function Ns(t,e){return va(t.getUTCFullYear()%1e4,e,4)}function Rs(t,e){var n=t.getUTCDay();return va((t=n>=4||0===n?Uo(t):Uo.ceil(t)).getUTCFullYear()%1e4,e,4)}function As(){return"+0000"}function Cs(){return"%"}function Ds(t){return+t}function Os(t){return Math.floor(+t/1e3)}const zs=so();zs("d3-number",(function(t,e,n){let i,r;function o(t){return r(t)}function a(){o.locale({decimal:n||".",thousands:e||",",grouping:[3],currency:["$",""]})}return o.locale=function(e){return i=ko(e),r=i.format(t),this},a(),o.format=function(t,r,o,s){return(o||s)&&(e=o,n=s,a()),i.format(t)(r)},o.pattern=function(e){return e&&(t=e,r=i.format(e)),t},o})),zs("d3-time",(function(t){let e=pa({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),n=e.format(t);function i(t){return n(t)}return i.format=function(t,n){return e.format(t)(n)},i.locale=function(){return e=pa(...arguments),n=e.format(t),this},i.parse=function(t,n){return e.parse(t)(n)},i.parsePattern=function(t){return e.parse(t)},i}));const Es={id:t=>"".concat(t.source,"/").concat(t.key||t.title),key:t=>String(t.key||t.title),tags:t=>t.tags,min:t=>t.min,max:t=>t.max,type:t=>t.type,title:t=>String(t.title),values:t=>t.values,value:t=>t,label:t=>t,formatter:t=>(t=>{if("function"==typeof t.formatter)return t.formatter();const e=t.formatter||{};return zs(e.type||"d3-number")(e.format||"")})(t)};function Is(t){let{id:e=Es.id,key:n=Es.key,min:i=Es.min,max:r=Es.max,type:o=Es.type,tags:a=Es.tags,title:s=Es.title,values:l=Es.values,value:c=Es.value,label:u=Es.label,formatter:h=Es.formatter}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{id:()=>e(t),key:()=>n(t),raw:()=>t,tags:()=>a(t),type:()=>o(t),min:()=>i(t),max:()=>r(t),title:()=>s(t),items:()=>l(t),formatter:()=>h(t),value:c,label:u}}const Ts=t=>t.filter((t=>"number"==typeof t&&!isNaN(t))),Ps=t=>t.reduce(((t,e)=>t+e),0),qs={first:t=>t[0],last:t=>t[t.length-1],min:t=>{const e=Ts(t);return e.length?Math.min.apply(null,e):NaN},max:t=>{const e=Ts(t);return e.length?Math.max.apply(null,e):NaN},sum:t=>{const e=Ts(t);return e.length?e.reduce(((t,e)=>t+e),0):NaN},avg:t=>{const e=Ts(t),n=e.length;return n?Ps(e)/n:NaN}};function Ls(t,e,n,i){const r={},o=i.field||(void 0!==t.field?e.field(t.field):null);return Object.keys(n).forEach((a=>{const s=n[a],l=r[a]={};-1!==["number","string","boolean"].indexOf(typeof s)?(l.type="primitive",l.value=s):"function"==typeof s?(l.type="function",l.value=s,l.label=s,l.field=o):"object"==typeof s&&(s.fields?l.fields=s.fields.map((n=>Ls(t,e,{main:n},i).main)):void 0!==s.field?(l.type="field",l.field=e.field(s.field),l.value=l.field.value,l.label=l.field.label):o&&(l.value=o.value,l.label=o.label,l.field=o),"function"==typeof s.filter&&(l.filter=s.filter),void 0!==s.value&&(l.value=s.value),void 0!==s.label&&(l.label=s.label),"function"==typeof s.reduce?l.reduce=s.reduce:s.reduce?l.reduce=qs[s.reduce]:l.field&&l.field.reduce&&(l.reduce="string"==typeof l.field.reduce?qs[l.field.reduce]:l.field.reduce),"function"==typeof s.reduceLabel?l.reduceLabel=s.reduceLabel:s.reduceLabel?l.reduceLabel=qs[s.reduceLabel]:l.field&&l.field.reduceLabel&&(l.reduceLabel="string"==typeof l.field.reduceLabel?qs[l.field.reduceLabel]:l.field.reduceLabel))})),r}function js(t,e){const{main:n}=Ls(t,e,{main:{value:t.value,label:t.label,reduce:t.reduce,filter:t.filter}},{});return{props:Ls(t,e,t.props||{},n),main:n}}function Fs(t,e,n,i){const r=Array(t.length),o=Array(t.length);let a;for(let e=0;e<t.length;e++)a=i?t[e][i]:t[e],r[e]=a.value,o[e]=a.label;const s=e.reduce,l=e.reduceLabel,c=s?s(r):r,u={value:c,label:l?l(o,c):n?n(c):String(c)};return i&&t[0][i].source?(u.source=t[0][i].source,u):!i&&t[0].source?(u.source=t[0].source,u):u}function Bs(t,e){let{main:n,propsArr:i,props:r}=e,o=[];const a=n.field.formatter(),s={};return i.forEach((t=>{s[t]=r[t].field?r[t].field.formatter():t=>t})),o.push(...t.map((t=>{const e=Fs(t.items,n,a);return i.forEach((n=>{e[n]=Fs(t.items,r[n],s[n],n)})),e}))),o}function Vs(t){let{cfg:e,itemData:n,obj:i,target:r,tracker:o,trackType:a}=t;const s="function"===a?e.trackBy(n):n[e.trackBy];let l=o[s];l||(l=o[s]={items:[],id:s},r.push(l)),l.items.push(i)}function $s(t){if(t.length<1e4)return Math.max(...t);let e=-1/0;const n=t.length;for(let i=0;i<n;i++)e<t[i]&&(e=t[i]);return e}function Hs(t){if(t.length<1e4)return Math.min(...t);let e=1/0;const n=t.length;for(let i=0;i<n;i++)e>t[i]&&(e=t[i]);return e}const Ws={diverging:function(t,e){if((s=t.length)>0)for(var n,i,r,o,a,s,l=0,c=t[e[0]].length;l<c;++l)for(o=a=0,n=0;n<s;++n)(r=(i=t[e[n]][l])[1]-i[0])>=0?(i[0]=o,i[1]=o+=r):r<0?(i[1]=a,i[0]=a+=r):i[0]=o},none:no,silhouette:function(t,e){if((n=t.length)>0){for(var n,i=0,r=t[e[0]],o=r.length;i<o;++i){for(var a=0,s=0;a<n;++a)s+=t[a][i][1]||0;r[i][1]+=r[i][0]=-s/2}no(t,e)}},expand:function(t,e){if((i=t.length)>0){for(var n,i,r,o=0,a=t[0].length;o<a;++o){for(r=n=0;n<i;++n)r+=t[n][o][1]||0;if(r)for(n=0;n<i;++n)t[n][o][1]/=r}no(t,e)}},wiggle:function(t,e){if((r=t.length)>0&&(i=(n=t[e[0]]).length)>0){for(var n,i,r,o=0,a=1;a<i;++a){for(var s=0,l=0,c=0;s<r;++s){for(var u=t[e[s]],h=u[a][1]||0,d=(h-(u[a-1][1]||0))/2,f=0;f<s;++f){var p=t[e[f]];d+=(p[a][1]||0)-(p[a-1][1]||0)}l+=h,c+=d*h}n[a-1][1]+=n[a-1][0]=o,l&&(o-=c/l)}n[a-1][1]+=n[a-1][0]=o,no(t,e)}}},Us={ascending:function(t){var e=t.map(ao);return io(t).sort((function(t,n){return e[t]-e[n]}))},insideout:function(t){var e,n,i=t.length,r=t.map(ao),o=function(t){var e=t.map(oo);return io(t).sort((function(t,n){return e[t]-e[n]}))}(t),a=0,s=0,l=[],c=[];for(e=0;e<i;++e)n=o[e],a<s?(a+=r[n],l.push(n)):(s+=r[n],c.push(n));return c.reverse().concat(l)},none:io,reverse:function(t){return io(t).reverse()}};function Ys(t,e,n){const i={},r=e.stackKey,o=e.value,a=e.startProp||"start",s=e.endProp||"end",l=e.offset||"none",c=e.order||"none",u=e.valueRef||"";let h=0,d={};for(let e=0;e<t.items.length;e++){let n=t.items[e],o=u?n[u]:null;if(o&&o.source){let t="".concat(o.source.key||"","/").concat(o.source.field);d[t]||(d[t]=o.source)}let a=r(n);i[a]=i[a]||{items:[]},i[a].items.push(n),h=Math.max(h,i[a].items.length)}const f=Array.apply(null,{length:h}).map(Number.call,Number),p=Object.keys(i).map((t=>i[t].items)),g=function(){var t=hr([]),e=io,n=no,i=ro;function r(r){var o,a,s=t.apply(this,arguments),l=r.length,c=s.length,u=new Array(c);for(o=0;o<c;++o){for(var h,d=s[o],f=u[o]=new Array(l),p=0;p<l;++p)f[p]=h=[0,+i(r[p],d,p,r)],h.data=r[p];f.key=d}for(o=0,a=e(u);o<c;++o)u[a[o]].index=o;return n(u,a),u}return r.keys=function(e){return arguments.length?(t="function"==typeof e?e:hr(Lr.call(e)),r):t},r.value=function(t){return arguments.length?(i="function"==typeof t?t:hr(+t),r):i},r.order=function(t){return arguments.length?(e=null==t?io:"function"==typeof t?t:hr(Lr.call(t)),r):e},r.offset=function(t){return arguments.length?(n=null==t?no:t,r):n},r}().keys(f).value(((t,e)=>t[e]?o(t[e]):0)).order(Us[c]).offset(Ws[l]);let m=g(p),y=[];for(let t=0;t<m.length;t++){let e=m[t];for(let t=0;t<e.length;t++){let n=e[t],i=e[t].data[e.key];i&&(i[a]={value:n[0]},i[s]={value:n[1]},y.push(n[0],n[1]))}}let x=Object.keys(d).map((t=>{let e=n(d[t].key);return e?e.field(d[t].field):null})).filter((t=>!!t));const v=Is({title:x.map((t=>t.title())).join(", "),min:Hs(y),max:$s(y),type:"measure",formatter:x[0]?x[0].formatter:void 0});t.fields.push(v)}function Xs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};const i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).logger;if(Array.isArray(t))n.items=t.map((t=>({value:t,label:String(t)})));else if(t){if("collection"in t)n=Xi({},e.collection(t.collection));else{const r=e.dataset?e.dataset(t.source):null;let o=t.value||(t=>t),a=t.label||(t=>t);if(t.groupBy||t.mapTo)i.warn('Deprecated "data" configuration',t),n.items=[];else if(t.hierarchy)n.root=r.hierarchy?r.hierarchy(t.hierarchy):null,n.fields=r.fields();else if(t.items)n.items=t.items.map((t=>({value:o(t),label:String(a(t))})));else if(t.extract){const i=Array.isArray(t.extract)?t.extract:[t.extract];n.items=[];const o=[];i.forEach((t=>{const i=t.source?e.dataset(t.source):r;i&&(n.items=[...n.items,...i.extract(t)],void 0!==t.field&&o.push(i.field(t.field)))})),o.length&&(n.fields=o),t.amend&&Array.isArray(t.amend)&&(n.items=[...n.items,...t.amend])}else if(void 0!==t.field&&r){const e=r.field(t.field);e&&(n.fields||(n.fields=[]),n.fields.push(e),"value"in t||(o=e.value||(t=>t),a=e.label||(t=>t),n.value=o),n.items=e.items().map((e=>({value:o(e),label:String(a(e)),source:{field:t.field}}))))}else t.fields&&t.fields.forEach((t=>{const i="object"==typeof t&&t.source?e.dataset(t.source):r;if(!i)return;let o;o="object"==typeof t&&void 0!==t.field?i.field(t.field):i.field(t),o&&(n.fields||(n.fields=[]),n.fields.push(o))}));n.items&&t.map&&(n.items=n.items.map(t.map))}t&&t.stack&&Ys(n,t.stack,e.dataset)}return t&&!Array.isArray(t)&&"function"==typeof t.filter&&n.items&&(n.items=n.items.filter(t.filter)),t&&!Array.isArray(t)&&"function"==typeof t.sort&&n.items&&(n.items=n.items.sort(t.sort)),n}function Gs(t,e,n){let i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xs;if(t.data){const i=r(t.data,e,n);if(i&&i.fields&&i.fields[0])return i.fields[0].formatter()}if(i=t.formatter?"".concat(t.formatter,"-").concat(t.type||"number"):t.type||"d3-number",n.formatter.has(i)){return n.formatter.get(i)(t.format||"")}throw new Error("Formatter of type '".concat(i,"' was not found"))}function Ks(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const Zs=Symbol("implicit");function Js(){var t=new ia,e=[],n=[],i=Zs;function r(r){let o=t.get(r);if(void 0===o){if(i!==Zs)return i;t.set(r,o=e.push(r)-1)}return n[o%n.length]}return r.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new ia;for(const i of n)t.has(i)||t.set(i,e.push(i)-1);return r},r.range=function(t){return arguments.length?(n=Array.from(t),r):n.slice()},r.unknown=function(t){return arguments.length?(i=t,r):i},r.copy=function(){return Js(e,n).unknown(i)},Ks.apply(r,arguments),r}function Qs(){var t,e,n=Js().unknown(void 0),i=n.domain,r=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=i().length,h=a<o,d=h?a:o,f=h?o:a;t=(f-d)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),d+=(f-d-t*(n-l))*u,e=t*(1-l),s&&(d=Math.round(d),e=Math.round(e));var p=function(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(r);++i<r;)o[i]=t+i*n;return o}(n).map((function(e){return d+t*e}));return r(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(i(t),h()):i()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return Qs(i(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Ks.apply(h(),arguments)}function tl(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function el(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function nl(){}var il=.7,rl=1/il,ol="\\s*([+-]?\\d+)\\s*",al="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ll=/^#([0-9a-f]{3,8})$/,cl=new RegExp(`^rgb\\(${ol},${ol},${ol}\\)$`),ul=new RegExp(`^rgb\\(${sl},${sl},${sl}\\)$`),hl=new RegExp(`^rgba\\(${ol},${ol},${ol},${al}\\)$`),dl=new RegExp(`^rgba\\(${sl},${sl},${sl},${al}\\)$`),fl=new RegExp(`^hsl\\(${al},${sl},${sl}\\)$`),pl=new RegExp(`^hsla\\(${al},${sl},${sl},${al}\\)$`),gl={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 ml(){return this.rgb().formatHex()}function yl(){return this.rgb().formatRgb()}function xl(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ll.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?vl(e):3===n?new Ml(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?bl(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?bl(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=cl.exec(t))?new Ml(e[1],e[2],e[3],1):(e=ul.exec(t))?new Ml(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=hl.exec(t))?bl(e[1],e[2],e[3],e[4]):(e=dl.exec(t))?bl(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=fl.exec(t))?Al(e[1],e[2]/100,e[3]/100,1):(e=pl.exec(t))?Al(e[1],e[2]/100,e[3]/100,e[4]):gl.hasOwnProperty(t)?vl(gl[t]):"transparent"===t?new Ml(NaN,NaN,NaN,0):null}function vl(t){return new Ml(t>>16&255,t>>8&255,255&t,1)}function bl(t,e,n,i){return i<=0&&(t=e=n=NaN),new Ml(t,e,n,i)}function wl(t,e,n,i){return 1===arguments.length?function(t){return t instanceof nl||(t=xl(t)),t?new Ml((t=t.rgb()).r,t.g,t.b,t.opacity):new Ml}(t):new Ml(t,e,n,null==i?1:i)}function Ml(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function kl(){return`#${Rl(this.r)}${Rl(this.g)}${Rl(this.b)}`}function _l(){const t=Sl(this.opacity);return`${1===t?"rgb(":"rgba("}${Nl(this.r)}, ${Nl(this.g)}, ${Nl(this.b)}${1===t?")":`, ${t})`}`}function Sl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Nl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Rl(t){return((t=Nl(t))<16?"0":"")+t.toString(16)}function Al(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Dl(t,e,n,i)}function Cl(t){if(t instanceof Dl)return new Dl(t.h,t.s,t.l,t.opacity);if(t instanceof nl||(t=xl(t)),!t)return new Dl;if(t instanceof Dl)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new Dl(a,s,l,t.opacity)}function Dl(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Ol(t){return(t=(t||0)%360)<0?t+360:t}function zl(t){return Math.max(0,Math.min(1,t||0))}function El(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}tl(nl,xl,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ml,formatHex:ml,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Cl(this).formatHsl()},formatRgb:yl,toString:yl}),tl(Ml,wl,el(nl,{brighter(t){return t=null==t?rl:Math.pow(rl,t),new Ml(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?il:Math.pow(il,t),new Ml(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ml(Nl(this.r),Nl(this.g),Nl(this.b),Sl(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:kl,formatHex:kl,formatHex8:function(){return`#${Rl(this.r)}${Rl(this.g)}${Rl(this.b)}${Rl(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:_l,toString:_l})),tl(Dl,(function(t,e,n,i){return 1===arguments.length?Cl(t):new Dl(t,e,n,null==i?1:i)}),el(nl,{brighter(t){return t=null==t?rl:Math.pow(rl,t),new Dl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?il:Math.pow(il,t),new Dl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Ml(El(t>=240?t-240:t+120,r,i),El(t,r,i),El(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new Dl(Ol(this.h),zl(this.s),zl(this.l),Sl(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=Sl(this.opacity);return`${1===t?"hsl(":"hsla("}${Ol(this.h)}, ${100*zl(this.s)}%, ${100*zl(this.l)}%${1===t?")":`, ${t})`}`}}));var Il=t=>()=>t;function Tl(t){return 1==(t=+t)?Pl:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Il(isNaN(e)?n:e)}}function Pl(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Il(isNaN(t)?e:t)}var ql=function t(e){var n=Tl(e);function i(t,e){var i=n((t=wl(t)).r,(e=wl(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=Pl(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1);function Ll(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(o){for(n=0;n<i;++n)r[n]=t[n]*(1-o)+e[n]*o;return r}}function jl(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,o=new Array(r),a=new Array(i);for(n=0;n<r;++n)o[n]=Ul(t[n],e[n]);for(;n<i;++n)a[n]=e[n];return function(t){for(n=0;n<r;++n)a[n]=o[n](t);return a}}function Fl(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Bl(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Vl(t,e){var n,i={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=Ul(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}var $l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hl=new RegExp($l.source,"g");function Wl(t,e){var n,i,r,o=$l.lastIndex=Hl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=$l.exec(t))&&(i=Hl.exec(e));)(r=i.index)>o&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Bl(n,i)})),o=Hl.lastIndex;return o<e.length&&(r=e.slice(o),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})}function Ul(t,e){var n,i=typeof e;return null==e||"boolean"===i?Il(e):("number"===i?Bl:"string"===i?(n=xl(e))?(e=n,ql):Wl:e instanceof xl?ql:e instanceof Date?Fl:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Ll:Array.isArray(e)?jl:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Vl:Bl)(t,e)}function Yl(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Xl(t){return+t}var Gl=[0,1];function Kl(t){return t}function Zl(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Jl(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r<i?(i=Zl(r,i),o=n(a,o)):(i=Zl(i,r),o=n(o,a)),function(t){return o(i(t))}}function Ql(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<i;)r[a]=Zl(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=na(t,e,1,i)-1;return o[n](r[n](e))}}function tc(){var t,e,n,i,r,o,a=Gl,s=Gl,l=Ul,c=Kl;function u(){var t=Math.min(a.length,s.length);return c!==Kl&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),i=t>2?Ql:Jl,r=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(r||(r=i(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=i(s,a.map(t),Bl)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Xl),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=Yl,u()},h.clamp=function(t){return arguments.length?(c=!!t||Kl,u()):c!==Kl},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,i){return t=n,e=i,u()}}function ec(t,e,n,i){var r,o=function(t,e,n){n=+n;const i=(e=+e)<(t=+t),r=i?ua(e,t,n):ua(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}(t,e,n);switch((i=fo(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(co(e)/3)))-co(Math.abs(t)))}(o,a))||(i.precision=r),bo(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,co(e)-co(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-co(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return vo(i)}function nc(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const i=e<t,[r,o,a]=i?ca(e,t,n):ca(t,e,n);if(!(o>=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(r+t)/-a;else for(let t=0;t<s;++t)l[t]=(r+t)*a;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return ec(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(r=l,l=c,c=r,r=a,a=s,s=r);u-- >0;){if((r=ua(l,c,n))===i)return o[a]=l,o[s]=c,e(o);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}i=r}return t},t}function ic(){var t=tc()(Kl,Kl);return t.copy=function(){return e=t,ic().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},Ks.apply(t,arguments),nc(t)}function rc(){var t,e=[.5],n=[0,1],i=1;function r(r){return null!=r&&r<=r?n[na(e,r,0,i)]:t}return r.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,n.length-1),r):e.slice()},r.range=function(t){return arguments.length?(n=Array.from(t),i=Math.min(e.length,n.length-1),r):n.slice()},r.invertExtent=function(t){var i=n.indexOf(t);return[e[i-1],e[i]]},r.unknown=function(e){return arguments.length?(t=e,r):t},r.copy=function(){return rc().domain(e).range(n).unknown(t)},Ks.apply(r,arguments)}function oc(t){return void 0===t?t=>t:e=>t(e)}function ac(t){return Math.max(0,Math.min(1,t))}function sc(t){return"object"==typeof t}function lc(t,e,n){const i=Math.abs(e-n)/(t+1),r=[];for(let o=1;o<=t;o++){const t=o*i;r.push(e<n?e+t:e-t)}return r}function cc(t,e,n){if(1===t.length)return t;const i=t.concat([]);for(let r=0;r<t.length;r++){let o=t[r],a=t[r+1];0===r&&o!==n.start()?(i.push(...lc(e,o,a)),o-=a-o,a=t[r],i.push(...lc(e,o,a))):r===t.length-1&&a!==n.end()?(a=o+(o-t[r-1]),i.push(...lc(e,o,a))):i.push(...lc(e,o,a))}return i.filter((t=>t>=n.min()&&t<=n.max()))}function uc(t){let{distance:e,scale:n,minorCount:i=0,unitDivider:r=100,formatter:o}=t;const a=Zi(r)||Zi(e)?2:Math.max(e/r,2),s=Math.min(1e3,Math.round(a));let l=n.ticks(s);l.length<=1&&(l=n.ticks(s+1));const c=i>0?cc(l,i,n):l;c.sort(((t,e)=>t-e));const u=c.map(oc(o));return c.map(((t,e)=>{const i=n(t);return{position:i,start:i,end:i,label:u[e],value:t,isMinor:-1===l.indexOf(t)}}))}function hc(t){let{distance:e,scale:n,minorCount:i=0,unitDivider:r=100,formatter:o}=t;const a=Zi(r)||Zi(e)?2:Math.max(e/r,2),s=Math.min(1e3,Math.round(a)),l=s>10?10:s;n.nice(l);const c=n.ticks(s),u=i>0?cc(c,i,n):c;u.sort(((t,e)=>t-e));const h=u.map(oc(o));return u.map(((t,e)=>{const i=n(t);return{position:i,start:i,end:i,label:h[e],value:t,isMinor:-1===c.indexOf(t)}}))}function dc(t){let e,{settings:n,scale:i,distance:r,formatter:o=t=>t}=t;const a=n.minorTicks&&!Zi(n.minorTicks.count)?Math.min(100,n.minorTicks.count):0;if(Array.isArray(n.ticks.values)){const t=n.ticks.values.filter((t=>"object"==typeof t?!Zi(t.value):!Zi(t)));e=function(t){let{values:e,scale:n,formatter:i=t=>t}=t;return e.sort(((t,e)=>(sc(t)?t.value:t)-(sc(e)?e.value:e))).filter(((t,e,i)=>{const r=sc(t)?t.value:t;return r<=n.max()&&r>=n.min()&&i.indexOf(t)===e})).map((t=>{const e=sc(t),r=e?t.value:t,o=n(r);return{position:o,value:r,label:e&&void 0!==t.label?t.label:i(r),isMinor:!!e&&!!t.isMinor,start:e&&!isNaN(t.start)?ac(n(t.start)):o,end:e&&!isNaN(t.end)?ac(n(t.end)):o}}))}({values:t,scale:i.copy(),formatter:o})}else if(Zi(n.ticks.count)){e=(n.ticks.tight?hc:uc)({distance:r,minorCount:a,unitDivider:n.ticks.distance,scale:i,formatter:o}),n.ticks.forceBounds&&function(t,e,n){const i=t.map((t=>t.position)),r=e.range();-1===i.indexOf(r[0])?t.splice(0,0,{position:r[0],start:r[0],end:r[0],label:n(e.start()),isMinor:!1,value:e.start()}):t[0]&&t[0].isMinor&&(t[0].isMinor=!1);const o=t[t.length-1];-1===i.indexOf(r[1])?t.push({position:r[1],start:r[1],end:r[1],label:n(e.end()),isMinor:!1,value:e.end()}):o&&o.isMinor&&(o.isMinor=!1)}(e,i,o)}else{e=function(t){let{count:e,minorCount:n,scale:i,formatter:r}=t;return i.ticks((e-1)*n+e).map(((t,e)=>{const o=i(t);return{position:o,start:o,end:o,label:r(t),isMinor:e%(n+1)!=0,value:t}}))}({count:Math.min(1e3,n.ticks.count),minorCount:a,scale:i.copy(),formatter:o})}return e}function fc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={};return Object.keys(e).forEach((r=>{const o=typeof t[r];i[r]="function"===o?t[r](n):"undefined"===o?e[r]:t[r]})),i}const pc={min:NaN,max:NaN,expand:NaN,include:[],invert:!1},gc={tight:!1,forceBounds:!1,values:void 0,count:NaN,distance:100},mc={count:NaN};function yc(t,e){t.instance||(t.instance=e.copy(),t.instance.domain([e.start(),e.end()]),t.instance.clamp(!0),t.instance.range(t.invert?[1,0]:[0,1]))}function xc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=ic(),r={instance:null,invert:!1},o={data:e,resources:n},a=fc(t,pc,o);let s;function l(t){return Zi(t)?NaN:i(t)}a.ticks=fc(t.ticks,gc,o),a.minorTicks=fc(t.minorTicks,mc,o),l.data=()=>e,l.invert=function(t){return i.invert(t)},l.rangeRound=function(t){return i.rangeRound(t),l},l.clamp=function(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return i.clamp(t),l},l.cachedTicks=function(){return s},l.clearTicksCache=function(){return s=void 0,this},l.ticks=function(t){return null!==t&&"object"==typeof t?(t.settings=t.settings||{},t.settings=Hi(!0,{},a,t.settings),t.scale=l,s=dc(t),s):(s=i.ticks(t),s)},l.nice=function(t){return i.nice(t),l},l.tickFormat=function(t,e){return i.tickFormat(t,e)},l.interpolate=function(t){return i.interpolate(t),l},l.domain=function(t){return arguments.length?(i.domain(t),r.instance&&r.instance.domain([l.start(),l.end()]),l):i.domain()},l.range=function(t){return arguments.length?(i.range(t),l):i.range()},l.start=function(){return l.domain()[0]},l.end=function(){return l.domain()[this.domain().length-1]},l.min=function(){return Math.min(this.start(),this.end())},l.max=function(){return Math.max(this.start(),this.end())},l.classify=function(t){let e=(l.start()-l.end())/t,n=[l.end()],i=[],r=e/2;for(let o=0;o<t;o++){let t=n[n.length-1]||0,o=t+e,a=l(t+r);n.push(o,o),i.push(a,a)}return n.pop(),l.domain(n),l.range(i),l},l.copy=function(){const r=xc(t,e,n);return r.domain(l.domain()),r.range(l.range()),r.clamp(i.clamp()),r},l.norm=function(t){return yc(r,l),r.instance(t)},l.normInvert=function(t){return yc(r,l),r.instance.invert(t)};const{mini:c,maxi:u}=function(t,e){const n=+t.min,i=+t.max;let r=0,o=1;if(e&&e[0]){const n=e.map((t=>t.min())).filter((t=>!isNaN(t))),i=e.map((t=>t.max())).filter((t=>!isNaN(t)));if(r=n.length?Math.min(...n):Number.NaN,o=i.length?Math.max(...i):Number.NaN,isNaN(r)||isNaN(o))r=-1,o=1;else if(r===o&&0===r)r=-1,o=1;else if(r===o&&r)r-=Math.abs(.1*r),o+=Math.abs(.1*o);else if(!isNaN(t.expand)){const e=o-r;r-=e*t.expand,o+=e*t.expand}if(Array.isArray(t.include)){const e=t.include.filter((t=>!isNaN(t)));r=Math.min(...e,r),o=Math.max(...e,o)}}return{mini:isNaN(n)?r:n,maxi:isNaN(i)?o:i}}(a,e?e.fields:[]);return l.domain([c,u]),l.range(a.invert?[1,0]:[0,1]),r.invert=a.invert,l}const vc={padding:0,paddingInner:NaN,paddingOuter:NaN,align:.5,invert:!1,maxPxStep:NaN,range:[0,1]};function bc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={data:e,resources:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}},i=fc(t,vc,n),r=e.items||[],o={},a=[],s=[];function l(t,n){t.data=()=>e,t.datum=t=>r[o[t]],t.start=function(){return t.domain()[0]},t.end=function(){return t.domain()[t.domain().length-1]},t.labels=()=>s,t.ticks=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scale=t,function(t){let{scale:e}=t;const n=e.domain(),i=e.data().items,r=e.labels?e.labels():n,o=e.bandwidth();return n.map(((t,n)=>{const a=e(t);return{position:a+o/2,label:"".concat(r[n]),data:i?i[n]:void 0,start:a,end:a+o}}))}(e,n.trackBy)}}const c=Qs();l(c,t),c.pxScale=function(e){const n=i.maxPxStep;if(isNaN(n))return c;const r=c.domain().length,o=Math.max(1,r-c.paddingInner()+2*c.paddingOuter());if(o*n>=e)return c;const a=c.copy();a.type=c.type,l(a,t);const s=o*n/e,u=(1-s)*c.align();return a.range(i.invert?[s+u,u]:[u,s+u]),a};const u="function"==typeof t.value?t.value:t=>t.datum.value,h="function"==typeof t.label?t.label:t=>t.datum.label;for(let t=0;t<r.length;t++){const e=Hi({datum:r[t]},n),i=u(e,t);-1===a.indexOf(i)&&(a.push(i),s.push(h(e,t)),o[i]=t)}return c.domain(a),c.range(i.invert?i.range.slice().reverse():i.range),c.padding(isNaN(i.padding)?0:i.padding),isNaN(i.paddingInner)||c.paddingInner(i.paddingInner),isNaN(i.paddingOuter)||c.paddingOuter(i.paddingOuter),c.align(isNaN(i.align)?.5:i.align),c}const wc={depth:0};function Mc(t,e,n){return t.ancestors().map((t=>e(Hi({datum:t.data},n)))).reverse().slice(1).toString()}const kc=t=>t.min(),_c=t=>t.max();function Sc(t,e){const n=t&&!isNaN(t.min),i=t&&!isNaN(t.max);let r=n?+t.min:0,o=i?+t.max:1;if(e&&e.length){if(!n){const t=e.map(kc).filter(Ki);r=t.length?Math.min(...t):r}if(!i){const t=e.map(_c).filter(Ki);o=t.length?Math.max(...t):o}}return[r,o]}const Nc={domain:[],range:[],invert:!1,min:NaN,max:NaN};function Rc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=xc(t,e,n).clamp(!0).interpolate(ql),r=fc(t,Nc,{data:e,resources:n}),o=Array.isArray(r.domain)&&r.domain.length,a=Array.isArray(r.range)&&r.range.length,s=i;Hi(!0,s,i);const[l,c]=Sc(r,e?e.fields:[]),u=o?r.domain.length:-1,h=n.theme?n.theme.palette("sequential",u>0?u:2):[],d=a?r.range:h;return s.range(r.invert?d.slice().reverse():d.slice()),s.domain(o?r.domain:function(t,e,n){const i=t.length;if(2===i)return[e,n];const r=[],o=(n-e)/(i-1);r.push(e);for(let t=1;t<i-1;t++)r.push(e+o*t);return r.push(n),r}(s.range(),l,c)),s}const Ac={domain:[],range:[],invert:!1,min:NaN,max:NaN,nice:!1};function Cc(t){const e=[];for(let n=0;n<t.length-1;n++)e.push((t[n]+t[n+1])/2);return e}const Dc={domain:[],range:[]};const Oc={domain:[],range:[],unknown:void 0},zc={domain:[],range:[],override:!1};const Ec=so();function Ic(t,e,n){let i=t.data;t.source&&(n.logger.warn("Deprecated: Scale data source configuration"),i={extract:[]},(Array.isArray(t.source)?t.source:[t.source]).forEach((t=>{i.extract.push({field:t})})));const r=Xs(i,e,n);let o,a=t.type||function(t){return t.root?"h-band":t.fields&&t.fields[0]?function(t){const e=t.map((t=>"dimension"===t.type()?"band":"linear"));return-1!==e.indexOf("linear")?"linear":"band"}(t.fields):"linear"}(r);return"color"===a&&(a=r.fields&&r.fields[0]&&"dimension"===r.fields[0].type()?"categorical-color":"sequential-color"),n.scale.has(a)&&(o=n.scale.get(a),o=o(t,r,{theme:n.theme,logger:n.logger}),o.type=a),o}Ec("linear",xc),Ec("band",bc),Ec("h-band",(function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={data:n,resources:i},o=fc(e,vc,r);o.ticks=fc(e.ticks,wc,r),o.value="function"==typeof e.value?e.value:t=>t.datum.value,o.label="function"==typeof e.label?e.label:t=>t.datum.value;let a=bc(o);const{values:s,labels:l,items:c,ticks:u}=function(t,e,n){const i=e.ticks.depth,r=e.value,o=e.label,a=[],s=[],l={},c=[];let u=0;if(!t)return{values:a,labels:s,items:l,ticks:c};t.eachAfter((t=>{if(t.depth>0){const e=Mc(t,r,n),h=t.leaves()||[t],d=r(Hi({datum:t.data},n)),f=o(Hi({datum:t.data},n)),p=Array.isArray(t.children),g={key:e,count:h.length,value:d,label:f,leftEdge:Mc(h[0],r,n),rightEdge:Mc(h[Math.max(h.length-1,0)],r,n),node:t};p?(a.push("SPACER_".concat(u,"_SPACER")),u++):(a.push(e),s.push(f)),(i<=0&&!p||t.depth===i)&&c.push(g),l[e]=g}}));const h=t.height-1;return h>0&&a.splice(-h),{values:a,labels:s,items:l,ticks:c}}(n.root,o,r),h=function(t){const e=String(t),n=c[e];return a(n?o.invert?n.rightEdge:n.leftEdge:e)};Hi(!0,h,a),h.bandwidth=function(t){const e=c[String(t)],n=a.bandwidth();if(e&&!e.isLeaf){const t=h(e.leftEdge),i=h(e.rightEdge);return Math.abs(t-i)+n}return n},h.step=function(t){const e=c[String(t)],n=e?e.count:1;let i=a.step();return i*=n,i},h.data=()=>n,h.datum=t=>{const e=c[String(t)];return e?e.node.data:null},h.copy=()=>t(e,n,i),h.labels=()=>l,h.ticks=()=>u.map((t=>{const e=h(t.key),n=h.bandwidth(t.key);return{position:e+n/2,label:t.label,data:t.node.data,start:e,end:e+n}}));const d=a.pxScale;return h.pxScale=function(t){return a=d(t),h},h.domain(s),h})),Ec("sequential-color",Rc),Ec("threshold-color",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=rc(),r=fc(t,Ac,{data:e,resources:n}),o=Array.isArray(r.domain)&&r.domain.length,a=Array.isArray(r.range)&&r.range.length;function s(t){return Zi(t)?NaN:i(t)}Object.keys(i).forEach((t=>s[t]=i[t]));const l=e.fields,[c,u]=Sc(r,l),h=o?r.domain.length:-1,d=n.theme?n.theme.palette("sequential",h>0?h:2):[];let f=a?r.range:d,p=[];return p=o?r.domain:r.nice?function(t,e,n){const i=2===t.length?10:Math.max(1,t.length),r=ic().domain([e,n]).nice(i).ticks(i);if(!t||!t.length)return r;const o=Math.max(0,t.length-1);for(;r.length>o;)r[0]-e<=n-r[r.length-1]?r.shift():r.pop();return r}(f,c,u):[c+(u-c)/2],f.length>p.length+1?p=function(t,e,n){const i=t.length;if(2===i)return[e+(n-e)/2];const r=[],o=(n-e)/i;for(let t=1;t<i;t++)r.push(e+o*t);return r}(f,c,u):f.length<p.length+1&&(f=function(t,e,n,i){n=t[0],i=t&&t.length>=2?t[t.length-1]:i;const r=Rc().domain([n,i]).range(e);return[n,...Cc(t),i].map((t=>r(t)))}(p,f,c,u)),s.data=()=>e,s.range(r.invert?f.slice().reverse():f),s.domain(p),s})),Ec("categorical-color",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Js(),r={data:e,resources:n},o=fc(t,Dc,r),a="function"==typeof t.value?t.value:t=>t.datum.value,s="function"==typeof t.label?t.label:t=>t.datum.label,l=e.items||[],c={},u=[],h=[];for(let t=0;t<l.length;t++){const e=Hi({datum:l[t]},r),n=a(e,t);-1===u.indexOf(n)&&(u.push(n),h.push(s(e,t)),c[n]=t)}return i.data=()=>e,i.labels=()=>h,i.label=t=>h[u.indexOf(t)],i.datum=t=>l[c[t]],i.range(o.range),Array.isArray(o.domain)&&o.domain.length?i.domain(o.domain):i.domain(u),i}(t,e,n),r=n.theme,o=fc(t,Oc,{data:e,resources:n});let a;if(o.explicit=fc(t.explicit,zc,{data:e,resources:n}),a=Array.isArray(o.range)&&0!==o.range.length?o.range.slice():r?r.palette("categorical",i.domain().length).slice():[],o.unknown)i.unknown(o.unknown);else if(r&&r.palette("unknown")){let t=r.palette("unknown");i.unknown(t[0])}if(Array.isArray(o.explicit.domain)&&o.explicit.domain.length){const t=i.domain().slice(),e=o.explicit.domain,n=Array.isArray(o.explicit.range)?o.explicit.range:[],r=Math.floor(t.length/a.length);for(let t=1;t<r+1;t*=2)a=a.concat(a);if(o.explicit.override)for(let i=0;i<e.length;i++){const r=t.indexOf(e[i]);r>-1&&(a[r]=n[i])}else{const i=e.map(((e,i)=>[t.indexOf(e),e,n[i]])).sort(((t,e)=>t[0]-e[0]));i.forEach((e=>{const n=t.indexOf(e[1]);-1!==n&&a.splice(n,0,e[2])}))}a.length=t.length}return i.range(a),i}));var Tc={};function Pc(){Pc.init.call(this)}Tc.isObject=function(t){return"object"==typeof t&&null!==t},Tc.isNumber=function(t){return"number"==typeof t},Tc.isUndefined=function(t){return void 0===t},Tc.isFunction=function(t){return"function"==typeof t};var qc=Pc;Pc.EventEmitter=Pc,Pc.prototype._events=void 0,Pc.prototype._maxListeners=void 0,Pc.defaultMaxListeners=10,Pc.init=function(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0},Pc.prototype.setMaxListeners=function(t){if(!Tc.isNumber(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},Pc.prototype.emit=function(t){var e,n,i,r,o,a;if(this._events||(this._events={}),"error"===t&&!this._events.error)throw(e=arguments[1])instanceof Error?e:Error('Uncaught, unspecified "error" event.');if(n=this._events[t],Tc.isUndefined(n))return!1;if(Tc.isFunction(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,r=new Array(i-1),o=1;o<i;o++)r[o-1]=arguments[o];n.apply(this,r)}else if(Tc.isObject(n)){for(i=arguments.length,r=new Array(i-1),o=1;o<i;o++)r[o-1]=arguments[o];for(i=(a=n.slice()).length,o=0;o<i;o++)a[o].apply(this,r)}return!0},Pc.prototype.addListener=function(t,e){var n;if(!Tc.isFunction(e))throw TypeError("listener must be a function");(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Tc.isFunction(e.listener)?e.listener:e),this._events[t]?Tc.isObject(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,Tc.isObject(this._events[t])&&!this._events[t].warned)&&((n=Tc.isUndefined(this._maxListeners)?Pc.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,Tc.isFunction(console.error)&&console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),Tc.isFunction(console.trace)&&console.trace()));return this},Pc.prototype.on=Pc.prototype.addListener,Pc.prototype.once=function(t,e){if(!Tc.isFunction(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},Pc.prototype.removeListener=function(t,e){var n,i,r,o;if(!Tc.isFunction(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=(n=this._events[t]).length,i=-1,n===e||Tc.isFunction(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(Tc.isObject(n)){for(o=r;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){i=o;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},Pc.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],Tc.isFunction(n))this.removeListener(t,n);else if(Array.isArray(n))for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},Pc.prototype.listeners=function(t){return this._events&&this._events[t]?Tc.isFunction(this._events[t])?[this._events[t]]:this._events[t].slice():[]},Pc.listenerCount=function(t,e){return t._events&&t._events[e]?Tc.isFunction(t._events[e])?1:t._events[e].length:0};var Lc={mixin:t=>(Object.keys(qc.prototype).forEach((e=>{t[e]=qc.prototype[e]})),qc.init(t),t)};function jc(){let t=0,e=0,n=0,i=0;n=n||t;const r={move(t){this.moveTo(n+t)},moveTo(o){const a=Math.max(t,Math.min(e-i,o));n!==a&&(n=a,r.emit("update"))},update(o){let a=!1;({min:t=t,max:e=e}=o),void 0!==o.viewSize&&o.viewSize!==i&&(i=o.viewSize,a=!0);const s=Math.max(t,Math.min(e-i,n));n!==s&&(n=s,a=!0),a&&r.emit("update")},getState:()=>({min:t,max:e,start:n,viewSize:i})};return Lc.mixin(r),r}function Fc(t,e){const n=t.min||0,i=t.max||0,r=t.viewSize||0,o=e||jc();return o.update({min:n,max:i,viewSize:r}),o}function Bc(t,e){return t<=e}function Vc(t,e){return t<e}function $c(t,e,n){let i=0;for(;i<t.length&&e>t[i];)++i;return t[i]===e&&n&&++i,i}function Hc(){let t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=[];function r(){}return r.configure=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{includeMax:i=!0,includeMin:r=!0}=n;t=i?Bc:Vc,e=r?Bc:Vc},r.add=t=>{let{min:e,max:n}=t;const r=$c(i,e),o=$c(i,n,!0),a=[r,o-r];r%2==0&&a.push(e),o%2==0&&a.push(n);const s=i.join(",");i.splice(...a);return s!==i.join(",")},r.remove=t=>{let{min:e,max:n}=t;const r=$c(i,e),o=$c(i,n,!0),a=[r,o-r];r%2==1&&a.push(e),o%2==1&&a.push(n);const s=i.join(",");i.splice(...a);return s!==i.join(",")},r.set=t=>{const e=i.join(",");i=[],Array.isArray(t)?t.forEach(r.add):r.add(t);return e!==i.join(",")},r.clear=()=>{const t=i.length>0;return i=[],t},r.containsValue=n=>function(t,e,n,i){const r=t.length;for(let o=1;o<r;o+=2)if(n(t[o-1],e)&&i(e,t[o]))return!0;return!1}(i,n,e,t),r.containsRange=t=>{let{min:e,max:n}=t;const r=$c(i,e,!0),o=$c(i,n);return r===o&&o%2==1},r.toggle=t=>r.containsRange(t)?r.remove(t):r.add(t),r.ranges=()=>{const t=[];for(let e=1;e<i.length;e+=2)t.push({min:i[e-1],max:i[e]});return t},r.configure(n),r}function Wc(){let t=[];function e(){}return e.add=e=>-1===t.indexOf(e)&&(t.push(e),!0),e.remove=e=>{const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)},e.contains=e=>-1!==t.indexOf(e),e.values=()=>t.slice(),e.clear=()=>t=[],e.toString=()=>t.join(";"),e}const Uc={key:void 0,includeMin:!0,includeMax:!0};function Yc(t){let{items:e,collection:n,vc:i}=t;const r={},o=[];let a,s;for(let t=0,o=e.length;t<o;t++){a=e[t].key,n[a]||(n[a]=i()),s=e[t].values||[e[t].value];for(let t=0;t<s.length;t++)n[a].add(s[t])&&(r[a]=r[a]||[],r[a].push(s[t]))}const l=Object.keys(r);for(let t=0,e=l.length;t<e;t++)a=l[t],o.push({id:a,values:r[a]});return o}function Xc(t){let{items:e,collection:n}=t;const i={},r=[];let o,a;for(let t=0,r=e.length;t<r;t++)if(o=e[t].key,n[o]){a=e[t].values||[e[t].value];for(let t=0;t<a.length;t++)n[o].remove(a[t])&&(i[o]=i[o]||[],i[o].push(a[t]))}const s=Object.keys(i);for(let t=0,e=s.length;t<e;t++)o=s[t],r.push({id:o,values:i[o]});return r}function Gc(t){const e={};let n,i;for(let r=0,o=t.length;r<o;r++){n=t[r].key,i=t[r].values||[t[r].value],e[n]||(e[n]=[]);for(let t=0;t<i.length;t++){-1===e[n].indexOf(i[t])&&e[n].push(i[t])}}return e}function Kc(t){let{key:e,collection:n,obj:i,fn:r,value:o}=t;n[e]||(n[e]=r()),i[e]=i[e]||[],i[e].push(o),n[e].add(o)}function Zc(t,e){const n=[],i=Object.keys(t);let r,o;const a=t=>-1===e[r].indexOf(t);for(let s=0,l=i.length;s<l;s++)r=i[s],e[r]?(o=t[r].filter(a),o.length&&n.push({id:r,values:o})):n.push({id:r,values:t[r]});return n}function Jc(t,e,n){const i=function(t,e){if(!Object.keys(e).length)return t;const n=t.length,i=Array(n);for(let r=0;r<n;r++)i[r]=t[r].key in e?Hi({},t[r],{key:e[t[r].key]}):t[r];return i}(e,n);return t&&t.length?t.reduce(((t,e)=>e(t)),i):i}function Qc(t){return t.replace(/(-[a-z])/g,(t=>t.toUpperCase().replace("-","")))}function tu(t){return t.replace(/([A-Z])/g,(t=>"-".concat(t.toLowerCase())))}function eu(t,e,n){let{ranges:i,interceptors:r,rc:o,aliases:a,rangeConfig:s}=n;const l=Jc(r["".concat(e,"Ranges")],t,a);let c=!1;return l.forEach((t=>{const n=t.key;if(i[n]||(i[n]=o(s.sources[n]||s.default)),"set"===e)c=i[n][e](t.ranges||t.range)||c;else{const r=t.ranges||[t.range];for(let t=0;t<r.length;t++)c=i[n][e](r[t])||c}})),c}function nu(){let{vc:t=Wc,rc:e=Hc}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1,i={},r={},o={},a={sources:{},default:Hi({},Uc)};const s={addValues:[],removeValues:[],toggleValues:[],setValues:[],addRanges:[],setRanges:[],removeRanges:[],toggleRanges:[]},l=()=>{const t={values:{},ranges:{}};return Object.keys(r).forEach((e=>{t.values[e]=r[e].values()})),Object.keys(i).forEach((e=>{t.ranges[e]=i[e].ranges()})),t},c={ls:[],clear(){this.ls.forEach((t=>t.clear()))},start(){this.ls.forEach((t=>t.start()))},end(){this.ls.forEach((t=>t.end()))},update(){const t=l();this.ls.forEach((e=>e._state(t)))},updateValues(){const t=l();this.ls.forEach((e=>e._state({values:t.values})))},updateRanges(){const t=l();this.ls.forEach((e=>e._state({ranges:t.ranges})))}},u={configure:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Array.isArray(t.ranges)&&t.ranges.length&&(a={sources:{},default:Hi({},Uc)},t.ranges.forEach((t=>{const e={};Object.keys(Uc).filter((t=>"key"!==t)).forEach((n=>{e[n]=void 0!==t[n]?t[n]:Uc[n]})),void 0!==t.key?a.sources[t.key]=e:a.default=e})),Object.keys(i).forEach((t=>i[t].configure(a.sources[t]||a.default))),u.emit("update",[],[]))},link:t=>{if(u===t)throw new Error("Can't link to self");c.ls.push(t),t._state(l())},_state:t=>{if(!t)return l();if(t.values){const e=[];Object.keys(t.values).forEach((n=>{r[n]&&t.values[n].join(";")===r[n].toString()||e.push({key:n,values:t.values[n]})})),Object.keys(r).forEach((n=>{t.values[n]||e.push({key:n,values:[]})})),e.length&&u.setValues(e)}if(t.ranges){const e=[];Object.keys(t.ranges).forEach((n=>{i[n]&&t.ranges[n].join(";")===i[n].toString()||e.push({key:n,ranges:t.ranges[n]})})),Object.keys(i).forEach((n=>{t.ranges[n]||e.push({key:n,ranges:[]})})),e.length&&u.setRanges(e)}},start:function(){if(!n){n=!0;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];u.emit("start",...e),c.start()}},end:function(){if(n){n=!1,i={},r={};for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];u.emit("end",...e),c.end()}},isActive:()=>n,clear:()=>{const t=u.brushes().filter((t=>"value"===t.type&&t.brush.values().length)).map((t=>({id:t.id,values:t.brush.values()}))),e=Object.keys(i).length>0||t.length;i={},r={},e&&(u.emit("update",[],t),c.clear())},brushes:()=>{let t=[];return t=t.concat(Object.keys(i).map((t=>({type:"range",id:t,brush:i[t]})))),t=t.concat(Object.keys(r).map((t=>({type:"value",id:t,brush:r[t]})))),t},addValue:(t,e)=>{u.addValues([{key:t,value:e}])},addValues:e=>{const i=Jc(s.addValues,e,o),a=Yc({vc:t,collection:r,items:i});u.emit("add-values",i),a.length&&(n||(n=!0,u.emit("start")),u.emit("update",a,[]),c.updateValues())}};return u.setValues=e=>{const i=Jc(s.setValues,e,o),a=function(t){let{items:e,vCollection:n,vc:i}=t;const r={},o=Gc(e);let a,s=[],l=[];const c={},u=Object.keys(n);for(let t=0,e=u.length;t<e;t++)a=u[t],c[a]=n[a].values().slice(),delete n[a];const h=t=>{n[a]&&n[a].contains(t)||Kc({key:a,value:t,collection:n,obj:r,fn:i})},d=Object.keys(o);for(let t=0,e=d.length;t<e;t++)a=d[t],o[a].forEach(h);return l=Zc(c,r),s=Zc(r,c),[s,l]}({items:i,vCollection:r,vc:t});u.emit("set-values",i),(a[0].length>0||a[1].length>0)&&(n||(n=!0,u.emit("start")),u.emit("update",a[0],a[1]),c.updateValues())},u.removeValue=(t,e)=>{u.removeValues([{key:t,value:e}])},u.removeValues=t=>{const e=Jc(s.removeValues,t,o),n=Xc({collection:r,items:e});u.emit("remove-values",e),n.length&&(u.emit("update",[],n),c.updateValues())},u.addAndRemoveValues=(e,i)=>{const a=Jc(s.addValues,e,o),l=Jc(s.removeValues,i,o),h=Yc({vc:t,collection:r,items:a}),d=Xc({collection:r,items:l});u.emit("add-values",a),u.emit("remove-values",l),(h.length||d.length)&&(n||(n=!0,u.emit("start")),u.emit("update",h,d),c.updateValues())},u.toggleValue=(t,e)=>{u.toggleValues([{key:t,value:e}])},u.toggleValues=e=>{const i=Jc(s.toggleValues,e,o),a=function(t){let{items:e,values:n,vc:i}=t;const r={},o={},a=[],s=[],l=Gc(e);let c,u,h;const d=Object.keys(l);for(let t=0,e=d.length;t<e;t++){c=d[t],h=l[c];for(let t=0,e=h.length;t<e;t++)u=h[t],n[c]&&n[c].contains(u)?n[c]&&n[c].contains(u)&&(o[c]=o[c]||[],o[c].push(u),n[c].remove(u)):Kc({key:c,value:u,collection:n,obj:r,fn:i})}const f=Object.keys(r);for(let t=0,e=f.length;t<e;t++)c=f[t],a.push({id:c,values:r[c]});const p=Object.keys(o);for(let t=0,e=p.length;t<e;t++)c=p[t],s.push({id:c,values:o[c]});return[a,s]}({items:i,values:r,vc:t});u.emit("toggle-values",i),(a[0].length>0||a[1].length>0)&&(n||(n=!0,u.emit("start")),u.emit("update",a[0],a[1]),c.updateValues())},u.containsValue=(t,e)=>{let n=o[t]||t;return!!r[n]&&r[n].contains(e)},u.addRange=(t,e)=>{u.addRanges([{key:t,range:e}])},u.addRanges=t=>{eu(t,"add",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},u.removeRange=(t,e)=>{u.removeRanges([{key:t,range:e}])},u.removeRanges=t=>{eu(t,"remove",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},u.setRange=(t,e)=>{u.setRanges([{key:t,range:e}])},u.setRanges=t=>{eu(t,"set",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},u.toggleRange=(t,e)=>{u.toggleRanges([{key:t,range:e}])},u.toggleRanges=t=>{eu(t,"toggle",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},u.containsRangeValue=(t,e)=>{let n=o[t]||t;return!!i[n]&&i[n].containsValue(e)},u.containsRange=(t,e)=>{let n=o[t]||t;return!!i[n]&&i[n].containsRange(e)},u.containsMappedData=(t,e,n)=>{let a=[];const s=Object.keys(t);let l,c,u,h;for(let e=0,n=s.length;e<n;e++){if(l=s[e],"value"===l)c=t,a[e]={key:"",i:e,bool:!1};else{if("source"===l)continue;c=t[l],a[e]={key:l,i:e,bool:!1}}u=c.source&&c.source.field,void 0!==u&&(void 0!==c.source.key&&(u="".concat(c.source.key,"/").concat(u)),u in o&&(u=o[u]),h=c.value,i[u]?a[e].bool=Array.isArray(h)?i[u].containsRange({min:h[0],max:h[1]}):i[u].containsValue(h):r[u]&&r[u].contains(h)&&(a[e].bool=!0))}return e?(a=a.filter((t=>-1!==e.indexOf(t.key))),"and"===n?!!a.length&&!a.some((t=>!1===t.bool)):"xor"===n?!!a.length&&a.some((t=>t.bool))&&a.some((t=>!1===t.bool)):a.some((t=>t.bool))):a.some((t=>t.bool))},u.intercept=(t,e)=>{const n=Qc(t);s[n]&&s[n].push(e)},u.removeInterceptor=(t,e)=>{const n=Qc(t);if(!s[n])return;const i=s[n].indexOf(e);-1!==i&&s[n].splice(i,1)},u.removeAllInterceptors=t=>{const e=[];if(t){const n=Qc(t);s[n]&&s[n].length&&e.push({name:t,handlers:s[n]})}else Object.keys(s).forEach((t=>{s[t].length&&e.push({name:tu(t),handlers:s[t]})}));e.forEach((t=>{t.handlers.slice().forEach((e=>u.removeInterceptor(t.name,e)))}))},u.addKeyAlias=(t,e)=>{o[t]=e},u.removeKeyAlias=t=>{delete o[t]},Lc.mixin(u),u}function iu(t){return t*t*t}function ru(t){return--t*t*t+1}function ou(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}so();const au=["stroke","fill","color","backgroundColor","thumbColor"];function su(t,e){const n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),o=new Array(n);let a;for(a=0;a<i;++a)r[a]=lu(t[a],e[a]);for(;a<n;++a)o[a]=e[a];return function(t){for(a=0;a<i;++a)o[a]=r[a](t);return o}}function lu(t,e,n){const i=typeof e;let r;return null==e||"boolean"===i?function(t){return()=>t}(e):("number"===i?Bl:"string"===i?(r=xl(e))&&au.includes(n)?(e=r,ql):Wl:e instanceof xl?ql:e instanceof Date?Fl:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Ll:Array.isArray(e)?su:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?cu:Bl)(t,e)}function cu(t,e){const n={},i={};let r;for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=lu(t[r],e[r],r):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}function uu(t,e){return t.data?t.data.value:"text"===t.type?t.text:e}const hu={fontFamily:"Arial",fontSize:"13px",color:"#595959",backgroundColor:"#ffffff",stroke:"#000000",strokeWidth:0,$fill:"#333333"},du=/^\$/;function fu(t){const e=typeof t;return"object"!==e&&"function"!==e&&"undefined"!==e}function pu(t,e,n){const i=t[e];i&&i.scale&&i.scale.pxScale?i.scale=i.scale.pxScale(n):i&&i.pxScale&&(t[e]=i.pxScale(n))}function gu(t,e){return t.pxScale?t.pxScale(e):t}const mu={normalizeSettings:function(t,e,n){const i=Hi({},t),r=Hi({},e);return Object.keys(i).forEach((t=>{r[t]={};const o=i[t],a=typeof o;if("function"==typeof o)r[t].fn=o;else if(fu(o)){let n=e[t];"string"==typeof n&&du.test(n)&&(n=hu[n]);const i=typeof n;r[t]="undefined"===i||i===a?o:n}else o&&"object"==typeof o&&("function"==typeof o.fn&&(r[t].fn=o.fn),void 0!==o.scale&&(r[t].scale=n.scale(o.scale)),"string"==typeof o.ref&&(r[t].ref=o.ref))})),Object.keys(e).forEach((t=>{if(t in i)return;const n=e[t];"string"===typeof n&&du.test(n)?r[t]=hu[n]:r[t]=n})),r},resolveForItem:function(t,e,n){const i={},r=Object.keys(e),o=r.length,a=t.datum,s=t.datum;for(let l=0;l<o;l++){const o=r[l],c=e[o],u="object"==typeof s&&void 0!==c,h=u&&"string"==typeof c.ref,d=u&&o in s,f=h?s[c.ref]:d?s[o]:a;fu(c)?i[o]=c:u&&c.fn?(c.scale&&(t.scale=c.scale),i[o]=c.fn.call(null,t,n)):u&&c.scale&&f?(i[o]=c.scale(f.value),c.scale.bandwidth&&(i[o]+=c.scale.bandwidth()/2)):h&&f?i[o]=f.value:c.fn?i[o]=c.fn.call(null,t,n):i[o]=c}return i},updateScaleSize:pu};function yu(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(((t,e)=>Array.isArray(e.children)?(t.push(...yu(e.children)),t):(t.push(e),t)),[])}function xu(t,e){let{context:n,data:i,style:r,filter:o,mode:a}=e;const s=t.chart.brush(n),l=i,c=r.active||{},u=r.inactive||{},h=[];Object.keys(c).forEach((t=>{h.push(t)})),Object.keys(u).forEach((t=>{-1===h.indexOf(t)&&h.push(t)}));const d=[];let f=!1;const p=()=>{let e=yu(t.nodes);return"function"==typeof o&&(e=e.filter(o)),e},g=()=>{const t=p(),e=t.length;let n,i=!1;const r="function"==typeof l?l({brush:s}):l;for(let i=0;i<e;i++){if(n=t[i].data,!n)continue;t[i].__style||(t[i].__style={},h.forEach((e=>{t[i].__style[e]=t[i][e]})));const e=s.containsMappedData(n,r,a),o=d.indexOf(t[i]);let l=!1;e&&-1===o?(d.push(t[i]),l=!0):e||-1===o||(d.splice(o,1),l=!0),t[i].needToUpdate=l||f,t[i].isActive=e}for(let r=0;r<e;r++)if(n=t[r].data,n){if(t[r].needToUpdate){const e=Hi({},t[r],t[r].__style),n=t[r].isActive;h.forEach((i=>{t[r][i]=n&&i in c?"function"==typeof c[i]?c[i].call(null,e,d):c[i]:!n&&i in u?"function"==typeof u[i]?u[i].call(null,e,d):u[i]:t[r].__style[i]})),i=!0}delete t[r].needToUpdate}return f=!1,i},m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppressRender:!1};const{suppressRender:n}=e,i=p(),r=i.length;for(let t=0;t<r;t++)i[t].data&&(i[t].__style=i[t].__style||{},h.forEach((e=>{i[t].__style[e]=i[t][e],e in u&&(i[t][e]="function"==typeof u[e]?u[e].call(null,i[t]):u[e])})));f=!0,d.length=0,n||t.renderer.render(t.nodes)},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppressRender:!1};const{suppressRender:n}=e,i=p(),r=i.length;for(let t=0;t<r;t++)i[t].__style&&(Object.keys(i[t].__style).forEach((e=>{i[t][e]=i[t].__style[e]})),i[t].__style=void 0);d.length=0,n||t.renderer.render(t.nodes)},x=()=>{if(g()){const e="function"==typeof t.config.sortNodes?t.config.sortNodes(t):t.nodes;"function"==typeof t.config.customRender?t.config.customRender({render:t.renderer.render,nodes:e}):t.renderer.render(e)}};return s.on("start",m),s.on("end",y),s.on("update",x),{isActive:()=>s.isActive(),update:()=>{d.length=0,f=!0,g()},cleanUp:function(){s.removeListener("start",m),s.removeListener("end",y),s.removeListener("update",x)}}}function vu(t){let{nodes:e,action:n,chart:i,trigger:r}=t;const o=[];for(let t=0;t<e.length;t++){let n=e[t].data;null!==n&&o.push(n)}!function(t){let{dataPoints:e,action:n,chart:i,trigger:r}=t;if(!r)return;const o=r.data||[""];let a={items:[],actionFn:"toggleRanges"},s={items:[],actionFn:"toggleValues"};-1!==["add","remove","set","toggle"].indexOf(n)&&(a.actionFn="".concat(n,"Ranges"),s.actionFn="".concat(n,"Values"));for(let t=0;t<e.length;t++){const n=e[t];n&&o.forEach((t=>{let e=n&&!t?n:n[t];if(e){let t={key:e.source.field};void 0!==e.source.key&&(t.key="".concat(e.source.key,"/").concat(e.source.field)),Array.isArray(e.value)?(t.range={min:e.value[0],max:e.value[1]},a.items.push(t)):(t.value=e.value,s.items.push(t))}}))}r.contexts.forEach((t=>{a.items.length?i.brush(t)[a.actionFn](a.items):i.brush(t)[s.actionFn](s.items)}))}({dataPoints:o,action:n,chart:i,trigger:r})}function bu(t){let{collisions:e,t:n,config:i,action:r}=t,o=[],a=!1;e.length>0&&(o=e,a=!0,"stop"===n.propagation&&(o=[e[e.length-1]]));const s=o.map((t=>t.node));return vu({nodes:s,action:r,chart:i.chart,data:i.data,trigger:n}),a}function wu(t,e,n){const i=n.element().getBoundingClientRect();let r=Gi(t)?function(t,e){return 1!==t.changedTouches.length?null:{x:t.changedTouches[0].clientX-e.left,y:t.changedTouches[0].clientY-e.top}}(t,i):function(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}(t,i);return null===r||r.x<0||r.y<0||r.x>i.width||r.y>i.height?[]:(e.touchRadius>0&&Gi(t)?r={cx:r.x,cy:r.y,r:e.touchRadius}:e.mouseRadius>0&&!Gi(t)&&(r={cx:r.x,cy:r.y,r:e.mouseRadius}),n.itemsAt(r))}function Mu(t,e,n){return t?"function"==typeof t?t(e):t:n}const ku={fill:"fill",stroke:"stroke",opacity:"opacity",strokeWidth:"stroke-width",strokeLinejoin:"stroke-linejoin",fontFamily:"font-family",fontSize:"font-size",fontStyle:"font-style",textDecoration:"text-decoration",fontWeight:"font-weight",baseline:"dominant-baseline",dominantBaseline:"dominant-baseline",anchor:"text-anchor",textAnchor:"text-anchor",maxWidth:"maxWidth",transform:"transform",strokeDasharray:"stroke-dasharray",id:"id"};function _u(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n="";for(let e=0;e<t.length;e++){const i=t[e];n+=0===e?"M".concat(i.x," ").concat(i.y):"L".concat(i.x," ").concat(i.y),n+=" "}return e&&(n+="Z"),n}function Su(t,e,n,i){const r=n/2,o=t-i/2,a=e-i/2,s=t-r,l=e-r;return[{x:o,y:a},{x:o,y:l},{x:o+i,y:l},{x:o+i,y:a},{x:s+n,y:a},{x:s+n,y:a+i},{x:o+i,y:a+i},{x:o+i,y:l+n},{x:o,y:l+n},{x:o,y:a+i},{x:s,y:a+i},{x:s,y:a}]}function Nu(t){return-t/180*Math.PI}function Ru(t){return function(t){let e=(.5*(Math.floor(t/Math.PI*2)+2)+.25)*Math.PI,n=Math.cos(Math.abs(e-t))*Math.sqrt(2),i=n*Math.cos(t),r=n*Math.sin(t);return{x1:i<0?1:0,y1:r<0?1:0,x2:i>=0?i:i+1,y2:r>=0?r:r+1}}(Nu(t))}function Au(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Cu(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Du(t,e){return{x:t.x*e,y:t.y*e}}function Ou(t,e){return t.x-e.x}function zu(t,e){return t.y-e.y}function Eu(t,e){return Ou(t,e)**2+zu(t,e)**2}function Iu(t,e){return Math.sqrt(Eu(t,e))}function Tu(t,e){return t.x*e.x+t.y*e.y}function Pu(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};const i=Math.cos(e),r=Math.sin(e),o=Cu(t,n);return Au({x:i*o.x-r*o.y,y:r*o.x+i*o.y},n)}const qu={up:0,down:180,left:90,right:-90};function Lu(t){let{x:e,y:n,size:i}=t;const r=i/2;return{type:"rect",x:e-r,y:n-r,width:i,height:i}}const ju=so();ju.add("circle",(function(t){return{type:"circle",fill:"black",cx:t.x,cy:t.y,r:t.size/2}})),ju.add("diamond",(function(t){const e=t.size,n=t.x-e/2,i=t.y-e/2;return{type:"path",fill:"black",d:_u([{x:n,y:i+e/2},{x:n+e/2,y:i},{x:n+e,y:i+e/2},{x:n+e/2,y:i+e},{x:n,y:i+e/2}])}})),ju.add("saltire",(function(t){const e=Nu(45),n=t.size/2,i=isNaN(t.width)?n/2:t.width,r=Math.min(i,n);let o=t.size;const a=Math.sin(Math.asin(-e))*(r/2);o+=2*(n/Math.sin(-e)-n),o-=2*a;const s={x:t.x,y:t.y},l=Su(t.x,t.y,o,r).map((t=>Pu(t,e,s)));return{type:"path",fill:"black",d:_u(l)}})),ju.add("square",(function(t){const e=t.size;return{type:"rect",fill:"black",x:t.x-e/2,y:t.y-e/2,width:e,height:e}})),ju.add("triangle",(function(t){const e=t.size,n={x:t.x,y:t.y},i=qu[t.direction]||0,r=e/2,o=t.x-r,a=t.y-r;let s=[{x:o,y:a+e},{x:o+r,y:a},{x:o+e,y:a+e},{x:o,y:a+e}];const l=Nu(i);return s=s.map((t=>Pu(t,l,n))),{type:"path",fill:"black",d:_u(s)}})),ju.add("line",(function(t){const e="vertical"===t.direction,n=t.size/2,i=t.x,r=t.y;return{type:"line",stroke:"black",strokeWidth:1,x1:i-(e?0:n),y1:r-(e?n:0),x2:i+(e?0:n),y2:r+(e?n:0),collider:Lu(t)}})),ju.add("star",(function(t){const e=t.size,n=[],i=e/2,r=t.points||5,o=Math.min(t.innerRadius||e/2,e)/2,a=isNaN(t.startAngle)?90:t.startAngle,s=360/r;for(let e=1;e<=r;e++){const r=s*e+a,l=Nu(r),c=Nu(r+s/2),u=Math.sin(l),h=Math.cos(l),d=Math.sin(c),f=Math.cos(c);n.push({x:t.x+h*i,y:t.y+u*i}),n.push({x:t.x+f*o,y:t.y+d*o})}return{type:"path",fill:"black",d:_u(n)}})),ju.add("n-polygon",(function(t){const e=[],n=t.size/2,i=Math.max(isNaN(t.sides)?6:t.sides,3),r=360/i,o=isNaN(t.startAngle)?0:t.startAngle;for(let a=1;a<=i;a++){const i=Nu(r*a+o),s=Math.sin(i),l=Math.cos(i);e.push({x:t.x+l*n,y:t.y+s*n})}return{type:"path",fill:"black",d:_u(e)}})),ju.add("cross",(function(t){const e=t.x,n=t.y,i=t.size/2,r=isNaN(t.width)?i/2:t.width,o=Math.min(r,i);return{type:"path",fill:"black",d:_u(Su(e,n,t.size,o))}})),ju.add("bar",(function(t){const e={x:t.x,y:t.y},n="vertical"===t.direction,i=t.size/2,r=i/2/2;let o=[{x:e.x-i,y:e.y+r},{x:e.x-i,y:e.y-r},{x:e.x+i,y:e.y-r},{x:e.x+i,y:e.y+r}];if(n){const t=Nu(90);o=o.map((n=>Pu(n,t,e)))}const a=er(o);return a.type="rect",a.fill="black",a})),ju.add("rect",(function(t){const{x:e,y:n,size:i}=t,r=void 0===t.width?i:t.width,o=void 0===t.height?i:t.height;return{type:"rect",fill:"black",x:e-r/2,y:n-o/2,width:r,height:o}}));const Fu=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ju;return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t.get(e.type);if(n){const t=n(e);return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(e).forEach((n=>{void 0!==ku[n]&&"transform"!==n&&(t[n]=e[n])}))}(t,e),void 0!==e.data&&(t.data=e.data),t}return n}};function Bu(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{dock:n="center",displayOrder:i=0,prioOrder:r=0,preferredSize:o=0,minimumLayoutMode:a,show:s=!0}=t;n=n||"center";return{computePreferredSize(t){let{inner:n,outer:i,children:r}=t;return"function"==typeof o?o({inner:n,outer:i,children:r,dock:this.dock()},e):o},dock(t){return void 0!==t?(n=t,this):"function"==typeof n?n(e):n},displayOrder(t){return void 0!==t?(i=t,this):"function"==typeof i?i(e):i},prioOrder(t){return void 0!==t?(r=t,this):"function"==typeof r?r(e):r},minimumLayoutMode(t){return void 0!==t?(a=t,this):"function"==typeof a?a(e):a},show(t){return void 0!==t?(s=t,this):"function"==typeof s?s(e):s}}}function Vu(t,e,n){const{require:i=[]}=e,r=e.mediator||{},{settings:o,formatter:a,scale:s,data:l,renderer:c,chart:u,dockConfig:h,mediator:d,instance:f,rect:p,style:g,registries:m,resolver:y,update:x,_DO_NOT_USE_getInfo:v,symbol:b,isVisible:w}=n;t.emit=()=>{},w&&(t.isVisible=w),Object.defineProperty(t,"settings",{get:o}),Object.defineProperty(t,"data",{get:l}),Object.defineProperty(t,"formatter",{get:a}),Object.defineProperty(t,"scale",{get:s}),Object.defineProperty(t,"mediator",{get:d}),Object.defineProperty(t,"style",{get:g}),Object.defineProperty(t,"registries",{get:m}),p&&Object.defineProperty(t,"rect",{get:p}),v&&(t._DO_NOT_USE_getInfo=v),Object.keys(e).forEach((n=>{var i;i=n,["on","preferredSize","created","beforeMount","mounted","resize","beforeUpdate","updated","beforeRender","render","beforeUnmount","beforeDestroy","destroyed","defaultSettings","data","settings","formatter","scale","chart","dockConfig","mediator","style","resolver","registries","_DO_NOT_USE_getInfo","symbol","isVisible"].some((t=>t===i))||("function"==typeof e[n]?t[n]=e[n].bind(t):t[n]=e[n])})),i.forEach((e=>{"renderer"===e?Object.defineProperty(t,"renderer",{get:c}):"chart"===e?Object.defineProperty(t,"chart",{get:u}):"dockConfig"===e?Object.defineProperty(t,"dockConfig",{get:h}):"instance"===e?Object.defineProperty(t,"instance",{get:f}):"update"===e&&x?Object.defineProperty(t,"update",{get:x}):"resolver"===e?Object.defineProperty(t,"resolver",{get:y}):"symbol"===e&&Object.defineProperty(t,"symbol",{get:b})})),Object.keys(r).forEach((e=>{t.mediator.on(e,r[e].bind(t))}))}function $u(t,e,n){const i=e=>t[e]?(n.warn("Deprecation Warning the ".concat(e," property should be moved into layout: {} property")),t[e]):t.layout?t.layout[e]:void 0,r={};return r.displayOrder=i("displayOrder"),r.dock=i("dock"),r.prioOrder=i("prioOrder"),r.minimumLayoutMode=i("minimumLayoutMode"),t.layout=t.layout||{},t.layout.displayOrder=void 0!==r.displayOrder?r.displayOrder:t.layout.displayOrder,t.layout.prioOrder=void 0!==r.prioOrder?r.prioOrder:t.layout.prioOrder,t.layout.dock=r.dock||t.layout.dock,t.layout.minimumLayoutMode=r.minimumLayoutMode||t.layout.minimumLayoutMode,r.show=t.show,r.preferredSize=e,r}function Hu(t,e,n){Object.keys(n.on||{}).forEach((i=>{t.eventListeners=t.eventListeners||[];const r=n.on[i].bind(t);t.eventListeners.push({event:i,listener:r}),e.on(i,r)})),t.emit=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return e.emit(t,...i)}}function Wu(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{defaultSettings:n={},_DO_NOT_USE_getInfo:i=()=>({})}=t,{chart:r,container:o,mediator:a,registries:s,theme:l,renderer:c}=e,u=Lc.mixin({});let h,d,f,p,g,m=e.settings||{},y=Hi(!0,{},n,m),x=[],v=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mu,n={};return{resolve:function(i){let{data:r,settings:o,defaults:a={},scaled:s}=i;const l=n.norm=e.normalizeSettings(o,a,t.chart),c={scale:t.chart.scale,formatter:t.chart.formatter};s&&Object.keys(s).forEach((t=>{l[t]&&e.updateScaleSize(l,t,s[t])}));const u=[];if(!r||!Array.isArray(r.items)){const t={data:r,resources:c};let i=e.resolveForItem(t,n.norm,-1);return{settings:n.norm,item:i}}{let t;for(let i=0,o=r.items.length;i<o;i++){t={datum:r.items[i],data:r,resources:c};let o=e.resolveForItem(t,n.norm,i);o.data=r.items[i],u.push(o)}}return{settings:n.norm,items:u}}}}({chart:r}),b=!1;const w={nodes:[],chart:r,config:y.brush||{},renderer:null},M={tap:[],over:[]},k=[],_={},S=Hi({},m);function N(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){const r=void 0!==t[e],o=void 0!==m[e];let a;for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return r&&("function"==typeof t[e]?a=t[e].call(_,...l):i&&(a=t[e])),o&&("function"==typeof m[e]?a=m[e].call(S,...l):i&&(a=m[e])),r||o||(a=n.call(_,...l)),a}}const R=N("preferredSize",(()=>0),!0),A=N("resize",(t=>{let{inner:e}=t;return e})),C=N("created"),D=N("beforeMount"),O=N("mounted"),z=N("beforeUnmount"),E=N("beforeUpdate"),I=N("updated"),T=N("beforeRender"),P=N("beforeDestroy"),q=N("destroyed"),L=t.render,j=()=>{y.brush&&(y.brush.consume||[]).forEach((t=>{t.context&&t.style&&k.push(xu(w,t))}))},F=()=>{y.brush&&(y.brush.trigger||[]).forEach((t=>{"over"===t.on?M.over.push(t):M.tap.push(t)}))};Object.defineProperty(w,"data",{get:()=>x});const B=y.renderer||t.renderer,V=B?c||s.renderer(B)():c||s.renderer()();"function"==typeof V.settings&&V.settings(y.rendererSettings),w.renderer=V;const $={resources:r.logger?{logger:r.logger()}:{}};let H=Bu($u(y,R,r.logger()),$);const W=t=>{t.key=y.key,t.element=V.element()},U=()=>{};U.dockConfig=()=>H,U.set=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.settings&&(m=t.settings,y=Hi(!0,{},n,t.settings),H=Bu($u(y,R,r.logger()),$),w.config=y.brush||{}),y.scale&&(h=r.scale(y.scale)),y.data){const{rendererSettings:t}=y,e="function"==typeof(null==t?void 0:t.progressive)&&t.progressive(),n=Xs(y.data,{dataset:r.dataset,collection:r.dataCollection},{logger:r.logger()},r.dataCollection);e?e.isFirst?(x=n,x.items&&(x.items=[...n.items])):x.items&&(x.items=[...x.items,...n.items||[]]):x=n}else x=h?h.data():[];"string"==typeof y.formatter||"object"==typeof y.formatter?d=r.formatter(y.formatter):h&&h.data().fields&&(d=h.data().fields[0].formatter()),g=l.style(y.style||{})},U.resize=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=A({inner:t,outer:e});p=n?V.size(n):V.size(t),S.rect=Hi(!0,{computedPhysical:p.computedPhysical,computedOuter:e.computed||e,computedInner:t.computed||t},t),p=Hi(!0,{computedOuter:e.computed||e,computedInner:t.computed||t},p)},U.getRect=()=>S.rect;const Y=()=>{const t=V.renderArgs?V.renderArgs.slice(0):[],{rendererSettings:e}=y;let n=x;const i="function"==typeof(null==e?void 0:e.progressive)&&e.progressive();return x.items&&i&&(n=Xi(Xi({},x),{},{items:x.items.slice(i.start,i.end)})),t.push({data:n}),t};let X,G,K;function Z(t){const{rendererSettings:e}=y,n="function"==typeof(null==e?void 0:e.progressive)&&e.progressive();n?n.isFirst?w.nodes=[...t||[]]:w.nodes&&(w.nodes=[...w.nodes,...t||[]]):w.nodes=t}U.beforeMount=D,U.beforeRender=()=>{T({size:p})},U.render=()=>{const t=L.call(_,...Y());Z(t),V.render(t),X=t,G=S.rect.computed},U.hide=()=>{U.unmount(),V.size({x:0,y:0,width:0,height:0}),V.clear()},U.beforeUpdate=()=>{E({settings:y,data:x})},U.update=()=>{K&&K.stop();const{rendererSettings:t,brush:e,animations:n}=y;if("function"==typeof(null==t?void 0:t.transform)&&t.transform())return V.render(),void(X=null);const i=L.call(_,...Y());Z(i),k.forEach((t=>t.cleanUp())),k.length=0,M.tap=[],M.over=[],e&&(j(),F()),k.forEach((t=>{t.isActive()&&t.update()})),X&&n&&("function"==typeof n.enabled?n.enabled():n.enabled)?(n.compensateForLayoutChanges&&n.compensateForLayoutChanges({currentNodes:X,currentRect:S.rect.computed,previousRect:G}),K=function(t,e,n,i){let r,{old:o,current:a}=t,{renderer:s}=e,l=[],c={nodes:[],ips:[]},u={nodes:[],ips:[]},h={nodes:[],ips:[]},d=[],f=null;const p=n.trackBy||uu,g={start(){let t={};if(o.forEach(((e,n)=>{let i=p(e,n);t[i]=e})),a.forEach(((e,n)=>{let i=p(e,n);if(t[i]){if("path"===e.type&&e.points&&e.points.length>0&&"trend"!==e.data.source.key){const n=function(t,e){const n=t.points.filter((t=>!t.dummy)),i=e.points.filter((t=>!t.dummy)),r=i.map((t=>t.data.major.value)),o=n.filter((t=>r.includes(t.data.major.value))).map((t=>t.data.major.value)),a=n.filter((t=>o.includes(t.data.major.value))),s=i.filter((t=>o.includes(t.data.major.value)));return{old:a,current:s}}(t[i],e);h.ips.push(cu(Hi({},t[i],{points:n.old}),Hi({},e,{points:n.current}))),l.push(Hi({},t[i],{commonPoints:n.old}))}else h.ips.push(cu(t[i],e)),l.push(t[i]);h.nodes.push(e),t[i]=!1}else c.nodes.push(e),c.ips.push(cu(Hi({},e,{r:.001,opacity:0}),e))})),Object.keys(t).forEach((e=>{t[e]&&(u.nodes.push(t[e]),u.ips.push(cu(t[e],Hi({},t[e],{r:1e-4,opacity:0}))))})),d.push({name:"exiting",easing:iu,duration:200,tweens:u.ips,nodes:[...l]}),d.push({name:"updating",easing:ou,duration:400,tweens:h.ips,nodes:[]}),d.push({name:"entering",easing:ru,duration:200,tweens:c.ips,nodes:[...h.nodes]}),n.isMainComponent){var e;const t=null===(e=n.isMainComponent)||void 0===e?void 0:e.filterFn,r=t?l.filter(t).length:l.length,{isInit:o,shouldBeRemoved:a}=i.getValue("animations.updatingStageMeta");!1===o?(i.setValue("animations.updatingStageMeta.shouldBeRemoved",0===r),i.setValue("animations.updatingStageMeta.isInit",!0)):i.setValue("animations.updatingStageMeta.shouldBeRemoved",a&&0===r)}d.length&&(f=s.getScene(a),d[0].started=Date.now(),"undefined"!=typeof window&&(r=window.requestAnimationFrame(g.tick)))},tick(){let t=d[0];t||g.stop(),t.started||(t.started=Date.now());let e=(Date.now()-t.started)/t.duration,n=[],o=t.tweens.map((n=>n(t.easing(Math.min(1,e)))));if(n.push(...o),n.push(...t.nodes),s.render(n),e>=1){d.shift();const{isInit:t,shouldBeRemoved:e}=i.getValue("animations.updatingStageMeta");d.length?"updating"===d[0].name&&e&&d.shift():(!0===t&&i.setValue("animations.updatingStageMeta.isInit",!1),g.stop())}r&&(r=window.requestAnimationFrame(g.tick))},stop(){r&&(window.cancelAnimationFrame(r),r=!1)},inProgress:()=>!!r,get targetScene(){return f}};return g}({old:X,current:i},{renderer:V},n,r.storage),K.start()):V.render(i),X=i,G=S.rect.computed,V.setKey&&"string"==typeof m.key&&V.setKey(m.key)},U.updated=I,U.destroy=()=>{U.unmount(),P(f),V.destroy(),q(),f=null};const J=t=>{w.nodes=t,k.forEach((t=>{t.isActive()&&t.update()})),V.render(t)};return Vu(_,t,{settings:()=>y,data:()=>x,scale:()=>h,formatter:()=>d,renderer:()=>V,chart:()=>r,dockConfig:()=>H,mediator:()=>a,instance:()=>S,rect:()=>S.rect,style:()=>g,update:()=>J,registries:()=>s,resolver:()=>v,symbol:()=>Fu(s.symbol)}),Vu(S,m,{settings:()=>y,data:()=>x,scale:()=>h,formatter:()=>d,renderer:()=>V,chart:()=>r,dockConfig:()=>H,mediator:()=>a,style:()=>g,_DO_NOT_USE_getInfo:i.bind(_),isVisible:()=>b}),U.getBrushedShapes=function(t,e,n){const i=[];if(y.brush&&y.brush.consume){const o=r.brush(t),a=V.findShapes("*");y.brush.consume.filter((e=>e.context===t)).forEach((t=>{for(let r=0;r<a.length;r++){const s=a[r];s.data&&o.containsMappedData(s.data,n||t.data,e)&&(W(s),i.push(s),a.splice(r,1),r--)}}))}return i},U.findShapes=t=>{var e;const n=(null!==(e=K)&&void 0!==e&&e.inProgress()?K.targetScene:V).findShapes(t);for(let t=0,e=n.length;t<e;t++)W(n[t]);return n},U.shapesAt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=V.itemsAt(t);let i;i=e&&"stop"===e.propagation&&n.length>0?[n.pop().node]:n.map((t=>t.node));for(let t=0,e=i.length;t<e;t++)W(i[t]);return i},U.brushFromShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.contexts=Array.isArray(e.contexts)?e.contexts:[];vu({nodes:t,action:e.action||"toggle",trigger:e,chart:r,data:w.data})},U.mount=()=>{f=V.element&&V.element()?f:V.appendTo(o),V.setKey&&"string"==typeof m.key&&V.setKey(m.key),y.brush&&(j(),F()),Hu(S,u,m),Hu(_,u,t),b=!0},U.mounted=()=>O(f),U.unmount=()=>{[S,_].forEach((t=>{!function(t,e){t.eventListeners&&(t.eventListeners.forEach((t=>{let{event:n,listener:i}=t;e.removeListener(n,i)})),t.eventListeners.length=0),t.emit=()=>{}}(t,u)})),M.tap=[],M.over=[],k.forEach((t=>{t.cleanUp()})),k.length=0,z(),b=!1},U.onBrushTap=t=>{M.tap.forEach((e=>{(function(t){let{e:e,t:n,config:i}=t;return bu({collisions:wu(e,n,i.renderer),t:n,config:i,action:Mu(n.action,e,"toggle")})})({e:t,t:e,config:w})&&"stop"===e.globalPropagation&&r.toggleBrushing(!0)}))},U.onBrushOver=t=>{M.over.forEach((e=>{(function(t){let{e:e,t:n,config:i}=t;return bu({collisions:wu(e,n,i.renderer),t:n,config:i,action:Mu(n.action,e,"set")})})({e:t,t:e,config:w})&&"stop"===e.globalPropagation&&r.toggleBrushing(!0)}))},U.def=_,U.ctx=S,U.renderer=()=>V,U.set({settings:m}),C(),U}function Uu(t){const e=Hi(!0,{},t),n={getAll:()=>e,getValue:(t,n)=>function(t,e,n){if(void 0===t||void 0===e)return n;const i=e.split(".");let r=t;for(let t=0;t<i.length;++t){const e=i[t];if(void 0===r[e])return n;r=r[e]}return r}(e,t,n),setValue:(t,n)=>function(t,e,n){if(void 0===t||void 0===e)return;const i=e.split("."),r=i[i.length-1];let o=t;for(let t=0;t<i.length-1;++t){const e=i[t];void 0===o[e]&&(o[e]=Number.isNaN(+i[t+1])?{}:[]),o=o[e]}void 0!==n?o[r]=n:delete o[r]}(e,t,n)};return n}function Yu(t,e,n){const i=Au(function(t,e){const n=Tu(t,e)/Tu(e,e)||1;return{x:e.x*n,y:e.y*n}}(Cu(n,t),Cu(e,t)),t);return i}function Xu(t,e,n){return Iu(t,n)+Iu(e,n)-Iu(t,e)<1e-12}function Gu(t,e){return t.x>=e.x&&t.x+t.width<=e.x+e.width&&t.y>=e.y&&t.y+t.height<=e.y+e.height}function Ku(t){return t.x1===t.x2&&t.y1===t.y2}function Zu(t){return t.width<=0||t.height<=0}function Ju(t){return t.r<=0}function Qu(t){return t.edges.length<=2}function th(t,e){let n=!1;for(let i=0,r=e.edges.length;i<r;i++)if(n=sh(t,nr(e.edges[i])),!0===n)return!0;return!1}function eh(t,e){let n=!1;const{numPolygons:i,polygons:r}=e;for(let e=0;e<i;e++){if(n=mh(t,r[e]),!0===n)return!0}return!1}function nh(t,e){if(Ju(t))return!1;return Eu({x:t.cx,y:t.cy},e)<=t.r**2}function ih(t,e){if(Zu(e)||Ju(t))return!1;const n=e.width/2,i=e.height/2,r=e.x+n,o=e.y+i,a=t.r,s=t.cx,l=t.cy,c=Math.abs(s-r),u=Math.abs(l-o);if(c>n+a||u>i+a)return!1;if(c<=n||u<=i)return!0;return(c-n)**2+(u-i)**2<=a**2}function rh(t,e){if(Ju(t)||Ku(e))return!1;const[n,i]=Qi(e);if(nh(t,n)||nh(t,i))return!0;const r={x:t.cx,y:t.cy},o=Yu(n,i,r);return Eu(o,r)<=t.r**2&&Xu(n,i,o)}function oh(t,e){if(Qu(e)||Ju(t))return!1;if(ah(e,{x:t.cx,y:t.cy}))return!0;const n=e.edges.length;for(let i=0;i<n;i++){if(rh(t,nr(e.edges[i])))return!0}return!1}function ah(t,e){if(Qu(t)||!hh(t.boundingRect(),e))return!1;const{x:n,y:i}=e,r=t.vertices;let o,a,s,l,c;for(o=!1,l=-1,a=r.length,s=a-1;++l<a;s=l){if(r[l].x===n&&r[l].y===i)return!0;if(r[l].y===r[s].y&&r[l].y===i&&(n-r[l].x)*(n-r[s].x)<=0)return!0;if(r[l].y<i&&i<=r[s].y||r[s].y<i&&i<=r[l].y){if(c=(r[s].x-r[l].x)*(i-r[l].y)/(r[s].y-r[l].y)+r[l].x,n===c)return!0;n<c&&(o=!o)}}return o}function sh(t,e){if(Qu(t))return!1;for(let n=0,i=t.edges.length;n<i;n++){if(fh(e,nr(t.edges[n])))return!0}const[n,i]=Qi(e);return ah(t,n)||ah(t,i)}function lh(t,e){if(Qu(t))return!1;for(let n=0,i=t.edges.length;n<i;n++){if(dh(e,nr(t.edges[n])))return!0}const[n,i,r,o]=tr(e);return ah(t,n)||ah(t,i)||ah(t,r)||ah(t,o)}function ch(t,e){return!Zu(t)&&!Zu(e)&&(t.x<=e.x+e.width&&e.x<=t.x+t.width&&t.y<=e.y+e.height&&e.y<=t.y+t.height)}function uh(t,e){if(Zu(t)||Zu(e))return!1;return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}].every((e=>hh(t,e)))}function hh(t,e){return!Zu(t)&&(e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height)}function dh(t,e){if(Ku(e)||Zu(t))return!1;const[n,i]=Qi(e);if(hh(t,n)||hh(t,i))return!0;const r=tr(t);let o=r.length;for(let t=0;t<o;t++){if(fh(nr([r[t],r[3!==t?t+1:0]]),e))return!0}return!1}function fh(t,e){const[n,i]=Qi(t),[r,o]=Qi(e),a=Ou(i,n),s=zu(i,n),l=Ou(o,r),c=zu(o,r),u=Ou(n,r),h=zu(n,r);let d=c*a-l*s;const f=l*h-c*u,p=a*h-s*u;let g,m;if(0===a&&0===s)return!1;if(0===l&&0===c)return!1;if(0===d){if(0===f&&0===p){if(0===a){if(0===s)return n.x===i.x&&n.y===i.y;g=zu(r,n)/s,m=zu(o,n)/s}else g=(r.x-n.x)/a,m=(o.x-n.x)/a;return!(g<0&&m<0||g>1&&m>1)}return!1}const y=f/d;return d=p/d,y>=0&&y<=1&&d>=0&&d<=1}function ph(t,e){if(Ku(t))return!1;const[n,i]=Qi(t);return Xu(n,i,e)}function gh(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!ch(n,i)&&(uh(n,i)?th(t,e):th(e,t))}function mh(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!ch(n,i)&&(uh(i,n)?function(t,e){let n=!1;const{numPolygons:i,polygons:r}=t;for(let t=0;t<i;t++)if(n=gh(e,r[t]),!0===n)return!0;return!1}(t,e):function(t,e){let n=!1;for(let i=0,r=e.edges.length;i<r;i++)if(n=vh(t,nr(e.edges[i])),!0===n)return!0;return!1}(t,e))}function yh(t,e){if(Ju(t))return!1;if(xh(e,{x:t.cx,y:t.cy}))return!0;const{numPolygons:n,polygons:i}=e;for(let e=0;e<n;e++){const n=i[e],r=n.edges.length;for(let e=0;e<r;e++){if(rh(t,nr(n.edges[e])))return!0}}return!1}function xh(t,e){if(!hh(t.boundingRect(),e))return!1;const{x:n,y:i}=e,r=t.numPolygons;let o,a,s,l,c,u,h=!1;for(a=0;a<r;a++)for(o=t.vertices[a],c=-1,s=o.length,l=s-1;++c<s;l=c){if(o[c].x===n&&o[c].y===i)return!0;if(o[c].y===o[l].y&&o[c].y===i&&(n-o[c].x)*(n-o[l].x)<=0)return!0;if(o[c].y<i&&i<=o[l].y||o[l].y<i&&i<=o[c].y){if(u=(o[l].x-o[c].x)*(i-o[c].y)/(o[l].y-o[c].y)+o[c].x,n===u)return!0;n<u&&(h=!h)}}return h}function vh(t,e){const[n,i]=Qi(e);if(xh(t,n)||xh(t,i))return!0;const{numPolygons:r,polygons:o}=t;for(let t=0;t<r;t++){const n=o[t];for(let t=0,i=n.edges.length;t<i;t++){if(fh(e,nr(n.edges[t])))return!0}}return!1}function bh(t,e){const[n,i,r,o]=tr(e);if(xh(t,n)||xh(t,i)||xh(t,r)||xh(t,o))return!0;const{numPolygons:a,polygons:s}=t;for(let t=0;t<a;t++){const n=s[t];for(let t=0,i=n.edges.length;t<i;t++){if(dh(e,nr(n.edges[t])))return!0}}return!1}const wh=/^\$/,Mh="@extend";function kh(t){throw new Error('Cyclical reference for "'.concat(t,'"'))}function _h(t,e,n){if("string"==typeof t){let i=e[t];return-1!==n.indexOf(t)&&kh(t),wh.test(i)?(n.push(t),_h(i,e,n)):i}let i=t;const r=Hi(!0,{},e,t),o={};if(t[Mh]){const o=t[Mh];-1!==n.indexOf(o)&&kh(o);let a=n.slice();a.push(o),i=Hi(!0,{},_h(r[o],e,a),t)}return Object.keys(i).forEach((t=>{let e=n.slice();if(t===Mh||wh.test(t))return;o[t]=i[t];let a=o[t];wh.test(a)&&a in r?(-1!==n.indexOf(a)&&kh(a),e.push(a),a=r[a],"object"==typeof a||wh.test(a)&&a in r?o[t]=_h(a,r,e):o[t]=a):"object"==typeof a&&(o[t]=_h(a,r,e))})),o}function Sh(t,e){return _h(t,e,[])}function Nh(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={},n=t;const i=t=>{t.forEach((t=>{const n=Array.isArray(t.colors[0])?t.colors:[t.colors];e[t.key]={colors:n,sizes:n.map((t=>t?t.length:0))}}))},r={palette:(t,n)=>((t,n)=>{const i=e[t];if(!i)return[];const r=i.sizes;for(let t=0;t<r.length;t++)if(n<=r[t])return i.colors[t];return i.colors[r.length-1]})(t,n),setPalettes:i,style:t=>Sh(t,n),setStyle:e=>{n=Hi({},t,e)}};return i(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]),r}function Rh(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height)}function Ah(t){const e={center:{minWidthRatio:.5,minHeightRatio:.5,minWidth:0,minHeight:0}};return Hi(!0,e,t),e.center.minWidthRatio=Math.min(Math.max(e.center.minWidthRatio,0),1),e.center.minHeightRatio=Math.min(Math.max(e.center.minHeightRatio,0),1),e.center.minWidth=Math.max(e.center.minWidth,0),e.center.minHeight=Math.max(e.center.minHeight,0),e}function Ch(t,e,n,i,r){return{x:isNaN(t)?0:t,y:isNaN(t)?0:e,width:isNaN(t)?0:n,height:isNaN(t)?0:i,margin:isNaN(r)?0:r}}function Dh(t,e,n){if(void 0===t.cachedSize){const i=t.config.dock();let r,o=t.comp.preferredSize({inner:e,outer:n,dock:i});isNaN(o)?o&&!isNaN(o.size)&&(o.width=o.size,o.height=o.size):o={width:o,height:o},r="top"===i||"bottom"===i?o.height:"right"===i||"left"===i?o.width:Math.max(o.width,o.height),t.cachedSize=Math.ceil(r),t.edgeBleed=o.edgeBleed||0}return t.cachedSize}function Oh(t,e){switch(e.config.dock()){case"top":t.y+=e.cachedSize,t.height-=e.cachedSize;break;case"bottom":t.height-=e.cachedSize;break;case"left":t.x+=e.cachedSize,t.width-=e.cachedSize;break;case"right":t.width-=e.cachedSize}}function zh(t,e){const n=e.edgeBleed;n&&(t.left=Math.max(t.left,n.left||0),t.right=Math.max(t.right,n.right||0),t.top=Math.max(t.top,n.top||0),t.bottom=Math.max(t.bottom,n.bottom||0))}function Eh(t,e,n){e.x<n.left&&(e.width-=n.left-e.x,e.x=n.left);const i=t.width-(e.x+e.width);i<n.right&&(e.width-=n.right-i),e.y<n.top&&(e.height-=n.top-e.y,e.y=n.top);const r=t.height-(e.y+e.height);r<n.bottom&&(e.height-=n.bottom-r)}function Ih(t,e,n,i,r){const o=Hi({},e),a=Hi({},n);Oh(o,i),zh(a,i),Eh(t,o,a);const s=function(t,e,n){const i=Math.min(n.center.minWidth,t.width)||Math.max(t.width*n.center.minWidthRatio,1),r=Math.min(n.center.minHeight,t.height)||Math.max(t.height*n.center.minHeightRatio,1);return e.width>=i&&e.height>=r}(t,o,r);return!!s&&(Oh(e,i),zh(n,i),!0)}function Th(t){return{x:t.margin.left+t.x*t.scaleRatio.x,y:t.margin.top+t.y*t.scaleRatio.y,width:t.width*t.scaleRatio.x,height:t.height*t.scaleRatio.y}}function Ph(t){return er([].concat(...t.map(tr)))}function qh(t){let{visible:e,layoutRect:n,reducedRect:i,containerRect:r,translation:o}=t;const a=Ch(i.x,i.y,i.width,i.height),s=Ch(i.x,i.y,i.width,i.height),l={},c=e.slice(),u=c.slice().sort(((t,e)=>t.config.displayOrder()-e.config.displayOrder()));return e.sort(((t,e)=>{if(t.referencedDocks.length>0&&e.referencedDocks.length>0)return 0;if(e.referencedDocks.length>0)return-1;if(t.referencedDocks.length>0)return 1;const n=t.config.displayOrder()-e.config.displayOrder();return 0===n?c.indexOf(t)-c.indexOf(e):n})).forEach((t=>{let e={},c={};switch(t.config.dock()){case"top":e.height=c.height=t.cachedSize,e.width=n.width,c.width=a.width,e.x=n.x,c.x=a.x,e.y=c.y=a.y-t.cachedSize,a.y-=t.cachedSize,a.height+=t.cachedSize;break;case"bottom":e.x=n.x,c.x=a.x,e.y=c.y=a.y+a.height,e.width=n.width,c.width=a.width,e.height=c.height=t.cachedSize,a.height+=t.cachedSize;break;case"left":e.x=c.x=s.x-t.cachedSize,e.y=n.y,c.y=s.y,e.width=c.width=t.cachedSize,e.height=n.height,c.height=s.height,s.x-=t.cachedSize,s.width+=t.cachedSize;break;case"right":e.x=c.x=s.x+s.width,e.y=n.y,c.y=s.y,e.width=c.width=t.cachedSize,e.height=n.height,c.height=s.height,s.width+=t.cachedSize;break;case"center":e.x=c.x=i.x,e.y=c.y=i.y,e.width=c.width=i.width,e.height=c.height=i.height;break;default:if(t.referencedDocks.length>0){const n=t.referencedDocks.map((t=>l[t])).filter((t=>!!t));n.length>0&&(e=Ph(n.map((t=>t.outerRect))),c=Ph(n.map((t=>t.r))))}}t.key&&(l[t.key]={r:c,outerRect:e}),function(t,e,n,i){const r={x:i.width/n.width,y:i.height/n.height},o={left:0,top:0};if(n.preserveAspectRatio){const t=r.x<r.y,e=Math.min(r.x,r.y);r.x=e,r.y=e;const a=t?"height":"width",s=(i[a]-n[a]*r.x)*n.align;o.left=t?0:s,o.top=t?s:0}t.scaleRatio=r,t.margin=o,e.scaleRatio=r,e.margin=o,n.scaleRatio=r,n.margin=o}(c,e,n,r),c.edgeBleed=t.edgeBleed,c.computed=Th(c),e.edgeBleed=t.edgeBleed,e.computed=Th(e),c.x+=o.x,c.y+=o.y,e.x+=o.x,e.y+=o.y,t.comp.resize(c,e),t.cachedSize=void 0,t.edgeBleed=void 0})),u}function Lh(t,e,n){const i=t.layoutModes||{},r=e.minimumLayoutMode();let o=e.show();return o&&"object"==typeof r?o=i[r.width]&&i[r.height]&&n.width>=i[r.width].width&&n.height>=i[r.height].height:o&&void 0!==r&&(o=i[r]&&n.width>=i[r].width&&n.height>=i[r].height),o}function jh(t){if(!t.resize||"function"!=typeof t.resize)throw new Error("Component is missing resize function");if(!t.dockConfig&&!t.preferredSize)throw new Error("Component is missing preferredSize function")}function Fh(t){let e=Ah(t);const n={};return n.layout=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t||isNaN(t.x)||isNaN(t.y)||isNaN(t.width)||isNaN(t.height))throw new Error("Invalid rect");if(!n.length)return{visible:[],hidden:[],ordered:[]};const{logicalContainerRect:i,containerRect:r}=function(t,e){const n={x:0,y:0,width:0,height:0},i={x:0,y:0,width:0,height:0};return n.width=t.width||0,n.height=t.height||0,void 0!==e.size&&(n.width=isNaN(e.size.width)?n.width:e.size.width,n.height=isNaN(e.size.height)?n.height:e.size.height),void 0!==e.logicalSize?(i.width=isNaN(e.logicalSize.width)?n.width:e.logicalSize.width,i.height=isNaN(e.logicalSize.height)?n.height:e.logicalSize.height,i.align=isNaN(e.logicalSize.align)?.5:Math.min(Math.max(e.logicalSize.align,0),1),i.preserveAspectRatio=e.logicalSize.preserveAspectRatio):(i.width=n.width,i.height=n.height,i.preserveAspectRatio=!1),Rh(i),Rh(n),{logicalContainerRect:i,containerRect:n}}(t,e),[o,a]=function(t,e,n){const i=[],r=[];for(let o=0;o<t.length;++o){const a=t[o];jh(a);let s=a.dockConfig;const l=a.key,c=s.dock(),u=/@/.test(c)?c.split(",").map((t=>t.replace(/^\s*@/,""))):[];Lh(e,s,n)?i.push({comp:a,key:l,config:s,referencedDocks:u}):r.push({comp:a,key:l,config:s,referencedDocks:u})}return[i,r]}(n,e,i),s=function(t){let{layoutRect:e,visible:n,hidden:i,settings:r}=t;const o=Ch(e.x,e.y,e.width,e.height),a={left:0,right:0,top:0,bottom:0},s=n.slice();s.sort(((t,e)=>t.config.prioOrder()-e.config.prioOrder()));for(let t=0;t<s.length;++t){const n=s[t];Dh(n,o,e),Ih(e,o,a,n,r)||(i.push(s.splice(t,1)[0]),--t)}!function(t,e){if(0!==e.length)for(let n=0;n<t.length;++n){let i=t[n];if(i.referencedDocks.length){const r=i.referencedDocks.every((t=>e.some((e=>e.key===t))));r&&e.push(t.splice(n,1)[0])}}}(n,i);const l=n.filter((t=>-1!==s.indexOf(t)));return n.length=0,n.push(...l),Eh(e,o,a),o}({layoutRect:i,visible:o,hidden:a,settings:e}),l=qh({visible:o,layoutRect:i,reducedRect:s,containerRect:r,translation:{x:t.x,y:t.y}});return a.forEach((t=>{t.comp.visible=!1;const e=Ch();t.comp.resize(e,e)})),{visible:o.map((t=>t.comp)),hidden:a.map((t=>t.comp)),ordered:l.map((t=>t.comp))}},n.settings=function(t){e=Ah(t)},n}const Bh=(t,e)=>{for(let n=0;n<t.length;n++){const i=t[n];if(i.hasKey&&i.key===e)return t[n]}return null},Vh=t=>null==t?void 0:t.map((t=>{const e=t.instance.dockConfig();return{preferredSize:n=>e.computePreferredSize(Xi(Xi({},n),{},{children:Vh(t.children)}))}})),$h=(t,e)=>({visible:[],hidden:e,ordered:[]}),Hh=t=>(e,n)=>{var i;const r=n.map(((t,e)=>{const n=t.instance.dockConfig();return{index:e,key:t.key,dockConfig:n,resize:t.instance.resize,preferredSize:e=>n.computePreferredSize(Xi(Xi({},e),{},{children:Vh(t.children)}))}})),o=t=>n[t.index],{visible:a=r,hidden:s=[],ordered:l=a}=null!==(i=t(e,r))&&void 0!==i?i:{};return{visible:a.map(o),hidden:s.map(o),ordered:l.map(o)}},Wh=t=>"function"==typeof t?Hh(t):(t=>{const e=Fh(t);return Hh(((t,n)=>e.layout(t,n)))})(t);function Uh(t,e,n){const i=e.left-n.left,r=e.top-n.top,o=ir(t),a=Hi(!0,{},t);switch(o){case"circle":a.cx+=i,a.cy+=r;break;case"polygon":for(let t=0,e=a.vertices.length;t<e;t++){const e=a.vertices[t];e.x+=i,e.y+=r}break;case"geopolygon":for(let t=0;t<a.vertices.length;t++){const e=a.vertices[t];for(let t=0,n=e.length;t<n;t++){const n=e[t];n.x+=i,n.y+=r}}break;case"line":a.x1+=i,a.y1+=r,a.x2+=i,a.y2+=r;break;case"point":case"rect":a.x+=i,a.y+=r}return a}function Yh(t,e){const n=[];let i=0;e.forEach((t=>{n.push(i),i++;const e=t.instance.def.additionalElements&&t.instance.def.additionalElements();e&&(i+=e.length)})),e.forEach(((e,i)=>((t,e,n)=>{const i=e.instance.renderer().element();if(isNaN(n)||!i||!t||!t.children)return;const r=t.children[Math.max(0,n)];if(i===r)return;const o=e.instance.def.additionalElements&&e.instance.def.additionalElements().filter(Boolean);t.insertBefore&&void 0!==r?(t.insertBefore(i,r),o&&o.forEach((e=>{t.insertBefore(e,i)}))):(o&&o.forEach((e=>{t.appendChild(e,i)})),t.appendChild(i))})(t,e,n[i])))}function Xh(t,e){let{element:n,data:i=[],settings:r={},on:o={}}=t;const a=e.registries,s=e.logger,l=Nh(e.style,e.palettes),c=[],u=Hi({},t),h=function(){const t={};return Lc.mixin(t),t}();let d=[],f=null,p=null,g=null,m=[],y=()=>{},x=()=>{};const v={};let b=!1;const w=function(t){let{createComponent:e}=t;const n={};let i=[],r=[];const o=t=>{const n=e(t);return n&&(i.push(n),t.components&&(n.children=t.components.map((t=>o(t))).filter((t=>!!t)))),n},a=t=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)},s=(t,e)=>{for(let n=t.length-1;n>=0;n--){const i=t[n],r=e.find((t=>i.hasKey&&i.key===t.key));r?i.children&&r.components&&s(i.children,r.components):(t.splice(n,1),a(i),i.children&&s(i.children,[]),i.instance.destroy())}},l=t=>{let{compList:e,data:n,excludeFromUpdate:i,formatters:r,scales:a,settingsList:s}=t;return s.map((t=>{const s=Bh(e,t.key);return i.indexOf(t.key)>-1?(delete s.updateWith,s):s?(t.rendererSettings&&"function"==typeof s.instance.renderer().settings&&s.instance.renderer().settings(t.rendererSettings),t.rendererSettings&&"function"==typeof t.rendererSettings.transform&&t.rendererSettings.transform()?(s.applyTransform=!0,s):(s.updateWith={formatters:r,scales:a,data:n,settings:t},t.components&&(s.children=l({compList:s.children||[],data:n,excludeFromUpdate:i,formatters:r,scales:a,settingsList:t.components})),s)):o(t)})).filter((t=>!!t))},c=t=>{let{components:e,hidden:n,layoutFn:i,ordered:r,rect:o,visible:a}=t;const{visible:s,hidden:l,ordered:u}=i(o,e);a.push(...s),n.push(...l),r.push(...u),s.forEach((t=>{if(t.children){var e,i;const o=Wh(null!==(e=null===(i=t.settings)||void 0===i?void 0:i.strategy)&&void 0!==e?e:{});c({components:t.children,hidden:n,layoutFn:o,ordered:r,rect:t.instance.getRect(),visible:a})}})),l.forEach((t=>{t.children&&c({components:t.children,hidden:n,layoutFn:$h,ordered:r,rect:null,visible:a})}))};return n.destroy=()=>{i.forEach((t=>t.instance.destroy())),i=[],r=[]},n.findComponentByKey=t=>Bh(i,t),n.forEach=t=>{i.forEach(t)},n.layout=t=>{let{layoutSettings:e,rect:n}=t;const i=[],o=[],a=[],s=Wh(e);return c({components:r,hidden:o,layoutFn:s,ordered:a,rect:n,visible:i}),{visible:i,hidden:o,ordered:a}},n.set=t=>{let{components:e}=t;r=e.map((t=>o(t))).filter((t=>!!t))},n.update=t=>{let{components:e,data:n,excludeFromUpdate:i,formatters:o,scales:a}=t;s(r,e),r=l({compList:r,data:n,excludeFromUpdate:i,formatters:o,scales:a,settingsList:e})},n}({createComponent:t=>{if(!a.component.has(t.type))return s.warn("Unknown component: ".concat(t.type)),!1;return{instance:Wu(a.component(t.type),{settings:t,chart:u,mediator:h,registries:a,theme:l,container:n}),settings:Hi(!0,{},t),key:t.key,hasKey:void 0!==t.key}}});function M(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};return function(){const i="function"==typeof t[e];let r;for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return r=i?t[e].call(u,...a):n.call(u,...a),r}}const k=()=>{let t;r.dockLayout?(s.warn('Deprecation Warning: "dockLayout" property should be renamed to "strategy"'),t=r.dockLayout):t=r.strategy;const e=function(t){if("function"==typeof t.getBoundingClientRect){const{width:e,height:n}=t.getBoundingClientRect();return{x:0,y:0,width:e,height:n}}return{x:0,y:0,width:0,height:0}}(n);return w.layout({layoutSettings:t,rect:e})},_=M("created"),S=M("beforeMount"),N=M("mounted"),R=M("beforeUpdate"),A=M("updated"),C=M("beforeRender"),D=M("beforeDestroy"),O=M("destroyed"),z=function(t,e){let{partialData:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{formatters:i={},scales:r={},scroll:o={}}=e;y=function(t,e){let{types:n,logger:i}=e;const r={},o=[];return Array.isArray(t)?o.push(...t):(i.warn('Deprecated: "data-source" configuration"'),o.push(t)),o.forEach(((t,e)=>{let o=n(t.type);if(o){let n=t.key;void 0===t.key&&(i.warn("Missing key for dataset. Using index '".concat(e,"' as key.")),n=e);let a=o({key:n,data:t.data,config:t.config});r[n]=a}})),t=>t?r[t]:r[Object.keys(r)[0]]}(t,{logger:s,types:a.data}),n||Object.keys(v).forEach((t=>v[t].clear())),e.palettes&&l.setPalettes(e.palettes),e.style&&l.setStyle(e.style),x=function(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xs;const r={};return(t||[]).forEach((t=>{if(!t.key)throw new Error('Data collection is missing "key" property');if("object"==typeof t.data&&"collection"in t.data)throw new Error("Data config for collections may not reference other collections");r[t.key]=()=>i(t.data,e,n)})),t=>{let e,n;if("string"==typeof t?e=t:"object"==typeof t&&(e=t.key,n=t),!(e in r))throw new Error("Unknown data collection: ".concat(e));"function"==typeof r[e]&&(r[e]=r[e]());let i=r[e];if(n&&n.fields&&n.fields.filter){let t=i.fields.filter(n.fields.filter);i.fields.length!==t.length&&(i=Hi(i,{fields:t}))}return i}}(e.collections,{dataset:y},{logger:s});const c={theme:l,logger:s};f=function(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ic;const r={};return{get(o){let a;return"string"==typeof o&&t[o]?a=o:"object"==typeof o&&"scale"in o&&t[o.scale]&&(a=o.scale),a?(r[a]=r[a]||i(t[a],e,n),r[a]):i(o,e,n)},all(){return Object.keys(t).forEach(this.get),r}}}(r,{dataset:y,collection:x},Xi(Xi({},c),{},{scale:a.scale})),p=function(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Gs;const r={};return{get(o){let a;return"string"==typeof o&&t[o]?a=o:"object"==typeof o&&"formatter"in o&&t[o.formatter]?a=o.formatter:"object"==typeof o&&"type"in o&&t[o.type]&&(a=o.type),a?(r[a]=r[a]||i(t[a],e,n),r[a]):i(o||{},e,n)},all(){return Object.keys(t).forEach(this.get),r}}}(i,{dataset:y,collection:x},Xi(Xi({},c),{},{formatter:a.formatter})),g=function(t,e){const n={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=Fc(t[i],e?e[i]:null));return n}(o,g)};function E(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e={},i=t.filter((t=>!!t.key)).map((t=>t.key));m.forEach((t=>{t.key&&-1!==i.indexOf(t.key)?e[t.key]=t:t.destroy()})),m=t.map((t=>{const i=t.key&&e[t.key]?e[t.key]:a.interaction(t.type)(u,h,n);return i.set(t),i}))}const I=t=>{const e=n.getBoundingClientRect(),i="clientX"in t?t.clientX:t.x,r="clientY"in t?t.clientY:t.y,o={x:i-e.left,y:r-e.top},a=[];return d.forEach((t=>{const e=t.instance.getRect();hh(e.computedPhysical?e.computedPhysical:{x:e.margin.left+e.x*e.scaleRatio.x,y:e.margin.top+e.y*e.scaleRatio.y,width:e.width*e.scaleRatio.x,height:e.height*e.scaleRatio.y},o)&&a.push(t)})),a},T=()=>{if(c.length||!n)return;Object.keys(o).forEach((t=>{const e=o[t].bind(u);n.addEventListener(t,e),c.push({key:t,listener:e})}));const t={},e=e=>{e.touches?(t.x=e.touches[0].clientX,t.y=e.touches[0].clientY,t.multiTouch=e.touches.length>1):(t.x=e.clientX,t.y=e.clientY,t.multiTouch=!1),t.time=Date.now(),t.comps=I(t)},i=e=>{const n=t.comps||I(e);if(!n.every((t=>t.instance.def.disableTriggers))&&("touchend"===e.type&&e.preventDefault(),function(t,e){const n=Gi(t),i=n?t.changedTouches[0]:t,r=Date.now()-e.time,o=isNaN(e.x)?0:Math.abs(i.clientX-e.x),a=isNaN(e.y)?0:Math.abs(i.clientY-e.y);return(0===t.button||n)&&!e.multiTouch&&o<=12&&a<=12&&r<=300}(e,t)))for(let t=n.length-1;t>=0;t--){if(n[t].instance.onBrushTap(e),b){b=!1;break}}},r=[];r.push({key:"mousedown",listener:e}),r.push({key:"mouseup",listener:i}),function(t){return"ontouchstart"in t&&"ontouchend"in t||navigator.maxTouchPoints>1}(n)&&(r.push({key:"touchstart",listener:e}),r.push({key:"touchend",listener:i})),r.push({key:"mousemove",listener:t=>{const e=I(t);for(let n=e.length-1;n>=0;n--){if(e[n].instance.onBrushOver(t),b){b=!1;break}}}}),r.forEach((t=>{n.addEventListener(t.key,t.listener),c.push(t)}))},P=()=>{c.forEach((t=>{let{key:e,listener:i}=t;return n.removeEventListener(e,i)})),c.length=0},q=()=>{n.innerHTML="",(()=>{const{components:t=[]}=r;C(),z(i,r),w.set({components:t});const{visible:e,hidden:o,ordered:a}=k();d=e,o.forEach((t=>{t.instance.hide(),t.visible=!1})),e.forEach((t=>t.instance.beforeMount())),e.forEach((t=>t.instance.mount())),e.forEach((t=>t.instance.beforeRender())),e.forEach((t=>t.instance.render())),e.forEach((t=>t.instance.mounted())),e.forEach((t=>{t.visible=!0})),Yh(n,a)})(),T(),E(r.interactions)};return u.layoutComponents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{excludeFromUpdate:e=[]}=t;t.data&&(i=t.data),t.settings&&(r=t.settings,E(t.settings.interactions)),R(),z(i,r);const{formatters:n,scales:o,components:a=[]}=r;w.update({components:a,data:i,excludeFromUpdate:e,formatters:n,scales:o}),w.forEach((t=>{t.updateWith&&t.instance.set(t.updateWith)})),w.forEach((t=>{t.updateWith&&t.instance.beforeUpdate()})),k()},u.update=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{partialData:e,excludeFromUpdate:o=[]}=t;let a;t.data&&(i=t.data),t.settings&&(r=t.settings,E(t.settings.interactions)),R(),z(i,r,{partialData:e});const{formatters:s,scales:l,components:c=[]}=r;w.update({components:c,data:i,excludeFromUpdate:o,formatters:s,scales:l}),w.forEach((t=>{t.updateWith&&t.instance.set(t.updateWith)})),w.forEach((t=>{t.updateWith&&t.instance.beforeUpdate()}));const u=[],h=[];let f;if(e)w.forEach((t=>{(t.updateWith||t.applyTransform)&&t.visible&&u.push(t)})),f=u;else{const{visible:t,hidden:e,ordered:n}=k();d=t,f=t,a=n,t.forEach((t=>{t.updateWith&&t.visible?u.push(t):h.push(t)})),e.forEach((t=>{t.instance.hide(),t.visible=!1,delete t.updateWith,t.applyTransform=!1}))}h.forEach((t=>t.instance.beforeMount())),h.forEach((t=>t.instance.mount())),f.forEach((t=>t.instance.beforeRender())),f.forEach((t=>{(t.updateWith||t.applyTransform)&&t.visible?t.instance.update():t.instance.render()})),e||Yh(n,a),h.forEach((t=>t.instance.mounted())),u.forEach((t=>t.instance.updated())),d.forEach((t=>{delete t.updateWith,t.visible=!0,t.applyTransform=!1})),A()},u.destroy=()=>{D(),w.destroy(),P(),E(),delete u.update,delete u.destroy,O()},u.getAffectedShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and",n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=[];return d.filter((t=>null==i||t.key===i)).forEach((i=>{const o=i.instance.getBrushedShapes(t,e,n);r=[...r,...o]})),r},u.findShapes=t=>{let e=[];return d.forEach((n=>{const i=n.instance.findShapes(t);e=[...e,...i]})),e},u.componentsFromPoint=t=>I(t).map((t=>t.instance.ctx)),u.shapesAt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];const r=n.getBoundingClientRect();let o=d;if(Array.isArray(e.components)&&e.components.length>0){const t=e.components.map((t=>t.key));o=d.filter((e=>-1!==t.indexOf(e.key))).map((n=>({instance:n.instance,opts:e.components[t.indexOf(n.key)]})))}for(let n=o.length-1;n>=0;n--){const a=o[n],s=Uh(t,r,a.instance.renderer().element().getBoundingClientRect()),l=a.instance.shapesAt(s,a.opts),c=l.length>0&&"stop"===e.propagation;if(i=[...i,...l],i.length>0&&c)return i}return i},u.brushFromShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{components:[]};for(let n=0;n<e.components.length;n++){const i=e.components[n].key;d.filter((t=>i===t.key)).forEach((i=>{let r=t.filter((t=>t.key===i.key));i.instance.brushFromShapes(r,e.components[n])}))}},u.scroll=function(){return function(t,e){return e[t]||(e[t]=jc()),e[t]}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",g)},u.dataset=t=>y(t),u.dataCollection=t=>x(t),u.scales=function(){return f.all()},u.formatters=function(){return p.all()},u.brush=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return v[t]||(v[t]=nu()),v[t]},u.scale=function(t){return f.get(t)},u.formatter=function(t){return p.get(t)},u.toggleBrushing=function(t){b=void 0!==t?t:!b},u.component=t=>{const e=w.findComponentByKey(t);return null==e?void 0:e.instance.ctx},u.logger=()=>s,u.theme=()=>l,u.storage=Uu({animations:{updatingStageMeta:{isInit:!1,shouldBeRemoved:!1}}}),Object.defineProperty(u,"interactions",{get:()=>({instances:m,on(){T(),m.forEach((t=>t.on()))},off(){P(),m.forEach((t=>t.off()))}})}),_(),n&&(S(),q(),N(n),u.element=n),u}const Gh=t=>{let e=so(t);return e.prio=t=>t?e.default(t[0]):[e.default()],e.types=()=>e.getKeys(),e};var Kh=so();function Zh(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}const Jh=t=>t.filter((t=>"number"==typeof t&&!isNaN(t)));const Qh=t=>{let{key:e,data:n,cache:i,config:r}=t;if(!n)return;let o=n;"string"==typeof o&&(o=(t=>{let{data:e,config:n}=t;const i=e.split("\n"),r=i[0],o=i[1];let a=",";if(n&&n.parse&&n.parse.delimiter)a=n.parse.delimiter;else if(r){const t=[/,/,/\t/,/;/];for(let e=0;e<t.length;e++){const n=t[e];if(r&&o){if(n.test(r)&&n.test(o)&&r.split(n).length===o.split(n).length){a=n;break}}else n.test(r)&&(a=n)}}return i.map((t=>t.split(a)))})({data:n,config:r})),Array.isArray(o)&&function(t){let e,{source:n,data:i,cache:r,config:o}=t,a=i;const s=o&&o.parse;Array.isArray(i[0])?s&&!1===s.headers?e=i[0].map(((t,e)=>e)):(e=i[0],a=i.slice(1)):e=Object.keys(i[0]);const l=!!s&&"function"==typeof s.row&&s.row;let c,u=e;u=s&&"function"==typeof s.fields?s.fields(u.slice()):e.map((t=>({key:t,title:t}))),Array.isArray(i[0])?c=u.map((()=>[])):(c={},u.forEach((t=>{c[t.key]=[]})));for(let t=0;t<a.length;t++){const e=l?l(a[t],t,u):a[t];if(e)if(Array.isArray(e))for(let t=0;t<u.length;t++)c[t].push(e[t]);else for(let t=0;t<u.length;t++)c[u[t].key].push(e[u[t].key])}const h=Array.isArray(c)?t=>c[t]:t=>c[u[t].key];for(let t=0;t<u.length;t++){const e=h(t),i=Jh(e),o=i.length>0,a=o?"measure":"dimension",s=o?Math.min(...i):NaN,l=o?Math.max(...i):NaN;r.fields.push(Is(Hi({source:n,key:t,title:u[t].title,values:e,min:s,max:l,type:a},u[t]),{value:u[t].value,label:u[t].label}))}}({data:o,cache:i,source:e,config:r})};function td(){let{key:t,data:e,config:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={fields:[]},r={key:()=>t,raw:()=>e,field:t=>function(t,e){let{cache:n}=e;if("number"==typeof t)return n.fields[t];for(let e=0;e<n.fields.length;e++)if(n.fields[e].key()===t)return n.fields[e];for(let e=0;e<n.fields.length;e++)if(n.fields[e].title()===t)return n.fields[e];return null}(t,{cache:i,matrix:e}),fields:()=>i.fields.slice(),extract:t=>function(t,e){const n=Array.isArray(t)?t:[t];let i=[];return n.forEach((t=>{if(void 0!==t.field){const n=e.field(t.field),r=e.key();if(!n)throw Error("Field '".concat(t.field,"' not found"));const{props:o,main:a}=js(t,e),s=Object.keys(o),l=!!t.trackBy,c=typeof t.trackBy,u={},h=[],d=n.items(),f=[];for(let e=0;e<d.length;e++){const n=d[e];if(a.filter&&!a.filter(n))continue;const i=Zh(a,n,{key:r});s.forEach((t=>{const a=o[t];let s=a.field?a.field.items()[e]:n;i[t]=Zh(a,s,{key:r})})),l&&Vs({cfg:t,itemData:n,obj:i,target:h,tracker:u,trackType:c}),f.push(i)}i=l?[...i,...Bs(h,{main:a,propsArr:s,props:o})]:[...i,...f]}})),i}(t,r),hierarchy:()=>null};return Qh({key:t,data:e,config:n,cache:i}),r}td.util={normalizeConfig:js,collect:Bs,track:Vs};const ed=so();ed.default("matrix"),ed("matrix",td),ed("default",td);const nd=so();function id(t,e,n){return Math.max(t,Math.min(e,n))}function rd(t){let{item:e,value:n,boxCenter:i,rendWidth:r,rendHeight:o,flipXY:a,symbol:s}=t,l="x",c="y",u=r,h=o,d=n<.5?90:-90;return a&&(l="y",c="x",u=o,h=r,d=n<.5?180:0),s(Hi({},e.oob,{[l]:i*u,[c]:Math.max(e.oob.size/2,Math.min(n*h,h-e.oob.size/2)),startAngle:d}))}function od(t){let{item:e,boxWidth:n,boxPadding:i,rendWidth:r,rendHeight:o,flipXY:a}=t,s="x",l="y",c="width",u="height",h=r,d=o;a&&(s="y",l="x",c="height",u="width",h=o,d=r);const{actualDiff:f,actualLow:p}=function(t){let{start:e,end:n,minPx:i=.1,maxPx:r=1}=t;const o=Math.max(e,n),a=Math.min(e,n),s=id(-.1,1.2,o),l=id(-.1,1.2,a),c=s*r-l*r,u=Math.max(i,c),h=(u-c)/2;return{actualDiff:u,startModifier:h,actualLow:l*r-h}}({start:e.start,end:e.end,minPx:e.box.minHeightPx,maxPx:d});return Hi({},e.box,{type:"rect",[s]:(i+e.major)*h,[l]:p,[u]:f,[c]:n*h,data:e.data||{},collider:{type:null}})}function ad(t){let{item:e,from:n,to:i,boxCenter:r,rendWidth:o,rendHeight:a,flipXY:s}=t,l="x1",c="y1",u="x2",h="y2",d=o,f=a;return s&&(l="y1",c="x1",u="y2",h="x2",d=a,f=o),Hi({},e.line,{type:"line",[h]:Math.floor(n*f),[l]:r*d,[c]:Math.floor(i*f),[u]:r*d,data:e.data||{},collider:{type:null}})}function sd(t){let{item:e,key:n,position:i,width:r,boxCenter:o,rendWidth:a,rendHeight:s,flipXY:l}=t,c="x1",u="y1",h="x2",d="y2",f=a,p=s;l&&(c="y1",u="x1",h="y2",d="x2",f=s,p=a);const g=r/2;return Hi({type:"line"},e[n],{[u]:Math.floor(i*p),[c]:(o-g)*f,[d]:Math.floor(i*p),[h]:(o+g)*f,r:g*f,cx:o*f,cy:i*p,width:r*f,data:e.data||{},collider:{type:null}})}function ld(t,e,n){const{width:i,maxWidthPx:r,minWidthPx:o}=e.box,a=t>=0?1:-1;let s=Math.min(a*t*i,isNaN(r)?n:r/n);return s=isNaN(o)?s:Math.max(o/n,s),s*a}nd("native",(function(t,e,n){let i,r,o={chart:t,mediator:e,element:n},a=[],s=!0;function l(){"function"==typeof i.enable&&(i.enable=i.enable.bind(o)()),i.enable&&Object.keys(i.events).forEach((t=>{const e=i.events[t].bind(o);n.addEventListener(t,e),a.push({key:t,listener:e})}))}function c(){a.forEach((t=>{let{key:e,listener:i}=t;n.removeEventListener(e,i)})),a=[]}return{get key(){return r},set(t){!function(t){r=t.key,i=t,i.events=i.events||[],void 0===i.enable&&(i.enable=!0)}(t),c(),s&&l()},off(){s=!1,c()},on(){s=!0,0===a.length&&l()},destroy(){c(),o=null,i=null}}}));const cd={oob:{show:!0,type:"n-polygon",fill:"#999",stroke:"#000",strokeWidth:0,size:10,sides:3,startAngle:-90},box:{show:!0,fill:"#fff",stroke:"#000",strokeWidth:1,strokeLinejoin:"miter",width:1,maxWidthPx:void 0,minWidthPx:1,minHeightPx:1},line:{show:!0,stroke:"#000",strokeWidth:1},median:{show:!0,stroke:"#000",strokeWidth:1},whisker:{show:!0,stroke:"#000",strokeWidth:1,fill:"",type:"line",width:1}},ud=Object.keys(cd),hd={require:["chart","resolver","symbol"],defaultSettings:{settings:{},data:{},style:{box:"$shape",line:"$shape-guide",whisker:"$shape-guide",median:"$shape-guide--inverted"}},created(){this.state={}},render(t){let{data:e}=t;const{width:n,height:i}=this.rect,r="horizontal"===this.settings.settings.orientation,{style:o,resolver:a,symbol:s}=this,l=ud.filter((t=>!this.settings.settings[t]||!1!==this.settings.settings[t].show)),c={};l.forEach((t=>c[t]=cd[t]));const u=function(t){let{keys:e,data:n,defaultSettings:i,style:r,settings:o,width:a,height:s,resolver:l}=t;const c=Hi(!0,{},i||{},r||{}),u={major:"horizontal"===o.orientation?s:a,minor:"horizontal"===o.orientation?a:s},h=o.major;let d;d="object"==typeof h&&"object"==typeof h.ref&&void 0!==h.ref.start&&void 0!==h.ref.end?l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:Hi(!0,{},{binStart:{scale:o.major.scale,ref:o.major.ref.start},binEnd:{scale:o.major.scale,ref:o.major.ref.end}})}):"object"==typeof h&&void 0!==h.binStart&&void 0!==h.binEnd?l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:Hi(!0,{},{binStart:{scale:o.major.scale,ref:"binStart"},binEnd:{scale:o.major.scale,ref:"binEnd"}},o.major)}):l.resolve({data:n,scaled:u,defaults:{major:.5},settings:{major:o.major}});const f=o.minor||{},p={};["start","end","min","max","med"].forEach((t=>{(f[t]||n.items&&n.items.length&&n.items[0][t])&&(p[t]={scale:f.scale,ref:t})}));let g,m={major:d,minor:l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:Hi(!0,{},p,f)})};for(let t=0,i=e.length;t<i;t++)o[g]&&!1===o[g].show||(g=e[t],m[g]=l.resolve({data:n,defaults:c[g],settings:o[g],scaled:u}));return m}({keys:l,data:e,defaultSettings:c,style:o,settings:this.settings.settings,width:n,height:i,resolver:a}),{settings:h,items:d}=u,f=function(t){let{width:e,height:n,flipXY:i,resolved:r,keys:o,symbol:a}=t;const s=[],l=r.major.items;if(!l.length)return s;const c=e,u=n,h=i?n:e,d=r.major.settings,f=["start","end","min","max","med"].filter((t=>void 0!==r.minor.settings[t])),p=f.length,g=o.filter((t=>"oob"!==t));let m,y,x,v,b,w,M,k,_;const S=o?o.length:0,N=g?g.length:0,R={box:function(){x.box&&Ki(x.start)&&Ki(x.end)&&m.push(od({item:x,boxWidth:v,boxPadding:b,rendWidth:c,rendHeight:u,flipXY:i}))},line:function(){Ki(x.min)&&Ki(x.start)&&m.push(ad({item:x,from:x.min,to:x.start,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i})),Ki(x.max)&&Ki(x.end)&&m.push(ad({item:x,from:x.max,to:x.end,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))},median:function(){x.median&&Ki(x.med)&&m.push(sd({item:x,key:"median",position:x.med,width:v,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))},whisker:function(){if(x.whisker){const t=v*x.whisker.width;Ki(x.min)&&m.push(sd({item:x,key:"whisker",position:x.min,width:t,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i})),Ki(x.max)&&m.push(sd({item:x,key:"whisker",position:x.max,width:t,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))}}};function A(){let t,e=-Number.MAX_VALUE,n=Number.MAX_VALUE;for(let i=0;i<p;i++)t=x[f[i]],Ki(t)&&(e<t&&(e=t),n>t&&(n=t));M=e<0&&e!==-Number.MAX_VALUE,k=n>1&&n!==Number.MAX_VALUE,_=M||k}for(let t=0,e=l.length;t<e;t++){m=[],y=null;const e=l[t],n=e.data;let f=null,p=null;void 0!==d.binStart?(f=e.binStart,p=e.binEnd,y=d.binStart.scale):(y=d.major.scale,f=y?e.major:0);let C=0;y?y.bandwidth?(C=y.bandwidth(),f-=C/2):C=p-f:C=1,x=Hi({},{major:f,majorEnd:p},r.minor.items[t]);for(let e=0;e<S;e++)x[o[e]]=r[o[e]].items[t];if(v=ld(C,x,h),b=(C-v)/2,w=b+x.major+v/2,A(),_)x.oob&&(M?m.push(rd({item:x,value:0,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i,symbol:a})):k&&m.push(rd({item:x,value:1,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i,symbol:a})));else for(let t=0;t<N;t++)x[g[t]]&&!1===x[g[t]].show||R[g[t]]();const D={type:"container",data:n,collider:{type:"bounds"},children:m};s.push(D)}return s}({items:d,settings:h,width:n,height:i,flipXY:r,resolved:u,keys:l,symbol:s});return f}};const dd={shape:"saltire",width:2,size:.5,fill:"#333",stroke:"#333",strokeWidth:0},fd=/px$/,pd={shape:"circle",label:"",fill:"#333",stroke:"#ccc",strokeDasharray:"",strokeWidth:0,strokeLinejoin:"miter",opacity:1,x:.5,y:.5,size:1,show:!0},gd={maxPx:1e4,minPx:1,maxRelExtent:.1,minRelExtent:.01,maxRelDiscrete:1,minRelDiscrete:.1};function md(t,e){return t&&"function"==typeof t.bandwidth?{isBandwidth:!0,value:Math.max(1,t.bandwidth()*e)}:{isBandwidth:!1,value:Math.max(1,e)}}function yd(t,e,n,i){let{width:r,height:o}=e;return t.filter((t=>!1!==t.show&&!isNaN(t.x+t.y))).map((t=>{let e=t,a=fd.test(t.size)?parseInt(t.size,10):n.min+e.size*(n.max-n.min);Zi(a)&&(e=dd,a=n.min+e.size*(n.max-n.min));const[s,l]=function(t){let e=pd.shape,n={};return"object"==typeof t.shape&&"string"==typeof t.shape.type?(e=t.shape.type,n=t.shape):"string"==typeof t.shape&&(e=t.shape),[e,n]}(e),c=Xi(Xi({},l),{},{type:s,label:t.label,x:t.x*r,y:t.y*o,fill:e.fill,size:Math.min(n.maxGlobal,Math.max(n.minGlobal,a)),stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,opacity:e.opacity});e===t.errorShape&&(c.width=e.width);const u=i(c);return u.data=t.data,u}))}const xd={require:["chart","resolver","symbol"],defaultSettings:{settings:{},data:{},animations:{enabled:!1,trackBy:t=>t.data.value},style:{item:"$shape"}},render(t){let{data:e}=t;const n=this.resolver.resolve({data:e,defaults:Hi({},pd,this.style.item),settings:this.settings.settings,scaled:{x:this.rect.width,y:this.rect.height}}),{width:i,height:r}=this.rect,o=Hi({},gd,this.settings.settings.sizeLimits),a=n.items,s=function(t,e,n,i,r){const o=md(t?t.scale:void 0,n),a=md(e?e.scale:void 0,i);let s=Math.min(o.value*r[o.isBandwidth?"maxRelDiscrete":"maxRelExtent"],a.value*r[a.isBandwidth?"maxRelDiscrete":"maxRelExtent"]),l=Math.min(o.value*r[o.isBandwidth?"minRelDiscrete":"minRelExtent"],a.value*r[a.isBandwidth?"minRelDiscrete":"minRelExtent"]);return{min:Math.max(1,Math.floor(l)),max:Math.max(1,Math.floor(s)),maxGlobal:r.maxPx,minGlobal:r.minPx}}(n.settings.x,n.settings.y,i,r,o);return yd(a,this.rect,s,this.settings.shapeFn||this.symbol)}};Math.PI;const vd={label:"",arc:1,show:!0,fill:"#333",stroke:"#ccc",strokeWidth:1,strokeLinejoin:"round",opacity:1,innerRadius:0,outerRadius:.8,cornerRadius:0,offset:0};function bd(t,e,n,i){let{x:r,y:o,width:a,height:s}=e;const l=Dr(),c={x:r+a/2,y:o+s/2},u=Math.min(a,s)/2,h=Math.min(a,s)/2,d=h/100;return t.map(((t,e)=>{const r=n[e];r.type="path";const o=h*r.outerRadius,a=u*r.innerRadius,s=d*r.cornerRadius;l.innerRadius(a),l.outerRadius(o),l.cornerRadius(s),r.arcDatum=t;const f=l.centroid(t),p=r.offset?function(t,e,n,i){let[r,o]=t;const a=Math.sqrt(r*r+o*o);r/=a,o/=a;const s=n-i;return{x:r*e*s,y:o*e*s}}(f,r.offset,o,a):{x:0,y:0};return r.transform="translate(".concat(p.x,", ").concat(p.y,") translate(").concat(c.x,", ").concat(c.y,")"),r.desc={share:t.value/i,slice:{start:t.startAngle,end:t.endAngle,innerRadius:a,outerRadius:o,cornerRadius:s,offset:{x:c.x+p.x,y:c.y+p.y}}},r}))}function wd(t,e){return t.slice&&"arc"in t.slice?e.arc:e.data.value}const Md={require:["chart","resolver"],defaultSettings:{settings:{startAngle:0,endAngle:2*Math.PI,padAngle:0,slice:{}},style:{slice:"$shape"},data:{}},render(t){let{data:e}=t;const n=[],i=[],r=this.settings.settings,{items:o}=this.resolver.resolve({data:e,defaults:Hi({},vd,this.style.slice),settings:r.slice});let a=0;for(let t=0,e=o.length;t<e;t++){const e=wd(r,o[t]);e>0&&o[t].outerRadius>=o[t].innerRadius&&(n.push(e),i.push(o[t]),a+=e)}const s=function(){var t=qr,e=Pr,n=null,i=hr(0),r=hr(Mr),o=hr(0);function a(a){var s,l,c,u,h,d=a.length,f=0,p=new Array(d),g=new Array(d),m=+i.apply(this,arguments),y=Math.min(Mr,Math.max(-Mr,r.apply(this,arguments)-m)),x=Math.min(Math.abs(y)/d,o.apply(this,arguments)),v=x*(y<0?-1:1);for(s=0;s<d;++s)(h=g[p[s]=s]=+t(a[s],s,a))>0&&(f+=h);for(null!=e?p.sort((function(t,n){return e(g[t],g[n])})):null!=n&&p.sort((function(t,e){return n(a[t],a[e])})),s=0,c=f?(y-d*v)/f:0;s<d;++s,m=u)l=p[s],u=m+((h=g[l])>0?h*c:0)+v,g[l]={data:a[l],index:s,value:h,startAngle:m,endAngle:u,padAngle:x};return g}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:hr(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:hr(+t),a):i},a.endAngle=function(t){return arguments.length?(r="function"==typeof t?t:hr(+t),a):r},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:hr(+t),a):o},a}().sortValues(null);s.startAngle(r.startAngle),s.endAngle(r.endAngle),s.padAngle(r.padAngle);return bd(s(n),Hi({},this.rect,{x:0,y:0}),i,a)}};const kd=function(t){function e(e){if(t[e.type]&&t[e.type].condition(e)){const n=t[e.type],i=void 0===n.conditionAppend||n.conditionAppend(e);n.items.forEach((t=>{const n=Math.round(e[t.key]),r=e[t.key]-n;e[t.key]=n,i&&"append"===t.type&&(r>0?e[t.key]+=.5:e[t.key]-=.5)}))}}return void 0===t&&((t={}).line={append:["x1","x2","y1","y2"],round:[],condition:t=>t.x1===t.x2||t.y1===t.y2,conditionAppend:t=>t.strokeWidth%2!=0},t.rect={append:["x","y"],round:["width","height"],condition:()=>!0,conditionAppend:t=>t.strokeWidth%2!=0}),Object.keys(t).forEach((e=>{const n=t[e];n.items=[],n.append.forEach((t=>{n.items.push({key:t,type:"append"})})),n.round.forEach((t=>{n.items.push({key:t,type:"round"})}))})),e.multiple=t=>t.forEach((t=>e(t))),e}();class _d{constructor(){this.reset(),this.push(...arguments)}static evaluateKey(t,e){if(e){const e=t.substring(0,1),n=t.substring(1);if("x"===e)return"y".concat(n);if("y"===e)return"x".concat(n);if("cx"===t)return"cy";if("cy"===t)return"cx";if("width"===t)return"height";if("height"===t)return"width"}return t}transposeCoordinate(t,e,n){if("number"==typeof e&&isFinite(e)){const i=t.substring(0,1);if("x"===i||"cx"===t)return e*this.width;if("width"===t)return e*this.width;if("r"===t)return e*(n?this.height:this.width);if("y"===i||"cy"===t)return e*this.height;if("height"===t)return e*this.height}return e}push(){return this.storage.push(...arguments),this}processItem(t){let e={};const n=void 0!==t.flipXY?t.flipXY:this.flipXY,i=void 0!==t.crisp?t.crisp:this.crisp;if(t.fn&&"function"==typeof t.fn){let i=n?this.height:this.width,r=n?this.width:this.height;t=t.fn({width:i,height:r,flipXY:n});const o=Object.keys(t);for(let i=0,r=o.length;i<r;i++){let r=o[i];e[_d.evaluateKey(r,n)]=t[r]}}else{const i=Object.keys(t);for(let r=0,o=i.length;r<o;r++){let o=i[r];const a=_d.evaluateKey(o,n),s=this.transposeCoordinate(a,t[o],n);e[a]=s}}return i&&kd(e),e}output(){let t=[];for(let e=0,n=this.storage.length;e<n;e++){let n=this.processItem(this.storage[e]);t.push(n)}return t}reset(){this.storage=[],this.flipXY=!1,this.crisp=!1,this.width=0,this.height=0}}function Sd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new _d(...e)}function Nd(t,e){return t&&e?t.cachedTicks&&t.cachedTicks()||t.ticks({distance:e}):[]}const Rd={created(){},require:["chart","renderer","resolver"],defaultSettings:{layout:{displayOrder:0},style:{ticks:"$guide-line",minorTicks:"$guide-line--minor"}},beforeRender(){this.blueprint=Sd(),this.blueprint.width=this.rect.width,this.blueprint.height=this.rect.height,this.blueprint.x=this.rect.x,this.blueprint.y=this.rect.y,this.blueprint.crisp=!0},render(){if(this.x=this.settings.x?this.chart.scale(this.settings.x):null,this.y=this.settings.y?this.chart.scale(this.settings.y):null,pu(this,"x",this.rect.width),pu(this,"y",this.rect.height),!this.x&&!this.y)return[];this.settings.ticks=Hi({show:!0},this.style.ticks,this.settings.ticks||{}),this.settings.minorTicks=Hi({show:!1},this.style.minorTicks,this.settings.minorTicks||{}),this.lines={x:[],y:[]},this.lines.x=Nd(this.x,this.rect.width),this.lines.y=Nd(this.y,this.rect.height),this.lines.y=this.lines.y.map((t=>Hi(t,{flipXY:!0})));let t=t=>{let{dir:e,isMinor:n}=t,i=this.lines[e].filter((t=>!!t.isMinor===n)),r=n?this.settings.minorTicks:this.settings.ticks;this.resolver.resolve({settings:r,data:{items:i,dir:e}}).items.forEach((t=>{let n=t.data;var i,r;t.show&&this.blueprint.push({type:"line",x1:n.position,y1:0,x2:n.position,y2:1,stroke:t.stroke||"black",strokeWidth:void 0!==t.strokeWidth?t.strokeWidth:1,strokeDasharray:void 0!==t.strokeDasharray?t.strokeDasharray:void 0,flipXY:n.flipXY||!1,value:null!==(i=n.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.value,dir:e})}))};return t({dir:"x",isMinor:!1}),t({dir:"x",isMinor:!0}),t({dir:"y",isMinor:!1}),t({dir:"y",isMinor:!0}),this.blueprint.output()}};function Ad(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bottom";if(n*=.8,"left"===i||"right"===i){let r="right"===i;return"\n M ".concat(t," ").concat(e-n,"\n A ").concat(1.25*n," ").concat(1.25*n,", 0, 1, ").concat(r?0:1,", ").concat(t," ").concat(e+n,"\n L ").concat(r?t+n:t-n," ").concat(e," Z\n ")}let r="bottom"===i;return"\n M ".concat(t-n," ").concat(e,"\n A ").concat(1.25*n," ").concat(1.25*n,", 0, 1, ").concat(r?1:0,", ").concat(t+n," ").concat(e,"\n L ").concat(t," ").concat(r?e+n:e-n," Z\n ")}function Cd(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bottom";if(n*=.75,"left"===i||"right"===i){let r="right"===i;return"\n M ".concat(t+=r?1.5*n:-1.5*n," ").concat(e-n,"\n L ").concat(t," ").concat(e+n,"\n L ").concat(r?t+n:t-n," ").concat(e," Z\n ")}let r="bottom"===i;return e+=r?1.5*n:-1.5*n,"\n M ".concat(t-n," ").concat(e,"\n L ").concat(t+n," ").concat(e,"\n L ").concat(t," ").concat(r?e+n:e-n," Z\n ")}function Dd(t,e,n){return t<e||t>n}function Od(t,e){if("string"==typeof t.formatter)return e.formatter(t.formatter);if("object"==typeof t.formatter)return e.formatter(t.formatter);if(void 0!==t.scale&&t.scale.data){const e=t.scale.data()&&t.scale.data().fields;return e&&e[0]?e[0].formatter():null}return null}function zd(t){if(void 0===t)return 0;if("number"==typeof t&&isFinite(t))return t;if("string"==typeof t)switch(t){case"center":case"middle":return.5;case"bottom":case"right":return 1;default:return 0}return 0}function Ed(t){let{chart:e,blueprint:n,renderer:i,p:r,settings:o,items:a,slopeLine:s}=t,l=!0,c=!1,u=!1,h=!1,d=!1,f=Hi(!0,{},o.style.line,r.line||{}),p=Hi(!0,{fill:"#000",fontFamily:"Arial",fontSize:"12px",opacity:1,maxWidth:1,maxWidthPx:9999,padding:5,background:{fill:"#fff",stroke:"transparent",strokeWidth:0,opacity:.5}},o.style.label||{},{fill:f.stroke});if(c=s?n.processItem({type:"line",x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,stroke:f.stroke||"black",strokeWidth:f.strokeWidth||1,strokeDasharray:f.strokeDasharray,flipXY:!1,value:r.valueInfo?r.valueInfo.id:r.value}):n.processItem({type:"line",x1:r.position,y1:0,x2:r.position,y2:1,stroke:f.stroke||"black",strokeWidth:f.strokeWidth||1,strokeDasharray:f.strokeDasharray,flipXY:r.flipXY||!1,value:r.valueInfo?r.valueInfo.id:r.value}),r.label){const t=Hi(!0,{fill:"#000",fontFamily:"Arial",fontSize:"12px",opacity:1,maxWidth:1,maxWidthPx:9999,padding:5,background:{fill:"#fff",stroke:"transparent",strokeWidth:0,opacity:.5}},o.style.label||{},{fill:f.stroke},r.label);let s,c={width:0,height:0},p="";s=Od(r,e),!1!==r.label.showValue&&(s?p=" (".concat(s(r.value),")"):r.scale&&(p=" (".concat(r.value,")"))),p&&(c=i.measureText({text:p,fontFamily:t.fontFamily,fontSize:t.fontSize}));let g=i.measureText({text:t.text||"",fontFamily:t.fontFamily,fontSize:t.fontSize}),m={width:g.width+c.width,height:Math.max(g.height,c.height)},y=t.padding,x=zd(r.flipXY?t.vAlign:t.align),v=zd(r.flipXY?t.align:t.vAlign),b=Math.min(1+m.width+2*y,t.maxWidth*n.width,t.maxWidthPx),w=m.height+2*y,M=r.flipXY?w:b,k=r.flipXY?b:w;if(u=n.processItem({fn:e=>{let{width:i,height:o}=e,a=r.position*i-(r.flipXY?w:b)*(1-x);a=r.flipXY?a:Math.max(a,0);return{type:"rect",x:a,y:Math.max(Math.abs(v*o-k*v),0),width:r.flipXY?M:Math.min(M,n.width-a),height:k,stroke:t.background.stroke,strokeWidth:t.background.strokeWidth,fill:t.background.fill,opacity:t.background.opacity}},flipXY:r.flipXY||!1}),u.x<-1||u.x+u.width>n.width+1||u.y<-1||u.y+u.height>n.height+1)u=void 0;else{h={type:"text",text:t.text||"",fill:t.fill,opacity:t.opacity,fontFamily:t.fontFamily,fontSize:t.fontSize,x:u.x+y,y:u.y+u.height/2+m.height/3,maxWidth:u.width-2*y-c.width,anchor:"start"},p&&(d={type:"text",text:p||"",fill:t.fill,opacity:t.opacity,fontFamily:t.fontFamily,fontSize:t.fontSize,x:h.x+3+(u.width-(c.width+2*y)),y:h.y});for(let t=0,e=a.length;t<e;t++){let e=a[t];"rect"===e.type?ch(u,e)&&(l=!1):"line"===e.type&&r.flipXY===e.flipXY&&dh(u,e)&&(l=!1)}}}if(c&&a.push(c),0!==(null==s?void 0:s.slope)&&(null!=s&&s.showLabel||null!=s&&s.showValue)){let t,o;const l=120;let u=s.showLabel?s.refLineLabel:"";if(s.showValue){const n=Od(r,e),i=n?n(s.value):s.value;t="(".concat(s.slope,"x + ").concat(i,")"),u+=s.refLineLabel?" ".concat(t):t}if(u.length>1){var g;const t=i.measureText({text:u,fontFamily:p.fontFamily,fontSize:p.fontSize});t.width=t.width>l?l:t.width;const r=function(t,e,n){const i=t.scale({scale:"x"}),r=t.scale({scale:"y"});if(e>0){if(i.max()*e+n>=r.max())return!0}else if(e<0&&i.min()*e+n>=r.max())return!0;return!1}(e,s.slope,s.value)?function(t,e,n){const i=t.scale({scale:"x"}),r=t.scale({scale:"y"});return i((r.max()-n)/e)}(e,s.slope,s.value):void 0,h=void 0===r||s.isRtl?p.padding:3*p.padding,d=void 0!==r||s.slope>0?3*p.padding:p.padding,m=function(t,e,n,i,r,o){let a=0;if(void 0!==n){if(n<.8)return a=t.slope<0||t.isRtl?3*o.padding:2*o.padding,t.isRtl,n*r.width+a;if(1===n)return t.isRtl?n*r.width-(i.width+3*o.padding):n*r.width-(i.width+6*o.padding);if(n>.8)return t.isRtl?n*r.width-(i.width+3*o.padding):n*r.width-(i.width+6*o.padding)}else if(t.slope>0)return e.x2-(i.width+2*o.padding);return t.isRtl?e.x1-(i.width+2*o.padding):e.x1}(s,c,r,t,n,p),y=Math.min(c.y1,c.y2);s.labelStroke&&(o={type:"rect",x:s.isRtl?Math.max(m,h)-2:Math.max(m,h)+2,y:Math.abs(Math.max(y,d)-t.height),rx:3,ry:3,width:t.width+p.padding,height:t.height-2,stroke:f.stroke,fill:f.stroke});const x={type:"text",text:u,fill:null!==(g=s.labelStroke)&&void 0!==g?g:f.stroke,opacity:p.opacity,fontFamily:p.fontFamily,fontSize:p.fontSize,x:o?o.x+2:Math.max(m,h)+2,y:o?o.y+t.height-p.padding:Math.abs(Math.max(y,d)-p.padding/2),anchor:"start",title:u,maxWidth:l,width:t.width};(function(t,e,n,i,r){for(let o=0,a=t.length;o<a;o++){const a=t[o];if("text"===(null==a?void 0:a.type)&&Math.abs(a.x-e.x)<Math.max(a.width+i,e.width+i)&&Math.abs(a.y-e.y)<n.height+r)return!0}return!1})(a,x,t,h,d)||(o&&a.push(o),a.push(x))}}l&&u&&h&&(a.push(u,h),d&&a.push(d))}function Id(t){const e={value:t.value};return t.label&&(e.label=t.label.text),e}function Td(t){return void 0!==("function"==typeof t.value?t.value():t.value)}function Pd(t,e){const n=t.min();if(n===t.max()){const i=function(t){const e=t.range();return 2===(null==e?void 0:e.length)&&e[0]>e[1]}(t);if(e<n)return i?2:-1;if(e>n)return i?-1:2}return t(e)}function qd(t,e){return t&&e&&Math.abs(t.x-e.x)<1e-15&&Math.abs(t.y-e.y)<1e-15}const Ld={require:["chart","renderer"],defaultSettings:{layout:{displayOrder:0},style:{oob:{show:!0,width:10,fill:"#1A1A1A",stroke:"transparent",strokeWidth:0,opacity:1,text:{fontFamily:"Arial",stroke:"transparent",fill:"#fff",strokeWidth:0,opacity:1},triangle:{fill:"#4D4D4D",stroke:"transparent",strokeWidth:0,opacity:1},padding:{x:28,y:5}},line:{stroke:"#000"},label:{strokeWidth:0}}},preferredSize:()=>30,beforeRender(){this.blueprint=Sd(),this.blueprint.width=this.rect.width,this.blueprint.height=this.rect.height,this.blueprint.x=this.rect.x,this.blueprint.y=this.rect.y,this.blueprint.crisp=!0},render(){let t=this.settings;if(this.lines={x:[],y:[]},this.lines.x=t.lines&&t.lines.x||[],this.lines.y=t.lines&&t.lines.y||[],0===this.lines.x.length&&0===this.lines.y.length)return[];const e={x0:[],x1:[],y0:[],y1:[]};this.lines.x=this.lines.x.filter(Td).map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=this.chart.scale(t.scale);const n=Pd(e,t.value);return Hi(t,{scale:e,position:n})}return Hi(t,{position:t.value})})),this.lines.y=this.lines.y.filter(Td).map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=this.chart.scale(t.scale);const n=Pd(e,t.value);return Hi(t,{scale:e,position:n,flipXY:!0})}return Hi(t,{position:t.value,flipXY:!0})})),this.lines.x=this.lines.x.filter((t=>!(t.position<0||t.position>1)||(e["x".concat(t.position>1?1:0)].push(Id(t)),!1))),this.lines.y=this.lines.y.filter((t=>!(!t.slope||0===t.slope)||(!(t.position<0||t.position>1)||(e["y".concat(t.position>1?1:0)].push(Id(t)),!1))));let n=[];return[...this.lines.x,...this.lines.y].forEach((i=>{if(!0===i.show||void 0===i.show){let r;if(i.slope&&0!==i.slope){const t=this.chart.scale({scale:"x"}),n=this.chart.scale({scale:"y"}),o=t.min(),a=t.max(),s=n.min(),l=n.max();r=Xi(Xi({},i),{},{x1:void 0,y1:void 0,x2:void 0,y2:void 0});const c=o*i.slope+i.value,u=a*i.slope+i.value,h=(s-i.value)/i.slope,d=(l-i.value)/i.slope;let f=[];Dd(c,s,l)||(f[0]={x:Pd(t,o),y:Pd(n,c)}),Dd(h,o,a)||(f[1]={x:Pd(t,h),y:1}),Dd(u,s,l)||(f[2]={x:Pd(t,a),y:Pd(n,u)}),Dd(d,o,a)||(f[3]={x:Pd(t,d),y:0});if(f.filter((t=>!!t)).length>2&&function(t){qd(t[0],t[1])&&(t[1]=void 0),qd(t[1],t[2])&&(t[2]=void 0),qd(t[2],t[3])&&(t[3]=void 0),qd(t[3],t[0])&&(t[3]=void 0)}(f),f=f.filter((t=>!!t)),f.length<2)return void e["y".concat(c>l?0:1)].push(Id(i));r.x1=f[0].x,r.y1=f[0].y,r.x2=f[1].x,r.y2=f[1].y}else r=void 0;Ed({chart:this.chart,blueprint:this.blueprint,renderer:this.renderer,p:i,settings:t,items:n,slopeLine:r})}})),t.style.oob.show&&function(t){let{blueprint:e,oob:n,settings:i,items:r}=t;const o=Object.keys(n);let a=i.style.oob||{};for(let t=0,i=o.length;t<i;t++){const i=o[t],s=n[i];if(s.length>0){let t=i.charAt(1),n="y"===i.charAt(0),o=a.padding.x+a.width,l=a.padding.y+a.width,c="bottom";c=n?"1"===t?"bottom":"top":"1"===t?"right":"left";let u=e.processItem({fn:e=>{let{width:i,height:r}=e,u=t*i+("1"===t?-o:o),h=n?l:r-l;return"arc"===a.type?{type:"path",d:Ad(n?h:u,n?u:h,a.width,c),x:u,y:h,stroke:a.stroke,fill:a.fill,strokeWidth:a.strokeWidth||0}:{type:"circle",cx:u,cy:h,r:a.width,stroke:a.stroke,fill:a.fill,strokeWidth:a.strokeWidth||0,opacity:a.opacity,data:s}},flipXY:n}),h=u.cx||u.x,d=u.cy||u.y,f={type:"text",text:s.length||"",x:h-.4*a.width,y:d+.4*a.width,fontFamily:a.text.fontFamily,fontSize:"".concat(1.3*a.width,"px"),stroke:a.text.stroke,fill:a.text.fill,strokeWidth:a.text.strokeWidth||0,opacity:a.text.opacity},p={type:"path",d:Cd(h,d,a.width,c),x:h,y:d,stroke:a.triangle.stroke,fill:a.triangle.fill,strokeWidth:a.triangle.strokeWidth||0,opacity:a.triangle.opacity};r.push(u,f,p)}}}({blueprint:this.blueprint,oob:e,settings:t,items:n}),n}};function jd(t){const e={type:"line",x1:0,x2:0,y1:0,y2:0,collider:{type:null}};return"top"===t.align||"bottom"===t.align?(e.x1=t.innerRect.x-t.outerRect.x,e.x2=e.x1+t.innerRect.width,e.y1=e.y2="top"===t.align?t.innerRect.height-t.padding:t.padding):(e.x1=e.x2="left"===t.align?t.innerRect.width-t.padding:t.padding,e.y1=t.innerRect.y-t.outerRect.y,e.y2=e.y1+t.innerRect.height),function(t,e){Hi(t,e.style)}(e,t),e}function Fd(t){return"string"==typeof t||"number"==typeof t?t:"-"}function Bd(t,e,n){n.layered||!n.stepSize?function(t,e){e.collider={type:"polygon",vertices:[{x:e.boundingRect.x,y:e.boundingRect.y},{x:e.boundingRect.x+e.boundingRect.width,y:e.boundingRect.y},{x:e.boundingRect.x+e.boundingRect.width,y:e.boundingRect.y+e.boundingRect.height},{x:e.boundingRect.x,y:e.boundingRect.y+e.boundingRect.height}]}}(0,e):n.tilted?function(t,e,n){const i=n.angle*(Math.PI/180),r=Math.max(n.stepSize/2,e.boundingRect.height/2),o="start"===e.anchor,a="end"===e.anchor&&i<0,s="start"===e.anchor&&i>=0,l=e.boundingRect.y+(s||a?e.boundingRect.height:0),c=[{x:e.x-r,y:l},{x:e.x+r,y:l}].map((t=>Pu(t,i,{x:e.x,y:e.y}))),u={x:o?e.boundingRect.x+e.boundingRect.width+10:e.boundingRect.x-10,y:e.boundingRect.y+e.boundingRect.height},h={x:o?e.boundingRect.x+e.boundingRect.width+10:e.boundingRect.x-10,y:e.boundingRect.y},d=i>=0?[u,h]:[h,u];c.push(...d),e.collider={type:"polygon",vertices:c}}(0,e,n):function(t,e,n){if("bottom"===n.align||"top"===n.align){const i=t.position*n.innerRect.width+(n.innerRect.x-n.outerRect.x-n.stepSize/2);e.collider={type:"rect",x:i,y:0,width:i<0?n.stepSize+i:n.stepSize,height:n.innerRect.height}}else{const i=t.position*n.innerRect.height+(n.innerRect.y-n.outerRect.y-n.stepSize/2);e.collider={type:"rect",x:0,y:i,width:n.innerRect.width,height:i<0?n.stepSize+i:n.stepSize}}const i=e.collider;i.x=Math.max(i.x,0),i.y=Math.max(i.y,0);const r=i.x+i.width-(n.outerRect.x+n.outerRect.width);i.width=r>0?i.width-r:i.width;const o=i.y+i.height-(n.outerRect.y+n.outerRect.height);i.height=o>0?i.height-o:i.height}(t,e,n)}function Vd(t,e){const n=isNaN(t.style.align)?.5:Math.min(Math.max(t.style.align,0),1);let i=0;if(t.tilted)i=t.stepSize*n;else{const r=e?t.textRect.height:t.textRect.width;i=Math.max(0,t.stepSize-r)*n}return i}function $d(t,e){var n,i;const r={type:"text",text:Fd(t.label),x:0,y:0,maxWidth:e.maxWidth,maxHeight:e.maxHeight,tickValue:null!==(n=t.value)&&void 0!==n?n:null===(i=t.data)||void 0===i?void 0:i.value};return"top"===e.align||"bottom"===e.align?(r.x=t.start*e.innerRect.width+(e.innerRect.x-e.outerRect.x)+Vd(e,!1),r.y="top"===e.align?e.innerRect.height:0,r.anchor=e.stepSize?"start":"middle",r.x+=isNaN(e.style.offset)?0:+e.style.offset):(r.y=t.start*e.innerRect.height+(e.innerRect.y-e.outerRect.y)+Vd(e,!0),r.x="left"===e.align?e.innerRect.width:0,r.anchor="left"===e.align?"end":"start",r.baseline=e.stepSize?"text-before-edge":"central",r.y+=isNaN(e.style.offset)?0:+e.style.offset),function(t,e){["fill","fontSize","fontFamily"].forEach((n=>{t[n]=e.style[n]}))}(r,e),function(t,e){if(!e.tilted&&!e.stepSize)if("top"===e.align||"bottom"===e.align){const n=0,i=e.outerRect.width,r=Math.min(e.maxWidth/2,e.textRect.width/2),o=t.x-r,a=t.x+r;o<n?(t.anchor="start",t.x=e.innerRect.x-e.outerRect.x):a>i&&(t.anchor="end",t.x=e.innerRect.width+e.innerRect.x)}else{const n=0,i=e.outerRect.height,r=e.maxHeight/2,o=t.y-r,a=t.y+r;o<n?(t.y=e.innerRect.y-e.outerRect.y,t.baseline="text-before-edge"):a>i&&(t.y=e.innerRect.height+(e.innerRect.y-e.outerRect.y),t.baseline="text-after-edge")}}(r,e),function(t,e){"top"===e.align?t.y-=e.padding:"bottom"===e.align?t.y+=e.padding+e.maxHeight:"left"===e.align?t.x-=e.padding:"right"===e.align&&(t.x+=e.padding)}(r,e),function(t,e){if(e.tilted){const n=-e.angle,i=n*(Math.PI/180);"bottom"===e.align?(t.x-=e.maxHeight*Math.sin(i)/2,t.y-=e.maxHeight,t.y+=e.maxHeight*Math.cos(i)/2):t.x-=e.maxHeight*Math.sin(i)/3,t.transform="rotate(".concat(n,", ").concat(t.x,", ").concat(t.y,")"),t.anchor="bottom"===e.align==e.angle<0?"start":"end";const r=Math.cos(i)*e.maxWidth;if("bottom"===e.align==e.angle<0){const n=e.outerRect.width-e.paddingEnd;t.x+r>n&&(t.maxWidth=(n-t.x-10)/Math.cos(i))}else{const n=e.paddingEnd;t.x-r<n&&(t.maxWidth=(t.x-n-10)/Math.cos(i))}}}(r,e),function(t,e){t.boundingRect=e.textBounds(t)}(r,e),Bd(t,r,e),r}function Hd(t,e){const n={type:"line",x1:0,x2:0,y1:0,y2:0,collider:{type:null},tickValue:t.value};return"top"===e.align||"bottom"===e.align?(n.x1=n.x2=t.position*e.innerRect.width+(e.innerRect.x-e.outerRect.x),n.y1="top"===e.align?e.innerRect.height:0,n.y2="top"===e.align?n.y1-e.tickSize:n.y1+e.tickSize):(n.y1=n.y2=t.position*e.innerRect.height+(e.innerRect.y-e.outerRect.y),n.x1="left"===e.align?e.innerRect.width:0,n.x2="left"===e.align?n.x1-e.tickSize:n.x1+e.tickSize),function(t,e){Hi(t,e.style)}(n,e),function(t,e){"top"===e.align?(t.y1-=e.padding,t.y2-=e.padding):"bottom"===e.align?(t.y1+=e.padding,t.y2+=e.padding):"left"===e.align?(t.x1-=e.padding,t.x2-=e.padding):"right"===e.align&&(t.x1+=e.padding,t.x2+=e.padding)}(n,e),function(t,e){const n=t.strokeWidth/2;t.x1===e.innerRect.width?(t.x1-=n,t.x2-=n):0===t.x1?(t.x1+=n,t.x2+=n):t.y1===e.innerRect.height?(t.y1-=n,t.y2-=n):0===t.y1&&(t.y1+=n,t.y2+=n)}(n,e),n}function Wd(t){return!t.isMinor&&t.position>=0&&t.position<=1}function Ud(t){let{rect:e,state:n,majorTicks:i,measure:r,horizontal:o}=t;return o?function(t){let{majorTicks:e,measureText:n,rect:i,state:r}=t;const o="layered"===r.labels.activeMode?2:1,a=i.width,s=e.map((t=>t.label)).map((t=>"".concat(t.slice(0,1)).concat(t.length>1?"…":""))).map(n).map((t=>t.width));for(let t=0;t<e.length;++t){const n=e[t];if(o*a*Math.abs(n.start-n.end)<s[t])return!0}return!1}({majorTicks:i,measureText:r,rect:e,state:n}):function(t){let{majorTicks:e,measureText:n,rect:i}=t;const r=i.height,o=n("M").height;return!(e.length<2)&&r*Math.abs(e[0].position-e[1].position)<o}({majorTicks:i,measureText:r,rect:e,state:n})}function Yd(t){let{value:e,maxValue:n,minValue:i,range:r,modifier:o}=t;return isNaN(r)||isNaN(o)||(e=r*o),e>n&&(e=n),e<i&&(e=i),e}function Xd(t){let{isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s}=t,l=0;const c={left:0,top:0,right:0,bottom:0},{maxLengthPx:u,minLengthPx:h}=a.labels;if(a.labels.show){const t=a.align,d="top"===t||"bottom"===t,f=d?n.inner.width:n.inner.height,p=o.ticks({settings:a,distance:f,formatter:i}).filter(Wd),g=t=>{const e=r({text:t,fontSize:a.labels.fontSize,fontFamily:a.labels.fontFamily});return e.width=Yd({value:e.width,maxValue:u,minValue:h}),e};if(e&&d&&"auto"===a.labels.mode&&(!function(t){let{majorTicks:e,measure:n,rect:i,state:r,settings:o}=t;const a=o.labels.maxGlyphCount,s="layered"===r.labels.activeMode?2:1,l=o.labels.tiltThreshold?o.labels.tiltThreshold:.7,c=n("…").width,u=i.width;let h=0,d=0;if(isNaN(a))for(let t=0;t<e.length;t++){const i=e[t],r=i.label,o=n(r).width*(r.length>1?l:1);if(d=s*u*Math.abs(i.start-i.end),o+c>d)return!0}else if(d=s*u*e.reduce(((t,e)=>Math.min(Math.abs(e.start-e.end),t)),1/0),h=n("M").width*l*a,h+c>d)return!0;return!1}({majorTicks:p,measure:g,rect:n.inner,state:s,settings:a})?s.labels.activeMode="horizontal":s.labels.activeMode="tilted"),!a.labels.filterOverlapping&&"tilted"!==s.labels.activeMode&&Ud({rect:n.inner,state:s,majorTicks:p,measure:g,horizontal:d})){return{size:Math.max(n.outer.width,n.outer.height),isToLarge:!0}}let m,y;if("tilted"===s.labels.activeMode){const t=Math.abs(a.labels.tiltAngle)*(Math.PI/180);m=e=>Yd({value:e.width,maxValue:u,minValue:h})*Math.sin(t)+e.height*Math.cos(t)}else m=d?t=>t.height:t=>Yd({value:t.width,maxValue:u,minValue:h});if(d&&"tilted"!==s.labels.activeMode)y=["M"];else if(isNaN(a.labels.maxGlyphCount))y=p.map((t=>t.label));else{let t="";for(let e=0;e<a.labels.maxGlyphCount;e++)t+="M";y=[t]}const x=y.map(g),v=x.map(m),b=Math.max(...v,0);if(l+=b,l+=a.labels.margin,"layered"===s.labels.activeMode&&(l*=2),"tilted"===s.labels.activeMode){const t="bottom"===a.align==a.labels.tiltAngle>=0,e=Math.abs(a.labels.tiltAngle)*(Math.PI/180),i=(b-g("M").height*Math.cos(e))/Math.sin(e),r=t=>Math.min(i,t.width)*Math.cos(e)+t.height,o=(e,i)=>{const r=p[i]?p[i].position:0;return t?e-r*n.inner.width:e-(1-r)*n.inner.width},s=Math.min(a.labels.maxEdgeBleed,Math.max(...x.map(r).map(o),0))+a.paddingEnd;if(c[t?"left":"right"]=s,!a.labels.filterOverlapping&&function(t){let{majorTicks:e,measureText:n,rect:i,bleedSize:r,angle:o}=t;if(e.length<2)return!1;if(0===o)return!0;const a=Math.abs(o),s=1/(Math.min(i.outer.width-r,i.inner.width)*Math.abs(e[0].position-e[1].position));return n("M").height>Math.sin(a*(Math.PI/180))/s}({majorTicks:p,measureText:g,rect:n,bleedSize:s,angle:a.labels.tiltAngle})){return{size:Math.max(n.outer.width,n.outer.height),isToLarge:!0}}}}return{size:l,edgeBleed:c}}const Gd=(t,e,n)=>t.width*Math.abs(e.position-n.position);function Kd(t){let{layered:e,major:n,innerRect:i,outerRect:r,tick:o,index:a}=t;const s=e?2:1,l=n[a-s],c=n[a+s],u=l?Gd(i,o,l)/2-2:1/0,h=c?Gd(i,o,c)/2-2:1/0;return n.length<2?i.width:l?c?2*Math.min(u,h):(t=>{let{innerRect:e,outerRect:n,tick:i,prevWidth:r}=t;const o=e.x-n.x,a=n.width-e.width-o,s=e.width-e.width*i.position+a,l=2*Math.min(r,s),c=1===i.position?e.width/2-2:0;return Math.max(r,l,c)})({innerRect:i,outerRect:r,tick:o,prevWidth:u}):(t=>{let{innerRect:e,outerRect:n,tick:i,nextWidth:r}=t;const o=e.x-n.x,a=e.width*i.position+o,s=2*Math.min(r,a),l=0===i.position?e.width/2-2:0;return Math.max(r,s,l)})({innerRect:i,outerRect:r,tick:o,nextWidth:h})}function Zd(t){const e=t.innerRect,n={cx:e.width/2,cy:e.height/2},i=Math.min(e.height,e.width)/2*t.radius,r=i+t.style.strokeWidth,o={visible:!0,type:"path",arcDatum:{startAngle:t.startAngle,endAngle:t.endAngle},transform:"translate(0, 0) translate(".concat(n.cx,", ").concat(n.cy,")"),desc:{share:1,slice:{cornerRadius:0,innerRadius:i,outerRadius:r}},ticks:[]};return function(t,e){Hi(t,e.style)}(o,t),o}function Jd(t,e,n,i){return{x:t+n*Math.cos(i),y:e+n*Math.sin(i)}}function Qd(t,e){const n=e.innerRect,i={cx:n.width/2,cy:n.height/2},r=Math.min(n.height,n.width)/2*e.radius+e.padding,o=e.startAngle,a=e.endAngle,s=e.tickSize,l=a-o;let c=a-t.position*l;c-=Math.PI/2;const u=Jd(i.cx,i.cy,r+s,c),h=Jd(i.cx,i.cy,r,c),d={type:"line",x1:u.x,y1:u.y,x2:h.x,y2:h.y,value:t.value};return function(t,e){const n=Xi({},e.style);Hi(t,n)}(d,e),d}function tf(t){return"string"==typeof t||"number"==typeof t?t:"-"}function ef(t,e,n){let i;return i="left"===e?n.x:"right"===e?t.outerRect.width-n.x:Math.max(n.x,t.outerRect.width-n.x),i}function nf(t,e){const n=e.innerRect,i={cx:n.width/2,cy:n.height/2},r=Math.min(n.height,n.width)/2*e.radius+e.padding,o=e.startAngle,a=e.endAngle,s=e.tickSize,l=a-o,c=.2;let u,h;u="top"===e.align||"bottom"===e.align?a-t.position*l:o+t.position*l,h=u<-.2&&u>-Math.PI+c?"left":u>.2&&u<Math.PI-c?"right":"center",u-=Math.PI/2;const d=function(t,e,n,i){return{x:t+n*Math.cos(i),y:e+n*Math.sin(i)}}(i.cx,i.cy,r+s+6,u);let f;f="left"===h?"end":"right"===h?"start":"middle";const p={type:"text",text:tf(t.label),align:h,x:d.x,y:d.y,maxHeight:e.maxHeight,maxWidth:ef(e,h,d),anchor:f,baseline:"middle"};return function(t,e){["fill","fontSize","fontFamily"].forEach((n=>{t[n]=e.style[n]}))}(p,e),function(t,e){t.boundingRect=e.textBounds(t)}(p,e),function(t,e,n){let i,r;const o=parseFloat(n.fontSize)||0;i=e.y-o/2,r=t.innerRect.height-(e.y+o/2),(i<0||r<0)&&(n.text="")}(e,d,p),p}function rf(t){let e=0;return e+=t.paddingStart,e+=t.line.show?t.line.strokeWidth/2:0,e+=t.ticks.show?t.ticks.margin:0,e}function of(t){let e=0;return e+=t.line.show?t.line.strokeWidth/2:0,e+=t.ticks.show?t.ticks.margin:0,e}function af(t){let e=0;return e+=t.ticks.show?t.ticks.tickSize:0,e+=rf(t)+t.labels.margin,e}function sf(t,e){return t.map((t=>Hd(t,e)))}function lf(t,e){return e?Math.abs(e.end-e.start):t.bandwidth()}function cf(t){let{textMetrics:e,settings:n,innerRect:i,scale:r,tilted:o,layered:a,tick:s}=t;const l=e.height,c=lf(r,s),u={width:0,height:l};if("left"===n.align||"right"===n.align)u.width=i.width-af(n)-n.paddingEnd;else if(a)u.width=c*i.width*2;else if(o){const t=Math.abs(n.labels.tiltAngle)*(Math.PI/180);u.width=(i.height-af(n)-n.paddingEnd-l*Math.cos(t))/Math.sin(t)}else u.width=c*i.width;return u.width=Yd({value:u.width,maxValue:n.labels.maxLengthPx,minValue:n.labels.minLengthPx}),u}function uf(t){let{textMetrics:e,settings:n,innerRect:i,outerRect:r,tilted:o,layered:a,tick:s,index:l,major:c}=t;const u=e.height,h={width:0,height:u};if("left"===n.align||"right"===n.align)h.width=i.width-af(n)-n.paddingEnd;else if(o){const t=Math.abs(n.labels.tiltAngle)*(Math.PI/180);h.width=(i.height-af(n)-n.paddingEnd-u*Math.cos(t))/Math.sin(t)}else h.width=Kd({layered:a,major:c,innerRect:i,outerRect:r,tick:s,index:l});return h.width=Yd({value:h.width,maxValue:n.labels.maxLengthPx,minValue:n.labels.minLengthPx}),h}function hf(t){let e;function n(){return e=uf,n}function i(){return e=cf,i}function r(t){let{settings:n,scale:i,innerRect:r,outerRect:o,measureText:a,ticks:s,state:l,textBounds:c}=t;const u=[],h=function(t){return t.filter((t=>!t.isMinor))}(s),d=function(t){return t.filter((t=>t.isMinor))}(s),f={innerRect:r,align:n.align,outerRect:o},p="tilted"===l.labels.activeMode,g="layered"===l.labels.activeMode;let m;if(n.arc&&(f.startAngle=n.arc.startAngle,f.endAngle=n.arc.endAngle,f.radius=n.arc.radius),n.line.show&&(f.style=n.line,f.padding=n.paddingStart,n.arc?u.push(Zd(f)):u.push(jd(f))),n.ticks.show&&(f.style=n.ticks,f.tickSize=n.ticks.tickSize,f.padding=rf(n),n.arc?(f.padding=of(n),m=function(t,e){return t.map((t=>Qd(t,e)))}(h,f)):m=sf(h,f)),n.labels.show){const t=af(n);f.style=n.labels,f.padding=t,f.tilted=p,f.layered=g,f.angle=n.labels.tiltAngle,f.paddingEnd=n.paddingEnd,f.textBounds=c;const l=(t,l)=>{f.textRect=function(t){let{style:e,measureText:n,tick:i}=t;return n({text:i.label,fontSize:e.fontSize,fontFamily:e.fontFamily})}({tick:t,measureText:a,style:f.style});const c=e({textMetrics:f.textRect,settings:n,innerRect:r,outerRect:o,scale:i,tilted:p,layered:g,tick:t,major:h,index:l});f.maxWidth=c.width,f.maxHeight=c.height,f.stepSize=function(t){let{innerRect:e,scale:n,settings:i,tick:r}=t;return("top"===i.align||"bottom"===i.align?e.width:e.height)*lf(n,r)}({innerRect:r,scale:i,ticks:s,settings:n,tick:t})};let d=[];n.arc?(f.padding=function(t){let e=0;return e+=t.ticks.show?t.ticks.tickSize:0,e+=of(t)+t.labels.margin,e}(n),d=function(t,e,n){return t.map(((t,i)=>{n(t,i);const r=nf(t,e);return r.data=t.data,r}))}(h,f,l)):d=!g||"top"!==n.align&&"bottom"!==n.align?function(t,e,n){return t.map(((t,i)=>{n(t,i);const r=$d(t,e);return r.data=t.data,r}))}(h,f,l):function(t,e,n,i){const r=e.padding,o=af(n);return t.map(((t,a)=>{i(t,a);const s=o+e.maxHeight+n.labels.margin;e.layer=a%2,e.padding=a%2==0?r:s;const l=$d(t,e);return l.data=t.data,l}))}(h,f,n,l),n.labels.filterOverlapping&&function(t,e,n){let i=(e,n)=>ch(rr(1,t[e].boundingRect),rr(1,t[n].boundingRect));if(n&&n.tilted){const e=Math.abs(n.angle);i=(n,i)=>{const r=1/Math.abs(t[n].x-t[i].x),o=Math.sin(e*(Math.PI/180))/r;return t[n].boundingRect.height>o}}for(let n=0;n<=t.length-1;n++)for(let r=n+1;r<=Math.min(n+5,n+(t.length-1));r++)t[n]&&t[r]&&i(n,r)&&(r===t.length-1?(t.splice(n,1),e&&e.splice(n,1)):(t.splice(r,1),e&&e.splice(r,1)),r--,n--)}(d,m,f),u.push(...d)}return n.minorTicks&&n.minorTicks.show&&d.length>0&&(f.style=n.minorTicks,f.tickSize=n.minorTicks.tickSize,f.padding=function(t){return t.line.strokeWidth+t.minorTicks.margin}(n),u.push(...sf(d,f))),m&&u.push(...m),u}return n.build=r,i.build=r,t?i():n()}const df={labels:{show:!0,tiltAngle:40,tiltThreshold:.7,maxEdgeBleed:1/0,margin:4,maxLengthPx:150,minLengthPx:0,mode:"auto",maxGlyphCount:NaN,align:.5,offset:0,filterOverlapping:!1},ticks:{show:!1,margin:0,tickSize:4},line:{show:!1},paddingStart:0,paddingEnd:10,align:"auto"},ff={labels:{show:!0,margin:4,maxLengthPx:150,minLengthPx:0,align:.5,offset:0,filterOverlapping:!0},ticks:{show:!0,margin:0,tickSize:8},minorTicks:{show:!1,tickSize:3,margin:0},line:{show:!0},paddingStart:0,paddingEnd:10,align:"auto"};const pf={require:["chart","renderer","dockConfig"],defaultSettings:{layout:{displayOrder:0,prioOrder:0},settings:{},style:{labels:"$label",ticks:"$guide-line",minorTicks:"$guide-line--minor",line:"$guide-line"}},created(){this.state={isDiscrete:!!this.scale.bandwidth,isHorizontal:!1,labels:{activeMode:"horizontal"},ticks:[],innerRect:{width:0,height:0,x:0,y:0},outerRect:{width:0,height:0,x:0,y:0},defaultDock:void 0,concreteNodeBuilder:void 0,settings:void 0},this.state.isDiscrete?this.state.defaultDock="bottom":this.state.defaultDock="left",this.setState(this.settings)},setState(){this.state.isDiscrete=!!this.scale.bandwidth,this.state.settings=function(t){let{state:e,style:n,settings:i}=t;const r=Hi(!0,{},e.isDiscrete?df:ff,n),o=Hi(!0,{},r,i.settings),a=i.layout.dock||e.defaultDock;o.dock=a,o.align=function(t,e){const n=["top","bottom"],i=["left","right"];return-1!==n.indexOf(t)&&-1===i.indexOf(e)||-1!==i.indexOf(t)&&-1===n.indexOf(e)?t:e}(i.settings.align,a),o.labels.tiltAngle=Math.max(-90,Math.min(o.labels.tiltAngle,90));const{paddingStart:s,paddingEnd:l}=o;return o.paddingStart="function"==typeof s?s.call(null):s,o.paddingEnd="function"==typeof l?l.call(null):l,o}(this),this.state.concreteNodeBuilder=hf(this.state.isDiscrete),this.dockConfig.dock(this.state.settings.dock),this.state.isHorizontal="top"===this.state.settings.align||"bottom"===this.state.settings.align,this.state.labels.activeMode=function(t,e,n){const i=e.labels.mode;return n&&t.isHorizontal?"auto"===i?t.labels.activeMode:-1!==["layered","tilted"].indexOf(e.labels.mode)&&-1!==["top","bottom"].indexOf(e.dock)?i:"horizontal":"horizontal"}(this.state,this.state.settings,this.state.isDiscrete)},preferredSize(t){const{formatter:e,state:n,scale:i}=this,r=this.state.isHorizontal?t.inner.width:t.inner.height;this.state.pxScale=gu(i,r);const o=function(t){let{isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s}=t,l=0;const{size:c,edgeBleed:u,isToLarge:h}=Xd({isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s});if(l+=c,h)return{size:l};if(a.ticks.show&&(l+=a.ticks.margin,l+=a.ticks.tickSize),a.minorTicks&&a.minorTicks.show){const t=a.minorTicks.margin+a.minorTicks.tickSize;t>l&&(l=t)}if(a.line.show){const t=a.line.strokeWidth/2;l+=t,u[function(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left";default:return t}}(a.align)]=Math.ceil(t)}return l+=a.paddingStart,l+=a.paddingEnd,{size:l,edgeBleed:u}}({isDiscrete:this.state.isDiscrete,rect:{inner:t.inner,outer:t.outer},formatter:e,measureText:this.renderer.measureText,scale:this.state.pxScale,settings:this.state.settings,state:n});return o},beforeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{settings:e}=t;this.setState(e)},resize(t){const{inner:e,outer:n}=t,i=Hi({},e,function(t){let{align:e,inner:n}=t;return"left"===e?{x:n.width+n.x}:"right"===e||"bottom"===e?n:{y:n.y+n.height}}({align:this.state.settings.align,inner:e})),r=n||i;return Hi(this.state.innerRect,i),Hi(this.state.outerRect,r),n},beforeRender(){const{scale:t,formatter:e}=this,n=this.state.isHorizontal?this.state.innerRect.width:this.state.innerRect.height;this.state.pxScale=gu(t,n),this.state.ticks=this.state.pxScale.ticks({distance:n,formatter:e}).filter((t=>t.position>=0&&t.position<=1))},render(){const{state:t}=this,e=[];return e.push(...this.state.concreteNodeBuilder.build({settings:this.state.settings,scale:this.state.pxScale,innerRect:this.state.innerRect,outerRect:this.state.outerRect,measureText:this.renderer.measureText,textBounds:this.renderer.textBounds,ticks:this.state.ticks,state:t})),kd.multiple(e),e}};const gf={render:()=>[]};function mf(t,e,n){let i="";if("function"==typeof t)i=t();else if("string"==typeof t)i=t;else if(n){const t=(n.data().fields||[]).map((t=>t.title()));i=t.join(e)}return i}function yf(t,e){let n="middle";return"left"===t?"top"===e?n="end":"bottom"===e&&(n="start"):"right"===t?"top"===e?n="start":"bottom"===e&&(n="end"):"left"===e?n="start":"right"===e&&(n="end"),n}const xf={require:["renderer","chart"],defaultSettings:{layout:{dock:"bottom",displayOrder:0,prioOrder:0},settings:{paddingStart:5,paddingEnd:5,paddingLeft:0,paddingRight:0,anchor:"center",join:", ",maxLengthPx:NaN},style:{text:"$title"}},created(){this.definitionSettings=this.settings.settings;const t=this.settings.text,e=this.definitionSettings.join;this.title=mf(t,e,this.scale)},preferredSize(){return this.renderer.measureText({text:this.title,fontSize:this.style.text.fontSize,fontFamily:this.style.text.fontFamily}).height+this.definitionSettings.paddingStart+this.definitionSettings.paddingEnd},render(){const{title:t,definitionSettings:e,rect:n}=this,i=[];return i.push(function(t){let{title:e,definitionSettings:n,dock:i,rect:r,measureText:o,style:a}=t;const s={type:"text",text:e,x:0,y:0,dx:0,dy:0,anchor:yf(i,n.anchor),baseline:"alphabetical",stroke:"transparent",strokeWidth:0,fontWeight:"normal"};Hi(s,a.text);const l=o(s);if("top"===i||"bottom"===i){let t=r.width/2;"left"===n.anchor?t=n.paddingLeft||0:"right"===n.anchor&&(t=r.width-(n.paddingRight||0)),s.x=t,s.y="top"===i?r.height-n.paddingStart:n.paddingStart+l.height,s.dy="top"===i?-l.height/6:-l.height/3,s.maxWidth=.8*r.width}else{let t=r.height/2;"top"===n.anchor?t=n.paddingStart:"bottom"===n.anchor&&(t=r.height-n.paddingStart),s.y=t,s.x="left"===i?r.width-n.paddingStart:n.paddingStart,s.dx="left"===i?-l.height/3:l.height/3;const e="left"===i?270:90;s.transform="rotate(".concat(e,", ").concat(s.x+s.dx,", ").concat(s.y+s.dy,")"),s.maxWidth=.8*r.height}return isNaN(n.maxLengthPx)||(s.maxWidth=Math.min(s.maxWidth,n.maxLengthPx)),s}({title:t,dock:this.settings.layout.dock,definitionSettings:e,rect:n,measureText:this.renderer.measureText,style:this.style})),i},beforeUpdate(t){t.settings&&(Hi(this.settings,t.settings),this.definitionSettings=t.settings.settings);const e=this.settings.text,n=this.definitionSettings.join;this.title=mf(e,n,this.scale)}};function vf(t,e){const n=t.settings.layout.dock,i=t.settings.settings.invert,r="top"===n||"bottom"===n,o=r?"width":"height",a=t.rect[o],s=t.chart.scroll(t.settings.scroll);let l;{let t=e[r?"x":"y"];i&&(t=a-t);const n=s.getState();l={startOffset:t,startScroll:n.start,swipe:!1};const o=t/a*(n.max-n.min)+n.min;o<n.start?l.startScroll=o:o>n.start+n.viewSize&&(l.startScroll=o-n.viewSize)}return{update:t=>{let e=t[r?"x":"y"];if(i&&(e=a-e),!l.swipe){if(Math.abs(l.startOffset-e)<=1)return;l.swipe=!0}const n=s.getState(),o=(e-l.startOffset)/a*(n.max-n.min),c=l.startScroll+o;s.moveTo(c)},end:t=>{let e=t[r?"x":"y"];i&&(e=a-e);const n=s.getState();if(l.swipe){const t=(e-l.startOffset)/a*(n.max-n.min),i=l.startScroll+t;s.moveTo(i)}else{const t=e/a*(n.max-n.min)+n.min-n.viewSize/2;s.moveTo(t)}}}}function bf(t,e){const n=e.element().getBoundingClientRect();return{x:t.center.x-n.left,y:t.center.y-n.top}}const wf={require:["chart","renderer"],on:{panStart(t){const e=bf(t,this.renderer),n={x:e.x-t.deltaX,y:e.y-t.deltaY};this.currentMove=vf(this,n),this.currentMove.update(e)},panMove(t){if(!this.currentMove)return;const e=bf(t,this.renderer);this.currentMove.update(e)},panEnd(t){if(!this.currentMove)return;const e=bf(t,this.renderer);this.currentMove.end(e),this.currentMove=null},panCancel(){this.currentMove=null},tap(t){const e=bf(t,this.renderer);vf(this,e).end(e)}},defaultSettings:{settings:{backgroundColor:"#eee",thumbColor:"#ccc",width:16}},preferredSize:function(t){const e=this.chart.scroll(this.settings.scroll).getState();if(e.viewSize>=e.max-e.min){return Math.max(t.width,t.height)}return this.settings.settings.width},render:function(t){const e=this.settings.layout.dock,n=this.settings.settings.invert,i="top"===e||"bottom"===e,r=i?"width":"height",o=this.rect[r],a=this.chart.scroll(this.settings.scroll).getState();let s=o*(a.start-a.min)/(a.max-a.min);const l=o*a.viewSize/(a.max-a.min);return n&&(s=o-s-l),t("div",{style:{position:"relative",width:"100%",height:"100%",background:this.settings.settings.backgroundColor,pointerEvents:"auto"}},[].concat(t("div",{class:"scroller",style:{position:"absolute",[i?"left":"top"]:"".concat(s,"px"),[i?"top":"left"]:"25%",[i?"height":"width"]:"50%",[r]:"".concat(Math.max(1,l),"px"),background:this.settings.settings.thumbColor}})))},renderer:"dom"};function Mf(t){let{h:e,isVertical:n,value:i,pos:r,align:o,borderHit:a,state:s,idx:l}=t;const c="end"!==o,u=c?{left:"0",top:"0"}:{right:"0",bottom:"0"};let h=0,d="100%",f="100%";return s.targetRect&&"start"===s.settings.bubbles.align?(d="".concat(s.targetRect.x+s.targetRect.width,"px"),f="".concat(s.targetRect.y+s.targetRect.height,"px")):s.targetRect&&"end"===s.settings.bubbles.align&&(h=n?s.targetRect.x:s.targetRect.y,d="".concat(s.rect.width-h,"px"),f="".concat(s.rect.height-h,"px")),c||(r-=a),e("div",{onmouseover(t){t.srcElement.children[0].style.backgroundColor="#000",t.srcElement.children[0].style[n?"height":"width"]="2px"},onmouseout(t){t.srcElement.children[0].style.backgroundColor=s.style.line.stroke,t.srcElement.children[0].style[n?"height":"width"]="1px"},"data-value":i,"data-key":[s.key,"edge",l].join("-"),style:{cursor:n?"ns-resize":"ew-resize",position:"absolute",left:"".concat(n?h:r,"px"),top:"".concat(n?r:h,"px"),height:n?"".concat(a,"px"):f,width:n?d:"".concat(a,"px"),pointerEvents:"auto"}},[e("div",{style:Hi({backgroundColor:s.style.line.stroke,position:"absolute",height:n?"".concat(1,"px"):"100%",width:n?"100%":"".concat(1,"px"),pointerEvents:"none"},u)})])}function kf(t){let{h:e,isVertical:n,label:i,otherValue:r,rangeIdx:o,idx:a,pos:s,align:l,state:c,value:u}=t;const h="end"!==l,d="outside"===c.settings.bubbles.placement;let f,p="none";n?(f=h?"left":"right",d&&(p=h?"translate(-100%, 0px)":"translate(100%, 0px)")):(f=h?"top":"bottom",d&&(p=h?"translate(0px, -100%)":"translate(0px, 100%)"));let g=c.edit&&c.edit.rangeIdx===o&&c.edit.bubbleIdx===a;const m={position:"relative",borderRadius:"".concat(c.style.bubble.borderRadius,"px"),border:"".concat(c.style.bubble.strokeWidth,"px solid ").concat(c.style.bubble.stroke),backgroundColor:c.style.bubble.fill,color:c.style.bubble.color,fontFamily:c.style.bubble.fontFamily,fontSize:c.style.bubble.fontSize,padding:"4px 8px",textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"150px",minWidth:"50px",minHeight:"1em",pointerEvents:"auto",transform:n?"translate(0,-50%)":"translate(-50%,0)",cursor:n?"ns-resize":"ew-resize"};let y=c.style.bubble.stroke;const x=g?e("input",{type:"text",value:u,style:Xi(Xi({},m),{},{textAlign:"start",textOverflow:"",fontSize:"13px"}),onkeyup(t){if("Enter"===t.key){t.preventDefault(),t.stopPropagation();const e=parseFloat(t.target.value);isNaN(e)?(y="rgba(230, 78, 78, 0.6)",t.target.style.border="".concat(c.style.bubble.strokeWidth,"px solid ").concat(y)):c.onEditConfirmed(o,e,r)}else"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),c.onEditCanceled())}}):e("div",{"data-key":[c.key,"bubble",o,a].join("-"),"data-other-value":r,"data-idx":o,"data-bidx":a,style:m},[i]);return e("div",{style:{position:"absolute",[f]:"0",[n?"top":"left"]:"".concat(s,"px"),transform:p}},[x])}function _f(t){let{h:e,isVertical:n,top:i,height:r,color:o,on:a,opacity:s}=t;return e("div",Hi({style:{backgroundColor:o,opacity:s,position:"absolute",left:n?0:"".concat(i,"px"),top:n?"".concat(i,"px"):0,height:n?"".concat(r,"px"):"100%",width:n?"100%":"".concat(r,"px"),pointerEvents:"auto"}},a),[])}function Sf(t){let{borderHit:e,els:n,isVertical:i,state:r,vStart:o,vEnd:a,idx:s}=t,l=0;r.targetRect&&(l=i?r.targetRect.y:r.targetRect.x);const c=!!r.scale,u=c?r.scale.norm(o)*r.size:o,h=c?r.scale.norm(a)*r.size:a,d=Math.abs(u-h),f=Math.min(u,h)+l,p=f+d;if(r.targetRect){const t=r.targetFillRect||r.targetRect,e=i?t.height:t.width,s=c?r.scale.norm(o)*e:o,l=c?r.scale.norm(a)*e:a,u=Math.abs(s-l),h=Math.min(s,l),d={h:r.h,isVertical:i,top:h,height:u,color:r.style.target.fill,opacity:r.style.target.opacity};r.style.target.opacity<.8&&(d.on={onmouseover(t){t.srcElement.style.opacity=r.style.target.opacity+.1},onmouseout(t){t.srcElement.style.opacity=r.style.target.opacity}}),n.push(r.h("div",{style:{position:"absolute",left:"".concat(t.x,"px"),top:"".concat(t.y,"px"),height:"".concat(t.height,"px"),width:"".concat(t.width,"px")}},[_f(d)]))}const g=u<h?o:a,m=u<h?a:o,[y,x]=c?r.scale.domain():[Math.min(o,a),Math.max(o,a)],v=g+1e-5>=y&&g-1e-5<=x,b=m-1e-5<=x&&m+1e-5>=y;v&&n.push(Mf({h:r.h,isVertical:i,borderHit:e,value:g,pos:f,align:"start",state:r,idx:s})),b&&n.push(Mf({h:r.h,isVertical:i,borderHit:e,value:m,pos:p,align:"end",state:r,idx:s}));const w=r.settings.bubbles;if(w&&w.show){const t={fontSize:w.fontSize,fontFamily:w.fontFamily,color:w.fill},e=[o,a];v&&n.push(kf({h:r.h,isVertical:i,align:w.align,style:t,rangeIdx:s,idx:0,otherValue:m,value:g,label:"".concat(r.format(g,e)),pos:f,state:r})),b&&n.push(kf({h:r.h,isVertical:i,align:w.align,style:t,rangeIdx:s,idx:1,otherValue:g,value:m,label:"".concat(r.format(m,e)),pos:p,state:r}))}}function Nf(t){const e=t.active.limitHigh-t.active.end,n=t.active.limitLow-t.active.start;let i=t.current-t.start;return i=i<0?Math.max(i,n):Math.min(i,e),i}function Rf(t){let e=[];const n=0===t.direction;if(Array.isArray(t.ranges)&&t.ranges.forEach(((i,r)=>{t.active&&r===t.active.idx||Sf({borderHit:5,els:e,isVertical:n,state:t,vStart:Math.min(i.min,i.max),vEnd:Math.max(i.min,i.max),idx:r})})),t.active){let i=t.start,r=t.current;if(-1!==t.active.idx)if("foo"===t.active.mode)i=Math.min(t.active.start,t.active.end),r=Math.max(t.active.start,t.active.end);else if("modify"===t.active.mode)i=Math.min(t.start,t.current),r=Math.max(t.start,t.current);else{const e=Nf(t);i=t.active.start+e,r=t.active.end+e}Sf({borderHit:5,els:e,isVertical:n,state:t,vStart:i,vEnd:r,idx:t.active.idx})}return e}function Af(t){return{min:t.scale.min(),max:t.scale.max()}}function Cf(t){return{min:0,max:t.direction?t.rect.width:t.rect.height}}function Df(t,e,n){let i,r,o=t.ranges,a=-1;for(i=0;i<o.length;i++){if(o[i].min<=e&&e<=o[i].max){a=i,n.min=i?o[i-1].max:n.min,n.max=i+1<o.length?o[i+1].min:n.max;break}if(e<o[i].min){n.max=o[i].min,n.min=i?o[i-1].max:n.min;break}}-1===a&&o.length&&i>=o.length&&(n.min=o[o.length-1].max),-1!==a&&(r={idx:a,start:o[a].min,end:o[a].max,limitLow:n.min,limitHigh:n.max,mode:"foo"}),t.active=r}function Of(t){t.renderer.render(Rf(t))}function zf(t,e){if(!e||!e.isActive())return[];const n=t.scale.data(),i=(n&&n.fields||[]).map((t=>t.id())),r=e.brushes().filter((t=>"range"===t.type&&-1!==i.indexOf(t.id)))[0];return r?r.brush.ranges():[]}function Ef(t,e){let n,i=1/0;const r=e.domain(),o=e.bandwidth()/2;for(let a=0;a<r.length;++a){const s=Math.abs(t-o-e(r[a]));s<i&&(i=s,n=r[a])}return n}function If(t,e){return Math.min(...t)<=Math.max(...e)&&Math.max(...t)>=Math.min(...e)}function Tf(t){return er(t.reduce(((t,e)=>(t.push(...tr(e.bounds)),t)),[]))}const Pf={require:["chart","settings","renderer"],defaultSettings:{settings:{bubbles:{show:!0,align:"start"}},style:{bubble:"$label-overlay",line:"$shape-guide--inverted",target:"$selection-area-target"}},renderer:"dom",on:{rangeStart(t){this.start(t)},rangeMove(t){this.move(t)},rangeEnd(t){this.end(t)},rangeClear(t){this.clear(t)},bubbleStart(t){this.bubbleStart(t)}},created(){this.state={key:this.settings.key||"brush-range"}},beforeRender(t){this.state.rect=t.size.computedInner},renderRanges(){this.state.started||(this.state.ranges=zf(this.state,this.state.brushInstance),this.state.active=null,Of(this.state))},render(t){const e=this.settings.settings;this.state.direction="vertical"===e.direction?0:1;const n=this.renderer.element().getBoundingClientRect(),i=this.state.rect[0===this.state.direction?"height":"width"];let r=gu(this.chart.scale(e.scale),i);const o=function(t){const e={targetRect:null,targetFillRect:null,scale:null,size:null},n=t.settings.settings,i=n.target&&(n.target.components||(n.target.component?[n.target.component]:[])).map((e=>t.chart.component(e))).filter((t=>!!t&&!!t.rect)),r=n.target&&n.target.selector?t.chart.findShapes(n.target.selector):[],o=n.target&&n.target.fillSelector?t.chart.findShapes(n.target.fillSelector):[];if(r.length>0){const i=Tf(r);if(e.size=i[0===t.state.direction?"height":"width"],e.scale=gu(t.chart.scale(n.scale),e.size),e.targetRect=i,o.length>0){const t=Tf(o);e.targetFillRect=t}}else if(i&&i.length>0){const n=i.slice(1).reduce(((t,e)=>({x0:Math.min(t.x0,e.rect.computedInner.x),y0:Math.min(t.y0,e.rect.computedInner.y),x1:Math.max(t.x1,e.rect.computedInner.x+e.rect.computedInner.width),y1:Math.max(t.y1,e.rect.computedInner.y+e.rect.computedInner.height)})),{x0:i[0].rect.computedInner.x,y0:i[0].rect.computedInner.y,x1:i[0].rect.computedInner.x+i[0].rect.computedInner.width,y1:i[0].rect.computedInner.y+i[0].rect.computedInner.height});e.targetRect={x:n.x0-t.state.rect.x,y:n.y0-t.state.rect.y,width:n.x1-n.x0,height:n.y1-n.y0}}return e}(this);if(r=o.scale?o.scale:r,this.state.targetRect=o.targetRect,this.state.targetFillRect=o.targetFillRect,this.state.size=null===o.size?i:o.size,this.state.settings=e,this.state.style=this.style,this.state.offset=n,this.state.brush="object"==typeof e.brush?e.brush.context:e.brush,this.state.brushInstance=this.chart.brush(this.state.brush),this.state.renderer=this.renderer,this.state.multi=!!e.multiple,this.state.h=t,this.state.onEditConfirmed=(t,e,n)=>{this.state.edit=null,function(t,e,n,i){let r=t.ranges.map((t=>({min:t.min,max:t.max})));const o=t.scale.min(),a=t.scale.max();r[e]={min:Math.max(o,Math.min(n,i)),max:Math.min(a,Math.max(n,i))},t.ranges[e]=Xi({},r[e]);const s=t.scale.data();s&&s.fields&&s.fields.forEach((e=>{t.fauxBrushInstance||t.brushInstance.setRange(e.id(),r)}))}(this.state,t,e,n),this.emit("bubbleEnd"),Of(this.state)},this.state.onEditCanceled=()=>{this.state.edit=null,Of(this.state)},this.state.cssCoord={offset:0===this.state.direction?"top":"left",coord:0===this.state.direction?"y":"x",pos:0===this.state.direction?"deltaY":"deltaX"},this.state.format="function"==typeof e.bubbles.label&&((t,n)=>e.bubbles.label.call(void 0,{datum:t,data:n,scale:r,resources:{scale:this.chart.scale,formatter:this.chart.formatter}})),{}.hasOwnProperty.call(r,"norm")){this.state.editable=!0,this.state.observeBrush="object"==typeof e.brush&&e.brush.observe,this.state.fauxBrushInstance=null,this.state.findValues=null,this.state.scale=r;const t=this.state.scale.data();!this.state.format&&t&&t.fields&&t.fields[0]&&(this.state.format=t.fields[0].formatter())}else this.state.editable=!1,this.state.scale=xc(),this.state.scale.data=r.data,this.state.format||(this.state.format=(t,e)=>If(r.range(),e)?function(t,e){const n=e.ticks(),i=e.domain().indexOf(Ef(t,e));return-1!==i?n[i].label:"-"}(t,r):"-"),this.state.fauxBrushInstance=nu(),this.state.findValues=t=>function(t,e){const n=e.domain(),i=e.range(),r=[];return t.forEach((t=>{if(!If(i,[t.min,t.max]))return;const o=n.indexOf(Ef(t.min,e)),a=n.indexOf(Ef(t.max,e));r.push.apply(r,n.slice(Math.min(o,a),Math.max(o,a)+1))})),r}(t,r);return this.state.ranges=zf(this.state,this.state.brushInstance),this.state.observeBrush||this.state.sourcedFromThisComponent?[Rf(this.state)]:[]},mounted(){this.state.observeBrush&&this.state.brushInstance&&this.state.brushInstance.on("update",this.renderRanges)},beforeDestroy(){this.state.observeBrush&&this.state.brushInstance&&this.state.brushInstance.removeListener("update",this.renderRanges)},start(t){!function(t){let{state:e,e:n,renderer:i,ranges:r,targetSize:o}=t;if(e.started)return;e.edit=null;const a=n.center.x-n.deltaX,s=n.center.y-n.deltaY;let l=document.elementFromPoint(a,s);i.element().contains(l)||(l=null);const c={started:!0};e.offset=Hi({},i.element().getBoundingClientRect());const u=a-e.offset.left,h=s-e.offset.top;e.offset.left+=e.targetRect?e.targetRect.x:0,e.offset.top+=e.targetRect?e.targetRect.y:0,e.ranges=r(e,e.fauxBrushInstance||e.brushInstance);const d=n.center[e.cssCoord.coord]-n[e.cssCoord.pos]-e.offset[e.cssCoord.offset],f=n.center[e.cssCoord.coord]-e.offset[e.cssCoord.offset];c.current=e.scale.normInvert(f/e.size),c.start=e.scale.normInvert(d/e.size);let p=e.ranges;const g=Af(e);let m,y,x=-1;if(l&&l.hasAttribute("data-idx"))x=parseInt(l.getAttribute("data-idx"),10),g.min=x>0?p[x-1].max:g.min,g.max=x+1<p.length?p[x+1].min:g.max;else{for(m=0;m<p.length;m++){if(p[m].min<=c.start&&c.start<=p[m].max){x=m,g.min=m?p[m-1].max:g.min,g.max=m+1<p.length?p[m+1].min:g.max;break}if(c.start<p[m].min){g.max=p[m].min,g.min=m?p[m-1].max:g.min;break}}-1===x&&p.length&&m>=p.length&&(g.min=p[p.length-1].max)}if(-1!==x||e.multi||(c.ranges=[],g.min=e.scale.min(),g.max=e.scale.max()),-1!==x)if(y={idx:x,start:p[x].min,end:p[x].max,limitLow:g.min,limitHigh:g.max,mode:"move"},l&&l.hasAttribute("data-other-value"))c.start=parseFloat(l.getAttribute("data-other-value")),y.mode="modify";else{let t=e.scale.norm(y.start)*e.size,n=e.scale.norm(y.end)*e.size;Math.abs(d-t)<=o?(c.start=y.end,y.mode="modify"):Math.abs(d-n)<=o&&(c.start=y.start,y.mode="modify")}else y={idx:-1,start:c.start,end:c.current,limitLow:g.min,limitHigh:g.max,mode:"current"};c.active=y,"modify"!==y.mode&&e.targetRect&&!hh(e.targetRect,{x:u,y:h})||Object.keys(c).forEach((t=>e[t]=c[t]))}({e:t,state:this.state,renderer:this.renderer,ranges:zf,targetSize:5})},end(){this.state.started&&(!function(t,e){t.started=!1,t.ranges=e(t,t.fauxBrushInstance||t.brushInstance);const n=Af(t);Df(t,t.current,n)}(this.state,zf),Of(this.state),this.state.sourcedFromThisComponent=!0,this.state.active=null)},move(t){this.state.started&&(!function(t,e){const n=(e.center[t.cssCoord.coord]-t.offset[t.cssCoord.offset])/t.size,i=t.scale.normInvert(n);t.current=Math.max(Math.min(i,t.active.limitHigh),t.active.limitLow)}(this.state,t),function(t){let e=t.ranges.map((t=>({min:t.min,max:t.max})));if(-1!==t.active.idx)if("modify"===t.active.mode)e[t.active.idx].min=Math.min(t.start,t.current),e[t.active.idx].max=Math.max(t.start,t.current);else{const n=Nf(t);e[t.active.idx].min+=n,e[t.active.idx].max+=n}else e.push({min:Math.min(t.start,t.current),max:Math.max(t.start,t.current)});const n=t.scale.data();n&&n.fields&&n.fields.forEach((n=>{if(t.fauxBrushInstance){let i=zf(t,t.fauxBrushInstance),r=t.findValues(i),o=t.findValues(e),a=o.filter((t=>-1===r.indexOf(t))),s=r.filter((t=>-1===o.indexOf(t))),l=a.map((t=>({key:n.id(),value:t}))),c=s.map((t=>({key:n.id(),value:t})));t.brushInstance.addAndRemoveValues(l,c),t.fauxBrushInstance.setRange(n.id(),e)}else t.brushInstance.setRange(n.id(),e)}))}(this.state),Of(this.state))},clear(){this.state.fauxBrushInstance&&this.state.fauxBrushInstance.clear(),this.state.renderer.render([]),this.state.started=!1,this.state.active=null,this.state.sourcedFromThisComponent=!1},bubbleStart(t){if(!this.state.editable)return;const e=t.srcEvent||t,n=e.target,i={rangeIdx:parseInt(n.getAttribute("data-idx"),10),bubbleIdx:parseInt(n.getAttribute("data-bidx"),10)};if(isNaN(i.rangeIdx)||JSON.stringify(i)===JSON.stringify(this.state.edit))return;this.state.edit=i,e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault();const r=n.parentNode;Of(this.state);const o=r.querySelector("input");o.focus(),o.select()}};function qf(t){t.renderer.render(Rf(t))}function Lf(t){return t.rc.ranges()}function jf(t,e){const n={x:t.direction?e.min+t.rect.x:t.rect.x,y:t.direction?t.rect.y:e.min+t.rect.y,width:t.direction?e.max-e.min:t.rect.width+t.rect.x,height:t.direction?t.rect.height+t.rect.y:e.max-e.min};return t.chart.shapesAt(n,t.settings.brush)}const Ff={require:["chart","settings","renderer"],defaultSettings:{settings:{bubbles:{show:!0,align:"start"}},style:{bubble:"$label-overlay",line:"$shape-guide--inverted",target:"$selection-area-target"}},renderer:"dom",on:{areaStart(t){this.start(t)},areaMove(t){this.move(t)},areaEnd(t){this.end(t)},areaClear(t){this.clear(t)}},created(){this.state={key:this.settings.key||"brush-area-dir"}},render(t){this.state.rect=this.rect;const e=this.settings.settings,n="vertical"===e.direction?0:1,i=this.state.rect[0===n?"height":"width"],r=this.renderer.element().getBoundingClientRect(),o=(e.target?e.target.components||[e.target.component]:[]).map((t=>this.chart.component(t))).filter((t=>!!t&&!!t.rect)),a=o[0]?o.slice(1).reduce(((t,e)=>({x0:Math.min(t.x0,e.rect.x),y0:Math.min(t.y0,e.rect.y),x1:Math.max(t.x1,e.rect.x+e.rect.width),y1:Math.max(t.y1,e.rect.y+e.rect.height)})),{x0:o[0].rect.x,y0:o[0].rect.y,x1:o[0].rect.x+o[0].rect.width,y1:o[0].rect.y+o[0].rect.height}):null;return this.state.targetRect=a?{x:a.x0-this.rect.x,y:a.y0-this.rect.y,width:a.x1-a.x0,height:a.y1-a.y0}:null,this.state.style=this.style,this.state.chart=this.chart,this.state.direction=n,this.state.settings=e,this.state.offset=r,this.state.rc=Hc(),this.state.renderer=this.renderer,this.state.multi=!!e.multiple,this.state.h=t,this.state.size=i,this.state.cssCoord={offset:0===this.state.direction?"top":"left",coord:0===this.state.direction?"y":"x",pos:0===this.state.direction?"deltaY":"deltaX",area:0===this.state.direction?"height":"width"},this.state.format=function(t,e){return function(t,e,n){const i=Math.min(...n),r=Math.max(...n),o={x:t.direction?i+t.rect.x:t.rect.x,y:t.direction?t.rect.y:i+t.rect.y,width:t.direction?r-i:t.rect.width+t.rect.x,height:t.direction?t.rect.height+t.rect.y:r-i},a=t.chart.shapesAt(o,t.settings.brush);if(0===a.length)return"-";const s=a.reduce(((n,r)=>{const o=n.bounds,a=r.bounds;return e===i?o[t.cssCoord.coord]<=a[t.cssCoord.coord]?n:r:o[t.cssCoord.coord]+o[t.cssCoord.area]>=a[t.cssCoord.coord]+a[t.cssCoord.area]?n:r})),l=t.settings.brush.components.reduce(((t,e)=>t.key===s.key?t:e));return"function"==typeof t.settings.bubbles.label?t.settings.bubbles.label(s.data):Array.isArray(l.data)&&l.data.length?s.data[l.data[0]].label:s.data&&s.data.label?s.data.label:"-"}(this,t,e)},[]},start(t){!function(t){let{state:e,e:n,renderer:i,ranges:r,targetSize:o}=t;if(e.started)return;const a=n.center.x-n.deltaX,s=n.center.y-n.deltaY;let l=document.elementFromPoint(a,s);i.element().contains(l)||(l=null);const c={started:!0};e.offset=i.element().getBoundingClientRect(),e.ranges=r(e);const u=a-e.offset.left,h=s-e.offset.top,d=n.center[e.cssCoord.coord]-n[e.cssCoord.pos]-e.offset[e.cssCoord.offset],f=n.center[e.cssCoord.coord]-e.offset[e.cssCoord.offset];let p=f,g=d;c.start=d,c.current=f;let m=e.ranges;const y=Cf(e);let x,v,b=-1;if(l&&l.hasAttribute("data-idx"))b=parseInt(l.getAttribute("data-idx"),10),y.min=b>0?m[b-1].max:y.min,y.max=b+1<m.length?m[b+1].min:y.max;else{for(x=0;x<m.length;x++){if(m[x].min<=g&&g<=m[x].max){b=x,y.min=x?m[x-1].max:y.min,y.max=x+1<m.length?m[x+1].min:y.max;break}if(g<m[x].min){y.max=m[x].min,y.min=x?m[x-1].max:y.min;break}}-1===b&&m.length&&x>=m.length&&(y.min=m[m.length-1].max)}if(-1!==b||e.multi||(c.ranges=[],y.min=0,y.max=e.direction?e.rect.width:e.rect.height),-1!==b)if(v={idx:b,start:m[b].min,end:m[b].max,limitLow:y.min,limitHigh:y.max,mode:"move"},l&&l.hasAttribute("data-other-value"))c.start=parseFloat(l.getAttribute("data-other-value")),v.mode="modify";else{let t=v.start,e=v.end;Math.abs(d-t)<=o?(c.start=v.end,v.mode="modify"):Math.abs(d-e)<=o&&(c.start=v.start,v.mode="modify")}else v={idx:-1,start:g,end:p,limitLow:y.min,limitHigh:y.max,mode:"current"};c.active=v,"modify"!==v.mode&&e.targetRect&&!hh(e.targetRect,{x:u,y:h})||Object.keys(c).forEach((t=>e[t]=c[t]))}({e:t,state:this.state,renderer:this.renderer,ranges:Lf,targetSize:5})},end(){this.state.started&&(!function(t,e){t.started=!1,t.ranges=e(t);const n=Cf(t);Df(t,t.current,n)}(this.state,Lf),qf(this.state))},move(t){this.state.started&&(!function(t,e){const n=e.center[t.cssCoord.coord]-t.offset[t.cssCoord.offset];t.current=Math.max(Math.min(n,t.active.limitHigh),t.active.limitLow)}(this.state,t),function(t){const e=t.ranges.map((t=>({min:t.min,max:t.max})));if(-1!==t.active.idx)if("modify"===t.active.mode)e[t.active.idx].min=Math.min(t.start,t.current),e[t.active.idx].max=Math.max(t.start,t.current);else{const n=Nf(t);e[t.active.idx].min=t.active.start+n,e[t.active.idx].max=t.active.end+n}else e.push({min:Math.min(t.start,t.current),max:Math.max(t.start,t.current)});t.rc.set(e);let n=[];e.forEach((e=>{n=[...n,...jf(t,e)]})),function(t,e){t.chart.brushFromShapes(e,t.settings.brush)}(t,n)}(this.state),qf(this.state))},clear(){this.state.rc&&this.state.rc.clear(),this.state.renderer.render([])}};function Bf(t){const e="vertical"===t.direction,n=t.rect[e?"height":"width"],i=t.rect[e?"width":"height"];return function(t){const e=t.brush;if(!e||!e.isActive())return[];const n=t.scale.data(),i=(n&&n.fields||[]).map((t=>t.id())),r=e.brushes().filter((t=>"range"===t.type&&-1!==i.indexOf(t.id)))[0];return r?r.brush.ranges():[]}(t).map((r=>{const o=t.scale(r.min)*n,a=t.scale(r.max)*n,s=Math.min(o,a),l=Math.abs(o-a);return{type:"rect",fill:t.fill,opacity:t.opacity,x:e?0:s,width:e?i:l,y:e?s:0,height:e?l:i}}))}function Vf(t,e,n,i){function r(){!function(t){t.renderer.render(Bf(t))}(t)}function o(){!function(t){t.renderer.render(Bf(t))}(t)}function a(){!function(t){t.renderer.render(Bf(t))}(t)}t.brush=e,e&&(e.on("start",r),e.on("update",o),e.on("end",a),t.start=r,t.update=o,t.end=a,t.brush=e,t.scale=n,t.renderer=i)}function $f(t){t.brush&&(t.brush.removeListener("start",t.start),t.brush.removeListener("update",t.update),t.brush.removeListener("end",t.end)),t.start=void 0,t.update=void 0,t.end=void 0,t.brush=void 0,t.scale=void 0,t.renderer=void 0}const Hf={require:["chart","settings","renderer"],defaultSettings:{settings:{}},preferredSize:()=>50,created(){this.state={}},render(){const t=this.settings.settings,e=this.chart.brush(t.brush),n=t.direction||"horizontal",i="horizontal"===n?this.rect.width:this.rect.height,r=gu(this.chart.scale(t.scale),i);return $f(this.state),Vf(this.state,e,r,this.renderer),this.state.rect=this.rect,this.state.fill=t.fill||"#ccc",this.state.opacity=void 0!==t.opacity?t.opacity:1,this.state.direction=n,Bf(this.state)},beforeDestroy(){$f(this.state)}};function Wf(t,e){const n=e.center.x,i=e.center.y;return{x:n-t.left,y:i-t.top}}function Uf(t,e,n){return Eu(t,e.points[0])<n.settings.snapIndicator.threshold**2}function Yf(t,e){null==t.path.d?t.path.d="M".concat(e.x," ").concat(e.y," "):t.path.d+="L".concat(e.x," ").concat(e.y," "),t.points.push(e)}function Xf(t){let{state:e,start:n=null,end:i=null}=t;null!==n&&(e.snapIndicator.x1=n.x,e.snapIndicator.y1=n.y),null!==i&&(e.snapIndicator.x2=i.x,e.snapIndicator.y2=i.y)}function Gf(t,e){t.snapIndicator.visible=e}const Kf={require:["chart","renderer","settings"],defaultSettings:{layout:{displayOrder:0},settings:{brush:{components:[]},snapIndicator:{threshold:75,strokeDasharray:"5, 5",stroke:"black",strokeWidth:2,opacity:.5},lasso:{fill:"transparent",stroke:"black",strokeWidth:2,opacity:.7,strokeDasharray:"20, 10"},startPoint:{r:10,fill:"green",stroke:"black",strokeWidth:1,opacity:1}}},on:{lassoStart(t){this.start(t)},lassoEnd(t){this.end(t)},lassoMove(t){this.move(t)},lassoCancel(){this.cancel()}},created(){this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}}},start(t){var e;this.state.active=!0,this.state.path={visible:!0,type:"path",d:null,fill:(e=this.settings.settings.lasso).fill,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,strokeDasharray:e.strokeDasharray,collider:{type:null}},this.state.snapIndicator=function(t){return{visible:!1,type:"line",x1:0,y1:0,x2:0,y2:0,strokeDasharray:t.strokeDasharray,stroke:t.stroke,strokeWidth:t.strokeWidth,opacity:t.opacity,collider:{type:null}}}(this.settings.settings.snapIndicator),this.state.startPoint=function(t){return{visible:!0,type:"circle",cx:0,cy:0,r:t.r,fill:t.fill,opacity:t.opacity,stroke:t.stroke,strokeWidth:t.strokeWidth,collider:{type:null}}}(this.settings.settings.startPoint),this.state.rendererBounds=this.renderer.element().getBoundingClientRect(),this.state.componentDelta=function(t,e){const n=t.element.getBoundingClientRect();return{x:e.left-n.left,y:e.top-n.top}}(this.chart,this.state.rendererBounds),this.state.brushConfig=this.settings.settings.brush.components.map((t=>({key:t.key,contexts:t.contexts||["lassoBrush"],data:t.data||[""],action:t.action||"add"})));const n=Wf(this.state.rendererBounds,t);Yf(this.state,n),Xf({state:this.state,start:n}),function(t,e){t.startPoint.cx=e.x,t.startPoint.cy=e.y}(this.state,n)},move(t){if(!this.state.active)return;const e=Wf(this.state.rendererBounds,t);Uf(e,this.state,this.settings)?Gf(this.state,!0):Gf(this.state,!1),Yf(this.state,e),Xf({state:this.state,end:e}),function(t,e){const n=[t.startPoint,t.path,t.snapIndicator].filter((t=>t.visible));e.render(n)}(this.state,this.renderer),function(t,e){if(t.active){const n=t.points[t.points.length-2],i=t.points[t.points.length-1];t.lineBrushShape.x1=n.x+t.componentDelta.x,t.lineBrushShape.y1=n.y+t.componentDelta.y,t.lineBrushShape.x2=i.x+t.componentDelta.x,t.lineBrushShape.y2=i.y+t.componentDelta.y;const r=e.shapesAt(t.lineBrushShape,{components:t.brushConfig});e.brushFromShapes(r,{components:t.brushConfig})}}(this.state,this.chart)},end(t){if(!this.state.active)return;Gf(this.state,!1);Uf(Wf(this.state.rendererBounds,t),this.state,this.settings)&&function(t,e){if(t.active){const n=t.componentDelta.x,i=t.componentDelta.y,r=t.points.map((t=>({x:t.x+n,y:t.y+i}))),o=e.shapesAt({vertices:r},{components:t.brushConfig});e.brushFromShapes(o,{components:t.brushConfig})}}(this.state,this.chart),this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}},this.renderer.render([])},cancel(){var t,e;this.state.active&&(t=this.state,e=this.chart,t.brushConfig.forEach((t=>{t.contexts.forEach((t=>{e.brush(t).end()}))})),this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}},this.renderer.render([]))},render(){}};function Zf(t,e,n,i,r){let o,a=0,s=e.length-1;for(;a<s;){let l=Math.floor((a+s)/2);o=r(e[l]),o[n]+o[i]<t[n]?a=l+1:s=l}return a}function Jf(t){let{orientation:e,targetNodes:n,labels:i,container:r}=t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zf;const a=[],s="v"===e?"x":"y",l="v"===e?"width":"height",c=t=>t.textBounds,u=t=>t.node.localBounds;return(t,e)=>{const{textBounds:h,node:d}=i[e];if(h[s]<r[s]||h[s]+h[l]>r[s]+r[l])return!1;for(let t=o(h,a,s,l,c);t<a.length;t++)if(ch(h,a[t].textBounds))return!1;const f=o(h,n,s,l,u),p=h[s]+h[l];for(let t=f;t<n.length;t++){const e=n[t].node;if(p<e.localBounds[s])break;if(ch(h,e.localBounds)&&d!==e)return!1}return a.push(i[e]),!0}}const Qf=4;function tp(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function ep(t){const e=typeof t;return("string"===e||"number"===e)&&""!==t}function np(t){return Xi(Xi({type:"rect",rx:2,ry:2,fill:t.backgroundColor},t.backgroundBounds),{},{data:"".concat(t.data," ").concat(t.text),rotation:t.transform&&t.transform.match(/rotate/gi)?"rotated":"horizontal"})}function ip(t,e,n){return n?t.width>=e.height:t.width>=e.width}function rp(t,e,n){return n?t.height>=e.width:t.height>=e.height}function op(t,e,n,i,r){let o,a;return"v"===t?(o=i||r||ip(e,n,!0),a=rp(e,n,!i)):(o=ip(e,n),a=r||rp(e,n,!1)),o&&a}function ap(t,e,n,i){return t+.5*e+(i-.5)*(e-n)-.5*n}function sp(t,e,n){const i={type:"text",text:e,maxWidth:n.rotate?t.height:t.width,x:0,y:t.y,dx:0,dy:0,fill:n.fill,anchor:n.rotate?"end":"start",baseline:"central",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily},r=n.textMetrics;if(!n.overflow&&!function(t,e,n){return ip(t,e,n.rotate)&&rp(t,e,n.rotate)}(t,r,n))return!1;const o=.5*r.height;return n.rotate?(i.x=ap(t.x,t.width,r.height,n.align)+o,i.y=ap(t.y,t.height,r.width,n.justify),i.transform="rotate(-90, ".concat(i.x+i.dx,", ").concat(i.y+i.dy,")")):(i.x=ap(t.x,t.width,r.width,n.align),i.y=ap(t.y,t.height,r.height,n.justify)+o),i}function lp(t){let{bar:e,view:n,direction:i,position:r,padding:o=Qf,measured:a}=t;const s={};if(Hi(s,e),r&&"inside"!==r)if("up"===i||"down"===i){const t=Math.max(0,Math.min(e.y,n.height)),o=Math.max(0,Math.min(e.y+e.height,n.height));"outside"===r&&"up"===i||"opposite"===r&&"down"===i?(s.y=0,s.height=t):("outside"===r&&"down"===i||"opposite"===r&&"up"===i)&&(s.y=o,s.height=n.height-o)}else{const t=Math.max(0,Math.min(e.x,n.width)),o=Math.max(0,Math.min(e.x+e.width,n.width));"outside"===r&&"left"===i||"opposite"===r&&"right"===i?(s.x=0,s.width=t):("outside"===r&&"right"===i||"opposite"===r&&"left"===i)&&(s.x=o,s.width=n.width-o)}else;return function(t,e){const n=Math.max(0,Math.min(t.y,e.height)),i=Math.max(0,Math.min(t.y+t.height,e.height)),r=Math.max(0,Math.min(t.x,e.width)),o=Math.max(0,Math.min(t.x+t.width,e.width));t.x=r,t.width=o-r,t.y=n,t.height=i-n}(s,n),function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{top:i=Qf,bottom:r=Qf,left:o=Qf,right:a=Qf}=n,s="function"==typeof o?o(e):o,l="function"==typeof a?a(e):a,c="function"==typeof i?i(e):i,u="function"==typeof r?r(e):r;t.x+=s,t.width-=s+l,t.y+=c,t.height-=c+u}(s,a,o),s}function cp(t){let e,n,i,r,o,{direction:a,fitsHorizontally:s,measured:l,node:c,orientation:u,placementSettings:h,rect:d}=t,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lp;const p=[],g="h"===u?"width":"height";for(o=0;o<h.length;o++)if(i=h[o],r=f({bar:c.localBounds,view:d,direction:a,position:i.position,padding:i.padding,measured:l}),p.push(r),e=!o||r[g]>e[g]?r:e,op(u,r,l,s,i.overflow)){n=r;break}return n||(n=e,o=p.indexOf(n)),i=h[o],{bounds:n,placement:i}}function up(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const{top:o=Qf,bottom:a=Qf,left:s=Qf,right:l=Qf}=r,c="function"==typeof s?s(e):s,u="function"==typeof l?l(e):l,h="function"==typeof o?o(e):o,d="function"==typeof a?a(e):a,f=t.x+t.dx,p=t.y+t.dy,g=n?Math.min(e.width,i.height):Math.min(e.height,i.width),m=n?Math.min(e.height,i.height):Math.min(e.width,i.width),y=.5*e.height,x=1e-9;return{x:(n?f-y:f)-c-x,y:(n?p:p-y)-h-x,width:m+(c+u)-x,height:g+(h+d)-x}}function hp(t){let{chart:e,targetNodes:n,rect:i,fitsHorizontally:r,collectiveOrientation:o}=t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cp,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sp,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Jf;const c=[],u={container:i,targetNodes:n,labels:[],orientation:o};let h,d,f,p,g,m,y,x,v,b,w,M,k,_;for(let t=0,l=n.length;t<l;t++){m=null,d=n[t],f=d.node,k=tp(f,e),v=d.direction,_="left"===v||"right"===v?"h":"v";for(let e=0;e<d.texts.length;e++){if(p=d.texts[e],!ep(p))continue;b=d.labelSettings[e],x=d.measurements[e],M=b.placements;const n=a({direction:v,fitsHorizontally:r,lblStngs:b,measured:x,node:f,orientation:_,placements:M,placementSettings:d.placementSettings[e],rect:i});if(m=n.bounds,w=n.placement,m&&w){g=w.justify;const e="function"==typeof b.linkData?b.linkData(k,t):void 0,n="function"==typeof w.overflow?w.overflow(k,t):w.overflow;"up"===v&&(g=1-g),"opposite"===w.position&&(g=1-g),"left"===v&&(g=1-g);const i=!("h"===o||r);if(h=s(m,p,{justify:"h"===_?w.align:g,align:"h"===_?g:w.align,fontSize:b.fontSize,fontFamily:b.fontFamily,textMetrics:x,rotate:i,overflow:!!n}),h){const n=up(h,x,i,m,w.padding);y="function"==typeof w.fill?w.fill(Xi(Xi({},k),{},{textBounds:n}),t):w.fill,h.fill=y,void 0!==e&&(h.data=e),"object"==typeof w.background&&(h.backgroundColor="function"==typeof w.background.fill?w.background.fill(Xi(Xi({},k),{},{textBounds:n}),t):w.background.fill,void 0!==h.backgroundColor&&(h.backgroundBounds=up(h,x,i,m,w.background.padding))),c.push(h),u.labels.push({node:f,textBounds:n})}}}}const S=c.filter(l(u));return[...S.filter((t=>void 0!==t.backgroundBounds)).map(np),...S]}function dp(t){const e=2*Math.PI;return(t%e+e)%e}function fp(t,e){t.x+=e,t.width-=2*e,t.y+=e,t.height-=2*e}function pp(t){return{x:t.x,y:t.y-t.height/2,width:t.width,height:t.height}}function gp(t,e,n){let{x:i,y:r}=e;if(i*i+r*r>t*t)return null;let o=Math.sin(n),a=Math.cos(n),s=i*a-r*o,l=t*t-s*s;if(l<0)return null;let c=Math.sqrt(l);return{x:s*a+o*c,y:-s*o+a*c}}function mp(t){let e,n,{radius:i,size:r,angle:o}=t,{width:a,height:s}=r,l={x:a/2,y:s/2};switch(Math.floor(o/(Math.PI/2))){case 0:if(e=gp(i,l,o),!e)return null;e.y*=-1,n={x:-a,y:0};break;case 1:if(e=gp(i,l,Math.PI-o),!e)return null;n={x:-a,y:-s};break;case 2:if(e=gp(i,l,o-Math.PI),!e)return null;e.x*=-1,n={x:0,y:-s};break;case 3:if(e=gp(i,l,2*Math.PI-o),!e)return null;e.x*=-1,e.y*=-1,n={x:0,y:0};break;default:throw new Error("invalid angle")}return{x:e.x+n.x,y:e.y+n.y,width:a,height:s}}function yp(t){let{slice:e,measured:n,padding:i}=t,{start:r,end:o,innerRadius:a,outerRadius:s}=e,l=s-a-2*i,c=o-r;if(c<Math.PI){let t=(n.height/2+i)/Math.tan(c/2);t>a&&(l=s-t-2*i)}if(l<0||l<n.minReqWidth)return null;const u=dp((r+o)/2);let h=s-i,d={x:Math.sin(u)*h,y:-Math.cos(u)*h,width:l,height:n.height};return u<Math.PI?(d.angle=u-Math.PI/2,d.anchor="end"):(d.angle=u+Math.PI/2,d.anchor="start"),d}function xp(t){let{context:e,node:n,bounds:i}=t;let{start:r,end:o}=n.desc.slice;const a=dp((r+o)/2);switch(Math.floor(a/(Math.PI/2))){case 0:e.q1maxY=i.y-2,void 0===e.q2minY&&(e.q2minY=i.y+i.height+2);break;case 1:e.q2minY=i.y+i.height+2;break;case 2:e.q3minY=i.y+i.height+2;break;case 3:e.q4maxY=i.y-2,void 0===e.q3minY&&(e.q3minY=i.y+i.height+2)}}function vp(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function bp(t,e,n){const i={type:"text",text:e,maxWidth:t.width,x:t.x,y:t.y+("top"===t.baseline?t.height/2:0),fill:n.fill,anchor:t.anchor||"start",baseline:"middle",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily};if(!isNaN(t.angle)){let e=t.angle*(360/(2*Math.PI));i.transform="rotate(".concat(e,", ").concat(i.x,", ").concat(i.y,")")}return i}function wp(t){let e,n,{slice:i,direction:r,position:o,padding:a,measured:s,view:l,context:c,store:u}=t,{start:h,end:d,innerRadius:f,offset:p}=i;switch(o){case"into":e="rotate"===r?yp({slice:i,measured:s,padding:a}):function(t){let{slice:e,padding:n,measured:i}=t,{start:r,end:o,innerRadius:a,outerRadius:s}=e;const l=dp((r+o)/2);let c=mp({radius:s,size:{width:i.width+2*n+1,height:i.height+2*n},angle:l});return c?(c.baseline="top",dh(c,{x1:0,y1:0,x2:Math.sin(r)*s,y2:-Math.cos(r)*s})||dh(c,{x1:0,y1:0,x2:Math.sin(o)*s,y2:-Math.cos(o)*s})||ih({cx:0,cy:0,r:a},c)?null:(fp(c,n),c)):null}({slice:i,measured:s,padding:a});break;case"inside":n={start:h,end:d,innerRadius:0,outerRadius:f},e="rotate"===r?yp({slice:n,measured:s,padding:a}):function(t){let{slice:e,padding:n,measured:i,store:r}=t;const{start:o,end:a,outerRadius:s}=e,l=dp((o+a)/2);let c=mp({radius:s,size:{width:i.width+2*n+1,height:i.height+2*n},angle:l});return c?(c.baseline="top",fp(c,n),r.insideLabelBounds.some((t=>ch(t,c)))?null:(r.insideLabelBounds.push({x:c.x-4,y:c.y,width:c.width+8,height:c.height}),c)):null}({slice:n,measured:s,padding:a,store:u});break;case"outside":e="rotate"===r?function(t){let{slice:e,measured:n,padding:i,view:r}=t,{start:o,end:a,outerRadius:s,offset:l}=e,c=s+i,u=a-o;if(u<Math.PI&&(n.height/2+i)/Math.tan(u/2)>c)return null;const h=dp((o+a)/2);let d=Math.sin(h)*c,f=-Math.cos(h)*c,p=n.width+1,g=h%Math.PI;if(g>Math.PI/2&&(g=Math.PI-g),Math.cos(g)>.001){let t=f<0?r.y:r.y+r.height,e=Math.abs(t-l.y)/Math.cos(g)-Math.tan(g)*(n.height/2)-2*i-s;e<p&&(p=e)}if(Math.sin(g)>.001){let t=d<0?r.x:r.x+r.width,e=Math.abs(t-l.x)/Math.sin(g)-n.height/2/Math.tan(g)-2*i-s;e<p&&(p=e)}if(p<=0||p<n.minReqWidth)return null;let m={x:d,y:f,width:p,height:n.height};return h<Math.PI?(m.angle=h-Math.PI/2,m.anchor="start"):(m.angle=h+Math.PI/2,m.anchor="end"),m}({slice:i,measured:s,padding:a,view:l}):function(t){let{slice:e,measured:n,padding:i,view:r,context:o}=t,{start:a,end:s,outerRadius:l,offset:c}=e;const u=dp((a+s)/2);if(function(t,e,n){switch(e){case 0:return t.q1maxY<0;case 1:return t.q2minY>n.height;case 2:return t.q3minY>n.height;case 3:return t.q4maxY<0;default:return!0}}(o,Math.floor(u/(Math.PI/2)),r))return null;let h=l+i+n.height/2,d=Math.sin(u)*h,f=-Math.cos(u)*h,p=n.width+1;if(u<Math.PI){let t=Math.abs(r.x+r.width-(d+c.x));t<p&&(p=t)}else{let t=Math.abs(r.x-(d+c.x));t<p&&(p=t)}if(p<n.minReqWidth)return null;let g={x:d,y:f,width:p,height:n.height};return u<Math.PI?g.anchor="start":g.anchor="end",g}({slice:i,measured:s,padding:a,view:l,context:c});break;default:throw new Error("not implemented")}return e&&(e.x+=p.x,e.y+=p.y,"outside"===o&&"rotate"!==r&&function(t,e,n){const{start:i,end:r,offset:o,outerRadius:a}=n,s=dp((i+r)/2);switch(Math.floor(s/(Math.PI/2))){case 0:if(void 0!==e.q1maxY){let n=Math.min(t.y,e.q1maxY-t.height),i=t.y-n;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x-2,y1:t.y+2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 1:if(void 0!==e.q2minY){let n=Math.max(t.y,e.q2minY),i=n-t.y;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x-2,y1:t.y-2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 2:if(void 0!==e.q3minY){let n=Math.max(t.y,e.q3minY),i=n-t.y;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x+2,y1:t.y-2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 3:if(void 0!==e.q4maxY){let n=Math.min(t.y,e.q4maxY-t.height),i=t.y-n;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x+2,y1:t.y+2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}}}(e,c,i)),e}function Mp(t){let{context:e,direction:n,measured:i,node:r,placementSettings:o,rect:a,store:s}=t,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wp;for(let t=0;t<o.length;t++){let c=o[t],u=l({context:e,slice:r.desc.slice,view:a,direction:n,position:c.position,measured:i,padding:c.padding,store:s});if(u)return{bounds:u,placement:c}}return{bounds:null,placement:null}}function kp(t,e,n){const i=e.fontFamily,r="".concat(e.fontSize,"px"),o=n.measureText({text:t,fontFamily:i,fontSize:r});return o.minReqWidth=Math.min(o.width,n.measureText({text:"".concat(t[0],"…"),fontFamily:i,fontSize:r}).width),o}const _p=/\n+|\r+|\r\n/,Sp=/\s/,Np=/[a-zA-Z\u00C0-\u00F6\u00F8-\u00FF\u00AD]/;function Rp(t){return"string"==typeof t?-1!==t.search(_p):-1!==String(t).search(_p)}function Ap(t){return-1!==t.search(Sp)}function Cp(t){return-1!==t.search(Np)}function Dp(t,e,n){return Math.max(e,Math.min(n,t))}function Op(){let{string:t,separator:e="",reverse:n=!1,measureText:i=t=>({width:t.length,height:1}),mandatoryBreakIdentifiers:r=[Rp],noBreakAllowedIdentifiers:o=[],suppressIdentifier:a=[Ap,Rp,t=>""===t],hyphenationIdentifiers:s=[Cp]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=String(t).split(e);!function(t){""===t[0]&&t.shift(),""===t[t.length-1]&&t.pop()}(l);const c=l.length,u=n?t=>t>=0:t=>t<c;let h=n?c:-1;function d(t){const e=Dp(t,0,c-1),n=l[e],u=i(n),h=function(t,e,n,i,r){return i.some((i=>i(t,e,n)))?1:r.some((i=>i(t,e,n)))?0:2}(n,e,l,r,o);return{index:e,value:n,breakOpportunity:h,suppress:a.some((t=>t(n,e,l))),hyphenation:s.some((t=>t(n,e,l))),width:u.width,height:u.height,done:!1}}return{next:function(t){return isNaN(t)?n?h--:h++:h=Dp(t,0,c-1),u(h)?d(h):{done:!0}},peek:d,length:c}}const zp="…",Ep=/^\s*\d+(\.\d+)?px\s*$/i;function Ip(t){return"string"===typeof t&&Ep.test(t)}function Tp(t){const e=t["font-size"]||t.fontSize;return Ip(e)?parseFloat(e)*Math.max(isNaN(t.lineHeight)?1.2:t.lineHeight,0):19.2}function Pp(t){const e=t.maxHeight,n=Math.max(t.maxLines,1)||1/0;if(isNaN(e))return n;const i=Tp(t);return Math.max(1,Math.min(Math.floor(e/i),n))}function qp(t,e){return{lines:[],line:"",width:0,maxLines:Pp(t),maxWidth:t.maxWidth,hyphens:{enabled:"auto"===t.hyphens,char:"‐",metrics:e("‐")}}}function Lp(t){t.lines.push(t.line),t.line="",t.width=0}function jp(t,e){t.line+=e.value,t.width+=e.width}function Fp(t,e,n){if(e.width>t.maxWidth)return e;const i=e.index;for(let r=1;r<5;r++){const o=n.peek(e.index-1);if(!e.hyphenation||!o.hyphenation||0===e.index)return e;if(t.width+t.hyphens.metrics.width<=t.maxWidth)return t.line+=t.hyphens.char,e;if(1===t.line.length)return e;e=n.next(i-r),t.line=t.line.slice(0,-1),t.width-=e.width}return e}function Bp(t,e,n){const i=Op({string:e.value,measureText:n});for(;t.lines.length<t.maxLines;){let e=i.next();if(e.done)break;t.width+e.width>t.maxWidth&&2===e.breakOpportunity&&t.line.length>0?(e=t.hyphens.enabled?Fp(t,e,i):e,Lp(t),jp(t,e)):jp(t,e)}}function Vp(t,e){const n=Op({string:t.text,separator:"",measureText:e,noBreakAllowedIdentifiers:[(t,e)=>0===e]}),i=qp(t,e);let r=!0;for(;i.lines.length<i.maxLines;){let t=n.next();if(t.done){Lp(i),r=!1;break}1===t.breakOpportunity?Lp(i):i.width+t.width>i.maxWidth&&2===t.breakOpportunity?t.suppress?i.width+=t.width:(t=i.hyphens.enabled?Fp(i,t,n):t,Lp(i),jp(i,t)):jp(i,t)}return{lines:i.lines,reduced:r}}function $p(t,e){const n=Op({string:t.text,separator:/(\s|-|\u2010)/,measureText:e}),i=qp(t,e);let r=!0;for(;i.lines.length<i.maxLines;){let t=n.next();if(t.done){Lp(i),r=!1;break}1===t.breakOpportunity?Lp(i):i.width+t.width>i.maxWidth&&2===t.breakOpportunity?t.suppress?Lp(i):t.width>i.maxWidth?Bp(i,t,e):(Lp(i),jp(i,t)):jp(i,t)}return{lines:i.lines,reduced:r}}function Hp(t){return{"break-all":Vp,"break-word":$p}[t.wordBreak]}function Wp(t){return e=>{const n=e.node;if(function(t){return"text"===t.type&&!t._lineBreak}(n)){const i=Hp(n);if(!i)return;const r=t(n);if(r.width>n.maxWidth||Rp(n.text)){const o=(Tp(n)-r.height)/2,a=i(n,function(t,e){return n=>e({text:n,fontSize:t.fontSize,fontFamily:t.fontFamily})}(n,t));e.node=function(t,e,n,i){const r={type:"container",children:[]};void 0!==e.id&&(r.id=e.id);let o=0;return t.lines.forEach(((a,s)=>{const l=Hi({},e);l.text=a,l._lineBreak=!0,o+=n,t.reduced&&s===t.lines.length-1?l.text+=zp:delete l.maxWidth,l.dy=isNaN(l.dy)?o:l.dy+o,o+=i,o+=n,r.children.push(l)})),r}(a,n,o,r.height)}}}}function Up(t,e){let{text:n,"font-size":i,"font-family":r,maxWidth:o}=t;if(n="string"==typeof n?n:"".concat(n),void 0===o)return n;let a=e({text:n,fontSize:i,fontFamily:r}).width;if(a<=o)return n;let s=0,l=n.length-1;for(;s<=l;){let t=Math.floor((s+l)/2);a=e({text:n.substr(0,t)+zp,fontSize:i,fontFamily:r}).width,a<=o?s=t+1:l=t-1}return n.substr(0,l)+zp}function Yp(t){const e=t.baseline||t["dominant-baseline"];let n=0;const i=parseInt(t.fontSize||t["font-size"],10)||0;switch(e){case"hanging":n=.75*i;break;case"text-before-edge":n=.85*i;break;case"middle":n=.25*i;break;case"central":n=.35*i;break;case"mathemetical":n=i/2;break;case"text-after-edge":case"ideographic":n=.2*-i;break;default:n=0}return n}const Xp={},Gp={},Kp={fontSize:void 0,fontFamily:void 0};let Zp;function Jp(t,e){return!t&&!e||t===e}function Qp(t){let{text:e,fontWeight:n,fontSize:i,fontFamily:r}=t;const o="".concat(e," ").concat(n," ").concat(i," ").concat(r);return"number"!=typeof Gp[o]&&(Zp=Zp||document.createElement("canvas").getContext("2d"),function(t){let{fontWeight:e,fontSize:n,fontFamily:i}=t;Jp(Kp.fontWeight,e)&&Jp(Kp.fontSize,n)&&Jp(Kp.fontFamily,i)||(Zp.font=[e,n,i].filter((t=>!!t)).join(" "),Kp.fontWeight=e,Kp.fontSize=n,Kp.fontFamily=i)}({fontWeight:n,fontSize:i,fontFamily:r}),Gp[o]=Zp.measureText(e).width),Gp[o]}function tg(t){return"number"!=typeof Xp[t]&&(Xp[t]=function(t){if(Ip(t)){const e=parseFloat(t);return e+4*Math.ceil((e+1e-12)/24)}return 16}(t)),Xp[t]}function eg(t){let{text:e,fontWeight:n,fontSize:i,fontFamily:r}=t;return{width:Qp({text:e,fontWeight:n,fontSize:i,fontFamily:r}),height:tg(i)}}function ng(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eg;const n=t["font-size"]||t.fontSize,i=t["font-family"]||t.fontFamily,r=e({text:t.text,fontFamily:i,fontSize:n}),o=Math.min(t.maxWidth||r.width,r.width),a=t.x||0,s=t.y||0,l=t.dx||0,c={x:0,y:s+((t.dy||0)+Yp(t))-.75*r.height,width:o,height:r.height},u=t["text-anchor"]||t.anchor;return c.x="middle"===u?a+l-o/2:"end"===u?a+l-o:a+l,c}function ig(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eg;const n=Hp(t),i=t["font-size"]||t.fontSize,r=t["font-family"]||t.fontFamily,o=e({text:t.text,fontFamily:r,fontSize:i});if(n&&(o.width>t.maxWidth||Rp(t.text))){const o=n(t,(t=>e({text:t,fontFamily:r,fontSize:i}))),a=Hi({},t);let s=0,l="";for(let t=0,n=o.lines.length;t<n;t++){let a=o.lines[t];a+=t===n-1&&o.reduced?zp:"";const c=e({text:a,fontSize:i,fontFamily:r}).width;c>=s&&(s=c,l=a)}a.text=l;const c=ng(a,e);return c.height=Tp(t)*o.lines.length,c}return ng(t,e)}function rg(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function og(t,e,n){const i={type:"text",text:e,maxWidth:t.width,x:0,y:t.y,dx:0,dy:0,fill:n.fill,anchor:"start",baseline:"alphabetical",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily},r=n.textMetrics;if(t.width<n.fontSize)return!1;const o=Math.max(0,t.width-r.width);return i.x=t.x+n.align*o,i.y=t.y+r.height/1.2,i}function ag(t){let{cx:e,cy:n,r:i}=t;return{type:"circle",bounds:{cx:e,cy:n,r:i}}}function sg(t){return t.desc&&t.desc.slice?function(t){let{start:e,end:n,innerRadius:i,outerRadius:r,offset:o}=t;if(Math.abs(e+2*Math.PI-n)>1e-12)return{type:null,bounds:null};let a=0!==i?i:r;return ag({cx:o.x,cy:o.y,r:a})}(t.desc.slice):"circle"===t.type?ag(t.attrs):"rect"===t.type?{type:"rect",bounds:t.bounds}:{type:null,bounds:null}}var lg={bar:function(t){let{settings:e,chart:n,nodes:i,rect:r,renderer:o,style:a}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hp;const l=Hi({fontSize:12,fontFamily:"Arial",align:.5,justify:0,fill:"#333"},a.label);l.fontSize=parseInt(l.fontSize,10);const c=e.labels.map((t=>Hi({},l,e,t))),u=e.labels.map((t=>t.placements.map((n=>Hi({},l,e,t,n))))),{fitsHorizontally:h,hasHorizontalDirection:d,targetNodes:f}=function(t){let{nodes:e,rect:n,chart:i,labelSettings:r,placementSettings:o,settings:a,renderer:s}=t;const l={},c=[];let u,h,d,f,p,g,m,y=!0,x=!1;for(let t=0;t<e.length;t++){if(h=e[t],f=h.localBounds,!ch(f,n))continue;let v=tp(h,i);u={node:h,texts:[],measurements:[],labelSettings:[],placementSettings:[]};for(let e=0;e<r.length;e++)g=r[e],d="function"==typeof g.label?g.label(v,t):void 0,ep(d)&&(m="function"==typeof a.direction?a.direction(v,t):a.direction||"up",x=x||"left"===m||"right"===m,l.fontFamily=g.fontFamily,l.fontSize="".concat(g.fontSize,"px"),l.text=d,p=s.measureText(l),u.measurements.push(p),u.texts.push(d),u.labelSettings.push(g),u.placementSettings.push(o[e]),u.direction=m,y=y&&p.width<=f.width-2*Qf);c.push(u)}return{targetNodes:c,fitsHorizontally:y,hasHorizontalDirection:x}}({nodes:i,chart:n,renderer:o,settings:e,rect:r,labelSettings:c,placementSettings:u}),p=function(t){let{orientation:e="auto",defaultOrientation:n="h"}=t;switch(e.toLocaleLowerCase()){case"vertical":return"v";case"horizontal":return"h";default:return n}}({orientation:e.orientation,defaultOrientation:d?"h":"v"}),g="h"===p?"y":"x",m="h"===p?"height":"width";return f.sort(((t,e)=>t.node.localBounds[g]+t.node.localBounds[m]-(e.node.localBounds[g]+e.node.localBounds[m]))),s({chart:n,targetNodes:f,stngs:e,rect:r,fitsHorizontally:h,collectiveOrientation:p})},slice:function(t){let{settings:e,chart:n,nodes:i,rect:r,renderer:o,style:a}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mp,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bp;const c=Hi({fontSize:12,fontFamily:"Arial",fill:"#333",padding:4,position:"into"},a.label);c.fontSize=parseInt(c.fontSize,10);const u=e.labels.map((t=>Hi({},c,e,t))),h=e.labels.map((t=>t.placements.map((n=>Hi({},c,e,t,n))))),d=[],f={insideLabelBounds:[]};i=function(t){const e=[],n=[],i=[],r=[];for(let o=0;o<t.length;++o){const{start:a,end:s}=t[o].desc.slice,l=dp((a+s)/2);switch(Math.floor(l/(Math.PI/2))){case 0:e.push(t[o]);break;case 1:n.push(t[o]);break;case 2:i.push(t[o]);break;case 3:r.push(t[o])}}const o=(t,e)=>dp((t.desc.slice.start+t.desc.slice.end)/2)-dp((e.desc.slice.start+e.desc.slice.end)/2),a=(t,e)=>o(e,t);return e.sort(a),n.sort(o),i.sort(a),r.sort(o),e.concat(n,r,i)}(i);const p={};for(let t=0,e=i.length;t<e;t++){const e=i[t],a=vp(e,n);for(let n=0;n<u.length;n++){const i=u[n],c="function"==typeof i.label?i.label(a,t):"";if(!c)continue;const g="function"==typeof i.direction?i.direction(a,t):i.direction||"horizontal",m="function"==typeof i.linkData?i.linkData(a,t):void 0,y=kp(c,i,o),x=s({context:p,direction:g,lblStngs:i,measured:y,node:e,placementSettings:h[n],rect:r,store:f}),v=x.bounds,b=x.placement;if(v&&b){if("outside"===b.position&&"rotate"!==g){xp({context:p,node:e,bounds:v});if(!Gu(pp(v),r))continue}const n="function"==typeof b.fill?b.fill(a,t):b.fill,o=l(v,c,{fill:n,fontSize:i.fontSize,fontFamily:i.fontFamily,textMetrics:y});o&&(void 0!==m&&(o.data=m),d.push(o),v.line&&(v.line.stroke=n,d.push(v.line)))}}}return d},rows:function(t){let{settings:e,chart:n,nodes:i,renderer:r,style:o}=t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:og;const s=Hi({fontSize:12,fontFamily:"Arial",fill:"#333",padding:4,align:.5,justify:.5},o.label);s.fontSize=parseInt(s.fontSize,10);const l=Hi({},s,e),c=e.labels.map((t=>Hi({},l,t))),u={},h=[];for(let t=0,e=i.length;t<e;t++){let e=i[t],o=rg(e,n),{type:s,bounds:d}=sg(e);if(!d)continue;let f,p=0,g=[],m=[],y="circle"===s?2*d.r*.9:d.height;for(p+=l.padding,f=0;f<c.length;f++){let e=c[f],n="function"==typeof e.label?e.label(o,t):"";u.fontFamily=e.fontFamily,u.fontSize="".concat(e.fontSize,"px"),u.text=n;let i=r.measureText(u);if(p+=i.height+e.padding,p>y)break;m.push(n),g.push(i)}const x=f,v=Math.max(0,y-p);let b;for(b="circle"===s?d.cy-.9*d.r:d.y,b+=l.justify*v+l.padding,f=0;f<x;f++){let e,n=c[f];if("circle"===s){let t=Math.max(Math.abs(b-d.cy),Math.abs(b+g[f].height-d.cy)),n=Math.sqrt(d.r*d.r-t*t);e={x:d.cx-n+l.padding,y:b,width:2*n-2*l.padding,height:g[f].height}}else e={x:d.x+l.padding,y:b,width:d.width-2*l.padding,height:g[f].height};b+=g[f].height+l.padding;let i="function"==typeof n.fill?n.fill(o,t):n.fill;const u="function"==typeof n.linkData?n.linkData(o,t):void 0;let p=a(e,m[f],{fill:i,align:n.align,fontSize:n.fontSize,fontFamily:n.fontFamily,textMetrics:g[f]});if(p){if(p.text&&p.text!==zp){const t=Up(p,r.measureText);if(zp===t)continue;p.ellipsed=t}void 0!==u&&(p.data=u),h.push(p)}}}return h}};const cg={require:["chart","renderer","settings"],defaultSettings:{settings:{},style:{label:"$label"}},render(){const t=this.settings.settings,e=[];return(t.sources||[]).forEach((t=>{t.strategy&&lg[t.strategy.type]&&t.component&&e.push(...function(t,e){let{chart:n,source:i,rect:r,renderer:o,style:a}=t;if(!n.component(i.component))return[];const s=n.findShapes(i.selector).filter((t=>t.key===i.component));return e({chart:n,settings:i.strategy.settings,nodes:s,rect:{x:0,y:0,width:r.width,height:r.height},renderer:o,style:a})}({chart:this.chart,rect:this.rect,renderer:this.renderer,source:t,style:this.style},lg[t.strategy.type]))})),e}};const ug={layout:{size:1,direction:"ltr",scrollOffset:0},item:{show:!0,justify:.5,align:.5,label:{fontSize:"12px",fontFamily:"Arial",fill:"#595959",wordBreak:"none",maxLines:2,maxWidth:136,lineHeight:1.2},shape:{type:"square",size:12}},title:{show:!0,text:void 0,anchor:"start",fontSize:"16px",fontFamily:"Arial",fill:"#595959",wordBreak:"none",maxLines:2,maxWidth:156,lineHeight:1.25},navigation:{button:{class:void 0,content:void 0,tabIndex:void 0},disabled:!1}};function hg(t){let{x:e=0,y:n,item:i,globalMetrics:r,createSymbol:o,direction:a="ltr"}=t,s=i.label.displayObject,l=i.label.bounds,c=i.symbol.meta;const u="rtl"===a;let h={x:u?e+r.maxLabelBounds.width:e+r.maxSymbolSize+r.spacing,y:n,width:r.maxLabelBounds.width,height:Math.max(r.maxSymbolSize,r.maxLabelBounds.height)},d=function(t,e,n){const i=Math.max(0,t.width-e),r=Math.max(0,t.height-e);return{x:t.x+e/2+n.align*i,y:t.y+e/2+n.justify*r}}({x:u?e+r.maxLabelBounds.width+r.spacing:e,y:n,width:r.maxSymbolSize,height:h.height},c.size,{align:void 0===c.align?.5:c.align,justify:void 0===c.justify?.5:c.justify});const f=o(Hi({},c,d));return delete f.collider,s.anchor=u?"end":"start",function(t,e,n){const i=n.textMetrics;if(t.height<i.height)return!1;const r=Math.max(0,t.width-i.width);e.baseline="text-before-edge";const o=Math.max(0,t.height-i.height);e.x=t.x+n.align*r,e.y=t.y+n.justify*o+.175*parseInt(e.fontSize,10)}(h,s,{textMetrics:l,fontSize:parseInt(s.fontSize,10),align:0,justify:.5}),{item:{type:"container",data:i.label.displayObject.data,children:[f,s],collider:{type:"rect",x:e,y:n,width:r.maxItemBounds.width,height:r.maxItemBounds.height}},metrics:h}}function dg(t,e){const n=t.items.length,i=Math.ceil(n/e),r="horizontal"===t.layout.orientation?"width":"height",o="width"===r?"horizontal":"vertical";return t.globalMetrics.maxItemBounds[r]*i+(i-1)*t.layout.margin[o]}function fg(t,e){let n,i,r,o,{onScroll:a=()=>{}}=e,s=null,l=0;const c={itemize:e=>{n=function(t,e){let n,i,{resolved:r,dock:o}=t,a=[],s=r.items.items,l=r.symbols.items,c=r.labels.items,u=0,h=0,d=0;for(let t=0;t<s.length;t++){if(!1===s[t].show)continue;const r=void 0!==c[t].text?c[t].text:c[t].data.label||"";n=Hi({},c[t],{type:"text",fontSize:"".concat(parseInt(c[t].fontSize,10),"px"),text:r,title:r}),i={symbol:{meta:l[t]},label:{displayObject:n,bounds:e.textBounds(n)}},a.push(i),u=Math.max(l[t].size,u),h=Math.max(i.label.bounds.width,h),d=Math.max(i.label.bounds.height,d)}return{items:a,globalMetrics:{spacing:8,maxSymbolSize:u,maxItemBounds:{height:Math.max(u,d),width:u+8+h},maxLabelBounds:{width:h,height:d}},layout:{margin:{vertical:void 0!==r.layout.item.vertical?r.layout.item.vertical:4,horizontal:void 0!==r.layout.item.horizontal?r.layout.item.horizontal:4},mode:r.layout.item.mode,size:r.layout.item.size,orientation:"top"===o||"bottom"===o?"horizontal":"vertical",direction:r.layout.item.direction,scrollOffset:r.layout.item.scrollOffset}}}(e,t.renderer),s=isNaN(n.layout.scrollOffset)?s:n.layout.scrollOffset},getItemsToRender:e=>{r=e.viewRect,l=c.getContentOverflow(r);const a=c.extent();s=Math.max(0,Math.min(s,l)),o=Hi({},r);const u="horizontal"===c.orientation()?"x":"y";return o[u]-=s,o["x"===u?"width":"height"]=a,function(t,e,n){let{viewRect:i}=t,{itemized:r,create:o=hg,parallels:a,createSymbol:s}=n;const l=r.layout.direction,c=r.globalMetrics,u=r.items,h="horizontal"===r.layout.orientation;let d=0;const f=[],p=c.maxItemBounds.height,g=c.maxItemBounds.width,m=r.layout.margin.vertical+p,y=r.layout.margin.horizontal+g;let x=e.x,v=e.y,b=i.x-e.x;for(let t=0;t<u.length;t++){let n=o({y:v,x:"rtl"===l?i.x+b+i.width-g-(x-e.x):x,item:u[t],globalMetrics:c,direction:l,createSymbol:s});if((h&&x>=i.x-g||!h&&v>=i.y-p)&&f.push(n.item),d++,d>=a?(d=0,h?(x+=y,v=e.y):(v+=m,x=e.x)):h?v+=m:x+=y,!h&&v>i.y+i.height)break;if(h&&x>i.x+i.width)break}return f}(e,o,{itemized:n,parallels:i,createSymbol:t.symbol})},parallelize:(t,e)=>(i=function(t,e,n){const i=n.items.length,r="horizontal"===n.layout.orientation?"width":"height",o="width"===r?"horizontal":"vertical",a=n.globalMetrics.maxItemBounds[r]*i+(i-1)*n.layout.margin[o];let s=Math.ceil(a/t);if(null!=e){const t="horizontal"===n.layout.orientation?"height":"width",i="width"===t?"horizontal":"vertical",r=n.layout.margin[i]||4,o=Math.floor((e+r)/(r+n.globalMetrics.maxItemBounds[t]));s=Math.min(s,o)}const l=isNaN(n.layout.size)?1:n.layout.size;return Math.max(1,Math.min(s,l))}(t,e,n),i),hasContentOverflow:()=>{const t="horizontal"===n.layout.orientation?"width":"height";return dg(n,i)>r[t]},getContentOverflow:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r;const e="horizontal"===n.layout.orientation?"width":"height";return Math.max(0,dg(n,i)-t[e])},getNextSize:()=>{const t="horizontal"===n.layout.orientation?"width":"height",e="width"===t?"horizontal":"vertical";return n.globalMetrics.maxItemBounds[t]+n.layout.margin[e]},getPrevSize:()=>{const t="horizontal"===n.layout.orientation?"width":"height",e="width"===t?"horizontal":"vertical";return n.globalMetrics.maxItemBounds[t]+n.layout.margin[e]},hasNext:()=>"horizontal"===c.orientation()?r.x+r.width<o.x+o.width:r.y+r.height<o.y+o.height,hasPrev:()=>"horizontal"===c.orientation()?o.x<r.x:o.y<r.y,next:()=>{c.scroll(-c.getNextSize())},prev:()=>{c.scroll(c.getPrevSize())},scroll:t=>{const e=Math.max(0,Math.min(l,s-t));e!==s&&(s=e,a())},offset:()=>s,orientation:()=>n.layout.orientation,direction:()=>n.layout.direction,extent:()=>dg(n,i),spread:()=>function(t,e){const n=e,i="horizontal"===t.layout.orientation?"height":"width",r="width"===i?"horizontal":"vertical";return t.globalMetrics.maxItemBounds[i]*n+(n-1)*t.layout.margin[r]}(n,i)};return c}function pg(t){return Object.keys(t).filter((e=>t[e])).join(" ")}const gg={up:"▲",right:"▶",down:"▼",left:"◀"};function mg(t,e){let{size:n,isActive:i,direction:r,nav:o,attrs:a}=e,s={},l="";const c=a;o&&o.button&&("function"==typeof o.button.class?s=o.button.class({direction:r}):o.button.class&&(s=o.button.class),"function"==typeof o.button.content&&(l=o.button.content(t,{direction:r})),void 0!==o.button.tabIndex&&(c.tabindex=o.button.tabIndex));const u={width:"".concat(n,"px"),minWidth:"".concat(n,"px"),height:"".concat(n,"px")};return Object.keys(s).length||(u.border="0",u.background="none"),(!i||o&&o.disabled)&&(c.disabled="disabled"),t("button",Hi({class:pg(s),style:u},c),[l||t("span",{style:{pointerEvents:"none"}},[gg[r]])])}function yg(t){let e;const n={itemize:t=>{e=function(t){let{dock:e,navigation:n}=t;return{layout:{orientation:"top"===e||"bottom"===e?"vertical":"horizontal"},navigation:n}}(t)},render:i=>function(t,e,n,i){let{rect:r,itemRenderer:o}=e;if(!t||!t.renderArgs)return;t.size(r);const a=t.renderArgs[0],s="vertical"===n.layout.orientation,l="rtl"===o.direction(),c=o.hasNext(),u=o.hasPrev();if(!u&&!c)return void t.render([]);const h=s?["right","left"]:["down","up"];l&&s&&h.reverse();const d=[a("div",{style:{position:"relative",display:"flex","flex-direction":s?"column":"row","justify-content":"center",height:"100%",pointerEvents:"auto"},dir:l&&!s?"rtl":"ltr"},[mg(a,{size:32,isActive:c,direction:h[0],attrs:{"data-action":"next","data-component-key":i.settings.key},nav:n.navigation}),mg(a,{size:32,isActive:u,direction:h[1],attrs:{"data-action":"prev","data-component-key":i.settings.key},nav:n.navigation})])];t.render(d)}(n.renderer,i,e,t),extent:()=>32,spread:()=>64};return n}function xg(t){let e;const n={itemize:n=>{e=function(t,e){let{resolved:n}=t;if(!1===n.title.item.show)return null;const i=Hi({},n.title.item,{type:"text"});if("rtl"===n.layout.item.direction&&(i.anchor&&"start"!==i.anchor?"end"===i.anchor&&(i.anchor="start"):i.anchor="end"),void 0===n.title.settings.text){const t=e.scale.data().fields;i.text=t&&t[0]?t[0].title():""}return{displayObject:i,bounds:e.renderer.textBounds(i)}}(n,t)},render:t=>{!function(t,e,n){let{rect:i}=t;if(!e)return;const r=[];if(e.size(i),n){const t={start:0,end:i.width,middle:i.width/2};r.push(Hi({},n.displayObject,{x:t[n.displayObject.anchor]||0,y:0,baseline:"text-before-edge",title:n.displayObject.text}))}e.render(r)}(t,n.renderer,e)},spread:()=>e?e.bounds.height:0,extent:()=>e?e.bounds.width:0};return n}function vg(t,e,n,i){let r,o,a,{itemRenderer:s,navigationRenderer:l,titleRenderer:c,isPreliminary:u=!1}=i,h=0;const d={x:e.spacing,y:e.spacing,width:t.width-2*e.spacing,height:t.height-2*e.spacing};if(r={x:d.x,y:d.y,width:d.width,height:c.spread()},"horizontal"===n){r={x:d.x,y:d.y,width:c.extent(),height:c.spread()};const t=d.width-r.width-(r.width?e.spacing:0),n=d.height;s.parallelize(t,u?void 0:n);const i=s.extent()>t?l.extent():0,f=s.spread(),p=i?l.spread():0;o={x:r.x+r.width+(r.width?e.spacing:0),y:d.y+Math.max(0,(p-f)/2),width:d.width-i-r.width-(i?e.spacing:0)-(r.width?e.spacing:0),height:n},a={x:o.x+o.width+(i?e.spacing:0),y:d.y,width:i,height:d.height},r.y=o.y;"rtl"===s.direction()&&(a.x=d.x,o.x=a.x+a.width+(a.width?e.spacing:0),r.x=o.x+o.width+(r.width?e.spacing:0)),h=Math.max(r.height,p,s.spread())}else{const t=d.height-r.height-(r.height?e.spacing:0),n=d.width;s.parallelize(t,u?void 0:n);const i=s.extent()>t?l.extent():0;a={x:d.x,y:d.y+d.height-i,width:d.width,height:i},o={x:d.x,y:r.y+r.height+(r.height?e.spacing:0),width:d.width,height:d.height-r.height-(r.height?e.spacing:0)-a.height-(a.height?e.spacing:0)},h=Math.max(c.extent(),i?l.spread():0,s.spread())}return o=Hi({},t,{x:t.x+o.x,y:t.y+o.y,width:o.width,height:o.height}),a.x+=t.x,a.y+=t.y,r.x+=t.x,r.y+=t.y,{title:Hi({},t,r),content:Hi({},t,o),navigation:Hi({},t,a),orientation:n,preferredSize:h}}function bg(t){t.state.resolved=function(t){const e=t.scale.domain();let n={items:[]};const i=t.settings.layout.dock;if("threshold-color"===t.scale.type){const r=t.scale.data().fields[0];let o=t=>String(t);t.settings.formatter?o=t.chart.formatter(t.settings.formatter):r&&(o=r.formatter());for(let t=0;t<e.length-1;t++){const i={value:e[t],label:"".concat(o(e[t])," - < ").concat(o(e[t+1]))};r&&(i.source={field:r.id()}),n.items.push(i)}"vertical"==("top"===i||"bottom"===i?"horizontal":"vertical")&&n.items.reverse()}else{const i=t.scale.labels?t.scale.labels():null;n.items=e.map(((e,n)=>{const r=t.scale.datum?Hi({},t.scale.datum(e)):{value:e};return r.value=e,t.scale.label?r.label=t.scale.label(e):i&&(r.label=i[n]),r}))}const r=t.resolver.resolve({data:{fields:t.scale.data().fields},defaults:Hi(!0,{},ug.title,t.style.title),settings:t.settings.settings.title}),o=t.resolver.resolve({data:{fields:t.scale.data().fields},defaults:ug.layout,settings:t.settings.settings.layout}),a=t.resolver.resolve({data:n,defaults:Hi(!0,{},ug.item.label,t.style.item.label),settings:(t.settings.settings.item||{}).label}),s=Hi(!0,{},(t.settings.settings.item||{}).shape);void 0===s.fill&&t.settings.scale&&(s.fill={scale:t.settings.scale});const l=t.resolver.resolve({data:n,defaults:Hi(!0,{},ug.item.shape,t.style.item.shape),settings:s}),c=t.resolver.resolve({data:n,defaults:Hi(!0,{},{show:ug.item.show}),settings:{show:(t.settings.settings.item||{}).show}});function u(t,n){let i=t.data.value,r=e[n+1];t.data.value=[i,r]}"threshold-color"===t.scale.type&&("vertical"==("top"===i||"bottom"===i?"horizontal":"vertical")?(c.items.reverse().forEach(u),c.items.reverse()):c.items.forEach(u));return{title:r,labels:a,symbols:l,items:c,layout:o}}(t),t.titleRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center"}),t.itemRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center"}),t.navigationRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center",navigation:t.settings.settings.navigation}),t.state.display={spacing:8}}function wg(t){const{rect:e,settings:n,state:i,itemRenderer:r,navigationRenderer:o,titleRenderer:a}=t,s=n.layout.dock,l="top"===s||"bottom"===s?"horizontal":"vertical",c=vg(e,i.display,l,{itemRenderer:r,navigationRenderer:o,titleRenderer:a});t.renderer.size(c.content);let u=r.getItemsToRender({viewRect:Hi({},c.content,{x:0,y:0})});return o.render({rect:c.navigation,itemRenderer:r}),a.render({rect:c.title}),t.state.views={layout:c},u}const Mg={require:["chart","settings","renderer","update","resolver","registries","symbol"],defaultSettings:{settings:{},style:{item:{label:"$label",shape:"$shape"},title:"$title"}},mounted(t){t&&t.parentNode&&(this.navigationRenderer.renderer.appendTo(t.parentNode),this.titleRenderer.renderer.appendTo(t.parentNode),t.parentNode.insertBefore(this.navigationRenderer.renderer.element(),t),t.parentNode.insertBefore(this.titleRenderer.renderer.element(),t)),this.navigationRenderer.render({rect:this.state.views.layout.navigation,itemRenderer:this.itemRenderer}),this.titleRenderer.render({rect:this.state.views.layout.title})},beforeUnmount(){this.navigationRenderer.renderer.clear(),this.titleRenderer.renderer.clear()},on:{panstart(){if(this.state.interaction.started)return;this.itemRenderer.getContentOverflow()&&(this.state.interaction.started=!0,this.state.interaction.delta=0)},panmove(t){if(!this.state.interaction.started)return;const e="horizontal"===this.itemRenderer.orientation()?("rtl"===this.itemRenderer.direction()?-1:1)*t.deltaX:t.deltaY;this.itemRenderer.scroll(e-this.state.interaction.delta),this.state.interaction.delta=e},panend(){this.state.interaction.started=!1},scroll(t){this.itemRenderer.scroll(-t)},next(){this.itemRenderer.next()},prev(){this.itemRenderer.prev()}},created(){this.state={interaction:{}},this.onScroll=()=>{const t=wg(this);this.update(t)},this.itemRenderer=fg(this,{onScroll:this.onScroll}),this.navigationRenderer=yg(this),this.titleRenderer=xg(this),this.navigationRenderer.renderer=this.registries.renderer("dom")(),this.titleRenderer.renderer=this.registries.renderer(this.settings.renderer)(),bg(this)},preferredSize(t){return function(t,e){let n=0;const i=t.settings.layout.dock||"center",r="top"===i||"bottom"===i?"horizontal":"vertical",o=t.state.display,a=vg(e.inner,o,r,{itemRenderer:t.itemRenderer,navigationRenderer:t.navigationRenderer,titleRenderer:t.titleRenderer,isPreliminary:!0});return n+=o.spacing,n+=a.preferredSize,n+=o.spacing,n}(this,t)},beforeUpdate(){bg(this)},render(){return wg(this)},beforeDestroy(){this.navigationRenderer.renderer.destroy(),this.titleRenderer.renderer.destroy()},additionalElements(){return[this.titleRenderer.renderer.element(),this.navigationRenderer.renderer.element()]},_DO_NOT_USE_getInfo(){return{offset:this.itemRenderer.offset()}}};function kg(t,e){let n=0;const i=t.state.isVertical?"justify":"align",r=t.state.isVertical?"y":"x",o=t.state.isVertical?"height":"width",a=t.state.isVertical?"requiredHeight":"requiredWidth";n=t.state.rect[o]-t.state.legend.length()-t.state.title[a](),n*=Math.min(1,Math.max(t.stgns[i],0)),e[r]+=n}function _g(t,e,n){const i=n[t];return"object"==typeof i?-1!==i.valid.indexOf(e)?e:i.default:n.default}function Sg(t){return _g(t.layout.dock,t.settings.title.anchor,{left:{valid:["top"],default:"top"},right:{valid:["top"],default:"top"},top:{valid:["left","right"],default:"left"},bottom:{valid:["left","right"],default:"left"},default:"top"})}function Ng(t,e){const n={x:0,y:0,width:0,height:0},i=t.stgns.padding;return n.x=i.left,n.y=i.top,n.width=e.width-i.left-i.right,n.height=e.height-i.top-i.bottom,n}function Rg(t){const e="top"!==t.settings.layout.dock&&"bottom"!==t.settings.layout.dock,n=t.stgns.title,i=t.chart.scale(t.stgns.fill),r=t.chart.scale(t.stgns.major),o=function(t,e){const n=e.domain();let i=n,r=t.stgns.tick.label;!r&&t.formatter?r=t.formatter:!r&&e.data().fields&&(r=e.data().fields[0].formatter()),"function"==typeof r&&(i=n.map(r).map(String));const o=n.map(((n,r)=>{const o=i[r];return{value:n,label:o,pos:e.norm(parseFloat(n,10)),textMetrics:t.renderer.measureText({text:o,fontSize:t.stgns.tick.fontSize,fontFamily:t.stgns.tick.fontFamily})}}));return o}(t,r),a=_g((s=t.settings).layout.dock,s.settings.tick.anchor,{left:{valid:["left","right"],default:"left"},right:{valid:["left","right"],default:"right"},top:{valid:["top","bottom"],default:"top"},bottom:{valid:["top","bottom"],default:"bottom"},default:"right"});var s;if(void 0===n.text){const t=r.data().fields;n.text=t&&t[0]?t[0].title():""}const l=t.renderer.measureText({text:n.text,fontSize:n.fontSize,fontFamily:n.fontFamily}),c=t.renderer.textBounds({text:n.text,fontSize:n.fontSize,fontFamily:n.fontFamily,maxLines:n.maxLines,maxWidth:n.maxLengthPx,wordBreak:n.wordBreak,hyphens:n.hyphens,lineHeight:n.lineHeight}),u={isVertical:e,nodes:[],title:{anchor:Sg(t.settings),textMetrics:l,textBounds:c,requiredWidth:()=>{if(!n.show)return 0;let t=c.width,i=n.maxLengthPx;return e||(t+=n.padding,i+=n.padding),Math.min(t,i,u.rect.width)},requiredHeight:()=>{if(!n.show)return 0;let t=c.height;return e&&(t+=n.padding),Math.min(t,u.rect.height)}},ticks:{values:o,anchor:a,length:Math.min(Math.max(...o.map((t=>t.textMetrics.width))),t.stgns.tick.maxLengthPx),requiredHeight:()=>"top"===a?Math.max(...u.ticks.values.map((t=>t.textMetrics.height)))+t.stgns.tick.padding:0,height:Math.max(...o.map((t=>t.textMetrics.height)))},legend:{fillScale:i,majorScale:r,length:()=>{const n=e?"height":"width",i=e?"requiredHeight":"requiredWidth",r=Math.min(u.rect[n],u.rect[n]*t.stgns.length)-u.title[i]();return Math.max(0,Math.min(r,t.stgns.maxLengthPx))}}};return u}const Ag={require:["chart","settings","renderer"],defaultSettings:{layout:{displayOrder:0,dock:"right"},settings:{size:15,length:.5,maxLengthPx:250,align:.5,justify:0,padding:{left:5,right:5,top:5,bottom:5},tick:{label:null,fill:"#595959",fontSize:"12px",fontFamily:"Arial",maxLengthPx:100,anchor:null,padding:5},title:{show:!0,text:void 0,fill:"#595959",fontSize:"12px",fontFamily:"Arial",maxLengthPx:100,padding:5,maxLines:2,wordBreak:"none",lineHeight:1.2,hyphens:"auto",anchor:null}}},preferredSize(t){const e=this.state;e.rect=Ng(this,t.inner);let n=this.stgns.size;const i=e.isVertical?this.stgns.padding.left+this.stgns.padding.right:this.stgns.padding.top+this.stgns.padding.bottom;n+=i;const r=Math.max(t.inner.width,t.inner.height);if("left"===e.ticks.anchor||"right"===e.ticks.anchor){const t=e.ticks.values.reduce(((t,e)=>t+e.textMetrics.height),0);if(t>this.state.legend.length())return r;n+=e.ticks.length}else{if(e.ticks.length>this.state.legend.length())return r;n+=Math.max(...e.ticks.values.map((t=>t.textMetrics.height)))}return n+=this.stgns.tick.padding,this.stgns.title.show&&(n="left"===e.title.anchor||"right"===e.title.anchor?Math.max(e.title.textBounds.height+i,n):Math.max(n,e.title.requiredWidth()+i)),this.state.preferredSize=n,n},created(){this.stgns=this.settings.settings,this.state=Rg(this)},beforeUpdate(t){this.stgns=t.settings.settings,this.state=Rg(this)},beforeRender(t){if(this.state.nodes=[],this.state.rect=Ng(this,t.size),this.stgns.title.show){const t=function(t){const e=t.state,n=t.stgns,i="left"===e.ticks.anchor,r="top"===e.ticks.anchor;let o=e.rect.x,a=e.rect.y,s="start";"left"===e.title.anchor?(o+=e.title.requiredWidth()-n.title.padding,a+=e.title.textMetrics.height,a+=r?e.rect.height-e.title.textBounds.height:0,s="end"):"right"===e.title.anchor?(o+=e.legend.length(),o+=n.title.padding,a+=e.title.textMetrics.height,a+=r?e.rect.height-e.title.textBounds.height:0):"top"===e.title.anchor&&(o+=i?e.rect.width:0,a+=e.title.textMetrics.height,s=i?"end":"start");const l={tag:"legend-title",type:"text",x:o,y:Math.min(a,e.rect.y+e.rect.height),text:n.title.text,fill:n.title.fill,fontSize:n.title.fontSize,fontFamily:n.title.fontFamily,maxWidth:n.title.maxLengthPx,maxLines:n.title.maxLines,wordBreak:n.title.wordBreak,hyphens:n.title.hyphens,lineHeight:n.title.lineHeight,anchor:s,title:n.title.text};return kg(t,l),l}(this);this.state.nodes.push(t)}const e=function(t){const e=t.state.legend.fillScale,n=t.state.legend.majorScale,i=e.domain().map((t=>({type:"stop",color:e(t),offset:Math.min(1,Math.max(0,n.norm(t)))})));return i.sort(((t,e)=>t.offset-e.offset))}(this),n=function(t,e){const n=t.state,i=t.stgns,r=n.rect;let o=r.x,a=r.y,s=n.isVertical?i.size:n.legend.length(),l=n.isVertical?n.legend.length():i.size;"left"===n.ticks.anchor?o+=n.rect.width-i.size:"top"===n.ticks.anchor&&(a+=n.rect.height-i.size),"top"===n.title.anchor?a+=n.title.requiredHeight():"left"===n.title.anchor&&(o+=n.title.requiredWidth());const c={type:"rect",x:o,y:a,width:s,height:l,fill:{type:"gradient",stops:e,degree:n.isVertical?90:180}};return kg(t,c),c}(this,e),i=function(t,e){const n=t.state,i=t.stgns;let r="start";const o={type:"rect",x:e.x,y:e.y,width:n.isVertical?0:e.width,height:n.isVertical?e.height:0,fill:"transparent"},a=n.ticks.values.map((a=>{let s=0,l=0,c=0,u="alphabetical";return n.isVertical?(l=e.y+e.height*a.pos,u=0===a.pos?"text-before-edge":"text-after-edge"):s=e.x+e.width*a.pos,"right"===n.ticks.anchor?(s=e.x+i.size+i.tick.padding,o.x=e.x+e.width):"left"===n.ticks.anchor?(s=e.x-i.tick.padding,r="end"):"top"===n.ticks.anchor?(l=e.y-i.tick.padding,c-=.25*a.textMetrics.height,r=0===a.pos?"start":"end"):"bottom"===n.ticks.anchor&&(l=e.y+e.height+i.tick.padding,c=.8*a.textMetrics.height,r=0===a.pos?"start":"end",o.y=e.y+e.height),{type:"text",x:s,y:l,dx:0,dy:c,text:a.label,fontSize:i.tick.fontSize,fontFamily:i.tick.fontFamily,fill:i.tick.fill,maxWidth:n.isVertical?i.tick.maxLengthPx:Math.min(i.tick.maxLengthPx,n.legend.length()/2),anchor:r,textBoundsFn:t.renderer.textBounds,title:a.label,baseline:u}}));return{type:"container",id:"legend-seq-ticks",children:[...a,o]}}(this,n),r={id:"legend-seq-target",type:"container",children:[n,i]};this.state.nodes.push(r)},render(){return this.state.nodes}};const Cg={coordinates:{minor:.5,major:.5,layerId:0,defined:!0},connect:!1,orientation:"horizontal",layers:{curve:"linear",show:!0,sort:void 0,line:{stroke:"#ccc",strokeWidth:1,strokeLinejoin:"miter",strokeDasharray:void 0,opacity:1,show:!0,showMinor0:!0},area:{fill:"#ccc",opacity:.8,show:!0}}};function Dg(t,e){let{generatorType:n,item:i,data:r,major:o,minor:a,layerObj:s,stngs:l}=e,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const u={type:"path",points:t,generatorType:n,major:o,minor:a,layerObj:s,stngs:l,opacity:i.opacity,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeLinejoin:i.strokeLinejoin,fill:c||i.fill,data:r};return i.strokeDasharray&&(u.strokeDasharray=i.strokeDasharray),u}function Og(t){const{metaLayers:e,coordinates:n,layers:i,lines:r,areas:o}=function(t){let{data:e,stngs:n,rect:i,resolver:r,style:o,domain:a}=t;const{width:s,height:l}=i,c=r.resolve({data:e,defaults:Cg.coordinates,settings:n.coordinates||{},scaled:{major:"vertical"===n.orientation?l:s,minor:"vertical"===n.orientation?s:l}}),u=!n.connect&&a.length>2&&("function"==typeof n.coordinates.layerId||"object"==typeof n.coordinates.layerId),h={};let d=0;for(let t=0;t<c.items.length;t++){let e=c.items[t],n=e.layerId;if(u){const t=h[n]?h[n].items[h[n].items.length-1]:null,i=t?a.indexOf(t.data.major?t.data.major.value:t.data.value):null;t&&a.indexOf(e.data.major?e.data.major.value:e.data.value)-1!==i&&h[n].items.push({dummy:!0})}h[n]=h[n]||{order:d++,id:n,items:[],dataItems:[],consumableData:{}},h[n].dataItems.push(e.data),h[n].items.push(e)}const f=Object.keys(h).map((t=>(h[t].consumableData=Xi({points:h[t].dataItems},h[t].dataItems[0]),h[t]))),p={items:f.map((t=>t.consumableData))},g=n.layers||{};return{coordinates:c,metaLayers:f,layers:r.resolve({data:p,defaults:{curve:Cg.layers.curve,show:Cg.layers.show},settings:{curve:g.curve,show:g.show}}),lines:r.resolve({data:p,defaults:Hi({},Cg.layers.line,o.line),settings:g.line}),areas:r.resolve({data:p,defaults:Hi({},Cg.layers.area,o.area),settings:g.area})}}(t),a=[];return e.forEach(((e,s)=>{const l=i.items[s];if(!1===l.show)return;l.datum=l.data,l.data=[],l.id=e.id;const c=[],u=[];let h,d;for(let i=0;i<e.items.length;i++){if(h=e.items[i],d=h.data,!h.dummy){if(isNaN(h.major))continue;t.missingMinor0&&(h.minor0=n.settings.minor.scale?n.settings.minor.scale(d.minor0?d.minor0.value:0):0),isNaN(h.minor)||c.push(h.minor),l.data.push(h.data)}u.push(h)}const f=c.sort(((t,e)=>t-e))[Math.floor((c.length-1)/2)];a.push({layerObj:l,lineObj:r.items[s],areaObj:o.items[s],median:f,points:u,consumableData:e.consumableData})})),a}const zg={require:["chart","resolver"],defaultSettings:{style:{area:"$shape",line:"$shape-outline"}},created(){},render(t){let{data:e}=t;const{width:n,height:i}=this.rect;this.stngs=this.settings.settings||{};const r=!this.stngs.coordinates||void 0===this.stngs.coordinates.minor0,o=Og({data:e,stngs:this.stngs,rect:this.rect,resolver:this.resolver,style:this.style,missingMinor0:r,domain:this.stngs.coordinates&&this.stngs.coordinates.major&&this.stngs.coordinates.major.scale?this.chart.scale(this.stngs.coordinates.major.scale).domain():[]});if(this.stngs.layers&&this.stngs.layers.sort){const t=o.map((t=>({id:t.layerObj.id,data:t.layerObj.data}))).sort(this.stngs.layers.sort).map((t=>t.id));o.sort(((e,n)=>t.indexOf(e.layerObj.id)-t.indexOf(n.layerObj.id)))}else o.sort(((t,e)=>t.median-e.median));return function(t,e){let{width:n,height:i,missingMinor0:r,stngs:o}=e;const a=[],s=o.layers||{};return t.forEach((t=>{const{lineObj:e,layerObj:l,areaObj:c,points:u}=t;let h={size:i,p:"y"},d={size:n,p:"x"};if("vertical"===o.orientation){const t=Hi(!0,{},d);d=Hi(!0,{},h),h=Hi(!0,{},t)}s.area&&!1!==c.show&&a.push(Dg(u,{data:t.consumableData,item:c,generatorType:"area",major:d,minor:h,layerObj:l,stngs:o})),e&&!1!==e.show&&(a.push(Dg(u,{data:t.consumableData,item:e,generatorType:"line".concat(h.p.toUpperCase(),"1"),major:d,minor:h,layerObj:l,stngs:o},"none")),!r&&s.area&&!1!==c.show&&!1!==e.showMinor0&&a.push(Dg(u,{data:t.consumableData,item:e,generatorType:"line".concat(h.p.toUpperCase(),"0"),major:d,minor:h,layerObj:l,stngs:o},"none")))})),a}(o,{width:n,height:i,missingMinor0:r,stngs:this.stngs})}};function Eg(t,e){let n,i,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"object"==typeof e.center?(n=e.center.x,i=e.center.y):(n=e.clientX,i=e.clientY);const o=n-t.state.boundingRect.left,a=i-t.state.boundingRect.top;return{x:r?Math.max(0,Math.min(o,t.rect.width)):o,y:r?Math.max(0,Math.min(a,t.rect.height)):a}}function Ig(t,e){return{x:e.x+t.rect.x,y:e.y+t.rect.y}}function Tg(t,e){const n=Math.min(t.x,e.x),i=Math.min(t.y,e.y);return{x:n,y:i,width:Math.max(t.x,e.x)-n,height:Math.max(t.y,e.y)-i}}const Pg={require:["chart","renderer"],defaultSettings:{layout:{displayOrder:99},settings:{brush:{components:[]}},style:{area:"$selection-area-target"}},on:{areaStart(t){this.start(t)},areaMove(t){this.move(t)},areaEnd(t){this.end(t)},areaCancel(){this.cancel()}},created(){this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1}},preferredSize:()=>0,render(){},start(t){this.state.boundingRect=this.renderer.element().getBoundingClientRect();const e=Eg(this,t,!1);hh({x:0,y:0,width:this.rect.width,height:this.rect.height},e)&&(this.state.brushConfig=this.settings.settings.brush.components.map((t=>({key:t.key,contexts:t.contexts,data:t.data,action:t.action||"set"}))),this.state.start=Eg(this,t),this.state.active=!0)},move(t){var e;this.state.active&&(this.state.end=Eg(this,t),function(t){if(t.state.active){const e=Ig(t,t.state.start),n=Ig(t,t.state.end),i=t.chart.shapesAt(Tg(e,n),{components:t.state.brushConfig});t.chart.brushFromShapes(i,{components:t.state.brushConfig})}}(this),(e=this).renderer.render([Hi({type:"rect"},Tg(e.state.start,e.state.end),e.style.area)]))},end(){this.state.active&&(this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1},this.renderer.render([]))},cancel(){var t,e;this.state.active&&(t=this.state,e=this.chart,t.brushConfig.forEach((t=>{Array.isArray(t.contexts)&&t.contexts.forEach((t=>{e.brush(t).end()}))})),this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1},this.renderer.render([]))}};function qg(t,e,n){let{renderer:i,style:r,props:o,h:a}=n;const s=function(t,e){return{tooltip:"function"==typeof t.tooltipClass?t.tooltipClass({dock:e.dock}):t.tooltipClass,content:"function"==typeof t.contentClass?t.contentClass({dock:e.dock}):t.contentClass,arrow:"function"==typeof t.arrowClass?t.arrowClass({dock:e.dock}):t.arrowClass}}(o,e),l=function(t,e,n,i){return i.content({h:t,style:n,data:e})}(a,t,r,o),c=a("div",{dir:o.direction,class:pg(Hi({"pic-tooltip":!0},s.tooltip)),style:Hi({position:"relative",display:"inline-block"},e.computedTooltipStyle)},a("div",{style:r.content,class:pg(Hi({"pic-tooltip-content":!0},s.content))},l),a("div",{class:pg(Hi({"pic-tooltip-arrow":!0},s.arrow)),style:Hi({},r.arrow,r["arrow-".concat(e.dock)],e.computedArrowStyle)}));return i.render(c),i.element().children[0]}function Lg(t){let{defaultDuration:e,defaultDelay:n}=t,i=null,r=null,o=!1;const a=function(){const t=function(){},e={pending:[],debounced:[],active:[],cancelled:[],rejected:[],fulfilled:[]};let n;return t.set=t=>{n=t,e[n].forEach((e=>e(t)))},t.on=(t,n)=>{Array.isArray(t)?t.forEach((t=>e[t].push(n))):e[t].push(n)},t.destroy=()=>{Object.keys(e).forEach((t=>{e[t].length=0}))},t}(),s=function(){},l=()=>{i=null,r=null,o=!1,a.set("fulfilled")};return s.invoke=function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;i&&(clearTimeout(i),a.set("debounced")),a.set("pending"),i=setTimeout((()=>{t(),o=!0,i=null,a.set("active")}),c),s>0&&(r&&clearTimeout(r),r=setTimeout(l,s+Math.max(c,0)))},s.clear=()=>{o?a.set("cancelled"):i&&(clearTimeout(i),a.set("rejected")),r&&clearTimeout(r),i=null,r=null,o=!1},s.on=(t,e)=>{a.on(t,e)},s.destroy=()=>{s.clear(),a.destroy()},s}function jg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return{left:"translate(-100%,-50%) translateX(".concat(-t,"px)"),right:"translate(".concat(t,"px, -50%)"),top:"translate(-50%, -100%) translateY(".concat(-t,"px)"),bottom:"translate(-50%, ".concat(t,"px)"),inside:"translate(-50%, -50%)"}}function Fg(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{left:{x:-t-n,y:-e/2},right:{x:n,y:-e/2},top:{x:-t/2,y:-e-n},bottom:{x:-t/2,y:n},inside:{x:-t/2,y:-e/2}}}function Bg(t,e){const n=t>0?"-":"+";return t=Math.abs(t),void 0===e&&(e=t),{left:{left:"100%",top:"calc(50% ".concat(n," ").concat(t,"px)"),borderWidth:"".concat(e,"px")},right:{left:"".concat(2*-t,"px"),top:"calc(50% ".concat(n," ").concat(t,"px)"),borderWidth:"".concat(e,"px")},top:{left:"calc(50% ".concat(n," ").concat(t,"px)"),top:"100%",borderWidth:"".concat(e,"px")},bottom:{left:"calc(50% ".concat(n," ").concat(t,"px)"),top:"".concat(2*-t,"px"),borderWidth:"".concat(e,"px")},inside:{left:"0px",top:"0px",borderWidth:"0px"}}}function Vg(t,e,n,i,r,o){const a=e+o.x,s=n+o.y,l=r;return!(a<0||s<0)&&!(a+i>t.width||s+l>t.height)}function $g(t){let{area:e,vx:n,vy:i,width:r,height:o,offset:a}=t;const s=n+a.x,l=i+a.y,c=r,u=o;let h=s<0?-s:0,d=l<0?-l:0;return h+=s+c>e.width?-(s+c-e.width):0,d+=l+u>e.height?-(l+u-e.height):0,{x:h,y:d}}function Hg(t){let{options:e,pointer:n,width:i,height:r,dockOrder:o,x:a,y:s}=t;const{targetBounds:l}=n,c=jg(e.offset),u=c[e.dock];if(u)return{computedTooltipStyle:{left:"".concat(a,"px"),top:"".concat(s,"px"),transform:u},computedArrowStyle:Bg(e.offset)[e.dock],dock:e.dock};const h={width:"target"===e.area?l.width:window.innerWidth,height:"target"===e.area?l.height:window.innerHeight},d=Fg(i,r,e.offset),f=[],p="target"===e.area?a:l.left+a,g="target"===e.area?s:l.top+s;for(let t=0;t<o.length;t+=1){const n=o[t],l=$g({area:h,vx:p,vy:g,width:i,height:r,offset:d[n]}),u={left:"".concat(a,"px"),top:"".concat(s,"px"),transform:c[n]},m=Bg(e.offset)[n];0!==l.x&&(u.width="".concat(i-20-Math.abs(l.x),"px"),"top"!==n&&"bottom"!==n||(u.left="".concat(a+l.x,"px"),m.left="calc(50% ".concat(l.x>0?"-":"+"," ").concat(Math.abs(l.x),"px)")));const y={computedTooltipStyle:u,computedArrowStyle:m,dock:n,rect:{width:i,height:r}};if(0===l.x&&0===l.y)return y;y.offset=l,f.push(y)}return f.sort(((t,e)=>Math.abs(t.offset.x)-Math.abs(e.offset.x))),f[0]}function Wg(t,e,n){const i=t.key?n.component(t.key):n.componentsFromPoint({x:e.clientX,y:e.clientY})[0];if(!i)return{x:0,y:0,width:0,height:0,scaleRatio:{x:1,y:1}};const r=i.rect;return Hi({scaleRatio:r.scaleRatio},r.computedInner)}const Ug={bounds:function(t){let{resources:e,nodes:n,pointer:i,width:r,height:o,options:a}=t;const{targetBounds:s}=i,{x:l,y:c,width:u,height:h}=e.getNodeBoundsRelativeToTarget(n[0]),d={left:{x:l,y:c+h/2},right:{x:l+u,y:c+h/2},top:{x:l+u/2,y:c},bottom:{x:l+u/2,y:c+h},inside:{x:l+u/2,y:c+h/2}},f=jg(a.offset),p=f[a.dock];if(p)return{computedTooltipStyle:{left:"".concat(d[a.dock].x,"px"),top:"".concat(d[a.dock].y,"px"),transform:p},computedArrowStyle:Bg(a.offset)[a.dock],dock:a.dock};const g={width:"target"===a.area?s.width:window.innerWidth,height:"target"===a.area?s.height:window.innerHeight},m=Fg(r,o,a.offset),y=["top","left","right","bottom","inside"];for(let t=0;t<y.length;t+=1){const e=y[t];if(Vg(g,"target"===a.area?d[e].x:s.left+d[e].x,"target"===a.area?d[e].y:s.top+d[e].y,r,o,m[e]))return{computedTooltipStyle:{left:"".concat(d[e].x,"px"),top:"".concat(d[e].y,"px"),transform:f[e]},computedArrowStyle:Bg(a.offset)[e],dock:e}}const x=function(t){let{options:e,docks:n,dockOffsets:i,targetBounds:r,area:o,width:a,height:s}=t;const l="top",c="target"===e.area?n[l].x:r.left+n[l].x,u=("target"===e.area?n[l].y:(r.top,n[l].y),i[l]),h=c+u.x,d=(u.y,a);let f=n.top.x;return h<0&&h+d>o.width||(h<0?f-=h:h+d>o.width&&(f-=h+d-o.width)),f}({options:a,docks:d,dockOffsets:m,targetBounds:s,area:g,width:r,height:o});return{computedTooltipStyle:{left:"".concat(x,"px"),top:"".concat(d.top.y,"px"),transform:f.top},computedArrowStyle:Bg(a.offset+x-d.top.x,a.offset).top,dock:"top"}},pointer:function(t){let{options:e,pointer:n,width:i,height:r}=t;const{x:o,y:a}=n;return Hg({x:o,y:a,pointer:n,width:i,height:r,options:e,dockOrder:["top","left","right","bottom"]})},slice:function(t){let{options:e,pointer:n,width:i,height:r,nodes:o,resources:a}=t;const s=o[0],{dx:l,dy:c}=n,u=a.getComponentBoundsFromNode(s),h=l+u.x+u.width/2,d=c+u.y+u.height/2,{start:f,end:p,outerRadius:g}=s.desc.slice,m=(f+p)/2-Math.PI/2,y=2*Math.PI,x=(m%y+y)%y;let v=["top","left","right","bottom"];return"auto"===e.dock&&(v=x<=Math.PI/4||x>=7*Math.PI/4?["right","top","bottom","left"]:x<=3*Math.PI/4?["bottom","left","right","top"]:x<=5*Math.PI/4?["left","top","bottom","right"]:["top","left","right","bottom"]),Hg({x:h+g*u.scaleRatio.x*Math.cos(x),y:d+g*u.scaleRatio.y*Math.sin(x),pointer:n,width:i,height:r,options:e,dockOrder:v})}};function Yg(t,e){let{width:n,height:i}=t,{chart:r,state:o,props:a}=e;const s={resources:{formatter:r.formatter,scale:r.scale,component:r.component,getComponentBoundsFromNode:t=>Wg(t,o.pointer,r),getNodeBoundsRelativeToTarget:t=>function(t,e,n){const i=Wg(t,e,n),r=t.bounds;return{x:i.x+e.dx+r.x,y:i.y+e.dy+r.y,width:r.width,height:r.height}}(t,o.pointer,r)},nodes:o.activeNodes,pointer:o.pointer,width:n,height:i},l=typeof a.placement;if("object"===l&&"function"==typeof a.placement.fn)return a.placement.fn(s);let c={type:"pointer",offset:8,dock:"auto",area:"viewport"};"function"===l&&(c=Hi(c,a.placement(s))),"object"===l&&Ug[a.placement.type]?c=Hi(c,a.placement):"string"===l&&Ug[a.placement]&&(c=Hi(c,{type:a.placement})),s.options=c;const u=Ug[c.type](s);let{x:h,y:d,width:f,height:p}=s.resources.getComponentBoundsFromNode(s.nodes[0]);return h+=s.pointer.dx,f+=h,d+=s.pointer.dy,p+=d,u.computedTooltipStyle.left="".concat(Math.min(Math.max(0,h,parseFloat(u.computedTooltipStyle.left)),f),"px"),u.computedTooltipStyle.top="".concat(Math.min(Math.max(0,d,parseFloat(u.computedTooltipStyle.top)),p),"px"),u}let Xg;function Gg(){Xg=null}const Kg={duration:8e3,delay:500,filter:t=>t.filter((t=>t.data&&void 0!==t.data.value)),extract:t=>t.node.data.value,content:t=>{let{h:e,data:n}=t;return n.map((t=>e("div",{},t)))},isEqual:(t,e)=>t.length&&t.length===e.length&&t.every(((t,n)=>e[n]&&JSON.stringify(t.data)===JSON.stringify(e[n].data))),placement:{type:"pointer",dock:"auto",offset:8,area:"viewport"},tooltipClass:{},contentClass:{},arrowClass:{},direction:"ltr",appendTo:void 0,beforeShow:void 0,afterShow:void 0,beforeHide:void 0,onHide:void 0,afterHide:void 0};const Zg={require:["chart","renderer"],defaultSettings:{settings:Kg,style:{tooltip:{},content:{backgroundColor:"$gray-25",color:"$font-color--inverted",fontFamily:"$font-family",fontSize:"$font-size",lineHeight:"$line-height",borderRadius:"4px",padding:"8px",opacity:.9},arrow:{position:"absolute",width:"0px",height:"0px",borderStyle:"solid",color:"$gray-25",opacity:.9},"arrow-bottom":{borderTopColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},"arrow-top":{borderBottomColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},"arrow-right":{borderTopColor:"transparent",borderLeftColor:"transparent",borderBottomColor:"transparent"},"arrow-left":{borderTopColor:"transparent",borderBottomColor:"transparent",borderRightColor:"transparent"}}},renderer:"dom",on:{hide(){this.hide()},show(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.show(t,e)},prevent(t){this.prevent(t)}},hide(){this.dispatcher.clear(),this.state.activeNodes=[],this.state.pointer={}},show(t){let e,{nodes:n,duration:i,delay:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!this.state.prevent&&this.state.targetElement&&(this.state.pointer=function(t,e){let{chart:n,state:i}=e,r=0,o=0;t.center?(r+=t.center.x,o+=t.center.y):(r+=t.clientX,o+=t.clientY);const a=n.element.getBoundingClientRect(),s=i.targetElement.getBoundingClientRect(),l=r,c=o,u=a.left-s.left,h=a.top-s.top,d=r-a.left,f=o-a.top;return r-=s.left,o-=s.top,{x:r,y:o,dx:u,dy:h,cx:d,cy:f,clientX:l,clientY:c,targetBounds:s,chartBounds:a}}(t,this),e=Array.isArray(n)?this.props.filter(n):this.props.filter(this.chart.shapesAt({x:this.state.pointer.cx,y:this.state.pointer.cy})),this.props.isEqual(this.state.activeNodes,e)||(this.dispatcher.clear(),this.state.activeNodes=e,this.state.activeNodes.length&&this.dispatcher.invoke((()=>this.invokeRenderer(this.state.activeNodes)),i,r)))},prevent(t){this.state.prevent=!!t},init(t){this.state={activeNodes:[],pointer:{},targetElement:null,prevent:!1},this.props=t.settings,this.dispatcher=Lg({defaultDuration:this.props.duration,defaultDelay:this.props.delay});const e=this.dispatcher.clear;this.dispatcher.on("pending",(()=>{!function(t){Xg&&Xg!==t&&Xg()}(e),Xg=e,"function"==typeof this.props.beforeShow&&this.props.beforeShow.call(void 0,{resources:{formatter:this.chart.formatter,scale:this.chart.scale}})})),this.dispatcher.on(["cancelled","fulfilled"],(()=>{const t={resources:{formatter:this.chart.formatter,scale:this.chart.scale}};"function"==typeof this.props.beforeHide&&this.props.beforeHide.call(void 0,Hi({element:this.state.tooltipElm},t)),"function"==typeof this.props.onHide?this.props.onHide.call(void 0,Hi({element:this.state.tooltipElm},t)):this.renderer.clear([]),"function"==typeof this.props.afterHide&&this.props.afterHide.call(void 0,t),Xg===e&&(Xg=null),this.state.tooltipElm=void 0})),this.dispatcher.on("active",(()=>{"function"==typeof this.props.afterShow&&this.props.afterShow.call(void 0,{element:this.state.tooltipElm,resources:{formatter:this.chart.formatter,scale:this.chart.scale}})}))},created(){this.init(this.settings)},beforeUpdate(t){let{settings:e}=t;this.dispatcher&&(this.dispatcher.destroy(),Gg()),this.init(e)},render(t){return this.h=t,[]},beforeDestroy(){this.dispatcher.destroy(),Gg()},appendTo(){if(this.props.appendTo){this.state.targetElement="function"==typeof this.props.appendTo?this.props.appendTo({resources:{formatter:this.chart.formatter,scale:this.chart.scale}}):this.props.appendTo;const{width:t,height:e}=this.state.targetElement.getBoundingClientRect();this.renderer.destroy(),this.renderer.size({width:t,height:e}),this.renderer.appendTo(this.state.targetElement)}else this.state.targetElement=this.renderer.element()},mounted(){this.appendTo()},updated(){this.appendTo()},invokeRenderer(t){const e=function(t,e){let{chart:n,scale:i,props:r,h:o}=e;const a={resources:{dataset:n.dataset,scale:n.scale,formatter:n.formatter},scale:i,h:o},s=[];return t.forEach((t=>{if("function"==typeof r.extract){const e=Hi({node:t},a);s.push(r.extract(e))}})),s}(t,this),n=Yg(qg(e,{style:{left:"0px",top:"0px",visibility:"hidden"}},this).getBoundingClientRect(),this);this.state.tooltipElm=qg(e,n,this)}};const Jg={require:["renderer","chart"],defaultSettings:{settings:{target:"",selector:"*",fill:"rgba(0, 255, 0, 0.1)",stroke:"lime",opacity:1,useOuterRect:!1}},on:{update(){this.draw()}},draw(){const t=this.chart.findShapes(this.props.selector).filter((t=>t.key===this.props.target)),e=t.filter((t=>t.collider)).map((t=>t.collider));e.forEach((t=>{t.fill=this.props.fill,t.stroke=this.props.stroke,t.opacity=this.props.opacity,t.collider={type:null}})),this.renderer.render(e)},created(){this.props=this.settings.settings},resize(t){let{outer:e,inner:n}=t;return this.props.useOuterRect?e:n},render(){},mounted(){this.draw()},updated(){this.props=this.settings.settings,this.draw()}};var Qg={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},tm=/([astvzqmhlc])([^astvzqmhlc]*)/gi,em=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function nm(t){const e=[],n=String(t).trim();return"M"!==n[0]&&"m"!==n[0]||n.replace(tm,((t,n,i)=>{const r=function(t){const e=t.match(em);return e?e.map(Number):[]}(i);let o=n.toLowerCase(),a=n;if("m"===o&&r.length>2&&(e.push([a,...r.splice(0,2)]),o="l",a="m"===a?"l":"L"),r.length<Qg[o])return"";for(e.push([a,...r.splice(0,Qg[o])]);r.length>=Qg[o]&&r.length&&Qg[o];)e.push([a,...r.splice(0,Qg[o])]);return""})),e}const im=2*Math.PI;function rm(t,e){return{x:.5*(t.x+e.x),y:.5*(t.y+e.y)}}function om(t,e,n,i,r){const o=1-t;return o**3*e+3*o**2*t*n+3*o*t**2*i+t**3*r}function am(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8;if(o<1||function(t,e,n,i){return Math.abs(t.x+n.x-(e.x+e.x))+Math.abs(t.y+n.y-(e.y+e.y))+Math.abs(e.x+i.x-(n.x+n.x))+Math.abs(e.y+i.y-(n.y+n.y))}(t,e,n,i)<=10)return r[r.length-1]!==t&&r.push(t),r.push(i),r;const a=rm(t,e),s=rm(e,n),l=rm(n,i),c={x:om(.5,t.x,e.x,n.x,i.x),y:om(.5,t.y,e.y,n.y,i.y)},u=rm(a,s),h=rm(s,l);return am(t,a,u,c,r,o-1),am(c,h,l,i,r,o-1),r}function sm(t,e,n){const{cp1:i,cp2:r}=function(t,e,n){return{cp1:{x:t.x+2/3*(e.x-t.x),y:t.y+2/3*(e.y-t.y)},cp2:{x:n.x+2/3*(e.x-n.x),y:n.y+2/3*(e.y-n.y)}}}(t,e,n);return am(t,i,r,n)}function lm(t,e,n){const i=[],r=!!t[4],o=!!t[5],a=t[3];let s,l,c,u,h=t[6],d=t[7],f=t[1],p=t[2];if("a"===t[0]&&(h+=e,d+=n),e===d&&n===d)return i;if(!f||!p)return i.push({x:h,y:d}),i;({cx:s,cy:l,rx:f,ry:p,sweepAngle:c,startAngle:u}=function(t,e,n,i,r,o,a,s,l){let c,u,h,d,f,p;const g=Nu(n%360),m=Math.cos(g),y=Math.sin(g),x=(s-o)/2,v=(l-a)/2,b=m*x+y*v,w=m*v-y*x;p=b**2/(t=Math.abs(t))**2+w**2/(e=Math.abs(e))**2,p>1&&(p=Math.sqrt(p),t*=p,e*=p);const M=t*w,k=e*b,_=M**2+k**2,S=(t*e)**2-_;let N=Math.sqrt(Math.max(S/_,0));i===r&&(N=-N);const R=N*(M/e),A=N*(-k/t);d=m*R-y*A+(s+o)/2,f=y*R+m*A+(l+a)/2;const C=(b-R)/t,D=(w-A)/e,O=(-b-R)/t,z=(-w-A)/e;return c=Math.atan2(D,C),c+=c<0?im:0,u=Math.atan2(z,O),u+=u<0?im:0,h=u-c,!r&&c<u?h-=im:r&&u<c&&(h+=im),h%=im,{startAngle:c,sweepAngle:h,cx:d,cy:f,rx:t,ry:e}}(f,p,a,r,o,h,d,e,n));const g=Math.abs(c*Math.sqrt((f**2+p**2)/2)),m=Math.ceil(g/10),y=c/m;for(let t=1;t<=m;t++){const e=(u+y*t)%im,n=Math.cos(e),r=Math.sin(e);i.push({x:s+n*f+-r*n,y:l+r*p+n*r})}return i}function cm(t){const e=nm(t),n=[],i=[];let r=0,o=0,a=null,s=null,l=null,c=null;for(let t=0;t<e.length;++t){const u=e[t],h=u[0];switch("S"!==h&&"s"!==h&&"C"!==h&&"c"!==h&&(a=null,s=null),"T"!==h&&"t"!==h&&"Q"!==h&&"q"!==h&&(l=null,c=null),h){case"m":i.length&&n.push(i.splice(0));case"l":r+=u[1],o+=u[2],i.push({x:r,y:o});break;case"M":i.length&&n.push(i.splice(0));case"L":r=u[1],o=u[2],i.push({x:r,y:o});break;case"H":r=u[1],i.push({x:r,y:o});break;case"h":r+=u[1],i.push({x:r,y:o});break;case"V":o=u[1],i.push({x:r,y:o});break;case"v":o+=u[1],i.push({x:r,y:o});break;case"a":i.push(...lm(u,r,o)),r+=u[6],o+=u[7];break;case"A":i.push(...lm(u,r,o)),r=u[6],o=u[7];break;case"c":i.push(...am({x:r,y:o},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o},{x:u[5]+r,y:u[6]+o})),a=u[3]+r,s=u[4]+o,r+=u[5],o+=u[6];break;case"C":i.push(...am({x:r,y:o},{x:u[1],y:u[2]},{x:u[3],y:u[4]},{x:u[5],y:u[6]})),a=u[3],s=u[4],r=u[5],o=u[6];break;case"s":null!==a&&null!==a||(a=r,s=o),i.push(...am({x:r,y:o},{x:2*r-a,y:2*o-s},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o})),a=u[1]+r,s=u[2]+o,r+=u[3],o+=u[4];break;case"S":null!==a&&null!==a||(a=r,s=o),i.push(...am({x:r,y:o},{x:2*r-a,y:2*o-s},{x:u[1],y:u[2]},{x:u[3],y:u[4]})),a=u[1],s=u[2],r=u[3],o=u[4];break;case"Q":i.push(...sm({x:r,y:o},{x:u[1],y:u[2]},{x:u[3],y:u[4]})),l=u[1],c=u[2],r=u[3],o=u[4];break;case"q":i.push(...sm({x:r,y:o},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o})),l=u[1]+r,c=u[2]+o,r+=u[3],o+=u[4];break;case"T":null!==l&&null!==l||(l=r,c=o),l=2*r-l,c=2*o-c,i.push(...sm({x:r,y:o},{x:l,y:c},{x:u[1],y:u[2]})),r=u[1],o=u[2];break;case"t":null!==l&&null!==l||(l=r,c=o),l=2*r-l,c=2*o-c,i.push(...sm({x:r,y:o},{x:l,y:c},{x:u[1]+r,y:u[2]+o})),r+=u[1],o+=u[2];break;case"z":case"Z":i.length&&i.push({x:i[0].x,y:i[0].y})}}return function(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];Math.abs(n.x-i.x)<1e-12&&Math.abs(n.y-i.y)<1e-12&&(t.splice(e,1),e--)}}(i),n.push(i.splice(0)),n}const um={require:["renderer","chart"],defaultSettings:{settings:{target:"",fill:"transparent",stroke:"lime",opacity:1,radius:2,useOuterRect:!1}},on:{update(){this.draw()}},draw(){const t=this.chart.findShapes("path").filter((t=>t.key===this.props.target)),e=[];t.forEach((t=>{cm(t.attrs.d).forEach((t=>{t.forEach((t=>{e.push({type:"circle",cx:t.x,cy:t.y,r:this.props.radius,fill:this.props.fill,stroke:this.props.stroke,opacity:this.props.opacity,collider:{type:null}})}))}))})),this.renderer.render(e)},created(){this.props=this.settings.settings},resize(t){let{outer:e,inner:n}=t;return this.props.useOuterRect?e:n},render(){},mounted(){this.draw()},updated(){this.props=this.settings.settings,this.draw()}};var hm=[function(t){t.component("box",hd),t.component("box-marker",hd)},function(t){t.component("point",xd),t.component("point-marker",xd)},function(t){t.component("pie",Md)},function(t){t.component("grid-line",Rd)},function(t){t.component("ref-line",Ld)},function(t){t.component("axis",pf)},function(t){t.component("container",gf)},function(t){t.component("text",xf)},function(t){t.component("scrollbar",wf)},function(t){t.component("brush-range",Pf),t.component("brush-area-dir",Ff)},function(t){t.component("range",Hf)},function(t){t.component("brush-lasso",Kf)},function(t){t.component("labels",cg)},function(t){t.component("legend-cat",Mg)},function(t){t.component("legend-seq",Ag)},function(t){t.component("line",zg)},function(t){t.component("brush-area",Pg)},function(t){t.component("tooltip",Zg)},function(t){t.component("debug-collider",Jg)},function(t){t.component("debug-path-to-points",um)}];class dm{constructor(t){this._parent=null,this._children=[],this._ancestors=null,this.type=t,this.data=null}detach(){return this._parent&&this._parent.removeChild(this),this}get parent(){return this._parent}get isBranch(){return this._children&&this._children.length}get children(){return this._children}get ancestors(){return this._ancestors||(this._ancestors=[],this.parent&&this._ancestors.push(this.parent,...this.parent.ancestors)),this._ancestors}get descendants(){let t=[];const e=this.children.length;let n,i;for(n=0;n<e;n++)i=this.children[n],t.push(i),i.children.length&&(t=[...t,...i.descendants]);return t}equals(t){const e=this.children,n=t.children;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!e[t].equals(n[t]))return!1;return!0}toJSON(){return{type:this.type,children:this.children.map((t=>t.toJSON()))}}}class fm{constructor(){let{x:t=0,y:e=0,width:n=0,height:i=0,minWidth:r=0,minHeight:o=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({x:t,y:e,width:n,height:i,minWidth:r,minHeight:o})}set(){let{x:t=0,y:e=0,width:n=0,height:i=0,minWidth:r=0,minHeight:o=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="rect",n>=0?(this.x=t,this.width=Math.max(n,r)):(this.x=t+Math.min(n,-r),this.width=-Math.min(n,-r)),i>=0?(this.y=e,this.height=Math.max(i,o)):(this.y=e+Math.min(i,-o),this.height=-Math.min(i,-o))}containsPoint(t){return hh(this,t)}intersectsLine(t){return dh(this,nr(t))}intersectsRect(t){return ch(this,er(t))}intersectsCircle(t){return ih(t,this)}intersectsPolygon(t){return lh(t,this)}intersectsGeoPolygon(t){return bh(t,this)}points(){return[{x:this.x,y:this.y},{x:this.x+this.width,y:this.y},{x:this.x+this.width,y:this.y+this.height},{x:this.x,y:this.y+this.height}]}}class pm{constructor(){let{cx:t=0,cy:e=0,r:n=0,minRadius:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({cx:t,cy:e,r:n,minRadius:i})}set(){let{cx:t=0,cy:e=0,r:n=0,minRadius:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="circle",this.cx=t,this.cy=e,this.r=Math.max(n,i),this.vector={x:this.cx,y:this.cy}}containsPoint(t){return nh(this,t)}intersectsLine(t){return rh(this,nr(t))}intersectsRect(t){return ih(this,er(t))}intersectsCircle(t){return n=t,!Ju(e=this)&&!Ju(n)&&(e.cx-n.cx)**2+(e.cy-n.cy)**2<=(e.r+n.r)**2;var e,n}intersectsPolygon(t){return oh(this,t)}intersectsGeoPolygon(t){return yh(this,t)}points(){return[{x:this.cx,y:this.cy}]}}class gm{constructor(){let{x1:t=0,y1:e=0,x2:n=0,y2:i=0,tolerance:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({x1:t,y1:e,x2:n,y2:i,tolerance:r})}set(){let{x1:t=0,y1:e=0,x2:n=0,y2:i=0,tolerance:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="line",this.x1=t,this.y1=e,this.x2=n,this.y2=i,this.tolerance=Math.max(0,Math.round(r)),this.vectors=this.points(),this.zeroSize=t===n&&e===i}containsPoint(t){if(this.tolerance>0){return rh({cx:t.x,cy:t.y,r:this.tolerance},this)}return ph(this,t)}intersectsLine(t){return fh(this,nr(t))}intersectsRect(t){return dh(er(t),this)}intersectsCircle(t){return rh(t,this)}intersectsPolygon(t){return sh(t,this)}intersectsGeoPolygon(t){return vh(t,this)}points(){return[{x:this.x1,y:this.y1},{x:this.x2,y:this.y2}]}}class mm{constructor(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({vertices:t})}set(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.type="polygon",this.vertices=t.slice(),this.edges=[],function(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];n.x===i.x&&n.y===i.y&&(t.splice(e,1),e--)}}(this.vertices),!(this.vertices.length<=2)){!function(t){const e=t[0],n=t[t.length-1];e.x===n.x&&e.y===n.y||t.push(e)}(this.vertices),this.xMin=NaN,this.yMin=NaN,this.xMax=NaN,this.yMax=NaN;for(let t=0;t<this.vertices.length;t++)t<this.vertices.length-1&&this.edges.push([this.vertices[t],this.vertices[t+1]]),this.xMin=isNaN(this.xMin)?this.vertices[t].x:Math.min(this.xMin,this.vertices[t].x),this.xMax=isNaN(this.xMax)?this.vertices[t].x:Math.max(this.xMax,this.vertices[t].x),this.yMin=isNaN(this.yMin)?this.vertices[t].y:Math.min(this.yMin,this.vertices[t].y),this.yMax=isNaN(this.yMax)?this.vertices[t].y:Math.max(this.yMax,this.vertices[t].y);this._bounds=null,this._boundingRect=null}}containsPoint(t){return ah(this,t)}intersectsCircle(t){return oh(t,this)}intersectsLine(t){return sh(this,nr(t))}intersectsRect(t){return lh(this,er(t))}intersectsPolygon(t){return gh(this,t)}intersectsGeoPolygon(t){return mh(t,this)}points(){return this.vertices}bounds(){return this._bounds||(this._bounds=[{x:this.xMin,y:this.yMin},{x:this.xMax,y:this.yMin},{x:this.xMax,y:this.yMax},{x:this.xMin,y:this.yMax}]),this._bounds}boundingRect(){return this._boundingRect||(this._boundingRect={x:this.xMin,y:this.yMin,width:this.xMax-this.xMin,height:this.yMax-this.yMin}),this._boundingRect}}function ym(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new mm(...e)}function xm(t){const e=t[0],n=t[t.length-1];e.x===n.x&&e.y===n.y||t.push(e)}function vm(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];n.x===i.x&&n.y===i.y&&(t.splice(e,1),e--)}}class bm{constructor(){let{vertices:t=[[]]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({vertices:t})}set(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="geopolygon",this.vertices=t.slice(),this.numPolygons=this.vertices.length,this.polygons=[],this.xMin=NaN,this.yMin=NaN,this.xMax=NaN,this.yMax=NaN;for(let t=0;t<this.numPolygons;t++)vm(this.vertices[t]),this.vertices[t].length>2&&xm(this.vertices[t]),this.polygons[t]=ym({vertices:this.vertices[t]}),this.xMin=isNaN(this.xMin)?this.polygons[t].xMin:Math.min(this.xMin,this.polygons[t].xMin),this.xMax=isNaN(this.xMax)?this.polygons[t].xMax:Math.max(this.xMax,this.polygons[t].xMax),this.yMin=isNaN(this.yMin)?this.polygons[t].yMin:Math.min(this.yMin,this.polygons[t].yMin),this.yMax=isNaN(this.yMax)?this.polygons[t].yMax:Math.max(this.yMax,this.polygons[t].yMax);this._bounds=null,this._boundingRect=null}containsPoint(t){return xh(this,t)}intersectsCircle(t){return yh(t,this)}intersectsLine(t){return vh(this,nr(t))}intersectsRect(t){return bh(this,er(t))}intersectsPolygon(t){return mh(this,t)}intersectsGeoPolygon(t){return function(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!ch(n,i)&&(uh(i,n)?eh(e,t):eh(t,e))}(this,t)}points(){return this.vertices}bounds(){return this._bounds||(this._bounds=[{x:this.xMin,y:this.yMin},{x:this.xMax,y:this.yMin},{x:this.xMax,y:this.yMax},{x:this.xMin,y:this.yMax}]),this._bounds}boundingRect(){return this._boundingRect||(this._boundingRect={x:this.xMin,y:this.yMin,width:this.xMax-this.xMin,height:this.yMax-this.yMin}),this._boundingRect}}function wm(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new bm(...e)}class Mm{constructor(){let{points:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({points:t})}set(){let{points:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.type="polyline",this.segments=[],this._points=t.slice(),this._points.length>1)for(let t=0,i=this._points.length-1;t<i;t++)e=this._points[t],n=this._points[t+1],(e.x!==n.x||e.y!==n.y)&&this.segments.push({x1:this._points[t].x,y1:this._points[t].y,x2:this._points[t+1].x,y2:this._points[t+1].y});var e,n}containsPoint(t){return this.segments.some((e=>ph(e,t)))}intersectsCircle(t){return this.segments.some((e=>rh(t,e)))}intersectsLine(t){const e=nr(t);return this.segments.some((t=>fh(t,e)))}intersectsRect(t){const e=er(t);return this.segments.some((t=>dh(e,t)))}intersectsPolygon(t){return this.segments.some((e=>sh(t,e)))}intersectsGeoPolygon(t){return this.segments.some((e=>vh(t,e)))}points(){return this._points}}const km=so();function _m(t,e){return km.get(t)(e)}km.add("rect",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new fm(...e)})),km.add("circle",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new pm(...e)})),km.add("line",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new gm(...e)})),km.add("polygon",ym),km.add("geopolygon",wm),km.add("polyline",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Mm(...e)}));class Sm{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.set(t)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.geometries=[],t.forEach((t=>{const e=_m(t.type,t);e&&this.geometries.push(e)}))}containsPoint(t){return this.geometries.some((e=>e.containsPoint(t)))}intersectsLine(t){return this.geometries.some((e=>e.intersectsLine(t)))}intersectsRect(t){return this.geometries.some((e=>e.intersectsRect(t)))}intersectsCircle(t){return this.geometries.some((e=>e.intersectsCircle(t)))}intersectsPolygon(t){return this.geometries.some((e=>e.intersectsPolygon(t)))}intersectsGeoPolygon(t){return this.geometries.some((e=>e.intersectsGeoPolygon(t)))}}class Nm{constructor(){this._elements=[[1,0,0],[0,1,0],[0,0,1]],this._stack=[]}clone(){return(new Nm).multiply(this)}set(t){return this._elements=t,this}save(){return this._stack.push(this.elements),this}restore(){return this._stack.length&&(this._elements=this._stack.pop()),this}add(t){let e,n;for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)this._elements[e][n]+=t;return this}translate(t,e){return this.multiply([[1,0,t],[0,1,e],[0,0,1]]),this}rotate(t){let e=Math.cos(-t),n=Math.sin(-t);return this.multiply([[e,n,0],[-n,e,0],[0,0,1]]),this}multiply(t){let e,n,i,r;if(t instanceof Nm&&(t=t._elements),Array.isArray(t)){for(i=[[0,0,0],[0,0,0],[0,0,0]],e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)for(r=0;r<3;r++)i[e][n]+=this._elements[e][r]*t[r][n];this._elements=i}else for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)this._elements[e][n]*=t;return this}scale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return this.multiply([[t,0,0],[0,e,0],[0,0,1]]),this}transform(t,e,n,i,r,o){return this.multiply([[t,n,r],[e,i,o],[0,0,1]]),this}determinant(){let t=this._elements[0][0],e=this._elements[0][1],n=this._elements[0][2],i=this._elements[1][0],r=this._elements[1][1],o=this._elements[1][2],a=this._elements[2][0],s=this._elements[2][1],l=this._elements[2][2],c=0;return c=t*r*l+e*o*a+n*i*s-n*r*a-e*i*l-t*o*s,c}invert(){let t=this.determinant(),e=this._elements[0][0],n=this._elements[0][1],i=this._elements[0][2],r=this._elements[1][0],o=this._elements[1][1],a=this._elements[1][2],s=this._elements[2][0],l=this._elements[2][1],c=this._elements[2][2];return this._elements=[[o*c-a*l,i*l-n*c,n*a-i*o],[a*s-r*c,e*c-i*s,i*r-e*a],[r*l-o*s,s*n-e*l,e*o-n*r]],this.multiply(1/t),this}transpose(){const t=Object.create(this._elements);return this._elements=[[t[0][0],t[1][0],t[2][0]],[t[0][1],t[1][1],t[2][1]],[t[0][2],t[1][2],t[2][2]]],this}identity(){return this._elements=[[1,0,0],[0,1,0],[0,0,1]],this}toString(){return"".concat(this._elements.map((t=>t.join("\t"))).join("\n"))}isIdentity(){const t=this._elements;return 1===t[0][0]&&0===t[0][1]&&0===t[0][2]&&0===t[1][0]&&1===t[1][1]&&0===t[1][2]&&0===t[2][0]&&0===t[2][1]&&1===t[2][2]}transformPoint(t){let e,n,i=[t.x,t.y,1],r=this._elements,o=[0,0,0];for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)o[e]+=i[n]*r[e][n];return{x:o[0],y:o[1]}}transformPoints(t){let e,n,i,r,o,a=this._elements,s=[];for(r=0;r<t.length;r++){for(e=[t[r].x,t[r].y,1],o=[0,0,0],n=0;n<this._elements.length;n++)for(i=0;i<this._elements[n].length;i++)o[n]+=e[i]*a[n][i];s.push({x:o[0],y:o[1]})}return s}get elements(){const t=this._elements;return[[t[0][0],t[0][1],t[0][2]],[t[1][0],t[1][1],t[1][2]],[t[2][0],t[2][1],t[2][2]]]}}const Rm=/(translate|scale|rotate|matrix)\(([0-9,.eE+-\s]+)(?:,|\s?)+\)/g;function Am(t,e){const n=e.args[0]*(Math.PI/180);if(e.args.length>2){const i=e.args[1],r=e.args[2];t.translate(i,r),t.rotate(n),t.translate(-i,-r)}else 1===e.args.length&&t.rotate(n)}function Cm(t,e){const n=e.args[0],i=isNaN(e.args[1])?e.args[0]:e.args[1];t.scale(n,i)}function Dm(t,e){const n=e.args[0],i=isNaN(e.args[1])?0:e.args[1];t.translate(n,i)}function Om(t,e){e.args.length>=6&&t.transform(...e.args)}function zm(t,e){const n=function(t){let e,n=[];for(;null!==(e=Rm.exec(t));){const t=e[2].trim(),i=-1===t.indexOf(",")?t.split(" "):t.split(",");n.push({cmd:e[1],args:i.filter((t=>t.trim().length>0)).map((t=>Number(t)))})}return n}(t);let i;for(let t=0,r=n.length;t<r;t++)i=n[t],"rotate"===i.cmd?Am(e,i):"scale"===i.cmd?Cm(e,i):"matrix"===i.cmd?Om(e,i):"translate"===i.cmd&&Dm(e,i)}const Em={type:/^\w[\w-]+/,attr:/^\[\w(?:[\w\._-]+)?(?:[!]?=['\"][\w\s*#_-]*['\"])?\]/,universal:/^(\*)/,tag:/^\.(\w+)/},Im={type:(t,e)=>e.filter((e=>{const n=e.type;return!!n&&n.toLowerCase()===t.toLowerCase()})),attr:(t,e,n,i)=>i.filter((i=>{const r=i.attrs[t];if(!e)return void 0!==r;if(void 0===r)return!1;switch(e){case"=":return n===String(r);case"!=":return n!==String(r);default:return!1}})),universal:t=>t,tag:(t,e)=>e.filter((e=>{const n=e.tag;return!!n&&-1!==n.trim().split(/\s+/).indexOf(t.replace(".",""))}))};function Tm(t,e){if(!e||!e.length||!t||"function"!=typeof Im[t.type])return[];switch(t.type){case"type":case"tag":return Im[t.type](t.value,e);case"attr":return Im[t.type](t.attribute,t.operator,t.attributeValue,e);case"universal":return Im[t.type](e);default:return[]}}var Pm={find:function(t,e){const n=[],i=[];let r,o;if(e.isBranch){let a;r=function(t){const e=[];let n,i,r,o;return t.split(/\s*,\s*/).forEach((t=>{t=t.trim(),n=[];const a=e=>{r=t.match(Em[e]),r&&(o=!0,t=t.slice(r[0].length),i={type:e,value:r[0]},"attr"===e&&(r=r[0].match(/\[(\w[\w\._-]+)?(?:([!]?=)['\"]([\w\s#_-]*)['\"])?\]/),i.attribute=r[1],i.operator=r[2],i.attributeValue=r[3]),n.push(i))};for(;t&&(o=!1,r=t.match(/^\s*([>+~]|\s)\s*/),r&&(o=!0,n.push({type:" ",value:r[0]}),t=t.slice(r[0].length)),Object.keys(Em).forEach(a),n&&n.length&&e.indexOf(n)<0&&e.push(n),o););})),e}(t),o=e.descendants;for(let t=0,e=r.length;t<e;t++){a=r[t];const e=[];let n=o.slice(),s=!1;a.reverse().forEach((t=>{if(" "===t.type)return e.push(n),n=o.slice(),void(s=!1);n=Tm(t,n),s=!0})),s&&e.push(n);const l=e[0].filter((t=>{let n,i=t.parent;for(let t=1;t<e.length;t++){for(n=e[t].indexOf(i);i&&n<0;)i=i.parent,n=e[t].indexOf(i);if(n<0)return!1}return!0}));i.push(l)}for(let t=0,e=i.length;t<e;t++)for(let e=0,r=i[t].length;e<r;e++)n.indexOf(i[t][e])<0&&n.push(i[t][e])}return n||[]}};function qm(t,e,n){const i=t.type;let r=t.points();n&&(r=r.every((t=>Array.isArray(t)))?r.map((t=>n.transformPoints(t))):n.transformPoints(r)),function(t,e){for(let n=0,i=t.length;n<i;n++)t[n].x/=e,t[n].y/=e}(r,e);let o=null;if("rect"===i||"bounds"===i)o=er(r),o.type=i;else if("circle"===i)o=function(t,e){return{cx:t[0].x,cy:t[0].y,r:e}}(r,t.r),o.type=i;else if("line"===i)o=nr(r),o.type=i;else if("polygon"===i||"polyline"===i){o={type:"path",d:_u(r,"polygon"===i)}}else if("geopolygon"===i){let t="";for(let e=0;e<r.length;e++)t+=_u(r[e],!0);o={type:"path",d:t}}return o}class Lm{constructor(t){this._bounds=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{x:n,y:i,width:r,height:o}=t.boundingRect?t.boundingRect(e):{x:0,y:0,width:0,height:0};return{x:n,y:i,width:r,height:o}},this._attrs=t.attrs,this._type=t.type,this._data=t.data,this._dpi=t.stage?t.stage.dpi:1,this._collider=()=>function(t,e){if(t.collider){const n=t.modelViewMatrix;return"collection"===t.colliderType?{type:"container",children:t.collider.geometries.map((t=>qm(t,e,n)))}:qm(t.collider,e,n)}return null}(t,this._dpi),this._desc=t.desc,this._tag=t.tag,this._children=()=>t.children.map((t=>new Lm(t))),this._parent=()=>t.parent?new Lm(t.parent):null,this._cache={elementBoundingRect:null},this._getElementBoundingRect=()=>(!this._cache.elementBoundingRect&&this.element&&(this._cache.elementBoundingRect=this.element.getBoundingClientRect()),this._cache.elementBoundingRect||{left:0,top:0})}get children(){return this._children()}get parent(){return this._parent()}get type(){return this._type}get data(){return this._data}get attrs(){return this._attrs}set element(t){this._cache.elementBoundingRect=null,this._element=t}get element(){return this._element}set key(t){this._key=t}get key(){return this._key}get bounds(){const t=this._bounds();return t.x/=this._dpi,t.y/=this._dpi,t.width/=this._dpi,t.height/=this._dpi,t}get localBounds(){return this._bounds(!1)}boundsRelativeTo(t){const e=typeof t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?this.bounds:this.localBounds,i=this._getElementBoundingRect();let r=i.left,o=i.top;if("object"===e&&null!==t&&"function"==typeof t.getBoundingClientRect){const{left:e=0,top:n=0}=t.getBoundingClientRect();r-=e,o-=n}return n.x+=r,n.y+=o,n}get collider(){return this._collider()}get desc(){return this._desc}get tag(){return this._tag}}function jm(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Lm(...e)}class Fm{constructor(t){this._node=jm(t),this._parent=null,this._input=null}get node(){return this._node}set parent(t){this._parent=t}get parent(){return this._parent}set input(t){this._input=t}get input(){return this._input}}function Bm(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Fm(...e)}function Vm(t,e){const n=t.parent;if(n&&"stage"!==n.type){e.parent=Bm(n);const t=n.parent;t&&"stage"!==t.type&&Vm(t,e.parent)}}function $m(t,e,n){if(null===t.colliderType)return null;const i=function(t,e){let n={};if(t.modelViewMatrix)if(Array.isArray(e))n=t.inverseModelViewMatrix.transformPoints(e);else if(isNaN(e.r))Array.isArray(e.vertices)?n.vertices=t.inverseModelViewMatrix.transformPoints(e.vertices):n=t.inverseModelViewMatrix.transformPoint(e);else{const i={x:e.cx,y:e.cy};({x:n.cx,y:n.cy}=t.inverseModelViewMatrix.transformPoint(i)),n.r=e.r}else n=e;return Array.isArray(n.vertices)&&(n=n.vertices.every((t=>Array.isArray(t)))?wm(n):ym(n)),n}(t,n);return"frontChild"===t.colliderType?function(t,e,n){for(let i=t.descendants.length-1;i>=0;i--){const r=t.descendants[i];if(null!==r.collider&&r.collider[e](n)){const t=Bm(r);return Vm(r,t),t}}return null}(t,e,i):function(t,e,n){if(t.collider[e](n)){const e=Bm(t);return Vm(t,e),e}return null}(t,e,i)}function Hm(t,e,n,i){const r=t.length;for(let o=0;o<r;o++){const r=t[o],a=$m(r,e,i);a&&n.push(a),!r.children||a||r.collider||Hm(r.children,e,n,i)}}function Wm(t,e,n){const i=t.length;for(let r=0;r<i;r++){const i=t[r];if(null!==$m(i,e,n))return!0;if(i.children&&!i.collider)return Wm(i.children,e,n)}return!1}function Um(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;let n={};switch(ir(t)){case"circle":return n.cx=t.cx*e,n.cy=t.cy*e,n.r=t.r,["intersectsCircle",n];case"rect":return n=tr(t).map((t=>Du(t,e))),["intersectsRect",n];case"line":return n=Qi(t).map((t=>Du(t,e))),["intersectsLine",n];case"point":return n=Du(t,e),["containsPoint",n];case"polygon":return n.vertices=t.vertices.map((t=>Du(t,e))),["intersectsPolygon",n];case"geopolygon":return n.vertices=t.vertices.map((t=>t.map((t=>Du(t,e))))),["intersectsGeoPolygon",n];default:return[]}}function Ym(t,e){const[n,i]=Um(e,t.dpi),r=[];return n&&(Hm([t],n,r,i),function(t,e){for(let n=0,i=e.length;n<i;n++)e[n].input=t}(e,r)),r}function Xm(t,e){const[n,i]=Um(e,t.dpi);return Wm([t],n,i)}class Gm extends dm{constructor(t){super(t),this._stage=null,this._collider={type:null,definition:null,fn:null},this._attrs={},this._node=null}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.node=t;const{data:e,desc:n,tag:i,strokeReference:r,fillReference:o}=t;var a,s;a=this.attrs,s=t,Object.keys(ku).forEach((t=>{const e=s[t];void 0!==e&&(a[ku[t]]=e)})),void 0!==e&&(this.data=e),"object"==typeof n&&(this.desc=Hi(!0,{},n)),"string"==typeof i&&(this.tag=i),"string"==typeof r&&(this.strokeReference=r),"string"==typeof o&&(this.fillReference=o)}findShapes(t){return Pm.find(t,this).map((t=>jm(t)))}getItemsFrom(t){return Ym(this,t)}containsPoint(t){return Xm(this,t)}intersectsLine(t){return Xm(this,t)}intersectsRect(t){return Xm(this,t)}intersectsCircle(t){return Xm(this,t)}intersectsPolygon(t){return Xm(this,t)}intersectsGeoPolygon(t){return Xm(this,t)}resolveLocalTransform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Nm;void 0!==this.attrs.transform&&zm(this.attrs.transform,t),this.modelViewMatrix=t.clone()}resolveGlobalTransform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Nm;const e=this.ancestors;if(e.length>0)for(let n=e.length-1;n>=0;n--)e[n].resolveLocalTransform(t),t=e[n].modelViewMatrix;this.resolveLocalTransform(t)}attr(t){return this.attrs[t]}equals(t){const e=this.attrs,n=Object.keys(e),i=t.attrs,r=Object.keys(i);if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++){const r=n[t];if(!Object.hasOwnProperty.call(i,r))return!1;if(e[r]!==i[r])return!1}return super.equals(t)}toJSON(){const t=super.toJSON();return t.attrs=this.attrs,t}get attrs(){return this._attrs}get stage(){return this._parent&&!this._stage?this._stage=this._parent.stage:this._parent||this._stage===this||(this._stage=null),this._stage}set modelViewMatrix(t){this._mvm=t,this._imvm=null}get modelViewMatrix(){return this._mvm}get inverseModelViewMatrix(){return this._imvm=this._imvm?this._imvm:this._mvm.clone().invert(),this._imvm}set node(t){this._node=t}get node(){return this._node}set collider(t){const e=Array.isArray(t)?"collection":t&&t.type;return"string"!=typeof e?(this._collider.type=null,this._collider.definition=null,void(this._collider.fn=null)):null!==this._collider&&this._collider.type===e&&null!==this._collider.fn?(this._collider.fn.set(t),void(this._collider.definition=t)):(this._collider.type=e,void(this._collider.definition=t))}get collider(){if(null!==this._collider.fn)return this._collider.fn;switch(this._collider.type){case"collection":this._collider.fn=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Sm(...e)}(this._collider.definition);break;case"frontChild":return!0;case"bounds":this._collider.fn=_m("rect",this.boundingRect());break;case"line":case"rect":case"circle":case"polygon":case"geopolygon":case"polyline":this._collider.fn=_m(this._collider.type,this._collider.definition);break;default:return null}return this._collider.fn}get colliderType(){return this._collider.type}}class Km extends dm{addChild(t){if(!(t&&t instanceof dm))throw new TypeError("Expecting a Node as argument, but got ".concat(t));if(t===this)throw new Error("Can not add itself as child!");if(t._children&&t._children.length&&this.ancestors.indexOf(t)>=0)throw new Error("Can not add an ancestor as child!");return t._parent&&t._parent!==this&&t._parent.removeChild(t),this._children.push(t),t._parent=this,t._ancestors=null,this}addChildren(t){let e,n=t?t.length:0;for(e=0;e<n;e++)this.addChild(t[e]);return this}removeChild(t){const e=this._children.indexOf(t);return e>=0&&(this._children.splice(e,1),t._parent=null,t._ancestors=null),this}removeChildren(t){let e,n;if(!this._children)return this;if(t)for(n=t.length,e=0;e<n;e++)this.removeChild(t[e]);else for(;this._children.length;)this.removeChild(this._children[0]);return this}}const Zm=Km.prototype;class Jm extends Gm{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const{collider:e}=t,n=Hi({type:null},e);this.collider=n,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}appendChildRect(t,e){if(void 0!==t.bounds){const n=this.__boundingRect[e]||{},[i,,r]=t.bounds(e),{x:o,y:a}=i,{x:s,y:l}=r,c=isNaN(n.width)?s:Math.max(s,n.width+n.x),u=isNaN(n.height)?l:Math.max(l,n.height+n.y);n.x=isNaN(n.x)?o:Math.min(o,n.x),n.y=isNaN(n.y)?a:Math.min(a,n.y),n.width=c-n.x,n.height=u-n.y,this.__boundingRect[e]=n}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=this.children.length;for(let n=0;n<e;n++)this.appendChildRect(this.children[n],t);return this.__boundingRect[t]=Hi({x:0,y:0,width:0,height:0},this.__boundingRect[t]),this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}addChild(t){const e=Zm.addChild.call(this,t);if(this._collider&&"bounds"===this._collider.type){this.appendChildRect(t,!0);const e=Hi({type:"bounds",x:0,y:0,width:0,height:0},this.__boundingRect.true);this.collider=e}return e}addChildren(t){const e=Zm.addChildren.call(this,t),n=t.length;if(this._collider&&"bounds"===this._collider.type&&n>0){for(let e=0;e<n;e++)this.appendChildRect(t[e],!0);const e=Hi({type:"bounds",x:0,y:0,width:0,height:0},this.__boundingRect.true);this.collider=e}return e}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;if(Zm.removeChild.call(this,t),this._collider&&"bounds"===this._collider.type){this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null};const t=Hi(this.boundingRect(!0),{type:"bounds"});this.collider=t}return this}removeChildren(t){if(Zm.removeChildren.call(this,t),this._collider&&"bounds"===this._collider.type){this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null};const t=Hi(this.boundingRect(!0),{type:"bounds"});this.collider=t}return this}}function Qm(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Jm(...e)}class ty extends Jm{constructor(t){super("stage"),this._stage=this,this._dpiRatio=t||1}get dpi(){return this._dpiRatio}}const ey=Km.prototype,ny=["x1","x2","y1","y2","id","offset","style"];class iy extends Gm{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t),this._boundingRect={}}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const e=this.attrs;let n="";for(let i=0,r=ny.length;i!==r;i++)n=ny[i],void 0!==t[n]&&(e[n]=t[n])}addChild(t){return ey.addChild.call(this,t)}addChildren(t){return ey.addChildren.call(this,t)}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;return ey.removeChild.call(this,t),this}removeChildren(t){return ey.removeChildren.call(this,t),this}}function ry(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new iy(...e)}const oy=Km.prototype,ay=["patternUnits","x","y","width","height","id"];class sy extends Gm{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t),this._boundingRect={}}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const e=this.attrs;let n="";for(let i=0,r=ay.length;i!==r;i++)n=ay[i],void 0!==t[n]&&(e[n]=t[n])}addChild(t){return oy.addChild.call(this,t)}addChildren(t){return oy.addChildren.call(this,t)}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;return oy.removeChild.call(this,t),this}removeChildren(t){return oy.removeChildren.call(this,t),this}}class ly extends Gm{constructor(){super("rect"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x:e=0,y:n=0,width:i=0,height:r=0,rx:o=0,ry:a=0,collider:s}=t,l=Hi({type:"rect",x:e,y:n,width:i,height:r},s);super.set(t),i>=0?(this.attrs.x=e,this.attrs.width=i):(this.attrs.x=e+i,this.attrs.width=-i),r>=0?(this.attrs.y=n,this.attrs.height=r):(this.attrs.y=n+r,this.attrs.height=-r),o>0&&(this.attrs.rx=o),a>0&&(this.attrs.ry=a),this.collider=l,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=tr(this.attrs),n=t&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(e):e,[i,r,o,a]=Ji(n);return this.__boundingRect[t]={x:i,y:r,width:o-i,height:a-r},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}class cy extends Gm{constructor(){super("circle"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{cx:e=0,cy:n=0,r:i=0,collider:r}=t,o=Hi({type:"circle",cx:e,cy:n,r:i},r);super.set(t),this.attrs.cx=e,this.attrs.cy=n,this.attrs.r=i,this.collider=o,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=this.bounds(t);return this.__boundingRect[t]={x:e[0].x,y:e[0].y,width:e[2].x-e[0].x,height:e[2].y-e[0].y},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const{cx:e,cy:n,r:i,r:r}=this.attrs,o=e-i,a=n-r;let s=2*i,l=2*r,c=[{x:o,y:a},{x:o+s,y:a},{x:o+s,y:a+l},{x:o,y:a+l}];if(t&&this.modelViewMatrix){c=this.modelViewMatrix.transformPoints(c);const[e,n,i,r]=Ji(c);s=i-e,l=r-n,this.__bounds[t]=[{x:e,y:n},{x:e+s,y:n},{x:e+s,y:n+l},{x:e,y:n+l}]}else this.__bounds[t]=c;return this.__bounds[t]}}class uy extends Gm{constructor(){super("line"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x1:e=0,y1:n=0,x2:i=0,y2:r=0,collider:o}=t;super.set(t),this.attrs.x1=e,this.attrs.y1=n,this.attrs.x2=i,this.attrs.y2=r;const a={type:"line",x1:e,y1:n,x2:i,y2:r};this.collider=Hi(a,o),this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];let e=Qi(this.attrs);t&&this.modelViewMatrix&&(e=this.modelViewMatrix.transformPoints(e));const[n,i,r,o]=Ji(e),a=n!==r||i!==o;return this.__boundingRect[t]={x:n,y:i,width:a?Math.max(1,r-n):0,height:a?Math.max(1,o-i):0},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}const hy=Math.PI/2;function dy(t,e){const n=Math.atan2(e.y-t.y,e.x-t.x);return n<0?n+2*Math.PI:n}function fy(t,e,n){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}const py={step:function(t){return new eo(t,.5)},stepAfter:function(t){return new eo(t,1)},stepBefore:function(t){return new eo(t,0)},linear:zr,basis:function(t){return new Fr(t)},cardinal:$r.tension(0),catmullRom:Wr,monotonex:function(t){return new Kr(t)},monotoney:function(t){return new Zr(t)},natural:function(t){return new Qr(t)}};function gy(t){if(t.length<2)return!1;const e=t[0],n=t[t.length-1];return Math.abs(e.x-n.x)<1e-12&&Math.abs(e.y-n.y)<1e-12}class my extends Gm{constructor(){super("path"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(super.set(t),this.segments=[],this.points=[],t.arcDatum){const e=Dr();e.innerRadius(t.desc.slice.innerRadius),e.outerRadius(t.desc.slice.outerRadius),e.cornerRadius(t.desc.slice.cornerRadius);const n=e(t.arcDatum);this.attrs.d=n}else if(t.points){const{major:e,minor:n,layerObj:i,points:r,stngs:o,generatorType:a}=t,s=Tr(),l=o.coordinates?o.coordinates.defined:null;s[e.p]((t=>t.major*e.size))["".concat(n.p,"1")]((t=>t.minor*n.size))["".concat(n.p,"0")]((t=>t.minor0*n.size)).curve(py["monotone"===i.curve?"monotone".concat(e.p):i.curve]),l?s.defined((t=>!t.dummy&&"number"==typeof t.minor&&!isNaN(t.minor)&&t.defined)):s.defined((t=>!t.dummy&&"number"==typeof t.minor&&!isNaN(t.minor)));const c=o.connect?r.filter(s.defined()):r,u=("area"===a?s:s[a]())(c);this.attrs.d=u}else t.d&&(this.attrs.d=t.d);if(this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null},Array.isArray(t.collider)||"object"==typeof t.collider&&void 0!==t.collider.type)this.collider=t.collider;else if(this.attrs.d){if(this.segments=cm(this.attrs.d),this.segments.length>1&&this.segments.every((t=>gy(t))))return void(this.collider=Hi({type:"geopolygon",vertices:this.segments},t.collider));this.segments.forEach((e=>{if(e.length<=1);else if(gy(e))this.collider=Hi({type:"polygon",vertices:e},t.collider);else if("object"==typeof t.collider&&t.collider.visual){const n=this.attrs["stroke-width"]/2;this.collider=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],r=[];if("h"===n.forceOrientation){const e=t[0].x<t[1].x?-1:1,n=t[t.length-1].x>t[t.length-2].x?1:-1;t.unshift({x:t[0].x+e,y:t[0].y}),t.push({x:t[t.length-1].x+n,y:t[t.length-1].y})}else if("v"===n.forceOrientation){const e=t[0].y<t[1].y?-1:1,n=t[t.length-1].y>t[t.length-2].y?1:-1;t.unshift({x:t[0].x,y:t[0].y+e}),t.push({x:t[t.length-1].x,y:t[t.length-1].y+n})}const o=t.length-1;for(let n=1;n<o;n++){const a=t[n-1],s=t[n],l=t[n+1],c=dy(s,a),u=dy(s,l),h=(c+u)/2,d=h+Math.PI,f=Math.max(h,d),p=Math.min(h,d),g=c>u;if(1===n){const t=dy(a,s);i.push(fy(a,t-hy,e)),r.unshift(fy(a,t+hy,e))}const m=g?f:p,y=g?p:f;if(i.push(fy(s,m,e)),r.unshift(fy(s,y,e)),n===o-1){const t=dy(l,s);i.push(fy(l,t+hy,e)),r.unshift(fy(l,t-hy,e))}}return{type:"polygon",vertices:[...i,...r]}}(e,n,t.collider)}else this.collider=Hi({type:"polyline",points:e},t.collider)}))}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];this.points.length||(this.segments=this.segments.length?this.segments:cm(this.attrs.d),this.points=function(t){const e=[];let n,i=t.length;for(let r=0;r<i;r++){n=t[r];for(let t=0;t<n.length;t++)e.push(n[t])}return e}(this.segments));const e=t&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(this.points):this.points,[n,i,r,o]=Ji(e);return this.__boundingRect[t]={x:n||0,y:i||0,width:r-n||0,height:o-i||0},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}function yy(t){let{data:e,_boundingRect:n,_textBoundsFn:i}=t;return null!=e&&(n||i)}class xy extends Gm{constructor(){super("text"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x:e=0,y:n=0,dx:i=0,dy:r=0,textBoundsFn:o,text:a,title:s,collider:l,boundingRect:c,ellipsed:u}=t;super.set(t),this.attrs.x=e,this.attrs.y=n,this.attrs.dx=i,this.attrs.dy=r,this.attrs.text=a,void 0!==s&&(this.attrs.title=String(s)),"object"==typeof c?this._textBoundsFn=()=>c:"function"==typeof o&&(this._textBoundsFn=o),"string"==typeof u&&(this.ellipsed=u),this.collider=Hi({type:yy(this)?"bounds":null},l),this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[e])return this.__boundingRect[e];if("function"!=typeof this._textBoundsFn)return{x:0,y:0,width:0,height:0};t=this._textBoundsFn(this.attrs);const n=tr(t),i=e&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(n):n,[r,o,a,s]=Ji(i);return this.__boundingRect[e]={x:r,y:o,width:a-r,height:s-o},this.__boundingRect[e]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}const vy=so();function by(t,e){return vy.get(t)(e)}vy.add("rect",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new ly(...e)})),vy.add("circle",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new cy(...e)})),vy.add("text",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new xy(...e)})),vy.add("line",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new uy(...e)})),vy.add("path",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new my(...e)})),vy.add("stage",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new ty(...e)})),vy.add("container",Qm),vy.add("defs",Qm),vy.add("linearGradient",ry),vy.add("radialGradient",ry),vy.add("conicGradient",ry),vy.add("stop",ry),vy.add("pattern",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new sy(...e)}));const wy=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=[{}];function n(){return e[e.length-1]}return n.save=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=n(),o={};let a="";for(let e=0;e<t.length;e++)a=t[e],void 0!==r[a]&&(o[a]=r[a]);return Hi(o,i),e.push(o),n()},n.restore=function(){e.splice(e.length-1,1)},n}(["stroke","fill","strokeWidth","opacity","fontFamily","fontSize","baseline"]);function My(t,e){if(Array.isArray(e))for(let n=0,i=e.length;n<i;n++)e[n](t)}function ky(t,e,n){t.node=n[e],t.index=e}function _y(t,e,n,i){let r=!1;const o={siblings:t,node:null,index:0};for(let a=0,s=t.length;a<s;a++){if(ky(o,a,t),My(o,i.create),r="function"==typeof o.node.disabled?o.node.disabled():o.node.disabled,r)continue;o.node=wy.save(o.node);const s=by(o.node.type,o.node);s&&(o.node.transform&&(n.save(),zm(o.node.transform,n)),n.isIdentity()||(s.modelViewMatrix=n.clone()),e.addChild(s),o.node.children&&_y(o.node.children,s,n,i),o.node.transform&&n.restore()),wy.restore()}}function Sy(t){let{items:e,stage:n,dpi:i,on:r={}}=t;return n||(n=by("stage",i)),_y(e,n,new Nm,r),n}function Ny(t,e,n){const{orientation:i,degree:r,stops:o=[]}=n;let a=null;if("radial"===i){const n=e.boundingRect();a=t.createRadialGradient(n.x+n.width/2,n.y+n.height/2,1e-5,n.x+n.width/2,n.y+n.height/2,Math.max(n.width,n.height)/2)}else if("conic"===i){const e=n.startAngle||0,i=n.x||0,r=n.y||0;a=t.createConicGradient(e,i,r)}else{const i=Ru(r);["x1","x2","y1","y2"].forEach((t=>{t in n&&(i[t]=n[t])}));const o=e.boundingRect();a=t.createLinearGradient(o.x+i.x1*o.width,o.y+i.y1*o.height,o.x+i.x2*o.width,o.y+i.y2*o.height)}for(let t=0,e=o.length;t<e;t++){let e=o[t];a.addColorStop(e.offset,e.color)}return a}function Ry(t,e,n){return e.width=t.width,e.height=t.height,n.save(),n.fillStyle=t.fill,t.shapes.forEach((t=>{if("rect"===t.type)n.rect(t.x,t.y,t.width,t.height)})),n.fill(),n.restore(),n.createPattern(e,"repeat")}function Ay(){let{x:t,y:e,width:n,height:i,scaleRatio:r,margin:o,edgeBleed:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s={x:0,y:0,width:0,height:0,scaleRatio:{x:1,y:1},margin:{left:0,top:0},edgeBleed:{left:0,right:0,top:0,bottom:0,bool:!1}};return s.x=isNaN(t)?s.x:t,s.y=isNaN(e)?s.y:e,s.width=isNaN(n)?s.width:n,s.height=isNaN(i)?s.height:i,void 0!==r&&(s.scaleRatio.x=isNaN(r.x)?s.scaleRatio.x:r.x,s.scaleRatio.y=isNaN(r.y)?s.scaleRatio.y:r.y),void 0!==o&&(s.margin.left=isNaN(o.left)?0:o.left,s.margin.top=isNaN(o.top)?0:o.top),"object"==typeof a&&["left","right","top","bottom"].forEach((t=>{!isNaN(a[t])&&a[t]>0&&(s.edgeBleed[t]=a[t],s.edgeBleed.bool=!0)})),s.computedPhysical={x:Math.round(s.margin.left+(s.x-s.edgeBleed.left)*s.scaleRatio.x),y:Math.round(s.margin.top+(s.y-s.edgeBleed.top)*s.scaleRatio.y),width:Math.round((s.width+s.edgeBleed.left+s.edgeBleed.right)*s.scaleRatio.x),height:Math.round((s.height+s.edgeBleed.top+s.edgeBleed.bottom)*s.scaleRatio.y)},s}function Cy(){const t={element:()=>{},root:()=>{},settings:()=>{},appendTo:()=>{},getScene:()=>[],render:()=>!1,itemsAt:()=>[],findShapes:()=>[],clear:()=>{},destory:()=>{},size:()=>{},measureText:eg,textBounds:ig,setKey:e=>{t.element().setAttribute("data-key",e)}};return t}function Dy(t){return e=>{let{node:n}=e;"text"!==n.type||null==n.data||n.textBoundsFn||(n.textBoundsFn=t.textBounds)}}const Oy=200,zy=200;class Ey{constructor(t){this.targetCanvas=t,this.bufferCanvas=t.cloneNode()}updateSize(t){let e,{rect:n,dpiRatio:i,canvasBufferSize:r}=t;e=r?"function"==typeof r?r(n):r:{width:n.computedPhysical.width+2*Oy,height:n.computedPhysical.height+2*zy},this.bufferCanvas.style.width="".concat(e.width,"px"),this.bufferCanvas.style.height="".concat(e.height,"px"),this.bufferCanvas.width=Math.round(e.width*i),this.bufferCanvas.height=Math.round(e.height*i)}apply(){this.targetCanvas.getContext("2d").drawImage(this.bufferCanvas,0,0)}clear(){this.bufferCanvas.width=this.bufferCanvas.width}getContext(){return this.bufferCanvas.getContext("2d")}}const Iy=so();function Ty(t){return Array.isArray(t)?t:"string"==typeof t?-1!==t.indexOf(",")?t.split(","):t.split(" "):[]}function Py(t){return("undefined"==typeof window?1:window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}function qy(t,e){e.setTransform(t[0][0],t[1][0],t[0][1],t[1][1],t[0][2],t[1][2])}function Ly(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=Object.keys(i);for(let r=0,o=n.length;r<o;r++){let o=n[r];const a=o[0],s=o[1],l=o[2];if(a in e.attrs&&!(s in i)&&t[s]!==e.attrs[a]){const n=l?l(e.attrs[a]):e.attrs[a];"function"==typeof t[s]?t[s](n):t[s]=n}}for(let e=0,n=r.length;e<n;e++){const n=r[e];t[n]=i[n]}}function jy(t,e,n,i){for(let r=0,o=t.length;r<o;r++){let o=t[r],a={};e.save(),o.attrs&&(o.attrs.fill||o.attrs.stroke)&&(o.attrs.fill&&"object"==typeof o.attrs.fill&&"gradient"===o.attrs.fill.type?a.fillStyle=Ny(e,o,o.attrs.fill):o.attrs.fill&&"object"==typeof o.attrs.fill&&"pattern"===o.attrs.fill.type&&(a.fillStyle=i.patterns.create(o.attrs.fill)),o.attrs.stroke&&"object"==typeof o.attrs.stroke&&"gradient"===o.attrs.stroke.type?a.strokeStyle=Ny(e,o,o.attrs.stroke):o.attrs.stroke&&"object"==typeof o.attrs.stroke&&"pattern"===o.attrs.stroke.type&&(a.strokeStyle=i.patterns.create(o.attrs.stroke))),Ly(e,o,n,a),o.modelViewMatrix&&qy(o.modelViewMatrix.elements,e),Iy.has(o.type)&&Iy.get(o.type)(o.attrs,{g:e,doFill:"fill"in o.attrs&&"none"!==o.attrs.fill,doStroke:"stroke"in o.attrs&&0!==o.attrs["stroke-width"],ellipsed:o.ellipsed}),o.children&&jy(o.children,e,n,i),e.restore()}}function Fy(){let t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sy;const i={transform:void 0,canvasBufferSize:void 0,progressive:void 0};let r,o=!1,a=Ay();const s=[["fill","fillStyle"],["stroke","strokeStyle"],["opacity","globalAlpha"],["globalAlpha","globalAlpha"],["stroke-width","lineWidth"],["stroke-linejoin","lineJoin"],["stroke-dasharray","setLineDash",Ty]];let l;const c=Cy();return c.element=()=>t,c.root=()=>t,c.settings=t=>(t&&Object.keys(i).forEach((e=>{void 0!==t[e]&&(i[e]=t[e])})),i),c.appendTo=n=>(t||(t=n.ownerDocument.createElement("canvas"),t.style.position="absolute",t.style["-webkit-font-smoothing"]="antialiased",t.style["-moz-osx-font-smoothing"]="antialiased",t.style.pointerEvents="none"),"function"!=typeof i.transform||e||(e=new Ey(t)),n.appendChild(t),t),c.getScene=i=>{const r=Py(e&&e.getContext()||t.getContext("2d")),o=a.scaleRatio.x,s=a.scaleRatio.y,l={type:"container",children:i,transform:a.edgeBleed.bool?"translate(".concat(a.edgeBleed.left*r*o,", ").concat(a.edgeBleed.top*r*s,")"):""};return 1===r&&1===o&&1===s||(l.transform+="scale(".concat(r*o,", ").concat(r*s,")")),n({items:[l],dpi:r,on:{create:[Wp(c.measureText),Dy(c)]}})},c.render=n=>{if(!t)return!1;l||(l=function(t){const e=t.createElement("canvas"),n=e.getContext("2d");let i={};return{create(t){const r=t.key;return r?(i[r]=i[r]||Ry(t,e,n),i[r]):Ry(t,e,n)},clear(){i={}}}}(t.ownerDocument));const u=e&&e.getContext()||t.getContext("2d"),h=Py(u),d=e&&i.transform();if(d)return t.width=t.width,function(t){let{el:e,dpiRatio:n,transform:i}=t;if("object"==typeof i){const t=[i.horizontalScaling,i.horizontalSkewing,i.verticalSkewing,i.verticalScaling,i.horizontalMoving*n,i.verticalMoving*n];e.getContext("2d").setTransform(...t)}}({el:t,dpiRatio:h,transform:d}),e.apply(),!0;o&&(t.style.left="".concat(a.computedPhysical.x,"px"),t.style.top="".concat(a.computedPhysical.y,"px"),t.style.width="".concat(a.computedPhysical.width,"px"),t.style.height="".concat(a.computedPhysical.height,"px"),t.width=Math.round(a.computedPhysical.width*h),t.height=Math.round(a.computedPhysical.height*h),e&&e.updateSize({rect:a,dpiRatio:h,canvasBufferSize:i.canvasBufferSize}));const f=c.getScene(n),p=!r||!f.equals(r);l.clear();const g=o||p,m="function"==typeof i.progressive&&i.progressive();return g&&(m&&!m.isFirst||c.clear(),jy(f.children,u,s,{patterns:l})),e&&(t.width=t.width,e.apply()),o=!1,m&&!m.isFirst&&f.children.unshift(...r.children),r=f,g},c.itemsAt=t=>r?r.getItemsFrom(t):[],c.findShapes=t=>r?r.findShapes(t):[],c.clear=()=>(t&&(t.width=t.width),e&&e.clear(),r=null,c),c.size=t=>{if(t){const e=Ay(t);JSON.stringify(a)!==JSON.stringify(e)&&(o=!0,a=e)}return a},c.destroy=()=>{t&&(t.parentElement&&t.parentElement.removeChild(t),t=null),e&&(e=null),r=null},c}function By(t,e){Iy.add(t,e)}function Vy(t,e){return Math.max(0,Math.min(t,e))}const $y=new RegExp("[A-Za-zªµºÀ-ÖØ-öø-ʸʻ-ˁː-ˑˠ-ˤˮͰ-ͳͶ-ͽΆΈ-ϵϷ-҂Ҋ-։ः-हऻऽ-ीॉ-ौॎ-ॐक़-ॡ।-ॿং-হঽ-ীে-ৌৎ-ৡ০-ৱ৴-৺ਃ-ਹਾ-ੀਖ਼-੯ੲ-ੴઃ-હઽ-ીૉ-ૌૐ-ૡ૦-૯ଂ-ହଽ-ାୀେ-ୌୗ-ୡ୦-୷ஃ-ிு-ௌௐ-௲ఁ-ఽు-ౄౘ-ౡ౦-౯౿-ಹಽ-ೋೕ-ೡ೦-ീെ-ൌൎ-ൡ൦-ෆා-ෑෘ-ะา-ำเ-ๆ๏-ະາ-ຳຽ-ໆ໐-༗༚-༴༶༸༾-ཬཿ྅ྈ-ྌ྾-࿅࿇-ာေးျ-ြဿ-ၗၚ-ၝၡ-ၰၵ-ႁႃ-ႄႇ-ႌႎ-ႜ႞-ፚ፠-ᎏᎠ-Ᏼᐁ-ᙿᚁ-ᚚᚠ-ᜑᜠ-ᜱ᜵-ᝑᝠ-ᝰក-ាើ-ៅះ-ៈ។-៚ៜ០-៩᠐-ᢨᢪ-ᤜᤣ-ᤦᤩ-ᤱᤳ-ᤸ᥆-᧚ᨀ-ᨖᨙ-ᩕᩗᩡᩣ-ᩤᩭ-ᩲ᪀-᪭ᬄ-ᬳᬵᬻᬽ-ᭁᭃ-᭪᭴-᭼ᮂ-ᮡᮦ-ᮧ᮪-ᯥᯧᯪ-ᯬᯮ᯲-ᰫᰴ-ᰵ᰻-᱿᳓᳡ᳩ-ᳬᳮ-ᶿḀ-ᾼιῂ-ῌῐ-Ίῠ-Ῥῲ-ῼ‎ⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎ-⅏Ⅰ-ↈ⌶-⍺⎕⒜-ⓩ⚬⠀-⣿Ⰰ-ⳤⳫ-ⳮⴀ-⵰ⶀ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ㆺㇰ-㈜㈠-㉏㉠-㉻㉿-㊰㋀-㋋㋐-㍶㍻-㏝㏠-㏾㐀-䶵一-ꒌꓐ-ꘌꘐ-ꙮꚀ-ꛯ꛲-꛷Ꜣ-ꞇ꞉-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠤꠧ꠰-꠷ꡀ-ꡳꢀ-ꣃ꣎-꣙ꣲ-ꤥ꤮-ꥆꥒ-ꥼꦃ-ꦲꦴ-ꦵꦺ-ꦻꦽ-ꨨꨯ-ꨰꨳ-ꨴꩀ-ꩂꩄ-ꩋꩍ-ꪯꪱꪵ-ꪶꪹ-ꪽꫀꫂ-ꯤꯦ-ꯧꯩ-꯬꯰-ﬗA-Za-zヲ-ᅵ]"),Hy=new RegExp("[־׀׃׆א-״߀-ߪߴ-ߵߺ-ࠕࠚࠤࠨ࠰-ࡘ࡞‏יִײַ-ﬨשׁ-ﭏ]"),Wy=new RegExp("[؈؋؍؛-ي٭-ٯٱ-ەۥ-ۦۮ-ۯۺ-܍ܐܒ-ܯݍ-ޥޱﭐ-ﴽﵐ-﷼ﹰ-ﻼ]");function Uy(t){return $y.test(t)}function Yy(t){return Hy.test(t)||Wy.test(t)}function Xy(t){let e,n,i=t?t.length:0;for(e=0;e<i;e++){if(n=t[e],Uy(n))return"ltr";if(Yy(n))return"rtl"}return"ltr"}const Gy={start:"end",end:"start",center:"center",middle:"middle"};function Ky(t,e){return"rtl"===e?Gy[t]:t}function Zy(t,e){const n=[];let i;const r=[],o=[],a=[];let s,l;const c=t=>t.id,u=(t,e)=>{let n;return n="object"==typeof t?"id"in t?t.id:e:t,{content:t,id:"".concat(n,"__").concat(t.type||"")}};t.isTree||(t=t.map(u)),e=e.map(u),s=t.map(c),l=e.map(c);for(let t=0,i=e.length;t<i;t++){-1===s.indexOf(e[t].id)?n.push(e[t]):o.push(e[t])}for(let e=0,n=t.length;e<n;e++){-1===l.indexOf(t[e].id)?r.push(t[e]):a.push(t[e])}for(let t=0,e=n.length;t<e;t++)n[t].content.children&&(n[t].diff=Zy([],n[t].content.children),n[t].children=n[t].diff.updatedNew.concat(n[t].diff.added),n[t].children.isTree=!0);for(let t=0,e=o.length;t<e;t++)o[t].diff=Zy(a[t].children||[],o[t].content.children||[]),o[t].object=a[t].object,o[t].children=o[t].diff.items;return i=o.concat(n),n.isTree=!0,r.isTree=!0,o.isTree=!0,a.isTree=!0,i.isTree=!0,{added:n,updatedNew:o,updatedOld:a,removed:r,items:i}}function Jy(t,e,n){for(let i=0,r=t.length;i<r;i++)t[i].object=n(t[i].content.type,e)}function Qy(t,e){for(let n=0,i=t.length;n<i;n++)null!==t[n].object&&void 0!==t[n].object&&(e(t[n].object),t[n].object=null)}function tx(t,e,n,i){let r;for(let o=0,a=t.length;o<a;o++)r=t[o],null!==r.object&&void 0!==r.object&&(n(r.object,r.content),r.diff&&(Jy(r.diff.added,r.object,e),Qy(r.diff.removed,i),tx(r.diff.items,e,n,i)))}function ex(t,e,n,i,r,o){const a=Zy(t,e);return Jy(a.added,n,i),Qy(a.removed,o),tx(a.items,i,r,o),a.items}By("rect",(function(t,e){let{g:n,doFill:i,doStroke:r}=e;n.beginPath(),t.rx>0||t.ry>0?function(t,e,n,i,r,o,a){o=Vy(i/2,o>0?o:a),a=Vy(r/2,a>0?a:o),t.moveTo(e,n+a),t.lineTo(e,n+r-a),t.quadraticCurveTo(e,n+r,e+o,n+r),t.lineTo(e+i-o,n+r),t.quadraticCurveTo(e+i,n+r,e+i,n+r-a),t.lineTo(e+i,n+a),t.quadraticCurveTo(e+i,n,e+i-o,n),t.lineTo(e+o,n),t.quadraticCurveTo(e,n,e,n+a)}(n,t.x,t.y,t.width,t.height,t.rx,t.ry):n.rect(t.x,t.y,t.width,t.height),i&&n.fill(),r&&n.stroke()})),By("circle",(function(t,e){let{g:n,doFill:i,doStroke:r}=e;n.beginPath(),n.moveTo(t.cx+t.r,t.cy),n.arc(t.cx,t.cy,t.r,0,2*Math.PI,!1),i&&n.fill(),r&&n.stroke()})),By("line",(function(t,e){let{g:n,doStroke:i}=e;n.beginPath(),n.moveTo(t.x1,t.y1),n.lineTo(t.x2,t.y2),i&&n.stroke()})),By("path",(function(t,e){let{g:n,doStroke:i,doFill:r}=e;const o=new Path2D(t.d);r&&n.fill(o),i&&n.stroke(o)})),By("text",(function(t,e){let{g:n,ellipsed:i,doStroke:r}=e;const o=i||Up(t,eg);n.font=[t["font-style"],t["font-weight"],t["font-size"],t["font-family"]].filter((t=>!!t)).join(" ");const a=Xy(t.text);n.canvas.dir!==a&&(n.canvas.dir=a);const s=Ky("middle"===t["text-anchor"]?"center":t["text-anchor"],n.canvas.dir);s&&n.textAlign!==s&&(n.textAlign=s);const l=Yp(t);n.fillText(o,t.x+t.dx,t.y+t.dy+l),r&&n.strokeText(o,t.x+t.dx,t.y+t.dy+l)}));const nx="http://www.w3.org/2000/svg",ix=(t,e)=>{if(!t||"string"!=typeof t)throw new Error("Invalid type: ".concat(t));const n=e.ownerDocument.createElementNS(nx,"container"===t?"g":t);return e.appendChild(n),n},rx=t=>{t.parentNode&&t.parentNode.removeChild(t)},ox=(t,e)=>{if((t=>{switch(t.type){case"circle":return!isNaN(t.attrs.cx)&&!isNaN(t.attrs.cy)&&!isNaN(t.attrs.r);case"line":return!(isNaN(t.attrs.x1)||isNaN(t.attrs.y1)||isNaN(t.attrs.x2)||isNaN(t.attrs.y2));case"rect":return!(isNaN(t.attrs.x)||isNaN(t.attrs.y)||isNaN(t.attrs.width)||isNaN(t.attrs.height));case"text":return!isNaN(t.attrs.x)&&!isNaN(t.attrs.y);default:return!0}})(e)){for(const n in e.attrs)if("stroke"===n&&e.strokeReference)t.setAttribute("stroke",e.strokeReference);else if("fill"===n&&e.fillReference)t.setAttribute("fill",e.fillReference);else if("text"===n){t.setAttribute("style","white-space: pre"),t.textContent=e.ellipsed||Up(e.attrs,eg);const n=Xy(e.attrs.text);"rtl"===n&&(t.setAttribute("direction","rtl"),t.setAttribute("dir","rtl"),t.setAttribute("text-anchor",Ky(t.getAttribute("text-anchor"),n)))}else if("text"!==e.type||"dy"!==n&&"dominant-baseline"!==n)if("text"===e.type&&"title"===n&&e.attrs.title){const n=t.ownerDocument.createElementNS(nx,"title");n.textContent=e.attrs.title,t.appendChild(n)}else t.setAttribute(n,e.attrs[n]);else{const i=+t.getAttribute(n)||0;let r=0;r="dominant-baseline"===n?Yp(e.attrs):e.attrs[n],t.setAttribute("dy",r+i)}if("string"==typeof e.data||"number"==typeof e.data||"boolean"==typeof e.data)t.setAttribute("data",e.data);else if("object"==typeof e.data&&null!==e.data)for(const n in e.data)"string"!=typeof e.data[n]&&"number"!=typeof e.data[n]&&"boolean"!=typeof e.data[n]||t.setAttribute("data-".concat(n),e.data[n])}};class ax{constructor(t,e,n,i){this.create=t,this.nodeCreator=e,this.nodeMaintainer=n,this.nodeDestroyer=i}render(t,e){return this.create([],t,e,this.nodeCreator,this.nodeMaintainer,this.nodeDestroyer)}}function sx(){return new ax(ex,ix,ox,rx)}function lx(t){let e,n,i,r=0;if(0===(t=JSON.stringify(t)).length)return r;for(e=0,i=t.length;e<i;e++)n=t.charCodeAt(e),r=(r<<5)-r+n,r&=r;return r}function cx(){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nx,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Sy;const n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:sx)();let i,r,o,a=!1,s=Ay();const l={transform:void 0},c=Cy(),u={type:"defs",children:[]},h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lx,n={},i=Date.now();const r={onCreate(r){let o={};r.node&&"object"==typeof r.node.fill&&"pattern"===r.node.fill.type&&r.node.fill.shapes&&(o.fill=r.node.fill),r.node&&"object"==typeof r.node.stroke&&"pattern"===r.node.stroke.type&&r.node.stroke.shapes&&(o.stroke=r.node.stroke),Object.keys(o).forEach((a=>{let s="";const l=o[a],c=e(l),u="picasso-pattern-".concat(i,"-").concat(c);if("undefined"!=typeof window&&(s=window.location.href.split("#")[0]),!n[c]){const e={patternUnits:"userSpaceOnUse",x:0,y:0,width:l.width,height:l.height,type:"pattern",id:u,children:[],fill:l.fill};l.shapes.forEach((t=>{e.children.push(t)})),t.push(e),n[c]=!0}r.node["".concat(a,"Reference")]="url('".concat(s,"#").concat(u,"')")}))},clear(){n={}}};return r}(u.children),d=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lx,n={},i=Date.now();const r={getOrCreateGradient(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=e(r[o]),l="picasso-gradient-".concat(i,"-").concat(s);if(!n[s]){let{orientation:e,degree:i,stops:a=[]}=r[o],c={};void 0===i&&(i=90),"radial"===e?c.type="radialGradient":(c=Ru(i),["x1","x2","y1","y2"].forEach((t=>{t in r[o]&&(c[t]=r[o][t])})),c.type="linearGradient"),c.id=l,c.children=a.map((t=>{let{offset:e,color:n,opacity:i}=t;return{type:"stop",offset:"".concat(100*e,"%"),style:"stop-color:".concat(n,";stop-opacity:").concat(void 0!==i?i:1)}})),t.push(c),n[s]=l}return"url('".concat(a,"#").concat(l,"')")},onCreate(t){let e="";"undefined"!=typeof window&&(e=window.location.href.split("#")[0]);const n=t.node;n.fill&&"object"==typeof n.fill&&"gradient"===n.fill.type&&(n.fillReference=r.getOrCreateGradient(n,"fill",e)),n.stroke&&"object"==typeof n.stroke&&"gradient"===n.stroke.type&&(n.strokeReference=r.getOrCreateGradient(n,"stroke",e))},clear(){n={}}};return r}(u.children);return c.element=()=>i,c.root=()=>r,c.settings=t=>(t&&Object.keys(l).forEach((e=>{void 0!==t[e]&&(l[e]=t[e])})),l),c.appendTo=e=>(i||(i=e.ownerDocument.createElementNS(t,"svg"),i.style.position="absolute",i.style["-webkit-font-smoothing"]="antialiased",i.style["-moz-osx-font-smoothing"]="antialiased",i.style.pointerEvents="none",i.setAttribute("xmlns",t),r=e.ownerDocument.createElementNS(t,"g"),r.style.pointerEvents="auto",i.appendChild(r)),e.appendChild(i),i),c.getScene=t=>{const n=s.scaleRatio.x,i=s.scaleRatio.y,r={type:"container",children:Array.isArray(t)?[...t,u]:t,transform:s.edgeBleed.bool?"translate(".concat(s.edgeBleed.left*n,", ").concat(s.edgeBleed.top*i,")"):""};return 1===n&&1===i||(r.transform+="scale(".concat(n,", ").concat(i,")")),e({items:[r],on:{create:[t=>{t.node.fillReference=void 0,t.node.strokeReference=void 0},d.onCreate,h.onCreate,Wp(c.measureText),Dy(c)]}})},c.render=t=>{if(!i)return!1;const e="function"==typeof l.transform&&l.transform();if(e){const{horizontalScaling:t,horizontalSkewing:n,verticalSkewing:i,verticalScaling:o,horizontalMoving:a,verticalMoving:s}=e;return r.style.transform="matrix(".concat(t,", ").concat(n,", ").concat(i,", ").concat(o,", ").concat(a,", ").concat(s,")"),!0}r.style.transform="",a&&(i.style.left="".concat(s.computedPhysical.x,"px"),i.style.top="".concat(s.computedPhysical.y,"px"),i.setAttribute("width",s.computedPhysical.width),i.setAttribute("height",s.computedPhysical.height)),d.clear(),h.clear(),u.children.length=0;const f=c.getScene(t),p=!o||!f.equals(o),g=a||p;return g&&(c.clear(),n.render(f.children,r)),a=!1,o=f,g},c.itemsAt=t=>o?o.getItemsFrom(t):[],c.findShapes=t=>o?o.findShapes(t):[],c.clear=()=>{if(!r)return c;o=null;const t=r.cloneNode(!1);return i.replaceChild(t,r),r=t,c},c.destroy=()=>{i&&i.parentNode&&i.parentNode.removeChild(i),i=null,r=null},c.size=t=>{if(t){const e=Ay(t);JSON.stringify(s)!==JSON.stringify(e)&&(a=!0,s=e)}return s},c}var ux,hx,dx,fx,px,gx,mx,yx={},xx=[],vx=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function bx(t,e){for(var n in e)t[n]=e[n];return t}function wx(t){var e=t.parentNode;e&&e.removeChild(t)}function Mx(t,e,n){var i,r,o,a={};for(o in e)"key"==o?i=e[o]:"ref"==o?r=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?ux.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===a[o]&&(a[o]=t.defaultProps[o]);return kx(t,a,i,r,null)}function kx(t,e,n,i,r){var o={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++dx:r};return null==r&&null!=hx.vnode&&hx.vnode(o),o}function _x(t){return t.children}function Sx(t,e){this.props=t,this.context=e}function Nx(t,e){if(null==e)return t.__?Nx(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?Nx(t):null}function Rx(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return Rx(t)}}function Ax(t){(!t.__d&&(t.__d=!0)&&fx.push(t)&&!Cx.__r++||px!==hx.debounceRendering)&&((px=hx.debounceRendering)||gx)(Cx)}function Cx(){var t,e,n,i,r,o,a,s;for(fx.sort(mx);t=fx.shift();)t.__d&&(e=fx.length,i=void 0,r=void 0,a=(o=(n=t).__v).__e,(s=n.__P)&&(i=[],(r=bx({},o)).__v=o.__v+1,Lx(s,o,r,n.__n,void 0!==s.ownerSVGElement,null!=o.__h?[a]:null,i,null==a?Nx(o):a,o.__h),jx(i,o),o.__e!=a&&Rx(o)),fx.length>e&&fx.sort(mx));Cx.__r=0}function Dx(t,e,n,i,r,o,a,s,l,c){var u,h,d,f,p,g,m,y=i&&i.__k||xx,x=y.length;for(n.__k=[],u=0;u<e.length;u++)if(null!=(f=n.__k[u]=null==(f=e[u])||"boolean"==typeof f||"function"==typeof f?null:"string"==typeof f||"number"==typeof f||"bigint"==typeof f?kx(null,f,null,null,f):Array.isArray(f)?kx(_x,{children:f},null,null,null):f.__b>0?kx(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)){if(f.__=n,f.__b=n.__b+1,null===(d=y[u])||d&&f.key==d.key&&f.type===d.type)y[u]=void 0;else for(h=0;h<x;h++){if((d=y[h])&&f.key==d.key&&f.type===d.type){y[h]=void 0;break}d=null}Lx(t,f,d=d||yx,r,o,a,s,l,c),p=f.__e,(h=f.ref)&&d.ref!=h&&(m||(m=[]),d.ref&&m.push(d.ref,null,f),m.push(h,f.__c||p,f)),null!=p?(null==g&&(g=p),"function"==typeof f.type&&f.__k===d.__k?f.__d=l=Ox(f,l,t):l=zx(t,f,d,y,p,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=t&&(l=Nx(d))}for(n.__e=g,u=x;u--;)null!=y[u]&&("function"==typeof n.type&&null!=y[u].__e&&y[u].__e==n.__d&&(n.__d=Ex(i).nextSibling),Vx(y[u],y[u]));if(m)for(u=0;u<m.length;u++)Bx(m[u],m[++u],m[++u])}function Ox(t,e,n){for(var i,r=t.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=t,e="function"==typeof i.type?Ox(i,e,n):zx(n,i,i,r,i.__e,e));return e}function zx(t,e,n,i,r,o){var a,s,l;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||r!=o||null==r.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(r),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<i.length;l+=1)if(s==r)break t;t.insertBefore(r,o),a=o}return void 0!==a?a:r.nextSibling}function Ex(t){var e,n,i;if(null==t.type||"string"==typeof t.type)return t.__e;if(t.__k)for(e=t.__k.length-1;e>=0;e--)if((n=t.__k[e])&&(i=Ex(n)))return i;return null}function Ix(t,e,n){"-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||vx.test(e)?n:n+"px"}function Tx(t,e,n,i,r){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||Ix(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||Ix(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i||t.addEventListener(e,o?qx:Px,o):t.removeEventListener(e,o?qx:Px,o);else if("dangerouslySetInnerHTML"!==e){if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==e&&"height"!==e&&"href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,n))}}function Px(t){return this.l[t.type+!1](hx.event?hx.event(t):t)}function qx(t){return this.l[t.type+!0](hx.event?hx.event(t):t)}function Lx(t,e,n,i,r,o,a,s,l){var c,u,h,d,f,p,g,m,y,x,v,b,w,M,k,_=e.type;if(void 0!==e.constructor)return null;null!=n.__h&&(l=n.__h,s=e.__e=n.__e,e.__h=null,o=[s]),(c=hx.__b)&&c(e);try{t:if("function"==typeof _){if(m=e.props,y=(c=_.contextType)&&i[c.__c],x=c?y?y.props.value:c.__:i,n.__c?g=(u=e.__c=n.__c).__=u.__E:("prototype"in _&&_.prototype.render?e.__c=u=new _(m,x):(e.__c=u=new Sx(m,x),u.constructor=_,u.render=$x),y&&y.sub(u),u.props=m,u.state||(u.state={}),u.context=x,u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=_.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=bx({},u.__s)),bx(u.__s,_.getDerivedStateFromProps(m,u.__s))),d=u.props,f=u.state,u.__v=e,h)null==_.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==_.getDerivedStateFromProps&&m!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(m,x),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(m,u.__s,x)||e.__v===n.__v){for(e.__v!==n.__v&&(u.props=m,u.state=u.__s,u.__d=!1),u.__e=!1,e.__e=n.__e,e.__k=n.__k,e.__k.forEach((function(t){t&&(t.__=e)})),v=0;v<u._sb.length;v++)u.__h.push(u._sb[v]);u._sb=[],u.__h.length&&a.push(u);break t}null!=u.componentWillUpdate&&u.componentWillUpdate(m,u.__s,x),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,f,p)}))}if(u.context=x,u.props=m,u.__P=t,b=hx.__r,w=0,"prototype"in _&&_.prototype.render){for(u.state=u.__s,u.__d=!1,b&&b(e),c=u.render(u.props,u.state,u.context),M=0;M<u._sb.length;M++)u.__h.push(u._sb[M]);u._sb=[]}else do{u.__d=!1,b&&b(e),c=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++w<25);u.state=u.__s,null!=u.getChildContext&&(i=bx(bx({},i),u.getChildContext())),h||null==u.getSnapshotBeforeUpdate||(p=u.getSnapshotBeforeUpdate(d,f)),k=null!=c&&c.type===_x&&null==c.key?c.props.children:c,Dx(t,Array.isArray(k)?k:[k],e,n,i,r,o,a,s,l),u.base=e.__e,e.__h=null,u.__h.length&&a.push(u),g&&(u.__E=u.__=null),u.__e=!1}else null==o&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=Fx(n.__e,e,n,i,r,o,a,l);(c=hx.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=o)&&(e.__e=s,e.__h=!!l,o[o.indexOf(s)]=null),hx.__e(t,e,n)}}function jx(t,e){hx.__c&&hx.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){hx.__e(t,e.__v)}}))}function Fx(t,e,n,i,r,o,a,s){var l,c,u,h=n.props,d=e.props,f=e.type,p=0;if("svg"===f&&(r=!0),null!=o)for(;p<o.length;p++)if((l=o[p])&&"setAttribute"in l==!!f&&(f?l.localName===f:3===l.nodeType)){t=l,o[p]=null;break}if(null==t){if(null===f)return document.createTextNode(d);t=r?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,d.is&&d),o=null,s=!1}if(null===f)h===d||s&&t.data===d||(t.data=d);else{if(o=o&&ux.call(t.childNodes),c=(h=n.props||yx).dangerouslySetInnerHTML,u=d.dangerouslySetInnerHTML,!s){if(null!=o)for(h={},p=0;p<t.attributes.length;p++)h[t.attributes[p].name]=t.attributes[p].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(t,e,n,i,r){var o;for(o in n)"children"===o||"key"===o||o in e||Tx(t,o,null,n[o],i);for(o in e)r&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===e[o]||Tx(t,o,e[o],n[o],i)}(t,d,h,r,s),u)e.__k=[];else if(p=e.props.children,Dx(t,Array.isArray(p)?p:[p],e,n,i,r&&"foreignObject"!==f,o,a,o?o[0]:n.__k&&Nx(n,0),s),null!=o)for(p=o.length;p--;)null!=o[p]&&wx(o[p]);s||("value"in d&&void 0!==(p=d.value)&&(p!==t.value||"progress"===f&&!p||"option"===f&&p!==h.value)&&Tx(t,"value",p,h.value,!1),"checked"in d&&void 0!==(p=d.checked)&&p!==t.checked&&Tx(t,"checked",p,h.checked,!1))}return t}function Bx(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){hx.__e(t,n)}}function Vx(t,e,n){var i,r;if(hx.unmount&&hx.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||Bx(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){hx.__e(t,e)}i.base=i.__P=null,t.__c=void 0}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&Vx(i[r],e,n||"function"!=typeof t.type);n||null==t.__e||wx(t.__e),t.__=t.__e=t.__d=void 0}function $x(t,e,n){return this.constructor(t,n)}function Hx(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{createElement:e=document.createElement.bind(document)}=t;let n,i,r=Ay();const o={transform:void 0},a=Cy();return a.element=()=>n,a.root=()=>n,a.settings=t=>(t&&Object.keys(o).forEach((e=>{void 0!==t[e]&&(o[e]=t[e])})),o),a.appendTo=t=>(n||(n=e("div"),n.style.position="absolute",n.style["-webkit-font-smoothing"]="antialiased",n.style["-moz-osx-font-smoothing"]="antialiased",n.style.pointerEvents="none"),t.appendChild(n),n),a.render=t=>{if(!n)return!1;const e="function"==typeof o.transform&&o.transform();if(e){const{horizontalScaling:t,horizontalSkewing:i,verticalSkewing:r,verticalScaling:o,horizontalMoving:a,verticalMoving:s}=e;return n.style.transform="matrix(".concat(t,", ").concat(i,", ").concat(r,", ").concat(o,", ").concat(a,", ").concat(s,")"),!0}let a;return n.style.transform="",n.style.left="".concat(r.computedPhysical.x,"px"),n.style.top="".concat(r.computedPhysical.y,"px"),n.style.width="".concat(r.computedPhysical.width,"px"),n.style.height="".concat(r.computedPhysical.height,"px"),a=Array.isArray(t)?Mx("div",null,t):t,i=function(t,e,n){var i,r,o;hx.__&&hx.__(t,e),r=(i="function"==typeof n)?null:n&&n.__k||e.__k,o=[],Lx(e,t=(!i&&n||e).__k=Mx(_x,null,[t]),r||yx,yx,void 0!==e.ownerSVGElement,!i&&n?[n]:r?null:e.firstChild?ux.call(e.childNodes):null,o,!i&&n?n:r?r.__e:e.firstChild,i),jx(o,t)}(a,n,i),!0},a.renderArgs=[Mx],a.clear=()=>{if(n){let t=n.firstChild;for(;t;)n.removeChild(t),t=n.firstChild;i=null}return a},a.destroy=()=>{n&&n.parentElement&&n.parentElement.removeChild(n),n=null,i=null},a.size=t=>(t&&(r=Ay(t)),r),a}ux=xx.slice,hx={__e:function(t,e,n,i){for(var r,o,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(t)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(t,i||{}),a=r.__d),a)return r.__E=r}catch(e){t=e}throw t}},dx=0,Sx.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=bx({},this.state),"function"==typeof t&&(t=t(bx({},n),this.props)),t&&bx(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),Ax(this))},Sx.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ax(this))},Sx.prototype.render=_x,fx=[],gx="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,mx=function(t,e){return t.__v.__b-e.__v.__b},Cx.__r=0;var Wx=[function(t){t.renderer("svg",cx)},function(t){t.renderer("canvas",Fy)},function(t){t.renderer("dom",Hx)}];const Ux={OFF:0,ERROR:1,WARN:2,INFO:3,DEBUG:4};const Yx=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=function(){let{level:t=Ux.OFF,pipe:e=console}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t;const i={[Ux.OFF]:()=>{},[Ux.ERROR]:function(){return e.error(...arguments)},[Ux.WARN]:function(){return e.warn(...arguments)},[Ux.INFO]:function(){return e.info(...arguments)},[Ux.DEBUG]:function(){return e.log(...arguments)}},r=function(t){if(t&&!(n<t)){for(var e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];(i[t]||i[Ux.DEBUG])(...r)}};return{log:r,error:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Ux.ERROR,...e)},warn:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Ux.WARN,...e)},info:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Ux.INFO,...e)},debug:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Ux.DEBUG,...e)},level:t=>("number"==typeof t&&(n=t),n),LOG_LEVEL:Ux}}(e.logger),r={component:so(n.component,"component",i),data:so(n.data,"data",i),formatter:so(n.formatter,"formatter",i),interaction:so(n.interaction,"interaction",i),renderer:Gh(n.renderer),scale:so(n.scale,"scale",i),symbol:so(n.symbol,"symbol",i),logger:i};function o(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t({palettes:e.palettes.concat(n.palettes||[]),style:Hi({},e.style,n.style),logger:n.logger||e.logger,renderer:n.renderer||e.renderer},r)}return e.renderer&&e.renderer.prio&&r.renderer.default(e.renderer.prio[0]),o.use=function(t){return function(t){t(arguments.length>2?arguments[2]:void 0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r)},o.chart=t=>Xh(t,{registries:r,logger:i,style:e.style,palettes:e.palettes}),o.config=()=>e,Object.keys(r).forEach((t=>{o[t]=r[t]})),o.version=Wi,o}({renderer:{prio:["svg","canvas"]},logger:{level:0},style:{"$font-family":"'Source Sans Pro', Arial, sans-serif","$font-size":"12px","$line-height":"16px","$font-size--l":"16px","$font-weight":"normal","$gray-100":"#ffffff","$gray-98":"#f9f9f9","$gray-95":"#f2f2f2","$gray-90":"#e6e6e6","$gray-35":"#595959","$gray-30":"#4d4d4d","$gray-25":"#404040","$gray-20":"#333333","$border-95":"rgba(255, 255, 255, 0.05)","$border-90":"rgba(255, 255, 255, 0.1)","$border-80":"rgba(255, 255, 255, 0.2)","$border-20":"rgba(0, 0, 0, 0.2)","$border-10":"rgba(0, 0, 0, 0.1)","$border-5":"rgba(0, 0, 0, 0.05)","$primary-blue":"#3F8AB3","$primary-green":"#6CB33F","$primary-red":"#DC423F","$primary-orange":"#EF960F","$spacing--s":4,$spacing:8,"$spacing--l":12,"$font-color":"$gray-35","$font-color--inverted":"$gray-90","$guide-color":"$gray-90","$guide-color--inverted":"$gray-35",$border:"$border-80","$border--inverted":"$border-10",$shape:{fill:"$primary-blue",strokeWidth:1,stroke:"$border"},"$shape-outline":{stroke:"$primary-blue",strokeWidth:2},"$shape-guide":{stroke:"$guide-color",strokeWidth:1},"$shape-guide--inverted":{"@extend":"$shape-guide",stroke:"$guide-color--inverted"},$label:{fontSize:"$font-size",fontFamily:"$font-family",fill:"$font-color"},"$label--inverted":{$extend:"$label",fill:"$font-color--inverted"},"$label-overlay":{fontSize:"$font-size--l",fontFamily:"$font-family",fill:"$gray-100",color:"$font-color",stroke:"$guide-color--inverted",strokeWidth:1,borderRadius:4},$title:{"@extend":"$label",fontSize:"$font-size--l",fontWeight:"$font-weight",stroke:"$guide-color--inverted",strokeWidth:0},"$guide-line":{strokeWidth:1,stroke:"$guide-color"},"$guide-line--minor":{strokeWidth:1,stroke:"$gray-95"},"$padding--s":{left:"$spacing--s",right:"$spacing--s",top:"$spacing--s",bottom:"$spacing--s"},$padding:{left:"$spacing",right:"$spacing",top:"$spacing",bottom:"$spacing"},"$selection-area-target":{fill:"$primary-green",strokeWidth:0,opacity:.2}},palettes:[{key:"categorical",colors:[["#a54343","#d76c6c","#ec983d","#ecc43d","#f9ec86","#cbe989","#70ba6e","#578b60","#79d69f","#26a0a7","#138185","#65d3da"]]},{key:"diverging",colors:[["#3d52a1","#3a89c9","#77b7e5","#b4ddf7","#e6f5fe","#ffe3aa","#f9bd7e","#ed875e","#d24d3e","#ae1c3e"]]},{key:"sequential",colors:[["rgb(180,221,212)","rgb(34, 83, 90)"]]}]},{component:Kh,data:ed,formatter:zs,interaction:nd,renderer:Gh(),scale:Ec,symbol:ju});hm.forEach(Yx.use),Wx.forEach(Yx.use),[].forEach(Yx.use);const Xx=52,Gx=-2*Math.PI/3,Kx=2*Math.PI/3,Zx="#EEEEEE",Jx=2.38,Qx={MIN:12,MAX:60},tv={MIN:100,MAX:1e3},ev={TOP:-4,BOTTOM:0,LEFT:4,RIGHT:4},nv={VERTICAL_ALIGNMENT_FACTOR:.4},iv={VERTICAL_ALIGNMENT_FACTOR:1.25},rv=1.2,ov={DARK:"#595959",LIGHT:"#E6E6E6"},av=.4,sv=1,lv=2,cv=.75,uv=.75,hv={MAX_WIDTH:150,MAX_LINES:2,CLEARANCE:12,ESTIMATED_LINE_HEIGHT:16,GAP:8},dv=70,fv=3,pv={MEASURE:"measure"},gv={BAR:"bar",LABEL_BAR:"label-bar",BACKGROUND_BAR:"background-bar",OOB_INDICATOR:"oob-indicator",BAR_AXIS:"bar-axis",AXIS_TITLE:"axis-title",GAUGE_LABEL:"gauge-label",RADIAL_GAUGE_NEEDLE:"radial-gauge-needle",RADIAL_OOB_INDICATOR:"radial-oob-indicator",RADIAL_GAUGE:"radial-gauge",REFERENCE_LINES_AND_LABELS:"reference-lines-and-labels",RADIAL_SPARK:"radial-spark",RADIAL_GAUGE_LABEL:"radial-gauge-label"},mv="XSMALL",yv="SMALL",xv="XSMALL_VERTICAL",vv="XSMALL_HORIZONTAL",bv="SMALL",wv={FULL:{width:550,height:450},MEDIUM:{width:300,height:150},SMALL:{width:150,height:84},SMALLER:{width:150,height:75},XSMALL:{width:84,height:84},XSMALL_VERTICAL:{width:105,height:0},XSMALL_HORIZONTAL:{width:0,height:104},SPARK:{height:75,width:50}},Mv=600,kv=200,_v=500;function Sv(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Nv(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Rv(){}var Av=.7,Cv=1/Av,Dv="\\s*([+-]?\\d+)\\s*",Ov="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ev=/^#([0-9a-f]{3,8})$/,Iv=new RegExp(`^rgb\\(${Dv},${Dv},${Dv}\\)$`),Tv=new RegExp(`^rgb\\(${zv},${zv},${zv}\\)$`),Pv=new RegExp(`^rgba\\(${Dv},${Dv},${Dv},${Ov}\\)$`),qv=new RegExp(`^rgba\\(${zv},${zv},${zv},${Ov}\\)$`),Lv=new RegExp(`^hsl\\(${Ov},${zv},${zv}\\)$`),jv=new RegExp(`^hsla\\(${Ov},${zv},${zv},${Ov}\\)$`),Fv={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 Bv(){return this.rgb().formatHex()}function Vv(){return this.rgb().formatRgb()}function $v(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ev.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Hv(e):3===n?new Xv(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Wv(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Wv(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=Iv.exec(t))?new Xv(e[1],e[2],e[3],1):(e=Tv.exec(t))?new Xv(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Pv.exec(t))?Wv(e[1],e[2],e[3],e[4]):(e=qv.exec(t))?Wv(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Lv.exec(t))?tb(e[1],e[2]/100,e[3]/100,1):(e=jv.exec(t))?tb(e[1],e[2]/100,e[3]/100,e[4]):Fv.hasOwnProperty(t)?Hv(Fv[t]):"transparent"===t?new Xv(NaN,NaN,NaN,0):null}function Hv(t){return new Xv(t>>16&255,t>>8&255,255&t,1)}function Wv(t,e,n,i){return i<=0&&(t=e=n=NaN),new Xv(t,e,n,i)}function Uv(t){return t instanceof Rv||(t=$v(t)),t?new Xv((t=t.rgb()).r,t.g,t.b,t.opacity):new Xv}function Yv(t,e,n,i){return 1===arguments.length?Uv(t):new Xv(t,e,n,null==i?1:i)}function Xv(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Gv(){return`#${Qv(this.r)}${Qv(this.g)}${Qv(this.b)}`}function Kv(){const t=Zv(this.opacity);return`${1===t?"rgb(":"rgba("}${Jv(this.r)}, ${Jv(this.g)}, ${Jv(this.b)}${1===t?")":`, ${t})`}`}function Zv(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Jv(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qv(t){return((t=Jv(t))<16?"0":"")+t.toString(16)}function tb(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new nb(t,e,n,i)}function eb(t){if(t instanceof nb)return new nb(t.h,t.s,t.l,t.opacity);if(t instanceof Rv||(t=$v(t)),!t)return new nb;if(t instanceof nb)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new nb(a,s,l,t.opacity)}function nb(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function ib(t){return(t=(t||0)%360)<0?t+360:t}function rb(t){return Math.max(0,Math.min(1,t||0))}function ob(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Sv(Rv,$v,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Bv,formatHex:Bv,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return eb(this).formatHsl()},formatRgb:Vv,toString:Vv}),Sv(Xv,Yv,Nv(Rv,{brighter(t){return t=null==t?Cv:Math.pow(Cv,t),new Xv(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Av:Math.pow(Av,t),new Xv(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Xv(Jv(this.r),Jv(this.g),Jv(this.b),Zv(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:Gv,formatHex:Gv,formatHex8:function(){return`#${Qv(this.r)}${Qv(this.g)}${Qv(this.b)}${Qv(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Kv,toString:Kv})),Sv(nb,(function(t,e,n,i){return 1===arguments.length?eb(t):new nb(t,e,n,null==i?1:i)}),Nv(Rv,{brighter(t){return t=null==t?Cv:Math.pow(Cv,t),new nb(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Av:Math.pow(Av,t),new nb(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Xv(ob(t>=240?t-240:t+120,r,i),ob(t,r,i),ob(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new nb(ib(this.h),rb(this.s),rb(this.l),Zv(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=Zv(this.opacity);return`${1===t?"hsl(":"hsla("}${ib(this.h)}, ${100*rb(this.s)}%, ${100*rb(this.l)}%${1===t?")":`, ${t})`}`}}));const ab=Math.PI/180,sb=180/Math.PI,lb=.96422,cb=.82521,ub=4/29,hb=6/29,db=3*hb*hb,fb=hb*hb*hb;function pb(t){if(t instanceof gb)return new gb(t.l,t.a,t.b,t.opacity);if(t instanceof wb)return Mb(t);t instanceof Xv||(t=Uv(t));var e,n,i=vb(t.r),r=vb(t.g),o=vb(t.b),a=mb((.2225045*i+.7168786*r+.0606169*o)/1);return i===r&&r===o?e=n=a:(e=mb((.4360747*i+.3850649*r+.1430804*o)/lb),n=mb((.0139322*i+.0971045*r+.7141733*o)/cb)),new gb(116*a-16,500*(e-a),200*(a-n),t.opacity)}function gb(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function mb(t){return t>fb?Math.pow(t,1/3):t/db+ub}function yb(t){return t>hb?t*t*t:db*(t-ub)}function xb(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function vb(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function bb(t,e,n,i){return 1===arguments.length?function(t){if(t instanceof wb)return new wb(t.h,t.c,t.l,t.opacity);if(t instanceof gb||(t=pb(t)),0===t.a&&0===t.b)return new wb(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*sb;return new wb(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new wb(t,e,n,null==i?1:i)}function wb(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function Mb(t){if(isNaN(t.h))return new gb(t.l,0,0,t.opacity);var e=t.h*ab;return new gb(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function kb(t){return function(t){return bb(t).l<70}(t)?ov.LIGHT:ov.DARK}function _b(t,e=!0){let n="";for(let e=0;e<t.length;e++){const i=t[e];n+=0===e?`M${i.x} ${i.y}`:`L${i.x} ${i.y}`,n+=" "}return e&&(n+="Z"),n}function Sb(t){const{angle:e,origin:n}=t,i=t.points.map((t=>function(t,e,n={x:0,y:0}){const i=Math.cos(e),r=Math.sin(e),o=(s=n,{x:(a=t).x-s.x,y:a.y-s.y});var a,s;return function(t,e){return{x:t.x+e.x,y:t.y+e.y}}({x:i*o.x-r*o.y,y:r*o.x+i*o.y},n)}(t,e,n)));return{type:"path",fill:t.fill,d:_b(i)}}Sv(gb,(function(t,e,n,i){return 1===arguments.length?pb(t):new gb(t,e,n,null==i?1:i)}),Nv(Rv,{brighter(t){return new gb(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new gb(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 Xv(xb(3.1338561*(e=lb*yb(e))-1.6168667*(t=1*yb(t))-.4906146*(n=cb*yb(n))),xb(-.9787684*e+1.9161415*t+.033454*n),xb(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Sv(wb,bb,Nv(Rv,{brighter(t){return new wb(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new wb(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Mb(this).rgb()}}));const Nb={require:["chart","symbol"],defaultSettings:{settings:{},style:{}},render(){var t;return function({chart:t,settings:e,symbol:n}){if(!t||!e||!n)return[];const{size:i,component:r,selector:o,pointingTo:a}=e;if(!t.component(e.component))return[];const s=t.findShapes(o).filter((t=>t.key===r));if(null==s||!s.length)return[];const{clientWidth:l,clientHeight:c}=t.element;let u=l/2,h=c/2,d=-Math.PI/2;const f=i/3;switch(a){case"top":h=f;break;case"bottom":h=c-f,d=3*Math.PI/2-Math.PI;break;case"right":u=l-f,d=0;break;case"left":u=f,d=Math.PI}const p=[];for(let t=0;t<s.length;t+=1){const e=s[t],n=kb(["top","right"].includes(a)?e.attrs.fill:Zx),r={x:u,y:h},o=i/6,l=Sb({points:[{x:r.x+2*o,y:r.y},{x:r.x,y:r.y+o},{x:r.x,y:r.y-o}],angle:d,fill:n,origin:r});p.push(l)}return p}({chart:this.chart,settings:null===(t=this.settings)||void 0===t?void 0:t.settings,symbol:this.symbol})}};function Rb(t,e,n,i){const r=Math.floor(Math.min(t,e)),o=Math.abs(i-n),a=.02*Math.tan(-o/4+Math.PI/2),s=2*(.4+a)-zb(t,e)/r;return{innerRadius:s-2*(r>500?50:Math.max(r/_v*50,10))/r,outerRadius:s,radiusIncrease:a}}function Ab(t,e,n,i){const r=i-Math.PI/2;return{x:t+n*Math.cos(r),y:e+n*Math.sin(r)}}function Cb(t,e){const n=t.getColor()({datum:{value:()=>0}});return e?"#595959":n}function Db({innerRadius:t,outerRadius:e,width:n,height:i}){return(e-t)*Math.min(n,i)/2}function Ob(t){return!1!==t.show&&0!==t.show&&"0"!==t.show}function zb(t,e){return Math.min(6,Math.min(t,e)/kv)}const Eb={require:["chart","symbol"],defaultSettings:{settings:{},style:{}},render(){var t;return function({chart:t,settings:e,symbol:n}){if(!t||!e||!n)return[];const{valueAngle:i}=e;if(!t.component(e.component))return[];const{clientWidth:r,clientHeight:o}=t.element,{outerRadius:a,innerRadius:s}=Rb(r,o,Gx,Kx),l=Db({innerRadius:s,outerRadius:a,width:r,height:o});let c=Ab(r/2,o/2,a*Math.min(r,o)/2,e.valueAngle),u=c.x,h=c.y;const d=[],f=kb(Zx),p={x:u,y:h},g=l/6,m=Sb({points:[{x:p.x,y:p.y},{x:p.x-8*g,y:p.y+g},{x:p.x-8*g,y:p.y-g}],angle:i-Math.PI/2,fill:f,origin:p});return d.push(m),d}({chart:this.chart,settings:null===(t=this.settings)||void 0===t?void 0:t.settings,symbol:this.symbol})}};const Ib={require:["chart","symbol"],defaultSettings:{settings:{},style:{}},render(){var t;return function({chart:t,settings:e,symbol:n}){if(!t||!e||!n)return[];const{size:i,component:r,selector:o,angle:a,radius:s}=e;if(!t.component(e.component))return[];const l=t.findShapes(o).filter((t=>t.key===r));if(null==l||!l.length)return[];const{clientWidth:c,clientHeight:u}=t.element;let h=c/2,d=u/2,{x:f,y:p}=Ab(h,d,s,a);const g=[],m=e.fill,y=a===Gx?-1:1,x={x:f,y:p},v=i/6,b=Sb({points:[{x:x.x+(2*v+1)*y,y:x.y+.5},{x:x.x+1*y,y:x.y+v+.5},{x:x.x+1*y,y:x.y-v+.5}],angle:a,fill:m,origin:x});return g.push(b),g}({chart:this.chart,settings:null===(t=this.settings)||void 0===t?void 0:t.settings,symbol:this.symbol})}};function Tb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pb=Object.prototype.hasOwnProperty,qb=Object.prototype.toString,Lb=Object.defineProperty,jb=Object.getOwnPropertyDescriptor,Fb=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===qb.call(t)},Bb=function(t){if(!t||"[object Object]"!==qb.call(t))return!1;var e,n=Pb.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Pb.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Pb.call(t,e)},Vb=function(t,e){Lb&&"__proto__"===e.name?Lb(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},$b=function(t,e){if("__proto__"===e){if(!Pb.call(t,e))return;if(jb)return jb(t,e).value}return t[e]},Hb=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=$b(s,n),s!==(r=$b(e,n))&&(u&&r&&(Bb(r)||(o=Fb(r)))?(o?(o=!1,a=i&&Fb(i)?i:[]):a=i&&Bb(i)?i:{},Vb(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&Vb(s,{name:n,newValue:r}));return s},Wb=Tb(Hb);let Ub;function Yb(){Ub=Ub||document.createElement("canvas").getContext("2d")}const Xb={measureTextWidth(t){Yb();const{width:e}=Ub.measureText(t);return e},lineWrap(t,e,n,i){let r,o;Yb();const a=t?t.split(/\n+|\r+|\r\n/):[],s=[];let l,c,u,h,d=t?t.split(/\s+/):[],f=a[0];if("number"!=typeof e||e<=0)return[t];if("number"==typeof i&&a.length>=i)return a.slice(0,i);for(n&&(Ub.font=n),o=0;o<a.length;o++){for(h=a[o],d=h.split(/\s+/),[f]=d,u="",r=1;r<d.length;r++)if(l=`${f} ${d[r]}`,c=Xb.measureTextWidth(l),c>e&&("number"!=typeof i||i>s.length)?(s.push(f),f=d[r]):f=l,"number"==typeof i&&s.length>=i){u=d.slice(r+1).join(" ");break}"number"!=typeof i||s.length<i?s.push(f):s[Math.max(0,s.length-1)]=`${s[Math.max(0,s.length-1)]} ${f} ${u}`}return s},wordWrap(t,e,n,i,r){if(Yb(),!t||!t.length)return[];n&&(Ub.font=n);let o=[];const a=t.slice();let s,l,c,u="";if(a.filter((t=>!!t)),"number"!=typeof e||e<0)return t.slice();for(c=0;c<a.length;c++){var h;if(l=a[c],u="",l.length<=1||Xb.measureTextWidth(l)<=e)o.push(l);else if(s=Xb.splitWord(l,e,void 0,void 0===i?void 0:i-o.length),s.length<=1)o.push(s[0]);else u=null!==(h=s.pop())&&void 0!==h?h:"",o=o.concat(s),a[c+1]?Xb.measureTextWidth(`${u} ${a[c+1]}`)>e&&(void 0===i||o.length+a.length-c<=i)?a.splice(c+1,0,u):a[c+1]=`${u} ${a[c+1]}`:a.push(u)}return o.forEach(((t,e,n)=>{n[e]=t.trim()})),void 0!==i&&o.length>i?(o=o.splice(0,i),o[o.length-1]=Xb.truncate(o[o.length-1],e,n,r).text):(l=o[o.length-1],l&&l.length>1&&Xb.measureTextWidth(l)>e&&(o[o.length-1]=Xb.truncate(l,e,n,r).text)),o},truncate(t,e,n,i="…"){Yb();let r,o,a,s,l=t;const c=Xb.measureTextWidth("i");if(n&&(Ub.font=n),t&&e){if(Xb.measureTextWidth(l)>e){const t=Math.ceil(e/c);for(r=Math.min(t,l.length);r>0;r--)if(o=l.substring(0,r-1),a=o.trim()+i,Xb.measureTextWidth(a)<=e){s=l.substring(r-1),l=a;break}r||(s=l,l="…")}}else s=void 0;return{text:l,rest:s}},isNumber:t=>"number"==typeof t&&Number.isFinite(t),explodeWord(t,e,n,i){let r;Yb();let o,a=t,s="",l=[];if(void 0!==n&&Xb.isNumber(n)&&n<=1)return[t];const c=Math.ceil(e/i);for(r=Math.min(t.length,c);r>0&&(a=t.substring(0,r),o=t.substring(r-1,r)," "===o?a=t.substring(0,r-1):a+="-",s=t.substring(r),!(Xb.measureTextWidth(a)<=e));r--);return(!r&&!a||Xb.measureTextWidth(a)>e)&&(a=t.substring(0,1),s=t.substring(1)),l.push(a),s?(Xb.measureTextWidth(s)>e?l=l.concat(Xb.explodeWord(s,e,void 0===n?void 0:n-1,i)):l.push(s),l.filter((t=>""!==t.trim()))):l},splitWord:(t,e,n,i)=>(Yb(),t&&e?(n&&(Ub.font=n),Xb.explodeWord(t,e,i,Math.max(1,Xb.measureTextWidth("i")))):[]),wrapText(t,e,n,i,r="…"){let o;return Number.isNaN(e)||!e?[t]:(o=void 0===i||i>1?Xb.lineWrap(t,e,n,i):[t],o=Xb.wordWrap(o,e,n,i,r),o)},getFontHeight:t=>(Yb(),t&&(Ub.font=t),1.5*Xb.measureTextWidth("m")),tokenize(t,e,n,i,r,o,a=1){Yb(),e&&(Ub.font=e);const s=Xb.getFontHeight(),l=a*s;let c=[],u=[];if(void 0!==o&&o<s)return[];const h=o?Math.max(1,Math.floor(o/l)):i||1;return c=[void 0===i||Number.isNaN(i)||i<=0?h:Math.min(h,i)],Array.isArray(t)?t.forEach(((t,n)=>{u.length<h&&(u=u.concat(Xb.wrapText(t,r,e,c[n])))})):u=Xb.wrapText(t,r,e,c[0],n),u}};function Gb({chart:t,renderer:e,refLine:n,settings:i,width:r,height:o,barWidth:a}){if(!t||!e||!i)return{};const{position:s,scale:l,value:c,label:u,line:h,formatter:d}=n,f=n.radius?n.radius*(Math.min(r,o)/2):r/2,p=(Kx-Gx)*s+Gx-Math.PI/2,g={x:r/2,y:o/2};let m=Wb(!0,{},i.style.line,h||{});const y={type:"line",...{x1:g.x+Math.cos(p)*f,y1:g.y+Math.sin(p)*f,x2:g.x+Math.cos(p)*(f+a),y2:g.y+Math.sin(p)*(f+a)},stroke:m.stroke,strokeWidth:m.strokeWidth,strokeDasharray:m.strokeDasharray};let x;if(u){const n=Wb(!0,{fill:"#000",fontFamily:"Arial",fontSize:"12px",opacity:1,padding:5,background:{fill:"#fff",stroke:"transparent",strokeWidth:0,opacity:.5}},i.style.label||{},{fill:m.stroke},u),{fontFamily:s,fontSize:h,fill:y,opacity:v}=n,b=u.showLabel?n.text:"";let w,M="";if("string"==typeof d||"object"==typeof d)w=t.formatter(d);else if(void 0!==l&&"string"!=typeof l&&"function"==typeof l.data){const t=l.data()&&l.data().fields;w=t&&t[0]?t[0].formatter():null}!1!==u.showValue&&(w?M=` (${w("function"==typeof c?c():c)})`:l&&(M=` (${c})`));const k=t=>e.measureText({text:t,fontFamily:s,fontSize:h}),_=k("M").height,S=`normal ${h} ${s}`;let N,R=fv;const A=`${b}${M}`||"",C=Math.min(r,o),D=Math.min(8,C/200),O=Ab(g.x,g.y,f+a+D,p+Math.PI/2),z=k(A).width;N=Math.min(O.x,r-O.x-Jx,dv),R=function(t,e,n){const i=Math.min(Math.floor((t+Jx)/e),Math.floor((n-t)/e));return Math.min(i,fv)}(O.y,_,o);let E=Xb.tokenize(A,S,`... ${M}`,R,N,void 0);const I=function(t){let e="start";const n=t>-Math.PI&&t<0?"baseline":"hanging";return(t+=Math.PI/2)<0&&t>-Math.PI?e="end":t>0&&t<Math.PI&&(e="start"),{textAnchor:e,baseline:n}}(p);O.y-2*_>0&&O.y+2*_<o&&(O.x-z+Jx<0&&"end"===I.textAnchor||O.x+z-Jx>r)&&(E=Xb.tokenize(A,S,`... ${M}`,R,N,void 0)),x={fill:y,opacity:v,fontFamily:s,fontSize:h,linePosition:O,lineHeight:_,align:"left",baseline:I.baseline,textAnchor:I.textAnchor,lines:E}}return{lineNode:y,labelNode:x}}const Kb={require:["chart","renderer"],defaultSettings:{style:{line:{stroke:"#000"}}},render(){var t,e;let{settings:n,chart:i,renderer:r,rect:o}=this;if(!(i&&o&&n&&r))return[];const{width:a,height:s}=o,l=null!==(t=null==n||null===(e=n.settings)||void 0===e?void 0:e.barWidth)&&void 0!==t?t:0;let c=(null==n?void 0:n.lines)&&n.lines.radial||[];if(0===c.length)return[];c=c.map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=null==i?void 0:i.scale("string"==typeof t.scale?t.scale:"");const n=e(t.value);return Wb(t,{scale:e,position:n})}return Wb(t,{position:t.value})}));const u=[];let h=[];[...c].forEach((t=>{if(t.position>0&&t.position<1){const{lineNode:e,labelNode:o}=Gb({chart:i,renderer:r,refLine:t,settings:n,width:a,height:s,barWidth:l});e&&u.push(e),o&&h.push(o)}}));const d=[];h.forEach((t=>{const{fill:e,opacity:n,fontFamily:i,fontSize:r,lines:o,lineHeight:a,textAnchor:s,linePosition:l,baseline:c}=t,u=l,h=o.length-1,f=o.map(((t,o)=>{let l=u.y;return h>0&&("baseline"===c?l-=(h-o)*a:l+=o*a),{type:"text",text:t,baseline:c,anchor:s,fill:e,opacity:n,fontFamily:i,fontSize:r,x:u.x,y:l}}));d.push(...f)}));const{MEDIUM:f,SMALLER:p}=wv,g=a>=f.width&&s>=f.height;return[...a>=p.width&&s>=p.height?u:[],...g?d:[]]}};const Zb={require:["chart","symbol"],defaultSettings:{settings:{},style:{}},render(){var t;return function({chart:t,settings:e,symbol:n}){if(!t||!e||!n)return[];const{valueAngle:i}=e,{clientWidth:r,clientHeight:o}=t.element,a=.4*Math.min(r,o),s=[],l=e.fill,c={x:r/2,y:o/2},u=Sb({points:[{x:c.x-a/2,y:c.y+a/2},{x:c.x,y:c.y-a},{x:c.x+a/2,y:c.y+a/2}],angle:i,fill:l,origin:c});return s.push(u),s}({chart:this.chart,settings:null===(t=this.settings)||void 0===t?void 0:t.settings,symbol:this.symbol})}},Jb={getGap(t,e){const n=t.position<e.position?t:e,i=t.position<e.position?e:t;return i.position-i.radius-(n.position+n.radius)},findSegmentPositionMeetMaxThenMin(t,e,n){const i=t.position+t.radius,r=t.position-Math.max(0,i-n),o=r-t.radius;return r+Math.max(0,e-o)},layoutPositionFromMin(t,e,n,i=0){const r=t.length-1;let o,a,s,l=e;for(let e=0;e<r;e++)o=t[e],a=t[e+1],s=(o.position+a.position)/2-i/2,o.position=Jb.findSegmentPositionMeetMaxThenMin(o,l,s),l=o.position+o.radius+i;a&&(a.position=Jb.findSegmentPositionMeetMaxThenMin(a,l,n))},adjustPositionFromMax(t,e,n,i=0){const r=t.length-1,o=Math.max(0,t[r].position+t[r].radius-n);if(0===o)return;let a,s,l,c,u=0;for(a=r;a>0&&(s=t[a],l=t[a-1],c=Math.max(0,Jb.getGap(l,s)-i),c-=Math.max(0,u+c-o),u+=c,s.move=c,!(u>=o));a--);for(u<o&&l&&(c=Math.max(0,l.position-l.radius-e),c-=Math.max(0,u+c-o),u+=c,l.move=c),u=0,a=0;a<=r;a++)s=t[a],u+=s.move||0,s.move=u,s.position-=u},createLayout(t,e,n,i=0){const r=t.map((t=>t.segment)),o=r.length-1;if(o<0)return[];if(0===o){const t=r[0];t.position=Jb.findSegmentPositionMeetMaxThenMin(t,e,n)}else Jb.layoutPositionFromMin(r,e,n,i),Jb.adjustPositionFromMax(r,e,n,i);return t.filter((t=>{const i=Math.ceil(t.segment.position-t.segment.radius),r=t.segment.position+t.segment.radius;return i>=e&&r<=n}))}};const Qb={require:["chart","renderer"],defaultSettings:{style:{line:{stroke:"#000"}}},render(){var t,e;let{settings:n,chart:i,renderer:r,rect:o}=this;if(!(i&&o&&n&&r))return[];const{width:a,height:s}=o,l=null!==(t=null==n||null===(e=n.settings)||void 0===e?void 0:e.barWidth)&&void 0!==t?t:0,c=(null==n?void 0:n.lines)&&n.lines.x||[],u=(null==n?void 0:n.lines)&&n.lines.y||[];let h=c.length>0?c:u;if(0===h.length)return[];const d=c.length>0;h=h.map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=null==i?void 0:i.scale("string"==typeof t.scale?t.scale:"");const n=e(t.value);return Wb(t,{scale:e,position:n})}return Wb(t,{position:t.value})}));const f=[];let p=[];if([...h].forEach((t=>{if(Ob(t)&&t.position>0&&t.position<1){const{lineNode:e,labelNode:o}=function({chart:t,renderer:e,refLine:n,settings:i,width:r,height:o,isVerticalRefLine:a,barWidth:s}){if(!t||!e||!i)return{};const{position:l,scale:c,value:u,label:h,line:d,formatter:f}=n;let p=Wb(!0,{},i.style.line,d||{});const g={type:"line",...a?{x1:l*r,x2:l*r,y1:o/2-s/2,y2:o/2+s/2}:{x1:r/2-s/2,x2:r/2+s/2,y1:l*o,y2:l*o},stroke:p.stroke,strokeWidth:p.strokeWidth,strokeDasharray:p.strokeDasharray};let m;if(h){const n=Wb(!0,{fill:"#000",fontFamily:"Arial",fontSize:"12px",opacity:1,padding:5,background:{fill:"#fff",stroke:"transparent",strokeWidth:0,opacity:.5}},i.style.label||{},{fill:p.stroke},h),{fontFamily:d,fontSize:g,fill:y,opacity:x}=n,v=h.showLabel?n.text:"";let b,w="";if("string"==typeof f||"object"==typeof f)b=t.formatter(f);else if(void 0!==c&&"string"!=typeof c&&"function"==typeof c.data){const t=c.data()&&c.data().fields;b=t&&t[0]?t[0].formatter():null}!1!==h.showValue&&(b?w=` (${b("function"==typeof u?u():u)})`:c&&(w=` (${u})`));const M=t=>e.measureText({text:t,fontFamily:d,fontSize:g}),k=M("M").height,_=`normal ${g} ${d}`,S=a?hv.MAX_WIDTH:r/2-s/2-hv.CLEARANCE,N=a?2:1,R=`${v}${w}`||"",A=Xb.tokenize(R,_,`... ${w}`,N,S,void 0),C=(a?r:o)*l,D=Math.min(S,Math.max(...A.map((t=>M(t).width)))),O=A.length*k;m={fill:y,opacity:x,fontFamily:d,fontSize:g,linePosition:C,lineHeight:k,lines:A,segment:{position:C,radius:a?D/2:O/2}}}return{lineNode:g,labelNode:m}}({chart:i,renderer:r,refLine:t,settings:n,width:a,height:s,isVerticalRefLine:d,barWidth:l});e&&f.push(e),o&&p.push(o)}})),d)p=Jb.createLayout(p,0,a,hv.GAP);else{const{attrs:t}=i.findShapes("text").filter((t=>t.key===gv.GAUGE_LABEL))[0],{"font-size":e}=t,n=parseFloat(e);let r=p.filter((e=>e.segment.position<t.y)),o=p.filter((e=>e.segment.position>t.y));r.sort(((t,e)=>t.segment.position-e.segment.position)),o.sort(((t,e)=>t.segment.position-e.segment.position)),r=Jb.createLayout(r,0,t.y-n/2),o=Jb.createLayout(o,t.y+n/2,s),p=[...r,...o]}const g=[],m=[];p.forEach((t=>{const{fill:e,opacity:n,fontFamily:i,fontSize:r,lines:o,segment:c,linePosition:u,lineHeight:h}=t,{position:f}=c;if(u!==f&&""!==t.lines[0]){let t={x1:a/2+l/2,x2:a/2+l/2+.75*hv.CLEARANCE,y1:u,y2:f};d&&(t={y1:s/2+l/2,y2:s/2+l/2+hv.CLEARANCE,x1:u,x2:f});const n={type:"line",...t,stroke:e,strokeWidth:1};m.push(n)}const p=o.map(((t,o)=>{let c=d?s/2+l/2+h/2+hv.CLEARANCE:f;return c+=o*h,{type:"text",text:t,baseline:"central",anchor:d?"middle":"start",fill:e,opacity:n,fontFamily:i,fontSize:r,x:d?f:a/2+l/2+hv.CLEARANCE,y:c}}));g.push(...p)}));const{MEDIUM:y,SMALLER:x}=wv,v=a>=y.width&&s>=y.height;return[...a>=x.width&&s>=x.height?f:[],...v?g:[],...v?m:[]]}};function tw({layout:t,options:e}){return t.snapshotData&&!e.freeResize?{width:t.snapshotData.content.size.w,height:t.snapshotData.content.size.h}:void 0}function ew(t,e,n){if(t>=n)return 1;if(t<=e)return 0;const i=Math.min(1,Math.max(0,(t-e)/(n-e)));return Number.isNaN(i)?0:i}function nw({chart:t,layoutService:e,dockService:n}){const{width:i,height:r}=n.meta.chart.size,{isVertical:o}=e.meta,a=Math.min(Xx,o?i/10:r/10),s=o?r:i;function l(){const{min:t,max:n}=e.meta.rangeLimits,i=e.meta.qHyperCube.qDataPages[0].qMatrix[0][0].qNum;return s*ew(i,t,n)}const c={getBottomPadding(t){if(o){const e=l()+-t.height*nv.VERTICAL_ALIGNMENT_FACTOR,n=ev.BOTTOM,i=s-t.height-ev.TOP;return e<n?n:e>i?i:e}const{MAX_LINES:n,ESTIMATED_LINE_HEIGHT:c,CLEARANCE:u}=hv,h=function(){const{MEDIUM:t}=wv,n=i>=t.width&&r>=t.height,{refLines:o}=e.meta;return o&&o.filter(Ob).length>0&&n}()?n*c+u:0;return-a*iv.VERTICAL_ALIGNMENT_FACTOR-h},getTopPadding:t=>-c.getBottomPadding(t),getLeftPadding(t){if(o)return i/5+a;const e=l()-t.width/2,n=ev.RIGHT,r=s-t.width-ev.LEFT;return e<n?n:e>r?r:e},getRightPadding:t=>-c.getLeftPadding(t)},u={getLeftPadding(e){if(!o)return 0;const n=t.findShapes("container").filter((t=>t.key===gv.BAR_AXIS));if(1!==n.length)return 0;const r=n[0],s=Math.max(...r.children.filter((t=>"text"===t.type)).map((t=>t.bounds.width))),l=Math.max(...r.children.filter((t=>"line"===t.type)).map((t=>t.bounds.width)));let c=a/2+s+l+a*uv;return c>i/2-e.height/4&&(c=i/2-e.height/4),-c},getRightPadding:t=>-u.getLeftPadding(t),getTopPadding(){if(o)return-4;const e=t.findShapes("container").filter((t=>t.key===gv.BAR_AXIS));if(1!==e.length)return 0;const n=e[0],i=Math.max(...n.children.filter((t=>"text"===t.type)).map((t=>t.bounds.height))),r=Math.max(...n.children.filter((t=>"line"===t.type)).map((t=>t.bounds.height)));return-(a/2+i+r+a*cv)},getBottomPadding:()=>-u.getTopPadding()};return{getBarWidthInPixels:()=>a,getValueLabelFontSize:function(t,e){const n=ew(Math.min(r,i),tv.MIN,tv.MAX);return t+Math.round(n*(e-t))},barValueLabel:c,barAxisTitle:u}}const iw=({core:t})=>{const h=r(),d=o(),f=a(),p=s(),g=l(),y=e(),x=c(),{qLocaleInfo:v}=u(),[b,w]=n(null);return i((()=>{if(!h||!t)return;const{picassoInstance:e,chart:n}=t;if(!n)return;const i=function(t){var e=t.source,n=t.metaAdditionsFn,i=t.experimental,r=void 0===i?{filter:!1}:i,o=I(!0,{},e),a=r.filter?function(t){var e=t.qHyperCube,n=Ne(e,Se.DIMENSION),i=n.reduced,r=n.filtered;e[Se.DIMENSION]=i;var o=Ne(e,Se.MEASURE),a=o.reduced,s=o.filtered;return e[Se.MEASURE]=a,{dimensions:r,measures:s}}(o):{dimensions:[],measures:[]},s=Ae(o),l=function(){var t=function(t){var e=t.layout,n=t.additionsFn,i=void 0===n?function(){return{}}:n,r=t.additionsProps,o=void 0===r?{}:r,a=e.qHyperCube,s=a.qDimensionInfo,l=a.qMeasureInfo,c=a.qMode,u=s.length,h=l.length,d=m({mode:{S:"S"===c,P:"P"===c,K:"K"===c,T:"T"===c},dimensionCount:u,measureCount:h,hasMultipleDimensions:u>1,hasMultipleMeasures:h>1,isOneDimensional:1===u,isTwoDimensional:2===u},o);return m(m({},d),i({layout:e,meta:d}))}({layout:o,additionsFn:n,additionsProps:{size:s.size}});return t.filteredFields=a,t},c={refs:m({},s.refs),meta:l(),getLayout:function(){return o},getLayoutValue:function(t,e){return we(o,t,e)},setLayoutValue:function(t,e){ke(o,t,e),s=Ae(o),c.meta=l()},getHyperCube:function(){return o.qHyperCube},getHyperCubeValue:function(t,e){return we(o.qHyperCube,t,e)},setHyperCubeValue:function(t,e){ke(o.qHyperCube,t,e),s=Ae(o),c.meta=l()},getDataPages:function(){return we(o,s.refs.dataPages)},setDataPages:function(t){ke(o,s.refs.dataPages,t),c.meta=l()}};return c}({source:h,metaAdditionsFn:function({layout:t}){var e;const{measureAxis:n,qHyperCube:i,autoOrientation:r,gaugetype:o,useSegments:a,segmentInfo:s,refLine:l}=t,c=null===(e=t.qHyperCube)||void 0===e?void 0:e.qMeasureInfo[0].qFallbackTitle,{width:u,height:h}=g;let d=t.orientation;r&&(d=u>=h?"horizontal":"vertical");const f="vertical"===d,p=function({measureAxis:t,qHyperCube:e}){if(!t||!e)return{min:0,max:1};let{min:n,max:i}=t;if(n=Number(n),i=Number(i),n!==i)return{min:Math.min(n,i),max:Math.max(n,i)};const r=e.qDataPages[0].qMatrix[0][0].qNum;let o=Math.abs(r-n)/2;return 0===o&&(o=0!==n?Math.abs(n)/2:Number.MAX_VALUE/2),{min:n-o,max:i+o}}({measureAxis:n,qHyperCube:i}),m=(null==l?void 0:l.refLines)||[];return{measureAxisTitle:c,measureAxisSpacing:null==n?void 0:n.spacing,rangeLimits:p,qHyperCube:i,orientation:d,autoOrientation:r,gaugetype:o,isVertical:f,useSegments:a,segmentInfo:s,refLines:m}}}),r=tw({layout:i.getLayout(),options:y}),o=be({chart:n,layoutService:i,config:{logicalSize:r},typeConfig:{type:"major-minor",fallback:"vertical",invert:!0}}),a=le({app:f,model:p,translator:x,picasso:e,layoutService:i,config:{key:"color",localeInfo:v,theme:d,auto:()=>({mode:"primary",byMeasureDef:{activeMeasureIndex:0,type:"expression",label:""}})}}),s=function(t){var e=t.theme,n=t.config,i=void 0===n?{}:n,r=i.id,o=i.resolve,a=void 0===o?[]:o,s=i.transform,l=void 0===s?[]:s,c=i.extend,u=void 0===c?[]:c,h={theme:e,matrix:Ve(a),styles:void 0};return h.styles=He({theme:e,id:r,transform:l,extend:u,matrix:h.matrix}),{getStyles:function(){return h.styles},getTheme:function(){return h.theme},setTheme:function(t){h.theme=t,h.styles=He({theme:t,id:r,transform:l,extend:u,matrix:h.matrix})}}}({theme:d,config:{id:"gauge"}}),l=nw({chart:n,layoutService:i,dockService:o}),c=function({layoutService:t,themeService:e,colorService:n}){const i=e.getStyles(),r=e=>{var n;const i=null===(n=t.getLayoutValue("components",[]))||void 0===n?void 0:n.find((t=>t.key===e));return i},o=t=>t?n.getPaletteColor(t):void 0;return{query:{axis:{title:{getStyle:()=>{var t,e,n,a;return{fontFamily:null!==(t=null===(e=r("axis"))||void 0===e||null===(e=e.axis)||void 0===e||null===(e=e.title)||void 0===e?void 0:e.fontFamily)&&void 0!==t?t:i.axis.title.fontFamily,fontSize:i.axis.title.fontSize,color:null!==(n=o(null===(a=r("axis"))||void 0===a||null===(a=a.axis)||void 0===a||null===(a=a.title)||void 0===a?void 0:a.color))&&void 0!==n?n:i.axis.title.color}}},label:{getStyle:()=>{var t,e,n,a;return{fontFamily:null!==(t=null===(e=r("axis"))||void 0===e||null===(e=e.axis)||void 0===e||null===(e=e.label)||void 0===e||null===(e=e.name)||void 0===e?void 0:e.fontFamily)&&void 0!==t?t:i.axis.label.name.fontFamily,fontSize:i.axis.label.name.fontSize,fill:null!==(n=o(null===(a=r("axis"))||void 0===a||null===(a=a.axis)||void 0===a||null===(a=a.label)||void 0===a||null===(a=a.name)||void 0===a?void 0:a.color))&&void 0!==n?n:i.axis.label.name.color}}}},label:{getStyle:()=>{var t,e,n,a;return{fontFamily:null!==(t=null===(e=r("value"))||void 0===e||null===(e=e.label)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.fontFamily)&&void 0!==t?t:i.label.value.fontFamily,fill:null!==(n=o(null===(a=r("value"))||void 0===a||null===(a=a.label)||void 0===a||null===(a=a.value)||void 0===a?void 0:a.color))&&void 0!==n?n:i.label.value.color}}}}}}({layoutService:i,themeService:s,colorService:a});w({layoutService:i,colorService:a,dockService:o,labelService:l,themeService:s,styleService:c})}),[p,f,h,d.name(),x.language(),t,g]),b};function rw({width:t,height:e,fontSize:n}){const{FULL:i}=wv;if(t>=i.width&&e>=i.height){let t=Number.parseFloat(n);return t=Math.floor(t*rv),`${t}px`}return n}function ow({width:t,height:e,isVertical:n,styleService:i,themeService:r}){const o=r.getStyles(),a=i.query.axis.label.getStyle(),{fontFamily:s,fill:l,fontSize:c}=a;return[{type:"axis",key:gv.BAR_AXIS,dock:"center",scale:"m",layout:{minimumLayoutMode:mv},settings:{align:n?"left":"top",line:{show:!n},labels:{minLengthPx:20,fontFamily:s,fill:l,fontSize:rw({width:t,height:e,fontSize:c})},paddingStart:()=>{if(n){const e=Math.min(t/10,Xx);return t/2+e/2}const i=Math.min(e/10,Xx);return e/2+i/2+lv},ticks:{stroke:o.axis.line.major.color}}}]}function aw({width:t,height:e,measureAxisTitle:n,isVertical:i,labelService:r,styleService:o}){const{getTopPadding:a,getBottomPadding:s,getLeftPadding:l,getRightPadding:c}=r.barAxisTitle,u=o.query.axis.title.getStyle(),{fontFamily:h,fontSize:d,color:f}=u;return[{type:"labels",key:gv.AXIS_TITLE,layout:{minimumLayoutMode:yv},settings:{sources:[{component:gv.BACKGROUND_BAR,selector:"rect",strategy:{type:"bar",settings:{direction:i?"up":"right",align:.5,justify:.5,labels:[{fontFamily:h,fill:f,fontSize:Number.parseFloat(rw({width:t,height:e,fontSize:d})),label:()=>n,placements:[{position:"inside",padding:{top:a,bottom:s,left:l,right:c},overflow:!0}]}]}}}]}}]}var sw=t=>()=>t;function lw(t){return 1==(t=+t)?cw:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):sw(isNaN(e)?n:e)}}function cw(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):sw(isNaN(t)?e:t)}var uw=function t(e){var n=lw(e);function i(t,e){var i=n((t=Yv(t)).r,(e=Yv(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=cw(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1);function hw({thisColor:t,paletteColors:e,paletteIndex:n,limit:i,isLeft:r=!1,themeService:o}){const a=r?0:1,s=0===Object.entries(i).length,l=i.gradient;let c=n+(r?-1:1);s&&(c=r?0:e.length-1);const u=o.getTheme().getColorPickerColor(c<e.length&&c>=0?e[c]:e[0]);return{color:l?uw(t,u)(.5):t,offset:a,gradient:l}}function dw({limits:t,paletteColors:e,paletteIndex:n,themeService:i}){const r=we(t,""+(n-1),{}),o=we(t,`${n}`,{}),a=[r,o].map((t=>t.gradient)).includes(!0),s=i.getTheme().getColorPickerColor(e[n]);if(!a)return[{offset:0,color:s},{offset:1,color:s}];const l=[hw({thisColor:s,paletteColors:e,paletteIndex:n,limit:r,isLeft:!0,themeService:i}),hw({thisColor:s,paletteColors:e,paletteIndex:n,limit:o,isLeft:!1,themeService:i})],c=2===l.filter((t=>t.gradient)).length;c&&l.splice(1,0,{offset:.5,color:s,gradient:!0});const u=l.map((({offset:t,color:e,gradient:n})=>({offset:t,color:e,gradient:n})));return u}function fw({themeService:t,segmentInfo:e,rangeLimits:n}){const{limits:i,paletteColors:r}=e,{min:o,max:a}=n;i.sort(((t,e)=>t.value-e.value));const s=[o,...i.map((t=>t.value)),a],l=[];for(let e=0;e<r.length;e++){const n=dw({limits:i,paletteColors:r,paletteIndex:e,themeService:t}).map((t=>({offset:ew(s[e]+t.offset*(s[e+1]-s[e]),o,a),color:t.color,gradient:"gradient"in t?t.gradient:void 0})));l.push(...n)}return l}function pw(t,e,n){const i=fw({themeService:e,segmentInfo:n,rangeLimits:t}),r=(Kx-Gx)/(2*Math.PI),o=i.map((t=>({offset:t.offset*r,color:t.color})));return{type:"gradient",orientation:"conic",startAngle:Gx-Math.PI/2,x:0,y:0,stops:o}}function gw({orientation:t,colorService:e,rangeLimits:n,isVertical:i,useSegments:r,themeService:o,segmentInfo:a}){let{min:s,max:l}=n;const c={type:"box",key:gv.BAR,data:{extract:{field:"qMeasureInfo/0",props:{start:s,end:{field:"qMeasureInfo/0"}}}},settings:{minor:{scale:"m"},orientation:t,box:{width:.1,maxWidthPx:Xx,fill:e.getColor()}}},u={type:"box",key:gv.BAR,data:{extract:{field:"qMeasureInfo/0",props:{start:s,end:l}}},settings:{minor:{scale:"m"},orientation:t,box:{width:.1,maxWidthPx:Xx,fill:()=>function({themeService:t,isVertical:e,segmentInfo:n,rangeLimits:i}){return{type:"gradient",x1:0,x2:e?0:1,y1:e?1:0,y2:0,stops:fw({themeService:t,segmentInfo:n,rangeLimits:i})}}({themeService:o,isVertical:i,segmentInfo:a,rangeLimits:n})}}},h={type:"box",key:gv.BACKGROUND_BAR,data:{extract:{field:"qMeasureInfo/0",props:{start:s,end:l}}},settings:{minor:{scale:"m"},orientation:t,box:{width:.1,maxWidthPx:Xx,fill:Zx}}};return[{type:"box",key:gv.LABEL_BAR,data:{extract:{field:"qMeasureInfo/0",props:{start:s,end:s}}},settings:{minor:{scale:"m"},orientation:t,box:{width:i?av:sv,opacity:0}}},h,r?u:c]}function mw({isVertical:t,chart:e,labelService:n,styleService:i}){if(!e.formatter)return[];const{getValueLabelFontSize:r,barValueLabel:o}=n,{getTopPadding:a,getBottomPadding:s,getLeftPadding:l,getRightPadding:c}=o,u=r(Qx.MIN,Qx.MAX),h=i.query.label.getStyle();return[{type:"labels",key:gv.GAUGE_LABEL,layout:{minimumLayoutMode:t?xv:vv},settings:{sources:[{component:gv.LABEL_BAR,selector:"rect",formatter:"measure",strategy:{type:"bar",settings:{direction:t?"up":"right",orientation:"horizontal",fontFamily:h.fontFamily,fill:h.fill,fontSize:u,align:t?0:.5,justify:0,labels:[{label:({data:t})=>t?e.formatter(pv.MEASURE)(t.value):"",placements:[{position:"outside",padding:{top:a,bottom:s,left:l,right:c},overflow:!0}]}]}}}]}}]}function yw({labelService:t,rangeLimits:e,qHyperCube:n,isVertical:i}){const{min:r,max:o}=e,a=n.qDataPages[0].qMatrix[0][0].qNum;if(a<=o&&a>=r)return!1;let s=i?"bottom":"left";return a>o&&(s=i?"top":"right"),{type:"oob-indicator",key:gv.OOB_INDICATOR,layout:{displayOrder:2},settings:{component:"bar",selector:"rect",pointingTo:s,size:t.getBarWidthInPixels()}}}function xw({width:t,height:e,styleService:n,themeService:i}){const r=Rb(t,e,Gx,Kx),{innerRadius:o,outerRadius:a,radiusIncrease:s}=r,l=4*s,c=Math.min(t,e)/2,u=i.getStyles(),h=n.query.axis.label.getStyle(),{tickLength:d,labelPadding:f}=function({width:t,height:e,defaultTickSize:n,defaultLabelPadding:i}){const r=Math.min(Math.min(t,e)/Mv,1);return{tickLength:n*r,labelPadding:i*r}}({width:t,height:e,defaultTickSize:8,defaultLabelPadding:20}),p=zb(t,e);return[{type:"axis",dock:"center",layout:{minimumLayoutMode:bv},scale:"m",settings:{arc:{radius:a,startAngle:Gx,endAngle:Kx,offset:-10*l*(a-o)*c},align:"top",line:{show:!1,stroke:"#cdcdcd"},ticks:{tickSize:d,stroke:u.axis.line.major.color,margin:p},labels:{margin:-6-2*d+f,fontFamily:h.fontFamily,fill:h.fill,fontSize:h.fontSize}}}]}function vw({qHyperCube:t,rangeLimits:e,width:n,height:i,colorService:r,themeService:o,segmentInfo:a,useSegments:s}){const{outerRadius:l,innerRadius:c}=Rb(n,i,Gx,Kx),u=e.max,h=t.qDataPages[0].qMatrix[0][0].qNum,d=u-h,f=[{value:h-e.min,valueLabel:"Measure"},{value:d,valueLabel:"Remaining"}],p=function({themeService:t,segmentInfo:e,rangeLimits:n}){const i=fw({themeService:t,segmentInfo:e,rangeLimits:n});let r=0,o=0,a=i.map((t=>(o=0===n.max?t.offset*(n.max-n.min)-r:t.offset*n.max-r,r+=o,{value:o,color:t.color,gradient:t.gradient}))).filter((t=>0!==t.value));return a.forEach((t=>{t.value=Math.abs(t.value)})),a}({themeService:o,segmentInfo:a,rangeLimits:e}),g={type:"pie",key:gv.RADIAL_GAUGE,data:{items:f},settings:{startAngle:Gx,endAngle:Kx,slice:{arc:{ref:"value"},outerRadius:()=>l,innerRadius:()=>c,fill:(t,e)=>{const n=r.getColor();return 0===e?n(t):Zx},strokeWidth:0}}},m={type:"pie",key:gv.RADIAL_GAUGE,renderer:"canvas",displayOrder:1,data:{items:p},settings:{startAngle:Gx,endAngle:Kx,slice:{arc:{ref:"value"},outerRadius:()=>l,innerRadius:()=>c,strokeWidth:0,fill:(t,n)=>{var i;return t.datum.value.gradient||null!==(i=p[n-1])&&void 0!==i&&i.gradient?pw(e,o,a):t.datum.value.color}}}},y={type:"pie",key:"circle-gauge",renderer:"canvas",displayOrder:0,data:{items:[{value:h,valueLabel:"Measure"}]},settings:{startAngle:0,endAngle:2*Math.PI,slice:{arc:{ref:"value"},outerRadius:()=>l,innerRadius:()=>c,fill:()=>function(t,e,n){let i=pw(t,e,n);const r={offset:(Kx-Gx)/(2*Math.PI),color:"rgba(0, 0, 0, 0)"};return i.stops.push(r),i.stops.push({offset:1,color:"rgba(0, 0, 0, 0)"}),i}(e,o,a),opacity:s?1:0}}};return[y,s?m:g]}function bw({qHyperCube:t,chart:e,styleService:n,labelService:i}){const r=t.qMeasureInfo[0].qFallbackTitle,o=n.query.label.getStyle(),a=n.query.axis.title.getStyle(),{getValueLabelFontSize:s}=i,l=s(Qx.MIN,Qx.MAX),c={type:"labels",key:gv.RADIAL_GAUGE_LABEL,layout:{displayOrder:4},settings:{sources:[{component:"circle-gauge",selector:"path",strategy:{type:"rows",settings:{fill:"#000",padding:0,labels:[{fontSize:l,fontFamily:o.fontFamily,fill:o.fill,label({data:t}){const n=e.formatter(pv.MEASURE);return t&&n?n(t.value.value):""}},{fontSize:Number.parseFloat(a.fontSize),fontFamily:a.fontFamily,fill:a.color,label:()=>r}]}}}]}};return[c]}function ww({width:t,height:e,rangeLimits:n,qHyperCube:i}){const{min:r,max:o}=n,a=i.qDataPages[0].qMatrix[0][0].qNum;if(a>o||a<r)return!1;const s=Rb(t,e,Gx,Kx).outerRadius,l=Gx+(a-r)/(o-r)*(Kx-Gx);return{type:"radial-gauge-needle",key:gv.RADIAL_GAUGE_NEEDLE,layout:{displayOrder:2},settings:{component:"radial-gauge",selector:"path",radius:s,valueAngle:l}}}function Mw({rangeLimits:t,qHyperCube:e,width:n,height:i,colorService:r,useSegments:o}){const{min:a,max:s}=t,l=e.qDataPages[0].qMatrix[0][0].qNum,{outerRadius:c,innerRadius:u}=Rb(n,i,Gx,Kx),h=(u+(c-u)/2)*Math.min(n,i)/2;if(l<=s&&l>=a)return!1;let d=Gx;return l>s&&(d=Kx),{type:"radial-oob-indicator",key:gv.RADIAL_OOB_INDICATOR,layout:{displayOrder:2},settings:{component:"radial-gauge",selector:"path",angle:d,radius:h,size:Db({innerRadius:u,outerRadius:c,width:n,height:i}),fill:Cb(r,o)}}}function kw({refLines:t,colorService:e,themeService:n,width:i,height:r}){const o=n.getStyles(),a=Rb(i,r,Gx,Kx),s={type:"radial-custom-ref-line",key:"radial-reference-lines",displayOrder:1,settings:{barWidth:Db({innerRadius:a.innerRadius,outerRadius:a.outerRadius,width:i,height:r})},lines:{radial:t.filter(Ob).map((t=>{var n,i;return{scale:"m",value:t.refLineExpr.value,label:{text:t.label,...o.referenceLine.label.name,showValue:t.showValue,showLabel:t.showLabel},radius:a.innerRadius,line:{stroke:e.getPaletteColor(t.paletteColor||{index:t.color}),strokeWidth:(null===(n=t.style)||void 0===n?void 0:n.lineThickness)||2,strokeDasharray:null===(i=t.style)||void 0===i?void 0:i.lineType}}}))}};return s}function _w({width:t,height:e,rangeLimits:n,qHyperCube:i,colorService:r,useSegments:o,segmentInfo:a}){const{min:s,max:l}=n,c=i.qDataPages[0].qMatrix[0][0].qNum,u=Rb(t,e,Gx,Kx).outerRadius;let h;h=c<s?Gx:c>l?Kx:Gx+(c-s)/(l-s)*(Kx-Gx);const d=r.getColor()({datum:{value:()=>0}}),f=a.paletteColors[0].color||d;return{type:"radial-spark",key:gv.RADIAL_SPARK,layout:{displayOrder:2},settings:{fill:o?f:d,radius:u,valueAngle:h}}}function Sw({refLines:t,isVertical:e,labelService:n,colorService:i,themeService:r}){const o=r.getStyles(),a={type:"custom-ref-line",key:gv.REFERENCE_LINES_AND_LABELS,settings:{barWidth:n.getBarWidthInPixels()},lines:{[e?"y":"x"]:t.filter(Ob).map((t=>{var e,n;return{scale:"m",value:t.refLineExpr.value,label:{text:t.label,...o.referenceLine.label.name,showValue:t.showValue,showLabel:t.showLabel},line:{stroke:i.getPaletteColor(t.paletteColor||{index:t.color}),strokeWidth:(null===(e=t.style)||void 0===e?void 0:e.lineThickness)||2,strokeDasharray:null===(n=t.style)||void 0===n?void 0:n.lineType}}}))}};return a}const Nw=Math.log(10),Rw={log:(t,e)=>t<=0||e<=0?NaN:Math.log(t)/Math.log(e),log10:t=>t<=0?NaN:Math.log(t)/Nw,getNiceNumber(t){let e;if(0===t)return 0;const n=Math.floor(Math.log(Math.abs(t))/Nw),i=t/10**n;return e=i<=1?1:i<=2?2:i<=5?5:10,e*10**n*(t<0?-1:1)},getSmallNiceNumber(t){let e;if(0===t)return 0;let n=Math.floor(Math.log(Math.abs(t))/Nw);const i=t/10**n;return i<1?(e=5,n--):e=i<2?1:i<5?2:5,e*10**n*(t<0?-1:1)},getGoodNumber(t){let e;if(0===t)return 0;const n=Math.floor(Math.log(Math.abs(t))/Nw),i=t/10**n;return e=Math.ceil(i),7!==e&&9!==e||e++,i>1&&i<=1.5?e=1.5:i>2&&i<=2.5&&(e=2.5),e*10**n*(t<0?-1:1)},calculateTicks(t,e,n,i,r,o){return this.plotSize=t,this.explicitPlotMin=e,this.explicitPlotMax=n,this.minTickSpacingInPixel=i,this.absMax=Math.abs(this.explicitPlotMax),this.absMin=Math.abs(this.explicitPlotMin),this.usedDataRange=this.explicitPlotMax-this.explicitPlotMin,this.maxNumIntervals=this.plotSize/this.minTickSpacingInPixel,this.maxNumTicks=this.maxNumIntervals+1,this.minTickDataSpacing=o||0,this.tickDataSpacing=Math.max(this.usedDataRange/this.maxNumIntervals,this.minTickDataSpacing),this.fontHeight=r,this.tickBaseValue=0,this.spaceUseLimit=.6,0===t?(this.plotMin=this.explicitPlotMin,this.plotMax=this.explicitPlotMax,this.tickDataSpacingNN=this.tickDataSpacing,Pw.call(this),Lw.call(this)):(this.maxNumIntervals<1?Ow.call(this):(this.explicitPlotMax>0&&this.explicitPlotMin<0?1===this.maxNumIntervals?Dw.call(this,!0):this.maxNumIntervals>=5?Cw.call(this):this.maxNumIntervals<2?zw.call(this):Ew.call(this):Cw.call(this),this.tickMaxIndex<this.tickMinIndex?(this.tickDataSpacing=Math.max(this.usedDataRange/this.maxNumIntervals,this.minTickDataSpacing),Ow.call(this)):Iw.call(this)),Pw.call(this),Lw.call(this))}};function Aw(t,e,n){void 0===t&&(t=null!==this.explicitPlotMin),void 0===e&&(e=null!==this.explicitPlotMax),this.tickDataSpacingNN=n?Rw.getGoodNumber(this.tickDataSpacing):Rw.getNiceNumber(this.tickDataSpacing),qw.apply(this,[t,e])}function Cw(){Aw.call(this);const t=this.tickMaxIndex-this.tickMinIndex;let e=this.plotMax-this.plotMin;this.spaceUseFactor=e/this.plotRange;let n=this.plotSize*this.tickDataSpacingNN/this.plotRange<this.minTickSpacingInPixel;if(n&&this.maxNumIntervals>=5){for(;this.tickDataSpacing<=this.absMax&&n;)this.tickDataSpacing=Math.max(1.1*this.tickDataSpacingNN,this.minTickDataSpacing),Aw.call(this),e=this.plotMax-this.plotMin,this.spaceUseFactor=e/this.plotRange,n=this.plotSize*this.tickDataSpacingNN/this.plotRange<this.minTickSpacingInPixel;if(!n)return}for(this.tickDataSpacing=Math.max(this.usedDataRange/this.maxNumIntervals,this.minTickDataSpacing),(n||t<=2&&this.maxNumIntervals>=2*t)&&Aw.apply(this,[void 0,void 0,!0]),e=this.plotMax-this.plotMin,this.spaceUseFactor=e/this.plotRange,n=this.plotSize*this.tickDataSpacingNN/this.plotRange<this.minTickSpacingInPixel;this.tickDataSpacing<=this.absMax&&n;)this.tickDataSpacing=Math.max(1.1*this.tickDataSpacingNN,this.minTickDataSpacing),Aw.apply(this,[void 0,void 0,!0]),e=this.plotMax-this.plotMin,this.spaceUseFactor=e/this.plotRange,n=this.plotSize*this.tickDataSpacingNN/this.plotRange<this.minTickSpacingInPixel}function Dw(t){t?(this.tickDataSpacingNN=Rw.getGoodNumber(this.absMax),this.tickBaseValue=-this.tickDataSpacingNN,this.plotMin=this.explicitPlotMin,this.plotMax=this.explicitPlotMax,this.tickMinIndex=1,this.tickMaxIndex=1,this.tickDataSpacingNN*=2):(this.plotMax=this.explicitPlotMax,this.plotMin=this.explicitPlotMin,this.plotRange=this.plotMax-this.plotMin,this.tickMinIndex=0,this.tickMaxIndex=0,this.tickDataSpacingNN=Rw.getNiceNumber(this.absMax),this.tickDataSpacingNN===this.absMax&&(this.tickDataSpacingNN=Rw.getNiceNumber(1.1*this.absMax)))}function Ow(){let t;this.tickDataSpacingNN=Rw.getNiceNumber(this.tickDataSpacing),this.plotMin=this.explicitPlotMin,this.plotMax=this.explicitPlotMax,this.plotRange=this.plotMax-this.plotMin,this.tickMinIndex=0,this.tickMaxIndex=0,(this.explicitPlotMax<0||this.explicitPlotMin>0)&&(t=Rw.getSmallNiceNumber(this.plotRange),this.tickBaseValue=Math.ceil(this.plotMin/t)*t)}function zw(){const t=this.explicitPlotMax>=-this.explicitPlotMin,e=t||null!==this.explicitPlotMin,n=!t||null!==this.explicitPlotMax;Aw.apply(this,[e,n,!0]);const i=(this.absMax+(1-this.spaceUseLimit)*this.absMin)/this.spaceUseLimit*1.0001;for(;this.tickDataSpacing<=i&&this.plotSize*this.tickDataSpacingNN/this.plotRange<this.minTickSpacingInPixel;)this.tickDataSpacing=Math.max(1.1*this.tickDataSpacingNN,this.minTickDataSpacing),Aw.apply(this,[e,n,!0]);const r=this.plotMax-this.plotMin;this.spaceUseFactor=r/this.plotRange}function Ew(){Cw.call(this);const t=this.plotMax-this.plotMin;this.spaceUseFactor=t/this.plotRange}function Iw(){const t=Rw.getNiceNumber(this.tickDataSpacingNN);if(this.tickDataSpacingNN===t||0!==this.tickBaseValue)return;const e=this.tickDataSpacingNN,n=this.tickMinIndex,i=this.tickMaxIndex,r=i-n,o=this.plotMin,a=this.plotMax;this.tickDataSpacingNN=t,qw.apply(this,[null!==this.explicitPlotMin,null!==this.explicitPlotMax]);const s=this.plotMax-this.plotMin;this.spaceUseFactor=s/this.plotRange;const l=this.plotSize*this.tickDataSpacingNN/this.plotRange<this.minTickSpacingInPixel,c=this.tickMaxIndex-this.tickMinIndex;!l&&(c===r||c>=10||c>=3&&1.5*c>=r)||(this.tickDataSpacingNN=e,this.tickMinIndex=n,this.tickMaxIndex=i,this.plotMin=o,this.plotMax=a,this.plotRange=this.plotMax-this.plotMin)}function Tw(){this.plotMax===this.plotMin||0===this.plotSize?(this.minTickValue=this.plotMin,this.maxTickValue=this.plotMax):(this.minTickValue=this.tickBaseValue+this.tickMinIndex*this.tickDataSpacingNN,this.maxTickValue=this.tickBaseValue+this.tickMaxIndex*this.tickDataSpacingNN)}function Pw(){let t,e;if(this.mainTickValues=[],this.secondaryTickValues=[],Tw.call(this),0===this.plotSize)return;t=this.tickBaseValue;const n=this.tickMaxIndex-this.tickMinIndex;if(!(n<1)){for(e=0;e<=n;e++)this.mainTickValues.push(t+(e+this.tickMinIndex)*this.tickDataSpacingNN);for(t=this.tickBaseValue+this.tickDataSpacingNN/2,e=0;e<n;e++)this.secondaryTickValues.push(t+(e+this.tickMinIndex)*this.tickDataSpacingNN)}}function qw(t,e){this.tickMinIndex=t?Math.ceil(this.explicitPlotMin/this.tickDataSpacingNN):Math.floor(this.explicitPlotMin/this.tickDataSpacingNN),this.tickMaxIndex=e?Math.floor(this.explicitPlotMax/this.tickDataSpacingNN):Math.ceil(this.explicitPlotMax/this.tickDataSpacingNN),this.plotMin=t?this.explicitPlotMin:this.tickMinIndex*this.tickDataSpacingNN,this.plotMax=e?this.explicitPlotMax:this.tickMaxIndex*this.tickDataSpacingNN,this.plotRange=this.plotMax-this.plotMin}function Lw(){return{plotMin:this.plotMin,plotMax:this.plotMax,tickSpacing:this.tickDataSpacingNN,tickBaseValue:this.tickBaseValue,tickMinIndex:this.tickMinIndex,tickMaxIndex:this.tickMaxIndex,minTickValue:this.minTickValue,maxTickValue:this.maxTickValue,mainTickValues:this.mainTickValues,secondaryTickValues:this.secondaryTickValues}}function jw({core:t,dockService:e,rangeLimits:n,measureAxisSpacing:i,isRadial:r,isVertical:o,styleService:a}){const s=n.min,l=n.max,{width:c,height:u}=function(t){return{width:t.meta.chart.size.width,height:t.meta.chart.size.height}}(e);let h,d=96*i;if(r)h=Math.min(u,c);else{h=o?u:c;const{chart:e,picassoInstance:n}=t;if(e&&n){const t=e.formatter(pv.MEASURE),r=n.renderer("svg")(),f=a.query.axis.label.getStyle(),{fontFamily:p,fontSize:g}=f,m=t=>r.measureText({text:t,fontSize:rw({width:c,height:u,fontSize:g}),fontFamily:p}),y=Math.max(96,...[s,l,(l-s)/2].map((e=>m(t(e)).width)));d=o?4*m("M").height:y;d=h/(Math.max(2,h/d/i+1)-1)}}const f=function({plotSize:t,rangeMax:e,rangeMin:n,minTickSpacingInPixel:i}){const r=Rw.calculateTicks(t,n,e,i,20,0);r.tickSpacing;let o=r.mainTickValues;0===o.length&&o.push(r.minTickValue);const a=o[0];o[0]=r.plotMin,a-r.plotMin>=r.tickSpacing/2&&o.splice(1,0,a);const s=r.mainTickValues[r.mainTickValues.length-1];return r.plotMax-s<=r.tickSpacing/2?o[r.mainTickValues.length-1]=Math.round(r.plotMax):o.push(Math.round(r.plotMax)),o}({plotSize:h,rangeMin:s,rangeMax:l,minTickSpacingInPixel:d});return{values:f}}function Fw({core:t,services:e,logicalSize:n}){const{layoutService:i,dockService:r,colorService:o,labelService:a,themeService:s,styleService:l}=e;if(!i.meta.qHyperCube)throw new Error("Layout is missing a hypercube");const{width:c,height:u}=r.meta.chart.size,{autoOrientation:h,gaugetype:d,rangeLimits:f,measureAxisTitle:p,qHyperCube:g,useSegments:m,segmentInfo:y,refLines:x,measureAxisSpacing:v}=i.meta;let b,w;w="radial"===d,b=h?c>=u?"horizontal":"vertical":i.meta.orientation;const M="vertical"===b,k=function({width:t,height:e,isVertical:n,orientation:i,measureAxisTitle:r,qHyperCube:o,rangeLimits:a,gaugetype:s,colorService:l,core:c,labelService:u,useSegments:h,themeService:d,segmentInfo:f,refLines:p,styleService:g}){const{chart:m}=c;if(!m)return[];let y=[];return y="bar"===s?[...ow({width:t,height:e,isVertical:n,styleService:g,themeService:d}),...gw({orientation:i,colorService:l,rangeLimits:a,isVertical:n,useSegments:h,themeService:d,segmentInfo:f}),...aw({width:t,height:e,labelService:u,measureAxisTitle:r,isVertical:n,styleService:g}),...mw({isVertical:n,chart:m,labelService:u,styleService:g}),yw({labelService:u,rangeLimits:a,qHyperCube:o,isVertical:n}),Sw({refLines:p,isVertical:n,labelService:u,colorService:l,themeService:d})]:t>=wv.SPARK.width&&e>=wv.SPARK.height?[...vw({qHyperCube:o,rangeLimits:a,width:t,height:e,colorService:l,themeService:d,segmentInfo:f,useSegments:h}),...bw({qHyperCube:o,chart:m,styleService:g,labelService:u}),...xw({width:t,height:e,styleService:g,themeService:d}),...h?[ww({width:t,height:e,rangeLimits:a,qHyperCube:o})]:[],Mw({rangeLimits:a,qHyperCube:o,width:t,height:e,colorService:l,useSegments:h}),kw({refLines:p,isVertical:n,labelService:u,colorService:l,themeService:d,width:t,height:e})]:[_w({width:t,height:e,rangeLimits:a,qHyperCube:o,colorService:l,useSegments:h,segmentInfo:f})],y}({width:c,height:u,isVertical:M,orientation:b,measureAxisTitle:p,qHyperCube:g,rangeLimits:f,gaugetype:d,colorService:o,core:t,labelService:a,themeService:s,useSegments:m,segmentInfo:y,refLines:x,styleService:l}),_=function({core:t,colorService:e,isVertical:n,isRadial:i,dockService:r,rangeLimits:o,measureAxisSpacing:a,styleService:s}){const l=jw({core:t,dockService:r,rangeLimits:o,measureAxisSpacing:a,isRadial:i,isVertical:n,styleService:s});return{m:{data:{field:"qMeasureInfo/0"},type:"linear",invert:!!i||n,min:o.min,max:o.max,ticks:{values:l.values}},...e.getScales()}}({core:t,measureAxisSpacing:v,isVertical:M,colorService:o,isRadial:w,dockService:r,rangeLimits:f,styleService:l});return{scales:_,components:k,formatters:{[pv.MEASURE]:{data:{field:"qMeasureInfo/0"}}},strategy:{layoutModes:wv,logicalSize:n}}}function Bw(a){return{qae:{properties:{qHyperCubeDef:{qMeasures:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressZero:!1,qSuppressMissing:!0},showTitles:!0,title:"",subtitle:"",footnote:"",measureAxis:{min:0,max:10},orientation:"vertical",segmentInfo:{limits:[],colors:[{color:3}]}},data:{targets:[{path:"/qHyperCubeDef",dimensions:{min:0,max:0},measures:{min:1,max:1}}]}},ext:Ye(a),component(){const a=(()=>{const r=t(),o=e(),[a,s]=n({});return i((()=>{r.style.overflow="hidden";const t=Yx();t.use(Ti),t.component("oob-indicator",Nb),t.component("radial-gauge-needle",Eb),t.component("radial-custom-ref-line",Kb),t.component("custom-ref-line",Qb),t.component("radial-oob-indicator",Ib),t.component("radial-spark",Zb);const e=t({renderer:{prio:[o.renderer||"svg"]}}),n=e.chart({element:r,data:[],settings:{}});return s({picassoInstance:e,chart:n}),()=>{n.destroy()}}),[]),a})(),s=iw({core:a}),c=(({core:t,services:a})=>{const[s,c]=n({}),d=e(),f=l(),p=o(),g=r(),{qLocaleInfo:m}=u();return h((async()=>{if(!a)return Promise.resolve();const{colorService:e}=a;return e.initialize({createConfig:()=>({theme:p,layout:g,localeInfo:m,hc:g.qHyperCube,colorProps:{...g.color,auto:!0,useBaseColors:"off",paletteColor:g.paletteProgressColor}})}).then((()=>{const{layoutService:e}=a,n=tw({layout:e.getLayout(),options:d}),i=Fw({core:t,services:a,logicalSize:n});c(i)}))}),[a]),i((()=>{if(a&&a.dockService&&a.layoutService){const{dockService:e,layoutService:n}=a,i=tw({layout:n.getLayout(),options:d});e.update(i||f);const r=Fw({core:t,services:a,logicalSize:i});c(r)}}),[f]),s})({core:a,services:s});(({core:t,services:e,settings:n})=>{i((()=>{if(!n||!t||!e)return;const{chart:i}=t;i&&i.update({data:[{type:"q",key:"qHyperCube",data:e.layoutService.getHyperCube()},...e.colorService.getData()],settings:n})}),[t,n])})({core:a,settings:c,services:s}),(({services:t})=>{d((e=>{if(t){const{dockService:n}=t,{width:i,height:r}=n.meta.chart.size;e.snapshotData=e.snapshotData||{content:{size:{w:i,h:r}}},e.snapshotData.content={size:{w:i,h:r}}}return Promise.resolve(e)}))})({services:s})}}}export{Bw as default};