<commit_before>/*! orb v0.1.0, Javascript pivot grid library.
 *  (c) <NAME>, 2014-11-23.
 *  Licence: MIT.
 */

orb={},orb.utils={ns:function(a){for(var b=a.split("."),c=window,d=0;d<b.length;)c[b[d]]=c[b[d]]||{},c=c[b[d]],d++;return c},ownProperties:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},isArray:function(a){return"[object Array]"===Object.prototype.toString.apply(a)},findInArray:function(a,b){if(orb.utils.isArray(a)&&b)for(var c=0;c<a.length;c++){var d=a[c];if(b(d))return d}return void 0},jsonStringify:function(a,b){function c(a,c){return b&&b.indexOf(a)>-1?void 0:c}return JSON.stringify(a,c,2)}},function(){function a(a,b,c){for(var d=0;d<b.length;d++)if(null!=b[d][a])return b[d][a];return c}function b(){for(var b=[],c=[],d=[],e=[],f=0;f<arguments.length;f++){var g=arguments[f]||{};b.push(g),c.push(g.sort||{}),d.push(g.subtotal||{}),e.push(g.filter||{})}return{name:a("name",b,""),caption:a("caption",b,""),filter:{type:a("type",e,"operator"),regexp:a("regexp",e,null),operator:a("operator",e,null),value:a("value",e,null)},sort:{order:a("order",c,null),customfunc:a("customfunc",c,null)},subtotal:{visible:a("visible",d,!0),collapsible:a("collapsible",d,!0),collapsed:a("collapsed",d,!1)},aggregatefunc:a("aggregatefunc",b,null),formatfunc:a("formatfunc",b,null)}}function c(a,c,d,e){var f;if(e)switch(c){case orb.axe.Type.ROWS:f=e.rowsettings;break;case orb.axe.Type.COLUMNS:f=e.columnsettings;break;case orb.axe.Type.DATA:f=e.datasettings;break;default:f=null}else f=null;return b(d,f,e,a)}function d(a){a=a||{},this.rowsvisible=void 0!==a.rowsvisible?a.rowsvisible:!0,this.columnsvisible=void 0!==a.columnsvisible?a.columnsvisible:!0}function e(a,b){var c={visible:b===!0?!0:void 0,collapsible:b===!0?!0:void 0,collapsed:b===!0?!1:void 0};a=a||{},this.visible=void 0!==a.visible?a.visible:c.visible,this.collapsible=void 0!==a.collapsible?a.collapsible:c.collapsible,this.collapsed=void 0!==a.collapsed?a.collapsed:c.collapsed}function f(a){a=a||{},this.order=a.order,this.customfunc=a.customfunc}function g(a){a=a||{},this.type=a.type,this.regexp=a.regexp,this.operator=a.operator,this.value=a.value}orb.field=function(a,b){a=a||{},this.name=a.name,this.caption=a.caption||this.name,this.filter=new g(a.filter),this.sort=new f(a.sort),this.subtotal=new e(a.subtotal),this.aggregatefunc=a.aggregatefunc,this.formatfunc=a.formatfunc,b!==!0&&((this.rowsettings=new orb.field(a.rowsettings,!0)).name=this.name,(this.columnsettings=new orb.field(a.columnsettings,!0)).name=this.name,(this.datasettings=new orb.field(a.datasettings,!0)).name=this.name)},orb.config=function(a){function b(a,b){var c=f(a,b);return c>-1?a[c]:null}function f(a,b){for(var c=0;c<a.length;c++)if(a[c].name===b)return c;return-1}var g=this;this.datasource=a.datasource,this.dataheaderslocation="columns"===a.dataheaderslocation?"columns":"rows",this.grandtotal=new d(a.grandtotal),this.subtotal=new e(a.subtotal,!0),this.allfields=(a.fields||[]).map(function(a){return new orb.field(a)}),this.rowfields=(a.rows||[]).map(function(a){return c(g,orb.axe.Type.ROWS,a,b(g.allfields,a.name))}),this.columnfields=(a.columns||[]).map(function(a){return c(g,orb.axe.Type.COLUMNS,a,b(g.allfields,a.name))}),this.datafields=(a.data||[]).map(function(a){return c(g,orb.axe.Type.DATA,a,b(g.allfields,a.name))}),this.datafieldscount=this.datafields?this.datafields.length||1:1,g.availablefields=function(){return g.allfields.filter(function(a){var b=function(b){return a.name!==b.name};return g.datafields.every(b)&&g.rowfields.every(b)&&g.columnfields.every(b)})},this.moveField=function(a,d,e,h){var i,j,k,l=b(g.allfields,a);if(l){switch(d){case orb.axe.Type.ROWS:i=g.rowfields;break;case orb.axe.Type.COLUMNS:i=g.columnfields;break;case orb.axe.Type.DATA:i=g.datafields}switch(e){case orb.axe.Type.ROWS:k=g.rowfields;break;case orb.axe.Type.COLUMNS:k=g.columnfields;break;case orb.axe.Type.DATA:k=g.datafields}if(i||k){if(i){if(j=f(i,a),d===e&&(j==i.length-1&&null==h||j===h-1))return!1;i.splice(j,1)}return l=c(g,e,null,l),k&&(null!=h?k.splice(h,0,l):k.push(l)),g.datafieldscount=g.datafields?g.datafields.length||1:1,!0}}}}}(),function(){orb.dimension=function(a,b,c,d,e,f,g){var h=this;this.id=a,this.parent=b,this.value=c,this.isRoot=f,this.isLeaf=g,this.field=d,this.depth=e,this.values=[],this.subdimvals={},this.rowIndexes=null,this.getRowIndexes=function(a){if(null==h.rowIndexes){this.rowIndexes=[];for(var b=0;b<h.values.length;b++)h.subdimvals[h.values[b]].getRowIndexes(this.rowIndexes)}if(null!=a){for(var c=0;c<h.rowIndexes.length;c++)a.push(h.rowIndexes[c]);return a}return h.rowIndexes}}}(),function(){orb.axe=function(a,b){function c(a){for(var b=0;b<e.fields.length;b++)if(e.fields[b].name===a.name)return b;return-1}function d(){if(null!=e.pgrid.config.datasource&&e.dimensionsCount>0){var a=e.pgrid.config.datasource;if(null!=a&&orb.utils.isArray(a)&&a.length>0)for(var b=0,c=a.length;c>b;b++)for(var d=a[b],g=e.root,h=0;h<e.dimensionsCount;h++){var i=e.dimensionsCount-h,j=e.fields[h],k=d[j.name],l=g.subdimvals;void 0!==l[k]?g=l[k]:(g.values.push(k),g=new orb.dimension(++f,g,k,j,i,!1,h==e.dimensionsCount-1),l[k]=g,g.rowIndexes=[],e.dimensionsByDepth[i].push(g)),g.rowIndexes.push(b)}}}var e=this,f=0;null!=a&&null!=a.config&&(this.pgrid=a,this.type=b,this.fields=function(){switch(b){case orb.axe.Type.COLUMNS:return e.pgrid.config.columnfields;case orb.axe.Type.ROWS:return e.pgrid.config.rowfields;case orb.axe.Type.DATA:return e.pgrid.config.datafields;default:return[]}}(),this.dimensionsCount,this.root,this.dimensionsByDepth,this.update=function(){e.dimensionsCount=e.fields.length,e.root=new orb.dimension(++f,null,null,null,e.dimensionsCount+1,!0),e.dimensionsByDepth={};for(var a=1;a<=e.dimensionsCount;a++)e.dimensionsByDepth[a]=[];d();for(var b=0;b<e.fields.length;b++){var c=e.fields[b];("asc"===c.sort.order||"desc"===c.sort.order)&&e.sort(c,!0)}},this.sort=function(a,b){if(null!=a){b!==!0&&(a.sort.order="asc"!==a.sort.order?"asc":"desc");for(var d=e.dimensionsCount-c(a),f=d===e.dimensionsCount?[e.root]:e.dimensionsByDepth[d+1],g=0;g<f.length;g++)f[g].values.sort(),"desc"===a.sort.order&&f[g].values.reverse()}},this.update())},orb.axe.Type={COLUMNS:1,ROWS:2,DATA:3}}(),function(){orb.pgrid=function(a){function b(a,b,c){var d={};if(g.config.datafieldscount>0){var e;if(null==a)e=b;else if(null==b)e=a;else{e=[];for(var h=0;h<a.length;h++){var i=a[h];if(i>=0){var j=b.indexOf(i);j>=0&&(a[h]=0-(i+2),e.push(i))}}}for(var k=g.config.datasource,l=0;l<g.config.datafieldscount;l++){var m=g.config.datafields[l]||f;if(m.aggregatefunc)d[m.name]=m.aggregatefunc(m.name,e,k,c,b);else{var n=null!=e;if(e=e||k,e.length>0){for(var o=0,p=0;p<e.length;p++){var q=e[p];n?q>=0&&(o+=k[q][m.name]):o+=q[m.name]}d[m.name]=o}}}}return d}function c(a){if(a){var c={},d="r"+a.id;if(void 0===e[d]&&(e[d]=a.isRoot?null:e[a.parent.id]||a.getRowIndexes()),c[g.columns.root.id]=b(a.isRoot?null:e[d].slice(0),null),g.columns.dimensionsCount>0)for(var f=0,h=[g.columns.root];f<h.length;){for(var i=h[f],j=a.isRoot?null:i.isRoot?e[d].slice(0):e["c"+i.id].slice(0),k=0;k<i.values.length;k++){var l=i.subdimvals[i.values[k]],m="c"+l.id;if(void 0===e[m]&&(e[m]=e[m]||l.getRowIndexes().slice(0)),c[l.id]=b(j,e[m],a.isRoot?null:a.getRowIndexes()),!l.isLeaf&&(h.push(l),j)){e[m]=[];for(var n=0;n<j.length;n++){var o=j[n];-1!=o&&0>o&&(e[m].push(0-(o+2)),j[n]=-1)}}}e["c"+i.id]=void 0,f++}return c}}function d(){if(g.dataMatrix={},e={},g.dataMatrix[g.rows.root.id]=c(g.rows.root),g.rows.dimensionsCount>0)for(var a,b=[g.rows.root],d=0;d<b.length;){a=b[d];for(var f=0;f<a.values.length;f++){var h=a.subdimvals[a.values[f]];g.dataMatrix[h.id]=c(h),h.isLeaf||b.push(h)}d++}}var e,f={name:"#undefined#"},g=this;this.config=new orb.config(a),this.rows=new orb.axe(g,orb.axe.Type.ROWS),this.columns=new orb.axe(g,orb.axe.Type.COLUMNS),this.dataMatrix={},this.moveField=function(a,b,c,e){g.config.moveField(a,b,c,e)&&(g.rows.update(),g.columns.update(),d())},this.getData=function(a,b,c){return b&&c?(a=a||(g.config.datafields[0]||f).name,g.dataMatrix[b.id]&&g.dataMatrix[b.id][c.id]?g.dataMatrix[b.id][c.id][a]||null:null):void 0},d()}}(),orb.utils.ns("orb.ui"),function(){function a(a){this.axetype=a.axetype,this.type=a.type,this.template=a.template,this.value=a.value,this.expanded=!0,this.cssclass=a.cssclass,this.hspan=a.hspan||function(){return 1},this.vspan=a.vspan||function(){return 1},this.visible=a.isvisible||function(){return!0}}orb.ui.header=function(b,c,d,e,f,g){function h(){if(m.type===orb.ui.HeaderType.SUB_TOTAL){for(var a=m.parent;null!=a;){if(a.subtotalHeader&&!a.subtotalHeader.expanded)return!1;a=a.parent}return!0}var b=m.dim.isRoot||m.dim.isLeaf||!m.dim.field.subtotal.visible||m.subtotalHeader.expanded;if(!b)return!1;for(var c=m.parent;null!=c&&(!c.dim.field.subtotal.visible||null!=c.subtotalHeader&&c.subtotalHeader.expanded);)c=c.parent;return null==c||null==c.subtotalHeader?b:c.subtotalHeader.expanded}function i(){var a,b=0,c=!1;if(m.visible()){if(m.dim.isLeaf)return f;for(var d=0;d<m.subheaders.length;d++){var e=m.subheaders[d];e.dim.isLeaf?b+=f:(a=n?e.vspan():e.hspan(),b+=a,0===d&&(0===a||n&&e.type===orb.ui.HeaderType.SUB_TOTAL&&!e.expanded)&&(c=!0))}return b+(c?1:0)}return b}var j,k,l,m=this,n=b===orb.axe.Type.ROWS;switch(c=c||(1===d.depth?orb.ui.HeaderType.INNER:orb.ui.HeaderType.WRAPPER)){case orb.ui.HeaderType.GRAND_TOTAL:l="Grand Total",j=n?d.depth-1||1:f,k=n?f:d.depth-1||1;break;case orb.ui.HeaderType.SUB_TOTAL:l="Total "+d.value,j=n?d.depth:f,k=n?f:d.depth;break;default:l=d.value,j=n?1:null,k=n?null:1}a.call(this,{axetype:b,type:c,template:n?"cell-template-row-header":"cell-template-column-header",value:l,cssclass:orb.ui.HeaderType.getHeaderClass(c,b),hspan:null!=j?function(){return j}:i,vspan:null!=k?function(){return k}:i,isvisible:h}),this.subtotalHeader=g,this.parent=e,this.subheaders=[],this.dim=d,this.expanded=c!==orb.ui.HeaderType.SUB_TOTAL||!d.field.subtotal.collapsed,this.expand=function(){m.expanded=!0},this.collapse=function(){m.expanded=!1},null!=e&&e.subheaders.push(this)},orb.ui.dataHeader=function(b,c){a.call(this,{axetype:null,type:orb.ui.HeaderType.DATA_HEADER,template:"cell-template-dataheader",value:b,cssclass:orb.ui.HeaderType.getHeaderClass(c.type),isvisible:c.visible}),this.parent=c},orb.ui.dataCell=function(b,c,d,e){var f=d.type===orb.ui.HeaderType.DATA_HEADER?d.parent.dim:d.dim,g=e.type===orb.ui.HeaderType.DATA_HEADER?e.parent.dim:e.dim,h=d.type===orb.ui.HeaderType.DATA_HEADER?d.parent.type:d.type,i=e.type===orb.ui.HeaderType.DATA_HEADER?e.parent.type:e.type,j=b.config.datafieldscount>1?"rows"===b.config.dataheaderslocation?d.value:e.value:b.config.datafields[0];a.call(this,{axetype:null,type:orb.ui.HeaderType.DATA_VALUE,template:"cell-template-datavalue",value:b.getData(j.name,f,g),cssclass:"cell "+orb.ui.HeaderType.getCellClass(h,i),isvisible:c}),this.datafield=j},orb.ui.buttonCell=function(b){a.call(this,{axetype:null,type:orb.ui.HeaderType.FIELD_BUTTON,template:"cell-template-fieldbutton",value:b,cssclass:orb.ui.HeaderType.getHeaderClass(orb.ui.HeaderType.FIELD_BUTTON)})},orb.ui.emptyCell=function(b,c){a.call(this,{axetype:null,type:orb.ui.HeaderType.EMPTY,template:"cell-template-empty",value:null,cssclass:orb.ui.HeaderType.getHeaderClass(orb.ui.HeaderType.EMPTY),hspan:function(){return b},vspan:function(){return c}})}}(),orb.utils.ns("orb.ui"),function(){orb.ui.rows=function(a){function b(a,b){if(e)for(var c=a[a.length-1],g=0;f>g;g++)c.push(new orb.ui.dataHeader(d.axe.pgrid.config.datafields[g],b)),f-1>g&&a.push(c=[])}function c(a,d){if(d.values.length>0)for(var e=a.length-1,g=a[e],h=g.length>0?g[g.length-1]:null,i=0;i<d.values.length;i++){var j,k=d.values[i],l=d.subdimvals[k];j=!l.isLeaf&&l.field.subtotal.visible?new orb.ui.header(orb.axe.Type.ROWS,orb.ui.HeaderType.SUB_TOTAL,l,h,f):null;var m=new orb.ui.header(orb.axe.Type.ROWS,null,l,h,f,j);i>0&&a.push(g=[]),g.push(m),l.isLeaf?b(a,m):(c(a,l,j),l.field.subtotal.visible&&(a.push([j]),b(a,j)))}}var d=this;this.axe=a,this.uiInfos=[];var e,f;this.build=function(){f="rows"===d.axe.pgrid.config.dataheaderslocation?d.axe.pgrid.config.datafieldscount||1:1,e="rows"===d.axe.pgrid.config.dataheaderslocation&&f>1;var a=[[]];if(null!=d.axe){if(c(a,d.axe.root),d.axe.pgrid.config.grandtotal.rowsvisible){var g=a[a.length-1],h=new orb.ui.header(orb.axe.Type.ROWS,orb.ui.HeaderType.GRAND_TOTAL,d.axe.root,null,f);0===g.length?g.push(h):a.push([h]),b(a,h)}0===a[0].length&&a[0].push(new orb.ui.header(orb.axe.Type.ROWS,orb.ui.HeaderType.INNER,d.axe.root,null,f))}d.uiInfos=a},this.build()}}(),orb.utils.ns("orb.ui"),function(){orb.ui.cols=function(a){function b(){function a(a){a&&a.dim.field.subtotal.visible&&b.push(a.subtotalHeader)}var b=[];if(d.uiInfos.length>0){for(var c,g=d.uiInfos[d.uiInfos.length-1],h=g[0],i=h.parent,j=0;j<g.length;j++){if(h=g[j],c=h.parent,c!=i){if(a(i),null!=c)for(var k=c.parent,l=i?i.parent:null;k!=l&&null!=l;)a(l),k=k?k.parent:null,l=l?l.parent:null;i=c}if(b.push(g[j]),j===g.length-1)for(;null!=i;)a(i),i=i.parent}d.axe.pgrid.config.grandtotal.columnsvisible&&d.axe.dimensionsCount>1&&b.push(d.uiInfos[0][d.uiInfos[0].length-1])}if(e){d.leafsHeaders=[];for(var m=0;m<b.length;m++)for(var n=0;f>n;n++)d.leafsHeaders.push(new orb.ui.dataHeader(d.axe.pgrid.config.datafields[n],b[m]));d.uiInfos.push(d.leafsHeaders)}else d.leafsHeaders=b}function c(a,b){for(var c=b[b.length-1],e=d.axe.root.depth===a?[null]:b[d.axe.root.depth-a-1].filter(function(a){return a.type!==orb.ui.HeaderType.SUB_TOTAL}),g=0;g<e.length;g++)for(var h=e[g],i=null==h?d.axe.root:h.dim,j=0;j<i.values.length;j++){var k,l=i.values[j],m=i.subdimvals[l];k=!m.isLeaf&&m.field.subtotal.visible?new orb.ui.header(orb.axe.Type.COLUMNS,orb.ui.HeaderType.SUB_TOTAL,m,h,f):null;var n=new orb.ui.header(orb.axe.Type.COLUMNS,null,m,h,f,k);c.push(n),!m.isLeaf&&m.field.subtotal.visible&&c.push(k)}}var d=this;this.axe=a,this.uiInfos=null,this.leafsHeaders=null;var e,f;this.build=function(){if(f="columns"===d.axe.pgrid.config.dataheaderslocation?d.axe.pgrid.config.datafieldscount:1,e="columns"===d.axe.pgrid.config.dataheaderslocation&&f>1,d.uiInfos=[],null!=d.axe){for(var a=d.axe.root.depth;a>1;a--)d.uiInfos.push([]),c(a,d.uiInfos);d.axe.pgrid.config.grandtotal.columnsvisible&&(d.uiInfos[0]=d.uiInfos[0]||[]).push(new orb.ui.header(orb.axe.Type.COLUMNS,orb.ui.HeaderType.GRAND_TOTAL,d.axe.root,null,f)),0===d.uiInfos.length&&d.uiInfos.push([new orb.ui.header(orb.axe.Type.COLUMNS,orb.ui.HeaderType.INNER,d.axe.root,null,f)]),b()}console.log("fff")},this.build()}}(),orb.utils.ns("orb.ui"),function(){orb.ui.pgridwidget=function(a){function b(){function a(a,b){return a.length!==b?(a.length=b,!0):!1}c.rows=new orb.ui.rows(c.pgrid.rows),c.columns=new orb.ui.cols(c.pgrid.columns);var b=c.rows.uiInfos,d=b.length,e=c.columns.uiInfos,f=e.length,g=c.columns.leafsHeaders,h=g.length;c.rowHeadersWidth=(c.pgrid.rows.fields.length||1)+("rows"===c.pgrid.config.dataheaderslocation&&c.pgrid.config.datafieldscount>1?1:0),c.columnHeadersWidth=h,c.rowHeadersHeight=d,c.columnHeadersHeight=(c.pgrid.columns.fields.length||1)+("columns"===c.pgrid.config.dataheaderslocation&&c.pgrid.config.datafieldscount>1?1:0),c.totalWidth=c.rowHeadersWidth+c.columnHeadersWidth,c.totalHeight=c.rowHeadersHeight+c.columnHeadersHeight;for(var i=[],j=(a(i,f+d),0);f>j;j++){var k=e[j],l=i[j]=i[j]||[],m=0;if(f>1&&0===j)m=1,a(l,m+k.length),l[0]=new orb.ui.emptyCell(c.rowHeadersWidth,c.columnHeadersHeight-1);else if(j===f-1)if(m=c.rowHeadersWidth,a(l,m+k.length),c.pgrid.rows.fields.length>0)for(var n=0;n<c.pgrid.config.rowfields.length;n++)l[n]=new orb.ui.buttonCell(c.pgrid.config.rowfields[n]);else l[0]=new orb.ui.emptyCell(c.rowHeadersWidth,1);for(var o=0;o<k.length;o++)l[m+o]=k[o]}for(var p=0;d>p;p++){var q=b[p];l=i[f+p]=i[f+p]||new Array(q.length+h),a(l,q.length+h);for(var r=0;r<q.length;r++)l[r]=q[r];for(var s=q[q.length-1],t=0;h>t;t++){var u=g[t],v=function(a,b){return function(){return a()&&b()}}(s.visible,u.visible);l[q.length+t]=new orb.ui.dataCell(c.pgrid,v,s,u)}}c.cells=i}var c=this;this.pgrid=new orb.pgrid(a),this.rows=null,this.columns=null,this.rowHeadersWidth=null,this.columnHeadersWidth=null,this.rowHeadersHeight=null,this.columnHeadersHeight=null,this.totalWidth=null,this.totalWidth=null,this.sort=function(a,d){if(a===orb.axe.Type.ROWS)c.pgrid.rows.sort(d);else{if(a!==orb.axe.Type.COLUMNS)return;c.pgrid.columns.sort(d)}b()},this.moveField=function(a,d,e,f){c.pgrid.moveField(a,d,e,f),b()},this.filters=null,this.cells=[],this.render=function(b){var d=React.createFactory(orb.react.PivotTable),e=d({data:c,config:a});React.render(e,b)},b()},orb.ui.HeaderType={EMPTY:1,DATA_HEADER:2,DATA_VALUE:3,FIELD_BUTTON:4,INNER:5,WRAPPER:6,SUB_TOTAL:7,GRAND_TOTAL:8,getHeaderClass:function(a,b){var c="";switch(a){case orb.ui.HeaderType.EMPTY:case orb.ui.HeaderType.FIELD_BUTTON:c="empty";break;case orb.ui.HeaderType.INNER:c="header";break;case orb.ui.HeaderType.WRAPPER:b===orb.axe.Type.ROWS?c="header":b===orb.axe.Type.COLUMNS&&(c="header");break;case orb.ui.HeaderType.SUB_TOTAL:c="header header-sub-total";break;case orb.ui.HeaderType.GRAND_TOTAL:c="header header-grand-total"}return c},getCellClass:function(a,b){var c="";switch(a){case orb.ui.HeaderType.GRAND_TOTAL:c="cell-grand-total";break;case orb.ui.HeaderType.SUB_TOTAL:c=b===orb.ui.HeaderType.GRAND_TOTAL?"cell-grand-total":"cell-sub-total";break;default:c=b===orb.ui.HeaderType.GRAND_TOTAL?"cell-grand-total":b===orb.ui.HeaderType.SUB_TOTAL?"cell-sub-total":"cell"}return c}}}(),orb.utils.ns("orb.react"),function(){var a=1;orb.react.PivotTable=React.createClass({displayName:"PivotTable",getInitialState:function(){return orb.react.DragManager.init(this),{}},sort:function(a,b){this.props.data.sort(a,b),this.setProps(this.props)},moveButton:function(a,b,c){this.props.data.moveField(a.props.field.name,a.props.axetype,b,c),this.setProps(this.props)},expandRow:function(a){a.expanded=!0,this.setProps({})},collapseRow:function(a){a.subtotalHeader.expanded=!1,this.setProps({})},render:function(){var b=this,c=this.props.data,d=orb.react.PivotButton,e=orb.react.PivotRow,f=orb.react.DropTarget,g=c.pgrid.config.availablefields().map(function(a,c){return React.createElement(d,{key:a.name,field:a,axetype:null,position:c,rootComp:b})}),h=c.pgrid.config.datafields.map(function(a,c){return React.createElement(d,{key:a.name,field:a,axetype:orb.axe.Type.DATA,position:c,rootComp:b})}),i=c.pgrid.config.columnfields.map(function(a,c){return React.createElement(d,{key:a.name,field:a,axetype:orb.axe.Type.COLUMNS,position:c,rootComp:b})}),j=orb.utils.findInArray(c.cells,function(a){return"cell-template-fieldbutton"===a[0].template});j=void 0!==j?j.filter(function(a){return"cell-template-fieldbutton"===a.template}).map(function(a,c){return React.createElement(d,{key:a.value.name,field:a.value,axetype:orb.axe.Type.ROWS,position:c,rootComp:b})}):[];var k=React.createElement("td",{className:"empty",colSpan:c.rowHeadersWidth+a,rowSpan:"1"},React.createElement(f,{data:j,axetype:orb.axe.Type.ROWS})),l=c.cells.map(function(a,d){return d==c.columnHeadersHeight-1?React.createElement(e,{key:d,row:a,rowButtonsCount:c.rowHeadersWidth,rowButtonsCell:k,rootComp:b}):React.createElement(e,{key:d,row:a,rootComp:b})}),m=this.props.config.width?{width:this.props.config.width}:{};return React.createElement("div",{className:"orb-container",style:m},React.createElement("table",{id:"tbl",className:"orb",style:{width:"100%"}},React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",{className:"available-fields field-group",colSpan:a,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Fields:")),React.createElement("td",{className:"available-fields",colSpan:c.totalWidth,rowSpan:"1"},React.createElement(f,{data:g,axetype:null}))),React.createElement("tr",null,React.createElement("td",{className:"field-group",colSpan:a,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Data fields:")),React.createElement("td",{className:"empty",colSpan:c.totalWidth,rowSpan:"1"},React.createElement(f,{data:h,axetype:orb.axe.Type.DATA}))),React.createElement("tr",null,React.createElement("td",{className:"empty",colSpan:c.rowHeadersWidth+a,rowSpan:"1"}),React.createElement("td",{className:"empty",colSpan:c.columnHeadersWidth,rowSpan:"1"},React.createElement(f,{data:i,axetype:orb.axe.Type.COLUMNS}))),l)))}}),orb.react.PivotRow=React.createClass({displayName:"PivotRow",render:function(){var a,b=this,c=orb.react.PivotCell,d=this.props.row.length-1,e=this.props.row[0],f={};return void 0!==this.props.rowButtonsCell?(a=this.props.row.slice(this.props.rowButtonsCount).map(function(a,e){var f=e===d-b.props.rowButtonsCount;return React.createElement(c,{key:e,cell:a,rightmost:f,leftmost:!1,rootComp:b.props.rootComp})}),React.createElement("tr",null,this.props.rowButtonsCell,a)):("cell-template-row-header"==e.template&&e.visible&&!e.visible()&&(f.display="none"),a=this.props.row.map(function(a,e){var f=e===d,g=0===e&&(a.type===orb.ui.HeaderType.EMPTY||a.type===orb.ui.HeaderType.SUB_TOTAL||a.type===orb.ui.HeaderType.GRAND_TOTAL||a.dim&&(a.dim.isRoot||a.dim.parent.isRoot));return React.createElement(c,{key:e,cell:a,rightmost:f,leftmost:g,rootComp:b.props.rootComp})}),React.createElement("tr",{style:f},a))}}),orb.react.PivotCell=React.createClass({displayName:"PivotCell",expand:function(){this.props.rootComp.expandRow(this.props.cell)},collapse:function(){this.props.rootComp.collapseRow(this.props.cell)},render:function(){var b,c=this.props.cell,d=[],e="\u25bc",f="\u25b6";switch(c.template){case"cell-template-row-header":case"cell-template-column-header":c.type===orb.ui.HeaderType.WRAPPER&&c.dim.field.subtotal.visible&&c.dim.field.subtotal.collapsible&&c.subtotalHeader.expanded?d.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.collapse},e)):c.type!==orb.ui.HeaderType.SUB_TOTAL||c.expanded||d.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.expand},f)),b=c.value;break;case"cell-template-dataheader":b=c.value.caption;break;case"cell-template-datavalue":b=c.datafield&&c.datafield.formatfunc?c.datafield.formatfunc(c.value):c.value}d.push(React.createElement("span",{key:"cell-value",style:{whiteSpace:"nowrap"}},b));var g=c.cssclass,h=!c.visible();return(h||this.props.rightmost||this.props.leftmost)&&(h&&(g+=" cell-hidden"),!this.props.rightmost||c.axetype===orb.axe.Type.COLUMNS&&c.type!==orb.ui.HeaderType.GRAND_TOTAL||(g+=" cell-rightmost"),this.props.leftmost&&(g+=" cell-leftmost",console.log("cell-leftmost: "+c.value))),React.createElement("td",{className:g,colSpan:c.hspan()+(this.props.leftmost?a:0),rowSpan:c.vspan()},React.createElement("div",null,d))}})}(),orb.utils.ns("orb.react"),function(){function a(a,b,c){var d;if(null!=a)for(var e=0,f=a.length;f>e&&(d=b(a[e],e),void 0===d||c!==!0);e++);return d}function b(a){if(null!=a){var b=a.getBoundingClientRect();return{x:b.left+0,y:b.top+0}}return{x:0,y:0}}function c(a){if(null!=a){var b=a.getBoundingClientRect();return{width:b.right-b.left,height:b.bottom-b.top}}return{x:0,y:0}}orb.react.DragManager=function(){function b(a,b){return!(a.right<b.left||a.left>b.right||a.bottom<b.top||a.top>b.bottom)}function c(a){return a.onDragOver?(a.onDragOver(h),!0):!1}function d(a){return a.onDragEnd?(a.onDragEnd(),!0):!1}function e(){return a(j,function(a){return a.component.state.isover?a:void 0},!0)}function f(){return a(k,function(a){return a.component.state.isover?a:void 0},!0)}var g=null,h=null,i=null,j=[],k=[],l=!1;return{init:function(a){l=!0,g=a},dragElement:function(b){var c=h;if(h=b,h!=c)if(null==b){var l=e(),m=f();if(l){var n=null!=m?m.position:null;g.moveButton(c,l.component.props.axetype,n)}i=null,a(j,function(a){d(a)}),a(k,function(a){d(a)})}else i=h.getDOMNode()},registerTarget:function(a,b,c,d){j.push({component:a,axetype:b,onDragOver:c,onDragEnd:d})},unregisterTarget:function(a){for(var b,c=0;c<j.length;c++)if(j[c].component==a){b=c;break}null!=b&&j.splice(b,1)},registerIndicator:function(a,b,c,d,e){k.push({component:a,axetype:b,position:c,onDragOver:d,onDragEnd:e})},unregisterIndicator:function(a){for(var b,c=0;c<k.length;c++)if(k[c].component==a){b=c;break}null!=b&&k.splice(b,1)},elementMoved:function(){if(null!=h){var e,f=i.getBoundingClientRect();a(j,function(a){if(!e){var g=a.component.getDOMNode().getBoundingClientRect(),h=b(f,g);if(h&&c(a))return e=a,!0;d(a)}},!0);var g;if(e){if(a(k,function(a){if(!g){var i=a.component.props.axetype===h.props.axetype&&a.component.props.position===h.props.position,j=a.component.props.axetype===e.component.props.axetype;if(j&&!i){var k=a.component.getDOMNode().getBoundingClientRect(),l=b(f,k);if(l&&c(a))return void(g=a)}}d(a)}),!g){var l=k.filter(function(a){return a.component.props.axetype===e.component.props.axetype});l.length>0&&c(l[l.length-1])}}else a(k,function(a){d(a)})}}}}();var d=0;orb.react.DropTarget=React.createClass({displayName:"DropTarget",getInitialState:function(){return this.dtid=++d,orb.react.DragManager.registerTarget(this,this.props.axetype,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){orb.react.DragManager.unregisterTarget(this)},onDragOver:function(){this.setState({isover:!0})},onDragEnd:function(){this.setState({isover:!1})},render:function(){var a=this,b=orb.react.DropIndicator,c=this.props.data.map(function(c,d){return d<a.props.data.length-1?[React.createElement(b,{isFirst:0===d,position:d,axetype:a.props.axetype}),c]:[React.createElement(b,{isFirst:0===d,position:d,axetype:a.props.axetype}),c,React.createElement(b,{isLast:!0,position:null,axetype:a.props.axetype})]});return React.createElement("div",{className:"drop-target"+(this.state.isover?" drag-over":"")},c)}}),orb.react.DropIndicator=React.createClass({displayName:"DropIndicator",getInitialState:function(){return orb.react.DragManager.registerIndicator(this,this.props.axetype,this.props.position,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){orb.react.DragManager.unregisterIndicator(this)},onDragOver:function(a){this.setState({isover:!0,width:a.getDOMNode().style.width})},onDragEnd:function(){this.setState({isover:!1,width:null})},render:function(){var a="drop-indicator";this.props.isFirst&&(a+=" drop-indicator-first"),this.props.isLast&&(a+=" drop-indicator-last");var b={};return this.state.isover&&(a+=" drop-indicator-drag-over"),React.createElement("div",{style:b,className:a})}});var e=0;orb.react.PivotButton=React.createClass({displayName:"PivotButton",getInitialState:function(){return this.pbid=++e,{pos:{x:0,y:0},startpos:{x:0,y:0},mousedown:!1,dragging:!1}},onMouseDown:function(a){if(0===a.button){var c=b(this.getDOMNode());this.setState({mousedown:!0,mouseoffset:{x:c.x-a.pageX,y:c.y-a.pageY},startpos:{x:a.pageX,y:a.pageY}}),a.stopPropagation(),a.preventDefault()}},componentDidUpdate:function(){this.state.mousedown?this.state.mousedown&&(orb.react.DragManager.dragElement(this),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)):(orb.react.DragManager.dragElement(null),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp))},componentWillUnmount:function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},onMouseUp:function(){var a=this.state.dragging;this.setState({mousedown:!1,dragging:!1,size:null,pos:{x:0,y:0}}),a||this.props.rootComp.sort(this.props.axetype,this.props.field)},onMouseMove:function(a){if(console.log("PivotButton["+this.pbid+"].onMouseMove"),this.state.mousedown){var b=null;b=this.state.dragging?this.state.size:c(this.getDOMNode());var d={x:a.pageX+this.state.mouseoffset.x,y:a.pageY+this.state.mouseoffset.y};this.setState({dragging:!0,size:b,pos:d}),orb.react.DragManager.elementMoved(),a.stopPropagation(),a.preventDefault()}},render:function(){var a=this,b={left:a.state.pos.x+"px",top:a.state.pos.y+"px",position:a.state.dragging?"fixed":""};a.state.size&&(b.width=a.state.size.width+"px");var c=(orb.react.DropIndicator,"asc"===a.props.field.sort.order?" \u25b3":"desc"===a.props.field.sort.order?" \u25bd":"");return React.createElement("div",{key:a.props.field.name,className:"field-button",onMouseDown:this.onMouseDown,style:b},a.props.field.caption,React.createElement("span",null,c))}})}();<commit_msg>Fix data cell value when no datafields is empty.<commit_after>/*! orb v0.1.0, Javascript pivot grid library.
 *  (c) <NAME>, 2014-11-23.
 *  Licence: MIT.
 */

orb={},orb.utils={ns:function(a){for(var b=a.split("."),c=window,d=0;d<b.length;)c[b[d]]=c[b[d]]||{},c=c[b[d]],d++;return c},ownProperties:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},isArray:function(a){return"[object Array]"===Object.prototype.toString.apply(a)},findInArray:function(a,b){if(orb.utils.isArray(a)&&b)for(var c=0;c<a.length;c++){var d=a[c];if(b(d))return d}return void 0},jsonStringify:function(a,b){function c(a,c){return b&&b.indexOf(a)>-1?void 0:c}return JSON.stringify(a,c,2)}},function(){function a(a,b,c){for(var d=0;d<b.length;d++)if(null!=b[d][a])return b[d][a];return c}function b(){for(var b=[],c=[],d=[],e=[],f=0;f<arguments.length;f++){var g=arguments[f]||{};b.push(g),c.push(g.sort||{}),d.push(g.subtotal||{}),e.push(g.filter||{})}return{name:a("name",b,""),caption:a("caption",b,""),filter:{type:a("type",e,"operator"),regexp:a("regexp",e,null),operator:a("operator",e,null),value:a("value",e,null)},sort:{order:a("order",c,null),customfunc:a("customfunc",c,null)},subtotal:{visible:a("visible",d,!0),collapsible:a("collapsible",d,!0),collapsed:a("collapsed",d,!1)},aggregatefunc:a("aggregatefunc",b,null),formatfunc:a("formatfunc",b,null)}}function c(a,c,d,e){var f;if(e)switch(c){case orb.axe.Type.ROWS:f=e.rowsettings;break;case orb.axe.Type.COLUMNS:f=e.columnsettings;break;case orb.axe.Type.DATA:f=e.datasettings;break;default:f=null}else f=null;return b(d,f,e,a)}function d(a){a=a||{},this.rowsvisible=void 0!==a.rowsvisible?a.rowsvisible:!0,this.columnsvisible=void 0!==a.columnsvisible?a.columnsvisible:!0}function e(a,b){var c={visible:b===!0?!0:void 0,collapsible:b===!0?!0:void 0,collapsed:b===!0?!1:void 0};a=a||{},this.visible=void 0!==a.visible?a.visible:c.visible,this.collapsible=void 0!==a.collapsible?a.collapsible:c.collapsible,this.collapsed=void 0!==a.collapsed?a.collapsed:c.collapsed}function f(a){a=a||{},this.order=a.order,this.customfunc=a.customfunc}function g(a){a=a||{},this.type=a.type,this.regexp=a.regexp,this.operator=a.operator,this.value=a.value}orb.field=function(a,b){a=a||{},this.name=a.name,this.caption=a.caption||this.name,this.filter=new g(a.filter),this.sort=new f(a.sort),this.subtotal=new e(a.subtotal),this.aggregatefunc=a.aggregatefunc,this.formatfunc=a.formatfunc,b!==!0&&((this.rowsettings=new orb.field(a.rowsettings,!0)).name=this.name,(this.columnsettings=new orb.field(a.columnsettings,!0)).name=this.name,(this.datasettings=new orb.field(a.datasettings,!0)).name=this.name)},orb.config=function(a){function b(a,b){var c=f(a,b);return c>-1?a[c]:null}function f(a,b){for(var c=0;c<a.length;c++)if(a[c].name===b)return c;return-1}var g=this;this.datasource=a.datasource,this.dataheaderslocation="columns"===a.dataheaderslocation?"columns":"rows",this.grandtotal=new d(a.grandtotal),this.subtotal=new e(a.subtotal,!0),this.allfields=(a.fields||[]).map(function(a){return new orb.field(a)}),this.rowfields=(a.rows||[]).map(function(a){return c(g,orb.axe.Type.ROWS,a,b(g.allfields,a.name))}),this.columnfields=(a.columns||[]).map(function(a){return c(g,orb.axe.Type.COLUMNS,a,b(g.allfields,a.name))}),this.datafields=(a.data||[]).map(function(a){return c(g,orb.axe.Type.DATA,a,b(g.allfields,a.name))}),this.datafieldscount=this.datafields?this.datafields.length||1:1,g.availablefields=function(){return g.allfields.filter(function(a){var b=function(b){return a.name!==b.name};return g.datafields.every(b)&&g.rowfields.every(b)&&g.columnfields.every(b)})},this.moveField=function(a,d,e,h){var i,j,k,l=b(g.allfields,a);if(l){switch(d){case orb.axe.Type.ROWS:i=g.rowfields;break;case orb.axe.Type.COLUMNS:i=g.columnfields;break;case orb.axe.Type.DATA:i=g.datafields}switch(e){case orb.axe.Type.ROWS:k=g.rowfields;break;case orb.axe.Type.COLUMNS:k=g.columnfields;break;case orb.axe.Type.DATA:k=g.datafields}if(i||k){if(i){if(j=f(i,a),d===e&&(j==i.length-1&&null==h||j===h-1))return!1;i.splice(j,1)}return l=c(g,e,null,l),k&&(null!=h?k.splice(h,0,l):k.push(l)),g.datafieldscount=g.datafields?g.datafields.length||1:1,!0}}}}}(),function(){orb.dimension=function(a,b,c,d,e,f,g){var h=this;this.id=a,this.parent=b,this.value=c,this.isRoot=f,this.isLeaf=g,this.field=d,this.depth=e,this.values=[],this.subdimvals={},this.rowIndexes=null,this.getRowIndexes=function(a){if(null==h.rowIndexes){this.rowIndexes=[];for(var b=0;b<h.values.length;b++)h.subdimvals[h.values[b]].getRowIndexes(this.rowIndexes)}if(null!=a){for(var c=0;c<h.rowIndexes.length;c++)a.push(h.rowIndexes[c]);return a}return h.rowIndexes}}}(),function(){orb.axe=function(a,b){function c(a){for(var b=0;b<e.fields.length;b++)if(e.fields[b].name===a.name)return b;return-1}function d(){if(null!=e.pgrid.config.datasource&&e.dimensionsCount>0){var a=e.pgrid.config.datasource;if(null!=a&&orb.utils.isArray(a)&&a.length>0)for(var b=0,c=a.length;c>b;b++)for(var d=a[b],g=e.root,h=0;h<e.dimensionsCount;h++){var i=e.dimensionsCount-h,j=e.fields[h],k=d[j.name],l=g.subdimvals;void 0!==l[k]?g=l[k]:(g.values.push(k),g=new orb.dimension(++f,g,k,j,i,!1,h==e.dimensionsCount-1),l[k]=g,g.rowIndexes=[],e.dimensionsByDepth[i].push(g)),g.rowIndexes.push(b)}}}var e=this,f=0;null!=a&&null!=a.config&&(this.pgrid=a,this.type=b,this.fields=function(){switch(b){case orb.axe.Type.COLUMNS:return e.pgrid.config.columnfields;case orb.axe.Type.ROWS:return e.pgrid.config.rowfields;case orb.axe.Type.DATA:return e.pgrid.config.datafields;default:return[]}}(),this.dimensionsCount,this.root,this.dimensionsByDepth,this.update=function(){e.dimensionsCount=e.fields.length,e.root=new orb.dimension(++f,null,null,null,e.dimensionsCount+1,!0),e.dimensionsByDepth={};for(var a=1;a<=e.dimensionsCount;a++)e.dimensionsByDepth[a]=[];d();for(var b=0;b<e.fields.length;b++){var c=e.fields[b];("asc"===c.sort.order||"desc"===c.sort.order)&&e.sort(c,!0)}},this.sort=function(a,b){if(null!=a){b!==!0&&(a.sort.order="asc"!==a.sort.order?"asc":"desc");for(var d=e.dimensionsCount-c(a),f=d===e.dimensionsCount?[e.root]:e.dimensionsByDepth[d+1],g=0;g<f.length;g++)f[g].values.sort(),"desc"===a.sort.order&&f[g].values.reverse()}},this.update())},orb.axe.Type={COLUMNS:1,ROWS:2,DATA:3}}(),function(){orb.pgrid=function(a){function b(a,b,c){var d={};if(g.config.datafieldscount>0){var e;if(null==a)e=b;else if(null==b)e=a;else{e=[];for(var h=0;h<a.length;h++){var i=a[h];if(i>=0){var j=b.indexOf(i);j>=0&&(a[h]=0-(i+2),e.push(i))}}}for(var k=g.config.datasource,l=0;l<g.config.datafieldscount;l++){var m=g.config.datafields[l]||f;if(m.aggregatefunc)d[m.name]=m.aggregatefunc(m.name,e,k,c,b);else{var n=null!=e;if(e=e||k,e.length>0){for(var o=0,p=0;p<e.length;p++){var q=e[p];n?q>=0&&(o+=k[q][m.name]):o+=q[m.name]}d[m.name]=o}}}}return d}function c(a){if(a){var c={},d="r"+a.id;if(void 0===e[d]&&(e[d]=a.isRoot?null:e[a.parent.id]||a.getRowIndexes()),c[g.columns.root.id]=b(a.isRoot?null:e[d].slice(0),null),g.columns.dimensionsCount>0)for(var f=0,h=[g.columns.root];f<h.length;){for(var i=h[f],j=a.isRoot?null:i.isRoot?e[d].slice(0):e["c"+i.id].slice(0),k=0;k<i.values.length;k++){var l=i.subdimvals[i.values[k]],m="c"+l.id;if(void 0===e[m]&&(e[m]=e[m]||l.getRowIndexes().slice(0)),c[l.id]=b(j,e[m],a.isRoot?null:a.getRowIndexes()),!l.isLeaf&&(h.push(l),j)){e[m]=[];for(var n=0;n<j.length;n++){var o=j[n];-1!=o&&0>o&&(e[m].push(0-(o+2)),j[n]=-1)}}}e["c"+i.id]=void 0,f++}return c}}function d(){if(g.dataMatrix={},e={},g.dataMatrix[g.rows.root.id]=c(g.rows.root),g.rows.dimensionsCount>0)for(var a,b=[g.rows.root],d=0;d<b.length;){a=b[d];for(var f=0;f<a.values.length;f++){var h=a.subdimvals[a.values[f]];g.dataMatrix[h.id]=c(h),h.isLeaf||b.push(h)}d++}}var e,f={name:"#undefined#"},g=this;this.config=new orb.config(a),this.rows=new orb.axe(g,orb.axe.Type.ROWS),this.columns=new orb.axe(g,orb.axe.Type.COLUMNS),this.dataMatrix={},this.moveField=function(a,b,c,e){g.config.moveField(a,b,c,e)&&(g.rows.update(),g.columns.update(),d())},this.getData=function(a,b,c){return b&&c?(a=a||(g.config.datafields[0]||f).name,g.dataMatrix[b.id]&&g.dataMatrix[b.id][c.id]?g.dataMatrix[b.id][c.id][a]||null:null):void 0},d()}}(),orb.utils.ns("orb.ui"),function(){function a(a){this.axetype=a.axetype,this.type=a.type,this.template=a.template,this.value=a.value,this.expanded=!0,this.cssclass=a.cssclass,this.hspan=a.hspan||function(){return 1},this.vspan=a.vspan||function(){return 1},this.visible=a.isvisible||function(){return!0}}orb.ui.header=function(b,c,d,e,f,g){function h(){if(m.type===orb.ui.HeaderType.SUB_TOTAL){for(var a=m.parent;null!=a;){if(a.subtotalHeader&&!a.subtotalHeader.expanded)return!1;a=a.parent}return!0}var b=m.dim.isRoot||m.dim.isLeaf||!m.dim.field.subtotal.visible||m.subtotalHeader.expanded;if(!b)return!1;for(var c=m.parent;null!=c&&(!c.dim.field.subtotal.visible||null!=c.subtotalHeader&&c.subtotalHeader.expanded);)c=c.parent;return null==c||null==c.subtotalHeader?b:c.subtotalHeader.expanded}function i(){var a,b=0,c=!1;if(m.visible()){if(m.dim.isLeaf)return f;for(var d=0;d<m.subheaders.length;d++){var e=m.subheaders[d];e.dim.isLeaf?b+=f:(a=n?e.vspan():e.hspan(),b+=a,0===d&&(0===a||n&&e.type===orb.ui.HeaderType.SUB_TOTAL&&!e.expanded)&&(c=!0))}return b+(c?1:0)}return b}var j,k,l,m=this,n=b===orb.axe.Type.ROWS;switch(c=c||(1===d.depth?orb.ui.HeaderType.INNER:orb.ui.HeaderType.WRAPPER)){case orb.ui.HeaderType.GRAND_TOTAL:l="Grand Total",j=n?d.depth-1||1:f,k=n?f:d.depth-1||1;break;case orb.ui.HeaderType.SUB_TOTAL:l="Total "+d.value,j=n?d.depth:f,k=n?f:d.depth;break;default:l=d.value,j=n?1:null,k=n?null:1}a.call(this,{axetype:b,type:c,template:n?"cell-template-row-header":"cell-template-column-header",value:l,cssclass:orb.ui.HeaderType.getHeaderClass(c,b),hspan:null!=j?function(){return j}:i,vspan:null!=k?function(){return k}:i,isvisible:h}),this.subtotalHeader=g,this.parent=e,this.subheaders=[],this.dim=d,this.expanded=c!==orb.ui.HeaderType.SUB_TOTAL||!d.field.subtotal.collapsed,this.expand=function(){m.expanded=!0},this.collapse=function(){m.expanded=!1},null!=e&&e.subheaders.push(this)},orb.ui.dataHeader=function(b,c){a.call(this,{axetype:null,type:orb.ui.HeaderType.DATA_HEADER,template:"cell-template-dataheader",value:b,cssclass:orb.ui.HeaderType.getHeaderClass(c.type),isvisible:c.visible}),this.parent=c},orb.ui.dataCell=function(b,c,d,e){var f=d.type===orb.ui.HeaderType.DATA_HEADER?d.parent.dim:d.dim,g=e.type===orb.ui.HeaderType.DATA_HEADER?e.parent.dim:e.dim,h=d.type===orb.ui.HeaderType.DATA_HEADER?d.parent.type:d.type,i=e.type===orb.ui.HeaderType.DATA_HEADER?e.parent.type:e.type,j=b.config.datafieldscount>1?"rows"===b.config.dataheaderslocation?d.value:e.value:b.config.datafields[0];a.call(this,{axetype:null,type:orb.ui.HeaderType.DATA_VALUE,template:"cell-template-datavalue",value:b.getData(j?j.name:null,f,g),cssclass:"cell "+orb.ui.HeaderType.getCellClass(h,i),isvisible:c}),this.datafield=j},orb.ui.buttonCell=function(b){a.call(this,{axetype:null,type:orb.ui.HeaderType.FIELD_BUTTON,template:"cell-template-fieldbutton",value:b,cssclass:orb.ui.HeaderType.getHeaderClass(orb.ui.HeaderType.FIELD_BUTTON)})},orb.ui.emptyCell=function(b,c){a.call(this,{axetype:null,type:orb.ui.HeaderType.EMPTY,template:"cell-template-empty",value:null,cssclass:orb.ui.HeaderType.getHeaderClass(orb.ui.HeaderType.EMPTY),hspan:function(){return b},vspan:function(){return c}})}}(),orb.utils.ns("orb.ui"),function(){orb.ui.rows=function(a){function b(a,b){if(e)for(var c=a[a.length-1],g=0;f>g;g++)c.push(new orb.ui.dataHeader(d.axe.pgrid.config.datafields[g],b)),f-1>g&&a.push(c=[])}function c(a,d){if(d.values.length>0)for(var e=a.length-1,g=a[e],h=g.length>0?g[g.length-1]:null,i=0;i<d.values.length;i++){var j,k=d.values[i],l=d.subdimvals[k];j=!l.isLeaf&&l.field.subtotal.visible?new orb.ui.header(orb.axe.Type.ROWS,orb.ui.HeaderType.SUB_TOTAL,l,h,f):null;var m=new orb.ui.header(orb.axe.Type.ROWS,null,l,h,f,j);i>0&&a.push(g=[]),g.push(m),l.isLeaf?b(a,m):(c(a,l,j),l.field.subtotal.visible&&(a.push([j]),b(a,j)))}}var d=this;this.axe=a,this.uiInfos=[];var e,f;this.build=function(){f="rows"===d.axe.pgrid.config.dataheaderslocation?d.axe.pgrid.config.datafieldscount||1:1,e="rows"===d.axe.pgrid.config.dataheaderslocation&&f>1;var a=[[]];if(null!=d.axe){if(c(a,d.axe.root),d.axe.pgrid.config.grandtotal.rowsvisible){var g=a[a.length-1],h=new orb.ui.header(orb.axe.Type.ROWS,orb.ui.HeaderType.GRAND_TOTAL,d.axe.root,null,f);0===g.length?g.push(h):a.push([h]),b(a,h)}0===a[0].length&&a[0].push(new orb.ui.header(orb.axe.Type.ROWS,orb.ui.HeaderType.INNER,d.axe.root,null,f))}d.uiInfos=a},this.build()}}(),orb.utils.ns("orb.ui"),function(){orb.ui.cols=function(a){function b(){function a(a){a&&a.dim.field.subtotal.visible&&b.push(a.subtotalHeader)}var b=[];if(d.uiInfos.length>0){for(var c,g=d.uiInfos[d.uiInfos.length-1],h=g[0],i=h.parent,j=0;j<g.length;j++){if(h=g[j],c=h.parent,c!=i){if(a(i),null!=c)for(var k=c.parent,l=i?i.parent:null;k!=l&&null!=l;)a(l),k=k?k.parent:null,l=l?l.parent:null;i=c}if(b.push(g[j]),j===g.length-1)for(;null!=i;)a(i),i=i.parent}d.axe.pgrid.config.grandtotal.columnsvisible&&d.axe.dimensionsCount>1&&b.push(d.uiInfos[0][d.uiInfos[0].length-1])}if(e){d.leafsHeaders=[];for(var m=0;m<b.length;m++)for(var n=0;f>n;n++)d.leafsHeaders.push(new orb.ui.dataHeader(d.axe.pgrid.config.datafields[n],b[m]));d.uiInfos.push(d.leafsHeaders)}else d.leafsHeaders=b}function c(a,b){for(var c=b[b.length-1],e=d.axe.root.depth===a?[null]:b[d.axe.root.depth-a-1].filter(function(a){return a.type!==orb.ui.HeaderType.SUB_TOTAL}),g=0;g<e.length;g++)for(var h=e[g],i=null==h?d.axe.root:h.dim,j=0;j<i.values.length;j++){var k,l=i.values[j],m=i.subdimvals[l];k=!m.isLeaf&&m.field.subtotal.visible?new orb.ui.header(orb.axe.Type.COLUMNS,orb.ui.HeaderType.SUB_TOTAL,m,h,f):null;var n=new orb.ui.header(orb.axe.Type.COLUMNS,null,m,h,f,k);c.push(n),!m.isLeaf&&m.field.subtotal.visible&&c.push(k)}}var d=this;this.axe=a,this.uiInfos=null,this.leafsHeaders=null;var e,f;this.build=function(){if(f="columns"===d.axe.pgrid.config.dataheaderslocation?d.axe.pgrid.config.datafieldscount:1,e="columns"===d.axe.pgrid.config.dataheaderslocation&&f>1,d.uiInfos=[],null!=d.axe){for(var a=d.axe.root.depth;a>1;a--)d.uiInfos.push([]),c(a,d.uiInfos);d.axe.pgrid.config.grandtotal.columnsvisible&&(d.uiInfos[0]=d.uiInfos[0]||[]).push(new orb.ui.header(orb.axe.Type.COLUMNS,orb.ui.HeaderType.GRAND_TOTAL,d.axe.root,null,f)),0===d.uiInfos.length&&d.uiInfos.push([new orb.ui.header(orb.axe.Type.COLUMNS,orb.ui.HeaderType.INNER,d.axe.root,null,f)]),b()}console.log("fff")},this.build()}}(),orb.utils.ns("orb.ui"),function(){orb.ui.pgridwidget=function(a){function b(){function a(a,b){return a.length!==b?(a.length=b,!0):!1}c.rows=new orb.ui.rows(c.pgrid.rows),c.columns=new orb.ui.cols(c.pgrid.columns);var b=c.rows.uiInfos,d=b.length,e=c.columns.uiInfos,f=e.length,g=c.columns.leafsHeaders,h=g.length;c.rowHeadersWidth=(c.pgrid.rows.fields.length||1)+("rows"===c.pgrid.config.dataheaderslocation&&c.pgrid.config.datafieldscount>1?1:0),c.columnHeadersWidth=h,c.rowHeadersHeight=d,c.columnHeadersHeight=(c.pgrid.columns.fields.length||1)+("columns"===c.pgrid.config.dataheaderslocation&&c.pgrid.config.datafieldscount>1?1:0),c.totalWidth=c.rowHeadersWidth+c.columnHeadersWidth,c.totalHeight=c.rowHeadersHeight+c.columnHeadersHeight;for(var i=[],j=(a(i,f+d),0);f>j;j++){var k=e[j],l=i[j]=i[j]||[],m=0;if(f>1&&0===j)m=1,a(l,m+k.length),l[0]=new orb.ui.emptyCell(c.rowHeadersWidth,c.columnHeadersHeight-1);else if(j===f-1)if(m=c.rowHeadersWidth,a(l,m+k.length),c.pgrid.rows.fields.length>0)for(var n=0;n<c.pgrid.config.rowfields.length;n++)l[n]=new orb.ui.buttonCell(c.pgrid.config.rowfields[n]);else l[0]=new orb.ui.emptyCell(c.rowHeadersWidth,1);for(var o=0;o<k.length;o++)l[m+o]=k[o]}for(var p=0;d>p;p++){var q=b[p];l=i[f+p]=i[f+p]||new Array(q.length+h),a(l,q.length+h);for(var r=0;r<q.length;r++)l[r]=q[r];for(var s=q[q.length-1],t=0;h>t;t++){var u=g[t],v=function(a,b){return function(){return a()&&b()}}(s.visible,u.visible);l[q.length+t]=new orb.ui.dataCell(c.pgrid,v,s,u)}}c.cells=i}var c=this;this.pgrid=new orb.pgrid(a),this.rows=null,this.columns=null,this.rowHeadersWidth=null,this.columnHeadersWidth=null,this.rowHeadersHeight=null,this.columnHeadersHeight=null,this.totalWidth=null,this.totalWidth=null,this.sort=function(a,d){if(a===orb.axe.Type.ROWS)c.pgrid.rows.sort(d);else{if(a!==orb.axe.Type.COLUMNS)return;c.pgrid.columns.sort(d)}b()},this.moveField=function(a,d,e,f){c.pgrid.moveField(a,d,e,f),b()},this.filters=null,this.cells=[],this.render=function(b){var d=React.createFactory(orb.react.PivotTable),e=d({data:c,config:a});React.render(e,b)},b()},orb.ui.HeaderType={EMPTY:1,DATA_HEADER:2,DATA_VALUE:3,FIELD_BUTTON:4,INNER:5,WRAPPER:6,SUB_TOTAL:7,GRAND_TOTAL:8,getHeaderClass:function(a,b){var c="";switch(a){case orb.ui.HeaderType.EMPTY:case orb.ui.HeaderType.FIELD_BUTTON:c="empty";break;case orb.ui.HeaderType.INNER:c="header";break;case orb.ui.HeaderType.WRAPPER:b===orb.axe.Type.ROWS?c="header":b===orb.axe.Type.COLUMNS&&(c="header");break;case orb.ui.HeaderType.SUB_TOTAL:c="header header-sub-total";break;case orb.ui.HeaderType.GRAND_TOTAL:c="header header-grand-total"}return c},getCellClass:function(a,b){var c="";switch(a){case orb.ui.HeaderType.GRAND_TOTAL:c="cell-grand-total";break;case orb.ui.HeaderType.SUB_TOTAL:c=b===orb.ui.HeaderType.GRAND_TOTAL?"cell-grand-total":"cell-sub-total";break;default:c=b===orb.ui.HeaderType.GRAND_TOTAL?"cell-grand-total":b===orb.ui.HeaderType.SUB_TOTAL?"cell-sub-total":"cell"}return c}}}(),orb.utils.ns("orb.react"),function(){var a=1;orb.react.PivotTable=React.createClass({displayName:"PivotTable",getInitialState:function(){return orb.react.DragManager.init(this),{}},sort:function(a,b){this.props.data.sort(a,b),this.setProps(this.props)},moveButton:function(a,b,c){this.props.data.moveField(a.props.field.name,a.props.axetype,b,c),this.setProps(this.props)},expandRow:function(a){a.expanded=!0,this.setProps({})},collapseRow:function(a){a.subtotalHeader.expanded=!1,this.setProps({})},render:function(){var b=this,c=this.props.data,d=orb.react.PivotButton,e=orb.react.PivotRow,f=orb.react.DropTarget,g=c.pgrid.config.availablefields().map(function(a,c){return React.createElement(d,{key:a.name,field:a,axetype:null,position:c,rootComp:b})}),h=c.pgrid.config.datafields.map(function(a,c){return React.createElement(d,{key:a.name,field:a,axetype:orb.axe.Type.DATA,position:c,rootComp:b})}),i=c.pgrid.config.columnfields.map(function(a,c){return React.createElement(d,{key:a.name,field:a,axetype:orb.axe.Type.COLUMNS,position:c,rootComp:b})}),j=orb.utils.findInArray(c.cells,function(a){return"cell-template-fieldbutton"===a[0].template});j=void 0!==j?j.filter(function(a){return"cell-template-fieldbutton"===a.template}).map(function(a,c){return React.createElement(d,{key:a.value.name,field:a.value,axetype:orb.axe.Type.ROWS,position:c,rootComp:b})}):[];var k=React.createElement("td",{className:"empty",colSpan:c.rowHeadersWidth+a,rowSpan:"1"},React.createElement(f,{data:j,axetype:orb.axe.Type.ROWS})),l=c.cells.map(function(a,d){return d==c.columnHeadersHeight-1?React.createElement(e,{key:d,row:a,rowButtonsCount:c.rowHeadersWidth,rowButtonsCell:k,rootComp:b}):React.createElement(e,{key:d,row:a,rootComp:b})}),m=this.props.config.width?{width:this.props.config.width}:{};return React.createElement("div",{className:"orb-container",style:m},React.createElement("table",{id:"tbl",className:"orb",style:{width:"100%"}},React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",{className:"available-fields field-group",colSpan:a,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Fields:")),React.createElement("td",{className:"available-fields",colSpan:c.totalWidth,rowSpan:"1"},React.createElement(f,{data:g,axetype:null}))),React.createElement("tr",null,React.createElement("td",{className:"field-group",colSpan:a,rowSpan:"1"},React.createElement("div",{className:"field-group-caption"},"Data fields:")),React.createElement("td",{className:"empty",colSpan:c.totalWidth,rowSpan:"1"},React.createElement(f,{data:h,axetype:orb.axe.Type.DATA}))),React.createElement("tr",null,React.createElement("td",{className:"empty",colSpan:c.rowHeadersWidth+a,rowSpan:"1"}),React.createElement("td",{className:"empty",colSpan:c.columnHeadersWidth,rowSpan:"1"},React.createElement(f,{data:i,axetype:orb.axe.Type.COLUMNS}))),l)))}}),orb.react.PivotRow=React.createClass({displayName:"PivotRow",render:function(){var a,b=this,c=orb.react.PivotCell,d=this.props.row.length-1,e=this.props.row[0],f={};return void 0!==this.props.rowButtonsCell?(a=this.props.row.slice(this.props.rowButtonsCount).map(function(a,e){var f=e===d-b.props.rowButtonsCount;return React.createElement(c,{key:e,cell:a,rightmost:f,leftmost:!1,rootComp:b.props.rootComp})}),React.createElement("tr",null,this.props.rowButtonsCell,a)):("cell-template-row-header"==e.template&&e.visible&&!e.visible()&&(f.display="none"),a=this.props.row.map(function(a,e){var f=e===d,g=0===e&&(a.type===orb.ui.HeaderType.EMPTY||a.type===orb.ui.HeaderType.SUB_TOTAL||a.type===orb.ui.HeaderType.GRAND_TOTAL||a.dim&&(a.dim.isRoot||a.dim.parent.isRoot));return React.createElement(c,{key:e,cell:a,rightmost:f,leftmost:g,rootComp:b.props.rootComp})}),React.createElement("tr",{style:f},a))}}),orb.react.PivotCell=React.createClass({displayName:"PivotCell",expand:function(){this.props.rootComp.expandRow(this.props.cell)},collapse:function(){this.props.rootComp.collapseRow(this.props.cell)},render:function(){var b,c=this.props.cell,d=[],e="\u25bc",f="\u25b6";switch(c.template){case"cell-template-row-header":case"cell-template-column-header":c.type===orb.ui.HeaderType.WRAPPER&&c.dim.field.subtotal.visible&&c.dim.field.subtotal.collapsible&&c.subtotalHeader.expanded?d.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.collapse},e)):c.type!==orb.ui.HeaderType.SUB_TOTAL||c.expanded||d.push(React.createElement("span",{key:"toggle-button",className:"toggle-button",onClick:this.expand},f)),b=c.value;break;case"cell-template-dataheader":b=c.value.caption;break;case"cell-template-datavalue":b=c.datafield&&c.datafield.formatfunc?c.datafield.formatfunc(c.value):c.value}d.push(React.createElement("span",{key:"cell-value",style:{whiteSpace:"nowrap"}},b));var g=c.cssclass,h=!c.visible();return(h||this.props.rightmost||this.props.leftmost)&&(h&&(g+=" cell-hidden"),!this.props.rightmost||c.axetype===orb.axe.Type.COLUMNS&&c.type!==orb.ui.HeaderType.GRAND_TOTAL||(g+=" cell-rightmost"),this.props.leftmost&&(g+=" cell-leftmost",console.log("cell-leftmost: "+c.value))),React.createElement("td",{className:g,colSpan:c.hspan()+(this.props.leftmost?a:0),rowSpan:c.vspan()},React.createElement("div",null,d))}})}(),orb.utils.ns("orb.react"),function(){function a(a,b,c){var d;if(null!=a)for(var e=0,f=a.length;f>e&&(d=b(a[e],e),void 0===d||c!==!0);e++);return d}function b(a){if(null!=a){var b=a.getBoundingClientRect();return{x:b.left+0,y:b.top+0}}return{x:0,y:0}}function c(a){if(null!=a){var b=a.getBoundingClientRect();return{width:b.right-b.left,height:b.bottom-b.top}}return{x:0,y:0}}orb.react.DragManager=function(){function b(a,b){return!(a.right<b.left||a.left>b.right||a.bottom<b.top||a.top>b.bottom)}function c(a){return a.onDragOver?(a.onDragOver(h),!0):!1}function d(a){return a.onDragEnd?(a.onDragEnd(),!0):!1}function e(){return a(j,function(a){return a.component.state.isover?a:void 0},!0)}function f(){return a(k,function(a){return a.component.state.isover?a:void 0},!0)}var g=null,h=null,i=null,j=[],k=[],l=!1;return{init:function(a){l=!0,g=a},dragElement:function(b){var c=h;if(h=b,h!=c)if(null==b){var l=e(),m=f();if(l){var n=null!=m?m.position:null;g.moveButton(c,l.component.props.axetype,n)}i=null,a(j,function(a){d(a)}),a(k,function(a){d(a)})}else i=h.getDOMNode()},registerTarget:function(a,b,c,d){j.push({component:a,axetype:b,onDragOver:c,onDragEnd:d})},unregisterTarget:function(a){for(var b,c=0;c<j.length;c++)if(j[c].component==a){b=c;break}null!=b&&j.splice(b,1)},registerIndicator:function(a,b,c,d,e){k.push({component:a,axetype:b,position:c,onDragOver:d,onDragEnd:e})},unregisterIndicator:function(a){for(var b,c=0;c<k.length;c++)if(k[c].component==a){b=c;break}null!=b&&k.splice(b,1)},elementMoved:function(){if(null!=h){var e,f=i.getBoundingClientRect();a(j,function(a){if(!e){var g=a.component.getDOMNode().getBoundingClientRect(),h=b(f,g);if(h&&c(a))return e=a,!0;d(a)}},!0);var g;if(e){if(a(k,function(a){if(!g){var i=a.component.props.axetype===h.props.axetype&&a.component.props.position===h.props.position,j=a.component.props.axetype===e.component.props.axetype;if(j&&!i){var k=a.component.getDOMNode().getBoundingClientRect(),l=b(f,k);if(l&&c(a))return void(g=a)}}d(a)}),!g){var l=k.filter(function(a){return a.component.props.axetype===e.component.props.axetype});l.length>0&&c(l[l.length-1])}}else a(k,function(a){d(a)})}}}}();var d=0;orb.react.DropTarget=React.createClass({displayName:"DropTarget",getInitialState:function(){return this.dtid=++d,orb.react.DragManager.registerTarget(this,this.props.axetype,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){orb.react.DragManager.unregisterTarget(this)},onDragOver:function(){this.setState({isover:!0})},onDragEnd:function(){this.setState({isover:!1})},render:function(){var a=this,b=orb.react.DropIndicator,c=this.props.data.map(function(c,d){return d<a.props.data.length-1?[React.createElement(b,{isFirst:0===d,position:d,axetype:a.props.axetype}),c]:[React.createElement(b,{isFirst:0===d,position:d,axetype:a.props.axetype}),c,React.createElement(b,{isLast:!0,position:null,axetype:a.props.axetype})]});return React.createElement("div",{className:"drop-target"+(this.state.isover?" drag-over":"")},c)}}),orb.react.DropIndicator=React.createClass({displayName:"DropIndicator",getInitialState:function(){return orb.react.DragManager.registerIndicator(this,this.props.axetype,this.props.position,this.onDragOver,this.onDragEnd),{isover:!1}},componentWillUnmount:function(){orb.react.DragManager.unregisterIndicator(this)},onDragOver:function(a){this.setState({isover:!0,width:a.getDOMNode().style.width})},onDragEnd:function(){this.setState({isover:!1,width:null})},render:function(){var a="drop-indicator";this.props.isFirst&&(a+=" drop-indicator-first"),this.props.isLast&&(a+=" drop-indicator-last");var b={};return this.state.isover&&(a+=" drop-indicator-drag-over"),React.createElement("div",{style:b,className:a})}});var e=0;orb.react.PivotButton=React.createClass({displayName:"PivotButton",getInitialState:function(){return this.pbid=++e,{pos:{x:0,y:0},startpos:{x:0,y:0},mousedown:!1,dragging:!1}},onMouseDown:function(a){if(0===a.button){var c=b(this.getDOMNode());this.setState({mousedown:!0,mouseoffset:{x:c.x-a.pageX,y:c.y-a.pageY},startpos:{x:a.pageX,y:a.pageY}}),a.stopPropagation(),a.preventDefault()}},componentDidUpdate:function(){this.state.mousedown?this.state.mousedown&&(orb.react.DragManager.dragElement(this),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)):(orb.react.DragManager.dragElement(null),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp))},componentWillUnmount:function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},onMouseUp:function(){var a=this.state.dragging;this.setState({mousedown:!1,dragging:!1,size:null,pos:{x:0,y:0}}),a||this.props.rootComp.sort(this.props.axetype,this.props.field)},onMouseMove:function(a){if(console.log("PivotButton["+this.pbid+"].onMouseMove"),this.state.mousedown){var b=null;b=this.state.dragging?this.state.size:c(this.getDOMNode());var d={x:a.pageX+this.state.mouseoffset.x,y:a.pageY+this.state.mouseoffset.y};this.setState({dragging:!0,size:b,pos:d}),orb.react.DragManager.elementMoved(),a.stopPropagation(),a.preventDefault()}},render:function(){var a=this,b={left:a.state.pos.x+"px",top:a.state.pos.y+"px",position:a.state.dragging?"fixed":""};a.state.size&&(b.width=a.state.size.width+"px");var c=(orb.react.DropIndicator,"asc"===a.props.field.sort.order?" \u25b3":"desc"===a.props.field.sort.order?" \u25bd":"");return React.createElement("div",{key:a.props.field.name,className:"field-button",onMouseDown:this.onMouseDown,style:b},a.props.field.caption,React.createElement("span",null,c))}})}();

{'fraction_non_alphanumeric': 0.2558155866500465, 'fraction_numerical': 0.010323214944082585, 'mean_word_length': 13.215123533815822, 'pattern_counts': {'":': 30, '<': 73, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2305404', 'n_tokens_mistral': 24129, 'n_tokens_neox': 23976, 'n_words': 693}