Built motion from commit (unavailable).|2.5.12
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 42cdca7..df73f92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfccf=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','autoAssociation','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','CustomDashboards','send','map','Dashboard','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find'];(function(_0x1ff171,_0x4012af){var _0x456656=function(_0x12ca4f){while(--_0x12ca4f){_0x1ff171['push'](_0x1ff171['shift']());}};_0x456656(++_0x4012af);}(_0xfccf,0xaa));var _0xffcc=function(_0x3d9105,_0x356c8f){_0x3d9105=_0x3d9105-0x0;var _0x57166a=_0xfccf[_0x3d9105];return _0x57166a;};'use strict';var pdf=require(_0xffcc('0x0'));var emlformat=require(_0xffcc('0x1'));var rimraf=require(_0xffcc('0x2'));var zipdir=require(_0xffcc('0x3'));var jsonpatch=require(_0xffcc('0x4'));var rp=require(_0xffcc('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xffcc('0x6'));var util=require(_0xffcc('0x7'));var path=require(_0xffcc('0x8'));var sox=require(_0xffcc('0x9'));var csv=require(_0xffcc('0xa'));var ejs=require(_0xffcc('0xb'));var fs=require('fs');var _=require(_0xffcc('0xc'));var squel=require(_0xffcc('0xd'));var crypto=require('crypto');var jsforce=require(_0xffcc('0xe'));var deskjs=require(_0xffcc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xffcc('0x10'));var Papa=require(_0xffcc('0x11'));var Redis=require('ioredis');var authService=require(_0xffcc('0x12'));var qs=require(_0xffcc('0x13'));var as=require(_0xffcc('0x14'));var hardwareService=require(_0xffcc('0x15'));var logger=require(_0xffcc('0x16'))(_0xffcc('0x17'));var utils=require(_0xffcc('0x18'));var config=require(_0xffcc('0x19'));var db=require(_0xffcc('0x1a'))['db'];config[_0xffcc('0x1b')]=_[_0xffcc('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xffcc('0x1d'))(new Redis(config[_0xffcc('0x1b')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x37eb46,_0x55f73c){_0x55f73c=_0x55f73c||0xcc;return function(_0x312465){if(_0x312465){return _0x37eb46[_0xffcc('0x1e')](_0x55f73c);}return _0x37eb46[_0xffcc('0x1f')](_0x55f73c)[_0xffcc('0x20')]();};}function respondWithResult(_0x5ac309,_0x44372e){_0x44372e=_0x44372e||0xc8;return function(_0x3086b7){if(_0x3086b7){return _0x5ac309[_0xffcc('0x1f')](_0x44372e)[_0xffcc('0x21')](_0x3086b7);}};}function respondWithFilteredResult(_0x5e0d2a,_0x35c427){return function(_0x268ee8){if(_0x268ee8){var _0x4e979f=_0x268ee8[_0xffcc('0x22')],_0x3dd2c8=_0x35c427[_0xffcc('0x23')],_0x230411=_0x35c427[_0xffcc('0x23')]+_0x35c427[_0xffcc('0x24')],_0x51437d;if(_0x230411>=_0x4e979f){_0x230411=_0x4e979f;_0x51437d=0xc8;}else{_0x51437d=0xce;}_0x5e0d2a['status'](_0x51437d);return _0x5e0d2a['set'](_0xffcc('0x25'),_0x3dd2c8+'-'+_0x230411+'/'+_0x4e979f)[_0xffcc('0x21')](_0x268ee8);}return null;};}function patchUpdates(_0x247329){return function(_0x46558e){try{jsonpatch[_0xffcc('0x26')](_0x46558e,_0x247329,!![]);}catch(_0x193297){return BPromise[_0xffcc('0x27')](_0x193297);}return _0x46558e[_0xffcc('0x28')]();};}function saveUpdates(_0x217914,_0x408d70){return function(_0x8e2840){if(_0x8e2840){return _0x8e2840[_0xffcc('0x29')](_0x217914)['then'](function(_0x174eb4){return _0x174eb4;});}return null;};}function removeEntity(_0x285280,_0x18e4ed){return function(_0x1b9024){if(_0x1b9024){return _0x1b9024[_0xffcc('0x2a')]()[_0xffcc('0x2b')](function(){var _0x1add35=_0x1b9024['get']({'plain':!![]});var _0x18b9c9=_0xffcc('0x2c');return db['UserProfileResource'][_0xffcc('0x2a')]({'where':{'type':_0x18b9c9,'resourceId':_0x1add35['id']}})[_0xffcc('0x2b')](function(){return _0x1b9024;});})['then'](function(){_0x285280[_0xffcc('0x1f')](0xcc)[_0xffcc('0x20')]();});}};}function handleEntityNotFound(_0xc6c631,_0x303437){return function(_0x5f28f2){if(!_0x5f28f2){_0xc6c631[_0xffcc('0x1e')](0x194);}return _0x5f28f2;};}function handleError(_0xced4e7,_0x364869){_0x364869=_0x364869||0x1f4;return function(_0x434cb7){logger['error'](_0x434cb7['stack']);if(_0x434cb7['name']){delete _0x434cb7['name'];}_0xced4e7['status'](_0x364869)[_0xffcc('0x2d')](_0x434cb7);};}exports['index']=function(_0x2564c3,_0x36517c){var _0x7d73d0={},_0x6cca29={},_0x1d2061={'count':0x0,'rows':[]};var _0x501bcf=_[_0xffcc('0x2e')](db[_0xffcc('0x2f')][_0xffcc('0x30')],function(_0x46337c){return{'name':_0x46337c[_0xffcc('0x31')],'type':_0x46337c[_0xffcc('0x32')][_0xffcc('0x33')]};});_0x6cca29[_0xffcc('0x34')]=_[_0xffcc('0x2e')](_0x501bcf,_0xffcc('0x35'));_0x6cca29[_0xffcc('0x36')]=_['keys'](_0x2564c3['query']);_0x6cca29[_0xffcc('0x37')]=_[_0xffcc('0x38')](_0x6cca29['model'],_0x6cca29[_0xffcc('0x36')]);_0x7d73d0[_0xffcc('0x39')]=_[_0xffcc('0x38')](_0x6cca29[_0xffcc('0x34')],qs[_0xffcc('0x3a')](_0x2564c3['query'][_0xffcc('0x3a')]));_0x7d73d0['attributes']=_0x7d73d0[_0xffcc('0x39')]['length']?_0x7d73d0[_0xffcc('0x39')]:_0x6cca29[_0xffcc('0x34')];if(!_0x2564c3['query'][_0xffcc('0x3b')](_0xffcc('0x3c'))){_0x7d73d0[_0xffcc('0x24')]=qs[_0xffcc('0x24')](_0x2564c3[_0xffcc('0x36')]['limit']);_0x7d73d0[_0xffcc('0x23')]=qs['offset'](_0x2564c3[_0xffcc('0x36')]['offset']);}_0x7d73d0[_0xffcc('0x3d')]=qs[_0xffcc('0x3e')](_0x2564c3[_0xffcc('0x36')]['sort']);_0x7d73d0[_0xffcc('0x3f')]=qs[_0xffcc('0x37')](_[_0xffcc('0x40')](_0x2564c3[_0xffcc('0x36')],_0x6cca29[_0xffcc('0x37')]));if(_0x2564c3['query'][_0xffcc('0x41')]){_0x7d73d0[_0xffcc('0x3f')]=_[_0xffcc('0x42')](_0x7d73d0[_0xffcc('0x3f')],{'$or':_['map'](_0x501bcf,function(_0x24ef1a){if(_0x24ef1a[_0xffcc('0x32')]!==_0xffcc('0x43')){var _0x9a2ba0={};_0x9a2ba0[_0x24ef1a['name']]={'$like':'%'+_0x2564c3[_0xffcc('0x36')][_0xffcc('0x41')]+'%'};return _0x9a2ba0;}})});}_0x7d73d0=_['merge']({},_0x7d73d0,_0x2564c3[_0xffcc('0x44')]);var _0x6dc547={'where':_0x7d73d0['where']};return db[_0xffcc('0x2f')]['count'](_0x6dc547)[_0xffcc('0x2b')](function(_0x350903){_0x1d2061['count']=_0x350903;if(_0x2564c3['query'][_0xffcc('0x45')]){_0x7d73d0[_0xffcc('0x46')]=[{'all':!![]}];}return db[_0xffcc('0x2f')][_0xffcc('0x47')](_0x7d73d0);})[_0xffcc('0x2b')](function(_0x469ca1){_0x1d2061[_0xffcc('0x48')]=_0x469ca1;return _0x1d2061;})[_0xffcc('0x2b')](respondWithFilteredResult(_0x36517c,_0x7d73d0))[_0xffcc('0x49')](handleError(_0x36517c,null));};exports['show']=function(_0x1854fa,_0xc0d588){var _0x4172e1={'raw':![],'where':{'id':_0x1854fa[_0xffcc('0x4a')]['id']}},_0x20276e={};_0x20276e[_0xffcc('0x34')]=_[_0xffcc('0x4b')](db[_0xffcc('0x2f')][_0xffcc('0x30')]);_0x20276e[_0xffcc('0x36')]=_[_0xffcc('0x4b')](_0x1854fa[_0xffcc('0x36')]);_0x20276e['filters']=_[_0xffcc('0x38')](_0x20276e['model'],_0x20276e['query']);_0x4172e1['attributes']=_[_0xffcc('0x38')](_0x20276e['model'],qs[_0xffcc('0x3a')](_0x1854fa[_0xffcc('0x36')][_0xffcc('0x3a')]));_0x4172e1[_0xffcc('0x39')]=_0x4172e1[_0xffcc('0x39')][_0xffcc('0x4c')]?_0x4172e1['attributes']:_0x20276e[_0xffcc('0x34')];if(_0x1854fa['query'][_0xffcc('0x45')]){_0x4172e1['include']=[{'all':!![]}];}_0x4172e1=_[_0xffcc('0x42')]({},_0x4172e1,_0x1854fa[_0xffcc('0x44')]);return db[_0xffcc('0x2f')][_0xffcc('0x4d')](_0x4172e1)[_0xffcc('0x2b')](handleEntityNotFound(_0xc0d588,null))[_0xffcc('0x2b')](respondWithResult(_0xc0d588,null))['catch'](handleError(_0xc0d588,null));};exports[_0xffcc('0x4e')]=function(_0x11e73d,_0x355ce1){return db[_0xffcc('0x2f')]['create'](_0x11e73d[_0xffcc('0x4f')],{})['then'](function(_0x4e83c5){var _0x56aaa6=_0x11e73d[_0xffcc('0x50')]['get']({'plain':!![]});if(!_0x56aaa6)throw new Error(_0xffcc('0x51'));if(_0x56aaa6[_0xffcc('0x52')]===_0xffcc('0x50')){var _0x257407=_0x4e83c5[_0xffcc('0x53')]({'plain':!![]});var _0x56f173=_0xffcc('0x2c');return db[_0xffcc('0x54')][_0xffcc('0x4d')]({'where':{'name':_0x56f173,'userProfileId':_0x56aaa6[_0xffcc('0x55')]},'raw':!![]})[_0xffcc('0x2b')](function(_0x4ffc18){if(_0x4ffc18&&_0x4ffc18['autoAssociation']===0x0){return db[_0xffcc('0x56')][_0xffcc('0x4e')]({'name':_0x257407['name'],'resourceId':_0x257407['id'],'type':_0x4ffc18[_0xffcc('0x35')],'sectionId':_0x4ffc18['id']},{})[_0xffcc('0x2b')](function(){return _0x4e83c5;});}else{return _0x4e83c5;}})[_0xffcc('0x49')](function(_0x1b87a6){logger[_0xffcc('0x57')](_0xffcc('0x58'),_0x1b87a6);throw _0x1b87a6;});}return _0x4e83c5;})[_0xffcc('0x2b')](respondWithResult(_0x355ce1,0xc9))['catch'](handleError(_0x355ce1,null));};exports[_0xffcc('0x59')]=function(_0x5c40f5,_0x547c1c){var _0x287ced={'where':{'id':_0x5c40f5['params']['id']}},_0x4ff30d={};_0x4ff30d['model']=_['keys'](db['Dashboard'][_0xffcc('0x30')]);_0x287ced['attributes']=_['intersection'](_0x4ff30d[_0xffcc('0x34')],qs['fields'](_0x5c40f5['query'][_0xffcc('0x3a')]));_0x287ced['attributes']=_0x287ced['attributes']['length']?_0x287ced[_0xffcc('0x39')]:_0x4ff30d[_0xffcc('0x34')];if(_0x5c40f5[_0xffcc('0x36')]['includeAll']){_0x287ced[_0xffcc('0x46')]=[{'all':!![]}];}_0x287ced=_[_0xffcc('0x42')]({},_0x287ced,_0x5c40f5[_0xffcc('0x44')]);return db['Dashboard'][_0xffcc('0x4d')](_0x287ced)[_0xffcc('0x2b')](handleEntityNotFound(_0x547c1c,null))[_0xffcc('0x2b')](function(_0x4939e8){if(_0x4939e8){var _0x32d269=_0x4939e8[_0xffcc('0x53')]({'plain':!![]});_0x32d269=qs['omit'](_0x32d269,['id',_0xffcc('0x5a'),_0xffcc('0x5b')]);_0x5c40f5[_0xffcc('0x4f')]=_[_0xffcc('0x5c')](_0x5c40f5[_0xffcc('0x4f')],['id','createdAt',_0xffcc('0x5b')]);return db[_0xffcc('0x2f')][_0xffcc('0x4e')](_['merge'](_0x32d269,_0x5c40f5[_0xffcc('0x4f')]),{'include':_0x5c40f5[_0xffcc('0x36')][_0xffcc('0x45')]?[{'all':!![]}]:undefined})[_0xffcc('0x2b')](function(_0x710d7e){var _0x33ccd6=_0x5c40f5[_0xffcc('0x50')]['get']({'plain':!![]});if(!_0x33ccd6)throw new Error(_0xffcc('0x51'));if(_0x33ccd6['role']==='user'){var _0x1b3e67=_0x710d7e[_0xffcc('0x53')]({'plain':!![]});var _0x552419=_0xffcc('0x2c');return db[_0xffcc('0x54')][_0xffcc('0x4d')]({'where':{'name':_0x552419,'userProfileId':_0x33ccd6[_0xffcc('0x55')]},'raw':!![]})[_0xffcc('0x2b')](function(_0x152de9){if(_0x152de9&&_0x152de9[_0xffcc('0x5d')]===0x0){return db[_0xffcc('0x56')][_0xffcc('0x4e')]({'name':_0x1b3e67[_0xffcc('0x35')],'resourceId':_0x1b3e67['id'],'type':_0x152de9[_0xffcc('0x35')],'sectionId':_0x152de9['id']},{})[_0xffcc('0x2b')](function(){return _0x710d7e;});}else{return _0x710d7e;}})[_0xffcc('0x49')](function(_0x3f0d14){logger[_0xffcc('0x57')](_0xffcc('0x58'),_0x3f0d14);throw _0x3f0d14;});}return _0x710d7e;});}})[_0xffcc('0x2b')](respondWithResult(_0x547c1c,0xc9))[_0xffcc('0x49')](handleError(_0x547c1c,null));};exports['update']=function(_0x50ba92,_0xf5f63a){if(_0x50ba92['body']['id']){delete _0x50ba92['body']['id'];}return db['Dashboard'][_0xffcc('0x4d')]({'where':{'id':_0x50ba92['params']['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0xf5f63a,null))[_0xffcc('0x2b')](saveUpdates(_0x50ba92[_0xffcc('0x4f')],null))[_0xffcc('0x2b')](respondWithResult(_0xf5f63a,null))['catch'](handleError(_0xf5f63a,null));};exports['destroy']=function(_0x48f6e0,_0x433e59){return db[_0xffcc('0x2f')][_0xffcc('0x4d')]({'where':{'id':_0x48f6e0[_0xffcc('0x4a')]['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0x433e59,null))['then'](removeEntity(_0x433e59,null))[_0xffcc('0x49')](handleError(_0x433e59,null));};function widgetAttributes(_0x33b16d){try{switch(_0x33b16d[_0xffcc('0x32')]){case'iframe':return[{'name':_0xffcc('0x5e'),'value':_0x33b16d[_0xffcc('0x5e')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||_0xffcc('0x61')}];case _0xffcc('0x62'):return[{'name':_0xffcc('0x63'),'value':_0x33b16d[_0xffcc('0x63')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d['attrs'][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||''}];case _0xffcc('0x64'):return[{'name':_0xffcc('0x65'),'value':_0x33b16d[_0xffcc('0x65')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||_0xffcc('0x66')},{'name':_0xffcc('0x67'),'value':_0x33b16d[_0xffcc('0x67')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d[_0xffcc('0x5f')][0x1][_0xffcc('0x60')]:undefined)||_0xffcc('0x68')},{'name':_0xffcc('0x69'),'value':_0x33b16d[_0xffcc('0x69')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d['attrs'][0x2]?_0x33b16d[_0xffcc('0x5f')][0x2][_0xffcc('0x60')]:undefined)||0xc}];case _0xffcc('0x6a'):return[{'name':'attrMetric','value':_0x33b16d[_0xffcc('0x6b')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d['attrs'][0x0][_0xffcc('0x60')]:undefined)||_0xffcc('0x6c')},{'name':_0xffcc('0x6d'),'value':_0x33b16d['attrVoiceQueues']||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d[_0xffcc('0x5f')][0x1][_0xffcc('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x33b16d[_0xffcc('0x69')]||(_0x33b16d['attrs']&&_0x33b16d[_0xffcc('0x5f')][0x2]?_0x33b16d[_0xffcc('0x5f')][0x2][_0xffcc('0x60')]:undefined)||0x14}];case _0xffcc('0x6e'):case _0xffcc('0x6f'):return[{'name':'attrSerie1','value':_0x33b16d[_0xffcc('0x70')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||'total'},{'name':'attrSerie2','value':_0x33b16d[_0xffcc('0x71')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d['attrs'][0x1]['value']:undefined)||null},{'name':_0xffcc('0x72'),'value':_0x33b16d[_0xffcc('0x72')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x2]?_0x33b16d[_0xffcc('0x5f')][0x2]['value']:undefined)||null},{'name':_0xffcc('0x6d'),'value':_0x33b16d[_0xffcc('0x6d')]||(_0x33b16d['attrs']&&_0x33b16d[_0xffcc('0x5f')][0x3]?_0x33b16d['attrs'][0x3][_0xffcc('0x60')]:undefined)||[]}];case'web-report':return[{'name':_0xffcc('0x73'),'type':_0x33b16d[_0xffcc('0x74')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d['attrs'][0x0][_0xffcc('0x32')]:undefined)||null,'value':_0x33b16d['attrReport']||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d['attrs'][0x0][_0xffcc('0x60')]:undefined)||null},{'name':_0xffcc('0x75'),'value':_0x33b16d['attrRefresh']||(_0x33b16d['attrs']&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d[_0xffcc('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x6a7259){logger[_0xffcc('0x57')](_0xffcc('0x76'),JSON[_0xffcc('0x77')](_0x6a7259));return[];}}exports[_0xffcc('0x78')]=function(_0x3c3c88,_0x2bff97,_0x11b12e){if(_0x3c3c88[_0xffcc('0x4f')]['id']){delete _0x3c3c88['body']['id'];}return db[_0xffcc('0x2f')][_0xffcc('0x4d')]({'where':{'id':_0x3c3c88['params']['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0x2bff97,null))[_0xffcc('0x2b')](function(_0x2e670a){if(_0x2e670a){_0x3c3c88[_0xffcc('0x4f')]['DashboardId']=_0x2e670a['id'];_0x3c3c88['body'][_0xffcc('0x5f')]=widgetAttributes(_0x3c3c88['body']);return db[_0xffcc('0x79')][_0xffcc('0x4e')](_0x3c3c88[_0xffcc('0x4f')]);}})[_0xffcc('0x2b')](respondWithResult(_0x2bff97,null))[_0xffcc('0x49')](handleError(_0x2bff97,null));};exports[_0xffcc('0x7a')]=function(_0x1853fc,_0x469291,_0x37bef0){var _0x589783={};var _0x59eed6={};var _0x3eaade;var _0x3731d3;return db[_0xffcc('0x2f')][_0xffcc('0x7b')]({'where':{'id':_0x1853fc[_0xffcc('0x4a')]['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0x469291,null))[_0xffcc('0x2b')](function(_0x2454ad){if(_0x2454ad){_0x3eaade=_0x2454ad;_0x59eed6[_0xffcc('0x34')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x59eed6[_0xffcc('0x36')]=_[_0xffcc('0x4b')](_0x1853fc[_0xffcc('0x36')]);_0x59eed6[_0xffcc('0x37')]=_[_0xffcc('0x38')](_0x59eed6[_0xffcc('0x34')],_0x59eed6['query']);_0x589783[_0xffcc('0x39')]=_['intersection'](_0x59eed6[_0xffcc('0x34')],qs[_0xffcc('0x3a')](_0x1853fc[_0xffcc('0x36')]['fields']));_0x589783[_0xffcc('0x39')]=_0x589783[_0xffcc('0x39')][_0xffcc('0x4c')]?_0x589783[_0xffcc('0x39')]:_0x59eed6[_0xffcc('0x34')];_0x589783[_0xffcc('0x3d')]=qs[_0xffcc('0x3e')](_0x1853fc[_0xffcc('0x36')][_0xffcc('0x3e')]);_0x589783['where']=qs[_0xffcc('0x37')](_[_0xffcc('0x40')](_0x1853fc[_0xffcc('0x36')],_0x59eed6[_0xffcc('0x37')]));if(_0x1853fc['query'][_0xffcc('0x41')]){_0x589783[_0xffcc('0x3f')]=_[_0xffcc('0x42')](_0x589783[_0xffcc('0x3f')],{'$or':_['map'](_0x589783['attributes'],function(_0x415952){var _0x43f327={};_0x43f327[_0x415952]={'$like':'%'+_0x1853fc['query']['filter']+'%'};return _0x43f327;})});}_0x589783=_[_0xffcc('0x42')]({},_0x589783,_0x1853fc[_0xffcc('0x44')]);return _0x3eaade[_0xffcc('0x7a')](_0x589783);}})[_0xffcc('0x2b')](function(_0x1e1d38){if(_0x1e1d38){_0x3731d3=_0x1e1d38[_0xffcc('0x4c')];if(!_0x1853fc[_0xffcc('0x36')][_0xffcc('0x3b')](_0xffcc('0x3c'))){_0x589783[_0xffcc('0x24')]=qs[_0xffcc('0x24')](_0x1853fc[_0xffcc('0x36')][_0xffcc('0x24')]);_0x589783[_0xffcc('0x23')]=qs['offset'](_0x1853fc[_0xffcc('0x36')][_0xffcc('0x23')]);}return _0x3eaade['getItems'](_0x589783);}})[_0xffcc('0x2b')](function(_0x56c4b7){if(_0x56c4b7){return _0x56c4b7?{'count':_0x3731d3,'rows':_0x56c4b7}:null;}})[_0xffcc('0x2b')](respondWithResult(_0x469291,null))[_0xffcc('0x49')](handleError(_0x469291,null));};
\ No newline at end of file
+var _0x8612=['eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','status','end','count','offset','limit','set','json','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','Dashboard','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf'];(function(_0x1d2b66,_0x256c6e){var _0x445a66=function(_0x2e5845){while(--_0x2e5845){_0x1d2b66['push'](_0x1d2b66['shift']());}};_0x445a66(++_0x256c6e);}(_0x8612,0xed));var _0x2861=function(_0x5652bb,_0x4b74d2){_0x5652bb=_0x5652bb-0x0;var _0x233716=_0x8612[_0x5652bb];return _0x233716;};'use strict';var pdf=require(_0x2861('0x0'));var emlformat=require(_0x2861('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2861('0x2'));var rp=require(_0x2861('0x3'));var moment=require('moment');var BPromise=require(_0x2861('0x4'));var Mustache=require('mustache');var util=require(_0x2861('0x5'));var path=require(_0x2861('0x6'));var sox=require(_0x2861('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2861('0x8'));var squel=require(_0x2861('0x9'));var crypto=require(_0x2861('0xa'));var jsforce=require(_0x2861('0xb'));var deskjs=require(_0x2861('0xc'));var toCsv=require(_0x2861('0xd'));var querystring=require('querystring');var Papa=require(_0x2861('0xe'));var Redis=require(_0x2861('0xf'));var authService=require(_0x2861('0x10'));var qs=require(_0x2861('0x11'));var as=require(_0x2861('0x12'));var hardwareService=require(_0x2861('0x13'));var logger=require(_0x2861('0x14'))(_0x2861('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2861('0x16'));var db=require('../../mysqldb')['db'];config[_0x2861('0x17')]=_[_0x2861('0x18')](config['redis'],{'host':_0x2861('0x19'),'port':0x18eb});var socket=require(_0x2861('0x1a'))(new Redis(config[_0x2861('0x17')]));require(_0x2861('0x1b'))['register'](socket);function respondWithStatusCode(_0x5c803a,_0x19de14){_0x19de14=_0x19de14||0xcc;return function(_0x42b51d){if(_0x42b51d){return _0x5c803a['sendStatus'](_0x19de14);}return _0x5c803a[_0x2861('0x1c')](_0x19de14)[_0x2861('0x1d')]();};}function respondWithResult(_0x5ce3b5,_0x266010){_0x266010=_0x266010||0xc8;return function(_0x4cf01b){if(_0x4cf01b){return _0x5ce3b5['status'](_0x266010)['json'](_0x4cf01b);}};}function respondWithFilteredResult(_0x4041ba,_0x22e233){return function(_0x4d6325){if(_0x4d6325){var _0x3bc193=_0x4d6325[_0x2861('0x1e')],_0x5b96b6=_0x22e233['offset'],_0x50ebbc=_0x22e233[_0x2861('0x1f')]+_0x22e233[_0x2861('0x20')],_0x15c1fe;if(_0x50ebbc>=_0x3bc193){_0x50ebbc=_0x3bc193;_0x15c1fe=0xc8;}else{_0x15c1fe=0xce;}_0x4041ba['status'](_0x15c1fe);return _0x4041ba[_0x2861('0x21')]('Content-Range',_0x5b96b6+'-'+_0x50ebbc+'/'+_0x3bc193)[_0x2861('0x22')](_0x4d6325);}return null;};}function patchUpdates(_0x137875){return function(_0x5b0188){try{jsonpatch[_0x2861('0x23')](_0x5b0188,_0x137875,!![]);}catch(_0x13fa62){return BPromise[_0x2861('0x24')](_0x13fa62);}return _0x5b0188[_0x2861('0x25')]();};}function saveUpdates(_0x2ae7a6,_0x43c9d6){return function(_0x3da2fe){if(_0x3da2fe){return _0x3da2fe['update'](_0x2ae7a6)[_0x2861('0x26')](function(_0xec7040){return _0xec7040;});}return null;};}function removeEntity(_0x1a5d24,_0x11ae9e){return function(_0xa43d44){if(_0xa43d44){return _0xa43d44[_0x2861('0x27')]()[_0x2861('0x26')](function(){var _0x10a28c=_0xa43d44[_0x2861('0x28')]({'plain':!![]});var _0x144637=_0x2861('0x29');return db[_0x2861('0x2a')]['destroy']({'where':{'type':_0x144637,'resourceId':_0x10a28c['id']}})[_0x2861('0x26')](function(){return _0xa43d44;});})[_0x2861('0x26')](function(){_0x1a5d24[_0x2861('0x1c')](0xcc)[_0x2861('0x1d')]();});}};}function handleEntityNotFound(_0x2ae3b4,_0x36fe1a){return function(_0x47b488){if(!_0x47b488){_0x2ae3b4[_0x2861('0x2b')](0x194);}return _0x47b488;};}function handleError(_0x26b913,_0x2ff44d){_0x2ff44d=_0x2ff44d||0x1f4;return function(_0x12f07a){logger[_0x2861('0x2c')](_0x12f07a[_0x2861('0x2d')]);if(_0x12f07a[_0x2861('0x2e')]){delete _0x12f07a['name'];}_0x26b913[_0x2861('0x1c')](_0x2ff44d)[_0x2861('0x2f')](_0x12f07a);};}exports[_0x2861('0x30')]=function(_0x15267f,_0x1d6a82){var _0xc98c51={},_0x4ab290={},_0x19028a={'count':0x0,'rows':[]};var _0x435d5f=_[_0x2861('0x31')](db['Dashboard']['rawAttributes'],function(_0x100d15){return{'name':_0x100d15[_0x2861('0x32')],'type':_0x100d15['type'][_0x2861('0x33')]};});_0x4ab290[_0x2861('0x34')]=_['map'](_0x435d5f,_0x2861('0x2e'));_0x4ab290['query']=_[_0x2861('0x35')](_0x15267f[_0x2861('0x36')]);_0x4ab290[_0x2861('0x37')]=_[_0x2861('0x38')](_0x4ab290[_0x2861('0x34')],_0x4ab290[_0x2861('0x36')]);_0xc98c51['attributes']=_[_0x2861('0x38')](_0x4ab290[_0x2861('0x34')],qs[_0x2861('0x39')](_0x15267f[_0x2861('0x36')][_0x2861('0x39')]));_0xc98c51[_0x2861('0x3a')]=_0xc98c51[_0x2861('0x3a')][_0x2861('0x3b')]?_0xc98c51[_0x2861('0x3a')]:_0x4ab290[_0x2861('0x34')];if(!_0x15267f['query']['hasOwnProperty'](_0x2861('0x3c'))){_0xc98c51[_0x2861('0x20')]=qs[_0x2861('0x20')](_0x15267f[_0x2861('0x36')]['limit']);_0xc98c51[_0x2861('0x1f')]=qs[_0x2861('0x1f')](_0x15267f[_0x2861('0x36')]['offset']);}_0xc98c51[_0x2861('0x3d')]=qs[_0x2861('0x3e')](_0x15267f['query']['sort']);_0xc98c51[_0x2861('0x3f')]=qs[_0x2861('0x37')](_[_0x2861('0x40')](_0x15267f['query'],_0x4ab290[_0x2861('0x37')]),_0x435d5f);if(_0x15267f[_0x2861('0x36')][_0x2861('0x41')]){_0xc98c51['where']=_['merge'](_0xc98c51[_0x2861('0x3f')],{'$or':_[_0x2861('0x31')](_0x435d5f,function(_0x3c1ae6){if(_0x3c1ae6['type']!=='VIRTUAL'){var _0x37fd92={};_0x37fd92[_0x3c1ae6['name']]={'$like':'%'+_0x15267f['query'][_0x2861('0x41')]+'%'};return _0x37fd92;}})});}_0xc98c51=_[_0x2861('0x42')]({},_0xc98c51,_0x15267f[_0x2861('0x43')]);var _0x3155ce={'where':_0xc98c51[_0x2861('0x3f')]};return db[_0x2861('0x44')][_0x2861('0x1e')](_0x3155ce)['then'](function(_0x11bf9a){_0x19028a[_0x2861('0x1e')]=_0x11bf9a;if(_0x15267f[_0x2861('0x36')][_0x2861('0x45')]){_0xc98c51[_0x2861('0x46')]=[{'all':!![]}];}return db['Dashboard'][_0x2861('0x47')](_0xc98c51);})[_0x2861('0x26')](function(_0x243e2d){_0x19028a[_0x2861('0x48')]=_0x243e2d;return _0x19028a;})['then'](respondWithFilteredResult(_0x1d6a82,_0xc98c51))['catch'](handleError(_0x1d6a82,null));};exports['show']=function(_0x588e3b,_0x1d16a3){var _0x46d547={'raw':![],'where':{'id':_0x588e3b[_0x2861('0x49')]['id']}},_0x42ba65={};_0x42ba65[_0x2861('0x34')]=_['keys'](db[_0x2861('0x44')][_0x2861('0x4a')]);_0x42ba65['query']=_[_0x2861('0x35')](_0x588e3b['query']);_0x42ba65['filters']=_[_0x2861('0x38')](_0x42ba65[_0x2861('0x34')],_0x42ba65[_0x2861('0x36')]);_0x46d547[_0x2861('0x3a')]=_[_0x2861('0x38')](_0x42ba65[_0x2861('0x34')],qs[_0x2861('0x39')](_0x588e3b[_0x2861('0x36')][_0x2861('0x39')]));_0x46d547[_0x2861('0x3a')]=_0x46d547[_0x2861('0x3a')][_0x2861('0x3b')]?_0x46d547[_0x2861('0x3a')]:_0x42ba65[_0x2861('0x34')];if(_0x588e3b[_0x2861('0x36')]['includeAll']){_0x46d547['include']=[{'all':!![]}];}_0x46d547=_[_0x2861('0x42')]({},_0x46d547,_0x588e3b[_0x2861('0x43')]);return db[_0x2861('0x44')][_0x2861('0x4b')](_0x46d547)[_0x2861('0x26')](handleEntityNotFound(_0x1d16a3,null))[_0x2861('0x26')](respondWithResult(_0x1d16a3,null))[_0x2861('0x4c')](handleError(_0x1d16a3,null));};exports[_0x2861('0x4d')]=function(_0x28d1af,_0x59535c){return db[_0x2861('0x44')]['create'](_0x28d1af[_0x2861('0x4e')],{})['then'](function(_0x50414a){var _0x5a4c25=_0x28d1af['user']['get']({'plain':!![]});if(!_0x5a4c25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a4c25['role']==='user'){var _0x442978=_0x50414a[_0x2861('0x28')]({'plain':!![]});var _0x44a2be=_0x2861('0x29');return db[_0x2861('0x4f')][_0x2861('0x4b')]({'where':{'name':_0x44a2be,'userProfileId':_0x5a4c25[_0x2861('0x50')]},'raw':!![]})['then'](function(_0xedd47d){if(_0xedd47d&&_0xedd47d[_0x2861('0x51')]===0x0){return db[_0x2861('0x2a')]['create']({'name':_0x442978[_0x2861('0x2e')],'resourceId':_0x442978['id'],'type':_0xedd47d['name'],'sectionId':_0xedd47d['id']},{})[_0x2861('0x26')](function(){return _0x50414a;});}else{return _0x50414a;}})['catch'](function(_0x4390f6){logger[_0x2861('0x2c')](_0x2861('0x52'),_0x4390f6);throw _0x4390f6;});}return _0x50414a;})[_0x2861('0x26')](respondWithResult(_0x59535c,0xc9))[_0x2861('0x4c')](handleError(_0x59535c,null));};exports[_0x2861('0x53')]=function(_0x4c6e2b,_0x397a27){var _0x3ba4b2={'where':{'id':_0x4c6e2b['params']['id']}},_0x268d1a={};_0x268d1a['model']=_[_0x2861('0x35')](db['Dashboard'][_0x2861('0x4a')]);_0x3ba4b2[_0x2861('0x3a')]=_[_0x2861('0x38')](_0x268d1a[_0x2861('0x34')],qs['fields'](_0x4c6e2b[_0x2861('0x36')]['fields']));_0x3ba4b2[_0x2861('0x3a')]=_0x3ba4b2['attributes'][_0x2861('0x3b')]?_0x3ba4b2[_0x2861('0x3a')]:_0x268d1a[_0x2861('0x34')];if(_0x4c6e2b[_0x2861('0x36')][_0x2861('0x45')]){_0x3ba4b2[_0x2861('0x46')]=[{'all':!![]}];}_0x3ba4b2=_['merge']({},_0x3ba4b2,_0x4c6e2b[_0x2861('0x43')]);return db[_0x2861('0x44')][_0x2861('0x4b')](_0x3ba4b2)[_0x2861('0x26')](handleEntityNotFound(_0x397a27,null))['then'](function(_0x525789){if(_0x525789){var _0x5a1a4b=_0x525789[_0x2861('0x28')]({'plain':!![]});_0x5a1a4b=qs[_0x2861('0x54')](_0x5a1a4b,['id',_0x2861('0x55'),'updatedAt']);_0x4c6e2b[_0x2861('0x4e')]=_[_0x2861('0x54')](_0x4c6e2b[_0x2861('0x4e')],['id',_0x2861('0x55'),_0x2861('0x56')]);return db['Dashboard'][_0x2861('0x4d')](_[_0x2861('0x42')](_0x5a1a4b,_0x4c6e2b[_0x2861('0x4e')]),{'include':_0x4c6e2b[_0x2861('0x36')][_0x2861('0x45')]?[{'all':!![]}]:undefined})[_0x2861('0x26')](function(_0x2aa556){var _0x3df05c=_0x4c6e2b[_0x2861('0x57')][_0x2861('0x28')]({'plain':!![]});if(!_0x3df05c)throw new Error(_0x2861('0x58'));if(_0x3df05c['role']===_0x2861('0x57')){var _0x364184=_0x2aa556[_0x2861('0x28')]({'plain':!![]});var _0x3bd580=_0x2861('0x29');return db[_0x2861('0x4f')][_0x2861('0x4b')]({'where':{'name':_0x3bd580,'userProfileId':_0x3df05c['userProfileId']},'raw':!![]})['then'](function(_0x3cd20d){if(_0x3cd20d&&_0x3cd20d['autoAssociation']===0x0){return db[_0x2861('0x2a')][_0x2861('0x4d')]({'name':_0x364184[_0x2861('0x2e')],'resourceId':_0x364184['id'],'type':_0x3cd20d[_0x2861('0x2e')],'sectionId':_0x3cd20d['id']},{})[_0x2861('0x26')](function(){return _0x2aa556;});}else{return _0x2aa556;}})['catch'](function(_0x35e6f3){logger[_0x2861('0x2c')](_0x2861('0x52'),_0x35e6f3);throw _0x35e6f3;});}return _0x2aa556;});}})['then'](respondWithResult(_0x397a27,0xc9))[_0x2861('0x4c')](handleError(_0x397a27,null));};exports[_0x2861('0x59')]=function(_0x22ffdd,_0x566180){if(_0x22ffdd[_0x2861('0x4e')]['id']){delete _0x22ffdd[_0x2861('0x4e')]['id'];}return db[_0x2861('0x44')]['find']({'where':{'id':_0x22ffdd[_0x2861('0x49')]['id']}})[_0x2861('0x26')](handleEntityNotFound(_0x566180,null))['then'](saveUpdates(_0x22ffdd[_0x2861('0x4e')],null))[_0x2861('0x26')](respondWithResult(_0x566180,null))['catch'](handleError(_0x566180,null));};exports[_0x2861('0x27')]=function(_0x13e872,_0x5b6771){return db[_0x2861('0x44')][_0x2861('0x4b')]({'where':{'id':_0x13e872[_0x2861('0x49')]['id']}})[_0x2861('0x26')](handleEntityNotFound(_0x5b6771,null))[_0x2861('0x26')](removeEntity(_0x5b6771,null))[_0x2861('0x4c')](handleError(_0x5b6771,null));};function widgetAttributes(_0x4bb810){try{switch(_0x4bb810[_0x2861('0x5a')]){case _0x2861('0x5b'):return[{'name':_0x2861('0x5c'),'value':_0x4bb810[_0x2861('0x5c')]||(_0x4bb810['attrs']&&_0x4bb810['attrs'][0x0]?_0x4bb810[_0x2861('0x5d')][0x0][_0x2861('0x5e')]:undefined)||_0x2861('0x5f')}];case _0x2861('0x60'):return[{'name':_0x2861('0x61'),'value':_0x4bb810['attrPath']||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x0]?_0x4bb810[_0x2861('0x5d')][0x0][_0x2861('0x5e')]:undefined)||''}];case _0x2861('0x62'):return[{'name':_0x2861('0x63'),'value':_0x4bb810[_0x2861('0x63')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x0]?_0x4bb810[_0x2861('0x5d')][0x0][_0x2861('0x5e')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x4bb810[_0x2861('0x64')]||(_0x4bb810['attrs']&&_0x4bb810['attrs'][0x1]?_0x4bb810[_0x2861('0x5d')][0x1]['value']:undefined)||_0x2861('0x65')},{'name':_0x2861('0x66'),'value':_0x4bb810[_0x2861('0x66')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x2]?_0x4bb810[_0x2861('0x5d')][0x2][_0x2861('0x5e')]:undefined)||0xc}];case'counter':return[{'name':_0x2861('0x67'),'value':_0x4bb810[_0x2861('0x67')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810['attrs'][0x0]?_0x4bb810[_0x2861('0x5d')][0x0][_0x2861('0x5e')]:undefined)||_0x2861('0x68')},{'name':_0x2861('0x69'),'value':_0x4bb810[_0x2861('0x69')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x1]?_0x4bb810[_0x2861('0x5d')][0x1]['value']:undefined)||[]},{'name':_0x2861('0x66'),'value':_0x4bb810['attrFontSize']||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x2]?_0x4bb810[_0x2861('0x5d')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x4bb810[_0x2861('0x6a')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x0]?_0x4bb810[_0x2861('0x5d')][0x0][_0x2861('0x5e')]:undefined)||_0x2861('0x68')},{'name':'attrSerie2','value':_0x4bb810[_0x2861('0x6b')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x1]?_0x4bb810[_0x2861('0x5d')][0x1][_0x2861('0x5e')]:undefined)||null},{'name':_0x2861('0x6c'),'value':_0x4bb810[_0x2861('0x6c')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x2]?_0x4bb810[_0x2861('0x5d')][0x2][_0x2861('0x5e')]:undefined)||null},{'name':_0x2861('0x69'),'value':_0x4bb810[_0x2861('0x69')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x3]?_0x4bb810[_0x2861('0x5d')][0x3][_0x2861('0x5e')]:undefined)||[]}];case _0x2861('0x6d'):return[{'name':_0x2861('0x6e'),'type':_0x4bb810[_0x2861('0x6f')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x0]?_0x4bb810[_0x2861('0x5d')][0x0]['type']:undefined)||null,'value':_0x4bb810[_0x2861('0x6e')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x0]?_0x4bb810['attrs'][0x0][_0x2861('0x5e')]:undefined)||null},{'name':_0x2861('0x70'),'value':_0x4bb810[_0x2861('0x70')]||(_0x4bb810[_0x2861('0x5d')]&&_0x4bb810[_0x2861('0x5d')][0x1]?_0x4bb810['attrs'][0x1][_0x2861('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x423206){logger[_0x2861('0x2c')](_0x2861('0x71'),JSON['stringify'](_0x423206));return[];}}exports['addItem']=function(_0x5dcb87,_0x5b26d9,_0x44b19e){if(_0x5dcb87['body']['id']){delete _0x5dcb87['body']['id'];}return db[_0x2861('0x44')][_0x2861('0x4b')]({'where':{'id':_0x5dcb87[_0x2861('0x49')]['id']}})[_0x2861('0x26')](handleEntityNotFound(_0x5b26d9,null))[_0x2861('0x26')](function(_0x159beb){if(_0x159beb){_0x5dcb87[_0x2861('0x4e')][_0x2861('0x72')]=_0x159beb['id'];_0x5dcb87[_0x2861('0x4e')]['attrs']=widgetAttributes(_0x5dcb87[_0x2861('0x4e')]);return db[_0x2861('0x73')][_0x2861('0x4d')](_0x5dcb87['body']);}})[_0x2861('0x26')](respondWithResult(_0x5b26d9,null))[_0x2861('0x4c')](handleError(_0x5b26d9,null));};exports[_0x2861('0x74')]=function(_0x1c4548,_0x4d130f,_0x1ca3d3){var _0x1d8ebc={};var _0x7536af={};var _0x5e85a1;var _0x28db18;return db['Dashboard'][_0x2861('0x75')]({'where':{'id':_0x1c4548[_0x2861('0x49')]['id']}})[_0x2861('0x26')](handleEntityNotFound(_0x4d130f,null))[_0x2861('0x26')](function(_0x6ca35){if(_0x6ca35){_0x5e85a1=_0x6ca35;_0x7536af[_0x2861('0x34')]=_[_0x2861('0x35')](db[_0x2861('0x73')][_0x2861('0x4a')]);_0x7536af[_0x2861('0x36')]=_['keys'](_0x1c4548[_0x2861('0x36')]);_0x7536af[_0x2861('0x37')]=_[_0x2861('0x38')](_0x7536af[_0x2861('0x34')],_0x7536af[_0x2861('0x36')]);_0x1d8ebc[_0x2861('0x3a')]=_[_0x2861('0x38')](_0x7536af[_0x2861('0x34')],qs[_0x2861('0x39')](_0x1c4548['query'][_0x2861('0x39')]));_0x1d8ebc['attributes']=_0x1d8ebc[_0x2861('0x3a')]['length']?_0x1d8ebc[_0x2861('0x3a')]:_0x7536af[_0x2861('0x34')];_0x1d8ebc[_0x2861('0x3d')]=qs[_0x2861('0x3e')](_0x1c4548[_0x2861('0x36')][_0x2861('0x3e')]);_0x1d8ebc[_0x2861('0x3f')]=qs[_0x2861('0x37')](_[_0x2861('0x40')](_0x1c4548[_0x2861('0x36')],_0x7536af[_0x2861('0x37')]));if(_0x1c4548['query'][_0x2861('0x41')]){_0x1d8ebc[_0x2861('0x3f')]=_[_0x2861('0x42')](_0x1d8ebc[_0x2861('0x3f')],{'$or':_[_0x2861('0x31')](_0x1d8ebc['attributes'],function(_0x18c43a){var _0x277e0e={};_0x277e0e[_0x18c43a]={'$like':'%'+_0x1c4548[_0x2861('0x36')][_0x2861('0x41')]+'%'};return _0x277e0e;})});}_0x1d8ebc=_['merge']({},_0x1d8ebc,_0x1c4548[_0x2861('0x43')]);return _0x5e85a1['getItems'](_0x1d8ebc);}})[_0x2861('0x26')](function(_0x23ac94){if(_0x23ac94){_0x28db18=_0x23ac94[_0x2861('0x3b')];if(!_0x1c4548[_0x2861('0x36')][_0x2861('0x76')](_0x2861('0x3c'))){_0x1d8ebc[_0x2861('0x20')]=qs['limit'](_0x1c4548[_0x2861('0x36')][_0x2861('0x20')]);_0x1d8ebc[_0x2861('0x1f')]=qs[_0x2861('0x1f')](_0x1c4548['query'][_0x2861('0x1f')]);}return _0x5e85a1[_0x2861('0x74')](_0x1d8ebc);}})[_0x2861('0x26')](function(_0x316212){if(_0x316212){return _0x316212?{'count':_0x28db18,'rows':_0x316212}:null;}})[_0x2861('0x26')](respondWithResult(_0x4d130f,null))[_0x2861('0x4c')](handleError(_0x4d130f,null));};
\ No newline at end of file