Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / team / team.controller.js
index 47fda4a..1614d51 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4724=['defaults','redis','socket.io-emitter','./team.socket','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','rawAttributes','intersection','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','destroy','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','addQueues','add','Queues','ids','removeQueues','findOne','isValidChannel','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','Openchannel','Whatsapp','removeAgents','Queue:remove','getAgents','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1765e5,_0x5e9fd7){var _0x401c3b=function(_0x503728){while(--_0x503728){_0x1765e5['push'](_0x1765e5['shift']());}};_0x401c3b(++_0x5e9fd7);}(_0x4724,0x1af));var _0x4472=function(_0x539fef,_0x17f310){_0x539fef=_0x539fef-0x0;var _0x1c9d6f=_0x4724[_0x539fef];return _0x1c9d6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4472('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4472('0x1'));var util=require(_0x4472('0x2'));var path=require(_0x4472('0x3'));var sox=require(_0x4472('0x4'));var csv=require(_0x4472('0x5'));var ejs=require(_0x4472('0x6'));var fs=require('fs');var fs_extra=require(_0x4472('0x7'));var _=require('lodash');var squel=require(_0x4472('0x8'));var crypto=require(_0x4472('0x9'));var jsforce=require(_0x4472('0xa'));var deskjs=require(_0x4472('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4472('0xc'));var Papa=require(_0x4472('0xd'));var Redis=require(_0x4472('0xe'));var authService=require(_0x4472('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4472('0x10'));var hardwareService=require(_0x4472('0x11'));var logger=require(_0x4472('0x12'))('api');var utils=require(_0x4472('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4472('0x14'));var db=require(_0x4472('0x15'))['db'];config['redis']=_[_0x4472('0x16')](config[_0x4472('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4472('0x18'))(new Redis(config[_0x4472('0x17')]));require(_0x4472('0x19'))['register'](socket);function respondWithStatusCode(_0x3623e4,_0x1a8621){_0x1a8621=_0x1a8621||0xcc;return function(_0x337199){if(_0x337199){return _0x3623e4['sendStatus'](_0x1a8621);}return _0x3623e4[_0x4472('0x1a')](_0x1a8621)[_0x4472('0x1b')]();};}function respondWithResult(_0xe9a03a,_0x1ac8f6){_0x1ac8f6=_0x1ac8f6||0xc8;return function(_0xedb8de){if(_0xedb8de){return _0xe9a03a[_0x4472('0x1a')](_0x1ac8f6)[_0x4472('0x1c')](_0xedb8de);}};}function respondWithFilteredResult(_0x5845b1,_0x442ce9){return function(_0x1bdb0f){if(_0x1bdb0f){var _0x5794fa=typeof _0x442ce9[_0x4472('0x1d')]===_0x4472('0x1e')&&typeof _0x442ce9[_0x4472('0x1f')]===_0x4472('0x1e');var _0x2b069e=_0x1bdb0f[_0x4472('0x20')];var _0xca6d8e=_0x5794fa?0x0:_0x442ce9[_0x4472('0x1d')];var _0x3e2ff0=_0x5794fa?_0x1bdb0f['count']:_0x442ce9[_0x4472('0x1d')]+_0x442ce9[_0x4472('0x1f')];var _0xb2633a;if(_0x3e2ff0>=_0x2b069e){_0x3e2ff0=_0x2b069e;_0xb2633a=0xc8;}else{_0xb2633a=0xce;}_0x5845b1[_0x4472('0x1a')](_0xb2633a);return _0x5845b1[_0x4472('0x21')]('Content-Range',_0xca6d8e+'-'+_0x3e2ff0+'/'+_0x2b069e)[_0x4472('0x1c')](_0x1bdb0f);}return null;};}function patchUpdates(_0x1611b4){return function(_0x477162){try{jsonpatch['apply'](_0x477162,_0x1611b4,!![]);}catch(_0xcf497f){return BPromise[_0x4472('0x22')](_0xcf497f);}return _0x477162[_0x4472('0x23')]();};}function saveUpdates(_0x30d4f8,_0x37960a){return function(_0x343d4e){if(_0x343d4e){return _0x343d4e[_0x4472('0x24')](_0x30d4f8)[_0x4472('0x25')](function(_0x3484c0){return _0x3484c0;});}return null;};}function handleEntityNotFound(_0x515231,_0x536eae){return function(_0x795f37){if(!_0x795f37){_0x515231[_0x4472('0x26')](0x194);}return _0x795f37;};}function handleError(_0x19a41d,_0x14af61){_0x14af61=_0x14af61||0x1f4;return function(_0x51a3e9){logger[_0x4472('0x27')](_0x51a3e9[_0x4472('0x28')]);if(_0x51a3e9[_0x4472('0x29')]){delete _0x51a3e9[_0x4472('0x29')];}_0x19a41d[_0x4472('0x1a')](_0x14af61)[_0x4472('0x2a')](_0x51a3e9);};}exports[_0x4472('0x2b')]=function(_0x5c54e4,_0x2b5ee1){var _0x42127a={},_0x55e530={},_0x1c747e={'count':0x0,'rows':[]};var _0x24b2fa=_[_0x4472('0x2c')](db[_0x4472('0x2d')]['rawAttributes'],function(_0x4e7d1b){return{'name':_0x4e7d1b[_0x4472('0x2e')],'type':_0x4e7d1b[_0x4472('0x2f')][_0x4472('0x30')]};});_0x55e530[_0x4472('0x31')]=_[_0x4472('0x2c')](_0x24b2fa,_0x4472('0x29'));_0x55e530[_0x4472('0x32')]=_[_0x4472('0x33')](_0x5c54e4[_0x4472('0x32')]);_0x55e530[_0x4472('0x34')]=_['intersection'](_0x55e530[_0x4472('0x31')],_0x55e530[_0x4472('0x32')]);_0x42127a['attributes']=_['intersection'](_0x55e530[_0x4472('0x31')],qs[_0x4472('0x35')](_0x5c54e4[_0x4472('0x32')]['fields']));_0x42127a[_0x4472('0x36')]=_0x42127a['attributes']['length']?_0x42127a[_0x4472('0x36')]:_0x55e530[_0x4472('0x31')];if(!_0x5c54e4['query'][_0x4472('0x37')](_0x4472('0x38'))){_0x42127a[_0x4472('0x1f')]=qs[_0x4472('0x1f')](_0x5c54e4['query'][_0x4472('0x1f')]);_0x42127a[_0x4472('0x1d')]=qs[_0x4472('0x1d')](_0x5c54e4[_0x4472('0x32')]['offset']);}_0x42127a[_0x4472('0x39')]=qs[_0x4472('0x3a')](_0x5c54e4[_0x4472('0x32')]['sort']);_0x42127a['where']=qs[_0x4472('0x34')](_[_0x4472('0x3b')](_0x5c54e4['query'],_0x55e530[_0x4472('0x34')]),_0x24b2fa);if(_0x5c54e4[_0x4472('0x32')]['filter']){_0x42127a[_0x4472('0x3c')]=_[_0x4472('0x3d')](_0x42127a[_0x4472('0x3c')],{'$or':_[_0x4472('0x2c')](_0x24b2fa,function(_0x31cd55){if(_0x31cd55['type']!==_0x4472('0x3e')){var _0xe9b86d={};_0xe9b86d[_0x31cd55['name']]={'$like':'%'+_0x5c54e4['query'][_0x4472('0x3f')]+'%'};return _0xe9b86d;}})});}_0x42127a=_['merge']({},_0x42127a,_0x5c54e4[_0x4472('0x40')]);var _0x10979b={'where':_0x42127a[_0x4472('0x3c')]};return db[_0x4472('0x2d')]['count'](_0x10979b)[_0x4472('0x25')](function(_0x1f5c0e){_0x1c747e['count']=_0x1f5c0e;if(_0x5c54e4[_0x4472('0x32')]['includeAll']){_0x42127a[_0x4472('0x41')]=[{'all':!![]}];}return db['Team'][_0x4472('0x42')](_0x42127a);})[_0x4472('0x25')](function(_0x4525e3){_0x1c747e[_0x4472('0x43')]=_0x4525e3;return _0x1c747e;})['then'](respondWithFilteredResult(_0x2b5ee1,_0x42127a))[_0x4472('0x44')](handleError(_0x2b5ee1,null));};exports[_0x4472('0x45')]=function(_0x203f52,_0x24df0b){var _0x378524={'raw':![],'where':{'id':_0x203f52['params']['id']}},_0x312f9a={};_0x312f9a[_0x4472('0x31')]=_[_0x4472('0x33')](db[_0x4472('0x2d')][_0x4472('0x46')]);_0x312f9a[_0x4472('0x32')]=_[_0x4472('0x33')](_0x203f52['query']);_0x312f9a[_0x4472('0x34')]=_[_0x4472('0x47')](_0x312f9a[_0x4472('0x31')],_0x312f9a[_0x4472('0x32')]);_0x378524[_0x4472('0x36')]=_[_0x4472('0x47')](_0x312f9a['model'],qs[_0x4472('0x35')](_0x203f52[_0x4472('0x32')][_0x4472('0x35')]));_0x378524[_0x4472('0x36')]=_0x378524[_0x4472('0x36')]['length']?_0x378524[_0x4472('0x36')]:_0x312f9a[_0x4472('0x31')];if(_0x203f52[_0x4472('0x32')][_0x4472('0x48')]){_0x378524[_0x4472('0x41')]=[{'all':!![]}];}_0x378524=_[_0x4472('0x3d')]({},_0x378524,_0x203f52['options']);return db[_0x4472('0x2d')]['find'](_0x378524)[_0x4472('0x25')](handleEntityNotFound(_0x24df0b,null))[_0x4472('0x25')](respondWithResult(_0x24df0b,null))[_0x4472('0x44')](handleError(_0x24df0b,null));};exports[_0x4472('0x49')]=function(_0x201069,_0x4501ce){return db[_0x4472('0x2d')][_0x4472('0x49')](_0x201069[_0x4472('0x4a')],{})[_0x4472('0x25')](function(_0x3e59b8){var _0x9a63ac=_0x201069['user'][_0x4472('0x4b')]({'plain':!![]});if(!_0x9a63ac)throw new Error(_0x4472('0x4c'));if(_0x9a63ac[_0x4472('0x4d')]===_0x4472('0x4e')){var _0x579e8b=_0x3e59b8['get']({'plain':!![]});var _0x562d17=_0x4472('0x4f');return db[_0x4472('0x50')][_0x4472('0x51')]({'where':{'name':_0x562d17,'userProfileId':_0x9a63ac[_0x4472('0x52')]},'raw':!![]})['then'](function(_0x4b9182){if(_0x4b9182&&_0x4b9182[_0x4472('0x53')]===0x0){return db[_0x4472('0x54')][_0x4472('0x49')]({'name':_0x579e8b[_0x4472('0x29')],'resourceId':_0x579e8b['id'],'type':_0x4b9182[_0x4472('0x29')],'sectionId':_0x4b9182['id']},{})[_0x4472('0x25')](function(){return _0x3e59b8;});}else{return _0x3e59b8;}})[_0x4472('0x44')](function(_0x24c3e0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24c3e0);throw _0x24c3e0;});}return _0x3e59b8;})[_0x4472('0x25')](respondWithResult(_0x4501ce,0xc9))[_0x4472('0x44')](handleError(_0x4501ce,null));};exports[_0x4472('0x24')]=function(_0x4226af,_0x10a831){if(_0x4226af[_0x4472('0x4a')]['id']){delete _0x4226af[_0x4472('0x4a')]['id'];}return db[_0x4472('0x2d')]['find']({'where':{'id':_0x4226af['params']['id']}})['then'](handleEntityNotFound(_0x10a831,null))[_0x4472('0x25')](saveUpdates(_0x4226af[_0x4472('0x4a')],null))[_0x4472('0x25')](respondWithResult(_0x10a831,null))['catch'](handleError(_0x10a831,null));};exports[_0x4472('0x55')]=function(_0x2a39f5,_0x1f7730){var _0x2c4f20=_0x2a39f5[_0x4472('0x56')]['id'];var _0x5d288c=[];return db[_0x4472('0x57')][_0x4472('0x58')](function(_0x3bdd82){var _0x1161a7=_0x4472('0x59')+_0x2c4f20;return db[_0x4472('0x57')]['query'](_0x1161a7,{'type':db[_0x4472('0x5a')][_0x4472('0x5b')]['SELECT'],'raw':!![],'transaction':_0x3bdd82})['then'](function(_0x5ac2d9){_0x5d288c=_[_0x4472('0x2c')](_0x5ac2d9,function(_0x59dc32){return Number(_0x59dc32['UserId']);});})[_0x4472('0x25')](function(){var _0x347033=_0x4472('0x5c')+_0x2c4f20;return db[_0x4472('0x57')][_0x4472('0x32')](_0x347033,{'type':db[_0x4472('0x5a')][_0x4472('0x5b')]['SELECT'],'raw':!![],'transaction':_0x3bdd82});})['then'](function(_0x50fb13){var _0x1edf5f=_[_0x4472('0x2c')](_0x50fb13,function(_0x4278bb){return Number(_0x4278bb[_0x4472('0x5d')]);});return db[_0x4472('0x5e')][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'VoiceQueueId':{'$in':_0x1edf5f}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){var _0x251a94='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c4f20;return db[_0x4472('0x57')]['query'](_0x251a94,{'type':db[_0x4472('0x5a')][_0x4472('0x5b')]['SELECT'],'raw':!![],'transaction':_0x3bdd82});})[_0x4472('0x25')](function(_0x1f0487){var _0x174a87=_[_0x4472('0x2c')](_0x1f0487,function(_0x38644e){return Number(_0x38644e[_0x4472('0x5f')]);});return db['UserMailQueue'][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'MailQueueId':{'$in':_0x174a87}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){var _0x2765de=_0x4472('0x60')+_0x2c4f20;return db[_0x4472('0x57')]['query'](_0x2765de,{'type':db[_0x4472('0x5a')]['QueryTypes'][_0x4472('0x61')],'raw':!![],'transaction':_0x3bdd82});})[_0x4472('0x25')](function(_0x9ca76){var _0x4aa2d6=_[_0x4472('0x2c')](_0x9ca76,function(_0x4f7a9a){return Number(_0x4f7a9a['SmsQueueId']);});return db[_0x4472('0x62')][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'SmsQueueId':{'$in':_0x4aa2d6}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){var _0x2821d5='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c4f20;return db['sequelize'][_0x4472('0x32')](_0x2821d5,{'type':db[_0x4472('0x5a')]['QueryTypes'][_0x4472('0x61')],'raw':!![],'transaction':_0x3bdd82});})['then'](function(_0x4efb5e){var _0x37e22c=_[_0x4472('0x2c')](_0x4efb5e,function(_0x3b8c30){return Number(_0x3b8c30['ChatQueueId']);});return db[_0x4472('0x63')][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'ChatQueueId':{'$in':_0x37e22c}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){var _0x4caa3b=_0x4472('0x64')+_0x2c4f20;return db[_0x4472('0x57')][_0x4472('0x32')](_0x4caa3b,{'type':db['Sequelize'][_0x4472('0x5b')][_0x4472('0x61')],'raw':!![],'transaction':_0x3bdd82});})[_0x4472('0x25')](function(_0x3423a2){var _0x17a795=_[_0x4472('0x2c')](_0x3423a2,function(_0x5473c2){return Number(_0x5473c2[_0x4472('0x65')]);});return db[_0x4472('0x66')][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'FaxQueueId':{'$in':_0x17a795}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){var _0x5249a0='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c4f20;return db['sequelize']['query'](_0x5249a0,{'type':db[_0x4472('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3bdd82});})[_0x4472('0x25')](function(_0x24fbcc){var _0x3a7960=_[_0x4472('0x2c')](_0x24fbcc,function(_0x89283b){return Number(_0x89283b[_0x4472('0x67')]);});return db['UserOpenchannelQueue'][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'OpenchannelQueueId':{'$in':_0x3a7960}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){var _0x777757=_0x4472('0x68')+_0x2c4f20;return db[_0x4472('0x57')][_0x4472('0x32')](_0x777757,{'type':db[_0x4472('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3bdd82});})[_0x4472('0x25')](function(_0x333d13){var _0x4319fd=_['map'](_0x333d13,function(_0x5d219e){return Number(_0x5d219e['WhatsappQueueId']);});return db[_0x4472('0x69')]['destroy']({'where':{'UserId':{'$in':_0x5d288c},'WhatsappQueueId':{'$in':_0x4319fd}},'transaction':_0x3bdd82});})[_0x4472('0x25')](function(){return db[_0x4472('0x6a')][_0x4472('0x51')]({'where':{'TeamId':_0x2c4f20}});})[_0x4472('0x25')](function(_0x471bf3){if(_0x471bf3===null){return;}return db[_0x4472('0x6b')][_0x4472('0x55')]({'where':{'UserId':{'$in':_0x5d288c},'VoicePrefixId':_0x471bf3[_0x4472('0x6c')]},'transaction':_0x3bdd82});})['then'](function(){return db[_0x4472('0x2d')]['destroy']({'where':{'id':_0x2c4f20},'cascade':!![],'transaction':_0x3bdd82});})[_0x4472('0x25')](function(_0x441235){if(_0x441235===0x0){_0x1f7730[_0x4472('0x26')](0x194);}else{return db[_0x4472('0x54')][_0x4472('0x55')]({'where':{'type':'Teams','resourceId':_0x2c4f20},'cascade':!![],'transaction':_0x3bdd82})[_0x4472('0x25')](function(){_0x1f7730[_0x4472('0x1a')](0xcc)[_0x4472('0x1b')]();});}})[_0x4472('0x44')](function(_0x55f0c3){_0x1f7730[_0x4472('0x1a')](0x1f4)[_0x4472('0x2a')](_0x55f0c3);});});};exports[_0x4472('0x6d')]=function(_0x142c7b,_0x4d5d8f,_0x998b77){return db[_0x4472('0x2d')]['findOne']({'where':{'id':_0x142c7b[_0x4472('0x56')]['id']}})[_0x4472('0x25')](handleEntityNotFound(_0x4d5d8f,null))[_0x4472('0x25')](function(_0x1c0780){if(!_0x142c7b[_0x4472('0x32')][_0x4472('0x6e')]||!utils['isValidChannel'](_0x142c7b['query'][_0x4472('0x6e')])){throw new db[(_0x4472('0x5a'))][(_0x4472('0x6f'))](_0x4472('0x70'));}var _0x49c8e6={};var _0x33d35b={};_0x33d35b['model']=_[_0x4472('0x33')](db[_[_0x4472('0x71')](_0x142c7b[_0x4472('0x32')][_0x4472('0x6e')][_0x4472('0x72')]())+_0x4472('0x73')][_0x4472('0x46')]);_0x33d35b[_0x4472('0x32')]=_['keys'](_0x142c7b[_0x4472('0x32')]);_0x33d35b[_0x4472('0x34')]=_['intersection'](_0x33d35b['model'],_0x33d35b[_0x4472('0x32')]);_0x49c8e6['attributes']=_[_0x4472('0x47')](_0x33d35b['model'],qs[_0x4472('0x35')](_0x142c7b[_0x4472('0x32')][_0x4472('0x35')]));_0x49c8e6[_0x4472('0x36')]=_0x49c8e6['attributes'][_0x4472('0x74')]?_0x49c8e6[_0x4472('0x36')]:_0x33d35b[_0x4472('0x31')];_0x49c8e6[_0x4472('0x1f')]=qs['limit'](_0x142c7b[_0x4472('0x32')][_0x4472('0x1f')]);_0x49c8e6['offset']=qs[_0x4472('0x1d')](_0x142c7b[_0x4472('0x32')][_0x4472('0x1d')]);_0x49c8e6[_0x4472('0x39')]=qs[_0x4472('0x3a')](_0x142c7b['query'][_0x4472('0x3a')]);_0x49c8e6['where']=qs['filters'](_[_0x4472('0x3b')](_0x142c7b[_0x4472('0x32')],_0x33d35b['filters']));_0x49c8e6=_['merge']({},_0x49c8e6,_0x142c7b[_0x4472('0x40')]);return _0x1c0780[_0x4472('0x4b')+_['capitalize'](_0x142c7b[_0x4472('0x32')][_0x4472('0x6e')][_0x4472('0x72')]())+'Queues'](_0x49c8e6);})[_0x4472('0x25')](respondWithResult(_0x4d5d8f,null))[_0x4472('0x44')](handleError(_0x4d5d8f,null));};exports[_0x4472('0x75')]=function(_0x55692b,_0x1591db,_0x464c90){return db[_0x4472('0x2d')]['findOne']({'where':{'id':_0x55692b[_0x4472('0x56')]['id']}})[_0x4472('0x25')](function(_0x38470f){if(_0x38470f){if(!_0x55692b['body'][_0x4472('0x6e')]||!utils['isValidChannel'](_0x55692b['body'][_0x4472('0x6e')])){throw new db['Sequelize'][(_0x4472('0x6f'))]('Unknown\x20channel');}return _0x38470f[_0x4472('0x76')+_[_0x4472('0x71')](_0x55692b[_0x4472('0x4a')][_0x4472('0x6e')][_0x4472('0x72')]())+_0x4472('0x77')](_0x55692b[_0x4472('0x4a')][_0x4472('0x78')]);}return null;})[_0x4472('0x25')](handleEntityNotFound(_0x1591db,null))['then'](respondWithStatusCode(_0x1591db,null))[_0x4472('0x44')](handleError(_0x1591db,null));};exports[_0x4472('0x79')]=function(_0x361c4b,_0xe91f,_0x2cf0c8){return db[_0x4472('0x2d')][_0x4472('0x7a')]({'where':{'id':_0x361c4b[_0x4472('0x56')]['id']}})[_0x4472('0x25')](function(_0x323cc0){if(_0x323cc0){if(!_0x361c4b[_0x4472('0x32')][_0x4472('0x6e')]||!utils[_0x4472('0x7b')](_0x361c4b['query'][_0x4472('0x6e')])){throw new db[(_0x4472('0x5a'))][(_0x4472('0x6f'))](_0x4472('0x70'));}return _0x323cc0['remove'+_[_0x4472('0x71')](_0x361c4b['query'][_0x4472('0x6e')]['toLowerCase']())+_0x4472('0x77')](_0x361c4b[_0x4472('0x32')]['ids']);}return null;})['then'](handleEntityNotFound(_0xe91f,null))['then'](respondWithStatusCode(_0xe91f,null))['catch'](handleError(_0xe91f,null));};exports[_0x4472('0x7c')]=function(_0x131a69,_0x1e7ef3){var _0x31b50b=_[_0x4472('0x7d')](_0x131a69['body'][_0x4472('0x78')])?_0x131a69[_0x4472('0x4a')][_0x4472('0x78')]:[_0x131a69[_0x4472('0x4a')][_0x4472('0x78')]];var _0x1b629c=_0x131a69[_0x4472('0x56')]['id'];return db[_0x4472('0x2d')][_0x4472('0x51')]({'where':{'id':_0x1b629c}})['then'](handleEntityNotFound(_0x1e7ef3,null))[_0x4472('0x25')](function(_0xd43199){if(_0xd43199){var _0x3b66b2=[_0x4472('0x7e'),_0x4472('0x7f'),_0x4472('0x80'),_0x4472('0x81'),_0x4472('0x82'),'Openchannel','Whatsapp'];return db[_0x4472('0x57')][_0x4472('0x58')](function(_0x3c6f8b){var _0xae523d=_[_0x4472('0x2c')](_0x3b66b2,function(_0x419479){var _0x21fca1={'attributes':['id',_0x4472('0x29')]};if(_0x419479===_0x4472('0x7e')){_0x21fca1[_0x4472('0x83')]={'attributes':['penalty']};}return _0xd43199['get'+_0x419479+_0x4472('0x77')](_0x21fca1)[_0x4472('0x25')](function(_0xf6f0e3){var _0xede245=_[_0x4472('0x2c')](_0xf6f0e3,function(_0x3fb458){var _0x27f4a9=_[_0x4472('0x2c')](_0x31b50b,function(_0x477d9c){var _0x161ac4={'where':{'UserId':_0x477d9c,[_0x419479+_0x4472('0x84')]:_0x3fb458['id']},'transaction':_0x3c6f8b};if(_0x419479===_0x4472('0x7e')){_0x161ac4[_0x4472('0x16')]={'penalty':_0x3fb458[_0x4472('0x85')]['penalty']};}return db['User'+_0x419479+_0x4472('0x73')][_0x4472('0x86')](_0x161ac4)['then'](function(){socket[_0x4472('0x87')](_0x4472('0x4e')+_0x419479+_0x4472('0x88'),{'UserId':_0x477d9c,[_0x419479+'QueueId']:_0x3fb458['id']});if(_0x419479!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x31b50b,'online':0x1},'attributes':['id',_0x4472('0x29'),_0x4472('0x89'),_0x4472('0x8a'),_0x4472('0x8b')],'raw':!![]})[_0x4472('0x25')](function(_0x1101d4){var _0x45f36e=_[_0x4472('0x2c')](_0x1101d4,function(_0x126195){return db[_0x4472('0x8c')][_0x4472('0x8d')]({'membername':_0x126195['name'],'UserId':_0x126195['id'],'queue_name':_0x3fb458['name'],'VoiceQueueId':_0x3fb458['id'],'interface':_[_0x4472('0x8e')](_0x126195[_0x4472('0x8b')])?util[_0x4472('0x8f')](_0x4472('0x90'),_0x126195['name']):_0x126195[_0x4472('0x8b')],'paused':_0x126195['voicePause']||![],'penalty':_0x3fb458[_0x4472('0x85')]['penalty']},{'transaction':_0x3c6f8b});});return Promise[_0x4472('0x91')](_0x45f36e);});});});return Promise[_0x4472('0x91')](_0x27f4a9);});return Promise[_0x4472('0x91')](_0xede245);})[_0x4472('0x25')](function(){return db[_0x4472('0x6a')]['findOne']({'where':{'teamId':_0x1b629c}})[_0x4472('0x25')](function(_0x1b7999){if(_0x1b7999){var _0x40a9d7=_[_0x4472('0x2c')](_0x31b50b,function(_0x337982){db['UserVoicePrefix'][_0x4472('0x8d')]({'UserId':_0x337982,'VoicePrefixId':_0x1b7999[_0x4472('0x6c')]});});return Promise[_0x4472('0x91')](_0x40a9d7);}});});});return Promise['all'](_0xae523d)[_0x4472('0x25')](function(){return _0xd43199[_0x4472('0x7c')](_0x31b50b,{'transaction':_0x3c6f8b})['spread'](function(_0x5cebd5){return _0x5cebd5;});});});}})[_0x4472('0x25')](respondWithResult(_0x1e7ef3,null))[_0x4472('0x44')](handleError(_0x1e7ef3,null));};exports['removeAgents']=function(_0x48e77a,_0x4fa425){var _0x25c4f7=_[_0x4472('0x7d')](_0x48e77a[_0x4472('0x32')][_0x4472('0x78')])?_0x48e77a[_0x4472('0x32')]['ids']:[_0x48e77a[_0x4472('0x32')][_0x4472('0x78')]];var _0x548624=_0x48e77a['params']['id'];return db[_0x4472('0x2d')][_0x4472('0x51')]({'where':{'id':_0x548624}})[_0x4472('0x25')](handleEntityNotFound(_0x4fa425,null))[_0x4472('0x25')](function(_0x3516ea){if(_0x3516ea){var _0x3d9175=['Voice',_0x4472('0x7f'),_0x4472('0x80'),_0x4472('0x81'),_0x4472('0x82'),_0x4472('0x92'),_0x4472('0x93')];return db[_0x4472('0x57')][_0x4472('0x58')](function(_0x4d53e1){var _0x17241b=_[_0x4472('0x2c')](_0x3d9175,function(_0x4194ca){var _0x3ee3e5={'attributes':['id','name']};return _0x3516ea[_0x4472('0x4b')+_0x4194ca+_0x4472('0x77')](_0x3ee3e5)[_0x4472('0x25')](function(_0xdc1d0b){var _0x3cd7a9=_['map'](_0xdc1d0b,function(_0x19078e){return _0x19078e[_0x4472('0x94')](_0x25c4f7,{'transaction':_0x4d53e1})[_0x4472('0x25')](function(){var _0x5a7c49=_[_0x4472('0x2c')](_0x25c4f7,function(_0x32d951){socket[_0x4472('0x87')]('user'+_0x4194ca+_0x4472('0x95'),{'UserId':Number(_0x32d951),[_0x4194ca+_0x4472('0x84')]:_0x19078e['id']});if(_0x4194ca!==_0x4472('0x7e')){return;}return db[_0x4472('0x8c')][_0x4472('0x55')]({'where':{'VoiceQueueId':_0x19078e['id'],'UserId':_0x32d951},'transaction':_0x4d53e1});});return Promise[_0x4472('0x91')](_0x5a7c49);});});return Promise['all'](_0x3cd7a9);});});return Promise[_0x4472('0x91')](_0x17241b)['then'](function(){return _0x3516ea[_0x4472('0x94')](_0x25c4f7,{'transaction':_0x4d53e1});})[_0x4472('0x25')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x548624}})[_0x4472('0x25')](function(_0x3d504d){if(_0x3d504d){var _0x5ae50c=_[_0x4472('0x2c')](_0x25c4f7,function(_0x2767c0){db[_0x4472('0x6b')]['destroy']({'where':{'UserId':_0x2767c0,'VoicePrefixId':_0x3d504d[_0x4472('0x6c')]}});});return Promise[_0x4472('0x91')](_0x5ae50c);}});});});}})[_0x4472('0x25')](respondWithStatusCode(_0x4fa425,null))[_0x4472('0x44')](handleError(_0x4fa425,null));};exports[_0x4472('0x96')]=function(_0x1f2bb6,_0x11b16c,_0x47aa73){var _0x57db72={};var _0x5f4e97={};var _0xcc2d3e;var _0x52b0ca;return db[_0x4472('0x2d')][_0x4472('0x7a')]({'where':{'id':_0x1f2bb6[_0x4472('0x56')]['id']}})[_0x4472('0x25')](handleEntityNotFound(_0x11b16c,null))[_0x4472('0x25')](function(_0x33255c){if(_0x33255c){_0xcc2d3e=_0x33255c;_0x5f4e97[_0x4472('0x31')]=_[_0x4472('0x33')](db['User'][_0x4472('0x46')]);_0x5f4e97['query']=_['keys'](_0x1f2bb6[_0x4472('0x32')]);_0x5f4e97[_0x4472('0x34')]=_['intersection'](_0x5f4e97[_0x4472('0x31')],_0x5f4e97[_0x4472('0x32')]);_0x57db72[_0x4472('0x36')]=_[_0x4472('0x47')](_0x5f4e97[_0x4472('0x31')],qs[_0x4472('0x35')](_0x1f2bb6['query'][_0x4472('0x35')]));_0x57db72[_0x4472('0x36')]=_0x57db72[_0x4472('0x36')][_0x4472('0x74')]?_0x57db72['attributes']:_0x5f4e97[_0x4472('0x31')];_0x57db72['order']=qs[_0x4472('0x3a')](_0x1f2bb6[_0x4472('0x32')][_0x4472('0x3a')]);_0x57db72['where']=qs[_0x4472('0x34')](_['pick'](_0x1f2bb6[_0x4472('0x32')],_0x5f4e97['filters']));if(_0x1f2bb6[_0x4472('0x32')]['filter']){_0x57db72[_0x4472('0x3c')]=_[_0x4472('0x3d')](_0x57db72[_0x4472('0x3c')],{'$or':_[_0x4472('0x2c')](_0x57db72[_0x4472('0x36')],function(_0x3410c4){var _0x1cdd9e={};_0x1cdd9e[_0x3410c4]={'$like':'%'+_0x1f2bb6['query']['filter']+'%'};return _0x1cdd9e;})});}_0x57db72=_[_0x4472('0x3d')]({},_0x57db72,_0x1f2bb6[_0x4472('0x40')]);return _0xcc2d3e[_0x4472('0x96')](_0x57db72);}})[_0x4472('0x25')](function(_0x1490c6){if(_0x1490c6){_0x52b0ca=_0x1490c6[_0x4472('0x74')];if(!_0x1f2bb6[_0x4472('0x32')][_0x4472('0x37')]('nolimit')){_0x57db72[_0x4472('0x1f')]=qs[_0x4472('0x1f')](_0x1f2bb6[_0x4472('0x32')][_0x4472('0x1f')]);_0x57db72[_0x4472('0x1d')]=qs[_0x4472('0x1d')](_0x1f2bb6[_0x4472('0x32')][_0x4472('0x1d')]);}return _0xcc2d3e['getAgents'](_0x57db72);}})[_0x4472('0x25')](function(_0x364795){if(_0x364795){return _0x364795?{'count':_0x52b0ca,'rows':_0x364795}:null;}})[_0x4472('0x25')](respondWithResult(_0x11b16c,null))[_0x4472('0x44')](handleError(_0x11b16c,null));};
\ No newline at end of file
+var _0x6380=['Queue','Queues','ValidationError','add','removeQueues','remove','addAgents','isArray','ids','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Fax','Queue:remove','getAgents','hasOwnProperty','zip-dir','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','save','error','stack','name','send','index','Team','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase'];(function(_0x44260e,_0x562865){var _0x244282=function(_0x4d5be6){while(--_0x4d5be6){_0x44260e['push'](_0x44260e['shift']());}};_0x244282(++_0x562865);}(_0x6380,0x1e4));var _0x0638=function(_0x2e9916,_0x1233c3){_0x2e9916=_0x2e9916-0x0;var _0x39af2b=_0x6380[_0x2e9916];return _0x39af2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0638('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0638('0x1'));var Mustache=require(_0x0638('0x2'));var util=require(_0x0638('0x3'));var path=require('path');var sox=require(_0x0638('0x4'));var csv=require(_0x0638('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0638('0x6'));var squel=require(_0x0638('0x7'));var crypto=require(_0x0638('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0638('0x9'));var toCsv=require(_0x0638('0x5'));var querystring=require(_0x0638('0xa'));var Papa=require(_0x0638('0xb'));var Redis=require(_0x0638('0xc'));var authService=require(_0x0638('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0638('0xe'));var logger=require('../../config/logger')(_0x0638('0xf'));var utils=require(_0x0638('0x10'));var config=require(_0x0638('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x0638('0x12'))['db'];config[_0x0638('0x13')]=_['defaults'](config[_0x0638('0x13')],{'host':_0x0638('0x14'),'port':0x18eb});var socket=require(_0x0638('0x15'))(new Redis(config[_0x0638('0x13')]));require(_0x0638('0x16'))[_0x0638('0x17')](socket);function respondWithStatusCode(_0x514a9f,_0x9277bf){_0x9277bf=_0x9277bf||0xcc;return function(_0x5a5aae){if(_0x5a5aae){return _0x514a9f[_0x0638('0x18')](_0x9277bf);}return _0x514a9f[_0x0638('0x19')](_0x9277bf)[_0x0638('0x1a')]();};}function respondWithResult(_0x5dd86a,_0x59e031){_0x59e031=_0x59e031||0xc8;return function(_0x2d0b6d){if(_0x2d0b6d){return _0x5dd86a['status'](_0x59e031)[_0x0638('0x1b')](_0x2d0b6d);}};}function respondWithFilteredResult(_0x3fbb5c,_0xe78f58){return function(_0x2c4523){if(_0x2c4523){var _0x35a698=typeof _0xe78f58[_0x0638('0x1c')]===_0x0638('0x1d')&&typeof _0xe78f58[_0x0638('0x1e')]==='undefined';var _0x3319d9=_0x2c4523['count'];var _0x1a62a2=_0x35a698?0x0:_0xe78f58['offset'];var _0x321ece=_0x35a698?_0x2c4523[_0x0638('0x1f')]:_0xe78f58[_0x0638('0x1c')]+_0xe78f58[_0x0638('0x1e')];var _0xa5d939;if(_0x321ece>=_0x3319d9){_0x321ece=_0x3319d9;_0xa5d939=0xc8;}else{_0xa5d939=0xce;}_0x3fbb5c['status'](_0xa5d939);return _0x3fbb5c['set']('Content-Range',_0x1a62a2+'-'+_0x321ece+'/'+_0x3319d9)[_0x0638('0x1b')](_0x2c4523);}return null;};}function patchUpdates(_0x46447e){return function(_0x2e41c4){try{jsonpatch['apply'](_0x2e41c4,_0x46447e,!![]);}catch(_0x306c8a){return BPromise['reject'](_0x306c8a);}return _0x2e41c4[_0x0638('0x20')]();};}function saveUpdates(_0x3ad81f,_0x47da71){return function(_0x5b5a1c){if(_0x5b5a1c){return _0x5b5a1c['update'](_0x3ad81f)['then'](function(_0x2b36bc){return _0x2b36bc;});}return null;};}function handleEntityNotFound(_0x4538c8,_0x507250){return function(_0x5603a1){if(!_0x5603a1){_0x4538c8[_0x0638('0x18')](0x194);}return _0x5603a1;};}function handleError(_0x4fbeeb,_0x2688d5){_0x2688d5=_0x2688d5||0x1f4;return function(_0x1618f5){logger[_0x0638('0x21')](_0x1618f5[_0x0638('0x22')]);if(_0x1618f5[_0x0638('0x23')]){delete _0x1618f5['name'];}_0x4fbeeb[_0x0638('0x19')](_0x2688d5)[_0x0638('0x24')](_0x1618f5);};}exports[_0x0638('0x25')]=function(_0x124a7d,_0x595f4a){var _0x162603={},_0x3d7a1b={},_0x4564f4={'count':0x0,'rows':[]};var _0x18b501=_['map'](db[_0x0638('0x26')][_0x0638('0x27')],function(_0x5d452f){return{'name':_0x5d452f[_0x0638('0x28')],'type':_0x5d452f[_0x0638('0x29')][_0x0638('0x2a')]};});_0x3d7a1b['model']=_[_0x0638('0x2b')](_0x18b501,'name');_0x3d7a1b[_0x0638('0x2c')]=_[_0x0638('0x2d')](_0x124a7d[_0x0638('0x2c')]);_0x3d7a1b['filters']=_[_0x0638('0x2e')](_0x3d7a1b[_0x0638('0x2f')],_0x3d7a1b[_0x0638('0x2c')]);_0x162603[_0x0638('0x30')]=_['intersection'](_0x3d7a1b[_0x0638('0x2f')],qs['fields'](_0x124a7d[_0x0638('0x2c')][_0x0638('0x31')]));_0x162603[_0x0638('0x30')]=_0x162603[_0x0638('0x30')][_0x0638('0x32')]?_0x162603[_0x0638('0x30')]:_0x3d7a1b['model'];if(!_0x124a7d['query']['hasOwnProperty']('nolimit')){_0x162603[_0x0638('0x1e')]=qs[_0x0638('0x1e')](_0x124a7d[_0x0638('0x2c')][_0x0638('0x1e')]);_0x162603['offset']=qs[_0x0638('0x1c')](_0x124a7d[_0x0638('0x2c')]['offset']);}_0x162603[_0x0638('0x33')]=qs[_0x0638('0x34')](_0x124a7d['query'][_0x0638('0x34')]);_0x162603[_0x0638('0x35')]=qs[_0x0638('0x36')](_[_0x0638('0x37')](_0x124a7d['query'],_0x3d7a1b[_0x0638('0x36')]),_0x18b501);if(_0x124a7d[_0x0638('0x2c')]['filter']){_0x162603[_0x0638('0x35')]=_[_0x0638('0x38')](_0x162603[_0x0638('0x35')],{'$or':_[_0x0638('0x2b')](_0x18b501,function(_0x4283b3){if(_0x4283b3['type']!==_0x0638('0x39')){var _0x48d9a1={};_0x48d9a1[_0x4283b3['name']]={'$like':'%'+_0x124a7d[_0x0638('0x2c')][_0x0638('0x3a')]+'%'};return _0x48d9a1;}})});}_0x162603=_[_0x0638('0x38')]({},_0x162603,_0x124a7d[_0x0638('0x3b')]);var _0x223d48={'where':_0x162603[_0x0638('0x35')]};return db[_0x0638('0x26')][_0x0638('0x1f')](_0x223d48)['then'](function(_0x261d0f){_0x4564f4['count']=_0x261d0f;if(_0x124a7d['query'][_0x0638('0x3c')]){_0x162603[_0x0638('0x3d')]=[{'all':!![]}];}return db['Team'][_0x0638('0x3e')](_0x162603);})[_0x0638('0x3f')](function(_0x21ae57){_0x4564f4[_0x0638('0x40')]=_0x21ae57;return _0x4564f4;})[_0x0638('0x3f')](respondWithFilteredResult(_0x595f4a,_0x162603))['catch'](handleError(_0x595f4a,null));};exports['show']=function(_0x12883f,_0x19ff11){var _0x566c75={'raw':![],'where':{'id':_0x12883f[_0x0638('0x41')]['id']}},_0x232105={};_0x232105[_0x0638('0x2f')]=_[_0x0638('0x2d')](db[_0x0638('0x26')][_0x0638('0x27')]);_0x232105['query']=_['keys'](_0x12883f['query']);_0x232105['filters']=_[_0x0638('0x2e')](_0x232105[_0x0638('0x2f')],_0x232105[_0x0638('0x2c')]);_0x566c75['attributes']=_[_0x0638('0x2e')](_0x232105[_0x0638('0x2f')],qs[_0x0638('0x31')](_0x12883f[_0x0638('0x2c')][_0x0638('0x31')]));_0x566c75[_0x0638('0x30')]=_0x566c75[_0x0638('0x30')]['length']?_0x566c75['attributes']:_0x232105[_0x0638('0x2f')];if(_0x12883f[_0x0638('0x2c')]['includeAll']){_0x566c75[_0x0638('0x3d')]=[{'all':!![]}];}_0x566c75=_[_0x0638('0x38')]({},_0x566c75,_0x12883f['options']);return db[_0x0638('0x26')][_0x0638('0x42')](_0x566c75)[_0x0638('0x3f')](handleEntityNotFound(_0x19ff11,null))['then'](respondWithResult(_0x19ff11,null))[_0x0638('0x43')](handleError(_0x19ff11,null));};exports[_0x0638('0x44')]=function(_0x3df8ac,_0x7ed923){return db[_0x0638('0x26')]['create'](_0x3df8ac['body'],{})[_0x0638('0x3f')](function(_0x28959d){var _0x3202a5=_0x3df8ac[_0x0638('0x45')][_0x0638('0x46')]({'plain':!![]});if(!_0x3202a5)throw new Error(_0x0638('0x47'));if(_0x3202a5[_0x0638('0x48')]===_0x0638('0x45')){var _0x504e0c=_0x28959d[_0x0638('0x46')]({'plain':!![]});var _0x5722c9='Teams';return db[_0x0638('0x49')]['find']({'where':{'name':_0x5722c9,'userProfileId':_0x3202a5[_0x0638('0x4a')]},'raw':!![]})['then'](function(_0xc20e98){if(_0xc20e98&&_0xc20e98[_0x0638('0x4b')]===0x0){return db[_0x0638('0x4c')]['create']({'name':_0x504e0c[_0x0638('0x23')],'resourceId':_0x504e0c['id'],'type':_0xc20e98[_0x0638('0x23')],'sectionId':_0xc20e98['id']},{})['then'](function(){return _0x28959d;});}else{return _0x28959d;}})[_0x0638('0x43')](function(_0x453584){logger[_0x0638('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x453584);throw _0x453584;});}return _0x28959d;})['then'](respondWithResult(_0x7ed923,0xc9))['catch'](handleError(_0x7ed923,null));};exports[_0x0638('0x4d')]=function(_0x250298,_0xa65efa){if(_0x250298[_0x0638('0x4e')]['id']){delete _0x250298[_0x0638('0x4e')]['id'];}return db[_0x0638('0x26')][_0x0638('0x42')]({'where':{'id':_0x250298['params']['id']}})[_0x0638('0x3f')](handleEntityNotFound(_0xa65efa,null))[_0x0638('0x3f')](saveUpdates(_0x250298[_0x0638('0x4e')],null))[_0x0638('0x3f')](respondWithResult(_0xa65efa,null))[_0x0638('0x43')](handleError(_0xa65efa,null));};exports['destroy']=function(_0x5c19dd,_0x222a69){var _0x21f69f=_0x5c19dd[_0x0638('0x41')]['id'];var _0x446a51=[];return db[_0x0638('0x4f')][_0x0638('0x50')](function(_0x5b8793){var _0x4a10e3=_0x0638('0x51')+_0x21f69f;return db[_0x0638('0x4f')][_0x0638('0x2c')](_0x4a10e3,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793})['then'](function(_0x4001c7){_0x446a51=_['map'](_0x4001c7,function(_0x1c5684){return Number(_0x1c5684['UserId']);});})[_0x0638('0x3f')](function(){var _0x191548=_0x0638('0x55')+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x191548,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x2adaf8){var _0x1d951e=_['map'](_0x2adaf8,function(_0x28ad67){return Number(_0x28ad67[_0x0638('0x56')]);});return db[_0x0638('0x57')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'VoiceQueueId':{'$in':_0x1d951e}},'transaction':_0x5b8793});})['then'](function(){var _0x32e786=_0x0638('0x59')+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x32e786,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x2e11c1){var _0x404a14=_['map'](_0x2e11c1,function(_0x459fbb){return Number(_0x459fbb[_0x0638('0x5a')]);});return db[_0x0638('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x446a51},'MailQueueId':{'$in':_0x404a14}},'transaction':_0x5b8793});})['then'](function(){var _0x558071='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x558071,{'type':db['Sequelize'][_0x0638('0x53')]['SELECT'],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x4032b4){var _0x15d9f7=_[_0x0638('0x2b')](_0x4032b4,function(_0x1bffe0){return Number(_0x1bffe0['SmsQueueId']);});return db[_0x0638('0x5c')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'SmsQueueId':{'$in':_0x15d9f7}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){var _0x54ae3a=_0x0638('0x5d')+_0x21f69f;return db[_0x0638('0x4f')][_0x0638('0x2c')](_0x54ae3a,{'type':db[_0x0638('0x52')][_0x0638('0x53')]['SELECT'],'raw':!![],'transaction':_0x5b8793});})['then'](function(_0xac88aa){var _0x429c56=_['map'](_0xac88aa,function(_0x4cd70f){return Number(_0x4cd70f[_0x0638('0x5e')]);});return db[_0x0638('0x5f')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'ChatQueueId':{'$in':_0x429c56}},'transaction':_0x5b8793});})['then'](function(){var _0x113672='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x113672,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x24fc3e){var _0x38ba95=_[_0x0638('0x2b')](_0x24fc3e,function(_0x8011e7){return Number(_0x8011e7['FaxQueueId']);});return db[_0x0638('0x60')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'FaxQueueId':{'$in':_0x38ba95}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){var _0x114770='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21f69f;return db[_0x0638('0x4f')]['query'](_0x114770,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x3b3a70){var _0x4a7a06=_[_0x0638('0x2b')](_0x3b3a70,function(_0x2276a4){return Number(_0x2276a4[_0x0638('0x61')]);});return db[_0x0638('0x62')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'OpenchannelQueueId':{'$in':_0x4a7a06}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){var _0x4b654e=_0x0638('0x63')+_0x21f69f;return db['sequelize']['query'](_0x4b654e,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x22bfcd){var _0x3a050f=_[_0x0638('0x2b')](_0x22bfcd,function(_0x31010a){return Number(_0x31010a[_0x0638('0x64')]);});return db[_0x0638('0x65')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'WhatsappQueueId':{'$in':_0x3a050f}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){return db[_0x0638('0x66')][_0x0638('0x42')]({'where':{'TeamId':_0x21f69f}});})[_0x0638('0x3f')](function(_0x15b1a5){if(_0x15b1a5===null){return;}return db[_0x0638('0x67')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'VoicePrefixId':_0x15b1a5[_0x0638('0x68')]},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){return db['Team'][_0x0638('0x58')]({'where':{'id':_0x21f69f},'cascade':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x131636){if(_0x131636===0x0){_0x222a69['sendStatus'](0x194);}else{return db[_0x0638('0x4c')]['destroy']({'where':{'type':'Teams','resourceId':_0x21f69f},'cascade':!![],'transaction':_0x5b8793})[_0x0638('0x3f')](function(){_0x222a69[_0x0638('0x19')](0xcc)[_0x0638('0x1a')]();});}})['catch'](function(_0xb6503f){_0x222a69[_0x0638('0x19')](0x1f4)[_0x0638('0x24')](_0xb6503f);});});};exports[_0x0638('0x69')]=function(_0x3fa5d2,_0x34fce4,_0x2c4a4a){return db[_0x0638('0x26')][_0x0638('0x6a')]({'where':{'id':_0x3fa5d2[_0x0638('0x41')]['id']}})[_0x0638('0x3f')](handleEntityNotFound(_0x34fce4,null))[_0x0638('0x3f')](function(_0x3ce0e3){if(!_0x3fa5d2['query'][_0x0638('0x6b')]||!utils[_0x0638('0x6c')](_0x3fa5d2[_0x0638('0x2c')][_0x0638('0x6b')])){throw new db[(_0x0638('0x52'))]['ValidationError'](_0x0638('0x6d'));}var _0x53bd49={};var _0x5bfe64={};_0x5bfe64[_0x0638('0x2f')]=_[_0x0638('0x2d')](db[_[_0x0638('0x6e')](_0x3fa5d2['query'][_0x0638('0x6b')][_0x0638('0x6f')]())+_0x0638('0x70')][_0x0638('0x27')]);_0x5bfe64[_0x0638('0x2c')]=_[_0x0638('0x2d')](_0x3fa5d2[_0x0638('0x2c')]);_0x5bfe64['filters']=_['intersection'](_0x5bfe64['model'],_0x5bfe64[_0x0638('0x2c')]);_0x53bd49[_0x0638('0x30')]=_[_0x0638('0x2e')](_0x5bfe64[_0x0638('0x2f')],qs['fields'](_0x3fa5d2[_0x0638('0x2c')]['fields']));_0x53bd49[_0x0638('0x30')]=_0x53bd49[_0x0638('0x30')][_0x0638('0x32')]?_0x53bd49['attributes']:_0x5bfe64[_0x0638('0x2f')];_0x53bd49[_0x0638('0x1e')]=qs['limit'](_0x3fa5d2['query'][_0x0638('0x1e')]);_0x53bd49[_0x0638('0x1c')]=qs[_0x0638('0x1c')](_0x3fa5d2[_0x0638('0x2c')][_0x0638('0x1c')]);_0x53bd49[_0x0638('0x33')]=qs['sort'](_0x3fa5d2[_0x0638('0x2c')][_0x0638('0x34')]);_0x53bd49[_0x0638('0x35')]=qs[_0x0638('0x36')](_[_0x0638('0x37')](_0x3fa5d2[_0x0638('0x2c')],_0x5bfe64[_0x0638('0x36')]));_0x53bd49=_[_0x0638('0x38')]({},_0x53bd49,_0x3fa5d2[_0x0638('0x3b')]);return _0x3ce0e3[_0x0638('0x46')+_[_0x0638('0x6e')](_0x3fa5d2[_0x0638('0x2c')]['channel']['toLowerCase']())+_0x0638('0x71')](_0x53bd49);})[_0x0638('0x3f')](respondWithResult(_0x34fce4,null))[_0x0638('0x43')](handleError(_0x34fce4,null));};exports['addQueues']=function(_0x432bfa,_0x3ffab3,_0x492d5d){return db[_0x0638('0x26')]['findOne']({'where':{'id':_0x432bfa['params']['id']}})[_0x0638('0x3f')](function(_0x3385e5){if(_0x3385e5){if(!_0x432bfa[_0x0638('0x4e')][_0x0638('0x6b')]||!utils[_0x0638('0x6c')](_0x432bfa['body'][_0x0638('0x6b')])){throw new db['Sequelize'][(_0x0638('0x72'))](_0x0638('0x6d'));}return _0x3385e5[_0x0638('0x73')+_[_0x0638('0x6e')](_0x432bfa[_0x0638('0x4e')][_0x0638('0x6b')][_0x0638('0x6f')]())+_0x0638('0x71')](_0x432bfa[_0x0638('0x4e')]['ids']);}return null;})[_0x0638('0x3f')](handleEntityNotFound(_0x3ffab3,null))[_0x0638('0x3f')](respondWithStatusCode(_0x3ffab3,null))[_0x0638('0x43')](handleError(_0x3ffab3,null));};exports[_0x0638('0x74')]=function(_0x416b21,_0x50d104,_0x3027ca){return db[_0x0638('0x26')][_0x0638('0x6a')]({'where':{'id':_0x416b21[_0x0638('0x41')]['id']}})[_0x0638('0x3f')](function(_0x41f2d7){if(_0x41f2d7){if(!_0x416b21[_0x0638('0x2c')][_0x0638('0x6b')]||!utils[_0x0638('0x6c')](_0x416b21[_0x0638('0x2c')][_0x0638('0x6b')])){throw new db[(_0x0638('0x52'))]['ValidationError']('Unknown\x20channel');}return _0x41f2d7[_0x0638('0x75')+_['capitalize'](_0x416b21[_0x0638('0x2c')][_0x0638('0x6b')]['toLowerCase']())+_0x0638('0x71')](_0x416b21['query']['ids']);}return null;})[_0x0638('0x3f')](handleEntityNotFound(_0x50d104,null))['then'](respondWithStatusCode(_0x50d104,null))['catch'](handleError(_0x50d104,null));};exports[_0x0638('0x76')]=function(_0x117b35,_0x135288){var _0x297d51=_[_0x0638('0x77')](_0x117b35['body'][_0x0638('0x78')])?_0x117b35['body'][_0x0638('0x78')]:[_0x117b35['body'][_0x0638('0x78')]];var _0x8ae1f5=_0x117b35[_0x0638('0x41')]['id'];return db[_0x0638('0x26')][_0x0638('0x42')]({'where':{'id':_0x8ae1f5}})[_0x0638('0x3f')](handleEntityNotFound(_0x135288,null))['then'](function(_0x247a12){if(_0x247a12){var _0x3ef298=[_0x0638('0x79'),_0x0638('0x7a'),_0x0638('0x7b'),_0x0638('0x7c'),'Fax',_0x0638('0x7d'),_0x0638('0x7e')];return db[_0x0638('0x4f')][_0x0638('0x50')](function(_0x2ddfd2){var _0x3a0aa9=_[_0x0638('0x2b')](_0x3ef298,function(_0x175bc6){var _0xed155f={'attributes':['id',_0x0638('0x23')]};if(_0x175bc6==='Voice'){_0xed155f[_0x0638('0x7f')]={'attributes':[_0x0638('0x80')]};}return _0x247a12[_0x0638('0x46')+_0x175bc6+_0x0638('0x71')](_0xed155f)['then'](function(_0x112b20){var _0x3cf005=_[_0x0638('0x2b')](_0x112b20,function(_0x56583b){var _0x56a830=_[_0x0638('0x2b')](_0x297d51,function(_0x5c5088){var _0x7e80b8={'where':{'UserId':_0x5c5088,[_0x175bc6+_0x0638('0x81')]:_0x56583b['id']},'transaction':_0x2ddfd2};if(_0x175bc6===_0x0638('0x79')){_0x7e80b8[_0x0638('0x82')]={'penalty':_0x56583b[_0x0638('0x83')][_0x0638('0x80')]};}return db[_0x0638('0x84')+_0x175bc6+_0x0638('0x70')]['findOrCreate'](_0x7e80b8)[_0x0638('0x3f')](function(){socket['emit']('user'+_0x175bc6+_0x0638('0x85'),{'UserId':_0x5c5088,[_0x175bc6+_0x0638('0x81')]:_0x56583b['id']});if(_0x175bc6!==_0x0638('0x79')){return;}return db[_0x0638('0x84')]['findAll']({'where':{'id':_0x297d51,'online':0x1},'attributes':['id','name',_0x0638('0x86'),_0x0638('0x87'),_0x0638('0x88')],'raw':!![]})[_0x0638('0x3f')](function(_0x11a91f){var _0x1f8b39=_['map'](_0x11a91f,function(_0x2e6b07){return db[_0x0638('0x89')][_0x0638('0x8a')]({'membername':_0x2e6b07[_0x0638('0x23')],'UserId':_0x2e6b07['id'],'queue_name':_0x56583b[_0x0638('0x23')],'VoiceQueueId':_0x56583b['id'],'interface':_[_0x0638('0x8b')](_0x2e6b07[_0x0638('0x88')])?util[_0x0638('0x8c')](_0x0638('0x8d'),_0x2e6b07['name']):_0x2e6b07[_0x0638('0x88')],'paused':_0x2e6b07[_0x0638('0x87')]||![],'penalty':_0x56583b[_0x0638('0x83')][_0x0638('0x80')]},{'transaction':_0x2ddfd2});});return Promise[_0x0638('0x8e')](_0x1f8b39);});});});return Promise[_0x0638('0x8e')](_0x56a830);});return Promise[_0x0638('0x8e')](_0x3cf005);})[_0x0638('0x3f')](function(){return db[_0x0638('0x66')][_0x0638('0x6a')]({'where':{'teamId':_0x8ae1f5}})[_0x0638('0x3f')](function(_0x26cc23){if(_0x26cc23){var _0x1a0bb3=_[_0x0638('0x2b')](_0x297d51,function(_0x501e88){db[_0x0638('0x67')]['upsert']({'UserId':_0x501e88,'VoicePrefixId':_0x26cc23[_0x0638('0x68')]});});return Promise[_0x0638('0x8e')](_0x1a0bb3);}});});});return Promise[_0x0638('0x8e')](_0x3a0aa9)[_0x0638('0x3f')](function(){return _0x247a12[_0x0638('0x76')](_0x297d51,{'transaction':_0x2ddfd2})[_0x0638('0x8f')](function(_0x397ed7){return _0x397ed7;});});});}})['then'](respondWithResult(_0x135288,null))[_0x0638('0x43')](handleError(_0x135288,null));};exports[_0x0638('0x90')]=function(_0x121ce9,_0x16a38c){var _0x4c0947=_[_0x0638('0x77')](_0x121ce9['query'][_0x0638('0x78')])?_0x121ce9[_0x0638('0x2c')][_0x0638('0x78')]:[_0x121ce9[_0x0638('0x2c')][_0x0638('0x78')]];var _0x40800f=_0x121ce9[_0x0638('0x41')]['id'];return db[_0x0638('0x26')][_0x0638('0x42')]({'where':{'id':_0x40800f}})[_0x0638('0x3f')](handleEntityNotFound(_0x16a38c,null))[_0x0638('0x3f')](function(_0x547537){if(_0x547537){var _0x236244=[_0x0638('0x79'),'Chat',_0x0638('0x7b'),_0x0638('0x7c'),_0x0638('0x91'),_0x0638('0x7d'),_0x0638('0x7e')];return db[_0x0638('0x4f')][_0x0638('0x50')](function(_0x592a5){var _0x148dc7=_[_0x0638('0x2b')](_0x236244,function(_0x26408d){var _0x294e3a={'attributes':['id','name']};return _0x547537[_0x0638('0x46')+_0x26408d+_0x0638('0x71')](_0x294e3a)['then'](function(_0x4bf80){var _0x4d9123=_[_0x0638('0x2b')](_0x4bf80,function(_0x197fb5){return _0x197fb5[_0x0638('0x90')](_0x4c0947,{'transaction':_0x592a5})[_0x0638('0x3f')](function(){var _0x4d3888=_[_0x0638('0x2b')](_0x4c0947,function(_0x132517){socket['emit'](_0x0638('0x45')+_0x26408d+_0x0638('0x92'),{'UserId':Number(_0x132517),[_0x26408d+_0x0638('0x81')]:_0x197fb5['id']});if(_0x26408d!==_0x0638('0x79')){return;}return db['UserVoiceQueueRt'][_0x0638('0x58')]({'where':{'VoiceQueueId':_0x197fb5['id'],'UserId':_0x132517},'transaction':_0x592a5});});return Promise[_0x0638('0x8e')](_0x4d3888);});});return Promise['all'](_0x4d9123);});});return Promise[_0x0638('0x8e')](_0x148dc7)[_0x0638('0x3f')](function(){return _0x547537[_0x0638('0x90')](_0x4c0947,{'transaction':_0x592a5});})[_0x0638('0x3f')](function(){return db['TeamVoicePrefix'][_0x0638('0x6a')]({'where':{'teamId':_0x40800f}})[_0x0638('0x3f')](function(_0x4633bc){if(_0x4633bc){var _0x3d4cbe=_['map'](_0x4c0947,function(_0xe30c4d){db[_0x0638('0x67')][_0x0638('0x58')]({'where':{'UserId':_0xe30c4d,'VoicePrefixId':_0x4633bc[_0x0638('0x68')]}});});return Promise[_0x0638('0x8e')](_0x3d4cbe);}});});});}})[_0x0638('0x3f')](respondWithStatusCode(_0x16a38c,null))[_0x0638('0x43')](handleError(_0x16a38c,null));};exports[_0x0638('0x93')]=function(_0x384164,_0x31b756,_0x3d6cc9){var _0x65d476={};var _0x3423fa={};var _0x1fb457;var _0x5d172e;return db[_0x0638('0x26')][_0x0638('0x6a')]({'where':{'id':_0x384164[_0x0638('0x41')]['id']}})[_0x0638('0x3f')](handleEntityNotFound(_0x31b756,null))[_0x0638('0x3f')](function(_0x2b1863){if(_0x2b1863){_0x1fb457=_0x2b1863;_0x3423fa[_0x0638('0x2f')]=_[_0x0638('0x2d')](db[_0x0638('0x84')][_0x0638('0x27')]);_0x3423fa[_0x0638('0x2c')]=_[_0x0638('0x2d')](_0x384164[_0x0638('0x2c')]);_0x3423fa[_0x0638('0x36')]=_[_0x0638('0x2e')](_0x3423fa[_0x0638('0x2f')],_0x3423fa[_0x0638('0x2c')]);_0x65d476[_0x0638('0x30')]=_['intersection'](_0x3423fa[_0x0638('0x2f')],qs[_0x0638('0x31')](_0x384164[_0x0638('0x2c')][_0x0638('0x31')]));_0x65d476['attributes']=_0x65d476[_0x0638('0x30')][_0x0638('0x32')]?_0x65d476[_0x0638('0x30')]:_0x3423fa[_0x0638('0x2f')];_0x65d476[_0x0638('0x33')]=qs[_0x0638('0x34')](_0x384164['query'][_0x0638('0x34')]);_0x65d476[_0x0638('0x35')]=qs[_0x0638('0x36')](_[_0x0638('0x37')](_0x384164[_0x0638('0x2c')],_0x3423fa[_0x0638('0x36')]));if(_0x384164[_0x0638('0x2c')][_0x0638('0x3a')]){_0x65d476[_0x0638('0x35')]=_[_0x0638('0x38')](_0x65d476[_0x0638('0x35')],{'$or':_[_0x0638('0x2b')](_0x65d476[_0x0638('0x30')],function(_0x350062){var _0x1569aa={};_0x1569aa[_0x350062]={'$like':'%'+_0x384164['query'][_0x0638('0x3a')]+'%'};return _0x1569aa;})});}_0x65d476=_[_0x0638('0x38')]({},_0x65d476,_0x384164['options']);return _0x1fb457[_0x0638('0x93')](_0x65d476);}})[_0x0638('0x3f')](function(_0x49a0db){if(_0x49a0db){_0x5d172e=_0x49a0db[_0x0638('0x32')];if(!_0x384164[_0x0638('0x2c')][_0x0638('0x94')]('nolimit')){_0x65d476['limit']=qs[_0x0638('0x1e')](_0x384164[_0x0638('0x2c')]['limit']);_0x65d476[_0x0638('0x1c')]=qs[_0x0638('0x1c')](_0x384164['query'][_0x0638('0x1c')]);}return _0x1fb457['getAgents'](_0x65d476);}})[_0x0638('0x3f')](function(_0x403c53){if(_0x403c53){return _0x403c53?{'count':_0x5d172e,'rows':_0x403c53}:null;}})[_0x0638('0x3f')](respondWithResult(_0x31b756,null))['catch'](handleError(_0x31b756,null));};
\ No newline at end of file