Built motion from commit 980b26c3.|2.6.29
[motion2.git] / server / api / userProfile / userProfile.model.js
index c194b71..c830bad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe47f=['ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','VoiceRecording','parentSections','membername','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','User','Users','admin','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','toUpperCase','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','../../components/parsers/qs','raw','mergeResources','isEmpty','length','UserProfileSection','all','ignore','find','push','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tags','color','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','exports','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','odbc','childModel','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues'];(function(_0x3736f7,_0xe2b1b4){var _0x4d1960=function(_0x4cb074){while(--_0x4cb074){_0x3736f7['push'](_0x3736f7['shift']());}};_0x4d1960(++_0xe2b1b4);}(_0xe47f,0x162));var _0xfe47=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0xe47f[_0x22d1ef];return _0x47c5a3;};'use strict';var _=require('lodash');var attributes=require(_0xfe47('0x0'));var squel=require('squel');module[_0xfe47('0x1')]=function(_0x1ec8f5){var _0x4eb493=_0x1ec8f5[_0xfe47('0x2')];function _0x46bebc(_0xa282c8,_0x18b4e8){return new Promise(function(_0x343d8b,_0x4072b4){if(!_0x18b4e8)return _0x343d8b(null);var _0x225e9d=_0x18b4e8[_0xfe47('0x3')]?{[_0x18b4e8[_0xfe47('0x3')][_0xfe47('0x4')]]:_0x18b4e8['filter'][_0xfe47('0x5')]}:undefined;return _0x4eb493[_0xa282c8][_0xfe47('0x6')]({'where':_0x225e9d,'raw':!![]})[_0xfe47('0x7')](function(_0x46a1a3){_0x18b4e8[_0xfe47('0x8')]=_['map'](_0x46a1a3,'id');_0x343d8b(_0x18b4e8);})[_0xfe47('0x9')](function(_0x184d46){_0x4072b4(_0x184d46);});});}function _0x1ee12b(_0x55b3b3,_0x3c9e5d){return new Promise(function(_0x216791,_0x3df2ce){var _0x4bad90=_0x55b3b3[_0xfe47('0x3')]?{[_0x55b3b3[_0xfe47('0x3')][_0xfe47('0x4')]]:_0x55b3b3[_0xfe47('0x3')][_0xfe47('0x5')]}:undefined;return _0x4eb493[_0x55b3b3[_0xfe47('0xa')]][_0xfe47('0x6')]({'where':_0x4bad90,'raw':!![]})[_0xfe47('0x7')](function(_0x4c4cd0){_0x3c9e5d['associatedResources']=_[_0xfe47('0xb')](_0x4c4cd0,function(_0x3fbd78){return _0x3fbd78[_0xfe47('0xc')];});_0x216791(_0x3c9e5d);})[_0xfe47('0x9')](function(_0xbd0d8d){_0x3df2ce(_0xbd0d8d);});});}function _0x5c0679(_0x2c4dea,_0x2b44e2,_0x2f396e){if(!_0x2b44e2)return Promise[_0xfe47('0xd')](null);return new Promise(function(_0x6ab9c,_0x16eab4){return _0x4eb493[_0xfe47('0xe')][_0xfe47('0x6')]({'where':{'sectionId':_0x2b44e2['id']},'raw':!![]})['then'](function(_0x1e8678){if(_0x2c4dea[_0xfe47('0x4')]&&_0x2c4dea[_0xfe47('0x4')]!=='id'){_0x2b44e2[_0xfe47('0x8')]=_[_0xfe47('0xb')](_0x1e8678,function(_0x2b75ea){return _0x2b75ea[_0x2c4dea[_0xfe47('0x4')]];});}else{if(_0x2f396e==='AnalyticExtractedReport'){_0x2b44e2[_0xfe47('0x8')]=_[_0xfe47('0xb')](_0x1e8678,function(_0xa0c852){return{'id':_0xa0c852[_0xfe47('0xf')],'type':_0xa0c852[_0xfe47('0x10')]};});}else{_0x2b44e2['associatedResources']=_[_0xfe47('0xb')](_0x1e8678,function(_0x247aed){return _0x247aed[_0xfe47('0xf')];});}}_0x6ab9c(_0x2b44e2);})['catch'](function(_0x10aaad){_0x16eab4(_0x10aaad);});});}function _0x37df52(_0x22c25e,_0x546621){var _0x272410={'parentSections':[]};switch(_0x22c25e[_0xfe47('0x11')]()){case _0xfe47('0x12'):_0x272410['childModel']='SquareProject';break;case _0xfe47('0x13'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x15');break;case _0xfe47('0x16'):_0x272410['childModel']='SquareRecording';_0x272410['parentSections']=[{'name':_0xfe47('0x17'),'field':_0xfe47('0xc'),'foreignKey':_0xfe47('0x18')}];break;case'projects':_0x272410[_0xfe47('0x14')]=_0xfe47('0x19');break;case _0xfe47('0x1a'):_0x272410[_0xfe47('0x14')]='CmContact';_0x272410['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xfe47('0x1b')}];break;case _0xfe47('0x1c'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x1d');break;case _0xfe47('0x1e'):_0x272410[_0xfe47('0x14')]='CmCompany';break;case _0xfe47('0x1f'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x20');break;case _0xfe47('0x21'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x22');break;case _0xfe47('0x23'):_0x272410['childModel']=_0xfe47('0x24');break;case _0xfe47('0x25'):_0x272410[_0xfe47('0x14')]='FaxQueue';break;case _0xfe47('0x26'):_0x272410[_0xfe47('0x14')]='FaxAccount';break;case _0xfe47('0x27'):case _0xfe47('0x28'):case _0xfe47('0x29'):_0x272410[_0xfe47('0x14')]='VoiceExtension';break;case _0xfe47('0x2a'):_0x272410[_0xfe47('0x14')]='VoiceContext';break;case _0xfe47('0x2b'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x2c');break;case'voicerecordings':_0x272410[_0xfe47('0x14')]=_0xfe47('0x2d');_0x272410[_0xfe47('0x2e')]=[{'name':'Agents','field':'name','foreignKey':_0xfe47('0x2f'),'model':'User','filter':{'field':_0xfe47('0x30'),'value':[_0xfe47('0x31')]}},{'name':_0xfe47('0x32'),'field':_0xfe47('0xc'),'foreignKey':_0xfe47('0x2f'),'model':'User','filter':{'field':_0xfe47('0x30'),'value':[_0xfe47('0x33')]}},{'name':_0xfe47('0x34'),'field':'name','foreignKey':'queue','model':_0xfe47('0x35'),'filter':{'field':'type','value':[_0xfe47('0x36')]}},{'name':_0xfe47('0x37'),'field':_0xfe47('0xc'),'foreignKey':_0xfe47('0x38'),'model':_0xfe47('0x35'),'filter':{'field':_0xfe47('0x10'),'value':[_0xfe47('0x39')]}}];break;case _0xfe47('0x3a'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x3b');break;case _0xfe47('0x3c'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x3d');break;case'voiceprefixes':_0x272410['childModel']=_0xfe47('0x3e');break;case _0xfe47('0x3f'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x40');break;case _0xfe47('0x41'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x42');break;case _0xfe47('0x43'):_0x272410[_0xfe47('0x14')]='MailAccount';break;case _0xfe47('0x44'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x45');break;case _0xfe47('0x46'):_0x272410['childModel']=_0xfe47('0x47');break;case'openchannelaccounts':_0x272410[_0xfe47('0x14')]=_0xfe47('0x48');break;case'smsqueues':_0x272410[_0xfe47('0x14')]=_0xfe47('0x49');break;case'smsaccounts':_0x272410[_0xfe47('0x14')]='SmsAccount';break;case _0xfe47('0x4a'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x4b');break;case _0xfe47('0x4c'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x4d');break;case _0xfe47('0x4e'):_0x272410[_0xfe47('0x14')]='Team';break;case _0xfe47('0x4f'):case _0xfe47('0x50'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x35');if(_0x546621){_0x272410[_0xfe47('0x2e')]=[{'name':_0xfe47('0x34')},{'name':_0xfe47('0x37')}];}break;case _0xfe47('0x51'):case _0xfe47('0x52'):case _0xfe47('0x53'):_0x272410['childModel']=_0xfe47('0x54');if(_0x546621){_0x272410['parentSections']=[{'name':_0xfe47('0x55'),'filter':{'field':_0xfe47('0x30'),'value':[_0xfe47('0x56'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xfe47('0x32')}];}break;case'zendeskaccounts':_0x272410[_0xfe47('0x14')]='ZendeskAccount';break;case _0xfe47('0x57'):_0x272410[_0xfe47('0x14')]='SalesforceAccount';break;case _0xfe47('0x58'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x59');break;case _0xfe47('0x5a'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x5b');break;case _0xfe47('0x5c'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x5d');break;case'zohoaccounts':_0x272410[_0xfe47('0x14')]=_0xfe47('0x5e');break;case _0xfe47('0x5f'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x54');break;case _0xfe47('0x60'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x61');break;case _0xfe47('0x62'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x63');break;case _0xfe47('0x64'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x65');break;case _0xfe47('0x66'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x67');break;case _0xfe47('0x68'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x69');break;case'scheduler':_0x272410[_0xfe47('0x14')]=_0xfe47('0x6a');break;case'sounds':_0x272410[_0xfe47('0x14')]=_0xfe47('0x6b');break;case _0xfe47('0x6c'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x6d');break;case _0xfe47('0x6e'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x6f');break;case _0xfe47('0x70'):_0x272410[_0xfe47('0x14')]='Trigger';break;case _0xfe47('0x71'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x72');break;case _0xfe47('0x73'):_0x272410['childModel']=_0xfe47('0x74');break;case _0xfe47('0x75'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x76');break;case _0xfe47('0x77'):_0x272410[_0xfe47('0x14')]=_0xfe47('0x78');_0x272410[_0xfe47('0x2e')]=[{'name':_0xfe47('0x79'),'field':'id','foreignKey':_0xfe47('0x7a')}];break;case'metrics':_0x272410[_0xfe47('0x14')]=_0xfe47('0x7b');break;}return _0x272410;}function _0x33edf8(_0x45ff42,_0x42a272){var _0x5a619f=_0x45ff42['charAt'](0x0)[_0xfe47('0x7c')]()+_0x45ff42['slice'](0x1);var _0x5d63b7={'type':_0x4eb493[_0xfe47('0x7d')][_0xfe47('0x7e')]['SELECT'],'raw':!![]};return new Promise(function(_0x5e8f2c,_0x3aaf82){var _0x46341d=squel[_0xfe47('0x7f')]()[_0xfe47('0x4')](_0xfe47('0x80')+_0x5a619f+_0xfe47('0x81'),'id')[_0xfe47('0x4')](_0xfe47('0x82'))['from']('user_has_'+_0x45ff42+_0xfe47('0x83'),'ui')['where'](_0xfe47('0x84'),_0x42a272['id']);return _0x4eb493['sequelize'][_0xfe47('0x85')](_0x46341d[_0xfe47('0x86')](),_0x5d63b7)[_0xfe47('0x7')](function(_0x19411e){_0x42a272[_0x5a619f+'OpenTabs']=_0x19411e;_0x5e8f2c(_0x19411e);})[_0xfe47('0x9')](function(_0x3b42b2){_0x3aaf82(_0x3b42b2);});});}return _0x1ec8f5[_0xfe47('0x87')](_0xfe47('0x88'),attributes,{'tableName':_0xfe47('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2d078e){var _0x46c8eb=require(_0xfe47('0x8a'));var _0x16813d={'raw':_0x2d078e[_0xfe47('0x85')][_0xfe47('0x8b')],'where':{}};var _0x81368d={};var _0x42019f={'count':0x0,'rows':[]};var _0x23d586=_0x2d078e[_0xfe47('0x85')]['section'];var _0x41f44d=_0x2d078e[_0xfe47('0x85')][_0xfe47('0x8c')]||![];var _0x374695=_0x37df52(_0x23d586,_0x41f44d);if(!_0x374695[_0xfe47('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x23d586+'\x27');var _0x1e4a20=[{'name':_0x23d586}];if(!_[_0xfe47('0x8d')](_0x374695[_0xfe47('0x2e')]))_0x1e4a20=_0x374695['parentSections'];var _0x452861=[];for(var _0x20b972=0x0;_0x20b972<_0x1e4a20[_0xfe47('0x8e')];_0x20b972++){_0x452861['push'](_0x4eb493[_0xfe47('0x8f')]['find']({'where':{'userProfileId':_0x2d078e['params']['id'],'name':_0x1e4a20[_0x20b972]['name']},'raw':!![]}));}return Promise[_0xfe47('0x90')](_0x452861)['then'](function(_0x34bcf6){var _0x1a65d5=_[_0xfe47('0x3')](_0x34bcf6,function(_0x386523){return _0x386523?_0x386523:undefined;});var _0x4f189b=_[_0xfe47('0x3')](_0x1e4a20,[_0xfe47('0x91'),!![]]);var _0x43dc08=_[_0xfe47('0x8d')](_0x1a65d5)&&_['isEmpty'](_0x4f189b)?null:_['union'](_0x4f189b,_0x1a65d5);if(!_0x43dc08)return null;var _0x589c35=[];for(var _0x28dbc8=0x0;_0x28dbc8<_0x43dc08['length'];_0x28dbc8++){var _0x3d2953=_[_0xfe47('0x92')](_0x1e4a20,function(_0x47eb2f){return _0x43dc08[_0x28dbc8]?_0x47eb2f[_0xfe47('0xc')]===_0x43dc08[_0x28dbc8][_0xfe47('0xc')]:null;});if(_0x3d2953){if(_0x43dc08[_0x28dbc8]['ignore']){_0x589c35[_0xfe47('0x93')](_0x46bebc(_0x374695['childModel'],_0x43dc08[_0x28dbc8]));}else{if(!_0x43dc08[_0x28dbc8]['autoAssociation']){_0x589c35[_0xfe47('0x93')](_0x5c0679(_0x3d2953,_0x43dc08[_0x28dbc8],_0x374695[_0xfe47('0x14')]));}else{if(_0x3d2953[_0xfe47('0xa')]){_0x589c35[_0xfe47('0x93')](_0x1ee12b(_0x3d2953,_0x43dc08[_0x28dbc8]));}}}}}return Promise[_0xfe47('0x90')](_0x589c35);})[_0xfe47('0x7')](function(_0x11966c){var _0x56acb0=_0x11966c;var _0x5534f7=null;if(_0x56acb0){_0x5534f7=_0x56acb0[_0xfe47('0x8e')]===0x1?_0x56acb0[0x0]:null;}if(!_0x5534f7&&!_0x56acb0)return _0x42019f;var _0x4b4b2e=_0x4eb493[_0x374695[_0xfe47('0x14')]][_0xfe47('0x94')];_0x81368d[_0xfe47('0xa')]=_[_0xfe47('0x95')](_0x4b4b2e);_0x81368d[_0xfe47('0x85')]=_[_0xfe47('0x95')](_0x2d078e[_0xfe47('0x85')]);_0x81368d['filters']=_[_0xfe47('0x96')](_0x81368d[_0xfe47('0xa')],_0x81368d[_0xfe47('0x85')]);_0x16813d[_0xfe47('0x97')]=_[_0xfe47('0x96')](_0x81368d['model'],_0x46c8eb[_0xfe47('0x98')](_0x2d078e['query']['fields']));_0x16813d[_0xfe47('0x97')]=_0x16813d[_0xfe47('0x97')][_0xfe47('0x8e')]?_0x16813d['attributes']:_0x81368d['model'];if(!_0x2d078e[_0xfe47('0x85')][_0xfe47('0x99')](_0xfe47('0x9a'))){_0x16813d[_0xfe47('0x9b')]=_0x46c8eb[_0xfe47('0x9b')](_0x2d078e[_0xfe47('0x85')]['limit']);_0x16813d['offset']=_0x46c8eb[_0xfe47('0x9c')](_0x2d078e[_0xfe47('0x85')][_0xfe47('0x9c')]);}_0x16813d[_0xfe47('0x9d')]=_0x46c8eb[_0xfe47('0x9e')](_0x2d078e[_0xfe47('0x85')][_0xfe47('0x9e')]);_0x16813d[_0xfe47('0x9f')]=_0x46c8eb[_0xfe47('0xa0')](_[_0xfe47('0xa1')](_0x2d078e[_0xfe47('0x85')],_0x81368d['filters']));if(_0x2d078e['query']['filter']){_0x16813d[_0xfe47('0x9f')]=_[_0xfe47('0xa2')](_0x16813d[_0xfe47('0x9f')],{'$or':_[_0xfe47('0xb')](_0x4b4b2e,function(_0x6e1973){if(_0x6e1973['type'][_0xfe47('0xa3')]!==_0xfe47('0xa4')){var _0x419a08={};_0x419a08[_0x6e1973[_0xfe47('0x4')]]={'$like':'%'+_0x2d078e[_0xfe47('0x85')][_0xfe47('0x3')]+'%'};return _0x419a08;}})});}var _0x2b374d=[];var _0x2b33dd=null;var _0x6a4f47={};if(_0x5534f7){_0x2b33dd=_[_0xfe47('0x92')](_0x1e4a20,[_0xfe47('0xc'),_0x5534f7[_0xfe47('0xc')]]);if(_0x2b33dd[_0xfe47('0x4')]){_0x6a4f47={};if(_0x374695[_0xfe47('0x14')]===_0xfe47('0x78')){_0x6a4f47[_0x2b33dd['foreignKey']]=_[_0xfe47('0xb')](_0x5534f7[_0xfe47('0x8')],'id');}else{_0x6a4f47[_0x2b33dd[_0xfe47('0xa5')]]=_0x5534f7[_0xfe47('0x8')];}_0x2b374d['push'](_0x6a4f47);}else{_0x16813d[_0xfe47('0x9f')]['id']=_0x5534f7[_0xfe47('0x8')];}}else{for(var _0x8ed862=0x0;_0x8ed862<_0x56acb0[_0xfe47('0x8e')];_0x8ed862++){_0x2b33dd=_[_0xfe47('0x92')](_0x1e4a20,[_0xfe47('0xc'),_0x56acb0[_0x8ed862][_0xfe47('0xc')]]);if(_0x2b33dd[_0xfe47('0x4')]){_0x6a4f47={};_0x6a4f47[_0x2b33dd[_0xfe47('0xa5')]]=_0x56acb0[_0x8ed862][_0xfe47('0x8')];_0x2b374d[_0xfe47('0x93')](_0x6a4f47);}else{if(!_0x16813d['where']['id'])_0x16813d[_0xfe47('0x9f')]['id']=[];_0x56acb0[_0x8ed862][_0xfe47('0x8')][_0xfe47('0xa6')](function(_0x377a30){_0x16813d[_0xfe47('0x9f')]['id'][_0xfe47('0x93')](_0x377a30);});}}}if(!_['isEmpty'](_0x2b374d)){_0x16813d['where']=_[_0xfe47('0xa2')](_0x16813d[_0xfe47('0x9f')],{'$and':{'$or':_0x2b374d}});}_0x16813d=_[_0xfe47('0xa2')]({},_0x16813d,_0x2d078e[_0xfe47('0xa7')]);if(_0x5534f7&&!_0x5534f7[_0xfe47('0xa8')]&&_0x374695[_0xfe47('0x14')]===_0xfe47('0x78')){if(_0x2d078e[_0xfe47('0x85')]['includeAll']){_0x16813d[_0xfe47('0xa9')]=[{'all':!![]}];}return _0x4eb493[_0x374695['childModel']][_0xfe47('0x6')](_0x16813d)['then'](function(_0x366239){var _0x589142=[];_0x366239[_0xfe47('0xa6')](function(_0x269c13){var _0x3bf0e2;switch(_0x269c13[_0xfe47('0xaa')]){case'default':_0x3bf0e2=_[_0xfe47('0x92')](_0x5534f7[_0xfe47('0x8')],function(_0x235f1b){return _0x235f1b['id']===_0x269c13[_0xfe47('0x7a')]&&_0x235f1b[_0xfe47('0x10')]===_0xfe47('0xab');});break;case _0xfe47('0xac'):_0x3bf0e2=_[_0xfe47('0x92')](_0x5534f7[_0xfe47('0x8')],function(_0x290027){return _0x290027['id']===_0x269c13[_0xfe47('0x7a')]&&_0x290027[_0xfe47('0x10')]===_0xfe47('0xad');});break;}if(_0x3bf0e2)_0x589142[_0xfe47('0x93')](_0x269c13);});_0x42019f[_0xfe47('0xae')]=_0x589142[_0xfe47('0x8e')];_0x42019f[_0xfe47('0xaf')]=_0x589142;return _0x42019f;});}else{if(!_[_0xfe47('0x8d')](_0x2d078e['query'][_0xfe47('0xb0')])){_0x16813d[_0xfe47('0x9f')]['id']=_0x16813d[_0xfe47('0x9f')]['id']?_['intersection'](_0x16813d[_0xfe47('0x9f')]['id'],_0x2d078e['query']['ids']):_0x2d078e['query'][_0xfe47('0xb0')];if(_0x2d078e[_0xfe47('0x85')][_0xfe47('0xb1')]){_0x16813d['order']=_0x2d078e['query'][_0xfe47('0xb1')];}}if(_0x2d078e[_0xfe47('0x85')]['extraQueryConditions']){_0x16813d[_0xfe47('0x9f')]=_[_0xfe47('0xa2')](_0x16813d['where'],{'$and':_0x2d078e[_0xfe47('0x85')][_0xfe47('0xb2')]});}return _0x4eb493[_0x374695['childModel']][_0xfe47('0xae')]({'where':_0x16813d['where']})['then'](function(_0x164574){_0x42019f[_0xfe47('0xae')]=_0x164574;if(_0x2d078e['query'][_0xfe47('0xb3')]){if(_0x374695[_0xfe47('0x14')]===_0xfe47('0xb4')){_0x16813d[_0xfe47('0xa9')]=[{'model':_0x4eb493[_0xfe47('0x6d')],'as':_0xfe47('0xb5'),'attributes':['id',_0xfe47('0xc'),_0xfe47('0xb6')],'required':_0x2d078e[_0xfe47('0x85')][_0xfe47('0xb7')]?!![]:![]},{'model':_0x4eb493[_0xfe47('0x6d')],'as':_0xfe47('0xb8'),'attributes':['id','name',_0xfe47('0xb6')],'through':_0x2d078e[_0xfe47('0x85')][_0xfe47('0xb7')]?{'attributes':[],'where':{'TagId':_0x2d078e['query'][_0xfe47('0xb7')]||undefined}}:{},'required':_0x2d078e[_0xfe47('0x85')][_0xfe47('0xb7')]?!![]:![]}];}else{_0x16813d[_0xfe47('0xa9')]=[{'all':!![]}];}}return _0x4eb493[_0x374695['childModel']][_0xfe47('0x6')](_0x16813d);})[_0xfe47('0x7')](function(_0x441906){_0x42019f[_0xfe47('0xaf')]=_0x441906;if(_0x23d586===_0xfe47('0xb9')&&_0x2d078e[_0xfe47('0x85')][_0xfe47('0xba')]===_0xfe47('0xbb')){var _0x311c54=[];for(var _0x2462c0=0x0;_0x2462c0<_0x42019f[_0xfe47('0xaf')]['length'];_0x2462c0++){_0x311c54[_0xfe47('0x93')](_0x33edf8(_0xfe47('0xbc'),_0x42019f['rows'][_0x2462c0][_0xfe47('0xbd')]));_0x311c54[_0xfe47('0x93')](_0x33edf8(_0xfe47('0xbe'),_0x42019f[_0xfe47('0xaf')][_0x2462c0][_0xfe47('0xbd')]));_0x311c54[_0xfe47('0x93')](_0x33edf8('fax',_0x42019f[_0xfe47('0xaf')][_0x2462c0][_0xfe47('0xbd')]));_0x311c54[_0xfe47('0x93')](_0x33edf8(_0xfe47('0xbf'),_0x42019f[_0xfe47('0xaf')][_0x2462c0][_0xfe47('0xbd')]));_0x311c54['push'](_0x33edf8(_0xfe47('0xc0'),_0x42019f[_0xfe47('0xaf')][_0x2462c0]['dataValues']));_0x311c54[_0xfe47('0x93')](_0x33edf8(_0xfe47('0xc1'),_0x42019f[_0xfe47('0xaf')][_0x2462c0][_0xfe47('0xbd')]));}return Promise[_0xfe47('0x90')](_0x311c54)[_0xfe47('0x7')](function(){return _0x42019f;});}return _0x42019f;});}});}}});};
\ No newline at end of file
+var _0x53f6=['VoiceMail','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','QueryTypes','SELECT','select','ui.','user_has_','_interactions','where','ui.UserId\x20=\x20?','toString','OpenTabs','user_profiles','../../components/parsers/qs','raw','query','section','mergeResources','length','UserProfileSection','params','all','ignore','isEmpty','find','autoAssociation','push','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','CustomReports','ids','customSorting','extraQueryConditions','count','color','ThroughTags','tag','true','rows','chat','dataValues','sms','mail','openchannel','lodash','squel','models','filter','field','value','findAll','associatedResources','map','catch','then','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','name','projectName','JscriptyProject','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x53f6,0x92));var _0x653f=function(_0x429c0c,_0x560f5b){_0x429c0c=_0x429c0c-0x0;var _0x45c8a5=_0x53f6[_0x429c0c];return _0x45c8a5;};'use strict';var _=require(_0x653f('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x653f('0x1'));module['exports']=function(_0x30fe60){var _0xb5f40f=_0x30fe60[_0x653f('0x2')];function _0xdf0972(_0x6c886d,_0x209878){return new Promise(function(_0x577f4f,_0x219b4d){if(!_0x209878)return _0x577f4f(null);var _0x566fa2=_0x209878[_0x653f('0x3')]?{[_0x209878[_0x653f('0x3')][_0x653f('0x4')]]:_0x209878['filter'][_0x653f('0x5')]}:undefined;return _0xb5f40f[_0x6c886d][_0x653f('0x6')]({'where':_0x566fa2,'raw':!![]})['then'](function(_0x3e4141){_0x209878[_0x653f('0x7')]=_[_0x653f('0x8')](_0x3e4141,'id');_0x577f4f(_0x209878);})[_0x653f('0x9')](function(_0xe961f2){_0x219b4d(_0xe961f2);});});}function _0x3cbb0d(_0x387e1e,_0x5a974e){return new Promise(function(_0x53d676,_0xfcbca1){var _0x4e3543=_0x387e1e['filter']?{[_0x387e1e[_0x653f('0x3')][_0x653f('0x4')]]:_0x387e1e[_0x653f('0x3')][_0x653f('0x5')]}:undefined;return _0xb5f40f[_0x387e1e['model']][_0x653f('0x6')]({'where':_0x4e3543,'raw':!![]})[_0x653f('0xa')](function(_0x46743c){_0x5a974e['associatedResources']=_[_0x653f('0x8')](_0x46743c,function(_0xab9b3c){return _0xab9b3c['name'];});_0x53d676(_0x5a974e);})[_0x653f('0x9')](function(_0x417210){_0xfcbca1(_0x417210);});});}function _0x5b129f(_0x58da3a,_0x5d1b52,_0x305002){if(!_0x5d1b52)return Promise[_0x653f('0xb')](null);return new Promise(function(_0x58eada,_0x4fcbe0){return _0xb5f40f['UserProfileResource'][_0x653f('0x6')]({'where':{'sectionId':_0x5d1b52['id']},'raw':!![]})['then'](function(_0x146da8){if(_0x58da3a[_0x653f('0x4')]&&_0x58da3a[_0x653f('0x4')]!=='id'){_0x5d1b52[_0x653f('0x7')]=_['map'](_0x146da8,function(_0x1a03d9){return _0x1a03d9[_0x58da3a[_0x653f('0x4')]];});}else{if(_0x305002===_0x653f('0xc')){_0x5d1b52[_0x653f('0x7')]=_[_0x653f('0x8')](_0x146da8,function(_0x3a8c88){return{'id':_0x3a8c88[_0x653f('0xd')],'type':_0x3a8c88[_0x653f('0xe')]};});}else{_0x5d1b52['associatedResources']=_[_0x653f('0x8')](_0x146da8,function(_0x145d85){return _0x145d85[_0x653f('0xd')];});}}_0x58eada(_0x5d1b52);})[_0x653f('0x9')](function(_0x370e49){_0x4fcbe0(_0x370e49);});});}function _0x24ba09(_0x200337,_0x4ac39d){var _0x4104e6={'parentSections':[]};switch(_0x200337[_0x653f('0xf')]()){case _0x653f('0x10'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x12');break;case _0x653f('0x13'):_0x4104e6['childModel']=_0x653f('0x14');break;case _0x653f('0x15'):_0x4104e6['childModel']=_0x653f('0x16');_0x4104e6[_0x653f('0x17')]=[{'name':'SquareProjects','field':_0x653f('0x18'),'foreignKey':_0x653f('0x19')}];break;case'projects':_0x4104e6[_0x653f('0x11')]=_0x653f('0x1a');break;case _0x653f('0x1b'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x1c');_0x4104e6[_0x653f('0x17')]=[{'name':_0x653f('0x1d'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x4104e6[_0x653f('0x11')]=_0x653f('0x1e');break;case _0x653f('0x1f'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x20');break;case _0x653f('0x21'):_0x4104e6['childModel']=_0x653f('0x22');break;case _0x653f('0x23'):_0x4104e6['childModel']=_0x653f('0x24');break;case _0x653f('0x25'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x26');break;case _0x653f('0x27'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x28');break;case _0x653f('0x29'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x2a');break;case _0x653f('0x2b'):case _0x653f('0x2c'):case'outboundroutes':_0x4104e6[_0x653f('0x11')]=_0x653f('0x2d');break;case _0x653f('0x2e'):_0x4104e6[_0x653f('0x11')]='VoiceContext';break;case'voicemails':_0x4104e6['childModel']=_0x653f('0x2f');break;case'voicerecordings':_0x4104e6[_0x653f('0x11')]=_0x653f('0x30');_0x4104e6[_0x653f('0x17')]=[{'name':_0x653f('0x31'),'field':_0x653f('0x18'),'foreignKey':'membername','model':_0x653f('0x32'),'filter':{'field':_0x653f('0x33'),'value':[_0x653f('0x34')]}},{'name':_0x653f('0x35'),'field':'name','foreignKey':_0x653f('0x36'),'model':_0x653f('0x32'),'filter':{'field':_0x653f('0x33'),'value':[_0x653f('0x37')]}},{'name':_0x653f('0x38'),'field':'name','foreignKey':'queue','model':_0x653f('0x39'),'filter':{'field':'type','value':['inbound']}},{'name':_0x653f('0x3a'),'field':_0x653f('0x18'),'foreignKey':'queue','model':_0x653f('0x39'),'filter':{'field':'type','value':[_0x653f('0x3b')]}}];break;case _0x653f('0x3c'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x3d');break;case'chanspies':_0x4104e6[_0x653f('0x11')]=_0x653f('0x3e');break;case _0x653f('0x3f'):_0x4104e6['childModel']=_0x653f('0x40');break;case _0x653f('0x41'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x42');break;case'mailqueues':_0x4104e6[_0x653f('0x11')]=_0x653f('0x43');break;case _0x653f('0x44'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x45');break;case _0x653f('0x46'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x47');break;case _0x653f('0x48'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x49');break;case _0x653f('0x4a'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x4b');break;case _0x653f('0x4c'):_0x4104e6['childModel']='SmsQueue';break;case _0x653f('0x4d'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x4e');break;case _0x653f('0x4f'):_0x4104e6['childModel']=_0x653f('0x50');break;case _0x653f('0x51'):_0x4104e6['childModel']=_0x653f('0x52');break;case _0x653f('0x53'):_0x4104e6['childModel']=_0x653f('0x54');break;case'voicequeues':case _0x653f('0x55'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x39');if(_0x4ac39d){_0x4104e6[_0x653f('0x17')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x653f('0x56'):case _0x653f('0x57'):case _0x653f('0x58'):_0x4104e6['childModel']=_0x653f('0x32');if(_0x4ac39d){_0x4104e6[_0x653f('0x17')]=[{'name':_0x653f('0x59'),'filter':{'field':'role','value':[_0x653f('0x5a'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x653f('0x35')}];}break;case _0x653f('0x5b'):_0x4104e6[_0x653f('0x11')]='ZendeskAccount';break;case _0x653f('0x5c'):_0x4104e6['childModel']=_0x653f('0x5d');break;case _0x653f('0x5e'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x5f');break;case _0x653f('0x60'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x61');break;case _0x653f('0x62'):_0x4104e6['childModel']=_0x653f('0x63');break;case _0x653f('0x64'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x65');break;case _0x653f('0x66'):_0x4104e6[_0x653f('0x11')]='User';break;case'cannedanswers':_0x4104e6[_0x653f('0x11')]=_0x653f('0x67');break;case _0x653f('0x68'):_0x4104e6['childModel']=_0x653f('0x69');break;case _0x653f('0x6a'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x6b');break;case _0x653f('0x6c'):_0x4104e6['childModel']=_0x653f('0x6d');break;case _0x653f('0x6e'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x6f');break;case _0x653f('0x70'):_0x4104e6[_0x653f('0x11')]='Schedule';break;case _0x653f('0x71'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x72');break;case _0x653f('0x73'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x74');break;case'templates':_0x4104e6[_0x653f('0x11')]='Template';break;case _0x653f('0x75'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x76');break;case _0x653f('0x77'):_0x4104e6['childModel']=_0x653f('0x78');break;case _0x653f('0x79'):_0x4104e6[_0x653f('0x11')]='Variable';break;case _0x653f('0x7a'):_0x4104e6[_0x653f('0x11')]=_0x653f('0x7b');break;case _0x653f('0x7c'):_0x4104e6[_0x653f('0x11')]=_0x653f('0xc');_0x4104e6['parentSections']=[{'name':_0x653f('0x7d'),'field':'id','foreignKey':_0x653f('0x7e')}];break;case'metrics':_0x4104e6[_0x653f('0x11')]=_0x653f('0x7f');break;}return _0x4104e6;}function _0x53ac32(_0x197d73,_0x5810f2){var _0x384da3=_0x197d73[_0x653f('0x80')](0x0)[_0x653f('0x81')]()+_0x197d73['slice'](0x1);var _0x4f2548={'type':_0xb5f40f['Sequelize'][_0x653f('0x82')][_0x653f('0x83')],'raw':!![]};return new Promise(function(_0x61b0f1,_0x472690){var _0x14293f=squel[_0x653f('0x84')]()[_0x653f('0x4')](_0x653f('0x85')+_0x384da3+'InteractionId','id')[_0x653f('0x4')]('ui.createdAt')['from'](_0x653f('0x86')+_0x197d73+_0x653f('0x87'),'ui')[_0x653f('0x88')](_0x653f('0x89'),_0x5810f2['id']);return _0xb5f40f['sequelize']['query'](_0x14293f[_0x653f('0x8a')](),_0x4f2548)['then'](function(_0x19ed0a){_0x5810f2[_0x384da3+_0x653f('0x8b')]=_0x19ed0a;_0x61b0f1(_0x19ed0a);})['catch'](function(_0xe7649c){_0x472690(_0xe7649c);});});}return _0x30fe60['define']('UserProfile',attributes,{'tableName':_0x653f('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5599f6){var _0x1ecc16=require(_0x653f('0x8d'));var _0x53908f={'raw':_0x5599f6['query'][_0x653f('0x8e')],'where':{}};var _0x1e00da={};var _0x2c437a={'count':0x0,'rows':[]};var _0x15f593=_0x5599f6[_0x653f('0x8f')][_0x653f('0x90')];var _0x2b18c8=_0x5599f6['query'][_0x653f('0x91')]||![];var _0x30d73b=_0x24ba09(_0x15f593,_0x2b18c8);if(!_0x30d73b[_0x653f('0x11')])throw new Error('Invalid\x20section\x20\x27'+_0x15f593+'\x27');var _0x55472d=[{'name':_0x15f593}];if(!_['isEmpty'](_0x30d73b[_0x653f('0x17')]))_0x55472d=_0x30d73b[_0x653f('0x17')];var _0x41b5cb=[];for(var _0x28e64e=0x0;_0x28e64e<_0x55472d[_0x653f('0x92')];_0x28e64e++){_0x41b5cb['push'](_0xb5f40f[_0x653f('0x93')]['find']({'where':{'userProfileId':_0x5599f6[_0x653f('0x94')]['id'],'name':_0x55472d[_0x28e64e][_0x653f('0x18')]},'raw':!![]}));}return Promise[_0x653f('0x95')](_0x41b5cb)[_0x653f('0xa')](function(_0x363f4a){var _0x1208d3=_[_0x653f('0x3')](_0x363f4a,function(_0x224cb0){return _0x224cb0?_0x224cb0:undefined;});var _0x1c8376=_[_0x653f('0x3')](_0x55472d,[_0x653f('0x96'),!![]]);var _0x36c076=_[_0x653f('0x97')](_0x1208d3)&&_[_0x653f('0x97')](_0x1c8376)?null:_['union'](_0x1c8376,_0x1208d3);if(!_0x36c076)return null;var _0x7bf1ed=[];for(var _0x4e1f8b=0x0;_0x4e1f8b<_0x36c076['length'];_0x4e1f8b++){var _0x358872=_[_0x653f('0x98')](_0x55472d,function(_0x2b5cd9){return _0x36c076[_0x4e1f8b]?_0x2b5cd9[_0x653f('0x18')]===_0x36c076[_0x4e1f8b]['name']:null;});if(_0x358872){if(_0x36c076[_0x4e1f8b][_0x653f('0x96')]){_0x7bf1ed['push'](_0xdf0972(_0x30d73b[_0x653f('0x11')],_0x36c076[_0x4e1f8b]));}else{if(!_0x36c076[_0x4e1f8b][_0x653f('0x99')]){_0x7bf1ed[_0x653f('0x9a')](_0x5b129f(_0x358872,_0x36c076[_0x4e1f8b],_0x30d73b[_0x653f('0x11')]));}else{if(_0x358872['model']){_0x7bf1ed[_0x653f('0x9a')](_0x3cbb0d(_0x358872,_0x36c076[_0x4e1f8b]));}}}}}return Promise['all'](_0x7bf1ed);})['then'](function(_0x40b6db){var _0x10e51b=_0x40b6db;var _0x369642=null;if(_0x10e51b){_0x369642=_0x10e51b[_0x653f('0x92')]===0x1?_0x10e51b[0x0]:null;}if(!_0x369642&&!_0x10e51b)return _0x2c437a;var _0x2e122b=_0xb5f40f[_0x30d73b[_0x653f('0x11')]]['rawAttributes'];_0x1e00da['model']=_['keys'](_0x2e122b);_0x1e00da[_0x653f('0x8f')]=_[_0x653f('0x9b')](_0x5599f6[_0x653f('0x8f')]);_0x1e00da[_0x653f('0x9c')]=_[_0x653f('0x9d')](_0x1e00da[_0x653f('0x9e')],_0x1e00da[_0x653f('0x8f')]);_0x53908f[_0x653f('0x9f')]=_[_0x653f('0x9d')](_0x1e00da[_0x653f('0x9e')],_0x1ecc16['fields'](_0x5599f6[_0x653f('0x8f')][_0x653f('0xa0')]));_0x53908f[_0x653f('0x9f')]=_0x53908f['attributes']['length']?_0x53908f[_0x653f('0x9f')]:_0x1e00da[_0x653f('0x9e')];if(!_0x5599f6['query'][_0x653f('0xa1')]('nolimit')){_0x53908f[_0x653f('0xa2')]=_0x1ecc16['limit'](_0x5599f6[_0x653f('0x8f')]['limit']);_0x53908f['offset']=_0x1ecc16['offset'](_0x5599f6['query'][_0x653f('0xa3')]);}_0x53908f[_0x653f('0xa4')]=_0x1ecc16['sort'](_0x5599f6['query'][_0x653f('0xa5')]);_0x53908f[_0x653f('0x88')]=_0x1ecc16[_0x653f('0x9c')](_[_0x653f('0xa6')](_0x5599f6[_0x653f('0x8f')],_0x1e00da[_0x653f('0x9c')]));if(_0x5599f6[_0x653f('0x8f')][_0x653f('0x3')]){_0x53908f['where']=_[_0x653f('0xa7')](_0x53908f[_0x653f('0x88')],{'$or':_[_0x653f('0x8')](_0x2e122b,function(_0x48b885){if(_0x48b885[_0x653f('0xe')][_0x653f('0xa8')]!==_0x653f('0xa9')){var _0x1c2b10={};_0x1c2b10[_0x48b885[_0x653f('0x4')]]={'$like':'%'+_0x5599f6['query'][_0x653f('0x3')]+'%'};return _0x1c2b10;}})});}var _0x5ddf52=[];var _0x3d6546=null;var _0x326b89={};if(_0x369642){_0x3d6546=_[_0x653f('0x98')](_0x55472d,[_0x653f('0x18'),_0x369642[_0x653f('0x18')]]);if(_0x3d6546[_0x653f('0x4')]){_0x326b89={};if(_0x30d73b[_0x653f('0x11')]===_0x653f('0xc')){_0x326b89[_0x3d6546[_0x653f('0xaa')]]=_['map'](_0x369642[_0x653f('0x7')],'id');}else{_0x326b89[_0x3d6546[_0x653f('0xaa')]]=_0x369642['associatedResources'];}_0x5ddf52[_0x653f('0x9a')](_0x326b89);}else{_0x53908f[_0x653f('0x88')]['id']=_0x369642['associatedResources'];}}else{for(var _0x29bea0=0x0;_0x29bea0<_0x10e51b[_0x653f('0x92')];_0x29bea0++){_0x3d6546=_[_0x653f('0x98')](_0x55472d,[_0x653f('0x18'),_0x10e51b[_0x29bea0][_0x653f('0x18')]]);if(_0x3d6546[_0x653f('0x4')]){_0x326b89={};_0x326b89[_0x3d6546[_0x653f('0xaa')]]=_0x10e51b[_0x29bea0][_0x653f('0x7')];_0x5ddf52['push'](_0x326b89);}else{if(!_0x53908f[_0x653f('0x88')]['id'])_0x53908f[_0x653f('0x88')]['id']=[];_0x10e51b[_0x29bea0][_0x653f('0x7')][_0x653f('0xab')](function(_0x14b7f6){_0x53908f[_0x653f('0x88')]['id'][_0x653f('0x9a')](_0x14b7f6);});}}}if(!_[_0x653f('0x97')](_0x5ddf52)){_0x53908f[_0x653f('0x88')]=_[_0x653f('0xa7')](_0x53908f[_0x653f('0x88')],{'$and':{'$or':_0x5ddf52}});}_0x53908f=_[_0x653f('0xa7')]({},_0x53908f,_0x5599f6[_0x653f('0xac')]);if(_0x369642&&!_0x369642[_0x653f('0x99')]&&_0x30d73b[_0x653f('0x11')]==='AnalyticExtractedReport'){if(_0x5599f6['query'][_0x653f('0xad')]){_0x53908f[_0x653f('0xae')]=[{'all':!![]}];}return _0xb5f40f[_0x30d73b[_0x653f('0x11')]][_0x653f('0x6')](_0x53908f)['then'](function(_0x97333a){var _0x147dce=[];_0x97333a['forEach'](function(_0x2e425c){var _0xbc374;switch(_0x2e425c[_0x653f('0xaf')]){case _0x653f('0xb0'):_0xbc374=_[_0x653f('0x98')](_0x369642[_0x653f('0x7')],function(_0x33bb71){return _0x33bb71['id']===_0x2e425c['reportId']&&_0x33bb71[_0x653f('0xe')]===_0x653f('0xb1');});break;case'custom':_0xbc374=_['find'](_0x369642[_0x653f('0x7')],function(_0x2ef142){return _0x2ef142['id']===_0x2e425c[_0x653f('0x7e')]&&_0x2ef142['type']===_0x653f('0xb2');});break;}if(_0xbc374)_0x147dce[_0x653f('0x9a')](_0x2e425c);});_0x2c437a['count']=_0x147dce[_0x653f('0x92')];_0x2c437a['rows']=_0x147dce;return _0x2c437a;});}else{if(!_['isEmpty'](_0x5599f6[_0x653f('0x8f')][_0x653f('0xb3')])){_0x53908f[_0x653f('0x88')]['id']=_0x53908f[_0x653f('0x88')]['id']?_[_0x653f('0x9d')](_0x53908f[_0x653f('0x88')]['id'],_0x5599f6[_0x653f('0x8f')][_0x653f('0xb3')]):_0x5599f6[_0x653f('0x8f')][_0x653f('0xb3')];if(_0x5599f6['query'][_0x653f('0xb4')]){_0x53908f[_0x653f('0xa4')]=_0x5599f6[_0x653f('0x8f')]['customSorting'];}}if(_0x5599f6[_0x653f('0x8f')][_0x653f('0xb5')]){_0x53908f[_0x653f('0x88')]=_[_0x653f('0xa7')](_0x53908f['where'],{'$and':_0x5599f6['query'][_0x653f('0xb5')]});}return _0xb5f40f[_0x30d73b['childModel']][_0x653f('0xb6')]({'where':_0x53908f['where']})[_0x653f('0xa')](function(_0x4eb5a9){_0x2c437a[_0x653f('0xb6')]=_0x4eb5a9;if(_0x5599f6[_0x653f('0x8f')]['includeAll']){if(_0x30d73b[_0x653f('0x11')]===_0x653f('0x1c')){_0x53908f['include']=[{'model':_0xb5f40f[_0x653f('0x74')],'as':'Tags','attributes':['id',_0x653f('0x18'),_0x653f('0xb7')],'required':_0x5599f6['query']['tag']?!![]:![]},{'model':_0xb5f40f[_0x653f('0x74')],'as':_0x653f('0xb8'),'attributes':['id',_0x653f('0x18'),_0x653f('0xb7')],'through':_0x5599f6[_0x653f('0x8f')][_0x653f('0xb9')]?{'attributes':[],'where':{'TagId':_0x5599f6[_0x653f('0x8f')]['tag']||undefined}}:{},'required':_0x5599f6['query']['tag']?!![]:![]}];}else{_0x53908f['include']=[{'all':!![]}];}}return _0xb5f40f[_0x30d73b[_0x653f('0x11')]][_0x653f('0x6')](_0x53908f);})[_0x653f('0xa')](function(_0x3ce836){_0x2c437a['rows']=_0x3ce836;if(_0x15f593===_0x653f('0x31')&&_0x5599f6[_0x653f('0x8f')]['openTabs']===_0x653f('0xba')){var _0x1c94c4=[];for(var _0x21e5ec=0x0;_0x21e5ec<_0x2c437a[_0x653f('0xbb')][_0x653f('0x92')];_0x21e5ec++){_0x1c94c4[_0x653f('0x9a')](_0x53ac32(_0x653f('0xbc'),_0x2c437a['rows'][_0x21e5ec][_0x653f('0xbd')]));_0x1c94c4['push'](_0x53ac32(_0x653f('0xbe'),_0x2c437a[_0x653f('0xbb')][_0x21e5ec][_0x653f('0xbd')]));_0x1c94c4[_0x653f('0x9a')](_0x53ac32('fax',_0x2c437a['rows'][_0x21e5ec][_0x653f('0xbd')]));_0x1c94c4[_0x653f('0x9a')](_0x53ac32(_0x653f('0xbf'),_0x2c437a[_0x653f('0xbb')][_0x21e5ec][_0x653f('0xbd')]));_0x1c94c4[_0x653f('0x9a')](_0x53ac32(_0x653f('0xc0'),_0x2c437a[_0x653f('0xbb')][_0x21e5ec][_0x653f('0xbd')]));_0x1c94c4[_0x653f('0x9a')](_0x53ac32('whatsapp',_0x2c437a[_0x653f('0xbb')][_0x21e5ec][_0x653f('0xbd')]));}return Promise[_0x653f('0x95')](_0x1c94c4)[_0x653f('0xa')](function(){return _0x2c437a;});}return _0x2c437a;});}});}}});};
\ No newline at end of file