Built motion from commit (unavailable).|2.5.20
[motion2.git] / server / api / userProfile / userProfile.controller.js
index a97a5b9..7458323 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc86f=['length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','clone','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','describe','sequelize','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','get','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','pick','type','VIRTUAL','field','associatedResources','foreignKey','reportType','default','reportId','rows','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','users','agents','admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','apply','save','then','destroy','error','stack','UserProfile','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields'];(function(_0x3ecd68,_0x4930c4){var _0x1a39cc=function(_0x549817){while(--_0x549817){_0x3ecd68['push'](_0x3ecd68['shift']());}};_0x1a39cc(++_0x4930c4);}(_0xc86f,0xb3));var _0xfc86=function(_0x2713f5,_0x382adb){_0x2713f5=_0x2713f5-0x0;var _0x4e6249=_0xc86f[_0x2713f5];return _0x4e6249;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc86('0x0'));var rimraf=require(_0xfc86('0x1'));var zipdir=require(_0xfc86('0x2'));var jsonpatch=require(_0xfc86('0x3'));var rp=require(_0xfc86('0x4'));var moment=require('moment');var BPromise=require(_0xfc86('0x5'));var Mustache=require('mustache');var util=require(_0xfc86('0x6'));var path=require('path');var sox=require(_0xfc86('0x7'));var csv=require(_0xfc86('0x8'));var ejs=require(_0xfc86('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc86('0xa'));var crypto=require(_0xfc86('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfc86('0xc'));var toCsv=require(_0xfc86('0x8'));var querystring=require('querystring');var Papa=require(_0xfc86('0xd'));var Redis=require(_0xfc86('0xe'));var authService=require(_0xfc86('0xf'));var qs=require(_0xfc86('0x10'));var as=require(_0xfc86('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc86('0x12'))(_0xfc86('0x13'));var utils=require('../../config/utils');var config=require(_0xfc86('0x14'));var licenseUtil=require(_0xfc86('0x15'));var db=require(_0xfc86('0x16'))['db'];config[_0xfc86('0x17')]=_['defaults'](config[_0xfc86('0x17')],{'host':_0xfc86('0x18'),'port':0x18eb});var socket=require(_0xfc86('0x19'))(new Redis(config[_0xfc86('0x17')]));require('./userProfile.socket')[_0xfc86('0x1a')](socket);function respondWithStatusCode(_0x1098c3,_0x3085f7){_0x3085f7=_0x3085f7||0xcc;return function(_0x49d0ca){if(_0x49d0ca){return _0x1098c3[_0xfc86('0x1b')](_0x3085f7);}return _0x1098c3[_0xfc86('0x1c')](_0x3085f7)[_0xfc86('0x1d')]();};}function respondWithResult(_0x1a31e8,_0x18ee80){_0x18ee80=_0x18ee80||0xc8;return function(_0x1f1a5c){if(_0x1f1a5c){return _0x1a31e8['status'](_0x18ee80)[_0xfc86('0x1e')](_0x1f1a5c);}};}function respondWithFilteredResult(_0x653a36,_0x347d00){return function(_0x9d3f03){if(_0x9d3f03){var _0x917206=_0x9d3f03[_0xfc86('0x1f')],_0x2e3167=_0x347d00[_0xfc86('0x20')],_0xaa96f1=_0x347d00[_0xfc86('0x20')]+_0x347d00['limit'],_0x117004;if(_0xaa96f1>=_0x917206){_0xaa96f1=_0x917206;_0x117004=0xc8;}else{_0x117004=0xce;}_0x653a36[_0xfc86('0x1c')](_0x117004);return _0x653a36['set']('Content-Range',_0x2e3167+'-'+_0xaa96f1+'/'+_0x917206)[_0xfc86('0x1e')](_0x9d3f03);}return null;};}function patchUpdates(_0x44c867){return function(_0x5439de){try{jsonpatch[_0xfc86('0x21')](_0x5439de,_0x44c867,!![]);}catch(_0xea65d9){return BPromise['reject'](_0xea65d9);}return _0x5439de[_0xfc86('0x22')]();};}function saveUpdates(_0x1a7cc6,_0x11238a){return function(_0x55e81a){if(_0x55e81a){return _0x55e81a['update'](_0x1a7cc6)[_0xfc86('0x23')](function(_0x386b16){return _0x386b16;});}return null;};}function removeEntity(_0x1cec62,_0x579d8e){return function(_0x912a3d){if(_0x912a3d){return _0x912a3d[_0xfc86('0x24')]()[_0xfc86('0x23')](function(){_0x1cec62['status'](0xcc)[_0xfc86('0x1d')]();});}};}function handleEntityNotFound(_0xa3322f,_0x20d90f){return function(_0x33b875){if(!_0x33b875){_0xa3322f[_0xfc86('0x1b')](0x194);}return _0x33b875;};}function handleError(_0xa590fa,_0x579497){_0x579497=_0x579497||0x1f4;return function(_0x3131a8){logger[_0xfc86('0x25')](_0x3131a8[_0xfc86('0x26')]);if(_0x3131a8['name']){delete _0x3131a8['name'];}_0xa590fa[_0xfc86('0x1c')](_0x579497)['send'](_0x3131a8);};}exports['index']=function(_0xf914cf,_0x3ccfcc){var _0x200be0={},_0x3a8ed4={},_0x29e60a={'count':0x0,'rows':[]};var _0x926029=_['map'](db[_0xfc86('0x27')][_0xfc86('0x28')],function(_0x12b693){return{'name':_0x12b693['fieldName'],'type':_0x12b693['type'][_0xfc86('0x29')]};});_0x3a8ed4[_0xfc86('0x2a')]=_[_0xfc86('0x2b')](_0x926029,_0xfc86('0x2c'));_0x3a8ed4[_0xfc86('0x2d')]=_[_0xfc86('0x2e')](_0xf914cf['query']);_0x3a8ed4[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x3a8ed4[_0xfc86('0x2a')],_0x3a8ed4[_0xfc86('0x2d')]);_0x200be0[_0xfc86('0x31')]=_['intersection'](_0x3a8ed4[_0xfc86('0x2a')],qs['fields'](_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x32')]));_0x200be0['attributes']=_0x200be0['attributes'][_0xfc86('0x33')]?_0x200be0[_0xfc86('0x31')]:_0x3a8ed4[_0xfc86('0x2a')];if(!_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x34')](_0xfc86('0x35'))){_0x200be0[_0xfc86('0x36')]=qs['limit'](_0xf914cf['query']['limit']);_0x200be0[_0xfc86('0x20')]=qs['offset'](_0xf914cf['query'][_0xfc86('0x20')]);}_0x200be0[_0xfc86('0x37')]=qs[_0xfc86('0x38')](_0xf914cf['query'][_0xfc86('0x38')]);_0x200be0['where']=qs[_0xfc86('0x2f')](_['pick'](_0xf914cf[_0xfc86('0x2d')],_0x3a8ed4['filters']),_0x926029);if(_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x39')]){_0x200be0[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x200be0[_0xfc86('0x3a')],{'$or':_['map'](_0x926029,function(_0x27d8e9){if(_0x27d8e9['type']!=='VIRTUAL'){var _0x1cbdca={};_0x1cbdca[_0x27d8e9[_0xfc86('0x2c')]]={'$like':'%'+_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x39')]+'%'};return _0x1cbdca;}})});}_0x200be0=_['merge']({},_0x200be0,_0xf914cf[_0xfc86('0x3c')]);var _0x20da03={'where':_0x200be0[_0xfc86('0x3a')]};return db[_0xfc86('0x27')][_0xfc86('0x1f')](_0x20da03)['then'](function(_0x4a2cbf){_0x29e60a[_0xfc86('0x1f')]=_0x4a2cbf;if(_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x3d')]){_0x200be0[_0xfc86('0x3e')]=[{'all':!![]}];}return db[_0xfc86('0x27')][_0xfc86('0x3f')](_0x200be0);})['then'](function(_0x4971eb){_0x29e60a['rows']=_0x4971eb;return _0x29e60a;})['then'](respondWithFilteredResult(_0x3ccfcc,_0x200be0))['catch'](handleError(_0x3ccfcc,null));};exports[_0xfc86('0x40')]=function(_0x4074d9,_0x4c5463){var _0x45f069={'raw':![],'where':{'id':_0x4074d9[_0xfc86('0x41')]['id']}},_0x4c6616={};_0x4c6616['model']=_[_0xfc86('0x2e')](db[_0xfc86('0x27')][_0xfc86('0x28')]);_0x4c6616['query']=_[_0xfc86('0x2e')](_0x4074d9[_0xfc86('0x2d')]);_0x4c6616[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x4c6616[_0xfc86('0x2a')],_0x4c6616['query']);_0x45f069[_0xfc86('0x31')]=_[_0xfc86('0x30')](_0x4c6616[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x4074d9[_0xfc86('0x2d')][_0xfc86('0x32')]));_0x45f069[_0xfc86('0x31')]=_0x45f069[_0xfc86('0x31')][_0xfc86('0x33')]?_0x45f069[_0xfc86('0x31')]:_0x4c6616['model'];if(_0x4074d9[_0xfc86('0x2d')][_0xfc86('0x3d')]){_0x45f069[_0xfc86('0x3e')]=[{'all':!![]}];}_0x45f069=_[_0xfc86('0x3b')]({},_0x45f069,_0x4074d9[_0xfc86('0x3c')]);return db[_0xfc86('0x27')][_0xfc86('0x42')](_0x45f069)[_0xfc86('0x23')](handleEntityNotFound(_0x4c5463,null))[_0xfc86('0x23')](respondWithResult(_0x4c5463,null))[_0xfc86('0x43')](handleError(_0x4c5463,null));};exports[_0xfc86('0x44')]=function(_0x3c4f3d,_0xd880e0){return db[_0xfc86('0x27')]['create'](_0x3c4f3d[_0xfc86('0x45')],{})[_0xfc86('0x23')](respondWithResult(_0xd880e0,0xc9))[_0xfc86('0x43')](handleError(_0xd880e0,null));};exports[_0xfc86('0x46')]=function(_0x39a2e,_0x26b236){var _0x26e602={'where':{'id':_0x39a2e['params']['id']}},_0x1f6911={};_0x1f6911[_0xfc86('0x2a')]=_[_0xfc86('0x2e')](db['UserProfile']['rawAttributes']);_0x26e602[_0xfc86('0x31')]=_[_0xfc86('0x30')](_0x1f6911[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x39a2e['query'][_0xfc86('0x32')]));_0x26e602[_0xfc86('0x31')]=_0x26e602[_0xfc86('0x31')][_0xfc86('0x33')]?_0x26e602['attributes']:_0x1f6911[_0xfc86('0x2a')];if(_0x39a2e['query'][_0xfc86('0x3d')]){_0x26e602[_0xfc86('0x3e')]=[{'all':!![]}];}_0x26e602=_[_0xfc86('0x3b')]({},_0x26e602,_0x39a2e['options']);return db[_0xfc86('0x27')][_0xfc86('0x42')](_0x26e602)['then'](handleEntityNotFound(_0x26b236,null))['then'](function(_0x30a07e){if(_0x30a07e){var _0x5ee6fe=_0x30a07e['get']({'plain':!![]});_0x5ee6fe=qs[_0xfc86('0x47')](_0x5ee6fe,['id','createdAt',_0xfc86('0x48'),_0xfc86('0x49')]);_0x39a2e[_0xfc86('0x45')]=_[_0xfc86('0x47')](_0x39a2e[_0xfc86('0x45')],['id',_0xfc86('0x4a'),_0xfc86('0x48')]);return db['sequelize'][_0xfc86('0x4b')](function(_0xbfa740){return db[_0xfc86('0x27')][_0xfc86('0x44')](_[_0xfc86('0x3b')](_0x5ee6fe,_0x39a2e[_0xfc86('0x45')]),{'include':_0x39a2e['query'][_0xfc86('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0xbfa740})[_0xfc86('0x23')](function(_0x2570fc){var _0x5382e5=_0x2570fc['get']({'plain':!![]});return db[_0xfc86('0x4c')][_0xfc86('0x3f')]({'where':{'userProfileId':_0x39a2e[_0xfc86('0x41')]['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x54b1f0){if(_0x54b1f0){return BPromise[_0xfc86('0x4d')](_0x54b1f0,function(_0x2acb34){return new BPromise(function(_0x43b6f6,_0x506ad7){if(_0x2acb34[_0xfc86('0x4e')]===null||_0x2acb34[_0xfc86('0x4e')]===0x1)_0x43b6f6(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2acb34['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x20f8d6){var _0x161a59=_[_0xfc86('0x2b')](_0x20f8d6,function(_0x49035c){return qs[_0xfc86('0x47')](_0x49035c,['id',_0xfc86('0x4a'),_0xfc86('0x48'),_0xfc86('0x4f')]);});_0x43b6f6(_0x161a59);})[_0xfc86('0x43')](function(_0x4ccf3c){_0x506ad7(_0x4ccf3c);});})['then'](function(_0x45e5ad){var _0x46f5c5=qs[_0xfc86('0x47')](_0x2acb34,['id',_0xfc86('0x4a'),'updatedAt']);_0x46f5c5[_0xfc86('0x50')]=_0x5382e5['id'];if(_0x45e5ad)_0x46f5c5[_0xfc86('0x51')]=_0x45e5ad;return _0x46f5c5;})[_0xfc86('0x23')](function(_0x2ce8e3){return db[_0xfc86('0x4c')]['create'](_0x2ce8e3,{'include':[{'model':db[_0xfc86('0x52')],'as':_0xfc86('0x51')}],'raw':!![],'transaction':_0xbfa740});});})[_0xfc86('0x23')](function(){return _0x5382e5;});}});});});}})[_0xfc86('0x23')](respondWithResult(_0x26b236,0xc9))[_0xfc86('0x43')](handleError(_0x26b236,null));};exports[_0xfc86('0x53')]=function(_0x252ecd,_0x3368ce){if(_0x252ecd[_0xfc86('0x45')]['id']){delete _0x252ecd[_0xfc86('0x45')]['id'];}return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x252ecd['params']['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3368ce,null))['then'](saveUpdates(_0x252ecd[_0xfc86('0x45')],null))[_0xfc86('0x23')](respondWithResult(_0x3368ce,null))['catch'](handleError(_0x3368ce,null));};exports['destroy']=function(_0x12ccf8,_0x3b76f4){return db['UserProfile'][_0xfc86('0x42')]({'where':{'id':_0x12ccf8[_0xfc86('0x41')]['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3b76f4,null))[_0xfc86('0x23')](removeEntity(_0x3b76f4,null))[_0xfc86('0x43')](handleError(_0x3b76f4,null));};exports[_0xfc86('0x54')]=function(_0x511685,_0x2825aa){return db[_0xfc86('0x27')][_0xfc86('0x54')]()[_0xfc86('0x23')](respondWithResult(_0x2825aa,null))[_0xfc86('0x43')](handleError(_0x2825aa,null));};exports['addSections']=function(_0x200c88,_0x3bcb42){var _0x16188d=_0x200c88[_0xfc86('0x45')];return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x200c88['params']['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3bcb42,null))[_0xfc86('0x23')](function(_0x42a726){if(_0x42a726){return db[_0xfc86('0x55')]['transaction'](function(_0x3ff6ef){return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x200c88[_0xfc86('0x41')]['id'],'sectionId':_[_0xfc86('0x2b')](_0x16188d,function(_0x51d989){return _0x51d989[_0xfc86('0x4f')];})},'transaction':_0x3ff6ef})[_0xfc86('0x23')](function(){var _0x20292f=_['map'](_0x16188d,function(_0x396dfd){_0x396dfd[_0xfc86('0x50')]=_0x200c88[_0xfc86('0x41')]['id'];return _0x396dfd;});var _0x32c0b5=[];return BPromise[_0xfc86('0x4d')](_0x20292f,function(_0x505e34){return db[_0xfc86('0x4c')]['create'](_0x505e34,{'include':[{'model':db[_0xfc86('0x52')],'as':_0xfc86('0x51')}],'raw':!![],'transaction':_0x3ff6ef})[_0xfc86('0x23')](function(_0x4a9fd5){_0x32c0b5['push'](_0x4a9fd5['get']({'plain':!![]}));});})[_0xfc86('0x23')](function(){return _0x32c0b5;});});});}})[_0xfc86('0x23')](function(_0xbccff3){return _0xbccff3;})['then'](respondWithResult(_0x3bcb42,null))[_0xfc86('0x43')](handleError(_0x3bcb42,null));};exports[_0xfc86('0x56')]=function(_0x586a88,_0x27c2d2){var _0x20b96c;return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x586a88[_0xfc86('0x41')]['id']},'attributes':['id',_0xfc86('0x2c')]})[_0xfc86('0x23')](handleEntityNotFound(_0x27c2d2,null))[_0xfc86('0x23')](function(_0x821fbc){if(_0x821fbc){_0x20b96c=_0x821fbc;return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x586a88[_0xfc86('0x41')]['id'],'sectionId':_0x586a88[_0xfc86('0x2d')][_0xfc86('0x57')]}});}})[_0xfc86('0x23')](function(){return _0x20b96c;})['then'](respondWithStatusCode(_0x27c2d2,null))[_0xfc86('0x43')](handleError(_0x27c2d2,null));};exports[_0xfc86('0x58')]=function(_0xedcfc3,_0x19d2a1){var _0x473694=[];var _0x12735e=[];return db['UserProfileSection'][_0xfc86('0x3f')]({'where':{'userProfileId':_0xedcfc3[_0xfc86('0x41')]['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x1d2aff){_0x473694=_[_0xfc86('0x39')](_0x1d2aff,function(_0x3b0cf4){return _0x3b0cf4[_0xfc86('0x59')]===0x1||_['includes']([0x3eb,0x709],_0x3b0cf4[_0xfc86('0x4f')]);});if(!_[_0xfc86('0x5a')](_0x473694)){return _[_0xfc86('0x2b')](_0x473694,function(_0xc840ad){return _0xc840ad[_0xfc86('0x4f')];});}else{return;}})['then'](function(_0x2aeafc){if(_0x2aeafc)_0x12735e=_0x2aeafc;if(_[_0xfc86('0x5b')](_0x12735e,0x64)){var _0x103c31=_[_0xfc86('0x42')](_0x473694,{'sectionId':0x64});return hasDefaultDashboard(_0x103c31)[_0xfc86('0x23')](function(_0x2cb602){return _[_0xfc86('0x2b')](_0x473694,function(_0x364107){if(_0x364107[_0xfc86('0x4f')]===0x64){_0x364107[_0xfc86('0x5c')]=_0x2cb602;}return _0x364107;});});}else{return;}})[_0xfc86('0x23')](function(_0x118a91){if(_0x118a91)_0x473694=_0x118a91;if(_['includes'](_0x12735e,0x3eb)){var _0x4a41fa=_['find'](_0x473694,{'sectionId':0x3eb});return getCustomDashboards(_0x4a41fa)[_0xfc86('0x23')](function(_0x25dca6){return _[_0xfc86('0x2b')](_0x473694,function(_0x4348cb){if(_0x4a41fa[_0xfc86('0x59')]){if(_0x4348cb[_0xfc86('0x4f')]===0x3eb){_0x4348cb[_0xfc86('0x5c')]=_0x25dca6;}}else{if(_0x4348cb[_0xfc86('0x4f')]===0x64){_0x4348cb[_0xfc86('0x5c')]=_0x25dca6;}}return _0x4348cb;});});}else{return;}})[_0xfc86('0x23')](function(_0x3a0b03){if(_0x3a0b03)_0x473694=_0x3a0b03;if(_[_0xfc86('0x5b')](_0x12735e,0x709)){var _0x470420=_[_0xfc86('0x42')](_0x473694,{'sectionId':0x709});return getPlugins(_0x470420)[_0xfc86('0x23')](function(_0x31a4be){if(_0x470420[_0xfc86('0x59')]){return _[_0xfc86('0x2b')](_0x473694,function(_0x3d875a){if(_0x3d875a[_0xfc86('0x4f')]===0x709){_0x3d875a[_0xfc86('0x5c')]=_0x31a4be;}return _0x3d875a;});}else{var _0x2c629b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x31a4be};var _0x16392f=_['map'](_0x473694);_0x16392f[_0xfc86('0x5d')](_0x2c629b);return _0x16392f;}});}else{return;}})[_0xfc86('0x23')](function(_0x1a31bb){if(_0x1a31bb)_0x473694=_0x1a31bb;return _[_0xfc86('0x39')](_0x473694,['enabled',0x1]);})['then'](respondWithResult(_0x19d2a1,null))[_0xfc86('0x43')](handleError(_0x19d2a1,null));};function hasDefaultDashboard(_0x38a363){var _0x21fe8c=[0x65];return new BPromise(function(_0x3158ed,_0x5f1078){try{if(_0x38a363[_0xfc86('0x4e')]){_0x3158ed(_0x21fe8c);}else{return db['UserProfileResource'][_0xfc86('0x5e')]({'where':{'sectionId':_0x38a363['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x2ef5c5){_0x2ef5c5?_0x3158ed(_0x21fe8c):_0x3158ed();});}}catch(_0x27833d){_0x5f1078(_0x27833d);}});}function getCustomDashboards(_0x436052){var _0x377e37=[];return new BPromise(function(_0x5c8cff,_0x289f20){try{if(_0x436052[_0xfc86('0x4e')]){return db['Dashboard'][_0xfc86('0x3f')]({'raw':!![]})[_0xfc86('0x23')](function(_0x5ec156){_0x5ec156[_0xfc86('0x5f')](function(_0x57ec9b){_0x377e37[_0xfc86('0x5d')](_0x57ec9b['id']+0x1869f);});_0x5c8cff(_0x377e37);});}else{return db[_0xfc86('0x52')][_0xfc86('0x3f')]({'where':{'sectionId':_0x436052['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x2035a5){_0x2035a5['forEach'](function(_0x1b8b71){_0x377e37[_0xfc86('0x5d')](_0x1b8b71[_0xfc86('0x60')]+0x1869f);});_0x5c8cff(_0x377e37);});}}catch(_0x31b90a){_0x289f20(_0x31b90a);}});}function getPlugins(_0x278046){var _0x35f4a5=[];return new BPromise(function(_0x7dfbc,_0x2a644a){try{if(_0x278046['autoAssociation']){return db[_0xfc86('0x61')][_0xfc86('0x3f')]({'raw':!![]})[_0xfc86('0x23')](function(_0x20a2ed){_0x20a2ed['forEach'](function(_0x3d6dfe){_0x35f4a5[_0xfc86('0x5d')](_0x3d6dfe['id']+0x15b38);});_0x7dfbc(_0x35f4a5);});}else{return db[_0xfc86('0x52')][_0xfc86('0x3f')]({'where':{'sectionId':_0x278046['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x3f910f){_0x3f910f['forEach'](function(_0x1ee07e){_0x35f4a5[_0xfc86('0x5d')](_0x1ee07e[_0xfc86('0x60')]+0x15b38);});_0x7dfbc(_0x35f4a5);});}}catch(_0xf4b6f9){_0x2a644a(_0xf4b6f9);}});}exports[_0xfc86('0x62')]=function(_0x1149ee,_0x6b19e1){return db[_0xfc86('0x27')]['find']({'where':{'id':_0x1149ee[_0xfc86('0x41')]['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x6b19e1,null))[_0xfc86('0x23')](function(_0x7501d3){if(_0x7501d3){return db['sequelize'][_0xfc86('0x4b')](function(_0x4a082b){return db['UserProfileSection'][_0xfc86('0x3f')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id']},'attributes':['id'],'raw':!![]})[_0xfc86('0x23')](function(_0xe02640){if(_0xe02640){return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id'],'id':_[_0xfc86('0x2b')](_0xe02640,function(_0x209e0a){return _0x209e0a['id'];})},'transaction':_0x4a082b});}})['then'](function(_0x137c17){var _0x2c7dbb=_['map'](_0x1149ee[_0xfc86('0x45')],function(_0x1a7e5d){_0x1a7e5d[_0xfc86('0x50')]=_0x1149ee[_0xfc86('0x41')]['id'];return _0x1a7e5d;});return db[_0xfc86('0x4c')][_0xfc86('0x63')](_0x2c7dbb,{'raw':!![],'transaction':_0x4a082b});})[_0xfc86('0x23')](function(_0x1d24cc){var _0x59f1a6=_[_0xfc86('0x39')](_[_0xfc86('0x2b')](_0x1d24cc,function(_0x386988){return _0x386988['get']({'plain':!![]});}),{'includeAll':![]});if(_0x59f1a6){return db[_0xfc86('0x4c')][_0xfc86('0x3f')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id'],'sectionId':_[_0xfc86('0x2b')](_0x59f1a6,function(_0x5a18eb){return _0x5a18eb[_0xfc86('0x4f')];})},'attributes':['id',_0xfc86('0x4f')],'raw':!![]})[_0xfc86('0x23')](function(_0x40482e){var _0x1b04c=_['map'](_0x1149ee[_0xfc86('0x45')],function(_0x5d429a){_0x5d429a['userProfileId']=_0x1149ee[_0xfc86('0x41')]['id'];return _0x5d429a;});return db[_0xfc86('0x52')][_0xfc86('0x63')](_0x1b04c,{'raw':!![],'transaction':_0x4a082b});});}})[_0xfc86('0x43')](handleError(_0x6b19e1,null));});}})[_0xfc86('0x23')](function(_0x4aac1e){var _0x35ec80=_[_0xfc86('0x2b')](_0x4aac1e,function(_0x31a244){return _0x31a244[_0xfc86('0x64')]({'plain':!![]});});})[_0xfc86('0x23')](respondWithResult(_0x6b19e1,null))[_0xfc86('0x43')](handleError(_0x6b19e1,null));};exports[_0xfc86('0x65')]=function(_0xb5d911,_0x355887,_0x58f41f){return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0xb5d911[_0xfc86('0x41')]['id']}})['then'](handleEntityNotFound(_0x355887,null))[_0xfc86('0x23')](function(_0x26639b){if(_0x26639b){return _0x26639b['removeResources'](_0xb5d911[_0xfc86('0x2d')][_0xfc86('0x57')]);}})[_0xfc86('0x23')](respondWithStatusCode(_0x355887,null))['catch'](handleError(_0x355887,null));};exports[_0xfc86('0x66')]=function(_0x5999de,_0xfa1a08){var _0x5a723d={'raw':![],'where':{}};var _0x1e3fab={};var _0x332444={'count':0x0,'rows':[]};var _0x4738d6=_0x5999de[_0xfc86('0x2d')][_0xfc86('0x67')];if(typeof _0x4738d6===_0xfc86('0x68')){throw new db[(_0xfc86('0x69'))][(_0xfc86('0x6a'))](_0xfc86('0x6b'));}var _0x3a7868=_0x5999de['query'][_0xfc86('0x6c')]||![];var _0x3cdbb2=getQueryModels(_0x4738d6,_0x3a7868);if(typeof _0x3cdbb2['childModel']==='undefined'){throw new db['Sequelize']['ValidationError'](_0xfc86('0x6d')+_0x4738d6+'\x27');}var _0x259e50=[];if(!_['isEmpty'](_0x3cdbb2[_0xfc86('0x6e')])){_0x259e50=_0x3cdbb2[_0xfc86('0x6e')];}else{_0x259e50=[{'name':_0x4738d6}];}return db['UserProfile'][_0xfc86('0x5e')]({'where':{'id':_0x5999de[_0xfc86('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa1a08,null))[_0xfc86('0x23')](function(_0x1ad19d){if(_0x1ad19d){var _0x5e411e=[];for(var _0x22c8c3=0x0;_0x22c8c3<_0x259e50[_0xfc86('0x33')];_0x22c8c3++){_0x5e411e[_0xfc86('0x5d')](db['UserProfileSection'][_0xfc86('0x5e')]({'where':{'userProfileId':_0x1ad19d['id'],'name':_0x259e50[_0x22c8c3][_0xfc86('0x2c')]},'raw':!![]}));}return BPromise[_0xfc86('0x6f')](_0x5e411e);}})['then'](function(_0x9e1b68){var _0x5add7b=_[_0xfc86('0x39')](_0x9e1b68,function(_0x2e4af0){return _0x2e4af0?_0x2e4af0:undefined;});var _0x5c9b05=_['filter'](_0x259e50,[_0xfc86('0x70'),!![]]);var _0x494267=_[_0xfc86('0x5a')](_0x5add7b)&&_['isEmpty'](_0x5c9b05)?null:_[_0xfc86('0x71')](_0x5c9b05,_0x5add7b);if(_0x494267){var _0x6a4373=[];for(var _0x986ce7=0x0;_0x986ce7<_0x494267[_0xfc86('0x33')];_0x986ce7++){var _0x40f995=_[_0xfc86('0x42')](_0x259e50,function(_0x2a884d){return _0x494267[_0x986ce7]?_0x2a884d[_0xfc86('0x2c')]===_0x494267[_0x986ce7][_0xfc86('0x2c')]:null;});if(_0x40f995){if(_0x494267[_0x986ce7][_0xfc86('0x70')]){_0x6a4373['push'](getAllResources(_0x3cdbb2[_0xfc86('0x72')],_0x494267[_0x986ce7]));}else{if(!_0x494267[_0x986ce7]['autoAssociation']){_0x6a4373[_0xfc86('0x5d')](getAllowedResources(_0x40f995,_0x494267[_0x986ce7],_0x3cdbb2[_0xfc86('0x72')]));}else{if(_0x40f995[_0xfc86('0x2a')]){_0x6a4373['push'](getAllFilteredResources(_0x40f995,_0x494267[_0x986ce7]));}}}}}return BPromise['all'](_0x6a4373);}else{return null;}})[_0xfc86('0x23')](function(_0x57233b){var _0x450bac=_0x57233b;var _0x1b4b11=null;if(_0x450bac){_0x1b4b11=_0x450bac[_0xfc86('0x33')]===0x1?_0x450bac[0x0]:null;}if(_0x1b4b11||_0x450bac){var _0x13d6c5=db[_0x3cdbb2[_0xfc86('0x72')]][_0xfc86('0x28')];_0x1e3fab[_0xfc86('0x2a')]=_[_0xfc86('0x2e')](_0x13d6c5);_0x1e3fab['query']=_[_0xfc86('0x2e')](_0x5999de[_0xfc86('0x2d')]);_0x1e3fab['filters']=_[_0xfc86('0x30')](_0x1e3fab[_0xfc86('0x2a')],_0x1e3fab[_0xfc86('0x2d')]);_0x5a723d[_0xfc86('0x31')]=_['intersection'](_0x1e3fab[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x5999de['query'][_0xfc86('0x32')]));_0x5a723d['attributes']=_0x5a723d['attributes'][_0xfc86('0x33')]?_0x5a723d['attributes']:_0x1e3fab['model'];if(!_0x5999de[_0xfc86('0x2d')][_0xfc86('0x34')]('nolimit')){_0x5a723d['limit']=qs[_0xfc86('0x36')](_0x5999de[_0xfc86('0x2d')]['limit']);_0x5a723d[_0xfc86('0x20')]=qs[_0xfc86('0x20')](_0x5999de[_0xfc86('0x2d')][_0xfc86('0x20')]);}_0x5a723d[_0xfc86('0x37')]=qs['sort'](_0x5999de[_0xfc86('0x2d')][_0xfc86('0x38')]);_0x5a723d[_0xfc86('0x3a')]=qs[_0xfc86('0x2f')](_[_0xfc86('0x73')](_0x5999de[_0xfc86('0x2d')],_0x1e3fab['filters']));if(_0x5999de['query']['filter']){_0x5a723d[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x5a723d[_0xfc86('0x3a')],{'$or':_['map'](_0x13d6c5,function(_0x4a5ef0){if(_0x4a5ef0[_0xfc86('0x74')][_0xfc86('0x29')]!==_0xfc86('0x75')){var _0x44abfc={};_0x44abfc[_0x4a5ef0[_0xfc86('0x76')]]={'$like':'%'+_0x5999de[_0xfc86('0x2d')][_0xfc86('0x39')]+'%'};return _0x44abfc;}})});}var _0x46d9b6=[];if(_0x1b4b11){var _0x48452c=_[_0xfc86('0x42')](_0x259e50,[_0xfc86('0x2c'),_0x1b4b11['name']]);if(_0x48452c['field']){var _0x28bad9={};if(_0x3cdbb2[_0xfc86('0x72')]==='AnalyticExtractedReport'){_0x28bad9[_0x48452c['foreignKey']]=_[_0xfc86('0x2b')](_0x1b4b11[_0xfc86('0x77')],'id');}else{_0x28bad9[_0x48452c['foreignKey']]=_0x1b4b11[_0xfc86('0x77')];}_0x46d9b6[_0xfc86('0x5d')](_0x28bad9);}else{_0x5a723d[_0xfc86('0x3a')]['id']=_0x1b4b11[_0xfc86('0x77')];}}else{for(var _0x310728=0x0;_0x310728<_0x450bac[_0xfc86('0x33')];_0x310728++){var _0x48452c=_[_0xfc86('0x42')](_0x259e50,['name',_0x450bac[_0x310728][_0xfc86('0x2c')]]);if(_0x48452c[_0xfc86('0x76')]){var _0x28bad9={};_0x28bad9[_0x48452c[_0xfc86('0x78')]]=_0x450bac[_0x310728]['associatedResources'];_0x46d9b6[_0xfc86('0x5d')](_0x28bad9);}else{if(!_0x5a723d[_0xfc86('0x3a')]['id'])_0x5a723d[_0xfc86('0x3a')]['id']=[];_0x450bac[_0x310728]['associatedResources']['forEach'](function(_0x3b837f){_0x5a723d[_0xfc86('0x3a')]['id'][_0xfc86('0x5d')](_0x3b837f);});}}}if(!_['isEmpty'](_0x46d9b6)){_0x5a723d[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x5a723d[_0xfc86('0x3a')],{'$and':{'$or':_0x46d9b6}});}_0x5a723d=_[_0xfc86('0x3b')]({},_0x5a723d,_0x5999de[_0xfc86('0x3c')]);if(_0x1b4b11&&!_0x1b4b11[_0xfc86('0x4e')]&&_0x3cdbb2[_0xfc86('0x72')]==='AnalyticExtractedReport'){if(_0x5999de['query'][_0xfc86('0x3d')]){_0x5a723d[_0xfc86('0x3e')]=[{'all':!![]}];}return db[_0x3cdbb2['childModel']][_0xfc86('0x3f')](_0x5a723d)[_0xfc86('0x23')](function(_0x1751ac){var _0x50d07a=[];_0x1751ac[_0xfc86('0x5f')](function(_0x338a47){var _0x38baf7;switch(_0x338a47[_0xfc86('0x79')]){case _0xfc86('0x7a'):_0x38baf7=_['find'](_0x1b4b11['associatedResources'],function(_0x414aaa){return _0x414aaa['id']===_0x338a47[_0xfc86('0x7b')]&&_0x414aaa[_0xfc86('0x74')]==='DefaultReports';});break;case'custom':_0x38baf7=_[_0xfc86('0x42')](_0x1b4b11[_0xfc86('0x77')],function(_0x451630){return _0x451630['id']===_0x338a47[_0xfc86('0x7b')]&&_0x451630[_0xfc86('0x74')]==='CustomReports';});break;}if(_0x38baf7)_0x50d07a[_0xfc86('0x5d')](_0x338a47);});_0x332444[_0xfc86('0x1f')]=_0x50d07a['length'];_0x332444[_0xfc86('0x7c')]=_0x50d07a;return _0x332444;});}else{return db[_0x3cdbb2[_0xfc86('0x72')]][_0xfc86('0x1f')]({'where':_0x5a723d[_0xfc86('0x3a')]})[_0xfc86('0x23')](function(_0x415601){_0x332444[_0xfc86('0x1f')]=_0x415601;if(_0x5999de[_0xfc86('0x2d')]['includeAll']){if(_0x3cdbb2[_0xfc86('0x72')]==='CmContact'){_0x5a723d[_0xfc86('0x3e')]=[{'model':db[_0xfc86('0x7d')],'as':_0xfc86('0x7e'),'attributes':['id',_0xfc86('0x2c'),_0xfc86('0x7f')],'required':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?!![]:![]},{'model':db[_0xfc86('0x7d')],'as':_0xfc86('0x81'),'attributes':['id','name',_0xfc86('0x7f')],'through':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?{'attributes':[],'where':{'TagId':_0x5999de[_0xfc86('0x2d')]['tag']||undefined}}:{},'required':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?!![]:![]}];}else{_0x5a723d[_0xfc86('0x3e')]=[{'all':!![]}];}}return db[_0x3cdbb2[_0xfc86('0x72')]]['findAll'](_0x5a723d);})[_0xfc86('0x23')](function(_0x26352a){_0x332444[_0xfc86('0x7c')]=_0x26352a;return _0x332444;});}}else{return _0x332444;}})['then'](respondWithFilteredResult(_0xfa1a08,_0x5a723d))[_0xfc86('0x43')](handleError(_0xfa1a08,null));};function getAllResources(_0x325d0c,_0x55a15c){return new BPromise(function(_0xd647cb,_0x29dc1c){if(_0x55a15c){var _0x2c3708=_0x55a15c[_0xfc86('0x39')]?{[_0x55a15c['filter'][_0xfc86('0x76')]]:_0x55a15c[_0xfc86('0x39')][_0xfc86('0x82')]}:undefined;return db[_0x325d0c]['findAll']({'where':_0x2c3708,'raw':!![]})['then'](function(_0xd409bc){_0x55a15c['associatedResources']=_[_0xfc86('0x2b')](_0xd409bc,'id');_0xd647cb(_0x55a15c);})[_0xfc86('0x43')](function(_0x3a8d02){_0x29dc1c(_0x3a8d02);});}else{_0xd647cb(null);}});}function getAllFilteredResources(_0x1df586,_0x4d5f53){return new BPromise(function(_0x3f3fe0,_0xb2983b){var _0x26cea8=_0x1df586[_0xfc86('0x39')]?{[_0x1df586['filter'][_0xfc86('0x76')]]:_0x1df586[_0xfc86('0x39')][_0xfc86('0x82')]}:undefined;return db[_0x1df586[_0xfc86('0x2a')]][_0xfc86('0x3f')]({'where':_0x26cea8,'raw':!![]})[_0xfc86('0x23')](function(_0x3e8a10){_0x4d5f53[_0xfc86('0x77')]=_[_0xfc86('0x2b')](_0x3e8a10,function(_0x34b84f){return _0x34b84f[_0xfc86('0x2c')];});_0x3f3fe0(_0x4d5f53);})['catch'](function(_0x57b607){_0xb2983b(_0x57b607);});});}function getAllowedResources(_0x153b7d,_0x3d0399,_0x18a618){return new BPromise(function(_0x1eea63,_0x159405){if(_0x3d0399){return db[_0xfc86('0x52')]['findAll']({'where':{'sectionId':_0x3d0399['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x44d6ff){if(_0x153b7d[_0xfc86('0x76')]&&_0x153b7d[_0xfc86('0x76')]!=='id'){_0x3d0399[_0xfc86('0x77')]=_['map'](_0x44d6ff,function(_0x796a48){return _0x796a48[_0x153b7d[_0xfc86('0x76')]];});}else{if(_0x18a618==='AnalyticExtractedReport'){_0x3d0399['associatedResources']=_[_0xfc86('0x2b')](_0x44d6ff,function(_0x996da8){return{'id':_0x996da8[_0xfc86('0x60')],'type':_0x996da8[_0xfc86('0x74')]};});}else{_0x3d0399['associatedResources']=_[_0xfc86('0x2b')](_0x44d6ff,function(_0x56c7bc){return _0x56c7bc[_0xfc86('0x60')];});}}_0x1eea63(_0x3d0399);})[_0xfc86('0x43')](function(_0x2cc39b){_0x159405(_0x2cc39b);});}else{_0x1eea63(null);}});}function getQueryModels(_0x1312fd,_0x4f79e1){var _0x4a5b51=_0x1312fd[_0xfc86('0x83')]();var _0x1fd847={'childModel':undefined,'parentSections':[]};switch(_0x4a5b51){case _0xfc86('0x84'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x85');break;case _0xfc86('0x86'):_0x1fd847[_0xfc86('0x72')]='SquareOdbc';break;case _0xfc86('0x87'):_0x1fd847[_0xfc86('0x72')]='SquareRecording';_0x1fd847['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0xfc86('0x88')}];break;case'projects':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x89');break;case _0xfc86('0x8a'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x8b');_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0x8c'),'field':'id','foreignKey':_0xfc86('0x8d')}];break;case _0xfc86('0x8e'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x8f');break;case _0xfc86('0x90'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x91');break;case'globalcustomfields':_0x1fd847['childModel']=_0xfc86('0x92');break;case'chatqueues':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x93');break;case _0xfc86('0x94'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x95');break;case _0xfc86('0x96'):_0x1fd847[_0xfc86('0x72')]='FaxQueue';break;case _0xfc86('0x97'):_0x1fd847['childModel']='FaxAccount';break;case'inboundroutes':case _0xfc86('0x98'):case'outboundroutes':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x99');break;case _0xfc86('0x9a'):_0x1fd847['childModel']=_0xfc86('0x9b');break;case'voicemails':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x9c');break;case'voicerecordings':_0x1fd847['childModel']=_0xfc86('0x9d');_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0x9e'),'field':'name','foreignKey':'membername','model':_0xfc86('0x9f'),'filter':{'field':_0xfc86('0xa0'),'value':['agent']}},{'name':_0xfc86('0xa1'),'field':_0xfc86('0x2c'),'foreignKey':_0xfc86('0xa2'),'model':'User','filter':{'field':_0xfc86('0xa0'),'value':[_0xfc86('0xa3')]}},{'name':_0xfc86('0xa4'),'field':'name','foreignKey':_0xfc86('0xa5'),'model':_0xfc86('0xa6'),'filter':{'field':_0xfc86('0x74'),'value':[_0xfc86('0xa7')]}},{'name':_0xfc86('0xa8'),'field':_0xfc86('0x2c'),'foreignKey':_0xfc86('0xa5'),'model':'VoiceQueue','filter':{'field':_0xfc86('0x74'),'value':[_0xfc86('0xa9')]}}];break;case'musiconholds':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xaa');break;case _0xfc86('0xab'):_0x1fd847['childModel']=_0xfc86('0xac');break;case _0xfc86('0xad'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xae');break;case _0xfc86('0xaf'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb0');break;case _0xfc86('0xb1'):_0x1fd847['childModel']=_0xfc86('0xb2');break;case'mailaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb3');break;case _0xfc86('0xb4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb5');break;case _0xfc86('0xb6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb7');break;case _0xfc86('0xb8'):_0x1fd847[_0xfc86('0x72')]='OpenchannelAccount';break;case'smsqueues':_0x1fd847['childModel']=_0xfc86('0xb9');break;case _0xfc86('0xba'):_0x1fd847['childModel']=_0xfc86('0xbb');break;case _0xfc86('0xbc'):_0x1fd847[_0xfc86('0x72')]='WhatsappQueue';break;case'whatsappaccounts':_0x1fd847[_0xfc86('0x72')]='WhatsappAccount';break;case _0xfc86('0xbd'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xbe');break;case _0xfc86('0xbf'):case'queuecampaigns':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xa6');if(_0x4f79e1){_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0xa4')},{'name':_0xfc86('0xa8')}];}break;case _0xfc86('0xc0'):case _0xfc86('0xc1'):case'telephones':_0x1fd847['childModel']=_0xfc86('0x9f');if(_0x4f79e1){_0x1fd847[_0xfc86('0x6e')]=[{'name':'Users','filter':{'field':_0xfc86('0xa0'),'value':[_0xfc86('0xc2'),_0xfc86('0xc3')]},'ignore':!![]},{'name':_0xfc86('0x9e')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc4');break;case _0xfc86('0xc5'):_0x1fd847[_0xfc86('0x72')]='SalesforceAccount';break;case _0xfc86('0xc6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc7');break;case'sugarcrmaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc8');break;case _0xfc86('0xc9'):_0x1fd847[_0xfc86('0x72')]='DeskAccount';break;case _0xfc86('0xca'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xcb');break;case _0xfc86('0xcc'):_0x1fd847['childModel']=_0xfc86('0x9f');break;case'cannedanswers':_0x1fd847['childModel']=_0xfc86('0xcd');break;case _0xfc86('0xce'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xcf');break;case _0xfc86('0xd0'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd1');break;case _0xfc86('0xd2'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd3');break;case _0xfc86('0xd4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd5');break;case _0xfc86('0xd6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd7');break;case _0xfc86('0xd8'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd9');break;case _0xfc86('0xda'):_0x1fd847[_0xfc86('0x72')]='Tag';break;case _0xfc86('0xdb'):_0x1fd847[_0xfc86('0x72')]='Template';break;case _0xfc86('0xdc'):_0x1fd847[_0xfc86('0x72')]='Trigger';break;case'trunks':_0x1fd847[_0xfc86('0x72')]='Trunk';break;case _0xfc86('0xdd'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xde');break;case _0xfc86('0xdf'):_0x1fd847['childModel']=_0xfc86('0x61');break;case _0xfc86('0xe0'):_0x1fd847['childModel']=_0xfc86('0xe1');_0x1fd847['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xfc86('0x7b')}];break;case _0xfc86('0xe2'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xe3');break;case _0xfc86('0xe4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xe5');break;default:return _0x1fd847;}return _0x1fd847;}
\ No newline at end of file
+var _0xf3f9=['CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','telephone','queue','VoiceQueue','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','agents','Users','admin','user','Telephones','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','show','includeAll','options','find','catch','create','body','clone','params','get','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','union','ignore','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','custom','CustomReports','CmContact','Tags','color','tag','Tag','ThroughTags','value','squareprojects','squarerecordings','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists'];(function(_0x494537,_0x2a5423){var _0xaa2428=function(_0x5c1815){while(--_0x5c1815){_0x494537['push'](_0x494537['shift']());}};_0xaa2428(++_0x2a5423);}(_0xf3f9,0x14a));var _0x9f3f=function(_0x36690d,_0xafa3ee){_0x36690d=_0x36690d-0x0;var _0x3ab597=_0xf3f9[_0x36690d];return _0x3ab597;};'use strict';var pdf=require(_0x9f3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9f3f('0x1'));var zipdir=require(_0x9f3f('0x2'));var jsonpatch=require(_0x9f3f('0x3'));var rp=require(_0x9f3f('0x4'));var moment=require(_0x9f3f('0x5'));var BPromise=require(_0x9f3f('0x6'));var Mustache=require(_0x9f3f('0x7'));var util=require(_0x9f3f('0x8'));var path=require('path');var sox=require(_0x9f3f('0x9'));var csv=require(_0x9f3f('0xa'));var ejs=require(_0x9f3f('0xb'));var fs=require('fs');var _=require(_0x9f3f('0xc'));var squel=require(_0x9f3f('0xd'));var crypto=require(_0x9f3f('0xe'));var jsforce=require(_0x9f3f('0xf'));var deskjs=require(_0x9f3f('0x10'));var toCsv=require(_0x9f3f('0xa'));var querystring=require(_0x9f3f('0x11'));var Papa=require('papaparse');var Redis=require(_0x9f3f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9f3f('0x13'));var as=require(_0x9f3f('0x14'));var hardwareService=require(_0x9f3f('0x15'));var logger=require('../../config/logger')(_0x9f3f('0x16'));var utils=require(_0x9f3f('0x17'));var config=require(_0x9f3f('0x18'));var licenseUtil=require(_0x9f3f('0x19'));var db=require(_0x9f3f('0x1a'))['db'];config[_0x9f3f('0x1b')]=_[_0x9f3f('0x1c')](config[_0x9f3f('0x1b')],{'host':_0x9f3f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f3f('0x1b')]));require(_0x9f3f('0x1e'))[_0x9f3f('0x1f')](socket);function respondWithStatusCode(_0x4d954a,_0xf2b523){_0xf2b523=_0xf2b523||0xcc;return function(_0x573af1){if(_0x573af1){return _0x4d954a[_0x9f3f('0x20')](_0xf2b523);}return _0x4d954a[_0x9f3f('0x21')](_0xf2b523)['end']();};}function respondWithResult(_0x3c025a,_0xf64c21){_0xf64c21=_0xf64c21||0xc8;return function(_0x5b3267){if(_0x5b3267){return _0x3c025a[_0x9f3f('0x21')](_0xf64c21)[_0x9f3f('0x22')](_0x5b3267);}};}function respondWithFilteredResult(_0x1f6403,_0x5037c8){return function(_0xa0e1f9){if(_0xa0e1f9){var _0xd650e1=_0xa0e1f9[_0x9f3f('0x23')],_0x2df28a=_0x5037c8[_0x9f3f('0x24')],_0x2b4fe4=_0x5037c8['offset']+_0x5037c8['limit'],_0x59df65;if(_0x2b4fe4>=_0xd650e1){_0x2b4fe4=_0xd650e1;_0x59df65=0xc8;}else{_0x59df65=0xce;}_0x1f6403[_0x9f3f('0x21')](_0x59df65);return _0x1f6403[_0x9f3f('0x25')]('Content-Range',_0x2df28a+'-'+_0x2b4fe4+'/'+_0xd650e1)[_0x9f3f('0x22')](_0xa0e1f9);}return null;};}function patchUpdates(_0x1d30b){return function(_0x2b2fe0){try{jsonpatch[_0x9f3f('0x26')](_0x2b2fe0,_0x1d30b,!![]);}catch(_0x5d297a){return BPromise[_0x9f3f('0x27')](_0x5d297a);}return _0x2b2fe0[_0x9f3f('0x28')]();};}function saveUpdates(_0x385a15,_0x2c0d42){return function(_0x2bd3f2){if(_0x2bd3f2){return _0x2bd3f2[_0x9f3f('0x29')](_0x385a15)[_0x9f3f('0x2a')](function(_0x5c9d64){return _0x5c9d64;});}return null;};}function removeEntity(_0x41b9df,_0x1af5bb){return function(_0xb26cc6){if(_0xb26cc6){return _0xb26cc6[_0x9f3f('0x2b')]()[_0x9f3f('0x2a')](function(){_0x41b9df[_0x9f3f('0x21')](0xcc)[_0x9f3f('0x2c')]();});}};}function handleEntityNotFound(_0x382b02,_0x24c4b5){return function(_0x5a8ca3){if(!_0x5a8ca3){_0x382b02[_0x9f3f('0x20')](0x194);}return _0x5a8ca3;};}function handleError(_0x4287d7,_0x3deb97){_0x3deb97=_0x3deb97||0x1f4;return function(_0x781e94){logger[_0x9f3f('0x2d')](_0x781e94['stack']);if(_0x781e94[_0x9f3f('0x2e')]){delete _0x781e94['name'];}_0x4287d7[_0x9f3f('0x21')](_0x3deb97)[_0x9f3f('0x2f')](_0x781e94);};}exports[_0x9f3f('0x30')]=function(_0x8b1ab0,_0x3d6c7){var _0x2bf879={},_0x5a6e12={},_0x5afec1={'count':0x0,'rows':[]};var _0x493ca9=_[_0x9f3f('0x31')](db[_0x9f3f('0x32')][_0x9f3f('0x33')],function(_0x160f87){return{'name':_0x160f87[_0x9f3f('0x34')],'type':_0x160f87[_0x9f3f('0x35')][_0x9f3f('0x36')]};});_0x5a6e12[_0x9f3f('0x37')]=_['map'](_0x493ca9,'name');_0x5a6e12['query']=_[_0x9f3f('0x38')](_0x8b1ab0['query']);_0x5a6e12['filters']=_[_0x9f3f('0x39')](_0x5a6e12['model'],_0x5a6e12[_0x9f3f('0x3a')]);_0x2bf879[_0x9f3f('0x3b')]=_[_0x9f3f('0x39')](_0x5a6e12[_0x9f3f('0x37')],qs[_0x9f3f('0x3c')](_0x8b1ab0[_0x9f3f('0x3a')][_0x9f3f('0x3c')]));_0x2bf879[_0x9f3f('0x3b')]=_0x2bf879[_0x9f3f('0x3b')][_0x9f3f('0x3d')]?_0x2bf879[_0x9f3f('0x3b')]:_0x5a6e12[_0x9f3f('0x37')];if(!_0x8b1ab0[_0x9f3f('0x3a')][_0x9f3f('0x3e')](_0x9f3f('0x3f'))){_0x2bf879[_0x9f3f('0x40')]=qs[_0x9f3f('0x40')](_0x8b1ab0[_0x9f3f('0x3a')][_0x9f3f('0x40')]);_0x2bf879[_0x9f3f('0x24')]=qs[_0x9f3f('0x24')](_0x8b1ab0[_0x9f3f('0x3a')][_0x9f3f('0x24')]);}_0x2bf879[_0x9f3f('0x41')]=qs[_0x9f3f('0x42')](_0x8b1ab0['query']['sort']);_0x2bf879[_0x9f3f('0x43')]=qs[_0x9f3f('0x44')](_[_0x9f3f('0x45')](_0x8b1ab0[_0x9f3f('0x3a')],_0x5a6e12[_0x9f3f('0x44')]),_0x493ca9);if(_0x8b1ab0[_0x9f3f('0x3a')][_0x9f3f('0x46')]){_0x2bf879[_0x9f3f('0x43')]=_[_0x9f3f('0x47')](_0x2bf879[_0x9f3f('0x43')],{'$or':_[_0x9f3f('0x31')](_0x493ca9,function(_0x370e96){if(_0x370e96[_0x9f3f('0x35')]!=='VIRTUAL'){var _0x3077c0={};_0x3077c0[_0x370e96[_0x9f3f('0x2e')]]={'$like':'%'+_0x8b1ab0[_0x9f3f('0x3a')]['filter']+'%'};return _0x3077c0;}})});}_0x2bf879=_[_0x9f3f('0x47')]({},_0x2bf879,_0x8b1ab0['options']);var _0x552ca2={'where':_0x2bf879[_0x9f3f('0x43')]};return db[_0x9f3f('0x32')][_0x9f3f('0x23')](_0x552ca2)[_0x9f3f('0x2a')](function(_0x57495c){_0x5afec1[_0x9f3f('0x23')]=_0x57495c;if(_0x8b1ab0[_0x9f3f('0x3a')]['includeAll']){_0x2bf879[_0x9f3f('0x48')]=[{'all':!![]}];}return db['UserProfile'][_0x9f3f('0x49')](_0x2bf879);})[_0x9f3f('0x2a')](function(_0x5083e3){_0x5afec1[_0x9f3f('0x4a')]=_0x5083e3;return _0x5afec1;})[_0x9f3f('0x2a')](respondWithFilteredResult(_0x3d6c7,_0x2bf879))['catch'](handleError(_0x3d6c7,null));};exports[_0x9f3f('0x4b')]=function(_0x2c3172,_0xfc46e1){var _0x58b207={'raw':![],'where':{'id':_0x2c3172['params']['id']}},_0x440c47={};_0x440c47[_0x9f3f('0x37')]=_['keys'](db[_0x9f3f('0x32')][_0x9f3f('0x33')]);_0x440c47[_0x9f3f('0x3a')]=_[_0x9f3f('0x38')](_0x2c3172[_0x9f3f('0x3a')]);_0x440c47['filters']=_['intersection'](_0x440c47[_0x9f3f('0x37')],_0x440c47['query']);_0x58b207[_0x9f3f('0x3b')]=_['intersection'](_0x440c47['model'],qs[_0x9f3f('0x3c')](_0x2c3172[_0x9f3f('0x3a')][_0x9f3f('0x3c')]));_0x58b207[_0x9f3f('0x3b')]=_0x58b207[_0x9f3f('0x3b')][_0x9f3f('0x3d')]?_0x58b207[_0x9f3f('0x3b')]:_0x440c47[_0x9f3f('0x37')];if(_0x2c3172[_0x9f3f('0x3a')][_0x9f3f('0x4c')]){_0x58b207[_0x9f3f('0x48')]=[{'all':!![]}];}_0x58b207=_[_0x9f3f('0x47')]({},_0x58b207,_0x2c3172[_0x9f3f('0x4d')]);return db[_0x9f3f('0x32')][_0x9f3f('0x4e')](_0x58b207)[_0x9f3f('0x2a')](handleEntityNotFound(_0xfc46e1,null))[_0x9f3f('0x2a')](respondWithResult(_0xfc46e1,null))[_0x9f3f('0x4f')](handleError(_0xfc46e1,null));};exports[_0x9f3f('0x50')]=function(_0x1c9630,_0x2e1497){return db[_0x9f3f('0x32')][_0x9f3f('0x50')](_0x1c9630[_0x9f3f('0x51')],{})[_0x9f3f('0x2a')](respondWithResult(_0x2e1497,0xc9))[_0x9f3f('0x4f')](handleError(_0x2e1497,null));};exports[_0x9f3f('0x52')]=function(_0x2410b6,_0xcf602c){var _0x37a0d8={'where':{'id':_0x2410b6[_0x9f3f('0x53')]['id']}},_0x5b0807={};_0x5b0807[_0x9f3f('0x37')]=_[_0x9f3f('0x38')](db['UserProfile'][_0x9f3f('0x33')]);_0x37a0d8['attributes']=_['intersection'](_0x5b0807[_0x9f3f('0x37')],qs[_0x9f3f('0x3c')](_0x2410b6[_0x9f3f('0x3a')]['fields']));_0x37a0d8[_0x9f3f('0x3b')]=_0x37a0d8[_0x9f3f('0x3b')]['length']?_0x37a0d8[_0x9f3f('0x3b')]:_0x5b0807[_0x9f3f('0x37')];if(_0x2410b6[_0x9f3f('0x3a')][_0x9f3f('0x4c')]){_0x37a0d8['include']=[{'all':!![]}];}_0x37a0d8=_[_0x9f3f('0x47')]({},_0x37a0d8,_0x2410b6[_0x9f3f('0x4d')]);return db['UserProfile']['find'](_0x37a0d8)[_0x9f3f('0x2a')](handleEntityNotFound(_0xcf602c,null))[_0x9f3f('0x2a')](function(_0x56e6b5){if(_0x56e6b5){var _0x508508=_0x56e6b5[_0x9f3f('0x54')]({'plain':!![]});_0x508508=qs['omit'](_0x508508,['id',_0x9f3f('0x55'),_0x9f3f('0x56'),_0x9f3f('0x57')]);_0x2410b6[_0x9f3f('0x51')]=_[_0x9f3f('0x58')](_0x2410b6[_0x9f3f('0x51')],['id',_0x9f3f('0x55'),_0x9f3f('0x56')]);return db[_0x9f3f('0x59')][_0x9f3f('0x5a')](function(_0x488095){return db[_0x9f3f('0x32')][_0x9f3f('0x50')](_[_0x9f3f('0x47')](_0x508508,_0x2410b6[_0x9f3f('0x51')]),{'include':_0x2410b6['query'][_0x9f3f('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x488095})[_0x9f3f('0x2a')](function(_0x1334dd){var _0x115e19=_0x1334dd[_0x9f3f('0x54')]({'plain':!![]});return db[_0x9f3f('0x5b')][_0x9f3f('0x49')]({'where':{'userProfileId':_0x2410b6[_0x9f3f('0x53')]['id']},'raw':!![]})['then'](function(_0x3cde8d){if(_0x3cde8d){return BPromise[_0x9f3f('0x5c')](_0x3cde8d,function(_0x1b9b81){return new BPromise(function(_0x3422b4,_0x295fbf){if(_0x1b9b81[_0x9f3f('0x5d')]===null||_0x1b9b81['autoAssociation']===0x1)_0x3422b4(null);return db[_0x9f3f('0x5e')]['findAll']({'where':{'sectionId':_0x1b9b81['id']},'raw':!![]})[_0x9f3f('0x2a')](function(_0x74254a){var _0x52bffe=_[_0x9f3f('0x31')](_0x74254a,function(_0x286729){return qs[_0x9f3f('0x58')](_0x286729,['id',_0x9f3f('0x55'),_0x9f3f('0x56'),_0x9f3f('0x5f')]);});_0x3422b4(_0x52bffe);})[_0x9f3f('0x4f')](function(_0x748122){_0x295fbf(_0x748122);});})[_0x9f3f('0x2a')](function(_0x35c537){var _0x3e8406=qs[_0x9f3f('0x58')](_0x1b9b81,['id',_0x9f3f('0x55'),_0x9f3f('0x56')]);_0x3e8406['userProfileId']=_0x115e19['id'];if(_0x35c537)_0x3e8406[_0x9f3f('0x60')]=_0x35c537;return _0x3e8406;})[_0x9f3f('0x2a')](function(_0x2777d6){return db[_0x9f3f('0x5b')][_0x9f3f('0x50')](_0x2777d6,{'include':[{'model':db[_0x9f3f('0x5e')],'as':_0x9f3f('0x60')}],'raw':!![],'transaction':_0x488095});});})[_0x9f3f('0x2a')](function(){return _0x115e19;});}});});});}})[_0x9f3f('0x2a')](respondWithResult(_0xcf602c,0xc9))[_0x9f3f('0x4f')](handleError(_0xcf602c,null));};exports[_0x9f3f('0x29')]=function(_0xe7f0e,_0x35e7ca){if(_0xe7f0e['body']['id']){delete _0xe7f0e['body']['id'];}return db['UserProfile'][_0x9f3f('0x4e')]({'where':{'id':_0xe7f0e[_0x9f3f('0x53')]['id']}})['then'](handleEntityNotFound(_0x35e7ca,null))[_0x9f3f('0x2a')](saveUpdates(_0xe7f0e[_0x9f3f('0x51')],null))[_0x9f3f('0x2a')](respondWithResult(_0x35e7ca,null))['catch'](handleError(_0x35e7ca,null));};exports[_0x9f3f('0x2b')]=function(_0x13a8a8,_0x4f1372){return db[_0x9f3f('0x32')][_0x9f3f('0x4e')]({'where':{'id':_0x13a8a8[_0x9f3f('0x53')]['id']}})[_0x9f3f('0x2a')](handleEntityNotFound(_0x4f1372,null))[_0x9f3f('0x2a')](removeEntity(_0x4f1372,null))[_0x9f3f('0x4f')](handleError(_0x4f1372,null));};exports[_0x9f3f('0x61')]=function(_0x39b0dc,_0x2cbb9d){return db[_0x9f3f('0x32')]['describe']()[_0x9f3f('0x2a')](respondWithResult(_0x2cbb9d,null))[_0x9f3f('0x4f')](handleError(_0x2cbb9d,null));};exports[_0x9f3f('0x62')]=function(_0x748a9c,_0x2a21ae){var _0x25e5fd=_0x748a9c[_0x9f3f('0x51')];return db[_0x9f3f('0x32')][_0x9f3f('0x4e')]({'where':{'id':_0x748a9c['params']['id']}})[_0x9f3f('0x2a')](handleEntityNotFound(_0x2a21ae,null))['then'](function(_0x3130f7){if(_0x3130f7){return db['sequelize'][_0x9f3f('0x5a')](function(_0x9b0423){return db[_0x9f3f('0x5b')][_0x9f3f('0x2b')]({'where':{'userProfileId':_0x748a9c[_0x9f3f('0x53')]['id'],'sectionId':_[_0x9f3f('0x31')](_0x25e5fd,function(_0x31dc57){return _0x31dc57[_0x9f3f('0x5f')];})},'transaction':_0x9b0423})[_0x9f3f('0x2a')](function(){var _0x3b25d0=_[_0x9f3f('0x31')](_0x25e5fd,function(_0x259fec){_0x259fec[_0x9f3f('0x63')]=_0x748a9c[_0x9f3f('0x53')]['id'];return _0x259fec;});var _0x4205de=[];return BPromise[_0x9f3f('0x5c')](_0x3b25d0,function(_0x317532){return db[_0x9f3f('0x5b')][_0x9f3f('0x50')](_0x317532,{'include':[{'model':db[_0x9f3f('0x5e')],'as':_0x9f3f('0x60')}],'raw':!![],'transaction':_0x9b0423})['then'](function(_0x59a78e){_0x4205de[_0x9f3f('0x64')](_0x59a78e['get']({'plain':!![]}));});})[_0x9f3f('0x2a')](function(){return _0x4205de;});});});}})[_0x9f3f('0x2a')](function(_0x20df16){return _0x20df16;})[_0x9f3f('0x2a')](respondWithResult(_0x2a21ae,null))['catch'](handleError(_0x2a21ae,null));};exports[_0x9f3f('0x65')]=function(_0x580f6d,_0x3b8f0e){var _0x11ad25;return db[_0x9f3f('0x32')][_0x9f3f('0x4e')]({'where':{'id':_0x580f6d['params']['id']},'attributes':['id',_0x9f3f('0x2e')]})[_0x9f3f('0x2a')](handleEntityNotFound(_0x3b8f0e,null))['then'](function(_0x4cc19d){if(_0x4cc19d){_0x11ad25=_0x4cc19d;return db[_0x9f3f('0x5b')][_0x9f3f('0x2b')]({'where':{'userProfileId':_0x580f6d['params']['id'],'sectionId':_0x580f6d[_0x9f3f('0x3a')][_0x9f3f('0x66')]}});}})[_0x9f3f('0x2a')](function(){return _0x11ad25;})[_0x9f3f('0x2a')](respondWithStatusCode(_0x3b8f0e,null))[_0x9f3f('0x4f')](handleError(_0x3b8f0e,null));};exports[_0x9f3f('0x67')]=function(_0x19b28d,_0x58caab){var _0xab80e8=[];var _0x134cdf=[];return db[_0x9f3f('0x5b')][_0x9f3f('0x49')]({'where':{'userProfileId':_0x19b28d['params']['id']},'raw':!![]})[_0x9f3f('0x2a')](function(_0x33d761){_0xab80e8=_[_0x9f3f('0x46')](_0x33d761,function(_0x2f5ae9){return _0x2f5ae9[_0x9f3f('0x68')]===0x1||_['includes']([0x3eb,0x709],_0x2f5ae9[_0x9f3f('0x5f')]);});if(!_[_0x9f3f('0x69')](_0xab80e8)){return _['map'](_0xab80e8,function(_0x2eedcb){return _0x2eedcb[_0x9f3f('0x5f')];});}else{return;}})[_0x9f3f('0x2a')](function(_0x350bd3){if(_0x350bd3)_0x134cdf=_0x350bd3;if(_['includes'](_0x134cdf,0x64)){var _0x4b121f=_[_0x9f3f('0x4e')](_0xab80e8,{'sectionId':0x64});return hasDefaultDashboard(_0x4b121f)[_0x9f3f('0x2a')](function(_0xadf852){return _[_0x9f3f('0x31')](_0xab80e8,function(_0x5c0bd8){if(_0x5c0bd8[_0x9f3f('0x5f')]===0x64){_0x5c0bd8['subsections']=_0xadf852;}return _0x5c0bd8;});});}else{return;}})[_0x9f3f('0x2a')](function(_0x251a90){if(_0x251a90)_0xab80e8=_0x251a90;if(_[_0x9f3f('0x6a')](_0x134cdf,0x3eb)){var _0x3d4eb9=_['find'](_0xab80e8,{'sectionId':0x3eb});return getCustomDashboards(_0x3d4eb9)[_0x9f3f('0x2a')](function(_0x3f6664){return _['map'](_0xab80e8,function(_0x5736e2){if(_0x3d4eb9[_0x9f3f('0x68')]){if(_0x5736e2[_0x9f3f('0x5f')]===0x3eb){_0x5736e2[_0x9f3f('0x6b')]=_0x3f6664;}}else{if(_0x5736e2['sectionId']===0x64){_0x5736e2[_0x9f3f('0x6b')]=_0x3f6664;}}return _0x5736e2;});});}else{return;}})[_0x9f3f('0x2a')](function(_0x411b05){if(_0x411b05)_0xab80e8=_0x411b05;if(_[_0x9f3f('0x6a')](_0x134cdf,0x709)){var _0x294a05=_['find'](_0xab80e8,{'sectionId':0x709});return getPlugins(_0x294a05)[_0x9f3f('0x2a')](function(_0x2ec8bb){if(_0x294a05[_0x9f3f('0x68')]){return _[_0x9f3f('0x31')](_0xab80e8,function(_0x47d873){if(_0x47d873['sectionId']===0x709){_0x47d873[_0x9f3f('0x6b')]=_0x2ec8bb;}return _0x47d873;});}else{var _0x595345={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ec8bb};var _0x51d9ec=_[_0x9f3f('0x31')](_0xab80e8);_0x51d9ec[_0x9f3f('0x64')](_0x595345);return _0x51d9ec;}});}else{return;}})[_0x9f3f('0x2a')](function(_0x521902){if(_0x521902)_0xab80e8=_0x521902;return _[_0x9f3f('0x46')](_0xab80e8,[_0x9f3f('0x68'),0x1]);})['then'](respondWithResult(_0x58caab,null))[_0x9f3f('0x4f')](handleError(_0x58caab,null));};function hasDefaultDashboard(_0x139c7b){var _0x12f600=[0x65];return new BPromise(function(_0x3ee497,_0xb09156){try{if(_0x139c7b['autoAssociation']){_0x3ee497(_0x12f600);}else{return db[_0x9f3f('0x5e')][_0x9f3f('0x6c')]({'where':{'sectionId':_0x139c7b['id']},'raw':!![]})[_0x9f3f('0x2a')](function(_0x1f9f91){_0x1f9f91?_0x3ee497(_0x12f600):_0x3ee497();});}}catch(_0x49135a){_0xb09156(_0x49135a);}});}function getCustomDashboards(_0x1e3717){var _0x31a782=[];return new BPromise(function(_0xfe3ec7,_0x55c086){try{if(_0x1e3717[_0x9f3f('0x5d')]){return db[_0x9f3f('0x6d')]['findAll']({'raw':!![]})[_0x9f3f('0x2a')](function(_0x5ab081){_0x5ab081[_0x9f3f('0x6e')](function(_0xbe99e5){_0x31a782[_0x9f3f('0x64')](_0xbe99e5['id']+0x1869f);});_0xfe3ec7(_0x31a782);});}else{return db[_0x9f3f('0x5e')][_0x9f3f('0x49')]({'where':{'sectionId':_0x1e3717['id']},'raw':!![]})['then'](function(_0x51ce12){_0x51ce12['forEach'](function(_0x4ab653){_0x31a782[_0x9f3f('0x64')](_0x4ab653[_0x9f3f('0x6f')]+0x1869f);});_0xfe3ec7(_0x31a782);});}}catch(_0x5457a0){_0x55c086(_0x5457a0);}});}function getPlugins(_0x46292a){var _0x3222d4=[];return new BPromise(function(_0x517bc9,_0x4c86cf){try{if(_0x46292a[_0x9f3f('0x5d')]){return db[_0x9f3f('0x70')]['findAll']({'raw':!![]})[_0x9f3f('0x2a')](function(_0x56746b){_0x56746b['forEach'](function(_0x2d28c2){_0x3222d4[_0x9f3f('0x64')](_0x2d28c2['id']+0x15b38);});_0x517bc9(_0x3222d4);});}else{return db['UserProfileResource'][_0x9f3f('0x49')]({'where':{'sectionId':_0x46292a['id']},'raw':!![]})[_0x9f3f('0x2a')](function(_0x4efbcb){_0x4efbcb[_0x9f3f('0x6e')](function(_0x25b481){_0x3222d4['push'](_0x25b481[_0x9f3f('0x6f')]+0x15b38);});_0x517bc9(_0x3222d4);});}}catch(_0xfc251d){_0x4c86cf(_0xfc251d);}});}exports['addResources']=function(_0x1fea05,_0x2915e1){return db[_0x9f3f('0x32')][_0x9f3f('0x4e')]({'where':{'id':_0x1fea05[_0x9f3f('0x53')]['id']}})[_0x9f3f('0x2a')](handleEntityNotFound(_0x2915e1,null))[_0x9f3f('0x2a')](function(_0x209514){if(_0x209514){return db[_0x9f3f('0x59')][_0x9f3f('0x5a')](function(_0x2d6f43){return db[_0x9f3f('0x5b')]['findAll']({'where':{'userProfileId':_0x1fea05[_0x9f3f('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0x9f3f('0x2a')](function(_0x8ba9d4){if(_0x8ba9d4){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x1fea05[_0x9f3f('0x53')]['id'],'id':_[_0x9f3f('0x31')](_0x8ba9d4,function(_0x4d4f62){return _0x4d4f62['id'];})},'transaction':_0x2d6f43});}})[_0x9f3f('0x2a')](function(_0x4fafce){var _0x1052df=_[_0x9f3f('0x31')](_0x1fea05[_0x9f3f('0x51')],function(_0x285d49){_0x285d49[_0x9f3f('0x63')]=_0x1fea05[_0x9f3f('0x53')]['id'];return _0x285d49;});return db['UserProfileSection']['bulkCreate'](_0x1052df,{'raw':!![],'transaction':_0x2d6f43});})[_0x9f3f('0x2a')](function(_0x4c8401){var _0x19fde8=_[_0x9f3f('0x46')](_[_0x9f3f('0x31')](_0x4c8401,function(_0x1ca459){return _0x1ca459[_0x9f3f('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x19fde8){return db['UserProfileSection'][_0x9f3f('0x49')]({'where':{'userProfileId':_0x1fea05[_0x9f3f('0x53')]['id'],'sectionId':_['map'](_0x19fde8,function(_0x482aa1){return _0x482aa1[_0x9f3f('0x5f')];})},'attributes':['id',_0x9f3f('0x5f')],'raw':!![]})['then'](function(_0x2d4ee5){var _0x418c6a=_['map'](_0x1fea05[_0x9f3f('0x51')],function(_0x5cc38b){_0x5cc38b[_0x9f3f('0x63')]=_0x1fea05['params']['id'];return _0x5cc38b;});return db['UserProfileResource']['bulkCreate'](_0x418c6a,{'raw':!![],'transaction':_0x2d6f43});});}})[_0x9f3f('0x4f')](handleError(_0x2915e1,null));});}})[_0x9f3f('0x2a')](function(_0x277ad6){var _0x308c77=_[_0x9f3f('0x31')](_0x277ad6,function(_0x3bfc43){return _0x3bfc43[_0x9f3f('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x2915e1,null))[_0x9f3f('0x4f')](handleError(_0x2915e1,null));};exports[_0x9f3f('0x71')]=function(_0x20fc0f,_0x2ccea6,_0x10e19c){return db[_0x9f3f('0x32')][_0x9f3f('0x4e')]({'where':{'id':_0x20fc0f[_0x9f3f('0x53')]['id']}})[_0x9f3f('0x2a')](handleEntityNotFound(_0x2ccea6,null))[_0x9f3f('0x2a')](function(_0x324f03){if(_0x324f03){return _0x324f03['removeResources'](_0x20fc0f[_0x9f3f('0x3a')]['ids']);}})[_0x9f3f('0x2a')](respondWithStatusCode(_0x2ccea6,null))[_0x9f3f('0x4f')](handleError(_0x2ccea6,null));};exports[_0x9f3f('0x72')]=function(_0x5eb152,_0x3264ce){var _0x7b0bf3={'raw':![],'where':{}};var _0x323ed5={};var _0x490232={'count':0x0,'rows':[]};var _0x13c18d=_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x73')];if(typeof _0x13c18d===_0x9f3f('0x74')){throw new db[(_0x9f3f('0x75'))]['ValidationError'](_0x9f3f('0x76'));}var _0x5c99fd=_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x77')]||![];var _0x461e37=getQueryModels(_0x13c18d,_0x5c99fd);if(typeof _0x461e37[_0x9f3f('0x78')]===_0x9f3f('0x74')){throw new db[(_0x9f3f('0x75'))]['ValidationError'](_0x9f3f('0x79')+_0x13c18d+'\x27');}var _0x49bfe7=[];if(!_['isEmpty'](_0x461e37[_0x9f3f('0x7a')])){_0x49bfe7=_0x461e37['parentSections'];}else{_0x49bfe7=[{'name':_0x13c18d}];}return db[_0x9f3f('0x32')]['findOne']({'where':{'id':_0x5eb152[_0x9f3f('0x53')]['id']}})['then'](handleEntityNotFound(_0x3264ce,null))[_0x9f3f('0x2a')](function(_0x343e47){if(_0x343e47){var _0x28dc2e=[];for(var _0x245397=0x0;_0x245397<_0x49bfe7[_0x9f3f('0x3d')];_0x245397++){_0x28dc2e[_0x9f3f('0x64')](db['UserProfileSection']['findOne']({'where':{'userProfileId':_0x343e47['id'],'name':_0x49bfe7[_0x245397][_0x9f3f('0x2e')]},'raw':!![]}));}return BPromise[_0x9f3f('0x7b')](_0x28dc2e);}})[_0x9f3f('0x2a')](function(_0x52bbec){var _0xd3d80e=_[_0x9f3f('0x46')](_0x52bbec,function(_0x2bec32){return _0x2bec32?_0x2bec32:undefined;});var _0x4eba39=_[_0x9f3f('0x46')](_0x49bfe7,['ignore',!![]]);var _0x2d6c2d=_[_0x9f3f('0x69')](_0xd3d80e)&&_[_0x9f3f('0x69')](_0x4eba39)?null:_[_0x9f3f('0x7c')](_0x4eba39,_0xd3d80e);if(_0x2d6c2d){var _0x179348=[];for(var _0x55771c=0x0;_0x55771c<_0x2d6c2d['length'];_0x55771c++){var _0x3b0dd1=_[_0x9f3f('0x4e')](_0x49bfe7,function(_0xc05e5f){return _0x2d6c2d[_0x55771c]?_0xc05e5f['name']===_0x2d6c2d[_0x55771c][_0x9f3f('0x2e')]:null;});if(_0x3b0dd1){if(_0x2d6c2d[_0x55771c][_0x9f3f('0x7d')]){_0x179348[_0x9f3f('0x64')](getAllResources(_0x461e37[_0x9f3f('0x78')],_0x2d6c2d[_0x55771c]));}else{if(!_0x2d6c2d[_0x55771c][_0x9f3f('0x5d')]){_0x179348[_0x9f3f('0x64')](getAllowedResources(_0x3b0dd1,_0x2d6c2d[_0x55771c],_0x461e37['childModel']));}else{if(_0x3b0dd1[_0x9f3f('0x37')]){_0x179348[_0x9f3f('0x64')](getAllFilteredResources(_0x3b0dd1,_0x2d6c2d[_0x55771c]));}}}}}return BPromise['all'](_0x179348);}else{return null;}})[_0x9f3f('0x2a')](function(_0x32ae27){var _0x1700e2=_0x32ae27;var _0xa93a4b=null;if(_0x1700e2){_0xa93a4b=_0x1700e2[_0x9f3f('0x3d')]===0x1?_0x1700e2[0x0]:null;}if(_0xa93a4b||_0x1700e2){var _0x477742=db[_0x461e37[_0x9f3f('0x78')]][_0x9f3f('0x33')];_0x323ed5[_0x9f3f('0x37')]=_[_0x9f3f('0x38')](_0x477742);_0x323ed5[_0x9f3f('0x3a')]=_[_0x9f3f('0x38')](_0x5eb152[_0x9f3f('0x3a')]);_0x323ed5['filters']=_['intersection'](_0x323ed5[_0x9f3f('0x37')],_0x323ed5['query']);_0x7b0bf3[_0x9f3f('0x3b')]=_[_0x9f3f('0x39')](_0x323ed5['model'],qs[_0x9f3f('0x3c')](_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x3c')]));_0x7b0bf3[_0x9f3f('0x3b')]=_0x7b0bf3[_0x9f3f('0x3b')][_0x9f3f('0x3d')]?_0x7b0bf3[_0x9f3f('0x3b')]:_0x323ed5[_0x9f3f('0x37')];if(!_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x3e')]('nolimit')){_0x7b0bf3[_0x9f3f('0x40')]=qs[_0x9f3f('0x40')](_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x40')]);_0x7b0bf3[_0x9f3f('0x24')]=qs[_0x9f3f('0x24')](_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x24')]);}_0x7b0bf3['order']=qs[_0x9f3f('0x42')](_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x42')]);_0x7b0bf3[_0x9f3f('0x43')]=qs['filters'](_['pick'](_0x5eb152[_0x9f3f('0x3a')],_0x323ed5[_0x9f3f('0x44')]));if(_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x46')]){_0x7b0bf3[_0x9f3f('0x43')]=_[_0x9f3f('0x47')](_0x7b0bf3['where'],{'$or':_[_0x9f3f('0x31')](_0x477742,function(_0x260dfe){if(_0x260dfe[_0x9f3f('0x35')]['key']!=='VIRTUAL'){var _0x59ad5a={};_0x59ad5a[_0x260dfe['field']]={'$like':'%'+_0x5eb152[_0x9f3f('0x3a')][_0x9f3f('0x46')]+'%'};return _0x59ad5a;}})});}var _0x1b281d=[];if(_0xa93a4b){var _0x4da833=_['find'](_0x49bfe7,[_0x9f3f('0x2e'),_0xa93a4b[_0x9f3f('0x2e')]]);if(_0x4da833[_0x9f3f('0x7e')]){var _0x4e81d8={};if(_0x461e37['childModel']===_0x9f3f('0x7f')){_0x4e81d8[_0x4da833[_0x9f3f('0x80')]]=_[_0x9f3f('0x31')](_0xa93a4b['associatedResources'],'id');}else{_0x4e81d8[_0x4da833[_0x9f3f('0x80')]]=_0xa93a4b[_0x9f3f('0x81')];}_0x1b281d[_0x9f3f('0x64')](_0x4e81d8);}else{_0x7b0bf3[_0x9f3f('0x43')]['id']=_0xa93a4b[_0x9f3f('0x81')];}}else{for(var _0x4a6482=0x0;_0x4a6482<_0x1700e2[_0x9f3f('0x3d')];_0x4a6482++){var _0x4da833=_['find'](_0x49bfe7,[_0x9f3f('0x2e'),_0x1700e2[_0x4a6482]['name']]);if(_0x4da833[_0x9f3f('0x7e')]){var _0x4e81d8={};_0x4e81d8[_0x4da833[_0x9f3f('0x80')]]=_0x1700e2[_0x4a6482][_0x9f3f('0x81')];_0x1b281d[_0x9f3f('0x64')](_0x4e81d8);}else{if(!_0x7b0bf3['where']['id'])_0x7b0bf3[_0x9f3f('0x43')]['id']=[];_0x1700e2[_0x4a6482][_0x9f3f('0x81')]['forEach'](function(_0x1c264d){_0x7b0bf3[_0x9f3f('0x43')]['id'][_0x9f3f('0x64')](_0x1c264d);});}}}if(!_[_0x9f3f('0x69')](_0x1b281d)){_0x7b0bf3['where']=_['merge'](_0x7b0bf3[_0x9f3f('0x43')],{'$and':{'$or':_0x1b281d}});}_0x7b0bf3=_['merge']({},_0x7b0bf3,_0x5eb152['options']);if(_0xa93a4b&&!_0xa93a4b[_0x9f3f('0x5d')]&&_0x461e37['childModel']===_0x9f3f('0x7f')){if(_0x5eb152[_0x9f3f('0x3a')]['includeAll']){_0x7b0bf3[_0x9f3f('0x48')]=[{'all':!![]}];}return db[_0x461e37['childModel']][_0x9f3f('0x49')](_0x7b0bf3)[_0x9f3f('0x2a')](function(_0x215530){var _0x4fc977=[];_0x215530[_0x9f3f('0x6e')](function(_0x34f026){var _0x5ee304;switch(_0x34f026[_0x9f3f('0x82')]){case'default':_0x5ee304=_['find'](_0xa93a4b[_0x9f3f('0x81')],function(_0xae7872){return _0xae7872['id']===_0x34f026[_0x9f3f('0x83')]&&_0xae7872[_0x9f3f('0x35')]==='DefaultReports';});break;case _0x9f3f('0x84'):_0x5ee304=_['find'](_0xa93a4b[_0x9f3f('0x81')],function(_0x4eff98){return _0x4eff98['id']===_0x34f026[_0x9f3f('0x83')]&&_0x4eff98[_0x9f3f('0x35')]===_0x9f3f('0x85');});break;}if(_0x5ee304)_0x4fc977[_0x9f3f('0x64')](_0x34f026);});_0x490232['count']=_0x4fc977['length'];_0x490232['rows']=_0x4fc977;return _0x490232;});}else{return db[_0x461e37[_0x9f3f('0x78')]][_0x9f3f('0x23')]({'where':_0x7b0bf3[_0x9f3f('0x43')]})[_0x9f3f('0x2a')](function(_0x5dc745){_0x490232['count']=_0x5dc745;if(_0x5eb152['query'][_0x9f3f('0x4c')]){if(_0x461e37['childModel']===_0x9f3f('0x86')){_0x7b0bf3[_0x9f3f('0x48')]=[{'model':db['Tag'],'as':_0x9f3f('0x87'),'attributes':['id',_0x9f3f('0x2e'),_0x9f3f('0x88')],'required':_0x5eb152['query'][_0x9f3f('0x89')]?!![]:![]},{'model':db[_0x9f3f('0x8a')],'as':_0x9f3f('0x8b'),'attributes':['id',_0x9f3f('0x2e'),_0x9f3f('0x88')],'through':_0x5eb152['query']['tag']?{'attributes':[],'where':{'TagId':_0x5eb152['query'][_0x9f3f('0x89')]||undefined}}:{},'required':_0x5eb152[_0x9f3f('0x3a')]['tag']?!![]:![]}];}else{_0x7b0bf3[_0x9f3f('0x48')]=[{'all':!![]}];}}return db[_0x461e37[_0x9f3f('0x78')]][_0x9f3f('0x49')](_0x7b0bf3);})[_0x9f3f('0x2a')](function(_0x332990){_0x490232['rows']=_0x332990;return _0x490232;});}}else{return _0x490232;}})['then'](respondWithFilteredResult(_0x3264ce,_0x7b0bf3))[_0x9f3f('0x4f')](handleError(_0x3264ce,null));};function getAllResources(_0x260f66,_0x4c8d97){return new BPromise(function(_0x4cf35f,_0x419dff){if(_0x4c8d97){var _0x4a9ad5=_0x4c8d97[_0x9f3f('0x46')]?{[_0x4c8d97[_0x9f3f('0x46')][_0x9f3f('0x7e')]]:_0x4c8d97[_0x9f3f('0x46')][_0x9f3f('0x8c')]}:undefined;return db[_0x260f66][_0x9f3f('0x49')]({'where':_0x4a9ad5,'raw':!![]})[_0x9f3f('0x2a')](function(_0x48c352){_0x4c8d97[_0x9f3f('0x81')]=_[_0x9f3f('0x31')](_0x48c352,'id');_0x4cf35f(_0x4c8d97);})[_0x9f3f('0x4f')](function(_0x52b0bc){_0x419dff(_0x52b0bc);});}else{_0x4cf35f(null);}});}function getAllFilteredResources(_0x27b48d,_0x38ad12){return new BPromise(function(_0x378a64,_0x48ca1b){var _0x1bd7f8=_0x27b48d[_0x9f3f('0x46')]?{[_0x27b48d[_0x9f3f('0x46')][_0x9f3f('0x7e')]]:_0x27b48d[_0x9f3f('0x46')]['value']}:undefined;return db[_0x27b48d[_0x9f3f('0x37')]][_0x9f3f('0x49')]({'where':_0x1bd7f8,'raw':!![]})[_0x9f3f('0x2a')](function(_0x19f420){_0x38ad12[_0x9f3f('0x81')]=_[_0x9f3f('0x31')](_0x19f420,function(_0x1a8bbb){return _0x1a8bbb['name'];});_0x378a64(_0x38ad12);})[_0x9f3f('0x4f')](function(_0x1c5645){_0x48ca1b(_0x1c5645);});});}function getAllowedResources(_0x2bd42c,_0x477d50,_0x1b3471){return new BPromise(function(_0x1b2e0b,_0x221aef){if(_0x477d50){return db[_0x9f3f('0x5e')][_0x9f3f('0x49')]({'where':{'sectionId':_0x477d50['id']},'raw':!![]})[_0x9f3f('0x2a')](function(_0x16b6b1){if(_0x2bd42c[_0x9f3f('0x7e')]&&_0x2bd42c[_0x9f3f('0x7e')]!=='id'){_0x477d50[_0x9f3f('0x81')]=_[_0x9f3f('0x31')](_0x16b6b1,function(_0x2e0e9a){return _0x2e0e9a[_0x2bd42c[_0x9f3f('0x7e')]];});}else{if(_0x1b3471===_0x9f3f('0x7f')){_0x477d50[_0x9f3f('0x81')]=_[_0x9f3f('0x31')](_0x16b6b1,function(_0x3cd8f4){return{'id':_0x3cd8f4[_0x9f3f('0x6f')],'type':_0x3cd8f4[_0x9f3f('0x35')]};});}else{_0x477d50[_0x9f3f('0x81')]=_[_0x9f3f('0x31')](_0x16b6b1,function(_0x4a86b7){return _0x4a86b7['resourceId'];});}}_0x1b2e0b(_0x477d50);})['catch'](function(_0x4aae72){_0x221aef(_0x4aae72);});}else{_0x1b2e0b(null);}});}function getQueryModels(_0x2d96f9,_0x204a0b){var _0x5e0b32=_0x2d96f9['toLowerCase']();var _0x316b3b={'childModel':undefined,'parentSections':[]};switch(_0x5e0b32){case _0x9f3f('0x8d'):_0x316b3b[_0x9f3f('0x78')]='SquareProject';break;case'odbc':_0x316b3b[_0x9f3f('0x78')]='SquareOdbc';break;case _0x9f3f('0x8e'):_0x316b3b[_0x9f3f('0x78')]='SquareRecording';_0x316b3b['parentSections']=[{'name':_0x9f3f('0x8f'),'field':_0x9f3f('0x2e'),'foreignKey':_0x9f3f('0x90')}];break;case _0x9f3f('0x91'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x92');break;case _0x9f3f('0x93'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x86');_0x316b3b[_0x9f3f('0x7a')]=[{'name':_0x9f3f('0x94'),'field':'id','foreignKey':'ListId'}];break;case _0x9f3f('0x95'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x96');break;case _0x9f3f('0x97'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x98');break;case _0x9f3f('0x99'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x9a');break;case _0x9f3f('0x9b'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x9c');break;case _0x9f3f('0x9d'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x9e');break;case _0x9f3f('0x9f'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xa0');break;case'faxaccounts':_0x316b3b['childModel']='FaxAccount';break;case'inboundroutes':case _0x9f3f('0xa1'):case _0x9f3f('0xa2'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xa3');break;case _0x9f3f('0xa4'):_0x316b3b['childModel']=_0x9f3f('0xa5');break;case _0x9f3f('0xa6'):_0x316b3b[_0x9f3f('0x78')]='VoiceMail';break;case _0x9f3f('0xa7'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xa8');_0x316b3b[_0x9f3f('0x7a')]=[{'name':_0x9f3f('0xa9'),'field':'name','foreignKey':_0x9f3f('0xaa'),'model':_0x9f3f('0xab'),'filter':{'field':_0x9f3f('0xac'),'value':['agent']}},{'name':'Telephones','field':_0x9f3f('0x2e'),'foreignKey':_0x9f3f('0xaa'),'model':_0x9f3f('0xab'),'filter':{'field':_0x9f3f('0xac'),'value':[_0x9f3f('0xad')]}},{'name':'VoiceQueues','field':_0x9f3f('0x2e'),'foreignKey':_0x9f3f('0xae'),'model':_0x9f3f('0xaf'),'filter':{'field':_0x9f3f('0x35'),'value':[_0x9f3f('0xb0')]}},{'name':'QueueCampaigns','field':_0x9f3f('0x2e'),'foreignKey':_0x9f3f('0xae'),'model':_0x9f3f('0xaf'),'filter':{'field':'type','value':[_0x9f3f('0xb1')]}}];break;case _0x9f3f('0xb2'):_0x316b3b[_0x9f3f('0x78')]='VoiceMusicOnHold';break;case _0x9f3f('0xb3'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xb4');break;case'voiceprefixes':_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xb5');break;case'ivrcampaigns':_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xb6');break;case _0x9f3f('0xb7'):_0x316b3b['childModel']='MailQueue';break;case _0x9f3f('0xb8'):_0x316b3b[_0x9f3f('0x78')]='MailAccount';break;case _0x9f3f('0xb9'):_0x316b3b['childModel']=_0x9f3f('0xba');break;case _0x9f3f('0xbb'):_0x316b3b[_0x9f3f('0x78')]='OpenchannelQueue';break;case _0x9f3f('0xbc'):_0x316b3b['childModel']=_0x9f3f('0xbd');break;case _0x9f3f('0xbe'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xbf');break;case _0x9f3f('0xc0'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xc1');break;case _0x9f3f('0xc2'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xc3');break;case _0x9f3f('0xc4'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xc5');break;case _0x9f3f('0xc6'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xc7');break;case _0x9f3f('0xc8'):case _0x9f3f('0xc9'):_0x316b3b['childModel']=_0x9f3f('0xaf');if(_0x204a0b){_0x316b3b[_0x9f3f('0x7a')]=[{'name':_0x9f3f('0xca')},{'name':_0x9f3f('0xcb')}];}break;case'users':case _0x9f3f('0xcc'):case'telephones':_0x316b3b['childModel']=_0x9f3f('0xab');if(_0x204a0b){_0x316b3b[_0x9f3f('0x7a')]=[{'name':_0x9f3f('0xcd'),'filter':{'field':_0x9f3f('0xac'),'value':[_0x9f3f('0xce'),_0x9f3f('0xcf')]},'ignore':!![]},{'name':'Agents'},{'name':_0x9f3f('0xd0')}];}break;case'zendeskaccounts':_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xd1');break;case _0x9f3f('0xd2'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xd3');break;case _0x9f3f('0xd4'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xd5');break;case _0x9f3f('0xd6'):_0x316b3b['childModel']=_0x9f3f('0xd7');break;case _0x9f3f('0xd8'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xd9');break;case _0x9f3f('0xda'):_0x316b3b[_0x9f3f('0x78')]='ZohoAccount';break;case _0x9f3f('0xdb'):_0x316b3b[_0x9f3f('0x78')]='User';break;case _0x9f3f('0xdc'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xdd');break;case _0x9f3f('0xde'):_0x316b3b[_0x9f3f('0x78')]='Disposition';break;case _0x9f3f('0xdf'):_0x316b3b[_0x9f3f('0x78')]='Dashboard';break;case _0x9f3f('0xe0'):_0x316b3b['childModel']=_0x9f3f('0xe1');break;case _0x9f3f('0xe2'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xe3');break;case _0x9f3f('0xe4'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xe5');break;case _0x9f3f('0xe6'):_0x316b3b['childModel']='Sound';break;case _0x9f3f('0xe7'):_0x316b3b['childModel']=_0x9f3f('0x8a');break;case'templates':_0x316b3b[_0x9f3f('0x78')]='Template';break;case'triggers':_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xe8');break;case _0x9f3f('0xe9'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xea');break;case _0x9f3f('0xeb'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xec');break;case'plugins':_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x70');break;case _0x9f3f('0xed'):_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0x7f');_0x316b3b[_0x9f3f('0x7a')]=[{'name':_0x9f3f('0xee'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x316b3b[_0x9f3f('0x78')]=_0x9f3f('0xef');break;case'whatsappaccounts':_0x316b3b[_0x9f3f('0x78')]='WhatsappAccount';break;default:return _0x316b3b;}return _0x316b3b;}
\ No newline at end of file