Built motion from commit 449495f6.|2.6.27
[motion2.git] / server / api / dashboardItem / dashboardItem.controller.js
index b3fc557..99f7223 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81c6=['attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','DashboardItem','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','catch','type','iframe','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total'];(function(_0x48d07b,_0x281a58){var _0x541dbf=function(_0x57b602){while(--_0x57b602){_0x48d07b['push'](_0x48d07b['shift']());}};_0x541dbf(++_0x281a58);}(_0x81c6,0x1d5));var _0x681c=function(_0x1c6f8,_0x18af22){_0x1c6f8=_0x1c6f8-0x0;var _0xc47f94=_0x81c6[_0x1c6f8];return _0xc47f94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];config[_0x681c('0x13')]=_['defaults'](config[_0x681c('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0x14'))(new Redis(config['redis']));require(_0x681c('0x15'))[_0x681c('0x16')](socket);function respondWithStatusCode(_0xe8bb4d,_0x416723){_0x416723=_0x416723||0xcc;return function(_0x402aa2){if(_0x402aa2){return _0xe8bb4d[_0x681c('0x17')](_0x416723);}return _0xe8bb4d['status'](_0x416723)[_0x681c('0x18')]();};}function respondWithResult(_0x1135c9,_0x435a4c){_0x435a4c=_0x435a4c||0xc8;return function(_0x5eb8){if(_0x5eb8){return _0x1135c9[_0x681c('0x19')](_0x435a4c)[_0x681c('0x1a')](_0x5eb8);}};}function respondWithFilteredResult(_0x4e7df2,_0xf3c042){return function(_0x42f506){if(_0x42f506){var _0x4a9192=typeof _0xf3c042[_0x681c('0x1b')]==='undefined'&&typeof _0xf3c042[_0x681c('0x1c')]===_0x681c('0x1d');var _0x54d27f=_0x42f506[_0x681c('0x1e')];var _0x4c22c7=_0x4a9192?0x0:_0xf3c042[_0x681c('0x1b')];var _0x11836c=_0x4a9192?_0x42f506[_0x681c('0x1e')]:_0xf3c042[_0x681c('0x1b')]+_0xf3c042[_0x681c('0x1c')];var _0x51d626;if(_0x11836c>=_0x54d27f){_0x11836c=_0x54d27f;_0x51d626=0xc8;}else{_0x51d626=0xce;}_0x4e7df2['status'](_0x51d626);return _0x4e7df2['set'](_0x681c('0x1f'),_0x4c22c7+'-'+_0x11836c+'/'+_0x54d27f)[_0x681c('0x1a')](_0x42f506);}return null;};}function patchUpdates(_0x3adfe3){return function(_0x27b8a0){try{jsonpatch[_0x681c('0x20')](_0x27b8a0,_0x3adfe3,!![]);}catch(_0x29f3fa){return BPromise[_0x681c('0x21')](_0x29f3fa);}return _0x27b8a0[_0x681c('0x22')]();};}function saveUpdates(_0x1b3d2b,_0x397ae3){return function(_0x2be552){if(_0x2be552){return _0x2be552[_0x681c('0x23')](_0x1b3d2b)[_0x681c('0x24')](function(_0x218410){return _0x218410;});}return null;};}function removeEntity(_0x3237ed,_0x228f59){return function(_0x5f352f){if(_0x5f352f){return _0x5f352f[_0x681c('0x25')]()['then'](function(){_0x3237ed[_0x681c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x583499,_0x30c977){return function(_0x17ea7c){if(!_0x17ea7c){_0x583499[_0x681c('0x17')](0x194);}return _0x17ea7c;};}function handleError(_0x2f7772,_0x4c9fd0){_0x4c9fd0=_0x4c9fd0||0x1f4;return function(_0x3b1031){logger[_0x681c('0x26')](_0x3b1031[_0x681c('0x27')]);if(_0x3b1031[_0x681c('0x28')]){delete _0x3b1031[_0x681c('0x28')];}_0x2f7772[_0x681c('0x19')](_0x4c9fd0)[_0x681c('0x29')](_0x3b1031);};}exports['show']=function(_0x3727e6,_0x390be5){var _0x2e783d={'raw':![],'where':{'id':_0x3727e6[_0x681c('0x2a')]['id']}},_0x4af6aa={};_0x4af6aa[_0x681c('0x2b')]=_[_0x681c('0x2c')](db['DashboardItem'][_0x681c('0x2d')]);_0x4af6aa['query']=_['keys'](_0x3727e6[_0x681c('0x2e')]);_0x4af6aa[_0x681c('0x2f')]=_[_0x681c('0x30')](_0x4af6aa['model'],_0x4af6aa[_0x681c('0x2e')]);_0x2e783d['attributes']=_[_0x681c('0x30')](_0x4af6aa['model'],qs['fields'](_0x3727e6['query'][_0x681c('0x31')]));_0x2e783d[_0x681c('0x32')]=_0x2e783d['attributes'][_0x681c('0x33')]?_0x2e783d['attributes']:_0x4af6aa['model'];if(_0x3727e6[_0x681c('0x2e')]['includeAll']){_0x2e783d[_0x681c('0x34')]=[{'all':!![]}];}_0x2e783d=_[_0x681c('0x35')]({},_0x2e783d,_0x3727e6[_0x681c('0x36')]);return db['DashboardItem']['find'](_0x2e783d)[_0x681c('0x24')](handleEntityNotFound(_0x390be5,null))[_0x681c('0x24')](respondWithResult(_0x390be5,null))['catch'](handleError(_0x390be5,null));};exports[_0x681c('0x25')]=function(_0x3a2120,_0x302dab){return db['DashboardItem'][_0x681c('0x37')]({'where':{'id':_0x3a2120[_0x681c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x302dab,null))[_0x681c('0x24')](removeEntity(_0x302dab,null))[_0x681c('0x38')](handleError(_0x302dab,null));};function widgetAttributes(_0x83953c){try{switch(_0x83953c[_0x681c('0x39')]){case _0x681c('0x3a'):return[{'name':'attrUrl','value':_0x83953c['attrUrl']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c['attrs'][0x0][_0x681c('0x3c')]:undefined)||_0x681c('0x3d')}];case'custom':return[{'name':_0x681c('0x3e'),'value':_0x83953c[_0x681c('0x3e')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c[_0x681c('0x3b')][0x0][_0x681c('0x3c')]:undefined)||''}];case _0x681c('0x3f'):return[{'name':_0x681c('0x40'),'value':_0x83953c[_0x681c('0x40')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x0]?_0x83953c[_0x681c('0x3b')][0x0][_0x681c('0x3c')]:undefined)||_0x681c('0x41')},{'name':_0x681c('0x42'),'value':_0x83953c[_0x681c('0x42')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c[_0x681c('0x3b')][0x1][_0x681c('0x3c')]:undefined)||_0x681c('0x43')},{'name':_0x681c('0x44'),'value':_0x83953c[_0x681c('0x44')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x2]?_0x83953c['attrs'][0x2]['value']:undefined)||0xc}];case _0x681c('0x45'):return[{'name':_0x681c('0x46'),'value':_0x83953c[_0x681c('0x46')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x0]?_0x83953c[_0x681c('0x3b')][0x0]['value']:undefined)||'total'},{'name':_0x681c('0x47'),'value':_0x83953c[_0x681c('0x47')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c[_0x681c('0x3b')][0x1][_0x681c('0x3c')]:undefined)||[]},{'name':'attrFontSize','value':_0x83953c[_0x681c('0x44')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x2]?_0x83953c['attrs'][0x2][_0x681c('0x3c')]:undefined)||0x14},{'name':'attrChannel','value':_0x83953c[_0x681c('0x48')]||(_0x83953c['attrs']&&_0x83953c['attrs'][0x3]?_0x83953c['attrs'][0x3][_0x681c('0x3c')]:undefined)||_0x681c('0x49')},{'name':_0x681c('0x4a'),'value':_0x83953c['attrEmailAccounts']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x4]?_0x83953c['attrs'][0x4][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4b'),'value':_0x83953c[_0x681c('0x4b')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x5]?_0x83953c[_0x681c('0x3b')][0x5]['value']:undefined)||''},{'name':_0x681c('0x4c'),'value':_0x83953c[_0x681c('0x4c')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x6]?_0x83953c[_0x681c('0x3b')][0x6][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4d'),'value':_0x83953c[_0x681c('0x4d')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x7]?_0x83953c[_0x681c('0x3b')][0x7][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4e'),'value':_0x83953c[_0x681c('0x4e')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x8]?_0x83953c[_0x681c('0x3b')][0x8][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4f'),'value':_0x83953c['attrChatWebsites']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x9]?_0x83953c['attrs'][0x9][_0x681c('0x3c')]:undefined)||''}];case'multibar-chart':case _0x681c('0x50'):return[{'name':_0x681c('0x51'),'value':_0x83953c[_0x681c('0x51')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c[_0x681c('0x3b')][0x0]['value']:undefined)||_0x681c('0x52')},{'name':'attrSerie2','value':_0x83953c[_0x681c('0x53')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c[_0x681c('0x3b')][0x1]['value']:undefined)||null},{'name':_0x681c('0x54'),'value':_0x83953c['attrSerie3']||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x2]?_0x83953c[_0x681c('0x3b')][0x2][_0x681c('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x83953c[_0x681c('0x47')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x3]?_0x83953c['attrs'][0x3]['value']:undefined)||[]},{'name':_0x681c('0x48'),'value':_0x83953c[_0x681c('0x48')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x4]?_0x83953c['attrs'][0x4][_0x681c('0x3c')]:undefined)||_0x681c('0x49')},{'name':_0x681c('0x4a'),'value':_0x83953c[_0x681c('0x4a')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x5]?_0x83953c[_0x681c('0x3b')][0x5][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4b'),'value':_0x83953c[_0x681c('0x4b')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x6]?_0x83953c[_0x681c('0x3b')][0x6][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4c'),'value':_0x83953c[_0x681c('0x4c')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x7]?_0x83953c['attrs'][0x7][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4d'),'value':_0x83953c[_0x681c('0x4d')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x8]?_0x83953c['attrs'][0x8][_0x681c('0x3c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x83953c['attrWhatsappAccounts']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x9]?_0x83953c['attrs'][0x9][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4f'),'value':_0x83953c[_0x681c('0x4f')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0xa]?_0x83953c[_0x681c('0x3b')][0xa][_0x681c('0x3c')]:undefined)||''}];case _0x681c('0x55'):return[{'name':_0x681c('0x56'),'type':_0x83953c['reportType']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c[_0x681c('0x3b')][0x0]['type']:undefined)||null,'value':_0x83953c['attrReport']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c['attrs'][0x0][_0x681c('0x3c')]:undefined)||null},{'name':_0x681c('0x57'),'value':_0x83953c[_0x681c('0x57')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c['attrs'][0x1][_0x681c('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x27f4ca){logger[_0x681c('0x26')](_0x681c('0x58'),JSON['stringify'](_0x27f4ca));return[];}}exports[_0x681c('0x59')]=function(_0xf0232,_0x2b0623){if(_0xf0232[_0x681c('0x5a')]){_0xf0232[_0x681c('0x5a')]['attrs']=widgetAttributes(_0xf0232[_0x681c('0x5a')]);}return db[_0x681c('0x5b')]['create'](_0xf0232['body'],{})['then'](respondWithResult(_0x2b0623,0xc9))[_0x681c('0x38')](handleError(_0x2b0623,null));};exports['update']=function(_0x40763f,_0x26e13c){if(_0x40763f[_0x681c('0x5a')]['id']){delete _0x40763f[_0x681c('0x5a')]['id'];}_0x40763f[_0x681c('0x5a')]['attrs']=widgetAttributes(_0x40763f[_0x681c('0x5a')]);return db['DashboardItem']['find']({'where':{'id':_0x40763f[_0x681c('0x2a')]['id']}})[_0x681c('0x24')](handleEntityNotFound(_0x26e13c,null))[_0x681c('0x24')](saveUpdates(_0x40763f['body'],null))[_0x681c('0x24')](respondWithResult(_0x26e13c,null))[_0x681c('0x38')](handleError(_0x26e13c,null));};
\ No newline at end of file
+var _0x7f05=['attributes','fields','include','merge','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','reportType','attrReport','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','Content-Range','json','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x7f05,0xdc));var _0x57f0=function(_0x126906,_0xeecc9c){_0x126906=_0x126906-0x0;var _0x35a16e=_0x7f05[_0x126906];return _0x35a16e;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x57f0('0x13')],{'host':_0x57f0('0x14'),'port':0x18eb});var socket=require(_0x57f0('0x15'))(new Redis(config[_0x57f0('0x13')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x471f97,_0x380859){_0x380859=_0x380859||0xcc;return function(_0x22bb0d){if(_0x22bb0d){return _0x471f97[_0x57f0('0x16')](_0x380859);}return _0x471f97[_0x57f0('0x17')](_0x380859)[_0x57f0('0x18')]();};}function respondWithResult(_0x555e18,_0x51dac4){_0x51dac4=_0x51dac4||0xc8;return function(_0x40a925){if(_0x40a925){return _0x555e18['status'](_0x51dac4)['json'](_0x40a925);}};}function respondWithFilteredResult(_0x48eadd,_0x593fd7){return function(_0x20d0ba){if(_0x20d0ba){var _0x2a382e=typeof _0x593fd7[_0x57f0('0x19')]==='undefined'&&typeof _0x593fd7[_0x57f0('0x1a')]===_0x57f0('0x1b');var _0x3d0cf6=_0x20d0ba['count'];var _0x2e3d15=_0x2a382e?0x0:_0x593fd7[_0x57f0('0x19')];var _0x5ab625=_0x2a382e?_0x20d0ba['count']:_0x593fd7[_0x57f0('0x19')]+_0x593fd7[_0x57f0('0x1a')];var _0x599aa2;if(_0x5ab625>=_0x3d0cf6){_0x5ab625=_0x3d0cf6;_0x599aa2=0xc8;}else{_0x599aa2=0xce;}_0x48eadd[_0x57f0('0x17')](_0x599aa2);return _0x48eadd['set'](_0x57f0('0x1c'),_0x2e3d15+'-'+_0x5ab625+'/'+_0x3d0cf6)[_0x57f0('0x1d')](_0x20d0ba);}return null;};}function patchUpdates(_0x426a09){return function(_0x202dcb){try{jsonpatch['apply'](_0x202dcb,_0x426a09,!![]);}catch(_0x5d16a6){return BPromise[_0x57f0('0x1e')](_0x5d16a6);}return _0x202dcb['save']();};}function saveUpdates(_0x1279ae,_0x3a01ea){return function(_0x4156c4){if(_0x4156c4){return _0x4156c4[_0x57f0('0x1f')](_0x1279ae)[_0x57f0('0x20')](function(_0x1c2cae){return _0x1c2cae;});}return null;};}function removeEntity(_0x4de0f5,_0x941a03){return function(_0x5a079e){if(_0x5a079e){return _0x5a079e[_0x57f0('0x21')]()['then'](function(){_0x4de0f5['status'](0xcc)[_0x57f0('0x18')]();});}};}function handleEntityNotFound(_0x58a529,_0x407829){return function(_0x50347e){if(!_0x50347e){_0x58a529['sendStatus'](0x194);}return _0x50347e;};}function handleError(_0x23564f,_0x1fd10){_0x1fd10=_0x1fd10||0x1f4;return function(_0x16c711){logger[_0x57f0('0x22')](_0x16c711[_0x57f0('0x23')]);if(_0x16c711[_0x57f0('0x24')]){delete _0x16c711[_0x57f0('0x24')];}_0x23564f[_0x57f0('0x17')](_0x1fd10)[_0x57f0('0x25')](_0x16c711);};}exports[_0x57f0('0x26')]=function(_0x5c7095,_0x2c61af){var _0x390400={'raw':![],'where':{'id':_0x5c7095[_0x57f0('0x27')]['id']}},_0x316abe={};_0x316abe[_0x57f0('0x28')]=_[_0x57f0('0x29')](db[_0x57f0('0x2a')][_0x57f0('0x2b')]);_0x316abe[_0x57f0('0x2c')]=_[_0x57f0('0x29')](_0x5c7095[_0x57f0('0x2c')]);_0x316abe[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x316abe[_0x57f0('0x28')],_0x316abe['query']);_0x390400[_0x57f0('0x2f')]=_[_0x57f0('0x2e')](_0x316abe[_0x57f0('0x28')],qs[_0x57f0('0x30')](_0x5c7095['query']['fields']));_0x390400['attributes']=_0x390400[_0x57f0('0x2f')]['length']?_0x390400[_0x57f0('0x2f')]:_0x316abe[_0x57f0('0x28')];if(_0x5c7095[_0x57f0('0x2c')]['includeAll']){_0x390400[_0x57f0('0x31')]=[{'all':!![]}];}_0x390400=_[_0x57f0('0x32')]({},_0x390400,_0x5c7095[_0x57f0('0x33')]);return db[_0x57f0('0x2a')][_0x57f0('0x34')](_0x390400)[_0x57f0('0x20')](handleEntityNotFound(_0x2c61af,null))[_0x57f0('0x20')](respondWithResult(_0x2c61af,null))[_0x57f0('0x35')](handleError(_0x2c61af,null));};exports[_0x57f0('0x21')]=function(_0x28d237,_0xb5b61f){return db[_0x57f0('0x2a')][_0x57f0('0x34')]({'where':{'id':_0x28d237[_0x57f0('0x27')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0xb5b61f,null))[_0x57f0('0x20')](removeEntity(_0xb5b61f,null))[_0x57f0('0x35')](handleError(_0xb5b61f,null));};function widgetAttributes(_0x3ec2ad){try{switch(_0x3ec2ad[_0x57f0('0x36')]){case'iframe':return[{'name':'attrUrl','value':_0x3ec2ad[_0x57f0('0x37')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x0]?_0x3ec2ad['attrs'][0x0][_0x57f0('0x39')]:undefined)||_0x57f0('0x3a')}];case _0x57f0('0x3b'):return[{'name':_0x57f0('0x3c'),'value':_0x3ec2ad[_0x57f0('0x3c')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x0]?_0x3ec2ad[_0x57f0('0x38')][0x0][_0x57f0('0x39')]:undefined)||''}];case'clock':return[{'name':_0x57f0('0x3d'),'value':_0x3ec2ad[_0x57f0('0x3d')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x0]?_0x3ec2ad['attrs'][0x0][_0x57f0('0x39')]:undefined)||_0x57f0('0x3e')},{'name':'attrTimezone','value':_0x3ec2ad[_0x57f0('0x3f')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x1]?_0x3ec2ad[_0x57f0('0x38')][0x1][_0x57f0('0x39')]:undefined)||_0x57f0('0x40')},{'name':_0x57f0('0x41'),'value':_0x3ec2ad['attrFontSize']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x2]?_0x3ec2ad[_0x57f0('0x38')][0x2]['value']:undefined)||0xc}];case _0x57f0('0x42'):return[{'name':_0x57f0('0x43'),'value':_0x3ec2ad[_0x57f0('0x43')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x0]?_0x3ec2ad[_0x57f0('0x38')][0x0][_0x57f0('0x39')]:undefined)||_0x57f0('0x44')},{'name':_0x57f0('0x45'),'value':_0x3ec2ad[_0x57f0('0x45')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x1]?_0x3ec2ad[_0x57f0('0x38')][0x1][_0x57f0('0x39')]:undefined)||[]},{'name':'attrFontSize','value':_0x3ec2ad['attrFontSize']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x2]?_0x3ec2ad[_0x57f0('0x38')][0x2][_0x57f0('0x39')]:undefined)||0x14},{'name':_0x57f0('0x46'),'value':_0x3ec2ad['attrChannel']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x3]?_0x3ec2ad['attrs'][0x3][_0x57f0('0x39')]:undefined)||_0x57f0('0x47')},{'name':_0x57f0('0x48'),'value':_0x3ec2ad[_0x57f0('0x48')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x4]?_0x3ec2ad['attrs'][0x4][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x49'),'value':_0x3ec2ad['attrFaxAccounts']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x5]?_0x3ec2ad[_0x57f0('0x38')][0x5]['value']:undefined)||''},{'name':_0x57f0('0x4a'),'value':_0x3ec2ad['attrSmsAccounts']||(_0x3ec2ad['attrs']&&_0x3ec2ad[_0x57f0('0x38')][0x6]?_0x3ec2ad[_0x57f0('0x38')][0x6][_0x57f0('0x39')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3ec2ad[_0x57f0('0x4b')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x7]?_0x3ec2ad[_0x57f0('0x38')][0x7][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x4c'),'value':_0x3ec2ad[_0x57f0('0x4c')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x8]?_0x3ec2ad['attrs'][0x8][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x4d'),'value':_0x3ec2ad['attrChatWebsites']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x9]?_0x3ec2ad['attrs'][0x9]['value']:undefined)||''}];case _0x57f0('0x4e'):case _0x57f0('0x4f'):return[{'name':'attrSerie1','value':_0x3ec2ad['attrSerie1']||(_0x3ec2ad['attrs']&&_0x3ec2ad[_0x57f0('0x38')][0x0]?_0x3ec2ad[_0x57f0('0x38')][0x0]['value']:undefined)||_0x57f0('0x44')},{'name':'attrSerie2','value':_0x3ec2ad[_0x57f0('0x50')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x1]?_0x3ec2ad[_0x57f0('0x38')][0x1][_0x57f0('0x39')]:undefined)||null},{'name':'attrSerie3','value':_0x3ec2ad[_0x57f0('0x51')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x2]?_0x3ec2ad[_0x57f0('0x38')][0x2][_0x57f0('0x39')]:undefined)||null},{'name':_0x57f0('0x45'),'value':_0x3ec2ad['attrVoiceQueues']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x3]?_0x3ec2ad[_0x57f0('0x38')][0x3]['value']:undefined)||[]},{'name':_0x57f0('0x46'),'value':_0x3ec2ad[_0x57f0('0x46')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x4]?_0x3ec2ad[_0x57f0('0x38')][0x4][_0x57f0('0x39')]:undefined)||_0x57f0('0x47')},{'name':_0x57f0('0x48'),'value':_0x3ec2ad[_0x57f0('0x48')]||(_0x3ec2ad['attrs']&&_0x3ec2ad[_0x57f0('0x38')][0x5]?_0x3ec2ad[_0x57f0('0x38')][0x5][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x49'),'value':_0x3ec2ad[_0x57f0('0x49')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x6]?_0x3ec2ad[_0x57f0('0x38')][0x6][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x4a'),'value':_0x3ec2ad['attrSmsAccounts']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x7]?_0x3ec2ad[_0x57f0('0x38')][0x7][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x4b'),'value':_0x3ec2ad[_0x57f0('0x4b')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x8]?_0x3ec2ad[_0x57f0('0x38')][0x8][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x4c'),'value':_0x3ec2ad[_0x57f0('0x4c')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x9]?_0x3ec2ad[_0x57f0('0x38')][0x9][_0x57f0('0x39')]:undefined)||''},{'name':_0x57f0('0x4d'),'value':_0x3ec2ad[_0x57f0('0x4d')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0xa]?_0x3ec2ad['attrs'][0xa][_0x57f0('0x39')]:undefined)||''}];case _0x57f0('0x52'):return[{'name':'attrReport','type':_0x3ec2ad[_0x57f0('0x53')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x0]?_0x3ec2ad['attrs'][0x0][_0x57f0('0x36')]:undefined)||null,'value':_0x3ec2ad[_0x57f0('0x54')]||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad['attrs'][0x0]?_0x3ec2ad[_0x57f0('0x38')][0x0][_0x57f0('0x39')]:undefined)||null},{'name':'attrRefresh','value':_0x3ec2ad['attrRefresh']||(_0x3ec2ad[_0x57f0('0x38')]&&_0x3ec2ad[_0x57f0('0x38')][0x1]?_0x3ec2ad['attrs'][0x1][_0x57f0('0x39')]:undefined)||0x0}];default:return[];}}catch(_0x240c5a){logger[_0x57f0('0x22')](_0x57f0('0x55'),JSON[_0x57f0('0x56')](_0x240c5a));return[];}}exports[_0x57f0('0x57')]=function(_0x33dbd2,_0x36aa4d){if(_0x33dbd2[_0x57f0('0x58')]){_0x33dbd2[_0x57f0('0x58')]['attrs']=widgetAttributes(_0x33dbd2['body']);}return db['DashboardItem'][_0x57f0('0x57')](_0x33dbd2['body'],{})['then'](respondWithResult(_0x36aa4d,0xc9))[_0x57f0('0x35')](handleError(_0x36aa4d,null));};exports[_0x57f0('0x1f')]=function(_0x36e1f4,_0x5b6750){if(_0x36e1f4['body']['id']){delete _0x36e1f4[_0x57f0('0x58')]['id'];}_0x36e1f4['body'][_0x57f0('0x38')]=widgetAttributes(_0x36e1f4[_0x57f0('0x58')]);return db[_0x57f0('0x2a')][_0x57f0('0x34')]({'where':{'id':_0x36e1f4['params']['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x5b6750,null))['then'](saveUpdates(_0x36e1f4[_0x57f0('0x58')],null))[_0x57f0('0x20')](respondWithResult(_0x5b6750,null))[_0x57f0('0x35')](handleError(_0x5b6750,null));};
\ No newline at end of file