Built motion from commit c49361c37b5f784889c8087ac6e0e91b7e6b561a. Version 3.0.0...
[motion-next.git] / server / api / user / user.controller.js
1 const a648_0x1464=['User','Unknown\x20role','bulkCreate','merge','options','flatten','Agents','compact','$eq','logout','Use','update','getMailInteractions','105','differenceBy','MemberReport','transaction','Openchannel','CmHopper','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','$and','debug','removeChatInteractions','and','addOpenchannelInteractions','email','files/images/','body','autoAssociation','authenticate','$any','rows','online','$not','addWhatsappInteractions','getSmsAccounts','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','104','includeAll','getSquareProjects','join','isValidChannel','addSquareProjects','removeOpenchannelAccounts','type','value','No\x20API\x20access\x20key\x20found!','permissions','$ne','voicemail','getOpenchannelInteractions','getTeams','../../config/license/util','password','loginInPause','token','forEach','offset','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','message','findOne','length','OpenchannelAccount','addMailInteractions','../../components/parsers/qs','getChatInteractions','salt','Queues','$notLike','root','ChatGroup','filter','catch','channel','Voice','rawAttributes','like','toLowerCase','UserId','Queue:remove','ignore','model','getFaxAccounts','securePassword','agent','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','getDataValue','addContacts','removeMailInteractions','Chat','moment','addAvatar','filename','keys','getWhatsappInteractions','$in','newPassword','connection','voice','remove','index','Unknown\x20channel','user_has_whatsapp_interactions:save','mail','previousPasswords','manual','pauseType','sort','$contains','Mail','getChatQueues','createApiKey','getWhatsappQueues','color','getVoicePrefixes','CmList','user_has_openchannel_interactions:remove','some','CmContact','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','lastPauseAt','Unauthorized','VoicePrefix','send','params','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','getMailAccounts','fields','penalty','ScreenRecording','iat','103','enforcePasswordHistory','../../rediscache','addOpenchannelAccounts','concat','addWhatsappAccounts','addMailAccounts','server/files/images/logos/default_profile.png','add','get','dialActive','108','%s%s','QueuePause','LOGININPAUSE','removeWhatsappAccounts','Queue:save','addAgent','download','user_has_sms_interactions:save','Wrong\x20credentials','ChatWebsite','Content-Range','$or','internal','socket','removeChatWebsites','faxPause','$lte','name','user_has_sms_interactions:remove','107','client','fax','getLists','filters','include','getContacts','set','api','getScheduledCalls','json','getAgents','UserVoiceQueueRt','stack','Sms','http','SmsInteraction','interface','isMiddleware','getRecordings','nolimit','file','VoiceQueue','removeFaxAccounts','userpic','getVoiceQueuesRt','../../mysqldb','removeApiKey','Queue','FaxAccount','request','111','addChatWebsites','end','find','whoami','map','openchannelPause','getChatWebsites','then','removeQueues','user','getFaxQueues','addSmsInteractions','passwordHistoryLimit','SIP/%s','headers','create','removeWhatsappInteractions','$gte','admin','push','max','lastName','$lt','$notBetween','undefined','pick','DEFAULT\x20PAUSE','getOpenchannelQueues','OpenchannelInteraction','$gt','getVoiceQueues','Pause','UserProfileResource','getApiKey','ids','all','pause','$contained','limit','addChatInteractions','fieldName','min_internal','113','getWhatsappAccounts','getGroups','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','addFaxInteractions','capitalize','userProfileId','User,\x20%s,\x20%s,\x20%s','role','phone','intrf','$like','omit','settingsEnabled','SELECT','removeFaxInteractions','API\x20key\x20not\x20available','info','User,\x20%s,\x20%s','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','fullname','100','remoteAddress','includes','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','query','Tag','isNil','isArray','List','VoiceRecording','109','telephone','WhatsappAccount','VoiceMail','retrieveApiKey','VIRTUAL','mailbox','user_has_fax_interactions:remove','chat','removeMailAccounts','mobile','QueueId','addSmsAccounts','checkUserLimits','Fax','YYYY-MM-DD\x20HH:mm:ss','lower','./user.socket','each','getScreenRecordings','request\x20sent','getSmsInteractions','code','Team','resolve','changePassword','getMailQueues','format','Whatsapp','../../components/auth/service','tag','where','validatePasswordHistory','oldPassword','register','Telephones','$overlap','apiKeyIat','Setting','UserProfileSection','setDataValue','Invalid\x20body\x20format.\x20Use\x20newPassword','getOpenchannelAccounts','MailInteraction','getQueues','addFaxAccounts','firstName','device','voicePause','getFaxInteractions','removeSmsAccounts','stringify','user_has_mail_interactions:remove','show','getChannels','WhatsappInteraction','removeSmsInteractions','attributes','user_has_chat_interactions:save','FaxInteraction','from','status','user_has_chat_interactions:remove','sequelize','101','114','intersection','removeOpenchannelInteractions','error','sendStatus','destroy','user_has_mail_interactions:save','PAUSE','removeSquareProjects','upsert','102','unpause','emit','findAll','order','$notILike','addTeams','login','count'];(function(_0x13a999,_0x146472){const _0x44a5f1=function(_0x598695){while(--_0x598695){_0x13a999['push'](_0x13a999['shift']());}};_0x44a5f1(++_0x146472);}(a648_0x1464,0x1cd));const a648_0x44a5=function(_0x13a999,_0x146472){_0x13a999=_0x13a999-0x0;let _0x44a5f1=a648_0x1464[_0x13a999];return _0x44a5f1;};const _0x15d5b3=a648_0x44a5;'use strict';const moment=require(_0x15d5b3('0x14b')),util=require('util'),path=require('path'),fs=require('fs'),_=require('lodash'),{getSocket}=require(_0x15d5b3('0x17')),socket=getSocket(),authService=require(_0x15d5b3('0xba')),qs=require(_0x15d5b3('0x131')),logger=require('../../config/logger')(_0x15d5b3('0x3c')),utils=require('../../config/utils'),config=require('../../config/environment'),db=require(_0x15d5b3('0x4e'))['db'],{Op,QueryTypes,fn,col,where,ValidationError}=require(_0x15d5b3('0xdc')),licenseUtil=require(_0x15d5b3('0x125'));require(_0x15d5b3('0xae'))[_0x15d5b3('0xbf')](socket);const jayson=require('jayson/promise'),client=jayson[_0x15d5b3('0x35')][_0x15d5b3('0x43')]({'port':0x232a});function respondWithRpcPromise(_0x598695,_0x1a822c,_0x52803a,_0x5a1a5c){return new Promise(function(_0x144674,_0x3397e3){const _0x5ce895=a648_0x44a5,_0x5b60cb=_0x5a1a5c||client;return _0x5b60cb[_0x5ce895('0x52')](_0x598695,_0x52803a)[_0x5ce895('0x5b')](function(_0xf81bc2){const _0x4450b4=_0x5ce895;logger[_0x4450b4('0x8f')](_0x4450b4('0x90'),_0x1a822c,_0x4450b4('0xb1')),logger[_0x4450b4('0x106')](_0x4450b4('0x85'),_0x1a822c,_0x4450b4('0xb1'),JSON[_0x4450b4('0xd0')](_0xf81bc2));if(_0xf81bc2['error']){if(_0xf81bc2[_0x4450b4('0xe1')][_0x4450b4('0xb3')]===0x1f4)return logger['error'](_0x4450b4('0x90'),_0x1a822c,_0xf81bc2['error']['message']),_0x3397e3(_0xf81bc2[_0x4450b4('0xe1')][_0x4450b4('0x12c')]);return logger[_0x4450b4('0xe1')](_0x4450b4('0x90'),_0x1a822c,_0xf81bc2['error'][_0x4450b4('0x12c')]),_0x144674(_0xf81bc2[_0x4450b4('0xe1')]['message']);}else logger['info'](_0x4450b4('0x90'),_0x1a822c,_0x4450b4('0xb1')),_0x144674(_0xf81bc2['result'][_0x4450b4('0x12c')]);})[_0x5ce895('0x139')](function(_0x1e7800){const _0x2fd87f=_0x5ce895;logger[_0x2fd87f('0xe1')](_0x2fd87f('0x90'),_0x1a822c,_0x1e7800),_0x3397e3(_0x1e7800);});});}function respondWithStatusCode(_0x2048ad,_0x40f1da){return _0x40f1da=_0x40f1da||0xcc,function(_0x23a901){const _0x1558d5=a648_0x44a5;if(_0x23a901)return _0x2048ad[_0x1558d5('0xe2')](_0x40f1da);return _0x2048ad[_0x1558d5('0xda')](_0x40f1da)[_0x1558d5('0x55')]();};}function respondWithResult(_0x5982ba,_0x4d3094){return _0x4d3094=_0x4d3094||0xc8,function(_0x3a1c9d){const _0x304338=a648_0x44a5;if(_0x3a1c9d)return _0x5982ba['status'](_0x4d3094)[_0x304338('0x3e')](_0x3a1c9d);};}function respondWithFilteredResult(_0x474a78,_0x3b6cf3){return function(_0x53a0c0){const _0x449583=a648_0x44a5;if(_0x53a0c0){const _0x289f86=_0x53a0c0['count'],_0xa5be3d=_0x3b6cf3[_0x449583('0x12a')];let _0x486e1d=_0x3b6cf3[_0x449583('0x12a')]+_0x3b6cf3[_0x449583('0x7a')],_0x1a679b;return _0x486e1d>=_0x289f86?(_0x486e1d=_0x289f86,_0x1a679b=0xc8):_0x1a679b=0xce,_0x474a78['status'](_0x1a679b),_0x474a78[_0x449583('0x3b')](_0x449583('0x2b'),_0xa5be3d+'-'+_0x486e1d+'/'+_0x289f86)['json'](_0x53a0c0);}return null;};}function saveUpdates(_0x2132e7){return function(_0x1bd534){const _0x3f5677=a648_0x44a5;if(_0x1bd534)return _0x1bd534['update'](_0x2132e7)[_0x3f5677('0x5b')](function(_0x45b42d){return _0x45b42d;});return null;};}function removeEntity(_0x5c8ea6){return function(_0x421fa2){const _0x41f73d=a648_0x44a5;if(_0x421fa2)return _0x421fa2[_0x41f73d('0xe3')]()[_0x41f73d('0x5b')](function(){const _0x5545c2=_0x41f73d,_0x5c86de=_0x421fa2[_0x5545c2('0x1e')]({'plain':!![]});if(_0x5c86de[_0x5545c2('0x86')]==='admin')return;const _0x3411c7=[{'name':'Users','value':_0x5545c2('0x5d'),'ignore':!![]},{'name':'Agents','value':_0x5545c2('0x145'),'ignore':![]},{'name':_0x5545c2('0xc0'),'value':'telephone','ignore':![]}],_0x280248=_(_0x3411c7)[_0x5545c2('0x138')](_0x5545c2('0x141'))[_0x5545c2('0x58')](_0x5545c2('0x11e'))[_0x5545c2('0x11e')]();if(_[_0x5545c2('0x95')](_0x280248,_0x5c86de[_0x5545c2('0x86')]))return;const _0x2fdcd3=_['find'](_0x3411c7,[_0x5545c2('0x11e'),_0x5c86de['role']])[_0x5545c2('0x32')];return db[_0x5545c2('0x74')][_0x5545c2('0xe3')]({'where':{'type':_0x2fdcd3,'resourceId':_0x5c86de['id']}})[_0x5545c2('0x5b')](function(){return _0x421fa2;});})[_0x41f73d('0x5b')](function(){const _0x47a2a5=_0x41f73d;_0x5c8ea6[_0x47a2a5('0xda')](0xcc)[_0x47a2a5('0x55')]();});};}function handleEntityNotFound(_0x591642){return function(_0x50da54){const _0x9bf36a=a648_0x44a5;return!_0x50da54&&_0x591642[_0x9bf36a('0xe2')](0x194),_0x50da54;};}function handleError(_0x39ae13,_0x27bc4d){return _0x27bc4d=_0x27bc4d||0x1f4,function(_0x98b6c6){const _0x1989e7=a648_0x44a5;logger[_0x1989e7('0xe1')](_0x98b6c6[_0x1989e7('0x41')]),_0x98b6c6[_0x1989e7('0x32')]&&delete _0x98b6c6['name'],_0x39ae13[_0x1989e7('0xda')](_0x27bc4d)[_0x1989e7('0xd')](_0x98b6c6);};}function validateUser(_0x251886){return new Promise(function(_0x5d1b49,_0xf0d01d){const _0x33fa62=a648_0x44a5;if(_0x251886['internal'])return _0x5d1b49(_0x251886);return db[_0x33fa62('0xc3')]['findByPk'](0x1)[_0x33fa62('0x5b')](function(_0x206390){const _0x3fe6c1=_0x33fa62;if(_0x206390[_0x3fe6c1('0x144')])authService['validatePasswordPattern'](_0x251886['password']);db[_0x3fe6c1('0xf1')][_0x3fe6c1('0x68')](_0x3fe6c1('0x2d'))['then'](function(_0x4d5c0f){const _0x4720cd=_0x3fe6c1;if(_[_0x4720cd('0x99')](_0x4d5c0f)){_0x251886[_0x4720cd('0x2d')]=_0x206390[_0x4720cd('0x7d')]||0x1;return;}if(_[_0x4720cd('0x99')](_0x206390['min_internal'])||_0x206390[_0x4720cd('0x7d')]===_0x4d5c0f){_0x251886[_0x4720cd('0x2d')]=_0x4d5c0f+0x1;return;}if(_0x206390['min_internal']>_0x4d5c0f){_0x251886[_0x4720cd('0x2d')]=_0x206390[_0x4720cd('0x7d')];return;}return db[_0x4720cd('0xdc')]['query'](_0x4720cd('0x96'),{'type':QueryTypes[_0x4720cd('0x8c')]})[_0x4720cd('0x5b')](function(_0x5f3ffb){const _0xd57aba=_0x4720cd;if(_0x5f3ffb&&_0x5f3ffb[_0xd57aba('0x12e')])for(let _0x4a7b3b=0x0,_0x7d021a=_0x5f3ffb['length'];_0x4a7b3b<_0x7d021a&&_[_0xd57aba('0x99')](_0x251886['internal']);_0x4a7b3b++){if(_0x206390[_0xd57aba('0x7d')]<=_0x5f3ffb[_0x4a7b3b]['from'])_0x251886[_0xd57aba('0x2d')]=_0x5f3ffb[_0x4a7b3b][_0xd57aba('0xd9')];else _0x206390[_0xd57aba('0x7d')]>_0x5f3ffb[_0x4a7b3b][_0xd57aba('0xd9')]&&_0x206390[_0xd57aba('0x7d')]<=_0x5f3ffb[_0x4a7b3b]['to']&&(_0x251886[_0xd57aba('0x2d')]=_0x206390[_0xd57aba('0x7d')]);}return _[_0xd57aba('0x99')](_0x251886[_0xd57aba('0x2d')])&&(_0x251886[_0xd57aba('0x2d')]=_0x4d5c0f+0x1),_0x5d1b49(_0x251886);});});})['catch'](function(_0x453f42){_0xf0d01d(_0x453f42);});});}function updateUser(_0x5e3e48){return new Promise(function(_0x1c8b9e,_0x561ec2){const _0x3cf189=a648_0x44a5;try{_0x5e3e48[_0x3cf189('0x122')]&&(_0x5e3e48[_0x3cf189('0xa3')]=_0x5e3e48[_0x3cf189('0x2d')],_0x5e3e48[_0x3cf189('0xa0')]={'mailbox':_0x5e3e48['internal'],'password':_0x5e3e48['password'],'fullname':_0x5e3e48[_0x3cf189('0x92')],'email':_0x5e3e48[_0x3cf189('0x10a')]});if(_0x5e3e48['role']===_0x3cf189('0x145')){if(!_0x5e3e48[_0x3cf189('0x120')])_0x5e3e48[_0x3cf189('0x120')]=[_0x3cf189('0xdd'),_0x3cf189('0xe8'),_0x3cf189('0x15'),_0x3cf189('0x7e'),'110',_0x3cf189('0x116'),_0x3cf189('0xfe'),'106',_0x3cf189('0x34'),_0x3cf189('0x20'),_0x3cf189('0x9d'),_0x3cf189('0x93'),_0x3cf189('0x53'),_0x3cf189('0xde')];}_0x1c8b9e(_0x5e3e48);}catch(_0x539a3c){_0x561ec2(_0x539a3c);}});}exports[_0x15d5b3('0x155')]=function(_0x2c215b,_0xfa2a7c){const _0xf152d6=_0x15d5b3;let _0x4decd5={};const _0xed1df7={},_0x227a91={'count':0x0,'rows':[]},_0x4926e2=_[_0xf152d6('0x58')](db['User'][_0xf152d6('0x13c')],function(_0xb32eb7){const _0x27bccf=_0xf152d6;return{'name':_0xb32eb7[_0x27bccf('0x7c')],'type':_0xb32eb7[_0x27bccf('0x11d')]['key']};});_0xed1df7[_0xf152d6('0x142')]=_[_0xf152d6('0xff')](_[_0xf152d6('0x58')](_0x4926e2,'name'),['password','salt']),_0xed1df7[_0xf152d6('0x97')]=_[_0xf152d6('0x14e')](_0x2c215b[_0xf152d6('0x97')]),_0xed1df7[_0xf152d6('0x38')]=_[_0xf152d6('0xdf')](_0xed1df7[_0xf152d6('0x142')],_0xed1df7[_0xf152d6('0x97')]),_0x4decd5[_0xf152d6('0xd6')]=_['intersection'](_0xed1df7['model'],qs[_0xf152d6('0x11')](_0x2c215b['query'][_0xf152d6('0x11')])),_0x4decd5['attributes']=_0x4decd5[_0xf152d6('0xd6')][_0xf152d6('0x12e')]?_0x4decd5[_0xf152d6('0xd6')]:_0xed1df7['model'];typeof _0x2c215b[_0xf152d6('0x97')][_0xf152d6('0x48')]===_0xf152d6('0x6c')&&(_0x4decd5[_0xf152d6('0x7a')]=qs[_0xf152d6('0x7a')](_0x2c215b[_0xf152d6('0x97')]['limit']),_0x4decd5['offset']=qs[_0xf152d6('0x12a')](_0x2c215b[_0xf152d6('0x97')][_0xf152d6('0x12a')]));_0x4decd5[_0xf152d6('0xec')]=qs[_0xf152d6('0x15c')](_0x2c215b['query']['sort']),_0x4decd5[_0xf152d6('0xbc')]=qs[_0xf152d6('0x38')](_['pick'](_0x2c215b[_0xf152d6('0x97')],_0xed1df7[_0xf152d6('0x38')]),_0x4926e2);_0x2c215b[_0xf152d6('0x97')]['filter']&&(_0x4decd5[_0xf152d6('0xbc')]=_['merge'](_0x4decd5[_0xf152d6('0xbc')],{[Op['or']]:_[_0xf152d6('0x58')](_0x4926e2,function(_0x1d1c3d){const _0x165a20=_0xf152d6;if(_0x1d1c3d['type']!==_0x165a20('0xa2'))return where(fn(_0x165a20('0xad'),col(_0x1d1c3d[_0x165a20('0x32')])),{'$like':fn('lower','%'+_0x2c215b[_0x165a20('0x97')][_0x165a20('0x138')]+'%')});})}));_0x4decd5=_[_0xf152d6('0xf4')]({},_0x4decd5,_0x2c215b['options']);const _0x5920db={'where':_0x4decd5['where']};return db[_0xf152d6('0xf1')]['count'](_0x5920db)[_0xf152d6('0x5b')](function(_0x5ec6dc){const _0x4351a5=_0xf152d6;return _0x227a91[_0x4351a5('0xf0')]=_0x5ec6dc,typeof _0x2c215b[_0x4351a5('0x97')][_0x4351a5('0x117')]!==_0x4351a5('0x6c')&&(_0x4decd5[_0x4351a5('0x39')]=[{'all':!![]}]),db[_0x4351a5('0xf1')][_0x4351a5('0xeb')](_0x4decd5);})[_0xf152d6('0x5b')](function(_0x10b894){const _0x49af07=_0xf152d6;return _0x227a91[_0x49af07('0x110')]=_0x10b894,_0x227a91;})[_0xf152d6('0x5b')](respondWithFilteredResult(_0xfa2a7c,_0x4decd5))[_0xf152d6('0x139')](handleError(_0xfa2a7c,null));},exports[_0x15d5b3('0xd2')]=function(_0x241c87,_0x418ca0){const _0xa9a3cf=_0x15d5b3;let _0x2ba05f={'raw':![],'where':{'id':_0x241c87['params']['id']}};const _0xca6314={};return _0xca6314[_0xa9a3cf('0x142')]=_[_0xa9a3cf('0xff')](_[_0xa9a3cf('0x14e')](db['User'][_0xa9a3cf('0x13c')]),[_0xa9a3cf('0x126'),_0xa9a3cf('0x133')]),_0xca6314['query']=_['keys'](_0x241c87[_0xa9a3cf('0x97')]),_0xca6314[_0xa9a3cf('0x38')]=_['intersection'](_0xca6314[_0xa9a3cf('0x142')],_0xca6314[_0xa9a3cf('0x97')]),_0x2ba05f[_0xa9a3cf('0xd6')]=_[_0xa9a3cf('0xdf')](_0xca6314[_0xa9a3cf('0x142')],qs['fields'](_0x241c87[_0xa9a3cf('0x97')][_0xa9a3cf('0x11')])),_0x2ba05f[_0xa9a3cf('0xd6')]=_0x2ba05f[_0xa9a3cf('0xd6')][_0xa9a3cf('0x12e')]?_0x2ba05f[_0xa9a3cf('0xd6')]:_0xca6314['model'],_0x241c87[_0xa9a3cf('0x97')][_0xa9a3cf('0x117')]&&(_0x2ba05f[_0xa9a3cf('0x39')]=[{'all':!![]}]),_0x2ba05f=_['merge']({},_0x2ba05f,_0x241c87[_0xa9a3cf('0xf5')]),db[_0xa9a3cf('0xf1')][_0xa9a3cf('0x12d')](_0x2ba05f)[_0xa9a3cf('0x5b')](handleEntityNotFound(_0x418ca0,null))[_0xa9a3cf('0x5b')](respondWithResult(_0x418ca0,null))[_0xa9a3cf('0x139')](handleError(_0x418ca0,null));},exports['bulkCreate']=function(_0x5b7cd8,_0x5370b7){const _0xfe4bc8=_0x15d5b3,_0x338613=_0x5b7cd8[_0xfe4bc8('0x10c')];let _0x53ff60=[];if(_0x5b7cd8[_0xfe4bc8('0x5d')][_0xfe4bc8('0x86')]==='agent')throw new Error(_0xfe4bc8('0xb'));if(_['some'](_0x338613,[_0xfe4bc8('0x86'),_0xfe4bc8('0x5d')])&&_0x5b7cd8[_0xfe4bc8('0x5d')][_0xfe4bc8('0x86')]!==_0xfe4bc8('0x66'))throw new Error(_0xfe4bc8('0x9'));if(_[_0xfe4bc8('0x7')](_0x338613,[_0xfe4bc8('0x86'),'admin'])&&_0x5b7cd8[_0xfe4bc8('0x5d')][_0xfe4bc8('0x86')]!=='admin')throw new Error(_0xfe4bc8('0x115'));return licenseUtil[_0xfe4bc8('0xaa')](_0x338613)[_0xfe4bc8('0x5b')](function(){return validateUser(_0x338613[0x0]);})['then'](function(){const _0x351f68=_0xfe4bc8;for(let _0x42478e=0x1;_0x42478e<_0x338613[_0x351f68('0x12e')];_0x42478e++){const _0xe6d758=_0x338613[_0x42478e-0x1][_0x351f68('0x2d')];if(!_0x338613[_0x42478e][_0x351f68('0x2d')])_0x338613[_0x42478e][_0x351f68('0x2d')]=_0xe6d758+0x1;_0x53ff60[_0x351f68('0x67')](validateUser(_0x338613[_0x42478e]));}return Promise[_0x351f68('0x77')](_0x53ff60);})['then'](function(){const _0x218830=_0xfe4bc8;_0x53ff60=[];for(let _0x376cd0=0x0;_0x376cd0<_0x338613['length'];_0x376cd0++){_0x53ff60[_0x218830('0x67')](updateUser(_0x338613[_0x376cd0]));}return Promise[_0x218830('0x77')](_0x53ff60);})[_0xfe4bc8('0x5b')](function(){const _0x69ccd5=_0xfe4bc8;return _0x53ff60=_0x338613[_0x69ccd5('0x58')](_0x215e5c=>{const _0x97b07e=_0x69ccd5;return db['User'][_0x97b07e('0x63')](_0x215e5c,{'include':[{'model':db[_0x97b07e('0xa0')],'as':_0x97b07e('0xa0')}]})[_0x97b07e('0x5b')](function(_0x5c70bf){return _0x215e5c['id']=_0x5c70bf['id'],_0x215e5c;});}),Promise[_0x69ccd5('0x77')](_0x53ff60);})[_0xfe4bc8('0x5b')](function(_0x428409){const _0x144a9d=_0xfe4bc8;if(_0x5b7cd8[_0x144a9d('0x10c')][_0x144a9d('0x86')]===_0x144a9d('0x5d'))return _0x428409;if(_0x5b7cd8[_0x144a9d('0x5d')]['role']!==_0x144a9d('0x5d'))return _0x428409;const _0x589a3b=_[_0x144a9d('0x7')](_0x428409,function(_0x1f3fe5){const _0x47d459=_0x144a9d;return _0x1f3fe5['role']==='agent'||_0x1f3fe5['role']===_0x47d459('0x9e');});if(!_0x589a3b)return _0x428409;return db[_0x144a9d('0xc4')][_0x144a9d('0xeb')]({'where':{'name':{[Op['or']]:[_0x144a9d('0xf7'),_0x144a9d('0xc0')]},'userProfileId':_0x5b7cd8[_0x144a9d('0x5d')][_0x144a9d('0x84')]},'raw':!![]})[_0x144a9d('0x5b')](function(_0x18107){const _0x2e2a46=_0x144a9d;if(_['isEmpty'](_0x18107)||!_[_0x2e2a46('0x7')](_0x18107,[_0x2e2a46('0x10d'),0x0]))return _0x428409;_0x53ff60=[];const _0x3a3bbb=_(_0x18107)[_0x2e2a46('0x58')](function(_0x2dc5c2){const _0xea7b05=_0x2e2a46;if(_0x2dc5c2[_0xea7b05('0x10d')]===0x1)return;return _0x2dc5c2[_0xea7b05('0x32')]==='Agents'?_0xea7b05('0x145'):_0xea7b05('0x9e');})[_0x2e2a46('0xf8')]()[_0x2e2a46('0x11e')]();for(let _0x1a5bfb=0x0;_0x1a5bfb<_0x428409['length'];_0x1a5bfb++){if(!_[_0x2e2a46('0x95')](_0x3a3bbb,_0x428409[_0x1a5bfb][_0x2e2a46('0x86')]))return;const _0x24f273=_0x428409[_0x1a5bfb][_0x2e2a46('0x86')]===_0x2e2a46('0x145')?'Agents':_0x2e2a46('0xc0');_0x53ff60[_0x2e2a46('0x67')](db[_0x2e2a46('0x74')]['create']({'name':_0x428409[_0x1a5bfb][_0x2e2a46('0x32')],'resourceId':_0x428409[_0x1a5bfb]['id'],'type':_0x24f273,'sectionId':_[_0x2e2a46('0x56')](_0x18107,['name',_0x24f273])['id']},{}));}return Promise[_0x2e2a46('0x77')](_0x53ff60);});})[_0xfe4bc8('0x5b')](respondWithResult(_0x5370b7,0xc9))[_0xfe4bc8('0x139')](handleError(_0x5370b7,null));},exports[_0x15d5b3('0xfc')]=function(_0x4d69e9,_0x16e8ef){const _0x14e4b6=_0x15d5b3;return _0x4d69e9[_0x14e4b6('0x10c')]['id']&&delete _0x4d69e9[_0x14e4b6('0x10c')]['id'],delete _0x4d69e9[_0x14e4b6('0x10c')][_0x14e4b6('0x86')],db[_0x14e4b6('0xf1')]['findOne']({'where':{'id':_0x4d69e9[_0x14e4b6('0xe')]['id']}})[_0x14e4b6('0x5b')](handleEntityNotFound(_0x16e8ef,null))['then'](saveUpdates(_0x4d69e9[_0x14e4b6('0x10c')],null))['then'](respondWithResult(_0x16e8ef,null))[_0x14e4b6('0x139')](handleError(_0x16e8ef,null));},exports['describe']=function(_0x8b04b,_0x2db9fd){const _0x4f80dd=_0x15d5b3;return db['User']['describe']()[_0x4f80dd('0x5b')](respondWithResult(_0x2db9fd,null))[_0x4f80dd('0x139')](handleError(_0x2db9fd,null));},exports['addContacts']=function(_0x5a99b4,_0x47c14e){const _0x49db80=_0x15d5b3;return db[_0x49db80('0xf1')][_0x49db80('0x12d')]({'where':{'id':_0x5a99b4[_0x49db80('0xe')]['id']}})[_0x49db80('0x5b')](handleEntityNotFound(_0x47c14e,null))[_0x49db80('0x5b')](function(_0x28f414){const _0xa93b44=_0x49db80;if(_0x28f414)return _0x28f414[_0xa93b44('0x148')](_0x5a99b4[_0xa93b44('0x10c')][_0xa93b44('0x76')],{'through':_[_0xa93b44('0x8a')](_0x5a99b4[_0xa93b44('0x10c')],[_0xa93b44('0x76'),'id'])});})[_0x49db80('0x5b')](respondWithResult(_0x47c14e,null))['catch'](handleError(_0x47c14e,null));},exports[_0x15d5b3('0x63')]=function(_0x2c7988,_0x5b871a){const _0x568b3e=_0x15d5b3;if(_0x2c7988[_0x568b3e('0x5d')]['role']===_0x568b3e('0x145'))throw new Error(_0x568b3e('0xb'));if(_0x2c7988[_0x568b3e('0x10c')][_0x568b3e('0x86')]===_0x568b3e('0x5d')&&_0x2c7988['user']['role']!==_0x568b3e('0x66'))throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');if(_0x2c7988[_0x568b3e('0x10c')][_0x568b3e('0x86')]===_0x568b3e('0x66')&&_0x2c7988['user']['role']!==_0x568b3e('0x66'))throw new Error(_0x568b3e('0xf'));return licenseUtil['checkUserLimits']([_0x2c7988[_0x568b3e('0x10c')]])[_0x568b3e('0x5b')](function(){const _0x3f2280=_0x568b3e;return validateUser(_0x2c7988[_0x3f2280('0x10c')]);})['then'](function(_0x378674){return updateUser(_0x378674)['then'](function(_0x36050e){const _0x2c9c17=a648_0x44a5;return _0x36050e['role']==='admin'&&(_0x36050e[_0x2c9c17('0x8b')]=_0x2c7988[_0x2c9c17('0x5d')]['settingsEnabled'],delete _0x36050e[_0x2c9c17('0x84')]),_0x36050e;});})[_0x568b3e('0x5b')](function(_0x3f7a4c){const _0x32bc1e=_0x568b3e;return db[_0x32bc1e('0xf1')]['create'](_0x3f7a4c,{'include':[{'model':db[_0x32bc1e('0xa0')],'as':_0x32bc1e('0xa0')}]});})[_0x568b3e('0x5b')](function(_0x1f6a7c){const _0x205d4b=_0x568b3e;if(_0x2c7988['body'][_0x205d4b('0x86')]===_0x205d4b('0x5d'))return _0x1f6a7c;if(_0x2c7988[_0x205d4b('0x5d')][_0x205d4b('0x86')]!=='user')return _0x1f6a7c;return db[_0x205d4b('0xc4')][_0x205d4b('0x12d')]({'where':{'name':_0x1f6a7c[_0x205d4b('0x86')]===_0x205d4b('0x145')?_0x205d4b('0xf7'):_0x205d4b('0xc0'),'userProfileId':_0x2c7988[_0x205d4b('0x5d')][_0x205d4b('0x84')]},'raw':!![]})[_0x205d4b('0x5b')](function(_0x1981fa){const _0x41fce0=_0x205d4b;if(!_0x1981fa||_0x1981fa['autoAssociation']!=0x0)return _0x1f6a7c;return db[_0x41fce0('0x74')][_0x41fce0('0x63')]({'name':_0x1f6a7c['name'],'resourceId':_0x1f6a7c['id'],'type':_0x1981fa['name'],'sectionId':_0x1981fa['id']},{})[_0x41fce0('0x5b')](function(){return _0x1f6a7c;});})[_0x205d4b('0x139')](function(_0x59544a){const _0x3ea360=_0x205d4b;logger['error'](_0x3ea360('0x104'),_0x59544a);throw _0x59544a;});})['then'](respondWithResult(_0x5b871a,0xc9))['catch'](handleError(_0x5b871a,null));},exports[_0x15d5b3('0xb6')]=function(_0xf749db,_0x1b3421){const _0xd1c4b2=_0x15d5b3;if(_0xf749db['body']['id'])delete _0xf749db[_0xd1c4b2('0x10c')]['id'];return db[_0xd1c4b2('0xf1')]['findOne']({'where':{'id':_0xf749db[_0xd1c4b2('0xe')]['id']}})[_0xd1c4b2('0x5b')](function(_0x217c6b){const _0x19ec1f=_0xd1c4b2;if(!_0x217c6b)return null;if(_0x217c6b['id']===_0xf749db[_0x19ec1f('0x5d')]['id']){if(!_0xf749db[_0x19ec1f('0x10c')][_0x19ec1f('0xbe')]||!_0xf749db[_0x19ec1f('0x10c')][_0x19ec1f('0x151')])throw new ValidationError(_0x19ec1f('0x146'));if(!_0x217c6b[_0x19ec1f('0x10e')](_0xf749db[_0x19ec1f('0x10c')][_0x19ec1f('0xbe')]))throw new ValidationError(_0x19ec1f('0x29'));if(_0xf749db['body'][_0x19ec1f('0xbe')]===_0xf749db['body'][_0x19ec1f('0x151')])throw new ValidationError(_0x19ec1f('0x81'));}else{if(_0xf749db[_0x19ec1f('0x5d')][_0x19ec1f('0x86')]===_0x19ec1f('0x66')){if(!_0xf749db[_0x19ec1f('0x10c')][_0x19ec1f('0x151')])throw new ValidationError(_0x19ec1f('0xc6'));}else{if(_0xf749db[_0x19ec1f('0x5d')][_0x19ec1f('0x86')]===_0x19ec1f('0x5d')){if(!_0xf749db[_0x19ec1f('0x10c')][_0x19ec1f('0x151')])throw new ValidationError(_0x19ec1f('0xc6'));if(_0x217c6b[_0x19ec1f('0x86')]!==_0x19ec1f('0x145'))throw new ValidationError(_0x19ec1f('0xb'));}else throw new ValidationError('Unauthorized');}}return _0x217c6b;})[_0xd1c4b2('0x5b')](handleEntityNotFound(_0x1b3421,null))[_0xd1c4b2('0x5b')](function(_0x478c4d){const _0x2ef7a6=_0xd1c4b2;return db[_0x2ef7a6('0xc3')]['findOne']({'attributes':['id',_0x2ef7a6('0x144'),_0x2ef7a6('0x16'),_0x2ef7a6('0x60')]})[_0x2ef7a6('0x5b')](function(_0x438315){const _0x5742b4=_0x2ef7a6;if(_0x438315['securePassword'])authService['validatePasswordPattern'](_0xf749db[_0x5742b4('0x10c')][_0x5742b4('0x151')]);if(!_0x438315[_0x5742b4('0x16')]||!_0x478c4d[_0x5742b4('0x159')])return _0x478c4d;return authService[_0x5742b4('0xbd')](_0xf749db['body'][_0x5742b4('0x151')],_0x478c4d[_0x5742b4('0x159')],_0x438315[_0x5742b4('0x60')]),_0x478c4d;})['then'](saveUpdates({'password':_0xf749db[_0x2ef7a6('0x10c')][_0x2ef7a6('0x151')],'passwordResetAt':_0xf749db['user']['id']==_0xf749db['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xf749db[_0x2ef7a6('0x10c')][_0x2ef7a6('0x151')],_0x478c4d[_0x2ef7a6('0x159')])},null));})[_0xd1c4b2('0x5b')](respondWithResult(_0x1b3421,null))[_0xd1c4b2('0x139')](handleError(_0x1b3421,null));},exports['addQueues']=function(_0x48a79a,_0x5caf86){const _0x2873c9=_0x15d5b3,_0x6adf30=_0x48a79a['body']['channel'];return db[_0x2873c9('0xf1')][_0x2873c9('0x12d')]({'where':{'id':_0x48a79a['params']['id']},'attributes':['id',_0x2873c9('0x32'),_0x2873c9('0x86'),'online',_0x2873c9('0x127'),_0x2873c9('0xcd'),_0x2873c9('0x45')]})['then'](handleEntityNotFound(_0x5caf86,null))['then'](function(_0x4f2560){const _0x2a8aae=_0x2873c9;if(_0x4f2560){if(!utils[_0x2a8aae('0x11a')](_0x6adf30))throw new ValidationError(_0x2a8aae('0x156'));return _0x4f2560[_0x2a8aae('0x1d')+_[_0x2a8aae('0x83')](_0x6adf30[_0x2a8aae('0x13e')]())+_0x2a8aae('0x134')](_0x48a79a[_0x2a8aae('0x10c')][_0x2a8aae('0x76')],{'through':{'penalty':_0x48a79a[_0x2a8aae('0x10c')][_0x2a8aae('0x12')]||0x0}})[_0x2a8aae('0x5b')](function(_0x155f8f){const _0x3db2de=_0x2a8aae;for(let _0x1b1666=0x0;_0x1b1666<_0x48a79a[_0x3db2de('0x10c')]['ids'][_0x3db2de('0x12e')];_0x1b1666+=0x1){const _0x4d0fd6={'UserId':_0x48a79a[_0x3db2de('0xe')]['id']};_0x4d0fd6[_['capitalize'](_0x6adf30['toLowerCase']())+_0x3db2de('0xa8')]=_0x48a79a['body'][_0x3db2de('0x76')][_0x1b1666],socket[_0x3db2de('0xea')](_0x3db2de('0x5d')+_['capitalize'](_0x6adf30['toLowerCase']())+_0x3db2de('0x25'),_0x4d0fd6);}return _0x155f8f;})[_0x2a8aae('0x5b')](function(){const _0x4d1b8c=_0x2a8aae;if(_0x6adf30==='voice')return db[_0x4d1b8c('0x4a')][_0x4d1b8c('0xeb')]({'where':{'id':_0x48a79a[_0x4d1b8c('0x10c')][_0x4d1b8c('0x76')]||[]},'raw':!![],'attributes':['id',_0x4d1b8c('0x32')]});})[_0x2a8aae('0x5b')](function(_0x47220f){const _0x39dab3=_0x2a8aae,_0x352cee=_0x4f2560[_0x39dab3('0x1e')]({'plain':!![]}),_0x29a9d8=[];if(_0x6adf30===_0x39dab3('0x153')&&_0x352cee[_0x39dab3('0x86')]===_0x39dab3('0x145')&&_0x352cee['online']){for(let _0x550e2c=0x0;_0x550e2c<_0x47220f[_0x39dab3('0x12e')];_0x550e2c+=0x1){_0x29a9d8[_0x39dab3('0x67')]({'membername':_0x352cee[_0x39dab3('0x32')],'UserId':_0x352cee['id'],'queue_name':_0x47220f[_0x550e2c]['name'],'VoiceQueueId':_0x47220f[_0x550e2c]['id'],'interface':_[_0x39dab3('0x99')](_0x352cee[_0x39dab3('0x45')])?util[_0x39dab3('0xb8')]('SIP/%s',_0x352cee[_0x39dab3('0x32')]):_0x352cee[_0x39dab3('0x45')],'paused':_0x352cee[_0x39dab3('0xcd')]||![],'penalty':_0x48a79a[_0x39dab3('0x10c')]['penalty']||0x0});}return Promise[_0x39dab3('0xaf')](_0x29a9d8,function(_0x15a54){const _0x32f35e=_0x39dab3;return db[_0x32f35e('0x40')][_0x32f35e('0xe7')](_0x15a54);});}return _0x4f2560;});}})[_0x2873c9('0x5b')](respondWithStatusCode(_0x5caf86,null))['catch'](handleError(_0x5caf86,null));},exports[_0x15d5b3('0x5c')]=function(_0x951ce,_0x1d46f7){const _0x26af6d=_0x15d5b3;let _0x3e80a8;return db[_0x26af6d('0xf1')][_0x26af6d('0x12d')]({'where':{'id':_0x951ce[_0x26af6d('0xe')]['id']},'attributes':['id',_0x26af6d('0x32'),_0x26af6d('0x86')]})[_0x26af6d('0x5b')](handleEntityNotFound(_0x1d46f7,null))[_0x26af6d('0x5b')](function(_0x295d00){const _0x85ac1d=_0x26af6d;if(_0x295d00){_0x3e80a8=_0x295d00;if(!_0x951ce['query'][_0x85ac1d('0x13a')]||!utils[_0x85ac1d('0x11a')](_0x951ce[_0x85ac1d('0x97')][_0x85ac1d('0x13a')]))throw new ValidationError('Unknown\x20channel');return _0x295d00[_0x85ac1d('0x154')+_[_0x85ac1d('0x83')](_0x951ce[_0x85ac1d('0x97')][_0x85ac1d('0x13a')][_0x85ac1d('0x13e')]())+_0x85ac1d('0x134')](_0x951ce[_0x85ac1d('0x97')]['ids']);}})[_0x26af6d('0x5b')](function(_0x455c28){const _0x5141c0=_0x26af6d;for(let _0x21956c=0x0;_0x21956c<_0x951ce[_0x5141c0('0x97')][_0x5141c0('0x76')][_0x5141c0('0x12e')];_0x21956c+=0x1){const _0xcf2e3f={'UserId':_0x951ce[_0x5141c0('0xe')]['id']};_0xcf2e3f[_[_0x5141c0('0x83')](_0x951ce[_0x5141c0('0x97')][_0x5141c0('0x13a')]['toLowerCase']())+_0x5141c0('0xa8')]=_0x951ce['query']['ids'][_0x21956c],socket[_0x5141c0('0xea')]('user'+_[_0x5141c0('0x83')](_0x951ce['query'][_0x5141c0('0x13a')][_0x5141c0('0x13e')]())+_0x5141c0('0x140'),_0xcf2e3f);}return _0x455c28;})['then'](function(){const _0x55f0fb=_0x26af6d;if(_0x951ce['query']['channel']===_0x55f0fb('0x153'))return db[_0x55f0fb('0x40')][_0x55f0fb('0xe3')]({'where':{'UserId':_0x951ce['params']['id'],'VoiceQueueId':_0x951ce['query'][_0x55f0fb('0x76')]},'individualHooks':!![]})[_0x55f0fb('0x5b')](function(){return _0x3e80a8;});return _0x3e80a8;})[_0x26af6d('0x5b')](respondWithStatusCode(_0x1d46f7,null))[_0x26af6d('0x139')](handleError(_0x1d46f7,null));},exports[_0x15d5b3('0x14c')]=function(_0x20b386,_0x13ed97){const _0x2758a3=_0x15d5b3;return _0x20b386[_0x2758a3('0x10c')][_0x2758a3('0x4c')]=_0x20b386[_0x2758a3('0x49')][_0x2758a3('0x14d')],db['User'][_0x2758a3('0x12d')]({'where':{'id':_0x20b386[_0x2758a3('0xe')]['id']}})[_0x2758a3('0x5b')](handleEntityNotFound(_0x13ed97,null))[_0x2758a3('0x5b')](saveUpdates(_0x20b386[_0x2758a3('0x10c')],null))[_0x2758a3('0x5b')](respondWithResult(_0x13ed97,null))[_0x2758a3('0x139')](handleError(_0x13ed97,null));},exports['getAvatar']=function(_0x53e62a,_0x482e99){const _0x4f1ce8=_0x15d5b3,_0x2e20ee=path['join'](config[_0x4f1ce8('0x136')],_0x4f1ce8('0x1c'));return db['User'][_0x4f1ce8('0x12d')]({'where':{'id':_0x53e62a[_0x4f1ce8('0xe')]['id']},'attributes':['id',_0x4f1ce8('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x482e99,null))['then'](function(_0x3d7032){const _0x36855d=_0x4f1ce8;if(_0x3d7032){if(_[_0x36855d('0x99')](_0x3d7032['userpic']))return _0x482e99['download'](_0x2e20ee);else{if(!fs['existsSync'](path[_0x36855d('0x119')](config[_0x36855d('0x136')],_0x36855d('0x10b'),_0x3d7032['userpic'])))return _0x482e99[_0x36855d('0x27')](_0x2e20ee);return _0x482e99[_0x36855d('0x27')](path[_0x36855d('0x119')](config['root'],'files/images/',_0x3d7032[_0x36855d('0x4c')]));}}})[_0x4f1ce8('0x139')](handleError(_0x482e99,null));},exports['getContacts']=function(_0x18cfdb,_0x230db9){const _0x338e43=_0x15d5b3;let _0x43a044={};const _0x108842={};let _0x4118f2,_0xb1e0cc;return db[_0x338e43('0xf1')][_0x338e43('0x12d')]({'where':{'id':_0x18cfdb['params']['id']}})['then'](handleEntityNotFound(_0x230db9,null))[_0x338e43('0x5b')](function(_0x3ab652){const _0x293e32=_0x338e43;if(_0x3ab652)return _0x4118f2=_0x3ab652,_0x108842[_0x293e32('0x142')]=_[_0x293e32('0x14e')](db[_0x293e32('0x8')][_0x293e32('0x13c')]),_0x108842['query']=_[_0x293e32('0x14e')](_0x18cfdb['query']),_0x108842[_0x293e32('0x38')]=_[_0x293e32('0xdf')](_0x108842[_0x293e32('0x142')],_0x108842[_0x293e32('0x97')]),_0x43a044[_0x293e32('0xd6')]=_['intersection'](_0x108842['model'],qs[_0x293e32('0x11')](_0x18cfdb[_0x293e32('0x97')]['fields'])),_0x43a044[_0x293e32('0xd6')]=_0x43a044[_0x293e32('0xd6')]['length']?_0x43a044[_0x293e32('0xd6')]:_0x108842[_0x293e32('0x142')],_0x43a044[_0x293e32('0xec')]=qs[_0x293e32('0x15c')](_0x18cfdb[_0x293e32('0x97')][_0x293e32('0x15c')]),_0x43a044[_0x293e32('0xbc')]=qs[_0x293e32('0x38')](_[_0x293e32('0x6d')](_0x18cfdb[_0x293e32('0x97')],_0x108842[_0x293e32('0x38')])),_0x18cfdb['query'][_0x293e32('0x138')]&&(_0x43a044[_0x293e32('0xbc')]=_[_0x293e32('0xf4')](_0x43a044[_0x293e32('0xbc')],{[Op['or']]:_[_0x293e32('0x58')](_0x43a044[_0x293e32('0xd6')],function(_0x5795dd){const _0x287fde=_0x293e32,_0x3a8020={};return _0x3a8020[_0x5795dd]={[Op[_0x287fde('0x13d')]]:'%'+_0x18cfdb[_0x287fde('0x97')][_0x287fde('0x138')]+'%'},_0x3a8020;})})),_0x43a044=_[_0x293e32('0xf4')]({},_0x43a044,_0x18cfdb['options']),_0x4118f2[_0x293e32('0x3a')](_0x43a044);})[_0x338e43('0x5b')](function(_0xf0ed1){const _0x89c0e2=_0x338e43;if(_0xf0ed1)return _0xb1e0cc=_0xf0ed1['length'],typeof _0x18cfdb[_0x89c0e2('0x97')][_0x89c0e2('0x117')]!==_0x89c0e2('0x6c')&&(_0x43a044[_0x89c0e2('0x39')]=[{'model':db[_0x89c0e2('0x5')],'as':_0x89c0e2('0x9b'),'required':![]},{'model':db[_0x89c0e2('0x98')],'as':'Tags','attributes':['id','name',_0x89c0e2('0x3')],'where':_0x18cfdb['query'][_0x89c0e2('0xbb')]?{'id':_0x18cfdb[_0x89c0e2('0x97')][_0x89c0e2('0xbb')]}:undefined,'required':_0x18cfdb['query'][_0x89c0e2('0xbb')]?!![]:![]}]),typeof _0x18cfdb['query'][_0x89c0e2('0x48')]===_0x89c0e2('0x6c')&&(_0x43a044[_0x89c0e2('0x7a')]=qs[_0x89c0e2('0x7a')](_0x18cfdb[_0x89c0e2('0x97')]['limit']),_0x43a044['offset']=qs[_0x89c0e2('0x12a')](_0x18cfdb[_0x89c0e2('0x97')][_0x89c0e2('0x12a')])),_0x4118f2[_0x89c0e2('0x3a')](_0x43a044);})[_0x338e43('0x5b')](function(_0x274686){if(_0x274686)return _0x274686?{'count':_0xb1e0cc,'rows':_0x274686}:null;})[_0x338e43('0x5b')](respondWithResult(_0x230db9,null))[_0x338e43('0x139')](handleError(_0x230db9,null));},exports[_0x15d5b3('0xc9')]=function(_0x4eabef,_0x181ec2){const _0xef4f52=_0x15d5b3;let _0x21187e,_0x4e2fa2={},_0x4292f8;return db[_0xef4f52('0xf1')][_0xef4f52('0x12d')]({'where':{'id':_0x4eabef[_0xef4f52('0xe')]['id']},'attributes':['id',_0xef4f52('0x32'),_0xef4f52('0x86')]})['then'](handleEntityNotFound(_0x181ec2,null))[_0xef4f52('0x5b')](function(_0x4ea584){const _0x258a6a=_0xef4f52;if(!utils[_0x258a6a('0x11a')](_0x4eabef[_0x258a6a('0x97')]['channel']))throw new ValidationError('Unknown\x20channel');_0x21187e=_0x4ea584;const _0x48be07={};_0x48be07['model']=_[_0x258a6a('0x14e')](db[_['capitalize'](_0x4eabef[_0x258a6a('0x97')][_0x258a6a('0x13a')])+'Queue']['rawAttributes']),_0x48be07[_0x258a6a('0x97')]=_['keys'](_0x4eabef[_0x258a6a('0x97')]),_0x48be07[_0x258a6a('0x38')]=_['intersection'](_0x48be07[_0x258a6a('0x142')],_0x48be07[_0x258a6a('0x97')]),_0x4e2fa2[_0x258a6a('0xd6')]=_['intersection'](_0x48be07[_0x258a6a('0x142')],qs['fields'](_0x4eabef[_0x258a6a('0x97')][_0x258a6a('0x11')])),_0x4e2fa2[_0x258a6a('0xd6')]=_0x4e2fa2[_0x258a6a('0xd6')]['length']?_0x4e2fa2[_0x258a6a('0xd6')]:_0x48be07[_0x258a6a('0x142')],_0x4e2fa2[_0x258a6a('0xec')]=qs['sort'](_0x4eabef[_0x258a6a('0x97')][_0x258a6a('0x15c')]),_0x4e2fa2[_0x258a6a('0xbc')]=qs['filters'](_[_0x258a6a('0x6d')](_0x4eabef[_0x258a6a('0x97')],_0x48be07[_0x258a6a('0x38')]));_0x4eabef['query'][_0x258a6a('0x138')]&&(_0x4e2fa2[_0x258a6a('0xbc')]=_[_0x258a6a('0xf4')](_0x4e2fa2[_0x258a6a('0xbc')],{[Op['or']]:_[_0x258a6a('0x58')](_0x4e2fa2['attributes'],function(_0x437278){const _0x23d7b1=_0x258a6a,_0x2692e5={};return _0x2692e5[_0x437278]={[Op['like']]:'%'+_0x4eabef[_0x23d7b1('0x97')]['filter']+'%'},_0x2692e5;})}));_0x4e2fa2=_[_0x258a6a('0xf4')]({},_0x4e2fa2,_0x4eabef['options']);switch(_0x21187e[_0x258a6a('0x86')]){case'admin':return db[_[_0x258a6a('0x83')](_0x4eabef[_0x258a6a('0x97')]['channel'])+_0x258a6a('0x50')]['findAll'](_0x4e2fa2);case _0x258a6a('0x5d'):case _0x258a6a('0x145'):return _0x21187e['get'+_[_0x258a6a('0x83')](_0x4eabef[_0x258a6a('0x97')][_0x258a6a('0x13a')])+_0x258a6a('0x134')](_0x4e2fa2);default:throw new ValidationError(_0x258a6a('0xf2'));}})[_0xef4f52('0x5b')](function(_0xd7b210){const _0x7343f2=_0xef4f52;_0x4292f8=_0xd7b210[_0x7343f2('0x12e')];typeof _0x4eabef['query'][_0x7343f2('0x48')]===_0x7343f2('0x6c')&&(_0x4e2fa2[_0x7343f2('0x7a')]=qs['limit'](_0x4eabef[_0x7343f2('0x97')][_0x7343f2('0x7a')]),_0x4e2fa2[_0x7343f2('0x12a')]=qs[_0x7343f2('0x12a')](_0x4eabef[_0x7343f2('0x97')]['offset']));switch(_0x21187e['role']){case _0x7343f2('0x66'):return db[_[_0x7343f2('0x83')](_0x4eabef[_0x7343f2('0x97')][_0x7343f2('0x13a')])+_0x7343f2('0x50')][_0x7343f2('0xeb')](_0x4e2fa2);case'user':case'agent':return _0x21187e[_0x7343f2('0x1e')+_[_0x7343f2('0x83')](_0x4eabef[_0x7343f2('0x97')][_0x7343f2('0x13a')])+_0x7343f2('0x134')](_0x4e2fa2);}})[_0xef4f52('0x5b')](function(_0x4c78a6){return{'count':_0x4292f8,'rows':_0x4c78a6};})[_0xef4f52('0x5b')](respondWithResult(_0x181ec2,null))['catch'](handleError(_0x181ec2,null));},exports[_0x15d5b3('0x4d')]=function(_0x4e0c83,_0x3f488a){const _0x472f63=_0x15d5b3;let _0xad0e05={};const _0x449ea9={};let _0x270c01,_0x16deb5;return db['User'][_0x472f63('0x12d')]({'where':{'id':_0x4e0c83[_0x472f63('0xe')]['id']}})[_0x472f63('0x5b')](handleEntityNotFound(_0x3f488a,null))[_0x472f63('0x5b')](function(_0x20cfd1){const _0x1f400a=_0x472f63;if(_0x20cfd1)return _0x270c01=_0x20cfd1,_0x449ea9[_0x1f400a('0x142')]=_['keys'](db[_0x1f400a('0x40')]['rawAttributes']),_0x449ea9[_0x1f400a('0x97')]=_[_0x1f400a('0x14e')](_0x4e0c83[_0x1f400a('0x97')]),_0x449ea9[_0x1f400a('0x38')]=_[_0x1f400a('0xdf')](_0x449ea9[_0x1f400a('0x142')],_0x449ea9[_0x1f400a('0x97')]),_0xad0e05[_0x1f400a('0xd6')]=_['intersection'](_0x449ea9[_0x1f400a('0x142')],qs[_0x1f400a('0x11')](_0x4e0c83['query'][_0x1f400a('0x11')])),_0xad0e05[_0x1f400a('0xd6')]=_0xad0e05[_0x1f400a('0xd6')]['length']?_0xad0e05[_0x1f400a('0xd6')]:_0x449ea9[_0x1f400a('0x142')],_0xad0e05[_0x1f400a('0xec')]=qs['sort'](_0x4e0c83[_0x1f400a('0x97')][_0x1f400a('0x15c')]),_0xad0e05['where']=qs[_0x1f400a('0x38')](_[_0x1f400a('0x6d')](_0x4e0c83[_0x1f400a('0x97')],_0x449ea9[_0x1f400a('0x38')])),_0x4e0c83[_0x1f400a('0x97')]['filter']&&(_0xad0e05[_0x1f400a('0xbc')]=_[_0x1f400a('0xf4')](_0xad0e05[_0x1f400a('0xbc')],{[Op['or']]:_[_0x1f400a('0x58')](_0xad0e05[_0x1f400a('0xd6')],function(_0x3f7852){const _0x55e8a3=_0x1f400a,_0x2d8587={};return _0x2d8587[_0x3f7852]={[Op[_0x55e8a3('0x13d')]]:'%'+_0x4e0c83[_0x55e8a3('0x97')]['filter']+'%'},_0x2d8587;})})),_0xad0e05=_[_0x1f400a('0xf4')]({},_0xad0e05,_0x4e0c83['options']),_0x270c01[_0x1f400a('0x4d')](_0xad0e05);})[_0x472f63('0x5b')](function(_0x48285b){const _0x521546=_0x472f63;if(_0x48285b)return _0x16deb5=_0x48285b[_0x521546('0x12e')],typeof _0x4e0c83[_0x521546('0x97')]['nolimit']===_0x521546('0x6c')&&(_0xad0e05[_0x521546('0x7a')]=qs[_0x521546('0x7a')](_0x4e0c83[_0x521546('0x97')][_0x521546('0x7a')]),_0xad0e05['offset']=qs[_0x521546('0x12a')](_0x4e0c83[_0x521546('0x97')]['offset'])),_0x270c01[_0x521546('0x4d')](_0xad0e05);})[_0x472f63('0x5b')](function(_0xe83e65){if(_0xe83e65)return _0xe83e65?{'count':_0x16deb5,'rows':_0xe83e65}:null;})[_0x472f63('0x5b')](respondWithResult(_0x3f488a,null))['catch'](handleError(_0x3f488a,null));},exports[_0x15d5b3('0x80')]=function(_0x31c6cd,_0x609017){const _0x25e46d=_0x15d5b3;let _0x468977={};const _0x541cfa={};let _0x2e45bb,_0xdacbc9;return db[_0x25e46d('0xf1')][_0x25e46d('0x12d')]({'where':{'id':_0x31c6cd[_0x25e46d('0xe')]['id']}})[_0x25e46d('0x5b')](handleEntityNotFound(_0x609017,null))['then'](function(_0x3c5270){const _0x5c9e5=_0x25e46d;if(_0x3c5270)return _0x2e45bb=_0x3c5270,_0x541cfa[_0x5c9e5('0x142')]=_[_0x5c9e5('0x14e')](db[_0x5c9e5('0x137')][_0x5c9e5('0x13c')]),_0x541cfa['query']=_[_0x5c9e5('0x14e')](_0x31c6cd[_0x5c9e5('0x97')]),_0x541cfa[_0x5c9e5('0x38')]=_[_0x5c9e5('0xdf')](_0x541cfa[_0x5c9e5('0x142')],_0x541cfa[_0x5c9e5('0x97')]),_0x468977[_0x5c9e5('0xd6')]=_[_0x5c9e5('0xdf')](_0x541cfa[_0x5c9e5('0x142')],qs[_0x5c9e5('0x11')](_0x31c6cd[_0x5c9e5('0x97')]['fields'])),_0x468977['attributes']=_0x468977[_0x5c9e5('0xd6')][_0x5c9e5('0x12e')]?_0x468977[_0x5c9e5('0xd6')]:_0x541cfa[_0x5c9e5('0x142')],_0x468977[_0x5c9e5('0xec')]=qs[_0x5c9e5('0x15c')](_0x31c6cd[_0x5c9e5('0x97')]['sort']),_0x468977[_0x5c9e5('0xbc')]=qs['filters'](_[_0x5c9e5('0x6d')](_0x31c6cd[_0x5c9e5('0x97')],_0x541cfa[_0x5c9e5('0x38')])),_0x31c6cd[_0x5c9e5('0x97')]['filter']&&(_0x468977[_0x5c9e5('0xbc')]=_[_0x5c9e5('0xf4')](_0x468977[_0x5c9e5('0xbc')],{[Op['or']]:_['map'](_0x468977['attributes'],function(_0x35e2d5){const _0x22d3b1=_0x5c9e5,_0xc11809={};return _0xc11809[_0x35e2d5]={[Op[_0x22d3b1('0x13d')]]:'%'+_0x31c6cd[_0x22d3b1('0x97')][_0x22d3b1('0x138')]+'%'},_0xc11809;})})),_0x468977=_[_0x5c9e5('0xf4')]({},_0x468977,_0x31c6cd['options']),_0x2e45bb[_0x5c9e5('0x80')](_0x468977);})[_0x25e46d('0x5b')](function(_0x28ad34){const _0x237fe0=_0x25e46d;if(_0x28ad34)return _0xdacbc9=_0x28ad34[_0x237fe0('0x12e')],typeof _0x31c6cd[_0x237fe0('0x97')][_0x237fe0('0x48')]===_0x237fe0('0x6c')&&(_0x468977['limit']=qs[_0x237fe0('0x7a')](_0x31c6cd[_0x237fe0('0x97')]['limit']),_0x468977[_0x237fe0('0x12a')]=qs[_0x237fe0('0x12a')](_0x31c6cd[_0x237fe0('0x97')][_0x237fe0('0x12a')])),_0x2e45bb[_0x237fe0('0x80')](_0x468977);})[_0x25e46d('0x5b')](function(_0xb24677){if(_0xb24677)return _0xb24677?{'count':_0xdacbc9,'rows':_0xb24677}:null;})['then'](respondWithResult(_0x609017,null))[_0x25e46d('0x139')](handleError(_0x609017,null));},exports[_0x15d5b3('0x47')]=function(_0x29fd25,_0x297b20){const _0x515afe=_0x15d5b3;let _0x1b81f2={'raw':!![],'where':{}};const _0x3659dd={},_0x7df45={'count':0x0,'rows':[]};return db[_0x515afe('0xf1')][_0x515afe('0x12d')]({'where':{'id':_0x29fd25[_0x515afe('0xe')]['id']}})['then'](handleEntityNotFound(_0x297b20,null))[_0x515afe('0x5b')](function(_0x6233df){const _0x1caf24=_0x515afe;if(_0x6233df)return _0x3659dd[_0x1caf24('0x142')]=_['keys'](db[_0x1caf24('0x9c')][_0x1caf24('0x13c')]),_0x3659dd['query']=_[_0x1caf24('0x14e')](_0x29fd25[_0x1caf24('0x97')]),_0x3659dd[_0x1caf24('0x38')]=_[_0x1caf24('0xdf')](_0x3659dd[_0x1caf24('0x142')],_0x3659dd[_0x1caf24('0x97')]),_0x1b81f2['attributes']=_[_0x1caf24('0xdf')](_0x3659dd['model'],qs[_0x1caf24('0x11')](_0x29fd25[_0x1caf24('0x97')][_0x1caf24('0x11')])),_0x1b81f2[_0x1caf24('0xd6')]=_0x1b81f2[_0x1caf24('0xd6')][_0x1caf24('0x12e')]?_0x1b81f2[_0x1caf24('0xd6')]:_0x3659dd[_0x1caf24('0x142')],typeof _0x29fd25[_0x1caf24('0x97')][_0x1caf24('0x48')]==='undefined'&&(_0x1b81f2[_0x1caf24('0x7a')]=qs['limit'](_0x29fd25[_0x1caf24('0x97')][_0x1caf24('0x7a')]),_0x1b81f2[_0x1caf24('0x12a')]=qs[_0x1caf24('0x12a')](_0x29fd25[_0x1caf24('0x97')][_0x1caf24('0x12a')])),_0x1b81f2[_0x1caf24('0xec')]=qs[_0x1caf24('0x15c')](_0x29fd25[_0x1caf24('0x97')][_0x1caf24('0x15c')]),_0x1b81f2[_0x1caf24('0xbc')]=qs[_0x1caf24('0x38')](_[_0x1caf24('0x6d')](_0x29fd25['query'],_0x3659dd[_0x1caf24('0x38')])),_0x1b81f2[_0x1caf24('0xbc')][_0x1caf24('0x13f')]=_0x6233df['id'],_0x29fd25[_0x1caf24('0x97')][_0x1caf24('0x138')]&&(_0x1b81f2[_0x1caf24('0xbc')]=_[_0x1caf24('0xf4')](_0x1b81f2[_0x1caf24('0xbc')],{[Op['or']]:_['map'](_0x1b81f2[_0x1caf24('0xd6')],function(_0xe5bef8){const _0xd8fff8=_0x1caf24,_0x3c15be={};return _0x3c15be[_0xe5bef8]={[Op[_0xd8fff8('0x13d')]]:'%'+_0x29fd25[_0xd8fff8('0x97')][_0xd8fff8('0x138')]+'%'},_0x3c15be;})})),_0x1b81f2=_[_0x1caf24('0xf4')]({},_0x1b81f2,_0x29fd25['options']),db[_0x1caf24('0x9c')][_0x1caf24('0xf0')]({'where':_0x1b81f2['where']})[_0x1caf24('0x5b')](function(_0x410577){const _0x32accc=_0x1caf24;return _0x7df45[_0x32accc('0xf0')]=_0x410577,_0x29fd25[_0x32accc('0x97')]['includeAll']&&(_0x1b81f2['include']=[{'all':!![]}]),db[_0x32accc('0x9c')]['findAll'](_0x1b81f2);})['then'](function(_0x187b44){const _0x5cfd15=_0x1caf24;return _0x7df45[_0x5cfd15('0x110')]=_0x187b44,_0x7df45;});})[_0x515afe('0x5b')](respondWithFilteredResult(_0x297b20,_0x1b81f2))[_0x515afe('0x139')](handleError(_0x297b20,null));},exports[_0x15d5b3('0xb0')]=function(_0x55ebae,_0xd46bee){const _0x33eafc=_0x15d5b3;let _0x4b021f={'raw':!![],'where':{}};const _0x1f1f78={},_0x35dab3={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x55ebae[_0x33eafc('0xe')]['id']}})[_0x33eafc('0x5b')](handleEntityNotFound(_0xd46bee,null))[_0x33eafc('0x5b')](function(_0x34dc3e){const _0x34b942=_0x33eafc;if(_0x34dc3e)return _0x1f1f78['model']=_[_0x34b942('0x14e')](db[_0x34b942('0x13')][_0x34b942('0x13c')]),_0x1f1f78[_0x34b942('0x97')]=_[_0x34b942('0x14e')](_0x55ebae[_0x34b942('0x97')]),_0x1f1f78['filters']=_[_0x34b942('0xdf')](_0x1f1f78[_0x34b942('0x142')],_0x1f1f78[_0x34b942('0x97')]),_0x4b021f[_0x34b942('0xd6')]=_[_0x34b942('0xdf')](_0x1f1f78[_0x34b942('0x142')],qs['fields'](_0x55ebae[_0x34b942('0x97')][_0x34b942('0x11')])),_0x4b021f['attributes']=_0x4b021f[_0x34b942('0xd6')]['length']?_0x4b021f[_0x34b942('0xd6')]:_0x1f1f78[_0x34b942('0x142')],typeof _0x55ebae['query'][_0x34b942('0x48')]===_0x34b942('0x6c')&&(_0x4b021f['limit']=qs[_0x34b942('0x7a')](_0x55ebae['query'][_0x34b942('0x7a')]),_0x4b021f[_0x34b942('0x12a')]=qs[_0x34b942('0x12a')](_0x55ebae[_0x34b942('0x97')][_0x34b942('0x12a')])),_0x4b021f[_0x34b942('0xec')]=qs[_0x34b942('0x15c')](_0x55ebae[_0x34b942('0x97')][_0x34b942('0x15c')]),_0x4b021f[_0x34b942('0xbc')]=qs[_0x34b942('0x38')](_['pick'](_0x55ebae[_0x34b942('0x97')],_0x1f1f78['filters'])),_0x4b021f[_0x34b942('0xbc')]['UserId']=_0x34dc3e['id'],_0x55ebae['query']['filter']&&(_0x4b021f[_0x34b942('0xbc')]=_['merge'](_0x4b021f['where'],{[Op['or']]:_['map'](_0x4b021f[_0x34b942('0xd6')],function(_0x457903){const _0x355eaa=_0x34b942,_0x34e031={};return _0x34e031[_0x457903]={[Op[_0x355eaa('0x13d')]]:'%'+_0x55ebae[_0x355eaa('0x97')][_0x355eaa('0x138')]+'%'},_0x34e031;})})),_0x4b021f=_['merge']({},_0x4b021f,_0x55ebae[_0x34b942('0xf5')]),db[_0x34b942('0x13')][_0x34b942('0xf0')]({'where':_0x4b021f['where']})['then'](function(_0x50b46c){const _0x10b650=_0x34b942;return _0x35dab3[_0x10b650('0xf0')]=_0x50b46c,_0x55ebae[_0x10b650('0x97')][_0x10b650('0x117')]&&(_0x4b021f[_0x10b650('0x39')]=[{'all':!![]}]),db['ScreenRecording']['findAll'](_0x4b021f);})[_0x34b942('0x5b')](function(_0x74669){const _0x1ab134=_0x34b942;return _0x35dab3[_0x1ab134('0x110')]=_0x74669,_0x35dab3;});})['then'](respondWithFilteredResult(_0xd46bee,_0x4b021f))[_0x33eafc('0x139')](handleError(_0xd46bee,null));},exports[_0x15d5b3('0x132')]=function(_0x4b8f88,_0x59de8d){const _0x59603a=_0x15d5b3;let _0x2709c2={};const _0x2e7011={};let _0x21f67b,_0x499192;return db[_0x59603a('0xf1')][_0x59603a('0x12d')]({'where':{'id':_0x4b8f88['params']['id']}})[_0x59603a('0x5b')](handleEntityNotFound(_0x59de8d,null))[_0x59603a('0x5b')](function(_0x345c2c){const _0x217fe6=_0x59603a;if(_0x345c2c)return _0x21f67b=_0x345c2c,_0x2e7011[_0x217fe6('0x142')]=_[_0x217fe6('0x14e')](db['ChatInteraction'][_0x217fe6('0x13c')]),_0x2e7011[_0x217fe6('0x97')]=_['keys'](_0x4b8f88[_0x217fe6('0x97')]),_0x2e7011[_0x217fe6('0x38')]=_['intersection'](_0x2e7011[_0x217fe6('0x142')],_0x2e7011[_0x217fe6('0x97')]),_0x2709c2['attributes']=_[_0x217fe6('0xdf')](_0x2e7011[_0x217fe6('0x142')],qs[_0x217fe6('0x11')](_0x4b8f88['query'][_0x217fe6('0x11')])),_0x2709c2['attributes']=_0x2709c2['attributes'][_0x217fe6('0x12e')]?_0x2709c2[_0x217fe6('0xd6')]:_0x2e7011['model'],_0x2709c2['order']=qs[_0x217fe6('0x15c')](_0x4b8f88[_0x217fe6('0x97')]['sort']),_0x2709c2['where']=qs[_0x217fe6('0x38')](_[_0x217fe6('0x6d')](_0x4b8f88[_0x217fe6('0x97')],_0x2e7011[_0x217fe6('0x38')])),_0x4b8f88[_0x217fe6('0x97')]['filter']&&(_0x2709c2[_0x217fe6('0xbc')]=_[_0x217fe6('0xf4')](_0x2709c2[_0x217fe6('0xbc')],{[Op['or']]:_[_0x217fe6('0x58')](_0x2709c2[_0x217fe6('0xd6')],function(_0xd23999){const _0x8976e7=_0x217fe6,_0x1f7882={};return _0x1f7882[_0xd23999]={[Op[_0x8976e7('0x13d')]]:'%'+_0x4b8f88[_0x8976e7('0x97')][_0x8976e7('0x138')]+'%'},_0x1f7882;})})),_0x2709c2=_['merge']({},_0x2709c2,_0x4b8f88[_0x217fe6('0xf5')]),_0x21f67b['getChatInteractions'](_0x2709c2);})[_0x59603a('0x5b')](function(_0x49099a){const _0x4bfeb4=_0x59603a;if(_0x49099a)return _0x499192=_0x49099a[_0x4bfeb4('0x12e')],typeof _0x4b8f88[_0x4bfeb4('0x97')][_0x4bfeb4('0x48')]===_0x4bfeb4('0x6c')&&(_0x2709c2['limit']=qs['limit'](_0x4b8f88[_0x4bfeb4('0x97')]['limit']),_0x2709c2['offset']=qs[_0x4bfeb4('0x12a')](_0x4b8f88[_0x4bfeb4('0x97')][_0x4bfeb4('0x12a')])),_0x21f67b[_0x4bfeb4('0x132')](_0x2709c2);})[_0x59603a('0x5b')](function(_0x546294){if(_0x546294)return _0x546294?{'count':_0x499192,'rows':_0x546294}:null;})[_0x59603a('0x5b')](respondWithResult(_0x59de8d,null))['catch'](handleError(_0x59de8d,null));},exports['getOpenchannelInteractions']=function(_0x408002,_0x5c0499){const _0x3d9c0b=_0x15d5b3;let _0x390da6={};const _0x50e775={};let _0x580b6b,_0xa1fe25;return db[_0x3d9c0b('0xf1')][_0x3d9c0b('0x12d')]({'where':{'id':_0x408002[_0x3d9c0b('0xe')]['id']}})[_0x3d9c0b('0x5b')](handleEntityNotFound(_0x5c0499,null))[_0x3d9c0b('0x5b')](function(_0x98840f){const _0x50328e=_0x3d9c0b;if(_0x98840f)return _0x580b6b=_0x98840f,_0x50e775['model']=_['keys'](db[_0x50328e('0x70')][_0x50328e('0x13c')]),_0x50e775[_0x50328e('0x97')]=_[_0x50328e('0x14e')](_0x408002[_0x50328e('0x97')]),_0x50e775[_0x50328e('0x38')]=_['intersection'](_0x50e775[_0x50328e('0x142')],_0x50e775[_0x50328e('0x97')]),_0x390da6[_0x50328e('0xd6')]=_[_0x50328e('0xdf')](_0x50e775[_0x50328e('0x142')],qs[_0x50328e('0x11')](_0x408002[_0x50328e('0x97')]['fields'])),_0x390da6[_0x50328e('0xd6')]=_0x390da6[_0x50328e('0xd6')][_0x50328e('0x12e')]?_0x390da6[_0x50328e('0xd6')]:_0x50e775[_0x50328e('0x142')],_0x390da6['order']=qs[_0x50328e('0x15c')](_0x408002[_0x50328e('0x97')][_0x50328e('0x15c')]),_0x390da6[_0x50328e('0xbc')]=qs[_0x50328e('0x38')](_[_0x50328e('0x6d')](_0x408002[_0x50328e('0x97')],_0x50e775[_0x50328e('0x38')])),_0x408002[_0x50328e('0x97')][_0x50328e('0x138')]&&(_0x390da6[_0x50328e('0xbc')]=_['merge'](_0x390da6[_0x50328e('0xbc')],{[Op['or']]:_[_0x50328e('0x58')](_0x390da6[_0x50328e('0xd6')],function(_0x34d7f0){const _0x1d2f64=_0x50328e,_0x8bcc66={};return _0x8bcc66[_0x34d7f0]={[Op[_0x1d2f64('0x13d')]]:'%'+_0x408002['query'][_0x1d2f64('0x138')]+'%'},_0x8bcc66;})})),_0x390da6=_[_0x50328e('0xf4')]({},_0x390da6,_0x408002[_0x50328e('0xf5')]),_0x580b6b[_0x50328e('0x123')](_0x390da6);})[_0x3d9c0b('0x5b')](function(_0x5f57ff){const _0x107aa4=_0x3d9c0b;if(_0x5f57ff)return _0xa1fe25=_0x5f57ff[_0x107aa4('0x12e')],typeof _0x408002[_0x107aa4('0x97')][_0x107aa4('0x48')]===_0x107aa4('0x6c')&&(_0x390da6[_0x107aa4('0x7a')]=qs['limit'](_0x408002[_0x107aa4('0x97')][_0x107aa4('0x7a')]),_0x390da6[_0x107aa4('0x12a')]=qs['offset'](_0x408002[_0x107aa4('0x97')][_0x107aa4('0x12a')])),_0x580b6b['getOpenchannelInteractions'](_0x390da6);})['then'](function(_0x566ef0){if(_0x566ef0)return _0x566ef0?{'count':_0xa1fe25,'rows':_0x566ef0}:null;})[_0x3d9c0b('0x5b')](respondWithResult(_0x5c0499,null))[_0x3d9c0b('0x139')](handleError(_0x5c0499,null));},exports[_0x15d5b3('0xfd')]=function(_0x2fa5ec,_0x2e089b){const _0x34793f=_0x15d5b3;let _0x1e7307={'raw':!![],'where':{}};const _0x299c52={},_0x52b22d={'count':0x0,'rows':[]};return db[_0x34793f('0xf1')]['findOne']({'where':{'id':_0x2fa5ec[_0x34793f('0xe')]['id']}})[_0x34793f('0x5b')](handleEntityNotFound(_0x2e089b,null))[_0x34793f('0x5b')](function(_0x3eee1a){const _0x413323=_0x34793f;if(_0x3eee1a)return _0x299c52[_0x413323('0x142')]=_[_0x413323('0x14e')](db['MailInteraction']['rawAttributes']),_0x299c52[_0x413323('0x97')]=_[_0x413323('0x14e')](_0x2fa5ec['query']),_0x299c52[_0x413323('0x38')]=_['intersection'](_0x299c52[_0x413323('0x142')],_0x299c52['query']),_0x1e7307[_0x413323('0xd6')]=_[_0x413323('0xdf')](_0x299c52['model'],qs['fields'](_0x2fa5ec['query'][_0x413323('0x11')])),_0x1e7307[_0x413323('0xd6')]=_0x1e7307[_0x413323('0xd6')][_0x413323('0x12e')]?_0x1e7307[_0x413323('0xd6')]:_0x299c52[_0x413323('0x142')],typeof _0x2fa5ec[_0x413323('0x97')]['nolimit']==='undefined'&&(_0x1e7307[_0x413323('0x7a')]=qs[_0x413323('0x7a')](_0x2fa5ec[_0x413323('0x97')][_0x413323('0x7a')]),_0x1e7307[_0x413323('0x12a')]=qs[_0x413323('0x12a')](_0x2fa5ec[_0x413323('0x97')][_0x413323('0x12a')])),_0x1e7307['order']=qs[_0x413323('0x15c')](_0x2fa5ec[_0x413323('0x97')][_0x413323('0x15c')]),_0x1e7307['where']=qs[_0x413323('0x38')](_[_0x413323('0x6d')](_0x2fa5ec[_0x413323('0x97')],_0x299c52[_0x413323('0x38')])),_0x1e7307[_0x413323('0xbc')][_0x413323('0x13f')]=_0x3eee1a['id'],_0x2fa5ec[_0x413323('0x97')][_0x413323('0x138')]&&(_0x1e7307[_0x413323('0xbc')]=_['merge'](_0x1e7307[_0x413323('0xbc')],{[Op['or']]:_['map'](_0x1e7307[_0x413323('0xd6')],function(_0x11cc00){const _0x235a46=_0x413323,_0x3fd997={};return _0x3fd997[_0x11cc00]={[Op[_0x235a46('0x13d')]]:'%'+_0x2fa5ec[_0x235a46('0x97')][_0x235a46('0x138')]+'%'},_0x3fd997;})})),_0x1e7307=_[_0x413323('0xf4')]({},_0x1e7307,_0x2fa5ec[_0x413323('0xf5')]),db[_0x413323('0xc8')][_0x413323('0xf0')]({'where':_0x1e7307[_0x413323('0xbc')]})[_0x413323('0x5b')](function(_0x55baf6){const _0x41689d=_0x413323;return _0x52b22d[_0x41689d('0xf0')]=_0x55baf6,_0x2fa5ec['query'][_0x41689d('0x117')]&&(_0x1e7307[_0x41689d('0x39')]=[{'all':!![]}]),db[_0x41689d('0xc8')][_0x41689d('0xeb')](_0x1e7307);})[_0x413323('0x5b')](function(_0x5d9a84){const _0x2c504e=_0x413323;return _0x52b22d[_0x2c504e('0x110')]=_0x5d9a84,_0x52b22d;});})[_0x34793f('0x5b')](respondWithFilteredResult(_0x2e089b,_0x1e7307))[_0x34793f('0x139')](handleError(_0x2e089b,null));},exports['getSmsInteractions']=function(_0x52fe39,_0x1cc346){const _0x652d63=_0x15d5b3;let _0x36d14f={};const _0x55cb96={};let _0x43ef79,_0x2f341d;return db[_0x652d63('0xf1')][_0x652d63('0x12d')]({'where':{'id':_0x52fe39[_0x652d63('0xe')]['id']}})['then'](handleEntityNotFound(_0x1cc346,null))[_0x652d63('0x5b')](function(_0x575b55){const _0x2c328c=_0x652d63;if(_0x575b55)return _0x43ef79=_0x575b55,_0x55cb96[_0x2c328c('0x142')]=_['keys'](db[_0x2c328c('0x44')][_0x2c328c('0x13c')]),_0x55cb96[_0x2c328c('0x97')]=_[_0x2c328c('0x14e')](_0x52fe39[_0x2c328c('0x97')]),_0x55cb96[_0x2c328c('0x38')]=_[_0x2c328c('0xdf')](_0x55cb96[_0x2c328c('0x142')],_0x55cb96[_0x2c328c('0x97')]),_0x36d14f[_0x2c328c('0xd6')]=_['intersection'](_0x55cb96[_0x2c328c('0x142')],qs[_0x2c328c('0x11')](_0x52fe39[_0x2c328c('0x97')][_0x2c328c('0x11')])),_0x36d14f['attributes']=_0x36d14f[_0x2c328c('0xd6')][_0x2c328c('0x12e')]?_0x36d14f[_0x2c328c('0xd6')]:_0x55cb96[_0x2c328c('0x142')],_0x36d14f[_0x2c328c('0xec')]=qs[_0x2c328c('0x15c')](_0x52fe39[_0x2c328c('0x97')]['sort']),_0x36d14f[_0x2c328c('0xbc')]=qs[_0x2c328c('0x38')](_[_0x2c328c('0x6d')](_0x52fe39['query'],_0x55cb96[_0x2c328c('0x38')])),_0x52fe39[_0x2c328c('0x97')][_0x2c328c('0x138')]&&(_0x36d14f[_0x2c328c('0xbc')]=_[_0x2c328c('0xf4')](_0x36d14f[_0x2c328c('0xbc')],{[Op['or']]:_[_0x2c328c('0x58')](_0x36d14f['attributes'],function(_0x51ecfb){const _0x51e98e=_0x2c328c,_0x42d1ea={};return _0x42d1ea[_0x51ecfb]={[Op['like']]:'%'+_0x52fe39[_0x51e98e('0x97')][_0x51e98e('0x138')]+'%'},_0x42d1ea;})})),_0x36d14f=_[_0x2c328c('0xf4')]({},_0x36d14f,_0x52fe39[_0x2c328c('0xf5')]),_0x43ef79[_0x2c328c('0xb2')](_0x36d14f);})[_0x652d63('0x5b')](function(_0x22c8cd){const _0x2f0261=_0x652d63;if(_0x22c8cd)return _0x2f341d=_0x22c8cd['length'],typeof _0x52fe39['query'][_0x2f0261('0x48')]==='undefined'&&(_0x36d14f[_0x2f0261('0x7a')]=qs[_0x2f0261('0x7a')](_0x52fe39[_0x2f0261('0x97')][_0x2f0261('0x7a')]),_0x36d14f[_0x2f0261('0x12a')]=qs[_0x2f0261('0x12a')](_0x52fe39['query']['offset'])),_0x43ef79[_0x2f0261('0xb2')](_0x36d14f);})[_0x652d63('0x5b')](function(_0x47dcc8){if(_0x47dcc8)return _0x47dcc8?{'count':_0x2f341d,'rows':_0x47dcc8}:null;})[_0x652d63('0x5b')](respondWithResult(_0x1cc346,null))['catch'](handleError(_0x1cc346,null));},exports[_0x15d5b3('0xce')]=function(_0x402a4f,_0x48d408){const _0xb54038=_0x15d5b3;let _0x48957f={};const _0x4a6151={};let _0x3e2f45,_0x29f93f;return db[_0xb54038('0xf1')][_0xb54038('0x12d')]({'where':{'id':_0x402a4f[_0xb54038('0xe')]['id']}})[_0xb54038('0x5b')](handleEntityNotFound(_0x48d408,null))[_0xb54038('0x5b')](function(_0x57e2b8){const _0x4a4214=_0xb54038;if(_0x57e2b8)return _0x3e2f45=_0x57e2b8,_0x4a6151[_0x4a4214('0x142')]=_[_0x4a4214('0x14e')](db[_0x4a4214('0xd8')][_0x4a4214('0x13c')]),_0x4a6151[_0x4a4214('0x97')]=_[_0x4a4214('0x14e')](_0x402a4f[_0x4a4214('0x97')]),_0x4a6151['filters']=_[_0x4a4214('0xdf')](_0x4a6151['model'],_0x4a6151['query']),_0x48957f['attributes']=_[_0x4a4214('0xdf')](_0x4a6151[_0x4a4214('0x142')],qs[_0x4a4214('0x11')](_0x402a4f[_0x4a4214('0x97')][_0x4a4214('0x11')])),_0x48957f[_0x4a4214('0xd6')]=_0x48957f[_0x4a4214('0xd6')][_0x4a4214('0x12e')]?_0x48957f[_0x4a4214('0xd6')]:_0x4a6151[_0x4a4214('0x142')],_0x48957f[_0x4a4214('0xec')]=qs[_0x4a4214('0x15c')](_0x402a4f[_0x4a4214('0x97')]['sort']),_0x48957f[_0x4a4214('0xbc')]=qs[_0x4a4214('0x38')](_['pick'](_0x402a4f['query'],_0x4a6151[_0x4a4214('0x38')])),_0x402a4f[_0x4a4214('0x97')][_0x4a4214('0x138')]&&(_0x48957f[_0x4a4214('0xbc')]=_[_0x4a4214('0xf4')](_0x48957f[_0x4a4214('0xbc')],{[Op['or']]:_['map'](_0x48957f[_0x4a4214('0xd6')],function(_0x77657e){const _0x218a92=_0x4a4214,_0x31098d={};return _0x31098d[_0x77657e]={[Op[_0x218a92('0x13d')]]:'%'+_0x402a4f[_0x218a92('0x97')][_0x218a92('0x138')]+'%'},_0x31098d;})})),_0x48957f=_[_0x4a4214('0xf4')]({},_0x48957f,_0x402a4f['options']),_0x3e2f45[_0x4a4214('0xce')](_0x48957f);})['then'](function(_0x148a67){const _0x897137=_0xb54038;if(_0x148a67)return _0x29f93f=_0x148a67[_0x897137('0x12e')],typeof _0x402a4f[_0x897137('0x97')]['nolimit']==='undefined'&&(_0x48957f['limit']=qs[_0x897137('0x7a')](_0x402a4f[_0x897137('0x97')][_0x897137('0x7a')]),_0x48957f[_0x897137('0x12a')]=qs['offset'](_0x402a4f['query'][_0x897137('0x12a')])),_0x3e2f45[_0x897137('0xce')](_0x48957f);})[_0xb54038('0x5b')](function(_0xc75d93){if(_0xc75d93)return _0xc75d93?{'count':_0x29f93f,'rows':_0xc75d93}:null;})[_0xb54038('0x5b')](respondWithResult(_0x48d408,null))[_0xb54038('0x139')](handleError(_0x48d408,null));},exports[_0x15d5b3('0x14f')]=function(_0x1598d7,_0x3fc11a){const _0x24d494=_0x15d5b3;let _0xbdbe88={};const _0x426aec={};let _0x40ffbf,_0x456158;return db[_0x24d494('0xf1')][_0x24d494('0x12d')]({'where':{'id':_0x1598d7[_0x24d494('0xe')]['id']}})[_0x24d494('0x5b')](handleEntityNotFound(_0x3fc11a,null))['then'](function(_0x4b4b0c){const _0x20cdde=_0x24d494;if(_0x4b4b0c)return _0x40ffbf=_0x4b4b0c,_0x426aec['model']=_[_0x20cdde('0x14e')](db[_0x20cdde('0xd4')][_0x20cdde('0x13c')]),_0x426aec[_0x20cdde('0x97')]=_[_0x20cdde('0x14e')](_0x1598d7[_0x20cdde('0x97')]),_0x426aec[_0x20cdde('0x38')]=_[_0x20cdde('0xdf')](_0x426aec[_0x20cdde('0x142')],_0x426aec[_0x20cdde('0x97')]),_0xbdbe88['attributes']=_[_0x20cdde('0xdf')](_0x426aec['model'],qs['fields'](_0x1598d7['query'][_0x20cdde('0x11')])),_0xbdbe88['attributes']=_0xbdbe88[_0x20cdde('0xd6')]['length']?_0xbdbe88['attributes']:_0x426aec[_0x20cdde('0x142')],_0xbdbe88[_0x20cdde('0xec')]=qs[_0x20cdde('0x15c')](_0x1598d7[_0x20cdde('0x97')][_0x20cdde('0x15c')]),_0xbdbe88[_0x20cdde('0xbc')]=qs[_0x20cdde('0x38')](_['pick'](_0x1598d7[_0x20cdde('0x97')],_0x426aec[_0x20cdde('0x38')])),_0x1598d7[_0x20cdde('0x97')]['filter']&&(_0xbdbe88[_0x20cdde('0xbc')]=_[_0x20cdde('0xf4')](_0xbdbe88[_0x20cdde('0xbc')],{[Op['or']]:_[_0x20cdde('0x58')](_0xbdbe88[_0x20cdde('0xd6')],function(_0x5d0270){const _0x4c058a=_0x20cdde,_0x4c5869={};return _0x4c5869[_0x5d0270]={[Op['like']]:'%'+_0x1598d7['query'][_0x4c058a('0x138')]+'%'},_0x4c5869;})})),_0xbdbe88=_[_0x20cdde('0xf4')]({},_0xbdbe88,_0x1598d7['options']),_0x40ffbf[_0x20cdde('0x14f')](_0xbdbe88);})[_0x24d494('0x5b')](function(_0x567d34){const _0x1a5e06=_0x24d494;if(_0x567d34)return _0x456158=_0x567d34['length'],typeof _0x1598d7[_0x1a5e06('0x97')][_0x1a5e06('0x48')]==='undefined'&&(_0xbdbe88['limit']=qs[_0x1a5e06('0x7a')](_0x1598d7['query'][_0x1a5e06('0x7a')]),_0xbdbe88[_0x1a5e06('0x12a')]=qs[_0x1a5e06('0x12a')](_0x1598d7['query'][_0x1a5e06('0x12a')])),_0x40ffbf['getWhatsappInteractions'](_0xbdbe88);})[_0x24d494('0x5b')](function(_0x233719){if(_0x233719)return _0x233719?{'count':_0x456158,'rows':_0x233719}:null;})[_0x24d494('0x5b')](respondWithResult(_0x3fc11a,null))[_0x24d494('0x139')](handleError(_0x3fc11a,null));},exports[_0x15d5b3('0xef')]=function(_0x595157,_0x62ba17,_0x321ff1){const _0x58acb9=_0x15d5b3;let _0x1d9d18,_0x40ea67,_0x1e7847;const _0x446799=!_['isNil'](_0x595157[_0x58acb9('0xe')]['id'])?_0x595157[_0x58acb9('0xe')]['id']:!_[_0x58acb9('0x99')](_0x595157['user']['id'])?_0x595157['user']['id']:null;return db[_0x58acb9('0xf1')]['findOne']({'where':{'id':_0x446799,'role':{[Op['or']]:[_0x58acb9('0x66'),_0x58acb9('0x5d'),_0x58acb9('0x145')]}},'attributes':['id',_0x58acb9('0x32'),'phone',_0x58acb9('0xa7'),_0x58acb9('0x86'),_0x58acb9('0x2d'),_0x58acb9('0x127')]})[_0x58acb9('0x5b')](function(_0x10e829){const _0x221a70=_0x58acb9;if(_0x10e829){if(_0x10e829[_0x221a70('0x86')]===_0x221a70('0x145')){_0x1d9d18=_0x10e829;if(_0x595157[_0x221a70('0x10c')][_0x221a70('0x45')])_0x1e7847=util[_0x221a70('0xb8')]('LOCAL/%s@from-sip/n',_0x1d9d18[_0x595157[_0x221a70('0x10c')][_0x221a70('0x45')]]);else _0x595157['body'][_0x221a70('0x88')]?_0x1e7847=util[_0x221a70('0xb8')](_0x221a70('0x61'),_0x595157['body'][_0x221a70('0x88')]):_0x1e7847=util[_0x221a70('0xb8')](_0x221a70('0x61'),_0x1d9d18[_0x221a70('0x32')]);return socket['to'](util['format']('user:%s',_0x1d9d18['name']))[_0x221a70('0xea')]('user:forcelogout',{'ip':_0x595157[_0x221a70('0x62')]['x-forwarded-for']||_0x595157[_0x221a70('0x152')][_0x221a70('0x94')]||_0x595157[_0x221a70('0x2e')][_0x221a70('0x94')]||_0x595157[_0x221a70('0x152')][_0x221a70('0x2e')][_0x221a70('0x94')]}),db[_0x221a70('0x40')][_0x221a70('0xe3')]({'where':{'membername':_0x1d9d18[_0x221a70('0x32')]},'individualHooks':!![]});}}else throw new ValidationError(_0x221a70('0x12b'));})[_0x58acb9('0x5b')](function(){const _0x42dd36=_0x58acb9;if(_0x1d9d18)return _0x1d9d18[_0x42dd36('0x72')]({'raw':!![]});})[_0x58acb9('0x5b')](function(_0x393823){const _0x49eb20=_0x58acb9;if(_0x1d9d18){if(_0x393823){_0x40ea67=_0x393823;if(_0x40ea67[_0x49eb20('0x12e')]){const _0xde5cfb=_0x40ea67[_0x49eb20('0x58')](_0x3de0e2=>{const _0x5c510d=_0x49eb20,_0x4147a4={'membername':_0x1d9d18[_0x5c510d('0x32')],'UserId':_0x1d9d18['id'],'queue_name':_0x3de0e2[_0x5c510d('0x32')],'VoiceQueueId':_0x3de0e2['id'],'interface':_0x1e7847,'paused':_0x1d9d18[_0x5c510d('0x127')]||![],'penalty':_0x3de0e2['UserVoiceQueue.penalty']||0x0};return db[_0x5c510d('0x40')][_0x5c510d('0xe7')](_0x4147a4);});return Promise[_0x49eb20('0x77')](_0xde5cfb);}}}})[_0x58acb9('0x5b')](function(){const _0x1082bb=_0x58acb9;if(_0x1d9d18)return db[_0x1082bb('0x100')][_0x1082bb('0xeb')]({'where':{'membername':_0x1d9d18[_0x1082bb('0x32')],'exitAt':null}});})['then'](function(_0x1fbf4f){const _0x2cac67=_0x58acb9;if(_0x1d9d18){const _0x2de7bc=[];return _0x1fbf4f[_0x2cac67('0x129')](function(_0x1bb040){const _0x1263bc=_0x2cac67;_0x2de7bc[_0x1263bc('0x67')](_0x1bb040[_0x1263bc('0xfc')]({'exitAt':moment()[_0x1263bc('0xb8')](_0x1263bc('0xac'))}));}),Promise[_0x2cac67('0x77')](_0x2de7bc);}})[_0x58acb9('0x5b')](function(){const _0x21882d=_0x58acb9;if(_0x1d9d18){const _0x508b41=[],_0x324282=[],_0x487c86=utils[_0x21882d('0xd3')](),_0x10ef32={'membername':_0x1d9d18[_0x21882d('0x32')],'interface':_0x1e7847,'enterAt':moment()[_0x21882d('0xb8')](_0x21882d('0xac')),'role':_0x1d9d18['role'],'internal':_0x1d9d18[_0x21882d('0x2d')]};return _0x487c86[_0x21882d('0x129')](function(_0x559eeb){const _0x3fb05c=_0x21882d;_0x508b41[_0x3fb05c('0x67')](_[_0x3fb05c('0xf4')]({'channel':_0x559eeb,'type':'LOGIN','data1':_0x595157[_0x3fb05c('0x10c')][_0x3fb05c('0xcc')],'data2':_0x1e7847},_0x10ef32)),_0x1d9d18[_0x3fb05c('0x127')]&&_0x324282[_0x3fb05c('0x67')](_[_0x3fb05c('0xf4')]({'channel':_0x559eeb,'type':_0x3fb05c('0xe5'),'data1':_0x3fb05c('0x23')},_0x10ef32));}),db[_0x21882d('0x100')][_0x21882d('0xf3')](_0x508b41[_0x21882d('0x19')](_0x324282),{'individualHooks':!![]});}})['then'](function(){const _0x2994cf=_0x58acb9;if(_0x1d9d18)return _0x1d9d18[_0x2994cf('0xfc')]({'online':!![],'lastLoginAt':moment()[_0x2994cf('0xb8')](_0x2994cf('0xac')),'voicePause':_0x1d9d18[_0x2994cf('0x127')]||![],'mailPause':_0x1d9d18[_0x2994cf('0x127')]||![],'chatPause':_0x1d9d18[_0x2994cf('0x127')]||![],'faxPause':_0x1d9d18[_0x2994cf('0x127')]||![],'smsPause':_0x1d9d18[_0x2994cf('0x127')]||![],'openchannelPause':_0x1d9d18['loginInPause']||![],'whatsappPause':_0x1d9d18[_0x2994cf('0x127')]||![],'pauseType':_0x1d9d18['loginInPause']?_0x2994cf('0x23'):null,'interface':_0x1e7847,'lastPauseAt':moment()[_0x2994cf('0xb8')](_0x2994cf('0xac'))});})[_0x58acb9('0x5b')](function(_0x488d3f){const _0x5a2e57=_0x58acb9;return _0x595157[_0x5a2e57('0x46')]?_0x321ff1():Promise[_0x5a2e57('0xb5')](_0x488d3f)[_0x5a2e57('0x5b')](respondWithResult(_0x62ba17,null));})['catch'](handleError(_0x62ba17,null));},exports[_0x15d5b3('0xfa')]=function(_0x278b06,_0x1b8188){const _0x3c32da=_0x15d5b3;let _0x29d5ab;return db[_0x3c32da('0xf1')][_0x3c32da('0x12d')]({'where':{'id':_0x278b06[_0x3c32da('0xe')]['id'],'role':_0x3c32da('0x145')},'attributes':['id',_0x3c32da('0x32'),_0x3c32da('0x86')]})[_0x3c32da('0x5b')](handleEntityNotFound(_0x1b8188,null))[_0x3c32da('0x5b')](function(_0x444184){const _0x37e300=_0x3c32da;if(_0x444184)return _0x29d5ab=_0x444184,db['UserVoiceQueueRt'][_0x37e300('0xe3')]({'where':{'membername':_0x29d5ab[_0x37e300('0x32')]},'individualHooks':!![]});})[_0x3c32da('0x5b')](function(){const _0x23c6f5=_0x3c32da;return db[_0x23c6f5('0x100')][_0x23c6f5('0xeb')]({'where':{'membername':_0x29d5ab[_0x23c6f5('0x32')],'exitAt':null}});})[_0x3c32da('0x5b')](function(_0xe113d6){const _0x108f0b=_0x3c32da,_0x19d2f6=[];return _0xe113d6[_0x108f0b('0x129')](function(_0x479927){const _0x5aebf1=_0x108f0b;_0x19d2f6[_0x5aebf1('0x67')](_0x479927[_0x5aebf1('0xfc')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));}),Promise[_0x108f0b('0x77')](_0x19d2f6);})[_0x3c32da('0x5b')](function(){const _0x3608b4=_0x3c32da;return _0x29d5ab[_0x3608b4('0xfc')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3c32da('0x5b')](respondWithResult(_0x1b8188,null))[_0x3c32da('0x139')](handleError(_0x1b8188,null));},exports[_0x15d5b3('0x78')]=function(_0x1a0152,_0x40dd12){const _0x323cd0=_0x15d5b3;let _0x75630d;return db['UserVoiceQueueRt'][_0x323cd0('0xfc')]({'paused':0x1},{'where':{'UserId':_0x1a0152['params']['id']},'individualHooks':!![]})[_0x323cd0('0x5b')](function(){const _0x47197a=_0x323cd0;return db['User'][_0x47197a('0x12d')]({'where':{'id':_0x1a0152[_0x47197a('0xe')]['id'],'role':_0x47197a('0x145')},'attributes':['id',_0x47197a('0x32'),'role','internal',_0x47197a('0x45')]});})[_0x323cd0('0x5b')](handleEntityNotFound(_0x40dd12,null))[_0x323cd0('0x5b')](function(_0x436e3c){const _0x1026dc=_0x323cd0;if(_0x436e3c)return _0x75630d=_0x436e3c,respondWithRpcPromise(_0x1026dc('0x22'),_0x1026dc('0x78'),{'id':_0x75630d['id'],'name':_0x75630d[_0x1026dc('0x32')],'pause':!![]});})[_0x323cd0('0x5b')](function(){const _0x47a789=_0x323cd0;if(_0x75630d)return db[_0x47a789('0x100')][_0x47a789('0xeb')]({'where':{'membername':_0x75630d[_0x47a789('0x32')],'type':'PAUSE','exitAt':null}});})[_0x323cd0('0x5b')](function(_0x2cbdb9){const _0x5da096=_0x323cd0;if(_0x2cbdb9[_0x5da096('0x12e')]){const _0x5399a7=moment()[_0x5da096('0xb8')](_0x5da096('0xac'));for(let _0x2934d3=0x0,_0xc0c9b8=_0x2cbdb9[_0x5da096('0x12e')];_0x2934d3<_0xc0c9b8;_0x2934d3++){_0x2cbdb9[_0x2934d3][_0x5da096('0xfc')]({'exitAt':_0x5399a7});}}})[_0x323cd0('0x5b')](function(){const _0x466816=_0x323cd0,_0x29f9f3=[],_0x206dad=utils[_0x466816('0xd3')]();return _0x206dad['forEach'](function(_0x367c8d){const _0x4b93b7=_0x466816;_0x29f9f3['push']({'channel':_0x367c8d,'membername':_0x75630d['name'],'interface':_['isNil'](_0x75630d[_0x4b93b7('0x45')])?util[_0x4b93b7('0xb8')](_0x4b93b7('0x61'),_0x75630d[_0x4b93b7('0x32')]):_0x75630d[_0x4b93b7('0x45')],'type':'PAUSE','enterAt':moment()['format'](_0x4b93b7('0xac')),'data1':_0x1a0152[_0x4b93b7('0x10c')][_0x4b93b7('0x11d')]||_0x4b93b7('0x6e'),'role':_0x75630d['role'],'internal':_0x75630d['internal']});}),db[_0x466816('0x100')][_0x466816('0xf3')](_0x29f9f3,{'individualHooks':!![]});})[_0x323cd0('0x5b')](function(){const _0x5c2e87=_0x323cd0;return _0x75630d[_0x5c2e87('0xfc')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a0152[_0x5c2e87('0x10c')]['type']||_0x5c2e87('0x6e'),'lastPauseAt':moment()[_0x5c2e87('0xb8')](_0x5c2e87('0xac'))});})[_0x323cd0('0x5b')](respondWithResult(_0x40dd12,null))[_0x323cd0('0x139')](handleError(_0x40dd12,null));},exports[_0x15d5b3('0xe9')]=function(_0x405cc9,_0x373a48){const _0x5954d8=_0x15d5b3;let _0x4e471b;return db[_0x5954d8('0xf1')][_0x5954d8('0x12d')]({'where':{'id':_0x405cc9[_0x5954d8('0xe')]['id']},'attributes':['id','name','role',_0x5954d8('0xcd'),'mailPause','chatPause',_0x5954d8('0x30'),_0x5954d8('0x59'),'smsPause','whatsapppause',_0x5954d8('0x15b'),_0x5954d8('0xa')]})[_0x5954d8('0x5b')](handleEntityNotFound(_0x373a48,null))[_0x5954d8('0x5b')](function(_0x537a9b){const _0x557d3f=_0x5954d8;if(_0x537a9b){_0x4e471b=_0x537a9b;if(_0x405cc9['body']['channel']&&!utils[_0x557d3f('0x11a')](_0x405cc9[_0x557d3f('0x10c')][_0x557d3f('0x13a')]))throw new ValidationError(_0x557d3f('0x156'));switch(_0x405cc9[_0x557d3f('0x10c')][_0x557d3f('0x13a')]){case _0x557d3f('0x153'):return respondWithRpcPromise(_0x557d3f('0x22'),'unpause',{'id':_0x4e471b['id'],'name':_0x4e471b[_0x557d3f('0x32')],'pause':![]})[_0x557d3f('0x5b')](function(){const _0x1002a7=_0x557d3f;return db[_0x1002a7('0x40')][_0x1002a7('0xfc')]({'paused':0x0},{'where':{'UserId':_0x4e471b['id']},'individualHooks':!![]});})[_0x557d3f('0x5b')](function(){const _0x429778=_0x557d3f;return db[_0x429778('0x100')][_0x429778('0x12d')]({'where':{'channel':_0x405cc9['body']['channel'],'membername':_0x4e471b[_0x429778('0x32')],'type':_0x429778('0xe5'),'exitAt':null}});})[_0x557d3f('0x5b')](function(_0x3cebd6){const _0x2e727c=_0x557d3f;if(_0x3cebd6)return _0x3cebd6[_0x2e727c('0xfc')]({'exitAt':moment()['format'](_0x2e727c('0xac')),'data2':_0x2e727c('0x15a')},{'individualHooks':!![]});return null;})[_0x557d3f('0x5b')](function(){const _0x2ca10c=_0x557d3f;return _0x4e471b[_0x2ca10c('0xfc')]({'voicePause':![]});});case _0x557d3f('0x158'):case _0x557d3f('0xa5'):case _0x557d3f('0x36'):case'sms':case'whatsapp':case'openchannel':return db[_0x557d3f('0x100')][_0x557d3f('0x12d')]({'where':{'channel':_0x405cc9['body']['channel'],'membername':_0x4e471b[_0x557d3f('0x32')],'type':_0x557d3f('0xe5'),'exitAt':null}})[_0x557d3f('0x5b')](function(_0x177f03){const _0x50a71d=_0x557d3f;if(_0x177f03)return _0x177f03['update']({'exitAt':moment()[_0x50a71d('0xb8')](_0x50a71d('0xac')),'data2':_0x50a71d('0x15a')},{'individualHooks':!![]});return null;})[_0x557d3f('0x5b')](function(){const _0xd30172=_0x557d3f,_0x11010f={};return _[_0xd30172('0x3b')](_0x11010f,util[_0xd30172('0xb8')](_0xd30172('0x21'),_0x405cc9[_0xd30172('0x10c')][_0xd30172('0x13a')],_0xd30172('0x73')),![]),_0x4e471b[_0xd30172('0xfc')](_0x11010f);});default:return respondWithRpcPromise(_0x557d3f('0x22'),'unpause',{'id':_0x4e471b['id'],'name':_0x4e471b[_0x557d3f('0x32')],'pause':![]})[_0x557d3f('0x5b')](function(){const _0x456295=_0x557d3f;return db[_0x456295('0x40')]['update']({'paused':0x0},{'where':{'UserId':_0x4e471b['id']}});})[_0x557d3f('0x5b')](function(){const _0x33de23=_0x557d3f;return db[_0x33de23('0x100')]['findAll']({'where':{'membername':_0x4e471b[_0x33de23('0x32')],'type':'PAUSE','exitAt':null}});})[_0x557d3f('0x5b')](function(_0x7e2a24){const _0x50d100=_0x557d3f,_0x542c93=[];return _0x7e2a24[_0x50d100('0x129')](function(_0x35dc90){const _0x599ff4=_0x50d100;_0x542c93[_0x599ff4('0x67')](_0x35dc90[_0x599ff4('0xfc')]({'exitAt':moment()['format'](_0x599ff4('0xac')),'data2':_0x599ff4('0x15a')}));}),Promise[_0x50d100('0x77')](_0x542c93);})[_0x557d3f('0x5b')](function(){const _0x3d8e1b=_0x557d3f;return _0x4e471b[_0x3d8e1b('0xfc')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x5954d8('0x5b')](respondWithResult(_0x373a48,null))[_0x5954d8('0x139')](handleError(_0x373a48,null));},exports[_0x15d5b3('0x124')]=function(_0x1f69c8,_0x11e634){const _0x10ff82=_0x15d5b3;let _0x4ef4a4={};const _0x5111de={};let _0x1df926,_0xdcdb80;return db[_0x10ff82('0xf1')][_0x10ff82('0x12d')]({'where':{'id':_0x1f69c8[_0x10ff82('0xe')]['id']}})['then'](handleEntityNotFound(_0x11e634,null))[_0x10ff82('0x5b')](function(_0x1b48c3){const _0x548b76=_0x10ff82;if(_0x1b48c3)return _0x1df926=_0x1b48c3,_0x5111de[_0x548b76('0x142')]=_[_0x548b76('0x14e')](db[_0x548b76('0xb4')][_0x548b76('0x13c')]),_0x5111de[_0x548b76('0x97')]=_[_0x548b76('0x14e')](_0x1f69c8[_0x548b76('0x97')]),_0x5111de[_0x548b76('0x38')]=_[_0x548b76('0xdf')](_0x5111de['model'],_0x5111de['query']),_0x4ef4a4[_0x548b76('0xd6')]=_['intersection'](_0x5111de[_0x548b76('0x142')],qs[_0x548b76('0x11')](_0x1f69c8[_0x548b76('0x97')]['fields'])),_0x4ef4a4[_0x548b76('0xd6')]=_0x4ef4a4[_0x548b76('0xd6')][_0x548b76('0x12e')]?_0x4ef4a4[_0x548b76('0xd6')]:_0x5111de['model'],_0x4ef4a4[_0x548b76('0xec')]=qs['sort'](_0x1f69c8['query'][_0x548b76('0x15c')]),_0x4ef4a4[_0x548b76('0xbc')]=qs[_0x548b76('0x38')](_['pick'](_0x1f69c8['query'],_0x5111de['filters'])),_0x1f69c8['query']['filter']&&(_0x4ef4a4[_0x548b76('0xbc')]=_[_0x548b76('0xf4')](_0x4ef4a4[_0x548b76('0xbc')],{[Op['or']]:_[_0x548b76('0x58')](_0x4ef4a4['attributes'],function(_0xe11ab7){const _0x34cfca=_0x548b76,_0x339b8a={};return _0x339b8a[_0xe11ab7]={[Op[_0x34cfca('0x13d')]]:'%'+_0x1f69c8['query'][_0x34cfca('0x138')]+'%'},_0x339b8a;})})),_0x4ef4a4=_[_0x548b76('0xf4')]({},_0x4ef4a4,_0x1f69c8[_0x548b76('0xf5')]),_0x1df926[_0x548b76('0x124')](_0x4ef4a4);})[_0x10ff82('0x5b')](function(_0x4ce15){const _0x23b187=_0x10ff82;if(_0x4ce15)return _0xdcdb80=_0x4ce15[_0x23b187('0x12e')],typeof _0x1f69c8[_0x23b187('0x97')][_0x23b187('0x48')]==='undefined'&&(_0x4ef4a4['limit']=qs['limit'](_0x1f69c8[_0x23b187('0x97')][_0x23b187('0x7a')]),_0x4ef4a4[_0x23b187('0x12a')]=qs['offset'](_0x1f69c8['query'][_0x23b187('0x12a')])),_0x1df926[_0x23b187('0x124')](_0x4ef4a4);})[_0x10ff82('0x5b')](function(_0x2b4c0b){if(_0x2b4c0b)return _0x2b4c0b?{'count':_0xdcdb80,'rows':_0x2b4c0b}:null;})['then'](respondWithResult(_0x11e634,null))[_0x10ff82('0x139')](handleError(_0x11e634,null));},exports[_0x15d5b3('0xee')]=function(_0x169ff0,_0x4e592c){const _0xb7d448=_0x15d5b3;return db[_0xb7d448('0xf1')][_0xb7d448('0x12d')]({'where':{'id':_0x169ff0['params']['id']}})[_0xb7d448('0x5b')](handleEntityNotFound(_0x4e592c,null))[_0xb7d448('0x5b')](function(_0x6b31e2){const _0x29de2e=_0xb7d448;if(_0x6b31e2){const _0x484446=_0x6b31e2['get']({'plain':!![]});return _0x6b31e2[_0x29de2e('0xee')](_0x169ff0[_0x29de2e('0x10c')][_0x29de2e('0x76')],_[_0x29de2e('0x8a')](_0x169ff0[_0x29de2e('0x10c')],[_0x29de2e('0x76'),'id'])||{})[_0x29de2e('0x5b')](function(){const _0x1b3d17=_0x29de2e;for(let _0x554229=0x0;_0x554229<_0x169ff0[_0x1b3d17('0x10c')][_0x1b3d17('0x76')][_0x1b3d17('0x12e')];_0x554229++){let _0x2c427f=[];db[_0x1b3d17('0xb4')][_0x1b3d17('0x12d')]({'where':{'id':_0x169ff0['body'][_0x1b3d17('0x76')][_0x554229]}})['then'](function(_0x58ba44){const _0x49fbcc=_0x1b3d17;return _0x2c427f[_0x49fbcc('0x67')](_0x58ba44[_0x49fbcc('0x72')]()[_0x49fbcc('0x5b')](function(_0x1b681b){const _0x39449b=_0x49fbcc;for(let _0x5b34e1=0x0;_0x5b34e1<_0x1b681b[_0x39449b('0x12e')];_0x5b34e1++){_0x1b681b[_0x5b34e1]['setDataValue'](_0x39449b('0x13a'),_0x39449b('0x13b'));}return _0x1b681b;})),_0x2c427f[_0x49fbcc('0x67')](_0x58ba44[_0x49fbcc('0x0')]()['then'](function(_0x89d285){const _0x2d8274=_0x49fbcc;for(let _0x3c52d6=0x0;_0x3c52d6<_0x89d285[_0x2d8274('0x12e')];_0x3c52d6++){_0x89d285[_0x3c52d6][_0x2d8274('0xc5')](_0x2d8274('0x13a'),_0x2d8274('0x14a'));}return _0x89d285;})),_0x2c427f[_0x49fbcc('0x67')](_0x58ba44['getMailQueues']()['then'](function(_0x485746){const _0x599501=_0x49fbcc;for(let _0x227636=0x0;_0x227636<_0x485746[_0x599501('0x12e')];_0x227636++){_0x485746[_0x227636]['setDataValue'](_0x599501('0x13a'),'Mail');}return _0x485746;})),_0x2c427f[_0x49fbcc('0x67')](_0x58ba44['getSmsQueues']()['then'](function(_0x3fbe36){const _0x1b0ad2=_0x49fbcc;for(let _0x24a3a3=0x0;_0x24a3a3<_0x3fbe36['length'];_0x24a3a3++){_0x3fbe36[_0x24a3a3][_0x1b0ad2('0xc5')]('channel',_0x1b0ad2('0x42'));}return _0x3fbe36;})),_0x2c427f[_0x49fbcc('0x67')](_0x58ba44[_0x49fbcc('0x2')]()[_0x49fbcc('0x5b')](function(_0xdc6833){const _0x437f30=_0x49fbcc;for(let _0x454771=0x0;_0x454771<_0xdc6833[_0x437f30('0x12e')];_0x454771++){_0xdc6833[_0x454771][_0x437f30('0xc5')](_0x437f30('0x13a'),'Whatsapp');}return _0xdc6833;})),_0x2c427f[_0x49fbcc('0x67')](_0x58ba44[_0x49fbcc('0x5e')]()[_0x49fbcc('0x5b')](function(_0x4c2fc8){const _0x294e1e=_0x49fbcc;for(let _0x503d96=0x0;_0x503d96<_0x4c2fc8[_0x294e1e('0x12e')];_0x503d96++){_0x4c2fc8[_0x503d96][_0x294e1e('0xc5')](_0x294e1e('0x13a'),'Fax');}return _0x4c2fc8;})),_0x2c427f['push'](_0x58ba44[_0x49fbcc('0x6f')]()[_0x49fbcc('0x5b')](function(_0x17f796){const _0x33a67a=_0x49fbcc;for(let _0x32a286=0x0;_0x32a286<_0x17f796[_0x33a67a('0x12e')];_0x32a286++){_0x17f796[_0x32a286][_0x33a67a('0xc5')](_0x33a67a('0x13a'),_0x33a67a('0x102'));}return _0x17f796;})),Promise[_0x49fbcc('0x77')](_0x2c427f);})['then'](function(_0x17428d){const _0x3a3531=_0x1b3d17,_0x42f922=_['flatten'](_0x17428d);return _0x2c427f=[],db[_0x3a3531('0xdc')][_0x3a3531('0x101')](function(_0x3bbe96){const _0x4880a3=_0x3a3531;for(let _0x4b9987=0x0;_0x4b9987<_0x42f922[_0x4880a3('0x12e')];_0x4b9987++){_0x2c427f[_0x4880a3('0x67')](_0x42f922[_0x4b9987][_0x4880a3('0x26')](_0x484446['id']),{'transaction':_0x3bbe96});}return Promise[_0x4880a3('0x77')](_0x2c427f)[_0x4880a3('0x5b')](function(){const _0x382603=_0x4880a3;if(_0x484446[_0x382603('0x111')])return Promise[_0x382603('0xaf')](_[_0x382603('0x138')](_0x42f922,function(_0x147417){const _0x37edb9=_0x382603;return _0x147417['getDataValue']('channel')===_0x37edb9('0x13b');}),function(_0xa236f7){const _0x67b5bd=_0x382603;return db[_0x67b5bd('0x40')][_0x67b5bd('0xe7')]({'membername':_0x484446['name'],'UserId':_0x484446['id'],'queue_name':_0xa236f7[_0x67b5bd('0x32')],'VoiceQueueId':_0xa236f7['id'],'interface':_[_0x67b5bd('0x99')](_0x484446[_0x67b5bd('0x45')])?util[_0x67b5bd('0xb8')](_0x67b5bd('0x61'),_0x484446['name']):_0x484446[_0x67b5bd('0x45')],'paused':_0x484446[_0x67b5bd('0xcd')]||![],'penalty':_0x484446[_0x67b5bd('0x12')]},{'transaction':_0x3bbe96});});else return;})[_0x4880a3('0x5b')](function(){const _0x1cd2bc=_0x4880a3;for(let _0x3d9e29=0x0;_0x3d9e29<_0x42f922[_0x1cd2bc('0x12e')];_0x3d9e29++){const _0x4c0001=_0x42f922[_0x3d9e29][_0x1cd2bc('0x147')](_0x1cd2bc('0x13a')),_0x582490=_0x4c0001+_0x1cd2bc('0xa8');socket[_0x1cd2bc('0xea')](_0x1cd2bc('0x5d')+_0x4c0001+_0x1cd2bc('0x25'),{'UserId':_0x484446['id'],[_0x582490]:_0x42f922[_0x3d9e29]['id']});}});});});}});}})[_0xb7d448('0x5b')](respondWithStatusCode(_0x4e592c,null))['catch'](handleError(_0x4e592c,null));},exports['removeTeams']=function(_0x13b33b,_0x57359a){const _0x2b3d5f=_0x15d5b3;return db['User'][_0x2b3d5f('0x12d')]({'where':{'id':_0x13b33b[_0x2b3d5f('0xe')]['id']}})[_0x2b3d5f('0x5b')](handleEntityNotFound(_0x57359a,null))[_0x2b3d5f('0x5b')](function(_0x104093){const _0x40854c=_0x2b3d5f;if(_0x104093){const _0x4cceb1=_0x104093[_0x40854c('0x1e')]({'plain':!![]}),_0x4cebb0=_0x13b33b[_0x40854c('0x97')][_0x40854c('0x76')];return _0x104093['removeTeams'](_0x4cebb0)[_0x40854c('0x5b')](function(){const _0x2aeb10=_0x40854c;for(let _0x10e545=0x0;_0x10e545<_0x4cebb0['length'];_0x10e545++){let _0x478c72=[];db[_0x2aeb10('0xb4')][_0x2aeb10('0x12d')]({'where':{'id':_0x4cebb0[_0x10e545]}})[_0x2aeb10('0x5b')](function(_0x3d7f38){const _0x175df=_0x2aeb10;return _0x478c72['push'](_0x3d7f38[_0x175df('0x72')]()[_0x175df('0x5b')](function(_0x5906af){const _0x4d6c09=_0x175df;for(let _0xe1cabf=0x0;_0xe1cabf<_0x5906af[_0x4d6c09('0x12e')];_0xe1cabf++){_0x5906af[_0xe1cabf][_0x4d6c09('0xc5')]('channel',_0x4d6c09('0x13b'));}return _0x5906af;})),_0x478c72['push'](_0x3d7f38['getChatQueues']()['then'](function(_0x426f91){const _0x195636=_0x175df;for(let _0x4f258d=0x0;_0x4f258d<_0x426f91[_0x195636('0x12e')];_0x4f258d++){_0x426f91[_0x4f258d]['setDataValue'](_0x195636('0x13a'),_0x195636('0x14a'));}return _0x426f91;})),_0x478c72[_0x175df('0x67')](_0x3d7f38[_0x175df('0xb7')]()[_0x175df('0x5b')](function(_0x1b6277){const _0x65f731=_0x175df;for(let _0x369ee5=0x0;_0x369ee5<_0x1b6277['length'];_0x369ee5++){_0x1b6277[_0x369ee5][_0x65f731('0xc5')](_0x65f731('0x13a'),_0x65f731('0x15e'));}return _0x1b6277;})),_0x478c72['push'](_0x3d7f38['getSmsQueues']()[_0x175df('0x5b')](function(_0x461d45){const _0x53e89c=_0x175df;for(let _0x3f6b37=0x0;_0x3f6b37<_0x461d45[_0x53e89c('0x12e')];_0x3f6b37++){_0x461d45[_0x3f6b37]['setDataValue']('channel',_0x53e89c('0x42'));}return _0x461d45;})),_0x478c72[_0x175df('0x67')](_0x3d7f38[_0x175df('0x2')]()[_0x175df('0x5b')](function(_0x3dad27){const _0x2ebbd5=_0x175df;for(let _0x1acaf0=0x0;_0x1acaf0<_0x3dad27[_0x2ebbd5('0x12e')];_0x1acaf0++){_0x3dad27[_0x1acaf0][_0x2ebbd5('0xc5')]('channel',_0x2ebbd5('0xb9'));}return _0x3dad27;})),_0x478c72[_0x175df('0x67')](_0x3d7f38[_0x175df('0x5e')]()['then'](function(_0x29450f){const _0x9346af=_0x175df;for(let _0x374bbf=0x0;_0x374bbf<_0x29450f[_0x9346af('0x12e')];_0x374bbf++){_0x29450f[_0x374bbf]['setDataValue']('channel',_0x9346af('0xab'));}return _0x29450f;})),_0x478c72[_0x175df('0x67')](_0x3d7f38['getOpenchannelQueues']()[_0x175df('0x5b')](function(_0x222772){const _0x3dcc86=_0x175df;for(let _0x10847a=0x0;_0x10847a<_0x222772[_0x3dcc86('0x12e')];_0x10847a++){_0x222772[_0x10847a][_0x3dcc86('0xc5')](_0x3dcc86('0x13a'),_0x3dcc86('0x102'));}return _0x222772;})),Promise[_0x175df('0x77')](_0x478c72);})[_0x2aeb10('0x5b')](function(_0x14d13a){const _0x8c78f3=_0x2aeb10,_0x41bc6e=_[_0x8c78f3('0xf6')](_0x14d13a);return _0x478c72=[],db['sequelize'][_0x8c78f3('0x101')](function(_0x20b82b){const _0x4d4ebc=_0x8c78f3;for(let _0x39f444=0x0;_0x39f444<_0x41bc6e[_0x4d4ebc('0x12e')];_0x39f444++){_0x478c72[_0x4d4ebc('0x67')](_0x41bc6e[_0x39f444]['removeAgent'](_0x4cceb1['id']),{'transaction':_0x20b82b});}return Promise[_0x4d4ebc('0x77')](_0x478c72)['then'](function(){const _0x1817ec=_0x4d4ebc;if(_0x4cceb1['online'])return Promise[_0x1817ec('0xaf')](_[_0x1817ec('0x138')](_0x41bc6e,function(_0x1ad7be){const _0x44f8a1=_0x1817ec;return _0x1ad7be[_0x44f8a1('0x147')](_0x44f8a1('0x13a'))===_0x44f8a1('0x13b');}),function(_0x481c88){const _0x241658=_0x1817ec;return db[_0x241658('0x40')][_0x241658('0xe3')]({'where':{'VoiceQueueId':_0x481c88['id'],'UserId':_0x4cceb1['id']},'transaction':_0x20b82b});});else return;})[_0x4d4ebc('0x5b')](function(){const _0x190c40=_0x4d4ebc;for(let _0xa89acd=0x0;_0xa89acd<_0x41bc6e[_0x190c40('0x12e')];_0xa89acd++){const _0x30da3f=_0x41bc6e[_0xa89acd][_0x190c40('0x147')](_0x190c40('0x13a')),_0x3ecbff=_0x30da3f+'QueueId';socket[_0x190c40('0xea')](_0x190c40('0x5d')+_0x30da3f+_0x190c40('0x140'),{'UserId':_0x4cceb1['id'],[_0x3ecbff]:_0x41bc6e[_0xa89acd]['id']});}});});});}});}})[_0x2b3d5f('0x5b')](respondWithStatusCode(_0x57359a,null))['catch'](handleError(_0x57359a,null));},exports[_0x15d5b3('0x37')]=function(_0x493348,_0x1a41bb){const _0x5f4526=_0x15d5b3;let _0x50829d={};const _0xb172d2={};let _0x1ba683,_0x255dcf;return db[_0x5f4526('0xf1')][_0x5f4526('0x12d')]({'where':{'id':_0x493348[_0x5f4526('0xe')]['id']}})['then'](handleEntityNotFound(_0x1a41bb,null))[_0x5f4526('0x5b')](function(_0x1177aa){const _0x1b5ab3=_0x5f4526;if(_0x1177aa)return _0x1ba683=_0x1177aa,_0xb172d2[_0x1b5ab3('0x142')]=_[_0x1b5ab3('0x14e')](db[_0x1b5ab3('0x5')]['rawAttributes']),_0xb172d2[_0x1b5ab3('0x97')]=_[_0x1b5ab3('0x14e')](_0x493348[_0x1b5ab3('0x97')]),_0xb172d2['filters']=_[_0x1b5ab3('0xdf')](_0xb172d2[_0x1b5ab3('0x142')],_0xb172d2[_0x1b5ab3('0x97')]),_0x50829d[_0x1b5ab3('0xd6')]=_[_0x1b5ab3('0xdf')](_0xb172d2['model'],qs['fields'](_0x493348[_0x1b5ab3('0x97')][_0x1b5ab3('0x11')])),_0x50829d[_0x1b5ab3('0xd6')]=_0x50829d[_0x1b5ab3('0xd6')][_0x1b5ab3('0x12e')]?_0x50829d['attributes']:_0xb172d2['model'],_0x50829d[_0x1b5ab3('0xec')]=qs[_0x1b5ab3('0x15c')](_0x493348['query'][_0x1b5ab3('0x15c')]),_0x50829d[_0x1b5ab3('0xbc')]=qs[_0x1b5ab3('0x38')](_[_0x1b5ab3('0x6d')](_0x493348[_0x1b5ab3('0x97')],_0xb172d2['filters'])),_0x493348[_0x1b5ab3('0x97')][_0x1b5ab3('0x138')]&&(_0x50829d[_0x1b5ab3('0xbc')]=_[_0x1b5ab3('0xf4')](_0x50829d[_0x1b5ab3('0xbc')],{[Op['or']]:_[_0x1b5ab3('0x58')](_0x50829d[_0x1b5ab3('0xd6')],function(_0x441203){const _0x51d009=_0x1b5ab3,_0x548c76={};return _0x548c76[_0x441203]={[Op[_0x51d009('0x13d')]]:'%'+_0x493348[_0x51d009('0x97')][_0x51d009('0x138')]+'%'},_0x548c76;})})),_0x50829d=_['merge']({},_0x50829d,_0x493348[_0x1b5ab3('0xf5')]),_0x1ba683[_0x1b5ab3('0x37')](_0x50829d);})[_0x5f4526('0x5b')](function(_0x2348fd){const _0x28c8d5=_0x5f4526;if(_0x2348fd)return _0x255dcf=_0x2348fd[_0x28c8d5('0x12e')],typeof _0x493348[_0x28c8d5('0x97')][_0x28c8d5('0x48')]==='undefined'&&(_0x50829d[_0x28c8d5('0x7a')]=qs[_0x28c8d5('0x7a')](_0x493348[_0x28c8d5('0x97')][_0x28c8d5('0x7a')]),_0x50829d['offset']=qs[_0x28c8d5('0x12a')](_0x493348[_0x28c8d5('0x97')][_0x28c8d5('0x12a')])),_0x1ba683['getLists'](_0x50829d);})[_0x5f4526('0x5b')](function(_0xb6f652){if(_0xb6f652)return _0xb6f652?{'count':_0x255dcf,'rows':_0xb6f652}:null;})[_0x5f4526('0x5b')](respondWithResult(_0x1a41bb,null))[_0x5f4526('0x139')](handleError(_0x1a41bb,null));},exports[_0x15d5b3('0x3f')]=function(_0x24977a,_0x45cafb){const _0x665cbd=_0x15d5b3;let _0x1ae697={};const _0x80322d={};let _0x2e2f0a;return db['User'][_0x665cbd('0x12d')]({'where':{'id':_0x24977a[_0x665cbd('0xe')]['id']}})[_0x665cbd('0x5b')](handleEntityNotFound(_0x45cafb,null))['then'](function(_0x52244b){const _0x2693b5=_0x665cbd;if(_0x52244b)return _0x2e2f0a=_0x52244b,_0x80322d['model']=_[_0x2693b5('0x14e')](db[_0x2693b5('0xf1')][_0x2693b5('0x13c')]),_0x80322d['query']=_[_0x2693b5('0x14e')](_0x24977a[_0x2693b5('0x97')]),_0x80322d['filters']=_[_0x2693b5('0xdf')](_0x80322d[_0x2693b5('0x142')],_0x80322d[_0x2693b5('0x97')]),_0x1ae697[_0x2693b5('0xd6')]=_[_0x2693b5('0xdf')](_0x80322d[_0x2693b5('0x142')],qs['fields'](_0x24977a[_0x2693b5('0x97')]['fields'])),_0x1ae697[_0x2693b5('0xd6')]=_0x1ae697[_0x2693b5('0xd6')]['length']?_0x1ae697[_0x2693b5('0xd6')]:_0x80322d['model'],_0x1ae697[_0x2693b5('0xec')]=qs[_0x2693b5('0x15c')](_0x24977a[_0x2693b5('0x97')][_0x2693b5('0x15c')]),_0x1ae697[_0x2693b5('0xbc')]=qs[_0x2693b5('0x38')](_['pick'](_0x24977a[_0x2693b5('0x97')],_0x80322d['filters'])),_0x24977a[_0x2693b5('0x97')][_0x2693b5('0x138')]&&(_0x1ae697[_0x2693b5('0xbc')]=_[_0x2693b5('0xf4')](_0x1ae697[_0x2693b5('0xbc')],{[Op['or']]:_[_0x2693b5('0x58')](_0x1ae697[_0x2693b5('0xd6')],function(_0x7b464d){const _0xd15281=_0x2693b5,_0x3121d4={};return _0x3121d4[_0x7b464d]={[Op[_0xd15281('0x13d')]]:'%'+_0x24977a[_0xd15281('0x97')][_0xd15281('0x138')]+'%'},_0x3121d4;})})),_0x1ae697['model']=db[_0x2693b5('0xf1')],_0x1ae697['as']='Agents',_0x1ae697=_[_0x2693b5('0xf4')]({},_0x1ae697,_0x24977a[_0x2693b5('0xf5')]),_0x2e2f0a[_0x2693b5('0x72')]({'include':[_0x1ae697]});})[_0x665cbd('0x5b')](function(_0x2ad3db){const _0xd69653=_0x665cbd;if(_0x2ad3db){let _0x3db5d2={};const _0x299e34=[];for(let _0x5e178c=0x0;_0x5e178c<_0x2ad3db['length'];_0x5e178c+=0x1){for(let _0xc899b3=0x0,_0x449029;_0xc899b3<_0x2ad3db[_0x5e178c]['Agents'][_0xd69653('0x12e')];_0xc899b3+=0x1){_0x449029=_0x2ad3db[_0x5e178c][_0xd69653('0xf7')][_0xc899b3][_0xd69653('0x1e')]({'plain':!![]}),_0x3db5d2[_0x449029['id']]=_0x449029;}}_0x3db5d2=_['values'](_0x3db5d2);for(let _0x276586=qs['offset'](_0x24977a[_0xd69653('0x97')][_0xd69653('0x12a')]);_0x276586<_0x3db5d2[_0xd69653('0x12e')]&&_0x299e34[_0xd69653('0x12e')]<qs[_0xd69653('0x7a')](_0x24977a[_0xd69653('0x97')][_0xd69653('0x7a')]);_0x276586+=0x1){_0x3db5d2[_0x276586]&&_0x299e34[_0xd69653('0x67')](_0x3db5d2[_0x276586]);}return{'count':_0x3db5d2[_0xd69653('0x12e')],'rows':_0x299e34};}})['then'](respondWithResult(_0x45cafb,null))[_0x665cbd('0x139')](handleError(_0x45cafb,null));},exports['destroy']=function(_0x54cec5,_0xc1f767){const _0x148b31=_0x15d5b3;if(_0x54cec5[_0x148b31('0x5d')]['id']==_0x54cec5[_0x148b31('0xe')]['id'])return _0xc1f767[_0x148b31('0xda')](0x1f4)[_0x148b31('0xd')]({'message':'You\x20can\x27t\x20delete\x20yourself'});return db[_0x148b31('0xf1')][_0x148b31('0x12d')]({'where':{'id':_0x54cec5['params']['id']}})[_0x148b31('0x5b')](handleEntityNotFound(_0xc1f767,null))[_0x148b31('0x5b')](removeEntity(_0xc1f767,null))[_0x148b31('0x139')](handleError(_0xc1f767,null));},exports['addChatInteractions']=function(_0x576c18,_0x47c6f6){const _0x164e6b=_0x15d5b3;return db['User'][_0x164e6b('0x12d')]({'where':{'id':_0x576c18[_0x164e6b('0xe')]['id']}})['then'](handleEntityNotFound(_0x47c6f6,null))[_0x164e6b('0x5b')](function(_0x1c0c30){const _0x73fa3a=_0x164e6b;if(_0x1c0c30)return _0x1c0c30[_0x73fa3a('0x7b')](_0x576c18[_0x73fa3a('0x10c')]['ids'],{'through':_[_0x73fa3a('0x8a')](_0x576c18[_0x73fa3a('0x10c')],[_0x73fa3a('0x76'),'id'])})['then'](function(){const _0x1b41f5=_0x73fa3a;for(let _0x10206b=0x0;_0x10206b<_0x576c18[_0x1b41f5('0x10c')][_0x1b41f5('0x76')][_0x1b41f5('0x12e')];_0x10206b+=0x1){socket[_0x1b41f5('0xea')](_0x1b41f5('0xd7'),{'ChatInteractionId':Number(_0x576c18[_0x1b41f5('0x10c')][_0x1b41f5('0x76')][_0x10206b]),'UserId':Number(_0x576c18[_0x1b41f5('0xe')]['id'])});}return _0x576c18['body'][_0x1b41f5('0x76')];});})[_0x164e6b('0x5b')](respondWithResult(_0x47c6f6,null))[_0x164e6b('0x139')](handleError(_0x47c6f6,null));},exports[_0x15d5b3('0x107')]=function(_0x28203d,_0x47f5aa){const _0x756fb2=_0x15d5b3;return db['User'][_0x756fb2('0x12d')]({'where':{'id':_0x28203d[_0x756fb2('0xe')]['id']}})[_0x756fb2('0x5b')](handleEntityNotFound(_0x47f5aa,null))[_0x756fb2('0x5b')](function(_0x22e9d3){const _0x49909a=_0x756fb2;if(_0x22e9d3)return _0x22e9d3['removeChatInteractions'](_0x28203d[_0x49909a('0x97')][_0x49909a('0x76')])[_0x49909a('0x5b')](function(){const _0x705f0e=_0x49909a;if(_[_0x705f0e('0x9a')](_0x28203d[_0x705f0e('0x97')][_0x705f0e('0x76')]))for(let _0x12ca5f=0x0;_0x12ca5f<_0x28203d[_0x705f0e('0x97')][_0x705f0e('0x76')][_0x705f0e('0x12e')];_0x12ca5f+=0x1){socket['emit'](_0x705f0e('0xdb'),{'ChatInteractionId':Number(_0x28203d[_0x705f0e('0x97')]['ids'][_0x12ca5f]),'UserId':Number(_0x28203d[_0x705f0e('0xe')]['id'])});}else socket[_0x705f0e('0xea')](_0x705f0e('0xdb'),{'ChatInteractionId':Number(_0x28203d[_0x705f0e('0x97')][_0x705f0e('0x76')]),'UserId':Number(_0x28203d[_0x705f0e('0xe')]['id'])});});})[_0x756fb2('0x5b')](respondWithStatusCode(_0x47f5aa,null))[_0x756fb2('0x139')](handleError(_0x47f5aa,null));},exports[_0x15d5b3('0x130')]=function(_0x551542,_0x217693){const _0x41744b=_0x15d5b3;return db[_0x41744b('0xf1')]['findOne']({'where':{'id':_0x551542['params']['id']}})[_0x41744b('0x5b')](handleEntityNotFound(_0x217693,null))[_0x41744b('0x5b')](function(_0x1ba2c7){const _0x432d1e=_0x41744b;if(_0x1ba2c7)return _0x1ba2c7['addMailInteractions'](_0x551542['body'][_0x432d1e('0x76')],{'through':_['omit'](_0x551542[_0x432d1e('0x10c')],[_0x432d1e('0x76'),'id'])})[_0x432d1e('0x5b')](function(){const _0x5bedc5=_0x432d1e;for(let _0x3b7c0b=0x0;_0x3b7c0b<_0x551542[_0x5bedc5('0x10c')]['ids'][_0x5bedc5('0x12e')];_0x3b7c0b+=0x1){socket[_0x5bedc5('0xea')](_0x5bedc5('0xe4'),{'MailInteractionId':Number(_0x551542[_0x5bedc5('0x10c')]['ids'][_0x3b7c0b]),'UserId':Number(_0x551542['params']['id'])});}return _0x551542[_0x5bedc5('0x10c')]['ids'];});})['then'](respondWithResult(_0x217693,null))[_0x41744b('0x139')](handleError(_0x217693,null));},exports[_0x15d5b3('0x149')]=function(_0x344c76,_0x1ea790){const _0x4d9a1e=_0x15d5b3;return db[_0x4d9a1e('0xf1')][_0x4d9a1e('0x12d')]({'where':{'id':_0x344c76[_0x4d9a1e('0xe')]['id']}})['then'](handleEntityNotFound(_0x1ea790,null))[_0x4d9a1e('0x5b')](function(_0xec7e30){const _0x193c25=_0x4d9a1e;if(_0xec7e30)return _0xec7e30['removeMailInteractions'](_0x344c76[_0x193c25('0x97')][_0x193c25('0x76')])[_0x193c25('0x5b')](function(){const _0x270799=_0x193c25;if(_[_0x270799('0x9a')](_0x344c76['query'][_0x270799('0x76')]))for(let _0x341657=0x0;_0x341657<_0x344c76[_0x270799('0x97')][_0x270799('0x76')][_0x270799('0x12e')];_0x341657+=0x1){socket[_0x270799('0xea')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x344c76[_0x270799('0x97')]['ids'][_0x341657]),'UserId':Number(_0x344c76[_0x270799('0xe')]['id'])});}else socket['emit'](_0x270799('0xd1'),{'MailInteractionId':Number(_0x344c76[_0x270799('0x97')][_0x270799('0x76')]),'UserId':Number(_0x344c76[_0x270799('0xe')]['id'])});});})['then'](respondWithStatusCode(_0x1ea790,null))[_0x4d9a1e('0x139')](handleError(_0x1ea790,null));},exports['addFaxInteractions']=function(_0x11b3fd,_0x3f0d1a){const _0x29813f=_0x15d5b3;return db[_0x29813f('0xf1')][_0x29813f('0x12d')]({'where':{'id':_0x11b3fd['params']['id']}})[_0x29813f('0x5b')](handleEntityNotFound(_0x3f0d1a,null))[_0x29813f('0x5b')](function(_0x33c463){const _0x13f8a8=_0x29813f;if(_0x33c463)return _0x33c463[_0x13f8a8('0x82')](_0x11b3fd['body'][_0x13f8a8('0x76')],{'through':_['omit'](_0x11b3fd[_0x13f8a8('0x10c')],[_0x13f8a8('0x76'),'id'])})[_0x13f8a8('0x5b')](function(){const _0x3f16d1=_0x13f8a8;for(let _0x461590=0x0;_0x461590<_0x11b3fd['body'][_0x3f16d1('0x76')][_0x3f16d1('0x12e')];_0x461590+=0x1){socket[_0x3f16d1('0xea')]('user_has_fax_interactions:save',{'FaxInteractionId':Number(_0x11b3fd[_0x3f16d1('0x10c')]['ids'][_0x461590]),'UserId':Number(_0x11b3fd['params']['id'])});}return _0x11b3fd['body'][_0x3f16d1('0x76')];});})[_0x29813f('0x5b')](respondWithResult(_0x3f0d1a,null))[_0x29813f('0x139')](handleError(_0x3f0d1a,null));},exports[_0x15d5b3('0x8d')]=function(_0x4e312e,_0x4aa92c){const _0x2f4984=_0x15d5b3;return db[_0x2f4984('0xf1')]['findOne']({'where':{'id':_0x4e312e[_0x2f4984('0xe')]['id']}})['then'](handleEntityNotFound(_0x4aa92c,null))[_0x2f4984('0x5b')](function(_0x3356b7){const _0x5c328e=_0x2f4984;if(_0x3356b7)return _0x3356b7[_0x5c328e('0x8d')](_0x4e312e[_0x5c328e('0x97')][_0x5c328e('0x76')])[_0x5c328e('0x5b')](function(){const _0x5c2655=_0x5c328e;if(_[_0x5c2655('0x9a')](_0x4e312e[_0x5c2655('0x97')]['ids']))for(let _0x243524=0x0;_0x243524<_0x4e312e['query'][_0x5c2655('0x76')][_0x5c2655('0x12e')];_0x243524+=0x1){socket['emit'](_0x5c2655('0xa4'),{'FaxInteractionId':Number(_0x4e312e[_0x5c2655('0x97')][_0x5c2655('0x76')][_0x243524]),'UserId':Number(_0x4e312e['params']['id'])});}else socket[_0x5c2655('0xea')](_0x5c2655('0xa4'),{'FaxInteractionId':Number(_0x4e312e[_0x5c2655('0x97')][_0x5c2655('0x76')]),'UserId':Number(_0x4e312e['params']['id'])});});})[_0x2f4984('0x5b')](respondWithStatusCode(_0x4aa92c,null))[_0x2f4984('0x139')](handleError(_0x4aa92c,null));},exports[_0x15d5b3('0x5f')]=function(_0x204c13,_0x269a8d){const _0x6e669e=_0x15d5b3;return db['User'][_0x6e669e('0x12d')]({'where':{'id':_0x204c13[_0x6e669e('0xe')]['id']}})[_0x6e669e('0x5b')](handleEntityNotFound(_0x269a8d,null))[_0x6e669e('0x5b')](function(_0x3ae9a6){const _0x42f6df=_0x6e669e;if(_0x3ae9a6)return _0x3ae9a6['addSmsInteractions'](_0x204c13[_0x42f6df('0x10c')][_0x42f6df('0x76')],{'through':_['omit'](_0x204c13[_0x42f6df('0x10c')],['ids','id'])})[_0x42f6df('0x5b')](function(){const _0x409171=_0x42f6df;for(let _0x4c2809=0x0;_0x4c2809<_0x204c13[_0x409171('0x10c')][_0x409171('0x76')]['length'];_0x4c2809+=0x1){socket[_0x409171('0xea')](_0x409171('0x28'),{'SmsInteractionId':Number(_0x204c13['body'][_0x409171('0x76')][_0x4c2809]),'UserId':Number(_0x204c13[_0x409171('0xe')]['id'])});}return _0x204c13['body'][_0x409171('0x76')];});})[_0x6e669e('0x5b')](respondWithResult(_0x269a8d,null))[_0x6e669e('0x139')](handleError(_0x269a8d,null));},exports['removeSmsInteractions']=function(_0x5484dd,_0x506e84){const _0x32e19b=_0x15d5b3;return db['User']['findOne']({'where':{'id':_0x5484dd[_0x32e19b('0xe')]['id']}})[_0x32e19b('0x5b')](handleEntityNotFound(_0x506e84,null))[_0x32e19b('0x5b')](function(_0x5889fc){const _0x551c4b=_0x32e19b;if(_0x5889fc)return _0x5889fc[_0x551c4b('0xd5')](_0x5484dd[_0x551c4b('0x97')][_0x551c4b('0x76')])[_0x551c4b('0x5b')](function(){const _0x4a65d7=_0x551c4b;if(_[_0x4a65d7('0x9a')](_0x5484dd['query'][_0x4a65d7('0x76')]))for(let _0xef32dc=0x0;_0xef32dc<_0x5484dd[_0x4a65d7('0x97')][_0x4a65d7('0x76')][_0x4a65d7('0x12e')];_0xef32dc+=0x1){socket[_0x4a65d7('0xea')](_0x4a65d7('0x33'),{'SmsInteractionId':Number(_0x5484dd['query'][_0x4a65d7('0x76')][_0xef32dc]),'UserId':Number(_0x5484dd[_0x4a65d7('0xe')]['id'])});}else socket['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5484dd[_0x4a65d7('0x97')][_0x4a65d7('0x76')]),'UserId':Number(_0x5484dd['params']['id'])});});})[_0x32e19b('0x5b')](respondWithStatusCode(_0x506e84,null))['catch'](handleError(_0x506e84,null));},exports[_0x15d5b3('0x109')]=function(_0x4740cd,_0xe3a24e){const _0xcd7f10=_0x15d5b3;return db[_0xcd7f10('0xf1')][_0xcd7f10('0x12d')]({'where':{'id':_0x4740cd['params']['id']}})[_0xcd7f10('0x5b')](handleEntityNotFound(_0xe3a24e,null))[_0xcd7f10('0x5b')](function(_0x443606){const _0x27e053=_0xcd7f10;if(_0x443606)return _0x443606[_0x27e053('0x109')](_0x4740cd[_0x27e053('0x10c')]['ids'],{'through':_[_0x27e053('0x8a')](_0x4740cd[_0x27e053('0x10c')],['ids','id'])})[_0x27e053('0x5b')](function(){const _0x19efaf=_0x27e053;for(let _0x4a08fe=0x0;_0x4a08fe<_0x4740cd[_0x19efaf('0x10c')][_0x19efaf('0x76')][_0x19efaf('0x12e')];_0x4a08fe+=0x1){socket[_0x19efaf('0xea')]('user_has_openchannel_interactions:save',{'OpenchannelInteractionId':Number(_0x4740cd[_0x19efaf('0x10c')][_0x19efaf('0x76')][_0x4a08fe]),'UserId':Number(_0x4740cd[_0x19efaf('0xe')]['id'])});}return _0x4740cd[_0x19efaf('0x10c')]['ids'];});})[_0xcd7f10('0x5b')](respondWithResult(_0xe3a24e,null))[_0xcd7f10('0x139')](handleError(_0xe3a24e,null));},exports[_0x15d5b3('0xe0')]=function(_0x1a7c93,_0x5f3af0){const _0x3c0b14=_0x15d5b3;return db[_0x3c0b14('0xf1')][_0x3c0b14('0x12d')]({'where':{'id':_0x1a7c93[_0x3c0b14('0xe')]['id']}})[_0x3c0b14('0x5b')](handleEntityNotFound(_0x5f3af0,null))['then'](function(_0x3d2ea5){const _0x5eeeca=_0x3c0b14;if(_0x3d2ea5)return _0x3d2ea5[_0x5eeeca('0xe0')](_0x1a7c93['query']['ids'])[_0x5eeeca('0x5b')](function(){const _0x3dea77=_0x5eeeca;if(_[_0x3dea77('0x9a')](_0x1a7c93[_0x3dea77('0x97')][_0x3dea77('0x76')]))for(let _0xe5b2d9=0x0;_0xe5b2d9<_0x1a7c93[_0x3dea77('0x97')][_0x3dea77('0x76')][_0x3dea77('0x12e')];_0xe5b2d9+=0x1){socket[_0x3dea77('0xea')](_0x3dea77('0x6'),{'OpenchannelInteractionId':Number(_0x1a7c93[_0x3dea77('0x97')][_0x3dea77('0x76')][_0xe5b2d9]),'UserId':Number(_0x1a7c93[_0x3dea77('0xe')]['id'])});}else socket['emit'](_0x3dea77('0x6'),{'OpenchannelInteractionId':Number(_0x1a7c93[_0x3dea77('0x97')][_0x3dea77('0x76')]),'UserId':Number(_0x1a7c93[_0x3dea77('0xe')]['id'])});});})[_0x3c0b14('0x5b')](respondWithStatusCode(_0x5f3af0,null))[_0x3c0b14('0x139')](handleError(_0x5f3af0,null));},exports['addWhatsappInteractions']=function(_0x430f38,_0x3a7626){const _0x848236=_0x15d5b3;return db[_0x848236('0xf1')][_0x848236('0x12d')]({'where':{'id':_0x430f38[_0x848236('0xe')]['id']}})['then'](handleEntityNotFound(_0x3a7626,null))['then'](function(_0x4d7a25){const _0x11136d=_0x848236;if(_0x4d7a25)return _0x4d7a25[_0x11136d('0x113')](_0x430f38[_0x11136d('0x10c')][_0x11136d('0x76')],{'through':_[_0x11136d('0x8a')](_0x430f38['body'],['ids','id'])})[_0x11136d('0x5b')](function(){const _0x3cbcdd=_0x11136d;for(let _0x37f93a=0x0;_0x37f93a<_0x430f38[_0x3cbcdd('0x10c')][_0x3cbcdd('0x76')][_0x3cbcdd('0x12e')];_0x37f93a+=0x1){socket[_0x3cbcdd('0xea')](_0x3cbcdd('0x157'),{'WhatsappInteractionId':Number(_0x430f38['body'][_0x3cbcdd('0x76')][_0x37f93a]),'UserId':Number(_0x430f38[_0x3cbcdd('0xe')]['id'])});}return _0x430f38[_0x3cbcdd('0x10c')][_0x3cbcdd('0x76')];});})['then'](respondWithResult(_0x3a7626,null))[_0x848236('0x139')](handleError(_0x3a7626,null));},exports['removeWhatsappInteractions']=function(_0x3061fb,_0x18343f){const _0x20559a=_0x15d5b3;return db[_0x20559a('0xf1')][_0x20559a('0x12d')]({'where':{'id':_0x3061fb['params']['id']}})[_0x20559a('0x5b')](handleEntityNotFound(_0x18343f,null))[_0x20559a('0x5b')](function(_0x14f66e){const _0x1112bc=_0x20559a;if(_0x14f66e)return _0x14f66e[_0x1112bc('0x64')](_0x3061fb['query'][_0x1112bc('0x76')]);})[_0x20559a('0x5b')](respondWithStatusCode(_0x18343f,null))[_0x20559a('0x139')](handleError(_0x18343f,null));},exports[_0x15d5b3('0x4')]=function(_0x53e48b,_0x76234f){const _0x569720=_0x15d5b3;let _0x191ddc={};const _0xaacc48={};let _0x350551,_0x4eabb8;return db[_0x569720('0xf1')][_0x569720('0x12d')]({'where':{'id':_0x53e48b[_0x569720('0xe')]['id']}})[_0x569720('0x5b')](handleEntityNotFound(_0x76234f,null))[_0x569720('0x5b')](function(_0x554f8c){const _0x3f8c61=_0x569720;if(_0x554f8c)return _0x350551=_0x554f8c,_0xaacc48[_0x3f8c61('0x142')]=_[_0x3f8c61('0x14e')](db[_0x3f8c61('0xc')][_0x3f8c61('0x13c')]),_0xaacc48[_0x3f8c61('0x97')]=_['keys'](_0x53e48b[_0x3f8c61('0x97')]),_0xaacc48[_0x3f8c61('0x38')]=_['intersection'](_0xaacc48[_0x3f8c61('0x142')],_0xaacc48[_0x3f8c61('0x97')]),_0x191ddc['attributes']=_[_0x3f8c61('0xdf')](_0xaacc48['model'],qs[_0x3f8c61('0x11')](_0x53e48b[_0x3f8c61('0x97')][_0x3f8c61('0x11')])),_0x191ddc[_0x3f8c61('0xd6')]=_0x191ddc[_0x3f8c61('0xd6')]['length']?_0x191ddc[_0x3f8c61('0xd6')]:_0xaacc48[_0x3f8c61('0x142')],_0x191ddc[_0x3f8c61('0xec')]=qs[_0x3f8c61('0x15c')](_0x53e48b[_0x3f8c61('0x97')][_0x3f8c61('0x15c')]),_0x191ddc[_0x3f8c61('0xbc')]=qs['filters'](_[_0x3f8c61('0x6d')](_0x53e48b['query'],_0xaacc48[_0x3f8c61('0x38')])),_0x53e48b['query'][_0x3f8c61('0x138')]&&(_0x191ddc['where']=_['merge'](_0x191ddc[_0x3f8c61('0xbc')],{[Op['or']]:_[_0x3f8c61('0x58')](_0x191ddc[_0x3f8c61('0xd6')],function(_0x51fbf3){const _0x44ec9f=_0x3f8c61,_0x1da97f={};return _0x1da97f[_0x51fbf3]={[Op[_0x44ec9f('0x13d')]]:'%'+_0x53e48b[_0x44ec9f('0x97')][_0x44ec9f('0x138')]+'%'},_0x1da97f;})})),_0x191ddc=_[_0x3f8c61('0xf4')]({},_0x191ddc,_0x53e48b['options']),_0x350551[_0x3f8c61('0x4')](_0x191ddc);})[_0x569720('0x5b')](function(_0x29484f){const _0xa04df5=_0x569720;if(_0x29484f)return _0x4eabb8=_0x29484f['length'],typeof _0x53e48b[_0xa04df5('0x97')]['nolimit']==='undefined'&&(_0x191ddc[_0xa04df5('0x7a')]=qs[_0xa04df5('0x7a')](_0x53e48b[_0xa04df5('0x97')][_0xa04df5('0x7a')]),_0x191ddc[_0xa04df5('0x12a')]=qs[_0xa04df5('0x12a')](_0x53e48b['query'][_0xa04df5('0x12a')])),_0x350551[_0xa04df5('0x4')](_0x191ddc);})[_0x569720('0x5b')](function(_0x291019){if(_0x291019)return _0x291019?{'count':_0x4eabb8,'rows':_0x291019}:null;})['then'](respondWithResult(_0x76234f,null))[_0x569720('0x139')](handleError(_0x76234f,null));},exports[_0x15d5b3('0x143')]=function(_0x1b1d21,_0x1f5c05){const _0x58d0ef=_0x15d5b3;let _0x226701={};const _0x235209={};let _0x4348b6,_0x4634c0;return db['User']['findOne']({'where':{'id':_0x1b1d21['params']['id']}})['then'](handleEntityNotFound(_0x1f5c05,null))[_0x58d0ef('0x5b')](function(_0x337135){const _0x1a4710=_0x58d0ef;if(_0x337135)return _0x4348b6=_0x337135,_0x235209[_0x1a4710('0x142')]=_[_0x1a4710('0x14e')](db[_0x1a4710('0x51')][_0x1a4710('0x13c')]),_0x235209[_0x1a4710('0x97')]=_['keys'](_0x1b1d21[_0x1a4710('0x97')]),_0x235209[_0x1a4710('0x38')]=_[_0x1a4710('0xdf')](_0x235209['model'],_0x235209[_0x1a4710('0x97')]),_0x226701[_0x1a4710('0xd6')]=_['intersection'](_0x235209[_0x1a4710('0x142')],qs[_0x1a4710('0x11')](_0x1b1d21[_0x1a4710('0x97')][_0x1a4710('0x11')])),_0x226701['attributes']=_0x226701[_0x1a4710('0xd6')][_0x1a4710('0x12e')]?_0x226701[_0x1a4710('0xd6')]:_0x235209['model'],_0x226701[_0x1a4710('0xec')]=qs[_0x1a4710('0x15c')](_0x1b1d21[_0x1a4710('0x97')]['sort']),_0x226701[_0x1a4710('0xbc')]=qs[_0x1a4710('0x38')](_[_0x1a4710('0x6d')](_0x1b1d21[_0x1a4710('0x97')],_0x235209[_0x1a4710('0x38')])),_0x1b1d21['query']['filter']&&(_0x226701[_0x1a4710('0xbc')]=_[_0x1a4710('0xf4')](_0x226701['where'],{[Op['or']]:_[_0x1a4710('0x58')](_0x226701[_0x1a4710('0xd6')],function(_0x55dbae){const _0x479e3c=_0x1a4710,_0x531b45={};return _0x531b45[_0x55dbae]={[Op[_0x479e3c('0x13d')]]:'%'+_0x1b1d21[_0x479e3c('0x97')][_0x479e3c('0x138')]+'%'},_0x531b45;})})),_0x226701=_[_0x1a4710('0xf4')]({},_0x226701,_0x1b1d21[_0x1a4710('0xf5')]),_0x4348b6['getFaxAccounts'](_0x226701);})['then'](function(_0x4a21de){const _0x20c996=_0x58d0ef;if(_0x4a21de)return _0x4634c0=_0x4a21de['length'],typeof _0x1b1d21['query'][_0x20c996('0x48')]===_0x20c996('0x6c')&&(_0x226701[_0x20c996('0x7a')]=qs['limit'](_0x1b1d21[_0x20c996('0x97')]['limit']),_0x226701[_0x20c996('0x12a')]=qs['offset'](_0x1b1d21[_0x20c996('0x97')][_0x20c996('0x12a')])),_0x4348b6[_0x20c996('0x143')](_0x226701);})['then'](function(_0x502bbe){if(_0x502bbe)return _0x502bbe?{'count':_0x4634c0,'rows':_0x502bbe}:null;})[_0x58d0ef('0x5b')](respondWithResult(_0x1f5c05,null))[_0x58d0ef('0x139')](handleError(_0x1f5c05,null));},exports['addFaxAccounts']=function(_0x37eb83,_0x32104b){const _0x4b4fc7=_0x15d5b3;return db[_0x4b4fc7('0xf1')][_0x4b4fc7('0x12d')]({'where':{'id':_0x37eb83[_0x4b4fc7('0xe')]['id']}})['then'](handleEntityNotFound(_0x32104b,null))['then'](function(_0x2fdd8e){const _0x5051eb=_0x4b4fc7;if(_0x2fdd8e)return _0x2fdd8e[_0x5051eb('0xca')](_0x37eb83['body'][_0x5051eb('0x76')],{'through':_['omit'](_0x37eb83[_0x5051eb('0x10c')],['ids','id'])});})[_0x4b4fc7('0x5b')](respondWithResult(_0x32104b,null))['catch'](handleError(_0x32104b,null));},exports[_0x15d5b3('0x4b')]=function(_0x3e6f4a,_0x13ead5){const _0x114ee7=_0x15d5b3;return db[_0x114ee7('0xf1')][_0x114ee7('0x12d')]({'where':{'id':_0x3e6f4a[_0x114ee7('0xe')]['id']}})[_0x114ee7('0x5b')](handleEntityNotFound(_0x13ead5,null))[_0x114ee7('0x5b')](function(_0x41e2f1){const _0x2d08f5=_0x114ee7;if(_0x41e2f1)return _0x41e2f1[_0x2d08f5('0x4b')](_0x3e6f4a['query'][_0x2d08f5('0x76')]);})[_0x114ee7('0x5b')](respondWithStatusCode(_0x13ead5,null))[_0x114ee7('0x139')](handleError(_0x13ead5,null));},exports['getMailAccounts']=function(_0x922c24,_0xf8fd67){const _0x43a091=_0x15d5b3;let _0xc63122={};const _0x5569b6={};let _0x1d04c1,_0xf11466;return db[_0x43a091('0xf1')][_0x43a091('0x12d')]({'where':{'id':_0x922c24[_0x43a091('0xe')]['id']}})[_0x43a091('0x5b')](handleEntityNotFound(_0xf8fd67,null))[_0x43a091('0x5b')](function(_0x539c6f){const _0x314702=_0x43a091;if(_0x539c6f)return _0x1d04c1=_0x539c6f,_0x5569b6[_0x314702('0x142')]=_[_0x314702('0x14e')](db['MailAccount'][_0x314702('0x13c')]),_0x5569b6[_0x314702('0x97')]=_[_0x314702('0x14e')](_0x922c24[_0x314702('0x97')]),_0x5569b6[_0x314702('0x38')]=_[_0x314702('0xdf')](_0x5569b6[_0x314702('0x142')],_0x5569b6['query']),_0xc63122[_0x314702('0xd6')]=_[_0x314702('0xdf')](_0x5569b6['model'],qs[_0x314702('0x11')](_0x922c24['query'][_0x314702('0x11')])),_0xc63122['attributes']=_0xc63122[_0x314702('0xd6')]['length']?_0xc63122[_0x314702('0xd6')]:_0x5569b6[_0x314702('0x142')],_0xc63122['order']=qs[_0x314702('0x15c')](_0x922c24[_0x314702('0x97')][_0x314702('0x15c')]),_0xc63122[_0x314702('0xbc')]=qs[_0x314702('0x38')](_['pick'](_0x922c24[_0x314702('0x97')],_0x5569b6[_0x314702('0x38')])),_0x922c24[_0x314702('0x97')]['filter']&&(_0xc63122['where']=_['merge'](_0xc63122[_0x314702('0xbc')],{[Op['or']]:_[_0x314702('0x58')](_0xc63122['attributes'],function(_0x485ed1){const _0x33a05f=_0x314702,_0x207921={};return _0x207921[_0x485ed1]={[Op[_0x33a05f('0x13d')]]:'%'+_0x922c24['query'][_0x33a05f('0x138')]+'%'},_0x207921;})})),_0xc63122=_['merge']({},_0xc63122,_0x922c24[_0x314702('0xf5')]),_0x1d04c1[_0x314702('0x10')](_0xc63122);})[_0x43a091('0x5b')](function(_0x36209c){const _0x180f78=_0x43a091;if(_0x36209c)return _0xf11466=_0x36209c['length'],typeof _0x922c24[_0x180f78('0x97')][_0x180f78('0x48')]===_0x180f78('0x6c')&&(_0xc63122['limit']=qs[_0x180f78('0x7a')](_0x922c24[_0x180f78('0x97')][_0x180f78('0x7a')]),_0xc63122[_0x180f78('0x12a')]=qs['offset'](_0x922c24[_0x180f78('0x97')][_0x180f78('0x12a')])),_0x1d04c1[_0x180f78('0x10')](_0xc63122);})[_0x43a091('0x5b')](function(_0x231535){if(_0x231535)return _0x231535?{'count':_0xf11466,'rows':_0x231535}:null;})[_0x43a091('0x5b')](respondWithResult(_0xf8fd67,null))['catch'](handleError(_0xf8fd67,null));},exports['addMailAccounts']=function(_0x241ab1,_0x29713d){const _0x216a1b=_0x15d5b3;return db[_0x216a1b('0xf1')][_0x216a1b('0x12d')]({'where':{'id':_0x241ab1[_0x216a1b('0xe')]['id']}})[_0x216a1b('0x5b')](handleEntityNotFound(_0x29713d,null))[_0x216a1b('0x5b')](function(_0x45d6b0){const _0x372ce9=_0x216a1b;if(_0x45d6b0)return _0x45d6b0[_0x372ce9('0x1b')](_0x241ab1[_0x372ce9('0x10c')][_0x372ce9('0x76')],{'through':_[_0x372ce9('0x8a')](_0x241ab1['body'],['ids','id'])});})['then'](respondWithResult(_0x29713d,null))['catch'](handleError(_0x29713d,null));},exports[_0x15d5b3('0xa6')]=function(_0x32c758,_0x121410){const _0x3ae13a=_0x15d5b3;return db[_0x3ae13a('0xf1')][_0x3ae13a('0x12d')]({'where':{'id':_0x32c758[_0x3ae13a('0xe')]['id']}})[_0x3ae13a('0x5b')](handleEntityNotFound(_0x121410,null))[_0x3ae13a('0x5b')](function(_0x6c62a9){const _0x508b9f=_0x3ae13a;if(_0x6c62a9)return _0x6c62a9['removeMailAccounts'](_0x32c758[_0x508b9f('0x97')]['ids']);})[_0x3ae13a('0x5b')](respondWithStatusCode(_0x121410,null))['catch'](handleError(_0x121410,null));},exports[_0x15d5b3('0xc7')]=function(_0x4da4f4,_0x3d79a4){const _0x20db88=_0x15d5b3;let _0x4db5d4={};const _0x3f7c03={};let _0x2069e0,_0xad4c8d;return db[_0x20db88('0xf1')][_0x20db88('0x12d')]({'where':{'id':_0x4da4f4['params']['id']}})[_0x20db88('0x5b')](handleEntityNotFound(_0x3d79a4,null))[_0x20db88('0x5b')](function(_0xf225b1){const _0x24ae02=_0x20db88;if(_0xf225b1)return _0x2069e0=_0xf225b1,_0x3f7c03['model']=_[_0x24ae02('0x14e')](db[_0x24ae02('0x12f')]['rawAttributes']),_0x3f7c03['query']=_[_0x24ae02('0x14e')](_0x4da4f4[_0x24ae02('0x97')]),_0x3f7c03['filters']=_['intersection'](_0x3f7c03[_0x24ae02('0x142')],_0x3f7c03[_0x24ae02('0x97')]),_0x4db5d4['attributes']=_[_0x24ae02('0xdf')](_0x3f7c03['model'],qs[_0x24ae02('0x11')](_0x4da4f4[_0x24ae02('0x97')]['fields'])),_0x4db5d4['attributes']=_0x4db5d4['attributes'][_0x24ae02('0x12e')]?_0x4db5d4[_0x24ae02('0xd6')]:_0x3f7c03[_0x24ae02('0x142')],_0x4db5d4[_0x24ae02('0xec')]=qs[_0x24ae02('0x15c')](_0x4da4f4[_0x24ae02('0x97')][_0x24ae02('0x15c')]),_0x4db5d4['where']=qs[_0x24ae02('0x38')](_[_0x24ae02('0x6d')](_0x4da4f4[_0x24ae02('0x97')],_0x3f7c03[_0x24ae02('0x38')])),_0x4da4f4[_0x24ae02('0x97')]['filter']&&(_0x4db5d4[_0x24ae02('0xbc')]=_['merge'](_0x4db5d4[_0x24ae02('0xbc')],{[Op['or']]:_[_0x24ae02('0x58')](_0x4db5d4[_0x24ae02('0xd6')],function(_0x5110e3){const _0xd64ada=_0x24ae02,_0x11f745={};return _0x11f745[_0x5110e3]={[Op[_0xd64ada('0x13d')]]:'%'+_0x4da4f4[_0xd64ada('0x97')]['filter']+'%'},_0x11f745;})})),_0x4db5d4=_[_0x24ae02('0xf4')]({},_0x4db5d4,_0x4da4f4['options']),_0x2069e0[_0x24ae02('0xc7')](_0x4db5d4);})[_0x20db88('0x5b')](function(_0x1ed677){const _0x4b8550=_0x20db88;if(_0x1ed677)return _0xad4c8d=_0x1ed677[_0x4b8550('0x12e')],typeof _0x4da4f4[_0x4b8550('0x97')]['nolimit']===_0x4b8550('0x6c')&&(_0x4db5d4[_0x4b8550('0x7a')]=qs['limit'](_0x4da4f4[_0x4b8550('0x97')][_0x4b8550('0x7a')]),_0x4db5d4[_0x4b8550('0x12a')]=qs[_0x4b8550('0x12a')](_0x4da4f4[_0x4b8550('0x97')][_0x4b8550('0x12a')])),_0x2069e0[_0x4b8550('0xc7')](_0x4db5d4);})[_0x20db88('0x5b')](function(_0x44e466){if(_0x44e466)return _0x44e466?{'count':_0xad4c8d,'rows':_0x44e466}:null;})[_0x20db88('0x5b')](respondWithResult(_0x3d79a4,null))[_0x20db88('0x139')](handleError(_0x3d79a4,null));},exports[_0x15d5b3('0x18')]=function(_0x59270c,_0x2c9d56){const _0x4d5496=_0x15d5b3;return db[_0x4d5496('0xf1')]['findOne']({'where':{'id':_0x59270c[_0x4d5496('0xe')]['id']}})[_0x4d5496('0x5b')](function(_0x68785d){const _0x3d12a0=_0x4d5496;if(_0x68785d)return _0x68785d[_0x3d12a0('0x18')](_0x59270c[_0x3d12a0('0x10c')][_0x3d12a0('0x76')],{'through':_[_0x3d12a0('0x8a')](_0x59270c['body'],[_0x3d12a0('0x76'),'id'])});})[_0x4d5496('0x5b')](respondWithResult(_0x2c9d56,null))[_0x4d5496('0x139')](handleError(_0x2c9d56,null));},exports[_0x15d5b3('0x11c')]=function(_0x518f6a,_0x2610d9){const _0x2735dc=_0x15d5b3;return db['User'][_0x2735dc('0x12d')]({'where':{'id':_0x518f6a[_0x2735dc('0xe')]['id']}})[_0x2735dc('0x5b')](handleEntityNotFound(_0x2610d9,null))[_0x2735dc('0x5b')](function(_0x348175){const _0x1f38eb=_0x2735dc;if(_0x348175)return _0x348175['removeOpenchannelAccounts'](_0x518f6a[_0x1f38eb('0x97')]['ids']);})[_0x2735dc('0x5b')](respondWithStatusCode(_0x2610d9,null))[_0x2735dc('0x139')](handleError(_0x2610d9,null));},exports[_0x15d5b3('0x114')]=function(_0x57217a,_0xb5321e){const _0x5cffb9=_0x15d5b3;let _0x5e2264={};const _0x2e2dac={};let _0x4345e9,_0x49ceec;return db[_0x5cffb9('0xf1')][_0x5cffb9('0x12d')]({'where':{'id':_0x57217a[_0x5cffb9('0xe')]['id']}})[_0x5cffb9('0x5b')](handleEntityNotFound(_0xb5321e,null))[_0x5cffb9('0x5b')](function(_0x44c2a5){const _0x5bc8aa=_0x5cffb9;if(_0x44c2a5)return _0x4345e9=_0x44c2a5,_0x2e2dac[_0x5bc8aa('0x142')]=_[_0x5bc8aa('0x14e')](db['SmsAccount'][_0x5bc8aa('0x13c')]),_0x2e2dac[_0x5bc8aa('0x97')]=_[_0x5bc8aa('0x14e')](_0x57217a[_0x5bc8aa('0x97')]),_0x2e2dac[_0x5bc8aa('0x38')]=_[_0x5bc8aa('0xdf')](_0x2e2dac['model'],_0x2e2dac['query']),_0x5e2264[_0x5bc8aa('0xd6')]=_[_0x5bc8aa('0xdf')](_0x2e2dac[_0x5bc8aa('0x142')],qs[_0x5bc8aa('0x11')](_0x57217a[_0x5bc8aa('0x97')][_0x5bc8aa('0x11')])),_0x5e2264[_0x5bc8aa('0xd6')]=_0x5e2264[_0x5bc8aa('0xd6')][_0x5bc8aa('0x12e')]?_0x5e2264[_0x5bc8aa('0xd6')]:_0x2e2dac[_0x5bc8aa('0x142')],_0x5e2264['order']=qs[_0x5bc8aa('0x15c')](_0x57217a[_0x5bc8aa('0x97')]['sort']),_0x5e2264['where']=qs[_0x5bc8aa('0x38')](_[_0x5bc8aa('0x6d')](_0x57217a[_0x5bc8aa('0x97')],_0x2e2dac[_0x5bc8aa('0x38')])),_0x57217a[_0x5bc8aa('0x97')][_0x5bc8aa('0x138')]&&(_0x5e2264[_0x5bc8aa('0xbc')]=_[_0x5bc8aa('0xf4')](_0x5e2264[_0x5bc8aa('0xbc')],{[Op['or']]:_[_0x5bc8aa('0x58')](_0x5e2264['attributes'],function(_0x28ac56){const _0x1258d5=_0x5bc8aa,_0x163c57={};return _0x163c57[_0x28ac56]={[Op[_0x1258d5('0x13d')]]:'%'+_0x57217a[_0x1258d5('0x97')]['filter']+'%'},_0x163c57;})})),_0x5e2264=_[_0x5bc8aa('0xf4')]({},_0x5e2264,_0x57217a[_0x5bc8aa('0xf5')]),_0x4345e9[_0x5bc8aa('0x114')](_0x5e2264);})[_0x5cffb9('0x5b')](function(_0x35f4b3){const _0x35fdd8=_0x5cffb9;if(_0x35f4b3)return _0x49ceec=_0x35f4b3[_0x35fdd8('0x12e')],typeof _0x57217a[_0x35fdd8('0x97')][_0x35fdd8('0x48')]===_0x35fdd8('0x6c')&&(_0x5e2264[_0x35fdd8('0x7a')]=qs[_0x35fdd8('0x7a')](_0x57217a[_0x35fdd8('0x97')][_0x35fdd8('0x7a')]),_0x5e2264['offset']=qs['offset'](_0x57217a[_0x35fdd8('0x97')][_0x35fdd8('0x12a')])),_0x4345e9['getSmsAccounts'](_0x5e2264);})[_0x5cffb9('0x5b')](function(_0x18c4d5){if(_0x18c4d5)return _0x18c4d5?{'count':_0x49ceec,'rows':_0x18c4d5}:null;})[_0x5cffb9('0x5b')](respondWithResult(_0xb5321e,null))[_0x5cffb9('0x139')](handleError(_0xb5321e,null));},exports[_0x15d5b3('0xa9')]=function(_0x3e633e,_0x16420b){const _0x59fc1a=_0x15d5b3;return db['User']['findOne']({'where':{'id':_0x3e633e[_0x59fc1a('0xe')]['id']}})[_0x59fc1a('0x5b')](handleEntityNotFound(_0x16420b,null))[_0x59fc1a('0x5b')](function(_0x76962f){const _0x4dd2ff=_0x59fc1a;if(_0x76962f)return _0x76962f[_0x4dd2ff('0xa9')](_0x3e633e['body'][_0x4dd2ff('0x76')],{'through':_['omit'](_0x3e633e[_0x4dd2ff('0x10c')],[_0x4dd2ff('0x76'),'id'])});})[_0x59fc1a('0x5b')](respondWithResult(_0x16420b,null))['catch'](handleError(_0x16420b,null));},exports[_0x15d5b3('0xcf')]=function(_0x39b50c,_0x31a048){const _0x22fd27=_0x15d5b3;return db[_0x22fd27('0xf1')]['findOne']({'where':{'id':_0x39b50c[_0x22fd27('0xe')]['id']}})['then'](handleEntityNotFound(_0x31a048,null))['then'](function(_0x5c9b99){const _0x21f961=_0x22fd27;if(_0x5c9b99)return _0x5c9b99[_0x21f961('0xcf')](_0x39b50c['query'][_0x21f961('0x76')]);})[_0x22fd27('0x5b')](respondWithStatusCode(_0x31a048,null))[_0x22fd27('0x139')](handleError(_0x31a048,null));},exports[_0x15d5b3('0x5a')]=function(_0x30a6c7,_0x23a58a){const _0x28c5c4=_0x15d5b3;let _0x39e445={};const _0x3ae94f={};let _0xfe3b12,_0x1fe802;return db[_0x28c5c4('0xf1')][_0x28c5c4('0x12d')]({'where':{'id':_0x30a6c7[_0x28c5c4('0xe')]['id']}})[_0x28c5c4('0x5b')](handleEntityNotFound(_0x23a58a,null))[_0x28c5c4('0x5b')](function(_0x401626){const _0x53f272=_0x28c5c4;if(_0x401626)return _0xfe3b12=_0x401626,_0x3ae94f[_0x53f272('0x142')]=_['keys'](db[_0x53f272('0x2a')][_0x53f272('0x13c')]),_0x3ae94f['query']=_[_0x53f272('0x14e')](_0x30a6c7[_0x53f272('0x97')]),_0x3ae94f[_0x53f272('0x38')]=_[_0x53f272('0xdf')](_0x3ae94f[_0x53f272('0x142')],_0x3ae94f[_0x53f272('0x97')]),_0x39e445[_0x53f272('0xd6')]=_[_0x53f272('0xdf')](_0x3ae94f[_0x53f272('0x142')],qs[_0x53f272('0x11')](_0x30a6c7[_0x53f272('0x97')][_0x53f272('0x11')])),_0x39e445['attributes']=_0x39e445[_0x53f272('0xd6')]['length']?_0x39e445[_0x53f272('0xd6')]:_0x3ae94f[_0x53f272('0x142')],_0x39e445[_0x53f272('0xec')]=qs[_0x53f272('0x15c')](_0x30a6c7[_0x53f272('0x97')]['sort']),_0x39e445[_0x53f272('0xbc')]=qs['filters'](_['pick'](_0x30a6c7[_0x53f272('0x97')],_0x3ae94f[_0x53f272('0x38')])),_0x30a6c7[_0x53f272('0x97')][_0x53f272('0x138')]&&(_0x39e445[_0x53f272('0xbc')]=_[_0x53f272('0xf4')](_0x39e445[_0x53f272('0xbc')],{[Op['or']]:_[_0x53f272('0x58')](_0x39e445[_0x53f272('0xd6')],function(_0x40870d){const _0x4844ec=_0x53f272,_0xd8b5f={};return _0xd8b5f[_0x40870d]={[Op[_0x4844ec('0x13d')]]:'%'+_0x30a6c7[_0x4844ec('0x97')]['filter']+'%'},_0xd8b5f;})})),_0x39e445=_[_0x53f272('0xf4')]({},_0x39e445,_0x30a6c7[_0x53f272('0xf5')]),_0xfe3b12[_0x53f272('0x5a')](_0x39e445);})[_0x28c5c4('0x5b')](function(_0x5ca569){const _0x14ddfc=_0x28c5c4;if(_0x5ca569)return _0x1fe802=_0x5ca569[_0x14ddfc('0x12e')],typeof _0x30a6c7['query'][_0x14ddfc('0x48')]==='undefined'&&(_0x39e445[_0x14ddfc('0x7a')]=qs['limit'](_0x30a6c7[_0x14ddfc('0x97')]['limit']),_0x39e445[_0x14ddfc('0x12a')]=qs[_0x14ddfc('0x12a')](_0x30a6c7[_0x14ddfc('0x97')][_0x14ddfc('0x12a')])),_0xfe3b12[_0x14ddfc('0x5a')](_0x39e445);})[_0x28c5c4('0x5b')](function(_0xe33575){if(_0xe33575)return _0xe33575?{'count':_0x1fe802,'rows':_0xe33575}:null;})[_0x28c5c4('0x5b')](respondWithResult(_0x23a58a,null))['catch'](handleError(_0x23a58a,null));},exports[_0x15d5b3('0x54')]=function(_0x200e94,_0x2cdd9a){const _0x54e8e6=_0x15d5b3;return db['User'][_0x54e8e6('0x12d')]({'where':{'id':_0x200e94[_0x54e8e6('0xe')]['id']}})['then'](handleEntityNotFound(_0x2cdd9a,null))[_0x54e8e6('0x5b')](function(_0x2d4904){const _0x202a90=_0x54e8e6;if(_0x2d4904)return _0x2d4904[_0x202a90('0x54')](_0x200e94['body'][_0x202a90('0x76')],{'through':_[_0x202a90('0x8a')](_0x200e94['body'],[_0x202a90('0x76'),'id'])});})['then'](respondWithResult(_0x2cdd9a,null))['catch'](handleError(_0x2cdd9a,null));},exports[_0x15d5b3('0x2f')]=function(_0x4947be,_0x37829f){const _0x183f9b=_0x15d5b3;return db['User'][_0x183f9b('0x12d')]({'where':{'id':_0x4947be['params']['id']}})[_0x183f9b('0x5b')](handleEntityNotFound(_0x37829f,null))[_0x183f9b('0x5b')](function(_0xddeea4){const _0x24f252=_0x183f9b;if(_0xddeea4)return _0xddeea4[_0x24f252('0x2f')](_0x4947be[_0x24f252('0x97')][_0x24f252('0x76')]);})[_0x183f9b('0x5b')](respondWithStatusCode(_0x37829f,null))['catch'](handleError(_0x37829f,null));},exports[_0x15d5b3('0x7f')]=function(_0x53adb9,_0x43e899){const _0x118e11=_0x15d5b3;let _0x8bf3a3={};const _0x42702a={};let _0x8b4892,_0x3a39b6;return db['User'][_0x118e11('0x12d')]({'where':{'id':_0x53adb9['params']['id']}})[_0x118e11('0x5b')](handleEntityNotFound(_0x43e899,null))[_0x118e11('0x5b')](function(_0x29c98d){const _0x613e40=_0x118e11;if(_0x29c98d)return _0x8b4892=_0x29c98d,_0x42702a['model']=_[_0x613e40('0x14e')](db[_0x613e40('0x9f')][_0x613e40('0x13c')]),_0x42702a[_0x613e40('0x97')]=_[_0x613e40('0x14e')](_0x53adb9[_0x613e40('0x97')]),_0x42702a[_0x613e40('0x38')]=_[_0x613e40('0xdf')](_0x42702a[_0x613e40('0x142')],_0x42702a['query']),_0x8bf3a3[_0x613e40('0xd6')]=_[_0x613e40('0xdf')](_0x42702a[_0x613e40('0x142')],qs[_0x613e40('0x11')](_0x53adb9['query']['fields'])),_0x8bf3a3['attributes']=_0x8bf3a3[_0x613e40('0xd6')][_0x613e40('0x12e')]?_0x8bf3a3[_0x613e40('0xd6')]:_0x42702a[_0x613e40('0x142')],_0x8bf3a3['order']=qs[_0x613e40('0x15c')](_0x53adb9[_0x613e40('0x97')][_0x613e40('0x15c')]),_0x8bf3a3[_0x613e40('0xbc')]=qs[_0x613e40('0x38')](_['pick'](_0x53adb9[_0x613e40('0x97')],_0x42702a[_0x613e40('0x38')])),_0x53adb9[_0x613e40('0x97')][_0x613e40('0x138')]&&(_0x8bf3a3[_0x613e40('0xbc')]=_['merge'](_0x8bf3a3['where'],{[Op['or']]:_[_0x613e40('0x58')](_0x8bf3a3[_0x613e40('0xd6')],function(_0x15f529){const _0x4f5c40=_0x613e40,_0x5dab2b={};return _0x5dab2b[_0x15f529]={[Op[_0x4f5c40('0x13d')]]:'%'+_0x53adb9[_0x4f5c40('0x97')][_0x4f5c40('0x138')]+'%'},_0x5dab2b;})})),_0x8bf3a3=_[_0x613e40('0xf4')]({},_0x8bf3a3,_0x53adb9[_0x613e40('0xf5')]),_0x8b4892[_0x613e40('0x7f')](_0x8bf3a3);})[_0x118e11('0x5b')](function(_0x3b97cf){const _0x2ab3d3=_0x118e11;if(_0x3b97cf)return _0x3a39b6=_0x3b97cf[_0x2ab3d3('0x12e')],typeof _0x53adb9['query'][_0x2ab3d3('0x48')]===_0x2ab3d3('0x6c')&&(_0x8bf3a3[_0x2ab3d3('0x7a')]=qs[_0x2ab3d3('0x7a')](_0x53adb9[_0x2ab3d3('0x97')][_0x2ab3d3('0x7a')]),_0x8bf3a3[_0x2ab3d3('0x12a')]=qs[_0x2ab3d3('0x12a')](_0x53adb9[_0x2ab3d3('0x97')]['offset'])),_0x8b4892['getWhatsappAccounts'](_0x8bf3a3);})['then'](function(_0x10a79f){if(_0x10a79f)return _0x10a79f?{'count':_0x3a39b6,'rows':_0x10a79f}:null;})[_0x118e11('0x5b')](respondWithResult(_0x43e899,null))[_0x118e11('0x139')](handleError(_0x43e899,null));},exports['addWhatsappAccounts']=function(_0x2a5919,_0x42d63e){const _0x18ee64=_0x15d5b3;return db[_0x18ee64('0xf1')][_0x18ee64('0x12d')]({'where':{'id':_0x2a5919[_0x18ee64('0xe')]['id']}})[_0x18ee64('0x5b')](handleEntityNotFound(_0x42d63e,null))[_0x18ee64('0x5b')](function(_0x299364){const _0x3e2a10=_0x18ee64;if(_0x299364)return _0x299364[_0x3e2a10('0x1a')](_0x2a5919[_0x3e2a10('0x10c')][_0x3e2a10('0x76')],{'through':_['omit'](_0x2a5919['body'],[_0x3e2a10('0x76'),'id'])});})[_0x18ee64('0x5b')](respondWithResult(_0x42d63e,null))[_0x18ee64('0x139')](handleError(_0x42d63e,null));},exports['removeWhatsappAccounts']=function(_0x715846,_0x1a0640){const _0x493704=_0x15d5b3;return db['User']['findOne']({'where':{'id':_0x715846[_0x493704('0xe')]['id']}})['then'](handleEntityNotFound(_0x1a0640,null))[_0x493704('0x5b')](function(_0x2a47b2){const _0x5ae69b=_0x493704;if(_0x2a47b2)return _0x2a47b2[_0x5ae69b('0x24')](_0x715846[_0x5ae69b('0x97')][_0x5ae69b('0x76')]);})[_0x493704('0x5b')](respondWithStatusCode(_0x1a0640,null))[_0x493704('0x139')](handleError(_0x1a0640,null));},exports[_0x15d5b3('0x118')]=function(_0x352e28,_0xe5b092){const _0x74c8af=_0x15d5b3;let _0x4bf130={};const _0x147574={};let _0x5f04c6,_0x21d382;return db[_0x74c8af('0xf1')]['findOne']({'where':{'id':_0x352e28[_0x74c8af('0xe')]['id']}})[_0x74c8af('0x5b')](handleEntityNotFound(_0xe5b092,null))[_0x74c8af('0x5b')](function(_0x1235bf){const _0x3d130b=_0x74c8af;if(_0x1235bf)return _0x5f04c6=_0x1235bf,_0x147574['model']=_[_0x3d130b('0x14e')](db['SquareProject'][_0x3d130b('0x13c')]),_0x147574['query']=_[_0x3d130b('0x14e')](_0x352e28['query']),_0x147574[_0x3d130b('0x38')]=_[_0x3d130b('0xdf')](_0x147574['model'],_0x147574[_0x3d130b('0x97')]),_0x4bf130[_0x3d130b('0xd6')]=_[_0x3d130b('0xdf')](_0x147574['model'],qs[_0x3d130b('0x11')](_0x352e28[_0x3d130b('0x97')]['fields'])),_0x4bf130[_0x3d130b('0xd6')]=_0x4bf130[_0x3d130b('0xd6')][_0x3d130b('0x12e')]?_0x4bf130[_0x3d130b('0xd6')]:_0x147574[_0x3d130b('0x142')],_0x4bf130['order']=qs[_0x3d130b('0x15c')](_0x352e28[_0x3d130b('0x97')][_0x3d130b('0x15c')]),_0x4bf130[_0x3d130b('0xbc')]=qs['filters'](_[_0x3d130b('0x6d')](_0x352e28[_0x3d130b('0x97')],_0x147574[_0x3d130b('0x38')])),_0x352e28['query'][_0x3d130b('0x138')]&&(_0x4bf130[_0x3d130b('0xbc')]=_['merge'](_0x4bf130[_0x3d130b('0xbc')],{[Op['or']]:_[_0x3d130b('0x58')](_0x4bf130[_0x3d130b('0xd6')],function(_0x107367){const _0x94f6ef=_0x3d130b,_0x9608d7={};return _0x9608d7[_0x107367]={[Op['like']]:'%'+_0x352e28[_0x94f6ef('0x97')][_0x94f6ef('0x138')]+'%'},_0x9608d7;})})),_0x4bf130=_[_0x3d130b('0xf4')]({},_0x4bf130,_0x352e28[_0x3d130b('0xf5')]),_0x5f04c6[_0x3d130b('0x118')](_0x4bf130);})[_0x74c8af('0x5b')](function(_0x4d0147){const _0x42d228=_0x74c8af;if(_0x4d0147)return _0x21d382=_0x4d0147[_0x42d228('0x12e')],typeof _0x352e28[_0x42d228('0x97')][_0x42d228('0x48')]==='undefined'&&(_0x4bf130['limit']=qs[_0x42d228('0x7a')](_0x352e28['query'][_0x42d228('0x7a')]),_0x4bf130[_0x42d228('0x12a')]=qs[_0x42d228('0x12a')](_0x352e28[_0x42d228('0x97')][_0x42d228('0x12a')])),_0x5f04c6['getSquareProjects'](_0x4bf130);})[_0x74c8af('0x5b')](function(_0x4805c7){if(_0x4805c7)return _0x4805c7?{'count':_0x21d382,'rows':_0x4805c7}:null;})[_0x74c8af('0x5b')](respondWithResult(_0xe5b092,null))[_0x74c8af('0x139')](handleError(_0xe5b092,null));},exports[_0x15d5b3('0x11b')]=function(_0x2ebabb,_0x47e958){const _0x13d9e6=_0x15d5b3;return db['User']['findOne']({'where':{'id':_0x2ebabb[_0x13d9e6('0xe')]['id']}})[_0x13d9e6('0x5b')](handleEntityNotFound(_0x47e958,null))['then'](function(_0x283d6e){const _0xdce11e=_0x13d9e6;if(_0x283d6e)return _0x283d6e[_0xdce11e('0x11b')](_0x2ebabb[_0xdce11e('0x10c')]['ids'],{'through':_[_0xdce11e('0x8a')](_0x2ebabb[_0xdce11e('0x10c')],[_0xdce11e('0x76'),'id'])});})['then'](respondWithResult(_0x47e958,null))['catch'](handleError(_0x47e958,null));},exports[_0x15d5b3('0xe6')]=function(_0x105b32,_0x3656f9){const _0x53e5a9=_0x15d5b3;return db[_0x53e5a9('0xf1')][_0x53e5a9('0x12d')]({'where':{'id':_0x105b32['params']['id']}})[_0x53e5a9('0x5b')](handleEntityNotFound(_0x3656f9,null))[_0x53e5a9('0x5b')](function(_0x17e512){const _0x1051e0=_0x53e5a9;if(_0x17e512)return _0x17e512['removeSquareProjects'](_0x105b32[_0x1051e0('0x97')][_0x1051e0('0x76')]);})[_0x53e5a9('0x5b')](respondWithStatusCode(_0x3656f9,null))['catch'](handleError(_0x3656f9,null));},exports[_0x15d5b3('0x3d')]=function(_0x128bf3,_0x51db0f){const _0x53514d=_0x15d5b3;let _0x3948dd={};const _0x21725d={},_0x4c1aa2={'count':0x0,'rows':[]},_0x26a627=db[_0x53514d('0x103')][_0x53514d('0x13c')];_0x21725d[_0x53514d('0x142')]=_[_0x53514d('0x14e')](_0x26a627),_0x21725d[_0x53514d('0x97')]=_[_0x53514d('0x14e')](_0x128bf3[_0x53514d('0x97')]),_0x21725d[_0x53514d('0x38')]=_[_0x53514d('0xdf')](_0x21725d[_0x53514d('0x142')],_0x21725d[_0x53514d('0x97')]),_0x21725d['filters']=_['concat'](_0x21725d[_0x53514d('0x38')],[_0x53514d('0x105'),_0x53514d('0x2c'),_0x53514d('0x71'),_0x53514d('0x65'),_0x53514d('0x6a'),_0x53514d('0x31'),_0x53514d('0x121'),_0x53514d('0xf9'),_0x53514d('0x112'),'$between',_0x53514d('0x6b'),_0x53514d('0x150'),'$notIn',_0x53514d('0x89'),_0x53514d('0x135'),'$iLike',_0x53514d('0xed'),_0x53514d('0x89'),_0x53514d('0xc1'),_0x53514d('0x15d'),_0x53514d('0x79'),_0x53514d('0x10f')]),_0x3948dd['attributes']=_[_0x53514d('0xdf')](_0x21725d[_0x53514d('0x142')],qs[_0x53514d('0x11')](_0x128bf3[_0x53514d('0x97')][_0x53514d('0x11')])),_0x3948dd[_0x53514d('0xd6')]=_0x3948dd[_0x53514d('0xd6')][_0x53514d('0x12e')]?_0x3948dd['attributes']:_0x21725d[_0x53514d('0x142')];typeof _0x128bf3[_0x53514d('0x97')][_0x53514d('0x48')]===_0x53514d('0x6c')&&(_0x3948dd[_0x53514d('0x7a')]=qs['limit'](_0x128bf3[_0x53514d('0x97')][_0x53514d('0x7a')]),_0x3948dd[_0x53514d('0x12a')]=qs['offset'](_0x128bf3[_0x53514d('0x97')][_0x53514d('0x12a')]));_0x3948dd[_0x53514d('0xec')]=qs['sort'](_0x128bf3[_0x53514d('0x97')][_0x53514d('0x15c')]),_0x3948dd[_0x53514d('0xbc')]=qs[_0x53514d('0x38')](_['pick'](_0x128bf3[_0x53514d('0x97')],_0x21725d[_0x53514d('0x38')]));_0x128bf3[_0x53514d('0x97')][_0x53514d('0x138')]&&(_0x3948dd['where']=_[_0x53514d('0xf4')](_0x3948dd[_0x53514d('0xbc')],{[Op['or']]:_[_0x53514d('0x58')](_0x3948dd[_0x53514d('0xd6')],function(_0x364e59){const _0x1db93c=_0x53514d,_0x181bf0={};return _0x181bf0[_0x364e59]={[Op['like']]:'%'+_0x128bf3['query'][_0x1db93c('0x138')]+'%'},_0x181bf0;})}));_0x3948dd[_0x53514d('0xbc')]={[Op[_0x53514d('0x108')]]:[_0x3948dd[_0x53514d('0xbc')],{[Op['or']]:[{'UserId':_0x128bf3['params']['id']},{'OwnerId':_0x128bf3['params']['id']}]}]},_0x3948dd=_[_0x53514d('0xf4')]({},_0x3948dd,_0x128bf3[_0x53514d('0xf5')]);const _0x11a419={'where':_0x3948dd[_0x53514d('0xbc')]};return db[_0x53514d('0x103')]['count'](_0x11a419)[_0x53514d('0x5b')](function(_0x347faa){const _0x39ab19=_0x53514d;return _0x4c1aa2['count']=_0x347faa,_0x128bf3[_0x39ab19('0x97')]['includeAll']&&(_0x3948dd[_0x39ab19('0x39')]=[{'attributes':['id',_0x39ab19('0xcb'),_0x39ab19('0x69'),_0x39ab19('0x87')],'model':db[_0x39ab19('0x8')],'as':'Contact'},{'attributes':['id',_0x39ab19('0x32'),_0x39ab19('0x1f')],'model':db[_0x39ab19('0x4a')],'as':_0x39ab19('0x50')}]),db[_0x39ab19('0x103')][_0x39ab19('0xeb')](_0x3948dd);})[_0x53514d('0x5b')](function(_0x46990c){return _0x4c1aa2['rows']=_0x46990c,_0x4c1aa2;})[_0x53514d('0x5b')](respondWithFilteredResult(_0x51db0f,_0x3948dd))['catch'](handleError(_0x51db0f,null));},exports[_0x15d5b3('0x75')]=function(_0x1bb7a9,_0x2b79ab){const _0x17699c=_0x15d5b3;return!_[_0x17699c('0x99')](_0x1bb7a9[_0x17699c('0x5d')]['id'])&&(_0x1bb7a9[_0x17699c('0x5d')][_0x17699c('0x86')]=='admin'||_0x1bb7a9[_0x17699c('0x5d')][_0x17699c('0x86')]==_0x17699c('0x5d'))?db['User'][_0x17699c('0x12d')]({'where':{'id':_0x1bb7a9[_0x17699c('0xe')]['id']},'raw':!![]})['then'](function(_0x215961){const _0x10413e=_0x17699c;return authService[_0x10413e('0xa1')](_0x215961);})[_0x17699c('0x5b')](function(_0x4d3af0){const _0x359a4c=_0x17699c;return _0x4d3af0?_0x2b79ab['status'](0xc8)[_0x359a4c('0x3e')]({'api_key':_0x4d3af0[_0x359a4c('0x128')]}):_0x2b79ab[_0x359a4c('0xda')](0xcc)['json']({'message':_0x359a4c('0x11f')});})['catch'](handleError(_0x2b79ab,0x193)):_0x2b79ab[_0x17699c('0xda')](0x191)[_0x17699c('0x3e')]({'message':_0x17699c('0x91')});},exports[_0x15d5b3('0x1')]=function(_0x19d482,_0x4b9db3){const _0x218163=_0x15d5b3;return!_[_0x218163('0x99')](_0x19d482[_0x218163('0x5d')]['id'])&&(_0x19d482[_0x218163('0x5d')][_0x218163('0x86')]=='admin'||_0x19d482[_0x218163('0x5d')][_0x218163('0x86')]==_0x218163('0x5d'))?db['Use'][_0x218163('0x12d')]({'where':{'id':_0x19d482[_0x218163('0xe')]['id']}})[_0x218163('0x5b')](function(_0x232e04){return authService['generateApiKey'](_0x232e04);})[_0x218163('0x5b')](function(_0x5f3ba3){const _0x2dd62b=_0x218163;return db[_0x2dd62b('0xf1')][_0x2dd62b('0xfc')]({'apiKeyIat':_0x5f3ba3[_0x2dd62b('0x14')],'apiKeyNonce':_0x5f3ba3['nonce']},{'where':{'id':_0x19d482['params']['id']}})[_0x2dd62b('0x5b')](function(){const _0x3d3624=_0x2dd62b;return _0x4b9db3[_0x3d3624('0xda')](0xc8)[_0x3d3624('0x3e')]({'api_key':_0x5f3ba3[_0x3d3624('0x128')]});});})[_0x218163('0x139')](handleError(_0x4b9db3,0x193)):_0x4b9db3['status'](0x191)[_0x218163('0x3e')]({'message':_0x218163('0x91')});},exports[_0x15d5b3('0x4f')]=function(_0x5b09cb,_0x24d6e5){const _0x53668b=_0x15d5b3;return!_[_0x53668b('0x99')](_0x5b09cb[_0x53668b('0x5d')]['id'])&&(_0x5b09cb[_0x53668b('0x5d')][_0x53668b('0x86')]==_0x53668b('0x66')||_0x5b09cb[_0x53668b('0x5d')]['role']==_0x53668b('0x5d'))?db[_0x53668b('0xfb')][_0x53668b('0x12d')]({'where':{'id':_0x5b09cb[_0x53668b('0xe')]['id']}})[_0x53668b('0x5b')](handleEntityNotFound(_0x24d6e5,null))[_0x53668b('0x5b')](function(_0x4a5da9){const _0x56e563=_0x53668b;if(_0x4a5da9&&_0x4a5da9['apiKeyNonce']&&_0x4a5da9[_0x56e563('0xc2')])return _0x4a5da9;else throw{'message':_0x56e563('0x8e')};})[_0x53668b('0x5b')](function(){const _0x295c4f=_0x53668b;return db[_0x295c4f('0xf1')][_0x295c4f('0xfc')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x5b09cb[_0x295c4f('0xe')]['id']}});})[_0x53668b('0x5b')](respondWithStatusCode(_0x24d6e5,0xc8))[_0x53668b('0x139')](handleError(_0x24d6e5,0x193)):_0x24d6e5[_0x53668b('0xda')](0x191)['json']({'message':_0x53668b('0x91')});},exports[_0x15d5b3('0x57')]=function(_0x50779a,_0x284983){const _0x3aa7f5=_0x15d5b3,_0x49943e=_0x50779a[_0x3aa7f5('0x5d')][_0x3aa7f5('0x1e')]({'plain':!![]});return!_0x49943e?_0x284983[_0x3aa7f5('0xda')](0x191)[_0x3aa7f5('0xd')]('Unable\x20to\x20retrieve\x20the\x20current\x20user'):_0x284983[_0x3aa7f5('0xda')](0xc8)[_0x3aa7f5('0x3e')](_0x49943e);};