// injector.js v0.1.7 (2014-07-04) // !function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof module&&"object"==typeof exports&&module.exports===exports?module.exports=b():a.Injector=b()}(this,function(){function a(a){return Object.prototype.toString.call(a).match(e)[1].toLowerCase()}function b(b,c){return"string"===a(b)?(c=c||"",0===b.indexOf(c)?b.substring(c.length):b):void 0}function c(a,b){j[a]=b}function d(c){function d(){var a,e=d.$injects||[],f=[];return e.forEach(function(c){var d;if(0===c.indexOf(m)&&(d=1,c=b(c,m)),!(c in j))throw new Error("Resolve failed: "+c+" is not registered");if(a=j[c],d)try{a=new a}catch(e){throw new Error("Resolve failed: "+c+" can't be instantiated")}f.push(a)}),c.apply(this,Array.prototype.slice.call(arguments).concat(f))}if("function"===a(c)){var e,k,l=this.config.injectPrefix||h,m=this.config.classPrefix||i,n=c.toString().replace(f,""),o=n.match(g)[1].replace(/\s*/g,""),p=o.indexOf(l),q=[];if(-1!==p){e=o.substring(p),k=e.split(",");for(var r,s=0;r=k[s];s++)if(0!==r.indexOf(l))throw new Error("Resolve failed: all injected must at the end of arguments");k.forEach(function(a){q.push(b(a,l))})}return d.$injects=c.$injects||q,d.prototype=c.prototype,d.prototype.constructor=d,d}}Array.prototype.forEach||(Array.prototype.forEach=function(a,b){for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c,this)});var e=/\s+(\w+)\]$/,f=/\/\/.*$|\/\*[\s\S]*?\*\//gm,g=/\(([\s\S]*?)\)/m,h="$",i="$",j={};return{register:c,resolve:d,config:{injectPrefix:h,classPrefix:i}}});