(function(){function d(a,b,c,d){this.allowed=a,this.actions=b,this.subjects=c,this.condition=d,f(this.actions)||(this.actions=[this.actions]),f(this.subjects)||(this.subjects=[this.subjects])}function e(){this.rules=[]}function f(a){return Object.prototype.toString.call(a)==="[object Array]"}var a={},b=this,c=b.manacle;typeof module!="undefined"&&module.exports?module.exports=a:b.manacle=a,a.VERSION="0.1.0",a.noConflict=function(){return b.manacle=c,a},a.create=function(){return new e},a.Rule=d,a.Acl=e,d.prototype.matchAction=function(a){return this.actions.indexOf(a)>=0||this.actions.indexOf("*")>=0},d.prototype.matchSubject=function(a){return this.subjects.indexOf(a)>=0||this.subjects.indexOf("*")>=0},d.prototype.match=function(a,b){return this.matchAction(a)&&this.matchSubject(b)},d.prototype.check=function(a){return this.condition!==undefined?this.condition.apply(this,a):!0},e.prototype.allow=function(a,b,c){this.rules.push(new d(!0,a,b,c))},e.prototype.deny=function(a,b,c){this.rules.push(new d(!1,a,b,c))},e.prototype.allowed=function(a,b){var c=[].slice.call(arguments,2),d=this.matches(a,b);for(var e=0;e