Built motion from commit 459747fdfe53bbf13fbede61eeaffea1f1438f86. Version 3.0.0...
[motion-next.git] / server / services / routing / lib / rule-engine.js
index 1833d41..51f9418 100644 (file)
@@ -1 +1 @@
-const a1162_0x2965=['turn','ruleRef','matches','toString','findRules','prioritize','asc','toJSON','isNil','inherits','restart','orderBy','fromJSON','name','consequence','isArray','priority','ignoreFactChanges','EventEmitter','call','filter','object','sync','prototype','init','clone','lodash','exports','isEqual','nextTick','parse','register','map','length','isObject','push','next','execute','concat','matchPath','events','condition','util','activeRules','rules'];(function(_0x5c846e,_0x29651e){const _0x5e7930=function(_0xda43ed){while(--_0xda43ed){_0x5c846e['push'](_0x5c846e['shift']());}};_0x5e7930(++_0x29651e);}(a1162_0x2965,0xcf));const a1162_0x5e79=function(_0x5c846e,_0x29651e){_0x5c846e=_0x5c846e-0x0;let _0x5e7930=a1162_0x2965[_0x5c846e];return _0x5e7930;};const _0x5ec62b=a1162_0x5e79;'use strict';const _=require(_0x5ec62b('0x2c')),util=require(_0x5ec62b('0xf')),EventEmitter=require(_0x5ec62b('0xd'))[_0x5ec62b('0x24')];function RuleEngine(_0xda43ed,_0x9347a3){const _0x3e6314=_0x5ec62b;return this[_0x3e6314('0x2a')](),!_['isNil'](_0xda43ed)&&this[_0x3e6314('0x4')](_0xda43ed),_0x9347a3&&(this['ignoreFactChanges']=_0x9347a3[_0x3e6314('0x23')]),this;}util[_0x5ec62b('0x1b')](RuleEngine,EventEmitter),RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0x2a')]=function(){const _0x160dd3=_0x5ec62b;this[_0x160dd3('0x11')]=[],this[_0x160dd3('0x10')]=[];},RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0x4')]=function(_0x1a8944){const _0x1a1507=_0x5ec62b;if(Array[_0x1a1507('0x21')](_0x1a8944))this[_0x1a1507('0x11')]=this[_0x1a1507('0x11')][_0x1a1507('0xb')](_0x1a8944);else _0x1a8944!==null&&_[_0x1a1507('0x7')](_0x1a8944)&&this[_0x1a1507('0x11')]['push'](_0x1a8944);this[_0x1a1507('0x28')]();},RuleEngine['prototype'][_0x5ec62b('0x28')]=function(){const _0x43e3b9=_0x5ec62b;this[_0x43e3b9('0x10')]=this[_0x43e3b9('0x11')][_0x43e3b9('0x26')](function(_0x3ee240){const _0x24562a=_0x43e3b9;_[_0x24562a('0x1a')](_0x3ee240['on'])&&(_0x3ee240['on']=!![]);if(_0x3ee240['on']===!![])return _0x3ee240;}),this['activeRules']=_[_0x43e3b9('0x1d')](this[_0x43e3b9('0x10')],['p'],[_0x43e3b9('0x18')]);},RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0xa')]=function(_0x5e2005,_0x3788fd){const _0x19aec2=_0x5ec62b;let _0x189ad7=![];_0x5e2005['result']=!![];const _0x43ea48=_['clone'](_0x5e2005);let _0x4579f5=_[_0x19aec2('0x2b')](_0x5e2005);const _0x355bd6=this[_0x19aec2('0x10')],_0x5c5ee5=[],_0x3f8d2f=this['ignoreFactChanges'];(function _0x5e3f67(_0x5f0319){const _0x5c4e01=_0x19aec2,_0xb7fa47={'rules':function(){return _0x355bd6;},'rule':function(){return _0x355bd6[_0x5f0319];},'when':function(_0x465d42){const _0x45d42f=a1162_0x5e79;if(_0x465d42){const _0x3f122c=_0x355bd6[_0x5f0319][_0x45d42f('0x20')];_0x3f122c[_0x45d42f('0x13')]=_0x355bd6[_0x5f0319]['id']||_0x355bd6[_0x5f0319][_0x45d42f('0x1f')]||'index_'+_0x5f0319,process[_0x45d42f('0x2')](function(){const _0x361edd=_0x45d42f;_0x5c5ee5[_0x361edd('0x8')](_0x3f122c[_0x361edd('0x13')]),_0x3f122c[_0x361edd('0x25')](_0x43ea48,_0xb7fa47);});}else process[_0x45d42f('0x2')](function(){const _0x457513=_0x45d42f;_0xb7fa47[_0x457513('0x9')]();});},'restart':function(){return _0x5e3f67(0x0);},'stop':function(){return _0x189ad7=!![],_0x5e3f67(0x0);},'next':function(_0x1003a5){const _0x194d6f=a1162_0x5e79;!_0x3f8d2f&&!_[_0x194d6f('0x1')](_0x4579f5,_0x43ea48)?(_0x4579f5=_[_0x194d6f('0x2b')](_0x43ea48),process[_0x194d6f('0x2')](function(){const _0x1bbc87=_0x194d6f;_0xb7fa47[_0x1bbc87('0x1c')]();})):process[_0x194d6f('0x2')](function(){const _0x3bf2fc=_0x194d6f;return _[_0x3bf2fc('0x1a')](_0x1003a5)?_0x5e3f67(_0x5f0319+0x1):_0x5e3f67(_0x1003a5);});}};if(_0x5f0319<_0x355bd6['length']&&_0x189ad7===![]){const _0x9d895b=_0x355bd6[_0x5f0319][_0x5c4e01('0xe')];_0x9d895b[_0x5c4e01('0x25')](_0x43ea48,_0xb7fa47);}else process[_0x5c4e01('0x2')](function(){const _0xbf6414=_0x5c4e01;return _0x43ea48[_0xbf6414('0xc')]=_0x5c5ee5,_0x3788fd?_0x3788fd(_0x43ea48):_['noop']();});}(0x0));},RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0x16')]=function(_0xa4f728){const _0x568268=_0x5ec62b;if(_[_0x568268('0x1a')](_0xa4f728))return this[_0x568268('0x11')];else{const _0x43b551=_[_0x568268('0x14')](_0xa4f728);return _[_0x568268('0x26')](this[_0x568268('0x11')],_0x43b551);}},RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0x12')]=function(_0x21f109,_0x83aae0){const _0x177c5f=_0x5ec62b,_0x4af9e5=_0x21f109==='on'||_0x21f109==='ON'?!![]:![],_0x243e55=this['findRules'](_0x83aae0);for(let _0x3381a3=0x0,_0x170975=_0x243e55[_0x177c5f('0x6')];_0x3381a3<_0x170975;_0x3381a3+=0x1){_0x243e55[_0x3381a3]['on']=_0x4af9e5;}this[_0x177c5f('0x28')]();},RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0x17')]=function(_0x3863fd,_0xbec8e9){const _0x597483=_0x5ec62b;_0x3863fd=parseInt(_0x3863fd,0xa);const _0x3a7db8=this[_0x597483('0x16')](_0xbec8e9);for(let _0x14dc7b=0x0,_0x2836a6=_0x3a7db8[_0x597483('0x6')];_0x14dc7b<_0x2836a6;_0x14dc7b+=0x1){_0x3a7db8[_0x14dc7b][_0x597483('0x22')]=_0x3863fd;}this['sync']();},RuleEngine['prototype'][_0x5ec62b('0x19')]=function(){const _0x4e69a2=_0x5ec62b;let _0x3c401a=this[_0x4e69a2('0x11')];if(_0x3c401a instanceof Array)_0x3c401a=_0x3c401a[_0x4e69a2('0x5')](function(_0x5a9ce5){const _0x196dbb=_0x4e69a2;return _0x5a9ce5[_0x196dbb('0xe')]=_0x5a9ce5[_0x196dbb('0xe')][_0x196dbb('0x15')](),_0x5a9ce5[_0x196dbb('0x20')]=_0x5a9ce5[_0x196dbb('0x20')][_0x196dbb('0x15')](),_0x5a9ce5;});else!_[_0x4e69a2('0x1a')](_0x3c401a)&&(_0x3c401a[_0x4e69a2('0xe')]=_0x3c401a[_0x4e69a2('0xe')][_0x4e69a2('0x15')](),_0x3c401a[_0x4e69a2('0x20')]=_0x3c401a['consequence']['toString']());return _0x3c401a;},RuleEngine[_0x5ec62b('0x29')][_0x5ec62b('0x1e')]=function(_0x1a8f37){const _0x223063=_0x5ec62b;this[_0x223063('0x2a')]();_['isString'](_0x1a8f37)&&(_0x1a8f37=JSON[_0x223063('0x3')](_0x1a8f37));if(_0x1a8f37 instanceof Array)_0x1a8f37=_0x1a8f37['map'](function(_0x35862a){const _0x299f33=_0x223063;return _0x35862a['condition']=eval('('+_0x35862a[_0x299f33('0xe')]+')'),_0x35862a[_0x299f33('0x20')]=eval('('+_0x35862a['consequence']+')'),_0x35862a;});else _0x1a8f37!==null&&typeof _0x1a8f37==_0x223063('0x27')&&(_0x1a8f37[_0x223063('0xe')]=eval('('+_0x1a8f37[_0x223063('0xe')]+')'),_0x1a8f37[_0x223063('0x20')]=eval('('+_0x1a8f37[_0x223063('0x20')]+')'));this['register'](_0x1a8f37);},module[_0x5ec62b('0x0')]=RuleEngine;
\ No newline at end of file
+const a1162_0x23bf=['prototype','sync','next','findRules','util','object','isArray','filter','consequence','toString','inherits','concat','toJSON','matches','activeRules','length','push','ruleRef','execute','condition','nextTick','init','EventEmitter','restart','ignoreFactChanges','clone','call','isNil','priority','matchPath','register','map','isString','rules','turn','lodash','index_'];(function(_0x361199,_0x23bfa9){const _0x65de5c=function(_0x30b964){while(--_0x30b964){_0x361199['push'](_0x361199['shift']());}};_0x65de5c(++_0x23bfa9);}(a1162_0x23bf,0x69));const a1162_0x65de=function(_0x361199,_0x23bfa9){_0x361199=_0x361199-0x0;let _0x65de5c=a1162_0x23bf[_0x361199];return _0x65de5c;};const _0x3d218b=a1162_0x65de;'use strict';const _=require(_0x3d218b('0x4')),util=require(_0x3d218b('0xa')),EventEmitter=require('events')[_0x3d218b('0x1c')];function RuleEngine(_0x30b964,_0x18848d){const _0x51c7f8=_0x3d218b;return this[_0x51c7f8('0x1b')](),!_[_0x51c7f8('0x21')](_0x30b964)&&this[_0x51c7f8('0x24')](_0x30b964),_0x18848d&&(this[_0x51c7f8('0x1e')]=_0x18848d['ignoreFactChanges']),this;}util[_0x3d218b('0x10')](RuleEngine,EventEmitter),RuleEngine[_0x3d218b('0x6')][_0x3d218b('0x1b')]=function(){const _0x28fa10=_0x3d218b;this[_0x28fa10('0x2')]=[],this[_0x28fa10('0x14')]=[];},RuleEngine[_0x3d218b('0x6')][_0x3d218b('0x24')]=function(_0x173778){const _0x2892c3=_0x3d218b;if(Array[_0x2892c3('0xc')](_0x173778))this[_0x2892c3('0x2')]=this[_0x2892c3('0x2')][_0x2892c3('0x11')](_0x173778);else _0x173778!==null&&_['isObject'](_0x173778)&&this[_0x2892c3('0x2')][_0x2892c3('0x16')](_0x173778);this[_0x2892c3('0x7')]();},RuleEngine[_0x3d218b('0x6')][_0x3d218b('0x7')]=function(){const _0x2090d7=_0x3d218b;this[_0x2090d7('0x14')]=this[_0x2090d7('0x2')][_0x2090d7('0xd')](function(_0x35427d){const _0x45a08a=_0x2090d7;_[_0x45a08a('0x21')](_0x35427d['on'])&&(_0x35427d['on']=!![]);if(_0x35427d['on']===!![])return _0x35427d;}),this[_0x2090d7('0x14')]=_['orderBy'](this[_0x2090d7('0x14')],['p'],['asc']);},RuleEngine[_0x3d218b('0x6')][_0x3d218b('0x18')]=function(_0x4fa770,_0x360f18){const _0x29ed9b=_0x3d218b;let _0x2a1622=![];_0x4fa770['result']=!![];const _0x50ceab=_[_0x29ed9b('0x1f')](_0x4fa770);let _0x46c344=_[_0x29ed9b('0x1f')](_0x4fa770);const _0x485c75=this['activeRules'],_0x3deacb=[],_0x24ca9f=this[_0x29ed9b('0x1e')];(function _0x43f6f8(_0x11d474){const _0x5f5238=_0x29ed9b,_0x3b4a1f={'rules':function(){return _0x485c75;},'rule':function(){return _0x485c75[_0x11d474];},'when':function(_0x5235fe){const _0x462ba5=a1162_0x65de;if(_0x5235fe){const _0x124807=_0x485c75[_0x11d474][_0x462ba5('0xe')];_0x124807[_0x462ba5('0x17')]=_0x485c75[_0x11d474]['id']||_0x485c75[_0x11d474]['name']||_0x462ba5('0x5')+_0x11d474,process[_0x462ba5('0x1a')](function(){const _0x1bf46c=_0x462ba5;_0x3deacb[_0x1bf46c('0x16')](_0x124807[_0x1bf46c('0x17')]),_0x124807[_0x1bf46c('0x20')](_0x50ceab,_0x3b4a1f);});}else process[_0x462ba5('0x1a')](function(){const _0x391b15=_0x462ba5;_0x3b4a1f[_0x391b15('0x8')]();});},'restart':function(){return _0x43f6f8(0x0);},'stop':function(){return _0x2a1622=!![],_0x43f6f8(0x0);},'next':function(_0x37d08d){const _0xf7784b=a1162_0x65de;!_0x24ca9f&&!_['isEqual'](_0x46c344,_0x50ceab)?(_0x46c344=_['clone'](_0x50ceab),process[_0xf7784b('0x1a')](function(){const _0x3d3845=_0xf7784b;_0x3b4a1f[_0x3d3845('0x1d')]();})):process[_0xf7784b('0x1a')](function(){const _0xa7ae4b=_0xf7784b;return _[_0xa7ae4b('0x21')](_0x37d08d)?_0x43f6f8(_0x11d474+0x1):_0x43f6f8(_0x37d08d);});}};if(_0x11d474<_0x485c75[_0x5f5238('0x15')]&&_0x2a1622===![]){const _0x47762d=_0x485c75[_0x11d474][_0x5f5238('0x19')];_0x47762d['call'](_0x50ceab,_0x3b4a1f);}else process['nextTick'](function(){const _0x413b7d=_0x5f5238;return _0x50ceab[_0x413b7d('0x23')]=_0x3deacb,_0x360f18?_0x360f18(_0x50ceab):_['noop']();});}(0x0));},RuleEngine['prototype']['findRules']=function(_0x5054aa){const _0xc4aa00=_0x3d218b;if(_['isNil'](_0x5054aa))return this['rules'];else{const _0x177f98=_[_0xc4aa00('0x13')](_0x5054aa);return _[_0xc4aa00('0xd')](this[_0xc4aa00('0x2')],_0x177f98);}},RuleEngine[_0x3d218b('0x6')][_0x3d218b('0x3')]=function(_0x4eca8a,_0x487d97){const _0x20cd34=_0x3d218b,_0x2cf2c3=_0x4eca8a==='on'||_0x4eca8a==='ON'?!![]:![],_0x1e08ee=this['findRules'](_0x487d97);for(let _0x16f8b1=0x0,_0x2731a4=_0x1e08ee[_0x20cd34('0x15')];_0x16f8b1<_0x2731a4;_0x16f8b1+=0x1){_0x1e08ee[_0x16f8b1]['on']=_0x2cf2c3;}this[_0x20cd34('0x7')]();},RuleEngine[_0x3d218b('0x6')]['prioritize']=function(_0xdc6f7e,_0x46e715){const _0x22ef1d=_0x3d218b;_0xdc6f7e=parseInt(_0xdc6f7e,0xa);const _0x596735=this[_0x22ef1d('0x9')](_0x46e715);for(let _0x4f3a88=0x0,_0x163e6d=_0x596735[_0x22ef1d('0x15')];_0x4f3a88<_0x163e6d;_0x4f3a88+=0x1){_0x596735[_0x4f3a88][_0x22ef1d('0x22')]=_0xdc6f7e;}this[_0x22ef1d('0x7')]();},RuleEngine['prototype'][_0x3d218b('0x12')]=function(){const _0x439215=_0x3d218b;let _0x4d4423=this[_0x439215('0x2')];if(_0x4d4423 instanceof Array)_0x4d4423=_0x4d4423[_0x439215('0x0')](function(_0x2e42d8){const _0x40c02c=_0x439215;return _0x2e42d8[_0x40c02c('0x19')]=_0x2e42d8[_0x40c02c('0x19')]['toString'](),_0x2e42d8[_0x40c02c('0xe')]=_0x2e42d8[_0x40c02c('0xe')][_0x40c02c('0xf')](),_0x2e42d8;});else!_[_0x439215('0x21')](_0x4d4423)&&(_0x4d4423[_0x439215('0x19')]=_0x4d4423['condition']['toString'](),_0x4d4423[_0x439215('0xe')]=_0x4d4423[_0x439215('0xe')]['toString']());return _0x4d4423;},RuleEngine[_0x3d218b('0x6')]['fromJSON']=function(_0x3a7dd2){const _0x45f3f0=_0x3d218b;this[_0x45f3f0('0x1b')]();_[_0x45f3f0('0x1')](_0x3a7dd2)&&(_0x3a7dd2=JSON['parse'](_0x3a7dd2));if(_0x3a7dd2 instanceof Array)_0x3a7dd2=_0x3a7dd2[_0x45f3f0('0x0')](function(_0x23b024){const _0x44a7ee=_0x45f3f0;return _0x23b024[_0x44a7ee('0x19')]=eval('('+_0x23b024[_0x44a7ee('0x19')]+')'),_0x23b024[_0x44a7ee('0xe')]=eval('('+_0x23b024[_0x44a7ee('0xe')]+')'),_0x23b024;});else _0x3a7dd2!==null&&typeof _0x3a7dd2==_0x45f3f0('0xb')&&(_0x3a7dd2['condition']=eval('('+_0x3a7dd2[_0x45f3f0('0x19')]+')'),_0x3a7dd2['consequence']=eval('('+_0x3a7dd2[_0x45f3f0('0xe')]+')'));this[_0x45f3f0('0x24')](_0x3a7dd2);},module['exports']=RuleEngine;
\ No newline at end of file