Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / openchannelAccount / openchannelAccount.controller.js
index e482a1b..df0f653 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff22=['*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','OpenchannelQueue','queueId','queue','waitForTheAssignedQueue','Start','EventManager','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','update','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','keys','length','create','body','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','describe','OpenchannelAccountId','Disposition','getDispositions','pick','removeDispositions','ids','CannedAnswer','findOne','rows','removeAnswers','notify','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','CmContact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','push','close'];(function(_0x45cb28,_0x583de8){var _0x14b612=function(_0x145aa8){while(--_0x145aa8){_0x45cb28['push'](_0x45cb28['shift']());}};_0x14b612(++_0x583de8);}(_0xff22,0x1a0));var _0x2ff2=function(_0x580b3f,_0x1868fa){_0x580b3f=_0x580b3f-0x0;var _0x659700=_0xff22[_0x580b3f];return _0x659700;};'use strict';var emlformat=require(_0x2ff2('0x0'));var rimraf=require(_0x2ff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ff2('0x2'));var rp=require(_0x2ff2('0x3'));var moment=require(_0x2ff2('0x4'));var BPromise=require(_0x2ff2('0x5'));var Mustache=require(_0x2ff2('0x6'));var util=require(_0x2ff2('0x7'));var path=require(_0x2ff2('0x8'));var sox=require(_0x2ff2('0x9'));var csv=require(_0x2ff2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ff2('0xb'));var _=require(_0x2ff2('0xc'));var squel=require(_0x2ff2('0xd'));var crypto=require(_0x2ff2('0xe'));var jsforce=require(_0x2ff2('0xf'));var deskjs=require(_0x2ff2('0x10'));var toCsv=require(_0x2ff2('0xa'));var querystring=require('querystring');var Papa=require(_0x2ff2('0x11'));var Redis=require(_0x2ff2('0x12'));var authService=require(_0x2ff2('0x13'));var qs=require(_0x2ff2('0x14'));var as=require(_0x2ff2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2ff2('0x16'));var config=require(_0x2ff2('0x17'));var licenseUtil=require(_0x2ff2('0x18'));var db=require(_0x2ff2('0x19'))['db'];config[_0x2ff2('0x1a')]=_[_0x2ff2('0x1b')](config[_0x2ff2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ff2('0x1c'))(new Redis(config[_0x2ff2('0x1a')]));require(_0x2ff2('0x1d'))[_0x2ff2('0x1e')](socket);var jayson=require(_0x2ff2('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x2ff2('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x401f66,_0x383aba,_0x1a7adb,_0x45dc41){return new BPromise(function(_0x15c2af,_0x2f2476){var _0xca38d7=_0x45dc41||client;return _0xca38d7['request'](_0x401f66,_0x1a7adb)[_0x2ff2('0x21')](function(_0x598e53){logger[_0x2ff2('0x22')](_0x2ff2('0x23'),_0x383aba,_0x2ff2('0x24'));logger[_0x2ff2('0x25')](_0x2ff2('0x26'),_0x383aba,_0x2ff2('0x24'),JSON[_0x2ff2('0x27')](_0x598e53));if(_0x598e53[_0x2ff2('0x28')]){if(_0x598e53[_0x2ff2('0x28')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x383aba,_0x598e53['error'][_0x2ff2('0x29')]);return _0x2f2476(_0x598e53['error'][_0x2ff2('0x29')]);}logger['error'](_0x2ff2('0x23'),_0x383aba,_0x598e53['error']['message']);return _0x15c2af(_0x598e53[_0x2ff2('0x28')][_0x2ff2('0x29')]);}else{logger[_0x2ff2('0x22')](_0x2ff2('0x23'),_0x383aba,_0x2ff2('0x24'));_0x15c2af(_0x598e53[_0x2ff2('0x2a')]['message']);}})['catch'](function(_0x26e395){logger[_0x2ff2('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x383aba,_0x26e395);_0x2f2476(_0x26e395);});});}function respondWithStatusCode(_0x2d6b12,_0x9efdcd){_0x9efdcd=_0x9efdcd||0xcc;return function(_0x248742){if(_0x248742){return _0x2d6b12[_0x2ff2('0x2b')](_0x9efdcd);}return _0x2d6b12[_0x2ff2('0x2c')](_0x9efdcd)[_0x2ff2('0x2d')]();};}function respondWithResult(_0x126b80,_0x8cdbb7){_0x8cdbb7=_0x8cdbb7||0xc8;return function(_0x5e3dec){if(_0x5e3dec){return _0x126b80[_0x2ff2('0x2c')](_0x8cdbb7)['json'](_0x5e3dec);}};}function respondWithFilteredResult(_0x1e1957,_0x49b954){return function(_0x354dff){if(_0x354dff){var _0x4e33e0=typeof _0x49b954[_0x2ff2('0x2e')]===_0x2ff2('0x2f')&&typeof _0x49b954[_0x2ff2('0x30')]===_0x2ff2('0x2f');var _0x116f9d=_0x354dff[_0x2ff2('0x31')];var _0x5f0e29=_0x4e33e0?0x0:_0x49b954[_0x2ff2('0x2e')];var _0x4d9af9=_0x4e33e0?_0x354dff['count']:_0x49b954['offset']+_0x49b954[_0x2ff2('0x30')];var _0x4b4995;if(_0x4d9af9>=_0x116f9d){_0x4d9af9=_0x116f9d;_0x4b4995=0xc8;}else{_0x4b4995=0xce;}_0x1e1957[_0x2ff2('0x2c')](_0x4b4995);return _0x1e1957['set']('Content-Range',_0x5f0e29+'-'+_0x4d9af9+'/'+_0x116f9d)[_0x2ff2('0x32')](_0x354dff);}return null;};}function patchUpdates(_0x482d6a){return function(_0x4abc99){try{jsonpatch[_0x2ff2('0x33')](_0x4abc99,_0x482d6a,!![]);}catch(_0x12a6a2){return BPromise[_0x2ff2('0x34')](_0x12a6a2);}return _0x4abc99['save']();};}function saveUpdates(_0x216451,_0x4192b5){return function(_0x3601bc){if(_0x3601bc){return _0x3601bc[_0x2ff2('0x35')](_0x216451)[_0x2ff2('0x21')](function(_0x3d8f5b){return _0x3d8f5b;});}return null;};}function removeEntity(_0x201805,_0x2d45d5){return function(_0xf4533d){if(_0xf4533d){return _0xf4533d[_0x2ff2('0x36')]()['then'](function(){var _0xc0de70=_0xf4533d[_0x2ff2('0x37')]({'plain':!![]});var _0x283cd1=_0x2ff2('0x38');return db['UserProfileResource'][_0x2ff2('0x36')]({'where':{'type':_0x283cd1,'resourceId':_0xc0de70['id']}})[_0x2ff2('0x21')](function(){return _0xf4533d;});})[_0x2ff2('0x21')](function(){_0x201805[_0x2ff2('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa782,_0x7cc4ae){return function(_0x1e39da){if(!_0x1e39da){_0x5aa782[_0x2ff2('0x2b')](0x194);}return _0x1e39da;};}function handleError(_0x5a757f,_0x4f4547){_0x4f4547=_0x4f4547||0x1f4;return function(_0x2cf5f8){logger[_0x2ff2('0x28')](_0x2cf5f8[_0x2ff2('0x39')]);if(_0x2cf5f8['name']){delete _0x2cf5f8[_0x2ff2('0x3a')];}_0x5a757f[_0x2ff2('0x2c')](_0x4f4547)[_0x2ff2('0x3b')](_0x2cf5f8);};}exports[_0x2ff2('0x3c')]=function(_0x36b9c8,_0x857d96){var _0x203085={'include':[{'model':db[_0x2ff2('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3fd022={},_0x31b105={'count':0x0,'rows':[]};var _0x18e7a4=_[_0x2ff2('0x3e')](db[_0x2ff2('0x3f')][_0x2ff2('0x40')],function(_0x4436c0){return{'name':_0x4436c0[_0x2ff2('0x41')],'type':_0x4436c0[_0x2ff2('0x42')]['key']};});_0x3fd022[_0x2ff2('0x43')]=_[_0x2ff2('0x3e')](_0x18e7a4,'name');_0x3fd022[_0x2ff2('0x44')]=_['keys'](_0x36b9c8[_0x2ff2('0x44')]);_0x3fd022['filters']=_[_0x2ff2('0x45')](_0x3fd022['model'],_0x3fd022[_0x2ff2('0x44')]);_0x203085[_0x2ff2('0x46')]=_[_0x2ff2('0x45')](_0x3fd022[_0x2ff2('0x43')],qs[_0x2ff2('0x47')](_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x47')]));_0x203085[_0x2ff2('0x46')]=_0x203085[_0x2ff2('0x46')]['length']?_0x203085[_0x2ff2('0x46')]:_0x3fd022['model'];if(!_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x48')](_0x2ff2('0x49'))){_0x203085[_0x2ff2('0x30')]=qs[_0x2ff2('0x30')](_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x30')]);_0x203085[_0x2ff2('0x2e')]=qs['offset'](_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x2e')]);}_0x203085[_0x2ff2('0x4a')]=qs[_0x2ff2('0x4b')](_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x4b')]);_0x203085[_0x2ff2('0x4c')]=qs['filters'](_['pick'](_0x36b9c8['query'],_0x3fd022[_0x2ff2('0x4d')]),_0x18e7a4);if(_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x4e')]){_0x203085[_0x2ff2('0x4c')]=_[_0x2ff2('0x4f')](_0x203085['where'],{'$or':_[_0x2ff2('0x3e')](_0x18e7a4,function(_0x502990){if(_0x502990[_0x2ff2('0x42')]!==_0x2ff2('0x50')){var _0x381479={};_0x381479[_0x502990['name']]={'$like':'%'+_0x36b9c8[_0x2ff2('0x44')]['filter']+'%'};return _0x381479;}})});}_0x203085=_[_0x2ff2('0x4f')]({},_0x203085,_0x36b9c8[_0x2ff2('0x51')]);var _0x3d3529={'where':_0x203085[_0x2ff2('0x4c')]};return db['OpenchannelAccount']['count'](_0x3d3529)[_0x2ff2('0x21')](function(_0xb22fb0){_0x31b105['count']=_0xb22fb0;if(_0x36b9c8[_0x2ff2('0x44')][_0x2ff2('0x52')]){_0x203085[_0x2ff2('0x53')]=[{'all':!![]}];}return db[_0x2ff2('0x3f')][_0x2ff2('0x54')](_0x203085);})[_0x2ff2('0x21')](function(_0x1e7bb5){_0x31b105['rows']=_0x1e7bb5;return _0x31b105;})[_0x2ff2('0x21')](respondWithFilteredResult(_0x857d96,_0x203085))[_0x2ff2('0x55')](handleError(_0x857d96,null));};exports[_0x2ff2('0x56')]=function(_0x312c98,_0x1cc1f2){var _0x34b462={'raw':![],'where':{'id':_0x312c98[_0x2ff2('0x57')]['id']},'include':[{'model':db[_0x2ff2('0x3d')],'as':_0x2ff2('0x58')}]},_0x4b333f={};_0x4b333f[_0x2ff2('0x43')]=_[_0x2ff2('0x59')](db[_0x2ff2('0x3f')][_0x2ff2('0x40')]);_0x4b333f[_0x2ff2('0x44')]=_[_0x2ff2('0x59')](_0x312c98['query']);_0x4b333f[_0x2ff2('0x4d')]=_['intersection'](_0x4b333f['model'],_0x4b333f[_0x2ff2('0x44')]);_0x34b462[_0x2ff2('0x46')]=_[_0x2ff2('0x45')](_0x4b333f[_0x2ff2('0x43')],qs[_0x2ff2('0x47')](_0x312c98[_0x2ff2('0x44')]['fields']));_0x34b462[_0x2ff2('0x46')]=_0x34b462['attributes'][_0x2ff2('0x5a')]?_0x34b462[_0x2ff2('0x46')]:_0x4b333f[_0x2ff2('0x43')];if(_0x312c98[_0x2ff2('0x44')][_0x2ff2('0x52')]){_0x34b462[_0x2ff2('0x53')]=[{'all':!![]}];}_0x34b462=_[_0x2ff2('0x4f')]({},_0x34b462,_0x312c98[_0x2ff2('0x51')]);return db[_0x2ff2('0x3f')]['find'](_0x34b462)['then'](handleEntityNotFound(_0x1cc1f2,null))[_0x2ff2('0x21')](respondWithResult(_0x1cc1f2,null))[_0x2ff2('0x55')](handleError(_0x1cc1f2,null));};exports[_0x2ff2('0x5b')]=function(_0x12a0e6,_0x52685e){return db['OpenchannelAccount'][_0x2ff2('0x5b')](_0x12a0e6[_0x2ff2('0x5c')],{})[_0x2ff2('0x21')](function(_0x336cba){var _0x1b2bae=_0x12a0e6[_0x2ff2('0x5d')][_0x2ff2('0x37')]({'plain':!![]});if(!_0x1b2bae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b2bae[_0x2ff2('0x5e')]===_0x2ff2('0x5d')){var _0x247e3f=_0x336cba[_0x2ff2('0x37')]({'plain':!![]});var _0x4c495e=_0x2ff2('0x38');return db[_0x2ff2('0x5f')][_0x2ff2('0x60')]({'where':{'name':_0x4c495e,'userProfileId':_0x1b2bae['userProfileId']},'raw':!![]})['then'](function(_0x525467){if(_0x525467&&_0x525467[_0x2ff2('0x61')]===0x0){return db[_0x2ff2('0x62')][_0x2ff2('0x5b')]({'name':_0x247e3f[_0x2ff2('0x3a')],'resourceId':_0x247e3f['id'],'type':_0x525467['name'],'sectionId':_0x525467['id']},{})[_0x2ff2('0x21')](function(){return _0x336cba;});}else{return _0x336cba;}})[_0x2ff2('0x55')](function(_0x7fb3b2){logger[_0x2ff2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7fb3b2);throw _0x7fb3b2;});}return _0x336cba;})[_0x2ff2('0x21')](respondWithResult(_0x52685e,0xc9))[_0x2ff2('0x55')](handleError(_0x52685e,null));};exports['update']=function(_0xa2cd19,_0x14e01c){if(_0xa2cd19[_0x2ff2('0x5c')]['id']){delete _0xa2cd19[_0x2ff2('0x5c')]['id'];}return db['OpenchannelAccount'][_0x2ff2('0x60')]({'where':{'id':_0xa2cd19[_0x2ff2('0x57')]['id']},'include':[{'model':db[_0x2ff2('0x3d')],'as':_0x2ff2('0x58')}]})[_0x2ff2('0x21')](handleEntityNotFound(_0x14e01c,null))[_0x2ff2('0x21')](saveUpdates(_0xa2cd19['body'],null))[_0x2ff2('0x21')](respondWithResult(_0x14e01c,null))[_0x2ff2('0x55')](handleError(_0x14e01c,null));};exports['destroy']=function(_0x3ad493,_0x5b2a94){return db[_0x2ff2('0x3f')]['find']({'where':{'id':_0x3ad493[_0x2ff2('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b2a94,null))[_0x2ff2('0x21')](removeEntity(_0x5b2a94,null))[_0x2ff2('0x55')](handleError(_0x5b2a94,null));};exports[_0x2ff2('0x63')]=function(_0x44384f,_0x262ec6){return db[_0x2ff2('0x3f')]['describe']()[_0x2ff2('0x21')](respondWithResult(_0x262ec6,null))['catch'](handleError(_0x262ec6,null));};exports['addDisposition']=function(_0x3ac3ce,_0x1f38aa,_0x16d330){if(_0x3ac3ce['body']['id']){delete _0x3ac3ce['body']['id'];}return db[_0x2ff2('0x3f')]['find']({'where':{'id':_0x3ac3ce[_0x2ff2('0x57')]['id']}})[_0x2ff2('0x21')](handleEntityNotFound(_0x1f38aa,null))[_0x2ff2('0x21')](function(_0x3fd5b9){if(_0x3fd5b9){_0x3ac3ce[_0x2ff2('0x5c')][_0x2ff2('0x64')]=_0x3fd5b9['id'];return db[_0x2ff2('0x65')]['create'](_0x3ac3ce[_0x2ff2('0x5c')]);}})[_0x2ff2('0x21')](respondWithResult(_0x1f38aa,null))[_0x2ff2('0x55')](handleError(_0x1f38aa,null));};exports[_0x2ff2('0x66')]=function(_0x3c9433,_0x259cbd,_0x214ea1){var _0x24caf8={'raw':![],'where':{}};var _0x511c3b={};var _0x5caa2b={'count':0x0,'rows':[]};return db[_0x2ff2('0x3f')]['findOne']({'where':{'id':_0x3c9433[_0x2ff2('0x57')]['id']}})[_0x2ff2('0x21')](handleEntityNotFound(_0x259cbd,null))['then'](function(_0x12eb5c){if(_0x12eb5c){_0x511c3b[_0x2ff2('0x43')]=_['keys'](db['Disposition'][_0x2ff2('0x40')]);_0x511c3b[_0x2ff2('0x44')]=_[_0x2ff2('0x59')](_0x3c9433['query']);_0x511c3b[_0x2ff2('0x4d')]=_[_0x2ff2('0x45')](_0x511c3b[_0x2ff2('0x43')],_0x511c3b[_0x2ff2('0x44')]);_0x24caf8[_0x2ff2('0x46')]=_[_0x2ff2('0x45')](_0x511c3b[_0x2ff2('0x43')],qs[_0x2ff2('0x47')](_0x3c9433[_0x2ff2('0x44')]['fields']));_0x24caf8[_0x2ff2('0x46')]=_0x24caf8[_0x2ff2('0x46')]['length']?_0x24caf8[_0x2ff2('0x46')]:_0x511c3b[_0x2ff2('0x43')];if(!_0x3c9433['query'][_0x2ff2('0x48')](_0x2ff2('0x49'))){_0x24caf8['limit']=qs[_0x2ff2('0x30')](_0x3c9433[_0x2ff2('0x44')][_0x2ff2('0x30')]);_0x24caf8[_0x2ff2('0x2e')]=qs[_0x2ff2('0x2e')](_0x3c9433['query'][_0x2ff2('0x2e')]);}_0x24caf8[_0x2ff2('0x4a')]=qs['sort'](_0x3c9433[_0x2ff2('0x44')][_0x2ff2('0x4b')]);_0x24caf8[_0x2ff2('0x4c')]=qs[_0x2ff2('0x4d')](_[_0x2ff2('0x67')](_0x3c9433[_0x2ff2('0x44')],_0x511c3b[_0x2ff2('0x4d')]));_0x24caf8[_0x2ff2('0x4c')][_0x2ff2('0x64')]=_0x12eb5c['id'];if(_0x3c9433[_0x2ff2('0x44')][_0x2ff2('0x4e')]){_0x24caf8[_0x2ff2('0x4c')]=_[_0x2ff2('0x4f')](_0x24caf8[_0x2ff2('0x4c')],{'$or':_[_0x2ff2('0x3e')](_0x24caf8['attributes'],function(_0x53b810){var _0x3a0e2f={};_0x3a0e2f[_0x53b810]={'$like':'%'+_0x3c9433['query'][_0x2ff2('0x4e')]+'%'};return _0x3a0e2f;})});}_0x24caf8=_[_0x2ff2('0x4f')]({},_0x24caf8,_0x3c9433[_0x2ff2('0x51')]);return db[_0x2ff2('0x65')][_0x2ff2('0x31')]({'where':_0x24caf8[_0x2ff2('0x4c')]})[_0x2ff2('0x21')](function(_0x578628){_0x5caa2b[_0x2ff2('0x31')]=_0x578628;if(_0x3c9433['query'][_0x2ff2('0x52')]){_0x24caf8['include']=[{'all':!![]}];}return db[_0x2ff2('0x65')][_0x2ff2('0x54')](_0x24caf8);})[_0x2ff2('0x21')](function(_0x545dcb){_0x5caa2b['rows']=_0x545dcb;return _0x5caa2b;});}})[_0x2ff2('0x21')](respondWithFilteredResult(_0x259cbd,_0x24caf8))[_0x2ff2('0x55')](handleError(_0x259cbd,null));};exports[_0x2ff2('0x68')]=function(_0x4a7d1f,_0x4d18f4,_0x48f6a3){return db[_0x2ff2('0x3f')][_0x2ff2('0x60')]({'where':{'id':_0x4a7d1f[_0x2ff2('0x57')]['id']}})['then'](handleEntityNotFound(_0x4d18f4,null))['then'](function(_0x529bbc){if(_0x529bbc){return _0x529bbc[_0x2ff2('0x68')](_0x4a7d1f[_0x2ff2('0x44')][_0x2ff2('0x69')]);}})[_0x2ff2('0x21')](respondWithStatusCode(_0x4d18f4,null))[_0x2ff2('0x55')](handleError(_0x4d18f4,null));};exports['addAnswer']=function(_0x520906,_0x533d26,_0x662700){if(_0x520906[_0x2ff2('0x5c')]['id']){delete _0x520906[_0x2ff2('0x5c')]['id'];}return db['OpenchannelAccount'][_0x2ff2('0x60')]({'where':{'id':_0x520906['params']['id']}})[_0x2ff2('0x21')](handleEntityNotFound(_0x533d26,null))[_0x2ff2('0x21')](function(_0x27ffc2){if(_0x27ffc2){_0x520906[_0x2ff2('0x5c')][_0x2ff2('0x64')]=_0x27ffc2['id'];return db[_0x2ff2('0x6a')][_0x2ff2('0x5b')](_0x520906[_0x2ff2('0x5c')]);}})[_0x2ff2('0x21')](respondWithResult(_0x533d26,null))['catch'](handleError(_0x533d26,null));};exports['getAnswers']=function(_0x3e24ca,_0x55e428,_0x45f315){var _0x31d38f={'raw':![],'where':{}};var _0x5b757b={};var _0x32edc4={'count':0x0,'rows':[]};return db[_0x2ff2('0x3f')][_0x2ff2('0x6b')]({'where':{'id':_0x3e24ca['params']['id']}})['then'](handleEntityNotFound(_0x55e428,null))['then'](function(_0x2b9b52){if(_0x2b9b52){_0x5b757b['model']=_[_0x2ff2('0x59')](db[_0x2ff2('0x6a')][_0x2ff2('0x40')]);_0x5b757b[_0x2ff2('0x44')]=_['keys'](_0x3e24ca[_0x2ff2('0x44')]);_0x5b757b[_0x2ff2('0x4d')]=_[_0x2ff2('0x45')](_0x5b757b['model'],_0x5b757b[_0x2ff2('0x44')]);_0x31d38f['attributes']=_[_0x2ff2('0x45')](_0x5b757b['model'],qs['fields'](_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x47')]));_0x31d38f[_0x2ff2('0x46')]=_0x31d38f[_0x2ff2('0x46')][_0x2ff2('0x5a')]?_0x31d38f[_0x2ff2('0x46')]:_0x5b757b[_0x2ff2('0x43')];if(!_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x48')](_0x2ff2('0x49'))){_0x31d38f[_0x2ff2('0x30')]=qs[_0x2ff2('0x30')](_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x30')]);_0x31d38f[_0x2ff2('0x2e')]=qs[_0x2ff2('0x2e')](_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x2e')]);}_0x31d38f[_0x2ff2('0x4a')]=qs[_0x2ff2('0x4b')](_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x4b')]);_0x31d38f[_0x2ff2('0x4c')]=qs[_0x2ff2('0x4d')](_['pick'](_0x3e24ca[_0x2ff2('0x44')],_0x5b757b[_0x2ff2('0x4d')]));_0x31d38f[_0x2ff2('0x4c')][_0x2ff2('0x64')]=_0x2b9b52['id'];if(_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x4e')]){_0x31d38f[_0x2ff2('0x4c')]=_[_0x2ff2('0x4f')](_0x31d38f[_0x2ff2('0x4c')],{'$or':_[_0x2ff2('0x3e')](_0x31d38f[_0x2ff2('0x46')],function(_0x5cf6c2){var _0x13297c={};_0x13297c[_0x5cf6c2]={'$like':'%'+_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x4e')]+'%'};return _0x13297c;})});}_0x31d38f=_[_0x2ff2('0x4f')]({},_0x31d38f,_0x3e24ca[_0x2ff2('0x51')]);return db['CannedAnswer']['count']({'where':_0x31d38f[_0x2ff2('0x4c')]})['then'](function(_0x45a7fd){_0x32edc4[_0x2ff2('0x31')]=_0x45a7fd;if(_0x3e24ca[_0x2ff2('0x44')][_0x2ff2('0x52')]){_0x31d38f['include']=[{'all':!![]}];}return db[_0x2ff2('0x6a')][_0x2ff2('0x54')](_0x31d38f);})[_0x2ff2('0x21')](function(_0xb4fb0f){_0x32edc4[_0x2ff2('0x6c')]=_0xb4fb0f;return _0x32edc4;});}})[_0x2ff2('0x21')](respondWithFilteredResult(_0x55e428,_0x31d38f))[_0x2ff2('0x55')](handleError(_0x55e428,null));};exports[_0x2ff2('0x6d')]=function(_0x343487,_0x5b4c25,_0x1ad4ee){return db[_0x2ff2('0x3f')][_0x2ff2('0x60')]({'where':{'id':_0x343487[_0x2ff2('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b4c25,null))['then'](function(_0x453a0d){if(_0x453a0d){return _0x453a0d['removeAnswers'](_0x343487[_0x2ff2('0x44')][_0x2ff2('0x69')]);}})[_0x2ff2('0x21')](respondWithStatusCode(_0x5b4c25,null))[_0x2ff2('0x55')](handleError(_0x5b4c25,null));};exports[_0x2ff2('0x6e')]=function(_0x4f0f9f,_0x5c0805,_0x5cb4c1){var _0x2a5ccb={'body':_0x4f0f9f[_0x2ff2('0x5c')],'channel':'openchannel'};var _0x1f40d5=[];var _0x1ff945=[];var _0x14ff82={};var _0x43d404=![];return db['CmContact'][_0x2ff2('0x63')]()['then'](function(_0x149973){if(!_0x149973){throw new db[(_0x2ff2('0x6f'))]['ValidationError'](_0x2ff2('0x70'));}_0x1f40d5=_[_0x2ff2('0x71')](_[_0x2ff2('0x59')](_0x149973),[_0x2ff2('0x72'),_0x2ff2('0x73')]);_0x1ff945=_['difference'](_[_0x2ff2('0x59')](_0x149973),['createdAt',_0x2ff2('0x73'),_0x2ff2('0x74'),_0x2ff2('0x75')]);if(_0x4f0f9f[_0x2ff2('0x5c')]['id']){delete _0x4f0f9f[_0x2ff2('0x5c')]['id'];}if(_[_0x2ff2('0x76')](_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x77')])){throw new db[(_0x2ff2('0x6f'))][(_0x2ff2('0x78'))](_0x2ff2('0x79'));}if(_[_0x2ff2('0x76')](_0x4f0f9f['body'][_0x2ff2('0x5c')])||_0x4f0f9f['body']['body']===''){throw new db[(_0x2ff2('0x6f'))][(_0x2ff2('0x78'))](_0x2ff2('0x7a'));}if(_[_0x2ff2('0x76')](_0x4f0f9f['body'][_0x2ff2('0x7b')])){throw new db[(_0x2ff2('0x6f'))][(_0x2ff2('0x78'))](_0x2ff2('0x7c')+_0x1ff945);}if(!_['includes'](_0x1ff945,_0x4f0f9f[_0x2ff2('0x5c')]['mapKey'])){throw new db[(_0x2ff2('0x6f'))][(_0x2ff2('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ff945);}_0x14ff82[_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x7b')]]=_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x77')];})[_0x2ff2('0x21')](function(){return db['OpenchannelAccount'][_0x2ff2('0x60')]({'where':{'id':_0x4f0f9f[_0x2ff2('0x57')]['id']},'include':[{'model':db[_0x2ff2('0x7d')],'as':_0x2ff2('0x7e'),'include':[{'model':db['CmContact'],'as':_0x2ff2('0x7f'),'where':_0x14ff82,'limit':0x1,'order':[['updatedAt',_0x2ff2('0x80')]]}]},{'model':db[_0x2ff2('0x81')],'as':_0x2ff2('0x82')}]});})[_0x2ff2('0x21')](handleEntityNotFound(_0x5c0805,null))[_0x2ff2('0x21')](function(_0x2f0c7d){if(_0x2f0c7d&&_0x2f0c7d[_0x2ff2('0x7e')]){_0x2a5ccb['account']=_0x2f0c7d;_0x2a5ccb[_0x2ff2('0x83')]=_0x2f0c7d[_0x2ff2('0x82')];_0x2a5ccb[_0x2ff2('0x84')]=_0x2f0c7d[_0x2ff2('0x7e')];_0x2a5ccb[_0x2ff2('0x83')]=_[_0x2ff2('0x85')](_0x2a5ccb[_0x2ff2('0x83')],[_0x2ff2('0x86')],[_0x2ff2('0x87')]);if(_0x2a5ccb[_0x2ff2('0x88')][_0x2ff2('0x82')]){delete _0x2a5ccb[_0x2ff2('0x88')]['Applications'];}if(_0x2a5ccb['account']['List']&&_0x2a5ccb[_0x2ff2('0x88')]['List']['Contacts'][_0x2ff2('0x5a')]){return _0x2a5ccb[_0x2ff2('0x88')][_0x2ff2('0x7e')]['Contacts'][0x0];}var _0x4d4c7e=_['defaults'](_0x4f0f9f[_0x2ff2('0x5c')],{'firstName':_0x4f0f9f['body'][_0x2ff2('0x77')],'ListId':_0x2f0c7d['ListId']});_0x4d4c7e[_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x7b')]]=_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x77')];return db[_0x2ff2('0x89')]['create'](_0x4d4c7e,{'fields':_0x1f40d5,'raw':!![]});}})[_0x2ff2('0x21')](handleEntityNotFound(_0x5c0805,null))['then'](function(_0x3c7886){_0x2a5ccb['contact']=_0x3c7886;if(_0x3c7886){var _0xd54d={'ContactId':_0x3c7886['id'],'OpenchannelAccountId':_0x4f0f9f[_0x2ff2('0x57')]['id'],'from':(_0x3c7886[_0x2ff2('0x8a')]||'')+'\x20'+(_0x3c7886[_0x2ff2('0x8b')]||'')};var _0x145633={'OpenchannelAccountId':_0x4f0f9f['params']['id'],'closed':![]};if(_0x4f0f9f['body'][_0x2ff2('0x8c')]){_0x145633['threadId']=_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x8c')];return db[_0x2ff2('0x8d')][_0x2ff2('0x60')]({'where':_0x145633})[_0x2ff2('0x21')](function(_0xb1c06c){if(_0xb1c06c){return[_0xb1c06c,![]];}_0xd54d[_0x2ff2('0x8c')]=_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x8c')];_0xd54d[_0x2ff2('0x8e')]=_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x8e')];return db[_0x2ff2('0x8d')][_0x2ff2('0x5b')](_0xd54d)[_0x2ff2('0x21')](function(_0x2afa98){return[_0x2afa98,!![]];});});}else{_0x145633[_0x2ff2('0x8c')]=null;}_0x145633[_0x2ff2('0x8f')]=_0x3c7886['id'];return db['OpenchannelInteraction'][_0x2ff2('0x60')]({'where':_0x145633})['then'](function(_0x4424b5){if(_0x4424b5){return[_0x4424b5,![]];}return db[_0x2ff2('0x8d')]['create'](_0xd54d)['then'](function(_0x2bca73){return[_0x2bca73,!![]];});});}})[_0x2ff2('0x90')](function(_0x46dae2,_0x1a95f4){if(_0x46dae2){_0x43d404=_0x1a95f4;if(!_0x1a95f4){var _0x4f9afd={'from':(_0x2a5ccb[_0x2ff2('0x91')][_0x2ff2('0x8a')]||'')+'\x20'+(_0x2a5ccb[_0x2ff2('0x91')][_0x2ff2('0x8b')]||'')};if(_0x4f0f9f['body']['threadId']&&_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x92')]&&_0x4f0f9f[_0x2ff2('0x5c')]['threadId']!=_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x92')]){_0x4f9afd[_0x2ff2('0x8c')]=_0x4f0f9f['body'][_0x2ff2('0x92')];}return _0x46dae2[_0x2ff2('0x35')](_0x4f9afd);}else{return _0x46dae2;}}})[_0x2ff2('0x21')](function(_0x44710b){_0x2a5ccb['interaction']=_0x44710b[_0x2ff2('0x37')]({'plain':!![]});_0x2a5ccb[_0x2ff2('0x93')][_0x2ff2('0x94')]=_0x43d404;if(_0x2a5ccb[_0x2ff2('0x93')]['created']){if(_0x2a5ccb[_0x2ff2('0x88')]['autoclose']){_0x2a5ccb[_0x2ff2('0x83')][_0x2ff2('0x95')]({'id':0x0,'priority':_0x2a5ccb[_0x2ff2('0x83')][_0x2ff2('0x5a')]+0x1,'app':_0x2ff2('0x96'),'appdata':'unmanaged','interval':_0x2ff2('0x97')});}}return db[_0x2ff2('0x98')][_0x2ff2('0x5b')]({'body':_0x4f0f9f[_0x2ff2('0x5c')]['body'],'OpenchannelAccountId':_0x4f0f9f[_0x2ff2('0x57')]['id'],'OpenchannelInteractionId':_0x44710b['id'],'direction':'in','ContactId':_0x2a5ccb[_0x2ff2('0x91')]['id'],'AttachmentId':_0x4f0f9f[_0x2ff2('0x5c')][_0x2ff2('0x99')]});})[_0x2ff2('0x21')](function(_0xba45de){_0x2a5ccb['message']=_0xba45de;if(!_0x2a5ccb[_0x2ff2('0x93')][_0x2ff2('0x9a')])return;return db[_0x2ff2('0x9b')][_0x2ff2('0x60')]({'attributes':['id',_0x2ff2('0x3a')],'where':{'id':_0x2a5ccb[_0x2ff2('0x93')]['UserId']}});})['then'](function(_0xc7b532){if(_0xc7b532){_0x2a5ccb[_0x2ff2('0x83')][_0x2ff2('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xc7b532[_0x2ff2('0x3a')]+','+(_0x2a5ccb[_0x2ff2('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x2ff2('0x97')});}if(!_0x2a5ccb[_0x2ff2('0x93')]['queueId'])return;return db[_0x2ff2('0x9d')][_0x2ff2('0x60')]({'attributes':['id',_0x2ff2('0x3a')],'where':{'id':_0x2a5ccb[_0x2ff2('0x93')][_0x2ff2('0x9e')]}});})['then'](function(_0x6370f0){if(_0x6370f0){_0x2a5ccb[_0x2ff2('0x83')][_0x2ff2('0x9c')]({'id':0x0,'priority':0x1,'app':_0x2ff2('0x9f'),'appdata':_0x6370f0['name']+','+(_0x2a5ccb[_0x2ff2('0x88')][_0x2ff2('0xa0')]||0x12c),'interval':_0x2ff2('0x97')});}return respondWithRpcPromise(_0x2ff2('0xa1'),'startRouting',_0x2a5ccb);})[_0x2ff2('0x21')](function(_0x1e6781){respondWithRpcPromise(_0x2ff2('0xa2'),_0x2ff2('0xa2'),{'event':_0x2ff2('0x6e'),'message':_0x1e6781},client9002);return _0x1e6781;})[_0x2ff2('0x21')](respondWithResult(_0x5c0805,null))[_0x2ff2('0x55')](handleError(_0x5c0805,null));};exports['addApplications']=function(_0x31fab8,_0x681ea4){var _0x2689c3=_0x31fab8[_0x2ff2('0x57')]['id'];var _0x289a9b=_0x31fab8[_0x2ff2('0x5c')];var _0xdaaf09=0xc8;var _0x129c6a=null;return db[_0x2ff2('0xa3')][_0x2ff2('0xa4')]({'isolationLevel':db[_0x2ff2('0xa3')][_0x2ff2('0xa5')]['ISOLATION_LEVELS'][_0x2ff2('0xa6')]},function(_0x12dde7){return db['OpenchannelAccount'][_0x2ff2('0x6b')]({'where':{'id':_0x2689c3},'transaction':_0x12dde7})[_0x2ff2('0x21')](function(_0x213f55){if(_0x213f55){return db[_0x2ff2('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x2689c3},'transaction':_0x12dde7})[_0x2ff2('0x21')](function(){var _0x3dcf68=_[_0x2ff2('0x3e')](_0x289a9b,function(_0x42e3d8){_0x42e3d8[_0x2ff2('0x64')]=_0x2689c3;return _0x42e3d8;});return db[_0x2ff2('0x81')][_0x2ff2('0xa7')](_0x3dcf68,{'transaction':_0x12dde7});});}else{_0xdaaf09=0x194;_0x129c6a=[];}});})[_0x2ff2('0x21')](function(){if(_0xdaaf09!==0x194){return db[_0x2ff2('0x81')][_0x2ff2('0xa8')]({'where':{'OpenchannelAccountId':_0x2689c3},'order':_0x2ff2('0x86')})['then'](function(_0x24cb95){_0x129c6a=_0x24cb95;});}})[_0x2ff2('0x55')](function(_0x21b678){_0xdaaf09=0x1f4;logger[_0x2ff2('0x28')](_0x21b678[_0x2ff2('0x39')]);if(_0x21b678['name']){delete _0x21b678[_0x2ff2('0x3a')];}_0x129c6a=_0x21b678;})[_0x2ff2('0xa9')](function(){if(_0x129c6a===null){_0x681ea4[_0x2ff2('0x2b')](_0xdaaf09);}else{if(_0xdaaf09===0x1f4){_0x681ea4[_0x2ff2('0x2c')](_0xdaaf09)[_0x2ff2('0x3b')](_0x129c6a);}else{_0x681ea4[_0x2ff2('0x2c')](_0xdaaf09)['json'](_0x129c6a);}}});};exports[_0x2ff2('0xaa')]=function(_0x2ff050,_0x48d8e9,_0x14c308){var _0x3f3b41={};var _0x1b2176={};var _0x1757c7;var _0x7c347;return db[_0x2ff2('0x3f')][_0x2ff2('0x6b')]({'where':{'id':_0x2ff050['params']['id']}})[_0x2ff2('0x21')](handleEntityNotFound(_0x48d8e9,null))[_0x2ff2('0x21')](function(_0x42e352){if(_0x42e352){_0x1757c7=_0x42e352;_0x1b2176[_0x2ff2('0x43')]=_['keys'](db[_0x2ff2('0x81')][_0x2ff2('0x40')]);_0x1b2176['query']=_[_0x2ff2('0x59')](_0x2ff050['query']);_0x1b2176[_0x2ff2('0x4d')]=_[_0x2ff2('0x45')](_0x1b2176[_0x2ff2('0x43')],_0x1b2176[_0x2ff2('0x44')]);_0x3f3b41[_0x2ff2('0x46')]=_[_0x2ff2('0x45')](_0x1b2176[_0x2ff2('0x43')],qs[_0x2ff2('0x47')](_0x2ff050[_0x2ff2('0x44')][_0x2ff2('0x47')]));_0x3f3b41['attributes']=_0x3f3b41[_0x2ff2('0x46')]['length']?_0x3f3b41[_0x2ff2('0x46')]:_0x1b2176['model'];_0x3f3b41[_0x2ff2('0x4a')]=qs[_0x2ff2('0x4b')](_0x2ff050[_0x2ff2('0x44')][_0x2ff2('0x4b')]);_0x3f3b41['where']=qs[_0x2ff2('0x4d')](_[_0x2ff2('0x67')](_0x2ff050['query'],_0x1b2176[_0x2ff2('0x4d')]));if(_0x2ff050[_0x2ff2('0x44')][_0x2ff2('0x4e')]){_0x3f3b41['where']=_['merge'](_0x3f3b41[_0x2ff2('0x4c')],{'$or':_[_0x2ff2('0x3e')](_0x3f3b41[_0x2ff2('0x46')],function(_0x48e02f){var _0x577ac3={};_0x577ac3[_0x48e02f]={'$like':'%'+_0x2ff050[_0x2ff2('0x44')][_0x2ff2('0x4e')]+'%'};return _0x577ac3;})});}_0x3f3b41=_[_0x2ff2('0x4f')]({},_0x3f3b41,_0x2ff050[_0x2ff2('0x51')]);return _0x1757c7['getApplications'](_0x3f3b41);}})[_0x2ff2('0x21')](function(_0x5be92a){if(_0x5be92a){_0x7c347=_0x5be92a[_0x2ff2('0x5a')];if(!_0x2ff050[_0x2ff2('0x44')][_0x2ff2('0x48')](_0x2ff2('0x49'))){_0x3f3b41['limit']=qs[_0x2ff2('0x30')](_0x2ff050[_0x2ff2('0x44')]['limit']);_0x3f3b41['offset']=qs['offset'](_0x2ff050[_0x2ff2('0x44')]['offset']);}return _0x1757c7[_0x2ff2('0xaa')](_0x3f3b41);}})[_0x2ff2('0x21')](function(_0x344110){if(_0x344110){return _0x344110?{'count':_0x7c347,'rows':_0x344110}:null;}})[_0x2ff2('0x21')](respondWithResult(_0x48d8e9,null))['catch'](handleError(_0x48d8e9,null));};exports[_0x2ff2('0xab')]=function(_0x4adaf8,_0x5121f3,_0x252c48){var _0x317cfe={'raw':![],'where':{}};var _0x4df228={};var _0x131375={'count':0x0,'rows':[]};return db[_0x2ff2('0x3f')]['findOne']({'where':{'id':_0x4adaf8[_0x2ff2('0x57')]['id']}})[_0x2ff2('0x21')](handleEntityNotFound(_0x5121f3,null))[_0x2ff2('0x21')](function(_0x1b0e09){if(_0x1b0e09){_0x4df228[_0x2ff2('0x43')]=_['keys'](db[_0x2ff2('0x8d')][_0x2ff2('0x40')]);_0x4df228['query']=_[_0x2ff2('0x59')](_0x4adaf8['query']);_0x4df228['filters']=_[_0x2ff2('0x45')](_0x4df228[_0x2ff2('0x43')],_0x4df228[_0x2ff2('0x44')]);_0x317cfe[_0x2ff2('0x46')]=_['intersection'](_0x4df228['model'],qs[_0x2ff2('0x47')](_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x47')]));_0x317cfe[_0x2ff2('0x46')]=_0x317cfe[_0x2ff2('0x46')][_0x2ff2('0x5a')]?_0x317cfe[_0x2ff2('0x46')]:_0x4df228[_0x2ff2('0x43')];if(!_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x48')](_0x2ff2('0x49'))){_0x317cfe[_0x2ff2('0x30')]=qs[_0x2ff2('0x30')](_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x30')]);_0x317cfe[_0x2ff2('0x2e')]=qs[_0x2ff2('0x2e')](_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x2e')]);}_0x317cfe[_0x2ff2('0x4a')]=qs[_0x2ff2('0x4b')](_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x4b')]);_0x317cfe['where']=qs[_0x2ff2('0x4d')](_[_0x2ff2('0x67')](_0x4adaf8[_0x2ff2('0x44')],_0x4df228[_0x2ff2('0x4d')]));_0x317cfe[_0x2ff2('0x4c')]['OpenchannelAccountId']=_0x1b0e09['id'];if(_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x4e')]){_0x317cfe['where']=_['merge'](_0x317cfe[_0x2ff2('0x4c')],{'$or':_[_0x2ff2('0x3e')](_0x317cfe[_0x2ff2('0x46')],function(_0x518b88){var _0x56b9c9={};_0x56b9c9[_0x518b88]={'$like':'%'+_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0x4e')]+'%'};return _0x56b9c9;})});}_0x317cfe=_[_0x2ff2('0x4f')]({},_0x317cfe,_0x4adaf8[_0x2ff2('0x51')]);return db['OpenchannelInteraction'][_0x2ff2('0x31')]({'where':_0x317cfe[_0x2ff2('0x4c')]})[_0x2ff2('0x21')](function(_0x466e70){_0x131375['count']=_0x466e70;if(_0x4adaf8['query'][_0x2ff2('0x52')]){_0x317cfe[_0x2ff2('0x53')]=[{'model':db[_0x2ff2('0x89')],'as':_0x2ff2('0xac'),'required':![]},{'model':db[_0x2ff2('0x9b')],'as':_0x2ff2('0xad'),'attributes':[_0x2ff2('0x3a'),_0x2ff2('0xae'),'internal'],'required':![]},{'model':db[_0x2ff2('0xaf')],'as':_0x2ff2('0xb0'),'attributes':['id',_0x2ff2('0x3a'),_0x2ff2('0xb1')],'where':_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0xb2')]?{'id':_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0xb2')]}:undefined,'required':_0x4adaf8[_0x2ff2('0x44')][_0x2ff2('0xb2')]?!![]:![]}];}return db[_0x2ff2('0x8d')]['findAll'](_0x317cfe);})[_0x2ff2('0x21')](function(_0x1a355d){_0x131375['rows']=_0x1a355d;return _0x131375;});}})[_0x2ff2('0x21')](respondWithFilteredResult(_0x5121f3,_0x317cfe))[_0x2ff2('0x55')](handleError(_0x5121f3,null));};exports[_0x2ff2('0xb3')]=function(_0x2eda78,_0x446f7a,_0x43e717){return db[_0x2ff2('0x3f')][_0x2ff2('0x60')]({'where':{'id':_0x2eda78['params']['id']}})['then'](handleEntityNotFound(_0x446f7a,null))[_0x2ff2('0x21')](function(_0x5ace94){if(_0x5ace94){return _0x5ace94[_0x2ff2('0xb3')](_0x2eda78[_0x2ff2('0x5c')][_0x2ff2('0x69')],_['omit'](_0x2eda78[_0x2ff2('0x5c')],[_0x2ff2('0x69'),'id'])||{})[_0x2ff2('0x90')](function(_0x37630d){for(var _0x3eb266=0x0;_0x3eb266<_0x2eda78[_0x2ff2('0x5c')][_0x2ff2('0x69')][_0x2ff2('0x5a')];_0x3eb266+=0x1){socket[_0x2ff2('0xb4')](_0x2ff2('0xb5'),{'UserId':Number(_0x2eda78[_0x2ff2('0x5c')][_0x2ff2('0x69')][_0x3eb266]),'OpenchannelAccountId':Number(_0x2eda78[_0x2ff2('0x57')]['id'])});}return _0x37630d;});}})['then'](respondWithResult(_0x446f7a,null))[_0x2ff2('0x55')](handleError(_0x446f7a,null));};exports['removeAgents']=function(_0xb3bde0,_0x3aaf9f,_0x48dd7c){return db['OpenchannelAccount']['find']({'where':{'id':_0xb3bde0['params']['id']}})['then'](handleEntityNotFound(_0x3aaf9f,null))[_0x2ff2('0x21')](function(_0x1ae9b0){if(_0x1ae9b0){return _0x1ae9b0[_0x2ff2('0xb6')](_0xb3bde0['query']['ids'])['then'](function(){if(_[_0x2ff2('0xb7')](_0xb3bde0['query'][_0x2ff2('0x69')])){for(var _0x185cac=0x0;_0x185cac<_0xb3bde0[_0x2ff2('0x44')][_0x2ff2('0x69')]['length'];_0x185cac+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0xb3bde0[_0x2ff2('0x44')]['ids'][_0x185cac]),'OpenchannelAccountId':Number(_0xb3bde0['params']['id'])});}}else{socket[_0x2ff2('0xb4')](_0x2ff2('0xb8'),{'UserId':Number(_0xb3bde0[_0x2ff2('0x44')][_0x2ff2('0x69')]),'OpenchannelAccountId':Number(_0xb3bde0[_0x2ff2('0x57')]['id'])});}});}})[_0x2ff2('0x21')](respondWithStatusCode(_0x3aaf9f,null))[_0x2ff2('0x55')](handleError(_0x3aaf9f,null));};exports[_0x2ff2('0xb9')]=function(_0x2233f9,_0x56f2de,_0x23e279){var _0x1b060e={};var _0x3d0077={};var _0x4813b2;var _0x4866c1;return db[_0x2ff2('0x3f')][_0x2ff2('0x6b')]({'where':{'id':_0x2233f9[_0x2ff2('0x57')]['id']}})['then'](handleEntityNotFound(_0x56f2de,null))[_0x2ff2('0x21')](function(_0x2899a8){if(_0x2899a8){_0x4813b2=_0x2899a8;_0x3d0077[_0x2ff2('0x43')]=_[_0x2ff2('0x59')](db[_0x2ff2('0x9b')][_0x2ff2('0x40')]);_0x3d0077['query']=_[_0x2ff2('0x59')](_0x2233f9[_0x2ff2('0x44')]);_0x3d0077['filters']=_[_0x2ff2('0x45')](_0x3d0077[_0x2ff2('0x43')],_0x3d0077[_0x2ff2('0x44')]);_0x1b060e[_0x2ff2('0x46')]=_[_0x2ff2('0x45')](_0x3d0077[_0x2ff2('0x43')],qs[_0x2ff2('0x47')](_0x2233f9[_0x2ff2('0x44')][_0x2ff2('0x47')]));_0x1b060e['attributes']=_0x1b060e[_0x2ff2('0x46')][_0x2ff2('0x5a')]?_0x1b060e['attributes']:_0x3d0077[_0x2ff2('0x43')];_0x1b060e[_0x2ff2('0x4a')]=qs[_0x2ff2('0x4b')](_0x2233f9[_0x2ff2('0x44')][_0x2ff2('0x4b')]);_0x1b060e[_0x2ff2('0x4c')]=qs[_0x2ff2('0x4d')](_[_0x2ff2('0x67')](_0x2233f9['query'],_0x3d0077[_0x2ff2('0x4d')]));if(_0x2233f9[_0x2ff2('0x44')][_0x2ff2('0x4e')]){_0x1b060e[_0x2ff2('0x4c')]=_['merge'](_0x1b060e['where'],{'$or':_[_0x2ff2('0x3e')](_0x1b060e[_0x2ff2('0x46')],function(_0x22a6a1){var _0xe236bf={};_0xe236bf[_0x22a6a1]={'$like':'%'+_0x2233f9[_0x2ff2('0x44')][_0x2ff2('0x4e')]+'%'};return _0xe236bf;})});}_0x1b060e=_[_0x2ff2('0x4f')]({},_0x1b060e,_0x2233f9['options']);return _0x4813b2['getAgents'](_0x1b060e);}})[_0x2ff2('0x21')](function(_0xd3bc04){if(_0xd3bc04){_0x4866c1=_0xd3bc04['length'];if(!_0x2233f9[_0x2ff2('0x44')][_0x2ff2('0x48')]('nolimit')){_0x1b060e[_0x2ff2('0x30')]=qs[_0x2ff2('0x30')](_0x2233f9['query']['limit']);_0x1b060e[_0x2ff2('0x2e')]=qs[_0x2ff2('0x2e')](_0x2233f9[_0x2ff2('0x44')][_0x2ff2('0x2e')]);}return _0x4813b2['getAgents'](_0x1b060e);}})[_0x2ff2('0x21')](function(_0x4d2276){if(_0x4d2276){return _0x4d2276?{'count':_0x4866c1,'rows':_0x4d2276}:null;}})[_0x2ff2('0x21')](respondWithResult(_0x56f2de,null))['catch'](handleError(_0x56f2de,null));};exports[_0x2ff2('0x3b')]=function(_0x139dbc,_0x2d41ae,_0x546526){var _0x5a7248,_0x45e81c,_0x33a155;if(_[_0x2ff2('0x76')](_0x139dbc[_0x2ff2('0x5c')][_0x2ff2('0x5c')])||_0x139dbc[_0x2ff2('0x5c')]['body']===''){throw new db[(_0x2ff2('0x6f'))][(_0x2ff2('0x78'))](_0x2ff2('0x7a'));}if(_[_0x2ff2('0x76')](_0x139dbc[_0x2ff2('0x5c')]['to'])){}_0x5a7248=_0x139dbc[_0x2ff2('0x5c')]['to'];return db[_0x2ff2('0x3f')][_0x2ff2('0x6b')]({'where':{'id':_0x139dbc[_0x2ff2('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d41ae,null))[_0x2ff2('0x21')](function(_0x955bc6){if(_0x955bc6){return db[_0x2ff2('0x3f')][_0x2ff2('0x60')]({'where':{'id':_0x955bc6['id']},'include':[{'model':db[_0x2ff2('0x7d')],'as':'List','include':[{'model':db[_0x2ff2('0x89')],'as':_0x2ff2('0x7f'),'where':{[_0x955bc6['mapKey']]:_0x5a7248},'limit':0x1,'order':[['updatedAt',_0x2ff2('0x80')]]}]}]})[_0x2ff2('0x21')](handleEntityNotFound(_0x2d41ae,null))[_0x2ff2('0x21')](function(_0x3dd8a6){if(_0x3dd8a6&&_0x3dd8a6[_0x2ff2('0x7e')]){_0x45e81c=_0x3dd8a6[_0x2ff2('0x37')]({'plain':!![]});if(_0x45e81c[_0x2ff2('0x7e')]&&_0x45e81c[_0x2ff2('0x7e')]['Contacts']['length']){return _0x45e81c[_0x2ff2('0x7e')][_0x2ff2('0x7f')][0x0];}return db[_0x2ff2('0x89')][_0x2ff2('0x5b')](_[_0x2ff2('0x1b')](_0x139dbc['body'],{'firstName':_0x5a7248,[_0x3dd8a6[_0x2ff2('0x7b')]]:_0x5a7248,'phone':_0x5a7248,'ListId':_0x45e81c[_0x2ff2('0x75')]}));}})['then'](handleEntityNotFound(_0x2d41ae,null))[_0x2ff2('0x21')](function(_0x5bd8b0){if(_0x5bd8b0){_0x33a155=_0x5bd8b0;return db[_0x2ff2('0x8d')][_0x2ff2('0x60')]({'where':{'ContactId':_0x33a155['id'],'closed':![],'OpenchannelAccountId':_0x45e81c['id']}})['then'](function(_0xe8f9ba){if(_0xe8f9ba){return[_0xe8f9ba,![]];}return db['OpenchannelInteraction'][_0x2ff2('0x5b')]({'UserId':_0x139dbc['user']['id'],'ContactId':_0x33a155['id'],'OpenchannelAccountId':_0x45e81c['id'],'lastMsgDirection':_0x2ff2('0xba'),'firstMsgDirection':_0x2ff2('0xba'),'Messages':[_[_0x2ff2('0x4f')](_0x139dbc[_0x2ff2('0x5c')],{'read':![],'body':_0x139dbc[_0x2ff2('0x5c')][_0x2ff2('0x5c')],'OpenchannelAccountId':_0x45e81c['id'],'UserId':_0x139dbc['user']['id'],'ContactId':_0x33a155['id']})]},{'include':[{'model':db[_0x2ff2('0x98')],'as':'Messages'}]})[_0x2ff2('0x21')](function(_0x2dd857){return[_0x2dd857,!![]];});});}})['spread'](function(_0x505439,_0x4eabc9){if(_0x4eabc9){return _0x505439;}return db[_0x2ff2('0x98')][_0x2ff2('0x5b')](_['merge'](_0x139dbc[_0x2ff2('0x5c')],{'read':![],'body':_0x139dbc[_0x2ff2('0x5c')][_0x2ff2('0x5c')],'OpenchannelAccountId':_0x45e81c['id'],'OpenchannelInteractionId':_0x505439['id'],'UserId':_0x139dbc['user']['id'],'ContactId':_0x33a155['id']}))['then'](function(_0x39fb44){_0x505439[_0x2ff2('0xbb')][_0x2ff2('0xbc')]=[];_0x505439[_0x2ff2('0xbb')][_0x2ff2('0xbc')][_0x2ff2('0x95')](_0x39fb44[_0x2ff2('0xbb')]);return _0x505439;});});}})[_0x2ff2('0x21')](respondWithResult(_0x2d41ae,null))[_0x2ff2('0x55')](handleError(_0x2d41ae,null));};
\ No newline at end of file
+var _0xf0c2=['show','rawAttributes','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','addDisposition','findOne','Disposition','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','account','Applications','list','applications','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','OpenchannelAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch'];(function(_0x559cca,_0x477765){var _0x228ba1=function(_0x1e2aea){while(--_0x1e2aea){_0x559cca['push'](_0x559cca['shift']());}};_0x228ba1(++_0x477765);}(_0xf0c2,0x6e));var _0x2f0c=function(_0x156d15,_0x2c22b4){_0x156d15=_0x156d15-0x0;var _0x6fe3fb=_0xf0c2[_0x156d15];return _0x6fe3fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f0c('0x0'));var zipdir=require(_0x2f0c('0x1'));var jsonpatch=require(_0x2f0c('0x2'));var rp=require(_0x2f0c('0x3'));var moment=require(_0x2f0c('0x4'));var BPromise=require(_0x2f0c('0x5'));var Mustache=require(_0x2f0c('0x6'));var util=require(_0x2f0c('0x7'));var path=require(_0x2f0c('0x8'));var sox=require(_0x2f0c('0x9'));var csv=require(_0x2f0c('0xa'));var ejs=require(_0x2f0c('0xb'));var fs=require('fs');var fs_extra=require(_0x2f0c('0xc'));var _=require('lodash');var squel=require(_0x2f0c('0xd'));var crypto=require(_0x2f0c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2f0c('0xf'));var toCsv=require(_0x2f0c('0xa'));var querystring=require(_0x2f0c('0x10'));var Papa=require(_0x2f0c('0x11'));var Redis=require(_0x2f0c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2f0c('0x13'));var as=require(_0x2f0c('0x14'));var hardwareService=require(_0x2f0c('0x15'));var logger=require(_0x2f0c('0x16'))(_0x2f0c('0x17'));var utils=require(_0x2f0c('0x18'));var config=require(_0x2f0c('0x19'));var licenseUtil=require(_0x2f0c('0x1a'));var db=require(_0x2f0c('0x1b'))['db'];config[_0x2f0c('0x1c')]=_[_0x2f0c('0x1d')](config[_0x2f0c('0x1c')],{'host':_0x2f0c('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f0c('0x1f'))[_0x2f0c('0x20')](socket);var jayson=require(_0x2f0c('0x21'));var client=jayson[_0x2f0c('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x2f0c('0x22')][_0x2f0c('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xa3f8e2,_0x31ab32,_0xd8f935,_0x4976e4){return new BPromise(function(_0x3612bb,_0xa16ab){var _0x5dad52=_0x4976e4||client;return _0x5dad52[_0x2f0c('0x24')](_0xa3f8e2,_0xd8f935)[_0x2f0c('0x25')](function(_0x5219e9){logger['info'](_0x2f0c('0x26'),_0x31ab32,_0x2f0c('0x27'));logger[_0x2f0c('0x28')](_0x2f0c('0x29'),_0x31ab32,_0x2f0c('0x27'),JSON[_0x2f0c('0x2a')](_0x5219e9));if(_0x5219e9[_0x2f0c('0x2b')]){if(_0x5219e9[_0x2f0c('0x2b')][_0x2f0c('0x2c')]===0x1f4){logger[_0x2f0c('0x2b')](_0x2f0c('0x26'),_0x31ab32,_0x5219e9[_0x2f0c('0x2b')][_0x2f0c('0x2d')]);return _0xa16ab(_0x5219e9['error'][_0x2f0c('0x2d')]);}logger[_0x2f0c('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x31ab32,_0x5219e9['error'][_0x2f0c('0x2d')]);return _0x3612bb(_0x5219e9[_0x2f0c('0x2b')][_0x2f0c('0x2d')]);}else{logger[_0x2f0c('0x2e')](_0x2f0c('0x26'),_0x31ab32,_0x2f0c('0x27'));_0x3612bb(_0x5219e9[_0x2f0c('0x2f')][_0x2f0c('0x2d')]);}})['catch'](function(_0x2d9053){logger['error'](_0x2f0c('0x26'),_0x31ab32,_0x2d9053);_0xa16ab(_0x2d9053);});});}function respondWithStatusCode(_0x3b48b7,_0x337f8e){_0x337f8e=_0x337f8e||0xcc;return function(_0x3b8e02){if(_0x3b8e02){return _0x3b48b7['sendStatus'](_0x337f8e);}return _0x3b48b7[_0x2f0c('0x30')](_0x337f8e)[_0x2f0c('0x31')]();};}function respondWithResult(_0x9b9273,_0x3edbc2){_0x3edbc2=_0x3edbc2||0xc8;return function(_0x5a11f2){if(_0x5a11f2){return _0x9b9273['status'](_0x3edbc2)[_0x2f0c('0x32')](_0x5a11f2);}};}function respondWithFilteredResult(_0x415c7a,_0x41a4f1){return function(_0x25c683){if(_0x25c683){var _0x1c5638=typeof _0x41a4f1[_0x2f0c('0x33')]===_0x2f0c('0x34')&&typeof _0x41a4f1['limit']===_0x2f0c('0x34');var _0x145441=_0x25c683[_0x2f0c('0x35')];var _0x4f3a99=_0x1c5638?0x0:_0x41a4f1[_0x2f0c('0x33')];var _0xaa2b97=_0x1c5638?_0x25c683[_0x2f0c('0x35')]:_0x41a4f1[_0x2f0c('0x33')]+_0x41a4f1['limit'];var _0x1cea58;if(_0xaa2b97>=_0x145441){_0xaa2b97=_0x145441;_0x1cea58=0xc8;}else{_0x1cea58=0xce;}_0x415c7a['status'](_0x1cea58);return _0x415c7a[_0x2f0c('0x36')](_0x2f0c('0x37'),_0x4f3a99+'-'+_0xaa2b97+'/'+_0x145441)[_0x2f0c('0x32')](_0x25c683);}return null;};}function patchUpdates(_0x219374){return function(_0x179906){try{jsonpatch[_0x2f0c('0x38')](_0x179906,_0x219374,!![]);}catch(_0x56a77e){return BPromise[_0x2f0c('0x39')](_0x56a77e);}return _0x179906[_0x2f0c('0x3a')]();};}function saveUpdates(_0x46ecba,_0x249cad){return function(_0x5d061f){if(_0x5d061f){return _0x5d061f[_0x2f0c('0x3b')](_0x46ecba)[_0x2f0c('0x25')](function(_0x4a4411){return _0x4a4411;});}return null;};}function removeEntity(_0x198e7f,_0x333561){return function(_0xf9dab8){if(_0xf9dab8){return _0xf9dab8['destroy']()[_0x2f0c('0x25')](function(){var _0x32db77=_0xf9dab8[_0x2f0c('0x3c')]({'plain':!![]});var _0x505936=_0x2f0c('0x3d');return db['UserProfileResource']['destroy']({'where':{'type':_0x505936,'resourceId':_0x32db77['id']}})['then'](function(){return _0xf9dab8;});})[_0x2f0c('0x25')](function(){_0x198e7f['status'](0xcc)[_0x2f0c('0x31')]();});}};}function handleEntityNotFound(_0x5d5fd9,_0x364f90){return function(_0x437816){if(!_0x437816){_0x5d5fd9[_0x2f0c('0x3e')](0x194);}return _0x437816;};}function handleError(_0x52f223,_0x2105ad){_0x2105ad=_0x2105ad||0x1f4;return function(_0x1d3600){logger[_0x2f0c('0x2b')](_0x1d3600[_0x2f0c('0x3f')]);if(_0x1d3600['name']){delete _0x1d3600[_0x2f0c('0x40')];}_0x52f223[_0x2f0c('0x30')](_0x2105ad)[_0x2f0c('0x41')](_0x1d3600);};}exports['index']=function(_0x43e5d8,_0x59cd57){var _0x268de4={'include':[{'model':db[_0x2f0c('0x42')],'as':_0x2f0c('0x43')}]},_0x7235bd={},_0x2854d8={'count':0x0,'rows':[]};var _0x41010d=_['map'](db[_0x2f0c('0x44')]['rawAttributes'],function(_0x1fd4da){return{'name':_0x1fd4da[_0x2f0c('0x45')],'type':_0x1fd4da[_0x2f0c('0x46')][_0x2f0c('0x47')]};});_0x7235bd['model']=_[_0x2f0c('0x48')](_0x41010d,_0x2f0c('0x40'));_0x7235bd[_0x2f0c('0x49')]=_[_0x2f0c('0x4a')](_0x43e5d8[_0x2f0c('0x49')]);_0x7235bd[_0x2f0c('0x4b')]=_['intersection'](_0x7235bd[_0x2f0c('0x4c')],_0x7235bd[_0x2f0c('0x49')]);_0x268de4[_0x2f0c('0x4d')]=_[_0x2f0c('0x4e')](_0x7235bd[_0x2f0c('0x4c')],qs[_0x2f0c('0x4f')](_0x43e5d8[_0x2f0c('0x49')][_0x2f0c('0x4f')]));_0x268de4[_0x2f0c('0x4d')]=_0x268de4[_0x2f0c('0x4d')]['length']?_0x268de4[_0x2f0c('0x4d')]:_0x7235bd['model'];if(!_0x43e5d8[_0x2f0c('0x49')][_0x2f0c('0x50')](_0x2f0c('0x51'))){_0x268de4['limit']=qs['limit'](_0x43e5d8['query'][_0x2f0c('0x52')]);_0x268de4[_0x2f0c('0x33')]=qs[_0x2f0c('0x33')](_0x43e5d8[_0x2f0c('0x49')][_0x2f0c('0x33')]);}_0x268de4['order']=qs[_0x2f0c('0x53')](_0x43e5d8[_0x2f0c('0x49')][_0x2f0c('0x53')]);_0x268de4[_0x2f0c('0x54')]=qs[_0x2f0c('0x4b')](_[_0x2f0c('0x55')](_0x43e5d8['query'],_0x7235bd['filters']),_0x41010d);if(_0x43e5d8[_0x2f0c('0x49')]['filter']){_0x268de4[_0x2f0c('0x54')]=_[_0x2f0c('0x56')](_0x268de4[_0x2f0c('0x54')],{'$or':_[_0x2f0c('0x48')](_0x41010d,function(_0x4bbec7){if(_0x4bbec7[_0x2f0c('0x46')]!==_0x2f0c('0x57')){var _0x476c47={};_0x476c47[_0x4bbec7['name']]={'$like':'%'+_0x43e5d8[_0x2f0c('0x49')][_0x2f0c('0x58')]+'%'};return _0x476c47;}})});}_0x268de4=_[_0x2f0c('0x56')]({},_0x268de4,_0x43e5d8['options']);var _0xf344db={'where':_0x268de4[_0x2f0c('0x54')]};return db[_0x2f0c('0x44')][_0x2f0c('0x35')](_0xf344db)['then'](function(_0x192398){_0x2854d8[_0x2f0c('0x35')]=_0x192398;if(_0x43e5d8[_0x2f0c('0x49')]['includeAll']){_0x268de4[_0x2f0c('0x59')]=[{'all':!![]}];}return db[_0x2f0c('0x44')][_0x2f0c('0x5a')](_0x268de4);})[_0x2f0c('0x25')](function(_0x23456a){_0x2854d8[_0x2f0c('0x5b')]=_0x23456a;return _0x2854d8;})[_0x2f0c('0x25')](respondWithFilteredResult(_0x59cd57,_0x268de4))[_0x2f0c('0x5c')](handleError(_0x59cd57,null));};exports[_0x2f0c('0x5d')]=function(_0x307db2,_0x426937){var _0x56224d={'raw':![],'where':{'id':_0x307db2['params']['id']},'include':[{'model':db['Pause'],'as':_0x2f0c('0x43')}]},_0x3bb5e8={};_0x3bb5e8['model']=_[_0x2f0c('0x4a')](db[_0x2f0c('0x44')][_0x2f0c('0x5e')]);_0x3bb5e8[_0x2f0c('0x49')]=_[_0x2f0c('0x4a')](_0x307db2[_0x2f0c('0x49')]);_0x3bb5e8[_0x2f0c('0x4b')]=_['intersection'](_0x3bb5e8['model'],_0x3bb5e8[_0x2f0c('0x49')]);_0x56224d[_0x2f0c('0x4d')]=_[_0x2f0c('0x4e')](_0x3bb5e8[_0x2f0c('0x4c')],qs[_0x2f0c('0x4f')](_0x307db2[_0x2f0c('0x49')][_0x2f0c('0x4f')]));_0x56224d[_0x2f0c('0x4d')]=_0x56224d['attributes'][_0x2f0c('0x5f')]?_0x56224d['attributes']:_0x3bb5e8[_0x2f0c('0x4c')];if(_0x307db2[_0x2f0c('0x49')][_0x2f0c('0x60')]){_0x56224d[_0x2f0c('0x59')]=[{'all':!![]}];}_0x56224d=_[_0x2f0c('0x56')]({},_0x56224d,_0x307db2[_0x2f0c('0x61')]);return db[_0x2f0c('0x44')][_0x2f0c('0x62')](_0x56224d)[_0x2f0c('0x25')](handleEntityNotFound(_0x426937,null))[_0x2f0c('0x25')](respondWithResult(_0x426937,null))['catch'](handleError(_0x426937,null));};exports[_0x2f0c('0x63')]=function(_0x265990,_0x2a642f){return db['OpenchannelAccount'][_0x2f0c('0x63')](_0x265990[_0x2f0c('0x64')],{})[_0x2f0c('0x25')](function(_0x5172ce){var _0x2fb525=_0x265990[_0x2f0c('0x65')][_0x2f0c('0x3c')]({'plain':!![]});if(!_0x2fb525)throw new Error(_0x2f0c('0x66'));if(_0x2fb525[_0x2f0c('0x67')]==='user'){var _0x11ac63=_0x5172ce['get']({'plain':!![]});var _0x4cf475=_0x2f0c('0x3d');return db[_0x2f0c('0x68')][_0x2f0c('0x62')]({'where':{'name':_0x4cf475,'userProfileId':_0x2fb525['userProfileId']},'raw':!![]})[_0x2f0c('0x25')](function(_0x2e6592){if(_0x2e6592&&_0x2e6592[_0x2f0c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x11ac63[_0x2f0c('0x40')],'resourceId':_0x11ac63['id'],'type':_0x2e6592[_0x2f0c('0x40')],'sectionId':_0x2e6592['id']},{})['then'](function(){return _0x5172ce;});}else{return _0x5172ce;}})[_0x2f0c('0x5c')](function(_0x292755){logger['error'](_0x2f0c('0x6a'),_0x292755);throw _0x292755;});}return _0x5172ce;})['then'](respondWithResult(_0x2a642f,0xc9))[_0x2f0c('0x5c')](handleError(_0x2a642f,null));};exports[_0x2f0c('0x3b')]=function(_0x5a5cd8,_0x124e8d){if(_0x5a5cd8[_0x2f0c('0x64')]['id']){delete _0x5a5cd8[_0x2f0c('0x64')]['id'];}return db['OpenchannelAccount'][_0x2f0c('0x62')]({'where':{'id':_0x5a5cd8[_0x2f0c('0x6b')]['id']},'include':[{'model':db['Pause'],'as':_0x2f0c('0x43')}]})[_0x2f0c('0x25')](handleEntityNotFound(_0x124e8d,null))[_0x2f0c('0x25')](saveUpdates(_0x5a5cd8[_0x2f0c('0x64')],null))[_0x2f0c('0x25')](respondWithResult(_0x124e8d,null))[_0x2f0c('0x5c')](handleError(_0x124e8d,null));};exports[_0x2f0c('0x6c')]=function(_0x54394b,_0x207028){return db[_0x2f0c('0x44')][_0x2f0c('0x62')]({'where':{'id':_0x54394b['params']['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x207028,null))['then'](removeEntity(_0x207028,null))[_0x2f0c('0x5c')](handleError(_0x207028,null));};exports['describe']=function(_0x39f479,_0x38f855){return db[_0x2f0c('0x44')][_0x2f0c('0x6d')]()[_0x2f0c('0x25')](respondWithResult(_0x38f855,null))['catch'](handleError(_0x38f855,null));};exports[_0x2f0c('0x6e')]=function(_0x56b5e6,_0x5dde71,_0x1cbafc){if(_0x56b5e6[_0x2f0c('0x64')]['id']){delete _0x56b5e6[_0x2f0c('0x64')]['id'];}return db[_0x2f0c('0x44')][_0x2f0c('0x62')]({'where':{'id':_0x56b5e6[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x5dde71,null))['then'](function(_0x54b213){if(_0x54b213){_0x56b5e6[_0x2f0c('0x64')]['OpenchannelAccountId']=_0x54b213['id'];return db['Disposition'][_0x2f0c('0x63')](_0x56b5e6[_0x2f0c('0x64')]);}})[_0x2f0c('0x25')](respondWithResult(_0x5dde71,null))[_0x2f0c('0x5c')](handleError(_0x5dde71,null));};exports['getDispositions']=function(_0x2edf98,_0x4bb7b0,_0x5669e5){var _0x411077={'raw':![],'where':{}};var _0x451ea9={};var _0x34e03d={'count':0x0,'rows':[]};return db[_0x2f0c('0x44')][_0x2f0c('0x6f')]({'where':{'id':_0x2edf98[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x4bb7b0,null))[_0x2f0c('0x25')](function(_0x4a5488){if(_0x4a5488){_0x451ea9[_0x2f0c('0x4c')]=_['keys'](db[_0x2f0c('0x70')][_0x2f0c('0x5e')]);_0x451ea9[_0x2f0c('0x49')]=_[_0x2f0c('0x4a')](_0x2edf98[_0x2f0c('0x49')]);_0x451ea9[_0x2f0c('0x4b')]=_[_0x2f0c('0x4e')](_0x451ea9[_0x2f0c('0x4c')],_0x451ea9['query']);_0x411077['attributes']=_[_0x2f0c('0x4e')](_0x451ea9[_0x2f0c('0x4c')],qs['fields'](_0x2edf98['query'][_0x2f0c('0x4f')]));_0x411077['attributes']=_0x411077[_0x2f0c('0x4d')]['length']?_0x411077[_0x2f0c('0x4d')]:_0x451ea9[_0x2f0c('0x4c')];if(!_0x2edf98[_0x2f0c('0x49')]['hasOwnProperty']('nolimit')){_0x411077['limit']=qs[_0x2f0c('0x52')](_0x2edf98[_0x2f0c('0x49')][_0x2f0c('0x52')]);_0x411077['offset']=qs['offset'](_0x2edf98[_0x2f0c('0x49')][_0x2f0c('0x33')]);}_0x411077['order']=qs[_0x2f0c('0x53')](_0x2edf98['query'][_0x2f0c('0x53')]);_0x411077[_0x2f0c('0x54')]=qs[_0x2f0c('0x4b')](_[_0x2f0c('0x55')](_0x2edf98['query'],_0x451ea9[_0x2f0c('0x4b')]));_0x411077['where'][_0x2f0c('0x71')]=_0x4a5488['id'];if(_0x2edf98[_0x2f0c('0x49')][_0x2f0c('0x58')]){_0x411077[_0x2f0c('0x54')]=_['merge'](_0x411077['where'],{'$or':_['map'](_0x411077['attributes'],function(_0xb016bb){var _0x33e6bf={};_0x33e6bf[_0xb016bb]={'$like':'%'+_0x2edf98['query'][_0x2f0c('0x58')]+'%'};return _0x33e6bf;})});}_0x411077=_[_0x2f0c('0x56')]({},_0x411077,_0x2edf98[_0x2f0c('0x61')]);return db[_0x2f0c('0x70')][_0x2f0c('0x35')]({'where':_0x411077[_0x2f0c('0x54')]})[_0x2f0c('0x25')](function(_0x1d3734){_0x34e03d[_0x2f0c('0x35')]=_0x1d3734;if(_0x2edf98[_0x2f0c('0x49')][_0x2f0c('0x60')]){_0x411077[_0x2f0c('0x59')]=[{'all':!![]}];}return db[_0x2f0c('0x70')][_0x2f0c('0x5a')](_0x411077);})[_0x2f0c('0x25')](function(_0x1747f5){_0x34e03d[_0x2f0c('0x5b')]=_0x1747f5;return _0x34e03d;});}})['then'](respondWithFilteredResult(_0x4bb7b0,_0x411077))[_0x2f0c('0x5c')](handleError(_0x4bb7b0,null));};exports[_0x2f0c('0x72')]=function(_0x286b79,_0x4668d9,_0x672730){return db[_0x2f0c('0x44')]['find']({'where':{'id':_0x286b79[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x4668d9,null))[_0x2f0c('0x25')](function(_0x568f28){if(_0x568f28){return _0x568f28[_0x2f0c('0x72')](_0x286b79[_0x2f0c('0x49')][_0x2f0c('0x73')]);}})[_0x2f0c('0x25')](respondWithStatusCode(_0x4668d9,null))['catch'](handleError(_0x4668d9,null));};exports[_0x2f0c('0x74')]=function(_0x298f10,_0x146db1,_0x26d8e9){if(_0x298f10[_0x2f0c('0x64')]['id']){delete _0x298f10[_0x2f0c('0x64')]['id'];}return db[_0x2f0c('0x44')]['find']({'where':{'id':_0x298f10[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x146db1,null))[_0x2f0c('0x25')](function(_0x3420d5){if(_0x3420d5){_0x298f10[_0x2f0c('0x64')][_0x2f0c('0x71')]=_0x3420d5['id'];return db[_0x2f0c('0x75')][_0x2f0c('0x63')](_0x298f10[_0x2f0c('0x64')]);}})[_0x2f0c('0x25')](respondWithResult(_0x146db1,null))[_0x2f0c('0x5c')](handleError(_0x146db1,null));};exports[_0x2f0c('0x76')]=function(_0x3c7018,_0x42d367,_0x57aad0){var _0x18f7e0={'raw':![],'where':{}};var _0xe8a96c={};var _0x524d5f={'count':0x0,'rows':[]};return db[_0x2f0c('0x44')][_0x2f0c('0x6f')]({'where':{'id':_0x3c7018[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x42d367,null))[_0x2f0c('0x25')](function(_0x2e1efb){if(_0x2e1efb){_0xe8a96c[_0x2f0c('0x4c')]=_[_0x2f0c('0x4a')](db[_0x2f0c('0x75')]['rawAttributes']);_0xe8a96c[_0x2f0c('0x49')]=_['keys'](_0x3c7018[_0x2f0c('0x49')]);_0xe8a96c[_0x2f0c('0x4b')]=_[_0x2f0c('0x4e')](_0xe8a96c[_0x2f0c('0x4c')],_0xe8a96c[_0x2f0c('0x49')]);_0x18f7e0['attributes']=_['intersection'](_0xe8a96c[_0x2f0c('0x4c')],qs[_0x2f0c('0x4f')](_0x3c7018[_0x2f0c('0x49')][_0x2f0c('0x4f')]));_0x18f7e0[_0x2f0c('0x4d')]=_0x18f7e0[_0x2f0c('0x4d')]['length']?_0x18f7e0[_0x2f0c('0x4d')]:_0xe8a96c[_0x2f0c('0x4c')];if(!_0x3c7018['query'][_0x2f0c('0x50')](_0x2f0c('0x51'))){_0x18f7e0['limit']=qs[_0x2f0c('0x52')](_0x3c7018[_0x2f0c('0x49')]['limit']);_0x18f7e0['offset']=qs[_0x2f0c('0x33')](_0x3c7018[_0x2f0c('0x49')][_0x2f0c('0x33')]);}_0x18f7e0[_0x2f0c('0x77')]=qs[_0x2f0c('0x53')](_0x3c7018[_0x2f0c('0x49')][_0x2f0c('0x53')]);_0x18f7e0['where']=qs[_0x2f0c('0x4b')](_[_0x2f0c('0x55')](_0x3c7018[_0x2f0c('0x49')],_0xe8a96c[_0x2f0c('0x4b')]));_0x18f7e0[_0x2f0c('0x54')]['OpenchannelAccountId']=_0x2e1efb['id'];if(_0x3c7018[_0x2f0c('0x49')]['filter']){_0x18f7e0[_0x2f0c('0x54')]=_[_0x2f0c('0x56')](_0x18f7e0[_0x2f0c('0x54')],{'$or':_[_0x2f0c('0x48')](_0x18f7e0[_0x2f0c('0x4d')],function(_0x5772e){var _0x22a1bc={};_0x22a1bc[_0x5772e]={'$like':'%'+_0x3c7018[_0x2f0c('0x49')][_0x2f0c('0x58')]+'%'};return _0x22a1bc;})});}_0x18f7e0=_[_0x2f0c('0x56')]({},_0x18f7e0,_0x3c7018[_0x2f0c('0x61')]);return db['CannedAnswer']['count']({'where':_0x18f7e0[_0x2f0c('0x54')]})[_0x2f0c('0x25')](function(_0x1c673f){_0x524d5f[_0x2f0c('0x35')]=_0x1c673f;if(_0x3c7018[_0x2f0c('0x49')][_0x2f0c('0x60')]){_0x18f7e0[_0x2f0c('0x59')]=[{'all':!![]}];}return db[_0x2f0c('0x75')]['findAll'](_0x18f7e0);})[_0x2f0c('0x25')](function(_0x3e0952){_0x524d5f[_0x2f0c('0x5b')]=_0x3e0952;return _0x524d5f;});}})[_0x2f0c('0x25')](respondWithFilteredResult(_0x42d367,_0x18f7e0))['catch'](handleError(_0x42d367,null));};exports[_0x2f0c('0x78')]=function(_0x585f39,_0x3e3363,_0x2a84ab){return db[_0x2f0c('0x44')]['find']({'where':{'id':_0x585f39[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x3e3363,null))[_0x2f0c('0x25')](function(_0x4e2a56){if(_0x4e2a56){return _0x4e2a56[_0x2f0c('0x78')](_0x585f39[_0x2f0c('0x49')][_0x2f0c('0x73')]);}})[_0x2f0c('0x25')](respondWithStatusCode(_0x3e3363,null))[_0x2f0c('0x5c')](handleError(_0x3e3363,null));};exports[_0x2f0c('0x79')]=function(_0x5611ae,_0x50b430,_0x5a00e9){var _0x4f99d4={'body':_0x5611ae[_0x2f0c('0x64')],'channel':_0x2f0c('0x7a')};var _0x31e28e=[];var _0xefd0bd=[];var _0x521d5d={};var _0x2d814a=![];return db[_0x2f0c('0x7b')][_0x2f0c('0x6d')]()['then'](function(_0x505616){if(!_0x505616){throw new db[(_0x2f0c('0x7c'))][(_0x2f0c('0x7d'))](_0x2f0c('0x7e'));}_0x31e28e=_['difference'](_['keys'](_0x505616),['createdAt',_0x2f0c('0x7f')]);_0xefd0bd=_[_0x2f0c('0x80')](_[_0x2f0c('0x4a')](_0x505616),[_0x2f0c('0x81'),_0x2f0c('0x7f'),_0x2f0c('0x82'),_0x2f0c('0x83')]);if(_0x5611ae[_0x2f0c('0x64')]['id']){delete _0x5611ae[_0x2f0c('0x64')]['id'];}if(_[_0x2f0c('0x84')](_0x5611ae['body'][_0x2f0c('0x85')])){throw new db[(_0x2f0c('0x7c'))]['ValidationError'](_0x2f0c('0x86'));}if(_[_0x2f0c('0x84')](_0x5611ae['body'][_0x2f0c('0x64')])||_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x64')]===''){throw new db[(_0x2f0c('0x7c'))][(_0x2f0c('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2f0c('0x84')](_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x87')])){throw new db[(_0x2f0c('0x7c'))][(_0x2f0c('0x7d'))](_0x2f0c('0x88')+_0xefd0bd);}if(!_[_0x2f0c('0x89')](_0xefd0bd,_0x5611ae[_0x2f0c('0x64')]['mapKey'])){throw new db[(_0x2f0c('0x7c'))][(_0x2f0c('0x7d'))](_0x2f0c('0x8a')+_0xefd0bd);}_0x521d5d[_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x87')]]=_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x85')];})['then'](function(){return db[_0x2f0c('0x44')][_0x2f0c('0x62')]({'where':{'id':_0x5611ae[_0x2f0c('0x6b')]['id']},'include':[{'model':db[_0x2f0c('0x8b')],'as':_0x2f0c('0x8c'),'include':[{'model':db[_0x2f0c('0x7b')],'as':'Contacts','where':_0x521d5d,'limit':0x1,'order':[[_0x2f0c('0x7f'),_0x2f0c('0x8d')]]}]},{'model':db[_0x2f0c('0x8e')],'as':'Applications'}]});})[_0x2f0c('0x25')](handleEntityNotFound(_0x50b430,null))[_0x2f0c('0x25')](function(_0x46f88d){if(_0x46f88d&&_0x46f88d['List']){_0x4f99d4[_0x2f0c('0x8f')]=_0x46f88d;_0x4f99d4['applications']=_0x46f88d[_0x2f0c('0x90')];_0x4f99d4[_0x2f0c('0x91')]=_0x46f88d['List'];_0x4f99d4[_0x2f0c('0x92')]=_[_0x2f0c('0x93')](_0x4f99d4[_0x2f0c('0x92')],[_0x2f0c('0x94')],[_0x2f0c('0x95')]);if(_0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0x90')]){delete _0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0x90')];}if(_0x4f99d4['account'][_0x2f0c('0x8c')]&&_0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0x8c')][_0x2f0c('0x96')][_0x2f0c('0x5f')]){return _0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0x8c')][_0x2f0c('0x96')][0x0];}var _0x1cd5cd=_[_0x2f0c('0x1d')](_0x5611ae[_0x2f0c('0x64')],{'firstName':_0x5611ae['body'][_0x2f0c('0x85')],'ListId':_0x46f88d[_0x2f0c('0x83')]});_0x1cd5cd[_0x5611ae[_0x2f0c('0x64')]['mapKey']]=_0x5611ae['body'][_0x2f0c('0x85')];return db[_0x2f0c('0x7b')][_0x2f0c('0x63')](_0x1cd5cd,{'fields':_0x31e28e,'raw':!![]});}})['then'](handleEntityNotFound(_0x50b430,null))['then'](function(_0xc523f2){_0x4f99d4[_0x2f0c('0x97')]=_0xc523f2;if(_0xc523f2){var _0x52d8d2={'ContactId':_0xc523f2['id'],'OpenchannelAccountId':_0x5611ae['params']['id'],'from':(_0xc523f2[_0x2f0c('0x98')]||'')+'\x20'+(_0xc523f2[_0x2f0c('0x99')]||'')};var _0x2781dd={'OpenchannelAccountId':_0x5611ae['params']['id'],'closed':![]};if(_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x9a')]){_0x2781dd[_0x2f0c('0x9a')]=_0x5611ae['body'][_0x2f0c('0x9a')];return db[_0x2f0c('0x9b')][_0x2f0c('0x62')]({'where':_0x2781dd})['then'](function(_0x552a66){if(_0x552a66){return[_0x552a66,![]];}_0x52d8d2['threadId']=_0x5611ae[_0x2f0c('0x64')]['threadId'];_0x52d8d2[_0x2f0c('0x9c')]=_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x9c')];return db[_0x2f0c('0x9b')][_0x2f0c('0x63')](_0x52d8d2)[_0x2f0c('0x25')](function(_0x1bbcdb){return[_0x1bbcdb,!![]];});});}else{_0x2781dd[_0x2f0c('0x9a')]=null;}_0x2781dd[_0x2f0c('0x9d')]=_0xc523f2['id'];return db['OpenchannelInteraction']['find']({'where':_0x2781dd})[_0x2f0c('0x25')](function(_0x561527){if(_0x561527){return[_0x561527,![]];}return db[_0x2f0c('0x9b')]['create'](_0x52d8d2)[_0x2f0c('0x25')](function(_0x24b3a3){return[_0x24b3a3,!![]];});});}})[_0x2f0c('0x9e')](function(_0x3234c5,_0x444c69){if(_0x3234c5){_0x2d814a=_0x444c69;if(!_0x444c69){var _0x2148f5={'from':(_0x4f99d4[_0x2f0c('0x97')][_0x2f0c('0x98')]||'')+'\x20'+(_0x4f99d4['contact'][_0x2f0c('0x99')]||'')};if(_0x5611ae['body']['threadId']&&_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x9f')]&&_0x5611ae['body'][_0x2f0c('0x9a')]!=_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x9f')]){_0x2148f5['threadId']=_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x9f')];}return _0x3234c5[_0x2f0c('0x3b')](_0x2148f5);}else{return _0x3234c5;}}})[_0x2f0c('0x25')](function(_0x209dce){_0x4f99d4[_0x2f0c('0xa0')]=_0x209dce[_0x2f0c('0x3c')]({'plain':!![]});_0x4f99d4['interaction']['created']=_0x2d814a;if(_0x4f99d4[_0x2f0c('0xa0')][_0x2f0c('0xa1')]){if(_0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0xa2')]){_0x4f99d4[_0x2f0c('0x92')][_0x2f0c('0xa3')]({'id':0x0,'priority':_0x4f99d4[_0x2f0c('0x92')][_0x2f0c('0x5f')]+0x1,'app':_0x2f0c('0xa4'),'appdata':_0x2f0c('0xa5'),'interval':_0x2f0c('0xa6')});}}return db[_0x2f0c('0xa7')][_0x2f0c('0x63')]({'body':_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0x64')],'OpenchannelAccountId':_0x5611ae[_0x2f0c('0x6b')]['id'],'OpenchannelInteractionId':_0x209dce['id'],'direction':'in','ContactId':_0x4f99d4[_0x2f0c('0x97')]['id'],'AttachmentId':_0x5611ae[_0x2f0c('0x64')][_0x2f0c('0xa8')]});})[_0x2f0c('0x25')](function(_0x3d3a23){_0x4f99d4[_0x2f0c('0x2d')]=_0x3d3a23;if(!_0x4f99d4['interaction']['UserId'])return;return db[_0x2f0c('0xa9')][_0x2f0c('0x62')]({'attributes':['id','name'],'where':{'id':_0x4f99d4['interaction'][_0x2f0c('0xaa')]}});})['then'](function(_0x2a1c60){if(_0x2a1c60){_0x4f99d4[_0x2f0c('0x92')][_0x2f0c('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2a1c60[_0x2f0c('0x40')]+','+(_0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0xac')]||0xa),'interval':_0x2f0c('0xa6')});}if(!_0x4f99d4[_0x2f0c('0xa0')][_0x2f0c('0xad')])return;return db['OpenchannelQueue'][_0x2f0c('0x62')]({'attributes':['id','name'],'where':{'id':_0x4f99d4[_0x2f0c('0xa0')][_0x2f0c('0xad')]}});})[_0x2f0c('0x25')](function(_0x25b94c){if(_0x25b94c){_0x4f99d4['applications'][_0x2f0c('0xab')]({'id':0x0,'priority':0x1,'app':_0x2f0c('0xae'),'appdata':_0x25b94c['name']+','+(_0x4f99d4[_0x2f0c('0x8f')][_0x2f0c('0xaf')]||0x12c),'interval':_0x2f0c('0xa6')});}return respondWithRpcPromise(_0x2f0c('0xb0'),_0x2f0c('0xb1'),_0x4f99d4);})[_0x2f0c('0x25')](function(_0x207693){respondWithRpcPromise(_0x2f0c('0xb2'),'EventManager',{'event':_0x2f0c('0x79'),'message':_0x207693},client9002);return _0x207693;})[_0x2f0c('0x25')](respondWithResult(_0x50b430,null))['catch'](handleError(_0x50b430,null));};exports['addApplications']=function(_0x42d40b,_0x21d932){var _0x4a36fd=_0x42d40b[_0x2f0c('0x6b')]['id'];var _0x3cf2cf=_0x42d40b[_0x2f0c('0x64')];var _0x4f85d4=0xc8;var _0x24e669=null;return db[_0x2f0c('0xb3')][_0x2f0c('0xb4')]({'isolationLevel':db[_0x2f0c('0xb3')][_0x2f0c('0xb5')][_0x2f0c('0xb6')]['READ_COMMITTED']},function(_0x3f1cd8){return db[_0x2f0c('0x44')][_0x2f0c('0x6f')]({'where':{'id':_0x4a36fd},'transaction':_0x3f1cd8})[_0x2f0c('0x25')](function(_0x244acc){if(_0x244acc){return db['OpenchannelApplication'][_0x2f0c('0x6c')]({'where':{'OpenchannelAccountId':_0x4a36fd},'transaction':_0x3f1cd8})[_0x2f0c('0x25')](function(){var _0x4780c3=_[_0x2f0c('0x48')](_0x3cf2cf,function(_0xa4f7f7){_0xa4f7f7[_0x2f0c('0x71')]=_0x4a36fd;return _0xa4f7f7;});return db['OpenchannelApplication'][_0x2f0c('0xb7')](_0x4780c3,{'transaction':_0x3f1cd8});});}else{_0x4f85d4=0x194;_0x24e669=[];}});})[_0x2f0c('0x25')](function(){if(_0x4f85d4!==0x194){return db[_0x2f0c('0x8e')][_0x2f0c('0xb8')]({'where':{'OpenchannelAccountId':_0x4a36fd},'order':'priority'})['then'](function(_0x19afdc){_0x24e669=_0x19afdc;});}})[_0x2f0c('0x5c')](function(_0xfae729){_0x4f85d4=0x1f4;logger[_0x2f0c('0x2b')](_0xfae729['stack']);if(_0xfae729[_0x2f0c('0x40')]){delete _0xfae729['name'];}_0x24e669=_0xfae729;})['finally'](function(){if(_0x24e669===null){_0x21d932[_0x2f0c('0x3e')](_0x4f85d4);}else{if(_0x4f85d4===0x1f4){_0x21d932[_0x2f0c('0x30')](_0x4f85d4)['send'](_0x24e669);}else{_0x21d932[_0x2f0c('0x30')](_0x4f85d4)[_0x2f0c('0x32')](_0x24e669);}}});};exports[_0x2f0c('0xb9')]=function(_0x60ee6b,_0x1a6851,_0x26e582){var _0x1c50f9={};var _0x54eef7={};var _0x314d93;var _0x32c46a;return db[_0x2f0c('0x44')][_0x2f0c('0x6f')]({'where':{'id':_0x60ee6b['params']['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x1a6851,null))[_0x2f0c('0x25')](function(_0x3e5f6b){if(_0x3e5f6b){_0x314d93=_0x3e5f6b;_0x54eef7[_0x2f0c('0x4c')]=_['keys'](db['OpenchannelApplication'][_0x2f0c('0x5e')]);_0x54eef7[_0x2f0c('0x49')]=_[_0x2f0c('0x4a')](_0x60ee6b[_0x2f0c('0x49')]);_0x54eef7[_0x2f0c('0x4b')]=_[_0x2f0c('0x4e')](_0x54eef7['model'],_0x54eef7[_0x2f0c('0x49')]);_0x1c50f9[_0x2f0c('0x4d')]=_['intersection'](_0x54eef7[_0x2f0c('0x4c')],qs['fields'](_0x60ee6b[_0x2f0c('0x49')][_0x2f0c('0x4f')]));_0x1c50f9[_0x2f0c('0x4d')]=_0x1c50f9[_0x2f0c('0x4d')][_0x2f0c('0x5f')]?_0x1c50f9[_0x2f0c('0x4d')]:_0x54eef7[_0x2f0c('0x4c')];_0x1c50f9[_0x2f0c('0x77')]=qs['sort'](_0x60ee6b[_0x2f0c('0x49')][_0x2f0c('0x53')]);_0x1c50f9[_0x2f0c('0x54')]=qs['filters'](_[_0x2f0c('0x55')](_0x60ee6b[_0x2f0c('0x49')],_0x54eef7[_0x2f0c('0x4b')]));if(_0x60ee6b[_0x2f0c('0x49')][_0x2f0c('0x58')]){_0x1c50f9[_0x2f0c('0x54')]=_['merge'](_0x1c50f9['where'],{'$or':_[_0x2f0c('0x48')](_0x1c50f9[_0x2f0c('0x4d')],function(_0x1f58e5){var _0x3b0f47={};_0x3b0f47[_0x1f58e5]={'$like':'%'+_0x60ee6b[_0x2f0c('0x49')]['filter']+'%'};return _0x3b0f47;})});}_0x1c50f9=_[_0x2f0c('0x56')]({},_0x1c50f9,_0x60ee6b[_0x2f0c('0x61')]);return _0x314d93[_0x2f0c('0xb9')](_0x1c50f9);}})[_0x2f0c('0x25')](function(_0x22fed0){if(_0x22fed0){_0x32c46a=_0x22fed0[_0x2f0c('0x5f')];if(!_0x60ee6b[_0x2f0c('0x49')][_0x2f0c('0x50')](_0x2f0c('0x51'))){_0x1c50f9[_0x2f0c('0x52')]=qs[_0x2f0c('0x52')](_0x60ee6b[_0x2f0c('0x49')][_0x2f0c('0x52')]);_0x1c50f9[_0x2f0c('0x33')]=qs['offset'](_0x60ee6b[_0x2f0c('0x49')][_0x2f0c('0x33')]);}return _0x314d93[_0x2f0c('0xb9')](_0x1c50f9);}})[_0x2f0c('0x25')](function(_0x518a3d){if(_0x518a3d){return _0x518a3d?{'count':_0x32c46a,'rows':_0x518a3d}:null;}})[_0x2f0c('0x25')](respondWithResult(_0x1a6851,null))[_0x2f0c('0x5c')](handleError(_0x1a6851,null));};exports[_0x2f0c('0xba')]=function(_0x19bef0,_0x2bae4,_0x4ee084){var _0x13af5e={'raw':![],'where':{}};var _0x15c533={};var _0xda0725={'count':0x0,'rows':[]};return db[_0x2f0c('0x44')][_0x2f0c('0x6f')]({'where':{'id':_0x19bef0['params']['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x2bae4,null))[_0x2f0c('0x25')](function(_0x3ece57){if(_0x3ece57){_0x15c533['model']=_['keys'](db[_0x2f0c('0x9b')]['rawAttributes']);_0x15c533[_0x2f0c('0x49')]=_[_0x2f0c('0x4a')](_0x19bef0[_0x2f0c('0x49')]);_0x15c533[_0x2f0c('0x4b')]=_[_0x2f0c('0x4e')](_0x15c533[_0x2f0c('0x4c')],_0x15c533[_0x2f0c('0x49')]);_0x13af5e[_0x2f0c('0x4d')]=_[_0x2f0c('0x4e')](_0x15c533['model'],qs[_0x2f0c('0x4f')](_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x4f')]));_0x13af5e['attributes']=_0x13af5e[_0x2f0c('0x4d')]['length']?_0x13af5e['attributes']:_0x15c533['model'];if(!_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x50')]('nolimit')){_0x13af5e[_0x2f0c('0x52')]=qs['limit'](_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x52')]);_0x13af5e[_0x2f0c('0x33')]=qs[_0x2f0c('0x33')](_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x33')]);}_0x13af5e['order']=qs[_0x2f0c('0x53')](_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x53')]);_0x13af5e['where']=qs[_0x2f0c('0x4b')](_[_0x2f0c('0x55')](_0x19bef0[_0x2f0c('0x49')],_0x15c533[_0x2f0c('0x4b')]));_0x13af5e[_0x2f0c('0x54')]['OpenchannelAccountId']=_0x3ece57['id'];if(_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x58')]){_0x13af5e[_0x2f0c('0x54')]=_[_0x2f0c('0x56')](_0x13af5e[_0x2f0c('0x54')],{'$or':_[_0x2f0c('0x48')](_0x13af5e[_0x2f0c('0x4d')],function(_0x2c65cc){var _0x579a33={};_0x579a33[_0x2c65cc]={'$like':'%'+_0x19bef0[_0x2f0c('0x49')]['filter']+'%'};return _0x579a33;})});}_0x13af5e=_['merge']({},_0x13af5e,_0x19bef0[_0x2f0c('0x61')]);return db['OpenchannelInteraction'][_0x2f0c('0x35')]({'where':_0x13af5e[_0x2f0c('0x54')]})[_0x2f0c('0x25')](function(_0x41e0ed){_0xda0725[_0x2f0c('0x35')]=_0x41e0ed;if(_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0x60')]){_0x13af5e[_0x2f0c('0x59')]=[{'model':db[_0x2f0c('0x7b')],'as':'Contact','required':![]},{'model':db[_0x2f0c('0xa9')],'as':_0x2f0c('0xbb'),'attributes':[_0x2f0c('0x40'),_0x2f0c('0xbc'),_0x2f0c('0xbd')],'required':![]},{'model':db[_0x2f0c('0xbe')],'as':_0x2f0c('0xbf'),'attributes':['id',_0x2f0c('0x40'),'color'],'where':_0x19bef0['query'][_0x2f0c('0xc0')]?{'id':_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0xc0')]}:undefined,'required':_0x19bef0[_0x2f0c('0x49')][_0x2f0c('0xc0')]?!![]:![]}];}return db[_0x2f0c('0x9b')][_0x2f0c('0x5a')](_0x13af5e);})['then'](function(_0x3aec14){_0xda0725[_0x2f0c('0x5b')]=_0x3aec14;return _0xda0725;});}})[_0x2f0c('0x25')](respondWithFilteredResult(_0x2bae4,_0x13af5e))[_0x2f0c('0x5c')](handleError(_0x2bae4,null));};exports[_0x2f0c('0xc1')]=function(_0x3faf73,_0x3e6d77,_0x63b9d1){return db['OpenchannelAccount'][_0x2f0c('0x62')]({'where':{'id':_0x3faf73[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x3e6d77,null))[_0x2f0c('0x25')](function(_0x4314d9){if(_0x4314d9){return _0x4314d9[_0x2f0c('0xc1')](_0x3faf73[_0x2f0c('0x64')]['ids'],_[_0x2f0c('0xc2')](_0x3faf73[_0x2f0c('0x64')],['ids','id'])||{})['spread'](function(_0x386860){for(var _0x3681b7=0x0;_0x3681b7<_0x3faf73[_0x2f0c('0x64')]['ids']['length'];_0x3681b7+=0x1){socket['emit'](_0x2f0c('0xc3'),{'UserId':Number(_0x3faf73[_0x2f0c('0x64')]['ids'][_0x3681b7]),'OpenchannelAccountId':Number(_0x3faf73[_0x2f0c('0x6b')]['id'])});}return _0x386860;});}})['then'](respondWithResult(_0x3e6d77,null))[_0x2f0c('0x5c')](handleError(_0x3e6d77,null));};exports['removeAgents']=function(_0x3513f1,_0x103b29,_0x194e42){return db[_0x2f0c('0x44')][_0x2f0c('0x62')]({'where':{'id':_0x3513f1[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x103b29,null))[_0x2f0c('0x25')](function(_0x28e1dc){if(_0x28e1dc){return _0x28e1dc[_0x2f0c('0xc4')](_0x3513f1['query'][_0x2f0c('0x73')])[_0x2f0c('0x25')](function(){if(_[_0x2f0c('0xc5')](_0x3513f1[_0x2f0c('0x49')]['ids'])){for(var _0x4b725d=0x0;_0x4b725d<_0x3513f1[_0x2f0c('0x49')][_0x2f0c('0x73')][_0x2f0c('0x5f')];_0x4b725d+=0x1){socket[_0x2f0c('0xc6')](_0x2f0c('0xc7'),{'UserId':Number(_0x3513f1[_0x2f0c('0x49')][_0x2f0c('0x73')][_0x4b725d]),'OpenchannelAccountId':Number(_0x3513f1[_0x2f0c('0x6b')]['id'])});}}else{socket['emit'](_0x2f0c('0xc7'),{'UserId':Number(_0x3513f1[_0x2f0c('0x49')][_0x2f0c('0x73')]),'OpenchannelAccountId':Number(_0x3513f1[_0x2f0c('0x6b')]['id'])});}});}})[_0x2f0c('0x25')](respondWithStatusCode(_0x103b29,null))[_0x2f0c('0x5c')](handleError(_0x103b29,null));};exports[_0x2f0c('0xc8')]=function(_0x490294,_0x15e876,_0xa14ba0){var _0x3057c5={};var _0x29a38c={};var _0xd08acf;var _0x2b7608;return db['OpenchannelAccount'][_0x2f0c('0x6f')]({'where':{'id':_0x490294['params']['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x15e876,null))[_0x2f0c('0x25')](function(_0x2aa0aa){if(_0x2aa0aa){_0xd08acf=_0x2aa0aa;_0x29a38c[_0x2f0c('0x4c')]=_[_0x2f0c('0x4a')](db[_0x2f0c('0xa9')]['rawAttributes']);_0x29a38c[_0x2f0c('0x49')]=_[_0x2f0c('0x4a')](_0x490294[_0x2f0c('0x49')]);_0x29a38c[_0x2f0c('0x4b')]=_['intersection'](_0x29a38c['model'],_0x29a38c[_0x2f0c('0x49')]);_0x3057c5[_0x2f0c('0x4d')]=_[_0x2f0c('0x4e')](_0x29a38c[_0x2f0c('0x4c')],qs[_0x2f0c('0x4f')](_0x490294['query'][_0x2f0c('0x4f')]));_0x3057c5[_0x2f0c('0x4d')]=_0x3057c5[_0x2f0c('0x4d')][_0x2f0c('0x5f')]?_0x3057c5[_0x2f0c('0x4d')]:_0x29a38c[_0x2f0c('0x4c')];_0x3057c5[_0x2f0c('0x77')]=qs['sort'](_0x490294['query'][_0x2f0c('0x53')]);_0x3057c5[_0x2f0c('0x54')]=qs[_0x2f0c('0x4b')](_['pick'](_0x490294['query'],_0x29a38c[_0x2f0c('0x4b')]));if(_0x490294[_0x2f0c('0x49')][_0x2f0c('0x58')]){_0x3057c5[_0x2f0c('0x54')]=_[_0x2f0c('0x56')](_0x3057c5[_0x2f0c('0x54')],{'$or':_[_0x2f0c('0x48')](_0x3057c5[_0x2f0c('0x4d')],function(_0x5dca15){var _0x471da9={};_0x471da9[_0x5dca15]={'$like':'%'+_0x490294['query'][_0x2f0c('0x58')]+'%'};return _0x471da9;})});}_0x3057c5=_[_0x2f0c('0x56')]({},_0x3057c5,_0x490294[_0x2f0c('0x61')]);return _0xd08acf[_0x2f0c('0xc8')](_0x3057c5);}})['then'](function(_0x9711c0){if(_0x9711c0){_0x2b7608=_0x9711c0['length'];if(!_0x490294['query'][_0x2f0c('0x50')](_0x2f0c('0x51'))){_0x3057c5[_0x2f0c('0x52')]=qs[_0x2f0c('0x52')](_0x490294['query']['limit']);_0x3057c5[_0x2f0c('0x33')]=qs[_0x2f0c('0x33')](_0x490294[_0x2f0c('0x49')][_0x2f0c('0x33')]);}return _0xd08acf[_0x2f0c('0xc8')](_0x3057c5);}})[_0x2f0c('0x25')](function(_0x20a836){if(_0x20a836){return _0x20a836?{'count':_0x2b7608,'rows':_0x20a836}:null;}})[_0x2f0c('0x25')](respondWithResult(_0x15e876,null))['catch'](handleError(_0x15e876,null));};exports['send']=function(_0x4547bb,_0x41e150,_0x2de7ab){var _0x37d41d,_0x4e0229,_0x3eef81;if(_['isNil'](_0x4547bb[_0x2f0c('0x64')][_0x2f0c('0x64')])||_0x4547bb[_0x2f0c('0x64')][_0x2f0c('0x64')]===''){throw new db[(_0x2f0c('0x7c'))][(_0x2f0c('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2f0c('0x84')](_0x4547bb[_0x2f0c('0x64')]['to'])){}_0x37d41d=_0x4547bb[_0x2f0c('0x64')]['to'];return db['OpenchannelAccount'][_0x2f0c('0x6f')]({'where':{'id':_0x4547bb[_0x2f0c('0x6b')]['id']}})[_0x2f0c('0x25')](handleEntityNotFound(_0x41e150,null))[_0x2f0c('0x25')](function(_0x2e3ce4){if(_0x2e3ce4){return db[_0x2f0c('0x44')][_0x2f0c('0x62')]({'where':{'id':_0x2e3ce4['id']},'include':[{'model':db[_0x2f0c('0x8b')],'as':_0x2f0c('0x8c'),'include':[{'model':db[_0x2f0c('0x7b')],'as':_0x2f0c('0x96'),'where':{[_0x2e3ce4[_0x2f0c('0x87')]]:_0x37d41d},'limit':0x1,'order':[[_0x2f0c('0x7f'),'DESC']]}]}]})[_0x2f0c('0x25')](handleEntityNotFound(_0x41e150,null))['then'](function(_0x5c1b0c){if(_0x5c1b0c&&_0x5c1b0c[_0x2f0c('0x8c')]){_0x4e0229=_0x5c1b0c[_0x2f0c('0x3c')]({'plain':!![]});if(_0x4e0229[_0x2f0c('0x8c')]&&_0x4e0229[_0x2f0c('0x8c')][_0x2f0c('0x96')][_0x2f0c('0x5f')]){return _0x4e0229[_0x2f0c('0x8c')][_0x2f0c('0x96')][0x0];}return db[_0x2f0c('0x7b')][_0x2f0c('0x63')](_[_0x2f0c('0x1d')](_0x4547bb[_0x2f0c('0x64')],{'firstName':_0x37d41d,[_0x5c1b0c['mapKey']]:_0x37d41d,'phone':_0x37d41d,'ListId':_0x4e0229[_0x2f0c('0x83')]}));}})[_0x2f0c('0x25')](handleEntityNotFound(_0x41e150,null))['then'](function(_0x4e3988){if(_0x4e3988){_0x3eef81=_0x4e3988;return db[_0x2f0c('0x9b')][_0x2f0c('0x62')]({'where':{'ContactId':_0x3eef81['id'],'closed':![],'OpenchannelAccountId':_0x4e0229['id']}})['then'](function(_0x4f9657){if(_0x4f9657){return[_0x4f9657,![]];}return db[_0x2f0c('0x9b')]['create']({'UserId':_0x4547bb[_0x2f0c('0x65')]['id'],'ContactId':_0x3eef81['id'],'OpenchannelAccountId':_0x4e0229['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x2f0c('0x56')](_0x4547bb['body'],{'read':![],'body':_0x4547bb[_0x2f0c('0x64')][_0x2f0c('0x64')],'OpenchannelAccountId':_0x4e0229['id'],'UserId':_0x4547bb['user']['id'],'ContactId':_0x3eef81['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x2f0c('0xc9')}]})[_0x2f0c('0x25')](function(_0x19ab23){return[_0x19ab23,!![]];});});}})[_0x2f0c('0x9e')](function(_0x102c0d,_0x378723){if(_0x378723){return _0x102c0d;}return db[_0x2f0c('0xa7')][_0x2f0c('0x63')](_['merge'](_0x4547bb[_0x2f0c('0x64')],{'read':![],'body':_0x4547bb[_0x2f0c('0x64')][_0x2f0c('0x64')],'OpenchannelAccountId':_0x4e0229['id'],'OpenchannelInteractionId':_0x102c0d['id'],'UserId':_0x4547bb[_0x2f0c('0x65')]['id'],'ContactId':_0x3eef81['id']}))[_0x2f0c('0x25')](function(_0x3e8d32){_0x102c0d[_0x2f0c('0xca')]['Messages']=[];_0x102c0d['dataValues'][_0x2f0c('0xc9')][_0x2f0c('0xa3')](_0x3e8d32[_0x2f0c('0xca')]);return _0x102c0d;});});}})[_0x2f0c('0x25')](respondWithResult(_0x41e150,null))[_0x2f0c('0x5c')](handleError(_0x41e150,null));};
\ No newline at end of file