Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / api / userProfile / userProfile.controller.js
index c1ae574..047a72e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd817=['FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceRecording','parentSections','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','SmsQueue','WhatsappQueue','whatsappaccounts','voicequeues','users','agents','telephones','Users','admin','user','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','pauses','Schedule','Sound','tags','Template','triggers','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','UserProfile','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','fields','find','create','body','clone','get','omit','createdAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','updatedAt','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','transaction','destroy','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','undefined','Invalid\x20section\x20\x27','all','union','ignore','childModel','order','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','Tag','tag','ThroughTags','color','value','SquareProject','SquareRecording','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue'];(function(_0x3a5b87,_0x5d3457){var _0x48b275=function(_0xab0520){while(--_0xab0520){_0x3a5b87['push'](_0x3a5b87['shift']());}};_0x48b275(++_0x5d3457);}(_0xd817,0x12e));var _0x7d81=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xd817[_0x2c9b79];return _0x265032;};'use strict';var pdf=require(_0x7d81('0x0'));var emlformat=require(_0x7d81('0x1'));var rimraf=require(_0x7d81('0x2'));var zipdir=require(_0x7d81('0x3'));var jsonpatch=require(_0x7d81('0x4'));var rp=require(_0x7d81('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d81('0x6'));var path=require(_0x7d81('0x7'));var sox=require(_0x7d81('0x8'));var csv=require(_0x7d81('0x9'));var ejs=require(_0x7d81('0xa'));var fs=require('fs');var _=require(_0x7d81('0xb'));var squel=require('squel');var crypto=require(_0x7d81('0xc'));var jsforce=require(_0x7d81('0xd'));var deskjs=require(_0x7d81('0xe'));var toCsv=require(_0x7d81('0x9'));var querystring=require('querystring');var Papa=require(_0x7d81('0xf'));var Redis=require(_0x7d81('0x10'));var authService=require(_0x7d81('0x11'));var qs=require(_0x7d81('0x12'));var as=require(_0x7d81('0x13'));var hardwareService=require(_0x7d81('0x14'));var logger=require(_0x7d81('0x15'))(_0x7d81('0x16'));var utils=require(_0x7d81('0x17'));var config=require(_0x7d81('0x18'));var licenseUtil=require(_0x7d81('0x19'));var db=require(_0x7d81('0x1a'))['db'];config[_0x7d81('0x1b')]=_[_0x7d81('0x1c')](config['redis'],{'host':_0x7d81('0x1d'),'port':0x18eb});var socket=require(_0x7d81('0x1e'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x28eea6,_0x5cce3e){_0x5cce3e=_0x5cce3e||0xcc;return function(_0x2ec603){if(_0x2ec603){return _0x28eea6[_0x7d81('0x1f')](_0x5cce3e);}return _0x28eea6[_0x7d81('0x20')](_0x5cce3e)[_0x7d81('0x21')]();};}function respondWithResult(_0x1ffe09,_0x1bee64){_0x1bee64=_0x1bee64||0xc8;return function(_0x51defe){if(_0x51defe){return _0x1ffe09[_0x7d81('0x20')](_0x1bee64)['json'](_0x51defe);}};}function respondWithFilteredResult(_0x583009,_0x556a76){return function(_0x2b1cb6){if(_0x2b1cb6){var _0x2352bd=_0x2b1cb6[_0x7d81('0x22')],_0x47a9c2=_0x556a76[_0x7d81('0x23')],_0x479546=_0x556a76[_0x7d81('0x23')]+_0x556a76[_0x7d81('0x24')],_0x159c0f;if(_0x479546>=_0x2352bd){_0x479546=_0x2352bd;_0x159c0f=0xc8;}else{_0x159c0f=0xce;}_0x583009[_0x7d81('0x20')](_0x159c0f);return _0x583009[_0x7d81('0x25')](_0x7d81('0x26'),_0x47a9c2+'-'+_0x479546+'/'+_0x2352bd)[_0x7d81('0x27')](_0x2b1cb6);}return null;};}function patchUpdates(_0x415147){return function(_0x4277c7){try{jsonpatch[_0x7d81('0x28')](_0x4277c7,_0x415147,!![]);}catch(_0xe2cc47){return BPromise[_0x7d81('0x29')](_0xe2cc47);}return _0x4277c7[_0x7d81('0x2a')]();};}function saveUpdates(_0x463a7b,_0x10702c){return function(_0x4f74ea){if(_0x4f74ea){return _0x4f74ea[_0x7d81('0x2b')](_0x463a7b)[_0x7d81('0x2c')](function(_0x4f931d){return _0x4f931d;});}return null;};}function removeEntity(_0x3037c9,_0x59596a){return function(_0x3b0eda){if(_0x3b0eda){return _0x3b0eda['destroy']()[_0x7d81('0x2c')](function(){_0x3037c9[_0x7d81('0x20')](0xcc)[_0x7d81('0x21')]();});}};}function handleEntityNotFound(_0x218a5b,_0x3eb48e){return function(_0x52f32a){if(!_0x52f32a){_0x218a5b[_0x7d81('0x1f')](0x194);}return _0x52f32a;};}function handleError(_0x6d06b7,_0x240e4a){_0x240e4a=_0x240e4a||0x1f4;return function(_0x3e17e0){logger['error'](_0x3e17e0[_0x7d81('0x2d')]);if(_0x3e17e0[_0x7d81('0x2e')]){delete _0x3e17e0['name'];}_0x6d06b7[_0x7d81('0x20')](_0x240e4a)[_0x7d81('0x2f')](_0x3e17e0);};}exports[_0x7d81('0x30')]=function(_0x4fa734,_0x20ecaf){var _0x370565={},_0x1fdd11={},_0x55e273={'count':0x0,'rows':[]};var _0x504a43=_[_0x7d81('0x31')](db['UserProfile']['rawAttributes'],function(_0x36d40d){return{'name':_0x36d40d[_0x7d81('0x32')],'type':_0x36d40d[_0x7d81('0x33')][_0x7d81('0x34')]};});_0x1fdd11[_0x7d81('0x35')]=_[_0x7d81('0x31')](_0x504a43,_0x7d81('0x2e'));_0x1fdd11[_0x7d81('0x36')]=_['keys'](_0x4fa734['query']);_0x1fdd11['filters']=_[_0x7d81('0x37')](_0x1fdd11[_0x7d81('0x35')],_0x1fdd11['query']);_0x370565[_0x7d81('0x38')]=_[_0x7d81('0x37')](_0x1fdd11[_0x7d81('0x35')],qs['fields'](_0x4fa734['query']['fields']));_0x370565[_0x7d81('0x38')]=_0x370565[_0x7d81('0x38')][_0x7d81('0x39')]?_0x370565[_0x7d81('0x38')]:_0x1fdd11[_0x7d81('0x35')];if(!_0x4fa734[_0x7d81('0x36')][_0x7d81('0x3a')](_0x7d81('0x3b'))){_0x370565[_0x7d81('0x24')]=qs['limit'](_0x4fa734['query'][_0x7d81('0x24')]);_0x370565[_0x7d81('0x23')]=qs[_0x7d81('0x23')](_0x4fa734[_0x7d81('0x36')][_0x7d81('0x23')]);}_0x370565['order']=qs[_0x7d81('0x3c')](_0x4fa734[_0x7d81('0x36')][_0x7d81('0x3c')]);_0x370565[_0x7d81('0x3d')]=qs[_0x7d81('0x3e')](_[_0x7d81('0x3f')](_0x4fa734[_0x7d81('0x36')],_0x1fdd11[_0x7d81('0x3e')]),_0x504a43);if(_0x4fa734[_0x7d81('0x36')][_0x7d81('0x40')]){_0x370565[_0x7d81('0x3d')]=_['merge'](_0x370565[_0x7d81('0x3d')],{'$or':_['map'](_0x504a43,function(_0x965ae0){if(_0x965ae0[_0x7d81('0x33')]!=='VIRTUAL'){var _0x307f5e={};_0x307f5e[_0x965ae0[_0x7d81('0x2e')]]={'$like':'%'+_0x4fa734[_0x7d81('0x36')]['filter']+'%'};return _0x307f5e;}})});}_0x370565=_[_0x7d81('0x41')]({},_0x370565,_0x4fa734[_0x7d81('0x42')]);var _0x3a29c6={'where':_0x370565[_0x7d81('0x3d')]};return db[_0x7d81('0x43')][_0x7d81('0x22')](_0x3a29c6)['then'](function(_0x1bf68b){_0x55e273[_0x7d81('0x22')]=_0x1bf68b;if(_0x4fa734['query'][_0x7d81('0x44')]){_0x370565[_0x7d81('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x7d81('0x46')](_0x370565);})[_0x7d81('0x2c')](function(_0x532176){_0x55e273[_0x7d81('0x47')]=_0x532176;return _0x55e273;})[_0x7d81('0x2c')](respondWithFilteredResult(_0x20ecaf,_0x370565))[_0x7d81('0x48')](handleError(_0x20ecaf,null));};exports['show']=function(_0x1003c4,_0x4ad0fe){var _0x249c98={'raw':![],'where':{'id':_0x1003c4[_0x7d81('0x49')]['id']}},_0x10735f={};_0x10735f[_0x7d81('0x35')]=_[_0x7d81('0x4a')](db[_0x7d81('0x43')][_0x7d81('0x4b')]);_0x10735f[_0x7d81('0x36')]=_[_0x7d81('0x4a')](_0x1003c4['query']);_0x10735f[_0x7d81('0x3e')]=_[_0x7d81('0x37')](_0x10735f[_0x7d81('0x35')],_0x10735f[_0x7d81('0x36')]);_0x249c98[_0x7d81('0x38')]=_[_0x7d81('0x37')](_0x10735f[_0x7d81('0x35')],qs['fields'](_0x1003c4[_0x7d81('0x36')][_0x7d81('0x4c')]));_0x249c98[_0x7d81('0x38')]=_0x249c98['attributes'][_0x7d81('0x39')]?_0x249c98[_0x7d81('0x38')]:_0x10735f[_0x7d81('0x35')];if(_0x1003c4[_0x7d81('0x36')][_0x7d81('0x44')]){_0x249c98[_0x7d81('0x45')]=[{'all':!![]}];}_0x249c98=_[_0x7d81('0x41')]({},_0x249c98,_0x1003c4[_0x7d81('0x42')]);return db[_0x7d81('0x43')][_0x7d81('0x4d')](_0x249c98)['then'](handleEntityNotFound(_0x4ad0fe,null))['then'](respondWithResult(_0x4ad0fe,null))[_0x7d81('0x48')](handleError(_0x4ad0fe,null));};exports[_0x7d81('0x4e')]=function(_0x558ae8,_0xb61b73){return db['UserProfile']['create'](_0x558ae8[_0x7d81('0x4f')],{})[_0x7d81('0x2c')](respondWithResult(_0xb61b73,0xc9))[_0x7d81('0x48')](handleError(_0xb61b73,null));};exports[_0x7d81('0x50')]=function(_0x1d3387,_0x4f24bf){var _0x31e970={'where':{'id':_0x1d3387['params']['id']}},_0x402849={};_0x402849['model']=_[_0x7d81('0x4a')](db[_0x7d81('0x43')][_0x7d81('0x4b')]);_0x31e970['attributes']=_[_0x7d81('0x37')](_0x402849['model'],qs[_0x7d81('0x4c')](_0x1d3387[_0x7d81('0x36')][_0x7d81('0x4c')]));_0x31e970['attributes']=_0x31e970['attributes'][_0x7d81('0x39')]?_0x31e970[_0x7d81('0x38')]:_0x402849[_0x7d81('0x35')];if(_0x1d3387[_0x7d81('0x36')][_0x7d81('0x44')]){_0x31e970['include']=[{'all':!![]}];}_0x31e970=_[_0x7d81('0x41')]({},_0x31e970,_0x1d3387[_0x7d81('0x42')]);return db[_0x7d81('0x43')][_0x7d81('0x4d')](_0x31e970)[_0x7d81('0x2c')](handleEntityNotFound(_0x4f24bf,null))[_0x7d81('0x2c')](function(_0xa78961){if(_0xa78961){var _0x479be9=_0xa78961[_0x7d81('0x51')]({'plain':!![]});_0x479be9=qs[_0x7d81('0x52')](_0x479be9,['id',_0x7d81('0x53'),'updatedAt',_0x7d81('0x54')]);_0x1d3387[_0x7d81('0x4f')]=_[_0x7d81('0x52')](_0x1d3387['body'],['id',_0x7d81('0x53'),'updatedAt']);return db[_0x7d81('0x55')]['transaction'](function(_0x182e3a){return db[_0x7d81('0x43')]['create'](_['merge'](_0x479be9,_0x1d3387[_0x7d81('0x4f')]),{'include':_0x1d3387['query'][_0x7d81('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x182e3a})[_0x7d81('0x2c')](function(_0x1c9088){var _0x36eebd=_0x1c9088[_0x7d81('0x51')]({'plain':!![]});return db[_0x7d81('0x56')][_0x7d81('0x46')]({'where':{'userProfileId':_0x1d3387[_0x7d81('0x49')]['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x4bcfa2){if(_0x4bcfa2){return BPromise[_0x7d81('0x57')](_0x4bcfa2,function(_0x2d2b85){return new BPromise(function(_0x227702,_0x23066b){if(_0x2d2b85[_0x7d81('0x58')]===null||_0x2d2b85[_0x7d81('0x58')]===0x1)_0x227702(null);return db['UserProfileResource'][_0x7d81('0x46')]({'where':{'sectionId':_0x2d2b85['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x235bea){var _0x2aa89e=_[_0x7d81('0x31')](_0x235bea,function(_0x5cb750){return qs[_0x7d81('0x52')](_0x5cb750,['id',_0x7d81('0x53'),_0x7d81('0x59'),_0x7d81('0x5a')]);});_0x227702(_0x2aa89e);})[_0x7d81('0x48')](function(_0x31151b){_0x23066b(_0x31151b);});})[_0x7d81('0x2c')](function(_0x36b805){var _0x3ca2b6=qs['omit'](_0x2d2b85,['id','createdAt',_0x7d81('0x59')]);_0x3ca2b6[_0x7d81('0x5b')]=_0x36eebd['id'];if(_0x36b805)_0x3ca2b6[_0x7d81('0x5c')]=_0x36b805;return _0x3ca2b6;})['then'](function(_0x56aa6b){return db[_0x7d81('0x56')][_0x7d81('0x4e')](_0x56aa6b,{'include':[{'model':db[_0x7d81('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x182e3a});});})['then'](function(){return _0x36eebd;});}});});});}})['then'](respondWithResult(_0x4f24bf,0xc9))[_0x7d81('0x48')](handleError(_0x4f24bf,null));};exports[_0x7d81('0x2b')]=function(_0x4a5eee,_0x3c2535){if(_0x4a5eee['body']['id']){delete _0x4a5eee[_0x7d81('0x4f')]['id'];}return db['UserProfile'][_0x7d81('0x4d')]({'where':{'id':_0x4a5eee[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x3c2535,null))['then'](saveUpdates(_0x4a5eee['body'],null))[_0x7d81('0x2c')](respondWithResult(_0x3c2535,null))[_0x7d81('0x48')](handleError(_0x3c2535,null));};exports['destroy']=function(_0x542ddb,_0x8192a0){return db[_0x7d81('0x43')][_0x7d81('0x4d')]({'where':{'id':_0x542ddb[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x8192a0,null))[_0x7d81('0x2c')](removeEntity(_0x8192a0,null))[_0x7d81('0x48')](handleError(_0x8192a0,null));};exports['describe']=function(_0x51cc86,_0x1afd8b){return db['UserProfile'][_0x7d81('0x5e')]()[_0x7d81('0x2c')](respondWithResult(_0x1afd8b,null))[_0x7d81('0x48')](handleError(_0x1afd8b,null));};exports[_0x7d81('0x5f')]=function(_0x2e1294,_0x3aec2c){var _0x10a979=_0x2e1294['body'];return db[_0x7d81('0x43')]['find']({'where':{'id':_0x2e1294[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x3aec2c,null))[_0x7d81('0x2c')](function(_0x3c4b09){if(_0x3c4b09){return db['sequelize'][_0x7d81('0x60')](function(_0x6b1098){return db[_0x7d81('0x56')][_0x7d81('0x61')]({'where':{'userProfileId':_0x2e1294[_0x7d81('0x49')]['id'],'sectionId':_[_0x7d81('0x31')](_0x10a979,function(_0x21ffa2){return _0x21ffa2['sectionId'];})},'transaction':_0x6b1098})['then'](function(){var _0xd53e99=_['map'](_0x10a979,function(_0x2fdae7){_0x2fdae7[_0x7d81('0x5b')]=_0x2e1294[_0x7d81('0x49')]['id'];return _0x2fdae7;});var _0x5767d1=[];return BPromise[_0x7d81('0x57')](_0xd53e99,function(_0x398b8b){return db[_0x7d81('0x56')]['create'](_0x398b8b,{'include':[{'model':db[_0x7d81('0x5d')],'as':_0x7d81('0x5c')}],'raw':!![],'transaction':_0x6b1098})[_0x7d81('0x2c')](function(_0x27b305){_0x5767d1[_0x7d81('0x62')](_0x27b305[_0x7d81('0x51')]({'plain':!![]}));});})[_0x7d81('0x2c')](function(){return _0x5767d1;});});});}})[_0x7d81('0x2c')](function(_0xd32268){return _0xd32268;})[_0x7d81('0x2c')](respondWithResult(_0x3aec2c,null))['catch'](handleError(_0x3aec2c,null));};exports[_0x7d81('0x63')]=function(_0x2c9ce0,_0x580242){var _0x4b540a;return db['UserProfile'][_0x7d81('0x4d')]({'where':{'id':_0x2c9ce0[_0x7d81('0x49')]['id']},'attributes':['id','name']})[_0x7d81('0x2c')](handleEntityNotFound(_0x580242,null))[_0x7d81('0x2c')](function(_0x266ef7){if(_0x266ef7){_0x4b540a=_0x266ef7;return db[_0x7d81('0x56')][_0x7d81('0x61')]({'where':{'userProfileId':_0x2c9ce0[_0x7d81('0x49')]['id'],'sectionId':_0x2c9ce0['query']['ids']}});}})[_0x7d81('0x2c')](function(){return _0x4b540a;})[_0x7d81('0x2c')](respondWithStatusCode(_0x580242,null))[_0x7d81('0x48')](handleError(_0x580242,null));};exports[_0x7d81('0x64')]=function(_0x146bd4,_0x4d32ab){var _0x2eeb34=[];var _0x5d2ff5=[];return db['UserProfileSection'][_0x7d81('0x46')]({'where':{'userProfileId':_0x146bd4['params']['id']},'raw':!![]})['then'](function(_0x289619){_0x2eeb34=_[_0x7d81('0x40')](_0x289619,function(_0x33b064){return _0x33b064[_0x7d81('0x65')]===0x1||_[_0x7d81('0x66')]([0x3eb,0x709],_0x33b064[_0x7d81('0x5a')]);});if(!_[_0x7d81('0x67')](_0x2eeb34)){return _[_0x7d81('0x31')](_0x2eeb34,function(_0x438373){return _0x438373[_0x7d81('0x5a')];});}else{return;}})[_0x7d81('0x2c')](function(_0x3b8415){if(_0x3b8415)_0x5d2ff5=_0x3b8415;if(_[_0x7d81('0x66')](_0x5d2ff5,0x64)){var _0x48ab42=_[_0x7d81('0x4d')](_0x2eeb34,{'sectionId':0x64});return hasDefaultDashboard(_0x48ab42)['then'](function(_0x31a7fd){return _[_0x7d81('0x31')](_0x2eeb34,function(_0x1d749d){if(_0x1d749d[_0x7d81('0x5a')]===0x64){_0x1d749d[_0x7d81('0x68')]=_0x31a7fd;}return _0x1d749d;});});}else{return;}})['then'](function(_0x161e8f){if(_0x161e8f)_0x2eeb34=_0x161e8f;if(_[_0x7d81('0x66')](_0x5d2ff5,0x3eb)){var _0x38dbd4=_[_0x7d81('0x4d')](_0x2eeb34,{'sectionId':0x3eb});return getCustomDashboards(_0x38dbd4)[_0x7d81('0x2c')](function(_0x51156f){return _[_0x7d81('0x31')](_0x2eeb34,function(_0x20749a){if(_0x38dbd4['enabled']){if(_0x20749a[_0x7d81('0x5a')]===0x3eb){_0x20749a[_0x7d81('0x68')]=_0x51156f;}}else{if(_0x20749a[_0x7d81('0x5a')]===0x64){_0x20749a[_0x7d81('0x68')]=_0x51156f;}}return _0x20749a;});});}else{return;}})[_0x7d81('0x2c')](function(_0x3b2afd){if(_0x3b2afd)_0x2eeb34=_0x3b2afd;if(_[_0x7d81('0x66')](_0x5d2ff5,0x709)){var _0x34bab2=_['find'](_0x2eeb34,{'sectionId':0x709});return getPlugins(_0x34bab2)[_0x7d81('0x2c')](function(_0x596460){if(_0x34bab2[_0x7d81('0x65')]){return _[_0x7d81('0x31')](_0x2eeb34,function(_0xc6f8ef){if(_0xc6f8ef['sectionId']===0x709){_0xc6f8ef['subsections']=_0x596460;}return _0xc6f8ef;});}else{var _0x918405={'sectionId':0x76c,'enabled':0x1,'subsections':_0x596460};var _0x64a10=_[_0x7d81('0x31')](_0x2eeb34);_0x64a10[_0x7d81('0x62')](_0x918405);return _0x64a10;}});}else{return;}})[_0x7d81('0x2c')](function(_0x53703b){if(_0x53703b)_0x2eeb34=_0x53703b;return _['filter'](_0x2eeb34,[_0x7d81('0x65'),0x1]);})[_0x7d81('0x2c')](respondWithResult(_0x4d32ab,null))[_0x7d81('0x48')](handleError(_0x4d32ab,null));};function hasDefaultDashboard(_0x516994){var _0x3b9235=[0x65];return new BPromise(function(_0x6a9ddc,_0x1dd49c){try{if(_0x516994[_0x7d81('0x58')]){_0x6a9ddc(_0x3b9235);}else{return db[_0x7d81('0x5d')][_0x7d81('0x69')]({'where':{'sectionId':_0x516994['id']},'raw':!![]})['then'](function(_0x335bc9){_0x335bc9?_0x6a9ddc(_0x3b9235):_0x6a9ddc();});}}catch(_0x684577){_0x1dd49c(_0x684577);}});}function getCustomDashboards(_0x55838b){var _0x24a710=[];return new BPromise(function(_0x28cae2,_0x51858d){try{if(_0x55838b[_0x7d81('0x58')]){return db[_0x7d81('0x6a')]['findAll']({'raw':!![]})[_0x7d81('0x2c')](function(_0x43ce56){_0x43ce56[_0x7d81('0x6b')](function(_0x4039d2){_0x24a710[_0x7d81('0x62')](_0x4039d2['id']+0x1869f);});_0x28cae2(_0x24a710);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x55838b['id']},'raw':!![]})['then'](function(_0x3dbccc){_0x3dbccc[_0x7d81('0x6b')](function(_0x5df653){_0x24a710[_0x7d81('0x62')](_0x5df653['resourceId']+0x1869f);});_0x28cae2(_0x24a710);});}}catch(_0x5c8e36){_0x51858d(_0x5c8e36);}});}function getPlugins(_0x2992b0){var _0x25973e=[];return new BPromise(function(_0x13f494,_0x1afdac){try{if(_0x2992b0[_0x7d81('0x58')]){return db[_0x7d81('0x6c')][_0x7d81('0x46')]({'raw':!![]})['then'](function(_0x3c76b8){_0x3c76b8[_0x7d81('0x6b')](function(_0x3283e7){_0x25973e['push'](_0x3283e7['id']+0x15b38);});_0x13f494(_0x25973e);});}else{return db[_0x7d81('0x5d')][_0x7d81('0x46')]({'where':{'sectionId':_0x2992b0['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x3e0add){_0x3e0add[_0x7d81('0x6b')](function(_0x5c4dda){_0x25973e['push'](_0x5c4dda[_0x7d81('0x6d')]+0x15b38);});_0x13f494(_0x25973e);});}}catch(_0x11157b){_0x1afdac(_0x11157b);}});}exports[_0x7d81('0x6e')]=function(_0xbd917d,_0x5754f8){return db[_0x7d81('0x43')][_0x7d81('0x4d')]({'where':{'id':_0xbd917d[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x5754f8,null))[_0x7d81('0x2c')](function(_0x1d1c41){if(_0x1d1c41){return db[_0x7d81('0x55')][_0x7d81('0x60')](function(_0x5acef3){return db[_0x7d81('0x56')][_0x7d81('0x46')]({'where':{'userProfileId':_0xbd917d[_0x7d81('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x7d81('0x2c')](function(_0x54fc76){if(_0x54fc76){return db[_0x7d81('0x56')][_0x7d81('0x61')]({'where':{'userProfileId':_0xbd917d[_0x7d81('0x49')]['id'],'id':_[_0x7d81('0x31')](_0x54fc76,function(_0x3877f6){return _0x3877f6['id'];})},'transaction':_0x5acef3});}})[_0x7d81('0x2c')](function(_0x49f7bc){var _0x577afc=_[_0x7d81('0x31')](_0xbd917d[_0x7d81('0x4f')],function(_0x5b24d6){_0x5b24d6[_0x7d81('0x5b')]=_0xbd917d[_0x7d81('0x49')]['id'];return _0x5b24d6;});return db['UserProfileSection'][_0x7d81('0x6f')](_0x577afc,{'raw':!![],'transaction':_0x5acef3});})[_0x7d81('0x2c')](function(_0x3263dd){var _0x237c25=_[_0x7d81('0x40')](_[_0x7d81('0x31')](_0x3263dd,function(_0x30c5e9){return _0x30c5e9['get']({'plain':!![]});}),{'includeAll':![]});if(_0x237c25){return db[_0x7d81('0x56')][_0x7d81('0x46')]({'where':{'userProfileId':_0xbd917d[_0x7d81('0x49')]['id'],'sectionId':_[_0x7d81('0x31')](_0x237c25,function(_0x57fd95){return _0x57fd95[_0x7d81('0x5a')];})},'attributes':['id',_0x7d81('0x5a')],'raw':!![]})[_0x7d81('0x2c')](function(_0x5b21ed){var _0x1db2a9=_[_0x7d81('0x31')](_0xbd917d[_0x7d81('0x4f')],function(_0x2be4da){_0x2be4da[_0x7d81('0x5b')]=_0xbd917d[_0x7d81('0x49')]['id'];return _0x2be4da;});return db[_0x7d81('0x5d')][_0x7d81('0x6f')](_0x1db2a9,{'raw':!![],'transaction':_0x5acef3});});}})['catch'](handleError(_0x5754f8,null));});}})[_0x7d81('0x2c')](function(_0x1065ca){var _0x351b46=_[_0x7d81('0x31')](_0x1065ca,function(_0x4febe6){return _0x4febe6[_0x7d81('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x5754f8,null))['catch'](handleError(_0x5754f8,null));};exports[_0x7d81('0x70')]=function(_0x31435f,_0x4967de,_0x3bf44f){return db['UserProfile'][_0x7d81('0x4d')]({'where':{'id':_0x31435f['params']['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x4967de,null))['then'](function(_0x18f099){if(_0x18f099){return _0x18f099['removeResources'](_0x31435f['query']['ids']);}})[_0x7d81('0x2c')](respondWithStatusCode(_0x4967de,null))[_0x7d81('0x48')](handleError(_0x4967de,null));};exports[_0x7d81('0x71')]=function(_0x460526,_0xd400b6){var _0x2b2e14={'raw':![],'where':{}};var _0x46b819={};var _0x248be1={'count':0x0,'rows':[]};var _0x216016=_0x460526[_0x7d81('0x36')][_0x7d81('0x72')];if(typeof _0x216016==='undefined'){throw new db[(_0x7d81('0x73'))][(_0x7d81('0x74'))](_0x7d81('0x75'));}var _0x3aea7c=_0x460526['query'][_0x7d81('0x76')]||![];var _0x29fa1c=getQueryModels(_0x216016,_0x3aea7c);if(typeof _0x29fa1c['childModel']===_0x7d81('0x77')){throw new db[(_0x7d81('0x73'))][(_0x7d81('0x74'))](_0x7d81('0x78')+_0x216016+'\x27');}var _0x5003fd=[];if(!_['isEmpty'](_0x29fa1c['parentSections'])){_0x5003fd=_0x29fa1c['parentSections'];}else{_0x5003fd=[{'name':_0x216016}];}return db[_0x7d81('0x43')][_0x7d81('0x69')]({'where':{'id':_0x460526[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0xd400b6,null))[_0x7d81('0x2c')](function(_0x4e9310){if(_0x4e9310){var _0x5aad6f=[];for(var _0x3f07f0=0x0;_0x3f07f0<_0x5003fd[_0x7d81('0x39')];_0x3f07f0++){_0x5aad6f[_0x7d81('0x62')](db[_0x7d81('0x56')][_0x7d81('0x69')]({'where':{'userProfileId':_0x4e9310['id'],'name':_0x5003fd[_0x3f07f0]['name']},'raw':!![]}));}return BPromise[_0x7d81('0x79')](_0x5aad6f);}})['then'](function(_0x457ff8){var _0x55ba36=_['filter'](_0x457ff8,function(_0x141488){return _0x141488?_0x141488:undefined;});var _0x38d823=_[_0x7d81('0x40')](_0x5003fd,['ignore',!![]]);var _0x188d74=_[_0x7d81('0x67')](_0x55ba36)&&_[_0x7d81('0x67')](_0x38d823)?null:_[_0x7d81('0x7a')](_0x38d823,_0x55ba36);if(_0x188d74){var _0x21b7f0=[];for(var _0x11d0ed=0x0;_0x11d0ed<_0x188d74['length'];_0x11d0ed++){var _0x152abe=_['find'](_0x5003fd,function(_0xc5676e){return _0x188d74[_0x11d0ed]?_0xc5676e[_0x7d81('0x2e')]===_0x188d74[_0x11d0ed][_0x7d81('0x2e')]:null;});if(_0x152abe){if(_0x188d74[_0x11d0ed][_0x7d81('0x7b')]){_0x21b7f0[_0x7d81('0x62')](getAllResources(_0x29fa1c[_0x7d81('0x7c')],_0x188d74[_0x11d0ed]));}else{if(!_0x188d74[_0x11d0ed]['autoAssociation']){_0x21b7f0[_0x7d81('0x62')](getAllowedResources(_0x152abe,_0x188d74[_0x11d0ed],_0x29fa1c[_0x7d81('0x7c')]));}else{if(_0x152abe[_0x7d81('0x35')]){_0x21b7f0[_0x7d81('0x62')](getAllFilteredResources(_0x152abe,_0x188d74[_0x11d0ed]));}}}}}return BPromise[_0x7d81('0x79')](_0x21b7f0);}else{return null;}})['then'](function(_0xa4a68b){var _0x1f8425=_0xa4a68b;var _0x28a92a=null;if(_0x1f8425){_0x28a92a=_0x1f8425[_0x7d81('0x39')]===0x1?_0x1f8425[0x0]:null;}if(_0x28a92a||_0x1f8425){var _0x338e07=db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x4b')];_0x46b819[_0x7d81('0x35')]=_[_0x7d81('0x4a')](_0x338e07);_0x46b819[_0x7d81('0x36')]=_[_0x7d81('0x4a')](_0x460526[_0x7d81('0x36')]);_0x46b819[_0x7d81('0x3e')]=_['intersection'](_0x46b819[_0x7d81('0x35')],_0x46b819[_0x7d81('0x36')]);_0x2b2e14[_0x7d81('0x38')]=_[_0x7d81('0x37')](_0x46b819['model'],qs[_0x7d81('0x4c')](_0x460526[_0x7d81('0x36')][_0x7d81('0x4c')]));_0x2b2e14[_0x7d81('0x38')]=_0x2b2e14[_0x7d81('0x38')][_0x7d81('0x39')]?_0x2b2e14[_0x7d81('0x38')]:_0x46b819['model'];if(!_0x460526[_0x7d81('0x36')]['hasOwnProperty']('nolimit')){_0x2b2e14['limit']=qs[_0x7d81('0x24')](_0x460526[_0x7d81('0x36')][_0x7d81('0x24')]);_0x2b2e14[_0x7d81('0x23')]=qs[_0x7d81('0x23')](_0x460526[_0x7d81('0x36')][_0x7d81('0x23')]);}_0x2b2e14[_0x7d81('0x7d')]=qs[_0x7d81('0x3c')](_0x460526['query'][_0x7d81('0x3c')]);_0x2b2e14[_0x7d81('0x3d')]=qs[_0x7d81('0x3e')](_[_0x7d81('0x3f')](_0x460526[_0x7d81('0x36')],_0x46b819['filters']));if(_0x460526[_0x7d81('0x36')]['filter']){_0x2b2e14['where']=_[_0x7d81('0x41')](_0x2b2e14[_0x7d81('0x3d')],{'$or':_[_0x7d81('0x31')](_0x338e07,function(_0x3d096f){if(_0x3d096f[_0x7d81('0x33')][_0x7d81('0x34')]!==_0x7d81('0x7e')){var _0x5eb199={};_0x5eb199[_0x3d096f[_0x7d81('0x7f')]]={'$like':'%'+_0x460526['query'][_0x7d81('0x40')]+'%'};return _0x5eb199;}})});}var _0xff92db=[];if(_0x28a92a){var _0xf0d441=_[_0x7d81('0x4d')](_0x5003fd,[_0x7d81('0x2e'),_0x28a92a[_0x7d81('0x2e')]]);if(_0xf0d441[_0x7d81('0x7f')]){var _0x47da3b={};if(_0x29fa1c[_0x7d81('0x7c')]===_0x7d81('0x80')){_0x47da3b[_0xf0d441[_0x7d81('0x81')]]=_['map'](_0x28a92a[_0x7d81('0x82')],'id');}else{_0x47da3b[_0xf0d441[_0x7d81('0x81')]]=_0x28a92a[_0x7d81('0x82')];}_0xff92db[_0x7d81('0x62')](_0x47da3b);}else{_0x2b2e14[_0x7d81('0x3d')]['id']=_0x28a92a[_0x7d81('0x82')];}}else{for(var _0x12d01e=0x0;_0x12d01e<_0x1f8425[_0x7d81('0x39')];_0x12d01e++){var _0xf0d441=_[_0x7d81('0x4d')](_0x5003fd,['name',_0x1f8425[_0x12d01e][_0x7d81('0x2e')]]);if(_0xf0d441[_0x7d81('0x7f')]){var _0x47da3b={};_0x47da3b[_0xf0d441[_0x7d81('0x81')]]=_0x1f8425[_0x12d01e][_0x7d81('0x82')];_0xff92db[_0x7d81('0x62')](_0x47da3b);}else{if(!_0x2b2e14[_0x7d81('0x3d')]['id'])_0x2b2e14[_0x7d81('0x3d')]['id']=[];_0x1f8425[_0x12d01e][_0x7d81('0x82')]['forEach'](function(_0x58854c){_0x2b2e14[_0x7d81('0x3d')]['id'][_0x7d81('0x62')](_0x58854c);});}}}if(!_['isEmpty'](_0xff92db)){_0x2b2e14[_0x7d81('0x3d')]=_[_0x7d81('0x41')](_0x2b2e14[_0x7d81('0x3d')],{'$and':{'$or':_0xff92db}});}_0x2b2e14=_['merge']({},_0x2b2e14,_0x460526[_0x7d81('0x42')]);if(_0x28a92a&&!_0x28a92a[_0x7d81('0x58')]&&_0x29fa1c[_0x7d81('0x7c')]==='AnalyticExtractedReport'){if(_0x460526['query'][_0x7d81('0x44')]){_0x2b2e14[_0x7d81('0x45')]=[{'all':!![]}];}return db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x46')](_0x2b2e14)[_0x7d81('0x2c')](function(_0x5b2985){var _0x6b7599=[];_0x5b2985['forEach'](function(_0x22c50e){var _0xc8d71d;switch(_0x22c50e[_0x7d81('0x83')]){case _0x7d81('0x84'):_0xc8d71d=_[_0x7d81('0x4d')](_0x28a92a[_0x7d81('0x82')],function(_0x5c6414){return _0x5c6414['id']===_0x22c50e[_0x7d81('0x85')]&&_0x5c6414[_0x7d81('0x33')]===_0x7d81('0x86');});break;case _0x7d81('0x87'):_0xc8d71d=_[_0x7d81('0x4d')](_0x28a92a[_0x7d81('0x82')],function(_0x154ec8){return _0x154ec8['id']===_0x22c50e['reportId']&&_0x154ec8['type']===_0x7d81('0x88');});break;}if(_0xc8d71d)_0x6b7599[_0x7d81('0x62')](_0x22c50e);});_0x248be1[_0x7d81('0x22')]=_0x6b7599[_0x7d81('0x39')];_0x248be1[_0x7d81('0x47')]=_0x6b7599;return _0x248be1;});}else{return db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x22')]({'where':_0x2b2e14[_0x7d81('0x3d')]})[_0x7d81('0x2c')](function(_0x515d78){_0x248be1[_0x7d81('0x22')]=_0x515d78;if(_0x460526[_0x7d81('0x36')][_0x7d81('0x44')]){if(_0x29fa1c[_0x7d81('0x7c')]==='CmContact'){_0x2b2e14[_0x7d81('0x45')]=[{'model':db[_0x7d81('0x89')],'as':'Tags','attributes':['id','name','color'],'required':_0x460526[_0x7d81('0x36')][_0x7d81('0x8a')]?!![]:![]},{'model':db['Tag'],'as':_0x7d81('0x8b'),'attributes':['id',_0x7d81('0x2e'),_0x7d81('0x8c')],'through':_0x460526[_0x7d81('0x36')]['tag']?{'attributes':[],'where':{'TagId':_0x460526[_0x7d81('0x36')][_0x7d81('0x8a')]||undefined}}:{},'required':_0x460526['query'][_0x7d81('0x8a')]?!![]:![]}];}else{_0x2b2e14[_0x7d81('0x45')]=[{'all':!![]}];}}return db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x46')](_0x2b2e14);})[_0x7d81('0x2c')](function(_0x2ebaec){_0x248be1[_0x7d81('0x47')]=_0x2ebaec;return _0x248be1;});}}else{return _0x248be1;}})[_0x7d81('0x2c')](respondWithFilteredResult(_0xd400b6,_0x2b2e14))['catch'](handleError(_0xd400b6,null));};function getAllResources(_0x23938d,_0x1c233f){return new BPromise(function(_0x505f62,_0x4e09fe){if(_0x1c233f){var _0x86f197=_0x1c233f[_0x7d81('0x40')]?{[_0x1c233f[_0x7d81('0x40')][_0x7d81('0x7f')]]:_0x1c233f['filter'][_0x7d81('0x8d')]}:undefined;return db[_0x23938d]['findAll']({'where':_0x86f197,'raw':!![]})[_0x7d81('0x2c')](function(_0x37ff22){_0x1c233f['associatedResources']=_[_0x7d81('0x31')](_0x37ff22,'id');_0x505f62(_0x1c233f);})['catch'](function(_0x1ec75b){_0x4e09fe(_0x1ec75b);});}else{_0x505f62(null);}});}function getAllFilteredResources(_0x4a14e5,_0x43d37d){return new BPromise(function(_0x5ed266,_0x2ac7bf){var _0x5c50b7=_0x4a14e5[_0x7d81('0x40')]?{[_0x4a14e5[_0x7d81('0x40')][_0x7d81('0x7f')]]:_0x4a14e5[_0x7d81('0x40')][_0x7d81('0x8d')]}:undefined;return db[_0x4a14e5['model']]['findAll']({'where':_0x5c50b7,'raw':!![]})[_0x7d81('0x2c')](function(_0x41afb7){_0x43d37d[_0x7d81('0x82')]=_[_0x7d81('0x31')](_0x41afb7,function(_0x20154f){return _0x20154f[_0x7d81('0x2e')];});_0x5ed266(_0x43d37d);})[_0x7d81('0x48')](function(_0x2ef5af){_0x2ac7bf(_0x2ef5af);});});}function getAllowedResources(_0x2930b6,_0x142c09,_0x52160a){return new BPromise(function(_0x2f1811,_0x4826df){if(_0x142c09){return db[_0x7d81('0x5d')][_0x7d81('0x46')]({'where':{'sectionId':_0x142c09['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x4fa811){if(_0x2930b6[_0x7d81('0x7f')]&&_0x2930b6[_0x7d81('0x7f')]!=='id'){_0x142c09[_0x7d81('0x82')]=_[_0x7d81('0x31')](_0x4fa811,function(_0x5179f9){return _0x5179f9[_0x2930b6[_0x7d81('0x7f')]];});}else{if(_0x52160a==='AnalyticExtractedReport'){_0x142c09[_0x7d81('0x82')]=_[_0x7d81('0x31')](_0x4fa811,function(_0x2c0c68){return{'id':_0x2c0c68[_0x7d81('0x6d')],'type':_0x2c0c68[_0x7d81('0x33')]};});}else{_0x142c09[_0x7d81('0x82')]=_['map'](_0x4fa811,function(_0x4d3249){return _0x4d3249[_0x7d81('0x6d')];});}}_0x2f1811(_0x142c09);})[_0x7d81('0x48')](function(_0x581c7a){_0x4826df(_0x581c7a);});}else{_0x2f1811(null);}});}function getQueryModels(_0x1c9755,_0x47c4ff){var _0x4d3e94=_0x1c9755['toLowerCase']();var _0x196afb={'childModel':undefined,'parentSections':[]};switch(_0x4d3e94){case'squareprojects':_0x196afb['childModel']=_0x7d81('0x8e');break;case'odbc':_0x196afb['childModel']='SquareOdbc';break;case'squarerecordings':_0x196afb['childModel']=_0x7d81('0x8f');_0x196afb['parentSections']=[{'name':'SquareProjects','field':_0x7d81('0x2e'),'foreignKey':'projectName'}];break;case'projects':_0x196afb[_0x7d81('0x7c')]='JscriptyProject';break;case'contacts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x90');_0x196afb['parentSections']=[{'name':_0x7d81('0x91'),'field':'id','foreignKey':_0x7d81('0x92')}];break;case'lists':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x93');break;case'companies':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x94');break;case _0x7d81('0x95'):_0x196afb[_0x7d81('0x7c')]='CmCustomField';break;case _0x7d81('0x96'):_0x196afb['childModel']=_0x7d81('0x97');break;case _0x7d81('0x98'):_0x196afb['childModel']=_0x7d81('0x99');break;case _0x7d81('0x9a'):_0x196afb['childModel']=_0x7d81('0x9b');break;case'faxaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x9c');break;case _0x7d81('0x9d'):case _0x7d81('0x9e'):case'outboundroutes':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x9f');break;case'contexts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xa0');break;case _0x7d81('0xa1'):_0x196afb[_0x7d81('0x7c')]='VoiceMail';break;case'voicerecordings':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xa2');_0x196afb[_0x7d81('0xa3')]=[{'name':_0x7d81('0xa4'),'field':'name','foreignKey':_0x7d81('0xa5'),'model':_0x7d81('0xa6'),'filter':{'field':'role','value':[_0x7d81('0xa7')]}},{'name':_0x7d81('0xa8'),'field':_0x7d81('0x2e'),'foreignKey':_0x7d81('0xa5'),'model':_0x7d81('0xa6'),'filter':{'field':_0x7d81('0xa9'),'value':[_0x7d81('0xaa')]}},{'name':_0x7d81('0xab'),'field':_0x7d81('0x2e'),'foreignKey':_0x7d81('0xac'),'model':_0x7d81('0xad'),'filter':{'field':_0x7d81('0x33'),'value':[_0x7d81('0xae')]}},{'name':_0x7d81('0xaf'),'field':_0x7d81('0x2e'),'foreignKey':_0x7d81('0xac'),'model':_0x7d81('0xad'),'filter':{'field':_0x7d81('0x33'),'value':['outbound']}}];break;case _0x7d81('0xb0'):_0x196afb['childModel']=_0x7d81('0xb1');break;case _0x7d81('0xb2'):_0x196afb['childModel']=_0x7d81('0xb3');break;case'voiceprefixes':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xb4');break;case _0x7d81('0xb5'):_0x196afb[_0x7d81('0x7c')]='Campaign';break;case _0x7d81('0xb6'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xb7');break;case _0x7d81('0xb8'):_0x196afb[_0x7d81('0x7c')]='MailAccount';break;case _0x7d81('0xb9'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xba');break;case _0x7d81('0xbb'):_0x196afb['childModel']='OpenchannelQueue';break;case _0x7d81('0xbc'):_0x196afb[_0x7d81('0x7c')]='OpenchannelAccount';break;case'smsqueues':_0x196afb['childModel']=_0x7d81('0xbd');break;case'smsaccounts':_0x196afb[_0x7d81('0x7c')]='SmsAccount';break;case'whatsappqueues':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xbe');break;case _0x7d81('0xbf'):_0x196afb[_0x7d81('0x7c')]='WhatsappAccount';break;case'teams':_0x196afb[_0x7d81('0x7c')]='Team';break;case _0x7d81('0xc0'):case'queuecampaigns':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xad');if(_0x47c4ff){_0x196afb[_0x7d81('0xa3')]=[{'name':'VoiceQueues'},{'name':_0x7d81('0xaf')}];}break;case _0x7d81('0xc1'):case _0x7d81('0xc2'):case _0x7d81('0xc3'):_0x196afb['childModel']='User';if(_0x47c4ff){_0x196afb[_0x7d81('0xa3')]=[{'name':_0x7d81('0xc4'),'filter':{'field':_0x7d81('0xa9'),'value':[_0x7d81('0xc5'),_0x7d81('0xc6')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xc7');break;case'salesforceaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xc8');break;case'freshdeskaccounts':_0x196afb['childModel']=_0x7d81('0xc9');break;case'sugarcrmaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xca');break;case _0x7d81('0xcb'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xcc');break;case _0x7d81('0xcd'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xce');break;case _0x7d81('0xcf'):_0x196afb['childModel']='User';break;case _0x7d81('0xd0'):_0x196afb['childModel']=_0x7d81('0xd1');break;case'dispositions':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xd2');break;case _0x7d81('0xd3'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x6a');break;case _0x7d81('0xd4'):_0x196afb[_0x7d81('0x7c')]='Interval';break;case _0x7d81('0xd5'):_0x196afb[_0x7d81('0x7c')]='Pause';break;case'scheduler':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xd6');break;case'sounds':_0x196afb['childModel']=_0x7d81('0xd7');break;case _0x7d81('0xd8'):_0x196afb[_0x7d81('0x7c')]='Tag';break;case'templates':_0x196afb['childModel']=_0x7d81('0xd9');break;case _0x7d81('0xda'):_0x196afb['childModel']='Trigger';break;case _0x7d81('0xdb'):_0x196afb['childModel']=_0x7d81('0xdc');break;case _0x7d81('0xdd'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xde');break;case _0x7d81('0xdf'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x6c');break;case _0x7d81('0xe0'):_0x196afb['childModel']=_0x7d81('0x80');_0x196afb[_0x7d81('0xa3')]=[{'name':_0x7d81('0xe1'),'field':'id','foreignKey':_0x7d81('0x85')}];break;case _0x7d81('0xe2'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xe3');break;case _0x7d81('0xbf'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xe4');break;default:return _0x196afb;}return _0x196afb;}
\ No newline at end of file
+var _0x0f82=['./userProfile.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','error','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','params','intersection','includeAll','create','clone','find','get','updatedAt','crudPermissions','body','omit','createdAt','UserProfileSection','findAll','each','autoAssociation','sectionId','userProfileId','UserProfileResource','describe','addSections','sequelize','transaction','Resources','push','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','parentSections','findOne','all','ignore','union','nolimit','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','DefaultReports','custom','CustomReports','count','CmContact','Tag','Tags','tag','ThroughTags','color','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueue','inbound','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Interval','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','trunks','variables','Variable','Reports','metrics','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x279f0f,_0x569056){var _0x1f494d=function(_0x4f2194){while(--_0x4f2194){_0x279f0f['push'](_0x279f0f['shift']());}};_0x1f494d(++_0x569056);}(_0x0f82,0x1c6));var _0x20f8=function(_0x8e8f89,_0x4254f3){_0x8e8f89=_0x8e8f89-0x0;var _0x151938=_0x0f82[_0x8e8f89];return _0x151938;};'use strict';var pdf=require(_0x20f8('0x0'));var emlformat=require(_0x20f8('0x1'));var rimraf=require(_0x20f8('0x2'));var zipdir=require(_0x20f8('0x3'));var jsonpatch=require(_0x20f8('0x4'));var rp=require(_0x20f8('0x5'));var moment=require('moment');var BPromise=require(_0x20f8('0x6'));var Mustache=require(_0x20f8('0x7'));var util=require(_0x20f8('0x8'));var path=require(_0x20f8('0x9'));var sox=require(_0x20f8('0xa'));var csv=require(_0x20f8('0xb'));var ejs=require(_0x20f8('0xc'));var fs=require('fs');var _=require(_0x20f8('0xd'));var squel=require(_0x20f8('0xe'));var crypto=require(_0x20f8('0xf'));var jsforce=require(_0x20f8('0x10'));var deskjs=require(_0x20f8('0x11'));var toCsv=require(_0x20f8('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20f8('0x12'));var authService=require(_0x20f8('0x13'));var qs=require(_0x20f8('0x14'));var as=require(_0x20f8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20f8('0x16'))(_0x20f8('0x17'));var utils=require(_0x20f8('0x18'));var config=require(_0x20f8('0x19'));var licenseUtil=require(_0x20f8('0x1a'));var db=require(_0x20f8('0x1b'))['db'];config[_0x20f8('0x1c')]=_[_0x20f8('0x1d')](config[_0x20f8('0x1c')],{'host':_0x20f8('0x1e'),'port':0x18eb});var socket=require(_0x20f8('0x1f'))(new Redis(config['redis']));require(_0x20f8('0x20'))[_0x20f8('0x21')](socket);function respondWithStatusCode(_0x4cf20a,_0x2a4589){_0x2a4589=_0x2a4589||0xcc;return function(_0x175b44){if(_0x175b44){return _0x4cf20a[_0x20f8('0x22')](_0x2a4589);}return _0x4cf20a[_0x20f8('0x23')](_0x2a4589)[_0x20f8('0x24')]();};}function respondWithResult(_0x10aecb,_0xa8ea40){_0xa8ea40=_0xa8ea40||0xc8;return function(_0x22a927){if(_0x22a927){return _0x10aecb['status'](_0xa8ea40)[_0x20f8('0x25')](_0x22a927);}};}function respondWithFilteredResult(_0x7e1573,_0xf6fa49){return function(_0x150660){if(_0x150660){var _0x2697a7=_0x150660['count'],_0x468bb1=_0xf6fa49[_0x20f8('0x26')],_0x47f9de=_0xf6fa49[_0x20f8('0x26')]+_0xf6fa49[_0x20f8('0x27')],_0x5b02ea;if(_0x47f9de>=_0x2697a7){_0x47f9de=_0x2697a7;_0x5b02ea=0xc8;}else{_0x5b02ea=0xce;}_0x7e1573[_0x20f8('0x23')](_0x5b02ea);return _0x7e1573[_0x20f8('0x28')](_0x20f8('0x29'),_0x468bb1+'-'+_0x47f9de+'/'+_0x2697a7)[_0x20f8('0x25')](_0x150660);}return null;};}function patchUpdates(_0x5e91ee){return function(_0x2c7068){try{jsonpatch['apply'](_0x2c7068,_0x5e91ee,!![]);}catch(_0x5b56ff){return BPromise[_0x20f8('0x2a')](_0x5b56ff);}return _0x2c7068['save']();};}function saveUpdates(_0xb634b0,_0x1646cf){return function(_0x4c4728){if(_0x4c4728){return _0x4c4728[_0x20f8('0x2b')](_0xb634b0)[_0x20f8('0x2c')](function(_0x957c7e){return _0x957c7e;});}return null;};}function removeEntity(_0x377b6a,_0xbaa18b){return function(_0x144596){if(_0x144596){return _0x144596[_0x20f8('0x2d')]()['then'](function(){_0x377b6a[_0x20f8('0x23')](0xcc)[_0x20f8('0x24')]();});}};}function handleEntityNotFound(_0x24a509,_0x121a6a){return function(_0x5ad7d2){if(!_0x5ad7d2){_0x24a509['sendStatus'](0x194);}return _0x5ad7d2;};}function handleError(_0x39e328,_0x1a9b91){_0x1a9b91=_0x1a9b91||0x1f4;return function(_0x1a75da){logger[_0x20f8('0x2e')](_0x1a75da['stack']);if(_0x1a75da[_0x20f8('0x2f')]){delete _0x1a75da[_0x20f8('0x2f')];}_0x39e328['status'](_0x1a9b91)[_0x20f8('0x30')](_0x1a75da);};}exports['index']=function(_0x27866b,_0x416daa){var _0x54332d={},_0x285dc9={},_0x4a3c60={'count':0x0,'rows':[]};var _0x141130=_[_0x20f8('0x31')](db[_0x20f8('0x32')][_0x20f8('0x33')],function(_0x1d9595){return{'name':_0x1d9595[_0x20f8('0x34')],'type':_0x1d9595[_0x20f8('0x35')][_0x20f8('0x36')]};});_0x285dc9[_0x20f8('0x37')]=_['map'](_0x141130,_0x20f8('0x2f'));_0x285dc9[_0x20f8('0x38')]=_[_0x20f8('0x39')](_0x27866b['query']);_0x285dc9['filters']=_['intersection'](_0x285dc9[_0x20f8('0x37')],_0x285dc9[_0x20f8('0x38')]);_0x54332d[_0x20f8('0x3a')]=_['intersection'](_0x285dc9['model'],qs[_0x20f8('0x3b')](_0x27866b[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x54332d['attributes']=_0x54332d[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x54332d['attributes']:_0x285dc9[_0x20f8('0x37')];if(!_0x27866b['query']['hasOwnProperty']('nolimit')){_0x54332d['limit']=qs[_0x20f8('0x27')](_0x27866b[_0x20f8('0x38')][_0x20f8('0x27')]);_0x54332d[_0x20f8('0x26')]=qs[_0x20f8('0x26')](_0x27866b[_0x20f8('0x38')][_0x20f8('0x26')]);}_0x54332d[_0x20f8('0x3d')]=qs[_0x20f8('0x3e')](_0x27866b[_0x20f8('0x38')]['sort']);_0x54332d[_0x20f8('0x3f')]=qs[_0x20f8('0x40')](_['pick'](_0x27866b['query'],_0x285dc9[_0x20f8('0x40')]),_0x141130);if(_0x27866b[_0x20f8('0x38')][_0x20f8('0x41')]){_0x54332d[_0x20f8('0x3f')]=_[_0x20f8('0x42')](_0x54332d[_0x20f8('0x3f')],{'$or':_[_0x20f8('0x31')](_0x141130,function(_0x5299aa){if(_0x5299aa[_0x20f8('0x35')]!==_0x20f8('0x43')){var _0x320cd5={};_0x320cd5[_0x5299aa['name']]={'$like':'%'+_0x27866b[_0x20f8('0x38')][_0x20f8('0x41')]+'%'};return _0x320cd5;}})});}_0x54332d=_[_0x20f8('0x42')]({},_0x54332d,_0x27866b[_0x20f8('0x44')]);var _0xcb86be={'where':_0x54332d[_0x20f8('0x3f')]};return db[_0x20f8('0x32')]['count'](_0xcb86be)['then'](function(_0x4601a6){_0x4a3c60['count']=_0x4601a6;if(_0x27866b[_0x20f8('0x38')]['includeAll']){_0x54332d[_0x20f8('0x45')]=[{'all':!![]}];}return db[_0x20f8('0x32')]['findAll'](_0x54332d);})[_0x20f8('0x2c')](function(_0x3a3a51){_0x4a3c60[_0x20f8('0x46')]=_0x3a3a51;return _0x4a3c60;})[_0x20f8('0x2c')](respondWithFilteredResult(_0x416daa,_0x54332d))[_0x20f8('0x47')](handleError(_0x416daa,null));};exports['show']=function(_0x395f6b,_0x2a87e1){var _0x416413={'raw':![],'where':{'id':_0x395f6b[_0x20f8('0x48')]['id']}},_0xdba9c9={};_0xdba9c9[_0x20f8('0x37')]=_[_0x20f8('0x39')](db['UserProfile'][_0x20f8('0x33')]);_0xdba9c9['query']=_[_0x20f8('0x39')](_0x395f6b[_0x20f8('0x38')]);_0xdba9c9['filters']=_['intersection'](_0xdba9c9[_0x20f8('0x37')],_0xdba9c9[_0x20f8('0x38')]);_0x416413[_0x20f8('0x3a')]=_[_0x20f8('0x49')](_0xdba9c9[_0x20f8('0x37')],qs['fields'](_0x395f6b[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x416413[_0x20f8('0x3a')]=_0x416413[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x416413[_0x20f8('0x3a')]:_0xdba9c9[_0x20f8('0x37')];if(_0x395f6b['query'][_0x20f8('0x4a')]){_0x416413[_0x20f8('0x45')]=[{'all':!![]}];}_0x416413=_['merge']({},_0x416413,_0x395f6b[_0x20f8('0x44')]);return db['UserProfile']['find'](_0x416413)[_0x20f8('0x2c')](handleEntityNotFound(_0x2a87e1,null))[_0x20f8('0x2c')](respondWithResult(_0x2a87e1,null))[_0x20f8('0x47')](handleError(_0x2a87e1,null));};exports[_0x20f8('0x4b')]=function(_0x1f6b4a,_0x5ecfa2){return db['UserProfile'][_0x20f8('0x4b')](_0x1f6b4a['body'],{})[_0x20f8('0x2c')](respondWithResult(_0x5ecfa2,0xc9))[_0x20f8('0x47')](handleError(_0x5ecfa2,null));};exports[_0x20f8('0x4c')]=function(_0x5ad1fa,_0x47e1f8){var _0x4fe634={'where':{'id':_0x5ad1fa[_0x20f8('0x48')]['id']}},_0x374b22={};_0x374b22['model']=_['keys'](db[_0x20f8('0x32')][_0x20f8('0x33')]);_0x4fe634[_0x20f8('0x3a')]=_[_0x20f8('0x49')](_0x374b22[_0x20f8('0x37')],qs[_0x20f8('0x3b')](_0x5ad1fa[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x4fe634['attributes']=_0x4fe634[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x4fe634[_0x20f8('0x3a')]:_0x374b22[_0x20f8('0x37')];if(_0x5ad1fa[_0x20f8('0x38')][_0x20f8('0x4a')]){_0x4fe634[_0x20f8('0x45')]=[{'all':!![]}];}_0x4fe634=_[_0x20f8('0x42')]({},_0x4fe634,_0x5ad1fa[_0x20f8('0x44')]);return db[_0x20f8('0x32')][_0x20f8('0x4d')](_0x4fe634)[_0x20f8('0x2c')](handleEntityNotFound(_0x47e1f8,null))[_0x20f8('0x2c')](function(_0x553a99){if(_0x553a99){var _0x41320a=_0x553a99[_0x20f8('0x4e')]({'plain':!![]});_0x41320a=qs['omit'](_0x41320a,['id','createdAt',_0x20f8('0x4f'),_0x20f8('0x50')]);_0x5ad1fa[_0x20f8('0x51')]=_[_0x20f8('0x52')](_0x5ad1fa[_0x20f8('0x51')],['id',_0x20f8('0x53'),_0x20f8('0x4f')]);return db['sequelize']['transaction'](function(_0x2884af){return db[_0x20f8('0x32')]['create'](_[_0x20f8('0x42')](_0x41320a,_0x5ad1fa[_0x20f8('0x51')]),{'include':_0x5ad1fa['query'][_0x20f8('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x2884af})[_0x20f8('0x2c')](function(_0x269216){var _0x2d4f06=_0x269216[_0x20f8('0x4e')]({'plain':!![]});return db[_0x20f8('0x54')][_0x20f8('0x55')]({'where':{'userProfileId':_0x5ad1fa[_0x20f8('0x48')]['id']},'raw':!![]})['then'](function(_0x32b103){if(_0x32b103){return BPromise[_0x20f8('0x56')](_0x32b103,function(_0xd9369c){return new BPromise(function(_0x233c7d,_0x77ecf1){if(_0xd9369c[_0x20f8('0x57')]===null||_0xd9369c[_0x20f8('0x57')]===0x1)_0x233c7d(null);return db['UserProfileResource'][_0x20f8('0x55')]({'where':{'sectionId':_0xd9369c['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x123c89){var _0x37892f=_[_0x20f8('0x31')](_0x123c89,function(_0xf129f4){return qs[_0x20f8('0x52')](_0xf129f4,['id','createdAt','updatedAt',_0x20f8('0x58')]);});_0x233c7d(_0x37892f);})['catch'](function(_0x3f8df1){_0x77ecf1(_0x3f8df1);});})['then'](function(_0x1e5450){var _0x42138c=qs[_0x20f8('0x52')](_0xd9369c,['id','createdAt',_0x20f8('0x4f')]);_0x42138c[_0x20f8('0x59')]=_0x2d4f06['id'];if(_0x1e5450)_0x42138c['Resources']=_0x1e5450;return _0x42138c;})[_0x20f8('0x2c')](function(_0x1e4b23){return db[_0x20f8('0x54')][_0x20f8('0x4b')](_0x1e4b23,{'include':[{'model':db[_0x20f8('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x2884af});});})[_0x20f8('0x2c')](function(){return _0x2d4f06;});}});});});}})[_0x20f8('0x2c')](respondWithResult(_0x47e1f8,0xc9))[_0x20f8('0x47')](handleError(_0x47e1f8,null));};exports[_0x20f8('0x2b')]=function(_0x3e5c6f,_0x13b009){if(_0x3e5c6f[_0x20f8('0x51')]['id']){delete _0x3e5c6f['body']['id'];}return db['UserProfile'][_0x20f8('0x4d')]({'where':{'id':_0x3e5c6f[_0x20f8('0x48')]['id']}})[_0x20f8('0x2c')](handleEntityNotFound(_0x13b009,null))['then'](saveUpdates(_0x3e5c6f[_0x20f8('0x51')],null))['then'](respondWithResult(_0x13b009,null))['catch'](handleError(_0x13b009,null));};exports['destroy']=function(_0x517f91,_0x303405){return db[_0x20f8('0x32')]['find']({'where':{'id':_0x517f91[_0x20f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x303405,null))[_0x20f8('0x2c')](removeEntity(_0x303405,null))[_0x20f8('0x47')](handleError(_0x303405,null));};exports[_0x20f8('0x5b')]=function(_0xc6c3ec,_0x838003){return db[_0x20f8('0x32')][_0x20f8('0x5b')]()['then'](respondWithResult(_0x838003,null))[_0x20f8('0x47')](handleError(_0x838003,null));};exports[_0x20f8('0x5c')]=function(_0x54bf43,_0xcb8b2d){var _0x10ef1b=_0x54bf43[_0x20f8('0x51')];return db['UserProfile'][_0x20f8('0x4d')]({'where':{'id':_0x54bf43[_0x20f8('0x48')]['id']}})['then'](handleEntityNotFound(_0xcb8b2d,null))[_0x20f8('0x2c')](function(_0x5fa4c3){if(_0x5fa4c3){return db[_0x20f8('0x5d')][_0x20f8('0x5e')](function(_0x345ac3){return db[_0x20f8('0x54')]['destroy']({'where':{'userProfileId':_0x54bf43['params']['id'],'sectionId':_['map'](_0x10ef1b,function(_0x57645d){return _0x57645d[_0x20f8('0x58')];})},'transaction':_0x345ac3})[_0x20f8('0x2c')](function(){var _0x93b1a1=_['map'](_0x10ef1b,function(_0x4b2882){_0x4b2882[_0x20f8('0x59')]=_0x54bf43[_0x20f8('0x48')]['id'];return _0x4b2882;});var _0x575732=[];return BPromise[_0x20f8('0x56')](_0x93b1a1,function(_0x2ad6e2){return db[_0x20f8('0x54')][_0x20f8('0x4b')](_0x2ad6e2,{'include':[{'model':db[_0x20f8('0x5a')],'as':_0x20f8('0x5f')}],'raw':!![],'transaction':_0x345ac3})[_0x20f8('0x2c')](function(_0xfd84e5){_0x575732[_0x20f8('0x60')](_0xfd84e5[_0x20f8('0x4e')]({'plain':!![]}));});})[_0x20f8('0x2c')](function(){return _0x575732;});});});}})[_0x20f8('0x2c')](function(_0x4539a4){return _0x4539a4;})[_0x20f8('0x2c')](respondWithResult(_0xcb8b2d,null))['catch'](handleError(_0xcb8b2d,null));};exports['removeSections']=function(_0x5dc48d,_0x46b4e4){var _0x1655f4;return db['UserProfile']['find']({'where':{'id':_0x5dc48d[_0x20f8('0x48')]['id']},'attributes':['id',_0x20f8('0x2f')]})['then'](handleEntityNotFound(_0x46b4e4,null))['then'](function(_0x1ed133){if(_0x1ed133){_0x1655f4=_0x1ed133;return db[_0x20f8('0x54')]['destroy']({'where':{'userProfileId':_0x5dc48d['params']['id'],'sectionId':_0x5dc48d[_0x20f8('0x38')][_0x20f8('0x61')]}});}})['then'](function(){return _0x1655f4;})[_0x20f8('0x2c')](respondWithStatusCode(_0x46b4e4,null))[_0x20f8('0x47')](handleError(_0x46b4e4,null));};exports[_0x20f8('0x62')]=function(_0x1834e6,_0x2e9dee){var _0x4e3b5e=[];var _0x111e8f=[];return db['UserProfileSection'][_0x20f8('0x55')]({'where':{'userProfileId':_0x1834e6['params']['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x2c71be){_0x4e3b5e=_['filter'](_0x2c71be,function(_0x1939dd){return _0x1939dd[_0x20f8('0x63')]===0x1||_[_0x20f8('0x64')]([0x3eb,0x709],_0x1939dd['sectionId']);});if(!_[_0x20f8('0x65')](_0x4e3b5e)){return _[_0x20f8('0x31')](_0x4e3b5e,function(_0x59a984){return _0x59a984[_0x20f8('0x58')];});}else{return;}})[_0x20f8('0x2c')](function(_0x13445e){if(_0x13445e)_0x111e8f=_0x13445e;if(_[_0x20f8('0x64')](_0x111e8f,0x64)){var _0x261245=_[_0x20f8('0x4d')](_0x4e3b5e,{'sectionId':0x64});return hasDefaultDashboard(_0x261245)[_0x20f8('0x2c')](function(_0xf41bcc){return _[_0x20f8('0x31')](_0x4e3b5e,function(_0x397717){if(_0x397717['sectionId']===0x64){_0x397717[_0x20f8('0x66')]=_0xf41bcc;}return _0x397717;});});}else{return;}})[_0x20f8('0x2c')](function(_0x570b66){if(_0x570b66)_0x4e3b5e=_0x570b66;if(_['includes'](_0x111e8f,0x3eb)){var _0x17762b=_[_0x20f8('0x4d')](_0x4e3b5e,{'sectionId':0x3eb});return getCustomDashboards(_0x17762b)['then'](function(_0x35f54b){return _[_0x20f8('0x31')](_0x4e3b5e,function(_0xb6b18){if(_0x17762b[_0x20f8('0x63')]){if(_0xb6b18[_0x20f8('0x58')]===0x3eb){_0xb6b18[_0x20f8('0x66')]=_0x35f54b;}}else{if(_0xb6b18[_0x20f8('0x58')]===0x64){_0xb6b18[_0x20f8('0x66')]=_0x35f54b;}}return _0xb6b18;});});}else{return;}})[_0x20f8('0x2c')](function(_0x531799){if(_0x531799)_0x4e3b5e=_0x531799;if(_['includes'](_0x111e8f,0x709)){var _0x2bef09=_[_0x20f8('0x4d')](_0x4e3b5e,{'sectionId':0x709});return getPlugins(_0x2bef09)[_0x20f8('0x2c')](function(_0x4e1e48){if(_0x2bef09[_0x20f8('0x63')]){return _['map'](_0x4e3b5e,function(_0x35283c){if(_0x35283c[_0x20f8('0x58')]===0x709){_0x35283c['subsections']=_0x4e1e48;}return _0x35283c;});}else{var _0x331de9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4e1e48};var _0x324d36=_['map'](_0x4e3b5e);_0x324d36[_0x20f8('0x60')](_0x331de9);return _0x324d36;}});}else{return;}})[_0x20f8('0x2c')](function(_0x86bdd1){if(_0x86bdd1)_0x4e3b5e=_0x86bdd1;return _['filter'](_0x4e3b5e,[_0x20f8('0x63'),0x1]);})[_0x20f8('0x2c')](respondWithResult(_0x2e9dee,null))[_0x20f8('0x47')](handleError(_0x2e9dee,null));};function hasDefaultDashboard(_0x4fb4c1){var _0x29e72e=[0x65];return new BPromise(function(_0x24671d,_0x2fc717){try{if(_0x4fb4c1[_0x20f8('0x57')]){_0x24671d(_0x29e72e);}else{return db[_0x20f8('0x5a')]['findOne']({'where':{'sectionId':_0x4fb4c1['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x3775e4){_0x3775e4?_0x24671d(_0x29e72e):_0x24671d();});}}catch(_0x5886c6){_0x2fc717(_0x5886c6);}});}function getCustomDashboards(_0x282002){var _0x5b76a4=[];return new BPromise(function(_0x2ff3c5,_0x34aa3c){try{if(_0x282002[_0x20f8('0x57')]){return db[_0x20f8('0x67')][_0x20f8('0x55')]({'raw':!![]})[_0x20f8('0x2c')](function(_0x32e7f5){_0x32e7f5[_0x20f8('0x68')](function(_0x58eaa3){_0x5b76a4[_0x20f8('0x60')](_0x58eaa3['id']+0x1869f);});_0x2ff3c5(_0x5b76a4);});}else{return db[_0x20f8('0x5a')]['findAll']({'where':{'sectionId':_0x282002['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x3e6780){_0x3e6780[_0x20f8('0x68')](function(_0x4617a6){_0x5b76a4[_0x20f8('0x60')](_0x4617a6[_0x20f8('0x69')]+0x1869f);});_0x2ff3c5(_0x5b76a4);});}}catch(_0x3476c2){_0x34aa3c(_0x3476c2);}});}function getPlugins(_0x4e0c00){var _0x4e6070=[];return new BPromise(function(_0xa4aed,_0x3333f9){try{if(_0x4e0c00['autoAssociation']){return db[_0x20f8('0x6a')][_0x20f8('0x55')]({'raw':!![]})[_0x20f8('0x2c')](function(_0x5b861b){_0x5b861b['forEach'](function(_0x3e772f){_0x4e6070['push'](_0x3e772f['id']+0x15b38);});_0xa4aed(_0x4e6070);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4e0c00['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x37eb19){_0x37eb19[_0x20f8('0x68')](function(_0x20c059){_0x4e6070[_0x20f8('0x60')](_0x20c059[_0x20f8('0x69')]+0x15b38);});_0xa4aed(_0x4e6070);});}}catch(_0x5707f1){_0x3333f9(_0x5707f1);}});}exports[_0x20f8('0x6b')]=function(_0x59504b,_0x104784){return db[_0x20f8('0x32')][_0x20f8('0x4d')]({'where':{'id':_0x59504b[_0x20f8('0x48')]['id']}})[_0x20f8('0x2c')](handleEntityNotFound(_0x104784,null))['then'](function(_0x18bab8){if(_0x18bab8){return db[_0x20f8('0x5d')]['transaction'](function(_0x4272da){return db[_0x20f8('0x54')][_0x20f8('0x55')]({'where':{'userProfileId':_0x59504b[_0x20f8('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xa41a2c){if(_0xa41a2c){return db[_0x20f8('0x54')][_0x20f8('0x2d')]({'where':{'userProfileId':_0x59504b['params']['id'],'id':_[_0x20f8('0x31')](_0xa41a2c,function(_0x35d77b){return _0x35d77b['id'];})},'transaction':_0x4272da});}})[_0x20f8('0x2c')](function(_0x30d449){var _0x1fb304=_['map'](_0x59504b['body'],function(_0x213b56){_0x213b56[_0x20f8('0x59')]=_0x59504b[_0x20f8('0x48')]['id'];return _0x213b56;});return db[_0x20f8('0x54')][_0x20f8('0x6c')](_0x1fb304,{'raw':!![],'transaction':_0x4272da});})[_0x20f8('0x2c')](function(_0x570e21){var _0x33ee39=_[_0x20f8('0x41')](_[_0x20f8('0x31')](_0x570e21,function(_0x1736f7){return _0x1736f7[_0x20f8('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x33ee39){return db[_0x20f8('0x54')][_0x20f8('0x55')]({'where':{'userProfileId':_0x59504b['params']['id'],'sectionId':_['map'](_0x33ee39,function(_0x28d7cc){return _0x28d7cc[_0x20f8('0x58')];})},'attributes':['id',_0x20f8('0x58')],'raw':!![]})[_0x20f8('0x2c')](function(_0x1ef314){var _0x180804=_[_0x20f8('0x31')](_0x59504b[_0x20f8('0x51')],function(_0x5eb879){_0x5eb879[_0x20f8('0x59')]=_0x59504b['params']['id'];return _0x5eb879;});return db[_0x20f8('0x5a')][_0x20f8('0x6c')](_0x180804,{'raw':!![],'transaction':_0x4272da});});}})[_0x20f8('0x47')](handleError(_0x104784,null));});}})[_0x20f8('0x2c')](function(_0x5747b4){var _0x596405=_[_0x20f8('0x31')](_0x5747b4,function(_0x4cc183){return _0x4cc183['get']({'plain':!![]});});})[_0x20f8('0x2c')](respondWithResult(_0x104784,null))['catch'](handleError(_0x104784,null));};exports[_0x20f8('0x6d')]=function(_0x1b8180,_0x4a4d6b,_0x26de89){return db[_0x20f8('0x32')][_0x20f8('0x4d')]({'where':{'id':_0x1b8180[_0x20f8('0x48')]['id']}})[_0x20f8('0x2c')](handleEntityNotFound(_0x4a4d6b,null))[_0x20f8('0x2c')](function(_0x52c9d0){if(_0x52c9d0){return _0x52c9d0[_0x20f8('0x6d')](_0x1b8180[_0x20f8('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x4a4d6b,null))[_0x20f8('0x47')](handleError(_0x4a4d6b,null));};exports['getResources']=function(_0x3cb6d3,_0x2bb08c){var _0x170342={'raw':![],'where':{}};var _0x4c0595={};var _0x112fa4={'count':0x0,'rows':[]};var _0x51e121=_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x6e')];if(typeof _0x51e121==='undefined'){throw new db[(_0x20f8('0x6f'))][(_0x20f8('0x70'))](_0x20f8('0x71'));}var _0x46d911=_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x72')]||![];var _0x32a11f=getQueryModels(_0x51e121,_0x46d911);if(typeof _0x32a11f[_0x20f8('0x73')]===_0x20f8('0x74')){throw new db[(_0x20f8('0x6f'))][(_0x20f8('0x70'))]('Invalid\x20section\x20\x27'+_0x51e121+'\x27');}var _0x2c6b32=[];if(!_[_0x20f8('0x65')](_0x32a11f[_0x20f8('0x75')])){_0x2c6b32=_0x32a11f[_0x20f8('0x75')];}else{_0x2c6b32=[{'name':_0x51e121}];}return db['UserProfile'][_0x20f8('0x76')]({'where':{'id':_0x3cb6d3['params']['id']}})['then'](handleEntityNotFound(_0x2bb08c,null))['then'](function(_0x4a399f){if(_0x4a399f){var _0x577edc=[];for(var _0x1093bb=0x0;_0x1093bb<_0x2c6b32[_0x20f8('0x3c')];_0x1093bb++){_0x577edc[_0x20f8('0x60')](db[_0x20f8('0x54')][_0x20f8('0x76')]({'where':{'userProfileId':_0x4a399f['id'],'name':_0x2c6b32[_0x1093bb][_0x20f8('0x2f')]},'raw':!![]}));}return BPromise[_0x20f8('0x77')](_0x577edc);}})[_0x20f8('0x2c')](function(_0x17f0bd){var _0x3c10be=_[_0x20f8('0x41')](_0x17f0bd,function(_0x2a53b6){return _0x2a53b6?_0x2a53b6:undefined;});var _0x40b3d7=_[_0x20f8('0x41')](_0x2c6b32,[_0x20f8('0x78'),!![]]);var _0x59457f=_[_0x20f8('0x65')](_0x3c10be)&&_['isEmpty'](_0x40b3d7)?null:_[_0x20f8('0x79')](_0x40b3d7,_0x3c10be);if(_0x59457f){var _0x19d525=[];for(var _0x1559ba=0x0;_0x1559ba<_0x59457f[_0x20f8('0x3c')];_0x1559ba++){var _0x4b6d32=_[_0x20f8('0x4d')](_0x2c6b32,function(_0x22d2aa){return _0x59457f[_0x1559ba]?_0x22d2aa[_0x20f8('0x2f')]===_0x59457f[_0x1559ba][_0x20f8('0x2f')]:null;});if(_0x4b6d32){if(_0x59457f[_0x1559ba][_0x20f8('0x78')]){_0x19d525[_0x20f8('0x60')](getAllResources(_0x32a11f[_0x20f8('0x73')],_0x59457f[_0x1559ba]));}else{if(!_0x59457f[_0x1559ba][_0x20f8('0x57')]){_0x19d525[_0x20f8('0x60')](getAllowedResources(_0x4b6d32,_0x59457f[_0x1559ba],_0x32a11f['childModel']));}else{if(_0x4b6d32['model']){_0x19d525[_0x20f8('0x60')](getAllFilteredResources(_0x4b6d32,_0x59457f[_0x1559ba]));}}}}}return BPromise[_0x20f8('0x77')](_0x19d525);}else{return null;}})['then'](function(_0x43514b){var _0x145d7a=_0x43514b;var _0x5da3e7=null;if(_0x145d7a){_0x5da3e7=_0x145d7a[_0x20f8('0x3c')]===0x1?_0x145d7a[0x0]:null;}if(_0x5da3e7||_0x145d7a){var _0x187608=db[_0x32a11f[_0x20f8('0x73')]]['rawAttributes'];_0x4c0595[_0x20f8('0x37')]=_[_0x20f8('0x39')](_0x187608);_0x4c0595[_0x20f8('0x38')]=_[_0x20f8('0x39')](_0x3cb6d3['query']);_0x4c0595[_0x20f8('0x40')]=_['intersection'](_0x4c0595['model'],_0x4c0595[_0x20f8('0x38')]);_0x170342['attributes']=_['intersection'](_0x4c0595[_0x20f8('0x37')],qs[_0x20f8('0x3b')](_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x170342[_0x20f8('0x3a')]=_0x170342[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x170342[_0x20f8('0x3a')]:_0x4c0595[_0x20f8('0x37')];if(!_0x3cb6d3[_0x20f8('0x38')]['hasOwnProperty'](_0x20f8('0x7a'))){_0x170342['limit']=qs[_0x20f8('0x27')](_0x3cb6d3[_0x20f8('0x38')]['limit']);_0x170342[_0x20f8('0x26')]=qs[_0x20f8('0x26')](_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x26')]);}_0x170342[_0x20f8('0x3d')]=qs[_0x20f8('0x3e')](_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x3e')]);_0x170342[_0x20f8('0x3f')]=qs[_0x20f8('0x40')](_[_0x20f8('0x7b')](_0x3cb6d3[_0x20f8('0x38')],_0x4c0595['filters']));if(_0x3cb6d3['query'][_0x20f8('0x41')]){_0x170342[_0x20f8('0x3f')]=_['merge'](_0x170342[_0x20f8('0x3f')],{'$or':_['map'](_0x187608,function(_0x41fe28){if(_0x41fe28[_0x20f8('0x35')][_0x20f8('0x36')]!==_0x20f8('0x43')){var _0x3a64c8={};_0x3a64c8[_0x41fe28['field']]={'$like':'%'+_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x41')]+'%'};return _0x3a64c8;}})});}var _0x1d742d=[];if(_0x5da3e7){var _0x5dc2b0=_[_0x20f8('0x4d')](_0x2c6b32,[_0x20f8('0x2f'),_0x5da3e7[_0x20f8('0x2f')]]);if(_0x5dc2b0[_0x20f8('0x7c')]){var _0x5bc105={};if(_0x32a11f[_0x20f8('0x73')]===_0x20f8('0x7d')){_0x5bc105[_0x5dc2b0[_0x20f8('0x7e')]]=_[_0x20f8('0x31')](_0x5da3e7['associatedResources'],'id');}else{_0x5bc105[_0x5dc2b0[_0x20f8('0x7e')]]=_0x5da3e7[_0x20f8('0x7f')];}_0x1d742d['push'](_0x5bc105);}else{_0x170342['where']['id']=_0x5da3e7[_0x20f8('0x7f')];}}else{for(var _0x299dd3=0x0;_0x299dd3<_0x145d7a[_0x20f8('0x3c')];_0x299dd3++){var _0x5dc2b0=_[_0x20f8('0x4d')](_0x2c6b32,[_0x20f8('0x2f'),_0x145d7a[_0x299dd3][_0x20f8('0x2f')]]);if(_0x5dc2b0[_0x20f8('0x7c')]){var _0x5bc105={};_0x5bc105[_0x5dc2b0[_0x20f8('0x7e')]]=_0x145d7a[_0x299dd3][_0x20f8('0x7f')];_0x1d742d[_0x20f8('0x60')](_0x5bc105);}else{if(!_0x170342[_0x20f8('0x3f')]['id'])_0x170342[_0x20f8('0x3f')]['id']=[];_0x145d7a[_0x299dd3][_0x20f8('0x7f')][_0x20f8('0x68')](function(_0x52d03c){_0x170342[_0x20f8('0x3f')]['id'][_0x20f8('0x60')](_0x52d03c);});}}}if(!_[_0x20f8('0x65')](_0x1d742d)){_0x170342[_0x20f8('0x3f')]=_[_0x20f8('0x42')](_0x170342[_0x20f8('0x3f')],{'$and':{'$or':_0x1d742d}});}_0x170342=_[_0x20f8('0x42')]({},_0x170342,_0x3cb6d3[_0x20f8('0x44')]);if(_0x5da3e7&&!_0x5da3e7[_0x20f8('0x57')]&&_0x32a11f['childModel']===_0x20f8('0x7d')){if(_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x4a')]){_0x170342[_0x20f8('0x45')]=[{'all':!![]}];}return db[_0x32a11f[_0x20f8('0x73')]][_0x20f8('0x55')](_0x170342)[_0x20f8('0x2c')](function(_0x3e23b5){var _0xae1ee7=[];_0x3e23b5[_0x20f8('0x68')](function(_0x3fb7e0){var _0x23b03f;switch(_0x3fb7e0['reportType']){case _0x20f8('0x80'):_0x23b03f=_[_0x20f8('0x4d')](_0x5da3e7[_0x20f8('0x7f')],function(_0x44d76e){return _0x44d76e['id']===_0x3fb7e0[_0x20f8('0x81')]&&_0x44d76e[_0x20f8('0x35')]===_0x20f8('0x82');});break;case _0x20f8('0x83'):_0x23b03f=_['find'](_0x5da3e7['associatedResources'],function(_0x5d9eb2){return _0x5d9eb2['id']===_0x3fb7e0[_0x20f8('0x81')]&&_0x5d9eb2[_0x20f8('0x35')]===_0x20f8('0x84');});break;}if(_0x23b03f)_0xae1ee7[_0x20f8('0x60')](_0x3fb7e0);});_0x112fa4['count']=_0xae1ee7[_0x20f8('0x3c')];_0x112fa4[_0x20f8('0x46')]=_0xae1ee7;return _0x112fa4;});}else{return db[_0x32a11f['childModel']][_0x20f8('0x85')]({'where':_0x170342[_0x20f8('0x3f')]})[_0x20f8('0x2c')](function(_0x37c330){_0x112fa4[_0x20f8('0x85')]=_0x37c330;if(_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x4a')]){if(_0x32a11f['childModel']===_0x20f8('0x86')){_0x170342['include']=[{'model':db[_0x20f8('0x87')],'as':_0x20f8('0x88'),'attributes':['id',_0x20f8('0x2f'),'color'],'required':_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x89')]?!![]:![]},{'model':db[_0x20f8('0x87')],'as':_0x20f8('0x8a'),'attributes':['id','name',_0x20f8('0x8b')],'through':_0x3cb6d3['query']['tag']?{'attributes':[],'where':{'TagId':_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x89')]||undefined}}:{},'required':_0x3cb6d3['query'][_0x20f8('0x89')]?!![]:![]}];}else{_0x170342[_0x20f8('0x45')]=[{'all':!![]}];}}return db[_0x32a11f[_0x20f8('0x73')]][_0x20f8('0x55')](_0x170342);})[_0x20f8('0x2c')](function(_0x4837b0){_0x112fa4[_0x20f8('0x46')]=_0x4837b0;return _0x112fa4;});}}else{return _0x112fa4;}})[_0x20f8('0x2c')](respondWithFilteredResult(_0x2bb08c,_0x170342))[_0x20f8('0x47')](handleError(_0x2bb08c,null));};function getAllResources(_0x43ac72,_0x2eb847){return new BPromise(function(_0x2b49d0,_0x26bfc1){if(_0x2eb847){var _0x29a2f8=_0x2eb847[_0x20f8('0x41')]?{[_0x2eb847[_0x20f8('0x41')][_0x20f8('0x7c')]]:_0x2eb847[_0x20f8('0x41')][_0x20f8('0x8c')]}:undefined;return db[_0x43ac72][_0x20f8('0x55')]({'where':_0x29a2f8,'raw':!![]})['then'](function(_0x5aaae5){_0x2eb847['associatedResources']=_[_0x20f8('0x31')](_0x5aaae5,'id');_0x2b49d0(_0x2eb847);})['catch'](function(_0x1dd9b6){_0x26bfc1(_0x1dd9b6);});}else{_0x2b49d0(null);}});}function getAllFilteredResources(_0x32bdaf,_0xe6ff13){return new BPromise(function(_0x1eadb,_0x5b88e2){var _0x15cf24=_0x32bdaf['filter']?{[_0x32bdaf[_0x20f8('0x41')][_0x20f8('0x7c')]]:_0x32bdaf['filter'][_0x20f8('0x8c')]}:undefined;return db[_0x32bdaf[_0x20f8('0x37')]]['findAll']({'where':_0x15cf24,'raw':!![]})[_0x20f8('0x2c')](function(_0x3bec30){_0xe6ff13[_0x20f8('0x7f')]=_[_0x20f8('0x31')](_0x3bec30,function(_0x3d69dd){return _0x3d69dd['name'];});_0x1eadb(_0xe6ff13);})['catch'](function(_0x119cd7){_0x5b88e2(_0x119cd7);});});}function getAllowedResources(_0xcd4f70,_0x3ef8a0,_0x4095f6){return new BPromise(function(_0x42d57f,_0x55ffc2){if(_0x3ef8a0){return db[_0x20f8('0x5a')][_0x20f8('0x55')]({'where':{'sectionId':_0x3ef8a0['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x598a95){if(_0xcd4f70['field']&&_0xcd4f70[_0x20f8('0x7c')]!=='id'){_0x3ef8a0[_0x20f8('0x7f')]=_[_0x20f8('0x31')](_0x598a95,function(_0x816fbb){return _0x816fbb[_0xcd4f70['field']];});}else{if(_0x4095f6===_0x20f8('0x7d')){_0x3ef8a0['associatedResources']=_['map'](_0x598a95,function(_0x6e13db){return{'id':_0x6e13db[_0x20f8('0x69')],'type':_0x6e13db[_0x20f8('0x35')]};});}else{_0x3ef8a0[_0x20f8('0x7f')]=_[_0x20f8('0x31')](_0x598a95,function(_0xfa5b01){return _0xfa5b01[_0x20f8('0x69')];});}}_0x42d57f(_0x3ef8a0);})[_0x20f8('0x47')](function(_0x44611d){_0x55ffc2(_0x44611d);});}else{_0x42d57f(null);}});}function getQueryModels(_0x5e06d1,_0x590532){var _0x15b31c=_0x5e06d1[_0x20f8('0x8d')]();var _0x3caeeb={'childModel':undefined,'parentSections':[]};switch(_0x15b31c){case'squareprojects':_0x3caeeb['childModel']=_0x20f8('0x8e');break;case _0x20f8('0x8f'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x90');break;case _0x20f8('0x91'):_0x3caeeb[_0x20f8('0x73')]='SquareRecording';_0x3caeeb[_0x20f8('0x75')]=[{'name':'SquareProjects','field':_0x20f8('0x2f'),'foreignKey':_0x20f8('0x92')}];break;case _0x20f8('0x93'):_0x3caeeb['childModel']=_0x20f8('0x94');break;case _0x20f8('0x95'):_0x3caeeb['childModel']='CmContact';_0x3caeeb[_0x20f8('0x75')]=[{'name':_0x20f8('0x96'),'field':'id','foreignKey':'ListId'}];break;case _0x20f8('0x97'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x98');break;case _0x20f8('0x99'):_0x3caeeb['childModel']=_0x20f8('0x9a');break;case _0x20f8('0x9b'):_0x3caeeb[_0x20f8('0x73')]='CmCustomField';break;case'chatqueues':_0x3caeeb['childModel']='ChatQueue';break;case _0x20f8('0x9c'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x9d');break;case _0x20f8('0x9e'):_0x3caeeb['childModel']=_0x20f8('0x9f');break;case _0x20f8('0xa0'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xa1');break;case'inboundroutes':case _0x20f8('0xa2'):case _0x20f8('0xa3'):_0x3caeeb['childModel']='VoiceExtension';break;case _0x20f8('0xa4'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xa5');break;case _0x20f8('0xa6'):_0x3caeeb['childModel']=_0x20f8('0xa7');break;case _0x20f8('0xa8'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xa9');_0x3caeeb['parentSections']=[{'name':_0x20f8('0xaa'),'field':'name','foreignKey':_0x20f8('0xab'),'model':_0x20f8('0xac'),'filter':{'field':_0x20f8('0xad'),'value':[_0x20f8('0xae')]}},{'name':_0x20f8('0xaf'),'field':_0x20f8('0x2f'),'foreignKey':_0x20f8('0xab'),'model':'User','filter':{'field':_0x20f8('0xad'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x20f8('0x2f'),'foreignKey':'queue','model':_0x20f8('0xb0'),'filter':{'field':'type','value':[_0x20f8('0xb1')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x20f8('0xb2'),'model':'VoiceQueue','filter':{'field':_0x20f8('0x35'),'value':[_0x20f8('0xb3')]}}];break;case'musiconholds':_0x3caeeb['childModel']=_0x20f8('0xb4');break;case _0x20f8('0xb5'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xb6');break;case _0x20f8('0xb7'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xb8');break;case _0x20f8('0xb9'):_0x3caeeb['childModel']='Campaign';break;case _0x20f8('0xba'):_0x3caeeb['childModel']=_0x20f8('0xbb');break;case _0x20f8('0xbc'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xbd');break;case _0x20f8('0xbe'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xbf');break;case _0x20f8('0xc0'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc1');break;case _0x20f8('0xc2'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc3');break;case _0x20f8('0xc4'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc5');break;case _0x20f8('0xc6'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc7');break;case _0x20f8('0xc8'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc9');break;case _0x20f8('0xca'):_0x3caeeb[_0x20f8('0x73')]='WhatsappAccount';break;case _0x20f8('0xcb'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xcc');break;case _0x20f8('0xcd'):case _0x20f8('0xce'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xb0');if(_0x590532){_0x3caeeb['parentSections']=[{'name':_0x20f8('0xcf')},{'name':_0x20f8('0xd0')}];}break;case _0x20f8('0xd1'):case _0x20f8('0xd2'):case _0x20f8('0xd3'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xac');if(_0x590532){_0x3caeeb['parentSections']=[{'name':_0x20f8('0xd4'),'filter':{'field':_0x20f8('0xad'),'value':['admin',_0x20f8('0xd5')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x20f8('0xd6'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xd7');break;case _0x20f8('0xd8'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xd9');break;case'freshdeskaccounts':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xda');break;case'sugarcrmaccounts':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xdb');break;case _0x20f8('0xdc'):_0x3caeeb[_0x20f8('0x73')]='DeskAccount';break;case _0x20f8('0xdd'):_0x3caeeb['childModel']=_0x20f8('0xde');break;case _0x20f8('0xdf'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xac');break;case _0x20f8('0xe0'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe1');break;case'dispositions':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe2');break;case _0x20f8('0xe3'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x67');break;case'intervals':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe4');break;case'pauses':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe5');break;case _0x20f8('0xe6'):_0x3caeeb['childModel']='Schedule';break;case _0x20f8('0xe7'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe8');break;case _0x20f8('0xe9'):_0x3caeeb[_0x20f8('0x73')]='Tag';break;case _0x20f8('0xea'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xeb');break;case _0x20f8('0xec'):_0x3caeeb[_0x20f8('0x73')]='Trigger';break;case _0x20f8('0xed'):_0x3caeeb[_0x20f8('0x73')]='Trunk';break;case _0x20f8('0xee'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xef');break;case'plugins':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x6a');break;case'extractedreports':_0x3caeeb[_0x20f8('0x73')]='AnalyticExtractedReport';_0x3caeeb[_0x20f8('0x75')]=[{'name':_0x20f8('0xf0'),'field':'id','foreignKey':_0x20f8('0x81')}];break;case _0x20f8('0xf1'):_0x3caeeb[_0x20f8('0x73')]='AnalyticMetric';break;case _0x20f8('0xca'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xf2');break;default:return _0x3caeeb;}return _0x3caeeb;}
\ No newline at end of file