Built motion from commit 14588770.|2.5.38
[motion2.git] / server / api / userNotification / userNotification.controller.js
index 40fd299..8e81e2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x05cd=['body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Sequelize','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','union','ids','replace','queue','Queue','push','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x05cd,0x1d5));var _0xd05c=function(_0xa029a,_0x2771d5){_0xa029a=_0xa029a-0x0;var _0x495458=_0x05cd[_0xa029a];return _0x495458;};'use strict';var emlformat=require(_0xd05c('0x0'));var rimraf=require(_0xd05c('0x1'));var zipdir=require(_0xd05c('0x2'));var jsonpatch=require(_0xd05c('0x3'));var rp=require(_0xd05c('0x4'));var moment=require(_0xd05c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd05c('0x6'));var path=require(_0xd05c('0x7'));var sox=require(_0xd05c('0x8'));var csv=require(_0xd05c('0x9'));var ejs=require(_0xd05c('0xa'));var fs=require('fs');var fs_extra=require(_0xd05c('0xb'));var _=require('lodash');var squel=require(_0xd05c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd05c('0xd'));var deskjs=require(_0xd05c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd05c('0xf'));var Papa=require(_0xd05c('0x10'));var Redis=require(_0xd05c('0x11'));var authService=require(_0xd05c('0x12'));var qs=require(_0xd05c('0x13'));var as=require(_0xd05c('0x14'));var hardwareService=require(_0xd05c('0x15'));var logger=require('../../config/logger')(_0xd05c('0x16'));var utils=require(_0xd05c('0x17'));var config=require(_0xd05c('0x18'));var licenseUtil=require(_0xd05c('0x19'));var db=require(_0xd05c('0x1a'))['db'];config[_0xd05c('0x1b')]=_[_0xd05c('0x1c')](config[_0xd05c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd05c('0x1d'))(new Redis(config[_0xd05c('0x1b')]));require(_0xd05c('0x1e'))[_0xd05c('0x1f')](socket);function respondWithStatusCode(_0x200b15,_0x17526b){_0x17526b=_0x17526b||0xcc;return function(_0x5ef217){if(_0x5ef217){return _0x200b15[_0xd05c('0x20')](_0x17526b);}return _0x200b15[_0xd05c('0x21')](_0x17526b)[_0xd05c('0x22')]();};}function respondWithResult(_0x3f2a03,_0x96d3a3){_0x96d3a3=_0x96d3a3||0xc8;return function(_0x281204){if(_0x281204){return _0x3f2a03['status'](_0x96d3a3)[_0xd05c('0x23')](_0x281204);}};}function respondWithFilteredResult(_0x274198,_0x3962a8){return function(_0x1ebb66){if(_0x1ebb66){var _0x4eaf49=typeof _0x3962a8[_0xd05c('0x24')]===_0xd05c('0x25')&&typeof _0x3962a8[_0xd05c('0x26')]===_0xd05c('0x25');var _0x316dbe=_0x1ebb66[_0xd05c('0x27')];var _0x7e6908=_0x4eaf49?0x0:_0x3962a8['offset'];var _0x49ab92=_0x4eaf49?_0x1ebb66['count']:_0x3962a8[_0xd05c('0x24')]+_0x3962a8['limit'];var _0x2fdf68;if(_0x49ab92>=_0x316dbe){_0x49ab92=_0x316dbe;_0x2fdf68=0xc8;}else{_0x2fdf68=0xce;}_0x274198[_0xd05c('0x21')](_0x2fdf68);return _0x274198['set']('Content-Range',_0x7e6908+'-'+_0x49ab92+'/'+_0x316dbe)[_0xd05c('0x23')](_0x1ebb66);}return null;};}function patchUpdates(_0x7bddcf){return function(_0x37dc6f){try{jsonpatch[_0xd05c('0x28')](_0x37dc6f,_0x7bddcf,!![]);}catch(_0x5a3f0f){return BPromise[_0xd05c('0x29')](_0x5a3f0f);}return _0x37dc6f[_0xd05c('0x2a')]();};}function saveUpdates(_0x300680,_0x1b007d){return function(_0x1eb14){if(_0x1eb14){return _0x1eb14[_0xd05c('0x2b')](_0x300680)[_0xd05c('0x2c')](function(_0x481600){return _0x481600;});}return null;};}function removeEntity(_0x79a974,_0x2bb908){return function(_0x706860){if(_0x706860){return _0x706860[_0xd05c('0x2d')]()['then'](function(){_0x79a974[_0xd05c('0x21')](0xcc)[_0xd05c('0x22')]();});}};}function handleEntityNotFound(_0x11cf1b,_0x54b119){return function(_0x23d7c1){if(!_0x23d7c1){_0x11cf1b[_0xd05c('0x20')](0x194);}return _0x23d7c1;};}function handleError(_0x229da8,_0x441990){_0x441990=_0x441990||0x1f4;return function(_0x1fa91e){logger[_0xd05c('0x2e')](_0x1fa91e[_0xd05c('0x2f')]);if(_0x1fa91e[_0xd05c('0x30')]){delete _0x1fa91e[_0xd05c('0x30')];}_0x229da8['status'](_0x441990)[_0xd05c('0x31')](_0x1fa91e);};}exports[_0xd05c('0x32')]=function(_0x2b1963,_0x5a5725,_0x3fa3a){if(!_0x2b1963[_0xd05c('0x33')]['hasOwnProperty'](_0xd05c('0x34'))&&!_0x2b1963[_0xd05c('0x33')][_0xd05c('0x35')](_0xd05c('0x36'))){throw new db['Sequelize'][(_0xd05c('0x37'))](_0xd05c('0x38'));}else{if(_0x2b1963[_0xd05c('0x33')]['hasOwnProperty'](_0xd05c('0x36'))&&!_0x2b1963['body'][_0xd05c('0x35')]('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x2b1963[_0xd05c('0x33')]['hasOwnProperty'](_0xd05c('0x39'))){throw new db['Sequelize'][(_0xd05c('0x37'))](_0xd05c('0x3a'));}else{try{var _0xddc69c=JSON[_0xd05c('0x3b')](_0x2b1963[_0xd05c('0x33')]['recipients']);}catch(_0x21ea09){logger[_0xd05c('0x2e')](_0x21ea09);throw new db[(_0xd05c('0x3c'))][(_0xd05c('0x37'))](_0xd05c('0x3d'));}var _0x4d5f90=[_0xd05c('0x3e'),_0xd05c('0x3f'),_0xd05c('0x40'),_0xd05c('0x41'),_0xd05c('0x42'),_0xd05c('0x43'),_0xd05c('0x44'),_0xd05c('0x45'),_0xd05c('0x46')];if(_[_0xd05c('0x47')](_0xddc69c,function(_0x57255a){return!_[_0xd05c('0x48')](_0x4d5f90,_0x57255a[_0xd05c('0x49')]['toLowerCase']());})){throw new db[(_0xd05c('0x3c'))][(_0xd05c('0x37'))](_0xd05c('0x4a'));}}}var _0x4255ce={};_0x4255ce[_0xd05c('0x4b')]=_0x2b1963['body'][_0xd05c('0x35')](_0xd05c('0x4b'))?_0x2b1963[_0xd05c('0x33')][_0xd05c('0x4b')]:_0x2b1963[_0xd05c('0x46')][_0xd05c('0x4c')];_0x4255ce[_0xd05c('0x4d')]=_[_0xd05c('0x4e')](_0x2b1963['body'][_0xd05c('0x4d')])?null:_0x2b1963[_0xd05c('0x33')]['recipientsDescription'];_0x4255ce[_0xd05c('0x4f')]=_0x2b1963[_0xd05c('0x33')][_0xd05c('0x4f')]||![];_0x4255ce[_0xd05c('0x50')]=_0x2b1963[_0xd05c('0x46')]['id'];return getContent(_0x2b1963[_0xd05c('0x33')])[_0xd05c('0x2c')](function(_0x5bb5dc){_0x4255ce[_0xd05c('0x33')]=_0x5bb5dc;return getRecipients(_0xddc69c);})[_0xd05c('0x2c')](function(_0x558ba7){_0x4255ce[_0xd05c('0x51')]=_[_0xd05c('0x52')](_0x558ba7)[_0xd05c('0x53')](',');return db['sequelize']['transaction'](function(_0x28f0e0){return db['UserNotification'][_0xd05c('0x54')](_0x4255ce,{'raw':!![],'transaction':_0x28f0e0})[_0xd05c('0x2c')](function(_0x5b0806){var _0x5ac5e3={'sender':_0x4255ce[_0xd05c('0x4b')],'description':_0x4255ce[_0xd05c('0x4d')],'content':_0x4255ce['body'],'beep':_0x4255ce[_0xd05c('0x4f')]};_0x558ba7[_0xd05c('0x55')](function(_0x170a3d){_0x5ac5e3[_0xd05c('0x56')]=_0x170a3d;socket['emit'](_0xd05c('0x57'),_0x5ac5e3);});return _0x5b0806;});});})[_0xd05c('0x2c')](respondWithResult(_0x5a5725,0xc9))[_0xd05c('0x58')](handleError(_0x5a5725,null));};function getContent(_0x55bf51){return new BPromise(function(_0x30be20,_0x4d385d){if(_0x55bf51[_0xd05c('0x34')]){_0x30be20(_0x55bf51['text']);return;}return db[_0xd05c('0x59')][_0xd05c('0x5a')]({'attributes':[_0xd05c('0x5b')],'where':{'id':_0x55bf51[_0xd05c('0x36')]},'raw':!![]})['then'](function(_0x21bb71){if(!_0x21bb71)throw new db[(_0xd05c('0x3c'))]['ValidationError'](_0xd05c('0x5c'));var _0x5dc4e7=Mustache[_0xd05c('0x5d')](_0x21bb71[_0xd05c('0x5b')],_0x55bf51['view']);_0x30be20(_0x5dc4e7);})[_0xd05c('0x58')](function(_0x2c1eba){_0x4d385d(_0x2c1eba);});});}function getRecipients(_0x11f313){return new BPromise(function(_0x46fe29,_0x39c870){var _0x4c8b45=[];var _0x35975e=[];_0x11f313[_0xd05c('0x55')](function(_0x1edd9d){var _0x21900d=_['startCase'](_0x1edd9d['model'][_0xd05c('0x5e')]());if(_0x21900d===_0xd05c('0x5f')){_0x4c8b45=_[_0xd05c('0x60')](_0x4c8b45,_0x1edd9d[_0xd05c('0x61')]);}else{if(_[_0xd05c('0x48')](_0x21900d,'queue'))_0x21900d=_0x21900d[_0xd05c('0x62')](_0xd05c('0x63'),_0xd05c('0x64'));_0x1edd9d[_0xd05c('0x61')]['forEach'](function(_0x2572e3){_0x35975e[_0xd05c('0x65')](getAgents(_0x21900d,_0x2572e3));});}});return BPromise['all'](_0x35975e)['then'](function(_0x30326d){_0x4c8b45=_[_0xd05c('0x60')](_0x4c8b45,_['flatten'](_0x30326d));_0x46fe29(_0x4c8b45);})[_0xd05c('0x58')](function(_0x86dc73){_0x39c870(_0x86dc73);});});}function getAgents(_0x1dda05,_0x507084){return new BPromise(function(_0x7a65a9,_0x1a52a6){return db[_0x1dda05][_0xd05c('0x5a')]({'where':{'id':_0x507084}})[_0xd05c('0x2c')](function(_0x7cc34a){return _0x7cc34a[_0xd05c('0x66')]({'attributes':['id'],'raw':!![]})[_0xd05c('0x2c')](function(_0x47d1fb){var _0x119962=_[_0xd05c('0x67')](_0x47d1fb,'id');_0x7a65a9(_0x119962);});})['catch'](function(_0x5135b6){_0x1a52a6(_0x5135b6);});});}
\ No newline at end of file
+var _0x3f8b=['emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','toLowerCase','User','union','ids','queue','replace','Queue','forEach','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','view','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient'];(function(_0x479bbb,_0x3011d3){var _0x221754=function(_0x3b53e5){while(--_0x3b53e5){_0x479bbb['push'](_0x479bbb['shift']());}};_0x221754(++_0x3011d3);}(_0x3f8b,0xe5));var _0xb3f8=function(_0x710418,_0x123ee2){_0x710418=_0x710418-0x0;var _0x15d8ef=_0x3f8b[_0x710418];return _0x15d8ef;};'use strict';var emlformat=require(_0xb3f8('0x0'));var rimraf=require(_0xb3f8('0x1'));var zipdir=require(_0xb3f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb3f8('0x3'));var Mustache=require(_0xb3f8('0x4'));var util=require(_0xb3f8('0x5'));var path=require(_0xb3f8('0x6'));var sox=require('sox');var csv=require(_0xb3f8('0x7'));var ejs=require(_0xb3f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3f8('0x9'));var squel=require(_0xb3f8('0xa'));var crypto=require('crypto');var jsforce=require(_0xb3f8('0xb'));var deskjs=require(_0xb3f8('0xc'));var toCsv=require(_0xb3f8('0x7'));var querystring=require(_0xb3f8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3f8('0xe'));var qs=require(_0xb3f8('0xf'));var as=require(_0xb3f8('0x10'));var hardwareService=require(_0xb3f8('0x11'));var logger=require(_0xb3f8('0x12'))('api');var utils=require(_0xb3f8('0x13'));var config=require(_0xb3f8('0x14'));var licenseUtil=require(_0xb3f8('0x15'));var db=require(_0xb3f8('0x16'))['db'];config['redis']=_[_0xb3f8('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb3f8('0x18'))[_0xb3f8('0x19')](socket);function respondWithStatusCode(_0xa2076a,_0x5ca105){_0x5ca105=_0x5ca105||0xcc;return function(_0x1df4d3){if(_0x1df4d3){return _0xa2076a[_0xb3f8('0x1a')](_0x5ca105);}return _0xa2076a['status'](_0x5ca105)[_0xb3f8('0x1b')]();};}function respondWithResult(_0x3b5c93,_0x32289d){_0x32289d=_0x32289d||0xc8;return function(_0xeeda9){if(_0xeeda9){return _0x3b5c93[_0xb3f8('0x1c')](_0x32289d)[_0xb3f8('0x1d')](_0xeeda9);}};}function respondWithFilteredResult(_0x62836e,_0x1c996e){return function(_0x560743){if(_0x560743){var _0x2b4e7d=typeof _0x1c996e[_0xb3f8('0x1e')]===_0xb3f8('0x1f')&&typeof _0x1c996e[_0xb3f8('0x20')]===_0xb3f8('0x1f');var _0x183045=_0x560743[_0xb3f8('0x21')];var _0xec830=_0x2b4e7d?0x0:_0x1c996e['offset'];var _0x24b904=_0x2b4e7d?_0x560743['count']:_0x1c996e[_0xb3f8('0x1e')]+_0x1c996e['limit'];var _0x6ee3b1;if(_0x24b904>=_0x183045){_0x24b904=_0x183045;_0x6ee3b1=0xc8;}else{_0x6ee3b1=0xce;}_0x62836e[_0xb3f8('0x1c')](_0x6ee3b1);return _0x62836e[_0xb3f8('0x22')](_0xb3f8('0x23'),_0xec830+'-'+_0x24b904+'/'+_0x183045)['json'](_0x560743);}return null;};}function patchUpdates(_0x1b0181){return function(_0xb161b2){try{jsonpatch[_0xb3f8('0x24')](_0xb161b2,_0x1b0181,!![]);}catch(_0x260f0e){return BPromise[_0xb3f8('0x25')](_0x260f0e);}return _0xb161b2['save']();};}function saveUpdates(_0x52fe71,_0x5a4d2c){return function(_0x953267){if(_0x953267){return _0x953267[_0xb3f8('0x26')](_0x52fe71)['then'](function(_0x5c12e0){return _0x5c12e0;});}return null;};}function removeEntity(_0x5778ac,_0x5cbf0b){return function(_0x2cbac3){if(_0x2cbac3){return _0x2cbac3[_0xb3f8('0x27')]()['then'](function(){_0x5778ac[_0xb3f8('0x1c')](0xcc)[_0xb3f8('0x1b')]();});}};}function handleEntityNotFound(_0x3adaff,_0x459cdc){return function(_0x2c7be8){if(!_0x2c7be8){_0x3adaff['sendStatus'](0x194);}return _0x2c7be8;};}function handleError(_0x37c89a,_0x5ab9a8){_0x5ab9a8=_0x5ab9a8||0x1f4;return function(_0x29e62a){logger[_0xb3f8('0x28')](_0x29e62a[_0xb3f8('0x29')]);if(_0x29e62a[_0xb3f8('0x2a')]){delete _0x29e62a[_0xb3f8('0x2a')];}_0x37c89a[_0xb3f8('0x1c')](_0x5ab9a8)[_0xb3f8('0x2b')](_0x29e62a);};}exports['sendUserNotification']=function(_0x54a29f,_0x426a2d,_0x4973af){if(!_0x54a29f['body'][_0xb3f8('0x2c')](_0xb3f8('0x2d'))&&!_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x2c')](_0xb3f8('0x2f'))){throw new db[(_0xb3f8('0x30'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x2c')](_0xb3f8('0x2f'))&&!_0x54a29f['body']['hasOwnProperty'](_0xb3f8('0x31'))){throw new db[(_0xb3f8('0x30'))]['ValidationError'](_0xb3f8('0x32'));}if(!_0x54a29f[_0xb3f8('0x2e')]['hasOwnProperty'](_0xb3f8('0x33'))){throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x35'));}else{try{var _0x5ca69a=JSON[_0xb3f8('0x36')](_0x54a29f[_0xb3f8('0x2e')]['recipients']);}catch(_0x373776){logger[_0xb3f8('0x28')](_0x373776);throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x37'));}var _0x1467e5=[_0xb3f8('0x38'),_0xb3f8('0x39'),_0xb3f8('0x3a'),_0xb3f8('0x3b'),_0xb3f8('0x3c'),'voicequeue',_0xb3f8('0x3d'),_0xb3f8('0x3e'),_0xb3f8('0x3f')];if(_[_0xb3f8('0x40')](_0x5ca69a,function(_0x2739d9){return!_[_0xb3f8('0x41')](_0x1467e5,_0x2739d9[_0xb3f8('0x42')]['toLowerCase']());})){throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x43'));}}}var _0x42ed86={};_0x42ed86['senderName']=_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x2c')](_0xb3f8('0x44'))?_0x54a29f['body'][_0xb3f8('0x44')]:_0x54a29f[_0xb3f8('0x3f')][_0xb3f8('0x45')];_0x42ed86[_0xb3f8('0x46')]=_[_0xb3f8('0x47')](_0x54a29f[_0xb3f8('0x2e')]['recipientsDescription'])?null:_0x54a29f[_0xb3f8('0x2e')]['recipientsDescription'];_0x42ed86[_0xb3f8('0x48')]=_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x48')]||![];_0x42ed86[_0xb3f8('0x49')]=_0x54a29f[_0xb3f8('0x3f')]['id'];return getContent(_0x54a29f[_0xb3f8('0x2e')])[_0xb3f8('0x4a')](function(_0x1c0595){_0x42ed86['body']=_0x1c0595;return getRecipients(_0x5ca69a);})[_0xb3f8('0x4a')](function(_0x5a087a){_0x42ed86[_0xb3f8('0x4b')]=_[_0xb3f8('0x4c')](_0x5a087a)[_0xb3f8('0x4d')](',');return db[_0xb3f8('0x4e')][_0xb3f8('0x4f')](function(_0x1af2e3){return db[_0xb3f8('0x50')][_0xb3f8('0x51')](_0x42ed86,{'raw':!![],'transaction':_0x1af2e3})['then'](function(_0x1e510f){var _0x32b878={'sender':_0x42ed86['senderName'],'description':_0x42ed86[_0xb3f8('0x46')],'content':_0x42ed86[_0xb3f8('0x2e')],'beep':_0x42ed86['beep']};_0x5a087a['forEach'](function(_0x35047c){_0x32b878[_0xb3f8('0x52')]=_0x35047c;socket[_0xb3f8('0x53')](_0xb3f8('0x54'),_0x32b878);});return _0x1e510f;});});})[_0xb3f8('0x4a')](respondWithResult(_0x426a2d,0xc9))[_0xb3f8('0x55')](handleError(_0x426a2d,null));};function getContent(_0x3f7bb7){return new BPromise(function(_0x19a87f,_0x585e65){if(_0x3f7bb7[_0xb3f8('0x2d')]){_0x19a87f(_0x3f7bb7[_0xb3f8('0x2d')]);return;}return db[_0xb3f8('0x56')][_0xb3f8('0x57')]({'attributes':['html'],'where':{'id':_0x3f7bb7['TemplateId']},'raw':!![]})[_0xb3f8('0x4a')](function(_0x10d157){if(!_0x10d157)throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x58'));var _0xaceb05=Mustache[_0xb3f8('0x59')](_0x10d157[_0xb3f8('0x5a')],_0x3f7bb7['view']);_0x19a87f(_0xaceb05);})['catch'](function(_0x1439ce){_0x585e65(_0x1439ce);});});}function getRecipients(_0x38f787){return new BPromise(function(_0x5b4ea9,_0x4cc44c){var _0x4d0ebf=[];var _0x251ac0=[];_0x38f787['forEach'](function(_0x4543da){var _0x3897bf=_[_0xb3f8('0x5b')](_0x4543da[_0xb3f8('0x42')][_0xb3f8('0x5c')]());if(_0x3897bf===_0xb3f8('0x5d')){_0x4d0ebf=_[_0xb3f8('0x5e')](_0x4d0ebf,_0x4543da[_0xb3f8('0x5f')]);}else{if(_[_0xb3f8('0x41')](_0x3897bf,_0xb3f8('0x60')))_0x3897bf=_0x3897bf[_0xb3f8('0x61')](_0xb3f8('0x60'),_0xb3f8('0x62'));_0x4543da[_0xb3f8('0x5f')][_0xb3f8('0x63')](function(_0xeb773e){_0x251ac0['push'](getAgents(_0x3897bf,_0xeb773e));});}});return BPromise[_0xb3f8('0x64')](_0x251ac0)[_0xb3f8('0x4a')](function(_0x49b316){_0x4d0ebf=_[_0xb3f8('0x5e')](_0x4d0ebf,_[_0xb3f8('0x65')](_0x49b316));_0x5b4ea9(_0x4d0ebf);})[_0xb3f8('0x55')](function(_0x5bd4fe){_0x4cc44c(_0x5bd4fe);});});}function getAgents(_0x1b936a,_0x2717b3){return new BPromise(function(_0x191ab5,_0xe96be2){return db[_0x1b936a][_0xb3f8('0x57')]({'where':{'id':_0x2717b3}})['then'](function(_0x544af2){return _0x544af2[_0xb3f8('0x66')]({'attributes':['id'],'raw':!![]})[_0xb3f8('0x4a')](function(_0x1edd04){var _0x18c88b=_[_0xb3f8('0x67')](_0x1edd04,'id');_0x191ab5(_0x18c88b);});})['catch'](function(_0xd5095){_0xe96be2(_0xd5095);});});}
\ No newline at end of file