Built motion from commit 06a208af.|2.6.26
[motion2.git] / server / api / dashboardItem / dashboardItem.controller.js
index c194c90..a4495e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7ae=['params','model','keys','DashboardItem','query','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','end','status','json','offset','undefined','count','apply','reject','save','update','then','sendStatus','error','stack','name','send','show'];(function(_0x1538f9,_0x4262fa){var _0x38f9d1=function(_0x2573eb){while(--_0x2573eb){_0x1538f9['push'](_0x1538f9['shift']());}};_0x38f9d1(++_0x4262fa);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x1cfce4,_0x66fa46){_0x1cfce4=_0x1cfce4-0x0;var _0x3a8345=_0xb7ae[_0x1cfce4];return _0x3a8345;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require(_0xeb7a('0x4'));var moment=require('moment');var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require(_0xeb7a('0x8'));var csv=require(_0xeb7a('0x9'));var ejs=require(_0xeb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xeb7a('0xb'));var _=require(_0xeb7a('0xc'));var squel=require('squel');var crypto=require(_0xeb7a('0xd'));var jsforce=require(_0xeb7a('0xe'));var deskjs=require(_0xeb7a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb7a('0x10'));var Papa=require(_0xeb7a('0x11'));var Redis=require(_0xeb7a('0x12'));var authService=require(_0xeb7a('0x13'));var qs=require(_0xeb7a('0x14'));var as=require(_0xeb7a('0x15'));var hardwareService=require(_0xeb7a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xeb7a('0x17'));var config=require(_0xeb7a('0x18'));var licenseUtil=require(_0xeb7a('0x19'));var db=require(_0xeb7a('0x1a'))['db'];config[_0xeb7a('0x1b')]=_[_0xeb7a('0x1c')](config[_0xeb7a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb7a('0x1d'))(new Redis(config[_0xeb7a('0x1b')]));require('./dashboardItem.socket')[_0xeb7a('0x1e')](socket);function respondWithStatusCode(_0x186ea3,_0x5f41f4){_0x5f41f4=_0x5f41f4||0xcc;return function(_0x2bf77e){if(_0x2bf77e){return _0x186ea3['sendStatus'](_0x5f41f4);}return _0x186ea3['status'](_0x5f41f4)[_0xeb7a('0x1f')]();};}function respondWithResult(_0x5e6256,_0x5782e6){_0x5782e6=_0x5782e6||0xc8;return function(_0x394208){if(_0x394208){return _0x5e6256[_0xeb7a('0x20')](_0x5782e6)[_0xeb7a('0x21')](_0x394208);}};}function respondWithFilteredResult(_0x2d92c7,_0x540b6c){return function(_0x4be13e){if(_0x4be13e){var _0x34ade5=typeof _0x540b6c[_0xeb7a('0x22')]==='undefined'&&typeof _0x540b6c['limit']===_0xeb7a('0x23');var _0x25a399=_0x4be13e[_0xeb7a('0x24')];var _0x268a17=_0x34ade5?0x0:_0x540b6c[_0xeb7a('0x22')];var _0x3025fc=_0x34ade5?_0x4be13e[_0xeb7a('0x24')]:_0x540b6c[_0xeb7a('0x22')]+_0x540b6c['limit'];var _0x431d4a;if(_0x3025fc>=_0x25a399){_0x3025fc=_0x25a399;_0x431d4a=0xc8;}else{_0x431d4a=0xce;}_0x2d92c7[_0xeb7a('0x20')](_0x431d4a);return _0x2d92c7['set']('Content-Range',_0x268a17+'-'+_0x3025fc+'/'+_0x25a399)[_0xeb7a('0x21')](_0x4be13e);}return null;};}function patchUpdates(_0x434aac){return function(_0x46a305){try{jsonpatch[_0xeb7a('0x25')](_0x46a305,_0x434aac,!![]);}catch(_0x29db91){return BPromise[_0xeb7a('0x26')](_0x29db91);}return _0x46a305[_0xeb7a('0x27')]();};}function saveUpdates(_0x4c4816,_0x1f0135){return function(_0xcf0f77){if(_0xcf0f77){return _0xcf0f77[_0xeb7a('0x28')](_0x4c4816)['then'](function(_0x10b7d3){return _0x10b7d3;});}return null;};}function removeEntity(_0x1cf8f6,_0x182335){return function(_0x9b80f5){if(_0x9b80f5){return _0x9b80f5['destroy']()[_0xeb7a('0x29')](function(){_0x1cf8f6['status'](0xcc)[_0xeb7a('0x1f')]();});}};}function handleEntityNotFound(_0x42698d,_0x4d24bc){return function(_0x189e2a){if(!_0x189e2a){_0x42698d[_0xeb7a('0x2a')](0x194);}return _0x189e2a;};}function handleError(_0x176577,_0x39738e){_0x39738e=_0x39738e||0x1f4;return function(_0x3917eb){logger[_0xeb7a('0x2b')](_0x3917eb[_0xeb7a('0x2c')]);if(_0x3917eb[_0xeb7a('0x2d')]){delete _0x3917eb['name'];}_0x176577[_0xeb7a('0x20')](_0x39738e)[_0xeb7a('0x2e')](_0x3917eb);};}exports[_0xeb7a('0x2f')]=function(_0x203993,_0x14e2e1){var _0x202d22={'raw':![],'where':{'id':_0x203993[_0xeb7a('0x30')]['id']}},_0x1662ee={};_0x1662ee[_0xeb7a('0x31')]=_[_0xeb7a('0x32')](db[_0xeb7a('0x33')]['rawAttributes']);_0x1662ee[_0xeb7a('0x34')]=_[_0xeb7a('0x32')](_0x203993[_0xeb7a('0x34')]);_0x1662ee[_0xeb7a('0x35')]=_['intersection'](_0x1662ee[_0xeb7a('0x31')],_0x1662ee[_0xeb7a('0x34')]);_0x202d22[_0xeb7a('0x36')]=_[_0xeb7a('0x37')](_0x1662ee[_0xeb7a('0x31')],qs[_0xeb7a('0x38')](_0x203993['query'][_0xeb7a('0x38')]));_0x202d22[_0xeb7a('0x36')]=_0x202d22[_0xeb7a('0x36')][_0xeb7a('0x39')]?_0x202d22[_0xeb7a('0x36')]:_0x1662ee[_0xeb7a('0x31')];if(_0x203993['query'][_0xeb7a('0x3a')]){_0x202d22['include']=[{'all':!![]}];}_0x202d22=_[_0xeb7a('0x3b')]({},_0x202d22,_0x203993[_0xeb7a('0x3c')]);return db['DashboardItem'][_0xeb7a('0x3d')](_0x202d22)[_0xeb7a('0x29')](handleEntityNotFound(_0x14e2e1,null))[_0xeb7a('0x29')](respondWithResult(_0x14e2e1,null))[_0xeb7a('0x3e')](handleError(_0x14e2e1,null));};exports[_0xeb7a('0x3f')]=function(_0x19bbf0,_0x2aaf7f){return db[_0xeb7a('0x33')]['find']({'where':{'id':_0x19bbf0[_0xeb7a('0x30')]['id']}})[_0xeb7a('0x29')](handleEntityNotFound(_0x2aaf7f,null))['then'](removeEntity(_0x2aaf7f,null))[_0xeb7a('0x3e')](handleError(_0x2aaf7f,null));};function widgetAttributes(_0x64dec){try{switch(_0x64dec[_0xeb7a('0x40')]){case _0xeb7a('0x41'):return[{'name':_0xeb7a('0x42'),'value':_0x64dec[_0xeb7a('0x42')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec['attrs'][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x44')]:undefined)||_0xeb7a('0x45')}];case _0xeb7a('0x46'):return[{'name':_0xeb7a('0x47'),'value':_0x64dec[_0xeb7a('0x47')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x44')]:undefined)||''}];case _0xeb7a('0x48'):return[{'name':_0xeb7a('0x49'),'value':_0x64dec['attrHourFormat']||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x44')]:undefined)||'HH:mm:ss'},{'name':_0xeb7a('0x4a'),'value':_0x64dec[_0xeb7a('0x4a')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x1]?_0x64dec[_0xeb7a('0x43')][0x1][_0xeb7a('0x44')]:undefined)||'0.00'},{'name':_0xeb7a('0x4b'),'value':_0x64dec[_0xeb7a('0x4b')]||(_0x64dec['attrs']&&_0x64dec[_0xeb7a('0x43')][0x2]?_0x64dec['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xeb7a('0x4c'),'value':_0x64dec[_0xeb7a('0x4c')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x44')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x64dec[_0xeb7a('0x4d')]||(_0x64dec['attrs']&&_0x64dec[_0xeb7a('0x43')][0x1]?_0x64dec[_0xeb7a('0x43')][0x1][_0xeb7a('0x44')]:undefined)||[]},{'name':_0xeb7a('0x4b'),'value':_0x64dec['attrFontSize']||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x2]?_0x64dec[_0xeb7a('0x43')][0x2][_0xeb7a('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x64dec[_0xeb7a('0x4e')]||(_0x64dec['attrs']&&_0x64dec[_0xeb7a('0x43')][0x3]?_0x64dec[_0xeb7a('0x43')][0x3][_0xeb7a('0x44')]:undefined)||_0xeb7a('0x4f')},{'name':_0xeb7a('0x50'),'value':_0x64dec[_0xeb7a('0x50')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec['attrs'][0x4]?_0x64dec['attrs'][0x4][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x51'),'value':_0x64dec[_0xeb7a('0x51')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x5]?_0x64dec['attrs'][0x5]['value']:undefined)||''},{'name':_0xeb7a('0x52'),'value':_0x64dec['attrSmsAccounts']||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x6]?_0x64dec[_0xeb7a('0x43')][0x6][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x53'),'value':_0x64dec[_0xeb7a('0x53')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x7]?_0x64dec[_0xeb7a('0x43')][0x7][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x54'),'value':_0x64dec[_0xeb7a('0x54')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x8]?_0x64dec['attrs'][0x8][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x55'),'value':_0x64dec[_0xeb7a('0x55')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x9]?_0x64dec[_0xeb7a('0x43')][0x9][_0xeb7a('0x44')]:undefined)||''}];case _0xeb7a('0x56'):case _0xeb7a('0x57'):return[{'name':_0xeb7a('0x58'),'value':_0x64dec[_0xeb7a('0x58')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x44')]:undefined)||_0xeb7a('0x59')},{'name':_0xeb7a('0x5a'),'value':_0x64dec[_0xeb7a('0x5a')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x1]?_0x64dec[_0xeb7a('0x43')][0x1][_0xeb7a('0x44')]:undefined)||null},{'name':_0xeb7a('0x5b'),'value':_0x64dec['attrSerie3']||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec['attrs'][0x2]?_0x64dec[_0xeb7a('0x43')][0x2]['value']:undefined)||null},{'name':_0xeb7a('0x4d'),'value':_0x64dec[_0xeb7a('0x4d')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x3]?_0x64dec[_0xeb7a('0x43')][0x3][_0xeb7a('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x64dec[_0xeb7a('0x4e')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x4]?_0x64dec[_0xeb7a('0x43')][0x4]['value']:undefined)||_0xeb7a('0x4f')},{'name':_0xeb7a('0x50'),'value':_0x64dec[_0xeb7a('0x50')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x5]?_0x64dec[_0xeb7a('0x43')][0x5][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x51'),'value':_0x64dec[_0xeb7a('0x51')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x6]?_0x64dec[_0xeb7a('0x43')][0x6][_0xeb7a('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x64dec[_0xeb7a('0x52')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x7]?_0x64dec[_0xeb7a('0x43')][0x7]['value']:undefined)||''},{'name':_0xeb7a('0x53'),'value':_0x64dec[_0xeb7a('0x53')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x8]?_0x64dec[_0xeb7a('0x43')][0x8][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x54'),'value':_0x64dec[_0xeb7a('0x54')]||(_0x64dec['attrs']&&_0x64dec[_0xeb7a('0x43')][0x9]?_0x64dec[_0xeb7a('0x43')][0x9][_0xeb7a('0x44')]:undefined)||''},{'name':_0xeb7a('0x55'),'value':_0x64dec['attrChatWebsites']||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0xa]?_0x64dec[_0xeb7a('0x43')][0xa][_0xeb7a('0x44')]:undefined)||''}];case'web-report':return[{'name':_0xeb7a('0x5c'),'type':_0x64dec['reportType']||(_0x64dec['attrs']&&_0x64dec[_0xeb7a('0x43')][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x40')]:undefined)||null,'value':_0x64dec[_0xeb7a('0x5c')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x0]?_0x64dec[_0xeb7a('0x43')][0x0][_0xeb7a('0x44')]:undefined)||null},{'name':_0xeb7a('0x5d'),'value':_0x64dec[_0xeb7a('0x5d')]||(_0x64dec[_0xeb7a('0x43')]&&_0x64dec[_0xeb7a('0x43')][0x1]?_0x64dec['attrs'][0x1][_0xeb7a('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x88d5fc){logger['error'](_0xeb7a('0x5e'),JSON['stringify'](_0x88d5fc));return[];}}exports['create']=function(_0x167322,_0x265d19){if(_0x167322[_0xeb7a('0x5f')]){_0x167322[_0xeb7a('0x5f')][_0xeb7a('0x43')]=widgetAttributes(_0x167322['body']);}return db['DashboardItem'][_0xeb7a('0x60')](_0x167322[_0xeb7a('0x5f')],{})[_0xeb7a('0x29')](respondWithResult(_0x265d19,0xc9))[_0xeb7a('0x3e')](handleError(_0x265d19,null));};exports[_0xeb7a('0x28')]=function(_0xb50b1e,_0x57918e){if(_0xb50b1e['body']['id']){delete _0xb50b1e[_0xeb7a('0x5f')]['id'];}_0xb50b1e[_0xeb7a('0x5f')][_0xeb7a('0x43')]=widgetAttributes(_0xb50b1e[_0xeb7a('0x5f')]);return db['DashboardItem'][_0xeb7a('0x3d')]({'where':{'id':_0xb50b1e[_0xeb7a('0x30')]['id']}})['then'](handleEntityNotFound(_0x57918e,null))['then'](saveUpdates(_0xb50b1e['body'],null))['then'](respondWithResult(_0x57918e,null))[_0xeb7a('0x3e')](handleError(_0x57918e,null));};
\ No newline at end of file
+var _0x9b69=['undefined','count','set','Content-Range','apply','reject','save','update','then','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','destroy','params','type','iframe','attrUrl','attrs','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','register','sendStatus','status','end','json','offset'];(function(_0x20ae75,_0x39c98e){var _0x3832f5=function(_0x16a1c9){while(--_0x16a1c9){_0x20ae75['push'](_0x20ae75['shift']());}};_0x3832f5(++_0x39c98e);}(_0x9b69,0xa3));var _0x99b6=function(_0x55b624,_0x502419){_0x55b624=_0x55b624-0x0;var _0x475e02=_0x9b69[_0x55b624];return _0x475e02;};'use strict';var emlformat=require(_0x99b6('0x0'));var rimraf=require(_0x99b6('0x1'));var zipdir=require(_0x99b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99b6('0x4'));var util=require(_0x99b6('0x5'));var path=require(_0x99b6('0x6'));var sox=require('sox');var csv=require(_0x99b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b6('0x8'));var _=require(_0x99b6('0x9'));var squel=require(_0x99b6('0xa'));var crypto=require(_0x99b6('0xb'));var jsforce=require(_0x99b6('0xc'));var deskjs=require(_0x99b6('0xd'));var toCsv=require(_0x99b6('0x7'));var querystring=require(_0x99b6('0xe'));var Papa=require(_0x99b6('0xf'));var Redis=require(_0x99b6('0x10'));var authService=require(_0x99b6('0x11'));var qs=require(_0x99b6('0x12'));var as=require(_0x99b6('0x13'));var hardwareService=require(_0x99b6('0x14'));var logger=require(_0x99b6('0x15'))(_0x99b6('0x16'));var utils=require(_0x99b6('0x17'));var config=require(_0x99b6('0x18'));var licenseUtil=require(_0x99b6('0x19'));var db=require(_0x99b6('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x99b6('0x1b')](socket);function respondWithStatusCode(_0x184e90,_0x2cda40){_0x2cda40=_0x2cda40||0xcc;return function(_0x54a474){if(_0x54a474){return _0x184e90[_0x99b6('0x1c')](_0x2cda40);}return _0x184e90[_0x99b6('0x1d')](_0x2cda40)[_0x99b6('0x1e')]();};}function respondWithResult(_0x417e9a,_0x4857a2){_0x4857a2=_0x4857a2||0xc8;return function(_0x433b59){if(_0x433b59){return _0x417e9a[_0x99b6('0x1d')](_0x4857a2)[_0x99b6('0x1f')](_0x433b59);}};}function respondWithFilteredResult(_0x2a2bf2,_0x453735){return function(_0x3fd5ad){if(_0x3fd5ad){var _0x1a6436=typeof _0x453735[_0x99b6('0x20')]===_0x99b6('0x21')&&typeof _0x453735['limit']===_0x99b6('0x21');var _0x391c6a=_0x3fd5ad[_0x99b6('0x22')];var _0x2036bb=_0x1a6436?0x0:_0x453735[_0x99b6('0x20')];var _0xc65470=_0x1a6436?_0x3fd5ad[_0x99b6('0x22')]:_0x453735['offset']+_0x453735['limit'];var _0x11b866;if(_0xc65470>=_0x391c6a){_0xc65470=_0x391c6a;_0x11b866=0xc8;}else{_0x11b866=0xce;}_0x2a2bf2[_0x99b6('0x1d')](_0x11b866);return _0x2a2bf2[_0x99b6('0x23')](_0x99b6('0x24'),_0x2036bb+'-'+_0xc65470+'/'+_0x391c6a)['json'](_0x3fd5ad);}return null;};}function patchUpdates(_0x38a916){return function(_0x8ad5c4){try{jsonpatch[_0x99b6('0x25')](_0x8ad5c4,_0x38a916,!![]);}catch(_0x563210){return BPromise[_0x99b6('0x26')](_0x563210);}return _0x8ad5c4[_0x99b6('0x27')]();};}function saveUpdates(_0x454d43,_0x2ea098){return function(_0x319e66){if(_0x319e66){return _0x319e66[_0x99b6('0x28')](_0x454d43)[_0x99b6('0x29')](function(_0x2d92a6){return _0x2d92a6;});}return null;};}function removeEntity(_0x1f8f01,_0x58176f){return function(_0xaa8d52){if(_0xaa8d52){return _0xaa8d52['destroy']()[_0x99b6('0x29')](function(){_0x1f8f01['status'](0xcc)[_0x99b6('0x1e')]();});}};}function handleEntityNotFound(_0x246b17,_0x49dc9a){return function(_0x5dcf7f){if(!_0x5dcf7f){_0x246b17[_0x99b6('0x1c')](0x194);}return _0x5dcf7f;};}function handleError(_0x9617c4,_0x368e6e){_0x368e6e=_0x368e6e||0x1f4;return function(_0x48f796){logger['error'](_0x48f796['stack']);if(_0x48f796['name']){delete _0x48f796[_0x99b6('0x2a')];}_0x9617c4[_0x99b6('0x1d')](_0x368e6e)['send'](_0x48f796);};}exports[_0x99b6('0x2b')]=function(_0x3e4461,_0x2228d1){var _0x311351={'raw':![],'where':{'id':_0x3e4461['params']['id']}},_0x200caf={};_0x200caf[_0x99b6('0x2c')]=_[_0x99b6('0x2d')](db[_0x99b6('0x2e')][_0x99b6('0x2f')]);_0x200caf[_0x99b6('0x30')]=_['keys'](_0x3e4461[_0x99b6('0x30')]);_0x200caf[_0x99b6('0x31')]=_[_0x99b6('0x32')](_0x200caf[_0x99b6('0x2c')],_0x200caf[_0x99b6('0x30')]);_0x311351[_0x99b6('0x33')]=_[_0x99b6('0x32')](_0x200caf[_0x99b6('0x2c')],qs['fields'](_0x3e4461[_0x99b6('0x30')][_0x99b6('0x34')]));_0x311351[_0x99b6('0x33')]=_0x311351[_0x99b6('0x33')][_0x99b6('0x35')]?_0x311351[_0x99b6('0x33')]:_0x200caf[_0x99b6('0x2c')];if(_0x3e4461[_0x99b6('0x30')][_0x99b6('0x36')]){_0x311351['include']=[{'all':!![]}];}_0x311351=_[_0x99b6('0x37')]({},_0x311351,_0x3e4461[_0x99b6('0x38')]);return db['DashboardItem'][_0x99b6('0x39')](_0x311351)['then'](handleEntityNotFound(_0x2228d1,null))[_0x99b6('0x29')](respondWithResult(_0x2228d1,null))[_0x99b6('0x3a')](handleError(_0x2228d1,null));};exports[_0x99b6('0x3b')]=function(_0x1350b1,_0x4e5fb5){return db[_0x99b6('0x2e')]['find']({'where':{'id':_0x1350b1[_0x99b6('0x3c')]['id']}})[_0x99b6('0x29')](handleEntityNotFound(_0x4e5fb5,null))[_0x99b6('0x29')](removeEntity(_0x4e5fb5,null))[_0x99b6('0x3a')](handleError(_0x4e5fb5,null));};function widgetAttributes(_0x172422){try{switch(_0x172422[_0x99b6('0x3d')]){case _0x99b6('0x3e'):return[{'name':_0x99b6('0x3f'),'value':_0x172422[_0x99b6('0x3f')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x0]?_0x172422[_0x99b6('0x40')][0x0]['value']:undefined)||'https://'}];case _0x99b6('0x41'):return[{'name':_0x99b6('0x42'),'value':_0x172422[_0x99b6('0x42')]||(_0x172422[_0x99b6('0x40')]&&_0x172422['attrs'][0x0]?_0x172422[_0x99b6('0x40')][0x0][_0x99b6('0x43')]:undefined)||''}];case'clock':return[{'name':_0x99b6('0x44'),'value':_0x172422['attrHourFormat']||(_0x172422['attrs']&&_0x172422['attrs'][0x0]?_0x172422[_0x99b6('0x40')][0x0]['value']:undefined)||_0x99b6('0x45')},{'name':_0x99b6('0x46'),'value':_0x172422['attrTimezone']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x1]?_0x172422[_0x99b6('0x40')][0x1][_0x99b6('0x43')]:undefined)||_0x99b6('0x47')},{'name':_0x99b6('0x48'),'value':_0x172422[_0x99b6('0x48')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x2]?_0x172422['attrs'][0x2][_0x99b6('0x43')]:undefined)||0xc}];case _0x99b6('0x49'):return[{'name':'attrMetric','value':_0x172422['attrMetric']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x0]?_0x172422[_0x99b6('0x40')][0x0][_0x99b6('0x43')]:undefined)||_0x99b6('0x4a')},{'name':_0x99b6('0x4b'),'value':_0x172422[_0x99b6('0x4b')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x1]?_0x172422[_0x99b6('0x40')][0x1][_0x99b6('0x43')]:undefined)||[]},{'name':_0x99b6('0x48'),'value':_0x172422[_0x99b6('0x48')]||(_0x172422['attrs']&&_0x172422['attrs'][0x2]?_0x172422[_0x99b6('0x40')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x172422[_0x99b6('0x4c')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x3]?_0x172422[_0x99b6('0x40')][0x3][_0x99b6('0x43')]:undefined)||_0x99b6('0x4d')},{'name':_0x99b6('0x4e'),'value':_0x172422[_0x99b6('0x4e')]||(_0x172422['attrs']&&_0x172422['attrs'][0x4]?_0x172422[_0x99b6('0x40')][0x4][_0x99b6('0x43')]:undefined)||''},{'name':_0x99b6('0x4f'),'value':_0x172422['attrFaxAccounts']||(_0x172422['attrs']&&_0x172422[_0x99b6('0x40')][0x5]?_0x172422[_0x99b6('0x40')][0x5]['value']:undefined)||''},{'name':_0x99b6('0x50'),'value':_0x172422['attrSmsAccounts']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x6]?_0x172422[_0x99b6('0x40')][0x6][_0x99b6('0x43')]:undefined)||''},{'name':_0x99b6('0x51'),'value':_0x172422[_0x99b6('0x51')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x7]?_0x172422[_0x99b6('0x40')][0x7][_0x99b6('0x43')]:undefined)||''},{'name':_0x99b6('0x52'),'value':_0x172422['attrWhatsappAccounts']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x8]?_0x172422[_0x99b6('0x40')][0x8]['value']:undefined)||''},{'name':_0x99b6('0x53'),'value':_0x172422[_0x99b6('0x53')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x9]?_0x172422[_0x99b6('0x40')][0x9][_0x99b6('0x43')]:undefined)||''}];case _0x99b6('0x54'):case _0x99b6('0x55'):return[{'name':'attrSerie1','value':_0x172422[_0x99b6('0x56')]||(_0x172422['attrs']&&_0x172422[_0x99b6('0x40')][0x0]?_0x172422['attrs'][0x0][_0x99b6('0x43')]:undefined)||_0x99b6('0x4a')},{'name':_0x99b6('0x57'),'value':_0x172422[_0x99b6('0x57')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x1]?_0x172422['attrs'][0x1][_0x99b6('0x43')]:undefined)||null},{'name':_0x99b6('0x58'),'value':_0x172422['attrSerie3']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x2]?_0x172422[_0x99b6('0x40')][0x2][_0x99b6('0x43')]:undefined)||null},{'name':_0x99b6('0x4b'),'value':_0x172422[_0x99b6('0x4b')]||(_0x172422['attrs']&&_0x172422[_0x99b6('0x40')][0x3]?_0x172422[_0x99b6('0x40')][0x3][_0x99b6('0x43')]:undefined)||[]},{'name':_0x99b6('0x4c'),'value':_0x172422[_0x99b6('0x4c')]||(_0x172422[_0x99b6('0x40')]&&_0x172422['attrs'][0x4]?_0x172422[_0x99b6('0x40')][0x4][_0x99b6('0x43')]:undefined)||'voice'},{'name':_0x99b6('0x4e'),'value':_0x172422[_0x99b6('0x4e')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x5]?_0x172422[_0x99b6('0x40')][0x5][_0x99b6('0x43')]:undefined)||''},{'name':_0x99b6('0x4f'),'value':_0x172422['attrFaxAccounts']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x6]?_0x172422[_0x99b6('0x40')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x172422[_0x99b6('0x50')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x7]?_0x172422[_0x99b6('0x40')][0x7][_0x99b6('0x43')]:undefined)||''},{'name':_0x99b6('0x51'),'value':_0x172422[_0x99b6('0x51')]||(_0x172422[_0x99b6('0x40')]&&_0x172422['attrs'][0x8]?_0x172422[_0x99b6('0x40')][0x8][_0x99b6('0x43')]:undefined)||''},{'name':_0x99b6('0x52'),'value':_0x172422['attrWhatsappAccounts']||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x9]?_0x172422['attrs'][0x9]['value']:undefined)||''},{'name':_0x99b6('0x53'),'value':_0x172422[_0x99b6('0x53')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0xa]?_0x172422[_0x99b6('0x40')][0xa][_0x99b6('0x43')]:undefined)||''}];case _0x99b6('0x59'):return[{'name':_0x99b6('0x5a'),'type':_0x172422[_0x99b6('0x5b')]||(_0x172422[_0x99b6('0x40')]&&_0x172422[_0x99b6('0x40')][0x0]?_0x172422[_0x99b6('0x40')][0x0]['type']:undefined)||null,'value':_0x172422[_0x99b6('0x5a')]||(_0x172422[_0x99b6('0x40')]&&_0x172422['attrs'][0x0]?_0x172422[_0x99b6('0x40')][0x0]['value']:undefined)||null},{'name':_0x99b6('0x5c'),'value':_0x172422[_0x99b6('0x5c')]||(_0x172422[_0x99b6('0x40')]&&_0x172422['attrs'][0x1]?_0x172422['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x454875){logger[_0x99b6('0x5d')](_0x99b6('0x5e'),JSON[_0x99b6('0x5f')](_0x454875));return[];}}exports[_0x99b6('0x60')]=function(_0x33c57a,_0x1da94b){if(_0x33c57a['body']){_0x33c57a[_0x99b6('0x61')]['attrs']=widgetAttributes(_0x33c57a['body']);}return db[_0x99b6('0x2e')][_0x99b6('0x60')](_0x33c57a[_0x99b6('0x61')],{})[_0x99b6('0x29')](respondWithResult(_0x1da94b,0xc9))[_0x99b6('0x3a')](handleError(_0x1da94b,null));};exports[_0x99b6('0x28')]=function(_0x361ca5,_0xbff277){if(_0x361ca5[_0x99b6('0x61')]['id']){delete _0x361ca5[_0x99b6('0x61')]['id'];}_0x361ca5[_0x99b6('0x61')]['attrs']=widgetAttributes(_0x361ca5['body']);return db[_0x99b6('0x2e')][_0x99b6('0x39')]({'where':{'id':_0x361ca5[_0x99b6('0x3c')]['id']}})[_0x99b6('0x29')](handleEntityNotFound(_0xbff277,null))[_0x99b6('0x29')](saveUpdates(_0x361ca5['body'],null))[_0x99b6('0x29')](respondWithResult(_0xbff277,null))[_0x99b6('0x3a')](handleError(_0xbff277,null));};
\ No newline at end of file