@nebula.js/sn-funnel-chart 1.3.9 → 1.3.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-funnel-chart:plugins",
5
5
  "description": "Funnel chart plugins API definitions",
6
- "version": "1.3.9",
6
+ "version": "1.3.10",
7
7
  "license": "MIT",
8
8
  "stability": "experimental",
9
9
  "x-qlik-visibility": "public"
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-funnel-chart:properties",
5
5
  "description": "Funnel chart generic object definition",
6
- "version": "1.3.9",
6
+ "version": "1.3.10",
7
7
  "license": "MIT",
8
8
  "stability": "stable",
9
9
  "x-qlik-visibility": "public"
package/core/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*
2
- * @nebula.js/sn-funnel-chart v1.3.9
2
+ * @nebula.js/sn-funnel-chart v1.3.10
3
3
  * Copyright (c) 2021 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
- import e from"picasso.js";import t from"picasso-plugin-q";import{useElement as n,useSelections as r,useModel as o,useApp as i,useTranslator as a,useOptions as u,useState as l,useEffect as c,useStaleLayout as s,useTheme as f,useConstraints as d,useRect as p,usePlugins as h,useAppLayout as m,usePromise as v,onTakeSnapshot as g}from"@nebula.js/stardust";function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){q(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||C(e,t)||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 w(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||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 C(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var I={fill:"steelblue",num:1},S=function(e,t,n){var r=0,o=0,i=0,a={},u=0;if("labelCenter"===e)r=t.bottomLeft.x,o=t.topRight.y,i=t.bottomRight.x-t.bottomLeft.x,u=t.bottomRight.y-t.topRight.y,a={share:n.share,fill:n.fill};else{var l=180/Math.PI*Math.atan((t.bottomRight.y-t.topRight.y)/(t.topRight.x-t.bottomRight.x));r=l<15&&l>=0?t.topRight.x:l>-15&&l<0?t.bottomRight.x:l<-15?(t.bottomRight.x-t.topRight.x)/2+t.topRight.x+15:(t.topRight.x-t.bottomRight.x)/2+t.bottomRight.x+15,o=t.topRight.y,i=t.width-r,u=t.bottomRight.y-t.topRight.y,a={fill:n.fill}}return{tag:e,type:"rect",x:r,y:o,width:i,height:u,data:n.data,desc:a,fill:"none"}},k=function(e,t){var n,r,o,i=(r=function(e){var t=0;return e.forEach((function(e){e.num>t&&(t=e.num)})),t}(n=e),o=0,n.slice().reverse().map((function(e){var t={datum:e,s:o/r,e:e.num/r};return o=e.num,t})).reverse()),a=.9*t.width,u=.9*t.height,l=(t.width-a)/2,c=(t.height-u)/2,s=a-(a>150&&u>150?100:0),f=(u-1*(i.length-1))/i.length,d=[];return i.forEach((function(e,n){var r,o,a=(r=e.e,o=n<i.length-1?e.s:e.e,[.5-.5*r,.5+.5*r,.5+.5*o,.5-.5*o]).map((function(e){return Math.round(e*s+l)})),u=f*n+1*n+c,p={bottomRight:{x:a[2],y:Math.round(u+f)},bottomLeft:{x:a[3],y:Math.round(u+f)},topRight:{x:a[1],y:Math.round(u)},topLeft:{x:a[0],y:Math.round(u)},width:t.width},h="M".concat(p.topLeft.x,",").concat(p.topLeft.y," L").concat(p.topRight.x,",").concat(p.topRight.y," ").concat(p.bottomRight.x,",").concat(p.bottomRight.y," ").concat(p.bottomLeft.x,",").concat(p.bottomLeft.y,"Z");d.push({tag:"section",type:"path",d:h,data:e.datum.data,fill:e.datum.fill});var m={share:e.e,fill:e.datum.fill,data:e.datum.data};f>12&&(p.bottomRight.x-p.bottomLeft.x>32&&d.push(S("labelCenter",p,m)),d.push(S("labelLeft",p,m)))})),d},O=function(e,t,n,r){return(r-e)/r*(t-n)+n},A=function(e,t,n){var r=e.filter((function(e){return"NaN"!==e.num&&e.num>0})),o=r.length,i=.9*n.width,a=.9*n.height,u=Math.round((n.width-i)/2),l=Math.round((n.height-a)/2),c=i-(i>150&&a>150?100:0),s=a-1*(o-1),f=[],d=r[0].data.num.value,p=l;return r.forEach((function(e,r){var o=t[r]*s,i=Math.round(O(p-l,c,.2*c,a)/2),h=Math.round(O(p-l+o,c,.2*c,a)/2),m=u+Math.round(c/2),v={bottomRight:{x:m+h,y:Math.round(p+o)},bottomLeft:{x:m-h,y:Math.round(p+o)},topRight:{x:m+i,y:p},topLeft:{x:m-i,y:p},width:n.width},g="M".concat(v.topLeft.x,",").concat(v.topLeft.y," L").concat(v.topRight.x,",").concat(v.topRight.y," ").concat(v.bottomRight.x,",").concat(v.bottomRight.y," ").concat(v.bottomLeft.x,",").concat(v.bottomLeft.y,"Z");f.push({tag:"section",type:"path",d:g,data:e.data,fill:e.fill});var y={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(S("labelCenter",v,y)),f.push(S("labelLeft",v,y))),p+=o+1})),f},E=function(e,t,n){var r=e.filter((function(e){return"NaN"!==e.num&&e.num>0}));if(r&&r.length>0)switch(t){case"WIDTH":return k(r,n);case"ORDER":return A(r,r.map((function(){return 1/r.length})),n);case"HEIGHT":return A(r,function(e){var t=e.reduce((function(e,t){return e+t.data.num.value}),0);return e.map((function(e){return e.data.num.value/t}))}(r),n);case"AREA":return A(r,function(e,t,n){for(var r=e.reduce((function(e,t){return e+t.data.num.value}),0),o=.9*t.width,i=.9*t.height,a=o*n,u=i*(o+a)/2,l=(o-a)/2/i,c=[],s=0,f=e.length-1;f>=0;f--){var d=e[f].data.num.value/r,p=2*l*s+a,h=-p/(2*l)+Math.sqrt(p*p/(4*l*l)+d*u/l);c[f]=h/i,s+=h}return c}(r,n,.2),n);default:return k(r,n)}return[]},N={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render:function(e){var t=e.data,n=this.resolver.resolve({data:t,defaults:b(b({},I),this.style.item),settings:this.settings.settings});return E(n.items,this.settings.settings.mode,this.rect)}},P={version:"1.3.9",color:{auto:!0,autoMinMax:!0,byDimDef:void 0,byMeasureDef:void 0,colorExpression:void 0,dimensionScheme:"12",expressionIsColor:!0,expressionLabel:"",measureMin:void 0,measureMax:void 0,measureScheme:"sg",mode:"primary",paletteColor:{index:6},persistent:!1,reverseScheme:!1,singleColor:void 0,useBaseColors:"off",useDimColVal:!0,useMeasureGradient:!0},dataPoint:{auto:!0,labelMode:"share"},footnote:"",funnel:{mode:"WIDTH"},qHyperCubeDef:{qDimensions:[],qMeasures:[],qInterColumnSortOrder:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressMissing:!0,qSuppressZero:!1},showDimensionTitle:!0,showTitles:!0,subtitle:"",title:""},j={definition:{type:"items",component:"accordion",items:{data:{uses:"data",items:{dimensions:{uses:"dimensions",items:{others:{items:{suppressOther:{defaultValue:!0,show:!1}}}},disabledRef:""},measures:{uses:"measures",disabledRef:""}}},sorting:{uses:"sorting"},settings:{uses:"settings",items:{presentation:{type:"items",label:"Presentation",grouped:!0,items:{funnelmode:{ref:"funnel.mode",label:"Funnel Mode",type:"string",component:"dropdown",options:[{value:"AREA",label:"Area"},{value:"HEIGHT",label:"Height"},{value:"WIDTH",label:"Width"},{value:"ORDER",label:"Ordering"}],defaultValue:"WIDTH"},dimensionTitle:{ref:"showDimensionTitle",type:"boolean",component:"switch",label:"Dimension label",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Off"}]},valuesAuto:{ref:"dataPoint.auto",type:"boolean",label:"Value labels",component:"switch",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Custom"}]},labelMode:{ref:"dataPoint.labelMode",type:"string",component:"dropdown",options:[{value:"none",label:"None"},{value:"share",label:"Share"},{value:"value",label:"Values"}],defaultValue:"share",show:function(e){return!e.dataPoint.auto}}}},colorsAndLegend:{uses:"colorsAndLegend",translation:"Colors",items:{colors:{items:{colorByLabel:{show:!1},expressionLabel:{show:!1}}},legend:{show:!1}}}}}}},support:{export:!0,exportData:!0,snapshot:!0,viewData:!1},importProperties:null,exportProperties:null},T=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:function(){return"Segments"}},measures:{min:1,max:1,description:function(e){switch(e.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added:function(e,t){2===t.qHyperCubeDef.qInterColumnSortOrder.length&&1!==t.qHyperCubeDef.qInterColumnSortOrder[0]&&(t.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function L(e){return(L="function"==typeof Symbol&&"symbol"==x(Symbol.iterator)?function(e){return x(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":x(e)})(e)}function R(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function F(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){R(i,r,o,a,u,"next",e)}function u(e){R(i,r,o,a,u,"throw",e)}a(void 0)}))}}function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){H(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function z(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(e,t)||K(e,t)||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 U(e){return function(e){if(Array.isArray(e))return W(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||K(e)||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 K(e,t){if(e){if("string"==typeof e)return W(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W(e,t):void 0}}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $=Object.prototype.hasOwnProperty,Y=Object.prototype.toString,G=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,J=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Y.call(e)},Q=function(e){if(!e||"[object Object]"!==Y.call(e))return!1;var t,n=$.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&$.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||$.call(e,t)},X=function(e,t){G&&"__proto__"===t.name?G(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},ee=function(e,t){if("__proto__"===t){if(!$.call(e,t))return;if(Z)return Z(e,t).value}return e[t]},te=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,c=arguments.length,s=!1;for("boolean"==typeof u&&(s=u,u=arguments[1]||{},l=2),(null==u||"object"!=x(u)&&"function"!=typeof u)&&(u={});l<c;++l)if(null!=(t=arguments[l]))for(n in t)r=ee(u,n),u!==(o=ee(t,n))&&(s&&o&&(Q(o)||(i=J(o)))?(i?(i=!1,a=r&&J(r)?r:[]):a=r&&Q(r)?r:{},X(u,{name:n,newValue:e(s,a,o)})):void 0!==o&&X(u,{name:n,newValue:o}));return u};function ne(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",t);return r.items.map((function(e){return o[e.value%o.length]}))},valueAccessor:e.value}}function re(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",t);return r.items.map((function(e){return o[e.row.value%o.length]}))},valueAccessor:e.value}}function oe(e,t,n,r,o){var i,a=o.byRow,u=o.byElemNo;if(r&&(t.input.persistent||e.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&e.hc.qSize.qcy>((null===(i=e.hc.qDataPages[0])||void 0===i?void 0:i.qArea.qHeight)||0)))return u(r,r.raw().qCardinal);if(r){var l=t.pic.extract({field:r.key(),trackBy:r.value}).length;return a(r,l)}return{}}function ie(e,t){var n=e.hc.qDimensionInfo,r=t.input.byDimDef||{activeDimensionIndex:n.length-1};if(r.activeDimensionIndex>=0){var o=n[r.activeDimensionIndex];r=o.coloring&&o.coloring.colorMapRef?{type:"libraryItem",key:o.coloring.colorMapRef,activeDimensionIndex:r.activeDimensionIndex}:{activeDimensionIndex:r.activeDimensionIndex}}return r}function ae(e,t){var n;return t.activeDimensionIndex>=0?n=e.pic.fields().filter((function(e){return"dimension"===e.type()}))[t.activeDimensionIndex]:"libraryItem"===t.type?!1===(n=t.key?e.pic.field((function(e){return e.raw().colorMapRef===t.key})):void 0)&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n}function ue(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function le(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ce(){}var se=1/.7,fe="\\s*([+-]?\\d+)\\s*",de="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",pe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",he=/^#([0-9a-f]{3,8})$/,me=new RegExp("^rgb\\("+[fe,fe,fe]+"\\)$"),ve=new RegExp("^rgb\\("+[pe,pe,pe]+"\\)$"),ge=new RegExp("^rgba\\("+[fe,fe,fe,de]+"\\)$"),ye=new RegExp("^rgba\\("+[pe,pe,pe,de]+"\\)$"),be=new RegExp("^hsl\\("+[de,pe,pe]+"\\)$"),xe=new RegExp("^hsla\\("+[de,pe,pe,de]+"\\)$"),qe={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 De(){return this.rgb().formatHex()}function we(){return this.rgb().formatRgb()}function Ce(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=he.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Me(t):3===n?new Oe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Ie(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Ie(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=me.exec(e))?new Oe(t[1],t[2],t[3],1):(t=ve.exec(e))?new Oe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ge.exec(e))?Ie(t[1],t[2],t[3],t[4]):(t=ye.exec(e))?Ie(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=be.exec(e))?Pe(t[1],t[2]/100,t[3]/100,1):(t=xe.exec(e))?Pe(t[1],t[2]/100,t[3]/100,t[4]):qe.hasOwnProperty(e)?Me(qe[e]):"transparent"===e?new Oe(NaN,NaN,NaN,0):null}function Me(e){return new Oe(e>>16&255,e>>8&255,255&e,1)}function Ie(e,t,n,r){return r<=0&&(e=t=n=NaN),new Oe(e,t,n,r)}function Se(e){return e instanceof ce||(e=Ce(e)),e?new Oe((e=e.rgb()).r,e.g,e.b,e.opacity):new Oe}function ke(e,t,n,r){return 1===arguments.length?Se(e):new Oe(e,t,n,null==r?1:r)}function Oe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Ae(){return"#"+Ne(this.r)+Ne(this.g)+Ne(this.b)}function Ee(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Ne(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Pe(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Te(e,t,n,r)}function je(e){if(e instanceof Te)return new Te(e.h,e.s,e.l,e.opacity);if(e instanceof ce||(e=Ce(e)),!e)return new Te;if(e instanceof Te)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,u=i-o,l=(i+o)/2;return u?(a=t===i?(n-r)/u+6*(n<r):n===i?(r-t)/u+2:(t-n)/u+4,u/=l<.5?i+o:2-i-o,a*=60):u=l>0&&l<1?0:a,new Te(a,u,l,e.opacity)}function Te(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Le(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Re(e){return function(){return e}}function Fe(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Re(isNaN(e)?t:e)}ue(ce,Ce,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:De,formatHex:De,formatHsl:function(){return je(this).formatHsl()},formatRgb:we,toString:we}),ue(Oe,ke,le(ce,{brighter:function(e){return e=null==e?se:Math.pow(se,e),new Oe(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Oe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){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:Ae,formatHex:Ae,formatRgb:Ee,toString:Ee})),ue(Te,(function(e,t,n,r){return 1===arguments.length?je(e):new Te(e,t,n,null==r?1:r)}),le(ce,{brighter:function(e){return e=null==e?se:Math.pow(se,e),new Te(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Te(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Oe(Le(e>=240?e-240:e+120,o,r),Le(e,o,r),Le(e<120?e+240:e-120,o,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var He=function e(t){var n=function(e){return 1==(e=+e)?Fe:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Re(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=ke(e)).r,(t=ke(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=Fe(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1),Ve=/^class(-pyramid)?/,_e=function(e,t,n,r){var o=void 0!==n.min?n.min:r.min(),i=void 0!==n.max?n.max:r.max(),a=o,u=i,l=t.limits,c={},s="percent"===t.limitType?l.map((function(e){return o+(i-o)*e})):l,f=t.colors.map((function(t){return e.resolveUIColor(t)}));if(o=Math.min.apply(Math,[o].concat(U(s))),i=Math.max.apply(Math,[i].concat(U(s))),c.min=o,c.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))c.type="categorical",Object.assign(c,function(e){var t=e.min,n=e.max,r=e.limits,o=e.range,i=[],a=[];if(r.length)if(r[r.length-1]<t)a.push(t,n),i.push(o[o.length-1],o[o.length-1],o[o.length-1]);else if(r[0]>n)a.push(t,n),i.push(o[0],o[0],o[0]);else{if(r[0]>t)a.push(t),i.push(o[0]);else{a.push(t);for(var u=0;u<r.length;u++)if(t<r[u]){i.push(o[u]);break}}for(var l=0;l<r.length;l++)t<r[l]&&r[l]<n&&(a.push(r[l]),i.push(o[l]));if(r[r.length-1]<n)a.push(n),i.push(o[r.length]),i.push(o[r.length]);else{a.push(n);for(var c=0;c<r.length;c++)if(r[c]>n){i.push(o[c]),i.push(o[c]);break}}}else i.push(o[0]);return{min:t,max:n,range:i,domain:a}}({min:"percent"===t.limitType?o:a,max:"percent"===t.limitType?i:u,range:f,limits:"percent"===t.limitType?s:l}));else if(t.breakTypes){var d=t.breakTypes;c.type="continuous",c.domain=[o],c.range=[f[0]];for(var p=0;p<s.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=He(h,m)(.5);c.range.push(v),c.domain.push(s[p]),p<s.length-1&&d[p+1]&&(c.range.push(f[p+1]),c.domain.push((s[p]+s[p+1])/2))}else c.range.push(f[p]),c.range.push(f[p+1]),c.domain.push(s[p]),c.domain.push(s[p]+Math.min(1e-6,(i-o)/1e6));c.range.push(f[f.length-1]),c.domain.push(i)}else c.domain=s,c.range=f;return c};function ze(e,t,n,r,o){var i,a,u,l=0,c=[],s=(e-t)/(r+1);if(0===s)return 1;for(i=0;i<n.length;i+=1)a=.99*(n[i]-t),u=n[i]>e?Math.floor(e/s):n[i]<t?0:Math.floor(a/s),Number.isNaN(u)||(c[u]?c[u]+=1:c[u]=1);for(i=0;i<c.length;i+=1)c[i]&&(l+=1);return l<=r||l>=o?Math.max(l,r):ze(e,t,n,r+1,o)}var Be=function(e,t,n,r){var o,i,a=t.theme,u=t.hc,l=r.f,c={mode:"field",fieldType:"measure",field:l?l.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(e){return e.resources.theme.palette("quant")}},s=[],f=!0;if(l){if(Number.isNaN(+l.min())||Number.isNaN(+l.max()))return{invalid:!0};(f=!("S"===(o=n.pic.raw()).qMode&&(o.qDataPages[0]&&o.qSize.qcy>o.qDataPages[0].qArea.qHeight||!o.qDataPages.length&&o.qSize.qcy>0)||"K"===o.qMode&&o.qStackedDataPages[0]&&o.qSize.qcy>o.qStackedDataPages[0].qArea.qHeight||"T"===o.qMode&&o.qSize.qcy>o.qTreeDataPages[0].qGroupSize))&&(s=n.pic.extract({field:0,props:{num:{field:l.key()},exclude:{fields:u.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return Math.min.apply(Math,U(e))<0}}}}).filter((function(e){return e.value>=0&&!e.exclude.value})).map((function(e){return e.num.value})).filter((function(e){return"number"==typeof e})))}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&&!f)c.min=l.min(),c.max=l.max();else if(l){if(!s.length)return{invalid:!0};c.min=Math.min.apply(Math,U(s)),c.max=Math.max.apply(Math,U(s))}if(n.input.measureScheme&&(c.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];c.type=d&&Ve.test(d.type)?"categorical":"continuous","categorical"===c.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,U(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===c.type){for(var p=f?ze(c.max,c.min,s,1,i):i,h=(c.max-c.min)/p,m=[],v=0;v<p+1;v+=1)m.push(c.min+h*v);c.domain=m,c.range=function(e){for(var t=e.resources.theme.palette("quant",p),n=Math.max(1,Math.floor(t.length/p)),r=[],o=0;o<p;o+=1)r.push(t[o*n]);return[r[0]].concat(r,[r[r.length-1]])}}return c};function Ue(e,t){var n;return t.activeMeasureIndex>=0?n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[t.activeMeasureIndex]:"libraryItem"===t.type?n=e.pic.field((function(e){return e.raw().colorMapRef===t.key&&void 0!==t.key})):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n||(n=e.pic.field((function(e){return void 0!==e.raw().matchMeasure})))&&(n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[n.raw().matchMeasure]),n}function Ke(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function We(e,t){for(var n=(null==t?void 0:t.domain)||[],r=(null==t?void 0:t.range)||[],o=[],i=0;i<e.length;++i){var a=e[i];if("constant"===(null==a?void 0:a.mode)){var u=n.indexOf(i);-1===u?(n.push(i),r.push(a.primary)):r[u]=a.primary,e[i]=null}else if(a){o.push(i);var l=n.indexOf(i);-1!==l&&(n.splice(l,1),r.splice(l,1))}}return{domain:n,range:r,exclude:o}}function $e(e,t,n,r){var o=function(e,t,n,r){if(t.input&&!t.input.auto){if("byMeasure"===t.input.mode)return function(e,t,n){var r=t.theme,o=t.hc,i=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===i?Ue:i,u=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,u),c=Be(0,{theme:r,hc:o},n,{f:l});if(c.invalid)return c;("expression"===u.type||u.activeMeasureIndex<0)&&(c.label=u.label,l&&"color.altLabel"===l.raw().labelExpRef&&(c.label=n.input.altLabel)),!c.label&&l&&(c.label=l.title());var s=u.activeMeasureIndex>=0?l:null;if(!s&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(s=n.pic.fields().filter((function(e){return"measure"===e.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===u.type)if(s){var f=s.raw().coloring;f&&f.gradient&&te(c,_e(e,f.gradient,c,s))}else c.auxiliary=u;return c}(e,n,t);if("byDimension"===t.input.mode)return function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.getCDef,i=void 0===o?ie:o,a=r.getCByField,u=void 0===a?ae:a,l=r.getPersistence,c=void 0===l?oe:l,s=i(t,n),f=u(n,s),d=f?f.raw():{},p=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!p.qHasOtherValues)return{invalid:!0};var h={mode:"field",fieldType:"dimension",type:"categorical",field:f?f.key():void 0,isFieldLocked:d.qLocked};return("expression"===s.type||s.activeDimensionIndex<0)&&(h.label=s.label,"color.altLabel"===d.labelExpRef&&(h.label=n.input.altLabel)),!h.label&&f&&(h.label=f.title()),n.input.dimensionScheme&&(h.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===s.type&&(h.auxiliary=s),te(h,c(t,n,s,f,{byRow:re,byElemNo:ne})),h}(e,n,t);if("byExpression"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,u=n.pic.field((function(e){return"colorByExpression"===e.raw().id}));if(!(u&&u.raw().qFallbackTitle&&(Number.isFinite(u.raw().qMin)&&Number.isFinite(u.raw().qMax)||n.input.expressionIsColor)))return{mode:"constant",type:"constant",primary:r.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:u?u.key():void 0,type:"color"};var l=Be(0,{hc:o,theme:i},n,{f:u});return l.invalid||(l.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),l}(0,n,t,r);if("byMultiple"===t.input.mode||"primary"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,u=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&o.qMeasureInfo.length>1&&(u="measure"),"measure"===u){var l=[],c=[];"measure"===n.input.useBaseColors&&o.qMeasureInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){l.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?c.push(r.primary):c.push(o)}}));var s=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,f=i?i.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&f&&(s={categorical:f.key}),{mode:"measure",type:"categorical",palettes:s,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:c}:void 0}}if("dimension"===u){var d=[],p=[];return o.qDimensionInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){d.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?p.push(r.primary):p.push(o)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:p}:void 0}}var h=r.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(h=e.resolveUIColor(n.input.paletteColor));else{var m=n.input.singleColor;"number"!=typeof m||Number.isNaN(m)||(h=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][m])}return{mode:"constant",type:"constant",primary:h}}(e,n,t,r)}return{}}(e,t,n,r);return t.input.measureOverrides?(o.measureOverrides=t.input.measureOverrides.map((function(n,o){return function(e){var t,n=e.cm,r=e.defaults,o=e.index,i=e.input,a=e.pic;if(!i||!i.on)return null;var u=null!==(t=i.mode)&&void 0!==t?t:"primary";return"primary"===u?function(e,t,n){var r=n.primary;return void 0!==t.paletteColor&&t.paletteColor&&(r=e.resolveUIColor(t.paletteColor)),_(_({},n),{},{mode:"constant",type:"constant",primary:r})}(n,i,r):"byExpression"===u?function(e,t,n){var r="qMeasureInfo/".concat(e,"/"),o=t.field((function(e){return e.id().startsWith(r)&&"colorByMeasureExpression"===e.raw().id})),i=o;return _(_({},n),{},i?{mode:"field",fieldType:"expression",field:o?o.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(o,a,r):null}({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(Ke(e),1===(null===(n=e.measureOverrides)||void 0===n?void 0:n.length))return e.measureOverrides[0];if("measure"===e.mode&&e.measureOverrides&&(e.explicit=We(e.measureOverrides,e.explicit),Ke(e)),null!==(r=e.measureOverrides)&&void 0!==r&&r.every((function(e){return"constant"===(null==e?void 0:e.mode)}))){var a={mode:"measure",type:"categorical",label:null==i?void 0:i.get("Common.Measures")};return a.explicit=We(e.measureOverrides),a}return null!==(o=e.measureOverrides)&&void 0!==o&&o.every((function(e){return e}))?{invalid:!0,measureOverrides:e.measureOverrides}:e}(o,n)):o}function Ye(e){var t=_({hc:null,colorProps:null,layout:null,theme:null},e),n={},r={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},o={auto:function(e){return e?(r.auto=e,o):r.auto},getDimensionColorMap:function(e){return e?(r.getDimensionColorMap=e,o):r.getDimensionColorMap},getAttributeDimension:function(e){return e?(r.getAttributeDimension=e,o):r.getAttributeDimension},getMeasure:function(e){return e?(r.getMeasure=e,o):r.getMeasure},set:function(e){var o;if(!e.colorProps)throw new Error('Missing "colorProps"');if(te(t,e),(n={pic:t.picasso.data("q")({data:t.hc,config:{localeInfo:t.localeInfo}}),input:t.colorProps}).input.auto){var i=r.auto(e.layout);n.input=te(!0,{},n.input,i,{auto:!1});var a=t.theme?t.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var u=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(u=+n.input.byDimDef.activeDimensionIndex),t.hc&&t.hc.qDimensionInfo[u]&&t.hc.qDimensionInfo[u].coloring&&t.hc.qDimensionInfo[u].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=t.hc.qDimensionInfo[u].coloring.colorMapRef)}null!==(o=n.input.measureOverrides)&&void 0!==o&&o.every((function(e){return!e||!e.on}))&&(n.input=te(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var e=t.theme,r=[];(e&&e.getDataColorPickerPalettes()||[]).forEach((function(e){r.push({key:"ui",colors:e.colors})})),n.palettes=r}return n.palettes},getAuxiliaryData:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!e.auxiliary&&!/qAttrDimInfo/.test(e.field))return Promise.resolve();var o=e.auxiliary||{},i=o.key;if("measure"===e.fieldType)return r.getMeasure(i,t).catch((function(){}));if("dimension"===e.fieldType){var a="".concat(n,"/").concat(e.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(e.field)?r.getAttributeDimension(a,t).catch((function(){})):Promise.resolve(),i?r.getDimensionColorMap(i,t).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(e,r){var o=this;return e.auxiliary||/qAttrDimInfo/.test(e.field)?(this.palettes(),this.getAuxiliaryData(e,r).then((function(r){if(!r)return{};if("measure"===e.fieldType){if(r.coloring&&r.coloring.gradient){var i=n.pic.field(e.field);return _e(o,r.coloring.gradient,e,i)}return{}}if("dimension"===e.fieldType){var a={nil:e.nil,others:e.others},u=r[0],l=r[1]?r[1].colorMap:null;if(u){var c=t.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(e.field).raw(),n.pic.field(e.field).raw()],qMeasureInfo:[],qDataPages:u,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=c}return l?function(e,t,n,r){var o=r.external,i=r.field,a=_({},e);te(a,ne(i,i.raw().qCardinal));var u=o.theme?o.theme.getDataColorPalettes()[0]:null;return t.nul&&(a.nil=n.resolveUIColor(t.nul)),t.oth&&(a.others=n.resolveUIColor(t.oth)),t.usePal?(a.palettes={categorical:t.pal},u&&!t.pal&&(a.palettes.categorical=u.key,te(a,ne(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(u&&(a.palettes={categorical:u.key}),te(a,ne(i))),t.colors&&t.colors.length&&(a.explicit=function(e,t,n){for(var r={},o=0;o<e.length;o+=1)r[e[o].value]=e[o].baseColor;var i=[];return{domain:function(e){var o=e.data,a=[];i=[];for(var u=0;u<o.items.length;u++){var l=o.items[u],c=(l.text||l).label;r[c]&&-1===a.indexOf(l.value)&&(a.push(l.value),i.push(t.resolveUIColor(r[c])))}return a.push(-3,-2),i.push(n.others),i.push(n.nil),a},range:function(){return i}}}(t.colors,n,a)),a}(a,l,o,{external:t,field:n.pic.field(e.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(e){if(e.index<0||void 0===e.index)return e.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(e){return"ui"===e.key}))[0]||!1),!n.uiPalette)return e.color;var t="none"===n.uiPalette.colors[0]?e.index:e.index-1;return void 0===n.uiPalette.colors[t]?e.color:n.uiPalette.colors[t]},settings:function(){if(this.palettes(),!n.settings){var e={primary:"steelblue",others:"#aaa",nil:"#ddd"},r=t.theme;r&&(e=_(_({},e),r.getDataColorSpecials())),n.settings=te(e,$e(this,n,t,e))}return n.settings}};return o}var Ge=function(e,t){var n=e.fieldType,r={};if(t)if("measure"===n){var o=t.coloring;o&&(r.measureGradient=o.gradient)}else if("dimension"===n){var i=t[0],a=t[1];i&&(r.legendDataPage=i),a&&(r.dimValsData=a.colorMap)}return r},Ze=function(e){throw e.isHandled=!0,e},Je=function(e,t){var n=t.layout,r=t.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():r&&r.getObject?r.getObject("ColorMapModel_".concat(e)).then((function(e){return e.getLayout()})):Promise.reject()},Qe=function(e,t){var n=t.layout,r=t.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():r&&r.getMeasure?r.getMeasure(e).then((function(e){return e.getMeasure()})):Promise.reject()},Xe=function(e,t){var n=t.layout,r=t.model,o=t.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():r&&r.session&&o?r.getHyperCubeData(e,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(Ze):Promise.reject()};function et(e){var t=e.hc,n=e.source,r=e.coloring,o={data:{extract:[{source:"dummy",field:0,filter:function(){return o.expando=t.qDataPages[0]?t.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:r.field,trackBy:r.valueAccessor,reduce:"first",props:{row:{reduce:function(){return o.expando++}},text:{value:function(e){return e.qText},reduce:"first"}}}]},expando:0};return o}function tt(e){return function(t){return"object"===L(t.datum[e])?t.datum[e].value:void 0}}function nt(e){return"object"===L(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function rt(e){return-3===e.datum.value}var ot=function(e,t,n){var r=e&&e.dock||void 0;if("auto"!==r)return r||"right";if(t){var o=t.element.getBoundingClientRect();if(o.height>o.width)return"bottom"}return n?"left":"right"},it=function(e,t,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&t.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof e.show?e.show():!1!==e.show)};function at(e,t){var n=e.styleReference,r=e.chart,o=e.rtl,i=t.legendProps,a=t.coloring,u=t.theme,l=t.hc;return{layout:{minimumLayoutMode:"MEDIUM",dock:ot(i,r,o)},show:"function"==typeof i.show?function(){return it(i,l,a)}:it(i,l,a),renderer:"svg",mounted:function(e){e.childNodes[0].style.pointerEvents="none",e.style.overflow="hidden"},settings:{title:{show:!1!==i.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:a.label||"",fill:u?u.getStyle(n,"legend.title","color"):void 0,fontSize:u?u.getStyle(n,"legend.title","fontSize"):"16px",fontFamily:u?u.getStyle(n,"legend.title","fontFamily"):"QlikView Sans, sans-serif"}}}}function ut(e,t,n){var r=[],o=[],i=function(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=at(e,t);if(!r.show)return!1;var o=e.key,i=e.styleReference,a=e.viewState,u=e.rtl,l=e.settings,c=e.style,s=t.scaleKey,f=t.theme,d=t.scales,p={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"},h="".concat(s,"Legend");return te(!0,r,{type:"legend-cat",key:"".concat(o,"-cat"),scale:h in d?h:s,settings:{layout:{scrollOffset:function(){return a?a.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:u?"rtl":"ltr",horizontal:20},item:{show:function(e){return-2!==e.datum.value},label:{fill:f?f.getStyle(i,"legend.label","color"):void 0,fontSize:f?f.getStyle(i,"legend.label","fontSize"):void 0,fontFamily:f?f.getStyle(i,"legend.label","fontFamily"):"QlikView Sans, sans-serif"}},navigation:{disabled:n,button:{content:function(e,t){var n=t.direction;return e("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"}},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[e("path",{d:p[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:l,style:c})}(e,t,n):"continuous"===t.coloring.type&&function(e,t){var n=e.key,r=e.styleReference,o=e.rtl,i=e.settings,a=e.style,u=t.scaleKey,l=t.theme,c=at(e,t);return!!c.show&&te(!0,c,{type:"legend-seq",key:"".concat(n,"-seq"),settings:{fill:u,major:"".concat(u,"Range"),length:1,tick:{fill:l?l.getStyle(r,"legend.label","color"):void 0,fontSize:l?l.getStyle(r,"legend.label","fontSize"):void 0,fontFamily:l?l.getStyle(r,"legend.label","fontFamily"):"QlikView Sans, sans-serif"},title:{anchor:!o||"top"!==c.layout.dock&&"bottom"!==c.layout.dock?void 0:"right",padding:parseFloat(c.settings.title.fontSize)||16}}},{settings:i,style:a})}(e,t)}(e,t,n&&n.navigationDisabled);return r.push(i),i&&"legend-cat"===i.type&&(o.push(function(e){var t=e.key,n=e.requireFailure,r=e.recognizeWith,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(t),type:"Tap",requireFailure:n,recognizeWith:r,options:{event:"legendtap",interval:10,pointers:1,enable:function(e,n){var r;if(!n)return!0;if(null!=o&&null!==(r=o.interact)&&void 0!==r&&r.enabled&&!o.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(e){return e.key==="".concat(t,"-cat")})))return!1;var i=n.srcEvent.target;return!!(i&&i.hasAttribute("data-action")&&i.hasAttribute("data-component-key"))||!(!i||!i.childNodes[0]||"BUTTON"!==i.childNodes[0].nodeName)}},events:{legendtap:function(e){e.preventDefault();var t=e.srcEvent.target;t&&t.hasAttribute("data-action")&&t.hasAttribute("data-component-key")&&this.chart.component(t.getAttribute("data-component-key")).emit(t.getAttribute("data-action"))}}}}(e,n)),o.push(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.eventName,r=t.key,o=t.requireFailure,i=t.recognizeWith,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(r),type:"Pan",requireFailure:o,recognizeWith:i,options:{event:n,pointers:1,threshold:10,enable:function(e,t){var o;return this.started===n||!t||!(null!=a&&null!==(o=a.interact)&&void 0!==o&&o.enabled&&!a.interact.enabled())&&this.chart.componentsFromPoint({x:t.center.x,y:t.center.y}).some((function(e){return e.key==="".concat(r,"-cat")}))}},events:(e={},H(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),H(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),H(e,"".concat(n,"end"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panend",e),this.started=!1})),e)}}(e,n))),{interactions:o,components:r}}var lt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function ct(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=Ye(e.resources).auto(t||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(e,t){var n=t.layout,r=t.app;return Je(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return Qe(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return Xe(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=Ge,n}({resources:e}),n={},r={},o=function(e){return r.settings||(e||console.warn("settings() called before auxiliarySettings()"),r.settings=t.settings()),r.settings},i={config:function(o){if(n=_({},o),r={},!n.key)throw new Error("Missing key");t.set(_(_({},e),n))},auto:function(e){return e?(t.auto(e),i):t.auto()},getAuxiliarySettings:function(e){return r.auxiliarySettings?Promise.resolve(r.auxiliarySettings):t.getAuxiliarySettings(o(!0),e).then((function(e){return r.auxiliarySettings=e||{},r.settings=_(_({},r.settings),r.auxiliarySettings),r.scales=void 0,r.color=void 0,r.auxiliarySettings}))},getAuxiliaryData:function(){return t.getAuxiliaryData(o())},getSnapshotData:function(e){var n=o();return t.getAuxiliaryData(n,e).then((function(e){return t.getSnapshotData(n,e)}))},resolveUIColor:function(e){return t.resolveUIColor(e)},settings:function(){var e=o();return{mode:e.mode,type:e.type,label:e.label,field:e.field,fieldType:e.fieldType,nil:e.nil,others:e.others,primary:e.primary}},settingsForMeasure:function(e){var t;return(null===(t=o().measureOverrides)||void 0===t?void 0:t[e])||this.settings()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return function(e,t){var n=t.isMeasureSelectionLocked;return"field"!==e.mode||("dimension"===e.fieldType?e.isFieldLocked:"measure"!==e.fieldType||n)}(o(),{isMeasureSelectionLocked:t})},palettes:function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.colorProps,n=e.coloring,r=e.theme,o=[];if(n&&n.palettes&&r){var i=n.palettes.categorical||t.dimensionScheme,a=r.getDataColorPalettes().filter((function(e){return e.key===i}))[0]||r.getDataColorPalettes()[0];i&&a&&o.push({key:"categorical",colors:a.colors});var u=n.palettes.metric||t.measureScheme,l=r.getDataColorScales().filter((function(e){return e.key===u}))[0];if(l){var c=l.colors[0]?l.colors:[[]].concat(U(l.colors.slice(1)));c=Array.isArray(c[0])?c.map((function(e){return e.slice().reverse()})):c.slice().reverse(),o.push({key:"quant",colors:c})}}return o}({coloring:o(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return r.scales=r.scales||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hc,n=e.coloring,r=e.rtl,o=e.key,i=e.source,a=e.picasso,u={},l=o;if(n){var c={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(U((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(U((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var s,f=et({hc:t,source:i,coloring:n}).data;if(n.legendDataset){var d=0,p={};a.data("q")({data:t}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(e){var t=e[0];return p[t]=d++,e[0]}}),s={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(e){return e.qElemNumber>=0},props:{row:{value:function(e){return p[e.qElemNumber]}}}}}}var h={data:f,range:n.range,domain:n.domain,explicit:c,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};u[l]=h,s&&(u["".concat(l,"Legend")]=_(_({},h),{},{data:s})),t&&t.qHasOtherValues&&s&&((s||h.data).amend=[{label:t.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var m={data:{field:n.field},min:n.min,max:n.max};u[l]=te({},m,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===u[l].type&&(u["".concat(l,"Range")]=te({},m,{invert:!!r}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var v={data:t.qDimensionInfo.map((function(e,t){return t})),label:function(e){return t.qDimensionInfo[e.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};u[l]=v}else if("measure"===n.mode){var g={data:t.qMeasureInfo.map((function(e,t){return t})).filter((function(e){var t,r;return!(null!==(t=n.explicit)&&void 0!==t&&null!==(r=t.exclude)&&void 0!==r&&r.includes(e))})),label:function(e){return t.qMeasureInfo[e.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};u[l]=g}}return u}({hc:n.hc,coloring:o(),key:n.key,source:n.source,picasso:e.picasso}),r.scales},color:function(){return r.color=r.color||function(e){var t=e.coloring,n=e.scales,r=e.key,o=tt(r),i=tt("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,u=e.mode,l=e.nil,c=e.others,s=e.primary,f=e.type;return a?function(e){return rt(e)||i(e)?c:l}:n[t]?function(e){return rt(e)?c:nt(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?l:i(e)?c:e.resources.scale(t)(o(e))||c}:"constant"===u?function(e){return rt(e)||i(e)?c:nt(e)?l:s}:"color"===f?function(e){return rt(e)||i(e)?c:nt(e)?l:o(e)||c}:null},u=a(t,r);if(t.measureOverrides){var l=tt("".concat(r,"MeasureIdx")),c=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=l(e);return c[t]?c[t](e):u(e)}}return u}({coloring:o(),scales:this.scales(),key:n.key}),r.color},datumProps:function(e){return function(e){var t,n,r=e.hc,o=e.coloring,i=e.scales,a=e.key,u=e.addMeasureIx,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=a,s=o.nil;"field"===o.mode&&o.field?t=o.field:i[a]&&"field"===o.mode&&(t=i[a].data.field||o.field),t?(n={field:t,reduce:"first"},"color"===o.type&&(n.value=function(e){return"NaN"!==e.qNum?lt(e.qNum):e.qText&&Ce(e.qText)?e.qText:s})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=l);var f=H({},c,n);return r.qDimensionInfo.length>1&&(f["".concat(c,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),u&&(f["".concat(c,"MeasureIdx")]=l),f}({coloring:this.settingsForMeasure(e),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:o().measureOverrides},e)},data:function(){var e=o(),t={key:"dummy",data:[["field"],["a"]]};return e.legendDataset?[t,{type:"q",key:"attrDim",data:e.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[t]},legend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.eventName,r=e.key,i=e.viewState,a=e.chart,u=e.rtl,l=e.styleReference,c=void 0===l?"object.legend":l,s=e.settings,f=void 0===s?{}:s,d=e.style,p=void 0===d?{}:d,h=arguments.length>1?arguments[1]:void 0;return ut({eventName:t,key:r,rtl:u,viewState:i,chart:a,styleReference:c,settings:f,style:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:o(),theme:n.theme,hc:n.hc,scales:this.scales()},h)}};return i}var st=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function ft(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(st),i=r.some(st),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function dt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=_(_(_({},e),t),{},{colorProps:_(_({},e.colorProps),t.colorProps||{})});return n}var pt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function ht(e){var t,n=e.qHyperCube.qDimensionInfo.some(pt),r=e.qHyperCube.qMeasureInfo.some(pt),o=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(t=null!=o?o:r?"measure":void 0)&&void 0!==t?t:"off",paletteColor:null}}var mt=function(){};function vt(e){var t=e.originalArray,n=e.newArray,r=e.matchKey;return Array.isArray(t)&&t.length?(n.forEach((function(e){var n=-1;t.some((function(t,o){return t[r]&&t[r]===e[r]&&(n=o),n})),n>-1?t[n]=e:t.push(e)})),t):n}function gt(e){return(gt="function"==typeof Symbol&&"symbol"==x(Symbol.iterator)?function(e){return x(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":x(e)})(e)}function yt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function xt(e,t,n){return t&&bt(e.prototype,t),n&&bt(e,n),e}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(n),!0).forEach((function(t){qt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ct(e,t){return(Ct=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Mt(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function It(e,t,n){return(It=Mt()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Ct(o,n.prototype),o}).apply(null,arguments)}function St(e){return function(e){if(Array.isArray(e))return Ot(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||kt(e)||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 kt(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var At=Object.prototype.hasOwnProperty,Et=Object.prototype.toString,Nt=Object.defineProperty,Pt=Object.getOwnPropertyDescriptor,jt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Et.call(e)},Tt=function(e){if(!e||"[object Object]"!==Et.call(e))return!1;var t,n=At.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&At.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||At.call(e,t)},Lt=function(e,t){Nt&&"__proto__"===t.name?Nt(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Rt=function(e,t){if("__proto__"===t){if(!At.call(e,t))return;if(Pt)return Pt(e,t).value}return e[t]},Ft=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,c=arguments.length,s=!1;for("boolean"==typeof u&&(s=u,u=arguments[1]||{},l=2),(null==u||"object"!=x(u)&&"function"!=typeof u)&&(u={});l<c;++l)if(null!=(t=arguments[l]))for(n in t)r=Rt(u,n),u!==(o=Rt(t,n))&&(s&&o&&(Tt(o)||(i=jt(o)))?(i?(i=!1,a=r&&jt(r)?r:[]):a=r&&Tt(r)?r:{},Lt(u,{name:n,newValue:e(s,a,o)})):void 0!==o&&Lt(u,{name:n,newValue:o}));return u};function Ht(e,t,n){if(!e)return-1;var r=n.cache,o=e.origin?e.origin():null;o&&(e=o);var i=r.fields.indexOf(e),a=-1,u=-1;if(-1===i)for(var l=0;l<r.wrappedFields.length;l++)if(u=r.wrappedFields[l].attrDims.map((function(e){return e.instance})).indexOf(e),a=r.wrappedFields[l].attrExps.map((function(e){return e.instance})).indexOf(e),-1!==u||-1!==a){i=l;break}return(i-=t.qArea.qLeft)<0||i>=t.qArea.qWidth?-1:u>=0?function(e){return e[i].qAttrDims.qValues[u]}:a>=0?function(e){return e[i].qAttrExps.qValues[a]}:function(e){return e[i]}}function Vt(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function _t(e){var t=e.cache,n=e.f,r=e.mainCell,o=e.p;e.prop;var i=e.page,a=e.rowIdx,u=e.row,l=e.sourceKey,c=e.target,s=e.targetProp,f=r;if(o.field&&o.field!==n){var d=Ht(o.field,i,{cache:t});if(-1===d)return;f=Ft({qRow:a},d(u))}c[s]=Vt(o,f,{key:l})}function zt(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){for(var u=t.raw(),l=t.key(),c="object"===gt(o[a].field)?o[a].field:t.field(o[a].field),s=r.normalizeConfig(o[a],t),f=s.props,d=s.main,p=Object.keys(f),h=!!o[a].trackBy,m=gt(o[a].trackBy),v={},g=[],y=[],b=0;b<u.qDataPages.length;b++){var x=Ht(c,u.qDataPages[b],{cache:n});if(-1!==x)for(var q=0;q<u.qDataPages[b].qMatrix.length;q++){var D=u.qDataPages[b].qArea.qTop+q,w=Ft({qRow:D},x(u.qDataPages[b].qMatrix[q])),C=Vt(d,w,{key:l});if(!d.filter||d.filter(w)){for(var M=0;M<p.length;M++){var I=f[p[M]],S=I.fields||[I];I.fields&&(C[p[M]]=[]);for(var k=0;k<S.length;k++)_t({cache:n,f:c,mainCell:w,p:S[k],prop:p[M],props:f,page:u.qDataPages[b],rowIdx:D,row:u.qDataPages[b].qMatrix[q],sourceKey:l,target:I.fields?C[p[M]]:C,targetProp:I.fields?k:p[M]});if(I.fields){var O=C[p[M]].map((function(e){return e.value})),A=C[p[M]].map((function(e){return e.label}));C[p[M]]={value:"function"==typeof I.value?I.value(O):void 0!==I.value?I.value:O,label:"function"==typeof I.label?I.label(A):void 0!==I.label?String(I.label):String(C[p[M]].value)}}}h&&r.track({cfg:o[a],itemData:w,obj:C,target:g,tracker:v,trackType:m}),y.push(C)}}}h?i.push.apply(i,St(r.collect(g,{main:d,propsArr:p,props:f}))):i.push.apply(i,y)}return i}function Bt(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Ut(e,t){var n,r,o,i,a,u=new Yt(e),l=+e.value&&(u.value=e.value),c=[u];for(null==t&&(t=Kt);n=c.pop();)if(l&&(n.value=+n.data.value),(o=t(n.data))&&(a=o.length))for(n.children=new Array(a),i=a-1;i>=0;--i)c.push(r=n.children[i]=new Yt(o[i])),r.parent=n,r.depth=n.depth+1;return u.eachBefore($t)}function Kt(e){return e.children}function Wt(e){e.data=e.data.data}function $t(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function Yt(e){this.data=e,this.depth=this.height=0,this.parent=null}function Gt(e){if("function"!=typeof e)throw new Error;return e}Yt.prototype=Ut.prototype={constructor:Yt,count:function(){return this.eachAfter(Bt)},each:function(e){var t,n,r,o,i=this,a=[i];do{for(t=a.reverse(),a=[];i=t.pop();)if(e(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r])}while(a.length);return this},eachAfter:function(e){for(var t,n,r,o=this,i=[o],a=[];o=i.pop();)if(a.push(o),t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n]);for(;o=a.pop();)e(o);return this},eachBefore:function(e){for(var t,n,r=this,o=[r];r=o.pop();)if(e(r),t=r.children)for(n=t.length-1;n>=0;--n)o.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,o=r&&r.length;--o>=0;)n+=r[o].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),o=null;for(e=n.pop(),t=r.pop();e===t;)o=e,e=n.pop(),t=r.pop();return o}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var o=r.length;e!==n;)r.splice(o,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Ut(this).eachBefore(Wt)}};var Zt={depth:-1},Jt={};function Qt(e){return e.id}function Xt(e){return e.parentId}function en(e,t){"/"===e.charAt(0)&&(e=e.substring(1));for(var n,r=e.split("/"),o=t,i=0;i<r.length;i++){if("*"===r[i]&&Array.isArray(o)){var a=[];n=r.slice(i+1).join("/");for(var u=0;u<o.length;u++){var l=en(n,o[u]);Array.isArray(l)?a.push.apply(a,St(l)):a.push(l)}return a}if(!r[i]&&Array.isArray(o)){var c=new Array(o.length);n=r.slice(i+1).join("/");for(var s=0;s<o.length;s++)c[s]=en(n,o[s]);return c}r[i]in o&&(o=o[r[i]])}return o}function tn(e,t,n){var r=[];if(!e||!e.length)return r;if(t<=0){var o=n>=0?[e[n]]:e;r.push.apply(r,St(o))}else for(var i=0;i<e.length;i++)e[i].children&&e[i].children.length&&r.push.apply(r,St(tn(e[i].children,t-1,n)));return r}function nn(e,t,n){if(e===t)return function(e){return e};if(e>t){var r=Math.max(0,Math.min(100,e-t)),o=St(Array(r)).map(String.prototype.valueOf,"parent").join(".");return Function("node","return node.".concat(o,";"))}if(t>e){var i=Math.max(0,Math.min(100,t-e));return function(e){return tn(e.children,i-1,n)}}return!1}function rn(e,t){var n=t.cache;if("number"==typeof e)return n.fields[e];var r=n.allFields;if("function"==typeof e){for(var o=0;o<r.length;o++)if(e(r[o]))return r[o];return!1}if("string"==typeof e){for(var i=0;i<r.length;i++)if(r[i].key()===e||r[i].title()===e)return r[i]}else if(e&&-1!==r.indexOf(e))return e;throw Error("Field not found: ".concat(e))}var on=/^qDimensionInfo(?:\/(\d+))?/,an=/^\/?qMeasureInfo\/(\d+)/,un=/\/qAttrExprInfo\/(\d+)/,ln=/\/qAttrDimInfo\/(\d+)/;function cn(e){return(e.qColumnOrder&&e.qColumnOrder.length?e.qColumnOrder:e.qDimensionInfo.map((function(e,t){return t}))).filter((function(t){return t<e.qDimensionInfo.length}))}function sn(e,t){var n=t.cube;if(!e)return-1;var r=e.origin&&e.origin()?e.origin().key():e.key(),o=!1,i=-1,a=-1,u=-1,l=-1,c=-1,s=r,f=n.qEffectiveInterColumnSortOrder,d=cn(n);return on.test(s)&&(o=!0,i=+on.exec(s)[1],s=r.replace(on,"")),an.test(s)&&("K"===n.qMode?l=+an.exec(s)[1]:f&&-1!==f.indexOf(-1)?(l=+an.exec(s)[1],c=0):c=+an.exec(s)[1],s=s.replace(an,"")),s&&(ln.exec(s)?u=+ln.exec(s)[1]:un.exec(s)&&(a=+un.exec(s)[1])),{fieldDepth:(o?"S"===n.qMode?d[i]:f?f.indexOf(i):i:f&&-1!==f.indexOf(-1)?f.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1))+1,pseudoMeasureIndex:l,measureIdx:c,attrDimIdx:u,attrIdx:a}}function fn(e,t){var n,r,o=nn(e.fieldDepth,t.fieldDepth,t.pseudoMeasureIndex);return n=t.measureIdx>=0?function(e){return e.data.qValues[t.measureIdx]}:function(e){return e.data},t.attrDimIdx>=0?r=function(e){var n;return null==e||null===(n=e.qAttrDims)||void 0===n?void 0:n.qValues[t.attrDimIdx]}:t.attrIdx>=0&&(r=function(e){var n;return null==e||null===(n=e.qAttrExps)||void 0===n?void 0:n.qValues[t.attrIdx]}),{nodeFn:o,attrFn:r,valueFn:n}}function dn(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function pn(e){for(var t=e.propsArr,n=e.props,r=e.item,o=e.itemData,i=e.ret,a=e.sourceKey,u=0;u<t.length;u++){var l=n[t[u]],c=l.fields||[l],s=void 0,f=void 0;l.fields&&(s=[],f=[]);for(var d=function(e){var n=c[e],d=void 0,p=void 0,h=void 0,m=void 0,v=void 0,g=void 0;if("primitive"===n.type?(h=n.value,g=String(n.value)):("function"==typeof n.value&&(d=function(e){return n.value(e,r)}),"function"==typeof n.label&&(p=function(e){return n.label(e,r)}),n.accessor?(m=n.accessor(r),Array.isArray(m)?(v=m.map(n.valueAccessor),n.attrAccessor&&(v=v.map(n.attrAccessor)),d&&(h=v.map(d),d=null),p&&(g=v.map(p),p=null),h=n.reduce?n.reduce(h):h,g=n.reduceLabel?n.reduceLabel(g,h):String(h)):g=h=n.attrAccessor?n.attrAccessor(n.valueAccessor(m)):n.valueAccessor(m)):(h=o,g=o)),l.fields){var y=d?d(h):h;s.push(y),f.push(p&&null!=g?p(g):null!=g?g:String(y))}else{var b=d?d(h):h;i[t[u]]={value:b,label:p?p(g):null!=g?g:String(b)},n.field&&(i[t[u]].source={field:n.field.key(),key:a})}},p=0;p<c.length;p++)d(p);s&&(i[t[u]]={value:"function"==typeof l.value?l.value(s,r):s,label:"function"==typeof l.label?l.label(f,r):f})}}var hn=function(e,t,n){var r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=en(r,e);return i&&i[0]?(t.tree=Ut(i[0],n.children||function(e){return e[o]}),t.tree):null};function mn(e){for(var t=e.raw().qDataPages.length?e.raw().qDataPages[0].qMatrix:[],n=function(e){var t=e.raw().qColumnOrder,n=e.fields();return t&&t.length===n.length?t:n.map((function(e,t){return t}))}(e),r=e.fields(),o=e.fields().filter((function(e){return"dimension"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),i=e.fields().filter((function(e){return"measure"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),a={__root:{__id:"__root",qValues:[]}},u=0;u<t.length;u++){for(var l=t[u],c="__root",s=!1,f=0;f<o.length;f++){var d=l[o[f]],p="".concat(c,"__").concat(d.qText);a[p]||(a[p]=wt({__id:p,__parent:c,qValues:[]},d),s=!0),c=p}if(s)for(var h=0;h<i.length;h++){var m=l[i[h]];a[c].qValues.push(m)}}var v=Object.keys(a).map((function(e){return a[e]}));return function(){var e=Qt,t=Xt;function n(n){var r,o,i,a,u,l,c,s=n.length,f=new Array(s),d={};for(o=0;o<s;++o)r=n[o],u=f[o]=new Yt(r),null!=(l=e(r,o,n))&&(l+="")&&(d[c="$"+(u.id=l)]=c in d?Jt:u);for(o=0;o<s;++o)if(u=f[o],null!=(l=t(n[o],o,n))&&(l+="")){if(!(a=d["$"+l]))throw new Error("missing: "+l);if(a===Jt)throw new Error("ambiguous: "+l);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(i)throw new Error("multiple roots");i=u}if(!i)throw new Error("no root");if(i.parent=Zt,i.eachBefore((function(e){e.depth=e.parent.depth+1,--s})).eachBefore($t),i.parent=null,s>0)throw new Error("cycle");return i}return n.id=function(t){return arguments.length?(e=Gt(t),n):e},n.parentId=function(e){return arguments.length?(t=Gt(e),n):t},n}().id((function(e){return e.__id})).parentId((function(e){return e.__parent}))(v)}var vn=function(e){for(var t=e.propsArr,n=e.props,r=e.cube,o=e.cache,i=e.itemDepthObject,a=e.f,u=0;u<t.length;u++)for(var l=n[t[u]],c=l.fields?l.fields:[l],s=0;s<c.length;s++){var f=c[s];if(f.field!==a){var d=fn(i,sn(f.field,{cube:r,cache:o}));f.accessor=d.nodeFn,f.valueAccessor=d.valueFn,f.attrAccessor=d.attrFn}}};function gn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t.raw(),i=t.key(),a="S"===o.qMode?mn(t):hn(o,n,e);if(!a)return null;for(var u=a.height,l=[],c=0;c<=u;c++){var s=null;if(c>0)if("S"===o.qMode){var f=cn(o),d=f[c-1];s=n.fields[d]}else{var p=o.qEffectiveInterColumnSortOrder[c-1];c>o.qEffectiveInterColumnSortOrder.length&&(p=o.qDimensionInfo.length),s=n.fields[p]}var h=r.normalizeConfig(wt(wt({},e),{},{field:s?s.key():void 0}),t),m=h.props,v=h.main,g=Object.keys(m);l[c]={propsArr:g,props:m,main:v};var y=s?sn(s,{cube:o,cache:n}):{fieldDepth:0};vn({propsArr:g,props:m,cube:o,cache:n,itemDepthObject:y,f:s})}for(var b=a.copy(),x=b.descendants(),q=a.descendants(),D=0;D<q.length;D++){var w=l[q[D].depth].propsArr,C=l[q[D].depth].props,M=l[q[D].depth].main,I=x[D],S=I.data,k=dn(M,S,{key:i});pn({propsArr:w,props:C,item:I,itemData:S,ret:k,sourceKey:i,isTree:!0}),q[D].data=k}return a}function yn(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){var u=t.raw(),l=t.key();if(!hn(u,n,e))continue;var c="object"===gt(o[a].field)?o[a].field:t.field(o[a].field),s=r.normalizeConfig(o[a],t),f=s.props,d=s.main,p=Object.keys(f),h=sn(c,{cube:u,cache:n}),m=fn({fieldDepth:0},h),v=m.nodeFn,g=m.attrFn,y=m.valueFn;vn({propsArr:p,props:f,cube:u,cache:n,itemDepthObject:h,f:c});for(var b=!!o[a].trackBy,x=gt(o[a].trackBy),q={},D=[],w=v(n.tree),C=[],M=0;M<w.length;M++){var I=w[M],S=g?g(y(I)):y(I);if(!d.filter||d.filter(S)){var k=dn(d,S,{key:l});pn({propsArr:p,props:f,item:I,itemData:S,ret:k,sourceKey:l}),b&&r.track({cfg:o[a],itemData:S,obj:k,target:D,tracker:q,trackType:x}),C.push(k)}}b?i.push.apply(i,St(r.collect(D,{main:d,propsArr:p,props:f}))):i.push.apply(i,C)}return i}var bn,xn=(function(e){
7
+ import e from"picasso.js";import t from"picasso-plugin-q";import{useElement as n,useSelections as r,useModel as o,useApp as i,useTranslator as a,useOptions as u,useState as l,useEffect as c,useStaleLayout as s,useTheme as f,useConstraints as d,useRect as p,usePlugins as h,useAppLayout as m,usePromise as v,onTakeSnapshot as g}from"@nebula.js/stardust";function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){q(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||C(e,t)||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 w(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||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 C(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var I={fill:"steelblue",num:1},S=function(e,t,n){var r=0,o=0,i=0,a={},u=0;if("labelCenter"===e)r=t.bottomLeft.x,o=t.topRight.y,i=t.bottomRight.x-t.bottomLeft.x,u=t.bottomRight.y-t.topRight.y,a={share:n.share,fill:n.fill};else{var l=180/Math.PI*Math.atan((t.bottomRight.y-t.topRight.y)/(t.topRight.x-t.bottomRight.x));r=l<15&&l>=0?t.topRight.x:l>-15&&l<0?t.bottomRight.x:l<-15?(t.bottomRight.x-t.topRight.x)/2+t.topRight.x+15:(t.topRight.x-t.bottomRight.x)/2+t.bottomRight.x+15,o=t.topRight.y,i=t.width-r,u=t.bottomRight.y-t.topRight.y,a={fill:n.fill}}return{tag:e,type:"rect",x:r,y:o,width:i,height:u,data:n.data,desc:a,fill:"none"}},k=function(e,t){var n,r,o,i=(r=function(e){var t=0;return e.forEach((function(e){e.num>t&&(t=e.num)})),t}(n=e),o=0,n.slice().reverse().map((function(e){var t={datum:e,s:o/r,e:e.num/r};return o=e.num,t})).reverse()),a=.9*t.width,u=.9*t.height,l=(t.width-a)/2,c=(t.height-u)/2,s=a-(a>150&&u>150?100:0),f=(u-1*(i.length-1))/i.length,d=[];return i.forEach((function(e,n){var r,o,a=(r=e.e,o=n<i.length-1?e.s:e.e,[.5-.5*r,.5+.5*r,.5+.5*o,.5-.5*o]).map((function(e){return Math.round(e*s+l)})),u=f*n+1*n+c,p={bottomRight:{x:a[2],y:Math.round(u+f)},bottomLeft:{x:a[3],y:Math.round(u+f)},topRight:{x:a[1],y:Math.round(u)},topLeft:{x:a[0],y:Math.round(u)},width:t.width},h="M".concat(p.topLeft.x,",").concat(p.topLeft.y," L").concat(p.topRight.x,",").concat(p.topRight.y," ").concat(p.bottomRight.x,",").concat(p.bottomRight.y," ").concat(p.bottomLeft.x,",").concat(p.bottomLeft.y,"Z");d.push({tag:"section",type:"path",d:h,data:e.datum.data,fill:e.datum.fill});var m={share:e.e,fill:e.datum.fill,data:e.datum.data};f>12&&(p.bottomRight.x-p.bottomLeft.x>32&&d.push(S("labelCenter",p,m)),d.push(S("labelLeft",p,m)))})),d},O=function(e,t,n,r){return(r-e)/r*(t-n)+n},A=function(e,t,n){var r=e.filter((function(e){return"NaN"!==e.num&&e.num>0})),o=r.length,i=.9*n.width,a=.9*n.height,u=Math.round((n.width-i)/2),l=Math.round((n.height-a)/2),c=i-(i>150&&a>150?100:0),s=a-1*(o-1),f=[],d=r[0].data.num.value,p=l;return r.forEach((function(e,r){var o=t[r]*s,i=Math.round(O(p-l,c,.2*c,a)/2),h=Math.round(O(p-l+o,c,.2*c,a)/2),m=u+Math.round(c/2),v={bottomRight:{x:m+h,y:Math.round(p+o)},bottomLeft:{x:m-h,y:Math.round(p+o)},topRight:{x:m+i,y:p},topLeft:{x:m-i,y:p},width:n.width},g="M".concat(v.topLeft.x,",").concat(v.topLeft.y," L").concat(v.topRight.x,",").concat(v.topRight.y," ").concat(v.bottomRight.x,",").concat(v.bottomRight.y," ").concat(v.bottomLeft.x,",").concat(v.bottomLeft.y,"Z");f.push({tag:"section",type:"path",d:g,data:e.data,fill:e.fill});var y={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(S("labelCenter",v,y)),f.push(S("labelLeft",v,y))),p+=o+1})),f},E=function(e,t,n){var r=e.filter((function(e){return"NaN"!==e.num&&e.num>0}));if(r&&r.length>0)switch(t){case"WIDTH":return k(r,n);case"ORDER":return A(r,r.map((function(){return 1/r.length})),n);case"HEIGHT":return A(r,function(e){var t=e.reduce((function(e,t){return e+t.data.num.value}),0);return e.map((function(e){return e.data.num.value/t}))}(r),n);case"AREA":return A(r,function(e,t,n){for(var r=e.reduce((function(e,t){return e+t.data.num.value}),0),o=.9*t.width,i=.9*t.height,a=o*n,u=i*(o+a)/2,l=(o-a)/2/i,c=[],s=0,f=e.length-1;f>=0;f--){var d=e[f].data.num.value/r,p=2*l*s+a,h=-p/(2*l)+Math.sqrt(p*p/(4*l*l)+d*u/l);c[f]=h/i,s+=h}return c}(r,n,.2),n);default:return k(r,n)}return[]},N={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render:function(e){var t=e.data,n=this.resolver.resolve({data:t,defaults:b(b({},I),this.style.item),settings:this.settings.settings});return E(n.items,this.settings.settings.mode,this.rect)}},P={version:"1.3.10",color:{auto:!0,autoMinMax:!0,byDimDef:void 0,byMeasureDef:void 0,colorExpression:void 0,dimensionScheme:"12",expressionIsColor:!0,expressionLabel:"",measureMin:void 0,measureMax:void 0,measureScheme:"sg",mode:"primary",paletteColor:{index:6},persistent:!1,reverseScheme:!1,singleColor:void 0,useBaseColors:"off",useDimColVal:!0,useMeasureGradient:!0},dataPoint:{auto:!0,labelMode:"share"},footnote:"",funnel:{mode:"WIDTH"},qHyperCubeDef:{qDimensions:[],qMeasures:[],qInterColumnSortOrder:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressMissing:!0,qSuppressZero:!1},showDimensionTitle:!0,showTitles:!0,subtitle:"",title:""},j={definition:{type:"items",component:"accordion",items:{data:{uses:"data",items:{dimensions:{uses:"dimensions",items:{others:{items:{suppressOther:{defaultValue:!0,show:!1}}}},disabledRef:""},measures:{uses:"measures",disabledRef:""}}},sorting:{uses:"sorting"},settings:{uses:"settings",items:{presentation:{type:"items",label:"Presentation",grouped:!0,items:{funnelmode:{ref:"funnel.mode",label:"Funnel Mode",type:"string",component:"dropdown",options:[{value:"AREA",label:"Area"},{value:"HEIGHT",label:"Height"},{value:"WIDTH",label:"Width"},{value:"ORDER",label:"Ordering"}],defaultValue:"WIDTH"},dimensionTitle:{ref:"showDimensionTitle",type:"boolean",component:"switch",label:"Dimension label",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Off"}]},valuesAuto:{ref:"dataPoint.auto",type:"boolean",label:"Value labels",component:"switch",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Custom"}]},labelMode:{ref:"dataPoint.labelMode",type:"string",component:"dropdown",options:[{value:"none",label:"None"},{value:"share",label:"Share"},{value:"value",label:"Values"}],defaultValue:"share",show:function(e){return!e.dataPoint.auto}}}},colorsAndLegend:{uses:"colorsAndLegend",translation:"Colors",items:{colors:{items:{colorByLabel:{show:!1},expressionLabel:{show:!1}}},legend:{show:!1}}}}}}},support:{export:!0,exportData:!0,snapshot:!0,viewData:!1},importProperties:null,exportProperties:null},T=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:function(){return"Segments"}},measures:{min:1,max:1,description:function(e){switch(e.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added:function(e,t){2===t.qHyperCubeDef.qInterColumnSortOrder.length&&1!==t.qHyperCubeDef.qInterColumnSortOrder[0]&&(t.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function L(e){return(L="function"==typeof Symbol&&"symbol"==x(Symbol.iterator)?function(e){return x(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":x(e)})(e)}function R(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function F(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){R(i,r,o,a,u,"next",e)}function u(e){R(i,r,o,a,u,"throw",e)}a(void 0)}))}}function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){H(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function z(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(e,t)||K(e,t)||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 U(e){return function(e){if(Array.isArray(e))return W(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||K(e)||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 K(e,t){if(e){if("string"==typeof e)return W(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W(e,t):void 0}}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $=Object.prototype.hasOwnProperty,Y=Object.prototype.toString,G=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,J=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Y.call(e)},Q=function(e){if(!e||"[object Object]"!==Y.call(e))return!1;var t,n=$.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&$.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||$.call(e,t)},X=function(e,t){G&&"__proto__"===t.name?G(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},ee=function(e,t){if("__proto__"===t){if(!$.call(e,t))return;if(Z)return Z(e,t).value}return e[t]},te=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,c=arguments.length,s=!1;for("boolean"==typeof u&&(s=u,u=arguments[1]||{},l=2),(null==u||"object"!=x(u)&&"function"!=typeof u)&&(u={});l<c;++l)if(null!=(t=arguments[l]))for(n in t)r=ee(u,n),u!==(o=ee(t,n))&&(s&&o&&(Q(o)||(i=J(o)))?(i?(i=!1,a=r&&J(r)?r:[]):a=r&&Q(r)?r:{},X(u,{name:n,newValue:e(s,a,o)})):void 0!==o&&X(u,{name:n,newValue:o}));return u};function ne(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",t);return r.items.map((function(e){return o[e.value%o.length]}))},valueAccessor:e.value}}function re(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",t);return r.items.map((function(e){return o[e.row.value%o.length]}))},valueAccessor:e.value}}function oe(e,t,n,r,o){var i,a=o.byRow,u=o.byElemNo;if(r&&(t.input.persistent||e.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&e.hc.qSize.qcy>((null===(i=e.hc.qDataPages[0])||void 0===i?void 0:i.qArea.qHeight)||0)))return u(r,r.raw().qCardinal);if(r){var l=t.pic.extract({field:r.key(),trackBy:r.value}).length;return a(r,l)}return{}}function ie(e,t){var n=e.hc.qDimensionInfo,r=t.input.byDimDef||{activeDimensionIndex:n.length-1};if(r.activeDimensionIndex>=0){var o=n[r.activeDimensionIndex];r=o.coloring&&o.coloring.colorMapRef?{type:"libraryItem",key:o.coloring.colorMapRef,activeDimensionIndex:r.activeDimensionIndex}:{activeDimensionIndex:r.activeDimensionIndex}}return r}function ae(e,t){var n;return t.activeDimensionIndex>=0?n=e.pic.fields().filter((function(e){return"dimension"===e.type()}))[t.activeDimensionIndex]:"libraryItem"===t.type?!1===(n=t.key?e.pic.field((function(e){return e.raw().colorMapRef===t.key})):void 0)&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n}function ue(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function le(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ce(){}var se=1/.7,fe="\\s*([+-]?\\d+)\\s*",de="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",pe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",he=/^#([0-9a-f]{3,8})$/,me=new RegExp("^rgb\\("+[fe,fe,fe]+"\\)$"),ve=new RegExp("^rgb\\("+[pe,pe,pe]+"\\)$"),ge=new RegExp("^rgba\\("+[fe,fe,fe,de]+"\\)$"),ye=new RegExp("^rgba\\("+[pe,pe,pe,de]+"\\)$"),be=new RegExp("^hsl\\("+[de,pe,pe]+"\\)$"),xe=new RegExp("^hsla\\("+[de,pe,pe,de]+"\\)$"),qe={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 De(){return this.rgb().formatHex()}function we(){return this.rgb().formatRgb()}function Ce(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=he.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Me(t):3===n?new Oe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Ie(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Ie(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=me.exec(e))?new Oe(t[1],t[2],t[3],1):(t=ve.exec(e))?new Oe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ge.exec(e))?Ie(t[1],t[2],t[3],t[4]):(t=ye.exec(e))?Ie(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=be.exec(e))?Pe(t[1],t[2]/100,t[3]/100,1):(t=xe.exec(e))?Pe(t[1],t[2]/100,t[3]/100,t[4]):qe.hasOwnProperty(e)?Me(qe[e]):"transparent"===e?new Oe(NaN,NaN,NaN,0):null}function Me(e){return new Oe(e>>16&255,e>>8&255,255&e,1)}function Ie(e,t,n,r){return r<=0&&(e=t=n=NaN),new Oe(e,t,n,r)}function Se(e){return e instanceof ce||(e=Ce(e)),e?new Oe((e=e.rgb()).r,e.g,e.b,e.opacity):new Oe}function ke(e,t,n,r){return 1===arguments.length?Se(e):new Oe(e,t,n,null==r?1:r)}function Oe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Ae(){return"#"+Ne(this.r)+Ne(this.g)+Ne(this.b)}function Ee(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Ne(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Pe(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Te(e,t,n,r)}function je(e){if(e instanceof Te)return new Te(e.h,e.s,e.l,e.opacity);if(e instanceof ce||(e=Ce(e)),!e)return new Te;if(e instanceof Te)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,u=i-o,l=(i+o)/2;return u?(a=t===i?(n-r)/u+6*(n<r):n===i?(r-t)/u+2:(t-n)/u+4,u/=l<.5?i+o:2-i-o,a*=60):u=l>0&&l<1?0:a,new Te(a,u,l,e.opacity)}function Te(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Le(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Re(e){return function(){return e}}function Fe(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Re(isNaN(e)?t:e)}ue(ce,Ce,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:De,formatHex:De,formatHsl:function(){return je(this).formatHsl()},formatRgb:we,toString:we}),ue(Oe,ke,le(ce,{brighter:function(e){return e=null==e?se:Math.pow(se,e),new Oe(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Oe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){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:Ae,formatHex:Ae,formatRgb:Ee,toString:Ee})),ue(Te,(function(e,t,n,r){return 1===arguments.length?je(e):new Te(e,t,n,null==r?1:r)}),le(ce,{brighter:function(e){return e=null==e?se:Math.pow(se,e),new Te(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Te(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Oe(Le(e>=240?e-240:e+120,o,r),Le(e,o,r),Le(e<120?e+240:e-120,o,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var He=function e(t){var n=function(e){return 1==(e=+e)?Fe:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Re(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=ke(e)).r,(t=ke(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=Fe(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1),Ve=/^class(-pyramid)?/,_e=function(e,t,n,r){var o=void 0!==n.min?n.min:r.min(),i=void 0!==n.max?n.max:r.max(),a=o,u=i,l=t.limits,c={},s="percent"===t.limitType?l.map((function(e){return o+(i-o)*e})):l,f=t.colors.map((function(t){return e.resolveUIColor(t)}));if(o=Math.min.apply(Math,[o].concat(U(s))),i=Math.max.apply(Math,[i].concat(U(s))),c.min=o,c.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))c.type="categorical",Object.assign(c,function(e){var t=e.min,n=e.max,r=e.limits,o=e.range,i=[],a=[];if(r.length)if(r[r.length-1]<t)a.push(t,n),i.push(o[o.length-1],o[o.length-1],o[o.length-1]);else if(r[0]>n)a.push(t,n),i.push(o[0],o[0],o[0]);else{if(r[0]>t)a.push(t),i.push(o[0]);else{a.push(t);for(var u=0;u<r.length;u++)if(t<r[u]){i.push(o[u]);break}}for(var l=0;l<r.length;l++)t<r[l]&&r[l]<n&&(a.push(r[l]),i.push(o[l]));if(r[r.length-1]<n)a.push(n),i.push(o[r.length]),i.push(o[r.length]);else{a.push(n);for(var c=0;c<r.length;c++)if(r[c]>n){i.push(o[c]),i.push(o[c]);break}}}else i.push(o[0]);return{min:t,max:n,range:i,domain:a}}({min:"percent"===t.limitType?o:a,max:"percent"===t.limitType?i:u,range:f,limits:"percent"===t.limitType?s:l}));else if(t.breakTypes){var d=t.breakTypes;c.type="continuous",c.domain=[o],c.range=[f[0]];for(var p=0;p<s.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=He(h,m)(.5);c.range.push(v),c.domain.push(s[p]),p<s.length-1&&d[p+1]&&(c.range.push(f[p+1]),c.domain.push((s[p]+s[p+1])/2))}else c.range.push(f[p]),c.range.push(f[p+1]),c.domain.push(s[p]),c.domain.push(s[p]+Math.min(1e-6,(i-o)/1e6));c.range.push(f[f.length-1]),c.domain.push(i)}else c.domain=s,c.range=f;return c};function ze(e,t,n,r,o){var i,a,u,l=0,c=[],s=(e-t)/(r+1);if(0===s)return 1;for(i=0;i<n.length;i+=1)a=.99*(n[i]-t),u=n[i]>e?Math.floor(e/s):n[i]<t?0:Math.floor(a/s),Number.isNaN(u)||(c[u]?c[u]+=1:c[u]=1);for(i=0;i<c.length;i+=1)c[i]&&(l+=1);return l<=r||l>=o?Math.max(l,r):ze(e,t,n,r+1,o)}var Be=function(e,t,n,r){var o,i,a=t.theme,u=t.hc,l=r.f,c={mode:"field",fieldType:"measure",field:l?l.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(e){return e.resources.theme.palette("quant")}},s=[],f=!0;if(l){if(Number.isNaN(+l.min())||Number.isNaN(+l.max()))return{invalid:!0};(f=!("S"===(o=n.pic.raw()).qMode&&(o.qDataPages[0]&&o.qSize.qcy>o.qDataPages[0].qArea.qHeight||!o.qDataPages.length&&o.qSize.qcy>0)||"K"===o.qMode&&o.qStackedDataPages[0]&&o.qSize.qcy>o.qStackedDataPages[0].qArea.qHeight||"T"===o.qMode&&o.qSize.qcy>o.qTreeDataPages[0].qGroupSize))&&(s=n.pic.extract({field:0,props:{num:{field:l.key()},exclude:{fields:u.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return Math.min.apply(Math,U(e))<0}}}}).filter((function(e){return e.value>=0&&!e.exclude.value})).map((function(e){return e.num.value})).filter((function(e){return"number"==typeof e})))}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&&!f)c.min=l.min(),c.max=l.max();else if(l){if(!s.length)return{invalid:!0};c.min=Math.min.apply(Math,U(s)),c.max=Math.max.apply(Math,U(s))}if(n.input.measureScheme&&(c.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];c.type=d&&Ve.test(d.type)?"categorical":"continuous","categorical"===c.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,U(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===c.type){for(var p=f?ze(c.max,c.min,s,1,i):i,h=(c.max-c.min)/p,m=[],v=0;v<p+1;v+=1)m.push(c.min+h*v);c.domain=m,c.range=function(e){for(var t=e.resources.theme.palette("quant",p),n=Math.max(1,Math.floor(t.length/p)),r=[],o=0;o<p;o+=1)r.push(t[o*n]);return[r[0]].concat(r,[r[r.length-1]])}}return c};function Ue(e,t){var n;return t.activeMeasureIndex>=0?n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[t.activeMeasureIndex]:"libraryItem"===t.type?n=e.pic.field((function(e){return e.raw().colorMapRef===t.key&&void 0!==t.key})):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n||(n=e.pic.field((function(e){return void 0!==e.raw().matchMeasure})))&&(n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[n.raw().matchMeasure]),n}function Ke(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function We(e,t){for(var n=(null==t?void 0:t.domain)||[],r=(null==t?void 0:t.range)||[],o=[],i=0;i<e.length;++i){var a=e[i];if("constant"===(null==a?void 0:a.mode)){var u=n.indexOf(i);-1===u?(n.push(i),r.push(a.primary)):r[u]=a.primary,e[i]=null}else if(a){o.push(i);var l=n.indexOf(i);-1!==l&&(n.splice(l,1),r.splice(l,1))}}return{domain:n,range:r,exclude:o}}function $e(e,t,n,r){var o=function(e,t,n,r){if(t.input&&!t.input.auto){if("byMeasure"===t.input.mode)return function(e,t,n){var r=t.theme,o=t.hc,i=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===i?Ue:i,u=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,u),c=Be(0,{theme:r,hc:o},n,{f:l});if(c.invalid)return c;("expression"===u.type||u.activeMeasureIndex<0)&&(c.label=u.label,l&&"color.altLabel"===l.raw().labelExpRef&&(c.label=n.input.altLabel)),!c.label&&l&&(c.label=l.title());var s=u.activeMeasureIndex>=0?l:null;if(!s&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(s=n.pic.fields().filter((function(e){return"measure"===e.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===u.type)if(s){var f=s.raw().coloring;f&&f.gradient&&te(c,_e(e,f.gradient,c,s))}else c.auxiliary=u;return c}(e,n,t);if("byDimension"===t.input.mode)return function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.getCDef,i=void 0===o?ie:o,a=r.getCByField,u=void 0===a?ae:a,l=r.getPersistence,c=void 0===l?oe:l,s=i(t,n),f=u(n,s),d=f?f.raw():{},p=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!p.qHasOtherValues)return{invalid:!0};var h={mode:"field",fieldType:"dimension",type:"categorical",field:f?f.key():void 0,isFieldLocked:d.qLocked};return("expression"===s.type||s.activeDimensionIndex<0)&&(h.label=s.label,"color.altLabel"===d.labelExpRef&&(h.label=n.input.altLabel)),!h.label&&f&&(h.label=f.title()),n.input.dimensionScheme&&(h.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===s.type&&(h.auxiliary=s),te(h,c(t,n,s,f,{byRow:re,byElemNo:ne})),h}(e,n,t);if("byExpression"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,u=n.pic.field((function(e){return"colorByExpression"===e.raw().id}));if(!(u&&u.raw().qFallbackTitle&&(Number.isFinite(u.raw().qMin)&&Number.isFinite(u.raw().qMax)||n.input.expressionIsColor)))return{mode:"constant",type:"constant",primary:r.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:u?u.key():void 0,type:"color"};var l=Be(0,{hc:o,theme:i},n,{f:u});return l.invalid||(l.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),l}(0,n,t,r);if("byMultiple"===t.input.mode||"primary"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,u=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&o.qMeasureInfo.length>1&&(u="measure"),"measure"===u){var l=[],c=[];"measure"===n.input.useBaseColors&&o.qMeasureInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){l.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?c.push(r.primary):c.push(o)}}));var s=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,f=i?i.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&f&&(s={categorical:f.key}),{mode:"measure",type:"categorical",palettes:s,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:c}:void 0}}if("dimension"===u){var d=[],p=[];return o.qDimensionInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){d.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?p.push(r.primary):p.push(o)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:p}:void 0}}var h=r.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(h=e.resolveUIColor(n.input.paletteColor));else{var m=n.input.singleColor;"number"!=typeof m||Number.isNaN(m)||(h=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][m])}return{mode:"constant",type:"constant",primary:h}}(e,n,t,r)}return{}}(e,t,n,r);return t.input.measureOverrides?(o.measureOverrides=t.input.measureOverrides.map((function(n,o){return function(e){var t,n=e.cm,r=e.defaults,o=e.index,i=e.input,a=e.pic;if(!i||!i.on)return null;var u=null!==(t=i.mode)&&void 0!==t?t:"primary";return"primary"===u?function(e,t,n){var r=n.primary;return void 0!==t.paletteColor&&t.paletteColor&&(r=e.resolveUIColor(t.paletteColor)),_(_({},n),{},{mode:"constant",type:"constant",primary:r})}(n,i,r):"byExpression"===u?function(e,t,n){var r="qMeasureInfo/".concat(e,"/"),o=t.field((function(e){return e.id().startsWith(r)&&"colorByMeasureExpression"===e.raw().id})),i=o;return _(_({},n),{},i?{mode:"field",fieldType:"expression",field:o?o.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(o,a,r):null}({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(Ke(e),1===(null===(n=e.measureOverrides)||void 0===n?void 0:n.length))return e.measureOverrides[0];if("measure"===e.mode&&e.measureOverrides&&(e.explicit=We(e.measureOverrides,e.explicit),Ke(e)),null!==(r=e.measureOverrides)&&void 0!==r&&r.every((function(e){return"constant"===(null==e?void 0:e.mode)}))){var a={mode:"measure",type:"categorical",label:null==i?void 0:i.get("Common.Measures")};return a.explicit=We(e.measureOverrides),a}return null!==(o=e.measureOverrides)&&void 0!==o&&o.every((function(e){return e}))?{invalid:!0,measureOverrides:e.measureOverrides}:e}(o,n)):o}function Ye(e){var t=_({hc:null,colorProps:null,layout:null,theme:null},e),n={},r={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},o={auto:function(e){return e?(r.auto=e,o):r.auto},getDimensionColorMap:function(e){return e?(r.getDimensionColorMap=e,o):r.getDimensionColorMap},getAttributeDimension:function(e){return e?(r.getAttributeDimension=e,o):r.getAttributeDimension},getMeasure:function(e){return e?(r.getMeasure=e,o):r.getMeasure},set:function(e){var o;if(!e.colorProps)throw new Error('Missing "colorProps"');if(te(t,e),(n={pic:t.picasso.data("q")({data:t.hc,config:{localeInfo:t.localeInfo}}),input:t.colorProps}).input.auto){var i=r.auto(e.layout);n.input=te(!0,{},n.input,i,{auto:!1});var a=t.theme?t.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var u=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(u=+n.input.byDimDef.activeDimensionIndex),t.hc&&t.hc.qDimensionInfo[u]&&t.hc.qDimensionInfo[u].coloring&&t.hc.qDimensionInfo[u].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=t.hc.qDimensionInfo[u].coloring.colorMapRef)}null!==(o=n.input.measureOverrides)&&void 0!==o&&o.every((function(e){return!e||!e.on}))&&(n.input=te(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var e=t.theme,r=[];(e&&e.getDataColorPickerPalettes()||[]).forEach((function(e){r.push({key:"ui",colors:e.colors})})),n.palettes=r}return n.palettes},getAuxiliaryData:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!e.auxiliary&&!/qAttrDimInfo/.test(e.field))return Promise.resolve();var o=e.auxiliary||{},i=o.key;if("measure"===e.fieldType)return r.getMeasure(i,t).catch((function(){}));if("dimension"===e.fieldType){var a="".concat(n,"/").concat(e.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(e.field)?r.getAttributeDimension(a,t).catch((function(){})):Promise.resolve(),i?r.getDimensionColorMap(i,t).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(e,r){var o=this;return e.auxiliary||/qAttrDimInfo/.test(e.field)?(this.palettes(),this.getAuxiliaryData(e,r).then((function(r){if(!r)return{};if("measure"===e.fieldType){if(r.coloring&&r.coloring.gradient){var i=n.pic.field(e.field);return _e(o,r.coloring.gradient,e,i)}return{}}if("dimension"===e.fieldType){var a={nil:e.nil,others:e.others},u=r[0],l=r[1]?r[1].colorMap:null;if(u){var c=t.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(e.field).raw(),n.pic.field(e.field).raw()],qMeasureInfo:[],qDataPages:u,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=c}return l?function(e,t,n,r){var o=r.external,i=r.field,a=_({},e);te(a,ne(i,i.raw().qCardinal));var u=o.theme?o.theme.getDataColorPalettes()[0]:null;return t.nul&&(a.nil=n.resolveUIColor(t.nul)),t.oth&&(a.others=n.resolveUIColor(t.oth)),t.usePal?(a.palettes={categorical:t.pal},u&&!t.pal&&(a.palettes.categorical=u.key,te(a,ne(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(u&&(a.palettes={categorical:u.key}),te(a,ne(i))),t.colors&&t.colors.length&&(a.explicit=function(e,t,n){for(var r={},o=0;o<e.length;o+=1)r[e[o].value]=e[o].baseColor;var i=[];return{domain:function(e){var o=e.data,a=[];i=[];for(var u=0;u<o.items.length;u++){var l=o.items[u],c=(l.text||l).label;r[c]&&-1===a.indexOf(l.value)&&(a.push(l.value),i.push(t.resolveUIColor(r[c])))}return a.push(-3,-2),i.push(n.others),i.push(n.nil),a},range:function(){return i}}}(t.colors,n,a)),a}(a,l,o,{external:t,field:n.pic.field(e.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(e){if(e.index<0||void 0===e.index)return e.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(e){return"ui"===e.key}))[0]||!1),!n.uiPalette)return e.color;var t="none"===n.uiPalette.colors[0]?e.index:e.index-1;return void 0===n.uiPalette.colors[t]?e.color:n.uiPalette.colors[t]},settings:function(){if(this.palettes(),!n.settings){var e={primary:"steelblue",others:"#aaa",nil:"#ddd"},r=t.theme;r&&(e=_(_({},e),r.getDataColorSpecials())),n.settings=te(e,$e(this,n,t,e))}return n.settings}};return o}var Ge=function(e,t){var n=e.fieldType,r={};if(t)if("measure"===n){var o=t.coloring;o&&(r.measureGradient=o.gradient)}else if("dimension"===n){var i=t[0],a=t[1];i&&(r.legendDataPage=i),a&&(r.dimValsData=a.colorMap)}return r},Ze=function(e){throw e.isHandled=!0,e},Je=function(e,t){var n=t.layout,r=t.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():r&&r.getObject?r.getObject("ColorMapModel_".concat(e)).then((function(e){return e.getLayout()})):Promise.reject()},Qe=function(e,t){var n=t.layout,r=t.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():r&&r.getMeasure?r.getMeasure(e).then((function(e){return e.getMeasure()})):Promise.reject()},Xe=function(e,t){var n=t.layout,r=t.model,o=t.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():r&&r.session&&o?r.getHyperCubeData(e,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(Ze):Promise.reject()};function et(e){var t=e.hc,n=e.source,r=e.coloring,o={data:{extract:[{source:"dummy",field:0,filter:function(){return o.expando=t.qDataPages[0]?t.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:r.field,trackBy:r.valueAccessor,reduce:"first",props:{row:{reduce:function(){return o.expando++}},text:{value:function(e){return e.qText},reduce:"first"}}}]},expando:0};return o}function tt(e){return function(t){return"object"===L(t.datum[e])?t.datum[e].value:void 0}}function nt(e){return"object"===L(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function rt(e){return-3===e.datum.value}var ot=function(e,t,n){var r=e&&e.dock||void 0;if("auto"!==r)return r||"right";if(t){var o=t.element.getBoundingClientRect();if(o.height>o.width)return"bottom"}return n?"left":"right"},it=function(e,t,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&t.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof e.show?e.show():!1!==e.show)};function at(e,t){var n=e.styleReference,r=e.chart,o=e.rtl,i=t.legendProps,a=t.coloring,u=t.theme,l=t.hc;return{layout:{minimumLayoutMode:"MEDIUM",dock:ot(i,r,o)},show:"function"==typeof i.show?function(){return it(i,l,a)}:it(i,l,a),renderer:"svg",mounted:function(e){e.childNodes[0].style.pointerEvents="none",e.style.overflow="hidden"},settings:{title:{show:!1!==i.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:a.label||"",fill:u?u.getStyle(n,"legend.title","color"):void 0,fontSize:u?u.getStyle(n,"legend.title","fontSize"):"16px",fontFamily:u?u.getStyle(n,"legend.title","fontFamily"):"QlikView Sans, sans-serif"}}}}function ut(e,t,n){var r=[],o=[],i=function(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=at(e,t);if(!r.show)return!1;var o=e.key,i=e.styleReference,a=e.viewState,u=e.rtl,l=e.settings,c=e.style,s=t.scaleKey,f=t.theme,d=t.scales,p={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"},h="".concat(s,"Legend");return te(!0,r,{type:"legend-cat",key:"".concat(o,"-cat"),scale:h in d?h:s,settings:{layout:{scrollOffset:function(){return a?a.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:u?"rtl":"ltr",horizontal:20},item:{show:function(e){return-2!==e.datum.value},label:{fill:f?f.getStyle(i,"legend.label","color"):void 0,fontSize:f?f.getStyle(i,"legend.label","fontSize"):void 0,fontFamily:f?f.getStyle(i,"legend.label","fontFamily"):"QlikView Sans, sans-serif"}},navigation:{disabled:n,button:{content:function(e,t){var n=t.direction;return e("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"}},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[e("path",{d:p[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:l,style:c})}(e,t,n):"continuous"===t.coloring.type&&function(e,t){var n=e.key,r=e.styleReference,o=e.rtl,i=e.settings,a=e.style,u=t.scaleKey,l=t.theme,c=at(e,t);return!!c.show&&te(!0,c,{type:"legend-seq",key:"".concat(n,"-seq"),settings:{fill:u,major:"".concat(u,"Range"),length:1,tick:{fill:l?l.getStyle(r,"legend.label","color"):void 0,fontSize:l?l.getStyle(r,"legend.label","fontSize"):void 0,fontFamily:l?l.getStyle(r,"legend.label","fontFamily"):"QlikView Sans, sans-serif"},title:{anchor:!o||"top"!==c.layout.dock&&"bottom"!==c.layout.dock?void 0:"right",padding:parseFloat(c.settings.title.fontSize)||16}}},{settings:i,style:a})}(e,t)}(e,t,n&&n.navigationDisabled);return r.push(i),i&&"legend-cat"===i.type&&(o.push(function(e){var t=e.key,n=e.requireFailure,r=e.recognizeWith,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(t),type:"Tap",requireFailure:n,recognizeWith:r,options:{event:"legendtap",interval:10,pointers:1,enable:function(e,n){var r;if(!n)return!0;if(null!=o&&null!==(r=o.interact)&&void 0!==r&&r.enabled&&!o.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(e){return e.key==="".concat(t,"-cat")})))return!1;var i=n.srcEvent.target;return!!(i&&i.hasAttribute("data-action")&&i.hasAttribute("data-component-key"))||!(!i||!i.childNodes[0]||"BUTTON"!==i.childNodes[0].nodeName)}},events:{legendtap:function(e){e.preventDefault();var t=e.srcEvent.target;t&&t.hasAttribute("data-action")&&t.hasAttribute("data-component-key")&&this.chart.component(t.getAttribute("data-component-key")).emit(t.getAttribute("data-action"))}}}}(e,n)),o.push(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.eventName,r=t.key,o=t.requireFailure,i=t.recognizeWith,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(r),type:"Pan",requireFailure:o,recognizeWith:i,options:{event:n,pointers:1,threshold:10,enable:function(e,t){var o;return this.started===n||!t||!(null!=a&&null!==(o=a.interact)&&void 0!==o&&o.enabled&&!a.interact.enabled())&&this.chart.componentsFromPoint({x:t.center.x,y:t.center.y}).some((function(e){return e.key==="".concat(r,"-cat")}))}},events:(e={},H(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),H(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),H(e,"".concat(n,"end"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panend",e),this.started=!1})),e)}}(e,n))),{interactions:o,components:r}}var lt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function ct(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=Ye(e.resources).auto(t||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(e,t){var n=t.layout,r=t.app;return Je(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return Qe(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return Xe(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=Ge,n}({resources:e}),n={},r={},o=function(e){return r.settings||(e||console.warn("settings() called before auxiliarySettings()"),r.settings=t.settings()),r.settings},i={config:function(o){if(n=_({},o),r={},!n.key)throw new Error("Missing key");t.set(_(_({},e),n))},auto:function(e){return e?(t.auto(e),i):t.auto()},getAuxiliarySettings:function(e){return r.auxiliarySettings?Promise.resolve(r.auxiliarySettings):t.getAuxiliarySettings(o(!0),e).then((function(e){return r.auxiliarySettings=e||{},r.settings=_(_({},r.settings),r.auxiliarySettings),r.scales=void 0,r.color=void 0,r.auxiliarySettings}))},getAuxiliaryData:function(){return t.getAuxiliaryData(o())},getSnapshotData:function(e){var n=o();return t.getAuxiliaryData(n,e).then((function(e){return t.getSnapshotData(n,e)}))},resolveUIColor:function(e){return t.resolveUIColor(e)},settings:function(){var e=o();return{mode:e.mode,type:e.type,label:e.label,field:e.field,fieldType:e.fieldType,nil:e.nil,others:e.others,primary:e.primary}},settingsForMeasure:function(e){var t;return(null===(t=o().measureOverrides)||void 0===t?void 0:t[e])||this.settings()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return function(e,t){var n=t.isMeasureSelectionLocked;return"field"!==e.mode||("dimension"===e.fieldType?e.isFieldLocked:"measure"!==e.fieldType||n)}(o(),{isMeasureSelectionLocked:t})},palettes:function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.colorProps,n=e.coloring,r=e.theme,o=[];if(n&&n.palettes&&r){var i=n.palettes.categorical||t.dimensionScheme,a=r.getDataColorPalettes().filter((function(e){return e.key===i}))[0]||r.getDataColorPalettes()[0];i&&a&&o.push({key:"categorical",colors:a.colors});var u=n.palettes.metric||t.measureScheme,l=r.getDataColorScales().filter((function(e){return e.key===u}))[0];if(l){var c=l.colors[0]?l.colors:[[]].concat(U(l.colors.slice(1)));c=Array.isArray(c[0])?c.map((function(e){return e.slice().reverse()})):c.slice().reverse(),o.push({key:"quant",colors:c})}}return o}({coloring:o(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return r.scales=r.scales||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hc,n=e.coloring,r=e.rtl,o=e.key,i=e.source,a=e.picasso,u={},l=o;if(n){var c={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(U((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(U((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var s,f=et({hc:t,source:i,coloring:n}).data;if(n.legendDataset){var d=0,p={};a.data("q")({data:t}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(e){var t=e[0];return p[t]=d++,e[0]}}),s={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(e){return e.qElemNumber>=0},props:{row:{value:function(e){return p[e.qElemNumber]}}}}}}var h={data:f,range:n.range,domain:n.domain,explicit:c,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};u[l]=h,s&&(u["".concat(l,"Legend")]=_(_({},h),{},{data:s})),t&&t.qHasOtherValues&&s&&((s||h.data).amend=[{label:t.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var m={data:{field:n.field},min:n.min,max:n.max};u[l]=te({},m,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===u[l].type&&(u["".concat(l,"Range")]=te({},m,{invert:!!r}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var v={data:t.qDimensionInfo.map((function(e,t){return t})),label:function(e){return t.qDimensionInfo[e.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};u[l]=v}else if("measure"===n.mode){var g={data:t.qMeasureInfo.map((function(e,t){return t})).filter((function(e){var t,r;return!(null!==(t=n.explicit)&&void 0!==t&&null!==(r=t.exclude)&&void 0!==r&&r.includes(e))})),label:function(e){return t.qMeasureInfo[e.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};u[l]=g}}return u}({hc:n.hc,coloring:o(),key:n.key,source:n.source,picasso:e.picasso}),r.scales},color:function(){return r.color=r.color||function(e){var t=e.coloring,n=e.scales,r=e.key,o=tt(r),i=tt("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,u=e.mode,l=e.nil,c=e.others,s=e.primary,f=e.type;return a?function(e){return rt(e)||i(e)?c:l}:n[t]?function(e){return rt(e)?c:nt(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?l:i(e)?c:e.resources.scale(t)(o(e))||c}:"constant"===u?function(e){return rt(e)||i(e)?c:nt(e)?l:s}:"color"===f?function(e){return rt(e)||i(e)?c:nt(e)?l:o(e)||c}:null},u=a(t,r);if(t.measureOverrides){var l=tt("".concat(r,"MeasureIdx")),c=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=l(e);return c[t]?c[t](e):u(e)}}return u}({coloring:o(),scales:this.scales(),key:n.key}),r.color},datumProps:function(e){return function(e){var t,n,r=e.hc,o=e.coloring,i=e.scales,a=e.key,u=e.addMeasureIx,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=a,s=o.nil;"field"===o.mode&&o.field?t=o.field:i[a]&&"field"===o.mode&&(t=i[a].data.field||o.field),t?(n={field:t,reduce:"first"},"color"===o.type&&(n.value=function(e){return"NaN"!==e.qNum?lt(e.qNum):e.qText&&Ce(e.qText)?e.qText:s})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=l);var f=H({},c,n);return r.qDimensionInfo.length>1&&(f["".concat(c,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),u&&(f["".concat(c,"MeasureIdx")]=l),f}({coloring:this.settingsForMeasure(e),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:o().measureOverrides},e)},data:function(){var e=o(),t={key:"dummy",data:[["field"],["a"]]};return e.legendDataset?[t,{type:"q",key:"attrDim",data:e.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[t]},legend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.eventName,r=e.key,i=e.viewState,a=e.chart,u=e.rtl,l=e.styleReference,c=void 0===l?"object.legend":l,s=e.settings,f=void 0===s?{}:s,d=e.style,p=void 0===d?{}:d,h=arguments.length>1?arguments[1]:void 0;return ut({eventName:t,key:r,rtl:u,viewState:i,chart:a,styleReference:c,settings:f,style:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:o(),theme:n.theme,hc:n.hc,scales:this.scales()},h)}};return i}var st=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function ft(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(st),i=r.some(st),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function dt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=_(_(_({},e),t),{},{colorProps:_(_({},e.colorProps),t.colorProps||{})});return n}var pt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function ht(e){var t,n=e.qHyperCube.qDimensionInfo.some(pt),r=e.qHyperCube.qMeasureInfo.some(pt),o=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(t=null!=o?o:r?"measure":void 0)&&void 0!==t?t:"off",paletteColor:null}}var mt=function(){};function vt(e){var t=e.originalArray,n=e.newArray,r=e.matchKey;return Array.isArray(t)&&t.length?(n.forEach((function(e){var n=-1;t.some((function(t,o){return t[r]&&t[r]===e[r]&&(n=o),n})),n>-1?t[n]=e:t.push(e)})),t):n}function gt(e){return(gt="function"==typeof Symbol&&"symbol"==x(Symbol.iterator)?function(e){return x(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":x(e)})(e)}function yt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function xt(e,t,n){return t&&bt(e.prototype,t),n&&bt(e,n),e}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(n),!0).forEach((function(t){qt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ct(e,t){return(Ct=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Mt(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function It(e,t,n){return(It=Mt()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Ct(o,n.prototype),o}).apply(null,arguments)}function St(e){return function(e){if(Array.isArray(e))return Ot(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||kt(e)||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 kt(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var At=Object.prototype.hasOwnProperty,Et=Object.prototype.toString,Nt=Object.defineProperty,Pt=Object.getOwnPropertyDescriptor,jt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Et.call(e)},Tt=function(e){if(!e||"[object Object]"!==Et.call(e))return!1;var t,n=At.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&At.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||At.call(e,t)},Lt=function(e,t){Nt&&"__proto__"===t.name?Nt(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Rt=function(e,t){if("__proto__"===t){if(!At.call(e,t))return;if(Pt)return Pt(e,t).value}return e[t]},Ft=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,c=arguments.length,s=!1;for("boolean"==typeof u&&(s=u,u=arguments[1]||{},l=2),(null==u||"object"!=x(u)&&"function"!=typeof u)&&(u={});l<c;++l)if(null!=(t=arguments[l]))for(n in t)r=Rt(u,n),u!==(o=Rt(t,n))&&(s&&o&&(Tt(o)||(i=jt(o)))?(i?(i=!1,a=r&&jt(r)?r:[]):a=r&&Tt(r)?r:{},Lt(u,{name:n,newValue:e(s,a,o)})):void 0!==o&&Lt(u,{name:n,newValue:o}));return u};function Ht(e,t,n){if(!e)return-1;var r=n.cache,o=e.origin?e.origin():null;o&&(e=o);var i=r.fields.indexOf(e),a=-1,u=-1;if(-1===i)for(var l=0;l<r.wrappedFields.length;l++)if(u=r.wrappedFields[l].attrDims.map((function(e){return e.instance})).indexOf(e),a=r.wrappedFields[l].attrExps.map((function(e){return e.instance})).indexOf(e),-1!==u||-1!==a){i=l;break}return(i-=t.qArea.qLeft)<0||i>=t.qArea.qWidth?-1:u>=0?function(e){return e[i].qAttrDims.qValues[u]}:a>=0?function(e){return e[i].qAttrExps.qValues[a]}:function(e){return e[i]}}function Vt(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function _t(e){var t=e.cache,n=e.f,r=e.mainCell,o=e.p;e.prop;var i=e.page,a=e.rowIdx,u=e.row,l=e.sourceKey,c=e.target,s=e.targetProp,f=r;if(o.field&&o.field!==n){var d=Ht(o.field,i,{cache:t});if(-1===d)return;f=Ft({qRow:a},d(u))}c[s]=Vt(o,f,{key:l})}function zt(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){for(var u=t.raw(),l=t.key(),c="object"===gt(o[a].field)?o[a].field:t.field(o[a].field),s=r.normalizeConfig(o[a],t),f=s.props,d=s.main,p=Object.keys(f),h=!!o[a].trackBy,m=gt(o[a].trackBy),v={},g=[],y=[],b=0;b<u.qDataPages.length;b++){var x=Ht(c,u.qDataPages[b],{cache:n});if(-1!==x)for(var q=0;q<u.qDataPages[b].qMatrix.length;q++){var D=u.qDataPages[b].qArea.qTop+q,w=Ft({qRow:D},x(u.qDataPages[b].qMatrix[q])),C=Vt(d,w,{key:l});if(!d.filter||d.filter(w)){for(var M=0;M<p.length;M++){var I=f[p[M]],S=I.fields||[I];I.fields&&(C[p[M]]=[]);for(var k=0;k<S.length;k++)_t({cache:n,f:c,mainCell:w,p:S[k],prop:p[M],props:f,page:u.qDataPages[b],rowIdx:D,row:u.qDataPages[b].qMatrix[q],sourceKey:l,target:I.fields?C[p[M]]:C,targetProp:I.fields?k:p[M]});if(I.fields){var O=C[p[M]].map((function(e){return e.value})),A=C[p[M]].map((function(e){return e.label}));C[p[M]]={value:"function"==typeof I.value?I.value(O):void 0!==I.value?I.value:O,label:"function"==typeof I.label?I.label(A):void 0!==I.label?String(I.label):String(C[p[M]].value)}}}h&&r.track({cfg:o[a],itemData:w,obj:C,target:g,tracker:v,trackType:m}),y.push(C)}}}h?i.push.apply(i,St(r.collect(g,{main:d,propsArr:p,props:f}))):i.push.apply(i,y)}return i}function Bt(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Ut(e,t){var n,r,o,i,a,u=new Yt(e),l=+e.value&&(u.value=e.value),c=[u];for(null==t&&(t=Kt);n=c.pop();)if(l&&(n.value=+n.data.value),(o=t(n.data))&&(a=o.length))for(n.children=new Array(a),i=a-1;i>=0;--i)c.push(r=n.children[i]=new Yt(o[i])),r.parent=n,r.depth=n.depth+1;return u.eachBefore($t)}function Kt(e){return e.children}function Wt(e){e.data=e.data.data}function $t(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function Yt(e){this.data=e,this.depth=this.height=0,this.parent=null}function Gt(e){if("function"!=typeof e)throw new Error;return e}Yt.prototype=Ut.prototype={constructor:Yt,count:function(){return this.eachAfter(Bt)},each:function(e){var t,n,r,o,i=this,a=[i];do{for(t=a.reverse(),a=[];i=t.pop();)if(e(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r])}while(a.length);return this},eachAfter:function(e){for(var t,n,r,o=this,i=[o],a=[];o=i.pop();)if(a.push(o),t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n]);for(;o=a.pop();)e(o);return this},eachBefore:function(e){for(var t,n,r=this,o=[r];r=o.pop();)if(e(r),t=r.children)for(n=t.length-1;n>=0;--n)o.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,o=r&&r.length;--o>=0;)n+=r[o].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),o=null;for(e=n.pop(),t=r.pop();e===t;)o=e,e=n.pop(),t=r.pop();return o}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var o=r.length;e!==n;)r.splice(o,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Ut(this).eachBefore(Wt)}};var Zt={depth:-1},Jt={};function Qt(e){return e.id}function Xt(e){return e.parentId}function en(e,t){"/"===e.charAt(0)&&(e=e.substring(1));for(var n,r=e.split("/"),o=t,i=0;i<r.length;i++){if("*"===r[i]&&Array.isArray(o)){var a=[];n=r.slice(i+1).join("/");for(var u=0;u<o.length;u++){var l=en(n,o[u]);Array.isArray(l)?a.push.apply(a,St(l)):a.push(l)}return a}if(!r[i]&&Array.isArray(o)){var c=new Array(o.length);n=r.slice(i+1).join("/");for(var s=0;s<o.length;s++)c[s]=en(n,o[s]);return c}r[i]in o&&(o=o[r[i]])}return o}function tn(e,t,n){var r=[];if(!e||!e.length)return r;if(t<=0){var o=n>=0?[e[n]]:e;r.push.apply(r,St(o))}else for(var i=0;i<e.length;i++)e[i].children&&e[i].children.length&&r.push.apply(r,St(tn(e[i].children,t-1,n)));return r}function nn(e,t,n){if(e===t)return function(e){return e};if(e>t){var r=Math.max(0,Math.min(100,e-t)),o=St(Array(r)).map(String.prototype.valueOf,"parent").join(".");return Function("node","return node.".concat(o,";"))}if(t>e){var i=Math.max(0,Math.min(100,t-e));return function(e){return tn(e.children,i-1,n)}}return!1}function rn(e,t){var n=t.cache;if("number"==typeof e)return n.fields[e];var r=n.allFields;if("function"==typeof e){for(var o=0;o<r.length;o++)if(e(r[o]))return r[o];return!1}if("string"==typeof e){for(var i=0;i<r.length;i++)if(r[i].key()===e||r[i].title()===e)return r[i]}else if(e&&-1!==r.indexOf(e))return e;throw Error("Field not found: ".concat(e))}var on=/^qDimensionInfo(?:\/(\d+))?/,an=/^\/?qMeasureInfo\/(\d+)/,un=/\/qAttrExprInfo\/(\d+)/,ln=/\/qAttrDimInfo\/(\d+)/;function cn(e){return(e.qColumnOrder&&e.qColumnOrder.length?e.qColumnOrder:e.qDimensionInfo.map((function(e,t){return t}))).filter((function(t){return t<e.qDimensionInfo.length}))}function sn(e,t){var n=t.cube;if(!e)return-1;var r=e.origin&&e.origin()?e.origin().key():e.key(),o=!1,i=-1,a=-1,u=-1,l=-1,c=-1,s=r,f=n.qEffectiveInterColumnSortOrder,d=cn(n);return on.test(s)&&(o=!0,i=+on.exec(s)[1],s=r.replace(on,"")),an.test(s)&&("K"===n.qMode?l=+an.exec(s)[1]:f&&-1!==f.indexOf(-1)?(l=+an.exec(s)[1],c=0):c=+an.exec(s)[1],s=s.replace(an,"")),s&&(ln.exec(s)?u=+ln.exec(s)[1]:un.exec(s)&&(a=+un.exec(s)[1])),{fieldDepth:(o?"S"===n.qMode?d[i]:f?f.indexOf(i):i:f&&-1!==f.indexOf(-1)?f.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1))+1,pseudoMeasureIndex:l,measureIdx:c,attrDimIdx:u,attrIdx:a}}function fn(e,t){var n,r,o=nn(e.fieldDepth,t.fieldDepth,t.pseudoMeasureIndex);return n=t.measureIdx>=0?function(e){return e.data.qValues[t.measureIdx]}:function(e){return e.data},t.attrDimIdx>=0?r=function(e){var n;return null==e||null===(n=e.qAttrDims)||void 0===n?void 0:n.qValues[t.attrDimIdx]}:t.attrIdx>=0&&(r=function(e){var n;return null==e||null===(n=e.qAttrExps)||void 0===n?void 0:n.qValues[t.attrIdx]}),{nodeFn:o,attrFn:r,valueFn:n}}function dn(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function pn(e){for(var t=e.propsArr,n=e.props,r=e.item,o=e.itemData,i=e.ret,a=e.sourceKey,u=0;u<t.length;u++){var l=n[t[u]],c=l.fields||[l],s=void 0,f=void 0;l.fields&&(s=[],f=[]);for(var d=function(e){var n=c[e],d=void 0,p=void 0,h=void 0,m=void 0,v=void 0,g=void 0;if("primitive"===n.type?(h=n.value,g=String(n.value)):("function"==typeof n.value&&(d=function(e){return n.value(e,r)}),"function"==typeof n.label&&(p=function(e){return n.label(e,r)}),n.accessor?(m=n.accessor(r),Array.isArray(m)?(v=m.map(n.valueAccessor),n.attrAccessor&&(v=v.map(n.attrAccessor)),d&&(h=v.map(d),d=null),p&&(g=v.map(p),p=null),h=n.reduce?n.reduce(h):h,g=n.reduceLabel?n.reduceLabel(g,h):String(h)):g=h=n.attrAccessor?n.attrAccessor(n.valueAccessor(m)):n.valueAccessor(m)):(h=o,g=o)),l.fields){var y=d?d(h):h;s.push(y),f.push(p&&null!=g?p(g):null!=g?g:String(y))}else{var b=d?d(h):h;i[t[u]]={value:b,label:p?p(g):null!=g?g:String(b)},n.field&&(i[t[u]].source={field:n.field.key(),key:a})}},p=0;p<c.length;p++)d(p);s&&(i[t[u]]={value:"function"==typeof l.value?l.value(s,r):s,label:"function"==typeof l.label?l.label(f,r):f})}}var hn=function(e,t,n){var r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=en(r,e);return i&&i[0]?(t.tree=Ut(i[0],n.children||function(e){return e[o]}),t.tree):null};function mn(e){for(var t=e.raw().qDataPages.length?e.raw().qDataPages[0].qMatrix:[],n=function(e){var t=e.raw().qColumnOrder,n=e.fields();return t&&t.length===n.length?t:n.map((function(e,t){return t}))}(e),r=e.fields(),o=e.fields().filter((function(e){return"dimension"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),i=e.fields().filter((function(e){return"measure"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),a={__root:{__id:"__root",qValues:[]}},u=0;u<t.length;u++){for(var l=t[u],c="__root",s=!1,f=0;f<o.length;f++){var d=l[o[f]],p="".concat(c,"__").concat(d.qText);a[p]||(a[p]=wt({__id:p,__parent:c,qValues:[]},d),s=!0),c=p}if(s)for(var h=0;h<i.length;h++){var m=l[i[h]];a[c].qValues.push(m)}}var v=Object.keys(a).map((function(e){return a[e]}));return function(){var e=Qt,t=Xt;function n(n){var r,o,i,a,u,l,c,s=n.length,f=new Array(s),d={};for(o=0;o<s;++o)r=n[o],u=f[o]=new Yt(r),null!=(l=e(r,o,n))&&(l+="")&&(d[c="$"+(u.id=l)]=c in d?Jt:u);for(o=0;o<s;++o)if(u=f[o],null!=(l=t(n[o],o,n))&&(l+="")){if(!(a=d["$"+l]))throw new Error("missing: "+l);if(a===Jt)throw new Error("ambiguous: "+l);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(i)throw new Error("multiple roots");i=u}if(!i)throw new Error("no root");if(i.parent=Zt,i.eachBefore((function(e){e.depth=e.parent.depth+1,--s})).eachBefore($t),i.parent=null,s>0)throw new Error("cycle");return i}return n.id=function(t){return arguments.length?(e=Gt(t),n):e},n.parentId=function(e){return arguments.length?(t=Gt(e),n):t},n}().id((function(e){return e.__id})).parentId((function(e){return e.__parent}))(v)}var vn=function(e){for(var t=e.propsArr,n=e.props,r=e.cube,o=e.cache,i=e.itemDepthObject,a=e.f,u=0;u<t.length;u++)for(var l=n[t[u]],c=l.fields?l.fields:[l],s=0;s<c.length;s++){var f=c[s];if(f.field!==a){var d=fn(i,sn(f.field,{cube:r,cache:o}));f.accessor=d.nodeFn,f.valueAccessor=d.valueFn,f.attrAccessor=d.attrFn}}};function gn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t.raw(),i=t.key(),a="S"===o.qMode?mn(t):hn(o,n,e);if(!a)return null;for(var u=a.height,l=[],c=0;c<=u;c++){var s=null;if(c>0)if("S"===o.qMode){var f=cn(o),d=f[c-1];s=n.fields[d]}else{var p=o.qEffectiveInterColumnSortOrder[c-1];c>o.qEffectiveInterColumnSortOrder.length&&(p=o.qDimensionInfo.length),s=n.fields[p]}var h=r.normalizeConfig(wt(wt({},e),{},{field:s?s.key():void 0}),t),m=h.props,v=h.main,g=Object.keys(m);l[c]={propsArr:g,props:m,main:v};var y=s?sn(s,{cube:o,cache:n}):{fieldDepth:0};vn({propsArr:g,props:m,cube:o,cache:n,itemDepthObject:y,f:s})}for(var b=a.copy(),x=b.descendants(),q=a.descendants(),D=0;D<q.length;D++){var w=l[q[D].depth].propsArr,C=l[q[D].depth].props,M=l[q[D].depth].main,I=x[D],S=I.data,k=dn(M,S,{key:i});pn({propsArr:w,props:C,item:I,itemData:S,ret:k,sourceKey:i,isTree:!0}),q[D].data=k}return a}function yn(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){var u=t.raw(),l=t.key();if(!hn(u,n,e))continue;var c="object"===gt(o[a].field)?o[a].field:t.field(o[a].field),s=r.normalizeConfig(o[a],t),f=s.props,d=s.main,p=Object.keys(f),h=sn(c,{cube:u,cache:n}),m=fn({fieldDepth:0},h),v=m.nodeFn,g=m.attrFn,y=m.valueFn;vn({propsArr:p,props:f,cube:u,cache:n,itemDepthObject:h,f:c});for(var b=!!o[a].trackBy,x=gt(o[a].trackBy),q={},D=[],w=v(n.tree),C=[],M=0;M<w.length;M++){var I=w[M],S=g?g(y(I)):y(I);if(!d.filter||d.filter(S)){var k=dn(d,S,{key:l});pn({propsArr:p,props:f,item:I,itemData:S,ret:k,sourceKey:l}),b&&r.track({cfg:o[a],itemData:S,obj:k,target:D,tracker:q,trackType:x}),C.push(k)}}b?i.push.apply(i,St(r.collect(D,{main:d,propsArr:p,props:f}))):i.push.apply(i,C)}return i}var bn,xn=(function(e){
8
8
  /*! javascript-number-formatter - v1.1.11 - http://mottie.github.com/javascript-number-formatter/ * © ecava */
9
9
  e.exports=function(e,t){if(!e||isNaN(+t))return t;var n,r,o,i,a,u,l,c,s,f,d=e.length,p=e.search(/[0-9\-\+#]/),h=p>0?e.substring(0,p):"",m=e.split("").reverse().join(""),v=m.search(/[0-9\-\+#]/),g=d-v,y=e.substring(g,g+1),b=g+("."===y||","===y?1:0),x=v>0?e.substring(b,d):"";if(n=(t="-"===(e=e.substring(p,b)).charAt(0)?-t:+t)<0?t=-t:0,o=(r=e.match(/[^\d\-\+#]/g))&&r[r.length-1]||".",i=r&&r[1]&&r[0]||",",e=e.split(o),t=+(t=t.toFixed(e[1]&&e[1].length))+"",u=e[1]&&e[1].lastIndexOf("0"),(!(c=t.split("."))[1]||c[1]&&c[1].length<=u)&&(t=(+t).toFixed(u+1)),s=e[0].split(i),e[0]=s.join(""),(a=e[0]&&e[0].indexOf("0"))>-1)for(;c[0].length<e[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((t=t.split("."))[0]=c[0],l=s[1]&&s[s.length-1].length){for(m="",g=(f=t[0]).length%l,d=f.length,b=0;b<d;b++)m+=f.charAt(b),!((b-g+1)%l)&&b<d-l&&(m+=i);t[0]=m}return t[1]=e[1]&&t[1]?o+t[1]:"","0"!==(r=t.join(""))&&""!==r||(n=!1),h+(n?"-":"")+r+x}}(bn={exports:{}}),bn.exports);function qn(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}var Dn={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"},wn=/%$/,Cn=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Mn=/^\(oct\)/i,In=/^\(dec\)/i,Sn=/^\(hex\)/i,kn=/^\(bin\)/i,On=/^\(rom\)/i,An=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,En=/#|0/g;function Nn(e,t,n,r){return e=e.toString(t),n[1]===n[1].toUpperCase()&&(e=e.toUpperCase()),e.length-e.indexOf(".")>10&&(e=e.slice(0,e.indexOf(".")+11)),e.replace(".",r||".")}function Pn(e,t,n){var r=qn(e);return n?r:new RegExp(r||"",t)}function jn(e,t,n){var r,o,i,a,u,l,c,s,f,d,p,h=e.pattern;h.indexOf("A")>=0&&(h=h.replace("A",""),e.abbreviate=!0),d=t,(p=n)&&(p=qn(p)),d&&(d=qn(d)),f=new RegExp("(?:[#0]+".concat(d,")?[#0]+(?:").concat(p,"[#0]+)?")),a=(i=(i=h.match(f))?i[0]:"")?h.substr(0,h.indexOf(i)):h,u=i?h.substring(h.indexOf(i)+i.length):"",i||(i=h?"#":"##########"),t&&t===n&&(o=(r=i.split(n)).pop(),i=r.join("")+n+o,t=""),l=t,t=/,/.test(n)?"¤":",",l&&(i=i.replace(Pn(l,"g"),t)),c=n,n=".",c&&(i=i.replace(Pn(c,"g"),n)),s=(s=i.match(/#/g))?s.length:0;var m,v=h.split(c);v[1]&&(m=v[1].match(En)),e.prefix=a||"",e.postfix=u||"",e.pattern=h,e.maxPrecision=m?m.length:2,e.percentage=wn.test(h),e.numericPattern=i||"",e.numericRegex=new RegExp("".concat(Pn(t,null,!0),"|").concat(Pn(n,null,!0)),"g"),e.groupTemp=l,e.decTemp=c,e.t=t,e.d=n,e.temp=s}var Tn=function(){function e(t,n,r,o,i){yt(this,e),this.localeInfo=t,this.pattern=n,this.thousandDelimiter=r||",",this.decimalDelimiter=o||".",this.type=i||"numeric",this.patternSeparator=";",this.abbreviations=function(e,t){if(!e||!e.qNumericalAbbreviation)return Dn;var n={};return e.qNumericalAbbreviation.split(t).forEach((function(e){var t=e.split(":");2===t.length&&(n[t[0]]=t[1])})),n}(t,this.patternSeparator),this.prepare()}return xt(e,[{key:"clone",value:function(){var t=new e(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return t.subtype=this.subtype,t}},{key:"format",value:function(e,t,n,r){return this.prepare(t,n,r),this.formatValue(e)}},{key:"prepare",value:function(e,t,n){var r;void 0===e&&(e=this.pattern),void 0===t&&(t=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),e?(this._prepared={positive:{d:n,t:t,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:t,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:t,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},r=this._prepared,e=e.split(this.patternSeparator),r.positive.pattern=e[0],r.negative.pattern=e[1],r.zero.pattern=e[2],An.test(e[0])&&(r.positive.isFunctional=!0),e[1]?An.test(e[1])&&(r.negative.isFunctional=!0):r.negative=!1,e[2]?An.test(e[2])&&(r.zero.isFunctional=!0):r.zero=!1,r.positive.isFunctional||jn(r.positive,t,n),r.negative&&!r.negative.isFunctional&&jn(r.negative,t,n),r.zero&&!r.zero.isFunctional&&jn(r.zero,t,n)):this._prepared={pattern:!1}}},{key:"formatValue",value:function(e){var t,n,r,o,i,a,u,l,c,s=this._prepared,f="",d="",p=e;if(isNaN(e))return"".concat(p);if(e=+e,!1===s.pattern)return e.toString();if(0===e&&s.zero)return(s=s.zero).pattern;if(e<0&&s.negative?(s=s.negative,e=-e):s=s.positive,i=s.d,a=s.t,s.isFunctional)e=function(e,t,n){var r;return Cn.test(t)?e=Nn(e,Number(/\d{2}/.exec(t)[0]),t,n):Mn.test(t)?e=Nn(e,8,t,n):In.test(t)?e=Nn(e,10,t,n):Sn.test(t)?e=Nn(e,16,t,n):kn.test(t)?e=Nn(e,2,t,n):On.test(t)&&(r="",e<0&&(r="-",e=-e),e=0===(e=Math.floor(e))?"0":e<=5e5?r+(e=function(e,t){for(var n,r="",o=Number(String(e).slice(-3)),i=(e-o)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),u=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();o>0;)for(n=0;n<a.length;n++)if(a[n]<=o){r+=u[n],o-=a[n];break}for(n=0;n<i;n++)r="M".concat(r);return t[1]!==t[1].toUpperCase()&&(r=r.toLowerCase()),r}(e,t)):t+r+e.toExponential(0)),e}(e,s.pattern,i);else{if(s.percentage&&(e*=100),s.abbreviate){var h,m,v=Object.keys(this.abbreviations).map((function(e){return parseInt(e,10)})).sort((function(e,t){return e-t})),g=v[0];for(u=0,n=Number(Number(e).toExponential().split("e")[1]);g<=n&&u<v.length;)g=v[++u];u>0&&(h=v[u-1]),h&&n>0&&h>0?m=h:(n<0&&h<0||!h)&&(g<0&&g-n<=s.maxPrecision?m=g:h<=n&&!(g>0&&-n<=s.maxPrecision)&&(m=h)),m&&(f=this.abbreviations[m],e/=Math.pow(10,m))}if(r=Math.abs(e),t=s.temp,c=(l=s.numericPattern).split(i)[1],"I"===this.type&&(e=Math.round(e)),o=e,c||"#"!==l.slice(-1)[0])if(r>=1e15||r>0&&r<=1e-14)e=r?r.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{var y=Number(e.toFixed(Math.min(20,c?c.length:0)).split(".")[0]),b=l.split(i)[0];if(e=xn(b+=i,y)||"0",c){var x=Math.max(0,Math.min(14,c.length)),q=c.replace(/#+$/,"").length,D=("I"===this.type?0:r%1).toFixed(x).slice(2).replace(/0+$/,"");for(u=D.length;u<q;u++)D+="0";D&&(e+=i+D)}else 0===y&&(o=0)}else if(r>=Math.pow(10,t)||r<1||r<1e-4)0===e?e="0":r<1e-4||r>=1e20?(e=(e=o.toExponential(Math.max(1,Math.min(14,t))-1)).replace(/\.?0+(?=e)/,""),d=""):(e=e.toPrecision(Math.max(1,Math.min(14,t)))).indexOf(".")>=0&&(e=(e=e.replace(e.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",i));else{for(l+=i,t=Math.max(0,Math.min(20,t-Math.ceil(Math.log(r)/Math.log(10)))),u=0;u<t;u++)l+="#";e=xn(l,e)}e=e.replace(s.numericRegex,(function(e){return e===a?s.groupTemp:e===i?s.decTemp:""})),o<0&&!/^-/.test(e)&&(e="-".concat(e))}return s.prefix+e+d+f+s.postfix}}],[{key:"getStaticFormatter",value:function(){return{prepare:function(){},formatValue:function(e){return"".concat(e)}}}}]),e}();function Ln(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size,i=void 0===o?5e3:o,a=r.multipleArguments,u=void 0!==a&&a,l=r.toKey,c=void 0===l?function(e){return e}:l,s=Object.create(null),f=Object.create(null),d=0,p=0;return(t=u?function(){return n=c.apply(void 0,arguments),t.has(n)?t.get(n):t.set(n,e.apply(void 0,arguments))}:function(r){return n=c(r),t.has(n)?t.get(n):t.set(n,e(r))}).set=function(e,t){return d>=i&&(delete s[f[p]],delete f[p],d--,p++),s[e]=t,f[d]=e,d++,t},t.get=function(e){return s[e]},t.has=function(e){return e in s},t.clear=function(){s=Object.create(null),f=Object.create(null),d=0,p=0},t.size=function(){return d},t}function Rn(e,t,n,r,o){var i=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return It(Tn,t)}(o,e,t,n,r),a=Ln(i.formatValue.bind(i),{toKey:function(e){return isNaN(e)?e:+e}});function u(e){return a(e)}return u.format=function(e,t,n,r){return a.clear(),i.format(t,e,n,r)},u.pattern=function(e){return e&&(a.clear(),i.pattern=e,i.prepare()),i.pattern},u}var Fn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Hn=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Vn=["January","February","March","April","May","June","July","August","September","October","November","December"],_n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zn(e,t){for(var n=e.length;n<t;n++)e="0".concat(e);return e}function Bn(e){var t=e.toString().split(".");return t[1]?t=Number("0.".concat(t[1])):0}var Un=function(){function e(t,n,r){yt(this,e);var o,i=t||{};i.qCalendarStrings||(i.qCalendarStrings={qLongDayNames:Fn,qDayNames:Hn,qLongMonthNames:Vn,qMonthNames:_n}),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(),n||(n=(qt(o={},"T",i.qTimeFmt||"hh:mm:ss"),qt(o,"D",i.qDateFmt||"YYYY-MM-DD"),qt(o,"TS",i.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"),o)[r]),this.pattern=n}return xt(e,[{key:"clone",value:function(){var t=new e(this.localeInfo,this.pattern);return t.subtype=this.subtype,t}},{key:"format",value:function(e,t){t||(t=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),t=t.replace(/\[.+]|\[|]/g,"");var n,r,o,i,a,u=/t+/gi.test(t);e instanceof Date?(o=u,i=(r=e).getUTCHours(),o&&((i%=12)||(i=12)),(a=r.getUTCDay()-1)<0&&(a=6),n={year:r.getUTCFullYear(),month:r.getUTCMonth(),day:a,date:r.getUTCDate(),h:i,m:r.getUTCMinutes(),s:r.getUTCSeconds(),f:r.getUTCMilliseconds(),t:r.getUTCHours()>=12?"pm":"am"}):(e<0&&(e=-e,t="-".concat(t)),n=function(e,t){var n,r=function(e){var t=e,n=24*Bn(t),r=60*Bn(n),o=60*Bn(r),i=1e3*Bn(o);return{d:Math.floor(t),h:Math.floor(n),m:Math.floor(r),s:Math.floor(o),f:Math.round(i)}}(e),o=r.d,i=r.h,a=r.m,u=r.s,l=r.f,c=0;/w+|t+/gi.test(t)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(e),0,0,Math.round(86400*(e-Math.floor(e))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(t)||(i+=24*o),/h+/gi.test(t)||(a+=60*i),/m+/gi.test(t)||(u+=60*a),/w+/gi.test(t)&&(c=n?n.getDay()-1:0)<0&&(c=6);var s="";return n&&(s=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:c,date:o,h:i,m:a,s:u,f:l,t:s}}(e,t));var l=function(e,t){return{"Y+|y+":{Y:"".concat(Number("".concat(t.year).slice(-2))),YY:zn("".concat(t.year).slice(-2),2),YYY:zn("".concat(t.year).slice(-3),3),def:function(e){return zn("".concat(t.year),e.length)}},"M+":{M:t.month+1,MM:zn("".concat(t.month+1),2),MMM:e.locale_months_abbr[t.month],def:e.locale_months[t.month]},"W+|w+":{W:t.day,WW:zn("".concat(t.day),2),WWW:e.locale_days_abbr[t.day],def:e.locale_days[t.day]},"D+|d+":{D:t.date,def:function(e){return zn("".concat(t.date),e.length)}},"h+|H+":{h:t.h,def:function(e){return zn("".concat(t.h),e.length)}},"m+":{m:t.m,def:function(e){return zn("".concat(t.m),e.length)}},"s+|S+":{s:t.s,def:function(e){return zn("".concat(t.s),e.length)}},"f+|F+":{def:function(e){var n="".concat(t.f),r=e.length-n.length;if(r>0)for(var o=0;o<r;o++)n+="0";else r<0&&(n=n.slice(0,e.length));return n}},"t{1,2}|T{1,2}":{def:function(e){var n=t.t;return e[0].toUpperCase()===e[0]&&(n=n.toUpperCase()),n.slice(0,e.length)}}}}(this,n),c=[];for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&c.push(s);var f=new RegExp(c.join("|"),"g");return t.replace(f,(function(e){var t,n,r;for(n in l)if(Object.prototype.hasOwnProperty.call(l,n)&&(t=new RegExp(n)).test(e))break;if(!t)return"";for(var o in l[n])if(o===e||o.toLowerCase()===e){void 0===(r=l[n][o])&&(r=l[n][o.toLowerCase()]);break}return void 0===r&&(r=l[n].def),"function"==typeof r&&(r=r(e)),r}))}}]),e}();function Kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return It(Un,t)}function Wn(e){return new Date(Date.UTC(1899,11,30+Math.floor(e),0,0,0,Math.round(864e5*(e-Math.floor(e)))))}function $n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=Kn(n,e,t),o=Ln(r.format.bind(r),{toKey:function(e){return"object"===gt(e)&&"function"==typeof e.getTime?e.getTime():e}});function i(e){return"IV"!==t?Wn(e):e}function a(e){return e=i(e),o(e)}return a.format=function(e,t){return o.clear(),t=i(t),r.format(t,e)},a.locale=function(n){return r=Kn(n,e,t),o=Ln(r.format.bind(r),{toKey:function(e){return"object"===gt(e)?e.getTime():e}}),this},a.qtype=function(e){return void 0!==e&&(t=e,o.clear()),t},a}function Yn(e,t){if(e&&e.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(e.qNumFormat.qType))return $n(e.qNumFormat.qFmt,e.qNumFormat.qType,t);var n="#",r=t&&void 0!==t.qThousandSep?t.qThousandSep:",",o=t&&void 0!==t.qDecimalSep?t.qDecimalSep:".",i="U",a=e&&!!e.qIsAutoFormat;return e&&e.qNumFormat?(n=e.qNumFormat.qFmt||n,r=e.qNumFormat.qThou||r,o=e.qNumFormat.qDec||o,i=e.qNumFormat.qType||i,a=a&&-1===["M"].indexOf(e.qNumFormat.qType)):a=!0,(a||"U"===i)&&(n="#".concat(o,"##A"),i="U"),Rn(n,r,o,i,t)}function Gn(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.meta,r=t.id,o=t.key,i=t.localeInfo,a=t.fieldExtractor,u=t.value,l=t.type,c=t.sourceField,s=u||("dimension"===l?function(e){return e.qElemNo}:function(e){return e.qValue}),f=function(e){return e.qText||""},d="dimension"===l?"first":"avg",p=Yn(n,i),h="dimension"===l?"first":function(e,t){return p(t)},m={id:function(){return r},key:function(){return o},raw:function(){return n},title:function(){return n.qFallbackTitle||n.label},type:function(){return l},origin:function(){return c},items:function(){return e||(e=a(m)),e},min:function(){return n.qMin},max:function(){return n.qMax},value:s,label:f,reduce:d,reduceLabel:h,formatter:function(){return p},tags:function(){return n.qTags}};return m}function Zn(e,t,n,r,o){return(t[e]||[]).map((function(t,i){var a="".concat(r?"".concat(r,"/"):"").concat(e,"/").concat(i),u={instance:Gn(Ft({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:t},o))};return u.attrDims=Zn("qAttrDimInfo",t,n,a,Ft({},o,{value:function(e){return e.qElemNo},type:"dimension"})),u.attrExps=Zn("qAttrExprInfo",t,n,a,Ft({},o,{value:function(e){return e.qNum},type:"measure"})),u.measures=Zn("qMeasureInfo",t,n,a,Ft({},o,{value:function(e){return e.qValue},type:"measure"})),u}))}function Jn(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.key,i=r.data,a=r.config,u=void 0===a?{}:a,l={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},c=i;if(!c)throw new Error('Missing "data" input');if(!c.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');var s=Jn.util,f={cache:l,cube:c,localeInfo:u.localeInfo,fieldExtractor:null,pages:null,hierarchy:function(){return null},virtualFields:u.virtualFields},d={key:function(){return o},raw:function(){return c},field:function(e){return rn(e,f)},fields:function(){return l.fields.slice()},extract:function(e){return f.extractor(e,d,l,s)},hierarchy:function(e){return f.hierarchy(e,d,l,s)},_cache:function(){return l}};"K"===c.qMode||"T"===c.qMode||!c.qMode&&c.qNodesOnDim?(f.extractor=yn,f.hierarchy=gn,f.pages="K"===c.qMode?c.qStackedDataPages:c.qTreeDataPages):"S"===c.qMode?(f.extractor=zt,f.pages=c.qDataPages,f.hierarchy=gn):f.extractor=function(){return[]},f.fieldExtractor=function(e){return f.extractor({field:e},d,l,s)};var p="S"===c.qMode?function(e){return e.qElemNumber}:void 0,h="S"===c.qMode?function(e){return e.qNum}:void 0;(e=l.wrappedFields).push.apply(e,St(Zn("qDimensionInfo",c,o,"",Ft({},f,{value:p,type:"dimension"})))),(t=l.wrappedFields).push.apply(t,St(Zn("qMeasureInfo",c,o,"",Ft({},f,{value:h,type:"measure"})))),l.fields=l.wrappedFields.map((function(e){return e.instance}));var m=function e(t){t.forEach((function(t){l.allFields.push(t.instance),e(t.measures),e(t.attrDims),e(t.attrExps)}))};return m(l.wrappedFields),(u.virtualFields||[]).forEach((function(e){var t=d.field(e.from),n=Gn(wt({meta:t.raw(),id:"".concat(o,"/").concat(e.key),sourceField:t,fieldExtractor:function(e){return f.extractor({field:e},d,l,s)},key:e.key,type:t.type(),localeInfo:f.localeInfo,value:t.value},e.override||{}));l.virtualFields.push(n)})),(n=l.allFields).push.apply(n,St(l.virtualFields)),d}var Qn=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],Xn=/\/qDimensionInfo(?:\/(\d+))?/,er=/\/qMeasureInfo\/(\d+)/,tr=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,nr=/\/qAttrExprInfo\/(\d+)/,rr=/\/?qHyperCube/,or=/\/?qTreeData/,ir=function(e){return"".concat(e.substr(0,e.indexOf("/qHyperCubeDef")+14))},ar=function(e){return"".concat(e.substr(0,e.indexOf("/qTreeDataDef")+13))};function ur(e,t){var n=e,r=-1,o=-1,i="",a=function(e){return e};rr.test(e)?(i="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=ir):or.test(e)&&(i="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=ar);var u=!0;if(Xn.test(e)&&(r=+Xn.exec(e)[1]),er.test(e)&&(o=+er.exec(e)[1]),tr.test(e)){o=-1,r=0;var l=+tr.exec(n)[2];isNaN(l)||(r=l,n=n.replace(/\/\d+$/,"")),u=!1}if(nr.test(e)){var c=o;if(t){o=0;var s=en(i,t);o+=(s.qMeasureInfo||[]).length,r>-1?(o=s.qDimensionInfo.slice(0,r).reduce((function(e,t){return e+t.qAttrExprInfo.length}),o),r=-1):(o=s.qDimensionInfo.reduce((function(e,t){return e+t.qAttrExprInfo.length}),o),o=s.qMeasureInfo.slice(0,c).reduce((function(e,t){return e+t.qAttrExprInfo.length}),o)),o+=+nr.exec(n)[1]}else r>-1?(r=-1,o=+nr.exec(n)[1]):o+=+nr.exec(n)[1]+1}return Qn.forEach((function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(e,t)||kt(e,t)||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.")}()}(e,2),r=t[0],o=t[1];n=n.replace(r,o)})),u&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:o,dimensionIdx:r,path:n}}function lr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=n.byCells,i=n.primarySource,a=[],u={},l=e.isActive(),c=!1;return e.brushes().forEach((function(e){var t=ur(e.id,r);if("range"===e.type&&t.measureIdx>-1&&t.dimensionIdx>-1){var n=e.brush.ranges();n.length&&(c=!0,u.multiRangeSelectTreeDataValues||(u.multiRangeSelectTreeDataValues={path:t.path,ranges:[]}),n.forEach((function(e){return u.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:t.measureIdx,qDimensionIx:t.dimensionIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}else{if("range"===e.type&&t.measureIdx>-1){var l=e.brush.ranges();l.length&&(c=!0,u.rangeSelectHyperCubeValues||(u.rangeSelectHyperCubeValues={path:t.path,ranges:[]}),l.forEach((function(e){return u.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:t.measureIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}if("range"===e.type&&t.dimensionIdx>-1){var s=e.brush.ranges();s.length&&(c=!0,u.selectHyperCubeContinuousRange||(u.selectHyperCubeContinuousRange={path:t.path,ranges:[]}),s.forEach((function(e){return u.selectHyperCubeContinuousRange.ranges.push({qDimIx:t.dimensionIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!1}})})))}if("value"===e.type&&t.dimensionIdx>-1)if(o)if(r&&r.qHyperCube&&("P"===r.qHyperCube.qMode||"T"===r.qHyperCube.qMode||"K"===r.qHyperCube.qMode)){var f=r.qHyperCube,d=f.qNoOfLeftDims,p=f.qEffectiveInterColumnSortOrder.indexOf(t.dimensionIdx);if(u.selectPivotCells||(u.selectPivotCells={path:t.path,cells:[]}),e.id===i||!i){var h=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)}));(0===d||p>=d)&&d>-1?h.forEach((function(e){u.selectPivotCells.cells.push({qType:"T",qCol:e,qRow:p-d})})):h.forEach((function(e){u.selectPivotCells.cells.push({qType:"L",qCol:t.dimensionIdx,qRow:e})})),c=!!u.selectPivotCells.cells.length}}else u.selectHyperCubeCells||(u.selectHyperCubeCells={path:t.path,cols:[]}),u.selectHyperCubeCells.cols.push(t.dimensionIdx),e.id!==i&&(i||u.selectHyperCubeCells.values)||(u.selectHyperCubeCells.values=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)})),c=!!u.selectHyperCubeCells.values.length);else{var m=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)}));c=!!m.length,a.push({params:[t.path,t.dimensionIdx,m,!1],method:"selectHyperCubeValues"})}}})),!c&&l?[{method:"resetMadeSelections",params:[]}]:(u.rangeSelectHyperCubeValues&&a.push({method:"rangeSelectHyperCubeValues",params:[u.rangeSelectHyperCubeValues.path,u.rangeSelectHyperCubeValues.ranges,[],null===(t=n.orMode)||void 0===t||t]}),u.selectHyperCubeContinuousRange&&a.push({method:"selectHyperCubeContinuousRange",params:[u.selectHyperCubeContinuousRange.path,u.selectHyperCubeContinuousRange.ranges]}),u.selectHyperCubeCells&&a.push({method:"selectHyperCubeCells",params:[u.selectHyperCubeCells.path,u.selectHyperCubeCells.values,u.selectHyperCubeCells.cols]}),u.selectPivotCells&&a.push({method:"selectPivotCells",params:[u.selectPivotCells.path,u.selectPivotCells.cells]}),u.multiRangeSelectTreeDataValues&&a.push({method:"multiRangeSelectTreeDataValues",params:[u.multiRangeSelectTreeDataValues.path,u.multiRangeSelectTreeDataValues.ranges]}),a)}function cr(e){Jn.util=e.data("matrix").util,e.data("q",Jn),e.formatter("q-number",Rn),e.formatter("q-time",$n)}function sr(e){var t=function(e,t,n){if(void 0===e||void 0===t)return n;for(var r=t.split("."),o=e,i=0;i<r.length;++i){var a=r[i];if(void 0===o[a])return n;o=o[a]}return o}(e.layout||{},e.path.split("/").join("."));if(!t)return!1;var n=t.qIsOneAndOnlyOne;return void 0!==n&&n}function fr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)return!1;var t=e.filter((function(e){return"object"===L(e.data)&&Array.isArray(e.data.fields)})).every((function(e){return e.data.fields.every((function(e){var t=e.raw();return!(!t.qLocked&&t.qCardinal)}))}));return t}function dr(e){var t=e.brush,n=e.colorField,r=e.legendAlias,o=e.useLegendCube,i=void 0!==o&&o;!n||/qAttrDimInfo/.test(n)?(t.removeKeyAlias("attrDim/qDimensionInfo/0"),r&&t.removeKeyAlias(r),t.addKeyAlias("attrDim/qDimensionInfo/0","qHyperCube/".concat(n))):i&&t.addKeyAlias(r,"qHyperCube/".concat(n))}cr.qBrushHelper=lr,cr.selections=lr;function pr(e){var t=e.brush,n=e.getConfig;return{interceptor:function(e){var r=t.brushes(),o=n(),i=o.allowSimultaneous,a=o.layout,u=void 0===a?{}:a;r.forEach((function(n){var r,o,a;("range"===n.type||null!==(r=e[0])&&void 0!==r&&r.key&&(null===(o=e[0])||void 0===o?void 0:o.key)!==n.id&&0!==i.indexOf(null===(a=e[0])||void 0===a?void 0:a.key))&&t.clear([])}));var l=e.filter((function(e){return-2!==e.value}));return l.length>1?function(e){var t=e.layout,n=void 0===t?{}:t,r=e.values,o=void 0===r?[]:r;if(null==o||!o.length)return[];var i=Array.from(new Set(o.map((function(e){return e.key})))),a=[];return i.forEach((function(e){var t=sr({layout:n,path:e}),r=o.filter((function(t){return t.key===e})),i=t?[r.pop()]:r;a.push.apply(a,U(i))})),a.filter(Boolean)}({layout:u,values:l}):l},rangeInterceptor:function(e){var r=t.brushes(),o=n().allowSimultaneous;return r.filter((function(e){return"value"===e.type})).length?(t.clear([]),e):(r.forEach((function(n){var r=n.id===e[0].key||o.includes(n.id)&&o.includes(e[0].key);"range"!==n.type||r||t.clear([])})),e)}}}var hr=[],mr=0,vr=function(e){var t=hr.filter((function(e){var t;return null===(t=e.selections)||void 0===t?void 0:t.isActive()}));t.length&&("Enter"===e.key?t.forEach((function(e){return e.selections.confirm()})):"Escape"!==e.key&&"Esc"!==e.key||t.forEach((function(e){return e.selections.cancel()})))},gr=function(){document.addEventListener("keyup",vr)},yr=function(){document.removeEventListener("keyup",vr)},br=function(e,t){Object.keys(t).forEach((function(n){e.on(n,t[n])}))},xr=function(e,t){Object.keys(t).forEach((function(n){e.removeListener(n,t[n])}))};function qr(e,t,n){if(t&&void 0!==n&&"selectHyperCubeContinuousRange"===e.method){var r=e.params;if(r&&r[1]&&r[1][0]){var o=r[1][0],i=o.qDimIx,a=o.qRange;"undefined"!==i&&a&&!1===a.qMaxInclEq&&a.qMax>=n&&(a.qMaxInclEq=!0)}}}function Dr(e){var t=e.chart,n=e.document,r=e.selectionInfo,o=e.eventName,i=e.componentName,a=e.brushName,u=void 0===a?"selection":a,l=e.emit,c=void 0===l?"rangeClear":l,s=r.event===o,f=n.querySelector("[data-key='".concat(i,"-edge-0']"));if(s||!f)return!1;var d=t.component(i);return!!d&&(d.emit(c),"string"==typeof u&&t.brush(u).clear(),d)}function wr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.eventName,i=void 0===o?"discreteRange":o,a=e.componentName,u=void 0===a?"discrete-range-brush":a,l=e.cleared;return Dr({selectionInfo:t,chart:n,document:r,eventName:void 0!==l&&l?void 0:i,componentName:u,emit:"areaClear",brushName:e.brushName})}function Cr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.eventName,i=void 0===o?"continuousRange":o,a=e.componentName,u=void 0===a?"continuous-range-brush":a,l=e.cleared;return Dr({selectionInfo:t,chart:n,document:r,eventName:void 0!==l&&l?void 0:i,componentName:u,brushName:e.brushName})}function Mr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.componentName,i=void 0===o?"minor-range-brush":o,a=e.eventName,u=void 0===a?"minorRange":a,l=e.cleared,c=void 0!==l&&l,s=e.brushName,f=Dr({selectionInfo:t,chart:n,document:r,eventName:c?void 0:u,componentName:i,brushName:void 0!==s&&s});if(f){var d=f.settings.settings,p=d.scale,h=d.brush,m=n.scale(p).data().fields.map((function(e){return e.id()})),v=n.brush(h),g=v.brushes().filter((function(e){return"range"===e.type&&m.some((function(t){return t===e.id}))}));v&&g.length&&g.forEach((function(e){v.removeRanges(e.brush.ranges().map((function(t){return{key:e.id,range:t}})))}))}}function Ir(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.selections,i=e.eventName,a=void 0===i?"xAxis":i,u=e.cleared;Dr({selectionInfo:t,chart:n,document:r,eventName:void 0!==u&&u?void 0:a,componentName:"".concat(a,"-range-brush"),emit:"areaClear",brushName:!1})&&o.clear()}function Sr(e){var t=e.chart,n=e.selectionInfo,r=e.selections,o=e.events,i=void 0===o?["tap"]:o,a=e.brushNames,u=void 0===a?[]:a;if(n&&i.includes(n.event)){var l=n.currentComponent;n.previousComponent!==l&&(r.clear(),u.forEach((function(e){return t.brush(e).end()})))}}function kr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.selections,i=e.eventName,a=void 0===i?"legendRange":i,u=e.componentName,l=void 0===u?"legend-range-brush":u,c=e.cleared,s=void 0!==c&&c,f=e.brushName;Dr({selectionInfo:t,chart:n,document:r,eventName:s?void 0:a,componentName:l,brushName:void 0!==f&&f})&&o.clear()}var Or=function(e){e.chart,e.document,e.selections,e.selectionInfo;var t=z(e,["chart","document","selections","selectionInfo"]);t.clearDiscrete(),t.clearContinuous(),t.clearMinor(),t.clearRange(),t.clearTap(),t.clearLegend()};function Ar(e){var t,n=e.lasso;null!=n&&null!==(t=n.active)&&void 0!==t&&t.call(n)&&(null==n||n.action(!1))}function Er(e){var t,n=e.chart,r=e.selectionInfo,o=e.selectionActions,i=e.actions,a=void 0===i?{}:i,u=e.selections,l=e.selectionEvents;if(!1===o||!1===l)return function(){};var c=(a||{}).lasso,s=void 0!==c&&c,f=o.reset,d=void 0===f?Ar:f,p=o.clear,h=!1!==p&&function(e){var t=e.clear,n=void 0===t?Or:t,r=e.selections,o=e.selectionInfo,i=e.chart;return function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cleared,t={selections:r,selectionInfo:o,chart:i,document:document,cleared:e};return n(_({clearDiscrete:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return wr(_(_({},t),e))},clearContinuous:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Cr(_(_({},t),e))},clearMinor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Mr(_(_({},t),e))},clearRange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ir(_(_({},t),e))},clearTap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Sr(_(_({},t),e))},clearLegend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return kr(_(_({},t),e))}},t))}}({clear:p,selections:u,selectionInfo:r,chart:n}),m=function(e){var t=e.chart,n=e.lasso,r=e.reset,o=e.clear,i=!1,a={deactivated:function(e){r({e:e,lasso:n})},canceled:function(e){r({e:e,lasso:n}),o({e:e,chart:t,document:document})},cleared:function(e){i||(i=!0,o({e:e,chart:t,document:document,cleared:!0}),i=!1)}};return!1===r&&delete a.deactivated,!1===o&&delete a.cleared,!1===r&&!1===o&&delete a.canceled,a}({chart:n,clear:h,reset:d,lasso:s}),v={};Object.entries(m).forEach((function(e){var t=B(e,2),n=t[0],r=t[1];v[n]=function(e,t){return t?function(n){return t({event:n,defaultFunc:e})}:e}(r,l[n])}));var g=function(e){var t=e.selectionEvents,n=e.selections,r=e.selectionInfo,o=e.clear,i=e.chart,a=e.document,u=t.start,l={selections:n,selectionInfo:r,chart:i,document:a},c=function(e){return Object.assign(r,e||{})},s=function(e){var t=e.event,n=e.components;return function(){return function(e){var t=e.selectionInfo,n=e.clear,r=e.event,o=e.components,i=void 0===o?[]:o;(0,e.setSelectionInfo)(_(_({},void 0===t?{}:t),{},{event:r,components:i.map((function(e){return e.key})).filter(Boolean)})),n()}({event:t,components:n,clear:o,chart:i,selectionInfo:r,setSelectionInfo:c})}};return"function"==typeof u?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];u(_(_({defaultFunc:s({event:e,components:t}),setSelectionInfo:c,clear:o},l),{},{event:e,components:t}))}:function(e){s({event:e,components:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})()}}({selectionEvents:l,selections:u,selectionInfo:r,clear:h,chart:n,document:document});return null==a||null===(t=a.select)||void 0===t||t.on("start",g),Object.entries(v).forEach((function(e){var t=B(e,2),n=t[0],r=t[1];null==u||u.on(n,r)})),function(){var e;null==a||null===(e=a.select)||void 0===e||e.removeListener("start",g),Object.entries(v).forEach((function(e){var t=B(e,2),n=t[0],r=t[1];null==u||u.removeListener(n,r)}))}}var Nr=[{key:"qHyperCube/qDimensionInfo/0:numeric",includeMax:!1}];function Pr(e){var t=e.chart,n=e.actions,r=e.selections,o=e.picassoQ,i=e.config,a=i.allowSimultaneous,u=void 0!==a&&a,l=i.majorScale,c=void 0===l?void 0:l,s=i.selectionActions,f=(s=void 0===s?{}:s).clear,d=s.reset,p=i.selectionEvents,h=void 0===p?{deactivated:void 0,canceled:void 0,cleared:void 0,start:void 0}:p,m=i.brushEvents,v=void 0===m?{}:m,g=i.brushName,y=void 0===g?"selection":g,b=i.brushMaxListeners,x=void 0===b?20:b,q=i.brushRanges,D=void 0!==q&&q,w=i.interceptors,C=void 0===w?{}:w,M=i.selectionsFn,I=void 0===M?o.selections:M,S=t.brush(y);if("number"==typeof x&&S.setMaxListeners(x),D){var k=!0===D?Nr:D;S.configure({ranges:k})}var O={canSelect:!0,getIsSelectionLocked:!1,isInnerDimensionLocked:!1,lockedDimensions:[],singleSelectIndex:0,singleSelectDims:[],selectionInfo:{colorField:void 0,components:[],event:void 0,currentComponent:void 0,previousComponent:void 0}},A=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.selections,r=t.brush,o=t.majorScale,i=t.actions,a=t.selectionsFn,u=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).path,l=void 0===u?"/qHyperCubeDef":u;if(!n)return{layout:function(){},allowSimultaneous:function(){},release:function(){}};var c=++mr,s=null,f=[],d={};n.on=n.on.bind(n),n.isActive=n.isActive.bind(n),n.addListener=n.addListener.bind(n),n.removeListener=n.removeListener.bind(n);var p=pr({brush:r,getConfig:function(){return{layout:s,allowSimultaneous:f}}}),h=p.rangeInterceptor,m=p.interceptor;r.intercept("set-ranges",h),r.intercept("toggle-ranges",h),r.intercept("toggle-values",m),r.intercept("set-values",m),r.intercept("add-values",m),r.on("start",(function(){return n.begin(l)}));var v={activate:function(){},deactivated:function(){return r.end()},cleared:function(){return r.clear()},canceled:function(){return r.end()}};br(n,v);var g=null==o||null===(e=o.max)||void 0===e?void 0:e.call(o);return null!=i&&i.select?(i.select.on("start",(function(){var e;r.start(),"function"==typeof i.select.getBrushOptions&&(d=(e=i.select).getBrushOptions.apply(e,arguments))})),i.select.on("end",(function(){a(r,d,s).forEach((function(e){qr(e,i.select.brushSelectionIncludeMax,g),n.select(e)}))}))):r.on("update",(function(){a(r,d,s).forEach((function(e){return n.select(e)}))})),0===hr.length&&gr(),hr.push({key:c,selections:n}),{layout:function(e){s=e},allowSimultaneous:function(e){f=e},release:function(){s=null;var e=hr.indexOf(hr.filter((function(e){return e.key===c}))[0]);-1!==e&&hr.splice(e,1),hr.length||yr(),xr(n,v)}}}({brush:S,majorScale:c,actions:n,selections:r,picassoQ:o,selectionsFn:I});!function(e){var t=e.brush,n=e.interceptors,r=void 0===n?{}:n;Object.entries(r).forEach((function(e){var n=B(e,2),r=n[0],o=n[1];(Array.isArray(o)?o:[o]).forEach((function(e){t.intercept(r,e)}))}))}({brush:S,interceptors:C});var E=function(e){var t=e.chart,n=e.selectionActions,r=e.brush,o=e.actions,i=e.selectionInfo,a=e.selections,u=e.selectionEvents,l=function(e){var t=e.brush,n=e.chart,r=e.selectionInfo,o=e.brushEvents,i=void 0===o?{}:o,a=Object.entries(i).map((function(e){var o=B(e,2),i=o[0],a=o[1],u=function(){return a({chart:n,selectionInfo:r})};return t.on(i,u),[i,u]}));return function(){a.forEach((function(e){var n=B(e,2),r=n[0],o=n[1];t.removeListener(r,o)}))}}({brush:r,chart:t,selectionInfo:i,brushEvents:e.brushEvents}),c=Er({chart:t,selectionInfo:i,selectionActions:n,actions:o,selections:a,selectionEvents:u}),s=function(e){var t=e.actions;if(null==t||!t.lasso)return function(){};var n=!1,r=function(e){n||"Shift"!==e.key||(t.lasso.action(!0),n=!0)},o=function(e){"Shift"===e.key&&(t.lasso.action(!1),n=!1)};return document.addEventListener("keydown",r),document.addEventListener("keyup",o),function(){document.removeEventListener("keydown",r),document.removeEventListener("keyup",o)}}({actions:o});return function(){l(),c(),s()}}({chart:t,brush:S,actions:n,selections:r,selectionInfo:O.selectionInfo,selectionActions:{clear:f,reset:d},selectionEvents:h,brushEvents:v});if(u){var N=!0===u?U(Array(15)).map((function(e,t){return"qHyperCube/qMeasureInfo/".concat(t)})):u;A.allowSimultaneous(N)}return{unbindEvents:E,state:O,picassoSelections:A,brush:S}}function jr(e){var t=e.chart,n=e.selections,r=e.actions,o=void 0!==r&&r,i=e.config,a=void 0===i?{}:i,u=Pr({chart:t,actions:o,selections:n,picassoQ:cr,config:a}),l=u.unbindEvents,c=u.state,s=u.picassoSelections,f=u.brush,d=a.custom,p=void 0===d?{}:d,h=a.legendAlias,m=void 0===h?void 0:h,v=a.setBrushAliases,g=void 0===v?dr:v;return{getIsDimensionLocked:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return c.lockedDimensions[e]},getIsSelectionLocked:function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return null!==(e=null==n||null===(t=n.isLocked)||void 0===t?void 0:t.call(n))&&void 0!==e?e:fr(r)},getIsSingleSelect:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.singleSelectIndex;return c.singleSelectDimensions[e]},getCanSelect:function(){return c.canSelect},getSelectionInfo:function(){return c.selectionInfo},setLayout:function(e){var t=function(e){var t,n,r,o=e.selections,i=e.picassoSelections,a=e.layout,u={lockedDimensions:[],singleSelectDimensions:[]};null!=o&&null!==(t=o.isModal)&&void 0!==t&&t.call(o)&&o.confirm(),i.layout(a);var l=(null!==(n=null==a?void 0:a.qHyperCube)&&void 0!==n?n:{}).qDimensionInfo,c=void 0===l?[]:l;return u.lockedDimensions=c.map((function(e){return!!e.qLocked})),u.singleSelectDimensions=c.map((function(e,t){return sr({layout:a,path:"qHyperCube/qDimensionInfo/".concat(t)})})),u.singleSelectIndex=function(e){var t,n=((null==e?void 0:e.qHyperCube)||{}).qDimensionInfo,r=void 0===n?[]:n;return null!==(t=r.map((function(e,t){var n;return!(e.qLocked||(null===(n=e.qCardinalities)||void 0===n?void 0:n.qHypercubeCardinal)<=1)&&t})).filter((function(e){return"number"==typeof e}))[0])&&void 0!==t?t:Math.max(r.length-1,0)}(a),u.canSelect=0===c.length||c.some((function(e){return!e.qLocked})),u.dimensionLocked=!(null===(r=c[0])||void 0===r||!r.qLocked),u}({selections:n,picassoSelections:s,layout:e});Object.assign(c,t)},setBrushAliases:function(e){var t=e.colorField,n=e.useLegendCube,r=void 0!==n&&n,o=z(e,["colorField","useLegendCube"]),i=_({useLegendCube:r,colorField:t,brush:f,legendAlias:m},o);g(_(_({},i),{},{defaultFunc:function(){return dr(i)}}))},destroy:function(){l(),s.release()},custom:_({},p)}}function Tr(e){var t=e.node.desc&&e.node.desc.share;return t?e.formatter("share")(t):""}function Lr(e){return e.formatter("num")(e.node.data.num.value)}function Rr(e){var t=e.data;return t?t.label:""}function Fr(e){if(e.dataPoint.auto)return Tr;switch(e.dataPoint.labelMode){case"share":return Tr;case"value":return Lr;case"none":return null;default:return Tr}}function Hr(e,t){var n=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return{component:"fun",selector:n,strategy:{type:"rows",settings:{align:r,fill:".labelCenter"===n?function(e){var n=e.node;return t.getContrastingColorTo(n.desc.fill)}:t.getStyle("","","color"),labels:".labelCenter"===n?[{label:Fr(e)}]:[{label:Rr}]}}}};return{key:"funnel-labels",type:"labels",layout:{displayOrder:2},settings:{sources:[n(".labelLeft",0),n(".labelCenter",.5)]}}}function Vr(e){if(!e.showDimensionTitle||!e.qHyperCube.qDimensionInfo[0].qFallbackTitle)return!1;return{key:"dimension-title",type:"text",text:e.qHyperCube.qDimensionInfo[0].qFallbackTitle,layout:{dock:"top"}}}function _r(e){var t=e.layout,n=e.constraints,r=e.colorService,o=e.theme,i=e.pluginService,a=function(e){return b({},e.getScales())}(r),u=r.getPalettes(),l=[function(e){var t=e.layout,n=e.constraints,r=e.colorService,o=r.getDatumProps(),i=r.getColor();return{type:"funnel",key:"fun",data:{extract:{field:"qDimensionInfo/0",props:b({num:{field:"qMeasureInfo/0"}},o)}},brush:n.select||n.active?{}:{trigger:[{contexts:["selection"],data:[""]}],consume:[{context:"selection",filter:function(e){return"section"===e.tag},style:{inactive:{opacity:.3}}}]},settings:{num:{ref:"num"},fill:i,mode:t.funnel.mode}}}({layout:t,constraints:n,colorService:r}),Hr(t,o),Vr(t)];return{palettes:u,style:{"$font-family":o.getStyle("","","fontFamily"),"$font-color":o.getStyle("","","color"),"$font-size":o.getStyle("","","fontSize")},scales:a,components:i.extendComponents(l),formatters:{share:{type:"d3-number",format:".1%"},num:{data:{field:"qMeasureInfo/0"}}}}}function zr(e){var t=e.picasso,s=n(),f=r(),d=o(),p=i(),h=a(),m=u(),v=D(l(),2),g=v[0],y=v[1],b=D(l(),2),x=b[0],q=b[1],w=D(l(),2),C=w[0],M=w[1];return c((function(){var e=function(e){var t,n,r,o,i=e.picasso,a=e.model,u=e.app,l=e.translator,c=e.layoutService,s=void 0===c?void 0:c,f=e.createConfig,d=void 0===f?mt:f,p=e.config,h=void 0===p?{}:p,m=e.custom,v=void 0===m?{}:m,g=h.localeInfo,y=h.key,b=h.theme,x=void 0===b?void 0:b,q=h.auto,D=void 0===q?void 0:q,w=h.definitionPath,C=null==s||null===(t=s.getLayout)||void 0===t?void 0:t.call(s),M={theme:x,key:y,localeInfo:g,layout:C,hc:null==s||null===(n=s.getHyperCube)||void 0===n?void 0:n.call(s),legendProps:null==s||null===(r=s.getLayoutValue)||void 0===r?void 0:r.call(s,"legend"),colorProps:_(_({},null==s||null===(o=s.getLayoutValue)||void 0===o?void 0:o.call(s,"color")),{},{useBaseColors:C?ft(C):void 0})},I=ct({picasso:i,model:a,app:u,translator:l,auto:D});!1!==D&&I.auto((function(e){return D?D({layout:e,defaultAuto:ht}):ht(e)}));var S=!1;return{getColor:function(){return I.color()},getPaletteColor:function(e){var t=e.index,n=e.color;return I.resolveUIColor({index:t,color:n})},getData:function(){return I.data()},getDatumProps:function(e){return I.datumProps(e)},getSnapshotData:function(){return I.getSnapshotData(w)},getSettingsForMeasure:function(e){return I.settingsForMeasure(e)},getSettings:function(){return I.settings()},getLegend:function(e,t){return I.legend(e,t)},getScales:function(){return I.scales()},getPalettes:function(){return I.palettes()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return I.isSelectionLocked({isMeasureSelectionLocked:t})},isInitialized:function(){return S},custom:_({},v),initialize:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,t=(void 0===e?d:e)({getUseBaseColors:ft}),n=dt(M,t);return I.config(n),I.getAuxiliarySettings(w).then((function(){S=!0}))}}}({picasso:t,model:d,app:p,translator:h,config:{auto:!1,key:"fill"}});s.style.overflow="hidden";var n=t({renderer:{prio:[m.renderer||"svg"]}}).chart({element:s,data:[],settings:{}}),r=jr({chart:n,selections:f,config:{selectionActions:!1}});return M(r),q(e),y(n),function(){r.destroy(),n.destroy()}}),[]),[g,x,C]}function Br(e){var t=e.picasso,n=s(),r=f(),o=d(),i=p(),a=h(),u=m().qLocaleInfo,l=D(zr({picasso:t,layout:n}),3),y=l[0],x=l[1],q=l[2],C=D(v((function(){if(!x)return Promise.resolve();var e=function(e){return{layout:e,keys:{SCALE:{FILL:"fill"},COMPONENT:{FUNNEL:"fun",FUNNEL_LABELS:"funnel-labels",DIMENSION_TITLE:"dimension-title"}}}}(n),o=function(e){var t=e.picassoInstance,n=e.plugins,r=e.pluginArgs,o=void 0===r?{}:r,i={initialized:!1,definitions:[]};return{initialize:function(){return F(regeneratorRuntime.mark((function e(){var r,a,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.initialized){e.next=2;break}return e.abrupt("return");case 2:return a=Promise.all(n.filter((function(e){return"custom-component"===e.info.type})).map(function(){var e=F(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.info.componentName){e.next=2;break}throw new Error("plugin-service: Custom component is missing componentName");case 2:return e.next=4,n.fn(_({},o));case 4:if("object"===L(r=e.sent)){e.next=7;break}throw new Error("plugin-service: Custom component needs to be an object");case 7:t.component(n.info.componentName,r);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),u=Promise.all(n.filter((function(e){return"component-definition"===e.info.type})).map((function(e){return e.fn(_({},o))}))),e.next=6,Promise.all([a,u]);case 6:l=e.sent,i.initialized=!0,(r=i.definitions).push.apply(r,U(l[1]));case 9:case"end":return e.stop()}}),e)})))()},extendComponents:function(e){return i.initialized?(i.definitions.filter(Boolean).forEach((function(t){var n=B(e.filter((function(e){return e.key&&e.key===t.key})),1)[0];if(n){var r=te(!0,{},n.brush);te(!0,n,t),t.brush&&(n.brush=function(e,t){return"object"===L(e)&&Object.keys(e).length?(Array.isArray(t.consume)&&(e.consume=vt({originalArray:e.consume,newArray:t.consume,matchKey:"context"})),Array.isArray(t.trigger)&&(e.trigger=vt({originalArray:e.trigger,newArray:t.trigger,matchKey:"on"})),e):t}(r,t.brush))}else e.push(t)})),e):e}}}({picassoInstance:t,plugins:a,pluginArgs:e});return Promise.all([x.initialize({createConfig:function(e){var t=e.getUseBaseColors;return{theme:r,colorProps:b(b({},n.color),{},{useBaseColors:t(n)}),layout:n,hc:n.qHyperCube}}}),o.initialize()]).then((function(){return o}))}),[n,x]),1)[0];c((function(){if(y&&x&&C){var e=[{type:"q",key:"qHyperCube",data:n.qHyperCube,config:{localeInfo:u}}].concat(w(x.getData())),t=_r({layout:n,constraints:o,colorService:x,theme:r,pluginService:C});y.update({data:e,settings:t})}}),[y,x,r.name(),C,o]),c((function(){y&&y.update()}),[i.width,i.height]),c((function(){q&&q.setLayout(n)}),[n]),g((function(e){return x.getSnapshotData().then((function(t){return e.snapshotData=e.snapshotData||{},e.snapshotData.content=e.snapshotData.content||{},e.snapshotData.content.chartData=t,e})).catch((function(){return e}))}))}function Ur(){var n=e();return n.use(t),n.component("funnel",N),{ext:j,qae:{properties:{initial:P},data:{targets:T}},component:function(){Br({picasso:n})}}}export default Ur;