Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / userNotification / userNotification.controller.js
index 700b583..20ce093 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88f2=['sortBy','join','sequelize','transaction','create','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','union','ids','replace','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId'];(function(_0x487f45,_0x351377){var _0x80033e=function(_0x8b4537){while(--_0x8b4537){_0x487f45['push'](_0x487f45['shift']());}};_0x80033e(++_0x351377);}(_0x88f2,0x13d));var _0x288f=function(_0x5ca30a,_0x361f27){_0x5ca30a=_0x5ca30a-0x0;var _0x1af438=_0x88f2[_0x5ca30a];return _0x1af438;};'use strict';var emlformat=require(_0x288f('0x0'));var rimraf=require(_0x288f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x288f('0x2'));var rp=require(_0x288f('0x3'));var moment=require(_0x288f('0x4'));var BPromise=require(_0x288f('0x5'));var Mustache=require(_0x288f('0x6'));var util=require(_0x288f('0x7'));var path=require(_0x288f('0x8'));var sox=require(_0x288f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x288f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x288f('0xb'));var jsforce=require(_0x288f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x288f('0xd'));var querystring=require('querystring');var Papa=require(_0x288f('0xe'));var Redis=require(_0x288f('0xf'));var authService=require(_0x288f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x288f('0x11'));var hardwareService=require(_0x288f('0x12'));var logger=require(_0x288f('0x13'))(_0x288f('0x14'));var utils=require(_0x288f('0x15'));var config=require(_0x288f('0x16'));var licenseUtil=require(_0x288f('0x17'));var db=require(_0x288f('0x18'))['db'];config[_0x288f('0x19')]=_[_0x288f('0x1a')](config[_0x288f('0x19')],{'host':_0x288f('0x1b'),'port':0x18eb});var socket=require(_0x288f('0x1c'))(new Redis(config[_0x288f('0x19')]));require('./userNotification.socket')[_0x288f('0x1d')](socket);function respondWithStatusCode(_0x1a433b,_0x16fb4f){_0x16fb4f=_0x16fb4f||0xcc;return function(_0xb64cdf){if(_0xb64cdf){return _0x1a433b[_0x288f('0x1e')](_0x16fb4f);}return _0x1a433b['status'](_0x16fb4f)[_0x288f('0x1f')]();};}function respondWithResult(_0x41009d,_0x4ef948){_0x4ef948=_0x4ef948||0xc8;return function(_0x4ebafd){if(_0x4ebafd){return _0x41009d[_0x288f('0x20')](_0x4ef948)['json'](_0x4ebafd);}};}function respondWithFilteredResult(_0x32796c,_0x51071b){return function(_0x20e900){if(_0x20e900){var _0x4c56cb=typeof _0x51071b[_0x288f('0x21')]===_0x288f('0x22')&&typeof _0x51071b[_0x288f('0x23')]===_0x288f('0x22');var _0x248ef7=_0x20e900[_0x288f('0x24')];var _0x2ff1c3=_0x4c56cb?0x0:_0x51071b['offset'];var _0x1075cd=_0x4c56cb?_0x20e900[_0x288f('0x24')]:_0x51071b['offset']+_0x51071b[_0x288f('0x23')];var _0x4d6a48;if(_0x1075cd>=_0x248ef7){_0x1075cd=_0x248ef7;_0x4d6a48=0xc8;}else{_0x4d6a48=0xce;}_0x32796c[_0x288f('0x20')](_0x4d6a48);return _0x32796c[_0x288f('0x25')](_0x288f('0x26'),_0x2ff1c3+'-'+_0x1075cd+'/'+_0x248ef7)[_0x288f('0x27')](_0x20e900);}return null;};}function patchUpdates(_0x3fc3b2){return function(_0x1e568a){try{jsonpatch[_0x288f('0x28')](_0x1e568a,_0x3fc3b2,!![]);}catch(_0x1bf1b1){return BPromise[_0x288f('0x29')](_0x1bf1b1);}return _0x1e568a['save']();};}function saveUpdates(_0x9c1b32,_0x32f1a4){return function(_0x221e53){if(_0x221e53){return _0x221e53[_0x288f('0x2a')](_0x9c1b32)[_0x288f('0x2b')](function(_0x3ab02b){return _0x3ab02b;});}return null;};}function removeEntity(_0xf2d89b,_0x3d92b3){return function(_0x332eb8){if(_0x332eb8){return _0x332eb8[_0x288f('0x2c')]()['then'](function(){_0xf2d89b[_0x288f('0x20')](0xcc)[_0x288f('0x1f')]();});}};}function handleEntityNotFound(_0x214c93,_0x41de24){return function(_0x4f88f1){if(!_0x4f88f1){_0x214c93[_0x288f('0x1e')](0x194);}return _0x4f88f1;};}function handleError(_0x1edd41,_0x4f7f90){_0x4f7f90=_0x4f7f90||0x1f4;return function(_0x34b838){logger[_0x288f('0x2d')](_0x34b838[_0x288f('0x2e')]);if(_0x34b838[_0x288f('0x2f')]){delete _0x34b838[_0x288f('0x2f')];}_0x1edd41[_0x288f('0x20')](_0x4f7f90)['send'](_0x34b838);};}exports[_0x288f('0x30')]=function(_0x2a18a8,_0x28372e,_0x5a351e){if(!_0x2a18a8['body'][_0x288f('0x31')](_0x288f('0x32'))&&!_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x34'))){throw new db[(_0x288f('0x35'))][(_0x288f('0x36'))](_0x288f('0x37'));}else{if(_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x34'))&&!_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x38'))){throw new db[(_0x288f('0x35'))]['ValidationError'](_0x288f('0x39'));}if(!_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x3a'))){throw new db[(_0x288f('0x35'))][(_0x288f('0x36'))](_0x288f('0x3b'));}else{try{var _0xb215f4=JSON['parse'](_0x2a18a8[_0x288f('0x33')][_0x288f('0x3a')]);}catch(_0x2a875d){logger[_0x288f('0x2d')](_0x2a875d);throw new db[(_0x288f('0x35'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x485c3f=['chatqueue',_0x288f('0x3c'),_0x288f('0x3d'),_0x288f('0x3e'),_0x288f('0x3f'),_0x288f('0x40'),_0x288f('0x41'),_0x288f('0x42'),_0x288f('0x43')];if(_[_0x288f('0x44')](_0xb215f4,function(_0x5dbec8){return!_[_0x288f('0x45')](_0x485c3f,_0x5dbec8[_0x288f('0x46')][_0x288f('0x47')]());})){throw new db[(_0x288f('0x35'))][(_0x288f('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2931a5={};_0x2931a5[_0x288f('0x48')]=_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x48'))?_0x2a18a8[_0x288f('0x33')][_0x288f('0x48')]:_0x2a18a8[_0x288f('0x43')][_0x288f('0x49')];_0x2931a5['recipientsDescription']=_[_0x288f('0x4a')](_0x2a18a8[_0x288f('0x33')][_0x288f('0x4b')])?null:_0x2a18a8['body'][_0x288f('0x4b')];_0x2931a5[_0x288f('0x4c')]=_0x2a18a8['body'][_0x288f('0x4c')]||![];_0x2931a5[_0x288f('0x4d')]=_0x2a18a8[_0x288f('0x43')]['id'];return getContent(_0x2a18a8[_0x288f('0x33')])[_0x288f('0x2b')](function(_0x1acd7d){_0x2931a5[_0x288f('0x33')]=_0x1acd7d;return getRecipients(_0xb215f4);})[_0x288f('0x2b')](function(_0x250847){_0x2931a5[_0x288f('0x4e')]=_[_0x288f('0x4f')](_0x250847)[_0x288f('0x50')](',');return db[_0x288f('0x51')][_0x288f('0x52')](function(_0x1b4345){return db['UserNotification'][_0x288f('0x53')](_0x2931a5,{'raw':!![],'transaction':_0x1b4345})[_0x288f('0x2b')](function(_0x405066){var _0x1f54f6={'sender':_0x2931a5[_0x288f('0x48')],'description':_0x2931a5[_0x288f('0x4b')],'content':_0x2931a5['body'],'beep':_0x2931a5[_0x288f('0x4c')]};_0x250847[_0x288f('0x54')](function(_0x22c87f){_0x1f54f6[_0x288f('0x55')]=_0x22c87f;socket['emit']('userNotification:send',_0x1f54f6);});return _0x405066;});});})[_0x288f('0x2b')](respondWithResult(_0x28372e,0xc9))[_0x288f('0x56')](handleError(_0x28372e,null));};function getContent(_0x342d50){return new BPromise(function(_0x201cbd,_0x445788){if(_0x342d50[_0x288f('0x32')]){_0x201cbd(_0x342d50[_0x288f('0x32')]);return;}return db[_0x288f('0x57')][_0x288f('0x58')]({'attributes':[_0x288f('0x59')],'where':{'id':_0x342d50[_0x288f('0x34')]},'raw':!![]})['then'](function(_0x1d7328){if(!_0x1d7328)throw new db['Sequelize'][(_0x288f('0x36'))](_0x288f('0x5a'));var _0x4addef=Mustache['render'](_0x1d7328[_0x288f('0x59')],_0x342d50[_0x288f('0x38')]);_0x201cbd(_0x4addef);})[_0x288f('0x56')](function(_0x1df1b8){_0x445788(_0x1df1b8);});});}function getRecipients(_0x198577){return new BPromise(function(_0x1e7c0d,_0x228cb3){var _0x205f2a=[];var _0x2dcd05=[];_0x198577['forEach'](function(_0x3a822b){var _0x496fd0=_['startCase'](_0x3a822b[_0x288f('0x46')]['toLowerCase']());if(_0x496fd0==='User'){_0x205f2a=_[_0x288f('0x5b')](_0x205f2a,_0x3a822b[_0x288f('0x5c')]);}else{if(_[_0x288f('0x45')](_0x496fd0,'queue'))_0x496fd0=_0x496fd0[_0x288f('0x5d')]('queue','Queue');_0x3a822b[_0x288f('0x5c')][_0x288f('0x54')](function(_0x390c6d){_0x2dcd05[_0x288f('0x5e')](getAgents(_0x496fd0,_0x390c6d));});}});return BPromise[_0x288f('0x5f')](_0x2dcd05)[_0x288f('0x2b')](function(_0x5aa73b){_0x205f2a=_[_0x288f('0x5b')](_0x205f2a,_[_0x288f('0x60')](_0x5aa73b));_0x1e7c0d(_0x205f2a);})[_0x288f('0x56')](function(_0x414058){_0x228cb3(_0x414058);});});}function getAgents(_0x5d816d,_0x127d35){return new BPromise(function(_0x44f962,_0x304fc7){return db[_0x5d816d][_0x288f('0x58')]({'where':{'id':_0x127d35}})['then'](function(_0x3e5039){return _0x3e5039[_0x288f('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40ac6f){var _0x55babf=_[_0x288f('0x62')](_0x40ac6f,'id');_0x44f962(_0x55babf);});})[_0x288f('0x56')](function(_0x28c8a9){_0x304fc7(_0x28c8a9);});});}
\ No newline at end of file
+var _0x133b=['ejs','fs-extra','lodash','squel','crypto','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','includes','replace','Queue','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3577e9,_0x55b49f){var _0x5e70ad=function(_0x2245b2){while(--_0x2245b2){_0x3577e9['push'](_0x3577e9['shift']());}};_0x5e70ad(++_0x55b49f);}(_0x133b,0xb2));var _0xb133=function(_0x56de75,_0x99fe2d){_0x56de75=_0x56de75-0x0;var _0x128fb5=_0x133b[_0x56de75];return _0x128fb5;};'use strict';var emlformat=require(_0xb133('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb133('0x1'));var jsonpatch=require(_0xb133('0x2'));var rp=require(_0xb133('0x3'));var moment=require(_0xb133('0x4'));var BPromise=require(_0xb133('0x5'));var Mustache=require(_0xb133('0x6'));var util=require(_0xb133('0x7'));var path=require(_0xb133('0x8'));var sox=require('sox');var csv=require(_0xb133('0x9'));var ejs=require(_0xb133('0xa'));var fs=require('fs');var fs_extra=require(_0xb133('0xb'));var _=require(_0xb133('0xc'));var squel=require(_0xb133('0xd'));var crypto=require(_0xb133('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb133('0xf'));var as=require(_0xb133('0x10'));var hardwareService=require(_0xb133('0x11'));var logger=require(_0xb133('0x12'))(_0xb133('0x13'));var utils=require(_0xb133('0x14'));var config=require(_0xb133('0x15'));var licenseUtil=require(_0xb133('0x16'));var db=require(_0xb133('0x17'))['db'];config[_0xb133('0x18')]=_[_0xb133('0x19')](config[_0xb133('0x18')],{'host':_0xb133('0x1a'),'port':0x18eb});var socket=require(_0xb133('0x1b'))(new Redis(config[_0xb133('0x18')]));require(_0xb133('0x1c'))[_0xb133('0x1d')](socket);function respondWithStatusCode(_0x34e4e1,_0x129ff2){_0x129ff2=_0x129ff2||0xcc;return function(_0x1e638c){if(_0x1e638c){return _0x34e4e1[_0xb133('0x1e')](_0x129ff2);}return _0x34e4e1['status'](_0x129ff2)['end']();};}function respondWithResult(_0x56e4c8,_0x1ee029){_0x1ee029=_0x1ee029||0xc8;return function(_0xd474a6){if(_0xd474a6){return _0x56e4c8['status'](_0x1ee029)[_0xb133('0x1f')](_0xd474a6);}};}function respondWithFilteredResult(_0x4cbcb4,_0x43ebed){return function(_0x2d89f1){if(_0x2d89f1){var _0x5ea5c1=typeof _0x43ebed[_0xb133('0x20')]===_0xb133('0x21')&&typeof _0x43ebed[_0xb133('0x22')]===_0xb133('0x21');var _0x32f4bb=_0x2d89f1[_0xb133('0x23')];var _0x24d62f=_0x5ea5c1?0x0:_0x43ebed[_0xb133('0x20')];var _0x388dd0=_0x5ea5c1?_0x2d89f1[_0xb133('0x23')]:_0x43ebed[_0xb133('0x20')]+_0x43ebed[_0xb133('0x22')];var _0x45bf94;if(_0x388dd0>=_0x32f4bb){_0x388dd0=_0x32f4bb;_0x45bf94=0xc8;}else{_0x45bf94=0xce;}_0x4cbcb4[_0xb133('0x24')](_0x45bf94);return _0x4cbcb4[_0xb133('0x25')]('Content-Range',_0x24d62f+'-'+_0x388dd0+'/'+_0x32f4bb)['json'](_0x2d89f1);}return null;};}function patchUpdates(_0x376dbc){return function(_0x4ff96a){try{jsonpatch[_0xb133('0x26')](_0x4ff96a,_0x376dbc,!![]);}catch(_0x5137f8){return BPromise['reject'](_0x5137f8);}return _0x4ff96a[_0xb133('0x27')]();};}function saveUpdates(_0x16c151,_0x3f1f18){return function(_0x1149fc){if(_0x1149fc){return _0x1149fc[_0xb133('0x28')](_0x16c151)[_0xb133('0x29')](function(_0x50b330){return _0x50b330;});}return null;};}function removeEntity(_0x35319d,_0x48900e){return function(_0x126d07){if(_0x126d07){return _0x126d07[_0xb133('0x2a')]()[_0xb133('0x29')](function(){_0x35319d[_0xb133('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x470866,_0x2167a1){return function(_0x339213){if(!_0x339213){_0x470866[_0xb133('0x1e')](0x194);}return _0x339213;};}function handleError(_0x414d3a,_0x2d7b24){_0x2d7b24=_0x2d7b24||0x1f4;return function(_0x594205){logger[_0xb133('0x2b')](_0x594205[_0xb133('0x2c')]);if(_0x594205[_0xb133('0x2d')]){delete _0x594205[_0xb133('0x2d')];}_0x414d3a[_0xb133('0x24')](_0x2d7b24)['send'](_0x594205);};}exports[_0xb133('0x2e')]=function(_0x592ee9,_0x40e007,_0x4b303b){if(!_0x592ee9[_0xb133('0x2f')][_0xb133('0x30')](_0xb133('0x31'))&&!_0x592ee9[_0xb133('0x2f')][_0xb133('0x30')](_0xb133('0x32'))){throw new db[(_0xb133('0x33'))][(_0xb133('0x34'))](_0xb133('0x35'));}else{if(_0x592ee9[_0xb133('0x2f')][_0xb133('0x30')](_0xb133('0x32'))&&!_0x592ee9[_0xb133('0x2f')][_0xb133('0x30')](_0xb133('0x36'))){throw new db[(_0xb133('0x33'))][(_0xb133('0x34'))](_0xb133('0x37'));}if(!_0x592ee9[_0xb133('0x2f')][_0xb133('0x30')]('recipients')){throw new db[(_0xb133('0x33'))][(_0xb133('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2966f8=JSON['parse'](_0x592ee9['body'][_0xb133('0x38')]);}catch(_0x2f6b02){logger[_0xb133('0x2b')](_0x2f6b02);throw new db[(_0xb133('0x33'))][(_0xb133('0x34'))](_0xb133('0x39'));}var _0x4f8f2f=[_0xb133('0x3a'),_0xb133('0x3b'),_0xb133('0x3c'),_0xb133('0x3d'),'smsqueue',_0xb133('0x3e'),_0xb133('0x3f'),_0xb133('0x40'),_0xb133('0x41')];if(_['some'](_0x2966f8,function(_0x5361f9){return!_['includes'](_0x4f8f2f,_0x5361f9[_0xb133('0x42')][_0xb133('0x43')]());})){throw new db[(_0xb133('0x33'))][(_0xb133('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x445254={};_0x445254[_0xb133('0x44')]=_0x592ee9['body'][_0xb133('0x30')](_0xb133('0x44'))?_0x592ee9[_0xb133('0x2f')][_0xb133('0x44')]:_0x592ee9['user']['fullname'];_0x445254[_0xb133('0x45')]=_[_0xb133('0x46')](_0x592ee9[_0xb133('0x2f')][_0xb133('0x45')])?null:_0x592ee9[_0xb133('0x2f')]['recipientsDescription'];_0x445254[_0xb133('0x47')]=_0x592ee9['body'][_0xb133('0x47')]||![];_0x445254['SenderId']=_0x592ee9['user']['id'];return getContent(_0x592ee9[_0xb133('0x2f')])[_0xb133('0x29')](function(_0xc7dc45){_0x445254[_0xb133('0x2f')]=_0xc7dc45;return getRecipients(_0x2966f8);})[_0xb133('0x29')](function(_0x4461a1){_0x445254[_0xb133('0x48')]=_[_0xb133('0x49')](_0x4461a1)[_0xb133('0x4a')](',');return db[_0xb133('0x4b')][_0xb133('0x4c')](function(_0x57db3b){return db[_0xb133('0x4d')]['create'](_0x445254,{'raw':!![],'transaction':_0x57db3b})[_0xb133('0x29')](function(_0x10f0d2){var _0x409c77={'sender':_0x445254[_0xb133('0x44')],'description':_0x445254[_0xb133('0x45')],'content':_0x445254[_0xb133('0x2f')],'beep':_0x445254[_0xb133('0x47')]};_0x4461a1[_0xb133('0x4e')](function(_0xe466c2){_0x409c77[_0xb133('0x4f')]=_0xe466c2;socket['emit']('userNotification:send',_0x409c77);});return _0x10f0d2;});});})[_0xb133('0x29')](respondWithResult(_0x40e007,0xc9))[_0xb133('0x50')](handleError(_0x40e007,null));};function getContent(_0x2dcfef){return new BPromise(function(_0x2a0a59,_0x2c9894){if(_0x2dcfef[_0xb133('0x31')]){_0x2a0a59(_0x2dcfef[_0xb133('0x31')]);return;}return db[_0xb133('0x51')][_0xb133('0x52')]({'attributes':[_0xb133('0x53')],'where':{'id':_0x2dcfef['TemplateId']},'raw':!![]})[_0xb133('0x29')](function(_0x320ef9){if(!_0x320ef9)throw new db['Sequelize'][(_0xb133('0x34'))](_0xb133('0x54'));var _0x35e288=Mustache['render'](_0x320ef9['html'],_0x2dcfef[_0xb133('0x36')]);_0x2a0a59(_0x35e288);})['catch'](function(_0x149080){_0x2c9894(_0x149080);});});}function getRecipients(_0xe36a05){return new BPromise(function(_0x1f008a,_0x4b2579){var _0x45b5c2=[];var _0x51216a=[];_0xe36a05[_0xb133('0x4e')](function(_0x3f5d1e){var _0x57a1dd=_[_0xb133('0x55')](_0x3f5d1e[_0xb133('0x42')][_0xb133('0x43')]());if(_0x57a1dd===_0xb133('0x56')){_0x45b5c2=_[_0xb133('0x57')](_0x45b5c2,_0x3f5d1e[_0xb133('0x58')]);}else{if(_[_0xb133('0x59')](_0x57a1dd,'queue'))_0x57a1dd=_0x57a1dd[_0xb133('0x5a')]('queue',_0xb133('0x5b'));_0x3f5d1e['ids'][_0xb133('0x4e')](function(_0x399998){_0x51216a['push'](getAgents(_0x57a1dd,_0x399998));});}});return BPromise['all'](_0x51216a)[_0xb133('0x29')](function(_0x2855fc){_0x45b5c2=_[_0xb133('0x57')](_0x45b5c2,_['flatten'](_0x2855fc));_0x1f008a(_0x45b5c2);})[_0xb133('0x50')](function(_0xb21978){_0x4b2579(_0xb21978);});});}function getAgents(_0x47e5dc,_0x5cdc70){return new BPromise(function(_0x3addb9,_0x1e7085){return db[_0x47e5dc][_0xb133('0x52')]({'where':{'id':_0x5cdc70}})[_0xb133('0x29')](function(_0x4143d9){return _0x4143d9[_0xb133('0x5c')]({'attributes':['id'],'raw':!![]})[_0xb133('0x29')](function(_0x33a631){var _0x276f73=_[_0xb133('0x5d')](_0x33a631,'id');_0x3addb9(_0x276f73);});})[_0xb133('0x50')](function(_0xccebe5){_0x1e7085(_0xccebe5);});});}
\ No newline at end of file