Built motion from commit (unavailable).|2.4.21
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 42cdca7..a951dfb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfccf=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','autoAssociation','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','CustomDashboards','send','map','Dashboard','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find'];(function(_0x1ff171,_0x4012af){var _0x456656=function(_0x12ca4f){while(--_0x12ca4f){_0x1ff171['push'](_0x1ff171['shift']());}};_0x456656(++_0x4012af);}(_0xfccf,0xaa));var _0xffcc=function(_0x3d9105,_0x356c8f){_0x3d9105=_0x3d9105-0x0;var _0x57166a=_0xfccf[_0x3d9105];return _0x57166a;};'use strict';var pdf=require(_0xffcc('0x0'));var emlformat=require(_0xffcc('0x1'));var rimraf=require(_0xffcc('0x2'));var zipdir=require(_0xffcc('0x3'));var jsonpatch=require(_0xffcc('0x4'));var rp=require(_0xffcc('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xffcc('0x6'));var util=require(_0xffcc('0x7'));var path=require(_0xffcc('0x8'));var sox=require(_0xffcc('0x9'));var csv=require(_0xffcc('0xa'));var ejs=require(_0xffcc('0xb'));var fs=require('fs');var _=require(_0xffcc('0xc'));var squel=require(_0xffcc('0xd'));var crypto=require('crypto');var jsforce=require(_0xffcc('0xe'));var deskjs=require(_0xffcc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xffcc('0x10'));var Papa=require(_0xffcc('0x11'));var Redis=require('ioredis');var authService=require(_0xffcc('0x12'));var qs=require(_0xffcc('0x13'));var as=require(_0xffcc('0x14'));var hardwareService=require(_0xffcc('0x15'));var logger=require(_0xffcc('0x16'))(_0xffcc('0x17'));var utils=require(_0xffcc('0x18'));var config=require(_0xffcc('0x19'));var db=require(_0xffcc('0x1a'))['db'];config[_0xffcc('0x1b')]=_[_0xffcc('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xffcc('0x1d'))(new Redis(config[_0xffcc('0x1b')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x37eb46,_0x55f73c){_0x55f73c=_0x55f73c||0xcc;return function(_0x312465){if(_0x312465){return _0x37eb46[_0xffcc('0x1e')](_0x55f73c);}return _0x37eb46[_0xffcc('0x1f')](_0x55f73c)[_0xffcc('0x20')]();};}function respondWithResult(_0x5ac309,_0x44372e){_0x44372e=_0x44372e||0xc8;return function(_0x3086b7){if(_0x3086b7){return _0x5ac309[_0xffcc('0x1f')](_0x44372e)[_0xffcc('0x21')](_0x3086b7);}};}function respondWithFilteredResult(_0x5e0d2a,_0x35c427){return function(_0x268ee8){if(_0x268ee8){var _0x4e979f=_0x268ee8[_0xffcc('0x22')],_0x3dd2c8=_0x35c427[_0xffcc('0x23')],_0x230411=_0x35c427[_0xffcc('0x23')]+_0x35c427[_0xffcc('0x24')],_0x51437d;if(_0x230411>=_0x4e979f){_0x230411=_0x4e979f;_0x51437d=0xc8;}else{_0x51437d=0xce;}_0x5e0d2a['status'](_0x51437d);return _0x5e0d2a['set'](_0xffcc('0x25'),_0x3dd2c8+'-'+_0x230411+'/'+_0x4e979f)[_0xffcc('0x21')](_0x268ee8);}return null;};}function patchUpdates(_0x247329){return function(_0x46558e){try{jsonpatch[_0xffcc('0x26')](_0x46558e,_0x247329,!![]);}catch(_0x193297){return BPromise[_0xffcc('0x27')](_0x193297);}return _0x46558e[_0xffcc('0x28')]();};}function saveUpdates(_0x217914,_0x408d70){return function(_0x8e2840){if(_0x8e2840){return _0x8e2840[_0xffcc('0x29')](_0x217914)['then'](function(_0x174eb4){return _0x174eb4;});}return null;};}function removeEntity(_0x285280,_0x18e4ed){return function(_0x1b9024){if(_0x1b9024){return _0x1b9024[_0xffcc('0x2a')]()[_0xffcc('0x2b')](function(){var _0x1add35=_0x1b9024['get']({'plain':!![]});var _0x18b9c9=_0xffcc('0x2c');return db['UserProfileResource'][_0xffcc('0x2a')]({'where':{'type':_0x18b9c9,'resourceId':_0x1add35['id']}})[_0xffcc('0x2b')](function(){return _0x1b9024;});})['then'](function(){_0x285280[_0xffcc('0x1f')](0xcc)[_0xffcc('0x20')]();});}};}function handleEntityNotFound(_0xc6c631,_0x303437){return function(_0x5f28f2){if(!_0x5f28f2){_0xc6c631[_0xffcc('0x1e')](0x194);}return _0x5f28f2;};}function handleError(_0xced4e7,_0x364869){_0x364869=_0x364869||0x1f4;return function(_0x434cb7){logger['error'](_0x434cb7['stack']);if(_0x434cb7['name']){delete _0x434cb7['name'];}_0xced4e7['status'](_0x364869)[_0xffcc('0x2d')](_0x434cb7);};}exports['index']=function(_0x2564c3,_0x36517c){var _0x7d73d0={},_0x6cca29={},_0x1d2061={'count':0x0,'rows':[]};var _0x501bcf=_[_0xffcc('0x2e')](db[_0xffcc('0x2f')][_0xffcc('0x30')],function(_0x46337c){return{'name':_0x46337c[_0xffcc('0x31')],'type':_0x46337c[_0xffcc('0x32')][_0xffcc('0x33')]};});_0x6cca29[_0xffcc('0x34')]=_[_0xffcc('0x2e')](_0x501bcf,_0xffcc('0x35'));_0x6cca29[_0xffcc('0x36')]=_['keys'](_0x2564c3['query']);_0x6cca29[_0xffcc('0x37')]=_[_0xffcc('0x38')](_0x6cca29['model'],_0x6cca29[_0xffcc('0x36')]);_0x7d73d0[_0xffcc('0x39')]=_[_0xffcc('0x38')](_0x6cca29[_0xffcc('0x34')],qs[_0xffcc('0x3a')](_0x2564c3['query'][_0xffcc('0x3a')]));_0x7d73d0['attributes']=_0x7d73d0[_0xffcc('0x39')]['length']?_0x7d73d0[_0xffcc('0x39')]:_0x6cca29[_0xffcc('0x34')];if(!_0x2564c3['query'][_0xffcc('0x3b')](_0xffcc('0x3c'))){_0x7d73d0[_0xffcc('0x24')]=qs[_0xffcc('0x24')](_0x2564c3[_0xffcc('0x36')]['limit']);_0x7d73d0[_0xffcc('0x23')]=qs['offset'](_0x2564c3[_0xffcc('0x36')]['offset']);}_0x7d73d0[_0xffcc('0x3d')]=qs[_0xffcc('0x3e')](_0x2564c3[_0xffcc('0x36')]['sort']);_0x7d73d0[_0xffcc('0x3f')]=qs[_0xffcc('0x37')](_[_0xffcc('0x40')](_0x2564c3[_0xffcc('0x36')],_0x6cca29[_0xffcc('0x37')]));if(_0x2564c3['query'][_0xffcc('0x41')]){_0x7d73d0[_0xffcc('0x3f')]=_[_0xffcc('0x42')](_0x7d73d0[_0xffcc('0x3f')],{'$or':_['map'](_0x501bcf,function(_0x24ef1a){if(_0x24ef1a[_0xffcc('0x32')]!==_0xffcc('0x43')){var _0x9a2ba0={};_0x9a2ba0[_0x24ef1a['name']]={'$like':'%'+_0x2564c3[_0xffcc('0x36')][_0xffcc('0x41')]+'%'};return _0x9a2ba0;}})});}_0x7d73d0=_['merge']({},_0x7d73d0,_0x2564c3[_0xffcc('0x44')]);var _0x6dc547={'where':_0x7d73d0['where']};return db[_0xffcc('0x2f')]['count'](_0x6dc547)[_0xffcc('0x2b')](function(_0x350903){_0x1d2061['count']=_0x350903;if(_0x2564c3['query'][_0xffcc('0x45')]){_0x7d73d0[_0xffcc('0x46')]=[{'all':!![]}];}return db[_0xffcc('0x2f')][_0xffcc('0x47')](_0x7d73d0);})[_0xffcc('0x2b')](function(_0x469ca1){_0x1d2061[_0xffcc('0x48')]=_0x469ca1;return _0x1d2061;})[_0xffcc('0x2b')](respondWithFilteredResult(_0x36517c,_0x7d73d0))[_0xffcc('0x49')](handleError(_0x36517c,null));};exports['show']=function(_0x1854fa,_0xc0d588){var _0x4172e1={'raw':![],'where':{'id':_0x1854fa[_0xffcc('0x4a')]['id']}},_0x20276e={};_0x20276e[_0xffcc('0x34')]=_[_0xffcc('0x4b')](db[_0xffcc('0x2f')][_0xffcc('0x30')]);_0x20276e[_0xffcc('0x36')]=_[_0xffcc('0x4b')](_0x1854fa[_0xffcc('0x36')]);_0x20276e['filters']=_[_0xffcc('0x38')](_0x20276e['model'],_0x20276e['query']);_0x4172e1['attributes']=_[_0xffcc('0x38')](_0x20276e['model'],qs[_0xffcc('0x3a')](_0x1854fa[_0xffcc('0x36')][_0xffcc('0x3a')]));_0x4172e1[_0xffcc('0x39')]=_0x4172e1[_0xffcc('0x39')][_0xffcc('0x4c')]?_0x4172e1['attributes']:_0x20276e[_0xffcc('0x34')];if(_0x1854fa['query'][_0xffcc('0x45')]){_0x4172e1['include']=[{'all':!![]}];}_0x4172e1=_[_0xffcc('0x42')]({},_0x4172e1,_0x1854fa[_0xffcc('0x44')]);return db[_0xffcc('0x2f')][_0xffcc('0x4d')](_0x4172e1)[_0xffcc('0x2b')](handleEntityNotFound(_0xc0d588,null))[_0xffcc('0x2b')](respondWithResult(_0xc0d588,null))['catch'](handleError(_0xc0d588,null));};exports[_0xffcc('0x4e')]=function(_0x11e73d,_0x355ce1){return db[_0xffcc('0x2f')]['create'](_0x11e73d[_0xffcc('0x4f')],{})['then'](function(_0x4e83c5){var _0x56aaa6=_0x11e73d[_0xffcc('0x50')]['get']({'plain':!![]});if(!_0x56aaa6)throw new Error(_0xffcc('0x51'));if(_0x56aaa6[_0xffcc('0x52')]===_0xffcc('0x50')){var _0x257407=_0x4e83c5[_0xffcc('0x53')]({'plain':!![]});var _0x56f173=_0xffcc('0x2c');return db[_0xffcc('0x54')][_0xffcc('0x4d')]({'where':{'name':_0x56f173,'userProfileId':_0x56aaa6[_0xffcc('0x55')]},'raw':!![]})[_0xffcc('0x2b')](function(_0x4ffc18){if(_0x4ffc18&&_0x4ffc18['autoAssociation']===0x0){return db[_0xffcc('0x56')][_0xffcc('0x4e')]({'name':_0x257407['name'],'resourceId':_0x257407['id'],'type':_0x4ffc18[_0xffcc('0x35')],'sectionId':_0x4ffc18['id']},{})[_0xffcc('0x2b')](function(){return _0x4e83c5;});}else{return _0x4e83c5;}})[_0xffcc('0x49')](function(_0x1b87a6){logger[_0xffcc('0x57')](_0xffcc('0x58'),_0x1b87a6);throw _0x1b87a6;});}return _0x4e83c5;})[_0xffcc('0x2b')](respondWithResult(_0x355ce1,0xc9))['catch'](handleError(_0x355ce1,null));};exports[_0xffcc('0x59')]=function(_0x5c40f5,_0x547c1c){var _0x287ced={'where':{'id':_0x5c40f5['params']['id']}},_0x4ff30d={};_0x4ff30d['model']=_['keys'](db['Dashboard'][_0xffcc('0x30')]);_0x287ced['attributes']=_['intersection'](_0x4ff30d[_0xffcc('0x34')],qs['fields'](_0x5c40f5['query'][_0xffcc('0x3a')]));_0x287ced['attributes']=_0x287ced['attributes']['length']?_0x287ced[_0xffcc('0x39')]:_0x4ff30d[_0xffcc('0x34')];if(_0x5c40f5[_0xffcc('0x36')]['includeAll']){_0x287ced[_0xffcc('0x46')]=[{'all':!![]}];}_0x287ced=_[_0xffcc('0x42')]({},_0x287ced,_0x5c40f5[_0xffcc('0x44')]);return db['Dashboard'][_0xffcc('0x4d')](_0x287ced)[_0xffcc('0x2b')](handleEntityNotFound(_0x547c1c,null))[_0xffcc('0x2b')](function(_0x4939e8){if(_0x4939e8){var _0x32d269=_0x4939e8[_0xffcc('0x53')]({'plain':!![]});_0x32d269=qs['omit'](_0x32d269,['id',_0xffcc('0x5a'),_0xffcc('0x5b')]);_0x5c40f5[_0xffcc('0x4f')]=_[_0xffcc('0x5c')](_0x5c40f5[_0xffcc('0x4f')],['id','createdAt',_0xffcc('0x5b')]);return db[_0xffcc('0x2f')][_0xffcc('0x4e')](_['merge'](_0x32d269,_0x5c40f5[_0xffcc('0x4f')]),{'include':_0x5c40f5[_0xffcc('0x36')][_0xffcc('0x45')]?[{'all':!![]}]:undefined})[_0xffcc('0x2b')](function(_0x710d7e){var _0x33ccd6=_0x5c40f5[_0xffcc('0x50')]['get']({'plain':!![]});if(!_0x33ccd6)throw new Error(_0xffcc('0x51'));if(_0x33ccd6['role']==='user'){var _0x1b3e67=_0x710d7e[_0xffcc('0x53')]({'plain':!![]});var _0x552419=_0xffcc('0x2c');return db[_0xffcc('0x54')][_0xffcc('0x4d')]({'where':{'name':_0x552419,'userProfileId':_0x33ccd6[_0xffcc('0x55')]},'raw':!![]})[_0xffcc('0x2b')](function(_0x152de9){if(_0x152de9&&_0x152de9[_0xffcc('0x5d')]===0x0){return db[_0xffcc('0x56')][_0xffcc('0x4e')]({'name':_0x1b3e67[_0xffcc('0x35')],'resourceId':_0x1b3e67['id'],'type':_0x152de9[_0xffcc('0x35')],'sectionId':_0x152de9['id']},{})[_0xffcc('0x2b')](function(){return _0x710d7e;});}else{return _0x710d7e;}})[_0xffcc('0x49')](function(_0x3f0d14){logger[_0xffcc('0x57')](_0xffcc('0x58'),_0x3f0d14);throw _0x3f0d14;});}return _0x710d7e;});}})[_0xffcc('0x2b')](respondWithResult(_0x547c1c,0xc9))[_0xffcc('0x49')](handleError(_0x547c1c,null));};exports['update']=function(_0x50ba92,_0xf5f63a){if(_0x50ba92['body']['id']){delete _0x50ba92['body']['id'];}return db['Dashboard'][_0xffcc('0x4d')]({'where':{'id':_0x50ba92['params']['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0xf5f63a,null))[_0xffcc('0x2b')](saveUpdates(_0x50ba92[_0xffcc('0x4f')],null))[_0xffcc('0x2b')](respondWithResult(_0xf5f63a,null))['catch'](handleError(_0xf5f63a,null));};exports['destroy']=function(_0x48f6e0,_0x433e59){return db[_0xffcc('0x2f')][_0xffcc('0x4d')]({'where':{'id':_0x48f6e0[_0xffcc('0x4a')]['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0x433e59,null))['then'](removeEntity(_0x433e59,null))[_0xffcc('0x49')](handleError(_0x433e59,null));};function widgetAttributes(_0x33b16d){try{switch(_0x33b16d[_0xffcc('0x32')]){case'iframe':return[{'name':_0xffcc('0x5e'),'value':_0x33b16d[_0xffcc('0x5e')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||_0xffcc('0x61')}];case _0xffcc('0x62'):return[{'name':_0xffcc('0x63'),'value':_0x33b16d[_0xffcc('0x63')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d['attrs'][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||''}];case _0xffcc('0x64'):return[{'name':_0xffcc('0x65'),'value':_0x33b16d[_0xffcc('0x65')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||_0xffcc('0x66')},{'name':_0xffcc('0x67'),'value':_0x33b16d[_0xffcc('0x67')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d[_0xffcc('0x5f')][0x1][_0xffcc('0x60')]:undefined)||_0xffcc('0x68')},{'name':_0xffcc('0x69'),'value':_0x33b16d[_0xffcc('0x69')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d['attrs'][0x2]?_0x33b16d[_0xffcc('0x5f')][0x2][_0xffcc('0x60')]:undefined)||0xc}];case _0xffcc('0x6a'):return[{'name':'attrMetric','value':_0x33b16d[_0xffcc('0x6b')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d['attrs'][0x0][_0xffcc('0x60')]:undefined)||_0xffcc('0x6c')},{'name':_0xffcc('0x6d'),'value':_0x33b16d['attrVoiceQueues']||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d[_0xffcc('0x5f')][0x1][_0xffcc('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x33b16d[_0xffcc('0x69')]||(_0x33b16d['attrs']&&_0x33b16d[_0xffcc('0x5f')][0x2]?_0x33b16d[_0xffcc('0x5f')][0x2][_0xffcc('0x60')]:undefined)||0x14}];case _0xffcc('0x6e'):case _0xffcc('0x6f'):return[{'name':'attrSerie1','value':_0x33b16d[_0xffcc('0x70')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d[_0xffcc('0x5f')][0x0][_0xffcc('0x60')]:undefined)||'total'},{'name':'attrSerie2','value':_0x33b16d[_0xffcc('0x71')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d['attrs'][0x1]['value']:undefined)||null},{'name':_0xffcc('0x72'),'value':_0x33b16d[_0xffcc('0x72')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x2]?_0x33b16d[_0xffcc('0x5f')][0x2]['value']:undefined)||null},{'name':_0xffcc('0x6d'),'value':_0x33b16d[_0xffcc('0x6d')]||(_0x33b16d['attrs']&&_0x33b16d[_0xffcc('0x5f')][0x3]?_0x33b16d['attrs'][0x3][_0xffcc('0x60')]:undefined)||[]}];case'web-report':return[{'name':_0xffcc('0x73'),'type':_0x33b16d[_0xffcc('0x74')]||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d['attrs'][0x0][_0xffcc('0x32')]:undefined)||null,'value':_0x33b16d['attrReport']||(_0x33b16d[_0xffcc('0x5f')]&&_0x33b16d[_0xffcc('0x5f')][0x0]?_0x33b16d['attrs'][0x0][_0xffcc('0x60')]:undefined)||null},{'name':_0xffcc('0x75'),'value':_0x33b16d['attrRefresh']||(_0x33b16d['attrs']&&_0x33b16d[_0xffcc('0x5f')][0x1]?_0x33b16d[_0xffcc('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x6a7259){logger[_0xffcc('0x57')](_0xffcc('0x76'),JSON[_0xffcc('0x77')](_0x6a7259));return[];}}exports[_0xffcc('0x78')]=function(_0x3c3c88,_0x2bff97,_0x11b12e){if(_0x3c3c88[_0xffcc('0x4f')]['id']){delete _0x3c3c88['body']['id'];}return db[_0xffcc('0x2f')][_0xffcc('0x4d')]({'where':{'id':_0x3c3c88['params']['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0x2bff97,null))[_0xffcc('0x2b')](function(_0x2e670a){if(_0x2e670a){_0x3c3c88[_0xffcc('0x4f')]['DashboardId']=_0x2e670a['id'];_0x3c3c88['body'][_0xffcc('0x5f')]=widgetAttributes(_0x3c3c88['body']);return db[_0xffcc('0x79')][_0xffcc('0x4e')](_0x3c3c88[_0xffcc('0x4f')]);}})[_0xffcc('0x2b')](respondWithResult(_0x2bff97,null))[_0xffcc('0x49')](handleError(_0x2bff97,null));};exports[_0xffcc('0x7a')]=function(_0x1853fc,_0x469291,_0x37bef0){var _0x589783={};var _0x59eed6={};var _0x3eaade;var _0x3731d3;return db[_0xffcc('0x2f')][_0xffcc('0x7b')]({'where':{'id':_0x1853fc[_0xffcc('0x4a')]['id']}})[_0xffcc('0x2b')](handleEntityNotFound(_0x469291,null))[_0xffcc('0x2b')](function(_0x2454ad){if(_0x2454ad){_0x3eaade=_0x2454ad;_0x59eed6[_0xffcc('0x34')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x59eed6[_0xffcc('0x36')]=_[_0xffcc('0x4b')](_0x1853fc[_0xffcc('0x36')]);_0x59eed6[_0xffcc('0x37')]=_[_0xffcc('0x38')](_0x59eed6[_0xffcc('0x34')],_0x59eed6['query']);_0x589783[_0xffcc('0x39')]=_['intersection'](_0x59eed6[_0xffcc('0x34')],qs[_0xffcc('0x3a')](_0x1853fc[_0xffcc('0x36')]['fields']));_0x589783[_0xffcc('0x39')]=_0x589783[_0xffcc('0x39')][_0xffcc('0x4c')]?_0x589783[_0xffcc('0x39')]:_0x59eed6[_0xffcc('0x34')];_0x589783[_0xffcc('0x3d')]=qs[_0xffcc('0x3e')](_0x1853fc[_0xffcc('0x36')][_0xffcc('0x3e')]);_0x589783['where']=qs[_0xffcc('0x37')](_[_0xffcc('0x40')](_0x1853fc[_0xffcc('0x36')],_0x59eed6[_0xffcc('0x37')]));if(_0x1853fc['query'][_0xffcc('0x41')]){_0x589783[_0xffcc('0x3f')]=_[_0xffcc('0x42')](_0x589783[_0xffcc('0x3f')],{'$or':_['map'](_0x589783['attributes'],function(_0x415952){var _0x43f327={};_0x43f327[_0x415952]={'$like':'%'+_0x1853fc['query']['filter']+'%'};return _0x43f327;})});}_0x589783=_[_0xffcc('0x42')]({},_0x589783,_0x1853fc[_0xffcc('0x44')]);return _0x3eaade[_0xffcc('0x7a')](_0x589783);}})[_0xffcc('0x2b')](function(_0x1e1d38){if(_0x1e1d38){_0x3731d3=_0x1e1d38[_0xffcc('0x4c')];if(!_0x1853fc[_0xffcc('0x36')][_0xffcc('0x3b')](_0xffcc('0x3c'))){_0x589783[_0xffcc('0x24')]=qs[_0xffcc('0x24')](_0x1853fc[_0xffcc('0x36')][_0xffcc('0x24')]);_0x589783[_0xffcc('0x23')]=qs['offset'](_0x1853fc[_0xffcc('0x36')][_0xffcc('0x23')]);}return _0x3eaade['getItems'](_0x589783);}})[_0xffcc('0x2b')](function(_0x56c4b7){if(_0x56c4b7){return _0x56c4b7?{'count':_0x3731d3,'rows':_0x56c4b7}:null;}})[_0xffcc('0x2b')](respondWithResult(_0x469291,null))[_0xffcc('0x49')](handleError(_0x469291,null));};
\ No newline at end of file
+var _0xfc03=['zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','rows','catch','show','rawAttributes','keys','includeAll','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','params','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrVoiceQueues','multibar-chart','pie-chart','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','html-pdf','rimraf'];(function(_0x2e3646,_0x412055){var _0x2b1dc1=function(_0x4e723a){while(--_0x4e723a){_0x2e3646['push'](_0x2e3646['shift']());}};_0x2b1dc1(++_0x412055);}(_0xfc03,0x16f));var _0x3fc0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xfc03[_0x5f309e];return _0x487b5e;};'use strict';var pdf=require(_0x3fc0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3fc0('0x1'));var zipdir=require(_0x3fc0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fc0('0x3'));var moment=require('moment');var BPromise=require(_0x3fc0('0x4'));var Mustache=require(_0x3fc0('0x5'));var util=require(_0x3fc0('0x6'));var path=require(_0x3fc0('0x7'));var sox=require(_0x3fc0('0x8'));var csv=require(_0x3fc0('0x9'));var ejs=require(_0x3fc0('0xa'));var fs=require('fs');var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x9'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var db=require(_0x3fc0('0x17'))['db'];config['redis']=_[_0x3fc0('0x18')](config['redis'],{'host':_0x3fc0('0x19'),'port':0x18eb});var socket=require(_0x3fc0('0x1a'))(new Redis(config['redis']));require(_0x3fc0('0x1b'))[_0x3fc0('0x1c')](socket);function respondWithStatusCode(_0x392c46,_0x4eb69a){_0x4eb69a=_0x4eb69a||0xcc;return function(_0x29ad7a){if(_0x29ad7a){return _0x392c46[_0x3fc0('0x1d')](_0x4eb69a);}return _0x392c46[_0x3fc0('0x1e')](_0x4eb69a)[_0x3fc0('0x1f')]();};}function respondWithResult(_0x562ecc,_0x277dbf){_0x277dbf=_0x277dbf||0xc8;return function(_0x3d869e){if(_0x3d869e){return _0x562ecc[_0x3fc0('0x1e')](_0x277dbf)['json'](_0x3d869e);}};}function respondWithFilteredResult(_0x52ba8c,_0x491446){return function(_0x121931){if(_0x121931){var _0x3c5026=_0x121931[_0x3fc0('0x20')],_0x4b947c=_0x491446[_0x3fc0('0x21')],_0x3bb388=_0x491446[_0x3fc0('0x21')]+_0x491446[_0x3fc0('0x22')],_0x33ffbc;if(_0x3bb388>=_0x3c5026){_0x3bb388=_0x3c5026;_0x33ffbc=0xc8;}else{_0x33ffbc=0xce;}_0x52ba8c[_0x3fc0('0x1e')](_0x33ffbc);return _0x52ba8c[_0x3fc0('0x23')](_0x3fc0('0x24'),_0x4b947c+'-'+_0x3bb388+'/'+_0x3c5026)['json'](_0x121931);}return null;};}function patchUpdates(_0xf13744){return function(_0x9ab2c5){try{jsonpatch[_0x3fc0('0x25')](_0x9ab2c5,_0xf13744,!![]);}catch(_0x3d6c0a){return BPromise[_0x3fc0('0x26')](_0x3d6c0a);}return _0x9ab2c5[_0x3fc0('0x27')]();};}function saveUpdates(_0x47c770,_0x477674){return function(_0x23d513){if(_0x23d513){return _0x23d513[_0x3fc0('0x28')](_0x47c770)[_0x3fc0('0x29')](function(_0x46c213){return _0x46c213;});}return null;};}function removeEntity(_0x303dd2,_0x2f423e){return function(_0x31743e){if(_0x31743e){return _0x31743e[_0x3fc0('0x2a')]()[_0x3fc0('0x29')](function(){var _0x294723=_0x31743e[_0x3fc0('0x2b')]({'plain':!![]});var _0x784765=_0x3fc0('0x2c');return db[_0x3fc0('0x2d')][_0x3fc0('0x2a')]({'where':{'type':_0x784765,'resourceId':_0x294723['id']}})['then'](function(){return _0x31743e;});})[_0x3fc0('0x29')](function(){_0x303dd2[_0x3fc0('0x1e')](0xcc)[_0x3fc0('0x1f')]();});}};}function handleEntityNotFound(_0x35c34c,_0x5a9179){return function(_0x134317){if(!_0x134317){_0x35c34c[_0x3fc0('0x1d')](0x194);}return _0x134317;};}function handleError(_0x126515,_0x2645b4){_0x2645b4=_0x2645b4||0x1f4;return function(_0x559fcc){logger[_0x3fc0('0x2e')](_0x559fcc[_0x3fc0('0x2f')]);if(_0x559fcc[_0x3fc0('0x30')]){delete _0x559fcc[_0x3fc0('0x30')];}_0x126515[_0x3fc0('0x1e')](_0x2645b4)[_0x3fc0('0x31')](_0x559fcc);};}exports['index']=function(_0xd9ecae,_0x2351c8){var _0x181948={},_0x21a074={},_0x3f1a75={'count':0x0,'rows':[]};var _0x48c8a8=_[_0x3fc0('0x32')](db[_0x3fc0('0x33')]['rawAttributes'],function(_0x54e9ca){return{'name':_0x54e9ca[_0x3fc0('0x34')],'type':_0x54e9ca['type'][_0x3fc0('0x35')]};});_0x21a074[_0x3fc0('0x36')]=_[_0x3fc0('0x32')](_0x48c8a8,_0x3fc0('0x30'));_0x21a074[_0x3fc0('0x37')]=_['keys'](_0xd9ecae['query']);_0x21a074[_0x3fc0('0x38')]=_[_0x3fc0('0x39')](_0x21a074[_0x3fc0('0x36')],_0x21a074[_0x3fc0('0x37')]);_0x181948[_0x3fc0('0x3a')]=_['intersection'](_0x21a074[_0x3fc0('0x36')],qs[_0x3fc0('0x3b')](_0xd9ecae[_0x3fc0('0x37')]['fields']));_0x181948[_0x3fc0('0x3a')]=_0x181948[_0x3fc0('0x3a')][_0x3fc0('0x3c')]?_0x181948[_0x3fc0('0x3a')]:_0x21a074['model'];if(!_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x3d')]('nolimit')){_0x181948[_0x3fc0('0x22')]=qs['limit'](_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x22')]);_0x181948[_0x3fc0('0x21')]=qs[_0x3fc0('0x21')](_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x21')]);}_0x181948[_0x3fc0('0x3e')]=qs[_0x3fc0('0x3f')](_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x3f')]);_0x181948[_0x3fc0('0x40')]=qs['filters'](_[_0x3fc0('0x41')](_0xd9ecae[_0x3fc0('0x37')],_0x21a074[_0x3fc0('0x38')]));if(_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x42')]){_0x181948[_0x3fc0('0x40')]=_['merge'](_0x181948['where'],{'$or':_[_0x3fc0('0x32')](_0x48c8a8,function(_0x3386d2){if(_0x3386d2[_0x3fc0('0x43')]!==_0x3fc0('0x44')){var _0xf34450={};_0xf34450[_0x3386d2['name']]={'$like':'%'+_0xd9ecae['query']['filter']+'%'};return _0xf34450;}})});}_0x181948=_[_0x3fc0('0x45')]({},_0x181948,_0xd9ecae[_0x3fc0('0x46')]);var _0x40ead6={'where':_0x181948['where']};return db['Dashboard'][_0x3fc0('0x20')](_0x40ead6)[_0x3fc0('0x29')](function(_0x320878){_0x3f1a75[_0x3fc0('0x20')]=_0x320878;if(_0xd9ecae['query']['includeAll']){_0x181948[_0x3fc0('0x47')]=[{'all':!![]}];}return db[_0x3fc0('0x33')]['findAll'](_0x181948);})[_0x3fc0('0x29')](function(_0x5ad073){_0x3f1a75[_0x3fc0('0x48')]=_0x5ad073;return _0x3f1a75;})[_0x3fc0('0x29')](respondWithFilteredResult(_0x2351c8,_0x181948))[_0x3fc0('0x49')](handleError(_0x2351c8,null));};exports[_0x3fc0('0x4a')]=function(_0x2d01e9,_0x38e449){var _0x80dfee={'raw':![],'where':{'id':_0x2d01e9['params']['id']}},_0x1b3b70={};_0x1b3b70[_0x3fc0('0x36')]=_['keys'](db[_0x3fc0('0x33')][_0x3fc0('0x4b')]);_0x1b3b70[_0x3fc0('0x37')]=_[_0x3fc0('0x4c')](_0x2d01e9[_0x3fc0('0x37')]);_0x1b3b70['filters']=_[_0x3fc0('0x39')](_0x1b3b70[_0x3fc0('0x36')],_0x1b3b70[_0x3fc0('0x37')]);_0x80dfee[_0x3fc0('0x3a')]=_['intersection'](_0x1b3b70[_0x3fc0('0x36')],qs['fields'](_0x2d01e9[_0x3fc0('0x37')][_0x3fc0('0x3b')]));_0x80dfee[_0x3fc0('0x3a')]=_0x80dfee[_0x3fc0('0x3a')][_0x3fc0('0x3c')]?_0x80dfee['attributes']:_0x1b3b70[_0x3fc0('0x36')];if(_0x2d01e9[_0x3fc0('0x37')][_0x3fc0('0x4d')]){_0x80dfee['include']=[{'all':!![]}];}_0x80dfee=_[_0x3fc0('0x45')]({},_0x80dfee,_0x2d01e9[_0x3fc0('0x46')]);return db['Dashboard'][_0x3fc0('0x4e')](_0x80dfee)[_0x3fc0('0x29')](handleEntityNotFound(_0x38e449,null))[_0x3fc0('0x29')](respondWithResult(_0x38e449,null))['catch'](handleError(_0x38e449,null));};exports['create']=function(_0x3a35ac,_0xa3de5a){return db[_0x3fc0('0x33')]['create'](_0x3a35ac[_0x3fc0('0x4f')],{})['then'](function(_0x40dbf3){var _0x5443dc=_0x3a35ac['user']['get']({'plain':!![]});if(!_0x5443dc)throw new Error(_0x3fc0('0x50'));if(_0x5443dc[_0x3fc0('0x51')]===_0x3fc0('0x52')){var _0x3730f5=_0x40dbf3[_0x3fc0('0x2b')]({'plain':!![]});var _0x16023b='CustomDashboards';return db[_0x3fc0('0x53')][_0x3fc0('0x4e')]({'where':{'name':_0x16023b,'userProfileId':_0x5443dc['userProfileId']},'raw':!![]})['then'](function(_0x74ae6a){if(_0x74ae6a&&_0x74ae6a[_0x3fc0('0x54')]===0x0){return db[_0x3fc0('0x2d')][_0x3fc0('0x55')]({'name':_0x3730f5[_0x3fc0('0x30')],'resourceId':_0x3730f5['id'],'type':_0x74ae6a[_0x3fc0('0x30')],'sectionId':_0x74ae6a['id']},{})[_0x3fc0('0x29')](function(){return _0x40dbf3;});}else{return _0x40dbf3;}})[_0x3fc0('0x49')](function(_0x2e6725){logger[_0x3fc0('0x2e')](_0x3fc0('0x56'),_0x2e6725);throw _0x2e6725;});}return _0x40dbf3;})[_0x3fc0('0x29')](respondWithResult(_0xa3de5a,0xc9))['catch'](handleError(_0xa3de5a,null));};exports[_0x3fc0('0x57')]=function(_0xda5d3e,_0x24ee40){var _0x1dfd2c={'where':{'id':_0xda5d3e['params']['id']}},_0x42645c={};_0x42645c[_0x3fc0('0x36')]=_['keys'](db[_0x3fc0('0x33')][_0x3fc0('0x4b')]);_0x1dfd2c[_0x3fc0('0x3a')]=_[_0x3fc0('0x39')](_0x42645c['model'],qs[_0x3fc0('0x3b')](_0xda5d3e[_0x3fc0('0x37')][_0x3fc0('0x3b')]));_0x1dfd2c[_0x3fc0('0x3a')]=_0x1dfd2c[_0x3fc0('0x3a')][_0x3fc0('0x3c')]?_0x1dfd2c['attributes']:_0x42645c[_0x3fc0('0x36')];if(_0xda5d3e[_0x3fc0('0x37')][_0x3fc0('0x4d')]){_0x1dfd2c[_0x3fc0('0x47')]=[{'all':!![]}];}_0x1dfd2c=_[_0x3fc0('0x45')]({},_0x1dfd2c,_0xda5d3e[_0x3fc0('0x46')]);return db['Dashboard'][_0x3fc0('0x4e')](_0x1dfd2c)[_0x3fc0('0x29')](handleEntityNotFound(_0x24ee40,null))[_0x3fc0('0x29')](function(_0x5a3732){if(_0x5a3732){var _0x2cc735=_0x5a3732[_0x3fc0('0x2b')]({'plain':!![]});_0x2cc735=qs[_0x3fc0('0x58')](_0x2cc735,['id',_0x3fc0('0x59'),_0x3fc0('0x5a')]);_0xda5d3e[_0x3fc0('0x4f')]=_[_0x3fc0('0x58')](_0xda5d3e[_0x3fc0('0x4f')],['id',_0x3fc0('0x59'),_0x3fc0('0x5a')]);return db[_0x3fc0('0x33')][_0x3fc0('0x55')](_[_0x3fc0('0x45')](_0x2cc735,_0xda5d3e[_0x3fc0('0x4f')]),{'include':_0xda5d3e[_0x3fc0('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x3fc0('0x29')](function(_0x13be8e){var _0x374d81=_0xda5d3e[_0x3fc0('0x52')][_0x3fc0('0x2b')]({'plain':!![]});if(!_0x374d81)throw new Error(_0x3fc0('0x50'));if(_0x374d81[_0x3fc0('0x51')]===_0x3fc0('0x52')){var _0x1c7d11=_0x13be8e[_0x3fc0('0x2b')]({'plain':!![]});var _0x5a9ad5=_0x3fc0('0x2c');return db[_0x3fc0('0x53')][_0x3fc0('0x4e')]({'where':{'name':_0x5a9ad5,'userProfileId':_0x374d81[_0x3fc0('0x5b')]},'raw':!![]})[_0x3fc0('0x29')](function(_0x32b653){if(_0x32b653&&_0x32b653['autoAssociation']===0x0){return db[_0x3fc0('0x2d')][_0x3fc0('0x55')]({'name':_0x1c7d11[_0x3fc0('0x30')],'resourceId':_0x1c7d11['id'],'type':_0x32b653['name'],'sectionId':_0x32b653['id']},{})[_0x3fc0('0x29')](function(){return _0x13be8e;});}else{return _0x13be8e;}})[_0x3fc0('0x49')](function(_0x2f8b6b){logger[_0x3fc0('0x2e')](_0x3fc0('0x56'),_0x2f8b6b);throw _0x2f8b6b;});}return _0x13be8e;});}})[_0x3fc0('0x29')](respondWithResult(_0x24ee40,0xc9))[_0x3fc0('0x49')](handleError(_0x24ee40,null));};exports[_0x3fc0('0x28')]=function(_0x139971,_0x5ea7e7){if(_0x139971[_0x3fc0('0x4f')]['id']){delete _0x139971[_0x3fc0('0x4f')]['id'];}return db[_0x3fc0('0x33')][_0x3fc0('0x4e')]({'where':{'id':_0x139971[_0x3fc0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5ea7e7,null))[_0x3fc0('0x29')](saveUpdates(_0x139971[_0x3fc0('0x4f')],null))[_0x3fc0('0x29')](respondWithResult(_0x5ea7e7,null))[_0x3fc0('0x49')](handleError(_0x5ea7e7,null));};exports[_0x3fc0('0x2a')]=function(_0x20e372,_0x1da3dc){return db[_0x3fc0('0x33')][_0x3fc0('0x4e')]({'where':{'id':_0x20e372[_0x3fc0('0x5c')]['id']}})[_0x3fc0('0x29')](handleEntityNotFound(_0x1da3dc,null))['then'](removeEntity(_0x1da3dc,null))[_0x3fc0('0x49')](handleError(_0x1da3dc,null));};function widgetAttributes(_0x4f667b){try{switch(_0x4f667b[_0x3fc0('0x43')]){case _0x3fc0('0x5d'):return[{'name':_0x3fc0('0x5e'),'value':_0x4f667b[_0x3fc0('0x5e')]||(_0x4f667b['attrs']&&_0x4f667b['attrs'][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||'https://'}];case _0x3fc0('0x61'):return[{'name':_0x3fc0('0x62'),'value':_0x4f667b['attrPath']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0]['value']:undefined)||''}];case _0x3fc0('0x63'):return[{'name':_0x3fc0('0x64'),'value':_0x4f667b[_0x3fc0('0x64')]||(_0x4f667b['attrs']&&_0x4f667b['attrs'][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||_0x3fc0('0x65')},{'name':_0x3fc0('0x66'),'value':_0x4f667b[_0x3fc0('0x66')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b[_0x3fc0('0x5f')][0x1][_0x3fc0('0x60')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x4f667b[_0x3fc0('0x67')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x2]?_0x4f667b[_0x3fc0('0x5f')][0x2][_0x3fc0('0x60')]:undefined)||0xc}];case _0x3fc0('0x68'):return[{'name':'attrMetric','value':_0x4f667b['attrMetric']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||'total'},{'name':_0x3fc0('0x69'),'value':_0x4f667b[_0x3fc0('0x69')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b['attrs'][0x1][_0x3fc0('0x60')]:undefined)||[]},{'name':_0x3fc0('0x67'),'value':_0x4f667b['attrFontSize']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x2]?_0x4f667b[_0x3fc0('0x5f')][0x2]['value']:undefined)||0x14}];case _0x3fc0('0x6a'):case _0x3fc0('0x6b'):return[{'name':'attrSerie1','value':_0x4f667b['attrSerie1']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b['attrs'][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||_0x3fc0('0x6c')},{'name':_0x3fc0('0x6d'),'value':_0x4f667b['attrSerie2']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b[_0x3fc0('0x5f')][0x1][_0x3fc0('0x60')]:undefined)||null},{'name':_0x3fc0('0x6e'),'value':_0x4f667b['attrSerie3']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b['attrs'][0x2]?_0x4f667b[_0x3fc0('0x5f')][0x2][_0x3fc0('0x60')]:undefined)||null},{'name':_0x3fc0('0x69'),'value':_0x4f667b[_0x3fc0('0x69')]||(_0x4f667b['attrs']&&_0x4f667b['attrs'][0x3]?_0x4f667b[_0x3fc0('0x5f')][0x3][_0x3fc0('0x60')]:undefined)||[]}];case _0x3fc0('0x6f'):return[{'name':_0x3fc0('0x70'),'type':_0x4f667b[_0x3fc0('0x71')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x43')]:undefined)||null,'value':_0x4f667b[_0x3fc0('0x70')]||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b['attrs'][0x0][_0x3fc0('0x60')]:undefined)||null},{'name':_0x3fc0('0x72'),'value':_0x4f667b['attrRefresh']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b['attrs'][0x1][_0x3fc0('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x418c85){logger[_0x3fc0('0x2e')](_0x3fc0('0x73'),JSON[_0x3fc0('0x74')](_0x418c85));return[];}}exports[_0x3fc0('0x75')]=function(_0x5a1373,_0x553789,_0x59f8c3){if(_0x5a1373['body']['id']){delete _0x5a1373[_0x3fc0('0x4f')]['id'];}return db[_0x3fc0('0x33')][_0x3fc0('0x4e')]({'where':{'id':_0x5a1373[_0x3fc0('0x5c')]['id']}})[_0x3fc0('0x29')](handleEntityNotFound(_0x553789,null))['then'](function(_0x423911){if(_0x423911){_0x5a1373[_0x3fc0('0x4f')][_0x3fc0('0x76')]=_0x423911['id'];_0x5a1373[_0x3fc0('0x4f')][_0x3fc0('0x5f')]=widgetAttributes(_0x5a1373[_0x3fc0('0x4f')]);return db[_0x3fc0('0x77')][_0x3fc0('0x55')](_0x5a1373[_0x3fc0('0x4f')]);}})[_0x3fc0('0x29')](respondWithResult(_0x553789,null))['catch'](handleError(_0x553789,null));};exports[_0x3fc0('0x78')]=function(_0x2bd1d3,_0x33d0ac,_0x309e7f){var _0x57f884={};var _0x38bdf7={};var _0x145913;var _0x287702;return db[_0x3fc0('0x33')][_0x3fc0('0x79')]({'where':{'id':_0x2bd1d3[_0x3fc0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33d0ac,null))[_0x3fc0('0x29')](function(_0x5a149d){if(_0x5a149d){_0x145913=_0x5a149d;_0x38bdf7[_0x3fc0('0x36')]=_[_0x3fc0('0x4c')](db[_0x3fc0('0x77')]['rawAttributes']);_0x38bdf7[_0x3fc0('0x37')]=_[_0x3fc0('0x4c')](_0x2bd1d3[_0x3fc0('0x37')]);_0x38bdf7['filters']=_['intersection'](_0x38bdf7[_0x3fc0('0x36')],_0x38bdf7[_0x3fc0('0x37')]);_0x57f884['attributes']=_[_0x3fc0('0x39')](_0x38bdf7[_0x3fc0('0x36')],qs[_0x3fc0('0x3b')](_0x2bd1d3['query'][_0x3fc0('0x3b')]));_0x57f884[_0x3fc0('0x3a')]=_0x57f884['attributes'][_0x3fc0('0x3c')]?_0x57f884['attributes']:_0x38bdf7[_0x3fc0('0x36')];_0x57f884[_0x3fc0('0x3e')]=qs[_0x3fc0('0x3f')](_0x2bd1d3[_0x3fc0('0x37')][_0x3fc0('0x3f')]);_0x57f884[_0x3fc0('0x40')]=qs[_0x3fc0('0x38')](_[_0x3fc0('0x41')](_0x2bd1d3['query'],_0x38bdf7['filters']));if(_0x2bd1d3[_0x3fc0('0x37')][_0x3fc0('0x42')]){_0x57f884['where']=_[_0x3fc0('0x45')](_0x57f884[_0x3fc0('0x40')],{'$or':_['map'](_0x57f884['attributes'],function(_0x42290a){var _0x3e6433={};_0x3e6433[_0x42290a]={'$like':'%'+_0x2bd1d3['query']['filter']+'%'};return _0x3e6433;})});}_0x57f884=_[_0x3fc0('0x45')]({},_0x57f884,_0x2bd1d3[_0x3fc0('0x46')]);return _0x145913[_0x3fc0('0x78')](_0x57f884);}})[_0x3fc0('0x29')](function(_0x278afe){if(_0x278afe){_0x287702=_0x278afe[_0x3fc0('0x3c')];if(!_0x2bd1d3[_0x3fc0('0x37')][_0x3fc0('0x3d')](_0x3fc0('0x7a'))){_0x57f884[_0x3fc0('0x22')]=qs[_0x3fc0('0x22')](_0x2bd1d3['query'][_0x3fc0('0x22')]);_0x57f884[_0x3fc0('0x21')]=qs[_0x3fc0('0x21')](_0x2bd1d3[_0x3fc0('0x37')]['offset']);}return _0x145913[_0x3fc0('0x78')](_0x57f884);}})[_0x3fc0('0x29')](function(_0x13244b){if(_0x13244b){return _0x13244b?{'count':_0x287702,'rows':_0x13244b}:null;}})[_0x3fc0('0x29')](respondWithResult(_0x33d0ac,null))[_0x3fc0('0x49')](handleError(_0x33d0ac,null));};
\ No newline at end of file