Built motion from commit ff78e754.|2.6.29
[motion2.git] / server / api / userProfile / userProfile.model.js
index d2bb65d..3df5aff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c7f=['query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','intersection','fields','attributes','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','reportId','DefaultReports','custom','CustomReports','count','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','findAll','openTabs','true','chat','rows','dataValues','fax','openchannel','whatsapp','squel','models','filter','then','map','field','value','model','name','resolve','UserProfileResource','AnalyticExtractedReport','associatedResources','resourceId','type','catch','toLowerCase','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','parentSections','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','Tag','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','user_has_','_interactions','where','sequelize'];(function(_0x5b6937,_0x53154f){var _0x26c339=function(_0x20400d){while(--_0x20400d){_0x5b6937['push'](_0x5b6937['shift']());}};_0x26c339(++_0x53154f);}(_0x8c7f,0x103));var _0xf8c7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c7f[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require(_0xf8c7('0x0'));module['exports']=function(_0x1cd5a5){var _0x4a6fbd=_0x1cd5a5[_0xf8c7('0x1')];function _0x3ca562(_0x392ac0,_0x55a054){return new Promise(function(_0x523339,_0xc25261){if(!_0x55a054)return _0x523339(null);var _0x251095=_0x55a054['filter']?{[_0x55a054[_0xf8c7('0x2')]['field']]:_0x55a054[_0xf8c7('0x2')]['value']}:undefined;return _0x4a6fbd[_0x392ac0]['findAll']({'where':_0x251095,'raw':!![]})[_0xf8c7('0x3')](function(_0x10514d){_0x55a054['associatedResources']=_[_0xf8c7('0x4')](_0x10514d,'id');_0x523339(_0x55a054);})['catch'](function(_0x1ecbe4){_0xc25261(_0x1ecbe4);});});}function _0x3de4ab(_0x9cc075,_0x42a0bf){return new Promise(function(_0x268e4b,_0xc875d3){var _0x5d2273=_0x9cc075[_0xf8c7('0x2')]?{[_0x9cc075[_0xf8c7('0x2')][_0xf8c7('0x5')]]:_0x9cc075['filter'][_0xf8c7('0x6')]}:undefined;return _0x4a6fbd[_0x9cc075[_0xf8c7('0x7')]]['findAll']({'where':_0x5d2273,'raw':!![]})[_0xf8c7('0x3')](function(_0x5a8dda){_0x42a0bf['associatedResources']=_[_0xf8c7('0x4')](_0x5a8dda,function(_0x3d8933){return _0x3d8933[_0xf8c7('0x8')];});_0x268e4b(_0x42a0bf);})['catch'](function(_0x291785){_0xc875d3(_0x291785);});});}function _0x585459(_0x1cebf5,_0x368786,_0x4d76ec){if(!_0x368786)return Promise[_0xf8c7('0x9')](null);return new Promise(function(_0x504e26,_0x365ce0){return _0x4a6fbd[_0xf8c7('0xa')]['findAll']({'where':{'sectionId':_0x368786['id']},'raw':!![]})['then'](function(_0x481a13){if(_0x1cebf5[_0xf8c7('0x5')]&&_0x1cebf5['field']!=='id'){_0x368786['associatedResources']=_[_0xf8c7('0x4')](_0x481a13,function(_0x1747af){return _0x1747af[_0x1cebf5[_0xf8c7('0x5')]];});}else{if(_0x4d76ec===_0xf8c7('0xb')){_0x368786[_0xf8c7('0xc')]=_['map'](_0x481a13,function(_0x53dee2){return{'id':_0x53dee2[_0xf8c7('0xd')],'type':_0x53dee2[_0xf8c7('0xe')]};});}else{_0x368786[_0xf8c7('0xc')]=_[_0xf8c7('0x4')](_0x481a13,function(_0x537d13){return _0x537d13[_0xf8c7('0xd')];});}}_0x504e26(_0x368786);})[_0xf8c7('0xf')](function(_0x38dc4d){_0x365ce0(_0x38dc4d);});});}function _0x16e0e0(_0x196eba,_0x25734a){var _0xf8b4ae={'parentSections':[]};switch(_0x196eba[_0xf8c7('0x10')]()){case'squareprojects':_0xf8b4ae[_0xf8c7('0x11')]='SquareProject';break;case _0xf8c7('0x12'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x13');break;case _0xf8c7('0x14'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x15');_0xf8b4ae['parentSections']=[{'name':_0xf8c7('0x16'),'field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x17')}];break;case _0xf8c7('0x18'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x19');break;case _0xf8c7('0x1a'):_0xf8b4ae['childModel']='CmContact';_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x1c'),'field':'id','foreignKey':_0xf8c7('0x1d')}];break;case _0xf8c7('0x1e'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x1f');break;case'companies':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x20');break;case _0xf8c7('0x21'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x22');break;case _0xf8c7('0x23'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x24');break;case'chatwebsites':_0xf8b4ae[_0xf8c7('0x11')]='ChatWebsite';break;case _0xf8c7('0x25'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x26');break;case _0xf8c7('0x27'):_0xf8b4ae[_0xf8c7('0x11')]='FaxAccount';break;case _0xf8c7('0x28'):case'internalroutes':case _0xf8c7('0x29'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x2a');break;case _0xf8c7('0x2b'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x2c');break;case _0xf8c7('0x2d'):_0xf8b4ae['childModel']=_0xf8c7('0x2e');break;case'voicerecordings':_0xf8b4ae['childModel']=_0xf8c7('0x2f');_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x30'),'field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x31'),'model':_0xf8c7('0x32'),'filter':{'field':_0xf8c7('0x33'),'value':['agent']}},{'name':'Telephones','field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x31'),'model':_0xf8c7('0x32'),'filter':{'field':_0xf8c7('0x33'),'value':[_0xf8c7('0x34')]}},{'name':_0xf8c7('0x35'),'field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x36'),'model':_0xf8c7('0x37'),'filter':{'field':_0xf8c7('0xe'),'value':['inbound']}},{'name':_0xf8c7('0x38'),'field':'name','foreignKey':_0xf8c7('0x36'),'model':'VoiceQueue','filter':{'field':_0xf8c7('0xe'),'value':[_0xf8c7('0x39')]}}];break;case _0xf8c7('0x3a'):_0xf8b4ae['childModel']=_0xf8c7('0x3b');break;case _0xf8c7('0x3c'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x3d');break;case'voiceprefixes':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x3e');break;case _0xf8c7('0x3f'):_0xf8b4ae['childModel']='Campaign';break;case'mailqueues':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x40');break;case _0xf8c7('0x41'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x42');break;case'mailsubstatuses':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x43');break;case _0xf8c7('0x44'):_0xf8b4ae['childModel']='OpenchannelQueue';break;case _0xf8c7('0x45'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x46');break;case _0xf8c7('0x47'):_0xf8b4ae[_0xf8c7('0x11')]='SmsQueue';break;case _0xf8c7('0x48'):_0xf8b4ae['childModel']=_0xf8c7('0x49');break;case _0xf8c7('0x4a'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x4b');break;case _0xf8c7('0x4c'):_0xf8b4ae['childModel']='WhatsappAccount';break;case _0xf8c7('0x4d'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x4e');break;case'voicequeues':case _0xf8c7('0x4f'):_0xf8b4ae['childModel']='VoiceQueue';if(_0x25734a){_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x35')},{'name':_0xf8c7('0x38')}];}break;case'users':case _0xf8c7('0x50'):case _0xf8c7('0x51'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x32');if(_0x25734a){_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x52'),'filter':{'field':_0xf8c7('0x33'),'value':[_0xf8c7('0x53'),_0xf8c7('0x54')]},'ignore':!![]},{'name':_0xf8c7('0x30')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x55');break;case _0xf8c7('0x56'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x57');break;case'freshdeskaccounts':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x58');break;case _0xf8c7('0x59'):_0xf8b4ae['childModel']=_0xf8c7('0x5a');break;case _0xf8c7('0x5b'):_0xf8b4ae['childModel']=_0xf8c7('0x5c');break;case'zohoaccounts':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x5d');break;case _0xf8c7('0x5e'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x32');break;case _0xf8c7('0x5f'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x60');break;case _0xf8c7('0x61'):_0xf8b4ae['childModel']=_0xf8c7('0x62');break;case _0xf8c7('0x63'):_0xf8b4ae['childModel']=_0xf8c7('0x64');break;case _0xf8c7('0x65'):_0xf8b4ae[_0xf8c7('0x11')]='Interval';break;case _0xf8c7('0x66'):_0xf8b4ae['childModel']=_0xf8c7('0x67');break;case _0xf8c7('0x68'):_0xf8b4ae['childModel']=_0xf8c7('0x69');break;case _0xf8c7('0x6a'):_0xf8b4ae['childModel']='Sound';break;case'tags':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x6b');break;case'templates':_0xf8b4ae['childModel']=_0xf8c7('0x6c');break;case _0xf8c7('0x6d'):_0xf8b4ae['childModel']='Trigger';break;case _0xf8c7('0x6e'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x6f');break;case _0xf8c7('0x70'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x71');break;case _0xf8c7('0x72'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x73');break;case _0xf8c7('0x74'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0xb');_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x75'),'field':'id','foreignKey':'reportId'}];break;case _0xf8c7('0x76'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x77');break;}return _0xf8b4ae;}function _0x555ea3(_0x163a8c,_0x2679c8){var _0x16f9b9=_0x163a8c[_0xf8c7('0x78')](0x0)[_0xf8c7('0x79')]()+_0x163a8c[_0xf8c7('0x7a')](0x1);var _0x54b0df={'type':_0x4a6fbd[_0xf8c7('0x7b')][_0xf8c7('0x7c')][_0xf8c7('0x7d')],'raw':!![]};return new Promise(function(_0x5e0058,_0x2ea19c){var _0x2734cf=squel[_0xf8c7('0x7e')]()[_0xf8c7('0x5')]('ui.'+_0x16f9b9+_0xf8c7('0x7f'),'id')[_0xf8c7('0x5')](_0xf8c7('0x80'))['from'](_0xf8c7('0x81')+_0x163a8c+_0xf8c7('0x82'),'ui')[_0xf8c7('0x83')]('ui.UserId\x20=\x20?',_0x2679c8['id']);return _0x4a6fbd[_0xf8c7('0x84')][_0xf8c7('0x85')](_0x2734cf[_0xf8c7('0x86')](),_0x54b0df)[_0xf8c7('0x3')](function(_0x36f980){_0x2679c8[_0x16f9b9+_0xf8c7('0x87')]=_0x36f980;_0x5e0058(_0x36f980);})[_0xf8c7('0xf')](function(_0x4ae198){_0x2ea19c(_0x4ae198);});});}return _0x1cd5a5['define'](_0xf8c7('0x88'),attributes,{'tableName':_0xf8c7('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x46c728){var _0x4e3319=require(_0xf8c7('0x8a'));var _0xf21eeb={'raw':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x8b')],'where':{}};var _0x56846b={};var _0x654f8d={'count':0x0,'rows':[]};var _0x18a384=_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x8c')];var _0x3b232f=_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x8d')]||![];var _0x3b3e0b=_0x16e0e0(_0x18a384,_0x3b232f);if(!_0x3b3e0b[_0xf8c7('0x11')])throw new Error(_0xf8c7('0x8e')+_0x18a384+'\x27');var _0x1ab5c3=[{'name':_0x18a384}];if(!_[_0xf8c7('0x8f')](_0x3b3e0b[_0xf8c7('0x1b')]))_0x1ab5c3=_0x3b3e0b[_0xf8c7('0x1b')];var _0x25faf5=[];for(var _0x26f62f=0x0;_0x26f62f<_0x1ab5c3[_0xf8c7('0x90')];_0x26f62f++){_0x25faf5[_0xf8c7('0x91')](_0x4a6fbd[_0xf8c7('0x92')][_0xf8c7('0x93')]({'where':{'userProfileId':_0x46c728[_0xf8c7('0x94')]['id'],'name':_0x1ab5c3[_0x26f62f][_0xf8c7('0x8')]},'raw':!![]}));}return Promise[_0xf8c7('0x95')](_0x25faf5)[_0xf8c7('0x3')](function(_0x40af24){var _0x2034af=_[_0xf8c7('0x2')](_0x40af24,function(_0x523914){return _0x523914?_0x523914:undefined;});var _0x4687af=_[_0xf8c7('0x2')](_0x1ab5c3,[_0xf8c7('0x96'),!![]]);var _0x7f9964=_['isEmpty'](_0x2034af)&&_['isEmpty'](_0x4687af)?null:_[_0xf8c7('0x97')](_0x4687af,_0x2034af);if(!_0x7f9964)return null;var _0x810059=[];for(var _0x50d568=0x0;_0x50d568<_0x7f9964['length'];_0x50d568++){var _0x1bb661=_['find'](_0x1ab5c3,function(_0x51f7e4){return _0x7f9964[_0x50d568]?_0x51f7e4[_0xf8c7('0x8')]===_0x7f9964[_0x50d568][_0xf8c7('0x8')]:null;});if(_0x1bb661){if(_0x7f9964[_0x50d568][_0xf8c7('0x96')]){_0x810059['push'](_0x3ca562(_0x3b3e0b[_0xf8c7('0x11')],_0x7f9964[_0x50d568]));}else{if(!_0x7f9964[_0x50d568]['autoAssociation']){_0x810059[_0xf8c7('0x91')](_0x585459(_0x1bb661,_0x7f9964[_0x50d568],_0x3b3e0b['childModel']));}else{if(_0x1bb661[_0xf8c7('0x7')]){_0x810059[_0xf8c7('0x91')](_0x3de4ab(_0x1bb661,_0x7f9964[_0x50d568]));}}}}}return Promise[_0xf8c7('0x95')](_0x810059);})[_0xf8c7('0x3')](function(_0x52288f){var _0x3044d5=_0x52288f;var _0x57b3b8=null;if(_0x3044d5){_0x57b3b8=_0x3044d5[_0xf8c7('0x90')]===0x1?_0x3044d5[0x0]:null;}if(!_0x57b3b8&&!_0x3044d5)return _0x654f8d;var _0xd4cae7=_0x4a6fbd[_0x3b3e0b['childModel']][_0xf8c7('0x98')];_0x56846b['model']=_['keys'](_0xd4cae7);_0x56846b[_0xf8c7('0x85')]=_[_0xf8c7('0x99')](_0x46c728[_0xf8c7('0x85')]);_0x56846b['filters']=_[_0xf8c7('0x9a')](_0x56846b[_0xf8c7('0x7')],_0x56846b['query']);_0xf21eeb['attributes']=_[_0xf8c7('0x9a')](_0x56846b['model'],_0x4e3319[_0xf8c7('0x9b')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x9b')]));_0xf21eeb['attributes']=_0xf21eeb[_0xf8c7('0x9c')][_0xf8c7('0x90')]?_0xf21eeb['attributes']:_0x56846b[_0xf8c7('0x7')];if(!_0x46c728['query']['hasOwnProperty']('nolimit')){_0xf21eeb['limit']=_0x4e3319[_0xf8c7('0x9d')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x9d')]);_0xf21eeb[_0xf8c7('0x9e')]=_0x4e3319[_0xf8c7('0x9e')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x9e')]);}_0xf21eeb[_0xf8c7('0x9f')]=_0x4e3319[_0xf8c7('0xa0')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xa0')]);_0xf21eeb[_0xf8c7('0x83')]=_0x4e3319[_0xf8c7('0xa1')](_[_0xf8c7('0xa2')](_0x46c728[_0xf8c7('0x85')],_0x56846b[_0xf8c7('0xa1')]));if(_0x46c728['query'][_0xf8c7('0x2')]){_0xf21eeb[_0xf8c7('0x83')]=_[_0xf8c7('0xa3')](_0xf21eeb[_0xf8c7('0x83')],{'$or':_[_0xf8c7('0x4')](_0xd4cae7,function(_0x48f3e3){if(_0x48f3e3['type'][_0xf8c7('0xa4')]!==_0xf8c7('0xa5')){var _0x4daa66={};_0x4daa66[_0x48f3e3['field']]={'$like':'%'+_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x2')]+'%'};return _0x4daa66;}})});}var _0x5cedd7=[];var _0x15138c=null;var _0x2ef10e={};if(_0x57b3b8){_0x15138c=_[_0xf8c7('0x93')](_0x1ab5c3,['name',_0x57b3b8[_0xf8c7('0x8')]]);if(_0x15138c[_0xf8c7('0x5')]){_0x2ef10e={};if(_0x3b3e0b[_0xf8c7('0x11')]===_0xf8c7('0xb')){_0x2ef10e[_0x15138c['foreignKey']]=_[_0xf8c7('0x4')](_0x57b3b8['associatedResources'],'id');}else{_0x2ef10e[_0x15138c['foreignKey']]=_0x57b3b8[_0xf8c7('0xc')];}_0x5cedd7['push'](_0x2ef10e);}else{_0xf21eeb[_0xf8c7('0x83')]['id']=_0x57b3b8[_0xf8c7('0xc')];}}else{for(var _0x31c7d6=0x0;_0x31c7d6<_0x3044d5[_0xf8c7('0x90')];_0x31c7d6++){_0x15138c=_[_0xf8c7('0x93')](_0x1ab5c3,[_0xf8c7('0x8'),_0x3044d5[_0x31c7d6]['name']]);if(_0x15138c[_0xf8c7('0x5')]){_0x2ef10e={};_0x2ef10e[_0x15138c[_0xf8c7('0xa6')]]=_0x3044d5[_0x31c7d6]['associatedResources'];_0x5cedd7[_0xf8c7('0x91')](_0x2ef10e);}else{if(!_0xf21eeb[_0xf8c7('0x83')]['id'])_0xf21eeb['where']['id']=[];_0x3044d5[_0x31c7d6][_0xf8c7('0xc')][_0xf8c7('0xa7')](function(_0x35958c){_0xf21eeb['where']['id'][_0xf8c7('0x91')](_0x35958c);});}}}if(!_[_0xf8c7('0x8f')](_0x5cedd7)){_0xf21eeb[_0xf8c7('0x83')]=_[_0xf8c7('0xa3')](_0xf21eeb[_0xf8c7('0x83')],{'$and':{'$or':_0x5cedd7}});}_0xf21eeb=_[_0xf8c7('0xa3')]({},_0xf21eeb,_0x46c728[_0xf8c7('0xa8')]);if(_0x57b3b8&&!_0x57b3b8[_0xf8c7('0xa9')]&&_0x3b3e0b[_0xf8c7('0x11')]===_0xf8c7('0xb')){if(_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xaa')]){_0xf21eeb[_0xf8c7('0xab')]=[{'all':!![]}];}return _0x4a6fbd[_0x3b3e0b[_0xf8c7('0x11')]]['findAll'](_0xf21eeb)['then'](function(_0x2cf77c){var _0x5c7555=[];_0x2cf77c[_0xf8c7('0xa7')](function(_0x52cbbd){var _0x25038d;switch(_0x52cbbd[_0xf8c7('0xac')]){case _0xf8c7('0xad'):_0x25038d=_[_0xf8c7('0x93')](_0x57b3b8[_0xf8c7('0xc')],function(_0x2836d6){return _0x2836d6['id']===_0x52cbbd[_0xf8c7('0xae')]&&_0x2836d6[_0xf8c7('0xe')]===_0xf8c7('0xaf');});break;case _0xf8c7('0xb0'):_0x25038d=_['find'](_0x57b3b8[_0xf8c7('0xc')],function(_0x4b5da8){return _0x4b5da8['id']===_0x52cbbd[_0xf8c7('0xae')]&&_0x4b5da8[_0xf8c7('0xe')]===_0xf8c7('0xb1');});break;}if(_0x25038d)_0x5c7555[_0xf8c7('0x91')](_0x52cbbd);});_0x654f8d[_0xf8c7('0xb2')]=_0x5c7555[_0xf8c7('0x90')];_0x654f8d['rows']=_0x5c7555;return _0x654f8d;});}else{if(!_[_0xf8c7('0x8f')](_0x46c728['query'][_0xf8c7('0xb3')])){_0xf21eeb[_0xf8c7('0x83')]['id']=_0xf21eeb['where']['id']?_[_0xf8c7('0x9a')](_0xf21eeb[_0xf8c7('0x83')]['id'],_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb3')]):_0x46c728[_0xf8c7('0x85')]['ids'];if(_0x46c728['query'][_0xf8c7('0xb4')]){_0xf21eeb[_0xf8c7('0x9f')]=_0x46c728['query'][_0xf8c7('0xb4')];}}if(_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb5')]){_0xf21eeb[_0xf8c7('0x83')]=_[_0xf8c7('0xa3')](_0xf21eeb[_0xf8c7('0x83')],{'$and':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb5')]});}return _0x4a6fbd[_0x3b3e0b['childModel']]['count']({'where':_0xf21eeb['where']})[_0xf8c7('0x3')](function(_0x563b68){_0x654f8d[_0xf8c7('0xb2')]=_0x563b68;if(_0x46c728['query'][_0xf8c7('0xaa')]){if(_0x3b3e0b[_0xf8c7('0x11')]===_0xf8c7('0xb6')){_0xf21eeb[_0xf8c7('0xab')]=[{'model':_0x4a6fbd['Tag'],'as':_0xf8c7('0xb7'),'attributes':['id',_0xf8c7('0x8'),_0xf8c7('0xb8')],'required':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb9')]?!![]:![]},{'model':_0x4a6fbd[_0xf8c7('0x6b')],'as':_0xf8c7('0xba'),'attributes':['id','name',_0xf8c7('0xb8')],'through':_0x46c728[_0xf8c7('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x46c728['query'][_0xf8c7('0xb9')]||undefined}}:{},'required':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb9')]?!![]:![]}];}else{_0xf21eeb[_0xf8c7('0xab')]=[{'all':!![]}];}}return _0x4a6fbd[_0x3b3e0b[_0xf8c7('0x11')]][_0xf8c7('0xbb')](_0xf21eeb);})[_0xf8c7('0x3')](function(_0xe19cdf){_0x654f8d['rows']=_0xe19cdf;if(_0x18a384===_0xf8c7('0x30')&&_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xbc')]===_0xf8c7('0xbd')){var _0x5c1203=[];for(var _0x59b1c5=0x0;_0x59b1c5<_0x654f8d['rows'][_0xf8c7('0x90')];_0x59b1c5++){_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xbe'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5][_0xf8c7('0xc0')]));_0x5c1203['push'](_0x555ea3('sms',_0x654f8d['rows'][_0x59b1c5][_0xf8c7('0xc0')]));_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xc1'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5]['dataValues']));_0x5c1203[_0xf8c7('0x91')](_0x555ea3('mail',_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5][_0xf8c7('0xc0')]));_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xc2'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5]['dataValues']));_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xc3'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5][_0xf8c7('0xc0')]));}return Promise[_0xf8c7('0x95')](_0x5c1203)[_0xf8c7('0x3')](function(){return _0x654f8d;});}return _0x654f8d;});}});}}});};
\ No newline at end of file
+var _0xdb67=['VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','pauses','Pause','scheduler','Schedule','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','select','ui.','ui.createdAt','from','user_has_','_interactions','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','params','ignore','union','find','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tag','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','map','catch','model','then','associatedResources','name','resolve','UserProfileResource','resourceId','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes'];(function(_0x57ccc0,_0x2464ba){var _0x1bd7c2=function(_0xd1bb5b){while(--_0xd1bb5b){_0x57ccc0['push'](_0x57ccc0['shift']());}};_0x1bd7c2(++_0x2464ba);}(_0xdb67,0x80));var _0x7db6=function(_0x3f0b0c,_0x170477){_0x3f0b0c=_0x3f0b0c-0x0;var _0x24f8e2=_0xdb67[_0x3f0b0c];return _0x24f8e2;};'use strict';var _=require(_0x7db6('0x0'));var attributes=require(_0x7db6('0x1'));var squel=require(_0x7db6('0x2'));module['exports']=function(_0x16cb45){var _0x316e4a=_0x16cb45[_0x7db6('0x3')];function _0x50da1e(_0x53796e,_0x333f6e){return new Promise(function(_0x1e6105,_0x5677ae){if(!_0x333f6e)return _0x1e6105(null);var _0x189839=_0x333f6e[_0x7db6('0x4')]?{[_0x333f6e[_0x7db6('0x4')][_0x7db6('0x5')]]:_0x333f6e[_0x7db6('0x4')][_0x7db6('0x6')]}:undefined;return _0x316e4a[_0x53796e][_0x7db6('0x7')]({'where':_0x189839,'raw':!![]})['then'](function(_0x35e390){_0x333f6e['associatedResources']=_[_0x7db6('0x8')](_0x35e390,'id');_0x1e6105(_0x333f6e);})[_0x7db6('0x9')](function(_0x41da73){_0x5677ae(_0x41da73);});});}function _0x27bd1b(_0x58ccd0,_0xd6e391){return new Promise(function(_0x2d00ed,_0x52604a){var _0x2b0ac2=_0x58ccd0[_0x7db6('0x4')]?{[_0x58ccd0['filter']['field']]:_0x58ccd0[_0x7db6('0x4')][_0x7db6('0x6')]}:undefined;return _0x316e4a[_0x58ccd0[_0x7db6('0xa')]][_0x7db6('0x7')]({'where':_0x2b0ac2,'raw':!![]})[_0x7db6('0xb')](function(_0x215d2a){_0xd6e391[_0x7db6('0xc')]=_['map'](_0x215d2a,function(_0xe40206){return _0xe40206[_0x7db6('0xd')];});_0x2d00ed(_0xd6e391);})[_0x7db6('0x9')](function(_0x3a2fff){_0x52604a(_0x3a2fff);});});}function _0x1f9d16(_0x1c61c1,_0x2cc474,_0x4f3246){if(!_0x2cc474)return Promise[_0x7db6('0xe')](null);return new Promise(function(_0x4cfd84,_0x1de2d5){return _0x316e4a[_0x7db6('0xf')][_0x7db6('0x7')]({'where':{'sectionId':_0x2cc474['id']},'raw':!![]})[_0x7db6('0xb')](function(_0x4fe3e0){if(_0x1c61c1[_0x7db6('0x5')]&&_0x1c61c1[_0x7db6('0x5')]!=='id'){_0x2cc474[_0x7db6('0xc')]=_[_0x7db6('0x8')](_0x4fe3e0,function(_0x322b90){return _0x322b90[_0x1c61c1[_0x7db6('0x5')]];});}else{if(_0x4f3246==='AnalyticExtractedReport'){_0x2cc474[_0x7db6('0xc')]=_['map'](_0x4fe3e0,function(_0x41f1f1){return{'id':_0x41f1f1[_0x7db6('0x10')],'type':_0x41f1f1['type']};});}else{_0x2cc474[_0x7db6('0xc')]=_['map'](_0x4fe3e0,function(_0x424225){return _0x424225[_0x7db6('0x10')];});}}_0x4cfd84(_0x2cc474);})['catch'](function(_0x2b88fe){_0x1de2d5(_0x2b88fe);});});}function _0xbe8061(_0x1e1a9d,_0x5da304){var _0xb3439e={'parentSections':[]};switch(_0x1e1a9d[_0x7db6('0x11')]()){case'squareprojects':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x13');break;case _0x7db6('0x14'):_0xb3439e['childModel']=_0x7db6('0x15');break;case _0x7db6('0x16'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x17');_0xb3439e[_0x7db6('0x18')]=[{'name':_0x7db6('0x19'),'field':_0x7db6('0xd'),'foreignKey':_0x7db6('0x1a')}];break;case _0x7db6('0x1b'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x1c');break;case _0x7db6('0x1d'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x1e');_0xb3439e[_0x7db6('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0x7db6('0x1f')}];break;case _0x7db6('0x20'):_0xb3439e['childModel']=_0x7db6('0x21');break;case'companies':_0xb3439e['childModel']='CmCompany';break;case _0x7db6('0x22'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x23');break;case'chatqueues':_0xb3439e[_0x7db6('0x12')]='ChatQueue';break;case _0x7db6('0x24'):_0xb3439e['childModel']=_0x7db6('0x25');break;case'faxqueues':_0xb3439e['childModel']=_0x7db6('0x26');break;case _0x7db6('0x27'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x28');break;case'inboundroutes':case _0x7db6('0x29'):case'outboundroutes':_0xb3439e[_0x7db6('0x12')]='VoiceExtension';break;case'contexts':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x2a');break;case _0x7db6('0x2b'):_0xb3439e[_0x7db6('0x12')]='VoiceMail';break;case'voicerecordings':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x2c');_0xb3439e[_0x7db6('0x18')]=[{'name':_0x7db6('0x2d'),'field':_0x7db6('0xd'),'foreignKey':_0x7db6('0x2e'),'model':_0x7db6('0x2f'),'filter':{'field':_0x7db6('0x30'),'value':[_0x7db6('0x31')]}},{'name':_0x7db6('0x32'),'field':_0x7db6('0xd'),'foreignKey':_0x7db6('0x2e'),'model':'User','filter':{'field':_0x7db6('0x30'),'value':[_0x7db6('0x33')]}},{'name':_0x7db6('0x34'),'field':'name','foreignKey':_0x7db6('0x35'),'model':_0x7db6('0x36'),'filter':{'field':_0x7db6('0x37'),'value':[_0x7db6('0x38')]}},{'name':_0x7db6('0x39'),'field':_0x7db6('0xd'),'foreignKey':_0x7db6('0x35'),'model':'VoiceQueue','filter':{'field':_0x7db6('0x37'),'value':[_0x7db6('0x3a')]}}];break;case _0x7db6('0x3b'):_0xb3439e[_0x7db6('0x12')]='VoiceMusicOnHold';break;case _0x7db6('0x3c'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x3d');break;case _0x7db6('0x3e'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x3f');break;case _0x7db6('0x40'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x41');break;case'mailqueues':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x42');break;case _0x7db6('0x43'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x44');break;case _0x7db6('0x45'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x46');break;case _0x7db6('0x47'):_0xb3439e['childModel']=_0x7db6('0x48');break;case _0x7db6('0x49'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x4a');break;case'smsqueues':_0xb3439e[_0x7db6('0x12')]='SmsQueue';break;case _0x7db6('0x4b'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x4c');break;case'whatsappqueues':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x4d');break;case _0x7db6('0x4e'):_0xb3439e['childModel']=_0x7db6('0x4f');break;case'teams':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x50');break;case _0x7db6('0x51'):case _0x7db6('0x52'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x36');if(_0x5da304){_0xb3439e[_0x7db6('0x18')]=[{'name':_0x7db6('0x34')},{'name':_0x7db6('0x39')}];}break;case'users':case'agents':case'telephones':_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x2f');if(_0x5da304){_0xb3439e['parentSections']=[{'name':_0x7db6('0x53'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':_0x7db6('0x2d')},{'name':'Telephones'}];}break;case _0x7db6('0x54'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x55');break;case _0x7db6('0x56'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x57');break;case _0x7db6('0x58'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x59');break;case _0x7db6('0x5a'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x5b');break;case'deskaccounts':_0xb3439e['childModel']=_0x7db6('0x5c');break;case _0x7db6('0x5d'):_0xb3439e['childModel']=_0x7db6('0x5e');break;case _0x7db6('0x5f'):_0xb3439e[_0x7db6('0x12')]='User';break;case _0x7db6('0x60'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x61');break;case _0x7db6('0x62'):_0xb3439e['childModel']='Disposition';break;case _0x7db6('0x63'):_0xb3439e['childModel']='Dashboard';break;case _0x7db6('0x64'):_0xb3439e[_0x7db6('0x12')]='Interval';break;case _0x7db6('0x65'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x66');break;case _0x7db6('0x67'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x68');break;case'sounds':_0xb3439e['childModel']='Sound';break;case'tags':_0xb3439e[_0x7db6('0x12')]='Tag';break;case _0x7db6('0x69'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x6a');break;case _0x7db6('0x6b'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x6c');break;case _0x7db6('0x6d'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x6e');break;case _0x7db6('0x6f'):_0xb3439e['childModel']=_0x7db6('0x70');break;case _0x7db6('0x71'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x72');break;case _0x7db6('0x73'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x74');_0xb3439e[_0x7db6('0x18')]=[{'name':_0x7db6('0x75'),'field':'id','foreignKey':_0x7db6('0x76')}];break;case _0x7db6('0x77'):_0xb3439e[_0x7db6('0x12')]=_0x7db6('0x78');break;}return _0xb3439e;}function _0x38818e(_0x2c6990,_0x3a607f){var _0x21af5b=_0x2c6990[_0x7db6('0x79')](0x0)[_0x7db6('0x7a')]()+_0x2c6990[_0x7db6('0x7b')](0x1);var _0x49c9b3={'type':_0x316e4a['Sequelize'][_0x7db6('0x7c')]['SELECT'],'raw':!![]};return new Promise(function(_0xd6c2a4,_0x5e5fa0){var _0x30c9a2=squel[_0x7db6('0x7d')]()[_0x7db6('0x5')](_0x7db6('0x7e')+_0x21af5b+'InteractionId','id')[_0x7db6('0x5')](_0x7db6('0x7f'))[_0x7db6('0x80')](_0x7db6('0x81')+_0x2c6990+_0x7db6('0x82'),'ui')['where']('ui.UserId\x20=\x20?',_0x3a607f['id']);return _0x316e4a['sequelize']['query'](_0x30c9a2[_0x7db6('0x83')](),_0x49c9b3)['then'](function(_0xbbce43){_0x3a607f[_0x21af5b+_0x7db6('0x84')]=_0xbbce43;_0xd6c2a4(_0xbbce43);})[_0x7db6('0x9')](function(_0x4edda2){_0x5e5fa0(_0x4edda2);});});}return _0x16cb45[_0x7db6('0x85')]('UserProfile',attributes,{'tableName':_0x7db6('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x37668a){var _0x348280=require(_0x7db6('0x87'));var _0x58cb35={'raw':_0x37668a[_0x7db6('0x88')][_0x7db6('0x89')],'where':{}};var _0x4df569={};var _0x2929f9={'count':0x0,'rows':[]};var _0x57d39a=_0x37668a[_0x7db6('0x88')][_0x7db6('0x8a')];var _0x23a168=_0x37668a[_0x7db6('0x88')][_0x7db6('0x8b')]||![];var _0x5f40fe=_0xbe8061(_0x57d39a,_0x23a168);if(!_0x5f40fe[_0x7db6('0x12')])throw new Error(_0x7db6('0x8c')+_0x57d39a+'\x27');var _0x289fdb=[{'name':_0x57d39a}];if(!_[_0x7db6('0x8d')](_0x5f40fe[_0x7db6('0x18')]))_0x289fdb=_0x5f40fe[_0x7db6('0x18')];var _0x5be840=[];for(var _0x4477a0=0x0;_0x4477a0<_0x289fdb[_0x7db6('0x8e')];_0x4477a0++){_0x5be840[_0x7db6('0x8f')](_0x316e4a['UserProfileSection']['find']({'where':{'userProfileId':_0x37668a[_0x7db6('0x90')]['id'],'name':_0x289fdb[_0x4477a0][_0x7db6('0xd')]},'raw':!![]}));}return Promise['all'](_0x5be840)['then'](function(_0x56fac5){var _0x488491=_[_0x7db6('0x4')](_0x56fac5,function(_0x4a99c8){return _0x4a99c8?_0x4a99c8:undefined;});var _0x14fb3e=_[_0x7db6('0x4')](_0x289fdb,[_0x7db6('0x91'),!![]]);var _0x2dfcc9=_[_0x7db6('0x8d')](_0x488491)&&_[_0x7db6('0x8d')](_0x14fb3e)?null:_[_0x7db6('0x92')](_0x14fb3e,_0x488491);if(!_0x2dfcc9)return null;var _0x3e7c24=[];for(var _0x2df85b=0x0;_0x2df85b<_0x2dfcc9[_0x7db6('0x8e')];_0x2df85b++){var _0x362318=_[_0x7db6('0x93')](_0x289fdb,function(_0x436576){return _0x2dfcc9[_0x2df85b]?_0x436576['name']===_0x2dfcc9[_0x2df85b][_0x7db6('0xd')]:null;});if(_0x362318){if(_0x2dfcc9[_0x2df85b]['ignore']){_0x3e7c24['push'](_0x50da1e(_0x5f40fe[_0x7db6('0x12')],_0x2dfcc9[_0x2df85b]));}else{if(!_0x2dfcc9[_0x2df85b]['autoAssociation']){_0x3e7c24[_0x7db6('0x8f')](_0x1f9d16(_0x362318,_0x2dfcc9[_0x2df85b],_0x5f40fe[_0x7db6('0x12')]));}else{if(_0x362318[_0x7db6('0xa')]){_0x3e7c24[_0x7db6('0x8f')](_0x27bd1b(_0x362318,_0x2dfcc9[_0x2df85b]));}}}}}return Promise[_0x7db6('0x94')](_0x3e7c24);})[_0x7db6('0xb')](function(_0x5d014f){var _0x159bc0=_0x5d014f;var _0x2b91d9=null;if(_0x159bc0){_0x2b91d9=_0x159bc0['length']===0x1?_0x159bc0[0x0]:null;}if(!_0x2b91d9&&!_0x159bc0)return _0x2929f9;var _0x336d2b=_0x316e4a[_0x5f40fe[_0x7db6('0x12')]][_0x7db6('0x95')];_0x4df569[_0x7db6('0xa')]=_[_0x7db6('0x96')](_0x336d2b);_0x4df569[_0x7db6('0x88')]=_[_0x7db6('0x96')](_0x37668a[_0x7db6('0x88')]);_0x4df569[_0x7db6('0x97')]=_[_0x7db6('0x98')](_0x4df569['model'],_0x4df569[_0x7db6('0x88')]);_0x58cb35[_0x7db6('0x99')]=_['intersection'](_0x4df569['model'],_0x348280['fields'](_0x37668a[_0x7db6('0x88')][_0x7db6('0x9a')]));_0x58cb35[_0x7db6('0x99')]=_0x58cb35[_0x7db6('0x99')]['length']?_0x58cb35[_0x7db6('0x99')]:_0x4df569[_0x7db6('0xa')];if(!_0x37668a[_0x7db6('0x88')]['hasOwnProperty'](_0x7db6('0x9b'))){_0x58cb35[_0x7db6('0x9c')]=_0x348280[_0x7db6('0x9c')](_0x37668a[_0x7db6('0x88')][_0x7db6('0x9c')]);_0x58cb35[_0x7db6('0x9d')]=_0x348280['offset'](_0x37668a[_0x7db6('0x88')][_0x7db6('0x9d')]);}_0x58cb35[_0x7db6('0x9e')]=_0x348280[_0x7db6('0x9f')](_0x37668a[_0x7db6('0x88')][_0x7db6('0x9f')]);_0x58cb35[_0x7db6('0xa0')]=_0x348280[_0x7db6('0x97')](_[_0x7db6('0xa1')](_0x37668a[_0x7db6('0x88')],_0x4df569[_0x7db6('0x97')]));if(_0x37668a['query']['filter']){_0x58cb35['where']=_[_0x7db6('0xa2')](_0x58cb35['where'],{'$or':_[_0x7db6('0x8')](_0x336d2b,function(_0x2e1861){if(_0x2e1861[_0x7db6('0x37')][_0x7db6('0xa3')]!==_0x7db6('0xa4')){var _0x3f39a9={};_0x3f39a9[_0x2e1861['field']]={'$like':'%'+_0x37668a[_0x7db6('0x88')][_0x7db6('0x4')]+'%'};return _0x3f39a9;}})});}var _0x38a35c=[];var _0x1d50e2=null;var _0x4946d6={};if(_0x2b91d9){_0x1d50e2=_[_0x7db6('0x93')](_0x289fdb,[_0x7db6('0xd'),_0x2b91d9[_0x7db6('0xd')]]);if(_0x1d50e2[_0x7db6('0x5')]){_0x4946d6={};if(_0x5f40fe[_0x7db6('0x12')]==='AnalyticExtractedReport'){_0x4946d6[_0x1d50e2[_0x7db6('0xa5')]]=_[_0x7db6('0x8')](_0x2b91d9['associatedResources'],'id');}else{_0x4946d6[_0x1d50e2['foreignKey']]=_0x2b91d9[_0x7db6('0xc')];}_0x38a35c[_0x7db6('0x8f')](_0x4946d6);}else{_0x58cb35[_0x7db6('0xa0')]['id']=_0x2b91d9[_0x7db6('0xc')];}}else{for(var _0x564514=0x0;_0x564514<_0x159bc0['length'];_0x564514++){_0x1d50e2=_[_0x7db6('0x93')](_0x289fdb,[_0x7db6('0xd'),_0x159bc0[_0x564514][_0x7db6('0xd')]]);if(_0x1d50e2[_0x7db6('0x5')]){_0x4946d6={};_0x4946d6[_0x1d50e2[_0x7db6('0xa5')]]=_0x159bc0[_0x564514][_0x7db6('0xc')];_0x38a35c[_0x7db6('0x8f')](_0x4946d6);}else{if(!_0x58cb35[_0x7db6('0xa0')]['id'])_0x58cb35[_0x7db6('0xa0')]['id']=[];_0x159bc0[_0x564514][_0x7db6('0xc')][_0x7db6('0xa6')](function(_0x450763){_0x58cb35[_0x7db6('0xa0')]['id'][_0x7db6('0x8f')](_0x450763);});}}}if(!_['isEmpty'](_0x38a35c)){_0x58cb35['where']=_['merge'](_0x58cb35[_0x7db6('0xa0')],{'$and':{'$or':_0x38a35c}});}_0x58cb35=_[_0x7db6('0xa2')]({},_0x58cb35,_0x37668a[_0x7db6('0xa7')]);if(_0x2b91d9&&!_0x2b91d9[_0x7db6('0xa8')]&&_0x5f40fe[_0x7db6('0x12')]==='AnalyticExtractedReport'){if(_0x37668a[_0x7db6('0x88')]['includeAll']){_0x58cb35[_0x7db6('0xa9')]=[{'all':!![]}];}return _0x316e4a[_0x5f40fe[_0x7db6('0x12')]][_0x7db6('0x7')](_0x58cb35)[_0x7db6('0xb')](function(_0xc094c6){var _0x40fcc8=[];_0xc094c6[_0x7db6('0xa6')](function(_0x250ad8){var _0x26fa4d;switch(_0x250ad8[_0x7db6('0xaa')]){case _0x7db6('0xab'):_0x26fa4d=_[_0x7db6('0x93')](_0x2b91d9[_0x7db6('0xc')],function(_0x1d9a23){return _0x1d9a23['id']===_0x250ad8[_0x7db6('0x76')]&&_0x1d9a23['type']===_0x7db6('0xac');});break;case _0x7db6('0xad'):_0x26fa4d=_[_0x7db6('0x93')](_0x2b91d9[_0x7db6('0xc')],function(_0xee27c6){return _0xee27c6['id']===_0x250ad8[_0x7db6('0x76')]&&_0xee27c6[_0x7db6('0x37')]===_0x7db6('0xae');});break;}if(_0x26fa4d)_0x40fcc8[_0x7db6('0x8f')](_0x250ad8);});_0x2929f9[_0x7db6('0xaf')]=_0x40fcc8[_0x7db6('0x8e')];_0x2929f9[_0x7db6('0xb0')]=_0x40fcc8;return _0x2929f9;});}else{if(!_['isEmpty'](_0x37668a[_0x7db6('0x88')]['ids'])){_0x58cb35[_0x7db6('0xa0')]['id']=_0x58cb35[_0x7db6('0xa0')]['id']?_['intersection'](_0x58cb35[_0x7db6('0xa0')]['id'],_0x37668a[_0x7db6('0x88')][_0x7db6('0xb1')]):_0x37668a[_0x7db6('0x88')][_0x7db6('0xb1')];if(_0x37668a['query'][_0x7db6('0xb2')]){_0x58cb35[_0x7db6('0x9e')]=_0x37668a[_0x7db6('0x88')][_0x7db6('0xb2')];}}if(_0x37668a[_0x7db6('0x88')]['extraQueryConditions']){_0x58cb35[_0x7db6('0xa0')]=_[_0x7db6('0xa2')](_0x58cb35['where'],{'$and':_0x37668a[_0x7db6('0x88')][_0x7db6('0xb3')]});}return _0x316e4a[_0x5f40fe[_0x7db6('0x12')]][_0x7db6('0xaf')]({'where':_0x58cb35[_0x7db6('0xa0')]})['then'](function(_0x50f06b){_0x2929f9['count']=_0x50f06b;if(_0x37668a[_0x7db6('0x88')][_0x7db6('0xb4')]){if(_0x5f40fe['childModel']===_0x7db6('0x1e')){_0x58cb35[_0x7db6('0xa9')]=[{'model':_0x316e4a[_0x7db6('0xb5')],'as':_0x7db6('0xb6'),'attributes':['id',_0x7db6('0xd'),_0x7db6('0xb7')],'required':_0x37668a[_0x7db6('0x88')][_0x7db6('0xb8')]?!![]:![]},{'model':_0x316e4a[_0x7db6('0xb5')],'as':_0x7db6('0xb9'),'attributes':['id','name',_0x7db6('0xb7')],'through':_0x37668a[_0x7db6('0x88')][_0x7db6('0xb8')]?{'attributes':[],'where':{'TagId':_0x37668a[_0x7db6('0x88')]['tag']||undefined}}:{},'required':_0x37668a[_0x7db6('0x88')][_0x7db6('0xb8')]?!![]:![]}];}else{_0x58cb35[_0x7db6('0xa9')]=[{'all':!![]}];}}return _0x316e4a[_0x5f40fe[_0x7db6('0x12')]][_0x7db6('0x7')](_0x58cb35);})[_0x7db6('0xb')](function(_0xe6ec97){_0x2929f9[_0x7db6('0xb0')]=_0xe6ec97;if(_0x57d39a==='Agents'&&_0x37668a[_0x7db6('0x88')][_0x7db6('0xba')]===_0x7db6('0xbb')){var _0x12cd3d=[];for(var _0x338fb4=0x0;_0x338fb4<_0x2929f9['rows'][_0x7db6('0x8e')];_0x338fb4++){_0x12cd3d[_0x7db6('0x8f')](_0x38818e('chat',_0x2929f9[_0x7db6('0xb0')][_0x338fb4][_0x7db6('0xbc')]));_0x12cd3d['push'](_0x38818e(_0x7db6('0xbd'),_0x2929f9['rows'][_0x338fb4][_0x7db6('0xbc')]));_0x12cd3d[_0x7db6('0x8f')](_0x38818e(_0x7db6('0xbe'),_0x2929f9['rows'][_0x338fb4][_0x7db6('0xbc')]));_0x12cd3d[_0x7db6('0x8f')](_0x38818e('mail',_0x2929f9['rows'][_0x338fb4][_0x7db6('0xbc')]));_0x12cd3d[_0x7db6('0x8f')](_0x38818e('openchannel',_0x2929f9[_0x7db6('0xb0')][_0x338fb4][_0x7db6('0xbc')]));_0x12cd3d[_0x7db6('0x8f')](_0x38818e('whatsapp',_0x2929f9[_0x7db6('0xb0')][_0x338fb4][_0x7db6('0xbc')]));}return Promise['all'](_0x12cd3d)['then'](function(){return _0x2929f9;});}return _0x2929f9;});}});}}});};
\ No newline at end of file