Built motion from commit 0555bc41.|2.5.41
[motion2.git] / server / api / dashboardItem / dashboardItem.controller.js
index d7d29e8..ffe9ee3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc59=['stringify','body','create','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','undefined','limit','status','Content-Range','apply','reject','update','destroy','error','stack','name','show','keys','DashboardItem','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','then','catch','params','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s'];(function(_0xba8150,_0x158320){var _0x4645c9=function(_0x14812c){while(--_0x14812c){_0xba8150['push'](_0xba8150['shift']());}};_0x4645c9(++_0x158320);}(_0xdc59,0x12c));var _0x9dc5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdc59[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x9dc5('0x0'));var rimraf=require(_0x9dc5('0x1'));var zipdir=require(_0x9dc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dc5('0x3'));var BPromise=require(_0x9dc5('0x4'));var Mustache=require(_0x9dc5('0x5'));var util=require(_0x9dc5('0x6'));var path=require(_0x9dc5('0x7'));var sox=require(_0x9dc5('0x8'));var csv=require(_0x9dc5('0x9'));var ejs=require(_0x9dc5('0xa'));var fs=require('fs');var fs_extra=require(_0x9dc5('0xb'));var _=require('lodash');var squel=require(_0x9dc5('0xc'));var crypto=require(_0x9dc5('0xd'));var jsforce=require(_0x9dc5('0xe'));var deskjs=require(_0x9dc5('0xf'));var toCsv=require(_0x9dc5('0x9'));var querystring=require(_0x9dc5('0x10'));var Papa=require(_0x9dc5('0x11'));var Redis=require(_0x9dc5('0x12'));var authService=require(_0x9dc5('0x13'));var qs=require(_0x9dc5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dc5('0x15'));var logger=require(_0x9dc5('0x16'))(_0x9dc5('0x17'));var utils=require(_0x9dc5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9dc5('0x19'));var db=require(_0x9dc5('0x1a'))['db'];config[_0x9dc5('0x1b')]=_['defaults'](config[_0x9dc5('0x1b')],{'host':_0x9dc5('0x1c'),'port':0x18eb});var socket=require(_0x9dc5('0x1d'))(new Redis(config[_0x9dc5('0x1b')]));require(_0x9dc5('0x1e'))[_0x9dc5('0x1f')](socket);function respondWithStatusCode(_0x786239,_0x1abc3f){_0x1abc3f=_0x1abc3f||0xcc;return function(_0x755ef){if(_0x755ef){return _0x786239[_0x9dc5('0x20')](_0x1abc3f);}return _0x786239['status'](_0x1abc3f)[_0x9dc5('0x21')]();};}function respondWithResult(_0x5ebe8b,_0x76737f){_0x76737f=_0x76737f||0xc8;return function(_0x9c1b35){if(_0x9c1b35){return _0x5ebe8b['status'](_0x76737f)[_0x9dc5('0x22')](_0x9c1b35);}};}function respondWithFilteredResult(_0x2f195a,_0x17e8d1){return function(_0x16fca8){if(_0x16fca8){var _0x4e1529=typeof _0x17e8d1[_0x9dc5('0x23')]===_0x9dc5('0x24')&&typeof _0x17e8d1[_0x9dc5('0x25')]===_0x9dc5('0x24');var _0x4100e7=_0x16fca8['count'];var _0x6355d2=_0x4e1529?0x0:_0x17e8d1[_0x9dc5('0x23')];var _0x8e7b1c=_0x4e1529?_0x16fca8['count']:_0x17e8d1['offset']+_0x17e8d1[_0x9dc5('0x25')];var _0x5e2da8;if(_0x8e7b1c>=_0x4100e7){_0x8e7b1c=_0x4100e7;_0x5e2da8=0xc8;}else{_0x5e2da8=0xce;}_0x2f195a[_0x9dc5('0x26')](_0x5e2da8);return _0x2f195a['set'](_0x9dc5('0x27'),_0x6355d2+'-'+_0x8e7b1c+'/'+_0x4100e7)['json'](_0x16fca8);}return null;};}function patchUpdates(_0x100ae7){return function(_0x4c885f){try{jsonpatch[_0x9dc5('0x28')](_0x4c885f,_0x100ae7,!![]);}catch(_0x1c3726){return BPromise[_0x9dc5('0x29')](_0x1c3726);}return _0x4c885f['save']();};}function saveUpdates(_0x184d78,_0x319d42){return function(_0xa55ce){if(_0xa55ce){return _0xa55ce[_0x9dc5('0x2a')](_0x184d78)['then'](function(_0x4ba5d2){return _0x4ba5d2;});}return null;};}function removeEntity(_0xdeab68,_0xf6da02){return function(_0x4570ed){if(_0x4570ed){return _0x4570ed[_0x9dc5('0x2b')]()['then'](function(){_0xdeab68['status'](0xcc)[_0x9dc5('0x21')]();});}};}function handleEntityNotFound(_0x427cc3,_0x483778){return function(_0xd1b613){if(!_0xd1b613){_0x427cc3[_0x9dc5('0x20')](0x194);}return _0xd1b613;};}function handleError(_0x3ddade,_0x5742e8){_0x5742e8=_0x5742e8||0x1f4;return function(_0x4777f0){logger[_0x9dc5('0x2c')](_0x4777f0[_0x9dc5('0x2d')]);if(_0x4777f0[_0x9dc5('0x2e')]){delete _0x4777f0[_0x9dc5('0x2e')];}_0x3ddade[_0x9dc5('0x26')](_0x5742e8)['send'](_0x4777f0);};}exports[_0x9dc5('0x2f')]=function(_0x25e8e9,_0x21b243){var _0x19b9b5={'raw':![],'where':{'id':_0x25e8e9['params']['id']}},_0x420158={};_0x420158['model']=_[_0x9dc5('0x30')](db[_0x9dc5('0x31')]['rawAttributes']);_0x420158[_0x9dc5('0x32')]=_[_0x9dc5('0x30')](_0x25e8e9[_0x9dc5('0x32')]);_0x420158[_0x9dc5('0x33')]=_[_0x9dc5('0x34')](_0x420158[_0x9dc5('0x35')],_0x420158[_0x9dc5('0x32')]);_0x19b9b5[_0x9dc5('0x36')]=_[_0x9dc5('0x34')](_0x420158['model'],qs[_0x9dc5('0x37')](_0x25e8e9[_0x9dc5('0x32')][_0x9dc5('0x37')]));_0x19b9b5[_0x9dc5('0x36')]=_0x19b9b5[_0x9dc5('0x36')][_0x9dc5('0x38')]?_0x19b9b5['attributes']:_0x420158[_0x9dc5('0x35')];if(_0x25e8e9['query'][_0x9dc5('0x39')]){_0x19b9b5['include']=[{'all':!![]}];}_0x19b9b5=_[_0x9dc5('0x3a')]({},_0x19b9b5,_0x25e8e9[_0x9dc5('0x3b')]);return db[_0x9dc5('0x31')][_0x9dc5('0x3c')](_0x19b9b5)[_0x9dc5('0x3d')](handleEntityNotFound(_0x21b243,null))[_0x9dc5('0x3d')](respondWithResult(_0x21b243,null))[_0x9dc5('0x3e')](handleError(_0x21b243,null));};exports[_0x9dc5('0x2b')]=function(_0x1c23fd,_0x216622){return db[_0x9dc5('0x31')]['find']({'where':{'id':_0x1c23fd[_0x9dc5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x216622,null))[_0x9dc5('0x3d')](removeEntity(_0x216622,null))[_0x9dc5('0x3e')](handleError(_0x216622,null));};function widgetAttributes(_0x2fb7ea){try{switch(_0x2fb7ea['type']){case _0x9dc5('0x40'):return[{'name':_0x9dc5('0x41'),'value':_0x2fb7ea[_0x9dc5('0x41')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x44')}];case'custom':return[{'name':_0x9dc5('0x45'),'value':_0x2fb7ea[_0x9dc5('0x45')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea['attrs'][0x0][_0x9dc5('0x43')]:undefined)||''}];case'clock':return[{'name':_0x9dc5('0x46'),'value':_0x2fb7ea[_0x9dc5('0x46')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x9dc5('0x47'),'value':_0x2fb7ea[_0x9dc5('0x47')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x1]?_0x2fb7ea['attrs'][0x1][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x48')},{'name':_0x9dc5('0x49'),'value':_0x2fb7ea[_0x9dc5('0x49')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea['attrs'][0x2]?_0x2fb7ea['attrs'][0x2][_0x9dc5('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x9dc5('0x4a'),'value':_0x2fb7ea[_0x9dc5('0x4a')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x4b')},{'name':_0x9dc5('0x4c'),'value':_0x2fb7ea[_0x9dc5('0x4c')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x1]?_0x2fb7ea[_0x9dc5('0x42')][0x1]['value']:undefined)||[]},{'name':_0x9dc5('0x49'),'value':_0x2fb7ea[_0x9dc5('0x49')]||(_0x2fb7ea['attrs']&&_0x2fb7ea['attrs'][0x2]?_0x2fb7ea[_0x9dc5('0x42')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x2fb7ea[_0x9dc5('0x4d')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x3]?_0x2fb7ea[_0x9dc5('0x42')][0x3]['value']:undefined)||_0x9dc5('0x4e')},{'name':'attrEmailAccounts','value':_0x2fb7ea[_0x9dc5('0x4f')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x4]?_0x2fb7ea['attrs'][0x4]['value']:undefined)||''},{'name':_0x9dc5('0x50'),'value':_0x2fb7ea[_0x9dc5('0x50')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x5]?_0x2fb7ea['attrs'][0x5][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x51'),'value':_0x2fb7ea['attrSmsAccounts']||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x6]?_0x2fb7ea[_0x9dc5('0x42')][0x6][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x52'),'value':_0x2fb7ea[_0x9dc5('0x52')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea['attrs'][0x7]?_0x2fb7ea[_0x9dc5('0x42')][0x7][_0x9dc5('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2fb7ea[_0x9dc5('0x53')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x8]?_0x2fb7ea[_0x9dc5('0x42')][0x8]['value']:undefined)||''},{'name':_0x9dc5('0x54'),'value':_0x2fb7ea[_0x9dc5('0x54')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x9]?_0x2fb7ea[_0x9dc5('0x42')][0x9][_0x9dc5('0x43')]:undefined)||''}];case _0x9dc5('0x55'):case _0x9dc5('0x56'):return[{'name':_0x9dc5('0x57'),'value':_0x2fb7ea['attrSerie1']||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea['attrs'][0x0][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x4b')},{'name':_0x9dc5('0x58'),'value':_0x2fb7ea[_0x9dc5('0x58')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x1]?_0x2fb7ea[_0x9dc5('0x42')][0x1][_0x9dc5('0x43')]:undefined)||null},{'name':_0x9dc5('0x59'),'value':_0x2fb7ea[_0x9dc5('0x59')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea['attrs'][0x2]?_0x2fb7ea[_0x9dc5('0x42')][0x2]['value']:undefined)||null},{'name':_0x9dc5('0x4c'),'value':_0x2fb7ea[_0x9dc5('0x4c')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x3]?_0x2fb7ea[_0x9dc5('0x42')][0x3][_0x9dc5('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x2fb7ea[_0x9dc5('0x4d')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x4]?_0x2fb7ea[_0x9dc5('0x42')][0x4][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x4e')},{'name':_0x9dc5('0x4f'),'value':_0x2fb7ea[_0x9dc5('0x4f')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x5]?_0x2fb7ea[_0x9dc5('0x42')][0x5][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x50'),'value':_0x2fb7ea[_0x9dc5('0x50')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x6]?_0x2fb7ea[_0x9dc5('0x42')][0x6][_0x9dc5('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2fb7ea['attrSmsAccounts']||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x7]?_0x2fb7ea[_0x9dc5('0x42')][0x7][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x52'),'value':_0x2fb7ea[_0x9dc5('0x52')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x8]?_0x2fb7ea[_0x9dc5('0x42')][0x8][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x53'),'value':_0x2fb7ea[_0x9dc5('0x53')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x9]?_0x2fb7ea[_0x9dc5('0x42')][0x9][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x54'),'value':_0x2fb7ea[_0x9dc5('0x54')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0xa]?_0x2fb7ea[_0x9dc5('0x42')][0xa][_0x9dc5('0x43')]:undefined)||''}];case _0x9dc5('0x5a'):return[{'name':_0x9dc5('0x5b'),'type':_0x2fb7ea[_0x9dc5('0x5c')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x5d')]:undefined)||null,'value':_0x2fb7ea[_0x9dc5('0x5b')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x43')]:undefined)||null},{'name':_0x9dc5('0x5e'),'value':_0x2fb7ea['attrRefresh']||(_0x2fb7ea['attrs']&&_0x2fb7ea['attrs'][0x1]?_0x2fb7ea['attrs'][0x1][_0x9dc5('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x9ec9e6){logger[_0x9dc5('0x2c')](_0x9dc5('0x5f'),JSON[_0x9dc5('0x60')](_0x9ec9e6));return[];}}exports['create']=function(_0x379fe6,_0x141c26){if(_0x379fe6[_0x9dc5('0x61')]){_0x379fe6[_0x9dc5('0x61')]['attrs']=widgetAttributes(_0x379fe6['body']);}return db['DashboardItem'][_0x9dc5('0x62')](_0x379fe6['body'],{})['then'](respondWithResult(_0x141c26,0xc9))[_0x9dc5('0x3e')](handleError(_0x141c26,null));};exports[_0x9dc5('0x2a')]=function(_0x36b51,_0x414e7d){if(_0x36b51[_0x9dc5('0x61')]['id']){delete _0x36b51[_0x9dc5('0x61')]['id'];}_0x36b51['body'][_0x9dc5('0x42')]=widgetAttributes(_0x36b51['body']);return db[_0x9dc5('0x31')][_0x9dc5('0x3c')]({'where':{'id':_0x36b51['params']['id']}})[_0x9dc5('0x3d')](handleEntityNotFound(_0x414e7d,null))[_0x9dc5('0x3d')](saveUpdates(_0x36b51[_0x9dc5('0x61')],null))[_0x9dc5('0x3d')](respondWithResult(_0x414e7d,null))['catch'](handleError(_0x414e7d,null));};
\ No newline at end of file
+var _0xcaf2=['type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','show','model','keys','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','DashboardItem','find','catch','params'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xcaf2,0x8a));var _0x2caf=function(_0x425c5b,_0x5a23a5){_0x425c5b=_0x425c5b-0x0;var _0x3ec47a=_0xcaf2[_0x425c5b];return _0x3ec47a;};'use strict';var emlformat=require(_0x2caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2caf('0x1'));var jsonpatch=require(_0x2caf('0x2'));var rp=require('request-promise');var moment=require(_0x2caf('0x3'));var BPromise=require(_0x2caf('0x4'));var Mustache=require('mustache');var util=require(_0x2caf('0x5'));var path=require('path');var sox=require(_0x2caf('0x6'));var csv=require(_0x2caf('0x7'));var ejs=require(_0x2caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x7'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var licenseUtil=require(_0x2caf('0x17'));var db=require(_0x2caf('0x18'))['db'];config[_0x2caf('0x19')]=_[_0x2caf('0x1a')](config[_0x2caf('0x19')],{'host':_0x2caf('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x19')]));require(_0x2caf('0x1c'))['register'](socket);function respondWithStatusCode(_0x4c47b8,_0x5f1e93){_0x5f1e93=_0x5f1e93||0xcc;return function(_0x27bca8){if(_0x27bca8){return _0x4c47b8['sendStatus'](_0x5f1e93);}return _0x4c47b8[_0x2caf('0x1d')](_0x5f1e93)[_0x2caf('0x1e')]();};}function respondWithResult(_0x3b8b67,_0x32ff41){_0x32ff41=_0x32ff41||0xc8;return function(_0x486b8d){if(_0x486b8d){return _0x3b8b67[_0x2caf('0x1d')](_0x32ff41)['json'](_0x486b8d);}};}function respondWithFilteredResult(_0x2d5b64,_0x57f3cd){return function(_0x4a33fc){if(_0x4a33fc){var _0x3e975f=typeof _0x57f3cd['offset']===_0x2caf('0x1f')&&typeof _0x57f3cd[_0x2caf('0x20')]==='undefined';var _0x12624b=_0x4a33fc[_0x2caf('0x21')];var _0x6b3778=_0x3e975f?0x0:_0x57f3cd[_0x2caf('0x22')];var _0x20f7d3=_0x3e975f?_0x4a33fc['count']:_0x57f3cd[_0x2caf('0x22')]+_0x57f3cd[_0x2caf('0x20')];var _0x2b4d16;if(_0x20f7d3>=_0x12624b){_0x20f7d3=_0x12624b;_0x2b4d16=0xc8;}else{_0x2b4d16=0xce;}_0x2d5b64[_0x2caf('0x1d')](_0x2b4d16);return _0x2d5b64[_0x2caf('0x23')](_0x2caf('0x24'),_0x6b3778+'-'+_0x20f7d3+'/'+_0x12624b)[_0x2caf('0x25')](_0x4a33fc);}return null;};}function patchUpdates(_0x256cc4){return function(_0x3332b1){try{jsonpatch[_0x2caf('0x26')](_0x3332b1,_0x256cc4,!![]);}catch(_0x6814bc){return BPromise['reject'](_0x6814bc);}return _0x3332b1[_0x2caf('0x27')]();};}function saveUpdates(_0x14bfd2,_0x1f29b0){return function(_0x401ea2){if(_0x401ea2){return _0x401ea2[_0x2caf('0x28')](_0x14bfd2)[_0x2caf('0x29')](function(_0x392196){return _0x392196;});}return null;};}function removeEntity(_0x164da,_0x2e0a75){return function(_0x31f059){if(_0x31f059){return _0x31f059['destroy']()[_0x2caf('0x29')](function(){_0x164da[_0x2caf('0x1d')](0xcc)[_0x2caf('0x1e')]();});}};}function handleEntityNotFound(_0x37b08f,_0x3c60d1){return function(_0x17d3c6){if(!_0x17d3c6){_0x37b08f[_0x2caf('0x2a')](0x194);}return _0x17d3c6;};}function handleError(_0x135977,_0x23f765){_0x23f765=_0x23f765||0x1f4;return function(_0x2304f1){logger[_0x2caf('0x2b')](_0x2304f1[_0x2caf('0x2c')]);if(_0x2304f1[_0x2caf('0x2d')]){delete _0x2304f1['name'];}_0x135977[_0x2caf('0x1d')](_0x23f765)[_0x2caf('0x2e')](_0x2304f1);};}exports[_0x2caf('0x2f')]=function(_0x25bbfc,_0xa8523b){var _0x1f52bf={'raw':![],'where':{'id':_0x25bbfc['params']['id']}},_0x3812cd={};_0x3812cd[_0x2caf('0x30')]=_[_0x2caf('0x31')](db['DashboardItem'][_0x2caf('0x32')]);_0x3812cd[_0x2caf('0x33')]=_[_0x2caf('0x31')](_0x25bbfc['query']);_0x3812cd[_0x2caf('0x34')]=_['intersection'](_0x3812cd['model'],_0x3812cd[_0x2caf('0x33')]);_0x1f52bf[_0x2caf('0x35')]=_[_0x2caf('0x36')](_0x3812cd[_0x2caf('0x30')],qs[_0x2caf('0x37')](_0x25bbfc[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1f52bf[_0x2caf('0x35')]=_0x1f52bf[_0x2caf('0x35')]['length']?_0x1f52bf[_0x2caf('0x35')]:_0x3812cd[_0x2caf('0x30')];if(_0x25bbfc[_0x2caf('0x33')][_0x2caf('0x38')]){_0x1f52bf[_0x2caf('0x39')]=[{'all':!![]}];}_0x1f52bf=_[_0x2caf('0x3a')]({},_0x1f52bf,_0x25bbfc[_0x2caf('0x3b')]);return db[_0x2caf('0x3c')][_0x2caf('0x3d')](_0x1f52bf)[_0x2caf('0x29')](handleEntityNotFound(_0xa8523b,null))[_0x2caf('0x29')](respondWithResult(_0xa8523b,null))[_0x2caf('0x3e')](handleError(_0xa8523b,null));};exports['destroy']=function(_0x5b3a78,_0x410020){return db[_0x2caf('0x3c')][_0x2caf('0x3d')]({'where':{'id':_0x5b3a78[_0x2caf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x410020,null))[_0x2caf('0x29')](removeEntity(_0x410020,null))[_0x2caf('0x3e')](handleError(_0x410020,null));};function widgetAttributes(_0x4568f9){try{switch(_0x4568f9[_0x2caf('0x40')]){case _0x2caf('0x41'):return[{'name':_0x2caf('0x42'),'value':_0x4568f9[_0x2caf('0x42')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x0]?_0x4568f9['attrs'][0x0][_0x2caf('0x44')]:undefined)||_0x2caf('0x45')}];case _0x2caf('0x46'):return[{'name':_0x2caf('0x47'),'value':_0x4568f9[_0x2caf('0x47')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0][_0x2caf('0x44')]:undefined)||''}];case _0x2caf('0x48'):return[{'name':_0x2caf('0x49'),'value':_0x4568f9['attrHourFormat']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0]['value']:undefined)||_0x2caf('0x4a')},{'name':_0x2caf('0x4b'),'value':_0x4568f9[_0x2caf('0x4b')]||(_0x4568f9['attrs']&&_0x4568f9[_0x2caf('0x43')][0x1]?_0x4568f9[_0x2caf('0x43')][0x1]['value']:undefined)||_0x2caf('0x4c')},{'name':_0x2caf('0x4d'),'value':_0x4568f9['attrFontSize']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x2]?_0x4568f9[_0x2caf('0x43')][0x2][_0x2caf('0x44')]:undefined)||0xc}];case _0x2caf('0x4e'):return[{'name':_0x2caf('0x4f'),'value':_0x4568f9[_0x2caf('0x4f')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x0]?_0x4568f9[_0x2caf('0x43')][0x0]['value']:undefined)||_0x2caf('0x50')},{'name':_0x2caf('0x51'),'value':_0x4568f9[_0x2caf('0x51')]||(_0x4568f9['attrs']&&_0x4568f9['attrs'][0x1]?_0x4568f9[_0x2caf('0x43')][0x1]['value']:undefined)||[]},{'name':_0x2caf('0x4d'),'value':_0x4568f9[_0x2caf('0x4d')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x2]?_0x4568f9[_0x2caf('0x43')][0x2][_0x2caf('0x44')]:undefined)||0x14},{'name':_0x2caf('0x52'),'value':_0x4568f9[_0x2caf('0x52')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x3]?_0x4568f9[_0x2caf('0x43')][0x3][_0x2caf('0x44')]:undefined)||_0x2caf('0x53')},{'name':_0x2caf('0x54'),'value':_0x4568f9[_0x2caf('0x54')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x4]?_0x4568f9[_0x2caf('0x43')][0x4][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x55'),'value':_0x4568f9[_0x2caf('0x55')]||(_0x4568f9['attrs']&&_0x4568f9[_0x2caf('0x43')][0x5]?_0x4568f9[_0x2caf('0x43')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4568f9[_0x2caf('0x56')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x6]?_0x4568f9[_0x2caf('0x43')][0x6][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x57'),'value':_0x4568f9[_0x2caf('0x57')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x7]?_0x4568f9[_0x2caf('0x43')][0x7][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x58'),'value':_0x4568f9[_0x2caf('0x58')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x8]?_0x4568f9[_0x2caf('0x43')][0x8]['value']:undefined)||''},{'name':_0x2caf('0x59'),'value':_0x4568f9[_0x2caf('0x59')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x9]?_0x4568f9[_0x2caf('0x43')][0x9][_0x2caf('0x44')]:undefined)||''}];case _0x2caf('0x5a'):case _0x2caf('0x5b'):return[{'name':_0x2caf('0x5c'),'value':_0x4568f9[_0x2caf('0x5c')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0][_0x2caf('0x44')]:undefined)||'total'},{'name':_0x2caf('0x5d'),'value':_0x4568f9[_0x2caf('0x5d')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x1]?_0x4568f9[_0x2caf('0x43')][0x1][_0x2caf('0x44')]:undefined)||null},{'name':_0x2caf('0x5e'),'value':_0x4568f9['attrSerie3']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x2]?_0x4568f9[_0x2caf('0x43')][0x2][_0x2caf('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4568f9[_0x2caf('0x51')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x3]?_0x4568f9['attrs'][0x3][_0x2caf('0x44')]:undefined)||[]},{'name':_0x2caf('0x52'),'value':_0x4568f9['attrChannel']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x4]?_0x4568f9[_0x2caf('0x43')][0x4]['value']:undefined)||_0x2caf('0x53')},{'name':'attrEmailAccounts','value':_0x4568f9[_0x2caf('0x54')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x5]?_0x4568f9['attrs'][0x5][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x55'),'value':_0x4568f9[_0x2caf('0x55')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x6]?_0x4568f9['attrs'][0x6][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x56'),'value':_0x4568f9['attrSmsAccounts']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x7]?_0x4568f9['attrs'][0x7]['value']:undefined)||''},{'name':_0x2caf('0x57'),'value':_0x4568f9['attrOpenchannelAccounts']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x8]?_0x4568f9[_0x2caf('0x43')][0x8][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x58'),'value':_0x4568f9['attrWhatsappAccounts']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x9]?_0x4568f9[_0x2caf('0x43')][0x9]['value']:undefined)||''},{'name':_0x2caf('0x59'),'value':_0x4568f9['attrChatWebsites']||(_0x4568f9['attrs']&&_0x4568f9[_0x2caf('0x43')][0xa]?_0x4568f9['attrs'][0xa][_0x2caf('0x44')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x4568f9[_0x2caf('0x5f')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0][_0x2caf('0x40')]:undefined)||null,'value':_0x4568f9['attrReport']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9['attrs'][0x0][_0x2caf('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x4568f9[_0x2caf('0x60')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x1]?_0x4568f9[_0x2caf('0x43')][0x1][_0x2caf('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x5d82f5){logger['error'](_0x2caf('0x61'),JSON[_0x2caf('0x62')](_0x5d82f5));return[];}}exports[_0x2caf('0x63')]=function(_0x177e28,_0x16eb75){if(_0x177e28[_0x2caf('0x64')]){_0x177e28[_0x2caf('0x64')]['attrs']=widgetAttributes(_0x177e28[_0x2caf('0x64')]);}return db[_0x2caf('0x3c')][_0x2caf('0x63')](_0x177e28[_0x2caf('0x64')],{})[_0x2caf('0x29')](respondWithResult(_0x16eb75,0xc9))['catch'](handleError(_0x16eb75,null));};exports[_0x2caf('0x28')]=function(_0x5ed955,_0x1fb36f){if(_0x5ed955[_0x2caf('0x64')]['id']){delete _0x5ed955[_0x2caf('0x64')]['id'];}_0x5ed955[_0x2caf('0x64')][_0x2caf('0x43')]=widgetAttributes(_0x5ed955['body']);return db[_0x2caf('0x3c')]['find']({'where':{'id':_0x5ed955[_0x2caf('0x3f')]['id']}})[_0x2caf('0x29')](handleEntityNotFound(_0x1fb36f,null))['then'](saveUpdates(_0x5ed955[_0x2caf('0x64')],null))[_0x2caf('0x29')](respondWithResult(_0x1fb36f,null))[_0x2caf('0x3e')](handleError(_0x1fb36f,null));};
\ No newline at end of file