Built motion from commit 36b8e3b.|0.0.111
[motion.git] / server / api / contact_manager / contact_manager.controller.js
1 var _0x36b3=["\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","\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","\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","\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","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x69\x64","\x6D\x61\x70","\x71\x75\x65\x72\x79","\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","\x64\x65\x73\x63\x72\x69\x62\x65","\x67\x65\x74\x4C\x6F\x67","\x64\x65\x74\x61\x69\x6C","\x67\x65\x6E\x65\x72\x61\x6C","\x73\x68\x6F\x77","\x70\x68\x6F\x6E\x65","\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","\x6D\x6F\x62\x69\x6C\x65","\x73\x6F\x75\x72\x63\x65","\x66\x72\x6F\x6D","\x65\x6D\x61\x69\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x76\x69\x73\x69\x74\x6F\x72\x65\x6D\x61\x69\x6C","\x63\x68\x61\x74","\x66\x61\x78","\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","\x6D\x65\x72\x67\x65","\x6C\x65\x6E\x67\x74\x68","\x2C","\x6A\x6F\x69\x6E","\x6E\x61\x6D\x65","\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","\x66\x6F\x72\x6D\x61\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x4C\x69\x73\x74\x49\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x45\x76\x65\x6E\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\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","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x62\x6F\x64\x79","\x25\x73\x3D\x27\x25\x73\x27","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\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","\x55\x73\x65\x72\x49\x64","\x61\x6C\x6C","\x74\x61\x67\x73","\x73\x70\x6C\x69\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x63\x6F\x6E\x74\x61\x63\x74\x73","\x6B\x6F","\x6F\x6B","\x66\x6F\x72\x45\x61\x63\x68\x4F\x66","\x75\x6E\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x36b3[0];var _=require(_0x36b3[1]);var moment=require(_0x36b3[2]);var Contact=require(_0x36b3[4])[_0x36b3[3]];var User=require(_0x36b3[4])[_0x36b3[5]];var ContactPhone=require(_0x36b3[4])[_0x36b3[6]];var ContactEmail=require(_0x36b3[4])[_0x36b3[7]];var CustomField=require(_0x36b3[4])[_0x36b3[8]];var ReportCall=require(_0x36b3[4])[_0x36b3[9]];var ReportQueue=require(_0x36b3[4])[_0x36b3[10]];var ReportQueueHistory=require(_0x36b3[4])[_0x36b3[12]][_0x36b3[11]];var ReportChatRoom=require(_0x36b3[4])[_0x36b3[13]];var ReportChatRoomHistory=require(_0x36b3[4])[_0x36b3[12]][_0x36b3[14]];var FaxRoom=require(_0x36b3[4])[_0x36b3[15]];var SmsRoom=require(_0x36b3[4])[_0x36b3[16]];var ReportIntegration=require(_0x36b3[4])[_0x36b3[17]];var List=require(_0x36b3[4])[_0x36b3[18]];var ReportCallHistory=require(_0x36b3[4])[_0x36b3[12]][_0x36b3[19]];var ReportMailSession=require(_0x36b3[4])[_0x36b3[20]];var MailRoom=require(_0x36b3[4])[_0x36b3[21]];var ReportMailSessionHistory=require(_0x36b3[4])[_0x36b3[12]][_0x36b3[22]];var Tag=require(_0x36b3[4])[_0x36b3[23]];var stream=require(_0x36b3[24]);var sequelize=require(_0x36b3[4])[_0x36b3[25]];var util=require(_0x36b3[26]);var Util=require(_0x36b3[27]);var Async=require(_0x36b3[28]);exports[_0x36b3[29]]=function(_0x8040x1b,_0x8040x1c,_0x8040x1d){switch(_0x8040x1b[_0x36b3[45]][_0x36b3[48]]){case _0x36b3[47]:return User[_0x36b3[46]](_0x8040x1b[_0x36b3[45]][_0x36b3[35]])[_0x36b3[34]](function(_0x8040x22){return _0x8040x22[_0x36b3[44]]()})[_0x36b3[34]](function(_0x8040x20){var _0x8040x21=_[_0x36b3[36]](_0x8040x20,_0x36b3[35]);return Contact[_0x36b3[43]](_0x36b3[40],_0x36b3[41],{method:[_0x36b3[42],_0x8040x1b[_0x36b3[37]]]})[_0x36b3[39]](Util[_0x36b3[38]](_0x8040x1b[_0x36b3[37]],{ListId:{$in:_0x8040x21}}))})[_0x36b3[34]](function(_0x8040x1f){_0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x1f)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return handleError(_0x8040x1c,_0x8040x1e)});default:return Contact[_0x36b3[43]](_0x36b3[40],_0x36b3[41],{method:[_0x36b3[42],_0x8040x1b[_0x36b3[37]]]})[_0x36b3[39]](Util[_0x36b3[38]](_0x8040x1b[_0x36b3[37]]))[_0x36b3[34]](function(_0x8040x1f){_0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x1f)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return handleError(_0x8040x1c,_0x8040x1e)})}};exports[_0x36b3[49]]=function(_0x8040x1b,_0x8040x1c){return Contact[_0x36b3[49]]()[_0x36b3[34]](function(_0x8040x23){return _0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x23)})[_0x36b3[31]](function(_0x8040x1e){return handleError(_0x8040x1c,_0x8040x1e)})};exports[_0x36b3[50]]=function(_0x8040x1b,_0x8040x1c,_0x8040x1d){_0x8040x1b[_0x36b3[37]][_0x36b3[51]]=_0x8040x1b[_0x36b3[37]][_0x36b3[51]]||_0x36b3[52];_0x8040x1b[_0x36b3[37]][_0x36b3[53]]=_0x8040x1b[_0x36b3[37]][_0x36b3[53]]||_0x36b3[54];_0x8040x1b[_0x36b3[37]][_0x36b3[55]]=_0x8040x1b[_0x36b3[37]][_0x36b3[55]]||_0x36b3[56];_0x8040x1b[_0x36b3[37]][_0x36b3[57]]=_0x8040x1b[_0x36b3[37]][_0x36b3[57]]||_0x36b3[58];var _0x8040x24,_0x8040x25={};return Contact[_0x36b3[46]](_0x8040x1b[_0x36b3[75]][_0x36b3[35]])[_0x36b3[34]](function(_0x8040x26){if(!_0x8040x26){return _0x8040x1c[_0x36b3[59]](404)};switch(_0x8040x1b[_0x36b3[37]][_0x36b3[51]]){case _0x36b3[52]:switch(_0x8040x1b[_0x36b3[37]][_0x36b3[53]]){case _0x36b3[54]:_0x8040x24=(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12])?ReportCallHistory:ReportCall;if(_0x8040x1b[_0x36b3[37]][_0x36b3[57]]===_0x36b3[60]){_0x8040x25[_0x36b3[61]]=[_0x8040x26[_0x36b3[54]],_0x8040x26[_0x36b3[62]]]}else {_0x8040x25[_0x36b3[63]]=[_0x8040x26[_0x36b3[54]],_0x8040x26[_0x36b3[62]]]};break;case _0x36b3[65]:_0x8040x24=MailRoom;_0x8040x25[_0x36b3[64]]=_0x8040x26[_0x36b3[65]];if(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12]){_0x8040x25[_0x36b3[66]]={$lt:moment()[_0x36b3[68]](_0x36b3[67])}}else {_0x8040x25[_0x36b3[66]]={$gte:moment()[_0x36b3[68]](_0x36b3[67])}};break;case _0x36b3[70]:_0x8040x24=(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12])?ReportChatRoomHistory:ReportChatRoom;_0x8040x25[_0x36b3[69]]=_0x8040x26[_0x36b3[65]];break;case _0x36b3[71]:_0x8040x24=FaxRoom;_0x8040x25[_0x36b3[64]]=_0x8040x26[_0x36b3[71]];if(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12]){_0x8040x25[_0x36b3[66]]={$lt:moment()[_0x36b3[68]](_0x36b3[67])}}else {_0x8040x25[_0x36b3[66]]={$gte:moment()[_0x36b3[68]](_0x36b3[67])}};break;case _0x36b3[72]:_0x8040x24=SmsRoom;_0x8040x25[_0x36b3[64]]=[_0x8040x26[_0x36b3[54]],_0x8040x26[_0x36b3[62]]];if(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12]){_0x8040x25[_0x36b3[66]]={$lt:moment()[_0x36b3[68]](_0x36b3[67])}}else {_0x8040x25[_0x36b3[66]]={$gte:moment()[_0x36b3[68]](_0x36b3[67])}};break;default:_0x8040x24=(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12])?ReportCallHistory:ReportCall};break;case _0x36b3[74]:switch(_0x8040x1b[_0x36b3[37]][_0x36b3[53]]){case _0x36b3[54]:_0x8040x24=(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12])?ReportQueueHistory:ReportQueue;_0x8040x25[_0x36b3[73]]=[_0x8040x26[_0x36b3[54]],_0x8040x26[_0x36b3[62]]];break;case _0x36b3[65]:return _0x8040x1c[_0x36b3[59]](404);default:_0x8040x24=(_0x8040x1b[_0x36b3[37]][_0x36b3[55]]===_0x36b3[12])?ReportQueueHistory:ReportQueue};break;default:_0x8040x24=ReportCall};delete _0x8040x1b[_0x36b3[37]][_0x36b3[51]];delete _0x8040x1b[_0x36b3[37]][_0x36b3[53]];delete _0x8040x1b[_0x36b3[37]][_0x36b3[55]];delete _0x8040x1b[_0x36b3[37]][_0x36b3[57]];return _0x8040x24[_0x36b3[39]](Util[_0x36b3[38]](_0x8040x1b[_0x36b3[37]],_0x8040x25))})[_0x36b3[34]](function(_0x8040x1f){_0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x1f)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return handleError(_0x8040x1c,_0x8040x1e)})};exports[_0x36b3[53]]=function(_0x8040x1b,_0x8040x1c){var _0x8040x27;return Contact[_0x36b3[43]](_0x36b3[40],_0x36b3[45],_0x36b3[41])[_0x36b3[46]](_0x8040x1b[_0x36b3[75]][_0x36b3[35]])[_0x36b3[34]](function(_0x8040x2b){if(!_0x8040x2b){return _0x8040x1c[_0x36b3[59]](404)};_0x8040x27=_0x8040x2b[_0x36b3[85]];return CustomField[_0x36b3[87]]({where:{ListId:_0x8040x27[_0x36b3[86]]}})})[_0x36b3[34]](function(_0x8040x29){if(_0x8040x29[_0x36b3[77]]){var _0x8040x2a=_[_0x36b3[36]](_0x8040x29,_0x36b3[80])[_0x36b3[79]](_0x36b3[78]);return sequelize[_0x36b3[37]](util[_0x36b3[82]](_0x36b3[81],_0x8040x2a,_0x8040x1b[_0x36b3[75]][_0x36b3[35]]),{type:sequelize[_0x36b3[84]][_0x36b3[83]]})}})[_0x36b3[34]](function(_0x8040x28){if(_0x8040x28){_[_0x36b3[76]](_0x8040x27,_0x8040x28[0])}})[_0x36b3[34]](function(){return _0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x27)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return handleError(_0x8040x1c,_0x8040x1e)})};exports[_0x36b3[88]]=function(_0x8040x1b,_0x8040x1c){return ReportIntegration[_0x36b3[46]](_0x8040x1b[_0x36b3[75]][_0x36b3[35]])[_0x36b3[34]](function(_0x8040x2d){var _0x8040x25={};switch(_0x8040x2d[_0x36b3[91]]){case _0x36b3[89]:_0x8040x25={$or:{phone:_0x8040x2d[_0x36b3[73]],mobile:_0x8040x2d[_0x36b3[73]]}};break;case _0x36b3[90]:_0x8040x25={email:_0x8040x2d[_0x36b3[64]]};break;default:_0x8040x25={}};return Contact[_0x36b3[87]]({where:_0x8040x25,include:[{model:List,where:{id:_[_0x36b3[36]](_[_0x36b3[36]](_0x8040x1b[_0x36b3[45]].Lists,_0x36b3[85]),_0x36b3[35])}}]})})[_0x36b3[34]](function(_0x8040x2c){return _0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x2c)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return handleError(_0x8040x1c,_0x8040x1e)})};exports[_0x36b3[92]]=function(_0x8040x1b,_0x8040x1c,_0x8040x1d){var _0x8040x27;return Tag[_0x36b3[87]]()[_0x36b3[34]](function(_0x8040x2f){var _0x8040x30=[];var _0x8040x31=_[_0x36b3[36]](_[_0x36b3[36]](_0x8040x2f,_0x36b3[85]),_0x36b3[80]);if(_0x8040x1b[_0x36b3[94]][_0x36b3[101]]){var _0x8040x32=_0x8040x1b[_0x36b3[94]][_0x36b3[101]][_0x36b3[102]](_0x36b3[78]);_0x8040x32[_0x36b3[97]](function(_0x8040x2e){if(!_[_0x36b3[103]](_0x8040x31,_0x8040x2e)){_0x8040x30[_0x36b3[96]](Tag[_0x36b3[92]]({name:_0x8040x2e}))}})};return _0x8040x30})[_0x36b3[100]]()[_0x36b3[34]](function(){_0x8040x1b[_0x36b3[94]][_0x36b3[99]]=_0x8040x1b[_0x36b3[45]][_0x36b3[35]];return Contact[_0x36b3[92]](_0x8040x1b[_0x36b3[94]])})[_0x36b3[34]](function(_0x8040x26){_0x8040x27=_0x8040x26;return CustomField[_0x36b3[87]]({where:{ListId:_0x8040x27[_0x36b3[86]]}})})[_0x36b3[34]](function(_0x8040x29){if(_0x8040x29[_0x36b3[77]]){var _0x8040x2a=[];_0x8040x29[_0x36b3[97]](function(_0x8040x2e){if(_0x8040x1b[_0x36b3[94]][_0x36b3[93]](_0x8040x2e[_0x36b3[80]])){_0x8040x2a[_0x36b3[96]](util[_0x36b3[82]](_0x36b3[95],_0x8040x2e[_0x36b3[80]],_0x8040x1b[_0x36b3[94]][_0x8040x2e[_0x36b3[80]]]))}});if(_0x8040x2a[_0x36b3[77]]){_0x8040x2a=_0x8040x2a[_0x36b3[79]](_0x36b3[78]);return sequelize[_0x36b3[37]](util[_0x36b3[82]](_0x36b3[98],_0x8040x2a,_0x8040x27[_0x36b3[35]]))}}})[_0x36b3[34]](function(){return _0x8040x1c[_0x36b3[33]](201)[_0x36b3[32]](_0x8040x27)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return _0x8040x1d(_0x8040x1e)})};exports[_0x36b3[104]]=function(_0x8040x1b,_0x8040x1c,_0x8040x1d){var _0x8040x33=[];var _0x8040x34={ok:0,ko:0};return Tag[_0x36b3[87]]()[_0x36b3[34]](function(_0x8040x2f){var _0x8040x30=[],_0x8040x32=[];var _0x8040x31=_[_0x36b3[36]](_[_0x36b3[36]](_0x8040x2f,_0x36b3[85]),_0x36b3[80]);_0x8040x1b[_0x36b3[94]][_0x36b3[105]][_0x36b3[97]](function(_0x8040x26){if(_0x8040x26[_0x36b3[101]]){_0x8040x32=_[_0x36b3[109]](_0x8040x32,_0x8040x26[_0x36b3[101]][_0x36b3[102]](_0x36b3[78]))}});_0x8040x32[_0x36b3[97]](function(_0x8040x2e){if(!_[_0x36b3[103]](_0x8040x31,_0x8040x2e)){_0x8040x30[_0x36b3[96]](Tag[_0x36b3[92]]({name:_0x8040x2e}))}});return _0x8040x30})[_0x36b3[100]]()[_0x36b3[34]](function(){var _0x8040x36=[];Async[_0x36b3[108]](_0x8040x1b[_0x36b3[94]][_0x36b3[105]],function(_0x8040x26){_0x8040x26[_0x36b3[99]]=_0x8040x1b[_0x36b3[45]][_0x36b3[35]];_0x8040x36[_0x36b3[96]](Contact[_0x36b3[92]](_0x8040x26)[_0x36b3[34]](function(_0x8040x26){_0x8040x33[_0x36b3[96]](_0x8040x26);_0x8040x34[_0x36b3[107]]++})[_0x36b3[31]](function(_0x8040x1e){_0x8040x34[_0x36b3[106]]++}))});return _0x8040x36})[_0x36b3[100]]()[_0x36b3[34]](function(){return CustomField[_0x36b3[87]]({where:{ListId:{$in:_[_0x36b3[36]](_0x8040x1b[_0x36b3[94]][_0x36b3[105]],_0x36b3[86])}}})})[_0x36b3[34]](function(_0x8040x29){var _0x8040x35=[];if(_0x8040x29[_0x36b3[77]]){var _0x8040x2a=[];_0x8040x33[_0x36b3[97]](function(_0x8040x26){_0x8040x2a=[];_0x8040x29[_0x36b3[97]](function(_0x8040x2e){if(_0x8040x26[_0x36b3[93]](_0x8040x2e[_0x36b3[80]])){_0x8040x2a[_0x36b3[96]](util[_0x36b3[82]](_0x36b3[95],_0x8040x2e[_0x36b3[80]],_0x8040x1b[_0x36b3[94]][_0x8040x2e[_0x36b3[80]]]))}});if(_0x8040x2a[_0x36b3[77]]){_0x8040x2a=_0x8040x2a[_0x36b3[79]](_0x36b3[78]);_0x8040x35[_0x36b3[96]](sequelize[_0x36b3[37]](util[_0x36b3[82]](_0x36b3[98],_0x8040x2a,_0x8040x26[_0x36b3[35]])))}})};return _0x8040x35})[_0x36b3[100]]()[_0x36b3[34]](function(){return _0x8040x1c[_0x36b3[33]](201)[_0x36b3[32]](_0x8040x34)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return _0x8040x1d(_0x8040x1e)})};exports[_0x36b3[110]]=function(_0x8040x1b,_0x8040x1c,_0x8040x1d){var _0x8040x27;return Tag[_0x36b3[87]]()[_0x36b3[34]](function(_0x8040x2f){var _0x8040x30=[];var _0x8040x31=_[_0x36b3[36]](_[_0x36b3[36]](_0x8040x2f,_0x36b3[85]),_0x36b3[80]);if(_0x8040x1b[_0x36b3[94]][_0x36b3[101]]){var _0x8040x32=_0x8040x1b[_0x36b3[94]][_0x36b3[101]][_0x36b3[102]](_0x36b3[78]);_0x8040x32[_0x36b3[97]](function(_0x8040x2e){if(!_[_0x36b3[103]](_0x8040x31,_0x8040x2e)){_0x8040x30[_0x36b3[96]](Tag[_0x36b3[92]]({name:_0x8040x2e}))}})};return _0x8040x30})[_0x36b3[34]](function(){return Contact[_0x36b3[46]](_0x8040x1b[_0x36b3[75]][_0x36b3[35]])})[_0x36b3[34]](function(_0x8040x26){delete _0x8040x1b[_0x36b3[94]][_0x36b3[35]];return _0x8040x26[_0x36b3[111]](_0x8040x1b[_0x36b3[94]])})[_0x36b3[34]](function(_0x8040x26){_0x8040x27=_0x8040x26;return CustomField[_0x36b3[87]]({where:{ListId:_0x8040x27[_0x36b3[86]]}})})[_0x36b3[34]](function(_0x8040x29){if(_0x8040x29[_0x36b3[77]]){var _0x8040x2a=[];_0x8040x29[_0x36b3[97]](function(_0x8040x2e){if(_0x8040x1b[_0x36b3[94]][_0x36b3[93]](_0x8040x2e[_0x36b3[80]])){_0x8040x2a[_0x36b3[96]](util[_0x36b3[82]](_0x36b3[95],_0x8040x2e[_0x36b3[80]],_0x8040x1b[_0x36b3[94]][_0x8040x2e[_0x36b3[80]]]))}});if(_0x8040x2a[_0x36b3[77]]){_0x8040x2a=_0x8040x2a[_0x36b3[79]](_0x36b3[78]);return sequelize[_0x36b3[37]](util[_0x36b3[82]](_0x36b3[98],_0x8040x2a,_0x8040x27[_0x36b3[35]]))}}})[_0x36b3[34]](function(){return _0x8040x1c[_0x36b3[33]](200)[_0x36b3[32]](_0x8040x27)})[_0x36b3[31]](function(_0x8040x1e){console[_0x36b3[30]](_0x8040x1e);return handleError(_0x8040x1c,_0x8040x1e)})};exports[_0x36b3[112]]=function(_0x8040x1b,_0x8040x1c){return Contact[_0x36b3[46]](_0x8040x1b[_0x36b3[75]][_0x36b3[35]])[_0x36b3[34]](function(_0x8040x2b){if(!_0x8040x2b){return _0x8040x1c[_0x36b3[59]](404)};return _0x8040x2b[_0x36b3[112]]()})[_0x36b3[34]](function(){return _0x8040x1c[_0x36b3[59]](204)})[_0x36b3[31]](function(_0x8040x1e){return handleError(_0x8040x1c,_0x8040x1e)})};exports[_0x36b3[113]]=function(_0x8040x1b,_0x8040x1c){return Contact[_0x36b3[112]]({where:{id:_0x8040x1b[_0x36b3[37]][_0x36b3[114]]},individualHooks:true})[_0x36b3[34]](function(){return _0x8040x1c[_0x36b3[59]](204)})[_0x36b3[31]](function(_0x8040x1e){return handleError(_0x8040x1c,_0x8040x1e)})};function handleError(_0x8040x1c,_0x8040x1e){return _0x8040x1c[_0x36b3[33]](500)[_0x36b3[32]](_0x8040x1e)}