e3dd1971ab9544590d1d278a86543083f0f552e1
[motion.git] / server / config / agi / lib / square.js
1 var _0x346f=["\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","\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","\x5B\x41\x47\x49\x5D\x20\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","\x6C\x6F\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","\x5B\x41\x47\x49\x5D\x20\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","\x5B\x41\x47\x49\x5D\x20\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","\x63\x6C\x65\x61\x72","\x63\x6F\x64\x65","\x72\x65\x73\x75\x6C\x74","\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","\x69\x64","\x74\x61\x72\x67\x65\x74","\x5B\x41\x47\x49\x5D\x20\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","\x5B\x41\x47\x49\x5D\x20\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","\x76\x61\x6C\x75\x65","\x73\x6F\x75\x72\x63\x65","\x2C","\x73\x70\x6C\x69\x74","\x65\x78\x74\x72\x61","\x69","\x76\x73\x77\x69\x74\x63\x68","\x66\x69\x6E\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"];_0x346f[0];var fs=require(_0x346f[1]);var parser=require(_0x346f[2]);var _=require(_0x346f[3]);var util=require(_0x346f[4]);var redis=require(_0x346f[5]);var config=require(_0x346f[6]);var AGIServer=require(_0x346f[7]);var AGIVertices=require(_0x346f[8]);var verticesWithRetry=[_0x346f[9],_0x346f[10],_0x346f[11]];var AGISquare=function(_0x1d02xb,_0x1d02xc,_0x1d02xd){this[_0x346f[12]]= _0x1d02xd;this[_0x346f[13]]=  new AGIServer(this[_0x346f[15]][_0x346f[14]](this),_0x1d02xb,_0x1d02xc);var _0x1d02xe;if(config[_0x346f[16]]){_0x1d02xe= {password:config[_0x346f[16]]}};var _0x1d02xf=redis[_0x346f[18]](6379,config[_0x346f[17]],_0x1d02xe);this[_0x346f[19]]= require(_0x346f[20])(_0x1d02xf)};AGISquare[_0x346f[22]][_0x346f[21]]= function(_0x1d02x10){var _0x1d02x11=this;this[_0x346f[12]][_0x346f[21]](this[_0x346f[28]][_0x346f[27]])[_0x346f[26]](function(_0x1d02x13){_0x1d02x11[_0x346f[19]][_0x346f[25]](_0x346f[24],_0x1d02x13);_0x1d02x10(null,_0x1d02x13)})[_0x346f[23]](function(_0x1d02x12){_0x1d02x10(_0x1d02x12)})};AGISquare[_0x346f[22]][_0x346f[29]]= function(_0x1d02x10){var _0x1d02x11=this;this[_0x346f[12]][_0x346f[29]](this[_0x346f[28]][_0x346f[27]][_0x346f[31]],this[_0x346f[28]][_0x346f[27]][_0x346f[32]])[_0x346f[26]](function(_0x1d02x13){if(_0x1d02x13[_0x346f[30]]> 1){for(var _0x1d02x14=0;_0x1d02x14< _0x1d02x13[1][_0x346f[30]];_0x1d02x14++){var _0x1d02x15=_0x1d02x13[1][_0x1d02x14];_0x1d02x11[_0x346f[19]][_0x346f[25]](_0x346f[24],_0x1d02x15)}};_0x1d02x10(null,_0x1d02x13)})[_0x346f[23]](function(_0x1d02x12){_0x1d02x10(_0x1d02x12)})};AGISquare[_0x346f[22]][_0x346f[15]]= function(_0x1d02x16){console[_0x346f[38]](util[_0x346f[37]](_0x346f[33],_0x1d02x16[_0x346f[27]][_0x346f[32]],_0x1d02x16[_0x346f[27]][_0x346f[34]],_0x1d02x16[_0x346f[27]][_0x346f[35]],_0x1d02x16[_0x346f[27]][_0x346f[36]],_0x1d02x16[_0x346f[27]][_0x346f[31]]));var _0x1d02x11=_[_0x346f[39]](this);_0x1d02x11[_0x346f[28]]= _0x1d02x16;_0x1d02x11[_0x346f[40]]= _0x1d02x11[_0x346f[42]][_0x346f[41]](_0x1d02x11,_0x1d02x11[_0x346f[28]][_0x346f[27]][_0x346f[32]]);if(_0x1d02x11[_0x346f[40]]){if(_0x1d02x11[_0x346f[40]][_0x346f[43]]){_0x1d02x11[_0x346f[44]]= _0x1d02x11[_0x346f[45]](_0x1d02x11[_0x346f[40]][_0x346f[43]]);_0x1d02x11[_0x346f[46]]=  new AGIVertices(_0x1d02x11[_0x346f[28]],_0x1d02x11[_0x346f[12]]);if(_0x1d02x11[_0x346f[44]]&& _0x1d02x11[_0x346f[44]][_0x346f[15]]){_0x1d02x11[_0x346f[21]][_0x346f[41]](_0x1d02x11);_0x1d02x11[_0x346f[44]][_0x346f[15]][_0x346f[47]]= _0x346f[15];_0x1d02x11[_0x346f[48]](_0x1d02x11[_0x346f[44]][_0x346f[15]],false);_0x1d02x11[_0x346f[29]][_0x346f[41]](_0x1d02x11);if(_0x1d02x11[_0x346f[44]][_0x346f[49]]){_0x1d02x11[_0x346f[44]][_0x346f[49]][_0x346f[47]]= _0x346f[49];_0x1d02x11[_0x346f[48]](_0x1d02x11[_0x346f[44]][_0x346f[49]],true)};_0x1d02x11[_0x346f[28]][_0x346f[25]](_0x346f[50]);if(_0x1d02x11){_0x1d02x11= undefined}}}else {console[_0x346f[52]](util[_0x346f[37]](_0x346f[51],_0x1d02x16[_0x346f[27]][_0x346f[32]]));_0x1d02x11[_0x346f[28]][_0x346f[25]](_0x346f[50])}}else {console[_0x346f[52]](util[_0x346f[37]](_0x346f[53],_0x1d02x16[_0x346f[27]][_0x346f[32]]));_0x1d02x11[_0x346f[28]][_0x346f[25]](_0x346f[50])}};AGISquare[_0x346f[22]][_0x346f[48]]= function(_0x1d02x17,_0x1d02x18){this[_0x346f[54]]= _0x1d02x17;while(this[_0x346f[54]]){this[_0x346f[54]]= this[_0x346f[46]][_0x346f[55]](this[_0x346f[54]]);var _0x1d02x13=this[_0x346f[46]][this[_0x346f[54]][_0x346f[47]]](this[_0x346f[54]]);if(!_0x1d02x18){if(_0x1d02x13[_0x346f[56]]=== 200&& _0x1d02x13[_0x346f[57]]!== _0x346f[58]){this[_0x346f[54]]= this[_0x346f[59]](_0x1d02x13)}else {this[_0x346f[54]]= null}}else {this[_0x346f[54]]= this[_0x346f[59]](_0x1d02x13)}}};AGISquare[_0x346f[22]][_0x346f[59]]= function(_0x1d02x19){var _0x1d02x1a=this[_0x346f[60]](_0x1d02x19);if(_0x1d02x1a){for(var _0x1d02x1b in this[_0x346f[44]]){if(this[_0x346f[44]][_0x346f[61]](_0x1d02x1b)){if(_0x1d02x1b!== _0x346f[62]){if(_[_0x346f[63]](this[_0x346f[44]][_0x1d02x1b])){for(var _0x1d02x1c in this[_0x346f[44]][_0x1d02x1b]){if(this[_0x346f[44]][_0x1d02x1b][_0x346f[61]](_0x1d02x1c)){if(this[_0x346f[44]][_0x1d02x1b][_0x1d02x1c][_0x346f[64]]=== _0x1d02x1a[_0x346f[65]]){this[_0x346f[44]][_0x1d02x1b][_0x1d02x1c][_0x346f[47]]= _0x1d02x1b;return this[_0x346f[44]][_0x1d02x1b][_0x1d02x1c]}}}}else {if(this[_0x346f[44]][_0x1d02x1b][_0x346f[64]]=== _0x1d02x1a[_0x346f[65]]){this[_0x346f[44]][_0x1d02x1b][_0x346f[47]]= _0x1d02x1b;return this[_0x346f[44]][_0x1d02x1b]}}}}}}else {console[_0x346f[38]](_0x346f[66],this[_0x346f[54]][_0x346f[47]],this[_0x346f[54]][_0x346f[64]],this[_0x346f[54]][_0x346f[67]],_0x1d02x19[_0x346f[57]]);if(_[_0x346f[68]](verticesWithRetry,this[_0x346f[54]][_0x346f[47]])){if(_0x1d02x19[_0x346f[57]]!== _0x346f[69]){console[_0x346f[38]](_0x346f[70],this[_0x346f[54]][_0x346f[47]],this[_0x346f[54]][_0x346f[64]],this[_0x346f[54]][_0x346f[67]],_0x1d02x19[_0x346f[57]]=== _0x346f[71]?_0x346f[72]:_0x346f[73],_0x1d02x19[_0x346f[57]]);return this[_0x346f[54]]}}};return null};AGISquare[_0x346f[22]][_0x346f[60]]= function(_0x1d02x19){var _0x1d02x11=this;var _0x1d02x1d=_[_0x346f[81]](this[_0x346f[44]][_0x346f[62]],function(_0x1d02x1a){if(_0x1d02x1a[_0x346f[61]](_0x346f[74])){if(_0x1d02x1a[_0x346f[75]]=== _0x1d02x11[_0x346f[54]][_0x346f[64]]){var _0x1d02x1e=_0x1d02x1a[_0x346f[74]][_0x346f[77]](_0x346f[76]);for(var _0x1d02x14=0;_0x1d02x14< _0x1d02x1e[_0x346f[30]];_0x1d02x14+= 1){if(_0x1d02x1e[_0x1d02x14]=== _0x1d02x19[_0x346f[57]]|| _0x1d02x1e[_0x1d02x14]=== _0x1d02x19[_0x346f[78]]){return true}};if(_0x1d02x19[_0x346f[57]]!== _0x346f[69]&& _0x1d02x19[_0x346f[57]]!== _0x346f[71]){for(var _0x1d02x1f=0;_0x1d02x1f< _0x1d02x1e[_0x346f[30]];_0x1d02x1f+= 1){if(_0x1d02x1e[_0x1d02x1f]=== _0x346f[79]){return true};if(_0x1d02x1e[_0x1d02x1f]=== _0x346f[69]&& _0x1d02x11[_0x346f[54]][_0x346f[47]]=== _0x346f[80]){return true}}}};return false};return _0x1d02x1a[_0x346f[75]]=== _0x1d02x11[_0x346f[54]][_0x346f[64]]});return _0x1d02x1d};AGISquare[_0x346f[22]][_0x346f[42]]= function(_0x1d02x20,_0x1d02x10){this[_0x346f[12]][_0x346f[42]](_0x1d02x20)[_0x346f[26]](function(_0x1d02x13){_0x1d02x10(null,_0x1d02x13)})[_0x346f[23]](function(_0x1d02x12){_0x1d02x10(_0x1d02x12)})};AGISquare[_0x346f[22]][_0x346f[45]]= function(_0x1d02x21){return parser[_0x346f[83]](_0x1d02x21,{object:true})[_0x346f[82]][_0x346f[44]]};module[_0x346f[84]]= AGISquare