Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / services / routing / lib / rule-engine.js
index 41a2ea9..4e25432 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69e2=['register','ignoreFactChanges','inherits','rules','activeRules','prototype','sync','asc','execute','clone','consequence','ruleRef','index_','push','call','nextTick','next','isEqual','restart','length','condition','noop','findRules','matches','prioritize','priority','toJSON','map','toString','fromJSON','isString','parse','exports','lodash','util','events','EventEmitter','init','isNil'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x69e2,0x6f));var _0x269e=function(_0x12bd8a,_0x2046f3){_0x12bd8a=_0x12bd8a-0x0;var _0x2795d5=_0x69e2[_0x12bd8a];return _0x2795d5;};'use strict';var _=require(_0x269e('0x0'));var util=require(_0x269e('0x1'));var EventEmitter=require(_0x269e('0x2'))[_0x269e('0x3')];function RuleEngine(_0x4c4249,_0x4acd0f){this[_0x269e('0x4')]();if(!_[_0x269e('0x5')](_0x4c4249)){this[_0x269e('0x6')](_0x4c4249);}if(_0x4acd0f){this[_0x269e('0x7')]=_0x4acd0f[_0x269e('0x7')];}return this;}util[_0x269e('0x8')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x5f1a28){this[_0x269e('0x9')]=[];this[_0x269e('0xa')]=[];};RuleEngine[_0x269e('0xb')][_0x269e('0x6')]=function(_0x2daea7){if(Array['isArray'](_0x2daea7)){this[_0x269e('0x9')]=this[_0x269e('0x9')]['concat'](_0x2daea7);}else if(_0x2daea7!==null&&_['isObject'](_0x2daea7)){this[_0x269e('0x9')]['push'](_0x2daea7);}this['sync']();};RuleEngine[_0x269e('0xb')][_0x269e('0xc')]=function(){this[_0x269e('0xa')]=this[_0x269e('0x9')]['filter'](function(_0x5cd10f){if(_[_0x269e('0x5')](_0x5cd10f['on'])){_0x5cd10f['on']=!![];}if(_0x5cd10f['on']===!![]){return _0x5cd10f;}});this['activeRules']=_['orderBy'](this[_0x269e('0xa')],['p'],[_0x269e('0xd')]);};RuleEngine[_0x269e('0xb')][_0x269e('0xe')]=function(_0x34903f,_0x3ec296){var _0x2b6f21=![];_0x34903f['result']=!![];var _0x4e76d5=_[_0x269e('0xf')](_0x34903f);var _0x27282e=_[_0x269e('0xf')](_0x34903f);var _0x128d44=this[_0x269e('0xa')];var _0x4b1d33=[];var _0x54bc4b=this[_0x269e('0x7')];(function FnRuleLoop(_0x58b8a0){var _0x1c0270={'rules':function(){return _0x128d44;},'rule':function(){return _0x128d44[_0x58b8a0];},'when':function(_0x5adf55){if(_0x5adf55){var _0x192d74=_0x128d44[_0x58b8a0][_0x269e('0x10')];_0x192d74[_0x269e('0x11')]=_0x128d44[_0x58b8a0]['id']||_0x128d44[_0x58b8a0]['name']||_0x269e('0x12')+_0x58b8a0;process['nextTick'](function(){_0x4b1d33[_0x269e('0x13')](_0x192d74[_0x269e('0x11')]);_0x192d74[_0x269e('0x14')](_0x4e76d5,_0x1c0270);});}else{process[_0x269e('0x15')](function(){_0x1c0270[_0x269e('0x16')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2b6f21=!![];return FnRuleLoop(0x0);},'next':function(_0x44c3ac){if(!_0x54bc4b&&!_[_0x269e('0x17')](_0x27282e,_0x4e76d5)){_0x27282e=_['clone'](_0x4e76d5);process['nextTick'](function(){_0x1c0270[_0x269e('0x18')]();});}else{process[_0x269e('0x15')](function(){if(_['isNil'](_0x44c3ac)){return FnRuleLoop(_0x58b8a0+0x1);}else{return FnRuleLoop(_0x44c3ac);}});}}};if(_0x58b8a0<_0x128d44[_0x269e('0x19')]&&_0x2b6f21===![]){var _0x3e9ab9=_0x128d44[_0x58b8a0][_0x269e('0x1a')];_0x3e9ab9[_0x269e('0x14')](_0x4e76d5,_0x1c0270);}else{process[_0x269e('0x15')](function(){_0x4e76d5['matchPath']=_0x4b1d33;return _0x3ec296?_0x3ec296(_0x4e76d5):_[_0x269e('0x1b')]();});}}(0x0));};RuleEngine['prototype'][_0x269e('0x1c')]=function(_0x4cbda7){if(_[_0x269e('0x5')](_0x4cbda7)){return this[_0x269e('0x9')];}else{var _0x17a190=_[_0x269e('0x1d')](_0x4cbda7);return _['filter'](this[_0x269e('0x9')],_0x17a190);}};RuleEngine[_0x269e('0xb')]['turn']=function(_0x49e322,_0x1bcba8){var _0x4febce=_0x49e322==='on'||_0x49e322==='ON'?!![]:![];var _0x5ab56b=this[_0x269e('0x1c')](_0x1bcba8);for(var _0x4fe7d0=0x0,_0x52f7c4=_0x5ab56b['length'];_0x4fe7d0<_0x52f7c4;_0x4fe7d0+=0x1){_0x5ab56b[_0x4fe7d0]['on']=_0x4febce;}this[_0x269e('0xc')]();};RuleEngine[_0x269e('0xb')][_0x269e('0x1e')]=function(_0x29694f,_0x56b1de){_0x29694f=parseInt(_0x29694f,0xa);var _0x69c9fc=this[_0x269e('0x1c')](_0x56b1de);for(var _0x331395=0x0,_0x3cf687=_0x69c9fc[_0x269e('0x19')];_0x331395<_0x3cf687;_0x331395+=0x1){_0x69c9fc[_0x331395][_0x269e('0x1f')]=_0x29694f;}this[_0x269e('0xc')]();};RuleEngine[_0x269e('0xb')][_0x269e('0x20')]=function(){var _0x5cb3f6=this[_0x269e('0x9')];if(_0x5cb3f6 instanceof Array){_0x5cb3f6=_0x5cb3f6[_0x269e('0x21')](function(_0x25f53e){_0x25f53e[_0x269e('0x1a')]=_0x25f53e[_0x269e('0x1a')][_0x269e('0x22')]();_0x25f53e[_0x269e('0x10')]=_0x25f53e['consequence']['toString']();return _0x25f53e;});}else if(!_[_0x269e('0x5')](_0x5cb3f6)){_0x5cb3f6['condition']=_0x5cb3f6[_0x269e('0x1a')]['toString']();_0x5cb3f6[_0x269e('0x10')]=_0x5cb3f6[_0x269e('0x10')][_0x269e('0x22')]();}return _0x5cb3f6;};RuleEngine[_0x269e('0xb')][_0x269e('0x23')]=function(_0x41d28c){this['init']();if(_[_0x269e('0x24')](_0x41d28c)){_0x41d28c=JSON[_0x269e('0x25')](_0x41d28c);}if(_0x41d28c instanceof Array){_0x41d28c=_0x41d28c['map'](function(_0x58b52a){_0x58b52a[_0x269e('0x1a')]=eval('('+_0x58b52a[_0x269e('0x1a')]+')');_0x58b52a[_0x269e('0x10')]=eval('('+_0x58b52a[_0x269e('0x10')]+')');return _0x58b52a;});}else if(_0x41d28c!==null&&typeof _0x41d28c=='object'){_0x41d28c['condition']=eval('('+_0x41d28c['condition']+')');_0x41d28c[_0x269e('0x10')]=eval('('+_0x41d28c[_0x269e('0x10')]+')');}this[_0x269e('0x6')](_0x41d28c);};module[_0x269e('0x26')]=RuleEngine;
\ No newline at end of file
+var _0xfbdf=['init','rules','activeRules','isArray','concat','isObject','push','sync','filter','orderBy','execute','clone','consequence','ruleRef','name','index_','nextTick','call','next','isEqual','restart','length','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','map','condition','toString','isString','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','inherits','prototype'];(function(_0x330fda,_0x21e587){var _0x5623c7=function(_0x3898ef){while(--_0x3898ef){_0x330fda['push'](_0x330fda['shift']());}};_0x5623c7(++_0x21e587);}(_0xfbdf,0x106));var _0xffbd=function(_0x34ac75,_0x75b3a2){_0x34ac75=_0x34ac75-0x0;var _0x389365=_0xfbdf[_0x34ac75];return _0x389365;};'use strict';var _=require(_0xffbd('0x0'));var util=require(_0xffbd('0x1'));var EventEmitter=require(_0xffbd('0x2'))[_0xffbd('0x3')];function RuleEngine(_0x22797f,_0x17dc83){this['init']();if(!_[_0xffbd('0x4')](_0x22797f)){this[_0xffbd('0x5')](_0x22797f);}if(_0x17dc83){this['ignoreFactChanges']=_0x17dc83['ignoreFactChanges'];}return this;}util[_0xffbd('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xffbd('0x7')][_0xffbd('0x8')]=function(_0x19caa4){this[_0xffbd('0x9')]=[];this[_0xffbd('0xa')]=[];};RuleEngine['prototype'][_0xffbd('0x5')]=function(_0x5af06e){if(Array[_0xffbd('0xb')](_0x5af06e)){this['rules']=this[_0xffbd('0x9')][_0xffbd('0xc')](_0x5af06e);}else if(_0x5af06e!==null&&_[_0xffbd('0xd')](_0x5af06e)){this['rules'][_0xffbd('0xe')](_0x5af06e);}this[_0xffbd('0xf')]();};RuleEngine[_0xffbd('0x7')][_0xffbd('0xf')]=function(){this['activeRules']=this[_0xffbd('0x9')][_0xffbd('0x10')](function(_0x5c1394){if(_[_0xffbd('0x4')](_0x5c1394['on'])){_0x5c1394['on']=!![];}if(_0x5c1394['on']===!![]){return _0x5c1394;}});this[_0xffbd('0xa')]=_[_0xffbd('0x11')](this[_0xffbd('0xa')],['p'],['asc']);};RuleEngine[_0xffbd('0x7')][_0xffbd('0x12')]=function(_0x158ae8,_0x1c6897){var _0x2e9b2f=![];_0x158ae8['result']=!![];var _0x350676=_['clone'](_0x158ae8);var _0x29656c=_[_0xffbd('0x13')](_0x158ae8);var _0x3fa6e1=this['activeRules'];var _0x1f0dc1=[];var _0x5de0bc=this['ignoreFactChanges'];(function FnRuleLoop(_0x1c2311){var _0x52fb52={'rules':function(){return _0x3fa6e1;},'rule':function(){return _0x3fa6e1[_0x1c2311];},'when':function(_0xd91ba6){if(_0xd91ba6){var _0x3224b5=_0x3fa6e1[_0x1c2311][_0xffbd('0x14')];_0x3224b5[_0xffbd('0x15')]=_0x3fa6e1[_0x1c2311]['id']||_0x3fa6e1[_0x1c2311][_0xffbd('0x16')]||_0xffbd('0x17')+_0x1c2311;process[_0xffbd('0x18')](function(){_0x1f0dc1[_0xffbd('0xe')](_0x3224b5[_0xffbd('0x15')]);_0x3224b5[_0xffbd('0x19')](_0x350676,_0x52fb52);});}else{process[_0xffbd('0x18')](function(){_0x52fb52[_0xffbd('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2e9b2f=!![];return FnRuleLoop(0x0);},'next':function(_0x48e5fa){if(!_0x5de0bc&&!_[_0xffbd('0x1b')](_0x29656c,_0x350676)){_0x29656c=_[_0xffbd('0x13')](_0x350676);process[_0xffbd('0x18')](function(){_0x52fb52[_0xffbd('0x1c')]();});}else{process['nextTick'](function(){if(_['isNil'](_0x48e5fa)){return FnRuleLoop(_0x1c2311+0x1);}else{return FnRuleLoop(_0x48e5fa);}});}}};if(_0x1c2311<_0x3fa6e1[_0xffbd('0x1d')]&&_0x2e9b2f===![]){var _0x5b395d=_0x3fa6e1[_0x1c2311]['condition'];_0x5b395d[_0xffbd('0x19')](_0x350676,_0x52fb52);}else{process[_0xffbd('0x18')](function(){_0x350676[_0xffbd('0x1e')]=_0x1f0dc1;return _0x1c6897?_0x1c6897(_0x350676):_[_0xffbd('0x1f')]();});}}(0x0));};RuleEngine[_0xffbd('0x7')][_0xffbd('0x20')]=function(_0x3a38b8){if(_['isNil'](_0x3a38b8)){return this[_0xffbd('0x9')];}else{var _0x145a12=_[_0xffbd('0x21')](_0x3a38b8);return _[_0xffbd('0x10')](this[_0xffbd('0x9')],_0x145a12);}};RuleEngine[_0xffbd('0x7')][_0xffbd('0x22')]=function(_0xdb5638,_0x7a1f9){var _0x4baf61=_0xdb5638==='on'||_0xdb5638==='ON'?!![]:![];var _0x90b93=this['findRules'](_0x7a1f9);for(var _0x2133ad=0x0,_0x33bcef=_0x90b93['length'];_0x2133ad<_0x33bcef;_0x2133ad+=0x1){_0x90b93[_0x2133ad]['on']=_0x4baf61;}this['sync']();};RuleEngine[_0xffbd('0x7')][_0xffbd('0x23')]=function(_0x53ceab,_0x555b3d){_0x53ceab=parseInt(_0x53ceab,0xa);var _0x52daa4=this['findRules'](_0x555b3d);for(var _0x580118=0x0,_0x53e33c=_0x52daa4[_0xffbd('0x1d')];_0x580118<_0x53e33c;_0x580118+=0x1){_0x52daa4[_0x580118][_0xffbd('0x24')]=_0x53ceab;}this[_0xffbd('0xf')]();};RuleEngine[_0xffbd('0x7')][_0xffbd('0x25')]=function(){var _0x3d25e0=this[_0xffbd('0x9')];if(_0x3d25e0 instanceof Array){_0x3d25e0=_0x3d25e0[_0xffbd('0x26')](function(_0x536ee8){_0x536ee8[_0xffbd('0x27')]=_0x536ee8['condition']['toString']();_0x536ee8[_0xffbd('0x14')]=_0x536ee8[_0xffbd('0x14')][_0xffbd('0x28')]();return _0x536ee8;});}else if(!_[_0xffbd('0x4')](_0x3d25e0)){_0x3d25e0[_0xffbd('0x27')]=_0x3d25e0[_0xffbd('0x27')][_0xffbd('0x28')]();_0x3d25e0[_0xffbd('0x14')]=_0x3d25e0[_0xffbd('0x14')][_0xffbd('0x28')]();}return _0x3d25e0;};RuleEngine[_0xffbd('0x7')]['fromJSON']=function(_0x1ca223){this[_0xffbd('0x8')]();if(_[_0xffbd('0x29')](_0x1ca223)){_0x1ca223=JSON[_0xffbd('0x2a')](_0x1ca223);}if(_0x1ca223 instanceof Array){_0x1ca223=_0x1ca223[_0xffbd('0x26')](function(_0x116301){_0x116301[_0xffbd('0x27')]=eval('('+_0x116301[_0xffbd('0x27')]+')');_0x116301[_0xffbd('0x14')]=eval('('+_0x116301['consequence']+')');return _0x116301;});}else if(_0x1ca223!==null&&typeof _0x1ca223==_0xffbd('0x2b')){_0x1ca223[_0xffbd('0x27')]=eval('('+_0x1ca223['condition']+')');_0x1ca223[_0xffbd('0x14')]=eval('('+_0x1ca223[_0xffbd('0x14')]+')');}this[_0xffbd('0x5')](_0x1ca223);};module[_0xffbd('0x2c')]=RuleEngine;
\ No newline at end of file