Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 329845c..60e63c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3f9=['VIRTUAL','merge','options','includeAll','include','catch','show','create','body','user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','QueueCampaigns','UserProfileSection','update','getHoppers','findOne','CmHopper','nolimit','pick','findAll','getHopperHistories','CmHopperHistory','VoiceQueueId','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','TeamVoiceQueue','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','all','union','compact','transaction','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','interface','isArray','getAgents','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0xcc956e,_0x5b8076){var _0x352d62=function(_0x5e7a59){while(--_0x5e7a59){_0xcc956e['push'](_0xcc956e['shift']());}};_0x352d62(++_0x5b8076);}(_0xb3f9,0x7a));var _0x9b3f=function(_0xb1b3a6,_0x38623f){_0xb1b3a6=_0xb1b3a6-0x0;var _0x4e074e=_0xb3f9[_0xb1b3a6];return _0x4e074e;};'use strict';var emlformat=require(_0x9b3f('0x0'));var rimraf=require(_0x9b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b3f('0x2'));var moment=require('moment');var BPromise=require(_0x9b3f('0x3'));var Mustache=require(_0x9b3f('0x4'));var util=require(_0x9b3f('0x5'));var path=require(_0x9b3f('0x6'));var sox=require(_0x9b3f('0x7'));var csv=require(_0x9b3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b3f('0x9'));var squel=require(_0x9b3f('0xa'));var crypto=require('crypto');var jsforce=require(_0x9b3f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b3f('0xc'));var Redis=require('ioredis');var authService=require(_0x9b3f('0xd'));var qs=require(_0x9b3f('0xe'));var as=require(_0x9b3f('0xf'));var hardwareService=require(_0x9b3f('0x10'));var logger=require(_0x9b3f('0x11'))('api');var utils=require(_0x9b3f('0x12'));var config=require(_0x9b3f('0x13'));var licenseUtil=require(_0x9b3f('0x14'));var db=require(_0x9b3f('0x15'))['db'];config[_0x9b3f('0x16')]=_[_0x9b3f('0x17')](config[_0x9b3f('0x16')],{'host':_0x9b3f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9b3f('0x19'))[_0x9b3f('0x1a')](socket);function respondWithStatusCode(_0x27dab5,_0x377bfa){_0x377bfa=_0x377bfa||0xcc;return function(_0x76978e){if(_0x76978e){return _0x27dab5['sendStatus'](_0x377bfa);}return _0x27dab5['status'](_0x377bfa)['end']();};}function respondWithResult(_0x34fb19,_0x427992){_0x427992=_0x427992||0xc8;return function(_0x484323){if(_0x484323){return _0x34fb19[_0x9b3f('0x1b')](_0x427992)[_0x9b3f('0x1c')](_0x484323);}};}function respondWithFilteredResult(_0x2cdc7c,_0x5f5c1c){return function(_0x579c32){if(_0x579c32){var _0x2f2a53=typeof _0x5f5c1c[_0x9b3f('0x1d')]===_0x9b3f('0x1e')&&typeof _0x5f5c1c[_0x9b3f('0x1f')]===_0x9b3f('0x1e');var _0x297fa8=_0x579c32[_0x9b3f('0x20')];var _0x17f2d3=_0x2f2a53?0x0:_0x5f5c1c[_0x9b3f('0x1d')];var _0x13e65b=_0x2f2a53?_0x579c32[_0x9b3f('0x20')]:_0x5f5c1c[_0x9b3f('0x1d')]+_0x5f5c1c[_0x9b3f('0x1f')];var _0x1218c0;if(_0x13e65b>=_0x297fa8){_0x13e65b=_0x297fa8;_0x1218c0=0xc8;}else{_0x1218c0=0xce;}_0x2cdc7c[_0x9b3f('0x1b')](_0x1218c0);return _0x2cdc7c[_0x9b3f('0x21')](_0x9b3f('0x22'),_0x17f2d3+'-'+_0x13e65b+'/'+_0x297fa8)[_0x9b3f('0x1c')](_0x579c32);}return null;};}function patchUpdates(_0x3360d6){return function(_0x5b4f21){try{jsonpatch[_0x9b3f('0x23')](_0x5b4f21,_0x3360d6,!![]);}catch(_0x4db496){return BPromise[_0x9b3f('0x24')](_0x4db496);}return _0x5b4f21['save']();};}function saveUpdates(_0x3c9d8d,_0x28dd96){return function(_0x16452e){if(_0x16452e){return _0x16452e['update'](_0x3c9d8d)[_0x9b3f('0x25')](function(_0x483eb3){return _0x483eb3;});}return null;};}function removeEntity(_0x325c74,_0x526355){return function(_0x1b3ba8){if(_0x1b3ba8){return _0x1b3ba8[_0x9b3f('0x26')]()['then'](function(){var _0x248c9d=_0x1b3ba8[_0x9b3f('0x27')]({'plain':!![]});var _0x2dfef4=[{'name':_0x9b3f('0x28'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x9b3f('0x29'),'ignore':![]}];var _0x555bf4=_(_0x2dfef4)[_0x9b3f('0x2a')]('ignore')[_0x9b3f('0x2b')](_0x9b3f('0x2c'))[_0x9b3f('0x2c')]();if(_[_0x9b3f('0x2d')](_0x555bf4,_0x248c9d[_0x9b3f('0x2e')])){return;}var _0x590e9c=_[_0x9b3f('0x2f')](_0x2dfef4,[_0x9b3f('0x2c'),_0x248c9d[_0x9b3f('0x2e')]])[_0x9b3f('0x30')];return db[_0x9b3f('0x31')][_0x9b3f('0x26')]({'where':{'type':_0x590e9c,'resourceId':_0x248c9d['id']}})[_0x9b3f('0x25')](function(){return _0x1b3ba8;});})['then'](function(){_0x325c74['status'](0xcc)[_0x9b3f('0x32')]();});}};}function handleEntityNotFound(_0x4ddecb,_0x53bf78){return function(_0x20b019){if(!_0x20b019){_0x4ddecb['sendStatus'](0x194);}return _0x20b019;};}function handleError(_0x44dab3,_0x1a123a){_0x1a123a=_0x1a123a||0x1f4;return function(_0x294506){logger[_0x9b3f('0x33')](_0x294506[_0x9b3f('0x34')]);if(_0x294506['name']){delete _0x294506[_0x9b3f('0x30')];}_0x44dab3[_0x9b3f('0x1b')](_0x1a123a)[_0x9b3f('0x35')](_0x294506);};}exports[_0x9b3f('0x36')]=function(_0x378e87,_0x365df5){var _0x5c7a9d={},_0x1ae307={},_0x4082cb={'count':0x0,'rows':[]};var _0x222118=_['map'](db[_0x9b3f('0x37')][_0x9b3f('0x38')],function(_0x23d4d6){return{'name':_0x23d4d6[_0x9b3f('0x39')],'type':_0x23d4d6[_0x9b3f('0x2e')][_0x9b3f('0x3a')]};});_0x1ae307[_0x9b3f('0x3b')]=_[_0x9b3f('0x2b')](_0x222118,_0x9b3f('0x30'));_0x1ae307[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x378e87[_0x9b3f('0x3c')]);_0x1ae307[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x1ae307[_0x9b3f('0x3b')],_0x1ae307['query']);_0x5c7a9d[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x1ae307[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x5c7a9d[_0x9b3f('0x40')]=_0x5c7a9d['attributes'][_0x9b3f('0x42')]?_0x5c7a9d[_0x9b3f('0x40')]:_0x1ae307['model'];if(!_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x43')]('nolimit')){_0x5c7a9d[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x378e87[_0x9b3f('0x3c')]['limit']);_0x5c7a9d[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}_0x5c7a9d[_0x9b3f('0x44')]=qs['sort'](_0x378e87['query'][_0x9b3f('0x45')]);_0x5c7a9d[_0x9b3f('0x46')]=qs['filters'](_['pick'](_0x378e87[_0x9b3f('0x3c')],_0x1ae307['filters']),_0x222118);if(_0x378e87[_0x9b3f('0x3c')]['filter']){_0x5c7a9d[_0x9b3f('0x46')]=_['merge'](_0x5c7a9d['where'],{'$or':_[_0x9b3f('0x2b')](_0x222118,function(_0x3ff5f5){if(_0x3ff5f5[_0x9b3f('0x2e')]!==_0x9b3f('0x47')){var _0x588e84={};_0x588e84[_0x3ff5f5['name']]={'$like':'%'+_0x378e87[_0x9b3f('0x3c')]['filter']+'%'};return _0x588e84;}})});}_0x5c7a9d=_[_0x9b3f('0x48')]({},_0x5c7a9d,_0x378e87[_0x9b3f('0x49')]);var _0x503210={'where':_0x5c7a9d[_0x9b3f('0x46')]};return db[_0x9b3f('0x37')][_0x9b3f('0x20')](_0x503210)[_0x9b3f('0x25')](function(_0x5bb2a7){_0x4082cb[_0x9b3f('0x20')]=_0x5bb2a7;if(_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x5c7a9d[_0x9b3f('0x4b')]=[{'all':!![]}];}return db[_0x9b3f('0x37')]['findAll'](_0x5c7a9d);})[_0x9b3f('0x25')](function(_0x2cb8e0){_0x4082cb['rows']=_0x2cb8e0;return _0x4082cb;})[_0x9b3f('0x25')](respondWithFilteredResult(_0x365df5,_0x5c7a9d))[_0x9b3f('0x4c')](handleError(_0x365df5,null));};exports[_0x9b3f('0x4d')]=function(_0x735da1,_0x2efc70){var _0xdf1738={'raw':![],'where':{'id':_0x735da1['params']['id']}},_0x24d87c={};_0x24d87c[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x37')][_0x9b3f('0x38')]);_0x24d87c[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x735da1[_0x9b3f('0x3c')]);_0x24d87c[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x24d87c['model'],_0x24d87c[_0x9b3f('0x3c')]);_0xdf1738['attributes']=_[_0x9b3f('0x3f')](_0x24d87c[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x735da1[_0x9b3f('0x3c')]['fields']));_0xdf1738[_0x9b3f('0x40')]=_0xdf1738[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0xdf1738[_0x9b3f('0x40')]:_0x24d87c['model'];if(_0x735da1['query']['includeAll']){_0xdf1738['include']=[{'all':!![]}];}_0xdf1738=_[_0x9b3f('0x48')]({},_0xdf1738,_0x735da1[_0x9b3f('0x49')]);return db[_0x9b3f('0x37')][_0x9b3f('0x2f')](_0xdf1738)[_0x9b3f('0x25')](handleEntityNotFound(_0x2efc70,null))['then'](respondWithResult(_0x2efc70,null))[_0x9b3f('0x4c')](handleError(_0x2efc70,null));};exports['create']=function(_0x330975,_0x3c6950){return db['VoiceQueue'][_0x9b3f('0x4e')](_0x330975[_0x9b3f('0x4f')],{})[_0x9b3f('0x25')](function(_0x42b751){var _0x36320e=_0x330975[_0x9b3f('0x50')][_0x9b3f('0x27')]({'plain':!![]});if(!_0x36320e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36320e[_0x9b3f('0x51')]==='user'){var _0x9503f0=_0x42b751[_0x9b3f('0x27')]({'plain':!![]});var _0x7839f9=[{'name':_0x9b3f('0x28'),'value':_0x9b3f('0x52')},{'name':'QueueCampaigns','value':_0x9b3f('0x29')}];var _0xbea8cb=_['find'](_0x7839f9,[_0x9b3f('0x2c'),_0x9503f0[_0x9b3f('0x2e')]])[_0x9b3f('0x30')];return db['UserProfileSection'][_0x9b3f('0x2f')]({'where':{'name':_0xbea8cb,'userProfileId':_0x36320e[_0x9b3f('0x53')]},'raw':!![]})['then'](function(_0x4652c4){if(_0x4652c4&&_0x4652c4[_0x9b3f('0x54')]===0x0){return db[_0x9b3f('0x31')][_0x9b3f('0x4e')]({'name':_0x9503f0[_0x9b3f('0x30')],'resourceId':_0x9503f0['id'],'type':_0x4652c4['name'],'sectionId':_0x4652c4['id']},{})[_0x9b3f('0x25')](function(){return _0x42b751;});}else{return _0x42b751;}})[_0x9b3f('0x4c')](function(_0x36eb9c){logger[_0x9b3f('0x33')](_0x9b3f('0x55'),_0x36eb9c);throw _0x36eb9c;});}return _0x42b751;})[_0x9b3f('0x25')](respondWithResult(_0x3c6950,0xc9))[_0x9b3f('0x4c')](handleError(_0x3c6950,null));};exports[_0x9b3f('0x56')]=function(_0x323c6d,_0x3dd4fc){var _0x2dc3b2={'where':{'id':_0x323c6d[_0x9b3f('0x57')]['id']}},_0x11011e={};_0x11011e[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db['VoiceQueue'][_0x9b3f('0x38')]);_0x2dc3b2[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x11011e[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x323c6d[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x2dc3b2[_0x9b3f('0x40')]=_0x2dc3b2['attributes'][_0x9b3f('0x42')]?_0x2dc3b2['attributes']:_0x11011e[_0x9b3f('0x3b')];if(_0x323c6d[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x2dc3b2[_0x9b3f('0x4b')]=[{'all':!![]}];}_0x2dc3b2=_[_0x9b3f('0x48')]({},_0x2dc3b2,_0x323c6d[_0x9b3f('0x49')]);return db[_0x9b3f('0x37')][_0x9b3f('0x2f')](_0x2dc3b2)[_0x9b3f('0x25')](handleEntityNotFound(_0x3dd4fc,null))[_0x9b3f('0x25')](function(_0x51adab){if(_0x51adab){var _0x461999=_0x51adab[_0x9b3f('0x27')]({'plain':!![]});_0x461999=qs[_0x9b3f('0x58')](_0x461999,['id',_0x9b3f('0x59'),_0x9b3f('0x5a')]);_0x323c6d['body']=_[_0x9b3f('0x58')](_0x323c6d[_0x9b3f('0x4f')],['id','createdAt',_0x9b3f('0x5a')]);return db['VoiceQueue']['create'](_['merge'](_0x461999,_0x323c6d['body']),{'include':_0x323c6d[_0x9b3f('0x3c')][_0x9b3f('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x514aac){var _0x24a45a=_0x323c6d[_0x9b3f('0x50')][_0x9b3f('0x27')]({'plain':!![]});if(!_0x24a45a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24a45a[_0x9b3f('0x51')]==='user'){var _0x4b0575=_0x514aac['get']({'plain':!![]});var _0x56631b=[{'name':'VoiceQueues','value':_0x9b3f('0x52')},{'name':_0x9b3f('0x5b'),'value':_0x9b3f('0x29')}];var _0x1bfaad=_[_0x9b3f('0x2f')](_0x56631b,[_0x9b3f('0x2c'),_0x4b0575[_0x9b3f('0x2e')]])['name'];return db[_0x9b3f('0x5c')][_0x9b3f('0x2f')]({'where':{'name':_0x1bfaad,'userProfileId':_0x24a45a[_0x9b3f('0x53')]},'raw':!![]})[_0x9b3f('0x25')](function(_0x44ec13){if(_0x44ec13&&_0x44ec13['autoAssociation']===0x0){return db['UserProfileResource'][_0x9b3f('0x4e')]({'name':_0x4b0575[_0x9b3f('0x30')],'resourceId':_0x4b0575['id'],'type':_0x44ec13['name'],'sectionId':_0x44ec13['id']},{})[_0x9b3f('0x25')](function(){return _0x514aac;});}else{return _0x514aac;}})[_0x9b3f('0x4c')](function(_0x3fdfe9){logger[_0x9b3f('0x33')](_0x9b3f('0x55'),_0x3fdfe9);throw _0x3fdfe9;});}return _0x514aac;});}})['then'](respondWithResult(_0x3dd4fc,0xc9))[_0x9b3f('0x4c')](handleError(_0x3dd4fc,null));};exports[_0x9b3f('0x5d')]=function(_0x41fff0,_0x430570){if(_0x41fff0['body']['id']){delete _0x41fff0[_0x9b3f('0x4f')]['id'];}return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x41fff0['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x430570,null))['then'](saveUpdates(_0x41fff0[_0x9b3f('0x4f')],null))[_0x9b3f('0x25')](respondWithResult(_0x430570,null))[_0x9b3f('0x4c')](handleError(_0x430570,null));};exports[_0x9b3f('0x26')]=function(_0x39fdb1,_0x25b2a5){return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x39fdb1[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x25b2a5,null))[_0x9b3f('0x25')](removeEntity(_0x25b2a5,null))[_0x9b3f('0x4c')](handleError(_0x25b2a5,null));};exports[_0x9b3f('0x5e')]=function(_0x37d719,_0x2896de,_0x43751c){var _0x479657={'raw':![],'where':{}};var _0x5ab9f4={};var _0xca9f52={'count':0x0,'rows':[]};return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x37d719[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x2896de,null))[_0x9b3f('0x25')](function(_0x3b2b87){if(_0x3b2b87){_0x5ab9f4[_0x9b3f('0x3b')]=_['keys'](db[_0x9b3f('0x60')][_0x9b3f('0x38')]);_0x5ab9f4[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x37d719[_0x9b3f('0x3c')]);_0x5ab9f4[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x5ab9f4[_0x9b3f('0x3b')],_0x5ab9f4[_0x9b3f('0x3c')]);_0x479657['attributes']=_[_0x9b3f('0x3f')](_0x5ab9f4['model'],qs[_0x9b3f('0x41')](_0x37d719[_0x9b3f('0x3c')]['fields']));_0x479657[_0x9b3f('0x40')]=_0x479657[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x479657[_0x9b3f('0x40')]:_0x5ab9f4[_0x9b3f('0x3b')];if(!_0x37d719['query'][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x479657[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x479657[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x37d719[_0x9b3f('0x3c')]['offset']);}_0x479657[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x479657[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0x37d719[_0x9b3f('0x3c')],_0x5ab9f4['filters']));_0x479657[_0x9b3f('0x46')]['VoiceQueueId']=_0x3b2b87['id'];if(_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x479657[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x479657['where'],{'$or':_[_0x9b3f('0x2b')](_0x479657[_0x9b3f('0x40')],function(_0xf7412c){var _0x4b94f3={};_0x4b94f3[_0xf7412c]={'$like':'%'+_0x37d719['query'][_0x9b3f('0x2a')]+'%'};return _0x4b94f3;})});}_0x479657=_[_0x9b3f('0x48')]({},_0x479657,_0x37d719[_0x9b3f('0x49')]);return db['CmHopper']['count']({'where':_0x479657[_0x9b3f('0x46')]})['then'](function(_0x48a45c){_0xca9f52[_0x9b3f('0x20')]=_0x48a45c;if(_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x479657['include']=[{'all':!![]}];}return db['CmHopper'][_0x9b3f('0x63')](_0x479657);})[_0x9b3f('0x25')](function(_0x5d7cf7){_0xca9f52['rows']=_0x5d7cf7;return _0xca9f52;});}})[_0x9b3f('0x25')](respondWithFilteredResult(_0x2896de,_0x479657))[_0x9b3f('0x4c')](handleError(_0x2896de,null));};exports[_0x9b3f('0x64')]=function(_0x22d633,_0x37bcc2,_0x81d2a0){var _0x8cdf78={'raw':!![],'where':{}};var _0x57d301={};var _0xbb6d44={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x22d633[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x37bcc2,null))[_0x9b3f('0x25')](function(_0x21ab78){if(_0x21ab78){_0x57d301[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x65')]['rawAttributes']);_0x57d301[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x22d633[_0x9b3f('0x3c')]);_0x57d301[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x57d301[_0x9b3f('0x3b')],_0x57d301['query']);_0x8cdf78[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x57d301['model'],qs['fields'](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x8cdf78[_0x9b3f('0x40')]=_0x8cdf78['attributes']['length']?_0x8cdf78[_0x9b3f('0x40')]:_0x57d301[_0x9b3f('0x3b')];if(!_0x22d633['query'][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x8cdf78[_0x9b3f('0x1f')]=qs['limit'](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x8cdf78[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}_0x8cdf78[_0x9b3f('0x44')]=qs['sort'](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x8cdf78[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0x22d633[_0x9b3f('0x3c')],_0x57d301[_0x9b3f('0x3e')]));_0x8cdf78[_0x9b3f('0x46')][_0x9b3f('0x66')]=_0x21ab78['id'];if(_0x22d633[_0x9b3f('0x3c')]['filter']){_0x8cdf78['where']=_[_0x9b3f('0x48')](_0x8cdf78[_0x9b3f('0x46')],{'$or':_[_0x9b3f('0x2b')](_0x8cdf78[_0x9b3f('0x40')],function(_0x7e5dce){var _0x19c42b={};_0x19c42b[_0x7e5dce]={'$like':'%'+_0x22d633['query']['filter']+'%'};return _0x19c42b;})});}_0x8cdf78=_[_0x9b3f('0x48')]({},_0x8cdf78,_0x22d633[_0x9b3f('0x49')]);return db[_0x9b3f('0x65')]['count']({'where':_0x8cdf78['where']})[_0x9b3f('0x25')](function(_0x573abe){_0xbb6d44[_0x9b3f('0x20')]=_0x573abe;if(_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x8cdf78['include']=[{'all':!![]}];}return db[_0x9b3f('0x65')][_0x9b3f('0x63')](_0x8cdf78);})['then'](function(_0xd911b7){_0xbb6d44[_0x9b3f('0x67')]=_0xd911b7;return _0xbb6d44;});}})['then'](respondWithFilteredResult(_0x37bcc2,_0x8cdf78))['catch'](handleError(_0x37bcc2,null));};exports['getHopperFinals']=function(_0x13d7f5,_0x27584f,_0x296989){var _0x1b4a44={'raw':!![],'where':{}};var _0x468cb2={};var _0x53d7ef={'count':0x0,'rows':[]};return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x13d7f5['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x27584f,null))[_0x9b3f('0x25')](function(_0x4174cb){if(_0x4174cb){_0x468cb2['model']=_[_0x9b3f('0x3d')](db[_0x9b3f('0x68')][_0x9b3f('0x38')]);_0x468cb2[_0x9b3f('0x3c')]=_['keys'](_0x13d7f5[_0x9b3f('0x3c')]);_0x468cb2[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x468cb2[_0x9b3f('0x3b')],_0x468cb2[_0x9b3f('0x3c')]);_0x1b4a44[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x468cb2[_0x9b3f('0x3b')],qs['fields'](_0x13d7f5['query']['fields']));_0x1b4a44['attributes']=_0x1b4a44[_0x9b3f('0x40')]['length']?_0x1b4a44[_0x9b3f('0x40')]:_0x468cb2['model'];if(!_0x13d7f5['query'][_0x9b3f('0x43')]('nolimit')){_0x1b4a44[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x13d7f5['query']['limit']);_0x1b4a44[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x13d7f5[_0x9b3f('0x3c')]['offset']);}_0x1b4a44[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x13d7f5['query'][_0x9b3f('0x45')]);_0x1b4a44[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x13d7f5[_0x9b3f('0x3c')],_0x468cb2[_0x9b3f('0x3e')]));_0x1b4a44[_0x9b3f('0x46')]['VoiceQueueId']=_0x4174cb['id'];if(_0x13d7f5['query'][_0x9b3f('0x2a')]){_0x1b4a44['where']=_['merge'](_0x1b4a44[_0x9b3f('0x46')],{'$or':_['map'](_0x1b4a44[_0x9b3f('0x40')],function(_0x3476d7){var _0x1891fa={};_0x1891fa[_0x3476d7]={'$like':'%'+_0x13d7f5[_0x9b3f('0x3c')]['filter']+'%'};return _0x1891fa;})});}_0x1b4a44=_[_0x9b3f('0x48')]({},_0x1b4a44,_0x13d7f5[_0x9b3f('0x49')]);return db['CmHopperFinal'][_0x9b3f('0x20')]({'where':_0x1b4a44['where']})[_0x9b3f('0x25')](function(_0x3b9018){_0x53d7ef[_0x9b3f('0x20')]=_0x3b9018;if(_0x13d7f5['query'][_0x9b3f('0x4a')]){_0x1b4a44[_0x9b3f('0x4b')]=[{'all':!![]}];}return db[_0x9b3f('0x68')][_0x9b3f('0x63')](_0x1b4a44);})[_0x9b3f('0x25')](function(_0x357cc1){_0x53d7ef[_0x9b3f('0x67')]=_0x357cc1;return _0x53d7ef;});}})[_0x9b3f('0x25')](respondWithFilteredResult(_0x27584f,_0x1b4a44))[_0x9b3f('0x4c')](handleError(_0x27584f,null));};exports[_0x9b3f('0x69')]=function(_0x279406,_0x136498,_0xf47c7){var _0x38a399={'raw':!![],'where':{}};var _0x3625ec={};var _0x2d9f95={'count':0x0,'rows':[]};return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x279406[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x136498,null))['then'](function(_0x5a4418){if(_0x5a4418){_0x3625ec[_0x9b3f('0x3b')]=_['keys'](db[_0x9b3f('0x6a')][_0x9b3f('0x38')]);_0x3625ec['query']=_[_0x9b3f('0x3d')](_0x279406[_0x9b3f('0x3c')]);_0x3625ec[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x3625ec[_0x9b3f('0x3b')],_0x3625ec[_0x9b3f('0x3c')]);_0x38a399[_0x9b3f('0x40')]=_['intersection'](_0x3625ec[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x38a399['attributes']=_0x38a399[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x38a399[_0x9b3f('0x40')]:_0x3625ec['model'];if(!_0x279406[_0x9b3f('0x3c')]['hasOwnProperty']('nolimit')){_0x38a399['limit']=qs['limit'](_0x279406['query']['limit']);_0x38a399['offset']=qs[_0x9b3f('0x1d')](_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}_0x38a399[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x38a399[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0x279406[_0x9b3f('0x3c')],_0x3625ec['filters']));_0x38a399[_0x9b3f('0x46')][_0x9b3f('0x66')]=_0x5a4418['id'];if(_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x38a399['where']=_[_0x9b3f('0x48')](_0x38a399[_0x9b3f('0x46')],{'$or':_[_0x9b3f('0x2b')](_0x38a399['attributes'],function(_0x164294){var _0x509551={};_0x509551[_0x164294]={'$like':'%'+_0x279406[_0x9b3f('0x3c')]['filter']+'%'};return _0x509551;})});}_0x38a399=_[_0x9b3f('0x48')]({},_0x38a399,_0x279406['options']);return db[_0x9b3f('0x6a')]['count']({'where':_0x38a399['where']})[_0x9b3f('0x25')](function(_0xc4af69){_0x2d9f95[_0x9b3f('0x20')]=_0xc4af69;if(_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x38a399[_0x9b3f('0x4b')]=[{'all':!![]}];}return db[_0x9b3f('0x6a')][_0x9b3f('0x63')](_0x38a399);})[_0x9b3f('0x25')](function(_0x5cc7bf){_0x2d9f95[_0x9b3f('0x67')]=_0x5cc7bf;return _0x2d9f95;});}})[_0x9b3f('0x25')](respondWithFilteredResult(_0x136498,_0x38a399))[_0x9b3f('0x4c')](handleError(_0x136498,null));};exports['getTeams']=function(_0x91daa8,_0x23e6db,_0x3fdd88){var _0x179905={};var _0x1e53c0={};var _0x27b517;var _0x3b2150;return db['VoiceQueue'][_0x9b3f('0x5f')]({'where':{'id':_0x91daa8['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x23e6db,null))[_0x9b3f('0x25')](function(_0x38b675){if(_0x38b675){_0x27b517=_0x38b675;_0x1e53c0['model']=_[_0x9b3f('0x3d')](db[_0x9b3f('0x6b')][_0x9b3f('0x38')]);_0x1e53c0[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x91daa8['query']);_0x1e53c0[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x1e53c0[_0x9b3f('0x3b')],_0x1e53c0['query']);_0x179905[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x1e53c0['model'],qs[_0x9b3f('0x41')](_0x91daa8[_0x9b3f('0x3c')]['fields']));_0x179905[_0x9b3f('0x40')]=_0x179905[_0x9b3f('0x40')]['length']?_0x179905[_0x9b3f('0x40')]:_0x1e53c0[_0x9b3f('0x3b')];_0x179905[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x91daa8[_0x9b3f('0x3c')]['sort']);_0x179905[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x91daa8[_0x9b3f('0x3c')],_0x1e53c0[_0x9b3f('0x3e')]));if(_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x179905[_0x9b3f('0x46')]=_['merge'](_0x179905[_0x9b3f('0x46')],{'$or':_[_0x9b3f('0x2b')](_0x179905[_0x9b3f('0x40')],function(_0x59e63b){var _0x27f5cf={};_0x27f5cf[_0x59e63b]={'$like':'%'+_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x27f5cf;})});}_0x179905=_[_0x9b3f('0x48')]({},_0x179905,_0x91daa8[_0x9b3f('0x49')]);return _0x27b517[_0x9b3f('0x6c')](_0x179905);}})[_0x9b3f('0x25')](function(_0x11d867){if(_0x11d867){_0x3b2150=_0x11d867[_0x9b3f('0x42')];if(!_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x179905[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x91daa8['query'][_0x9b3f('0x1f')]);_0x179905[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x27b517[_0x9b3f('0x6c')](_0x179905);}})[_0x9b3f('0x25')](function(_0xb45da2){if(_0xb45da2){return _0xb45da2?{'count':_0x3b2150,'rows':_0xb45da2}:null;}})[_0x9b3f('0x25')](respondWithResult(_0x23e6db,null))['catch'](handleError(_0x23e6db,null));};exports[_0x9b3f('0x6d')]=function(_0x16bf29,_0x221c2a,_0x45bd1f){var _0x152e4a=_0x16bf29[_0x9b3f('0x4f')]['teams'];var _0x5ef2f1=_['map'](_0x152e4a,'id');return db[_0x9b3f('0x6b')]['findAll']({'where':{'id':_0x5ef2f1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9b3f('0x6e'),'attributes':['id','name',_0x9b3f('0x6f'),_0x9b3f('0x70'),'interface'],'raw':!![]}]})[_0x9b3f('0x25')](function(_0x55b3e5){if(_0x55b3e5){var _0x297172=_[_0x9b3f('0x71')](_0x55b3e5,function(_0x4f03b1){var _0x4657eb=_0x4f03b1['get']({'plain':!![]});_0x4657eb[_0x9b3f('0x6e')][_0x9b3f('0x72')](function(_0x33baf9){_0x33baf9[_0x9b3f('0x73')]=_[_0x9b3f('0x2f')](_0x152e4a,{'id':_0x4657eb['id']})[_0x9b3f('0x73')];});return _0x4657eb[_0x9b3f('0x6e')];});return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x16bf29[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(_0x5cd274){return db[_0x9b3f('0x74')]['transaction'](function(_0x467b2a){return _0x5cd274[_0x9b3f('0x6d')](_0x5ef2f1,{'transaction':_0x467b2a})[_0x9b3f('0x25')](function(){return BPromise['each'](_0x152e4a,function(_0x235d18){return db[_0x9b3f('0x75')]['upsert']({'TeamId':_0x235d18['id'],'VoiceQueueId':_0x16bf29[_0x9b3f('0x57')]['id'],'penalty':_0x235d18[_0x9b3f('0x73')]},{'transaction':_0x467b2a});});})['then'](function(){return BPromise[_0x9b3f('0x76')](_0x297172,function(_0x2e589a){return db[_0x9b3f('0x77')][_0x9b3f('0x78')]({'where':{'UserId':_0x2e589a['id'],'VoiceQueueId':_0x16bf29[_0x9b3f('0x57')]['id']},'defaults':{'penalty':_0x2e589a[_0x9b3f('0x73')]},'transaction':_0x467b2a});});})[_0x9b3f('0x25')](function(){return BPromise[_0x9b3f('0x76')](_[_0x9b3f('0x2a')](_0x297172,{'online':!![]}),function(_0x5e78d8){return db[_0x9b3f('0x79')][_0x9b3f('0x7a')]({'membername':_0x5e78d8['name'],'UserId':_0x5e78d8['id'],'queue_name':_0x5cd274['name'],'VoiceQueueId':_0x5cd274['id'],'interface':_[_0x9b3f('0x7b')](_0x5e78d8['interface'])?util[_0x9b3f('0x7c')](_0x9b3f('0x7d'),_0x5e78d8[_0x9b3f('0x30')]):_0x5e78d8['interface'],'paused':_0x5e78d8['voicePause']||![],'penalty':_0x5e78d8[_0x9b3f('0x73')]},{'transaction':_0x467b2a});});})[_0x9b3f('0x25')](function(){_0x297172[_0x9b3f('0x72')](function(_0x58b594){socket[_0x9b3f('0x7e')](_0x9b3f('0x7f'),{'UserId':_0x58b594['id'],'VoiceQueueId':_0x5cd274['id']});});});});});}})[_0x9b3f('0x25')](respondWithStatusCode(_0x221c2a,null))[_0x9b3f('0x4c')](handleError(_0x221c2a,null));};exports[_0x9b3f('0x80')]=function(_0x37bde7,_0x5304fe,_0x172ebb){return db[_0x9b3f('0x6b')][_0x9b3f('0x63')]({'where':{'id':_0x37bde7[_0x9b3f('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9b3f('0x81')],'as':_0x9b3f('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x9b3f('0x25')](handleEntityNotFound(_0x5304fe,null))[_0x9b3f('0x25')](function(_0x44b8af){var _0x1a7336=_['map'](_0x44b8af,'id');var _0x375ade=[];var _0x421cd8=[];var _0x3abe8f=squel[_0x9b3f('0x82')]();_0x3abe8f[_0x9b3f('0x83')]('tq.TeamId')[_0x9b3f('0x84')](_0x9b3f('0x85'),'tq')['join'](_0x9b3f('0x86'),'ut',_0x9b3f('0x87'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x37bde7[_0x9b3f('0x57')]['id']);for(var _0xeda184=0x0;_0xeda184<_0x44b8af['length'];_0xeda184+=0x1){let _0x4b1b77=_0x44b8af[_0xeda184];for(var _0xc956ce=0x0;_0xc956ce<_0x4b1b77[_0x9b3f('0x6e')][_0x9b3f('0x42')];_0xc956ce+=0x1){let _0x1a73ab=_0x4b1b77[_0x9b3f('0x6e')][_0xc956ce];var _0xa85fa=_0x3abe8f['clone']();_0xa85fa['where'](_0x9b3f('0x89'),_0x1a73ab['id']);_0x421cd8[_0x9b3f('0x8a')](db[_0x9b3f('0x74')]['query'](_0xa85fa['toString'](),{'type':db[_0x9b3f('0x74')][_0x9b3f('0x8b')][_0x9b3f('0x8c')]})[_0x9b3f('0x25')](function(_0x429bc3){if(_0x429bc3['length']===0x1){return _0x1a73ab['id'];}else{var _0x224012=_['every'](_['map'](_0x429bc3,'TeamId'),function(_0x1c224a){return _[_0x9b3f('0x2d')](_0x1a7336,_0x1c224a);});if(_0x224012){return _0x1a73ab['id'];}}}));}}return BPromise[_0x9b3f('0x8d')](_0x421cd8)['then'](function(_0x58759e){_0x375ade=_(_0x375ade)[_0x9b3f('0x8e')](_0x58759e)[_0x9b3f('0x8f')]()[_0x9b3f('0x2c')]();return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x37bde7[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(_0x1c0eeb){return db[_0x9b3f('0x74')][_0x9b3f('0x90')](function(_0x5f2bf7){return _0x1c0eeb[_0x9b3f('0x80')](_0x37bde7['query'][_0x9b3f('0x91')],{'transaction':_0x5f2bf7})['then'](function(){if(!_[_0x9b3f('0x92')](_0x375ade)){return _0x1c0eeb[_0x9b3f('0x93')](_0x375ade,{'transaction':_0x5f2bf7})[_0x9b3f('0x25')](function(){return db[_0x9b3f('0x79')][_0x9b3f('0x26')]({'where':{'VoiceQueueId':_0x37bde7[_0x9b3f('0x57')]['id'],'UserId':_0x375ade},'transaction':_0x5f2bf7});});}})[_0x9b3f('0x25')](function(){_0x375ade[_0x9b3f('0x72')](function(_0x37886f){socket[_0x9b3f('0x7e')](_0x9b3f('0x94'),{'UserId':_0x37886f,'VoiceQueueId':_0x1c0eeb['id']});});});});});});})[_0x9b3f('0x25')](respondWithStatusCode(_0x5304fe,null))[_0x9b3f('0x4c')](handleError(_0x5304fe,null));};exports[_0x9b3f('0x95')]=function(_0x3c56a2,_0x23aa6c,_0x246813){var _0x268566,_0x2b21ec;return db[_0x9b3f('0x37')]['find']({'where':{'id':_0x3c56a2[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x23aa6c,null))[_0x9b3f('0x25')](function(_0x3b73b4){if(_0x3b73b4){_0x2b21ec=_0x3b73b4;return _0x3b73b4[_0x9b3f('0x95')](_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')],_[_0x9b3f('0x58')](_0x3c56a2[_0x9b3f('0x4f')],[_0x9b3f('0x91'),'id'])||{})['spread'](function(_0x262f23){for(var _0x491d83=0x0;_0x491d83<_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')][_0x9b3f('0x42')];_0x491d83+=0x1){socket[_0x9b3f('0x7e')](_0x9b3f('0x7f'),{'UserId':Number(_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')][_0x491d83]),'VoiceQueueId':Number(_0x3c56a2[_0x9b3f('0x57')]['id'])});}return _0x262f23;});}})['then'](function(_0x3504e1){_0x268566=_0x3504e1||[];if(_0x2b21ec){return db[_0x9b3f('0x81')][_0x9b3f('0x63')]({'where':{'id':_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')]},'attributes':['id',_0x9b3f('0x30'),'online',_0x9b3f('0x70'),_0x9b3f('0x96')],'raw':!![]});}})['then'](function(_0x9d437f){if(!_[_0x9b3f('0x92')](_0x9d437f)){var _0x209dce=[];for(var _0x572b1b=0x0;_0x572b1b<_0x9d437f[_0x9b3f('0x42')];_0x572b1b++){if(_0x9d437f[_0x572b1b][_0x9b3f('0x6f')]){_0x209dce[_0x9b3f('0x8a')](db[_0x9b3f('0x79')][_0x9b3f('0x7a')]({'membername':_0x9d437f[_0x572b1b][_0x9b3f('0x30')],'UserId':_0x9d437f[_0x572b1b]['id'],'queue_name':_0x2b21ec[_0x9b3f('0x30')],'VoiceQueueId':_0x2b21ec['id'],'interface':_[_0x9b3f('0x7b')](_0x9d437f[_0x572b1b][_0x9b3f('0x96')])?util[_0x9b3f('0x7c')]('SIP/%s',_0x9d437f[_0x572b1b]['name']):_0x9d437f[_0x572b1b][_0x9b3f('0x96')],'paused':_0x9d437f[_0x572b1b][_0x9b3f('0x70')]||![],'penalty':_0x3c56a2[_0x9b3f('0x4f')]['penalty']||0x0}));}}return BPromise[_0x9b3f('0x8d')](_0x209dce);}})[_0x9b3f('0x25')](function(){return _0x268566;})[_0x9b3f('0x25')](respondWithResult(_0x23aa6c,null))[_0x9b3f('0x4c')](handleError(_0x23aa6c,null));};exports['removeAgents']=function(_0x463bc3,_0x1d79f4,_0xa9c31b){return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x463bc3[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1d79f4,null))[_0x9b3f('0x25')](function(_0x4aaaa2){if(_0x4aaaa2){return _0x4aaaa2[_0x9b3f('0x93')](_0x463bc3[_0x9b3f('0x3c')]['ids'])[_0x9b3f('0x25')](function(){if(_[_0x9b3f('0x97')](_0x463bc3['query'][_0x9b3f('0x91')])){for(var _0x5a78c8=0x0;_0x5a78c8<_0x463bc3[_0x9b3f('0x3c')][_0x9b3f('0x91')][_0x9b3f('0x42')];_0x5a78c8+=0x1){socket[_0x9b3f('0x7e')](_0x9b3f('0x94'),{'UserId':Number(_0x463bc3[_0x9b3f('0x3c')]['ids'][_0x5a78c8]),'VoiceQueueId':Number(_0x463bc3['params']['id'])});}}else{socket[_0x9b3f('0x7e')](_0x9b3f('0x94'),{'UserId':Number(_0x463bc3[_0x9b3f('0x3c')][_0x9b3f('0x91')]),'VoiceQueueId':Number(_0x463bc3[_0x9b3f('0x57')]['id'])});}});}})[_0x9b3f('0x25')](function(_0x461f3c){return db[_0x9b3f('0x79')][_0x9b3f('0x26')]({'where':{'VoiceQueueId':_0x463bc3['params']['id'],'UserId':_0x463bc3[_0x9b3f('0x3c')]['ids']}})[_0x9b3f('0x25')](function(){return _0x461f3c;});})[_0x9b3f('0x25')](respondWithStatusCode(_0x1d79f4,null))['catch'](handleError(_0x1d79f4,null));};exports['getAgents']=function(_0x56ec83,_0x876a8b,_0x2f933a){var _0x5e369a={};var _0x2a661c={};var _0x115cb0;var _0x4cca54;return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x56ec83[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x876a8b,null))[_0x9b3f('0x25')](function(_0x5d3261){if(_0x5d3261){_0x115cb0=_0x5d3261;_0x2a661c[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x81')]['rawAttributes']);_0x2a661c['query']=_['keys'](_0x56ec83['query']);_0x2a661c[_0x9b3f('0x3e')]=_['intersection'](_0x2a661c['model'],_0x2a661c[_0x9b3f('0x3c')]);_0x5e369a[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x2a661c[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x56ec83['query']['fields']));_0x5e369a[_0x9b3f('0x40')]=_0x5e369a['attributes'][_0x9b3f('0x42')]?_0x5e369a[_0x9b3f('0x40')]:_0x2a661c[_0x9b3f('0x3b')];_0x5e369a[_0x9b3f('0x44')]=qs['sort'](_0x56ec83[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x5e369a[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x56ec83['query'],_0x2a661c[_0x9b3f('0x3e')]));if(_0x56ec83[_0x9b3f('0x3c')]['filter']){_0x5e369a[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x5e369a['where'],{'$or':_[_0x9b3f('0x2b')](_0x5e369a[_0x9b3f('0x40')],function(_0x20bb74){var _0x4d5fd1={};_0x4d5fd1[_0x20bb74]={'$like':'%'+_0x56ec83[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x4d5fd1;})});}_0x5e369a=_[_0x9b3f('0x48')]({},_0x5e369a,_0x56ec83[_0x9b3f('0x49')]);return _0x115cb0[_0x9b3f('0x98')](_0x5e369a);}})[_0x9b3f('0x25')](function(_0x35871a){if(_0x35871a){_0x4cca54=_0x35871a[_0x9b3f('0x42')];if(!_0x56ec83['query'][_0x9b3f('0x43')]('nolimit')){_0x5e369a['limit']=qs['limit'](_0x56ec83[_0x9b3f('0x3c')]['limit']);_0x5e369a['offset']=qs[_0x9b3f('0x1d')](_0x56ec83[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x115cb0[_0x9b3f('0x98')](_0x5e369a);}})[_0x9b3f('0x25')](function(_0x255dcb){if(_0x255dcb){return _0x255dcb?{'count':_0x4cca54,'rows':_0x255dcb}:null;}})[_0x9b3f('0x25')](respondWithResult(_0x876a8b,null))['catch'](handleError(_0x876a8b,null));};exports['getMembers']=function(_0x23fcf9,_0xb6cda0,_0x29f684){var _0x5084d1={};var _0x1aa0cb={};var _0x21aa68;var _0x4d991e;return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x23fcf9[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0xb6cda0,null))['then'](function(_0x2d1511){if(_0x2d1511){_0x21aa68=_0x2d1511;_0x1aa0cb[_0x9b3f('0x3b')]=_['keys'](db[_0x9b3f('0x79')][_0x9b3f('0x38')]);_0x1aa0cb[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x23fcf9[_0x9b3f('0x3c')]);_0x1aa0cb[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x1aa0cb[_0x9b3f('0x3b')],_0x1aa0cb[_0x9b3f('0x3c')]);_0x5084d1[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x1aa0cb[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x23fcf9['query'][_0x9b3f('0x41')]));_0x5084d1[_0x9b3f('0x40')]=_0x5084d1[_0x9b3f('0x40')]['length']?_0x5084d1[_0x9b3f('0x40')]:_0x1aa0cb[_0x9b3f('0x3b')];_0x5084d1[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x5084d1[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x23fcf9[_0x9b3f('0x3c')],_0x1aa0cb[_0x9b3f('0x3e')]));if(_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x5084d1['where']=_[_0x9b3f('0x48')](_0x5084d1[_0x9b3f('0x46')],{'$or':_['map'](_0x5084d1['attributes'],function(_0x199477){var _0x2b71ff={};_0x2b71ff[_0x199477]={'$like':'%'+_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x2b71ff;})});}_0x5084d1=_[_0x9b3f('0x48')]({},_0x5084d1,_0x23fcf9[_0x9b3f('0x49')]);return _0x21aa68['getMembers'](_0x5084d1);}})[_0x9b3f('0x25')](function(_0x5a96d8){if(_0x5a96d8){_0x4d991e=_0x5a96d8['length'];if(!_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x43')]('nolimit')){_0x5084d1[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x5084d1['offset']=qs[_0x9b3f('0x1d')](_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x21aa68['getMembers'](_0x5084d1);}})['then'](function(_0x1b3fb7){return _0x1b3fb7?{'count':_0x4d991e,'rows':_0x1b3fb7}:null;})[_0x9b3f('0x25')](respondWithResult(_0xb6cda0,null))[_0x9b3f('0x4c')](handleError(_0xb6cda0,null));};exports[_0x9b3f('0x99')]=function(_0xe8cbd1,_0x1d2887,_0x3c2e8d){var _0x113923={};var _0x4a84e8={};var _0x1ea162;var _0x229b52;return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0xe8cbd1[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x1d2887,null))[_0x9b3f('0x25')](function(_0x50d6c1){if(_0x50d6c1){_0x1ea162=_0x50d6c1;_0x4a84e8[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x9a')][_0x9b3f('0x38')]);_0x4a84e8[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0xe8cbd1[_0x9b3f('0x3c')]);_0x4a84e8[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x4a84e8['model'],_0x4a84e8[_0x9b3f('0x3c')]);_0x113923[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x4a84e8[_0x9b3f('0x3b')],qs['fields'](_0xe8cbd1[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x113923[_0x9b3f('0x40')]=_0x113923[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x113923['attributes']:_0x4a84e8[_0x9b3f('0x3b')];_0x113923[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0xe8cbd1[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x113923[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0xe8cbd1['query'],_0x4a84e8[_0x9b3f('0x3e')]));if(_0xe8cbd1['query'][_0x9b3f('0x2a')]){_0x113923[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x113923['where'],{'$or':_[_0x9b3f('0x2b')](_0x113923[_0x9b3f('0x40')],function(_0x133095){var _0x102bfe={};_0x102bfe[_0x133095]={'$like':'%'+_0xe8cbd1['query'][_0x9b3f('0x2a')]+'%'};return _0x102bfe;})});}_0x113923=_[_0x9b3f('0x48')]({},_0x113923,_0xe8cbd1['options']);return _0x1ea162[_0x9b3f('0x99')](_0x113923);}})['then'](function(_0x357dd8){if(_0x357dd8){_0x229b52=_0x357dd8[_0x9b3f('0x42')];if(!_0xe8cbd1['query'][_0x9b3f('0x43')]('nolimit')){_0x113923[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0xe8cbd1['query']['limit']);_0x113923[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0xe8cbd1[_0x9b3f('0x3c')]['offset']);}return _0x1ea162['getLists'](_0x113923);}})[_0x9b3f('0x25')](function(_0x425b6e){if(_0x425b6e){return _0x425b6e?{'count':_0x229b52,'rows':_0x425b6e}:null;}})[_0x9b3f('0x25')](respondWithResult(_0x1d2887,null))[_0x9b3f('0x4c')](handleError(_0x1d2887,null));};exports[_0x9b3f('0x9b')]=function(_0x2317fd,_0x36131f,_0x55498b){var _0x291cbe=moment()[_0x9b3f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e72b9,_0x2abfde;return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x2317fd[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x36131f,null))['then'](function(_0xbf63dc){if(_0xbf63dc){_0x2abfde=_0xbf63dc;return _0xbf63dc['addLists'](_0x2317fd[_0x9b3f('0x4f')]['ids'],_[_0x9b3f('0x58')](_0x2317fd[_0x9b3f('0x4f')],[_0x9b3f('0x91'),'id'])||{});}return null;})[_0x9b3f('0x9c')](function(_0x2896ad){var _0x19e8a6;_0x1e72b9=_0x2896ad||[];var _0x4f5d97=[];if(_0x2896ad){for(var _0x296fe8=0x0;_0x296fe8<_0x2896ad['length'];_0x296fe8+=0x1){var _0x567212=_0x2896ad[_0x296fe8]['get']({'plain':!![]});_0x2abfde[_0x9b3f('0x9d')]=_0x2317fd[_0x9b3f('0x4f')]['dialCheckDuplicateType']?_0x2317fd['body']['dialCheckDuplicateType']:_0x2abfde[_0x9b3f('0x9d')];switch(_0x2abfde[_0x9b3f('0x9d')]){case _0x9b3f('0x9e'):_0x19e8a6=squel['insert']()[_0x9b3f('0x9f')](_0x9b3f('0xa0'))[_0x9b3f('0xa1')]([_0x9b3f('0xa2'),_0x9b3f('0xa3'),_0x9b3f('0xa4'),'ListId',_0x9b3f('0x66'),_0x9b3f('0x59'),'updatedAt'],squel[_0x9b3f('0x82')]()['field'](_0x9b3f('0xa2'),_0x9b3f('0xa2'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27','scheduledAt')[_0x9b3f('0x83')]('id',_0x9b3f('0xa4'))['field'](_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')](),'ListId')[_0x9b3f('0x83')](_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),'VoiceQueueId')[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27','updatedAt')[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')](_0x9b3f('0xa8'))['where']('ListId\x20=\x20?',_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')]())[_0x9b3f('0x46')](_0x9b3f('0xa9'))['where'](_0x9b3f('0xaa'),squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x9b3f('0xab'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')]()))[_0x9b3f('0x46')](_0x9b3f('0xaa'),squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xac'))[_0x9b3f('0x84')](_0x9b3f('0xa0'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')]())))[_0x9b3f('0xa6')]();break;case _0x9b3f('0xad'):_0x19e8a6=squel[_0x9b3f('0xae')]()['into'](_0x9b3f('0xa0'))['fromQuery']([_0x9b3f('0xa2'),_0x9b3f('0xa3'),'ContactId',_0x9b3f('0xaf'),_0x9b3f('0x66'),'createdAt',_0x9b3f('0x5a')],squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xa2'),_0x9b3f('0xa2'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0xa3'))['field']('id',_0x9b3f('0xa4'))[_0x9b3f('0x83')](_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')](),_0x9b3f('0xaf'))[_0x9b3f('0x83')](_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),_0x9b3f('0x66'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x5a'))[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')]('deletedAt\x20IS\x20NULL')[_0x9b3f('0x46')]('ListId\x20=\x20?',_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')]())['where'](_0x9b3f('0xa9'))[_0x9b3f('0x46')](_0x9b3f('0xaa'),squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xac'))['from'](_0x9b3f('0xa0'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x2317fd['params']['id'][_0x9b3f('0xa6')]())))[_0x9b3f('0xa6')]();break;default:_0x19e8a6=squel[_0x9b3f('0xae')]()[_0x9b3f('0x9f')](_0x9b3f('0xa0'))[_0x9b3f('0xa1')]([_0x9b3f('0xa2'),_0x9b3f('0xa3'),'ContactId',_0x9b3f('0xaf'),'VoiceQueueId',_0x9b3f('0x59'),_0x9b3f('0x5a')],squel['select']()['field'](_0x9b3f('0xa2'),_0x9b3f('0xa2'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0xa3'))['field']('id','ContactId')['field'](_0x567212['CmListId'][_0x9b3f('0xa6')](),_0x9b3f('0xaf'))[_0x9b3f('0x83')](_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),_0x9b3f('0x66'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x5a'))[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')](_0x9b3f('0xa8'))['where']('ListId\x20=\x20?',_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')]())[_0x9b3f('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x4f5d97[_0x9b3f('0x8a')](db[_0x9b3f('0x74')][_0x9b3f('0x3c')](_0x19e8a6));}return BPromise[_0x9b3f('0x8d')](_0x4f5d97);}})['then'](function(){var _0x395455=[];var _0x542f0f=squel[_0x9b3f('0xae')]()[_0x9b3f('0x9f')](_0x9b3f('0xb0'))[_0x9b3f('0xa1')]([_0x9b3f('0xb1'),_0x9b3f('0xa2'),_0x9b3f('0xb2'),_0x9b3f('0x59'),_0x9b3f('0x5a')],squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xb3'))[_0x9b3f('0x83')](_0x9b3f('0xb4'))[_0x9b3f('0x83')](_0x9b3f('0xb5'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x5a'))[_0x9b3f('0x84')](_0x9b3f('0xb6'),'ci')[_0x9b3f('0xb7')](_0x9b3f('0xa0'),'h','h.ContactId=ci.CmContactId')[_0x9b3f('0x46')](_0x9b3f('0xb8'),_0x291cbe)['where'](_0x9b3f('0xb9'),_0x9b3f('0xba')))[_0x9b3f('0xa6')]();_0x395455[_0x9b3f('0x8a')](db[_0x9b3f('0x74')][_0x9b3f('0x3c')](_0x542f0f));return BPromise['all'](_0x395455);})['then'](function(){return _0x1e72b9;})['then'](respondWithResult(_0x36131f,null))[_0x9b3f('0x4c')](handleError(_0x36131f,null));};exports[_0x9b3f('0xbb')]=function(_0x13e7a5,_0xcf9bad,_0x168698){return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x13e7a5[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0xcf9bad,null))[_0x9b3f('0x25')](function(_0x11ffce){if(_0x11ffce){return _0x11ffce[_0x9b3f('0xbb')](_0x13e7a5[_0x9b3f('0x3c')][_0x9b3f('0x91')]);}})[_0x9b3f('0x25')](function(_0x35ecc7){if(_0x35ecc7){return db[_0x9b3f('0x60')]['destroy']({'where':{'ListId':_0x13e7a5['query'][_0x9b3f('0x91')],'VoiceQueueId':_0x13e7a5[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(){return _0x35ecc7;});}})[_0x9b3f('0x25')](respondWithStatusCode(_0xcf9bad,null))[_0x9b3f('0x4c')](handleError(_0xcf9bad,null));};exports[_0x9b3f('0xbc')]=function(_0x3081fd,_0xd0aa59,_0x114f15){var _0x2314e8={};var _0x50fd7a={};var _0x174182;var _0x5726ce;return db['VoiceQueue'][_0x9b3f('0x5f')]({'where':{'id':_0x3081fd['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0xd0aa59,null))[_0x9b3f('0x25')](function(_0x2a30b9){if(_0x2a30b9){_0x174182=_0x2a30b9;_0x50fd7a[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x9a')]['rawAttributes']);_0x50fd7a['query']=_['keys'](_0x3081fd[_0x9b3f('0x3c')]);_0x50fd7a['filters']=_[_0x9b3f('0x3f')](_0x50fd7a[_0x9b3f('0x3b')],_0x50fd7a[_0x9b3f('0x3c')]);_0x2314e8[_0x9b3f('0x40')]=_['intersection'](_0x50fd7a[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x3081fd[_0x9b3f('0x3c')]['fields']));_0x2314e8['attributes']=_0x2314e8[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x2314e8[_0x9b3f('0x40')]:_0x50fd7a[_0x9b3f('0x3b')];_0x2314e8['order']=qs[_0x9b3f('0x45')](_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x2314e8[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_['pick'](_0x3081fd[_0x9b3f('0x3c')],_0x50fd7a[_0x9b3f('0x3e')]));if(_0x3081fd[_0x9b3f('0x3c')]['filter']){_0x2314e8[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x2314e8[_0x9b3f('0x46')],{'$or':_['map'](_0x2314e8[_0x9b3f('0x40')],function(_0x48082a){var _0x1b0f50={};_0x1b0f50[_0x48082a]={'$like':'%'+_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x1b0f50;})});}_0x2314e8=_['merge']({},_0x2314e8,_0x3081fd[_0x9b3f('0x49')]);return _0x174182[_0x9b3f('0xbc')](_0x2314e8);}})[_0x9b3f('0x25')](function(_0x4f9219){if(_0x4f9219){_0x5726ce=_0x4f9219[_0x9b3f('0x42')];if(!_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x2314e8[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x2314e8[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x174182[_0x9b3f('0xbc')](_0x2314e8);}})[_0x9b3f('0x25')](function(_0x59cb79){if(_0x59cb79){return _0x59cb79?{'count':_0x5726ce,'rows':_0x59cb79}:null;}})[_0x9b3f('0x25')](respondWithResult(_0xd0aa59,null))[_0x9b3f('0x4c')](handleError(_0xd0aa59,null));};exports[_0x9b3f('0xbd')]=function(_0x34bb7c,_0x1390a7,_0xf542b5){var _0xa77f64,_0x47b122;return db[_0x9b3f('0x37')]['find']({'where':{'id':_0x34bb7c['params']['id']}})['then'](handleEntityNotFound(_0x1390a7,null))[_0x9b3f('0x25')](function(_0x45b9fa){if(_0x45b9fa){_0x47b122=_0x45b9fa;return _0x45b9fa['addBlackLists'](_0x34bb7c[_0x9b3f('0x4f')][_0x9b3f('0x91')],_['omit'](_0x34bb7c[_0x9b3f('0x4f')],[_0x9b3f('0x91'),'id'])||{});}return null;})[_0x9b3f('0x9c')](function(_0x4df618){var _0x1327cc;_0xa77f64=_0x4df618||[];var _0x2aa355=[];if(_0x4df618){for(var _0x48457d=0x0;_0x48457d<_0x4df618['length'];_0x48457d+=0x1){var _0xf75f7e=_0x4df618[_0x48457d][_0x9b3f('0x27')]({'plain':!![]});_0x1327cc=squel[_0x9b3f('0xae')]()[_0x9b3f('0x9f')]('cm_hopper_black')['fromQuery']([_0x9b3f('0xa2'),'ContactId',_0x9b3f('0xaf'),_0x9b3f('0x66'),_0x9b3f('0x59'),_0x9b3f('0x5a')],squel[_0x9b3f('0x82')]()['field']('phone','phone')['field']('id',_0x9b3f('0xa4'))[_0x9b3f('0x83')](_0xf75f7e[_0x9b3f('0xa5')][_0x9b3f('0xa6')](),'ListId')['field'](_0x34bb7c[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),_0x9b3f('0x66'))[_0x9b3f('0x83')](_0x9b3f('0xbe'),_0x9b3f('0x59'))['field']('NOW()','updatedAt')[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')](_0x9b3f('0xa8'))[_0x9b3f('0x46')](_0x9b3f('0xbf'),_0xf75f7e[_0x9b3f('0xa5')]['toString']())[_0x9b3f('0x46')](_0x9b3f('0xa9')))[_0x9b3f('0xa6')]();_0x2aa355[_0x9b3f('0x8a')](db['sequelize'][_0x9b3f('0x3c')](_0x1327cc));}return BPromise[_0x9b3f('0x8d')](_0x2aa355);}})[_0x9b3f('0x25')](function(){return _0xa77f64;})[_0x9b3f('0x25')](respondWithResult(_0x1390a7,null))[_0x9b3f('0x4c')](handleError(_0x1390a7,null));};exports[_0x9b3f('0xc0')]=function(_0x2ef027,_0x3b1a67,_0x5e6d5d){return db['VoiceQueue'][_0x9b3f('0x2f')]({'where':{'id':_0x2ef027[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x3b1a67,null))[_0x9b3f('0x25')](function(_0x453c16){if(_0x453c16){return _0x453c16[_0x9b3f('0xc0')](_0x2ef027[_0x9b3f('0x3c')]['ids']);}})[_0x9b3f('0x25')](function(_0x61e89b){if(_0x61e89b){return db[_0x9b3f('0x6a')][_0x9b3f('0x26')]({'where':{'ListId':_0x2ef027[_0x9b3f('0x3c')][_0x9b3f('0x91')],'VoiceQueueId':_0x2ef027[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(){return _0x61e89b;});}})[_0x9b3f('0x25')](respondWithStatusCode(_0x3b1a67,null))[_0x9b3f('0x4c')](handleError(_0x3b1a67,null));};
\ No newline at end of file
+var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x457b74,_0xecd07a){var _0x38e079=function(_0x405da9){while(--_0x405da9){_0x457b74['push'](_0x457b74['shift']());}};_0x38e079(++_0xecd07a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));};
\ No newline at end of file