Built motion from commit 857c5af.|0.0.124
[motion.git] / server / api / custom_report / custom_report.controller.js
1 var _0x72e4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x4D\x65\x74\x72\x69\x63","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x6D\x6F\x6D\x65\x6E\x74","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x67\x65\x74\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x72\x79","\x45\x72\x72\x6F\x72\x20\x67\x65\x74\x74\x69\x6E\x67\x20\x71\x75\x65\x72\x79\x20\x66\x72\x6F\x6D\x20\x61\x70\x69\x3A","\x6C\x6F\x67","\x61\x6C\x6C","\x62\x75\x69\x6C\x64\x51\x75\x65\x72\x79","\x73\x70\x72\x65\x61\x64","\x75\x73\x65\x72","\x62\x75\x69\x6C\x64\x46\x69\x6C\x74\x65\x72","\x66\x6F\x75\x6E\x64\x20\x72\x65\x70\x6F\x72\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x64\x61\x69\x6C\x79","\x74\x72\x75\x65","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44","\x66\x6F\x72\x6D\x61\x74","\x65\x6E\x64\x44\x61\x74\x65","\x74\x61\x62\x6C\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x5F\x68\x69\x73\x74\x6F\x72\x79","","\x72\x65\x70\x6C\x61\x63\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x70\x72\x65\x76\x69\x65\x77","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6D\x69\x74","\x76\x61\x6C\x75\x65","\x74\x61\x6B\x65","\x6F\x66\x66\x73\x65\x74","\x73\x6C\x69\x63\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x4F\x77\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x43\x53\x56","\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x2E\x6A\x73","\x66\x6F\x72\x6B","\x65\x72\x72\x6F\x72","\x63\x68\x69\x6C\x64\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x63\x68\x69\x6C\x64\x20\x63\x6C\x6F\x73\x65","\x6D\x65\x73\x73\x61\x67\x65","\x63\x68\x69\x6C\x64\x20\x6D\x65\x73\x73\x61\x67\x65","\x6B\x69\x6C\x6C","\x74\x72\x65\x65","\x70\x61\x72\x73\x65","\x70\x61\x72\x65\x6E\x74","\x66\x69\x6E\x64","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x74\x65\x78\x74","\x2F\x20","\x23","\x73\x68\x6F\x77","\x65\x78\x70\x6F\x72\x74","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x63\x6F\x70\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x62\x6F\x64\x79","\x6D\x61\x70","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64\x73","\x69\x6D\x70\x6F\x72\x74","\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x69\x73\x41\x72\x72\x61\x79","\x67\x65\x74\x54\x61\x62\x6C\x65","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74\x49\x64","\x4D\x65\x74\x72\x69\x63\x49\x64","\x66\x69\x65\x6C\x64","\x6D\x65\x74\x72\x69\x63","\x70\x75\x73\x68","\x54\x68\x65\x20\x6D\x65\x74\x72\x69\x63\x20\x77\x69\x74\x68\x20\x69\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x63\x75\x73\x74\x6F\x6D","\x54\x68\x65\x20\x66\x69\x65\x6C\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65","\x6B\x65\x79\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x59\x6F\x75\x20\x68\x61\x76\x65\x20\x6E\x6F\x74\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x6F\x72\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x44\x65\x66\x61\x75\x6C\x74\x4D\x65\x74\x72\x69\x63\x49\x64","\x68\x61\x73","\x65\x76\x65\x72\x79","\x44\x65\x66\x61\x75\x6C\x74\x4D\x65\x74\x72\x69\x63","\x55\x6E\x73\x75\x70\x70\x6F\x72\x74\x65\x64\x20\x49\x6D\x70\x6F\x72\x74\x20\x66\x6F\x72\x6D\x61\x74\x20\x28\x4D\x65\x74\x72\x69\x63\x20\x74\x79\x70\x65\x20\x69\x6E\x20\x72\x65\x70\x6F\x72\x74\x20\x66\x69\x65\x6C\x64\x73\x20\x69\x73\x20\x6D\x69\x73\x73\x69\x6E\x67\x29","\x49\x64","\x67\x72\x6F\x75\x70\x42\x79","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6E\x75\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x5F","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x72e4[0];var _=require(_0x72e4[1]);var util=require(_0x72e4[2]);var sequelize=require(_0x72e4[4])[_0x72e4[3]];var CustomReport=require(_0x72e4[4])[_0x72e4[5]];var ReportField=require(_0x72e4[4])[_0x72e4[6]];var Metric=require(_0x72e4[4])[_0x72e4[7]];var ExtractedReport=require(_0x72e4[4])[_0x72e4[8]];var extractUtils=require(_0x72e4[9]);var reportBuildUtils=require(_0x72e4[10]);var Util=require(_0x72e4[11]);var sr=require(_0x72e4[12]);var moment=require(_0x72e4[13]);var cp=require(_0x72e4[14]);var ReportTree=require(_0x72e4[4])[_0x72e4[15]];exports[_0x72e4[16]]= function(_0x905exf,_0x905ex10,_0x905ex11){return CustomReport[_0x72e4[23]](Util[_0x72e4[22]](_0x905exf[_0x72e4[21]]))[_0x72e4[20]](function(_0x905ex13){_0x905ex10[_0x72e4[19]](200)[_0x72e4[18]](_0x905ex13)})[_0x72e4[17]](function(_0x905ex12){return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[24]]= function(_0x905exf,_0x905ex10){return Promise[_0x72e4[27]]([])[_0x72e4[20]](getQuery(_0x905exf,_0x905ex10))[_0x72e4[20]](function(_0x905ex14){_0x905ex10[_0x72e4[19]](200)[_0x72e4[18]]({query:_0x905ex14})})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x72e4[25],_0x905ex12)})};function getQuery(_0x905exf,_0x905ex10){var _0x905ex16;return function(){return CustomReport[_0x72e4[49]](_0x72e4[48])[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]])[_0x72e4[20]](function(_0x905ex18){console[_0x72e4[26]](_0x72e4[32]);if(!_0x905ex18){return _0x905ex10[_0x72e4[33]](404)};if(_0x905exf[_0x72e4[21]][_0x72e4[34]]&& _0x905exf[_0x72e4[21]][_0x72e4[34]]=== _0x72e4[35]){_0x905exf[_0x72e4[21]][_0x72e4[36]]= moment()[_0x72e4[38]](_0x72e4[37]);_0x905exf[_0x72e4[21]][_0x72e4[39]]= moment()[_0x72e4[38]](_0x72e4[37]);_0x905ex18[_0x72e4[41]][_0x72e4[40]]= _0x905ex18[_0x72e4[41]][_0x72e4[40]][_0x72e4[44]](_0x72e4[42],_0x72e4[43])};delete _0x905exf[_0x72e4[21]][_0x72e4[34]];_0x905ex16= _0x905ex18[_0x72e4[41]];return _0x905ex16[_0x72e4[40]]})[_0x72e4[20]](reportBuildUtils[_0x72e4[31]](_0x905exf[_0x72e4[30]]))[_0x72e4[20]](function(_0x905ex17){return [_0x905ex17,_0x905ex16]})[_0x72e4[29]](reportBuildUtils[_0x72e4[28]](_0x905exf[_0x72e4[21]]))}}exports[_0x72e4[50]]= function(_0x905exf,_0x905ex10){var _0x905ex19;return Promise[_0x72e4[27]]([])[_0x72e4[20]](getQuery(_0x905exf,_0x905ex10))[_0x72e4[20]](function(_0x905ex14){return _0x905ex14?sequelize[_0x72e4[21]](_0x905ex14,{type:sequelize[_0x72e4[61]][_0x72e4[60]]}):[]})[_0x72e4[20]](function(_0x905ex1a){_0x905ex19= _0x905ex1a[_0x72e4[51]];if(_0x905exf[_0x72e4[21]][_0x72e4[52]]){_0x905ex1a= _(_0x905ex1a)[_0x72e4[56]](_0x905exf[_0x72e4[21]][_0x72e4[55]]|| 0)[_0x72e4[54]](_0x905exf[_0x72e4[21]][_0x72e4[52]])[_0x72e4[53]]()};_[_0x72e4[59]](_0x905ex1a,function(_0x905ex1b){_[_0x72e4[58]](_0x905ex1b,function(_0x905ex1c,_0x905ex1d){if(_0x905ex1c instanceof  Date){_0x905ex1b[_0x905ex1d]= moment(_0x905ex1c)[_0x72e4[38]](_0x72e4[57]).toString()}})});_0x905ex10[_0x72e4[19]](200)[_0x72e4[18]]({rows:_0x905ex1a,count:_0x905ex19})})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x905ex12);return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[62]]= function(_0x905exf,_0x905ex10){docExtract(_0x905exf,_0x905ex10,_0x72e4[63])};exports[_0x72e4[64]]= function(_0x905exf,_0x905ex10){docExtract(_0x905exf,_0x905ex10,_0x72e4[65])};function docExtract(_0x905exf,_0x905ex10,_0x905ex1f){var _0x905ex18;CustomReport[_0x72e4[49]](_0x72e4[48])[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]])[_0x72e4[20]](function(_0x905ex16){if(!_0x905ex16){return _0x905ex10[_0x72e4[33]](404)};_0x905ex18= _0x905ex16;return ReportTree[_0x72e4[47]](2)})[_0x72e4[20]](function(_0x905ex23){_0x905ex23= JSON[_0x72e4[77]](_0x905ex23[_0x72e4[76]]);var _0x905ex24=_[_0x72e4[79]](_0x905ex23,{id:_0x905ex18[_0x72e4[78]]});var _0x905ex25=getReportPath(_0x905ex24,_0x905ex23,_0x905ex18[_0x72e4[80]]);if(_0x905exf[_0x72e4[21]][_0x72e4[34]]&& _0x905exf[_0x72e4[21]][_0x72e4[34]]=== _0x72e4[35]){_0x905exf[_0x72e4[21]][_0x72e4[36]]= moment()[_0x72e4[38]](_0x72e4[37]);_0x905exf[_0x72e4[21]][_0x72e4[39]]= moment()[_0x72e4[38]](_0x72e4[37]);_0x905ex18[_0x72e4[41]][_0x72e4[40]]= _0x905ex18[_0x72e4[41]][_0x72e4[40]][_0x72e4[44]](_0x72e4[42],_0x72e4[43])};delete _0x905exf[_0x72e4[21]][_0x72e4[34]];return [_0x905ex18,ExtractedReport[_0x72e4[81]]({name:_0x905ex25,startDate:_0x905exf[_0x72e4[21]][_0x72e4[36]]|| null,endDate:_0x905exf[_0x72e4[21]][_0x72e4[39]]|| null,output:_0x905ex1f,UserId:_0x905exf[_0x72e4[30]][_0x72e4[45]]})]})[_0x72e4[29]](function(_0x905ex18,_0x905ex20){var _0x905ex21=cp[_0x72e4[67]](__dirname+ _0x72e4[66]);_0x905ex21[_0x72e4[70]](_0x72e4[73],function(_0x905ex22){console[_0x72e4[26]](_0x72e4[74],_0x905ex22);_0x905ex21[_0x72e4[75]]()})[_0x72e4[70]](_0x72e4[71],function(){console[_0x72e4[26]](_0x72e4[72])})[_0x72e4[70]](_0x72e4[68],function(_0x905ex12){console[_0x72e4[26]](_0x72e4[69],_0x905ex12)});_0x905ex21[_0x72e4[18]]({report:_0x905ex18,query:_0x905exf[_0x72e4[21]],extractedId:_0x905ex20[_0x72e4[45]],user:_0x905exf[_0x72e4[30]],type:_0x905ex1f})})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x905ex12);return handleError(_0x905ex10,_0x905ex12)});return _0x905ex10[_0x72e4[33]](200)}function getReportPath(_0x905ex24,_0x905ex23,_0x905ex25){_0x905ex25= _0x905ex24[_0x72e4[82]]+ _0x72e4[83]+ _0x905ex25;if(_0x905ex24[_0x72e4[78]]=== _0x72e4[84]){return _0x905ex25}else {return getReportPath(_[_0x72e4[79]](_0x905ex23,{id:_0x905ex24[_0x72e4[78]]}),_0x905ex23,_0x905ex25)}}exports[_0x72e4[85]]= function(_0x905exf,_0x905ex10){return CustomReport[_0x72e4[49]](_0x72e4[48])[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]])[_0x72e4[20]](function(_0x905ex18){if(!_0x905ex18){return _0x905ex10[_0x72e4[33]](404)};return _0x905ex10[_0x72e4[18]](_0x905ex18)})[_0x72e4[17]](function(_0x905ex12){return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[86]]= function(_0x905exf,_0x905ex10){return CustomReport[_0x72e4[49]]({method:[_0x72e4[89],{CustomReportId:_0x905exf[_0x72e4[46]][_0x72e4[45]]}]})[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]],{attributes:[_0x72e4[87],_0x72e4[88],_0x72e4[80],_0x72e4[78],_0x72e4[40]]})[_0x72e4[20]](function(_0x905ex18){if(!_0x905ex18){return _0x905ex10[_0x72e4[33]](404)};return _0x905ex10[_0x72e4[18]](_0x905ex18)})[_0x72e4[17]](function(_0x905ex12){return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[90]]= function(_0x905exf,_0x905ex10){var _0x905ex27;return sequelize[_0x72e4[95]](function(_0x905ex28){return CustomReport[_0x72e4[49]](_0x72e4[48])[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]])[_0x72e4[20]](function(_0x905ex18){if(!_0x905ex18){return _0x905ex10[_0x72e4[33]](404)};var _0x905ex29=_0x905ex18[_0x72e4[41]];delete _0x905ex29[_0x72e4[45]];delete _0x905ex29[_0x72e4[91]];delete _0x905ex29[_0x72e4[92]];_0x905ex29[_0x72e4[78]]= _0x905exf[_0x72e4[93]][_0x72e4[78]];_0x905ex27= _[_0x72e4[94]](_0x905ex29.Fields,_0x72e4[41]);return CustomReport[_0x72e4[81]](_0x905ex29,{transaction:_0x905ex28})})[_0x72e4[20]](function(_0x905ex18){return [_0x905ex18,_0x905ex27]})[_0x72e4[29]](createFields(_0x905ex28))})[_0x72e4[20]](function(){return _0x905ex10[_0x72e4[33]](201)})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x905ex12);return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[81]]= function(_0x905exf,_0x905ex10){var _0x905ex16;return sequelize[_0x72e4[95]](function(_0x905ex28){return CustomReport[_0x72e4[81]](_0x905exf[_0x72e4[93]],{transaction:_0x905ex28})[_0x72e4[20]](function(_0x905ex18){_0x905ex16= _0x905ex18;return [_0x905ex16,_0x905exf[_0x72e4[93]][_0x72e4[96]]]})[_0x72e4[29]](createFields(_0x905ex28))})[_0x72e4[20]](function(){return _0x905ex10[_0x72e4[19]](201)[_0x72e4[18]](_0x905ex16)})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x905ex12);return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[97]]= function(_0x905exf,_0x905ex10){var _0x905ex16;return sequelize[_0x72e4[95]](function(_0x905ex28){return CustomReport[_0x72e4[81]](_0x905exf[_0x72e4[93]],{transaction:_0x905ex28})[_0x72e4[20]](function(_0x905ex18){_0x905ex16= _0x905ex18;return [_0x905ex16,_0x905exf[_0x72e4[93]][_0x72e4[96]]]})[_0x72e4[29]](createImportFields(_0x905ex28))})[_0x72e4[20]](function(){return _0x905ex10[_0x72e4[19]](201)[_0x72e4[18]](_0x905ex16)})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x905ex12);return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[98]]= function(_0x905exf,_0x905ex10,_0x905ex11){if(_0x905exf[_0x72e4[93]][_0x72e4[45]]){delete _0x905exf[_0x72e4[93]][_0x72e4[45]]};var _0x905ex16;return sequelize[_0x72e4[95]](function(_0x905ex28){return CustomReport[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]])[_0x72e4[20]](function(_0x905ex18){if(!_0x905ex18){return _0x905ex10[_0x72e4[33]](404)};var _0x905ex2a=_[_0x72e4[100]](_0x905ex18,_0x905exf[_0x72e4[93]]);return _0x905ex18[_0x72e4[101]]({transaction:_0x905ex28})})[_0x72e4[20]](function(_0x905ex18){_0x905ex16= _0x905ex18;if(_0x905exf[_0x72e4[93]][_0x72e4[96]]){return ReportField[_0x72e4[99]]({where:{CustomReportId:_0x905exf[_0x72e4[46]][_0x72e4[45]]},transaction:_0x905ex28})}})[_0x72e4[20]](function(){return [_0x905ex16,_0x905exf[_0x72e4[93]][_0x72e4[96]]]})[_0x72e4[29]](createFields(_0x905ex28))})[_0x72e4[20]](function(){return _0x905ex10[_0x72e4[33]](200)})[_0x72e4[17]](function(_0x905ex12){console[_0x72e4[26]](_0x905ex12);return handleError(_0x905ex10,_0x905ex12)})};function createFields(_0x905ex28){return function(_0x905ex18,_0x905ex2c){if(_0x905ex2c&& Array[_0x72e4[102]](_0x905ex2c)&& _0x905ex2c[_0x72e4[51]]){var _0x905ex2d=reportBuildUtils[_0x72e4[103]](_0x905ex18[_0x72e4[40]]);if(_0x905ex2d){var _0x905ex2e;return _0x905ex2d[_0x72e4[117]]()[_0x72e4[20]](function(_0x905ex33){_0x905ex2e= _[_0x72e4[115]](_0x905ex33);return Metric[_0x72e4[116]]()})[_0x72e4[20]](function(_0x905ex2f){var _0x905ex30=[];_0x905ex2f= _[_0x72e4[94]](_0x905ex2f,_0x72e4[41]);_0x905ex2c[_0x72e4[59]](function(_0x905ex31){_0x905ex31[_0x72e4[104]]= _0x905ex18[_0x72e4[45]];if(_0x905ex31[_0x72e4[105]]){var _0x905ex32=_[_0x72e4[79]](_0x905ex2f,{id:_0x905ex31[_0x72e4[105]]});if(_0x905ex32){_0x905ex31[_0x72e4[106]]= _0x905ex32[_0x72e4[107]];_0x905ex30[_0x72e4[108]](ReportField[_0x72e4[81]](_0x905ex31,{transaction:_0x905ex28}))}else {throw  new sequelize.Error(_0x72e4[109]+ _0x905ex31[_0x72e4[105]]+ _0x72e4[110])}}else {if(_[_0x72e4[111]](_0x905ex2e,_0x905ex31[_0x72e4[106]])|| _0x905ex31[_0x72e4[112]]){_0x905ex30[_0x72e4[108]](ReportField[_0x72e4[81]](_0x905ex31,{transaction:_0x905ex28}))}else {throw  new sequelize.Error(_0x72e4[113]+ _0x905ex31[_0x72e4[106]]+ _0x72e4[114])}}});return _0x905ex30})[_0x72e4[27]]()}else {throw  new sequelize.Error(_0x72e4[118])}}}}function createImportFields(_0x905ex28){return function(_0x905ex18,_0x905ex2c){if(_0x905ex2c&& Array[_0x72e4[102]](_0x905ex2c)&& _0x905ex2c[_0x72e4[51]]){var _0x905ex2d=reportBuildUtils[_0x72e4[103]](_0x905ex18[_0x72e4[40]]);if(_0x905ex2d){var _0x905ex2e;return _0x905ex2d[_0x72e4[117]]()[_0x72e4[20]](function(_0x905ex33){_0x905ex2e= _[_0x72e4[115]](_0x905ex33);var _0x905ex30=[];var _0x905ex35;if(_[_0x72e4[121]](_0x905ex2c,function(_0x905ex31){return _[_0x72e4[120]](_0x905ex31,_0x72e4[119])})){_0x905ex35= _0x72e4[122]}else {if(_[_0x72e4[121]](_0x905ex2c,function(_0x905ex31){return _[_0x72e4[120]](_0x905ex31,_0x72e4[105])})){_0x905ex35= _0x72e4[7]}else {throw  new sequelize.Error(_0x72e4[123])}};var _0x905ex36=_[_0x72e4[125]](_0x905ex2c,_0x905ex35+ _0x72e4[124]);_[_0x72e4[58]](_0x905ex36,function(_0x905ex37,_0x905ex1d){if(_0x905ex1d!== _0x72e4[126]&& _0x905ex1d!== _0x72e4[127]){_0x905ex37[0][_0x905ex35][_0x72e4[128]][_0x72e4[59]](function(_0x905ex31){_0x905ex31[_0x72e4[104]]= _0x905ex18[_0x72e4[45]]});_0x905ex37[0][_0x905ex35][_0x72e4[80]]+= _0x72e4[129]+ sr({length:5});_0x905ex30[_0x72e4[108]](Metric[_0x72e4[81]](_0x905ex37[0][_0x905ex35],{include:[{model:ReportField,as:_0x72e4[128]}],transaction:_0x905ex28}))}else {_0x905ex37[_0x72e4[59]](function(_0x905ex31){if(_[_0x72e4[111]](_0x905ex2e,_0x905ex31[_0x72e4[106]])|| _0x905ex31[_0x72e4[112]]){_0x905ex31[_0x72e4[104]]= _0x905ex18[_0x72e4[45]];_0x905ex30[_0x72e4[108]](ReportField[_0x72e4[81]](_0x905ex31,{transaction:_0x905ex28}))}else {throw  new sequelize.Error(_0x72e4[113]+ _0x905ex31[_0x72e4[106]]+ _0x72e4[114])}})}});return _0x905ex30})[_0x72e4[27]]()}else {throw  new sequelize.Error(_0x72e4[118])}}}}exports[_0x72e4[99]]= function(_0x905exf,_0x905ex10){return CustomReport[_0x72e4[47]](_0x905exf[_0x72e4[46]][_0x72e4[45]])[_0x72e4[20]](function(_0x905ex18){if(!_0x905ex18){return _0x905ex10[_0x72e4[33]](404)};return _0x905ex18[_0x72e4[99]]()})[_0x72e4[20]](function(){return _0x905ex10[_0x72e4[33]](204)})[_0x72e4[17]](function(_0x905ex12){return handleError(_0x905ex10,_0x905ex12)})};exports[_0x72e4[130]]= function(_0x905exf,_0x905ex10){return CustomReport[_0x72e4[99]]({where:{id:_0x905exf[_0x72e4[21]][_0x72e4[131]]},individualHooks:true})[_0x72e4[20]](function(){return _0x905ex10[_0x72e4[33]](204)})[_0x72e4[17]](function(_0x905ex12){return handleError(_0x905ex10,_0x905ex12)})};function handleError(_0x905ex10,_0x905ex12){return _0x905ex10[_0x72e4[19]](500)[_0x72e4[18]](_0x905ex12)}