rails-angularjs2 2.0.0.pre.alpha.32 → 2.0.0.pre.beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/rails-angularjs2/version.rb +1 -1
  4. data/vendor/assets/javascripts/Rx.js +11615 -0
  5. data/vendor/assets/javascripts/Rx.min.js +417 -0
  6. data/vendor/assets/javascripts/Rx.min.js.map +1 -0
  7. data/vendor/assets/javascripts/Rx.umd.js +10274 -0
  8. data/vendor/assets/javascripts/Rx.umd.min.js +748 -0
  9. data/vendor/assets/javascripts/Rx.umd.min.js.map +8 -0
  10. data/vendor/assets/javascripts/angular2-all-testing.umd.dev.js +39335 -0
  11. data/vendor/assets/javascripts/angular2-all.umd.dev.js +37160 -0
  12. data/vendor/assets/javascripts/angular2-all.umd.js +37159 -0
  13. data/vendor/assets/javascripts/angular2-all.umd.min.js +19 -0
  14. data/vendor/assets/javascripts/angular2-polyfills.js +3324 -0
  15. data/vendor/assets/javascripts/angular2-polyfills.min.js +1 -0
  16. data/vendor/assets/javascripts/angular2.dev.js +23937 -29580
  17. data/vendor/assets/javascripts/angular2.js +24021 -29105
  18. data/vendor/assets/javascripts/angular2.min.js +18 -24
  19. data/vendor/assets/javascripts/http.dev.js +1091 -0
  20. data/vendor/assets/javascripts/http.js +1091 -0
  21. data/vendor/assets/javascripts/http.min.js +1 -0
  22. data/vendor/assets/javascripts/router.dev.js +2946 -1894
  23. data/vendor/assets/javascripts/router.js +3107 -0
  24. data/vendor/assets/javascripts/router.min.js +3 -0
  25. data/vendor/assets/javascripts/testing.dev.js +2105 -0
  26. data/vendor/assets/javascripts/testing.dev.js.map +1 -0
  27. data/vendor/assets/javascripts/upgrade.dev.js +777 -0
  28. data/vendor/assets/javascripts/upgrade.js +777 -0
  29. data/vendor/assets/javascripts/upgrade.min.js +1 -0
  30. metadata +25 -9
  31. data/vendor/assets/javascripts/angular2.sfx.dev.js +0 -36368
  32. data/vendor/assets/javascripts/mock.dev.js +0 -337
  33. data/vendor/assets/javascripts/mock.dev.js.map +0 -1
  34. data/vendor/assets/javascripts/router.dev.js.map +0 -1
  35. data/vendor/assets/javascripts/test_lib.dev.js +0 -1510
  36. data/vendor/assets/javascripts/test_lib.dev.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ "format register";System.register("angular2/src/router/router_link_transform",["angular2/compiler","angular2/src/core/change_detection/parser/ast","angular2/src/facade/exceptions","angular2/core","angular2/src/core/change_detection/parser/parser"],!0,function(t,e,r){function n(t,e){var r=new y(t,e.trim()).tokenize();return new v(r).generate()}var o=System.global,a=o.define;o.define=void 0;var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},s=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},u=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},c=t("angular2/compiler"),l=t("angular2/src/core/change_detection/parser/ast"),p=t("angular2/src/facade/exceptions"),f=t("angular2/core"),h=t("angular2/src/core/change_detection/parser/parser"),g=function(){function t(t){this.value=t}return t}(),m=function(){function t(){}return t}(),d=function(){function t(){}return t}(),_=function(){function t(t){this.ast=t}return t}(),y=function(){function t(t,e){this.parser=t,this.exp=e,this.index=0}return t.prototype.tokenize=function(){for(var t=[];this.index<this.exp.length;)t.push(this._parseToken());return t},t.prototype._parseToken=function(){var t=this.exp[this.index];return"["==t?(this.index++,new m):"]"==t?(this.index++,new d):"("==t?this._parseParams():"/"==t&&0!==this.index?(this.index++,this._parseFixedPart()):this._parseFixedPart()},t.prototype._parseParams=function(){for(var t=this.index;this.index<this.exp.length;++this.index){var e=this.exp[this.index];if(")"==e){var r=this.exp.substring(t+1,this.index);return this.index++,new _(this.parser.parseBinding("{"+r+"}",null).ast)}}throw new p.BaseException("Cannot find ')'")},t.prototype._parseFixedPart=function(){for(var t=this.index,e=!1;this.index<this.exp.length;++this.index){var r=this.exp[this.index];if("("==r||"["==r||"]"==r||"/"==r&&e)break;"."!=r&&"/"!=r&&(e=!0)}var n=this.exp.substring(t,this.index);if(t===this.index||!e||n.startsWith("//"))throw new p.BaseException("Invalid router link");return new g(n)},t}(),v=function(){function t(t){this.tokens=t,this.index=0}return t.prototype.generate=function(){return this._genAuxiliary()},t.prototype._genAuxiliary=function(){for(var t=[];this.index<this.tokens.length;this.index++){var e=this.tokens[this.index];if(e instanceof g)t.push(new l.LiteralPrimitive(e.value));else if(e instanceof _)t.push(e.ast);else{if(e instanceof d)break;e instanceof m&&(this.index++,t.push(this._genAuxiliary()))}}return new l.LiteralArray(t)},t}(),R=function(t){function e(e){t.call(this),this.parser=e}return i(e,t),e.prototype.visitQuote=function(e){return"route"==e.prefix?n(this.parser,e.uninterpretedExpression):t.prototype.visitQuote.call(this,e)},e}(l.AstTransformer);e.parseRouterLinkExpression=n;var P=function(){function t(t){this.astTransformer=new R(t)}return t.prototype.visitNgContent=function(t,e){return t},t.prototype.visitEmbeddedTemplate=function(t,e){return t},t.prototype.visitElement=function(t,e){var r=this,n=t.children.map(function(t){return t.visit(r,e)}),o=t.inputs.map(function(t){return t.visit(r,e)}),a=t.directives.map(function(t){return t.visit(r,e)});return new c.ElementAst(t.name,t.attrs,o,t.outputs,t.exportAsVars,a,n,t.ngContentIndex,t.sourceSpan)},t.prototype.visitVariable=function(t,e){return t},t.prototype.visitEvent=function(t,e){return t},t.prototype.visitElementProperty=function(t,e){return t},t.prototype.visitAttr=function(t,e){return t},t.prototype.visitBoundText=function(t,e){return t},t.prototype.visitText=function(t,e){return t},t.prototype.visitDirective=function(t,e){var r=this,n=t.inputs.map(function(t){return t.visit(r,e)});return new c.DirectiveAst(t.directive,n,t.hostProperties,t.hostEvents,t.exportAsVars,t.sourceSpan)},t.prototype.visitDirectiveProperty=function(t,e){var r=t.value.visit(this.astTransformer);return new c.BoundDirectivePropertyAst(t.directiveName,t.templateName,r,t.sourceSpan)},t=s([f.Injectable(),u("design:paramtypes",[h.Parser])],t)}();return e.RouterLinkTransform=P,o.define=a,r.exports}),System.register("angular2/router/router_link_dsl",["angular2/compiler","angular2/core","angular2/src/router/router_link_transform","angular2/src/facade/lang","angular2/src/router/router_link_transform"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/compiler"),i=t("angular2/core"),s=t("angular2/src/router/router_link_transform"),u=t("angular2/src/facade/lang"),c=t("angular2/src/router/router_link_transform");return e.RouterLinkTransform=c.RouterLinkTransform,e.ROUTER_LINK_DSL_PROVIDER=u.CONST_EXPR(new i.Provider(a.TEMPLATE_TRANSFORMS,{useClass:s.RouterLinkTransform,multi:!0})),n.define=o,r.exports}),System.register("angular2/src/router/route_config_impl",["angular2/src/facade/lang"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=t("angular2/src/facade/lang"),u=function(){function t(t){this.configs=t}return t=a([s.CONST(),i("design:paramtypes",[Array])],t)}();e.RouteConfig=u;var c=function(){function t(t){var e=t.path,r=t.component,n=t.name,o=t.data,a=t.useAsDefault;this.aux=null,this.loader=null,this.redirectTo=null,this.path=e,this.component=r,this.name=n,this.data=o,this.useAsDefault=a}return t=a([s.CONST(),i("design:paramtypes",[Object])],t)}();e.Route=c;var l=function(){function t(t){var e=t.path,r=t.component,n=t.name;this.data=null,this.aux=null,this.loader=null,this.redirectTo=null,this.useAsDefault=!1,this.path=e,this.component=r,this.name=n}return t=a([s.CONST(),i("design:paramtypes",[Object])],t)}();e.AuxRoute=l;var p=function(){function t(t){var e=t.path,r=t.loader,n=t.name,o=t.data,a=t.useAsDefault;this.aux=null,this.path=e,this.loader=r,this.name=n,this.data=o,this.useAsDefault=a}return t=a([s.CONST(),i("design:paramtypes",[Object])],t)}();e.AsyncRoute=p;var f=function(){function t(t){var e=t.path,r=t.redirectTo;this.name=null,this.loader=null,this.data=null,this.aux=null,this.useAsDefault=!1,this.path=e,this.redirectTo=r}return t=a([s.CONST(),i("design:paramtypes",[Object])],t)}();return e.Redirect=f,n.define=o,r.exports}),System.register("angular2/src/router/instruction",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/async"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("angular2/src/facade/collection"),s=t("angular2/src/facade/lang"),u=t("angular2/src/facade/async"),c=function(){function t(t){this.params=t}return t.prototype.get=function(t){return s.normalizeBlank(i.StringMapWrapper.get(this.params,t))},t}();e.RouteParams=c;var l=function(){function t(t){void 0===t&&(t=s.CONST_EXPR({})),this.data=t}return t.prototype.get=function(t){return s.normalizeBlank(i.StringMapWrapper.get(this.data,t))},t}();e.RouteData=l,e.BLANK_ROUTE_DATA=new l;var p=function(){function t(t,e,r){this.component=t,this.child=e,this.auxInstruction=r}return Object.defineProperty(t.prototype,"urlPath",{get:function(){return s.isPresent(this.component)?this.component.urlPath:""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"urlParams",{get:function(){return s.isPresent(this.component)?this.component.urlParams:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"specificity",{get:function(){var t="";return s.isPresent(this.component)&&(t+=this.component.specificity),s.isPresent(this.child)&&(t+=this.child.specificity),t},enumerable:!0,configurable:!0}),t.prototype.toRootUrl=function(){return this.toUrlPath()+this.toUrlQuery()},t.prototype._toNonRootUrl=function(){return this._stringifyPathMatrixAuxPrefixed()+(s.isPresent(this.child)?this.child._toNonRootUrl():"")},t.prototype.toUrlQuery=function(){return this.urlParams.length>0?"?"+this.urlParams.join("&"):""},t.prototype.replaceChild=function(t){return new f(this.component,t,this.auxInstruction)},t.prototype.toUrlPath=function(){return this.urlPath+this._stringifyAux()+(s.isPresent(this.child)?this.child._toNonRootUrl():"")},t.prototype.toLinkUrl=function(){return this.urlPath+this._stringifyAux()+(s.isPresent(this.child)?this.child._toLinkUrl():"")},t.prototype._toLinkUrl=function(){return this._stringifyPathMatrixAuxPrefixed()+(s.isPresent(this.child)?this.child._toLinkUrl():"")},t.prototype._stringifyPathMatrixAuxPrefixed=function(){var t=this._stringifyPathMatrixAux();return t.length>0&&(t="/"+t),t},t.prototype._stringifyMatrixParams=function(){return this.urlParams.length>0?";"+this.urlParams.join(";"):""},t.prototype._stringifyPathMatrixAux=function(){return s.isBlank(this.component)?"":this.urlPath+this._stringifyMatrixParams()+this._stringifyAux()},t.prototype._stringifyAux=function(){var t=[];return i.StringMapWrapper.forEach(this.auxInstruction,function(e,r){t.push(e._stringifyPathMatrixAux())}),t.length>0?"("+t.join("//")+")":""},t}();e.Instruction=p;var f=function(t){function e(e,r,n){t.call(this,e,r,n)}return a(e,t),e.prototype.resolveComponent=function(){return u.PromiseWrapper.resolve(this.component)},e}(p);e.ResolvedInstruction=f;var h=function(t){function e(e,r){t.call(this,e,r,{})}return a(e,t),e.prototype.resolveComponent=function(){return u.PromiseWrapper.resolve(this.component)},e.prototype.toLinkUrl=function(){return""},e.prototype._toLinkUrl=function(){return""},e}(p);e.DefaultInstruction=h;var g=function(t){function e(e,r,n){void 0===r&&(r=""),void 0===n&&(n=s.CONST_EXPR([])),t.call(this,null,null,{}),this._resolver=e,this._urlPath=r,this._urlParams=n}return a(e,t),Object.defineProperty(e.prototype,"urlPath",{get:function(){return s.isPresent(this.component)?this.component.urlPath:s.isPresent(this._urlPath)?this._urlPath:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"urlParams",{get:function(){return s.isPresent(this.component)?this.component.urlParams:s.isPresent(this._urlParams)?this._urlParams:[]},enumerable:!0,configurable:!0}),e.prototype.resolveComponent=function(){var t=this;return s.isPresent(this.component)?u.PromiseWrapper.resolve(this.component):this._resolver().then(function(e){return t.child=e.child,t.component=e.component})},e}(p);e.UnresolvedInstruction=g;var m=function(t){function e(e,r,n,o){t.call(this,e,r,n),this._specificity=o}return a(e,t),Object.defineProperty(e.prototype,"specificity",{get:function(){return this._specificity},enumerable:!0,configurable:!0}),e}(f);e.RedirectInstruction=m;var d=function(){function t(t,r,n,o,a,i,u){void 0===u&&(u=null),this.urlPath=t,this.urlParams=r,this.componentType=o,this.terminal=a,this.specificity=i,this.params=u,this.reuse=!1,this.routeData=s.isPresent(n)?n:e.BLANK_ROUTE_DATA}return t}();return e.ComponentInstruction=d,n.define=o,r.exports}),System.register("angular2/src/router/url_parser",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/exceptions"],!0,function(t,e,r){function n(t){for(var e=new f(t[t.length-1]),r=t.length-2;r>=0;r-=1)e=new f(t[r],e);return e}function o(t){var e=l.RegExpWrapper.firstMatch(g,t);return l.isPresent(e)?e[0]:""}function a(t){var e=[];return l.isPresent(t)&&c.StringMapWrapper.forEach(t,function(t,r){t===!0?e.push(r):e.push(r+"="+t)}),e}var i=System.global,s=i.define;i.define=void 0;var u=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},c=t("angular2/src/facade/collection"),l=t("angular2/src/facade/lang"),p=t("angular2/src/facade/exceptions"),f=function(){function t(t,e,r,n){void 0===e&&(e=null),void 0===r&&(r=l.CONST_EXPR([])),void 0===n&&(n=null),this.path=t,this.child=e,this.auxiliary=r,this.params=n}return t.prototype.toString=function(){return this.path+this._matrixParamsToString()+this._auxToString()+this._childString()},t.prototype.segmentToString=function(){return this.path+this._matrixParamsToString()},t.prototype._auxToString=function(){return this.auxiliary.length>0?"("+this.auxiliary.map(function(t){return t.toString()}).join("//")+")":""},t.prototype._matrixParamsToString=function(){return l.isBlank(this.params)?"":";"+a(this.params).join(";")},t.prototype._childString=function(){return l.isPresent(this.child)?"/"+this.child.toString():""},t}();e.Url=f;var h=function(t){function e(e,r,n,o){void 0===r&&(r=null),void 0===n&&(n=l.CONST_EXPR([])),void 0===o&&(o=null),t.call(this,e,r,n,o)}return u(e,t),e.prototype.toString=function(){return this.path+this._auxToString()+this._childString()+this._queryParamsToString()},e.prototype.segmentToString=function(){return this.path+this._queryParamsToString()},e.prototype._queryParamsToString=function(){return l.isBlank(this.params)?"":"?"+a(this.params).join("&")},e}(f);e.RootUrl=h,e.pathSegmentsToUrl=n;var g=l.RegExpWrapper.create("^[^\\/\\(\\)\\?;=&#]+"),m=function(){function t(){}return t.prototype.peekStartsWith=function(t){return this._remaining.startsWith(t)},t.prototype.capture=function(t){if(!this._remaining.startsWith(t))throw new p.BaseException('Expected "'+t+'".');this._remaining=this._remaining.substring(t.length)},t.prototype.parse=function(t){return this._remaining=t,""==t||"/"==t?new f(""):this.parseRoot()},t.prototype.parseRoot=function(){this.peekStartsWith("/")&&this.capture("/");var t=o(this._remaining);this.capture(t);var e=[];this.peekStartsWith("(")&&(e=this.parseAuxiliaryRoutes()),this.peekStartsWith(";")&&this.parseMatrixParams();var r=null;this.peekStartsWith("/")&&!this.peekStartsWith("//")&&(this.capture("/"),r=this.parseSegment());var n=null;return this.peekStartsWith("?")&&(n=this.parseQueryParams()),new h(t,r,e,n)},t.prototype.parseSegment=function(){if(0==this._remaining.length)return null;this.peekStartsWith("/")&&this.capture("/");var t=o(this._remaining);this.capture(t);var e=null;this.peekStartsWith(";")&&(e=this.parseMatrixParams());var r=[];this.peekStartsWith("(")&&(r=this.parseAuxiliaryRoutes());var n=null;return this.peekStartsWith("/")&&!this.peekStartsWith("//")&&(this.capture("/"),n=this.parseSegment()),new f(t,n,r,e)},t.prototype.parseQueryParams=function(){var t={};for(this.capture("?"),this.parseParam(t);this._remaining.length>0&&this.peekStartsWith("&");)this.capture("&"),this.parseParam(t);return t},t.prototype.parseMatrixParams=function(){for(var t={};this._remaining.length>0&&this.peekStartsWith(";");)this.capture(";"),this.parseParam(t);return t},t.prototype.parseParam=function(t){var e=o(this._remaining);if(!l.isBlank(e)){this.capture(e);var r=!0;if(this.peekStartsWith("=")){this.capture("=");var n=o(this._remaining);l.isPresent(n)&&(r=n,this.capture(r))}t[e]=r}},t.prototype.parseAuxiliaryRoutes=function(){var t=[];for(this.capture("(");!this.peekStartsWith(")")&&this._remaining.length>0;)t.push(this.parseSegment()),this.peekStartsWith("//")&&this.capture("//");return this.capture(")"),t},t}();return e.UrlParser=m,e.parser=new m,e.serializeParams=a,i.define=s,r.exports}),System.register("angular2/src/router/async_route_handler",["angular2/src/facade/lang","angular2/src/router/instruction"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/src/facade/lang"),i=t("angular2/src/router/instruction"),s=function(){function t(t,e){void 0===e&&(e=null),this._loader=t,this._resolvedComponent=null,this.data=a.isPresent(e)?new i.RouteData(e):i.BLANK_ROUTE_DATA}return t.prototype.resolveComponentType=function(){var t=this;return a.isPresent(this._resolvedComponent)?this._resolvedComponent:this._resolvedComponent=this._loader().then(function(e){return t.componentType=e,e})},t}();return e.AsyncRouteHandler=s,n.define=o,r.exports}),System.register("angular2/src/router/sync_route_handler",["angular2/src/facade/async","angular2/src/facade/lang","angular2/src/router/instruction"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/src/facade/async"),i=t("angular2/src/facade/lang"),s=t("angular2/src/router/instruction"),u=function(){function t(t,e){this.componentType=t,this._resolvedComponent=null,this._resolvedComponent=a.PromiseWrapper.resolve(t),this.data=i.isPresent(e)?new s.RouteData(e):s.BLANK_ROUTE_DATA}return t.prototype.resolveComponentType=function(){return this._resolvedComponent},t}();return e.SyncRouteHandler=u,n.define=o,r.exports}),System.register("angular2/src/router/route_config_decorator",["angular2/src/router/route_config_impl","angular2/src/core/util/decorators","angular2/src/router/route_config_impl"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/src/router/route_config_impl"),i=t("angular2/src/core/util/decorators"),s=t("angular2/src/router/route_config_impl");return e.Route=s.Route,e.Redirect=s.Redirect,e.AuxRoute=s.AuxRoute,e.AsyncRoute=s.AsyncRoute,e.RouteConfig=i.makeDecorator(a.RouteConfig),n.define=o,r.exports}),System.register("angular2/src/router/location_strategy",["angular2/src/facade/lang","angular2/core"],!0,function(t,e,r){function n(t){return t.length>0&&"?"!=t.substring(0,1)?"?"+t:t}function o(t,e){if(0==t.length)return e;if(0==e.length)return t;var r=0;return t.endsWith("/")&&r++,e.startsWith("/")&&r++,2==r?t+e.substring(1):1==r?t+e:t+"/"+e}var a=System.global,i=a.define;a.define=void 0;var s=t("angular2/src/facade/lang"),u=t("angular2/core"),c=function(){function t(){}return t}();return e.LocationStrategy=c,e.APP_BASE_HREF=s.CONST_EXPR(new u.OpaqueToken("appBaseHref")),e.normalizeQueryParams=n,e.joinWithSlash=o,a.define=i,r.exports}),System.register("angular2/src/router/lifecycle_annotations_impl",["angular2/src/facade/lang"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=t("angular2/src/facade/lang"),u=function(){function t(t){this.name=t}return t=a([s.CONST(),i("design:paramtypes",[String])],t)}();e.RouteLifecycleHook=u;var c=function(){function t(t){this.fn=t}return t=a([s.CONST(),i("design:paramtypes",[Function])],t)}();return e.CanActivate=c,e.routerCanReuse=s.CONST_EXPR(new u("routerCanReuse")),e.routerCanDeactivate=s.CONST_EXPR(new u("routerCanDeactivate")),e.routerOnActivate=s.CONST_EXPR(new u("routerOnActivate")),e.routerOnReuse=s.CONST_EXPR(new u("routerOnReuse")),e.routerOnDeactivate=s.CONST_EXPR(new u("routerOnDeactivate")),n.define=o,r.exports}),System.register("angular2/src/router/lifecycle_annotations",["angular2/src/core/util/decorators","angular2/src/router/lifecycle_annotations_impl","angular2/src/router/lifecycle_annotations_impl"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/src/core/util/decorators"),i=t("angular2/src/router/lifecycle_annotations_impl"),s=t("angular2/src/router/lifecycle_annotations_impl");return e.routerCanReuse=s.routerCanReuse,e.routerCanDeactivate=s.routerCanDeactivate,e.routerOnActivate=s.routerOnActivate,e.routerOnReuse=s.routerOnReuse,e.routerOnDeactivate=s.routerOnDeactivate,e.CanActivate=a.makeDecorator(i.CanActivate),n.define=o,r.exports}),System.register("angular2/src/router/router_link",["angular2/core","angular2/src/facade/lang","angular2/src/router/router","angular2/src/router/location"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=t("angular2/core"),u=t("angular2/src/facade/lang"),c=t("angular2/src/router/router"),l=t("angular2/src/router/location"),p=function(){function t(t,e){var r=this;this._router=t,this._location=e,this._router.subscribe(function(t){return r._updateLink()})}return t.prototype._updateLink=function(){this._navigationInstruction=this._router.generate(this._routeParams);var t=this._navigationInstruction.toLinkUrl();this.visibleHref=this._location.prepareExternalUrl(t)},Object.defineProperty(t.prototype,"isRouteActive",{get:function(){return this._router.isRouteActive(this._navigationInstruction)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"routeParams",{set:function(t){this._routeParams=t,this._updateLink()},enumerable:!0,configurable:!0}),t.prototype.onClick=function(){return u.isString(this.target)&&"_self"!=this.target?!0:(this._router.navigateByInstruction(this._navigationInstruction),!1)},t=a([s.Directive({selector:"[routerLink]",inputs:["routeParams: routerLink","target: target"],host:{"(click)":"onClick()","[attr.href]":"visibleHref","[class.router-link-active]":"isRouteActive"}}),i("design:paramtypes",[c.Router,l.Location])],t)}();return e.RouterLink=p,n.define=o,r.exports}),System.register("angular2/src/router/platform_location",[],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=function(){function t(){}return t}();return e.PlatformLocation=a,n.define=o,r.exports}),System.register("angular2/src/router/hash_location_strategy",["angular2/core","angular2/src/router/location_strategy","angular2/src/facade/lang","angular2/src/router/platform_location"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},c=t("angular2/core"),l=t("angular2/src/router/location_strategy"),p=t("angular2/src/facade/lang"),f=t("angular2/src/router/platform_location"),h=function(t){function e(e,r){t.call(this),this._platformLocation=e,this._baseHref="",p.isPresent(r)&&(this._baseHref=r)}return a(e,t),e.prototype.onPopState=function(t){this._platformLocation.onPopState(t),this._platformLocation.onHashChange(t)},e.prototype.getBaseHref=function(){return this._baseHref},e.prototype.path=function(){var t=this._platformLocation.hash;return(t.length>0?t.substring(1):t)+l.normalizeQueryParams(this._platformLocation.search)},e.prototype.prepareExternalUrl=function(t){var e=l.joinWithSlash(this._baseHref,t);return e.length>0?"#"+e:e},e.prototype.pushState=function(t,e,r,n){var o=this.prepareExternalUrl(r+l.normalizeQueryParams(n));0==o.length&&(o=this._platformLocation.pathname),this._platformLocation.pushState(t,e,o)},e.prototype.replaceState=function(t,e,r,n){var o=this.prepareExternalUrl(r+l.normalizeQueryParams(n));0==o.length&&(o=this._platformLocation.pathname),this._platformLocation.replaceState(t,e,o)},e.prototype.forward=function(){this._platformLocation.forward()},e.prototype.back=function(){this._platformLocation.back()},e=i([c.Injectable(),u(1,c.Optional()),u(1,c.Inject(l.APP_BASE_HREF)),s("design:paramtypes",[f.PlatformLocation,String])],e)}(l.LocationStrategy);return e.HashLocationStrategy=h,n.define=o,r.exports}),System.register("angular2/src/router/path_location_strategy",["angular2/core","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/router/location_strategy","angular2/src/router/platform_location"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},c=t("angular2/core"),l=t("angular2/src/facade/lang"),p=t("angular2/src/facade/exceptions"),f=t("angular2/src/router/location_strategy"),h=t("angular2/src/router/platform_location"),g=function(t){function e(e,r){if(t.call(this),this._platformLocation=e,l.isBlank(r)&&(r=this._platformLocation.getBaseHrefFromDOM()),l.isBlank(r))throw new p.BaseException("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");this._baseHref=r}return a(e,t),e.prototype.onPopState=function(t){this._platformLocation.onPopState(t),this._platformLocation.onHashChange(t)},e.prototype.getBaseHref=function(){return this._baseHref},e.prototype.prepareExternalUrl=function(t){return f.joinWithSlash(this._baseHref,t)},e.prototype.path=function(){return this._platformLocation.pathname+f.normalizeQueryParams(this._platformLocation.search)},e.prototype.pushState=function(t,e,r,n){var o=this.prepareExternalUrl(r+f.normalizeQueryParams(n));this._platformLocation.pushState(t,e,o)},e.prototype.replaceState=function(t,e,r,n){var o=this.prepareExternalUrl(r+f.normalizeQueryParams(n));this._platformLocation.replaceState(t,e,o)},e.prototype.forward=function(){this._platformLocation.forward()},e.prototype.back=function(){this._platformLocation.back()},e=i([c.Injectable(),u(1,c.Optional()),u(1,c.Inject(f.APP_BASE_HREF)),s("design:paramtypes",[h.PlatformLocation,String])],e)}(f.LocationStrategy);return e.PathLocationStrategy=g,n.define=o,r.exports}),System.register("angular2/src/router/route_definition",[],!0,function(t,e,r){var n=System.global,o=n.define;return n.define=void 0,n.define=o,r.exports}),System.register("angular2/src/router/router_providers_common",["angular2/src/router/location_strategy","angular2/src/router/path_location_strategy","angular2/src/router/router","angular2/src/router/route_registry","angular2/src/router/location","angular2/src/facade/lang","angular2/core","angular2/src/facade/exceptions"],!0,function(t,e,r){function n(t,e,r,n){var o=new c.RootRouter(t,e,r);return n.registerDisposeListener(function(){return o.dispose()}),o}function o(t){if(0==t.componentTypes.length)throw new g.BaseException("Bootstrap at least one component before injecting Router.");return t.componentTypes[0]}var a=System.global,i=a.define;a.define=void 0;var s=t("angular2/src/router/location_strategy"),u=t("angular2/src/router/path_location_strategy"),c=t("angular2/src/router/router"),l=t("angular2/src/router/route_registry"),p=t("angular2/src/router/location"),f=t("angular2/src/facade/lang"),h=t("angular2/core"),g=t("angular2/src/facade/exceptions");return e.ROUTER_PROVIDERS_COMMON=f.CONST_EXPR([l.RouteRegistry,f.CONST_EXPR(new h.Provider(s.LocationStrategy,{useClass:u.PathLocationStrategy})),p.Location,f.CONST_EXPR(new h.Provider(c.Router,{useFactory:n,deps:f.CONST_EXPR([l.RouteRegistry,p.Location,l.ROUTER_PRIMARY_COMPONENT,h.ApplicationRef])})),f.CONST_EXPR(new h.Provider(l.ROUTER_PRIMARY_COMPONENT,{useFactory:o,deps:f.CONST_EXPR([h.ApplicationRef])}))]),a.define=i,r.exports}),System.register("angular2/src/router/path_recognizer",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/collection","angular2/src/router/url_parser"],!0,function(t,e,r){function n(t){return l.isBlank(t)?null:t.toString()}function o(t){t.startsWith("/")&&(t=t.substring(1));var e=i(t),r=[],n="";0==e.length&&(n+="2");for(var o=e.length-1,a=0;o>=a;a++){var s,u=e[a];if(l.isPresent(s=l.RegExpWrapper.firstMatch(v,u)))r.push(new _(s[1])),n+="1";else if(l.isPresent(s=l.RegExpWrapper.firstMatch(R,u)))r.push(new y(s[1])),n+="0";else if("..."==u){if(o>a)throw new p.BaseException('Unexpected "..." before the end of the path for "'+t+'".');r.push(new m)}else r.push(new d(u)),n+="2"}return{segments:r,specificity:n}}function a(t){return t.map(function(t){return t instanceof y?"*":t instanceof m?"...":t instanceof _?":":t instanceof d?t.path:void 0}).join("/")}function i(t){return t.split("/")}function s(t){if(l.StringWrapper.contains(t,"#"))throw new p.BaseException('Path "'+t+'" should not include "#". Use "HashLocationStrategy" instead.');var e=l.RegExpWrapper.firstMatch(P,t);if(l.isPresent(e))throw new p.BaseException('Path "'+t+'" contains "'+e[0]+'" which is not allowed in a route config.')}var u=System.global,c=u.define;u.define=void 0;var l=t("angular2/src/facade/lang"),p=t("angular2/src/facade/exceptions"),f=t("angular2/src/facade/collection"),h=t("angular2/src/router/url_parser"),g=function(){function t(t){var e=this;this.map={},this.keys={},l.isPresent(t)&&f.StringMapWrapper.forEach(t,function(t,r){e.map[r]=l.isPresent(t)?t.toString():null,e.keys[r]=!0})}return t.prototype.get=function(t){return f.StringMapWrapper["delete"](this.keys,t),this.map[t]},t.prototype.getUnused=function(){var t=this,e={},r=f.StringMapWrapper.keys(this.keys);return r.forEach(function(r){return e[r]=f.StringMapWrapper.get(t.map,r)}),e},t}(),m=function(){function t(){this.name=""}return t.prototype.generate=function(t){return""},t.prototype.match=function(t){return!0},t}(),d=function(){function t(t){this.path=t,this.name=""}return t.prototype.match=function(t){return t==this.path},t.prototype.generate=function(t){return this.path},t}(),_=function(){function t(t){this.name=t}return t.prototype.match=function(t){return t.length>0},t.prototype.generate=function(t){if(!f.StringMapWrapper.contains(t.map,this.name))throw new p.BaseException("Route generator for '"+this.name+"' was not included in parameters passed.");return n(t.get(this.name))},t}(),y=function(){function t(t){this.name=t}return t.prototype.match=function(t){return!0},t.prototype.generate=function(t){return n(t.get(this.name))},t}(),v=/^:([^\/]+)$/g,R=/^\*([^\/]+)$/g,P=l.RegExpWrapper.create("//|\\(|\\)|;|\\?|="),x=function(){function t(t){this.path=t,this.terminal=!0,s(t);var e=o(t);this._segments=e.segments,this.specificity=e.specificity,this.hash=a(this._segments);var r=this._segments[this._segments.length-1];this.terminal=!(r instanceof m);
2
+ }return t.prototype.recognize=function(t){for(var e,r=t,n={},o=[],a=0;a<this._segments.length;a+=1){var i=this._segments[a];if(e=r,i instanceof m)break;if(l.isPresent(e)){if(i instanceof y){n[i.name]=e.toString(),o.push(e.toString()),r=null;break}if(o.push(e.path),i instanceof _)n[i.name]=e.path;else if(!i.match(e.path))return null;r=e.child}else if(!i.match(""))return null}if(this.terminal&&l.isPresent(r))return null;var s,u,c,p=o.join("/");if(l.isPresent(e)){var g=t instanceof h.RootUrl?t:e;c=l.isPresent(g.params)?f.StringMapWrapper.merge(g.params,n):n,u=h.serializeParams(g.params),s=e.auxiliary}else c=n,s=[],u=[];return{urlPath:p,urlParams:u,allParams:c,auxiliary:s,nextSegment:r}},t.prototype.generate=function(t){for(var e=new g(t),r=[],n=0;n<this._segments.length;n++){var o=this._segments[n];o instanceof m||r.push(o.generate(e))}var a=r.join("/"),i=e.getUnused(),s=h.serializeParams(i);return{urlPath:a,urlParams:s}},t}();return e.PathRecognizer=x,u.define=c,r.exports}),System.register("angular2/src/router/component_recognizer",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/collection","angular2/src/facade/async","angular2/src/router/route_recognizer","angular2/src/router/route_config_impl","angular2/src/router/async_route_handler","angular2/src/router/sync_route_handler"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/src/facade/lang"),i=t("angular2/src/facade/exceptions"),s=t("angular2/src/facade/collection"),u=t("angular2/src/facade/async"),c=t("angular2/src/router/route_recognizer"),l=t("angular2/src/router/route_config_impl"),p=t("angular2/src/router/async_route_handler"),f=t("angular2/src/router/sync_route_handler"),h=function(){function t(){this.names=new s.Map,this.auxNames=new s.Map,this.auxRoutes=new s.Map,this.matchers=[],this.defaultRoute=null}return t.prototype.config=function(t){var e;if(a.isPresent(t.name)&&t.name[0].toUpperCase()!=t.name[0]){var r=t.name[0].toUpperCase()+t.name.substring(1);throw new i.BaseException('Route "'+t.path+'" with name "'+t.name+'" does not begin with an uppercase letter. Route names should be CamelCase like "'+r+'".')}if(t instanceof l.AuxRoute){e=new f.SyncRouteHandler(t.component,t.data);var n=t.path.startsWith("/")?t.path.substring(1):t.path,o=new c.RouteRecognizer(t.path,e);return this.auxRoutes.set(n,o),a.isPresent(t.name)&&this.auxNames.set(t.name,o),o.terminal}var s=!1;if(t instanceof l.Redirect){var u=new c.RedirectRecognizer(t.path,t.redirectTo);return this._assertNoHashCollision(u.hash,t.path),this.matchers.push(u),!0}t instanceof l.Route?(e=new f.SyncRouteHandler(t.component,t.data),s=a.isPresent(t.useAsDefault)&&t.useAsDefault):t instanceof l.AsyncRoute&&(e=new p.AsyncRouteHandler(t.loader,t.data),s=a.isPresent(t.useAsDefault)&&t.useAsDefault);var o=new c.RouteRecognizer(t.path,e);if(this._assertNoHashCollision(o.hash,t.path),s){if(a.isPresent(this.defaultRoute))throw new i.BaseException("Only one route can be default");this.defaultRoute=o}return this.matchers.push(o),a.isPresent(t.name)&&this.names.set(t.name,o),o.terminal},t.prototype._assertNoHashCollision=function(t,e){this.matchers.forEach(function(r){if(t==r.hash)throw new i.BaseException("Configuration '"+e+"' conflicts with existing route '"+r.path+"'")})},t.prototype.recognize=function(t){var e=[];return this.matchers.forEach(function(r){var n=r.recognize(t);a.isPresent(n)&&e.push(n)}),0==e.length&&a.isPresent(t)&&t.auxiliary.length>0?[u.PromiseWrapper.resolve(new c.PathMatch(null,null,t.auxiliary))]:e},t.prototype.recognizeAuxiliary=function(t){var e=this.auxRoutes.get(t.path);return a.isPresent(e)?[e.recognize(t)]:[u.PromiseWrapper.resolve(null)]},t.prototype.hasRoute=function(t){return this.names.has(t)},t.prototype.componentLoaded=function(t){return this.hasRoute(t)&&a.isPresent(this.names.get(t).handler.componentType)},t.prototype.loadComponent=function(t){return this.names.get(t).handler.resolveComponentType()},t.prototype.generate=function(t,e){var r=this.names.get(t);return a.isBlank(r)?null:r.generate(e)},t.prototype.generateAuxiliary=function(t,e){var r=this.auxNames.get(t);return a.isBlank(r)?null:r.generate(e)},t}();return e.ComponentRecognizer=h,n.define=o,r.exports}),System.register("angular2/src/router/route_config_nomalizer",["angular2/src/router/route_config_decorator","angular2/src/facade/lang","angular2/src/facade/exceptions"],!0,function(t,e,r){function n(t,e){if(t instanceof u.AsyncRoute){var r=o(t.loader,e);return new u.AsyncRoute({path:t.path,loader:r,name:t.name,data:t.data,useAsDefault:t.useAsDefault})}if(t instanceof u.Route||t instanceof u.Redirect||t instanceof u.AuxRoute)return t;if(+!!t.component+ +!!t.redirectTo+ +!!t.loader!=1)throw new l.BaseException('Route config should contain exactly one "component", "loader", or "redirectTo" property.');if(t.as&&t.name)throw new l.BaseException('Route config should contain exactly one "as" or "name" property.');if(t.as&&(t.name=t.as),t.loader){var r=o(t.loader,e);return new u.AsyncRoute({path:t.path,loader:r,name:t.name,data:t.data,useAsDefault:t.useAsDefault})}if(t.aux)return new u.AuxRoute({path:t.aux,component:t.component,name:t.name});if(t.component){if("object"==typeof t.component){var n=t.component;if("constructor"==n.type)return new u.Route({path:t.path,component:n.constructor,name:t.name,data:t.data,useAsDefault:t.useAsDefault});if("loader"==n.type)return new u.AsyncRoute({path:t.path,loader:n.loader,name:t.name,data:t.data,useAsDefault:t.useAsDefault});throw new l.BaseException('Invalid component type "'+n.type+'". Valid types are "constructor" and "loader".')}return new u.Route(t)}return t.redirectTo?new u.Redirect({path:t.path,redirectTo:t.redirectTo}):t}function o(t,e){return function(){return t().then(function(t){return e.configFromComponent(t),t})}}function a(t,e){if(!c.isType(t))throw new l.BaseException('Component for route "'+e+'" is not defined, or is not a class.')}var i=System.global,s=i.define;i.define=void 0;var u=t("angular2/src/router/route_config_decorator"),c=t("angular2/src/facade/lang"),l=t("angular2/src/facade/exceptions");return e.normalizeRouteConfig=n,e.assertComponentExists=a,i.define=s,r.exports}),System.register("angular2/src/router/location",["angular2/src/router/location_strategy","angular2/src/facade/async","angular2/core"],!0,function(t,e,r){function n(t,e){return t.length>0&&e.startsWith(t)?e.substring(t.length):e}function o(t){return/\/index.html$/g.test(t)?t.substring(0,t.length-11):t}function a(t){return/\/$/g.test(t)&&(t=t.substring(0,t.length-1)),t}var i=System.global,s=i.define;i.define=void 0;var u=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},c=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},l=t("angular2/src/router/location_strategy"),p=t("angular2/src/facade/async"),f=t("angular2/core"),h=function(){function t(t){var e=this;this.platformStrategy=t,this._subject=new p.EventEmitter;var r=this.platformStrategy.getBaseHref();this._baseHref=a(o(r)),this.platformStrategy.onPopState(function(t){p.ObservableWrapper.callEmit(e._subject,{url:e.path(),pop:!0,type:t.type})})}return t.prototype.path=function(){return this.normalize(this.platformStrategy.path())},t.prototype.normalize=function(t){return a(n(this._baseHref,o(t)))},t.prototype.prepareExternalUrl=function(t){return t.length>0&&!t.startsWith("/")&&(t="/"+t),this.platformStrategy.prepareExternalUrl(t)},t.prototype.go=function(t,e){void 0===e&&(e=""),this.platformStrategy.pushState(null,"",t,e)},t.prototype.replaceState=function(t,e){void 0===e&&(e=""),this.platformStrategy.replaceState(null,"",t,e)},t.prototype.forward=function(){this.platformStrategy.forward()},t.prototype.back=function(){this.platformStrategy.back()},t.prototype.subscribe=function(t,e,r){return void 0===e&&(e=null),void 0===r&&(r=null),p.ObservableWrapper.subscribe(this._subject,t,e,r)},t=u([f.Injectable(),c("design:paramtypes",[l.LocationStrategy])],t)}();return e.Location=h,i.define=s,r.exports}),System.register("angular2/src/router/route_lifecycle_reflector",["angular2/src/facade/lang","angular2/src/router/lifecycle_annotations_impl","angular2/src/core/reflection/reflection"],!0,function(t,e,r){function n(t,e){return e instanceof s.Type?t.name in e.prototype:!1}function o(t){for(var e=c.reflector.annotations(t),r=0;r<e.length;r+=1){var n=e[r];if(n instanceof u.CanActivate)return n.fn}return null}var a=System.global,i=a.define;a.define=void 0;var s=t("angular2/src/facade/lang"),u=t("angular2/src/router/lifecycle_annotations_impl"),c=t("angular2/src/core/reflection/reflection");return e.hasLifecycleHook=n,e.getCanActivateHook=o,a.define=i,r.exports}),System.register("angular2/src/router/router_outlet",["angular2/src/facade/async","angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/core","angular2/src/router/router","angular2/src/router/instruction","angular2/src/router/lifecycle_annotations","angular2/src/router/route_lifecycle_reflector"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},u=t("angular2/src/facade/async"),c=t("angular2/src/facade/collection"),l=t("angular2/src/facade/lang"),p=t("angular2/src/facade/exceptions"),f=t("angular2/core"),h=t("angular2/src/router/router"),g=t("angular2/src/router/instruction"),m=t("angular2/src/router/lifecycle_annotations"),d=t("angular2/src/router/route_lifecycle_reflector"),_=u.PromiseWrapper.resolve(!0),y=function(){function t(t,e,r,n){this._elementRef=t,this._loader=e,this._parentRouter=r,this.name=null,this._componentRef=null,this._currentInstruction=null,l.isPresent(n)?(this.name=n,this._parentRouter.registerAuxOutlet(this)):this._parentRouter.registerPrimaryOutlet(this)}return t.prototype.activate=function(t){var e=this,r=this._currentInstruction;this._currentInstruction=t;var n=t.componentType,o=this._parentRouter.childRouter(n),a=f.Injector.resolve([f.provide(g.RouteData,{useValue:t.routeData}),f.provide(g.RouteParams,{useValue:new g.RouteParams(t.params)}),f.provide(h.Router,{useValue:o})]);return this._loader.loadNextToLocation(n,this._elementRef,a).then(function(o){return e._componentRef=o,d.hasLifecycleHook(m.routerOnActivate,n)?e._componentRef.instance.routerOnActivate(t,r):void 0})},t.prototype.reuse=function(t){var e=this._currentInstruction;if(this._currentInstruction=t,l.isBlank(this._componentRef))throw new p.BaseException("Cannot reuse an outlet that does not contain a component.");return u.PromiseWrapper.resolve(d.hasLifecycleHook(m.routerOnReuse,this._currentInstruction.componentType)?this._componentRef.instance.routerOnReuse(t,e):!0)},t.prototype.deactivate=function(t){var e=this,r=_;return l.isPresent(this._componentRef)&&l.isPresent(this._currentInstruction)&&d.hasLifecycleHook(m.routerOnDeactivate,this._currentInstruction.componentType)&&(r=u.PromiseWrapper.resolve(this._componentRef.instance.routerOnDeactivate(t,this._currentInstruction))),r.then(function(t){l.isPresent(e._componentRef)&&(e._componentRef.dispose(),e._componentRef=null)})},t.prototype.routerCanDeactivate=function(t){return l.isBlank(this._currentInstruction)?_:d.hasLifecycleHook(m.routerCanDeactivate,this._currentInstruction.componentType)?u.PromiseWrapper.resolve(this._componentRef.instance.routerCanDeactivate(t,this._currentInstruction)):_},t.prototype.routerCanReuse=function(t){var e;return e=l.isBlank(this._currentInstruction)||this._currentInstruction.componentType!=t.componentType?!1:d.hasLifecycleHook(m.routerCanReuse,this._currentInstruction.componentType)?this._componentRef.instance.routerCanReuse(t,this._currentInstruction):t==this._currentInstruction||l.isPresent(t.params)&&l.isPresent(this._currentInstruction.params)&&c.StringMapWrapper.equals(t.params,this._currentInstruction.params),u.PromiseWrapper.resolve(e)},t=a([f.Directive({selector:"router-outlet"}),s(3,f.Attribute("name")),i("design:paramtypes",[f.ElementRef,f.DynamicComponentLoader,h.Router,String])],t)}();return e.RouterOutlet=y,n.define=o,r.exports}),System.register("angular2/src/router/browser_platform_location",["angular2/core","angular2/src/router/platform_location","angular2/src/platform/dom/dom_adapter"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=t("angular2/core"),c=t("angular2/src/router/platform_location"),l=t("angular2/src/platform/dom/dom_adapter"),p=function(t){function e(){t.call(this),this._init()}return a(e,t),e.prototype._init=function(){this._location=l.DOM.getLocation(),this._history=l.DOM.getHistory()},Object.defineProperty(e.prototype,"location",{get:function(){return this._location},enumerable:!0,configurable:!0}),e.prototype.getBaseHrefFromDOM=function(){return l.DOM.getBaseHref()},e.prototype.onPopState=function(t){l.DOM.getGlobalEventTarget("window").addEventListener("popstate",t,!1)},e.prototype.onHashChange=function(t){l.DOM.getGlobalEventTarget("window").addEventListener("hashchange",t,!1)},Object.defineProperty(e.prototype,"pathname",{get:function(){return this._location.pathname},set:function(t){this._location.pathname=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"search",{get:function(){return this._location.search},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hash",{get:function(){return this._location.hash},enumerable:!0,configurable:!0}),e.prototype.pushState=function(t,e,r){this._history.pushState(t,e,r)},e.prototype.replaceState=function(t,e,r){this._history.replaceState(t,e,r)},e.prototype.forward=function(){this._history.forward()},e.prototype.back=function(){this._history.back()},e=i([u.Injectable(),s("design:paramtypes",[])],e)}(c.PlatformLocation);return e.BrowserPlatformLocation=p,n.define=o,r.exports}),System.register("angular2/src/router/route_recognizer",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/promise","angular2/src/facade/collection","angular2/src/router/instruction","angular2/src/router/path_recognizer"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("angular2/src/facade/lang"),s=t("angular2/src/facade/exceptions"),u=t("angular2/src/facade/promise"),c=t("angular2/src/facade/collection"),l=t("angular2/src/router/instruction"),p=t("angular2/src/router/path_recognizer"),f=function(){function t(){}return t}();e.RouteMatch=f;var h=function(t){function e(e,r,n){t.call(this),this.instruction=e,this.remaining=r,this.remainingAux=n}return a(e,t),e}(f);e.PathMatch=h;var g=function(t){function e(e,r){t.call(this),this.redirectTo=e,this.specificity=r}return a(e,t),e}(f);e.RedirectMatch=g;var m=function(){function t(t,e){this.path=t,this.redirectTo=e,this._pathRecognizer=new p.PathRecognizer(t),this.hash=this._pathRecognizer.hash}return t.prototype.recognize=function(t){var e=null;return i.isPresent(this._pathRecognizer.recognize(t))&&(e=new g(this.redirectTo,this._pathRecognizer.specificity)),u.PromiseWrapper.resolve(e)},t.prototype.generate=function(t){throw new s.BaseException("Tried to generate a redirect.")},t}();e.RedirectRecognizer=m;var d=function(){function t(t,e){this.path=t,this.handler=e,this.terminal=!0,this._cache=new c.Map,this._pathRecognizer=new p.PathRecognizer(t),this.specificity=this._pathRecognizer.specificity,this.hash=this._pathRecognizer.hash,this.terminal=this._pathRecognizer.terminal}return t.prototype.recognize=function(t){var e=this,r=this._pathRecognizer.recognize(t);return i.isBlank(r)?null:this.handler.resolveComponentType().then(function(t){var n=e._getInstruction(r.urlPath,r.urlParams,r.allParams);return new h(n,r.nextSegment,r.auxiliary)})},t.prototype.generate=function(t){var e=this._pathRecognizer.generate(t),r=e.urlPath,n=e.urlParams;return this._getInstruction(r,n,t)},t.prototype.generateComponentPathValues=function(t){return this._pathRecognizer.generate(t)},t.prototype._getInstruction=function(t,e,r){if(i.isBlank(this.handler.componentType))throw new s.BaseException("Tried to get instruction before the type was loaded.");var n=t+"?"+e.join("?");if(this._cache.has(n))return this._cache.get(n);var o=new l.ComponentInstruction(t,e,this.handler.data,this.handler.componentType,this.terminal,this.specificity,r);return this._cache.set(n,o),o},t}();return e.RouteRecognizer=d,n.define=o,r.exports}),System.register("angular2/src/router/router_providers",["angular2/router","angular2/core","angular2/src/facade/lang","angular2/src/router/browser_platform_location","angular2/src/router/platform_location"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var a=t("angular2/router"),i=t("angular2/core"),s=t("angular2/src/facade/lang"),u=t("angular2/src/router/browser_platform_location"),c=t("angular2/src/router/platform_location");return e.ROUTER_PROVIDERS=s.CONST_EXPR([a.ROUTER_PROVIDERS_COMMON,s.CONST_EXPR(new i.Provider(c.PlatformLocation,{useClass:u.BrowserPlatformLocation}))]),e.ROUTER_BINDINGS=e.ROUTER_PROVIDERS,n.define=o,r.exports}),System.register("angular2/src/router/route_registry",["angular2/src/facade/collection","angular2/src/facade/async","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/core/reflection/reflection","angular2/core","angular2/src/router/route_config_impl","angular2/src/router/route_recognizer","angular2/src/router/component_recognizer","angular2/src/router/instruction","angular2/src/router/route_config_nomalizer","angular2/src/router/url_parser"],!0,function(t,e,r){function n(t){return t.reduce(function(t,e){if(g.isString(e)){var r=e;return t.concat(r.split("/"))}return t.push(e),t},[])}function o(t){if(t=t.filter(function(t){return g.isPresent(t)}),0==t.length)return null;if(1==t.length)return t[0];var e=t[0],r=t.slice(1);return r.reduce(function(t,e){return-1==a(e.specificity,t.specificity)?e:t},e)}function a(t,e){for(var r=g.Math.min(t.length,e.length),n=0;r>n;n+=1){var o=g.StringWrapper.charCodeAt(t,n),a=g.StringWrapper.charCodeAt(e,n),i=a-o;if(0!=i)return i}return t.length-e.length}function i(t,e){if(g.isType(t)){var r=d.reflector.annotations(t);if(g.isPresent(r))for(var n=0;n<r.length;n++){var o=r[n];if(o instanceof y.RouteConfig)throw new m.BaseException('Child routes are not allowed for "'+e+'". Use "..." on the parent\'s route path.')}}}var s=System.global,u=s.define;s.define=void 0;var c=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},l=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},p=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},f=t("angular2/src/facade/collection"),h=t("angular2/src/facade/async"),g=t("angular2/src/facade/lang"),m=t("angular2/src/facade/exceptions"),d=t("angular2/src/core/reflection/reflection"),_=t("angular2/core"),y=t("angular2/src/router/route_config_impl"),v=t("angular2/src/router/route_recognizer"),R=t("angular2/src/router/component_recognizer"),P=t("angular2/src/router/instruction"),x=t("angular2/src/router/route_config_nomalizer"),S=t("angular2/src/router/url_parser"),b=h.PromiseWrapper.resolve(null);e.ROUTER_PRIMARY_COMPONENT=g.CONST_EXPR(new _.OpaqueToken("RouterPrimaryComponent"));var O=function(){function t(t){this._rootComponent=t,this._rules=new f.Map}return t.prototype.config=function(t,e){e=x.normalizeRouteConfig(e,this),e instanceof y.Route?x.assertComponentExists(e.component,e.path):e instanceof y.AuxRoute&&x.assertComponentExists(e.component,e.path);var r=this._rules.get(t);g.isBlank(r)&&(r=new R.ComponentRecognizer,this._rules.set(t,r));var n=r.config(e);e instanceof y.Route&&(n?i(e.component,e.path):this.configFromComponent(e.component))},t.prototype.configFromComponent=function(t){var e=this;if(g.isType(t)&&!this._rules.has(t)){var r=d.reflector.annotations(t);if(g.isPresent(r))for(var n=0;n<r.length;n++){var o=r[n];if(o instanceof y.RouteConfig){var a=o.configs;a.forEach(function(r){return e.config(t,r)})}}}},t.prototype.recognize=function(t,e){var r=S.parser.parse(t);return this._recognize(r,[])},t.prototype._recognize=function(t,e,r){var n=this;void 0===r&&(r=!1);var a=f.ListWrapper.last(e),i=g.isPresent(a)?a.component.componentType:this._rootComponent,s=this._rules.get(i);if(g.isBlank(s))return b;var u=r?s.recognizeAuxiliary(t):s.recognize(t),c=u.map(function(t){return t.then(function(t){if(t instanceof v.PathMatch){var r=e.length>0?[f.ListWrapper.last(e)]:[],o=n._auxRoutesToUnresolved(t.remainingAux,r),a=new P.ResolvedInstruction(t.instruction,null,o);if(g.isBlank(t.instruction)||t.instruction.terminal)return a;var i=e.concat([a]);return n._recognize(t.remaining,i).then(function(t){return g.isBlank(t)?null:t instanceof P.RedirectInstruction?t:(a.child=t,a)})}if(t instanceof v.RedirectMatch){var a=n.generate(t.redirectTo,e.concat([null]));return new P.RedirectInstruction(a.component,a.child,a.auxInstruction,t.specificity)}})});return!g.isBlank(t)&&""!=t.path||0!=u.length?h.PromiseWrapper.all(c).then(o):h.PromiseWrapper.resolve(this.generateDefault(i))},t.prototype._auxRoutesToUnresolved=function(t,e){var r=this,n={};return t.forEach(function(t){n[t.path]=new P.UnresolvedInstruction(function(){return r._recognize(t,e,!0)})}),n},t.prototype.generate=function(t,e,r){void 0===r&&(r=!1);var o,a=n(t);if(""==f.ListWrapper.first(a))a.shift(),o=f.ListWrapper.first(e),e=[];else if(o=e.length>0?e.pop():null,"."==f.ListWrapper.first(a))a.shift();else if(".."==f.ListWrapper.first(a))for(;".."==f.ListWrapper.first(a);){if(e.length<=0)throw new m.BaseException('Link "'+f.ListWrapper.toJSON(t)+'" has too many "../" segments.');o=e.pop(),a=f.ListWrapper.slice(a,1)}else{var i=f.ListWrapper.first(a),s=this._rootComponent,u=null;if(e.length>1){var c=e[e.length-1],l=e[e.length-2];s=c.component.componentType,u=l.component.componentType}else 1==e.length&&(s=e[0].component.componentType,u=this._rootComponent);var p=this.hasRoute(i,s),h=g.isPresent(u)&&this.hasRoute(i,u);if(h&&p){var d='Link "'+f.ListWrapper.toJSON(t)+'" is ambiguous, use "./" or "../" to disambiguate.';throw new m.BaseException(d)}h&&(o=e.pop())}if(""==a[a.length-1]&&a.pop(),a.length>0&&""==a[0]&&a.shift(),a.length<1){var d='Link "'+f.ListWrapper.toJSON(t)+'" must include a route name.';throw new m.BaseException(d)}for(var _=this._generate(a,e,o,r,t),y=e.length-1;y>=0;y--){var v=e[y];if(g.isBlank(v))break;_=v.replaceChild(_)}return _},t.prototype._generate=function(t,e,r,n,o){var a=this;void 0===n&&(n=!1);var i=this._rootComponent,s=null,u={},c=f.ListWrapper.last(e);if(g.isPresent(c)&&g.isPresent(c.component)&&(i=c.component.componentType),0==t.length){var l=this.generateDefault(i);if(g.isBlank(l))throw new m.BaseException('Link "'+f.ListWrapper.toJSON(o)+'" does not resolve to a terminal instruction.');return l}g.isPresent(r)&&!n&&(u=f.StringMapWrapper.merge(r.auxInstruction,u),s=r.component);var p=this._rules.get(i);if(g.isBlank(p))throw new m.BaseException('Component "'+g.getTypeNameForDebugging(i)+'" has no route config.');var h=0,d={};if(h<t.length&&g.isString(t[h])){var _=t[h];if(""==_||"."==_||".."==_)throw new m.BaseException('"'+_+'/" is only allowed at the beginning of a link DSL.');if(h+=1,h<t.length){var y=t[h];g.isStringMap(y)&&!g.isArray(y)&&(d=y,h+=1)}var v=(n?p.auxNames:p.names).get(_);if(g.isBlank(v))throw new m.BaseException('Component "'+g.getTypeNameForDebugging(i)+'" has no route named "'+_+'".');if(g.isBlank(v.handler.componentType)){var R=v.generateComponentPathValues(d);return new P.UnresolvedInstruction(function(){return v.handler.resolveComponentType().then(function(i){return a._generate(t,e,r,n,o)})},R.urlPath,R.urlParams)}s=n?p.generateAuxiliary(_,d):p.generate(_,d)}for(;h<t.length&&g.isArray(t[h]);){var x=[c],S=this._generate(t[h],x,null,!0,o);u[S.component.urlPath]=S,h+=1}var b=new P.ResolvedInstruction(s,null,u);if(g.isPresent(s)&&g.isPresent(s.componentType)){var O=null;if(s.terminal)h>=t.length;else{var w=e.concat([b]),E=t.slice(h);O=this._generate(E,w,null,!1,o)}b.child=O}return b},t.prototype.hasRoute=function(t,e){var r=this._rules.get(e);return g.isBlank(r)?!1:r.hasRoute(t)},t.prototype.generateDefault=function(t){var e=this;if(g.isBlank(t))return null;var r=this._rules.get(t);if(g.isBlank(r)||g.isBlank(r.defaultRoute))return null;var n=null;if(g.isPresent(r.defaultRoute.handler.componentType)){var o=r.defaultRoute.generate({});return r.defaultRoute.terminal||(n=this.generateDefault(r.defaultRoute.handler.componentType)),new P.DefaultInstruction(o,n)}return new P.UnresolvedInstruction(function(){return r.defaultRoute.handler.resolveComponentType().then(function(r){return e.generateDefault(t)})})},t=c([_.Injectable(),p(0,_.Inject(e.ROUTER_PRIMARY_COMPONENT)),l("design:paramtypes",[g.Type])],t)}();return e.RouteRegistry=O,s.define=u,r.exports}),System.register("angular2/src/router/router",["angular2/src/facade/async","angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/core","angular2/src/router/route_registry","angular2/src/router/location","angular2/src/router/route_lifecycle_reflector"],!0,function(t,e,r){function n(t,e){var r=y;return f.isBlank(t.component)?r:(f.isPresent(t.child)&&(r=n(t.child,f.isPresent(e)?e.child:null)),r.then(function(r){if(0==r)return!1;if(t.component.reuse)return!0;var n=_.getCanActivateHook(t.component.componentType);return f.isPresent(n)?n(t.component,f.isPresent(e)?e.component:null):!0}))}var o=System.global,a=o.define;o.define=void 0;var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},s=this&&this.__decorate||function(t,e,r,n){var o,a=arguments.length,i=3>a?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(3>a?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},u=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},c=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},l=t("angular2/src/facade/async"),p=t("angular2/src/facade/collection"),f=t("angular2/src/facade/lang"),h=t("angular2/src/facade/exceptions"),g=t("angular2/core"),m=t("angular2/src/router/route_registry"),d=t("angular2/src/router/location"),_=t("angular2/src/router/route_lifecycle_reflector"),y=l.PromiseWrapper.resolve(!0),v=l.PromiseWrapper.resolve(!1),R=function(){function t(t,e,r){this.registry=t,this.parent=e,this.hostComponent=r,this.navigating=!1,this._currentInstruction=null,this._currentNavigation=y,this._outlet=null,this._auxRouters=new p.Map,this._subject=new l.EventEmitter}return t.prototype.childRouter=function(t){return this._childRouter=new x(this,t)},t.prototype.auxRouter=function(t){return new x(this,t)},t.prototype.registerPrimaryOutlet=function(t){if(f.isPresent(t.name))throw new h.BaseException("registerPrimaryOutlet expects to be called with an unnamed outlet.");return this._outlet=t,f.isPresent(this._currentInstruction)?this.commit(this._currentInstruction,!1):y},t.prototype.registerAuxOutlet=function(t){var e=t.name;if(f.isBlank(e))throw new h.BaseException("registerAuxOutlet expects to be called with an outlet with a name.");var r=this.auxRouter(this.hostComponent);this._auxRouters.set(e,r),r._outlet=t;var n;return f.isPresent(this._currentInstruction)&&f.isPresent(n=this._currentInstruction.auxInstruction[e])?r.commit(n):y},t.prototype.isRouteActive=function(t){for(var e=this;f.isPresent(e.parent)&&f.isPresent(t.child);)e=e.parent,t=t.child;return f.isPresent(this._currentInstruction)&&this._currentInstruction.component==t.component},t.prototype.config=function(t){var e=this;return t.forEach(function(t){e.registry.config(e.hostComponent,t)}),this.renavigate()},t.prototype.navigate=function(t){var e=this.generate(t);return this.navigateByInstruction(e,!1)},t.prototype.navigateByUrl=function(t,e){var r=this;return void 0===e&&(e=!1),this._currentNavigation=this._currentNavigation.then(function(n){return r.lastNavigationAttempt=t,r._startNavigating(),r._afterPromiseFinishNavigating(r.recognize(t).then(function(t){return f.isBlank(t)?!1:r._navigate(t,e)}))})},t.prototype.navigateByInstruction=function(t,e){var r=this;return void 0===e&&(e=!1),f.isBlank(t)?v:this._currentNavigation=this._currentNavigation.then(function(n){return r._startNavigating(),r._afterPromiseFinishNavigating(r._navigate(t,e))})},t.prototype._navigate=function(t,e){var r=this;return this._settleInstruction(t).then(function(e){return r._routerCanReuse(t)}).then(function(e){return r._canActivate(t)}).then(function(n){return n?r._routerCanDeactivate(t).then(function(n){return n?r.commit(t,e).then(function(e){return r._emitNavigationFinish(t.toRootUrl()),!0}):void 0}):!1})},t.prototype._settleInstruction=function(t){var e=this;return t.resolveComponent().then(function(r){var n=[];return f.isPresent(t.component)&&(t.component.reuse=!1),f.isPresent(t.child)&&n.push(e._settleInstruction(t.child)),p.StringMapWrapper.forEach(t.auxInstruction,function(t,r){n.push(e._settleInstruction(t))}),l.PromiseWrapper.all(n)})},t.prototype._emitNavigationFinish=function(t){l.ObservableWrapper.callEmit(this._subject,t)},t.prototype._afterPromiseFinishNavigating=function(t){var e=this;return l.PromiseWrapper.catchError(t.then(function(t){return e._finishNavigating()}),function(t){throw e._finishNavigating(),t})},t.prototype._routerCanReuse=function(t){var e=this;return f.isBlank(this._outlet)?v:f.isBlank(t.component)?y:this._outlet.routerCanReuse(t.component).then(function(r){return t.component.reuse=r,r&&f.isPresent(e._childRouter)&&f.isPresent(t.child)?e._childRouter._routerCanReuse(t.child):void 0})},t.prototype._canActivate=function(t){return n(t,this._currentInstruction)},t.prototype._routerCanDeactivate=function(t){var e=this;if(f.isBlank(this._outlet))return y;var r,n=null,o=!1,a=null;return f.isPresent(t)&&(n=t.child,
3
+ a=t.component,o=f.isBlank(t.component)||t.component.reuse),r=o?y:this._outlet.routerCanDeactivate(a),r.then(function(t){return 0==t?!1:f.isPresent(e._childRouter)?e._childRouter._routerCanDeactivate(n):!0})},t.prototype.commit=function(t,e){var r=this;void 0===e&&(e=!1),this._currentInstruction=t;var n=y;if(f.isPresent(this._outlet)&&f.isPresent(t.component)){var o=t.component;n=o.reuse?this._outlet.reuse(o):this.deactivate(t).then(function(t){return r._outlet.activate(o)}),f.isPresent(t.child)&&(n=n.then(function(e){return f.isPresent(r._childRouter)?r._childRouter.commit(t.child):void 0}))}var a=[];return this._auxRouters.forEach(function(e,r){f.isPresent(t.auxInstruction[r])&&a.push(e.commit(t.auxInstruction[r]))}),n.then(function(t){return l.PromiseWrapper.all(a)})},t.prototype._startNavigating=function(){this.navigating=!0},t.prototype._finishNavigating=function(){this.navigating=!1},t.prototype.subscribe=function(t){return l.ObservableWrapper.subscribe(this._subject,t)},t.prototype.deactivate=function(t){var e=this,r=null,n=null;f.isPresent(t)&&(r=t.child,n=t.component);var o=y;return f.isPresent(this._childRouter)&&(o=this._childRouter.deactivate(r)),f.isPresent(this._outlet)&&(o=o.then(function(t){return e._outlet.deactivate(n)})),o},t.prototype.recognize=function(t){var e=this._getAncestorInstructions();return this.registry.recognize(t,e)},t.prototype._getAncestorInstructions=function(){for(var t=[this._currentInstruction],e=this;f.isPresent(e=e.parent);)t.unshift(e._currentInstruction);return t},t.prototype.renavigate=function(){return f.isBlank(this.lastNavigationAttempt)?this._currentNavigation:this.navigateByUrl(this.lastNavigationAttempt)},t.prototype.generate=function(t){var e=this._getAncestorInstructions();return this.registry.generate(t,e)},t}();e.Router=R;var P=function(t){function e(e,r,n){var o=this;t.call(this,e,null,n),this._location=r,this._locationSub=this._location.subscribe(function(t){o.recognize(t.url).then(function(e){o.navigateByInstruction(e,f.isPresent(t.pop)).then(function(r){if(!f.isPresent(t.pop)||"hashchange"==t.type){var n=e.toUrlPath(),a=e.toUrlQuery();n.length>0&&"/"!=n[0]&&(n="/"+n),"hashchange"==t.type?e.toRootUrl()!=o._location.path()&&o._location.replaceState(n,a):o._location.go(n,a)}})})}),this.registry.configFromComponent(n),this.navigateByUrl(r.path())}return i(e,t),e.prototype.commit=function(e,r){var n=this;void 0===r&&(r=!1);var o=e.toUrlPath(),a=e.toUrlQuery();o.length>0&&"/"!=o[0]&&(o="/"+o);var i=t.prototype.commit.call(this,e);return r||(i=i.then(function(t){n._location.go(o,a)})),i},e.prototype.dispose=function(){f.isPresent(this._locationSub)&&(l.ObservableWrapper.dispose(this._locationSub),this._locationSub=null)},e=s([g.Injectable(),c(2,g.Inject(m.ROUTER_PRIMARY_COMPONENT)),u("design:paramtypes",[m.RouteRegistry,d.Location,f.Type])],e)}(R);e.RootRouter=P;var x=function(t){function e(e,r){t.call(this,e.registry,e,r),this.parent=e}return i(e,t),e.prototype.navigateByUrl=function(t,e){return void 0===e&&(e=!1),this.parent.navigateByUrl(t,e)},e.prototype.navigateByInstruction=function(t,e){return void 0===e&&(e=!1),this.parent.navigateByInstruction(t,e)},e}(R);return o.define=a,r.exports}),System.register("angular2/router",["angular2/src/router/router","angular2/src/router/router_outlet","angular2/src/router/router_link","angular2/src/router/instruction","angular2/src/router/platform_location","angular2/src/router/route_registry","angular2/src/router/location_strategy","angular2/src/router/hash_location_strategy","angular2/src/router/path_location_strategy","angular2/src/router/location","angular2/src/router/route_config_decorator","angular2/src/router/route_definition","angular2/src/router/lifecycle_annotations","angular2/src/router/instruction","angular2/core","angular2/src/router/router_providers_common","angular2/src/router/router_providers","angular2/src/router/router_outlet","angular2/src/router/router_link","angular2/src/facade/lang"],!0,function(t,e,r){function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}var o=System.global,a=o.define;o.define=void 0;var i=t("angular2/src/router/router");e.Router=i.Router;var s=t("angular2/src/router/router_outlet");e.RouterOutlet=s.RouterOutlet;var u=t("angular2/src/router/router_link");e.RouterLink=u.RouterLink;var c=t("angular2/src/router/instruction");e.RouteParams=c.RouteParams,e.RouteData=c.RouteData;var l=t("angular2/src/router/platform_location");e.PlatformLocation=l.PlatformLocation;var p=t("angular2/src/router/route_registry");e.RouteRegistry=p.RouteRegistry,e.ROUTER_PRIMARY_COMPONENT=p.ROUTER_PRIMARY_COMPONENT;var f=t("angular2/src/router/location_strategy");e.LocationStrategy=f.LocationStrategy,e.APP_BASE_HREF=f.APP_BASE_HREF;var h=t("angular2/src/router/hash_location_strategy");e.HashLocationStrategy=h.HashLocationStrategy;var g=t("angular2/src/router/path_location_strategy");e.PathLocationStrategy=g.PathLocationStrategy;var m=t("angular2/src/router/location");e.Location=m.Location,n(t("angular2/src/router/route_config_decorator")),n(t("angular2/src/router/route_definition"));var d=t("angular2/src/router/lifecycle_annotations");e.CanActivate=d.CanActivate;var _=t("angular2/src/router/instruction");e.Instruction=_.Instruction,e.ComponentInstruction=_.ComponentInstruction;var y=t("angular2/core");e.OpaqueToken=y.OpaqueToken;var v=t("angular2/src/router/router_providers_common");e.ROUTER_PROVIDERS_COMMON=v.ROUTER_PROVIDERS_COMMON;var R=t("angular2/src/router/router_providers");e.ROUTER_PROVIDERS=R.ROUTER_PROVIDERS,e.ROUTER_BINDINGS=R.ROUTER_BINDINGS;var P=t("angular2/src/router/router_outlet"),x=t("angular2/src/router/router_link"),S=t("angular2/src/facade/lang");return e.ROUTER_DIRECTIVES=S.CONST_EXPR([P.RouterOutlet,x.RouterLink]),o.define=a,r.exports});
@@ -0,0 +1,2105 @@
1
+ "format register";
2
+ System.register("angular2/src/mock/animation_builder_mock", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/animate/css_animation_builder", "angular2/src/animate/animation", "angular2/src/animate/browser_details"], true, function(require, exports, module) {
3
+ var global = System.global,
4
+ __define = global.define;
5
+ global.define = undefined;
6
+ var __extends = (this && this.__extends) || function(d, b) {
7
+ for (var p in b)
8
+ if (b.hasOwnProperty(p))
9
+ d[p] = b[p];
10
+ function __() {
11
+ this.constructor = d;
12
+ }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
16
+ var c = arguments.length,
17
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
18
+ d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
20
+ r = Reflect.decorate(decorators, target, key, desc);
21
+ else
22
+ for (var i = decorators.length - 1; i >= 0; i--)
23
+ if (d = decorators[i])
24
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
26
+ };
27
+ var __metadata = (this && this.__metadata) || function(k, v) {
28
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
29
+ return Reflect.metadata(k, v);
30
+ };
31
+ var di_1 = require("angular2/src/core/di");
32
+ var animation_builder_1 = require("angular2/src/animate/animation_builder");
33
+ var css_animation_builder_1 = require("angular2/src/animate/css_animation_builder");
34
+ var animation_1 = require("angular2/src/animate/animation");
35
+ var browser_details_1 = require("angular2/src/animate/browser_details");
36
+ var MockAnimationBuilder = (function(_super) {
37
+ __extends(MockAnimationBuilder, _super);
38
+ function MockAnimationBuilder() {
39
+ _super.call(this, null);
40
+ }
41
+ MockAnimationBuilder.prototype.css = function() {
42
+ return new MockCssAnimationBuilder();
43
+ };
44
+ MockAnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockAnimationBuilder);
45
+ return MockAnimationBuilder;
46
+ })(animation_builder_1.AnimationBuilder);
47
+ exports.MockAnimationBuilder = MockAnimationBuilder;
48
+ var MockCssAnimationBuilder = (function(_super) {
49
+ __extends(MockCssAnimationBuilder, _super);
50
+ function MockCssAnimationBuilder() {
51
+ _super.call(this, null);
52
+ }
53
+ MockCssAnimationBuilder.prototype.start = function(element) {
54
+ return new MockAnimation(element, this.data);
55
+ };
56
+ return MockCssAnimationBuilder;
57
+ })(css_animation_builder_1.CssAnimationBuilder);
58
+ var MockBrowserAbstraction = (function(_super) {
59
+ __extends(MockBrowserAbstraction, _super);
60
+ function MockBrowserAbstraction() {
61
+ _super.apply(this, arguments);
62
+ }
63
+ MockBrowserAbstraction.prototype.doesElapsedTimeIncludesDelay = function() {
64
+ this.elapsedTimeIncludesDelay = false;
65
+ };
66
+ return MockBrowserAbstraction;
67
+ })(browser_details_1.BrowserDetails);
68
+ var MockAnimation = (function(_super) {
69
+ __extends(MockAnimation, _super);
70
+ function MockAnimation(element, data) {
71
+ _super.call(this, element, data, new MockBrowserAbstraction());
72
+ }
73
+ MockAnimation.prototype.wait = function(callback) {
74
+ this._callback = callback;
75
+ };
76
+ MockAnimation.prototype.flush = function() {
77
+ this._callback(0);
78
+ this._callback = null;
79
+ };
80
+ return MockAnimation;
81
+ })(animation_1.Animation);
82
+ global.define = __define;
83
+ return module.exports;
84
+ });
85
+
86
+ System.register("angular2/src/mock/directive_resolver_mock", ["angular2/src/core/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/metadata", "angular2/src/core/linker/directive_resolver"], true, function(require, exports, module) {
87
+ var global = System.global,
88
+ __define = global.define;
89
+ global.define = undefined;
90
+ var __extends = (this && this.__extends) || function(d, b) {
91
+ for (var p in b)
92
+ if (b.hasOwnProperty(p))
93
+ d[p] = b[p];
94
+ function __() {
95
+ this.constructor = d;
96
+ }
97
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
98
+ };
99
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
100
+ var c = arguments.length,
101
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
102
+ d;
103
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
104
+ r = Reflect.decorate(decorators, target, key, desc);
105
+ else
106
+ for (var i = decorators.length - 1; i >= 0; i--)
107
+ if (d = decorators[i])
108
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
109
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
110
+ };
111
+ var __metadata = (this && this.__metadata) || function(k, v) {
112
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
113
+ return Reflect.metadata(k, v);
114
+ };
115
+ var di_1 = require("angular2/src/core/di");
116
+ var collection_1 = require("angular2/src/facade/collection");
117
+ var lang_1 = require("angular2/src/facade/lang");
118
+ var metadata_1 = require("angular2/src/core/metadata");
119
+ var directive_resolver_1 = require("angular2/src/core/linker/directive_resolver");
120
+ var MockDirectiveResolver = (function(_super) {
121
+ __extends(MockDirectiveResolver, _super);
122
+ function MockDirectiveResolver() {
123
+ _super.apply(this, arguments);
124
+ this._providerOverrides = new collection_1.Map();
125
+ this.viewProviderOverrides = new collection_1.Map();
126
+ }
127
+ MockDirectiveResolver.prototype.resolve = function(type) {
128
+ var dm = _super.prototype.resolve.call(this, type);
129
+ var providerOverrides = this._providerOverrides.get(type);
130
+ var viewProviderOverrides = this.viewProviderOverrides.get(type);
131
+ var providers = dm.providers;
132
+ if (lang_1.isPresent(providerOverrides)) {
133
+ providers = dm.providers.concat(providerOverrides);
134
+ }
135
+ if (dm instanceof metadata_1.ComponentMetadata) {
136
+ var viewProviders = dm.viewProviders;
137
+ if (lang_1.isPresent(viewProviderOverrides)) {
138
+ viewProviders = dm.viewProviders.concat(viewProviderOverrides);
139
+ }
140
+ return new metadata_1.ComponentMetadata({
141
+ selector: dm.selector,
142
+ inputs: dm.inputs,
143
+ outputs: dm.outputs,
144
+ host: dm.host,
145
+ exportAs: dm.exportAs,
146
+ moduleId: dm.moduleId,
147
+ queries: dm.queries,
148
+ changeDetection: dm.changeDetection,
149
+ providers: providers,
150
+ viewProviders: viewProviders
151
+ });
152
+ }
153
+ return new metadata_1.DirectiveMetadata({
154
+ selector: dm.selector,
155
+ inputs: dm.inputs,
156
+ outputs: dm.outputs,
157
+ host: dm.host,
158
+ providers: providers,
159
+ exportAs: dm.exportAs,
160
+ queries: dm.queries
161
+ });
162
+ };
163
+ MockDirectiveResolver.prototype.setBindingsOverride = function(type, bindings) {
164
+ this._providerOverrides.set(type, bindings);
165
+ };
166
+ MockDirectiveResolver.prototype.setViewBindingsOverride = function(type, viewBindings) {
167
+ this.viewProviderOverrides.set(type, viewBindings);
168
+ };
169
+ MockDirectiveResolver.prototype.setProvidersOverride = function(type, providers) {
170
+ this._providerOverrides.set(type, providers);
171
+ };
172
+ MockDirectiveResolver.prototype.setViewProvidersOverride = function(type, viewProviders) {
173
+ this.viewProviderOverrides.set(type, viewProviders);
174
+ };
175
+ MockDirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockDirectiveResolver);
176
+ return MockDirectiveResolver;
177
+ })(directive_resolver_1.DirectiveResolver);
178
+ exports.MockDirectiveResolver = MockDirectiveResolver;
179
+ global.define = __define;
180
+ return module.exports;
181
+ });
182
+
183
+ System.register("angular2/src/mock/view_resolver_mock", ["angular2/src/core/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/linker/view_resolver"], true, function(require, exports, module) {
184
+ var global = System.global,
185
+ __define = global.define;
186
+ global.define = undefined;
187
+ var __extends = (this && this.__extends) || function(d, b) {
188
+ for (var p in b)
189
+ if (b.hasOwnProperty(p))
190
+ d[p] = b[p];
191
+ function __() {
192
+ this.constructor = d;
193
+ }
194
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
195
+ };
196
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
197
+ var c = arguments.length,
198
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
199
+ d;
200
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
201
+ r = Reflect.decorate(decorators, target, key, desc);
202
+ else
203
+ for (var i = decorators.length - 1; i >= 0; i--)
204
+ if (d = decorators[i])
205
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
206
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
207
+ };
208
+ var __metadata = (this && this.__metadata) || function(k, v) {
209
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
210
+ return Reflect.metadata(k, v);
211
+ };
212
+ var di_1 = require("angular2/src/core/di");
213
+ var collection_1 = require("angular2/src/facade/collection");
214
+ var lang_1 = require("angular2/src/facade/lang");
215
+ var exceptions_1 = require("angular2/src/facade/exceptions");
216
+ var metadata_1 = require("angular2/src/core/metadata");
217
+ var view_resolver_1 = require("angular2/src/core/linker/view_resolver");
218
+ var MockViewResolver = (function(_super) {
219
+ __extends(MockViewResolver, _super);
220
+ function MockViewResolver() {
221
+ _super.call(this);
222
+ this._views = new collection_1.Map();
223
+ this._inlineTemplates = new collection_1.Map();
224
+ this._viewCache = new collection_1.Map();
225
+ this._directiveOverrides = new collection_1.Map();
226
+ }
227
+ MockViewResolver.prototype.setView = function(component, view) {
228
+ this._checkOverrideable(component);
229
+ this._views.set(component, view);
230
+ };
231
+ MockViewResolver.prototype.setInlineTemplate = function(component, template) {
232
+ this._checkOverrideable(component);
233
+ this._inlineTemplates.set(component, template);
234
+ };
235
+ MockViewResolver.prototype.overrideViewDirective = function(component, from, to) {
236
+ this._checkOverrideable(component);
237
+ var overrides = this._directiveOverrides.get(component);
238
+ if (lang_1.isBlank(overrides)) {
239
+ overrides = new collection_1.Map();
240
+ this._directiveOverrides.set(component, overrides);
241
+ }
242
+ overrides.set(from, to);
243
+ };
244
+ MockViewResolver.prototype.resolve = function(component) {
245
+ var view = this._viewCache.get(component);
246
+ if (lang_1.isPresent(view))
247
+ return view;
248
+ view = this._views.get(component);
249
+ if (lang_1.isBlank(view)) {
250
+ view = _super.prototype.resolve.call(this, component);
251
+ }
252
+ var directives = view.directives;
253
+ var overrides = this._directiveOverrides.get(component);
254
+ if (lang_1.isPresent(overrides) && lang_1.isPresent(directives)) {
255
+ directives = collection_1.ListWrapper.clone(view.directives);
256
+ overrides.forEach(function(to, from) {
257
+ var srcIndex = directives.indexOf(from);
258
+ if (srcIndex == -1) {
259
+ throw new exceptions_1.BaseException("Overriden directive " + lang_1.stringify(from) + " not found in the template of " + lang_1.stringify(component));
260
+ }
261
+ directives[srcIndex] = to;
262
+ });
263
+ view = new metadata_1.ViewMetadata({
264
+ template: view.template,
265
+ templateUrl: view.templateUrl,
266
+ directives: directives
267
+ });
268
+ }
269
+ var inlineTemplate = this._inlineTemplates.get(component);
270
+ if (lang_1.isPresent(inlineTemplate)) {
271
+ view = new metadata_1.ViewMetadata({
272
+ template: inlineTemplate,
273
+ templateUrl: null,
274
+ directives: view.directives
275
+ });
276
+ }
277
+ this._viewCache.set(component, view);
278
+ return view;
279
+ };
280
+ MockViewResolver.prototype._checkOverrideable = function(component) {
281
+ var cached = this._viewCache.get(component);
282
+ if (lang_1.isPresent(cached)) {
283
+ throw new exceptions_1.BaseException("The component " + lang_1.stringify(component) + " has already been compiled, its configuration can not be changed");
284
+ }
285
+ };
286
+ MockViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockViewResolver);
287
+ return MockViewResolver;
288
+ })(view_resolver_1.ViewResolver);
289
+ exports.MockViewResolver = MockViewResolver;
290
+ global.define = __define;
291
+ return module.exports;
292
+ });
293
+
294
+ System.register("angular2/src/router/location_strategy", ["angular2/src/facade/lang", "angular2/core"], true, function(require, exports, module) {
295
+ var global = System.global,
296
+ __define = global.define;
297
+ global.define = undefined;
298
+ var lang_1 = require("angular2/src/facade/lang");
299
+ var core_1 = require("angular2/core");
300
+ var LocationStrategy = (function() {
301
+ function LocationStrategy() {}
302
+ return LocationStrategy;
303
+ })();
304
+ exports.LocationStrategy = LocationStrategy;
305
+ exports.APP_BASE_HREF = lang_1.CONST_EXPR(new core_1.OpaqueToken('appBaseHref'));
306
+ function normalizeQueryParams(params) {
307
+ return (params.length > 0 && params.substring(0, 1) != '?') ? ('?' + params) : params;
308
+ }
309
+ exports.normalizeQueryParams = normalizeQueryParams;
310
+ function joinWithSlash(start, end) {
311
+ if (start.length == 0) {
312
+ return end;
313
+ }
314
+ if (end.length == 0) {
315
+ return start;
316
+ }
317
+ var slashes = 0;
318
+ if (start.endsWith('/')) {
319
+ slashes++;
320
+ }
321
+ if (end.startsWith('/')) {
322
+ slashes++;
323
+ }
324
+ if (slashes == 2) {
325
+ return start + end.substring(1);
326
+ }
327
+ if (slashes == 1) {
328
+ return start + end;
329
+ }
330
+ return start + '/' + end;
331
+ }
332
+ exports.joinWithSlash = joinWithSlash;
333
+ global.define = __define;
334
+ return module.exports;
335
+ });
336
+
337
+ System.register("angular2/src/mock/ng_zone_mock", ["angular2/src/core/di", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], true, function(require, exports, module) {
338
+ var global = System.global,
339
+ __define = global.define;
340
+ global.define = undefined;
341
+ var __extends = (this && this.__extends) || function(d, b) {
342
+ for (var p in b)
343
+ if (b.hasOwnProperty(p))
344
+ d[p] = b[p];
345
+ function __() {
346
+ this.constructor = d;
347
+ }
348
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
349
+ };
350
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
351
+ var c = arguments.length,
352
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
353
+ d;
354
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
355
+ r = Reflect.decorate(decorators, target, key, desc);
356
+ else
357
+ for (var i = decorators.length - 1; i >= 0; i--)
358
+ if (d = decorators[i])
359
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
360
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
361
+ };
362
+ var __metadata = (this && this.__metadata) || function(k, v) {
363
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
364
+ return Reflect.metadata(k, v);
365
+ };
366
+ var di_1 = require("angular2/src/core/di");
367
+ var ng_zone_1 = require("angular2/src/core/zone/ng_zone");
368
+ var async_1 = require("angular2/src/facade/async");
369
+ var MockNgZone = (function(_super) {
370
+ __extends(MockNgZone, _super);
371
+ function MockNgZone() {
372
+ _super.call(this, {enableLongStackTrace: false});
373
+ this._mockOnEventDone = new async_1.EventEmitter(false);
374
+ }
375
+ Object.defineProperty(MockNgZone.prototype, "onEventDone", {
376
+ get: function() {
377
+ return this._mockOnEventDone;
378
+ },
379
+ enumerable: true,
380
+ configurable: true
381
+ });
382
+ MockNgZone.prototype.run = function(fn) {
383
+ return fn();
384
+ };
385
+ MockNgZone.prototype.runOutsideAngular = function(fn) {
386
+ return fn();
387
+ };
388
+ MockNgZone.prototype.simulateZoneExit = function() {
389
+ async_1.ObservableWrapper.callNext(this.onEventDone, null);
390
+ };
391
+ MockNgZone = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockNgZone);
392
+ return MockNgZone;
393
+ })(ng_zone_1.NgZone);
394
+ exports.MockNgZone = MockNgZone;
395
+ global.define = __define;
396
+ return module.exports;
397
+ });
398
+
399
+ System.register("angular2/src/testing/utils", ["angular2/core", "angular2/src/facade/collection", "angular2/src/platform/dom/dom_adapter", "angular2/src/facade/lang"], true, function(require, exports, module) {
400
+ var global = System.global,
401
+ __define = global.define;
402
+ global.define = undefined;
403
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
404
+ var c = arguments.length,
405
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
406
+ d;
407
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
408
+ r = Reflect.decorate(decorators, target, key, desc);
409
+ else
410
+ for (var i = decorators.length - 1; i >= 0; i--)
411
+ if (d = decorators[i])
412
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
413
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
414
+ };
415
+ var __metadata = (this && this.__metadata) || function(k, v) {
416
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
417
+ return Reflect.metadata(k, v);
418
+ };
419
+ var core_1 = require("angular2/core");
420
+ var collection_1 = require("angular2/src/facade/collection");
421
+ var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter");
422
+ var lang_1 = require("angular2/src/facade/lang");
423
+ var Log = (function() {
424
+ function Log() {
425
+ this._result = [];
426
+ }
427
+ Log.prototype.add = function(value) {
428
+ this._result.push(value);
429
+ };
430
+ Log.prototype.fn = function(value) {
431
+ var _this = this;
432
+ return function(a1, a2, a3, a4, a5) {
433
+ if (a1 === void 0) {
434
+ a1 = null;
435
+ }
436
+ if (a2 === void 0) {
437
+ a2 = null;
438
+ }
439
+ if (a3 === void 0) {
440
+ a3 = null;
441
+ }
442
+ if (a4 === void 0) {
443
+ a4 = null;
444
+ }
445
+ if (a5 === void 0) {
446
+ a5 = null;
447
+ }
448
+ _this._result.push(value);
449
+ };
450
+ };
451
+ Log.prototype.clear = function() {
452
+ this._result = [];
453
+ };
454
+ Log.prototype.result = function() {
455
+ return this._result.join("; ");
456
+ };
457
+ Log = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], Log);
458
+ return Log;
459
+ })();
460
+ exports.Log = Log;
461
+ exports.browserDetection = null;
462
+ var BrowserDetection = (function() {
463
+ function BrowserDetection(ua) {
464
+ if (lang_1.isPresent(ua)) {
465
+ this._ua = ua;
466
+ } else {
467
+ this._ua = lang_1.isPresent(dom_adapter_1.DOM) ? dom_adapter_1.DOM.getUserAgent() : '';
468
+ }
469
+ }
470
+ BrowserDetection.setup = function() {
471
+ exports.browserDetection = new BrowserDetection(null);
472
+ };
473
+ Object.defineProperty(BrowserDetection.prototype, "isFirefox", {
474
+ get: function() {
475
+ return this._ua.indexOf('Firefox') > -1;
476
+ },
477
+ enumerable: true,
478
+ configurable: true
479
+ });
480
+ Object.defineProperty(BrowserDetection.prototype, "isAndroid", {
481
+ get: function() {
482
+ return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 && this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1;
483
+ },
484
+ enumerable: true,
485
+ configurable: true
486
+ });
487
+ Object.defineProperty(BrowserDetection.prototype, "isEdge", {
488
+ get: function() {
489
+ return this._ua.indexOf('Edge') > -1;
490
+ },
491
+ enumerable: true,
492
+ configurable: true
493
+ });
494
+ Object.defineProperty(BrowserDetection.prototype, "isIE", {
495
+ get: function() {
496
+ return this._ua.indexOf('Trident') > -1;
497
+ },
498
+ enumerable: true,
499
+ configurable: true
500
+ });
501
+ Object.defineProperty(BrowserDetection.prototype, "isWebkit", {
502
+ get: function() {
503
+ return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1;
504
+ },
505
+ enumerable: true,
506
+ configurable: true
507
+ });
508
+ Object.defineProperty(BrowserDetection.prototype, "isIOS7", {
509
+ get: function() {
510
+ return this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1;
511
+ },
512
+ enumerable: true,
513
+ configurable: true
514
+ });
515
+ Object.defineProperty(BrowserDetection.prototype, "isSlow", {
516
+ get: function() {
517
+ return this.isAndroid || this.isIE || this.isIOS7;
518
+ },
519
+ enumerable: true,
520
+ configurable: true
521
+ });
522
+ Object.defineProperty(BrowserDetection.prototype, "supportsIntlApi", {
523
+ get: function() {
524
+ return this._ua.indexOf('Chrome/4') > -1 && this._ua.indexOf('Edge') == -1;
525
+ },
526
+ enumerable: true,
527
+ configurable: true
528
+ });
529
+ return BrowserDetection;
530
+ })();
531
+ exports.BrowserDetection = BrowserDetection;
532
+ function dispatchEvent(element, eventType) {
533
+ dom_adapter_1.DOM.dispatchEvent(element, dom_adapter_1.DOM.createEvent(eventType));
534
+ }
535
+ exports.dispatchEvent = dispatchEvent;
536
+ function el(html) {
537
+ return dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(html)));
538
+ }
539
+ exports.el = el;
540
+ var _RE_SPECIAL_CHARS = ['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|'];
541
+ var _ESCAPE_RE = lang_1.RegExpWrapper.create("[\\" + _RE_SPECIAL_CHARS.join('\\') + "]");
542
+ function containsRegexp(input) {
543
+ return lang_1.RegExpWrapper.create(lang_1.StringWrapper.replaceAllMapped(input, _ESCAPE_RE, function(match) {
544
+ return ("\\" + match[0]);
545
+ }));
546
+ }
547
+ exports.containsRegexp = containsRegexp;
548
+ function normalizeCSS(css) {
549
+ css = lang_1.StringWrapper.replaceAll(css, /\s+/g, ' ');
550
+ css = lang_1.StringWrapper.replaceAll(css, /:\s/g, ':');
551
+ css = lang_1.StringWrapper.replaceAll(css, /'/g, '"');
552
+ css = lang_1.StringWrapper.replaceAll(css, / }/g, '}');
553
+ css = lang_1.StringWrapper.replaceAllMapped(css, /url\((\"|\s)(.+)(\"|\s)\)(\s*)/g, function(match) {
554
+ return ("url(\"" + match[2] + "\")");
555
+ });
556
+ css = lang_1.StringWrapper.replaceAllMapped(css, /\[(.+)=([^"\]]+)\]/g, function(match) {
557
+ return ("[" + match[1] + "=\"" + match[2] + "\"]");
558
+ });
559
+ return css;
560
+ }
561
+ exports.normalizeCSS = normalizeCSS;
562
+ var _singleTagWhitelist = ['br', 'hr', 'input'];
563
+ function stringifyElement(el) {
564
+ var result = '';
565
+ if (dom_adapter_1.DOM.isElementNode(el)) {
566
+ var tagName = dom_adapter_1.DOM.tagName(el).toLowerCase();
567
+ result += "<" + tagName;
568
+ var attributeMap = dom_adapter_1.DOM.attributeMap(el);
569
+ var keys = [];
570
+ attributeMap.forEach(function(v, k) {
571
+ return keys.push(k);
572
+ });
573
+ collection_1.ListWrapper.sort(keys);
574
+ for (var i = 0; i < keys.length; i++) {
575
+ var key = keys[i];
576
+ var attValue = attributeMap.get(key);
577
+ if (!lang_1.isString(attValue)) {
578
+ result += " " + key;
579
+ } else {
580
+ result += " " + key + "=\"" + attValue + "\"";
581
+ }
582
+ }
583
+ result += '>';
584
+ var childrenRoot = dom_adapter_1.DOM.templateAwareRoot(el);
585
+ var children = lang_1.isPresent(childrenRoot) ? dom_adapter_1.DOM.childNodes(childrenRoot) : [];
586
+ for (var j = 0; j < children.length; j++) {
587
+ result += stringifyElement(children[j]);
588
+ }
589
+ if (!collection_1.ListWrapper.contains(_singleTagWhitelist, tagName)) {
590
+ result += "</" + tagName + ">";
591
+ }
592
+ } else if (dom_adapter_1.DOM.isCommentNode(el)) {
593
+ result += "<!--" + dom_adapter_1.DOM.nodeValue(el) + "-->";
594
+ } else {
595
+ result += dom_adapter_1.DOM.getText(el);
596
+ }
597
+ return result;
598
+ }
599
+ exports.stringifyElement = stringifyElement;
600
+ global.define = __define;
601
+ return module.exports;
602
+ });
603
+
604
+ System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/core/di", "angular2/src/facade/async", "angular2/src/router/location_strategy"], true, function(require, exports, module) {
605
+ var global = System.global,
606
+ __define = global.define;
607
+ global.define = undefined;
608
+ var __extends = (this && this.__extends) || function(d, b) {
609
+ for (var p in b)
610
+ if (b.hasOwnProperty(p))
611
+ d[p] = b[p];
612
+ function __() {
613
+ this.constructor = d;
614
+ }
615
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
616
+ };
617
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
618
+ var c = arguments.length,
619
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
620
+ d;
621
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
622
+ r = Reflect.decorate(decorators, target, key, desc);
623
+ else
624
+ for (var i = decorators.length - 1; i >= 0; i--)
625
+ if (d = decorators[i])
626
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
627
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
628
+ };
629
+ var __metadata = (this && this.__metadata) || function(k, v) {
630
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
631
+ return Reflect.metadata(k, v);
632
+ };
633
+ var di_1 = require("angular2/src/core/di");
634
+ var async_1 = require("angular2/src/facade/async");
635
+ var location_strategy_1 = require("angular2/src/router/location_strategy");
636
+ var MockLocationStrategy = (function(_super) {
637
+ __extends(MockLocationStrategy, _super);
638
+ function MockLocationStrategy() {
639
+ _super.call(this);
640
+ this.internalBaseHref = '/';
641
+ this.internalPath = '/';
642
+ this.internalTitle = '';
643
+ this.urlChanges = [];
644
+ this._subject = new async_1.EventEmitter();
645
+ }
646
+ MockLocationStrategy.prototype.simulatePopState = function(url) {
647
+ this.internalPath = url;
648
+ async_1.ObservableWrapper.callEmit(this._subject, new _MockPopStateEvent(this.path()));
649
+ };
650
+ MockLocationStrategy.prototype.path = function() {
651
+ return this.internalPath;
652
+ };
653
+ MockLocationStrategy.prototype.prepareExternalUrl = function(internal) {
654
+ if (internal.startsWith('/') && this.internalBaseHref.endsWith('/')) {
655
+ return this.internalBaseHref + internal.substring(1);
656
+ }
657
+ return this.internalBaseHref + internal;
658
+ };
659
+ MockLocationStrategy.prototype.pushState = function(ctx, title, path, query) {
660
+ this.internalTitle = title;
661
+ var url = path + (query.length > 0 ? ('?' + query) : '');
662
+ this.internalPath = url;
663
+ var externalUrl = this.prepareExternalUrl(url);
664
+ this.urlChanges.push(externalUrl);
665
+ };
666
+ MockLocationStrategy.prototype.replaceState = function(ctx, title, path, query) {
667
+ this.internalTitle = title;
668
+ var url = path + (query.length > 0 ? ('?' + query) : '');
669
+ this.internalPath = url;
670
+ var externalUrl = this.prepareExternalUrl(url);
671
+ this.urlChanges.push('replace: ' + externalUrl);
672
+ };
673
+ MockLocationStrategy.prototype.onPopState = function(fn) {
674
+ async_1.ObservableWrapper.subscribe(this._subject, fn);
675
+ };
676
+ MockLocationStrategy.prototype.getBaseHref = function() {
677
+ return this.internalBaseHref;
678
+ };
679
+ MockLocationStrategy.prototype.back = function() {
680
+ if (this.urlChanges.length > 0) {
681
+ this.urlChanges.pop();
682
+ var nextUrl = this.urlChanges.length > 0 ? this.urlChanges[this.urlChanges.length - 1] : '';
683
+ this.simulatePopState(nextUrl);
684
+ }
685
+ };
686
+ MockLocationStrategy.prototype.forward = function() {
687
+ throw 'not implemented';
688
+ };
689
+ MockLocationStrategy = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockLocationStrategy);
690
+ return MockLocationStrategy;
691
+ })(location_strategy_1.LocationStrategy);
692
+ exports.MockLocationStrategy = MockLocationStrategy;
693
+ var _MockPopStateEvent = (function() {
694
+ function _MockPopStateEvent(newUrl) {
695
+ this.newUrl = newUrl;
696
+ this.pop = true;
697
+ this.type = 'popstate';
698
+ }
699
+ return _MockPopStateEvent;
700
+ })();
701
+ global.define = __define;
702
+ return module.exports;
703
+ });
704
+
705
+ System.register("angular2/src/testing/test_component_builder", ["angular2/core", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/testing/utils", "angular2/src/platform/dom/dom_tokens", "angular2/src/platform/dom/dom_adapter", "angular2/src/core/debug/debug_node"], true, function(require, exports, module) {
706
+ var global = System.global,
707
+ __define = global.define;
708
+ global.define = undefined;
709
+ var __extends = (this && this.__extends) || function(d, b) {
710
+ for (var p in b)
711
+ if (b.hasOwnProperty(p))
712
+ d[p] = b[p];
713
+ function __() {
714
+ this.constructor = d;
715
+ }
716
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
717
+ };
718
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
719
+ var c = arguments.length,
720
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
721
+ d;
722
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
723
+ r = Reflect.decorate(decorators, target, key, desc);
724
+ else
725
+ for (var i = decorators.length - 1; i >= 0; i--)
726
+ if (d = decorators[i])
727
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
728
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
729
+ };
730
+ var __metadata = (this && this.__metadata) || function(k, v) {
731
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
732
+ return Reflect.metadata(k, v);
733
+ };
734
+ var core_1 = require("angular2/core");
735
+ var lang_1 = require("angular2/src/facade/lang");
736
+ var collection_1 = require("angular2/src/facade/collection");
737
+ var utils_1 = require("angular2/src/testing/utils");
738
+ var dom_tokens_1 = require("angular2/src/platform/dom/dom_tokens");
739
+ var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter");
740
+ var debug_node_1 = require("angular2/src/core/debug/debug_node");
741
+ var ComponentFixture = (function() {
742
+ function ComponentFixture() {}
743
+ return ComponentFixture;
744
+ })();
745
+ exports.ComponentFixture = ComponentFixture;
746
+ var ComponentFixture_ = (function(_super) {
747
+ __extends(ComponentFixture_, _super);
748
+ function ComponentFixture_(componentRef) {
749
+ _super.call(this);
750
+ this._componentParentView = componentRef.hostView.internalView;
751
+ this.elementRef = this._componentParentView.appElements[0].ref;
752
+ this.debugElement = debug_node_1.getDebugNode(this._componentParentView.rootNodesOrAppElements[0].nativeElement);
753
+ this.componentInstance = this.debugElement.componentInstance;
754
+ this.nativeElement = this.debugElement.nativeElement;
755
+ this._componentRef = componentRef;
756
+ }
757
+ ComponentFixture_.prototype.detectChanges = function() {
758
+ this._componentParentView.changeDetector.detectChanges();
759
+ this._componentParentView.changeDetector.checkNoChanges();
760
+ };
761
+ ComponentFixture_.prototype.destroy = function() {
762
+ this._componentRef.dispose();
763
+ };
764
+ return ComponentFixture_;
765
+ })(ComponentFixture);
766
+ exports.ComponentFixture_ = ComponentFixture_;
767
+ var _nextRootElementId = 0;
768
+ var TestComponentBuilder = (function() {
769
+ function TestComponentBuilder(_injector) {
770
+ this._injector = _injector;
771
+ this._bindingsOverrides = new Map();
772
+ this._directiveOverrides = new Map();
773
+ this._templateOverrides = new Map();
774
+ this._viewBindingsOverrides = new Map();
775
+ this._viewOverrides = new Map();
776
+ }
777
+ TestComponentBuilder.prototype._clone = function() {
778
+ var clone = new TestComponentBuilder(this._injector);
779
+ clone._viewOverrides = collection_1.MapWrapper.clone(this._viewOverrides);
780
+ clone._directiveOverrides = collection_1.MapWrapper.clone(this._directiveOverrides);
781
+ clone._templateOverrides = collection_1.MapWrapper.clone(this._templateOverrides);
782
+ return clone;
783
+ };
784
+ TestComponentBuilder.prototype.overrideTemplate = function(componentType, template) {
785
+ var clone = this._clone();
786
+ clone._templateOverrides.set(componentType, template);
787
+ return clone;
788
+ };
789
+ TestComponentBuilder.prototype.overrideView = function(componentType, view) {
790
+ var clone = this._clone();
791
+ clone._viewOverrides.set(componentType, view);
792
+ return clone;
793
+ };
794
+ TestComponentBuilder.prototype.overrideDirective = function(componentType, from, to) {
795
+ var clone = this._clone();
796
+ var overridesForComponent = clone._directiveOverrides.get(componentType);
797
+ if (!lang_1.isPresent(overridesForComponent)) {
798
+ clone._directiveOverrides.set(componentType, new Map());
799
+ overridesForComponent = clone._directiveOverrides.get(componentType);
800
+ }
801
+ overridesForComponent.set(from, to);
802
+ return clone;
803
+ };
804
+ TestComponentBuilder.prototype.overrideProviders = function(type, providers) {
805
+ var clone = this._clone();
806
+ clone._bindingsOverrides.set(type, providers);
807
+ return clone;
808
+ };
809
+ TestComponentBuilder.prototype.overrideBindings = function(type, providers) {
810
+ return this.overrideProviders(type, providers);
811
+ };
812
+ TestComponentBuilder.prototype.overrideViewProviders = function(type, providers) {
813
+ var clone = this._clone();
814
+ clone._viewBindingsOverrides.set(type, providers);
815
+ return clone;
816
+ };
817
+ TestComponentBuilder.prototype.overrideViewBindings = function(type, providers) {
818
+ return this.overrideViewProviders(type, providers);
819
+ };
820
+ TestComponentBuilder.prototype.createAsync = function(rootComponentType) {
821
+ var mockDirectiveResolver = this._injector.get(core_1.DirectiveResolver);
822
+ var mockViewResolver = this._injector.get(core_1.ViewResolver);
823
+ this._viewOverrides.forEach(function(view, type) {
824
+ return mockViewResolver.setView(type, view);
825
+ });
826
+ this._templateOverrides.forEach(function(template, type) {
827
+ return mockViewResolver.setInlineTemplate(type, template);
828
+ });
829
+ this._directiveOverrides.forEach(function(overrides, component) {
830
+ overrides.forEach(function(to, from) {
831
+ mockViewResolver.overrideViewDirective(component, from, to);
832
+ });
833
+ });
834
+ this._bindingsOverrides.forEach(function(bindings, type) {
835
+ return mockDirectiveResolver.setBindingsOverride(type, bindings);
836
+ });
837
+ this._viewBindingsOverrides.forEach(function(bindings, type) {
838
+ return mockDirectiveResolver.setViewBindingsOverride(type, bindings);
839
+ });
840
+ var rootElId = "root" + _nextRootElementId++;
841
+ var rootEl = utils_1.el("<div id=\"" + rootElId + "\"></div>");
842
+ var doc = this._injector.get(dom_tokens_1.DOCUMENT);
843
+ var oldRoots = dom_adapter_1.DOM.querySelectorAll(doc, '[id^=root]');
844
+ for (var i = 0; i < oldRoots.length; i++) {
845
+ dom_adapter_1.DOM.remove(oldRoots[i]);
846
+ }
847
+ dom_adapter_1.DOM.appendChild(doc.body, rootEl);
848
+ return this._injector.get(core_1.DynamicComponentLoader).loadAsRoot(rootComponentType, "#" + rootElId, this._injector).then(function(componentRef) {
849
+ return new ComponentFixture_(componentRef);
850
+ });
851
+ };
852
+ TestComponentBuilder = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [core_1.Injector])], TestComponentBuilder);
853
+ return TestComponentBuilder;
854
+ })();
855
+ exports.TestComponentBuilder = TestComponentBuilder;
856
+ global.define = __define;
857
+ return module.exports;
858
+ });
859
+
860
+ System.register("angular2/platform/testing/browser_static", ["angular2/core", "angular2/src/platform/browser_common", "angular2/src/platform/browser/browser_adapter", "angular2/src/animate/animation_builder", "angular2/src/mock/animation_builder_mock", "angular2/src/mock/directive_resolver_mock", "angular2/src/mock/view_resolver_mock", "angular2/src/mock/mock_location_strategy", "angular2/src/router/location_strategy", "angular2/src/mock/ng_zone_mock", "angular2/src/platform/browser/xhr_impl", "angular2/compiler", "angular2/src/testing/test_component_builder", "angular2/src/testing/utils", "angular2/platform/common_dom", "angular2/src/facade/lang", "angular2/src/testing/utils"], true, function(require, exports, module) {
861
+ var global = System.global,
862
+ __define = global.define;
863
+ global.define = undefined;
864
+ var core_1 = require("angular2/core");
865
+ var browser_common_1 = require("angular2/src/platform/browser_common");
866
+ var browser_adapter_1 = require("angular2/src/platform/browser/browser_adapter");
867
+ var animation_builder_1 = require("angular2/src/animate/animation_builder");
868
+ var animation_builder_mock_1 = require("angular2/src/mock/animation_builder_mock");
869
+ var directive_resolver_mock_1 = require("angular2/src/mock/directive_resolver_mock");
870
+ var view_resolver_mock_1 = require("angular2/src/mock/view_resolver_mock");
871
+ var mock_location_strategy_1 = require("angular2/src/mock/mock_location_strategy");
872
+ var location_strategy_1 = require("angular2/src/router/location_strategy");
873
+ var ng_zone_mock_1 = require("angular2/src/mock/ng_zone_mock");
874
+ var xhr_impl_1 = require("angular2/src/platform/browser/xhr_impl");
875
+ var compiler_1 = require("angular2/compiler");
876
+ var test_component_builder_1 = require("angular2/src/testing/test_component_builder");
877
+ var utils_1 = require("angular2/src/testing/utils");
878
+ var common_dom_1 = require("angular2/platform/common_dom");
879
+ var lang_1 = require("angular2/src/facade/lang");
880
+ var utils_2 = require("angular2/src/testing/utils");
881
+ function initBrowserTests() {
882
+ browser_adapter_1.BrowserDomAdapter.makeCurrent();
883
+ utils_1.BrowserDetection.setup();
884
+ }
885
+ exports.TEST_BROWSER_STATIC_PLATFORM_PROVIDERS = lang_1.CONST_EXPR([core_1.PLATFORM_COMMON_PROVIDERS, new core_1.Provider(core_1.PLATFORM_INITIALIZER, {
886
+ useValue: initBrowserTests,
887
+ multi: true
888
+ })]);
889
+ exports.ADDITIONAL_TEST_BROWSER_PROVIDERS = lang_1.CONST_EXPR([new core_1.Provider(core_1.APP_ID, {useValue: 'a'}), common_dom_1.ELEMENT_PROBE_PROVIDERS, new core_1.Provider(core_1.DirectiveResolver, {useClass: directive_resolver_mock_1.MockDirectiveResolver}), new core_1.Provider(core_1.ViewResolver, {useClass: view_resolver_mock_1.MockViewResolver}), utils_2.Log, test_component_builder_1.TestComponentBuilder, new core_1.Provider(core_1.NgZone, {useClass: ng_zone_mock_1.MockNgZone}), new core_1.Provider(location_strategy_1.LocationStrategy, {useClass: mock_location_strategy_1.MockLocationStrategy}), new core_1.Provider(animation_builder_1.AnimationBuilder, {useClass: animation_builder_mock_1.MockAnimationBuilder})]);
890
+ exports.TEST_BROWSER_STATIC_APPLICATION_PROVIDERS = lang_1.CONST_EXPR([browser_common_1.BROWSER_APP_COMMON_PROVIDERS, new core_1.Provider(compiler_1.XHR, {useClass: xhr_impl_1.XHRImpl}), exports.ADDITIONAL_TEST_BROWSER_PROVIDERS]);
891
+ global.define = __define;
892
+ return module.exports;
893
+ });
894
+
895
+ System.register("angular2/platform/testing/browser", ["angular2/platform/testing/browser_static", "angular2/platform/browser", "angular2/src/facade/lang"], true, function(require, exports, module) {
896
+ var global = System.global,
897
+ __define = global.define;
898
+ global.define = undefined;
899
+ var browser_static_1 = require("angular2/platform/testing/browser_static");
900
+ var browser_1 = require("angular2/platform/browser");
901
+ var lang_1 = require("angular2/src/facade/lang");
902
+ exports.TEST_BROWSER_PLATFORM_PROVIDERS = lang_1.CONST_EXPR([browser_static_1.TEST_BROWSER_STATIC_PLATFORM_PROVIDERS]);
903
+ exports.TEST_BROWSER_APPLICATION_PROVIDERS = lang_1.CONST_EXPR([browser_1.BROWSER_APP_PROVIDERS, browser_static_1.ADDITIONAL_TEST_BROWSER_PROVIDERS]);
904
+ global.define = __define;
905
+ return module.exports;
906
+ });
907
+
908
+ System.register("angular2/src/mock/location_mock", ["angular2/src/core/di", "angular2/src/facade/async"], true, function(require, exports, module) {
909
+ var global = System.global,
910
+ __define = global.define;
911
+ global.define = undefined;
912
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
913
+ var c = arguments.length,
914
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
915
+ d;
916
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
917
+ r = Reflect.decorate(decorators, target, key, desc);
918
+ else
919
+ for (var i = decorators.length - 1; i >= 0; i--)
920
+ if (d = decorators[i])
921
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
922
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
923
+ };
924
+ var __metadata = (this && this.__metadata) || function(k, v) {
925
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
926
+ return Reflect.metadata(k, v);
927
+ };
928
+ var di_1 = require("angular2/src/core/di");
929
+ var async_1 = require("angular2/src/facade/async");
930
+ var SpyLocation = (function() {
931
+ function SpyLocation() {
932
+ this.urlChanges = [];
933
+ this._path = '';
934
+ this._query = '';
935
+ this._subject = new async_1.EventEmitter();
936
+ this._baseHref = '';
937
+ this.platformStrategy = null;
938
+ }
939
+ SpyLocation.prototype.setInitialPath = function(url) {
940
+ this._path = url;
941
+ };
942
+ SpyLocation.prototype.setBaseHref = function(url) {
943
+ this._baseHref = url;
944
+ };
945
+ SpyLocation.prototype.path = function() {
946
+ return this._path;
947
+ };
948
+ SpyLocation.prototype.simulateUrlPop = function(pathname) {
949
+ async_1.ObservableWrapper.callEmit(this._subject, {
950
+ 'url': pathname,
951
+ 'pop': true
952
+ });
953
+ };
954
+ SpyLocation.prototype.simulateHashChange = function(pathname) {
955
+ this.setInitialPath(pathname);
956
+ this.urlChanges.push('hash: ' + pathname);
957
+ async_1.ObservableWrapper.callEmit(this._subject, {
958
+ 'url': pathname,
959
+ 'pop': true,
960
+ 'type': 'hashchange'
961
+ });
962
+ };
963
+ SpyLocation.prototype.prepareExternalUrl = function(url) {
964
+ if (url.length > 0 && !url.startsWith('/')) {
965
+ url = '/' + url;
966
+ }
967
+ return this._baseHref + url;
968
+ };
969
+ SpyLocation.prototype.go = function(path, query) {
970
+ if (query === void 0) {
971
+ query = '';
972
+ }
973
+ path = this.prepareExternalUrl(path);
974
+ if (this._path == path && this._query == query) {
975
+ return ;
976
+ }
977
+ this._path = path;
978
+ this._query = query;
979
+ var url = path + (query.length > 0 ? ('?' + query) : '');
980
+ this.urlChanges.push(url);
981
+ };
982
+ SpyLocation.prototype.replaceState = function(path, query) {
983
+ if (query === void 0) {
984
+ query = '';
985
+ }
986
+ path = this.prepareExternalUrl(path);
987
+ this._path = path;
988
+ this._query = query;
989
+ var url = path + (query.length > 0 ? ('?' + query) : '');
990
+ this.urlChanges.push('replace: ' + url);
991
+ };
992
+ SpyLocation.prototype.forward = function() {};
993
+ SpyLocation.prototype.back = function() {};
994
+ SpyLocation.prototype.subscribe = function(onNext, onThrow, onReturn) {
995
+ if (onThrow === void 0) {
996
+ onThrow = null;
997
+ }
998
+ if (onReturn === void 0) {
999
+ onReturn = null;
1000
+ }
1001
+ return async_1.ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
1002
+ };
1003
+ SpyLocation.prototype.normalize = function(url) {
1004
+ return null;
1005
+ };
1006
+ SpyLocation = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SpyLocation);
1007
+ return SpyLocation;
1008
+ })();
1009
+ exports.SpyLocation = SpyLocation;
1010
+ global.define = __define;
1011
+ return module.exports;
1012
+ });
1013
+
1014
+ System.register("angular2/router/testing", ["angular2/src/mock/mock_location_strategy", "angular2/src/mock/location_mock"], true, function(require, exports, module) {
1015
+ var global = System.global,
1016
+ __define = global.define;
1017
+ global.define = undefined;
1018
+ function __export(m) {
1019
+ for (var p in m)
1020
+ if (!exports.hasOwnProperty(p))
1021
+ exports[p] = m[p];
1022
+ }
1023
+ __export(require("angular2/src/mock/mock_location_strategy"));
1024
+ __export(require("angular2/src/mock/location_mock"));
1025
+ global.define = __define;
1026
+ return module.exports;
1027
+ });
1028
+
1029
+ System.register("angular2/src/http/headers", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection"], true, function(require, exports, module) {
1030
+ var global = System.global,
1031
+ __define = global.define;
1032
+ global.define = undefined;
1033
+ var lang_1 = require("angular2/src/facade/lang");
1034
+ var exceptions_1 = require("angular2/src/facade/exceptions");
1035
+ var collection_1 = require("angular2/src/facade/collection");
1036
+ var Headers = (function() {
1037
+ function Headers(headers) {
1038
+ var _this = this;
1039
+ if (headers instanceof Headers) {
1040
+ this._headersMap = headers._headersMap;
1041
+ return ;
1042
+ }
1043
+ this._headersMap = new collection_1.Map();
1044
+ if (lang_1.isBlank(headers)) {
1045
+ return ;
1046
+ }
1047
+ collection_1.StringMapWrapper.forEach(headers, function(v, k) {
1048
+ _this._headersMap.set(k, collection_1.isListLikeIterable(v) ? v : [v]);
1049
+ });
1050
+ }
1051
+ Headers.fromResponseHeaderString = function(headersString) {
1052
+ return headersString.trim().split('\n').map(function(val) {
1053
+ return val.split(':');
1054
+ }).map(function(_a) {
1055
+ var key = _a[0],
1056
+ parts = _a.slice(1);
1057
+ return ([key.trim(), parts.join(':').trim()]);
1058
+ }).reduce(function(headers, _a) {
1059
+ var key = _a[0],
1060
+ value = _a[1];
1061
+ return !headers.set(key, value) && headers;
1062
+ }, new Headers());
1063
+ };
1064
+ Headers.prototype.append = function(name, value) {
1065
+ var mapName = this._headersMap.get(name);
1066
+ var list = collection_1.isListLikeIterable(mapName) ? mapName : [];
1067
+ list.push(value);
1068
+ this._headersMap.set(name, list);
1069
+ };
1070
+ Headers.prototype.delete = function(name) {
1071
+ this._headersMap.delete(name);
1072
+ };
1073
+ Headers.prototype.forEach = function(fn) {
1074
+ this._headersMap.forEach(fn);
1075
+ };
1076
+ Headers.prototype.get = function(header) {
1077
+ return collection_1.ListWrapper.first(this._headersMap.get(header));
1078
+ };
1079
+ Headers.prototype.has = function(header) {
1080
+ return this._headersMap.has(header);
1081
+ };
1082
+ Headers.prototype.keys = function() {
1083
+ return collection_1.MapWrapper.keys(this._headersMap);
1084
+ };
1085
+ Headers.prototype.set = function(header, value) {
1086
+ var list = [];
1087
+ if (collection_1.isListLikeIterable(value)) {
1088
+ var pushValue = value.join(',');
1089
+ list.push(pushValue);
1090
+ } else {
1091
+ list.push(value);
1092
+ }
1093
+ this._headersMap.set(header, list);
1094
+ };
1095
+ Headers.prototype.values = function() {
1096
+ return collection_1.MapWrapper.values(this._headersMap);
1097
+ };
1098
+ Headers.prototype.toJSON = function() {
1099
+ var serializableHeaders = {};
1100
+ this._headersMap.forEach(function(values, name) {
1101
+ var list = [];
1102
+ collection_1.iterateListLike(values, function(val) {
1103
+ return list = collection_1.ListWrapper.concat(list, val.split(','));
1104
+ });
1105
+ serializableHeaders[name] = list;
1106
+ });
1107
+ return serializableHeaders;
1108
+ };
1109
+ Headers.prototype.getAll = function(header) {
1110
+ var headers = this._headersMap.get(header);
1111
+ return collection_1.isListLikeIterable(headers) ? headers : [];
1112
+ };
1113
+ Headers.prototype.entries = function() {
1114
+ throw new exceptions_1.BaseException('"entries" method is not implemented on Headers class');
1115
+ };
1116
+ return Headers;
1117
+ })();
1118
+ exports.Headers = Headers;
1119
+ global.define = __define;
1120
+ return module.exports;
1121
+ });
1122
+
1123
+ System.register("angular2/src/http/enums", [], true, function(require, exports, module) {
1124
+ var global = System.global,
1125
+ __define = global.define;
1126
+ global.define = undefined;
1127
+ (function(RequestMethod) {
1128
+ RequestMethod[RequestMethod["Get"] = 0] = "Get";
1129
+ RequestMethod[RequestMethod["Post"] = 1] = "Post";
1130
+ RequestMethod[RequestMethod["Put"] = 2] = "Put";
1131
+ RequestMethod[RequestMethod["Delete"] = 3] = "Delete";
1132
+ RequestMethod[RequestMethod["Options"] = 4] = "Options";
1133
+ RequestMethod[RequestMethod["Head"] = 5] = "Head";
1134
+ RequestMethod[RequestMethod["Patch"] = 6] = "Patch";
1135
+ })(exports.RequestMethod || (exports.RequestMethod = {}));
1136
+ var RequestMethod = exports.RequestMethod;
1137
+ (function(ReadyState) {
1138
+ ReadyState[ReadyState["Unsent"] = 0] = "Unsent";
1139
+ ReadyState[ReadyState["Open"] = 1] = "Open";
1140
+ ReadyState[ReadyState["HeadersReceived"] = 2] = "HeadersReceived";
1141
+ ReadyState[ReadyState["Loading"] = 3] = "Loading";
1142
+ ReadyState[ReadyState["Done"] = 4] = "Done";
1143
+ ReadyState[ReadyState["Cancelled"] = 5] = "Cancelled";
1144
+ })(exports.ReadyState || (exports.ReadyState = {}));
1145
+ var ReadyState = exports.ReadyState;
1146
+ (function(ResponseType) {
1147
+ ResponseType[ResponseType["Basic"] = 0] = "Basic";
1148
+ ResponseType[ResponseType["Cors"] = 1] = "Cors";
1149
+ ResponseType[ResponseType["Default"] = 2] = "Default";
1150
+ ResponseType[ResponseType["Error"] = 3] = "Error";
1151
+ ResponseType[ResponseType["Opaque"] = 4] = "Opaque";
1152
+ })(exports.ResponseType || (exports.ResponseType = {}));
1153
+ var ResponseType = exports.ResponseType;
1154
+ global.define = __define;
1155
+ return module.exports;
1156
+ });
1157
+
1158
+ System.register("angular2/src/http/http_utils", ["angular2/src/facade/lang", "angular2/src/http/enums", "angular2/src/facade/exceptions", "angular2/src/facade/lang"], true, function(require, exports, module) {
1159
+ var global = System.global,
1160
+ __define = global.define;
1161
+ global.define = undefined;
1162
+ var lang_1 = require("angular2/src/facade/lang");
1163
+ var enums_1 = require("angular2/src/http/enums");
1164
+ var exceptions_1 = require("angular2/src/facade/exceptions");
1165
+ function normalizeMethodName(method) {
1166
+ if (lang_1.isString(method)) {
1167
+ var originalMethod = method;
1168
+ method = method.replace(/(\w)(\w*)/g, function(g0, g1, g2) {
1169
+ return g1.toUpperCase() + g2.toLowerCase();
1170
+ });
1171
+ method = enums_1.RequestMethod[method];
1172
+ if (typeof method !== 'number')
1173
+ throw exceptions_1.makeTypeError("Invalid request method. The method \"" + originalMethod + "\" is not supported.");
1174
+ }
1175
+ return method;
1176
+ }
1177
+ exports.normalizeMethodName = normalizeMethodName;
1178
+ exports.isSuccess = function(status) {
1179
+ return (status >= 200 && status < 300);
1180
+ };
1181
+ function getResponseURL(xhr) {
1182
+ if ('responseURL' in xhr) {
1183
+ return xhr.responseURL;
1184
+ }
1185
+ if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
1186
+ return xhr.getResponseHeader('X-Request-URL');
1187
+ }
1188
+ return ;
1189
+ }
1190
+ exports.getResponseURL = getResponseURL;
1191
+ var lang_2 = require("angular2/src/facade/lang");
1192
+ exports.isJsObject = lang_2.isJsObject;
1193
+ global.define = __define;
1194
+ return module.exports;
1195
+ });
1196
+
1197
+ System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/http/http_utils", "angular2/src/facade/lang"], true, function(require, exports, module) {
1198
+ var global = System.global,
1199
+ __define = global.define;
1200
+ global.define = undefined;
1201
+ var headers_1 = require("angular2/src/http/headers");
1202
+ var http_utils_1 = require("angular2/src/http/http_utils");
1203
+ var lang_1 = require("angular2/src/facade/lang");
1204
+ var Request = (function() {
1205
+ function Request(requestOptions) {
1206
+ var url = requestOptions.url;
1207
+ this.url = requestOptions.url;
1208
+ if (lang_1.isPresent(requestOptions.search)) {
1209
+ var search = requestOptions.search.toString();
1210
+ if (search.length > 0) {
1211
+ var prefix = '?';
1212
+ if (lang_1.StringWrapper.contains(this.url, '?')) {
1213
+ prefix = (this.url[this.url.length - 1] == '&') ? '' : '&';
1214
+ }
1215
+ this.url = url + prefix + search;
1216
+ }
1217
+ }
1218
+ this._body = requestOptions.body;
1219
+ this.method = http_utils_1.normalizeMethodName(requestOptions.method);
1220
+ this.headers = new headers_1.Headers(requestOptions.headers);
1221
+ }
1222
+ Request.prototype.text = function() {
1223
+ return lang_1.isPresent(this._body) ? this._body.toString() : '';
1224
+ };
1225
+ return Request;
1226
+ })();
1227
+ exports.Request = Request;
1228
+ global.define = __define;
1229
+ return module.exports;
1230
+ });
1231
+
1232
+ System.register("angular2/src/http/backends/mock_backend", ["angular2/core", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/facade/lang", "angular2/src/facade/exceptions", "rxjs/Subject", "rxjs/subject/ReplaySubject", "rxjs/operator/take"], true, function(require, exports, module) {
1233
+ var global = System.global,
1234
+ __define = global.define;
1235
+ global.define = undefined;
1236
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
1237
+ var c = arguments.length,
1238
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
1239
+ d;
1240
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1241
+ r = Reflect.decorate(decorators, target, key, desc);
1242
+ else
1243
+ for (var i = decorators.length - 1; i >= 0; i--)
1244
+ if (d = decorators[i])
1245
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1246
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1247
+ };
1248
+ var __metadata = (this && this.__metadata) || function(k, v) {
1249
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1250
+ return Reflect.metadata(k, v);
1251
+ };
1252
+ var core_1 = require("angular2/core");
1253
+ var static_request_1 = require("angular2/src/http/static_request");
1254
+ var enums_1 = require("angular2/src/http/enums");
1255
+ var lang_1 = require("angular2/src/facade/lang");
1256
+ var exceptions_1 = require("angular2/src/facade/exceptions");
1257
+ var Subject_1 = require("rxjs/Subject");
1258
+ var ReplaySubject_1 = require("rxjs/subject/ReplaySubject");
1259
+ var take_1 = require("rxjs/operator/take");
1260
+ var MockConnection = (function() {
1261
+ function MockConnection(req) {
1262
+ this.response = take_1.take.call(new ReplaySubject_1.ReplaySubject(1), 1);
1263
+ this.readyState = enums_1.ReadyState.Open;
1264
+ this.request = req;
1265
+ }
1266
+ MockConnection.prototype.mockRespond = function(res) {
1267
+ if (this.readyState === enums_1.ReadyState.Done || this.readyState === enums_1.ReadyState.Cancelled) {
1268
+ throw new exceptions_1.BaseException('Connection has already been resolved');
1269
+ }
1270
+ this.readyState = enums_1.ReadyState.Done;
1271
+ this.response.next(res);
1272
+ this.response.complete();
1273
+ };
1274
+ MockConnection.prototype.mockDownload = function(res) {};
1275
+ MockConnection.prototype.mockError = function(err) {
1276
+ this.readyState = enums_1.ReadyState.Done;
1277
+ this.response.error(err);
1278
+ };
1279
+ return MockConnection;
1280
+ })();
1281
+ exports.MockConnection = MockConnection;
1282
+ var MockBackend = (function() {
1283
+ function MockBackend() {
1284
+ var _this = this;
1285
+ this.connectionsArray = [];
1286
+ this.connections = new Subject_1.Subject();
1287
+ this.connections.subscribe(function(connection) {
1288
+ return _this.connectionsArray.push(connection);
1289
+ });
1290
+ this.pendingConnections = new Subject_1.Subject();
1291
+ }
1292
+ MockBackend.prototype.verifyNoPendingRequests = function() {
1293
+ var pending = 0;
1294
+ this.pendingConnections.subscribe(function(c) {
1295
+ return pending++;
1296
+ });
1297
+ if (pending > 0)
1298
+ throw new exceptions_1.BaseException(pending + " pending connections to be resolved");
1299
+ };
1300
+ MockBackend.prototype.resolveAllConnections = function() {
1301
+ this.connections.subscribe(function(c) {
1302
+ return c.readyState = 4;
1303
+ });
1304
+ };
1305
+ MockBackend.prototype.createConnection = function(req) {
1306
+ if (!lang_1.isPresent(req) || !(req instanceof static_request_1.Request)) {
1307
+ throw new exceptions_1.BaseException("createConnection requires an instance of Request, got " + req);
1308
+ }
1309
+ var connection = new MockConnection(req);
1310
+ this.connections.next(connection);
1311
+ return connection;
1312
+ };
1313
+ MockBackend = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], MockBackend);
1314
+ return MockBackend;
1315
+ })();
1316
+ exports.MockBackend = MockBackend;
1317
+ global.define = __define;
1318
+ return module.exports;
1319
+ });
1320
+
1321
+ System.register("angular2/http/testing", ["angular2/src/http/backends/mock_backend"], true, function(require, exports, module) {
1322
+ var global = System.global,
1323
+ __define = global.define;
1324
+ global.define = undefined;
1325
+ function __export(m) {
1326
+ for (var p in m)
1327
+ if (!exports.hasOwnProperty(p))
1328
+ exports[p] = m[p];
1329
+ }
1330
+ __export(require("angular2/src/http/backends/mock_backend"));
1331
+ global.define = __define;
1332
+ return module.exports;
1333
+ });
1334
+
1335
+ System.register("angular2/src/testing/fake_async", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection"], true, function(require, exports, module) {
1336
+ var global = System.global,
1337
+ __define = global.define;
1338
+ global.define = undefined;
1339
+ var lang_1 = require("angular2/src/facade/lang");
1340
+ var exceptions_1 = require("angular2/src/facade/exceptions");
1341
+ var collection_1 = require("angular2/src/facade/collection");
1342
+ var _scheduler;
1343
+ var _microtasks = [];
1344
+ var _pendingPeriodicTimers = [];
1345
+ var _pendingTimers = [];
1346
+ function fakeAsync(fn) {
1347
+ if (lang_1.global.zone._inFakeAsyncZone) {
1348
+ throw new Error('fakeAsync() calls can not be nested');
1349
+ }
1350
+ var fakeAsyncZone = lang_1.global.zone.fork({
1351
+ setTimeout: _setTimeout,
1352
+ clearTimeout: _clearTimeout,
1353
+ setInterval: _setInterval,
1354
+ clearInterval: _clearInterval,
1355
+ scheduleMicrotask: _scheduleMicrotask,
1356
+ _inFakeAsyncZone: true
1357
+ });
1358
+ return function() {
1359
+ var args = [];
1360
+ for (var _i = 0; _i < arguments.length; _i++) {
1361
+ args[_i - 0] = arguments[_i];
1362
+ }
1363
+ _scheduler = new jasmine.DelayedFunctionScheduler();
1364
+ clearPendingTimers();
1365
+ var res = fakeAsyncZone.run(function() {
1366
+ var res = fn.apply(void 0, args);
1367
+ flushMicrotasks();
1368
+ return res;
1369
+ });
1370
+ if (_pendingPeriodicTimers.length > 0) {
1371
+ throw new exceptions_1.BaseException(_pendingPeriodicTimers.length + " periodic timer(s) still in the queue.");
1372
+ }
1373
+ if (_pendingTimers.length > 0) {
1374
+ throw new exceptions_1.BaseException(_pendingTimers.length + " timer(s) still in the queue.");
1375
+ }
1376
+ _scheduler = null;
1377
+ collection_1.ListWrapper.clear(_microtasks);
1378
+ return res;
1379
+ };
1380
+ }
1381
+ exports.fakeAsync = fakeAsync;
1382
+ function clearPendingTimers() {
1383
+ collection_1.ListWrapper.clear(_microtasks);
1384
+ collection_1.ListWrapper.clear(_pendingPeriodicTimers);
1385
+ collection_1.ListWrapper.clear(_pendingTimers);
1386
+ }
1387
+ exports.clearPendingTimers = clearPendingTimers;
1388
+ function tick(millis) {
1389
+ if (millis === void 0) {
1390
+ millis = 0;
1391
+ }
1392
+ _assertInFakeAsyncZone();
1393
+ flushMicrotasks();
1394
+ _scheduler.tick(millis);
1395
+ }
1396
+ exports.tick = tick;
1397
+ function flushMicrotasks() {
1398
+ _assertInFakeAsyncZone();
1399
+ while (_microtasks.length > 0) {
1400
+ var microtask = collection_1.ListWrapper.removeAt(_microtasks, 0);
1401
+ microtask();
1402
+ }
1403
+ }
1404
+ exports.flushMicrotasks = flushMicrotasks;
1405
+ function _setTimeout(fn, delay) {
1406
+ var args = [];
1407
+ for (var _i = 2; _i < arguments.length; _i++) {
1408
+ args[_i - 2] = arguments[_i];
1409
+ }
1410
+ var cb = _fnAndFlush(fn);
1411
+ var id = _scheduler.scheduleFunction(cb, delay, args);
1412
+ _pendingTimers.push(id);
1413
+ _scheduler.scheduleFunction(_dequeueTimer(id), delay);
1414
+ return id;
1415
+ }
1416
+ function _clearTimeout(id) {
1417
+ _dequeueTimer(id);
1418
+ return _scheduler.removeFunctionWithId(id);
1419
+ }
1420
+ function _setInterval(fn, interval) {
1421
+ var args = [];
1422
+ for (var _i = 2; _i < arguments.length; _i++) {
1423
+ args[_i - 2] = arguments[_i];
1424
+ }
1425
+ var cb = _fnAndFlush(fn);
1426
+ var id = _scheduler.scheduleFunction(cb, interval, args, true);
1427
+ _pendingPeriodicTimers.push(id);
1428
+ return id;
1429
+ }
1430
+ function _clearInterval(id) {
1431
+ collection_1.ListWrapper.remove(_pendingPeriodicTimers, id);
1432
+ return _scheduler.removeFunctionWithId(id);
1433
+ }
1434
+ function _fnAndFlush(fn) {
1435
+ return function() {
1436
+ var args = [];
1437
+ for (var _i = 0; _i < arguments.length; _i++) {
1438
+ args[_i - 0] = arguments[_i];
1439
+ }
1440
+ fn.apply(lang_1.global, args);
1441
+ flushMicrotasks();
1442
+ };
1443
+ }
1444
+ function _scheduleMicrotask(microtask) {
1445
+ _microtasks.push(microtask);
1446
+ }
1447
+ function _dequeueTimer(id) {
1448
+ return function() {
1449
+ collection_1.ListWrapper.remove(_pendingTimers, id);
1450
+ };
1451
+ }
1452
+ function _assertInFakeAsyncZone() {
1453
+ if (!lang_1.global.zone || !lang_1.global.zone._inFakeAsyncZone) {
1454
+ throw new Error('The code should be running in the fakeAsync zone to call this function');
1455
+ }
1456
+ }
1457
+ global.define = __define;
1458
+ return module.exports;
1459
+ });
1460
+
1461
+ System.register("angular2/src/mock/mock_application_ref", ["angular2/src/core/application_ref", "angular2/src/core/di"], true, function(require, exports, module) {
1462
+ var global = System.global,
1463
+ __define = global.define;
1464
+ global.define = undefined;
1465
+ var __extends = (this && this.__extends) || function(d, b) {
1466
+ for (var p in b)
1467
+ if (b.hasOwnProperty(p))
1468
+ d[p] = b[p];
1469
+ function __() {
1470
+ this.constructor = d;
1471
+ }
1472
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1473
+ };
1474
+ var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
1475
+ var c = arguments.length,
1476
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
1477
+ d;
1478
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1479
+ r = Reflect.decorate(decorators, target, key, desc);
1480
+ else
1481
+ for (var i = decorators.length - 1; i >= 0; i--)
1482
+ if (d = decorators[i])
1483
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1484
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1485
+ };
1486
+ var __metadata = (this && this.__metadata) || function(k, v) {
1487
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1488
+ return Reflect.metadata(k, v);
1489
+ };
1490
+ var application_ref_1 = require("angular2/src/core/application_ref");
1491
+ var di_1 = require("angular2/src/core/di");
1492
+ var MockApplicationRef = (function(_super) {
1493
+ __extends(MockApplicationRef, _super);
1494
+ function MockApplicationRef() {
1495
+ _super.apply(this, arguments);
1496
+ }
1497
+ MockApplicationRef.prototype.registerBootstrapListener = function(listener) {};
1498
+ MockApplicationRef.prototype.registerDisposeListener = function(dispose) {};
1499
+ MockApplicationRef.prototype.bootstrap = function(componentType, bindings) {
1500
+ return null;
1501
+ };
1502
+ Object.defineProperty(MockApplicationRef.prototype, "injector", {
1503
+ get: function() {
1504
+ return null;
1505
+ },
1506
+ enumerable: true,
1507
+ configurable: true
1508
+ });
1509
+ ;
1510
+ Object.defineProperty(MockApplicationRef.prototype, "zone", {
1511
+ get: function() {
1512
+ return null;
1513
+ },
1514
+ enumerable: true,
1515
+ configurable: true
1516
+ });
1517
+ ;
1518
+ MockApplicationRef.prototype.dispose = function() {};
1519
+ MockApplicationRef.prototype.tick = function() {};
1520
+ Object.defineProperty(MockApplicationRef.prototype, "componentTypes", {
1521
+ get: function() {
1522
+ return null;
1523
+ },
1524
+ enumerable: true,
1525
+ configurable: true
1526
+ });
1527
+ ;
1528
+ MockApplicationRef = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockApplicationRef);
1529
+ return MockApplicationRef;
1530
+ })(application_ref_1.ApplicationRef);
1531
+ exports.MockApplicationRef = MockApplicationRef;
1532
+ global.define = __define;
1533
+ return module.exports;
1534
+ });
1535
+
1536
+ System.register("angular2/src/testing/matchers", ["angular2/src/platform/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection"], true, function(require, exports, module) {
1537
+ var global = System.global,
1538
+ __define = global.define;
1539
+ global.define = undefined;
1540
+ var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter");
1541
+ var lang_1 = require("angular2/src/facade/lang");
1542
+ var collection_1 = require("angular2/src/facade/collection");
1543
+ var _global = (typeof window === 'undefined' ? lang_1.global : window);
1544
+ exports.expect = _global.expect;
1545
+ Map.prototype['jasmineToString'] = function() {
1546
+ var m = this;
1547
+ if (!m) {
1548
+ return '' + m;
1549
+ }
1550
+ var res = [];
1551
+ m.forEach(function(v, k) {
1552
+ res.push(k + ":" + v);
1553
+ });
1554
+ return "{ " + res.join(',') + " }";
1555
+ };
1556
+ _global.beforeEach(function() {
1557
+ jasmine.addMatchers({
1558
+ toEqual: function(util, customEqualityTesters) {
1559
+ return {compare: function(actual, expected) {
1560
+ return {pass: util.equals(actual, expected, [compareMap])};
1561
+ }};
1562
+ function compareMap(actual, expected) {
1563
+ if (actual instanceof Map) {
1564
+ var pass = actual.size === expected.size;
1565
+ if (pass) {
1566
+ actual.forEach(function(v, k) {
1567
+ pass = pass && util.equals(v, expected.get(k));
1568
+ });
1569
+ }
1570
+ return pass;
1571
+ } else {
1572
+ return undefined;
1573
+ }
1574
+ }
1575
+ },
1576
+ toBePromise: function() {
1577
+ return {compare: function(actual, expectedClass) {
1578
+ var pass = typeof actual === 'object' && typeof actual.then === 'function';
1579
+ return {
1580
+ pass: pass,
1581
+ get message() {
1582
+ return 'Expected ' + actual + ' to be a promise';
1583
+ }
1584
+ };
1585
+ }};
1586
+ },
1587
+ toBeAnInstanceOf: function() {
1588
+ return {compare: function(actual, expectedClass) {
1589
+ var pass = typeof actual === 'object' && actual instanceof expectedClass;
1590
+ return {
1591
+ pass: pass,
1592
+ get message() {
1593
+ return 'Expected ' + actual + ' to be an instance of ' + expectedClass;
1594
+ }
1595
+ };
1596
+ }};
1597
+ },
1598
+ toHaveText: function() {
1599
+ return {compare: function(actual, expectedText) {
1600
+ var actualText = elementText(actual);
1601
+ return {
1602
+ pass: actualText == expectedText,
1603
+ get message() {
1604
+ return 'Expected ' + actualText + ' to be equal to ' + expectedText;
1605
+ }
1606
+ };
1607
+ }};
1608
+ },
1609
+ toHaveCssClass: function() {
1610
+ return {
1611
+ compare: buildError(false),
1612
+ negativeCompare: buildError(true)
1613
+ };
1614
+ function buildError(isNot) {
1615
+ return function(actual, className) {
1616
+ return {
1617
+ pass: dom_adapter_1.DOM.hasClass(actual, className) == !isNot,
1618
+ get message() {
1619
+ return "Expected " + actual.outerHTML + " " + (isNot ? 'not ' : '') + "to contain the CSS class \"" + className + "\"";
1620
+ }
1621
+ };
1622
+ };
1623
+ }
1624
+ },
1625
+ toHaveCssStyle: function() {
1626
+ return {compare: function(actual, styles) {
1627
+ var allPassed;
1628
+ if (lang_1.isString(styles)) {
1629
+ allPassed = dom_adapter_1.DOM.hasStyle(actual, styles);
1630
+ } else {
1631
+ allPassed = !collection_1.StringMapWrapper.isEmpty(styles);
1632
+ collection_1.StringMapWrapper.forEach(styles, function(style, prop) {
1633
+ allPassed = allPassed && dom_adapter_1.DOM.hasStyle(actual, prop, style);
1634
+ });
1635
+ }
1636
+ return {
1637
+ pass: allPassed,
1638
+ get message() {
1639
+ var expectedValueStr = lang_1.isString(styles) ? styles : JSON.stringify(styles);
1640
+ return "Expected " + actual.outerHTML + " " + (!allPassed ? ' ' : 'not ') + "to contain the\n CSS " + (lang_1.isString(styles) ? 'property' : 'styles') + " \"" + expectedValueStr + "\"";
1641
+ }
1642
+ };
1643
+ }};
1644
+ },
1645
+ toContainError: function() {
1646
+ return {compare: function(actual, expectedText) {
1647
+ var errorMessage = actual.toString();
1648
+ return {
1649
+ pass: errorMessage.indexOf(expectedText) > -1,
1650
+ get message() {
1651
+ return 'Expected ' + errorMessage + ' to contain ' + expectedText;
1652
+ }
1653
+ };
1654
+ }};
1655
+ },
1656
+ toThrowErrorWith: function() {
1657
+ return {compare: function(actual, expectedText) {
1658
+ try {
1659
+ actual();
1660
+ return {
1661
+ pass: false,
1662
+ get message() {
1663
+ return "Was expected to throw, but did not throw";
1664
+ }
1665
+ };
1666
+ } catch (e) {
1667
+ var errorMessage = e.toString();
1668
+ return {
1669
+ pass: errorMessage.indexOf(expectedText) > -1,
1670
+ get message() {
1671
+ return 'Expected ' + errorMessage + ' to contain ' + expectedText;
1672
+ }
1673
+ };
1674
+ }
1675
+ }};
1676
+ },
1677
+ toImplement: function() {
1678
+ return {compare: function(actualObject, expectedInterface) {
1679
+ var objProps = Object.keys(actualObject.constructor.prototype);
1680
+ var intProps = Object.keys(expectedInterface.prototype);
1681
+ var missedMethods = [];
1682
+ intProps.forEach(function(k) {
1683
+ if (!actualObject.constructor.prototype[k])
1684
+ missedMethods.push(k);
1685
+ });
1686
+ return {
1687
+ pass: missedMethods.length == 0,
1688
+ get message() {
1689
+ return 'Expected ' + actualObject + ' to have the following methods: ' + missedMethods.join(", ");
1690
+ }
1691
+ };
1692
+ }};
1693
+ }
1694
+ });
1695
+ });
1696
+ function elementText(n) {
1697
+ var hasNodes = function(n) {
1698
+ var children = dom_adapter_1.DOM.childNodes(n);
1699
+ return children && children.length > 0;
1700
+ };
1701
+ if (n instanceof Array) {
1702
+ return n.map(elementText).join("");
1703
+ }
1704
+ if (dom_adapter_1.DOM.isCommentNode(n)) {
1705
+ return '';
1706
+ }
1707
+ if (dom_adapter_1.DOM.isElementNode(n) && dom_adapter_1.DOM.tagName(n) == 'CONTENT') {
1708
+ return elementText(Array.prototype.slice.apply(dom_adapter_1.DOM.getDistributedNodes(n)));
1709
+ }
1710
+ if (dom_adapter_1.DOM.hasShadowRoot(n)) {
1711
+ return elementText(dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.getShadowRoot(n)));
1712
+ }
1713
+ if (hasNodes(n)) {
1714
+ return elementText(dom_adapter_1.DOM.childNodesAsList(n));
1715
+ }
1716
+ return dom_adapter_1.DOM.getText(n);
1717
+ }
1718
+ global.define = __define;
1719
+ return module.exports;
1720
+ });
1721
+
1722
+ System.register("angular2/src/compiler/xhr_mock", ["angular2/src/compiler/xhr", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/async"], true, function(require, exports, module) {
1723
+ var global = System.global,
1724
+ __define = global.define;
1725
+ global.define = undefined;
1726
+ var __extends = (this && this.__extends) || function(d, b) {
1727
+ for (var p in b)
1728
+ if (b.hasOwnProperty(p))
1729
+ d[p] = b[p];
1730
+ function __() {
1731
+ this.constructor = d;
1732
+ }
1733
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1734
+ };
1735
+ var xhr_1 = require("angular2/src/compiler/xhr");
1736
+ var collection_1 = require("angular2/src/facade/collection");
1737
+ var lang_1 = require("angular2/src/facade/lang");
1738
+ var exceptions_1 = require("angular2/src/facade/exceptions");
1739
+ var async_1 = require("angular2/src/facade/async");
1740
+ var MockXHR = (function(_super) {
1741
+ __extends(MockXHR, _super);
1742
+ function MockXHR() {
1743
+ _super.apply(this, arguments);
1744
+ this._expectations = [];
1745
+ this._definitions = new collection_1.Map();
1746
+ this._requests = [];
1747
+ }
1748
+ MockXHR.prototype.get = function(url) {
1749
+ var request = new _PendingRequest(url);
1750
+ this._requests.push(request);
1751
+ return request.getPromise();
1752
+ };
1753
+ MockXHR.prototype.expect = function(url, response) {
1754
+ var expectation = new _Expectation(url, response);
1755
+ this._expectations.push(expectation);
1756
+ };
1757
+ MockXHR.prototype.when = function(url, response) {
1758
+ this._definitions.set(url, response);
1759
+ };
1760
+ MockXHR.prototype.flush = function() {
1761
+ if (this._requests.length === 0) {
1762
+ throw new exceptions_1.BaseException('No pending requests to flush');
1763
+ }
1764
+ do {
1765
+ this._processRequest(this._requests.shift());
1766
+ } while (this._requests.length > 0);
1767
+ this.verifyNoOutstandingExpectations();
1768
+ };
1769
+ MockXHR.prototype.verifyNoOutstandingExpectations = function() {
1770
+ if (this._expectations.length === 0)
1771
+ return ;
1772
+ var urls = [];
1773
+ for (var i = 0; i < this._expectations.length; i++) {
1774
+ var expectation = this._expectations[i];
1775
+ urls.push(expectation.url);
1776
+ }
1777
+ throw new exceptions_1.BaseException("Unsatisfied requests: " + urls.join(', '));
1778
+ };
1779
+ MockXHR.prototype._processRequest = function(request) {
1780
+ var url = request.url;
1781
+ if (this._expectations.length > 0) {
1782
+ var expectation = this._expectations[0];
1783
+ if (expectation.url == url) {
1784
+ collection_1.ListWrapper.remove(this._expectations, expectation);
1785
+ request.complete(expectation.response);
1786
+ return ;
1787
+ }
1788
+ }
1789
+ if (this._definitions.has(url)) {
1790
+ var response = this._definitions.get(url);
1791
+ request.complete(lang_1.normalizeBlank(response));
1792
+ return ;
1793
+ }
1794
+ throw new exceptions_1.BaseException("Unexpected request " + url);
1795
+ };
1796
+ return MockXHR;
1797
+ })(xhr_1.XHR);
1798
+ exports.MockXHR = MockXHR;
1799
+ var _PendingRequest = (function() {
1800
+ function _PendingRequest(url) {
1801
+ this.url = url;
1802
+ this.completer = async_1.PromiseWrapper.completer();
1803
+ }
1804
+ _PendingRequest.prototype.complete = function(response) {
1805
+ if (lang_1.isBlank(response)) {
1806
+ this.completer.reject("Failed to load " + this.url, null);
1807
+ } else {
1808
+ this.completer.resolve(response);
1809
+ }
1810
+ };
1811
+ _PendingRequest.prototype.getPromise = function() {
1812
+ return this.completer.promise;
1813
+ };
1814
+ return _PendingRequest;
1815
+ })();
1816
+ var _Expectation = (function() {
1817
+ function _Expectation(url, response) {
1818
+ this.url = url;
1819
+ this.response = response;
1820
+ }
1821
+ return _Expectation;
1822
+ })();
1823
+ global.define = __define;
1824
+ return module.exports;
1825
+ });
1826
+
1827
+ System.register("angular2/src/testing/test_injector", ["angular2/core", "angular2/src/facade/exceptions", "angular2/src/facade/collection", "angular2/src/facade/lang"], true, function(require, exports, module) {
1828
+ var global = System.global,
1829
+ __define = global.define;
1830
+ global.define = undefined;
1831
+ var core_1 = require("angular2/core");
1832
+ var exceptions_1 = require("angular2/src/facade/exceptions");
1833
+ var collection_1 = require("angular2/src/facade/collection");
1834
+ var lang_1 = require("angular2/src/facade/lang");
1835
+ var TestInjector = (function() {
1836
+ function TestInjector() {
1837
+ this._instantiated = false;
1838
+ this._injector = null;
1839
+ this._providers = [];
1840
+ this.platformProviders = [];
1841
+ this.applicationProviders = [];
1842
+ }
1843
+ TestInjector.prototype.reset = function() {
1844
+ this._injector = null;
1845
+ this._providers = [];
1846
+ this._instantiated = false;
1847
+ };
1848
+ TestInjector.prototype.addProviders = function(providers) {
1849
+ if (this._instantiated) {
1850
+ throw new exceptions_1.BaseException('Cannot add providers after test injector is instantiated');
1851
+ }
1852
+ this._providers = collection_1.ListWrapper.concat(this._providers, providers);
1853
+ };
1854
+ TestInjector.prototype.createInjector = function() {
1855
+ var rootInjector = core_1.Injector.resolveAndCreate(this.platformProviders);
1856
+ this._injector = rootInjector.resolveAndCreateChild(collection_1.ListWrapper.concat(this.applicationProviders, this._providers));
1857
+ this._instantiated = true;
1858
+ return this._injector;
1859
+ };
1860
+ TestInjector.prototype.execute = function(fn) {
1861
+ if (!this._instantiated) {
1862
+ this.createInjector();
1863
+ }
1864
+ return fn.execute(this._injector);
1865
+ };
1866
+ return TestInjector;
1867
+ })();
1868
+ exports.TestInjector = TestInjector;
1869
+ var _testInjector = null;
1870
+ function getTestInjector() {
1871
+ if (_testInjector == null) {
1872
+ _testInjector = new TestInjector();
1873
+ }
1874
+ return _testInjector;
1875
+ }
1876
+ exports.getTestInjector = getTestInjector;
1877
+ function setBaseTestProviders(platformProviders, applicationProviders) {
1878
+ var testInjector = getTestInjector();
1879
+ if (testInjector.platformProviders.length > 0 || testInjector.applicationProviders.length > 0) {
1880
+ throw new exceptions_1.BaseException('Cannot set base providers because it has already been called');
1881
+ }
1882
+ testInjector.platformProviders = platformProviders;
1883
+ testInjector.applicationProviders = applicationProviders;
1884
+ var injector = testInjector.createInjector();
1885
+ var inits = injector.getOptional(core_1.PLATFORM_INITIALIZER);
1886
+ if (lang_1.isPresent(inits)) {
1887
+ inits.forEach(function(init) {
1888
+ return init();
1889
+ });
1890
+ }
1891
+ testInjector.reset();
1892
+ }
1893
+ exports.setBaseTestProviders = setBaseTestProviders;
1894
+ function resetBaseTestProviders() {
1895
+ var testInjector = getTestInjector();
1896
+ testInjector.platformProviders = [];
1897
+ testInjector.applicationProviders = [];
1898
+ testInjector.reset();
1899
+ }
1900
+ exports.resetBaseTestProviders = resetBaseTestProviders;
1901
+ function inject(tokens, fn) {
1902
+ return new FunctionWithParamTokens(tokens, fn, false);
1903
+ }
1904
+ exports.inject = inject;
1905
+ function injectAsync(tokens, fn) {
1906
+ return new FunctionWithParamTokens(tokens, fn, true);
1907
+ }
1908
+ exports.injectAsync = injectAsync;
1909
+ var FunctionWithParamTokens = (function() {
1910
+ function FunctionWithParamTokens(_tokens, _fn, isAsync) {
1911
+ this._tokens = _tokens;
1912
+ this._fn = _fn;
1913
+ this.isAsync = isAsync;
1914
+ }
1915
+ FunctionWithParamTokens.prototype.execute = function(injector) {
1916
+ var params = this._tokens.map(function(t) {
1917
+ return injector.get(t);
1918
+ });
1919
+ return lang_1.FunctionWrapper.apply(this._fn, params);
1920
+ };
1921
+ FunctionWithParamTokens.prototype.hasToken = function(token) {
1922
+ return this._tokens.indexOf(token) > -1;
1923
+ };
1924
+ return FunctionWithParamTokens;
1925
+ })();
1926
+ exports.FunctionWithParamTokens = FunctionWithParamTokens;
1927
+ global.define = __define;
1928
+ return module.exports;
1929
+ });
1930
+
1931
+ System.register("angular2/src/testing/testing", ["angular2/src/facade/lang", "angular2/src/testing/test_injector", "angular2/src/testing/test_injector", "angular2/src/testing/matchers"], true, function(require, exports, module) {
1932
+ var global = System.global,
1933
+ __define = global.define;
1934
+ global.define = undefined;
1935
+ var lang_1 = require("angular2/src/facade/lang");
1936
+ var test_injector_1 = require("angular2/src/testing/test_injector");
1937
+ var test_injector_2 = require("angular2/src/testing/test_injector");
1938
+ exports.inject = test_injector_2.inject;
1939
+ exports.injectAsync = test_injector_2.injectAsync;
1940
+ var matchers_1 = require("angular2/src/testing/matchers");
1941
+ exports.expect = matchers_1.expect;
1942
+ var _global = (typeof window === 'undefined' ? lang_1.global : window);
1943
+ exports.afterEach = _global.afterEach;
1944
+ exports.describe = _global.describe;
1945
+ exports.ddescribe = _global.fdescribe;
1946
+ exports.fdescribe = _global.fdescribe;
1947
+ exports.xdescribe = _global.xdescribe;
1948
+ var jsmBeforeEach = _global.beforeEach;
1949
+ var jsmIt = _global.it;
1950
+ var jsmIIt = _global.fit;
1951
+ var jsmXIt = _global.xit;
1952
+ var testInjector = test_injector_1.getTestInjector();
1953
+ jsmBeforeEach(function() {
1954
+ testInjector.reset();
1955
+ });
1956
+ function beforeEachProviders(fn) {
1957
+ jsmBeforeEach(function() {
1958
+ var providers = fn();
1959
+ if (!providers)
1960
+ return ;
1961
+ try {
1962
+ testInjector.addProviders(providers);
1963
+ } catch (e) {
1964
+ throw new Error('beforeEachProviders was called after the injector had ' + 'been used in a beforeEach or it block. This invalidates the ' + 'test injector');
1965
+ }
1966
+ });
1967
+ }
1968
+ exports.beforeEachProviders = beforeEachProviders;
1969
+ function _isPromiseLike(input) {
1970
+ return input && !!(input.then);
1971
+ }
1972
+ function _it(jsmFn, name, testFn, testTimeOut) {
1973
+ var timeOut = testTimeOut;
1974
+ if (testFn instanceof test_injector_1.FunctionWithParamTokens) {
1975
+ jsmFn(name, function(done) {
1976
+ var returnedTestValue;
1977
+ try {
1978
+ returnedTestValue = testInjector.execute(testFn);
1979
+ } catch (err) {
1980
+ done.fail(err);
1981
+ return ;
1982
+ }
1983
+ if (testFn.isAsync) {
1984
+ if (_isPromiseLike(returnedTestValue)) {
1985
+ returnedTestValue.then(function() {
1986
+ done();
1987
+ }, function(err) {
1988
+ done.fail(err);
1989
+ });
1990
+ } else {
1991
+ done.fail('Error: injectAsync was expected to return a promise, but the ' + ' returned value was: ' + returnedTestValue);
1992
+ }
1993
+ } else {
1994
+ if (!(returnedTestValue === undefined)) {
1995
+ done.fail('Error: inject returned a value. Did you mean to use injectAsync? Returned ' + 'value was: ' + returnedTestValue);
1996
+ }
1997
+ done();
1998
+ }
1999
+ }, timeOut);
2000
+ } else {
2001
+ jsmFn(name, testFn, timeOut);
2002
+ }
2003
+ }
2004
+ function beforeEach(fn) {
2005
+ if (fn instanceof test_injector_1.FunctionWithParamTokens) {
2006
+ jsmBeforeEach(function(done) {
2007
+ var returnedTestValue;
2008
+ try {
2009
+ returnedTestValue = testInjector.execute(fn);
2010
+ } catch (err) {
2011
+ done.fail(err);
2012
+ return ;
2013
+ }
2014
+ if (fn.isAsync) {
2015
+ if (_isPromiseLike(returnedTestValue)) {
2016
+ returnedTestValue.then(function() {
2017
+ done();
2018
+ }, function(err) {
2019
+ done.fail(err);
2020
+ });
2021
+ } else {
2022
+ done.fail('Error: injectAsync was expected to return a promise, but the ' + ' returned value was: ' + returnedTestValue);
2023
+ }
2024
+ } else {
2025
+ if (!(returnedTestValue === undefined)) {
2026
+ done.fail('Error: inject returned a value. Did you mean to use injectAsync? Returned ' + 'value was: ' + returnedTestValue);
2027
+ }
2028
+ done();
2029
+ }
2030
+ });
2031
+ } else {
2032
+ if (fn.length === 0) {
2033
+ jsmBeforeEach(function() {
2034
+ fn();
2035
+ });
2036
+ } else {
2037
+ jsmBeforeEach(function(done) {
2038
+ fn(done);
2039
+ });
2040
+ }
2041
+ }
2042
+ }
2043
+ exports.beforeEach = beforeEach;
2044
+ function it(name, fn, timeOut) {
2045
+ if (timeOut === void 0) {
2046
+ timeOut = null;
2047
+ }
2048
+ return _it(jsmIt, name, fn, timeOut);
2049
+ }
2050
+ exports.it = it;
2051
+ function xit(name, fn, timeOut) {
2052
+ if (timeOut === void 0) {
2053
+ timeOut = null;
2054
+ }
2055
+ return _it(jsmXIt, name, fn, timeOut);
2056
+ }
2057
+ exports.xit = xit;
2058
+ function iit(name, fn, timeOut) {
2059
+ if (timeOut === void 0) {
2060
+ timeOut = null;
2061
+ }
2062
+ return _it(jsmIIt, name, fn, timeOut);
2063
+ }
2064
+ exports.iit = iit;
2065
+ function fit(name, fn, timeOut) {
2066
+ if (timeOut === void 0) {
2067
+ timeOut = null;
2068
+ }
2069
+ return _it(jsmIIt, name, fn, timeOut);
2070
+ }
2071
+ exports.fit = fit;
2072
+ global.define = __define;
2073
+ return module.exports;
2074
+ });
2075
+
2076
+ System.register("angular2/testing", ["angular2/src/testing/testing", "angular2/src/testing/test_component_builder", "angular2/src/testing/test_injector", "angular2/src/testing/fake_async", "angular2/src/mock/view_resolver_mock", "angular2/src/compiler/xhr_mock", "angular2/src/mock/ng_zone_mock", "angular2/src/mock/mock_application_ref", "angular2/src/mock/directive_resolver_mock"], true, function(require, exports, module) {
2077
+ var global = System.global,
2078
+ __define = global.define;
2079
+ global.define = undefined;
2080
+ function __export(m) {
2081
+ for (var p in m)
2082
+ if (!exports.hasOwnProperty(p))
2083
+ exports[p] = m[p];
2084
+ }
2085
+ __export(require("angular2/src/testing/testing"));
2086
+ var test_component_builder_1 = require("angular2/src/testing/test_component_builder");
2087
+ exports.ComponentFixture = test_component_builder_1.ComponentFixture;
2088
+ exports.TestComponentBuilder = test_component_builder_1.TestComponentBuilder;
2089
+ __export(require("angular2/src/testing/test_injector"));
2090
+ __export(require("angular2/src/testing/fake_async"));
2091
+ var view_resolver_mock_1 = require("angular2/src/mock/view_resolver_mock");
2092
+ exports.MockViewResolver = view_resolver_mock_1.MockViewResolver;
2093
+ var xhr_mock_1 = require("angular2/src/compiler/xhr_mock");
2094
+ exports.MockXHR = xhr_mock_1.MockXHR;
2095
+ var ng_zone_mock_1 = require("angular2/src/mock/ng_zone_mock");
2096
+ exports.MockNgZone = ng_zone_mock_1.MockNgZone;
2097
+ var mock_application_ref_1 = require("angular2/src/mock/mock_application_ref");
2098
+ exports.MockApplicationRef = mock_application_ref_1.MockApplicationRef;
2099
+ var directive_resolver_mock_1 = require("angular2/src/mock/directive_resolver_mock");
2100
+ exports.MockDirectiveResolver = directive_resolver_mock_1.MockDirectiveResolver;
2101
+ global.define = __define;
2102
+ return module.exports;
2103
+ });
2104
+
2105
+ //# sourceMappingURL=testing.dev.js.map