Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 699426d..16e6189 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b19=['DashboardId','getItems','findOne','DashboardItem','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','length','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','0.00','attrFontSize','attrMetric','total','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','attrRefresh','stringify'];(function(_0x4f7b90,_0x54efa9){var _0x5d4aa6=function(_0x532193){while(--_0x532193){_0x4f7b90['push'](_0x4f7b90['shift']());}};_0x5d4aa6(++_0x54efa9);}(_0x6b19,0xe8));var _0x96b1=function(_0x1b44f3,_0x42bb0d){_0x1b44f3=_0x1b44f3-0x0;var _0x443d9a=_0x6b19[_0x1b44f3];return _0x443d9a;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require(_0x96b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96b1('0x3'));var Mustache=require(_0x96b1('0x4'));var util=require(_0x96b1('0x5'));var path=require(_0x96b1('0x6'));var sox=require(_0x96b1('0x7'));var csv=require('to-csv');var ejs=require(_0x96b1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x96b1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x96b1('0xb'));var querystring=require('querystring');var Papa=require(_0x96b1('0xc'));var Redis=require(_0x96b1('0xd'));var authService=require(_0x96b1('0xe'));var qs=require(_0x96b1('0xf'));var as=require(_0x96b1('0x10'));var hardwareService=require(_0x96b1('0x11'));var logger=require(_0x96b1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x96b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x96b1('0x14')]=_[_0x96b1('0x15')](config[_0x96b1('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x96b1('0x16'))(new Redis(config[_0x96b1('0x14')]));require(_0x96b1('0x17'))[_0x96b1('0x18')](socket);function respondWithStatusCode(_0x46b2bb,_0x4f4150){_0x4f4150=_0x4f4150||0xcc;return function(_0x27254a){if(_0x27254a){return _0x46b2bb[_0x96b1('0x19')](_0x4f4150);}return _0x46b2bb[_0x96b1('0x1a')](_0x4f4150)[_0x96b1('0x1b')]();};}function respondWithResult(_0x2cd1f5,_0x43b7f5){_0x43b7f5=_0x43b7f5||0xc8;return function(_0x24fa0f){if(_0x24fa0f){return _0x2cd1f5[_0x96b1('0x1a')](_0x43b7f5)[_0x96b1('0x1c')](_0x24fa0f);}};}function respondWithFilteredResult(_0x1b1f8e,_0x450099){return function(_0x38478c){if(_0x38478c){var _0x2b192a=typeof _0x450099[_0x96b1('0x1d')]===_0x96b1('0x1e')&&typeof _0x450099['limit']===_0x96b1('0x1e');var _0x5dab57=_0x38478c[_0x96b1('0x1f')];var _0x2f98a2=_0x2b192a?0x0:_0x450099[_0x96b1('0x1d')];var _0x5dd21e=_0x2b192a?_0x38478c[_0x96b1('0x1f')]:_0x450099[_0x96b1('0x1d')]+_0x450099[_0x96b1('0x20')];var _0x4b3894;if(_0x5dd21e>=_0x5dab57){_0x5dd21e=_0x5dab57;_0x4b3894=0xc8;}else{_0x4b3894=0xce;}_0x1b1f8e[_0x96b1('0x1a')](_0x4b3894);return _0x1b1f8e[_0x96b1('0x21')](_0x96b1('0x22'),_0x2f98a2+'-'+_0x5dd21e+'/'+_0x5dab57)[_0x96b1('0x1c')](_0x38478c);}return null;};}function patchUpdates(_0x555185){return function(_0x301ba2){try{jsonpatch[_0x96b1('0x23')](_0x301ba2,_0x555185,!![]);}catch(_0xde249b){return BPromise['reject'](_0xde249b);}return _0x301ba2[_0x96b1('0x24')]();};}function saveUpdates(_0x370f15,_0x28b42b){return function(_0x20a85f){if(_0x20a85f){return _0x20a85f['update'](_0x370f15)[_0x96b1('0x25')](function(_0x548bae){return _0x548bae;});}return null;};}function removeEntity(_0x21ac25,_0x4ad19f){return function(_0x6509d2){if(_0x6509d2){return _0x6509d2[_0x96b1('0x26')]()['then'](function(){var _0x50dcbc=_0x6509d2['get']({'plain':!![]});var _0x3f24bc=_0x96b1('0x27');return db[_0x96b1('0x28')][_0x96b1('0x26')]({'where':{'type':_0x3f24bc,'resourceId':_0x50dcbc['id']}})[_0x96b1('0x25')](function(){return _0x6509d2;});})['then'](function(){_0x21ac25[_0x96b1('0x1a')](0xcc)[_0x96b1('0x1b')]();});}};}function handleEntityNotFound(_0x3cadbb,_0x209ce8){return function(_0x51e2c1){if(!_0x51e2c1){_0x3cadbb[_0x96b1('0x19')](0x194);}return _0x51e2c1;};}function handleError(_0x33f96b,_0x52f988){_0x52f988=_0x52f988||0x1f4;return function(_0x59cf9b){logger[_0x96b1('0x29')](_0x59cf9b['stack']);if(_0x59cf9b[_0x96b1('0x2a')]){delete _0x59cf9b[_0x96b1('0x2a')];}_0x33f96b['status'](_0x52f988)[_0x96b1('0x2b')](_0x59cf9b);};}exports[_0x96b1('0x2c')]=function(_0x5cb283,_0x36e049){var _0x444401={},_0x11cdf5={},_0x50d470={'count':0x0,'rows':[]};var _0x2ac0bf=_[_0x96b1('0x2d')](db[_0x96b1('0x2e')][_0x96b1('0x2f')],function(_0x2e232f){return{'name':_0x2e232f[_0x96b1('0x30')],'type':_0x2e232f['type'][_0x96b1('0x31')]};});_0x11cdf5[_0x96b1('0x32')]=_['map'](_0x2ac0bf,'name');_0x11cdf5[_0x96b1('0x33')]=_[_0x96b1('0x34')](_0x5cb283[_0x96b1('0x33')]);_0x11cdf5['filters']=_['intersection'](_0x11cdf5[_0x96b1('0x32')],_0x11cdf5[_0x96b1('0x33')]);_0x444401[_0x96b1('0x35')]=_[_0x96b1('0x36')](_0x11cdf5['model'],qs[_0x96b1('0x37')](_0x5cb283['query'][_0x96b1('0x37')]));_0x444401[_0x96b1('0x35')]=_0x444401[_0x96b1('0x35')]['length']?_0x444401[_0x96b1('0x35')]:_0x11cdf5[_0x96b1('0x32')];if(!_0x5cb283[_0x96b1('0x33')][_0x96b1('0x38')](_0x96b1('0x39'))){_0x444401[_0x96b1('0x20')]=qs['limit'](_0x5cb283[_0x96b1('0x33')][_0x96b1('0x20')]);_0x444401['offset']=qs[_0x96b1('0x1d')](_0x5cb283['query'][_0x96b1('0x1d')]);}_0x444401[_0x96b1('0x3a')]=qs[_0x96b1('0x3b')](_0x5cb283[_0x96b1('0x33')][_0x96b1('0x3b')]);_0x444401[_0x96b1('0x3c')]=qs[_0x96b1('0x3d')](_[_0x96b1('0x3e')](_0x5cb283[_0x96b1('0x33')],_0x11cdf5['filters']),_0x2ac0bf);if(_0x5cb283[_0x96b1('0x33')][_0x96b1('0x3f')]){_0x444401[_0x96b1('0x3c')]=_[_0x96b1('0x40')](_0x444401[_0x96b1('0x3c')],{'$or':_[_0x96b1('0x2d')](_0x2ac0bf,function(_0x3304d6){if(_0x3304d6[_0x96b1('0x41')]!==_0x96b1('0x42')){var _0x37a2ed={};_0x37a2ed[_0x3304d6[_0x96b1('0x2a')]]={'$like':'%'+_0x5cb283[_0x96b1('0x33')][_0x96b1('0x3f')]+'%'};return _0x37a2ed;}})});}_0x444401=_[_0x96b1('0x40')]({},_0x444401,_0x5cb283[_0x96b1('0x43')]);var _0x49a73e={'where':_0x444401['where']};return db[_0x96b1('0x2e')][_0x96b1('0x1f')](_0x49a73e)['then'](function(_0x2d0e9b){_0x50d470[_0x96b1('0x1f')]=_0x2d0e9b;if(_0x5cb283['query']['includeAll']){_0x444401['include']=[{'all':!![]}];}return db[_0x96b1('0x2e')][_0x96b1('0x44')](_0x444401);})[_0x96b1('0x25')](function(_0x458fd9){_0x50d470[_0x96b1('0x45')]=_0x458fd9;return _0x50d470;})[_0x96b1('0x25')](respondWithFilteredResult(_0x36e049,_0x444401))[_0x96b1('0x46')](handleError(_0x36e049,null));};exports[_0x96b1('0x47')]=function(_0x2610ee,_0x28f820){var _0x47d7d5={'raw':![],'where':{'id':_0x2610ee['params']['id']}},_0x25bfa9={};_0x25bfa9[_0x96b1('0x32')]=_['keys'](db[_0x96b1('0x2e')]['rawAttributes']);_0x25bfa9[_0x96b1('0x33')]=_[_0x96b1('0x34')](_0x2610ee[_0x96b1('0x33')]);_0x25bfa9[_0x96b1('0x3d')]=_[_0x96b1('0x36')](_0x25bfa9['model'],_0x25bfa9[_0x96b1('0x33')]);_0x47d7d5[_0x96b1('0x35')]=_[_0x96b1('0x36')](_0x25bfa9['model'],qs[_0x96b1('0x37')](_0x2610ee[_0x96b1('0x33')][_0x96b1('0x37')]));_0x47d7d5[_0x96b1('0x35')]=_0x47d7d5['attributes'][_0x96b1('0x48')]?_0x47d7d5[_0x96b1('0x35')]:_0x25bfa9['model'];if(_0x2610ee[_0x96b1('0x33')][_0x96b1('0x49')]){_0x47d7d5[_0x96b1('0x4a')]=[{'all':!![]}];}_0x47d7d5=_[_0x96b1('0x40')]({},_0x47d7d5,_0x2610ee[_0x96b1('0x43')]);return db[_0x96b1('0x2e')]['find'](_0x47d7d5)[_0x96b1('0x25')](handleEntityNotFound(_0x28f820,null))['then'](respondWithResult(_0x28f820,null))[_0x96b1('0x46')](handleError(_0x28f820,null));};exports[_0x96b1('0x4b')]=function(_0x5c0463,_0x23ad53){return db[_0x96b1('0x2e')]['create'](_0x5c0463[_0x96b1('0x4c')],{})[_0x96b1('0x25')](function(_0x2087ba){var _0x3a7301=_0x5c0463[_0x96b1('0x4d')][_0x96b1('0x4e')]({'plain':!![]});if(!_0x3a7301)throw new Error(_0x96b1('0x4f'));if(_0x3a7301[_0x96b1('0x50')]===_0x96b1('0x4d')){var _0xfeeadf=_0x2087ba['get']({'plain':!![]});var _0x296960=_0x96b1('0x27');return db[_0x96b1('0x51')][_0x96b1('0x52')]({'where':{'name':_0x296960,'userProfileId':_0x3a7301[_0x96b1('0x53')]},'raw':!![]})[_0x96b1('0x25')](function(_0x420d36){if(_0x420d36&&_0x420d36[_0x96b1('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xfeeadf[_0x96b1('0x2a')],'resourceId':_0xfeeadf['id'],'type':_0x420d36[_0x96b1('0x2a')],'sectionId':_0x420d36['id']},{})['then'](function(){return _0x2087ba;});}else{return _0x2087ba;}})[_0x96b1('0x46')](function(_0x2863b2){logger[_0x96b1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2863b2);throw _0x2863b2;});}return _0x2087ba;})[_0x96b1('0x25')](respondWithResult(_0x23ad53,0xc9))[_0x96b1('0x46')](handleError(_0x23ad53,null));};exports['clone']=function(_0x5f5b83,_0x31c32d){var _0x19cc23={'where':{'id':_0x5f5b83[_0x96b1('0x55')]['id']}},_0x3b0fe6={};_0x3b0fe6[_0x96b1('0x32')]=_[_0x96b1('0x34')](db[_0x96b1('0x2e')][_0x96b1('0x2f')]);_0x19cc23[_0x96b1('0x35')]=_[_0x96b1('0x36')](_0x3b0fe6[_0x96b1('0x32')],qs[_0x96b1('0x37')](_0x5f5b83['query'][_0x96b1('0x37')]));_0x19cc23[_0x96b1('0x35')]=_0x19cc23[_0x96b1('0x35')][_0x96b1('0x48')]?_0x19cc23[_0x96b1('0x35')]:_0x3b0fe6[_0x96b1('0x32')];if(_0x5f5b83[_0x96b1('0x33')]['includeAll']){_0x19cc23[_0x96b1('0x4a')]=[{'all':!![]}];}_0x19cc23=_['merge']({},_0x19cc23,_0x5f5b83['options']);return db[_0x96b1('0x2e')][_0x96b1('0x52')](_0x19cc23)[_0x96b1('0x25')](handleEntityNotFound(_0x31c32d,null))[_0x96b1('0x25')](function(_0x41cca1){if(_0x41cca1){var _0x192744=_0x41cca1[_0x96b1('0x4e')]({'plain':!![]});_0x192744=qs['omit'](_0x192744,['id',_0x96b1('0x56'),'updatedAt']);_0x5f5b83[_0x96b1('0x4c')]=_['omit'](_0x5f5b83[_0x96b1('0x4c')],['id',_0x96b1('0x56'),'updatedAt']);return db[_0x96b1('0x2e')][_0x96b1('0x4b')](_[_0x96b1('0x40')](_0x192744,_0x5f5b83[_0x96b1('0x4c')]),{'include':_0x5f5b83['query']['includeAll']?[{'all':!![]}]:undefined})[_0x96b1('0x25')](function(_0x33b5a3){var _0x474bad=_0x5f5b83[_0x96b1('0x4d')]['get']({'plain':!![]});if(!_0x474bad)throw new Error(_0x96b1('0x4f'));if(_0x474bad[_0x96b1('0x50')]===_0x96b1('0x4d')){var _0x2048d6=_0x33b5a3[_0x96b1('0x4e')]({'plain':!![]});var _0x134e1b=_0x96b1('0x27');return db[_0x96b1('0x51')][_0x96b1('0x52')]({'where':{'name':_0x134e1b,'userProfileId':_0x474bad['userProfileId']},'raw':!![]})['then'](function(_0x15f591){if(_0x15f591&&_0x15f591[_0x96b1('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x2048d6[_0x96b1('0x2a')],'resourceId':_0x2048d6['id'],'type':_0x15f591[_0x96b1('0x2a')],'sectionId':_0x15f591['id']},{})[_0x96b1('0x25')](function(){return _0x33b5a3;});}else{return _0x33b5a3;}})[_0x96b1('0x46')](function(_0x24ea99){logger[_0x96b1('0x29')](_0x96b1('0x57'),_0x24ea99);throw _0x24ea99;});}return _0x33b5a3;});}})['then'](respondWithResult(_0x31c32d,0xc9))['catch'](handleError(_0x31c32d,null));};exports[_0x96b1('0x58')]=function(_0x1efa0e,_0x4cbc78){if(_0x1efa0e['body']['id']){delete _0x1efa0e[_0x96b1('0x4c')]['id'];}return db[_0x96b1('0x2e')]['find']({'where':{'id':_0x1efa0e[_0x96b1('0x55')]['id']}})[_0x96b1('0x25')](handleEntityNotFound(_0x4cbc78,null))[_0x96b1('0x25')](saveUpdates(_0x1efa0e[_0x96b1('0x4c')],null))[_0x96b1('0x25')](respondWithResult(_0x4cbc78,null))[_0x96b1('0x46')](handleError(_0x4cbc78,null));};exports['destroy']=function(_0xa0877f,_0x1db88a){return db[_0x96b1('0x2e')][_0x96b1('0x52')]({'where':{'id':_0xa0877f['params']['id']}})[_0x96b1('0x25')](handleEntityNotFound(_0x1db88a,null))['then'](removeEntity(_0x1db88a,null))[_0x96b1('0x46')](handleError(_0x1db88a,null));};function widgetAttributes(_0x30547f){try{switch(_0x30547f[_0x96b1('0x41')]){case _0x96b1('0x59'):return[{'name':_0x96b1('0x5a'),'value':_0x30547f[_0x96b1('0x5a')]||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x0]?_0x30547f[_0x96b1('0x5b')][0x0][_0x96b1('0x5c')]:undefined)||_0x96b1('0x5d')}];case'custom':return[{'name':_0x96b1('0x5e'),'value':_0x30547f[_0x96b1('0x5e')]||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x0]?_0x30547f[_0x96b1('0x5b')][0x0]['value']:undefined)||''}];case _0x96b1('0x5f'):return[{'name':_0x96b1('0x60'),'value':_0x30547f['attrHourFormat']||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x0]?_0x30547f[_0x96b1('0x5b')][0x0][_0x96b1('0x5c')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x30547f['attrTimezone']||(_0x30547f['attrs']&&_0x30547f[_0x96b1('0x5b')][0x1]?_0x30547f[_0x96b1('0x5b')][0x1]['value']:undefined)||_0x96b1('0x61')},{'name':_0x96b1('0x62'),'value':_0x30547f[_0x96b1('0x62')]||(_0x30547f['attrs']&&_0x30547f[_0x96b1('0x5b')][0x2]?_0x30547f[_0x96b1('0x5b')][0x2][_0x96b1('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0x96b1('0x63'),'value':_0x30547f[_0x96b1('0x63')]||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x0]?_0x30547f[_0x96b1('0x5b')][0x0]['value']:undefined)||_0x96b1('0x64')},{'name':'attrVoiceQueues','value':_0x30547f['attrVoiceQueues']||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x1]?_0x30547f[_0x96b1('0x5b')][0x1][_0x96b1('0x5c')]:undefined)||[]},{'name':'attrFontSize','value':_0x30547f['attrFontSize']||(_0x30547f['attrs']&&_0x30547f['attrs'][0x2]?_0x30547f['attrs'][0x2][_0x96b1('0x5c')]:undefined)||0x14}];case'multibar-chart':case _0x96b1('0x65'):return[{'name':_0x96b1('0x66'),'value':_0x30547f[_0x96b1('0x66')]||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f['attrs'][0x0]?_0x30547f[_0x96b1('0x5b')][0x0][_0x96b1('0x5c')]:undefined)||'total'},{'name':_0x96b1('0x67'),'value':_0x30547f['attrSerie2']||(_0x30547f['attrs']&&_0x30547f[_0x96b1('0x5b')][0x1]?_0x30547f['attrs'][0x1][_0x96b1('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x30547f[_0x96b1('0x68')]||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x2]?_0x30547f['attrs'][0x2][_0x96b1('0x5c')]:undefined)||null},{'name':_0x96b1('0x69'),'value':_0x30547f[_0x96b1('0x69')]||(_0x30547f['attrs']&&_0x30547f[_0x96b1('0x5b')][0x3]?_0x30547f[_0x96b1('0x5b')][0x3]['value']:undefined)||[]}];case _0x96b1('0x6a'):return[{'name':_0x96b1('0x6b'),'type':_0x30547f['reportType']||(_0x30547f['attrs']&&_0x30547f[_0x96b1('0x5b')][0x0]?_0x30547f['attrs'][0x0][_0x96b1('0x41')]:undefined)||null,'value':_0x30547f['attrReport']||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x0]?_0x30547f[_0x96b1('0x5b')][0x0][_0x96b1('0x5c')]:undefined)||null},{'name':_0x96b1('0x6c'),'value':_0x30547f['attrRefresh']||(_0x30547f[_0x96b1('0x5b')]&&_0x30547f[_0x96b1('0x5b')][0x1]?_0x30547f[_0x96b1('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3b939a){logger['error']('widgetAttributes:\x20%s',JSON[_0x96b1('0x6d')](_0x3b939a));return[];}}exports['addItem']=function(_0x1b1d65,_0x55feaa,_0x4a31ce){if(_0x1b1d65[_0x96b1('0x4c')]['id']){delete _0x1b1d65['body']['id'];}return db[_0x96b1('0x2e')][_0x96b1('0x52')]({'where':{'id':_0x1b1d65[_0x96b1('0x55')]['id']}})[_0x96b1('0x25')](handleEntityNotFound(_0x55feaa,null))[_0x96b1('0x25')](function(_0x68af5b){if(_0x68af5b){_0x1b1d65['body'][_0x96b1('0x6e')]=_0x68af5b['id'];_0x1b1d65['body'][_0x96b1('0x5b')]=widgetAttributes(_0x1b1d65[_0x96b1('0x4c')]);return db['DashboardItem'][_0x96b1('0x4b')](_0x1b1d65[_0x96b1('0x4c')]);}})['then'](respondWithResult(_0x55feaa,null))[_0x96b1('0x46')](handleError(_0x55feaa,null));};exports[_0x96b1('0x6f')]=function(_0x5846ef,_0x2f6929,_0x566e6b){var _0x3d68d6={};var _0x50ec93={};var _0x4c61b4;var _0x42615d;return db[_0x96b1('0x2e')][_0x96b1('0x70')]({'where':{'id':_0x5846ef[_0x96b1('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f6929,null))[_0x96b1('0x25')](function(_0x311f04){if(_0x311f04){_0x4c61b4=_0x311f04;_0x50ec93[_0x96b1('0x32')]=_[_0x96b1('0x34')](db[_0x96b1('0x71')][_0x96b1('0x2f')]);_0x50ec93[_0x96b1('0x33')]=_['keys'](_0x5846ef[_0x96b1('0x33')]);_0x50ec93[_0x96b1('0x3d')]=_[_0x96b1('0x36')](_0x50ec93[_0x96b1('0x32')],_0x50ec93['query']);_0x3d68d6['attributes']=_[_0x96b1('0x36')](_0x50ec93[_0x96b1('0x32')],qs[_0x96b1('0x37')](_0x5846ef[_0x96b1('0x33')][_0x96b1('0x37')]));_0x3d68d6[_0x96b1('0x35')]=_0x3d68d6[_0x96b1('0x35')][_0x96b1('0x48')]?_0x3d68d6[_0x96b1('0x35')]:_0x50ec93[_0x96b1('0x32')];_0x3d68d6['order']=qs['sort'](_0x5846ef[_0x96b1('0x33')][_0x96b1('0x3b')]);_0x3d68d6[_0x96b1('0x3c')]=qs[_0x96b1('0x3d')](_[_0x96b1('0x3e')](_0x5846ef[_0x96b1('0x33')],_0x50ec93['filters']));if(_0x5846ef[_0x96b1('0x33')]['filter']){_0x3d68d6[_0x96b1('0x3c')]=_[_0x96b1('0x40')](_0x3d68d6[_0x96b1('0x3c')],{'$or':_[_0x96b1('0x2d')](_0x3d68d6[_0x96b1('0x35')],function(_0xe0035a){var _0x4c0929={};_0x4c0929[_0xe0035a]={'$like':'%'+_0x5846ef[_0x96b1('0x33')][_0x96b1('0x3f')]+'%'};return _0x4c0929;})});}_0x3d68d6=_[_0x96b1('0x40')]({},_0x3d68d6,_0x5846ef[_0x96b1('0x43')]);return _0x4c61b4['getItems'](_0x3d68d6);}})[_0x96b1('0x25')](function(_0x2681b7){if(_0x2681b7){_0x42615d=_0x2681b7['length'];if(!_0x5846ef['query'][_0x96b1('0x38')](_0x96b1('0x39'))){_0x3d68d6[_0x96b1('0x20')]=qs[_0x96b1('0x20')](_0x5846ef['query'][_0x96b1('0x20')]);_0x3d68d6['offset']=qs[_0x96b1('0x1d')](_0x5846ef[_0x96b1('0x33')][_0x96b1('0x1d')]);}return _0x4c61b4[_0x96b1('0x6f')](_0x3d68d6);}})[_0x96b1('0x25')](function(_0x459563){if(_0x459563){return _0x459563?{'count':_0x42615d,'rows':_0x459563}:null;}})[_0x96b1('0x25')](respondWithResult(_0x2f6929,null))['catch'](handleError(_0x2f6929,null));};
\ No newline at end of file
+var _0x31de=['DashboardItem','getItems','findOne','nolimit','rimraf','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','destroy','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','body','CustomDashboards','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrRefresh','stringify','addItem','DashboardId'];(function(_0x5597aa,_0x2edbea){var _0x35a3ab=function(_0x4c0cbb){while(--_0x4c0cbb){_0x5597aa['push'](_0x5597aa['shift']());}};_0x35a3ab(++_0x2edbea);}(_0x31de,0x106));var _0xe31d=function(_0x317070,_0x3bdb0b){_0x317070=_0x317070-0x0;var _0x24f306=_0x31de[_0x317070];return _0x24f306;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe31d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe31d('0x1'));var moment=require(_0xe31d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe31d('0x3'));var util=require(_0xe31d('0x4'));var path=require(_0xe31d('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe31d('0x6'));var fs=require('fs');var fs_extra=require(_0xe31d('0x7'));var _=require(_0xe31d('0x8'));var squel=require(_0xe31d('0x9'));var crypto=require('crypto');var jsforce=require(_0xe31d('0xa'));var deskjs=require(_0xe31d('0xb'));var toCsv=require(_0xe31d('0xc'));var querystring=require(_0xe31d('0xd'));var Papa=require(_0xe31d('0xe'));var Redis=require(_0xe31d('0xf'));var authService=require(_0xe31d('0x10'));var qs=require(_0xe31d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe31d('0x12'));var logger=require(_0xe31d('0x13'))(_0xe31d('0x14'));var utils=require(_0xe31d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe31d('0x16'));var db=require(_0xe31d('0x17'))['db'];config[_0xe31d('0x18')]=_[_0xe31d('0x19')](config[_0xe31d('0x18')],{'host':_0xe31d('0x1a'),'port':0x18eb});var socket=require(_0xe31d('0x1b'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0xfe4847,_0x34f73e){_0x34f73e=_0x34f73e||0xcc;return function(_0x4de555){if(_0x4de555){return _0xfe4847[_0xe31d('0x1c')](_0x34f73e);}return _0xfe4847[_0xe31d('0x1d')](_0x34f73e)[_0xe31d('0x1e')]();};}function respondWithResult(_0x5275b8,_0xeeab8c){_0xeeab8c=_0xeeab8c||0xc8;return function(_0x287b22){if(_0x287b22){return _0x5275b8[_0xe31d('0x1d')](_0xeeab8c)[_0xe31d('0x1f')](_0x287b22);}};}function respondWithFilteredResult(_0x5b0fb6,_0x435b64){return function(_0x3343ee){if(_0x3343ee){var _0x50656a=typeof _0x435b64[_0xe31d('0x20')]===_0xe31d('0x21')&&typeof _0x435b64['limit']===_0xe31d('0x21');var _0x42c6ae=_0x3343ee[_0xe31d('0x22')];var _0x4b596a=_0x50656a?0x0:_0x435b64['offset'];var _0x4bd1ed=_0x50656a?_0x3343ee[_0xe31d('0x22')]:_0x435b64[_0xe31d('0x20')]+_0x435b64[_0xe31d('0x23')];var _0x168d75;if(_0x4bd1ed>=_0x42c6ae){_0x4bd1ed=_0x42c6ae;_0x168d75=0xc8;}else{_0x168d75=0xce;}_0x5b0fb6[_0xe31d('0x1d')](_0x168d75);return _0x5b0fb6[_0xe31d('0x24')](_0xe31d('0x25'),_0x4b596a+'-'+_0x4bd1ed+'/'+_0x42c6ae)[_0xe31d('0x1f')](_0x3343ee);}return null;};}function patchUpdates(_0x461e41){return function(_0x3aa281){try{jsonpatch[_0xe31d('0x26')](_0x3aa281,_0x461e41,!![]);}catch(_0x41b3c6){return BPromise['reject'](_0x41b3c6);}return _0x3aa281['save']();};}function saveUpdates(_0x558a67,_0x5b4428){return function(_0x2c2287){if(_0x2c2287){return _0x2c2287[_0xe31d('0x27')](_0x558a67)[_0xe31d('0x28')](function(_0x5ec27d){return _0x5ec27d;});}return null;};}function removeEntity(_0x14f03c,_0x5d9b83){return function(_0x420af2){if(_0x420af2){return _0x420af2['destroy']()[_0xe31d('0x28')](function(){var _0x373998=_0x420af2[_0xe31d('0x29')]({'plain':!![]});var _0x374b3b='CustomDashboards';return db['UserProfileResource'][_0xe31d('0x2a')]({'where':{'type':_0x374b3b,'resourceId':_0x373998['id']}})[_0xe31d('0x28')](function(){return _0x420af2;});})[_0xe31d('0x28')](function(){_0x14f03c['status'](0xcc)[_0xe31d('0x1e')]();});}};}function handleEntityNotFound(_0x14211e,_0x583f23){return function(_0x554e34){if(!_0x554e34){_0x14211e[_0xe31d('0x1c')](0x194);}return _0x554e34;};}function handleError(_0x9294e9,_0x3d5754){_0x3d5754=_0x3d5754||0x1f4;return function(_0x16ddca){logger[_0xe31d('0x2b')](_0x16ddca[_0xe31d('0x2c')]);if(_0x16ddca[_0xe31d('0x2d')]){delete _0x16ddca[_0xe31d('0x2d')];}_0x9294e9[_0xe31d('0x1d')](_0x3d5754)['send'](_0x16ddca);};}exports['index']=function(_0x4e6153,_0xc5b186){var _0x1b6971={},_0x505994={},_0x2c9334={'count':0x0,'rows':[]};var _0x58afa4=_[_0xe31d('0x2e')](db[_0xe31d('0x2f')][_0xe31d('0x30')],function(_0x3101ec){return{'name':_0x3101ec[_0xe31d('0x31')],'type':_0x3101ec[_0xe31d('0x32')][_0xe31d('0x33')]};});_0x505994[_0xe31d('0x34')]=_[_0xe31d('0x2e')](_0x58afa4,_0xe31d('0x2d'));_0x505994['query']=_[_0xe31d('0x35')](_0x4e6153[_0xe31d('0x36')]);_0x505994['filters']=_[_0xe31d('0x37')](_0x505994[_0xe31d('0x34')],_0x505994[_0xe31d('0x36')]);_0x1b6971[_0xe31d('0x38')]=_[_0xe31d('0x37')](_0x505994[_0xe31d('0x34')],qs['fields'](_0x4e6153['query'][_0xe31d('0x39')]));_0x1b6971[_0xe31d('0x38')]=_0x1b6971[_0xe31d('0x38')][_0xe31d('0x3a')]?_0x1b6971['attributes']:_0x505994[_0xe31d('0x34')];if(!_0x4e6153[_0xe31d('0x36')][_0xe31d('0x3b')]('nolimit')){_0x1b6971[_0xe31d('0x23')]=qs[_0xe31d('0x23')](_0x4e6153['query'][_0xe31d('0x23')]);_0x1b6971[_0xe31d('0x20')]=qs[_0xe31d('0x20')](_0x4e6153[_0xe31d('0x36')][_0xe31d('0x20')]);}_0x1b6971[_0xe31d('0x3c')]=qs['sort'](_0x4e6153[_0xe31d('0x36')][_0xe31d('0x3d')]);_0x1b6971[_0xe31d('0x3e')]=qs[_0xe31d('0x3f')](_[_0xe31d('0x40')](_0x4e6153[_0xe31d('0x36')],_0x505994[_0xe31d('0x3f')]),_0x58afa4);if(_0x4e6153['query']['filter']){_0x1b6971[_0xe31d('0x3e')]=_[_0xe31d('0x41')](_0x1b6971[_0xe31d('0x3e')],{'$or':_[_0xe31d('0x2e')](_0x58afa4,function(_0x2d26f4){if(_0x2d26f4[_0xe31d('0x32')]!==_0xe31d('0x42')){var _0x9cb95={};_0x9cb95[_0x2d26f4['name']]={'$like':'%'+_0x4e6153[_0xe31d('0x36')][_0xe31d('0x43')]+'%'};return _0x9cb95;}})});}_0x1b6971=_[_0xe31d('0x41')]({},_0x1b6971,_0x4e6153[_0xe31d('0x44')]);var _0x4a2196={'where':_0x1b6971[_0xe31d('0x3e')]};return db[_0xe31d('0x2f')][_0xe31d('0x22')](_0x4a2196)[_0xe31d('0x28')](function(_0x364b24){_0x2c9334['count']=_0x364b24;if(_0x4e6153[_0xe31d('0x36')]['includeAll']){_0x1b6971['include']=[{'all':!![]}];}return db['Dashboard'][_0xe31d('0x45')](_0x1b6971);})[_0xe31d('0x28')](function(_0x59c7dc){_0x2c9334['rows']=_0x59c7dc;return _0x2c9334;})['then'](respondWithFilteredResult(_0xc5b186,_0x1b6971))[_0xe31d('0x46')](handleError(_0xc5b186,null));};exports[_0xe31d('0x47')]=function(_0x41c7be,_0x563de4){var _0x40720d={'raw':![],'where':{'id':_0x41c7be[_0xe31d('0x48')]['id']}},_0x47fd88={};_0x47fd88[_0xe31d('0x34')]=_[_0xe31d('0x35')](db[_0xe31d('0x2f')][_0xe31d('0x30')]);_0x47fd88[_0xe31d('0x36')]=_['keys'](_0x41c7be[_0xe31d('0x36')]);_0x47fd88['filters']=_['intersection'](_0x47fd88[_0xe31d('0x34')],_0x47fd88[_0xe31d('0x36')]);_0x40720d[_0xe31d('0x38')]=_[_0xe31d('0x37')](_0x47fd88[_0xe31d('0x34')],qs[_0xe31d('0x39')](_0x41c7be['query']['fields']));_0x40720d[_0xe31d('0x38')]=_0x40720d['attributes']['length']?_0x40720d[_0xe31d('0x38')]:_0x47fd88[_0xe31d('0x34')];if(_0x41c7be[_0xe31d('0x36')][_0xe31d('0x49')]){_0x40720d[_0xe31d('0x4a')]=[{'all':!![]}];}_0x40720d=_[_0xe31d('0x41')]({},_0x40720d,_0x41c7be[_0xe31d('0x44')]);return db['Dashboard'][_0xe31d('0x4b')](_0x40720d)[_0xe31d('0x28')](handleEntityNotFound(_0x563de4,null))[_0xe31d('0x28')](respondWithResult(_0x563de4,null))['catch'](handleError(_0x563de4,null));};exports[_0xe31d('0x4c')]=function(_0x569829,_0x111eb7){return db[_0xe31d('0x2f')][_0xe31d('0x4c')](_0x569829['body'],{})[_0xe31d('0x28')](function(_0xb2ec8){var _0x2ded86=_0x569829['user']['get']({'plain':!![]});if(!_0x2ded86)throw new Error(_0xe31d('0x4d'));if(_0x2ded86['role']===_0xe31d('0x4e')){var _0x3a4a33=_0xb2ec8[_0xe31d('0x29')]({'plain':!![]});var _0x229605='CustomDashboards';return db[_0xe31d('0x4f')]['find']({'where':{'name':_0x229605,'userProfileId':_0x2ded86[_0xe31d('0x50')]},'raw':!![]})[_0xe31d('0x28')](function(_0x4aebfa){if(_0x4aebfa&&_0x4aebfa['autoAssociation']===0x0){return db[_0xe31d('0x51')][_0xe31d('0x4c')]({'name':_0x3a4a33['name'],'resourceId':_0x3a4a33['id'],'type':_0x4aebfa[_0xe31d('0x2d')],'sectionId':_0x4aebfa['id']},{})[_0xe31d('0x28')](function(){return _0xb2ec8;});}else{return _0xb2ec8;}})[_0xe31d('0x46')](function(_0xb68a88){logger[_0xe31d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb68a88);throw _0xb68a88;});}return _0xb2ec8;})[_0xe31d('0x28')](respondWithResult(_0x111eb7,0xc9))[_0xe31d('0x46')](handleError(_0x111eb7,null));};exports[_0xe31d('0x52')]=function(_0x385fd3,_0x512bc5){var _0x2b2fbe={'where':{'id':_0x385fd3[_0xe31d('0x48')]['id']}},_0x561880={};_0x561880[_0xe31d('0x34')]=_[_0xe31d('0x35')](db[_0xe31d('0x2f')][_0xe31d('0x30')]);_0x2b2fbe['attributes']=_[_0xe31d('0x37')](_0x561880[_0xe31d('0x34')],qs[_0xe31d('0x39')](_0x385fd3['query'][_0xe31d('0x39')]));_0x2b2fbe[_0xe31d('0x38')]=_0x2b2fbe['attributes']['length']?_0x2b2fbe[_0xe31d('0x38')]:_0x561880[_0xe31d('0x34')];if(_0x385fd3[_0xe31d('0x36')][_0xe31d('0x49')]){_0x2b2fbe[_0xe31d('0x4a')]=[{'all':!![]}];}_0x2b2fbe=_[_0xe31d('0x41')]({},_0x2b2fbe,_0x385fd3[_0xe31d('0x44')]);return db[_0xe31d('0x2f')]['find'](_0x2b2fbe)[_0xe31d('0x28')](handleEntityNotFound(_0x512bc5,null))[_0xe31d('0x28')](function(_0x50c60c){if(_0x50c60c){var _0x5e6e61=_0x50c60c[_0xe31d('0x29')]({'plain':!![]});_0x5e6e61=qs[_0xe31d('0x53')](_0x5e6e61,['id',_0xe31d('0x54'),_0xe31d('0x55')]);_0x385fd3['body']=_[_0xe31d('0x53')](_0x385fd3[_0xe31d('0x56')],['id',_0xe31d('0x54'),_0xe31d('0x55')]);return db[_0xe31d('0x2f')][_0xe31d('0x4c')](_['merge'](_0x5e6e61,_0x385fd3['body']),{'include':_0x385fd3[_0xe31d('0x36')][_0xe31d('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x29cb67){var _0x5ab628=_0x385fd3[_0xe31d('0x4e')][_0xe31d('0x29')]({'plain':!![]});if(!_0x5ab628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab628['role']==='user'){var _0x184cb2=_0x29cb67[_0xe31d('0x29')]({'plain':!![]});var _0x276a9b=_0xe31d('0x57');return db[_0xe31d('0x4f')][_0xe31d('0x4b')]({'where':{'name':_0x276a9b,'userProfileId':_0x5ab628[_0xe31d('0x50')]},'raw':!![]})['then'](function(_0x3e4ea1){if(_0x3e4ea1&&_0x3e4ea1[_0xe31d('0x58')]===0x0){return db[_0xe31d('0x51')][_0xe31d('0x4c')]({'name':_0x184cb2[_0xe31d('0x2d')],'resourceId':_0x184cb2['id'],'type':_0x3e4ea1[_0xe31d('0x2d')],'sectionId':_0x3e4ea1['id']},{})[_0xe31d('0x28')](function(){return _0x29cb67;});}else{return _0x29cb67;}})[_0xe31d('0x46')](function(_0x97beda){logger[_0xe31d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x97beda);throw _0x97beda;});}return _0x29cb67;});}})['then'](respondWithResult(_0x512bc5,0xc9))[_0xe31d('0x46')](handleError(_0x512bc5,null));};exports['update']=function(_0x250c43,_0x378366){if(_0x250c43['body']['id']){delete _0x250c43['body']['id'];}return db[_0xe31d('0x2f')]['find']({'where':{'id':_0x250c43[_0xe31d('0x48')]['id']}})[_0xe31d('0x28')](handleEntityNotFound(_0x378366,null))[_0xe31d('0x28')](saveUpdates(_0x250c43[_0xe31d('0x56')],null))[_0xe31d('0x28')](respondWithResult(_0x378366,null))[_0xe31d('0x46')](handleError(_0x378366,null));};exports['destroy']=function(_0x47f1d5,_0x1653a7){return db['Dashboard'][_0xe31d('0x4b')]({'where':{'id':_0x47f1d5['params']['id']}})[_0xe31d('0x28')](handleEntityNotFound(_0x1653a7,null))[_0xe31d('0x28')](removeEntity(_0x1653a7,null))[_0xe31d('0x46')](handleError(_0x1653a7,null));};function widgetAttributes(_0x3c44a2){try{switch(_0x3c44a2[_0xe31d('0x32')]){case _0xe31d('0x59'):return[{'name':_0xe31d('0x5a'),'value':_0x3c44a2[_0xe31d('0x5a')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x0]?_0x3c44a2[_0xe31d('0x5b')][0x0][_0xe31d('0x5c')]:undefined)||_0xe31d('0x5d')}];case _0xe31d('0x5e'):return[{'name':'attrPath','value':_0x3c44a2[_0xe31d('0x5f')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2['attrs'][0x0]['value']:undefined)||''}];case _0xe31d('0x60'):return[{'name':_0xe31d('0x61'),'value':_0x3c44a2[_0xe31d('0x61')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2['attrs'][0x0][_0xe31d('0x5c')]:undefined)||_0xe31d('0x62')},{'name':_0xe31d('0x63'),'value':_0x3c44a2[_0xe31d('0x63')]||(_0x3c44a2['attrs']&&_0x3c44a2['attrs'][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||_0xe31d('0x64')},{'name':'attrFontSize','value':_0x3c44a2[_0xe31d('0x65')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x2]?_0x3c44a2[_0xe31d('0x5b')][0x2][_0xe31d('0x5c')]:undefined)||0xc}];case _0xe31d('0x66'):return[{'name':_0xe31d('0x67'),'value':_0x3c44a2[_0xe31d('0x67')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2[_0xe31d('0x5b')][0x0][_0xe31d('0x5c')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x3c44a2[_0xe31d('0x68')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||[]},{'name':_0xe31d('0x65'),'value':_0x3c44a2[_0xe31d('0x65')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x2]?_0x3c44a2['attrs'][0x2][_0xe31d('0x5c')]:undefined)||0x14},{'name':_0xe31d('0x69'),'value':_0x3c44a2[_0xe31d('0x69')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x3]?_0x3c44a2['attrs'][0x3][_0xe31d('0x5c')]:undefined)||_0xe31d('0x6a')},{'name':_0xe31d('0x6b'),'value':_0x3c44a2[_0xe31d('0x6b')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x4]?_0x3c44a2[_0xe31d('0x5b')][0x4][_0xe31d('0x5c')]:undefined)||''},{'name':_0xe31d('0x6c'),'value':_0x3c44a2[_0xe31d('0x6c')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x5]?_0x3c44a2['attrs'][0x5]['value']:undefined)||''},{'name':_0xe31d('0x6d'),'value':_0x3c44a2[_0xe31d('0x6d')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x6]?_0x3c44a2[_0xe31d('0x5b')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c44a2['attrOpenchannelAccounts']||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x7]?_0x3c44a2[_0xe31d('0x5b')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c44a2[_0xe31d('0x6e')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x8]?_0x3c44a2[_0xe31d('0x5b')][0x8][_0xe31d('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c44a2[_0xe31d('0x6f')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x9]?_0x3c44a2[_0xe31d('0x5b')][0x9][_0xe31d('0x5c')]:undefined)||''}];case _0xe31d('0x70'):case _0xe31d('0x71'):return[{'name':_0xe31d('0x72'),'value':_0x3c44a2[_0xe31d('0x72')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2[_0xe31d('0x5b')][0x0][_0xe31d('0x5c')]:undefined)||_0xe31d('0x73')},{'name':_0xe31d('0x74'),'value':_0x3c44a2['attrSerie2']||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||null},{'name':_0xe31d('0x75'),'value':_0x3c44a2[_0xe31d('0x75')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x2]?_0x3c44a2[_0xe31d('0x5b')][0x2][_0xe31d('0x5c')]:undefined)||null},{'name':_0xe31d('0x68'),'value':_0x3c44a2[_0xe31d('0x68')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x3]?_0x3c44a2[_0xe31d('0x5b')][0x3][_0xe31d('0x5c')]:undefined)||[]},{'name':_0xe31d('0x69'),'value':_0x3c44a2[_0xe31d('0x69')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x4]?_0x3c44a2[_0xe31d('0x5b')][0x4][_0xe31d('0x5c')]:undefined)||_0xe31d('0x6a')},{'name':_0xe31d('0x6b'),'value':_0x3c44a2['attrEmailAccounts']||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x5]?_0x3c44a2['attrs'][0x5][_0xe31d('0x5c')]:undefined)||''},{'name':_0xe31d('0x6c'),'value':_0x3c44a2[_0xe31d('0x6c')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x6]?_0x3c44a2['attrs'][0x6][_0xe31d('0x5c')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c44a2[_0xe31d('0x6d')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x7]?_0x3c44a2[_0xe31d('0x5b')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c44a2[_0xe31d('0x76')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x8]?_0x3c44a2[_0xe31d('0x5b')][0x8][_0xe31d('0x5c')]:undefined)||''},{'name':_0xe31d('0x6e'),'value':_0x3c44a2[_0xe31d('0x6e')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x9]?_0x3c44a2[_0xe31d('0x5b')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3c44a2[_0xe31d('0x6f')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0xa]?_0x3c44a2[_0xe31d('0x5b')][0xa][_0xe31d('0x5c')]:undefined)||''}];case _0xe31d('0x77'):return[{'name':'attrReport','type':_0x3c44a2[_0xe31d('0x78')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x0]?_0x3c44a2['attrs'][0x0][_0xe31d('0x32')]:undefined)||null,'value':_0x3c44a2['attrReport']||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2['attrs'][0x0]['value']:undefined)||null},{'name':_0xe31d('0x79'),'value':_0x3c44a2[_0xe31d('0x79')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x5a3959){logger[_0xe31d('0x2b')]('widgetAttributes:\x20%s',JSON[_0xe31d('0x7a')](_0x5a3959));return[];}}exports[_0xe31d('0x7b')]=function(_0x2f262b,_0x1d87b0,_0x176f45){if(_0x2f262b['body']['id']){delete _0x2f262b[_0xe31d('0x56')]['id'];}return db[_0xe31d('0x2f')][_0xe31d('0x4b')]({'where':{'id':_0x2f262b[_0xe31d('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d87b0,null))[_0xe31d('0x28')](function(_0x780d5c){if(_0x780d5c){_0x2f262b['body'][_0xe31d('0x7c')]=_0x780d5c['id'];_0x2f262b[_0xe31d('0x56')]['attrs']=widgetAttributes(_0x2f262b[_0xe31d('0x56')]);return db[_0xe31d('0x7d')]['create'](_0x2f262b[_0xe31d('0x56')]);}})[_0xe31d('0x28')](respondWithResult(_0x1d87b0,null))[_0xe31d('0x46')](handleError(_0x1d87b0,null));};exports[_0xe31d('0x7e')]=function(_0x50545b,_0x339042,_0x2ffd86){var _0x5495b9={};var _0x4f1f01={};var _0x2d7df0;var _0x53f1b0;return db[_0xe31d('0x2f')][_0xe31d('0x7f')]({'where':{'id':_0x50545b['params']['id']}})[_0xe31d('0x28')](handleEntityNotFound(_0x339042,null))[_0xe31d('0x28')](function(_0xcc26c9){if(_0xcc26c9){_0x2d7df0=_0xcc26c9;_0x4f1f01[_0xe31d('0x34')]=_[_0xe31d('0x35')](db['DashboardItem']['rawAttributes']);_0x4f1f01[_0xe31d('0x36')]=_[_0xe31d('0x35')](_0x50545b[_0xe31d('0x36')]);_0x4f1f01[_0xe31d('0x3f')]=_[_0xe31d('0x37')](_0x4f1f01['model'],_0x4f1f01[_0xe31d('0x36')]);_0x5495b9[_0xe31d('0x38')]=_[_0xe31d('0x37')](_0x4f1f01[_0xe31d('0x34')],qs[_0xe31d('0x39')](_0x50545b[_0xe31d('0x36')][_0xe31d('0x39')]));_0x5495b9['attributes']=_0x5495b9['attributes'][_0xe31d('0x3a')]?_0x5495b9[_0xe31d('0x38')]:_0x4f1f01[_0xe31d('0x34')];_0x5495b9['order']=qs['sort'](_0x50545b[_0xe31d('0x36')][_0xe31d('0x3d')]);_0x5495b9[_0xe31d('0x3e')]=qs[_0xe31d('0x3f')](_[_0xe31d('0x40')](_0x50545b[_0xe31d('0x36')],_0x4f1f01['filters']));if(_0x50545b['query']['filter']){_0x5495b9[_0xe31d('0x3e')]=_['merge'](_0x5495b9[_0xe31d('0x3e')],{'$or':_['map'](_0x5495b9[_0xe31d('0x38')],function(_0x2dd69f){var _0x466e3b={};_0x466e3b[_0x2dd69f]={'$like':'%'+_0x50545b[_0xe31d('0x36')][_0xe31d('0x43')]+'%'};return _0x466e3b;})});}_0x5495b9=_[_0xe31d('0x41')]({},_0x5495b9,_0x50545b[_0xe31d('0x44')]);return _0x2d7df0[_0xe31d('0x7e')](_0x5495b9);}})['then'](function(_0x10472a){if(_0x10472a){_0x53f1b0=_0x10472a['length'];if(!_0x50545b[_0xe31d('0x36')][_0xe31d('0x3b')](_0xe31d('0x80'))){_0x5495b9[_0xe31d('0x23')]=qs[_0xe31d('0x23')](_0x50545b[_0xe31d('0x36')][_0xe31d('0x23')]);_0x5495b9[_0xe31d('0x20')]=qs['offset'](_0x50545b[_0xe31d('0x36')]['offset']);}return _0x2d7df0[_0xe31d('0x7e')](_0x5495b9);}})['then'](function(_0x4fdd1a){if(_0x4fdd1a){return _0x4fdd1a?{'count':_0x53f1b0,'rows':_0x4fdd1a}:null;}})[_0xe31d('0x28')](respondWithResult(_0x339042,null))[_0xe31d('0x46')](handleError(_0x339042,null));};
\ No newline at end of file