51f2bd79cdec9a1d15561b7cdabe222322a013ca
[motion.git] / server / config / agi / lib / square.js
1 var _0x1a25=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x78\x6D\x6C\x32\x6A\x73\x6F\x6E","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x72\x65\x64\x69\x73","\x61\x67\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x73\x65\x72\x76\x65\x72","\x2E\x2F\x76\x65\x72\x74\x69\x63\x65\x73","\x6D\x65\x6E\x75","\x67\x65\x74\x64\x69\x67\x69\x74\x73","\x67\x65\x74\x73\x65\x63\x72\x65\x74\x64\x69\x67\x69\x74\x73","\x72\x70\x63","\x73\x65\x72\x76\x65\x72","\x62\x69\x6E\x64","\x73\x74\x61\x72\x74","\x72\x65\x64\x69\x73\x50\x77\x64","\x69\x70","\x63\x72\x65\x61\x74\x65\x43\x6C\x69\x65\x6E\x74","\x69\x6F","\x73\x6F\x63\x6B\x65\x74\x2E\x69\x6F\x2D\x65\x6D\x69\x74\x74\x65\x72","\x63\x72\x65\x61\x74\x65\x53\x71\x75\x61\x72\x65\x52\x65\x70\x6F\x72\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x61\x74\x63\x68","\x72\x65\x70\x6F\x72\x74\x5F\x73\x71\x75\x61\x72\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x74\x68\x65\x6E","\x72\x65\x71\x75\x65\x73\x74","\x63\x68\x61\x6E\x6E\x65\x6C","\x75\x70\x64\x61\x74\x65\x53\x71\x75\x61\x72\x65\x52\x65\x70\x6F\x72\x74","\x6C\x65\x6E\x67\x74\x68","\x75\x6E\x69\x71\x75\x65\x69\x64","\x61\x72\x67\x5F\x31","\x53\x74\x61\x72\x74\x20\x25\x73\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20\x66\x72\x6F\x6D\x20\x22\x25\x73\x22\x20\x3C\x25\x73\x3E\x20\x74\x6F\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x20\x25\x73\x20\x77\x69\x74\x68\x20\x75\x6E\x69\x71\x75\x65\x69\x64\x20\x25\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x64\x6E\x69\x64","\x66\x6F\x72\x6D\x61\x74","\x69\x6E\x66\x6F","\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x64\x65\x62\x75\x67","\x63\x6C\x6F\x6E\x65","\x70\x72\x6F\x6A\x65\x63\x74","\x73\x79\x6E\x63","\x67\x65\x74\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E","\x72\x6F\x6F\x74","\x67\x65\x74\x52\x6F\x6F\x74","\x76\x65\x72\x74\x69\x63\x65\x73","\x76\x65\x72\x74\x65\x78\x4E\x61\x6D\x65","\x72\x75\x6E","\x66\x69\x6E\x61\x6C\x6C\x79","\x64\x6F\x6E\x65","\x50\x72\x6F\x6A\x65\x63\x74\x20\x25\x73\x20\x6E\x6F\x74\x20\x70\x75\x62\x6C\x69\x73\x68\x65\x64","\x65\x72\x72\x6F\x72","\x50\x72\x6F\x6A\x65\x63\x74\x20\x25\x73\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x63\x75\x72\x72\x65\x6E\x74\x56\x65\x72\x74\x65\x78","\x61\x67\x69\x4E\x65\x77\x45\x78\x74\x65\x6E","\x71\x75\x65\x75\x65","\x71\x75\x65\x75\x65\x5F\x69\x64","\x73\x65\x6E\x64","\x63\x6C\x65\x61\x72","\x76\x65\x72\x74\x65\x78","\x72\x65\x73\x75\x6C\x74","\x69\x64","\x63\x6F\x64\x65","\x2D\x31","\x67\x65\x74\x4E\x65\x78\x74\x56\x65\x72\x74\x65\x78","\x66\x69\x6E\x64\x45\x64\x67\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x6D\x78\x43\x65\x6C\x6C","\x69\x73\x41\x72\x72\x61\x79","\x74\x61\x72\x67\x65\x74","\x45\x64\x67\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x66\x6F\x72\x20\x76\x65\x72\x74\x65\x78\x20\x25\x73\x20\x28\x25\x73\x20\x2D\x20\x25\x73\x29\x20\x66\x6F\x72\x20\x72\x65\x73\x75\x6C\x74\x20\x22\x25\x73\x22","\x6C\x61\x62\x65\x6C","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x2D","\x52\x65\x74\x72\x79\x20\x76\x65\x72\x74\x65\x78\x20\x25\x73\x20\x28\x25\x73\x20\x2D\x20\x25\x73\x29\x20\x66\x6F\x72\x20\x25\x73\x20\x72\x65\x61\x73\x6F\x6E\x20\x22\x25\x73\x22","\x74","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x76\x61\x6C\x69\x64","\x66\x69\x6C\x74\x65\x72","\x76\x61\x6C\x75\x65","\x2C","\x73\x70\x6C\x69\x74","\x65\x78\x74\x72\x61","\x66\x69\x6E\x64","\x69","\x76\x73\x77\x69\x74\x63\x68","\x68\x65\x61\x64","\x6D\x78\x47\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C","\x74\x6F\x4A\x73\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];_0x1a25[0];var fs=require(_0x1a25[1]);var parser=require(_0x1a25[2]);var _=require(_0x1a25[3]);var util=require(_0x1a25[4]);var redis=require(_0x1a25[5]);var logger=require(_0x1a25[7])(_0x1a25[6]);var config=require(_0x1a25[8]);var AGIServer=require(_0x1a25[9]);var AGIVertices=require(_0x1a25[10]);var verticesWithRetry=[_0x1a25[11],_0x1a25[12],_0x1a25[13]];var AGISquare=function(_0xdcc4xc,_0xdcc4xd,_0xdcc4xe){this[_0x1a25[14]]= _0xdcc4xe;this[_0x1a25[15]]=  new AGIServer(this[_0x1a25[17]][_0x1a25[16]](this),_0xdcc4xc,_0xdcc4xd);var _0xdcc4xf;if(config[_0x1a25[18]]){_0xdcc4xf= {password:config[_0x1a25[18]]}};var _0xdcc4x10=redis[_0x1a25[20]](6379,config[_0x1a25[19]],_0xdcc4xf);this[_0x1a25[21]]= require(_0x1a25[22])(_0xdcc4x10)};AGISquare[_0x1a25[24]][_0x1a25[23]]= function(_0xdcc4x11){var _0xdcc4x12=this;this[_0x1a25[14]][_0x1a25[23]](this[_0x1a25[30]][_0x1a25[29]])[_0x1a25[28]](function(_0xdcc4x14){_0xdcc4x12[_0x1a25[21]][_0x1a25[27]](_0x1a25[26],_0xdcc4x14);_0xdcc4x11(null,_0xdcc4x14)})[_0x1a25[25]](function(_0xdcc4x13){_0xdcc4x11(_0xdcc4x13)})};AGISquare[_0x1a25[24]][_0x1a25[31]]= function(_0xdcc4x11){var _0xdcc4x12=this;this[_0x1a25[14]][_0x1a25[31]](this[_0x1a25[30]][_0x1a25[29]][_0x1a25[33]],this[_0x1a25[30]][_0x1a25[29]][_0x1a25[34]])[_0x1a25[28]](function(_0xdcc4x14){if(_0xdcc4x14[_0x1a25[32]]> 1){for(var _0xdcc4x15=0;_0xdcc4x15< _0xdcc4x14[1][_0x1a25[32]];_0xdcc4x15++){var _0xdcc4x16=_0xdcc4x14[1][_0xdcc4x15];_0xdcc4x12[_0x1a25[21]][_0x1a25[27]](_0x1a25[26],_0xdcc4x16)}};_0xdcc4x11(null,_0xdcc4x14)})[_0x1a25[25]](function(_0xdcc4x13){_0xdcc4x11(_0xdcc4x13)})};AGISquare[_0x1a25[24]][_0x1a25[17]]= function(_0xdcc4x17){logger[_0x1a25[40]](util[_0x1a25[39]](_0x1a25[35],_0xdcc4x17[_0x1a25[29]][_0x1a25[34]],_0xdcc4x17[_0x1a25[29]][_0x1a25[36]],_0xdcc4x17[_0x1a25[29]][_0x1a25[37]],_0xdcc4x17[_0x1a25[29]][_0x1a25[38]],_0xdcc4x17[_0x1a25[29]][_0x1a25[33]]));logger[_0x1a25[43]](_0x1a25[41],JSON[_0x1a25[42]](_0xdcc4x17[_0x1a25[29]],null,2));var _0xdcc4x12=_[_0x1a25[44]](this);_0xdcc4x12[_0x1a25[30]]= _0xdcc4x17;_0xdcc4x12[_0x1a25[45]]= _0xdcc4x12[_0x1a25[47]][_0x1a25[46]](_0xdcc4x12,_0xdcc4x12[_0x1a25[30]][_0x1a25[29]][_0x1a25[34]]);if(_0xdcc4x12[_0x1a25[45]]){if(_0xdcc4x12[_0x1a25[45]][_0x1a25[48]]){_0xdcc4x12[_0x1a25[49]]= _0xdcc4x12[_0x1a25[50]](_0xdcc4x12[_0x1a25[45]][_0x1a25[48]]);_0xdcc4x12[_0x1a25[51]]=  new AGIVertices(_0xdcc4x12[_0x1a25[30]],_0xdcc4x12[_0x1a25[14]]);if(_0xdcc4x12[_0x1a25[49]]&& _0xdcc4x12[_0x1a25[49]][_0x1a25[17]]){logger[_0x1a25[43]](_0x1a25[49],JSON[_0x1a25[42]](_0xdcc4x12[_0x1a25[49]],null,2));_0xdcc4x12[_0x1a25[23]][_0x1a25[46]](_0xdcc4x12);_0xdcc4x12[_0x1a25[49]][_0x1a25[17]][_0x1a25[52]]= _0x1a25[17];_0xdcc4x12[_0x1a25[53]](_0xdcc4x12[_0x1a25[49]][_0x1a25[17]],false);_0xdcc4x12[_0x1a25[31]][_0x1a25[46]](_0xdcc4x12);if(_0xdcc4x12[_0x1a25[49]][_0x1a25[54]]){_0xdcc4x12[_0x1a25[49]][_0x1a25[54]][_0x1a25[52]]= _0x1a25[54];_0xdcc4x12[_0x1a25[53]](_0xdcc4x12[_0x1a25[49]][_0x1a25[54]],true)};_0xdcc4x12[_0x1a25[30]][_0x1a25[27]](_0x1a25[55]);if(_0xdcc4x12){_0xdcc4x12= undefined}}}else {logger[_0x1a25[57]](util[_0x1a25[39]](_0x1a25[56],_0xdcc4x17[_0x1a25[29]][_0x1a25[34]]));_0xdcc4x12[_0x1a25[30]][_0x1a25[27]](_0x1a25[55])}}else {logger[_0x1a25[57]](util[_0x1a25[39]](_0x1a25[58],_0xdcc4x17[_0x1a25[29]][_0x1a25[34]]));_0xdcc4x12[_0x1a25[30]][_0x1a25[27]](_0x1a25[55])}};AGISquare[_0x1a25[24]][_0x1a25[53]]= function(_0xdcc4x18,_0xdcc4x19){this[_0x1a25[59]]= _0xdcc4x18;while(this[_0x1a25[59]]){process[_0x1a25[63]]({message:_0x1a25[60],doc:{application:this[_0x1a25[59]][_0x1a25[52]],uniqueid:this[_0x1a25[30]][_0x1a25[29]][_0x1a25[33]],queue:this[_0x1a25[59]][_0x1a25[52]]=== _0x1a25[61]?this[_0x1a25[59]][_0x1a25[62]]:undefined}});this[_0x1a25[59]]= this[_0x1a25[51]][_0x1a25[64]](this[_0x1a25[59]]);logger[_0x1a25[43]](this[_0x1a25[30]][_0x1a25[29]][_0x1a25[33]],_0x1a25[65],JSON[_0x1a25[42]](this[_0x1a25[59]],null,2));var _0xdcc4x14=this[_0x1a25[51]][this[_0x1a25[59]][_0x1a25[52]]](this[_0x1a25[59]]);logger[_0x1a25[43]](this[_0x1a25[30]][_0x1a25[29]][_0x1a25[33]],_0x1a25[66],this[_0x1a25[59]][_0x1a25[52]],this[_0x1a25[59]][_0x1a25[67]],JSON[_0x1a25[42]](_0xdcc4x14,null,2));if(!_0xdcc4x19){if(_0xdcc4x14[_0x1a25[68]]=== 200&& _0xdcc4x14[_0x1a25[66]]!== _0x1a25[69]){this[_0x1a25[59]]= this[_0x1a25[70]](_0xdcc4x14)}else {this[_0x1a25[59]]= null}}else {this[_0x1a25[59]]= this[_0x1a25[70]](_0xdcc4x14)}}};AGISquare[_0x1a25[24]][_0x1a25[70]]= function(_0xdcc4x1a){var _0xdcc4x1b=this[_0x1a25[71]](_0xdcc4x1a);if(_0xdcc4x1b){for(var _0xdcc4x1c in this[_0x1a25[49]]){if(this[_0x1a25[49]][_0x1a25[72]](_0xdcc4x1c)){if(_0xdcc4x1c!== _0x1a25[73]){if(_[_0x1a25[74]](this[_0x1a25[49]][_0xdcc4x1c])){for(var _0xdcc4x1d in this[_0x1a25[49]][_0xdcc4x1c]){if(this[_0x1a25[49]][_0xdcc4x1c][_0x1a25[72]](_0xdcc4x1d)){if(this[_0x1a25[49]][_0xdcc4x1c][_0xdcc4x1d][_0x1a25[67]]=== _0xdcc4x1b[_0x1a25[75]]){this[_0x1a25[49]][_0xdcc4x1c][_0xdcc4x1d][_0x1a25[52]]= _0xdcc4x1c;return this[_0x1a25[49]][_0xdcc4x1c][_0xdcc4x1d]}}}}else {if(this[_0x1a25[49]][_0xdcc4x1c][_0x1a25[67]]=== _0xdcc4x1b[_0x1a25[75]]){this[_0x1a25[49]][_0xdcc4x1c][_0x1a25[52]]= _0xdcc4x1c;return this[_0x1a25[49]][_0xdcc4x1c]}}}}}}else {logger[_0x1a25[40]](_0x1a25[76],this[_0x1a25[59]][_0x1a25[52]],this[_0x1a25[59]][_0x1a25[67]],this[_0x1a25[59]][_0x1a25[77]],_0xdcc4x1a[_0x1a25[66]]);if(_[_0x1a25[78]](verticesWithRetry,this[_0x1a25[59]][_0x1a25[52]])){if(_0xdcc4x1a[_0x1a25[66]]!== _0x1a25[79]){logger[_0x1a25[40]](_0x1a25[80],this[_0x1a25[59]][_0x1a25[52]],this[_0x1a25[59]][_0x1a25[67]],this[_0x1a25[59]][_0x1a25[77]],_0xdcc4x1a[_0x1a25[66]]=== _0x1a25[81]?_0x1a25[82]:_0x1a25[83],_0xdcc4x1a[_0x1a25[66]]);return this[_0x1a25[59]]}}};return null};AGISquare[_0x1a25[24]][_0x1a25[71]]= function(_0xdcc4x1a){var _0xdcc4x12=this;var _0xdcc4x1e=false;var _0xdcc4x1f=_[_0x1a25[84]](this[_0x1a25[49]][_0x1a25[73]],{"\x73\x6F\x75\x72\x63\x65":_0xdcc4x12[_0x1a25[59]][_0x1a25[67]]});_0xdcc4x1e= _[_0x1a25[89]](_0xdcc4x1f,function(_0xdcc4x1b){if(_0xdcc4x1b[_0x1a25[72]](_0x1a25[85])){var _0xdcc4x20=_0xdcc4x1b[_0x1a25[85]][_0x1a25[87]](_0x1a25[86]);for(var _0xdcc4x15=0;_0xdcc4x15< _0xdcc4x20[_0x1a25[32]];_0xdcc4x15+= 1){if(_0xdcc4x20[_0xdcc4x15]=== _0xdcc4x1a[_0x1a25[66]]|| _0xdcc4x20[_0xdcc4x15]=== _0xdcc4x1a[_0x1a25[88]]){return true}}}});if(_0xdcc4x1e){return _0xdcc4x1e};if(_0xdcc4x1a[_0x1a25[66]]!== _0x1a25[79]&& _0xdcc4x1a[_0x1a25[66]]!== _0x1a25[81]){_0xdcc4x1e= _[_0x1a25[89]](_0xdcc4x1f,function(_0xdcc4x1b){if(_0xdcc4x1b[_0x1a25[72]](_0x1a25[85])){var _0xdcc4x20=_0xdcc4x1b[_0x1a25[85]][_0x1a25[87]](_0x1a25[86]);for(var _0xdcc4x21=0;_0xdcc4x21< _0xdcc4x20[_0x1a25[32]];_0xdcc4x21+= 1){if(_0xdcc4x20[_0xdcc4x21]=== _0x1a25[90]){return true};if(_0xdcc4x20[_0xdcc4x21]=== _0x1a25[79]&& _0xdcc4x12[_0x1a25[59]][_0x1a25[52]]=== _0x1a25[91]){return true}}}});if(_0xdcc4x1e){return _0xdcc4x1e}};if(!_[_0x1a25[78]](verticesWithRetry,_0xdcc4x12[_0x1a25[59]][_0x1a25[52]])&& _0xdcc4x12[_0x1a25[59]][_0x1a25[52]]!== _0x1a25[91]){_0xdcc4x1e= _[_0x1a25[92]](_0xdcc4x1f)};return _0xdcc4x1e};AGISquare[_0x1a25[24]][_0x1a25[47]]= function(_0xdcc4x22,_0xdcc4x11){this[_0x1a25[14]][_0x1a25[47]](_0xdcc4x22)[_0x1a25[28]](function(_0xdcc4x14){_0xdcc4x11(null,_0xdcc4x14)})[_0x1a25[25]](function(_0xdcc4x13){_0xdcc4x11(_0xdcc4x13)})};AGISquare[_0x1a25[24]][_0x1a25[50]]= function(_0xdcc4x23){return parser[_0x1a25[94]](_0xdcc4x23,{object:true})[_0x1a25[93]][_0x1a25[49]]};module[_0x1a25[95]]= AGISquare