Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / userProfile / userProfile.model.js
index 4cd9220..15acecf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12e2=['VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','Tag','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','mergeResources','isEmpty','push','UserProfileSection','find','params','all','ignore','union','length','rawAttributes','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filters','merge','key','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','forEach','default','DefaultReports','count','rows','ids','customSorting','extraQueryConditions','Tags','ThroughTags','color','tag','openTabs','true','sms','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','value','findAll','associatedResources','catch','field','model','then','map','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','parentSections','name','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes'];(function(_0x33a2bf,_0xcc5085){var _0x3612c1=function(_0x35f9dd){while(--_0x35f9dd){_0x33a2bf['push'](_0x33a2bf['shift']());}};_0x3612c1(++_0xcc5085);}(_0x12e2,0x9e));var _0x212e=function(_0x19bebd,_0xbdb9eb){_0x19bebd=_0x19bebd-0x0;var _0x243436=_0x12e2[_0x19bebd];return _0x243436;};'use strict';var _=require(_0x212e('0x0'));var attributes=require(_0x212e('0x1'));var qs=require(_0x212e('0x2'));var squel=require(_0x212e('0x3'));module[_0x212e('0x4')]=function(_0x3664d5){var _0x3af1a8=_0x3664d5['models'];function _0x1ac95a(_0x5588c2,_0x2fb828){return new Promise(function(_0x1af8ca,_0x5934aa){if(!_0x2fb828)return _0x1af8ca(null);var _0x346250=_0x2fb828[_0x212e('0x5')]?{[_0x2fb828[_0x212e('0x5')]['field']]:_0x2fb828[_0x212e('0x5')][_0x212e('0x6')]}:undefined;return _0x3af1a8[_0x5588c2][_0x212e('0x7')]({'where':_0x346250,'raw':!![]})['then'](function(_0x4fdc14){_0x2fb828[_0x212e('0x8')]=_['map'](_0x4fdc14,'id');_0x1af8ca(_0x2fb828);})[_0x212e('0x9')](function(_0x39a0f0){_0x5934aa(_0x39a0f0);});});}function _0x17aea0(_0x535cc7,_0x2e412e){return new Promise(function(_0x574208,_0x876626){var _0x17a659=_0x535cc7[_0x212e('0x5')]?{[_0x535cc7[_0x212e('0x5')][_0x212e('0xa')]]:_0x535cc7[_0x212e('0x5')]['value']}:undefined;return _0x3af1a8[_0x535cc7[_0x212e('0xb')]][_0x212e('0x7')]({'where':_0x17a659,'raw':!![]})[_0x212e('0xc')](function(_0x459324){_0x2e412e['associatedResources']=_[_0x212e('0xd')](_0x459324,function(_0x4e3727){return _0x4e3727['name'];});_0x574208(_0x2e412e);})['catch'](function(_0x7216ff){_0x876626(_0x7216ff);});});}function _0x16dea6(_0x37e093,_0x34d2ef,_0x2cb9dc){if(!_0x34d2ef)return Promise[_0x212e('0xe')](null);return new Promise(function(_0x65889a,_0x248cbc){return _0x3af1a8[_0x212e('0xf')][_0x212e('0x7')]({'where':{'sectionId':_0x34d2ef['id']},'raw':!![]})[_0x212e('0xc')](function(_0x4d2c97){if(_0x37e093[_0x212e('0xa')]&&_0x37e093['field']!=='id'){_0x34d2ef[_0x212e('0x8')]=_['map'](_0x4d2c97,function(_0x5c9aea){return _0x5c9aea[_0x37e093[_0x212e('0xa')]];});}else{if(_0x2cb9dc===_0x212e('0x10')){_0x34d2ef[_0x212e('0x8')]=_['map'](_0x4d2c97,function(_0x4a435b){return{'id':_0x4a435b[_0x212e('0x11')],'type':_0x4a435b[_0x212e('0x12')]};});}else{_0x34d2ef[_0x212e('0x8')]=_['map'](_0x4d2c97,function(_0x810fed){return _0x810fed[_0x212e('0x11')];});}}_0x65889a(_0x34d2ef);})['catch'](function(_0x19ab31){_0x248cbc(_0x19ab31);});});}function _0x39e609(_0x1e7d4d,_0x22802a){var _0x27a09b={'parentSections':[]};switch(_0x1e7d4d['toLowerCase']()){case _0x212e('0x13'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x15');break;case _0x212e('0x16'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x17');break;case'squarerecordings':_0x27a09b['childModel']='SquareRecording';_0x27a09b[_0x212e('0x18')]=[{'name':'SquareProjects','field':_0x212e('0x19'),'foreignKey':_0x212e('0x1a')}];break;case _0x212e('0x1b'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x1c');break;case _0x212e('0x1d'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x1e');_0x27a09b[_0x212e('0x18')]=[{'name':_0x212e('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0x212e('0x20'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x21');break;case _0x212e('0x22'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x23');break;case _0x212e('0x24'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x25');break;case'chatqueues':_0x27a09b[_0x212e('0x14')]=_0x212e('0x26');break;case _0x212e('0x27'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x28');break;case _0x212e('0x29'):_0x27a09b[_0x212e('0x14')]='FaxQueue';break;case _0x212e('0x2a'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x2b');break;case _0x212e('0x2c'):case _0x212e('0x2d'):case'outboundroutes':_0x27a09b[_0x212e('0x14')]=_0x212e('0x2e');break;case'contexts':_0x27a09b[_0x212e('0x14')]=_0x212e('0x2f');break;case _0x212e('0x30'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x31');break;case _0x212e('0x32'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x33');_0x27a09b[_0x212e('0x18')]=[{'name':_0x212e('0x34'),'field':_0x212e('0x19'),'foreignKey':_0x212e('0x35'),'model':_0x212e('0x36'),'filter':{'field':_0x212e('0x37'),'value':[_0x212e('0x38')]}},{'name':'Telephones','field':_0x212e('0x19'),'foreignKey':_0x212e('0x35'),'model':_0x212e('0x36'),'filter':{'field':'role','value':[_0x212e('0x39')]}},{'name':_0x212e('0x3a'),'field':'name','foreignKey':'queue','model':_0x212e('0x3b'),'filter':{'field':_0x212e('0x12'),'value':[_0x212e('0x3c')]}},{'name':_0x212e('0x3d'),'field':_0x212e('0x19'),'foreignKey':_0x212e('0x3e'),'model':_0x212e('0x3b'),'filter':{'field':_0x212e('0x12'),'value':[_0x212e('0x3f')]}}];break;case _0x212e('0x40'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x41');break;case _0x212e('0x42'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x43');break;case _0x212e('0x44'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x45');break;case _0x212e('0x46'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x47');break;case _0x212e('0x48'):_0x27a09b[_0x212e('0x14')]='MailQueue';break;case _0x212e('0x49'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x4a');break;case _0x212e('0x4b'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x4c');break;case _0x212e('0x4d'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x4e');break;case'openchannelaccounts':_0x27a09b[_0x212e('0x14')]=_0x212e('0x4f');break;case _0x212e('0x50'):_0x27a09b['childModel']=_0x212e('0x51');break;case _0x212e('0x52'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x53');break;case _0x212e('0x54'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x55');break;case'whatsappaccounts':_0x27a09b[_0x212e('0x14')]=_0x212e('0x56');break;case'teams':_0x27a09b[_0x212e('0x14')]=_0x212e('0x57');break;case _0x212e('0x58'):case _0x212e('0x59'):_0x27a09b['childModel']=_0x212e('0x3b');if(_0x22802a){_0x27a09b['parentSections']=[{'name':_0x212e('0x3a')},{'name':_0x212e('0x3d')}];}break;case _0x212e('0x5a'):case _0x212e('0x5b'):case _0x212e('0x5c'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x36');if(_0x22802a){_0x27a09b[_0x212e('0x18')]=[{'name':_0x212e('0x5d'),'filter':{'field':_0x212e('0x37'),'value':[_0x212e('0x5e'),_0x212e('0x5f')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x212e('0x60'):_0x27a09b['childModel']=_0x212e('0x61');break;case _0x212e('0x62'):_0x27a09b['childModel']=_0x212e('0x63');break;case _0x212e('0x64'):_0x27a09b['childModel']=_0x212e('0x65');break;case _0x212e('0x66'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x67');break;case _0x212e('0x68'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x69');break;case _0x212e('0x6a'):_0x27a09b['childModel']=_0x212e('0x6b');break;case _0x212e('0x6c'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x36');break;case'cannedanswers':_0x27a09b[_0x212e('0x14')]=_0x212e('0x6d');break;case _0x212e('0x6e'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x6f');break;case _0x212e('0x70'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x71');break;case _0x212e('0x72'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x73');break;case'pauses':_0x27a09b[_0x212e('0x14')]=_0x212e('0x74');break;case _0x212e('0x75'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x76');break;case _0x212e('0x77'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x78');break;case'tags':_0x27a09b['childModel']=_0x212e('0x79');break;case'templates':_0x27a09b['childModel']='Template';break;case _0x212e('0x7a'):_0x27a09b[_0x212e('0x14')]='Trigger';break;case _0x212e('0x7b'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x7c');break;case _0x212e('0x7d'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x7e');break;case _0x212e('0x7f'):_0x27a09b['childModel']=_0x212e('0x80');break;case _0x212e('0x81'):_0x27a09b[_0x212e('0x14')]=_0x212e('0x10');_0x27a09b[_0x212e('0x18')]=[{'name':_0x212e('0x82'),'field':'id','foreignKey':_0x212e('0x83')}];break;case _0x212e('0x84'):_0x27a09b['childModel']=_0x212e('0x85');break;}return _0x27a09b;}function _0x367888(_0x141676,_0x5ddae0){var _0x184398=_0x141676[_0x212e('0x86')](0x0)[_0x212e('0x87')]()+_0x141676['slice'](0x1);var _0x24ce45={'type':_0x3af1a8[_0x212e('0x88')][_0x212e('0x89')][_0x212e('0x8a')],'raw':!![]};return new Promise(function(_0x237020,_0x382670){var _0x77601e=squel[_0x212e('0x8b')]()[_0x212e('0xa')](_0x212e('0x8c')+_0x184398+_0x212e('0x8d'),'id')[_0x212e('0xa')]('ui.createdAt')[_0x212e('0x8e')](_0x212e('0x8f')+_0x141676+_0x212e('0x90'),'ui')[_0x212e('0x91')](_0x212e('0x92'),_0x5ddae0['id']);return _0x3af1a8[_0x212e('0x93')][_0x212e('0x94')](_0x77601e[_0x212e('0x95')](),_0x24ce45)[_0x212e('0xc')](function(_0x4fd4f8){_0x5ddae0[_0x184398+_0x212e('0x96')]=_0x4fd4f8;_0x237020(_0x4fd4f8);})[_0x212e('0x9')](function(_0x47e053){_0x382670(_0x47e053);});});}return _0x3664d5[_0x212e('0x97')]('UserProfile',attributes,{'tableName':_0x212e('0x98'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x470df7){var _0x5820a9={'raw':_0x470df7[_0x212e('0x94')][_0x212e('0x99')],'where':{}};var _0x35408e={};var _0x261e76={'count':0x0,'rows':[]};var _0x189896=_0x470df7[_0x212e('0x94')][_0x212e('0x9a')];var _0x138f2b=_0x470df7['query'][_0x212e('0x9b')]||![];var _0xe86f0f=_0x39e609(_0x189896,_0x138f2b);if(!_0xe86f0f['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x189896+'\x27');var _0x512e96=[{'name':_0x189896}];if(!_[_0x212e('0x9c')](_0xe86f0f['parentSections']))_0x512e96=_0xe86f0f[_0x212e('0x18')];var _0x39fabb=[];for(var _0x58014e=0x0;_0x58014e<_0x512e96['length'];_0x58014e++){_0x39fabb[_0x212e('0x9d')](_0x3af1a8[_0x212e('0x9e')][_0x212e('0x9f')]({'where':{'userProfileId':_0x470df7[_0x212e('0xa0')]['id'],'name':_0x512e96[_0x58014e][_0x212e('0x19')]},'raw':!![]}));}return Promise[_0x212e('0xa1')](_0x39fabb)[_0x212e('0xc')](function(_0x4c2635){var _0xb47cd0=_['filter'](_0x4c2635,function(_0x4a9d78){return _0x4a9d78?_0x4a9d78:undefined;});var _0x22c921=_[_0x212e('0x5')](_0x512e96,[_0x212e('0xa2'),!![]]);var _0x479a13=_[_0x212e('0x9c')](_0xb47cd0)&&_['isEmpty'](_0x22c921)?null:_[_0x212e('0xa3')](_0x22c921,_0xb47cd0);if(!_0x479a13)return null;var _0xa8cd08=[];for(var _0x372164=0x0;_0x372164<_0x479a13[_0x212e('0xa4')];_0x372164++){var _0x41d3fb=_[_0x212e('0x9f')](_0x512e96,function(_0x5f15ef){return _0x479a13[_0x372164]?_0x5f15ef[_0x212e('0x19')]===_0x479a13[_0x372164][_0x212e('0x19')]:null;});if(_0x41d3fb){if(_0x479a13[_0x372164]['ignore']){_0xa8cd08[_0x212e('0x9d')](_0x1ac95a(_0xe86f0f['childModel'],_0x479a13[_0x372164]));}else{if(!_0x479a13[_0x372164]['autoAssociation']){_0xa8cd08[_0x212e('0x9d')](_0x16dea6(_0x41d3fb,_0x479a13[_0x372164],_0xe86f0f[_0x212e('0x14')]));}else{if(_0x41d3fb[_0x212e('0xb')]){_0xa8cd08[_0x212e('0x9d')](_0x17aea0(_0x41d3fb,_0x479a13[_0x372164]));}}}}}return Promise['all'](_0xa8cd08);})['then'](function(_0x1c0f26){var _0x580914=_0x1c0f26;var _0x2a55cf=null;if(_0x580914){_0x2a55cf=_0x580914[_0x212e('0xa4')]===0x1?_0x580914[0x0]:null;}if(!_0x2a55cf&&!_0x580914)return _0x261e76;var _0x420b1b=_0x3af1a8[_0xe86f0f['childModel']][_0x212e('0xa5')];_0x35408e['model']=_['keys'](_0x420b1b);_0x35408e[_0x212e('0x94')]=_['keys'](_0x470df7[_0x212e('0x94')]);_0x35408e['filters']=_[_0x212e('0xa6')](_0x35408e['model'],_0x35408e[_0x212e('0x94')]);_0x5820a9[_0x212e('0xa7')]=_['intersection'](_0x35408e[_0x212e('0xb')],qs[_0x212e('0xa8')](_0x470df7[_0x212e('0x94')][_0x212e('0xa8')]));_0x5820a9['attributes']=_0x5820a9[_0x212e('0xa7')][_0x212e('0xa4')]?_0x5820a9['attributes']:_0x35408e[_0x212e('0xb')];if(!_0x470df7[_0x212e('0x94')][_0x212e('0xa9')](_0x212e('0xaa'))){_0x5820a9['limit']=qs['limit'](_0x470df7[_0x212e('0x94')][_0x212e('0xab')]);_0x5820a9[_0x212e('0xac')]=qs[_0x212e('0xac')](_0x470df7[_0x212e('0x94')][_0x212e('0xac')]);}_0x5820a9[_0x212e('0xad')]=qs[_0x212e('0xae')](_0x470df7[_0x212e('0x94')][_0x212e('0xae')]);_0x5820a9[_0x212e('0x91')]=qs['filters'](_[_0x212e('0xaf')](_0x470df7['query'],_0x35408e[_0x212e('0xb0')]));if(_0x470df7[_0x212e('0x94')][_0x212e('0x5')]){_0x5820a9[_0x212e('0x91')]=_[_0x212e('0xb1')](_0x5820a9[_0x212e('0x91')],{'$or':_[_0x212e('0xd')](_0x420b1b,function(_0x281afa){if(_0x281afa[_0x212e('0x12')][_0x212e('0xb2')]!==_0x212e('0xb3')){var _0x503509={};_0x503509[_0x281afa[_0x212e('0xa')]]={'$like':'%'+_0x470df7[_0x212e('0x94')][_0x212e('0x5')]+'%'};return _0x503509;}})});}var _0x4306fe=[];var _0x1a9537=null;var _0x84c32f={};if(_0x2a55cf){_0x1a9537=_[_0x212e('0x9f')](_0x512e96,[_0x212e('0x19'),_0x2a55cf[_0x212e('0x19')]]);if(_0x1a9537['field']){_0x84c32f={};if(_0xe86f0f['childModel']===_0x212e('0x10')){_0x84c32f[_0x1a9537['foreignKey']]=_['map'](_0x2a55cf[_0x212e('0x8')],'id');}else{_0x84c32f[_0x1a9537['foreignKey']]=_0x2a55cf[_0x212e('0x8')];}_0x4306fe[_0x212e('0x9d')](_0x84c32f);}else{_0x5820a9[_0x212e('0x91')]['id']=_0x2a55cf[_0x212e('0x8')];}}else{for(var _0x6e4104=0x0;_0x6e4104<_0x580914[_0x212e('0xa4')];_0x6e4104++){_0x1a9537=_[_0x212e('0x9f')](_0x512e96,[_0x212e('0x19'),_0x580914[_0x6e4104][_0x212e('0x19')]]);if(_0x1a9537[_0x212e('0xa')]){_0x84c32f={};_0x84c32f[_0x1a9537[_0x212e('0xb4')]]=_0x580914[_0x6e4104][_0x212e('0x8')];_0x4306fe['push'](_0x84c32f);}else{if(!_0x5820a9[_0x212e('0x91')]['id'])_0x5820a9['where']['id']=[];_0x580914[_0x6e4104][_0x212e('0x8')]['forEach'](function(_0x5542e2){_0x5820a9[_0x212e('0x91')]['id'][_0x212e('0x9d')](_0x5542e2);});}}}if(!_[_0x212e('0x9c')](_0x4306fe)){_0x5820a9[_0x212e('0x91')]=_[_0x212e('0xb1')](_0x5820a9[_0x212e('0x91')],{'$and':{'$or':_0x4306fe}});}_0x5820a9=_[_0x212e('0xb1')]({},_0x5820a9,_0x470df7[_0x212e('0xb5')]);if(_0x2a55cf&&!_0x2a55cf[_0x212e('0xb6')]&&_0xe86f0f[_0x212e('0x14')]===_0x212e('0x10')){if(_0x470df7[_0x212e('0x94')][_0x212e('0xb7')]){_0x5820a9[_0x212e('0xb8')]=[{'all':!![]}];}return _0x3af1a8[_0xe86f0f[_0x212e('0x14')]][_0x212e('0x7')](_0x5820a9)[_0x212e('0xc')](function(_0x1c94e1){var _0x4cfb5d=[];_0x1c94e1[_0x212e('0xb9')](function(_0x4be27d){var _0x5b00a0;switch(_0x4be27d['reportType']){case _0x212e('0xba'):_0x5b00a0=_[_0x212e('0x9f')](_0x2a55cf[_0x212e('0x8')],function(_0x3b23e3){return _0x3b23e3['id']===_0x4be27d['reportId']&&_0x3b23e3[_0x212e('0x12')]===_0x212e('0xbb');});break;case'custom':_0x5b00a0=_[_0x212e('0x9f')](_0x2a55cf[_0x212e('0x8')],function(_0x3a01b8){return _0x3a01b8['id']===_0x4be27d[_0x212e('0x83')]&&_0x3a01b8[_0x212e('0x12')]==='CustomReports';});break;}if(_0x5b00a0)_0x4cfb5d[_0x212e('0x9d')](_0x4be27d);});_0x261e76[_0x212e('0xbc')]=_0x4cfb5d[_0x212e('0xa4')];_0x261e76[_0x212e('0xbd')]=_0x4cfb5d;return _0x261e76;});}else{if(!_['isEmpty'](_0x470df7[_0x212e('0x94')][_0x212e('0xbe')])){_0x5820a9[_0x212e('0x91')]['id']=_0x5820a9[_0x212e('0x91')]['id']?_[_0x212e('0xa6')](_0x5820a9[_0x212e('0x91')]['id'],_0x470df7[_0x212e('0x94')][_0x212e('0xbe')]):_0x470df7[_0x212e('0x94')][_0x212e('0xbe')];if(_0x470df7['query'][_0x212e('0xbf')]){_0x5820a9[_0x212e('0xad')]=_0x470df7[_0x212e('0x94')]['customSorting'];}}if(_0x470df7['query']['extraQueryConditions']){_0x5820a9['where']=_[_0x212e('0xb1')](_0x5820a9[_0x212e('0x91')],{'$and':_0x470df7[_0x212e('0x94')][_0x212e('0xc0')]});}return _0x3af1a8[_0xe86f0f[_0x212e('0x14')]][_0x212e('0xbc')]({'where':_0x5820a9['where']})[_0x212e('0xc')](function(_0x5a9e00){_0x261e76[_0x212e('0xbc')]=_0x5a9e00;if(_0x470df7[_0x212e('0x94')][_0x212e('0xb7')]){if(_0xe86f0f[_0x212e('0x14')]==='CmContact'){_0x5820a9[_0x212e('0xb8')]=[{'model':_0x3af1a8[_0x212e('0x79')],'as':_0x212e('0xc1'),'attributes':['id',_0x212e('0x19'),'color'],'required':_0x470df7[_0x212e('0x94')]['tag']?!![]:![]},{'model':_0x3af1a8[_0x212e('0x79')],'as':_0x212e('0xc2'),'attributes':['id',_0x212e('0x19'),_0x212e('0xc3')],'through':_0x470df7['query']['tag']?{'attributes':[],'where':{'TagId':_0x470df7[_0x212e('0x94')][_0x212e('0xc4')]||undefined}}:{},'required':_0x470df7['query'][_0x212e('0xc4')]?!![]:![]}];}else{_0x5820a9[_0x212e('0xb8')]=[{'all':!![]}];}}return _0x3af1a8[_0xe86f0f[_0x212e('0x14')]][_0x212e('0x7')](_0x5820a9);})[_0x212e('0xc')](function(_0x17c8fa){_0x261e76[_0x212e('0xbd')]=_0x17c8fa;if(_0x189896===_0x212e('0x34')&&_0x470df7[_0x212e('0x94')][_0x212e('0xc5')]===_0x212e('0xc6')){var _0x1b4024=[];for(var _0xbe73d=0x0;_0xbe73d<_0x261e76[_0x212e('0xbd')][_0x212e('0xa4')];_0xbe73d++){_0x1b4024[_0x212e('0x9d')](_0x367888('chat',_0x261e76[_0x212e('0xbd')][_0xbe73d]['dataValues']));_0x1b4024[_0x212e('0x9d')](_0x367888(_0x212e('0xc7'),_0x261e76[_0x212e('0xbd')][_0xbe73d]['dataValues']));_0x1b4024['push'](_0x367888('fax',_0x261e76[_0x212e('0xbd')][_0xbe73d][_0x212e('0xc8')]));_0x1b4024['push'](_0x367888(_0x212e('0xc9'),_0x261e76[_0x212e('0xbd')][_0xbe73d][_0x212e('0xc8')]));_0x1b4024[_0x212e('0x9d')](_0x367888(_0x212e('0xca'),_0x261e76[_0x212e('0xbd')][_0xbe73d]['dataValues']));_0x1b4024['push'](_0x367888(_0x212e('0xcb'),_0x261e76[_0x212e('0xbd')][_0xbe73d][_0x212e('0xc8')]));}return Promise[_0x212e('0xa1')](_0x1b4024)[_0x212e('0xc')](function(){return _0x261e76;});}return _0x261e76;});}});}}});};
\ No newline at end of file
+var _0x8fe3=['custom','CustomReports','rows','ids','customSorting','order','extraQueryConditions','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','value','then','catch','field','model','findAll','map','name','resolve','UserProfileResource','associatedResources','AnalyticExtractedReport','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','reportId','metrics','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','toString','define','UserProfile','user_profiles','../../components/parsers/qs','raw','query','section','mergeResources','isEmpty','length','params','all','ignore','union','find','push','autoAssociation','rawAttributes','keys','intersection','attributes','nolimit','limit','offset','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType'];(function(_0x55d7c2,_0x4ce6fb){var _0x1755ef=function(_0xddc25c){while(--_0xddc25c){_0x55d7c2['push'](_0x55d7c2['shift']());}};_0x1755ef(++_0x4ce6fb);}(_0x8fe3,0xd0));var _0x38fe=function(_0x361776,_0x1298cc){_0x361776=_0x361776-0x0;var _0x3041db=_0x8fe3[_0x361776];return _0x3041db;};'use strict';var _=require(_0x38fe('0x0'));var attributes=require(_0x38fe('0x1'));var squel=require('squel');module['exports']=function(_0x5bfd74){var _0x505076=_0x5bfd74[_0x38fe('0x2')];function _0x382b3a(_0xde568a,_0x370ea4){return new Promise(function(_0x305799,_0x19667e){if(!_0x370ea4)return _0x305799(null);var _0x342680=_0x370ea4['filter']?{[_0x370ea4[_0x38fe('0x3')]['field']]:_0x370ea4[_0x38fe('0x3')][_0x38fe('0x4')]}:undefined;return _0x505076[_0xde568a]['findAll']({'where':_0x342680,'raw':!![]})[_0x38fe('0x5')](function(_0x8995a1){_0x370ea4['associatedResources']=_['map'](_0x8995a1,'id');_0x305799(_0x370ea4);})[_0x38fe('0x6')](function(_0x3d7604){_0x19667e(_0x3d7604);});});}function _0x5d6619(_0x3f2d8f,_0x23c644){return new Promise(function(_0x4a9f91,_0x15be39){var _0x47e9d5=_0x3f2d8f[_0x38fe('0x3')]?{[_0x3f2d8f[_0x38fe('0x3')][_0x38fe('0x7')]]:_0x3f2d8f['filter'][_0x38fe('0x4')]}:undefined;return _0x505076[_0x3f2d8f[_0x38fe('0x8')]][_0x38fe('0x9')]({'where':_0x47e9d5,'raw':!![]})[_0x38fe('0x5')](function(_0x12ab57){_0x23c644['associatedResources']=_[_0x38fe('0xa')](_0x12ab57,function(_0x2b6d15){return _0x2b6d15[_0x38fe('0xb')];});_0x4a9f91(_0x23c644);})[_0x38fe('0x6')](function(_0x15c19b){_0x15be39(_0x15c19b);});});}function _0x30c694(_0x2d7b7b,_0x276355,_0x5408b5){if(!_0x276355)return Promise[_0x38fe('0xc')](null);return new Promise(function(_0x14752d,_0x4f67c8){return _0x505076[_0x38fe('0xd')][_0x38fe('0x9')]({'where':{'sectionId':_0x276355['id']},'raw':!![]})[_0x38fe('0x5')](function(_0x402936){if(_0x2d7b7b[_0x38fe('0x7')]&&_0x2d7b7b[_0x38fe('0x7')]!=='id'){_0x276355[_0x38fe('0xe')]=_[_0x38fe('0xa')](_0x402936,function(_0x4cb05d){return _0x4cb05d[_0x2d7b7b[_0x38fe('0x7')]];});}else{if(_0x5408b5===_0x38fe('0xf')){_0x276355[_0x38fe('0xe')]=_[_0x38fe('0xa')](_0x402936,function(_0x336ec4){return{'id':_0x336ec4['resourceId'],'type':_0x336ec4[_0x38fe('0x10')]};});}else{_0x276355[_0x38fe('0xe')]=_[_0x38fe('0xa')](_0x402936,function(_0x127de8){return _0x127de8['resourceId'];});}}_0x14752d(_0x276355);})['catch'](function(_0x1f52c1){_0x4f67c8(_0x1f52c1);});});}function _0x274366(_0x3058f3,_0x311020){var _0x4487c1={'parentSections':[]};switch(_0x3058f3[_0x38fe('0x11')]()){case'squareprojects':_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x13');break;case _0x38fe('0x14'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x15');break;case _0x38fe('0x16'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x17');_0x4487c1[_0x38fe('0x18')]=[{'name':_0x38fe('0x19'),'field':_0x38fe('0xb'),'foreignKey':_0x38fe('0x1a')}];break;case _0x38fe('0x1b'):_0x4487c1[_0x38fe('0x12')]='JscriptyProject';break;case _0x38fe('0x1c'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x1d');_0x4487c1['parentSections']=[{'name':_0x38fe('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0x38fe('0x1f'):_0x4487c1['childModel']='CmList';break;case _0x38fe('0x20'):_0x4487c1['childModel']=_0x38fe('0x21');break;case _0x38fe('0x22'):_0x4487c1['childModel']=_0x38fe('0x23');break;case'chatqueues':_0x4487c1[_0x38fe('0x12')]='ChatQueue';break;case _0x38fe('0x24'):_0x4487c1[_0x38fe('0x12')]='ChatWebsite';break;case _0x38fe('0x25'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x26');break;case _0x38fe('0x27'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x28');break;case _0x38fe('0x29'):case _0x38fe('0x2a'):case _0x38fe('0x2b'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x2c');break;case'contexts':_0x4487c1['childModel']=_0x38fe('0x2d');break;case _0x38fe('0x2e'):_0x4487c1[_0x38fe('0x12')]='VoiceMail';break;case _0x38fe('0x2f'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x30');_0x4487c1[_0x38fe('0x18')]=[{'name':_0x38fe('0x31'),'field':_0x38fe('0xb'),'foreignKey':_0x38fe('0x32'),'model':_0x38fe('0x33'),'filter':{'field':_0x38fe('0x34'),'value':[_0x38fe('0x35')]}},{'name':_0x38fe('0x36'),'field':_0x38fe('0xb'),'foreignKey':_0x38fe('0x32'),'model':'User','filter':{'field':_0x38fe('0x34'),'value':[_0x38fe('0x37')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x38fe('0x38'),'model':_0x38fe('0x39'),'filter':{'field':'type','value':[_0x38fe('0x3a')]}},{'name':_0x38fe('0x3b'),'field':_0x38fe('0xb'),'foreignKey':'queue','model':_0x38fe('0x39'),'filter':{'field':_0x38fe('0x10'),'value':[_0x38fe('0x3c')]}}];break;case _0x38fe('0x3d'):_0x4487c1[_0x38fe('0x12')]='VoiceMusicOnHold';break;case _0x38fe('0x3e'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x3f');break;case _0x38fe('0x40'):_0x4487c1[_0x38fe('0x12')]='VoicePrefix';break;case _0x38fe('0x41'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x42');break;case _0x38fe('0x43'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x44');break;case _0x38fe('0x45'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x46');break;case'mailsubstatuses':_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x47');break;case _0x38fe('0x48'):_0x4487c1[_0x38fe('0x12')]='OpenchannelQueue';break;case _0x38fe('0x49'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x4a');break;case'smsqueues':_0x4487c1['childModel']=_0x38fe('0x4b');break;case _0x38fe('0x4c'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x4d');break;case _0x38fe('0x4e'):_0x4487c1[_0x38fe('0x12')]='WhatsappQueue';break;case _0x38fe('0x4f'):_0x4487c1['childModel']=_0x38fe('0x50');break;case _0x38fe('0x51'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x52');break;case _0x38fe('0x53'):case _0x38fe('0x54'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x39');if(_0x311020){_0x4487c1[_0x38fe('0x18')]=[{'name':_0x38fe('0x55')},{'name':_0x38fe('0x3b')}];}break;case _0x38fe('0x56'):case _0x38fe('0x57'):case'telephones':_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x33');if(_0x311020){_0x4487c1['parentSections']=[{'name':'Users','filter':{'field':_0x38fe('0x34'),'value':[_0x38fe('0x58'),'user']},'ignore':!![]},{'name':_0x38fe('0x31')},{'name':_0x38fe('0x36')}];}break;case _0x38fe('0x59'):_0x4487c1['childModel']=_0x38fe('0x5a');break;case'salesforceaccounts':_0x4487c1['childModel']=_0x38fe('0x5b');break;case _0x38fe('0x5c'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x5d');break;case'sugarcrmaccounts':_0x4487c1['childModel']=_0x38fe('0x5e');break;case _0x38fe('0x5f'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x60');break;case _0x38fe('0x61'):_0x4487c1[_0x38fe('0x12')]='ZohoAccount';break;case _0x38fe('0x62'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x33');break;case _0x38fe('0x63'):_0x4487c1['childModel']=_0x38fe('0x64');break;case'dispositions':_0x4487c1['childModel']=_0x38fe('0x65');break;case'customdashboards':_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x66');break;case _0x38fe('0x67'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x68');break;case _0x38fe('0x69'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x6a');break;case _0x38fe('0x6b'):_0x4487c1['childModel']='Schedule';break;case'sounds':_0x4487c1[_0x38fe('0x12')]='Sound';break;case _0x38fe('0x6c'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x6d');break;case _0x38fe('0x6e'):_0x4487c1['childModel']=_0x38fe('0x6f');break;case _0x38fe('0x70'):_0x4487c1['childModel']=_0x38fe('0x71');break;case _0x38fe('0x72'):_0x4487c1['childModel']=_0x38fe('0x73');break;case _0x38fe('0x74'):_0x4487c1[_0x38fe('0x12')]=_0x38fe('0x75');break;case _0x38fe('0x76'):_0x4487c1[_0x38fe('0x12')]='Plugin';break;case'extractedreports':_0x4487c1['childModel']=_0x38fe('0xf');_0x4487c1['parentSections']=[{'name':_0x38fe('0x77'),'field':'id','foreignKey':_0x38fe('0x78')}];break;case _0x38fe('0x79'):_0x4487c1['childModel']='AnalyticMetric';break;}return _0x4487c1;}function _0xe55d09(_0x3367e1,_0x7dc287){var _0x53b78a=_0x3367e1[_0x38fe('0x7a')](0x0)['toUpperCase']()+_0x3367e1[_0x38fe('0x7b')](0x1);var _0x5acd9e={'type':_0x505076[_0x38fe('0x7c')][_0x38fe('0x7d')]['SELECT'],'raw':!![]};return new Promise(function(_0x9a53be,_0x4ddef8){var _0x4af157=squel[_0x38fe('0x7e')]()[_0x38fe('0x7')](_0x38fe('0x7f')+_0x53b78a+_0x38fe('0x80'),'id')[_0x38fe('0x7')](_0x38fe('0x81'))[_0x38fe('0x82')](_0x38fe('0x83')+_0x3367e1+'_interactions','ui')[_0x38fe('0x84')]('ui.UserId\x20=\x20?',_0x7dc287['id']);return _0x505076['sequelize']['query'](_0x4af157[_0x38fe('0x85')](),_0x5acd9e)[_0x38fe('0x5')](function(_0x497307){_0x7dc287[_0x53b78a+'OpenTabs']=_0x497307;_0x9a53be(_0x497307);})['catch'](function(_0x38dd39){_0x4ddef8(_0x38dd39);});});}return _0x5bfd74[_0x38fe('0x86')](_0x38fe('0x87'),attributes,{'tableName':_0x38fe('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x39074d){var _0x2f39ff=require(_0x38fe('0x89'));var _0x4adf12={'raw':_0x39074d['query'][_0x38fe('0x8a')],'where':{}};var _0xdb172b={};var _0xd66220={'count':0x0,'rows':[]};var _0x38f114=_0x39074d[_0x38fe('0x8b')][_0x38fe('0x8c')];var _0x6ce0c0=_0x39074d[_0x38fe('0x8b')][_0x38fe('0x8d')]||![];var _0x2cf570=_0x274366(_0x38f114,_0x6ce0c0);if(!_0x2cf570[_0x38fe('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x38f114+'\x27');var _0x13ba8c=[{'name':_0x38f114}];if(!_[_0x38fe('0x8e')](_0x2cf570['parentSections']))_0x13ba8c=_0x2cf570[_0x38fe('0x18')];var _0x1f5566=[];for(var _0x259a00=0x0;_0x259a00<_0x13ba8c[_0x38fe('0x8f')];_0x259a00++){_0x1f5566['push'](_0x505076['UserProfileSection']['find']({'where':{'userProfileId':_0x39074d[_0x38fe('0x90')]['id'],'name':_0x13ba8c[_0x259a00][_0x38fe('0xb')]},'raw':!![]}));}return Promise[_0x38fe('0x91')](_0x1f5566)[_0x38fe('0x5')](function(_0x393923){var _0x5d9530=_[_0x38fe('0x3')](_0x393923,function(_0x423b6a){return _0x423b6a?_0x423b6a:undefined;});var _0x2fbab1=_[_0x38fe('0x3')](_0x13ba8c,[_0x38fe('0x92'),!![]]);var _0x4f2aa0=_['isEmpty'](_0x5d9530)&&_[_0x38fe('0x8e')](_0x2fbab1)?null:_[_0x38fe('0x93')](_0x2fbab1,_0x5d9530);if(!_0x4f2aa0)return null;var _0x29d4dc=[];for(var _0x352a86=0x0;_0x352a86<_0x4f2aa0['length'];_0x352a86++){var _0x2b7fb6=_[_0x38fe('0x94')](_0x13ba8c,function(_0xf6bd36){return _0x4f2aa0[_0x352a86]?_0xf6bd36[_0x38fe('0xb')]===_0x4f2aa0[_0x352a86][_0x38fe('0xb')]:null;});if(_0x2b7fb6){if(_0x4f2aa0[_0x352a86][_0x38fe('0x92')]){_0x29d4dc[_0x38fe('0x95')](_0x382b3a(_0x2cf570['childModel'],_0x4f2aa0[_0x352a86]));}else{if(!_0x4f2aa0[_0x352a86][_0x38fe('0x96')]){_0x29d4dc[_0x38fe('0x95')](_0x30c694(_0x2b7fb6,_0x4f2aa0[_0x352a86],_0x2cf570[_0x38fe('0x12')]));}else{if(_0x2b7fb6[_0x38fe('0x8')]){_0x29d4dc['push'](_0x5d6619(_0x2b7fb6,_0x4f2aa0[_0x352a86]));}}}}}return Promise[_0x38fe('0x91')](_0x29d4dc);})[_0x38fe('0x5')](function(_0x1b08bb){var _0x5d80f7=_0x1b08bb;var _0x19b8ad=null;if(_0x5d80f7){_0x19b8ad=_0x5d80f7['length']===0x1?_0x5d80f7[0x0]:null;}if(!_0x19b8ad&&!_0x5d80f7)return _0xd66220;var _0x23e046=_0x505076[_0x2cf570[_0x38fe('0x12')]][_0x38fe('0x97')];_0xdb172b[_0x38fe('0x8')]=_[_0x38fe('0x98')](_0x23e046);_0xdb172b[_0x38fe('0x8b')]=_[_0x38fe('0x98')](_0x39074d[_0x38fe('0x8b')]);_0xdb172b['filters']=_[_0x38fe('0x99')](_0xdb172b[_0x38fe('0x8')],_0xdb172b['query']);_0x4adf12[_0x38fe('0x9a')]=_[_0x38fe('0x99')](_0xdb172b[_0x38fe('0x8')],_0x2f39ff['fields'](_0x39074d['query']['fields']));_0x4adf12['attributes']=_0x4adf12[_0x38fe('0x9a')]['length']?_0x4adf12[_0x38fe('0x9a')]:_0xdb172b[_0x38fe('0x8')];if(!_0x39074d[_0x38fe('0x8b')]['hasOwnProperty'](_0x38fe('0x9b'))){_0x4adf12['limit']=_0x2f39ff[_0x38fe('0x9c')](_0x39074d[_0x38fe('0x8b')][_0x38fe('0x9c')]);_0x4adf12['offset']=_0x2f39ff[_0x38fe('0x9d')](_0x39074d[_0x38fe('0x8b')][_0x38fe('0x9d')]);}_0x4adf12['order']=_0x2f39ff[_0x38fe('0x9e')](_0x39074d['query']['sort']);_0x4adf12[_0x38fe('0x84')]=_0x2f39ff[_0x38fe('0x9f')](_[_0x38fe('0xa0')](_0x39074d['query'],_0xdb172b[_0x38fe('0x9f')]));if(_0x39074d[_0x38fe('0x8b')][_0x38fe('0x3')]){_0x4adf12[_0x38fe('0x84')]=_[_0x38fe('0xa1')](_0x4adf12['where'],{'$or':_[_0x38fe('0xa')](_0x23e046,function(_0x4a62c5){if(_0x4a62c5[_0x38fe('0x10')][_0x38fe('0xa2')]!==_0x38fe('0xa3')){var _0x4dac05={};_0x4dac05[_0x4a62c5['field']]={'$like':'%'+_0x39074d[_0x38fe('0x8b')][_0x38fe('0x3')]+'%'};return _0x4dac05;}})});}var _0x3b0a2b=[];var _0x887036=null;var _0x227381={};if(_0x19b8ad){_0x887036=_[_0x38fe('0x94')](_0x13ba8c,[_0x38fe('0xb'),_0x19b8ad[_0x38fe('0xb')]]);if(_0x887036[_0x38fe('0x7')]){_0x227381={};if(_0x2cf570[_0x38fe('0x12')]===_0x38fe('0xf')){_0x227381[_0x887036['foreignKey']]=_[_0x38fe('0xa')](_0x19b8ad[_0x38fe('0xe')],'id');}else{_0x227381[_0x887036[_0x38fe('0xa4')]]=_0x19b8ad[_0x38fe('0xe')];}_0x3b0a2b[_0x38fe('0x95')](_0x227381);}else{_0x4adf12[_0x38fe('0x84')]['id']=_0x19b8ad[_0x38fe('0xe')];}}else{for(var _0x4ae5f4=0x0;_0x4ae5f4<_0x5d80f7[_0x38fe('0x8f')];_0x4ae5f4++){_0x887036=_[_0x38fe('0x94')](_0x13ba8c,[_0x38fe('0xb'),_0x5d80f7[_0x4ae5f4][_0x38fe('0xb')]]);if(_0x887036[_0x38fe('0x7')]){_0x227381={};_0x227381[_0x887036['foreignKey']]=_0x5d80f7[_0x4ae5f4]['associatedResources'];_0x3b0a2b[_0x38fe('0x95')](_0x227381);}else{if(!_0x4adf12[_0x38fe('0x84')]['id'])_0x4adf12[_0x38fe('0x84')]['id']=[];_0x5d80f7[_0x4ae5f4][_0x38fe('0xe')][_0x38fe('0xa5')](function(_0x1d2d9e){_0x4adf12[_0x38fe('0x84')]['id'][_0x38fe('0x95')](_0x1d2d9e);});}}}if(!_[_0x38fe('0x8e')](_0x3b0a2b)){_0x4adf12[_0x38fe('0x84')]=_['merge'](_0x4adf12[_0x38fe('0x84')],{'$and':{'$or':_0x3b0a2b}});}_0x4adf12=_[_0x38fe('0xa1')]({},_0x4adf12,_0x39074d[_0x38fe('0xa6')]);if(_0x19b8ad&&!_0x19b8ad['autoAssociation']&&_0x2cf570[_0x38fe('0x12')]===_0x38fe('0xf')){if(_0x39074d[_0x38fe('0x8b')][_0x38fe('0xa7')]){_0x4adf12[_0x38fe('0xa8')]=[{'all':!![]}];}return _0x505076[_0x2cf570[_0x38fe('0x12')]]['findAll'](_0x4adf12)[_0x38fe('0x5')](function(_0xa6cff3){var _0x13bc97=[];_0xa6cff3[_0x38fe('0xa5')](function(_0x229298){var _0x21ae0a;switch(_0x229298[_0x38fe('0xa9')]){case'default':_0x21ae0a=_[_0x38fe('0x94')](_0x19b8ad[_0x38fe('0xe')],function(_0x3aee18){return _0x3aee18['id']===_0x229298[_0x38fe('0x78')]&&_0x3aee18['type']==='DefaultReports';});break;case _0x38fe('0xaa'):_0x21ae0a=_[_0x38fe('0x94')](_0x19b8ad[_0x38fe('0xe')],function(_0x5642a7){return _0x5642a7['id']===_0x229298[_0x38fe('0x78')]&&_0x5642a7['type']===_0x38fe('0xab');});break;}if(_0x21ae0a)_0x13bc97[_0x38fe('0x95')](_0x229298);});_0xd66220['count']=_0x13bc97[_0x38fe('0x8f')];_0xd66220[_0x38fe('0xac')]=_0x13bc97;return _0xd66220;});}else{if(!_[_0x38fe('0x8e')](_0x39074d[_0x38fe('0x8b')]['ids'])){_0x4adf12['where']['id']=_0x4adf12[_0x38fe('0x84')]['id']?_['intersection'](_0x4adf12[_0x38fe('0x84')]['id'],_0x39074d['query'][_0x38fe('0xad')]):_0x39074d[_0x38fe('0x8b')]['ids'];if(_0x39074d[_0x38fe('0x8b')][_0x38fe('0xae')]){_0x4adf12[_0x38fe('0xaf')]=_0x39074d[_0x38fe('0x8b')][_0x38fe('0xae')];}}if(_0x39074d[_0x38fe('0x8b')][_0x38fe('0xb0')]){_0x4adf12[_0x38fe('0x84')]=_[_0x38fe('0xa1')](_0x4adf12[_0x38fe('0x84')],{'$and':_0x39074d['query']['extraQueryConditions']});}return _0x505076[_0x2cf570[_0x38fe('0x12')]]['count']({'where':_0x4adf12[_0x38fe('0x84')]})[_0x38fe('0x5')](function(_0x4f74e9){_0xd66220['count']=_0x4f74e9;if(_0x39074d[_0x38fe('0x8b')]['includeAll']){if(_0x2cf570[_0x38fe('0x12')]===_0x38fe('0x1d')){_0x4adf12[_0x38fe('0xa8')]=[{'model':_0x505076['Tag'],'as':'Tags','attributes':['id','name',_0x38fe('0xb1')],'required':_0x39074d['query']['tag']?!![]:![]},{'model':_0x505076[_0x38fe('0x6d')],'as':_0x38fe('0xb2'),'attributes':['id','name',_0x38fe('0xb1')],'through':_0x39074d[_0x38fe('0x8b')][_0x38fe('0xb3')]?{'attributes':[],'where':{'TagId':_0x39074d[_0x38fe('0x8b')][_0x38fe('0xb3')]||undefined}}:{},'required':_0x39074d[_0x38fe('0x8b')][_0x38fe('0xb3')]?!![]:![]}];}else{_0x4adf12[_0x38fe('0xa8')]=[{'all':!![]}];}}return _0x505076[_0x2cf570[_0x38fe('0x12')]][_0x38fe('0x9')](_0x4adf12);})[_0x38fe('0x5')](function(_0x202147){_0xd66220[_0x38fe('0xac')]=_0x202147;if(_0x38f114==='Agents'&&_0x39074d[_0x38fe('0x8b')][_0x38fe('0xb4')]===_0x38fe('0xb5')){var _0x256c1c=[];for(var _0x317c06=0x0;_0x317c06<_0xd66220[_0x38fe('0xac')][_0x38fe('0x8f')];_0x317c06++){_0x256c1c[_0x38fe('0x95')](_0xe55d09(_0x38fe('0xb6'),_0xd66220[_0x38fe('0xac')][_0x317c06][_0x38fe('0xb7')]));_0x256c1c['push'](_0xe55d09(_0x38fe('0xb8'),_0xd66220[_0x38fe('0xac')][_0x317c06][_0x38fe('0xb7')]));_0x256c1c['push'](_0xe55d09(_0x38fe('0xb9'),_0xd66220['rows'][_0x317c06][_0x38fe('0xb7')]));_0x256c1c[_0x38fe('0x95')](_0xe55d09(_0x38fe('0xba'),_0xd66220['rows'][_0x317c06][_0x38fe('0xb7')]));_0x256c1c[_0x38fe('0x95')](_0xe55d09(_0x38fe('0xbb'),_0xd66220[_0x38fe('0xac')][_0x317c06][_0x38fe('0xb7')]));_0x256c1c[_0x38fe('0x95')](_0xe55d09(_0x38fe('0xbc'),_0xd66220['rows'][_0x317c06][_0x38fe('0xb7')]));}return Promise[_0x38fe('0x91')](_0x256c1c)[_0x38fe('0x5')](function(){return _0xd66220;});}return _0xd66220;});}});}}});};
\ No newline at end of file