var c=function(r){v(r);var e=l(r);return r.on=e.on,r.off=e.off,r.fire=e.fire,r};function l(n){var r=Object.create(null);return{on:function(e,t,o){if(typeof t!="function")throw new Error("callback is expected to be a function");var f=r[e];return f||(f=r[e]=[]),f.push({callback:t,ctx:o}),n},off:function(e,t){var o=typeof e=="undefined";if(o)return r=Object.create(null),n;if(r[e]){var f=typeof t!="function";if(f)delete r[e];else for(var a=r[e],i=0;i1&&(o=Array.prototype.splice.call(arguments,1));for(var f=0;f