(function(a){function c(){if(arguments.length==0){var d=0;for(var e=0;e<b.length;e++)d+=c(b[e].route);return d}var f=arguments[0],g=arguments[1];if(arguments.length==1&&typeof f=="object")for(var h in f)c(h,f[h]);else{if(arguments.length==1&&typeof f=="string"){var d=0;for(var e=0;e<b.length;e++){var h=b[e];if(h.route!==f)continue;if("selector"in h){var i=a(h.selector).filter(function(){return!a(this).data("run:"+h.selector)}).data("run:"+h.selector,!0);i.length&&(h.callback.call(i),d++)}else if("pathname"in h){var j,k=window.location.hash.slice(0,2)=="#!"?window.location.hash.slice(2):window.location.pathname;if(j=h.pathname.exec(k))h.callback.apply(i,j.concat(j.shift())),d++}}return d}!g&&typeof f=="function"&&(g=f,f="/?*");var l=typeof f=="string"&&f.charAt()=="/";if(l){var k=f.concat("/?").replace(/\(([^)]+)\)/,"(?:$1)?").replace(/:(\w+)/,"([^/]+)").replace(/([\/.])/g,"\\$1").replace(/\*(\w+)?/g,"(.+)");b.push({route:f,pathname:new RegExp("^"+k+"$","i"),callback:g})}else b.push({route:f,selector:f,callback:g})}}var b=[];a.run=c,a.run._routes=b,a.run.again=function(b,c){a(b).removeData("run:"+selector),c&&a.run(selector)},a(function(){c()})})(jQuery)
