@nebula.js/sn-funnel-chart 1.4.12 → 1.5.1

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.4.12",
6
+ "version": "1.5.1",
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.4.12",
6
+ "version": "1.5.1",
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.4.12
2
+ * @nebula.js/sn-funnel-chart v1.5.1
3
3
  * Copyright (c) 2022 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 s,useStaleLayout as c,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";const y={fill:"steelblue",num:1},b=(e,t,n)=>{let 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{const e=180/Math.PI*Math.atan((t.bottomRight.y-t.topRight.y)/(t.topRight.x-t.bottomRight.x));r=e<15&&e>=0?t.topRight.x:e>-15&&e<0?t.bottomRight.x:e<-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"}},x=(e,t)=>{const n=(e=>{const t=(e=>{let t=0;return e.forEach((e=>{e.num>t&&(t=e.num)})),t})(e);let n=0;return e.slice().reverse().map((e=>{const r={datum:e,s:n/t,e:e.num/t};return n=e.num,r})).reverse()})(e),r=.9*t.width,o=.9*t.height,i=(t.width-r)/2,a=(t.height-o)/2,u=r-(r>150&&o>150?100:0),l=(o-1*(n.length-1))/n.length,s=[];return n.forEach(((e,r)=>{const o=(c=e.e,f=r<n.length-1?e.s:e.e,[.5-.5*c,.5+.5*c,.5+.5*f,.5-.5*f]).map((e=>Math.round(e*u+i)));var c,f;const d=l*r+1*r+a,p={bottomRight:{x:o[2],y:Math.round(d+l)},bottomLeft:{x:o[3],y:Math.round(d+l)},topRight:{x:o[1],y:Math.round(d)},topLeft:{x:o[0],y:Math.round(d)},width:t.width},h=`M${p.topLeft.x},${p.topLeft.y} L${p.topRight.x},${p.topRight.y} ${p.bottomRight.x},${p.bottomRight.y} ${p.bottomLeft.x},${p.bottomLeft.y}Z`;s.push({tag:"section",type:"path",d:h,data:e.datum.data,fill:e.datum.fill});const m={share:e.e,fill:e.datum.fill,data:e.datum.data};l>12&&(p.bottomRight.x-p.bottomLeft.x>32&&s.push(b("labelCenter",p,m)),s.push(b("labelLeft",p,m)))})),s},q=(e,t,n,r)=>(r-e)/r*(t-n)+n,w=(e,t,n)=>{const r=e.filter((e=>"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),s=i-(i>150&&a>150?100:0),c=a-1*(o-1),f=[],d=r[0].data.num.value;let p=l;return r.forEach(((e,r)=>{const o=t[r]*c,i=Math.round(q(p-l,s,.2*s,a)/2),h=Math.round(q(p-l+o,s,.2*s,a)/2),m=u+Math.round(s/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${v.topLeft.x},${v.topLeft.y} L${v.topRight.x},${v.topRight.y} ${v.bottomRight.x},${v.bottomRight.y} ${v.bottomLeft.x},${v.bottomLeft.y}Z`;f.push({tag:"section",type:"path",d:g,data:e.data,fill:e.fill});const y={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(b("labelCenter",v,y)),f.push(b("labelLeft",v,y))),p+=o+1})),f},D=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0));if(r&&r.length>0)switch(t){case"WIDTH":return x(r,n);case"ORDER":return w(r,r.map((()=>1/r.length)),n);case"HEIGHT":return w(r,(e=>{const t=e.reduce(((e,t)=>e+t.data.num.value),0);return e.map((e=>e.data.num.value/t))})(r),n);case"AREA":return w(r,((e,t,n)=>{const r=e.reduce(((e,t)=>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,s=[];let c=0;for(let t=e.length-1;t>=0;t--){const n=e[t].data.num.value/r,o=2*l*c+a,f=-o/(2*l)+Math.sqrt(o*o/(4*l*l)+n*u/l);s[t]=f/i,c+=f}return s})(r,n,.2),n);default:return x(r,n)}return[]};var M={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:e}){const t=this.resolver.resolve({data:e,defaults:{...y,...this.style.item},settings:this.settings.settings});return D(t.items,this.settings.settings.mode,this.rect)}};const C={version:"1.4.12",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:""};var I={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 title",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:e=>!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};const k=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:()=>"Segments"},measures:{min:1,max:1,description(e){switch(e.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added(e,t){2===t.qHyperCubeDef.qInterColumnSortOrder.length&&1!==t.qHyperCubeDef.qInterColumnSortOrder[0]&&(t.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function S(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 A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){L(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(){O=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var o=t&&t.prototype instanceof f?t:f,i=Object.create(o.prototype),a=new D(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=x(a,n);if(u){if(u===c)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,a),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function f(){}function d(){}function p(){}var h={};u(h,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(M([])));v&&v!==t&&n.call(v,o)&&(h=v);var g=p.prototype=f.prototype=Object.create(h);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(o,i,a,u){var l=s(e[o],e,i);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,u)}))}u(l.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=s(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function M(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=p,u(g,"constructor",p),u(p,"constructor",d),d.displayName=u(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},y(b.prototype),u(b.prototype,i,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new b(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},y(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=M,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(u&&l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;w(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function E(e){return(E="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 N(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 P(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){N(i,r,o,a,u,"next",e)}function u(e){N(i,r,o,a,u,"throw",e)}a(void 0)}))}}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(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 j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){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)||R(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 F(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||R(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 R(e,t){if(e){if("string"==typeof e)return H(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)?H(e,t):void 0}}function H(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,V=Object.prototype.toString,z=Object.defineProperty,B=Object.getOwnPropertyDescriptor,U=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===V.call(e)},$=function(e){if(!e||"[object Object]"!==V.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)},K=function(e,t){z&&"__proto__"===t.name?z(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},W=function(e,t){if("__proto__"===t){if(!_.call(e,t))return;if(B)return B(e,t).value}return e[t]},Y=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,s=arguments.length,c=!1;for("boolean"==typeof u&&(c=u,u=arguments[1]||{},l=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});l<s;++l)if(null!=(t=arguments[l]))for(n in t)r=W(u,n),u!==(o=W(t,n))&&(c&&o&&($(o)||(i=U(o)))?(i?(i=!1,a=r&&U(r)?r:[]):a=r&&$(r)?r:{},K(u,{name:n,newValue:e(c,a,o)})):void 0!==o&&K(u,{name:n,newValue:o}));return u};function G(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.value%o.length]}))},valueAccessor:e.value}}function Z(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.row.value%o.length]}))},valueAccessor:e.value}}function J(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 X(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 Q(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 ee(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function te(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ne(){}var re=1/.7,oe="\\s*([+-]?\\d+)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ae="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ue=/^#([0-9a-f]{3,8})$/,le=new RegExp("^rgb\\("+[oe,oe,oe]+"\\)$"),se=new RegExp("^rgb\\("+[ae,ae,ae]+"\\)$"),ce=new RegExp("^rgba\\("+[oe,oe,oe,ie]+"\\)$"),fe=new RegExp("^rgba\\("+[ae,ae,ae,ie]+"\\)$"),de=new RegExp("^hsl\\("+[ie,ae,ae]+"\\)$"),pe=new RegExp("^hsla\\("+[ie,ae,ae,ie]+"\\)$"),he={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 me(){return this.rgb().formatHex()}function ve(){return this.rgb().formatRgb()}function ge(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ue.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?ye(t):3===n?new we(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?be(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?be(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=le.exec(e))?new we(t[1],t[2],t[3],1):(t=se.exec(e))?new we(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ce.exec(e))?be(t[1],t[2],t[3],t[4]):(t=fe.exec(e))?be(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=de.exec(e))?Ie(t[1],t[2]/100,t[3]/100,1):(t=pe.exec(e))?Ie(t[1],t[2]/100,t[3]/100,t[4]):he.hasOwnProperty(e)?ye(he[e]):"transparent"===e?new we(NaN,NaN,NaN,0):null}function ye(e){return new we(e>>16&255,e>>8&255,255&e,1)}function be(e,t,n,r){return r<=0&&(e=t=n=NaN),new we(e,t,n,r)}function xe(e){return e instanceof ne||(e=ge(e)),e?new we((e=e.rgb()).r,e.g,e.b,e.opacity):new we}function qe(e,t,n,r){return 1===arguments.length?xe(e):new we(e,t,n,null==r?1:r)}function we(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function De(){return"#"+Ce(this.r)+Ce(this.g)+Ce(this.b)}function Me(){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 Ce(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ie(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Se(e,t,n,r)}function ke(e){if(e instanceof Se)return new Se(e.h,e.s,e.l,e.opacity);if(e instanceof ne||(e=ge(e)),!e)return new Se;if(e instanceof Se)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 Se(a,u,l,e.opacity)}function Se(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ae(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}ee(ne,ge,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:me,formatHex:me,formatHsl:function(){return ke(this).formatHsl()},formatRgb:ve,toString:ve}),ee(we,qe,te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new we(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:De,formatHex:De,formatRgb:Me,toString:Me})),ee(Se,(function(e,t,n,r){return 1===arguments.length?ke(e):new Se(e,t,n,null==r?1:r)}),te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new Se(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Se(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 we(Ae(e>=240?e-240:e+120,o,r),Ae(e,o,r),Ae(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 Oe=Math.PI/180,Ee=180/Math.PI,Ne=4/29,Pe=6/29,Le=3*Pe*Pe;function Te(e){if(e instanceof je)return new je(e.l,e.a,e.b,e.opacity);if(e instanceof ze)return Be(e);e instanceof we||(e=xe(e));var t,n,r=_e(e.r),o=_e(e.g),i=_e(e.b),a=Fe((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?t=n=a:(t=Fe((.4360747*r+.3850649*o+.1430804*i)/.96422),n=Fe((.0139322*r+.0971045*o+.7141733*i)/.82521)),new je(116*a-16,500*(t-a),200*(a-n),e.opacity)}function je(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Fe(e){return e>.008856451679035631?Math.pow(e,1/3):e/Le+Ne}function Re(e){return e>Pe?e*e*e:Le*(e-Ne)}function He(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function _e(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ve(e){if(e instanceof ze)return new ze(e.h,e.c,e.l,e.opacity);if(e instanceof je||(e=Te(e)),0===e.a&&0===e.b)return new ze(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Ee;return new ze(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function ze(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function Be(e){if(isNaN(e.h))return new je(e.l,0,0,e.opacity);var t=e.h*Oe;return new je(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Ue(e){return function(){return e}}function $e(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Ue(isNaN(e)?t:e)}ee(je,(function(e,t,n,r){return 1===arguments.length?Te(e):new je(e,t,n,null==r?1:r)}),te(ne,{brighter:function(e){return new je(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new je(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new we(He(3.1338561*(t=.96422*Re(t))-1.6168667*(e=1*Re(e))-.4906146*(n=.82521*Re(n))),He(-.9787684*t+1.9161415*e+.033454*n),He(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),ee(ze,(function(e,t,n,r){return 1===arguments.length?Ve(e):new ze(e,t,n,null==r?1:r)}),te(ne,{brighter:function(e){return new ze(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new ze(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return Be(this).rgb()}}));var Ke=function e(t){var n=function(e){return 1==(e=+e)?$e: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):Ue(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=qe(e)).r,(t=qe(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=$e(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),We=/^class(-pyramid)?/,Ye=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,s={},c="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(F(c))),i=Math.max.apply(Math,[i].concat(F(c))),s.min=o,s.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))s.type="categorical",Object.assign(s,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 s=0;s<r.length;s++)if(r[s]>n){i.push(o[s]),i.push(o[s]);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?c:l}));else if(t.breakTypes){var d=t.breakTypes;s.type="continuous",s.domain=[o],s.range=[f[0]];for(var p=0;p<c.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=Ke(h,m)(.5);s.range.push(v),s.domain.push(c[p]),p<c.length-1&&d[p+1]&&(s.range.push(f[p+1]),s.domain.push((c[p]+c[p+1])/2))}else s.range.push(f[p]),s.range.push(f[p+1]),s.domain.push(c[p]),s.domain.push(c[p]+Math.min(1e-6,(i-o)/1e6));s.range.push(f[f.length-1]),s.domain.push(i)}else s.domain=c,s.range=f;return s};function Ge(e,t,n,r,o){var i,a,u,l=0,s=[],c=(e-t)/(r+1);if(0===c)return 1;for(i=0;i<n.length;i+=1)a=.99*(n[i]-t),u=n[i]>e?Math.floor(e/c):n[i]<t?0:Math.floor(a/c),Number.isNaN(u)||(s[u]?s[u]+=1:s[u]=1);for(i=0;i<s.length;i+=1)s[i]&&(l+=1);return l<=r||l>=o?Math.max(l,r):Ge(e,t,n,r+1,o)}var Ze=function(e,t,n,r){var o,i,a=t.theme,u=t.hc,l=r.f,s={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")}},c=[],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))&&(c=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,F(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(s.min=n.input.measureMin,s.max=n.input.measureMax,s.max<s.min)return{invalid:!0}}else if(l&&!f)s.min=l.min(),s.max=l.max();else if(l){if(!c.length)return{invalid:!0};s.min=Math.min.apply(Math,F(c)),s.max=Math.max.apply(Math,F(c))}if(n.input.measureScheme&&(s.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];s.type=d&&We.test(d.type)?"categorical":"continuous","categorical"===s.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,F(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===s.type){for(var p=f?Ge(s.max,s.min,c,1,i):i,h=(s.max-s.min)/p,m=[],v=0;v<p+1;v+=1)m.push(s.min+h*v);s.domain=m,s.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 s};function Je(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 Xe(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)),A(A({},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 A(A({},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}function Qe(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function et(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 tt(e,t,n,r){var o,i=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?Je:i,u=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,u),s=Ze(0,{theme:r,hc:o},n,{f:l});if(s.invalid)return s;("expression"===u.type||u.activeMeasureIndex<0)&&(s.label=u.label,l&&"color.altLabel"===l.raw().labelExpRef&&(s.label=n.input.altLabel)),!s.label&&l&&(s.label=l.title());var c=u.activeMeasureIndex>=0?l:null;if(!c&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(c=n.pic.fields().filter((function(e){return"measure"===e.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===u.type)if(c){var f=c.raw().coloring;f&&f.gradient&&Y(s,Ye(e,f.gradient,s,c))}else s.auxiliary=u;return s}(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?X:o,a=r.getCByField,u=void 0===a?Q:a,l=r.getPersistence,s=void 0===l?J:l,c=i(t,n),f=u(n,c),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"===c.type||c.activeDimensionIndex<0)&&(h.label=c.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"===c.type&&(h.auxiliary=c),Y(h,s(t,n,c,f,{byRow:Z,byElemNo:G})),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&&!n.input.colorExpression||!(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=Ze(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=[],s=[];"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?s.push(r.primary):s.push(o)}}));var c=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,f=i?i.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&f&&(c={categorical:f.key}),{mode:"measure",type:"categorical",palettes:c,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:s}: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 null!==(o=t.input)&&void 0!==o&&o.measureOverrides?(i.measureOverrides=t.input.measureOverrides.map((function(n,o){return Xe({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(Qe(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=et(e.measureOverrides,e.explicit),Qe(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=et(e.measureOverrides),a}return null!==(o=e.measureOverrides)&&void 0!==o&&o.every((function(e){return e}))?{invalid:!0,measureOverrides:e.measureOverrides}:e}(i,n)):i}function nt(e){var t=A({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(Y(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=Y(!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=Y(!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 Ye(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 s=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=s}return l?function(e,t,n,r){var o=r.external,i=r.field,a=A({},e);Y(a,G(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,Y(a,G(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(u&&(a.palettes={categorical:u.key}),Y(a,G(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],s=(l.text||l).label;r[s]&&-1===a.indexOf(l.value)&&(a.push(l.value),i.push(t.resolveUIColor(r[s])))}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=A(A({},e),r.getDataColorSpecials())),n.settings=Y(e,tt(this,n,t,e))}return n.settings}};return o}var rt=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},ot=function(e){throw e.isHandled=!0,e},it=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()},at=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()},ut=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(ot):Promise.reject()};function lt(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 st(e){return function(t){return"object"===E(t.datum[e])?t.datum[e].value:void 0}}function ct(e){return"object"===E(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function ft(e){return-3===e.datum.value}var dt=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"},pt=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 ht(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:dt(i,r,o)},show:"function"==typeof i.show?function(){return pt(i,l,a)}:pt(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"):"'Source Sans Pro', 'Arial', 'sans-serif'"}}}}function mt(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=ht(e,t);if(!r.show)return!1;var o,i=e.key,a=e.styleReference,u=e.viewState,l=e.rtl,s=e.settings,c=e.style,f=t.scaleKey,d=t.theme,p=t.scales,h=r.layout.dock,m="left"===h||"right"===h?{maxLines:3,wordBreak:"break-word"}:{},v={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"};"dimension"===t.coloring.fieldType&&(o=function(e){return e.datum.value>=0||-3===e.datum.value});var g="".concat(f,"Legend");return Y(!0,r,{type:"legend-cat",key:"".concat(i,"-cat"),scale:g in p?g:f,settings:{layout:{scrollOffset:function(){return u?u.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:l?"rtl":"ltr",horizontal:20},item:{show:o,label:A({fill:d?d.getStyle(a,"legend.label","color"):void 0,fontSize:d?d.getStyle(a,"legend.label","fontSize"):void 0,fontFamily:d?d.getStyle(a,"legend.label","fontFamily"):"'Source Sans Pro', 'Arial', 'sans-serif'"},m)},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:v[n]})])])}}}},brush:{consume:[{context:"selection",data:["",i],style:{inactive:{opacity:.3}}}]}},{settings:s,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,s=ht(e,t);return!!s.show&&Y(!0,s,{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"):"'Source Sans Pro', 'Arial', 'sans-serif'"},title:{anchor:!o||"top"!==s.layout.dock&&"bottom"!==s.layout.dock?void 0:"right",padding:parseFloat(s.settings.title.fontSize)||16}}},{settings:i,style:a})}(e,t)}function vt(e,t,n){var r=[],o=[],i=mt(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={},L(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),L(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),L(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 gt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function yt(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=nt(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 it(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return at(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return ut(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=rt,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=A({},o),r={},!n.key)throw new Error("Missing key");t.set(A(A({},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=A(A({},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 s=l.colors[0]?l.colors:[[]].concat(F(l.colors.slice(1)));s=Array.isArray(s[0])?s.map((function(e){return e.slice().reverse()})):s.slice().reverse(),o.push({key:"quant",colors:s})}}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 s={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(F((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(F((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var c,f=lt({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]}}),c={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:s,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};u[l]=h,c&&(u["".concat(l,"Legend")]=A(A({},h),{},{data:c})),t&&t.qHasOtherValues&&c&&((c||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]=Y({},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")]=Y({},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:s,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:s,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=st(r),i=st("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,u=e.mode,l=e.nil,s=e.others,c=e.primary,f=e.type;return a?function(e){return ft(e)||i(e)?s:l}:n[t]?function(e){return ft(e)?s:ct(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?l:i(e)?s:e.resources.scale(t)(o(e))||s}:"constant"===u?function(e){return ft(e)||i(e)?s:ct(e)?l:c}:"color"===f?function(e){return ft(e)||i(e)?s:ct(e)?l:o(e)||s}:null},u=a(t,r);if(t.measureOverrides){var l=st("".concat(r,"MeasureIdx")),s=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=l(e);return s[t]?s[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,s=a,c=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?gt(e.qNum):e.qText&&ge(e.qText)?e.qText:c})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=l);var f=L({},s,n);return r.qDimensionInfo.length>1&&(f["".concat(s,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),u&&(f["".concat(s,"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,s=void 0===l?"object.legend":l,c=e.settings,f=void 0===c?{}:c,d=e.style,p=void 0===d?{}:d,h=arguments.length>1?arguments[1]:void 0;return vt({eventName:t,key:r,rtl:u,viewState:i,chart:a,styleReference:s,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 bt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function xt(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(bt),i=r.some(bt),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function qt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=A(A(A({},e),t),{},{colorProps:A(A({},e.colorProps),t.colorProps||{})});return n}var wt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function Dt(e){var t,n=e.qHyperCube.qDimensionInfo.some(wt),r=e.qHyperCube.qMeasureInfo.some(wt),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 Ct(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 It(e){return(It="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 kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function St(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 At(e,t,n){return t&&St(e.prototype,t),n&&St(e,n),e}function Ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(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 Nt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Et(Object(n),!0).forEach((function(t){Ot(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pt(e,t){return(Pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Lt(){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 Tt(e,t,n){return(Tt=Lt()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Pt(o,n.prototype),o}).apply(null,arguments)}function jt(e){return function(e){if(Array.isArray(e))return Rt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ft(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 Ft(e,t){if(e){if("string"==typeof e)return Rt(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)?Rt(e,t):void 0}}function Rt(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 Ht=Object.prototype.hasOwnProperty,_t=Object.prototype.toString,Vt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Bt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===_t.call(e)},Ut=function(e){if(!e||"[object Object]"!==_t.call(e))return!1;var t,n=Ht.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Ht.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Ht.call(e,t)},$t=function(e,t){Vt&&"__proto__"===t.name?Vt(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Kt=function(e,t){if("__proto__"===t){if(!Ht.call(e,t))return;if(zt)return zt(e,t).value}return e[t]},Wt=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,s=arguments.length,c=!1;for("boolean"==typeof u&&(c=u,u=arguments[1]||{},l=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});l<s;++l)if(null!=(t=arguments[l]))for(n in t)r=Kt(u,n),u!==(o=Kt(t,n))&&(c&&o&&(Ut(o)||(i=Bt(o)))?(i?(i=!1,a=r&&Bt(r)?r:[]):a=r&&Ut(r)?r:{},$t(u,{name:n,newValue:e(c,a,o)})):void 0!==o&&$t(u,{name:n,newValue:o}));return u};function Yt(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 Gt(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 Zt(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,s=e.target,c=e.targetProp,f=r;if(o.field&&o.field!==n){var d=Yt(o.field,i,{cache:t});if(-1===d)return;f=Wt({qRow:a},d(u))}s[c]=Gt(o,f,{key:l})}function Jt(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(),s="object"===It(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=!!o[a].trackBy,m=It(o[a].trackBy),v={},g=[],y=[],b=0;b<u.qDataPages.length;b++){var x=Yt(s,u.qDataPages[b],{cache:n});if(-1!==x)for(var q=0;q<u.qDataPages[b].qMatrix.length;q++){var w=u.qDataPages[b].qArea.qTop+q,D=Wt({qRow:w},x(u.qDataPages[b].qMatrix[q])),M=Gt(d,D,{key:l});if(!d.filter||d.filter(D)){for(var C=0;C<p.length;C++){var I=f[p[C]],k=I.fields||[I];I.fields&&(M[p[C]]=[]);for(var S=0;S<k.length;S++)Zt({cache:n,f:s,mainCell:D,p:k[S],prop:p[C],props:f,page:u.qDataPages[b],rowIdx:w,row:u.qDataPages[b].qMatrix[q],sourceKey:l,target:I.fields?M[p[C]]:M,targetProp:I.fields?S:p[C]});if(I.fields){var A=M[p[C]].map((function(e){return e.value})),O=M[p[C]].map((function(e){return e.label}));M[p[C]]={value:"function"==typeof I.value?I.value(A):void 0!==I.value?I.value:A,label:"function"==typeof I.label?I.label(O):void 0!==I.label?String(I.label):String(M[p[C]].value)}}}h&&r.track({cfg:o[a],itemData:D,obj:M,target:g,tracker:v,trackType:m}),y.push(M)}}}h?i.push.apply(i,jt(r.collect(g,{main:d,propsArr:p,props:f}))):i.push.apply(i,y)}return i}function Xt(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 Qt(e,t){var n,r,o,i,a,u=new rn(e),l=+e.value&&(u.value=e.value),s=[u];for(null==t&&(t=en);n=s.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)s.push(r=n.children[i]=new rn(o[i])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(nn)}function en(e){return e.children}function tn(e){e.data=e.data.data}function nn(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function rn(e){this.data=e,this.depth=this.height=0,this.parent=null}function on(e){if("function"!=typeof e)throw new Error;return e}rn.prototype=Qt.prototype={constructor:rn,count:function(){return this.eachAfter(Xt)},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 Qt(this).eachBefore(tn)}};var an={depth:-1},un={};function ln(e){return e.id}function sn(e){return e.parentId}function cn(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=cn(n,o[u]);Array.isArray(l)?a.push.apply(a,jt(l)):a.push(l)}return a}if(!r[i]&&Array.isArray(o)){var s=new Array(o.length);n=r.slice(i+1).join("/");for(var c=0;c<o.length;c++)s[c]=cn(n,o[c]);return s}r[i]in o&&(o=o[r[i]])}return o}function fn(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,jt(o))}else for(var i=0;i<e.length;i++)e[i].children&&e[i].children.length&&r.push.apply(r,jt(fn(e[i].children,t-1,n)));return r}function dn(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=jt(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 fn(e.children,i-1,n)}}return!1}function pn(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 hn=/^qDimensionInfo(?:\/(\d+))?/,mn=/^\/?qMeasureInfo\/(\d+)/,vn=/\/qAttrExprInfo\/(\d+)/,gn=/\/qAttrDimInfo\/(\d+)/;function yn(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 bn(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,s=-1,c=r,f=n.qEffectiveInterColumnSortOrder,d=yn(n);return hn.test(c)&&(o=!0,i=+hn.exec(c)[1],c=r.replace(hn,"")),mn.test(c)&&("K"===n.qMode?l=+mn.exec(c)[1]:f&&-1!==f.indexOf(-1)?(l=+mn.exec(c)[1],s=0):s=+mn.exec(c)[1],c=c.replace(mn,"")),c&&(gn.exec(c)?u=+gn.exec(c)[1]:vn.exec(c)&&(a=+vn.exec(c)[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:s,attrDimIdx:u,attrIdx:a}}function xn(e,t){var n,r,o=dn(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 qn(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 wn(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]],s=l.fields||[l],c=void 0,f=void 0;l.fields&&(c=[],f=[]);for(var d=function(e){var n=s[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;c.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<s.length;p++)d(p);c&&(i[t[u]]={value:"function"==typeof l.value?l.value(c,r):c,label:"function"==typeof l.label?l.label(f,r):f})}}var Dn=function(e,t,n){var r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=cn(r,e);return i&&i[0]?(t.tree=Qt(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],s="__root",c=!1,f=0;f<o.length;f++){var d=l[o[f]],p="".concat(s,"__").concat(d.qText);a[p]||(a[p]=Nt({__id:p,__parent:s,qValues:[]},d),c=!0),s=p}if(c)for(var h=0;h<i.length;h++){var m=l[i[h]];a[s].qValues.push(m)}}var v=Object.keys(a).map((function(e){return a[e]}));return function(){var e=ln,t=sn;function n(n){var r,o,i,a,u,l,s,c=n.length,f=new Array(c),d={};for(o=0;o<c;++o)r=n[o],u=f[o]=new rn(r),null!=(l=e(r,o,n))&&(l+="")&&(d[s="$"+(u.id=l)]=s in d?un:u);for(o=0;o<c;++o)if(u=f[o],null!=(l=t(n[o],o,n))&&(l+="")){if(!(a=d["$"+l]))throw new Error("missing: "+l);if(a===un)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=an,i.eachBefore((function(e){e.depth=e.parent.depth+1,--c})).eachBefore(nn),i.parent=null,c>0)throw new Error("cycle");return i}return n.id=function(t){return arguments.length?(e=on(t),n):e},n.parentId=function(e){return arguments.length?(t=on(e),n):t},n}().id((function(e){return e.__id})).parentId((function(e){return e.__parent}))(v)}var Cn=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]],s=l.fields?l.fields:[l],c=0;c<s.length;c++){var f=s[c];if(f.field!==a){var d=xn(i,bn(f.field,{cube:r,cache:o}));f.accessor=d.nodeFn,f.valueAccessor=d.valueFn,f.attrAccessor=d.attrFn}}};function In(){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):Dn(o,n,e);if(!a)return null;for(var u=a.height,l=[],s=0;s<=u;s++){var c=null;if(s>0)if("S"===o.qMode){var f=yn(o),d=f[s-1];c=n.fields[d]}else{var p=o.qEffectiveInterColumnSortOrder[s-1];s>o.qEffectiveInterColumnSortOrder.length&&(p=o.qDimensionInfo.length),c=n.fields[p]}var h=r.normalizeConfig(Nt(Nt({},e),{},{field:c?c.key():void 0}),t),m=h.props,v=h.main,g=Object.keys(m);l[s]={propsArr:g,props:m,main:v};var y=c?bn(c,{cube:o,cache:n}):{fieldDepth:0};Cn({propsArr:g,props:m,cube:o,cache:n,itemDepthObject:y,f:c})}for(var b=a.copy(),x=b.descendants(),q=a.descendants(),w=0;w<q.length;w++){var D=l[q[w].depth].propsArr,M=l[q[w].depth].props,C=l[q[w].depth].main,I=x[w],k=I.data,S=qn(C,k,{key:i});wn({propsArr:D,props:M,item:I,itemData:k,ret:S,sourceKey:i,isTree:!0}),q[w].data=S}return a}function kn(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(!Dn(u,n,e))continue;var s="object"===It(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=bn(s,{cube:u,cache:n}),m=xn({fieldDepth:0},h),v=m.nodeFn,g=m.attrFn,y=m.valueFn;Cn({propsArr:p,props:f,cube:u,cache:n,itemDepthObject:h,f:s});for(var b=!!o[a].trackBy,x=It(o[a].trackBy),q={},w=[],D=v(n.tree),M=[],C=0;C<D.length;C++){var I=D[C],k=g?g(y(I)):y(I);if(!d.filter||d.filter(k)){var S=qn(d,k,{key:l});wn({propsArr:p,props:f,item:I,itemData:k,ret:S,sourceKey:l}),b&&r.track({cfg:o[a],itemData:k,obj:S,target:w,tracker:q,trackType:x}),M.push(S)}}b?i.push.apply(i,jt(r.collect(w,{main:d,propsArr:p,props:f}))):i.push.apply(i,M)}return i}var Sn,An=(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 s,useStaleLayout as c,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";const y={fill:"steelblue",num:1},b=(e,t,n)=>{let 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{const e=180/Math.PI*Math.atan((t.bottomRight.y-t.topRight.y)/(t.topRight.x-t.bottomRight.x));r=e<15&&e>=0?t.topRight.x:e>-15&&e<0?t.bottomRight.x:e<-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"}},x=(e,t)=>{const n=(e=>{const t=(e=>{let t=0;return e.forEach((e=>{e.num>t&&(t=e.num)})),t})(e);let n=0;return e.slice().reverse().map((e=>{const r={datum:e,s:n/t,e:e.num/t};return n=e.num,r})).reverse()})(e),r=.9*t.width,o=.9*t.height,i=(t.width-r)/2,a=(t.height-o)/2,u=r-(r>150&&o>150?100:0),l=(o-1*(n.length-1))/n.length,s=[];return n.forEach(((e,r)=>{const o=(c=e.e,f=r<n.length-1?e.s:e.e,[.5-.5*c,.5+.5*c,.5+.5*f,.5-.5*f]).map((e=>Math.round(e*u+i)));var c,f;const d=l*r+1*r+a,p={bottomRight:{x:o[2],y:Math.round(d+l)},bottomLeft:{x:o[3],y:Math.round(d+l)},topRight:{x:o[1],y:Math.round(d)},topLeft:{x:o[0],y:Math.round(d)},width:t.width},h=`M${p.topLeft.x},${p.topLeft.y} L${p.topRight.x},${p.topRight.y} ${p.bottomRight.x},${p.bottomRight.y} ${p.bottomLeft.x},${p.bottomLeft.y}Z`;s.push({tag:"section",type:"path",d:h,data:e.datum.data,fill:e.datum.fill});const m={share:e.e,fill:e.datum.fill,data:e.datum.data};l>12&&(p.bottomRight.x-p.bottomLeft.x>32&&s.push(b("labelCenter",p,m)),s.push(b("labelLeft",p,m)))})),s},q=(e,t,n,r)=>(r-e)/r*(t-n)+n,w=(e,t,n)=>{const r=e.filter((e=>"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),s=i-(i>150&&a>150?100:0),c=a-1*(o-1),f=[],d=r[0].data.num.value;let p=l;return r.forEach(((e,r)=>{const o=t[r]*c,i=Math.round(q(p-l,s,.2*s,a)/2),h=Math.round(q(p-l+o,s,.2*s,a)/2),m=u+Math.round(s/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${v.topLeft.x},${v.topLeft.y} L${v.topRight.x},${v.topRight.y} ${v.bottomRight.x},${v.bottomRight.y} ${v.bottomLeft.x},${v.bottomLeft.y}Z`;f.push({tag:"section",type:"path",d:g,data:e.data,fill:e.fill});const y={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(b("labelCenter",v,y)),f.push(b("labelLeft",v,y))),p+=o+1})),f},D=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0));if(r&&r.length>0)switch(t){case"WIDTH":return x(r,n);case"ORDER":return w(r,r.map((()=>1/r.length)),n);case"HEIGHT":return w(r,(e=>{const t=e.reduce(((e,t)=>e+t.data.num.value),0);return e.map((e=>e.data.num.value/t))})(r),n);case"AREA":return w(r,((e,t,n)=>{const r=e.reduce(((e,t)=>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,s=[];let c=0;for(let t=e.length-1;t>=0;t--){const n=e[t].data.num.value/r,o=2*l*c+a,f=-o/(2*l)+Math.sqrt(o*o/(4*l*l)+n*u/l);s[t]=f/i,c+=f}return s})(r,n,.2),n);default:return x(r,n)}return[]};var M={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:e}){const t=this.resolver.resolve({data:e,defaults:{...y,...this.style.item},settings:this.settings.settings});return D(t.items,this.settings.settings.mode,this.rect)}};const C={version:"1.5.1",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:""};var I={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 title",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:e=>!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};const k=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:()=>"Segments"},measures:{min:1,max:1,description(e){switch(e.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added(e,t){2===t.qHyperCubeDef.qInterColumnSortOrder.length&&1!==t.qHyperCubeDef.qInterColumnSortOrder[0]&&(t.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function S(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 A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){L(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(){O=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var o=t&&t.prototype instanceof f?t:f,i=Object.create(o.prototype),a=new D(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=x(a,n);if(u){if(u===c)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,a),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function f(){}function d(){}function p(){}var h={};u(h,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(M([])));v&&v!==t&&n.call(v,o)&&(h=v);var g=p.prototype=f.prototype=Object.create(h);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(o,i,a,u){var l=s(e[o],e,i);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,u)}))}u(l.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=s(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function M(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=p,u(g,"constructor",p),u(p,"constructor",d),d.displayName=u(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},y(b.prototype),u(b.prototype,i,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new b(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},y(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=M,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(u&&l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;w(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function E(e){return(E="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 N(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 P(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){N(i,r,o,a,u,"next",e)}function u(e){N(i,r,o,a,u,"throw",e)}a(void 0)}))}}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(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 j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){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)||R(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 F(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||R(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 R(e,t){if(e){if("string"==typeof e)return H(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)?H(e,t):void 0}}function H(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,V=Object.prototype.toString,z=Object.defineProperty,B=Object.getOwnPropertyDescriptor,U=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===V.call(e)},$=function(e){if(!e||"[object Object]"!==V.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)},K=function(e,t){z&&"__proto__"===t.name?z(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},W=function(e,t){if("__proto__"===t){if(!_.call(e,t))return;if(B)return B(e,t).value}return e[t]},Y=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,s=arguments.length,c=!1;for("boolean"==typeof u&&(c=u,u=arguments[1]||{},l=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});l<s;++l)if(null!=(t=arguments[l]))for(n in t)r=W(u,n),u!==(o=W(t,n))&&(c&&o&&($(o)||(i=U(o)))?(i?(i=!1,a=r&&U(r)?r:[]):a=r&&$(r)?r:{},K(u,{name:n,newValue:e(c,a,o)})):void 0!==o&&K(u,{name:n,newValue:o}));return u};function G(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.value%o.length]}))},valueAccessor:e.value}}function Z(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.row.value%o.length]}))},valueAccessor:e.value}}function J(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 X(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 Q(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 ee(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function te(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ne(){}var re=1/.7,oe="\\s*([+-]?\\d+)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ae="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ue=/^#([0-9a-f]{3,8})$/,le=new RegExp("^rgb\\("+[oe,oe,oe]+"\\)$"),se=new RegExp("^rgb\\("+[ae,ae,ae]+"\\)$"),ce=new RegExp("^rgba\\("+[oe,oe,oe,ie]+"\\)$"),fe=new RegExp("^rgba\\("+[ae,ae,ae,ie]+"\\)$"),de=new RegExp("^hsl\\("+[ie,ae,ae]+"\\)$"),pe=new RegExp("^hsla\\("+[ie,ae,ae,ie]+"\\)$"),he={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 me(){return this.rgb().formatHex()}function ve(){return this.rgb().formatRgb()}function ge(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ue.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?ye(t):3===n?new we(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?be(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?be(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=le.exec(e))?new we(t[1],t[2],t[3],1):(t=se.exec(e))?new we(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ce.exec(e))?be(t[1],t[2],t[3],t[4]):(t=fe.exec(e))?be(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=de.exec(e))?Ie(t[1],t[2]/100,t[3]/100,1):(t=pe.exec(e))?Ie(t[1],t[2]/100,t[3]/100,t[4]):he.hasOwnProperty(e)?ye(he[e]):"transparent"===e?new we(NaN,NaN,NaN,0):null}function ye(e){return new we(e>>16&255,e>>8&255,255&e,1)}function be(e,t,n,r){return r<=0&&(e=t=n=NaN),new we(e,t,n,r)}function xe(e){return e instanceof ne||(e=ge(e)),e?new we((e=e.rgb()).r,e.g,e.b,e.opacity):new we}function qe(e,t,n,r){return 1===arguments.length?xe(e):new we(e,t,n,null==r?1:r)}function we(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function De(){return"#"+Ce(this.r)+Ce(this.g)+Ce(this.b)}function Me(){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 Ce(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ie(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Se(e,t,n,r)}function ke(e){if(e instanceof Se)return new Se(e.h,e.s,e.l,e.opacity);if(e instanceof ne||(e=ge(e)),!e)return new Se;if(e instanceof Se)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 Se(a,u,l,e.opacity)}function Se(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ae(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}ee(ne,ge,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:me,formatHex:me,formatHsl:function(){return ke(this).formatHsl()},formatRgb:ve,toString:ve}),ee(we,qe,te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new we(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:De,formatHex:De,formatRgb:Me,toString:Me})),ee(Se,(function(e,t,n,r){return 1===arguments.length?ke(e):new Se(e,t,n,null==r?1:r)}),te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new Se(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Se(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 we(Ae(e>=240?e-240:e+120,o,r),Ae(e,o,r),Ae(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 Oe=Math.PI/180,Ee=180/Math.PI,Ne=4/29,Pe=6/29,Le=3*Pe*Pe;function Te(e){if(e instanceof je)return new je(e.l,e.a,e.b,e.opacity);if(e instanceof ze)return Be(e);e instanceof we||(e=xe(e));var t,n,r=_e(e.r),o=_e(e.g),i=_e(e.b),a=Fe((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?t=n=a:(t=Fe((.4360747*r+.3850649*o+.1430804*i)/.96422),n=Fe((.0139322*r+.0971045*o+.7141733*i)/.82521)),new je(116*a-16,500*(t-a),200*(a-n),e.opacity)}function je(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Fe(e){return e>.008856451679035631?Math.pow(e,1/3):e/Le+Ne}function Re(e){return e>Pe?e*e*e:Le*(e-Ne)}function He(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function _e(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ve(e){if(e instanceof ze)return new ze(e.h,e.c,e.l,e.opacity);if(e instanceof je||(e=Te(e)),0===e.a&&0===e.b)return new ze(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Ee;return new ze(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function ze(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function Be(e){if(isNaN(e.h))return new je(e.l,0,0,e.opacity);var t=e.h*Oe;return new je(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Ue(e){return function(){return e}}function $e(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Ue(isNaN(e)?t:e)}ee(je,(function(e,t,n,r){return 1===arguments.length?Te(e):new je(e,t,n,null==r?1:r)}),te(ne,{brighter:function(e){return new je(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new je(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new we(He(3.1338561*(t=.96422*Re(t))-1.6168667*(e=1*Re(e))-.4906146*(n=.82521*Re(n))),He(-.9787684*t+1.9161415*e+.033454*n),He(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),ee(ze,(function(e,t,n,r){return 1===arguments.length?Ve(e):new ze(e,t,n,null==r?1:r)}),te(ne,{brighter:function(e){return new ze(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new ze(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return Be(this).rgb()}}));var Ke=function e(t){var n=function(e){return 1==(e=+e)?$e: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):Ue(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=qe(e)).r,(t=qe(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=$e(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),We=/^class(-pyramid)?/,Ye=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,s={},c="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(F(c))),i=Math.max.apply(Math,[i].concat(F(c))),s.min=o,s.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))s.type="categorical",Object.assign(s,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 s=0;s<r.length;s++)if(r[s]>n){i.push(o[s]),i.push(o[s]);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?c:l}));else if(t.breakTypes){var d=t.breakTypes;s.type="continuous",s.domain=[o],s.range=[f[0]];for(var p=0;p<c.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=Ke(h,m)(.5);s.range.push(v),s.domain.push(c[p]),p<c.length-1&&d[p+1]&&(s.range.push(f[p+1]),s.domain.push((c[p]+c[p+1])/2))}else s.range.push(f[p]),s.range.push(f[p+1]),s.domain.push(c[p]),s.domain.push(c[p]+Math.min(1e-6,(i-o)/1e6));s.range.push(f[f.length-1]),s.domain.push(i)}else s.domain=c,s.range=f;return s};function Ge(e,t,n,r,o){var i,a,u,l=0,s=[],c=(e-t)/(r+1);if(0===c)return 1;for(i=0;i<n.length;i+=1)a=.99*(n[i]-t),u=n[i]>e?Math.floor(e/c):n[i]<t?0:Math.floor(a/c),Number.isNaN(u)||(s[u]?s[u]+=1:s[u]=1);for(i=0;i<s.length;i+=1)s[i]&&(l+=1);return l<=r||l>=o?Math.max(l,r):Ge(e,t,n,r+1,o)}var Ze=function(e,t,n,r){var o,i,a=t.theme,u=t.hc,l=r.f,s={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")}},c=[],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))&&(c=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,F(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(s.min=n.input.measureMin,s.max=n.input.measureMax,s.max<s.min)return{invalid:!0}}else if(l&&!f)s.min=l.min(),s.max=l.max();else if(l){if(!c.length)return{invalid:!0};s.min=Math.min.apply(Math,F(c)),s.max=Math.max.apply(Math,F(c))}if(n.input.measureScheme&&(s.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];s.type=d&&We.test(d.type)?"categorical":"continuous","categorical"===s.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,F(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===s.type){for(var p=f?Ge(s.max,s.min,c,1,i):i,h=(s.max-s.min)/p,m=[],v=0;v<p+1;v+=1)m.push(s.min+h*v);s.domain=m,s.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 s};function Je(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 Xe(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)),A(A({},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 A(A({},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}function Qe(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function et(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 tt(e,t,n,r){var o,i=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?Je:i,u=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,u),s=Ze(0,{theme:r,hc:o},n,{f:l});if(s.invalid)return s;("expression"===u.type||u.activeMeasureIndex<0)&&(s.label=u.label,l&&"color.altLabel"===l.raw().labelExpRef&&(s.label=n.input.altLabel)),!s.label&&l&&(s.label=l.title());var c=u.activeMeasureIndex>=0?l:null;if(!c&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(c=n.pic.fields().filter((function(e){return"measure"===e.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===u.type)if(c){var f=c.raw().coloring;f&&f.gradient&&Y(s,Ye(e,f.gradient,s,c))}else s.auxiliary=u;return s}(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?X:o,a=r.getCByField,u=void 0===a?Q:a,l=r.getPersistence,s=void 0===l?J:l,c=i(t,n),f=u(n,c),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"===c.type||c.activeDimensionIndex<0)&&(h.label=c.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"===c.type&&(h.auxiliary=c),Y(h,s(t,n,c,f,{byRow:Z,byElemNo:G})),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&&!n.input.colorExpression||!(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=Ze(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=[],s=[];"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?s.push(r.primary):s.push(o)}}));var c=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,f=i?i.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&f&&(c={categorical:f.key}),{mode:"measure",type:"categorical",palettes:c,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:s}: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 null!==(o=t.input)&&void 0!==o&&o.measureOverrides?(i.measureOverrides=t.input.measureOverrides.map((function(n,o){return Xe({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(Qe(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=et(e.measureOverrides,e.explicit),Qe(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=et(e.measureOverrides),a}return null!==(o=e.measureOverrides)&&void 0!==o&&o.every((function(e){return e}))?{invalid:!0,measureOverrides:e.measureOverrides}:e}(i,n)):i}function nt(e){var t=A({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(Y(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=Y(!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=Y(!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 Ye(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 s=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=s}return l?function(e,t,n,r){var o=r.external,i=r.field,a=A({},e);Y(a,G(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,Y(a,G(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(u&&(a.palettes={categorical:u.key}),Y(a,G(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],s=(l.text||l).label;r[s]&&-1===a.indexOf(l.value)&&(a.push(l.value),i.push(t.resolveUIColor(r[s])))}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=A(A({},e),r.getDataColorSpecials())),n.settings=Y(e,tt(this,n,t,e))}return n.settings}};return o}var rt=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},ot=function(e){throw e.isHandled=!0,e},it=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()},at=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()},ut=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(ot):Promise.reject()};function lt(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 st(e){return function(t){return"object"===E(t.datum[e])?t.datum[e].value:void 0}}function ct(e){return"object"===E(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function ft(e){return-3===e.datum.value}var dt=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"},pt=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 ht(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:dt(i,r,o)},show:"function"==typeof i.show?function(){return pt(i,l,a)}:pt(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"):"'Source Sans Pro', 'Arial', 'sans-serif'"}}}}function mt(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=ht(e,t);if(!r.show)return!1;var o,i=e.key,a=e.styleReference,u=e.viewState,l=e.rtl,s=e.settings,c=e.style,f=t.scaleKey,d=t.theme,p=t.scales,h=r.layout.dock,m="left"===h||"right"===h?{maxLines:3,wordBreak:"break-word"}:{},v={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"};"dimension"===t.coloring.fieldType&&(o=function(e){return e.datum.value>=0||-3===e.datum.value});var g="".concat(f,"Legend");return Y(!0,r,{type:"legend-cat",key:"".concat(i,"-cat"),scale:g in p?g:f,settings:{layout:{scrollOffset:function(){return u?u.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:l?"rtl":"ltr",horizontal:20},item:{show:o,label:A({fill:d?d.getStyle(a,"legend.label","color"):void 0,fontSize:d?d.getStyle(a,"legend.label","fontSize"):void 0,fontFamily:d?d.getStyle(a,"legend.label","fontFamily"):"'Source Sans Pro', 'Arial', 'sans-serif'"},m)},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:v[n]})])])}}}},brush:{consume:[{context:"selection",data:["",i],style:{inactive:{opacity:.3}}}]}},{settings:s,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,s=ht(e,t);return!!s.show&&Y(!0,s,{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"):"'Source Sans Pro', 'Arial', 'sans-serif'"},title:{anchor:!o||"top"!==s.layout.dock&&"bottom"!==s.layout.dock?void 0:"right",padding:parseFloat(s.settings.title.fontSize)||16}}},{settings:i,style:a})}(e,t)}function vt(e,t,n){var r=[],o=[],i=mt(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={},L(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),L(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),L(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 gt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function yt(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=nt(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 it(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return at(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return ut(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=rt,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=A({},o),r={},!n.key)throw new Error("Missing key");t.set(A(A({},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=A(A({},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 s=l.colors[0]?l.colors:[[]].concat(F(l.colors.slice(1)));s=Array.isArray(s[0])?s.map((function(e){return e.slice().reverse()})):s.slice().reverse(),o.push({key:"quant",colors:s})}}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 s={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(F((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(F((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var c,f=lt({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]}}),c={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:s,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};u[l]=h,c&&(u["".concat(l,"Legend")]=A(A({},h),{},{data:c})),t&&t.qHasOtherValues&&c&&((c||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]=Y({},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")]=Y({},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:s,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:s,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=st(r),i=st("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,u=e.mode,l=e.nil,s=e.others,c=e.primary,f=e.type;return a?function(e){return ft(e)||i(e)?s:l}:n[t]?function(e){return ft(e)?s:ct(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?l:i(e)?s:e.resources.scale(t)(o(e))||s}:"constant"===u?function(e){return ft(e)||i(e)?s:ct(e)?l:c}:"color"===f?function(e){return ft(e)||i(e)?s:ct(e)?l:o(e)||s}:null},u=a(t,r);if(t.measureOverrides){var l=st("".concat(r,"MeasureIdx")),s=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=l(e);return s[t]?s[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,s=a,c=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?gt(e.qNum):e.qText&&ge(e.qText)?e.qText:c})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=l);var f=L({},s,n);return r.qDimensionInfo.length>1&&(f["".concat(s,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),u&&(f["".concat(s,"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,s=void 0===l?"object.legend":l,c=e.settings,f=void 0===c?{}:c,d=e.style,p=void 0===d?{}:d,h=arguments.length>1?arguments[1]:void 0;return vt({eventName:t,key:r,rtl:u,viewState:i,chart:a,styleReference:s,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 bt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function xt(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(bt),i=r.some(bt),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function qt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=A(A(A({},e),t),{},{colorProps:A(A({},e.colorProps),t.colorProps||{})});return n}var wt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function Dt(e){var t,n=e.qHyperCube.qDimensionInfo.some(wt),r=e.qHyperCube.qMeasureInfo.some(wt),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 Ct(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 It(e){return(It="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 kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function St(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 At(e,t,n){return t&&St(e.prototype,t),n&&St(e,n),e}function Ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(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 Nt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Et(Object(n),!0).forEach((function(t){Ot(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pt(e,t){return(Pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Lt(){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 Tt(e,t,n){return(Tt=Lt()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Pt(o,n.prototype),o}).apply(null,arguments)}function jt(e){return function(e){if(Array.isArray(e))return Rt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ft(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 Ft(e,t){if(e){if("string"==typeof e)return Rt(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)?Rt(e,t):void 0}}function Rt(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 Ht=Object.prototype.hasOwnProperty,_t=Object.prototype.toString,Vt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Bt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===_t.call(e)},Ut=function(e){if(!e||"[object Object]"!==_t.call(e))return!1;var t,n=Ht.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Ht.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Ht.call(e,t)},$t=function(e,t){Vt&&"__proto__"===t.name?Vt(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Kt=function(e,t){if("__proto__"===t){if(!Ht.call(e,t))return;if(zt)return zt(e,t).value}return e[t]},Wt=function e(){var t,n,r,o,i,a,u=arguments[0],l=1,s=arguments.length,c=!1;for("boolean"==typeof u&&(c=u,u=arguments[1]||{},l=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});l<s;++l)if(null!=(t=arguments[l]))for(n in t)r=Kt(u,n),u!==(o=Kt(t,n))&&(c&&o&&(Ut(o)||(i=Bt(o)))?(i?(i=!1,a=r&&Bt(r)?r:[]):a=r&&Ut(r)?r:{},$t(u,{name:n,newValue:e(c,a,o)})):void 0!==o&&$t(u,{name:n,newValue:o}));return u};function Yt(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 Gt(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 Zt(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,s=e.target,c=e.targetProp,f=r;if(o.field&&o.field!==n){var d=Yt(o.field,i,{cache:t});if(-1===d)return;f=Wt({qRow:a},d(u))}s[c]=Gt(o,f,{key:l})}function Jt(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(),s="object"===It(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=!!o[a].trackBy,m=It(o[a].trackBy),v={},g=[],y=[],b=0;b<u.qDataPages.length;b++){var x=Yt(s,u.qDataPages[b],{cache:n});if(-1!==x)for(var q=0;q<u.qDataPages[b].qMatrix.length;q++){var w=u.qDataPages[b].qArea.qTop+q,D=Wt({qRow:w},x(u.qDataPages[b].qMatrix[q])),M=Gt(d,D,{key:l});if(!d.filter||d.filter(D)){for(var C=0;C<p.length;C++){var I=f[p[C]],k=I.fields||[I];I.fields&&(M[p[C]]=[]);for(var S=0;S<k.length;S++)Zt({cache:n,f:s,mainCell:D,p:k[S],prop:p[C],props:f,page:u.qDataPages[b],rowIdx:w,row:u.qDataPages[b].qMatrix[q],sourceKey:l,target:I.fields?M[p[C]]:M,targetProp:I.fields?S:p[C]});if(I.fields){var A=M[p[C]].map((function(e){return e.value})),O=M[p[C]].map((function(e){return e.label}));M[p[C]]={value:"function"==typeof I.value?I.value(A):void 0!==I.value?I.value:A,label:"function"==typeof I.label?I.label(O):void 0!==I.label?String(I.label):String(M[p[C]].value)}}}h&&r.track({cfg:o[a],itemData:D,obj:M,target:g,tracker:v,trackType:m}),y.push(M)}}}h?i.push.apply(i,jt(r.collect(g,{main:d,propsArr:p,props:f}))):i.push.apply(i,y)}return i}function Xt(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 Qt(e,t){var n,r,o,i,a,u=new rn(e),l=+e.value&&(u.value=e.value),s=[u];for(null==t&&(t=en);n=s.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)s.push(r=n.children[i]=new rn(o[i])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(nn)}function en(e){return e.children}function tn(e){e.data=e.data.data}function nn(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function rn(e){this.data=e,this.depth=this.height=0,this.parent=null}function on(e){if("function"!=typeof e)throw new Error;return e}rn.prototype=Qt.prototype={constructor:rn,count:function(){return this.eachAfter(Xt)},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 Qt(this).eachBefore(tn)}};var an={depth:-1},un={};function ln(e){return e.id}function sn(e){return e.parentId}function cn(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=cn(n,o[u]);Array.isArray(l)?a.push.apply(a,jt(l)):a.push(l)}return a}if(!r[i]&&Array.isArray(o)){var s=new Array(o.length);n=r.slice(i+1).join("/");for(var c=0;c<o.length;c++)s[c]=cn(n,o[c]);return s}r[i]in o&&(o=o[r[i]])}return o}function fn(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,jt(o))}else for(var i=0;i<e.length;i++)e[i].children&&e[i].children.length&&r.push.apply(r,jt(fn(e[i].children,t-1,n)));return r}function dn(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=jt(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 fn(e.children,i-1,n)}}return!1}function pn(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 hn=/^qDimensionInfo(?:\/(\d+))?/,mn=/^\/?qMeasureInfo\/(\d+)/,vn=/\/qAttrExprInfo\/(\d+)/,gn=/\/qAttrDimInfo\/(\d+)/;function yn(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 bn(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,s=-1,c=r,f=n.qEffectiveInterColumnSortOrder,d=yn(n);return hn.test(c)&&(o=!0,i=+hn.exec(c)[1],c=r.replace(hn,"")),mn.test(c)&&("K"===n.qMode?l=+mn.exec(c)[1]:f&&-1!==f.indexOf(-1)?(l=+mn.exec(c)[1],s=0):s=+mn.exec(c)[1],c=c.replace(mn,"")),c&&(gn.exec(c)?u=+gn.exec(c)[1]:vn.exec(c)&&(a=+vn.exec(c)[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:s,attrDimIdx:u,attrIdx:a}}function xn(e,t){var n,r,o=dn(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 qn(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 wn(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]],s=l.fields||[l],c=void 0,f=void 0;l.fields&&(c=[],f=[]);for(var d=function(e){var n=s[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;c.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<s.length;p++)d(p);c&&(i[t[u]]={value:"function"==typeof l.value?l.value(c,r):c,label:"function"==typeof l.label?l.label(f,r):f})}}var Dn=function(e,t,n){var r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=cn(r,e);return i&&i[0]?(t.tree=Qt(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],s="__root",c=!1,f=0;f<o.length;f++){var d=l[o[f]],p="".concat(s,"__").concat(d.qText);a[p]||(a[p]=Nt({__id:p,__parent:s,qValues:[]},d),c=!0),s=p}if(c)for(var h=0;h<i.length;h++){var m=l[i[h]];a[s].qValues.push(m)}}var v=Object.keys(a).map((function(e){return a[e]}));return function(){var e=ln,t=sn;function n(n){var r,o,i,a,u,l,s,c=n.length,f=new Array(c),d={};for(o=0;o<c;++o)r=n[o],u=f[o]=new rn(r),null!=(l=e(r,o,n))&&(l+="")&&(d[s="$"+(u.id=l)]=s in d?un:u);for(o=0;o<c;++o)if(u=f[o],null!=(l=t(n[o],o,n))&&(l+="")){if(!(a=d["$"+l]))throw new Error("missing: "+l);if(a===un)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=an,i.eachBefore((function(e){e.depth=e.parent.depth+1,--c})).eachBefore(nn),i.parent=null,c>0)throw new Error("cycle");return i}return n.id=function(t){return arguments.length?(e=on(t),n):e},n.parentId=function(e){return arguments.length?(t=on(e),n):t},n}().id((function(e){return e.__id})).parentId((function(e){return e.__parent}))(v)}var Cn=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]],s=l.fields?l.fields:[l],c=0;c<s.length;c++){var f=s[c];if(f.field!==a){var d=xn(i,bn(f.field,{cube:r,cache:o}));f.accessor=d.nodeFn,f.valueAccessor=d.valueFn,f.attrAccessor=d.attrFn}}};function In(){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):Dn(o,n,e);if(!a)return null;for(var u=a.height,l=[],s=0;s<=u;s++){var c=null;if(s>0)if("S"===o.qMode){var f=yn(o),d=f[s-1];c=n.fields[d]}else{var p=o.qEffectiveInterColumnSortOrder[s-1];s>o.qEffectiveInterColumnSortOrder.length&&(p=o.qDimensionInfo.length),c=n.fields[p]}var h=r.normalizeConfig(Nt(Nt({},e),{},{field:c?c.key():void 0}),t),m=h.props,v=h.main,g=Object.keys(m);l[s]={propsArr:g,props:m,main:v};var y=c?bn(c,{cube:o,cache:n}):{fieldDepth:0};Cn({propsArr:g,props:m,cube:o,cache:n,itemDepthObject:y,f:c})}for(var b=a.copy(),x=b.descendants(),q=a.descendants(),w=0;w<q.length;w++){var D=l[q[w].depth].propsArr,M=l[q[w].depth].props,C=l[q[w].depth].main,I=x[w],k=I.data,S=qn(C,k,{key:i});wn({propsArr:D,props:M,item:I,itemData:k,ret:S,sourceKey:i,isTree:!0}),q[w].data=S}return a}function kn(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(!Dn(u,n,e))continue;var s="object"===It(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=bn(s,{cube:u,cache:n}),m=xn({fieldDepth:0},h),v=m.nodeFn,g=m.attrFn,y=m.valueFn;Cn({propsArr:p,props:f,cube:u,cache:n,itemDepthObject:h,f:s});for(var b=!!o[a].trackBy,x=It(o[a].trackBy),q={},w=[],D=v(n.tree),M=[],C=0;C<D.length;C++){var I=D[C],k=g?g(y(I)):y(I);if(!d.filter||d.filter(k)){var S=qn(d,k,{key:l});wn({propsArr:p,props:f,item:I,itemData:k,ret:S,sourceKey:l}),b&&r.track({cfg:o[a],itemData:k,obj:S,target:w,tracker:q,trackType:x}),M.push(S)}}b?i.push.apply(i,jt(r.collect(w,{main:d,propsArr:p,props:f}))):i.push.apply(i,M)}return i}var Sn,An=(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,s,c,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"),(!(s=t.split("."))[1]||s[1]&&s[1].length<=u)&&(t=(+t).toFixed(u+1)),c=e[0].split(i),e[0]=c.join(""),(a=e[0]&&e[0].indexOf("0"))>-1)for(;s[0].length<e[0].length-a;)s[0]="0"+s[0];else 0==+s[0]&&(s[0]="");if((t=t.split("."))[0]=s[0],l=c[1]&&c[c.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}}(Sn={exports:{}}),Sn.exports);function On(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}var En={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"},Nn=/%$/,Pn=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Ln=/^\(oct\)/i,Tn=/^\(dec\)/i,jn=/^\(hex\)/i,Fn=/^\(bin\)/i,Rn=/^\(rom\)/i,Hn=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,_n=/#|0/g;function Vn(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 zn(e,t,n){var r=On(e);return n?r:new RegExp(r||"",t)}function Bn(e,t,n){var r,o,i,a,u,l,s,c,f,d,p,h=e.pattern;h.indexOf("A")>=0&&(h=h.replace("A",""),e.abbreviate=!0),d=t,(p=n)&&(p=On(p)),d&&(d=On(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(zn(l,"g"),t)),s=n,n=".",s&&(i=i.replace(zn(s,"g"),n)),c=(c=i.match(/#/g))?c.length:0;var m,v=h.split(s);v[1]&&(m=v[1].match(_n)),e.prefix=a||"",e.postfix=u||"",e.pattern=h,e.maxPrecision=m?m.length:2,e.percentage=Nn.test(h),e.numericPattern=i||"",e.numericRegex=new RegExp("".concat(zn(t,null,!0),"|").concat(zn(n,null,!0)),"g"),e.groupTemp=l,e.decTemp=s,e.t=t,e.d=n,e.temp=c}var Un=function(){function e(t,n,r,o,i){kt(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 En;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 At(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],Hn.test(e[0])&&(r.positive.isFunctional=!0),e[1]?Hn.test(e[1])&&(r.negative.isFunctional=!0):r.negative=!1,e[2]?Hn.test(e[2])&&(r.zero.isFunctional=!0):r.zero=!1,r.positive.isFunctional||Bn(r.positive,t,n),r.negative&&!r.negative.isFunctional&&Bn(r.negative,t,n),r.zero&&!r.zero.isFunctional&&Bn(r.zero,t,n)):this._prepared={pattern:!1}}},{key:"formatValue",value:function(e){var t,n,r,o,i,a,u,l,s,c=this._prepared,f="",d="",p=e;if(isNaN(e))return"".concat(p);if(e=+e,!1===c.pattern)return e.toString();if(0===e&&c.zero)return(c=c.zero).pattern;if(e<0&&c.negative?(c=c.negative,e=-e):c=c.positive,i=c.d,a=c.t,c.isFunctional)e=function(e,t,n){var r;return Pn.test(t)?e=Vn(e,Number(/\d{2}/.exec(t)[0]),t,n):Ln.test(t)?e=Vn(e,8,t,n):Tn.test(t)?e=Vn(e,10,t,n):jn.test(t)?e=Vn(e,16,t,n):Fn.test(t)?e=Vn(e,2,t,n):Rn.test(t)&&(r="",e<0&&(r="-",e=-e),0===(e=Math.floor(e))?e="0":e<=5e5?(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),e=r+e):e=t+r+e.toExponential(0)),e}(e,c.pattern,i);else{if(c.percentage&&(e*=100),c.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<=c.maxPrecision?m=g:h<=n&&!(g>0&&-n<=c.maxPrecision)&&(m=h)),m&&(f=this.abbreviations[m],e/=Math.pow(10,m))}if(r=Math.abs(e),t=c.temp,s=(l=c.numericPattern).split(i)[1],"I"===this.type&&(e=Math.round(e)),o=e,s||"#"!==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,s?s.length:0)).split(".")[0]),b=l.split(i)[0];if(e=An(b+=i,y)||"0",s){var x=Math.max(0,Math.min(14,s.length)),q=s.replace(/#+$/,"").length,w=("I"===this.type?0:r%1).toFixed(x).slice(2).replace(/0+$/,"");for(u=w.length;u<q;u++)w+="0";w&&(e+=i+w)}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=An(l,e)}e=e.replace(c.numericRegex,(function(e){return e===a?c.groupTemp:e===i?c.decTemp:""})),o<0&&!/^-/.test(e)&&(e="-".concat(e))}return c.prefix+e+d+f+c.postfix}}],[{key:"getStaticFormatter",value:function(){return{prepare:function(){},formatValue:function(e){return"".concat(e)}}}}]),e}();function $n(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,s=void 0===l?function(e){return e}:l,c=Object.create(null),f=Object.create(null),d=0,p=0;return(t=u?function(){return n=s.apply(void 0,arguments),t.has(n)?t.get(n):t.set(n,e.apply(void 0,arguments))}:function(r){return n=s(r),t.has(n)?t.get(n):t.set(n,e(r))}).set=function(e,t){return d>=i&&(delete c[f[p]],delete f[p],d--,p++),c[e]=t,f[d]=e,d++,t},t.get=function(e){return c[e]},t.has=function(e){return e in c},t.clear=function(){c=Object.create(null),f=Object.create(null),d=0,p=0},t.size=function(){return d},t}function Kn(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 Tt(Un,t)}(o,e,t,n,r),a=$n(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 Wn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Yn=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Gn=["January","February","March","April","May","June","July","August","September","October","November","December"],Zn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jn(e,t){for(var n=e.length;n<t;n++)e="0".concat(e);return e}function Xn(e){var t=e.toString().split(".");return t[1]?t=Number("0.".concat(t[1])):0}var Qn=function(){function e(t,n,r){kt(this,e);var o,i=t||{};i.qCalendarStrings||(i.qCalendarStrings={qLongDayNames:Wn,qDayNames:Yn,qLongMonthNames:Gn,qMonthNames:Zn}),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=(Ot(o={},"T",i.qTimeFmt||"hh:mm:ss"),Ot(o,"D",i.qDateFmt||"YYYY-MM-DD"),Ot(o,"TS",i.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"),o)[r]),this.pattern=n}return At(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*Xn(t),r=60*Xn(n),o=60*Xn(r),i=1e3*Xn(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,s=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)&&(s=n?n.getDay()-1:0)<0&&(s=6);var c="";return n&&(c=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:s,date:o,h:i,m:a,s:u,f:l,t:c}}(e,t));var l=function(e,t){return{"Y+|y+":{Y:"".concat(Number("".concat(t.year).slice(-2))),YY:Jn("".concat(t.year).slice(-2),2),YYY:Jn("".concat(t.year).slice(-3),3),def:function(e){return Jn("".concat(t.year),e.length)}},"M+":{M:t.month+1,MM:Jn("".concat(t.month+1),2),MMM:e.locale_months_abbr[t.month],def:e.locale_months[t.month]},"W+|w+":{W:t.day,WW:Jn("".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 Jn("".concat(t.date),e.length)}},"h+|H+":{h:t.h,def:function(e){return Jn("".concat(t.h),e.length)}},"m+":{m:t.m,def:function(e){return Jn("".concat(t.m),e.length)}},"s+|S+":{s:t.s,def:function(e){return Jn("".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),s=[];for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s.push(c);var f=new RegExp(s.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 er(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Tt(Qn,t)}function tr(e){return new Date(Date.UTC(1899,11,30+Math.floor(e),0,0,0,Math.round(864e5*(e-Math.floor(e)))))}function nr(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=er(n,e,t),o=$n(r.format.bind(r),{toKey:function(e){return"object"===It(e)&&"function"==typeof e.getTime?e.getTime():e}});function i(e){return"IV"!==t?tr(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=er(n,e,t),o=$n(r.format.bind(r),{toKey:function(e){return"object"===It(e)?e.getTime():e}}),this},a.qtype=function(e){return void 0!==e&&(t=e,o.clear()),t},a}function rr(e,t){if(e&&e.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(e.qNumFormat.qType))return nr(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"),Kn(n,r,o,i,t)}function or(){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,s=t.sourceField,c=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=rr(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 s},items:function(){return e||(e=a(m)),e},min:function(){return n.qMin},max:function(){return n.qMax},value:c,label:f,reduce:d,reduceLabel:h,formatter:function(){return p},tags:function(){return n.qTags}};return m}function ir(e,t,n,r,o){return(t[e]||[]).map((function(t,i){var a="".concat(r?"".concat(r,"/"):"").concat(e,"/").concat(i),u={instance:or(Wt({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:t},o))};return u.attrDims=ir("qAttrDimInfo",t,n,a,Wt({},o,{value:function(e){return e.qElemNo},type:"dimension"})),u.attrExps=ir("qAttrExprInfo",t,n,a,Wt({},o,{value:function(e){return e.qNum},type:"measure"})),u.measures=ir("qMeasureInfo",t,n,a,Wt({},o,{value:function(e){return e.qValue},type:"measure"})),u}))}function ar(){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:[]},s=i;if(!s)throw new Error('Missing "data" input');if(!s.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');var c=ar.util,f={cache:l,cube:s,localeInfo:u.localeInfo,fieldExtractor:null,pages:null,hierarchy:function(){return null},virtualFields:u.virtualFields},d={key:function(){return o},raw:function(){return s},field:function(e){return pn(e,f)},fields:function(){return l.fields.slice()},extract:function(e){return f.extractor(e,d,l,c)},hierarchy:function(e){return f.hierarchy(e,d,l,c)},_cache:function(){return l}};"K"===s.qMode||"T"===s.qMode||!s.qMode&&s.qNodesOnDim?(f.extractor=kn,f.hierarchy=In,f.pages="K"===s.qMode?s.qStackedDataPages:s.qTreeDataPages):"S"===s.qMode?(f.extractor=Jt,f.pages=s.qDataPages,f.hierarchy=In):f.extractor=function(){return[]},f.fieldExtractor=function(e){return f.extractor({field:e},d,l,c)};var p="S"===s.qMode?function(e){return e.qElemNumber}:void 0,h="S"===s.qMode?function(e){return e.qNum}:void 0;(e=l.wrappedFields).push.apply(e,jt(ir("qDimensionInfo",s,o,"",Wt({},f,{value:p,type:"dimension"})))),(t=l.wrappedFields).push.apply(t,jt(ir("qMeasureInfo",s,o,"",Wt({},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=or(Nt({meta:t.raw(),id:"".concat(o,"/").concat(e.key),sourceField:t,fieldExtractor:function(e){return f.extractor({field:e},d,l,c)},key:e.key,type:t.type(),localeInfo:f.localeInfo,value:t.value},e.override||{}));l.virtualFields.push(n)})),(n=l.allFields).push.apply(n,jt(l.virtualFields)),d}var ur=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],lr=/\/qDimensionInfo(?:\/(\d+))?/,sr=/\/qMeasureInfo\/(\d+)/,cr=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,fr=/\/qAttrExprInfo\/(\d+)/,dr=/\/?qHyperCube/,pr=/\/?qTreeData/,hr=function(e){return"".concat(e.substr(0,e.indexOf("/qHyperCubeDef")+14))},mr=function(e){return"".concat(e.substr(0,e.indexOf("/qTreeDataDef")+13))};function vr(e,t){var n=e,r=-1,o=-1,i="",a=function(e){return e};dr.test(e)?(i="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=hr):pr.test(e)&&(i="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=mr);var u=!0;if(lr.test(e)&&(r=+lr.exec(e)[1]),sr.test(e)&&(o=+sr.exec(e)[1]),cr.test(e)){o=-1,r=0;var l=+cr.exec(n)[2];isNaN(l)||(r=l,n=n.replace(/\/\d+$/,"")),u=!1}if(fr.test(e)){var s=o;if(t){o=0;var c=cn(i,t);o+=(c.qMeasureInfo||[]).length,r>-1?(o=c.qDimensionInfo.slice(0,r).reduce((function(e,t){return e+t.qAttrExprInfo.length}),o),r=-1):(o=c.qDimensionInfo.reduce((function(e,t){return e+t.qAttrExprInfo.length}),o),o=c.qMeasureInfo.slice(0,s).reduce((function(e,t){return e+t.qAttrExprInfo.length}),o)),o+=+fr.exec(n)[1]}else r>-1?(r=-1,o=+fr.exec(n)[1]):o+=+fr.exec(n)[1]+1}return ur.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)||Ft(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 gr(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(),s=!1;return e.brushes().forEach((function(e){var t=vr(e.id,r);if("range"===e.type&&t.measureIdx>-1&&t.dimensionIdx>-1){var n=e.brush.ranges();n.length&&(s=!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&&(s=!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 c=e.brush.ranges();c.length&&(s=!0,u.selectHyperCubeContinuousRange||(u.selectHyperCubeContinuousRange={path:t.path,ranges:[]}),c.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})})),s=!!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)})),s=!!u.selectHyperCubeCells.values.length);else{var m=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)}));s=!!m.length,a.push({params:[t.path,t.dimensionIdx,m,!1],method:"selectHyperCubeValues"})}}})),!s&&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 yr(e){ar.util=e.data("matrix").util,e.data("q",ar),e.formatter("q-number",Kn),e.formatter("q-time",nr)}function br(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 xr(){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"===E(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 qr(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))}yr.qBrushHelper=gr,yr.selections=gr;function wr(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=br({layout:n,path:e}),r=o.filter((function(t){return t.key===e})),i=t?[r.pop()]:r;a.push.apply(a,F(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 Dr=function e(t,n){return n[t]?e(t+1,n):t},Mr=function(e,t){var n=t.reduce((function(e,t){return e[t]=!0,e}),{});return e.reduce((function(e,t,r){var o=Dr(r,n);return n[o]=!0,e[r]=o,e}),{})};function Cr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.layout,n=e.filtered,r=void 0===n?{}:n,o=(null==t?void 0:t.qHyperCube)||{},i=o.qDimensionInfo,a=void 0===i?[]:i,u=o.qMeasureInfo,l=void 0===u?[]:u;return{dimensions:Mr(a,r.dimensions||[]),measures:Mr(l,r.measures||[])}}function Ir(e){var t=e.selection,n=e.fieldMap,r=t.method,o=t.params;if("selectHyperCubeValues"===r){var i=n.dimensions[o[1]];void 0!==i&&(o[1]=i)}return"rangeSelectHyperCubeValues"===r&&o[1].forEach((function(e){var t=n.measures[e.qMeasureIx];void 0!==t&&(e.qMeasureIx=t)})),"selectHyperCubeContinuousRange"===r&&o[1].forEach((function(e){var t=n.dimensions[e.qDimIx];void 0!==t&&(e.qDimIx=t)})),t}var kr=[],Sr=0,Ar=function(e){var t=kr.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()})))},Or=function(){document.addEventListener("keyup",Ar)},Er=function(){document.removeEventListener("keyup",Ar)},Nr=function(e,t){Object.keys(t).forEach((function(n){e.on(n,t[n])}))},Pr=function(e,t){Object.keys(t).forEach((function(n){e.removeListener(n,t[n])}))};function Lr(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 Tr(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,s=void 0===l?"rangeClear":l,c=r.event===o,f=n.querySelector("[data-key='".concat(i,"-edge-0']"));if(c||!f)return!1;var d=t.component(i);return!!d&&(d.emit(s),"string"==typeof u&&t.brush(u).clear(),d)}function jr(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 Tr({selectionInfo:t,chart:n,document:r,eventName:void 0!==l&&l?void 0:i,componentName:u,emit:"areaClear",brushName:e.brushName})}function Fr(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 Tr({selectionInfo:t,chart:n,document:r,eventName:void 0!==l&&l?void 0:i,componentName:u,brushName:e.brushName})}function Rr(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,s=void 0!==l&&l,c=e.brushName,f=Tr({selectionInfo:t,chart:n,document:r,eventName:s?void 0:u,componentName:i,brushName:void 0!==c&&c});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 Hr(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;Tr({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 _r(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 Vr(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,s=e.cleared,c=void 0!==s&&s,f=e.brushName;Tr({selectionInfo:t,chart:n,document:r,eventName:c?void 0:a,componentName:l,brushName:void 0!==f&&f})&&o.clear()}var zr=["chart","document","selections","selectionInfo"],Br=function(e){e.chart,e.document,e.selections,e.selectionInfo;var t=T(e,zr);t.clearDiscrete(),t.clearContinuous(),t.clearMinor(),t.clearRange(),t.clearTap(),t.clearLegend()};function Ur(e){var t,n=e.lasso;null!=n&&null!==(t=n.active)&&void 0!==t&&t.call(n)&&(null==n||n.action(!1))}function $r(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 s=(a||{}).lasso,c=void 0!==s&&s,f=o.reset,d=void 0===f?Ur:f,p=o.clear,h=!1!==p&&function(e){var t=e.clear,n=void 0===t?Br: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(A({clearDiscrete:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return jr(A(A({},t),e))},clearContinuous:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fr(A(A({},t),e))},clearMinor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Rr(A(A({},t),e))},clearRange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hr(A(A({},t),e))},clearTap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _r(A(A({},t),e))},clearLegend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vr(A(A({},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:c}),v={};Object.entries(m).forEach((function(e){var t=j(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},s=function(e){return Object.assign(r,e||{})},c=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)(A(A({},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:s})}};return"function"==typeof u?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];u(A(A({defaultFunc:c({event:e,components:t}),setSelectionInfo:s,clear:o},l),{},{event:e,components:t}))}:function(e){c({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=j(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=j(e,2),n=t[0],r=t[1];null==u||u.removeListener(n,r)}))}}var Kr=[{key:"qHyperCube/qDimensionInfo/0:numeric",includeMax:!1}];function Wr(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,s=void 0===l?void 0:l,c=i.selectionActions,f=(c=void 0===c?{}:c).clear,d=c.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,w=void 0!==q&&q,D=i.interceptors,M=void 0===D?{}:D,C=i.selectionsFn,I=void 0===C?o.selections:C,k=t.brush(y);if("number"==typeof x&&k.setMaxListeners(x),w){var S=!0===w?Kr:w;k.configure({ranges:S})}var A={canSelect:!0,getIsSelectionLocked:!1,isInnerDimensionLocked:!1,lockedDimensions:[],singleSelectIndex:0,selectionInfo:{colorField:void 0,components:[],event:void 0,currentComponent:void 0,previousComponent:void 0}},O=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(){},filteredFields:function(){},allowSimultaneous:function(){},release:function(){}};var s=++Sr,c=null,f={dimensions:[],measures:[]},d=[],p={};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 h=wr({brush:r,getConfig:function(){return{layout:c,allowSimultaneous:d}}}),m=h.rangeInterceptor,v=h.interceptor;r.intercept("set-ranges",m),r.intercept("toggle-ranges",m),r.intercept("toggle-values",v),r.intercept("set-values",v),r.intercept("add-values",v),r.on("start",(function(){return n.begin(l)}));var g={activate:function(){},deactivated:function(){return r.end()},cleared:function(){return r.clear()},canceled:function(){return r.end()}};Nr(n,g);var y=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&&(p=(e=i.select).getBrushOptions.apply(e,arguments))})),i.select.on("end",(function(){var e=a(r,p,c),t=Cr({layout:c,filtered:f});e.forEach((function(e){var r=Ir({selection:e,fieldMap:t});Lr(r,i.select.brushSelectionIncludeMax,y),n.select(r)}))}))):r.on("update",(function(){var e=a(r,p,c),t=Cr({layout:c,filtered:f});e.forEach((function(e){n.select(Ir({selection:e,fieldMap:t}))}))})),0===kr.length&&Or(),kr.push({key:s,selections:n}),{layout:function(e){c=e},filteredFields:function(e){f=e},allowSimultaneous:function(e){d=e},release:function(){c=null;var e=kr.indexOf(kr.filter((function(e){return e.key===s}))[0]);-1!==e&&kr.splice(e,1),kr.length||Er(),Pr(n,g)}}}({brush:k,majorScale:s,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=j(e,2),r=n[0],o=n[1];(Array.isArray(o)?o:[o]).forEach((function(e){t.intercept(r,e)}))}))}({brush:k,interceptors:M});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=j(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=j(e,2),r=n[0],o=n[1];t.removeListener(r,o)}))}}({brush:r,chart:t,selectionInfo:i,brushEvents:e.brushEvents}),s=$r({chart:t,selectionInfo:i,selectionActions:n,actions:o,selections:a,selectionEvents:u}),c=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(),s(),c()}}({chart:t,brush:k,actions:n,selections:r,selectionInfo:A.selectionInfo,selectionActions:{clear:f,reset:d},selectionEvents:h,brushEvents:v});if(u){var N=!0===u?F(Array(15)).map((function(e,t){return"qHyperCube/qMeasureInfo/".concat(t)})):u;O.allowSimultaneous(N)}return{unbindEvents:E,state:A,picassoSelections:O,brush:k}}var Yr=["colorField","useLegendCube"];function Gr(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=Wr({chart:t,actions:o,selections:n,picassoQ:yr,config:a}),l=u.unbindEvents,s=u.state,c=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?qr:v;return{getIsDimensionLocked:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return s.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:xr(r)},getIsSingleSelect:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.singleSelectIndex;return s.singleSelectDimensions[e]},getCanSelect:function(){return s.canSelect},getSelectionInfo:function(){return s.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,s=void 0===l?[]:l;return u.lockedDimensions=s.map((function(e){return!!e.qLocked})),u.singleSelectDimensions=s.map((function(e,t){return br({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===s.length||s.some((function(e){return!e.qLocked})),u.dimensionLocked=!(null===(r=s[0])||void 0===r||!r.qLocked),u}({selections:n,picassoSelections:c,layout:e});Object.assign(s,t)},setFilteredFields:function(e){c.filteredFields(e)},setBrushAliases:function(e){var t=e.colorField,n=e.useLegendCube,r=void 0!==n&&n,o=T(e,Yr),i=A({useLegendCube:r,colorField:t,brush:f,legendAlias:m},o);g(A(A({},i),{},{defaultFunc:function(){return qr(i)}}))},destroy:function(){l(),c.release()},custom:A({},p)}}function Zr(e){const t=e.node.desc&&e.node.desc.share;return t?e.formatter("share")(t):""}function Jr(e){return e.formatter("num")(e.node.data.num.value)}function Xr({data:e}){return e?e.label:""}function Qr(e){if(e.dataPoint.auto)return Zr;switch(e.dataPoint.labelMode){case"share":return Zr;case"value":return Jr;case"none":return null;default:return Zr}}function eo(e,t,n){const r=(n,r=1)=>({component:"fun",selector:n,strategy:{type:"rows",settings:{align:r,fill:".labelCenter"===n?({node:e})=>t.getContrastingColorTo(e.desc.fill):t.getStyle("","","color"),labels:".labelCenter"===n?[{label:Qr(e)}]:[{label:Xr}],linkData:t=>".labelCenter"===n?"none"===e.dataPoint.labelMode?Math.random():`${t.data.value} ${Qr(e)(t)}`:`${t.data.value} ${Xr(t)}`}}});return{key:"funnel-labels",type:"labels",layout:{displayOrder:2},settings:{sources:[r(".labelLeft",0),r(".labelCenter",.5)]},animations:{enabled:n,trackBy:e=>e.data}}}function to(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 no({picasso:e}){const t=n(),c=r(),f=o(),d=i(),p=a(),h=u(),[m,v]=l(),[g,y]=l(),[b,x]=l(),[q,w]=l();return s((()=>{const n=function(e){var t,n,r,o,i=e.picasso,a=e.model,u=e.app,l=e.translator,s=e.layoutService,c=void 0===s?void 0:s,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,w=void 0===q?void 0:q,D=h.definitionPath,M=null==c||null===(t=c.getLayout)||void 0===t?void 0:t.call(c),C={theme:x,key:y,localeInfo:g,layout:M,hc:null==c||null===(n=c.getHyperCube)||void 0===n?void 0:n.call(c),legendProps:null==c||null===(r=c.getLayoutValue)||void 0===r?void 0:r.call(c,"legend"),colorProps:A(A({},null==c||null===(o=c.getLayoutValue)||void 0===o?void 0:o.call(c,"color")),{},{useBaseColors:M?xt(M):void 0})},I=yt({picasso:i,model:a,app:u,translator:l,auto:w});!1!==w&&I.auto((function(e){return w?w({layout:e,defaultAuto:Dt}):Dt(e)}));var k=!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(D)},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 k},custom:A({},v),initialize:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,t=(void 0===e?d:e)({getUseBaseColors:xt}),n=qt(C,t);return I.config(n),I.getAuxiliarySettings(D).then((function(){k=!0}))}}}({picasso:e,model:f,app:d,translator:p,config:{auto:!1,key:"fill"}});t.style.overflow="hidden";const r=e({renderer:{prio:[h.renderer||"svg"]}}).chart({element:t,data:[],settings:{}}),o=Gr({chart:r,selections:c,config:{selectionActions:!1}});return x(o),y(n),v(r),w(function(){var e={};return{get:function(t){return e[t]},set:function(t,n){return e[t]=n,n},has:function(t){return t in e},remove:function(t){delete e[t]},empty:function(){e={}}}}()),()=>{o.destroy(),r.destroy()}}),[]),[m,g,b,q]}function ro({picasso:e,flags:t}){const n=c(),r=f(),o=d(),i=p(),a=h(),l=m().qLocaleInfo,[y,b,x,q]=no({picasso:e,layout:n}),w=u(),D=()=>{const e=y.element.clientWidth!==q.get("width")||y.element.clientHeight!==q.get("height");return!1!==w.chartAnimations&&t.isEnabled("IM_1355_ANIMATIONS_FUNNEL")&&!o.active&&!e},[M]=v((()=>{if(!b)return Promise.resolve();const t=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 P(O().mark((function e(){var r,a,u,l;return O().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=P(O().mark((function e(n){var r;return O().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(A({},o));case 4:if("object"===E(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(A({},o))}))),e.next=6,Promise.all([a,u]);case 6:l=e.sent,i.initialized=!0,(r=i.definitions).push.apply(r,F(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=j(e.filter((function(e){return e.key&&e.key===t.key})),1)[0];if(n){var r=Y(!0,{},n.brush);Y(!0,n,t),t.brush&&(n.brush=function(e,t){return"object"===E(e)&&Object.keys(e).length?(Array.isArray(t.consume)&&(e.consume=Ct({originalArray:e.consume,newArray:t.consume,matchKey:"context"})),Array.isArray(t.trigger)&&(e.trigger=Ct({originalArray:e.trigger,newArray:t.trigger,matchKey:"on"})),e):t}(r,t.brush))}else e.push(t)})),e):e}}}({picassoInstance:e,plugins:a,pluginArgs:t});return Promise.all([b.initialize({createConfig:({getUseBaseColors:e})=>({theme:r,colorProps:{...n.color,useBaseColors:e(n)},layout:n,hc:n.qHyperCube})}),o.initialize()]).then((()=>o))}),[n,b]);s((()=>{if(!y||!b||!M)return;const e=[{type:"q",key:"qHyperCube",data:n.qHyperCube,config:{localeInfo:l}},...b.getData()],t=function({layout:e,constraints:t,colorService:n,theme:r,pluginService:o,animationsEnabled:i}){const a=function(e){return{...e.getScales()}}(n),u=n.getPalettes(),l=[function({layout:e,constraints:t,colorService:n,animationsEnabled:r}){const o=n.getDatumProps(),i=n.getColor();return{type:"funnel",key:"fun",data:{extract:{field:"qDimensionInfo/0",props:{num:{field:"qMeasureInfo/0"},...o}}},brush:t.select||t.active?{}:{trigger:[{contexts:["selection"],data:[""]}],consume:[{context:"selection",filter:e=>"section"===e.tag,style:{inactive:{opacity:.3}}}]},settings:{num:{ref:"num"},fill:i,mode:e.funnel.mode},animations:{enabled:r,isMainComponent:!0,trackBy:e=>`${e.tag}: ${e.data.value}`}}}({layout:e,constraints:t,colorService:n,animationsEnabled:i}),eo(e,r,i),to(e)];return{palettes:u,style:{"$font-family":r.getStyle("","","fontFamily"),"$font-color":r.getStyle("","","color"),"$font-size":r.getStyle("","","fontSize")},scales:a,components:o.extendComponents(l),formatters:{share:{type:"d3-number",format:".1%"},num:{data:{field:"qMeasureInfo/0"}}}}}({layout:n,constraints:o,colorService:b,theme:r,pluginService:M,animationsEnabled:D});y.update({data:e,settings:t}),q.set("width",y.element.clientWidth),q.set("height",y.element.clientHeight)}),[y,b,r.name(),M,o]),s((()=>{y&&(y.update(),q.set("width",y.element.clientWidth),q.set("height",y.element.clientHeight))}),[i.width,i.height]),s((()=>{x&&x.setLayout(n)}),[n]),g((e=>b.getSnapshotData().then((t=>(e.snapshotData=e.snapshotData||{},e.snapshotData.content=e.snapshotData.content||{},e.snapshotData.content.chartData=t,e))).catch((()=>e))))}function oo(n){const r=e();r.use(t),r.component("funnel",M);const{flags:o}=n;return{ext:I,qae:{properties:{initial:C},data:{targets:k}},component(){ro({picasso:r,flags:o})}}}export{oo as default};