Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / voiceQueue / voiceQueue.controller.js
index d8c35e7..defff2d 100644 (file)
@@ -1 +1 @@
-const a753_0x59e0=['autoAssociation','omit','Content-Range','voicePause','getHopperFinals','scheduledAt','getBlackLists','body','userVoiceQueue:save','TeamId','penalty','filter','Agents','like','Team','getHopperBlacks','userVoiceQueue:remove','union','util','model','options','lodash','COALESCE(phone,\x27\x27)','error','cm_hopper_black','value','name','query','team_has_voice_queues','register','send','VoiceQueue','getHopperHistories','rawAttributes','addLists','updatedAt','keys','VIRTUAL','../../components/parsers/qs','into','stack','getLists','find','undefined','fieldName','deletedAt\x20IS\x20NULL','removeLists','removeAgents','VoiceQueues','CmHopper','offset','show','COALESCE(calleridnum,\x27\x27)','createdAt','../../mysqldb','type','SELECT','sort','upsert','findOne','getAgents','all','emit','ignore','filters','ut.TeamId\x20=\x20tq.TeamId','UserVoiceQueueRt','compact','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','isEmpty','CmHopperBlack','map','json','getMembers','../../rediscache','cm_hopper','Unable\x20to\x20retrieve\x20the\x20current\x20user','addBlackLists','CmListId','cm_contacts','findAll','phone','merge','field','always','where','push','every','ut.UserId\x20=\x20?','order','removeTeams','update','toString','tq.TeamId','ids','includes','length','CmHopperFinal','../../config/logger','limit','pick','userProfileId','attributes','onlyIfOpen','select','ListId\x20=\x20?','end','isNil','SIP/%s','transaction','removeBlackLists','teams','UserProfileSection','addTeams','NOW()','UserProfileResource','params','ContactId','sequelize','from','user','VoiceQueueId\x20=\x20?','get','sendStatus','includeAll','QueueCampaigns','CmList','VoiceQueueId','set','insert','inbound','format','rows','ListId','UserVoiceQueue','online','User','fields','intersection','dialCheckDuplicateType','role','join','getTeams','key','nolimit','count','index','fromQuery','interface','phone\x20NOT\x20IN\x20(?)','status','create','destroy','flatMap','then','each','include','forEach','addAgents','catch','phone\x20IS\x20NOT\x20NULL'];(function(_0x6a9733,_0x59e0f1){const _0x2472bc=function(_0x29e6a2){while(--_0x29e6a2){_0x6a9733['push'](_0x6a9733['shift']());}};_0x2472bc(++_0x59e0f1);}(a753_0x59e0,0x73));const a753_0x2472=function(_0x6a9733,_0x59e0f1){_0x6a9733=_0x6a9733-0x0;let _0x2472bc=a753_0x59e0[_0x6a9733];return _0x2472bc;};const _0x37a035=a753_0x2472;'use strict';const util=require(_0x37a035('0x40')),_=require(_0x37a035('0x43')),squel=require('squel'),qs=require(_0x37a035('0x54')),logger=require(_0x37a035('0x90'))('api'),{getSocket}=require(_0x37a035('0x78')),socket=getSocket(),db=require(_0x37a035('0x64'))['db'],{Op,QueryTypes}=require(_0x37a035('0x3'));require('./voiceQueue.socket')[_0x37a035('0x4b')](socket);function respondWithStatusCode(_0x29e6a2,_0x5cffba){return _0x5cffba=_0x5cffba||0xcc,function(_0xac56e9){const _0x4f2c5a=a753_0x2472;if(_0xac56e9)return _0x29e6a2[_0x4f2c5a('0x8')](_0x5cffba);return _0x29e6a2['status'](_0x5cffba)[_0x4f2c5a('0x98')]();};}function respondWithResult(_0x37ed63,_0x590634){return _0x590634=_0x590634||0xc8,function(_0x30b2ee){const _0x599f9a=a753_0x2472;if(_0x30b2ee)return _0x37ed63['status'](_0x590634)[_0x599f9a('0x76')](_0x30b2ee);};}function respondWithFilteredResult(_0xfcea12,_0x5cd509){return function(_0x4e7252){const _0x2fbfe8=a753_0x2472;if(_0x4e7252){const _0x5f4317=_0x4e7252['count'],_0x581552=_0x5cd509['offset'];let _0x2916f6=_0x5cd509[_0x2fbfe8('0x60')]+_0x5cd509['limit'],_0x30b73f;return _0x2916f6>=_0x5f4317?(_0x2916f6=_0x5f4317,_0x30b73f=0xc8):_0x30b73f=0xce,_0xfcea12[_0x2fbfe8('0x23')](_0x30b73f),_0xfcea12[_0x2fbfe8('0xd')](_0x2fbfe8('0x30'),_0x581552+'-'+_0x2916f6+'/'+_0x5f4317)[_0x2fbfe8('0x76')](_0x4e7252);}return null;};}function saveUpdates(_0x3b3fb){return function(_0x150a48){const _0x2e7e15=a753_0x2472;if(_0x150a48)return _0x150a48[_0x2e7e15('0x89')](_0x3b3fb)[_0x2e7e15('0x27')](function(_0xb8e6b4){return _0xb8e6b4;});return null;};}function removeEntity(_0x2d6c87){return function(_0x1ea93a){const _0x3d3e2f=a753_0x2472;if(_0x1ea93a)return _0x1ea93a[_0x3d3e2f('0x25')]()['then'](function(){const _0x367a82=_0x3d3e2f,_0x573a48=_0x1ea93a[_0x367a82('0x7')]({'plain':!![]}),_0x4e1a1d=[{'name':_0x367a82('0x5e'),'value':_0x367a82('0xf'),'ignore':![]},{'name':_0x367a82('0xa'),'value':'outbound','ignore':![]}],_0x5475f5=_(_0x4e1a1d)[_0x367a82('0x39')](_0x367a82('0x6d'))['map']('value')[_0x367a82('0x47')]();if(_['includes'](_0x5475f5,_0x573a48[_0x367a82('0x65')]))return;const _0x4ba745=_['find'](_0x4e1a1d,['value',_0x573a48[_0x367a82('0x65')]])['name'];return db['UserProfileResource'][_0x367a82('0x25')]({'where':{'type':_0x4ba745,'resourceId':_0x573a48['id']}})['then'](function(){return _0x1ea93a;});})[_0x3d3e2f('0x27')](function(){const _0x5ec5bf=_0x3d3e2f;_0x2d6c87[_0x5ec5bf('0x23')](0xcc)[_0x5ec5bf('0x98')]();});};}function handleEntityNotFound(_0x371949){return function(_0x225bb7){const _0x497e7b=a753_0x2472;return!_0x225bb7&&_0x371949[_0x497e7b('0x8')](0x194),_0x225bb7;};}function handleError(_0x40620d,_0x2170d3){return _0x2170d3=_0x2170d3||0x1f4,function(_0x546837){const _0x58f1ba=a753_0x2472;logger[_0x58f1ba('0x45')](_0x546837[_0x58f1ba('0x56')]),_0x546837[_0x58f1ba('0x48')]&&delete _0x546837[_0x58f1ba('0x48')],_0x40620d[_0x58f1ba('0x23')](_0x2170d3)[_0x58f1ba('0x4c')](_0x546837);};}exports[_0x37a035('0x1f')]=function(_0xf1b459,_0xaf8fdc){const _0x30ad59=_0x37a035;let _0x5ac8a7={};const _0x23fbbb={},_0x2e4b9e={'count':0x0,'rows':[]},_0x517354=_[_0x30ad59('0x75')](db[_0x30ad59('0x4d')]['rawAttributes'],function(_0x1a1bd1){const _0x583b8c=_0x30ad59;return{'name':_0x1a1bd1[_0x583b8c('0x5a')],'type':_0x1a1bd1[_0x583b8c('0x65')][_0x583b8c('0x1c')]};});_0x23fbbb['model']=_[_0x30ad59('0x75')](_0x517354,_0x30ad59('0x48')),_0x23fbbb['query']=_[_0x30ad59('0x52')](_0xf1b459['query']),_0x23fbbb[_0x30ad59('0x6e')]=_[_0x30ad59('0x17')](_0x23fbbb['model'],_0x23fbbb[_0x30ad59('0x49')]),_0x5ac8a7[_0x30ad59('0x94')]=_['intersection'](_0x23fbbb[_0x30ad59('0x41')],qs[_0x30ad59('0x16')](_0xf1b459['query']['fields'])),_0x5ac8a7[_0x30ad59('0x94')]=_0x5ac8a7[_0x30ad59('0x94')]['length']?_0x5ac8a7[_0x30ad59('0x94')]:_0x23fbbb[_0x30ad59('0x41')];typeof _0xf1b459['query'][_0x30ad59('0x1d')]===_0x30ad59('0x59')&&(_0x5ac8a7['limit']=qs[_0x30ad59('0x91')](_0xf1b459[_0x30ad59('0x49')]['limit']),_0x5ac8a7['offset']=qs[_0x30ad59('0x60')](_0xf1b459[_0x30ad59('0x49')][_0x30ad59('0x60')]));_0x5ac8a7['order']=qs[_0x30ad59('0x67')](_0xf1b459[_0x30ad59('0x49')][_0x30ad59('0x67')]),_0x5ac8a7[_0x30ad59('0x83')]=qs[_0x30ad59('0x6e')](_[_0x30ad59('0x92')](_0xf1b459[_0x30ad59('0x49')],_0x23fbbb[_0x30ad59('0x6e')]),_0x517354);_0xf1b459['query'][_0x30ad59('0x39')]&&(_0x5ac8a7['where']=_[_0x30ad59('0x80')](_0x5ac8a7['where'],{[Op['or']]:_[_0x30ad59('0x75')](_0x517354,function(_0x1aa2e7){const _0x152a29=_0x30ad59;if(_0x1aa2e7[_0x152a29('0x65')]!==_0x152a29('0x53')){const _0x2aa642={};return _0x2aa642[_0x1aa2e7[_0x152a29('0x48')]]={[Op[_0x152a29('0x3b')]]:'%'+_0xf1b459[_0x152a29('0x49')][_0x152a29('0x39')]+'%'},_0x2aa642;}})}));_0x5ac8a7=_['merge']({},_0x5ac8a7,_0xf1b459['options']);const _0x499a8f={'where':_0x5ac8a7['where']};return db[_0x30ad59('0x4d')]['count'](_0x499a8f)[_0x30ad59('0x27')](function(_0x32871a){const _0x4bac3e=_0x30ad59;return _0x2e4b9e[_0x4bac3e('0x1e')]=_0x32871a,_0xf1b459[_0x4bac3e('0x49')][_0x4bac3e('0x9')]&&(_0x5ac8a7[_0x4bac3e('0x29')]=[{'all':!![]}]),db[_0x4bac3e('0x4d')][_0x4bac3e('0x7e')](_0x5ac8a7);})[_0x30ad59('0x27')](function(_0x1d1fc7){const _0x2c2739=_0x30ad59;return _0x2e4b9e[_0x2c2739('0x11')]=_0x1d1fc7,_0x2e4b9e;})[_0x30ad59('0x27')](respondWithFilteredResult(_0xaf8fdc,_0x5ac8a7))['catch'](handleError(_0xaf8fdc,null));},exports[_0x37a035('0x61')]=function(_0x49af78,_0x4552c5){const _0xb7b0be=_0x37a035;let _0x310303={'raw':![],'where':{'id':_0x49af78['params']['id']}};const _0x3666be={};return _0x3666be[_0xb7b0be('0x41')]=_[_0xb7b0be('0x52')](db['VoiceQueue'][_0xb7b0be('0x4f')]),_0x3666be['query']=_[_0xb7b0be('0x52')](_0x49af78[_0xb7b0be('0x49')]),_0x3666be[_0xb7b0be('0x6e')]=_[_0xb7b0be('0x17')](_0x3666be[_0xb7b0be('0x41')],_0x3666be['query']),_0x310303[_0xb7b0be('0x94')]=_['intersection'](_0x3666be[_0xb7b0be('0x41')],qs['fields'](_0x49af78[_0xb7b0be('0x49')]['fields'])),_0x310303[_0xb7b0be('0x94')]=_0x310303[_0xb7b0be('0x94')][_0xb7b0be('0x8e')]?_0x310303[_0xb7b0be('0x94')]:_0x3666be['model'],_0x49af78['query'][_0xb7b0be('0x9')]&&(_0x310303[_0xb7b0be('0x29')]=[{'all':!![]}]),_0x310303=_[_0xb7b0be('0x80')]({},_0x310303,_0x49af78[_0xb7b0be('0x42')]),db[_0xb7b0be('0x4d')]['findOne'](_0x310303)[_0xb7b0be('0x27')](handleEntityNotFound(_0x4552c5,null))[_0xb7b0be('0x27')](respondWithResult(_0x4552c5,null))[_0xb7b0be('0x2c')](handleError(_0x4552c5,null));},exports[_0x37a035('0x24')]=function(_0x4b0795,_0x44ec3a){const _0x195591=_0x37a035;return db[_0x195591('0x4d')]['create'](_0x4b0795[_0x195591('0x35')],{})[_0x195591('0x27')](function(_0x13b011){const _0x2ba2a4=_0x195591,_0x3499df=_0x4b0795[_0x2ba2a4('0x5')][_0x2ba2a4('0x7')]({'plain':!![]});if(!_0x3499df)throw new Error(_0x2ba2a4('0x7a'));if(_0x3499df[_0x2ba2a4('0x19')]===_0x2ba2a4('0x5')){const _0x230391=_0x13b011[_0x2ba2a4('0x7')]({'plain':!![]}),_0x2847de=[{'name':_0x2ba2a4('0x5e'),'value':_0x2ba2a4('0xf')},{'name':_0x2ba2a4('0xa'),'value':'outbound'}],_0x11c322=_['find'](_0x2847de,[_0x2ba2a4('0x47'),_0x230391['type']])[_0x2ba2a4('0x48')];return db[_0x2ba2a4('0x9e')]['findOne']({'where':{'name':_0x11c322,'userProfileId':_0x3499df[_0x2ba2a4('0x93')]},'raw':!![]})[_0x2ba2a4('0x27')](function(_0x254305){const _0x17421b=_0x2ba2a4;return _0x254305&&_0x254305[_0x17421b('0x2e')]===0x0?db[_0x17421b('0x0')]['create']({'name':_0x230391['name'],'resourceId':_0x230391['id'],'type':_0x254305[_0x17421b('0x48')],'sectionId':_0x254305['id']},{})[_0x17421b('0x27')](function(){return _0x13b011;}):_0x13b011;})['catch'](function(_0x6e9314){const _0x385fff=_0x2ba2a4;logger[_0x385fff('0x45')](_0x385fff('0x72'),_0x6e9314);throw _0x6e9314;});}return _0x13b011;})['then'](respondWithResult(_0x44ec3a,0xc9))[_0x195591('0x2c')](handleError(_0x44ec3a,null));},exports['clone']=function(_0x216bb3,_0x5ab9ce){const _0x522c9b=_0x37a035;let _0x18c992={'where':{'id':_0x216bb3[_0x522c9b('0x1')]['id']}};const _0x11fb4d={};return _0x11fb4d[_0x522c9b('0x41')]=_[_0x522c9b('0x52')](db[_0x522c9b('0x4d')][_0x522c9b('0x4f')]),_0x18c992[_0x522c9b('0x94')]=_[_0x522c9b('0x17')](_0x11fb4d[_0x522c9b('0x41')],qs[_0x522c9b('0x16')](_0x216bb3[_0x522c9b('0x49')][_0x522c9b('0x16')])),_0x18c992['attributes']=_0x18c992[_0x522c9b('0x94')][_0x522c9b('0x8e')]?_0x18c992[_0x522c9b('0x94')]:_0x11fb4d[_0x522c9b('0x41')],_0x216bb3[_0x522c9b('0x49')][_0x522c9b('0x9')]&&(_0x18c992['include']=[{'all':!![]}]),_0x18c992=_[_0x522c9b('0x80')]({},_0x18c992,_0x216bb3['options']),db[_0x522c9b('0x4d')][_0x522c9b('0x69')](_0x18c992)[_0x522c9b('0x27')](handleEntityNotFound(_0x5ab9ce,null))['then'](function(_0x363489){const _0xd45c95=_0x522c9b;if(_0x363489){let _0x320f69=_0x363489[_0xd45c95('0x7')]({'plain':!![]});return _0x320f69=qs['omit'](_0x320f69,['id','createdAt',_0xd45c95('0x51')]),_0x216bb3[_0xd45c95('0x35')]=_[_0xd45c95('0x2f')](_0x216bb3[_0xd45c95('0x35')],['id',_0xd45c95('0x63'),_0xd45c95('0x51')]),db[_0xd45c95('0x4d')][_0xd45c95('0x24')](_[_0xd45c95('0x80')](_0x320f69,_0x216bb3[_0xd45c95('0x35')]),{'include':_0x216bb3[_0xd45c95('0x49')][_0xd45c95('0x9')]?[{'all':!![]}]:undefined})['then'](function(_0x573744){const _0x38b18f=_0xd45c95,_0x31d8fe=_0x216bb3[_0x38b18f('0x5')][_0x38b18f('0x7')]({'plain':!![]});if(!_0x31d8fe)throw new Error(_0x38b18f('0x7a'));if(_0x31d8fe[_0x38b18f('0x19')]===_0x38b18f('0x5')){const _0x264c0c=_0x573744[_0x38b18f('0x7')]({'plain':!![]}),_0x48b8c6=[{'name':_0x38b18f('0x5e'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}],_0x3ae192=_[_0x38b18f('0x58')](_0x48b8c6,[_0x38b18f('0x47'),_0x264c0c['type']])['name'];return db[_0x38b18f('0x9e')][_0x38b18f('0x69')]({'where':{'name':_0x3ae192,'userProfileId':_0x31d8fe[_0x38b18f('0x93')]},'raw':!![]})[_0x38b18f('0x27')](function(_0x26c9ca){const _0x5dcb44=_0x38b18f;return _0x26c9ca&&_0x26c9ca[_0x5dcb44('0x2e')]===0x0?db[_0x5dcb44('0x0')]['create']({'name':_0x264c0c[_0x5dcb44('0x48')],'resourceId':_0x264c0c['id'],'type':_0x26c9ca[_0x5dcb44('0x48')],'sectionId':_0x26c9ca['id']},{})[_0x5dcb44('0x27')](function(){return _0x573744;}):_0x573744;})['catch'](function(_0x30af96){const _0x1e09c8=_0x38b18f;logger[_0x1e09c8('0x45')](_0x1e09c8('0x72'),_0x30af96);throw _0x30af96;});}return _0x573744;});}})[_0x522c9b('0x27')](respondWithResult(_0x5ab9ce,0xc9))[_0x522c9b('0x2c')](handleError(_0x5ab9ce,null));},exports['update']=function(_0x2e7862,_0x3031b9){const _0x809222=_0x37a035;return _0x2e7862[_0x809222('0x35')]['id']&&delete _0x2e7862[_0x809222('0x35')]['id'],db[_0x809222('0x4d')]['findOne']({'where':{'id':_0x2e7862[_0x809222('0x1')]['id']}})['then'](handleEntityNotFound(_0x3031b9,null))['then'](saveUpdates(_0x2e7862['body'],null))[_0x809222('0x27')](respondWithResult(_0x3031b9,null))[_0x809222('0x2c')](handleError(_0x3031b9,null));},exports[_0x37a035('0x25')]=function(_0x5ebe04,_0x15bdd9){const _0x293cbd=_0x37a035;return db[_0x293cbd('0x4d')][_0x293cbd('0x69')]({'where':{'id':_0x5ebe04[_0x293cbd('0x1')]['id']}})[_0x293cbd('0x27')](handleEntityNotFound(_0x15bdd9,null))[_0x293cbd('0x27')](removeEntity(_0x15bdd9,null))['catch'](handleError(_0x15bdd9,null));},exports['getHoppers']=function(_0x3530b9,_0x47d865){const _0x44d4e7=_0x37a035;let _0x180c73={'raw':![],'where':{}};const _0xb6fbf5={},_0x2b324b={'count':0x0,'rows':[]};return db[_0x44d4e7('0x4d')]['findOne']({'where':{'id':_0x3530b9[_0x44d4e7('0x1')]['id']}})[_0x44d4e7('0x27')](handleEntityNotFound(_0x47d865,null))[_0x44d4e7('0x27')](function(_0xbe062c){const _0x51d65a=_0x44d4e7;if(_0xbe062c)return _0xb6fbf5[_0x51d65a('0x41')]=_[_0x51d65a('0x52')](db[_0x51d65a('0x5f')]['rawAttributes']),_0xb6fbf5['query']=_[_0x51d65a('0x52')](_0x3530b9['query']),_0xb6fbf5[_0x51d65a('0x6e')]=_['intersection'](_0xb6fbf5[_0x51d65a('0x41')],_0xb6fbf5[_0x51d65a('0x49')]),_0x180c73[_0x51d65a('0x94')]=_['intersection'](_0xb6fbf5[_0x51d65a('0x41')],qs[_0x51d65a('0x16')](_0x3530b9[_0x51d65a('0x49')][_0x51d65a('0x16')])),_0x180c73[_0x51d65a('0x94')]=_0x180c73[_0x51d65a('0x94')][_0x51d65a('0x8e')]?_0x180c73[_0x51d65a('0x94')]:_0xb6fbf5[_0x51d65a('0x41')],typeof _0x3530b9['query'][_0x51d65a('0x1d')]===_0x51d65a('0x59')&&(_0x180c73[_0x51d65a('0x91')]=qs[_0x51d65a('0x91')](_0x3530b9[_0x51d65a('0x49')][_0x51d65a('0x91')]),_0x180c73['offset']=qs[_0x51d65a('0x60')](_0x3530b9[_0x51d65a('0x49')][_0x51d65a('0x60')])),_0x180c73['order']=qs['sort'](_0x3530b9[_0x51d65a('0x49')][_0x51d65a('0x67')]),_0x180c73[_0x51d65a('0x83')]=qs['filters'](_[_0x51d65a('0x92')](_0x3530b9[_0x51d65a('0x49')],_0xb6fbf5[_0x51d65a('0x6e')])),_0x180c73[_0x51d65a('0x83')][_0x51d65a('0xc')]=_0xbe062c['id'],_0x3530b9[_0x51d65a('0x49')][_0x51d65a('0x39')]&&(_0x180c73['where']=_[_0x51d65a('0x80')](_0x180c73[_0x51d65a('0x83')],{[Op['or']]:_[_0x51d65a('0x75')](_0x180c73[_0x51d65a('0x94')],function(_0x2d51af){const _0x5cd366=_0x51d65a,_0x395c46={};return _0x395c46[_0x2d51af]={[Op[_0x5cd366('0x3b')]]:'%'+_0x3530b9['query'][_0x5cd366('0x39')]+'%'},_0x395c46;})})),_0x180c73=_[_0x51d65a('0x80')]({},_0x180c73,_0x3530b9[_0x51d65a('0x42')]),db[_0x51d65a('0x5f')]['count']({'where':_0x180c73[_0x51d65a('0x83')]})[_0x51d65a('0x27')](function(_0x1aa50f){const _0x1ecd84=_0x51d65a;return _0x2b324b[_0x1ecd84('0x1e')]=_0x1aa50f,_0x3530b9['query'][_0x1ecd84('0x9')]&&(_0x180c73[_0x1ecd84('0x29')]=[{'all':!![]}]),db[_0x1ecd84('0x5f')][_0x1ecd84('0x7e')](_0x180c73);})['then'](function(_0x30d447){return _0x2b324b['rows']=_0x30d447,_0x2b324b;});})['then'](respondWithFilteredResult(_0x47d865,_0x180c73))[_0x44d4e7('0x2c')](handleError(_0x47d865,null));},exports[_0x37a035('0x4e')]=function(_0x2adda6,_0xf4636f){const _0x174777=_0x37a035;let _0x247815={'raw':!![],'where':{}};const _0x290af6={},_0x9491df={'count':0x0,'rows':[]};return db[_0x174777('0x4d')][_0x174777('0x69')]({'where':{'id':_0x2adda6[_0x174777('0x1')]['id']}})[_0x174777('0x27')](handleEntityNotFound(_0xf4636f,null))[_0x174777('0x27')](function(_0x3eb5ab){const _0x2d2732=_0x174777;if(_0x3eb5ab)return _0x290af6[_0x2d2732('0x41')]=_[_0x2d2732('0x52')](db['CmHopperHistory'][_0x2d2732('0x4f')]),_0x290af6[_0x2d2732('0x49')]=_[_0x2d2732('0x52')](_0x2adda6[_0x2d2732('0x49')]),_0x290af6[_0x2d2732('0x6e')]=_['intersection'](_0x290af6[_0x2d2732('0x41')],_0x290af6[_0x2d2732('0x49')]),_0x247815[_0x2d2732('0x94')]=_[_0x2d2732('0x17')](_0x290af6[_0x2d2732('0x41')],qs['fields'](_0x2adda6[_0x2d2732('0x49')][_0x2d2732('0x16')])),_0x247815[_0x2d2732('0x94')]=_0x247815[_0x2d2732('0x94')][_0x2d2732('0x8e')]?_0x247815[_0x2d2732('0x94')]:_0x290af6['model'],typeof _0x2adda6[_0x2d2732('0x49')][_0x2d2732('0x1d')]===_0x2d2732('0x59')&&(_0x247815[_0x2d2732('0x91')]=qs[_0x2d2732('0x91')](_0x2adda6[_0x2d2732('0x49')][_0x2d2732('0x91')]),_0x247815[_0x2d2732('0x60')]=qs['offset'](_0x2adda6[_0x2d2732('0x49')][_0x2d2732('0x60')])),_0x247815[_0x2d2732('0x87')]=qs['sort'](_0x2adda6[_0x2d2732('0x49')][_0x2d2732('0x67')]),_0x247815['where']=qs[_0x2d2732('0x6e')](_[_0x2d2732('0x92')](_0x2adda6[_0x2d2732('0x49')],_0x290af6[_0x2d2732('0x6e')])),_0x247815['where'][_0x2d2732('0xc')]=_0x3eb5ab['id'],_0x2adda6[_0x2d2732('0x49')][_0x2d2732('0x39')]&&(_0x247815[_0x2d2732('0x83')]=_[_0x2d2732('0x80')](_0x247815[_0x2d2732('0x83')],{[Op['or']]:_[_0x2d2732('0x75')](_0x247815[_0x2d2732('0x94')],function(_0x1dc16b){const _0x4a69b9=_0x2d2732,_0x5bd328={};return _0x5bd328[_0x1dc16b]={[Op[_0x4a69b9('0x3b')]]:'%'+_0x2adda6[_0x4a69b9('0x49')][_0x4a69b9('0x39')]+'%'},_0x5bd328;})})),_0x247815=_[_0x2d2732('0x80')]({},_0x247815,_0x2adda6[_0x2d2732('0x42')]),db['CmHopperHistory'][_0x2d2732('0x1e')]({'where':_0x247815['where']})['then'](function(_0x3b2d36){const _0x111a4f=_0x2d2732;return _0x9491df[_0x111a4f('0x1e')]=_0x3b2d36,_0x2adda6[_0x111a4f('0x49')][_0x111a4f('0x9')]&&(_0x247815['include']=[{'all':!![]}]),db['CmHopperHistory'][_0x111a4f('0x7e')](_0x247815);})['then'](function(_0x1013d5){return _0x9491df['rows']=_0x1013d5,_0x9491df;});})['then'](respondWithFilteredResult(_0xf4636f,_0x247815))[_0x174777('0x2c')](handleError(_0xf4636f,null));},exports[_0x37a035('0x32')]=function(_0x4c4e4d,_0x1a4156){const _0xe077a0=_0x37a035;let _0x2a717c={'raw':!![],'where':{}};const _0x394746={},_0x5d9801={'count':0x0,'rows':[]};return db[_0xe077a0('0x4d')][_0xe077a0('0x69')]({'where':{'id':_0x4c4e4d[_0xe077a0('0x1')]['id']}})[_0xe077a0('0x27')](handleEntityNotFound(_0x1a4156,null))[_0xe077a0('0x27')](function(_0x1cc4de){const _0x1ca64a=_0xe077a0;if(_0x1cc4de)return _0x394746['model']=_[_0x1ca64a('0x52')](db['CmHopperFinal'][_0x1ca64a('0x4f')]),_0x394746[_0x1ca64a('0x49')]=_[_0x1ca64a('0x52')](_0x4c4e4d['query']),_0x394746['filters']=_[_0x1ca64a('0x17')](_0x394746[_0x1ca64a('0x41')],_0x394746['query']),_0x2a717c[_0x1ca64a('0x94')]=_[_0x1ca64a('0x17')](_0x394746[_0x1ca64a('0x41')],qs['fields'](_0x4c4e4d[_0x1ca64a('0x49')][_0x1ca64a('0x16')])),_0x2a717c['attributes']=_0x2a717c[_0x1ca64a('0x94')]['length']?_0x2a717c[_0x1ca64a('0x94')]:_0x394746[_0x1ca64a('0x41')],typeof _0x4c4e4d[_0x1ca64a('0x49')][_0x1ca64a('0x1d')]===_0x1ca64a('0x59')&&(_0x2a717c[_0x1ca64a('0x91')]=qs['limit'](_0x4c4e4d[_0x1ca64a('0x49')][_0x1ca64a('0x91')]),_0x2a717c[_0x1ca64a('0x60')]=qs['offset'](_0x4c4e4d[_0x1ca64a('0x49')][_0x1ca64a('0x60')])),_0x2a717c[_0x1ca64a('0x87')]=qs[_0x1ca64a('0x67')](_0x4c4e4d['query'][_0x1ca64a('0x67')]),_0x2a717c['where']=qs['filters'](_[_0x1ca64a('0x92')](_0x4c4e4d[_0x1ca64a('0x49')],_0x394746['filters'])),_0x2a717c['where']['VoiceQueueId']=_0x1cc4de['id'],_0x4c4e4d[_0x1ca64a('0x49')][_0x1ca64a('0x39')]&&(_0x2a717c[_0x1ca64a('0x83')]=_[_0x1ca64a('0x80')](_0x2a717c[_0x1ca64a('0x83')],{[Op['or']]:_[_0x1ca64a('0x75')](_0x2a717c[_0x1ca64a('0x94')],function(_0x510e68){const _0x289343=_0x1ca64a,_0x181708={};return _0x181708[_0x510e68]={[Op[_0x289343('0x3b')]]:'%'+_0x4c4e4d['query']['filter']+'%'},_0x181708;})})),_0x2a717c=_[_0x1ca64a('0x80')]({},_0x2a717c,_0x4c4e4d[_0x1ca64a('0x42')]),db[_0x1ca64a('0x8f')]['count']({'where':_0x2a717c[_0x1ca64a('0x83')]})[_0x1ca64a('0x27')](function(_0x4cd7a6){const _0x19bc93=_0x1ca64a;return _0x5d9801[_0x19bc93('0x1e')]=_0x4cd7a6,_0x4c4e4d[_0x19bc93('0x49')][_0x19bc93('0x9')]&&(_0x2a717c[_0x19bc93('0x29')]=[{'all':!![]}]),db['CmHopperFinal']['findAll'](_0x2a717c);})['then'](function(_0x2523f3){return _0x5d9801['rows']=_0x2523f3,_0x5d9801;});})[_0xe077a0('0x27')](respondWithFilteredResult(_0x1a4156,_0x2a717c))[_0xe077a0('0x2c')](handleError(_0x1a4156,null));},exports[_0x37a035('0x3d')]=function(_0x37e132,_0x22fb2b){const _0x379215=_0x37a035;let _0x148940={'raw':!![],'where':{}};const _0x56b69a={},_0xe870f4={'count':0x0,'rows':[]};return db[_0x379215('0x4d')]['findOne']({'where':{'id':_0x37e132[_0x379215('0x1')]['id']}})[_0x379215('0x27')](handleEntityNotFound(_0x22fb2b,null))['then'](function(_0x232c6e){const _0x64a66e=_0x379215;if(_0x232c6e)return _0x56b69a['model']=_[_0x64a66e('0x52')](db[_0x64a66e('0x74')][_0x64a66e('0x4f')]),_0x56b69a[_0x64a66e('0x49')]=_['keys'](_0x37e132[_0x64a66e('0x49')]),_0x56b69a[_0x64a66e('0x6e')]=_[_0x64a66e('0x17')](_0x56b69a[_0x64a66e('0x41')],_0x56b69a[_0x64a66e('0x49')]),_0x148940[_0x64a66e('0x94')]=_[_0x64a66e('0x17')](_0x56b69a[_0x64a66e('0x41')],qs[_0x64a66e('0x16')](_0x37e132[_0x64a66e('0x49')]['fields'])),_0x148940[_0x64a66e('0x94')]=_0x148940[_0x64a66e('0x94')]['length']?_0x148940['attributes']:_0x56b69a[_0x64a66e('0x41')],typeof _0x37e132['query']['nolimit']==='undefined'&&(_0x148940['limit']=qs[_0x64a66e('0x91')](_0x37e132['query'][_0x64a66e('0x91')]),_0x148940[_0x64a66e('0x60')]=qs[_0x64a66e('0x60')](_0x37e132[_0x64a66e('0x49')][_0x64a66e('0x60')])),_0x148940['order']=qs['sort'](_0x37e132[_0x64a66e('0x49')][_0x64a66e('0x67')]),_0x148940[_0x64a66e('0x83')]=qs['filters'](_[_0x64a66e('0x92')](_0x37e132['query'],_0x56b69a[_0x64a66e('0x6e')])),_0x148940['where'][_0x64a66e('0xc')]=_0x232c6e['id'],_0x37e132[_0x64a66e('0x49')][_0x64a66e('0x39')]&&(_0x148940[_0x64a66e('0x83')]=_[_0x64a66e('0x80')](_0x148940[_0x64a66e('0x83')],{[Op['or']]:_['map'](_0x148940[_0x64a66e('0x94')],function(_0x3801cd){const _0x293435=_0x64a66e,_0x11fe2f={};return _0x11fe2f[_0x3801cd]={[Op['like']]:'%'+_0x37e132[_0x293435('0x49')][_0x293435('0x39')]+'%'},_0x11fe2f;})})),_0x148940=_[_0x64a66e('0x80')]({},_0x148940,_0x37e132['options']),db[_0x64a66e('0x74')][_0x64a66e('0x1e')]({'where':_0x148940[_0x64a66e('0x83')]})[_0x64a66e('0x27')](function(_0x5f5730){const _0x545f9e=_0x64a66e;return _0xe870f4[_0x545f9e('0x1e')]=_0x5f5730,_0x37e132[_0x545f9e('0x49')]['includeAll']&&(_0x148940['include']=[{'all':!![]}]),db['CmHopperBlack'][_0x545f9e('0x7e')](_0x148940);})['then'](function(_0x198bed){return _0xe870f4['rows']=_0x198bed,_0xe870f4;});})[_0x379215('0x27')](respondWithFilteredResult(_0x22fb2b,_0x148940))[_0x379215('0x2c')](handleError(_0x22fb2b,null));},exports['getTeams']=function(_0x114f5a,_0x1f594d){const _0x23fa38=_0x37a035;let _0x1d6c0f={};const _0x19080b={};let _0x4f3202,_0x5d44c1;return db['VoiceQueue'][_0x23fa38('0x69')]({'where':{'id':_0x114f5a[_0x23fa38('0x1')]['id']}})[_0x23fa38('0x27')](handleEntityNotFound(_0x1f594d,null))['then'](function(_0x473568){const _0x41f44e=_0x23fa38;if(_0x473568)return _0x4f3202=_0x473568,_0x19080b['model']=_['keys'](db['Team'][_0x41f44e('0x4f')]),_0x19080b[_0x41f44e('0x49')]=_[_0x41f44e('0x52')](_0x114f5a[_0x41f44e('0x49')]),_0x19080b[_0x41f44e('0x6e')]=_[_0x41f44e('0x17')](_0x19080b['model'],_0x19080b[_0x41f44e('0x49')]),_0x1d6c0f['attributes']=_[_0x41f44e('0x17')](_0x19080b[_0x41f44e('0x41')],qs[_0x41f44e('0x16')](_0x114f5a[_0x41f44e('0x49')][_0x41f44e('0x16')])),_0x1d6c0f[_0x41f44e('0x94')]=_0x1d6c0f[_0x41f44e('0x94')][_0x41f44e('0x8e')]?_0x1d6c0f[_0x41f44e('0x94')]:_0x19080b[_0x41f44e('0x41')],_0x1d6c0f[_0x41f44e('0x87')]=qs['sort'](_0x114f5a[_0x41f44e('0x49')]['sort']),_0x1d6c0f['where']=qs[_0x41f44e('0x6e')](_[_0x41f44e('0x92')](_0x114f5a[_0x41f44e('0x49')],_0x19080b[_0x41f44e('0x6e')])),_0x114f5a['query'][_0x41f44e('0x39')]&&(_0x1d6c0f['where']=_[_0x41f44e('0x80')](_0x1d6c0f[_0x41f44e('0x83')],{[Op['or']]:_[_0x41f44e('0x75')](_0x1d6c0f[_0x41f44e('0x94')],function(_0x5aaa9e){const _0xeb6e42=_0x41f44e,_0x3fb8ce={};return _0x3fb8ce[_0x5aaa9e]={[Op[_0xeb6e42('0x3b')]]:'%'+_0x114f5a[_0xeb6e42('0x49')][_0xeb6e42('0x39')]+'%'},_0x3fb8ce;})})),_0x1d6c0f=_[_0x41f44e('0x80')]({},_0x1d6c0f,_0x114f5a['options']),_0x4f3202[_0x41f44e('0x1b')](_0x1d6c0f);})[_0x23fa38('0x27')](function(_0x15993d){const _0xcdb8ea=_0x23fa38;if(_0x15993d)return _0x5d44c1=_0x15993d[_0xcdb8ea('0x8e')],typeof _0x114f5a[_0xcdb8ea('0x49')][_0xcdb8ea('0x1d')]===_0xcdb8ea('0x59')&&(_0x1d6c0f[_0xcdb8ea('0x91')]=qs['limit'](_0x114f5a['query'][_0xcdb8ea('0x91')]),_0x1d6c0f['offset']=qs[_0xcdb8ea('0x60')](_0x114f5a[_0xcdb8ea('0x49')]['offset'])),_0x4f3202['getTeams'](_0x1d6c0f);})[_0x23fa38('0x27')](function(_0x844289){if(_0x844289)return _0x844289?{'count':_0x5d44c1,'rows':_0x844289}:null;})[_0x23fa38('0x27')](respondWithResult(_0x1f594d,null))[_0x23fa38('0x2c')](handleError(_0x1f594d,null));},exports['addTeams']=function(_0x2074d2,_0x530948){const _0xc6a039=_0x37a035,_0x5cf9f0=_0x2074d2[_0xc6a039('0x35')][_0xc6a039('0x9d')],_0x5a7f16=_[_0xc6a039('0x75')](_0x5cf9f0,'id');return db[_0xc6a039('0x3c')][_0xc6a039('0x7e')]({'where':{'id':_0x5a7f16},'attributes':['id'],'include':[{'model':db[_0xc6a039('0x15')],'as':'Agents','attributes':['id',_0xc6a039('0x48'),'online',_0xc6a039('0x31'),_0xc6a039('0x21')],'raw':!![]}]})[_0xc6a039('0x27')](function(_0xa90e3f){const _0x494788=_0xc6a039;if(_0xa90e3f){const _0x13ea0f=_[_0x494788('0x26')](_0xa90e3f,function(_0x4d6349){const _0x455d22=_0x494788,_0x1a927b=_0x4d6349[_0x455d22('0x7')]({'plain':!![]});return _0x1a927b[_0x455d22('0x3a')][_0x455d22('0x2a')](function(_0x4987a0){const _0x488bb4=_0x455d22;_0x4987a0[_0x488bb4('0x38')]=_[_0x488bb4('0x58')](_0x5cf9f0,{'id':_0x1a927b['id']})[_0x488bb4('0x38')];}),_0x1a927b['Agents'];});return db[_0x494788('0x4d')]['findOne']({'where':{'id':_0x2074d2[_0x494788('0x1')]['id']}})['then'](function(_0x4b0535){const _0x1360d5=_0x494788;return db[_0x1360d5('0x3')][_0x1360d5('0x9b')](function(_0xa53e5d){const _0x4512a8=_0x1360d5;return _0x4b0535[_0x4512a8('0x9f')](_0x5a7f16,{'transaction':_0xa53e5d})[_0x4512a8('0x27')](function(){const _0x22a821=_0x4512a8;return Promise[_0x22a821('0x28')](_0x13ea0f,function(_0x3d8328){const _0x53088f=_0x22a821;return db[_0x53088f('0x13')]['findOrCreate']({'where':{'UserId':_0x3d8328['id'],'VoiceQueueId':_0x2074d2['params']['id']},'defaults':{'penalty':_0x3d8328[_0x53088f('0x38')]},'transaction':_0xa53e5d});});})[_0x4512a8('0x27')](function(){const _0x310f14=_0x4512a8;return Promise[_0x310f14('0x28')](_[_0x310f14('0x39')](_0x13ea0f,{'online':!![]}),function(_0x309eb7){const _0x7b3f18=_0x310f14;return db[_0x7b3f18('0x70')][_0x7b3f18('0x68')]({'membername':_0x309eb7[_0x7b3f18('0x48')],'UserId':_0x309eb7['id'],'queue_name':_0x4b0535[_0x7b3f18('0x48')],'VoiceQueueId':_0x4b0535['id'],'interface':_[_0x7b3f18('0x99')](_0x309eb7[_0x7b3f18('0x21')])?util['format'](_0x7b3f18('0x9a'),_0x309eb7[_0x7b3f18('0x48')]):_0x309eb7[_0x7b3f18('0x21')],'paused':_0x309eb7[_0x7b3f18('0x31')]||![],'penalty':_0x309eb7['penalty']},{'transaction':_0xa53e5d});});})[_0x4512a8('0x27')](function(){const _0x14c349=_0x4512a8;_0x13ea0f[_0x14c349('0x2a')](function(_0x4aea61){const _0x3c3b04=_0x14c349;socket['emit'](_0x3c3b04('0x36'),{'UserId':_0x4aea61['id'],'VoiceQueueId':_0x4b0535['id']});});});});});}})[_0xc6a039('0x27')](respondWithStatusCode(_0x530948,null))[_0xc6a039('0x2c')](handleError(_0x530948,null));},exports[_0x37a035('0x88')]=function(_0x27a247,_0x5afd27){const _0x118e6b=_0x37a035;return db[_0x118e6b('0x3c')][_0x118e6b('0x7e')]({'where':{'id':_0x27a247[_0x118e6b('0x49')]['ids']},'attributes':['id'],'include':[{'model':db[_0x118e6b('0x15')],'as':_0x118e6b('0x3a'),'attributes':['id'],'raw':!![]}]})[_0x118e6b('0x27')](handleEntityNotFound(_0x5afd27,null))['then'](function(_0x2c612b){const _0xce3061=_0x118e6b,_0x366fe3=_[_0xce3061('0x75')](_0x2c612b,'id');let _0x30a675=[];const _0x311038=[],_0x395d78=squel['select']();_0x395d78[_0xce3061('0x81')](_0xce3061('0x8b'))[_0xce3061('0x4')](_0xce3061('0x4a'),'tq')[_0xce3061('0x1a')]('user_has_teams','ut',_0xce3061('0x6f'))[_0xce3061('0x83')](_0xce3061('0x6'),_0x27a247[_0xce3061('0x1')]['id']);for(let _0x54ba27=0x0;_0x54ba27<_0x2c612b[_0xce3061('0x8e')];_0x54ba27+=0x1){const _0x3aea07=_0x2c612b[_0x54ba27];for(let _0xdd27=0x0;_0xdd27<_0x3aea07[_0xce3061('0x3a')][_0xce3061('0x8e')];_0xdd27+=0x1){const _0x23099c=_0x3aea07[_0xce3061('0x3a')][_0xdd27],_0x28291e=_0x395d78['clone']();_0x28291e[_0xce3061('0x83')](_0xce3061('0x86'),_0x23099c['id']),_0x311038[_0xce3061('0x84')](db['sequelize'][_0xce3061('0x49')](_0x28291e[_0xce3061('0x8a')](),{'type':QueryTypes[_0xce3061('0x66')]})['then'](function(_0x3c513b){const _0x2cc15a=_0xce3061;if(_0x3c513b[_0x2cc15a('0x8e')]===0x1)return _0x23099c['id'];else{const _0x183a76=_[_0x2cc15a('0x85')](_[_0x2cc15a('0x75')](_0x3c513b,_0x2cc15a('0x37')),function(_0x2ca3e9){const _0x54ee91=_0x2cc15a;return _[_0x54ee91('0x8d')](_0x366fe3,_0x2ca3e9);});if(_0x183a76)return _0x23099c['id'];}}));}}return Promise[_0xce3061('0x6b')](_0x311038)[_0xce3061('0x27')](function(_0x1a9af3){const _0x3e5324=_0xce3061;return _0x30a675=_(_0x30a675)[_0x3e5324('0x3f')](_0x1a9af3)[_0x3e5324('0x71')]()['value'](),db['VoiceQueue'][_0x3e5324('0x69')]({'where':{'id':_0x27a247[_0x3e5324('0x1')]['id']}})[_0x3e5324('0x27')](function(_0x44b041){const _0x4f6507=_0x3e5324;return db[_0x4f6507('0x3')][_0x4f6507('0x9b')](function(_0x5b94b9){const _0xb6afff=_0x4f6507;return _0x44b041[_0xb6afff('0x88')](_0x27a247[_0xb6afff('0x49')][_0xb6afff('0x8c')],{'transaction':_0x5b94b9})[_0xb6afff('0x27')](function(){const _0x19cb4c=_0xb6afff;if(!_['isEmpty'](_0x30a675))return _0x44b041[_0x19cb4c('0x5d')](_0x30a675,{'transaction':_0x5b94b9})[_0x19cb4c('0x27')](function(){const _0x701321=_0x19cb4c;return db[_0x701321('0x70')]['destroy']({'where':{'VoiceQueueId':_0x27a247['params']['id'],'UserId':_0x30a675},'transaction':_0x5b94b9});});})[_0xb6afff('0x27')](function(){const _0x245a34=_0xb6afff;_0x30a675[_0x245a34('0x2a')](function(_0x3802bc){const _0x3dc881=_0x245a34;socket['emit'](_0x3dc881('0x3e'),{'UserId':_0x3802bc,'VoiceQueueId':_0x44b041['id']});});});});});});})[_0x118e6b('0x27')](respondWithStatusCode(_0x5afd27,null))['catch'](handleError(_0x5afd27,null));},exports[_0x37a035('0x2b')]=function(_0x840d36,_0x553cf9){const _0x1e5a32=_0x37a035;let _0x5485b5,_0x1634ef;return db[_0x1e5a32('0x4d')][_0x1e5a32('0x69')]({'where':{'id':_0x840d36['params']['id']}})[_0x1e5a32('0x27')](function(_0x5b10ed){const _0x29419f=_0x1e5a32;if(_0x5b10ed)return _0x1634ef=_0x5b10ed,_0x5b10ed[_0x29419f('0x2b')](_0x840d36[_0x29419f('0x35')][_0x29419f('0x8c')],{'through':_[_0x29419f('0x2f')](_0x840d36[_0x29419f('0x35')],['ids','id'])})[_0x29419f('0x27')](function(_0x31fd9c){const _0x49f154=_0x29419f;for(let _0x3b8f48=0x0;_0x3b8f48<_0x840d36[_0x49f154('0x35')][_0x49f154('0x8c')]['length'];_0x3b8f48+=0x1){socket[_0x49f154('0x6c')](_0x49f154('0x36'),{'UserId':_0x840d36[_0x49f154('0x35')][_0x49f154('0x8c')][_0x3b8f48],'VoiceQueueId':_0x840d36[_0x49f154('0x1')]['id']});}return _0x31fd9c;});})[_0x1e5a32('0x27')](function(_0x22d86d){const _0x4652b4=_0x1e5a32;_0x5485b5=_0x22d86d||[];if(_0x1634ef)return db[_0x4652b4('0x15')][_0x4652b4('0x7e')]({'where':{'id':_0x840d36[_0x4652b4('0x35')][_0x4652b4('0x8c')]},'attributes':['id',_0x4652b4('0x48'),_0x4652b4('0x14'),'voicePause','interface'],'raw':!![]});})[_0x1e5a32('0x27')](function(_0x40f792){const _0x5543a6=_0x1e5a32;if(!_[_0x5543a6('0x73')](_0x40f792)){const _0x3a29a0=[];for(let _0x4ba7ce=0x0;_0x4ba7ce<_0x40f792[_0x5543a6('0x8e')];_0x4ba7ce++){_0x40f792[_0x4ba7ce][_0x5543a6('0x14')]&&_0x3a29a0[_0x5543a6('0x84')](db[_0x5543a6('0x70')]['upsert']({'membername':_0x40f792[_0x4ba7ce][_0x5543a6('0x48')],'UserId':_0x40f792[_0x4ba7ce]['id'],'queue_name':_0x1634ef['name'],'VoiceQueueId':_0x1634ef['id'],'interface':_[_0x5543a6('0x99')](_0x40f792[_0x4ba7ce][_0x5543a6('0x21')])?util[_0x5543a6('0x10')](_0x5543a6('0x9a'),_0x40f792[_0x4ba7ce][_0x5543a6('0x48')]):_0x40f792[_0x4ba7ce][_0x5543a6('0x21')],'paused':_0x40f792[_0x4ba7ce][_0x5543a6('0x31')]||![],'penalty':_0x840d36[_0x5543a6('0x35')][_0x5543a6('0x38')]||0x0}));}return Promise[_0x5543a6('0x6b')](_0x3a29a0);}})[_0x1e5a32('0x27')](function(){return _0x5485b5;})[_0x1e5a32('0x27')](respondWithResult(_0x553cf9,null))[_0x1e5a32('0x2c')](handleError(_0x553cf9,null));},exports[_0x37a035('0x5d')]=function(_0x235417,_0x1ef6df){const _0x1703de=_0x37a035;return db[_0x1703de('0x4d')]['findOne']({'where':{'id':_0x235417[_0x1703de('0x1')]['id']}})['then'](handleEntityNotFound(_0x1ef6df,null))[_0x1703de('0x27')](function(_0x10cec1){const _0x54c56f=_0x1703de;if(_0x10cec1)return _0x10cec1[_0x54c56f('0x5d')](_0x235417[_0x54c56f('0x49')][_0x54c56f('0x8c')])[_0x54c56f('0x27')](function(){const _0x3333b9=_0x54c56f;if(_['isArray'](_0x235417[_0x3333b9('0x49')][_0x3333b9('0x8c')]))for(let _0xe5ba93=0x0;_0xe5ba93<_0x235417['query']['ids'][_0x3333b9('0x8e')];_0xe5ba93+=0x1){socket[_0x3333b9('0x6c')](_0x3333b9('0x3e'),{'UserId':Number(_0x235417['query'][_0x3333b9('0x8c')][_0xe5ba93]),'VoiceQueueId':Number(_0x235417[_0x3333b9('0x1')]['id'])});}else socket[_0x3333b9('0x6c')](_0x3333b9('0x3e'),{'UserId':Number(_0x235417[_0x3333b9('0x49')][_0x3333b9('0x8c')]),'VoiceQueueId':Number(_0x235417[_0x3333b9('0x1')]['id'])});});})['then'](function(_0x2673d0){const _0x239eae=_0x1703de;return db[_0x239eae('0x70')]['destroy']({'where':{'VoiceQueueId':_0x235417[_0x239eae('0x1')]['id'],'UserId':_0x235417['query']['ids']}})[_0x239eae('0x27')](function(){return _0x2673d0;});})['then'](respondWithStatusCode(_0x1ef6df,null))[_0x1703de('0x2c')](handleError(_0x1ef6df,null));},exports[_0x37a035('0x6a')]=function(_0x394a75,_0x29cba0){const _0xd35527=_0x37a035;let _0x5f1d5a={};const _0x364727={};let _0x229d38,_0x3734b2;return db['VoiceQueue'][_0xd35527('0x69')]({'where':{'id':_0x394a75['params']['id']}})[_0xd35527('0x27')](handleEntityNotFound(_0x29cba0,null))[_0xd35527('0x27')](function(_0x1e074c){const _0x3dca86=_0xd35527;if(_0x1e074c)return _0x229d38=_0x1e074c,_0x364727[_0x3dca86('0x41')]=_[_0x3dca86('0x52')](db[_0x3dca86('0x15')][_0x3dca86('0x4f')]),_0x364727[_0x3dca86('0x49')]=_[_0x3dca86('0x52')](_0x394a75[_0x3dca86('0x49')]),_0x364727[_0x3dca86('0x6e')]=_['intersection'](_0x364727[_0x3dca86('0x41')],_0x364727[_0x3dca86('0x49')]),_0x5f1d5a[_0x3dca86('0x94')]=_[_0x3dca86('0x17')](_0x364727[_0x3dca86('0x41')],qs['fields'](_0x394a75[_0x3dca86('0x49')][_0x3dca86('0x16')])),_0x5f1d5a[_0x3dca86('0x94')]=_0x5f1d5a[_0x3dca86('0x94')]['length']?_0x5f1d5a[_0x3dca86('0x94')]:_0x364727[_0x3dca86('0x41')],_0x5f1d5a[_0x3dca86('0x87')]=qs[_0x3dca86('0x67')](_0x394a75[_0x3dca86('0x49')][_0x3dca86('0x67')]),_0x5f1d5a['where']=qs[_0x3dca86('0x6e')](_['pick'](_0x394a75[_0x3dca86('0x49')],_0x364727['filters'])),_0x394a75[_0x3dca86('0x49')]['filter']&&(_0x5f1d5a[_0x3dca86('0x83')]=_['merge'](_0x5f1d5a[_0x3dca86('0x83')],{[Op['or']]:_[_0x3dca86('0x75')](_0x5f1d5a[_0x3dca86('0x94')],function(_0x169618){const _0x3a1a15=_0x3dca86,_0x16601c={};return _0x16601c[_0x169618]={[Op[_0x3a1a15('0x3b')]]:'%'+_0x394a75['query'][_0x3a1a15('0x39')]+'%'},_0x16601c;})})),_0x5f1d5a=_[_0x3dca86('0x80')]({},_0x5f1d5a,_0x394a75[_0x3dca86('0x42')]),_0x229d38[_0x3dca86('0x6a')](_0x5f1d5a);})['then'](function(_0x12a33b){const _0x4b0089=_0xd35527;if(_0x12a33b)return _0x3734b2=_0x12a33b[_0x4b0089('0x8e')],typeof _0x394a75[_0x4b0089('0x49')][_0x4b0089('0x1d')]==='undefined'&&(_0x5f1d5a[_0x4b0089('0x91')]=qs[_0x4b0089('0x91')](_0x394a75[_0x4b0089('0x49')][_0x4b0089('0x91')]),_0x5f1d5a['offset']=qs['offset'](_0x394a75[_0x4b0089('0x49')][_0x4b0089('0x60')])),_0x229d38['getAgents'](_0x5f1d5a);})[_0xd35527('0x27')](function(_0x245372){if(_0x245372)return _0x245372?{'count':_0x3734b2,'rows':_0x245372}:null;})[_0xd35527('0x27')](respondWithResult(_0x29cba0,null))[_0xd35527('0x2c')](handleError(_0x29cba0,null));},exports[_0x37a035('0x77')]=function(_0x3555db,_0x268361){const _0x234120=_0x37a035;let _0x4f02d0={};const _0x14677e={};let _0x31812a,_0x3265e2;return db[_0x234120('0x4d')]['findOne']({'where':{'id':_0x3555db[_0x234120('0x1')]['id']}})[_0x234120('0x27')](handleEntityNotFound(_0x268361,null))['then'](function(_0x4799a5){const _0x53bd90=_0x234120;if(_0x4799a5)return _0x31812a=_0x4799a5,_0x14677e[_0x53bd90('0x41')]=_[_0x53bd90('0x52')](db[_0x53bd90('0x70')][_0x53bd90('0x4f')]),_0x14677e['query']=_['keys'](_0x3555db[_0x53bd90('0x49')]),_0x14677e[_0x53bd90('0x6e')]=_[_0x53bd90('0x17')](_0x14677e[_0x53bd90('0x41')],_0x14677e[_0x53bd90('0x49')]),_0x4f02d0[_0x53bd90('0x94')]=_[_0x53bd90('0x17')](_0x14677e[_0x53bd90('0x41')],qs[_0x53bd90('0x16')](_0x3555db[_0x53bd90('0x49')][_0x53bd90('0x16')])),_0x4f02d0[_0x53bd90('0x94')]=_0x4f02d0[_0x53bd90('0x94')][_0x53bd90('0x8e')]?_0x4f02d0[_0x53bd90('0x94')]:_0x14677e['model'],_0x4f02d0[_0x53bd90('0x87')]=qs[_0x53bd90('0x67')](_0x3555db[_0x53bd90('0x49')]['sort']),_0x4f02d0[_0x53bd90('0x83')]=qs['filters'](_[_0x53bd90('0x92')](_0x3555db[_0x53bd90('0x49')],_0x14677e['filters'])),_0x3555db[_0x53bd90('0x49')]['filter']&&(_0x4f02d0[_0x53bd90('0x83')]=_['merge'](_0x4f02d0['where'],{[Op['or']]:_[_0x53bd90('0x75')](_0x4f02d0[_0x53bd90('0x94')],function(_0x5f75c6){const _0x3ae263=_0x53bd90,_0x377bb5={};return _0x377bb5[_0x5f75c6]={[Op[_0x3ae263('0x3b')]]:'%'+_0x3555db[_0x3ae263('0x49')][_0x3ae263('0x39')]+'%'},_0x377bb5;})})),_0x4f02d0=_[_0x53bd90('0x80')]({},_0x4f02d0,_0x3555db[_0x53bd90('0x42')]),_0x31812a['getMembers'](_0x4f02d0);})[_0x234120('0x27')](function(_0x2d3b0e){const _0x310d0f=_0x234120;if(_0x2d3b0e)return _0x3265e2=_0x2d3b0e[_0x310d0f('0x8e')],typeof _0x3555db[_0x310d0f('0x49')]['nolimit']==='undefined'&&(_0x4f02d0[_0x310d0f('0x91')]=qs[_0x310d0f('0x91')](_0x3555db[_0x310d0f('0x49')][_0x310d0f('0x91')]),_0x4f02d0[_0x310d0f('0x60')]=qs[_0x310d0f('0x60')](_0x3555db[_0x310d0f('0x49')][_0x310d0f('0x60')])),_0x31812a[_0x310d0f('0x77')](_0x4f02d0);})[_0x234120('0x27')](function(_0x2c3a45){return _0x2c3a45?{'count':_0x3265e2,'rows':_0x2c3a45}:null;})['then'](respondWithResult(_0x268361,null))['catch'](handleError(_0x268361,null));},exports[_0x37a035('0x57')]=function(_0x179b83,_0xc8e014){const _0x247b54=_0x37a035;let _0x23a247={};const _0x144429={};let _0x5d014e,_0x4883a5;return db[_0x247b54('0x4d')][_0x247b54('0x69')]({'where':{'id':_0x179b83[_0x247b54('0x1')]['id']}})['then'](handleEntityNotFound(_0xc8e014,null))[_0x247b54('0x27')](function(_0x58a3e0){const _0x5752ba=_0x247b54;if(_0x58a3e0)return _0x5d014e=_0x58a3e0,_0x144429[_0x5752ba('0x41')]=_[_0x5752ba('0x52')](db[_0x5752ba('0xb')][_0x5752ba('0x4f')]),_0x144429['query']=_[_0x5752ba('0x52')](_0x179b83[_0x5752ba('0x49')]),_0x144429[_0x5752ba('0x6e')]=_['intersection'](_0x144429[_0x5752ba('0x41')],_0x144429[_0x5752ba('0x49')]),_0x23a247[_0x5752ba('0x94')]=_[_0x5752ba('0x17')](_0x144429['model'],qs[_0x5752ba('0x16')](_0x179b83[_0x5752ba('0x49')]['fields'])),_0x23a247['attributes']=_0x23a247[_0x5752ba('0x94')][_0x5752ba('0x8e')]?_0x23a247[_0x5752ba('0x94')]:_0x144429[_0x5752ba('0x41')],_0x23a247[_0x5752ba('0x87')]=qs[_0x5752ba('0x67')](_0x179b83[_0x5752ba('0x49')][_0x5752ba('0x67')]),_0x23a247[_0x5752ba('0x83')]=qs[_0x5752ba('0x6e')](_['pick'](_0x179b83[_0x5752ba('0x49')],_0x144429['filters'])),_0x179b83[_0x5752ba('0x49')][_0x5752ba('0x39')]&&(_0x23a247['where']=_['merge'](_0x23a247['where'],{[Op['or']]:_[_0x5752ba('0x75')](_0x23a247[_0x5752ba('0x94')],function(_0x407dd0){const _0x39f76f=_0x5752ba,_0x5e4eda={};return _0x5e4eda[_0x407dd0]={[Op[_0x39f76f('0x3b')]]:'%'+_0x179b83[_0x39f76f('0x49')]['filter']+'%'},_0x5e4eda;})})),_0x23a247=_[_0x5752ba('0x80')]({},_0x23a247,_0x179b83[_0x5752ba('0x42')]),_0x5d014e['getLists'](_0x23a247);})[_0x247b54('0x27')](function(_0x4ce6b8){const _0x3c9508=_0x247b54;if(_0x4ce6b8)return _0x4883a5=_0x4ce6b8[_0x3c9508('0x8e')],typeof _0x179b83[_0x3c9508('0x49')][_0x3c9508('0x1d')]===_0x3c9508('0x59')&&(_0x23a247['limit']=qs['limit'](_0x179b83['query'][_0x3c9508('0x91')]),_0x23a247[_0x3c9508('0x60')]=qs[_0x3c9508('0x60')](_0x179b83[_0x3c9508('0x49')][_0x3c9508('0x60')])),_0x5d014e[_0x3c9508('0x57')](_0x23a247);})[_0x247b54('0x27')](function(_0x402230){if(_0x402230)return _0x402230?{'count':_0x4883a5,'rows':_0x402230}:null;})['then'](respondWithResult(_0xc8e014,null))['catch'](handleError(_0xc8e014,null));},exports[_0x37a035('0x50')]=function(_0x144539,_0x50e043){const _0x1bd4c2=_0x37a035;let _0x103728,_0x40e850;return db['VoiceQueue']['findOne']({'where':{'id':_0x144539['params']['id']}})[_0x1bd4c2('0x27')](handleEntityNotFound(_0x50e043,null))[_0x1bd4c2('0x27')](function(_0xd9a287){const _0x306869=_0x1bd4c2;if(_0xd9a287)return _0x40e850=_0xd9a287,_0xd9a287[_0x306869('0x50')](_0x144539[_0x306869('0x35')][_0x306869('0x8c')],{'through':_[_0x306869('0x2f')](_0x144539['body'],[_0x306869('0x8c'),'id'])});return null;})['then'](function(_0xee053a){const _0x37ea97=_0x1bd4c2;let _0x2d9b65;_0x103728=_0xee053a||[];const _0x595c89=[];if(_0xee053a){for(let _0x31b880=0x0;_0x31b880<_0xee053a[_0x37ea97('0x8e')];_0x31b880+=0x1){const _0xf62ac5=_0xee053a[_0x31b880][_0x37ea97('0x7')]({'plain':!![]});_0x40e850[_0x37ea97('0x18')]=_0x144539[_0x37ea97('0x35')][_0x37ea97('0x18')]?_0x144539[_0x37ea97('0x35')][_0x37ea97('0x18')]:_0x40e850[_0x37ea97('0x18')];switch(_0x40e850[_0x37ea97('0x18')]){case _0x37ea97('0x82'):_0x2d9b65=squel[_0x37ea97('0xe')]()[_0x37ea97('0x55')](_0x37ea97('0x79'))[_0x37ea97('0x20')]([_0x37ea97('0x7f'),_0x37ea97('0x33'),_0x37ea97('0x2'),_0x37ea97('0x12'),_0x37ea97('0xc'),_0x37ea97('0x63'),_0x37ea97('0x51')],squel[_0x37ea97('0x96')]()['field'](_0x37ea97('0x7f'),_0x37ea97('0x7f'))['field']('NOW()',_0x37ea97('0x33'))['field']('id',_0x37ea97('0x2'))[_0x37ea97('0x81')](_0xf62ac5[_0x37ea97('0x7c')]['toString'](),_0x37ea97('0x12'))[_0x37ea97('0x81')](_0x144539['params']['id'][_0x37ea97('0x8a')](),'VoiceQueueId')[_0x37ea97('0x81')](_0x37ea97('0xa0'),_0x37ea97('0x63'))[_0x37ea97('0x81')](_0x37ea97('0xa0'),'updatedAt')[_0x37ea97('0x4')](_0x37ea97('0x7d'))['where'](_0x37ea97('0x5b'))[_0x37ea97('0x83')](_0x37ea97('0x97'),_0xf62ac5['CmListId'][_0x37ea97('0x8a')]())[_0x37ea97('0x83')](_0x37ea97('0x2d'))[_0x37ea97('0x83')](_0x37ea97('0x22'),squel[_0x37ea97('0x96')]()[_0x37ea97('0x81')](_0x37ea97('0x62'))[_0x37ea97('0x4')]('cm_hopper_final')[_0x37ea97('0x83')](_0x37ea97('0x6'),_0x144539[_0x37ea97('0x1')]['id'][_0x37ea97('0x8a')]()))[_0x37ea97('0x83')]('phone\x20NOT\x20IN\x20(?)',squel[_0x37ea97('0x96')]()[_0x37ea97('0x81')](_0x37ea97('0x44'))[_0x37ea97('0x4')]('cm_hopper')['where'](_0x37ea97('0x6'),_0x144539[_0x37ea97('0x1')]['id']['toString']())))[_0x37ea97('0x8a')]();break;case _0x37ea97('0x95'):_0x2d9b65=squel[_0x37ea97('0xe')]()[_0x37ea97('0x55')](_0x37ea97('0x79'))[_0x37ea97('0x20')](['phone',_0x37ea97('0x33'),_0x37ea97('0x2'),_0x37ea97('0x12'),_0x37ea97('0xc'),_0x37ea97('0x63'),_0x37ea97('0x51')],squel[_0x37ea97('0x96')]()['field'](_0x37ea97('0x7f'),'phone')[_0x37ea97('0x81')](_0x37ea97('0xa0'),'scheduledAt')[_0x37ea97('0x81')]('id',_0x37ea97('0x2'))['field'](_0xf62ac5[_0x37ea97('0x7c')][_0x37ea97('0x8a')](),_0x37ea97('0x12'))['field'](_0x144539['params']['id'][_0x37ea97('0x8a')](),'VoiceQueueId')['field']('NOW()',_0x37ea97('0x63'))[_0x37ea97('0x81')](_0x37ea97('0xa0'),_0x37ea97('0x51'))[_0x37ea97('0x4')](_0x37ea97('0x7d'))[_0x37ea97('0x83')]('deletedAt\x20IS\x20NULL')[_0x37ea97('0x83')]('ListId\x20=\x20?',_0xf62ac5[_0x37ea97('0x7c')]['toString']())[_0x37ea97('0x83')](_0x37ea97('0x2d'))[_0x37ea97('0x83')](_0x37ea97('0x22'),squel[_0x37ea97('0x96')]()[_0x37ea97('0x81')]('COALESCE(phone,\x27\x27)')[_0x37ea97('0x4')](_0x37ea97('0x79'))[_0x37ea97('0x83')](_0x37ea97('0x6'),_0x144539[_0x37ea97('0x1')]['id'][_0x37ea97('0x8a')]())))[_0x37ea97('0x8a')]();break;default:_0x2d9b65=squel['insert']()['into'](_0x37ea97('0x79'))['fromQuery'](['phone',_0x37ea97('0x33'),'ContactId',_0x37ea97('0x12'),_0x37ea97('0xc'),_0x37ea97('0x63'),_0x37ea97('0x51')],squel['select']()[_0x37ea97('0x81')](_0x37ea97('0x7f'),_0x37ea97('0x7f'))[_0x37ea97('0x81')](_0x37ea97('0xa0'),_0x37ea97('0x33'))[_0x37ea97('0x81')]('id',_0x37ea97('0x2'))['field'](_0xf62ac5[_0x37ea97('0x7c')][_0x37ea97('0x8a')](),_0x37ea97('0x12'))[_0x37ea97('0x81')](_0x144539[_0x37ea97('0x1')]['id'][_0x37ea97('0x8a')](),_0x37ea97('0xc'))[_0x37ea97('0x81')](_0x37ea97('0xa0'),_0x37ea97('0x63'))[_0x37ea97('0x81')]('NOW()',_0x37ea97('0x51'))[_0x37ea97('0x4')](_0x37ea97('0x7d'))[_0x37ea97('0x83')](_0x37ea97('0x5b'))['where']('ListId\x20=\x20?',_0xf62ac5[_0x37ea97('0x7c')]['toString']())[_0x37ea97('0x83')](_0x37ea97('0x2d')))[_0x37ea97('0x8a')]();}_0x595c89[_0x37ea97('0x84')](db[_0x37ea97('0x3')]['query'](_0x2d9b65));}return Promise['all'](_0x595c89);}})[_0x1bd4c2('0x27')](function(){return _0x103728;})['then'](respondWithResult(_0x50e043,null))[_0x1bd4c2('0x2c')](handleError(_0x50e043,null));},exports[_0x37a035('0x5c')]=function(_0xccd2c9,_0x5354ac){const _0x1f52f9=_0x37a035;return db['VoiceQueue']['findOne']({'where':{'id':_0xccd2c9['params']['id']}})[_0x1f52f9('0x27')](handleEntityNotFound(_0x5354ac,null))[_0x1f52f9('0x27')](function(_0x288fe8){const _0x3b5ae7=_0x1f52f9;if(_0x288fe8)return _0x288fe8[_0x3b5ae7('0x5c')](_0xccd2c9[_0x3b5ae7('0x49')]['ids']);})[_0x1f52f9('0x27')](function(_0x24b95b){const _0x523056=_0x1f52f9;if(_0x24b95b)return db[_0x523056('0x5f')]['destroy']({'where':{'ListId':_0xccd2c9['query'][_0x523056('0x8c')],'VoiceQueueId':_0xccd2c9[_0x523056('0x1')]['id']}})[_0x523056('0x27')](function(){return _0x24b95b;});})['then'](respondWithStatusCode(_0x5354ac,null))[_0x1f52f9('0x2c')](handleError(_0x5354ac,null));},exports[_0x37a035('0x34')]=function(_0x33b95a,_0xd20beb){const _0x522aa2=_0x37a035;let _0x1b779b={};const _0x1ee97a={};let _0x442ffc,_0xf4ed35;return db[_0x522aa2('0x4d')][_0x522aa2('0x69')]({'where':{'id':_0x33b95a[_0x522aa2('0x1')]['id']}})[_0x522aa2('0x27')](handleEntityNotFound(_0xd20beb,null))['then'](function(_0x242467){const _0x447820=_0x522aa2;if(_0x242467)return _0x442ffc=_0x242467,_0x1ee97a[_0x447820('0x41')]=_[_0x447820('0x52')](db[_0x447820('0xb')][_0x447820('0x4f')]),_0x1ee97a[_0x447820('0x49')]=_[_0x447820('0x52')](_0x33b95a[_0x447820('0x49')]),_0x1ee97a[_0x447820('0x6e')]=_[_0x447820('0x17')](_0x1ee97a[_0x447820('0x41')],_0x1ee97a['query']),_0x1b779b[_0x447820('0x94')]=_['intersection'](_0x1ee97a[_0x447820('0x41')],qs[_0x447820('0x16')](_0x33b95a['query'][_0x447820('0x16')])),_0x1b779b['attributes']=_0x1b779b['attributes'][_0x447820('0x8e')]?_0x1b779b[_0x447820('0x94')]:_0x1ee97a[_0x447820('0x41')],_0x1b779b['order']=qs[_0x447820('0x67')](_0x33b95a['query'][_0x447820('0x67')]),_0x1b779b['where']=qs['filters'](_[_0x447820('0x92')](_0x33b95a[_0x447820('0x49')],_0x1ee97a[_0x447820('0x6e')])),_0x33b95a[_0x447820('0x49')]['filter']&&(_0x1b779b[_0x447820('0x83')]=_[_0x447820('0x80')](_0x1b779b['where'],{[Op['or']]:_[_0x447820('0x75')](_0x1b779b[_0x447820('0x94')],function(_0x376cac){const _0x1445ff=_0x447820,_0x150072={};return _0x150072[_0x376cac]={[Op[_0x1445ff('0x3b')]]:'%'+_0x33b95a[_0x1445ff('0x49')][_0x1445ff('0x39')]+'%'},_0x150072;})})),_0x1b779b=_[_0x447820('0x80')]({},_0x1b779b,_0x33b95a[_0x447820('0x42')]),_0x442ffc[_0x447820('0x34')](_0x1b779b);})[_0x522aa2('0x27')](function(_0x3ed4f1){const _0x3d99f6=_0x522aa2;if(_0x3ed4f1)return _0xf4ed35=_0x3ed4f1['length'],typeof _0x33b95a[_0x3d99f6('0x49')]['nolimit']===_0x3d99f6('0x59')&&(_0x1b779b['limit']=qs['limit'](_0x33b95a[_0x3d99f6('0x49')][_0x3d99f6('0x91')]),_0x1b779b[_0x3d99f6('0x60')]=qs[_0x3d99f6('0x60')](_0x33b95a[_0x3d99f6('0x49')]['offset'])),_0x442ffc[_0x3d99f6('0x34')](_0x1b779b);})[_0x522aa2('0x27')](function(_0x268708){if(_0x268708)return _0x268708?{'count':_0xf4ed35,'rows':_0x268708}:null;})[_0x522aa2('0x27')](respondWithResult(_0xd20beb,null))[_0x522aa2('0x2c')](handleError(_0xd20beb,null));},exports[_0x37a035('0x7b')]=function(_0x37aab0,_0x1cf5fa){const _0xc2b675=_0x37a035;let _0x2013c6;return db[_0xc2b675('0x4d')]['findOne']({'where':{'id':_0x37aab0[_0xc2b675('0x1')]['id']}})[_0xc2b675('0x27')](handleEntityNotFound(_0x1cf5fa,null))[_0xc2b675('0x27')](function(_0x5d7300){const _0x54f454=_0xc2b675;if(_0x5d7300)return _0x5d7300['addBlackLists'](_0x37aab0[_0x54f454('0x35')][_0x54f454('0x8c')],{'through':_[_0x54f454('0x2f')](_0x37aab0[_0x54f454('0x35')],['ids','id'])});return null;})['then'](function(_0x5dafa5){const _0x1522e8=_0xc2b675;let _0x42cab6;_0x2013c6=_0x5dafa5||[];const _0x689ce1=[];if(_0x5dafa5){for(let _0x1efa90=0x0;_0x1efa90<_0x5dafa5['length'];_0x1efa90+=0x1){const _0x1c14b7=_0x5dafa5[_0x1efa90][_0x1522e8('0x7')]({'plain':!![]});_0x42cab6=squel[_0x1522e8('0xe')]()[_0x1522e8('0x55')](_0x1522e8('0x46'))[_0x1522e8('0x20')]([_0x1522e8('0x7f'),_0x1522e8('0x2'),_0x1522e8('0x12'),_0x1522e8('0xc'),_0x1522e8('0x63'),_0x1522e8('0x51')],squel[_0x1522e8('0x96')]()[_0x1522e8('0x81')](_0x1522e8('0x7f'),_0x1522e8('0x7f'))[_0x1522e8('0x81')]('id','ContactId')[_0x1522e8('0x81')](_0x1c14b7[_0x1522e8('0x7c')]['toString'](),_0x1522e8('0x12'))[_0x1522e8('0x81')](_0x37aab0[_0x1522e8('0x1')]['id'][_0x1522e8('0x8a')](),'VoiceQueueId')[_0x1522e8('0x81')](_0x1522e8('0xa0'),'createdAt')[_0x1522e8('0x81')]('NOW()',_0x1522e8('0x51'))[_0x1522e8('0x4')]('cm_contacts')['where'](_0x1522e8('0x5b'))[_0x1522e8('0x83')](_0x1522e8('0x97'),_0x1c14b7['CmListId'][_0x1522e8('0x8a')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1522e8('0x8a')](),_0x689ce1[_0x1522e8('0x84')](db['sequelize'][_0x1522e8('0x49')](_0x42cab6));}return Promise['all'](_0x689ce1);}})['then'](function(){return _0x2013c6;})[_0xc2b675('0x27')](respondWithResult(_0x1cf5fa,null))[_0xc2b675('0x2c')](handleError(_0x1cf5fa,null));},exports[_0x37a035('0x9c')]=function(_0x3c4d64,_0x5d27b5){const _0x58dde0=_0x37a035;return db['VoiceQueue'][_0x58dde0('0x69')]({'where':{'id':_0x3c4d64[_0x58dde0('0x1')]['id']}})[_0x58dde0('0x27')](handleEntityNotFound(_0x5d27b5,null))['then'](function(_0x12a67a){const _0x3b4d33=_0x58dde0;if(_0x12a67a)return _0x12a67a['removeBlackLists'](_0x3c4d64['query'][_0x3b4d33('0x8c')]);})['then'](function(_0x4c2e4e){const _0x371397=_0x58dde0;if(_0x4c2e4e)return db[_0x371397('0x74')][_0x371397('0x25')]({'where':{'ListId':_0x3c4d64[_0x371397('0x49')]['ids'],'VoiceQueueId':_0x3c4d64['params']['id']}})[_0x371397('0x27')](function(){return _0x4c2e4e;});})['then'](respondWithStatusCode(_0x5d27b5,null))[_0x58dde0('0x2c')](handleError(_0x5d27b5,null));};
\ No newline at end of file
+const a753_0x5f00=['include','field','../../config/logger','ut.TeamId\x20=\x20tq.TeamId','create','getTeams','scheduledAt','CmHopperFinal','SIP/%s','../../components/parsers/qs','all','getBlackLists','intersection','cm_hopper','addBlackLists','removeBlackLists','then','updatedAt','VoiceQueues','params','isArray','forEach','voicePause','UserVoiceQueueRt','register','util','CmListId','cm_contacts','from','ut.UserId\x20=\x20?','getAgents','model','type','getMembers','toString','removeAgents','join','api','VoiceQueueId\x20=\x20?','compact','error','addLists','penalty','role','UserProfileResource','COALESCE(calleridnum,\x27\x27)','SELECT','CmHopper','clone','pick','order','destroy','removeLists','show','insert','undefined','QueueCampaigns','CmList','team_has_voice_queues','index','UserVoiceQueue','filter','attributes','ids','query','findAll','CmHopperBlack','map','getLists','fields','update','userProfileId','catch','onlyIfOpen','CmHopperHistory','sort','limit','like','end','outbound','each','userVoiceQueue:save','ignore','where','Content-Range','into','status','name','COALESCE(phone,\x27\x27)','upsert','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','cm_hopper_final','interface','dialCheckDuplicateType','includes','options','userVoiceQueue:remove','VoiceQueueId','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','VIRTUAL','autoAssociation','sequelize','key','emit','addAgents','removeTeams','nolimit','every','keys','online','omit','VoiceQueue','NOW()','rows','./voiceQueue.socket','merge','count','includeAll','get','set','find','json','../../rediscache','UserProfileSection','offset','TeamId','transaction','isEmpty','findOne','select','findOrCreate','lodash','User','rawAttributes','always','fromQuery','format','body','getHopperFinals','sendStatus','phone','ListId\x20=\x20?','send','createdAt','deletedAt\x20IS\x20NULL','ListId','phone\x20IS\x20NOT\x20NULL','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHopperBlacks','length','inbound','ContactId','push','value','fieldName','addTeams','isNil','filters','flatMap','Agents'];(function(_0x1c583,_0x5f00ec){const _0x2208ca=function(_0x1098fa){while(--_0x1098fa){_0x1c583['push'](_0x1c583['shift']());}};_0x2208ca(++_0x5f00ec);}(a753_0x5f00,0x144));const a753_0x2208=function(_0x1c583,_0x5f00ec){_0x1c583=_0x1c583-0x0;let _0x2208ca=a753_0x5f00[_0x1c583];return _0x2208ca;};const _0x4e057b=a753_0x2208;'use strict';const util=require(_0x4e057b('0x19')),_=require(_0x4e057b('0x85')),squel=require('squel'),qs=require(_0x4e057b('0x9')),logger=require(_0x4e057b('0x2'))(_0x4e057b('0x25')),{getSocket}=require(_0x4e057b('0x7c')),socket=getSocket(),db=require('../../mysqldb')['db'],{Op,QueryTypes}=require(_0x4e057b('0x67'));require(_0x4e057b('0x74'))[_0x4e057b('0x18')](socket);function respondWithStatusCode(_0x1098fa,_0x44c8cd){return _0x44c8cd=_0x44c8cd||0xcc,function(_0x190cda){const _0x39a65e=a753_0x2208;if(_0x190cda)return _0x1098fa[_0x39a65e('0x8d')](_0x44c8cd);return _0x1098fa['status'](_0x44c8cd)[_0x39a65e('0x4e')]();};}function respondWithResult(_0x5771d2,_0x1003be){return _0x1003be=_0x1003be||0xc8,function(_0xe9a9fe){const _0x199b67=a753_0x2208;if(_0xe9a9fe)return _0x5771d2['status'](_0x1003be)[_0x199b67('0x7b')](_0xe9a9fe);};}function respondWithFilteredResult(_0x35d371,_0x32b328){return function(_0x49f8bd){const _0x1d51e6=a753_0x2208;if(_0x49f8bd){const _0xe4fae2=_0x49f8bd['count'],_0x5b997a=_0x32b328['offset'];let _0x1cec7d=_0x32b328['offset']+_0x32b328[_0x1d51e6('0x4c')],_0x382d64;return _0x1cec7d>=_0xe4fae2?(_0x1cec7d=_0xe4fae2,_0x382d64=0xc8):_0x382d64=0xce,_0x35d371[_0x1d51e6('0x56')](_0x382d64),_0x35d371[_0x1d51e6('0x79')](_0x1d51e6('0x54'),_0x5b997a+'-'+_0x1cec7d+'/'+_0xe4fae2)[_0x1d51e6('0x7b')](_0x49f8bd);}return null;};}function saveUpdates(_0x1e41b3){return function(_0x3208ee){const _0x29e85f=a753_0x2208;if(_0x3208ee)return _0x3208ee['update'](_0x1e41b3)[_0x29e85f('0x10')](function(_0x325404){return _0x325404;});return null;};}function removeEntity(_0x1c782b){return function(_0x2c1372){const _0x2731fb=a753_0x2208;if(_0x2c1372)return _0x2c1372[_0x2731fb('0x33')]()['then'](function(){const _0x1b56d2=_0x2731fb,_0x1b31aa=_0x2c1372[_0x1b56d2('0x78')]({'plain':!![]}),_0x4436ac=[{'name':_0x1b56d2('0x12'),'value':_0x1b56d2('0x98'),'ignore':![]},{'name':_0x1b56d2('0x38'),'value':'outbound','ignore':![]}],_0x4b371c=_(_0x4436ac)[_0x1b56d2('0x3d')](_0x1b56d2('0x52'))['map'](_0x1b56d2('0x9b'))[_0x1b56d2('0x9b')]();if(_[_0x1b56d2('0x5f')](_0x4b371c,_0x1b31aa[_0x1b56d2('0x20')]))return;const _0x190e1e=_['find'](_0x4436ac,[_0x1b56d2('0x9b'),_0x1b31aa[_0x1b56d2('0x20')]])[_0x1b56d2('0x57')];return db[_0x1b56d2('0x2c')][_0x1b56d2('0x33')]({'where':{'type':_0x190e1e,'resourceId':_0x1b31aa['id']}})['then'](function(){return _0x2c1372;});})[_0x2731fb('0x10')](function(){const _0x4df00d=_0x2731fb;_0x1c782b[_0x4df00d('0x56')](0xcc)[_0x4df00d('0x4e')]();});};}function handleEntityNotFound(_0x4e49d1){return function(_0x3f2fb3){const _0x4922d0=a753_0x2208;return!_0x3f2fb3&&_0x4e49d1[_0x4922d0('0x8d')](0x194),_0x3f2fb3;};}function handleError(_0x597497,_0x9ad429){return _0x9ad429=_0x9ad429||0x1f4,function(_0x5ca05d){const _0x1d0720=a753_0x2208;logger[_0x1d0720('0x28')](_0x5ca05d['stack']),_0x5ca05d[_0x1d0720('0x57')]&&delete _0x5ca05d['name'],_0x597497[_0x1d0720('0x56')](_0x9ad429)[_0x1d0720('0x90')](_0x5ca05d);};}exports[_0x4e057b('0x3b')]=function(_0x48e3eb,_0x36b062){const _0x33fed7=_0x4e057b;let _0xba7d56={};const _0x2de930={},_0x5bf320={'count':0x0,'rows':[]},_0x28f6ca=_['map'](db['VoiceQueue'][_0x33fed7('0x87')],function(_0x2bf9e7){const _0x8140a4=_0x33fed7;return{'name':_0x2bf9e7[_0x8140a4('0x9c')],'type':_0x2bf9e7['type'][_0x8140a4('0x68')]};});_0x2de930[_0x33fed7('0x1f')]=_['map'](_0x28f6ca,_0x33fed7('0x57')),_0x2de930[_0x33fed7('0x40')]=_[_0x33fed7('0x6e')](_0x48e3eb[_0x33fed7('0x40')]),_0x2de930[_0x33fed7('0x9f')]=_[_0x33fed7('0xc')](_0x2de930[_0x33fed7('0x1f')],_0x2de930[_0x33fed7('0x40')]),_0xba7d56[_0x33fed7('0x3e')]=_[_0x33fed7('0xc')](_0x2de930[_0x33fed7('0x1f')],qs[_0x33fed7('0x45')](_0x48e3eb[_0x33fed7('0x40')][_0x33fed7('0x45')])),_0xba7d56['attributes']=_0xba7d56[_0x33fed7('0x3e')][_0x33fed7('0x97')]?_0xba7d56[_0x33fed7('0x3e')]:_0x2de930[_0x33fed7('0x1f')];typeof _0x48e3eb[_0x33fed7('0x40')][_0x33fed7('0x6c')]==='undefined'&&(_0xba7d56[_0x33fed7('0x4c')]=qs['limit'](_0x48e3eb['query'][_0x33fed7('0x4c')]),_0xba7d56[_0x33fed7('0x7e')]=qs[_0x33fed7('0x7e')](_0x48e3eb['query'][_0x33fed7('0x7e')]));_0xba7d56[_0x33fed7('0x32')]=qs['sort'](_0x48e3eb['query']['sort']),_0xba7d56['where']=qs['filters'](_[_0x33fed7('0x31')](_0x48e3eb[_0x33fed7('0x40')],_0x2de930[_0x33fed7('0x9f')]),_0x28f6ca);_0x48e3eb[_0x33fed7('0x40')][_0x33fed7('0x3d')]&&(_0xba7d56[_0x33fed7('0x53')]=_[_0x33fed7('0x75')](_0xba7d56['where'],{[Op['or']]:_[_0x33fed7('0x43')](_0x28f6ca,function(_0x15c62c){const _0x54a51c=_0x33fed7;if(_0x15c62c[_0x54a51c('0x20')]!==_0x54a51c('0x65')){const _0x77a1c1={};return _0x77a1c1[_0x15c62c[_0x54a51c('0x57')]]={[Op['like']]:'%'+_0x48e3eb[_0x54a51c('0x40')][_0x54a51c('0x3d')]+'%'},_0x77a1c1;}})}));_0xba7d56=_[_0x33fed7('0x75')]({},_0xba7d56,_0x48e3eb['options']);const _0x40344c={'where':_0xba7d56[_0x33fed7('0x53')]};return db['VoiceQueue'][_0x33fed7('0x76')](_0x40344c)['then'](function(_0x4ea041){const _0x4e1efd=_0x33fed7;return _0x5bf320['count']=_0x4ea041,_0x48e3eb[_0x4e1efd('0x40')][_0x4e1efd('0x77')]&&(_0xba7d56[_0x4e1efd('0x0')]=[{'all':!![]}]),db['VoiceQueue'][_0x4e1efd('0x41')](_0xba7d56);})[_0x33fed7('0x10')](function(_0x190c5f){const _0x1c6719=_0x33fed7;return _0x5bf320[_0x1c6719('0x73')]=_0x190c5f,_0x5bf320;})[_0x33fed7('0x10')](respondWithFilteredResult(_0x36b062,_0xba7d56))[_0x33fed7('0x48')](handleError(_0x36b062,null));},exports[_0x4e057b('0x35')]=function(_0x1f1df6,_0x480c01){const _0x29043a=_0x4e057b;let _0x1f24f7={'raw':![],'where':{'id':_0x1f1df6[_0x29043a('0x13')]['id']}};const _0x2ce859={};return _0x2ce859['model']=_['keys'](db[_0x29043a('0x71')][_0x29043a('0x87')]),_0x2ce859[_0x29043a('0x40')]=_[_0x29043a('0x6e')](_0x1f1df6[_0x29043a('0x40')]),_0x2ce859['filters']=_['intersection'](_0x2ce859[_0x29043a('0x1f')],_0x2ce859[_0x29043a('0x40')]),_0x1f24f7[_0x29043a('0x3e')]=_['intersection'](_0x2ce859[_0x29043a('0x1f')],qs['fields'](_0x1f1df6[_0x29043a('0x40')][_0x29043a('0x45')])),_0x1f24f7[_0x29043a('0x3e')]=_0x1f24f7[_0x29043a('0x3e')][_0x29043a('0x97')]?_0x1f24f7['attributes']:_0x2ce859[_0x29043a('0x1f')],_0x1f1df6[_0x29043a('0x40')][_0x29043a('0x77')]&&(_0x1f24f7[_0x29043a('0x0')]=[{'all':!![]}]),_0x1f24f7=_['merge']({},_0x1f24f7,_0x1f1df6[_0x29043a('0x60')]),db[_0x29043a('0x71')]['findOne'](_0x1f24f7)[_0x29043a('0x10')](handleEntityNotFound(_0x480c01,null))[_0x29043a('0x10')](respondWithResult(_0x480c01,null))[_0x29043a('0x48')](handleError(_0x480c01,null));},exports[_0x4e057b('0x4')]=function(_0x58df20,_0x428f07){const _0x528d9c=_0x4e057b;return db['VoiceQueue'][_0x528d9c('0x4')](_0x58df20[_0x528d9c('0x8b')],{})[_0x528d9c('0x10')](function(_0x1ed1be){const _0x145201=_0x528d9c,_0x1c3299=_0x58df20[_0x145201('0x5a')][_0x145201('0x78')]({'plain':!![]});if(!_0x1c3299)throw new Error(_0x145201('0x95'));if(_0x1c3299[_0x145201('0x2b')]===_0x145201('0x5a')){const _0x180a11=_0x1ed1be[_0x145201('0x78')]({'plain':!![]}),_0x2c4f65=[{'name':_0x145201('0x12'),'value':'inbound'},{'name':_0x145201('0x38'),'value':_0x145201('0x4f')}],_0x5f5288=_[_0x145201('0x7a')](_0x2c4f65,[_0x145201('0x9b'),_0x180a11[_0x145201('0x20')]])[_0x145201('0x57')];return db[_0x145201('0x7d')][_0x145201('0x82')]({'where':{'name':_0x5f5288,'userProfileId':_0x1c3299['userProfileId']},'raw':!![]})['then'](function(_0x94324e){const _0x1e2b8a=_0x145201;return _0x94324e&&_0x94324e[_0x1e2b8a('0x66')]===0x0?db[_0x1e2b8a('0x2c')][_0x1e2b8a('0x4')]({'name':_0x180a11[_0x1e2b8a('0x57')],'resourceId':_0x180a11['id'],'type':_0x94324e['name'],'sectionId':_0x94324e['id']},{})[_0x1e2b8a('0x10')](function(){return _0x1ed1be;}):_0x1ed1be;})[_0x145201('0x48')](function(_0x1a435d){const _0x38ca61=_0x145201;logger[_0x38ca61('0x28')](_0x38ca61('0x5b'),_0x1a435d);throw _0x1a435d;});}return _0x1ed1be;})[_0x528d9c('0x10')](respondWithResult(_0x428f07,0xc9))['catch'](handleError(_0x428f07,null));},exports[_0x4e057b('0x30')]=function(_0x19e82c,_0x2959d3){const _0x5ce9b3=_0x4e057b;let _0x85e416={'where':{'id':_0x19e82c[_0x5ce9b3('0x13')]['id']}};const _0x47d0a1={};return _0x47d0a1[_0x5ce9b3('0x1f')]=_[_0x5ce9b3('0x6e')](db[_0x5ce9b3('0x71')]['rawAttributes']),_0x85e416[_0x5ce9b3('0x3e')]=_['intersection'](_0x47d0a1[_0x5ce9b3('0x1f')],qs[_0x5ce9b3('0x45')](_0x19e82c['query'][_0x5ce9b3('0x45')])),_0x85e416[_0x5ce9b3('0x3e')]=_0x85e416[_0x5ce9b3('0x3e')][_0x5ce9b3('0x97')]?_0x85e416[_0x5ce9b3('0x3e')]:_0x47d0a1['model'],_0x19e82c['query']['includeAll']&&(_0x85e416[_0x5ce9b3('0x0')]=[{'all':!![]}]),_0x85e416=_[_0x5ce9b3('0x75')]({},_0x85e416,_0x19e82c[_0x5ce9b3('0x60')]),db[_0x5ce9b3('0x71')][_0x5ce9b3('0x82')](_0x85e416)[_0x5ce9b3('0x10')](handleEntityNotFound(_0x2959d3,null))[_0x5ce9b3('0x10')](function(_0x1aea33){const _0x181949=_0x5ce9b3;if(_0x1aea33){let _0x213cc=_0x1aea33[_0x181949('0x78')]({'plain':!![]});return _0x213cc=qs[_0x181949('0x70')](_0x213cc,['id',_0x181949('0x91'),_0x181949('0x11')]),_0x19e82c[_0x181949('0x8b')]=_[_0x181949('0x70')](_0x19e82c[_0x181949('0x8b')],['id','createdAt',_0x181949('0x11')]),db[_0x181949('0x71')][_0x181949('0x4')](_[_0x181949('0x75')](_0x213cc,_0x19e82c[_0x181949('0x8b')]),{'include':_0x19e82c['query']['includeAll']?[{'all':!![]}]:undefined})[_0x181949('0x10')](function(_0xc1f09a){const _0x52169e=_0x181949,_0x5bb862=_0x19e82c[_0x52169e('0x5a')][_0x52169e('0x78')]({'plain':!![]});if(!_0x5bb862)throw new Error(_0x52169e('0x95'));if(_0x5bb862[_0x52169e('0x2b')]===_0x52169e('0x5a')){const _0x3d3d24=_0xc1f09a['get']({'plain':!![]}),_0x215688=[{'name':_0x52169e('0x12'),'value':_0x52169e('0x98')},{'name':_0x52169e('0x38'),'value':_0x52169e('0x4f')}],_0x26db02=_[_0x52169e('0x7a')](_0x215688,[_0x52169e('0x9b'),_0x3d3d24['type']])['name'];return db[_0x52169e('0x7d')][_0x52169e('0x82')]({'where':{'name':_0x26db02,'userProfileId':_0x5bb862[_0x52169e('0x47')]},'raw':!![]})['then'](function(_0x5ee221){const _0x46f538=_0x52169e;return _0x5ee221&&_0x5ee221[_0x46f538('0x66')]===0x0?db[_0x46f538('0x2c')][_0x46f538('0x4')]({'name':_0x3d3d24[_0x46f538('0x57')],'resourceId':_0x3d3d24['id'],'type':_0x5ee221[_0x46f538('0x57')],'sectionId':_0x5ee221['id']},{})['then'](function(){return _0xc1f09a;}):_0xc1f09a;})['catch'](function(_0x3170a7){const _0x5ab8a8=_0x52169e;logger[_0x5ab8a8('0x28')](_0x5ab8a8('0x5b'),_0x3170a7);throw _0x3170a7;});}return _0xc1f09a;});}})[_0x5ce9b3('0x10')](respondWithResult(_0x2959d3,0xc9))[_0x5ce9b3('0x48')](handleError(_0x2959d3,null));},exports[_0x4e057b('0x46')]=function(_0x464734,_0x1da4f4){const _0x1c723f=_0x4e057b;return _0x464734[_0x1c723f('0x8b')]['id']&&delete _0x464734[_0x1c723f('0x8b')]['id'],db[_0x1c723f('0x71')][_0x1c723f('0x82')]({'where':{'id':_0x464734['params']['id']}})[_0x1c723f('0x10')](handleEntityNotFound(_0x1da4f4,null))[_0x1c723f('0x10')](saveUpdates(_0x464734[_0x1c723f('0x8b')],null))[_0x1c723f('0x10')](respondWithResult(_0x1da4f4,null))['catch'](handleError(_0x1da4f4,null));},exports[_0x4e057b('0x33')]=function(_0xe1e8e9,_0x3cfc7b){const _0x3c5e0f=_0x4e057b;return db[_0x3c5e0f('0x71')]['findOne']({'where':{'id':_0xe1e8e9[_0x3c5e0f('0x13')]['id']}})[_0x3c5e0f('0x10')](handleEntityNotFound(_0x3cfc7b,null))[_0x3c5e0f('0x10')](removeEntity(_0x3cfc7b,null))['catch'](handleError(_0x3cfc7b,null));},exports['getHoppers']=function(_0x4bc120,_0x33c983){const _0x454f77=_0x4e057b;let _0x4f6277={'raw':![],'where':{}};const _0x425696={},_0x3d8285={'count':0x0,'rows':[]};return db[_0x454f77('0x71')][_0x454f77('0x82')]({'where':{'id':_0x4bc120[_0x454f77('0x13')]['id']}})['then'](handleEntityNotFound(_0x33c983,null))['then'](function(_0x38ab9b){const _0x558d49=_0x454f77;if(_0x38ab9b)return _0x425696[_0x558d49('0x1f')]=_['keys'](db['CmHopper'][_0x558d49('0x87')]),_0x425696['query']=_[_0x558d49('0x6e')](_0x4bc120['query']),_0x425696[_0x558d49('0x9f')]=_['intersection'](_0x425696['model'],_0x425696[_0x558d49('0x40')]),_0x4f6277[_0x558d49('0x3e')]=_['intersection'](_0x425696[_0x558d49('0x1f')],qs[_0x558d49('0x45')](_0x4bc120[_0x558d49('0x40')][_0x558d49('0x45')])),_0x4f6277[_0x558d49('0x3e')]=_0x4f6277[_0x558d49('0x3e')][_0x558d49('0x97')]?_0x4f6277['attributes']:_0x425696[_0x558d49('0x1f')],typeof _0x4bc120['query'][_0x558d49('0x6c')]===_0x558d49('0x37')&&(_0x4f6277[_0x558d49('0x4c')]=qs['limit'](_0x4bc120[_0x558d49('0x40')][_0x558d49('0x4c')]),_0x4f6277['offset']=qs['offset'](_0x4bc120[_0x558d49('0x40')][_0x558d49('0x7e')])),_0x4f6277['order']=qs[_0x558d49('0x4b')](_0x4bc120[_0x558d49('0x40')][_0x558d49('0x4b')]),_0x4f6277[_0x558d49('0x53')]=qs[_0x558d49('0x9f')](_[_0x558d49('0x31')](_0x4bc120[_0x558d49('0x40')],_0x425696[_0x558d49('0x9f')])),_0x4f6277[_0x558d49('0x53')][_0x558d49('0x62')]=_0x38ab9b['id'],_0x4bc120['query'][_0x558d49('0x3d')]&&(_0x4f6277[_0x558d49('0x53')]=_['merge'](_0x4f6277['where'],{[Op['or']]:_[_0x558d49('0x43')](_0x4f6277['attributes'],function(_0x39deb5){const _0x2c6517=_0x558d49,_0x589c36={};return _0x589c36[_0x39deb5]={[Op[_0x2c6517('0x4d')]]:'%'+_0x4bc120['query'][_0x2c6517('0x3d')]+'%'},_0x589c36;})})),_0x4f6277=_[_0x558d49('0x75')]({},_0x4f6277,_0x4bc120[_0x558d49('0x60')]),db[_0x558d49('0x2f')][_0x558d49('0x76')]({'where':_0x4f6277[_0x558d49('0x53')]})[_0x558d49('0x10')](function(_0x1c3b1d){const _0x2fe795=_0x558d49;return _0x3d8285[_0x2fe795('0x76')]=_0x1c3b1d,_0x4bc120[_0x2fe795('0x40')][_0x2fe795('0x77')]&&(_0x4f6277['include']=[{'all':!![]}]),db['CmHopper'][_0x2fe795('0x41')](_0x4f6277);})[_0x558d49('0x10')](function(_0x4067b2){const _0x32525f=_0x558d49;return _0x3d8285[_0x32525f('0x73')]=_0x4067b2,_0x3d8285;});})[_0x454f77('0x10')](respondWithFilteredResult(_0x33c983,_0x4f6277))[_0x454f77('0x48')](handleError(_0x33c983,null));},exports['getHopperHistories']=function(_0x2a18e3,_0x3fff34){const _0x2ff87d=_0x4e057b;let _0x186e5c={'raw':!![],'where':{}};const _0x139ac7={},_0x3bf6a5={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ff87d('0x82')]({'where':{'id':_0x2a18e3[_0x2ff87d('0x13')]['id']}})[_0x2ff87d('0x10')](handleEntityNotFound(_0x3fff34,null))[_0x2ff87d('0x10')](function(_0xc14af7){const _0x4f88d0=_0x2ff87d;if(_0xc14af7)return _0x139ac7[_0x4f88d0('0x1f')]=_[_0x4f88d0('0x6e')](db[_0x4f88d0('0x4a')]['rawAttributes']),_0x139ac7['query']=_['keys'](_0x2a18e3[_0x4f88d0('0x40')]),_0x139ac7[_0x4f88d0('0x9f')]=_[_0x4f88d0('0xc')](_0x139ac7['model'],_0x139ac7[_0x4f88d0('0x40')]),_0x186e5c[_0x4f88d0('0x3e')]=_[_0x4f88d0('0xc')](_0x139ac7[_0x4f88d0('0x1f')],qs[_0x4f88d0('0x45')](_0x2a18e3[_0x4f88d0('0x40')][_0x4f88d0('0x45')])),_0x186e5c[_0x4f88d0('0x3e')]=_0x186e5c[_0x4f88d0('0x3e')][_0x4f88d0('0x97')]?_0x186e5c['attributes']:_0x139ac7[_0x4f88d0('0x1f')],typeof _0x2a18e3[_0x4f88d0('0x40')][_0x4f88d0('0x6c')]===_0x4f88d0('0x37')&&(_0x186e5c[_0x4f88d0('0x4c')]=qs[_0x4f88d0('0x4c')](_0x2a18e3[_0x4f88d0('0x40')][_0x4f88d0('0x4c')]),_0x186e5c[_0x4f88d0('0x7e')]=qs[_0x4f88d0('0x7e')](_0x2a18e3[_0x4f88d0('0x40')][_0x4f88d0('0x7e')])),_0x186e5c[_0x4f88d0('0x32')]=qs[_0x4f88d0('0x4b')](_0x2a18e3[_0x4f88d0('0x40')]['sort']),_0x186e5c[_0x4f88d0('0x53')]=qs[_0x4f88d0('0x9f')](_['pick'](_0x2a18e3[_0x4f88d0('0x40')],_0x139ac7[_0x4f88d0('0x9f')])),_0x186e5c[_0x4f88d0('0x53')][_0x4f88d0('0x62')]=_0xc14af7['id'],_0x2a18e3[_0x4f88d0('0x40')][_0x4f88d0('0x3d')]&&(_0x186e5c[_0x4f88d0('0x53')]=_[_0x4f88d0('0x75')](_0x186e5c[_0x4f88d0('0x53')],{[Op['or']]:_['map'](_0x186e5c[_0x4f88d0('0x3e')],function(_0x39b898){const _0x529bce=_0x4f88d0,_0x376a00={};return _0x376a00[_0x39b898]={[Op[_0x529bce('0x4d')]]:'%'+_0x2a18e3[_0x529bce('0x40')][_0x529bce('0x3d')]+'%'},_0x376a00;})})),_0x186e5c=_[_0x4f88d0('0x75')]({},_0x186e5c,_0x2a18e3[_0x4f88d0('0x60')]),db['CmHopperHistory']['count']({'where':_0x186e5c[_0x4f88d0('0x53')]})[_0x4f88d0('0x10')](function(_0x292dc1){const _0x2c5037=_0x4f88d0;return _0x3bf6a5[_0x2c5037('0x76')]=_0x292dc1,_0x2a18e3['query']['includeAll']&&(_0x186e5c[_0x2c5037('0x0')]=[{'all':!![]}]),db[_0x2c5037('0x4a')][_0x2c5037('0x41')](_0x186e5c);})['then'](function(_0x3cdb11){const _0x103a94=_0x4f88d0;return _0x3bf6a5[_0x103a94('0x73')]=_0x3cdb11,_0x3bf6a5;});})[_0x2ff87d('0x10')](respondWithFilteredResult(_0x3fff34,_0x186e5c))[_0x2ff87d('0x48')](handleError(_0x3fff34,null));},exports[_0x4e057b('0x8c')]=function(_0x2d996b,_0x499845){const _0x271fbc=_0x4e057b;let _0x1518a5={'raw':!![],'where':{}};const _0x5d258d={},_0x5acff7={'count':0x0,'rows':[]};return db[_0x271fbc('0x71')][_0x271fbc('0x82')]({'where':{'id':_0x2d996b[_0x271fbc('0x13')]['id']}})[_0x271fbc('0x10')](handleEntityNotFound(_0x499845,null))[_0x271fbc('0x10')](function(_0x5567ce){const _0x26596b=_0x271fbc;if(_0x5567ce)return _0x5d258d[_0x26596b('0x1f')]=_['keys'](db['CmHopperFinal'][_0x26596b('0x87')]),_0x5d258d[_0x26596b('0x40')]=_['keys'](_0x2d996b['query']),_0x5d258d[_0x26596b('0x9f')]=_[_0x26596b('0xc')](_0x5d258d[_0x26596b('0x1f')],_0x5d258d[_0x26596b('0x40')]),_0x1518a5[_0x26596b('0x3e')]=_[_0x26596b('0xc')](_0x5d258d[_0x26596b('0x1f')],qs['fields'](_0x2d996b['query'][_0x26596b('0x45')])),_0x1518a5[_0x26596b('0x3e')]=_0x1518a5[_0x26596b('0x3e')][_0x26596b('0x97')]?_0x1518a5[_0x26596b('0x3e')]:_0x5d258d[_0x26596b('0x1f')],typeof _0x2d996b['query'][_0x26596b('0x6c')]===_0x26596b('0x37')&&(_0x1518a5['limit']=qs[_0x26596b('0x4c')](_0x2d996b[_0x26596b('0x40')][_0x26596b('0x4c')]),_0x1518a5['offset']=qs[_0x26596b('0x7e')](_0x2d996b[_0x26596b('0x40')][_0x26596b('0x7e')])),_0x1518a5['order']=qs[_0x26596b('0x4b')](_0x2d996b[_0x26596b('0x40')][_0x26596b('0x4b')]),_0x1518a5[_0x26596b('0x53')]=qs[_0x26596b('0x9f')](_[_0x26596b('0x31')](_0x2d996b[_0x26596b('0x40')],_0x5d258d['filters'])),_0x1518a5['where'][_0x26596b('0x62')]=_0x5567ce['id'],_0x2d996b[_0x26596b('0x40')][_0x26596b('0x3d')]&&(_0x1518a5[_0x26596b('0x53')]=_['merge'](_0x1518a5['where'],{[Op['or']]:_['map'](_0x1518a5[_0x26596b('0x3e')],function(_0x194608){const _0x442630=_0x26596b,_0x1696bb={};return _0x1696bb[_0x194608]={[Op[_0x442630('0x4d')]]:'%'+_0x2d996b[_0x442630('0x40')][_0x442630('0x3d')]+'%'},_0x1696bb;})})),_0x1518a5=_['merge']({},_0x1518a5,_0x2d996b['options']),db[_0x26596b('0x7')][_0x26596b('0x76')]({'where':_0x1518a5['where']})['then'](function(_0x9667fd){const _0x4207fb=_0x26596b;return _0x5acff7['count']=_0x9667fd,_0x2d996b['query'][_0x4207fb('0x77')]&&(_0x1518a5['include']=[{'all':!![]}]),db[_0x4207fb('0x7')][_0x4207fb('0x41')](_0x1518a5);})[_0x26596b('0x10')](function(_0x307f37){const _0x3d6941=_0x26596b;return _0x5acff7[_0x3d6941('0x73')]=_0x307f37,_0x5acff7;});})['then'](respondWithFilteredResult(_0x499845,_0x1518a5))[_0x271fbc('0x48')](handleError(_0x499845,null));},exports[_0x4e057b('0x96')]=function(_0x1eb5a2,_0x2d6a04){const _0x2039b2=_0x4e057b;let _0x322b0c={'raw':!![],'where':{}};const _0x45f78d={},_0x33402e={'count':0x0,'rows':[]};return db[_0x2039b2('0x71')]['findOne']({'where':{'id':_0x1eb5a2[_0x2039b2('0x13')]['id']}})[_0x2039b2('0x10')](handleEntityNotFound(_0x2d6a04,null))[_0x2039b2('0x10')](function(_0x3c09a6){const _0x878718=_0x2039b2;if(_0x3c09a6)return _0x45f78d[_0x878718('0x1f')]=_[_0x878718('0x6e')](db['CmHopperBlack'][_0x878718('0x87')]),_0x45f78d[_0x878718('0x40')]=_[_0x878718('0x6e')](_0x1eb5a2[_0x878718('0x40')]),_0x45f78d[_0x878718('0x9f')]=_[_0x878718('0xc')](_0x45f78d[_0x878718('0x1f')],_0x45f78d[_0x878718('0x40')]),_0x322b0c[_0x878718('0x3e')]=_[_0x878718('0xc')](_0x45f78d[_0x878718('0x1f')],qs['fields'](_0x1eb5a2[_0x878718('0x40')]['fields'])),_0x322b0c[_0x878718('0x3e')]=_0x322b0c[_0x878718('0x3e')][_0x878718('0x97')]?_0x322b0c[_0x878718('0x3e')]:_0x45f78d[_0x878718('0x1f')],typeof _0x1eb5a2[_0x878718('0x40')][_0x878718('0x6c')]===_0x878718('0x37')&&(_0x322b0c[_0x878718('0x4c')]=qs[_0x878718('0x4c')](_0x1eb5a2[_0x878718('0x40')][_0x878718('0x4c')]),_0x322b0c['offset']=qs[_0x878718('0x7e')](_0x1eb5a2[_0x878718('0x40')][_0x878718('0x7e')])),_0x322b0c['order']=qs[_0x878718('0x4b')](_0x1eb5a2['query'][_0x878718('0x4b')]),_0x322b0c[_0x878718('0x53')]=qs[_0x878718('0x9f')](_[_0x878718('0x31')](_0x1eb5a2[_0x878718('0x40')],_0x45f78d['filters'])),_0x322b0c[_0x878718('0x53')][_0x878718('0x62')]=_0x3c09a6['id'],_0x1eb5a2[_0x878718('0x40')][_0x878718('0x3d')]&&(_0x322b0c[_0x878718('0x53')]=_[_0x878718('0x75')](_0x322b0c[_0x878718('0x53')],{[Op['or']]:_[_0x878718('0x43')](_0x322b0c[_0x878718('0x3e')],function(_0x227474){const _0xea96f7=_0x878718,_0x221061={};return _0x221061[_0x227474]={[Op['like']]:'%'+_0x1eb5a2[_0xea96f7('0x40')][_0xea96f7('0x3d')]+'%'},_0x221061;})})),_0x322b0c=_[_0x878718('0x75')]({},_0x322b0c,_0x1eb5a2[_0x878718('0x60')]),db[_0x878718('0x42')]['count']({'where':_0x322b0c[_0x878718('0x53')]})[_0x878718('0x10')](function(_0x15122c){const _0x2afd4a=_0x878718;return _0x33402e[_0x2afd4a('0x76')]=_0x15122c,_0x1eb5a2[_0x2afd4a('0x40')][_0x2afd4a('0x77')]&&(_0x322b0c[_0x2afd4a('0x0')]=[{'all':!![]}]),db[_0x2afd4a('0x42')][_0x2afd4a('0x41')](_0x322b0c);})['then'](function(_0x5c3640){const _0x4c2faa=_0x878718;return _0x33402e[_0x4c2faa('0x73')]=_0x5c3640,_0x33402e;});})[_0x2039b2('0x10')](respondWithFilteredResult(_0x2d6a04,_0x322b0c))[_0x2039b2('0x48')](handleError(_0x2d6a04,null));},exports[_0x4e057b('0x5')]=function(_0x254a2f,_0x293098){const _0x24bd90=_0x4e057b;let _0x5602aa={};const _0x33b2bd={};let _0x1c7b7e,_0xe3231a;return db['VoiceQueue'][_0x24bd90('0x82')]({'where':{'id':_0x254a2f[_0x24bd90('0x13')]['id']}})[_0x24bd90('0x10')](handleEntityNotFound(_0x293098,null))[_0x24bd90('0x10')](function(_0x4953ac){const _0x28e2d7=_0x24bd90;if(_0x4953ac)return _0x1c7b7e=_0x4953ac,_0x33b2bd[_0x28e2d7('0x1f')]=_[_0x28e2d7('0x6e')](db['Team'][_0x28e2d7('0x87')]),_0x33b2bd['query']=_['keys'](_0x254a2f[_0x28e2d7('0x40')]),_0x33b2bd[_0x28e2d7('0x9f')]=_[_0x28e2d7('0xc')](_0x33b2bd[_0x28e2d7('0x1f')],_0x33b2bd[_0x28e2d7('0x40')]),_0x5602aa['attributes']=_[_0x28e2d7('0xc')](_0x33b2bd[_0x28e2d7('0x1f')],qs['fields'](_0x254a2f[_0x28e2d7('0x40')][_0x28e2d7('0x45')])),_0x5602aa['attributes']=_0x5602aa['attributes'][_0x28e2d7('0x97')]?_0x5602aa[_0x28e2d7('0x3e')]:_0x33b2bd[_0x28e2d7('0x1f')],_0x5602aa['order']=qs[_0x28e2d7('0x4b')](_0x254a2f[_0x28e2d7('0x40')]['sort']),_0x5602aa[_0x28e2d7('0x53')]=qs['filters'](_['pick'](_0x254a2f['query'],_0x33b2bd[_0x28e2d7('0x9f')])),_0x254a2f[_0x28e2d7('0x40')][_0x28e2d7('0x3d')]&&(_0x5602aa[_0x28e2d7('0x53')]=_[_0x28e2d7('0x75')](_0x5602aa[_0x28e2d7('0x53')],{[Op['or']]:_[_0x28e2d7('0x43')](_0x5602aa[_0x28e2d7('0x3e')],function(_0x1de914){const _0x213e8b=_0x28e2d7,_0x2256bf={};return _0x2256bf[_0x1de914]={[Op[_0x213e8b('0x4d')]]:'%'+_0x254a2f['query'][_0x213e8b('0x3d')]+'%'},_0x2256bf;})})),_0x5602aa=_['merge']({},_0x5602aa,_0x254a2f[_0x28e2d7('0x60')]),_0x1c7b7e['getTeams'](_0x5602aa);})['then'](function(_0xe0c2f2){const _0x960d90=_0x24bd90;if(_0xe0c2f2)return _0xe3231a=_0xe0c2f2[_0x960d90('0x97')],typeof _0x254a2f[_0x960d90('0x40')]['nolimit']===_0x960d90('0x37')&&(_0x5602aa[_0x960d90('0x4c')]=qs[_0x960d90('0x4c')](_0x254a2f['query'][_0x960d90('0x4c')]),_0x5602aa['offset']=qs[_0x960d90('0x7e')](_0x254a2f[_0x960d90('0x40')][_0x960d90('0x7e')])),_0x1c7b7e[_0x960d90('0x5')](_0x5602aa);})[_0x24bd90('0x10')](function(_0x47577a){if(_0x47577a)return _0x47577a?{'count':_0xe3231a,'rows':_0x47577a}:null;})['then'](respondWithResult(_0x293098,null))['catch'](handleError(_0x293098,null));},exports[_0x4e057b('0x9d')]=function(_0x2159b8,_0x4b854c){const _0x204073=_0x4e057b,_0x51bfb4=_0x2159b8[_0x204073('0x8b')]['teams'],_0x3b89a4=_[_0x204073('0x43')](_0x51bfb4,'id');return db['Team'][_0x204073('0x41')]({'where':{'id':_0x3b89a4},'attributes':['id'],'include':[{'model':db[_0x204073('0x86')],'as':_0x204073('0xa1'),'attributes':['id',_0x204073('0x57'),'online',_0x204073('0x16'),_0x204073('0x5d')],'raw':!![]}]})[_0x204073('0x10')](function(_0x14c0e1){const _0x335148=_0x204073;if(_0x14c0e1){const _0x1b92f5=_[_0x335148('0xa0')](_0x14c0e1,function(_0x353e8d){const _0x48f599=_0x335148,_0x2cb0aa=_0x353e8d[_0x48f599('0x78')]({'plain':!![]});return _0x2cb0aa[_0x48f599('0xa1')]['forEach'](function(_0x89b364){const _0x23b90d=_0x48f599;_0x89b364['penalty']=_[_0x23b90d('0x7a')](_0x51bfb4,{'id':_0x2cb0aa['id']})['penalty'];}),_0x2cb0aa[_0x48f599('0xa1')];});return db[_0x335148('0x71')][_0x335148('0x82')]({'where':{'id':_0x2159b8[_0x335148('0x13')]['id']}})[_0x335148('0x10')](function(_0x598968){const _0x1952b2=_0x335148;return db[_0x1952b2('0x67')][_0x1952b2('0x80')](function(_0xd0753e){const _0x3fc952=_0x1952b2;return _0x598968['addTeams'](_0x3b89a4,{'transaction':_0xd0753e})[_0x3fc952('0x10')](function(){const _0x442224=_0x3fc952;return Promise[_0x442224('0x50')](_0x1b92f5,function(_0x3b41e6){const _0x2dc2c8=_0x442224;return db[_0x2dc2c8('0x3c')][_0x2dc2c8('0x84')]({'where':{'UserId':_0x3b41e6['id'],'VoiceQueueId':_0x2159b8[_0x2dc2c8('0x13')]['id']},'defaults':{'penalty':_0x3b41e6[_0x2dc2c8('0x2a')]},'transaction':_0xd0753e});});})[_0x3fc952('0x10')](function(){const _0x3e865d=_0x3fc952;return Promise[_0x3e865d('0x50')](_[_0x3e865d('0x3d')](_0x1b92f5,{'online':!![]}),function(_0x2011e3){const _0x52918=_0x3e865d;return db[_0x52918('0x17')][_0x52918('0x59')]({'membername':_0x2011e3[_0x52918('0x57')],'UserId':_0x2011e3['id'],'queue_name':_0x598968['name'],'VoiceQueueId':_0x598968['id'],'interface':_[_0x52918('0x9e')](_0x2011e3[_0x52918('0x5d')])?util['format']('SIP/%s',_0x2011e3['name']):_0x2011e3['interface'],'paused':_0x2011e3[_0x52918('0x16')]||![],'penalty':_0x2011e3[_0x52918('0x2a')]},{'transaction':_0xd0753e});});})['then'](function(){const _0x1cda8b=_0x3fc952;_0x1b92f5[_0x1cda8b('0x15')](function(_0x53c4bd){const _0x2d2ce4=_0x1cda8b;socket[_0x2d2ce4('0x69')]('userVoiceQueue:save',{'UserId':_0x53c4bd['id'],'VoiceQueueId':_0x598968['id']});});});});});}})[_0x204073('0x10')](respondWithStatusCode(_0x4b854c,null))[_0x204073('0x48')](handleError(_0x4b854c,null));},exports[_0x4e057b('0x6b')]=function(_0xd7e5dd,_0x461ea9){const _0x3306c9=_0x4e057b;return db['Team']['findAll']({'where':{'id':_0xd7e5dd[_0x3306c9('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3306c9('0x86')],'as':_0x3306c9('0xa1'),'attributes':['id'],'raw':!![]}]})[_0x3306c9('0x10')](handleEntityNotFound(_0x461ea9,null))[_0x3306c9('0x10')](function(_0x150939){const _0x3f3440=_0x3306c9,_0x5a6715=_['map'](_0x150939,'id');let _0x1fc065=[];const _0x1efd75=[],_0x1dc003=squel[_0x3f3440('0x83')]();_0x1dc003['field']('tq.TeamId')[_0x3f3440('0x1c')](_0x3f3440('0x3a'),'tq')[_0x3f3440('0x24')]('user_has_teams','ut',_0x3f3440('0x3'))[_0x3f3440('0x53')](_0x3f3440('0x26'),_0xd7e5dd[_0x3f3440('0x13')]['id']);for(let _0x228d84=0x0;_0x228d84<_0x150939['length'];_0x228d84+=0x1){const _0x399eb1=_0x150939[_0x228d84];for(let _0x151823=0x0;_0x151823<_0x399eb1[_0x3f3440('0xa1')][_0x3f3440('0x97')];_0x151823+=0x1){const _0x356d8f=_0x399eb1['Agents'][_0x151823],_0x134ff5=_0x1dc003['clone']();_0x134ff5[_0x3f3440('0x53')](_0x3f3440('0x1d'),_0x356d8f['id']),_0x1efd75[_0x3f3440('0x9a')](db[_0x3f3440('0x67')][_0x3f3440('0x40')](_0x134ff5[_0x3f3440('0x22')](),{'type':QueryTypes[_0x3f3440('0x2e')]})[_0x3f3440('0x10')](function(_0x17f27b){const _0x238917=_0x3f3440;if(_0x17f27b[_0x238917('0x97')]===0x1)return _0x356d8f['id'];else{const _0x3c973c=_[_0x238917('0x6d')](_['map'](_0x17f27b,_0x238917('0x7f')),function(_0x5664e7){const _0x5e1347=_0x238917;return _[_0x5e1347('0x5f')](_0x5a6715,_0x5664e7);});if(_0x3c973c)return _0x356d8f['id'];}}));}}return Promise[_0x3f3440('0xa')](_0x1efd75)[_0x3f3440('0x10')](function(_0x4c98c1){const _0xfb9b09=_0x3f3440;return _0x1fc065=_(_0x1fc065)['union'](_0x4c98c1)[_0xfb9b09('0x27')]()['value'](),db[_0xfb9b09('0x71')]['findOne']({'where':{'id':_0xd7e5dd[_0xfb9b09('0x13')]['id']}})['then'](function(_0x533042){const _0xc51159=_0xfb9b09;return db['sequelize'][_0xc51159('0x80')](function(_0x1e1dee){const _0xfe2076=_0xc51159;return _0x533042[_0xfe2076('0x6b')](_0xd7e5dd[_0xfe2076('0x40')]['ids'],{'transaction':_0x1e1dee})[_0xfe2076('0x10')](function(){const _0x50a979=_0xfe2076;if(!_[_0x50a979('0x81')](_0x1fc065))return _0x533042['removeAgents'](_0x1fc065,{'transaction':_0x1e1dee})[_0x50a979('0x10')](function(){const _0x3cd4a7=_0x50a979;return db[_0x3cd4a7('0x17')][_0x3cd4a7('0x33')]({'where':{'VoiceQueueId':_0xd7e5dd[_0x3cd4a7('0x13')]['id'],'UserId':_0x1fc065},'transaction':_0x1e1dee});});})[_0xfe2076('0x10')](function(){_0x1fc065['forEach'](function(_0x2cafe9){const _0x1754de=a753_0x2208;socket['emit'](_0x1754de('0x61'),{'UserId':_0x2cafe9,'VoiceQueueId':_0x533042['id']});});});});});});})[_0x3306c9('0x10')](respondWithStatusCode(_0x461ea9,null))['catch'](handleError(_0x461ea9,null));},exports['addAgents']=function(_0x502995,_0x5363df){const _0x11f408=_0x4e057b;let _0x4f1e35,_0x32d456;return db[_0x11f408('0x71')][_0x11f408('0x82')]({'where':{'id':_0x502995[_0x11f408('0x13')]['id']}})['then'](function(_0xba0b5){const _0x171451=_0x11f408;if(_0xba0b5)return _0x32d456=_0xba0b5,_0xba0b5[_0x171451('0x6a')](_0x502995[_0x171451('0x8b')][_0x171451('0x3f')],{'through':_[_0x171451('0x70')](_0x502995[_0x171451('0x8b')],[_0x171451('0x3f'),'id'])})['then'](function(_0x262ebb){const _0x5e5ec6=_0x171451;for(let _0x1e2b22=0x0;_0x1e2b22<_0x502995[_0x5e5ec6('0x8b')][_0x5e5ec6('0x3f')][_0x5e5ec6('0x97')];_0x1e2b22+=0x1){socket['emit'](_0x5e5ec6('0x51'),{'UserId':_0x502995[_0x5e5ec6('0x8b')]['ids'][_0x1e2b22],'VoiceQueueId':_0x502995[_0x5e5ec6('0x13')]['id']});}return _0x262ebb;});})[_0x11f408('0x10')](function(_0x348a19){const _0x5ea5b0=_0x11f408;_0x4f1e35=_0x348a19||[];if(_0x32d456)return db[_0x5ea5b0('0x86')][_0x5ea5b0('0x41')]({'where':{'id':_0x502995[_0x5ea5b0('0x8b')][_0x5ea5b0('0x3f')]},'attributes':['id','name','online',_0x5ea5b0('0x16'),_0x5ea5b0('0x5d')],'raw':!![]});})[_0x11f408('0x10')](function(_0x5aacd6){const _0x5839f0=_0x11f408;if(!_[_0x5839f0('0x81')](_0x5aacd6)){const _0x49f7fa=[];for(let _0x232ece=0x0;_0x232ece<_0x5aacd6[_0x5839f0('0x97')];_0x232ece++){_0x5aacd6[_0x232ece][_0x5839f0('0x6f')]&&_0x49f7fa[_0x5839f0('0x9a')](db[_0x5839f0('0x17')][_0x5839f0('0x59')]({'membername':_0x5aacd6[_0x232ece][_0x5839f0('0x57')],'UserId':_0x5aacd6[_0x232ece]['id'],'queue_name':_0x32d456[_0x5839f0('0x57')],'VoiceQueueId':_0x32d456['id'],'interface':_['isNil'](_0x5aacd6[_0x232ece][_0x5839f0('0x5d')])?util[_0x5839f0('0x8a')](_0x5839f0('0x8'),_0x5aacd6[_0x232ece][_0x5839f0('0x57')]):_0x5aacd6[_0x232ece][_0x5839f0('0x5d')],'paused':_0x5aacd6[_0x232ece][_0x5839f0('0x16')]||![],'penalty':_0x502995[_0x5839f0('0x8b')][_0x5839f0('0x2a')]||0x0}));}return Promise['all'](_0x49f7fa);}})[_0x11f408('0x10')](function(){return _0x4f1e35;})[_0x11f408('0x10')](respondWithResult(_0x5363df,null))[_0x11f408('0x48')](handleError(_0x5363df,null));},exports[_0x4e057b('0x23')]=function(_0x573b84,_0x324d0f){const _0x182cac=_0x4e057b;return db[_0x182cac('0x71')][_0x182cac('0x82')]({'where':{'id':_0x573b84[_0x182cac('0x13')]['id']}})['then'](handleEntityNotFound(_0x324d0f,null))[_0x182cac('0x10')](function(_0x1b5646){const _0x22253e=_0x182cac;if(_0x1b5646)return _0x1b5646[_0x22253e('0x23')](_0x573b84[_0x22253e('0x40')][_0x22253e('0x3f')])[_0x22253e('0x10')](function(){const _0xe25f56=_0x22253e;if(_[_0xe25f56('0x14')](_0x573b84['query'][_0xe25f56('0x3f')]))for(let _0x19e9e8=0x0;_0x19e9e8<_0x573b84[_0xe25f56('0x40')][_0xe25f56('0x3f')][_0xe25f56('0x97')];_0x19e9e8+=0x1){socket[_0xe25f56('0x69')](_0xe25f56('0x61'),{'UserId':Number(_0x573b84[_0xe25f56('0x40')][_0xe25f56('0x3f')][_0x19e9e8]),'VoiceQueueId':Number(_0x573b84['params']['id'])});}else socket['emit'](_0xe25f56('0x61'),{'UserId':Number(_0x573b84[_0xe25f56('0x40')]['ids']),'VoiceQueueId':Number(_0x573b84[_0xe25f56('0x13')]['id'])});});})['then'](function(_0x30e47b){const _0x3771f3=_0x182cac;return db[_0x3771f3('0x17')]['destroy']({'where':{'VoiceQueueId':_0x573b84[_0x3771f3('0x13')]['id'],'UserId':_0x573b84[_0x3771f3('0x40')][_0x3771f3('0x3f')]}})[_0x3771f3('0x10')](function(){return _0x30e47b;});})['then'](respondWithStatusCode(_0x324d0f,null))[_0x182cac('0x48')](handleError(_0x324d0f,null));},exports[_0x4e057b('0x1e')]=function(_0x5b421d,_0x4a185e){const _0x4a5a9a=_0x4e057b;let _0x46e316={};const _0x5caafa={};let _0x5dc763,_0x3ea7a9;return db[_0x4a5a9a('0x71')][_0x4a5a9a('0x82')]({'where':{'id':_0x5b421d[_0x4a5a9a('0x13')]['id']}})['then'](handleEntityNotFound(_0x4a185e,null))[_0x4a5a9a('0x10')](function(_0xa40275){const _0x2be9b5=_0x4a5a9a;if(_0xa40275)return _0x5dc763=_0xa40275,_0x5caafa[_0x2be9b5('0x1f')]=_['keys'](db[_0x2be9b5('0x86')][_0x2be9b5('0x87')]),_0x5caafa[_0x2be9b5('0x40')]=_[_0x2be9b5('0x6e')](_0x5b421d['query']),_0x5caafa[_0x2be9b5('0x9f')]=_['intersection'](_0x5caafa[_0x2be9b5('0x1f')],_0x5caafa['query']),_0x46e316['attributes']=_['intersection'](_0x5caafa[_0x2be9b5('0x1f')],qs[_0x2be9b5('0x45')](_0x5b421d[_0x2be9b5('0x40')][_0x2be9b5('0x45')])),_0x46e316[_0x2be9b5('0x3e')]=_0x46e316[_0x2be9b5('0x3e')]['length']?_0x46e316['attributes']:_0x5caafa[_0x2be9b5('0x1f')],_0x46e316[_0x2be9b5('0x32')]=qs[_0x2be9b5('0x4b')](_0x5b421d[_0x2be9b5('0x40')][_0x2be9b5('0x4b')]),_0x46e316['where']=qs[_0x2be9b5('0x9f')](_[_0x2be9b5('0x31')](_0x5b421d['query'],_0x5caafa[_0x2be9b5('0x9f')])),_0x5b421d[_0x2be9b5('0x40')]['filter']&&(_0x46e316[_0x2be9b5('0x53')]=_[_0x2be9b5('0x75')](_0x46e316['where'],{[Op['or']]:_['map'](_0x46e316['attributes'],function(_0x10403e){const _0x3194aa=_0x2be9b5,_0x11c7c5={};return _0x11c7c5[_0x10403e]={[Op[_0x3194aa('0x4d')]]:'%'+_0x5b421d[_0x3194aa('0x40')][_0x3194aa('0x3d')]+'%'},_0x11c7c5;})})),_0x46e316=_[_0x2be9b5('0x75')]({},_0x46e316,_0x5b421d['options']),_0x5dc763['getAgents'](_0x46e316);})[_0x4a5a9a('0x10')](function(_0x398236){const _0x5d1e07=_0x4a5a9a;if(_0x398236)return _0x3ea7a9=_0x398236[_0x5d1e07('0x97')],typeof _0x5b421d[_0x5d1e07('0x40')]['nolimit']===_0x5d1e07('0x37')&&(_0x46e316[_0x5d1e07('0x4c')]=qs[_0x5d1e07('0x4c')](_0x5b421d[_0x5d1e07('0x40')][_0x5d1e07('0x4c')]),_0x46e316[_0x5d1e07('0x7e')]=qs[_0x5d1e07('0x7e')](_0x5b421d['query'][_0x5d1e07('0x7e')])),_0x5dc763[_0x5d1e07('0x1e')](_0x46e316);})['then'](function(_0x1296c5){if(_0x1296c5)return _0x1296c5?{'count':_0x3ea7a9,'rows':_0x1296c5}:null;})[_0x4a5a9a('0x10')](respondWithResult(_0x4a185e,null))['catch'](handleError(_0x4a185e,null));},exports[_0x4e057b('0x21')]=function(_0x2db18d,_0x35e581){const _0x4138bc=_0x4e057b;let _0x25939d={};const _0x19fa21={};let _0x491830,_0x269523;return db[_0x4138bc('0x71')][_0x4138bc('0x82')]({'where':{'id':_0x2db18d[_0x4138bc('0x13')]['id']}})[_0x4138bc('0x10')](handleEntityNotFound(_0x35e581,null))[_0x4138bc('0x10')](function(_0x4da0a9){const _0x2d87e2=_0x4138bc;if(_0x4da0a9)return _0x491830=_0x4da0a9,_0x19fa21[_0x2d87e2('0x1f')]=_[_0x2d87e2('0x6e')](db[_0x2d87e2('0x17')][_0x2d87e2('0x87')]),_0x19fa21[_0x2d87e2('0x40')]=_[_0x2d87e2('0x6e')](_0x2db18d[_0x2d87e2('0x40')]),_0x19fa21[_0x2d87e2('0x9f')]=_[_0x2d87e2('0xc')](_0x19fa21[_0x2d87e2('0x1f')],_0x19fa21[_0x2d87e2('0x40')]),_0x25939d[_0x2d87e2('0x3e')]=_['intersection'](_0x19fa21[_0x2d87e2('0x1f')],qs[_0x2d87e2('0x45')](_0x2db18d['query']['fields'])),_0x25939d[_0x2d87e2('0x3e')]=_0x25939d['attributes'][_0x2d87e2('0x97')]?_0x25939d['attributes']:_0x19fa21[_0x2d87e2('0x1f')],_0x25939d[_0x2d87e2('0x32')]=qs[_0x2d87e2('0x4b')](_0x2db18d[_0x2d87e2('0x40')]['sort']),_0x25939d[_0x2d87e2('0x53')]=qs['filters'](_['pick'](_0x2db18d['query'],_0x19fa21[_0x2d87e2('0x9f')])),_0x2db18d[_0x2d87e2('0x40')][_0x2d87e2('0x3d')]&&(_0x25939d['where']=_[_0x2d87e2('0x75')](_0x25939d[_0x2d87e2('0x53')],{[Op['or']]:_['map'](_0x25939d[_0x2d87e2('0x3e')],function(_0x366d06){const _0x4288de=_0x2d87e2,_0x171f09={};return _0x171f09[_0x366d06]={[Op[_0x4288de('0x4d')]]:'%'+_0x2db18d[_0x4288de('0x40')][_0x4288de('0x3d')]+'%'},_0x171f09;})})),_0x25939d=_[_0x2d87e2('0x75')]({},_0x25939d,_0x2db18d[_0x2d87e2('0x60')]),_0x491830[_0x2d87e2('0x21')](_0x25939d);})['then'](function(_0xf31b40){const _0x1ae3ac=_0x4138bc;if(_0xf31b40)return _0x269523=_0xf31b40['length'],typeof _0x2db18d[_0x1ae3ac('0x40')][_0x1ae3ac('0x6c')]==='undefined'&&(_0x25939d[_0x1ae3ac('0x4c')]=qs['limit'](_0x2db18d['query']['limit']),_0x25939d['offset']=qs[_0x1ae3ac('0x7e')](_0x2db18d[_0x1ae3ac('0x40')][_0x1ae3ac('0x7e')])),_0x491830[_0x1ae3ac('0x21')](_0x25939d);})[_0x4138bc('0x10')](function(_0x2c206a){return _0x2c206a?{'count':_0x269523,'rows':_0x2c206a}:null;})[_0x4138bc('0x10')](respondWithResult(_0x35e581,null))[_0x4138bc('0x48')](handleError(_0x35e581,null));},exports[_0x4e057b('0x44')]=function(_0x5f4380,_0x3e2da3){const _0x4867ff=_0x4e057b;let _0x4b2833={};const _0x2f3ae2={};let _0x2a3a59,_0x3b5c83;return db[_0x4867ff('0x71')][_0x4867ff('0x82')]({'where':{'id':_0x5f4380['params']['id']}})[_0x4867ff('0x10')](handleEntityNotFound(_0x3e2da3,null))['then'](function(_0x4d6489){const _0x36d229=_0x4867ff;if(_0x4d6489)return _0x2a3a59=_0x4d6489,_0x2f3ae2['model']=_[_0x36d229('0x6e')](db[_0x36d229('0x39')][_0x36d229('0x87')]),_0x2f3ae2[_0x36d229('0x40')]=_[_0x36d229('0x6e')](_0x5f4380[_0x36d229('0x40')]),_0x2f3ae2['filters']=_[_0x36d229('0xc')](_0x2f3ae2[_0x36d229('0x1f')],_0x2f3ae2[_0x36d229('0x40')]),_0x4b2833[_0x36d229('0x3e')]=_[_0x36d229('0xc')](_0x2f3ae2[_0x36d229('0x1f')],qs[_0x36d229('0x45')](_0x5f4380[_0x36d229('0x40')][_0x36d229('0x45')])),_0x4b2833[_0x36d229('0x3e')]=_0x4b2833[_0x36d229('0x3e')][_0x36d229('0x97')]?_0x4b2833[_0x36d229('0x3e')]:_0x2f3ae2[_0x36d229('0x1f')],_0x4b2833[_0x36d229('0x32')]=qs[_0x36d229('0x4b')](_0x5f4380['query'][_0x36d229('0x4b')]),_0x4b2833[_0x36d229('0x53')]=qs[_0x36d229('0x9f')](_[_0x36d229('0x31')](_0x5f4380[_0x36d229('0x40')],_0x2f3ae2[_0x36d229('0x9f')])),_0x5f4380[_0x36d229('0x40')][_0x36d229('0x3d')]&&(_0x4b2833[_0x36d229('0x53')]=_['merge'](_0x4b2833[_0x36d229('0x53')],{[Op['or']]:_['map'](_0x4b2833[_0x36d229('0x3e')],function(_0x4ae158){const _0x5346c7=_0x36d229,_0x54acec={};return _0x54acec[_0x4ae158]={[Op['like']]:'%'+_0x5f4380[_0x5346c7('0x40')][_0x5346c7('0x3d')]+'%'},_0x54acec;})})),_0x4b2833=_[_0x36d229('0x75')]({},_0x4b2833,_0x5f4380[_0x36d229('0x60')]),_0x2a3a59['getLists'](_0x4b2833);})[_0x4867ff('0x10')](function(_0x5c4abe){const _0x3ac459=_0x4867ff;if(_0x5c4abe)return _0x3b5c83=_0x5c4abe['length'],typeof _0x5f4380[_0x3ac459('0x40')]['nolimit']==='undefined'&&(_0x4b2833[_0x3ac459('0x4c')]=qs[_0x3ac459('0x4c')](_0x5f4380['query'][_0x3ac459('0x4c')]),_0x4b2833['offset']=qs['offset'](_0x5f4380['query'][_0x3ac459('0x7e')])),_0x2a3a59[_0x3ac459('0x44')](_0x4b2833);})[_0x4867ff('0x10')](function(_0x469097){if(_0x469097)return _0x469097?{'count':_0x3b5c83,'rows':_0x469097}:null;})[_0x4867ff('0x10')](respondWithResult(_0x3e2da3,null))['catch'](handleError(_0x3e2da3,null));},exports[_0x4e057b('0x29')]=function(_0x172bcc,_0xe5556f){const _0x2fbae8=_0x4e057b;let _0x2ad7fb,_0x232f62;return db['VoiceQueue'][_0x2fbae8('0x82')]({'where':{'id':_0x172bcc[_0x2fbae8('0x13')]['id']}})[_0x2fbae8('0x10')](handleEntityNotFound(_0xe5556f,null))[_0x2fbae8('0x10')](function(_0x47c8cc){const _0x4797a2=_0x2fbae8;if(_0x47c8cc)return _0x232f62=_0x47c8cc,_0x47c8cc[_0x4797a2('0x29')](_0x172bcc['body'][_0x4797a2('0x3f')],{'through':_[_0x4797a2('0x70')](_0x172bcc[_0x4797a2('0x8b')],[_0x4797a2('0x3f'),'id'])});return null;})[_0x2fbae8('0x10')](function(_0x588212){const _0x52ce47=_0x2fbae8;let _0x200c6d;_0x2ad7fb=_0x588212||[];const _0x4e8df5=[];if(_0x588212){for(let _0x2b75ee=0x0;_0x2b75ee<_0x588212[_0x52ce47('0x97')];_0x2b75ee+=0x1){const _0x5006aa=_0x588212[_0x2b75ee]['get']({'plain':!![]});_0x232f62[_0x52ce47('0x5e')]=_0x172bcc[_0x52ce47('0x8b')][_0x52ce47('0x5e')]?_0x172bcc['body'][_0x52ce47('0x5e')]:_0x232f62[_0x52ce47('0x5e')];switch(_0x232f62['dialCheckDuplicateType']){case _0x52ce47('0x88'):_0x200c6d=squel[_0x52ce47('0x36')]()[_0x52ce47('0x55')]('cm_hopper')[_0x52ce47('0x89')](['phone',_0x52ce47('0x6'),'ContactId',_0x52ce47('0x93'),_0x52ce47('0x62'),_0x52ce47('0x91'),_0x52ce47('0x11')],squel['select']()[_0x52ce47('0x1')](_0x52ce47('0x8e'),'phone')[_0x52ce47('0x1')]('NOW()',_0x52ce47('0x6'))[_0x52ce47('0x1')]('id',_0x52ce47('0x99'))['field'](_0x5006aa[_0x52ce47('0x1a')][_0x52ce47('0x22')](),_0x52ce47('0x93'))[_0x52ce47('0x1')](_0x172bcc[_0x52ce47('0x13')]['id']['toString'](),_0x52ce47('0x62'))[_0x52ce47('0x1')]('NOW()',_0x52ce47('0x91'))[_0x52ce47('0x1')]('NOW()',_0x52ce47('0x11'))[_0x52ce47('0x1c')](_0x52ce47('0x1b'))[_0x52ce47('0x53')](_0x52ce47('0x92'))[_0x52ce47('0x53')](_0x52ce47('0x8f'),_0x5006aa[_0x52ce47('0x1a')]['toString']())[_0x52ce47('0x53')](_0x52ce47('0x94'))[_0x52ce47('0x53')](_0x52ce47('0x63'),squel[_0x52ce47('0x83')]()['field'](_0x52ce47('0x2d'))[_0x52ce47('0x1c')](_0x52ce47('0x5c'))['where'](_0x52ce47('0x26'),_0x172bcc[_0x52ce47('0x13')]['id'][_0x52ce47('0x22')]()))[_0x52ce47('0x53')](_0x52ce47('0x63'),squel[_0x52ce47('0x83')]()[_0x52ce47('0x1')](_0x52ce47('0x58'))[_0x52ce47('0x1c')]('cm_hopper')[_0x52ce47('0x53')](_0x52ce47('0x26'),_0x172bcc[_0x52ce47('0x13')]['id'][_0x52ce47('0x22')]())))[_0x52ce47('0x22')]();break;case _0x52ce47('0x49'):_0x200c6d=squel[_0x52ce47('0x36')]()[_0x52ce47('0x55')](_0x52ce47('0xd'))[_0x52ce47('0x89')]([_0x52ce47('0x8e'),_0x52ce47('0x6'),_0x52ce47('0x99'),'ListId',_0x52ce47('0x62'),_0x52ce47('0x91'),_0x52ce47('0x11')],squel['select']()[_0x52ce47('0x1')](_0x52ce47('0x8e'),_0x52ce47('0x8e'))[_0x52ce47('0x1')](_0x52ce47('0x72'),_0x52ce47('0x6'))[_0x52ce47('0x1')]('id','ContactId')[_0x52ce47('0x1')](_0x5006aa[_0x52ce47('0x1a')][_0x52ce47('0x22')](),_0x52ce47('0x93'))['field'](_0x172bcc['params']['id']['toString'](),_0x52ce47('0x62'))['field'](_0x52ce47('0x72'),'createdAt')[_0x52ce47('0x1')](_0x52ce47('0x72'),'updatedAt')[_0x52ce47('0x1c')](_0x52ce47('0x1b'))[_0x52ce47('0x53')]('deletedAt\x20IS\x20NULL')['where'](_0x52ce47('0x8f'),_0x5006aa['CmListId']['toString']())[_0x52ce47('0x53')](_0x52ce47('0x94'))[_0x52ce47('0x53')](_0x52ce47('0x63'),squel[_0x52ce47('0x83')]()[_0x52ce47('0x1')](_0x52ce47('0x58'))['from']('cm_hopper')[_0x52ce47('0x53')](_0x52ce47('0x26'),_0x172bcc['params']['id'][_0x52ce47('0x22')]())))[_0x52ce47('0x22')]();break;default:_0x200c6d=squel[_0x52ce47('0x36')]()[_0x52ce47('0x55')](_0x52ce47('0xd'))[_0x52ce47('0x89')]([_0x52ce47('0x8e'),_0x52ce47('0x6'),'ContactId',_0x52ce47('0x93'),_0x52ce47('0x62'),_0x52ce47('0x91'),_0x52ce47('0x11')],squel[_0x52ce47('0x83')]()[_0x52ce47('0x1')](_0x52ce47('0x8e'),_0x52ce47('0x8e'))[_0x52ce47('0x1')](_0x52ce47('0x72'),'scheduledAt')[_0x52ce47('0x1')]('id',_0x52ce47('0x99'))[_0x52ce47('0x1')](_0x5006aa[_0x52ce47('0x1a')]['toString'](),_0x52ce47('0x93'))[_0x52ce47('0x1')](_0x172bcc[_0x52ce47('0x13')]['id']['toString'](),'VoiceQueueId')['field'](_0x52ce47('0x72'),_0x52ce47('0x91'))[_0x52ce47('0x1')](_0x52ce47('0x72'),'updatedAt')['from']('cm_contacts')[_0x52ce47('0x53')]('deletedAt\x20IS\x20NULL')[_0x52ce47('0x53')](_0x52ce47('0x8f'),_0x5006aa[_0x52ce47('0x1a')][_0x52ce47('0x22')]())['where'](_0x52ce47('0x94')))['toString']();}_0x4e8df5[_0x52ce47('0x9a')](db[_0x52ce47('0x67')][_0x52ce47('0x40')](_0x200c6d));}return Promise[_0x52ce47('0xa')](_0x4e8df5);}})[_0x2fbae8('0x10')](function(){return _0x2ad7fb;})[_0x2fbae8('0x10')](respondWithResult(_0xe5556f,null))[_0x2fbae8('0x48')](handleError(_0xe5556f,null));},exports['removeLists']=function(_0x243c4c,_0x59909b){const _0x3ebe89=_0x4e057b;return db['VoiceQueue'][_0x3ebe89('0x82')]({'where':{'id':_0x243c4c['params']['id']}})[_0x3ebe89('0x10')](handleEntityNotFound(_0x59909b,null))['then'](function(_0x10297a){const _0x168e80=_0x3ebe89;if(_0x10297a)return _0x10297a[_0x168e80('0x34')](_0x243c4c['query'][_0x168e80('0x3f')]);})[_0x3ebe89('0x10')](function(_0x470809){const _0x3ac38b=_0x3ebe89;if(_0x470809)return db['CmHopper'][_0x3ac38b('0x33')]({'where':{'ListId':_0x243c4c[_0x3ac38b('0x40')]['ids'],'VoiceQueueId':_0x243c4c[_0x3ac38b('0x13')]['id']}})[_0x3ac38b('0x10')](function(){return _0x470809;});})[_0x3ebe89('0x10')](respondWithStatusCode(_0x59909b,null))[_0x3ebe89('0x48')](handleError(_0x59909b,null));},exports[_0x4e057b('0xb')]=function(_0x266094,_0x46478c){const _0x23cedd=_0x4e057b;let _0x35ef38={};const _0x2e73a0={};let _0x2135a7,_0x12180b;return db[_0x23cedd('0x71')][_0x23cedd('0x82')]({'where':{'id':_0x266094[_0x23cedd('0x13')]['id']}})[_0x23cedd('0x10')](handleEntityNotFound(_0x46478c,null))[_0x23cedd('0x10')](function(_0xc3db5d){const _0x2ac56e=_0x23cedd;if(_0xc3db5d)return _0x2135a7=_0xc3db5d,_0x2e73a0['model']=_[_0x2ac56e('0x6e')](db[_0x2ac56e('0x39')][_0x2ac56e('0x87')]),_0x2e73a0[_0x2ac56e('0x40')]=_[_0x2ac56e('0x6e')](_0x266094[_0x2ac56e('0x40')]),_0x2e73a0['filters']=_['intersection'](_0x2e73a0[_0x2ac56e('0x1f')],_0x2e73a0[_0x2ac56e('0x40')]),_0x35ef38[_0x2ac56e('0x3e')]=_[_0x2ac56e('0xc')](_0x2e73a0['model'],qs[_0x2ac56e('0x45')](_0x266094['query'][_0x2ac56e('0x45')])),_0x35ef38[_0x2ac56e('0x3e')]=_0x35ef38[_0x2ac56e('0x3e')]['length']?_0x35ef38[_0x2ac56e('0x3e')]:_0x2e73a0[_0x2ac56e('0x1f')],_0x35ef38['order']=qs[_0x2ac56e('0x4b')](_0x266094[_0x2ac56e('0x40')]['sort']),_0x35ef38[_0x2ac56e('0x53')]=qs[_0x2ac56e('0x9f')](_['pick'](_0x266094['query'],_0x2e73a0['filters'])),_0x266094[_0x2ac56e('0x40')][_0x2ac56e('0x3d')]&&(_0x35ef38['where']=_['merge'](_0x35ef38[_0x2ac56e('0x53')],{[Op['or']]:_[_0x2ac56e('0x43')](_0x35ef38[_0x2ac56e('0x3e')],function(_0x533e3d){const _0x3bcba2=_0x2ac56e,_0x384df4={};return _0x384df4[_0x533e3d]={[Op[_0x3bcba2('0x4d')]]:'%'+_0x266094[_0x3bcba2('0x40')][_0x3bcba2('0x3d')]+'%'},_0x384df4;})})),_0x35ef38=_[_0x2ac56e('0x75')]({},_0x35ef38,_0x266094['options']),_0x2135a7[_0x2ac56e('0xb')](_0x35ef38);})[_0x23cedd('0x10')](function(_0x5bfc01){const _0x1865df=_0x23cedd;if(_0x5bfc01)return _0x12180b=_0x5bfc01[_0x1865df('0x97')],typeof _0x266094[_0x1865df('0x40')][_0x1865df('0x6c')]===_0x1865df('0x37')&&(_0x35ef38[_0x1865df('0x4c')]=qs[_0x1865df('0x4c')](_0x266094['query']['limit']),_0x35ef38['offset']=qs[_0x1865df('0x7e')](_0x266094['query']['offset'])),_0x2135a7[_0x1865df('0xb')](_0x35ef38);})[_0x23cedd('0x10')](function(_0x5bcbf2){if(_0x5bcbf2)return _0x5bcbf2?{'count':_0x12180b,'rows':_0x5bcbf2}:null;})[_0x23cedd('0x10')](respondWithResult(_0x46478c,null))['catch'](handleError(_0x46478c,null));},exports['addBlackLists']=function(_0x186409,_0x20c898){const _0x1abdb7=_0x4e057b;let _0x342e90;return db[_0x1abdb7('0x71')][_0x1abdb7('0x82')]({'where':{'id':_0x186409[_0x1abdb7('0x13')]['id']}})[_0x1abdb7('0x10')](handleEntityNotFound(_0x20c898,null))['then'](function(_0x230ff4){const _0x56df10=_0x1abdb7;if(_0x230ff4)return _0x230ff4[_0x56df10('0xe')](_0x186409[_0x56df10('0x8b')]['ids'],{'through':_[_0x56df10('0x70')](_0x186409[_0x56df10('0x8b')],[_0x56df10('0x3f'),'id'])});return null;})['then'](function(_0x31e228){const _0x1f4918=_0x1abdb7;let _0xfde417;_0x342e90=_0x31e228||[];const _0x485c05=[];if(_0x31e228){for(let _0x5a8040=0x0;_0x5a8040<_0x31e228[_0x1f4918('0x97')];_0x5a8040+=0x1){const _0x394c1b=_0x31e228[_0x5a8040][_0x1f4918('0x78')]({'plain':!![]});_0xfde417=squel[_0x1f4918('0x36')]()[_0x1f4918('0x55')](_0x1f4918('0x64'))[_0x1f4918('0x89')]([_0x1f4918('0x8e'),_0x1f4918('0x99'),_0x1f4918('0x93'),_0x1f4918('0x62'),'createdAt',_0x1f4918('0x11')],squel[_0x1f4918('0x83')]()[_0x1f4918('0x1')]('phone','phone')[_0x1f4918('0x1')]('id',_0x1f4918('0x99'))['field'](_0x394c1b[_0x1f4918('0x1a')][_0x1f4918('0x22')](),_0x1f4918('0x93'))[_0x1f4918('0x1')](_0x186409['params']['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0x1f4918('0x91'))['field'](_0x1f4918('0x72'),_0x1f4918('0x11'))[_0x1f4918('0x1c')](_0x1f4918('0x1b'))[_0x1f4918('0x53')](_0x1f4918('0x92'))[_0x1f4918('0x53')](_0x1f4918('0x8f'),_0x394c1b[_0x1f4918('0x1a')][_0x1f4918('0x22')]())['where'](_0x1f4918('0x94')))[_0x1f4918('0x22')](),_0x485c05[_0x1f4918('0x9a')](db['sequelize'][_0x1f4918('0x40')](_0xfde417));}return Promise['all'](_0x485c05);}})[_0x1abdb7('0x10')](function(){return _0x342e90;})[_0x1abdb7('0x10')](respondWithResult(_0x20c898,null))[_0x1abdb7('0x48')](handleError(_0x20c898,null));},exports[_0x4e057b('0xf')]=function(_0x55d8b7,_0x30af0a){const _0x247d0b=_0x4e057b;return db[_0x247d0b('0x71')][_0x247d0b('0x82')]({'where':{'id':_0x55d8b7[_0x247d0b('0x13')]['id']}})[_0x247d0b('0x10')](handleEntityNotFound(_0x30af0a,null))[_0x247d0b('0x10')](function(_0x382ba2){const _0x18d5df=_0x247d0b;if(_0x382ba2)return _0x382ba2[_0x18d5df('0xf')](_0x55d8b7[_0x18d5df('0x40')][_0x18d5df('0x3f')]);})['then'](function(_0x6f4e0f){const _0x32a721=_0x247d0b;if(_0x6f4e0f)return db[_0x32a721('0x42')][_0x32a721('0x33')]({'where':{'ListId':_0x55d8b7[_0x32a721('0x40')][_0x32a721('0x3f')],'VoiceQueueId':_0x55d8b7['params']['id']}})[_0x32a721('0x10')](function(){return _0x6f4e0f;});})[_0x247d0b('0x10')](respondWithStatusCode(_0x30af0a,null))[_0x247d0b('0x48')](handleError(_0x30af0a,null));};
\ No newline at end of file