Built motion from commit ec3309576.|1.0.33
[motion.git] / server / api / contact_manager / contact_manager.controller.js
index 9739529..0b9b689 100644 (file)
@@ -1 +1 @@
-var _0xb8f0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D\x48\x69\x73\x74\x6F\x72\x79","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x46\x61\x78\x52\x6F\x6F\x6D","\x53\x6D\x73\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x4C\x69\x73\x74","\x43\x6F\x6D\x70\x61\x6E\x79","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x54\x61\x67","\x54\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x72\x65\x61\x6D","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x62\x6C\x75\x65\x62\x69\x72\x64","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x72\x65\x73\x6F\x6C\x76\x65","\x65\x78\x74\x72\x61\x63\x74\x41\x6C\x6C","\x69\x64","\x66\x69\x72\x73\x74\x4E\x61\x6D\x65","\x46\x69\x72\x73\x74\x20\x4E\x61\x6D\x65","\x6C\x61\x73\x74\x4E\x61\x6D\x65","\x4C\x61\x73\x74\x20\x4E\x61\x6D\x65","\x74\x61\x67\x73","\x54\x61\x67\x73","\x73\x74\x72\x65\x65\x74","\x53\x74\x72\x65\x65\x74","\x70\x6F\x73\x74\x61\x6C\x43\x6F\x64\x65","\x50\x6F\x73\x74\x61\x6C\x20\x43\x6F\x64\x65","\x63\x69\x74\x79","\x43\x69\x74\x79","\x63\x6F\x75\x6E\x74\x72\x79","\x43\x6F\x75\x6E\x74\x72\x79","\x64\x61\x74\x65\x4F\x66\x42\x69\x72\x74\x68","\x44\x61\x74\x65\x20\x6F\x66\x20\x62\x69\x72\x74\x68","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x70\x68\x6F\x6E\x65","\x50\x68\x6F\x6E\x65","\x6D\x6F\x62\x69\x6C\x65","\x4D\x6F\x62\x69\x6C\x65","\x66\x61\x78","\x46\x61\x78","\x65\x6D\x61\x69\x6C","\x45\x6D\x61\x69\x6C","\x75\x72\x6C","\x55\x52\x4C","\x43\x6F\x6D\x70\x61\x6E\x79\x49\x64","\x4C\x69\x73\x74\x49\x64","\x72\x6F\x77\x73","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64","\x6E\x61\x6D\x65","","\x66\x6F\x72\x45\x61\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x2C","\x6A\x6F\x69\x6E","\x20\x61\x73\x20\x27","\x61\x6C\x69\x61\x73","\x27","\x6D\x61\x70","\x53\x45\x4C\x45\x43\x54\x20\x69\x64\x2C\x25\x73\x20\x46\x52\x4F\x4D\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x20\x49\x4E\x20\x28\x27\x25\x73\x27\x29\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73","\x27\x2C\x27","\x6F\x72\x64\x65\x72","\x71\x75\x65\x72\x79","\x69\x64\x20\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x6B\x65\x79\x73","\x63\x66\x5F","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x66\x69\x6C\x74\x65\x72","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x63\x6F\x75\x6E\x74","\x64\x65\x73\x63\x72\x69\x62\x65","\x63\x6F\x6E\x63\x61\x74","\x6D\x65\x72\x67\x65\x63\x6F\x6E\x74\x61\x63\x74","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6C\x69\x73\x74","\x63\x6F\x6D\x70\x61\x6E\x79","\x63\x6F\x6D\x70\x61\x6E\x79\x5F\x6C\x69\x73\x74\x5F\x66\x69\x6C\x74\x65\x72","\x73\x63\x6F\x70\x65","\x67\x65\x74\x4C\x69\x73\x74\x73","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x67\x65\x74\x4C\x6F\x67","\x64\x65\x74\x61\x69\x6C","\x67\x65\x6E\x65\x72\x61\x6C","\x73\x68\x6F\x77","\x6C\x6F\x67\x54\x79\x70\x65","\x6A\x6F\x75\x72\x6E\x61\x6C","\x74\x79\x70\x65","\x69\x6E\x62\x6F\x75\x6E\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E","\x73\x6F\x75\x72\x63\x65","\x66\x72\x6F\x6D","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x63\x6F\x6E\x74\x61\x63\x74","\x63\x68\x61\x74","\x73\x6D\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x71\x75\x65\x75\x65","\x70\x61\x72\x61\x6D\x73","\x6E\x75\x6C\x6C","\x53\x45\x4C\x45\x43\x54\x20\x25\x73\x20\x46\x52\x4F\x4D\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3D\x25\x73","\x67\x65\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x73\x75\x62\x74\x79\x70\x65\x43\x68\x61\x6E\x6E\x65\x6C","\x62\x6F\x64\x79","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x76\x6F\x69\x63\x65","\x6D\x61\x69\x6C","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x74\x61\x63\x74","\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x63\x6F\x6E\x74\x61\x63\x74\x20\x61\x75\x74\x6F\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x65\x72\x72\x6F\x72","\x70\x75\x73\x68","\x67\x65\x74","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x4E\x61\x6D\x65\x20\x6F\x72\x20\x4C\x69\x73\x74\x49\x64\x20\x6D\x69\x73\x73\x69\x6E\x67\x20\x6F\x72\x20\x69\x6E\x76\x61\x6C\x69\x64\x21","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x55\x73\x65\x72\x49\x64","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x3B","\x3F","\x66\x6F\x72\x4F\x77\x6E","\x69\x6E\x73\x65\x72\x74\x49\x64","\x49\x4E\x53\x45\x52\x54\x20\x49\x4E\x54\x4F\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x28\x25\x73\x29\x20\x56\x41\x4C\x55\x45\x53\x20\x28\x25\x73\x29","\x63\x6F\x70\x79","\x25\x73\x3D\x3F","\x55\x50\x44\x41\x54\x45\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x53\x45\x54\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3D\x25\x73","\x63\x6C\x6F\x6E\x65","\x73\x70\x6C\x69\x74","\x70\x6F\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x6C\x6C","\x63\x6F\x6E\x74\x61\x63\x74\x73","\x75\x6E\x69\x6F\x6E","\x73\x74\x61\x63\x6B","\x64\x65\x62\x75\x67","\x6B\x6F","\x66\x61\x69\x6C\x65\x64","\x6F\x6B","\x66\x6F\x72\x45\x61\x63\x68\x4F\x66","\x75\x70\x64\x61\x74\x65","\x6F\x6C\x64\x43\x6F\x6E\x74\x61\x63\x74","\x64\x65\x73\x74\x72\x6F\x79","\x63\x6F\x6E\x74\x61\x63\x74\x2F\x75\x70\x64\x61\x74\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x63\x6F\x6E\x74\x61\x63\x74\x2F\x64\x65\x6C\x65\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xb8f0[0];var _=require(_0xb8f0[1]);var moment=require(_0xb8f0[2]);var Contact=require(_0xb8f0[4])[_0xb8f0[3]];var User=require(_0xb8f0[4])[_0xb8f0[5]];var ContactPhone=require(_0xb8f0[4])[_0xb8f0[6]];var ContactEmail=require(_0xb8f0[4])[_0xb8f0[7]];var CustomField=require(_0xb8f0[4])[_0xb8f0[8]];var ReportCall=require(_0xb8f0[4])[_0xb8f0[9]];var ReportQueue=require(_0xb8f0[4])[_0xb8f0[10]];var ReportQueueHistory=require(_0xb8f0[4])[_0xb8f0[12]][_0xb8f0[11]];var ReportChatRoom=require(_0xb8f0[4])[_0xb8f0[13]];var ReportChatRoomHistory=require(_0xb8f0[4])[_0xb8f0[12]][_0xb8f0[14]];var ChatRoom=require(_0xb8f0[4])[_0xb8f0[15]];var FaxRoom=require(_0xb8f0[4])[_0xb8f0[16]];var SmsRoom=require(_0xb8f0[4])[_0xb8f0[17]];var ReportIntegration=require(_0xb8f0[4])[_0xb8f0[18]];var List=require(_0xb8f0[4])[_0xb8f0[19]];var Company=require(_0xb8f0[4])[_0xb8f0[20]];var ReportCallHistory=require(_0xb8f0[4])[_0xb8f0[12]][_0xb8f0[21]];var ReportMailSession=require(_0xb8f0[4])[_0xb8f0[22]];var MailRoom=require(_0xb8f0[4])[_0xb8f0[23]];var ReportMailSessionHistory=require(_0xb8f0[4])[_0xb8f0[12]][_0xb8f0[24]];var Tag=require(_0xb8f0[4])[_0xb8f0[25]];var TdUpdate=require(_0xb8f0[4])[_0xb8f0[26]];var stream=require(_0xb8f0[27]);var sequelize=require(_0xb8f0[4])[_0xb8f0[28]];var util=require(_0xb8f0[29]);var Util=require(_0xb8f0[30]);var Async=require(_0xb8f0[31]);var Promise=require(_0xb8f0[32]);var logger=require(_0xb8f0[34])(_0xb8f0[33]);exports[_0xb8f0[35]]= function(_0x1260x20,_0x1260x21,_0x1260x22){return Promise[_0xb8f0[40]]()[_0xb8f0[39]](getContacts(_0x1260x20))[_0xb8f0[39]](function(_0x1260x24){_0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x24)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[41]]= function(_0x1260x20,_0x1260x21,_0x1260x22){var _0x1260x25=[_0xb8f0[42],[_0xb8f0[43],_0xb8f0[44]],[_0xb8f0[45],_0xb8f0[46]],[_0xb8f0[47],_0xb8f0[48]],[_0xb8f0[49],_0xb8f0[50]],[_0xb8f0[51],_0xb8f0[52]],[_0xb8f0[53],_0xb8f0[54]],[_0xb8f0[55],_0xb8f0[56]],[_0xb8f0[57],_0xb8f0[58]],[_0xb8f0[59],_0xb8f0[60]],[_0xb8f0[61],_0xb8f0[62]],[_0xb8f0[63],_0xb8f0[64]],[_0xb8f0[65],_0xb8f0[66]],[_0xb8f0[67],_0xb8f0[68]],[_0xb8f0[69],_0xb8f0[70]],_0xb8f0[71],_0xb8f0[72]];return Promise[_0xb8f0[40]]()[_0xb8f0[39]](getContacts(_0x1260x20,_0x1260x25))[_0xb8f0[39]](function(_0x1260x24){_0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x24)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};function getContacts(_0x1260x20,_0x1260x25){return function(){var _0x1260x27,_0x1260x28,_0x1260x29,_0x1260x2a=[],_0x1260x2b=[];switch(_0x1260x20[_0xb8f0[113]][_0xb8f0[116]]){case _0xb8f0[115]:return User[_0xb8f0[114]](_0x1260x20[_0xb8f0[113]][_0xb8f0[42]])[_0xb8f0[39]](function(_0x1260x3b){return _0x1260x3b[_0xb8f0[112]]()})[_0xb8f0[39]](function(_0x1260x2b){_0x1260x28= _[_0xb8f0[85]](_0x1260x2b,_0xb8f0[42]);return Company[_0xb8f0[100]]({attributes:[_0xb8f0[42],_0xb8f0[76]],raw:true})})[_0xb8f0[39]](function(_0x1260x3a){_0x1260x2a= _0x1260x3a;return List[_0xb8f0[100]]({attributes:[_0xb8f0[42],_0xb8f0[76]],raw:true})})[_0xb8f0[39]](function(_0x1260x38){_0x1260x2b= _0x1260x38;_0x1260x29= {CompanyId:_0x1260x20[_0xb8f0[89]][_0xb8f0[71]]|| null,ListId:_0x1260x20[_0xb8f0[89]][_0xb8f0[72]]|| null};delete _0x1260x20[_0xb8f0[89]][_0xb8f0[71]];delete _0x1260x20[_0xb8f0[89]][_0xb8f0[72]];var _0x1260x39=_0x1260x29[_0xb8f0[72]]?{}:{ListId:{$in:_0x1260x28[_0xb8f0[104]](_[_0xb8f0[85]](_[_0xb8f0[97]](_0x1260x2b,{defaultEntry:true}),_0xb8f0[42]))}};if(_0x1260x20[_0xb8f0[89]][_0xb8f0[105]]){_0x1260x39[_0xb8f0[42]]= {$ne:_0x1260x20[_0xb8f0[89]][_0xb8f0[105]]};delete _0x1260x20[_0xb8f0[89]][_0xb8f0[105]]};return Contact[_0xb8f0[111]](_0xb8f0[108],_0xb8f0[109],{method:[_0xb8f0[110],_0x1260x29]})[_0xb8f0[107]](Util[_0xb8f0[106]](_0x1260x20[_0xb8f0[89]],_0x1260x39,{attributes:_0x1260x25,order:_0x1260x20[_0xb8f0[89]][_0xb8f0[88]]|| _0xb8f0[90]}))})[_0xb8f0[39]](function(_0x1260x37){_0x1260x27= {rows:_[_0xb8f0[85]](_0x1260x37[_0xb8f0[73]],_0xb8f0[101]),count:_0x1260x37[_0xb8f0[102]]};return Contact[_0xb8f0[103]]()})[_0xb8f0[39]](function(_0x1260x34){_0x1260x34= _[_0xb8f0[97]](_[_0xb8f0[94]](_0x1260x34),function(_0x1260x35){return _[_0xb8f0[96]](_0x1260x35,_0xb8f0[95])});var _0x1260x36={where:{name:_0x1260x34}};_0x1260x29[_0xb8f0[72]]&& (_0x1260x36[_0xb8f0[99]][_0xb8f0[98]]= [{ListId:_0x1260x29[_0xb8f0[72]]},{ListId:null}]);return CustomField[_0xb8f0[100]](_0x1260x36)})[_0xb8f0[39]](function(_0x1260x31){if(_0x1260x27[_0xb8f0[73]][_0xb8f0[79]]&& _0x1260x31[_0xb8f0[79]]){var _0x1260x32;if(_0x1260x25){_0x1260x32= _[_0xb8f0[85]](_0x1260x31,function(_0x1260x33){return _0x1260x33[_0xb8f0[76]]+ _0xb8f0[82]+ _0x1260x33[_0xb8f0[83]]+ _0xb8f0[84]})[_0xb8f0[81]](_0xb8f0[80])}else {_0x1260x32= _[_0xb8f0[85]](_0x1260x31,_0xb8f0[76])[_0xb8f0[81]](_0xb8f0[80])};return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[86],_0x1260x32,_[_0xb8f0[85]](_0x1260x27[_0xb8f0[73]],_0xb8f0[42])[_0xb8f0[81]](_0xb8f0[87]),_0x1260x20[_0xb8f0[89]][_0xb8f0[88]]|| _0xb8f0[90]),{type:sequelize[_0xb8f0[93]][_0xb8f0[92]]})}})[_0xb8f0[39]](function(_0x1260x2c){var _0x1260x2d,_0x1260x2e;_[_0xb8f0[78]](_0x1260x27[_0xb8f0[73]],function(_0x1260x2f,_0x1260x30){_0x1260x2c&& _[_0xb8f0[74]](_0x1260x2f,_0x1260x2c[_0x1260x30]);_0x1260x2d= _[_0xb8f0[75]](_0x1260x2a,{id:_0x1260x2f[_0xb8f0[71]]});_0x1260x2f[_0xb8f0[20]]= _0x1260x2d?_0x1260x2d[_0xb8f0[76]]:_0xb8f0[77];_0x1260x2e= _[_0xb8f0[75]](_0x1260x2b,{id:_0x1260x2f[_0xb8f0[72]]});_0x1260x2f[_0xb8f0[19]]= _0x1260x2e?_0x1260x2e[_0xb8f0[76]]:_0xb8f0[77];if(_0x1260x25){delete _0x1260x2f[_0xb8f0[42]];delete _0x1260x2f[_0xb8f0[71]];delete _0x1260x2f[_0xb8f0[72]]}});return _0x1260x27});default:_0x1260x29= {CompanyId:_0x1260x20[_0xb8f0[89]][_0xb8f0[71]]|| null,ListId:_0x1260x20[_0xb8f0[89]][_0xb8f0[72]]|| null};delete _0x1260x20[_0xb8f0[89]][_0xb8f0[71]];delete _0x1260x20[_0xb8f0[89]][_0xb8f0[72]];var _0x1260x39={};if(_0x1260x20[_0xb8f0[89]][_0xb8f0[105]]){_0x1260x39[_0xb8f0[42]]= {$ne:_0x1260x20[_0xb8f0[89]][_0xb8f0[105]]};delete _0x1260x20[_0xb8f0[89]][_0xb8f0[105]]};return Company[_0xb8f0[100]]({attributes:[_0xb8f0[42],_0xb8f0[76]],raw:true})[_0xb8f0[39]](function(_0x1260x3a){_0x1260x2a= _0x1260x3a;return List[_0xb8f0[100]]({attributes:[_0xb8f0[42],_0xb8f0[76]],raw:true})})[_0xb8f0[39]](function(_0x1260x38){_0x1260x2b= _0x1260x38;return Contact[_0xb8f0[111]]({method:[_0xb8f0[110],_0x1260x29]})[_0xb8f0[107]](Util[_0xb8f0[106]](_0x1260x20[_0xb8f0[89]],_0x1260x39,{attributes:_0x1260x25,order:_0x1260x20[_0xb8f0[89]][_0xb8f0[88]]|| _0xb8f0[90]}))})[_0xb8f0[39]](function(_0x1260x37){_0x1260x27= {rows:_[_0xb8f0[85]](_0x1260x37[_0xb8f0[73]],_0xb8f0[101]),count:_0x1260x37[_0xb8f0[102]]};return Contact[_0xb8f0[103]]()})[_0xb8f0[39]](function(_0x1260x34){_0x1260x34= _[_0xb8f0[97]](_[_0xb8f0[94]](_0x1260x34),function(_0x1260x35){return _[_0xb8f0[96]](_0x1260x35,_0xb8f0[95])});var _0x1260x36={where:{name:_0x1260x34}};_0x1260x29[_0xb8f0[72]]&& (_0x1260x36[_0xb8f0[99]][_0xb8f0[98]]= [{ListId:_0x1260x29[_0xb8f0[72]]},{ListId:null}]);return CustomField[_0xb8f0[100]](_0x1260x36)})[_0xb8f0[39]](function(_0x1260x31){if(_0x1260x27[_0xb8f0[73]][_0xb8f0[79]]&& _0x1260x31[_0xb8f0[79]]){var _0x1260x32;if(_0x1260x25){_0x1260x32= _[_0xb8f0[85]](_0x1260x31,function(_0x1260x33){return _0x1260x33[_0xb8f0[76]]+ _0xb8f0[82]+ _0x1260x33[_0xb8f0[83]]+ _0xb8f0[84]})[_0xb8f0[81]](_0xb8f0[80])}else {_0x1260x32= _[_0xb8f0[85]](_0x1260x31,_0xb8f0[76])[_0xb8f0[81]](_0xb8f0[80])};return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[86],_0x1260x32,_[_0xb8f0[85]](_0x1260x27[_0xb8f0[73]],_0xb8f0[42])[_0xb8f0[81]](_0xb8f0[87]),_0x1260x20[_0xb8f0[89]][_0xb8f0[88]]|| _0xb8f0[90]),{type:sequelize[_0xb8f0[93]][_0xb8f0[92]]})}})[_0xb8f0[39]](function(_0x1260x2c){var _0x1260x2d,_0x1260x2e;_[_0xb8f0[78]](_0x1260x27[_0xb8f0[73]],function(_0x1260x2f,_0x1260x30){_0x1260x2c&& _[_0xb8f0[74]](_0x1260x2f,_0x1260x2c[_0x1260x30]);_0x1260x2d= _[_0xb8f0[75]](_0x1260x2a,{id:_0x1260x2f[_0xb8f0[71]]});_0x1260x2f[_0xb8f0[20]]= _0x1260x2d?_0x1260x2d[_0xb8f0[76]]:_0xb8f0[77];_0x1260x2e= _[_0xb8f0[75]](_0x1260x2b,{id:_0x1260x2f[_0xb8f0[72]]});_0x1260x2f[_0xb8f0[19]]= _0x1260x2e?_0x1260x2e[_0xb8f0[76]]:_0xb8f0[77];if(_0x1260x25){delete _0x1260x2f[_0xb8f0[42]];delete _0x1260x2f[_0xb8f0[71]];delete _0x1260x2f[_0xb8f0[72]]}});return _0x1260x27})}}}exports[_0xb8f0[103]]= function(_0x1260x20,_0x1260x21){return Contact[_0xb8f0[103]]()[_0xb8f0[39]](function(_0x1260x34){return _0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x34)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[117]]= function(_0x1260x20,_0x1260x21,_0x1260x22){_0x1260x20[_0xb8f0[89]][_0xb8f0[118]]= _0x1260x20[_0xb8f0[89]][_0xb8f0[118]]|| _0xb8f0[119];_0x1260x20[_0xb8f0[89]][_0xb8f0[120]]= _0x1260x20[_0xb8f0[89]][_0xb8f0[120]]|| _0xb8f0[61];_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]= _0x1260x20[_0xb8f0[89]][_0xb8f0[121]]|| _0xb8f0[122];_0x1260x20[_0xb8f0[89]][_0xb8f0[123]]= _0x1260x20[_0xb8f0[89]][_0xb8f0[123]]|| _0xb8f0[124];var _0x1260x3c,_0x1260x3d={};return Contact[_0xb8f0[114]](_0x1260x20[_0xb8f0[138]][_0xb8f0[42]])[_0xb8f0[39]](function(_0x1260x3e){if(!_0x1260x3e){return _0x1260x21[_0xb8f0[125]](404)};switch(_0x1260x20[_0xb8f0[89]][_0xb8f0[118]]){case _0xb8f0[119]:switch(_0x1260x20[_0xb8f0[89]][_0xb8f0[120]]){case _0xb8f0[61]:_0x1260x3c= (_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12])?ReportCallHistory:ReportCall;if(_0x1260x20[_0xb8f0[89]][_0xb8f0[123]]=== _0xb8f0[126]){_0x1260x3d[_0xb8f0[127]]= [_0x1260x3e[_0xb8f0[61]],_0x1260x3e[_0xb8f0[63]]]}else {_0x1260x3d[_0xb8f0[128]]= [_0x1260x3e[_0xb8f0[61]],_0x1260x3e[_0xb8f0[63]]]};break;case _0xb8f0[67]:_0x1260x3c= MailRoom;_0x1260x3d[_0xb8f0[129]]= _0x1260x3e[_0xb8f0[67]];if(_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12]){_0x1260x3d[_0xb8f0[130]]= {$lt:moment()[_0xb8f0[132]](_0xb8f0[131])}}else {_0x1260x3d[_0xb8f0[130]]= {$gte:moment()[_0xb8f0[132]](_0xb8f0[131])}};break;case _0xb8f0[134]:_0x1260x3c= ChatRoom;_0x1260x3d[_0xb8f0[133]]= _0x1260x3e[_0xb8f0[67]];if(_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12]){_0x1260x3d[_0xb8f0[130]]= {$lt:moment()[_0xb8f0[132]](_0xb8f0[131])}}else {_0x1260x3d[_0xb8f0[130]]= {$gte:moment()[_0xb8f0[132]](_0xb8f0[131])}};break;case _0xb8f0[65]:_0x1260x3c= FaxRoom;_0x1260x3d[_0xb8f0[133]]= _0x1260x3e[_0xb8f0[65]];if(_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12]){_0x1260x3d[_0xb8f0[130]]= {$lt:moment()[_0xb8f0[132]](_0xb8f0[131])}}else {_0x1260x3d[_0xb8f0[130]]= {$gte:moment()[_0xb8f0[132]](_0xb8f0[131])}};break;case _0xb8f0[135]:_0x1260x3c= SmsRoom;_0x1260x3d[_0xb8f0[133]]= [_0x1260x3e[_0xb8f0[61]],_0x1260x3e[_0xb8f0[63]]];if(_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12]){_0x1260x3d[_0xb8f0[130]]= {$lt:moment()[_0xb8f0[132]](_0xb8f0[131])}}else {_0x1260x3d[_0xb8f0[130]]= {$gte:moment()[_0xb8f0[132]](_0xb8f0[131])}};break;default:_0x1260x3c= (_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12])?ReportCallHistory:ReportCall};break;case _0xb8f0[137]:switch(_0x1260x20[_0xb8f0[89]][_0xb8f0[120]]){case _0xb8f0[61]:_0x1260x3c= (_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12])?ReportQueueHistory:ReportQueue;_0x1260x3d[_0xb8f0[136]]= [_0x1260x3e[_0xb8f0[61]],_0x1260x3e[_0xb8f0[63]]];break;case _0xb8f0[67]:return _0x1260x21[_0xb8f0[125]](404);default:_0x1260x3c= (_0x1260x20[_0xb8f0[89]][_0xb8f0[121]]=== _0xb8f0[12])?ReportQueueHistory:ReportQueue};break;default:_0x1260x3c= ReportCall};delete _0x1260x20[_0xb8f0[89]][_0xb8f0[118]];delete _0x1260x20[_0xb8f0[89]][_0xb8f0[120]];delete _0x1260x20[_0xb8f0[89]][_0xb8f0[121]];delete _0x1260x20[_0xb8f0[89]][_0xb8f0[123]];return _0x1260x3c[_0xb8f0[107]](Util[_0xb8f0[106]](_0x1260x20[_0xb8f0[89]],_0x1260x3d))})[_0xb8f0[39]](function(_0x1260x24){_0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x24)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[120]]= function(_0x1260x20,_0x1260x21){var _0x1260x3f;return Contact[_0xb8f0[111]](_0xb8f0[108],_0xb8f0[113],_0xb8f0[109])[_0xb8f0[114]](_0x1260x20[_0xb8f0[138]][_0xb8f0[42]])[_0xb8f0[39]](function(_0x1260x44){if(!_0x1260x44){return _0x1260x21[_0xb8f0[125]](404)};_0x1260x3f= _0x1260x44;return CustomField[_0xb8f0[100]]({where:{$or:[{ListId:_0x1260x3f[_0xb8f0[72]]},{ListId:null}]}})})[_0xb8f0[39]](function(_0x1260x31){if(_0x1260x31[_0xb8f0[79]]){var _0x1260x32=_[_0xb8f0[85]](_0x1260x31,_0xb8f0[76])[_0xb8f0[81]](_0xb8f0[80]);return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[140],_0x1260x32,_0x1260x20[_0xb8f0[138]][_0xb8f0[42]]),{type:sequelize[_0xb8f0[93]][_0xb8f0[92]]})}})[_0xb8f0[39]](function(_0x1260x40){if(_0x1260x40){_[_0xb8f0[78]](_0x1260x40[0],function(_0x1260x41,_0x1260x42,_0x1260x43){if(_0x1260x41=== _0xb8f0[139]){_0x1260x43[_0x1260x42]= null}});_[_0xb8f0[74]](_0x1260x3f[_0xb8f0[101]],_0x1260x40[0])}})[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x3f)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[141]]= function(_0x1260x20,_0x1260x21){var _0x1260x3d={},_0x1260x45;switch(_0x1260x20[_0xb8f0[143]][_0xb8f0[147]]){case _0xb8f0[145]:if(_0x1260x20[_0xb8f0[143]][_0xb8f0[142]]=== _0xb8f0[137]){_0x1260x3d= {$or:{phone:_0x1260x20[_0xb8f0[143]][_0xb8f0[136]],mobile:_0x1260x20[_0xb8f0[143]][_0xb8f0[136]]}}}else {_0x1260x3d= {$or:{phone:_0x1260x20[_0xb8f0[143]][_0xb8f0[144]],mobile:_0x1260x20[_0xb8f0[143]][_0xb8f0[144]]}}};break;case _0xb8f0[146]:_0x1260x3d= {email:_0x1260x20[_0xb8f0[143]][_0xb8f0[129]]};break;default:_0x1260x3d= {}};var _0x1260x46=_[_0xb8f0[85]](_[_0xb8f0[85]](_0x1260x20[_0xb8f0[113]].Lists,_0xb8f0[101]),_0xb8f0[42]);var _0x1260x47;return List[_0xb8f0[155]]({where:{defaultEntry:true}})[_0xb8f0[39]](function(_0x1260x2e){if(_0x1260x2e){_0x1260x46[_0xb8f0[151]](_0x1260x2e[_0xb8f0[42]])};if(_0x1260x20[_0xb8f0[143]][_0xb8f0[72]]){_0x1260x47= _[_0xb8f0[96]](_0x1260x46,_0x1260x20[_0xb8f0[143]].ListId)?{id:_0x1260x20[_0xb8f0[143]][_0xb8f0[72]]}:null}else {_0x1260x47= {id:_0x1260x46}};if(_0x1260x47){return Contact[_0xb8f0[107]]({where:_0x1260x3d,include:[{model:List,where:_0x1260x47}]})};return null})[_0xb8f0[39]](function(_0x1260x37){if(_0x1260x37&& _0x1260x37[_0xb8f0[73]][_0xb8f0[79]]){_0x1260x45= _0x1260x37;return null}else {_0x1260x45= {count:0,rows:[]};if(_0x1260x20[_0xb8f0[143]][_0xb8f0[148]]&& _0x1260x20[_0xb8f0[143]][_0xb8f0[72]]&& _[_0xb8f0[96]](_0x1260x46,_0x1260x20[_0xb8f0[143]].ListId)){var _0x1260x3f={};return Contact[_0xb8f0[154]]({firstName:_0x1260x20[_0xb8f0[143]][_0xb8f0[153]],phone:_0x1260x20[_0xb8f0[143]][_0xb8f0[136]],ListId:_0x1260x20[_0xb8f0[143]][_0xb8f0[72]]})[_0xb8f0[39]](function(_0x1260x3e){_0x1260x3f= _0x1260x3e[_0xb8f0[152]]({plain:true});return List[_0xb8f0[114]](_0x1260x20[_0xb8f0[143]].ListId,{raw:true})})[_0xb8f0[39]](function(_0x1260x2e){_0x1260x3f[_0xb8f0[19]]= _0x1260x2e;_0x1260x45[_0xb8f0[73]][_0xb8f0[151]](_0x1260x3f)})[_0xb8f0[36]](function(_0x1260x23){logger[_0xb8f0[150]](_0xb8f0[149],_0x1260x23)})}}})[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x45)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[154]]= function(_0x1260x20,_0x1260x21,_0x1260x22){if(!_0x1260x20[_0xb8f0[143]][_0xb8f0[43]]||  !_0x1260x20[_0xb8f0[143]][_0xb8f0[72]]){return handleError(_0x1260x21,{message:_0xb8f0[156]})};var _0x1260x3f,_0x1260x48=moment()[_0xb8f0[91]](_0xb8f0[157]),_0x1260x49=[],_0x1260x4a=[],_0x1260x4b=[];_0x1260x20[_0xb8f0[143]][_0xb8f0[158]]= _0x1260x20[_0xb8f0[113]][_0xb8f0[42]];_0x1260x20[_0xb8f0[143]][_0xb8f0[130]]= _0x1260x48;_0x1260x20[_0xb8f0[143]][_0xb8f0[159]]= _0x1260x48;_[_0xb8f0[162]](_0x1260x20[_0xb8f0[143]],function(_0x1260x41,_0x1260x42){if(_0x1260x41){switch(_0x1260x42){case _0xb8f0[47]:if(_0x1260x41[_0xb8f0[79]]){_0x1260x4a[_0xb8f0[151]](_0x1260x41[_0xb8f0[81]](_0xb8f0[160])+ _0xb8f0[160]);_0x1260x49[_0xb8f0[151]](_0x1260x42);_0x1260x4b[_0xb8f0[151]](_0xb8f0[161])};break;default:_0x1260x49[_0xb8f0[151]](_0x1260x42);_0x1260x4a[_0xb8f0[151]](_0x1260x41);_0x1260x4b[_0xb8f0[151]](_0xb8f0[161])}}});return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[164],_0x1260x49[_0xb8f0[81]](_0xb8f0[80]),_0x1260x4b[_0xb8f0[81]](_0xb8f0[80])),{replacements:_0x1260x4a})[_0xb8f0[39]](function(_0x1260x3e){_0x1260x20[_0xb8f0[143]][_0xb8f0[42]]= _0x1260x3e[0][_0xb8f0[163]];return _0x1260x21[_0xb8f0[38]](201)[_0xb8f0[37]](_0x1260x20[_0xb8f0[143]])})[_0xb8f0[36]](function(_0x1260x23){return _0x1260x22(_0x1260x23)})};exports[_0xb8f0[165]]= function(_0x1260x20,_0x1260x21,_0x1260x22){var _0x1260x3f,_0x1260x4c;return Contact[_0xb8f0[114]](_0x1260x20[_0xb8f0[138]][_0xb8f0[42]])[_0xb8f0[39]](function(_0x1260x3e){_0x1260x3f= _0x1260x3e[_0xb8f0[101]];_0x1260x4c= _[_0xb8f0[168]](_0x1260x3e[_0xb8f0[101]]);delete _0x1260x4c[_0xb8f0[42]];_0x1260x4c[_0xb8f0[158]]= _0x1260x20[_0xb8f0[113]][_0xb8f0[42]];_0x1260x4c[_0xb8f0[72]]= _0x1260x20[_0xb8f0[143]][_0xb8f0[72]];_0x1260x4c[_0xb8f0[47]]= _0x1260x4c[_0xb8f0[47]]?_0x1260x4c[_0xb8f0[47]][_0xb8f0[169]](_0xb8f0[160]):[];if(_0x1260x4c[_0xb8f0[47]][_0xb8f0[79]]> 1){_0x1260x4c[_0xb8f0[47]][_0xb8f0[170]]()};return Contact[_0xb8f0[154]](_0x1260x4c)})[_0xb8f0[39]](function(_0x1260x50){_0x1260x4c= _0x1260x50;if(_0x1260x3f[_0xb8f0[72]]=== _0x1260x20[_0xb8f0[143]][_0xb8f0[72]]){return CustomField[_0xb8f0[100]]({where:{$or:[{ListId:_0x1260x3f[_0xb8f0[72]]},{ListId:null}]}})}})[_0xb8f0[39]](function(_0x1260x31){if(_0x1260x31&& _0x1260x31[_0xb8f0[79]]){var _0x1260x32=_[_0xb8f0[85]](_0x1260x31,_0xb8f0[76])[_0xb8f0[81]](_0xb8f0[80]);return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[140],_0x1260x32,_0x1260x3f[_0xb8f0[42]]),{type:sequelize[_0xb8f0[93]][_0xb8f0[92]]})}})[_0xb8f0[39]](function(_0x1260x4d){if(_0x1260x4d){var _0x1260x4e=[],_0x1260x4f=[];_[_0xb8f0[162]](_0x1260x4d[0],function(_0x1260x41,_0x1260x42){_0x1260x4e[_0xb8f0[151]](util[_0xb8f0[91]](_0xb8f0[166],_0x1260x42));_0x1260x4f[_0xb8f0[151]](_0x1260x41)});if(_0x1260x4e[_0xb8f0[79]]){_0x1260x4e= _0x1260x4e[_0xb8f0[81]](_0xb8f0[80]);return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[167],_0x1260x4e,_0x1260x4c[_0xb8f0[42]]),{replacements:_0x1260x4f})}}})[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[38]](201)[_0xb8f0[37]](_0x1260x4c)})[_0xb8f0[36]](function(_0x1260x23){return _0x1260x22(_0x1260x23)})};exports[_0xb8f0[171]]= function(_0x1260x20,_0x1260x21,_0x1260x22){var _0x1260x45=[],_0x1260x48=moment()[_0xb8f0[91]](_0xb8f0[157]),_0x1260x51=[],_0x1260x49,_0x1260x4a,_0x1260x52={ok:0,ko:0,failed:[]};return Tag[_0xb8f0[100]]()[_0xb8f0[39]](function(_0x1260x53){var _0x1260x54=[],_0x1260x55=[];var _0x1260x56=_[_0xb8f0[85]](_[_0xb8f0[85]](_0x1260x53,_0xb8f0[101]),_0xb8f0[76]);Async[_0xb8f0[180]](_0x1260x20[_0xb8f0[143]][_0xb8f0[173]],function(_0x1260x3e,_0x1260x30){if(_0x1260x3e[_0xb8f0[43]]&& _0x1260x3e[_0xb8f0[72]]){_0x1260x3e[_0xb8f0[158]]= _0x1260x20[_0xb8f0[113]][_0xb8f0[42]];_0x1260x3e[_0xb8f0[130]]= _0x1260x48;_0x1260x3e[_0xb8f0[159]]= _0x1260x48;_0x1260x3e[_0xb8f0[47]]&& (_0x1260x55= _[_0xb8f0[174]](_0x1260x55,_0x1260x3e[_0xb8f0[47]]));var _0x1260x49=[],_0x1260x4a=[],_0x1260x4b=[];_[_0xb8f0[162]](_0x1260x3e,function(_0x1260x41,_0x1260x42){if(_0x1260x41){switch(_0x1260x42){case _0xb8f0[47]:if(_0x1260x41[_0xb8f0[79]]){_0x1260x4a[_0xb8f0[151]](_0x1260x41[_0xb8f0[81]](_0xb8f0[160])+ _0xb8f0[160]);_0x1260x49[_0xb8f0[151]](_0x1260x42);_0x1260x4b[_0xb8f0[151]](_0xb8f0[161])};break;default:_0x1260x49[_0xb8f0[151]](_0x1260x42);_0x1260x4a[_0xb8f0[151]](_0x1260x41);_0x1260x4b[_0xb8f0[151]](_0xb8f0[161])}}});_0x1260x51[_0xb8f0[151]](sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[164],_0x1260x49[_0xb8f0[81]](_0xb8f0[80]),_0x1260x4b[_0xb8f0[81]](_0xb8f0[80])),{replacements:_0x1260x4a})[_0xb8f0[39]](function(_0x1260x50){_0x1260x3e[_0xb8f0[42]]= _0x1260x50[_0xb8f0[42]];_0x1260x45[_0xb8f0[151]](_0x1260x3e);_0x1260x52[_0xb8f0[179]]++})[_0xb8f0[36]](function(_0x1260x23){logger[_0xb8f0[176]](_0x1260x23[_0xb8f0[175]]);_0x1260x52[_0xb8f0[177]]++;_0x1260x52[_0xb8f0[178]][_0xb8f0[151]](_0x1260x30)}))}else {_0x1260x52[_0xb8f0[177]]++;_0x1260x52[_0xb8f0[178]][_0xb8f0[151]](_0x1260x30)}});_0x1260x55[_0xb8f0[79]]&& _[_0xb8f0[78]](_0x1260x55,function(_0x1260x35){if(!_0x1260x56[_0xb8f0[79]]||  !_[_0xb8f0[96]](_0x1260x56,_0x1260x35)){_0x1260x54[_0xb8f0[151]](Tag[_0xb8f0[154]]({name:_0x1260x35}))}});return _0x1260x54})[_0xb8f0[172]]()[_0xb8f0[39]](function(){return _0x1260x51})[_0xb8f0[172]]()[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[38]](201)[_0xb8f0[37]](_0x1260x52)})[_0xb8f0[36]](function(_0x1260x23){return _0x1260x22(_0x1260x23)})};exports[_0xb8f0[181]]= function(_0x1260x20,_0x1260x21,_0x1260x22){return Promise[_0xb8f0[172]]([])[_0xb8f0[39]](updateContact(_0x1260x20,_0x1260x21))[_0xb8f0[39]](function(_0x1260x3e){return _0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x3e)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[74]]= function(_0x1260x20,_0x1260x21,_0x1260x22){var _0x1260x3f;return Promise[_0xb8f0[172]]([])[_0xb8f0[39]](updateContact(_0x1260x20,_0x1260x21))[_0xb8f0[39]](function(_0x1260x3e){_0x1260x3f= _0x1260x3e;if(_0x1260x20[_0xb8f0[143]][_0xb8f0[182]]){return Contact[_0xb8f0[183]]({where:{id:_0x1260x20[_0xb8f0[143]][_0xb8f0[182]]},individualHooks:true})}})[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[38]](200)[_0xb8f0[37]](_0x1260x3f)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};function updateContact(_0x1260x20,_0x1260x21){return function(){var _0x1260x3f;return Tag[_0xb8f0[100]]()[_0xb8f0[39]](function(_0x1260x53){var _0x1260x54=[];var _0x1260x56=_[_0xb8f0[85]](_[_0xb8f0[85]](_0x1260x53,_0xb8f0[101]),_0xb8f0[76]);if(_0x1260x20[_0xb8f0[143]][_0xb8f0[47]]){_0x1260x20[_0xb8f0[143]][_0xb8f0[47]][_0xb8f0[78]](function(_0x1260x35){if(!_[_0xb8f0[96]](_0x1260x56,_0x1260x35)){_0x1260x54[_0xb8f0[151]](Tag[_0xb8f0[154]]({name:_0x1260x35}))}})};return _0x1260x54})[_0xb8f0[39]](function(){return Contact[_0xb8f0[114]](_0x1260x20[_0xb8f0[138]][_0xb8f0[42]])})[_0xb8f0[39]](function(_0x1260x3e){if(!_0x1260x3e){return _0x1260x21[_0xb8f0[125]](404)};delete _0x1260x20[_0xb8f0[143]][_0xb8f0[42]];return _0x1260x3e[_0xb8f0[186]](_0x1260x20[_0xb8f0[143]])})[_0xb8f0[39]](function(_0x1260x3e){_0x1260x3f= _0x1260x3e;return CustomField[_0xb8f0[100]]({where:{$or:[{ListId:_0x1260x3f[_0xb8f0[72]]},{ListId:null}]}})})[_0xb8f0[39]](function(_0x1260x31){if(_0x1260x31[_0xb8f0[79]]){var _0x1260x4e=[];var _0x1260x4f=[];_0x1260x31[_0xb8f0[78]](function(_0x1260x35){if(_0x1260x20[_0xb8f0[143]][_0xb8f0[185]](_0x1260x35[_0xb8f0[76]])){_0x1260x4e[_0xb8f0[151]](util[_0xb8f0[91]](_0xb8f0[166],_0x1260x35[_0xb8f0[76]]));_0x1260x4f[_0xb8f0[151]](_0x1260x20[_0xb8f0[143]][_0x1260x35[_0xb8f0[76]]])}});if(_0x1260x4e[_0xb8f0[79]]){_0x1260x4e= _0x1260x4e[_0xb8f0[81]](_0xb8f0[80]);return sequelize[_0xb8f0[89]](util[_0xb8f0[91]](_0xb8f0[167],_0x1260x4e,_0x1260x3f[_0xb8f0[42]]),{replacements:_0x1260x4f})}}})[_0xb8f0[39]](function(){return TdUpdate[_0xb8f0[154]]({action:_0xb8f0[184],listId:_0x1260x3f[_0xb8f0[72]],contactId:_0x1260x3f[_0xb8f0[42]]})})[_0xb8f0[39]](function(){return _0x1260x3f})}}exports[_0xb8f0[183]]= function(_0x1260x20,_0x1260x21){return Contact[_0xb8f0[114]](_0x1260x20[_0xb8f0[138]][_0xb8f0[42]])[_0xb8f0[39]](function(_0x1260x44){if(!_0x1260x44){return _0x1260x21[_0xb8f0[125]](404)};return _0x1260x44[_0xb8f0[183]]()})[_0xb8f0[39]](function(_0x1260x3e){return TdUpdate[_0xb8f0[154]]({action:_0xb8f0[187],listId:_0x1260x3e[_0xb8f0[72]],contactId:_0x1260x3e[_0xb8f0[42]]})})[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[125]](204)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};exports[_0xb8f0[188]]= function(_0x1260x20,_0x1260x21){return Contact[_0xb8f0[100]]({where:{id:_0x1260x20[_0xb8f0[89]][_0xb8f0[189]]}})[_0xb8f0[39]](function(_0x1260x37){var _0x1260x58=[];if(_0x1260x37&& _0x1260x37[_0xb8f0[79]]){_[_0xb8f0[78]](_0x1260x37,function(_0x1260x3e){_0x1260x58[_0xb8f0[151]](_0x1260x3e[_0xb8f0[183]]());_0x1260x58[_0xb8f0[151]](TdUpdate[_0xb8f0[154]]({action:_0xb8f0[187],listId:_0x1260x3e[_0xb8f0[72]],contactId:_0x1260x3e[_0xb8f0[42]]}))})};return _0x1260x58})[_0xb8f0[172]]()[_0xb8f0[39]](function(){return _0x1260x21[_0xb8f0[125]](204)})[_0xb8f0[36]](function(_0x1260x23){return handleError(_0x1260x21,_0x1260x23)})};function handleError(_0x1260x21,_0x1260x23){logger[_0xb8f0[150]](_0x1260x23[_0xb8f0[175]]);return _0x1260x21[_0xb8f0[38]](500)[_0xb8f0[37]](_0x1260x23)}
\ No newline at end of file
+var _0xfc6d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D\x48\x69\x73\x74\x6F\x72\x79","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x46\x61\x78\x52\x6F\x6F\x6D","\x53\x6D\x73\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x4C\x69\x73\x74","\x43\x6F\x6D\x70\x61\x6E\x79","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x54\x61\x67","\x54\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x72\x65\x61\x6D","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x62\x6C\x75\x65\x62\x69\x72\x64","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x72\x65\x73\x6F\x6C\x76\x65","\x65\x78\x74\x72\x61\x63\x74\x41\x6C\x6C","\x69\x64","\x66\x69\x72\x73\x74\x4E\x61\x6D\x65","\x46\x69\x72\x73\x74\x20\x4E\x61\x6D\x65","\x6C\x61\x73\x74\x4E\x61\x6D\x65","\x4C\x61\x73\x74\x20\x4E\x61\x6D\x65","\x74\x61\x67\x73","\x54\x61\x67\x73","\x73\x74\x72\x65\x65\x74","\x53\x74\x72\x65\x65\x74","\x70\x6F\x73\x74\x61\x6C\x43\x6F\x64\x65","\x50\x6F\x73\x74\x61\x6C\x20\x43\x6F\x64\x65","\x63\x69\x74\x79","\x43\x69\x74\x79","\x63\x6F\x75\x6E\x74\x72\x79","\x43\x6F\x75\x6E\x74\x72\x79","\x64\x61\x74\x65\x4F\x66\x42\x69\x72\x74\x68","\x44\x61\x74\x65\x20\x6F\x66\x20\x62\x69\x72\x74\x68","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x70\x68\x6F\x6E\x65","\x50\x68\x6F\x6E\x65","\x6D\x6F\x62\x69\x6C\x65","\x4D\x6F\x62\x69\x6C\x65","\x66\x61\x78","\x46\x61\x78","\x65\x6D\x61\x69\x6C","\x45\x6D\x61\x69\x6C","\x75\x72\x6C","\x55\x52\x4C","\x43\x6F\x6D\x70\x61\x6E\x79\x49\x64","\x4C\x69\x73\x74\x49\x64","\x72\x6F\x77\x73","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64","\x6E\x61\x6D\x65","","\x66\x6F\x72\x45\x61\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x2C","\x6A\x6F\x69\x6E","\x20\x61\x73\x20\x27","\x61\x6C\x69\x61\x73","\x27","\x6D\x61\x70","\x53\x45\x4C\x45\x43\x54\x20\x69\x64\x2C\x25\x73\x20\x46\x52\x4F\x4D\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x20\x49\x4E\x20\x28\x27\x25\x73\x27\x29\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73","\x27\x2C\x27","\x6F\x72\x64\x65\x72","\x71\x75\x65\x72\x79","\x69\x64\x20\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x6B\x65\x79\x73","\x63\x66\x5F","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x66\x69\x6C\x74\x65\x72","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x63\x6F\x75\x6E\x74","\x64\x65\x73\x63\x72\x69\x62\x65","\x63\x6F\x6E\x63\x61\x74","\x6D\x65\x72\x67\x65\x63\x6F\x6E\x74\x61\x63\x74","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6C\x69\x73\x74","\x63\x6F\x6D\x70\x61\x6E\x79","\x63\x6F\x6D\x70\x61\x6E\x79\x5F\x6C\x69\x73\x74\x5F\x66\x69\x6C\x74\x65\x72","\x73\x63\x6F\x70\x65","\x67\x65\x74\x4C\x69\x73\x74\x73","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x67\x65\x74\x4C\x6F\x67","\x64\x65\x74\x61\x69\x6C","\x67\x65\x6E\x65\x72\x61\x6C","\x73\x68\x6F\x77","\x6C\x6F\x67\x54\x79\x70\x65","\x6A\x6F\x75\x72\x6E\x61\x6C","\x74\x79\x70\x65","\x69\x6E\x62\x6F\x75\x6E\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E","\x73\x6F\x75\x72\x63\x65","\x66\x72\x6F\x6D","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x63\x6F\x6E\x74\x61\x63\x74","\x63\x68\x61\x74","\x73\x6D\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x71\x75\x65\x75\x65","\x70\x61\x72\x61\x6D\x73","\x6E\x75\x6C\x6C","\x53\x45\x4C\x45\x43\x54\x20\x25\x73\x20\x46\x52\x4F\x4D\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3D\x25\x73","\x67\x65\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x73\x75\x62\x74\x79\x70\x65\x43\x68\x61\x6E\x6E\x65\x6C","\x62\x6F\x64\x79","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x76\x6F\x69\x63\x65","\x6D\x61\x69\x6C","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x74\x61\x63\x74","\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x63\x6F\x6E\x74\x61\x63\x74\x20\x61\x75\x74\x6F\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x65\x72\x72\x6F\x72","\x70\x75\x73\x68","\x67\x65\x74","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x4E\x61\x6D\x65\x20\x6F\x72\x20\x4C\x69\x73\x74\x49\x64\x20\x6D\x69\x73\x73\x69\x6E\x67\x20\x6F\x72\x20\x69\x6E\x76\x61\x6C\x69\x64\x21","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x55\x73\x65\x72\x49\x64","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x3B","\x3F","\x66\x6F\x72\x4F\x77\x6E","\x69\x6E\x73\x65\x72\x74\x49\x64","\x49\x4E\x53\x45\x52\x54\x20\x49\x4E\x54\x4F\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x28\x25\x73\x29\x20\x56\x41\x4C\x55\x45\x53\x20\x28\x25\x73\x29","\x63\x6F\x70\x79","\x25\x73\x3D\x3F","\x55\x50\x44\x41\x54\x45\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x53\x45\x54\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3D\x25\x73","\x63\x6C\x6F\x6E\x65","\x73\x70\x6C\x69\x74","\x70\x6F\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x6C\x6C","\x63\x6F\x6E\x74\x61\x63\x74\x73","\x75\x6E\x69\x6F\x6E","\x73\x74\x61\x63\x6B","\x64\x65\x62\x75\x67","\x6B\x6F","\x66\x61\x69\x6C\x65\x64","\x6F\x6B","\x66\x6F\x72\x45\x61\x63\x68\x4F\x66","\x75\x70\x64\x61\x74\x65","\x6F\x6C\x64\x43\x6F\x6E\x74\x61\x63\x74","\x64\x65\x73\x74\x72\x6F\x79","\x63\x6F\x6E\x74\x61\x63\x74\x2F\x75\x70\x64\x61\x74\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x63\x6F\x6E\x74\x61\x63\x74\x2F\x64\x65\x6C\x65\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xfc6d[0];var _=require(_0xfc6d[1]);var moment=require(_0xfc6d[2]);var Contact=require(_0xfc6d[4])[_0xfc6d[3]];var User=require(_0xfc6d[4])[_0xfc6d[5]];var ContactPhone=require(_0xfc6d[4])[_0xfc6d[6]];var ContactEmail=require(_0xfc6d[4])[_0xfc6d[7]];var CustomField=require(_0xfc6d[4])[_0xfc6d[8]];var ReportCall=require(_0xfc6d[4])[_0xfc6d[9]];var ReportQueue=require(_0xfc6d[4])[_0xfc6d[10]];var ReportQueueHistory=require(_0xfc6d[4])[_0xfc6d[12]][_0xfc6d[11]];var ReportChatRoom=require(_0xfc6d[4])[_0xfc6d[13]];var ReportChatRoomHistory=require(_0xfc6d[4])[_0xfc6d[12]][_0xfc6d[14]];var ChatRoom=require(_0xfc6d[4])[_0xfc6d[15]];var FaxRoom=require(_0xfc6d[4])[_0xfc6d[16]];var SmsRoom=require(_0xfc6d[4])[_0xfc6d[17]];var ReportIntegration=require(_0xfc6d[4])[_0xfc6d[18]];var List=require(_0xfc6d[4])[_0xfc6d[19]];var Company=require(_0xfc6d[4])[_0xfc6d[20]];var ReportCallHistory=require(_0xfc6d[4])[_0xfc6d[12]][_0xfc6d[21]];var ReportMailSession=require(_0xfc6d[4])[_0xfc6d[22]];var MailRoom=require(_0xfc6d[4])[_0xfc6d[23]];var ReportMailSessionHistory=require(_0xfc6d[4])[_0xfc6d[12]][_0xfc6d[24]];var Tag=require(_0xfc6d[4])[_0xfc6d[25]];var TdUpdate=require(_0xfc6d[4])[_0xfc6d[26]];var stream=require(_0xfc6d[27]);var sequelize=require(_0xfc6d[4])[_0xfc6d[28]];var util=require(_0xfc6d[29]);var Util=require(_0xfc6d[30]);var Async=require(_0xfc6d[31]);var Promise=require(_0xfc6d[32]);var logger=require(_0xfc6d[34])(_0xfc6d[33]);exports[_0xfc6d[35]]= function(_0xf964x20,_0xf964x21,_0xf964x22){return Promise[_0xfc6d[40]]()[_0xfc6d[39]](getContacts(_0xf964x20))[_0xfc6d[39]](function(_0xf964x24){_0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x24)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[41]]= function(_0xf964x20,_0xf964x21,_0xf964x22){var _0xf964x25=[_0xfc6d[42],[_0xfc6d[43],_0xfc6d[44]],[_0xfc6d[45],_0xfc6d[46]],[_0xfc6d[47],_0xfc6d[48]],[_0xfc6d[49],_0xfc6d[50]],[_0xfc6d[51],_0xfc6d[52]],[_0xfc6d[53],_0xfc6d[54]],[_0xfc6d[55],_0xfc6d[56]],[_0xfc6d[57],_0xfc6d[58]],[_0xfc6d[59],_0xfc6d[60]],[_0xfc6d[61],_0xfc6d[62]],[_0xfc6d[63],_0xfc6d[64]],[_0xfc6d[65],_0xfc6d[66]],[_0xfc6d[67],_0xfc6d[68]],[_0xfc6d[69],_0xfc6d[70]],_0xfc6d[71],_0xfc6d[72]];return Promise[_0xfc6d[40]]()[_0xfc6d[39]](getContacts(_0xf964x20,_0xf964x25))[_0xfc6d[39]](function(_0xf964x24){_0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x24)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};function getContacts(_0xf964x20,_0xf964x25){return function(){var _0xf964x27,_0xf964x28,_0xf964x29,_0xf964x2a=[],_0xf964x2b=[];switch(_0xf964x20[_0xfc6d[113]][_0xfc6d[116]]){case _0xfc6d[115]:return User[_0xfc6d[114]](_0xf964x20[_0xfc6d[113]][_0xfc6d[42]])[_0xfc6d[39]](function(_0xf964x3b){return _0xf964x3b[_0xfc6d[112]]()})[_0xfc6d[39]](function(_0xf964x2b){_0xf964x28= _[_0xfc6d[85]](_0xf964x2b,_0xfc6d[42]);return Company[_0xfc6d[100]]({attributes:[_0xfc6d[42],_0xfc6d[76]],raw:true})})[_0xfc6d[39]](function(_0xf964x3a){_0xf964x2a= _0xf964x3a;return List[_0xfc6d[100]]({attributes:[_0xfc6d[42],_0xfc6d[76]],raw:true})})[_0xfc6d[39]](function(_0xf964x38){_0xf964x2b= _0xf964x38;_0xf964x29= {CompanyId:_0xf964x20[_0xfc6d[89]][_0xfc6d[71]]|| null,ListId:_0xf964x20[_0xfc6d[89]][_0xfc6d[72]]|| null};delete _0xf964x20[_0xfc6d[89]][_0xfc6d[71]];delete _0xf964x20[_0xfc6d[89]][_0xfc6d[72]];var _0xf964x39=_0xf964x29[_0xfc6d[72]]?{}:{ListId:{$in:_0xf964x28[_0xfc6d[104]](_[_0xfc6d[85]](_[_0xfc6d[97]](_0xf964x2b,{defaultEntry:true}),_0xfc6d[42]))}};if(_0xf964x20[_0xfc6d[89]][_0xfc6d[105]]){_0xf964x39[_0xfc6d[42]]= {$ne:_0xf964x20[_0xfc6d[89]][_0xfc6d[105]]};delete _0xf964x20[_0xfc6d[89]][_0xfc6d[105]]};return Contact[_0xfc6d[111]](_0xfc6d[108],_0xfc6d[109],{method:[_0xfc6d[110],_0xf964x29]})[_0xfc6d[107]](Util[_0xfc6d[106]](_0xf964x20[_0xfc6d[89]],_0xf964x39,{attributes:_0xf964x25,order:_0xf964x20[_0xfc6d[89]][_0xfc6d[88]]|| _0xfc6d[90]}))})[_0xfc6d[39]](function(_0xf964x37){_0xf964x27= {rows:_[_0xfc6d[85]](_0xf964x37[_0xfc6d[73]],_0xfc6d[101]),count:_0xf964x37[_0xfc6d[102]]};return Contact[_0xfc6d[103]]()})[_0xfc6d[39]](function(_0xf964x34){_0xf964x34= _[_0xfc6d[97]](_[_0xfc6d[94]](_0xf964x34),function(_0xf964x35){return _[_0xfc6d[96]](_0xf964x35,_0xfc6d[95])});var _0xf964x36={where:{name:_0xf964x34}};_0xf964x29[_0xfc6d[72]]&& (_0xf964x36[_0xfc6d[99]][_0xfc6d[98]]= [{ListId:_0xf964x29[_0xfc6d[72]]},{ListId:null}]);return CustomField[_0xfc6d[100]](_0xf964x36)})[_0xfc6d[39]](function(_0xf964x31){if(_0xf964x27[_0xfc6d[73]][_0xfc6d[79]]&& _0xf964x31[_0xfc6d[79]]){var _0xf964x32;if(_0xf964x25){_0xf964x32= _[_0xfc6d[85]](_0xf964x31,function(_0xf964x33){return _0xf964x33[_0xfc6d[76]]+ _0xfc6d[82]+ _0xf964x33[_0xfc6d[83]]+ _0xfc6d[84]})[_0xfc6d[81]](_0xfc6d[80])}else {_0xf964x32= _[_0xfc6d[85]](_0xf964x31,_0xfc6d[76])[_0xfc6d[81]](_0xfc6d[80])};return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[86],_0xf964x32,_[_0xfc6d[85]](_0xf964x27[_0xfc6d[73]],_0xfc6d[42])[_0xfc6d[81]](_0xfc6d[87]),_0xf964x20[_0xfc6d[89]][_0xfc6d[88]]|| _0xfc6d[90]),{type:sequelize[_0xfc6d[93]][_0xfc6d[92]]})}})[_0xfc6d[39]](function(_0xf964x2c){var _0xf964x2d,_0xf964x2e;_[_0xfc6d[78]](_0xf964x27[_0xfc6d[73]],function(_0xf964x2f,_0xf964x30){_0xf964x2c&& _[_0xfc6d[74]](_0xf964x2f,_0xf964x2c[_0xf964x30]);_0xf964x2d= _[_0xfc6d[75]](_0xf964x2a,{id:_0xf964x2f[_0xfc6d[71]]});_0xf964x2f[_0xfc6d[20]]= _0xf964x2d?_0xf964x2d[_0xfc6d[76]]:_0xfc6d[77];_0xf964x2e= _[_0xfc6d[75]](_0xf964x2b,{id:_0xf964x2f[_0xfc6d[72]]});_0xf964x2f[_0xfc6d[19]]= _0xf964x2e?_0xf964x2e[_0xfc6d[76]]:_0xfc6d[77];if(_0xf964x25){delete _0xf964x2f[_0xfc6d[42]];delete _0xf964x2f[_0xfc6d[71]];delete _0xf964x2f[_0xfc6d[72]]}});return _0xf964x27});default:_0xf964x29= {CompanyId:_0xf964x20[_0xfc6d[89]][_0xfc6d[71]]|| null,ListId:_0xf964x20[_0xfc6d[89]][_0xfc6d[72]]|| null};delete _0xf964x20[_0xfc6d[89]][_0xfc6d[71]];delete _0xf964x20[_0xfc6d[89]][_0xfc6d[72]];var _0xf964x39={};if(_0xf964x20[_0xfc6d[89]][_0xfc6d[105]]){_0xf964x39[_0xfc6d[42]]= {$ne:_0xf964x20[_0xfc6d[89]][_0xfc6d[105]]};delete _0xf964x20[_0xfc6d[89]][_0xfc6d[105]]};return Company[_0xfc6d[100]]({attributes:[_0xfc6d[42],_0xfc6d[76]],raw:true})[_0xfc6d[39]](function(_0xf964x3a){_0xf964x2a= _0xf964x3a;return List[_0xfc6d[100]]({attributes:[_0xfc6d[42],_0xfc6d[76]],raw:true})})[_0xfc6d[39]](function(_0xf964x38){_0xf964x2b= _0xf964x38;return Contact[_0xfc6d[111]]({method:[_0xfc6d[110],_0xf964x29]})[_0xfc6d[107]](Util[_0xfc6d[106]](_0xf964x20[_0xfc6d[89]],_0xf964x39,{attributes:_0xf964x25,order:_0xf964x20[_0xfc6d[89]][_0xfc6d[88]]|| _0xfc6d[90]}))})[_0xfc6d[39]](function(_0xf964x37){_0xf964x27= {rows:_[_0xfc6d[85]](_0xf964x37[_0xfc6d[73]],_0xfc6d[101]),count:_0xf964x37[_0xfc6d[102]]};return Contact[_0xfc6d[103]]()})[_0xfc6d[39]](function(_0xf964x34){_0xf964x34= _[_0xfc6d[97]](_[_0xfc6d[94]](_0xf964x34),function(_0xf964x35){return _[_0xfc6d[96]](_0xf964x35,_0xfc6d[95])});var _0xf964x36={where:{name:_0xf964x34}};_0xf964x29[_0xfc6d[72]]&& (_0xf964x36[_0xfc6d[99]][_0xfc6d[98]]= [{ListId:_0xf964x29[_0xfc6d[72]]},{ListId:null}]);return CustomField[_0xfc6d[100]](_0xf964x36)})[_0xfc6d[39]](function(_0xf964x31){if(_0xf964x27[_0xfc6d[73]][_0xfc6d[79]]&& _0xf964x31[_0xfc6d[79]]){var _0xf964x32;if(_0xf964x25){_0xf964x32= _[_0xfc6d[85]](_0xf964x31,function(_0xf964x33){return _0xf964x33[_0xfc6d[76]]+ _0xfc6d[82]+ _0xf964x33[_0xfc6d[83]]+ _0xfc6d[84]})[_0xfc6d[81]](_0xfc6d[80])}else {_0xf964x32= _[_0xfc6d[85]](_0xf964x31,_0xfc6d[76])[_0xfc6d[81]](_0xfc6d[80])};return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[86],_0xf964x32,_[_0xfc6d[85]](_0xf964x27[_0xfc6d[73]],_0xfc6d[42])[_0xfc6d[81]](_0xfc6d[87]),_0xf964x20[_0xfc6d[89]][_0xfc6d[88]]|| _0xfc6d[90]),{type:sequelize[_0xfc6d[93]][_0xfc6d[92]]})}})[_0xfc6d[39]](function(_0xf964x2c){var _0xf964x2d,_0xf964x2e;_[_0xfc6d[78]](_0xf964x27[_0xfc6d[73]],function(_0xf964x2f,_0xf964x30){_0xf964x2c&& _[_0xfc6d[74]](_0xf964x2f,_0xf964x2c[_0xf964x30]);_0xf964x2d= _[_0xfc6d[75]](_0xf964x2a,{id:_0xf964x2f[_0xfc6d[71]]});_0xf964x2f[_0xfc6d[20]]= _0xf964x2d?_0xf964x2d[_0xfc6d[76]]:_0xfc6d[77];_0xf964x2e= _[_0xfc6d[75]](_0xf964x2b,{id:_0xf964x2f[_0xfc6d[72]]});_0xf964x2f[_0xfc6d[19]]= _0xf964x2e?_0xf964x2e[_0xfc6d[76]]:_0xfc6d[77];if(_0xf964x25){delete _0xf964x2f[_0xfc6d[42]];delete _0xf964x2f[_0xfc6d[71]];delete _0xf964x2f[_0xfc6d[72]]}});return _0xf964x27})}}}exports[_0xfc6d[103]]= function(_0xf964x20,_0xf964x21){return Contact[_0xfc6d[103]]()[_0xfc6d[39]](function(_0xf964x34){return _0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x34)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[117]]= function(_0xf964x20,_0xf964x21,_0xf964x22){_0xf964x20[_0xfc6d[89]][_0xfc6d[118]]= _0xf964x20[_0xfc6d[89]][_0xfc6d[118]]|| _0xfc6d[119];_0xf964x20[_0xfc6d[89]][_0xfc6d[120]]= _0xf964x20[_0xfc6d[89]][_0xfc6d[120]]|| _0xfc6d[61];_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]= _0xf964x20[_0xfc6d[89]][_0xfc6d[121]]|| _0xfc6d[122];_0xf964x20[_0xfc6d[89]][_0xfc6d[123]]= _0xf964x20[_0xfc6d[89]][_0xfc6d[123]]|| _0xfc6d[124];var _0xf964x3c,_0xf964x3d={};return Contact[_0xfc6d[114]](_0xf964x20[_0xfc6d[138]][_0xfc6d[42]])[_0xfc6d[39]](function(_0xf964x3e){if(!_0xf964x3e){return _0xf964x21[_0xfc6d[125]](404)};switch(_0xf964x20[_0xfc6d[89]][_0xfc6d[118]]){case _0xfc6d[119]:switch(_0xf964x20[_0xfc6d[89]][_0xfc6d[120]]){case _0xfc6d[61]:_0xf964x3c= (_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12])?ReportCallHistory:ReportCall;if(_0xf964x20[_0xfc6d[89]][_0xfc6d[123]]=== _0xfc6d[126]){_0xf964x3d[_0xfc6d[127]]= [_0xf964x3e[_0xfc6d[61]],_0xf964x3e[_0xfc6d[63]]]}else {_0xf964x3d[_0xfc6d[128]]= [_0xf964x3e[_0xfc6d[61]],_0xf964x3e[_0xfc6d[63]]]};break;case _0xfc6d[67]:_0xf964x3c= MailRoom;_0xf964x3d[_0xfc6d[129]]= _0xf964x3e[_0xfc6d[67]];if(_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12]){_0xf964x3d[_0xfc6d[130]]= {$lt:moment()[_0xfc6d[132]](_0xfc6d[131])}}else {_0xf964x3d[_0xfc6d[130]]= {$gte:moment()[_0xfc6d[132]](_0xfc6d[131])}};break;case _0xfc6d[134]:_0xf964x3c= ChatRoom;_0xf964x3d[_0xfc6d[133]]= _0xf964x3e[_0xfc6d[67]];if(_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12]){_0xf964x3d[_0xfc6d[130]]= {$lt:moment()[_0xfc6d[132]](_0xfc6d[131])}}else {_0xf964x3d[_0xfc6d[130]]= {$gte:moment()[_0xfc6d[132]](_0xfc6d[131])}};break;case _0xfc6d[65]:_0xf964x3c= FaxRoom;_0xf964x3d[_0xfc6d[133]]= _0xf964x3e[_0xfc6d[65]];if(_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12]){_0xf964x3d[_0xfc6d[130]]= {$lt:moment()[_0xfc6d[132]](_0xfc6d[131])}}else {_0xf964x3d[_0xfc6d[130]]= {$gte:moment()[_0xfc6d[132]](_0xfc6d[131])}};break;case _0xfc6d[135]:_0xf964x3c= SmsRoom;_0xf964x3d[_0xfc6d[133]]= [_0xf964x3e[_0xfc6d[61]],_0xf964x3e[_0xfc6d[63]]];if(_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12]){_0xf964x3d[_0xfc6d[130]]= {$lt:moment()[_0xfc6d[132]](_0xfc6d[131])}}else {_0xf964x3d[_0xfc6d[130]]= {$gte:moment()[_0xfc6d[132]](_0xfc6d[131])}};break;default:_0xf964x3c= (_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12])?ReportCallHistory:ReportCall};break;case _0xfc6d[137]:switch(_0xf964x20[_0xfc6d[89]][_0xfc6d[120]]){case _0xfc6d[61]:_0xf964x3c= (_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12])?ReportQueueHistory:ReportQueue;_0xf964x3d[_0xfc6d[136]]= [_0xf964x3e[_0xfc6d[61]],_0xf964x3e[_0xfc6d[63]]];break;case _0xfc6d[67]:return _0xf964x21[_0xfc6d[125]](404);default:_0xf964x3c= (_0xf964x20[_0xfc6d[89]][_0xfc6d[121]]=== _0xfc6d[12])?ReportQueueHistory:ReportQueue};break;default:_0xf964x3c= ReportCall};delete _0xf964x20[_0xfc6d[89]][_0xfc6d[118]];delete _0xf964x20[_0xfc6d[89]][_0xfc6d[120]];delete _0xf964x20[_0xfc6d[89]][_0xfc6d[121]];delete _0xf964x20[_0xfc6d[89]][_0xfc6d[123]];return _0xf964x3c[_0xfc6d[107]](Util[_0xfc6d[106]](_0xf964x20[_0xfc6d[89]],_0xf964x3d))})[_0xfc6d[39]](function(_0xf964x24){_0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x24)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[120]]= function(_0xf964x20,_0xf964x21){var _0xf964x3f;return Contact[_0xfc6d[111]](_0xfc6d[108],_0xfc6d[113],_0xfc6d[109])[_0xfc6d[114]](_0xf964x20[_0xfc6d[138]][_0xfc6d[42]])[_0xfc6d[39]](function(_0xf964x44){if(!_0xf964x44){return _0xf964x21[_0xfc6d[125]](404)};_0xf964x3f= _0xf964x44;return CustomField[_0xfc6d[100]]({where:{$or:[{ListId:_0xf964x3f[_0xfc6d[72]]},{ListId:null}]}})})[_0xfc6d[39]](function(_0xf964x31){if(_0xf964x31[_0xfc6d[79]]){var _0xf964x32=_[_0xfc6d[85]](_0xf964x31,_0xfc6d[76])[_0xfc6d[81]](_0xfc6d[80]);return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[140],_0xf964x32,_0xf964x20[_0xfc6d[138]][_0xfc6d[42]]),{type:sequelize[_0xfc6d[93]][_0xfc6d[92]]})}})[_0xfc6d[39]](function(_0xf964x40){if(_0xf964x40){_[_0xfc6d[78]](_0xf964x40[0],function(_0xf964x41,_0xf964x42,_0xf964x43){if(_0xf964x41=== _0xfc6d[139]){_0xf964x43[_0xf964x42]= null}});_[_0xfc6d[74]](_0xf964x3f[_0xfc6d[101]],_0xf964x40[0])}})[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x3f)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[141]]= function(_0xf964x20,_0xf964x21){var _0xf964x3d={},_0xf964x45;switch(_0xf964x20[_0xfc6d[143]][_0xfc6d[147]]){case _0xfc6d[145]:if(_0xf964x20[_0xfc6d[143]][_0xfc6d[142]]=== _0xfc6d[137]){_0xf964x3d= {$or:{phone:_0xf964x20[_0xfc6d[143]][_0xfc6d[136]],mobile:_0xf964x20[_0xfc6d[143]][_0xfc6d[136]]}}}else {_0xf964x3d= {$or:{phone:_0xf964x20[_0xfc6d[143]][_0xfc6d[144]],mobile:_0xf964x20[_0xfc6d[143]][_0xfc6d[144]]}}};break;case _0xfc6d[146]:_0xf964x3d= {email:_0xf964x20[_0xfc6d[143]][_0xfc6d[129]]};break;default:_0xf964x3d= {}};var _0xf964x46=_[_0xfc6d[85]](_[_0xfc6d[85]](_0xf964x20[_0xfc6d[113]].Lists,_0xfc6d[101]),_0xfc6d[42]);var _0xf964x47;return List[_0xfc6d[155]]({where:{defaultEntry:true}})[_0xfc6d[39]](function(_0xf964x2e){if(_0xf964x2e){_0xf964x46[_0xfc6d[151]](_0xf964x2e[_0xfc6d[42]])};if(_0xf964x20[_0xfc6d[143]][_0xfc6d[72]]){_0xf964x47= _[_0xfc6d[96]](_0xf964x46,_0xf964x20[_0xfc6d[143]].ListId)?{id:_0xf964x20[_0xfc6d[143]][_0xfc6d[72]]}:null}else {_0xf964x47= {id:_0xf964x46}};if(_0xf964x47){return Contact[_0xfc6d[107]]({where:_0xf964x3d,include:[{model:List,where:_0xf964x47}]})};return null})[_0xfc6d[39]](function(_0xf964x37){if(_0xf964x37&& _0xf964x37[_0xfc6d[73]][_0xfc6d[79]]){_0xf964x45= _0xf964x37;return null}else {_0xf964x45= {count:0,rows:[]};if(_0xf964x20[_0xfc6d[143]][_0xfc6d[148]]&& _0xf964x20[_0xfc6d[143]][_0xfc6d[72]]&& _[_0xfc6d[96]](_0xf964x46,_0xf964x20[_0xfc6d[143]].ListId)){var _0xf964x3f={};return Contact[_0xfc6d[154]]({firstName:_0xf964x20[_0xfc6d[143]][_0xfc6d[153]],phone:_0xf964x20[_0xfc6d[143]][_0xfc6d[136]],ListId:_0xf964x20[_0xfc6d[143]][_0xfc6d[72]]})[_0xfc6d[39]](function(_0xf964x3e){_0xf964x3f= _0xf964x3e[_0xfc6d[152]]({plain:true});return List[_0xfc6d[114]](_0xf964x20[_0xfc6d[143]].ListId,{raw:true})})[_0xfc6d[39]](function(_0xf964x2e){_0xf964x3f[_0xfc6d[19]]= _0xf964x2e;_0xf964x45[_0xfc6d[73]][_0xfc6d[151]](_0xf964x3f)})[_0xfc6d[36]](function(_0xf964x23){logger[_0xfc6d[150]](_0xfc6d[149],_0xf964x23)})}}})[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x45)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[154]]= function(_0xf964x20,_0xf964x21,_0xf964x22){if(!_0xf964x20[_0xfc6d[143]][_0xfc6d[43]]||  !_0xf964x20[_0xfc6d[143]][_0xfc6d[72]]){return handleError(_0xf964x21,{message:_0xfc6d[156]})};var _0xf964x3f,_0xf964x48=moment()[_0xfc6d[91]](_0xfc6d[157]),_0xf964x49=[],_0xf964x4a=[],_0xf964x4b=[];_0xf964x20[_0xfc6d[143]][_0xfc6d[158]]= _0xf964x20[_0xfc6d[113]][_0xfc6d[42]];_0xf964x20[_0xfc6d[143]][_0xfc6d[130]]= _0xf964x48;_0xf964x20[_0xfc6d[143]][_0xfc6d[159]]= _0xf964x48;_[_0xfc6d[162]](_0xf964x20[_0xfc6d[143]],function(_0xf964x41,_0xf964x42){if(_0xf964x41){switch(_0xf964x42){case _0xfc6d[47]:if(_0xf964x41[_0xfc6d[79]]){_0xf964x4a[_0xfc6d[151]](_0xf964x41[_0xfc6d[81]](_0xfc6d[160])+ _0xfc6d[160]);_0xf964x49[_0xfc6d[151]](_0xf964x42);_0xf964x4b[_0xfc6d[151]](_0xfc6d[161])};break;default:_0xf964x49[_0xfc6d[151]](_0xf964x42);_0xf964x4a[_0xfc6d[151]](_0xf964x41);_0xf964x4b[_0xfc6d[151]](_0xfc6d[161])}}});return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[164],_0xf964x49[_0xfc6d[81]](_0xfc6d[80]),_0xf964x4b[_0xfc6d[81]](_0xfc6d[80])),{replacements:_0xf964x4a})[_0xfc6d[39]](function(_0xf964x3e){_0xf964x20[_0xfc6d[143]][_0xfc6d[42]]= _0xf964x3e[0][_0xfc6d[163]];return _0xf964x21[_0xfc6d[38]](201)[_0xfc6d[37]](_0xf964x20[_0xfc6d[143]])})[_0xfc6d[36]](function(_0xf964x23){return _0xf964x22(_0xf964x23)})};exports[_0xfc6d[165]]= function(_0xf964x20,_0xf964x21,_0xf964x22){var _0xf964x3f,_0xf964x4c;return Contact[_0xfc6d[114]](_0xf964x20[_0xfc6d[138]][_0xfc6d[42]])[_0xfc6d[39]](function(_0xf964x3e){_0xf964x3f= _0xf964x3e[_0xfc6d[101]];_0xf964x4c= _[_0xfc6d[168]](_0xf964x3e[_0xfc6d[101]]);delete _0xf964x4c[_0xfc6d[42]];_0xf964x4c[_0xfc6d[158]]= _0xf964x20[_0xfc6d[113]][_0xfc6d[42]];_0xf964x4c[_0xfc6d[72]]= _0xf964x20[_0xfc6d[143]][_0xfc6d[72]];_0xf964x4c[_0xfc6d[47]]= _0xf964x4c[_0xfc6d[47]]?_0xf964x4c[_0xfc6d[47]][_0xfc6d[169]](_0xfc6d[160]):[];if(_0xf964x4c[_0xfc6d[47]][_0xfc6d[79]]> 1){_0xf964x4c[_0xfc6d[47]][_0xfc6d[170]]()};return Contact[_0xfc6d[154]](_0xf964x4c)})[_0xfc6d[39]](function(_0xf964x50){_0xf964x4c= _0xf964x50;if(_0xf964x3f[_0xfc6d[72]]=== _0xf964x20[_0xfc6d[143]][_0xfc6d[72]]){return CustomField[_0xfc6d[100]]({where:{$or:[{ListId:_0xf964x3f[_0xfc6d[72]]},{ListId:null}]}})}})[_0xfc6d[39]](function(_0xf964x31){if(_0xf964x31&& _0xf964x31[_0xfc6d[79]]){var _0xf964x32=_[_0xfc6d[85]](_0xf964x31,_0xfc6d[76])[_0xfc6d[81]](_0xfc6d[80]);return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[140],_0xf964x32,_0xf964x3f[_0xfc6d[42]]),{type:sequelize[_0xfc6d[93]][_0xfc6d[92]]})}})[_0xfc6d[39]](function(_0xf964x4d){if(_0xf964x4d){var _0xf964x4e=[],_0xf964x4f=[];_[_0xfc6d[162]](_0xf964x4d[0],function(_0xf964x41,_0xf964x42){_0xf964x4e[_0xfc6d[151]](util[_0xfc6d[91]](_0xfc6d[166],_0xf964x42));_0xf964x4f[_0xfc6d[151]](_0xf964x41)});if(_0xf964x4e[_0xfc6d[79]]){_0xf964x4e= _0xf964x4e[_0xfc6d[81]](_0xfc6d[80]);return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[167],_0xf964x4e,_0xf964x4c[_0xfc6d[42]]),{replacements:_0xf964x4f})}}})[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[38]](201)[_0xfc6d[37]](_0xf964x4c)})[_0xfc6d[36]](function(_0xf964x23){return _0xf964x22(_0xf964x23)})};exports[_0xfc6d[171]]= function(_0xf964x20,_0xf964x21,_0xf964x22){var _0xf964x45=[],_0xf964x48=moment()[_0xfc6d[91]](_0xfc6d[157]),_0xf964x51=[],_0xf964x49,_0xf964x4a,_0xf964x52={ok:0,ko:0,failed:[]};return Tag[_0xfc6d[100]]()[_0xfc6d[39]](function(_0xf964x53){var _0xf964x54=[],_0xf964x55=[];var _0xf964x56=_[_0xfc6d[85]](_[_0xfc6d[85]](_0xf964x53,_0xfc6d[101]),_0xfc6d[76]);Async[_0xfc6d[180]](_0xf964x20[_0xfc6d[143]][_0xfc6d[173]],function(_0xf964x3e,_0xf964x30){if(_0xf964x3e[_0xfc6d[43]]&& _0xf964x3e[_0xfc6d[72]]){_0xf964x3e[_0xfc6d[158]]= _0xf964x20[_0xfc6d[113]][_0xfc6d[42]];_0xf964x3e[_0xfc6d[130]]= _0xf964x48;_0xf964x3e[_0xfc6d[159]]= _0xf964x48;_0xf964x3e[_0xfc6d[47]]&& (_0xf964x55= _[_0xfc6d[174]](_0xf964x55,_0xf964x3e[_0xfc6d[47]]));var _0xf964x49=[],_0xf964x4a=[],_0xf964x4b=[];_[_0xfc6d[162]](_0xf964x3e,function(_0xf964x41,_0xf964x42){if(_0xf964x41){switch(_0xf964x42){case _0xfc6d[47]:if(_0xf964x41[_0xfc6d[79]]){_0xf964x4a[_0xfc6d[151]](_0xf964x41[_0xfc6d[81]](_0xfc6d[160])+ _0xfc6d[160]);_0xf964x49[_0xfc6d[151]](_0xf964x42);_0xf964x4b[_0xfc6d[151]](_0xfc6d[161])};break;default:_0xf964x49[_0xfc6d[151]](_0xf964x42);_0xf964x4a[_0xfc6d[151]](_0xf964x41);_0xf964x4b[_0xfc6d[151]](_0xfc6d[161])}}});_0xf964x51[_0xfc6d[151]](sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[164],_0xf964x49[_0xfc6d[81]](_0xfc6d[80]),_0xf964x4b[_0xfc6d[81]](_0xfc6d[80])),{replacements:_0xf964x4a})[_0xfc6d[39]](function(_0xf964x50){_0xf964x3e[_0xfc6d[42]]= _0xf964x50[_0xfc6d[42]];_0xf964x45[_0xfc6d[151]](_0xf964x3e);_0xf964x52[_0xfc6d[179]]++})[_0xfc6d[36]](function(_0xf964x23){logger[_0xfc6d[176]](_0xf964x23[_0xfc6d[175]]);_0xf964x52[_0xfc6d[177]]++;_0xf964x52[_0xfc6d[178]][_0xfc6d[151]](_0xf964x30)}))}else {_0xf964x52[_0xfc6d[177]]++;_0xf964x52[_0xfc6d[178]][_0xfc6d[151]](_0xf964x30)}});_0xf964x55[_0xfc6d[79]]&& _[_0xfc6d[78]](_0xf964x55,function(_0xf964x35){if(!_0xf964x56[_0xfc6d[79]]||  !_[_0xfc6d[96]](_0xf964x56,_0xf964x35)){_0xf964x54[_0xfc6d[151]](Tag[_0xfc6d[154]]({name:_0xf964x35}))}});return _0xf964x54})[_0xfc6d[172]]()[_0xfc6d[39]](function(){return _0xf964x51})[_0xfc6d[172]]()[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[38]](201)[_0xfc6d[37]](_0xf964x52)})[_0xfc6d[36]](function(_0xf964x23){return _0xf964x22(_0xf964x23)})};exports[_0xfc6d[181]]= function(_0xf964x20,_0xf964x21,_0xf964x22){return Promise[_0xfc6d[172]]([])[_0xfc6d[39]](updateContact(_0xf964x20,_0xf964x21))[_0xfc6d[39]](function(_0xf964x3e){return _0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x3e)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[74]]= function(_0xf964x20,_0xf964x21,_0xf964x22){var _0xf964x3f;return Promise[_0xfc6d[172]]([])[_0xfc6d[39]](updateContact(_0xf964x20,_0xf964x21))[_0xfc6d[39]](function(_0xf964x3e){_0xf964x3f= _0xf964x3e;if(_0xf964x20[_0xfc6d[143]][_0xfc6d[182]]){return Contact[_0xfc6d[183]]({where:{id:_0xf964x20[_0xfc6d[143]][_0xfc6d[182]]},individualHooks:true})}})[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[38]](200)[_0xfc6d[37]](_0xf964x3f)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};function updateContact(_0xf964x20,_0xf964x21){return function(){var _0xf964x3f;return Tag[_0xfc6d[100]]()[_0xfc6d[39]](function(_0xf964x53){var _0xf964x54=[];var _0xf964x56=_[_0xfc6d[85]](_[_0xfc6d[85]](_0xf964x53,_0xfc6d[101]),_0xfc6d[76]);if(_0xf964x20[_0xfc6d[143]][_0xfc6d[47]]){_0xf964x20[_0xfc6d[143]][_0xfc6d[47]][_0xfc6d[78]](function(_0xf964x35){if(!_[_0xfc6d[96]](_0xf964x56,_0xf964x35)){_0xf964x54[_0xfc6d[151]](Tag[_0xfc6d[154]]({name:_0xf964x35}))}})};return _0xf964x54})[_0xfc6d[39]](function(){return Contact[_0xfc6d[114]](_0xf964x20[_0xfc6d[138]][_0xfc6d[42]])})[_0xfc6d[39]](function(_0xf964x3e){if(!_0xf964x3e){return _0xf964x21[_0xfc6d[125]](404)};delete _0xf964x20[_0xfc6d[143]][_0xfc6d[42]];return _0xf964x3e[_0xfc6d[186]](_0xf964x20[_0xfc6d[143]])})[_0xfc6d[39]](function(_0xf964x3e){_0xf964x3f= _0xf964x3e;return CustomField[_0xfc6d[100]]({where:{$or:[{ListId:_0xf964x3f[_0xfc6d[72]]},{ListId:null}]}})})[_0xfc6d[39]](function(_0xf964x31){if(_0xf964x31[_0xfc6d[79]]){var _0xf964x4e=[];var _0xf964x4f=[];_0xf964x31[_0xfc6d[78]](function(_0xf964x35){if(_0xf964x20[_0xfc6d[143]][_0xfc6d[185]](_0xf964x35[_0xfc6d[76]])){_0xf964x4e[_0xfc6d[151]](util[_0xfc6d[91]](_0xfc6d[166],_0xf964x35[_0xfc6d[76]]));_0xf964x4f[_0xfc6d[151]](_0xf964x20[_0xfc6d[143]][_0xf964x35[_0xfc6d[76]]])}});if(_0xf964x4e[_0xfc6d[79]]){_0xf964x4e= _0xf964x4e[_0xfc6d[81]](_0xfc6d[80]);return sequelize[_0xfc6d[89]](util[_0xfc6d[91]](_0xfc6d[167],_0xf964x4e,_0xf964x3f[_0xfc6d[42]]),{replacements:_0xf964x4f})}}})[_0xfc6d[39]](function(){return TdUpdate[_0xfc6d[154]]({action:_0xfc6d[184],listId:_0xf964x3f[_0xfc6d[72]],contactId:_0xf964x3f[_0xfc6d[42]]})})[_0xfc6d[39]](function(){return _0xf964x3f})}}exports[_0xfc6d[183]]= function(_0xf964x20,_0xf964x21){return Contact[_0xfc6d[114]](_0xf964x20[_0xfc6d[138]][_0xfc6d[42]])[_0xfc6d[39]](function(_0xf964x44){if(!_0xf964x44){return _0xf964x21[_0xfc6d[125]](404)};return _0xf964x44[_0xfc6d[183]]()})[_0xfc6d[39]](function(_0xf964x3e){return TdUpdate[_0xfc6d[154]]({action:_0xfc6d[187],listId:_0xf964x3e[_0xfc6d[72]],contactId:_0xf964x3e[_0xfc6d[42]]})})[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[125]](204)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};exports[_0xfc6d[188]]= function(_0xf964x20,_0xf964x21){return Contact[_0xfc6d[100]]({where:{id:_0xf964x20[_0xfc6d[89]][_0xfc6d[189]]}})[_0xfc6d[39]](function(_0xf964x37){var _0xf964x58=[];if(_0xf964x37&& _0xf964x37[_0xfc6d[79]]){_[_0xfc6d[78]](_0xf964x37,function(_0xf964x3e){_0xf964x58[_0xfc6d[151]](_0xf964x3e[_0xfc6d[183]]());_0xf964x58[_0xfc6d[151]](TdUpdate[_0xfc6d[154]]({action:_0xfc6d[187],listId:_0xf964x3e[_0xfc6d[72]],contactId:_0xf964x3e[_0xfc6d[42]]}))})};return _0xf964x58})[_0xfc6d[172]]()[_0xfc6d[39]](function(){return _0xf964x21[_0xfc6d[125]](204)})[_0xfc6d[36]](function(_0xf964x23){return handleError(_0xf964x21,_0xf964x23)})};function handleError(_0xf964x21,_0xf964x23){logger[_0xfc6d[150]](_0xf964x23[_0xfc6d[175]]);return _0xf964x21[_0xfc6d[38]](500)[_0xfc6d[37]](_0xf964x23)}
\ No newline at end of file