Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index d7c227d..88ca625 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1aaa=['socket.io-emitter','./voiceQueue.socket','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','Agents','online','forEach','penalty','sequelize','transaction','addTeams','UserVoiceQueue','findOrCreate','upsert','interface','format','SIP/%s','voicePause','emit','removeTeams','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','ids','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','removeLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1aaa,0x99));var _0xa1aa=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x1aaa[_0x5a79e2];return _0x266c45;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa1aa('0x0'));var rimraf=require(_0xa1aa('0x1'));var zipdir=require(_0xa1aa('0x2'));var jsonpatch=require(_0xa1aa('0x3'));var rp=require('request-promise');var moment=require(_0xa1aa('0x4'));var BPromise=require(_0xa1aa('0x5'));var Mustache=require(_0xa1aa('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa1aa('0x7'));var csv=require(_0xa1aa('0x8'));var ejs=require(_0xa1aa('0x9'));var fs=require('fs');var _=require(_0xa1aa('0xa'));var squel=require(_0xa1aa('0xb'));var crypto=require('crypto');var jsforce=require(_0xa1aa('0xc'));var deskjs=require(_0xa1aa('0xd'));var toCsv=require(_0xa1aa('0x8'));var querystring=require('querystring');var Papa=require(_0xa1aa('0xe'));var Redis=require('ioredis');var authService=require(_0xa1aa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa1aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1aa('0x11'))('api');var utils=require(_0xa1aa('0x12'));var config=require(_0xa1aa('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1aa('0x14'))['db'];config['redis']=_['defaults'](config[_0xa1aa('0x15')],{'host':_0xa1aa('0x16'),'port':0x18eb});var socket=require(_0xa1aa('0x17'))(new Redis(config[_0xa1aa('0x15')]));require(_0xa1aa('0x18'))['register'](socket);function respondWithStatusCode(_0x14dc75,_0x101e34){_0x101e34=_0x101e34||0xcc;return function(_0x117810){if(_0x117810){return _0x14dc75['sendStatus'](_0x101e34);}return _0x14dc75[_0xa1aa('0x19')](_0x101e34)[_0xa1aa('0x1a')]();};}function respondWithResult(_0x5b587d,_0x454ba4){_0x454ba4=_0x454ba4||0xc8;return function(_0x5c4c63){if(_0x5c4c63){return _0x5b587d[_0xa1aa('0x19')](_0x454ba4)[_0xa1aa('0x1b')](_0x5c4c63);}};}function respondWithFilteredResult(_0x5c0dca,_0xc6f0ec){return function(_0x30427b){if(_0x30427b){var _0x15c655=_0x30427b['count'],_0xd0d89=_0xc6f0ec[_0xa1aa('0x1c')],_0x10bdaf=_0xc6f0ec[_0xa1aa('0x1c')]+_0xc6f0ec[_0xa1aa('0x1d')],_0x4669eb;if(_0x10bdaf>=_0x15c655){_0x10bdaf=_0x15c655;_0x4669eb=0xc8;}else{_0x4669eb=0xce;}_0x5c0dca[_0xa1aa('0x19')](_0x4669eb);return _0x5c0dca['set'](_0xa1aa('0x1e'),_0xd0d89+'-'+_0x10bdaf+'/'+_0x15c655)[_0xa1aa('0x1b')](_0x30427b);}return null;};}function patchUpdates(_0x3d1aba){return function(_0x363963){try{jsonpatch[_0xa1aa('0x1f')](_0x363963,_0x3d1aba,!![]);}catch(_0x2854dd){return BPromise[_0xa1aa('0x20')](_0x2854dd);}return _0x363963[_0xa1aa('0x21')]();};}function saveUpdates(_0x3d8a86,_0x15e1a9){return function(_0x1a7c81){if(_0x1a7c81){return _0x1a7c81[_0xa1aa('0x22')](_0x3d8a86)[_0xa1aa('0x23')](function(_0x4891fa){return _0x4891fa;});}return null;};}function removeEntity(_0x42f15c,_0x531754){return function(_0x3e61e9){if(_0x3e61e9){return _0x3e61e9[_0xa1aa('0x24')]()['then'](function(){var _0x9badce=_0x3e61e9[_0xa1aa('0x25')]({'plain':!![]});var _0x3ab4c8=[{'name':_0xa1aa('0x26'),'value':_0xa1aa('0x27'),'ignore':![]},{'name':_0xa1aa('0x28'),'value':_0xa1aa('0x29'),'ignore':![]}];var _0x3a0aa5=_(_0x3ab4c8)[_0xa1aa('0x2a')](_0xa1aa('0x2b'))[_0xa1aa('0x2c')](_0xa1aa('0x2d'))['value']();if(_[_0xa1aa('0x2e')](_0x3a0aa5,_0x9badce['type'])){return;}var _0xef41e3=_['find'](_0x3ab4c8,[_0xa1aa('0x2d'),_0x9badce['type']])[_0xa1aa('0x2f')];return db[_0xa1aa('0x30')][_0xa1aa('0x24')]({'where':{'type':_0xef41e3,'resourceId':_0x9badce['id']}})[_0xa1aa('0x23')](function(){return _0x3e61e9;});})[_0xa1aa('0x23')](function(){_0x42f15c[_0xa1aa('0x19')](0xcc)[_0xa1aa('0x1a')]();});}};}function handleEntityNotFound(_0x2767da,_0x2eafb6){return function(_0x2f2b55){if(!_0x2f2b55){_0x2767da[_0xa1aa('0x31')](0x194);}return _0x2f2b55;};}function handleError(_0x57568b,_0x494b81){_0x494b81=_0x494b81||0x1f4;return function(_0x5b63a4){logger[_0xa1aa('0x32')](_0x5b63a4[_0xa1aa('0x33')]);if(_0x5b63a4[_0xa1aa('0x2f')]){delete _0x5b63a4['name'];}_0x57568b[_0xa1aa('0x19')](_0x494b81)[_0xa1aa('0x34')](_0x5b63a4);};}exports[_0xa1aa('0x35')]=function(_0x41d469,_0x6c5434){var _0x35d2d7={},_0x486351={},_0x19b854={'count':0x0,'rows':[]};var _0x783c81=_[_0xa1aa('0x2c')](db[_0xa1aa('0x36')][_0xa1aa('0x37')],function(_0x2a0ba6){return{'name':_0x2a0ba6['fieldName'],'type':_0x2a0ba6[_0xa1aa('0x38')][_0xa1aa('0x39')]};});_0x486351[_0xa1aa('0x3a')]=_[_0xa1aa('0x2c')](_0x783c81,_0xa1aa('0x2f'));_0x486351[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x41d469['query']);_0x486351[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0x486351[_0xa1aa('0x3a')],_0x486351[_0xa1aa('0x3b')]);_0x35d2d7[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x486351['model'],qs[_0xa1aa('0x40')](_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x35d2d7[_0xa1aa('0x3f')]=_0x35d2d7[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x35d2d7[_0xa1aa('0x3f')]:_0x486351[_0xa1aa('0x3a')];if(!_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x42')](_0xa1aa('0x43'))){_0x35d2d7[_0xa1aa('0x1d')]=qs['limit'](_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x35d2d7['offset']=qs['offset'](_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x1c')]);}_0x35d2d7[_0xa1aa('0x44')]=qs['sort'](_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x45')]);_0x35d2d7['where']=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0x41d469[_0xa1aa('0x3b')],_0x486351[_0xa1aa('0x3d')]),_0x783c81);if(_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x35d2d7[_0xa1aa('0x47')]=_['merge'](_0x35d2d7['where'],{'$or':_['map'](_0x783c81,function(_0x18a85d){if(_0x18a85d[_0xa1aa('0x38')]!=='VIRTUAL'){var _0x28baa3={};_0x28baa3[_0x18a85d[_0xa1aa('0x2f')]]={'$like':'%'+_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x28baa3;}})});}_0x35d2d7=_[_0xa1aa('0x48')]({},_0x35d2d7,_0x41d469[_0xa1aa('0x49')]);var _0x412367={'where':_0x35d2d7['where']};return db[_0xa1aa('0x36')][_0xa1aa('0x4a')](_0x412367)[_0xa1aa('0x23')](function(_0x175482){_0x19b854[_0xa1aa('0x4a')]=_0x175482;if(_0x41d469[_0xa1aa('0x3b')][_0xa1aa('0x4b')]){_0x35d2d7[_0xa1aa('0x4c')]=[{'all':!![]}];}return db['VoiceQueue'][_0xa1aa('0x4d')](_0x35d2d7);})[_0xa1aa('0x23')](function(_0x44e9b8){_0x19b854[_0xa1aa('0x4e')]=_0x44e9b8;return _0x19b854;})[_0xa1aa('0x23')](respondWithFilteredResult(_0x6c5434,_0x35d2d7))['catch'](handleError(_0x6c5434,null));};exports[_0xa1aa('0x4f')]=function(_0x1b0162,_0x171d22){var _0x10d0d7={'raw':![],'where':{'id':_0x1b0162[_0xa1aa('0x50')]['id']}},_0x461751={};_0x461751[_0xa1aa('0x3a')]=_['keys'](db['VoiceQueue'][_0xa1aa('0x37')]);_0x461751[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x1b0162[_0xa1aa('0x3b')]);_0x461751[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0x461751['model'],_0x461751[_0xa1aa('0x3b')]);_0x10d0d7[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x461751[_0xa1aa('0x3a')],qs[_0xa1aa('0x40')](_0x1b0162[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x10d0d7[_0xa1aa('0x3f')]=_0x10d0d7['attributes'][_0xa1aa('0x41')]?_0x10d0d7['attributes']:_0x461751[_0xa1aa('0x3a')];if(_0x1b0162[_0xa1aa('0x3b')][_0xa1aa('0x4b')]){_0x10d0d7['include']=[{'all':!![]}];}_0x10d0d7=_[_0xa1aa('0x48')]({},_0x10d0d7,_0x1b0162[_0xa1aa('0x49')]);return db[_0xa1aa('0x36')][_0xa1aa('0x51')](_0x10d0d7)['then'](handleEntityNotFound(_0x171d22,null))[_0xa1aa('0x23')](respondWithResult(_0x171d22,null))[_0xa1aa('0x52')](handleError(_0x171d22,null));};exports['create']=function(_0x57df9b,_0x5405ed){return db[_0xa1aa('0x36')][_0xa1aa('0x53')](_0x57df9b[_0xa1aa('0x54')],{})[_0xa1aa('0x23')](function(_0x31ac62){var _0x1f39d4=_0x57df9b[_0xa1aa('0x55')][_0xa1aa('0x25')]({'plain':!![]});if(!_0x1f39d4)throw new Error(_0xa1aa('0x56'));if(_0x1f39d4[_0xa1aa('0x57')]==='user'){var _0x1a489f=_0x31ac62['get']({'plain':!![]});var _0x3a1541=[{'name':_0xa1aa('0x26'),'value':_0xa1aa('0x27')},{'name':_0xa1aa('0x28'),'value':'outbound'}];var _0xfc8708=_[_0xa1aa('0x51')](_0x3a1541,['value',_0x1a489f['type']])['name'];return db['UserProfileSection'][_0xa1aa('0x51')]({'where':{'name':_0xfc8708,'userProfileId':_0x1f39d4[_0xa1aa('0x58')]},'raw':!![]})['then'](function(_0xbff1fd){if(_0xbff1fd&&_0xbff1fd[_0xa1aa('0x59')]===0x0){return db['UserProfileResource'][_0xa1aa('0x53')]({'name':_0x1a489f[_0xa1aa('0x2f')],'resourceId':_0x1a489f['id'],'type':_0xbff1fd[_0xa1aa('0x2f')],'sectionId':_0xbff1fd['id']},{})['then'](function(){return _0x31ac62;});}else{return _0x31ac62;}})['catch'](function(_0x11c0f4){logger[_0xa1aa('0x32')](_0xa1aa('0x5a'),_0x11c0f4);throw _0x11c0f4;});}return _0x31ac62;})[_0xa1aa('0x23')](respondWithResult(_0x5405ed,0xc9))[_0xa1aa('0x52')](handleError(_0x5405ed,null));};exports['clone']=function(_0x3a2299,_0x157120){var _0x165394={'where':{'id':_0x3a2299['params']['id']}},_0x1642f3={};_0x1642f3['model']=_[_0xa1aa('0x3c')](db[_0xa1aa('0x36')]['rawAttributes']);_0x165394[_0xa1aa('0x3f')]=_['intersection'](_0x1642f3[_0xa1aa('0x3a')],qs[_0xa1aa('0x40')](_0x3a2299[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x165394['attributes']=_0x165394['attributes'][_0xa1aa('0x41')]?_0x165394[_0xa1aa('0x3f')]:_0x1642f3['model'];if(_0x3a2299['query'][_0xa1aa('0x4b')]){_0x165394[_0xa1aa('0x4c')]=[{'all':!![]}];}_0x165394=_[_0xa1aa('0x48')]({},_0x165394,_0x3a2299[_0xa1aa('0x49')]);return db['VoiceQueue'][_0xa1aa('0x51')](_0x165394)[_0xa1aa('0x23')](handleEntityNotFound(_0x157120,null))[_0xa1aa('0x23')](function(_0x26c778){if(_0x26c778){var _0x54019c=_0x26c778[_0xa1aa('0x25')]({'plain':!![]});_0x54019c=qs[_0xa1aa('0x5b')](_0x54019c,['id',_0xa1aa('0x5c'),_0xa1aa('0x5d')]);_0x3a2299['body']=_[_0xa1aa('0x5b')](_0x3a2299['body'],['id','createdAt',_0xa1aa('0x5d')]);return db['VoiceQueue'][_0xa1aa('0x53')](_[_0xa1aa('0x48')](_0x54019c,_0x3a2299[_0xa1aa('0x54')]),{'include':_0x3a2299[_0xa1aa('0x3b')][_0xa1aa('0x4b')]?[{'all':!![]}]:undefined})[_0xa1aa('0x23')](function(_0x213b4c){var _0x5db85d=_0x3a2299[_0xa1aa('0x55')]['get']({'plain':!![]});if(!_0x5db85d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5db85d['role']===_0xa1aa('0x55')){var _0x5663b2=_0x213b4c[_0xa1aa('0x25')]({'plain':!![]});var _0x4e3c15=[{'name':_0xa1aa('0x26'),'value':'inbound'},{'name':_0xa1aa('0x28'),'value':'outbound'}];var _0x3c047d=_[_0xa1aa('0x51')](_0x4e3c15,[_0xa1aa('0x2d'),_0x5663b2[_0xa1aa('0x38')]])[_0xa1aa('0x2f')];return db[_0xa1aa('0x5e')][_0xa1aa('0x51')]({'where':{'name':_0x3c047d,'userProfileId':_0x5db85d[_0xa1aa('0x58')]},'raw':!![]})[_0xa1aa('0x23')](function(_0x5d8b9c){if(_0x5d8b9c&&_0x5d8b9c['autoAssociation']===0x0){return db['UserProfileResource'][_0xa1aa('0x53')]({'name':_0x5663b2['name'],'resourceId':_0x5663b2['id'],'type':_0x5d8b9c[_0xa1aa('0x2f')],'sectionId':_0x5d8b9c['id']},{})[_0xa1aa('0x23')](function(){return _0x213b4c;});}else{return _0x213b4c;}})[_0xa1aa('0x52')](function(_0x39daab){logger['error'](_0xa1aa('0x5a'),_0x39daab);throw _0x39daab;});}return _0x213b4c;});}})['then'](respondWithResult(_0x157120,0xc9))[_0xa1aa('0x52')](handleError(_0x157120,null));};exports[_0xa1aa('0x22')]=function(_0x2066f3,_0x5737af){if(_0x2066f3[_0xa1aa('0x54')]['id']){delete _0x2066f3['body']['id'];}return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x2066f3['params']['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x5737af,null))[_0xa1aa('0x23')](saveUpdates(_0x2066f3[_0xa1aa('0x54')],null))['then'](respondWithResult(_0x5737af,null))[_0xa1aa('0x52')](handleError(_0x5737af,null));};exports['destroy']=function(_0x32f6c8,_0x551a18){return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x32f6c8[_0xa1aa('0x50')]['id']}})['then'](handleEntityNotFound(_0x551a18,null))[_0xa1aa('0x23')](removeEntity(_0x551a18,null))[_0xa1aa('0x52')](handleError(_0x551a18,null));};exports[_0xa1aa('0x5f')]=function(_0x5c7567,_0x1133b3,_0x3fe730){var _0xe4aa41={'raw':![],'where':{}};var _0xbb45d8={};var _0x586e52={'count':0x0,'rows':[]};return db[_0xa1aa('0x36')][_0xa1aa('0x60')]({'where':{'id':_0x5c7567[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x1133b3,null))[_0xa1aa('0x23')](function(_0x4d978e){if(_0x4d978e){_0xbb45d8[_0xa1aa('0x3a')]=_[_0xa1aa('0x3c')](db[_0xa1aa('0x61')]['rawAttributes']);_0xbb45d8[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x5c7567[_0xa1aa('0x3b')]);_0xbb45d8[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0xbb45d8['model'],_0xbb45d8['query']);_0xe4aa41[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0xbb45d8[_0xa1aa('0x3a')],qs[_0xa1aa('0x40')](_0x5c7567[_0xa1aa('0x3b')]['fields']));_0xe4aa41[_0xa1aa('0x3f')]=_0xe4aa41[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0xe4aa41[_0xa1aa('0x3f')]:_0xbb45d8[_0xa1aa('0x3a')];if(!_0x5c7567[_0xa1aa('0x3b')][_0xa1aa('0x42')]('nolimit')){_0xe4aa41[_0xa1aa('0x1d')]=qs['limit'](_0x5c7567['query']['limit']);_0xe4aa41[_0xa1aa('0x1c')]=qs[_0xa1aa('0x1c')](_0x5c7567[_0xa1aa('0x3b')][_0xa1aa('0x1c')]);}_0xe4aa41[_0xa1aa('0x44')]=qs['sort'](_0x5c7567[_0xa1aa('0x3b')]['sort']);_0xe4aa41[_0xa1aa('0x47')]=qs['filters'](_['pick'](_0x5c7567[_0xa1aa('0x3b')],_0xbb45d8[_0xa1aa('0x3d')]));_0xe4aa41[_0xa1aa('0x47')]['VoiceQueueId']=_0x4d978e['id'];if(_0x5c7567[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0xe4aa41[_0xa1aa('0x47')]=_[_0xa1aa('0x48')](_0xe4aa41[_0xa1aa('0x47')],{'$or':_[_0xa1aa('0x2c')](_0xe4aa41['attributes'],function(_0x478f5f){var _0x431fbb={};_0x431fbb[_0x478f5f]={'$like':'%'+_0x5c7567['query'][_0xa1aa('0x2a')]+'%'};return _0x431fbb;})});}_0xe4aa41=_[_0xa1aa('0x48')]({},_0xe4aa41,_0x5c7567[_0xa1aa('0x49')]);return db[_0xa1aa('0x61')][_0xa1aa('0x4a')]({'where':_0xe4aa41['where']})[_0xa1aa('0x23')](function(_0x13b1fc){_0x586e52[_0xa1aa('0x4a')]=_0x13b1fc;if(_0x5c7567['query']['includeAll']){_0xe4aa41['include']=[{'all':!![]}];}return db[_0xa1aa('0x61')]['findAll'](_0xe4aa41);})['then'](function(_0xb89c0d){_0x586e52[_0xa1aa('0x4e')]=_0xb89c0d;return _0x586e52;});}})[_0xa1aa('0x23')](respondWithFilteredResult(_0x1133b3,_0xe4aa41))['catch'](handleError(_0x1133b3,null));};exports['getHopperHistories']=function(_0xdf07c7,_0x12ea81,_0x406ae4){var _0x47fd33={'raw':!![],'where':{}};var _0x5b4490={};var _0x365639={'count':0x0,'rows':[]};return db[_0xa1aa('0x36')][_0xa1aa('0x60')]({'where':{'id':_0xdf07c7['params']['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x12ea81,null))[_0xa1aa('0x23')](function(_0x23e547){if(_0x23e547){_0x5b4490[_0xa1aa('0x3a')]=_[_0xa1aa('0x3c')](db[_0xa1aa('0x62')]['rawAttributes']);_0x5b4490[_0xa1aa('0x3b')]=_['keys'](_0xdf07c7[_0xa1aa('0x3b')]);_0x5b4490[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0x5b4490['model'],_0x5b4490[_0xa1aa('0x3b')]);_0x47fd33[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x5b4490[_0xa1aa('0x3a')],qs[_0xa1aa('0x40')](_0xdf07c7[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x47fd33[_0xa1aa('0x3f')]=_0x47fd33['attributes'][_0xa1aa('0x41')]?_0x47fd33[_0xa1aa('0x3f')]:_0x5b4490[_0xa1aa('0x3a')];if(!_0xdf07c7[_0xa1aa('0x3b')][_0xa1aa('0x42')]('nolimit')){_0x47fd33[_0xa1aa('0x1d')]=qs[_0xa1aa('0x1d')](_0xdf07c7[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x47fd33[_0xa1aa('0x1c')]=qs[_0xa1aa('0x1c')](_0xdf07c7[_0xa1aa('0x3b')][_0xa1aa('0x1c')]);}_0x47fd33[_0xa1aa('0x44')]=qs[_0xa1aa('0x45')](_0xdf07c7['query'][_0xa1aa('0x45')]);_0x47fd33[_0xa1aa('0x47')]=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0xdf07c7[_0xa1aa('0x3b')],_0x5b4490[_0xa1aa('0x3d')]));_0x47fd33['where'][_0xa1aa('0x63')]=_0x23e547['id'];if(_0xdf07c7[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x47fd33[_0xa1aa('0x47')]=_[_0xa1aa('0x48')](_0x47fd33['where'],{'$or':_[_0xa1aa('0x2c')](_0x47fd33[_0xa1aa('0x3f')],function(_0x1b3542){var _0x3d558f={};_0x3d558f[_0x1b3542]={'$like':'%'+_0xdf07c7[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x3d558f;})});}_0x47fd33=_[_0xa1aa('0x48')]({},_0x47fd33,_0xdf07c7['options']);return db[_0xa1aa('0x62')]['count']({'where':_0x47fd33['where']})[_0xa1aa('0x23')](function(_0x4d798b){_0x365639[_0xa1aa('0x4a')]=_0x4d798b;if(_0xdf07c7[_0xa1aa('0x3b')]['includeAll']){_0x47fd33['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xa1aa('0x4d')](_0x47fd33);})['then'](function(_0x25b539){_0x365639[_0xa1aa('0x4e')]=_0x25b539;return _0x365639;});}})[_0xa1aa('0x23')](respondWithFilteredResult(_0x12ea81,_0x47fd33))['catch'](handleError(_0x12ea81,null));};exports[_0xa1aa('0x64')]=function(_0x59e72d,_0x2c4436,_0x58016f){var _0x29d34a={'raw':!![],'where':{}};var _0x3ea1dd={};var _0x55c6b3={'count':0x0,'rows':[]};return db[_0xa1aa('0x36')]['findOne']({'where':{'id':_0x59e72d[_0xa1aa('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c4436,null))[_0xa1aa('0x23')](function(_0x98c33e){if(_0x98c33e){_0x3ea1dd['model']=_[_0xa1aa('0x3c')](db[_0xa1aa('0x65')]['rawAttributes']);_0x3ea1dd[_0xa1aa('0x3b')]=_['keys'](_0x59e72d[_0xa1aa('0x3b')]);_0x3ea1dd[_0xa1aa('0x3d')]=_['intersection'](_0x3ea1dd[_0xa1aa('0x3a')],_0x3ea1dd[_0xa1aa('0x3b')]);_0x29d34a[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x3ea1dd['model'],qs[_0xa1aa('0x40')](_0x59e72d['query'][_0xa1aa('0x40')]));_0x29d34a[_0xa1aa('0x3f')]=_0x29d34a[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x29d34a[_0xa1aa('0x3f')]:_0x3ea1dd[_0xa1aa('0x3a')];if(!_0x59e72d['query'][_0xa1aa('0x42')](_0xa1aa('0x43'))){_0x29d34a['limit']=qs['limit'](_0x59e72d[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x29d34a['offset']=qs[_0xa1aa('0x1c')](_0x59e72d['query'][_0xa1aa('0x1c')]);}_0x29d34a[_0xa1aa('0x44')]=qs[_0xa1aa('0x45')](_0x59e72d[_0xa1aa('0x3b')][_0xa1aa('0x45')]);_0x29d34a[_0xa1aa('0x47')]=qs['filters'](_[_0xa1aa('0x46')](_0x59e72d['query'],_0x3ea1dd[_0xa1aa('0x3d')]));_0x29d34a['where'][_0xa1aa('0x63')]=_0x98c33e['id'];if(_0x59e72d[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x29d34a[_0xa1aa('0x47')]=_[_0xa1aa('0x48')](_0x29d34a['where'],{'$or':_['map'](_0x29d34a['attributes'],function(_0x4fbe11){var _0x439d89={};_0x439d89[_0x4fbe11]={'$like':'%'+_0x59e72d[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x439d89;})});}_0x29d34a=_[_0xa1aa('0x48')]({},_0x29d34a,_0x59e72d[_0xa1aa('0x49')]);return db['CmHopperFinal'][_0xa1aa('0x4a')]({'where':_0x29d34a[_0xa1aa('0x47')]})['then'](function(_0x1b008f){_0x55c6b3[_0xa1aa('0x4a')]=_0x1b008f;if(_0x59e72d[_0xa1aa('0x3b')][_0xa1aa('0x4b')]){_0x29d34a[_0xa1aa('0x4c')]=[{'all':!![]}];}return db[_0xa1aa('0x65')][_0xa1aa('0x4d')](_0x29d34a);})[_0xa1aa('0x23')](function(_0x344cb6){_0x55c6b3[_0xa1aa('0x4e')]=_0x344cb6;return _0x55c6b3;});}})[_0xa1aa('0x23')](respondWithFilteredResult(_0x2c4436,_0x29d34a))[_0xa1aa('0x52')](handleError(_0x2c4436,null));};exports['getHopperBlacks']=function(_0x56a521,_0x3cd1fb,_0x2392ae){var _0x31328a={'raw':!![],'where':{}};var _0x538c8b={};var _0x492d9c={'count':0x0,'rows':[]};return db[_0xa1aa('0x36')]['findOne']({'where':{'id':_0x56a521['params']['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x3cd1fb,null))[_0xa1aa('0x23')](function(_0x4eea53){if(_0x4eea53){_0x538c8b[_0xa1aa('0x3a')]=_[_0xa1aa('0x3c')](db['CmHopperBlack'][_0xa1aa('0x37')]);_0x538c8b[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x56a521[_0xa1aa('0x3b')]);_0x538c8b[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0x538c8b['model'],_0x538c8b[_0xa1aa('0x3b')]);_0x31328a[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x538c8b[_0xa1aa('0x3a')],qs['fields'](_0x56a521['query']['fields']));_0x31328a[_0xa1aa('0x3f')]=_0x31328a[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x31328a['attributes']:_0x538c8b['model'];if(!_0x56a521[_0xa1aa('0x3b')][_0xa1aa('0x42')]('nolimit')){_0x31328a['limit']=qs[_0xa1aa('0x1d')](_0x56a521[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x31328a[_0xa1aa('0x1c')]=qs[_0xa1aa('0x1c')](_0x56a521['query'][_0xa1aa('0x1c')]);}_0x31328a[_0xa1aa('0x44')]=qs['sort'](_0x56a521[_0xa1aa('0x3b')][_0xa1aa('0x45')]);_0x31328a[_0xa1aa('0x47')]=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0x56a521[_0xa1aa('0x3b')],_0x538c8b[_0xa1aa('0x3d')]));_0x31328a[_0xa1aa('0x47')][_0xa1aa('0x63')]=_0x4eea53['id'];if(_0x56a521[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x31328a[_0xa1aa('0x47')]=_[_0xa1aa('0x48')](_0x31328a[_0xa1aa('0x47')],{'$or':_[_0xa1aa('0x2c')](_0x31328a[_0xa1aa('0x3f')],function(_0x259f10){var _0x3d124e={};_0x3d124e[_0x259f10]={'$like':'%'+_0x56a521['query'][_0xa1aa('0x2a')]+'%'};return _0x3d124e;})});}_0x31328a=_[_0xa1aa('0x48')]({},_0x31328a,_0x56a521[_0xa1aa('0x49')]);return db[_0xa1aa('0x66')]['count']({'where':_0x31328a[_0xa1aa('0x47')]})[_0xa1aa('0x23')](function(_0x7011ef){_0x492d9c['count']=_0x7011ef;if(_0x56a521[_0xa1aa('0x3b')][_0xa1aa('0x4b')]){_0x31328a[_0xa1aa('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x31328a);})['then'](function(_0x19c61c){_0x492d9c['rows']=_0x19c61c;return _0x492d9c;});}})[_0xa1aa('0x23')](respondWithFilteredResult(_0x3cd1fb,_0x31328a))[_0xa1aa('0x52')](handleError(_0x3cd1fb,null));};exports[_0xa1aa('0x67')]=function(_0x4b0f43,_0x3513e6,_0x334fc2){var _0x2b8de1={};var _0x497466={};var _0x356172;var _0x2bb49b;return db['VoiceQueue'][_0xa1aa('0x60')]({'where':{'id':_0x4b0f43[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x3513e6,null))[_0xa1aa('0x23')](function(_0x4b95c9){if(_0x4b95c9){_0x356172=_0x4b95c9;_0x497466['model']=_[_0xa1aa('0x3c')](db[_0xa1aa('0x68')][_0xa1aa('0x37')]);_0x497466[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x4b0f43[_0xa1aa('0x3b')]);_0x497466['filters']=_[_0xa1aa('0x3e')](_0x497466[_0xa1aa('0x3a')],_0x497466['query']);_0x2b8de1[_0xa1aa('0x3f')]=_['intersection'](_0x497466[_0xa1aa('0x3a')],qs[_0xa1aa('0x40')](_0x4b0f43[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x2b8de1['attributes']=_0x2b8de1[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x2b8de1[_0xa1aa('0x3f')]:_0x497466[_0xa1aa('0x3a')];_0x2b8de1['order']=qs[_0xa1aa('0x45')](_0x4b0f43['query'][_0xa1aa('0x45')]);_0x2b8de1[_0xa1aa('0x47')]=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0x4b0f43['query'],_0x497466[_0xa1aa('0x3d')]));if(_0x4b0f43[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x2b8de1[_0xa1aa('0x47')]=_['merge'](_0x2b8de1[_0xa1aa('0x47')],{'$or':_[_0xa1aa('0x2c')](_0x2b8de1['attributes'],function(_0x2cae41){var _0x53537c={};_0x53537c[_0x2cae41]={'$like':'%'+_0x4b0f43[_0xa1aa('0x3b')]['filter']+'%'};return _0x53537c;})});}_0x2b8de1=_['merge']({},_0x2b8de1,_0x4b0f43[_0xa1aa('0x49')]);return _0x356172[_0xa1aa('0x67')](_0x2b8de1);}})[_0xa1aa('0x23')](function(_0x5eccda){if(_0x5eccda){_0x2bb49b=_0x5eccda['length'];if(!_0x4b0f43['query']['hasOwnProperty'](_0xa1aa('0x43'))){_0x2b8de1[_0xa1aa('0x1d')]=qs['limit'](_0x4b0f43[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x2b8de1[_0xa1aa('0x1c')]=qs[_0xa1aa('0x1c')](_0x4b0f43[_0xa1aa('0x3b')][_0xa1aa('0x1c')]);}return _0x356172[_0xa1aa('0x67')](_0x2b8de1);}})['then'](function(_0x16ceb1){if(_0x16ceb1){return _0x16ceb1?{'count':_0x2bb49b,'rows':_0x16ceb1}:null;}})[_0xa1aa('0x23')](respondWithResult(_0x3513e6,null))[_0xa1aa('0x52')](handleError(_0x3513e6,null));};exports['addTeams']=function(_0x57ca31,_0x54ad10,_0x5e33ea){var _0x215821=_0x57ca31[_0xa1aa('0x54')][_0xa1aa('0x69')];var _0x16b007=_['map'](_0x215821,'id');return db[_0xa1aa('0x68')]['findAll']({'where':{'id':_0x16b007},'attributes':['id'],'include':[{'model':db[_0xa1aa('0x6a')],'as':_0xa1aa('0x6b'),'attributes':['id',_0xa1aa('0x2f'),_0xa1aa('0x6c'),'voicePause','interface'],'raw':!![]}]})[_0xa1aa('0x23')](function(_0x27d4ef){if(_0x27d4ef){var _0x4ce99f=_['flatMap'](_0x27d4ef,function(_0x2e1fc1){var _0x16b6a5=_0x2e1fc1[_0xa1aa('0x25')]({'plain':!![]});_0x16b6a5[_0xa1aa('0x6b')][_0xa1aa('0x6d')](function(_0x24783){_0x24783[_0xa1aa('0x6e')]=_['find'](_0x215821,{'id':_0x16b6a5['id']})['penalty'];});return _0x16b6a5[_0xa1aa('0x6b')];});return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x57ca31[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](function(_0x1e34d5){return db[_0xa1aa('0x6f')][_0xa1aa('0x70')](function(_0x20acda){return _0x1e34d5[_0xa1aa('0x71')](_0x16b007,{'transaction':_0x20acda})[_0xa1aa('0x23')](function(){return BPromise['each'](_0x4ce99f,function(_0x170f5d){return db[_0xa1aa('0x72')][_0xa1aa('0x73')]({'where':{'UserId':_0x170f5d['id'],'VoiceQueueId':_0x57ca31['params']['id']},'defaults':{'penalty':_0x170f5d[_0xa1aa('0x6e')]},'transaction':_0x20acda});});})[_0xa1aa('0x23')](function(){return BPromise['each'](_[_0xa1aa('0x2a')](_0x4ce99f,{'online':!![]}),function(_0x4d66c2){return db['UserVoiceQueueRt'][_0xa1aa('0x74')]({'membername':_0x4d66c2['name'],'UserId':_0x4d66c2['id'],'queue_name':_0x1e34d5[_0xa1aa('0x2f')],'VoiceQueueId':_0x1e34d5['id'],'interface':_['isNil'](_0x4d66c2[_0xa1aa('0x75')])?util[_0xa1aa('0x76')](_0xa1aa('0x77'),_0x4d66c2[_0xa1aa('0x2f')]):_0x4d66c2[_0xa1aa('0x75')],'paused':_0x4d66c2[_0xa1aa('0x78')]||![],'penalty':_0x4d66c2[_0xa1aa('0x6e')]},{'transaction':_0x20acda});});})['then'](function(){_0x4ce99f[_0xa1aa('0x6d')](function(_0x248776){socket[_0xa1aa('0x79')]('userVoiceQueue:save',{'UserId':_0x248776['id'],'VoiceQueueId':_0x1e34d5['id']});});});});});}})[_0xa1aa('0x23')](respondWithStatusCode(_0x54ad10,null))['catch'](handleError(_0x54ad10,null));};exports[_0xa1aa('0x7a')]=function(_0x27d0cc,_0x4309d3,_0xbbea4a){return db[_0xa1aa('0x68')][_0xa1aa('0x4d')]({'where':{'id':_0x27d0cc[_0xa1aa('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa1aa('0x6a')],'as':_0xa1aa('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa1aa('0x23')](handleEntityNotFound(_0x4309d3,null))[_0xa1aa('0x23')](function(_0x5059d2){var _0x522045=_[_0xa1aa('0x2c')](_0x5059d2,'id');var _0x17d24f=[];var _0x121fb0=[];var _0x5294d9=squel[_0xa1aa('0x7b')]();_0x5294d9['field'](_0xa1aa('0x7c'))[_0xa1aa('0x7d')](_0xa1aa('0x7e'),'tq')[_0xa1aa('0x7f')](_0xa1aa('0x80'),'ut',_0xa1aa('0x81'))[_0xa1aa('0x47')](_0xa1aa('0x82'),_0x27d0cc['params']['id']);for(var _0xca22c5=0x0;_0xca22c5<_0x5059d2[_0xa1aa('0x41')];_0xca22c5+=0x1){let _0x1b0592=_0x5059d2[_0xca22c5];for(var _0x29e8f2=0x0;_0x29e8f2<_0x1b0592[_0xa1aa('0x6b')]['length'];_0x29e8f2+=0x1){let _0xa9c210=_0x1b0592['Agents'][_0x29e8f2];var _0x8e8c12=_0x5294d9['clone']();_0x8e8c12[_0xa1aa('0x47')](_0xa1aa('0x83'),_0xa9c210['id']);_0x121fb0[_0xa1aa('0x84')](db[_0xa1aa('0x6f')][_0xa1aa('0x3b')](_0x8e8c12[_0xa1aa('0x85')](),{'type':db['sequelize'][_0xa1aa('0x86')][_0xa1aa('0x87')]})[_0xa1aa('0x23')](function(_0x3a4f40){if(_0x3a4f40[_0xa1aa('0x41')]===0x1){return _0xa9c210['id'];}else{var _0x4ee034=_[_0xa1aa('0x88')](_[_0xa1aa('0x2c')](_0x3a4f40,_0xa1aa('0x89')),function(_0x415d2b){return _[_0xa1aa('0x2e')](_0x522045,_0x415d2b);});if(_0x4ee034){return _0xa9c210['id'];}}}));}}return BPromise[_0xa1aa('0x8a')](_0x121fb0)[_0xa1aa('0x23')](function(_0x30eb74){_0x17d24f=_(_0x17d24f)[_0xa1aa('0x8b')](_0x30eb74)[_0xa1aa('0x8c')]()['value']();return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x27d0cc[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](function(_0x2bc477){return db[_0xa1aa('0x6f')]['transaction'](function(_0x1ff0da){return _0x2bc477[_0xa1aa('0x7a')](_0x27d0cc['query'][_0xa1aa('0x8d')],{'transaction':_0x1ff0da})[_0xa1aa('0x23')](function(){if(!_['isEmpty'](_0x17d24f)){return _0x2bc477[_0xa1aa('0x8e')](_0x17d24f,{'transaction':_0x1ff0da})[_0xa1aa('0x23')](function(){return db[_0xa1aa('0x8f')][_0xa1aa('0x24')]({'where':{'VoiceQueueId':_0x27d0cc[_0xa1aa('0x50')]['id'],'UserId':_0x17d24f},'transaction':_0x1ff0da});});}})[_0xa1aa('0x23')](function(){_0x17d24f[_0xa1aa('0x6d')](function(_0x2b5f0a){socket[_0xa1aa('0x79')](_0xa1aa('0x90'),{'UserId':_0x2b5f0a,'VoiceQueueId':_0x2bc477['id']});});});});});});})[_0xa1aa('0x23')](respondWithStatusCode(_0x4309d3,null))[_0xa1aa('0x52')](handleError(_0x4309d3,null));};exports[_0xa1aa('0x91')]=function(_0x288363,_0x10e6cf,_0x1cb7ac){var _0x44e879,_0x2cc63b;return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x288363['params']['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x10e6cf,null))[_0xa1aa('0x23')](function(_0x30b08c){if(_0x30b08c){_0x2cc63b=_0x30b08c;return _0x30b08c[_0xa1aa('0x91')](_0x288363['body']['ids'],_[_0xa1aa('0x5b')](_0x288363['body'],[_0xa1aa('0x8d'),'id'])||{})[_0xa1aa('0x92')](function(_0x448f72){for(var _0xecb0bc=0x0;_0xecb0bc<_0x288363[_0xa1aa('0x54')][_0xa1aa('0x8d')][_0xa1aa('0x41')];_0xecb0bc+=0x1){socket[_0xa1aa('0x79')]('userVoiceQueue:save',{'UserId':_0x288363[_0xa1aa('0x54')]['ids'][_0xecb0bc],'VoiceQueueId':_0x288363[_0xa1aa('0x50')]['id']});}return _0x448f72;});}})[_0xa1aa('0x23')](function(_0xdcfe26){_0x44e879=_0xdcfe26||[];if(_0x2cc63b){return db[_0xa1aa('0x6a')][_0xa1aa('0x4d')]({'where':{'id':_0x288363['body'][_0xa1aa('0x8d')]},'attributes':['id',_0xa1aa('0x2f'),'online',_0xa1aa('0x78'),'interface'],'raw':!![]});}})[_0xa1aa('0x23')](function(_0x188873){if(!_[_0xa1aa('0x93')](_0x188873)){var _0xfdad05=[];for(var _0x5537d6=0x0;_0x5537d6<_0x188873['length'];_0x5537d6++){if(_0x188873[_0x5537d6][_0xa1aa('0x6c')]){_0xfdad05[_0xa1aa('0x84')](db['UserVoiceQueueRt'][_0xa1aa('0x74')]({'membername':_0x188873[_0x5537d6][_0xa1aa('0x2f')],'UserId':_0x188873[_0x5537d6]['id'],'queue_name':_0x2cc63b[_0xa1aa('0x2f')],'VoiceQueueId':_0x2cc63b['id'],'interface':_['isNil'](_0x188873[_0x5537d6]['interface'])?util['format'](_0xa1aa('0x77'),_0x188873[_0x5537d6][_0xa1aa('0x2f')]):_0x188873[_0x5537d6]['interface'],'paused':_0x188873[_0x5537d6][_0xa1aa('0x78')]||![],'penalty':_0x288363[_0xa1aa('0x54')][_0xa1aa('0x6e')]||0x0}));}}return BPromise['all'](_0xfdad05);}})[_0xa1aa('0x23')](function(){return _0x44e879;})[_0xa1aa('0x23')](respondWithResult(_0x10e6cf,null))[_0xa1aa('0x52')](handleError(_0x10e6cf,null));};exports[_0xa1aa('0x8e')]=function(_0x39dcfd,_0x296229,_0x52bb0b){return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x39dcfd[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x296229,null))[_0xa1aa('0x23')](function(_0x257de3){if(_0x257de3){return _0x257de3[_0xa1aa('0x8e')](_0x39dcfd[_0xa1aa('0x3b')]['ids'])[_0xa1aa('0x23')](function(){if(_['isArray'](_0x39dcfd['query'][_0xa1aa('0x8d')])){for(var _0x1f4a17=0x0;_0x1f4a17<_0x39dcfd[_0xa1aa('0x3b')][_0xa1aa('0x8d')][_0xa1aa('0x41')];_0x1f4a17+=0x1){socket[_0xa1aa('0x79')](_0xa1aa('0x90'),{'UserId':Number(_0x39dcfd[_0xa1aa('0x3b')]['ids'][_0x1f4a17]),'VoiceQueueId':Number(_0x39dcfd[_0xa1aa('0x50')]['id'])});}}else{socket[_0xa1aa('0x79')](_0xa1aa('0x90'),{'UserId':Number(_0x39dcfd['query']['ids']),'VoiceQueueId':Number(_0x39dcfd['params']['id'])});}});}})[_0xa1aa('0x23')](function(_0x190bdc){return db[_0xa1aa('0x8f')][_0xa1aa('0x24')]({'where':{'VoiceQueueId':_0x39dcfd[_0xa1aa('0x50')]['id'],'UserId':_0x39dcfd[_0xa1aa('0x3b')][_0xa1aa('0x8d')]}})['then'](function(){return _0x190bdc;});})[_0xa1aa('0x23')](respondWithStatusCode(_0x296229,null))[_0xa1aa('0x52')](handleError(_0x296229,null));};exports['getAgents']=function(_0x1372b1,_0x843718,_0x214317){var _0x586d62={};var _0x46719c={};var _0x4029ca;var _0x2cf22e;return db[_0xa1aa('0x36')]['findOne']({'where':{'id':_0x1372b1[_0xa1aa('0x50')]['id']}})['then'](handleEntityNotFound(_0x843718,null))[_0xa1aa('0x23')](function(_0x50b514){if(_0x50b514){_0x4029ca=_0x50b514;_0x46719c[_0xa1aa('0x3a')]=_[_0xa1aa('0x3c')](db['User']['rawAttributes']);_0x46719c[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x1372b1[_0xa1aa('0x3b')]);_0x46719c[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0x46719c[_0xa1aa('0x3a')],_0x46719c[_0xa1aa('0x3b')]);_0x586d62['attributes']=_[_0xa1aa('0x3e')](_0x46719c['model'],qs['fields'](_0x1372b1[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x586d62[_0xa1aa('0x3f')]=_0x586d62[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x586d62['attributes']:_0x46719c['model'];_0x586d62[_0xa1aa('0x44')]=qs[_0xa1aa('0x45')](_0x1372b1[_0xa1aa('0x3b')][_0xa1aa('0x45')]);_0x586d62[_0xa1aa('0x47')]=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0x1372b1[_0xa1aa('0x3b')],_0x46719c[_0xa1aa('0x3d')]));if(_0x1372b1[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x586d62['where']=_[_0xa1aa('0x48')](_0x586d62[_0xa1aa('0x47')],{'$or':_['map'](_0x586d62[_0xa1aa('0x3f')],function(_0xfc5633){var _0x2b30aa={};_0x2b30aa[_0xfc5633]={'$like':'%'+_0x1372b1[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x2b30aa;})});}_0x586d62=_[_0xa1aa('0x48')]({},_0x586d62,_0x1372b1[_0xa1aa('0x49')]);return _0x4029ca[_0xa1aa('0x94')](_0x586d62);}})[_0xa1aa('0x23')](function(_0x3c438c){if(_0x3c438c){_0x2cf22e=_0x3c438c[_0xa1aa('0x41')];if(!_0x1372b1['query'][_0xa1aa('0x42')](_0xa1aa('0x43'))){_0x586d62[_0xa1aa('0x1d')]=qs[_0xa1aa('0x1d')](_0x1372b1[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x586d62[_0xa1aa('0x1c')]=qs['offset'](_0x1372b1[_0xa1aa('0x3b')]['offset']);}return _0x4029ca[_0xa1aa('0x94')](_0x586d62);}})[_0xa1aa('0x23')](function(_0x1a4690){if(_0x1a4690){return _0x1a4690?{'count':_0x2cf22e,'rows':_0x1a4690}:null;}})['then'](respondWithResult(_0x843718,null))[_0xa1aa('0x52')](handleError(_0x843718,null));};exports[_0xa1aa('0x95')]=function(_0x11106a,_0x26b009,_0x323d56){var _0x3e704b={};var _0x5e413f={};var _0x2fff59;var _0x24c39d;return db['VoiceQueue'][_0xa1aa('0x60')]({'where':{'id':_0x11106a['params']['id']}})['then'](handleEntityNotFound(_0x26b009,null))[_0xa1aa('0x23')](function(_0x9cf45){if(_0x9cf45){_0x2fff59=_0x9cf45;_0x5e413f['model']=_[_0xa1aa('0x3c')](db[_0xa1aa('0x8f')][_0xa1aa('0x37')]);_0x5e413f[_0xa1aa('0x3b')]=_[_0xa1aa('0x3c')](_0x11106a[_0xa1aa('0x3b')]);_0x5e413f[_0xa1aa('0x3d')]=_['intersection'](_0x5e413f[_0xa1aa('0x3a')],_0x5e413f[_0xa1aa('0x3b')]);_0x3e704b['attributes']=_['intersection'](_0x5e413f[_0xa1aa('0x3a')],qs[_0xa1aa('0x40')](_0x11106a[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x3e704b[_0xa1aa('0x3f')]=_0x3e704b[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x3e704b[_0xa1aa('0x3f')]:_0x5e413f[_0xa1aa('0x3a')];_0x3e704b[_0xa1aa('0x44')]=qs[_0xa1aa('0x45')](_0x11106a['query']['sort']);_0x3e704b['where']=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0x11106a['query'],_0x5e413f[_0xa1aa('0x3d')]));if(_0x11106a[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x3e704b['where']=_['merge'](_0x3e704b[_0xa1aa('0x47')],{'$or':_['map'](_0x3e704b['attributes'],function(_0x3b3063){var _0x3bad47={};_0x3bad47[_0x3b3063]={'$like':'%'+_0x11106a[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x3bad47;})});}_0x3e704b=_[_0xa1aa('0x48')]({},_0x3e704b,_0x11106a[_0xa1aa('0x49')]);return _0x2fff59[_0xa1aa('0x95')](_0x3e704b);}})[_0xa1aa('0x23')](function(_0x121e5b){if(_0x121e5b){_0x24c39d=_0x121e5b[_0xa1aa('0x41')];if(!_0x11106a[_0xa1aa('0x3b')]['hasOwnProperty']('nolimit')){_0x3e704b[_0xa1aa('0x1d')]=qs[_0xa1aa('0x1d')](_0x11106a[_0xa1aa('0x3b')][_0xa1aa('0x1d')]);_0x3e704b['offset']=qs[_0xa1aa('0x1c')](_0x11106a[_0xa1aa('0x3b')]['offset']);}return _0x2fff59['getMembers'](_0x3e704b);}})[_0xa1aa('0x23')](function(_0x451fa9){return _0x451fa9?{'count':_0x24c39d,'rows':_0x451fa9}:null;})[_0xa1aa('0x23')](respondWithResult(_0x26b009,null))[_0xa1aa('0x52')](handleError(_0x26b009,null));};exports[_0xa1aa('0x96')]=function(_0x587c4f,_0x5cb812,_0x26d72b){var _0x347ad3={};var _0x3e516d={};var _0x2edd5c;var _0x455a5b;return db[_0xa1aa('0x36')][_0xa1aa('0x60')]({'where':{'id':_0x587c4f[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x5cb812,null))[_0xa1aa('0x23')](function(_0x45769d){if(_0x45769d){_0x2edd5c=_0x45769d;_0x3e516d[_0xa1aa('0x3a')]=_[_0xa1aa('0x3c')](db[_0xa1aa('0x97')][_0xa1aa('0x37')]);_0x3e516d['query']=_[_0xa1aa('0x3c')](_0x587c4f[_0xa1aa('0x3b')]);_0x3e516d['filters']=_[_0xa1aa('0x3e')](_0x3e516d[_0xa1aa('0x3a')],_0x3e516d['query']);_0x347ad3[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x3e516d[_0xa1aa('0x3a')],qs['fields'](_0x587c4f[_0xa1aa('0x3b')]['fields']));_0x347ad3[_0xa1aa('0x3f')]=_0x347ad3[_0xa1aa('0x3f')][_0xa1aa('0x41')]?_0x347ad3[_0xa1aa('0x3f')]:_0x3e516d[_0xa1aa('0x3a')];_0x347ad3[_0xa1aa('0x44')]=qs['sort'](_0x587c4f[_0xa1aa('0x3b')]['sort']);_0x347ad3[_0xa1aa('0x47')]=qs[_0xa1aa('0x3d')](_[_0xa1aa('0x46')](_0x587c4f[_0xa1aa('0x3b')],_0x3e516d[_0xa1aa('0x3d')]));if(_0x587c4f[_0xa1aa('0x3b')][_0xa1aa('0x2a')]){_0x347ad3[_0xa1aa('0x47')]=_['merge'](_0x347ad3['where'],{'$or':_[_0xa1aa('0x2c')](_0x347ad3[_0xa1aa('0x3f')],function(_0x1fb30b){var _0x112d0a={};_0x112d0a[_0x1fb30b]={'$like':'%'+_0x587c4f[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x112d0a;})});}_0x347ad3=_[_0xa1aa('0x48')]({},_0x347ad3,_0x587c4f[_0xa1aa('0x49')]);return _0x2edd5c[_0xa1aa('0x96')](_0x347ad3);}})[_0xa1aa('0x23')](function(_0x4e8dc4){if(_0x4e8dc4){_0x455a5b=_0x4e8dc4[_0xa1aa('0x41')];if(!_0x587c4f[_0xa1aa('0x3b')]['hasOwnProperty'](_0xa1aa('0x43'))){_0x347ad3[_0xa1aa('0x1d')]=qs['limit'](_0x587c4f['query'][_0xa1aa('0x1d')]);_0x347ad3[_0xa1aa('0x1c')]=qs[_0xa1aa('0x1c')](_0x587c4f['query'][_0xa1aa('0x1c')]);}return _0x2edd5c[_0xa1aa('0x96')](_0x347ad3);}})[_0xa1aa('0x23')](function(_0x56b214){if(_0x56b214){return _0x56b214?{'count':_0x455a5b,'rows':_0x56b214}:null;}})['then'](respondWithResult(_0x5cb812,null))[_0xa1aa('0x52')](handleError(_0x5cb812,null));};exports[_0xa1aa('0x98')]=function(_0x5b995f,_0x2bf78b,_0x3c6b21){var _0x162b6e,_0x48a6fc;return db[_0xa1aa('0x36')][_0xa1aa('0x51')]({'where':{'id':_0x5b995f[_0xa1aa('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bf78b,null))[_0xa1aa('0x23')](function(_0x383bbe){if(_0x383bbe){_0x48a6fc=_0x383bbe;return _0x383bbe[_0xa1aa('0x98')](_0x5b995f['body'][_0xa1aa('0x8d')],_[_0xa1aa('0x5b')](_0x5b995f[_0xa1aa('0x54')],[_0xa1aa('0x8d'),'id'])||{});}return null;})['spread'](function(_0x5e8d1c){var _0x3274e7;_0x162b6e=_0x5e8d1c||[];var _0x24f38f=[];if(_0x5e8d1c){for(var _0x181219=0x0;_0x181219<_0x5e8d1c[_0xa1aa('0x41')];_0x181219+=0x1){var _0x760563=_0x5e8d1c[_0x181219][_0xa1aa('0x25')]({'plain':!![]});_0x48a6fc[_0xa1aa('0x99')]=_0x5b995f[_0xa1aa('0x54')][_0xa1aa('0x99')]?_0x5b995f[_0xa1aa('0x54')]['dialCheckDuplicateType']:_0x48a6fc[_0xa1aa('0x99')];switch(_0x48a6fc['dialCheckDuplicateType']){case _0xa1aa('0x9a'):_0x3274e7=squel[_0xa1aa('0x9b')]()[_0xa1aa('0x9c')](_0xa1aa('0x9d'))[_0xa1aa('0x9e')]([_0xa1aa('0x9f'),_0xa1aa('0xa0'),_0xa1aa('0xa1'),_0xa1aa('0xa2'),_0xa1aa('0x63'),_0xa1aa('0x5c'),_0xa1aa('0x5d')],squel['select']()[_0xa1aa('0xa3')]('phone','phone')[_0xa1aa('0xa3')](_0xa1aa('0xa4'),'scheduledAt')[_0xa1aa('0xa3')]('id',_0xa1aa('0xa1'))[_0xa1aa('0xa3')](_0x760563[_0xa1aa('0xa5')][_0xa1aa('0x85')](),_0xa1aa('0xa2'))[_0xa1aa('0xa3')](_0x5b995f['params']['id'][_0xa1aa('0x85')](),_0xa1aa('0x63'))[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5c'))[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5d'))['from']('cm_contacts')[_0xa1aa('0x47')](_0xa1aa('0xa6'))['where']('ListId\x20=\x20?',_0x760563['CmListId'][_0xa1aa('0x85')]())['where'](_0xa1aa('0xa7'))['where'](_0xa1aa('0xa8'),squel['select']()[_0xa1aa('0xa3')]('COALESCE(calleridnum,\x27\x27)')[_0xa1aa('0x7d')]('cm_hopper_final')[_0xa1aa('0x47')](_0xa1aa('0x82'),_0x5b995f[_0xa1aa('0x50')]['id']['toString']()))[_0xa1aa('0x47')](_0xa1aa('0xa8'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xa1aa('0x7d')]('cm_hopper')[_0xa1aa('0x47')](_0xa1aa('0x82'),_0x5b995f[_0xa1aa('0x50')]['id'][_0xa1aa('0x85')]())))[_0xa1aa('0x85')]();break;case _0xa1aa('0xa9'):_0x3274e7=squel[_0xa1aa('0x9b')]()[_0xa1aa('0x9c')]('cm_hopper')['fromQuery']([_0xa1aa('0x9f'),'scheduledAt',_0xa1aa('0xa1'),_0xa1aa('0xa2'),_0xa1aa('0x63'),_0xa1aa('0x5c'),'updatedAt'],squel[_0xa1aa('0x7b')]()['field'](_0xa1aa('0x9f'),'phone')['field'](_0xa1aa('0xa4'),_0xa1aa('0xa0'))[_0xa1aa('0xa3')]('id',_0xa1aa('0xa1'))[_0xa1aa('0xa3')](_0x760563[_0xa1aa('0xa5')]['toString'](),'ListId')[_0xa1aa('0xa3')](_0x5b995f['params']['id']['toString'](),_0xa1aa('0x63'))[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5c'))[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5d'))['from'](_0xa1aa('0xaa'))[_0xa1aa('0x47')]('deletedAt\x20IS\x20NULL')[_0xa1aa('0x47')]('ListId\x20=\x20?',_0x760563['CmListId']['toString']())[_0xa1aa('0x47')](_0xa1aa('0xa7'))[_0xa1aa('0x47')](_0xa1aa('0xa8'),squel[_0xa1aa('0x7b')]()['field'](_0xa1aa('0xab'))[_0xa1aa('0x7d')](_0xa1aa('0x9d'))[_0xa1aa('0x47')]('VoiceQueueId\x20=\x20?',_0x5b995f[_0xa1aa('0x50')]['id']['toString']())))[_0xa1aa('0x85')]();break;default:_0x3274e7=squel[_0xa1aa('0x9b')]()[_0xa1aa('0x9c')](_0xa1aa('0x9d'))['fromQuery']([_0xa1aa('0x9f'),_0xa1aa('0xa0'),_0xa1aa('0xa1'),_0xa1aa('0xa2'),_0xa1aa('0x63'),_0xa1aa('0x5c'),_0xa1aa('0x5d')],squel['select']()[_0xa1aa('0xa3')](_0xa1aa('0x9f'),_0xa1aa('0x9f'))['field'](_0xa1aa('0xa4'),_0xa1aa('0xa0'))[_0xa1aa('0xa3')]('id',_0xa1aa('0xa1'))[_0xa1aa('0xa3')](_0x760563[_0xa1aa('0xa5')]['toString'](),_0xa1aa('0xa2'))[_0xa1aa('0xa3')](_0x5b995f[_0xa1aa('0x50')]['id']['toString'](),_0xa1aa('0x63'))[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5c'))[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5d'))[_0xa1aa('0x7d')](_0xa1aa('0xaa'))[_0xa1aa('0x47')]('deletedAt\x20IS\x20NULL')[_0xa1aa('0x47')](_0xa1aa('0xac'),_0x760563[_0xa1aa('0xa5')]['toString']())[_0xa1aa('0x47')](_0xa1aa('0xa7')))[_0xa1aa('0x85')]();}_0x24f38f[_0xa1aa('0x84')](db[_0xa1aa('0x6f')][_0xa1aa('0x3b')](_0x3274e7));}return BPromise[_0xa1aa('0x8a')](_0x24f38f);}})['then'](function(){return _0x162b6e;})[_0xa1aa('0x23')](respondWithResult(_0x2bf78b,null))[_0xa1aa('0x52')](handleError(_0x2bf78b,null));};exports['removeLists']=function(_0x14c741,_0x478616,_0x152959){return db['VoiceQueue'][_0xa1aa('0x51')]({'where':{'id':_0x14c741[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x478616,null))[_0xa1aa('0x23')](function(_0x20c85c){if(_0x20c85c){return _0x20c85c[_0xa1aa('0xad')](_0x14c741[_0xa1aa('0x3b')][_0xa1aa('0x8d')]);}})[_0xa1aa('0x23')](function(_0x20e424){if(_0x20e424){return db['CmHopper'][_0xa1aa('0x24')]({'where':{'ListId':_0x14c741['query'][_0xa1aa('0x8d')],'VoiceQueueId':_0x14c741[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](function(){return _0x20e424;});}})[_0xa1aa('0x23')](respondWithStatusCode(_0x478616,null))['catch'](handleError(_0x478616,null));};exports['getBlackLists']=function(_0x28f78f,_0x4c8dfc,_0xe5c2b7){var _0x2df097={};var _0x115f0b={};var _0x2d8b03;var _0x1d2b41;return db[_0xa1aa('0x36')][_0xa1aa('0x60')]({'where':{'id':_0x28f78f[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x4c8dfc,null))[_0xa1aa('0x23')](function(_0x318dc6){if(_0x318dc6){_0x2d8b03=_0x318dc6;_0x115f0b['model']=_['keys'](db[_0xa1aa('0x97')][_0xa1aa('0x37')]);_0x115f0b['query']=_['keys'](_0x28f78f[_0xa1aa('0x3b')]);_0x115f0b[_0xa1aa('0x3d')]=_[_0xa1aa('0x3e')](_0x115f0b[_0xa1aa('0x3a')],_0x115f0b[_0xa1aa('0x3b')]);_0x2df097[_0xa1aa('0x3f')]=_[_0xa1aa('0x3e')](_0x115f0b['model'],qs[_0xa1aa('0x40')](_0x28f78f[_0xa1aa('0x3b')][_0xa1aa('0x40')]));_0x2df097[_0xa1aa('0x3f')]=_0x2df097['attributes'][_0xa1aa('0x41')]?_0x2df097['attributes']:_0x115f0b[_0xa1aa('0x3a')];_0x2df097[_0xa1aa('0x44')]=qs[_0xa1aa('0x45')](_0x28f78f[_0xa1aa('0x3b')][_0xa1aa('0x45')]);_0x2df097['where']=qs['filters'](_[_0xa1aa('0x46')](_0x28f78f['query'],_0x115f0b[_0xa1aa('0x3d')]));if(_0x28f78f['query'][_0xa1aa('0x2a')]){_0x2df097[_0xa1aa('0x47')]=_['merge'](_0x2df097['where'],{'$or':_[_0xa1aa('0x2c')](_0x2df097[_0xa1aa('0x3f')],function(_0x4355c0){var _0x4dee14={};_0x4dee14[_0x4355c0]={'$like':'%'+_0x28f78f[_0xa1aa('0x3b')][_0xa1aa('0x2a')]+'%'};return _0x4dee14;})});}_0x2df097=_[_0xa1aa('0x48')]({},_0x2df097,_0x28f78f[_0xa1aa('0x49')]);return _0x2d8b03['getBlackLists'](_0x2df097);}})[_0xa1aa('0x23')](function(_0xc4f7ea){if(_0xc4f7ea){_0x1d2b41=_0xc4f7ea[_0xa1aa('0x41')];if(!_0x28f78f[_0xa1aa('0x3b')]['hasOwnProperty'](_0xa1aa('0x43'))){_0x2df097[_0xa1aa('0x1d')]=qs['limit'](_0x28f78f[_0xa1aa('0x3b')]['limit']);_0x2df097[_0xa1aa('0x1c')]=qs[_0xa1aa('0x1c')](_0x28f78f[_0xa1aa('0x3b')][_0xa1aa('0x1c')]);}return _0x2d8b03['getBlackLists'](_0x2df097);}})['then'](function(_0x40cee3){if(_0x40cee3){return _0x40cee3?{'count':_0x1d2b41,'rows':_0x40cee3}:null;}})[_0xa1aa('0x23')](respondWithResult(_0x4c8dfc,null))[_0xa1aa('0x52')](handleError(_0x4c8dfc,null));};exports['addBlackLists']=function(_0x1c0796,_0x47f0b6,_0xb52220){var _0x4f865a,_0x55b1b5;return db[_0xa1aa('0x36')]['find']({'where':{'id':_0x1c0796[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x47f0b6,null))['then'](function(_0x39d0cd){if(_0x39d0cd){_0x55b1b5=_0x39d0cd;return _0x39d0cd[_0xa1aa('0xae')](_0x1c0796[_0xa1aa('0x54')][_0xa1aa('0x8d')],_[_0xa1aa('0x5b')](_0x1c0796[_0xa1aa('0x54')],['ids','id'])||{});}return null;})[_0xa1aa('0x92')](function(_0x2efdce){var _0x5cd498;_0x4f865a=_0x2efdce||[];var _0x38166a=[];if(_0x2efdce){for(var _0x474792=0x0;_0x474792<_0x2efdce[_0xa1aa('0x41')];_0x474792+=0x1){var _0xbe1d67=_0x2efdce[_0x474792]['get']({'plain':!![]});_0x5cd498=squel[_0xa1aa('0x9b')]()[_0xa1aa('0x9c')](_0xa1aa('0xaf'))['fromQuery']([_0xa1aa('0x9f'),_0xa1aa('0xa1'),'ListId','VoiceQueueId',_0xa1aa('0x5c'),_0xa1aa('0x5d')],squel['select']()['field'](_0xa1aa('0x9f'),_0xa1aa('0x9f'))['field']('id',_0xa1aa('0xa1'))[_0xa1aa('0xa3')](_0xbe1d67[_0xa1aa('0xa5')][_0xa1aa('0x85')](),'ListId')['field'](_0x1c0796[_0xa1aa('0x50')]['id'][_0xa1aa('0x85')](),_0xa1aa('0x63'))[_0xa1aa('0xa3')]('NOW()','createdAt')[_0xa1aa('0xa3')](_0xa1aa('0xa4'),_0xa1aa('0x5d'))['from'](_0xa1aa('0xaa'))[_0xa1aa('0x47')]('deletedAt\x20IS\x20NULL')[_0xa1aa('0x47')](_0xa1aa('0xac'),_0xbe1d67[_0xa1aa('0xa5')]['toString']())[_0xa1aa('0x47')](_0xa1aa('0xa7')))['toString']();_0x38166a[_0xa1aa('0x84')](db[_0xa1aa('0x6f')][_0xa1aa('0x3b')](_0x5cd498));}return BPromise['all'](_0x38166a);}})['then'](function(){return _0x4f865a;})[_0xa1aa('0x23')](respondWithResult(_0x47f0b6,null))[_0xa1aa('0x52')](handleError(_0x47f0b6,null));};exports['removeBlackLists']=function(_0x2de8e1,_0x1b5c1f,_0x3881ec){return db[_0xa1aa('0x36')]['find']({'where':{'id':_0x2de8e1['params']['id']}})[_0xa1aa('0x23')](handleEntityNotFound(_0x1b5c1f,null))[_0xa1aa('0x23')](function(_0x224fb4){if(_0x224fb4){return _0x224fb4['removeBlackLists'](_0x2de8e1[_0xa1aa('0x3b')]['ids']);}})['then'](function(_0x35aeef){if(_0x35aeef){return db[_0xa1aa('0x66')]['destroy']({'where':{'ListId':_0x2de8e1['query']['ids'],'VoiceQueueId':_0x2de8e1[_0xa1aa('0x50')]['id']}})[_0xa1aa('0x23')](function(){return _0x35aeef;});}})[_0xa1aa('0x23')](respondWithStatusCode(_0x1b5c1f,null))[_0xa1aa('0x52')](handleError(_0x1b5c1f,null));};
\ No newline at end of file
+var _0x3fdb=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','online','voicePause','interface','flatMap','Agents','forEach','sequelize','transaction','each','TeamVoiceQueue','penalty','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','User','select','field','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','removeTeams','userVoiceQueue:remove','addAgents','spread','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','destroy','sendStatus','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x7d710,_0x412547){var _0x3f5e58=function(_0x11b52c){while(--_0x11b52c){_0x7d710['push'](_0x7d710['shift']());}};_0x3f5e58(++_0x412547);}(_0x3fdb,0x1af));var _0xb3fd=function(_0x38960a,_0x4e49b0){_0x38960a=_0x38960a-0x0;var _0x1003e2=_0x3fdb[_0x38960a];return _0x1003e2;};'use strict';var emlformat=require(_0xb3fd('0x0'));var rimraf=require(_0xb3fd('0x1'));var zipdir=require(_0xb3fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3fd('0x3'));var moment=require('moment');var BPromise=require(_0xb3fd('0x4'));var Mustache=require(_0xb3fd('0x5'));var util=require(_0xb3fd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb3fd('0x7'));var ejs=require(_0xb3fd('0x8'));var fs=require('fs');var fs_extra=require(_0xb3fd('0x9'));var _=require(_0xb3fd('0xa'));var squel=require('squel');var crypto=require(_0xb3fd('0xb'));var jsforce=require(_0xb3fd('0xc'));var deskjs=require(_0xb3fd('0xd'));var toCsv=require(_0xb3fd('0x7'));var querystring=require(_0xb3fd('0xe'));var Papa=require(_0xb3fd('0xf'));var Redis=require(_0xb3fd('0x10'));var authService=require(_0xb3fd('0x11'));var qs=require(_0xb3fd('0x12'));var as=require(_0xb3fd('0x13'));var hardwareService=require(_0xb3fd('0x14'));var logger=require(_0xb3fd('0x15'))(_0xb3fd('0x16'));var utils=require(_0xb3fd('0x17'));var config=require(_0xb3fd('0x18'));var licenseUtil=require(_0xb3fd('0x19'));var db=require(_0xb3fd('0x1a'))['db'];config[_0xb3fd('0x1b')]=_[_0xb3fd('0x1c')](config[_0xb3fd('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3fd('0x1b')]));require('./voiceQueue.socket')[_0xb3fd('0x1d')](socket);function respondWithStatusCode(_0x1f706b,_0x33a33c){_0x33a33c=_0x33a33c||0xcc;return function(_0x44bf55){if(_0x44bf55){return _0x1f706b['sendStatus'](_0x33a33c);}return _0x1f706b['status'](_0x33a33c)[_0xb3fd('0x1e')]();};}function respondWithResult(_0x3403fb,_0x519fd3){_0x519fd3=_0x519fd3||0xc8;return function(_0x5634af){if(_0x5634af){return _0x3403fb['status'](_0x519fd3)['json'](_0x5634af);}};}function respondWithFilteredResult(_0x36b67d,_0x3d92b9){return function(_0x13d283){if(_0x13d283){var _0x9c7ea9=typeof _0x3d92b9[_0xb3fd('0x1f')]==='undefined'&&typeof _0x3d92b9[_0xb3fd('0x20')]===_0xb3fd('0x21');var _0x38911e=_0x13d283[_0xb3fd('0x22')];var _0x14f402=_0x9c7ea9?0x0:_0x3d92b9[_0xb3fd('0x1f')];var _0x3c099a=_0x9c7ea9?_0x13d283['count']:_0x3d92b9[_0xb3fd('0x1f')]+_0x3d92b9[_0xb3fd('0x20')];var _0x123314;if(_0x3c099a>=_0x38911e){_0x3c099a=_0x38911e;_0x123314=0xc8;}else{_0x123314=0xce;}_0x36b67d[_0xb3fd('0x23')](_0x123314);return _0x36b67d[_0xb3fd('0x24')](_0xb3fd('0x25'),_0x14f402+'-'+_0x3c099a+'/'+_0x38911e)['json'](_0x13d283);}return null;};}function patchUpdates(_0x5a8a8d){return function(_0x590eb5){try{jsonpatch[_0xb3fd('0x26')](_0x590eb5,_0x5a8a8d,!![]);}catch(_0x3a8819){return BPromise[_0xb3fd('0x27')](_0x3a8819);}return _0x590eb5['save']();};}function saveUpdates(_0x45c993,_0x3417e9){return function(_0x4af128){if(_0x4af128){return _0x4af128[_0xb3fd('0x28')](_0x45c993)['then'](function(_0x147d0e){return _0x147d0e;});}return null;};}function removeEntity(_0x1866c1,_0x416912){return function(_0x23dec8){if(_0x23dec8){return _0x23dec8['destroy']()[_0xb3fd('0x29')](function(){var _0x171f17=_0x23dec8[_0xb3fd('0x2a')]({'plain':!![]});var _0x4c2b0c=[{'name':_0xb3fd('0x2b'),'value':_0xb3fd('0x2c'),'ignore':![]},{'name':_0xb3fd('0x2d'),'value':_0xb3fd('0x2e'),'ignore':![]}];var _0x4ea6ba=_(_0x4c2b0c)[_0xb3fd('0x2f')](_0xb3fd('0x30'))[_0xb3fd('0x31')]('value')[_0xb3fd('0x32')]();if(_['includes'](_0x4ea6ba,_0x171f17[_0xb3fd('0x33')])){return;}var _0x1df219=_[_0xb3fd('0x34')](_0x4c2b0c,[_0xb3fd('0x32'),_0x171f17[_0xb3fd('0x33')]])[_0xb3fd('0x35')];return db[_0xb3fd('0x36')][_0xb3fd('0x37')]({'where':{'type':_0x1df219,'resourceId':_0x171f17['id']}})[_0xb3fd('0x29')](function(){return _0x23dec8;});})[_0xb3fd('0x29')](function(){_0x1866c1[_0xb3fd('0x23')](0xcc)[_0xb3fd('0x1e')]();});}};}function handleEntityNotFound(_0x2923db,_0x5f3852){return function(_0x2f6e3d){if(!_0x2f6e3d){_0x2923db[_0xb3fd('0x38')](0x194);}return _0x2f6e3d;};}function handleError(_0x4dd2ce,_0x1cb48c){_0x1cb48c=_0x1cb48c||0x1f4;return function(_0x111b25){logger[_0xb3fd('0x39')](_0x111b25['stack']);if(_0x111b25[_0xb3fd('0x35')]){delete _0x111b25[_0xb3fd('0x35')];}_0x4dd2ce[_0xb3fd('0x23')](_0x1cb48c)[_0xb3fd('0x3a')](_0x111b25);};}exports[_0xb3fd('0x3b')]=function(_0x3f578b,_0x1ff8c1){var _0x5338f6={},_0x50cdae={},_0x181790={'count':0x0,'rows':[]};var _0x1cdab9=_[_0xb3fd('0x31')](db[_0xb3fd('0x3c')][_0xb3fd('0x3d')],function(_0x47f449){return{'name':_0x47f449[_0xb3fd('0x3e')],'type':_0x47f449['type'][_0xb3fd('0x3f')]};});_0x50cdae[_0xb3fd('0x40')]=_[_0xb3fd('0x31')](_0x1cdab9,_0xb3fd('0x35'));_0x50cdae[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x3f578b[_0xb3fd('0x41')]);_0x50cdae[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x50cdae[_0xb3fd('0x40')],_0x50cdae[_0xb3fd('0x41')]);_0x5338f6['attributes']=_[_0xb3fd('0x44')](_0x50cdae['model'],qs[_0xb3fd('0x45')](_0x3f578b[_0xb3fd('0x41')]['fields']));_0x5338f6[_0xb3fd('0x46')]=_0x5338f6[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x5338f6[_0xb3fd('0x46')]:_0x50cdae[_0xb3fd('0x40')];if(!_0x3f578b[_0xb3fd('0x41')]['hasOwnProperty']('nolimit')){_0x5338f6[_0xb3fd('0x20')]=qs['limit'](_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x5338f6['offset']=qs[_0xb3fd('0x1f')](_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0x5338f6[_0xb3fd('0x48')]=qs['sort'](_0x3f578b['query']['sort']);_0x5338f6[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x3f578b['query'],_0x50cdae[_0xb3fd('0x43')]),_0x1cdab9);if(_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x5338f6['where']=_[_0xb3fd('0x4b')](_0x5338f6[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x1cdab9,function(_0x13bd29){if(_0x13bd29[_0xb3fd('0x33')]!==_0xb3fd('0x4c')){var _0x5f3b42={};_0x5f3b42[_0x13bd29['name']]={'$like':'%'+_0x3f578b['query'][_0xb3fd('0x2f')]+'%'};return _0x5f3b42;}})});}_0x5338f6=_['merge']({},_0x5338f6,_0x3f578b[_0xb3fd('0x4d')]);var _0x27efe4={'where':_0x5338f6[_0xb3fd('0x49')]};return db[_0xb3fd('0x3c')][_0xb3fd('0x22')](_0x27efe4)[_0xb3fd('0x29')](function(_0x1f2532){_0x181790[_0xb3fd('0x22')]=_0x1f2532;if(_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0x5338f6[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x3c')][_0xb3fd('0x50')](_0x5338f6);})[_0xb3fd('0x29')](function(_0x39a6ce){_0x181790[_0xb3fd('0x51')]=_0x39a6ce;return _0x181790;})[_0xb3fd('0x29')](respondWithFilteredResult(_0x1ff8c1,_0x5338f6))[_0xb3fd('0x52')](handleError(_0x1ff8c1,null));};exports['show']=function(_0x559d1f,_0x3d96b0){var _0x7e08d6={'raw':![],'where':{'id':_0x559d1f['params']['id']}},_0x40836c={};_0x40836c[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x3c')]['rawAttributes']);_0x40836c[_0xb3fd('0x41')]=_['keys'](_0x559d1f[_0xb3fd('0x41')]);_0x40836c['filters']=_['intersection'](_0x40836c[_0xb3fd('0x40')],_0x40836c[_0xb3fd('0x41')]);_0x7e08d6[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x40836c[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x559d1f['query'][_0xb3fd('0x45')]));_0x7e08d6[_0xb3fd('0x46')]=_0x7e08d6['attributes'][_0xb3fd('0x47')]?_0x7e08d6[_0xb3fd('0x46')]:_0x40836c[_0xb3fd('0x40')];if(_0x559d1f[_0xb3fd('0x41')]['includeAll']){_0x7e08d6['include']=[{'all':!![]}];}_0x7e08d6=_['merge']({},_0x7e08d6,_0x559d1f[_0xb3fd('0x4d')]);return db['VoiceQueue'][_0xb3fd('0x34')](_0x7e08d6)['then'](handleEntityNotFound(_0x3d96b0,null))[_0xb3fd('0x29')](respondWithResult(_0x3d96b0,null))[_0xb3fd('0x52')](handleError(_0x3d96b0,null));};exports[_0xb3fd('0x53')]=function(_0x4a9214,_0x367703){return db['VoiceQueue'][_0xb3fd('0x53')](_0x4a9214[_0xb3fd('0x54')],{})['then'](function(_0x21fbdc){var _0x221922=_0x4a9214['user'][_0xb3fd('0x2a')]({'plain':!![]});if(!_0x221922)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x221922[_0xb3fd('0x55')]===_0xb3fd('0x56')){var _0x5bddcd=_0x21fbdc[_0xb3fd('0x2a')]({'plain':!![]});var _0x13d39f=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xb3fd('0x2d'),'value':'outbound'}];var _0x2296a8=_[_0xb3fd('0x34')](_0x13d39f,[_0xb3fd('0x32'),_0x5bddcd['type']])[_0xb3fd('0x35')];return db[_0xb3fd('0x57')][_0xb3fd('0x34')]({'where':{'name':_0x2296a8,'userProfileId':_0x221922[_0xb3fd('0x58')]},'raw':!![]})[_0xb3fd('0x29')](function(_0x3e1e5e){if(_0x3e1e5e&&_0x3e1e5e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bddcd[_0xb3fd('0x35')],'resourceId':_0x5bddcd['id'],'type':_0x3e1e5e[_0xb3fd('0x35')],'sectionId':_0x3e1e5e['id']},{})[_0xb3fd('0x29')](function(){return _0x21fbdc;});}else{return _0x21fbdc;}})[_0xb3fd('0x52')](function(_0x5c996e){logger[_0xb3fd('0x39')](_0xb3fd('0x59'),_0x5c996e);throw _0x5c996e;});}return _0x21fbdc;})['then'](respondWithResult(_0x367703,0xc9))[_0xb3fd('0x52')](handleError(_0x367703,null));};exports[_0xb3fd('0x5a')]=function(_0x2934e,_0x1a822d){var _0x7cbf03={'where':{'id':_0x2934e[_0xb3fd('0x5b')]['id']}},_0x5eb62f={};_0x5eb62f[_0xb3fd('0x40')]=_['keys'](db['VoiceQueue'][_0xb3fd('0x3d')]);_0x7cbf03[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x5eb62f[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x2934e[_0xb3fd('0x41')]['fields']));_0x7cbf03[_0xb3fd('0x46')]=_0x7cbf03[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x7cbf03['attributes']:_0x5eb62f['model'];if(_0x2934e['query'][_0xb3fd('0x4e')]){_0x7cbf03[_0xb3fd('0x4f')]=[{'all':!![]}];}_0x7cbf03=_[_0xb3fd('0x4b')]({},_0x7cbf03,_0x2934e['options']);return db[_0xb3fd('0x3c')][_0xb3fd('0x34')](_0x7cbf03)['then'](handleEntityNotFound(_0x1a822d,null))[_0xb3fd('0x29')](function(_0x3e53b0){if(_0x3e53b0){var _0x386dc4=_0x3e53b0['get']({'plain':!![]});_0x386dc4=qs[_0xb3fd('0x5c')](_0x386dc4,['id','createdAt',_0xb3fd('0x5d')]);_0x2934e[_0xb3fd('0x54')]=_[_0xb3fd('0x5c')](_0x2934e['body'],['id',_0xb3fd('0x5e'),_0xb3fd('0x5d')]);return db[_0xb3fd('0x3c')]['create'](_[_0xb3fd('0x4b')](_0x386dc4,_0x2934e['body']),{'include':_0x2934e[_0xb3fd('0x41')][_0xb3fd('0x4e')]?[{'all':!![]}]:undefined})[_0xb3fd('0x29')](function(_0x551530){var _0x2fe570=_0x2934e[_0xb3fd('0x56')][_0xb3fd('0x2a')]({'plain':!![]});if(!_0x2fe570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe570[_0xb3fd('0x55')]===_0xb3fd('0x56')){var _0x37f662=_0x551530[_0xb3fd('0x2a')]({'plain':!![]});var _0x587fd9=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xb3fd('0x2e')}];var _0x36eb2b=_[_0xb3fd('0x34')](_0x587fd9,[_0xb3fd('0x32'),_0x37f662[_0xb3fd('0x33')]])[_0xb3fd('0x35')];return db[_0xb3fd('0x57')][_0xb3fd('0x34')]({'where':{'name':_0x36eb2b,'userProfileId':_0x2fe570[_0xb3fd('0x58')]},'raw':!![]})[_0xb3fd('0x29')](function(_0x385d1b){if(_0x385d1b&&_0x385d1b[_0xb3fd('0x5f')]===0x0){return db[_0xb3fd('0x36')]['create']({'name':_0x37f662[_0xb3fd('0x35')],'resourceId':_0x37f662['id'],'type':_0x385d1b['name'],'sectionId':_0x385d1b['id']},{})['then'](function(){return _0x551530;});}else{return _0x551530;}})[_0xb3fd('0x52')](function(_0x210ad7){logger[_0xb3fd('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x210ad7);throw _0x210ad7;});}return _0x551530;});}})[_0xb3fd('0x29')](respondWithResult(_0x1a822d,0xc9))[_0xb3fd('0x52')](handleError(_0x1a822d,null));};exports[_0xb3fd('0x28')]=function(_0x430087,_0x48b0bf){if(_0x430087[_0xb3fd('0x54')]['id']){delete _0x430087[_0xb3fd('0x54')]['id'];}return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x430087[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x48b0bf,null))[_0xb3fd('0x29')](saveUpdates(_0x430087[_0xb3fd('0x54')],null))[_0xb3fd('0x29')](respondWithResult(_0x48b0bf,null))[_0xb3fd('0x52')](handleError(_0x48b0bf,null));};exports[_0xb3fd('0x37')]=function(_0x1d61f0,_0x5abd72){return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x1d61f0[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5abd72,null))[_0xb3fd('0x29')](removeEntity(_0x5abd72,null))['catch'](handleError(_0x5abd72,null));};exports[_0xb3fd('0x60')]=function(_0x5ee0d9,_0x242cc8,_0x2673e2){var _0xb8bbb5={'raw':![],'where':{}};var _0x339d75={};var _0x16f018={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x5ee0d9[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x242cc8,null))['then'](function(_0x5ad749){if(_0x5ad749){_0x339d75['model']=_['keys'](db['CmHopper'][_0xb3fd('0x3d')]);_0x339d75[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x5ee0d9['query']);_0x339d75[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x339d75[_0xb3fd('0x40')],_0x339d75[_0xb3fd('0x41')]);_0xb8bbb5['attributes']=_[_0xb3fd('0x44')](_0x339d75[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x5ee0d9[_0xb3fd('0x41')]['fields']));_0xb8bbb5['attributes']=_0xb8bbb5[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0xb8bbb5[_0xb3fd('0x46')]:_0x339d75[_0xb3fd('0x40')];if(!_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0xb8bbb5[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x5ee0d9['query'][_0xb3fd('0x20')]);_0xb8bbb5[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0xb8bbb5[_0xb3fd('0x48')]=qs['sort'](_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0xb8bbb5[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x5ee0d9[_0xb3fd('0x41')],_0x339d75[_0xb3fd('0x43')]));_0xb8bbb5['where'][_0xb3fd('0x65')]=_0x5ad749['id'];if(_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0xb8bbb5['where']=_[_0xb3fd('0x4b')](_0xb8bbb5[_0xb3fd('0x49')],{'$or':_['map'](_0xb8bbb5[_0xb3fd('0x46')],function(_0x5520d2){var _0xcb0fa2={};_0xcb0fa2[_0x5520d2]={'$like':'%'+_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0xcb0fa2;})});}_0xb8bbb5=_[_0xb3fd('0x4b')]({},_0xb8bbb5,_0x5ee0d9[_0xb3fd('0x4d')]);return db[_0xb3fd('0x66')]['count']({'where':_0xb8bbb5[_0xb3fd('0x49')]})[_0xb3fd('0x29')](function(_0x20ea78){_0x16f018[_0xb3fd('0x22')]=_0x20ea78;if(_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0xb8bbb5[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x66')]['findAll'](_0xb8bbb5);})[_0xb3fd('0x29')](function(_0x5cc606){_0x16f018[_0xb3fd('0x51')]=_0x5cc606;return _0x16f018;});}})['then'](respondWithFilteredResult(_0x242cc8,_0xb8bbb5))[_0xb3fd('0x52')](handleError(_0x242cc8,null));};exports[_0xb3fd('0x67')]=function(_0x645e08,_0x29f4ac,_0x3026a6){var _0x148b8f={'raw':!![],'where':{}};var _0x5aea99={};var _0x2e4fbf={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x645e08['params']['id']}})['then'](handleEntityNotFound(_0x29f4ac,null))[_0xb3fd('0x29')](function(_0x41db8b){if(_0x41db8b){_0x5aea99['model']=_['keys'](db['CmHopperHistory'][_0xb3fd('0x3d')]);_0x5aea99[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x645e08['query']);_0x5aea99[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x5aea99['model'],_0x5aea99['query']);_0x148b8f['attributes']=_[_0xb3fd('0x44')](_0x5aea99[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x148b8f[_0xb3fd('0x46')]=_0x148b8f[_0xb3fd('0x46')]['length']?_0x148b8f[_0xb3fd('0x46')]:_0x5aea99['model'];if(!_0x645e08['query'][_0xb3fd('0x62')]('nolimit')){_0x148b8f[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x645e08[_0xb3fd('0x41')]['limit']);_0x148b8f[_0xb3fd('0x1f')]=qs['offset'](_0x645e08['query'][_0xb3fd('0x1f')]);}_0x148b8f[_0xb3fd('0x48')]=qs['sort'](_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x148b8f['where']=qs[_0xb3fd('0x43')](_['pick'](_0x645e08[_0xb3fd('0x41')],_0x5aea99['filters']));_0x148b8f[_0xb3fd('0x49')][_0xb3fd('0x65')]=_0x41db8b['id'];if(_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x148b8f[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x148b8f[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x148b8f[_0xb3fd('0x46')],function(_0x1ca808){var _0x57d78e={};_0x57d78e[_0x1ca808]={'$like':'%'+_0x645e08[_0xb3fd('0x41')]['filter']+'%'};return _0x57d78e;})});}_0x148b8f=_[_0xb3fd('0x4b')]({},_0x148b8f,_0x645e08[_0xb3fd('0x4d')]);return db[_0xb3fd('0x68')][_0xb3fd('0x22')]({'where':_0x148b8f[_0xb3fd('0x49')]})['then'](function(_0x2f1e80){_0x2e4fbf['count']=_0x2f1e80;if(_0x645e08['query'][_0xb3fd('0x4e')]){_0x148b8f['include']=[{'all':!![]}];}return db[_0xb3fd('0x68')][_0xb3fd('0x50')](_0x148b8f);})[_0xb3fd('0x29')](function(_0x152b7b){_0x2e4fbf[_0xb3fd('0x51')]=_0x152b7b;return _0x2e4fbf;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x29f4ac,_0x148b8f))[_0xb3fd('0x52')](handleError(_0x29f4ac,null));};exports[_0xb3fd('0x69')]=function(_0x3001bb,_0x3a6fa5,_0x51acfe){var _0x70f1db={'raw':!![],'where':{}};var _0x49b9c2={};var _0x352ee4={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x3001bb['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x3a6fa5,null))[_0xb3fd('0x29')](function(_0x28cb50){if(_0x28cb50){_0x49b9c2['model']=_[_0xb3fd('0x42')](db[_0xb3fd('0x6a')][_0xb3fd('0x3d')]);_0x49b9c2['query']=_['keys'](_0x3001bb['query']);_0x49b9c2['filters']=_['intersection'](_0x49b9c2['model'],_0x49b9c2[_0xb3fd('0x41')]);_0x70f1db[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x49b9c2['model'],qs[_0xb3fd('0x45')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x70f1db['attributes']=_0x70f1db['attributes']['length']?_0x70f1db[_0xb3fd('0x46')]:_0x49b9c2[_0xb3fd('0x40')];if(!_0x3001bb['query']['hasOwnProperty'](_0xb3fd('0x63'))){_0x70f1db[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x70f1db['offset']=qs[_0xb3fd('0x1f')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0x70f1db[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x70f1db[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x3001bb[_0xb3fd('0x41')],_0x49b9c2[_0xb3fd('0x43')]));_0x70f1db['where'][_0xb3fd('0x65')]=_0x28cb50['id'];if(_0x3001bb['query']['filter']){_0x70f1db[_0xb3fd('0x49')]=_['merge'](_0x70f1db['where'],{'$or':_[_0xb3fd('0x31')](_0x70f1db[_0xb3fd('0x46')],function(_0x124877){var _0x3929b3={};_0x3929b3[_0x124877]={'$like':'%'+_0x3001bb['query']['filter']+'%'};return _0x3929b3;})});}_0x70f1db=_[_0xb3fd('0x4b')]({},_0x70f1db,_0x3001bb[_0xb3fd('0x4d')]);return db['CmHopperFinal'][_0xb3fd('0x22')]({'where':_0x70f1db[_0xb3fd('0x49')]})[_0xb3fd('0x29')](function(_0x1e810e){_0x352ee4['count']=_0x1e810e;if(_0x3001bb[_0xb3fd('0x41')]['includeAll']){_0x70f1db['include']=[{'all':!![]}];}return db[_0xb3fd('0x6a')][_0xb3fd('0x50')](_0x70f1db);})[_0xb3fd('0x29')](function(_0x2377a5){_0x352ee4[_0xb3fd('0x51')]=_0x2377a5;return _0x352ee4;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x3a6fa5,_0x70f1db))[_0xb3fd('0x52')](handleError(_0x3a6fa5,null));};exports[_0xb3fd('0x6b')]=function(_0x265dbf,_0x359c3d,_0x58d092){var _0x185908={'raw':!![],'where':{}};var _0x2f44e5={};var _0x6eb95c={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')]['findOne']({'where':{'id':_0x265dbf[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x359c3d,null))['then'](function(_0x18cc20){if(_0x18cc20){_0x2f44e5[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x6c')]['rawAttributes']);_0x2f44e5[_0xb3fd('0x41')]=_['keys'](_0x265dbf[_0xb3fd('0x41')]);_0x2f44e5[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x2f44e5[_0xb3fd('0x40')],_0x2f44e5[_0xb3fd('0x41')]);_0x185908['attributes']=_['intersection'](_0x2f44e5[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x185908[_0xb3fd('0x46')]=_0x185908['attributes'][_0xb3fd('0x47')]?_0x185908['attributes']:_0x2f44e5[_0xb3fd('0x40')];if(!_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x62')]('nolimit')){_0x185908[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x265dbf[_0xb3fd('0x41')]['limit']);_0x185908[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x265dbf['query'][_0xb3fd('0x1f')]);}_0x185908['order']=qs[_0xb3fd('0x64')](_0x265dbf[_0xb3fd('0x41')]['sort']);_0x185908[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_['pick'](_0x265dbf[_0xb3fd('0x41')],_0x2f44e5[_0xb3fd('0x43')]));_0x185908[_0xb3fd('0x49')][_0xb3fd('0x65')]=_0x18cc20['id'];if(_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x185908[_0xb3fd('0x49')]=_['merge'](_0x185908[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x185908[_0xb3fd('0x46')],function(_0x568ece){var _0x606ef8={};_0x606ef8[_0x568ece]={'$like':'%'+_0x265dbf[_0xb3fd('0x41')]['filter']+'%'};return _0x606ef8;})});}_0x185908=_[_0xb3fd('0x4b')]({},_0x185908,_0x265dbf[_0xb3fd('0x4d')]);return db[_0xb3fd('0x6c')][_0xb3fd('0x22')]({'where':_0x185908[_0xb3fd('0x49')]})['then'](function(_0x43f875){_0x6eb95c['count']=_0x43f875;if(_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0x185908[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x6c')][_0xb3fd('0x50')](_0x185908);})[_0xb3fd('0x29')](function(_0x54e420){_0x6eb95c[_0xb3fd('0x51')]=_0x54e420;return _0x6eb95c;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x359c3d,_0x185908))[_0xb3fd('0x52')](handleError(_0x359c3d,null));};exports[_0xb3fd('0x6d')]=function(_0x24e9c3,_0x3aad43,_0x2f64f7){var _0x58b552={};var _0x1bd0e5={};var _0x4e756e;var _0x220066;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x24e9c3[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x3aad43,null))['then'](function(_0x217a0d){if(_0x217a0d){_0x4e756e=_0x217a0d;_0x1bd0e5[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db['Team'][_0xb3fd('0x3d')]);_0x1bd0e5[_0xb3fd('0x41')]=_['keys'](_0x24e9c3[_0xb3fd('0x41')]);_0x1bd0e5['filters']=_['intersection'](_0x1bd0e5[_0xb3fd('0x40')],_0x1bd0e5['query']);_0x58b552['attributes']=_[_0xb3fd('0x44')](_0x1bd0e5[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x24e9c3[_0xb3fd('0x41')]['fields']));_0x58b552[_0xb3fd('0x46')]=_0x58b552[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x58b552[_0xb3fd('0x46')]:_0x1bd0e5['model'];_0x58b552[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x58b552[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_['pick'](_0x24e9c3['query'],_0x1bd0e5[_0xb3fd('0x43')]));if(_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x58b552[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x58b552['where'],{'$or':_[_0xb3fd('0x31')](_0x58b552[_0xb3fd('0x46')],function(_0x3cc72f){var _0x304b9e={};_0x304b9e[_0x3cc72f]={'$like':'%'+_0x24e9c3['query'][_0xb3fd('0x2f')]+'%'};return _0x304b9e;})});}_0x58b552=_[_0xb3fd('0x4b')]({},_0x58b552,_0x24e9c3[_0xb3fd('0x4d')]);return _0x4e756e[_0xb3fd('0x6d')](_0x58b552);}})[_0xb3fd('0x29')](function(_0x10e147){if(_0x10e147){_0x220066=_0x10e147[_0xb3fd('0x47')];if(!_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x62')]('nolimit')){_0x58b552[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x24e9c3['query'][_0xb3fd('0x20')]);_0x58b552['offset']=qs[_0xb3fd('0x1f')](_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x4e756e[_0xb3fd('0x6d')](_0x58b552);}})[_0xb3fd('0x29')](function(_0x565c8d){if(_0x565c8d){return _0x565c8d?{'count':_0x220066,'rows':_0x565c8d}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x3aad43,null))[_0xb3fd('0x52')](handleError(_0x3aad43,null));};exports['addTeams']=function(_0x41e636,_0xa132aa,_0x1a025c){var _0x33e4bd=_0x41e636['body'][_0xb3fd('0x6e')];var _0xbb1870=_[_0xb3fd('0x31')](_0x33e4bd,'id');return db[_0xb3fd('0x6f')][_0xb3fd('0x50')]({'where':{'id':_0xbb1870},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb3fd('0x35'),_0xb3fd('0x70'),_0xb3fd('0x71'),_0xb3fd('0x72')],'raw':!![]}]})[_0xb3fd('0x29')](function(_0x5bdf08){if(_0x5bdf08){var _0x230beb=_[_0xb3fd('0x73')](_0x5bdf08,function(_0x5d0bf4){var _0x2cf093=_0x5d0bf4[_0xb3fd('0x2a')]({'plain':!![]});_0x2cf093[_0xb3fd('0x74')][_0xb3fd('0x75')](function(_0x897e23){_0x897e23['penalty']=_[_0xb3fd('0x34')](_0x33e4bd,{'id':_0x2cf093['id']})['penalty'];});return _0x2cf093[_0xb3fd('0x74')];});return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x41e636[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](function(_0x5376c8){return db[_0xb3fd('0x76')][_0xb3fd('0x77')](function(_0x463479){return _0x5376c8['addTeams'](_0xbb1870,{'transaction':_0x463479})['then'](function(){return BPromise[_0xb3fd('0x78')](_0x33e4bd,function(_0xb3d03d){return db[_0xb3fd('0x79')]['upsert']({'TeamId':_0xb3d03d['id'],'VoiceQueueId':_0x41e636['params']['id'],'penalty':_0xb3d03d[_0xb3fd('0x7a')]},{'transaction':_0x463479});});})[_0xb3fd('0x29')](function(){return BPromise[_0xb3fd('0x78')](_0x230beb,function(_0x57af6a){return db['UserVoiceQueue'][_0xb3fd('0x7b')]({'where':{'UserId':_0x57af6a['id'],'VoiceQueueId':_0x41e636[_0xb3fd('0x5b')]['id']},'defaults':{'penalty':_0x57af6a[_0xb3fd('0x7a')]},'transaction':_0x463479});});})['then'](function(){return BPromise[_0xb3fd('0x78')](_[_0xb3fd('0x2f')](_0x230beb,{'online':!![]}),function(_0x564838){return db[_0xb3fd('0x7c')]['upsert']({'membername':_0x564838['name'],'UserId':_0x564838['id'],'queue_name':_0x5376c8[_0xb3fd('0x35')],'VoiceQueueId':_0x5376c8['id'],'interface':_[_0xb3fd('0x7d')](_0x564838[_0xb3fd('0x72')])?util[_0xb3fd('0x7e')](_0xb3fd('0x7f'),_0x564838['name']):_0x564838[_0xb3fd('0x72')],'paused':_0x564838[_0xb3fd('0x71')]||![],'penalty':_0x564838['penalty']},{'transaction':_0x463479});});})[_0xb3fd('0x29')](function(){_0x230beb['forEach'](function(_0xa47d43){socket[_0xb3fd('0x80')](_0xb3fd('0x81'),{'UserId':_0xa47d43['id'],'VoiceQueueId':_0x5376c8['id']});});});});});}})['then'](respondWithStatusCode(_0xa132aa,null))[_0xb3fd('0x52')](handleError(_0xa132aa,null));};exports['removeTeams']=function(_0x9788bf,_0x19a4cb,_0x5f51a2){return db[_0xb3fd('0x6f')][_0xb3fd('0x50')]({'where':{'id':_0x9788bf['query'][_0xb3fd('0x82')]},'attributes':['id'],'include':[{'model':db[_0xb3fd('0x83')],'as':_0xb3fd('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb3fd('0x29')](handleEntityNotFound(_0x19a4cb,null))[_0xb3fd('0x29')](function(_0x4b9be3){var _0x5dc78c=_[_0xb3fd('0x31')](_0x4b9be3,'id');var _0x1453cc=[];var _0x2b9400=[];var _0x5ef26b=squel[_0xb3fd('0x84')]();_0x5ef26b[_0xb3fd('0x85')]('tq.TeamId')['from']('team_has_voice_queues','tq')[_0xb3fd('0x86')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb3fd('0x49')](_0xb3fd('0x87'),_0x9788bf['params']['id']);for(var _0x43d669=0x0;_0x43d669<_0x4b9be3['length'];_0x43d669+=0x1){let _0x92bb8=_0x4b9be3[_0x43d669];for(var _0x29e5aa=0x0;_0x29e5aa<_0x92bb8[_0xb3fd('0x74')][_0xb3fd('0x47')];_0x29e5aa+=0x1){let _0x5c49e7=_0x92bb8[_0xb3fd('0x74')][_0x29e5aa];var _0xd3f381=_0x5ef26b['clone']();_0xd3f381[_0xb3fd('0x49')](_0xb3fd('0x88'),_0x5c49e7['id']);_0x2b9400[_0xb3fd('0x89')](db[_0xb3fd('0x76')][_0xb3fd('0x41')](_0xd3f381[_0xb3fd('0x8a')](),{'type':db['sequelize'][_0xb3fd('0x8b')][_0xb3fd('0x8c')]})[_0xb3fd('0x29')](function(_0x2e48d5){if(_0x2e48d5[_0xb3fd('0x47')]===0x1){return _0x5c49e7['id'];}else{var _0xdcebf4=_[_0xb3fd('0x8d')](_[_0xb3fd('0x31')](_0x2e48d5,_0xb3fd('0x8e')),function(_0x4186cd){return _['includes'](_0x5dc78c,_0x4186cd);});if(_0xdcebf4){return _0x5c49e7['id'];}}}));}}return BPromise[_0xb3fd('0x8f')](_0x2b9400)[_0xb3fd('0x29')](function(_0x281b4d){_0x1453cc=_(_0x1453cc)['union'](_0x281b4d)['compact']()[_0xb3fd('0x32')]();return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x9788bf[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](function(_0x485949){return db[_0xb3fd('0x76')][_0xb3fd('0x77')](function(_0x539886){return _0x485949[_0xb3fd('0x90')](_0x9788bf[_0xb3fd('0x41')][_0xb3fd('0x82')],{'transaction':_0x539886})[_0xb3fd('0x29')](function(){if(!_['isEmpty'](_0x1453cc)){return _0x485949['removeAgents'](_0x1453cc,{'transaction':_0x539886})[_0xb3fd('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x9788bf[_0xb3fd('0x5b')]['id'],'UserId':_0x1453cc},'transaction':_0x539886});});}})[_0xb3fd('0x29')](function(){_0x1453cc[_0xb3fd('0x75')](function(_0x362b5e){socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':_0x362b5e,'VoiceQueueId':_0x485949['id']});});});});});});})['then'](respondWithStatusCode(_0x19a4cb,null))['catch'](handleError(_0x19a4cb,null));};exports[_0xb3fd('0x92')]=function(_0x15277a,_0x40d450,_0x28854a){var _0x5c899c,_0x3f8f7a;return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x15277a[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x40d450,null))[_0xb3fd('0x29')](function(_0x1dfb09){if(_0x1dfb09){_0x3f8f7a=_0x1dfb09;return _0x1dfb09[_0xb3fd('0x92')](_0x15277a[_0xb3fd('0x54')][_0xb3fd('0x82')],_[_0xb3fd('0x5c')](_0x15277a[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{})[_0xb3fd('0x93')](function(_0x556a33){for(var _0x5a7235=0x0;_0x5a7235<_0x15277a[_0xb3fd('0x54')][_0xb3fd('0x82')][_0xb3fd('0x47')];_0x5a7235+=0x1){socket['emit'](_0xb3fd('0x81'),{'UserId':Number(_0x15277a[_0xb3fd('0x54')]['ids'][_0x5a7235]),'VoiceQueueId':Number(_0x15277a[_0xb3fd('0x5b')]['id'])});}return _0x556a33;});}})['then'](function(_0x908d92){_0x5c899c=_0x908d92||[];if(_0x3f8f7a){return db[_0xb3fd('0x83')][_0xb3fd('0x50')]({'where':{'id':_0x15277a[_0xb3fd('0x54')]['ids']},'attributes':['id',_0xb3fd('0x35'),_0xb3fd('0x70'),_0xb3fd('0x71'),_0xb3fd('0x72')],'raw':!![]});}})[_0xb3fd('0x29')](function(_0x16a324){if(!_['isEmpty'](_0x16a324)){var _0x45b085=[];for(var _0x4b79dc=0x0;_0x4b79dc<_0x16a324[_0xb3fd('0x47')];_0x4b79dc++){if(_0x16a324[_0x4b79dc]['online']){_0x45b085['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x16a324[_0x4b79dc][_0xb3fd('0x35')],'UserId':_0x16a324[_0x4b79dc]['id'],'queue_name':_0x3f8f7a['name'],'VoiceQueueId':_0x3f8f7a['id'],'interface':_[_0xb3fd('0x7d')](_0x16a324[_0x4b79dc][_0xb3fd('0x72')])?util[_0xb3fd('0x7e')](_0xb3fd('0x7f'),_0x16a324[_0x4b79dc][_0xb3fd('0x35')]):_0x16a324[_0x4b79dc][_0xb3fd('0x72')],'paused':_0x16a324[_0x4b79dc]['voicePause']||![],'penalty':_0x15277a['body']['penalty']||0x0}));}}return BPromise['all'](_0x45b085);}})[_0xb3fd('0x29')](function(){return _0x5c899c;})[_0xb3fd('0x29')](respondWithResult(_0x40d450,null))[_0xb3fd('0x52')](handleError(_0x40d450,null));};exports[_0xb3fd('0x94')]=function(_0x189d02,_0x1d8003,_0x168b10){return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x189d02['params']['id']}})['then'](handleEntityNotFound(_0x1d8003,null))[_0xb3fd('0x29')](function(_0x256597){if(_0x256597){return _0x256597[_0xb3fd('0x94')](_0x189d02[_0xb3fd('0x41')]['ids'])[_0xb3fd('0x29')](function(){if(_['isArray'](_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')])){for(var _0x36755c=0x0;_0x36755c<_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')]['length'];_0x36755c+=0x1){socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':Number(_0x189d02['query'][_0xb3fd('0x82')][_0x36755c]),'VoiceQueueId':Number(_0x189d02['params']['id'])});}}else{socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':Number(_0x189d02['query'][_0xb3fd('0x82')]),'VoiceQueueId':Number(_0x189d02[_0xb3fd('0x5b')]['id'])});}});}})[_0xb3fd('0x29')](function(_0x18324b){return db[_0xb3fd('0x7c')][_0xb3fd('0x37')]({'where':{'VoiceQueueId':_0x189d02['params']['id'],'UserId':_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')]}})[_0xb3fd('0x29')](function(){return _0x18324b;});})[_0xb3fd('0x29')](respondWithStatusCode(_0x1d8003,null))['catch'](handleError(_0x1d8003,null));};exports['getAgents']=function(_0x10049d,_0x357612,_0x187c47){var _0x392353={};var _0x3ad565={};var _0xd1ada2;var _0x5c499a;return db['VoiceQueue'][_0xb3fd('0x61')]({'where':{'id':_0x10049d['params']['id']}})['then'](handleEntityNotFound(_0x357612,null))[_0xb3fd('0x29')](function(_0x152e5f){if(_0x152e5f){_0xd1ada2=_0x152e5f;_0x3ad565[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x83')][_0xb3fd('0x3d')]);_0x3ad565[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x10049d['query']);_0x3ad565[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x3ad565['model'],_0x3ad565[_0xb3fd('0x41')]);_0x392353['attributes']=_[_0xb3fd('0x44')](_0x3ad565[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x10049d[_0xb3fd('0x41')]['fields']));_0x392353['attributes']=_0x392353['attributes'][_0xb3fd('0x47')]?_0x392353[_0xb3fd('0x46')]:_0x3ad565[_0xb3fd('0x40')];_0x392353[_0xb3fd('0x48')]=qs['sort'](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x392353[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x10049d[_0xb3fd('0x41')],_0x3ad565[_0xb3fd('0x43')]));if(_0x10049d[_0xb3fd('0x41')]['filter']){_0x392353[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x392353[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x392353[_0xb3fd('0x46')],function(_0x59f024){var _0x2cc91b={};_0x2cc91b[_0x59f024]={'$like':'%'+_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x2cc91b;})});}_0x392353=_[_0xb3fd('0x4b')]({},_0x392353,_0x10049d['options']);return _0xd1ada2[_0xb3fd('0x95')](_0x392353);}})[_0xb3fd('0x29')](function(_0x378bf8){if(_0x378bf8){_0x5c499a=_0x378bf8[_0xb3fd('0x47')];if(!_0x10049d[_0xb3fd('0x41')]['hasOwnProperty']('nolimit')){_0x392353[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x392353[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0xd1ada2[_0xb3fd('0x95')](_0x392353);}})['then'](function(_0x3be443){if(_0x3be443){return _0x3be443?{'count':_0x5c499a,'rows':_0x3be443}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x357612,null))['catch'](handleError(_0x357612,null));};exports[_0xb3fd('0x96')]=function(_0x29ad66,_0x270fbe,_0x3dcca2){var _0x43f3e3={};var _0x1c9cd6={};var _0x4d9185;var _0x2a9621;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x29ad66[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x270fbe,null))[_0xb3fd('0x29')](function(_0x52e6a3){if(_0x52e6a3){_0x4d9185=_0x52e6a3;_0x1c9cd6[_0xb3fd('0x40')]=_['keys'](db[_0xb3fd('0x7c')][_0xb3fd('0x3d')]);_0x1c9cd6['query']=_[_0xb3fd('0x42')](_0x29ad66['query']);_0x1c9cd6['filters']=_[_0xb3fd('0x44')](_0x1c9cd6[_0xb3fd('0x40')],_0x1c9cd6[_0xb3fd('0x41')]);_0x43f3e3[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x1c9cd6['model'],qs[_0xb3fd('0x45')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x43f3e3[_0xb3fd('0x46')]=_0x43f3e3[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x43f3e3['attributes']:_0x1c9cd6[_0xb3fd('0x40')];_0x43f3e3[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x29ad66[_0xb3fd('0x41')]['sort']);_0x43f3e3[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x29ad66[_0xb3fd('0x41')],_0x1c9cd6['filters']));if(_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x43f3e3['where']=_[_0xb3fd('0x4b')](_0x43f3e3[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x43f3e3[_0xb3fd('0x46')],function(_0x16d680){var _0x2fecf9={};_0x2fecf9[_0x16d680]={'$like':'%'+_0x29ad66['query']['filter']+'%'};return _0x2fecf9;})});}_0x43f3e3=_[_0xb3fd('0x4b')]({},_0x43f3e3,_0x29ad66[_0xb3fd('0x4d')]);return _0x4d9185[_0xb3fd('0x96')](_0x43f3e3);}})[_0xb3fd('0x29')](function(_0x54a8ff){if(_0x54a8ff){_0x2a9621=_0x54a8ff[_0xb3fd('0x47')];if(!_0x29ad66['query'][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x43f3e3[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x43f3e3[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x4d9185[_0xb3fd('0x96')](_0x43f3e3);}})[_0xb3fd('0x29')](function(_0x96ed60){return _0x96ed60?{'count':_0x2a9621,'rows':_0x96ed60}:null;})[_0xb3fd('0x29')](respondWithResult(_0x270fbe,null))[_0xb3fd('0x52')](handleError(_0x270fbe,null));};exports[_0xb3fd('0x97')]=function(_0x189094,_0x15e6c7,_0xb5fd96){var _0x374740={};var _0x26466e={};var _0x1e65fb;var _0x47c8f7;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x189094[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x15e6c7,null))[_0xb3fd('0x29')](function(_0x252460){if(_0x252460){_0x1e65fb=_0x252460;_0x26466e[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x98')][_0xb3fd('0x3d')]);_0x26466e['query']=_[_0xb3fd('0x42')](_0x189094[_0xb3fd('0x41')]);_0x26466e['filters']=_[_0xb3fd('0x44')](_0x26466e[_0xb3fd('0x40')],_0x26466e['query']);_0x374740[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x26466e['model'],qs[_0xb3fd('0x45')](_0x189094[_0xb3fd('0x41')]['fields']));_0x374740[_0xb3fd('0x46')]=_0x374740[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x374740[_0xb3fd('0x46')]:_0x26466e[_0xb3fd('0x40')];_0x374740[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x189094[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x374740['where']=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x189094[_0xb3fd('0x41')],_0x26466e[_0xb3fd('0x43')]));if(_0x189094[_0xb3fd('0x41')]['filter']){_0x374740[_0xb3fd('0x49')]=_['merge'](_0x374740[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x374740['attributes'],function(_0x5230fe){var _0x38c996={};_0x38c996[_0x5230fe]={'$like':'%'+_0x189094[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x38c996;})});}_0x374740=_[_0xb3fd('0x4b')]({},_0x374740,_0x189094[_0xb3fd('0x4d')]);return _0x1e65fb[_0xb3fd('0x97')](_0x374740);}})[_0xb3fd('0x29')](function(_0x4164c6){if(_0x4164c6){_0x47c8f7=_0x4164c6[_0xb3fd('0x47')];if(!_0x189094[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x374740[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x189094['query'][_0xb3fd('0x20')]);_0x374740[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x189094[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x1e65fb[_0xb3fd('0x97')](_0x374740);}})['then'](function(_0x5afd00){if(_0x5afd00){return _0x5afd00?{'count':_0x47c8f7,'rows':_0x5afd00}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x15e6c7,null))['catch'](handleError(_0x15e6c7,null));};exports[_0xb3fd('0x99')]=function(_0x45b62a,_0x475183,_0x49a16a){var _0xd8da4,_0x433675;return db['VoiceQueue'][_0xb3fd('0x34')]({'where':{'id':_0x45b62a['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x475183,null))[_0xb3fd('0x29')](function(_0xd23a50){if(_0xd23a50){_0x433675=_0xd23a50;return _0xd23a50[_0xb3fd('0x99')](_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x82')],_[_0xb3fd('0x5c')](_0x45b62a[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{});}return null;})['spread'](function(_0x12d55b){var _0xb343c;_0xd8da4=_0x12d55b||[];var _0x335ed8=[];if(_0x12d55b){for(var _0x9d0ef3=0x0;_0x9d0ef3<_0x12d55b[_0xb3fd('0x47')];_0x9d0ef3+=0x1){var _0x458cfc=_0x12d55b[_0x9d0ef3][_0xb3fd('0x2a')]({'plain':!![]});_0x433675[_0xb3fd('0x9a')]=_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x9a')]?_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x9a')]:_0x433675[_0xb3fd('0x9a')];switch(_0x433675[_0xb3fd('0x9a')]){case _0xb3fd('0x9b'):_0xb343c=squel[_0xb3fd('0x9c')]()[_0xb3fd('0x9d')](_0xb3fd('0x9e'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),'ListId',_0xb3fd('0x65'),_0xb3fd('0x5e'),_0xb3fd('0x5d')],squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0xa1'))['field']('id',_0xb3fd('0xa2'))['field'](_0x458cfc[_0xb3fd('0xa4')]['toString'](),_0xb3fd('0xa5'))[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))['field'](_0xb3fd('0xa3'),'createdAt')[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))['where'](_0xb3fd('0xa7'))['where'](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')]['toString']())['where'](_0xb3fd('0xa9'))[_0xb3fd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb3fd('0x84')]()['field'](_0xb3fd('0xaa'))[_0xb3fd('0xab')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x45b62a['params']['id'][_0xb3fd('0x8a')]()))[_0xb3fd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xac'))[_0xb3fd('0xab')](_0xb3fd('0x9e'))[_0xb3fd('0x49')](_0xb3fd('0x87'),_0x45b62a['params']['id'][_0xb3fd('0x8a')]())))['toString']();break;case _0xb3fd('0xad'):_0xb343c=squel[_0xb3fd('0x9c')]()[_0xb3fd('0x9d')]('cm_hopper')[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel['select']()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0xa1'))[_0xb3fd('0x85')]('id',_0xb3fd('0xa2'))[_0xb3fd('0x85')](_0x458cfc[_0xb3fd('0xa4')][_0xb3fd('0x8a')](),'ListId')[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5e'))['field']('NOW()',_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))[_0xb3fd('0x49')](_0xb3fd('0xa7'))[_0xb3fd('0x49')](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')][_0xb3fd('0x8a')]())[_0xb3fd('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xb3fd('0x49')](_0xb3fd('0xae'),squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xac'))[_0xb3fd('0xab')](_0xb3fd('0x9e'))[_0xb3fd('0x49')]('VoiceQueueId\x20=\x20?',_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')]())))[_0xb3fd('0x8a')]();break;default:_0xb343c=squel['insert']()[_0xb3fd('0x9d')](_0xb3fd('0x9e'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel[_0xb3fd('0x84')]()['field'](_0xb3fd('0xa0'),'phone')[_0xb3fd('0x85')](_0xb3fd('0xa3'),'scheduledAt')[_0xb3fd('0x85')]('id','ContactId')[_0xb3fd('0x85')](_0x458cfc[_0xb3fd('0xa4')]['toString'](),'ListId')[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5e'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))[_0xb3fd('0xab')](_0xb3fd('0xa6'))[_0xb3fd('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')]['toString']())[_0xb3fd('0x49')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x335ed8[_0xb3fd('0x89')](db['sequelize'][_0xb3fd('0x41')](_0xb343c));}return BPromise[_0xb3fd('0x8f')](_0x335ed8);}})['then'](function(){return _0xd8da4;})[_0xb3fd('0x29')](respondWithResult(_0x475183,null))[_0xb3fd('0x52')](handleError(_0x475183,null));};exports['removeLists']=function(_0x1177cc,_0x17ad48,_0x6d049e){return db['VoiceQueue']['find']({'where':{'id':_0x1177cc[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x17ad48,null))[_0xb3fd('0x29')](function(_0x23e58e){if(_0x23e58e){return _0x23e58e['removeLists'](_0x1177cc['query'][_0xb3fd('0x82')]);}})[_0xb3fd('0x29')](function(_0x3b696b){if(_0x3b696b){return db[_0xb3fd('0x66')][_0xb3fd('0x37')]({'where':{'ListId':_0x1177cc[_0xb3fd('0x41')]['ids'],'VoiceQueueId':_0x1177cc['params']['id']}})[_0xb3fd('0x29')](function(){return _0x3b696b;});}})[_0xb3fd('0x29')](respondWithStatusCode(_0x17ad48,null))[_0xb3fd('0x52')](handleError(_0x17ad48,null));};exports[_0xb3fd('0xaf')]=function(_0x42dde0,_0xc82fa5,_0x2776ff){var _0x184399={};var _0x44fee2={};var _0x264819;var _0x30af0f;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x42dde0[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc82fa5,null))[_0xb3fd('0x29')](function(_0x1b76ff){if(_0x1b76ff){_0x264819=_0x1b76ff;_0x44fee2[_0xb3fd('0x40')]=_['keys'](db[_0xb3fd('0x98')][_0xb3fd('0x3d')]);_0x44fee2[_0xb3fd('0x41')]=_['keys'](_0x42dde0[_0xb3fd('0x41')]);_0x44fee2[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x44fee2[_0xb3fd('0x40')],_0x44fee2[_0xb3fd('0x41')]);_0x184399['attributes']=_['intersection'](_0x44fee2['model'],qs[_0xb3fd('0x45')](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x184399[_0xb3fd('0x46')]=_0x184399[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x184399[_0xb3fd('0x46')]:_0x44fee2['model'];_0x184399[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x184399['where']=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x42dde0[_0xb3fd('0x41')],_0x44fee2[_0xb3fd('0x43')]));if(_0x42dde0[_0xb3fd('0x41')]['filter']){_0x184399[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x184399[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x184399[_0xb3fd('0x46')],function(_0x448210){var _0x95eb46={};_0x95eb46[_0x448210]={'$like':'%'+_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x95eb46;})});}_0x184399=_[_0xb3fd('0x4b')]({},_0x184399,_0x42dde0[_0xb3fd('0x4d')]);return _0x264819[_0xb3fd('0xaf')](_0x184399);}})[_0xb3fd('0x29')](function(_0x559e77){if(_0x559e77){_0x30af0f=_0x559e77[_0xb3fd('0x47')];if(!_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x184399[_0xb3fd('0x20')]=qs['limit'](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x184399[_0xb3fd('0x1f')]=qs['offset'](_0x42dde0['query'][_0xb3fd('0x1f')]);}return _0x264819[_0xb3fd('0xaf')](_0x184399);}})['then'](function(_0x5d0ea5){if(_0x5d0ea5){return _0x5d0ea5?{'count':_0x30af0f,'rows':_0x5d0ea5}:null;}})['then'](respondWithResult(_0xc82fa5,null))[_0xb3fd('0x52')](handleError(_0xc82fa5,null));};exports[_0xb3fd('0xb0')]=function(_0x31b06d,_0x424872,_0x16896c){var _0x424194,_0x5498bc;return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x31b06d[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x424872,null))[_0xb3fd('0x29')](function(_0xe28ee2){if(_0xe28ee2){_0x5498bc=_0xe28ee2;return _0xe28ee2[_0xb3fd('0xb0')](_0x31b06d[_0xb3fd('0x54')]['ids'],_['omit'](_0x31b06d[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{});}return null;})['spread'](function(_0x51765e){var _0x2cc5e5;_0x424194=_0x51765e||[];var _0x5cf9ea=[];if(_0x51765e){for(var _0x486275=0x0;_0x486275<_0x51765e[_0xb3fd('0x47')];_0x486275+=0x1){var _0x31d2dc=_0x51765e[_0x486275][_0xb3fd('0x2a')]({'plain':!![]});_0x2cc5e5=squel['insert']()[_0xb3fd('0x9d')](_0xb3fd('0xb1'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')]('id','ContactId')[_0xb3fd('0x85')](_0x31d2dc[_0xb3fd('0xa4')][_0xb3fd('0x8a')](),_0xb3fd('0xa5'))[_0xb3fd('0x85')](_0x31b06d['params']['id']['toString'](),_0xb3fd('0x65'))['field'](_0xb3fd('0xa3'),_0xb3fd('0x5e'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))[_0xb3fd('0x49')](_0xb3fd('0xa7'))[_0xb3fd('0x49')](_0xb3fd('0xa8'),_0x31d2dc[_0xb3fd('0xa4')][_0xb3fd('0x8a')]())['where'](_0xb3fd('0xa9')))[_0xb3fd('0x8a')]();_0x5cf9ea[_0xb3fd('0x89')](db['sequelize'][_0xb3fd('0x41')](_0x2cc5e5));}return BPromise[_0xb3fd('0x8f')](_0x5cf9ea);}})[_0xb3fd('0x29')](function(){return _0x424194;})[_0xb3fd('0x29')](respondWithResult(_0x424872,null))[_0xb3fd('0x52')](handleError(_0x424872,null));};exports[_0xb3fd('0xb2')]=function(_0x24cf2f,_0x2a9343,_0x289c50){return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x24cf2f['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x2a9343,null))[_0xb3fd('0x29')](function(_0x532664){if(_0x532664){return _0x532664[_0xb3fd('0xb2')](_0x24cf2f[_0xb3fd('0x41')][_0xb3fd('0x82')]);}})[_0xb3fd('0x29')](function(_0xe1d190){if(_0xe1d190){return db[_0xb3fd('0x6c')][_0xb3fd('0x37')]({'where':{'ListId':_0x24cf2f['query'][_0xb3fd('0x82')],'VoiceQueueId':_0x24cf2f['params']['id']}})['then'](function(){return _0xe1d190;});}})[_0xb3fd('0x29')](respondWithStatusCode(_0x2a9343,null))[_0xb3fd('0x52')](handleError(_0x2a9343,null));};
\ No newline at end of file