Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index e0633ef..221a0a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x492f=['nolimit','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','interface','flatMap','penalty','sequelize','each','UserVoiceQueueRt','upsert','isNil','SIP/%s','forEach','select','field','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','online','push','format','all','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','NOW()','scheduledAt','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','ListId\x20=\x20?','removeBlackLists','html-pdf','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','fields','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','omit','getHoppers','findOne','CmHopper'];(function(_0x2f3e2f,_0x32aaf8){var _0x23cd4a=function(_0x4deaee){while(--_0x4deaee){_0x2f3e2f['push'](_0x2f3e2f['shift']());}};_0x23cd4a(++_0x32aaf8);}(_0x492f,0x103));var _0xf492=function(_0x1f689e,_0x1c3e0d){_0x1f689e=_0x1f689e-0x0;var _0x535029=_0x492f[_0x1f689e];return _0x535029;};'use strict';var pdf=require(_0xf492('0x0'));var emlformat=require(_0xf492('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf492('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf492('0x3'));var moment=require(_0xf492('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf492('0x5'));var sox=require(_0xf492('0x6'));var csv=require(_0xf492('0x7'));var ejs=require(_0xf492('0x8'));var fs=require('fs');var _=require(_0xf492('0x9'));var squel=require('squel');var crypto=require(_0xf492('0xa'));var jsforce=require(_0xf492('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf492('0x7'));var querystring=require(_0xf492('0xc'));var Papa=require(_0xf492('0xd'));var Redis=require(_0xf492('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf492('0xf'));var as=require(_0xf492('0x10'));var hardwareService=require(_0xf492('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf492('0x12'));var db=require(_0xf492('0x13'))['db'];config[_0xf492('0x14')]=_[_0xf492('0x15')](config[_0xf492('0x14')],{'host':_0xf492('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xf492('0x17')](socket);function respondWithStatusCode(_0x9bb935,_0x5da8de){_0x5da8de=_0x5da8de||0xcc;return function(_0x381ef3){if(_0x381ef3){return _0x9bb935[_0xf492('0x18')](_0x5da8de);}return _0x9bb935[_0xf492('0x19')](_0x5da8de)[_0xf492('0x1a')]();};}function respondWithResult(_0x1c2d78,_0x5e2509){_0x5e2509=_0x5e2509||0xc8;return function(_0x311cd8){if(_0x311cd8){return _0x1c2d78[_0xf492('0x19')](_0x5e2509)[_0xf492('0x1b')](_0x311cd8);}};}function respondWithFilteredResult(_0x4c62db,_0x17ae46){return function(_0x1e857c){if(_0x1e857c){var _0x35dbfe=_0x1e857c[_0xf492('0x1c')],_0x2d4124=_0x17ae46[_0xf492('0x1d')],_0x1de63a=_0x17ae46[_0xf492('0x1d')]+_0x17ae46[_0xf492('0x1e')],_0x29d5f3;if(_0x1de63a>=_0x35dbfe){_0x1de63a=_0x35dbfe;_0x29d5f3=0xc8;}else{_0x29d5f3=0xce;}_0x4c62db[_0xf492('0x19')](_0x29d5f3);return _0x4c62db[_0xf492('0x1f')]('Content-Range',_0x2d4124+'-'+_0x1de63a+'/'+_0x35dbfe)[_0xf492('0x1b')](_0x1e857c);}return null;};}function patchUpdates(_0x4aa832){return function(_0x2adcd1){try{jsonpatch[_0xf492('0x20')](_0x2adcd1,_0x4aa832,!![]);}catch(_0x4ff62c){return BPromise[_0xf492('0x21')](_0x4ff62c);}return _0x2adcd1[_0xf492('0x22')]();};}function saveUpdates(_0xd2033d,_0x1e11e7){return function(_0x2a89fb){if(_0x2a89fb){return _0x2a89fb[_0xf492('0x23')](_0xd2033d)[_0xf492('0x24')](function(_0x3f9310){return _0x3f9310;});}return null;};}function removeEntity(_0x378b67,_0x483796){return function(_0x27bbe4){if(_0x27bbe4){return _0x27bbe4[_0xf492('0x25')]()[_0xf492('0x24')](function(){var _0x30c0e2=_0x27bbe4['get']({'plain':!![]});var _0xba7a42=[{'name':_0xf492('0x26'),'value':_0xf492('0x27'),'ignore':![]},{'name':'QueueCampaigns','value':_0xf492('0x28'),'ignore':![]}];var _0x5ab005=_(_0xba7a42)['filter'](_0xf492('0x29'))[_0xf492('0x2a')](_0xf492('0x2b'))[_0xf492('0x2b')]();if(_[_0xf492('0x2c')](_0x5ab005,_0x30c0e2[_0xf492('0x2d')])){return;}var _0x342dbc=_[_0xf492('0x2e')](_0xba7a42,[_0xf492('0x2b'),_0x30c0e2[_0xf492('0x2d')]])['name'];return db[_0xf492('0x2f')][_0xf492('0x25')]({'where':{'type':_0x342dbc,'resourceId':_0x30c0e2['id']}})[_0xf492('0x24')](function(){return _0x27bbe4;});})['then'](function(){_0x378b67[_0xf492('0x19')](0xcc)[_0xf492('0x1a')]();});}};}function handleEntityNotFound(_0x45b175,_0x5d3f66){return function(_0x544fb7){if(!_0x544fb7){_0x45b175['sendStatus'](0x194);}return _0x544fb7;};}function handleError(_0x2c07a7,_0x4ff272){_0x4ff272=_0x4ff272||0x1f4;return function(_0x54b786){logger[_0xf492('0x30')](_0x54b786[_0xf492('0x31')]);if(_0x54b786[_0xf492('0x32')]){delete _0x54b786[_0xf492('0x32')];}_0x2c07a7[_0xf492('0x19')](_0x4ff272)[_0xf492('0x33')](_0x54b786);};}exports[_0xf492('0x34')]=function(_0x2e98e7,_0x10f0f2){var _0x3b0f1a={},_0x3678a8={},_0xdce339={'count':0x0,'rows':[]};var _0x5ce554=_[_0xf492('0x2a')](db[_0xf492('0x35')][_0xf492('0x36')],function(_0x4937da){return{'name':_0x4937da[_0xf492('0x37')],'type':_0x4937da[_0xf492('0x2d')]['key']};});_0x3678a8[_0xf492('0x38')]=_[_0xf492('0x2a')](_0x5ce554,'name');_0x3678a8[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x2e98e7[_0xf492('0x39')]);_0x3678a8[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x3678a8[_0xf492('0x38')],_0x3678a8[_0xf492('0x39')]);_0x3b0f1a[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x3678a8['model'],qs['fields'](_0x2e98e7[_0xf492('0x39')]['fields']));_0x3b0f1a['attributes']=_0x3b0f1a[_0xf492('0x3d')][_0xf492('0x3e')]?_0x3b0f1a[_0xf492('0x3d')]:_0x3678a8[_0xf492('0x38')];if(!_0x2e98e7[_0xf492('0x39')][_0xf492('0x3f')]('nolimit')){_0x3b0f1a[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x2e98e7[_0xf492('0x39')][_0xf492('0x1e')]);_0x3b0f1a[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x2e98e7[_0xf492('0x39')]['offset']);}_0x3b0f1a[_0xf492('0x40')]=qs['sort'](_0x2e98e7[_0xf492('0x39')][_0xf492('0x41')]);_0x3b0f1a[_0xf492('0x42')]=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x2e98e7[_0xf492('0x39')],_0x3678a8[_0xf492('0x3b')]),_0x5ce554);if(_0x2e98e7[_0xf492('0x39')]['filter']){_0x3b0f1a[_0xf492('0x42')]=_[_0xf492('0x44')](_0x3b0f1a['where'],{'$or':_[_0xf492('0x2a')](_0x5ce554,function(_0x5ded8e){if(_0x5ded8e[_0xf492('0x2d')]!==_0xf492('0x45')){var _0x4222b8={};_0x4222b8[_0x5ded8e['name']]={'$like':'%'+_0x2e98e7[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x4222b8;}})});}_0x3b0f1a=_['merge']({},_0x3b0f1a,_0x2e98e7['options']);var _0x45e734={'where':_0x3b0f1a[_0xf492('0x42')]};return db['VoiceQueue']['count'](_0x45e734)['then'](function(_0x564b8d){_0xdce339['count']=_0x564b8d;if(_0x2e98e7[_0xf492('0x39')][_0xf492('0x47')]){_0x3b0f1a[_0xf492('0x48')]=[{'all':!![]}];}return db[_0xf492('0x35')][_0xf492('0x49')](_0x3b0f1a);})['then'](function(_0x301520){_0xdce339['rows']=_0x301520;return _0xdce339;})[_0xf492('0x24')](respondWithFilteredResult(_0x10f0f2,_0x3b0f1a))[_0xf492('0x4a')](handleError(_0x10f0f2,null));};exports['show']=function(_0x264d35,_0x1ef926){var _0x2bab12={'raw':![],'where':{'id':_0x264d35[_0xf492('0x4b')]['id']}},_0x1bc8c7={};_0x1bc8c7['model']=_[_0xf492('0x3a')](db[_0xf492('0x35')][_0xf492('0x36')]);_0x1bc8c7['query']=_['keys'](_0x264d35[_0xf492('0x39')]);_0x1bc8c7[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1bc8c7['model'],_0x1bc8c7[_0xf492('0x39')]);_0x2bab12[_0xf492('0x3d')]=_['intersection'](_0x1bc8c7['model'],qs[_0xf492('0x4c')](_0x264d35['query'][_0xf492('0x4c')]));_0x2bab12[_0xf492('0x3d')]=_0x2bab12['attributes'][_0xf492('0x3e')]?_0x2bab12[_0xf492('0x3d')]:_0x1bc8c7[_0xf492('0x38')];if(_0x264d35[_0xf492('0x39')][_0xf492('0x47')]){_0x2bab12[_0xf492('0x48')]=[{'all':!![]}];}_0x2bab12=_[_0xf492('0x44')]({},_0x2bab12,_0x264d35[_0xf492('0x4d')]);return db[_0xf492('0x35')]['find'](_0x2bab12)[_0xf492('0x24')](handleEntityNotFound(_0x1ef926,null))[_0xf492('0x24')](respondWithResult(_0x1ef926,null))[_0xf492('0x4a')](handleError(_0x1ef926,null));};exports[_0xf492('0x4e')]=function(_0x3c8655,_0x4475d7){return db[_0xf492('0x35')][_0xf492('0x4e')](_0x3c8655['body'],{})[_0xf492('0x24')](function(_0x44fbb8){var _0x31235c=_0x3c8655[_0xf492('0x4f')][_0xf492('0x50')]({'plain':!![]});if(!_0x31235c)throw new Error(_0xf492('0x51'));if(_0x31235c[_0xf492('0x52')]===_0xf492('0x4f')){var _0x15bc8b=_0x44fbb8[_0xf492('0x50')]({'plain':!![]});var _0x2b9e57=[{'name':_0xf492('0x26'),'value':_0xf492('0x27')},{'name':_0xf492('0x53'),'value':_0xf492('0x28')}];var _0x7f171e=_[_0xf492('0x2e')](_0x2b9e57,['value',_0x15bc8b['type']])[_0xf492('0x32')];return db[_0xf492('0x54')]['find']({'where':{'name':_0x7f171e,'userProfileId':_0x31235c[_0xf492('0x55')]},'raw':!![]})[_0xf492('0x24')](function(_0x3296a4){if(_0x3296a4&&_0x3296a4[_0xf492('0x56')]===0x0){return db[_0xf492('0x2f')][_0xf492('0x4e')]({'name':_0x15bc8b[_0xf492('0x32')],'resourceId':_0x15bc8b['id'],'type':_0x3296a4[_0xf492('0x32')],'sectionId':_0x3296a4['id']},{})[_0xf492('0x24')](function(){return _0x44fbb8;});}else{return _0x44fbb8;}})[_0xf492('0x4a')](function(_0x4b363b){logger[_0xf492('0x30')](_0xf492('0x57'),_0x4b363b);throw _0x4b363b;});}return _0x44fbb8;})[_0xf492('0x24')](respondWithResult(_0x4475d7,0xc9))[_0xf492('0x4a')](handleError(_0x4475d7,null));};exports['clone']=function(_0x3ed7bb,_0x19cbe1){var _0x501936={'where':{'id':_0x3ed7bb[_0xf492('0x4b')]['id']}},_0x1c6b97={};_0x1c6b97[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x35')][_0xf492('0x36')]);_0x501936[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x1c6b97[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x3ed7bb['query'][_0xf492('0x4c')]));_0x501936[_0xf492('0x3d')]=_0x501936[_0xf492('0x3d')]['length']?_0x501936[_0xf492('0x3d')]:_0x1c6b97['model'];if(_0x3ed7bb[_0xf492('0x39')][_0xf492('0x47')]){_0x501936[_0xf492('0x48')]=[{'all':!![]}];}_0x501936=_['merge']({},_0x501936,_0x3ed7bb[_0xf492('0x4d')]);return db[_0xf492('0x35')][_0xf492('0x2e')](_0x501936)[_0xf492('0x24')](handleEntityNotFound(_0x19cbe1,null))['then'](function(_0x5d57ec){if(_0x5d57ec){var _0x101bbf=_0x5d57ec[_0xf492('0x50')]({'plain':!![]});_0x101bbf=qs['omit'](_0x101bbf,['id',_0xf492('0x58'),_0xf492('0x59')]);_0x3ed7bb[_0xf492('0x5a')]=_[_0xf492('0x5b')](_0x3ed7bb[_0xf492('0x5a')],['id',_0xf492('0x58'),_0xf492('0x59')]);return db['VoiceQueue'][_0xf492('0x4e')](_[_0xf492('0x44')](_0x101bbf,_0x3ed7bb[_0xf492('0x5a')]),{'include':_0x3ed7bb[_0xf492('0x39')][_0xf492('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x502aba){var _0x4d52ca=_0x3ed7bb[_0xf492('0x4f')][_0xf492('0x50')]({'plain':!![]});if(!_0x4d52ca)throw new Error(_0xf492('0x51'));if(_0x4d52ca[_0xf492('0x52')]===_0xf492('0x4f')){var _0x2170cd=_0x502aba[_0xf492('0x50')]({'plain':!![]});var _0x38da47=[{'name':_0xf492('0x26'),'value':'inbound'},{'name':_0xf492('0x53'),'value':_0xf492('0x28')}];var _0x5d150a=_[_0xf492('0x2e')](_0x38da47,[_0xf492('0x2b'),_0x2170cd[_0xf492('0x2d')]])[_0xf492('0x32')];return db[_0xf492('0x54')]['find']({'where':{'name':_0x5d150a,'userProfileId':_0x4d52ca[_0xf492('0x55')]},'raw':!![]})['then'](function(_0x5a9117){if(_0x5a9117&&_0x5a9117[_0xf492('0x56')]===0x0){return db[_0xf492('0x2f')][_0xf492('0x4e')]({'name':_0x2170cd[_0xf492('0x32')],'resourceId':_0x2170cd['id'],'type':_0x5a9117[_0xf492('0x32')],'sectionId':_0x5a9117['id']},{})[_0xf492('0x24')](function(){return _0x502aba;});}else{return _0x502aba;}})['catch'](function(_0x5c540f){logger[_0xf492('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c540f);throw _0x5c540f;});}return _0x502aba;});}})['then'](respondWithResult(_0x19cbe1,0xc9))['catch'](handleError(_0x19cbe1,null));};exports['update']=function(_0x139f8f,_0x2c3bc0){if(_0x139f8f[_0xf492('0x5a')]['id']){delete _0x139f8f[_0xf492('0x5a')]['id'];}return db[_0xf492('0x35')]['find']({'where':{'id':_0x139f8f[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x2c3bc0,null))['then'](saveUpdates(_0x139f8f[_0xf492('0x5a')],null))[_0xf492('0x24')](respondWithResult(_0x2c3bc0,null))['catch'](handleError(_0x2c3bc0,null));};exports[_0xf492('0x25')]=function(_0x28d4a4,_0xe9e650){return db[_0xf492('0x35')]['find']({'where':{'id':_0x28d4a4[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe9e650,null))[_0xf492('0x24')](removeEntity(_0xe9e650,null))[_0xf492('0x4a')](handleError(_0xe9e650,null));};exports[_0xf492('0x5c')]=function(_0x5b4966,_0x195f6a,_0x44f520){var _0x2fd687={'raw':![],'where':{}};var _0x1435b7={};var _0x265505={'count':0x0,'rows':[]};return db[_0xf492('0x35')][_0xf492('0x5d')]({'where':{'id':_0x5b4966['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x195f6a,null))[_0xf492('0x24')](function(_0x21d572){if(_0x21d572){_0x1435b7[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x5e')][_0xf492('0x36')]);_0x1435b7[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x5b4966['query']);_0x1435b7[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1435b7[_0xf492('0x38')],_0x1435b7[_0xf492('0x39')]);_0x2fd687[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x1435b7[_0xf492('0x38')],qs['fields'](_0x5b4966[_0xf492('0x39')][_0xf492('0x4c')]));_0x2fd687[_0xf492('0x3d')]=_0x2fd687[_0xf492('0x3d')][_0xf492('0x3e')]?_0x2fd687[_0xf492('0x3d')]:_0x1435b7[_0xf492('0x38')];if(!_0x5b4966[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x2fd687['limit']=qs['limit'](_0x5b4966[_0xf492('0x39')][_0xf492('0x1e')]);_0x2fd687[_0xf492('0x1d')]=qs['offset'](_0x5b4966[_0xf492('0x39')][_0xf492('0x1d')]);}_0x2fd687[_0xf492('0x40')]=qs['sort'](_0x5b4966[_0xf492('0x39')][_0xf492('0x41')]);_0x2fd687[_0xf492('0x42')]=qs['filters'](_[_0xf492('0x43')](_0x5b4966['query'],_0x1435b7['filters']));_0x2fd687['where'][_0xf492('0x60')]=_0x21d572['id'];if(_0x5b4966[_0xf492('0x39')][_0xf492('0x46')]){_0x2fd687[_0xf492('0x42')]=_[_0xf492('0x44')](_0x2fd687['where'],{'$or':_[_0xf492('0x2a')](_0x2fd687['attributes'],function(_0xb858af){var _0x3f6611={};_0x3f6611[_0xb858af]={'$like':'%'+_0x5b4966[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x3f6611;})});}_0x2fd687=_[_0xf492('0x44')]({},_0x2fd687,_0x5b4966[_0xf492('0x4d')]);return db[_0xf492('0x5e')][_0xf492('0x1c')]({'where':_0x2fd687[_0xf492('0x42')]})['then'](function(_0xf7718c){_0x265505[_0xf492('0x1c')]=_0xf7718c;if(_0x5b4966[_0xf492('0x39')][_0xf492('0x47')]){_0x2fd687['include']=[{'all':!![]}];}return db[_0xf492('0x5e')]['findAll'](_0x2fd687);})[_0xf492('0x24')](function(_0x4a09ed){_0x265505[_0xf492('0x61')]=_0x4a09ed;return _0x265505;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x195f6a,_0x2fd687))[_0xf492('0x4a')](handleError(_0x195f6a,null));};exports[_0xf492('0x62')]=function(_0x15d6df,_0x24d36a,_0x479d5c){var _0x1edf8e={'raw':!![],'where':{}};var _0x5647a9={};var _0x61a77f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x15d6df[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x24d36a,null))['then'](function(_0x39a6e4){if(_0x39a6e4){_0x5647a9[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x63')][_0xf492('0x36')]);_0x5647a9[_0xf492('0x39')]=_['keys'](_0x15d6df['query']);_0x5647a9['filters']=_[_0xf492('0x3c')](_0x5647a9['model'],_0x5647a9[_0xf492('0x39')]);_0x1edf8e[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x5647a9['model'],qs[_0xf492('0x4c')](_0x15d6df['query'][_0xf492('0x4c')]));_0x1edf8e[_0xf492('0x3d')]=_0x1edf8e[_0xf492('0x3d')][_0xf492('0x3e')]?_0x1edf8e['attributes']:_0x5647a9[_0xf492('0x38')];if(!_0x15d6df[_0xf492('0x39')]['hasOwnProperty'](_0xf492('0x5f'))){_0x1edf8e[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x15d6df[_0xf492('0x39')][_0xf492('0x1e')]);_0x1edf8e[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x15d6df[_0xf492('0x39')][_0xf492('0x1d')]);}_0x1edf8e[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x15d6df['query'][_0xf492('0x41')]);_0x1edf8e['where']=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x15d6df[_0xf492('0x39')],_0x5647a9[_0xf492('0x3b')]));_0x1edf8e[_0xf492('0x42')][_0xf492('0x60')]=_0x39a6e4['id'];if(_0x15d6df[_0xf492('0x39')][_0xf492('0x46')]){_0x1edf8e['where']=_[_0xf492('0x44')](_0x1edf8e[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0x1edf8e[_0xf492('0x3d')],function(_0x1567e0){var _0x5845c8={};_0x5845c8[_0x1567e0]={'$like':'%'+_0x15d6df['query'][_0xf492('0x46')]+'%'};return _0x5845c8;})});}_0x1edf8e=_[_0xf492('0x44')]({},_0x1edf8e,_0x15d6df['options']);return db[_0xf492('0x63')][_0xf492('0x1c')]({'where':_0x1edf8e['where']})[_0xf492('0x24')](function(_0x3f9967){_0x61a77f[_0xf492('0x1c')]=_0x3f9967;if(_0x15d6df[_0xf492('0x39')][_0xf492('0x47')]){_0x1edf8e['include']=[{'all':!![]}];}return db[_0xf492('0x63')][_0xf492('0x49')](_0x1edf8e);})[_0xf492('0x24')](function(_0x59789e){_0x61a77f[_0xf492('0x61')]=_0x59789e;return _0x61a77f;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x24d36a,_0x1edf8e))[_0xf492('0x4a')](handleError(_0x24d36a,null));};exports[_0xf492('0x64')]=function(_0xa2909,_0x2e93d6,_0x36e18a){var _0xcef401={'raw':!![],'where':{}};var _0x1146ef={};var _0x2429d5={'count':0x0,'rows':[]};return db[_0xf492('0x35')][_0xf492('0x5d')]({'where':{'id':_0xa2909[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e93d6,null))[_0xf492('0x24')](function(_0x3be1ad){if(_0x3be1ad){_0x1146ef[_0xf492('0x38')]=_['keys'](db[_0xf492('0x65')][_0xf492('0x36')]);_0x1146ef[_0xf492('0x39')]=_[_0xf492('0x3a')](_0xa2909[_0xf492('0x39')]);_0x1146ef[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1146ef['model'],_0x1146ef[_0xf492('0x39')]);_0xcef401['attributes']=_[_0xf492('0x3c')](_0x1146ef[_0xf492('0x38')],qs[_0xf492('0x4c')](_0xa2909[_0xf492('0x39')][_0xf492('0x4c')]));_0xcef401['attributes']=_0xcef401[_0xf492('0x3d')][_0xf492('0x3e')]?_0xcef401[_0xf492('0x3d')]:_0x1146ef['model'];if(!_0xa2909['query'][_0xf492('0x3f')]('nolimit')){_0xcef401['limit']=qs[_0xf492('0x1e')](_0xa2909[_0xf492('0x39')][_0xf492('0x1e')]);_0xcef401['offset']=qs[_0xf492('0x1d')](_0xa2909[_0xf492('0x39')]['offset']);}_0xcef401[_0xf492('0x40')]=qs[_0xf492('0x41')](_0xa2909[_0xf492('0x39')][_0xf492('0x41')]);_0xcef401['where']=qs[_0xf492('0x3b')](_['pick'](_0xa2909[_0xf492('0x39')],_0x1146ef[_0xf492('0x3b')]));_0xcef401[_0xf492('0x42')][_0xf492('0x60')]=_0x3be1ad['id'];if(_0xa2909['query'][_0xf492('0x46')]){_0xcef401[_0xf492('0x42')]=_[_0xf492('0x44')](_0xcef401[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0xcef401['attributes'],function(_0x5851f9){var _0x3fef1f={};_0x3fef1f[_0x5851f9]={'$like':'%'+_0xa2909['query'][_0xf492('0x46')]+'%'};return _0x3fef1f;})});}_0xcef401=_[_0xf492('0x44')]({},_0xcef401,_0xa2909['options']);return db[_0xf492('0x65')][_0xf492('0x1c')]({'where':_0xcef401[_0xf492('0x42')]})['then'](function(_0x1898b1){_0x2429d5[_0xf492('0x1c')]=_0x1898b1;if(_0xa2909[_0xf492('0x39')][_0xf492('0x47')]){_0xcef401['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xf492('0x49')](_0xcef401);})[_0xf492('0x24')](function(_0x1cc11e){_0x2429d5['rows']=_0x1cc11e;return _0x2429d5;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x2e93d6,_0xcef401))['catch'](handleError(_0x2e93d6,null));};exports[_0xf492('0x66')]=function(_0x54e85e,_0x39d425,_0x21b6ff){var _0x2542e5={'raw':!![],'where':{}};var _0x34242d={};var _0x4ee001={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf492('0x5d')]({'where':{'id':_0x54e85e[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x39d425,null))['then'](function(_0x53d384){if(_0x53d384){_0x34242d[_0xf492('0x38')]=_['keys'](db['CmHopperBlack'][_0xf492('0x36')]);_0x34242d['query']=_[_0xf492('0x3a')](_0x54e85e[_0xf492('0x39')]);_0x34242d[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x34242d[_0xf492('0x38')],_0x34242d[_0xf492('0x39')]);_0x2542e5[_0xf492('0x3d')]=_['intersection'](_0x34242d[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x54e85e['query'][_0xf492('0x4c')]));_0x2542e5[_0xf492('0x3d')]=_0x2542e5[_0xf492('0x3d')][_0xf492('0x3e')]?_0x2542e5['attributes']:_0x34242d['model'];if(!_0x54e85e[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x2542e5[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x54e85e[_0xf492('0x39')]['limit']);_0x2542e5['offset']=qs[_0xf492('0x1d')](_0x54e85e[_0xf492('0x39')][_0xf492('0x1d')]);}_0x2542e5[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x54e85e[_0xf492('0x39')][_0xf492('0x41')]);_0x2542e5[_0xf492('0x42')]=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x54e85e[_0xf492('0x39')],_0x34242d[_0xf492('0x3b')]));_0x2542e5[_0xf492('0x42')][_0xf492('0x60')]=_0x53d384['id'];if(_0x54e85e['query'][_0xf492('0x46')]){_0x2542e5['where']=_[_0xf492('0x44')](_0x2542e5['where'],{'$or':_[_0xf492('0x2a')](_0x2542e5[_0xf492('0x3d')],function(_0x971e01){var _0x30dcb={};_0x30dcb[_0x971e01]={'$like':'%'+_0x54e85e[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x30dcb;})});}_0x2542e5=_[_0xf492('0x44')]({},_0x2542e5,_0x54e85e[_0xf492('0x4d')]);return db[_0xf492('0x67')][_0xf492('0x1c')]({'where':_0x2542e5[_0xf492('0x42')]})['then'](function(_0x48403c){_0x4ee001[_0xf492('0x1c')]=_0x48403c;if(_0x54e85e['query'][_0xf492('0x47')]){_0x2542e5[_0xf492('0x48')]=[{'all':!![]}];}return db[_0xf492('0x67')]['findAll'](_0x2542e5);})['then'](function(_0x2d666d){_0x4ee001[_0xf492('0x61')]=_0x2d666d;return _0x4ee001;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x39d425,_0x2542e5))[_0xf492('0x4a')](handleError(_0x39d425,null));};exports[_0xf492('0x68')]=function(_0x496f49,_0x40ec96,_0x1a74f6){var _0x95cc23={};var _0x27fdc3={};var _0x425076;var _0x26d551;return db['VoiceQueue']['findOne']({'where':{'id':_0x496f49['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x40ec96,null))['then'](function(_0x26583c){if(_0x26583c){_0x425076=_0x26583c;_0x27fdc3[_0xf492('0x38')]=_['keys'](db['Team'][_0xf492('0x36')]);_0x27fdc3[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x496f49['query']);_0x27fdc3[_0xf492('0x3b')]=_['intersection'](_0x27fdc3[_0xf492('0x38')],_0x27fdc3['query']);_0x95cc23[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x27fdc3['model'],qs['fields'](_0x496f49[_0xf492('0x39')][_0xf492('0x4c')]));_0x95cc23['attributes']=_0x95cc23[_0xf492('0x3d')][_0xf492('0x3e')]?_0x95cc23[_0xf492('0x3d')]:_0x27fdc3[_0xf492('0x38')];_0x95cc23[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x496f49[_0xf492('0x39')][_0xf492('0x41')]);_0x95cc23[_0xf492('0x42')]=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x496f49[_0xf492('0x39')],_0x27fdc3[_0xf492('0x3b')]));if(_0x496f49[_0xf492('0x39')]['filter']){_0x95cc23['where']=_['merge'](_0x95cc23[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0x95cc23['attributes'],function(_0x52b4f0){var _0x4f7554={};_0x4f7554[_0x52b4f0]={'$like':'%'+_0x496f49['query'][_0xf492('0x46')]+'%'};return _0x4f7554;})});}_0x95cc23=_['merge']({},_0x95cc23,_0x496f49[_0xf492('0x4d')]);return _0x425076[_0xf492('0x68')](_0x95cc23);}})[_0xf492('0x24')](function(_0x172b28){if(_0x172b28){_0x26d551=_0x172b28[_0xf492('0x3e')];if(!_0x496f49[_0xf492('0x39')]['hasOwnProperty'](_0xf492('0x5f'))){_0x95cc23[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x496f49[_0xf492('0x39')][_0xf492('0x1e')]);_0x95cc23[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x496f49[_0xf492('0x39')][_0xf492('0x1d')]);}return _0x425076['getTeams'](_0x95cc23);}})[_0xf492('0x24')](function(_0x5b3538){if(_0x5b3538){return _0x5b3538?{'count':_0x26d551,'rows':_0x5b3538}:null;}})['then'](respondWithResult(_0x40ec96,null))[_0xf492('0x4a')](handleError(_0x40ec96,null));};exports[_0xf492('0x69')]=function(_0x4a281c,_0x38c217,_0x57f259){var _0x77c18e=_0x4a281c[_0xf492('0x5a')][_0xf492('0x6a')];var _0x4f3e8b=_[_0xf492('0x2a')](_0x77c18e,'id');return db[_0xf492('0x6b')][_0xf492('0x49')]({'where':{'id':_0x4f3e8b},'attributes':['id'],'include':[{'model':db[_0xf492('0x6c')],'as':_0xf492('0x6d'),'attributes':['id',_0xf492('0x32'),'online',_0xf492('0x6e'),_0xf492('0x6f')],'raw':!![]}]})[_0xf492('0x24')](function(_0x1bea8f){if(_0x1bea8f){var _0x5a369d=_[_0xf492('0x70')](_0x1bea8f,function(_0x5f3f27){var _0x279943=_0x5f3f27[_0xf492('0x50')]({'plain':!![]});_0x279943[_0xf492('0x6d')]['forEach'](function(_0x58ea26){_0x58ea26[_0xf492('0x71')]=_[_0xf492('0x2e')](_0x77c18e,{'id':_0x279943['id']})[_0xf492('0x71')];});return _0x279943[_0xf492('0x6d')];});return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x4a281c[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(_0x5527ba){return db[_0xf492('0x72')]['transaction'](function(_0x229842){return _0x5527ba[_0xf492('0x69')](_0x4f3e8b,{'transaction':_0x229842})[_0xf492('0x24')](function(){return BPromise['each'](_0x5a369d,function(_0xf5504){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0xf5504['id'],'VoiceQueueId':_0x4a281c[_0xf492('0x4b')]['id']},'defaults':{'penalty':_0xf5504[_0xf492('0x71')]},'transaction':_0x229842});});})[_0xf492('0x24')](function(){return BPromise[_0xf492('0x73')](_['filter'](_0x5a369d,{'online':!![]}),function(_0x55fcba){return db[_0xf492('0x74')][_0xf492('0x75')]({'membername':_0x55fcba[_0xf492('0x32')],'UserId':_0x55fcba['id'],'queue_name':_0x5527ba[_0xf492('0x32')],'VoiceQueueId':_0x5527ba['id'],'interface':_[_0xf492('0x76')](_0x55fcba[_0xf492('0x6f')])?util['format'](_0xf492('0x77'),_0x55fcba[_0xf492('0x32')]):_0x55fcba['interface'],'paused':_0x55fcba['voicePause']||![],'penalty':_0x55fcba[_0xf492('0x71')]},{'transaction':_0x229842});});})[_0xf492('0x24')](function(){_0x5a369d[_0xf492('0x78')](function(_0x4dd447){socket['emit']('userVoiceQueue:save',{'UserId':_0x4dd447['id'],'VoiceQueueId':_0x5527ba['id']});});});});});}})[_0xf492('0x24')](respondWithStatusCode(_0x38c217,null))['catch'](handleError(_0x38c217,null));};exports['removeTeams']=function(_0x5bf244,_0x322d39,_0x1d9fd0){return db[_0xf492('0x6b')]['findAll']({'where':{'id':_0x5bf244['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf492('0x6c')],'as':_0xf492('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xf492('0x24')](handleEntityNotFound(_0x322d39,null))['then'](function(_0x48cb87){var _0x2b8ac6=_[_0xf492('0x2a')](_0x48cb87,'id');var _0x513fc3=[];var _0x2bf10b=[];var _0x486082=squel[_0xf492('0x79')]();_0x486082[_0xf492('0x7a')](_0xf492('0x7b'))['from']('team_has_voice_queues','tq')[_0xf492('0x7c')](_0xf492('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf492('0x7e'),_0x5bf244[_0xf492('0x4b')]['id']);for(var _0x1de0bb=0x0;_0x1de0bb<_0x48cb87[_0xf492('0x3e')];_0x1de0bb+=0x1){let _0x5e0b0f=_0x48cb87[_0x1de0bb];for(var _0x1de59b=0x0;_0x1de59b<_0x5e0b0f[_0xf492('0x6d')][_0xf492('0x3e')];_0x1de59b+=0x1){let _0x145009=_0x5e0b0f[_0xf492('0x6d')][_0x1de59b];var _0x2979f8=_0x486082['clone']();_0x2979f8[_0xf492('0x42')](_0xf492('0x7f'),_0x145009['id']);_0x2bf10b['push'](db[_0xf492('0x72')][_0xf492('0x39')](_0x2979f8[_0xf492('0x80')](),{'type':db[_0xf492('0x72')][_0xf492('0x81')][_0xf492('0x82')]})[_0xf492('0x24')](function(_0x4340e1){if(_0x4340e1[_0xf492('0x3e')]===0x1){return _0x145009['id'];}else{var _0x40b802=_[_0xf492('0x83')](_[_0xf492('0x2a')](_0x4340e1,_0xf492('0x84')),function(_0x3e8aac){return _[_0xf492('0x2c')](_0x2b8ac6,_0x3e8aac);});if(_0x40b802){return _0x145009['id'];}}}));}}return BPromise['all'](_0x2bf10b)['then'](function(_0x569e73){_0x513fc3=_(_0x513fc3)['union'](_0x569e73)[_0xf492('0x85')]()[_0xf492('0x2b')]();return db[_0xf492('0x35')]['find']({'where':{'id':_0x5bf244[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(_0x2ebd49){return db['sequelize']['transaction'](function(_0x5e837e){return _0x2ebd49['removeTeams'](_0x5bf244[_0xf492('0x39')][_0xf492('0x86')],{'transaction':_0x5e837e})[_0xf492('0x24')](function(){if(!_[_0xf492('0x87')](_0x513fc3)){return _0x2ebd49[_0xf492('0x88')](_0x513fc3,{'transaction':_0x5e837e})[_0xf492('0x24')](function(){return db[_0xf492('0x74')][_0xf492('0x25')]({'where':{'VoiceQueueId':_0x5bf244['params']['id'],'UserId':_0x513fc3},'transaction':_0x5e837e});});}})[_0xf492('0x24')](function(){_0x513fc3[_0xf492('0x78')](function(_0x2e9ec2){socket['emit'](_0xf492('0x89'),{'UserId':_0x2e9ec2,'VoiceQueueId':_0x2ebd49['id']});});});});});});})[_0xf492('0x24')](respondWithStatusCode(_0x322d39,null))[_0xf492('0x4a')](handleError(_0x322d39,null));};exports['addAgents']=function(_0x45f189,_0x45a6cf,_0x179ca6){var _0x148795,_0x2380c2;return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x45f189['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x45a6cf,null))['then'](function(_0x2c3f7d){if(_0x2c3f7d){_0x2380c2=_0x2c3f7d;return _0x2c3f7d[_0xf492('0x8a')](_0x45f189[_0xf492('0x5a')][_0xf492('0x86')],_[_0xf492('0x5b')](_0x45f189['body'],[_0xf492('0x86'),'id'])||{})[_0xf492('0x8b')](function(_0xe5dd89){for(var _0x14a7ac=0x0;_0x14a7ac<_0x45f189[_0xf492('0x5a')][_0xf492('0x86')][_0xf492('0x3e')];_0x14a7ac+=0x1){socket[_0xf492('0x8c')](_0xf492('0x8d'),{'UserId':_0x45f189['body']['ids'][_0x14a7ac],'VoiceQueueId':_0x45f189[_0xf492('0x4b')]['id']});}return _0xe5dd89;});}})['then'](function(_0x23ab92){_0x148795=_0x23ab92||[];if(_0x2380c2){return db[_0xf492('0x6c')][_0xf492('0x49')]({'where':{'id':_0x45f189['body'][_0xf492('0x86')]},'attributes':['id',_0xf492('0x32'),'online',_0xf492('0x6e'),'interface'],'raw':!![]});}})[_0xf492('0x24')](function(_0x54b68b){if(!_[_0xf492('0x87')](_0x54b68b)){var _0x560458=[];for(var _0x1cd14a=0x0;_0x1cd14a<_0x54b68b['length'];_0x1cd14a++){if(_0x54b68b[_0x1cd14a][_0xf492('0x8e')]){_0x560458[_0xf492('0x8f')](db[_0xf492('0x74')][_0xf492('0x75')]({'membername':_0x54b68b[_0x1cd14a][_0xf492('0x32')],'UserId':_0x54b68b[_0x1cd14a]['id'],'queue_name':_0x2380c2[_0xf492('0x32')],'VoiceQueueId':_0x2380c2['id'],'interface':_[_0xf492('0x76')](_0x54b68b[_0x1cd14a][_0xf492('0x6f')])?util[_0xf492('0x90')](_0xf492('0x77'),_0x54b68b[_0x1cd14a][_0xf492('0x32')]):_0x54b68b[_0x1cd14a]['interface'],'paused':_0x54b68b[_0x1cd14a][_0xf492('0x6e')]||![],'penalty':_0x45f189[_0xf492('0x5a')][_0xf492('0x71')]||0x0}));}}return BPromise[_0xf492('0x91')](_0x560458);}})[_0xf492('0x24')](function(){return _0x148795;})[_0xf492('0x24')](respondWithResult(_0x45a6cf,null))['catch'](handleError(_0x45a6cf,null));};exports[_0xf492('0x88')]=function(_0x1936c7,_0x20ee1e,_0x5b9be8){return db[_0xf492('0x35')]['find']({'where':{'id':_0x1936c7[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x20ee1e,null))['then'](function(_0x8d2f53){if(_0x8d2f53){return _0x8d2f53[_0xf492('0x88')](_0x1936c7[_0xf492('0x39')][_0xf492('0x86')])['then'](function(){if(_[_0xf492('0x92')](_0x1936c7['query'][_0xf492('0x86')])){for(var _0x1bcab2=0x0;_0x1bcab2<_0x1936c7[_0xf492('0x39')][_0xf492('0x86')]['length'];_0x1bcab2+=0x1){socket[_0xf492('0x8c')](_0xf492('0x89'),{'UserId':Number(_0x1936c7['query']['ids'][_0x1bcab2]),'VoiceQueueId':Number(_0x1936c7[_0xf492('0x4b')]['id'])});}}else{socket[_0xf492('0x8c')](_0xf492('0x89'),{'UserId':Number(_0x1936c7[_0xf492('0x39')][_0xf492('0x86')]),'VoiceQueueId':Number(_0x1936c7[_0xf492('0x4b')]['id'])});}});}})[_0xf492('0x24')](function(_0x19cb9a){return db[_0xf492('0x74')][_0xf492('0x25')]({'where':{'VoiceQueueId':_0x1936c7[_0xf492('0x4b')]['id'],'UserId':_0x1936c7['query'][_0xf492('0x86')]}})[_0xf492('0x24')](function(){return _0x19cb9a;});})[_0xf492('0x24')](respondWithStatusCode(_0x20ee1e,null))[_0xf492('0x4a')](handleError(_0x20ee1e,null));};exports[_0xf492('0x93')]=function(_0x997c60,_0x1c8086,_0x3beb91){var _0x52d3a1={};var _0x1a0239={};var _0x41096c;var _0x4a8c35;return db[_0xf492('0x35')]['findOne']({'where':{'id':_0x997c60['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x1c8086,null))[_0xf492('0x24')](function(_0x252413){if(_0x252413){_0x41096c=_0x252413;_0x1a0239[_0xf492('0x38')]=_['keys'](db[_0xf492('0x6c')][_0xf492('0x36')]);_0x1a0239['query']=_['keys'](_0x997c60['query']);_0x1a0239[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1a0239[_0xf492('0x38')],_0x1a0239[_0xf492('0x39')]);_0x52d3a1[_0xf492('0x3d')]=_['intersection'](_0x1a0239[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x997c60[_0xf492('0x39')][_0xf492('0x4c')]));_0x52d3a1[_0xf492('0x3d')]=_0x52d3a1[_0xf492('0x3d')][_0xf492('0x3e')]?_0x52d3a1[_0xf492('0x3d')]:_0x1a0239[_0xf492('0x38')];_0x52d3a1[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x997c60['query'][_0xf492('0x41')]);_0x52d3a1['where']=qs[_0xf492('0x3b')](_['pick'](_0x997c60[_0xf492('0x39')],_0x1a0239[_0xf492('0x3b')]));if(_0x997c60[_0xf492('0x39')][_0xf492('0x46')]){_0x52d3a1[_0xf492('0x42')]=_[_0xf492('0x44')](_0x52d3a1[_0xf492('0x42')],{'$or':_['map'](_0x52d3a1[_0xf492('0x3d')],function(_0x3af4f1){var _0x1e3700={};_0x1e3700[_0x3af4f1]={'$like':'%'+_0x997c60[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x1e3700;})});}_0x52d3a1=_[_0xf492('0x44')]({},_0x52d3a1,_0x997c60['options']);return _0x41096c[_0xf492('0x93')](_0x52d3a1);}})[_0xf492('0x24')](function(_0x210c9a){if(_0x210c9a){_0x4a8c35=_0x210c9a['length'];if(!_0x997c60[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x52d3a1[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x997c60[_0xf492('0x39')][_0xf492('0x1e')]);_0x52d3a1[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x997c60[_0xf492('0x39')][_0xf492('0x1d')]);}return _0x41096c[_0xf492('0x93')](_0x52d3a1);}})['then'](function(_0x23a5b5){if(_0x23a5b5){return _0x23a5b5?{'count':_0x4a8c35,'rows':_0x23a5b5}:null;}})[_0xf492('0x24')](respondWithResult(_0x1c8086,null))[_0xf492('0x4a')](handleError(_0x1c8086,null));};exports[_0xf492('0x94')]=function(_0x1ea762,_0x15adfa,_0x44e1dd){var _0x46cb59={};var _0x2a812b={};var _0xa7b1a9;var _0x9b3be5;return db[_0xf492('0x35')]['findOne']({'where':{'id':_0x1ea762[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15adfa,null))[_0xf492('0x24')](function(_0x1bcca8){if(_0x1bcca8){_0xa7b1a9=_0x1bcca8;_0x2a812b[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x74')]['rawAttributes']);_0x2a812b[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x1ea762['query']);_0x2a812b['filters']=_[_0xf492('0x3c')](_0x2a812b[_0xf492('0x38')],_0x2a812b[_0xf492('0x39')]);_0x46cb59[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x2a812b[_0xf492('0x38')],qs['fields'](_0x1ea762[_0xf492('0x39')][_0xf492('0x4c')]));_0x46cb59['attributes']=_0x46cb59[_0xf492('0x3d')][_0xf492('0x3e')]?_0x46cb59[_0xf492('0x3d')]:_0x2a812b[_0xf492('0x38')];_0x46cb59[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x1ea762['query'][_0xf492('0x41')]);_0x46cb59[_0xf492('0x42')]=qs['filters'](_[_0xf492('0x43')](_0x1ea762[_0xf492('0x39')],_0x2a812b['filters']));if(_0x1ea762[_0xf492('0x39')]['filter']){_0x46cb59[_0xf492('0x42')]=_[_0xf492('0x44')](_0x46cb59[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0x46cb59[_0xf492('0x3d')],function(_0x4661d0){var _0x3693d6={};_0x3693d6[_0x4661d0]={'$like':'%'+_0x1ea762[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x3693d6;})});}_0x46cb59=_[_0xf492('0x44')]({},_0x46cb59,_0x1ea762['options']);return _0xa7b1a9[_0xf492('0x94')](_0x46cb59);}})[_0xf492('0x24')](function(_0xac4436){if(_0xac4436){_0x9b3be5=_0xac4436[_0xf492('0x3e')];if(!_0x1ea762['query'][_0xf492('0x3f')]('nolimit')){_0x46cb59[_0xf492('0x1e')]=qs['limit'](_0x1ea762['query'][_0xf492('0x1e')]);_0x46cb59['offset']=qs[_0xf492('0x1d')](_0x1ea762[_0xf492('0x39')][_0xf492('0x1d')]);}return _0xa7b1a9['getMembers'](_0x46cb59);}})['then'](function(_0x53d3df){return _0x53d3df?{'count':_0x9b3be5,'rows':_0x53d3df}:null;})['then'](respondWithResult(_0x15adfa,null))['catch'](handleError(_0x15adfa,null));};exports['getLists']=function(_0x1f312d,_0x475577,_0x106ea5){var _0x2602f2={};var _0x237ea1={};var _0x26ec85;var _0x204646;return db['VoiceQueue'][_0xf492('0x5d')]({'where':{'id':_0x1f312d['params']['id']}})['then'](handleEntityNotFound(_0x475577,null))[_0xf492('0x24')](function(_0x4a411f){if(_0x4a411f){_0x26ec85=_0x4a411f;_0x237ea1[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x95')]['rawAttributes']);_0x237ea1[_0xf492('0x39')]=_['keys'](_0x1f312d[_0xf492('0x39')]);_0x237ea1['filters']=_['intersection'](_0x237ea1['model'],_0x237ea1[_0xf492('0x39')]);_0x2602f2[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x237ea1[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x1f312d['query']['fields']));_0x2602f2['attributes']=_0x2602f2[_0xf492('0x3d')][_0xf492('0x3e')]?_0x2602f2[_0xf492('0x3d')]:_0x237ea1[_0xf492('0x38')];_0x2602f2[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x1f312d[_0xf492('0x39')][_0xf492('0x41')]);_0x2602f2[_0xf492('0x42')]=qs['filters'](_[_0xf492('0x43')](_0x1f312d[_0xf492('0x39')],_0x237ea1[_0xf492('0x3b')]));if(_0x1f312d[_0xf492('0x39')][_0xf492('0x46')]){_0x2602f2[_0xf492('0x42')]=_[_0xf492('0x44')](_0x2602f2['where'],{'$or':_[_0xf492('0x2a')](_0x2602f2['attributes'],function(_0x4cdba5){var _0x36de7e={};_0x36de7e[_0x4cdba5]={'$like':'%'+_0x1f312d[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x36de7e;})});}_0x2602f2=_[_0xf492('0x44')]({},_0x2602f2,_0x1f312d[_0xf492('0x4d')]);return _0x26ec85[_0xf492('0x96')](_0x2602f2);}})[_0xf492('0x24')](function(_0x133066){if(_0x133066){_0x204646=_0x133066[_0xf492('0x3e')];if(!_0x1f312d[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x2602f2['limit']=qs['limit'](_0x1f312d['query']['limit']);_0x2602f2['offset']=qs[_0xf492('0x1d')](_0x1f312d[_0xf492('0x39')][_0xf492('0x1d')]);}return _0x26ec85[_0xf492('0x96')](_0x2602f2);}})['then'](function(_0x3ca8cb){if(_0x3ca8cb){return _0x3ca8cb?{'count':_0x204646,'rows':_0x3ca8cb}:null;}})['then'](respondWithResult(_0x475577,null))[_0xf492('0x4a')](handleError(_0x475577,null));};exports[_0xf492('0x97')]=function(_0x251403,_0x1e21fa,_0x3255ed){var _0x589a07,_0x286fc2;return db['VoiceQueue']['find']({'where':{'id':_0x251403[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e21fa,null))[_0xf492('0x24')](function(_0x21d519){if(_0x21d519){_0x286fc2=_0x21d519;return _0x21d519['addLists'](_0x251403[_0xf492('0x5a')][_0xf492('0x86')],_['omit'](_0x251403[_0xf492('0x5a')],[_0xf492('0x86'),'id'])||{});}return null;})['spread'](function(_0x2e8bbb){var _0xc54a7;_0x589a07=_0x2e8bbb||[];var _0x330f0a=[];if(_0x2e8bbb){for(var _0x4eb7f4=0x0;_0x4eb7f4<_0x2e8bbb['length'];_0x4eb7f4+=0x1){var _0x3516bc=_0x2e8bbb[_0x4eb7f4][_0xf492('0x50')]({'plain':!![]});_0x286fc2['dialCheckDuplicateType']=_0x251403[_0xf492('0x5a')][_0xf492('0x98')]?_0x251403[_0xf492('0x5a')][_0xf492('0x98')]:_0x286fc2[_0xf492('0x98')];switch(_0x286fc2[_0xf492('0x98')]){case'always':_0xc54a7=squel[_0xf492('0x99')]()[_0xf492('0x9a')](_0xf492('0x9b'))[_0xf492('0x9c')]([_0xf492('0x9d'),'scheduledAt',_0xf492('0x9e'),_0xf492('0x9f'),'VoiceQueueId','createdAt',_0xf492('0x59')],squel[_0xf492('0x79')]()[_0xf492('0x7a')](_0xf492('0x9d'),'phone')[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0xa1'))[_0xf492('0x7a')]('id','ContactId')[_0xf492('0x7a')](_0x3516bc['CmListId'][_0xf492('0x80')](),'ListId')[_0xf492('0x7a')](_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')](),_0xf492('0x60'))['field'](_0xf492('0xa0'),_0xf492('0x58'))[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x59'))[_0xf492('0xa2')](_0xf492('0xa3'))[_0xf492('0x42')](_0xf492('0xa4'))['where']('ListId\x20=\x20?',_0x3516bc[_0xf492('0xa5')][_0xf492('0x80')]())[_0xf492('0x42')](_0xf492('0xa6'))[_0xf492('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf492('0x7a')](_0xf492('0xa7'))[_0xf492('0xa2')](_0xf492('0xa8'))['where'](_0xf492('0x7e'),_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xf492('0x79')]()[_0xf492('0x7a')]('COALESCE(phone,\x27\x27)')[_0xf492('0xa2')](_0xf492('0x9b'))[_0xf492('0x42')](_0xf492('0x7e'),_0x251403['params']['id'][_0xf492('0x80')]())))[_0xf492('0x80')]();break;case _0xf492('0xa9'):_0xc54a7=squel[_0xf492('0x99')]()['into'](_0xf492('0x9b'))[_0xf492('0x9c')]([_0xf492('0x9d'),_0xf492('0xa1'),_0xf492('0x9e'),_0xf492('0x9f'),_0xf492('0x60'),'createdAt','updatedAt'],squel['select']()[_0xf492('0x7a')](_0xf492('0x9d'),_0xf492('0x9d'))[_0xf492('0x7a')](_0xf492('0xa0'),'scheduledAt')[_0xf492('0x7a')]('id',_0xf492('0x9e'))[_0xf492('0x7a')](_0x3516bc['CmListId'][_0xf492('0x80')](),_0xf492('0x9f'))['field'](_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')](),'VoiceQueueId')[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x58'))[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x59'))[_0xf492('0xa2')]('cm_contacts')[_0xf492('0x42')](_0xf492('0xa4'))[_0xf492('0x42')]('ListId\x20=\x20?',_0x3516bc['CmListId'][_0xf492('0x80')]())[_0xf492('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xf492('0x42')](_0xf492('0xaa'),squel[_0xf492('0x79')]()['field'](_0xf492('0xab'))[_0xf492('0xa2')](_0xf492('0x9b'))[_0xf492('0x42')]('VoiceQueueId\x20=\x20?',_0x251403['params']['id'][_0xf492('0x80')]())))['toString']();break;default:_0xc54a7=squel['insert']()[_0xf492('0x9a')](_0xf492('0x9b'))[_0xf492('0x9c')]([_0xf492('0x9d'),_0xf492('0xa1'),_0xf492('0x9e'),_0xf492('0x9f'),_0xf492('0x60'),_0xf492('0x58'),'updatedAt'],squel[_0xf492('0x79')]()[_0xf492('0x7a')]('phone',_0xf492('0x9d'))[_0xf492('0x7a')](_0xf492('0xa0'),'scheduledAt')[_0xf492('0x7a')]('id','ContactId')[_0xf492('0x7a')](_0x3516bc[_0xf492('0xa5')][_0xf492('0x80')](),_0xf492('0x9f'))[_0xf492('0x7a')](_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')](),_0xf492('0x60'))[_0xf492('0x7a')]('NOW()','createdAt')[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x59'))[_0xf492('0xa2')](_0xf492('0xa3'))[_0xf492('0x42')](_0xf492('0xa4'))[_0xf492('0x42')]('ListId\x20=\x20?',_0x3516bc[_0xf492('0xa5')][_0xf492('0x80')]())['where'](_0xf492('0xa6')))[_0xf492('0x80')]();}_0x330f0a[_0xf492('0x8f')](db['sequelize'][_0xf492('0x39')](_0xc54a7));}return BPromise['all'](_0x330f0a);}})['then'](function(){return _0x589a07;})[_0xf492('0x24')](respondWithResult(_0x1e21fa,null))['catch'](handleError(_0x1e21fa,null));};exports[_0xf492('0xac')]=function(_0x894b71,_0x444868,_0xff10d6){return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x894b71['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x444868,null))[_0xf492('0x24')](function(_0xb983ee){if(_0xb983ee){return _0xb983ee[_0xf492('0xac')](_0x894b71[_0xf492('0x39')][_0xf492('0x86')]);}})[_0xf492('0x24')](function(_0x2c5004){if(_0x2c5004){return db[_0xf492('0x5e')]['destroy']({'where':{'ListId':_0x894b71['query']['ids'],'VoiceQueueId':_0x894b71[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(){return _0x2c5004;});}})[_0xf492('0x24')](respondWithStatusCode(_0x444868,null))[_0xf492('0x4a')](handleError(_0x444868,null));};exports[_0xf492('0xad')]=function(_0x16cb4c,_0x4d6c7c,_0xb8bc4a){var _0x40927a={};var _0x204668={};var _0x273138;var _0x2a5792;return db['VoiceQueue'][_0xf492('0x5d')]({'where':{'id':_0x16cb4c[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x4d6c7c,null))[_0xf492('0x24')](function(_0x396eb0){if(_0x396eb0){_0x273138=_0x396eb0;_0x204668[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x95')][_0xf492('0x36')]);_0x204668['query']=_[_0xf492('0x3a')](_0x16cb4c['query']);_0x204668[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x204668[_0xf492('0x38')],_0x204668['query']);_0x40927a[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x204668[_0xf492('0x38')],qs['fields'](_0x16cb4c[_0xf492('0x39')][_0xf492('0x4c')]));_0x40927a['attributes']=_0x40927a['attributes'][_0xf492('0x3e')]?_0x40927a[_0xf492('0x3d')]:_0x204668[_0xf492('0x38')];_0x40927a[_0xf492('0x40')]=qs['sort'](_0x16cb4c[_0xf492('0x39')][_0xf492('0x41')]);_0x40927a['where']=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x16cb4c[_0xf492('0x39')],_0x204668[_0xf492('0x3b')]));if(_0x16cb4c['query'][_0xf492('0x46')]){_0x40927a[_0xf492('0x42')]=_[_0xf492('0x44')](_0x40927a['where'],{'$or':_['map'](_0x40927a['attributes'],function(_0x5e2759){var _0x4c58ae={};_0x4c58ae[_0x5e2759]={'$like':'%'+_0x16cb4c[_0xf492('0x39')]['filter']+'%'};return _0x4c58ae;})});}_0x40927a=_[_0xf492('0x44')]({},_0x40927a,_0x16cb4c['options']);return _0x273138['getBlackLists'](_0x40927a);}})['then'](function(_0x41573f){if(_0x41573f){_0x2a5792=_0x41573f[_0xf492('0x3e')];if(!_0x16cb4c[_0xf492('0x39')][_0xf492('0x3f')]('nolimit')){_0x40927a[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x16cb4c[_0xf492('0x39')][_0xf492('0x1e')]);_0x40927a[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x16cb4c[_0xf492('0x39')]['offset']);}return _0x273138[_0xf492('0xad')](_0x40927a);}})[_0xf492('0x24')](function(_0x5d83a1){if(_0x5d83a1){return _0x5d83a1?{'count':_0x2a5792,'rows':_0x5d83a1}:null;}})[_0xf492('0x24')](respondWithResult(_0x4d6c7c,null))[_0xf492('0x4a')](handleError(_0x4d6c7c,null));};exports['addBlackLists']=function(_0x369452,_0x499efc,_0x1be39c){var _0x3a99e9,_0xa04b18;return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x369452[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x499efc,null))[_0xf492('0x24')](function(_0x4b09f2){if(_0x4b09f2){_0xa04b18=_0x4b09f2;return _0x4b09f2[_0xf492('0xae')](_0x369452[_0xf492('0x5a')][_0xf492('0x86')],_['omit'](_0x369452['body'],['ids','id'])||{});}return null;})['spread'](function(_0x402bdc){var _0x2daeba;_0x3a99e9=_0x402bdc||[];var _0x5a7441=[];if(_0x402bdc){for(var _0x43dd7d=0x0;_0x43dd7d<_0x402bdc[_0xf492('0x3e')];_0x43dd7d+=0x1){var _0x294806=_0x402bdc[_0x43dd7d][_0xf492('0x50')]({'plain':!![]});_0x2daeba=squel['insert']()[_0xf492('0x9a')]('cm_hopper_black')[_0xf492('0x9c')]([_0xf492('0x9d'),_0xf492('0x9e'),_0xf492('0x9f'),_0xf492('0x60'),_0xf492('0x58'),'updatedAt'],squel[_0xf492('0x79')]()['field']('phone',_0xf492('0x9d'))[_0xf492('0x7a')]('id',_0xf492('0x9e'))['field'](_0x294806[_0xf492('0xa5')][_0xf492('0x80')](),_0xf492('0x9f'))[_0xf492('0x7a')](_0x369452[_0xf492('0x4b')]['id']['toString'](),_0xf492('0x60'))[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x58'))[_0xf492('0x7a')](_0xf492('0xa0'),'updatedAt')[_0xf492('0xa2')](_0xf492('0xa3'))[_0xf492('0x42')](_0xf492('0xa4'))[_0xf492('0x42')](_0xf492('0xaf'),_0x294806['CmListId'][_0xf492('0x80')]())[_0xf492('0x42')](_0xf492('0xa6')))[_0xf492('0x80')]();_0x5a7441[_0xf492('0x8f')](db[_0xf492('0x72')]['query'](_0x2daeba));}return BPromise['all'](_0x5a7441);}})[_0xf492('0x24')](function(){return _0x3a99e9;})[_0xf492('0x24')](respondWithResult(_0x499efc,null))[_0xf492('0x4a')](handleError(_0x499efc,null));};exports[_0xf492('0xb0')]=function(_0x3ac2ba,_0x58a381,_0x356a3c){return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x3ac2ba[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58a381,null))[_0xf492('0x24')](function(_0x1608e4){if(_0x1608e4){return _0x1608e4[_0xf492('0xb0')](_0x3ac2ba[_0xf492('0x39')]['ids']);}})[_0xf492('0x24')](function(_0x4208a1){if(_0x4208a1){return db[_0xf492('0x67')][_0xf492('0x25')]({'where':{'ListId':_0x3ac2ba[_0xf492('0x39')]['ids'],'VoiceQueueId':_0x3ac2ba[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(){return _0x4208a1;});}})['then'](respondWithStatusCode(_0x58a381,null))[_0xf492('0x4a')](handleError(_0x58a381,null));};
\ No newline at end of file
+var _0xfd20=['autoAssociation','clone','merge','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','CmHopperHistory','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','transaction','removeAgents','userVoiceQueue:remove','addAgents','omit','ids','spread','online','isEmpty','isNil','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ListId','scheduledAt','ContactId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','all','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','destroy','error','stack','send','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','options','VoiceQueue','includeAll','include','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd20,0x66));var _0x0fd2=function(_0x268509,_0x196d93){_0x268509=_0x268509-0x0;var _0x5de441=_0xfd20[_0x268509];return _0x5de441;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fd2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fd2('0x1'));var moment=require(_0x0fd2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0fd2('0x3'));var util=require('util');var path=require(_0x0fd2('0x4'));var sox=require(_0x0fd2('0x5'));var csv=require(_0x0fd2('0x6'));var ejs=require(_0x0fd2('0x7'));var fs=require('fs');var fs_extra=require(_0x0fd2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0fd2('0x9'));var jsforce=require(_0x0fd2('0xa'));var deskjs=require(_0x0fd2('0xb'));var toCsv=require(_0x0fd2('0x6'));var querystring=require(_0x0fd2('0xc'));var Papa=require(_0x0fd2('0xd'));var Redis=require(_0x0fd2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0fd2('0xf'));var as=require(_0x0fd2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fd2('0x11'))('api');var utils=require(_0x0fd2('0x12'));var config=require(_0x0fd2('0x13'));var licenseUtil=require(_0x0fd2('0x14'));var db=require(_0x0fd2('0x15'))['db'];config[_0x0fd2('0x16')]=_[_0x0fd2('0x17')](config[_0x0fd2('0x16')],{'host':_0x0fd2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0fd2('0x19'))[_0x0fd2('0x1a')](socket);function respondWithStatusCode(_0x21dcc5,_0x28dd2b){_0x28dd2b=_0x28dd2b||0xcc;return function(_0x52ab36){if(_0x52ab36){return _0x21dcc5[_0x0fd2('0x1b')](_0x28dd2b);}return _0x21dcc5['status'](_0x28dd2b)['end']();};}function respondWithResult(_0x2b6254,_0x50eedc){_0x50eedc=_0x50eedc||0xc8;return function(_0x42f44c){if(_0x42f44c){return _0x2b6254['status'](_0x50eedc)[_0x0fd2('0x1c')](_0x42f44c);}};}function respondWithFilteredResult(_0x4cd2bf,_0x267dfb){return function(_0x15c9de){if(_0x15c9de){var _0x53787a=typeof _0x267dfb[_0x0fd2('0x1d')]==='undefined'&&typeof _0x267dfb[_0x0fd2('0x1e')]===_0x0fd2('0x1f');var _0x3fb07e=_0x15c9de[_0x0fd2('0x20')];var _0x2977ef=_0x53787a?0x0:_0x267dfb[_0x0fd2('0x1d')];var _0x3ea260=_0x53787a?_0x15c9de[_0x0fd2('0x20')]:_0x267dfb[_0x0fd2('0x1d')]+_0x267dfb[_0x0fd2('0x1e')];var _0x5c50ad;if(_0x3ea260>=_0x3fb07e){_0x3ea260=_0x3fb07e;_0x5c50ad=0xc8;}else{_0x5c50ad=0xce;}_0x4cd2bf['status'](_0x5c50ad);return _0x4cd2bf['set'](_0x0fd2('0x21'),_0x2977ef+'-'+_0x3ea260+'/'+_0x3fb07e)[_0x0fd2('0x1c')](_0x15c9de);}return null;};}function patchUpdates(_0x53ab17){return function(_0x48586c){try{jsonpatch[_0x0fd2('0x22')](_0x48586c,_0x53ab17,!![]);}catch(_0x25563c){return BPromise[_0x0fd2('0x23')](_0x25563c);}return _0x48586c[_0x0fd2('0x24')]();};}function saveUpdates(_0x25cdd2,_0x5d15ed){return function(_0x233b01){if(_0x233b01){return _0x233b01[_0x0fd2('0x25')](_0x25cdd2)[_0x0fd2('0x26')](function(_0x54cce1){return _0x54cce1;});}return null;};}function removeEntity(_0x4c77a8,_0x11bb10){return function(_0x2a45e1){if(_0x2a45e1){return _0x2a45e1['destroy']()[_0x0fd2('0x26')](function(){var _0x429fef=_0x2a45e1[_0x0fd2('0x27')]({'plain':!![]});var _0x1defb4=[{'name':_0x0fd2('0x28'),'value':_0x0fd2('0x29'),'ignore':![]},{'name':_0x0fd2('0x2a'),'value':_0x0fd2('0x2b'),'ignore':![]}];var _0x5b32df=_(_0x1defb4)[_0x0fd2('0x2c')](_0x0fd2('0x2d'))[_0x0fd2('0x2e')](_0x0fd2('0x2f'))[_0x0fd2('0x2f')]();if(_['includes'](_0x5b32df,_0x429fef[_0x0fd2('0x30')])){return;}var _0x33335b=_[_0x0fd2('0x31')](_0x1defb4,[_0x0fd2('0x2f'),_0x429fef[_0x0fd2('0x30')]])[_0x0fd2('0x32')];return db[_0x0fd2('0x33')][_0x0fd2('0x34')]({'where':{'type':_0x33335b,'resourceId':_0x429fef['id']}})['then'](function(){return _0x2a45e1;});})[_0x0fd2('0x26')](function(){_0x4c77a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1828cc,_0x553715){return function(_0x2faac3){if(!_0x2faac3){_0x1828cc['sendStatus'](0x194);}return _0x2faac3;};}function handleError(_0x244095,_0x53f585){_0x53f585=_0x53f585||0x1f4;return function(_0x5caeff){logger[_0x0fd2('0x35')](_0x5caeff[_0x0fd2('0x36')]);if(_0x5caeff[_0x0fd2('0x32')]){delete _0x5caeff['name'];}_0x244095['status'](_0x53f585)[_0x0fd2('0x37')](_0x5caeff);};}exports['index']=function(_0x11917f,_0x6b6cb4){var _0x803113={},_0x44167a={},_0x12f9ad={'count':0x0,'rows':[]};var _0x2975fb=_[_0x0fd2('0x2e')](db['VoiceQueue'][_0x0fd2('0x38')],function(_0x2ccfbe){return{'name':_0x2ccfbe['fieldName'],'type':_0x2ccfbe['type'][_0x0fd2('0x39')]};});_0x44167a['model']=_['map'](_0x2975fb,_0x0fd2('0x32'));_0x44167a[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x11917f[_0x0fd2('0x3a')]);_0x44167a[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0x44167a[_0x0fd2('0x3e')],_0x44167a[_0x0fd2('0x3a')]);_0x803113[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x44167a[_0x0fd2('0x3e')],qs[_0x0fd2('0x40')](_0x11917f[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x803113[_0x0fd2('0x3f')]=_0x803113[_0x0fd2('0x3f')]['length']?_0x803113[_0x0fd2('0x3f')]:_0x44167a[_0x0fd2('0x3e')];if(!_0x11917f[_0x0fd2('0x3a')][_0x0fd2('0x41')]('nolimit')){_0x803113[_0x0fd2('0x1e')]=qs['limit'](_0x11917f[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x803113['offset']=qs[_0x0fd2('0x1d')](_0x11917f[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}_0x803113[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x11917f[_0x0fd2('0x3a')]['sort']);_0x803113[_0x0fd2('0x44')]=qs[_0x0fd2('0x3c')](_[_0x0fd2('0x45')](_0x11917f[_0x0fd2('0x3a')],_0x44167a[_0x0fd2('0x3c')]),_0x2975fb);if(_0x11917f['query'][_0x0fd2('0x2c')]){_0x803113[_0x0fd2('0x44')]=_['merge'](_0x803113[_0x0fd2('0x44')],{'$or':_[_0x0fd2('0x2e')](_0x2975fb,function(_0x400b49){if(_0x400b49[_0x0fd2('0x30')]!==_0x0fd2('0x46')){var _0x22c89d={};_0x22c89d[_0x400b49[_0x0fd2('0x32')]]={'$like':'%'+_0x11917f[_0x0fd2('0x3a')]['filter']+'%'};return _0x22c89d;}})});}_0x803113=_['merge']({},_0x803113,_0x11917f[_0x0fd2('0x47')]);var _0x19d9e2={'where':_0x803113['where']};return db[_0x0fd2('0x48')]['count'](_0x19d9e2)[_0x0fd2('0x26')](function(_0x241570){_0x12f9ad[_0x0fd2('0x20')]=_0x241570;if(_0x11917f[_0x0fd2('0x3a')][_0x0fd2('0x49')]){_0x803113[_0x0fd2('0x4a')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x803113);})[_0x0fd2('0x26')](function(_0x5065dc){_0x12f9ad[_0x0fd2('0x4b')]=_0x5065dc;return _0x12f9ad;})[_0x0fd2('0x26')](respondWithFilteredResult(_0x6b6cb4,_0x803113))[_0x0fd2('0x4c')](handleError(_0x6b6cb4,null));};exports[_0x0fd2('0x4d')]=function(_0x2f47f9,_0x500d1a){var _0x1bbe6a={'raw':![],'where':{'id':_0x2f47f9[_0x0fd2('0x4e')]['id']}},_0x49f5c2={};_0x49f5c2[_0x0fd2('0x3e')]=_['keys'](db[_0x0fd2('0x48')]['rawAttributes']);_0x49f5c2['query']=_[_0x0fd2('0x3b')](_0x2f47f9[_0x0fd2('0x3a')]);_0x49f5c2[_0x0fd2('0x3c')]=_['intersection'](_0x49f5c2[_0x0fd2('0x3e')],_0x49f5c2[_0x0fd2('0x3a')]);_0x1bbe6a[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x49f5c2['model'],qs[_0x0fd2('0x40')](_0x2f47f9[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x1bbe6a[_0x0fd2('0x3f')]=_0x1bbe6a[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x1bbe6a[_0x0fd2('0x3f')]:_0x49f5c2[_0x0fd2('0x3e')];if(_0x2f47f9[_0x0fd2('0x3a')][_0x0fd2('0x49')]){_0x1bbe6a[_0x0fd2('0x4a')]=[{'all':!![]}];}_0x1bbe6a=_['merge']({},_0x1bbe6a,_0x2f47f9[_0x0fd2('0x47')]);return db[_0x0fd2('0x48')]['find'](_0x1bbe6a)[_0x0fd2('0x26')](handleEntityNotFound(_0x500d1a,null))['then'](respondWithResult(_0x500d1a,null))[_0x0fd2('0x4c')](handleError(_0x500d1a,null));};exports[_0x0fd2('0x50')]=function(_0xe2cd72,_0xed36b3){return db[_0x0fd2('0x48')]['create'](_0xe2cd72[_0x0fd2('0x51')],{})[_0x0fd2('0x26')](function(_0x101509){var _0x4c1020=_0xe2cd72['user'][_0x0fd2('0x27')]({'plain':!![]});if(!_0x4c1020)throw new Error(_0x0fd2('0x52'));if(_0x4c1020[_0x0fd2('0x53')]===_0x0fd2('0x54')){var _0xec149c=_0x101509[_0x0fd2('0x27')]({'plain':!![]});var _0x4a9fe1=[{'name':_0x0fd2('0x28'),'value':_0x0fd2('0x29')},{'name':_0x0fd2('0x2a'),'value':_0x0fd2('0x2b')}];var _0x379524=_[_0x0fd2('0x31')](_0x4a9fe1,[_0x0fd2('0x2f'),_0xec149c[_0x0fd2('0x30')]])[_0x0fd2('0x32')];return db[_0x0fd2('0x55')][_0x0fd2('0x31')]({'where':{'name':_0x379524,'userProfileId':_0x4c1020[_0x0fd2('0x56')]},'raw':!![]})[_0x0fd2('0x26')](function(_0x50929f){if(_0x50929f&&_0x50929f[_0x0fd2('0x57')]===0x0){return db[_0x0fd2('0x33')]['create']({'name':_0xec149c[_0x0fd2('0x32')],'resourceId':_0xec149c['id'],'type':_0x50929f[_0x0fd2('0x32')],'sectionId':_0x50929f['id']},{})[_0x0fd2('0x26')](function(){return _0x101509;});}else{return _0x101509;}})[_0x0fd2('0x4c')](function(_0x5674b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5674b3);throw _0x5674b3;});}return _0x101509;})[_0x0fd2('0x26')](respondWithResult(_0xed36b3,0xc9))[_0x0fd2('0x4c')](handleError(_0xed36b3,null));};exports[_0x0fd2('0x58')]=function(_0x27754d,_0x41dd02){var _0x1ba67f={'where':{'id':_0x27754d[_0x0fd2('0x4e')]['id']}},_0x47343a={};_0x47343a[_0x0fd2('0x3e')]=_[_0x0fd2('0x3b')](db['VoiceQueue']['rawAttributes']);_0x1ba67f['attributes']=_['intersection'](_0x47343a['model'],qs[_0x0fd2('0x40')](_0x27754d['query'][_0x0fd2('0x40')]));_0x1ba67f['attributes']=_0x1ba67f[_0x0fd2('0x3f')]['length']?_0x1ba67f[_0x0fd2('0x3f')]:_0x47343a[_0x0fd2('0x3e')];if(_0x27754d[_0x0fd2('0x3a')]['includeAll']){_0x1ba67f['include']=[{'all':!![]}];}_0x1ba67f=_[_0x0fd2('0x59')]({},_0x1ba67f,_0x27754d[_0x0fd2('0x47')]);return db[_0x0fd2('0x48')][_0x0fd2('0x31')](_0x1ba67f)[_0x0fd2('0x26')](handleEntityNotFound(_0x41dd02,null))[_0x0fd2('0x26')](function(_0x359ee2){if(_0x359ee2){var _0x44fd9d=_0x359ee2[_0x0fd2('0x27')]({'plain':!![]});_0x44fd9d=qs['omit'](_0x44fd9d,['id',_0x0fd2('0x5a'),_0x0fd2('0x5b')]);_0x27754d[_0x0fd2('0x51')]=_['omit'](_0x27754d[_0x0fd2('0x51')],['id','createdAt',_0x0fd2('0x5b')]);return db[_0x0fd2('0x48')][_0x0fd2('0x50')](_[_0x0fd2('0x59')](_0x44fd9d,_0x27754d[_0x0fd2('0x51')]),{'include':_0x27754d[_0x0fd2('0x3a')][_0x0fd2('0x49')]?[{'all':!![]}]:undefined})[_0x0fd2('0x26')](function(_0x53bb88){var _0x33530b=_0x27754d[_0x0fd2('0x54')]['get']({'plain':!![]});if(!_0x33530b)throw new Error(_0x0fd2('0x52'));if(_0x33530b[_0x0fd2('0x53')]===_0x0fd2('0x54')){var _0x58d2f1=_0x53bb88[_0x0fd2('0x27')]({'plain':!![]});var _0x43f751=[{'name':_0x0fd2('0x28'),'value':_0x0fd2('0x29')},{'name':_0x0fd2('0x2a'),'value':_0x0fd2('0x2b')}];var _0x1ed5db=_[_0x0fd2('0x31')](_0x43f751,[_0x0fd2('0x2f'),_0x58d2f1['type']])[_0x0fd2('0x32')];return db[_0x0fd2('0x55')][_0x0fd2('0x31')]({'where':{'name':_0x1ed5db,'userProfileId':_0x33530b['userProfileId']},'raw':!![]})[_0x0fd2('0x26')](function(_0x288212){if(_0x288212&&_0x288212[_0x0fd2('0x57')]===0x0){return db[_0x0fd2('0x33')][_0x0fd2('0x50')]({'name':_0x58d2f1['name'],'resourceId':_0x58d2f1['id'],'type':_0x288212['name'],'sectionId':_0x288212['id']},{})[_0x0fd2('0x26')](function(){return _0x53bb88;});}else{return _0x53bb88;}})[_0x0fd2('0x4c')](function(_0x39bd89){logger[_0x0fd2('0x35')](_0x0fd2('0x5c'),_0x39bd89);throw _0x39bd89;});}return _0x53bb88;});}})[_0x0fd2('0x26')](respondWithResult(_0x41dd02,0xc9))[_0x0fd2('0x4c')](handleError(_0x41dd02,null));};exports[_0x0fd2('0x25')]=function(_0x54aadc,_0x14f6fb){if(_0x54aadc[_0x0fd2('0x51')]['id']){delete _0x54aadc[_0x0fd2('0x51')]['id'];}return db[_0x0fd2('0x48')]['find']({'where':{'id':_0x54aadc[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x14f6fb,null))[_0x0fd2('0x26')](saveUpdates(_0x54aadc[_0x0fd2('0x51')],null))[_0x0fd2('0x26')](respondWithResult(_0x14f6fb,null))[_0x0fd2('0x4c')](handleError(_0x14f6fb,null));};exports[_0x0fd2('0x34')]=function(_0x16d33b,_0x404af9){return db['VoiceQueue'][_0x0fd2('0x31')]({'where':{'id':_0x16d33b[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x404af9,null))[_0x0fd2('0x26')](removeEntity(_0x404af9,null))[_0x0fd2('0x4c')](handleError(_0x404af9,null));};exports[_0x0fd2('0x5d')]=function(_0x294e12,_0x3fb02f,_0x5e91c0){var _0x6660e4={'raw':![],'where':{}};var _0x3b4bfc={};var _0x32ee12={'count':0x0,'rows':[]};return db[_0x0fd2('0x48')][_0x0fd2('0x5e')]({'where':{'id':_0x294e12['params']['id']}})['then'](handleEntityNotFound(_0x3fb02f,null))[_0x0fd2('0x26')](function(_0x158899){if(_0x158899){_0x3b4bfc[_0x0fd2('0x3e')]=_['keys'](db[_0x0fd2('0x5f')][_0x0fd2('0x38')]);_0x3b4bfc[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x294e12[_0x0fd2('0x3a')]);_0x3b4bfc[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0x3b4bfc[_0x0fd2('0x3e')],_0x3b4bfc[_0x0fd2('0x3a')]);_0x6660e4[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x3b4bfc[_0x0fd2('0x3e')],qs[_0x0fd2('0x40')](_0x294e12[_0x0fd2('0x3a')]['fields']));_0x6660e4[_0x0fd2('0x3f')]=_0x6660e4[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x6660e4['attributes']:_0x3b4bfc[_0x0fd2('0x3e')];if(!_0x294e12[_0x0fd2('0x3a')][_0x0fd2('0x41')](_0x0fd2('0x60'))){_0x6660e4[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x294e12[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x6660e4[_0x0fd2('0x1d')]=qs['offset'](_0x294e12['query']['offset']);}_0x6660e4[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x294e12[_0x0fd2('0x3a')][_0x0fd2('0x43')]);_0x6660e4[_0x0fd2('0x44')]=qs[_0x0fd2('0x3c')](_['pick'](_0x294e12[_0x0fd2('0x3a')],_0x3b4bfc['filters']));_0x6660e4[_0x0fd2('0x44')][_0x0fd2('0x61')]=_0x158899['id'];if(_0x294e12['query'][_0x0fd2('0x2c')]){_0x6660e4[_0x0fd2('0x44')]=_[_0x0fd2('0x59')](_0x6660e4['where'],{'$or':_[_0x0fd2('0x2e')](_0x6660e4[_0x0fd2('0x3f')],function(_0x5ee8bc){var _0x5659f6={};_0x5659f6[_0x5ee8bc]={'$like':'%'+_0x294e12[_0x0fd2('0x3a')][_0x0fd2('0x2c')]+'%'};return _0x5659f6;})});}_0x6660e4=_[_0x0fd2('0x59')]({},_0x6660e4,_0x294e12[_0x0fd2('0x47')]);return db[_0x0fd2('0x5f')]['count']({'where':_0x6660e4[_0x0fd2('0x44')]})[_0x0fd2('0x26')](function(_0x53a49c){_0x32ee12[_0x0fd2('0x20')]=_0x53a49c;if(_0x294e12[_0x0fd2('0x3a')][_0x0fd2('0x49')]){_0x6660e4[_0x0fd2('0x4a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x6660e4);})[_0x0fd2('0x26')](function(_0x524528){_0x32ee12[_0x0fd2('0x4b')]=_0x524528;return _0x32ee12;});}})[_0x0fd2('0x26')](respondWithFilteredResult(_0x3fb02f,_0x6660e4))['catch'](handleError(_0x3fb02f,null));};exports['getHopperHistories']=function(_0x405814,_0x21d371,_0x2043f5){var _0x552dcd={'raw':!![],'where':{}};var _0x22c88a={};var _0x3883de={'count':0x0,'rows':[]};return db[_0x0fd2('0x48')]['findOne']({'where':{'id':_0x405814[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x21d371,null))['then'](function(_0x5cc6fe){if(_0x5cc6fe){_0x22c88a[_0x0fd2('0x3e')]=_[_0x0fd2('0x3b')](db[_0x0fd2('0x62')][_0x0fd2('0x38')]);_0x22c88a[_0x0fd2('0x3a')]=_['keys'](_0x405814[_0x0fd2('0x3a')]);_0x22c88a[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0x22c88a[_0x0fd2('0x3e')],_0x22c88a[_0x0fd2('0x3a')]);_0x552dcd[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x22c88a[_0x0fd2('0x3e')],qs['fields'](_0x405814['query'][_0x0fd2('0x40')]));_0x552dcd[_0x0fd2('0x3f')]=_0x552dcd[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x552dcd['attributes']:_0x22c88a[_0x0fd2('0x3e')];if(!_0x405814[_0x0fd2('0x3a')]['hasOwnProperty']('nolimit')){_0x552dcd['limit']=qs[_0x0fd2('0x1e')](_0x405814[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x552dcd[_0x0fd2('0x1d')]=qs[_0x0fd2('0x1d')](_0x405814[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}_0x552dcd[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x405814[_0x0fd2('0x3a')]['sort']);_0x552dcd[_0x0fd2('0x44')]=qs[_0x0fd2('0x3c')](_[_0x0fd2('0x45')](_0x405814[_0x0fd2('0x3a')],_0x22c88a[_0x0fd2('0x3c')]));_0x552dcd[_0x0fd2('0x44')][_0x0fd2('0x61')]=_0x5cc6fe['id'];if(_0x405814['query'][_0x0fd2('0x2c')]){_0x552dcd[_0x0fd2('0x44')]=_[_0x0fd2('0x59')](_0x552dcd[_0x0fd2('0x44')],{'$or':_[_0x0fd2('0x2e')](_0x552dcd[_0x0fd2('0x3f')],function(_0x203979){var _0x4141de={};_0x4141de[_0x203979]={'$like':'%'+_0x405814['query'][_0x0fd2('0x2c')]+'%'};return _0x4141de;})});}_0x552dcd=_[_0x0fd2('0x59')]({},_0x552dcd,_0x405814[_0x0fd2('0x47')]);return db[_0x0fd2('0x62')][_0x0fd2('0x20')]({'where':_0x552dcd[_0x0fd2('0x44')]})['then'](function(_0x146f01){_0x3883de[_0x0fd2('0x20')]=_0x146f01;if(_0x405814['query'][_0x0fd2('0x49')]){_0x552dcd[_0x0fd2('0x4a')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x552dcd);})[_0x0fd2('0x26')](function(_0x27e6ac){_0x3883de[_0x0fd2('0x4b')]=_0x27e6ac;return _0x3883de;});}})[_0x0fd2('0x26')](respondWithFilteredResult(_0x21d371,_0x552dcd))['catch'](handleError(_0x21d371,null));};exports['getHopperFinals']=function(_0x12e136,_0x46d4f2,_0x35ec32){var _0x5b88fc={'raw':!![],'where':{}};var _0x2fa756={};var _0x2acc75={'count':0x0,'rows':[]};return db[_0x0fd2('0x48')][_0x0fd2('0x5e')]({'where':{'id':_0x12e136[_0x0fd2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x46d4f2,null))[_0x0fd2('0x26')](function(_0x2f5c3b){if(_0x2f5c3b){_0x2fa756['model']=_[_0x0fd2('0x3b')](db[_0x0fd2('0x63')]['rawAttributes']);_0x2fa756[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x12e136[_0x0fd2('0x3a')]);_0x2fa756[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0x2fa756[_0x0fd2('0x3e')],_0x2fa756[_0x0fd2('0x3a')]);_0x5b88fc[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x2fa756[_0x0fd2('0x3e')],qs['fields'](_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x5b88fc[_0x0fd2('0x3f')]=_0x5b88fc[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x5b88fc[_0x0fd2('0x3f')]:_0x2fa756[_0x0fd2('0x3e')];if(!_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x41')]('nolimit')){_0x5b88fc[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x5b88fc['offset']=qs[_0x0fd2('0x1d')](_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}_0x5b88fc['order']=qs['sort'](_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x43')]);_0x5b88fc[_0x0fd2('0x44')]=qs['filters'](_[_0x0fd2('0x45')](_0x12e136[_0x0fd2('0x3a')],_0x2fa756['filters']));_0x5b88fc[_0x0fd2('0x44')][_0x0fd2('0x61')]=_0x2f5c3b['id'];if(_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x2c')]){_0x5b88fc[_0x0fd2('0x44')]=_['merge'](_0x5b88fc[_0x0fd2('0x44')],{'$or':_[_0x0fd2('0x2e')](_0x5b88fc[_0x0fd2('0x3f')],function(_0x1260db){var _0x3dfe33={};_0x3dfe33[_0x1260db]={'$like':'%'+_0x12e136[_0x0fd2('0x3a')][_0x0fd2('0x2c')]+'%'};return _0x3dfe33;})});}_0x5b88fc=_['merge']({},_0x5b88fc,_0x12e136[_0x0fd2('0x47')]);return db[_0x0fd2('0x63')]['count']({'where':_0x5b88fc['where']})['then'](function(_0x3ab8c6){_0x2acc75['count']=_0x3ab8c6;if(_0x12e136['query'][_0x0fd2('0x49')]){_0x5b88fc['include']=[{'all':!![]}];}return db[_0x0fd2('0x63')][_0x0fd2('0x64')](_0x5b88fc);})['then'](function(_0x5d0ca9){_0x2acc75['rows']=_0x5d0ca9;return _0x2acc75;});}})['then'](respondWithFilteredResult(_0x46d4f2,_0x5b88fc))['catch'](handleError(_0x46d4f2,null));};exports[_0x0fd2('0x65')]=function(_0x244fd2,_0x50502e,_0x528fa4){var _0x453b8d={'raw':!![],'where':{}};var _0x1771ce={};var _0xf445a8={'count':0x0,'rows':[]};return db[_0x0fd2('0x48')][_0x0fd2('0x5e')]({'where':{'id':_0x244fd2[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x50502e,null))[_0x0fd2('0x26')](function(_0x2f56dd){if(_0x2f56dd){_0x1771ce[_0x0fd2('0x3e')]=_[_0x0fd2('0x3b')](db['CmHopperBlack'][_0x0fd2('0x38')]);_0x1771ce['query']=_[_0x0fd2('0x3b')](_0x244fd2[_0x0fd2('0x3a')]);_0x1771ce[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0x1771ce['model'],_0x1771ce[_0x0fd2('0x3a')]);_0x453b8d[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x1771ce['model'],qs[_0x0fd2('0x40')](_0x244fd2[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x453b8d[_0x0fd2('0x3f')]=_0x453b8d[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x453b8d[_0x0fd2('0x3f')]:_0x1771ce[_0x0fd2('0x3e')];if(!_0x244fd2['query'][_0x0fd2('0x41')]('nolimit')){_0x453b8d[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x244fd2['query']['limit']);_0x453b8d[_0x0fd2('0x1d')]=qs[_0x0fd2('0x1d')](_0x244fd2[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}_0x453b8d[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x244fd2['query'][_0x0fd2('0x43')]);_0x453b8d[_0x0fd2('0x44')]=qs['filters'](_['pick'](_0x244fd2[_0x0fd2('0x3a')],_0x1771ce['filters']));_0x453b8d[_0x0fd2('0x44')][_0x0fd2('0x61')]=_0x2f56dd['id'];if(_0x244fd2[_0x0fd2('0x3a')][_0x0fd2('0x2c')]){_0x453b8d['where']=_[_0x0fd2('0x59')](_0x453b8d['where'],{'$or':_['map'](_0x453b8d[_0x0fd2('0x3f')],function(_0x1b7818){var _0x41e57e={};_0x41e57e[_0x1b7818]={'$like':'%'+_0x244fd2[_0x0fd2('0x3a')][_0x0fd2('0x2c')]+'%'};return _0x41e57e;})});}_0x453b8d=_['merge']({},_0x453b8d,_0x244fd2['options']);return db['CmHopperBlack']['count']({'where':_0x453b8d[_0x0fd2('0x44')]})['then'](function(_0x36b164){_0xf445a8[_0x0fd2('0x20')]=_0x36b164;if(_0x244fd2[_0x0fd2('0x3a')]['includeAll']){_0x453b8d[_0x0fd2('0x4a')]=[{'all':!![]}];}return db[_0x0fd2('0x66')][_0x0fd2('0x64')](_0x453b8d);})['then'](function(_0x1c0392){_0xf445a8[_0x0fd2('0x4b')]=_0x1c0392;return _0xf445a8;});}})[_0x0fd2('0x26')](respondWithFilteredResult(_0x50502e,_0x453b8d))[_0x0fd2('0x4c')](handleError(_0x50502e,null));};exports[_0x0fd2('0x67')]=function(_0x2dd7bd,_0x2fb19f,_0x1361ff){var _0x2311d8={};var _0x2fd8f8={};var _0xcc05d5;var _0x19f8c0;return db[_0x0fd2('0x48')][_0x0fd2('0x5e')]({'where':{'id':_0x2dd7bd[_0x0fd2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2fb19f,null))[_0x0fd2('0x26')](function(_0x4463eb){if(_0x4463eb){_0xcc05d5=_0x4463eb;_0x2fd8f8[_0x0fd2('0x3e')]=_['keys'](db[_0x0fd2('0x68')][_0x0fd2('0x38')]);_0x2fd8f8[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x2dd7bd[_0x0fd2('0x3a')]);_0x2fd8f8[_0x0fd2('0x3c')]=_['intersection'](_0x2fd8f8[_0x0fd2('0x3e')],_0x2fd8f8[_0x0fd2('0x3a')]);_0x2311d8[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x2fd8f8[_0x0fd2('0x3e')],qs[_0x0fd2('0x40')](_0x2dd7bd[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x2311d8[_0x0fd2('0x3f')]=_0x2311d8[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x2311d8[_0x0fd2('0x3f')]:_0x2fd8f8[_0x0fd2('0x3e')];_0x2311d8[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x2dd7bd[_0x0fd2('0x3a')]['sort']);_0x2311d8[_0x0fd2('0x44')]=qs[_0x0fd2('0x3c')](_[_0x0fd2('0x45')](_0x2dd7bd[_0x0fd2('0x3a')],_0x2fd8f8[_0x0fd2('0x3c')]));if(_0x2dd7bd[_0x0fd2('0x3a')][_0x0fd2('0x2c')]){_0x2311d8['where']=_[_0x0fd2('0x59')](_0x2311d8[_0x0fd2('0x44')],{'$or':_['map'](_0x2311d8[_0x0fd2('0x3f')],function(_0x425333){var _0x7e2917={};_0x7e2917[_0x425333]={'$like':'%'+_0x2dd7bd[_0x0fd2('0x3a')]['filter']+'%'};return _0x7e2917;})});}_0x2311d8=_['merge']({},_0x2311d8,_0x2dd7bd[_0x0fd2('0x47')]);return _0xcc05d5['getTeams'](_0x2311d8);}})['then'](function(_0x11db90){if(_0x11db90){_0x19f8c0=_0x11db90['length'];if(!_0x2dd7bd[_0x0fd2('0x3a')]['hasOwnProperty'](_0x0fd2('0x60'))){_0x2311d8[_0x0fd2('0x1e')]=qs['limit'](_0x2dd7bd[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x2311d8[_0x0fd2('0x1d')]=qs['offset'](_0x2dd7bd[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}return _0xcc05d5['getTeams'](_0x2311d8);}})[_0x0fd2('0x26')](function(_0x293098){if(_0x293098){return _0x293098?{'count':_0x19f8c0,'rows':_0x293098}:null;}})[_0x0fd2('0x26')](respondWithResult(_0x2fb19f,null))[_0x0fd2('0x4c')](handleError(_0x2fb19f,null));};exports[_0x0fd2('0x69')]=function(_0x23db78,_0x2d97de,_0x5cb489){var _0x5a3809=_0x23db78[_0x0fd2('0x51')]['teams'];var _0x549306=_[_0x0fd2('0x2e')](_0x5a3809,'id');return db[_0x0fd2('0x68')][_0x0fd2('0x64')]({'where':{'id':_0x549306},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0fd2('0x6a'),'attributes':['id',_0x0fd2('0x32'),'online',_0x0fd2('0x6b'),_0x0fd2('0x6c')],'raw':!![]}]})[_0x0fd2('0x26')](function(_0x45eb44){if(_0x45eb44){var _0x254999=_[_0x0fd2('0x6d')](_0x45eb44,function(_0x3cc23a){var _0x17b6ee=_0x3cc23a[_0x0fd2('0x27')]({'plain':!![]});_0x17b6ee[_0x0fd2('0x6a')]['forEach'](function(_0x5d1bd1){_0x5d1bd1['penalty']=_[_0x0fd2('0x31')](_0x5a3809,{'id':_0x17b6ee['id']})[_0x0fd2('0x6e')];});return _0x17b6ee[_0x0fd2('0x6a')];});return db['VoiceQueue'][_0x0fd2('0x31')]({'where':{'id':_0x23db78[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](function(_0x30c8aa){return db[_0x0fd2('0x6f')]['transaction'](function(_0x8aa97d){return _0x30c8aa[_0x0fd2('0x69')](_0x549306,{'transaction':_0x8aa97d})[_0x0fd2('0x26')](function(){return BPromise[_0x0fd2('0x70')](_0x5a3809,function(_0x3ac89f){return db[_0x0fd2('0x71')][_0x0fd2('0x72')]({'TeamId':_0x3ac89f['id'],'VoiceQueueId':_0x23db78['params']['id'],'penalty':_0x3ac89f[_0x0fd2('0x6e')]},{'transaction':_0x8aa97d});});})[_0x0fd2('0x26')](function(){return BPromise['each'](_0x254999,function(_0x26b5b0){return db[_0x0fd2('0x73')]['findOrCreate']({'where':{'UserId':_0x26b5b0['id'],'VoiceQueueId':_0x23db78['params']['id']},'defaults':{'penalty':_0x26b5b0['penalty']},'transaction':_0x8aa97d});});})['then'](function(){return BPromise[_0x0fd2('0x70')](_[_0x0fd2('0x2c')](_0x254999,{'online':!![]}),function(_0x45f4be){return db[_0x0fd2('0x74')][_0x0fd2('0x72')]({'membername':_0x45f4be['name'],'UserId':_0x45f4be['id'],'queue_name':_0x30c8aa[_0x0fd2('0x32')],'VoiceQueueId':_0x30c8aa['id'],'interface':_['isNil'](_0x45f4be[_0x0fd2('0x6c')])?util[_0x0fd2('0x75')](_0x0fd2('0x76'),_0x45f4be[_0x0fd2('0x32')]):_0x45f4be['interface'],'paused':_0x45f4be['voicePause']||![],'penalty':_0x45f4be[_0x0fd2('0x6e')]},{'transaction':_0x8aa97d});});})[_0x0fd2('0x26')](function(){_0x254999[_0x0fd2('0x77')](function(_0x5592a5){socket[_0x0fd2('0x78')](_0x0fd2('0x79'),{'UserId':_0x5592a5['id'],'VoiceQueueId':_0x30c8aa['id']});});});});});}})[_0x0fd2('0x26')](respondWithStatusCode(_0x2d97de,null))[_0x0fd2('0x4c')](handleError(_0x2d97de,null));};exports[_0x0fd2('0x7a')]=function(_0x204295,_0x3acba7,_0x502625){return db[_0x0fd2('0x68')][_0x0fd2('0x64')]({'where':{'id':_0x204295[_0x0fd2('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0fd2('0x7b')],'as':_0x0fd2('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x0fd2('0x26')](handleEntityNotFound(_0x3acba7,null))[_0x0fd2('0x26')](function(_0x2eee6e){var _0x2f46f0=_[_0x0fd2('0x2e')](_0x2eee6e,'id');var _0x930fd8=[];var _0x42359e=[];var _0x4055f4=squel['select']();_0x4055f4[_0x0fd2('0x7c')]('tq.TeamId')[_0x0fd2('0x7d')]('team_has_voice_queues','tq')[_0x0fd2('0x7e')](_0x0fd2('0x7f'),'ut',_0x0fd2('0x80'))[_0x0fd2('0x44')](_0x0fd2('0x81'),_0x204295[_0x0fd2('0x4e')]['id']);for(var _0x24676f=0x0;_0x24676f<_0x2eee6e['length'];_0x24676f+=0x1){let _0x4102c4=_0x2eee6e[_0x24676f];for(var _0x3cab70=0x0;_0x3cab70<_0x4102c4[_0x0fd2('0x6a')][_0x0fd2('0x4f')];_0x3cab70+=0x1){let _0x4af57f=_0x4102c4[_0x0fd2('0x6a')][_0x3cab70];var _0x5f54bb=_0x4055f4['clone']();_0x5f54bb[_0x0fd2('0x44')](_0x0fd2('0x82'),_0x4af57f['id']);_0x42359e[_0x0fd2('0x83')](db[_0x0fd2('0x6f')][_0x0fd2('0x3a')](_0x5f54bb[_0x0fd2('0x84')](),{'type':db[_0x0fd2('0x6f')][_0x0fd2('0x85')]['SELECT']})[_0x0fd2('0x26')](function(_0x1b8a6b){if(_0x1b8a6b[_0x0fd2('0x4f')]===0x1){return _0x4af57f['id'];}else{var _0x55bf30=_[_0x0fd2('0x86')](_['map'](_0x1b8a6b,_0x0fd2('0x87')),function(_0x329f21){return _[_0x0fd2('0x88')](_0x2f46f0,_0x329f21);});if(_0x55bf30){return _0x4af57f['id'];}}}));}}return BPromise['all'](_0x42359e)[_0x0fd2('0x26')](function(_0xfbbf6a){_0x930fd8=_(_0x930fd8)[_0x0fd2('0x89')](_0xfbbf6a)[_0x0fd2('0x8a')]()['value']();return db['VoiceQueue'][_0x0fd2('0x31')]({'where':{'id':_0x204295[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](function(_0x1ea889){return db[_0x0fd2('0x6f')][_0x0fd2('0x8b')](function(_0x4ef946){return _0x1ea889[_0x0fd2('0x7a')](_0x204295[_0x0fd2('0x3a')]['ids'],{'transaction':_0x4ef946})[_0x0fd2('0x26')](function(){if(!_['isEmpty'](_0x930fd8)){return _0x1ea889[_0x0fd2('0x8c')](_0x930fd8,{'transaction':_0x4ef946})[_0x0fd2('0x26')](function(){return db[_0x0fd2('0x74')][_0x0fd2('0x34')]({'where':{'VoiceQueueId':_0x204295[_0x0fd2('0x4e')]['id'],'UserId':_0x930fd8},'transaction':_0x4ef946});});}})['then'](function(){_0x930fd8['forEach'](function(_0x337a61){socket['emit'](_0x0fd2('0x8d'),{'UserId':_0x337a61,'VoiceQueueId':_0x1ea889['id']});});});});});});})[_0x0fd2('0x26')](respondWithStatusCode(_0x3acba7,null))[_0x0fd2('0x4c')](handleError(_0x3acba7,null));};exports[_0x0fd2('0x8e')]=function(_0x2b36ba,_0x8ec643,_0xd0380a){var _0x5e7a1e,_0x33fb11;return db[_0x0fd2('0x48')][_0x0fd2('0x31')]({'where':{'id':_0x2b36ba[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x8ec643,null))[_0x0fd2('0x26')](function(_0x45a93b){if(_0x45a93b){_0x33fb11=_0x45a93b;return _0x45a93b[_0x0fd2('0x8e')](_0x2b36ba[_0x0fd2('0x51')]['ids'],_[_0x0fd2('0x8f')](_0x2b36ba[_0x0fd2('0x51')],[_0x0fd2('0x90'),'id'])||{})[_0x0fd2('0x91')](function(_0x489a04){for(var _0x56fa58=0x0;_0x56fa58<_0x2b36ba[_0x0fd2('0x51')]['ids'][_0x0fd2('0x4f')];_0x56fa58+=0x1){socket[_0x0fd2('0x78')](_0x0fd2('0x79'),{'UserId':Number(_0x2b36ba[_0x0fd2('0x51')]['ids'][_0x56fa58]),'VoiceQueueId':Number(_0x2b36ba[_0x0fd2('0x4e')]['id'])});}return _0x489a04;});}})[_0x0fd2('0x26')](function(_0x278640){_0x5e7a1e=_0x278640||[];if(_0x33fb11){return db[_0x0fd2('0x7b')]['findAll']({'where':{'id':_0x2b36ba[_0x0fd2('0x51')]['ids']},'attributes':['id',_0x0fd2('0x32'),_0x0fd2('0x92'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x2e2316){if(!_[_0x0fd2('0x93')](_0x2e2316)){var _0x44c4f6=[];for(var _0x5dce22=0x0;_0x5dce22<_0x2e2316[_0x0fd2('0x4f')];_0x5dce22++){if(_0x2e2316[_0x5dce22][_0x0fd2('0x92')]){_0x44c4f6[_0x0fd2('0x83')](db['UserVoiceQueueRt'][_0x0fd2('0x72')]({'membername':_0x2e2316[_0x5dce22][_0x0fd2('0x32')],'UserId':_0x2e2316[_0x5dce22]['id'],'queue_name':_0x33fb11[_0x0fd2('0x32')],'VoiceQueueId':_0x33fb11['id'],'interface':_[_0x0fd2('0x94')](_0x2e2316[_0x5dce22][_0x0fd2('0x6c')])?util['format'](_0x0fd2('0x76'),_0x2e2316[_0x5dce22][_0x0fd2('0x32')]):_0x2e2316[_0x5dce22]['interface'],'paused':_0x2e2316[_0x5dce22][_0x0fd2('0x6b')]||![],'penalty':_0x2b36ba['body'][_0x0fd2('0x6e')]||0x0}));}}return BPromise['all'](_0x44c4f6);}})['then'](function(){return _0x5e7a1e;})['then'](respondWithResult(_0x8ec643,null))[_0x0fd2('0x4c')](handleError(_0x8ec643,null));};exports[_0x0fd2('0x8c')]=function(_0x171fcd,_0x39d82a,_0x352e30){return db[_0x0fd2('0x48')][_0x0fd2('0x31')]({'where':{'id':_0x171fcd[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x39d82a,null))[_0x0fd2('0x26')](function(_0x25ec73){if(_0x25ec73){return _0x25ec73[_0x0fd2('0x8c')](_0x171fcd[_0x0fd2('0x3a')][_0x0fd2('0x90')])[_0x0fd2('0x26')](function(){if(_['isArray'](_0x171fcd[_0x0fd2('0x3a')][_0x0fd2('0x90')])){for(var _0xc64ae7=0x0;_0xc64ae7<_0x171fcd['query'][_0x0fd2('0x90')][_0x0fd2('0x4f')];_0xc64ae7+=0x1){socket['emit'](_0x0fd2('0x8d'),{'UserId':Number(_0x171fcd['query'][_0x0fd2('0x90')][_0xc64ae7]),'VoiceQueueId':Number(_0x171fcd[_0x0fd2('0x4e')]['id'])});}}else{socket[_0x0fd2('0x78')]('userVoiceQueue:remove',{'UserId':Number(_0x171fcd[_0x0fd2('0x3a')][_0x0fd2('0x90')]),'VoiceQueueId':Number(_0x171fcd[_0x0fd2('0x4e')]['id'])});}});}})[_0x0fd2('0x26')](function(_0x386e89){return db[_0x0fd2('0x74')][_0x0fd2('0x34')]({'where':{'VoiceQueueId':_0x171fcd['params']['id'],'UserId':_0x171fcd['query'][_0x0fd2('0x90')]}})[_0x0fd2('0x26')](function(){return _0x386e89;});})[_0x0fd2('0x26')](respondWithStatusCode(_0x39d82a,null))[_0x0fd2('0x4c')](handleError(_0x39d82a,null));};exports[_0x0fd2('0x95')]=function(_0x5288b4,_0x52581b,_0x36f6ad){var _0x38c3dc={};var _0x40d38a={};var _0xcb396d;var _0x3da13b;return db['VoiceQueue'][_0x0fd2('0x5e')]({'where':{'id':_0x5288b4[_0x0fd2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x52581b,null))[_0x0fd2('0x26')](function(_0x12c6fd){if(_0x12c6fd){_0xcb396d=_0x12c6fd;_0x40d38a[_0x0fd2('0x3e')]=_[_0x0fd2('0x3b')](db[_0x0fd2('0x7b')]['rawAttributes']);_0x40d38a[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x5288b4[_0x0fd2('0x3a')]);_0x40d38a['filters']=_[_0x0fd2('0x3d')](_0x40d38a[_0x0fd2('0x3e')],_0x40d38a[_0x0fd2('0x3a')]);_0x38c3dc[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x40d38a[_0x0fd2('0x3e')],qs[_0x0fd2('0x40')](_0x5288b4[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x38c3dc[_0x0fd2('0x3f')]=_0x38c3dc[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x38c3dc['attributes']:_0x40d38a[_0x0fd2('0x3e')];_0x38c3dc[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x5288b4[_0x0fd2('0x3a')][_0x0fd2('0x43')]);_0x38c3dc['where']=qs[_0x0fd2('0x3c')](_[_0x0fd2('0x45')](_0x5288b4[_0x0fd2('0x3a')],_0x40d38a[_0x0fd2('0x3c')]));if(_0x5288b4[_0x0fd2('0x3a')][_0x0fd2('0x2c')]){_0x38c3dc[_0x0fd2('0x44')]=_[_0x0fd2('0x59')](_0x38c3dc['where'],{'$or':_[_0x0fd2('0x2e')](_0x38c3dc['attributes'],function(_0x838146){var _0x46c7de={};_0x46c7de[_0x838146]={'$like':'%'+_0x5288b4[_0x0fd2('0x3a')][_0x0fd2('0x2c')]+'%'};return _0x46c7de;})});}_0x38c3dc=_[_0x0fd2('0x59')]({},_0x38c3dc,_0x5288b4[_0x0fd2('0x47')]);return _0xcb396d[_0x0fd2('0x95')](_0x38c3dc);}})[_0x0fd2('0x26')](function(_0x9e4ce8){if(_0x9e4ce8){_0x3da13b=_0x9e4ce8[_0x0fd2('0x4f')];if(!_0x5288b4[_0x0fd2('0x3a')][_0x0fd2('0x41')](_0x0fd2('0x60'))){_0x38c3dc[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x5288b4['query'][_0x0fd2('0x1e')]);_0x38c3dc['offset']=qs['offset'](_0x5288b4[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}return _0xcb396d[_0x0fd2('0x95')](_0x38c3dc);}})['then'](function(_0x389a13){if(_0x389a13){return _0x389a13?{'count':_0x3da13b,'rows':_0x389a13}:null;}})[_0x0fd2('0x26')](respondWithResult(_0x52581b,null))[_0x0fd2('0x4c')](handleError(_0x52581b,null));};exports['getMembers']=function(_0x2d72d3,_0x13d21f,_0x839fa2){var _0x2c937e={};var _0x2182ff={};var _0x57a3b7;var _0x4a560f;return db[_0x0fd2('0x48')][_0x0fd2('0x5e')]({'where':{'id':_0x2d72d3['params']['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x13d21f,null))[_0x0fd2('0x26')](function(_0xfb23b5){if(_0xfb23b5){_0x57a3b7=_0xfb23b5;_0x2182ff[_0x0fd2('0x3e')]=_[_0x0fd2('0x3b')](db[_0x0fd2('0x74')]['rawAttributes']);_0x2182ff[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x2d72d3[_0x0fd2('0x3a')]);_0x2182ff['filters']=_[_0x0fd2('0x3d')](_0x2182ff['model'],_0x2182ff['query']);_0x2c937e[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0x2182ff[_0x0fd2('0x3e')],qs['fields'](_0x2d72d3[_0x0fd2('0x3a')]['fields']));_0x2c937e[_0x0fd2('0x3f')]=_0x2c937e[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x2c937e['attributes']:_0x2182ff[_0x0fd2('0x3e')];_0x2c937e[_0x0fd2('0x42')]=qs[_0x0fd2('0x43')](_0x2d72d3[_0x0fd2('0x3a')][_0x0fd2('0x43')]);_0x2c937e[_0x0fd2('0x44')]=qs[_0x0fd2('0x3c')](_[_0x0fd2('0x45')](_0x2d72d3['query'],_0x2182ff['filters']));if(_0x2d72d3[_0x0fd2('0x3a')][_0x0fd2('0x2c')]){_0x2c937e[_0x0fd2('0x44')]=_['merge'](_0x2c937e[_0x0fd2('0x44')],{'$or':_[_0x0fd2('0x2e')](_0x2c937e['attributes'],function(_0x4cbf0b){var _0xbbdba={};_0xbbdba[_0x4cbf0b]={'$like':'%'+_0x2d72d3[_0x0fd2('0x3a')][_0x0fd2('0x2c')]+'%'};return _0xbbdba;})});}_0x2c937e=_[_0x0fd2('0x59')]({},_0x2c937e,_0x2d72d3[_0x0fd2('0x47')]);return _0x57a3b7[_0x0fd2('0x96')](_0x2c937e);}})['then'](function(_0xbc48){if(_0xbc48){_0x4a560f=_0xbc48['length'];if(!_0x2d72d3[_0x0fd2('0x3a')][_0x0fd2('0x41')](_0x0fd2('0x60'))){_0x2c937e[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x2d72d3[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x2c937e[_0x0fd2('0x1d')]=qs[_0x0fd2('0x1d')](_0x2d72d3[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}return _0x57a3b7[_0x0fd2('0x96')](_0x2c937e);}})[_0x0fd2('0x26')](function(_0x46d429){return _0x46d429?{'count':_0x4a560f,'rows':_0x46d429}:null;})[_0x0fd2('0x26')](respondWithResult(_0x13d21f,null))[_0x0fd2('0x4c')](handleError(_0x13d21f,null));};exports[_0x0fd2('0x97')]=function(_0x591dab,_0x187f92,_0x26d3d5){var _0x522123={};var _0xe0bf92={};var _0x15c72e;var _0x59eca9;return db[_0x0fd2('0x48')][_0x0fd2('0x5e')]({'where':{'id':_0x591dab['params']['id']}})['then'](handleEntityNotFound(_0x187f92,null))[_0x0fd2('0x26')](function(_0x5d3ae7){if(_0x5d3ae7){_0x15c72e=_0x5d3ae7;_0xe0bf92['model']=_[_0x0fd2('0x3b')](db['CmList'][_0x0fd2('0x38')]);_0xe0bf92[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x591dab[_0x0fd2('0x3a')]);_0xe0bf92[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0xe0bf92[_0x0fd2('0x3e')],_0xe0bf92[_0x0fd2('0x3a')]);_0x522123[_0x0fd2('0x3f')]=_[_0x0fd2('0x3d')](_0xe0bf92[_0x0fd2('0x3e')],qs[_0x0fd2('0x40')](_0x591dab[_0x0fd2('0x3a')][_0x0fd2('0x40')]));_0x522123['attributes']=_0x522123[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x522123['attributes']:_0xe0bf92[_0x0fd2('0x3e')];_0x522123['order']=qs[_0x0fd2('0x43')](_0x591dab[_0x0fd2('0x3a')][_0x0fd2('0x43')]);_0x522123['where']=qs['filters'](_[_0x0fd2('0x45')](_0x591dab[_0x0fd2('0x3a')],_0xe0bf92[_0x0fd2('0x3c')]));if(_0x591dab['query'][_0x0fd2('0x2c')]){_0x522123[_0x0fd2('0x44')]=_[_0x0fd2('0x59')](_0x522123[_0x0fd2('0x44')],{'$or':_[_0x0fd2('0x2e')](_0x522123[_0x0fd2('0x3f')],function(_0x3ce674){var _0x43f2c6={};_0x43f2c6[_0x3ce674]={'$like':'%'+_0x591dab['query']['filter']+'%'};return _0x43f2c6;})});}_0x522123=_[_0x0fd2('0x59')]({},_0x522123,_0x591dab[_0x0fd2('0x47')]);return _0x15c72e[_0x0fd2('0x97')](_0x522123);}})[_0x0fd2('0x26')](function(_0xaace5f){if(_0xaace5f){_0x59eca9=_0xaace5f[_0x0fd2('0x4f')];if(!_0x591dab[_0x0fd2('0x3a')][_0x0fd2('0x41')](_0x0fd2('0x60'))){_0x522123[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x591dab[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x522123[_0x0fd2('0x1d')]=qs[_0x0fd2('0x1d')](_0x591dab[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}return _0x15c72e['getLists'](_0x522123);}})[_0x0fd2('0x26')](function(_0x451f31){if(_0x451f31){return _0x451f31?{'count':_0x59eca9,'rows':_0x451f31}:null;}})[_0x0fd2('0x26')](respondWithResult(_0x187f92,null))[_0x0fd2('0x4c')](handleError(_0x187f92,null));};exports[_0x0fd2('0x98')]=function(_0x468f7a,_0x4b0e7d,_0x4e1cef){var _0x2dc84d=moment()['format'](_0x0fd2('0x99'));var _0x1b61b2,_0x4f4b3b;return db[_0x0fd2('0x48')][_0x0fd2('0x31')]({'where':{'id':_0x468f7a[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x4b0e7d,null))['then'](function(_0x203fbe){if(_0x203fbe){_0x4f4b3b=_0x203fbe;return _0x203fbe[_0x0fd2('0x98')](_0x468f7a[_0x0fd2('0x51')][_0x0fd2('0x90')],_[_0x0fd2('0x8f')](_0x468f7a[_0x0fd2('0x51')],[_0x0fd2('0x90'),'id'])||{});}return null;})['spread'](function(_0x23a184){var _0x544885;_0x1b61b2=_0x23a184||[];var _0x6d0e63=[];if(_0x23a184){for(var _0x2379c0=0x0;_0x2379c0<_0x23a184[_0x0fd2('0x4f')];_0x2379c0+=0x1){var _0x285bd7=_0x23a184[_0x2379c0][_0x0fd2('0x27')]({'plain':!![]});_0x4f4b3b[_0x0fd2('0x9a')]=_0x468f7a['body'][_0x0fd2('0x9a')]?_0x468f7a[_0x0fd2('0x51')][_0x0fd2('0x9a')]:_0x4f4b3b[_0x0fd2('0x9a')];switch(_0x4f4b3b['dialCheckDuplicateType']){case _0x0fd2('0x9b'):_0x544885=squel[_0x0fd2('0x9c')]()['into'](_0x0fd2('0x9d'))[_0x0fd2('0x9e')]([_0x0fd2('0x9f'),'scheduledAt','ContactId',_0x0fd2('0xa0'),_0x0fd2('0x61'),_0x0fd2('0x5a'),'updatedAt'],squel['select']()[_0x0fd2('0x7c')](_0x0fd2('0x9f'),_0x0fd2('0x9f'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27',_0x0fd2('0xa1'))[_0x0fd2('0x7c')]('id',_0x0fd2('0xa2'))[_0x0fd2('0x7c')](_0x285bd7['CmListId'][_0x0fd2('0x84')](),_0x0fd2('0xa0'))[_0x0fd2('0x7c')](_0x468f7a[_0x0fd2('0x4e')]['id'][_0x0fd2('0x84')](),'VoiceQueueId')[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27',_0x0fd2('0x5a'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27',_0x0fd2('0x5b'))[_0x0fd2('0x7d')](_0x0fd2('0xa3'))[_0x0fd2('0x44')](_0x0fd2('0xa4'))[_0x0fd2('0x44')](_0x0fd2('0xa5'),_0x285bd7[_0x0fd2('0xa6')][_0x0fd2('0x84')]())[_0x0fd2('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x0fd2('0x44')](_0x0fd2('0xa7'),squel[_0x0fd2('0xa8')]()[_0x0fd2('0x7c')]('COALESCE(calleridnum,\x27\x27)')[_0x0fd2('0x7d')]('cm_hopper_final')[_0x0fd2('0x44')]('VoiceQueueId\x20=\x20?',_0x468f7a[_0x0fd2('0x4e')]['id']['toString']()))[_0x0fd2('0x44')](_0x0fd2('0xa7'),squel[_0x0fd2('0xa8')]()[_0x0fd2('0x7c')](_0x0fd2('0xa9'))[_0x0fd2('0x7d')](_0x0fd2('0x9d'))[_0x0fd2('0x44')](_0x0fd2('0x81'),_0x468f7a[_0x0fd2('0x4e')]['id'][_0x0fd2('0x84')]())))[_0x0fd2('0x84')]();break;case _0x0fd2('0xaa'):_0x544885=squel['insert']()[_0x0fd2('0xab')]('cm_hopper')['fromQuery']([_0x0fd2('0x9f'),_0x0fd2('0xa1'),_0x0fd2('0xa2'),_0x0fd2('0xa0'),_0x0fd2('0x61'),_0x0fd2('0x5a'),'updatedAt'],squel[_0x0fd2('0xa8')]()['field'](_0x0fd2('0x9f'),_0x0fd2('0x9f'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27','scheduledAt')[_0x0fd2('0x7c')]('id',_0x0fd2('0xa2'))[_0x0fd2('0x7c')](_0x285bd7[_0x0fd2('0xa6')]['toString'](),_0x0fd2('0xa0'))[_0x0fd2('0x7c')](_0x468f7a[_0x0fd2('0x4e')]['id'][_0x0fd2('0x84')](),_0x0fd2('0x61'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27','createdAt')[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27','updatedAt')[_0x0fd2('0x7d')]('cm_contacts')[_0x0fd2('0x44')]('deletedAt\x20IS\x20NULL')[_0x0fd2('0x44')]('ListId\x20=\x20?',_0x285bd7['CmListId'][_0x0fd2('0x84')]())[_0x0fd2('0x44')](_0x0fd2('0xac'))[_0x0fd2('0x44')](_0x0fd2('0xa7'),squel[_0x0fd2('0xa8')]()[_0x0fd2('0x7c')](_0x0fd2('0xa9'))[_0x0fd2('0x7d')]('cm_hopper')[_0x0fd2('0x44')]('VoiceQueueId\x20=\x20?',_0x468f7a[_0x0fd2('0x4e')]['id']['toString']())))[_0x0fd2('0x84')]();break;default:_0x544885=squel[_0x0fd2('0x9c')]()['into'](_0x0fd2('0x9d'))['fromQuery']([_0x0fd2('0x9f'),_0x0fd2('0xa1'),_0x0fd2('0xa2'),_0x0fd2('0xa0'),'VoiceQueueId',_0x0fd2('0x5a'),_0x0fd2('0x5b')],squel[_0x0fd2('0xa8')]()[_0x0fd2('0x7c')](_0x0fd2('0x9f'),'phone')[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27','scheduledAt')['field']('id','ContactId')[_0x0fd2('0x7c')](_0x285bd7[_0x0fd2('0xa6')]['toString'](),_0x0fd2('0xa0'))['field'](_0x468f7a[_0x0fd2('0x4e')]['id'][_0x0fd2('0x84')](),_0x0fd2('0x61'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27','createdAt')[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27',_0x0fd2('0x5b'))[_0x0fd2('0x7d')](_0x0fd2('0xa3'))[_0x0fd2('0x44')]('deletedAt\x20IS\x20NULL')[_0x0fd2('0x44')]('ListId\x20=\x20?',_0x285bd7[_0x0fd2('0xa6')]['toString']())[_0x0fd2('0x44')](_0x0fd2('0xac')))[_0x0fd2('0x84')]();}_0x6d0e63[_0x0fd2('0x83')](db[_0x0fd2('0x6f')][_0x0fd2('0x3a')](_0x544885));}return BPromise['all'](_0x6d0e63);}})[_0x0fd2('0x26')](function(){var _0x4b2a0e=[];var _0x1ad987=squel[_0x0fd2('0x9c')]()[_0x0fd2('0xab')]('cm_hopper_additional_phones')[_0x0fd2('0x9e')]([_0x0fd2('0xad'),'phone',_0x0fd2('0xae'),_0x0fd2('0x5a'),'updatedAt'],squel[_0x0fd2('0xa8')]()[_0x0fd2('0x7c')]('h.id')[_0x0fd2('0x7c')](_0x0fd2('0xaf'))[_0x0fd2('0x7c')](_0x0fd2('0xb0'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27',_0x0fd2('0x5a'))[_0x0fd2('0x7c')]('\x27'+_0x2dc84d+'\x27','updatedAt')[_0x0fd2('0x7d')](_0x0fd2('0xb1'),'ci')[_0x0fd2('0x7e')](_0x0fd2('0x9d'),'h','h.ContactId=ci.CmContactId')[_0x0fd2('0x44')](_0x0fd2('0xb2'),_0x2dc84d)[_0x0fd2('0x44')](_0x0fd2('0xb3'),_0x0fd2('0xb4')))[_0x0fd2('0x84')]();_0x4b2a0e['push'](db[_0x0fd2('0x6f')]['query'](_0x1ad987));return BPromise[_0x0fd2('0xb5')](_0x4b2a0e);})[_0x0fd2('0x26')](function(){return _0x1b61b2;})['then'](respondWithResult(_0x4b0e7d,null))['catch'](handleError(_0x4b0e7d,null));};exports[_0x0fd2('0xb6')]=function(_0x3878eb,_0x5383ea,_0x260a1d){return db['VoiceQueue'][_0x0fd2('0x31')]({'where':{'id':_0x3878eb['params']['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x5383ea,null))[_0x0fd2('0x26')](function(_0x4fd20b){if(_0x4fd20b){return _0x4fd20b[_0x0fd2('0xb6')](_0x3878eb[_0x0fd2('0x3a')][_0x0fd2('0x90')]);}})[_0x0fd2('0x26')](function(_0x318144){if(_0x318144){return db[_0x0fd2('0x5f')][_0x0fd2('0x34')]({'where':{'ListId':_0x3878eb[_0x0fd2('0x3a')][_0x0fd2('0x90')],'VoiceQueueId':_0x3878eb[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](function(){return _0x318144;});}})[_0x0fd2('0x26')](respondWithStatusCode(_0x5383ea,null))[_0x0fd2('0x4c')](handleError(_0x5383ea,null));};exports['getBlackLists']=function(_0x51b80a,_0x54585d,_0x407be5){var _0x241914={};var _0x64e087={};var _0x35479a;var _0x81b4bb;return db[_0x0fd2('0x48')]['findOne']({'where':{'id':_0x51b80a[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x54585d,null))['then'](function(_0x2ec276){if(_0x2ec276){_0x35479a=_0x2ec276;_0x64e087['model']=_[_0x0fd2('0x3b')](db[_0x0fd2('0xb7')][_0x0fd2('0x38')]);_0x64e087[_0x0fd2('0x3a')]=_[_0x0fd2('0x3b')](_0x51b80a[_0x0fd2('0x3a')]);_0x64e087[_0x0fd2('0x3c')]=_[_0x0fd2('0x3d')](_0x64e087[_0x0fd2('0x3e')],_0x64e087[_0x0fd2('0x3a')]);_0x241914[_0x0fd2('0x3f')]=_['intersection'](_0x64e087[_0x0fd2('0x3e')],qs[_0x0fd2('0x40')](_0x51b80a[_0x0fd2('0x3a')]['fields']));_0x241914['attributes']=_0x241914[_0x0fd2('0x3f')][_0x0fd2('0x4f')]?_0x241914[_0x0fd2('0x3f')]:_0x64e087[_0x0fd2('0x3e')];_0x241914['order']=qs[_0x0fd2('0x43')](_0x51b80a[_0x0fd2('0x3a')][_0x0fd2('0x43')]);_0x241914[_0x0fd2('0x44')]=qs[_0x0fd2('0x3c')](_['pick'](_0x51b80a['query'],_0x64e087[_0x0fd2('0x3c')]));if(_0x51b80a[_0x0fd2('0x3a')][_0x0fd2('0x2c')]){_0x241914[_0x0fd2('0x44')]=_['merge'](_0x241914[_0x0fd2('0x44')],{'$or':_[_0x0fd2('0x2e')](_0x241914[_0x0fd2('0x3f')],function(_0x2c7824){var _0x1ec0da={};_0x1ec0da[_0x2c7824]={'$like':'%'+_0x51b80a['query']['filter']+'%'};return _0x1ec0da;})});}_0x241914=_[_0x0fd2('0x59')]({},_0x241914,_0x51b80a[_0x0fd2('0x47')]);return _0x35479a[_0x0fd2('0xb8')](_0x241914);}})[_0x0fd2('0x26')](function(_0x5a3e6d){if(_0x5a3e6d){_0x81b4bb=_0x5a3e6d[_0x0fd2('0x4f')];if(!_0x51b80a['query']['hasOwnProperty'](_0x0fd2('0x60'))){_0x241914[_0x0fd2('0x1e')]=qs[_0x0fd2('0x1e')](_0x51b80a[_0x0fd2('0x3a')][_0x0fd2('0x1e')]);_0x241914['offset']=qs[_0x0fd2('0x1d')](_0x51b80a[_0x0fd2('0x3a')][_0x0fd2('0x1d')]);}return _0x35479a[_0x0fd2('0xb8')](_0x241914);}})['then'](function(_0x4567ad){if(_0x4567ad){return _0x4567ad?{'count':_0x81b4bb,'rows':_0x4567ad}:null;}})[_0x0fd2('0x26')](respondWithResult(_0x54585d,null))[_0x0fd2('0x4c')](handleError(_0x54585d,null));};exports[_0x0fd2('0xb9')]=function(_0x30ef90,_0x6ea2c8,_0x17a770){var _0x34b662,_0x14df62;return db['VoiceQueue'][_0x0fd2('0x31')]({'where':{'id':_0x30ef90[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x6ea2c8,null))[_0x0fd2('0x26')](function(_0x3c0c6c){if(_0x3c0c6c){_0x14df62=_0x3c0c6c;return _0x3c0c6c[_0x0fd2('0xb9')](_0x30ef90[_0x0fd2('0x51')]['ids'],_[_0x0fd2('0x8f')](_0x30ef90[_0x0fd2('0x51')],[_0x0fd2('0x90'),'id'])||{});}return null;})[_0x0fd2('0x91')](function(_0x1da9f3){var _0x50e7ba;_0x34b662=_0x1da9f3||[];var _0x1739c7=[];if(_0x1da9f3){for(var _0x59618c=0x0;_0x59618c<_0x1da9f3[_0x0fd2('0x4f')];_0x59618c+=0x1){var _0x18ec77=_0x1da9f3[_0x59618c][_0x0fd2('0x27')]({'plain':!![]});_0x50e7ba=squel[_0x0fd2('0x9c')]()[_0x0fd2('0xab')](_0x0fd2('0xba'))[_0x0fd2('0x9e')]([_0x0fd2('0x9f'),_0x0fd2('0xa2'),_0x0fd2('0xa0'),'VoiceQueueId',_0x0fd2('0x5a'),_0x0fd2('0x5b')],squel['select']()[_0x0fd2('0x7c')](_0x0fd2('0x9f'),_0x0fd2('0x9f'))[_0x0fd2('0x7c')]('id',_0x0fd2('0xa2'))[_0x0fd2('0x7c')](_0x18ec77[_0x0fd2('0xa6')][_0x0fd2('0x84')](),'ListId')[_0x0fd2('0x7c')](_0x30ef90['params']['id'][_0x0fd2('0x84')](),_0x0fd2('0x61'))[_0x0fd2('0x7c')](_0x0fd2('0xbb'),_0x0fd2('0x5a'))[_0x0fd2('0x7c')](_0x0fd2('0xbb'),_0x0fd2('0x5b'))[_0x0fd2('0x7d')](_0x0fd2('0xa3'))[_0x0fd2('0x44')](_0x0fd2('0xa4'))[_0x0fd2('0x44')](_0x0fd2('0xa5'),_0x18ec77[_0x0fd2('0xa6')][_0x0fd2('0x84')]())[_0x0fd2('0x44')](_0x0fd2('0xac')))['toString']();_0x1739c7['push'](db[_0x0fd2('0x6f')][_0x0fd2('0x3a')](_0x50e7ba));}return BPromise[_0x0fd2('0xb5')](_0x1739c7);}})[_0x0fd2('0x26')](function(){return _0x34b662;})[_0x0fd2('0x26')](respondWithResult(_0x6ea2c8,null))[_0x0fd2('0x4c')](handleError(_0x6ea2c8,null));};exports[_0x0fd2('0xbc')]=function(_0x2085ad,_0x44db9a,_0x5134d9){return db['VoiceQueue'][_0x0fd2('0x31')]({'where':{'id':_0x2085ad[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](handleEntityNotFound(_0x44db9a,null))[_0x0fd2('0x26')](function(_0x5af168){if(_0x5af168){return _0x5af168[_0x0fd2('0xbc')](_0x2085ad['query'][_0x0fd2('0x90')]);}})[_0x0fd2('0x26')](function(_0x30e702){if(_0x30e702){return db[_0x0fd2('0x66')][_0x0fd2('0x34')]({'where':{'ListId':_0x2085ad['query'][_0x0fd2('0x90')],'VoiceQueueId':_0x2085ad[_0x0fd2('0x4e')]['id']}})[_0x0fd2('0x26')](function(){return _0x30e702;});}})[_0x0fd2('0x26')](respondWithStatusCode(_0x44db9a,null))['catch'](handleError(_0x44db9a,null));};
\ No newline at end of file