Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 75c809a..88ca625 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb238=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','omit','updatedAt','createdAt','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','nolimit','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','upsert','isNil','format','SIP/%s','emit','select','field','from','team_has_voice_queues','join','user_has_teams','clone','push','toString','QueryTypes','SELECT','TeamId','includes','union','removeTeams','ids','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isEmpty','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','ListId\x20=\x20?','cm_hopper','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','name','UserProfileResource','end','error','index','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0x202359,_0x3a3f32){var _0x2a55b5=function(_0x31e9d3){while(--_0x31e9d3){_0x202359['push'](_0x202359['shift']());}};_0x2a55b5(++_0x3a3f32);}(_0xb238,0x1df));var _0x8b23=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xb238[_0x3fe6df];return _0x372a0e;};'use strict';var pdf=require(_0x8b23('0x0'));var emlformat=require(_0x8b23('0x1'));var rimraf=require(_0x8b23('0x2'));var zipdir=require(_0x8b23('0x3'));var jsonpatch=require(_0x8b23('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b23('0x5'));var util=require(_0x8b23('0x6'));var path=require('path');var sox=require(_0x8b23('0x7'));var csv=require(_0x8b23('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8b23('0x9'));var crypto=require(_0x8b23('0xa'));var jsforce=require(_0x8b23('0xb'));var deskjs=require(_0x8b23('0xc'));var toCsv=require(_0x8b23('0x8'));var querystring=require(_0x8b23('0xd'));var Papa=require(_0x8b23('0xe'));var Redis=require(_0x8b23('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8b23('0x10'));var as=require(_0x8b23('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b23('0x12'))(_0x8b23('0x13'));var utils=require(_0x8b23('0x14'));var config=require(_0x8b23('0x15'));var licenseUtil=require(_0x8b23('0x16'));var db=require(_0x8b23('0x17'))['db'];config[_0x8b23('0x18')]=_['defaults'](config[_0x8b23('0x18')],{'host':_0x8b23('0x19'),'port':0x18eb});var socket=require(_0x8b23('0x1a'))(new Redis(config[_0x8b23('0x18')]));require(_0x8b23('0x1b'))[_0x8b23('0x1c')](socket);function respondWithStatusCode(_0xa55285,_0x5303df){_0x5303df=_0x5303df||0xcc;return function(_0x166c45){if(_0x166c45){return _0xa55285[_0x8b23('0x1d')](_0x5303df);}return _0xa55285[_0x8b23('0x1e')](_0x5303df)['end']();};}function respondWithResult(_0x2c5d2a,_0x1b28ce){_0x1b28ce=_0x1b28ce||0xc8;return function(_0x5aec6a){if(_0x5aec6a){return _0x2c5d2a[_0x8b23('0x1e')](_0x1b28ce)[_0x8b23('0x1f')](_0x5aec6a);}};}function respondWithFilteredResult(_0x22616c,_0x134f28){return function(_0xac71d9){if(_0xac71d9){var _0x6c97b7=_0xac71d9['count'],_0x50ad19=_0x134f28[_0x8b23('0x20')],_0x2ff837=_0x134f28[_0x8b23('0x20')]+_0x134f28[_0x8b23('0x21')],_0x56facb;if(_0x2ff837>=_0x6c97b7){_0x2ff837=_0x6c97b7;_0x56facb=0xc8;}else{_0x56facb=0xce;}_0x22616c[_0x8b23('0x1e')](_0x56facb);return _0x22616c[_0x8b23('0x22')](_0x8b23('0x23'),_0x50ad19+'-'+_0x2ff837+'/'+_0x6c97b7)[_0x8b23('0x1f')](_0xac71d9);}return null;};}function patchUpdates(_0x408a7e){return function(_0x32f201){try{jsonpatch[_0x8b23('0x24')](_0x32f201,_0x408a7e,!![]);}catch(_0x44631c){return BPromise[_0x8b23('0x25')](_0x44631c);}return _0x32f201[_0x8b23('0x26')]();};}function saveUpdates(_0x8a6323,_0x273a3f){return function(_0x1f6e5b){if(_0x1f6e5b){return _0x1f6e5b['update'](_0x8a6323)[_0x8b23('0x27')](function(_0x52f77b){return _0x52f77b;});}return null;};}function removeEntity(_0x1cfa3d,_0x4a240a){return function(_0x189166){if(_0x189166){return _0x189166[_0x8b23('0x28')]()[_0x8b23('0x27')](function(){var _0x47721f=_0x189166[_0x8b23('0x29')]({'plain':!![]});var _0x84f573=[{'name':_0x8b23('0x2a'),'value':_0x8b23('0x2b'),'ignore':![]},{'name':_0x8b23('0x2c'),'value':_0x8b23('0x2d'),'ignore':![]}];var _0x4d0a3f=_(_0x84f573)[_0x8b23('0x2e')](_0x8b23('0x2f'))[_0x8b23('0x30')](_0x8b23('0x31'))[_0x8b23('0x31')]();if(_['includes'](_0x4d0a3f,_0x47721f[_0x8b23('0x32')])){return;}var _0x3a7459=_['find'](_0x84f573,['value',_0x47721f['type']])[_0x8b23('0x33')];return db[_0x8b23('0x34')]['destroy']({'where':{'type':_0x3a7459,'resourceId':_0x47721f['id']}})[_0x8b23('0x27')](function(){return _0x189166;});})[_0x8b23('0x27')](function(){_0x1cfa3d[_0x8b23('0x1e')](0xcc)[_0x8b23('0x35')]();});}};}function handleEntityNotFound(_0xed2692,_0x4e6208){return function(_0x3f73b3){if(!_0x3f73b3){_0xed2692[_0x8b23('0x1d')](0x194);}return _0x3f73b3;};}function handleError(_0x4def63,_0x225a66){_0x225a66=_0x225a66||0x1f4;return function(_0x1054ae){logger[_0x8b23('0x36')](_0x1054ae['stack']);if(_0x1054ae[_0x8b23('0x33')]){delete _0x1054ae[_0x8b23('0x33')];}_0x4def63[_0x8b23('0x1e')](_0x225a66)['send'](_0x1054ae);};}exports[_0x8b23('0x37')]=function(_0x2ad046,_0x149ca2){var _0x43c913={},_0x4611ea={},_0xe2b07b={'count':0x0,'rows':[]};var _0x2a28a7=_[_0x8b23('0x30')](db[_0x8b23('0x38')][_0x8b23('0x39')],function(_0x3ba35b){return{'name':_0x3ba35b[_0x8b23('0x3a')],'type':_0x3ba35b['type'][_0x8b23('0x3b')]};});_0x4611ea[_0x8b23('0x3c')]=_[_0x8b23('0x30')](_0x2a28a7,_0x8b23('0x33'));_0x4611ea[_0x8b23('0x3d')]=_['keys'](_0x2ad046['query']);_0x4611ea[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x4611ea[_0x8b23('0x3c')],_0x4611ea['query']);_0x43c913['attributes']=_[_0x8b23('0x3f')](_0x4611ea[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x2ad046['query']['fields']));_0x43c913['attributes']=_0x43c913[_0x8b23('0x41')][_0x8b23('0x42')]?_0x43c913['attributes']:_0x4611ea[_0x8b23('0x3c')];if(!_0x2ad046['query'][_0x8b23('0x43')]('nolimit')){_0x43c913[_0x8b23('0x21')]=qs['limit'](_0x2ad046[_0x8b23('0x3d')]['limit']);_0x43c913[_0x8b23('0x20')]=qs[_0x8b23('0x20')](_0x2ad046[_0x8b23('0x3d')][_0x8b23('0x20')]);}_0x43c913[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0x2ad046[_0x8b23('0x3d')][_0x8b23('0x45')]);_0x43c913[_0x8b23('0x46')]=qs['filters'](_[_0x8b23('0x47')](_0x2ad046[_0x8b23('0x3d')],_0x4611ea['filters']),_0x2a28a7);if(_0x2ad046[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x43c913[_0x8b23('0x46')]=_[_0x8b23('0x48')](_0x43c913[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x2a28a7,function(_0x57ecb5){if(_0x57ecb5['type']!==_0x8b23('0x49')){var _0x5bc3ba={};_0x5bc3ba[_0x57ecb5['name']]={'$like':'%'+_0x2ad046['query']['filter']+'%'};return _0x5bc3ba;}})});}_0x43c913=_['merge']({},_0x43c913,_0x2ad046[_0x8b23('0x4a')]);var _0x548500={'where':_0x43c913[_0x8b23('0x46')]};return db[_0x8b23('0x38')][_0x8b23('0x4b')](_0x548500)['then'](function(_0x33be76){_0xe2b07b[_0x8b23('0x4b')]=_0x33be76;if(_0x2ad046['query'][_0x8b23('0x4c')]){_0x43c913[_0x8b23('0x4d')]=[{'all':!![]}];}return db[_0x8b23('0x38')][_0x8b23('0x4e')](_0x43c913);})[_0x8b23('0x27')](function(_0x27f678){_0xe2b07b['rows']=_0x27f678;return _0xe2b07b;})[_0x8b23('0x27')](respondWithFilteredResult(_0x149ca2,_0x43c913))[_0x8b23('0x4f')](handleError(_0x149ca2,null));};exports['show']=function(_0x57e190,_0x24b890){var _0x264438={'raw':![],'where':{'id':_0x57e190[_0x8b23('0x50')]['id']}},_0x50d448={};_0x50d448[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x38')]['rawAttributes']);_0x50d448[_0x8b23('0x3d')]=_['keys'](_0x57e190[_0x8b23('0x3d')]);_0x50d448[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x50d448[_0x8b23('0x3c')],_0x50d448['query']);_0x264438['attributes']=_[_0x8b23('0x3f')](_0x50d448['model'],qs[_0x8b23('0x40')](_0x57e190[_0x8b23('0x3d')]['fields']));_0x264438['attributes']=_0x264438['attributes'][_0x8b23('0x42')]?_0x264438[_0x8b23('0x41')]:_0x50d448[_0x8b23('0x3c')];if(_0x57e190[_0x8b23('0x3d')][_0x8b23('0x4c')]){_0x264438['include']=[{'all':!![]}];}_0x264438=_[_0x8b23('0x48')]({},_0x264438,_0x57e190['options']);return db['VoiceQueue'][_0x8b23('0x52')](_0x264438)[_0x8b23('0x27')](handleEntityNotFound(_0x24b890,null))[_0x8b23('0x27')](respondWithResult(_0x24b890,null))[_0x8b23('0x4f')](handleError(_0x24b890,null));};exports[_0x8b23('0x53')]=function(_0x436fdb,_0x59afb1){return db[_0x8b23('0x38')]['create'](_0x436fdb[_0x8b23('0x54')],{})['then'](function(_0x21b954){var _0x2048e3=_0x436fdb[_0x8b23('0x55')][_0x8b23('0x29')]({'plain':!![]});if(!_0x2048e3)throw new Error(_0x8b23('0x56'));if(_0x2048e3['role']==='user'){var _0x3118e3=_0x21b954[_0x8b23('0x29')]({'plain':!![]});var _0x4dcbfa=[{'name':_0x8b23('0x2a'),'value':_0x8b23('0x2b')},{'name':_0x8b23('0x2c'),'value':_0x8b23('0x2d')}];var _0x97ed6e=_['find'](_0x4dcbfa,[_0x8b23('0x31'),_0x3118e3[_0x8b23('0x32')]])['name'];return db[_0x8b23('0x57')][_0x8b23('0x52')]({'where':{'name':_0x97ed6e,'userProfileId':_0x2048e3['userProfileId']},'raw':!![]})['then'](function(_0x4746b8){if(_0x4746b8&&_0x4746b8[_0x8b23('0x58')]===0x0){return db[_0x8b23('0x34')]['create']({'name':_0x3118e3[_0x8b23('0x33')],'resourceId':_0x3118e3['id'],'type':_0x4746b8['name'],'sectionId':_0x4746b8['id']},{})[_0x8b23('0x27')](function(){return _0x21b954;});}else{return _0x21b954;}})['catch'](function(_0x5809d5){logger[_0x8b23('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5809d5);throw _0x5809d5;});}return _0x21b954;})[_0x8b23('0x27')](respondWithResult(_0x59afb1,0xc9))['catch'](handleError(_0x59afb1,null));};exports['clone']=function(_0x3c0e99,_0x3ebb83){var _0x279207={'where':{'id':_0x3c0e99[_0x8b23('0x50')]['id']}},_0x4e22a2={};_0x4e22a2[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x38')]['rawAttributes']);_0x279207[_0x8b23('0x41')]=_[_0x8b23('0x3f')](_0x4e22a2[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x3c0e99[_0x8b23('0x3d')][_0x8b23('0x40')]));_0x279207[_0x8b23('0x41')]=_0x279207['attributes'][_0x8b23('0x42')]?_0x279207['attributes']:_0x4e22a2[_0x8b23('0x3c')];if(_0x3c0e99[_0x8b23('0x3d')][_0x8b23('0x4c')]){_0x279207['include']=[{'all':!![]}];}_0x279207=_[_0x8b23('0x48')]({},_0x279207,_0x3c0e99['options']);return db[_0x8b23('0x38')]['find'](_0x279207)[_0x8b23('0x27')](handleEntityNotFound(_0x3ebb83,null))['then'](function(_0xaac5ac){if(_0xaac5ac){var _0x1446e1=_0xaac5ac[_0x8b23('0x29')]({'plain':!![]});_0x1446e1=qs[_0x8b23('0x59')](_0x1446e1,['id','createdAt',_0x8b23('0x5a')]);_0x3c0e99[_0x8b23('0x54')]=_[_0x8b23('0x59')](_0x3c0e99[_0x8b23('0x54')],['id',_0x8b23('0x5b'),_0x8b23('0x5a')]);return db[_0x8b23('0x38')]['create'](_[_0x8b23('0x48')](_0x1446e1,_0x3c0e99[_0x8b23('0x54')]),{'include':_0x3c0e99[_0x8b23('0x3d')][_0x8b23('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x12f8c4){var _0x103bc2=_0x3c0e99[_0x8b23('0x55')][_0x8b23('0x29')]({'plain':!![]});if(!_0x103bc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x103bc2[_0x8b23('0x5c')]===_0x8b23('0x55')){var _0xb572a4=_0x12f8c4[_0x8b23('0x29')]({'plain':!![]});var _0x191796=[{'name':_0x8b23('0x2a'),'value':'inbound'},{'name':_0x8b23('0x2c'),'value':_0x8b23('0x2d')}];var _0x47d6a7=_[_0x8b23('0x52')](_0x191796,[_0x8b23('0x31'),_0xb572a4[_0x8b23('0x32')]])[_0x8b23('0x33')];return db[_0x8b23('0x57')]['find']({'where':{'name':_0x47d6a7,'userProfileId':_0x103bc2[_0x8b23('0x5d')]},'raw':!![]})[_0x8b23('0x27')](function(_0x1b06a6){if(_0x1b06a6&&_0x1b06a6[_0x8b23('0x58')]===0x0){return db[_0x8b23('0x34')][_0x8b23('0x53')]({'name':_0xb572a4[_0x8b23('0x33')],'resourceId':_0xb572a4['id'],'type':_0x1b06a6[_0x8b23('0x33')],'sectionId':_0x1b06a6['id']},{})[_0x8b23('0x27')](function(){return _0x12f8c4;});}else{return _0x12f8c4;}})['catch'](function(_0x3870a7){logger[_0x8b23('0x36')](_0x8b23('0x5e'),_0x3870a7);throw _0x3870a7;});}return _0x12f8c4;});}})[_0x8b23('0x27')](respondWithResult(_0x3ebb83,0xc9))['catch'](handleError(_0x3ebb83,null));};exports[_0x8b23('0x5f')]=function(_0x192be9,_0x579382){if(_0x192be9[_0x8b23('0x54')]['id']){delete _0x192be9[_0x8b23('0x54')]['id'];}return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x192be9['params']['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x579382,null))['then'](saveUpdates(_0x192be9[_0x8b23('0x54')],null))[_0x8b23('0x27')](respondWithResult(_0x579382,null))[_0x8b23('0x4f')](handleError(_0x579382,null));};exports[_0x8b23('0x28')]=function(_0x1507fb,_0x376e6a){return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x1507fb['params']['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x376e6a,null))[_0x8b23('0x27')](removeEntity(_0x376e6a,null))[_0x8b23('0x4f')](handleError(_0x376e6a,null));};exports[_0x8b23('0x60')]=function(_0x4d5ea6,_0x58fa55,_0x33dacd){var _0x3c1119={'raw':![],'where':{}};var _0x5d00b4={};var _0xdc812e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x8b23('0x61')]({'where':{'id':_0x4d5ea6['params']['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x58fa55,null))[_0x8b23('0x27')](function(_0x8068af){if(_0x8068af){_0x5d00b4['model']=_[_0x8b23('0x51')](db['CmHopper'][_0x8b23('0x39')]);_0x5d00b4[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0x4d5ea6['query']);_0x5d00b4[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x5d00b4['model'],_0x5d00b4['query']);_0x3c1119[_0x8b23('0x41')]=_[_0x8b23('0x3f')](_0x5d00b4[_0x8b23('0x3c')],qs['fields'](_0x4d5ea6[_0x8b23('0x3d')][_0x8b23('0x40')]));_0x3c1119[_0x8b23('0x41')]=_0x3c1119[_0x8b23('0x41')][_0x8b23('0x42')]?_0x3c1119['attributes']:_0x5d00b4[_0x8b23('0x3c')];if(!_0x4d5ea6['query'][_0x8b23('0x43')](_0x8b23('0x62'))){_0x3c1119[_0x8b23('0x21')]=qs[_0x8b23('0x21')](_0x4d5ea6[_0x8b23('0x3d')][_0x8b23('0x21')]);_0x3c1119[_0x8b23('0x20')]=qs[_0x8b23('0x20')](_0x4d5ea6[_0x8b23('0x3d')][_0x8b23('0x20')]);}_0x3c1119[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0x4d5ea6[_0x8b23('0x3d')]['sort']);_0x3c1119[_0x8b23('0x46')]=qs[_0x8b23('0x3e')](_[_0x8b23('0x47')](_0x4d5ea6[_0x8b23('0x3d')],_0x5d00b4['filters']));_0x3c1119[_0x8b23('0x46')]['VoiceQueueId']=_0x8068af['id'];if(_0x4d5ea6['query'][_0x8b23('0x2e')]){_0x3c1119[_0x8b23('0x46')]=_[_0x8b23('0x48')](_0x3c1119[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x3c1119[_0x8b23('0x41')],function(_0x18c405){var _0x45d686={};_0x45d686[_0x18c405]={'$like':'%'+_0x4d5ea6[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x45d686;})});}_0x3c1119=_[_0x8b23('0x48')]({},_0x3c1119,_0x4d5ea6[_0x8b23('0x4a')]);return db[_0x8b23('0x63')][_0x8b23('0x4b')]({'where':_0x3c1119[_0x8b23('0x46')]})[_0x8b23('0x27')](function(_0x2c2aa5){_0xdc812e[_0x8b23('0x4b')]=_0x2c2aa5;if(_0x4d5ea6['query']['includeAll']){_0x3c1119[_0x8b23('0x4d')]=[{'all':!![]}];}return db[_0x8b23('0x63')][_0x8b23('0x4e')](_0x3c1119);})['then'](function(_0x4d6499){_0xdc812e[_0x8b23('0x64')]=_0x4d6499;return _0xdc812e;});}})[_0x8b23('0x27')](respondWithFilteredResult(_0x58fa55,_0x3c1119))[_0x8b23('0x4f')](handleError(_0x58fa55,null));};exports[_0x8b23('0x65')]=function(_0x4042a9,_0x56cec2,_0x4632fd){var _0x567bdc={'raw':!![],'where':{}};var _0x170b4f={};var _0x5bb9ae={'count':0x0,'rows':[]};return db[_0x8b23('0x38')]['findOne']({'where':{'id':_0x4042a9[_0x8b23('0x50')]['id']}})['then'](handleEntityNotFound(_0x56cec2,null))[_0x8b23('0x27')](function(_0x5d1727){if(_0x5d1727){_0x170b4f[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x66')][_0x8b23('0x39')]);_0x170b4f[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0x4042a9[_0x8b23('0x3d')]);_0x170b4f[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x170b4f[_0x8b23('0x3c')],_0x170b4f[_0x8b23('0x3d')]);_0x567bdc['attributes']=_[_0x8b23('0x3f')](_0x170b4f[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x4042a9['query'][_0x8b23('0x40')]));_0x567bdc[_0x8b23('0x41')]=_0x567bdc[_0x8b23('0x41')]['length']?_0x567bdc[_0x8b23('0x41')]:_0x170b4f[_0x8b23('0x3c')];if(!_0x4042a9[_0x8b23('0x3d')][_0x8b23('0x43')](_0x8b23('0x62'))){_0x567bdc[_0x8b23('0x21')]=qs[_0x8b23('0x21')](_0x4042a9[_0x8b23('0x3d')][_0x8b23('0x21')]);_0x567bdc['offset']=qs[_0x8b23('0x20')](_0x4042a9[_0x8b23('0x3d')][_0x8b23('0x20')]);}_0x567bdc[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0x4042a9['query'][_0x8b23('0x45')]);_0x567bdc['where']=qs['filters'](_[_0x8b23('0x47')](_0x4042a9[_0x8b23('0x3d')],_0x170b4f[_0x8b23('0x3e')]));_0x567bdc[_0x8b23('0x46')][_0x8b23('0x67')]=_0x5d1727['id'];if(_0x4042a9[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x567bdc['where']=_[_0x8b23('0x48')](_0x567bdc[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x567bdc[_0x8b23('0x41')],function(_0x380bba){var _0x48f9dd={};_0x48f9dd[_0x380bba]={'$like':'%'+_0x4042a9[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x48f9dd;})});}_0x567bdc=_['merge']({},_0x567bdc,_0x4042a9[_0x8b23('0x4a')]);return db[_0x8b23('0x66')][_0x8b23('0x4b')]({'where':_0x567bdc['where']})[_0x8b23('0x27')](function(_0x9d5371){_0x5bb9ae[_0x8b23('0x4b')]=_0x9d5371;if(_0x4042a9[_0x8b23('0x3d')][_0x8b23('0x4c')]){_0x567bdc[_0x8b23('0x4d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x8b23('0x4e')](_0x567bdc);})['then'](function(_0x220fa7){_0x5bb9ae[_0x8b23('0x64')]=_0x220fa7;return _0x5bb9ae;});}})['then'](respondWithFilteredResult(_0x56cec2,_0x567bdc))[_0x8b23('0x4f')](handleError(_0x56cec2,null));};exports[_0x8b23('0x68')]=function(_0x33c453,_0x5a7eeb,_0x463b72){var _0x566b1a={'raw':!![],'where':{}};var _0x53ff0c={};var _0x3c4048={'count':0x0,'rows':[]};return db[_0x8b23('0x38')][_0x8b23('0x61')]({'where':{'id':_0x33c453[_0x8b23('0x50')]['id']}})['then'](handleEntityNotFound(_0x5a7eeb,null))[_0x8b23('0x27')](function(_0x59776e){if(_0x59776e){_0x53ff0c[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db['CmHopperFinal']['rawAttributes']);_0x53ff0c[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0x33c453['query']);_0x53ff0c[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x53ff0c[_0x8b23('0x3c')],_0x53ff0c['query']);_0x566b1a[_0x8b23('0x41')]=_[_0x8b23('0x3f')](_0x53ff0c[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x33c453['query'][_0x8b23('0x40')]));_0x566b1a['attributes']=_0x566b1a[_0x8b23('0x41')][_0x8b23('0x42')]?_0x566b1a['attributes']:_0x53ff0c[_0x8b23('0x3c')];if(!_0x33c453[_0x8b23('0x3d')][_0x8b23('0x43')]('nolimit')){_0x566b1a[_0x8b23('0x21')]=qs[_0x8b23('0x21')](_0x33c453['query'][_0x8b23('0x21')]);_0x566b1a[_0x8b23('0x20')]=qs[_0x8b23('0x20')](_0x33c453[_0x8b23('0x3d')][_0x8b23('0x20')]);}_0x566b1a['order']=qs[_0x8b23('0x45')](_0x33c453[_0x8b23('0x3d')]['sort']);_0x566b1a[_0x8b23('0x46')]=qs[_0x8b23('0x3e')](_[_0x8b23('0x47')](_0x33c453[_0x8b23('0x3d')],_0x53ff0c[_0x8b23('0x3e')]));_0x566b1a['where'][_0x8b23('0x67')]=_0x59776e['id'];if(_0x33c453[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x566b1a[_0x8b23('0x46')]=_['merge'](_0x566b1a[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x566b1a['attributes'],function(_0x3a9fc9){var _0x2712bf={};_0x2712bf[_0x3a9fc9]={'$like':'%'+_0x33c453[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x2712bf;})});}_0x566b1a=_[_0x8b23('0x48')]({},_0x566b1a,_0x33c453[_0x8b23('0x4a')]);return db[_0x8b23('0x69')][_0x8b23('0x4b')]({'where':_0x566b1a[_0x8b23('0x46')]})[_0x8b23('0x27')](function(_0x50dad6){_0x3c4048['count']=_0x50dad6;if(_0x33c453[_0x8b23('0x3d')]['includeAll']){_0x566b1a[_0x8b23('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x8b23('0x4e')](_0x566b1a);})[_0x8b23('0x27')](function(_0x8d4603){_0x3c4048[_0x8b23('0x64')]=_0x8d4603;return _0x3c4048;});}})[_0x8b23('0x27')](respondWithFilteredResult(_0x5a7eeb,_0x566b1a))[_0x8b23('0x4f')](handleError(_0x5a7eeb,null));};exports[_0x8b23('0x6a')]=function(_0x1b4be7,_0x422fb7,_0x149fbe){var _0x32dd44={'raw':!![],'where':{}};var _0x285de6={};var _0x413d05={'count':0x0,'rows':[]};return db[_0x8b23('0x38')][_0x8b23('0x61')]({'where':{'id':_0x1b4be7[_0x8b23('0x50')]['id']}})['then'](handleEntityNotFound(_0x422fb7,null))[_0x8b23('0x27')](function(_0x2a4384){if(_0x2a4384){_0x285de6['model']=_[_0x8b23('0x51')](db[_0x8b23('0x6b')]['rawAttributes']);_0x285de6[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0x1b4be7[_0x8b23('0x3d')]);_0x285de6[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x285de6[_0x8b23('0x3c')],_0x285de6[_0x8b23('0x3d')]);_0x32dd44[_0x8b23('0x41')]=_[_0x8b23('0x3f')](_0x285de6[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x1b4be7[_0x8b23('0x3d')][_0x8b23('0x40')]));_0x32dd44[_0x8b23('0x41')]=_0x32dd44[_0x8b23('0x41')][_0x8b23('0x42')]?_0x32dd44[_0x8b23('0x41')]:_0x285de6['model'];if(!_0x1b4be7[_0x8b23('0x3d')]['hasOwnProperty'](_0x8b23('0x62'))){_0x32dd44[_0x8b23('0x21')]=qs[_0x8b23('0x21')](_0x1b4be7['query'][_0x8b23('0x21')]);_0x32dd44[_0x8b23('0x20')]=qs[_0x8b23('0x20')](_0x1b4be7[_0x8b23('0x3d')][_0x8b23('0x20')]);}_0x32dd44[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0x1b4be7[_0x8b23('0x3d')][_0x8b23('0x45')]);_0x32dd44[_0x8b23('0x46')]=qs[_0x8b23('0x3e')](_['pick'](_0x1b4be7[_0x8b23('0x3d')],_0x285de6[_0x8b23('0x3e')]));_0x32dd44[_0x8b23('0x46')][_0x8b23('0x67')]=_0x2a4384['id'];if(_0x1b4be7[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x32dd44['where']=_['merge'](_0x32dd44['where'],{'$or':_[_0x8b23('0x30')](_0x32dd44[_0x8b23('0x41')],function(_0x21b155){var _0x302023={};_0x302023[_0x21b155]={'$like':'%'+_0x1b4be7[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x302023;})});}_0x32dd44=_[_0x8b23('0x48')]({},_0x32dd44,_0x1b4be7['options']);return db[_0x8b23('0x6b')][_0x8b23('0x4b')]({'where':_0x32dd44[_0x8b23('0x46')]})[_0x8b23('0x27')](function(_0x2144d0){_0x413d05['count']=_0x2144d0;if(_0x1b4be7[_0x8b23('0x3d')]['includeAll']){_0x32dd44[_0x8b23('0x4d')]=[{'all':!![]}];}return db[_0x8b23('0x6b')]['findAll'](_0x32dd44);})[_0x8b23('0x27')](function(_0x41d76d){_0x413d05[_0x8b23('0x64')]=_0x41d76d;return _0x413d05;});}})['then'](respondWithFilteredResult(_0x422fb7,_0x32dd44))[_0x8b23('0x4f')](handleError(_0x422fb7,null));};exports['getTeams']=function(_0x133543,_0x3af4e6,_0x14251d){var _0x1ef245={};var _0x454169={};var _0x389ee3;var _0x26d486;return db[_0x8b23('0x38')]['findOne']({'where':{'id':_0x133543[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x3af4e6,null))['then'](function(_0x3ed87f){if(_0x3ed87f){_0x389ee3=_0x3ed87f;_0x454169[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x6c')][_0x8b23('0x39')]);_0x454169[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0x133543[_0x8b23('0x3d')]);_0x454169['filters']=_[_0x8b23('0x3f')](_0x454169[_0x8b23('0x3c')],_0x454169[_0x8b23('0x3d')]);_0x1ef245[_0x8b23('0x41')]=_['intersection'](_0x454169[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x133543['query'][_0x8b23('0x40')]));_0x1ef245[_0x8b23('0x41')]=_0x1ef245['attributes']['length']?_0x1ef245[_0x8b23('0x41')]:_0x454169[_0x8b23('0x3c')];_0x1ef245[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0x133543[_0x8b23('0x3d')]['sort']);_0x1ef245[_0x8b23('0x46')]=qs[_0x8b23('0x3e')](_[_0x8b23('0x47')](_0x133543[_0x8b23('0x3d')],_0x454169[_0x8b23('0x3e')]));if(_0x133543[_0x8b23('0x3d')]['filter']){_0x1ef245[_0x8b23('0x46')]=_['merge'](_0x1ef245[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x1ef245[_0x8b23('0x41')],function(_0x173a27){var _0x195ad2={};_0x195ad2[_0x173a27]={'$like':'%'+_0x133543[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x195ad2;})});}_0x1ef245=_[_0x8b23('0x48')]({},_0x1ef245,_0x133543[_0x8b23('0x4a')]);return _0x389ee3[_0x8b23('0x6d')](_0x1ef245);}})['then'](function(_0x1d7052){if(_0x1d7052){_0x26d486=_0x1d7052['length'];if(!_0x133543[_0x8b23('0x3d')][_0x8b23('0x43')](_0x8b23('0x62'))){_0x1ef245[_0x8b23('0x21')]=qs[_0x8b23('0x21')](_0x133543['query'][_0x8b23('0x21')]);_0x1ef245[_0x8b23('0x20')]=qs[_0x8b23('0x20')](_0x133543[_0x8b23('0x3d')]['offset']);}return _0x389ee3['getTeams'](_0x1ef245);}})['then'](function(_0x3ecd0f){if(_0x3ecd0f){return _0x3ecd0f?{'count':_0x26d486,'rows':_0x3ecd0f}:null;}})[_0x8b23('0x27')](respondWithResult(_0x3af4e6,null))[_0x8b23('0x4f')](handleError(_0x3af4e6,null));};exports[_0x8b23('0x6e')]=function(_0x3420ce,_0xa42c47,_0x44178b){var _0x5bee81=_0x3420ce[_0x8b23('0x54')][_0x8b23('0x6f')];var _0x481211=_[_0x8b23('0x30')](_0x5bee81,'id');return db[_0x8b23('0x6c')][_0x8b23('0x4e')]({'where':{'id':_0x481211},'attributes':['id'],'include':[{'model':db[_0x8b23('0x70')],'as':_0x8b23('0x71'),'attributes':['id',_0x8b23('0x33'),_0x8b23('0x72'),_0x8b23('0x73'),_0x8b23('0x74')],'raw':!![]}]})[_0x8b23('0x27')](function(_0x1e247f){if(_0x1e247f){var _0x222fdc=_['flatMap'](_0x1e247f,function(_0x1c9f5d){var _0xd25b2c=_0x1c9f5d['get']({'plain':!![]});_0xd25b2c['Agents'][_0x8b23('0x75')](function(_0x582715){_0x582715['penalty']=_[_0x8b23('0x52')](_0x5bee81,{'id':_0xd25b2c['id']})[_0x8b23('0x76')];});return _0xd25b2c[_0x8b23('0x71')];});return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x3420ce[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](function(_0x2b1bc6){return db[_0x8b23('0x77')][_0x8b23('0x78')](function(_0x55cde7){return _0x2b1bc6[_0x8b23('0x6e')](_0x481211,{'transaction':_0x55cde7})['then'](function(){return BPromise['each'](_0x222fdc,function(_0x181ebb){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x181ebb['id'],'VoiceQueueId':_0x3420ce[_0x8b23('0x50')]['id']},'defaults':{'penalty':_0x181ebb['penalty']},'transaction':_0x55cde7});});})[_0x8b23('0x27')](function(){return BPromise['each'](_[_0x8b23('0x2e')](_0x222fdc,{'online':!![]}),function(_0x330da3){return db['UserVoiceQueueRt'][_0x8b23('0x79')]({'membername':_0x330da3[_0x8b23('0x33')],'UserId':_0x330da3['id'],'queue_name':_0x2b1bc6[_0x8b23('0x33')],'VoiceQueueId':_0x2b1bc6['id'],'interface':_[_0x8b23('0x7a')](_0x330da3['interface'])?util[_0x8b23('0x7b')](_0x8b23('0x7c'),_0x330da3[_0x8b23('0x33')]):_0x330da3[_0x8b23('0x74')],'paused':_0x330da3[_0x8b23('0x73')]||![],'penalty':_0x330da3[_0x8b23('0x76')]},{'transaction':_0x55cde7});});})[_0x8b23('0x27')](function(){_0x222fdc[_0x8b23('0x75')](function(_0x2b8dda){socket[_0x8b23('0x7d')]('userVoiceQueue:save',{'UserId':_0x2b8dda['id'],'VoiceQueueId':_0x2b1bc6['id']});});});});});}})[_0x8b23('0x27')](respondWithStatusCode(_0xa42c47,null))['catch'](handleError(_0xa42c47,null));};exports['removeTeams']=function(_0x6385ae,_0x9bc128,_0x23736d){return db[_0x8b23('0x6c')][_0x8b23('0x4e')]({'where':{'id':_0x6385ae[_0x8b23('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8b23('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x9bc128,null))['then'](function(_0x106f30){var _0x20d10b=_[_0x8b23('0x30')](_0x106f30,'id');var _0x2f0d8a=[];var _0x2ec9eb=[];var _0x5ad47c=squel[_0x8b23('0x7e')]();_0x5ad47c[_0x8b23('0x7f')]('tq.TeamId')[_0x8b23('0x80')](_0x8b23('0x81'),'tq')[_0x8b23('0x82')](_0x8b23('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8b23('0x46')]('VoiceQueueId\x20=\x20?',_0x6385ae[_0x8b23('0x50')]['id']);for(var _0x4246b3=0x0;_0x4246b3<_0x106f30[_0x8b23('0x42')];_0x4246b3+=0x1){let _0xbdc725=_0x106f30[_0x4246b3];for(var _0x360d4a=0x0;_0x360d4a<_0xbdc725[_0x8b23('0x71')][_0x8b23('0x42')];_0x360d4a+=0x1){let _0x23d24f=_0xbdc725[_0x8b23('0x71')][_0x360d4a];var _0x12fe0a=_0x5ad47c[_0x8b23('0x84')]();_0x12fe0a[_0x8b23('0x46')]('ut.UserId\x20=\x20?',_0x23d24f['id']);_0x2ec9eb[_0x8b23('0x85')](db[_0x8b23('0x77')][_0x8b23('0x3d')](_0x12fe0a[_0x8b23('0x86')](),{'type':db[_0x8b23('0x77')][_0x8b23('0x87')][_0x8b23('0x88')]})['then'](function(_0x34ae4e){if(_0x34ae4e[_0x8b23('0x42')]===0x1){return _0x23d24f['id'];}else{var _0x3932ea=_['every'](_[_0x8b23('0x30')](_0x34ae4e,_0x8b23('0x89')),function(_0x9fcb7f){return _[_0x8b23('0x8a')](_0x20d10b,_0x9fcb7f);});if(_0x3932ea){return _0x23d24f['id'];}}}));}}return BPromise['all'](_0x2ec9eb)[_0x8b23('0x27')](function(_0x393ddb){_0x2f0d8a=_(_0x2f0d8a)[_0x8b23('0x8b')](_0x393ddb)['compact']()[_0x8b23('0x31')]();return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x6385ae[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](function(_0x2dd1b3){return db['sequelize'][_0x8b23('0x78')](function(_0x4e0100){return _0x2dd1b3[_0x8b23('0x8c')](_0x6385ae['query'][_0x8b23('0x8d')],{'transaction':_0x4e0100})[_0x8b23('0x27')](function(){if(!_['isEmpty'](_0x2f0d8a)){return _0x2dd1b3[_0x8b23('0x8e')](_0x2f0d8a,{'transaction':_0x4e0100})['then'](function(){return db[_0x8b23('0x8f')][_0x8b23('0x28')]({'where':{'VoiceQueueId':_0x6385ae['params']['id'],'UserId':_0x2f0d8a},'transaction':_0x4e0100});});}})[_0x8b23('0x27')](function(){_0x2f0d8a[_0x8b23('0x75')](function(_0x5a2c4d){socket[_0x8b23('0x7d')](_0x8b23('0x90'),{'UserId':_0x5a2c4d,'VoiceQueueId':_0x2dd1b3['id']});});});});});});})[_0x8b23('0x27')](respondWithStatusCode(_0x9bc128,null))[_0x8b23('0x4f')](handleError(_0x9bc128,null));};exports[_0x8b23('0x91')]=function(_0x5af152,_0x55fbab,_0x1979ff){var _0xf3402d,_0x48a8d6;return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x5af152[_0x8b23('0x50')]['id']}})['then'](handleEntityNotFound(_0x55fbab,null))['then'](function(_0x4e2850){if(_0x4e2850){_0x48a8d6=_0x4e2850;return _0x4e2850[_0x8b23('0x91')](_0x5af152[_0x8b23('0x54')]['ids'],_[_0x8b23('0x59')](_0x5af152[_0x8b23('0x54')],[_0x8b23('0x8d'),'id'])||{})[_0x8b23('0x92')](function(_0x3a3f87){for(var _0x253fd9=0x0;_0x253fd9<_0x5af152[_0x8b23('0x54')]['ids'][_0x8b23('0x42')];_0x253fd9+=0x1){socket[_0x8b23('0x7d')](_0x8b23('0x93'),{'UserId':_0x5af152[_0x8b23('0x54')]['ids'][_0x253fd9],'VoiceQueueId':_0x5af152['params']['id']});}return _0x3a3f87;});}})[_0x8b23('0x27')](function(_0x2c99fd){_0xf3402d=_0x2c99fd||[];if(_0x48a8d6){return db['User'][_0x8b23('0x4e')]({'where':{'id':_0x5af152[_0x8b23('0x54')][_0x8b23('0x8d')]},'attributes':['id','name',_0x8b23('0x72'),_0x8b23('0x73'),'interface'],'raw':!![]});}})['then'](function(_0x626cf3){if(!_[_0x8b23('0x94')](_0x626cf3)){var _0x53101b=[];for(var _0x503016=0x0;_0x503016<_0x626cf3['length'];_0x503016++){if(_0x626cf3[_0x503016][_0x8b23('0x72')]){_0x53101b[_0x8b23('0x85')](db[_0x8b23('0x8f')]['upsert']({'membername':_0x626cf3[_0x503016][_0x8b23('0x33')],'UserId':_0x626cf3[_0x503016]['id'],'queue_name':_0x48a8d6[_0x8b23('0x33')],'VoiceQueueId':_0x48a8d6['id'],'interface':_[_0x8b23('0x7a')](_0x626cf3[_0x503016][_0x8b23('0x74')])?util[_0x8b23('0x7b')](_0x8b23('0x7c'),_0x626cf3[_0x503016][_0x8b23('0x33')]):_0x626cf3[_0x503016][_0x8b23('0x74')],'paused':_0x626cf3[_0x503016][_0x8b23('0x73')]||![],'penalty':_0x5af152[_0x8b23('0x54')][_0x8b23('0x76')]||0x0}));}}return BPromise['all'](_0x53101b);}})[_0x8b23('0x27')](function(){return _0xf3402d;})['then'](respondWithResult(_0x55fbab,null))[_0x8b23('0x4f')](handleError(_0x55fbab,null));};exports[_0x8b23('0x8e')]=function(_0x13e9bb,_0x486610,_0x1ca1a5){return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x13e9bb['params']['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x486610,null))[_0x8b23('0x27')](function(_0x4a4bdb){if(_0x4a4bdb){return _0x4a4bdb['removeAgents'](_0x13e9bb[_0x8b23('0x3d')][_0x8b23('0x8d')])[_0x8b23('0x27')](function(){if(_['isArray'](_0x13e9bb[_0x8b23('0x3d')][_0x8b23('0x8d')])){for(var _0xcc4143=0x0;_0xcc4143<_0x13e9bb['query'][_0x8b23('0x8d')][_0x8b23('0x42')];_0xcc4143+=0x1){socket[_0x8b23('0x7d')](_0x8b23('0x90'),{'UserId':Number(_0x13e9bb[_0x8b23('0x3d')][_0x8b23('0x8d')][_0xcc4143]),'VoiceQueueId':Number(_0x13e9bb[_0x8b23('0x50')]['id'])});}}else{socket[_0x8b23('0x7d')](_0x8b23('0x90'),{'UserId':Number(_0x13e9bb[_0x8b23('0x3d')][_0x8b23('0x8d')]),'VoiceQueueId':Number(_0x13e9bb[_0x8b23('0x50')]['id'])});}});}})[_0x8b23('0x27')](function(_0xa4685e){return db[_0x8b23('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x13e9bb[_0x8b23('0x50')]['id'],'UserId':_0x13e9bb[_0x8b23('0x3d')][_0x8b23('0x8d')]}})[_0x8b23('0x27')](function(){return _0xa4685e;});})[_0x8b23('0x27')](respondWithStatusCode(_0x486610,null))['catch'](handleError(_0x486610,null));};exports[_0x8b23('0x95')]=function(_0x562c8b,_0x2cbd14,_0x54507b){var _0x1648b4={};var _0x550548={};var _0x2b8c9c;var _0x28725e;return db[_0x8b23('0x38')][_0x8b23('0x61')]({'where':{'id':_0x562c8b[_0x8b23('0x50')]['id']}})['then'](handleEntityNotFound(_0x2cbd14,null))[_0x8b23('0x27')](function(_0x3b160a){if(_0x3b160a){_0x2b8c9c=_0x3b160a;_0x550548[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x70')][_0x8b23('0x39')]);_0x550548[_0x8b23('0x3d')]=_['keys'](_0x562c8b[_0x8b23('0x3d')]);_0x550548[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x550548[_0x8b23('0x3c')],_0x550548['query']);_0x1648b4[_0x8b23('0x41')]=_[_0x8b23('0x3f')](_0x550548['model'],qs[_0x8b23('0x40')](_0x562c8b['query'][_0x8b23('0x40')]));_0x1648b4[_0x8b23('0x41')]=_0x1648b4['attributes'][_0x8b23('0x42')]?_0x1648b4['attributes']:_0x550548['model'];_0x1648b4[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0x562c8b[_0x8b23('0x3d')][_0x8b23('0x45')]);_0x1648b4['where']=qs[_0x8b23('0x3e')](_[_0x8b23('0x47')](_0x562c8b[_0x8b23('0x3d')],_0x550548['filters']));if(_0x562c8b[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x1648b4['where']=_[_0x8b23('0x48')](_0x1648b4['where'],{'$or':_['map'](_0x1648b4[_0x8b23('0x41')],function(_0x2a2be5){var _0x3f0730={};_0x3f0730[_0x2a2be5]={'$like':'%'+_0x562c8b[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x3f0730;})});}_0x1648b4=_[_0x8b23('0x48')]({},_0x1648b4,_0x562c8b[_0x8b23('0x4a')]);return _0x2b8c9c[_0x8b23('0x95')](_0x1648b4);}})[_0x8b23('0x27')](function(_0x419df0){if(_0x419df0){_0x28725e=_0x419df0[_0x8b23('0x42')];if(!_0x562c8b['query']['hasOwnProperty'](_0x8b23('0x62'))){_0x1648b4[_0x8b23('0x21')]=qs['limit'](_0x562c8b[_0x8b23('0x3d')][_0x8b23('0x21')]);_0x1648b4['offset']=qs[_0x8b23('0x20')](_0x562c8b[_0x8b23('0x3d')][_0x8b23('0x20')]);}return _0x2b8c9c[_0x8b23('0x95')](_0x1648b4);}})['then'](function(_0x9b7825){if(_0x9b7825){return _0x9b7825?{'count':_0x28725e,'rows':_0x9b7825}:null;}})[_0x8b23('0x27')](respondWithResult(_0x2cbd14,null))['catch'](handleError(_0x2cbd14,null));};exports[_0x8b23('0x96')]=function(_0x4b4db6,_0x48bc96,_0x535d57){var _0x4caaa8={};var _0x2a4c52={};var _0x15c0c8;var _0x29060e;return db['VoiceQueue']['findOne']({'where':{'id':_0x4b4db6[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x48bc96,null))[_0x8b23('0x27')](function(_0x364122){if(_0x364122){_0x15c0c8=_0x364122;_0x2a4c52[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x8f')][_0x8b23('0x39')]);_0x2a4c52[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0x4b4db6[_0x8b23('0x3d')]);_0x2a4c52[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x2a4c52['model'],_0x2a4c52[_0x8b23('0x3d')]);_0x4caaa8[_0x8b23('0x41')]=_[_0x8b23('0x3f')](_0x2a4c52[_0x8b23('0x3c')],qs[_0x8b23('0x40')](_0x4b4db6[_0x8b23('0x3d')][_0x8b23('0x40')]));_0x4caaa8[_0x8b23('0x41')]=_0x4caaa8['attributes'][_0x8b23('0x42')]?_0x4caaa8[_0x8b23('0x41')]:_0x2a4c52[_0x8b23('0x3c')];_0x4caaa8[_0x8b23('0x44')]=qs['sort'](_0x4b4db6[_0x8b23('0x3d')]['sort']);_0x4caaa8[_0x8b23('0x46')]=qs[_0x8b23('0x3e')](_[_0x8b23('0x47')](_0x4b4db6[_0x8b23('0x3d')],_0x2a4c52[_0x8b23('0x3e')]));if(_0x4b4db6[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x4caaa8[_0x8b23('0x46')]=_['merge'](_0x4caaa8[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x4caaa8[_0x8b23('0x41')],function(_0x43f04f){var _0x1b9d0d={};_0x1b9d0d[_0x43f04f]={'$like':'%'+_0x4b4db6[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x1b9d0d;})});}_0x4caaa8=_['merge']({},_0x4caaa8,_0x4b4db6[_0x8b23('0x4a')]);return _0x15c0c8[_0x8b23('0x96')](_0x4caaa8);}})[_0x8b23('0x27')](function(_0x537a30){if(_0x537a30){_0x29060e=_0x537a30[_0x8b23('0x42')];if(!_0x4b4db6[_0x8b23('0x3d')]['hasOwnProperty'](_0x8b23('0x62'))){_0x4caaa8[_0x8b23('0x21')]=qs['limit'](_0x4b4db6['query']['limit']);_0x4caaa8['offset']=qs[_0x8b23('0x20')](_0x4b4db6[_0x8b23('0x3d')][_0x8b23('0x20')]);}return _0x15c0c8[_0x8b23('0x96')](_0x4caaa8);}})[_0x8b23('0x27')](function(_0x185c91){return _0x185c91?{'count':_0x29060e,'rows':_0x185c91}:null;})[_0x8b23('0x27')](respondWithResult(_0x48bc96,null))[_0x8b23('0x4f')](handleError(_0x48bc96,null));};exports[_0x8b23('0x97')]=function(_0x2360b6,_0x49661c,_0x577132){var _0x4128ca={};var _0x4452f4={};var _0x3c7cc4;var _0x31e609;return db['VoiceQueue'][_0x8b23('0x61')]({'where':{'id':_0x2360b6[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x49661c,null))[_0x8b23('0x27')](function(_0x56875b){if(_0x56875b){_0x3c7cc4=_0x56875b;_0x4452f4[_0x8b23('0x3c')]=_[_0x8b23('0x51')](db[_0x8b23('0x98')][_0x8b23('0x39')]);_0x4452f4[_0x8b23('0x3d')]=_['keys'](_0x2360b6[_0x8b23('0x3d')]);_0x4452f4['filters']=_[_0x8b23('0x3f')](_0x4452f4['model'],_0x4452f4['query']);_0x4128ca['attributes']=_[_0x8b23('0x3f')](_0x4452f4[_0x8b23('0x3c')],qs['fields'](_0x2360b6[_0x8b23('0x3d')][_0x8b23('0x40')]));_0x4128ca[_0x8b23('0x41')]=_0x4128ca[_0x8b23('0x41')][_0x8b23('0x42')]?_0x4128ca[_0x8b23('0x41')]:_0x4452f4[_0x8b23('0x3c')];_0x4128ca['order']=qs[_0x8b23('0x45')](_0x2360b6['query']['sort']);_0x4128ca[_0x8b23('0x46')]=qs[_0x8b23('0x3e')](_[_0x8b23('0x47')](_0x2360b6['query'],_0x4452f4[_0x8b23('0x3e')]));if(_0x2360b6[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x4128ca[_0x8b23('0x46')]=_[_0x8b23('0x48')](_0x4128ca[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x4128ca['attributes'],function(_0x2f2f4b){var _0x50abf1={};_0x50abf1[_0x2f2f4b]={'$like':'%'+_0x2360b6[_0x8b23('0x3d')][_0x8b23('0x2e')]+'%'};return _0x50abf1;})});}_0x4128ca=_['merge']({},_0x4128ca,_0x2360b6[_0x8b23('0x4a')]);return _0x3c7cc4[_0x8b23('0x97')](_0x4128ca);}})['then'](function(_0xbee7f3){if(_0xbee7f3){_0x31e609=_0xbee7f3[_0x8b23('0x42')];if(!_0x2360b6[_0x8b23('0x3d')]['hasOwnProperty']('nolimit')){_0x4128ca['limit']=qs[_0x8b23('0x21')](_0x2360b6['query'][_0x8b23('0x21')]);_0x4128ca['offset']=qs[_0x8b23('0x20')](_0x2360b6[_0x8b23('0x3d')][_0x8b23('0x20')]);}return _0x3c7cc4[_0x8b23('0x97')](_0x4128ca);}})['then'](function(_0x53d86d){if(_0x53d86d){return _0x53d86d?{'count':_0x31e609,'rows':_0x53d86d}:null;}})[_0x8b23('0x27')](respondWithResult(_0x49661c,null))[_0x8b23('0x4f')](handleError(_0x49661c,null));};exports[_0x8b23('0x99')]=function(_0x2a39a1,_0x306052,_0x2c7e98){var _0x3169ac,_0x1d7b95;return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x2a39a1[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x306052,null))[_0x8b23('0x27')](function(_0x912dd5){if(_0x912dd5){_0x1d7b95=_0x912dd5;return _0x912dd5[_0x8b23('0x99')](_0x2a39a1[_0x8b23('0x54')][_0x8b23('0x8d')],_[_0x8b23('0x59')](_0x2a39a1['body'],['ids','id'])||{});}return null;})[_0x8b23('0x92')](function(_0x1889c8){var _0x50c8d1;_0x3169ac=_0x1889c8||[];var _0x8c9569=[];if(_0x1889c8){for(var _0xc9027d=0x0;_0xc9027d<_0x1889c8[_0x8b23('0x42')];_0xc9027d+=0x1){var _0x2aa853=_0x1889c8[_0xc9027d][_0x8b23('0x29')]({'plain':!![]});_0x1d7b95[_0x8b23('0x9a')]=_0x2a39a1['body'][_0x8b23('0x9a')]?_0x2a39a1[_0x8b23('0x54')][_0x8b23('0x9a')]:_0x1d7b95['dialCheckDuplicateType'];switch(_0x1d7b95[_0x8b23('0x9a')]){case _0x8b23('0x9b'):_0x50c8d1=squel[_0x8b23('0x9c')]()['into']('cm_hopper')[_0x8b23('0x9d')]([_0x8b23('0x9e'),_0x8b23('0x9f'),_0x8b23('0xa0'),_0x8b23('0xa1'),'VoiceQueueId',_0x8b23('0x5b'),'updatedAt'],squel[_0x8b23('0x7e')]()['field'](_0x8b23('0x9e'),_0x8b23('0x9e'))['field'](_0x8b23('0xa2'),'scheduledAt')[_0x8b23('0x7f')]('id',_0x8b23('0xa0'))[_0x8b23('0x7f')](_0x2aa853[_0x8b23('0xa3')][_0x8b23('0x86')](),_0x8b23('0xa1'))[_0x8b23('0x7f')](_0x2a39a1['params']['id'][_0x8b23('0x86')](),'VoiceQueueId')[_0x8b23('0x7f')]('NOW()',_0x8b23('0x5b'))['field']('NOW()',_0x8b23('0x5a'))['from'](_0x8b23('0xa4'))['where'](_0x8b23('0xa5'))[_0x8b23('0x46')]('ListId\x20=\x20?',_0x2aa853[_0x8b23('0xa3')]['toString']())[_0x8b23('0x46')](_0x8b23('0xa6'))['where'](_0x8b23('0xa7'),squel[_0x8b23('0x7e')]()['field'](_0x8b23('0xa8'))[_0x8b23('0x80')]('cm_hopper_final')['where'](_0x8b23('0xa9'),_0x2a39a1['params']['id']['toString']()))['where'](_0x8b23('0xa7'),squel[_0x8b23('0x7e')]()['field'](_0x8b23('0xaa'))[_0x8b23('0x80')]('cm_hopper')[_0x8b23('0x46')](_0x8b23('0xa9'),_0x2a39a1[_0x8b23('0x50')]['id']['toString']())))[_0x8b23('0x86')]();break;case _0x8b23('0xab'):_0x50c8d1=squel['insert']()[_0x8b23('0xac')]('cm_hopper')['fromQuery']([_0x8b23('0x9e'),'scheduledAt','ContactId',_0x8b23('0xa1'),'VoiceQueueId',_0x8b23('0x5b'),_0x8b23('0x5a')],squel[_0x8b23('0x7e')]()[_0x8b23('0x7f')](_0x8b23('0x9e'),'phone')[_0x8b23('0x7f')](_0x8b23('0xa2'),_0x8b23('0x9f'))[_0x8b23('0x7f')]('id',_0x8b23('0xa0'))[_0x8b23('0x7f')](_0x2aa853[_0x8b23('0xa3')]['toString'](),_0x8b23('0xa1'))['field'](_0x2a39a1['params']['id']['toString'](),_0x8b23('0x67'))[_0x8b23('0x7f')]('NOW()','createdAt')['field'](_0x8b23('0xa2'),'updatedAt')[_0x8b23('0x80')](_0x8b23('0xa4'))[_0x8b23('0x46')](_0x8b23('0xa5'))[_0x8b23('0x46')](_0x8b23('0xad'),_0x2aa853['CmListId'][_0x8b23('0x86')]())[_0x8b23('0x46')](_0x8b23('0xa6'))[_0x8b23('0x46')](_0x8b23('0xa7'),squel[_0x8b23('0x7e')]()[_0x8b23('0x7f')](_0x8b23('0xaa'))[_0x8b23('0x80')](_0x8b23('0xae'))[_0x8b23('0x46')]('VoiceQueueId\x20=\x20?',_0x2a39a1[_0x8b23('0x50')]['id'][_0x8b23('0x86')]())))[_0x8b23('0x86')]();break;default:_0x50c8d1=squel[_0x8b23('0x9c')]()['into'](_0x8b23('0xae'))['fromQuery'](['phone',_0x8b23('0x9f'),_0x8b23('0xa0'),_0x8b23('0xa1'),'VoiceQueueId',_0x8b23('0x5b'),'updatedAt'],squel[_0x8b23('0x7e')]()['field'](_0x8b23('0x9e'),_0x8b23('0x9e'))[_0x8b23('0x7f')](_0x8b23('0xa2'),'scheduledAt')['field']('id',_0x8b23('0xa0'))[_0x8b23('0x7f')](_0x2aa853[_0x8b23('0xa3')][_0x8b23('0x86')](),_0x8b23('0xa1'))[_0x8b23('0x7f')](_0x2a39a1['params']['id'][_0x8b23('0x86')](),_0x8b23('0x67'))[_0x8b23('0x7f')](_0x8b23('0xa2'),_0x8b23('0x5b'))[_0x8b23('0x7f')](_0x8b23('0xa2'),'updatedAt')[_0x8b23('0x80')](_0x8b23('0xa4'))['where'](_0x8b23('0xa5'))[_0x8b23('0x46')](_0x8b23('0xad'),_0x2aa853[_0x8b23('0xa3')]['toString']())[_0x8b23('0x46')](_0x8b23('0xa6')))[_0x8b23('0x86')]();}_0x8c9569[_0x8b23('0x85')](db[_0x8b23('0x77')][_0x8b23('0x3d')](_0x50c8d1));}return BPromise[_0x8b23('0xaf')](_0x8c9569);}})['then'](function(){return _0x3169ac;})[_0x8b23('0x27')](respondWithResult(_0x306052,null))[_0x8b23('0x4f')](handleError(_0x306052,null));};exports[_0x8b23('0xb0')]=function(_0xfa05e0,_0x185c1d,_0x124860){return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0xfa05e0[_0x8b23('0x50')]['id']}})['then'](handleEntityNotFound(_0x185c1d,null))[_0x8b23('0x27')](function(_0x44fff9){if(_0x44fff9){return _0x44fff9[_0x8b23('0xb0')](_0xfa05e0[_0x8b23('0x3d')][_0x8b23('0x8d')]);}})['then'](function(_0x538324){if(_0x538324){return db['CmHopper'][_0x8b23('0x28')]({'where':{'ListId':_0xfa05e0[_0x8b23('0x3d')][_0x8b23('0x8d')],'VoiceQueueId':_0xfa05e0[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](function(){return _0x538324;});}})[_0x8b23('0x27')](respondWithStatusCode(_0x185c1d,null))[_0x8b23('0x4f')](handleError(_0x185c1d,null));};exports[_0x8b23('0xb1')]=function(_0xfb6cbb,_0x33f816,_0x4f4037){var _0x487577={};var _0x44a479={};var _0x1f18dd;var _0x4f01ed;return db['VoiceQueue'][_0x8b23('0x61')]({'where':{'id':_0xfb6cbb[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x33f816,null))[_0x8b23('0x27')](function(_0x3e93e7){if(_0x3e93e7){_0x1f18dd=_0x3e93e7;_0x44a479[_0x8b23('0x3c')]=_['keys'](db['CmList'][_0x8b23('0x39')]);_0x44a479[_0x8b23('0x3d')]=_[_0x8b23('0x51')](_0xfb6cbb['query']);_0x44a479[_0x8b23('0x3e')]=_[_0x8b23('0x3f')](_0x44a479[_0x8b23('0x3c')],_0x44a479[_0x8b23('0x3d')]);_0x487577[_0x8b23('0x41')]=_['intersection'](_0x44a479['model'],qs[_0x8b23('0x40')](_0xfb6cbb[_0x8b23('0x3d')]['fields']));_0x487577['attributes']=_0x487577[_0x8b23('0x41')][_0x8b23('0x42')]?_0x487577[_0x8b23('0x41')]:_0x44a479[_0x8b23('0x3c')];_0x487577[_0x8b23('0x44')]=qs[_0x8b23('0x45')](_0xfb6cbb[_0x8b23('0x3d')]['sort']);_0x487577[_0x8b23('0x46')]=qs['filters'](_['pick'](_0xfb6cbb[_0x8b23('0x3d')],_0x44a479['filters']));if(_0xfb6cbb[_0x8b23('0x3d')][_0x8b23('0x2e')]){_0x487577[_0x8b23('0x46')]=_[_0x8b23('0x48')](_0x487577[_0x8b23('0x46')],{'$or':_[_0x8b23('0x30')](_0x487577[_0x8b23('0x41')],function(_0x2da86e){var _0x30c32e={};_0x30c32e[_0x2da86e]={'$like':'%'+_0xfb6cbb[_0x8b23('0x3d')]['filter']+'%'};return _0x30c32e;})});}_0x487577=_['merge']({},_0x487577,_0xfb6cbb[_0x8b23('0x4a')]);return _0x1f18dd['getBlackLists'](_0x487577);}})['then'](function(_0x2a4705){if(_0x2a4705){_0x4f01ed=_0x2a4705[_0x8b23('0x42')];if(!_0xfb6cbb[_0x8b23('0x3d')]['hasOwnProperty'](_0x8b23('0x62'))){_0x487577[_0x8b23('0x21')]=qs[_0x8b23('0x21')](_0xfb6cbb[_0x8b23('0x3d')][_0x8b23('0x21')]);_0x487577['offset']=qs[_0x8b23('0x20')](_0xfb6cbb[_0x8b23('0x3d')][_0x8b23('0x20')]);}return _0x1f18dd[_0x8b23('0xb1')](_0x487577);}})[_0x8b23('0x27')](function(_0x1d5dff){if(_0x1d5dff){return _0x1d5dff?{'count':_0x4f01ed,'rows':_0x1d5dff}:null;}})[_0x8b23('0x27')](respondWithResult(_0x33f816,null))[_0x8b23('0x4f')](handleError(_0x33f816,null));};exports['addBlackLists']=function(_0x2ec34b,_0x1459c4,_0xa85220){var _0x5b3e22,_0x23abcb;return db[_0x8b23('0x38')][_0x8b23('0x52')]({'where':{'id':_0x2ec34b[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x1459c4,null))['then'](function(_0x3d6fbc){if(_0x3d6fbc){_0x23abcb=_0x3d6fbc;return _0x3d6fbc[_0x8b23('0xb2')](_0x2ec34b[_0x8b23('0x54')][_0x8b23('0x8d')],_[_0x8b23('0x59')](_0x2ec34b['body'],['ids','id'])||{});}return null;})[_0x8b23('0x92')](function(_0x4c3600){var _0x175949;_0x5b3e22=_0x4c3600||[];var _0x48b5c2=[];if(_0x4c3600){for(var _0x312f8d=0x0;_0x312f8d<_0x4c3600[_0x8b23('0x42')];_0x312f8d+=0x1){var _0x42cc39=_0x4c3600[_0x312f8d]['get']({'plain':!![]});_0x175949=squel[_0x8b23('0x9c')]()[_0x8b23('0xac')](_0x8b23('0xb3'))[_0x8b23('0x9d')](['phone',_0x8b23('0xa0'),_0x8b23('0xa1'),'VoiceQueueId',_0x8b23('0x5b'),_0x8b23('0x5a')],squel['select']()[_0x8b23('0x7f')](_0x8b23('0x9e'),_0x8b23('0x9e'))[_0x8b23('0x7f')]('id','ContactId')[_0x8b23('0x7f')](_0x42cc39['CmListId'][_0x8b23('0x86')](),_0x8b23('0xa1'))[_0x8b23('0x7f')](_0x2ec34b[_0x8b23('0x50')]['id'][_0x8b23('0x86')](),_0x8b23('0x67'))['field'](_0x8b23('0xa2'),_0x8b23('0x5b'))[_0x8b23('0x7f')](_0x8b23('0xa2'),_0x8b23('0x5a'))[_0x8b23('0x80')](_0x8b23('0xa4'))[_0x8b23('0x46')](_0x8b23('0xa5'))[_0x8b23('0x46')](_0x8b23('0xad'),_0x42cc39[_0x8b23('0xa3')][_0x8b23('0x86')]())[_0x8b23('0x46')](_0x8b23('0xa6')))[_0x8b23('0x86')]();_0x48b5c2['push'](db[_0x8b23('0x77')][_0x8b23('0x3d')](_0x175949));}return BPromise[_0x8b23('0xaf')](_0x48b5c2);}})[_0x8b23('0x27')](function(){return _0x5b3e22;})[_0x8b23('0x27')](respondWithResult(_0x1459c4,null))['catch'](handleError(_0x1459c4,null));};exports[_0x8b23('0xb4')]=function(_0x209ccb,_0x4e7f0e,_0x27ecbf){return db['VoiceQueue']['find']({'where':{'id':_0x209ccb[_0x8b23('0x50')]['id']}})[_0x8b23('0x27')](handleEntityNotFound(_0x4e7f0e,null))[_0x8b23('0x27')](function(_0x6c79c1){if(_0x6c79c1){return _0x6c79c1[_0x8b23('0xb4')](_0x209ccb[_0x8b23('0x3d')][_0x8b23('0x8d')]);}})[_0x8b23('0x27')](function(_0x4680e3){if(_0x4680e3){return db[_0x8b23('0x6b')][_0x8b23('0x28')]({'where':{'ListId':_0x209ccb['query'][_0x8b23('0x8d')],'VoiceQueueId':_0x209ccb[_0x8b23('0x50')]['id']}})['then'](function(){return _0x4680e3;});}})[_0x8b23('0x27')](respondWithStatusCode(_0x4e7f0e,null))[_0x8b23('0x4f')](handleError(_0x4e7f0e,null));};
\ No newline at end of file
+var _0x3fdb=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','online','voicePause','interface','flatMap','Agents','forEach','sequelize','transaction','each','TeamVoiceQueue','penalty','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','User','select','field','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','removeTeams','userVoiceQueue:remove','addAgents','spread','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','destroy','sendStatus','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x7d710,_0x412547){var _0x3f5e58=function(_0x11b52c){while(--_0x11b52c){_0x7d710['push'](_0x7d710['shift']());}};_0x3f5e58(++_0x412547);}(_0x3fdb,0x1af));var _0xb3fd=function(_0x38960a,_0x4e49b0){_0x38960a=_0x38960a-0x0;var _0x1003e2=_0x3fdb[_0x38960a];return _0x1003e2;};'use strict';var emlformat=require(_0xb3fd('0x0'));var rimraf=require(_0xb3fd('0x1'));var zipdir=require(_0xb3fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3fd('0x3'));var moment=require('moment');var BPromise=require(_0xb3fd('0x4'));var Mustache=require(_0xb3fd('0x5'));var util=require(_0xb3fd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb3fd('0x7'));var ejs=require(_0xb3fd('0x8'));var fs=require('fs');var fs_extra=require(_0xb3fd('0x9'));var _=require(_0xb3fd('0xa'));var squel=require('squel');var crypto=require(_0xb3fd('0xb'));var jsforce=require(_0xb3fd('0xc'));var deskjs=require(_0xb3fd('0xd'));var toCsv=require(_0xb3fd('0x7'));var querystring=require(_0xb3fd('0xe'));var Papa=require(_0xb3fd('0xf'));var Redis=require(_0xb3fd('0x10'));var authService=require(_0xb3fd('0x11'));var qs=require(_0xb3fd('0x12'));var as=require(_0xb3fd('0x13'));var hardwareService=require(_0xb3fd('0x14'));var logger=require(_0xb3fd('0x15'))(_0xb3fd('0x16'));var utils=require(_0xb3fd('0x17'));var config=require(_0xb3fd('0x18'));var licenseUtil=require(_0xb3fd('0x19'));var db=require(_0xb3fd('0x1a'))['db'];config[_0xb3fd('0x1b')]=_[_0xb3fd('0x1c')](config[_0xb3fd('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3fd('0x1b')]));require('./voiceQueue.socket')[_0xb3fd('0x1d')](socket);function respondWithStatusCode(_0x1f706b,_0x33a33c){_0x33a33c=_0x33a33c||0xcc;return function(_0x44bf55){if(_0x44bf55){return _0x1f706b['sendStatus'](_0x33a33c);}return _0x1f706b['status'](_0x33a33c)[_0xb3fd('0x1e')]();};}function respondWithResult(_0x3403fb,_0x519fd3){_0x519fd3=_0x519fd3||0xc8;return function(_0x5634af){if(_0x5634af){return _0x3403fb['status'](_0x519fd3)['json'](_0x5634af);}};}function respondWithFilteredResult(_0x36b67d,_0x3d92b9){return function(_0x13d283){if(_0x13d283){var _0x9c7ea9=typeof _0x3d92b9[_0xb3fd('0x1f')]==='undefined'&&typeof _0x3d92b9[_0xb3fd('0x20')]===_0xb3fd('0x21');var _0x38911e=_0x13d283[_0xb3fd('0x22')];var _0x14f402=_0x9c7ea9?0x0:_0x3d92b9[_0xb3fd('0x1f')];var _0x3c099a=_0x9c7ea9?_0x13d283['count']:_0x3d92b9[_0xb3fd('0x1f')]+_0x3d92b9[_0xb3fd('0x20')];var _0x123314;if(_0x3c099a>=_0x38911e){_0x3c099a=_0x38911e;_0x123314=0xc8;}else{_0x123314=0xce;}_0x36b67d[_0xb3fd('0x23')](_0x123314);return _0x36b67d[_0xb3fd('0x24')](_0xb3fd('0x25'),_0x14f402+'-'+_0x3c099a+'/'+_0x38911e)['json'](_0x13d283);}return null;};}function patchUpdates(_0x5a8a8d){return function(_0x590eb5){try{jsonpatch[_0xb3fd('0x26')](_0x590eb5,_0x5a8a8d,!![]);}catch(_0x3a8819){return BPromise[_0xb3fd('0x27')](_0x3a8819);}return _0x590eb5['save']();};}function saveUpdates(_0x45c993,_0x3417e9){return function(_0x4af128){if(_0x4af128){return _0x4af128[_0xb3fd('0x28')](_0x45c993)['then'](function(_0x147d0e){return _0x147d0e;});}return null;};}function removeEntity(_0x1866c1,_0x416912){return function(_0x23dec8){if(_0x23dec8){return _0x23dec8['destroy']()[_0xb3fd('0x29')](function(){var _0x171f17=_0x23dec8[_0xb3fd('0x2a')]({'plain':!![]});var _0x4c2b0c=[{'name':_0xb3fd('0x2b'),'value':_0xb3fd('0x2c'),'ignore':![]},{'name':_0xb3fd('0x2d'),'value':_0xb3fd('0x2e'),'ignore':![]}];var _0x4ea6ba=_(_0x4c2b0c)[_0xb3fd('0x2f')](_0xb3fd('0x30'))[_0xb3fd('0x31')]('value')[_0xb3fd('0x32')]();if(_['includes'](_0x4ea6ba,_0x171f17[_0xb3fd('0x33')])){return;}var _0x1df219=_[_0xb3fd('0x34')](_0x4c2b0c,[_0xb3fd('0x32'),_0x171f17[_0xb3fd('0x33')]])[_0xb3fd('0x35')];return db[_0xb3fd('0x36')][_0xb3fd('0x37')]({'where':{'type':_0x1df219,'resourceId':_0x171f17['id']}})[_0xb3fd('0x29')](function(){return _0x23dec8;});})[_0xb3fd('0x29')](function(){_0x1866c1[_0xb3fd('0x23')](0xcc)[_0xb3fd('0x1e')]();});}};}function handleEntityNotFound(_0x2923db,_0x5f3852){return function(_0x2f6e3d){if(!_0x2f6e3d){_0x2923db[_0xb3fd('0x38')](0x194);}return _0x2f6e3d;};}function handleError(_0x4dd2ce,_0x1cb48c){_0x1cb48c=_0x1cb48c||0x1f4;return function(_0x111b25){logger[_0xb3fd('0x39')](_0x111b25['stack']);if(_0x111b25[_0xb3fd('0x35')]){delete _0x111b25[_0xb3fd('0x35')];}_0x4dd2ce[_0xb3fd('0x23')](_0x1cb48c)[_0xb3fd('0x3a')](_0x111b25);};}exports[_0xb3fd('0x3b')]=function(_0x3f578b,_0x1ff8c1){var _0x5338f6={},_0x50cdae={},_0x181790={'count':0x0,'rows':[]};var _0x1cdab9=_[_0xb3fd('0x31')](db[_0xb3fd('0x3c')][_0xb3fd('0x3d')],function(_0x47f449){return{'name':_0x47f449[_0xb3fd('0x3e')],'type':_0x47f449['type'][_0xb3fd('0x3f')]};});_0x50cdae[_0xb3fd('0x40')]=_[_0xb3fd('0x31')](_0x1cdab9,_0xb3fd('0x35'));_0x50cdae[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x3f578b[_0xb3fd('0x41')]);_0x50cdae[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x50cdae[_0xb3fd('0x40')],_0x50cdae[_0xb3fd('0x41')]);_0x5338f6['attributes']=_[_0xb3fd('0x44')](_0x50cdae['model'],qs[_0xb3fd('0x45')](_0x3f578b[_0xb3fd('0x41')]['fields']));_0x5338f6[_0xb3fd('0x46')]=_0x5338f6[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x5338f6[_0xb3fd('0x46')]:_0x50cdae[_0xb3fd('0x40')];if(!_0x3f578b[_0xb3fd('0x41')]['hasOwnProperty']('nolimit')){_0x5338f6[_0xb3fd('0x20')]=qs['limit'](_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x5338f6['offset']=qs[_0xb3fd('0x1f')](_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0x5338f6[_0xb3fd('0x48')]=qs['sort'](_0x3f578b['query']['sort']);_0x5338f6[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x3f578b['query'],_0x50cdae[_0xb3fd('0x43')]),_0x1cdab9);if(_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x5338f6['where']=_[_0xb3fd('0x4b')](_0x5338f6[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x1cdab9,function(_0x13bd29){if(_0x13bd29[_0xb3fd('0x33')]!==_0xb3fd('0x4c')){var _0x5f3b42={};_0x5f3b42[_0x13bd29['name']]={'$like':'%'+_0x3f578b['query'][_0xb3fd('0x2f')]+'%'};return _0x5f3b42;}})});}_0x5338f6=_['merge']({},_0x5338f6,_0x3f578b[_0xb3fd('0x4d')]);var _0x27efe4={'where':_0x5338f6[_0xb3fd('0x49')]};return db[_0xb3fd('0x3c')][_0xb3fd('0x22')](_0x27efe4)[_0xb3fd('0x29')](function(_0x1f2532){_0x181790[_0xb3fd('0x22')]=_0x1f2532;if(_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0x5338f6[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x3c')][_0xb3fd('0x50')](_0x5338f6);})[_0xb3fd('0x29')](function(_0x39a6ce){_0x181790[_0xb3fd('0x51')]=_0x39a6ce;return _0x181790;})[_0xb3fd('0x29')](respondWithFilteredResult(_0x1ff8c1,_0x5338f6))[_0xb3fd('0x52')](handleError(_0x1ff8c1,null));};exports['show']=function(_0x559d1f,_0x3d96b0){var _0x7e08d6={'raw':![],'where':{'id':_0x559d1f['params']['id']}},_0x40836c={};_0x40836c[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x3c')]['rawAttributes']);_0x40836c[_0xb3fd('0x41')]=_['keys'](_0x559d1f[_0xb3fd('0x41')]);_0x40836c['filters']=_['intersection'](_0x40836c[_0xb3fd('0x40')],_0x40836c[_0xb3fd('0x41')]);_0x7e08d6[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x40836c[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x559d1f['query'][_0xb3fd('0x45')]));_0x7e08d6[_0xb3fd('0x46')]=_0x7e08d6['attributes'][_0xb3fd('0x47')]?_0x7e08d6[_0xb3fd('0x46')]:_0x40836c[_0xb3fd('0x40')];if(_0x559d1f[_0xb3fd('0x41')]['includeAll']){_0x7e08d6['include']=[{'all':!![]}];}_0x7e08d6=_['merge']({},_0x7e08d6,_0x559d1f[_0xb3fd('0x4d')]);return db['VoiceQueue'][_0xb3fd('0x34')](_0x7e08d6)['then'](handleEntityNotFound(_0x3d96b0,null))[_0xb3fd('0x29')](respondWithResult(_0x3d96b0,null))[_0xb3fd('0x52')](handleError(_0x3d96b0,null));};exports[_0xb3fd('0x53')]=function(_0x4a9214,_0x367703){return db['VoiceQueue'][_0xb3fd('0x53')](_0x4a9214[_0xb3fd('0x54')],{})['then'](function(_0x21fbdc){var _0x221922=_0x4a9214['user'][_0xb3fd('0x2a')]({'plain':!![]});if(!_0x221922)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x221922[_0xb3fd('0x55')]===_0xb3fd('0x56')){var _0x5bddcd=_0x21fbdc[_0xb3fd('0x2a')]({'plain':!![]});var _0x13d39f=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xb3fd('0x2d'),'value':'outbound'}];var _0x2296a8=_[_0xb3fd('0x34')](_0x13d39f,[_0xb3fd('0x32'),_0x5bddcd['type']])[_0xb3fd('0x35')];return db[_0xb3fd('0x57')][_0xb3fd('0x34')]({'where':{'name':_0x2296a8,'userProfileId':_0x221922[_0xb3fd('0x58')]},'raw':!![]})[_0xb3fd('0x29')](function(_0x3e1e5e){if(_0x3e1e5e&&_0x3e1e5e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bddcd[_0xb3fd('0x35')],'resourceId':_0x5bddcd['id'],'type':_0x3e1e5e[_0xb3fd('0x35')],'sectionId':_0x3e1e5e['id']},{})[_0xb3fd('0x29')](function(){return _0x21fbdc;});}else{return _0x21fbdc;}})[_0xb3fd('0x52')](function(_0x5c996e){logger[_0xb3fd('0x39')](_0xb3fd('0x59'),_0x5c996e);throw _0x5c996e;});}return _0x21fbdc;})['then'](respondWithResult(_0x367703,0xc9))[_0xb3fd('0x52')](handleError(_0x367703,null));};exports[_0xb3fd('0x5a')]=function(_0x2934e,_0x1a822d){var _0x7cbf03={'where':{'id':_0x2934e[_0xb3fd('0x5b')]['id']}},_0x5eb62f={};_0x5eb62f[_0xb3fd('0x40')]=_['keys'](db['VoiceQueue'][_0xb3fd('0x3d')]);_0x7cbf03[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x5eb62f[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x2934e[_0xb3fd('0x41')]['fields']));_0x7cbf03[_0xb3fd('0x46')]=_0x7cbf03[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x7cbf03['attributes']:_0x5eb62f['model'];if(_0x2934e['query'][_0xb3fd('0x4e')]){_0x7cbf03[_0xb3fd('0x4f')]=[{'all':!![]}];}_0x7cbf03=_[_0xb3fd('0x4b')]({},_0x7cbf03,_0x2934e['options']);return db[_0xb3fd('0x3c')][_0xb3fd('0x34')](_0x7cbf03)['then'](handleEntityNotFound(_0x1a822d,null))[_0xb3fd('0x29')](function(_0x3e53b0){if(_0x3e53b0){var _0x386dc4=_0x3e53b0['get']({'plain':!![]});_0x386dc4=qs[_0xb3fd('0x5c')](_0x386dc4,['id','createdAt',_0xb3fd('0x5d')]);_0x2934e[_0xb3fd('0x54')]=_[_0xb3fd('0x5c')](_0x2934e['body'],['id',_0xb3fd('0x5e'),_0xb3fd('0x5d')]);return db[_0xb3fd('0x3c')]['create'](_[_0xb3fd('0x4b')](_0x386dc4,_0x2934e['body']),{'include':_0x2934e[_0xb3fd('0x41')][_0xb3fd('0x4e')]?[{'all':!![]}]:undefined})[_0xb3fd('0x29')](function(_0x551530){var _0x2fe570=_0x2934e[_0xb3fd('0x56')][_0xb3fd('0x2a')]({'plain':!![]});if(!_0x2fe570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe570[_0xb3fd('0x55')]===_0xb3fd('0x56')){var _0x37f662=_0x551530[_0xb3fd('0x2a')]({'plain':!![]});var _0x587fd9=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xb3fd('0x2e')}];var _0x36eb2b=_[_0xb3fd('0x34')](_0x587fd9,[_0xb3fd('0x32'),_0x37f662[_0xb3fd('0x33')]])[_0xb3fd('0x35')];return db[_0xb3fd('0x57')][_0xb3fd('0x34')]({'where':{'name':_0x36eb2b,'userProfileId':_0x2fe570[_0xb3fd('0x58')]},'raw':!![]})[_0xb3fd('0x29')](function(_0x385d1b){if(_0x385d1b&&_0x385d1b[_0xb3fd('0x5f')]===0x0){return db[_0xb3fd('0x36')]['create']({'name':_0x37f662[_0xb3fd('0x35')],'resourceId':_0x37f662['id'],'type':_0x385d1b['name'],'sectionId':_0x385d1b['id']},{})['then'](function(){return _0x551530;});}else{return _0x551530;}})[_0xb3fd('0x52')](function(_0x210ad7){logger[_0xb3fd('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x210ad7);throw _0x210ad7;});}return _0x551530;});}})[_0xb3fd('0x29')](respondWithResult(_0x1a822d,0xc9))[_0xb3fd('0x52')](handleError(_0x1a822d,null));};exports[_0xb3fd('0x28')]=function(_0x430087,_0x48b0bf){if(_0x430087[_0xb3fd('0x54')]['id']){delete _0x430087[_0xb3fd('0x54')]['id'];}return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x430087[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x48b0bf,null))[_0xb3fd('0x29')](saveUpdates(_0x430087[_0xb3fd('0x54')],null))[_0xb3fd('0x29')](respondWithResult(_0x48b0bf,null))[_0xb3fd('0x52')](handleError(_0x48b0bf,null));};exports[_0xb3fd('0x37')]=function(_0x1d61f0,_0x5abd72){return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x1d61f0[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5abd72,null))[_0xb3fd('0x29')](removeEntity(_0x5abd72,null))['catch'](handleError(_0x5abd72,null));};exports[_0xb3fd('0x60')]=function(_0x5ee0d9,_0x242cc8,_0x2673e2){var _0xb8bbb5={'raw':![],'where':{}};var _0x339d75={};var _0x16f018={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x5ee0d9[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x242cc8,null))['then'](function(_0x5ad749){if(_0x5ad749){_0x339d75['model']=_['keys'](db['CmHopper'][_0xb3fd('0x3d')]);_0x339d75[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x5ee0d9['query']);_0x339d75[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x339d75[_0xb3fd('0x40')],_0x339d75[_0xb3fd('0x41')]);_0xb8bbb5['attributes']=_[_0xb3fd('0x44')](_0x339d75[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x5ee0d9[_0xb3fd('0x41')]['fields']));_0xb8bbb5['attributes']=_0xb8bbb5[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0xb8bbb5[_0xb3fd('0x46')]:_0x339d75[_0xb3fd('0x40')];if(!_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0xb8bbb5[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x5ee0d9['query'][_0xb3fd('0x20')]);_0xb8bbb5[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0xb8bbb5[_0xb3fd('0x48')]=qs['sort'](_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0xb8bbb5[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x5ee0d9[_0xb3fd('0x41')],_0x339d75[_0xb3fd('0x43')]));_0xb8bbb5['where'][_0xb3fd('0x65')]=_0x5ad749['id'];if(_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0xb8bbb5['where']=_[_0xb3fd('0x4b')](_0xb8bbb5[_0xb3fd('0x49')],{'$or':_['map'](_0xb8bbb5[_0xb3fd('0x46')],function(_0x5520d2){var _0xcb0fa2={};_0xcb0fa2[_0x5520d2]={'$like':'%'+_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0xcb0fa2;})});}_0xb8bbb5=_[_0xb3fd('0x4b')]({},_0xb8bbb5,_0x5ee0d9[_0xb3fd('0x4d')]);return db[_0xb3fd('0x66')]['count']({'where':_0xb8bbb5[_0xb3fd('0x49')]})[_0xb3fd('0x29')](function(_0x20ea78){_0x16f018[_0xb3fd('0x22')]=_0x20ea78;if(_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0xb8bbb5[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x66')]['findAll'](_0xb8bbb5);})[_0xb3fd('0x29')](function(_0x5cc606){_0x16f018[_0xb3fd('0x51')]=_0x5cc606;return _0x16f018;});}})['then'](respondWithFilteredResult(_0x242cc8,_0xb8bbb5))[_0xb3fd('0x52')](handleError(_0x242cc8,null));};exports[_0xb3fd('0x67')]=function(_0x645e08,_0x29f4ac,_0x3026a6){var _0x148b8f={'raw':!![],'where':{}};var _0x5aea99={};var _0x2e4fbf={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x645e08['params']['id']}})['then'](handleEntityNotFound(_0x29f4ac,null))[_0xb3fd('0x29')](function(_0x41db8b){if(_0x41db8b){_0x5aea99['model']=_['keys'](db['CmHopperHistory'][_0xb3fd('0x3d')]);_0x5aea99[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x645e08['query']);_0x5aea99[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x5aea99['model'],_0x5aea99['query']);_0x148b8f['attributes']=_[_0xb3fd('0x44')](_0x5aea99[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x148b8f[_0xb3fd('0x46')]=_0x148b8f[_0xb3fd('0x46')]['length']?_0x148b8f[_0xb3fd('0x46')]:_0x5aea99['model'];if(!_0x645e08['query'][_0xb3fd('0x62')]('nolimit')){_0x148b8f[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x645e08[_0xb3fd('0x41')]['limit']);_0x148b8f[_0xb3fd('0x1f')]=qs['offset'](_0x645e08['query'][_0xb3fd('0x1f')]);}_0x148b8f[_0xb3fd('0x48')]=qs['sort'](_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x148b8f['where']=qs[_0xb3fd('0x43')](_['pick'](_0x645e08[_0xb3fd('0x41')],_0x5aea99['filters']));_0x148b8f[_0xb3fd('0x49')][_0xb3fd('0x65')]=_0x41db8b['id'];if(_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x148b8f[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x148b8f[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x148b8f[_0xb3fd('0x46')],function(_0x1ca808){var _0x57d78e={};_0x57d78e[_0x1ca808]={'$like':'%'+_0x645e08[_0xb3fd('0x41')]['filter']+'%'};return _0x57d78e;})});}_0x148b8f=_[_0xb3fd('0x4b')]({},_0x148b8f,_0x645e08[_0xb3fd('0x4d')]);return db[_0xb3fd('0x68')][_0xb3fd('0x22')]({'where':_0x148b8f[_0xb3fd('0x49')]})['then'](function(_0x2f1e80){_0x2e4fbf['count']=_0x2f1e80;if(_0x645e08['query'][_0xb3fd('0x4e')]){_0x148b8f['include']=[{'all':!![]}];}return db[_0xb3fd('0x68')][_0xb3fd('0x50')](_0x148b8f);})[_0xb3fd('0x29')](function(_0x152b7b){_0x2e4fbf[_0xb3fd('0x51')]=_0x152b7b;return _0x2e4fbf;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x29f4ac,_0x148b8f))[_0xb3fd('0x52')](handleError(_0x29f4ac,null));};exports[_0xb3fd('0x69')]=function(_0x3001bb,_0x3a6fa5,_0x51acfe){var _0x70f1db={'raw':!![],'where':{}};var _0x49b9c2={};var _0x352ee4={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x3001bb['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x3a6fa5,null))[_0xb3fd('0x29')](function(_0x28cb50){if(_0x28cb50){_0x49b9c2['model']=_[_0xb3fd('0x42')](db[_0xb3fd('0x6a')][_0xb3fd('0x3d')]);_0x49b9c2['query']=_['keys'](_0x3001bb['query']);_0x49b9c2['filters']=_['intersection'](_0x49b9c2['model'],_0x49b9c2[_0xb3fd('0x41')]);_0x70f1db[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x49b9c2['model'],qs[_0xb3fd('0x45')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x70f1db['attributes']=_0x70f1db['attributes']['length']?_0x70f1db[_0xb3fd('0x46')]:_0x49b9c2[_0xb3fd('0x40')];if(!_0x3001bb['query']['hasOwnProperty'](_0xb3fd('0x63'))){_0x70f1db[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x70f1db['offset']=qs[_0xb3fd('0x1f')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0x70f1db[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x70f1db[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x3001bb[_0xb3fd('0x41')],_0x49b9c2[_0xb3fd('0x43')]));_0x70f1db['where'][_0xb3fd('0x65')]=_0x28cb50['id'];if(_0x3001bb['query']['filter']){_0x70f1db[_0xb3fd('0x49')]=_['merge'](_0x70f1db['where'],{'$or':_[_0xb3fd('0x31')](_0x70f1db[_0xb3fd('0x46')],function(_0x124877){var _0x3929b3={};_0x3929b3[_0x124877]={'$like':'%'+_0x3001bb['query']['filter']+'%'};return _0x3929b3;})});}_0x70f1db=_[_0xb3fd('0x4b')]({},_0x70f1db,_0x3001bb[_0xb3fd('0x4d')]);return db['CmHopperFinal'][_0xb3fd('0x22')]({'where':_0x70f1db[_0xb3fd('0x49')]})[_0xb3fd('0x29')](function(_0x1e810e){_0x352ee4['count']=_0x1e810e;if(_0x3001bb[_0xb3fd('0x41')]['includeAll']){_0x70f1db['include']=[{'all':!![]}];}return db[_0xb3fd('0x6a')][_0xb3fd('0x50')](_0x70f1db);})[_0xb3fd('0x29')](function(_0x2377a5){_0x352ee4[_0xb3fd('0x51')]=_0x2377a5;return _0x352ee4;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x3a6fa5,_0x70f1db))[_0xb3fd('0x52')](handleError(_0x3a6fa5,null));};exports[_0xb3fd('0x6b')]=function(_0x265dbf,_0x359c3d,_0x58d092){var _0x185908={'raw':!![],'where':{}};var _0x2f44e5={};var _0x6eb95c={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')]['findOne']({'where':{'id':_0x265dbf[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x359c3d,null))['then'](function(_0x18cc20){if(_0x18cc20){_0x2f44e5[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x6c')]['rawAttributes']);_0x2f44e5[_0xb3fd('0x41')]=_['keys'](_0x265dbf[_0xb3fd('0x41')]);_0x2f44e5[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x2f44e5[_0xb3fd('0x40')],_0x2f44e5[_0xb3fd('0x41')]);_0x185908['attributes']=_['intersection'](_0x2f44e5[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x185908[_0xb3fd('0x46')]=_0x185908['attributes'][_0xb3fd('0x47')]?_0x185908['attributes']:_0x2f44e5[_0xb3fd('0x40')];if(!_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x62')]('nolimit')){_0x185908[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x265dbf[_0xb3fd('0x41')]['limit']);_0x185908[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x265dbf['query'][_0xb3fd('0x1f')]);}_0x185908['order']=qs[_0xb3fd('0x64')](_0x265dbf[_0xb3fd('0x41')]['sort']);_0x185908[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_['pick'](_0x265dbf[_0xb3fd('0x41')],_0x2f44e5[_0xb3fd('0x43')]));_0x185908[_0xb3fd('0x49')][_0xb3fd('0x65')]=_0x18cc20['id'];if(_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x185908[_0xb3fd('0x49')]=_['merge'](_0x185908[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x185908[_0xb3fd('0x46')],function(_0x568ece){var _0x606ef8={};_0x606ef8[_0x568ece]={'$like':'%'+_0x265dbf[_0xb3fd('0x41')]['filter']+'%'};return _0x606ef8;})});}_0x185908=_[_0xb3fd('0x4b')]({},_0x185908,_0x265dbf[_0xb3fd('0x4d')]);return db[_0xb3fd('0x6c')][_0xb3fd('0x22')]({'where':_0x185908[_0xb3fd('0x49')]})['then'](function(_0x43f875){_0x6eb95c['count']=_0x43f875;if(_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0x185908[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x6c')][_0xb3fd('0x50')](_0x185908);})[_0xb3fd('0x29')](function(_0x54e420){_0x6eb95c[_0xb3fd('0x51')]=_0x54e420;return _0x6eb95c;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x359c3d,_0x185908))[_0xb3fd('0x52')](handleError(_0x359c3d,null));};exports[_0xb3fd('0x6d')]=function(_0x24e9c3,_0x3aad43,_0x2f64f7){var _0x58b552={};var _0x1bd0e5={};var _0x4e756e;var _0x220066;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x24e9c3[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x3aad43,null))['then'](function(_0x217a0d){if(_0x217a0d){_0x4e756e=_0x217a0d;_0x1bd0e5[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db['Team'][_0xb3fd('0x3d')]);_0x1bd0e5[_0xb3fd('0x41')]=_['keys'](_0x24e9c3[_0xb3fd('0x41')]);_0x1bd0e5['filters']=_['intersection'](_0x1bd0e5[_0xb3fd('0x40')],_0x1bd0e5['query']);_0x58b552['attributes']=_[_0xb3fd('0x44')](_0x1bd0e5[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x24e9c3[_0xb3fd('0x41')]['fields']));_0x58b552[_0xb3fd('0x46')]=_0x58b552[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x58b552[_0xb3fd('0x46')]:_0x1bd0e5['model'];_0x58b552[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x58b552[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_['pick'](_0x24e9c3['query'],_0x1bd0e5[_0xb3fd('0x43')]));if(_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x58b552[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x58b552['where'],{'$or':_[_0xb3fd('0x31')](_0x58b552[_0xb3fd('0x46')],function(_0x3cc72f){var _0x304b9e={};_0x304b9e[_0x3cc72f]={'$like':'%'+_0x24e9c3['query'][_0xb3fd('0x2f')]+'%'};return _0x304b9e;})});}_0x58b552=_[_0xb3fd('0x4b')]({},_0x58b552,_0x24e9c3[_0xb3fd('0x4d')]);return _0x4e756e[_0xb3fd('0x6d')](_0x58b552);}})[_0xb3fd('0x29')](function(_0x10e147){if(_0x10e147){_0x220066=_0x10e147[_0xb3fd('0x47')];if(!_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x62')]('nolimit')){_0x58b552[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x24e9c3['query'][_0xb3fd('0x20')]);_0x58b552['offset']=qs[_0xb3fd('0x1f')](_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x4e756e[_0xb3fd('0x6d')](_0x58b552);}})[_0xb3fd('0x29')](function(_0x565c8d){if(_0x565c8d){return _0x565c8d?{'count':_0x220066,'rows':_0x565c8d}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x3aad43,null))[_0xb3fd('0x52')](handleError(_0x3aad43,null));};exports['addTeams']=function(_0x41e636,_0xa132aa,_0x1a025c){var _0x33e4bd=_0x41e636['body'][_0xb3fd('0x6e')];var _0xbb1870=_[_0xb3fd('0x31')](_0x33e4bd,'id');return db[_0xb3fd('0x6f')][_0xb3fd('0x50')]({'where':{'id':_0xbb1870},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb3fd('0x35'),_0xb3fd('0x70'),_0xb3fd('0x71'),_0xb3fd('0x72')],'raw':!![]}]})[_0xb3fd('0x29')](function(_0x5bdf08){if(_0x5bdf08){var _0x230beb=_[_0xb3fd('0x73')](_0x5bdf08,function(_0x5d0bf4){var _0x2cf093=_0x5d0bf4[_0xb3fd('0x2a')]({'plain':!![]});_0x2cf093[_0xb3fd('0x74')][_0xb3fd('0x75')](function(_0x897e23){_0x897e23['penalty']=_[_0xb3fd('0x34')](_0x33e4bd,{'id':_0x2cf093['id']})['penalty'];});return _0x2cf093[_0xb3fd('0x74')];});return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x41e636[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](function(_0x5376c8){return db[_0xb3fd('0x76')][_0xb3fd('0x77')](function(_0x463479){return _0x5376c8['addTeams'](_0xbb1870,{'transaction':_0x463479})['then'](function(){return BPromise[_0xb3fd('0x78')](_0x33e4bd,function(_0xb3d03d){return db[_0xb3fd('0x79')]['upsert']({'TeamId':_0xb3d03d['id'],'VoiceQueueId':_0x41e636['params']['id'],'penalty':_0xb3d03d[_0xb3fd('0x7a')]},{'transaction':_0x463479});});})[_0xb3fd('0x29')](function(){return BPromise[_0xb3fd('0x78')](_0x230beb,function(_0x57af6a){return db['UserVoiceQueue'][_0xb3fd('0x7b')]({'where':{'UserId':_0x57af6a['id'],'VoiceQueueId':_0x41e636[_0xb3fd('0x5b')]['id']},'defaults':{'penalty':_0x57af6a[_0xb3fd('0x7a')]},'transaction':_0x463479});});})['then'](function(){return BPromise[_0xb3fd('0x78')](_[_0xb3fd('0x2f')](_0x230beb,{'online':!![]}),function(_0x564838){return db[_0xb3fd('0x7c')]['upsert']({'membername':_0x564838['name'],'UserId':_0x564838['id'],'queue_name':_0x5376c8[_0xb3fd('0x35')],'VoiceQueueId':_0x5376c8['id'],'interface':_[_0xb3fd('0x7d')](_0x564838[_0xb3fd('0x72')])?util[_0xb3fd('0x7e')](_0xb3fd('0x7f'),_0x564838['name']):_0x564838[_0xb3fd('0x72')],'paused':_0x564838[_0xb3fd('0x71')]||![],'penalty':_0x564838['penalty']},{'transaction':_0x463479});});})[_0xb3fd('0x29')](function(){_0x230beb['forEach'](function(_0xa47d43){socket[_0xb3fd('0x80')](_0xb3fd('0x81'),{'UserId':_0xa47d43['id'],'VoiceQueueId':_0x5376c8['id']});});});});});}})['then'](respondWithStatusCode(_0xa132aa,null))[_0xb3fd('0x52')](handleError(_0xa132aa,null));};exports['removeTeams']=function(_0x9788bf,_0x19a4cb,_0x5f51a2){return db[_0xb3fd('0x6f')][_0xb3fd('0x50')]({'where':{'id':_0x9788bf['query'][_0xb3fd('0x82')]},'attributes':['id'],'include':[{'model':db[_0xb3fd('0x83')],'as':_0xb3fd('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb3fd('0x29')](handleEntityNotFound(_0x19a4cb,null))[_0xb3fd('0x29')](function(_0x4b9be3){var _0x5dc78c=_[_0xb3fd('0x31')](_0x4b9be3,'id');var _0x1453cc=[];var _0x2b9400=[];var _0x5ef26b=squel[_0xb3fd('0x84')]();_0x5ef26b[_0xb3fd('0x85')]('tq.TeamId')['from']('team_has_voice_queues','tq')[_0xb3fd('0x86')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb3fd('0x49')](_0xb3fd('0x87'),_0x9788bf['params']['id']);for(var _0x43d669=0x0;_0x43d669<_0x4b9be3['length'];_0x43d669+=0x1){let _0x92bb8=_0x4b9be3[_0x43d669];for(var _0x29e5aa=0x0;_0x29e5aa<_0x92bb8[_0xb3fd('0x74')][_0xb3fd('0x47')];_0x29e5aa+=0x1){let _0x5c49e7=_0x92bb8[_0xb3fd('0x74')][_0x29e5aa];var _0xd3f381=_0x5ef26b['clone']();_0xd3f381[_0xb3fd('0x49')](_0xb3fd('0x88'),_0x5c49e7['id']);_0x2b9400[_0xb3fd('0x89')](db[_0xb3fd('0x76')][_0xb3fd('0x41')](_0xd3f381[_0xb3fd('0x8a')](),{'type':db['sequelize'][_0xb3fd('0x8b')][_0xb3fd('0x8c')]})[_0xb3fd('0x29')](function(_0x2e48d5){if(_0x2e48d5[_0xb3fd('0x47')]===0x1){return _0x5c49e7['id'];}else{var _0xdcebf4=_[_0xb3fd('0x8d')](_[_0xb3fd('0x31')](_0x2e48d5,_0xb3fd('0x8e')),function(_0x4186cd){return _['includes'](_0x5dc78c,_0x4186cd);});if(_0xdcebf4){return _0x5c49e7['id'];}}}));}}return BPromise[_0xb3fd('0x8f')](_0x2b9400)[_0xb3fd('0x29')](function(_0x281b4d){_0x1453cc=_(_0x1453cc)['union'](_0x281b4d)['compact']()[_0xb3fd('0x32')]();return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x9788bf[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](function(_0x485949){return db[_0xb3fd('0x76')][_0xb3fd('0x77')](function(_0x539886){return _0x485949[_0xb3fd('0x90')](_0x9788bf[_0xb3fd('0x41')][_0xb3fd('0x82')],{'transaction':_0x539886})[_0xb3fd('0x29')](function(){if(!_['isEmpty'](_0x1453cc)){return _0x485949['removeAgents'](_0x1453cc,{'transaction':_0x539886})[_0xb3fd('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x9788bf[_0xb3fd('0x5b')]['id'],'UserId':_0x1453cc},'transaction':_0x539886});});}})[_0xb3fd('0x29')](function(){_0x1453cc[_0xb3fd('0x75')](function(_0x362b5e){socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':_0x362b5e,'VoiceQueueId':_0x485949['id']});});});});});});})['then'](respondWithStatusCode(_0x19a4cb,null))['catch'](handleError(_0x19a4cb,null));};exports[_0xb3fd('0x92')]=function(_0x15277a,_0x40d450,_0x28854a){var _0x5c899c,_0x3f8f7a;return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x15277a[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x40d450,null))[_0xb3fd('0x29')](function(_0x1dfb09){if(_0x1dfb09){_0x3f8f7a=_0x1dfb09;return _0x1dfb09[_0xb3fd('0x92')](_0x15277a[_0xb3fd('0x54')][_0xb3fd('0x82')],_[_0xb3fd('0x5c')](_0x15277a[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{})[_0xb3fd('0x93')](function(_0x556a33){for(var _0x5a7235=0x0;_0x5a7235<_0x15277a[_0xb3fd('0x54')][_0xb3fd('0x82')][_0xb3fd('0x47')];_0x5a7235+=0x1){socket['emit'](_0xb3fd('0x81'),{'UserId':Number(_0x15277a[_0xb3fd('0x54')]['ids'][_0x5a7235]),'VoiceQueueId':Number(_0x15277a[_0xb3fd('0x5b')]['id'])});}return _0x556a33;});}})['then'](function(_0x908d92){_0x5c899c=_0x908d92||[];if(_0x3f8f7a){return db[_0xb3fd('0x83')][_0xb3fd('0x50')]({'where':{'id':_0x15277a[_0xb3fd('0x54')]['ids']},'attributes':['id',_0xb3fd('0x35'),_0xb3fd('0x70'),_0xb3fd('0x71'),_0xb3fd('0x72')],'raw':!![]});}})[_0xb3fd('0x29')](function(_0x16a324){if(!_['isEmpty'](_0x16a324)){var _0x45b085=[];for(var _0x4b79dc=0x0;_0x4b79dc<_0x16a324[_0xb3fd('0x47')];_0x4b79dc++){if(_0x16a324[_0x4b79dc]['online']){_0x45b085['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x16a324[_0x4b79dc][_0xb3fd('0x35')],'UserId':_0x16a324[_0x4b79dc]['id'],'queue_name':_0x3f8f7a['name'],'VoiceQueueId':_0x3f8f7a['id'],'interface':_[_0xb3fd('0x7d')](_0x16a324[_0x4b79dc][_0xb3fd('0x72')])?util[_0xb3fd('0x7e')](_0xb3fd('0x7f'),_0x16a324[_0x4b79dc][_0xb3fd('0x35')]):_0x16a324[_0x4b79dc][_0xb3fd('0x72')],'paused':_0x16a324[_0x4b79dc]['voicePause']||![],'penalty':_0x15277a['body']['penalty']||0x0}));}}return BPromise['all'](_0x45b085);}})[_0xb3fd('0x29')](function(){return _0x5c899c;})[_0xb3fd('0x29')](respondWithResult(_0x40d450,null))[_0xb3fd('0x52')](handleError(_0x40d450,null));};exports[_0xb3fd('0x94')]=function(_0x189d02,_0x1d8003,_0x168b10){return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x189d02['params']['id']}})['then'](handleEntityNotFound(_0x1d8003,null))[_0xb3fd('0x29')](function(_0x256597){if(_0x256597){return _0x256597[_0xb3fd('0x94')](_0x189d02[_0xb3fd('0x41')]['ids'])[_0xb3fd('0x29')](function(){if(_['isArray'](_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')])){for(var _0x36755c=0x0;_0x36755c<_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')]['length'];_0x36755c+=0x1){socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':Number(_0x189d02['query'][_0xb3fd('0x82')][_0x36755c]),'VoiceQueueId':Number(_0x189d02['params']['id'])});}}else{socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':Number(_0x189d02['query'][_0xb3fd('0x82')]),'VoiceQueueId':Number(_0x189d02[_0xb3fd('0x5b')]['id'])});}});}})[_0xb3fd('0x29')](function(_0x18324b){return db[_0xb3fd('0x7c')][_0xb3fd('0x37')]({'where':{'VoiceQueueId':_0x189d02['params']['id'],'UserId':_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')]}})[_0xb3fd('0x29')](function(){return _0x18324b;});})[_0xb3fd('0x29')](respondWithStatusCode(_0x1d8003,null))['catch'](handleError(_0x1d8003,null));};exports['getAgents']=function(_0x10049d,_0x357612,_0x187c47){var _0x392353={};var _0x3ad565={};var _0xd1ada2;var _0x5c499a;return db['VoiceQueue'][_0xb3fd('0x61')]({'where':{'id':_0x10049d['params']['id']}})['then'](handleEntityNotFound(_0x357612,null))[_0xb3fd('0x29')](function(_0x152e5f){if(_0x152e5f){_0xd1ada2=_0x152e5f;_0x3ad565[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x83')][_0xb3fd('0x3d')]);_0x3ad565[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x10049d['query']);_0x3ad565[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x3ad565['model'],_0x3ad565[_0xb3fd('0x41')]);_0x392353['attributes']=_[_0xb3fd('0x44')](_0x3ad565[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x10049d[_0xb3fd('0x41')]['fields']));_0x392353['attributes']=_0x392353['attributes'][_0xb3fd('0x47')]?_0x392353[_0xb3fd('0x46')]:_0x3ad565[_0xb3fd('0x40')];_0x392353[_0xb3fd('0x48')]=qs['sort'](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x392353[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x10049d[_0xb3fd('0x41')],_0x3ad565[_0xb3fd('0x43')]));if(_0x10049d[_0xb3fd('0x41')]['filter']){_0x392353[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x392353[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x392353[_0xb3fd('0x46')],function(_0x59f024){var _0x2cc91b={};_0x2cc91b[_0x59f024]={'$like':'%'+_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x2cc91b;})});}_0x392353=_[_0xb3fd('0x4b')]({},_0x392353,_0x10049d['options']);return _0xd1ada2[_0xb3fd('0x95')](_0x392353);}})[_0xb3fd('0x29')](function(_0x378bf8){if(_0x378bf8){_0x5c499a=_0x378bf8[_0xb3fd('0x47')];if(!_0x10049d[_0xb3fd('0x41')]['hasOwnProperty']('nolimit')){_0x392353[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x392353[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0xd1ada2[_0xb3fd('0x95')](_0x392353);}})['then'](function(_0x3be443){if(_0x3be443){return _0x3be443?{'count':_0x5c499a,'rows':_0x3be443}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x357612,null))['catch'](handleError(_0x357612,null));};exports[_0xb3fd('0x96')]=function(_0x29ad66,_0x270fbe,_0x3dcca2){var _0x43f3e3={};var _0x1c9cd6={};var _0x4d9185;var _0x2a9621;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x29ad66[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x270fbe,null))[_0xb3fd('0x29')](function(_0x52e6a3){if(_0x52e6a3){_0x4d9185=_0x52e6a3;_0x1c9cd6[_0xb3fd('0x40')]=_['keys'](db[_0xb3fd('0x7c')][_0xb3fd('0x3d')]);_0x1c9cd6['query']=_[_0xb3fd('0x42')](_0x29ad66['query']);_0x1c9cd6['filters']=_[_0xb3fd('0x44')](_0x1c9cd6[_0xb3fd('0x40')],_0x1c9cd6[_0xb3fd('0x41')]);_0x43f3e3[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x1c9cd6['model'],qs[_0xb3fd('0x45')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x43f3e3[_0xb3fd('0x46')]=_0x43f3e3[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x43f3e3['attributes']:_0x1c9cd6[_0xb3fd('0x40')];_0x43f3e3[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x29ad66[_0xb3fd('0x41')]['sort']);_0x43f3e3[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x29ad66[_0xb3fd('0x41')],_0x1c9cd6['filters']));if(_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x43f3e3['where']=_[_0xb3fd('0x4b')](_0x43f3e3[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x43f3e3[_0xb3fd('0x46')],function(_0x16d680){var _0x2fecf9={};_0x2fecf9[_0x16d680]={'$like':'%'+_0x29ad66['query']['filter']+'%'};return _0x2fecf9;})});}_0x43f3e3=_[_0xb3fd('0x4b')]({},_0x43f3e3,_0x29ad66[_0xb3fd('0x4d')]);return _0x4d9185[_0xb3fd('0x96')](_0x43f3e3);}})[_0xb3fd('0x29')](function(_0x54a8ff){if(_0x54a8ff){_0x2a9621=_0x54a8ff[_0xb3fd('0x47')];if(!_0x29ad66['query'][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x43f3e3[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x43f3e3[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x4d9185[_0xb3fd('0x96')](_0x43f3e3);}})[_0xb3fd('0x29')](function(_0x96ed60){return _0x96ed60?{'count':_0x2a9621,'rows':_0x96ed60}:null;})[_0xb3fd('0x29')](respondWithResult(_0x270fbe,null))[_0xb3fd('0x52')](handleError(_0x270fbe,null));};exports[_0xb3fd('0x97')]=function(_0x189094,_0x15e6c7,_0xb5fd96){var _0x374740={};var _0x26466e={};var _0x1e65fb;var _0x47c8f7;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x189094[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x15e6c7,null))[_0xb3fd('0x29')](function(_0x252460){if(_0x252460){_0x1e65fb=_0x252460;_0x26466e[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x98')][_0xb3fd('0x3d')]);_0x26466e['query']=_[_0xb3fd('0x42')](_0x189094[_0xb3fd('0x41')]);_0x26466e['filters']=_[_0xb3fd('0x44')](_0x26466e[_0xb3fd('0x40')],_0x26466e['query']);_0x374740[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x26466e['model'],qs[_0xb3fd('0x45')](_0x189094[_0xb3fd('0x41')]['fields']));_0x374740[_0xb3fd('0x46')]=_0x374740[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x374740[_0xb3fd('0x46')]:_0x26466e[_0xb3fd('0x40')];_0x374740[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x189094[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x374740['where']=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x189094[_0xb3fd('0x41')],_0x26466e[_0xb3fd('0x43')]));if(_0x189094[_0xb3fd('0x41')]['filter']){_0x374740[_0xb3fd('0x49')]=_['merge'](_0x374740[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x374740['attributes'],function(_0x5230fe){var _0x38c996={};_0x38c996[_0x5230fe]={'$like':'%'+_0x189094[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x38c996;})});}_0x374740=_[_0xb3fd('0x4b')]({},_0x374740,_0x189094[_0xb3fd('0x4d')]);return _0x1e65fb[_0xb3fd('0x97')](_0x374740);}})[_0xb3fd('0x29')](function(_0x4164c6){if(_0x4164c6){_0x47c8f7=_0x4164c6[_0xb3fd('0x47')];if(!_0x189094[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x374740[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x189094['query'][_0xb3fd('0x20')]);_0x374740[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x189094[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x1e65fb[_0xb3fd('0x97')](_0x374740);}})['then'](function(_0x5afd00){if(_0x5afd00){return _0x5afd00?{'count':_0x47c8f7,'rows':_0x5afd00}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x15e6c7,null))['catch'](handleError(_0x15e6c7,null));};exports[_0xb3fd('0x99')]=function(_0x45b62a,_0x475183,_0x49a16a){var _0xd8da4,_0x433675;return db['VoiceQueue'][_0xb3fd('0x34')]({'where':{'id':_0x45b62a['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x475183,null))[_0xb3fd('0x29')](function(_0xd23a50){if(_0xd23a50){_0x433675=_0xd23a50;return _0xd23a50[_0xb3fd('0x99')](_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x82')],_[_0xb3fd('0x5c')](_0x45b62a[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{});}return null;})['spread'](function(_0x12d55b){var _0xb343c;_0xd8da4=_0x12d55b||[];var _0x335ed8=[];if(_0x12d55b){for(var _0x9d0ef3=0x0;_0x9d0ef3<_0x12d55b[_0xb3fd('0x47')];_0x9d0ef3+=0x1){var _0x458cfc=_0x12d55b[_0x9d0ef3][_0xb3fd('0x2a')]({'plain':!![]});_0x433675[_0xb3fd('0x9a')]=_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x9a')]?_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x9a')]:_0x433675[_0xb3fd('0x9a')];switch(_0x433675[_0xb3fd('0x9a')]){case _0xb3fd('0x9b'):_0xb343c=squel[_0xb3fd('0x9c')]()[_0xb3fd('0x9d')](_0xb3fd('0x9e'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),'ListId',_0xb3fd('0x65'),_0xb3fd('0x5e'),_0xb3fd('0x5d')],squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0xa1'))['field']('id',_0xb3fd('0xa2'))['field'](_0x458cfc[_0xb3fd('0xa4')]['toString'](),_0xb3fd('0xa5'))[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))['field'](_0xb3fd('0xa3'),'createdAt')[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))['where'](_0xb3fd('0xa7'))['where'](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')]['toString']())['where'](_0xb3fd('0xa9'))[_0xb3fd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb3fd('0x84')]()['field'](_0xb3fd('0xaa'))[_0xb3fd('0xab')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x45b62a['params']['id'][_0xb3fd('0x8a')]()))[_0xb3fd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xac'))[_0xb3fd('0xab')](_0xb3fd('0x9e'))[_0xb3fd('0x49')](_0xb3fd('0x87'),_0x45b62a['params']['id'][_0xb3fd('0x8a')]())))['toString']();break;case _0xb3fd('0xad'):_0xb343c=squel[_0xb3fd('0x9c')]()[_0xb3fd('0x9d')]('cm_hopper')[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel['select']()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0xa1'))[_0xb3fd('0x85')]('id',_0xb3fd('0xa2'))[_0xb3fd('0x85')](_0x458cfc[_0xb3fd('0xa4')][_0xb3fd('0x8a')](),'ListId')[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5e'))['field']('NOW()',_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))[_0xb3fd('0x49')](_0xb3fd('0xa7'))[_0xb3fd('0x49')](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')][_0xb3fd('0x8a')]())[_0xb3fd('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xb3fd('0x49')](_0xb3fd('0xae'),squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xac'))[_0xb3fd('0xab')](_0xb3fd('0x9e'))[_0xb3fd('0x49')]('VoiceQueueId\x20=\x20?',_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')]())))[_0xb3fd('0x8a')]();break;default:_0xb343c=squel['insert']()[_0xb3fd('0x9d')](_0xb3fd('0x9e'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel[_0xb3fd('0x84')]()['field'](_0xb3fd('0xa0'),'phone')[_0xb3fd('0x85')](_0xb3fd('0xa3'),'scheduledAt')[_0xb3fd('0x85')]('id','ContactId')[_0xb3fd('0x85')](_0x458cfc[_0xb3fd('0xa4')]['toString'](),'ListId')[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5e'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))[_0xb3fd('0xab')](_0xb3fd('0xa6'))[_0xb3fd('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')]['toString']())[_0xb3fd('0x49')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x335ed8[_0xb3fd('0x89')](db['sequelize'][_0xb3fd('0x41')](_0xb343c));}return BPromise[_0xb3fd('0x8f')](_0x335ed8);}})['then'](function(){return _0xd8da4;})[_0xb3fd('0x29')](respondWithResult(_0x475183,null))[_0xb3fd('0x52')](handleError(_0x475183,null));};exports['removeLists']=function(_0x1177cc,_0x17ad48,_0x6d049e){return db['VoiceQueue']['find']({'where':{'id':_0x1177cc[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x17ad48,null))[_0xb3fd('0x29')](function(_0x23e58e){if(_0x23e58e){return _0x23e58e['removeLists'](_0x1177cc['query'][_0xb3fd('0x82')]);}})[_0xb3fd('0x29')](function(_0x3b696b){if(_0x3b696b){return db[_0xb3fd('0x66')][_0xb3fd('0x37')]({'where':{'ListId':_0x1177cc[_0xb3fd('0x41')]['ids'],'VoiceQueueId':_0x1177cc['params']['id']}})[_0xb3fd('0x29')](function(){return _0x3b696b;});}})[_0xb3fd('0x29')](respondWithStatusCode(_0x17ad48,null))[_0xb3fd('0x52')](handleError(_0x17ad48,null));};exports[_0xb3fd('0xaf')]=function(_0x42dde0,_0xc82fa5,_0x2776ff){var _0x184399={};var _0x44fee2={};var _0x264819;var _0x30af0f;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x42dde0[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc82fa5,null))[_0xb3fd('0x29')](function(_0x1b76ff){if(_0x1b76ff){_0x264819=_0x1b76ff;_0x44fee2[_0xb3fd('0x40')]=_['keys'](db[_0xb3fd('0x98')][_0xb3fd('0x3d')]);_0x44fee2[_0xb3fd('0x41')]=_['keys'](_0x42dde0[_0xb3fd('0x41')]);_0x44fee2[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x44fee2[_0xb3fd('0x40')],_0x44fee2[_0xb3fd('0x41')]);_0x184399['attributes']=_['intersection'](_0x44fee2['model'],qs[_0xb3fd('0x45')](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x184399[_0xb3fd('0x46')]=_0x184399[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x184399[_0xb3fd('0x46')]:_0x44fee2['model'];_0x184399[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x184399['where']=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x42dde0[_0xb3fd('0x41')],_0x44fee2[_0xb3fd('0x43')]));if(_0x42dde0[_0xb3fd('0x41')]['filter']){_0x184399[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x184399[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x184399[_0xb3fd('0x46')],function(_0x448210){var _0x95eb46={};_0x95eb46[_0x448210]={'$like':'%'+_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x95eb46;})});}_0x184399=_[_0xb3fd('0x4b')]({},_0x184399,_0x42dde0[_0xb3fd('0x4d')]);return _0x264819[_0xb3fd('0xaf')](_0x184399);}})[_0xb3fd('0x29')](function(_0x559e77){if(_0x559e77){_0x30af0f=_0x559e77[_0xb3fd('0x47')];if(!_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x184399[_0xb3fd('0x20')]=qs['limit'](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x184399[_0xb3fd('0x1f')]=qs['offset'](_0x42dde0['query'][_0xb3fd('0x1f')]);}return _0x264819[_0xb3fd('0xaf')](_0x184399);}})['then'](function(_0x5d0ea5){if(_0x5d0ea5){return _0x5d0ea5?{'count':_0x30af0f,'rows':_0x5d0ea5}:null;}})['then'](respondWithResult(_0xc82fa5,null))[_0xb3fd('0x52')](handleError(_0xc82fa5,null));};exports[_0xb3fd('0xb0')]=function(_0x31b06d,_0x424872,_0x16896c){var _0x424194,_0x5498bc;return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x31b06d[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x424872,null))[_0xb3fd('0x29')](function(_0xe28ee2){if(_0xe28ee2){_0x5498bc=_0xe28ee2;return _0xe28ee2[_0xb3fd('0xb0')](_0x31b06d[_0xb3fd('0x54')]['ids'],_['omit'](_0x31b06d[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{});}return null;})['spread'](function(_0x51765e){var _0x2cc5e5;_0x424194=_0x51765e||[];var _0x5cf9ea=[];if(_0x51765e){for(var _0x486275=0x0;_0x486275<_0x51765e[_0xb3fd('0x47')];_0x486275+=0x1){var _0x31d2dc=_0x51765e[_0x486275][_0xb3fd('0x2a')]({'plain':!![]});_0x2cc5e5=squel['insert']()[_0xb3fd('0x9d')](_0xb3fd('0xb1'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')]('id','ContactId')[_0xb3fd('0x85')](_0x31d2dc[_0xb3fd('0xa4')][_0xb3fd('0x8a')](),_0xb3fd('0xa5'))[_0xb3fd('0x85')](_0x31b06d['params']['id']['toString'](),_0xb3fd('0x65'))['field'](_0xb3fd('0xa3'),_0xb3fd('0x5e'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))[_0xb3fd('0x49')](_0xb3fd('0xa7'))[_0xb3fd('0x49')](_0xb3fd('0xa8'),_0x31d2dc[_0xb3fd('0xa4')][_0xb3fd('0x8a')]())['where'](_0xb3fd('0xa9')))[_0xb3fd('0x8a')]();_0x5cf9ea[_0xb3fd('0x89')](db['sequelize'][_0xb3fd('0x41')](_0x2cc5e5));}return BPromise[_0xb3fd('0x8f')](_0x5cf9ea);}})[_0xb3fd('0x29')](function(){return _0x424194;})[_0xb3fd('0x29')](respondWithResult(_0x424872,null))[_0xb3fd('0x52')](handleError(_0x424872,null));};exports[_0xb3fd('0xb2')]=function(_0x24cf2f,_0x2a9343,_0x289c50){return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x24cf2f['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x2a9343,null))[_0xb3fd('0x29')](function(_0x532664){if(_0x532664){return _0x532664[_0xb3fd('0xb2')](_0x24cf2f[_0xb3fd('0x41')][_0xb3fd('0x82')]);}})[_0xb3fd('0x29')](function(_0xe1d190){if(_0xe1d190){return db[_0xb3fd('0x6c')][_0xb3fd('0x37')]({'where':{'ListId':_0x24cf2f['query'][_0xb3fd('0x82')],'VoiceQueueId':_0x24cf2f['params']['id']}})['then'](function(){return _0xe1d190;});}})[_0xb3fd('0x29')](respondWithStatusCode(_0x2a9343,null))[_0xb3fd('0x52')](handleError(_0x2a9343,null));};
\ No newline at end of file