Built motion from commit be44e1e4d16f8b29d243415b03d27262d8601e0e. Version 3.0.0...
[motion-next.git] / server / services / ami / realtime / index.js
1 const a1091_0x342d=['ANSWERED','outboundAnswerAgiCallsDay','length','initFreshdeskAccounts','freshdeskAccounts','outboundAnswerCallsDay','../model/template','queuecallerleaveAt','channels','total','../model/trigger','outboundBusyCallsDay','initTelephones','initTriggers','outboundNoAnswerCallsDay','sumDuration','../model/faxAccount','answered','../model/servicenowAccount','dialQueueProject','sumBillable','faxAccounts','diff','zendeskAccounts','queuecallercompleteAt','seconds','ivrAnswerCallsDay','../model/dynamics365Account','telephones','merge','../model/campaign','outboundBlacklistCallsDay','freshsalesAccounts','queuecallerabandon','servicenowAccounts','queuecallerexitAt','outboundOriginateFailureCallsDay','zohoAccounts','billableseconds','isNil','voiceExtensions','outboundRejectCallsDay','util','groupBy','exports','initVoiceQueueReports','lodash','outboundCongestionCallsDay','unmanaged','isUndefined','uniqueid','prototype','../model/zohoAccount','triggers','vtigerAccounts','deskAccounts','trunks','dynamics365Accounts','name','initSugarcrmAccounts','initServicenowAccounts','../model/agent','initSalesforceAccounts','sugarcrmAccounts','SquareProject','disposition','format','initAgents','queueStatusComplete','outbound','initVoiceCallReports','queuecallercomplete','queueChannels','sumHoldTime','mapKeys','queue','../model/voiceExtension','initDynamics365Accounts','templates','outboundDropCallsDayCallersExit','salesforceAccounts','campaigns','agents','initVoiceQueueHopperHistory','abandoned','queuecallerjoinAt','interface','SIP/%s','mergeFromDatabase','outboundUnknownCallsDay','../model/trunk','../model/sugarcrmAccount','ivrTotalCallsDays','initVoiceExtensions','undefined','duration','isEmpty','voiceQueues','initZohoAccounts','queuecallerabandonAt'];(function(_0x5dfd82,_0x342df3){const _0x3ca429=function(_0x1453a3){while(--_0x1453a3){_0x5dfd82['push'](_0x5dfd82['shift']());}};_0x3ca429(++_0x342df3);}(a1091_0x342d,0x86));const a1091_0x3ca4=function(_0x5dfd82,_0x342df3){_0x5dfd82=_0x5dfd82-0x0;let _0x3ca429=a1091_0x342d[_0x5dfd82];return _0x3ca429;};const _0x28b907=a1091_0x3ca4;'use strict';const util=require(_0x28b907('0x8')),_=require(_0x28b907('0xc')),moment=require('moment'),Agent=require(_0x28b907('0x1b')),Telephone=require('../model/telephone'),Trunk=require(_0x28b907('0x38')),VoiceQueue=require('../model/voiceQueue'),Trigger=require(_0x28b907('0x4c')),Template=require(_0x28b907('0x48')),Campaign=require(_0x28b907('0x60')),VoiceExtension=require(_0x28b907('0x2a')),ZendeskAccount=require('../model/zendeskAccount'),SalesforceAccount=require('../model/salesforceAccount'),FreshdeskAccount=require('../model/freshdeskAccount'),SugarcrmAccount=require(_0x28b907('0x39')),ZohoAccount=require(_0x28b907('0x12')),DeskAccount=require('../model/deskAccount'),VtigerAccount=require('../model/vtigerAccount'),ServicenowAccount=require(_0x28b907('0x54')),Dynamics365Account=require(_0x28b907('0x5d')),FreshsalesAccount=require('../model/freshsalesAccount'),FaxAccount=require(_0x28b907('0x52')),Realtime=function(){const _0x5450ee=_0x28b907;this[_0x5450ee('0x30')]={},this['telephones']={},this['trunks']={},this[_0x5450ee('0x3f')]={},this['triggers']={},this[_0x5450ee('0x2f')]={},this[_0x5450ee('0x2c')]={},this[_0x5450ee('0x23')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0},this[_0x5450ee('0x6')]={},this[_0x5450ee('0x4a')]={},this[_0x5450ee('0x26')]={},this['outboundChannels']={},this['timers']={},this[_0x5450ee('0x59')]={},this[_0x5450ee('0x2e')]={},this['sugarcrmAccounts']={},this[_0x5450ee('0x46')]={},this[_0x5450ee('0x3')]={},this['deskAccounts']={},this[_0x5450ee('0x14')]={},this[_0x5450ee('0x0')]={},this[_0x5450ee('0x17')]={},this[_0x5450ee('0x62')]={},this[_0x5450ee('0x57')]={};};function freeIsNotKey(_0x1453a3,_0x1bd206,_0xda3e11){const _0x27f286=_0x28b907,_0x92df79=_[_0x27f286('0x28')](_0x1453a3,function(_0x46a335){return _0x46a335[_0xda3e11];});for(const _0x15651f in _0x1bd206){typeof _0x1bd206[_0x15651f]!==_0x27f286('0x3c')&&(!_0x92df79[_0x15651f]&&delete _0x1bd206[_0x15651f]);}}function freeIsNotKeySip(_0x41d930,_0x517907){const _0x13221a=_0x28b907,_0xc821c7=_[_0x13221a('0x28')](_0x41d930,function(_0x35d774){const _0x461aa7=_0x13221a;return util[_0x461aa7('0x20')](_0x461aa7('0x35'),_0x35d774[_0x461aa7('0x18')]);});for(const _0x2788ce in _0x517907){typeof _0x517907[_0x2788ce]!=='undefined'&&(!_0xc821c7[_0x2788ce]&&delete _0x517907[_0x2788ce]);}}function freeIsNotKeyAgent(_0x375fa3,_0xe1211f){const _0x455658=_0x28b907,_0x330c0b=_[_0x455658('0x28')](_0x375fa3,function(_0x513ba6){const _0x202f2a=_0x455658,_0x3d0db0=_[_0x202f2a('0x5')](_0x513ba6[_0x202f2a('0x34')])?util[_0x202f2a('0x20')]('SIP/%s',_0x513ba6[_0x202f2a('0x18')]):_0x513ba6['interface'];return _0x3d0db0;});for(const _0x266898 in _0xe1211f){typeof _0xe1211f[_0x266898]!=='undefined'&&(!_0x330c0b[_0x266898]&&delete _0xe1211f[_0x266898]);}}function clearVoiceCallReports(_0x44c93b){const _0x140bdc=_0x28b907;_0x44c93b[_0x140bdc('0x4b')]=0x0,_0x44c93b[_0x140bdc('0x53')]=0x0,_0x44c93b[_0x140bdc('0x27')]=0x0,_0x44c93b[_0x140bdc('0x51')]=0x0,_0x44c93b[_0x140bdc('0x56')]=0x0;}function clearCampaigns(_0x1e0f3d){const _0x60dc6b=_0x28b907;if(!_[_0x60dc6b('0x3e')](_0x1e0f3d))for(const _0x3b673e in _0x1e0f3d){typeof _0x1e0f3d[_0x3b673e]!==_0x60dc6b('0x3c')&&(_0x1e0f3d[_0x3b673e][_0x60dc6b('0x3a')]=0x0,_0x1e0f3d[_0x3b673e][_0x60dc6b('0x5c')]=0x0);}}function clearVoiceQueues(_0x15afe6){const _0x441ad4=_0x28b907;if(!_['isEmpty'](_0x15afe6))for(const _0x3d615c in _0x15afe6){typeof _0x15afe6[_0x3d615c]!==_0x441ad4('0x3c')&&(_0x15afe6[_0x3d615c][_0x441ad4('0x4b')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x53')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0xe')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x32')]=0x0,_0x15afe6[_0x3d615c]['sumHoldTime']=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x51')]=0x0,_0x15afe6[_0x3d615c]['sumBillable']=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x43')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x50')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x4d')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0xd')]=0x0,_0x15afe6[_0x3d615c]['outboundNoSuchCallsDay']=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x37')]=0x0,_0x15afe6[_0x3d615c]['outboundDropCallsDayTimeout']=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x2d')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x61')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x2')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x7')]=0x0,_0x15afe6[_0x3d615c]['outboundReCallsDay']=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x43')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x47')]=0x0,_0x15afe6[_0x3d615c][_0x441ad4('0x22')]=!![]);}}Realtime[_0x28b907('0x11')]['mergeFromDatabase']=function(_0x2dd79b,_0x3641bf){const _0x5d5568=_0x28b907;for(const _0x563418 in _0x3641bf){typeof _0x2dd79b[_0x563418]!==_0x5d5568('0x3c')&&(_0x2dd79b[_0x563418]=_0x3641bf[_0x563418]);}},Realtime[_0x28b907('0x11')][_0x28b907('0x21')]=function(){const _0x4ffdeb=this;return function(_0x5b646e){const _0x5b78dd=a1091_0x3ca4;if(_0x5b646e){freeIsNotKeyAgent(_0x5b646e,_0x4ffdeb[_0x5b78dd('0x30')]);for(let _0x18570b=0x0,_0x2f61e7={};_0x18570b<_0x5b646e[_0x5b78dd('0x44')];_0x18570b+=0x1){_0x2f61e7=_0x5b646e[_0x18570b];const _0x12a082=_[_0x5b78dd('0x5')](_0x2f61e7[_0x5b78dd('0x34')])?util['format'](_0x5b78dd('0x35'),_0x2f61e7[_0x5b78dd('0x18')]):_0x2f61e7['interface'];_['isUndefined'](_0x4ffdeb['agents'][_0x12a082])?_0x4ffdeb[_0x5b78dd('0x30')][_0x12a082]=new Agent(_0x2f61e7):_0x4ffdeb[_0x5b78dd('0x36')](_0x4ffdeb[_0x5b78dd('0x30')][_0x12a082],_0x2f61e7);}}return _0x4ffdeb[_0x5b78dd('0x30')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x4e')]=function(){const _0x279197=this;return function(_0x51903e){const _0x4a2c33=a1091_0x3ca4;if(_0x51903e){freeIsNotKeySip(_0x51903e,_0x279197[_0x4a2c33('0x5e')]);for(let _0x44b025=0x0,_0x57d840={};_0x44b025<_0x51903e[_0x4a2c33('0x44')];_0x44b025+=0x1){_0x57d840=_0x51903e[_0x44b025],_[_0x4a2c33('0xf')](_0x279197[_0x4a2c33('0x5e')][util[_0x4a2c33('0x20')](_0x4a2c33('0x35'),_0x57d840[_0x4a2c33('0x18')])])?_0x279197['telephones'][util[_0x4a2c33('0x20')](_0x4a2c33('0x35'),_0x57d840[_0x4a2c33('0x18')])]=new Telephone(_0x57d840):_0x279197[_0x4a2c33('0x36')](_0x279197[_0x4a2c33('0x5e')][util[_0x4a2c33('0x20')](_0x4a2c33('0x35'),_0x57d840[_0x4a2c33('0x18')])],_0x57d840);}}return _0x279197['telephones'];};},Realtime[_0x28b907('0x11')]['initTrunks']=function(){const _0x36109f=this;return function(_0x132257){const _0x8ce12f=a1091_0x3ca4;if(_0x132257){freeIsNotKeySip(_0x132257,_0x36109f[_0x8ce12f('0x16')]);for(let _0x2c2fc6=0x0,_0x11e2bc={};_0x2c2fc6<_0x132257['length'];_0x2c2fc6+=0x1){_0x11e2bc=_0x132257[_0x2c2fc6],_[_0x8ce12f('0xf')](_0x36109f['trunks'][util[_0x8ce12f('0x20')](_0x8ce12f('0x35'),_0x11e2bc['name'])])?_0x36109f[_0x8ce12f('0x16')][util[_0x8ce12f('0x20')](_0x8ce12f('0x35'),_0x11e2bc[_0x8ce12f('0x18')])]=new Trunk(_0x11e2bc):_0x36109f[_0x8ce12f('0x36')](_0x36109f['trunks'][util[_0x8ce12f('0x20')](_0x8ce12f('0x35'),_0x11e2bc[_0x8ce12f('0x18')])],_0x11e2bc);}}return _0x36109f['trunks'];};},Realtime[_0x28b907('0x11')]['initVoiceQueues']=function(){const _0x4803cb=this;return function(_0x3e654c){const _0x48f6f5=a1091_0x3ca4;if(_0x3e654c){freeIsNotKey(_0x3e654c,_0x4803cb[_0x48f6f5('0x3f')],'name');for(let _0x10d9a9=0x0,_0x234485={};_0x10d9a9<_0x3e654c[_0x48f6f5('0x44')];_0x10d9a9+=0x1){_0x234485=_0x3e654c[_0x10d9a9],_['isUndefined'](_0x4803cb[_0x48f6f5('0x3f')][_0x234485[_0x48f6f5('0x18')]])?_0x4803cb[_0x48f6f5('0x3f')][_0x234485['name']]=new VoiceQueue(_0x234485):_0x4803cb[_0x48f6f5('0x36')](_0x4803cb[_0x48f6f5('0x3f')][_0x234485[_0x48f6f5('0x18')]],_0x234485);}}return _0x4803cb[_0x48f6f5('0x3f')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x4f')]=function(){const _0x3b7bd1=this;return function(_0x1a94a7){const _0x150462=a1091_0x3ca4;if(_0x1a94a7){freeIsNotKey(_0x1a94a7,_0x3b7bd1['triggers'],'id');for(let _0x2104b1=0x0,_0x4ccba5={};_0x2104b1<_0x1a94a7[_0x150462('0x44')];_0x2104b1+=0x1){_0x4ccba5=_0x1a94a7[_0x2104b1],_[_0x150462('0xf')](_0x3b7bd1[_0x150462('0x13')][_0x4ccba5['id']])?_0x3b7bd1[_0x150462('0x13')][_0x4ccba5['id']]=new Trigger(_0x4ccba5):_0x3b7bd1[_0x150462('0x36')](_0x3b7bd1[_0x150462('0x13')][_0x4ccba5['id']],_0x4ccba5);}}return _0x3b7bd1[_0x150462('0x13')];};},Realtime[_0x28b907('0x11')]['initTemplates']=function(){const _0x443ff0=this;return function(_0x4448ca){const _0x9ce745=a1091_0x3ca4;if(_0x4448ca){freeIsNotKey(_0x4448ca,_0x443ff0['templates'],'id');for(let _0x193cf5=0x0,_0x2ba3f5={};_0x193cf5<_0x4448ca['length'];_0x193cf5+=0x1){_0x2ba3f5=_0x4448ca[_0x193cf5],_[_0x9ce745('0xf')](_0x443ff0[_0x9ce745('0x2c')][_0x2ba3f5['id']])?_0x443ff0[_0x9ce745('0x2c')][_0x2ba3f5['id']]=new Template(_0x2ba3f5):_0x443ff0[_0x9ce745('0x36')](_0x443ff0[_0x9ce745('0x2c')][_0x2ba3f5['id']],_0x2ba3f5);}}return _0x443ff0[_0x9ce745('0x2c')];};},Realtime[_0x28b907('0x11')]['initZendeskAccounts']=function(){const _0x510a08=this;return function(_0x181e4d){const _0x2c45fe=a1091_0x3ca4;if(_0x181e4d){freeIsNotKey(_0x181e4d,_0x510a08[_0x2c45fe('0x59')],'id');for(let _0x3170e2=0x0,_0x3decb8={};_0x3170e2<_0x181e4d[_0x2c45fe('0x44')];_0x3170e2+=0x1){_0x3decb8=_0x181e4d[_0x3170e2],_[_0x2c45fe('0xf')](_0x510a08[_0x2c45fe('0x59')][_0x3decb8['id']])?_0x510a08[_0x2c45fe('0x59')][_0x3decb8['id']]=new ZendeskAccount(_0x3decb8):_0x510a08[_0x2c45fe('0x36')](_0x510a08[_0x2c45fe('0x59')][_0x3decb8['id']],_0x3decb8);}}return _0x510a08['zendeskAccounts'];};},Realtime[_0x28b907('0x11')][_0x28b907('0x1c')]=function(){const _0x158a6c=this;return function(_0x1bf564){const _0xd86f59=a1091_0x3ca4;if(_0x1bf564){freeIsNotKey(_0x1bf564,_0x158a6c[_0xd86f59('0x2e')],'id');for(let _0x42198d=0x0,_0x2ca1c4={};_0x42198d<_0x1bf564[_0xd86f59('0x44')];_0x42198d+=0x1){_0x2ca1c4=_0x1bf564[_0x42198d],_[_0xd86f59('0xf')](_0x158a6c[_0xd86f59('0x2e')][_0x2ca1c4['id']])?_0x158a6c[_0xd86f59('0x2e')][_0x2ca1c4['id']]=new SalesforceAccount(_0x2ca1c4):_0x158a6c[_0xd86f59('0x36')](_0x158a6c[_0xd86f59('0x2e')][_0x2ca1c4['id']],_0x2ca1c4);}}return _0x158a6c[_0xd86f59('0x2e')];};},Realtime['prototype'][_0x28b907('0x45')]=function(){const _0x3b500d=this;return function(_0x453503){const _0x2e973a=a1091_0x3ca4;if(_0x453503){freeIsNotKey(_0x453503,_0x3b500d[_0x2e973a('0x46')],'id');for(let _0x14899e=0x0,_0x38cb12={};_0x14899e<_0x453503['length'];_0x14899e+=0x1){_0x38cb12=_0x453503[_0x14899e],_[_0x2e973a('0xf')](_0x3b500d['freshdeskAccounts'][_0x38cb12['id']])?_0x3b500d[_0x2e973a('0x46')][_0x38cb12['id']]=new FreshdeskAccount(_0x38cb12):_0x3b500d[_0x2e973a('0x36')](_0x3b500d['freshdeskAccounts'][_0x38cb12['id']],_0x38cb12);}}return _0x3b500d[_0x2e973a('0x46')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x40')]=function(){const _0xdc3192=this;return function(_0x5aaef7){const _0x3659c0=a1091_0x3ca4;if(_0x5aaef7){freeIsNotKey(_0x5aaef7,_0xdc3192[_0x3659c0('0x3')],'id');for(let _0x5c7bec=0x0,_0x335a56={};_0x5c7bec<_0x5aaef7['length'];_0x5c7bec+=0x1){_0x335a56=_0x5aaef7[_0x5c7bec],_['isUndefined'](_0xdc3192[_0x3659c0('0x3')][_0x335a56['id']])?_0xdc3192[_0x3659c0('0x3')][_0x335a56['id']]=new ZohoAccount(_0x335a56):_0xdc3192['mergeFromDatabase'](_0xdc3192['zohoAccounts'][_0x335a56['id']],_0x335a56);}}return _0xdc3192[_0x3659c0('0x3')];};},Realtime['prototype']['initDeskAccounts']=function(){const _0x5ba9fb=this;return function(_0x208348){const _0x28b818=a1091_0x3ca4;if(_0x208348){freeIsNotKey(_0x208348,_0x5ba9fb['deskAccounts'],'id');for(let _0x2a9698=0x0,_0x5caaf0={};_0x2a9698<_0x208348[_0x28b818('0x44')];_0x2a9698+=0x1){_0x5caaf0=_0x208348[_0x2a9698],_[_0x28b818('0xf')](_0x5ba9fb[_0x28b818('0x15')][_0x5caaf0['id']])?_0x5ba9fb['deskAccounts'][_0x5caaf0['id']]=new DeskAccount(_0x5caaf0):_0x5ba9fb['mergeFromDatabase'](_0x5ba9fb[_0x28b818('0x15')][_0x5caaf0['id']],_0x5caaf0);}}return _0x5ba9fb[_0x28b818('0x15')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x19')]=function(){const _0x32198=this;return function(_0x635d98){const _0x23715d=a1091_0x3ca4;if(_0x635d98){freeIsNotKey(_0x635d98,_0x32198[_0x23715d('0x1d')],'id');for(let _0x1b93f4=0x0,_0x5d5c43={};_0x1b93f4<_0x635d98['length'];_0x1b93f4+=0x1){_0x5d5c43=_0x635d98[_0x1b93f4],_[_0x23715d('0xf')](_0x32198['sugarcrmAccounts'][_0x5d5c43['id']])?_0x32198[_0x23715d('0x1d')][_0x5d5c43['id']]=new SugarcrmAccount(_0x5d5c43):_0x32198['mergeFromDatabase'](_0x32198[_0x23715d('0x1d')][_0x5d5c43['id']],_0x5d5c43);}}return _0x32198[_0x23715d('0x1d')];};},Realtime[_0x28b907('0x11')]['initVtigerAccounts']=function(){const _0x5accc4=this;return function(_0x3e9012){const _0x4f7efa=a1091_0x3ca4;if(_0x3e9012){freeIsNotKey(_0x3e9012,_0x5accc4[_0x4f7efa('0x14')],'id');for(let _0x5e7393=0x0,_0x5ba19f={};_0x5e7393<_0x3e9012['length'];_0x5e7393+=0x1){_0x5ba19f=_0x3e9012[_0x5e7393],_['isUndefined'](_0x5accc4['vtigerAccounts'][_0x5ba19f['id']])?_0x5accc4[_0x4f7efa('0x14')][_0x5ba19f['id']]=new VtigerAccount(_0x5ba19f):_0x5accc4[_0x4f7efa('0x36')](_0x5accc4[_0x4f7efa('0x14')][_0x5ba19f['id']],_0x5ba19f);}}return _0x5accc4[_0x4f7efa('0x14')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x1a')]=function(){const _0x2c216e=this;return function(_0x40342e){const _0x46bb4c=a1091_0x3ca4;if(_0x40342e){freeIsNotKey(_0x40342e,_0x2c216e['servicenowAccounts'],'id');for(let _0x5930e6=0x0,_0x4a4393={};_0x5930e6<_0x40342e[_0x46bb4c('0x44')];_0x5930e6+=0x1){_0x4a4393=_0x40342e[_0x5930e6],_[_0x46bb4c('0xf')](_0x2c216e['servicenowAccounts'][_0x4a4393['id']])?_0x2c216e[_0x46bb4c('0x0')][_0x4a4393['id']]=new ServicenowAccount(_0x4a4393):_0x2c216e[_0x46bb4c('0x36')](_0x2c216e['servicenowAccounts'][_0x4a4393['id']],_0x4a4393);}}return _0x2c216e[_0x46bb4c('0x0')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x2b')]=function(){const _0x2cc6e4=this;return function(_0x598a2e){const _0x2912ef=a1091_0x3ca4;if(_0x598a2e){freeIsNotKey(_0x598a2e,_0x2cc6e4['dynamics365Accounts'],'id');for(let _0x2ca24a=0x0,_0x26f46f={};_0x2ca24a<_0x598a2e['length'];_0x2ca24a+=0x1){_0x26f46f=_0x598a2e[_0x2ca24a],_['isUndefined'](_0x2cc6e4['dynamics365Accounts'][_0x26f46f['id']])?_0x2cc6e4[_0x2912ef('0x17')][_0x26f46f['id']]=new Dynamics365Account(_0x26f46f):_0x2cc6e4['mergeFromDatabase'](_0x2cc6e4[_0x2912ef('0x17')][_0x26f46f['id']],_0x26f46f);}}return _0x2cc6e4['dynamics365Accounts'];};},Realtime[_0x28b907('0x11')]['initFreshsalesAccounts']=function(){const _0x107e71=this;return function(_0x56eb17){const _0x19b022=a1091_0x3ca4;if(_0x56eb17){freeIsNotKey(_0x56eb17,_0x107e71[_0x19b022('0x62')],'id');for(let _0x527fab=0x0,_0x40711b={};_0x527fab<_0x56eb17[_0x19b022('0x44')];_0x527fab+=0x1){_0x40711b=_0x56eb17[_0x527fab],_[_0x19b022('0xf')](_0x107e71[_0x19b022('0x62')][_0x40711b['id']])?_0x107e71[_0x19b022('0x62')][_0x40711b['id']]=new FreshsalesAccount(_0x40711b):_0x107e71[_0x19b022('0x36')](_0x107e71[_0x19b022('0x62')][_0x40711b['id']],_0x40711b);}}return _0x107e71[_0x19b022('0x62')];};},Realtime['prototype'][_0x28b907('0x31')]=function(){const _0x5bd950=this;return function(_0x2eb62d){const _0x3ae798=a1091_0x3ca4;for(let _0x353c74=0x0;_0x353c74<_0x2eb62d[_0x3ae798('0x44')];_0x353c74+=0x1){_[_0x3ae798('0x5f')](_0x5bd950['voiceQueues'][_0x2eb62d[_0x353c74][_0x3ae798('0x18')]],_0x2eb62d[_0x353c74]);}return _0x5bd950[_0x3ae798('0x3f')];};},Realtime[_0x28b907('0x11')][_0x28b907('0xb')]=function(){const _0xd0260c=this;return function(_0x5d9eca){const _0x47ebbe=a1091_0x3ca4;clearVoiceQueues(_0xd0260c['voiceQueues']);if(_0x5d9eca){_0x5d9eca=_[_0x47ebbe('0x9')](_0x5d9eca,_0x47ebbe('0x10'));for(const _0x2006e4 in _0x5d9eca){if(typeof _0x5d9eca[_0x2006e4]!==_0x47ebbe('0x3c'))for(let _0x57f5d4=0x0;_0x57f5d4<_0x5d9eca[_0x2006e4][_0x47ebbe('0x44')];_0x57f5d4+=0x1){const _0x439e9f=_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x29')];_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f]&&(_0x5d9eca[_0x2006e4][_0x57f5d4]['queuecallerexit']&&(_0xd0260c['voiceQueues'][_0x439e9f][_0x47ebbe('0xe')]+=0x1),_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x63')]&&(_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f][_0x47ebbe('0x32')]+=0x1),_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f][_0x47ebbe('0x27')]+=moment(_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x49')])[_0x47ebbe('0x58')](moment(_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x33')]),_0x47ebbe('0x5b'))||0x0,_0x57f5d4===_0x5d9eca[_0x2006e4][_0x47ebbe('0x44')]-0x1?(_0xd0260c['voiceQueues'][_0x439e9f][_0x47ebbe('0x51')]+=moment(_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x5a')]||_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x41')]||_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x1')])[_0x47ebbe('0x58')](moment(_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x33')]),_0x47ebbe('0x5b'))||0x0,_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f][_0x47ebbe('0x4b')]+=0x1,_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x25')]&&(_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f]['answered']+=0x1,_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f]['sumBillable']+=moment(_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x5a')])[_0x47ebbe('0x58')](moment(_0x5d9eca[_0x2006e4][_0x57f5d4][_0x47ebbe('0x49')]),_0x47ebbe('0x5b'))||0x0)):_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f][_0x47ebbe('0x51')]+=_0xd0260c[_0x47ebbe('0x3f')][_0x439e9f][_0x47ebbe('0x27')]||0x0);}}}return _0xd0260c['voiceQueues'];};},Realtime[_0x28b907('0x11')][_0x28b907('0x24')]=function(){const _0x1c40e0=this;return function(_0x49cdb5){const _0x13f4db=a1091_0x3ca4;clearVoiceCallReports(_0x1c40e0['outbound']);if(_0x49cdb5)for(let _0x4709a0=0x0;_0x4709a0<_0x49cdb5[_0x13f4db('0x44')];_0x4709a0+=0x1){_0x1c40e0[_0x13f4db('0x23')][_0x13f4db('0x4b')]+=0x1,_0x1c40e0[_0x13f4db('0x23')]['sumDuration']+=_0x49cdb5[_0x4709a0]['duration'],_0x49cdb5[_0x4709a0][_0x13f4db('0x1f')]===_0x13f4db('0x42')&&(_0x1c40e0[_0x13f4db('0x23')]['answered']+=0x1,_0x1c40e0['outbound'][_0x13f4db('0x27')]+=_0x49cdb5[_0x4709a0][_0x13f4db('0x3d')]-_0x49cdb5[_0x4709a0][_0x13f4db('0x4')]||0x0,_0x1c40e0[_0x13f4db('0x23')][_0x13f4db('0x56')]+=_0x49cdb5[_0x4709a0]['billableseconds']);}return _0x1c40e0['outbound'];};},Realtime[_0x28b907('0x11')]['initCampaigns']=function(){const _0x5d371f=this;return function(_0x4fad3b){const _0x334020=a1091_0x3ca4;if(_0x4fad3b){freeIsNotKey(_0x4fad3b,_0x5d371f[_0x334020('0x2f')],_0x334020('0x18'));for(let _0x157137=0x0,_0xe52d69={};_0x157137<_0x4fad3b[_0x334020('0x44')];_0x157137+=0x1){_0xe52d69=_0x4fad3b[_0x157137],_[_0x334020('0xf')](_0x5d371f['campaigns'][_0xe52d69[_0x334020('0x18')]])?_0x5d371f[_0x334020('0x2f')][_0xe52d69[_0x334020('0x18')]]=new Campaign(_0xe52d69):(_0x5d371f['mergeFromDatabase'](_0x5d371f[_0x334020('0x2f')][_0xe52d69[_0x334020('0x18')]],_0xe52d69),_0x5d371f[_0x334020('0x2f')][_0xe52d69[_0x334020('0x18')]][_0x334020('0x55')]=_0xe52d69[_0x334020('0x1e')]?_0xe52d69[_0x334020('0x1e')][_0x334020('0x18')]:undefined);}}return _0x5d371f[_0x334020('0x2f')];};},Realtime[_0x28b907('0x11')][_0x28b907('0x3b')]=function(){const _0x9b8f8c=this;return function(_0x1d0a22){const _0x4f885d=a1091_0x3ca4;if(_0x1d0a22){freeIsNotKey(_0x1d0a22,_0x9b8f8c[_0x4f885d('0x6')],'id');for(let _0x4028de=0x0,_0x346c4a={};_0x4028de<_0x1d0a22[_0x4f885d('0x44')];_0x4028de+=0x1){_0x346c4a=_0x1d0a22[_0x4028de],_[_0x4f885d('0xf')](_0x9b8f8c[_0x4f885d('0x6')][_0x346c4a['id']])?_0x9b8f8c[_0x4f885d('0x6')][_0x346c4a['id']]=new VoiceExtension(_0x346c4a):_0x9b8f8c[_0x4f885d('0x36')](_0x9b8f8c[_0x4f885d('0x6')][_0x346c4a['id']],_0x346c4a);}}return _0x9b8f8c['voiceExtensions'];};},Realtime[_0x28b907('0x11')]['initCampaignHopperHistory']=function(){const _0x18c415=this;return function(_0x498e40){const _0x56c62e=a1091_0x3ca4;clearCampaigns(_0x18c415[_0x56c62e('0x2f')]);for(let _0x5882d5=0x0;_0x5882d5<_0x498e40[_0x56c62e('0x44')];_0x5882d5+=0x1){_[_0x56c62e('0x5f')](_0x18c415[_0x56c62e('0x2f')][_0x498e40[_0x5882d5][_0x56c62e('0x18')]],_0x498e40[_0x5882d5]);}return _0x18c415[_0x56c62e('0x2f')];};},Realtime[_0x28b907('0x11')]['initFaxAccounts']=function(){const _0x2a4ec1=this;return function(_0x471af9){const _0x401fc7=a1091_0x3ca4;if(_0x471af9){freeIsNotKey(_0x471af9,_0x2a4ec1[_0x401fc7('0x57')],'id');for(let _0x3b078e=0x0,_0x2f4304={};_0x3b078e<_0x471af9[_0x401fc7('0x44')];_0x3b078e+=0x1){_0x2f4304=_0x471af9[_0x3b078e],_['isUndefined'](_0x2a4ec1['faxAccounts'][_0x2f4304['id']])?_0x2a4ec1['faxAccounts'][_0x2f4304['id']]=new FaxAccount(_0x2f4304):_0x2a4ec1[_0x401fc7('0x36')](_0x2a4ec1[_0x401fc7('0x57')][_0x2f4304['id']],_0x2f4304);}}return _0x2a4ec1[_0x401fc7('0x57')];};},module[_0x28b907('0xa')]=Realtime;