Built motion from commit 366410c.|0.0.27
[motion.git] / server / api / xchatty / xchatty.controller.js
1 var _0x992f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6A\x73\x6D\x69\x6E","\x6D\x75\x73\x74\x61\x63\x68\x65","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x70\x61\x74\x68","\x6D\x64\x35","\x66\x73","\x75\x61\x2D\x70\x61\x72\x73\x65\x72\x2D\x6A\x73","\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65\x2D\x70\x61\x72\x73\x65\x72","\x69\x70\x61\x64\x64\x72\x2E\x6A\x73","\x67\x65\x6F\x69\x70\x2D\x6C\x69\x74\x65","\x74\x6F\x2D\x63\x73\x76","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x58\x63\x68\x61\x74\x74\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x78\x63\x68\x61\x74\x74\x79","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x55\x73\x65\x72","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x4A\x73\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x6E\x6F\x77","\x73\x65\x74","\x6A\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x72\x65\x6D\x6F\x74\x65","\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79\x2F","\x66\x61\x6C\x73\x65","\x74\x72\x75\x65","\x22\x22","\x6E\x75\x6C\x6C","\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79\x2F\x61\x73\x73\x65\x74\x73","\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x68\x65\x61\x64\x65\x72\x5F\x73\x68\x61\x70\x65","\x68\x65\x61\x64\x65\x72\x5F\x6F\x6E\x6C\x69\x6E\x65","\x6F\x6E\x6C\x69\x6E\x65\x5F\x6D\x65\x73\x73\x61\x67\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65\x5F\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x65\x6D\x61\x69\x6C\x5F\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x73\x74\x61\x72\x74\x5F\x63\x68\x61\x74\x5F\x62\x75\x74\x74\x6F\x6E","\x6F\x66\x66\x6C\x69\x6E\x65\x5F\x6D\x65\x73\x73\x61\x67\x65","\x68\x65\x61\x64\x65\x72\x5F\x6F\x66\x66\x6C\x69\x6E\x65","\x65\x6E\x71\x75\x69\x72\x79\x5F\x6D\x65\x73\x73\x61\x67\x65\x5F\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x65\x6E\x71\x75\x69\x72\x79\x5F\x62\x75\x74\x74\x6F\x6E","\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x5F\x74\x72\x61\x6E\x73\x63\x72\x69\x70\x74","\x72\x65\x6E\x64\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x53\x74\x79\x6C\x65\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x74\x65\x78\x74\x2F\x63\x73\x73","\x63\x73\x73","\x63\x6F\x6C\x6F\x72","\x63\x6F\x6C\x6F\x72\x5F\x66\x6F\x63\x75\x73","\x63\x6F\x6C\x6F\x72\x5F\x62\x75\x74\x74\x6F\x6E","\x67\x65\x74\x41\x73\x73\x65\x74\x73","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73","\x78\x63\x68\x61\x74\x74\x79","\x61\x73\x73\x65\x74\x73","\x72\x65\x73\x6F\x75\x72\x63\x65","\x71\x75\x65\x72\x79","\x6A\x6F\x69\x6E","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x67\x65\x74\x4A\x71\x75\x65\x72\x79\x4C\x69\x62\x72\x61\x72\x79","\x6A\x71\x75\x65\x72\x79","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x65\x73\x73\x69\x6F\x6E","\x6F\x70\x65\x6E\x5F\x73\x74\x61\x74\x65","\x64\x61\x74\x61","\x72\x6F\x6F\x6D\x5F\x69\x64","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","","\x65\x6D\x61\x69\x6C","\x61\x76\x61\x74\x61\x72","\x6C\x65\x6E\x67\x74\x68","\x76\x69\x73\x69\x74\x6F\x72\x5F\x69\x64","\x73\x69\x67\x6E\x65\x64\x5F\x75\x70","\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x28","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x29","\x6F\x70\x65\x6E","\x66\x69\x6E\x64\x4F\x6E\x65","\x61\x67\x65\x6E\x74","\x67\x65\x74\x4D\x65\x73\x73\x61\x67\x65\x73","\x6E\x61\x6D\x65","\x69\x73\x5F\x6E\x65\x77\x5F\x70\x61\x67\x65","\x77\x68\x65\x72\x65","\x6C\x61\x73\x74\x5F\x69\x64","\x73\x65\x6E\x64\x4D\x65\x73\x73\x61\x67\x65","\x63\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x6C\x6F\x67","\x6D\x65\x73\x73\x61\x67\x65","\x4D\x65\x73\x73\x61\x67\x65","\x63\x72\x65\x61\x74\x65","\x73\x69\x67\x6E\x6F\x75\x74\x43\x75\x73\x74\x6F\x6D\x65\x72","\x63\x6C\x6F\x73\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x73\x69\x67\x6E\x75\x70\x43\x75\x73\x74\x6F\x6D\x65\x72","\x67\x65\x74\x52\x65\x73\x75\x6C\x74","\x75\x73\x65\x72\x2D\x61\x67\x65\x6E\x74","\x68\x65\x61\x64\x65\x72\x73","\x73\x65\x74\x55\x41","\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65","\x70\x61\x72\x73\x65","\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E","\x72\x65\x6D\x6F\x74\x65\x41\x64\x64\x72\x65\x73\x73","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x72\x65\x66\x65\x72\x65\x72","\x77\x65\x62\x63\x68\x61\x74","\x62\x72\x6F\x77\x73\x65\x72","\x20","\x76\x65\x72\x73\x69\x6F\x6E","\x65\x6E\x67\x69\x6E\x65","\x6F\x73","\x6D\x6F\x64\x65\x6C","\x64\x65\x76\x69\x63\x65","\x76\x65\x6E\x64\x6F\x72","\x74\x79\x70\x65","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x62\x61\x73\x65\x36\x34","\x75\x6E\x73\x65\x72\x76\x65\x64\x43\x75\x73\x74\x6F\x6D\x65\x72","\x75\x6E\x73\x65\x72\x76\x65\x64","\x73\x75\x62\x6D\x69\x74\x45\x6E\x71\x75\x69\x72\x79","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x45\x6E\x71\x75\x69\x72\x79","\x77\x65\x62\x73\x69\x74\x65\x49\x64","\x65\x6E\x71\x75\x69\x72\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x67\x65\x74\x54\x72\x61\x6E\x73\x63\x72\x69\x70\x74","\x72\x65\x70\x6C\x61\x63\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x74\x65\x78\x74\x2F\x63\x73\x76","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x992f[0];var _=require(_0x992f[1]);var jsmin=require(_0x992f[2])[_0x992f[2]];var Mustache=require(_0x992f[3]);var querystring=require(_0x992f[4]);var path=require(_0x992f[5]);var md5=require(_0x992f[6]);var fs=require(_0x992f[7]);var UAParser=require(_0x992f[8]);var uaParser= new UAParser();var languageParser=require(_0x992f[9]);var ipaddr=require(_0x992f[10]);var geoip=require(_0x992f[11]);var csv=require(_0x992f[12]);var config=require(_0x992f[13]);var Xchatty=require(_0x992f[15])[_0x992f[14]];var xchatty_components=require(_0x992f[16]);var sequelize=require(_0x992f[15])[_0x992f[17]];var User=require(_0x992f[15])[_0x992f[18]];var Agent=require(_0x992f[15])[_0x992f[18]];var ChatRoom=require(_0x992f[15])[_0x992f[19]];var ChatEnquiry=require(_0x992f[15])[_0x992f[20]];var ChatVisitor=require(_0x992f[15])[_0x992f[21]];var ChatMessage=require(_0x992f[15])[_0x992f[22]];var ChatWebsite=require(_0x992f[15])[_0x992f[23]];var id=1;exports[_0x992f[24]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){Xchatty[_0x992f[29]]()[_0x992f[28]](function(_0x7026x1e){return _0x7026x1b[_0x992f[27]](200)[_0x992f[26]](_0x7026x1e)})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)})};exports[_0x992f[30]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){ChatWebsite[_0x992f[57]](_0x7026x1a[_0x992f[36]][_0x992f[35]])[_0x992f[28]](function(_0x7026x1f){_0x7026x1b[_0x992f[33]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x992f[31],"\x78\x2D\x74\x69\x6D\x65\x73\x74\x61\x6D\x70":Date[_0x992f[32]](),"\x78\x2D\x73\x65\x6E\x74":true});var _0x7026x20=xchatty_components[_0x992f[34]];var _0x7026x21={websiteId:_0x7026x1a[_0x992f[36]][_0x992f[35]],rootPath:_0x7026x1f[_0x992f[37]]+_0x992f[38],signedUp:_0x992f[39],windowFocused:_0x992f[39],isNewPage:_0x992f[40],processingSignUp:_0x992f[39],processingEnquiry:_0x992f[39],processingSend:_0x992f[39],visitorFullname:_0x992f[41],visitorAvatar:_0x992f[41],timerReadMessages:_0x992f[42],timerCheckStatus:_0x992f[42],isOnline:_0x992f[39],decayHistory:0,defaultTimeout:2000,isInitialStatusCheck:_0x992f[40],muteNotificationSoundOnce:_0x992f[39],assetBase:_0x7026x1f[_0x992f[37]]+_0x992f[43],hasSessionSaf:_0x992f[39],restoreOpenState:_0x992f[39],animateHover:_0x7026x1f[_0x992f[44]],hideEmail:_0x992f[39],hideOffline:_0x992f[39],headerShape:_0x7026x1f[_0x992f[45]],HeaderOnline:_0x7026x1f[_0x992f[46]],OnlineMessage:_0x7026x1f[_0x992f[47]],UsernamePlaceholder:_0x7026x1f[_0x992f[48]],EmailPlaceholder:_0x7026x1f[_0x992f[49]],StartChatButtonText:_0x7026x1f[_0x992f[50]],OfflineMessage:_0x7026x1f[_0x992f[51]],HeaderOffline:_0x7026x1f[_0x992f[52]],EnquiryMessagePlaceholder:_0x7026x1f[_0x992f[53]],EnquiryButtonText:_0x7026x1f[_0x992f[54]],downloadTranscript:_0x7026x1f[_0x992f[55]]};_0x7026x20=Mustache[_0x992f[56]](_0x7026x20,_0x7026x21);_0x7026x1b[_0x992f[26]](_0x7026x20);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})};exports[_0x992f[58]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){ChatWebsite[_0x992f[57]](_0x7026x1a[_0x992f[36]][_0x992f[35]])[_0x992f[28]](function(_0x7026x1f){_0x7026x1b[_0x992f[33]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x992f[59],"\x78\x2D\x74\x69\x6D\x65\x73\x74\x61\x6D\x70":Date[_0x992f[32]](),"\x78\x2D\x73\x65\x6E\x74":true});var _0x7026x22=xchatty_components[_0x992f[60]];var _0x7026x23={assetBase:_0x7026x1f[_0x992f[37]]+_0x992f[43],color:_0x7026x1f[_0x992f[61]],colorFocus:_0x7026x1f[_0x992f[62]],colorButton:_0x7026x1f[_0x992f[63]]};_0x7026x22=Mustache[_0x992f[56]](_0x7026x22,_0x7026x23);_0x7026x1b[_0x992f[26]](_0x7026x22);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})};exports[_0x992f[64]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){_0x7026x1b[_0x992f[73]](path[_0x992f[72]](config[_0x992f[65]],_0x992f[66],_0x992f[67],_0x992f[68],_0x992f[69],_0x7026x1a[_0x992f[71]][_0x992f[70]]))};exports[_0x992f[74]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){_0x7026x1b[_0x992f[33]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x992f[31],"\x78\x2D\x74\x69\x6D\x65\x73\x74\x61\x6D\x70":Date[_0x992f[32]](),"\x78\x2D\x73\x65\x6E\x74":true});var _0x7026x24=xchatty_components[_0x992f[75]];_0x7026x1b[_0x992f[26]](_0x7026x24);};exports[_0x992f[76]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){if(!_0x7026x1a[_0x992f[77]][_0x992f[68]]){_0x7026x1a[_0x992f[77]][_0x992f[68]]={}};Agent[_0x992f[29]]({where:{online:true,role:_0x992f[94]}})[_0x992f[28]](function(_0x7026x25){if(_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[78]]){_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[78]]=_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[78]]===_0x992f[40]?true:false};var _0x7026x26={success:true,has_session_saf:null,signed_up:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]?true:false,fullname:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[81]]?_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[81]]:_0x992f[82],email:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[83]]?_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[83]]:_0x992f[82],avatar:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[84]]?_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[84]]:_0x992f[82],open_state:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[78]]||_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]?true:false,online:_0x7026x25[_0x992f[85]]?true:false};if(_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[86]]){ChatRoom[_0x992f[93]]({where:{ChatVisitorId:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[86]],status:_0x992f[92]}})[_0x992f[28]](function(_0x7026x27){if(_0x7026x27){_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]=_0x7026x27[_0x992f[35]];_0x7026x26[_0x992f[87]]=true;}else {_0x7026x26[_0x992f[87]]=false};_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x26)+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})}else {_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x26)+_0x992f[91])};})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)});};exports[_0x992f[95]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){var _0x7026x28={where:{ChatRoomId:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]},include:[{model:User,attributes:[_0x992f[35],_0x992f[96],_0x992f[81],_0x992f[83]]},{model:ChatVisitor,attributes:[_0x992f[35],_0x992f[81],_0x992f[83]]}]};if(_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[97]]===_0x992f[39]){_0x7026x28[_0x992f[98]][_0x992f[35]]={$gt:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[99]]}};ChatMessage[_0x992f[29]](_0x7026x28)[_0x992f[28]](function(_0x7026x29){var _0x7026x2a={success:true,messages:_0x7026x29,composing:false,composing_fullname:null};_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x2a)+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)});};exports[_0x992f[100]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){var _0x7026x28={where:{ChatRoomId:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]},include:[{model:User,attributes:[_0x992f[35],_0x992f[96],_0x992f[81],_0x992f[83]]},{model:ChatVisitor,attributes:[_0x992f[35],_0x992f[81],_0x992f[83]]}]};if(_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[97]]===_0x992f[39]){_0x7026x28[_0x992f[98]][_0x992f[35]]={$gt:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[99]]}};ChatMessage[_0x992f[105]]({body:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[104]][_0x992f[103]],ChatRoomId:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]],ChatVisitorId:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[86]]})[_0x992f[28]](function(_0x7026x2b){console[_0x992f[102]](_0x992f[101],_0x7026x2b);ChatMessage[_0x992f[29]](_0x7026x28)[_0x992f[28]](function(_0x7026x29){var _0x7026x2a={errors:[],success:true,data:_0x7026x2b,messages:_0x7026x29};_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x2a)+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)});})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)});};exports[_0x992f[106]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){ChatRoom[_0x992f[57]](_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]])[_0x992f[28]](function(_0x7026x27){_0x7026x27[_0x992f[108]]({status:_0x992f[107]})[_0x992f[28]](function(_0x7026x27){var _0x7026x2a={success:true,errors:[]};_0x7026x1a[_0x992f[77]][_0x992f[68]]={};_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x2a)+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})};exports[_0x992f[109]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){var _0x7026x2c=uaParser[_0x992f[113]](_0x7026x1a[_0x992f[112]][_0x992f[111]])[_0x992f[110]]();var _0x7026x2d=languageParser[_0x992f[115]](_0x7026x1a[_0x992f[112]][_0x992f[114]]);var _0x7026x2e={fullname:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[116]][_0x992f[81]],email:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[116]][_0x992f[83]],remote_address:_0x7026x1a[_0x992f[118]][_0x992f[117]],user_agent:_0x7026x1a[_0x992f[112]][_0x992f[111]],visitor_language:_0x7026x1a[_0x992f[112]][_0x992f[114]],referer:_0x7026x1a[_0x992f[112]][_0x992f[119]],origin:_0x992f[120],browser:_0x7026x2c[_0x992f[121]][_0x992f[96]]+_0x992f[122]+_0x7026x2c[_0x992f[121]][_0x992f[123]],engine:_0x7026x2c[_0x992f[124]][_0x992f[96]]+_0x992f[122]+_0x7026x2c[_0x992f[124]][_0x992f[123]],os:_0x7026x2c[_0x992f[125]][_0x992f[96]]+_0x992f[122]+_0x7026x2c[_0x992f[125]][_0x992f[123]],device:_0x7026x2c[_0x992f[127]][_0x992f[126]]?_0x7026x2c[_0x992f[127]][_0x992f[126]]+_0x992f[122]+_0x7026x2c[_0x992f[127]][_0x992f[128]]+_0x992f[122]+_0x7026x2c[_0x992f[127]][_0x992f[129]]:null,ChatWebsiteId:_0x7026x1a[_0x992f[71]][_0x992f[130]]};return ChatVisitor[_0x992f[105]](_0x7026x2e)[_0x992f[28]](function(_0x7026x2f){_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[81]]=_0x7026x2f[_0x992f[81]];_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[83]]=_0x7026x2f[_0x992f[83]];_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[84]]=md5(_0x7026x2f[_0x992f[83]]).toString(_0x992f[131]);_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[86]]=_0x7026x2f[_0x992f[35]];var _0x7026x2a={success:true,errors:[],chatVisitor:{id:_0x7026x2f[_0x992f[35]]}};_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x2a)+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)});};exports[_0x992f[132]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){ChatVisitor[_0x992f[57]](_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[86]])[_0x992f[28]](function(_0x7026x2f){_0x7026x2f[_0x992f[108]]({status:_0x992f[133]})[_0x992f[28]](function(){var _0x7026x2a={success:true,errors:[]};_0x7026x1a[_0x992f[77]][_0x992f[68]]={};_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]](_0x7026x2a)+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})};exports[_0x992f[134]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){var _0x7026x30;var _0x7026x31;return sequelize[_0x992f[140]]()[_0x992f[28]](function(_0x7026x32){return ChatVisitor[_0x992f[105]]({fullname:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[137]][_0x992f[81]],email:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[137]][_0x992f[83]],remote_address:_0x7026x1a[_0x992f[118]][_0x992f[117]],user_agent:_0x7026x1a[_0x992f[112]][_0x992f[111]],visitor_language:_0x7026x1a[_0x992f[112]][_0x992f[114]],referer:_0x7026x1a[_0x992f[112]][_0x992f[119]],origin:_0x992f[139],status:_0x992f[133]},{transaction:_0x7026x32})[_0x992f[28]](function(_0x7026x2f){_0x7026x30=_0x7026x2f;return ChatEnquiry[_0x992f[105]]({username:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[137]][_0x992f[81]],email:_0x7026x2f[_0x992f[83]],text:_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[137]][_0x992f[103]],ChatWebsiteId:parseInt(_0x7026x1a[_0x992f[71]][_0x992f[79]][_0x992f[137]][_0x992f[138]],10),ChatVisitorId:_0x7026x30[_0x992f[35]]},{include:[{all:true,include:[{all:true}]}],transaction:_0x7026x32});})[_0x992f[28]](function(){_0x7026x32[_0x992f[136]]();_0x7026x1b[_0x992f[26]](_0x7026x1a[_0x992f[71]][_0x992f[88]]+_0x992f[89]+JSON[_0x992f[90]]({success:true,errors:[]})+_0x992f[91]);})[_0x992f[25]](function(_0x7026x1d){_0x7026x32[_0x992f[135]]();_0x7026x1c(_0x7026x1d);})});};exports[_0x992f[141]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){if(_0x7026x1a[_0x992f[77]][_0x992f[68]]&&_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[86]]&&_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]){ChatMessage[_0x992f[29]]({where:{ChatRoomId:_0x7026x1a[_0x992f[77]][_0x992f[68]][_0x992f[80]]}})[_0x992f[28]](function(_0x7026x29){var _0x7026x33=[];_0x7026x29[_0x992f[146]](function(_0x7026x2b){var _0x7026x34={name:_0x7026x2b[_0x992f[81]],text:_0x7026x2b[_0x992f[143]][_0x992f[142]](/(\r\n|\n|\r)/gm,_0x992f[122]),date:_0x7026x2b[_0x992f[144]]};_0x7026x33[_0x992f[145]](_0x7026x34);});var _0x7026x35=csv(_0x7026x33);_0x7026x1b[_0x992f[129]](_0x992f[147])[_0x992f[27]](200)[_0x992f[26]](_0x7026x35);})[_0x992f[25]](function(_0x7026x1d){_0x7026x1c(_0x7026x1d)})}};exports[_0x992f[148]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){Xchatty[_0x992f[57]](_0x7026x1a[_0x992f[36]][_0x992f[35]])[_0x992f[28]](function(_0x7026x36){if(!_0x7026x36){return _0x7026x1b[_0x992f[149]](404)};return _0x7026x1b[_0x992f[26]](_0x7026x36);})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)})};exports[_0x992f[105]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){Xchatty[_0x992f[105]](_0x7026x1a[_0x992f[143]])[_0x992f[28]](function(_0x7026x36){return _0x7026x1b[_0x992f[27]](201)[_0x992f[26]](_0x7026x36)})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)})};exports[_0x992f[150]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){if(_0x7026x1a[_0x992f[143]][_0x992f[35]]){delete _0x7026x1a[_0x992f[143]][_0x992f[35]]};Xchatty[_0x992f[57]](_0x7026x1a[_0x992f[36]][_0x992f[35]])[_0x992f[28]](function(_0x7026x36){if(!_0x7026x36){return _0x7026x1b[_0x992f[149]](404)};var _0x7026x37=_[_0x992f[151]](_0x7026x36,_0x7026x1a[_0x992f[143]]);_0x7026x37[_0x992f[152]]()[_0x992f[28]](function(){return _0x7026x1b[_0x992f[27]](200)[_0x992f[26]](_0x7026x36)})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)});})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)});};exports[_0x992f[153]]=function(_0x7026x1a,_0x7026x1b,_0x7026x1c){Xchatty[_0x992f[57]](_0x7026x1a[_0x992f[36]][_0x992f[35]])[_0x992f[28]](function(_0x7026x36){if(!_0x7026x36){return _0x7026x1b[_0x992f[149]](404)};_0x7026x36[_0x992f[153]]()[_0x992f[28]](function(){return _0x7026x1b[_0x992f[149]](204)})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)});})[_0x992f[25]](function(_0x7026x1d){return _0x7026x1c(_0x7026x1d)})};