Built motion from commit f16df95f.|2.5.40
[motion2.git] / server / api / dashboard / dashboard.controller.js
index f0c42a4..2688566 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2493=['body','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','nolimit','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','stack','name','send','map','Dashboard','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','find','create'];(function(_0x4a6c45,_0x1e0f8f){var _0x3b1bdf=function(_0x1bdc4d){while(--_0x1bdc4d){_0x4a6c45['push'](_0x4a6c45['shift']());}};_0x3b1bdf(++_0x1e0f8f);}(_0x2493,0x1ac));var _0x3249=function(_0x2c0730,_0x2cddd2){_0x2c0730=_0x2c0730-0x0;var _0x38a9ba=_0x2493[_0x2c0730];return _0x38a9ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3249('0x0'));var jsonpatch=require(_0x3249('0x1'));var rp=require(_0x3249('0x2'));var moment=require('moment');var BPromise=require(_0x3249('0x3'));var Mustache=require('mustache');var util=require(_0x3249('0x4'));var path=require(_0x3249('0x5'));var sox=require(_0x3249('0x6'));var csv=require(_0x3249('0x7'));var ejs=require(_0x3249('0x8'));var fs=require('fs');var fs_extra=require(_0x3249('0x9'));var _=require(_0x3249('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3249('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3249('0x7'));var querystring=require(_0x3249('0xc'));var Papa=require(_0x3249('0xd'));var Redis=require(_0x3249('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3249('0xf'));var hardwareService=require(_0x3249('0x10'));var logger=require('../../config/logger')(_0x3249('0x11'));var utils=require(_0x3249('0x12'));var config=require(_0x3249('0x13'));var licenseUtil=require(_0x3249('0x14'));var db=require(_0x3249('0x15'))['db'];config[_0x3249('0x16')]=_[_0x3249('0x17')](config[_0x3249('0x16')],{'host':_0x3249('0x18'),'port':0x18eb});var socket=require(_0x3249('0x19'))(new Redis(config[_0x3249('0x16')]));require('./dashboard.socket')[_0x3249('0x1a')](socket);function respondWithStatusCode(_0x2c6635,_0x243538){_0x243538=_0x243538||0xcc;return function(_0x31c267){if(_0x31c267){return _0x2c6635[_0x3249('0x1b')](_0x243538);}return _0x2c6635[_0x3249('0x1c')](_0x243538)[_0x3249('0x1d')]();};}function respondWithResult(_0x1955a2,_0x4f7c41){_0x4f7c41=_0x4f7c41||0xc8;return function(_0x1fa248){if(_0x1fa248){return _0x1955a2[_0x3249('0x1c')](_0x4f7c41)[_0x3249('0x1e')](_0x1fa248);}};}function respondWithFilteredResult(_0x1707ec,_0x14c649){return function(_0x7571b9){if(_0x7571b9){var _0x1668c9=typeof _0x14c649['offset']===_0x3249('0x1f')&&typeof _0x14c649[_0x3249('0x20')]===_0x3249('0x1f');var _0x4c537e=_0x7571b9[_0x3249('0x21')];var _0x3b0d87=_0x1668c9?0x0:_0x14c649[_0x3249('0x22')];var _0x56d0a2=_0x1668c9?_0x7571b9[_0x3249('0x21')]:_0x14c649[_0x3249('0x22')]+_0x14c649[_0x3249('0x20')];var _0x778a67;if(_0x56d0a2>=_0x4c537e){_0x56d0a2=_0x4c537e;_0x778a67=0xc8;}else{_0x778a67=0xce;}_0x1707ec[_0x3249('0x1c')](_0x778a67);return _0x1707ec[_0x3249('0x23')]('Content-Range',_0x3b0d87+'-'+_0x56d0a2+'/'+_0x4c537e)[_0x3249('0x1e')](_0x7571b9);}return null;};}function patchUpdates(_0x587643){return function(_0x340871){try{jsonpatch[_0x3249('0x24')](_0x340871,_0x587643,!![]);}catch(_0xdd6a36){return BPromise[_0x3249('0x25')](_0xdd6a36);}return _0x340871[_0x3249('0x26')]();};}function saveUpdates(_0x195c5b,_0x3956c3){return function(_0x44ea71){if(_0x44ea71){return _0x44ea71[_0x3249('0x27')](_0x195c5b)[_0x3249('0x28')](function(_0x84d947){return _0x84d947;});}return null;};}function removeEntity(_0x152099,_0x3b6e1f){return function(_0x2ddd33){if(_0x2ddd33){return _0x2ddd33['destroy']()[_0x3249('0x28')](function(){var _0x52fd98=_0x2ddd33[_0x3249('0x29')]({'plain':!![]});var _0x540c2e=_0x3249('0x2a');return db[_0x3249('0x2b')][_0x3249('0x2c')]({'where':{'type':_0x540c2e,'resourceId':_0x52fd98['id']}})['then'](function(){return _0x2ddd33;});})[_0x3249('0x28')](function(){_0x152099[_0x3249('0x1c')](0xcc)[_0x3249('0x1d')]();});}};}function handleEntityNotFound(_0x69969f,_0x270361){return function(_0x469061){if(!_0x469061){_0x69969f[_0x3249('0x1b')](0x194);}return _0x469061;};}function handleError(_0x3d029c,_0x595ea1){_0x595ea1=_0x595ea1||0x1f4;return function(_0x480339){logger['error'](_0x480339[_0x3249('0x2d')]);if(_0x480339[_0x3249('0x2e')]){delete _0x480339[_0x3249('0x2e')];}_0x3d029c[_0x3249('0x1c')](_0x595ea1)[_0x3249('0x2f')](_0x480339);};}exports['index']=function(_0x3ae79f,_0x244c44){var _0x1f5780={},_0x3b08f5={},_0x495cdf={'count':0x0,'rows':[]};var _0x5bf770=_[_0x3249('0x30')](db[_0x3249('0x31')][_0x3249('0x32')],function(_0x4b36ab){return{'name':_0x4b36ab['fieldName'],'type':_0x4b36ab[_0x3249('0x33')][_0x3249('0x34')]};});_0x3b08f5['model']=_[_0x3249('0x30')](_0x5bf770,_0x3249('0x2e'));_0x3b08f5[_0x3249('0x35')]=_[_0x3249('0x36')](_0x3ae79f[_0x3249('0x35')]);_0x3b08f5[_0x3249('0x37')]=_[_0x3249('0x38')](_0x3b08f5[_0x3249('0x39')],_0x3b08f5[_0x3249('0x35')]);_0x1f5780[_0x3249('0x3a')]=_[_0x3249('0x38')](_0x3b08f5[_0x3249('0x39')],qs[_0x3249('0x3b')](_0x3ae79f[_0x3249('0x35')][_0x3249('0x3b')]));_0x1f5780['attributes']=_0x1f5780[_0x3249('0x3a')][_0x3249('0x3c')]?_0x1f5780['attributes']:_0x3b08f5['model'];if(!_0x3ae79f[_0x3249('0x35')][_0x3249('0x3d')]('nolimit')){_0x1f5780['limit']=qs[_0x3249('0x20')](_0x3ae79f[_0x3249('0x35')][_0x3249('0x20')]);_0x1f5780['offset']=qs[_0x3249('0x22')](_0x3ae79f[_0x3249('0x35')][_0x3249('0x22')]);}_0x1f5780[_0x3249('0x3e')]=qs[_0x3249('0x3f')](_0x3ae79f['query']['sort']);_0x1f5780[_0x3249('0x40')]=qs[_0x3249('0x37')](_[_0x3249('0x41')](_0x3ae79f['query'],_0x3b08f5['filters']),_0x5bf770);if(_0x3ae79f[_0x3249('0x35')][_0x3249('0x42')]){_0x1f5780[_0x3249('0x40')]=_[_0x3249('0x43')](_0x1f5780[_0x3249('0x40')],{'$or':_[_0x3249('0x30')](_0x5bf770,function(_0x20e800){if(_0x20e800[_0x3249('0x33')]!==_0x3249('0x44')){var _0x5d7a17={};_0x5d7a17[_0x20e800[_0x3249('0x2e')]]={'$like':'%'+_0x3ae79f[_0x3249('0x35')]['filter']+'%'};return _0x5d7a17;}})});}_0x1f5780=_[_0x3249('0x43')]({},_0x1f5780,_0x3ae79f[_0x3249('0x45')]);var _0x292aba={'where':_0x1f5780[_0x3249('0x40')]};return db[_0x3249('0x31')][_0x3249('0x21')](_0x292aba)[_0x3249('0x28')](function(_0x515d5e){_0x495cdf[_0x3249('0x21')]=_0x515d5e;if(_0x3ae79f['query']['includeAll']){_0x1f5780[_0x3249('0x46')]=[{'all':!![]}];}return db[_0x3249('0x31')][_0x3249('0x47')](_0x1f5780);})[_0x3249('0x28')](function(_0x1fcdae){_0x495cdf['rows']=_0x1fcdae;return _0x495cdf;})[_0x3249('0x28')](respondWithFilteredResult(_0x244c44,_0x1f5780))[_0x3249('0x48')](handleError(_0x244c44,null));};exports[_0x3249('0x49')]=function(_0x1efc39,_0x75ffa){var _0x20ca8c={'raw':![],'where':{'id':_0x1efc39['params']['id']}},_0x2aa2d0={};_0x2aa2d0[_0x3249('0x39')]=_[_0x3249('0x36')](db[_0x3249('0x31')]['rawAttributes']);_0x2aa2d0[_0x3249('0x35')]=_['keys'](_0x1efc39[_0x3249('0x35')]);_0x2aa2d0[_0x3249('0x37')]=_[_0x3249('0x38')](_0x2aa2d0['model'],_0x2aa2d0[_0x3249('0x35')]);_0x20ca8c[_0x3249('0x3a')]=_['intersection'](_0x2aa2d0[_0x3249('0x39')],qs[_0x3249('0x3b')](_0x1efc39[_0x3249('0x35')]['fields']));_0x20ca8c[_0x3249('0x3a')]=_0x20ca8c[_0x3249('0x3a')][_0x3249('0x3c')]?_0x20ca8c[_0x3249('0x3a')]:_0x2aa2d0[_0x3249('0x39')];if(_0x1efc39[_0x3249('0x35')]['includeAll']){_0x20ca8c[_0x3249('0x46')]=[{'all':!![]}];}_0x20ca8c=_['merge']({},_0x20ca8c,_0x1efc39['options']);return db[_0x3249('0x31')][_0x3249('0x4a')](_0x20ca8c)[_0x3249('0x28')](handleEntityNotFound(_0x75ffa,null))[_0x3249('0x28')](respondWithResult(_0x75ffa,null))['catch'](handleError(_0x75ffa,null));};exports[_0x3249('0x4b')]=function(_0x15b068,_0x25b45c){return db[_0x3249('0x31')]['create'](_0x15b068[_0x3249('0x4c')],{})['then'](function(_0x15a47b){var _0x1a4fd6=_0x15b068[_0x3249('0x4d')][_0x3249('0x29')]({'plain':!![]});if(!_0x1a4fd6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a4fd6['role']==='user'){var _0x194a0=_0x15a47b['get']({'plain':!![]});var _0x7ea710=_0x3249('0x2a');return db[_0x3249('0x4e')][_0x3249('0x4a')]({'where':{'name':_0x7ea710,'userProfileId':_0x1a4fd6['userProfileId']},'raw':!![]})['then'](function(_0x590f97){if(_0x590f97&&_0x590f97[_0x3249('0x4f')]===0x0){return db[_0x3249('0x2b')][_0x3249('0x4b')]({'name':_0x194a0[_0x3249('0x2e')],'resourceId':_0x194a0['id'],'type':_0x590f97[_0x3249('0x2e')],'sectionId':_0x590f97['id']},{})['then'](function(){return _0x15a47b;});}else{return _0x15a47b;}})['catch'](function(_0x55270c){logger[_0x3249('0x50')](_0x3249('0x51'),_0x55270c);throw _0x55270c;});}return _0x15a47b;})[_0x3249('0x28')](respondWithResult(_0x25b45c,0xc9))[_0x3249('0x48')](handleError(_0x25b45c,null));};exports[_0x3249('0x52')]=function(_0x134937,_0xc316f3){var _0xd0c002={'where':{'id':_0x134937[_0x3249('0x53')]['id']}},_0x42b994={};_0x42b994['model']=_[_0x3249('0x36')](db[_0x3249('0x31')][_0x3249('0x32')]);_0xd0c002[_0x3249('0x3a')]=_[_0x3249('0x38')](_0x42b994[_0x3249('0x39')],qs[_0x3249('0x3b')](_0x134937[_0x3249('0x35')][_0x3249('0x3b')]));_0xd0c002['attributes']=_0xd0c002[_0x3249('0x3a')]['length']?_0xd0c002[_0x3249('0x3a')]:_0x42b994[_0x3249('0x39')];if(_0x134937['query'][_0x3249('0x54')]){_0xd0c002[_0x3249('0x46')]=[{'all':!![]}];}_0xd0c002=_[_0x3249('0x43')]({},_0xd0c002,_0x134937[_0x3249('0x45')]);return db[_0x3249('0x31')][_0x3249('0x4a')](_0xd0c002)[_0x3249('0x28')](handleEntityNotFound(_0xc316f3,null))[_0x3249('0x28')](function(_0x200e8f){if(_0x200e8f){var _0x2cffaf=_0x200e8f['get']({'plain':!![]});_0x2cffaf=qs[_0x3249('0x55')](_0x2cffaf,['id',_0x3249('0x56'),'updatedAt']);_0x134937[_0x3249('0x4c')]=_['omit'](_0x134937['body'],['id',_0x3249('0x56'),_0x3249('0x57')]);return db[_0x3249('0x31')][_0x3249('0x4b')](_[_0x3249('0x43')](_0x2cffaf,_0x134937[_0x3249('0x4c')]),{'include':_0x134937[_0x3249('0x35')][_0x3249('0x54')]?[{'all':!![]}]:undefined})[_0x3249('0x28')](function(_0x43ee73){var _0x3c9cc5=_0x134937[_0x3249('0x4d')]['get']({'plain':!![]});if(!_0x3c9cc5)throw new Error(_0x3249('0x58'));if(_0x3c9cc5[_0x3249('0x59')]===_0x3249('0x4d')){var _0x24d71e=_0x43ee73[_0x3249('0x29')]({'plain':!![]});var _0x1262ea=_0x3249('0x2a');return db[_0x3249('0x4e')][_0x3249('0x4a')]({'where':{'name':_0x1262ea,'userProfileId':_0x3c9cc5['userProfileId']},'raw':!![]})[_0x3249('0x28')](function(_0x2eb2af){if(_0x2eb2af&&_0x2eb2af[_0x3249('0x4f')]===0x0){return db[_0x3249('0x2b')][_0x3249('0x4b')]({'name':_0x24d71e['name'],'resourceId':_0x24d71e['id'],'type':_0x2eb2af[_0x3249('0x2e')],'sectionId':_0x2eb2af['id']},{})[_0x3249('0x28')](function(){return _0x43ee73;});}else{return _0x43ee73;}})['catch'](function(_0x3674de){logger[_0x3249('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3674de);throw _0x3674de;});}return _0x43ee73;});}})[_0x3249('0x28')](respondWithResult(_0xc316f3,0xc9))['catch'](handleError(_0xc316f3,null));};exports[_0x3249('0x27')]=function(_0x159cb4,_0x1ec980){if(_0x159cb4[_0x3249('0x4c')]['id']){delete _0x159cb4[_0x3249('0x4c')]['id'];}return db[_0x3249('0x31')][_0x3249('0x4a')]({'where':{'id':_0x159cb4['params']['id']}})['then'](handleEntityNotFound(_0x1ec980,null))[_0x3249('0x28')](saveUpdates(_0x159cb4['body'],null))[_0x3249('0x28')](respondWithResult(_0x1ec980,null))[_0x3249('0x48')](handleError(_0x1ec980,null));};exports[_0x3249('0x2c')]=function(_0x47ca52,_0x4bd75f){return db[_0x3249('0x31')][_0x3249('0x4a')]({'where':{'id':_0x47ca52[_0x3249('0x53')]['id']}})[_0x3249('0x28')](handleEntityNotFound(_0x4bd75f,null))[_0x3249('0x28')](removeEntity(_0x4bd75f,null))[_0x3249('0x48')](handleError(_0x4bd75f,null));};function widgetAttributes(_0x101357){try{switch(_0x101357[_0x3249('0x33')]){case _0x3249('0x5a'):return[{'name':_0x3249('0x5b'),'value':_0x101357[_0x3249('0x5b')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x0]?_0x101357[_0x3249('0x5c')][0x0][_0x3249('0x5d')]:undefined)||'https://'}];case _0x3249('0x5e'):return[{'name':_0x3249('0x5f'),'value':_0x101357[_0x3249('0x5f')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x0]?_0x101357[_0x3249('0x5c')][0x0][_0x3249('0x5d')]:undefined)||''}];case _0x3249('0x60'):return[{'name':_0x3249('0x61'),'value':_0x101357[_0x3249('0x61')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x0]?_0x101357[_0x3249('0x5c')][0x0][_0x3249('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x3249('0x62'),'value':_0x101357[_0x3249('0x62')]||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x1]?_0x101357[_0x3249('0x5c')][0x1][_0x3249('0x5d')]:undefined)||'0.00'},{'name':_0x3249('0x63'),'value':_0x101357[_0x3249('0x63')]||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x2]?_0x101357[_0x3249('0x5c')][0x2][_0x3249('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0x3249('0x64'),'value':_0x101357[_0x3249('0x64')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x0]?_0x101357[_0x3249('0x5c')][0x0][_0x3249('0x5d')]:undefined)||_0x3249('0x65')},{'name':_0x3249('0x66'),'value':_0x101357[_0x3249('0x66')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x1]?_0x101357[_0x3249('0x5c')][0x1][_0x3249('0x5d')]:undefined)||[]},{'name':_0x3249('0x63'),'value':_0x101357['attrFontSize']||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x2]?_0x101357[_0x3249('0x5c')][0x2]['value']:undefined)||0x14},{'name':_0x3249('0x67'),'value':_0x101357[_0x3249('0x67')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x3]?_0x101357[_0x3249('0x5c')][0x3][_0x3249('0x5d')]:undefined)||_0x3249('0x68')},{'name':_0x3249('0x69'),'value':_0x101357[_0x3249('0x69')]||(_0x101357['attrs']&&_0x101357[_0x3249('0x5c')][0x4]?_0x101357[_0x3249('0x5c')][0x4][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6a'),'value':_0x101357[_0x3249('0x6a')]||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x5]?_0x101357[_0x3249('0x5c')][0x5][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6b'),'value':_0x101357['attrSmsAccounts']||(_0x101357['attrs']&&_0x101357[_0x3249('0x5c')][0x6]?_0x101357[_0x3249('0x5c')][0x6]['value']:undefined)||''},{'name':_0x3249('0x6c'),'value':_0x101357['attrOpenchannelAccounts']||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x7]?_0x101357[_0x3249('0x5c')][0x7][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6d'),'value':_0x101357['attrWhatsappAccounts']||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x8]?_0x101357[_0x3249('0x5c')][0x8]['value']:undefined)||''},{'name':_0x3249('0x6e'),'value':_0x101357['attrChatWebsites']||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x9]?_0x101357[_0x3249('0x5c')][0x9][_0x3249('0x5d')]:undefined)||''}];case _0x3249('0x6f'):case _0x3249('0x70'):return[{'name':_0x3249('0x71'),'value':_0x101357[_0x3249('0x71')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x0]?_0x101357[_0x3249('0x5c')][0x0][_0x3249('0x5d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x101357['attrSerie2']||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x1]?_0x101357[_0x3249('0x5c')][0x1][_0x3249('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x101357[_0x3249('0x72')]||(_0x101357['attrs']&&_0x101357['attrs'][0x2]?_0x101357[_0x3249('0x5c')][0x2][_0x3249('0x5d')]:undefined)||null},{'name':_0x3249('0x66'),'value':_0x101357[_0x3249('0x66')]||(_0x101357['attrs']&&_0x101357['attrs'][0x3]?_0x101357['attrs'][0x3][_0x3249('0x5d')]:undefined)||[]},{'name':'attrChannel','value':_0x101357['attrChannel']||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x4]?_0x101357[_0x3249('0x5c')][0x4][_0x3249('0x5d')]:undefined)||_0x3249('0x68')},{'name':_0x3249('0x69'),'value':_0x101357['attrEmailAccounts']||(_0x101357['attrs']&&_0x101357[_0x3249('0x5c')][0x5]?_0x101357[_0x3249('0x5c')][0x5][_0x3249('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x101357[_0x3249('0x6a')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x6]?_0x101357['attrs'][0x6][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6b'),'value':_0x101357[_0x3249('0x6b')]||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x7]?_0x101357['attrs'][0x7][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6c'),'value':_0x101357['attrOpenchannelAccounts']||(_0x101357[_0x3249('0x5c')]&&_0x101357['attrs'][0x8]?_0x101357['attrs'][0x8][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6d'),'value':_0x101357['attrWhatsappAccounts']||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x9]?_0x101357[_0x3249('0x5c')][0x9][_0x3249('0x5d')]:undefined)||''},{'name':_0x3249('0x6e'),'value':_0x101357['attrChatWebsites']||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0xa]?_0x101357[_0x3249('0x5c')][0xa][_0x3249('0x5d')]:undefined)||''}];case _0x3249('0x73'):return[{'name':_0x3249('0x74'),'type':_0x101357[_0x3249('0x75')]||(_0x101357[_0x3249('0x5c')]&&_0x101357[_0x3249('0x5c')][0x0]?_0x101357[_0x3249('0x5c')][0x0]['type']:undefined)||null,'value':_0x101357[_0x3249('0x74')]||(_0x101357['attrs']&&_0x101357['attrs'][0x0]?_0x101357['attrs'][0x0][_0x3249('0x5d')]:undefined)||null},{'name':_0x3249('0x76'),'value':_0x101357[_0x3249('0x76')]||(_0x101357['attrs']&&_0x101357[_0x3249('0x5c')][0x1]?_0x101357[_0x3249('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x43b4ca){logger[_0x3249('0x50')](_0x3249('0x77'),JSON[_0x3249('0x78')](_0x43b4ca));return[];}}exports['addItem']=function(_0x396869,_0x1baf9c,_0x218de7){if(_0x396869['body']['id']){delete _0x396869['body']['id'];}return db['Dashboard'][_0x3249('0x4a')]({'where':{'id':_0x396869[_0x3249('0x53')]['id']}})['then'](handleEntityNotFound(_0x1baf9c,null))[_0x3249('0x28')](function(_0x149ac2){if(_0x149ac2){_0x396869[_0x3249('0x4c')][_0x3249('0x79')]=_0x149ac2['id'];_0x396869[_0x3249('0x4c')][_0x3249('0x5c')]=widgetAttributes(_0x396869[_0x3249('0x4c')]);return db[_0x3249('0x7a')]['create'](_0x396869[_0x3249('0x4c')]);}})[_0x3249('0x28')](respondWithResult(_0x1baf9c,null))[_0x3249('0x48')](handleError(_0x1baf9c,null));};exports[_0x3249('0x7b')]=function(_0x3ab109,_0x404a3d,_0x57a6de){var _0x181e9f={};var _0x727b74={};var _0x58ef63;var _0x353bc5;return db[_0x3249('0x31')][_0x3249('0x7c')]({'where':{'id':_0x3ab109[_0x3249('0x53')]['id']}})['then'](handleEntityNotFound(_0x404a3d,null))[_0x3249('0x28')](function(_0x41412c){if(_0x41412c){_0x58ef63=_0x41412c;_0x727b74['model']=_[_0x3249('0x36')](db[_0x3249('0x7a')][_0x3249('0x32')]);_0x727b74[_0x3249('0x35')]=_[_0x3249('0x36')](_0x3ab109['query']);_0x727b74[_0x3249('0x37')]=_[_0x3249('0x38')](_0x727b74[_0x3249('0x39')],_0x727b74[_0x3249('0x35')]);_0x181e9f[_0x3249('0x3a')]=_[_0x3249('0x38')](_0x727b74[_0x3249('0x39')],qs['fields'](_0x3ab109['query']['fields']));_0x181e9f['attributes']=_0x181e9f[_0x3249('0x3a')]['length']?_0x181e9f['attributes']:_0x727b74[_0x3249('0x39')];_0x181e9f[_0x3249('0x3e')]=qs['sort'](_0x3ab109[_0x3249('0x35')]['sort']);_0x181e9f[_0x3249('0x40')]=qs['filters'](_[_0x3249('0x41')](_0x3ab109[_0x3249('0x35')],_0x727b74[_0x3249('0x37')]));if(_0x3ab109[_0x3249('0x35')][_0x3249('0x42')]){_0x181e9f['where']=_[_0x3249('0x43')](_0x181e9f[_0x3249('0x40')],{'$or':_['map'](_0x181e9f['attributes'],function(_0x322a23){var _0x1b93b0={};_0x1b93b0[_0x322a23]={'$like':'%'+_0x3ab109['query'][_0x3249('0x42')]+'%'};return _0x1b93b0;})});}_0x181e9f=_[_0x3249('0x43')]({},_0x181e9f,_0x3ab109[_0x3249('0x45')]);return _0x58ef63['getItems'](_0x181e9f);}})[_0x3249('0x28')](function(_0x213d90){if(_0x213d90){_0x353bc5=_0x213d90[_0x3249('0x3c')];if(!_0x3ab109['query']['hasOwnProperty'](_0x3249('0x7d'))){_0x181e9f[_0x3249('0x20')]=qs[_0x3249('0x20')](_0x3ab109[_0x3249('0x35')][_0x3249('0x20')]);_0x181e9f['offset']=qs[_0x3249('0x22')](_0x3ab109['query']['offset']);}return _0x58ef63[_0x3249('0x7b')](_0x181e9f);}})[_0x3249('0x28')](function(_0xee2a49){if(_0xee2a49){return _0xee2a49?{'count':_0x353bc5,'rows':_0xee2a49}:null;}})[_0x3249('0x28')](respondWithResult(_0x404a3d,null))[_0x3249('0x48')](handleError(_0x404a3d,null));};
\ No newline at end of file
+var _0xb8f1=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4a8170,_0x318e9a){var _0x7a421a=function(_0x5939d1){while(--_0x5939d1){_0x4a8170['push'](_0x4a8170['shift']());}};_0x7a421a(++_0x318e9a);}(_0xb8f1,0xfd));var _0x1b8f=function(_0x3a7e02,_0x3f5085){_0x3a7e02=_0x3a7e02-0x0;var _0x1956fc=_0xb8f1[_0x3a7e02];return _0x1956fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b8f('0x0'));var zipdir=require(_0x1b8f('0x1'));var jsonpatch=require(_0x1b8f('0x2'));var rp=require(_0x1b8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b8f('0x4'));var util=require(_0x1b8f('0x5'));var path=require('path');var sox=require(_0x1b8f('0x6'));var csv=require(_0x1b8f('0x7'));var ejs=require(_0x1b8f('0x8'));var fs=require('fs');var fs_extra=require(_0x1b8f('0x9'));var _=require(_0x1b8f('0xa'));var squel=require(_0x1b8f('0xb'));var crypto=require(_0x1b8f('0xc'));var jsforce=require(_0x1b8f('0xd'));var deskjs=require(_0x1b8f('0xe'));var toCsv=require(_0x1b8f('0x7'));var querystring=require(_0x1b8f('0xf'));var Papa=require(_0x1b8f('0x10'));var Redis=require(_0x1b8f('0x11'));var authService=require(_0x1b8f('0x12'));var qs=require(_0x1b8f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b8f('0x14'));var logger=require(_0x1b8f('0x15'))(_0x1b8f('0x16'));var utils=require(_0x1b8f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1b8f('0x18'));var db=require(_0x1b8f('0x19'))['db'];config[_0x1b8f('0x1a')]=_['defaults'](config[_0x1b8f('0x1a')],{'host':_0x1b8f('0x1b'),'port':0x18eb});var socket=require(_0x1b8f('0x1c'))(new Redis(config[_0x1b8f('0x1a')]));require('./dashboard.socket')[_0x1b8f('0x1d')](socket);function respondWithStatusCode(_0x5c2111,_0x3e1bad){_0x3e1bad=_0x3e1bad||0xcc;return function(_0x35e9cb){if(_0x35e9cb){return _0x5c2111[_0x1b8f('0x1e')](_0x3e1bad);}return _0x5c2111[_0x1b8f('0x1f')](_0x3e1bad)[_0x1b8f('0x20')]();};}function respondWithResult(_0x27895a,_0x4a867e){_0x4a867e=_0x4a867e||0xc8;return function(_0x21bcf1){if(_0x21bcf1){return _0x27895a[_0x1b8f('0x1f')](_0x4a867e)[_0x1b8f('0x21')](_0x21bcf1);}};}function respondWithFilteredResult(_0x3f6911,_0x44581b){return function(_0x3810c2){if(_0x3810c2){var _0x249f5c=typeof _0x44581b[_0x1b8f('0x22')]===_0x1b8f('0x23')&&typeof _0x44581b[_0x1b8f('0x24')]===_0x1b8f('0x23');var _0x1eaf83=_0x3810c2[_0x1b8f('0x25')];var _0x5c683e=_0x249f5c?0x0:_0x44581b['offset'];var _0x144b65=_0x249f5c?_0x3810c2[_0x1b8f('0x25')]:_0x44581b[_0x1b8f('0x22')]+_0x44581b[_0x1b8f('0x24')];var _0x58175e;if(_0x144b65>=_0x1eaf83){_0x144b65=_0x1eaf83;_0x58175e=0xc8;}else{_0x58175e=0xce;}_0x3f6911[_0x1b8f('0x1f')](_0x58175e);return _0x3f6911[_0x1b8f('0x26')](_0x1b8f('0x27'),_0x5c683e+'-'+_0x144b65+'/'+_0x1eaf83)[_0x1b8f('0x21')](_0x3810c2);}return null;};}function patchUpdates(_0x314ef6){return function(_0x292b58){try{jsonpatch[_0x1b8f('0x28')](_0x292b58,_0x314ef6,!![]);}catch(_0x2fc526){return BPromise[_0x1b8f('0x29')](_0x2fc526);}return _0x292b58[_0x1b8f('0x2a')]();};}function saveUpdates(_0x5e7224,_0x1e6c93){return function(_0x64a8bc){if(_0x64a8bc){return _0x64a8bc[_0x1b8f('0x2b')](_0x5e7224)[_0x1b8f('0x2c')](function(_0x213475){return _0x213475;});}return null;};}function removeEntity(_0x28e4c6,_0xec0e31){return function(_0x1de892){if(_0x1de892){return _0x1de892[_0x1b8f('0x2d')]()[_0x1b8f('0x2c')](function(){var _0x2b4f77=_0x1de892[_0x1b8f('0x2e')]({'plain':!![]});var _0x13d27e=_0x1b8f('0x2f');return db[_0x1b8f('0x30')]['destroy']({'where':{'type':_0x13d27e,'resourceId':_0x2b4f77['id']}})[_0x1b8f('0x2c')](function(){return _0x1de892;});})[_0x1b8f('0x2c')](function(){_0x28e4c6[_0x1b8f('0x1f')](0xcc)[_0x1b8f('0x20')]();});}};}function handleEntityNotFound(_0x1bfce6,_0x49bf76){return function(_0x396720){if(!_0x396720){_0x1bfce6['sendStatus'](0x194);}return _0x396720;};}function handleError(_0x2a2c7f,_0x2f01eb){_0x2f01eb=_0x2f01eb||0x1f4;return function(_0x292397){logger[_0x1b8f('0x31')](_0x292397[_0x1b8f('0x32')]);if(_0x292397[_0x1b8f('0x33')]){delete _0x292397[_0x1b8f('0x33')];}_0x2a2c7f['status'](_0x2f01eb)[_0x1b8f('0x34')](_0x292397);};}exports[_0x1b8f('0x35')]=function(_0x3b75a6,_0xbda6e){var _0x13bc1e={},_0x235faa={},_0x560024={'count':0x0,'rows':[]};var _0x57bb26=_[_0x1b8f('0x36')](db[_0x1b8f('0x37')][_0x1b8f('0x38')],function(_0x115c40){return{'name':_0x115c40[_0x1b8f('0x39')],'type':_0x115c40[_0x1b8f('0x3a')]['key']};});_0x235faa[_0x1b8f('0x3b')]=_[_0x1b8f('0x36')](_0x57bb26,_0x1b8f('0x33'));_0x235faa[_0x1b8f('0x3c')]=_[_0x1b8f('0x3d')](_0x3b75a6[_0x1b8f('0x3c')]);_0x235faa[_0x1b8f('0x3e')]=_['intersection'](_0x235faa[_0x1b8f('0x3b')],_0x235faa[_0x1b8f('0x3c')]);_0x13bc1e[_0x1b8f('0x3f')]=_[_0x1b8f('0x40')](_0x235faa[_0x1b8f('0x3b')],qs['fields'](_0x3b75a6[_0x1b8f('0x3c')]['fields']));_0x13bc1e[_0x1b8f('0x3f')]=_0x13bc1e['attributes']['length']?_0x13bc1e['attributes']:_0x235faa[_0x1b8f('0x3b')];if(!_0x3b75a6[_0x1b8f('0x3c')][_0x1b8f('0x41')]('nolimit')){_0x13bc1e['limit']=qs[_0x1b8f('0x24')](_0x3b75a6[_0x1b8f('0x3c')][_0x1b8f('0x24')]);_0x13bc1e[_0x1b8f('0x22')]=qs['offset'](_0x3b75a6[_0x1b8f('0x3c')][_0x1b8f('0x22')]);}_0x13bc1e[_0x1b8f('0x42')]=qs[_0x1b8f('0x43')](_0x3b75a6[_0x1b8f('0x3c')][_0x1b8f('0x43')]);_0x13bc1e[_0x1b8f('0x44')]=qs[_0x1b8f('0x3e')](_[_0x1b8f('0x45')](_0x3b75a6[_0x1b8f('0x3c')],_0x235faa['filters']),_0x57bb26);if(_0x3b75a6[_0x1b8f('0x3c')][_0x1b8f('0x46')]){_0x13bc1e[_0x1b8f('0x44')]=_[_0x1b8f('0x47')](_0x13bc1e[_0x1b8f('0x44')],{'$or':_[_0x1b8f('0x36')](_0x57bb26,function(_0x4e9bae){if(_0x4e9bae['type']!==_0x1b8f('0x48')){var _0x1de2ec={};_0x1de2ec[_0x4e9bae['name']]={'$like':'%'+_0x3b75a6['query'][_0x1b8f('0x46')]+'%'};return _0x1de2ec;}})});}_0x13bc1e=_[_0x1b8f('0x47')]({},_0x13bc1e,_0x3b75a6[_0x1b8f('0x49')]);var _0x3da434={'where':_0x13bc1e[_0x1b8f('0x44')]};return db[_0x1b8f('0x37')]['count'](_0x3da434)['then'](function(_0x319a4b){_0x560024[_0x1b8f('0x25')]=_0x319a4b;if(_0x3b75a6[_0x1b8f('0x3c')]['includeAll']){_0x13bc1e[_0x1b8f('0x4a')]=[{'all':!![]}];}return db[_0x1b8f('0x37')][_0x1b8f('0x4b')](_0x13bc1e);})[_0x1b8f('0x2c')](function(_0xa8faf7){_0x560024['rows']=_0xa8faf7;return _0x560024;})[_0x1b8f('0x2c')](respondWithFilteredResult(_0xbda6e,_0x13bc1e))[_0x1b8f('0x4c')](handleError(_0xbda6e,null));};exports[_0x1b8f('0x4d')]=function(_0x169aa0,_0x1c3b61){var _0x2a1e00={'raw':![],'where':{'id':_0x169aa0['params']['id']}},_0x26919b={};_0x26919b['model']=_[_0x1b8f('0x3d')](db[_0x1b8f('0x37')][_0x1b8f('0x38')]);_0x26919b[_0x1b8f('0x3c')]=_[_0x1b8f('0x3d')](_0x169aa0[_0x1b8f('0x3c')]);_0x26919b[_0x1b8f('0x3e')]=_[_0x1b8f('0x40')](_0x26919b['model'],_0x26919b[_0x1b8f('0x3c')]);_0x2a1e00[_0x1b8f('0x3f')]=_[_0x1b8f('0x40')](_0x26919b['model'],qs[_0x1b8f('0x4e')](_0x169aa0[_0x1b8f('0x3c')][_0x1b8f('0x4e')]));_0x2a1e00['attributes']=_0x2a1e00[_0x1b8f('0x3f')][_0x1b8f('0x4f')]?_0x2a1e00[_0x1b8f('0x3f')]:_0x26919b[_0x1b8f('0x3b')];if(_0x169aa0[_0x1b8f('0x3c')][_0x1b8f('0x50')]){_0x2a1e00[_0x1b8f('0x4a')]=[{'all':!![]}];}_0x2a1e00=_[_0x1b8f('0x47')]({},_0x2a1e00,_0x169aa0[_0x1b8f('0x49')]);return db[_0x1b8f('0x37')][_0x1b8f('0x51')](_0x2a1e00)[_0x1b8f('0x2c')](handleEntityNotFound(_0x1c3b61,null))[_0x1b8f('0x2c')](respondWithResult(_0x1c3b61,null))[_0x1b8f('0x4c')](handleError(_0x1c3b61,null));};exports[_0x1b8f('0x52')]=function(_0xf07eb4,_0x2a6ae7){return db[_0x1b8f('0x37')][_0x1b8f('0x52')](_0xf07eb4[_0x1b8f('0x53')],{})['then'](function(_0x33e96a){var _0x2e6c26=_0xf07eb4[_0x1b8f('0x54')][_0x1b8f('0x2e')]({'plain':!![]});if(!_0x2e6c26)throw new Error(_0x1b8f('0x55'));if(_0x2e6c26['role']===_0x1b8f('0x54')){var _0x104943=_0x33e96a['get']({'plain':!![]});var _0x458b32='CustomDashboards';return db[_0x1b8f('0x56')][_0x1b8f('0x51')]({'where':{'name':_0x458b32,'userProfileId':_0x2e6c26[_0x1b8f('0x57')]},'raw':!![]})[_0x1b8f('0x2c')](function(_0x60869a){if(_0x60869a&&_0x60869a[_0x1b8f('0x58')]===0x0){return db[_0x1b8f('0x30')][_0x1b8f('0x52')]({'name':_0x104943[_0x1b8f('0x33')],'resourceId':_0x104943['id'],'type':_0x60869a[_0x1b8f('0x33')],'sectionId':_0x60869a['id']},{})[_0x1b8f('0x2c')](function(){return _0x33e96a;});}else{return _0x33e96a;}})[_0x1b8f('0x4c')](function(_0x229b7a){logger[_0x1b8f('0x31')](_0x1b8f('0x59'),_0x229b7a);throw _0x229b7a;});}return _0x33e96a;})['then'](respondWithResult(_0x2a6ae7,0xc9))[_0x1b8f('0x4c')](handleError(_0x2a6ae7,null));};exports['clone']=function(_0x4cc7b9,_0x382433){var _0x4aab9b={'where':{'id':_0x4cc7b9[_0x1b8f('0x5a')]['id']}},_0x387557={};_0x387557[_0x1b8f('0x3b')]=_[_0x1b8f('0x3d')](db[_0x1b8f('0x37')][_0x1b8f('0x38')]);_0x4aab9b[_0x1b8f('0x3f')]=_[_0x1b8f('0x40')](_0x387557[_0x1b8f('0x3b')],qs['fields'](_0x4cc7b9[_0x1b8f('0x3c')][_0x1b8f('0x4e')]));_0x4aab9b['attributes']=_0x4aab9b[_0x1b8f('0x3f')][_0x1b8f('0x4f')]?_0x4aab9b['attributes']:_0x387557['model'];if(_0x4cc7b9['query']['includeAll']){_0x4aab9b[_0x1b8f('0x4a')]=[{'all':!![]}];}_0x4aab9b=_[_0x1b8f('0x47')]({},_0x4aab9b,_0x4cc7b9['options']);return db[_0x1b8f('0x37')][_0x1b8f('0x51')](_0x4aab9b)[_0x1b8f('0x2c')](handleEntityNotFound(_0x382433,null))[_0x1b8f('0x2c')](function(_0x39229f){if(_0x39229f){var _0x14eadb=_0x39229f[_0x1b8f('0x2e')]({'plain':!![]});_0x14eadb=qs[_0x1b8f('0x5b')](_0x14eadb,['id',_0x1b8f('0x5c'),_0x1b8f('0x5d')]);_0x4cc7b9['body']=_[_0x1b8f('0x5b')](_0x4cc7b9[_0x1b8f('0x53')],['id',_0x1b8f('0x5c'),_0x1b8f('0x5d')]);return db[_0x1b8f('0x37')]['create'](_[_0x1b8f('0x47')](_0x14eadb,_0x4cc7b9['body']),{'include':_0x4cc7b9[_0x1b8f('0x3c')][_0x1b8f('0x50')]?[{'all':!![]}]:undefined})[_0x1b8f('0x2c')](function(_0x5c735c){var _0x40d1bf=_0x4cc7b9[_0x1b8f('0x54')][_0x1b8f('0x2e')]({'plain':!![]});if(!_0x40d1bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40d1bf[_0x1b8f('0x5e')]===_0x1b8f('0x54')){var _0x4fa801=_0x5c735c['get']({'plain':!![]});var _0x354e4d=_0x1b8f('0x2f');return db[_0x1b8f('0x56')][_0x1b8f('0x51')]({'where':{'name':_0x354e4d,'userProfileId':_0x40d1bf[_0x1b8f('0x57')]},'raw':!![]})[_0x1b8f('0x2c')](function(_0x139703){if(_0x139703&&_0x139703[_0x1b8f('0x58')]===0x0){return db['UserProfileResource'][_0x1b8f('0x52')]({'name':_0x4fa801[_0x1b8f('0x33')],'resourceId':_0x4fa801['id'],'type':_0x139703[_0x1b8f('0x33')],'sectionId':_0x139703['id']},{})['then'](function(){return _0x5c735c;});}else{return _0x5c735c;}})[_0x1b8f('0x4c')](function(_0x213b5b){logger['error'](_0x1b8f('0x59'),_0x213b5b);throw _0x213b5b;});}return _0x5c735c;});}})[_0x1b8f('0x2c')](respondWithResult(_0x382433,0xc9))[_0x1b8f('0x4c')](handleError(_0x382433,null));};exports['update']=function(_0x56b53b,_0x365283){if(_0x56b53b[_0x1b8f('0x53')]['id']){delete _0x56b53b[_0x1b8f('0x53')]['id'];}return db[_0x1b8f('0x37')][_0x1b8f('0x51')]({'where':{'id':_0x56b53b['params']['id']}})[_0x1b8f('0x2c')](handleEntityNotFound(_0x365283,null))['then'](saveUpdates(_0x56b53b[_0x1b8f('0x53')],null))[_0x1b8f('0x2c')](respondWithResult(_0x365283,null))[_0x1b8f('0x4c')](handleError(_0x365283,null));};exports[_0x1b8f('0x2d')]=function(_0x98ae1a,_0x1d0082){return db['Dashboard']['find']({'where':{'id':_0x98ae1a[_0x1b8f('0x5a')]['id']}})[_0x1b8f('0x2c')](handleEntityNotFound(_0x1d0082,null))[_0x1b8f('0x2c')](removeEntity(_0x1d0082,null))['catch'](handleError(_0x1d0082,null));};function widgetAttributes(_0x5334da){try{switch(_0x5334da[_0x1b8f('0x3a')]){case _0x1b8f('0x5f'):return[{'name':'attrUrl','value':_0x5334da[_0x1b8f('0x60')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0x0]?_0x5334da[_0x1b8f('0x61')][0x0][_0x1b8f('0x62')]:undefined)||_0x1b8f('0x63')}];case _0x1b8f('0x64'):return[{'name':_0x1b8f('0x65'),'value':_0x5334da[_0x1b8f('0x65')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x0]?_0x5334da[_0x1b8f('0x61')][0x0]['value']:undefined)||''}];case _0x1b8f('0x66'):return[{'name':_0x1b8f('0x67'),'value':_0x5334da[_0x1b8f('0x67')]||(_0x5334da['attrs']&&_0x5334da[_0x1b8f('0x61')][0x0]?_0x5334da[_0x1b8f('0x61')][0x0]['value']:undefined)||_0x1b8f('0x68')},{'name':_0x1b8f('0x69'),'value':_0x5334da['attrTimezone']||(_0x5334da['attrs']&&_0x5334da[_0x1b8f('0x61')][0x1]?_0x5334da[_0x1b8f('0x61')][0x1]['value']:undefined)||_0x1b8f('0x6a')},{'name':_0x1b8f('0x6b'),'value':_0x5334da[_0x1b8f('0x6b')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0x2]?_0x5334da['attrs'][0x2][_0x1b8f('0x62')]:undefined)||0xc}];case _0x1b8f('0x6c'):return[{'name':_0x1b8f('0x6d'),'value':_0x5334da[_0x1b8f('0x6d')]||(_0x5334da['attrs']&&_0x5334da[_0x1b8f('0x61')][0x0]?_0x5334da['attrs'][0x0][_0x1b8f('0x62')]:undefined)||_0x1b8f('0x6e')},{'name':_0x1b8f('0x6f'),'value':_0x5334da[_0x1b8f('0x6f')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x1]?_0x5334da['attrs'][0x1][_0x1b8f('0x62')]:undefined)||[]},{'name':_0x1b8f('0x6b'),'value':_0x5334da[_0x1b8f('0x6b')]||(_0x5334da['attrs']&&_0x5334da[_0x1b8f('0x61')][0x2]?_0x5334da[_0x1b8f('0x61')][0x2][_0x1b8f('0x62')]:undefined)||0x14},{'name':_0x1b8f('0x70'),'value':_0x5334da[_0x1b8f('0x70')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x3]?_0x5334da['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0x1b8f('0x71'),'value':_0x5334da[_0x1b8f('0x71')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0x4]?_0x5334da[_0x1b8f('0x61')][0x4]['value']:undefined)||''},{'name':_0x1b8f('0x72'),'value':_0x5334da[_0x1b8f('0x72')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0x5]?_0x5334da['attrs'][0x5][_0x1b8f('0x62')]:undefined)||''},{'name':_0x1b8f('0x73'),'value':_0x5334da[_0x1b8f('0x73')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x6]?_0x5334da[_0x1b8f('0x61')][0x6]['value']:undefined)||''},{'name':_0x1b8f('0x74'),'value':_0x5334da[_0x1b8f('0x74')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x7]?_0x5334da[_0x1b8f('0x61')][0x7]['value']:undefined)||''},{'name':_0x1b8f('0x75'),'value':_0x5334da['attrWhatsappAccounts']||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0x8]?_0x5334da[_0x1b8f('0x61')][0x8][_0x1b8f('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5334da[_0x1b8f('0x76')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x9]?_0x5334da[_0x1b8f('0x61')][0x9][_0x1b8f('0x62')]:undefined)||''}];case'multibar-chart':case _0x1b8f('0x77'):return[{'name':_0x1b8f('0x78'),'value':_0x5334da['attrSerie1']||(_0x5334da['attrs']&&_0x5334da['attrs'][0x0]?_0x5334da[_0x1b8f('0x61')][0x0][_0x1b8f('0x62')]:undefined)||_0x1b8f('0x6e')},{'name':_0x1b8f('0x79'),'value':_0x5334da[_0x1b8f('0x79')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x1]?_0x5334da[_0x1b8f('0x61')][0x1][_0x1b8f('0x62')]:undefined)||null},{'name':_0x1b8f('0x7a'),'value':_0x5334da[_0x1b8f('0x7a')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x2]?_0x5334da['attrs'][0x2][_0x1b8f('0x62')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5334da[_0x1b8f('0x6f')]||(_0x5334da['attrs']&&_0x5334da[_0x1b8f('0x61')][0x3]?_0x5334da[_0x1b8f('0x61')][0x3][_0x1b8f('0x62')]:undefined)||[]},{'name':_0x1b8f('0x70'),'value':_0x5334da['attrChannel']||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x4]?_0x5334da[_0x1b8f('0x61')][0x4][_0x1b8f('0x62')]:undefined)||_0x1b8f('0x7b')},{'name':_0x1b8f('0x71'),'value':_0x5334da[_0x1b8f('0x71')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x5]?_0x5334da[_0x1b8f('0x61')][0x5][_0x1b8f('0x62')]:undefined)||''},{'name':_0x1b8f('0x72'),'value':_0x5334da[_0x1b8f('0x72')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x6]?_0x5334da['attrs'][0x6][_0x1b8f('0x62')]:undefined)||''},{'name':_0x1b8f('0x73'),'value':_0x5334da[_0x1b8f('0x73')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x7]?_0x5334da[_0x1b8f('0x61')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5334da[_0x1b8f('0x74')]||(_0x5334da['attrs']&&_0x5334da[_0x1b8f('0x61')][0x8]?_0x5334da['attrs'][0x8]['value']:undefined)||''},{'name':_0x1b8f('0x75'),'value':_0x5334da[_0x1b8f('0x75')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0x9]?_0x5334da[_0x1b8f('0x61')][0x9][_0x1b8f('0x62')]:undefined)||''},{'name':_0x1b8f('0x76'),'value':_0x5334da[_0x1b8f('0x76')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da['attrs'][0xa]?_0x5334da['attrs'][0xa][_0x1b8f('0x62')]:undefined)||''}];case _0x1b8f('0x7c'):return[{'name':_0x1b8f('0x7d'),'type':_0x5334da[_0x1b8f('0x7e')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x0]?_0x5334da[_0x1b8f('0x61')][0x0][_0x1b8f('0x3a')]:undefined)||null,'value':_0x5334da['attrReport']||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x0]?_0x5334da[_0x1b8f('0x61')][0x0][_0x1b8f('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x5334da[_0x1b8f('0x7f')]||(_0x5334da[_0x1b8f('0x61')]&&_0x5334da[_0x1b8f('0x61')][0x1]?_0x5334da[_0x1b8f('0x61')][0x1][_0x1b8f('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x530666){logger['error'](_0x1b8f('0x80'),JSON[_0x1b8f('0x81')](_0x530666));return[];}}exports['addItem']=function(_0x1e7969,_0x3394db,_0x4c1279){if(_0x1e7969[_0x1b8f('0x53')]['id']){delete _0x1e7969[_0x1b8f('0x53')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x1e7969[_0x1b8f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3394db,null))['then'](function(_0xb9a93f){if(_0xb9a93f){_0x1e7969[_0x1b8f('0x53')][_0x1b8f('0x82')]=_0xb9a93f['id'];_0x1e7969[_0x1b8f('0x53')]['attrs']=widgetAttributes(_0x1e7969[_0x1b8f('0x53')]);return db[_0x1b8f('0x83')][_0x1b8f('0x52')](_0x1e7969[_0x1b8f('0x53')]);}})[_0x1b8f('0x2c')](respondWithResult(_0x3394db,null))[_0x1b8f('0x4c')](handleError(_0x3394db,null));};exports[_0x1b8f('0x84')]=function(_0x3a31b0,_0x3d79ea,_0x23b894){var _0x37599e={};var _0x1f2cb9={};var _0xd47702;var _0x2ec055;return db[_0x1b8f('0x37')][_0x1b8f('0x85')]({'where':{'id':_0x3a31b0[_0x1b8f('0x5a')]['id']}})[_0x1b8f('0x2c')](handleEntityNotFound(_0x3d79ea,null))[_0x1b8f('0x2c')](function(_0x328025){if(_0x328025){_0xd47702=_0x328025;_0x1f2cb9[_0x1b8f('0x3b')]=_[_0x1b8f('0x3d')](db[_0x1b8f('0x83')][_0x1b8f('0x38')]);_0x1f2cb9[_0x1b8f('0x3c')]=_[_0x1b8f('0x3d')](_0x3a31b0['query']);_0x1f2cb9[_0x1b8f('0x3e')]=_[_0x1b8f('0x40')](_0x1f2cb9['model'],_0x1f2cb9[_0x1b8f('0x3c')]);_0x37599e[_0x1b8f('0x3f')]=_[_0x1b8f('0x40')](_0x1f2cb9[_0x1b8f('0x3b')],qs[_0x1b8f('0x4e')](_0x3a31b0[_0x1b8f('0x3c')]['fields']));_0x37599e[_0x1b8f('0x3f')]=_0x37599e[_0x1b8f('0x3f')][_0x1b8f('0x4f')]?_0x37599e[_0x1b8f('0x3f')]:_0x1f2cb9[_0x1b8f('0x3b')];_0x37599e[_0x1b8f('0x42')]=qs[_0x1b8f('0x43')](_0x3a31b0[_0x1b8f('0x3c')][_0x1b8f('0x43')]);_0x37599e[_0x1b8f('0x44')]=qs[_0x1b8f('0x3e')](_[_0x1b8f('0x45')](_0x3a31b0[_0x1b8f('0x3c')],_0x1f2cb9[_0x1b8f('0x3e')]));if(_0x3a31b0[_0x1b8f('0x3c')][_0x1b8f('0x46')]){_0x37599e['where']=_[_0x1b8f('0x47')](_0x37599e[_0x1b8f('0x44')],{'$or':_['map'](_0x37599e[_0x1b8f('0x3f')],function(_0x5226c0){var _0x5385e9={};_0x5385e9[_0x5226c0]={'$like':'%'+_0x3a31b0['query'][_0x1b8f('0x46')]+'%'};return _0x5385e9;})});}_0x37599e=_[_0x1b8f('0x47')]({},_0x37599e,_0x3a31b0[_0x1b8f('0x49')]);return _0xd47702[_0x1b8f('0x84')](_0x37599e);}})[_0x1b8f('0x2c')](function(_0x3a6913){if(_0x3a6913){_0x2ec055=_0x3a6913[_0x1b8f('0x4f')];if(!_0x3a31b0['query'][_0x1b8f('0x41')](_0x1b8f('0x86'))){_0x37599e['limit']=qs[_0x1b8f('0x24')](_0x3a31b0[_0x1b8f('0x3c')]['limit']);_0x37599e[_0x1b8f('0x22')]=qs['offset'](_0x3a31b0['query'][_0x1b8f('0x22')]);}return _0xd47702[_0x1b8f('0x84')](_0x37599e);}})['then'](function(_0x2a77e3){if(_0x2a77e3){return _0x2a77e3?{'count':_0x2ec055,'rows':_0x2a77e3}:null;}})[_0x1b8f('0x2c')](respondWithResult(_0x3d79ea,null))[_0x1b8f('0x4c')](handleError(_0x3d79ea,null));};
\ No newline at end of file