UNPKG

78.1 kBJavaScriptView Raw
1var __extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/common"),require("@angular/core"),require("rxjs/Subject"),require("rxjs/observable/PromiseObservable"),require("rxjs/operator/toPromise"),require("rxjs/Observable"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define(["exports","@angular/common","@angular/core","rxjs/Subject","rxjs/observable/PromiseObservable","rxjs/operator/toPromise","rxjs/Observable","@angular/platform-browser"],factory):factory((global.ng=global.ng||{},global.ng.router_deprecated=global.ng.router_deprecated||{}),global.ng.common,global.ng.core,global.Rx,global.Rx,global.Rx.Observable.prototype,global.Rx,global.ng.platformBrowser)}(this,function(exports,_angular_common,_angular_core,rxjs_Subject,rxjs_observable_PromiseObservable,rxjs_operator_toPromise,rxjs_Observable,_angular_platformBrowser){"use strict";function getTypeNameForDebugging(type){return type.name?type.name:typeof type}function isPresent(obj){return void 0!==obj&&null!==obj}function isBlank(obj){return void 0===obj||null===obj}function isString(obj){return"string"==typeof obj}function isFunction(obj){return"function"==typeof obj}function isType(obj){return isFunction(obj)}function isStringMap(obj){return"object"==typeof obj&&null!==obj}function isArray(obj){return Array.isArray(obj)}function noop(){}function normalizeBlank(obj){return isBlank(obj)?null:obj}function _flattenArray(source,target){if(isPresent(source))for(var i=0;i<source.length;i++){var item=source[i];isArray(item)?_flattenArray(item,target):target.push(item)}return target}function hasLifecycleHook(e,type){return type instanceof _angular_core.Type?e.name in type.prototype:!1}function getCanActivateHook(type){for(var annotations=reflector.annotations(type),i=0;i<annotations.length;i+=1){var annotation=annotations[i];if(annotation instanceof CanActivateAnnotation)return annotation.fn}return null}function convertUrlParamsToArray(urlParams){var paramsArray=[];return isBlank(urlParams)?[]:(StringMapWrapper.forEach(urlParams,function(value,key){paramsArray.push(value===!0?key:key+"="+value)}),paramsArray)}function serializeParams(urlParams,joiner){return void 0===joiner&&(joiner="&"),convertUrlParamsToArray(urlParams).join(joiner)}function matchUrlSegment(str){var match=RegExpWrapper.firstMatch(SEGMENT_RE,str);return isPresent(match)?match[0]:""}function matchUrlQueryParamValue(str){var match=RegExpWrapper.firstMatch(QUERY_PARAM_VALUE_RE,str);return isPresent(match)?match[0]:""}function normalizeString(obj){return isBlank(obj)?null:obj.toString()}function encodeDynamicSegment(value){return isBlank(value)?null:(value=StringWrapper.replaceAll(value,REGEXP_PERCENT,"%25"),value=StringWrapper.replaceAll(value,REGEXP_SLASH,"%2F"),value=StringWrapper.replaceAll(value,REGEXP_OPEN_PARENT,"%28"),value=StringWrapper.replaceAll(value,REGEXP_CLOSE_PARENT,"%29"),value=StringWrapper.replaceAll(value,REGEXP_SEMICOLON,"%3B"))}function decodeDynamicSegment(value){return isBlank(value)?null:(value=StringWrapper.replaceAll(value,REGEXP_ENC_SEMICOLON,";"),value=StringWrapper.replaceAll(value,REGEXP_ENC_CLOSE_PARENT,")"),value=StringWrapper.replaceAll(value,REGEXP_ENC_OPEN_PARENT,"("),value=StringWrapper.replaceAll(value,REGEXP_ENC_SLASH,"/"),value=StringWrapper.replaceAll(value,REGEXP_ENC_PERCENT,"%"))}function computeNumberOfRegexGroups(regex){var test_regex=RegExpWrapper.create(regex+"|"),matcher=RegExpWrapper.matcher(test_regex,""),match=RegExpMatcherWrapper.next(matcher);return match.length}function normalizeRouteConfig(config,registry){if(config instanceof AsyncRoute){var wrappedLoader=wrapLoaderToReconfigureRegistry(config.loader,registry);return new AsyncRoute({path:config.path,loader:wrappedLoader,name:config.name,data:config.data,useAsDefault:config.useAsDefault})}if(config instanceof Route||config instanceof Redirect||config instanceof AuxRoute)return config;if(1!=+!!config.component+ +!!config.redirectTo+ +!!config.loader)throw new BaseException$1('Route config should contain exactly one "component", "loader", or "redirectTo" property.');if(config.loader){var wrappedLoader=wrapLoaderToReconfigureRegistry(config.loader,registry);return new AsyncRoute({path:config.path,loader:wrappedLoader,name:config.name,data:config.data,useAsDefault:config.useAsDefault})}if(config.aux)return new AuxRoute({path:config.aux,component:config.component,name:config.name});if(config.component){if("object"==typeof config.component){var componentDefinitionObject=config.component;if("constructor"==componentDefinitionObject.type)return new Route({path:config.path,component:componentDefinitionObject.constructor,name:config.name,data:config.data,useAsDefault:config.useAsDefault});if("loader"==componentDefinitionObject.type)return new AsyncRoute({path:config.path,loader:componentDefinitionObject.loader,name:config.name,data:config.data,useAsDefault:config.useAsDefault});throw new BaseException$1('Invalid component type "'+componentDefinitionObject.type+'". Valid types are "constructor" and "loader".')}return new Route(config)}return config.redirectTo?new Redirect({path:config.path,redirectTo:config.redirectTo}):config}function wrapLoaderToReconfigureRegistry(loader,registry){return function(){return loader().then(function(componentType){return registry.configFromComponent(componentType),componentType})}}function assertComponentExists(component,path){if(!isType(component))throw new BaseException$1('Component for route "'+path+'" is not defined, or is not a class.')}function splitAndFlattenLinkParams(linkParams){var accumulation=[];return linkParams.forEach(function(item){if(isString(item)){var strItem=item;accumulation=accumulation.concat(strItem.split("/"))}else accumulation.push(item)}),accumulation}function mostSpecific(instructions){if(instructions=instructions.filter(function(instruction){return isPresent(instruction)}),0==instructions.length)return null;if(1==instructions.length)return instructions[0];var first=instructions[0],rest=instructions.slice(1);return rest.reduce(function(instruction,contender){return-1==compareSpecificityStrings(contender.specificity,instruction.specificity)?contender:instruction},first)}function compareSpecificityStrings(a,b){for(var l=Math.min(a.length,b.length),i=0;l>i;i+=1){var ai=StringWrapper.charCodeAt(a,i),bi=StringWrapper.charCodeAt(b,i),difference=bi-ai;if(0!=difference)return difference}return a.length-b.length}function assertTerminalComponent(component,path){if(isType(component)){var annotations=reflector.annotations(component);if(isPresent(annotations))for(var i=0;i<annotations.length;i++){var annotation=annotations[i];if(annotation instanceof RouteConfigAnnotation)throw new BaseException$1('Child routes are not allowed for "'+path+'". Use "..." on the parent\'s route path.')}}}function canActivateOne(nextInstruction,prevInstruction){var next=_resolveToTrue;return isBlank(nextInstruction.component)?next:(isPresent(nextInstruction.child)&&(next=canActivateOne(nextInstruction.child,isPresent(prevInstruction)?prevInstruction.child:null)),next.then(function(result){if(0==result)return!1;if(nextInstruction.component.reuse)return!0;var hook=getCanActivateHook(nextInstruction.component.componentType);return isPresent(hook)?hook(nextInstruction.component,isPresent(prevInstruction)?prevInstruction.component:null):!0}))}function routerFactory(registry,location,primaryComponent,appRef){var rootRouter=new exports.RootRouter(registry,location,primaryComponent);return appRef.registerDisposeListener(function(){return rootRouter.dispose()}),rootRouter}function routerPrimaryComponentFactory(app){if(0==app.componentTypes.length)throw new BaseException$1("Bootstrap at least one component before injecting Router.");return app.componentTypes[0]}var globalScope;globalScope="undefined"==typeof window?"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:global:window;var global$1=globalScope,Type$1=Function,Math=global$1.Math;global$1.assert=function(){};var StringWrapper=function(){function StringWrapper(){}return StringWrapper.fromCharCode=function(code){return String.fromCharCode(code)},StringWrapper.charCodeAt=function(s,index){return s.charCodeAt(index)},StringWrapper.split=function(s,regExp){return s.split(regExp)},StringWrapper.equals=function(s,s2){return s===s2},StringWrapper.stripLeft=function(s,charVal){if(s&&s.length){for(var pos=0,i=0;i<s.length&&s[i]==charVal;i++)pos++;s=s.substring(pos)}return s},StringWrapper.stripRight=function(s,charVal){if(s&&s.length){for(var pos=s.length,i=s.length-1;i>=0&&s[i]==charVal;i--)pos--;s=s.substring(0,pos)}return s},StringWrapper.replace=function(s,from,replace){return s.replace(from,replace)},StringWrapper.replaceAll=function(s,from,replace){return s.replace(from,replace)},StringWrapper.slice=function(s,from,to){return void 0===from&&(from=0),void 0===to&&(to=null),s.slice(from,null===to?void 0:to)},StringWrapper.replaceAllMapped=function(s,from,cb){return s.replace(from,function(){for(var matches=[],_i=0;_i<arguments.length;_i++)matches[_i-0]=arguments[_i];return matches.splice(-2,2),cb(matches)})},StringWrapper.contains=function(s,substr){return-1!=s.indexOf(substr)},StringWrapper.compare=function(a,b){return b>a?-1:a>b?1:0},StringWrapper}(),RegExpWrapper=function(){function RegExpWrapper(){}return RegExpWrapper.create=function(regExpStr,flags){return void 0===flags&&(flags=""),flags=flags.replace(/g/g,""),new global$1.RegExp(regExpStr,flags+"g")},RegExpWrapper.firstMatch=function(regExp,input){return regExp.lastIndex=0,regExp.exec(input)},RegExpWrapper.test=function(regExp,input){return regExp.lastIndex=0,regExp.test(input)},RegExpWrapper.matcher=function(regExp,input){return regExp.lastIndex=0,{re:regExp,input:input}},RegExpWrapper.replaceAll=function(regExp,input,replace){var c=regExp.exec(input),res="";regExp.lastIndex=0;for(var prev=0;c;)res+=input.substring(prev,c.index),res+=replace(c),prev=c.index+c[0].length,regExp.lastIndex=prev,c=regExp.exec(input);return res+=input.substring(prev)},RegExpWrapper}(),RegExpMatcherWrapper=function(){function RegExpMatcherWrapper(){}return RegExpMatcherWrapper.next=function(matcher){return matcher.re.exec(matcher.input)},RegExpMatcherWrapper}(),PromiseCompleter=function(){function PromiseCompleter(){var _this=this;this.promise=new Promise(function(res,rej){_this.resolve=res,_this.reject=rej})}return PromiseCompleter}(),PromiseWrapper=function(){function PromiseWrapper(){}return PromiseWrapper.resolve=function(obj){return Promise.resolve(obj)},PromiseWrapper.reject=function(obj){return Promise.reject(obj)},PromiseWrapper.catchError=function(promise,onError){return promise.catch(onError)},PromiseWrapper.all=function(promises){return 0==promises.length?Promise.resolve([]):Promise.all(promises)},PromiseWrapper.then=function(promise,success,rejection){return promise.then(success,rejection)},PromiseWrapper.wrap=function(computation){return new Promise(function(res,rej){try{res(computation())}catch(e){rej(e)}})},PromiseWrapper.scheduleMicrotask=function(computation){PromiseWrapper.then(PromiseWrapper.resolve(null),computation,function(){})},PromiseWrapper.isPromise=function(obj){return obj instanceof Promise},PromiseWrapper.completer=function(){return new PromiseCompleter},PromiseWrapper}(),ObservableWrapper=function(){function ObservableWrapper(){}return ObservableWrapper.subscribe=function(emitter,onNext,onError,onComplete){return void 0===onComplete&&(onComplete=function(){}),onError="function"==typeof onError&&onError||noop,onComplete="function"==typeof onComplete&&onComplete||noop,emitter.subscribe({next:onNext,error:onError,complete:onComplete})},ObservableWrapper.isObservable=function(obs){return!!obs.subscribe},ObservableWrapper.hasSubscribers=function(obs){return obs.observers.length>0},ObservableWrapper.dispose=function(subscription){subscription.unsubscribe()},ObservableWrapper.callNext=function(emitter,value){emitter.next(value)},ObservableWrapper.callEmit=function(emitter,value){emitter.emit(value)},ObservableWrapper.callError=function(emitter,error){emitter.error(error)},ObservableWrapper.callComplete=function(emitter){emitter.complete()},ObservableWrapper.fromPromise=function(promise){return rxjs_observable_PromiseObservable.PromiseObservable.create(promise)},ObservableWrapper.toPromise=function(obj){return rxjs_operator_toPromise.toPromise.call(obj)},ObservableWrapper}(),EventEmitter=function(_super){function EventEmitter(isAsync){void 0===isAsync&&(isAsync=!1),_super.call(this),this.__isAsync=isAsync}return __extends(EventEmitter,_super),EventEmitter.prototype.emit=function(value){_super.prototype.next.call(this,value)},EventEmitter.prototype.next=function(value){_super.prototype.next.call(this,value)},EventEmitter.prototype.subscribe=function(generatorOrNext,error,complete){var schedulerFn,errorFn=function(){return null},completeFn=function(){return null};return generatorOrNext&&"object"==typeof generatorOrNext?(schedulerFn=this.__isAsync?function(value){setTimeout(function(){return generatorOrNext.next(value)})}:function(value){generatorOrNext.next(value)},generatorOrNext.error&&(errorFn=this.__isAsync?function(err){setTimeout(function(){return generatorOrNext.error(err)})}:function(err){generatorOrNext.error(err)}),generatorOrNext.complete&&(completeFn=this.__isAsync?function(){setTimeout(function(){return generatorOrNext.complete()})}:function(){generatorOrNext.complete()})):(schedulerFn=this.__isAsync?function(value){setTimeout(function(){return generatorOrNext(value)})}:function(value){generatorOrNext(value)},error&&(errorFn=this.__isAsync?function(err){setTimeout(function(){return error(err)})}:function(err){error(err)}),complete&&(completeFn=this.__isAsync?function(){setTimeout(function(){return complete()})}:function(){complete()})),_super.prototype.subscribe.call(this,schedulerFn,errorFn,completeFn)},EventEmitter}(rxjs_Subject.Subject),Map$1=global$1.Map,Set=global$1.Set;!function(){try{if(1===new Map$1([[1,2]]).size)return function(pairs){return new Map$1(pairs)}}catch(e){}return function(pairs){for(var map=new Map$1,i=0;i<pairs.length;i++){var pair=pairs[i];map.set(pair[0],pair[1])}return map}}(),function(){try{if(new Map$1(new Map$1))return function(m){return new Map$1(m)}}catch(e){}return function(m){var map=new Map$1;return m.forEach(function(v,k){map.set(k,v)}),map}}(),function(){return(new Map$1).keys().next?function(m){for(var k,keyIterator=m.keys();!(k=keyIterator.next()).done;)m.set(k.value,null)}:function(m){m.forEach(function(v,k){m.set(k,null)})}}(),function(){try{if((new Map$1).values().next)return function(m,getValues){return getValues?Array.from(m.values()):Array.from(m.keys())}}catch(e){}return function(m,getValues){var res=ListWrapper.createFixedSize(m.size),i=0;return m.forEach(function(v,k){res[i]=getValues?v:k,i++}),res}}();var StringMapWrapper=function(){function StringMapWrapper(){}return StringMapWrapper.create=function(){return{}},StringMapWrapper.contains=function(map,key){return map.hasOwnProperty(key)},StringMapWrapper.get=function(map,key){return map.hasOwnProperty(key)?map[key]:void 0},StringMapWrapper.set=function(map,key,value){map[key]=value},StringMapWrapper.keys=function(map){return Object.keys(map)},StringMapWrapper.values=function(map){return Object.keys(map).reduce(function(r,a){return r.push(map[a]),r},[])},StringMapWrapper.isEmpty=function(map){for(var prop in map)return!1;return!0},StringMapWrapper.delete=function(map,key){delete map[key]},StringMapWrapper.forEach=function(map,callback){for(var prop in map)map.hasOwnProperty(prop)&&callback(map[prop],prop)},StringMapWrapper.merge=function(m1,m2){var m={};for(var attr in m1)m1.hasOwnProperty(attr)&&(m[attr]=m1[attr]);for(var attr in m2)m2.hasOwnProperty(attr)&&(m[attr]=m2[attr]);return m},StringMapWrapper.equals=function(m1,m2){var k1=Object.keys(m1),k2=Object.keys(m2);if(k1.length!=k2.length)return!1;for(var key,i=0;i<k1.length;i++)if(key=k1[i],m1[key]!==m2[key])return!1;return!0},StringMapWrapper}(),ListWrapper=function(){function ListWrapper(){}return ListWrapper.createFixedSize=function(size){return new Array(size)},ListWrapper.createGrowableSize=function(size){return new Array(size)},ListWrapper.clone=function(array){return array.slice(0)},ListWrapper.forEachWithIndex=function(array,fn){for(var i=0;i<array.length;i++)fn(array[i],i)},ListWrapper.first=function(array){return array?array[0]:null},ListWrapper.last=function(array){return array&&0!=array.length?array[array.length-1]:null},ListWrapper.indexOf=function(array,value,startIndex){return void 0===startIndex&&(startIndex=0),array.indexOf(value,startIndex)},ListWrapper.contains=function(list,el){return-1!==list.indexOf(el)},ListWrapper.reversed=function(array){var a=ListWrapper.clone(array);return a.reverse()},ListWrapper.concat=function(a,b){return a.concat(b)},ListWrapper.insert=function(list,index,value){list.splice(index,0,value)},ListWrapper.removeAt=function(list,index){var res=list[index];return list.splice(index,1),res},ListWrapper.removeAll=function(list,items){for(var i=0;i<items.length;++i){var index=list.indexOf(items[i]);list.splice(index,1)}},ListWrapper.remove=function(list,el){var index=list.indexOf(el);return index>-1?(list.splice(index,1),!0):!1},ListWrapper.clear=function(list){list.length=0},ListWrapper.isEmpty=function(list){return 0==list.length},ListWrapper.fill=function(list,value,start,end){void 0===start&&(start=0),void 0===end&&(end=null),list.fill(value,start,null===end?list.length:end)},ListWrapper.equals=function(a,b){if(a.length!=b.length)return!1;for(var i=0;i<a.length;++i)if(a[i]!==b[i])return!1;return!0},ListWrapper.slice=function(l,from,to){return void 0===from&&(from=0),void 0===to&&(to=null),l.slice(from,null===to?void 0:to)},ListWrapper.splice=function(l,from,length){return l.splice(from,length)},ListWrapper.sort=function(l,compareFn){isPresent(compareFn)?l.sort(compareFn):l.sort()},ListWrapper.toString=function(l){return l.toString()},ListWrapper.toJSON=function(l){return JSON.stringify(l)},ListWrapper.maximum=function(list,predicate){if(0==list.length)return null;for(var solution=null,maxValue=-1/0,index=0;index<list.length;index++){var candidate=list[index];if(!isBlank(candidate)){var candidateValue=predicate(candidate);candidateValue>maxValue&&(solution=candidate,maxValue=candidateValue)}}return solution},ListWrapper.flatten=function(list){var target=[];return _flattenArray(list,target),target},ListWrapper.addAll=function(list,source){for(var i=0;i<source.length;i++)list.push(source[i])},ListWrapper}();!function(){var test=new Set([1,2,3]);return 3===test.size?function(lst){return new Set(lst)}:function(lst){var res=new Set(lst);if(res.size!==lst.length)for(var i=0;i<lst.length;i++)res.add(lst[i]);return res}}();var BaseException$1=function(_super){function BaseException$1(message){void 0===message&&(message="--"),_super.call(this,message),this.message=message,this.stack=new Error(message).stack}return __extends(BaseException$1,_super),BaseException$1.prototype.toString=function(){return this.message},BaseException$1}(Error),RouteParams=function(){function RouteParams(params){this.params=params}return RouteParams.prototype.get=function(param){return normalizeBlank(StringMapWrapper.get(this.params,param))},RouteParams}(),RouteData=function(){function RouteData(data){void 0===data&&(data={}),this.data=data}return RouteData.prototype.get=function(key){return normalizeBlank(StringMapWrapper.get(this.data,key))},RouteData}(),BLANK_ROUTE_DATA=new RouteData,Instruction=function(){function Instruction(component,child,auxInstruction){this.component=component,this.child=child,this.auxInstruction=auxInstruction}return Object.defineProperty(Instruction.prototype,"urlPath",{get:function(){return isPresent(this.component)?this.component.urlPath:""},enumerable:!0,configurable:!0}),Object.defineProperty(Instruction.prototype,"urlParams",{get:function(){return isPresent(this.component)?this.component.urlParams:[]},enumerable:!0,configurable:!0}),Object.defineProperty(Instruction.prototype,"specificity",{get:function(){var total="";return isPresent(this.component)&&(total+=this.component.specificity),isPresent(this.child)&&(total+=this.child.specificity),total},enumerable:!0,configurable:!0}),Instruction.prototype.toRootUrl=function(){return this.toUrlPath()+this.toUrlQuery()},Instruction.prototype._toNonRootUrl=function(){return this._stringifyPathMatrixAuxPrefixed()+(isPresent(this.child)?this.child._toNonRootUrl():"")},Instruction.prototype.toUrlQuery=function(){return this.urlParams.length>0?"?"+this.urlParams.join("&"):""},Instruction.prototype.replaceChild=function(child){return new ResolvedInstruction(this.component,child,this.auxInstruction)},Instruction.prototype.toUrlPath=function(){return this.urlPath+this._stringifyAux()+(isPresent(this.child)?this.child._toNonRootUrl():"")},Instruction.prototype.toLinkUrl=function(){return this.urlPath+this._stringifyAux()+(isPresent(this.child)?this.child._toLinkUrl():"")+this.toUrlQuery()},Instruction.prototype._toLinkUrl=function(){return this._stringifyPathMatrixAuxPrefixed()+(isPresent(this.child)?this.child._toLinkUrl():"")},Instruction.prototype._stringifyPathMatrixAuxPrefixed=function(){var primary=this._stringifyPathMatrixAux();return primary.length>0&&(primary="/"+primary),primary},Instruction.prototype._stringifyMatrixParams=function(){return this.urlParams.length>0?";"+this.urlParams.join(";"):""},Instruction.prototype._stringifyPathMatrixAux=function(){return isBlank(this.component)&&isBlank(this.urlPath)?"":this.urlPath+this._stringifyMatrixParams()+this._stringifyAux()},Instruction.prototype._stringifyAux=function(){var routes=[];return StringMapWrapper.forEach(this.auxInstruction,function(auxInstruction){routes.push(auxInstruction._stringifyPathMatrixAux())}),routes.length>0?"("+routes.join("//")+")":""},Instruction}(),ResolvedInstruction=function(_super){function ResolvedInstruction(component,child,auxInstruction){_super.call(this,component,child,auxInstruction)}return __extends(ResolvedInstruction,_super),ResolvedInstruction.prototype.resolveComponent=function(){return PromiseWrapper.resolve(this.component)},ResolvedInstruction}(Instruction),DefaultInstruction=function(_super){function DefaultInstruction(component,child){_super.call(this,component,child,{})}return __extends(DefaultInstruction,_super),DefaultInstruction.prototype.toLinkUrl=function(){return""},DefaultInstruction.prototype._toLinkUrl=function(){return""},DefaultInstruction}(ResolvedInstruction),UnresolvedInstruction=function(_super){function UnresolvedInstruction(_resolver,_urlPath,_urlParams){void 0===_urlPath&&(_urlPath=""),void 0===_urlParams&&(_urlParams=[]),_super.call(this,null,null,{}),this._resolver=_resolver,this._urlPath=_urlPath,this._urlParams=_urlParams}return __extends(UnresolvedInstruction,_super),Object.defineProperty(UnresolvedInstruction.prototype,"urlPath",{get:function(){return isPresent(this.component)?this.component.urlPath:isPresent(this._urlPath)?this._urlPath:""},enumerable:!0,configurable:!0}),Object.defineProperty(UnresolvedInstruction.prototype,"urlParams",{get:function(){return isPresent(this.component)?this.component.urlParams:isPresent(this._urlParams)?this._urlParams:[]},enumerable:!0,configurable:!0}),UnresolvedInstruction.prototype.resolveComponent=function(){var _this=this;return isPresent(this.component)?PromiseWrapper.resolve(this.component):this._resolver().then(function(instruction){return _this.child=isPresent(instruction)?instruction.child:null,_this.component=isPresent(instruction)?instruction.component:null})},UnresolvedInstruction}(Instruction),RedirectInstruction=function(_super){function RedirectInstruction(component,child,auxInstruction,_specificity){_super.call(this,component,child,auxInstruction),this._specificity=_specificity}return __extends(RedirectInstruction,_super),Object.defineProperty(RedirectInstruction.prototype,"specificity",{get:function(){return this._specificity},enumerable:!0,configurable:!0}),RedirectInstruction}(ResolvedInstruction),ComponentInstruction=function(){function ComponentInstruction(urlPath,urlParams,data,componentType,terminal,specificity,params,routeName){void 0===params&&(params=null),this.urlPath=urlPath,this.urlParams=urlParams,this.componentType=componentType,this.terminal=terminal,this.specificity=specificity,this.params=params,this.routeName=routeName,this.reuse=!1,this.routeData=isPresent(data)?data:BLANK_ROUTE_DATA}return ComponentInstruction}(),makeDecorator=_angular_core.__core_private__.makeDecorator,reflector=_angular_core.__core_private__.reflector,RouteLifecycleHook=function(){function RouteLifecycleHook(name){this.name=name}return RouteLifecycleHook}(),CanActivateAnnotation=function(){function CanActivateAnnotation(fn){this.fn=fn}return CanActivateAnnotation}(),routerCanReuse=new RouteLifecycleHook("routerCanReuse"),routerCanDeactivate=new RouteLifecycleHook("routerCanDeactivate"),routerOnActivate=new RouteLifecycleHook("routerOnActivate"),routerOnReuse=new RouteLifecycleHook("routerOnReuse"),routerOnDeactivate=new RouteLifecycleHook("routerOnDeactivate"),RouteConfigAnnotation=function(){function RouteConfigAnnotation(configs){this.configs=configs}return RouteConfigAnnotation}(),AbstractRoute=function(){function AbstractRoute(_a){var name=_a.name,useAsDefault=_a.useAsDefault,path=_a.path,regex=_a.regex,regex_group_names=_a.regex_group_names,serializer=_a.serializer,data=_a.data;this.name=name,this.useAsDefault=useAsDefault,this.path=path,this.regex=regex,this.regex_group_names=regex_group_names,this.serializer=serializer,this.data=data}return AbstractRoute}(),Route=function(_super){function Route(_a){var name=_a.name,useAsDefault=_a.useAsDefault,path=_a.path,regex=_a.regex,regex_group_names=_a.regex_group_names,serializer=_a.serializer,data=_a.data,component=_a.component;_super.call(this,{name:name,useAsDefault:useAsDefault,path:path,regex:regex,regex_group_names:regex_group_names,serializer:serializer,data:data}),this.aux=null,this.component=component}return __extends(Route,_super),Route}(AbstractRoute),AuxRoute=function(_super){function AuxRoute(_a){var name=_a.name,useAsDefault=_a.useAsDefault,path=_a.path,regex=_a.regex,regex_group_names=_a.regex_group_names,serializer=_a.serializer,data=_a.data,component=_a.component;_super.call(this,{name:name,useAsDefault:useAsDefault,path:path,regex:regex,regex_group_names:regex_group_names,serializer:serializer,data:data}),this.component=component}return __extends(AuxRoute,_super),AuxRoute}(AbstractRoute),AsyncRoute=function(_super){function AsyncRoute(_a){var name=_a.name,useAsDefault=_a.useAsDefault,path=_a.path,regex=_a.regex,regex_group_names=_a.regex_group_names,serializer=_a.serializer,data=_a.data,loader=_a.loader;_super.call(this,{name:name,useAsDefault:useAsDefault,path:path,regex:regex,regex_group_names:regex_group_names,serializer:serializer,data:data}),this.aux=null,this.loader=loader}return __extends(AsyncRoute,_super),AsyncRoute}(AbstractRoute),Redirect=function(_super){function Redirect(_a){var name=_a.name,useAsDefault=_a.useAsDefault,path=_a.path,regex=_a.regex,regex_group_names=_a.regex_group_names,serializer=_a.serializer,data=_a.data,redirectTo=_a.redirectTo;_super.call(this,{name:name,useAsDefault:useAsDefault,path:path,regex:regex,regex_group_names:regex_group_names,serializer:serializer,data:data}),this.redirectTo=redirectTo}return __extends(Redirect,_super),Redirect}(AbstractRoute),Url=function(){function Url(path,child,auxiliary,params){void 0===child&&(child=null),void 0===auxiliary&&(auxiliary=[]),void 0===params&&(params={}),this.path=path,this.child=child,this.auxiliary=auxiliary,this.params=params}return Url.prototype.toString=function(){return this.path+this._matrixParamsToString()+this._auxToString()+this._childString()},Url.prototype.segmentToString=function(){return this.path+this._matrixParamsToString()},Url.prototype._auxToString=function(){return this.auxiliary.length>0?"("+this.auxiliary.map(function(sibling){return sibling.toString()}).join("//")+")":""},Url.prototype._matrixParamsToString=function(){var paramString=serializeParams(this.params,";");return paramString.length>0?";"+paramString:""},Url.prototype._childString=function(){return isPresent(this.child)?"/"+this.child.toString():""},Url}(),RootUrl=function(_super){function RootUrl(path,child,auxiliary,params){void 0===child&&(child=null),void 0===auxiliary&&(auxiliary=[]),void 0===params&&(params=null),_super.call(this,path,child,auxiliary,params)}return __extends(RootUrl,_super),RootUrl.prototype.toString=function(){return this.path+this._auxToString()+this._childString()+this._queryParamsToString()},RootUrl.prototype.segmentToString=function(){return this.path+this._queryParamsToString()},RootUrl.prototype._queryParamsToString=function(){return isBlank(this.params)?"":"?"+serializeParams(this.params)},RootUrl}(Url),SEGMENT_RE=RegExpWrapper.create("^[^\\/\\(\\)\\?;=&#]+"),QUERY_PARAM_VALUE_RE=RegExpWrapper.create("^[^\\(\\)\\?;&#]+"),UrlParser=function(){function UrlParser(){}return UrlParser.prototype.peekStartsWith=function(str){return this._remaining.startsWith(str)},UrlParser.prototype.capture=function(str){if(!this._remaining.startsWith(str))throw new BaseException$1('Expected "'+str+'".');this._remaining=this._remaining.substring(str.length)},UrlParser.prototype.parse=function(url){return this._remaining=url,""==url||"/"==url?new Url(""):this.parseRoot()},UrlParser.prototype.parseRoot=function(){this.peekStartsWith("/")&&this.capture("/");var path=matchUrlSegment(this._remaining);this.capture(path);var aux=[];this.peekStartsWith("(")&&(aux=this.parseAuxiliaryRoutes()),this.peekStartsWith(";")&&this.parseMatrixParams();var child=null;this.peekStartsWith("/")&&!this.peekStartsWith("//")&&(this.capture("/"),child=this.parseSegment());var queryParams=null;return this.peekStartsWith("?")&&(queryParams=this.parseQueryParams()),new RootUrl(path,child,aux,queryParams)},UrlParser.prototype.parseSegment=function(){if(0==this._remaining.length)return null;this.peekStartsWith("/")&&this.capture("/");var path=matchUrlSegment(this._remaining);this.capture(path);var matrixParams=null;this.peekStartsWith(";")&&(matrixParams=this.parseMatrixParams());var aux=[];this.peekStartsWith("(")&&(aux=this.parseAuxiliaryRoutes());var child=null;return this.peekStartsWith("/")&&!this.peekStartsWith("//")&&(this.capture("/"),child=this.parseSegment()),new Url(path,child,aux,matrixParams)},UrlParser.prototype.parseQueryParams=function(){var params={};for(this.capture("?"),this.parseQueryParam(params);this._remaining.length>0&&this.peekStartsWith("&");)this.capture("&"),this.parseQueryParam(params);return params},UrlParser.prototype.parseMatrixParams=function(){for(var params={};this._remaining.length>0&&this.peekStartsWith(";");)this.capture(";"),this.parseParam(params);return params},UrlParser.prototype.parseParam=function(params){var key=matchUrlSegment(this._remaining);if(!isBlank(key)){this.capture(key);var value=!0;if(this.peekStartsWith("=")){this.capture("=");var valueMatch=matchUrlSegment(this._remaining);isPresent(valueMatch)&&(value=valueMatch,this.capture(value))}params[key]=value}},UrlParser.prototype.parseQueryParam=function(params){var key=matchUrlSegment(this._remaining);if(!isBlank(key)){this.capture(key);var value=!0;if(this.peekStartsWith("=")){this.capture("=");var valueMatch=matchUrlQueryParamValue(this._remaining);isPresent(valueMatch)&&(value=valueMatch,this.capture(value))}params[key]=value}},UrlParser.prototype.parseAuxiliaryRoutes=function(){var routes=[];for(this.capture("(");!this.peekStartsWith(")")&&this._remaining.length>0;)routes.push(this.parseSegment()),this.peekStartsWith("//")&&this.capture("//");
2return this.capture(")"),routes},UrlParser}(),parser=new UrlParser,RouteMatch=function(){function RouteMatch(){}return RouteMatch}(),PathMatch=function(_super){function PathMatch(instruction,remaining,remainingAux){_super.call(this),this.instruction=instruction,this.remaining=remaining,this.remainingAux=remainingAux}return __extends(PathMatch,_super),PathMatch}(RouteMatch),RedirectMatch=function(_super){function RedirectMatch(redirectTo,specificity){_super.call(this),this.redirectTo=redirectTo,this.specificity=specificity}return __extends(RedirectMatch,_super),RedirectMatch}(RouteMatch),RedirectRule=function(){function RedirectRule(_pathRecognizer,redirectTo){this._pathRecognizer=_pathRecognizer,this.redirectTo=redirectTo,this.hash=this._pathRecognizer.hash}return Object.defineProperty(RedirectRule.prototype,"path",{get:function(){return this._pathRecognizer.toString()},set:function(){throw new BaseException$1("you cannot set the path of a RedirectRule directly")},enumerable:!0,configurable:!0}),RedirectRule.prototype.recognize=function(beginningSegment){var match=null;return isPresent(this._pathRecognizer.matchUrl(beginningSegment))&&(match=new RedirectMatch(this.redirectTo,this._pathRecognizer.specificity)),PromiseWrapper.resolve(match)},RedirectRule.prototype.generate=function(){throw new BaseException$1("Tried to generate a redirect.")},RedirectRule}(),RouteRule=function(){function RouteRule(_routePath,handler,_routeName){this._routePath=_routePath,this.handler=handler,this._routeName=_routeName,this._cache=new Map$1,this.specificity=this._routePath.specificity,this.hash=this._routePath.hash,this.terminal=this._routePath.terminal}return Object.defineProperty(RouteRule.prototype,"path",{get:function(){return this._routePath.toString()},set:function(){throw new BaseException$1("you cannot set the path of a RouteRule directly")},enumerable:!0,configurable:!0}),RouteRule.prototype.recognize=function(beginningSegment){var _this=this,res=this._routePath.matchUrl(beginningSegment);return isBlank(res)?null:this.handler.resolveComponentType().then(function(){var componentInstruction=_this._getInstruction(res.urlPath,res.urlParams,res.allParams);return new PathMatch(componentInstruction,res.rest,res.auxiliary)})},RouteRule.prototype.generate=function(params){var generated=this._routePath.generateUrl(params),urlPath=generated.urlPath,urlParams=generated.urlParams;return this._getInstruction(urlPath,convertUrlParamsToArray(urlParams),params)},RouteRule.prototype.generateComponentPathValues=function(params){return this._routePath.generateUrl(params)},RouteRule.prototype._getInstruction=function(urlPath,urlParams,params){if(isBlank(this.handler.componentType))throw new BaseException$1("Tried to get instruction before the type was loaded.");var hashKey=urlPath+"?"+urlParams.join("&");if(this._cache.has(hashKey))return this._cache.get(hashKey);var instruction=new ComponentInstruction(urlPath,urlParams,this.handler.data,this.handler.componentType,this.terminal,this.specificity,params,this._routeName);return this._cache.set(hashKey,instruction),instruction},RouteRule}(),AsyncRouteHandler=function(){function AsyncRouteHandler(_loader,data){void 0===data&&(data=null),this._loader=_loader,this._resolvedComponent=null,this.data=isPresent(data)?new RouteData(data):BLANK_ROUTE_DATA}return AsyncRouteHandler.prototype.resolveComponentType=function(){var _this=this;return isPresent(this._resolvedComponent)?this._resolvedComponent:this._resolvedComponent=this._loader().then(function(componentType){return _this.componentType=componentType,componentType})},AsyncRouteHandler}(),SyncRouteHandler=function(){function SyncRouteHandler(componentType,data){this.componentType=componentType,this._resolvedComponent=null,this._resolvedComponent=PromiseWrapper.resolve(componentType),this.data=isPresent(data)?new RouteData(data):BLANK_ROUTE_DATA}return SyncRouteHandler.prototype.resolveComponentType=function(){return this._resolvedComponent},SyncRouteHandler}(),TouchMap=function(){function TouchMap(map){var _this=this;this.map={},this.keys={},isPresent(map)&&StringMapWrapper.forEach(map,function(value,key){_this.map[key]=isPresent(value)?value.toString():null,_this.keys[key]=!0})}return TouchMap.prototype.get=function(key){return StringMapWrapper.delete(this.keys,key),this.map[key]},TouchMap.prototype.getUnused=function(){var _this=this,unused={},keys=StringMapWrapper.keys(this.keys);return keys.forEach(function(key){return unused[key]=StringMapWrapper.get(_this.map,key)}),unused},TouchMap}(),MatchedUrl=function(){function MatchedUrl(urlPath,urlParams,allParams,auxiliary,rest){this.urlPath=urlPath,this.urlParams=urlParams,this.allParams=allParams,this.auxiliary=auxiliary,this.rest=rest}return MatchedUrl}(),GeneratedUrl=function(){function GeneratedUrl(urlPath,urlParams){this.urlPath=urlPath,this.urlParams=urlParams}return GeneratedUrl}(),ContinuationPathSegment=function(){function ContinuationPathSegment(){this.name="",this.specificity="",this.hash="..."}return ContinuationPathSegment.prototype.generate=function(){return""},ContinuationPathSegment.prototype.match=function(){return!0},ContinuationPathSegment}(),StaticPathSegment=function(){function StaticPathSegment(path){this.path=path,this.name="",this.specificity="2",this.hash=path}return StaticPathSegment.prototype.match=function(path){return path==this.path},StaticPathSegment.prototype.generate=function(){return this.path},StaticPathSegment}(),DynamicPathSegment=function(){function DynamicPathSegment(name){this.name=name,this.specificity="1",this.hash=":"}return DynamicPathSegment.prototype.match=function(path){return path.length>0},DynamicPathSegment.prototype.generate=function(params){if(!StringMapWrapper.contains(params.map,this.name))throw new BaseException$1("Route generator for '"+this.name+"' was not included in parameters passed.");return encodeDynamicSegment(normalizeString(params.get(this.name)))},DynamicPathSegment}();DynamicPathSegment.paramMatcher=/^:([^\/]+)$/g;var StarPathSegment=function(){function StarPathSegment(name){this.name=name,this.specificity="0",this.hash="*"}return StarPathSegment.prototype.match=function(){return!0},StarPathSegment.prototype.generate=function(params){return normalizeString(params.get(this.name))},StarPathSegment}();StarPathSegment.wildcardMatcher=/^\*([^\/]+)$/g;var ParamRoutePath=function(){function ParamRoutePath(routePath){this.routePath=routePath,this.terminal=!0,this._assertValidPath(routePath),this._parsePathString(routePath),this.specificity=this._calculateSpecificity(),this.hash=this._calculateHash();var lastSegment=this._segments[this._segments.length-1];this.terminal=!(lastSegment instanceof ContinuationPathSegment)}return ParamRoutePath.prototype.matchUrl=function(url){for(var currentUrlSegment,nextUrlSegment=url,positionalParams={},captured=[],i=0;i<this._segments.length;i+=1){var pathSegment=this._segments[i];if(pathSegment instanceof ContinuationPathSegment)break;if(currentUrlSegment=nextUrlSegment,isPresent(currentUrlSegment)){if(pathSegment instanceof StarPathSegment){positionalParams[pathSegment.name]=currentUrlSegment.toString(),captured.push(currentUrlSegment.toString()),nextUrlSegment=null;break}if(captured.push(currentUrlSegment.path),pathSegment instanceof DynamicPathSegment)positionalParams[pathSegment.name]=decodeDynamicSegment(currentUrlSegment.path);else if(!pathSegment.match(currentUrlSegment.path))return null;nextUrlSegment=currentUrlSegment.child}else if(!pathSegment.match(""))return null}if(this.terminal&&isPresent(nextUrlSegment))return null;var urlPath=captured.join("/"),auxiliary=[],urlParams=[],allParams=positionalParams;if(isPresent(currentUrlSegment)){var paramsSegment=url instanceof RootUrl?url:currentUrlSegment;isPresent(paramsSegment.params)?(allParams=StringMapWrapper.merge(paramsSegment.params,positionalParams),urlParams=convertUrlParamsToArray(paramsSegment.params)):allParams=positionalParams,auxiliary=currentUrlSegment.auxiliary}return new MatchedUrl(urlPath,urlParams,allParams,auxiliary,nextUrlSegment)},ParamRoutePath.prototype.generateUrl=function(params){for(var paramTokens=new TouchMap(params),path=[],i=0;i<this._segments.length;i++){var segment=this._segments[i];segment instanceof ContinuationPathSegment||path.push(segment.generate(paramTokens))}var urlPath=path.join("/"),nonPositionalParams=paramTokens.getUnused(),urlParams=nonPositionalParams;return new GeneratedUrl(urlPath,urlParams)},ParamRoutePath.prototype.toString=function(){return this.routePath},ParamRoutePath.prototype._parsePathString=function(routePath){routePath.startsWith("/")&&(routePath=routePath.substring(1));var segmentStrings=routePath.split("/");this._segments=[];for(var limit=segmentStrings.length-1,i=0;limit>=i;i++){var match,segment=segmentStrings[i];if(isPresent(match=RegExpWrapper.firstMatch(DynamicPathSegment.paramMatcher,segment)))this._segments.push(new DynamicPathSegment(match[1]));else if(isPresent(match=RegExpWrapper.firstMatch(StarPathSegment.wildcardMatcher,segment)))this._segments.push(new StarPathSegment(match[1]));else if("..."==segment){if(limit>i)throw new BaseException$1('Unexpected "..." before the end of the path for "'+routePath+'".');this._segments.push(new ContinuationPathSegment)}else this._segments.push(new StaticPathSegment(segment))}},ParamRoutePath.prototype._calculateSpecificity=function(){var i,specificity,length=this._segments.length;if(0==length)specificity+="2";else for(specificity="",i=0;length>i;i++)specificity+=this._segments[i].specificity;return specificity},ParamRoutePath.prototype._calculateHash=function(){var i,length=this._segments.length,hashParts=[];for(i=0;length>i;i++)hashParts.push(this._segments[i].hash);return hashParts.join("/")},ParamRoutePath.prototype._assertValidPath=function(path){if(StringWrapper.contains(path,"#"))throw new BaseException$1('Path "'+path+'" should not include "#". Use "HashLocationStrategy" instead.');var illegalCharacter=RegExpWrapper.firstMatch(ParamRoutePath.RESERVED_CHARS,path);if(isPresent(illegalCharacter))throw new BaseException$1('Path "'+path+'" contains "'+illegalCharacter[0]+'" which is not allowed in a route config.')},ParamRoutePath}();ParamRoutePath.RESERVED_CHARS=RegExpWrapper.create("//|\\(|\\)|;|\\?|=");var REGEXP_PERCENT=/%/g,REGEXP_SLASH=/\//g,REGEXP_OPEN_PARENT=/\(/g,REGEXP_CLOSE_PARENT=/\)/g,REGEXP_SEMICOLON=/;/g,REGEXP_ENC_SEMICOLON=/%3B/gi,REGEXP_ENC_CLOSE_PARENT=/%29/gi,REGEXP_ENC_OPEN_PARENT=/%28/gi,REGEXP_ENC_SLASH=/%2F/gi,REGEXP_ENC_PERCENT=/%25/gi,RegexRoutePath=function(){function RegexRoutePath(_reString,_serializer,_groupNames){if(this._reString=_reString,this._serializer=_serializer,this._groupNames=_groupNames,this.terminal=!0,this.specificity="2",this.hash=this._reString,this._regex=RegExpWrapper.create(this._reString),null!=this._groupNames){var groups=computeNumberOfRegexGroups(this._reString);if(groups!=_groupNames.length)throw new _angular_core.BaseException("Regex group names ["+this._groupNames.join(",")+"] must contain names for each matching group and a name for the complete match as its first element of regex '"+this._reString+"'. "+groups+" group names are expected.")}}return RegexRoutePath.prototype.matchUrl=function(url){var urlPath=url.toString(),params={},matcher=RegExpWrapper.matcher(this._regex,urlPath),match=RegExpMatcherWrapper.next(matcher);if(isBlank(match))return null;for(var i=0;i<match.length;i+=1)params[null!=this._groupNames?this._groupNames[i]:i.toString()]=match[i];return new MatchedUrl(urlPath,[],params,[],null)},RegexRoutePath.prototype.generateUrl=function(params){return this._serializer(params)},RegexRoutePath.prototype.toString=function(){return this._reString},RegexRoutePath}(),RuleSet=function(){function RuleSet(){this.rulesByName=new Map$1,this.auxRulesByName=new Map$1,this.auxRulesByPath=new Map$1,this.rules=[],this.defaultRule=null}return RuleSet.prototype.config=function(config){var handler;if(isPresent(config.name)&&config.name[0].toUpperCase()!=config.name[0]){var suggestedName=config.name[0].toUpperCase()+config.name.substring(1);throw new BaseException$1('Route "'+config.path+'" with name "'+config.name+'" does not begin with an uppercase letter. Route names should be PascalCase like "'+suggestedName+'".')}if(config instanceof AuxRoute){handler=new SyncRouteHandler(config.component,config.data);var routePath_1=this._getRoutePath(config),auxRule=new RouteRule(routePath_1,handler,config.name);return this.auxRulesByPath.set(routePath_1.toString(),auxRule),isPresent(config.name)&&this.auxRulesByName.set(config.name,auxRule),auxRule.terminal}var useAsDefault=!1;if(config instanceof Redirect){var routePath_2=this._getRoutePath(config),redirector=new RedirectRule(routePath_2,config.redirectTo);return this._assertNoHashCollision(redirector.hash,config.path),this.rules.push(redirector),!0}config instanceof Route?(handler=new SyncRouteHandler(config.component,config.data),useAsDefault=isPresent(config.useAsDefault)&&config.useAsDefault):config instanceof AsyncRoute&&(handler=new AsyncRouteHandler(config.loader,config.data),useAsDefault=isPresent(config.useAsDefault)&&config.useAsDefault);var routePath=this._getRoutePath(config),newRule=new RouteRule(routePath,handler,config.name);if(this._assertNoHashCollision(newRule.hash,config.path),useAsDefault){if(isPresent(this.defaultRule))throw new BaseException$1("Only one route can be default");this.defaultRule=newRule}return this.rules.push(newRule),isPresent(config.name)&&this.rulesByName.set(config.name,newRule),newRule.terminal},RuleSet.prototype.recognize=function(urlParse){var solutions=[];return this.rules.forEach(function(routeRecognizer){var pathMatch=routeRecognizer.recognize(urlParse);isPresent(pathMatch)&&solutions.push(pathMatch)}),0==solutions.length&&isPresent(urlParse)&&urlParse.auxiliary.length>0?[PromiseWrapper.resolve(new PathMatch(null,null,urlParse.auxiliary))]:solutions},RuleSet.prototype.recognizeAuxiliary=function(urlParse){var routeRecognizer=this.auxRulesByPath.get(urlParse.path);return isPresent(routeRecognizer)?[routeRecognizer.recognize(urlParse)]:[PromiseWrapper.resolve(null)]},RuleSet.prototype.hasRoute=function(name){return this.rulesByName.has(name)},RuleSet.prototype.componentLoaded=function(name){return this.hasRoute(name)&&isPresent(this.rulesByName.get(name).handler.componentType)},RuleSet.prototype.loadComponent=function(name){return this.rulesByName.get(name).handler.resolveComponentType()},RuleSet.prototype.generate=function(name,params){var rule=this.rulesByName.get(name);return isBlank(rule)?null:rule.generate(params)},RuleSet.prototype.generateAuxiliary=function(name,params){var rule=this.auxRulesByName.get(name);return isBlank(rule)?null:rule.generate(params)},RuleSet.prototype._assertNoHashCollision=function(hash,path){this.rules.forEach(function(rule){if(hash==rule.hash)throw new BaseException$1("Configuration '"+path+"' conflicts with existing route '"+rule.path+"'")})},RuleSet.prototype._getRoutePath=function(config){if(isPresent(config.regex)){if(isFunction(config.serializer))return new RegexRoutePath(config.regex,config.serializer,config.regex_group_names);throw new BaseException$1("Route provides a regex property, '"+config.regex+"', but no serializer property")}if(isPresent(config.path)){var path=config instanceof AuxRoute&&config.path.startsWith("/")?config.path.substring(1):config.path;return new ParamRoutePath(path)}throw new BaseException$1("Route must provide either a path or regex property")},RuleSet}(),RouteConfig=makeDecorator(RouteConfigAnnotation),__decorate$2=this&&this.__decorate||function(decorators,target,key,desc){var d,c=arguments.length,r=3>c?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(3>c?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},__metadata$2=this&&this.__metadata||function(k,v){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(k,v):void 0},__param$1=this&&this.__param||function(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}},_resolveToNull=PromiseWrapper.resolve(null),ROUTER_PRIMARY_COMPONENT=new _angular_core.OpaqueToken("RouterPrimaryComponent");exports.RouteRegistry=function(){function RouteRegistry(_rootComponent){this._rootComponent=_rootComponent,this._rules=new Map$1}return RouteRegistry.prototype.config=function(parentComponent,config){config=normalizeRouteConfig(config,this),config instanceof Route?assertComponentExists(config.component,config.path):config instanceof AuxRoute&&assertComponentExists(config.component,config.path);var rules=this._rules.get(parentComponent);isBlank(rules)&&(rules=new RuleSet,this._rules.set(parentComponent,rules));var terminal=rules.config(config);config instanceof Route&&(terminal?assertTerminalComponent(config.component,config.path):this.configFromComponent(config.component))},RouteRegistry.prototype.configFromComponent=function(component){var _this=this;if(isType(component)&&!this._rules.has(component)){var annotations=reflector.annotations(component);if(isPresent(annotations))for(var i=0;i<annotations.length;i++){var annotation=annotations[i];if(annotation instanceof RouteConfigAnnotation){var routeCfgs=annotation.configs;routeCfgs.forEach(function(config){return _this.config(component,config)})}}}},RouteRegistry.prototype.recognize=function(url){var parsedUrl=parser.parse(url);return this._recognize(parsedUrl,[])},RouteRegistry.prototype._recognize=function(parsedUrl,ancestorInstructions,_aux){var _this=this;void 0===_aux&&(_aux=!1);var parentInstruction=ListWrapper.last(ancestorInstructions),parentComponent=isPresent(parentInstruction)?parentInstruction.component.componentType:this._rootComponent,rules=this._rules.get(parentComponent);if(isBlank(rules))return _resolveToNull;var possibleMatches=_aux?rules.recognizeAuxiliary(parsedUrl):rules.recognize(parsedUrl),matchPromises=possibleMatches.map(function(candidate){return candidate.then(function(candidate){if(candidate instanceof PathMatch){var auxParentInstructions=ancestorInstructions.length>0?[ListWrapper.last(ancestorInstructions)]:[],auxInstructions=_this._auxRoutesToUnresolved(candidate.remainingAux,auxParentInstructions),instruction=new ResolvedInstruction(candidate.instruction,null,auxInstructions);if(isBlank(candidate.instruction)||candidate.instruction.terminal)return instruction;var newAncestorInstructions=ancestorInstructions.concat([instruction]);return _this._recognize(candidate.remaining,newAncestorInstructions).then(function(childInstruction){return isBlank(childInstruction)?null:childInstruction instanceof RedirectInstruction?childInstruction:(instruction.child=childInstruction,instruction)})}if(candidate instanceof RedirectMatch){var instruction=_this.generate(candidate.redirectTo,ancestorInstructions.concat([null]));return new RedirectInstruction(instruction.component,instruction.child,instruction.auxInstruction,candidate.specificity)}})});return!isBlank(parsedUrl)&&""!=parsedUrl.path||0!=possibleMatches.length?PromiseWrapper.all(matchPromises).then(mostSpecific):PromiseWrapper.resolve(this.generateDefault(parentComponent))},RouteRegistry.prototype._auxRoutesToUnresolved=function(auxRoutes,parentInstructions){var _this=this,unresolvedAuxInstructions={};return auxRoutes.forEach(function(auxUrl){unresolvedAuxInstructions[auxUrl.path]=new UnresolvedInstruction(function(){return _this._recognize(auxUrl,parentInstructions,!0)})}),unresolvedAuxInstructions},RouteRegistry.prototype.generate=function(linkParams,ancestorInstructions,_aux){void 0===_aux&&(_aux=!1);var prevInstruction,params=splitAndFlattenLinkParams(linkParams);if(""==ListWrapper.first(params))params.shift(),prevInstruction=ListWrapper.first(ancestorInstructions),ancestorInstructions=[];else if(prevInstruction=ancestorInstructions.length>0?ancestorInstructions.pop():null,"."==ListWrapper.first(params))params.shift();else if(".."==ListWrapper.first(params))for(;".."==ListWrapper.first(params);){if(ancestorInstructions.length<=0)throw new BaseException$1('Link "'+ListWrapper.toJSON(linkParams)+'" has too many "../" segments.');prevInstruction=ancestorInstructions.pop(),params=ListWrapper.slice(params,1)}else{var routeName=ListWrapper.first(params),parentComponentType=this._rootComponent,grandparentComponentType=null;if(ancestorInstructions.length>1){var parentComponentInstruction=ancestorInstructions[ancestorInstructions.length-1],grandComponentInstruction=ancestorInstructions[ancestorInstructions.length-2];parentComponentType=parentComponentInstruction.component.componentType,grandparentComponentType=grandComponentInstruction.component.componentType}else 1==ancestorInstructions.length&&(parentComponentType=ancestorInstructions[0].component.componentType,grandparentComponentType=this._rootComponent);var childRouteExists=this.hasRoute(routeName,parentComponentType),parentRouteExists=isPresent(grandparentComponentType)&&this.hasRoute(routeName,grandparentComponentType);if(parentRouteExists&&childRouteExists){var msg='Link "'+ListWrapper.toJSON(linkParams)+'" is ambiguous, use "./" or "../" to disambiguate.';throw new BaseException$1(msg)}parentRouteExists&&(prevInstruction=ancestorInstructions.pop())}if(""==params[params.length-1]&&params.pop(),params.length>0&&""==params[0]&&params.shift(),params.length<1){var msg='Link "'+ListWrapper.toJSON(linkParams)+'" must include a route name.';throw new BaseException$1(msg)}for(var generatedInstruction=this._generate(params,ancestorInstructions,prevInstruction,_aux,linkParams),i=ancestorInstructions.length-1;i>=0;i--){var ancestorInstruction=ancestorInstructions[i];if(isBlank(ancestorInstruction))break;generatedInstruction=ancestorInstruction.replaceChild(generatedInstruction)}return generatedInstruction},RouteRegistry.prototype._generate=function(linkParams,ancestorInstructions,prevInstruction,_aux,_originalLink){var _this=this;void 0===_aux&&(_aux=!1);var parentComponentType=this._rootComponent,componentInstruction=null,auxInstructions={},parentInstruction=ListWrapper.last(ancestorInstructions);if(isPresent(parentInstruction)&&isPresent(parentInstruction.component)&&(parentComponentType=parentInstruction.component.componentType),0==linkParams.length){var defaultInstruction=this.generateDefault(parentComponentType);if(isBlank(defaultInstruction))throw new BaseException$1('Link "'+ListWrapper.toJSON(_originalLink)+'" does not resolve to a terminal instruction.');return defaultInstruction}isPresent(prevInstruction)&&!_aux&&(auxInstructions=StringMapWrapper.merge(prevInstruction.auxInstruction,auxInstructions),componentInstruction=prevInstruction.component);var rules=this._rules.get(parentComponentType);if(isBlank(rules))throw new BaseException$1('Component "'+getTypeNameForDebugging(parentComponentType)+'" has no route config.');var linkParamIndex=0,routeParams={};if(linkParamIndex<linkParams.length&&isString(linkParams[linkParamIndex])){var routeName=linkParams[linkParamIndex];if(""==routeName||"."==routeName||".."==routeName)throw new BaseException$1('"'+routeName+'/" is only allowed at the beginning of a link DSL.');if(linkParamIndex+=1,linkParamIndex<linkParams.length){var linkParam=linkParams[linkParamIndex];isStringMap(linkParam)&&!isArray(linkParam)&&(routeParams=linkParam,linkParamIndex+=1)}var routeRecognizer=(_aux?rules.auxRulesByName:rules.rulesByName).get(routeName);if(isBlank(routeRecognizer))throw new BaseException$1('Component "'+getTypeNameForDebugging(parentComponentType)+'" has no route named "'+routeName+'".');if(isBlank(routeRecognizer.handler.componentType)){var generatedUrl=routeRecognizer.generateComponentPathValues(routeParams);return new UnresolvedInstruction(function(){return routeRecognizer.handler.resolveComponentType().then(function(){return _this._generate(linkParams,ancestorInstructions,prevInstruction,_aux,_originalLink)})},generatedUrl.urlPath,convertUrlParamsToArray(generatedUrl.urlParams))}componentInstruction=_aux?rules.generateAuxiliary(routeName,routeParams):rules.generate(routeName,routeParams)}for(;linkParamIndex<linkParams.length&&isArray(linkParams[linkParamIndex]);){var auxParentInstruction=[parentInstruction],auxInstruction=this._generate(linkParams[linkParamIndex],auxParentInstruction,null,!0,_originalLink);auxInstructions[auxInstruction.component.urlPath]=auxInstruction,linkParamIndex+=1}var instruction=new ResolvedInstruction(componentInstruction,null,auxInstructions);if(isPresent(componentInstruction)&&isPresent(componentInstruction.componentType)){var childInstruction=null;if(componentInstruction.terminal)linkParamIndex>=linkParams.length;else{var childAncestorComponents=ancestorInstructions.concat([instruction]),remainingLinkParams=linkParams.slice(linkParamIndex);childInstruction=this._generate(remainingLinkParams,childAncestorComponents,null,!1,_originalLink)}instruction.child=childInstruction}return instruction},RouteRegistry.prototype.hasRoute=function(name,parentComponent){var rules=this._rules.get(parentComponent);return isBlank(rules)?!1:rules.hasRoute(name)},RouteRegistry.prototype.generateDefault=function(componentCursor){var _this=this;if(isBlank(componentCursor))return null;var rules=this._rules.get(componentCursor);if(isBlank(rules)||isBlank(rules.defaultRule))return null;var defaultChild=null;if(isPresent(rules.defaultRule.handler.componentType)){var componentInstruction=rules.defaultRule.generate({});return rules.defaultRule.terminal||(defaultChild=this.generateDefault(rules.defaultRule.handler.componentType)),new DefaultInstruction(componentInstruction,defaultChild)}return new UnresolvedInstruction(function(){return rules.defaultRule.handler.resolveComponentType().then(function(){return _this.generateDefault(componentCursor)})})},RouteRegistry}(),exports.RouteRegistry=__decorate$2([_angular_core.Injectable(),__param$1(0,_angular_core.Inject(ROUTER_PRIMARY_COMPONENT)),__metadata$2("design:paramtypes",[Type$1])],exports.RouteRegistry);var __decorate$1=this&&this.__decorate||function(decorators,target,key,desc){var d,c=arguments.length,r=3>c?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(3>c?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},__metadata$1=this&&this.__metadata||function(k,v){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(k,v):void 0},__param=this&&this.__param||function(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}},_resolveToTrue=PromiseWrapper.resolve(!0),_resolveToFalse=PromiseWrapper.resolve(!1);exports.Router=function(){function Router(registry,parent,hostComponent,root){this.registry=registry,this.parent=parent,this.hostComponent=hostComponent,this.root=root,this.navigating=!1,this.currentInstruction=null,this._currentNavigation=_resolveToTrue,this._outlet=null,this._auxRouters=new Map$1,this._subject=new EventEmitter}return Router.prototype.childRouter=function(hostComponent){return this._childRouter=new ChildRouter(this,hostComponent)},Router.prototype.auxRouter=function(hostComponent){return new ChildRouter(this,hostComponent)},Router.prototype.registerPrimaryOutlet=function(outlet){if(isPresent(outlet.name))throw new BaseException$1("registerPrimaryOutlet expects to be called with an unnamed outlet.");if(isPresent(this._outlet))throw new BaseException$1("Primary outlet is already registered.");return this._outlet=outlet,isPresent(this.currentInstruction)?this.commit(this.currentInstruction,!1):_resolveToTrue},Router.prototype.unregisterPrimaryOutlet=function(outlet){if(isPresent(outlet.name))throw new BaseException$1("registerPrimaryOutlet expects to be called with an unnamed outlet.");this._outlet=null},Router.prototype.registerAuxOutlet=function(outlet){var outletName=outlet.name;if(isBlank(outletName))throw new BaseException$1("registerAuxOutlet expects to be called with an outlet with a name.");var router=this.auxRouter(this.hostComponent);this._auxRouters.set(outletName,router),router._outlet=outlet;var auxInstruction;return isPresent(this.currentInstruction)&&isPresent(auxInstruction=this.currentInstruction.auxInstruction[outletName])?router.commit(auxInstruction):_resolveToTrue},Router.prototype.isRouteActive=function(instruction){var router=this,currentInstruction=this.currentInstruction;if(isBlank(currentInstruction))return!1;for(;isPresent(router.parent)&&isPresent(instruction.child);)router=router.parent,instruction=instruction.child;var reason=!0;do{if(isBlank(instruction.component)||isBlank(currentInstruction.component)||currentInstruction.component.routeName!=instruction.component.routeName)return!1;isPresent(instruction.component.params)&&StringMapWrapper.forEach(instruction.component.params,function(value,key){currentInstruction.component.params[key]!==value&&(reason=!1)}),currentInstruction=currentInstruction.child,instruction=instruction.child}while(isPresent(currentInstruction)&&isPresent(instruction)&&!(instruction instanceof DefaultInstruction)&&reason);return reason&&(isBlank(instruction)||instruction instanceof DefaultInstruction)},Router.prototype.config=function(definitions){var _this=this;return definitions.forEach(function(routeDefinition){_this.registry.config(_this.hostComponent,routeDefinition)}),this.renavigate()},Router.prototype.navigate=function(linkParams){var instruction=this.generate(linkParams);return this.navigateByInstruction(instruction,!1)},Router.prototype.navigateByUrl=function(url,_skipLocationChange){var _this=this;return void 0===_skipLocationChange&&(_skipLocationChange=!1),this._currentNavigation=this._currentNavigation.then(function(){return _this.lastNavigationAttempt=url,_this._startNavigating(),_this._afterPromiseFinishNavigating(_this.recognize(url).then(function(instruction){return isBlank(instruction)?!1:_this._navigate(instruction,_skipLocationChange)}))})},Router.prototype.navigateByInstruction=function(instruction,_skipLocationChange){var _this=this;return void 0===_skipLocationChange&&(_skipLocationChange=!1),isBlank(instruction)?_resolveToFalse:this._currentNavigation=this._currentNavigation.then(function(){return _this._startNavigating(),_this._afterPromiseFinishNavigating(_this._navigate(instruction,_skipLocationChange))})},Router.prototype._settleInstruction=function(instruction){var _this=this;return instruction.resolveComponent().then(function(){var unsettledInstructions=[];return isPresent(instruction.component)&&(instruction.component.reuse=!1),isPresent(instruction.child)&&unsettledInstructions.push(_this._settleInstruction(instruction.child)),StringMapWrapper.forEach(instruction.auxInstruction,function(instruction){unsettledInstructions.push(_this._settleInstruction(instruction))}),PromiseWrapper.all(unsettledInstructions)})},Router.prototype._navigate=function(instruction,_skipLocationChange){var _this=this;return this._settleInstruction(instruction).then(function(){return _this._routerCanReuse(instruction)}).then(function(){return _this._canActivate(instruction)}).then(function(result){return result?_this._routerCanDeactivate(instruction).then(function(result){return result?_this.commit(instruction,_skipLocationChange).then(function(){return _this._emitNavigationFinish(instruction.component),!0}):void 0}):!1})},Router.prototype._emitNavigationFinish=function(instruction){ObservableWrapper.callEmit(this._subject,{status:"success",instruction:instruction})},Router.prototype._emitNavigationFail=function(url){ObservableWrapper.callEmit(this._subject,{status:"fail",url:url})},Router.prototype._afterPromiseFinishNavigating=function(promise){var _this=this;
3return PromiseWrapper.catchError(promise.then(function(){return _this._finishNavigating()}),function(err){throw _this._finishNavigating(),err})},Router.prototype._routerCanReuse=function(instruction){var _this=this;return isBlank(this._outlet)?_resolveToFalse:isBlank(instruction.component)?_resolveToTrue:this._outlet.routerCanReuse(instruction.component).then(function(result){return instruction.component.reuse=result,result&&isPresent(_this._childRouter)&&isPresent(instruction.child)?_this._childRouter._routerCanReuse(instruction.child):void 0})},Router.prototype._canActivate=function(nextInstruction){return canActivateOne(nextInstruction,this.currentInstruction)},Router.prototype._routerCanDeactivate=function(instruction){var _this=this;if(isBlank(this._outlet))return _resolveToTrue;var next,childInstruction=null,reuse=!1,componentInstruction=null;return isPresent(instruction)&&(childInstruction=instruction.child,componentInstruction=instruction.component,reuse=isBlank(instruction.component)||instruction.component.reuse),next=reuse?_resolveToTrue:this._outlet.routerCanDeactivate(componentInstruction),next.then(function(result){return 0==result?!1:isPresent(_this._childRouter)?_this._childRouter._routerCanDeactivate(childInstruction):!0})},Router.prototype.commit=function(instruction,_skipLocationChange){var _this=this;void 0===_skipLocationChange&&(_skipLocationChange=!1),this.currentInstruction=instruction;var next=_resolveToTrue;if(isPresent(this._outlet)&&isPresent(instruction.component)){var componentInstruction=instruction.component;next=componentInstruction.reuse?this._outlet.reuse(componentInstruction):this.deactivate(instruction).then(function(){return _this._outlet.activate(componentInstruction)}),isPresent(instruction.child)&&(next=next.then(function(){return isPresent(_this._childRouter)?_this._childRouter.commit(instruction.child):void 0}))}var promises=[];return this._auxRouters.forEach(function(router,name){isPresent(instruction.auxInstruction[name])&&promises.push(router.commit(instruction.auxInstruction[name]))}),next.then(function(){return PromiseWrapper.all(promises)})},Router.prototype._startNavigating=function(){this.navigating=!0},Router.prototype._finishNavigating=function(){this.navigating=!1},Router.prototype.subscribe=function(onNext,onError){return ObservableWrapper.subscribe(this._subject,onNext,onError)},Router.prototype.deactivate=function(instruction){var _this=this,childInstruction=null,componentInstruction=null;isPresent(instruction)&&(childInstruction=instruction.child,componentInstruction=instruction.component);var next=_resolveToTrue;return isPresent(this._childRouter)&&(next=this._childRouter.deactivate(childInstruction)),isPresent(this._outlet)&&(next=next.then(function(){return _this._outlet.deactivate(componentInstruction)})),next},Router.prototype.recognize=function(url){var ancestorComponents=this._getAncestorInstructions();return this.registry.recognize(url,ancestorComponents)},Router.prototype._getAncestorInstructions=function(){for(var ancestorInstructions=[this.currentInstruction],ancestorRouter=this;isPresent(ancestorRouter=ancestorRouter.parent);)ancestorInstructions.unshift(ancestorRouter.currentInstruction);return ancestorInstructions},Router.prototype.renavigate=function(){return isBlank(this.lastNavigationAttempt)?this._currentNavigation:this.navigateByUrl(this.lastNavigationAttempt)},Router.prototype.generate=function(linkParams){var ancestorInstructions=this._getAncestorInstructions();return this.registry.generate(linkParams,ancestorInstructions)},Router}(),exports.Router=__decorate$1([_angular_core.Injectable(),__metadata$1("design:paramtypes",[exports.RouteRegistry,exports.Router,Object,exports.Router])],exports.Router),exports.RootRouter=function(_super){function RootRouter(registry,location,primaryComponent){var _this=this;_super.call(this,registry,null,primaryComponent),this.root=this,this._location=location,this._locationSub=this._location.subscribe(function(change){_this.recognize(change.url).then(function(instruction){isPresent(instruction)?_this.navigateByInstruction(instruction,isPresent(change.pop)).then(function(){if(!isPresent(change.pop)||"hashchange"==change.type){var emitPath=instruction.toUrlPath(),emitQuery=instruction.toUrlQuery();emitPath.length>0&&"/"!=emitPath[0]&&(emitPath="/"+emitPath),"hashchange"==change.type?instruction.toRootUrl()!=_this._location.path()&&_this._location.replaceState(emitPath,emitQuery):_this._location.go(emitPath,emitQuery)}}):_this._emitNavigationFail(change.url)})}),this.registry.configFromComponent(primaryComponent),this.navigateByUrl(location.path())}return __extends(RootRouter,_super),RootRouter.prototype.commit=function(instruction,_skipLocationChange){var _this=this;void 0===_skipLocationChange&&(_skipLocationChange=!1);var emitPath=instruction.toUrlPath(),emitQuery=instruction.toUrlQuery();emitPath.length>0&&"/"!=emitPath[0]&&(emitPath="/"+emitPath);var promise=_super.prototype.commit.call(this,instruction);return _skipLocationChange||(promise=this._location.isCurrentPathEqualTo(emitPath,emitQuery)?promise.then(function(){_this._location.replaceState(emitPath,emitQuery)}):promise.then(function(){_this._location.go(emitPath,emitQuery)})),promise},RootRouter.prototype.dispose=function(){isPresent(this._locationSub)&&(ObservableWrapper.dispose(this._locationSub),this._locationSub=null)},RootRouter}(exports.Router),exports.RootRouter=__decorate$1([_angular_core.Injectable(),__param(2,_angular_core.Inject(ROUTER_PRIMARY_COMPONENT)),__metadata$1("design:paramtypes",[exports.RouteRegistry,_angular_common.Location,Type$1])],exports.RootRouter);var ChildRouter=function(_super){function ChildRouter(parent,hostComponent){_super.call(this,parent.registry,parent,hostComponent,parent.root),this.parent=parent}return __extends(ChildRouter,_super),ChildRouter.prototype.navigateByUrl=function(url,_skipLocationChange){return void 0===_skipLocationChange&&(_skipLocationChange=!1),this.parent.navigateByUrl(url,_skipLocationChange)},ChildRouter.prototype.navigateByInstruction=function(instruction,_skipLocationChange){return void 0===_skipLocationChange&&(_skipLocationChange=!1),this.parent.navigateByInstruction(instruction,_skipLocationChange)},ChildRouter}(exports.Router),__decorate=this&&this.__decorate||function(decorators,target,key,desc){var d,c=arguments.length,r=3>c?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(3>c?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},__metadata=this&&this.__metadata||function(k,v){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(k,v):void 0};exports.RouterLink=function(){function RouterLink(_router,_location){var _this=this;this._router=_router,this._location=_location,this._router.subscribe(function(){return _this._updateLink()})}return RouterLink.prototype._updateLink=function(){this._navigationInstruction=this._router.generate(this._routeParams);var navigationHref=this._navigationInstruction.toLinkUrl();this.visibleHref=this._location.prepareExternalUrl(navigationHref)},Object.defineProperty(RouterLink.prototype,"isRouteActive",{get:function(){return this._router.isRouteActive(this._navigationInstruction)},enumerable:!0,configurable:!0}),Object.defineProperty(RouterLink.prototype,"routeParams",{set:function(changes){this._routeParams=changes,this._updateLink()},enumerable:!0,configurable:!0}),RouterLink.prototype.onClick=function(){return isString(this.target)&&"_self"!=this.target?!0:(this._router.navigateByInstruction(this._navigationInstruction),!1)},RouterLink}(),exports.RouterLink=__decorate([_angular_core.Directive({selector:"[routerLink]",inputs:["routeParams: routerLink","target: target"],host:{"(click)":"onClick()","[attr.href]":"visibleHref","[class.router-link-active]":"isRouteActive"}}),__metadata("design:paramtypes",[exports.Router,_angular_common.Location])],exports.RouterLink);var CanActivate=makeDecorator(CanActivateAnnotation),__decorate$3=this&&this.__decorate||function(decorators,target,key,desc){var d,c=arguments.length,r=3>c?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(3>c?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},__metadata$3=this&&this.__metadata||function(k,v){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(k,v):void 0},__param$2=this&&this.__param||function(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}},_resolveToTrue$1=PromiseWrapper.resolve(!0);exports.RouterOutlet=function(){function RouterOutlet(_viewContainerRef,_loader,_parentRouter,nameAttr){this._viewContainerRef=_viewContainerRef,this._loader=_loader,this._parentRouter=_parentRouter,this.name=null,this._componentRef=null,this._currentInstruction=null,this.activateEvents=new EventEmitter,isPresent(nameAttr)?(this.name=nameAttr,this._parentRouter.registerAuxOutlet(this)):this._parentRouter.registerPrimaryOutlet(this)}return RouterOutlet.prototype.activate=function(nextInstruction){var _this=this,previousInstruction=this._currentInstruction;this._currentInstruction=nextInstruction;var componentType=nextInstruction.componentType,childRouter=this._parentRouter.childRouter(componentType),providers=_angular_core.ReflectiveInjector.resolve([{provide:RouteData,useValue:nextInstruction.routeData},{provide:RouteParams,useValue:new RouteParams(nextInstruction.params)},{provide:exports.Router,useValue:childRouter}]);return this._componentRef=this._loader.loadNextToLocation(componentType,this._viewContainerRef,providers),this._componentRef.then(function(componentRef){return _this.activateEvents.emit(componentRef.instance),hasLifecycleHook(routerOnActivate,componentType)?_this._componentRef.then(function(ref){return ref.instance.routerOnActivate(nextInstruction,previousInstruction)}):componentRef})},RouterOutlet.prototype.reuse=function(nextInstruction){var previousInstruction=this._currentInstruction;return this._currentInstruction=nextInstruction,isBlank(this._componentRef)?this.activate(nextInstruction):PromiseWrapper.resolve(hasLifecycleHook(routerOnReuse,this._currentInstruction.componentType)?this._componentRef.then(function(ref){return ref.instance.routerOnReuse(nextInstruction,previousInstruction)}):!0)},RouterOutlet.prototype.deactivate=function(nextInstruction){var _this=this,next=_resolveToTrue$1;return isPresent(this._componentRef)&&isPresent(this._currentInstruction)&&hasLifecycleHook(routerOnDeactivate,this._currentInstruction.componentType)&&(next=this._componentRef.then(function(ref){return ref.instance.routerOnDeactivate(nextInstruction,_this._currentInstruction)})),next.then(function(){if(isPresent(_this._componentRef)){var onDispose=_this._componentRef.then(function(ref){return ref.destroy()});return _this._componentRef=null,onDispose}})},RouterOutlet.prototype.routerCanDeactivate=function(nextInstruction){var _this=this;return isBlank(this._currentInstruction)?_resolveToTrue$1:hasLifecycleHook(routerCanDeactivate,this._currentInstruction.componentType)?this._componentRef.then(function(ref){return ref.instance.routerCanDeactivate(nextInstruction,_this._currentInstruction)}):_resolveToTrue$1},RouterOutlet.prototype.routerCanReuse=function(nextInstruction){var result,_this=this;return result=isBlank(this._currentInstruction)||this._currentInstruction.componentType!=nextInstruction.componentType?!1:hasLifecycleHook(routerCanReuse,this._currentInstruction.componentType)?this._componentRef.then(function(ref){return ref.instance.routerCanReuse(nextInstruction,_this._currentInstruction)}):nextInstruction==this._currentInstruction||isPresent(nextInstruction.params)&&isPresent(this._currentInstruction.params)&&StringMapWrapper.equals(nextInstruction.params,this._currentInstruction.params),PromiseWrapper.resolve(result)},RouterOutlet.prototype.ngOnDestroy=function(){this._parentRouter.unregisterPrimaryOutlet(this)},RouterOutlet}(),__decorate$3([_angular_core.Output("activate"),__metadata$3("design:type",Object)],exports.RouterOutlet.prototype,"activateEvents",void 0),exports.RouterOutlet=__decorate$3([_angular_core.Directive({selector:"router-outlet"}),__param$2(3,_angular_core.Attribute("name")),__metadata$3("design:paramtypes",[_angular_core.ViewContainerRef,_angular_core.DynamicComponentLoader,exports.Router,String])],exports.RouterOutlet);var ROUTER_PROVIDERS_COMMON=[exports.RouteRegistry,{provide:_angular_common.LocationStrategy,useClass:_angular_common.PathLocationStrategy},_angular_common.Location,{provide:exports.Router,useFactory:routerFactory,deps:[exports.RouteRegistry,_angular_common.Location,ROUTER_PRIMARY_COMPONENT,_angular_core.ApplicationRef]},{provide:ROUTER_PRIMARY_COMPONENT,useFactory:routerPrimaryComponentFactory,deps:[_angular_core.ApplicationRef]}],ROUTER_PROVIDERS=[ROUTER_PROVIDERS_COMMON,{provide:_angular_common.PlatformLocation,useClass:_angular_platformBrowser.BrowserPlatformLocation}],ROUTER_BINDINGS=ROUTER_PROVIDERS,ROUTER_DIRECTIVES=[exports.RouterOutlet,exports.RouterLink];exports.ROUTER_DIRECTIVES=ROUTER_DIRECTIVES,exports.RouteData=RouteData,exports.RouteParams=RouteParams,exports.ROUTER_PRIMARY_COMPONENT=ROUTER_PRIMARY_COMPONENT,exports.CanActivate=CanActivate,exports.Instruction=Instruction,exports.ComponentInstruction=ComponentInstruction,exports.OpaqueToken=_angular_core.OpaqueToken,exports.ROUTER_PROVIDERS_COMMON=ROUTER_PROVIDERS_COMMON,exports.ROUTER_PROVIDERS=ROUTER_PROVIDERS,exports.ROUTER_BINDINGS=ROUTER_BINDINGS,exports.RouteConfig=RouteConfig,exports.AsyncRoute=AsyncRoute,exports.AuxRoute=AuxRoute,exports.Redirect=Redirect,exports.Route=Route});
\No newline at end of file