Built motion from commit d6d69adf.|2.6.33
[motion2.git] / server / components / realtime / agents.js
index 1d4f21d..c0ecf09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7aa=['voiceStatus','voicePause','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','flatten','uniq','value','includes','getAgentIdsByStatus','resolve','findAll','fullname','chatPause','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','fullname,internal','internal','substring','validateSortParameter','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','name','role','openchannelStatus','chatCapacity','faxCapacity','openchannelCapacity','chatCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil'];(function(_0x2e2c26,_0x1b3e84){var _0x345643=function(_0x564df5){while(--_0x564df5){_0x2e2c26['push'](_0x2e2c26['shift']());}};_0x345643(++_0x1b3e84);}(_0xb7aa,0x11a));var _0xab7a=function(_0x5c56ec,_0xc7f70b){_0x5c56ec=_0x5c56ec-0x0;var _0x438537=_0xb7aa[_0x5c56ec];return _0x438537;};'use strict';var _=require(_0xab7a('0x0'));var jayson=require(_0xab7a('0x1'));var db=require(_0xab7a('0x2'))['db'];var amiClient=jayson[_0xab7a('0x3')][_0xab7a('0x4')]({'port':0x232a});var routingClient=jayson[_0xab7a('0x3')][_0xab7a('0x4')]({'port':0x232c});function isAgentPaused(_0x242521,_0x34adc3){var _0x3b0621=[_0x242521['chatPause'],_0x242521[_0xab7a('0x5')],_0x242521[_0xab7a('0x6')],_0x242521[_0xab7a('0x7')],_0x242521[_0xab7a('0x8')],_0x242521['voicePause'],_0x242521[_0xab7a('0x9')]];if(!_0x34adc3)return _[_0xab7a('0xa')](_0x3b0621);var _0x520d21=_[_0xab7a('0xb')](_0x3b0621);return _0x520d21[_0xab7a('0xc')]>0x0&&_0x520d21[_0xab7a('0xc')]<_0x3b0621[_0xab7a('0xc')]?!![]:![];}function isIdle(_0x40cc81){return _0x40cc81===_0xab7a('0xd')||_0x40cc81===_0xab7a('0xe')||_0x40cc81===_0xab7a('0xf')||_0x40cc81===_0xab7a('0x10')||_[_0xab7a('0x11')](_0x40cc81);}function isAgentIdle(_0x563b84){if(_0x563b84[_0xab7a('0x12')]!==_0xab7a('0xd')&&_0x563b84[_0xab7a('0x13')]){_0x563b84[_0xab7a('0x12')]='pause';return![];}return _[_0xab7a('0xa')]([_0x563b84[_0xab7a('0x14')],_0x563b84[_0xab7a('0x15')],_0x563b84[_0xab7a('0x16')],_0x563b84['openchannelStatus'],_0x563b84[_0xab7a('0x17')],_0x563b84[_0xab7a('0x12')],_0x563b84['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xab7a('0x18')](_0xab7a('0x19'),{})[_0xab7a('0x1a')](function(_0x8ddb0d){if(_0x8ddb0d[_0xab7a('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x198e78=_0x8ddb0d[_0xab7a('0x1c')];return routingClient['request'](_0xab7a('0x19'),{})[_0xab7a('0x1a')](function(_0x187f51){if(_0x187f51[_0xab7a('0x1b')]){throw new Error(_0xab7a('0x1d'));}var _0x14b2b5=_0x187f51[_0xab7a('0x1c')];return _['merge']({},_0x198e78,_0x14b2b5);});})[_0xab7a('0x1e')](function(_0x2ea6c8){throw _0x2ea6c8;});}exports[_0xab7a('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x9db11a){var _0x2fa287=_0xab7a('0xe');if(isAgentPaused(_0x9db11a))_0x2fa287=_0xab7a('0x20');else if(isAgentPaused(_0x9db11a,!![]))_0x2fa287=_0xab7a('0x21');else if(isAgentIdle(_0x9db11a))_0x2fa287=_0xab7a('0xd');else _0x2fa287=_0xab7a('0x22');return _0x2fa287;}exports[_0xab7a('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x5b7ee4,_0x4b65f0){var _0x5c4c3e=_[_0xab7a('0x24')](_0x5b7ee4)?_0x5b7ee4:[_0x5b7ee4];var _0x210ac6=_[_0xab7a('0x25')](_0x4b65f0)+_0xab7a('0x26');var _0x41ecb5=_[_0xab7a('0x27')](_0x5c4c3e,function(_0x3324f2){return db[_0x210ac6]['findOne']({'where':{'id':_0x3324f2}})['then'](function(_0x2c62dc){if(!_0x2c62dc)return[];return _0x2c62dc['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x41ecb5)[_0xab7a('0x1a')](function(_0x570a8b){var _0x169417=_(_0x570a8b)[_0xab7a('0x28')]()[_0xab7a('0x27')]('id')[_0xab7a('0x29')]()[_0xab7a('0x2a')]();return _0x169417;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x14fbee,_0x47f1e1,_0x26c106){try{if(_0x47f1e1['length']>0x0){_0x14fbee=_0x14fbee[_0xab7a('0xb')](function(_0x311dfa){return _0x47f1e1[_0xab7a('0x2b')](_0x311dfa['id']);});}var _0x599375=_0x14fbee['filter'](function(_0x2e0600){var _0x5b5501=_0xab7a('0x22');if(isAgentIdle(_0x2e0600)){_0x5b5501=_0xab7a('0xd');}return _0x5b5501===_0x26c106;});return _['map'](_0x599375,'id');}catch(_0x14065b){throw _0x14065b;}}exports[_0xab7a('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x467dce,_0x6e0d82,_0x36b71e){return Promise[_0xab7a('0x2d')]()['then'](function(){if(_0x6e0d82[_0xab7a('0xc')]>0x0){_0x467dce=_0x467dce['filter'](function(_0x304af8){return _0x6e0d82[_0xab7a('0x2b')](_0x304af8['id']);});}return _0x467dce;})[_0xab7a('0x1a')](function(){return db['User'][_0xab7a('0x2e')]({'attributes':['id','name',_0xab7a('0x2f'),_0xab7a('0x30'),_0xab7a('0x5'),_0xab7a('0x6'),_0xab7a('0x7'),_0xab7a('0x8'),_0xab7a('0x13'),_0xab7a('0x9'),'pauseType'],'where':{'id':{'$in':_[_0xab7a('0x27')](_0x467dce,'id')}},'raw':!![]});})[_0xab7a('0x1a')](function(_0x2ac036){return _0x2ac036[_0xab7a('0x27')](function(_0x4ad5ff){var _0x2df446=_[_0xab7a('0x31')](_0x467dce,['id',_0x4ad5ff['id']]);var _0x2377d9=filterAgentAttributes(_0x2df446);_['merge'](_0x4ad5ff,_0x2377d9);_0x4ad5ff[_0xab7a('0x32')]=getAgentStatus(_0x4ad5ff);return _0x4ad5ff;});})[_0xab7a('0x1a')](function(_0x2243aa){var _0x1db644=sortAgentsByStatus(_0x2243aa,_0x36b71e);return _['map'](_0x1db644,'id');})[_0xab7a('0x1e')](function(_0x4d178f){throw _0x4d178f;});}exports[_0xab7a('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4fa7c9){var _0x4bdbea={'fields':[],'order':null};var _0x8e145b=_0x4fa7c9['split'](',');_0x4bdbea[_0xab7a('0x34')]=_[_0xab7a('0xb')](_0x8e145b,function(_0x5aadb1){if(!_0x5aadb1['includes'](_0xab7a('0x32'))){return!![];}_0x4bdbea[_0xab7a('0x35')]=_[_0xab7a('0x36')](_0x5aadb1,'-')?_0xab7a('0x37'):'ASC';return![];});return _0x4bdbea;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1dd395){if(!_0x1dd395){_0x1dd395=_0xab7a('0x38');}if(_0x1dd395[_0xab7a('0x2b')](_0xab7a('0x2f'))&&!_0x1dd395['includes'](_0xab7a('0x39'))){var _0xcac61=_0x1dd395[_0xab7a('0x3a')](0x0,_0x1dd395['indexOf'](_0xab7a('0x2f')));_0x1dd395+=','+_0xcac61+_0xab7a('0x39');}return _0x1dd395;}exports[_0xab7a('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x9cfc25,_0x4d9303){var _0x1e431d=_0x9cfc25['sort'](function(_0x6bfc12,_0x1bf286){if(_0x6bfc12[_0xab7a('0x32')]===_0x1bf286['globalStatus']){if(_0x6bfc12[_0xab7a('0x32')]===_0xab7a('0x20')){if(_0x4d9303===_0xab7a('0x37')){return(_0x6bfc12[_0xab7a('0x3c')]||'')<(_0x1bf286['pauseType']||'')||_0x6bfc12[_0xab7a('0x2f')][_0xab7a('0x3d')]()>_0x1bf286[_0xab7a('0x2f')][_0xab7a('0x3d')]()?0x1:-0x1;}else{return(_0x6bfc12['pauseType']||'')<(_0x1bf286[_0xab7a('0x3c')]||'')||_0x6bfc12['fullname'][_0xab7a('0x3d')]()>_0x1bf286['fullname'][_0xab7a('0x3d')]()?-0x1:0x1;}}else{if(_0x4d9303===_0xab7a('0x37')){return _0x6bfc12['fullname'][_0xab7a('0x3d')]()<_0x1bf286[_0xab7a('0x2f')][_0xab7a('0x3d')]()?0x1:-0x1;}else{return _0x6bfc12[_0xab7a('0x2f')][_0xab7a('0x3d')]()<_0x1bf286[_0xab7a('0x2f')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4d9303==='DESC'){return _0x6bfc12[_0xab7a('0x32')]<_0x1bf286[_0xab7a('0x32')]?0x1:-0x1;}else{return _0x6bfc12[_0xab7a('0x32')]<_0x1bf286[_0xab7a('0x32')]?-0x1:0x1;}}});return _0x1e431d;}exports[_0xab7a('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0xbaef59){var _0x2930c5=[_0xab7a('0x3f'),_0xab7a('0x40'),_0xab7a('0x41'),_0xab7a('0x42'),_0xab7a('0x3c'),'lastPauseAt','internal',_0xab7a('0x43'),_0xab7a('0x30'),_0xab7a('0x7'),'mailPause',_0xab7a('0x8'),'whatsappPause',_0xab7a('0x5'),_0xab7a('0x13'),'chatCapacity','openchannelCapacity','mailCapacity',_0xab7a('0x44'),_0xab7a('0x45'),'faxCapacity','chatCurrentCapacity',_0xab7a('0x46'),_0xab7a('0x47'),_0xab7a('0x48'),_0xab7a('0x49'),_0xab7a('0x4a'),'chatStatus','openchannelStatus',_0xab7a('0x16'),'smsStatus',_0xab7a('0x4b'),'faxStatus',_0xab7a('0x12'),_0xab7a('0x4c'),_0xab7a('0x4d'),_0xab7a('0x4e'),_0xab7a('0x4f'),_0xab7a('0x50'),_0xab7a('0x51'),_0xab7a('0x52'),_0xab7a('0x53'),_0xab7a('0x54'),_0xab7a('0x55'),'phoneBarEnableScreenRecordingByAgent',_0xab7a('0x56')];var _0xafeb36=[_0xab7a('0x30'),_0xab7a('0x7'),'mailPause','smsPause','whatsappPause',_0xab7a('0x5'),_0xab7a('0x13'),'online'];var _0x7ccec9=_(_0xbaef59)[_0xab7a('0x57')](_0xafeb36)[_0xab7a('0x58')](_0x2930c5)[_0xab7a('0x2a')]();return _0x7ccec9;}exports[_0xab7a('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xab7a('0x5a'),_0xab7a('0x2f'),_0xab7a('0x5b'),_0xab7a('0x39'),_0xab7a('0x40'),_0xab7a('0x32'),_0xab7a('0x3f'),'lastLoginAt','pauseType',_0xab7a('0x42'),_0xab7a('0x5'),_0xab7a('0x30'),'mailPause',_0xab7a('0x7'),'smsPause',_0xab7a('0x13'),'whatsappPause',_0xab7a('0x14'),'faxStatus',_0xab7a('0x16'),_0xab7a('0x5c'),_0xab7a('0x17'),_0xab7a('0x12'),_0xab7a('0x4b'),_0xab7a('0x4c'),_0xab7a('0x51'),_0xab7a('0x4e'),_0xab7a('0x4d'),'smsStatusTime','voiceStatusTime','whatsappStatusTime',_0xab7a('0x5d'),_0xab7a('0x5e'),'mailCapacity',_0xab7a('0x5f'),_0xab7a('0x44'),_0xab7a('0x45'),_0xab7a('0x60'),_0xab7a('0x4a'),_0xab7a('0x47'),_0xab7a('0x46'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xab7a('0x61'),_0xab7a('0x56'),_0xab7a('0x54'),_0xab7a('0x62'),_0xab7a('0x53'),_0xab7a('0x55')];}exports[_0xab7a('0x63')]=getRealtimeAgentsQueryFields;
\ No newline at end of file
+var _0x530f=['mailPause','whatsappPause','pauseType','find','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','faxStatus','smsStatusTime','mailCurrentCapacity','jayson/promise','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname'];(function(_0x1dee62,_0x275e18){var _0x37c117=function(_0x3f7c8c){while(--_0x3f7c8c){_0x1dee62['push'](_0x1dee62['shift']());}};_0x37c117(++_0x275e18);}(_0x530f,0x167));var _0xf530=function(_0x32faa6,_0x231c1f){_0x32faa6=_0x32faa6-0x0;var _0x1526dd=_0x530f[_0x32faa6];return _0x1526dd;};'use strict';var _=require('lodash');var jayson=require(_0xf530('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xf530('0x1')]({'port':0x232a});var routingClient=jayson[_0xf530('0x2')][_0xf530('0x1')]({'port':0x232c});function isAgentPaused(_0x206a5d,_0x464b2e){var _0x2bacf8=[_0x206a5d[_0xf530('0x3')],_0x206a5d[_0xf530('0x4')],_0x206a5d['mailPause'],_0x206a5d[_0xf530('0x5')],_0x206a5d[_0xf530('0x6')],_0x206a5d[_0xf530('0x7')],_0x206a5d['whatsappPause']];if(!_0x464b2e)return _[_0xf530('0x8')](_0x2bacf8);var _0xf205be=_[_0xf530('0x9')](_0x2bacf8);return _0xf205be[_0xf530('0xa')]>0x0&&_0xf205be[_0xf530('0xa')]<_0x2bacf8[_0xf530('0xa')]?!![]:![];}function isIdle(_0x4b8336){return _0x4b8336===_0xf530('0xb')||_0x4b8336===_0xf530('0xc')||_0x4b8336===_0xf530('0xd')||_0x4b8336===_0xf530('0xe')||_[_0xf530('0xf')](_0x4b8336);}function isAgentIdle(_0x39912f){if(_0x39912f['voiceStatus']!=='idle'&&_0x39912f[_0xf530('0x7')]){_0x39912f[_0xf530('0x10')]=_0xf530('0x11');return![];}return _[_0xf530('0x8')]([_0x39912f[_0xf530('0x12')],_0x39912f['faxStatus'],_0x39912f[_0xf530('0x13')],_0x39912f[_0xf530('0x14')],_0x39912f[_0xf530('0x15')],_0x39912f[_0xf530('0x10')],_0x39912f[_0xf530('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xf530('0x17')](_0xf530('0x18'),{})[_0xf530('0x19')](function(_0x4cbfc0){if(_0x4cbfc0[_0xf530('0x1a')]){throw new Error(_0xf530('0x1b'));}var _0x47e156=_0x4cbfc0[_0xf530('0x1c')];return routingClient[_0xf530('0x17')]('Agents',{})[_0xf530('0x19')](function(_0x255bb3){if(_0x255bb3[_0xf530('0x1a')]){throw new Error(_0xf530('0x1d'));}var _0x52c10f=_0x255bb3[_0xf530('0x1c')];return _[_0xf530('0x1e')]({},_0x47e156,_0x52c10f);});})[_0xf530('0x1f')](function(_0x384f92){throw _0x384f92;});}exports[_0xf530('0x20')]=getRealtimeAgents;function getAgentStatus(_0x3cb0f7){var _0x48f834=_0xf530('0xc');if(isAgentPaused(_0x3cb0f7))_0x48f834=_0xf530('0x11');else if(isAgentPaused(_0x3cb0f7,!![]))_0x48f834=_0xf530('0x21');else if(isAgentIdle(_0x3cb0f7))_0x48f834=_0xf530('0xb');else _0x48f834=_0xf530('0x22');return _0x48f834;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x4dbbaf,_0x5679ce){var _0x4375af=_[_0xf530('0x23')](_0x4dbbaf)?_0x4dbbaf:[_0x4dbbaf];var _0x3e6b3b=_[_0xf530('0x24')](_0x5679ce)+_0xf530('0x25');var _0x4bb1b3=_[_0xf530('0x26')](_0x4375af,function(_0x1473b6){return db[_0x3e6b3b][_0xf530('0x27')]({'where':{'id':_0x1473b6}})[_0xf530('0x19')](function(_0x21b89d){if(!_0x21b89d)return[];return _0x21b89d[_0xf530('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf530('0x29')](_0x4bb1b3)[_0xf530('0x19')](function(_0x32f17a){var _0x1f3c88=_(_0x32f17a)[_0xf530('0x2a')]()['map']('id')[_0xf530('0x2b')]()[_0xf530('0x2c')]();return _0x1f3c88;});}exports[_0xf530('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58a41a,_0x21b792,_0x5b7837){try{if(_0x21b792['length']>0x0){_0x58a41a=_0x58a41a[_0xf530('0x9')](function(_0x3efab8){return _0x21b792[_0xf530('0x2e')](_0x3efab8['id']);});}var _0x5dea4d=_0x58a41a[_0xf530('0x9')](function(_0x3f3480){var _0x3170f7=_0xf530('0x22');if(isAgentIdle(_0x3f3480)){_0x3170f7=_0xf530('0xb');}return _0x3170f7===_0x5b7837;});return _[_0xf530('0x26')](_0x5dea4d,'id');}catch(_0x39b429){throw _0x39b429;}}exports[_0xf530('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x26dece,_0x321fb7,_0x5572ba){return Promise[_0xf530('0x30')]()['then'](function(){if(_0x321fb7[_0xf530('0xa')]>0x0){_0x26dece=_0x26dece[_0xf530('0x9')](function(_0x4d60ad){return _0x321fb7['includes'](_0x4d60ad['id']);});}return _0x26dece;})['then'](function(){return db[_0xf530('0x31')][_0xf530('0x32')]({'attributes':['id',_0xf530('0x33'),_0xf530('0x34'),'chatPause','faxPause',_0xf530('0x35'),_0xf530('0x5'),_0xf530('0x6'),_0xf530('0x7'),_0xf530('0x36'),_0xf530('0x37')],'where':{'id':{'$in':_[_0xf530('0x26')](_0x26dece,'id')}},'raw':!![]});})['then'](function(_0x1cef3b){return _0x1cef3b[_0xf530('0x26')](function(_0x11292b){var _0x1375de=_[_0xf530('0x38')](_0x26dece,['id',_0x11292b['id']]);var _0x4b75af=filterAgentAttributes(_0x1375de);_[_0xf530('0x1e')](_0x11292b,_0x4b75af);_0x11292b['globalStatus']=getAgentStatus(_0x11292b);return _0x11292b;});})[_0xf530('0x19')](function(_0x53c95a){var _0xa3ce3f=sortAgentsByStatus(_0x53c95a,_0x5572ba);return _[_0xf530('0x26')](_0xa3ce3f,'id');})[_0xf530('0x1f')](function(_0x46fe51){throw _0x46fe51;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x44bd4d){var _0x4b77d9={'fields':[],'order':null};var _0x5b7bfc=_0x44bd4d[_0xf530('0x39')](',');_0x4b77d9[_0xf530('0x3a')]=_[_0xf530('0x9')](_0x5b7bfc,function(_0x43a308){if(!_0x43a308[_0xf530('0x2e')](_0xf530('0x3b'))){return!![];}_0x4b77d9[_0xf530('0x3c')]=_[_0xf530('0x3d')](_0x43a308,'-')?_0xf530('0x3e'):_0xf530('0x3f');return![];});return _0x4b77d9;}exports[_0xf530('0x40')]=getUpdatedSortOptions;function validateSortParameter(_0x2551f1){if(!_0x2551f1){_0x2551f1='fullname,internal';}if(_0x2551f1[_0xf530('0x2e')](_0xf530('0x34'))&&!_0x2551f1[_0xf530('0x2e')](_0xf530('0x41'))){var _0x20aefd=_0x2551f1[_0xf530('0x42')](0x0,_0x2551f1[_0xf530('0x43')]('fullname'));_0x2551f1+=','+_0x20aefd+'internal';}return _0x2551f1;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xe016,_0x1b4e94){var _0x3e1cda=_0xe016[_0xf530('0x44')](function(_0x1f202f,_0x4cb84f){if(_0x1f202f[_0xf530('0x3b')]===_0x4cb84f['globalStatus']){if(_0x1f202f[_0xf530('0x3b')]===_0xf530('0x11')){if(_0x1b4e94===_0xf530('0x3e')){return(_0x1f202f[_0xf530('0x37')]||'')<(_0x4cb84f[_0xf530('0x37')]||'')||_0x1f202f['fullname'][_0xf530('0x45')]()>_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1f202f['pauseType']||'')<(_0x4cb84f[_0xf530('0x37')]||'')||_0x1f202f[_0xf530('0x34')]['toLowerCase']()>_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1b4e94===_0xf530('0x3e')){return _0x1f202f[_0xf530('0x34')][_0xf530('0x45')]()<_0x4cb84f['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x1f202f[_0xf530('0x34')]['toLowerCase']()<_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1b4e94===_0xf530('0x3e')){return _0x1f202f[_0xf530('0x3b')]<_0x4cb84f['globalStatus']?0x1:-0x1;}else{return _0x1f202f['globalStatus']<_0x4cb84f['globalStatus']?-0x1:0x1;}}});return _0x3e1cda;}exports[_0xf530('0x46')]=sortAgentsByStatus;function filterAgentAttributes(_0x56063f){var _0x3948e0=[_0xf530('0x47'),_0xf530('0x48'),_0xf530('0x49'),_0xf530('0x4a'),_0xf530('0x37'),_0xf530('0x4a'),_0xf530('0x41'),_0xf530('0x4b'),_0xf530('0x3'),_0xf530('0x5'),_0xf530('0x35'),_0xf530('0x6'),_0xf530('0x36'),_0xf530('0x4'),_0xf530('0x7'),_0xf530('0x4c'),_0xf530('0x4d'),_0xf530('0x4e'),_0xf530('0x4f'),_0xf530('0x50'),_0xf530('0x51'),_0xf530('0x52'),_0xf530('0x53'),'mailCurrentCapacity',_0xf530('0x54'),_0xf530('0x55'),_0xf530('0x56'),_0xf530('0x12'),_0xf530('0x14'),'mailStatus',_0xf530('0x15'),_0xf530('0x16'),'faxStatus',_0xf530('0x10'),_0xf530('0x57'),_0xf530('0x58'),_0xf530('0x59'),'smsStatusTime',_0xf530('0x5a'),_0xf530('0x5b'),_0xf530('0x5c'),_0xf530('0x5d'),_0xf530('0x5e'),_0xf530('0x5f'),'phoneBarEnableScreenRecordingByAgent',_0xf530('0x60')];var _0x769171=[_0xf530('0x3'),_0xf530('0x5'),'mailPause',_0xf530('0x6'),'whatsappPause',_0xf530('0x4'),_0xf530('0x7'),_0xf530('0x48')];var _0x497e3b=_(_0x56063f)[_0xf530('0x61')](_0x769171)['pick'](_0x3948e0)[_0xf530('0x2c')]();return _0x497e3b;}exports[_0xf530('0x62')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf530('0x33'),_0xf530('0x34'),_0xf530('0x63'),'internal','online','globalStatus',_0xf530('0x47'),_0xf530('0x49'),_0xf530('0x37'),_0xf530('0x4a'),_0xf530('0x4'),'chatPause','mailPause',_0xf530('0x5'),'smsPause',_0xf530('0x7'),_0xf530('0x36'),_0xf530('0x12'),_0xf530('0x64'),'mailStatus',_0xf530('0x14'),_0xf530('0x15'),'voiceStatus',_0xf530('0x16'),_0xf530('0x57'),_0xf530('0x5b'),_0xf530('0x59'),_0xf530('0x58'),_0xf530('0x65'),_0xf530('0x5c'),'whatsappStatusTime','chatCapacity',_0xf530('0x51'),'mailCapacity',_0xf530('0x4d'),_0xf530('0x4f'),_0xf530('0x50'),_0xf530('0x52'),_0xf530('0x56'),_0xf530('0x66'),_0xf530('0x53'),_0xf530('0x54'),_0xf530('0x55'),'phoneBarEnableScreenRecordingByAgent',_0xf530('0x60'),_0xf530('0x5e'),'onhold',_0xf530('0x5d'),_0xf530('0x5f')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields;
\ No newline at end of file