Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / cmContact / cmContact.controller.js
index 5e0f7de..a5fe8b2 100644 (file)
@@ -1 +1 @@
-const a151_0x3d2b=['TagIds','c.deletedAt','startsWith','cf_','catch','omit','squel','order','DESC','findOne','all','toParam','keys','createReadStream','isArray','destroy','split','filters','name','get','child\x20stdout:\x0a','stdin','uc.UserId\x20=\x20?','MailInteraction','getFullTextValue','id\x20=\x20?','\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20with\x20parameters\x20=\x20','select','query','info','c.lastName\x20LIKE\x20?','pick','data','t.id\x20=\x20ct.TagId','sqlOperator','fields','child_process','offset','getJscriptySessions','datetime','SELECT','push','ct.CmContactId\x20=\x20c.id','parseSearch','start\x20child\x20process\x20correctly!','[CmContact][merge][destroy][CmHopper],\x20%s','and','keyBy','Calling\x20','concat','format','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','isEmail','describe','send','OpenchannelMessage','Tags','map','filter','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','\x20process:\x20error\x20','error','MailMessage','../../config/environment','undefined','show','then','set','c.email','having','binding','meta','../../components/parsers/qs','DATE','pid','status','ChatOfflineMessage','table','User','c.email\x20LIKE\x20?','getHopperFinals','CmHopperHistory','CmCustomField','CmHopper','includeAll','params','like','child\x20stderr:\x0a','where','findOrCreate','field','left_join','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','\x20on\x20file\x20','c.fax\x20LIKE\x20?','c.id','parse','sort','isNumeric','columnName','OpenchannelQueueReport','expr','Contact','cf_%d','CmContact','getHoppers','findAll','toString','model','Content-Range','intersection','[CmContact][merge][destroy][CmHopperBlack],\x20%s','type','Missing\x20stdin\x20and\x20stdout\x20on\x20child\x20process','fieldType','options','Tag','[CmContact][merge]\x20to\x20%s\x20from\x20%s','update','OpenchannelInteraction','./cmContact.socket','from','GROUP_CONCAT(DISTINCT\x20t.id)','ChatQueueReport','SmsQueueReport','getLists','files/tmp','forEach','agent','mergeWith','pipe','isEmpty','t.id\x20IN\x20?','ids','include','tags','register','No\x20phone\x20column\x20specified','dateOfBirth','rows','c.fax','union','conditions','../../components/parsers/advancedSearch','\x20=\x20?','api','json','No\x20ListId\x20specified','isNil','count','file','ListId','firstName','rawAttributes','trimStart','tools_tags','SmsMessage','phone','stringify','length','error\x20child\x20process','limit','ChatInteraction','socket_timestamp','body','value','setFields','replace','ReportAgentPreview','util','CmHopperBlack','sequelize','stderr','group','start','getTags','c.ListId\x20IS\x20NULL','end','message','path','import','join','c.firstName\x20LIKE\x20?','Failed\x20to\x20start\x20','CmHopperFinal','castTo','c.ListId','c.lastName','create','search','buildExpression','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','c.phone\x20LIKE\x20?','values','attributes','\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20and\x20agents\x20=\x20','setTags','alias','papaparse','ChatMessage','text','c.mobile','c.mobile\x20LIKE\x20?','VoiceCallReport','No\x20firstName\x20column\x20specified','JscriptySessionReport','displayName','bulkCreate','ContactId','uc.CmContactId\x20=\x20c.id','cm_contacts','index','../../mysqldb','sendStatus','duplicates','tag','nolimit','c.phone','merge','getHopperHistories'];(function(_0x49211b,_0x27176e){const _0x3d2be8=function(_0x1c6403){while(--_0x1c6403){_0x49211b['push'](_0x49211b['shift']());}};_0x3d2be8(++_0x27176e);}(a151_0x3d2b,0x1e5));const a151_0x1c64=function(_0x49211b,_0x27176e){_0x49211b=_0x49211b-0x16e;let _0x3d2be8=a151_0x3d2b[_0x49211b];return _0x3d2be8;};const a151_0x4b61b8=a151_0x1c64;'use strict';const util=require(a151_0x4b61b8(0x1ed)),path=require(a151_0x4b61b8(0x1f7)),fs=require('fs'),_=require('lodash'),squel=require(a151_0x4b61b8(0x226)),Papa=require(a151_0x4b61b8(0x20a)),{getSocket}=require('../../rediscache'),socket=getSocket(),qs=require(a151_0x4b61b8(0x18c)),as=require(a151_0x4b61b8(0x1d3)),logger=require('../../config/logger')(a151_0x4b61b8(0x1d5)),{db}=require(a151_0x4b61b8(0x218)),{Op,QueryTypes}=require(a151_0x4b61b8(0x1ef)),{fork}=require(a151_0x4b61b8(0x244)),config=require(a151_0x4b61b8(0x183));require(a151_0x4b61b8(0x1bc))[a151_0x4b61b8(0x1cc)](socket);const CSV2_SCRIPT=path['join'](__dirname,'../../components/import/cm/csv2.js');function respondWithResult(_0x8c5149,_0x3427bc){return _0x3427bc=_0x3427bc||0xc8,function(_0xce9156){const _0x4e5de6=a151_0x1c64;if(_0xce9156)return _0x8c5149[_0x4e5de6(0x18f)](_0x3427bc)[_0x4e5de6(0x1d6)](_0xce9156);};}function respondWithFilteredResult(_0x542f12,_0x1d9bb4){return function(_0x5dc2ad){const _0x10f76b=a151_0x1c64;if(_0x5dc2ad){const _0x966ecb=_0x5dc2ad[_0x10f76b(0x1d9)],_0xa0c744=_0x1d9bb4[_0x10f76b(0x245)];let _0x4c42d8=_0x1d9bb4[_0x10f76b(0x245)]+_0x1d9bb4[_0x10f76b(0x1e5)],_0x4f56e7;return _0x4c42d8>=_0x966ecb?(_0x4c42d8=_0x966ecb,_0x4f56e7=0xc8):_0x4f56e7=0xce,_0x542f12['status'](_0x4f56e7),_0x542f12[_0x10f76b(0x187)](_0x10f76b(0x1b1),_0xa0c744+'-'+_0x4c42d8+'/'+_0x966ecb)[_0x10f76b(0x1d6)](_0x5dc2ad);}return null;};}function saveUpdates(_0x539d8c){return function(_0x49a2c0){const _0x587ffc=a151_0x1c64;if(_0x49a2c0)return _0x49a2c0['update'](_0x539d8c)[_0x587ffc(0x186)](function(_0x2a9929){return _0x2a9929;});return null;};}function removeEntity(_0x2e301f){return function(_0x1d6897){const _0x293437=a151_0x1c64;if(_0x1d6897)return _0x1d6897[_0x293437(0x22f)]()['then'](function(){const _0x1b467e=_0x293437;_0x2e301f[_0x1b467e(0x18f)](0xcc)[_0x1b467e(0x1f5)]();});};}function handleEntityNotFound(_0x4f4ea9){return function(_0x57d0c5){const _0x5c150b=a151_0x1c64;return!_0x57d0c5&&_0x4f4ea9[_0x5c150b(0x219)](0x194),_0x57d0c5;};}function handleError(_0x2d4c39,_0x481e2f){return _0x481e2f=_0x481e2f||0x1f4,function(_0x23be71){const _0x310fa8=a151_0x1c64;logger[_0x310fa8(0x181)](_0x23be71['stack']),_0x23be71[_0x310fa8(0x232)]&&delete _0x23be71[_0x310fa8(0x232)],_0x2d4c39[_0x310fa8(0x18f)](_0x481e2f)[_0x310fa8(0x17a)](_0x23be71);};}exports[a151_0x4b61b8(0x217)]=function(_0x1f16b3,_0x192a9c){const _0x51facd=a151_0x4b61b8,_0x223369={},_0x2cd580={},_0x7d5ee7={'count':0x0,'rows':[]};return db[_0x51facd(0x1ac)]['describe']()[_0x51facd(0x186)](function(_0xdff6d3){const _0x4344d2=_0x51facd,_0x2cd492=[];for(let _0x46d9bd=0x0;_0x46d9bd<Object[_0x4344d2(0x22c)](_0xdff6d3)['length'];_0x46d9bd++){const _0x58a194=Object[_0x4344d2(0x22c)](_0xdff6d3)[_0x46d9bd];_[_0x4344d2(0x222)](_0x58a194,'cf_')&&_0x2cd492[_0x4344d2(0x249)](db[_0x4344d2(0x196)][_0x4344d2(0x229)]({'where':{'id':_[_0x4344d2(0x1de)](_0x58a194,_0x4344d2(0x223))},'raw':!![]}));}return Promise[_0x4344d2(0x22a)](_0x2cd492)[_0x4344d2(0x186)](function(_0x546472){const _0x54b5d5=_0x4344d2;for(let _0x3849e0=0x0;_0x3849e0<_0x546472[_0x54b5d5(0x1e3)];_0x3849e0++){if(_0x546472[_0x3849e0]){const _0x3dff72=_0x54b5d5(0x223)+_0x546472[_0x3849e0]['id'],_0x4e7749=_0xdff6d3[_0x3dff72];_0x4e7749[_0x54b5d5(0x1b6)]=_0x546472[_0x3849e0]['type'];}}return _0xdff6d3;});})[_0x51facd(0x186)](function(_0x4d543d){const _0x51a4a5=_0x51facd;_0x2cd580[_0x51a4a5(0x1b0)]=_[_0x51a4a5(0x22c)](_0x4d543d),_0x2cd580['query']=_[_0x51a4a5(0x22c)](_0x1f16b3['query']),_0x2cd580[_0x51a4a5(0x231)]=_[_0x51a4a5(0x1b2)](_0x2cd580[_0x51a4a5(0x1b0)],_0x2cd580[_0x51a4a5(0x23c)]),_0x223369['attributes']=_['intersection'](_0x2cd580[_0x51a4a5(0x1b0)],qs[_0x51a4a5(0x243)](_0x1f16b3['query']['fields'])),_0x223369[_0x51a4a5(0x206)]=_0x223369['attributes'][_0x51a4a5(0x1e3)]?_0x223369['attributes']:_0x2cd580[_0x51a4a5(0x1b0)];typeof _0x1f16b3[_0x51a4a5(0x23c)][_0x51a4a5(0x21c)]==='undefined'&&(_0x223369[_0x51a4a5(0x1e5)]=qs['limit'](_0x1f16b3[_0x51a4a5(0x23c)][_0x51a4a5(0x1e5)]),_0x223369[_0x51a4a5(0x245)]=qs[_0x51a4a5(0x245)](_0x1f16b3[_0x51a4a5(0x23c)]['offset']));_0x223369['order']=qs[_0x51a4a5(0x1a5)](_0x1f16b3[_0x51a4a5(0x23c)]['sort']),_0x223369[_0x51a4a5(0x19c)]=qs['filters'](_[_0x51a4a5(0x23f)](_0x1f16b3[_0x51a4a5(0x23c)],_0x2cd580['filters']),_0x4d543d);let _0x290065=[];const _0x2a2d50=squel[_0x51a4a5(0x23b)]()[_0x51a4a5(0x19e)]('id')[_0x51a4a5(0x19e)](_0x51a4a5(0x232))[_0x51a4a5(0x19e)]('color')['from'](_0x51a4a5(0x1df)),_0x192983=squel[_0x51a4a5(0x23b)]()[_0x51a4a5(0x1bd)]('cm_contacts','c')[_0x51a4a5(0x19f)](_0x51a4a5(0x177),'uc',_0x51a4a5(0x215))[_0x51a4a5(0x19f)]('cm_contact_has_tags','ct',_0x51a4a5(0x24a))[_0x51a4a5(0x19f)](_0x51a4a5(0x1df),'t',_0x51a4a5(0x241))['where'](_0x51a4a5(0x176)),_0x59776e=squel['expr']();let _0x3cd37e=[];const _0x1382dd=squel[_0x51a4a5(0x1a9)]();let _0x21135d;if(_0x1f16b3[_0x51a4a5(0x23c)][_0x51a4a5(0x201)]){_0x21135d=as[_0x51a4a5(0x16e)](_0x1f16b3[_0x51a4a5(0x23c)]['search']);const _0x4b848f=_0x21135d[_0x51a4a5(0x242)];for(let _0xe98712=0x0;_0xe98712<_0x21135d[_0x51a4a5(0x1d2)][_0x51a4a5(0x1e3)];_0xe98712++){const _0x35e97f=_0x21135d[_0x51a4a5(0x1d2)][_0xe98712],_0x343074='c';let _0xf880bf=_(_0x4d543d)['keys']()['find'](function(_0x3c308e){const _0xb26e55=_0x51a4a5;return _0x3c308e===_0x35e97f[_0xb26e55(0x19e)];});if(_0xf880bf)_0xf880bf=_0x4d543d[_0x35e97f['field']];if(!_0xf880bf){if(_0x35e97f[_0x51a4a5(0x19e)]===_0x51a4a5(0x1b8)){const _0x45d05a=_0x35e97f['value'][_0x51a4a5(0x230)](',')[_0x51a4a5(0x17d)](function(_0x357e93){return Number(_0x357e93);});_0x45d05a[_0x51a4a5(0x1c3)](function(_0x3e47c0){const _0x547ad7=_0x51a4a5;_0x1382dd['or'](_0x547ad7(0x17f),'%,'+_0x3e47c0+',%');}),_0x3cd37e=_[_0x51a4a5(0x1d1)](_0x3cd37e,_0x45d05a);}else _0x35e97f[_0x51a4a5(0x19e)]===_0x51a4a5(0x192)&&_0x59776e[_0x51a4a5(0x171)](_0x51a4a5(0x236),_0x35e97f[_0x51a4a5(0x1e9)]);}else{if(_0x35e97f[_0x51a4a5(0x19e)]===_0x51a4a5(0x1ce)||_0xf880bf[_0x51a4a5(0x1b6)]===_0x51a4a5(0x247))_0x35e97f[_0x51a4a5(0x1fd)]=_0x51a4a5(0x18d);const _0x31d127=as[_0x51a4a5(0x202)](_0x343074,_0xf880bf[_0x51a4a5(0x1b4)],_0x35e97f);_0x59776e[_0x4b848f](_0x31d127[_0x51a4a5(0x20c)],_0x31d127[_0x51a4a5(0x1e9)][_0x51a4a5(0x1f2)],_0x31d127[_0x51a4a5(0x1e9)][_0x51a4a5(0x1f5)]);}}}else{const _0x15e2b5=_(Object[_0x51a4a5(0x22c)](_0x1f16b3['query']))[_0x51a4a5(0x17d)](function(_0x4ae27c){const _0x3a8e4a=_0x51a4a5;return typeof _0x4d543d[_0x4ae27c]===_0x3a8e4a(0x184)?undefined:_0x4ae27c;})[_0x51a4a5(0x17e)](function(_0x3f682a){const _0x10dec7=_0x51a4a5;return!_[_0x10dec7(0x1d8)](_0x3f682a);})[_0x51a4a5(0x1e9)]();if(_0x1f16b3['query'][_0x51a4a5(0x1aa)])_0x15e2b5[_0x51a4a5(0x249)](_0x51a4a5(0x1aa));!_[_0x51a4a5(0x1c7)](_0x15e2b5)&&_0x15e2b5[_0x51a4a5(0x1c3)](function(_0x7b9e13){const _0x2c60d0=_0x51a4a5;if(_0x7b9e13==='ListId')_0x192983[_0x2c60d0(0x19c)]('c.ListId\x20IN\x20?',[][_0x2c60d0(0x174)](_0x1f16b3[_0x2c60d0(0x23c)][_0x7b9e13]));else{if(_0x7b9e13===_0x2c60d0(0x1aa)){const _0x1e38a7='%'+_0x1f16b3[_0x2c60d0(0x23c)][_0x7b9e13]+'%';_0x192983['where'](_0x2c60d0(0x203),_0x1e38a7);}else _0x192983[_0x2c60d0(0x19c)]('c.'+_0x7b9e13+_0x2c60d0(0x1d4),_0x1f16b3[_0x2c60d0(0x23c)][_0x7b9e13]);}});_0x1f16b3['query'][_0x51a4a5(0x21b)]&&(_0x3cd37e=_[_0x51a4a5(0x22e)](_0x1f16b3['query']['tag'])?_0x1f16b3[_0x51a4a5(0x23c)]['tag']:new Array(_0x1f16b3[_0x51a4a5(0x23c)][_0x51a4a5(0x21b)]),_0x3cd37e['forEach'](function(_0x2bb5f7){const _0x2dda8f=_0x51a4a5;_0x1382dd['or'](_0x2dda8f(0x17f),'%,'+_0x2bb5f7+',%');}));if(_0x1f16b3[_0x51a4a5(0x23c)][_0x51a4a5(0x17e)]){const _0x52b703=_0x1f16b3[_0x51a4a5(0x23c)]['filter'][_0x51a4a5(0x1eb)]('\x5c','\x5c\x5c')[_0x51a4a5(0x1eb)](/'/g,'\x27\x27');if(_0x52b703[_0x51a4a5(0x230)]('\x20')['length']>0x1)_0x59776e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x51a4a5(0x238)](_0x52b703),null);else{if(qs[_0x51a4a5(0x1a6)](_0x52b703))_0x59776e['or']('c.id\x20LIKE\x20?',_0x52b703+'%'),_0x59776e['or'](_0x51a4a5(0x204),_0x52b703+'%'),_0x59776e['or'](_0x51a4a5(0x20e),_0x52b703+'%'),_0x59776e['or'](_0x51a4a5(0x1a2),_0x52b703+'%');else qs[_0x51a4a5(0x178)](_0x52b703)?_0x59776e['or'](_0x51a4a5(0x193),_0x52b703+'%'):(_0x59776e['or'](_0x51a4a5(0x1fa),'%'+_0x52b703+'%'),_0x59776e['or'](_0x51a4a5(0x23e),'%'+_0x52b703+'%'),_0x59776e['or'](_0x51a4a5(0x193),'%'+_0x52b703+'%'));}}}_0x192983[_0x51a4a5(0x19c)](_0x59776e),_0x192983[_0x51a4a5(0x1f1)](_0x51a4a5(0x1a3));let _0x3bb8dd={'type':QueryTypes[_0x51a4a5(0x248)],'raw':!![]};const _0x122b08=_0x192983['clone']()[_0x51a4a5(0x19e)](_0x51a4a5(0x1a3));_0x223369[_0x51a4a5(0x227)]&&_0x223369['order']['forEach'](function(_0x4b142f){const _0x2bbd49=_0x51a4a5;_0x192983[_0x2bbd49(0x227)]('c.'+_0x4b142f[0x0],_0x4b142f[0x1]===_0x2bbd49(0x228)?![]:!![]);}),!_[_0x51a4a5(0x1c7)](_0x3cd37e)&&(_0x192983[_0x51a4a5(0x189)](_0x1382dd),_0x122b08[_0x51a4a5(0x19c)](_0x51a4a5(0x1c8),_0x3cd37e)),Promise['resolve']()[_0x51a4a5(0x186)](function(){const _0x310c56=_0x51a4a5;if(_0x21135d&&!_['some'](_0x21135d['conditions'],['field',_0x310c56(0x192)]))return _0x1f16b3['user'][_0x310c56(0x1c1)]({'attributes':['id'],'raw':!![]})['then'](function(_0x292647){const _0x4a3c5d=_0x310c56;_[_0x4a3c5d(0x1c7)](_0x292647)?(_0x122b08[_0x4a3c5d(0x19c)](_0x4a3c5d(0x1f4)),_0x192983['where'](_0x4a3c5d(0x1f4))):(_0x122b08[_0x4a3c5d(0x19c)]('c.ListId\x20IN\x20?',_[_0x4a3c5d(0x17d)](_0x292647,'id')),_0x192983[_0x4a3c5d(0x19c)]('c.ListId\x20IN\x20?',_['map'](_0x292647,'id')));});else return;})[_0x51a4a5(0x186)](function(){const _0x2d7618=_0x51a4a5;db[_0x2d7618(0x1ef)][_0x2d7618(0x23c)](_0x122b08[_0x2d7618(0x1af)](),_0x3bb8dd)['then'](function(_0x3e69e2){const _0x194eb8=_0x2d7618;_0x7d5ee7[_0x194eb8(0x1d9)]=_0x3e69e2['length'];if(_0x7d5ee7['count']===0x0)return[];return db[_0x194eb8(0x1ef)][_0x194eb8(0x23c)](_0x2a2d50[_0x194eb8(0x1af)](),_0x3bb8dd);})[_0x2d7618(0x186)](function(_0x3b24f1){const _0x127bd1=_0x2d7618;_0x290065=_[_0x127bd1(0x172)](_0x3b24f1,'id'),_0x3bb8dd=_[_0x127bd1(0x21e)](_0x3bb8dd,{'model':db[_0x127bd1(0x1ac)],'mapToModel':!![],'raw':!![],'nest':!![]});_0x1f16b3[_0x127bd1(0x23c)][_0x127bd1(0x243)]?_0x223369[_0x127bd1(0x206)][_0x127bd1(0x1c3)](function(_0x20d514){const _0x2d65a3=_0x127bd1;_0x192983[_0x2d65a3(0x19e)]('c.'+_0x20d514);}):(_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x1a3)),_0x192983[_0x127bd1(0x19e)]('c.firstName'),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x1ff)),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x21d)),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x20d)),_0x192983['field'](_0x127bd1(0x1d0)),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x188)),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x1fe)),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x221)),_0x192983[_0x127bd1(0x19e)](_0x127bd1(0x1be),_0x127bd1(0x220)));if(_0x223369['limit'])_0x192983[_0x127bd1(0x1e5)](_0x223369[_0x127bd1(0x1e5)]);if(_0x223369[_0x127bd1(0x245)])_0x192983['offset'](_0x223369[_0x127bd1(0x245)]);return db[_0x127bd1(0x1ef)][_0x127bd1(0x23c)](_0x192983[_0x127bd1(0x1af)](),_0x3bb8dd);})[_0x2d7618(0x186)](function(_0x21711a){const _0x33e290=_0x2d7618;return _0x21711a[_0x33e290(0x1c3)](function(_0x383d37){const _0x29dbb9=_0x33e290;_0x383d37[_0x29dbb9(0x220)]&&(_0x383d37[_0x29dbb9(0x17c)]=[],_0x383d37[_0x29dbb9(0x220)][_0x29dbb9(0x230)](',')['forEach'](function(_0x200952){const _0x3a5e9d=_0x29dbb9;_0x383d37[_0x3a5e9d(0x17c)]['push'](_0x290065[_0x200952]);})),delete _0x383d37[_0x29dbb9(0x220)];}),_0x7d5ee7[_0x33e290(0x1cf)]=_0x21711a,_0x7d5ee7;})[_0x2d7618(0x186)](respondWithFilteredResult(_0x192a9c,_0x223369));});})[_0x51facd(0x224)](handleError(_0x192a9c,null));},exports['destroy']=function(_0xa27e17,_0x541784){const _0x329ce5=a151_0x4b61b8;return db['CmContact'][_0x329ce5(0x229)]({'where':{'id':_0xa27e17[_0x329ce5(0x199)]['id']}})[_0x329ce5(0x186)](handleEntityNotFound(_0x541784,null))['then'](removeEntity(_0x541784,null))[_0x329ce5(0x224)](handleError(_0x541784,null));},exports[a151_0x4b61b8(0x179)]=function(_0x374a42,_0x4373e3){const _0x52beba=a151_0x4b61b8;return db[_0x52beba(0x1ac)]['describe']()[_0x52beba(0x186)](function(_0x4dd42b){const _0x4c539e=_0x52beba;delete _0x4dd42b[_0x4c539e(0x1cb)];for(let _0x2ab743=0x0;_0x2ab743<Object[_0x4c539e(0x22c)](_0x4dd42b)[_0x4c539e(0x1e3)];_0x2ab743++){const _0x250ac0=Object[_0x4c539e(0x22c)](_0x4dd42b)[_0x2ab743];!_[_0x4c539e(0x222)](_0x250ac0,_0x4c539e(0x223))&&(_0x4dd42b[_0x250ac0]['columnName']=_0x250ac0,_0x4dd42b[_0x250ac0]['displayName']=_0x250ac0);}return _0x4dd42b;})['then'](function(_0x2aeaf6){const _0x3f9501=_0x52beba,_0x4117cd=_0x374a42['query']['id']?_0x374a42[_0x3f9501(0x23c)]['id']:null,_0x2bf5c6={'where':{'ListId':_0x4117cd},'raw':!![]};return db[_0x3f9501(0x196)][_0x3f9501(0x1ae)](_0x2bf5c6)[_0x3f9501(0x186)](function(_0x259faf){const _0xb664c3=_0x3f9501;for(let _0x15953a=0x0;_0x15953a<_0x259faf[_0xb664c3(0x1e3)];_0x15953a++){console['log']('2',_0x259faf[_0x15953a]);const _0x2ea22c='cf_'+_0x259faf[_0x15953a]['id'];_0x2aeaf6[_0x2ea22c][_0xb664c3(0x1a7)]=_0x2ea22c,_0x2aeaf6[_0x2ea22c][_0xb664c3(0x212)]=_0x259faf[_0x15953a][_0xb664c3(0x209)],_0x2aeaf6[_0x2ea22c]['custom']={'type':_0x259faf[_0x15953a]['type'],'values':_0x259faf[_0x15953a][_0xb664c3(0x205)]};}return Object[_0xb664c3(0x22c)](_0x2aeaf6)[_0xb664c3(0x1c3)](function(_0x38f843){const _0x1d877f=_0xb664c3;typeof _0x2aeaf6[_0x38f843]['columnName']===_0x1d877f(0x184)&&delete _0x2aeaf6[_0x38f843];}),_0x2aeaf6;});})[_0x52beba(0x186)](respondWithResult(_0x4373e3,null))['catch'](handleError(_0x4373e3,null));},exports[a151_0x4b61b8(0x21e)]=function(_0x4b2004,_0x54bef4){const _0x381ad7=a151_0x4b61b8;let _0x5789be,_0x3ca1d2,_0x491ddd;return _0x4b2004[_0x381ad7(0x1e8)]['id']&&delete _0x4b2004['body']['id'],db[_0x381ad7(0x1ac)][_0x381ad7(0x1ae)]({'where':{'id':[_0x4b2004[_0x381ad7(0x1e8)]['to'],_0x4b2004[_0x381ad7(0x1e8)][_0x381ad7(0x1bd)]]}})['then'](function(_0x32e2ae){const _0x53b0d8=_0x381ad7;if(_0x32e2ae){if(_0x32e2ae[_0x53b0d8(0x1e3)]!==0x2)return null;return _0x32e2ae[0x0]=_0x32e2ae[0x0][_0x53b0d8(0x233)]({'plain':!![]}),_0x32e2ae[0x1]=_0x32e2ae[0x1][_0x53b0d8(0x233)]({'plain':!![]}),delete _0x32e2ae[0x0]['id'],delete _0x32e2ae[0x1]['id'],_[_0x53b0d8(0x1c5)](_0x32e2ae[0x0],_0x32e2ae[0x1],function(_0x14a40d,_0x3830ed){const _0xea0b0=_0x53b0d8;if(Array[_0xea0b0(0x22e)](_0x3830ed)&&!_0x3830ed[_0xea0b0(0x1e3)])return _0x14a40d;else{if(!_0x3830ed)return _0x14a40d;}});}})['then'](handleEntityNotFound(_0x54bef4,null))[_0x381ad7(0x186)](function(_0x4ab922){const _0x3e2027=_0x381ad7;if(_0x4ab922)return _0x4ab922['tags']&&_[_0x3e2027(0x22e)](_0x4ab922[_0x3e2027(0x1cb)])&&(_0x4ab922[_0x3e2027(0x1cb)]=_0x4ab922[_0x3e2027(0x1cb)][_0x3e2027(0x1f9)]()),logger['info'](_0x3e2027(0x1b9),_0x4b2004['body']['to'],_0x4b2004[_0x3e2027(0x1e8)]['from']),db[_0x3e2027(0x197)][_0x3e2027(0x22f)]({'where':{'ContactId':[_0x4b2004[_0x3e2027(0x1e8)]['to'],_0x4b2004['body'][_0x3e2027(0x1bd)]]}})[_0x3e2027(0x186)](function(_0x330c99){const _0x46d44b=_0x3e2027;return logger[_0x46d44b(0x23d)](_0x46d44b(0x170),_0x330c99),db[_0x46d44b(0x1ee)][_0x46d44b(0x22f)]({'where':{'ContactId':[_0x4b2004[_0x46d44b(0x1e8)]['to'],_0x4b2004[_0x46d44b(0x1e8)][_0x46d44b(0x1bd)]]}})[_0x46d44b(0x186)](function(_0x53d38b){const _0x525b5b=_0x46d44b;return logger[_0x525b5b(0x23d)](_0x525b5b(0x1b3),_0x53d38b),db[_0x525b5b(0x1ac)][_0x525b5b(0x200)](_0x4ab922);});});})[_0x381ad7(0x186)](function(_0x1bf9f7){const _0x310597=_0x381ad7;if(_0x1bf9f7)return _0x5789be=_0x1bf9f7,_0x3ca1d2={'ContactId':_0x5789be['id']},_0x491ddd={'where':{'ContactId':[_0x4b2004[_0x310597(0x1e8)]['to'],_0x4b2004[_0x310597(0x1e8)][_0x310597(0x1bd)]]}},db[_0x310597(0x1e6)][_0x310597(0x1ba)](_0x3ca1d2,_0x491ddd);})['then'](function(){const _0x2d1e70=_0x381ad7;if(_0x5789be)return db[_0x2d1e70(0x20b)]['update'](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x53d866=_0x381ad7;if(_0x5789be)return db[_0x53d866(0x190)][_0x53d866(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x15f347=_0x381ad7;if(_0x5789be)return db['MailInteraction'][_0x15f347(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x2de0c7=_0x381ad7;if(_0x5789be)return db[_0x2de0c7(0x182)]['update'](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x247a3=_0x381ad7;if(_0x5789be)return db[_0x247a3(0x237)][_0x247a3(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x189077=_0x381ad7;if(_0x5789be)return db[_0x189077(0x182)][_0x189077(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){if(_0x5789be)return db['SmsInteraction']['update'](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x3168c5=_0x381ad7;if(_0x5789be)return db[_0x3168c5(0x1e0)][_0x3168c5(0x1ba)](_0x3ca1d2,_0x491ddd);})['then'](function(){const _0x4731b7=_0x381ad7;if(_0x5789be)return db['FaxInteraction'][_0x4731b7(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x56663a=_0x381ad7;if(_0x5789be)return db['FaxMessage'][_0x56663a(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x2f0bf0=_0x381ad7;if(_0x5789be)return db[_0x2f0bf0(0x1bb)][_0x2f0bf0(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x20e60c=_0x381ad7;if(_0x5789be)return db[_0x20e60c(0x17b)][_0x20e60c(0x1ba)](_0x3ca1d2,_0x491ddd);})['then'](function(){const _0x50f496=_0x381ad7;if(_0x5789be)return db[_0x50f496(0x1fc)]['update'](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){if(_0x5789be)return db['CmHopperHistory']['update'](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x2d1af6=_0x381ad7;if(_0x5789be)return db[_0x2d1af6(0x1ec)][_0x2d1af6(0x1ba)](_0x3ca1d2,_0x491ddd);})['then'](function(){const _0x4956c2=_0x381ad7;if(_0x5789be)return db[_0x4956c2(0x20f)][_0x4956c2(0x1ba)](_0x3ca1d2,_0x491ddd);})['then'](function(){const _0x5acd83=_0x381ad7;if(_0x5789be)return db[_0x5acd83(0x1bf)][_0x5acd83(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x2bccae=_0x381ad7;if(_0x5789be)return db['FaxQueueReport'][_0x2bccae(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x3b1703=_0x381ad7;if(_0x5789be)return db['MailQueueReport'][_0x3b1703(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x50c64d=_0x381ad7;if(_0x5789be)return db[_0x50c64d(0x1a8)][_0x50c64d(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x380047=_0x381ad7;if(_0x5789be)return db[_0x380047(0x1c0)][_0x380047(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0x2439a4=_0x381ad7;if(_0x5789be)return db[_0x2439a4(0x211)][_0x2439a4(0x1ba)](_0x3ca1d2,_0x491ddd);})[_0x381ad7(0x186)](function(){const _0xf9de74=_0x381ad7;if(_0x5789be)return db['CmContact'][_0xf9de74(0x22f)]({'where':{'id':[_0x4b2004['body']['to'],_0x4b2004[_0xf9de74(0x1e8)][_0xf9de74(0x1bd)]]}});})[_0x381ad7(0x186)](function(){if(_0x5789be)return _0x5789be;})[_0x381ad7(0x186)](respondWithResult(_0x54bef4,null))[_0x381ad7(0x224)](handleError(_0x54bef4,null));},exports['create']=function(_0x5d21c0,_0x25c784){const _0x2aa577=a151_0x4b61b8;return db[_0x2aa577(0x1ac)]['describe']()[_0x2aa577(0x186)](function(_0x5a0321){const _0x51afc1=_0x2aa577;return _0x5d21c0[_0x51afc1(0x1e8)][_0x51afc1(0x1cb)]&&_[_0x51afc1(0x22e)](_0x5d21c0['body'][_0x51afc1(0x1cb)])?_0x5d21c0[_0x51afc1(0x1e8)][_0x51afc1(0x1cb)][_0x51afc1(0x1e3)]?_0x5d21c0[_0x51afc1(0x1e8)][_0x51afc1(0x1cb)]=_0x5d21c0[_0x51afc1(0x1e8)][_0x51afc1(0x1cb)]['join'](';')+';':_0x5d21c0[_0x51afc1(0x1e8)][_0x51afc1(0x1cb)]=null:_0x5d21c0[_0x51afc1(0x1e8)][_0x51afc1(0x1cb)]=null,db[_0x51afc1(0x1ac)][_0x51afc1(0x200)](_0x5d21c0[_0x51afc1(0x1e8)],{'fields':_[_0x51afc1(0x22c)](_0x5a0321),'raw':!![]});})[_0x2aa577(0x186)](respondWithResult(_0x25c784,0xc9))[_0x2aa577(0x224)](handleError(_0x25c784,null));},exports[a151_0x4b61b8(0x213)]=function(_0x58cc5a,_0x5e7207){const _0x4b43ce=a151_0x4b61b8;let _0x2583ba=0x0,_0x3411b8=0x0,_0x2aa871=0x0;return db['CmContact']['describe']()[_0x4b43ce(0x186)](function(_0x29663a){const _0x574d53=_0x4b43ce;return Promise[_0x574d53(0x22a)](_0x58cc5a[_0x574d53(0x1e8)][_0x574d53(0x17d)](_0x8710ba=>{const _0x4b6779=_0x574d53,_0x5d5214={'where':{[Op['or']]:[]},'defaults':_0x8710ba,'fields':_[_0x4b6779(0x22c)](_0x29663a),'raw':!![]};if(_0x8710ba['duplicates']){for(let _0x12536a=0x0;_0x12536a<_0x8710ba[_0x4b6779(0x21a)][_0x4b6779(0x1e3)];_0x12536a++){const _0x49cf2b={};_0x49cf2b[_0x8710ba[_0x4b6779(0x21a)][_0x12536a]]=_0x8710ba[_0x8710ba[_0x4b6779(0x21a)][_0x12536a]],_0x5d5214[_0x4b6779(0x19c)][Op['or']][_0x4b6779(0x249)](_0x49cf2b);}_0x5d5214['where']['ListId']=_0x8710ba[_0x4b6779(0x1db)];}return db[_0x4b6779(0x1ac)][_0x4b6779(0x19d)](_0x5d5214)[_0x4b6779(0x186)](function([,_0x38f2c2]){_0x38f2c2?_0x2583ba++:_0x2aa871++;})['catch'](function(_0x58c26c){console['error'](_0x58c26c),_0x3411b8++;});}));})['then'](function(_0x474b59){if(_0x474b59)return{'success':_0x2583ba,'failure':_0x3411b8,'duplicates':_0x2aa871};})[_0x4b43ce(0x186)](respondWithResult(_0x5e7207,0xc9))['catch'](handleError(_0x5e7207,null));},exports[a151_0x4b61b8(0x185)]=function(_0x5c64ad,_0x1a9424){const _0x48ca30=a151_0x4b61b8;let _0x2fdfab;return db[_0x48ca30(0x1ac)][_0x48ca30(0x179)]()[_0x48ca30(0x186)](function(_0x59b3c6){const _0x5039c1=_0x48ca30;return db['CmContact'][_0x5039c1(0x229)]({'where':{'id':_0x5c64ad[_0x5039c1(0x199)]['id']},'include':[{'model':db[_0x5039c1(0x1b8)],'as':_0x5039c1(0x17c),'attributes':['id','name','color'],'required':_0x5c64ad[_0x5039c1(0x23c)][_0x5039c1(0x21b)]?!![]:![]}],'attributes':_[_0x5039c1(0x22c)](_0x59b3c6)});})[_0x48ca30(0x186)](function(_0x3a2cf3){const _0x59eaef=_0x48ca30;_0x2fdfab=_0x3a2cf3['get']({'plain':!![]});const _0x4e8402={'where':{[Op[_0x59eaef(0x171)]]:[{'ListId':{[Op['ne']]:null}}]}};return _0x3a2cf3&&_0x3a2cf3['ListId']&&(_0x3a2cf3[_0x59eaef(0x1db)]&&_0x4e8402[_0x59eaef(0x19c)][Op['and']][_0x59eaef(0x249)]({'ListId':{[Op['ne']]:_0x3a2cf3[_0x59eaef(0x1db)]}})),db[_0x59eaef(0x196)][_0x59eaef(0x1ae)](_0x4e8402);})['then'](function(_0x384031){const _0xc343ce=_0x48ca30;return _[_0xc343ce(0x225)](_0x2fdfab,_['map'](_0x384031,function(_0x36f442){const _0x40f481=_0xc343ce;return util[_0x40f481(0x175)](_0x40f481(0x1ab),_0x36f442['id']);}));})['then'](handleEntityNotFound(_0x1a9424,null))[_0x48ca30(0x186)](respondWithResult(_0x1a9424,null))[_0x48ca30(0x224)](handleError(_0x1a9424,null));},exports[a151_0x4b61b8(0x1ba)]=function(_0x2f2a38,_0x575f57){const _0xa4c925=a151_0x4b61b8;let _0x1097a9;return _0x2f2a38[_0xa4c925(0x1e8)]['id']&&delete _0x2f2a38[_0xa4c925(0x1e8)]['id'],db[_0xa4c925(0x1ac)][_0xa4c925(0x229)]({'where':{'id':_0x2f2a38[_0xa4c925(0x199)]['id']}})[_0xa4c925(0x186)](handleEntityNotFound(_0x575f57,null))[_0xa4c925(0x186)](saveUpdates(_0x2f2a38[_0xa4c925(0x1e8)],null))[_0xa4c925(0x186)](function(_0x5363c2){const _0x2d56e6=_0xa4c925;_0x1097a9=_0x5363c2;const _0x3eaa17={'where':{[Op[_0x2d56e6(0x171)]]:[{'ListId':{[Op['ne']]:null}}]}};return _0x5363c2&&_0x5363c2[_0x2d56e6(0x1db)]&&(_0x5363c2['ListId']&&_0x3eaa17[_0x2d56e6(0x19c)][Op[_0x2d56e6(0x171)]][_0x2d56e6(0x249)]({'ListId':{[Op['ne']]:_0x5363c2[_0x2d56e6(0x1db)]}})),db[_0x2d56e6(0x196)]['findAll'](_0x3eaa17);})[_0xa4c925(0x186)](function(_0x560caa){const _0x14a007=_0xa4c925;if(_0x560caa)return _[_0x14a007(0x225)](_['pickBy'](_0x2f2a38[_0x14a007(0x1e8)],function(_0x1a7a7c,_0xfcc0ee){const _0xa5e676=_0x14a007;return _[_0xa5e676(0x222)](_0xfcc0ee,_0xa5e676(0x223));}),_[_0x14a007(0x17d)](_0x560caa,function(_0xdc9600){const _0x4a5a8d=_0x14a007;return util[_0x4a5a8d(0x175)](_0x4a5a8d(0x1ab),_0xdc9600['id']);}));})[_0xa4c925(0x186)](function(_0x4f54e4){const _0x5bc44a=_0xa4c925;if(_0x4f54e4&&!_[_0x5bc44a(0x1c7)](_0x4f54e4)){const _0x2ef11e=squel[_0x5bc44a(0x1ba)]()[_0x5bc44a(0x191)](_0x5bc44a(0x216))[_0x5bc44a(0x1ea)](_0x4f54e4)['where'](_0x5bc44a(0x239),_0x2f2a38[_0x5bc44a(0x199)]['id'])[_0x5bc44a(0x22b)]();return db[_0x5bc44a(0x1ef)][_0x5bc44a(0x23c)](_0x2ef11e[_0x5bc44a(0x20c)],{'replacements':_0x2ef11e['values']});}})[_0xa4c925(0x186)](function(){const _0x1a8d31=_0xa4c925;if(_0x2f2a38[_0x1a8d31(0x1e8)][_0x1a8d31(0x1e1)]&&_0x1097a9)return db[_0x1a8d31(0x197)][_0x1a8d31(0x1ba)]({'phone':_0x2f2a38[_0x1a8d31(0x1e8)][_0x1a8d31(0x1e1)]},{'where':{'ContactId':_0x1097a9['id']}});})['then'](function(){return _0x1097a9;})[_0xa4c925(0x186)](respondWithResult(_0x575f57,null))[_0xa4c925(0x224)](handleError(_0x575f57,null));},exports[a151_0x4b61b8(0x1f3)]=function(_0x5d262d,_0x50119d){const _0x18bcd9=a151_0x4b61b8;let _0x1a9268={};const _0x58bd2a={};let _0x66235,_0x45bb07;return db['CmContact'][_0x18bcd9(0x229)]({'where':{'id':_0x5d262d[_0x18bcd9(0x199)]['id']}})[_0x18bcd9(0x186)](handleEntityNotFound(_0x50119d,null))['then'](function(_0x5dfbd8){const _0x1d277e=_0x18bcd9;if(_0x5dfbd8)return _0x66235=_0x5dfbd8,_0x58bd2a[_0x1d277e(0x1b0)]=_['keys'](db[_0x1d277e(0x1b8)]['rawAttributes']),_0x58bd2a[_0x1d277e(0x23c)]=_[_0x1d277e(0x22c)](_0x5d262d[_0x1d277e(0x23c)]),_0x58bd2a[_0x1d277e(0x231)]=_[_0x1d277e(0x1b2)](_0x58bd2a['model'],_0x58bd2a[_0x1d277e(0x23c)]),_0x1a9268['attributes']=_[_0x1d277e(0x1b2)](_0x58bd2a['model'],qs[_0x1d277e(0x243)](_0x5d262d[_0x1d277e(0x23c)][_0x1d277e(0x243)])),_0x1a9268[_0x1d277e(0x206)]=_0x1a9268[_0x1d277e(0x206)][_0x1d277e(0x1e3)]?_0x1a9268[_0x1d277e(0x206)]:_0x58bd2a['model'],_0x1a9268[_0x1d277e(0x227)]=qs[_0x1d277e(0x1a5)](_0x5d262d[_0x1d277e(0x23c)][_0x1d277e(0x1a5)]),_0x1a9268[_0x1d277e(0x19c)]=qs['filters'](_['pick'](_0x5d262d[_0x1d277e(0x23c)],_0x58bd2a[_0x1d277e(0x231)])),_0x5d262d['query'][_0x1d277e(0x17e)]&&(_0x1a9268[_0x1d277e(0x19c)]=_[_0x1d277e(0x21e)](_0x1a9268['where'],{[Op['or']]:_[_0x1d277e(0x17d)](_0x1a9268['attributes'],function(_0x30dba2){const _0x2961d5=_0x1d277e,_0x2cd944={};return _0x2cd944[_0x30dba2]={[Op['like']]:'%'+_0x5d262d[_0x2961d5(0x23c)]['filter']+'%'},_0x2cd944;})})),_0x1a9268=_[_0x1d277e(0x21e)]({},_0x1a9268,_0x5d262d[_0x1d277e(0x1b7)]),_0x66235[_0x1d277e(0x1f3)](_0x1a9268);})[_0x18bcd9(0x186)](function(_0x54737b){const _0x9b7f61=_0x18bcd9;if(_0x54737b)return _0x45bb07=_0x54737b['length'],typeof _0x5d262d[_0x9b7f61(0x23c)][_0x9b7f61(0x21c)]===_0x9b7f61(0x184)&&(_0x1a9268['limit']=qs[_0x9b7f61(0x1e5)](_0x5d262d[_0x9b7f61(0x23c)][_0x9b7f61(0x1e5)]),_0x1a9268[_0x9b7f61(0x245)]=qs[_0x9b7f61(0x245)](_0x5d262d[_0x9b7f61(0x23c)]['offset'])),_0x66235[_0x9b7f61(0x1f3)](_0x1a9268);})[_0x18bcd9(0x186)](function(_0x2696a5){if(_0x2696a5)return _0x2696a5?{'count':_0x45bb07,'rows':_0x2696a5}:null;})[_0x18bcd9(0x186)](respondWithResult(_0x50119d,null))[_0x18bcd9(0x224)](handleError(_0x50119d,null));},exports[a151_0x4b61b8(0x208)]=function(_0x47a7b9,_0x36dbdc){const _0x38124f=a151_0x4b61b8;return _0x47a7b9['body']['id']&&delete _0x47a7b9[_0x38124f(0x1e8)]['id'],db['CmContact'][_0x38124f(0x229)]({'where':{'id':_0x47a7b9[_0x38124f(0x199)]['id']}})[_0x38124f(0x186)](handleEntityNotFound(_0x36dbdc,null))[_0x38124f(0x186)](function(_0x547d59){const _0x4be533=_0x38124f;if(_0x547d59)return _0x547d59['setTags'](_0x47a7b9[_0x4be533(0x1e8)][_0x4be533(0x1c9)]||[]);return null;})[_0x38124f(0x186)](respondWithResult(_0x36dbdc,null))['catch'](handleError(_0x36dbdc,null));},exports[a151_0x4b61b8(0x1ad)]=function(_0x324089,_0x185c56){const _0x33dabe=a151_0x4b61b8;let _0x3ab966={'raw':![],'where':{}};const _0x31fc57={},_0xa7b4a1={'count':0x0,'rows':[]};return db[_0x33dabe(0x1ac)][_0x33dabe(0x229)]({'where':{'id':_0x324089['params']['id']}})[_0x33dabe(0x186)](handleEntityNotFound(_0x185c56,null))[_0x33dabe(0x186)](function(_0x4b3c9a){const _0x4d9d07=_0x33dabe;if(_0x4b3c9a)return _0x31fc57['model']=_[_0x4d9d07(0x22c)](db['CmHopper']['rawAttributes']),_0x31fc57[_0x4d9d07(0x23c)]=_[_0x4d9d07(0x22c)](_0x324089[_0x4d9d07(0x23c)]),_0x31fc57[_0x4d9d07(0x231)]=_[_0x4d9d07(0x1b2)](_0x31fc57[_0x4d9d07(0x1b0)],_0x31fc57[_0x4d9d07(0x23c)]),_0x3ab966[_0x4d9d07(0x206)]=_[_0x4d9d07(0x1b2)](_0x31fc57[_0x4d9d07(0x1b0)],qs['fields'](_0x324089[_0x4d9d07(0x23c)][_0x4d9d07(0x243)])),_0x3ab966[_0x4d9d07(0x206)]=_0x3ab966[_0x4d9d07(0x206)]['length']?_0x3ab966[_0x4d9d07(0x206)]:_0x31fc57[_0x4d9d07(0x1b0)],typeof _0x324089[_0x4d9d07(0x23c)][_0x4d9d07(0x21c)]===_0x4d9d07(0x184)&&(_0x3ab966[_0x4d9d07(0x1e5)]=qs['limit'](_0x324089[_0x4d9d07(0x23c)][_0x4d9d07(0x1e5)]),_0x3ab966[_0x4d9d07(0x245)]=qs[_0x4d9d07(0x245)](_0x324089['query'][_0x4d9d07(0x245)])),_0x3ab966['order']=qs['sort'](_0x324089[_0x4d9d07(0x23c)][_0x4d9d07(0x1a5)]),_0x3ab966[_0x4d9d07(0x19c)]=qs[_0x4d9d07(0x231)](_[_0x4d9d07(0x23f)](_0x324089[_0x4d9d07(0x23c)],_0x31fc57[_0x4d9d07(0x231)])),_0x3ab966[_0x4d9d07(0x19c)][_0x4d9d07(0x214)]=_0x4b3c9a['id'],_0x324089[_0x4d9d07(0x23c)][_0x4d9d07(0x17e)]&&(_0x3ab966[_0x4d9d07(0x19c)]=_[_0x4d9d07(0x21e)](_0x3ab966[_0x4d9d07(0x19c)],{[Op['or']]:_[_0x4d9d07(0x17d)](_0x3ab966[_0x4d9d07(0x206)],function(_0x357d6f){const _0x585ca8=_0x4d9d07,_0xfbf993={};return _0xfbf993[_0x357d6f]={[Op['like']]:'%'+_0x324089[_0x585ca8(0x23c)][_0x585ca8(0x17e)]+'%'},_0xfbf993;})})),_0x3ab966=_['merge']({},_0x3ab966,_0x324089[_0x4d9d07(0x1b7)]),db[_0x4d9d07(0x197)][_0x4d9d07(0x1d9)]({'where':_0x3ab966[_0x4d9d07(0x19c)]})[_0x4d9d07(0x186)](function(_0x320092){const _0x2fafa2=_0x4d9d07;return _0xa7b4a1[_0x2fafa2(0x1d9)]=_0x320092,_0x324089[_0x2fafa2(0x23c)][_0x2fafa2(0x198)]&&(_0x3ab966[_0x2fafa2(0x1ca)]=[{'all':!![]}]),db[_0x2fafa2(0x197)][_0x2fafa2(0x1ae)](_0x3ab966);})[_0x4d9d07(0x186)](function(_0x267f55){const _0x7af25f=_0x4d9d07;return _0xa7b4a1[_0x7af25f(0x1cf)]=_0x267f55,_0xa7b4a1;});})[_0x33dabe(0x186)](respondWithFilteredResult(_0x185c56,_0x3ab966))['catch'](handleError(_0x185c56,null));},exports[a151_0x4b61b8(0x21f)]=function(_0x5d959d,_0x5cf6ed){const _0x5b25ee=a151_0x4b61b8;let _0x2dd5ce={'raw':!![],'where':{}};const _0x92e5c4={},_0x11dff8={'count':0x0,'rows':[]};return db[_0x5b25ee(0x1ac)]['findOne']({'where':{'id':_0x5d959d[_0x5b25ee(0x199)]['id']}})[_0x5b25ee(0x186)](handleEntityNotFound(_0x5cf6ed,null))[_0x5b25ee(0x186)](function(_0x1eb5ad){const _0x5678fa=_0x5b25ee;if(_0x1eb5ad)return _0x92e5c4[_0x5678fa(0x1b0)]=_[_0x5678fa(0x22c)](db[_0x5678fa(0x195)][_0x5678fa(0x1dd)]),_0x92e5c4[_0x5678fa(0x23c)]=_[_0x5678fa(0x22c)](_0x5d959d['query']),_0x92e5c4[_0x5678fa(0x231)]=_[_0x5678fa(0x1b2)](_0x92e5c4['model'],_0x92e5c4[_0x5678fa(0x23c)]),_0x2dd5ce['attributes']=_[_0x5678fa(0x1b2)](_0x92e5c4[_0x5678fa(0x1b0)],qs[_0x5678fa(0x243)](_0x5d959d[_0x5678fa(0x23c)][_0x5678fa(0x243)])),_0x2dd5ce[_0x5678fa(0x206)]=_0x2dd5ce['attributes'][_0x5678fa(0x1e3)]?_0x2dd5ce[_0x5678fa(0x206)]:_0x92e5c4[_0x5678fa(0x1b0)],typeof _0x5d959d[_0x5678fa(0x23c)]['nolimit']==='undefined'&&(_0x2dd5ce[_0x5678fa(0x1e5)]=qs['limit'](_0x5d959d[_0x5678fa(0x23c)][_0x5678fa(0x1e5)]),_0x2dd5ce[_0x5678fa(0x245)]=qs[_0x5678fa(0x245)](_0x5d959d[_0x5678fa(0x23c)]['offset'])),_0x2dd5ce['order']=qs[_0x5678fa(0x1a5)](_0x5d959d['query']['sort']),_0x2dd5ce[_0x5678fa(0x19c)]=qs[_0x5678fa(0x231)](_[_0x5678fa(0x23f)](_0x5d959d['query'],_0x92e5c4['filters'])),_0x2dd5ce['where'][_0x5678fa(0x214)]=_0x1eb5ad['id'],_0x5d959d[_0x5678fa(0x23c)]['filter']&&(_0x2dd5ce['where']=_['merge'](_0x2dd5ce['where'],{[Op['or']]:_['map'](_0x2dd5ce[_0x5678fa(0x206)],function(_0x1fe19f){const _0x318aa2=_0x5678fa,_0x11eee6={};return _0x11eee6[_0x1fe19f]={[Op[_0x318aa2(0x19a)]]:'%'+_0x5d959d[_0x318aa2(0x23c)]['filter']+'%'},_0x11eee6;})})),_0x2dd5ce=_[_0x5678fa(0x21e)]({},_0x2dd5ce,_0x5d959d[_0x5678fa(0x1b7)]),db[_0x5678fa(0x195)][_0x5678fa(0x1d9)]({'where':_0x2dd5ce[_0x5678fa(0x19c)]})['then'](function(_0x2ca393){const _0x1d3049=_0x5678fa;return _0x11dff8[_0x1d3049(0x1d9)]=_0x2ca393,_0x5d959d[_0x1d3049(0x23c)]['includeAll']&&(_0x2dd5ce['include']=[{'all':!![]}]),db[_0x1d3049(0x195)]['findAll'](_0x2dd5ce);})['then'](function(_0x576130){const _0x3d373c=_0x5678fa;return _0x11dff8[_0x3d373c(0x1cf)]=_0x576130,_0x11dff8;});})['then'](respondWithFilteredResult(_0x5cf6ed,_0x2dd5ce))[_0x5b25ee(0x224)](handleError(_0x5cf6ed,null));},exports[a151_0x4b61b8(0x194)]=function(_0x3a64d7,_0x5eac56){const _0x46392e=a151_0x4b61b8;let _0x4b8347={'raw':!![],'where':{}};const _0x37eb46={},_0x3bf9f9={'count':0x0,'rows':[]};return db[_0x46392e(0x1ac)][_0x46392e(0x229)]({'where':{'id':_0x3a64d7[_0x46392e(0x199)]['id']}})['then'](handleEntityNotFound(_0x5eac56,null))[_0x46392e(0x186)](function(_0x43315c){const _0x3e9b3a=_0x46392e;if(_0x43315c)return _0x37eb46[_0x3e9b3a(0x1b0)]=_[_0x3e9b3a(0x22c)](db[_0x3e9b3a(0x1fc)][_0x3e9b3a(0x1dd)]),_0x37eb46[_0x3e9b3a(0x23c)]=_['keys'](_0x3a64d7[_0x3e9b3a(0x23c)]),_0x37eb46[_0x3e9b3a(0x231)]=_[_0x3e9b3a(0x1b2)](_0x37eb46[_0x3e9b3a(0x1b0)],_0x37eb46['query']),_0x4b8347[_0x3e9b3a(0x206)]=_['intersection'](_0x37eb46[_0x3e9b3a(0x1b0)],qs[_0x3e9b3a(0x243)](_0x3a64d7[_0x3e9b3a(0x23c)]['fields'])),_0x4b8347[_0x3e9b3a(0x206)]=_0x4b8347['attributes']['length']?_0x4b8347[_0x3e9b3a(0x206)]:_0x37eb46[_0x3e9b3a(0x1b0)],typeof _0x3a64d7[_0x3e9b3a(0x23c)][_0x3e9b3a(0x21c)]===_0x3e9b3a(0x184)&&(_0x4b8347['limit']=qs['limit'](_0x3a64d7[_0x3e9b3a(0x23c)][_0x3e9b3a(0x1e5)]),_0x4b8347[_0x3e9b3a(0x245)]=qs[_0x3e9b3a(0x245)](_0x3a64d7[_0x3e9b3a(0x23c)][_0x3e9b3a(0x245)])),_0x4b8347['order']=qs['sort'](_0x3a64d7[_0x3e9b3a(0x23c)][_0x3e9b3a(0x1a5)]),_0x4b8347[_0x3e9b3a(0x19c)]=qs[_0x3e9b3a(0x231)](_['pick'](_0x3a64d7[_0x3e9b3a(0x23c)],_0x37eb46['filters'])),_0x4b8347[_0x3e9b3a(0x19c)][_0x3e9b3a(0x214)]=_0x43315c['id'],_0x3a64d7[_0x3e9b3a(0x23c)][_0x3e9b3a(0x17e)]&&(_0x4b8347[_0x3e9b3a(0x19c)]=_['merge'](_0x4b8347['where'],{[Op['or']]:_[_0x3e9b3a(0x17d)](_0x4b8347['attributes'],function(_0x45be0f){const _0x53a16c=_0x3e9b3a,_0x18f137={};return _0x18f137[_0x45be0f]={[Op[_0x53a16c(0x19a)]]:'%'+_0x3a64d7[_0x53a16c(0x23c)]['filter']+'%'},_0x18f137;})})),_0x4b8347=_['merge']({},_0x4b8347,_0x3a64d7[_0x3e9b3a(0x1b7)]),db[_0x3e9b3a(0x1fc)][_0x3e9b3a(0x1d9)]({'where':_0x4b8347['where']})[_0x3e9b3a(0x186)](function(_0x31e266){const _0x5d0f12=_0x3e9b3a;return _0x3bf9f9[_0x5d0f12(0x1d9)]=_0x31e266,_0x3a64d7[_0x5d0f12(0x23c)][_0x5d0f12(0x198)]&&(_0x4b8347[_0x5d0f12(0x1ca)]=[{'all':!![]}]),db[_0x5d0f12(0x1fc)]['findAll'](_0x4b8347);})[_0x3e9b3a(0x186)](function(_0x489f02){const _0x46d11e=_0x3e9b3a;return _0x3bf9f9[_0x46d11e(0x1cf)]=_0x489f02,_0x3bf9f9;});})['then'](respondWithFilteredResult(_0x5eac56,_0x4b8347))[_0x46392e(0x224)](handleError(_0x5eac56,null));},exports[a151_0x4b61b8(0x246)]=function(_0x34164c,_0x549efc){const _0x7d885a=a151_0x4b61b8;let _0x5edf85={'raw':!![],'where':{}};const _0x396216={},_0x553d5a={'count':0x0,'rows':[]};return db[_0x7d885a(0x1ac)]['findOne']({'where':{'id':_0x34164c[_0x7d885a(0x199)]['id']}})['then'](handleEntityNotFound(_0x549efc,null))[_0x7d885a(0x186)](function(_0x2fa2ea){const _0x25078b=_0x7d885a;if(_0x2fa2ea)return _0x396216[_0x25078b(0x1b0)]=_['keys'](db[_0x25078b(0x211)]['rawAttributes']),_0x396216[_0x25078b(0x23c)]=_[_0x25078b(0x22c)](_0x34164c[_0x25078b(0x23c)]),_0x396216['filters']=_['intersection'](_0x396216['model'],_0x396216[_0x25078b(0x23c)]),_0x5edf85['attributes']=_['intersection'](_0x396216['model'],qs[_0x25078b(0x243)](_0x34164c[_0x25078b(0x23c)][_0x25078b(0x243)])),_0x5edf85[_0x25078b(0x206)]=_0x5edf85[_0x25078b(0x206)][_0x25078b(0x1e3)]?_0x5edf85[_0x25078b(0x206)]:_0x396216[_0x25078b(0x1b0)],typeof _0x34164c[_0x25078b(0x23c)]['nolimit']===_0x25078b(0x184)&&(_0x5edf85['limit']=qs[_0x25078b(0x1e5)](_0x34164c['query'][_0x25078b(0x1e5)]),_0x5edf85[_0x25078b(0x245)]=qs[_0x25078b(0x245)](_0x34164c[_0x25078b(0x23c)][_0x25078b(0x245)])),_0x5edf85[_0x25078b(0x227)]=qs[_0x25078b(0x1a5)](_0x34164c['query'][_0x25078b(0x1a5)]),_0x5edf85[_0x25078b(0x19c)]=qs[_0x25078b(0x231)](_[_0x25078b(0x23f)](_0x34164c[_0x25078b(0x23c)],_0x396216[_0x25078b(0x231)])),_0x5edf85[_0x25078b(0x19c)]['ContactId']=_0x2fa2ea['id'],_0x34164c[_0x25078b(0x23c)][_0x25078b(0x17e)]&&(_0x5edf85[_0x25078b(0x19c)]=_[_0x25078b(0x21e)](_0x5edf85[_0x25078b(0x19c)],{[Op['or']]:_[_0x25078b(0x17d)](_0x5edf85['attributes'],function(_0x40ab1d){const _0x551557=_0x25078b,_0x52699a={};return _0x52699a[_0x40ab1d]={[Op[_0x551557(0x19a)]]:'%'+_0x34164c[_0x551557(0x23c)][_0x551557(0x17e)]+'%'},_0x52699a;})})),_0x5edf85=_[_0x25078b(0x21e)]({},_0x5edf85,_0x34164c['options']),db[_0x25078b(0x211)][_0x25078b(0x1d9)]({'where':_0x5edf85[_0x25078b(0x19c)]})[_0x25078b(0x186)](function(_0xa48b3e){const _0x350e5f=_0x25078b;return _0x553d5a[_0x350e5f(0x1d9)]=_0xa48b3e,_0x34164c[_0x350e5f(0x23c)]['includeAll']&&(_0x5edf85['include']=[{'all':!![]}]),db[_0x350e5f(0x211)][_0x350e5f(0x1ae)](_0x5edf85);})[_0x25078b(0x186)](function(_0x1a895b){const _0xcc2fca=_0x25078b;return _0x553d5a[_0xcc2fca(0x1cf)]=_0x1a895b,_0x553d5a;});})[_0x7d885a(0x186)](respondWithFilteredResult(_0x549efc,_0x5edf85))[_0x7d885a(0x224)](handleError(_0x549efc,null));},exports['upload']=function(_0x54b625,_0x5daa82){const _0x280e72=a151_0x4b61b8,_0xd59925=fs[_0x280e72(0x22d)](_0x54b625[_0x280e72(0x1da)][_0x280e72(0x1f7)]);Papa[_0x280e72(0x1a4)](_0xd59925,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3c8d51){const _0xe239cc=_0x280e72;return _0x5daa82[_0xe239cc(0x18f)](0xc8)[_0xe239cc(0x1d6)]({'file':_0x54b625['file'],'fields':_0x3c8d51[_0xe239cc(0x18b)][_0xe239cc(0x243)]});}});},exports[a151_0x4b61b8(0x1f8)]=function(_0x40eaa5,_0x2bc880){const _0x114dc7=a151_0x4b61b8;return db['User'][_0x114dc7(0x1ae)]({'raw':!![],'attributes':['id'],'where':{'role':_0x114dc7(0x1c4)}})[_0x114dc7(0x186)](function(_0x4222c4){const _0x431553=_0x114dc7;let _0x3956c8=![];if(!_0x40eaa5['body'][_0x431553(0x1db)])throw new Error(_0x431553(0x1d7));if(!_0x40eaa5[_0x431553(0x1e8)][_0x431553(0x18a)][_0x431553(0x1e1)])throw new Error(_0x431553(0x1cd));if(!_0x40eaa5[_0x431553(0x1e8)][_0x431553(0x18a)][_0x431553(0x1dc)])throw new Error(_0x431553(0x210));if(!_0x40eaa5[_0x431553(0x1e8)][_0x431553(0x1e7)])throw new Error(_0x431553(0x1a0));const _0x15d78d=path[_0x431553(0x1f9)](config['root'],_0x431553(0x1c2),_0x40eaa5[_0x431553(0x199)]['id']),_0x353005=JSON['stringify'](_0x40eaa5['body']),_0x242503=JSON[_0x431553(0x1e2)](_0x4222c4);logger[_0x431553(0x23d)](_0x431553(0x173)+CSV2_SCRIPT+_0x431553(0x1a1)+_0x15d78d+_0x431553(0x23a)+_0x353005+_0x431553(0x207)+_0x242503);const _0x387cbe=fork(CSV2_SCRIPT,[_0x15d78d,_0x353005,_0x242503],{'stdio':_0x431553(0x1c6)});_0x387cbe['on'](_0x431553(0x1f6),()=>{const _0xd0d47f=_0x431553;return _0x3956c8=!![],_0x2bc880[_0xd0d47f(0x18f)](0xc8)[_0xd0d47f(0x1d6)]({'message':_0xd0d47f(0x16f),'pid':_0x387cbe[_0xd0d47f(0x18e)]});}),_0x387cbe['on'](_0x431553(0x181),_0x317bae=>{const _0x55d99f=_0x431553;logger[_0x55d99f(0x181)](_0x55d99f(0x1fb)+CSV2_SCRIPT+_0x55d99f(0x180)+_0x317bae[_0x55d99f(0x1f6)]+'\x20'+_0x317bae['stack']);}),_0x387cbe[_0x431553(0x235)]&&_0x387cbe[_0x431553(0x1f0)]?(_0x387cbe['stdout']['on']('data',_0x913b73=>{const _0x1e0712=_0x431553;logger[_0x1e0712(0x23d)](_0x1e0712(0x234)+_0x913b73);}),_0x387cbe[_0x431553(0x1f0)]['on'](_0x431553(0x240),_0x5ce33d=>{const _0x3dbcce=_0x431553;logger[_0x3dbcce(0x181)](_0x3dbcce(0x19b)+_0x5ce33d);})):logger[_0x431553(0x23d)](_0x431553(0x1b5)),_0x387cbe['on']('exit',_0x311416=>{const _0x174401=_0x431553;if(_0x311416&&!_0x3956c8)return _0x2bc880[_0x174401(0x18f)](0x1f4)['json']({'message':_0x174401(0x1e4),'pid':_0x387cbe[_0x174401(0x18e)]});});})[_0x114dc7(0x224)](handleError(_0x2bc880,null));};
\ No newline at end of file
+const a151_0x44b5=['map','phone','color','VoiceCallReport','t.id\x20=\x20ct.TagId','keyBy','Failed\x20to\x20start\x20','stdout','file','type','c.phone\x20LIKE\x20?','forEach','findAll','DATE','pick','index','create','[CmContact][merge][destroy][CmHopperBlack],\x20%s','log','custom','trimStart','Tags','replace','where','displayName','meta','path','select','firstName','attributes','FaxInteraction','root','body','includeAll','isEmpty','set','c.firstName\x20LIKE\x20?','model','length','Contact','No\x20firstName\x20column\x20specified','some','tag','ids','socket_timestamp','isArray','join','parseSearch','c.firstName','ReportAgentPreview','left_join','upload','error\x20child\x20process','split','data','SmsMessage','child\x20stderr:\x0a','text','ContactId','count','binding','search','stderr','then','JscriptySessionReport','get','message','api','value','import','find','pipe','SmsInteraction','offset','info','../../components/import/cm/csv2.js','getJscriptySessions','and','push','intersection','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','child_process','c.lastName','duplicates','query','destroy','setFields','OpenchannelMessage','c.ListId','\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20and\x20agents\x20=\x20','findOrCreate','params','datetime','c.email\x20LIKE\x20?','SmsQueueReport','tools_tags','CmContact','exit','filter','catch','child\x20stdout:\x0a','ChatInteraction','CmCustomField','start','CmHopperBlack','lodash','rows','describe','name','Tag','merge','isNil','getFullTextValue','c.email','bulkCreate','SELECT','CmHopper','values','../../rediscache','pickBy','cf_','MailMessage','c.fax','pid','concat','sequelize','[CmContact][merge]\x20to\x20%s\x20from\x20%s','t.id\x20IN\x20?','format','filters','CmHopperHistory','Content-Range','update','startsWith','stringify','c.mobile\x20LIKE\x20?','include','\x20on\x20file\x20','fieldType','cm_user_has_contacts','stdin','[CmContact][merge][destroy][CmHopper],\x20%s','DESC','uc.UserId\x20=\x20?','omit','CmHopperFinal','from','cf_%d','\x20process:\x20error\x20','squel','keys','Missing\x20stdin\x20and\x20stdout\x20on\x20child\x20process','user','register','MailQueueReport','limit','status','files/tmp','show','fields','GROUP_CONCAT(DISTINCT\x20t.id)','resolve','c.phone','c.ListId\x20IN\x20?','getHopperHistories','c.id','parse','MailInteraction','ChatQueueReport','ListId','TagIds','c.fax\x20LIKE\x20?','rawAttributes','all','FaxMessage','expr','cm_contacts','getTags','conditions','User','tags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','ct.CmContactId\x20=\x20c.id','papaparse','c.deletedAt\x20IS\x20NULL','order','\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20with\x20parameters\x20=\x20','getHoppers','uc.CmContactId\x20=\x20c.id','createReadStream','isNumeric','options','undefined','../../config/environment','nolimit','table','toString','error','findOne','../../components/parsers/advancedSearch','sort','columnName','field','like','No\x20phone\x20column\x20specified','stack','json','end'];(function(_0x30e020,_0x2b5948){const _0x44b5d1=function(_0x1ad14a){while(--_0x1ad14a){_0x30e020['push'](_0x30e020['shift']());}};_0x44b5d1(++_0x2b5948);}(a151_0x44b5,0x136));const a151_0x1ad1=function(_0x30e020,_0x2b5948){_0x30e020=_0x30e020-0x1cc;let _0x44b5d1=a151_0x44b5[_0x30e020];return _0x44b5d1;};const a151_0x115ae4=a151_0x1ad1;'use strict';const util=require('util'),path=require(a151_0x115ae4(0x250)),fs=require('fs'),_=require(a151_0x115ae4(0x1cf)),squel=require(a151_0x115ae4(0x1fb)),Papa=require(a151_0x115ae4(0x21d)),{getSocket}=require(a151_0x115ae4(0x1dc)),socket=getSocket(),qs=require('../../components/parsers/qs'),as=require(a151_0x115ae4(0x22d)),logger=require('../../config/logger')(a151_0x115ae4(0x279)),{db}=require('../../mysqldb'),{Op,QueryTypes}=require(a151_0x115ae4(0x1e3)),{fork}=require(a151_0x115ae4(0x287)),config=require(a151_0x115ae4(0x227));require('./cmContact.socket')[a151_0x115ae4(0x1ff)](socket);const CSV2_SCRIPT=path[a151_0x115ae4(0x264)](__dirname,a151_0x115ae4(0x281));function respondWithResult(_0x3b9f6b,_0x19d4cb){return _0x19d4cb=_0x19d4cb||0xc8,function(_0x3c130d){const _0x33491d=a151_0x1ad1;if(_0x3c130d)return _0x3b9f6b[_0x33491d(0x202)](_0x19d4cb)[_0x33491d(0x234)](_0x3c130d);};}function respondWithFilteredResult(_0x11b7fd,_0x1a8fad){return function(_0x53a175){const _0x20c1e0=a151_0x1ad1;if(_0x53a175){const _0x55ef87=_0x53a175[_0x20c1e0(0x271)],_0x547621=_0x1a8fad[_0x20c1e0(0x27f)];let _0x1bab13=_0x1a8fad[_0x20c1e0(0x27f)]+_0x1a8fad[_0x20c1e0(0x201)],_0x5a1fec;return _0x1bab13>=_0x55ef87?(_0x1bab13=_0x55ef87,_0x5a1fec=0xc8):_0x5a1fec=0xce,_0x11b7fd[_0x20c1e0(0x202)](_0x5a1fec),_0x11b7fd[_0x20c1e0(0x259)](_0x20c1e0(0x1e9),_0x547621+'-'+_0x1bab13+'/'+_0x55ef87)['json'](_0x53a175);}return null;};}function saveUpdates(_0x2f4d29){return function(_0x439bf2){const _0xd97b13=a151_0x1ad1;if(_0x439bf2)return _0x439bf2['update'](_0x2f4d29)[_0xd97b13(0x275)](function(_0x1de7a3){return _0x1de7a3;});return null;};}function removeEntity(_0x5d8ad6){return function(_0x39f8f3){const _0x1e6187=a151_0x1ad1;if(_0x39f8f3)return _0x39f8f3[_0x1e6187(0x28b)]()['then'](function(){const _0x3513eb=_0x1e6187;_0x5d8ad6[_0x3513eb(0x202)](0xcc)[_0x3513eb(0x235)]();});};}function handleEntityNotFound(_0x1f136f){return function(_0x22239b){return!_0x22239b&&_0x1f136f['sendStatus'](0x194),_0x22239b;};}function handleError(_0x3e966b,_0x111cc3){return _0x111cc3=_0x111cc3||0x1f4,function(_0x321c7b){const _0x5aad96=a151_0x1ad1;logger[_0x5aad96(0x22b)](_0x321c7b[_0x5aad96(0x233)]),_0x321c7b['name']&&delete _0x321c7b[_0x5aad96(0x1d2)],_0x3e966b['status'](_0x111cc3)['send'](_0x321c7b);};}exports[a151_0x115ae4(0x245)]=function(_0x1940cd,_0x5e4461){const _0x194659=a151_0x115ae4,_0x4b7ab9={},_0x578655={},_0x22aa11={'count':0x0,'rows':[]};return db[_0x194659(0x296)][_0x194659(0x1d1)]()[_0x194659(0x275)](function(_0x3eb4ec){const _0x4dbc3d=_0x194659,_0x1ced7f=[];for(let _0x40b0f9=0x0;_0x40b0f9<Object['keys'](_0x3eb4ec)['length'];_0x40b0f9++){const _0x20eda1=Object[_0x4dbc3d(0x1fc)](_0x3eb4ec)[_0x40b0f9];_[_0x4dbc3d(0x1eb)](_0x20eda1,_0x4dbc3d(0x1de))&&_0x1ced7f[_0x4dbc3d(0x284)](db[_0x4dbc3d(0x1cc)]['findOne']({'where':{'id':_[_0x4dbc3d(0x24a)](_0x20eda1,'cf_')},'raw':!![]}));}return Promise[_0x4dbc3d(0x213)](_0x1ced7f)['then'](function(_0x44c40f){const _0x2355cf=_0x4dbc3d;for(let _0x54872a=0x0;_0x54872a<_0x44c40f[_0x2355cf(0x25c)];_0x54872a++){if(_0x44c40f[_0x54872a]){const _0x48b7d5=_0x2355cf(0x1de)+_0x44c40f[_0x54872a]['id'],_0x326046=_0x3eb4ec[_0x48b7d5];_0x326046[_0x2355cf(0x1f0)]=_0x44c40f[_0x54872a][_0x2355cf(0x23f)];}}return _0x3eb4ec;});})['then'](function(_0x58f797){const _0x23284a=_0x194659;_0x578655[_0x23284a(0x25b)]=_['keys'](_0x58f797),_0x578655[_0x23284a(0x28a)]=_['keys'](_0x1940cd[_0x23284a(0x28a)]),_0x578655[_0x23284a(0x1e7)]=_[_0x23284a(0x285)](_0x578655[_0x23284a(0x25b)],_0x578655['query']),_0x4b7ab9[_0x23284a(0x253)]=_[_0x23284a(0x285)](_0x578655[_0x23284a(0x25b)],qs[_0x23284a(0x205)](_0x1940cd[_0x23284a(0x28a)]['fields'])),_0x4b7ab9['attributes']=_0x4b7ab9['attributes']['length']?_0x4b7ab9['attributes']:_0x578655['model'];typeof _0x1940cd[_0x23284a(0x28a)][_0x23284a(0x228)]===_0x23284a(0x226)&&(_0x4b7ab9[_0x23284a(0x201)]=qs['limit'](_0x1940cd[_0x23284a(0x28a)][_0x23284a(0x201)]),_0x4b7ab9[_0x23284a(0x27f)]=qs[_0x23284a(0x27f)](_0x1940cd[_0x23284a(0x28a)]['offset']));_0x4b7ab9['order']=qs['sort'](_0x1940cd['query'][_0x23284a(0x22e)]),_0x4b7ab9[_0x23284a(0x24d)]=qs[_0x23284a(0x1e7)](_[_0x23284a(0x244)](_0x1940cd[_0x23284a(0x28a)],_0x578655[_0x23284a(0x1e7)]),_0x58f797);let _0x524eeb=[];const _0x450f0c=squel[_0x23284a(0x251)]()['field']('id')['field'](_0x23284a(0x1d2))[_0x23284a(0x230)](_0x23284a(0x238))[_0x23284a(0x1f8)](_0x23284a(0x295)),_0x36388f=squel[_0x23284a(0x251)]()[_0x23284a(0x1f8)](_0x23284a(0x216),'c')['left_join'](_0x23284a(0x1f1),'uc',_0x23284a(0x222))[_0x23284a(0x268)]('cm_contact_has_tags','ct',_0x23284a(0x21c))[_0x23284a(0x268)]('tools_tags','t',_0x23284a(0x23a))['where'](_0x23284a(0x21e)),_0x262252=squel['expr']();let _0x55a18e=[];const _0x43842f=squel[_0x23284a(0x215)]();let _0x573d92;if(_0x1940cd[_0x23284a(0x28a)][_0x23284a(0x273)]){_0x573d92=as[_0x23284a(0x265)](_0x1940cd[_0x23284a(0x28a)][_0x23284a(0x273)]);const _0x90495a=_0x573d92['sqlOperator'];for(let _0x2496fb=0x0;_0x2496fb<_0x573d92[_0x23284a(0x218)][_0x23284a(0x25c)];_0x2496fb++){const _0x3171b3=_0x573d92[_0x23284a(0x218)][_0x2496fb],_0x2bba55='c';let _0x3b91cb=_(_0x58f797)['keys']()[_0x23284a(0x27c)](function(_0x1d0266){const _0x4c0ea0=_0x23284a;return _0x1d0266===_0x3171b3[_0x4c0ea0(0x230)];});if(_0x3b91cb)_0x3b91cb=_0x58f797[_0x3171b3['field']];if(!_0x3b91cb){if(_0x3171b3[_0x23284a(0x230)]===_0x23284a(0x1d3)){const _0x25063e=_0x3171b3['value'][_0x23284a(0x26b)](',')['map'](function(_0x33aa0f){return Number(_0x33aa0f);});_0x25063e[_0x23284a(0x241)](function(_0x5bd268){const _0x4f129e=_0x23284a;_0x43842f['or'](_0x4f129e(0x21b),'%,'+_0x5bd268+',%');}),_0x55a18e=_['union'](_0x55a18e,_0x25063e);}else _0x3171b3[_0x23284a(0x230)]===_0x23284a(0x219)&&_0x262252[_0x23284a(0x283)](_0x23284a(0x1f5),_0x3171b3[_0x23284a(0x27a)]);}else{if(_0x3171b3[_0x23284a(0x230)]==='dateOfBirth'||_0x3b91cb[_0x23284a(0x1f0)]===_0x23284a(0x292))_0x3171b3['castTo']=_0x23284a(0x243);const _0x5a1bae=as['buildExpression'](_0x2bba55,_0x3b91cb[_0x23284a(0x23f)],_0x3171b3);_0x262252[_0x90495a](_0x5a1bae[_0x23284a(0x26f)],_0x5a1bae[_0x23284a(0x27a)][_0x23284a(0x1cd)],_0x5a1bae[_0x23284a(0x27a)]['end']);}}}else{const _0x2ca476=_(Object[_0x23284a(0x1fc)](_0x1940cd[_0x23284a(0x28a)]))[_0x23284a(0x236)](function(_0x22ce26){return typeof _0x58f797[_0x22ce26]==='undefined'?undefined:_0x22ce26;})[_0x23284a(0x298)](function(_0x180d65){const _0xc2d84b=_0x23284a;return!_[_0xc2d84b(0x1d5)](_0x180d65);})[_0x23284a(0x27a)]();if(_0x1940cd['query'][_0x23284a(0x25d)])_0x2ca476[_0x23284a(0x284)]('Contact');!_[_0x23284a(0x258)](_0x2ca476)&&_0x2ca476[_0x23284a(0x241)](function(_0x353963){const _0x1c76bb=_0x23284a;if(_0x353963===_0x1c76bb(0x20f))_0x36388f[_0x1c76bb(0x24d)](_0x1c76bb(0x209),[][_0x1c76bb(0x1e2)](_0x1940cd['query'][_0x353963]));else{if(_0x353963===_0x1c76bb(0x25d)){const _0x3d0c5b='%'+_0x1940cd[_0x1c76bb(0x28a)][_0x353963]+'%';_0x36388f['where']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3d0c5b);}else _0x36388f['where']('c.'+_0x353963+'\x20=\x20?',_0x1940cd[_0x1c76bb(0x28a)][_0x353963]);}});_0x1940cd['query'][_0x23284a(0x260)]&&(_0x55a18e=_[_0x23284a(0x263)](_0x1940cd[_0x23284a(0x28a)]['tag'])?_0x1940cd['query'][_0x23284a(0x260)]:new Array(_0x1940cd['query'][_0x23284a(0x260)]),_0x55a18e[_0x23284a(0x241)](function(_0x89ffd){const _0x5bf3f9=_0x23284a;_0x43842f['or'](_0x5bf3f9(0x21b),'%,'+_0x89ffd+',%');}));if(_0x1940cd['query']['filter']){const _0x7a7cfd=_0x1940cd['query']['filter'][_0x23284a(0x24c)]('\x5c','\x5c\x5c')[_0x23284a(0x24c)](/'/g,'\x27\x27');if(_0x7a7cfd[_0x23284a(0x26b)]('\x20')['length']>0x1)_0x262252['or'](_0x23284a(0x286),qs[_0x23284a(0x1d6)](_0x7a7cfd),null);else{if(qs[_0x23284a(0x224)](_0x7a7cfd))_0x262252['or']('c.id\x20LIKE\x20?',_0x7a7cfd+'%'),_0x262252['or'](_0x23284a(0x240),_0x7a7cfd+'%'),_0x262252['or'](_0x23284a(0x1ed),_0x7a7cfd+'%'),_0x262252['or'](_0x23284a(0x211),_0x7a7cfd+'%');else qs['isEmail'](_0x7a7cfd)?_0x262252['or'](_0x23284a(0x293),_0x7a7cfd+'%'):(_0x262252['or'](_0x23284a(0x25a),'%'+_0x7a7cfd+'%'),_0x262252['or']('c.lastName\x20LIKE\x20?','%'+_0x7a7cfd+'%'),_0x262252['or'](_0x23284a(0x293),'%'+_0x7a7cfd+'%'));}}}_0x36388f[_0x23284a(0x24d)](_0x262252),_0x36388f['group'](_0x23284a(0x20b));let _0x3d656c={'type':QueryTypes[_0x23284a(0x1d9)],'raw':!![]};const _0x3f313c=_0x36388f['clone']()[_0x23284a(0x230)]('c.id');_0x4b7ab9[_0x23284a(0x21f)]&&_0x4b7ab9[_0x23284a(0x21f)][_0x23284a(0x241)](function(_0x5185b9){const _0x7a6ce7=_0x23284a;_0x36388f['order']('c.'+_0x5185b9[0x0],_0x5185b9[0x1]===_0x7a6ce7(0x1f4)?![]:!![]);}),!_['isEmpty'](_0x55a18e)&&(_0x36388f['having'](_0x43842f),_0x3f313c['where'](_0x23284a(0x1e5),_0x55a18e)),Promise[_0x23284a(0x207)]()['then'](function(){const _0x667139=_0x23284a;if(_0x573d92&&!_[_0x667139(0x25f)](_0x573d92[_0x667139(0x218)],['field',_0x667139(0x219)]))return _0x1940cd[_0x667139(0x1fe)]['getLists']({'attributes':['id'],'raw':!![]})[_0x667139(0x275)](function(_0x13a001){const _0x4921b1=_0x667139;_['isEmpty'](_0x13a001)?(_0x3f313c[_0x4921b1(0x24d)]('c.ListId\x20IS\x20NULL'),_0x36388f[_0x4921b1(0x24d)]('c.ListId\x20IS\x20NULL')):(_0x3f313c[_0x4921b1(0x24d)]('c.ListId\x20IN\x20?',_[_0x4921b1(0x236)](_0x13a001,'id')),_0x36388f['where'](_0x4921b1(0x209),_[_0x4921b1(0x236)](_0x13a001,'id')));});else return;})['then'](function(){const _0x55e740=_0x23284a;db['sequelize']['query'](_0x3f313c['toString'](),_0x3d656c)[_0x55e740(0x275)](function(_0x1a9f7c){const _0x2f2d03=_0x55e740;_0x22aa11['count']=_0x1a9f7c['length'];if(_0x22aa11['count']===0x0)return[];return db[_0x2f2d03(0x1e3)]['query'](_0x450f0c[_0x2f2d03(0x22a)](),_0x3d656c);})[_0x55e740(0x275)](function(_0x1ec74b){const _0x5ebefb=_0x55e740;_0x524eeb=_[_0x5ebefb(0x23b)](_0x1ec74b,'id'),_0x3d656c=_[_0x5ebefb(0x1d4)](_0x3d656c,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});_0x1940cd[_0x5ebefb(0x28a)][_0x5ebefb(0x205)]?_0x4b7ab9[_0x5ebefb(0x253)][_0x5ebefb(0x241)](function(_0x202393){const _0x19066a=_0x5ebefb;_0x36388f[_0x19066a(0x230)]('c.'+_0x202393);}):(_0x36388f['field'](_0x5ebefb(0x20b)),_0x36388f[_0x5ebefb(0x230)](_0x5ebefb(0x266)),_0x36388f[_0x5ebefb(0x230)](_0x5ebefb(0x288)),_0x36388f['field'](_0x5ebefb(0x208)),_0x36388f[_0x5ebefb(0x230)]('c.mobile'),_0x36388f[_0x5ebefb(0x230)](_0x5ebefb(0x1e0)),_0x36388f['field'](_0x5ebefb(0x1d7)),_0x36388f['field'](_0x5ebefb(0x28e)),_0x36388f[_0x5ebefb(0x230)]('c.deletedAt'),_0x36388f[_0x5ebefb(0x230)](_0x5ebefb(0x206),_0x5ebefb(0x210)));if(_0x4b7ab9[_0x5ebefb(0x201)])_0x36388f['limit'](_0x4b7ab9['limit']);if(_0x4b7ab9[_0x5ebefb(0x27f)])_0x36388f[_0x5ebefb(0x27f)](_0x4b7ab9[_0x5ebefb(0x27f)]);return db[_0x5ebefb(0x1e3)]['query'](_0x36388f['toString'](),_0x3d656c);})['then'](function(_0x2dfc28){const _0x31f2f6=_0x55e740;return _0x2dfc28[_0x31f2f6(0x241)](function(_0x354c9d){const _0x207f4a=_0x31f2f6;_0x354c9d[_0x207f4a(0x210)]&&(_0x354c9d[_0x207f4a(0x24b)]=[],_0x354c9d[_0x207f4a(0x210)][_0x207f4a(0x26b)](',')[_0x207f4a(0x241)](function(_0x4f6fce){const _0x1f9229=_0x207f4a;_0x354c9d[_0x1f9229(0x24b)][_0x1f9229(0x284)](_0x524eeb[_0x4f6fce]);})),delete _0x354c9d[_0x207f4a(0x210)];}),_0x22aa11[_0x31f2f6(0x1d0)]=_0x2dfc28,_0x22aa11;})[_0x55e740(0x275)](respondWithFilteredResult(_0x5e4461,_0x4b7ab9));});})[_0x194659(0x299)](handleError(_0x5e4461,null));},exports['destroy']=function(_0x2d5dc2,_0x386cb3){const _0x8c8847=a151_0x115ae4;return db['CmContact'][_0x8c8847(0x22c)]({'where':{'id':_0x2d5dc2['params']['id']}})[_0x8c8847(0x275)](handleEntityNotFound(_0x386cb3,null))[_0x8c8847(0x275)](removeEntity(_0x386cb3,null))[_0x8c8847(0x299)](handleError(_0x386cb3,null));},exports[a151_0x115ae4(0x1d1)]=function(_0x37240e,_0x34f1f3){const _0x534b77=a151_0x115ae4;return db['CmContact'][_0x534b77(0x1d1)]()['then'](function(_0x4dde7c){const _0x54cbf2=_0x534b77;delete _0x4dde7c['tags'];for(let _0x1c362d=0x0;_0x1c362d<Object[_0x54cbf2(0x1fc)](_0x4dde7c)['length'];_0x1c362d++){const _0x1c3766=Object[_0x54cbf2(0x1fc)](_0x4dde7c)[_0x1c362d];!_[_0x54cbf2(0x1eb)](_0x1c3766,'cf_')&&(_0x4dde7c[_0x1c3766][_0x54cbf2(0x22f)]=_0x1c3766,_0x4dde7c[_0x1c3766][_0x54cbf2(0x24e)]=_0x1c3766);}return _0x4dde7c;})[_0x534b77(0x275)](function(_0x2b0997){const _0x587a41=_0x534b77,_0x46fe5b=_0x37240e[_0x587a41(0x28a)]['id']?_0x37240e['query']['id']:null,_0x1dde5e={'where':{'ListId':_0x46fe5b},'raw':!![]};return db['CmCustomField'][_0x587a41(0x242)](_0x1dde5e)[_0x587a41(0x275)](function(_0xe48150){const _0x1694b8=_0x587a41;for(let _0x2a6e7f=0x0;_0x2a6e7f<_0xe48150[_0x1694b8(0x25c)];_0x2a6e7f++){console[_0x1694b8(0x248)]('2',_0xe48150[_0x2a6e7f]);const _0x117d4c=_0x1694b8(0x1de)+_0xe48150[_0x2a6e7f]['id'];_0x2b0997[_0x117d4c]['columnName']=_0x117d4c,_0x2b0997[_0x117d4c][_0x1694b8(0x24e)]=_0xe48150[_0x2a6e7f]['alias'],_0x2b0997[_0x117d4c][_0x1694b8(0x249)]={'type':_0xe48150[_0x2a6e7f][_0x1694b8(0x23f)],'values':_0xe48150[_0x2a6e7f][_0x1694b8(0x1db)]};}return Object['keys'](_0x2b0997)[_0x1694b8(0x241)](function(_0x12b1b1){const _0x2f851d=_0x1694b8;typeof _0x2b0997[_0x12b1b1][_0x2f851d(0x22f)]==='undefined'&&delete _0x2b0997[_0x12b1b1];}),_0x2b0997;});})['then'](respondWithResult(_0x34f1f3,null))[_0x534b77(0x299)](handleError(_0x34f1f3,null));},exports[a151_0x115ae4(0x1d4)]=function(_0x102609,_0x2a0812){const _0x426576=a151_0x115ae4;let _0x431efc,_0x147073,_0x554beb;return _0x102609[_0x426576(0x256)]['id']&&delete _0x102609[_0x426576(0x256)]['id'],db['CmContact']['findAll']({'where':{'id':[_0x102609[_0x426576(0x256)]['to'],_0x102609[_0x426576(0x256)][_0x426576(0x1f8)]]}})[_0x426576(0x275)](function(_0x3e6775){const _0x3dd89a=_0x426576;if(_0x3e6775){if(_0x3e6775['length']!==0x2)return null;return _0x3e6775[0x0]=_0x3e6775[0x0][_0x3dd89a(0x277)]({'plain':!![]}),_0x3e6775[0x1]=_0x3e6775[0x1][_0x3dd89a(0x277)]({'plain':!![]}),delete _0x3e6775[0x0]['id'],delete _0x3e6775[0x1]['id'],_['mergeWith'](_0x3e6775[0x0],_0x3e6775[0x1],function(_0x18f9a5,_0x248be6){const _0x201206=_0x3dd89a;if(Array[_0x201206(0x263)](_0x248be6)&&!_0x248be6['length'])return _0x18f9a5;else{if(!_0x248be6)return _0x18f9a5;}});}})[_0x426576(0x275)](handleEntityNotFound(_0x2a0812,null))[_0x426576(0x275)](function(_0x247052){const _0x549935=_0x426576;if(_0x247052)return _0x247052['tags']&&_[_0x549935(0x263)](_0x247052[_0x549935(0x21a)])&&(_0x247052[_0x549935(0x21a)]=_0x247052[_0x549935(0x21a)][_0x549935(0x264)]()),logger[_0x549935(0x280)](_0x549935(0x1e4),_0x102609['body']['to'],_0x102609[_0x549935(0x256)][_0x549935(0x1f8)]),db[_0x549935(0x1da)][_0x549935(0x28b)]({'where':{'ContactId':[_0x102609[_0x549935(0x256)]['to'],_0x102609[_0x549935(0x256)]['from']]}})[_0x549935(0x275)](function(_0x3e96ea){const _0x3fd779=_0x549935;return logger[_0x3fd779(0x280)](_0x3fd779(0x1f3),_0x3e96ea),db[_0x3fd779(0x1ce)][_0x3fd779(0x28b)]({'where':{'ContactId':[_0x102609['body']['to'],_0x102609[_0x3fd779(0x256)]['from']]}})[_0x3fd779(0x275)](function(_0x1521f4){const _0x544c99=_0x3fd779;return logger[_0x544c99(0x280)](_0x544c99(0x247),_0x1521f4),db[_0x544c99(0x296)][_0x544c99(0x246)](_0x247052);});});})[_0x426576(0x275)](function(_0x4f8788){const _0x3de148=_0x426576;if(_0x4f8788)return _0x431efc=_0x4f8788,_0x147073={'ContactId':_0x431efc['id']},_0x554beb={'where':{'ContactId':[_0x102609['body']['to'],_0x102609[_0x3de148(0x256)][_0x3de148(0x1f8)]]}},db[_0x3de148(0x29b)][_0x3de148(0x1ea)](_0x147073,_0x554beb);})['then'](function(){const _0x24f0a7=_0x426576;if(_0x431efc)return db['ChatMessage'][_0x24f0a7(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x44cbc8=_0x426576;if(_0x431efc)return db['ChatOfflineMessage'][_0x44cbc8(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x24260f=_0x426576;if(_0x431efc)return db[_0x24260f(0x20d)][_0x24260f(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x5a7e61=_0x426576;if(_0x431efc)return db['MailMessage'][_0x5a7e61(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x1ddac0=_0x426576;if(_0x431efc)return db[_0x1ddac0(0x20d)][_0x1ddac0(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x539f29=_0x426576;if(_0x431efc)return db[_0x539f29(0x1df)][_0x539f29(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x44bf39=_0x426576;if(_0x431efc)return db[_0x44bf39(0x27e)][_0x44bf39(0x1ea)](_0x147073,_0x554beb);})['then'](function(){const _0x551502=_0x426576;if(_0x431efc)return db[_0x551502(0x26d)][_0x551502(0x1ea)](_0x147073,_0x554beb);})['then'](function(){const _0x26186c=_0x426576;if(_0x431efc)return db[_0x26186c(0x254)][_0x26186c(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x16702f=_0x426576;if(_0x431efc)return db[_0x16702f(0x214)]['update'](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x3e42ed=_0x426576;if(_0x431efc)return db['OpenchannelInteraction'][_0x3e42ed(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x3700e5=_0x426576;if(_0x431efc)return db[_0x3700e5(0x28d)][_0x3700e5(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x1bd5de=_0x426576;if(_0x431efc)return db['CmHopperFinal'][_0x1bd5de(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x25031b=_0x426576;if(_0x431efc)return db[_0x25031b(0x1e8)][_0x25031b(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x3da071=_0x426576;if(_0x431efc)return db[_0x3da071(0x267)]['update'](_0x147073,_0x554beb);})['then'](function(){const _0x34aba2=_0x426576;if(_0x431efc)return db[_0x34aba2(0x239)]['update'](_0x147073,_0x554beb);})['then'](function(){const _0x4029bf=_0x426576;if(_0x431efc)return db[_0x4029bf(0x20e)][_0x4029bf(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x4498b7=_0x426576;if(_0x431efc)return db['FaxQueueReport'][_0x4498b7(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x278fd1=_0x426576;if(_0x431efc)return db[_0x278fd1(0x200)][_0x278fd1(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x289d41=_0x426576;if(_0x431efc)return db['OpenchannelQueueReport'][_0x289d41(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x493df7=_0x426576;if(_0x431efc)return db[_0x493df7(0x294)][_0x493df7(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x481597=_0x426576;if(_0x431efc)return db[_0x481597(0x276)][_0x481597(0x1ea)](_0x147073,_0x554beb);})[_0x426576(0x275)](function(){const _0x5e73f8=_0x426576;if(_0x431efc)return db[_0x5e73f8(0x296)][_0x5e73f8(0x28b)]({'where':{'id':[_0x102609[_0x5e73f8(0x256)]['to'],_0x102609[_0x5e73f8(0x256)][_0x5e73f8(0x1f8)]]}});})[_0x426576(0x275)](function(){if(_0x431efc)return _0x431efc;})[_0x426576(0x275)](respondWithResult(_0x2a0812,null))[_0x426576(0x299)](handleError(_0x2a0812,null));},exports['create']=function(_0x2cf64c,_0xb57b1f){const _0x431933=a151_0x115ae4;return db['CmContact'][_0x431933(0x1d1)]()['then'](function(_0x1f786e){const _0xda2d9a=_0x431933;return _0x2cf64c[_0xda2d9a(0x256)]['tags']&&_[_0xda2d9a(0x263)](_0x2cf64c[_0xda2d9a(0x256)]['tags'])?_0x2cf64c[_0xda2d9a(0x256)][_0xda2d9a(0x21a)][_0xda2d9a(0x25c)]?_0x2cf64c[_0xda2d9a(0x256)][_0xda2d9a(0x21a)]=_0x2cf64c[_0xda2d9a(0x256)][_0xda2d9a(0x21a)]['join'](';')+';':_0x2cf64c['body'][_0xda2d9a(0x21a)]=null:_0x2cf64c[_0xda2d9a(0x256)][_0xda2d9a(0x21a)]=null,db[_0xda2d9a(0x296)][_0xda2d9a(0x246)](_0x2cf64c['body'],{'fields':_['keys'](_0x1f786e),'raw':!![]});})['then'](respondWithResult(_0xb57b1f,0xc9))['catch'](handleError(_0xb57b1f,null));},exports[a151_0x115ae4(0x1d8)]=function(_0x374ca6,_0x5d6b3a){const _0x180e08=a151_0x115ae4;let _0x3d7e37=0x0,_0x49624b=0x0,_0x3ea04b=0x0;return db[_0x180e08(0x296)][_0x180e08(0x1d1)]()[_0x180e08(0x275)](function(_0x2d900d){const _0x4bb80f=_0x180e08;return Promise[_0x4bb80f(0x213)](_0x374ca6[_0x4bb80f(0x256)][_0x4bb80f(0x236)](_0x19c964=>{const _0xc40007=_0x4bb80f,_0x16d85e={'where':{[Op['or']]:[]},'defaults':_0x19c964,'fields':_[_0xc40007(0x1fc)](_0x2d900d),'raw':!![]};if(_0x19c964[_0xc40007(0x289)]){for(let _0x95e21f=0x0;_0x95e21f<_0x19c964['duplicates'][_0xc40007(0x25c)];_0x95e21f++){const _0xad1af7={};_0xad1af7[_0x19c964[_0xc40007(0x289)][_0x95e21f]]=_0x19c964[_0x19c964[_0xc40007(0x289)][_0x95e21f]],_0x16d85e['where'][Op['or']][_0xc40007(0x284)](_0xad1af7);}_0x16d85e[_0xc40007(0x24d)][_0xc40007(0x20f)]=_0x19c964['ListId'];}return db['CmContact'][_0xc40007(0x290)](_0x16d85e)[_0xc40007(0x275)](function([,_0x30caed]){_0x30caed?_0x3d7e37++:_0x3ea04b++;})[_0xc40007(0x299)](function(_0x52f358){const _0x526747=_0xc40007;console[_0x526747(0x22b)](_0x52f358),_0x49624b++;});}));})['then'](function(_0x1b66b1){if(_0x1b66b1)return{'success':_0x3d7e37,'failure':_0x49624b,'duplicates':_0x3ea04b};})['then'](respondWithResult(_0x5d6b3a,0xc9))[_0x180e08(0x299)](handleError(_0x5d6b3a,null));},exports[a151_0x115ae4(0x204)]=function(_0x4df336,_0x4785ef){const _0x5ca9a9=a151_0x115ae4;let _0x423fc7;return db['CmContact']['describe']()['then'](function(_0x53827c){const _0x2a861b=a151_0x1ad1;return db[_0x2a861b(0x296)][_0x2a861b(0x22c)]({'where':{'id':_0x4df336['params']['id']},'include':[{'model':db[_0x2a861b(0x1d3)],'as':_0x2a861b(0x24b),'attributes':['id',_0x2a861b(0x1d2),_0x2a861b(0x238)],'required':_0x4df336[_0x2a861b(0x28a)][_0x2a861b(0x260)]?!![]:![]}],'attributes':_[_0x2a861b(0x1fc)](_0x53827c)});})['then'](function(_0x2d4a2d){const _0x2eab2e=a151_0x1ad1;_0x423fc7=_0x2d4a2d[_0x2eab2e(0x277)]({'plain':!![]});const _0x3be096={'where':{[Op[_0x2eab2e(0x283)]]:[{'ListId':{[Op['ne']]:null}}]}};return _0x2d4a2d&&_0x2d4a2d['ListId']&&(_0x2d4a2d[_0x2eab2e(0x20f)]&&_0x3be096['where'][Op[_0x2eab2e(0x283)]][_0x2eab2e(0x284)]({'ListId':{[Op['ne']]:_0x2d4a2d[_0x2eab2e(0x20f)]}})),db[_0x2eab2e(0x1cc)][_0x2eab2e(0x242)](_0x3be096);})['then'](function(_0x1ab691){const _0x44aff3=a151_0x1ad1;return _[_0x44aff3(0x1f6)](_0x423fc7,_[_0x44aff3(0x236)](_0x1ab691,function(_0xc976fc){const _0x2cd60c=_0x44aff3;return util[_0x2cd60c(0x1e6)](_0x2cd60c(0x1f9),_0xc976fc['id']);}));})['then'](handleEntityNotFound(_0x4785ef,null))['then'](respondWithResult(_0x4785ef,null))[_0x5ca9a9(0x299)](handleError(_0x4785ef,null));},exports[a151_0x115ae4(0x1ea)]=function(_0x2ac3f1,_0xf460c0){const _0x2b00db=a151_0x115ae4;let _0x2e3831;return _0x2ac3f1[_0x2b00db(0x256)]['id']&&delete _0x2ac3f1[_0x2b00db(0x256)]['id'],db[_0x2b00db(0x296)][_0x2b00db(0x22c)]({'where':{'id':_0x2ac3f1[_0x2b00db(0x291)]['id']}})[_0x2b00db(0x275)](handleEntityNotFound(_0xf460c0,null))['then'](saveUpdates(_0x2ac3f1[_0x2b00db(0x256)],null))[_0x2b00db(0x275)](function(_0x2b3bc4){const _0x4806d4=_0x2b00db;_0x2e3831=_0x2b3bc4;const _0x144f98={'where':{[Op['and']]:[{'ListId':{[Op['ne']]:null}}]}};return _0x2b3bc4&&_0x2b3bc4['ListId']&&(_0x2b3bc4['ListId']&&_0x144f98['where'][Op[_0x4806d4(0x283)]]['push']({'ListId':{[Op['ne']]:_0x2b3bc4[_0x4806d4(0x20f)]}})),db['CmCustomField']['findAll'](_0x144f98);})[_0x2b00db(0x275)](function(_0x506142){const _0x5641cc=_0x2b00db;if(_0x506142)return _[_0x5641cc(0x1f6)](_[_0x5641cc(0x1dd)](_0x2ac3f1[_0x5641cc(0x256)],function(_0x1ba977,_0x4779ec){const _0xb2ce6=_0x5641cc;return _[_0xb2ce6(0x1eb)](_0x4779ec,'cf_');}),_[_0x5641cc(0x236)](_0x506142,function(_0x3ccafe){const _0x123515=_0x5641cc;return util['format'](_0x123515(0x1f9),_0x3ccafe['id']);}));})[_0x2b00db(0x275)](function(_0x1e9e8f){const _0x4ffbc6=_0x2b00db;if(_0x1e9e8f&&!_[_0x4ffbc6(0x258)](_0x1e9e8f)){const _0x154e27=squel[_0x4ffbc6(0x1ea)]()[_0x4ffbc6(0x229)](_0x4ffbc6(0x216))[_0x4ffbc6(0x28c)](_0x1e9e8f)[_0x4ffbc6(0x24d)]('id\x20=\x20?',_0x2ac3f1[_0x4ffbc6(0x291)]['id'])['toParam']();return db[_0x4ffbc6(0x1e3)][_0x4ffbc6(0x28a)](_0x154e27[_0x4ffbc6(0x26f)],{'replacements':_0x154e27['values']});}})[_0x2b00db(0x275)](function(){const _0x4ef99f=_0x2b00db;if(_0x2ac3f1[_0x4ef99f(0x256)][_0x4ef99f(0x237)]&&_0x2e3831)return db['CmHopper'][_0x4ef99f(0x1ea)]({'phone':_0x2ac3f1['body'][_0x4ef99f(0x237)]},{'where':{'ContactId':_0x2e3831['id']}});})['then'](function(){return _0x2e3831;})[_0x2b00db(0x275)](respondWithResult(_0xf460c0,null))['catch'](handleError(_0xf460c0,null));},exports[a151_0x115ae4(0x217)]=function(_0xa3b182,_0x59e345){const _0x4a7526=a151_0x115ae4;let _0x29e7a9={};const _0x2631d0={};let _0x45fa03,_0x24078e;return db[_0x4a7526(0x296)][_0x4a7526(0x22c)]({'where':{'id':_0xa3b182['params']['id']}})[_0x4a7526(0x275)](handleEntityNotFound(_0x59e345,null))[_0x4a7526(0x275)](function(_0x2c3bce){const _0x21a97d=_0x4a7526;if(_0x2c3bce)return _0x45fa03=_0x2c3bce,_0x2631d0[_0x21a97d(0x25b)]=_['keys'](db[_0x21a97d(0x1d3)][_0x21a97d(0x212)]),_0x2631d0[_0x21a97d(0x28a)]=_[_0x21a97d(0x1fc)](_0xa3b182[_0x21a97d(0x28a)]),_0x2631d0[_0x21a97d(0x1e7)]=_[_0x21a97d(0x285)](_0x2631d0[_0x21a97d(0x25b)],_0x2631d0[_0x21a97d(0x28a)]),_0x29e7a9[_0x21a97d(0x253)]=_[_0x21a97d(0x285)](_0x2631d0['model'],qs[_0x21a97d(0x205)](_0xa3b182[_0x21a97d(0x28a)][_0x21a97d(0x205)])),_0x29e7a9[_0x21a97d(0x253)]=_0x29e7a9[_0x21a97d(0x253)][_0x21a97d(0x25c)]?_0x29e7a9[_0x21a97d(0x253)]:_0x2631d0[_0x21a97d(0x25b)],_0x29e7a9[_0x21a97d(0x21f)]=qs['sort'](_0xa3b182[_0x21a97d(0x28a)][_0x21a97d(0x22e)]),_0x29e7a9[_0x21a97d(0x24d)]=qs[_0x21a97d(0x1e7)](_[_0x21a97d(0x244)](_0xa3b182[_0x21a97d(0x28a)],_0x2631d0['filters'])),_0xa3b182['query'][_0x21a97d(0x298)]&&(_0x29e7a9['where']=_[_0x21a97d(0x1d4)](_0x29e7a9[_0x21a97d(0x24d)],{[Op['or']]:_[_0x21a97d(0x236)](_0x29e7a9['attributes'],function(_0x3afc20){const _0x184cdd=_0x21a97d,_0x134f24={};return _0x134f24[_0x3afc20]={[Op[_0x184cdd(0x231)]]:'%'+_0xa3b182[_0x184cdd(0x28a)][_0x184cdd(0x298)]+'%'},_0x134f24;})})),_0x29e7a9=_[_0x21a97d(0x1d4)]({},_0x29e7a9,_0xa3b182[_0x21a97d(0x225)]),_0x45fa03[_0x21a97d(0x217)](_0x29e7a9);})[_0x4a7526(0x275)](function(_0x2314d6){const _0x494f1d=_0x4a7526;if(_0x2314d6)return _0x24078e=_0x2314d6[_0x494f1d(0x25c)],typeof _0xa3b182[_0x494f1d(0x28a)][_0x494f1d(0x228)]==='undefined'&&(_0x29e7a9[_0x494f1d(0x201)]=qs[_0x494f1d(0x201)](_0xa3b182['query']['limit']),_0x29e7a9['offset']=qs['offset'](_0xa3b182[_0x494f1d(0x28a)]['offset'])),_0x45fa03[_0x494f1d(0x217)](_0x29e7a9);})[_0x4a7526(0x275)](function(_0x28fe7f){if(_0x28fe7f)return _0x28fe7f?{'count':_0x24078e,'rows':_0x28fe7f}:null;})[_0x4a7526(0x275)](respondWithResult(_0x59e345,null))[_0x4a7526(0x299)](handleError(_0x59e345,null));},exports['setTags']=function(_0x796e13,_0x449f09){const _0x1e9db3=a151_0x115ae4;return _0x796e13['body']['id']&&delete _0x796e13['body']['id'],db[_0x1e9db3(0x296)][_0x1e9db3(0x22c)]({'where':{'id':_0x796e13[_0x1e9db3(0x291)]['id']}})[_0x1e9db3(0x275)](handleEntityNotFound(_0x449f09,null))[_0x1e9db3(0x275)](function(_0x21d741){const _0x63cd80=_0x1e9db3;if(_0x21d741)return _0x21d741['setTags'](_0x796e13['body'][_0x63cd80(0x261)]||[]);return null;})[_0x1e9db3(0x275)](respondWithResult(_0x449f09,null))['catch'](handleError(_0x449f09,null));},exports[a151_0x115ae4(0x221)]=function(_0x4e927c,_0x32728c){const _0x5a5198=a151_0x115ae4;let _0x43596d={'raw':![],'where':{}};const _0x53f9ea={},_0x51db80={'count':0x0,'rows':[]};return db[_0x5a5198(0x296)][_0x5a5198(0x22c)]({'where':{'id':_0x4e927c[_0x5a5198(0x291)]['id']}})[_0x5a5198(0x275)](handleEntityNotFound(_0x32728c,null))[_0x5a5198(0x275)](function(_0x55d72f){const _0xe6af8c=_0x5a5198;if(_0x55d72f)return _0x53f9ea[_0xe6af8c(0x25b)]=_['keys'](db[_0xe6af8c(0x1da)][_0xe6af8c(0x212)]),_0x53f9ea[_0xe6af8c(0x28a)]=_[_0xe6af8c(0x1fc)](_0x4e927c[_0xe6af8c(0x28a)]),_0x53f9ea[_0xe6af8c(0x1e7)]=_[_0xe6af8c(0x285)](_0x53f9ea[_0xe6af8c(0x25b)],_0x53f9ea[_0xe6af8c(0x28a)]),_0x43596d[_0xe6af8c(0x253)]=_['intersection'](_0x53f9ea[_0xe6af8c(0x25b)],qs['fields'](_0x4e927c['query'][_0xe6af8c(0x205)])),_0x43596d[_0xe6af8c(0x253)]=_0x43596d[_0xe6af8c(0x253)][_0xe6af8c(0x25c)]?_0x43596d[_0xe6af8c(0x253)]:_0x53f9ea[_0xe6af8c(0x25b)],typeof _0x4e927c['query'][_0xe6af8c(0x228)]===_0xe6af8c(0x226)&&(_0x43596d['limit']=qs[_0xe6af8c(0x201)](_0x4e927c[_0xe6af8c(0x28a)]['limit']),_0x43596d['offset']=qs[_0xe6af8c(0x27f)](_0x4e927c['query'][_0xe6af8c(0x27f)])),_0x43596d['order']=qs['sort'](_0x4e927c[_0xe6af8c(0x28a)][_0xe6af8c(0x22e)]),_0x43596d[_0xe6af8c(0x24d)]=qs['filters'](_[_0xe6af8c(0x244)](_0x4e927c['query'],_0x53f9ea[_0xe6af8c(0x1e7)])),_0x43596d[_0xe6af8c(0x24d)][_0xe6af8c(0x270)]=_0x55d72f['id'],_0x4e927c['query'][_0xe6af8c(0x298)]&&(_0x43596d[_0xe6af8c(0x24d)]=_['merge'](_0x43596d[_0xe6af8c(0x24d)],{[Op['or']]:_['map'](_0x43596d[_0xe6af8c(0x253)],function(_0xe2670){const _0x36b4bb=_0xe6af8c,_0x47f1fb={};return _0x47f1fb[_0xe2670]={[Op[_0x36b4bb(0x231)]]:'%'+_0x4e927c[_0x36b4bb(0x28a)][_0x36b4bb(0x298)]+'%'},_0x47f1fb;})})),_0x43596d=_['merge']({},_0x43596d,_0x4e927c['options']),db[_0xe6af8c(0x1da)][_0xe6af8c(0x271)]({'where':_0x43596d[_0xe6af8c(0x24d)]})['then'](function(_0x392df6){const _0x32a301=_0xe6af8c;return _0x51db80['count']=_0x392df6,_0x4e927c[_0x32a301(0x28a)][_0x32a301(0x257)]&&(_0x43596d['include']=[{'all':!![]}]),db['CmHopper']['findAll'](_0x43596d);})[_0xe6af8c(0x275)](function(_0x545ffc){const _0x4eadc5=_0xe6af8c;return _0x51db80[_0x4eadc5(0x1d0)]=_0x545ffc,_0x51db80;});})['then'](respondWithFilteredResult(_0x32728c,_0x43596d))[_0x5a5198(0x299)](handleError(_0x32728c,null));},exports[a151_0x115ae4(0x20a)]=function(_0x1e40fc,_0x3a0ac1){const _0x216fa5=a151_0x115ae4;let _0x46cee4={'raw':!![],'where':{}};const _0x53ce5f={},_0x3535b6={'count':0x0,'rows':[]};return db[_0x216fa5(0x296)][_0x216fa5(0x22c)]({'where':{'id':_0x1e40fc['params']['id']}})[_0x216fa5(0x275)](handleEntityNotFound(_0x3a0ac1,null))['then'](function(_0xb59654){const _0x14fbf2=_0x216fa5;if(_0xb59654)return _0x53ce5f[_0x14fbf2(0x25b)]=_[_0x14fbf2(0x1fc)](db['CmHopperHistory'][_0x14fbf2(0x212)]),_0x53ce5f['query']=_[_0x14fbf2(0x1fc)](_0x1e40fc[_0x14fbf2(0x28a)]),_0x53ce5f['filters']=_['intersection'](_0x53ce5f['model'],_0x53ce5f['query']),_0x46cee4[_0x14fbf2(0x253)]=_[_0x14fbf2(0x285)](_0x53ce5f[_0x14fbf2(0x25b)],qs['fields'](_0x1e40fc[_0x14fbf2(0x28a)][_0x14fbf2(0x205)])),_0x46cee4['attributes']=_0x46cee4[_0x14fbf2(0x253)][_0x14fbf2(0x25c)]?_0x46cee4['attributes']:_0x53ce5f['model'],typeof _0x1e40fc[_0x14fbf2(0x28a)][_0x14fbf2(0x228)]===_0x14fbf2(0x226)&&(_0x46cee4['limit']=qs['limit'](_0x1e40fc[_0x14fbf2(0x28a)][_0x14fbf2(0x201)]),_0x46cee4['offset']=qs[_0x14fbf2(0x27f)](_0x1e40fc[_0x14fbf2(0x28a)]['offset'])),_0x46cee4[_0x14fbf2(0x21f)]=qs[_0x14fbf2(0x22e)](_0x1e40fc[_0x14fbf2(0x28a)][_0x14fbf2(0x22e)]),_0x46cee4[_0x14fbf2(0x24d)]=qs[_0x14fbf2(0x1e7)](_[_0x14fbf2(0x244)](_0x1e40fc[_0x14fbf2(0x28a)],_0x53ce5f[_0x14fbf2(0x1e7)])),_0x46cee4['where']['ContactId']=_0xb59654['id'],_0x1e40fc[_0x14fbf2(0x28a)][_0x14fbf2(0x298)]&&(_0x46cee4[_0x14fbf2(0x24d)]=_['merge'](_0x46cee4['where'],{[Op['or']]:_['map'](_0x46cee4['attributes'],function(_0x3f5fd2){const _0x4887ca=_0x14fbf2,_0xd41a59={};return _0xd41a59[_0x3f5fd2]={[Op[_0x4887ca(0x231)]]:'%'+_0x1e40fc[_0x4887ca(0x28a)][_0x4887ca(0x298)]+'%'},_0xd41a59;})})),_0x46cee4=_[_0x14fbf2(0x1d4)]({},_0x46cee4,_0x1e40fc['options']),db[_0x14fbf2(0x1e8)][_0x14fbf2(0x271)]({'where':_0x46cee4[_0x14fbf2(0x24d)]})[_0x14fbf2(0x275)](function(_0x270560){const _0x2e82b7=_0x14fbf2;return _0x3535b6[_0x2e82b7(0x271)]=_0x270560,_0x1e40fc[_0x2e82b7(0x28a)][_0x2e82b7(0x257)]&&(_0x46cee4['include']=[{'all':!![]}]),db[_0x2e82b7(0x1e8)][_0x2e82b7(0x242)](_0x46cee4);})[_0x14fbf2(0x275)](function(_0x40b34c){const _0x1a0991=_0x14fbf2;return _0x3535b6[_0x1a0991(0x1d0)]=_0x40b34c,_0x3535b6;});})[_0x216fa5(0x275)](respondWithFilteredResult(_0x3a0ac1,_0x46cee4))[_0x216fa5(0x299)](handleError(_0x3a0ac1,null));},exports['getHopperFinals']=function(_0x4c6b92,_0x3efbfb){const _0x570c1f=a151_0x115ae4;let _0x4e0db6={'raw':!![],'where':{}};const _0x5c0c62={},_0x5507c9={'count':0x0,'rows':[]};return db[_0x570c1f(0x296)][_0x570c1f(0x22c)]({'where':{'id':_0x4c6b92['params']['id']}})['then'](handleEntityNotFound(_0x3efbfb,null))[_0x570c1f(0x275)](function(_0x211ea7){const _0x81ad5e=_0x570c1f;if(_0x211ea7)return _0x5c0c62['model']=_['keys'](db[_0x81ad5e(0x1f7)][_0x81ad5e(0x212)]),_0x5c0c62['query']=_[_0x81ad5e(0x1fc)](_0x4c6b92[_0x81ad5e(0x28a)]),_0x5c0c62[_0x81ad5e(0x1e7)]=_[_0x81ad5e(0x285)](_0x5c0c62[_0x81ad5e(0x25b)],_0x5c0c62[_0x81ad5e(0x28a)]),_0x4e0db6[_0x81ad5e(0x253)]=_[_0x81ad5e(0x285)](_0x5c0c62[_0x81ad5e(0x25b)],qs[_0x81ad5e(0x205)](_0x4c6b92[_0x81ad5e(0x28a)][_0x81ad5e(0x205)])),_0x4e0db6[_0x81ad5e(0x253)]=_0x4e0db6['attributes'][_0x81ad5e(0x25c)]?_0x4e0db6[_0x81ad5e(0x253)]:_0x5c0c62[_0x81ad5e(0x25b)],typeof _0x4c6b92[_0x81ad5e(0x28a)][_0x81ad5e(0x228)]===_0x81ad5e(0x226)&&(_0x4e0db6[_0x81ad5e(0x201)]=qs[_0x81ad5e(0x201)](_0x4c6b92[_0x81ad5e(0x28a)][_0x81ad5e(0x201)]),_0x4e0db6[_0x81ad5e(0x27f)]=qs[_0x81ad5e(0x27f)](_0x4c6b92[_0x81ad5e(0x28a)][_0x81ad5e(0x27f)])),_0x4e0db6[_0x81ad5e(0x21f)]=qs[_0x81ad5e(0x22e)](_0x4c6b92[_0x81ad5e(0x28a)][_0x81ad5e(0x22e)]),_0x4e0db6[_0x81ad5e(0x24d)]=qs[_0x81ad5e(0x1e7)](_[_0x81ad5e(0x244)](_0x4c6b92[_0x81ad5e(0x28a)],_0x5c0c62[_0x81ad5e(0x1e7)])),_0x4e0db6[_0x81ad5e(0x24d)][_0x81ad5e(0x270)]=_0x211ea7['id'],_0x4c6b92[_0x81ad5e(0x28a)][_0x81ad5e(0x298)]&&(_0x4e0db6[_0x81ad5e(0x24d)]=_[_0x81ad5e(0x1d4)](_0x4e0db6[_0x81ad5e(0x24d)],{[Op['or']]:_[_0x81ad5e(0x236)](_0x4e0db6[_0x81ad5e(0x253)],function(_0x6683bf){const _0x3849f2=_0x81ad5e,_0xbcab24={};return _0xbcab24[_0x6683bf]={[Op[_0x3849f2(0x231)]]:'%'+_0x4c6b92[_0x3849f2(0x28a)]['filter']+'%'},_0xbcab24;})})),_0x4e0db6=_[_0x81ad5e(0x1d4)]({},_0x4e0db6,_0x4c6b92[_0x81ad5e(0x225)]),db[_0x81ad5e(0x1f7)]['count']({'where':_0x4e0db6[_0x81ad5e(0x24d)]})[_0x81ad5e(0x275)](function(_0xfaa4cc){const _0x4ed600=_0x81ad5e;return _0x5507c9['count']=_0xfaa4cc,_0x4c6b92['query'][_0x4ed600(0x257)]&&(_0x4e0db6[_0x4ed600(0x1ee)]=[{'all':!![]}]),db[_0x4ed600(0x1f7)][_0x4ed600(0x242)](_0x4e0db6);})[_0x81ad5e(0x275)](function(_0x2faaa2){const _0x169db0=_0x81ad5e;return _0x5507c9[_0x169db0(0x1d0)]=_0x2faaa2,_0x5507c9;});})[_0x570c1f(0x275)](respondWithFilteredResult(_0x3efbfb,_0x4e0db6))['catch'](handleError(_0x3efbfb,null));},exports[a151_0x115ae4(0x282)]=function(_0x23f606,_0x3ae928){const _0x224038=a151_0x115ae4;let _0x555a63={'raw':!![],'where':{}};const _0xd5439c={},_0x175103={'count':0x0,'rows':[]};return db[_0x224038(0x296)]['findOne']({'where':{'id':_0x23f606[_0x224038(0x291)]['id']}})['then'](handleEntityNotFound(_0x3ae928,null))[_0x224038(0x275)](function(_0x27d7f7){const _0x5efc44=_0x224038;if(_0x27d7f7)return _0xd5439c['model']=_[_0x5efc44(0x1fc)](db['JscriptySessionReport'][_0x5efc44(0x212)]),_0xd5439c[_0x5efc44(0x28a)]=_['keys'](_0x23f606[_0x5efc44(0x28a)]),_0xd5439c[_0x5efc44(0x1e7)]=_[_0x5efc44(0x285)](_0xd5439c['model'],_0xd5439c['query']),_0x555a63[_0x5efc44(0x253)]=_[_0x5efc44(0x285)](_0xd5439c[_0x5efc44(0x25b)],qs[_0x5efc44(0x205)](_0x23f606[_0x5efc44(0x28a)][_0x5efc44(0x205)])),_0x555a63['attributes']=_0x555a63[_0x5efc44(0x253)][_0x5efc44(0x25c)]?_0x555a63[_0x5efc44(0x253)]:_0xd5439c[_0x5efc44(0x25b)],typeof _0x23f606[_0x5efc44(0x28a)][_0x5efc44(0x228)]===_0x5efc44(0x226)&&(_0x555a63['limit']=qs[_0x5efc44(0x201)](_0x23f606['query'][_0x5efc44(0x201)]),_0x555a63['offset']=qs['offset'](_0x23f606[_0x5efc44(0x28a)][_0x5efc44(0x27f)])),_0x555a63[_0x5efc44(0x21f)]=qs[_0x5efc44(0x22e)](_0x23f606[_0x5efc44(0x28a)][_0x5efc44(0x22e)]),_0x555a63[_0x5efc44(0x24d)]=qs['filters'](_[_0x5efc44(0x244)](_0x23f606[_0x5efc44(0x28a)],_0xd5439c['filters'])),_0x555a63[_0x5efc44(0x24d)][_0x5efc44(0x270)]=_0x27d7f7['id'],_0x23f606[_0x5efc44(0x28a)]['filter']&&(_0x555a63[_0x5efc44(0x24d)]=_['merge'](_0x555a63[_0x5efc44(0x24d)],{[Op['or']]:_['map'](_0x555a63[_0x5efc44(0x253)],function(_0x57e48d){const _0x44f1dc=_0x5efc44,_0x430fdd={};return _0x430fdd[_0x57e48d]={[Op[_0x44f1dc(0x231)]]:'%'+_0x23f606[_0x44f1dc(0x28a)][_0x44f1dc(0x298)]+'%'},_0x430fdd;})})),_0x555a63=_[_0x5efc44(0x1d4)]({},_0x555a63,_0x23f606[_0x5efc44(0x225)]),db[_0x5efc44(0x276)][_0x5efc44(0x271)]({'where':_0x555a63[_0x5efc44(0x24d)]})[_0x5efc44(0x275)](function(_0x425654){const _0xd3337b=_0x5efc44;return _0x175103[_0xd3337b(0x271)]=_0x425654,_0x23f606[_0xd3337b(0x28a)][_0xd3337b(0x257)]&&(_0x555a63[_0xd3337b(0x1ee)]=[{'all':!![]}]),db[_0xd3337b(0x276)][_0xd3337b(0x242)](_0x555a63);})[_0x5efc44(0x275)](function(_0x55dcc1){const _0x5239ec=_0x5efc44;return _0x175103[_0x5239ec(0x1d0)]=_0x55dcc1,_0x175103;});})[_0x224038(0x275)](respondWithFilteredResult(_0x3ae928,_0x555a63))[_0x224038(0x299)](handleError(_0x3ae928,null));},exports[a151_0x115ae4(0x269)]=function(_0x1097a3,_0x588b1b){const _0x5a8e15=a151_0x115ae4,_0x2be906=fs[_0x5a8e15(0x223)](_0x1097a3[_0x5a8e15(0x23e)]['path']);Papa[_0x5a8e15(0x20c)](_0x2be906,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x83cfba){const _0x379bf0=_0x5a8e15;return _0x588b1b[_0x379bf0(0x202)](0xc8)['json']({'file':_0x1097a3[_0x379bf0(0x23e)],'fields':_0x83cfba[_0x379bf0(0x24f)][_0x379bf0(0x205)]});}});},exports[a151_0x115ae4(0x27b)]=function(_0x564efa,_0x2389b6){const _0x26832f=a151_0x115ae4;return db[_0x26832f(0x219)][_0x26832f(0x242)]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x26832f(0x275)](function(_0x1f8176){const _0x323f83=_0x26832f;let _0x3c3134=![];if(!_0x564efa[_0x323f83(0x256)][_0x323f83(0x20f)])throw new Error('No\x20ListId\x20specified');if(!_0x564efa[_0x323f83(0x256)][_0x323f83(0x272)][_0x323f83(0x237)])throw new Error(_0x323f83(0x232));if(!_0x564efa[_0x323f83(0x256)][_0x323f83(0x272)][_0x323f83(0x252)])throw new Error(_0x323f83(0x25e));if(!_0x564efa['body'][_0x323f83(0x262)])throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');const _0xe8b364=path[_0x323f83(0x264)](config[_0x323f83(0x255)],_0x323f83(0x203),_0x564efa[_0x323f83(0x291)]['id']),_0x3f48ff=JSON[_0x323f83(0x1ec)](_0x564efa[_0x323f83(0x256)]),_0x1c0553=JSON[_0x323f83(0x1ec)](_0x1f8176);logger[_0x323f83(0x280)]('Calling\x20'+CSV2_SCRIPT+_0x323f83(0x1ef)+_0xe8b364+_0x323f83(0x220)+_0x3f48ff+_0x323f83(0x28f)+_0x1c0553);const _0x64325e=fork(CSV2_SCRIPT,[_0xe8b364,_0x3f48ff,_0x1c0553],{'stdio':_0x323f83(0x27d)});_0x64325e['on'](_0x323f83(0x278),()=>{const _0x6d0735=_0x323f83;return _0x3c3134=!![],_0x2389b6[_0x6d0735(0x202)](0xc8)[_0x6d0735(0x234)]({'message':'start\x20child\x20process\x20correctly!','pid':_0x64325e[_0x6d0735(0x1e1)]});}),_0x64325e['on'](_0x323f83(0x22b),_0x37e9d8=>{const _0x14489b=_0x323f83;logger['error'](_0x14489b(0x23c)+CSV2_SCRIPT+_0x14489b(0x1fa)+_0x37e9d8[_0x14489b(0x278)]+'\x20'+_0x37e9d8['stack']);}),_0x64325e[_0x323f83(0x1f2)]&&_0x64325e[_0x323f83(0x274)]?(_0x64325e[_0x323f83(0x23d)]['on']('data',_0xd4a09=>{const _0x5e9571=_0x323f83;logger['info'](_0x5e9571(0x29a)+_0xd4a09);}),_0x64325e['stderr']['on'](_0x323f83(0x26c),_0x319139=>{const _0x45e2df=_0x323f83;logger[_0x45e2df(0x22b)](_0x45e2df(0x26e)+_0x319139);})):logger[_0x323f83(0x280)](_0x323f83(0x1fd)),_0x64325e['on'](_0x323f83(0x297),_0x4f68cb=>{const _0x1086e7=_0x323f83;if(_0x4f68cb&&!_0x3c3134)return _0x2389b6[_0x1086e7(0x202)](0x1f4)[_0x1086e7(0x234)]({'message':_0x1086e7(0x26a),'pid':_0x64325e[_0x1086e7(0x1e1)]});});})['catch'](handleError(_0x2389b6,null));};
\ No newline at end of file