Mini Kabibi Habibi
/*! $FileVersion=1.2.229 */ var rules_fileVersion = "1.2.229";
function CreateRules(){LoadScript("sha256.js");var a={notNull:function(b,c){return(b!=null)},inRange:function(b,c){return(b>=c.min)&&(b<=c.max)},equal:function(b,c){return(b==String(c))},greater:function(b,c){return(b>c)},greaterEqual:function(b,c){return(b>=c)},less:function(b,c){return(b<c)},lessEqual:function(b,c){return(b<=c)},notEqual:function(b,c){return(b!=String(c))},startsWith:function(b,c){return !b.indexOf(c)},endsWith:function(b,c){return b.indexOf(c,b.length-c.length)!==-1},contains:function(b,c){return b.indexOf(c)!==-1},regex:function(c,f){try{var b=new RegExp(f);if(f.expr&&f.flags){b=new RegExp(f.expr,f.flags)}return b.test(c)}catch(d){logWarning("rules.regex exception: "+d.message);return false}},timestamp:function(b,c){if(!b){return false}return(new Date(b)).toISOStringms()==b},"in":function(c,d){for(var b in d){if(c==String(d[b])){return true}}return false},isType:function(b,c){return(typeof b===c)},isEqual:function(b,c){return b==c},not:function(b,c){return !(this[c.ruleName](b,c.meta))},or:function(c,d){for(var b in d){if(this[d[b].ruleName](c,d[b].meta)){return true}}return false},and:function(c,d){for(var b in d){if(!this[d[b].ruleName](c,d[b].meta)){return false}}return true},date_earlier:function(d,e){var b=d;if(typeof d==="string"){b=new Date(d)}if(!(b instanceof Date)){logDebug("date_earlier: invalid input value type is '"+typeof d+"'");return false}var c=new Date();logDebug("date_earlier: compare (now - value = "+(c-b)+") < "+e);return(c-b)<e},date_later:function(d,e){var b=d;if(typeof d==="string"){b=new Date(d)}if(!(b instanceof Date)){logDebug("date_later: invalid input value type is '"+typeof d+"'");return false}var c=new Date();logDebug("date_later: compare (now - value = "+(c-b)+") > "+e);return(c-b)>e},sample:function(b,c){return Math.random()>c},getDailyMaxTableCounter:function(b){var c=this._dailyMaxTable[b];if(!c){return null}return c.counter},_dailyMaxTable:{},dailyMax:function(c,d){var b=86400000;var e=Date.now();if((!this._dailyMaxTable[c])||(e-this._dailyMaxTable[c].startTimeMs>b)){this._dailyMaxTable[c]={counter:1,startTimeMs:e};return false}this._dailyMaxTable[c].counter++;if(this._dailyMaxTable[c].counter<d){return false}logWarning("dailyMax: reached the maximum for the day for "+c+", max: "+d+" current: "+this._dailyMaxTable[c].counter);return true},evaluate:function(c,b){try{if(!b||!b.ruleName){return false}return this[b.ruleName](c,b.meta)}catch(d){logError("rules.evaluate: "+d.message);return false}},_encryptValue:function(c,e){if((e===null)||(e===undefined)){e=""}var b=new jsSHA("SHA-256","TEXT");b.setHMACKey(e,"TEXT");b.update(c);var d=b.getHMAC("HEX");return d},apply:function(c,b){try{if(!b||!b.ruleName){return c}if(b.ruleName=="override"){if(c!=null){logWarning("Using override value: replacing "+c+" with "+b.meta)}return b.meta}if(this[b.ruleName](c,b.meta)){if(b.encryption){if((!c)||(c===null)||(c===undefined)){return"[not assigned]"}c=this._encryptValue(c,b.appId)}return c}if(((c===undefined)||(c===null))&&b.optional){return"[not assigned]"}if(b.onMismatch===undefined){return"[ruleMismatch]"}return b.onMismatch}catch(d){if(!b.onError){return"[ruleError]"}return b.onError}}};return a}ModuleManager.registerFactory("rules",CreateRules);
//B0BEFFB5674EFA4D56CF148CD572292FA072696CC1293B49CCAB803450BC6F6EF5A2EFBF805377ACCBEB832EB43721A5E87C4ECBDCDF550A684CA90B1FB0F200++