{"templates":{"body.html":"
\n\t
\n
\n","body/table.html":"
\n","options.html":"
\n
\n\t
\n
\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n"},"js":"!function(e){\"use strict\";var t=function(e,t){new t(e)};e.controller(\"reporting.pivottable.controllers.main\",[\"$scope\",\"reporting.pivottable.services.widgetBuilder\",t])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.directive(\"reporting.pivottable.display\",[\"$sce\",\"$timeout\",\"reporting.pivottable.services.tableHTMLGenerator\",\"reporting.widgetBase.scrollShadowService\",function(e,t,n,r){return{templateUrl:\"reporting/pivottable/templates/body/table.html\",scope:{data:\"=\",sizing:\"=\",resizingService:\"=\",dashboardEditing:\"=\"},link:function(i,a){var o=function(o,s){i.data&&i.data.dataTree&&(i.resizingService.disable(),i.tablehtml=e.trustAsHtml(n.generateHTML(i.data.dataTree,i.sizing)),i.dashboardEditing&&t(i.resizingService.enable,0,!1),t(function(){var e=a.parent(\".widget-body\");r.addScrollShadows(e,{top:0})},0,!1),s())},s=i.$on(\"dataUpdated\",o);a.on(\"$destroy\",function(){s(),i.$destroy()})}}}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.configurationValidation\",[function(){var e={};return e.hasSameDimension=function(e){var t=_.countBy(e,function(e){return e.field}),n=_.some(t,function(e){return e>1});return n},e}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.value(\"reporting.pivottable.services.constants\",{ENUMERABLE_SCALAR_VALUE:\"EnumerableScalarValue\",EMPTY_LABEL:\"\",ROW:\"Row\",COLUMN:\"Column\",MEASURE_PREFIX:\"M\",DIMENSION_PREFIX:\"E\",MAX_DATA_POINTS:8e3,VALIDATION_ERROR:{INVALID_TREE_DEPTH:\"INVALID_TREE_DEPTH\",INVALID_ROW_COLOUMN_ORDER:\"INVALID_ROW_COLOUMN_ORDER\",TOO_MANY_POINTS:\"TOO_MANY_RECORDS_ADD_FILTERS\"}})}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.dataTreeToTable\",[\"reporting.widget-base.options.measuresHelpers\",\"reporting.pivottable.services.matrixUtils\",\"reporting.pivottable.services.constants\",function(e,t,n){function r(e,t){function n(e,t,n){return t&&e.push(n),e}var r=[],i=[];return _.forEach(e,function(e,n){_.forEach(e,function(e,a){var o=t(e);r[n]=o&&r[n]!==!1,i[a]=o&&i[a]!==!1})}),{emptyRows:_.reduce(r,n,[]),emptyColumns:_.reduce(i,n,[])}}function i(e,t,n){var r=o(n);_.forEach(r,function(n){e.splice(n,1),s(t,n)})}function a(e,t,n){var r=o(n);_.forEach(r,function(n){_.forEach(e,function(e){e.splice(n,1)}),u(t,n)})}function o(e){return e.slice(0).sort(function(e,t){return t-e})}function s(e,t){var r=e.splice(t,1),i=e[t],a=r[0];if(i&&i.length&&a&&a.length)for(var o=0;or)?n(e,r+1):{}}))};return n(e,1)},c.extractRowsTreeKey=function(e){var t=_.filter(e.dimensions,{direction:n.ROW}).length;return c.extractTreeKeys(e.keyTree,t)},c.extractSubtreeAtDepth=function(e,t){var n=function(e,r){var i=_.keys(e);return 0===i.length?{}:r==t?e:n(e[i[0]],r+1)};return n(e,1)},c.extractColumnsTreeKey=function(e){var t=_.filter(e.dimensions,{direction:n.ROW}).length,r=c.extractSubtreeAtDepth(e.keyTree,1+t);return c.extractTreeKeys(r,void 0)},c.treeKeysToTable=function(e,t,r){var i=[],a=function(e,o){_.isUndefined(i[o])&&(i[o]=[]);var s=_.keys(e),u=_.sortBy(s,function(e){return t[e].order});_.forEach(u,function(s,u){var c=e[s],l=r(t[s]);i[o].push(l),0!==u&&_.forEach(_.range(o),function(e){i[e].push(n.EMPTY_LABEL)}),_.isPlainObject(c)&&!_.isEmpty(c)&&a(c,o+1)})};return a(e,0),i},c.treeToTableParts=function(e,n,r,i,a){var o=c.treeToTableData(e,n),s=c.extractRowsTreeKey(e),u=c.treeKeysToTable(s,e.keyInfo,i),l=t.transpose(u),f=c.extractColumnsTreeKey(e),d=c.treeKeysToTable(f,e.keyInfo,a),p={table:o,rowLabels:l,colLabels:d};return e.hideEmptyData&&(p=c.hideEmptyData(p,r)),p},c.treeToCSVTable=function(n){var r=function(t,n){return e.formatValue(t.value,n)},i=function(e){return!e&&0!==e},a=function(e){return e.label},o=c.treeToTableParts(n,r,i,a,a),s=t.uniform(t.nrows(o.colLabels),t.ncols(o.rowLabels)),u=t.flattenBlockMatrix([[s,o.colLabels],[o.rowLabels,o.table]]);return u},c.hideEmptyData=function(e,t){var n=r(e.table,t);return i(e.table,e.rowLabels,n.emptyRows),a(e.table,e.colLabels,n.emptyColumns),e},c}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.dataTree\",[\"$filter\",\"reporting.widgetBase.idGeneratorUtil\",\"reporting.pivottable.services.constants\",\"reporting.pivottable.services.adjustedResiduals\",function(e,t,n,r){function i(e){return _.isObject(e)?_.reduce(_.map(_.values(e),i),f,1):1}var a={},o=e(\"translate\");a.expandTreeLeaves=function(e,t){if(_.isPlainObject(t)){var n={};return _.forEach(t,function(t,r){n[r]=a.expandTreeLeaves(e,t)}),n}return _.isArray(e)&&_.isArray(t)?_.zipObject(e,t):_.isString(e)&&!_.isArray(t)?_.zipObject([e],[t]):{}};var s=function(e,t){var i,o,s=_.cloneDeep(e.dimensions),u=a.extractKeysByLevel(t.data),c=a.treeKeysToTreeKeyInfo(u,e.dimensions),l=c.treeKeyInfo,f=c.keyRemap,d=a.convertTreeKeys(t.data,f);_.isUndefined(e.values)||_.isUndefined(e.values.index)||-1===e.values.index?0===_.filter(s,{direction:n.COLUMN}).length?(o=n.COLUMN,i=s.length):0===_.filter(s,{direction:n.ROW}).length?(o=n.ROW,i=0):(o=n.COLUMN,i=s.length):(i=e.values.index,o=e.values.direction);var p={fieldName:\"Values\",direction:o},g=a.measuresToTreeKeyInfo(e.measures),v=g.treeKeyInfo,h=g.measureIds,m=a.expandTreeLeaves(h,d);l=_.merge(v,l);var T=a.generateKeyTree(l,i);s.splice(i,0,p);var b=s.length,y=b-i-1;m=a.shiftLeavesUpLevels(m,y);var E=new r(e,t.significanceTesting,f[0]),w={dimensions:s,data:m,keyInfo:l,keyTree:T,adjustedResiduals:E};return w},u=function(e){var t={fieldName:\"ValuesLabel\"},r={label:o(\"VALUES\"),type:\"display\"};return 0===_.filter(e.dimensions,{direction:n.ROW}).length&&(t.direction=n.ROW,e.dimensions.splice(0,0,t),e.data={V:e.data},e.keyTree={V:e.keyTree},e.keyInfo.V=r),0===_.filter(e.dimensions,{direction:n.COLUMN}).length&&(t.direction=n.COLUMN,e.dimensions.push(t),e.data=a.expandTreeLeaves(\"V\",e.data),e.keyTree=a.expandTreeLeaves(\"V\",e.keyTree),e.keyInfo.V=r),e};a.fromConfigResults=function(e,t,n){var r,i=s(e,t);return i=u(i),n&&(i.hideEmptyData=!!n),r=a.hasValidationError(i),r?{valid:!1,error:r}:{valid:!0,dataTree:i}},a.treeDepth=function(e){var t=_.keys(e);return _.isPlainObject(e)&&!_.isEmpty(e)?1+a.treeDepth(e[t[0]]):0};var c=function(e){var t=e.dimensions.map(function(e){return e.direction}),r=_.reduce(t,function(e,t){return{Count:e.Count+(e.LastDirection!==t),LastDirection:t}},{Count:0,LastDirection:n.ROW});return 1===r.Count},l=function(e){return a.treeDepth(e.data)===e.dimensions.length},f=function(e,t){return e+t},d=function(e){return i(e.data)=n&&(t=n-1);var r=_.cloneDeep(e);return _.forEach(_.range(t),function(e){var t=n-1-e;r=a.flipTreeAtDepth(r,t)}),r},a.extractKeysByLevel=function(e){var t=function(e){if(!_.every(e,_.isPlainObject))return[];var n=_(e).map(function(e){return _.keys(e)}).flatten().uniq().value(),r=_(e).map(function(e){return _.values(e)}).flatten().value(),i=t(r);return i.unshift(n),i};return t([e])},a.treeKeysToTreeKeyInfo=function(e,t){var r={},i=[];return _.forEach(e,function(e,a){i[a]={};var o=t[a],s=e.sort(function(e,t){return o.type===n.ENUMERABLE_SCALAR_VALUE?parseFloat(e)-parseFloat(t):(\"\"+e).localeCompare(t)});_.forEach(s,function(e,t){var s=[n.DIMENSION_PREFIX,a.toString(),e].join(\"_\");r[s]={label:o.valueInfo[e]&&o.valueInfo[e].label||e,order:t,level:a,type:\"dimension\"},i[a][e]=s})}),{treeKeyInfo:r,keyRemap:i}},a.measuresToTreeKeyInfo=function(e){var r={},i=[];return _.forEach(e,function(e,a){e.hasOwnProperty(\"_id\")||(e._id=t(n.MEASURE_PREFIX)),i.push(e._id),r[e._id]=e,r[e._id].order=a,r[e._id].type=\"measure\"}),{treeKeyInfo:r,measureIds:i}},a.convertTreeKeys=function(e,t){var n=function(e,r){var i=_(e).map(function(e,i){return _.isPlainObject(e)?[t[r][i],n(e,1+r)]:[t[r][i],e]});return\"4\"===_.VERSION[0]?i.fromPairs().value():i.zipObject().value()};return _.isPlainObject(e)?n(e,0):e},a.generateKeyTree=function(e,t){function r(e,r){var i;return e.substring(0,1)===n.MEASURE_PREFIX?i=t:(i=r.level,i>=t&&i++),i}function i(e,t){return a[t]?(_.forEach(a[t],function(n,r){e[r]=i(n,t+1)}),e):null}var a=[];_.forEach(e,function(e,t){var n=r(t,e);a[n]||(a[n]={}),a[n][t]={}});var o=i({},0);return o},a}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.matrixUtils\",[function(){var e={};e.isValid=function(e){if(!_.isArray(e)||_.isEmpty(e)||!_.every(e,function(e){return _.isArray(e)}))return!1;var t=e[0].length;return _.every(e,function(e){return e.length==t})?!0:!1},e.transpose=function(t){if(!e.isValid(t))return[[]];var n=t.length,r=t[0].length,i=[];return _.forEach(_.range(r),function(e){i[e]=[],_.forEach(_.range(n),function(n){i[e][n]=t[n][e]})}),i},e.uniform=function(e,t,n){_.isUndefined(n)&&(n=\"\");var r=[];return _.forEach(_.range(0,e),function(){var e=[];r.push(e),_.forEach(_.range(0,t),function(){e.push(n)})}),r},e.nrows=function(t){return e.isValid(t)?t.length:-1},e.ncols=function(t){return e.isValid(t)?t[0].length:-1},e.isValidBlockMatrix=function(t){if(!_.every(t,function(t){return _.every(t,function(t){return e.isValid(t)})}))return!1;var n=function(e,t){return _.every(e,function(e){var n=t(e[0]);return _.every(e,function(e){return n==t(e)})})};return n(t,e.nrows)&&n(e.transpose(t),e.ncols)?!0:!1};var t=function(){var e=[];return _.forEach(arguments,function(t){_.forEach(t,function(t){e.push(t)})}),e};return e.hstack=function(){return _.zip.apply(null,arguments).map(function(e){return t.apply(null,e)})},e.flattenBlockMatrix=function(t){var n=_(t).map(function(t){return e.hstack.apply(null,t)}).flatten(\"2\"==_.VERSION.split(\".\")[0]).value();return n},e.mergeBlankRows=function(t){for(var n,r,i,a,o=_.map(t,function(e){return _.map(e,function(e){return[[e]]})}),s=e.nrows(o),u=e.ncols(o),c=u-1;c>=0;c--)for(n=0;s>n;){for(r=n+1;s>r&&\"\"===o[r][c][0][0];)r+=1;r-n>1&&(i=r-n,a=e.uniform(i,1),a[0][0]=o[n][c][0][0],o[n][c]=a,_.forEach(_.range(n+1,r),function(e){o[e][c]=[[]]})),n=r}return o},e.mergeBlankCols=function(t){var n=_.map(t,function(e){return _.map(e,function(e){return[[e]]})}),r=function(e){return _.every(e,function(e){return _.every(e,function(e){return\"\"===e})})},i=e.ncols(t),a=function(t){for(var n,a=0;i>a;){for(n=a+1;i>n&&e.ncols(t[n])>0&&r(t[n])&&e.nrows(t[a])==e.nrows(t[n]);)n+=1;_.forEach(_.range(a+1,n),function(n){t[a]=e.hstack(t[a],t[n])}),_.forEach(_.range(a+1,n),function(e){t[e]=[[]]}),a=n}return t},o=_.map(n,a);return o},e}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.adjustedResiduals\",[\"reporting.significanceTesting.adjustedResidual.significanceTest\",function(e){function t(e,t){var n={};return t=t||{},_.forEach(e,function(e,r){n[r]={},_.forEach(e,function(e,i){var a=t[i];a&&(n[r][a]=e)})}),n}function n(e,t){return _.findLast(t,function(t){return t!==e&&\"V\"!==t})}var r=function(e,n,r){this.configData=e,this.remappedAdjustedResiduals=t(n,r)||{}};return r.prototype.getSignificance=function(t,r){var i=n(t,r),a=this.getAdjustedResidual(t,i),o=this.getConfidenceInterval(t);return e.getSignificance(a,o)},r.prototype.getAdjustedResidual=function(e,t){return(this.remappedAdjustedResiduals[e]||{})[t]},r.prototype.getConfidenceInterval=function(e){var t=_.find(this.configData.measures,{_id:e})||{};return(t.significanceTesting||{}).confidenceInterval},r}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.significanceTesting\",[\"$q\",\"reporting.significanceTesting.adjustedResidual.topBottomBox\",function(e,t){function n(n,r,i){var a={};return _.forEach(n.data.measures,function(e){var o=e._id;e.significanceTesting=e.significanceTesting||{},e.significanceTesting.enabled&&t.canCalculateAdjustedResidualsForMeasure(n,e)&&(a[o]=t.getAdjustedResidualsForMeasure(i,n,e,r))}),e.all(a)}return{makeDataRequests:n}}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.tableHTMLGenerator\",[\"dashboards.api.sanitize\",\"reporting.widgetBase.options.formatRulesService\",\"reporting.widget-base.options.measuresHelpers\",\"reporting.pivottable.services.dataTreeToTable\",\"reporting.pivottable.services.matrixUtils\",\"reporting.significanceTesting.indicatorGenerator\",function(e,t,n,r,i,a){var o={};o.dataTreeToMergedTable=function(e){var o=function(e,r){var i=n.formatValue(e.value,r);(\"\"===i||null===i)&&(i=\"-\");var o=e.significance||{},s=a.getIndicatorHTML(o.level,o.direction)||\"\",u={Raw:e.value,Value:s+i,Class:\"data\",Style:t.getStylesForValue(r.rules,e.value)},c=[[u]];return c},s=function(e){return!e.length||!e[0].length||null===e[0][0].Raw||\"\"===e[0][0].Raw},u=function(e,t){return{Value:t.label,Class:e}},c=_.partial(u,\"rowLabel\"),l=_.partial(u,\"colLabel\"),f=r.treeToTableParts(e,o,s,c,l),d=i.uniform(i.nrows(f.colLabels),i.ncols(f.rowLabels),[[]]);d[0][0]=i.uniform(i.nrows(f.colLabels),i.ncols(f.rowLabels),\"\"),d[0][0][0][0]={Value:\"\",Class:\"colLabel\"};var p=i.mergeBlankRows(f.rowLabels),g=i.mergeBlankCols(f.colLabels),v=g?g.length>1:!1,h=[];if(v){g[0].forEach(function(e,t){e[0][0]&&e[0][0].Value&&(g.forEach(function(e,n){e[t][0][0].Class+=\" columnBorder\"}),h.push(t))});const m=g.length-1;g.forEach(function(e,t){t!=m&&e.forEach(function(t,n){e[n][0][0]&&(e[n][0][0].Class+=\" outerColLabel\")})})}f.table.forEach(function(e){e.forEach(function(e,t){h.includes(t)&&(e[0][0].Class?e[0][0].Class+=\" columnBorder\":e[0][0].Class=\" columnBorder\")})});var T=[[d,g],[p,f.table]],b=i.flattenBlockMatrix(T);return b};var s=function(e,t,n){if(t.length>0){var r=_.map(t,function(e){return e.Attribute+'=\"'+e.Value+'\"'}).join(\" \");return\"<\"+e+\" \"+r+\">\"+n+\"\"}return\"<\"+e+\">\"+n+\"\"},u=function(t){var n=_(t).filter(function(e){return i.nrows(e)>0&&i.ncols(e)>0}).map(function(t){var n=t[0][0],r=n.Class&&\"data\"!==n.Class?e:_.identity,a={Value:r(n.Value),Height:i.nrows(t),Width:i.ncols(t)};if(n.Class&&(a.Class=n.Class),n.Style){var o=_(n.Style).map(function(e,t){return t+\": \"+e}).join(\"; \");a.Style=o}return a}),r=n.map(function(e,t){var n=[];return e.Height>1&&n.push({Attribute:\"rowspan\",Value:e.Height}),e.Width>1&&n.push({Attribute:\"colspan\",Value:e.Width}),e.Class&&n.push({Attribute:\"class\",Value:e.Class}),e.Style&&n.push({Attribute:\"style\",Value:e.Style}),s(\"td\",n,e.Value)}).join(\"\\n\");return\"\\n\"+r+\"\\n\"},c=function(e,t){for(var n=[],r=e&&e[0]&&e[0].length||0,i=0;r>i;i++){var a=[{Attribute:\"style\",Value:\"height:0px; padding:0px;\"+l(t[i])}];n.push(s(\"th\",a,\"\"))}var o=s(\"tr\",[],\"\\n\"+n.join(\"\\n\")+\"\\n\");return s(\"thead\",[],\"\\n\"+o+\"\\n\")},l=function(e){return e?\" width:\"+e+\";\":\"\"};return o.mergedTableToHTML=function(e,t,n){t||(t=[]);var r=c(e,n),i=_(e).map(u).map(_.partial(s,\"tr\",[])).join(\"\\n\");return i+=\"\\n\",i=s(\"table\",t,\"\\n\"+r+\"\\n\"+i+\"\\n\")},o.generateHTML=function(e,t){var n=o.dataTreeToMergedTable(e),r=[{Attribute:\"class\",Value:\"qstrap simple-table response-table resizable-table\"}];_.isEmpty(t)||r.push({Attribute:\"style\",Value:\"table-layout:fixed\"});var i=o.mergedTableToHTML(n,r,t);return i},o}])}(angular.module(\"ripsaw.widgets\")),function(e){\"use strict\";e.factory(\"reporting.pivottable.services.widgetBuilder\",[\"$filter\",\"$sce\",\"$q\",\"$timeout\",\"reporting.widgetBase.widgetFactory\",\"reporting.widgetBase.checkMeasureConfig\",\"reporting.widget-base.options.measuresHelpers\",\"reporting.pivottable.services.dataTree\",\"reporting.pivottable.services.dataTreeToTable\",\"reporting.pivottable.services.configurationValidation\",\"reporting.pivottable.services.constants\",\"reporting.pivottable.services.significanceTesting\",\"reporting.widgetBase.tableColResizingService\",\"reporting.significanceTesting.SIGNIFICANCE_TYPES\",\"reporting.significanceTesting.SIGNIFICANCE_METRICS\",function(e,t,n,r,i,a,o,s,u,c,l,f,d,p,g){function v(e,t){return!e||!t||h(e.dimensions,t.dimensions)||m(e.measures,t.measures)}function h(e,t){return!angular.equals(e,t)}function m(e,t){return e.length!==t.length}var T=e(\"translate\"),b=function(e){this.$scope=e;var t=_.bind(this.getDSVData,this);this.widget=i.fieldsetWidget(e,{supportLegacySignificanceTesting:!0,exports:{getDSVData:t}}),this.widget.settings.load(),this.widget.settings.watch(),this.$scope.resizingService=d(this.$scope,this.widget.settings),this.$scope.data={},this.init()};return b.prototype.init=function(){angular.extend(this.$scope,{sourceWidgetSettings:{enablePercentOfRowCol:!1,enablePercentOfTotal:!0,measures:{includeConditional:!0,significanceTesting:{defaultType:p.AGGREGATE_SIGNIFICANCE_TESTING,supportedTypes:[p.AGGREGATE_SIGNIFICANCE_TESTING],supportedMetrics:[g.TOP_BOTTOM_BOX]}},dimensions:{defaultValuesRow:!1,showSwap:!0,sortable:!0,x:{max:3,addLabel:T(\"SET_ROW_DIMENSION\"),removeLabel:T(\"REMOVE_ROW\")},y:{max:3,addLabel:T(\"SET_COLUMN_DIMENSION\"),removeLabel:T(\"REMOVE_COLUMN\")},removeUsedDimensionsFromAddMenu:!0}},state:{showMissingValues:!0,sizing:[]}});var e=[\"load\",\"changeData\",\"changePageFilters\",\"changeDashboardEdit\",\"changeState\"],t=this;_.forEach(e,function(e){t.widget.on(e,t[e].bind(t))});var n={\"reporting.filters.filterChanged\":\"filtersChanged\"};_.forEach(n,function(e,n){t.$scope.$on(n,t[e].bind(t))})},b.prototype.load=function(){var e={fieldName:\"Count\",label:T(\"COUNT\"),field:\"_recordId\",type:\"Id\",metric:\"count\",autoGenerateLabel:!0,options:{format:\"number\",decimals:0}};0===this.$scope.config.data.measures.length&&this.$scope.config.data.measures.push(e),this.loadData()},b.prototype.changeData=function(e,t){v(e,t)&&(this.$scope.state.sizing=[]),this.loadData()},b.prototype.changePageFilters=function(){var e=_.head(_.filter(this.$scope.config.data.filters,{type:\"DrillDown\"}));e||o.updateDrillDownMeasures(this.$scope.config.data.measures),this.loadData()},b.prototype.changeDashboardEdit=function(e){e?this.$scope.resizingService.enable():this.$scope.resizingService.disable()},b.prototype.changeState=function(e,t){e.showMissingValues!==t.showMissingValues&&this.loadData()},b.prototype.filtersChanged=function(e,t){this.loadData(),t&&t.filter&&\"DrillDown\"===t.filter.type?o.updateDrillDownMeasures(this.$scope.config.data.measures,t.filter):t&&t.refreshMeasureLabels&&o.updateDrillDownMeasures(this.$scope.config.data.measures)},b.prototype.getDSVData=function(){var e={};return\"NO_DATA\"!==this.widget.status.getStatus().state&&\"MISCONFIGURED\"!==this.widget.status.getStatus().state&&(e=u.treeToCSVTable(this.$scope.data.dataTree)),{json:e}},b.prototype.loadData=function(){if(_.isEmpty(this.$scope.config.data.measures))return void this.widget.status.setNew();var e=this,t=function(t){return _.filter(e.$scope.config.data.dimensions,function(e){return e.direction==t})};this.$scope.config.data.dimensions=t(l.ROW).concat(t(l.COLUMN)),a.containsMisconfiguredMeasures(this.$scope.config.data.measures,this.$scope.config.data.dimensions).then(function(t){return t?n.reject(e.widget.status.setMisconfigured):void 0}).then(function(){return c.hasSameDimension(e.$scope.config.data.dimensions)?n.reject(function(){e.widget.status.setMisconfigured(T(\"NO_SAME_DIMENSION\"))}):void 0}).then(function(){e.widget.status.setLoading(),e.makeDataRequests().then(function(t){var r=e.handleData(t,!1);return r&&!r.valid?n.reject(r.error):void 0},null,function(t){var r=e.handleData(t,!0);return r&&!r.valid?n.reject(r.error):void 0})[\"catch\"](function(t){e.handleError(t)})})[\"catch\"](function(t){e.handleError(t)})},b.prototype.makeDataRequests=function(){var e={dateFormat:\"table\",skipSparseDataFill:!this.$scope.state.showMissingValues},t=f.makeDataRequests(this.$scope.config,e,this.widget.data);return this.widget.data.getCrossFromSource(this.$scope.config.data,e).then(function(e){return t.then(function(t){return e.significanceData&&(e=e.data),{data:e,significanceTesting:t}})},null,function(e){return{data:e,significanceTesting:{}}})},b.prototype.handleData=function(e,t){if(e.data&&_.isEmpty(e.data))return this.widget.status.setNoData(),this.$scope.data={},{valid:!0};var n=s.fromConfigResults(this.$scope.config.data,e,!this.$scope.state.showMissingValues),i=this;if(n.valid){this.$scope.data.dataTree=n.dataTree;var a=function(){t?i.widget.status.setSample():i.widget.status.setOk()};return r(function(){i.$scope.$broadcast(\"dataUpdated\",a)}),n}return n.valid||n.error!==l.VALIDATION_ERROR.TOO_MANY_POINTS?n:{valid:!1,error:function(){i.widget.status.setMisconfigured(T(\"TOO_MANY_DATA_POINTS_ADD_FILTERS\"))}}},b.prototype.handleError=function(e){if(e&&_.isFunction(e))e();else{var t=e.message;this.widget.status.setError(t,e)}},b}])}(angular.module(\"ripsaw.widgets\"));","css":".reporting-pivottable .simple-table{position:relative;border-spacing:0}.reporting-pivottable .simple-table .colLabel,.reporting-pivottable .simple-table .rowLabel{color:#6A6D70;font-weight:600;font-size:12px;line-height:16px}.reporting-pivottable .simple-table .colLabel{text-align:right;border-bottom:1px solid #D9D9D9}.reporting-pivottable .simple-table .colLabel.outerColLabel{text-align:center;border-bottom:none}.reporting-pivottable .simple-table .colLabel.columnBorder{border-left:1px solid #D9D9D9}.reporting-pivottable .simple-table .rowLabel{text-align:left;border-left:none}.reporting-pivottable .simple-table td,.reporting-pivottable .simple-table th{padding:8px 16px}.reporting-pivottable .simple-table thead tr th{border:none}.reporting-pivottable .simple-table td{border-bottom:1px solid #EEEEEF}.reporting-pivottable .simple-table .data{color:#32363A;text-align:right;font-weight:400;font-size:14px;line-height:20px}.reporting-pivottable .simple-table .data.columnBorder{border-left:1px solid #EEEEEF}.reporting-pivottable .simple-table tbody tr:hover td,.reporting-pivottable .simple-table tbody tr:hover th{background:0 0}.reporting-pivottable .table-body{overflow-y:none}.reporting-pivottable .data .significance-indicator{line-height:0;vertical-align:middle}","lang":{}}